Version Description
19.04.2022
- Tweak: Refactored some of the GA4 functions
- Tweak: Changed escaping method for outputting the titles and names into the wpmDataLayer in order to properly deal with characters like a dash, ampersand, etc.
- Tweak: Load categories for variations from parent product, because on some installs the variations don't inherit the parent product's categories
- Tweak: Removed more cruft from the code and improved the syntax here and there
- Tweak: Adjusted validation for the Google Merchant Center ID
- Tweak: Updated selectWoo.full.*.js
- Tweak: Tested up to WooCommerce 6.4
Download this release
Release Info
Developer | alekv |
Plugin | Pixel Manager for WooCommerce – Track Google Analytics, Google Ads, Facebook and more |
Version | 1.16.9 |
Comparing to | |
See all releases |
Code changes from version 1.16.8 to 1.16.9
- classes/admin/class-admin.php +2 -2
- classes/admin/class-consent-mode-regions.php +1 -0
- classes/admin/class-validations.php +1 -1
- classes/pixels/class-pixel-manager.php +36 -5
- classes/pixels/google/class-google-pixel-manager.php +22 -4
- classes/pixels/trait-product.php +20 -18
- classes/pixels/trait-shop.php +74 -3
- js/admin/main.min.js +1 -0
- js/admin/selectWoo.full.js +6599 -0
- js/admin/selectWoo.full.min.js +1 -1
- js/public/wpm-public.p1.min.js +1 -1
- js/public/wpm-public.p1.min.js.map +1 -1
- readme.txt +16 -6
- wgact.php +3 -3
classes/admin/class-admin.php
CHANGED
@@ -1383,7 +1383,7 @@ class Admin
|
|
1383 |
?>
|
1384 |
<select id="wpm_setting_google_consent_regions" multiple="multiple"
|
1385 |
name="wgact_plugin_options[google][consent_mode][regions][]"
|
1386 |
-
style="width:350px;
|
1387 |
class="wc-enhanced-select"
|
1388 |
<?php
|
1389 |
esc_html_e( $this->disable_if_demo() );
|
@@ -2424,7 +2424,7 @@ class Admin
|
|
2424 |
|
2425 |
if ( !$this->validations->is_gads_aw_merchant_id( $input['google']['ads']['aw_merchant_id'] ) ) {
|
2426 |
$input['google']['ads']['aw_merchant_id'] = ( isset( $this->options['google']['ads']['aw_merchant_id'] ) ? $this->options['google']['ads']['aw_merchant_id'] : '' );
|
2427 |
-
add_settings_error( 'wgact_plugin_options', 'invalid-aw-merchant-id', esc_html__( 'You have entered an invalid merchant ID. It only contains
|
2428 |
}
|
2429 |
|
2430 |
}
|
1383 |
?>
|
1384 |
<select id="wpm_setting_google_consent_regions" multiple="multiple"
|
1385 |
name="wgact_plugin_options[google][consent_mode][regions][]"
|
1386 |
+
style="width:350px;" data-placeholder="Choose countries…" aria-label="Country"
|
1387 |
class="wc-enhanced-select"
|
1388 |
<?php
|
1389 |
esc_html_e( $this->disable_if_demo() );
|
2424 |
|
2425 |
if ( !$this->validations->is_gads_aw_merchant_id( $input['google']['ads']['aw_merchant_id'] ) ) {
|
2426 |
$input['google']['ads']['aw_merchant_id'] = ( isset( $this->options['google']['ads']['aw_merchant_id'] ) ? $this->options['google']['ads']['aw_merchant_id'] : '' );
|
2427 |
+
add_settings_error( 'wgact_plugin_options', 'invalid-aw-merchant-id', esc_html__( 'You have entered an invalid merchant ID. It only contains 6 to 12 digits.', 'woocommerce-google-adwords-conversion-tracking-tag' ) );
|
2428 |
}
|
2429 |
|
2430 |
}
|
classes/admin/class-consent-mode-regions.php
CHANGED
@@ -6,6 +6,7 @@ class Consent_Mode_Regions {
|
|
6 |
|
7 |
public function get_consent_mode_regions() {
|
8 |
return [
|
|
|
9 |
'AF' => 'Afghanistan',
|
10 |
'AX' => 'Åland Islands',
|
11 |
'AL' => 'Albania',
|
6 |
|
7 |
public function get_consent_mode_regions() {
|
8 |
return [
|
9 |
+
'EU' => 'European Union',
|
10 |
'AF' => 'Afghanistan',
|
11 |
'AX' => 'Åland Islands',
|
12 |
'AL' => 'Albania',
|
classes/admin/class-validations.php
CHANGED
@@ -49,7 +49,7 @@ class Validations {
|
|
49 |
return true;
|
50 |
}
|
51 |
|
52 |
-
$re = '/^\d{
|
53 |
|
54 |
return $this->validate_with_regex($re, $string);
|
55 |
}
|
49 |
return true;
|
50 |
}
|
51 |
|
52 |
+
$re = '/^\d{6,12}$/m';
|
53 |
|
54 |
return $this->validate_with_regex($re, $string);
|
55 |
}
|
classes/pixels/class-pixel-manager.php
CHANGED
@@ -131,6 +131,38 @@ class Pixel_Manager extends Script_Manager
|
|
131 |
2
|
132 |
);
|
133 |
add_action( 'woocommerce_mini_cart_contents', [ $this, 'woocommerce_mini_cart_contents' ] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
135 |
|
136 |
// Thanks to: https://gist.github.com/mishterk/6b7a4d6e5a91086a5a9b05ace304b5ce#file-mark-wordpress-scripts-as-async-or-defer-php
|
@@ -678,7 +710,7 @@ class Pixel_Manager extends Script_Manager
|
|
678 |
$data['list_id'] = 'product_shop_page_number_' . $this->get_page_number();
|
679 |
$data['page_type'] = 'product_shop';
|
680 |
} elseif ( is_product() ) {
|
681 |
-
$data['list_name'] = 'Product | ' .
|
682 |
$data['list_id'] = 'product_' . sanitize_title( get_the_title() );
|
683 |
$data['page_type'] = 'product';
|
684 |
$product = wc_get_product();
|
@@ -700,7 +732,7 @@ class Pixel_Manager extends Script_Manager
|
|
700 |
$data['list_id'] = 'checkout';
|
701 |
$data['page_type'] = 'checkout';
|
702 |
} elseif ( is_page() ) {
|
703 |
-
$data['list_name'] = 'Page | ' .
|
704 |
$data['list_id'] = 'page_' . sanitize_title( get_the_title() );
|
705 |
$data['page_type'] = 'page';
|
706 |
} elseif ( is_home() ) {
|
@@ -708,7 +740,7 @@ class Pixel_Manager extends Script_Manager
|
|
708 |
$data['list_id'] = 'blog_home';
|
709 |
$data['page_type'] = 'blog_post';
|
710 |
} elseif ( 'post' === get_post_type() ) {
|
711 |
-
$data['list_name'] = 'Blog Post | ' .
|
712 |
$data['list_id'] = 'blog_post_' . sanitize_title( get_the_title() );
|
713 |
$data['page_type'] = 'blog_post';
|
714 |
} else {
|
@@ -748,11 +780,10 @@ class Pixel_Manager extends Script_Manager
|
|
748 |
|
749 |
private function get_general_data()
|
750 |
{
|
751 |
-
|
752 |
'variationsOutput' => (bool) $this->options_obj->general->variations_output,
|
753 |
'userLoggedIn' => is_user_logged_in(),
|
754 |
];
|
755 |
-
return $data;
|
756 |
}
|
757 |
|
758 |
}
|
131 |
2
|
132 |
);
|
133 |
add_action( 'woocommerce_mini_cart_contents', [ $this, 'woocommerce_mini_cart_contents' ] );
|
134 |
+
add_action( 'woocommerce_new_order', [ $this, 'wpm_woocommerce_new_order' ] );
|
135 |
+
}
|
136 |
+
|
137 |
+
public function wpm_woocommerce_new_order( $order_id )
|
138 |
+
{
|
139 |
+
/**
|
140 |
+
* All new orders should be marked as long WPM is active,
|
141 |
+
* so that we know we can process them later through WPM,
|
142 |
+
* and so that we know we should not touch orders that were
|
143 |
+
* placed before WPM was active.
|
144 |
+
*/
|
145 |
+
add_post_meta(
|
146 |
+
$order_id,
|
147 |
+
'_wpm_process_through_wpm',
|
148 |
+
true,
|
149 |
+
true
|
150 |
+
);
|
151 |
+
/**
|
152 |
+
* Set a custom user ID on the order
|
153 |
+
* because WC sets 0 on all order created
|
154 |
+
* manually through the back-end.
|
155 |
+
*/
|
156 |
+
$user_id = 0;
|
157 |
+
if ( is_user_logged_in() ) {
|
158 |
+
$user_id = get_current_user_id();
|
159 |
+
}
|
160 |
+
add_post_meta(
|
161 |
+
$order_id,
|
162 |
+
'_wpm_customer_user',
|
163 |
+
$user_id,
|
164 |
+
true
|
165 |
+
);
|
166 |
}
|
167 |
|
168 |
// Thanks to: https://gist.github.com/mishterk/6b7a4d6e5a91086a5a9b05ace304b5ce#file-mark-wordpress-scripts-as-async-or-defer-php
|
710 |
$data['list_id'] = 'product_shop_page_number_' . $this->get_page_number();
|
711 |
$data['page_type'] = 'product_shop';
|
712 |
} elseif ( is_product() ) {
|
713 |
+
$data['list_name'] = 'Product | ' . $this->wpm_get_the_title();
|
714 |
$data['list_id'] = 'product_' . sanitize_title( get_the_title() );
|
715 |
$data['page_type'] = 'product';
|
716 |
$product = wc_get_product();
|
732 |
$data['list_id'] = 'checkout';
|
733 |
$data['page_type'] = 'checkout';
|
734 |
} elseif ( is_page() ) {
|
735 |
+
$data['list_name'] = 'Page | ' . $this->wpm_get_the_title();
|
736 |
$data['list_id'] = 'page_' . sanitize_title( get_the_title() );
|
737 |
$data['page_type'] = 'page';
|
738 |
} elseif ( is_home() ) {
|
740 |
$data['list_id'] = 'blog_home';
|
741 |
$data['page_type'] = 'blog_post';
|
742 |
} elseif ( 'post' === get_post_type() ) {
|
743 |
+
$data['list_name'] = 'Blog Post | ' . $this->wpm_get_the_title();
|
744 |
$data['list_id'] = 'blog_post_' . sanitize_title( get_the_title() );
|
745 |
$data['page_type'] = 'blog_post';
|
746 |
} else {
|
780 |
|
781 |
private function get_general_data()
|
782 |
{
|
783 |
+
return [
|
784 |
'variationsOutput' => (bool) $this->options_obj->general->variations_output,
|
785 |
'userLoggedIn' => is_user_logged_in(),
|
786 |
];
|
|
|
787 |
}
|
788 |
|
789 |
}
|
classes/pixels/google/class-google-pixel-manager.php
CHANGED
@@ -24,14 +24,32 @@ class Google_Pixel_Manager extends Script_Manager
|
|
24 |
$this->google_pixel = new Google( $options );
|
25 |
}
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
protected function log_prevented_order_report_for_user( $order )
|
28 |
{
|
29 |
|
30 |
if ( is_user_logged_in() ) {
|
31 |
-
$user_info = $order->
|
32 |
-
|
33 |
-
'
|
34 |
-
|
|
|
|
|
35 |
}
|
36 |
|
37 |
}
|
24 |
$this->google_pixel = new Google( $options );
|
25 |
}
|
26 |
|
27 |
+
public function wpm_woocommerce_order_status_changed(
|
28 |
+
$order_id,
|
29 |
+
$old_status,
|
30 |
+
$new_status,
|
31 |
+
$order
|
32 |
+
)
|
33 |
+
{
|
34 |
+
/**
|
35 |
+
* If admin sends a payment link to a client
|
36 |
+
* we want to set the clients cid
|
37 |
+
*/
|
38 |
+
if ( 'on-hold' === $new_status && !is_admin() ) {
|
39 |
+
$this->google_analytics_save_cid_on_order__premium_only( $order );
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
protected function log_prevented_order_report_for_user( $order )
|
44 |
{
|
45 |
|
46 |
if ( is_user_logged_in() ) {
|
47 |
+
$user_info = get_user_by( 'id', $this->wpm_get_order_user_id( $order->get_id() ) );
|
48 |
+
if ( is_object( $user_info ) ) {
|
49 |
+
wc_get_logger()->debug( 'Prevented order ID ' . $order->get_id() . ' to be reported through the Measurement Protocol for user ' . $user_info->user_login . ' (roles: ' . implode( ', ', $user_info->roles ) . ')', [
|
50 |
+
'source' => 'wpm',
|
51 |
+
] );
|
52 |
+
}
|
53 |
}
|
54 |
|
55 |
}
|
classes/pixels/trait-product.php
CHANGED
@@ -74,11 +74,6 @@ trait Trait_Product {
|
|
74 |
// get an array with all product categories
|
75 |
public function get_product_category( $product_id ) {
|
76 |
|
77 |
-
if ($this->is_variable_product_by_id($product_id)) {
|
78 |
-
$product = wc_get_product($product_id);
|
79 |
-
$product_id = $product->get_parent_id();
|
80 |
-
}
|
81 |
-
|
82 |
$prod_cats = get_the_terms($product_id, 'product_cat');
|
83 |
$prod_cats_output = [];
|
84 |
|
@@ -345,31 +340,38 @@ trait Trait_Product {
|
|
345 |
}
|
346 |
|
347 |
$product_details = [
|
348 |
-
'id'
|
349 |
-
'sku'
|
350 |
-
'
|
351 |
-
'
|
352 |
-
'
|
353 |
-
'
|
354 |
-
'
|
355 |
-
'dyn_r_ids' => $dyn_r_ids,
|
356 |
-
'isVariable' => $product->get_type() === 'variable',
|
357 |
-
'isVariation' => false,
|
358 |
];
|
359 |
|
360 |
-
if ($product->get_type() === 'variation') {
|
361 |
|
362 |
$parent_product = wc_get_product($product->get_parent_id());
|
|
|
363 |
if ($parent_product) {
|
364 |
-
|
|
|
|
|
365 |
$product_details['parentId_dyn_r_ids'] = $this->get_dyn_r_ids($parent_product);
|
366 |
$product_details['parentId'] = $parent_product->get_id();
|
367 |
} else {
|
|
|
368 |
wc_get_logger()->debug('Variation ' . $product->get_id() . ' doesn\'t link to a valid parent product.', ['source' => 'wpm']);
|
369 |
}
|
370 |
|
371 |
-
$product_details['isVariation'] = true;
|
372 |
$product_details['variant'] = $this->get_formatted_variant_text($product);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
373 |
}
|
374 |
|
375 |
return $product_details;
|
74 |
// get an array with all product categories
|
75 |
public function get_product_category( $product_id ) {
|
76 |
|
|
|
|
|
|
|
|
|
|
|
77 |
$prod_cats = get_the_terms($product_id, 'product_cat');
|
78 |
$prod_cats_output = [];
|
79 |
|
340 |
}
|
341 |
|
342 |
$product_details = [
|
343 |
+
'id' => (string) $product->get_id(),
|
344 |
+
'sku' => (string) $product->get_sku(),
|
345 |
+
'price' => (float) $price,
|
346 |
+
'brand' => $this->get_brand_name($product->get_id()),
|
347 |
+
'quantity' => 1,
|
348 |
+
'dyn_r_ids' => $dyn_r_ids,
|
349 |
+
'isVariable' => $product->get_type() === 'variable',
|
|
|
|
|
|
|
350 |
];
|
351 |
|
352 |
+
if ($product->get_type() === 'variation') { // In case the product is a variation
|
353 |
|
354 |
$parent_product = wc_get_product($product->get_parent_id());
|
355 |
+
|
356 |
if ($parent_product) {
|
357 |
+
|
358 |
+
$product_details['name'] = $parent_product->get_name();
|
359 |
+
|
360 |
$product_details['parentId_dyn_r_ids'] = $this->get_dyn_r_ids($parent_product);
|
361 |
$product_details['parentId'] = $parent_product->get_id();
|
362 |
} else {
|
363 |
+
|
364 |
wc_get_logger()->debug('Variation ' . $product->get_id() . ' doesn\'t link to a valid parent product.', ['source' => 'wpm']);
|
365 |
}
|
366 |
|
|
|
367 |
$product_details['variant'] = $this->get_formatted_variant_text($product);
|
368 |
+
$product_details['category'] = $this->get_product_category($product->get_parent_id());
|
369 |
+
$product_details['isVariation'] = true;
|
370 |
+
} else { // It's not a variation, so get the fields for a regular product
|
371 |
+
|
372 |
+
$product_details['name'] = (string) $product->get_name();
|
373 |
+
$product_details['category'] = $this->get_product_category($product->get_id());
|
374 |
+
$product_details['isVariation'] = false;
|
375 |
}
|
376 |
|
377 |
return $product_details;
|
classes/pixels/trait-shop.php
CHANGED
@@ -14,17 +14,18 @@ if (!defined('ABSPATH')) {
|
|
14 |
trait Trait_Shop {
|
15 |
|
16 |
protected function get_list_name_suffix() {
|
|
|
17 |
$list_suffix = '';
|
18 |
|
19 |
if (is_product_category()) {
|
20 |
|
21 |
$category = get_queried_object();
|
22 |
-
$list_suffix = ' | ' . $category->name;
|
23 |
$list_suffix = $this->add_parent_category_name($category, $list_suffix);
|
24 |
} else {
|
25 |
if (is_product_tag()) {
|
26 |
$tag = get_queried_object();
|
27 |
-
$list_suffix = ' | ' . $tag->name;
|
28 |
}
|
29 |
}
|
30 |
|
@@ -32,10 +33,11 @@ trait Trait_Shop {
|
|
32 |
}
|
33 |
|
34 |
protected function add_parent_category_name( $category, $list_suffix ) {
|
|
|
35 |
if ($category->parent > 0) {
|
36 |
|
37 |
$parent_category = get_term_by('id', $category->parent, 'product_cat');
|
38 |
-
$list_suffix = ' | ' . $parent_category->name . $list_suffix;
|
39 |
$list_suffix = $this->add_parent_category_name($parent_category, $list_suffix);
|
40 |
}
|
41 |
|
@@ -43,6 +45,7 @@ trait Trait_Shop {
|
|
43 |
}
|
44 |
|
45 |
protected function get_list_id_suffix() {
|
|
|
46 |
$list_suffix = '';
|
47 |
|
48 |
if (is_product_category()) {
|
@@ -60,6 +63,7 @@ trait Trait_Shop {
|
|
60 |
}
|
61 |
|
62 |
protected function add_parent_category_id( $category, $list_suffix ) {
|
|
|
63 |
if ($category->parent > 0) {
|
64 |
|
65 |
$parent_category = get_term_by('id', $category->parent, 'product_cat');
|
@@ -72,6 +76,7 @@ trait Trait_Shop {
|
|
72 |
|
73 |
// https://stackoverflow.com/a/49616130/4688612
|
74 |
protected function get_order_from_order_received_page() {
|
|
|
75 |
if ($this->get_order_from_query_vars()) {
|
76 |
return $this->get_order_from_query_vars();
|
77 |
} else {
|
@@ -97,6 +102,7 @@ trait Trait_Shop {
|
|
97 |
}
|
98 |
|
99 |
protected function get_order_from_query_vars() {
|
|
|
100 |
global $wp;
|
101 |
|
102 |
$order_id = absint($wp->query_vars['order-received']);
|
@@ -125,6 +131,7 @@ trait Trait_Shop {
|
|
125 |
$_get = filter_input_array(INPUT_GET, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
126 |
|
127 |
if (isset($_get['key'])) {
|
|
|
128 |
$order_key = $_get['key'];
|
129 |
return wc_get_order(wc_get_order_id_by_order_key($order_key));
|
130 |
} else {
|
@@ -145,12 +152,15 @@ trait Trait_Shop {
|
|
145 |
}
|
146 |
|
147 |
protected function get_order_currency( $order ) {
|
|
|
148 |
// use the right function to get the currency depending on the WooCommerce version
|
149 |
return $this->woocommerce_3_and_above() ? $order->get_currency() : $order->get_order_currency();
|
150 |
}
|
151 |
|
152 |
protected function woocommerce_3_and_above() {
|
|
|
153 |
global $woocommerce;
|
|
|
154 |
if (version_compare($woocommerce->version, 3.0, '>=')) {
|
155 |
return true;
|
156 |
} else {
|
@@ -163,9 +173,11 @@ trait Trait_Shop {
|
|
163 |
protected function is_existing_customer( $order, $value = 0 ) {
|
164 |
|
165 |
if (is_numeric($value)) { // Based on user ID (registered users)
|
|
|
166 |
$meta_key = '_customer_user';
|
167 |
$meta_value = 0 == $value ? get_current_user_id() : (int) $value;
|
168 |
} else { // Based on billing email (Guest users)
|
|
|
169 |
$meta_key = '_billing_email';
|
170 |
$meta_value = sanitize_email($value);
|
171 |
}
|
@@ -247,6 +259,7 @@ trait Trait_Shop {
|
|
247 |
}
|
248 |
|
249 |
private function get_e164_formatted_phone_number( $number, $country ) {
|
|
|
250 |
try {
|
251 |
$phone_util = PhoneNumberUtil::getInstance();
|
252 |
$number_parsed = $phone_util->parse($number, $country);
|
@@ -285,5 +298,63 @@ trait Trait_Shop {
|
|
285 |
protected function do_not_track_user( $user_id = null ) {
|
286 |
return !$this->track_user($user_id);
|
287 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
}
|
289 |
|
14 |
trait Trait_Shop {
|
15 |
|
16 |
protected function get_list_name_suffix() {
|
17 |
+
|
18 |
$list_suffix = '';
|
19 |
|
20 |
if (is_product_category()) {
|
21 |
|
22 |
$category = get_queried_object();
|
23 |
+
$list_suffix = ' | ' . wp_specialchars_decode($category->name);
|
24 |
$list_suffix = $this->add_parent_category_name($category, $list_suffix);
|
25 |
} else {
|
26 |
if (is_product_tag()) {
|
27 |
$tag = get_queried_object();
|
28 |
+
$list_suffix = ' | ' . wp_specialchars_decode($tag->name);
|
29 |
}
|
30 |
}
|
31 |
|
33 |
}
|
34 |
|
35 |
protected function add_parent_category_name( $category, $list_suffix ) {
|
36 |
+
|
37 |
if ($category->parent > 0) {
|
38 |
|
39 |
$parent_category = get_term_by('id', $category->parent, 'product_cat');
|
40 |
+
$list_suffix = ' | ' . wp_specialchars_decode($parent_category->name) . $list_suffix;
|
41 |
$list_suffix = $this->add_parent_category_name($parent_category, $list_suffix);
|
42 |
}
|
43 |
|
45 |
}
|
46 |
|
47 |
protected function get_list_id_suffix() {
|
48 |
+
|
49 |
$list_suffix = '';
|
50 |
|
51 |
if (is_product_category()) {
|
63 |
}
|
64 |
|
65 |
protected function add_parent_category_id( $category, $list_suffix ) {
|
66 |
+
|
67 |
if ($category->parent > 0) {
|
68 |
|
69 |
$parent_category = get_term_by('id', $category->parent, 'product_cat');
|
76 |
|
77 |
// https://stackoverflow.com/a/49616130/4688612
|
78 |
protected function get_order_from_order_received_page() {
|
79 |
+
|
80 |
if ($this->get_order_from_query_vars()) {
|
81 |
return $this->get_order_from_query_vars();
|
82 |
} else {
|
102 |
}
|
103 |
|
104 |
protected function get_order_from_query_vars() {
|
105 |
+
|
106 |
global $wp;
|
107 |
|
108 |
$order_id = absint($wp->query_vars['order-received']);
|
131 |
$_get = filter_input_array(INPUT_GET, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
|
132 |
|
133 |
if (isset($_get['key'])) {
|
134 |
+
|
135 |
$order_key = $_get['key'];
|
136 |
return wc_get_order(wc_get_order_id_by_order_key($order_key));
|
137 |
} else {
|
152 |
}
|
153 |
|
154 |
protected function get_order_currency( $order ) {
|
155 |
+
|
156 |
// use the right function to get the currency depending on the WooCommerce version
|
157 |
return $this->woocommerce_3_and_above() ? $order->get_currency() : $order->get_order_currency();
|
158 |
}
|
159 |
|
160 |
protected function woocommerce_3_and_above() {
|
161 |
+
|
162 |
global $woocommerce;
|
163 |
+
|
164 |
if (version_compare($woocommerce->version, 3.0, '>=')) {
|
165 |
return true;
|
166 |
} else {
|
173 |
protected function is_existing_customer( $order, $value = 0 ) {
|
174 |
|
175 |
if (is_numeric($value)) { // Based on user ID (registered users)
|
176 |
+
|
177 |
$meta_key = '_customer_user';
|
178 |
$meta_value = 0 == $value ? get_current_user_id() : (int) $value;
|
179 |
} else { // Based on billing email (Guest users)
|
180 |
+
|
181 |
$meta_key = '_billing_email';
|
182 |
$meta_value = sanitize_email($value);
|
183 |
}
|
259 |
}
|
260 |
|
261 |
private function get_e164_formatted_phone_number( $number, $country ) {
|
262 |
+
|
263 |
try {
|
264 |
$phone_util = PhoneNumberUtil::getInstance();
|
265 |
$number_parsed = $phone_util->parse($number, $country);
|
298 |
protected function do_not_track_user( $user_id = null ) {
|
299 |
return !$this->track_user($user_id);
|
300 |
}
|
301 |
+
|
302 |
+
// https://wordpress.stackexchange.com/a/95440/68337
|
303 |
+
// https://wordpress.stackexchange.com/a/31435/68337
|
304 |
+
// https://developer.wordpress.org/reference/functions/get_the_title/
|
305 |
+
// https://codex.wordpress.org/Data_Validation#Output_Sanitation
|
306 |
+
// https://developer.wordpress.org/reference/functions/wp_specialchars_decode/
|
307 |
+
protected function wpm_get_the_title( $post = 0 ) {
|
308 |
+
|
309 |
+
$post = get_post($post);
|
310 |
+
$title = isset($post->post_title) ? $post->post_title : '';
|
311 |
+
|
312 |
+
return wp_specialchars_decode($title);
|
313 |
+
}
|
314 |
+
|
315 |
+
protected function is_backend_manual_order( $post_id ) {
|
316 |
+
|
317 |
+
// Only continue if this is a back-end order
|
318 |
+
if (metadata_exists('post', $post_id, '_created_via') && 'admin' === get_post_meta($post_id, '_created_via', true)) {
|
319 |
+
return true;
|
320 |
+
} else {
|
321 |
+
return false;
|
322 |
+
}
|
323 |
+
}
|
324 |
+
|
325 |
+
protected function is_backend_subscription_renewal_order( $post_id ) {
|
326 |
+
|
327 |
+
// Only continue if this is a back-end order
|
328 |
+
if (metadata_exists('post', $post_id, '_created_via') && 'subscription' === get_post_meta($post_id, '_created_via', true)) {
|
329 |
+
return true;
|
330 |
+
} else {
|
331 |
+
return false;
|
332 |
+
}
|
333 |
+
}
|
334 |
+
|
335 |
+
protected function was_order_created_while_wpm_was_active( $order_id ) {
|
336 |
+
if (get_post_meta($order_id, '_wpm_process_through_wpm', true)) {
|
337 |
+
return true;
|
338 |
+
} else {
|
339 |
+
return false;
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
protected function was_order_created_while_wpm_premium_was_active( $order_id ) {
|
344 |
+
if (get_post_meta($order_id, '_wpm_premium_active', true)) {
|
345 |
+
return true;
|
346 |
+
} else {
|
347 |
+
return false;
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
protected function wpm_get_order_user_id( $order_id ) {
|
352 |
+
|
353 |
+
if (metadata_exists('post', $order_id, '_wpm_customer_user')) {
|
354 |
+
return get_post_meta($order_id, '_wpm_customer_user', true);
|
355 |
+
} else {
|
356 |
+
return get_post_meta($order_id, '_customer_user', true);
|
357 |
+
}
|
358 |
+
}
|
359 |
}
|
360 |
|
js/admin/main.min.js
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
import ask_for_rating from"./ask-for-rating.js";import environment_check from"./environment-check.js";import helpers from"./helpers.js";import script_blocker_warning from"./script-blocker-warning.js";import tabs from"./tabs.js";
|
js/admin/selectWoo.full.js
ADDED
@@ -0,0 +1,6599 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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* https://github.com/woocommerce/selectWoo
|
4 |
+
*
|
5 |
+
* Released under the MIT license
|
6 |
+
* https://github.com/woocommerce/selectWoo/blob/master/LICENSE.md
|
7 |
+
*/
|
8 |
+
(function (factory) {
|
9 |
+
if (typeof define === 'function' && define.amd) {
|
10 |
+
// AMD. Register as an anonymous module.
|
11 |
+
define(['jquery'], factory);
|
12 |
+
} else if (typeof module === 'object' && module.exports) {
|
13 |
+
// Node/CommonJS
|
14 |
+
module.exports = function (root, jQuery) {
|
15 |
+
if (jQuery === undefined) {
|
16 |
+
// require('jQuery') returns a factory that requires window to
|
17 |
+
// build a jQuery instance, we normalize how we use modules
|
18 |
+
// that require this pattern but the window provided is a noop
|
19 |
+
// if it's defined (how jquery works)
|
20 |
+
if (typeof window !== 'undefined') {
|
21 |
+
jQuery = require('jquery');
|
22 |
+
}
|
23 |
+
else {
|
24 |
+
jQuery = require('jquery')(root);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
factory(jQuery);
|
28 |
+
return jQuery;
|
29 |
+
};
|
30 |
+
} else {
|
31 |
+
// Browser globals
|
32 |
+
factory(jQuery);
|
33 |
+
}
|
34 |
+
} (function (jQuery) {
|
35 |
+
// This is needed so we can catch the AMD loader configuration and use it
|
36 |
+
// The inner file should be wrapped (by `banner.start.js`) in a function that
|
37 |
+
// returns the AMD loader references.
|
38 |
+
var S2 =(function () {
|
39 |
+
// Restore the Select2 AMD loader so it can be used
|
40 |
+
// Needed mostly in the language files, where the loader is not inserted
|
41 |
+
if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) {
|
42 |
+
var S2 = jQuery.fn.select2.amd;
|
43 |
+
}
|
44 |
+
var S2;(function () { if (!S2 || !S2.requirejs) {
|
45 |
+
if (!S2) { S2 = {}; } else { require = S2; }
|
46 |
+
/**
|
47 |
+
* @license almond 0.3.3 Copyright jQuery Foundation and other contributors.
|
48 |
+
* Released under MIT license, http://github.com/requirejs/almond/LICENSE
|
49 |
+
*/
|
50 |
+
//Going sloppy to avoid 'use strict' string cost, but strict practices should
|
51 |
+
//be followed.
|
52 |
+
/*global setTimeout: false */
|
53 |
+
|
54 |
+
var requirejs, require, define;
|
55 |
+
(function (undef) {
|
56 |
+
var main, req, makeMap, handlers,
|
57 |
+
defined = {},
|
58 |
+
waiting = {},
|
59 |
+
config = {},
|
60 |
+
defining = {},
|
61 |
+
hasOwn = Object.prototype.hasOwnProperty,
|
62 |
+
aps = [].slice,
|
63 |
+
jsSuffixRegExp = /\.js$/;
|
64 |
+
|
65 |
+
function hasProp(obj, prop) {
|
66 |
+
return hasOwn.call(obj, prop);
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* Given a relative module name, like ./something, normalize it to
|
71 |
+
* a real name that can be mapped to a path.
|
72 |
+
* @param {String} name the relative name
|
73 |
+
* @param {String} baseName a real name that the name arg is relative
|
74 |
+
* to.
|
75 |
+
* @returns {String} normalized name
|
76 |
+
*/
|
77 |
+
function normalize(name, baseName) {
|
78 |
+
var nameParts, nameSegment, mapValue, foundMap, lastIndex,
|
79 |
+
foundI, foundStarMap, starI, i, j, part, normalizedBaseParts,
|
80 |
+
baseParts = baseName && baseName.split("/"),
|
81 |
+
map = config.map,
|
82 |
+
starMap = (map && map['*']) || {};
|
83 |
+
|
84 |
+
//Adjust any relative paths.
|
85 |
+
if (name) {
|
86 |
+
name = name.split('/');
|
87 |
+
lastIndex = name.length - 1;
|
88 |
+
|
89 |
+
// If wanting node ID compatibility, strip .js from end
|
90 |
+
// of IDs. Have to do this here, and not in nameToUrl
|
91 |
+
// because node allows either .js or non .js to map
|
92 |
+
// to same file.
|
93 |
+
if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) {
|
94 |
+
name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, '');
|
95 |
+
}
|
96 |
+
|
97 |
+
// Starts with a '.' so need the baseName
|
98 |
+
if (name[0].charAt(0) === '.' && baseParts) {
|
99 |
+
//Convert baseName to array, and lop off the last part,
|
100 |
+
//so that . matches that 'directory' and not name of the baseName's
|
101 |
+
//module. For instance, baseName of 'one/two/three', maps to
|
102 |
+
//'one/two/three.js', but we want the directory, 'one/two' for
|
103 |
+
//this normalization.
|
104 |
+
normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
|
105 |
+
name = normalizedBaseParts.concat(name);
|
106 |
+
}
|
107 |
+
|
108 |
+
//start trimDots
|
109 |
+
for (i = 0; i < name.length; i++) {
|
110 |
+
part = name[i];
|
111 |
+
if (part === '.') {
|
112 |
+
name.splice(i, 1);
|
113 |
+
i -= 1;
|
114 |
+
} else if (part === '..') {
|
115 |
+
// If at the start, or previous value is still ..,
|
116 |
+
// keep them so that when converted to a path it may
|
117 |
+
// still work when converted to a path, even though
|
118 |
+
// as an ID it is less than ideal. In larger point
|
119 |
+
// releases, may be better to just kick out an error.
|
120 |
+
if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') {
|
121 |
+
continue;
|
122 |
+
} else if (i > 0) {
|
123 |
+
name.splice(i - 1, 2);
|
124 |
+
i -= 2;
|
125 |
+
}
|
126 |
+
}
|
127 |
+
}
|
128 |
+
//end trimDots
|
129 |
+
|
130 |
+
name = name.join('/');
|
131 |
+
}
|
132 |
+
|
133 |
+
//Apply map config if available.
|
134 |
+
if ((baseParts || starMap) && map) {
|
135 |
+
nameParts = name.split('/');
|
136 |
+
|
137 |
+
for (i = nameParts.length; i > 0; i -= 1) {
|
138 |
+
nameSegment = nameParts.slice(0, i).join("/");
|
139 |
+
|
140 |
+
if (baseParts) {
|
141 |
+
//Find the longest baseName segment match in the config.
|
142 |
+
//So, do joins on the biggest to smallest lengths of baseParts.
|
143 |
+
for (j = baseParts.length; j > 0; j -= 1) {
|
144 |
+
mapValue = map[baseParts.slice(0, j).join('/')];
|
145 |
+
|
146 |
+
//baseName segment has config, find if it has one for
|
147 |
+
//this name.
|
148 |
+
if (mapValue) {
|
149 |
+
mapValue = mapValue[nameSegment];
|
150 |
+
if (mapValue) {
|
151 |
+
//Match, update name to the new value.
|
152 |
+
foundMap = mapValue;
|
153 |
+
foundI = i;
|
154 |
+
break;
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
}
|
159 |
+
|
160 |
+
if (foundMap) {
|
161 |
+
break;
|
162 |
+
}
|
163 |
+
|
164 |
+
//Check for a star map match, but just hold on to it,
|
165 |
+
//if there is a shorter segment match later in a matching
|
166 |
+
//config, then favor over this star map.
|
167 |
+
if (!foundStarMap && starMap && starMap[nameSegment]) {
|
168 |
+
foundStarMap = starMap[nameSegment];
|
169 |
+
starI = i;
|
170 |
+
}
|
171 |
+
}
|
172 |
+
|
173 |
+
if (!foundMap && foundStarMap) {
|
174 |
+
foundMap = foundStarMap;
|
175 |
+
foundI = starI;
|
176 |
+
}
|
177 |
+
|
178 |
+
if (foundMap) {
|
179 |
+
nameParts.splice(0, foundI, foundMap);
|
180 |
+
name = nameParts.join('/');
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
return name;
|
185 |
+
}
|
186 |
+
|
187 |
+
function makeRequire(relName, forceSync) {
|
188 |
+
return function () {
|
189 |
+
//A version of a require function that passes a moduleName
|
190 |
+
//value for items that may need to
|
191 |
+
//look up paths relative to the moduleName
|
192 |
+
var args = aps.call(arguments, 0);
|
193 |
+
|
194 |
+
//If first arg is not require('string'), and there is only
|
195 |
+
//one arg, it is the array form without a callback. Insert
|
196 |
+
//a null so that the following concat is correct.
|
197 |
+
if (typeof args[0] !== 'string' && args.length === 1) {
|
198 |
+
args.push(null);
|
199 |
+
}
|
200 |
+
return req.apply(undef, args.concat([relName, forceSync]));
|
201 |
+
};
|
202 |
+
}
|
203 |
+
|
204 |
+
function makeNormalize(relName) {
|
205 |
+
return function (name) {
|
206 |
+
return normalize(name, relName);
|
207 |
+
};
|
208 |
+
}
|
209 |
+
|
210 |
+
function makeLoad(depName) {
|
211 |
+
return function (value) {
|
212 |
+
defined[depName] = value;
|
213 |
+
};
|
214 |
+
}
|
215 |
+
|
216 |
+
function callDep(name) {
|
217 |
+
if (hasProp(waiting, name)) {
|
218 |
+
var args = waiting[name];
|
219 |
+
delete waiting[name];
|
220 |
+
defining[name] = true;
|
221 |
+
main.apply(undef, args);
|
222 |
+
}
|
223 |
+
|
224 |
+
if (!hasProp(defined, name) && !hasProp(defining, name)) {
|
225 |
+
throw new Error('No ' + name);
|
226 |
+
}
|
227 |
+
return defined[name];
|
228 |
+
}
|
229 |
+
|
230 |
+
//Turns a plugin!resource to [plugin, resource]
|
231 |
+
//with the plugin being undefined if the name
|
232 |
+
//did not have a plugin prefix.
|
233 |
+
function splitPrefix(name) {
|
234 |
+
var prefix,
|
235 |
+
index = name ? name.indexOf('!') : -1;
|
236 |
+
if (index > -1) {
|
237 |
+
prefix = name.substring(0, index);
|
238 |
+
name = name.substring(index + 1, name.length);
|
239 |
+
}
|
240 |
+
return [prefix, name];
|
241 |
+
}
|
242 |
+
|
243 |
+
//Creates a parts array for a relName where first part is plugin ID,
|
244 |
+
//second part is resource ID. Assumes relName has already been normalized.
|
245 |
+
function makeRelParts(relName) {
|
246 |
+
return relName ? splitPrefix(relName) : [];
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Makes a name map, normalizing the name, and using a plugin
|
251 |
+
* for normalization if necessary. Grabs a ref to plugin
|
252 |
+
* too, as an optimization.
|
253 |
+
*/
|
254 |
+
makeMap = function (name, relParts) {
|
255 |
+
var plugin,
|
256 |
+
parts = splitPrefix(name),
|
257 |
+
prefix = parts[0],
|
258 |
+
relResourceName = relParts[1];
|
259 |
+
|
260 |
+
name = parts[1];
|
261 |
+
|
262 |
+
if (prefix) {
|
263 |
+
prefix = normalize(prefix, relResourceName);
|
264 |
+
plugin = callDep(prefix);
|
265 |
+
}
|
266 |
+
|
267 |
+
//Normalize according
|
268 |
+
if (prefix) {
|
269 |
+
if (plugin && plugin.normalize) {
|
270 |
+
name = plugin.normalize(name, makeNormalize(relResourceName));
|
271 |
+
} else {
|
272 |
+
name = normalize(name, relResourceName);
|
273 |
+
}
|
274 |
+
} else {
|
275 |
+
name = normalize(name, relResourceName);
|
276 |
+
parts = splitPrefix(name);
|
277 |
+
prefix = parts[0];
|
278 |
+
name = parts[1];
|
279 |
+
if (prefix) {
|
280 |
+
plugin = callDep(prefix);
|
281 |
+
}
|
282 |
+
}
|
283 |
+
|
284 |
+
//Using ridiculous property names for space reasons
|
285 |
+
return {
|
286 |
+
f: prefix ? prefix + '!' + name : name, //fullName
|
287 |
+
n: name,
|
288 |
+
pr: prefix,
|
289 |
+
p: plugin
|
290 |
+
};
|
291 |
+
};
|
292 |
+
|
293 |
+
function makeConfig(name) {
|
294 |
+
return function () {
|
295 |
+
return (config && config.config && config.config[name]) || {};
|
296 |
+
};
|
297 |
+
}
|
298 |
+
|
299 |
+
handlers = {
|
300 |
+
require: function (name) {
|
301 |
+
return makeRequire(name);
|
302 |
+
},
|
303 |
+
exports: function (name) {
|
304 |
+
var e = defined[name];
|
305 |
+
if (typeof e !== 'undefined') {
|
306 |
+
return e;
|
307 |
+
} else {
|
308 |
+
return (defined[name] = {});
|
309 |
+
}
|
310 |
+
},
|
311 |
+
module: function (name) {
|
312 |
+
return {
|
313 |
+
id: name,
|
314 |
+
uri: '',
|
315 |
+
exports: defined[name],
|
316 |
+
config: makeConfig(name)
|
317 |
+
};
|
318 |
+
}
|
319 |
+
};
|
320 |
+
|
321 |
+
main = function (name, deps, callback, relName) {
|
322 |
+
var cjsModule, depName, ret, map, i, relParts,
|
323 |
+
args = [],
|
324 |
+
callbackType = typeof callback,
|
325 |
+
usingExports;
|
326 |
+
|
327 |
+
//Use name if no relName
|
328 |
+
relName = relName || name;
|
329 |
+
relParts = makeRelParts(relName);
|
330 |
+
|
331 |
+
//Call the callback to define the module, if necessary.
|
332 |
+
if (callbackType === 'undefined' || callbackType === 'function') {
|
333 |
+
//Pull out the defined dependencies and pass the ordered
|
334 |
+
//values to the callback.
|
335 |
+
//Default to [require, exports, module] if no deps
|
336 |
+
deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps;
|
337 |
+
for (i = 0; i < deps.length; i += 1) {
|
338 |
+
map = makeMap(deps[i], relParts);
|
339 |
+
depName = map.f;
|
340 |
+
|
341 |
+
//Fast path CommonJS standard dependencies.
|
342 |
+
if (depName === "require") {
|
343 |
+
args[i] = handlers.require(name);
|
344 |
+
} else if (depName === "exports") {
|
345 |
+
//CommonJS module spec 1.1
|
346 |
+
args[i] = handlers.exports(name);
|
347 |
+
usingExports = true;
|
348 |
+
} else if (depName === "module") {
|
349 |
+
//CommonJS module spec 1.1
|
350 |
+
cjsModule = args[i] = handlers.module(name);
|
351 |
+
} else if (hasProp(defined, depName) ||
|
352 |
+
hasProp(waiting, depName) ||
|
353 |
+
hasProp(defining, depName)) {
|
354 |
+
args[i] = callDep(depName);
|
355 |
+
} else if (map.p) {
|
356 |
+
map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {});
|
357 |
+
args[i] = defined[depName];
|
358 |
+
} else {
|
359 |
+
throw new Error(name + ' missing ' + depName);
|
360 |
+
}
|
361 |
+
}
|
362 |
+
|
363 |
+
ret = callback ? callback.apply(defined[name], args) : undefined;
|
364 |
+
|
365 |
+
if (name) {
|
366 |
+
//If setting exports via "module" is in play,
|
367 |
+
//favor that over return value and exports. After that,
|
368 |
+
//favor a non-undefined return value over exports use.
|
369 |
+
if (cjsModule && cjsModule.exports !== undef &&
|
370 |
+
cjsModule.exports !== defined[name]) {
|
371 |
+
defined[name] = cjsModule.exports;
|
372 |
+
} else if (ret !== undef || !usingExports) {
|
373 |
+
//Use the return value from the function.
|
374 |
+
defined[name] = ret;
|
375 |
+
}
|
376 |
+
}
|
377 |
+
} else if (name) {
|
378 |
+
//May just be an object definition for the module. Only
|
379 |
+
//worry about defining if have a module name.
|
380 |
+
defined[name] = callback;
|
381 |
+
}
|
382 |
+
};
|
383 |
+
|
384 |
+
requirejs = require = req = function (deps, callback, relName, forceSync, alt) {
|
385 |
+
if (typeof deps === "string") {
|
386 |
+
if (handlers[deps]) {
|
387 |
+
//callback in this case is really relName
|
388 |
+
return handlers[deps](callback);
|
389 |
+
}
|
390 |
+
//Just return the module wanted. In this scenario, the
|
391 |
+
//deps arg is the module name, and second arg (if passed)
|
392 |
+
//is just the relName.
|
393 |
+
//Normalize module name, if it contains . or ..
|
394 |
+
return callDep(makeMap(deps, makeRelParts(callback)).f);
|
395 |
+
} else if (!deps.splice) {
|
396 |
+
//deps is a config object, not an array.
|
397 |
+
config = deps;
|
398 |
+
if (config.deps) {
|
399 |
+
req(config.deps, config.callback);
|
400 |
+
}
|
401 |
+
if (!callback) {
|
402 |
+
return;
|
403 |
+
}
|
404 |
+
|
405 |
+
if (callback.splice) {
|
406 |
+
//callback is an array, which means it is a dependency list.
|
407 |
+
//Adjust args if there are dependencies
|
408 |
+
deps = callback;
|
409 |
+
callback = relName;
|
410 |
+
relName = null;
|
411 |
+
} else {
|
412 |
+
deps = undef;
|
413 |
+
}
|
414 |
+
}
|
415 |
+
|
416 |
+
//Support require(['a'])
|
417 |
+
callback = callback || function () {};
|
418 |
+
|
419 |
+
//If relName is a function, it is an errback handler,
|
420 |
+
//so remove it.
|
421 |
+
if (typeof relName === 'function') {
|
422 |
+
relName = forceSync;
|
423 |
+
forceSync = alt;
|
424 |
+
}
|
425 |
+
|
426 |
+
//Simulate async callback;
|
427 |
+
if (forceSync) {
|
428 |
+
main(undef, deps, callback, relName);
|
429 |
+
} else {
|
430 |
+
//Using a non-zero value because of concern for what old browsers
|
431 |
+
//do, and latest browsers "upgrade" to 4 if lower value is used:
|
432 |
+
//http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout:
|
433 |
+
//If want a value immediately, use require('id') instead -- something
|
434 |
+
//that works in almond on the global level, but not guaranteed and
|
435 |
+
//unlikely to work in other AMD implementations.
|
436 |
+
setTimeout(function () {
|
437 |
+
main(undef, deps, callback, relName);
|
438 |
+
}, 4);
|
439 |
+
}
|
440 |
+
|
441 |
+
return req;
|
442 |
+
};
|
443 |
+
|
444 |
+
/**
|
445 |
+
* Just drops the config on the floor, but returns req in case
|
446 |
+
* the config return value is used.
|
447 |
+
*/
|
448 |
+
req.config = function (cfg) {
|
449 |
+
return req(cfg);
|
450 |
+
};
|
451 |
+
|
452 |
+
/**
|
453 |
+
* Expose module registry for debugging and tooling
|
454 |
+
*/
|
455 |
+
requirejs._defined = defined;
|
456 |
+
|
457 |
+
define = function (name, deps, callback) {
|
458 |
+
if (typeof name !== 'string') {
|
459 |
+
throw new Error('See almond README: incorrect module build, no module name');
|
460 |
+
}
|
461 |
+
|
462 |
+
//This module may not have dependencies
|
463 |
+
if (!deps.splice) {
|
464 |
+
//deps is not an array, so probably means
|
465 |
+
//an object literal or factory function for
|
466 |
+
//the value. Adjust args.
|
467 |
+
callback = deps;
|
468 |
+
deps = [];
|
469 |
+
}
|
470 |
+
|
471 |
+
if (!hasProp(defined, name) && !hasProp(waiting, name)) {
|
472 |
+
waiting[name] = [name, deps, callback];
|
473 |
+
}
|
474 |
+
};
|
475 |
+
|
476 |
+
define.amd = {
|
477 |
+
jQuery: true
|
478 |
+
};
|
479 |
+
}());
|
480 |
+
|
481 |
+
S2.requirejs = requirejs;S2.require = require;S2.define = define;
|
482 |
+
}
|
483 |
+
}());
|
484 |
+
S2.define("almond", function(){});
|
485 |
+
|
486 |
+
/* global jQuery:false, $:false */
|
487 |
+
S2.define('jquery',[],function () {
|
488 |
+
var _$ = jQuery || $;
|
489 |
+
|
490 |
+
if (_$ == null && console && console.error) {
|
491 |
+
console.error(
|
492 |
+
'Select2: An instance of jQuery or a jQuery-compatible library was not ' +
|
493 |
+
'found. Make sure that you are including jQuery before Select2 on your ' +
|
494 |
+
'web page.'
|
495 |
+
);
|
496 |
+
}
|
497 |
+
|
498 |
+
return _$;
|
499 |
+
});
|
500 |
+
|
501 |
+
S2.define('select2/utils',[
|
502 |
+
'jquery'
|
503 |
+
], function ($) {
|
504 |
+
var Utils = {};
|
505 |
+
|
506 |
+
Utils.Extend = function (ChildClass, SuperClass) {
|
507 |
+
var __hasProp = {}.hasOwnProperty;
|
508 |
+
|
509 |
+
function BaseConstructor () {
|
510 |
+
this.constructor = ChildClass;
|
511 |
+
}
|
512 |
+
|
513 |
+
for (var key in SuperClass) {
|
514 |
+
if (__hasProp.call(SuperClass, key)) {
|
515 |
+
ChildClass[key] = SuperClass[key];
|
516 |
+
}
|
517 |
+
}
|
518 |
+
|
519 |
+
BaseConstructor.prototype = SuperClass.prototype;
|
520 |
+
ChildClass.prototype = new BaseConstructor();
|
521 |
+
ChildClass.__super__ = SuperClass.prototype;
|
522 |
+
|
523 |
+
return ChildClass;
|
524 |
+
};
|
525 |
+
|
526 |
+
function getMethods (theClass) {
|
527 |
+
var proto = theClass.prototype;
|
528 |
+
|
529 |
+
var methods = [];
|
530 |
+
|
531 |
+
for (var methodName in proto) {
|
532 |
+
var m = proto[methodName];
|
533 |
+
|
534 |
+
if (typeof m !== 'function') {
|
535 |
+
continue;
|
536 |
+
}
|
537 |
+
|
538 |
+
if (methodName === 'constructor') {
|
539 |
+
continue;
|
540 |
+
}
|
541 |
+
|
542 |
+
methods.push(methodName);
|
543 |
+
}
|
544 |
+
|
545 |
+
return methods;
|
546 |
+
}
|
547 |
+
|
548 |
+
Utils.Decorate = function (SuperClass, DecoratorClass) {
|
549 |
+
var decoratedMethods = getMethods(DecoratorClass);
|
550 |
+
var superMethods = getMethods(SuperClass);
|
551 |
+
|
552 |
+
function DecoratedClass () {
|
553 |
+
var unshift = Array.prototype.unshift;
|
554 |
+
|
555 |
+
var argCount = DecoratorClass.prototype.constructor.length;
|
556 |
+
|
557 |
+
var calledConstructor = SuperClass.prototype.constructor;
|
558 |
+
|
559 |
+
if (argCount > 0) {
|
560 |
+
unshift.call(arguments, SuperClass.prototype.constructor);
|
561 |
+
|
562 |
+
calledConstructor = DecoratorClass.prototype.constructor;
|
563 |
+
}
|
564 |
+
|
565 |
+
calledConstructor.apply(this, arguments);
|
566 |
+
}
|
567 |
+
|
568 |
+
DecoratorClass.displayName = SuperClass.displayName;
|
569 |
+
|
570 |
+
function ctr () {
|
571 |
+
this.constructor = DecoratedClass;
|
572 |
+
}
|
573 |
+
|
574 |
+
DecoratedClass.prototype = new ctr();
|
575 |
+
|
576 |
+
for (var m = 0; m < superMethods.length; m++) {
|
577 |
+
var superMethod = superMethods[m];
|
578 |
+
|
579 |
+
DecoratedClass.prototype[superMethod] =
|
580 |
+
SuperClass.prototype[superMethod];
|
581 |
+
}
|
582 |
+
|
583 |
+
var calledMethod = function (methodName) {
|
584 |
+
// Stub out the original method if it's not decorating an actual method
|
585 |
+
var originalMethod = function () {};
|
586 |
+
|
587 |
+
if (methodName in DecoratedClass.prototype) {
|
588 |
+
originalMethod = DecoratedClass.prototype[methodName];
|
589 |
+
}
|
590 |
+
|
591 |
+
var decoratedMethod = DecoratorClass.prototype[methodName];
|
592 |
+
|
593 |
+
return function () {
|
594 |
+
var unshift = Array.prototype.unshift;
|
595 |
+
|
596 |
+
unshift.call(arguments, originalMethod);
|
597 |
+
|
598 |
+
return decoratedMethod.apply(this, arguments);
|
599 |
+
};
|
600 |
+
};
|
601 |
+
|
602 |
+
for (var d = 0; d < decoratedMethods.length; d++) {
|
603 |
+
var decoratedMethod = decoratedMethods[d];
|
604 |
+
|
605 |
+
DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod);
|
606 |
+
}
|
607 |
+
|
608 |
+
return DecoratedClass;
|
609 |
+
};
|
610 |
+
|
611 |
+
var Observable = function () {
|
612 |
+
this.listeners = {};
|
613 |
+
};
|
614 |
+
|
615 |
+
Observable.prototype.on = function (event, callback) {
|
616 |
+
this.listeners = this.listeners || {};
|
617 |
+
|
618 |
+
if (event in this.listeners) {
|
619 |
+
this.listeners[event].push(callback);
|
620 |
+
} else {
|
621 |
+
this.listeners[event] = [callback];
|
622 |
+
}
|
623 |
+
};
|
624 |
+
|
625 |
+
Observable.prototype.trigger = function (event) {
|
626 |
+
var slice = Array.prototype.slice;
|
627 |
+
var params = slice.call(arguments, 1);
|
628 |
+
|
629 |
+
this.listeners = this.listeners || {};
|
630 |
+
|
631 |
+
// Params should always come in as an array
|
632 |
+
if (params == null) {
|
633 |
+
params = [];
|
634 |
+
}
|
635 |
+
|
636 |
+
// If there are no arguments to the event, use a temporary object
|
637 |
+
if (params.length === 0) {
|
638 |
+
params.push({});
|
639 |
+
}
|
640 |
+
|
641 |
+
// Set the `_type` of the first object to the event
|
642 |
+
params[0]._type = event;
|
643 |
+
|
644 |
+
if (event in this.listeners) {
|
645 |
+
this.invoke(this.listeners[event], slice.call(arguments, 1));
|
646 |
+
}
|
647 |
+
|
648 |
+
if ('*' in this.listeners) {
|
649 |
+
this.invoke(this.listeners['*'], arguments);
|
650 |
+
}
|
651 |
+
};
|
652 |
+
|
653 |
+
Observable.prototype.invoke = function (listeners, params) {
|
654 |
+
for (var i = 0, len = listeners.length; i < len; i++) {
|
655 |
+
listeners[i].apply(this, params);
|
656 |
+
}
|
657 |
+
};
|
658 |
+
|
659 |
+
Utils.Observable = Observable;
|
660 |
+
|
661 |
+
Utils.generateChars = function (length) {
|
662 |
+
var chars = '';
|
663 |
+
|
664 |
+
for (var i = 0; i < length; i++) {
|
665 |
+
var randomChar = Math.floor(Math.random() * 36);
|
666 |
+
chars += randomChar.toString(36);
|
667 |
+
}
|
668 |
+
|
669 |
+
return chars;
|
670 |
+
};
|
671 |
+
|
672 |
+
Utils.bind = function (func, context) {
|
673 |
+
return function () {
|
674 |
+
func.apply(context, arguments);
|
675 |
+
};
|
676 |
+
};
|
677 |
+
|
678 |
+
Utils._convertData = function (data) {
|
679 |
+
for (var originalKey in data) {
|
680 |
+
var keys = originalKey.split('-');
|
681 |
+
|
682 |
+
var dataLevel = data;
|
683 |
+
|
684 |
+
if (keys.length === 1) {
|
685 |
+
continue;
|
686 |
+
}
|
687 |
+
|
688 |
+
for (var k = 0; k < keys.length; k++) {
|
689 |
+
var key = keys[k];
|
690 |
+
|
691 |
+
// Lowercase the first letter
|
692 |
+
// By default, dash-separated becomes camelCase
|
693 |
+
key = key.substring(0, 1).toLowerCase() + key.substring(1);
|
694 |
+
|
695 |
+
if (!(key in dataLevel)) {
|
696 |
+
dataLevel[key] = {};
|
697 |
+
}
|
698 |
+
|
699 |
+
if (k == keys.length - 1) {
|
700 |
+
dataLevel[key] = data[originalKey];
|
701 |
+
}
|
702 |
+
|
703 |
+
dataLevel = dataLevel[key];
|
704 |
+
}
|
705 |
+
|
706 |
+
delete data[originalKey];
|
707 |
+
}
|
708 |
+
|
709 |
+
return data;
|
710 |
+
};
|
711 |
+
|
712 |
+
Utils.hasScroll = function (index, el) {
|
713 |
+
// Adapted from the function created by @ShadowScripter
|
714 |
+
// and adapted by @BillBarry on the Stack Exchange Code Review website.
|
715 |
+
// The original code can be found at
|
716 |
+
// http://codereview.stackexchange.com/q/13338
|
717 |
+
// and was designed to be used with the Sizzle selector engine.
|
718 |
+
|
719 |
+
var $el = $(el);
|
720 |
+
var overflowX = el.style.overflowX;
|
721 |
+
var overflowY = el.style.overflowY;
|
722 |
+
|
723 |
+
//Check both x and y declarations
|
724 |
+
if (overflowX === overflowY &&
|
725 |
+
(overflowY === 'hidden' || overflowY === 'visible')) {
|
726 |
+
return false;
|
727 |
+
}
|
728 |
+
|
729 |
+
if (overflowX === 'scroll' || overflowY === 'scroll') {
|
730 |
+
return true;
|
731 |
+
}
|
732 |
+
|
733 |
+
return ($el.innerHeight() < el.scrollHeight ||
|
734 |
+
$el.innerWidth() < el.scrollWidth);
|
735 |
+
};
|
736 |
+
|
737 |
+
Utils.escapeMarkup = function (markup) {
|
738 |
+
var replaceMap = {
|
739 |
+
'\\': '\',
|
740 |
+
'&': '&',
|
741 |
+
'<': '<',
|
742 |
+
'>': '>',
|
743 |
+
'"': '"',
|
744 |
+
'\'': ''',
|
745 |
+
'/': '/'
|
746 |
+
};
|
747 |
+
|
748 |
+
// Do not try to escape the markup if it's not a string
|
749 |
+
if (typeof markup !== 'string') {
|
750 |
+
return markup;
|
751 |
+
}
|
752 |
+
|
753 |
+
return String(markup).replace(/[&<>"'\/\\]/g, function (match) {
|
754 |
+
return replaceMap[match];
|
755 |
+
});
|
756 |
+
};
|
757 |
+
|
758 |
+
Utils.entityDecode = function (html) {
|
759 |
+
var txt = document.createElement('textarea');
|
760 |
+
txt.innerHTML = html;
|
761 |
+
return txt.value;
|
762 |
+
}
|
763 |
+
|
764 |
+
// Append an array of jQuery nodes to a given element.
|
765 |
+
Utils.appendMany = function ($element, $nodes) {
|
766 |
+
// jQuery 1.7.x does not support $.fn.append() with an array
|
767 |
+
// Fall back to a jQuery object collection using $.fn.add()
|
768 |
+
if ($.fn.jquery.substr(0, 3) === '1.7') {
|
769 |
+
var $jqNodes = $();
|
770 |
+
|
771 |
+
$.map($nodes, function (node) {
|
772 |
+
$jqNodes = $jqNodes.add(node);
|
773 |
+
});
|
774 |
+
|
775 |
+
$nodes = $jqNodes;
|
776 |
+
}
|
777 |
+
|
778 |
+
$element.append($nodes);
|
779 |
+
};
|
780 |
+
|
781 |
+
// Determine whether the browser is on a touchscreen device.
|
782 |
+
Utils.isTouchscreen = function() {
|
783 |
+
if ('undefined' === typeof Utils._isTouchscreenCache) {
|
784 |
+
Utils._isTouchscreenCache = 'ontouchstart' in document.documentElement;
|
785 |
+
}
|
786 |
+
return Utils._isTouchscreenCache;
|
787 |
+
}
|
788 |
+
|
789 |
+
return Utils;
|
790 |
+
});
|
791 |
+
|
792 |
+
S2.define('select2/results',[
|
793 |
+
'jquery',
|
794 |
+
'./utils'
|
795 |
+
], function ($, Utils) {
|
796 |
+
function Results ($element, options, dataAdapter) {
|
797 |
+
this.$element = $element;
|
798 |
+
this.data = dataAdapter;
|
799 |
+
this.options = options;
|
800 |
+
|
801 |
+
Results.__super__.constructor.call(this);
|
802 |
+
}
|
803 |
+
|
804 |
+
Utils.Extend(Results, Utils.Observable);
|
805 |
+
|
806 |
+
Results.prototype.render = function () {
|
807 |
+
var $results = $(
|
808 |
+
'<ul class="select2-results__options" role="listbox" tabindex="-1"></ul>'
|
809 |
+
);
|
810 |
+
|
811 |
+
if (this.options.get('multiple')) {
|
812 |
+
$results.attr('aria-multiselectable', 'true');
|
813 |
+
}
|
814 |
+
|
815 |
+
this.$results = $results;
|
816 |
+
|
817 |
+
return $results;
|
818 |
+
};
|
819 |
+
|
820 |
+
Results.prototype.clear = function () {
|
821 |
+
this.$results.empty();
|
822 |
+
};
|
823 |
+
|
824 |
+
Results.prototype.displayMessage = function (params) {
|
825 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
826 |
+
|
827 |
+
this.clear();
|
828 |
+
this.hideLoading();
|
829 |
+
|
830 |
+
var $message = $(
|
831 |
+
'<li role="alert" aria-live="assertive"' +
|
832 |
+
' class="select2-results__option"></li>'
|
833 |
+
);
|
834 |
+
|
835 |
+
var message = this.options.get('translations').get(params.message);
|
836 |
+
|
837 |
+
$message.append(
|
838 |
+
escapeMarkup(
|
839 |
+
message(params.args)
|
840 |
+
)
|
841 |
+
);
|
842 |
+
|
843 |
+
$message[0].className += ' select2-results__message';
|
844 |
+
|
845 |
+
this.$results.append($message);
|
846 |
+
};
|
847 |
+
|
848 |
+
Results.prototype.hideMessages = function () {
|
849 |
+
this.$results.find('.select2-results__message').remove();
|
850 |
+
};
|
851 |
+
|
852 |
+
Results.prototype.append = function (data) {
|
853 |
+
this.hideLoading();
|
854 |
+
|
855 |
+
var $options = [];
|
856 |
+
|
857 |
+
if (data.results == null || data.results.length === 0) {
|
858 |
+
if (this.$results.children().length === 0) {
|
859 |
+
this.trigger('results:message', {
|
860 |
+
message: 'noResults'
|
861 |
+
});
|
862 |
+
}
|
863 |
+
|
864 |
+
return;
|
865 |
+
}
|
866 |
+
|
867 |
+
data.results = this.sort(data.results);
|
868 |
+
|
869 |
+
for (var d = 0; d < data.results.length; d++) {
|
870 |
+
var item = data.results[d];
|
871 |
+
|
872 |
+
var $option = this.option(item);
|
873 |
+
|
874 |
+
$options.push($option);
|
875 |
+
}
|
876 |
+
|
877 |
+
this.$results.append($options);
|
878 |
+
};
|
879 |
+
|
880 |
+
Results.prototype.position = function ($results, $dropdown) {
|
881 |
+
var $resultsContainer = $dropdown.find('.select2-results');
|
882 |
+
$resultsContainer.append($results);
|
883 |
+
};
|
884 |
+
|
885 |
+
Results.prototype.sort = function (data) {
|
886 |
+
var sorter = this.options.get('sorter');
|
887 |
+
|
888 |
+
return sorter(data);
|
889 |
+
};
|
890 |
+
|
891 |
+
Results.prototype.highlightFirstItem = function () {
|
892 |
+
var $options = this.$results
|
893 |
+
.find('.select2-results__option[data-selected]');
|
894 |
+
|
895 |
+
var $selected = $options.filter('[data-selected=true]');
|
896 |
+
|
897 |
+
// Check if there are any selected options
|
898 |
+
if ($selected.length > 0) {
|
899 |
+
// If there are selected options, highlight the first
|
900 |
+
$selected.first().trigger('mouseenter');
|
901 |
+
} else {
|
902 |
+
// If there are no selected options, highlight the first option
|
903 |
+
// in the dropdown
|
904 |
+
$options.first().trigger('mouseenter');
|
905 |
+
}
|
906 |
+
|
907 |
+
this.ensureHighlightVisible();
|
908 |
+
};
|
909 |
+
|
910 |
+
Results.prototype.setClasses = function () {
|
911 |
+
var self = this;
|
912 |
+
|
913 |
+
this.data.current(function (selected) {
|
914 |
+
var selectedIds = $.map(selected, function (s) {
|
915 |
+
return s.id.toString();
|
916 |
+
});
|
917 |
+
|
918 |
+
var $options = self.$results
|
919 |
+
.find('.select2-results__option[data-selected]');
|
920 |
+
|
921 |
+
$options.each(function () {
|
922 |
+
var $option = $(this);
|
923 |
+
|
924 |
+
var item = $.data(this, 'data');
|
925 |
+
|
926 |
+
// id needs to be converted to a string when comparing
|
927 |
+
var id = '' + item.id;
|
928 |
+
|
929 |
+
if ((item.element != null && item.element.selected) ||
|
930 |
+
(item.element == null && $.inArray(id, selectedIds) > -1)) {
|
931 |
+
$option.attr('data-selected', 'true');
|
932 |
+
} else {
|
933 |
+
$option.attr('data-selected', 'false');
|
934 |
+
}
|
935 |
+
});
|
936 |
+
|
937 |
+
});
|
938 |
+
};
|
939 |
+
|
940 |
+
Results.prototype.showLoading = function (params) {
|
941 |
+
this.hideLoading();
|
942 |
+
|
943 |
+
var loadingMore = this.options.get('translations').get('searching');
|
944 |
+
|
945 |
+
var loading = {
|
946 |
+
disabled: true,
|
947 |
+
loading: true,
|
948 |
+
text: loadingMore(params)
|
949 |
+
};
|
950 |
+
var $loading = this.option(loading);
|
951 |
+
$loading.className += ' loading-results';
|
952 |
+
|
953 |
+
this.$results.prepend($loading);
|
954 |
+
};
|
955 |
+
|
956 |
+
Results.prototype.hideLoading = function () {
|
957 |
+
this.$results.find('.loading-results').remove();
|
958 |
+
};
|
959 |
+
|
960 |
+
Results.prototype.option = function (data) {
|
961 |
+
var option = document.createElement('li');
|
962 |
+
option.className = 'select2-results__option';
|
963 |
+
|
964 |
+
var attrs = {
|
965 |
+
'role': 'option',
|
966 |
+
'data-selected': 'false',
|
967 |
+
'tabindex': -1
|
968 |
+
};
|
969 |
+
|
970 |
+
if (data.disabled) {
|
971 |
+
delete attrs['data-selected'];
|
972 |
+
attrs['aria-disabled'] = 'true';
|
973 |
+
}
|
974 |
+
|
975 |
+
if (data.id == null) {
|
976 |
+
delete attrs['data-selected'];
|
977 |
+
}
|
978 |
+
|
979 |
+
if (data._resultId != null) {
|
980 |
+
option.id = data._resultId;
|
981 |
+
}
|
982 |
+
|
983 |
+
if (data.title) {
|
984 |
+
option.title = data.title;
|
985 |
+
}
|
986 |
+
|
987 |
+
if (data.children) {
|
988 |
+
attrs['aria-label'] = data.text;
|
989 |
+
delete attrs['data-selected'];
|
990 |
+
}
|
991 |
+
|
992 |
+
for (var attr in attrs) {
|
993 |
+
var val = attrs[attr];
|
994 |
+
|
995 |
+
option.setAttribute(attr, val);
|
996 |
+
}
|
997 |
+
|
998 |
+
if (data.children) {
|
999 |
+
var $option = $(option);
|
1000 |
+
|
1001 |
+
var label = document.createElement('strong');
|
1002 |
+
label.className = 'select2-results__group';
|
1003 |
+
|
1004 |
+
var $label = $(label);
|
1005 |
+
this.template(data, label);
|
1006 |
+
$label.attr('role', 'presentation');
|
1007 |
+
|
1008 |
+
var $children = [];
|
1009 |
+
|
1010 |
+
for (var c = 0; c < data.children.length; c++) {
|
1011 |
+
var child = data.children[c];
|
1012 |
+
|
1013 |
+
var $child = this.option(child);
|
1014 |
+
|
1015 |
+
$children.push($child);
|
1016 |
+
}
|
1017 |
+
|
1018 |
+
var $childrenContainer = $('<ul></ul>', {
|
1019 |
+
'class': 'select2-results__options select2-results__options--nested',
|
1020 |
+
'role': 'listbox'
|
1021 |
+
});
|
1022 |
+
$childrenContainer.append($children);
|
1023 |
+
$option.attr('role', 'list');
|
1024 |
+
|
1025 |
+
$option.append(label);
|
1026 |
+
$option.append($childrenContainer);
|
1027 |
+
} else {
|
1028 |
+
this.template(data, option);
|
1029 |
+
}
|
1030 |
+
|
1031 |
+
$.data(option, 'data', data);
|
1032 |
+
|
1033 |
+
return option;
|
1034 |
+
};
|
1035 |
+
|
1036 |
+
Results.prototype.bind = function (container, $container) {
|
1037 |
+
var self = this;
|
1038 |
+
|
1039 |
+
var id = container.id + '-results';
|
1040 |
+
|
1041 |
+
this.$results.attr('id', id);
|
1042 |
+
|
1043 |
+
container.on('results:all', function (params) {
|
1044 |
+
self.clear();
|
1045 |
+
self.append(params.data);
|
1046 |
+
|
1047 |
+
if (container.isOpen()) {
|
1048 |
+
self.setClasses();
|
1049 |
+
self.highlightFirstItem();
|
1050 |
+
}
|
1051 |
+
});
|
1052 |
+
|
1053 |
+
container.on('results:append', function (params) {
|
1054 |
+
self.append(params.data);
|
1055 |
+
|
1056 |
+
if (container.isOpen()) {
|
1057 |
+
self.setClasses();
|
1058 |
+
}
|
1059 |
+
});
|
1060 |
+
|
1061 |
+
container.on('query', function (params) {
|
1062 |
+
self.hideMessages();
|
1063 |
+
self.showLoading(params);
|
1064 |
+
});
|
1065 |
+
|
1066 |
+
container.on('select', function () {
|
1067 |
+
if (!container.isOpen()) {
|
1068 |
+
return;
|
1069 |
+
}
|
1070 |
+
|
1071 |
+
self.setClasses();
|
1072 |
+
self.highlightFirstItem();
|
1073 |
+
});
|
1074 |
+
|
1075 |
+
container.on('unselect', function () {
|
1076 |
+
if (!container.isOpen()) {
|
1077 |
+
return;
|
1078 |
+
}
|
1079 |
+
|
1080 |
+
self.setClasses();
|
1081 |
+
self.highlightFirstItem();
|
1082 |
+
});
|
1083 |
+
|
1084 |
+
container.on('open', function () {
|
1085 |
+
// When the dropdown is open, aria-expended="true"
|
1086 |
+
self.$results.attr('aria-expanded', 'true');
|
1087 |
+
self.$results.attr('aria-hidden', 'false');
|
1088 |
+
|
1089 |
+
self.setClasses();
|
1090 |
+
self.ensureHighlightVisible();
|
1091 |
+
});
|
1092 |
+
|
1093 |
+
container.on('close', function () {
|
1094 |
+
// When the dropdown is closed, aria-expended="false"
|
1095 |
+
self.$results.attr('aria-expanded', 'false');
|
1096 |
+
self.$results.attr('aria-hidden', 'true');
|
1097 |
+
self.$results.removeAttr('aria-activedescendant');
|
1098 |
+
});
|
1099 |
+
|
1100 |
+
container.on('results:toggle', function () {
|
1101 |
+
var $highlighted = self.getHighlightedResults();
|
1102 |
+
|
1103 |
+
if ($highlighted.length === 0) {
|
1104 |
+
return;
|
1105 |
+
}
|
1106 |
+
|
1107 |
+
$highlighted.trigger('mouseup');
|
1108 |
+
});
|
1109 |
+
|
1110 |
+
container.on('results:select', function () {
|
1111 |
+
var $highlighted = self.getHighlightedResults();
|
1112 |
+
|
1113 |
+
if ($highlighted.length === 0) {
|
1114 |
+
return;
|
1115 |
+
}
|
1116 |
+
|
1117 |
+
var data = $highlighted.data('data');
|
1118 |
+
|
1119 |
+
if ($highlighted.attr('data-selected') == 'true') {
|
1120 |
+
self.trigger('close', {});
|
1121 |
+
} else {
|
1122 |
+
self.trigger('select', {
|
1123 |
+
data: data
|
1124 |
+
});
|
1125 |
+
}
|
1126 |
+
});
|
1127 |
+
|
1128 |
+
container.on('results:previous', function () {
|
1129 |
+
var $highlighted = self.getHighlightedResults();
|
1130 |
+
|
1131 |
+
var $options = self.$results.find('[data-selected]');
|
1132 |
+
|
1133 |
+
var currentIndex = $options.index($highlighted);
|
1134 |
+
|
1135 |
+
// If we are already at te top, don't move further
|
1136 |
+
if (currentIndex === 0) {
|
1137 |
+
return;
|
1138 |
+
}
|
1139 |
+
|
1140 |
+
var nextIndex = currentIndex - 1;
|
1141 |
+
|
1142 |
+
// If none are highlighted, highlight the first
|
1143 |
+
if ($highlighted.length === 0) {
|
1144 |
+
nextIndex = 0;
|
1145 |
+
}
|
1146 |
+
|
1147 |
+
var $next = $options.eq(nextIndex);
|
1148 |
+
|
1149 |
+
$next.trigger('mouseenter');
|
1150 |
+
|
1151 |
+
var currentOffset = self.$results.offset().top;
|
1152 |
+
var nextTop = $next.offset().top;
|
1153 |
+
var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset);
|
1154 |
+
|
1155 |
+
if (nextIndex === 0) {
|
1156 |
+
self.$results.scrollTop(0);
|
1157 |
+
} else if (nextTop - currentOffset < 0) {
|
1158 |
+
self.$results.scrollTop(nextOffset);
|
1159 |
+
}
|
1160 |
+
});
|
1161 |
+
|
1162 |
+
container.on('results:next', function () {
|
1163 |
+
var $highlighted = self.getHighlightedResults();
|
1164 |
+
|
1165 |
+
var $options = self.$results.find('[data-selected]');
|
1166 |
+
|
1167 |
+
var currentIndex = $options.index($highlighted);
|
1168 |
+
|
1169 |
+
var nextIndex = currentIndex + 1;
|
1170 |
+
|
1171 |
+
// If we are at the last option, stay there
|
1172 |
+
if (nextIndex >= $options.length) {
|
1173 |
+
return;
|
1174 |
+
}
|
1175 |
+
|
1176 |
+
var $next = $options.eq(nextIndex);
|
1177 |
+
|
1178 |
+
$next.trigger('mouseenter');
|
1179 |
+
|
1180 |
+
var currentOffset = self.$results.offset().top +
|
1181 |
+
self.$results.outerHeight(false);
|
1182 |
+
var nextBottom = $next.offset().top + $next.outerHeight(false);
|
1183 |
+
var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset;
|
1184 |
+
|
1185 |
+
if (nextIndex === 0) {
|
1186 |
+
self.$results.scrollTop(0);
|
1187 |
+
} else if (nextBottom > currentOffset) {
|
1188 |
+
self.$results.scrollTop(nextOffset);
|
1189 |
+
}
|
1190 |
+
});
|
1191 |
+
|
1192 |
+
container.on('results:focus', function (params) {
|
1193 |
+
params.element.addClass('select2-results__option--highlighted').attr('aria-selected', 'true');
|
1194 |
+
self.$results.attr('aria-activedescendant', params.element.attr('id'));
|
1195 |
+
});
|
1196 |
+
|
1197 |
+
container.on('results:message', function (params) {
|
1198 |
+
self.displayMessage(params);
|
1199 |
+
});
|
1200 |
+
|
1201 |
+
if ($.fn.mousewheel) {
|
1202 |
+
this.$results.on('mousewheel', function (e) {
|
1203 |
+
var top = self.$results.scrollTop();
|
1204 |
+
|
1205 |
+
var bottom = self.$results.get(0).scrollHeight - top + e.deltaY;
|
1206 |
+
|
1207 |
+
var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0;
|
1208 |
+
var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height();
|
1209 |
+
|
1210 |
+
if (isAtTop) {
|
1211 |
+
self.$results.scrollTop(0);
|
1212 |
+
|
1213 |
+
e.preventDefault();
|
1214 |
+
e.stopPropagation();
|
1215 |
+
} else if (isAtBottom) {
|
1216 |
+
self.$results.scrollTop(
|
1217 |
+
self.$results.get(0).scrollHeight - self.$results.height()
|
1218 |
+
);
|
1219 |
+
|
1220 |
+
e.preventDefault();
|
1221 |
+
e.stopPropagation();
|
1222 |
+
}
|
1223 |
+
});
|
1224 |
+
}
|
1225 |
+
|
1226 |
+
this.$results.on('mouseup', '.select2-results__option[data-selected]',
|
1227 |
+
function (evt) {
|
1228 |
+
var $this = $(this);
|
1229 |
+
|
1230 |
+
var data = $this.data('data');
|
1231 |
+
|
1232 |
+
if ($this.attr('data-selected') === 'true') {
|
1233 |
+
if (self.options.get('multiple')) {
|
1234 |
+
self.trigger('unselect', {
|
1235 |
+
originalEvent: evt,
|
1236 |
+
data: data
|
1237 |
+
});
|
1238 |
+
} else {
|
1239 |
+
self.trigger('close', {});
|
1240 |
+
}
|
1241 |
+
|
1242 |
+
return;
|
1243 |
+
}
|
1244 |
+
|
1245 |
+
self.trigger('select', {
|
1246 |
+
originalEvent: evt,
|
1247 |
+
data: data
|
1248 |
+
});
|
1249 |
+
});
|
1250 |
+
|
1251 |
+
this.$results.on('mouseenter', '.select2-results__option[data-selected]',
|
1252 |
+
function (evt) {
|
1253 |
+
var data = $(this).data('data');
|
1254 |
+
|
1255 |
+
self.getHighlightedResults()
|
1256 |
+
.removeClass('select2-results__option--highlighted')
|
1257 |
+
.attr('aria-selected', 'false');
|
1258 |
+
|
1259 |
+
self.trigger('results:focus', {
|
1260 |
+
data: data,
|
1261 |
+
element: $(this)
|
1262 |
+
});
|
1263 |
+
});
|
1264 |
+
};
|
1265 |
+
|
1266 |
+
Results.prototype.getHighlightedResults = function () {
|
1267 |
+
var $highlighted = this.$results
|
1268 |
+
.find('.select2-results__option--highlighted');
|
1269 |
+
|
1270 |
+
return $highlighted;
|
1271 |
+
};
|
1272 |
+
|
1273 |
+
Results.prototype.destroy = function () {
|
1274 |
+
this.$results.remove();
|
1275 |
+
};
|
1276 |
+
|
1277 |
+
Results.prototype.ensureHighlightVisible = function () {
|
1278 |
+
var $highlighted = this.getHighlightedResults();
|
1279 |
+
|
1280 |
+
if ($highlighted.length === 0) {
|
1281 |
+
return;
|
1282 |
+
}
|
1283 |
+
|
1284 |
+
var $options = this.$results.find('[data-selected]');
|
1285 |
+
|
1286 |
+
var currentIndex = $options.index($highlighted);
|
1287 |
+
|
1288 |
+
var currentOffset = this.$results.offset().top;
|
1289 |
+
var nextTop = $highlighted.offset().top;
|
1290 |
+
var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset);
|
1291 |
+
|
1292 |
+
var offsetDelta = nextTop - currentOffset;
|
1293 |
+
nextOffset -= $highlighted.outerHeight(false) * 2;
|
1294 |
+
|
1295 |
+
if (currentIndex <= 2) {
|
1296 |
+
this.$results.scrollTop(0);
|
1297 |
+
} else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) {
|
1298 |
+
this.$results.scrollTop(nextOffset);
|
1299 |
+
}
|
1300 |
+
};
|
1301 |
+
|
1302 |
+
Results.prototype.template = function (result, container) {
|
1303 |
+
var template = this.options.get('templateResult');
|
1304 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
1305 |
+
|
1306 |
+
var content = template(result, container);
|
1307 |
+
|
1308 |
+
if (content == null) {
|
1309 |
+
container.style.display = 'none';
|
1310 |
+
} else if (typeof content === 'string') {
|
1311 |
+
container.innerHTML = escapeMarkup(content);
|
1312 |
+
} else {
|
1313 |
+
$(container).append(content);
|
1314 |
+
}
|
1315 |
+
};
|
1316 |
+
|
1317 |
+
return Results;
|
1318 |
+
});
|
1319 |
+
|
1320 |
+
S2.define('select2/keys',[
|
1321 |
+
|
1322 |
+
], function () {
|
1323 |
+
var KEYS = {
|
1324 |
+
BACKSPACE: 8,
|
1325 |
+
TAB: 9,
|
1326 |
+
ENTER: 13,
|
1327 |
+
SHIFT: 16,
|
1328 |
+
CTRL: 17,
|
1329 |
+
ALT: 18,
|
1330 |
+
ESC: 27,
|
1331 |
+
SPACE: 32,
|
1332 |
+
PAGE_UP: 33,
|
1333 |
+
PAGE_DOWN: 34,
|
1334 |
+
END: 35,
|
1335 |
+
HOME: 36,
|
1336 |
+
LEFT: 37,
|
1337 |
+
UP: 38,
|
1338 |
+
RIGHT: 39,
|
1339 |
+
DOWN: 40,
|
1340 |
+
DELETE: 46
|
1341 |
+
};
|
1342 |
+
|
1343 |
+
return KEYS;
|
1344 |
+
});
|
1345 |
+
|
1346 |
+
S2.define('select2/selection/base',[
|
1347 |
+
'jquery',
|
1348 |
+
'../utils',
|
1349 |
+
'../keys'
|
1350 |
+
], function ($, Utils, KEYS) {
|
1351 |
+
function BaseSelection ($element, options) {
|
1352 |
+
this.$element = $element;
|
1353 |
+
this.options = options;
|
1354 |
+
|
1355 |
+
BaseSelection.__super__.constructor.call(this);
|
1356 |
+
}
|
1357 |
+
|
1358 |
+
Utils.Extend(BaseSelection, Utils.Observable);
|
1359 |
+
|
1360 |
+
BaseSelection.prototype.render = function () {
|
1361 |
+
var $selection = $(
|
1362 |
+
'<span class="select2-selection" ' +
|
1363 |
+
' aria-haspopup="true" aria-expanded="false">' +
|
1364 |
+
'</span>'
|
1365 |
+
);
|
1366 |
+
|
1367 |
+
this._tabindex = 0;
|
1368 |
+
|
1369 |
+
if (this.$element.data('old-tabindex') != null) {
|
1370 |
+
this._tabindex = this.$element.data('old-tabindex');
|
1371 |
+
} else if (this.$element.attr('tabindex') != null) {
|
1372 |
+
this._tabindex = this.$element.attr('tabindex');
|
1373 |
+
}
|
1374 |
+
|
1375 |
+
$selection.attr('title', this.$element.attr('title'));
|
1376 |
+
$selection.attr('tabindex', this._tabindex);
|
1377 |
+
|
1378 |
+
this.$selection = $selection;
|
1379 |
+
|
1380 |
+
return $selection;
|
1381 |
+
};
|
1382 |
+
|
1383 |
+
BaseSelection.prototype.bind = function (container, $container) {
|
1384 |
+
var self = this;
|
1385 |
+
|
1386 |
+
var id = container.id + '-container';
|
1387 |
+
var resultsId = container.id + '-results';
|
1388 |
+
var searchHidden = this.options.get('minimumResultsForSearch') === Infinity;
|
1389 |
+
|
1390 |
+
this.container = container;
|
1391 |
+
|
1392 |
+
this.$selection.on('focus', function (evt) {
|
1393 |
+
self.trigger('focus', evt);
|
1394 |
+
});
|
1395 |
+
|
1396 |
+
this.$selection.on('blur', function (evt) {
|
1397 |
+
self._handleBlur(evt);
|
1398 |
+
});
|
1399 |
+
|
1400 |
+
this.$selection.on('keydown', function (evt) {
|
1401 |
+
self.trigger('keypress', evt);
|
1402 |
+
|
1403 |
+
if (evt.which === KEYS.SPACE) {
|
1404 |
+
evt.preventDefault();
|
1405 |
+
}
|
1406 |
+
});
|
1407 |
+
|
1408 |
+
container.on('results:focus', function (params) {
|
1409 |
+
self.$selection.attr('aria-activedescendant', params.data._resultId);
|
1410 |
+
});
|
1411 |
+
|
1412 |
+
container.on('selection:update', function (params) {
|
1413 |
+
self.update(params.data);
|
1414 |
+
});
|
1415 |
+
|
1416 |
+
container.on('open', function () {
|
1417 |
+
// When the dropdown is open, aria-expanded="true"
|
1418 |
+
self.$selection.attr('aria-expanded', 'true');
|
1419 |
+
self.$selection.attr('aria-owns', resultsId);
|
1420 |
+
|
1421 |
+
self._attachCloseHandler(container);
|
1422 |
+
});
|
1423 |
+
|
1424 |
+
container.on('close', function () {
|
1425 |
+
// When the dropdown is closed, aria-expanded="false"
|
1426 |
+
self.$selection.attr('aria-expanded', 'false');
|
1427 |
+
self.$selection.removeAttr('aria-activedescendant');
|
1428 |
+
self.$selection.removeAttr('aria-owns');
|
1429 |
+
|
1430 |
+
// This needs to be delayed as the active element is the body when the
|
1431 |
+
// key is pressed.
|
1432 |
+
window.setTimeout(function () {
|
1433 |
+
self.$selection.focus();
|
1434 |
+
}, 1);
|
1435 |
+
|
1436 |
+
self._detachCloseHandler(container);
|
1437 |
+
});
|
1438 |
+
|
1439 |
+
container.on('enable', function () {
|
1440 |
+
self.$selection.attr('tabindex', self._tabindex);
|
1441 |
+
});
|
1442 |
+
|
1443 |
+
container.on('disable', function () {
|
1444 |
+
self.$selection.attr('tabindex', '-1');
|
1445 |
+
});
|
1446 |
+
};
|
1447 |
+
|
1448 |
+
BaseSelection.prototype._handleBlur = function (evt) {
|
1449 |
+
var self = this;
|
1450 |
+
|
1451 |
+
// This needs to be delayed as the active element is the body when the tab
|
1452 |
+
// key is pressed, possibly along with others.
|
1453 |
+
window.setTimeout(function () {
|
1454 |
+
// Don't trigger `blur` if the focus is still in the selection
|
1455 |
+
if (
|
1456 |
+
(document.activeElement == self.$selection[0]) ||
|
1457 |
+
($.contains(self.$selection[0], document.activeElement))
|
1458 |
+
) {
|
1459 |
+
return;
|
1460 |
+
}
|
1461 |
+
|
1462 |
+
self.trigger('blur', evt);
|
1463 |
+
}, 1);
|
1464 |
+
};
|
1465 |
+
|
1466 |
+
BaseSelection.prototype._attachCloseHandler = function (container) {
|
1467 |
+
var self = this;
|
1468 |
+
|
1469 |
+
$(document.body).on('mousedown.select2.' + container.id, function (e) {
|
1470 |
+
var $target = $(e.target);
|
1471 |
+
|
1472 |
+
var $select = $target.closest('.select2');
|
1473 |
+
|
1474 |
+
var $all = $('.select2.select2-container--open');
|
1475 |
+
|
1476 |
+
$all.each(function () {
|
1477 |
+
var $this = $(this);
|
1478 |
+
|
1479 |
+
if (this == $select[0]) {
|
1480 |
+
return;
|
1481 |
+
}
|
1482 |
+
|
1483 |
+
var $element = $this.data('element');
|
1484 |
+
$element.select2('close');
|
1485 |
+
|
1486 |
+
// Remove any focus when dropdown is closed by clicking outside the select area.
|
1487 |
+
// Timeout of 1 required for close to finish wrapping up.
|
1488 |
+
setTimeout(function(){
|
1489 |
+
$this.find('*:focus').blur();
|
1490 |
+
$target.focus();
|
1491 |
+
}, 1);
|
1492 |
+
});
|
1493 |
+
});
|
1494 |
+
};
|
1495 |
+
|
1496 |
+
BaseSelection.prototype._detachCloseHandler = function (container) {
|
1497 |
+
$(document.body).off('mousedown.select2.' + container.id);
|
1498 |
+
};
|
1499 |
+
|
1500 |
+
BaseSelection.prototype.position = function ($selection, $container) {
|
1501 |
+
var $selectionContainer = $container.find('.selection');
|
1502 |
+
$selectionContainer.append($selection);
|
1503 |
+
};
|
1504 |
+
|
1505 |
+
BaseSelection.prototype.destroy = function () {
|
1506 |
+
this._detachCloseHandler(this.container);
|
1507 |
+
};
|
1508 |
+
|
1509 |
+
BaseSelection.prototype.update = function (data) {
|
1510 |
+
throw new Error('The `update` method must be defined in child classes.');
|
1511 |
+
};
|
1512 |
+
|
1513 |
+
return BaseSelection;
|
1514 |
+
});
|
1515 |
+
|
1516 |
+
S2.define('select2/selection/single',[
|
1517 |
+
'jquery',
|
1518 |
+
'./base',
|
1519 |
+
'../utils',
|
1520 |
+
'../keys'
|
1521 |
+
], function ($, BaseSelection, Utils, KEYS) {
|
1522 |
+
function SingleSelection () {
|
1523 |
+
SingleSelection.__super__.constructor.apply(this, arguments);
|
1524 |
+
}
|
1525 |
+
|
1526 |
+
Utils.Extend(SingleSelection, BaseSelection);
|
1527 |
+
|
1528 |
+
SingleSelection.prototype.render = function () {
|
1529 |
+
var $selection = SingleSelection.__super__.render.call(this);
|
1530 |
+
|
1531 |
+
$selection.addClass('select2-selection--single');
|
1532 |
+
|
1533 |
+
$selection.html(
|
1534 |
+
'<span class="select2-selection__rendered"></span>' +
|
1535 |
+
'<span class="select2-selection__arrow" role="presentation">' +
|
1536 |
+
'<b role="presentation"></b>' +
|
1537 |
+
'</span>'
|
1538 |
+
);
|
1539 |
+
|
1540 |
+
return $selection;
|
1541 |
+
};
|
1542 |
+
|
1543 |
+
SingleSelection.prototype.bind = function (container, $container) {
|
1544 |
+
var self = this;
|
1545 |
+
|
1546 |
+
SingleSelection.__super__.bind.apply(this, arguments);
|
1547 |
+
|
1548 |
+
var id = container.id + '-container';
|
1549 |
+
|
1550 |
+
this.$selection.find('.select2-selection__rendered')
|
1551 |
+
.attr('id', id)
|
1552 |
+
.attr('role', 'textbox')
|
1553 |
+
.attr('aria-readonly', 'true');
|
1554 |
+
|
1555 |
+
var label = this.options.get( 'label' );
|
1556 |
+
|
1557 |
+
if ( typeof( label ) === 'string' ) {
|
1558 |
+
this.$selection.attr( 'aria-label', label );
|
1559 |
+
} else {
|
1560 |
+
this.$selection.attr( 'aria-labelledby', id );
|
1561 |
+
}
|
1562 |
+
|
1563 |
+
// This makes single non-search selects work in screen readers. If it causes problems elsewhere, remove.
|
1564 |
+
this.$selection.attr('role', 'combobox');
|
1565 |
+
|
1566 |
+
this.$selection.on('mousedown', function (evt) {
|
1567 |
+
// Only respond to left clicks
|
1568 |
+
if (evt.which !== 1) {
|
1569 |
+
return;
|
1570 |
+
}
|
1571 |
+
|
1572 |
+
self.trigger('toggle', {
|
1573 |
+
originalEvent: evt
|
1574 |
+
});
|
1575 |
+
});
|
1576 |
+
|
1577 |
+
this.$selection.on('focus', function (evt) {
|
1578 |
+
// User focuses on the container
|
1579 |
+
});
|
1580 |
+
|
1581 |
+
this.$selection.on('keydown', function (evt) {
|
1582 |
+
// If user starts typing an alphanumeric key on the keyboard, open if not opened.
|
1583 |
+
if (!container.isOpen() && evt.which >= 48 && evt.which <= 90) {
|
1584 |
+
container.open();
|
1585 |
+
}
|
1586 |
+
});
|
1587 |
+
|
1588 |
+
this.$selection.on('blur', function (evt) {
|
1589 |
+
// User exits the container
|
1590 |
+
});
|
1591 |
+
|
1592 |
+
container.on('focus', function (evt) {
|
1593 |
+
if (!container.isOpen()) {
|
1594 |
+
self.$selection.focus();
|
1595 |
+
}
|
1596 |
+
});
|
1597 |
+
|
1598 |
+
container.on('selection:update', function (params) {
|
1599 |
+
self.update(params.data);
|
1600 |
+
});
|
1601 |
+
};
|
1602 |
+
|
1603 |
+
SingleSelection.prototype.clear = function () {
|
1604 |
+
this.$selection.find('.select2-selection__rendered').empty();
|
1605 |
+
};
|
1606 |
+
|
1607 |
+
SingleSelection.prototype.display = function (data, container) {
|
1608 |
+
var template = this.options.get('templateSelection');
|
1609 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
1610 |
+
|
1611 |
+
return escapeMarkup(template(data, container));
|
1612 |
+
};
|
1613 |
+
|
1614 |
+
SingleSelection.prototype.selectionContainer = function () {
|
1615 |
+
return $('<span></span>');
|
1616 |
+
};
|
1617 |
+
|
1618 |
+
SingleSelection.prototype.update = function (data) {
|
1619 |
+
if (data.length === 0) {
|
1620 |
+
this.clear();
|
1621 |
+
return;
|
1622 |
+
}
|
1623 |
+
|
1624 |
+
var selection = data[0];
|
1625 |
+
|
1626 |
+
var $rendered = this.$selection.find('.select2-selection__rendered');
|
1627 |
+
var formatted = Utils.entityDecode(this.display(selection, $rendered));
|
1628 |
+
|
1629 |
+
$rendered.empty().text(formatted);
|
1630 |
+
$rendered.prop('title', selection.title || selection.text);
|
1631 |
+
};
|
1632 |
+
|
1633 |
+
return SingleSelection;
|
1634 |
+
});
|
1635 |
+
|
1636 |
+
S2.define('select2/selection/multiple',[
|
1637 |
+
'jquery',
|
1638 |
+
'./base',
|
1639 |
+
'../utils'
|
1640 |
+
], function ($, BaseSelection, Utils) {
|
1641 |
+
function MultipleSelection ($element, options) {
|
1642 |
+
MultipleSelection.__super__.constructor.apply(this, arguments);
|
1643 |
+
}
|
1644 |
+
|
1645 |
+
Utils.Extend(MultipleSelection, BaseSelection);
|
1646 |
+
|
1647 |
+
MultipleSelection.prototype.render = function () {
|
1648 |
+
var $selection = MultipleSelection.__super__.render.call(this);
|
1649 |
+
|
1650 |
+
$selection.addClass('select2-selection--multiple');
|
1651 |
+
|
1652 |
+
$selection.html(
|
1653 |
+
'<ul class="select2-selection__rendered" aria-live="polite" aria-relevant="additions removals" aria-atomic="true"></ul>'
|
1654 |
+
);
|
1655 |
+
|
1656 |
+
return $selection;
|
1657 |
+
};
|
1658 |
+
|
1659 |
+
MultipleSelection.prototype.bind = function (container, $container) {
|
1660 |
+
var self = this;
|
1661 |
+
|
1662 |
+
MultipleSelection.__super__.bind.apply(this, arguments);
|
1663 |
+
|
1664 |
+
this.$selection.on('click', function (evt) {
|
1665 |
+
self.trigger('toggle', {
|
1666 |
+
originalEvent: evt
|
1667 |
+
});
|
1668 |
+
});
|
1669 |
+
|
1670 |
+
this.$selection.on(
|
1671 |
+
'click',
|
1672 |
+
'.select2-selection__choice__remove',
|
1673 |
+
function (evt) {
|
1674 |
+
// Ignore the event if it is disabled
|
1675 |
+
if (self.options.get('disabled')) {
|
1676 |
+
return;
|
1677 |
+
}
|
1678 |
+
|
1679 |
+
var $remove = $(this);
|
1680 |
+
var $selection = $remove.parent();
|
1681 |
+
|
1682 |
+
var data = $selection.data('data');
|
1683 |
+
|
1684 |
+
self.trigger('unselect', {
|
1685 |
+
originalEvent: evt,
|
1686 |
+
data: data
|
1687 |
+
});
|
1688 |
+
}
|
1689 |
+
);
|
1690 |
+
|
1691 |
+
this.$selection.on('keydown', function (evt) {
|
1692 |
+
// If user starts typing an alphanumeric key on the keyboard, open if not opened.
|
1693 |
+
if (!container.isOpen() && evt.which >= 48 && evt.which <= 90) {
|
1694 |
+
container.open();
|
1695 |
+
}
|
1696 |
+
});
|
1697 |
+
|
1698 |
+
// Focus on the search field when the container is focused instead of the main container.
|
1699 |
+
container.on( 'focus', function(){
|
1700 |
+
self.focusOnSearch();
|
1701 |
+
});
|
1702 |
+
};
|
1703 |
+
|
1704 |
+
MultipleSelection.prototype.clear = function () {
|
1705 |
+
this.$selection.find('.select2-selection__rendered').empty();
|
1706 |
+
};
|
1707 |
+
|
1708 |
+
MultipleSelection.prototype.display = function (data, container) {
|
1709 |
+
var template = this.options.get('templateSelection');
|
1710 |
+
var escapeMarkup = this.options.get('escapeMarkup');
|
1711 |
+
|
1712 |
+
return escapeMarkup(template(data, container));
|
1713 |
+
};
|
1714 |
+
|
1715 |
+
MultipleSelection.prototype.selectionContainer = function () {
|
1716 |
+
var $container = $(
|
1717 |
+
'<li class="select2-selection__choice">' +
|
1718 |
+
'<span class="select2-selection__choice__remove" role="presentation" aria-hidden="true">' +
|
1719 |
+
'×' +
|
1720 |
+
'</span>' +
|
1721 |
+
'</li>'
|
1722 |
+
);
|
1723 |
+
|
1724 |
+
return $container;
|
1725 |
+
};
|
1726 |
+
|
1727 |
+
/**
|
1728 |
+
* Focus on the search field instead of the main multiselect container.
|
1729 |
+
*/
|
1730 |
+
MultipleSelection.prototype.focusOnSearch = function() {
|
1731 |
+
var self = this;
|
1732 |
+
|
1733 |
+
if ('undefined' !== typeof self.$search) {
|
1734 |
+
// Needs 1 ms delay because of other 1 ms setTimeouts when rendering.
|
1735 |
+
setTimeout(function(){
|
1736 |
+
// Prevent the dropdown opening again when focused from this.
|
1737 |
+
// This gets reset automatically when focus is triggered.
|
1738 |
+
self._keyUpPrevented = true;
|
1739 |
+
|
1740 |
+
self.$search.focus();
|
1741 |
+
}, 1);
|
1742 |
+
}
|
1743 |
+
}
|
1744 |
+
|
1745 |
+
MultipleSelection.prototype.update = function (data) {
|
1746 |
+
this.clear();
|
1747 |
+
|
1748 |
+
if (data.length === 0) {
|
1749 |
+
return;
|
1750 |
+
}
|
1751 |
+
|
1752 |
+
var $selections = [];
|
1753 |
+
|
1754 |
+
for (var d = 0; d < data.length; d++) {
|
1755 |
+
var selection = data[d];
|
1756 |
+
|
1757 |
+
var $selection = this.selectionContainer();
|
1758 |
+
var removeItemTag = $selection.html();
|
1759 |
+
var formatted = this.display(selection, $selection);
|
1760 |
+
if ('string' === typeof formatted) {
|
1761 |
+
formatted = Utils.entityDecode(formatted.trim());
|
1762 |
+
}
|
1763 |
+
|
1764 |
+
$selection.text(formatted);
|
1765 |
+
$selection.prepend(removeItemTag);
|
1766 |
+
$selection.prop('title', selection.title || selection.text);
|
1767 |
+
|
1768 |
+
$selection.data('data', selection);
|
1769 |
+
|
1770 |
+
$selections.push($selection);
|
1771 |
+
}
|
1772 |
+
|
1773 |
+
var $rendered = this.$selection.find('.select2-selection__rendered');
|
1774 |
+
|
1775 |
+
Utils.appendMany($rendered, $selections);
|
1776 |
+
};
|
1777 |
+
|
1778 |
+
return MultipleSelection;
|
1779 |
+
});
|
1780 |
+
|
1781 |
+
S2.define('select2/selection/placeholder',[
|
1782 |
+
'../utils'
|
1783 |
+
], function (Utils) {
|
1784 |
+
function Placeholder (decorated, $element, options) {
|
1785 |
+
this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
|
1786 |
+
|
1787 |
+
decorated.call(this, $element, options);
|
1788 |
+
}
|
1789 |
+
|
1790 |
+
Placeholder.prototype.normalizePlaceholder = function (_, placeholder) {
|
1791 |
+
if (typeof placeholder === 'string') {
|
1792 |
+
placeholder = {
|
1793 |
+
id: '',
|
1794 |
+
text: placeholder
|
1795 |
+
};
|
1796 |
+
}
|
1797 |
+
|
1798 |
+
return placeholder;
|
1799 |
+
};
|
1800 |
+
|
1801 |
+
Placeholder.prototype.createPlaceholder = function (decorated, placeholder) {
|
1802 |
+
var $placeholder = this.selectionContainer();
|
1803 |
+
|
1804 |
+
$placeholder.text(Utils.entityDecode(this.display(placeholder)));
|
1805 |
+
$placeholder.addClass('select2-selection__placeholder')
|
1806 |
+
.removeClass('select2-selection__choice');
|
1807 |
+
|
1808 |
+
return $placeholder;
|
1809 |
+
};
|
1810 |
+
|
1811 |
+
Placeholder.prototype.update = function (decorated, data) {
|
1812 |
+
var singlePlaceholder = (
|
1813 |
+
data.length == 1 && data[0].id != this.placeholder.id
|
1814 |
+
);
|
1815 |
+
var multipleSelections = data.length > 1;
|
1816 |
+
|
1817 |
+
if (multipleSelections || singlePlaceholder) {
|
1818 |
+
return decorated.call(this, data);
|
1819 |
+
}
|
1820 |
+
|
1821 |
+
this.clear();
|
1822 |
+
|
1823 |
+
var $placeholder = this.createPlaceholder(this.placeholder);
|
1824 |
+
|
1825 |
+
this.$selection.find('.select2-selection__rendered').append($placeholder);
|
1826 |
+
};
|
1827 |
+
|
1828 |
+
return Placeholder;
|
1829 |
+
});
|
1830 |
+
|
1831 |
+
S2.define('select2/selection/allowClear',[
|
1832 |
+
'jquery',
|
1833 |
+
'../keys'
|
1834 |
+
], function ($, KEYS) {
|
1835 |
+
function AllowClear () { }
|
1836 |
+
|
1837 |
+
AllowClear.prototype.bind = function (decorated, container, $container) {
|
1838 |
+
var self = this;
|
1839 |
+
|
1840 |
+
decorated.call(this, container, $container);
|
1841 |
+
|
1842 |
+
if (this.placeholder == null) {
|
1843 |
+
if (this.options.get('debug') && window.console && console.error) {
|
1844 |
+
console.error(
|
1845 |
+
'Select2: The `allowClear` option should be used in combination ' +
|
1846 |
+
'with the `placeholder` option.'
|
1847 |
+
);
|
1848 |
+
}
|
1849 |
+
}
|
1850 |
+
|
1851 |
+
this.$selection.on('mousedown', '.select2-selection__clear',
|
1852 |
+
function (evt) {
|
1853 |
+
self._handleClear(evt);
|
1854 |
+
});
|
1855 |
+
|
1856 |
+
container.on('keypress', function (evt) {
|
1857 |
+
self._handleKeyboardClear(evt, container);
|
1858 |
+
});
|
1859 |
+
};
|
1860 |
+
|
1861 |
+
AllowClear.prototype._handleClear = function (_, evt) {
|
1862 |
+
// Ignore the event if it is disabled
|
1863 |
+
if (this.options.get('disabled')) {
|
1864 |
+
return;
|
1865 |
+
}
|
1866 |
+
|
1867 |
+
var $clear = this.$selection.find('.select2-selection__clear');
|
1868 |
+
|
1869 |
+
// Ignore the event if nothing has been selected
|
1870 |
+
if ($clear.length === 0) {
|
1871 |
+
return;
|
1872 |
+
}
|
1873 |
+
|
1874 |
+
evt.stopPropagation();
|
1875 |
+
|
1876 |
+
var data = $clear.data('data');
|
1877 |
+
|
1878 |
+
for (var d = 0; d < data.length; d++) {
|
1879 |
+
var unselectData = {
|
1880 |
+
data: data[d]
|
1881 |
+
};
|
1882 |
+
|
1883 |
+
// Trigger the `unselect` event, so people can prevent it from being
|
1884 |
+
// cleared.
|
1885 |
+
this.trigger('unselect', unselectData);
|
1886 |
+
|
1887 |
+
// If the event was prevented, don't clear it out.
|
1888 |
+
if (unselectData.prevented) {
|
1889 |
+
return;
|
1890 |
+
}
|
1891 |
+
}
|
1892 |
+
|
1893 |
+
this.$element.val(this.placeholder.id).trigger('change');
|
1894 |
+
|
1895 |
+
this.trigger('toggle', {});
|
1896 |
+
};
|
1897 |
+
|
1898 |
+
AllowClear.prototype._handleKeyboardClear = function (_, evt, container) {
|
1899 |
+
if (container.isOpen()) {
|
1900 |
+
return;
|
1901 |
+
}
|
1902 |
+
|
1903 |
+
if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) {
|
1904 |
+
this._handleClear(evt);
|
1905 |
+
}
|
1906 |
+
};
|
1907 |
+
|
1908 |
+
AllowClear.prototype.update = function (decorated, data) {
|
1909 |
+
decorated.call(this, data);
|
1910 |
+
|
1911 |
+
if (this.$selection.find('.select2-selection__placeholder').length > 0 ||
|
1912 |
+
data.length === 0) {
|
1913 |
+
return;
|
1914 |
+
}
|
1915 |
+
|
1916 |
+
var $remove = $(
|
1917 |
+
'<span class="select2-selection__clear">' +
|
1918 |
+
'×' +
|
1919 |
+
'</span>'
|
1920 |
+
);
|
1921 |
+
$remove.data('data', data);
|
1922 |
+
|
1923 |
+
this.$selection.find('.select2-selection__rendered').prepend($remove);
|
1924 |
+
};
|
1925 |
+
|
1926 |
+
return AllowClear;
|
1927 |
+
});
|
1928 |
+
|
1929 |
+
S2.define('select2/selection/search',[
|
1930 |
+
'jquery',
|
1931 |
+
'../utils',
|
1932 |
+
'../keys'
|
1933 |
+
], function ($, Utils, KEYS) {
|
1934 |
+
function Search (decorated, $element, options) {
|
1935 |
+
decorated.call(this, $element, options);
|
1936 |
+
}
|
1937 |
+
|
1938 |
+
Search.prototype.render = function (decorated) {
|
1939 |
+
var $search = $(
|
1940 |
+
'<li class="select2-search select2-search--inline">' +
|
1941 |
+
'<input class="select2-search__field" type="text" tabindex="-1"' +
|
1942 |
+
' autocomplete="off" autocorrect="off" autocapitalize="none"' +
|
1943 |
+
' spellcheck="false" role="textbox" aria-autocomplete="list" />' +
|
1944 |
+
'</li>'
|
1945 |
+
);
|
1946 |
+
|
1947 |
+
this.$searchContainer = $search;
|
1948 |
+
this.$search = $search.find('input');
|
1949 |
+
|
1950 |
+
var $rendered = decorated.call(this);
|
1951 |
+
|
1952 |
+
this._transferTabIndex();
|
1953 |
+
|
1954 |
+
return $rendered;
|
1955 |
+
};
|
1956 |
+
|
1957 |
+
Search.prototype.bind = function (decorated, container, $container) {
|
1958 |
+
var self = this;
|
1959 |
+
var resultsId = container.id + '-results';
|
1960 |
+
|
1961 |
+
decorated.call(this, container, $container);
|
1962 |
+
|
1963 |
+
container.on('open', function () {
|
1964 |
+
self.$search.attr('aria-owns', resultsId);
|
1965 |
+
self.$search.trigger('focus');
|
1966 |
+
});
|
1967 |
+
|
1968 |
+
container.on('close', function () {
|
1969 |
+
self.$search.val('');
|
1970 |
+
self.$search.removeAttr('aria-activedescendant');
|
1971 |
+
self.$search.removeAttr('aria-owns');
|
1972 |
+
self.$search.trigger('focus');
|
1973 |
+
});
|
1974 |
+
|
1975 |
+
container.on('enable', function () {
|
1976 |
+
self.$search.prop('disabled', false);
|
1977 |
+
|
1978 |
+
self._transferTabIndex();
|
1979 |
+
});
|
1980 |
+
|
1981 |
+
container.on('disable', function () {
|
1982 |
+
self.$search.prop('disabled', true);
|
1983 |
+
});
|
1984 |
+
|
1985 |
+
container.on('focus', function (evt) {
|
1986 |
+
self.$search.trigger('focus');
|
1987 |
+
});
|
1988 |
+
|
1989 |
+
container.on('results:focus', function (params) {
|
1990 |
+
self.$search.attr('aria-activedescendant', params.data._resultId);
|
1991 |
+
});
|
1992 |
+
|
1993 |
+
this.$selection.on('focusin', '.select2-search--inline', function (evt) {
|
1994 |
+
self.trigger('focus', evt);
|
1995 |
+
});
|
1996 |
+
|
1997 |
+
this.$selection.on('focusout', '.select2-search--inline', function (evt) {
|
1998 |
+
self._handleBlur(evt);
|
1999 |
+
});
|
2000 |
+
|
2001 |
+
this.$selection.on('keydown', '.select2-search--inline', function (evt) {
|
2002 |
+
evt.stopPropagation();
|
2003 |
+
|
2004 |
+
self.trigger('keypress', evt);
|
2005 |
+
|
2006 |
+
self._keyUpPrevented = evt.isDefaultPrevented();
|
2007 |
+
|
2008 |
+
var key = evt.which;
|
2009 |
+
|
2010 |
+
if (key === KEYS.BACKSPACE && self.$search.val() === '') {
|
2011 |
+
var $previousChoice = self.$searchContainer
|
2012 |
+
.prev('.select2-selection__choice');
|
2013 |
+
|
2014 |
+
if ($previousChoice.length > 0) {
|
2015 |
+
var item = $previousChoice.data('data');
|
2016 |
+
|
2017 |
+
self.searchRemoveChoice(item);
|
2018 |
+
|
2019 |
+
evt.preventDefault();
|
2020 |
+
}
|
2021 |
+
} else if (evt.which === KEYS.ENTER) {
|
2022 |
+
container.open();
|
2023 |
+
evt.preventDefault();
|
2024 |
+
}
|
2025 |
+
});
|
2026 |
+
|
2027 |
+
// Try to detect the IE version should the `documentMode` property that
|
2028 |
+
// is stored on the document. This is only implemented in IE and is
|
2029 |
+
// slightly cleaner than doing a user agent check.
|
2030 |
+
// This property is not available in Edge, but Edge also doesn't have
|
2031 |
+
// this bug.
|
2032 |
+
var msie = document.documentMode;
|
2033 |
+
var disableInputEvents = msie && msie <= 11;
|
2034 |
+
|
2035 |
+
// Workaround for browsers which do not support the `input` event
|
2036 |
+
// This will prevent double-triggering of events for browsers which support
|
2037 |
+
// both the `keyup` and `input` events.
|
2038 |
+
this.$selection.on(
|
2039 |
+
'input.searchcheck',
|
2040 |
+
'.select2-search--inline',
|
2041 |
+
function (evt) {
|
2042 |
+
// IE will trigger the `input` event when a placeholder is used on a
|
2043 |
+
// search box. To get around this issue, we are forced to ignore all
|
2044 |
+
// `input` events in IE and keep using `keyup`.
|
2045 |
+
if (disableInputEvents) {
|
2046 |
+
self.$selection.off('input.search input.searchcheck');
|
2047 |
+
return;
|
2048 |
+
}
|
2049 |
+
|
2050 |
+
// Unbind the duplicated `keyup` event
|
2051 |
+
self.$selection.off('keyup.search');
|
2052 |
+
}
|
2053 |
+
);
|
2054 |
+
|
2055 |
+
this.$selection.on(
|
2056 |
+
'keyup.search input.search',
|
2057 |
+
'.select2-search--inline',
|
2058 |
+
function (evt) {
|
2059 |
+
// IE will trigger the `input` event when a placeholder is used on a
|
2060 |
+
// search box. To get around this issue, we are forced to ignore all
|
2061 |
+
// `input` events in IE and keep using `keyup`.
|
2062 |
+
if (disableInputEvents && evt.type === 'input') {
|
2063 |
+
self.$selection.off('input.search input.searchcheck');
|
2064 |
+
return;
|
2065 |
+
}
|
2066 |
+
|
2067 |
+
var key = evt.which;
|
2068 |
+
|
2069 |
+
// We can freely ignore events from modifier keys
|
2070 |
+
if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) {
|
2071 |
+
return;
|
2072 |
+
}
|
2073 |
+
|
2074 |
+
// Tabbing will be handled during the `keydown` phase
|
2075 |
+
if (key == KEYS.TAB) {
|
2076 |
+
return;
|
2077 |
+
}
|
2078 |
+
|
2079 |
+
self.handleSearch(evt);
|
2080 |
+
}
|
2081 |
+
);
|
2082 |
+
};
|
2083 |
+
|
2084 |
+
/**
|
2085 |
+
* This method will transfer the tabindex attribute from the rendered
|
2086 |
+
* selection to the search box. This allows for the search box to be used as
|
2087 |
+
* the primary focus instead of the selection container.
|
2088 |
+
*
|
2089 |
+
* @private
|
2090 |
+
*/
|
2091 |
+
Search.prototype._transferTabIndex = function (decorated) {
|
2092 |
+
this.$search.attr('tabindex', this.$selection.attr('tabindex'));
|
2093 |
+
this.$selection.attr('tabindex', '-1');
|
2094 |
+
};
|
2095 |
+
|
2096 |
+
Search.prototype.createPlaceholder = function (decorated, placeholder) {
|
2097 |
+
this.$search.attr('placeholder', placeholder.text);
|
2098 |
+
};
|
2099 |
+
|
2100 |
+
Search.prototype.update = function (decorated, data) {
|
2101 |
+
var searchHadFocus = this.$search[0] == document.activeElement;
|
2102 |
+
|
2103 |
+
this.$search.attr('placeholder', '');
|
2104 |
+
|
2105 |
+
decorated.call(this, data);
|
2106 |
+
|
2107 |
+
this.$selection.find('.select2-selection__rendered')
|
2108 |
+
.append(this.$searchContainer);
|
2109 |
+
|
2110 |
+
this.resizeSearch();
|
2111 |
+
if (searchHadFocus) {
|
2112 |
+
this.$search.focus();
|
2113 |
+
}
|
2114 |
+
};
|
2115 |
+
|
2116 |
+
Search.prototype.handleSearch = function () {
|
2117 |
+
this.resizeSearch();
|
2118 |
+
|
2119 |
+
if (!this._keyUpPrevented) {
|
2120 |
+
var input = this.$search.val();
|
2121 |
+
|
2122 |
+
this.trigger('query', {
|
2123 |
+
term: input
|
2124 |
+
});
|
2125 |
+
}
|
2126 |
+
|
2127 |
+
this._keyUpPrevented = false;
|
2128 |
+
};
|
2129 |
+
|
2130 |
+
Search.prototype.searchRemoveChoice = function (decorated, item) {
|
2131 |
+
this.trigger('unselect', {
|
2132 |
+
data: item
|
2133 |
+
});
|
2134 |
+
|
2135 |
+
this.$search.val(item.text);
|
2136 |
+
this.handleSearch();
|
2137 |
+
};
|
2138 |
+
|
2139 |
+
Search.prototype.resizeSearch = function () {
|
2140 |
+
this.$search.css('width', '25px');
|
2141 |
+
|
2142 |
+
var width = '';
|
2143 |
+
|
2144 |
+
if (this.$search.attr('placeholder') !== '') {
|
2145 |
+
width = this.$selection.find('.select2-selection__rendered').innerWidth();
|
2146 |
+
} else {
|
2147 |
+
var minimumWidth = this.$search.val().length + 1;
|
2148 |
+
|
2149 |
+
width = (minimumWidth * 0.75) + 'em';
|
2150 |
+
}
|
2151 |
+
|
2152 |
+
this.$search.css('width', width);
|
2153 |
+
};
|
2154 |
+
|
2155 |
+
return Search;
|
2156 |
+
});
|
2157 |
+
|
2158 |
+
S2.define('select2/selection/eventRelay',[
|
2159 |
+
'jquery'
|
2160 |
+
], function ($) {
|
2161 |
+
function EventRelay () { }
|
2162 |
+
|
2163 |
+
EventRelay.prototype.bind = function (decorated, container, $container) {
|
2164 |
+
var self = this;
|
2165 |
+
var relayEvents = [
|
2166 |
+
'open', 'opening',
|
2167 |
+
'close', 'closing',
|
2168 |
+
'select', 'selecting',
|
2169 |
+
'unselect', 'unselecting'
|
2170 |
+
];
|
2171 |
+
|
2172 |
+
var preventableEvents = ['opening', 'closing', 'selecting', 'unselecting'];
|
2173 |
+
|
2174 |
+
decorated.call(this, container, $container);
|
2175 |
+
|
2176 |
+
container.on('*', function (name, params) {
|
2177 |
+
// Ignore events that should not be relayed
|
2178 |
+
if ($.inArray(name, relayEvents) === -1) {
|
2179 |
+
return;
|
2180 |
+
}
|
2181 |
+
|
2182 |
+
// The parameters should always be an object
|
2183 |
+
params = params || {};
|
2184 |
+
|
2185 |
+
// Generate the jQuery event for the Select2 event
|
2186 |
+
var evt = $.Event('select2:' + name, {
|
2187 |
+
params: params
|
2188 |
+
});
|
2189 |
+
|
2190 |
+
self.$element.trigger(evt);
|
2191 |
+
|
2192 |
+
// Only handle preventable events if it was one
|
2193 |
+
if ($.inArray(name, preventableEvents) === -1) {
|
2194 |
+
return;
|
2195 |
+
}
|
2196 |
+
|
2197 |
+
params.prevented = evt.isDefaultPrevented();
|
2198 |
+
});
|
2199 |
+
};
|
2200 |
+
|
2201 |
+
return EventRelay;
|
2202 |
+
});
|
2203 |
+
|
2204 |
+
S2.define('select2/translation',[
|
2205 |
+
'jquery',
|
2206 |
+
'require'
|
2207 |
+
], function ($, require) {
|
2208 |
+
function Translation (dict) {
|
2209 |
+
this.dict = dict || {};
|
2210 |
+
}
|
2211 |
+
|
2212 |
+
Translation.prototype.all = function () {
|
2213 |
+
return this.dict;
|
2214 |
+
};
|
2215 |
+
|
2216 |
+
Translation.prototype.get = function (key) {
|
2217 |
+
return this.dict[key];
|
2218 |
+
};
|
2219 |
+
|
2220 |
+
Translation.prototype.extend = function (translation) {
|
2221 |
+
this.dict = $.extend({}, translation.all(), this.dict);
|
2222 |
+
};
|
2223 |
+
|
2224 |
+
// Static functions
|
2225 |
+
|
2226 |
+
Translation._cache = {};
|
2227 |
+
|
2228 |
+
Translation.loadPath = function (path) {
|
2229 |
+
if (!(path in Translation._cache)) {
|
2230 |
+
var translations = require(path);
|
2231 |
+
|
2232 |
+
Translation._cache[path] = translations;
|
2233 |
+
}
|
2234 |
+
|
2235 |
+
return new Translation(Translation._cache[path]);
|
2236 |
+
};
|
2237 |
+
|
2238 |
+
return Translation;
|
2239 |
+
});
|
2240 |
+
|
2241 |
+
S2.define('select2/diacritics',[
|
2242 |
+
|
2243 |
+
], function () {
|
2244 |
+
var diacritics = {
|
2245 |
+
'\u24B6': 'A',
|
2246 |
+
'\uFF21': 'A',
|
2247 |
+
'\u00C0': 'A',
|
2248 |
+
'\u00C1': 'A',
|
2249 |
+
'\u00C2': 'A',
|
2250 |
+
'\u1EA6': 'A',
|
2251 |
+
'\u1EA4': 'A',
|
2252 |
+
'\u1EAA': 'A',
|
2253 |
+
'\u1EA8': 'A',
|
2254 |
+
'\u00C3': 'A',
|
2255 |
+
'\u0100': 'A',
|
2256 |
+
'\u0102': 'A',
|
2257 |
+
'\u1EB0': 'A',
|
2258 |
+
'\u1EAE': 'A',
|
2259 |
+
'\u1EB4': 'A',
|
2260 |
+
'\u1EB2': 'A',
|
2261 |
+
'\u0226': 'A',
|
2262 |
+
'\u01E0': 'A',
|
2263 |
+
'\u00C4': 'A',
|
2264 |
+
'\u01DE': 'A',
|
2265 |
+
'\u1EA2': 'A',
|
2266 |
+
'\u00C5': 'A',
|
2267 |
+
'\u01FA': 'A',
|
2268 |
+
'\u01CD': 'A',
|
2269 |
+
'\u0200': 'A',
|
2270 |
+
'\u0202': 'A',
|
2271 |
+
'\u1EA0': 'A',
|
2272 |
+
'\u1EAC': 'A',
|
2273 |
+
'\u1EB6': 'A',
|
2274 |
+
'\u1E00': 'A',
|
2275 |
+
'\u0104': 'A',
|
2276 |
+
'\u023A': 'A',
|
2277 |
+
'\u2C6F': 'A',
|
2278 |
+
'\uA732': 'AA',
|
2279 |
+
'\u00C6': 'AE',
|
2280 |
+
'\u01FC': 'AE',
|
2281 |
+
'\u01E2': 'AE',
|
2282 |
+
'\uA734': 'AO',
|
2283 |
+
'\uA736': 'AU',
|
2284 |
+
'\uA738': 'AV',
|
2285 |
+
'\uA73A': 'AV',
|
2286 |
+
'\uA73C': 'AY',
|
2287 |
+
'\u24B7': 'B',
|
2288 |
+
'\uFF22': 'B',
|
2289 |
+
'\u1E02': 'B',
|
2290 |
+
'\u1E04': 'B',
|
2291 |
+
'\u1E06': 'B',
|
2292 |
+
'\u0243': 'B',
|
2293 |
+
'\u0182': 'B',
|
2294 |
+
'\u0181': 'B',
|
2295 |
+
'\u24B8': 'C',
|
2296 |
+
'\uFF23': 'C',
|
2297 |
+
'\u0106': 'C',
|
2298 |
+
'\u0108': 'C',
|
2299 |
+
'\u010A': 'C',
|
2300 |
+
'\u010C': 'C',
|
2301 |
+
'\u00C7': 'C',
|
2302 |
+
'\u1E08': 'C',
|
2303 |
+
'\u0187': 'C',
|
2304 |
+
'\u023B': 'C',
|
2305 |
+
'\uA73E': 'C',
|
2306 |
+
'\u24B9': 'D',
|
2307 |
+
'\uFF24': 'D',
|
2308 |
+
'\u1E0A': 'D',
|
2309 |
+
'\u010E': 'D',
|
2310 |
+
'\u1E0C': 'D',
|
2311 |
+
'\u1E10': 'D',
|
2312 |
+
'\u1E12': 'D',
|
2313 |
+
'\u1E0E': 'D',
|
2314 |
+
'\u0110': 'D',
|
2315 |
+
'\u018B': 'D',
|
2316 |
+
'\u018A': 'D',
|
2317 |
+
'\u0189': 'D',
|
2318 |
+
'\uA779': 'D',
|
2319 |
+
'\u01F1': 'DZ',
|
2320 |
+
'\u01C4': 'DZ',
|
2321 |
+
'\u01F2': 'Dz',
|
2322 |
+
'\u01C5': 'Dz',
|
2323 |
+
'\u24BA': 'E',
|
2324 |
+
'\uFF25': 'E',
|
2325 |
+
'\u00C8': 'E',
|
2326 |
+
'\u00C9': 'E',
|
2327 |
+
'\u00CA': 'E',
|
2328 |
+
'\u1EC0': 'E',
|
2329 |
+
'\u1EBE': 'E',
|
2330 |
+
'\u1EC4': 'E',
|
2331 |
+
'\u1EC2': 'E',
|
2332 |
+
'\u1EBC': 'E',
|
2333 |
+
'\u0112': 'E',
|
2334 |
+
'\u1E14': 'E',
|
2335 |
+
'\u1E16': 'E',
|
2336 |
+
'\u0114': 'E',
|
2337 |
+
'\u0116': 'E',
|
2338 |
+
'\u00CB': 'E',
|
2339 |
+
'\u1EBA': 'E',
|
2340 |
+
'\u011A': 'E',
|
2341 |
+
'\u0204': 'E',
|
2342 |
+
'\u0206': 'E',
|
2343 |
+
'\u1EB8': 'E',
|
2344 |
+
'\u1EC6': 'E',
|
2345 |
+
'\u0228': 'E',
|
2346 |
+
'\u1E1C': 'E',
|
2347 |
+
'\u0118': 'E',
|
2348 |
+
'\u1E18': 'E',
|
2349 |
+
'\u1E1A': 'E',
|
2350 |
+
'\u0190': 'E',
|
2351 |
+
'\u018E': 'E',
|
2352 |
+
'\u24BB': 'F',
|
2353 |
+
'\uFF26': 'F',
|
2354 |
+
'\u1E1E': 'F',
|
2355 |
+
'\u0191': 'F',
|
2356 |
+
'\uA77B': 'F',
|
2357 |
+
'\u24BC': 'G',
|
2358 |
+
'\uFF27': 'G',
|
2359 |
+
'\u01F4': 'G',
|
2360 |
+
'\u011C': 'G',
|
2361 |
+
'\u1E20': 'G',
|
2362 |
+
'\u011E': 'G',
|
2363 |
+
'\u0120': 'G',
|
2364 |
+
'\u01E6': 'G',
|
2365 |
+
'\u0122': 'G',
|
2366 |
+
'\u01E4': 'G',
|
2367 |
+
'\u0193': 'G',
|
2368 |
+
'\uA7A0': 'G',
|
2369 |
+
'\uA77D': 'G',
|
2370 |
+
'\uA77E': 'G',
|
2371 |
+
'\u24BD': 'H',
|
2372 |
+
'\uFF28': 'H',
|
2373 |
+
'\u0124': 'H',
|
2374 |
+
'\u1E22': 'H',
|
2375 |
+
'\u1E26': 'H',
|
2376 |
+
'\u021E': 'H',
|
2377 |
+
'\u1E24': 'H',
|
2378 |
+
'\u1E28': 'H',
|
2379 |
+
'\u1E2A': 'H',
|
2380 |
+
'\u0126': 'H',
|
2381 |
+
'\u2C67': 'H',
|
2382 |
+
'\u2C75': 'H',
|
2383 |
+
'\uA78D': 'H',
|
2384 |
+
'\u24BE': 'I',
|
2385 |
+
'\uFF29': 'I',
|
2386 |
+
'\u00CC': 'I',
|
2387 |
+
'\u00CD': 'I',
|
2388 |
+
'\u00CE': 'I',
|
2389 |
+
'\u0128': 'I',
|
2390 |
+
'\u012A': 'I',
|
2391 |
+
'\u012C': 'I',
|
2392 |
+
'\u0130': 'I',
|
2393 |
+
'\u00CF': 'I',
|
2394 |
+
'\u1E2E': 'I',
|
2395 |
+
'\u1EC8': 'I',
|
2396 |
+
'\u01CF': 'I',
|
2397 |
+
'\u0208': 'I',
|
2398 |
+
'\u020A': 'I',
|
2399 |
+
'\u1ECA': 'I',
|
2400 |
+
'\u012E': 'I',
|
2401 |
+
'\u1E2C': 'I',
|
2402 |
+
'\u0197': 'I',
|
2403 |
+
'\u24BF': 'J',
|
2404 |
+
'\uFF2A': 'J',
|
2405 |
+
'\u0134': 'J',
|
2406 |
+
'\u0248': 'J',
|
2407 |
+
'\u24C0': 'K',
|
2408 |
+
'\uFF2B': 'K',
|
2409 |
+
'\u1E30': 'K',
|
2410 |
+
'\u01E8': 'K',
|
2411 |
+
'\u1E32': 'K',
|
2412 |
+
'\u0136': 'K',
|
2413 |
+
'\u1E34': 'K',
|
2414 |
+
'\u0198': 'K',
|
2415 |
+
'\u2C69': 'K',
|
2416 |
+
'\uA740': 'K',
|
2417 |
+
'\uA742': 'K',
|
2418 |
+
'\uA744': 'K',
|
2419 |
+
'\uA7A2': 'K',
|
2420 |
+
'\u24C1': 'L',
|
2421 |
+
'\uFF2C': 'L',
|
2422 |
+
'\u013F': 'L',
|
2423 |
+
'\u0139': 'L',
|
2424 |
+
'\u013D': 'L',
|
2425 |
+
'\u1E36': 'L',
|
2426 |
+
'\u1E38': 'L',
|
2427 |
+
'\u013B': 'L',
|
2428 |
+
'\u1E3C': 'L',
|
2429 |
+
'\u1E3A': 'L',
|
2430 |
+
'\u0141': 'L',
|
2431 |
+
'\u023D': 'L',
|
2432 |
+
'\u2C62': 'L',
|
2433 |
+
'\u2C60': 'L',
|
2434 |
+
'\uA748': 'L',
|
2435 |
+
'\uA746': 'L',
|
2436 |
+
'\uA780': 'L',
|
2437 |
+
'\u01C7': 'LJ',
|
2438 |
+
'\u01C8': 'Lj',
|
2439 |
+
'\u24C2': 'M',
|
2440 |
+
'\uFF2D': 'M',
|
2441 |
+
'\u1E3E': 'M',
|
2442 |
+
'\u1E40': 'M',
|
2443 |
+
'\u1E42': 'M',
|
2444 |
+
'\u2C6E': 'M',
|
2445 |
+
'\u019C': 'M',
|
2446 |
+
'\u24C3': 'N',
|
2447 |
+
'\uFF2E': 'N',
|
2448 |
+
'\u01F8': 'N',
|
2449 |
+
'\u0143': 'N',
|
2450 |
+
'\u00D1': 'N',
|
2451 |
+
'\u1E44': 'N',
|
2452 |
+
'\u0147': 'N',
|
2453 |
+
'\u1E46': 'N',
|
2454 |
+
'\u0145': 'N',
|
2455 |
+
'\u1E4A': 'N',
|
2456 |
+
'\u1E48': 'N',
|
2457 |
+
'\u0220': 'N',
|
2458 |
+
'\u019D': 'N',
|
2459 |
+
'\uA790': 'N',
|
2460 |
+
'\uA7A4': 'N',
|
2461 |
+
'\u01CA': 'NJ',
|
2462 |
+
'\u01CB': 'Nj',
|
2463 |
+
'\u24C4': 'O',
|
2464 |
+
'\uFF2F': 'O',
|
2465 |
+
'\u00D2': 'O',
|
2466 |
+
'\u00D3': 'O',
|
2467 |
+
'\u00D4': 'O',
|
2468 |
+
'\u1ED2': 'O',
|
2469 |
+
'\u1ED0': 'O',
|
2470 |
+
'\u1ED6': 'O',
|
2471 |
+
'\u1ED4': 'O',
|
2472 |
+
'\u00D5': 'O',
|
2473 |
+
'\u1E4C': 'O',
|
2474 |
+
'\u022C': 'O',
|
2475 |
+
'\u1E4E': 'O',
|
2476 |
+
'\u014C': 'O',
|
2477 |
+
'\u1E50': 'O',
|
2478 |
+
'\u1E52': 'O',
|
2479 |
+
'\u014E': 'O',
|
2480 |
+
'\u022E': 'O',
|
2481 |
+
'\u0230': 'O',
|
2482 |
+
'\u00D6': 'O',
|
2483 |
+
'\u022A': 'O',
|
2484 |
+
'\u1ECE': 'O',
|
2485 |
+
'\u0150': 'O',
|
2486 |
+
'\u01D1': 'O',
|
2487 |
+
'\u020C': 'O',
|
2488 |
+
'\u020E': 'O',
|
2489 |
+
'\u01A0': 'O',
|
2490 |
+
'\u1EDC': 'O',
|
2491 |
+
'\u1EDA': 'O',
|
2492 |
+
'\u1EE0': 'O',
|
2493 |
+
'\u1EDE': 'O',
|
2494 |
+
'\u1EE2': 'O',
|
2495 |
+
'\u1ECC': 'O',
|
2496 |
+
'\u1ED8': 'O',
|
2497 |
+
'\u01EA': 'O',
|
2498 |
+
'\u01EC': 'O',
|
2499 |
+
'\u00D8': 'O',
|
2500 |
+
'\u01FE': 'O',
|
2501 |
+
'\u0186': 'O',
|
2502 |
+
'\u019F': 'O',
|
2503 |
+
'\uA74A': 'O',
|
2504 |
+
'\uA74C': 'O',
|
2505 |
+
'\u01A2': 'OI',
|
2506 |
+
'\uA74E': 'OO',
|
2507 |
+
'\u0222': 'OU',
|
2508 |
+
'\u24C5': 'P',
|
2509 |
+
'\uFF30': 'P',
|
2510 |
+
'\u1E54': 'P',
|
2511 |
+
'\u1E56': 'P',
|
2512 |
+
'\u01A4': 'P',
|
2513 |
+
'\u2C63': 'P',
|
2514 |
+
'\uA750': 'P',
|
2515 |
+
'\uA752': 'P',
|
2516 |
+
'\uA754': 'P',
|
2517 |
+
'\u24C6': 'Q',
|
2518 |
+
'\uFF31': 'Q',
|
2519 |
+
'\uA756': 'Q',
|
2520 |
+
'\uA758': 'Q',
|
2521 |
+
'\u024A': 'Q',
|
2522 |
+
'\u24C7': 'R',
|
2523 |
+
'\uFF32': 'R',
|
2524 |
+
'\u0154': 'R',
|
2525 |
+
'\u1E58': 'R',
|
2526 |
+
'\u0158': 'R',
|
2527 |
+
'\u0210': 'R',
|
2528 |
+
'\u0212': 'R',
|
2529 |
+
'\u1E5A': 'R',
|
2530 |
+
'\u1E5C': 'R',
|
2531 |
+
'\u0156': 'R',
|
2532 |
+
'\u1E5E': 'R',
|
2533 |
+
'\u024C': 'R',
|
2534 |
+
'\u2C64': 'R',
|
2535 |
+
'\uA75A': 'R',
|
2536 |
+
'\uA7A6': 'R',
|
2537 |
+
'\uA782': 'R',
|
2538 |
+
'\u24C8': 'S',
|
2539 |
+
'\uFF33': 'S',
|
2540 |
+
'\u1E9E': 'S',
|
2541 |
+
'\u015A': 'S',
|
2542 |
+
'\u1E64': 'S',
|
2543 |
+
'\u015C': 'S',
|
2544 |
+
'\u1E60': 'S',
|
2545 |
+
'\u0160': 'S',
|
2546 |
+
'\u1E66': 'S',
|
2547 |
+
'\u1E62': 'S',
|
2548 |
+
'\u1E68': 'S',
|
2549 |
+
'\u0218': 'S',
|
2550 |
+
'\u015E': 'S',
|
2551 |
+
'\u2C7E': 'S',
|
2552 |
+
'\uA7A8': 'S',
|
2553 |
+
'\uA784': 'S',
|
2554 |
+
'\u24C9': 'T',
|
2555 |
+
'\uFF34': 'T',
|
2556 |
+
'\u1E6A': 'T',
|
2557 |
+
'\u0164': 'T',
|
2558 |
+
'\u1E6C': 'T',
|
2559 |
+
'\u021A': 'T',
|
2560 |
+
'\u0162': 'T',
|
2561 |
+
'\u1E70': 'T',
|
2562 |
+
'\u1E6E': 'T',
|
2563 |
+
'\u0166': 'T',
|
2564 |
+
'\u01AC': 'T',
|
2565 |
+
'\u01AE': 'T',
|
2566 |
+
'\u023E': 'T',
|
2567 |
+
'\uA786': 'T',
|
2568 |
+
'\uA728': 'TZ',
|
2569 |
+
'\u24CA': 'U',
|
2570 |
+
'\uFF35': 'U',
|
2571 |
+
'\u00D9': 'U',
|
2572 |
+
'\u00DA': 'U',
|
2573 |
+
'\u00DB': 'U',
|
2574 |
+
'\u0168': 'U',
|
2575 |
+
'\u1E78': 'U',
|
2576 |
+
'\u016A': 'U',
|
2577 |
+
'\u1E7A': 'U',
|
2578 |
+
'\u016C': 'U',
|
2579 |
+
'\u00DC': 'U',
|
2580 |
+
'\u01DB': 'U',
|
2581 |
+
'\u01D7': 'U',
|
2582 |
+
'\u01D5': 'U',
|
2583 |
+
'\u01D9': 'U',
|
2584 |
+
'\u1EE6': 'U',
|
2585 |
+
'\u016E': 'U',
|
2586 |
+
'\u0170': 'U',
|
2587 |
+
'\u01D3': 'U',
|
2588 |
+
'\u0214': 'U',
|
2589 |
+
'\u0216': 'U',
|
2590 |
+
'\u01AF': 'U',
|
2591 |
+
'\u1EEA': 'U',
|
2592 |
+
'\u1EE8': 'U',
|
2593 |
+
'\u1EEE': 'U',
|
2594 |
+
'\u1EEC': 'U',
|
2595 |
+
'\u1EF0': 'U',
|
2596 |
+
'\u1EE4': 'U',
|
2597 |
+
'\u1E72': 'U',
|
2598 |
+
'\u0172': 'U',
|
2599 |
+
'\u1E76': 'U',
|
2600 |
+
'\u1E74': 'U',
|
2601 |
+
'\u0244': 'U',
|
2602 |
+
'\u24CB': 'V',
|
2603 |
+
'\uFF36': 'V',
|
2604 |
+
'\u1E7C': 'V',
|
2605 |
+
'\u1E7E': 'V',
|
2606 |
+
'\u01B2': 'V',
|
2607 |
+
'\uA75E': 'V',
|
2608 |
+
'\u0245': 'V',
|
2609 |
+
'\uA760': 'VY',
|
2610 |
+
'\u24CC': 'W',
|
2611 |
+
'\uFF37': 'W',
|
2612 |
+
'\u1E80': 'W',
|
2613 |
+
'\u1E82': 'W',
|
2614 |
+
'\u0174': 'W',
|
2615 |
+
'\u1E86': 'W',
|
2616 |
+
'\u1E84': 'W',
|
2617 |
+
'\u1E88': 'W',
|
2618 |
+
'\u2C72': 'W',
|
2619 |
+
'\u24CD': 'X',
|
2620 |
+
'\uFF38': 'X',
|
2621 |
+
'\u1E8A': 'X',
|
2622 |
+
'\u1E8C': 'X',
|
2623 |
+
'\u24CE': 'Y',
|
2624 |
+
'\uFF39': 'Y',
|
2625 |
+
'\u1EF2': 'Y',
|
2626 |
+
'\u00DD': 'Y',
|
2627 |
+
'\u0176': 'Y',
|
2628 |
+
'\u1EF8': 'Y',
|
2629 |
+
'\u0232': 'Y',
|
2630 |
+
'\u1E8E': 'Y',
|
2631 |
+
'\u0178': 'Y',
|
2632 |
+
'\u1EF6': 'Y',
|
2633 |
+
'\u1EF4': 'Y',
|
2634 |
+
'\u01B3': 'Y',
|
2635 |
+
'\u024E': 'Y',
|
2636 |
+
'\u1EFE': 'Y',
|
2637 |
+
'\u24CF': 'Z',
|
2638 |
+
'\uFF3A': 'Z',
|
2639 |
+
'\u0179': 'Z',
|
2640 |
+
'\u1E90': 'Z',
|
2641 |
+
'\u017B': 'Z',
|
2642 |
+
'\u017D': 'Z',
|
2643 |
+
'\u1E92': 'Z',
|
2644 |
+
'\u1E94': 'Z',
|
2645 |
+
'\u01B5': 'Z',
|
2646 |
+
'\u0224': 'Z',
|
2647 |
+
'\u2C7F': 'Z',
|
2648 |
+
'\u2C6B': 'Z',
|
2649 |
+
'\uA762': 'Z',
|
2650 |
+
'\u24D0': 'a',
|
2651 |
+
'\uFF41': 'a',
|
2652 |
+
'\u1E9A': 'a',
|
2653 |
+
'\u00E0': 'a',
|
2654 |
+
'\u00E1': 'a',
|
2655 |
+
'\u00E2': 'a',
|
2656 |
+
'\u1EA7': 'a',
|
2657 |
+
'\u1EA5': 'a',
|
2658 |
+
'\u1EAB': 'a',
|
2659 |
+
'\u1EA9': 'a',
|
2660 |
+
'\u00E3': 'a',
|
2661 |
+
'\u0101': 'a',
|
2662 |
+
'\u0103': 'a',
|
2663 |
+
'\u1EB1': 'a',
|
2664 |
+
'\u1EAF': 'a',
|
2665 |
+
'\u1EB5': 'a',
|
2666 |
+
'\u1EB3': 'a',
|
2667 |
+
'\u0227': 'a',
|
2668 |
+
'\u01E1': 'a',
|
2669 |
+
'\u00E4': 'a',
|
2670 |
+
'\u01DF': 'a',
|
2671 |
+
'\u1EA3': 'a',
|
2672 |
+
'\u00E5': 'a',
|
2673 |
+
'\u01FB': 'a',
|
2674 |
+
'\u01CE': 'a',
|
2675 |
+
'\u0201': 'a',
|
2676 |
+
'\u0203': 'a',
|
2677 |
+
'\u1EA1': 'a',
|
2678 |
+
'\u1EAD': 'a',
|
2679 |
+
'\u1EB7': 'a',
|
2680 |
+
'\u1E01': 'a',
|
2681 |
+
'\u0105': 'a',
|
2682 |
+
'\u2C65': 'a',
|
2683 |
+
'\u0250': 'a',
|
2684 |
+
'\uA733': 'aa',
|
2685 |
+
'\u00E6': 'ae',
|
2686 |
+
'\u01FD': 'ae',
|
2687 |
+
'\u01E3': 'ae',
|
2688 |
+
'\uA735': 'ao',
|
2689 |
+
'\uA737': 'au',
|
2690 |
+
'\uA739': 'av',
|
2691 |
+
'\uA73B': 'av',
|
2692 |
+
'\uA73D': 'ay',
|
2693 |
+
'\u24D1': 'b',
|
2694 |
+
'\uFF42': 'b',
|
2695 |
+
'\u1E03': 'b',
|
2696 |
+
'\u1E05': 'b',
|
2697 |
+
'\u1E07': 'b',
|
2698 |
+
'\u0180': 'b',
|
2699 |
+
'\u0183': 'b',
|
2700 |
+
'\u0253': 'b',
|
2701 |
+
'\u24D2': 'c',
|
2702 |
+
'\uFF43': 'c',
|
2703 |
+
'\u0107': 'c',
|
2704 |
+
'\u0109': 'c',
|
2705 |
+
'\u010B': 'c',
|
2706 |
+
'\u010D': 'c',
|
2707 |
+
'\u00E7': 'c',
|
2708 |
+
'\u1E09': 'c',
|
2709 |
+
'\u0188': 'c',
|
2710 |
+
'\u023C': 'c',
|
2711 |
+
'\uA73F': 'c',
|
2712 |
+
'\u2184': 'c',
|
2713 |
+
'\u24D3': 'd',
|
2714 |
+
'\uFF44': 'd',
|
2715 |
+
'\u1E0B': 'd',
|
2716 |
+
'\u010F': 'd',
|
2717 |
+
'\u1E0D': 'd',
|
2718 |
+
'\u1E11': 'd',
|
2719 |
+
'\u1E13': 'd',
|
2720 |
+
'\u1E0F': 'd',
|
2721 |
+
'\u0111': 'd',
|
2722 |
+
'\u018C': 'd',
|
2723 |
+
'\u0256': 'd',
|
2724 |
+
'\u0257': 'd',
|
2725 |
+
'\uA77A': 'd',
|
2726 |
+
'\u01F3': 'dz',
|
2727 |
+
'\u01C6': 'dz',
|
2728 |
+
'\u24D4': 'e',
|
2729 |
+
'\uFF45': 'e',
|
2730 |
+
'\u00E8': 'e',
|
2731 |
+
'\u00E9': 'e',
|
2732 |
+
'\u00EA': 'e',
|
2733 |
+
'\u1EC1': 'e',
|
2734 |
+
'\u1EBF': 'e',
|
2735 |
+
'\u1EC5': 'e',
|
2736 |
+
'\u1EC3': 'e',
|
2737 |
+
'\u1EBD': 'e',
|
2738 |
+
'\u0113': 'e',
|
2739 |
+
'\u1E15': 'e',
|
2740 |
+
'\u1E17': 'e',
|
2741 |
+
'\u0115': 'e',
|
2742 |
+
'\u0117': 'e',
|
2743 |
+
'\u00EB': 'e',
|
2744 |
+
'\u1EBB': 'e',
|
2745 |
+
'\u011B': 'e',
|
2746 |
+
'\u0205': 'e',
|
2747 |
+
'\u0207': 'e',
|
2748 |
+
'\u1EB9': 'e',
|
2749 |
+
'\u1EC7': 'e',
|
2750 |
+
'\u0229': 'e',
|
2751 |
+
'\u1E1D': 'e',
|
2752 |
+
'\u0119': 'e',
|
2753 |
+
'\u1E19': 'e',
|
2754 |
+
'\u1E1B': 'e',
|
2755 |
+
'\u0247': 'e',
|
2756 |
+
'\u025B': 'e',
|
2757 |
+
'\u01DD': 'e',
|
2758 |
+
'\u24D5': 'f',
|
2759 |
+
'\uFF46': 'f',
|
2760 |
+
'\u1E1F': 'f',
|
2761 |
+
'\u0192': 'f',
|
2762 |
+
'\uA77C': 'f',
|
2763 |
+
'\u24D6': 'g',
|
2764 |
+
'\uFF47': 'g',
|
2765 |
+
'\u01F5': 'g',
|
2766 |
+
'\u011D': 'g',
|
2767 |
+
'\u1E21': 'g',
|
2768 |
+
'\u011F': 'g',
|
2769 |
+
'\u0121': 'g',
|
2770 |
+
'\u01E7': 'g',
|
2771 |
+
'\u0123': 'g',
|
2772 |
+
'\u01E5': 'g',
|
2773 |
+
'\u0260': 'g',
|
2774 |
+
'\uA7A1': 'g',
|
2775 |
+
'\u1D79': 'g',
|
2776 |
+
'\uA77F': 'g',
|
2777 |
+
'\u24D7': 'h',
|
2778 |
+
'\uFF48': 'h',
|
2779 |
+
'\u0125': 'h',
|
2780 |
+
'\u1E23': 'h',
|
2781 |
+
'\u1E27': 'h',
|
2782 |
+
'\u021F': 'h',
|
2783 |
+
'\u1E25': 'h',
|
2784 |
+
'\u1E29': 'h',
|
2785 |
+
'\u1E2B': 'h',
|
2786 |
+
'\u1E96': 'h',
|
2787 |
+
'\u0127': 'h',
|
2788 |
+
'\u2C68': 'h',
|
2789 |
+
'\u2C76': 'h',
|
2790 |
+
'\u0265': 'h',
|
2791 |
+
'\u0195': 'hv',
|
2792 |
+
'\u24D8': 'i',
|
2793 |
+
'\uFF49': 'i',
|
2794 |
+
'\u00EC': 'i',
|
2795 |
+
'\u00ED': 'i',
|
2796 |
+
'\u00EE': 'i',
|
2797 |
+
'\u0129': 'i',
|
2798 |
+
'\u012B': 'i',
|
2799 |
+
'\u012D': 'i',
|
2800 |
+
'\u00EF': 'i',
|
2801 |
+
'\u1E2F': 'i',
|
2802 |
+
'\u1EC9': 'i',
|
2803 |
+
'\u01D0': 'i',
|
2804 |
+
'\u0209': 'i',
|
2805 |
+
'\u020B': 'i',
|
2806 |
+
'\u1ECB': 'i',
|
2807 |
+
'\u012F': 'i',
|
2808 |
+
'\u1E2D': 'i',
|
2809 |
+
'\u0268': 'i',
|
2810 |
+
'\u0131': 'i',
|
2811 |
+
'\u24D9': 'j',
|
2812 |
+
'\uFF4A': 'j',
|
2813 |
+
'\u0135': 'j',
|
2814 |
+
'\u01F0': 'j',
|
2815 |
+
'\u0249': 'j',
|
2816 |
+
'\u24DA': 'k',
|
2817 |
+
'\uFF4B': 'k',
|
2818 |
+
'\u1E31': 'k',
|
2819 |
+
'\u01E9': 'k',
|
2820 |
+
'\u1E33': 'k',
|
2821 |
+
'\u0137': 'k',
|
2822 |
+
'\u1E35': 'k',
|
2823 |
+
'\u0199': 'k',
|
2824 |
+
'\u2C6A': 'k',
|
2825 |
+
'\uA741': 'k',
|
2826 |
+
'\uA743': 'k',
|
2827 |
+
'\uA745': 'k',
|
2828 |
+
'\uA7A3': 'k',
|
2829 |
+
'\u24DB': 'l',
|
2830 |
+
'\uFF4C': 'l',
|
2831 |
+
'\u0140': 'l',
|
2832 |
+
'\u013A': 'l',
|
2833 |
+
'\u013E': 'l',
|
2834 |
+
'\u1E37': 'l',
|
2835 |
+
'\u1E39': 'l',
|
2836 |
+
'\u013C': 'l',
|
2837 |
+
'\u1E3D': 'l',
|
2838 |
+
'\u1E3B': 'l',
|
2839 |
+
'\u017F': 'l',
|
2840 |
+
'\u0142': 'l',
|
2841 |
+
'\u019A': 'l',
|
2842 |
+
'\u026B': 'l',
|
2843 |
+
'\u2C61': 'l',
|
2844 |
+
'\uA749': 'l',
|
2845 |
+
'\uA781': 'l',
|
2846 |
+
'\uA747': 'l',
|
2847 |
+
'\u01C9': 'lj',
|
2848 |
+
'\u24DC': 'm',
|
2849 |
+
'\uFF4D': 'm',
|
2850 |
+
'\u1E3F': 'm',
|
2851 |
+
'\u1E41': 'm',
|
2852 |
+
'\u1E43': 'm',
|
2853 |
+
'\u0271': 'm',
|
2854 |
+
'\u026F': 'm',
|
2855 |
+
'\u24DD': 'n',
|
2856 |
+
'\uFF4E': 'n',
|
2857 |
+
'\u01F9': 'n',
|
2858 |
+
'\u0144': 'n',
|
2859 |
+
'\u00F1': 'n',
|
2860 |
+
'\u1E45': 'n',
|
2861 |
+
'\u0148': 'n',
|
2862 |
+
'\u1E47': 'n',
|
2863 |
+
'\u0146': 'n',
|
2864 |
+
'\u1E4B': 'n',
|
2865 |
+
'\u1E49': 'n',
|
2866 |
+
'\u019E': 'n',
|
2867 |
+
'\u0272': 'n',
|
2868 |
+
'\u0149': 'n',
|
2869 |
+
'\uA791': 'n',
|
2870 |
+
'\uA7A5': 'n',
|
2871 |
+
'\u01CC': 'nj',
|
2872 |
+
'\u24DE': 'o',
|
2873 |
+
'\uFF4F': 'o',
|
2874 |
+
'\u00F2': 'o',
|
2875 |
+
'\u00F3': 'o',
|
2876 |
+
'\u00F4': 'o',
|
2877 |
+
'\u1ED3': 'o',
|
2878 |
+
'\u1ED1': 'o',
|
2879 |
+
'\u1ED7': 'o',
|
2880 |
+
'\u1ED5': 'o',
|
2881 |
+
'\u00F5': 'o',
|
2882 |
+
'\u1E4D': 'o',
|
2883 |
+
'\u022D': 'o',
|
2884 |
+
'\u1E4F': 'o',
|
2885 |
+
'\u014D': 'o',
|
2886 |
+
'\u1E51': 'o',
|
2887 |
+
'\u1E53': 'o',
|
2888 |
+
'\u014F': 'o',
|
2889 |
+
'\u022F': 'o',
|
2890 |
+
'\u0231': 'o',
|
2891 |
+
'\u00F6': 'o',
|
2892 |
+
'\u022B': 'o',
|
2893 |
+
'\u1ECF': 'o',
|
2894 |
+
'\u0151': 'o',
|
2895 |
+
'\u01D2': 'o',
|
2896 |
+
'\u020D': 'o',
|
2897 |
+
'\u020F': 'o',
|
2898 |
+
'\u01A1': 'o',
|
2899 |
+
'\u1EDD': 'o',
|
2900 |
+
'\u1EDB': 'o',
|
2901 |
+
'\u1EE1': 'o',
|
2902 |
+
'\u1EDF': 'o',
|
2903 |
+
'\u1EE3': 'o',
|
2904 |
+
'\u1ECD': 'o',
|
2905 |
+
'\u1ED9': 'o',
|
2906 |
+
'\u01EB': 'o',
|
2907 |
+
'\u01ED': 'o',
|
2908 |
+
'\u00F8': 'o',
|
2909 |
+
'\u01FF': 'o',
|
2910 |
+
'\u0254': 'o',
|
2911 |
+
'\uA74B': 'o',
|
2912 |
+
'\uA74D': 'o',
|
2913 |
+
'\u0275': 'o',
|
2914 |
+
'\u01A3': 'oi',
|
2915 |
+
'\u0223': 'ou',
|
2916 |
+
'\uA74F': 'oo',
|
2917 |
+
'\u24DF': 'p',
|
2918 |
+
'\uFF50': 'p',
|
2919 |
+
'\u1E55': 'p',
|
2920 |
+
'\u1E57': 'p',
|
2921 |
+
'\u01A5': 'p',
|
2922 |
+
'\u1D7D': 'p',
|
2923 |
+
'\uA751': 'p',
|
2924 |
+
'\uA753': 'p',
|
2925 |
+
'\uA755': 'p',
|
2926 |
+
'\u24E0': 'q',
|
2927 |
+
'\uFF51': 'q',
|
2928 |
+
'\u024B': 'q',
|
2929 |
+
'\uA757': 'q',
|
2930 |
+
'\uA759': 'q',
|
2931 |
+
'\u24E1': 'r',
|
2932 |
+
'\uFF52': 'r',
|
2933 |
+
'\u0155': 'r',
|
2934 |
+
'\u1E59': 'r',
|
2935 |
+
'\u0159': 'r',
|
2936 |
+
'\u0211': 'r',
|
2937 |
+
'\u0213': 'r',
|
2938 |
+
'\u1E5B': 'r',
|
2939 |
+
'\u1E5D': 'r',
|
2940 |
+
'\u0157': 'r',
|
2941 |
+
'\u1E5F': 'r',
|
2942 |
+
'\u024D': 'r',
|
2943 |
+
'\u027D': 'r',
|
2944 |
+
'\uA75B': 'r',
|
2945 |
+
'\uA7A7': 'r',
|
2946 |
+
'\uA783': 'r',
|
2947 |
+
'\u24E2': 's',
|
2948 |
+
'\uFF53': 's',
|
2949 |
+
'\u00DF': 's',
|
2950 |
+
'\u015B': 's',
|
2951 |
+
'\u1E65': 's',
|
2952 |
+
'\u015D': 's',
|
2953 |
+
'\u1E61': 's',
|
2954 |
+
'\u0161': 's',
|
2955 |
+
'\u1E67': 's',
|
2956 |
+
'\u1E63': 's',
|
2957 |
+
'\u1E69': 's',
|
2958 |
+
'\u0219': 's',
|
2959 |
+
'\u015F': 's',
|
2960 |
+
'\u023F': 's',
|
2961 |
+
'\uA7A9': 's',
|
2962 |
+
'\uA785': 's',
|
2963 |
+
'\u1E9B': 's',
|
2964 |
+
'\u24E3': 't',
|
2965 |
+
'\uFF54': 't',
|
2966 |
+
'\u1E6B': 't',
|
2967 |
+
'\u1E97': 't',
|
2968 |
+
'\u0165': 't',
|
2969 |
+
'\u1E6D': 't',
|
2970 |
+
'\u021B': 't',
|
2971 |
+
'\u0163': 't',
|
2972 |
+
'\u1E71': 't',
|
2973 |
+
'\u1E6F': 't',
|
2974 |
+
'\u0167': 't',
|
2975 |
+
'\u01AD': 't',
|
2976 |
+
'\u0288': 't',
|
2977 |
+
'\u2C66': 't',
|
2978 |
+
'\uA787': 't',
|
2979 |
+
'\uA729': 'tz',
|
2980 |
+
'\u24E4': 'u',
|
2981 |
+
'\uFF55': 'u',
|
2982 |
+
'\u00F9': 'u',
|
2983 |
+
'\u00FA': 'u',
|
2984 |
+
'\u00FB': 'u',
|
2985 |
+
'\u0169': 'u',
|
2986 |
+
'\u1E79': 'u',
|
2987 |
+
'\u016B': 'u',
|
2988 |
+
'\u1E7B': 'u',
|
2989 |
+
'\u016D': 'u',
|
2990 |
+
'\u00FC': 'u',
|
2991 |
+
'\u01DC': 'u',
|
2992 |
+
'\u01D8': 'u',
|
2993 |
+
'\u01D6': 'u',
|
2994 |
+
'\u01DA': 'u',
|
2995 |
+
'\u1EE7': 'u',
|
2996 |
+
'\u016F': 'u',
|
2997 |
+
'\u0171': 'u',
|
2998 |
+
'\u01D4': 'u',
|
2999 |
+
'\u0215': 'u',
|
3000 |
+
'\u0217': 'u',
|
3001 |
+
'\u01B0': 'u',
|
3002 |
+
'\u1EEB': 'u',
|
3003 |
+
'\u1EE9': 'u',
|
3004 |
+
'\u1EEF': 'u',
|
3005 |
+
'\u1EED': 'u',
|
3006 |
+
'\u1EF1': 'u',
|
3007 |
+
'\u1EE5': 'u',
|
3008 |
+
'\u1E73': 'u',
|
3009 |
+
'\u0173': 'u',
|
3010 |
+
'\u1E77': 'u',
|
3011 |
+
'\u1E75': 'u',
|
3012 |
+
'\u0289': 'u',
|
3013 |
+
'\u24E5': 'v',
|
3014 |
+
'\uFF56': 'v',
|
3015 |
+
'\u1E7D': 'v',
|
3016 |
+
'\u1E7F': 'v',
|
3017 |
+
'\u028B': 'v',
|
3018 |
+
'\uA75F': 'v',
|
3019 |
+
'\u028C': 'v',
|
3020 |
+
'\uA761': 'vy',
|
3021 |
+
'\u24E6': 'w',
|
3022 |
+
'\uFF57': 'w',
|
3023 |
+
'\u1E81': 'w',
|
3024 |
+
'\u1E83': 'w',
|
3025 |
+
'\u0175': 'w',
|
3026 |
+
'\u1E87': 'w',
|
3027 |
+
'\u1E85': 'w',
|
3028 |
+
'\u1E98': 'w',
|
3029 |
+
'\u1E89': 'w',
|
3030 |
+
'\u2C73': 'w',
|
3031 |
+
'\u24E7': 'x',
|
3032 |
+
'\uFF58': 'x',
|
3033 |
+
'\u1E8B': 'x',
|
3034 |
+
'\u1E8D': 'x',
|
3035 |
+
'\u24E8': 'y',
|
3036 |
+
'\uFF59': 'y',
|
3037 |
+
'\u1EF3': 'y',
|
3038 |
+
'\u00FD': 'y',
|
3039 |
+
'\u0177': 'y',
|
3040 |
+
'\u1EF9': 'y',
|
3041 |
+
'\u0233': 'y',
|
3042 |
+
'\u1E8F': 'y',
|
3043 |
+
'\u00FF': 'y',
|
3044 |
+
'\u1EF7': 'y',
|
3045 |
+
'\u1E99': 'y',
|
3046 |
+
'\u1EF5': 'y',
|
3047 |
+
'\u01B4': 'y',
|
3048 |
+
'\u024F': 'y',
|
3049 |
+
'\u1EFF': 'y',
|
3050 |
+
'\u24E9': 'z',
|
3051 |
+
'\uFF5A': 'z',
|
3052 |
+
'\u017A': 'z',
|
3053 |
+
'\u1E91': 'z',
|
3054 |
+
'\u017C': 'z',
|
3055 |
+
'\u017E': 'z',
|
3056 |
+
'\u1E93': 'z',
|
3057 |
+
'\u1E95': 'z',
|
3058 |
+
'\u01B6': 'z',
|
3059 |
+
'\u0225': 'z',
|
3060 |
+
'\u0240': 'z',
|
3061 |
+
'\u2C6C': 'z',
|
3062 |
+
'\uA763': 'z',
|
3063 |
+
'\u0386': '\u0391',
|
3064 |
+
'\u0388': '\u0395',
|
3065 |
+
'\u0389': '\u0397',
|
3066 |
+
'\u038A': '\u0399',
|
3067 |
+
'\u03AA': '\u0399',
|
3068 |
+
'\u038C': '\u039F',
|
3069 |
+
'\u038E': '\u03A5',
|
3070 |
+
'\u03AB': '\u03A5',
|
3071 |
+
'\u038F': '\u03A9',
|
3072 |
+
'\u03AC': '\u03B1',
|
3073 |
+
'\u03AD': '\u03B5',
|
3074 |
+
'\u03AE': '\u03B7',
|
3075 |
+
'\u03AF': '\u03B9',
|
3076 |
+
'\u03CA': '\u03B9',
|
3077 |
+
'\u0390': '\u03B9',
|
3078 |
+
'\u03CC': '\u03BF',
|
3079 |
+
'\u03CD': '\u03C5',
|
3080 |
+
'\u03CB': '\u03C5',
|
3081 |
+
'\u03B0': '\u03C5',
|
3082 |
+
'\u03C9': '\u03C9',
|
3083 |
+
'\u03C2': '\u03C3'
|
3084 |
+
};
|
3085 |
+
|
3086 |
+
return diacritics;
|
3087 |
+
});
|
3088 |
+
|
3089 |
+
S2.define('select2/data/base',[
|
3090 |
+
'../utils'
|
3091 |
+
], function (Utils) {
|
3092 |
+
function BaseAdapter ($element, options) {
|
3093 |
+
BaseAdapter.__super__.constructor.call(this);
|
3094 |
+
}
|
3095 |
+
|
3096 |
+
Utils.Extend(BaseAdapter, Utils.Observable);
|
3097 |
+
|
3098 |
+
BaseAdapter.prototype.current = function (callback) {
|
3099 |
+
throw new Error('The `current` method must be defined in child classes.');
|
3100 |
+
};
|
3101 |
+
|
3102 |
+
BaseAdapter.prototype.query = function (params, callback) {
|
3103 |
+
throw new Error('The `query` method must be defined in child classes.');
|
3104 |
+
};
|
3105 |
+
|
3106 |
+
BaseAdapter.prototype.bind = function (container, $container) {
|
3107 |
+
// Can be implemented in subclasses
|
3108 |
+
};
|
3109 |
+
|
3110 |
+
BaseAdapter.prototype.destroy = function () {
|
3111 |
+
// Can be implemented in subclasses
|
3112 |
+
};
|
3113 |
+
|
3114 |
+
BaseAdapter.prototype.generateResultId = function (container, data) {
|
3115 |
+
var id = '';
|
3116 |
+
|
3117 |
+
if (container != null) {
|
3118 |
+
id += container.id
|
3119 |
+
} else {
|
3120 |
+
id += Utils.generateChars(4);
|
3121 |
+
}
|
3122 |
+
|
3123 |
+
id += '-result-';
|
3124 |
+
id += Utils.generateChars(4);
|
3125 |
+
|
3126 |
+
if (data.id != null) {
|
3127 |
+
id += '-' + data.id.toString();
|
3128 |
+
} else {
|
3129 |
+
id += '-' + Utils.generateChars(4);
|
3130 |
+
}
|
3131 |
+
return id;
|
3132 |
+
};
|
3133 |
+
|
3134 |
+
return BaseAdapter;
|
3135 |
+
});
|
3136 |
+
|
3137 |
+
S2.define('select2/data/select',[
|
3138 |
+
'./base',
|
3139 |
+
'../utils',
|
3140 |
+
'jquery'
|
3141 |
+
], function (BaseAdapter, Utils, $) {
|
3142 |
+
function SelectAdapter ($element, options) {
|
3143 |
+
this.$element = $element;
|
3144 |
+
this.options = options;
|
3145 |
+
|
3146 |
+
SelectAdapter.__super__.constructor.call(this);
|
3147 |
+
}
|
3148 |
+
|
3149 |
+
Utils.Extend(SelectAdapter, BaseAdapter);
|
3150 |
+
|
3151 |
+
SelectAdapter.prototype.current = function (callback) {
|
3152 |
+
var data = [];
|
3153 |
+
var self = this;
|
3154 |
+
|
3155 |
+
this.$element.find(':selected').each(function () {
|
3156 |
+
var $option = $(this);
|
3157 |
+
|
3158 |
+
var option = self.item($option);
|
3159 |
+
|
3160 |
+
data.push(option);
|
3161 |
+
});
|
3162 |
+
|
3163 |
+
callback(data);
|
3164 |
+
};
|
3165 |
+
|
3166 |
+
SelectAdapter.prototype.select = function (data) {
|
3167 |
+
var self = this;
|
3168 |
+
|
3169 |
+
data.selected = true;
|
3170 |
+
|
3171 |
+
// If data.element is a DOM node, use it instead
|
3172 |
+
if ($(data.element).is('option')) {
|
3173 |
+
data.element.selected = true;
|
3174 |
+
|
3175 |
+
this.$element.trigger('change');
|
3176 |
+
|
3177 |
+
return;
|
3178 |
+
}
|
3179 |
+
|
3180 |
+
if (this.$element.prop('multiple')) {
|
3181 |
+
this.current(function (currentData) {
|
3182 |
+
var val = [];
|
3183 |
+
|
3184 |
+
data = [data];
|
3185 |
+
data.push.apply(data, currentData);
|
3186 |
+
|
3187 |
+
for (var d = 0; d < data.length; d++) {
|
3188 |
+
var id = data[d].id;
|
3189 |
+
|
3190 |
+
if ($.inArray(id, val) === -1) {
|
3191 |
+
val.push(id);
|
3192 |
+
}
|
3193 |
+
}
|
3194 |
+
|
3195 |
+
self.$element.val(val);
|
3196 |
+
self.$element.trigger('change');
|
3197 |
+
});
|
3198 |
+
} else {
|
3199 |
+
var val = data.id;
|
3200 |
+
|
3201 |
+
this.$element.val(val);
|
3202 |
+
this.$element.trigger('change');
|
3203 |
+
}
|
3204 |
+
};
|
3205 |
+
|
3206 |
+
SelectAdapter.prototype.unselect = function (data) {
|
3207 |
+
var self = this;
|
3208 |
+
|
3209 |
+
if (!this.$element.prop('multiple')) {
|
3210 |
+
return;
|
3211 |
+
}
|
3212 |
+
|
3213 |
+
data.selected = false;
|
3214 |
+
|
3215 |
+
if ($(data.element).is('option')) {
|
3216 |
+
data.element.selected = false;
|
3217 |
+
|
3218 |
+
this.$element.trigger('change');
|
3219 |
+
|
3220 |
+
return;
|
3221 |
+
}
|
3222 |
+
|
3223 |
+
this.current(function (currentData) {
|
3224 |
+
var val = [];
|
3225 |
+
|
3226 |
+
for (var d = 0; d < currentData.length; d++) {
|
3227 |
+
var id = currentData[d].id;
|
3228 |
+
|
3229 |
+
if (id !== data.id && $.inArray(id, val) === -1) {
|
3230 |
+
val.push(id);
|
3231 |
+
}
|
3232 |
+
}
|
3233 |
+
|
3234 |
+
self.$element.val(val);
|
3235 |
+
|
3236 |
+
self.$element.trigger('change');
|
3237 |
+
});
|
3238 |
+
};
|
3239 |
+
|
3240 |
+
SelectAdapter.prototype.bind = function (container, $container) {
|
3241 |
+
var self = this;
|
3242 |
+
|
3243 |
+
this.container = container;
|
3244 |
+
|
3245 |
+
container.on('select', function (params) {
|
3246 |
+
self.select(params.data);
|
3247 |
+
});
|
3248 |
+
|
3249 |
+
container.on('unselect', function (params) {
|
3250 |
+
self.unselect(params.data);
|
3251 |
+
});
|
3252 |
+
};
|
3253 |
+
|
3254 |
+
SelectAdapter.prototype.destroy = function () {
|
3255 |
+
// Remove anything added to child elements
|
3256 |
+
this.$element.find('*').each(function () {
|
3257 |
+
// Remove any custom data set by Select2
|
3258 |
+
$.removeData(this, 'data');
|
3259 |
+
});
|
3260 |
+
};
|
3261 |
+
|
3262 |
+
SelectAdapter.prototype.query = function (params, callback) {
|
3263 |
+
var data = [];
|
3264 |
+
var self = this;
|
3265 |
+
|
3266 |
+
var $options = this.$element.children();
|
3267 |
+
|
3268 |
+
$options.each(function () {
|
3269 |
+
var $option = $(this);
|
3270 |
+
|
3271 |
+
if (!$option.is('option') && !$option.is('optgroup')) {
|
3272 |
+
return;
|
3273 |
+
}
|
3274 |
+
|
3275 |
+
var option = self.item($option);
|
3276 |
+
|
3277 |
+
var matches = self.matches(params, option);
|
3278 |
+
|
3279 |
+
if (matches !== null) {
|
3280 |
+
data.push(matches);
|
3281 |
+
}
|
3282 |
+
});
|
3283 |
+
|
3284 |
+
callback({
|
3285 |
+
results: data
|
3286 |
+
});
|
3287 |
+
};
|
3288 |
+
|
3289 |
+
SelectAdapter.prototype.addOptions = function ($options) {
|
3290 |
+
Utils.appendMany(this.$element, $options);
|
3291 |
+
};
|
3292 |
+
|
3293 |
+
SelectAdapter.prototype.option = function (data) {
|
3294 |
+
var option;
|
3295 |
+
|
3296 |
+
if (data.children) {
|
3297 |
+
option = document.createElement('optgroup');
|
3298 |
+
option.label = data.text;
|
3299 |
+
} else {
|
3300 |
+
option = document.createElement('option');
|
3301 |
+
|
3302 |
+
if (option.textContent !== undefined) {
|
3303 |
+
option.textContent = data.text;
|
3304 |
+
} else {
|
3305 |
+
option.innerText = data.text;
|
3306 |
+
}
|
3307 |
+
}
|
3308 |
+
|
3309 |
+
if (data.id !== undefined) {
|
3310 |
+
option.value = data.id;
|
3311 |
+
}
|
3312 |
+
|
3313 |
+
if (data.disabled) {
|
3314 |
+
option.disabled = true;
|
3315 |
+
}
|
3316 |
+
|
3317 |
+
if (data.selected) {
|
3318 |
+
option.selected = true;
|
3319 |
+
}
|
3320 |
+
|
3321 |
+
if (data.title) {
|
3322 |
+
option.title = data.title;
|
3323 |
+
}
|
3324 |
+
|
3325 |
+
var $option = $(option);
|
3326 |
+
|
3327 |
+
var normalizedData = this._normalizeItem(data);
|
3328 |
+
normalizedData.element = option;
|
3329 |
+
|
3330 |
+
// Override the option's data with the combined data
|
3331 |
+
$.data(option, 'data', normalizedData);
|
3332 |
+
|
3333 |
+
return $option;
|
3334 |
+
};
|
3335 |
+
|
3336 |
+
SelectAdapter.prototype.item = function ($option) {
|
3337 |
+
var data = {};
|
3338 |
+
|
3339 |
+
data = $.data($option[0], 'data');
|
3340 |
+
|
3341 |
+
if (data != null) {
|
3342 |
+
return data;
|
3343 |
+
}
|
3344 |
+
|
3345 |
+
if ($option.is('option')) {
|
3346 |
+
data = {
|
3347 |
+
id: $option.val(),
|
3348 |
+
text: $option.text(),
|
3349 |
+
disabled: $option.prop('disabled'),
|
3350 |
+
selected: $option.prop('selected'),
|
3351 |
+
title: $option.prop('title')
|
3352 |
+
};
|
3353 |
+
} else if ($option.is('optgroup')) {
|
3354 |
+
data = {
|
3355 |
+
text: $option.prop('label'),
|
3356 |
+
children: [],
|
3357 |
+
title: $option.prop('title')
|
3358 |
+
};
|
3359 |
+
|
3360 |
+
var $children = $option.children('option');
|
3361 |
+
var children = [];
|
3362 |
+
|
3363 |
+
for (var c = 0; c < $children.length; c++) {
|
3364 |
+
var $child = $($children[c]);
|
3365 |
+
|
3366 |
+
var child = this.item($child);
|
3367 |
+
|
3368 |
+
children.push(child);
|
3369 |
+
}
|
3370 |
+
|
3371 |
+
data.children = children;
|
3372 |
+
}
|
3373 |
+
|
3374 |
+
data = this._normalizeItem(data);
|
3375 |
+
data.element = $option[0];
|
3376 |
+
|
3377 |
+
$.data($option[0], 'data', data);
|
3378 |
+
|
3379 |
+
return data;
|
3380 |
+
};
|
3381 |
+
|
3382 |
+
SelectAdapter.prototype._normalizeItem = function (item) {
|
3383 |
+
if (!$.isPlainObject(item)) {
|
3384 |
+
item = {
|
3385 |
+
id: item,
|
3386 |
+
text: item
|
3387 |
+
};
|
3388 |
+
}
|
3389 |
+
|
3390 |
+
item = $.extend({}, {
|
3391 |
+
text: ''
|
3392 |
+
}, item);
|
3393 |
+
|
3394 |
+
var defaults = {
|
3395 |
+
selected: false,
|
3396 |
+
disabled: false
|
3397 |
+
};
|
3398 |
+
|
3399 |
+
if (item.id != null) {
|
3400 |
+
item.id = item.id.toString();
|
3401 |
+
}
|
3402 |
+
|
3403 |
+
if (item.text != null) {
|
3404 |
+
item.text = item.text.toString();
|
3405 |
+
}
|
3406 |
+
|
3407 |
+
if (item._resultId == null && item.id) {
|
3408 |
+
item._resultId = this.generateResultId(this.container, item);
|
3409 |
+
}
|
3410 |
+
|
3411 |
+
return $.extend({}, defaults, item);
|
3412 |
+
};
|
3413 |
+
|
3414 |
+
SelectAdapter.prototype.matches = function (params, data) {
|
3415 |
+
var matcher = this.options.get('matcher');
|
3416 |
+
|
3417 |
+
return matcher(params, data);
|
3418 |
+
};
|
3419 |
+
|
3420 |
+
return SelectAdapter;
|
3421 |
+
});
|
3422 |
+
|
3423 |
+
S2.define('select2/data/array',[
|
3424 |
+
'./select',
|
3425 |
+
'../utils',
|
3426 |
+
'jquery'
|
3427 |
+
], function (SelectAdapter, Utils, $) {
|
3428 |
+
function ArrayAdapter ($element, options) {
|
3429 |
+
var data = options.get('data') || [];
|
3430 |
+
|
3431 |
+
ArrayAdapter.__super__.constructor.call(this, $element, options);
|
3432 |
+
|
3433 |
+
this.addOptions(this.convertToOptions(data));
|
3434 |
+
}
|
3435 |
+
|
3436 |
+
Utils.Extend(ArrayAdapter, SelectAdapter);
|
3437 |
+
|
3438 |
+
ArrayAdapter.prototype.select = function (data) {
|
3439 |
+
var $option = this.$element.find('option').filter(function (i, elm) {
|
3440 |
+
return elm.value == data.id.toString();
|
3441 |
+
});
|
3442 |
+
|
3443 |
+
if ($option.length === 0) {
|
3444 |
+
$option = this.option(data);
|
3445 |
+
|
3446 |
+
this.addOptions($option);
|
3447 |
+
}
|
3448 |
+
|
3449 |
+
ArrayAdapter.__super__.select.call(this, data);
|
3450 |
+
};
|
3451 |
+
|
3452 |
+
ArrayAdapter.prototype.convertToOptions = function (data) {
|
3453 |
+
var self = this;
|
3454 |
+
|
3455 |
+
var $existing = this.$element.find('option');
|
3456 |
+
var existingIds = $existing.map(function () {
|
3457 |
+
return self.item($(this)).id;
|
3458 |
+
}).get();
|
3459 |
+
|
3460 |
+
var $options = [];
|
3461 |
+
|
3462 |
+
// Filter out all items except for the one passed in the argument
|
3463 |
+
function onlyItem (item) {
|
3464 |
+
return function () {
|
3465 |
+
return $(this).val() == item.id;
|
3466 |
+
};
|
3467 |
+
}
|
3468 |
+
|
3469 |
+
for (var d = 0; d < data.length; d++) {
|
3470 |
+
var item = this._normalizeItem(data[d]);
|
3471 |
+
|
3472 |
+
// Skip items which were pre-loaded, only merge the data
|
3473 |
+
if ($.inArray(item.id, existingIds) >= 0) {
|
3474 |
+
var $existingOption = $existing.filter(onlyItem(item));
|
3475 |
+
|
3476 |
+
var existingData = this.item($existingOption);
|
3477 |
+
var newData = $.extend(true, {}, item, existingData);
|
3478 |
+
|
3479 |
+
var $newOption = this.option(newData);
|
3480 |
+
|
3481 |
+
$existingOption.replaceWith($newOption);
|
3482 |
+
|
3483 |
+
continue;
|
3484 |
+
}
|
3485 |
+
|
3486 |
+
var $option = this.option(item);
|
3487 |
+
|
3488 |
+
if (item.children) {
|
3489 |
+
var $children = this.convertToOptions(item.children);
|
3490 |
+
|
3491 |
+
Utils.appendMany($option, $children);
|
3492 |
+
}
|
3493 |
+
|
3494 |
+
$options.push($option);
|
3495 |
+
}
|
3496 |
+
|
3497 |
+
return $options;
|
3498 |
+
};
|
3499 |
+
|
3500 |
+
return ArrayAdapter;
|
3501 |
+
});
|
3502 |
+
|
3503 |
+
S2.define('select2/data/ajax',[
|
3504 |
+
'./array',
|
3505 |
+
'../utils',
|
3506 |
+
'jquery'
|
3507 |
+
], function (ArrayAdapter, Utils, $) {
|
3508 |
+
function AjaxAdapter ($element, options) {
|
3509 |
+
this.ajaxOptions = this._applyDefaults(options.get('ajax'));
|
3510 |
+
|
3511 |
+
if (this.ajaxOptions.processResults != null) {
|
3512 |
+
this.processResults = this.ajaxOptions.processResults;
|
3513 |
+
}
|
3514 |
+
|
3515 |
+
AjaxAdapter.__super__.constructor.call(this, $element, options);
|
3516 |
+
}
|
3517 |
+
|
3518 |
+
Utils.Extend(AjaxAdapter, ArrayAdapter);
|
3519 |
+
|
3520 |
+
AjaxAdapter.prototype._applyDefaults = function (options) {
|
3521 |
+
var defaults = {
|
3522 |
+
data: function (params) {
|
3523 |
+
return $.extend({}, params, {
|
3524 |
+
q: params.term
|
3525 |
+
});
|
3526 |
+
},
|
3527 |
+
transport: function (params, success, failure) {
|
3528 |
+
var $request = $.ajax(params);
|
3529 |
+
|
3530 |
+
$request.then(success);
|
3531 |
+
$request.fail(failure);
|
3532 |
+
|
3533 |
+
return $request;
|
3534 |
+
}
|
3535 |
+
};
|
3536 |
+
|
3537 |
+
return $.extend({}, defaults, options, true);
|
3538 |
+
};
|
3539 |
+
|
3540 |
+
AjaxAdapter.prototype.processResults = function (results) {
|
3541 |
+
return results;
|
3542 |
+
};
|
3543 |
+
|
3544 |
+
AjaxAdapter.prototype.query = function (params, callback) {
|
3545 |
+
var matches = [];
|
3546 |
+
var self = this;
|
3547 |
+
|
3548 |
+
if (this._request != null) {
|
3549 |
+
// JSONP requests cannot always be aborted
|
3550 |
+
if ($.isFunction(this._request.abort)) {
|
3551 |
+
this._request.abort();
|
3552 |
+
}
|
3553 |
+
|
3554 |
+
this._request = null;
|
3555 |
+
}
|
3556 |
+
|
3557 |
+
var options = $.extend({
|
3558 |
+
type: 'GET'
|
3559 |
+
}, this.ajaxOptions);
|
3560 |
+
|
3561 |
+
if (typeof options.url === 'function') {
|
3562 |
+
options.url = options.url.call(this.$element, params);
|
3563 |
+
}
|
3564 |
+
|
3565 |
+
if (typeof options.data === 'function') {
|
3566 |
+
options.data = options.data.call(this.$element, params);
|
3567 |
+
}
|
3568 |
+
|
3569 |
+
function request () {
|
3570 |
+
var $request = options.transport(options, function (data) {
|
3571 |
+
var results = self.processResults(data, params);
|
3572 |
+
|
3573 |
+
if (self.options.get('debug') && window.console && console.error) {
|
3574 |
+
// Check to make sure that the response included a `results` key.
|
3575 |
+
if (!results || !results.results || !$.isArray(results.results)) {
|
3576 |
+
console.error(
|
3577 |
+
'Select2: The AJAX results did not return an array in the ' +
|
3578 |
+
'`results` key of the response.'
|
3579 |
+
);
|
3580 |
+
}
|
3581 |
+
}
|
3582 |
+
|
3583 |
+
callback(results);
|
3584 |
+
self.container.focusOnActiveElement();
|
3585 |
+
}, function () {
|
3586 |
+
// Attempt to detect if a request was aborted
|
3587 |
+
// Only works if the transport exposes a status property
|
3588 |
+
if ($request.status && $request.status === '0') {
|
3589 |
+
return;
|
3590 |
+
}
|
3591 |
+
|
3592 |
+
self.trigger('results:message', {
|
3593 |
+
message: 'errorLoading'
|
3594 |
+
});
|
3595 |
+
});
|
3596 |
+
|
3597 |
+
self._request = $request;
|
3598 |
+
}
|
3599 |
+
|
3600 |
+
if (this.ajaxOptions.delay && params.term != null) {
|
3601 |
+
if (this._queryTimeout) {
|
3602 |
+
window.clearTimeout(this._queryTimeout);
|
3603 |
+
}
|
3604 |
+
|
3605 |
+
this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay);
|
3606 |
+
} else {
|
3607 |
+
request();
|
3608 |
+
}
|
3609 |
+
};
|
3610 |
+
|
3611 |
+
return AjaxAdapter;
|
3612 |
+
});
|
3613 |
+
|
3614 |
+
S2.define('select2/data/tags',[
|
3615 |
+
'jquery'
|
3616 |
+
], function ($) {
|
3617 |
+
function Tags (decorated, $element, options) {
|
3618 |
+
var tags = options.get('tags');
|
3619 |
+
|
3620 |
+
var createTag = options.get('createTag');
|
3621 |
+
|
3622 |
+
if (createTag !== undefined) {
|
3623 |
+
this.createTag = createTag;
|
3624 |
+
}
|
3625 |
+
|
3626 |
+
var insertTag = options.get('insertTag');
|
3627 |
+
|
3628 |
+
if (insertTag !== undefined) {
|
3629 |
+
this.insertTag = insertTag;
|
3630 |
+
}
|
3631 |
+
|
3632 |
+
decorated.call(this, $element, options);
|
3633 |
+
|
3634 |
+
if ($.isArray(tags)) {
|
3635 |
+
for (var t = 0; t < tags.length; t++) {
|
3636 |
+
var tag = tags[t];
|
3637 |
+
var item = this._normalizeItem(tag);
|
3638 |
+
|
3639 |
+
var $option = this.option(item);
|
3640 |
+
|
3641 |
+
this.$element.append($option);
|
3642 |
+
}
|
3643 |
+
}
|
3644 |
+
}
|
3645 |
+
|
3646 |
+
Tags.prototype.query = function (decorated, params, callback) {
|
3647 |
+
var self = this;
|
3648 |
+
|
3649 |
+
this._removeOldTags();
|
3650 |
+
|
3651 |
+
if (params.term == null || params.page != null) {
|
3652 |
+
decorated.call(this, params, callback);
|
3653 |
+
return;
|
3654 |
+
}
|
3655 |
+
|
3656 |
+
function wrapper (obj, child) {
|
3657 |
+
var data = obj.results;
|
3658 |
+
|
3659 |
+
for (var i = 0; i < data.length; i++) {
|
3660 |
+
var option = data[i];
|
3661 |
+
|
3662 |
+
var checkChildren = (
|
3663 |
+
option.children != null &&
|
3664 |
+
!wrapper({
|
3665 |
+
results: option.children
|
3666 |
+
}, true)
|
3667 |
+
);
|
3668 |
+
|
3669 |
+
var optionText = (option.text || '').toUpperCase();
|
3670 |
+
var paramsTerm = (params.term || '').toUpperCase();
|
3671 |
+
|
3672 |
+
var checkText = optionText === paramsTerm;
|
3673 |
+
|
3674 |
+
if (checkText || checkChildren) {
|
3675 |
+
if (child) {
|
3676 |
+
return false;
|
3677 |
+
}
|
3678 |
+
|
3679 |
+
obj.data = data;
|
3680 |
+
callback(obj);
|
3681 |
+
|
3682 |
+
return;
|
3683 |
+
}
|
3684 |
+
}
|
3685 |
+
|
3686 |
+
if (child) {
|
3687 |
+
return true;
|
3688 |
+
}
|
3689 |
+
|
3690 |
+
var tag = self.createTag(params);
|
3691 |
+
|
3692 |
+
if (tag != null) {
|
3693 |
+
var $option = self.option(tag);
|
3694 |
+
$option.attr('data-select2-tag', true);
|
3695 |
+
|
3696 |
+
self.addOptions([$option]);
|
3697 |
+
|
3698 |
+
self.insertTag(data, tag);
|
3699 |
+
}
|
3700 |
+
|
3701 |
+
obj.results = data;
|
3702 |
+
|
3703 |
+
callback(obj);
|
3704 |
+
}
|
3705 |
+
|
3706 |
+
decorated.call(this, params, wrapper);
|
3707 |
+
};
|
3708 |
+
|
3709 |
+
Tags.prototype.createTag = function (decorated, params) {
|
3710 |
+
var term = $.trim(params.term);
|
3711 |
+
|
3712 |
+
if (term === '') {
|
3713 |
+
return null;
|
3714 |
+
}
|
3715 |
+
|
3716 |
+
return {
|
3717 |
+
id: term,
|
3718 |
+
text: term
|
3719 |
+
};
|
3720 |
+
};
|
3721 |
+
|
3722 |
+
Tags.prototype.insertTag = function (_, data, tag) {
|
3723 |
+
data.unshift(tag);
|
3724 |
+
};
|
3725 |
+
|
3726 |
+
Tags.prototype._removeOldTags = function (_) {
|
3727 |
+
var tag = this._lastTag;
|
3728 |
+
|
3729 |
+
var $options = this.$element.find('option[data-select2-tag]');
|
3730 |
+
|
3731 |
+
$options.each(function () {
|
3732 |
+
if (this.selected) {
|
3733 |
+
return;
|
3734 |
+
}
|
3735 |
+
|
3736 |
+
$(this).remove();
|
3737 |
+
});
|
3738 |
+
};
|
3739 |
+
|
3740 |
+
return Tags;
|
3741 |
+
});
|
3742 |
+
|
3743 |
+
S2.define('select2/data/tokenizer',[
|
3744 |
+
'jquery'
|
3745 |
+
], function ($) {
|
3746 |
+
function Tokenizer (decorated, $element, options) {
|
3747 |
+
var tokenizer = options.get('tokenizer');
|
3748 |
+
|
3749 |
+
if (tokenizer !== undefined) {
|
3750 |
+
this.tokenizer = tokenizer;
|
3751 |
+
}
|
3752 |
+
|
3753 |
+
decorated.call(this, $element, options);
|
3754 |
+
}
|
3755 |
+
|
3756 |
+
Tokenizer.prototype.bind = function (decorated, container, $container) {
|
3757 |
+
decorated.call(this, container, $container);
|
3758 |
+
|
3759 |
+
this.$search = container.dropdown.$search || container.selection.$search ||
|
3760 |
+
$container.find('.select2-search__field');
|
3761 |
+
};
|
3762 |
+
|
3763 |
+
Tokenizer.prototype.query = function (decorated, params, callback) {
|
3764 |
+
var self = this;
|
3765 |
+
|
3766 |
+
function createAndSelect (data) {
|
3767 |
+
// Normalize the data object so we can use it for checks
|
3768 |
+
var item = self._normalizeItem(data);
|
3769 |
+
|
3770 |
+
// Check if the data object already exists as a tag
|
3771 |
+
// Select it if it doesn't
|
3772 |
+
var $existingOptions = self.$element.find('option').filter(function () {
|
3773 |
+
return $(this).val() === item.id;
|
3774 |
+
});
|
3775 |
+
|
3776 |
+
// If an existing option wasn't found for it, create the option
|
3777 |
+
if (!$existingOptions.length) {
|
3778 |
+
var $option = self.option(item);
|
3779 |
+
$option.attr('data-select2-tag', true);
|
3780 |
+
|
3781 |
+
self._removeOldTags();
|
3782 |
+
self.addOptions([$option]);
|
3783 |
+
}
|
3784 |
+
|
3785 |
+
// Select the item, now that we know there is an option for it
|
3786 |
+
select(item);
|
3787 |
+
}
|
3788 |
+
|
3789 |
+
function select (data) {
|
3790 |
+
self.trigger('select', {
|
3791 |
+
data: data
|
3792 |
+
});
|
3793 |
+
}
|
3794 |
+
|
3795 |
+
params.term = params.term || '';
|
3796 |
+
|
3797 |
+
var tokenData = this.tokenizer(params, this.options, createAndSelect);
|
3798 |
+
|
3799 |
+
if (tokenData.term !== params.term) {
|
3800 |
+
// Replace the search term if we have the search box
|
3801 |
+
if (this.$search.length) {
|
3802 |
+
this.$search.val(tokenData.term);
|
3803 |
+
this.$search.focus();
|
3804 |
+
}
|
3805 |
+
|
3806 |
+
params.term = tokenData.term;
|
3807 |
+
}
|
3808 |
+
|
3809 |
+
decorated.call(this, params, callback);
|
3810 |
+
};
|
3811 |
+
|
3812 |
+
Tokenizer.prototype.tokenizer = function (_, params, options, callback) {
|
3813 |
+
var separators = options.get('tokenSeparators') || [];
|
3814 |
+
var term = params.term;
|
3815 |
+
var i = 0;
|
3816 |
+
|
3817 |
+
var createTag = this.createTag || function (params) {
|
3818 |
+
return {
|
3819 |
+
id: params.term,
|
3820 |
+
text: params.term
|
3821 |
+
};
|
3822 |
+
};
|
3823 |
+
|
3824 |
+
while (i < term.length) {
|
3825 |
+
var termChar = term[i];
|
3826 |
+
|
3827 |
+
if ($.inArray(termChar, separators) === -1) {
|
3828 |
+
i++;
|
3829 |
+
|
3830 |
+
continue;
|
3831 |
+
}
|
3832 |
+
|
3833 |
+
var part = term.substr(0, i);
|
3834 |
+
var partParams = $.extend({}, params, {
|
3835 |
+
term: part
|
3836 |
+
});
|
3837 |
+
|
3838 |
+
var data = createTag(partParams);
|
3839 |
+
|
3840 |
+
if (data == null) {
|
3841 |
+
i++;
|
3842 |
+
continue;
|
3843 |
+
}
|
3844 |
+
|
3845 |
+
callback(data);
|
3846 |
+
|
3847 |
+
// Reset the term to not include the tokenized portion
|
3848 |
+
term = term.substr(i + 1) || '';
|
3849 |
+
i = 0;
|
3850 |
+
}
|
3851 |
+
|
3852 |
+
return {
|
3853 |
+
term: term
|
3854 |
+
};
|
3855 |
+
};
|
3856 |
+
|
3857 |
+
return Tokenizer;
|
3858 |
+
});
|
3859 |
+
|
3860 |
+
S2.define('select2/data/minimumInputLength',[
|
3861 |
+
|
3862 |
+
], function () {
|
3863 |
+
function MinimumInputLength (decorated, $e, options) {
|
3864 |
+
this.minimumInputLength = options.get('minimumInputLength');
|
3865 |
+
|
3866 |
+
decorated.call(this, $e, options);
|
3867 |
+
}
|
3868 |
+
|
3869 |
+
MinimumInputLength.prototype.query = function (decorated, params, callback) {
|
3870 |
+
params.term = params.term || '';
|
3871 |
+
|
3872 |
+
if (params.term.length < this.minimumInputLength) {
|
3873 |
+
this.trigger('results:message', {
|
3874 |
+
message: 'inputTooShort',
|
3875 |
+
args: {
|
3876 |
+
minimum: this.minimumInputLength,
|
3877 |
+
input: params.term,
|
3878 |
+
params: params
|
3879 |
+
}
|
3880 |
+
});
|
3881 |
+
|
3882 |
+
return;
|
3883 |
+
}
|
3884 |
+
|
3885 |
+
decorated.call(this, params, callback);
|
3886 |
+
};
|
3887 |
+
|
3888 |
+
return MinimumInputLength;
|
3889 |
+
});
|
3890 |
+
|
3891 |
+
S2.define('select2/data/maximumInputLength',[
|
3892 |
+
|
3893 |
+
], function () {
|
3894 |
+
function MaximumInputLength (decorated, $e, options) {
|
3895 |
+
this.maximumInputLength = options.get('maximumInputLength');
|
3896 |
+
|
3897 |
+
decorated.call(this, $e, options);
|
3898 |
+
}
|
3899 |
+
|
3900 |
+
MaximumInputLength.prototype.query = function (decorated, params, callback) {
|
3901 |
+
params.term = params.term || '';
|
3902 |
+
|
3903 |
+
if (this.maximumInputLength > 0 &&
|
3904 |
+
params.term.length > this.maximumInputLength) {
|
3905 |
+
this.trigger('results:message', {
|
3906 |
+
message: 'inputTooLong',
|
3907 |
+
args: {
|
3908 |
+
maximum: this.maximumInputLength,
|
3909 |
+
input: params.term,
|
3910 |
+
params: params
|
3911 |
+
}
|
3912 |
+
});
|
3913 |
+
|
3914 |
+
return;
|
3915 |
+
}
|
3916 |
+
|
3917 |
+
decorated.call(this, params, callback);
|
3918 |
+
};
|
3919 |
+
|
3920 |
+
return MaximumInputLength;
|
3921 |
+
});
|
3922 |
+
|
3923 |
+
S2.define('select2/data/maximumSelectionLength',[
|
3924 |
+
|
3925 |
+
], function (){
|
3926 |
+
function MaximumSelectionLength (decorated, $e, options) {
|
3927 |
+
this.maximumSelectionLength = options.get('maximumSelectionLength');
|
3928 |
+
|
3929 |
+
decorated.call(this, $e, options);
|
3930 |
+
}
|
3931 |
+
|
3932 |
+
MaximumSelectionLength.prototype.query =
|
3933 |
+
function (decorated, params, callback) {
|
3934 |
+
var self = this;
|
3935 |
+
|
3936 |
+
this.current(function (currentData) {
|
3937 |
+
var count = currentData != null ? currentData.length : 0;
|
3938 |
+
if (self.maximumSelectionLength > 0 &&
|
3939 |
+
count >= self.maximumSelectionLength) {
|
3940 |
+
self.trigger('results:message', {
|
3941 |
+
message: 'maximumSelected',
|
3942 |
+
args: {
|
3943 |
+
maximum: self.maximumSelectionLength
|
3944 |
+
}
|
3945 |
+
});
|
3946 |
+
return;
|
3947 |
+
}
|
3948 |
+
decorated.call(self, params, callback);
|
3949 |
+
});
|
3950 |
+
};
|
3951 |
+
|
3952 |
+
return MaximumSelectionLength;
|
3953 |
+
});
|
3954 |
+
|
3955 |
+
S2.define('select2/dropdown',[
|
3956 |
+
'jquery',
|
3957 |
+
'./utils'
|
3958 |
+
], function ($, Utils) {
|
3959 |
+
function Dropdown ($element, options) {
|
3960 |
+
this.$element = $element;
|
3961 |
+
this.options = options;
|
3962 |
+
|
3963 |
+
Dropdown.__super__.constructor.call(this);
|
3964 |
+
}
|
3965 |
+
|
3966 |
+
Utils.Extend(Dropdown, Utils.Observable);
|
3967 |
+
|
3968 |
+
Dropdown.prototype.render = function () {
|
3969 |
+
var $dropdown = $(
|
3970 |
+
'<span class="select2-dropdown">' +
|
3971 |
+
'<span class="select2-results"></span>' +
|
3972 |
+
'</span>'
|
3973 |
+
);
|
3974 |
+
|
3975 |
+
$dropdown.attr('dir', this.options.get('dir'));
|
3976 |
+
|
3977 |
+
this.$dropdown = $dropdown;
|
3978 |
+
|
3979 |
+
return $dropdown;
|
3980 |
+
};
|
3981 |
+
|
3982 |
+
Dropdown.prototype.bind = function () {
|
3983 |
+
// Should be implemented in subclasses
|
3984 |
+
};
|
3985 |
+
|
3986 |
+
Dropdown.prototype.position = function ($dropdown, $container) {
|
3987 |
+
// Should be implmented in subclasses
|
3988 |
+
};
|
3989 |
+
|
3990 |
+
Dropdown.prototype.destroy = function () {
|
3991 |
+
// Remove the dropdown from the DOM
|
3992 |
+
this.$dropdown.remove();
|
3993 |
+
};
|
3994 |
+
|
3995 |
+
return Dropdown;
|
3996 |
+
});
|
3997 |
+
|
3998 |
+
S2.define('select2/dropdown/search',[
|
3999 |
+
'jquery',
|
4000 |
+
'../utils'
|
4001 |
+
], function ($, Utils) {
|
4002 |
+
function Search () { }
|
4003 |
+
|
4004 |
+
Search.prototype.render = function (decorated) {
|
4005 |
+
var $rendered = decorated.call(this);
|
4006 |
+
|
4007 |
+
var $search = $(
|
4008 |
+
'<span class="select2-search select2-search--dropdown">' +
|
4009 |
+
'<input class="select2-search__field" type="text" tabindex="-1"' +
|
4010 |
+
' autocomplete="off" autocorrect="off" autocapitalize="none"' +
|
4011 |
+
' spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="true" />' +
|
4012 |
+
'</span>'
|
4013 |
+
);
|
4014 |
+
|
4015 |
+
this.$searchContainer = $search;
|
4016 |
+
this.$search = $search.find('input');
|
4017 |
+
|
4018 |
+
$rendered.prepend($search);
|
4019 |
+
|
4020 |
+
return $rendered;
|
4021 |
+
};
|
4022 |
+
|
4023 |
+
Search.prototype.bind = function (decorated, container, $container) {
|
4024 |
+
var self = this;
|
4025 |
+
var resultsId = container.id + '-results';
|
4026 |
+
|
4027 |
+
decorated.call(this, container, $container);
|
4028 |
+
|
4029 |
+
this.$search.on('keydown', function (evt) {
|
4030 |
+
self.trigger('keypress', evt);
|
4031 |
+
|
4032 |
+
self._keyUpPrevented = evt.isDefaultPrevented();
|
4033 |
+
});
|
4034 |
+
|
4035 |
+
// Workaround for browsers which do not support the `input` event
|
4036 |
+
// This will prevent double-triggering of events for browsers which support
|
4037 |
+
// both the `keyup` and `input` events.
|
4038 |
+
this.$search.on('input', function (evt) {
|
4039 |
+
// Unbind the duplicated `keyup` event
|
4040 |
+
$(this).off('keyup');
|
4041 |
+
});
|
4042 |
+
|
4043 |
+
this.$search.on('keyup input', function (evt) {
|
4044 |
+
self.handleSearch(evt);
|
4045 |
+
});
|
4046 |
+
|
4047 |
+
container.on('open', function () {
|
4048 |
+
self.$search.attr('tabindex', 0);
|
4049 |
+
self.$search.attr('aria-owns', resultsId);
|
4050 |
+
self.$search.focus();
|
4051 |
+
|
4052 |
+
window.setTimeout(function () {
|
4053 |
+
self.$search.focus();
|
4054 |
+
}, 0);
|
4055 |
+
});
|
4056 |
+
|
4057 |
+
container.on('close', function () {
|
4058 |
+
self.$search.attr('tabindex', -1);
|
4059 |
+
self.$search.removeAttr('aria-activedescendant');
|
4060 |
+
self.$search.removeAttr('aria-owns');
|
4061 |
+
self.$search.val('');
|
4062 |
+
});
|
4063 |
+
|
4064 |
+
container.on('focus', function () {
|
4065 |
+
if (!container.isOpen()) {
|
4066 |
+
self.$search.focus();
|
4067 |
+
}
|
4068 |
+
});
|
4069 |
+
|
4070 |
+
container.on('results:all', function (params) {
|
4071 |
+
if (params.query.term == null || params.query.term === '') {
|
4072 |
+
var showSearch = self.showSearch(params);
|
4073 |
+
|
4074 |
+
if (showSearch) {
|
4075 |
+
self.$searchContainer.removeClass('select2-search--hide');
|
4076 |
+
} else {
|
4077 |
+
self.$searchContainer.addClass('select2-search--hide');
|
4078 |
+
}
|
4079 |
+
}
|
4080 |
+
});
|
4081 |
+
|
4082 |
+
container.on('results:focus', function (params) {
|
4083 |
+
self.$search.attr('aria-activedescendant', params.data._resultId);
|
4084 |
+
});
|
4085 |
+
};
|
4086 |
+
|
4087 |
+
Search.prototype.handleSearch = function (evt) {
|
4088 |
+
if (!this._keyUpPrevented) {
|
4089 |
+
var input = this.$search.val();
|
4090 |
+
|
4091 |
+
this.trigger('query', {
|
4092 |
+
term: input
|
4093 |
+
});
|
4094 |
+
}
|
4095 |
+
|
4096 |
+
this._keyUpPrevented = false;
|
4097 |
+
};
|
4098 |
+
|
4099 |
+
Search.prototype.showSearch = function (_, params) {
|
4100 |
+
return true;
|
4101 |
+
};
|
4102 |
+
|
4103 |
+
return Search;
|
4104 |
+
});
|
4105 |
+
|
4106 |
+
S2.define('select2/dropdown/hidePlaceholder',[
|
4107 |
+
|
4108 |
+
], function () {
|
4109 |
+
function HidePlaceholder (decorated, $element, options, dataAdapter) {
|
4110 |
+
this.placeholder = this.normalizePlaceholder(options.get('placeholder'));
|
4111 |
+
|
4112 |
+
decorated.call(this, $element, options, dataAdapter);
|
4113 |
+
}
|
4114 |
+
|
4115 |
+
HidePlaceholder.prototype.append = function (decorated, data) {
|
4116 |
+
data.results = this.removePlaceholder(data.results);
|
4117 |
+
|
4118 |
+
decorated.call(this, data);
|
4119 |
+
};
|
4120 |
+
|
4121 |
+
HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) {
|
4122 |
+
if (typeof placeholder === 'string') {
|
4123 |
+
placeholder = {
|
4124 |
+
id: '',
|
4125 |
+
text: placeholder
|
4126 |
+
};
|
4127 |
+
}
|
4128 |
+
|
4129 |
+
return placeholder;
|
4130 |
+
};
|
4131 |
+
|
4132 |
+
HidePlaceholder.prototype.removePlaceholder = function (_, data) {
|
4133 |
+
var modifiedData = data.slice(0);
|
4134 |
+
|
4135 |
+
for (var d = data.length - 1; d >= 0; d--) {
|
4136 |
+
var item = data[d];
|
4137 |
+
|
4138 |
+
if (this.placeholder.id === item.id) {
|
4139 |
+
modifiedData.splice(d, 1);
|
4140 |
+
}
|
4141 |
+
}
|
4142 |
+
|
4143 |
+
return modifiedData;
|
4144 |
+
};
|
4145 |
+
|
4146 |
+
return HidePlaceholder;
|
4147 |
+
});
|
4148 |
+
|
4149 |
+
S2.define('select2/dropdown/infiniteScroll',[
|
4150 |
+
'jquery'
|
4151 |
+
], function ($) {
|
4152 |
+
function InfiniteScroll (decorated, $element, options, dataAdapter) {
|
4153 |
+
this.lastParams = {};
|
4154 |
+
|
4155 |
+
decorated.call(this, $element, options, dataAdapter);
|
4156 |
+
|
4157 |
+
this.$loadingMore = this.createLoadingMore();
|
4158 |
+
this.loading = false;
|
4159 |
+
}
|
4160 |
+
|
4161 |
+
InfiniteScroll.prototype.append = function (decorated, data) {
|
4162 |
+
this.$loadingMore.remove();
|
4163 |
+
this.loading = false;
|
4164 |
+
|
4165 |
+
decorated.call(this, data);
|
4166 |
+
|
4167 |
+
if (this.showLoadingMore(data)) {
|
4168 |
+
this.$results.append(this.$loadingMore);
|
4169 |
+
}
|
4170 |
+
};
|
4171 |
+
|
4172 |
+
InfiniteScroll.prototype.bind = function (decorated, container, $container) {
|
4173 |
+
var self = this;
|
4174 |
+
|
4175 |
+
decorated.call(this, container, $container);
|
4176 |
+
|
4177 |
+
container.on('query', function (params) {
|
4178 |
+
self.lastParams = params;
|
4179 |
+
self.loading = true;
|
4180 |
+
});
|
4181 |
+
|
4182 |
+
container.on('query:append', function (params) {
|
4183 |
+
self.lastParams = params;
|
4184 |
+
self.loading = true;
|
4185 |
+
});
|
4186 |
+
|
4187 |
+
this.$results.on('scroll', function () {
|
4188 |
+
var isLoadMoreVisible = $.contains(
|
4189 |
+
document.documentElement,
|
4190 |
+
self.$loadingMore[0]
|
4191 |
+
);
|
4192 |
+
|
4193 |
+
if (self.loading || !isLoadMoreVisible) {
|
4194 |
+
return;
|
4195 |
+
}
|
4196 |
+
|
4197 |
+
var currentOffset = self.$results.offset().top +
|
4198 |
+
self.$results.outerHeight(false);
|
4199 |
+
var loadingMoreOffset = self.$loadingMore.offset().top +
|
4200 |
+
self.$loadingMore.outerHeight(false);
|
4201 |
+
|
4202 |
+
if (currentOffset + 50 >= loadingMoreOffset) {
|
4203 |
+
self.loadMore();
|
4204 |
+
}
|
4205 |
+
});
|
4206 |
+
};
|
4207 |
+
|
4208 |
+
InfiniteScroll.prototype.loadMore = function () {
|
4209 |
+
this.loading = true;
|
4210 |
+
|
4211 |
+
var params = $.extend({}, {page: 1}, this.lastParams);
|
4212 |
+
|
4213 |
+
params.page++;
|
4214 |
+
|
4215 |
+
this.trigger('query:append', params);
|
4216 |
+
};
|
4217 |
+
|
4218 |
+
InfiniteScroll.prototype.showLoadingMore = function (_, data) {
|
4219 |
+
return data.pagination && data.pagination.more;
|
4220 |
+
};
|
4221 |
+
|
4222 |
+
InfiniteScroll.prototype.createLoadingMore = function () {
|
4223 |
+
var $option = $(
|
4224 |
+
'<li ' +
|
4225 |
+
'class="select2-results__option select2-results__option--load-more"' +
|
4226 |
+
'role="option" aria-disabled="true"></li>'
|
4227 |
+
);
|
4228 |
+
|
4229 |
+
var message = this.options.get('translations').get('loadingMore');
|
4230 |
+
|
4231 |
+
$option.html(message(this.lastParams));
|
4232 |
+
|
4233 |
+
return $option;
|
4234 |
+
};
|
4235 |
+
|
4236 |
+
return InfiniteScroll;
|
4237 |
+
});
|
4238 |
+
|
4239 |
+
S2.define('select2/dropdown/attachBody',[
|
4240 |
+
'jquery',
|
4241 |
+
'../utils'
|
4242 |
+
], function ($, Utils) {
|
4243 |
+
function AttachBody (decorated, $element, options) {
|
4244 |
+
this.$dropdownParent = options.get('dropdownParent') || $(document.body);
|
4245 |
+
|
4246 |
+
decorated.call(this, $element, options);
|
4247 |
+
}
|
4248 |
+
|
4249 |
+
AttachBody.prototype.bind = function (decorated, container, $container) {
|
4250 |
+
var self = this;
|
4251 |
+
|
4252 |
+
var setupResultsEvents = false;
|
4253 |
+
|
4254 |
+
decorated.call(this, container, $container);
|
4255 |
+
|
4256 |
+
container.on('open', function () {
|
4257 |
+
self._showDropdown();
|
4258 |
+
self._attachPositioningHandler(container);
|
4259 |
+
|
4260 |
+
if (!setupResultsEvents) {
|
4261 |
+
setupResultsEvents = true;
|
4262 |
+
|
4263 |
+
container.on('results:all', function () {
|
4264 |
+
self._positionDropdown();
|
4265 |
+
self._resizeDropdown();
|
4266 |
+
});
|
4267 |
+
|
4268 |
+
container.on('results:append', function () {
|
4269 |
+
self._positionDropdown();
|
4270 |
+
self._resizeDropdown();
|
4271 |
+
});
|
4272 |
+
}
|
4273 |
+
});
|
4274 |
+
|
4275 |
+
container.on('close', function () {
|
4276 |
+
self._hideDropdown();
|
4277 |
+
self._detachPositioningHandler(container);
|
4278 |
+
});
|
4279 |
+
|
4280 |
+
this.$dropdownContainer.on('mousedown', function (evt) {
|
4281 |
+
evt.stopPropagation();
|
4282 |
+
});
|
4283 |
+
};
|
4284 |
+
|
4285 |
+
AttachBody.prototype.destroy = function (decorated) {
|
4286 |
+
decorated.call(this);
|
4287 |
+
|
4288 |
+
this.$dropdownContainer.remove();
|
4289 |
+
};
|
4290 |
+
|
4291 |
+
AttachBody.prototype.position = function (decorated, $dropdown, $container) {
|
4292 |
+
// Clone all of the container classes
|
4293 |
+
$dropdown.attr('class', $container.attr('class'));
|
4294 |
+
|
4295 |
+
$dropdown.removeClass('select2');
|
4296 |
+
$dropdown.addClass('select2-container--open');
|
4297 |
+
|
4298 |
+
$dropdown.css({
|
4299 |
+
position: 'absolute',
|
4300 |
+
top: -999999
|
4301 |
+
});
|
4302 |
+
|
4303 |
+
this.$container = $container;
|
4304 |
+
};
|
4305 |
+
|
4306 |
+
AttachBody.prototype.render = function (decorated) {
|
4307 |
+
var $container = $('<span></span>');
|
4308 |
+
|
4309 |
+
var $dropdown = decorated.call(this);
|
4310 |
+
$container.append($dropdown);
|
4311 |
+
|
4312 |
+
this.$dropdownContainer = $container;
|
4313 |
+
|
4314 |
+
return $container;
|
4315 |
+
};
|
4316 |
+
|
4317 |
+
AttachBody.prototype._hideDropdown = function (decorated) {
|
4318 |
+
this.$dropdownContainer.detach();
|
4319 |
+
};
|
4320 |
+
|
4321 |
+
AttachBody.prototype._attachPositioningHandler =
|
4322 |
+
function (decorated, container) {
|
4323 |
+
var self = this;
|
4324 |
+
|
4325 |
+
var scrollEvent = 'scroll.select2.' + container.id;
|
4326 |
+
var resizeEvent = 'resize.select2.' + container.id;
|
4327 |
+
var orientationEvent = 'orientationchange.select2.' + container.id;
|
4328 |
+
|
4329 |
+
var $watchers = this.$container.parents().filter(Utils.hasScroll);
|
4330 |
+
$watchers.each(function () {
|
4331 |
+
$(this).data('select2-scroll-position', {
|
4332 |
+
x: $(this).scrollLeft(),
|
4333 |
+
y: $(this).scrollTop()
|
4334 |
+
});
|
4335 |
+
});
|
4336 |
+
|
4337 |
+
$watchers.on(scrollEvent, function (ev) {
|
4338 |
+
var position = $(this).data('select2-scroll-position');
|
4339 |
+
$(this).scrollTop(position.y);
|
4340 |
+
});
|
4341 |
+
|
4342 |
+
$(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent,
|
4343 |
+
function (e) {
|
4344 |
+
self._positionDropdown();
|
4345 |
+
self._resizeDropdown();
|
4346 |
+
});
|
4347 |
+
};
|
4348 |
+
|
4349 |
+
AttachBody.prototype._detachPositioningHandler =
|
4350 |
+
function (decorated, container) {
|
4351 |
+
var scrollEvent = 'scroll.select2.' + container.id;
|
4352 |
+
var resizeEvent = 'resize.select2.' + container.id;
|
4353 |
+
var orientationEvent = 'orientationchange.select2.' + container.id;
|
4354 |
+
|
4355 |
+
var $watchers = this.$container.parents().filter(Utils.hasScroll);
|
4356 |
+
$watchers.off(scrollEvent);
|
4357 |
+
|
4358 |
+
$(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent);
|
4359 |
+
};
|
4360 |
+
|
4361 |
+
AttachBody.prototype._positionDropdown = function () {
|
4362 |
+
var $window = $(window);
|
4363 |
+
|
4364 |
+
var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above');
|
4365 |
+
var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below');
|
4366 |
+
|
4367 |
+
var newDirection = null;
|
4368 |
+
|
4369 |
+
var offset = this.$container.offset();
|
4370 |
+
|
4371 |
+
offset.bottom = offset.top + this.$container.outerHeight(false);
|
4372 |
+
|
4373 |
+
var container = {
|
4374 |
+
height: this.$container.outerHeight(false)
|
4375 |
+
};
|
4376 |
+
|
4377 |
+
container.top = offset.top;
|
4378 |
+
container.bottom = offset.top + container.height;
|
4379 |
+
|
4380 |
+
var dropdown = {
|
4381 |
+
height: this.$dropdown.outerHeight(false)
|
4382 |
+
};
|
4383 |
+
|
4384 |
+
var viewport = {
|
4385 |
+
top: $window.scrollTop(),
|
4386 |
+
bottom: $window.scrollTop() + $window.height()
|
4387 |
+
};
|
4388 |
+
|
4389 |
+
var enoughRoomAbove = viewport.top < (offset.top - dropdown.height);
|
4390 |
+
var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height);
|
4391 |
+
|
4392 |
+
var css = {
|
4393 |
+
left: offset.left,
|
4394 |
+
top: container.bottom
|
4395 |
+
};
|
4396 |
+
|
4397 |
+
// Determine what the parent element is to use for calciulating the offset
|
4398 |
+
var $offsetParent = this.$dropdownParent;
|
4399 |
+
|
4400 |
+
// For statically positoned elements, we need to get the element
|
4401 |
+
// that is determining the offset
|
4402 |
+
if ($offsetParent.css('position') === 'static') {
|
4403 |
+
$offsetParent = $offsetParent.offsetParent();
|
4404 |
+
}
|
4405 |
+
|
4406 |
+
var parentOffset = $offsetParent.offset();
|
4407 |
+
|
4408 |
+
css.left -= parentOffset.left;
|
4409 |
+
|
4410 |
+
if (!isCurrentlyAbove && !isCurrentlyBelow) {
|
4411 |
+
newDirection = 'below';
|
4412 |
+
}
|
4413 |
+
|
4414 |
+
if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) {
|
4415 |
+
newDirection = 'above';
|
4416 |
+
} else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) {
|
4417 |
+
newDirection = 'below';
|
4418 |
+
}
|
4419 |
+
|
4420 |
+
if (newDirection == 'above' ||
|
4421 |
+
(isCurrentlyAbove && newDirection !== 'below')) {
|
4422 |
+
css.top = container.top - dropdown.height;
|
4423 |
+
}
|
4424 |
+
|
4425 |
+
if (newDirection != null) {
|
4426 |
+
this.$dropdown
|
4427 |
+
.removeClass('select2-dropdown--below select2-dropdown--above')
|
4428 |
+
.addClass('select2-dropdown--' + newDirection);
|
4429 |
+
this.$container
|
4430 |
+
.removeClass('select2-container--below select2-container--above')
|
4431 |
+
.addClass('select2-container--' + newDirection);
|
4432 |
+
}
|
4433 |
+
|
4434 |
+
this.$dropdownContainer.css(css);
|
4435 |
+
};
|
4436 |
+
|
4437 |
+
AttachBody.prototype._resizeDropdown = function () {
|
4438 |
+
var css = {
|
4439 |
+
width: this.$container.outerWidth(false) + 'px'
|
4440 |
+
};
|
4441 |
+
|
4442 |
+
if (this.options.get('dropdownAutoWidth')) {
|
4443 |
+
css.minWidth = css.width;
|
4444 |
+
css.position = 'relative';
|
4445 |
+
css.width = 'auto';
|
4446 |
+
}
|
4447 |
+
|
4448 |
+
this.$dropdown.css(css);
|
4449 |
+
};
|
4450 |
+
|
4451 |
+
AttachBody.prototype._showDropdown = function (decorated) {
|
4452 |
+
this.$dropdownContainer.appendTo(this.$dropdownParent);
|
4453 |
+
|
4454 |
+
this._positionDropdown();
|
4455 |
+
this._resizeDropdown();
|
4456 |
+
};
|
4457 |
+
|
4458 |
+
return AttachBody;
|
4459 |
+
});
|
4460 |
+
|
4461 |
+
S2.define('select2/dropdown/minimumResultsForSearch',[
|
4462 |
+
|
4463 |
+
], function () {
|
4464 |
+
function countResults (data) {
|
4465 |
+
var count = 0;
|
4466 |
+
|
4467 |
+
for (var d = 0; d < data.length; d++) {
|
4468 |
+
var item = data[d];
|
4469 |
+
|
4470 |
+
if (item.children) {
|
4471 |
+
count += countResults(item.children);
|
4472 |
+
} else {
|
4473 |
+
count++;
|
4474 |
+
}
|
4475 |
+
}
|
4476 |
+
|
4477 |
+
return count;
|
4478 |
+
}
|
4479 |
+
|
4480 |
+
function MinimumResultsForSearch (decorated, $element, options, dataAdapter) {
|
4481 |
+
this.minimumResultsForSearch = options.get('minimumResultsForSearch');
|
4482 |
+
|
4483 |
+
if (this.minimumResultsForSearch < 0) {
|
4484 |
+
this.minimumResultsForSearch = Infinity;
|
4485 |
+
}
|
4486 |
+
|
4487 |
+
decorated.call(this, $element, options, dataAdapter);
|
4488 |
+
}
|
4489 |
+
|
4490 |
+
MinimumResultsForSearch.prototype.showSearch = function (decorated, params) {
|
4491 |
+
if (countResults(params.data.results) < this.minimumResultsForSearch) {
|
4492 |
+
return false;
|
4493 |
+
}
|
4494 |
+
|
4495 |
+
return decorated.call(this, params);
|
4496 |
+
};
|
4497 |
+
|
4498 |
+
return MinimumResultsForSearch;
|
4499 |
+
});
|
4500 |
+
|
4501 |
+
S2.define('select2/dropdown/selectOnClose',[
|
4502 |
+
|
4503 |
+
], function () {
|
4504 |
+
function SelectOnClose () { }
|
4505 |
+
|
4506 |
+
SelectOnClose.prototype.bind = function (decorated, container, $container) {
|
4507 |
+
var self = this;
|
4508 |
+
|
4509 |
+
decorated.call(this, container, $container);
|
4510 |
+
|
4511 |
+
container.on('close', function (params) {
|
4512 |
+
self._handleSelectOnClose(params);
|
4513 |
+
});
|
4514 |
+
};
|
4515 |
+
|
4516 |
+
SelectOnClose.prototype._handleSelectOnClose = function (_, params) {
|
4517 |
+
if (params && params.originalSelect2Event != null) {
|
4518 |
+
var event = params.originalSelect2Event;
|
4519 |
+
|
4520 |
+
// Don't select an item if the close event was triggered from a select or
|
4521 |
+
// unselect event
|
4522 |
+
if (event._type === 'select' || event._type === 'unselect') {
|
4523 |
+
return;
|
4524 |
+
}
|
4525 |
+
}
|
4526 |
+
|
4527 |
+
var $highlightedResults = this.getHighlightedResults();
|
4528 |
+
|
4529 |
+
// Only select highlighted results
|
4530 |
+
if ($highlightedResults.length < 1) {
|
4531 |
+
return;
|
4532 |
+
}
|
4533 |
+
|
4534 |
+
var data = $highlightedResults.data('data');
|
4535 |
+
|
4536 |
+
// Don't re-select already selected resulte
|
4537 |
+
if (
|
4538 |
+
(data.element != null && data.element.selected) ||
|
4539 |
+
(data.element == null && data.selected)
|
4540 |
+
) {
|
4541 |
+
return;
|
4542 |
+
}
|
4543 |
+
|
4544 |
+
this.trigger('select', {
|
4545 |
+
data: data
|
4546 |
+
});
|
4547 |
+
};
|
4548 |
+
|
4549 |
+
return SelectOnClose;
|
4550 |
+
});
|
4551 |
+
|
4552 |
+
S2.define('select2/dropdown/closeOnSelect',[
|
4553 |
+
|
4554 |
+
], function () {
|
4555 |
+
function CloseOnSelect () { }
|
4556 |
+
|
4557 |
+
CloseOnSelect.prototype.bind = function (decorated, container, $container) {
|
4558 |
+
var self = this;
|
4559 |
+
|
4560 |
+
decorated.call(this, container, $container);
|
4561 |
+
|
4562 |
+
container.on('select', function (evt) {
|
4563 |
+
self._selectTriggered(evt);
|
4564 |
+
});
|
4565 |
+
|
4566 |
+
container.on('unselect', function (evt) {
|
4567 |
+
self._selectTriggered(evt);
|
4568 |
+
});
|
4569 |
+
};
|
4570 |
+
|
4571 |
+
CloseOnSelect.prototype._selectTriggered = function (_, evt) {
|
4572 |
+
var originalEvent = evt.originalEvent;
|
4573 |
+
|
4574 |
+
// Don't close if the control key is being held
|
4575 |
+
if (originalEvent && originalEvent.ctrlKey) {
|
4576 |
+
return;
|
4577 |
+
}
|
4578 |
+
|
4579 |
+
this.trigger('close', {
|
4580 |
+
originalEvent: originalEvent,
|
4581 |
+
originalSelect2Event: evt
|
4582 |
+
});
|
4583 |
+
};
|
4584 |
+
|
4585 |
+
return CloseOnSelect;
|
4586 |
+
});
|
4587 |
+
|
4588 |
+
S2.define('select2/i18n/en',[],function () {
|
4589 |
+
// English
|
4590 |
+
return {
|
4591 |
+
errorLoading: function () {
|
4592 |
+
return 'The results could not be loaded.';
|
4593 |
+
},
|
4594 |
+
inputTooLong: function (args) {
|
4595 |
+
var overChars = args.input.length - args.maximum;
|
4596 |
+
|
4597 |
+
var message = 'Please delete ' + overChars + ' character';
|
4598 |
+
|
4599 |
+
if (overChars != 1) {
|
4600 |
+
message += 's';
|
4601 |
+
}
|
4602 |
+
|
4603 |
+
return message;
|
4604 |
+
},
|
4605 |
+
inputTooShort: function (args) {
|
4606 |
+
var remainingChars = args.minimum - args.input.length;
|
4607 |
+
|
4608 |
+
var message = 'Please enter ' + remainingChars + ' or more characters';
|
4609 |
+
|
4610 |
+
return message;
|
4611 |
+
},
|
4612 |
+
loadingMore: function () {
|
4613 |
+
return 'Loading more results…';
|
4614 |
+
},
|
4615 |
+
maximumSelected: function (args) {
|
4616 |
+
var message = 'You can only select ' + args.maximum + ' item';
|
4617 |
+
|
4618 |
+
if (args.maximum != 1) {
|
4619 |
+
message += 's';
|
4620 |
+
}
|
4621 |
+
|
4622 |
+
return message;
|
4623 |
+
},
|
4624 |
+
noResults: function () {
|
4625 |
+
return 'No results found';
|
4626 |
+
},
|
4627 |
+
searching: function () {
|
4628 |
+
return 'Searching…';
|
4629 |
+
}
|
4630 |
+
};
|
4631 |
+
});
|
4632 |
+
|
4633 |
+
S2.define('select2/defaults',[
|
4634 |
+
'jquery',
|
4635 |
+
'require',
|
4636 |
+
|
4637 |
+
'./results',
|
4638 |
+
|
4639 |
+
'./selection/single',
|
4640 |
+
'./selection/multiple',
|
4641 |
+
'./selection/placeholder',
|
4642 |
+
'./selection/allowClear',
|
4643 |
+
'./selection/search',
|
4644 |
+
'./selection/eventRelay',
|
4645 |
+
|
4646 |
+
'./utils',
|
4647 |
+
'./translation',
|
4648 |
+
'./diacritics',
|
4649 |
+
|
4650 |
+
'./data/select',
|
4651 |
+
'./data/array',
|
4652 |
+
'./data/ajax',
|
4653 |
+
'./data/tags',
|
4654 |
+
'./data/tokenizer',
|
4655 |
+
'./data/minimumInputLength',
|
4656 |
+
'./data/maximumInputLength',
|
4657 |
+
'./data/maximumSelectionLength',
|
4658 |
+
|
4659 |
+
'./dropdown',
|
4660 |
+
'./dropdown/search',
|
4661 |
+
'./dropdown/hidePlaceholder',
|
4662 |
+
'./dropdown/infiniteScroll',
|
4663 |
+
'./dropdown/attachBody',
|
4664 |
+
'./dropdown/minimumResultsForSearch',
|
4665 |
+
'./dropdown/selectOnClose',
|
4666 |
+
'./dropdown/closeOnSelect',
|
4667 |
+
|
4668 |
+
'./i18n/en'
|
4669 |
+
], function ($, require,
|
4670 |
+
|
4671 |
+
ResultsList,
|
4672 |
+
|
4673 |
+
SingleSelection, MultipleSelection, Placeholder, AllowClear,
|
4674 |
+
SelectionSearch, EventRelay,
|
4675 |
+
|
4676 |
+
Utils, Translation, DIACRITICS,
|
4677 |
+
|
4678 |
+
SelectData, ArrayData, AjaxData, Tags, Tokenizer,
|
4679 |
+
MinimumInputLength, MaximumInputLength, MaximumSelectionLength,
|
4680 |
+
|
4681 |
+
Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll,
|
4682 |
+
AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect,
|
4683 |
+
|
4684 |
+
EnglishTranslation) {
|
4685 |
+
function Defaults () {
|
4686 |
+
this.reset();
|
4687 |
+
}
|
4688 |
+
|
4689 |
+
Defaults.prototype.apply = function (options) {
|
4690 |
+
options = $.extend(true, {}, this.defaults, options);
|
4691 |
+
|
4692 |
+
if (options.dataAdapter == null) {
|
4693 |
+
if (options.ajax != null) {
|
4694 |
+
options.dataAdapter = AjaxData;
|
4695 |
+
} else if (options.data != null) {
|
4696 |
+
options.dataAdapter = ArrayData;
|
4697 |
+
} else {
|
4698 |
+
options.dataAdapter = SelectData;
|
4699 |
+
}
|
4700 |
+
|
4701 |
+
if (options.minimumInputLength > 0) {
|
4702 |
+
options.dataAdapter = Utils.Decorate(
|
4703 |
+
options.dataAdapter,
|
4704 |
+
MinimumInputLength
|
4705 |
+
);
|
4706 |
+
}
|
4707 |
+
|
4708 |
+
if (options.maximumInputLength > 0) {
|
4709 |
+
options.dataAdapter = Utils.Decorate(
|
4710 |
+
options.dataAdapter,
|
4711 |
+
MaximumInputLength
|
4712 |
+
);
|
4713 |
+
}
|
4714 |
+
|
4715 |
+
if (options.maximumSelectionLength > 0) {
|
4716 |
+
options.dataAdapter = Utils.Decorate(
|
4717 |
+
options.dataAdapter,
|
4718 |
+
MaximumSelectionLength
|
4719 |
+
);
|
4720 |
+
}
|
4721 |
+
|
4722 |
+
if (options.tags) {
|
4723 |
+
options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags);
|
4724 |
+
}
|
4725 |
+
|
4726 |
+
if (options.tokenSeparators != null || options.tokenizer != null) {
|
4727 |
+
options.dataAdapter = Utils.Decorate(
|
4728 |
+
options.dataAdapter,
|
4729 |
+
Tokenizer
|
4730 |
+
);
|
4731 |
+
}
|
4732 |
+
|
4733 |
+
if (options.query != null) {
|
4734 |
+
var Query = require(options.amdBase + 'compat/query');
|
4735 |
+
|
4736 |
+
options.dataAdapter = Utils.Decorate(
|
4737 |
+
options.dataAdapter,
|
4738 |
+
Query
|
4739 |
+
);
|
4740 |
+
}
|
4741 |
+
|
4742 |
+
if (options.initSelection != null) {
|
4743 |
+
var InitSelection = require(options.amdBase + 'compat/initSelection');
|
4744 |
+
|
4745 |
+
options.dataAdapter = Utils.Decorate(
|
4746 |
+
options.dataAdapter,
|
4747 |
+
InitSelection
|
4748 |
+
);
|
4749 |
+
}
|
4750 |
+
}
|
4751 |
+
|
4752 |
+
if (options.resultsAdapter == null) {
|
4753 |
+
options.resultsAdapter = ResultsList;
|
4754 |
+
|
4755 |
+
if (options.ajax != null) {
|
4756 |
+
options.resultsAdapter = Utils.Decorate(
|
4757 |
+
options.resultsAdapter,
|
4758 |
+
InfiniteScroll
|
4759 |
+
);
|
4760 |
+
}
|
4761 |
+
|
4762 |
+
if (options.placeholder != null) {
|
4763 |
+
options.resultsAdapter = Utils.Decorate(
|
4764 |
+
options.resultsAdapter,
|
4765 |
+
HidePlaceholder
|
4766 |
+
);
|
4767 |
+
}
|
4768 |
+
|
4769 |
+
if (options.selectOnClose) {
|
4770 |
+
options.resultsAdapter = Utils.Decorate(
|
4771 |
+
options.resultsAdapter,
|
4772 |
+
SelectOnClose
|
4773 |
+
);
|
4774 |
+
}
|
4775 |
+
}
|
4776 |
+
|
4777 |
+
if (options.dropdownAdapter == null) {
|
4778 |
+
if (options.multiple) {
|
4779 |
+
options.dropdownAdapter = Dropdown;
|
4780 |
+
} else {
|
4781 |
+
var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch);
|
4782 |
+
|
4783 |
+
options.dropdownAdapter = SearchableDropdown;
|
4784 |
+
}
|
4785 |
+
|
4786 |
+
if (options.minimumResultsForSearch !== 0) {
|
4787 |
+
options.dropdownAdapter = Utils.Decorate(
|
4788 |
+
options.dropdownAdapter,
|
4789 |
+
MinimumResultsForSearch
|
4790 |
+
);
|
4791 |
+
}
|
4792 |
+
|
4793 |
+
if (options.closeOnSelect) {
|
4794 |
+
options.dropdownAdapter = Utils.Decorate(
|
4795 |
+
options.dropdownAdapter,
|
4796 |
+
CloseOnSelect
|
4797 |
+
);
|
4798 |
+
}
|
4799 |
+
|
4800 |
+
if (
|
4801 |
+
options.dropdownCssClass != null ||
|
4802 |
+
options.dropdownCss != null ||
|
4803 |
+
options.adaptDropdownCssClass != null
|
4804 |
+
) {
|
4805 |
+
var DropdownCSS = require(options.amdBase + 'compat/dropdownCss');
|
4806 |
+
|
4807 |
+
options.dropdownAdapter = Utils.Decorate(
|
4808 |
+
options.dropdownAdapter,
|
4809 |
+
DropdownCSS
|
4810 |
+
);
|
4811 |
+
}
|
4812 |
+
|
4813 |
+
options.dropdownAdapter = Utils.Decorate(
|
4814 |
+
options.dropdownAdapter,
|
4815 |
+
AttachBody
|
4816 |
+
);
|
4817 |
+
}
|
4818 |
+
|
4819 |
+
if (options.selectionAdapter == null) {
|
4820 |
+
if (options.multiple) {
|
4821 |
+
options.selectionAdapter = MultipleSelection;
|
4822 |
+
} else {
|
4823 |
+
options.selectionAdapter = SingleSelection;
|
4824 |
+
}
|
4825 |
+
|
4826 |
+
// Add the placeholder mixin if a placeholder was specified
|
4827 |
+
if (options.placeholder != null) {
|
4828 |
+
options.selectionAdapter = Utils.Decorate(
|
4829 |
+
options.selectionAdapter,
|
4830 |
+
Placeholder
|
4831 |
+
);
|
4832 |
+
}
|
4833 |
+
|
4834 |
+
if (options.allowClear) {
|
4835 |
+
options.selectionAdapter = Utils.Decorate(
|
4836 |
+
options.selectionAdapter,
|
4837 |
+
AllowClear
|
4838 |
+
);
|
4839 |
+
}
|
4840 |
+
|
4841 |
+
if (options.multiple) {
|
4842 |
+
options.selectionAdapter = Utils.Decorate(
|
4843 |
+
options.selectionAdapter,
|
4844 |
+
SelectionSearch
|
4845 |
+
);
|
4846 |
+
}
|
4847 |
+
|
4848 |
+
if (
|
4849 |
+
options.containerCssClass != null ||
|
4850 |
+
options.containerCss != null ||
|
4851 |
+
options.adaptContainerCssClass != null
|
4852 |
+
) {
|
4853 |
+
var ContainerCSS = require(options.amdBase + 'compat/containerCss');
|
4854 |
+
|
4855 |
+
options.selectionAdapter = Utils.Decorate(
|
4856 |
+
options.selectionAdapter,
|
4857 |
+
ContainerCSS
|
4858 |
+
);
|
4859 |
+
}
|
4860 |
+
|
4861 |
+
options.selectionAdapter = Utils.Decorate(
|
4862 |
+
options.selectionAdapter,
|
4863 |
+
EventRelay
|
4864 |
+
);
|
4865 |
+
}
|
4866 |
+
|
4867 |
+
if (typeof options.language === 'string') {
|
4868 |
+
// Check if the language is specified with a region
|
4869 |
+
if (options.language.indexOf('-') > 0) {
|
4870 |
+
// Extract the region information if it is included
|
4871 |
+
var languageParts = options.language.split('-');
|
4872 |
+
var baseLanguage = languageParts[0];
|
4873 |
+
|
4874 |
+
options.language = [options.language, baseLanguage];
|
4875 |
+
} else {
|
4876 |
+
options.language = [options.language];
|
4877 |
+
}
|
4878 |
+
}
|
4879 |
+
|
4880 |
+
if ($.isArray(options.language)) {
|
4881 |
+
var languages = new Translation();
|
4882 |
+
options.language.push('en');
|
4883 |
+
|
4884 |
+
var languageNames = options.language;
|
4885 |
+
|
4886 |
+
for (var l = 0; l < languageNames.length; l++) {
|
4887 |
+
var name = languageNames[l];
|
4888 |
+
var language = {};
|
4889 |
+
|
4890 |
+
try {
|
4891 |
+
// Try to load it with the original name
|
4892 |
+
language = Translation.loadPath(name);
|
4893 |
+
} catch (e) {
|
4894 |
+
try {
|
4895 |
+
// If we couldn't load it, check if it wasn't the full path
|
4896 |
+
name = this.defaults.amdLanguageBase + name;
|
4897 |
+
language = Translation.loadPath(name);
|
4898 |
+
} catch (ex) {
|
4899 |
+
// The translation could not be loaded at all. Sometimes this is
|
4900 |
+
// because of a configuration problem, other times this can be
|
4901 |
+
// because of how Select2 helps load all possible translation files.
|
4902 |
+
if (options.debug && window.console && console.warn) {
|
4903 |
+
console.warn(
|
4904 |
+
'Select2: The language file for "' + name + '" could not be ' +
|
4905 |
+
'automatically loaded. A fallback will be used instead.'
|
4906 |
+
);
|
4907 |
+
}
|
4908 |
+
|
4909 |
+
continue;
|
4910 |
+
}
|
4911 |
+
}
|
4912 |
+
|
4913 |
+
languages.extend(language);
|
4914 |
+
}
|
4915 |
+
|
4916 |
+
options.translations = languages;
|
4917 |
+
} else {
|
4918 |
+
var baseTranslation = Translation.loadPath(
|
4919 |
+
this.defaults.amdLanguageBase + 'en'
|
4920 |
+
);
|
4921 |
+
var customTranslation = new Translation(options.language);
|
4922 |
+
|
4923 |
+
customTranslation.extend(baseTranslation);
|
4924 |
+
|
4925 |
+
options.translations = customTranslation;
|
4926 |
+
}
|
4927 |
+
|
4928 |
+
return options;
|
4929 |
+
};
|
4930 |
+
|
4931 |
+
Defaults.prototype.reset = function () {
|
4932 |
+
function stripDiacritics (text) {
|
4933 |
+
// Used 'uni range + named function' from http://jsperf.com/diacritics/18
|
4934 |
+
function match(a) {
|
4935 |
+
return DIACRITICS[a] || a;
|
4936 |
+
}
|
4937 |
+
|
4938 |
+
return text.replace(/[^\u0000-\u007E]/g, match);
|
4939 |
+
}
|
4940 |
+
|
4941 |
+
function matcher (params, data) {
|
4942 |
+
// Always return the object if there is nothing to compare
|
4943 |
+
if ($.trim(params.term) === '') {
|
4944 |
+
return data;
|
4945 |
+
}
|
4946 |
+
|
4947 |
+
// Do a recursive check for options with children
|
4948 |
+
if (data.children && data.children.length > 0) {
|
4949 |
+
// Clone the data object if there are children
|
4950 |
+
// This is required as we modify the object to remove any non-matches
|
4951 |
+
var match = $.extend(true, {}, data);
|
4952 |
+
|
4953 |
+
// Check each child of the option
|
4954 |
+
for (var c = data.children.length - 1; c >= 0; c--) {
|
4955 |
+
var child = data.children[c];
|
4956 |
+
|
4957 |
+
var matches = matcher(params, child);
|
4958 |
+
|
4959 |
+
// If there wasn't a match, remove the object in the array
|
4960 |
+
if (matches == null) {
|
4961 |
+
match.children.splice(c, 1);
|
4962 |
+
}
|
4963 |
+
}
|
4964 |
+
|
4965 |
+
// If any children matched, return the new object
|
4966 |
+
if (match.children.length > 0) {
|
4967 |
+
return match;
|
4968 |
+
}
|
4969 |
+
|
4970 |
+
// If there were no matching children, check just the plain object
|
4971 |
+
return matcher(params, match);
|
4972 |
+
}
|
4973 |
+
|
4974 |
+
var original = stripDiacritics(data.text).toUpperCase();
|
4975 |
+
var term = stripDiacritics(params.term).toUpperCase();
|
4976 |
+
|
4977 |
+
// Check if the text contains the term
|
4978 |
+
if (original.indexOf(term) > -1) {
|
4979 |
+
return data;
|
4980 |
+
}
|
4981 |
+
|
4982 |
+
// If it doesn't contain the term, don't return anything
|
4983 |
+
return null;
|
4984 |
+
}
|
4985 |
+
|
4986 |
+
this.defaults = {
|
4987 |
+
amdBase: './',
|
4988 |
+
amdLanguageBase: './i18n/',
|
4989 |
+
closeOnSelect: true,
|
4990 |
+
debug: false,
|
4991 |
+
dropdownAutoWidth: false,
|
4992 |
+
escapeMarkup: Utils.escapeMarkup,
|
4993 |
+
language: EnglishTranslation,
|
4994 |
+
matcher: matcher,
|
4995 |
+
minimumInputLength: 0,
|
4996 |
+
maximumInputLength: 0,
|
4997 |
+
maximumSelectionLength: 0,
|
4998 |
+
minimumResultsForSearch: 0,
|
4999 |
+
selectOnClose: false,
|
5000 |
+
sorter: function (data) {
|
5001 |
+
return data;
|
5002 |
+
},
|
5003 |
+
templateResult: function (result) {
|
5004 |
+
return result.text;
|
5005 |
+
},
|
5006 |
+
templateSelection: function (selection) {
|
5007 |
+
return selection.text;
|
5008 |
+
},
|
5009 |
+
theme: 'default',
|
5010 |
+
width: 'resolve'
|
5011 |
+
};
|
5012 |
+
};
|
5013 |
+
|
5014 |
+
Defaults.prototype.set = function (key, value) {
|
5015 |
+
var camelKey = $.camelCase(key);
|
5016 |
+
|
5017 |
+
var data = {};
|
5018 |
+
data[camelKey] = value;
|
5019 |
+
|
5020 |
+
var convertedData = Utils._convertData(data);
|
5021 |
+
|
5022 |
+
$.extend(this.defaults, convertedData);
|
5023 |
+
};
|
5024 |
+
|
5025 |
+
var defaults = new Defaults();
|
5026 |
+
|
5027 |
+
return defaults;
|
5028 |
+
});
|
5029 |
+
|
5030 |
+
S2.define('select2/options',[
|
5031 |
+
'require',
|
5032 |
+
'jquery',
|
5033 |
+
'./defaults',
|
5034 |
+
'./utils'
|
5035 |
+
], function (require, $, Defaults, Utils) {
|
5036 |
+
function Options (options, $element) {
|
5037 |
+
this.options = options;
|
5038 |
+
|
5039 |
+
if ($element != null) {
|
5040 |
+
this.fromElement($element);
|
5041 |
+
}
|
5042 |
+
|
5043 |
+
this.options = Defaults.apply(this.options);
|
5044 |
+
|
5045 |
+
if ($element && $element.is('input')) {
|
5046 |
+
var InputCompat = require(this.get('amdBase') + 'compat/inputData');
|
5047 |
+
|
5048 |
+
this.options.dataAdapter = Utils.Decorate(
|
5049 |
+
this.options.dataAdapter,
|
5050 |
+
InputCompat
|
5051 |
+
);
|
5052 |
+
}
|
5053 |
+
}
|
5054 |
+
|
5055 |
+
Options.prototype.fromElement = function ($e) {
|
5056 |
+
var excludedData = ['select2'];
|
5057 |
+
|
5058 |
+
if (this.options.multiple == null) {
|
5059 |
+
this.options.multiple = $e.prop('multiple');
|
5060 |
+
}
|
5061 |
+
|
5062 |
+
if (this.options.disabled == null) {
|
5063 |
+
this.options.disabled = $e.prop('disabled');
|
5064 |
+
}
|
5065 |
+
|
5066 |
+
if (this.options.language == null) {
|
5067 |
+
if ($e.prop('lang')) {
|
5068 |
+
this.options.language = $e.prop('lang').toLowerCase();
|
5069 |
+
} else if ($e.closest('[lang]').prop('lang')) {
|
5070 |
+
this.options.language = $e.closest('[lang]').prop('lang');
|
5071 |
+
}
|
5072 |
+
}
|
5073 |
+
|
5074 |
+
if (this.options.dir == null) {
|
5075 |
+
if ($e.prop('dir')) {
|
5076 |
+
this.options.dir = $e.prop('dir');
|
5077 |
+
} else if ($e.closest('[dir]').prop('dir')) {
|
5078 |
+
this.options.dir = $e.closest('[dir]').prop('dir');
|
5079 |
+
} else {
|
5080 |
+
this.options.dir = 'ltr';
|
5081 |
+
}
|
5082 |
+
}
|
5083 |
+
|
5084 |
+
$e.prop('disabled', this.options.disabled);
|
5085 |
+
$e.prop('multiple', this.options.multiple);
|
5086 |
+
|
5087 |
+
if ($e.data('select2Tags')) {
|
5088 |
+
if (this.options.debug && window.console && console.warn) {
|
5089 |
+
console.warn(
|
5090 |
+
'Select2: The `data-select2-tags` attribute has been changed to ' +
|
5091 |
+
'use the `data-data` and `data-tags="true"` attributes and will be ' +
|
5092 |
+
'removed in future versions of Select2.'
|
5093 |
+
);
|
5094 |
+
}
|
5095 |
+
|
5096 |
+
$e.data('data', $e.data('select2Tags'));
|
5097 |
+
$e.data('tags', true);
|
5098 |
+
}
|
5099 |
+
|
5100 |
+
if ($e.data('ajaxUrl')) {
|
5101 |
+
if (this.options.debug && window.console && console.warn) {
|
5102 |
+
console.warn(
|
5103 |
+
'Select2: The `data-ajax-url` attribute has been changed to ' +
|
5104 |
+
'`data-ajax--url` and support for the old attribute will be removed' +
|
5105 |
+
' in future versions of Select2.'
|
5106 |
+
);
|
5107 |
+
}
|
5108 |
+
|
5109 |
+
$e.attr('ajax--url', $e.data('ajaxUrl'));
|
5110 |
+
$e.data('ajax--url', $e.data('ajaxUrl'));
|
5111 |
+
}
|
5112 |
+
|
5113 |
+
var dataset = {};
|
5114 |
+
|
5115 |
+
// Prefer the element's `dataset` attribute if it exists
|
5116 |
+
// jQuery 1.x does not correctly handle data attributes with multiple dashes
|
5117 |
+
if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) {
|
5118 |
+
dataset = $.extend(true, {}, $e[0].dataset, $e.data());
|
5119 |
+
} else {
|
5120 |
+
dataset = $e.data();
|
5121 |
+
}
|
5122 |
+
|
5123 |
+
var data = $.extend(true, {}, dataset);
|
5124 |
+
|
5125 |
+
data = Utils._convertData(data);
|
5126 |
+
|
5127 |
+
for (var key in data) {
|
5128 |
+
if ($.inArray(key, excludedData) > -1) {
|
5129 |
+
continue;
|
5130 |
+
}
|
5131 |
+
|
5132 |
+
if ($.isPlainObject(this.options[key])) {
|
5133 |
+
$.extend(this.options[key], data[key]);
|
5134 |
+
} else {
|
5135 |
+
this.options[key] = data[key];
|
5136 |
+
}
|
5137 |
+
}
|
5138 |
+
|
5139 |
+
return this;
|
5140 |
+
};
|
5141 |
+
|
5142 |
+
Options.prototype.get = function (key) {
|
5143 |
+
return this.options[key];
|
5144 |
+
};
|
5145 |
+
|
5146 |
+
Options.prototype.set = function (key, val) {
|
5147 |
+
this.options[key] = val;
|
5148 |
+
};
|
5149 |
+
|
5150 |
+
return Options;
|
5151 |
+
});
|
5152 |
+
|
5153 |
+
S2.define('select2/core',[
|
5154 |
+
'jquery',
|
5155 |
+
'./options',
|
5156 |
+
'./utils',
|
5157 |
+
'./keys'
|
5158 |
+
], function ($, Options, Utils, KEYS) {
|
5159 |
+
var Select2 = function ($element, options) {
|
5160 |
+
if ($element.data('select2') != null) {
|
5161 |
+
$element.data('select2').destroy();
|
5162 |
+
}
|
5163 |
+
|
5164 |
+
this.$element = $element;
|
5165 |
+
|
5166 |
+
this.id = this._generateId($element);
|
5167 |
+
|
5168 |
+
options = options || {};
|
5169 |
+
|
5170 |
+
this.options = new Options(options, $element);
|
5171 |
+
|
5172 |
+
Select2.__super__.constructor.call(this);
|
5173 |
+
|
5174 |
+
// Set up the tabindex
|
5175 |
+
|
5176 |
+
var tabindex = $element.attr('tabindex') || 0;
|
5177 |
+
$element.data('old-tabindex', tabindex);
|
5178 |
+
$element.attr('tabindex', '-1');
|
5179 |
+
|
5180 |
+
// Set up containers and adapters
|
5181 |
+
|
5182 |
+
var DataAdapter = this.options.get('dataAdapter');
|
5183 |
+
this.dataAdapter = new DataAdapter($element, this.options);
|
5184 |
+
|
5185 |
+
var $container = this.render();
|
5186 |
+
|
5187 |
+
this._placeContainer($container);
|
5188 |
+
|
5189 |
+
var SelectionAdapter = this.options.get('selectionAdapter');
|
5190 |
+
this.selection = new SelectionAdapter($element, this.options);
|
5191 |
+
this.$selection = this.selection.render();
|
5192 |
+
|
5193 |
+
this.selection.position(this.$selection, $container);
|
5194 |
+
|
5195 |
+
var DropdownAdapter = this.options.get('dropdownAdapter');
|
5196 |
+
this.dropdown = new DropdownAdapter($element, this.options);
|
5197 |
+
this.$dropdown = this.dropdown.render();
|
5198 |
+
|
5199 |
+
this.dropdown.position(this.$dropdown, $container);
|
5200 |
+
|
5201 |
+
var ResultsAdapter = this.options.get('resultsAdapter');
|
5202 |
+
this.results = new ResultsAdapter($element, this.options, this.dataAdapter);
|
5203 |
+
this.$results = this.results.render();
|
5204 |
+
|
5205 |
+
this.results.position(this.$results, this.$dropdown);
|
5206 |
+
|
5207 |
+
// Bind events
|
5208 |
+
|
5209 |
+
var self = this;
|
5210 |
+
|
5211 |
+
// Bind the container to all of the adapters
|
5212 |
+
this._bindAdapters();
|
5213 |
+
|
5214 |
+
// Register any DOM event handlers
|
5215 |
+
this._registerDomEvents();
|
5216 |
+
|
5217 |
+
// Register any internal event handlers
|
5218 |
+
this._registerDataEvents();
|
5219 |
+
this._registerSelectionEvents();
|
5220 |
+
this._registerDropdownEvents();
|
5221 |
+
this._registerResultsEvents();
|
5222 |
+
this._registerEvents();
|
5223 |
+
|
5224 |
+
// Set the initial state
|
5225 |
+
this.dataAdapter.current(function (initialData) {
|
5226 |
+
self.trigger('selection:update', {
|
5227 |
+
data: initialData
|
5228 |
+
});
|
5229 |
+
});
|
5230 |
+
|
5231 |
+
// Hide the original select
|
5232 |
+
$element.addClass('select2-hidden-accessible');
|
5233 |
+
$element.attr('aria-hidden', 'true');
|
5234 |
+
|
5235 |
+
// Synchronize any monitored attributes
|
5236 |
+
this._syncAttributes();
|
5237 |
+
|
5238 |
+
$element.data('select2', this);
|
5239 |
+
};
|
5240 |
+
|
5241 |
+
Utils.Extend(Select2, Utils.Observable);
|
5242 |
+
|
5243 |
+
Select2.prototype._generateId = function ($element) {
|
5244 |
+
var id = '';
|
5245 |
+
|
5246 |
+
if ($element.attr('id') != null) {
|
5247 |
+
id = $element.attr('id');
|
5248 |
+
} else if ($element.attr('name') != null) {
|
5249 |
+
id = $element.attr('name') + '-' + Utils.generateChars(2);
|
5250 |
+
} else {
|
5251 |
+
id = Utils.generateChars(4);
|
5252 |
+
}
|
5253 |
+
|
5254 |
+
id = id.replace(/(:|\.|\[|\]|,)/g, '');
|
5255 |
+
id = 'select2-' + id;
|
5256 |
+
|
5257 |
+
return id;
|
5258 |
+
};
|
5259 |
+
|
5260 |
+
Select2.prototype._placeContainer = function ($container) {
|
5261 |
+
$container.insertAfter(this.$element);
|
5262 |
+
|
5263 |
+
var width = this._resolveWidth(this.$element, this.options.get('width'));
|
5264 |
+
|
5265 |
+
if (width != null) {
|
5266 |
+
$container.css('width', width);
|
5267 |
+
}
|
5268 |
+
};
|
5269 |
+
|
5270 |
+
Select2.prototype._resolveWidth = function ($element, method) {
|
5271 |
+
var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;
|
5272 |
+
|
5273 |
+
if (method == 'resolve') {
|
5274 |
+
var styleWidth = this._resolveWidth($element, 'style');
|
5275 |
+
|
5276 |
+
if (styleWidth != null) {
|
5277 |
+
return styleWidth;
|
5278 |
+
}
|
5279 |
+
|
5280 |
+
return this._resolveWidth($element, 'element');
|
5281 |
+
}
|
5282 |
+
|
5283 |
+
if (method == 'element') {
|
5284 |
+
var elementWidth = $element.outerWidth(false);
|
5285 |
+
|
5286 |
+
if (elementWidth <= 0) {
|
5287 |
+
return 'auto';
|
5288 |
+
}
|
5289 |
+
|
5290 |
+
return elementWidth + 'px';
|
5291 |
+
}
|
5292 |
+
|
5293 |
+
if (method == 'style') {
|
5294 |
+
var style = $element.attr('style');
|
5295 |
+
|
5296 |
+
if (typeof(style) !== 'string') {
|
5297 |
+
return null;
|
5298 |
+
}
|
5299 |
+
|
5300 |
+
var attrs = style.split(';');
|
5301 |
+
|
5302 |
+
for (var i = 0, l = attrs.length; i < l; i = i + 1) {
|
5303 |
+
var attr = attrs[i].replace(/\s/g, '');
|
5304 |
+
var matches = attr.match(WIDTH);
|
5305 |
+
|
5306 |
+
if (matches !== null && matches.length >= 1) {
|
5307 |
+
return matches[1];
|
5308 |
+
}
|
5309 |
+
}
|
5310 |
+
|
5311 |
+
return null;
|
5312 |
+
}
|
5313 |
+
|
5314 |
+
return method;
|
5315 |
+
};
|
5316 |
+
|
5317 |
+
Select2.prototype._bindAdapters = function () {
|
5318 |
+
this.dataAdapter.bind(this, this.$container);
|
5319 |
+
this.selection.bind(this, this.$container);
|
5320 |
+
|
5321 |
+
this.dropdown.bind(this, this.$container);
|
5322 |
+
this.results.bind(this, this.$container);
|
5323 |
+
};
|
5324 |
+
|
5325 |
+
Select2.prototype._registerDomEvents = function () {
|
5326 |
+
var self = this;
|
5327 |
+
|
5328 |
+
this.$element.on('change.select2', function () {
|
5329 |
+
self.dataAdapter.current(function (data) {
|
5330 |
+
self.trigger('selection:update', {
|
5331 |
+
data: data
|
5332 |
+
});
|
5333 |
+
});
|
5334 |
+
});
|
5335 |
+
|
5336 |
+
this.$element.on('focus.select2', function (evt) {
|
5337 |
+
self.trigger('focus', evt);
|
5338 |
+
});
|
5339 |
+
|
5340 |
+
this._syncA = Utils.bind(this._syncAttributes, this);
|
5341 |
+
this._syncS = Utils.bind(this._syncSubtree, this);
|
5342 |
+
|
5343 |
+
if (this.$element[0].attachEvent) {
|
5344 |
+
this.$element[0].attachEvent('onpropertychange', this._syncA);
|
5345 |
+
}
|
5346 |
+
|
5347 |
+
var observer = window.MutationObserver ||
|
5348 |
+
window.WebKitMutationObserver ||
|
5349 |
+
window.MozMutationObserver
|
5350 |
+
;
|
5351 |
+
|
5352 |
+
if (observer != null) {
|
5353 |
+
this._observer = new observer(function (mutations) {
|
5354 |
+
$.each(mutations, self._syncA);
|
5355 |
+
$.each(mutations, self._syncS);
|
5356 |
+
});
|
5357 |
+
this._observer.observe(this.$element[0], {
|
5358 |
+
attributes: true,
|
5359 |
+
childList: true,
|
5360 |
+
subtree: false
|
5361 |
+
});
|
5362 |
+
} else if (this.$element[0].addEventListener) {
|
5363 |
+
this.$element[0].addEventListener(
|
5364 |
+
'DOMAttrModified',
|
5365 |
+
self._syncA,
|
5366 |
+
false
|
5367 |
+
);
|
5368 |
+
this.$element[0].addEventListener(
|
5369 |
+
'DOMNodeInserted',
|
5370 |
+
self._syncS,
|
5371 |
+
false
|
5372 |
+
);
|
5373 |
+
this.$element[0].addEventListener(
|
5374 |
+
'DOMNodeRemoved',
|
5375 |
+
self._syncS,
|
5376 |
+
false
|
5377 |
+
);
|
5378 |
+
}
|
5379 |
+
};
|
5380 |
+
|
5381 |
+
Select2.prototype._registerDataEvents = function () {
|
5382 |
+
var self = this;
|
5383 |
+
|
5384 |
+
this.dataAdapter.on('*', function (name, params) {
|
5385 |
+
self.trigger(name, params);
|
5386 |
+
});
|
5387 |
+
};
|
5388 |
+
|
5389 |
+
Select2.prototype._registerSelectionEvents = function () {
|
5390 |
+
var self = this;
|
5391 |
+
var nonRelayEvents = ['toggle', 'focus'];
|
5392 |
+
|
5393 |
+
this.selection.on('toggle', function () {
|
5394 |
+
self.toggleDropdown();
|
5395 |
+
});
|
5396 |
+
|
5397 |
+
this.selection.on('focus', function (params) {
|
5398 |
+
self.focus(params);
|
5399 |
+
});
|
5400 |
+
|
5401 |
+
this.selection.on('*', function (name, params) {
|
5402 |
+
if ($.inArray(name, nonRelayEvents) !== -1) {
|
5403 |
+
return;
|
5404 |
+
}
|
5405 |
+
|
5406 |
+
self.trigger(name, params);
|
5407 |
+
});
|
5408 |
+
};
|
5409 |
+
|
5410 |
+
Select2.prototype._registerDropdownEvents = function () {
|
5411 |
+
var self = this;
|
5412 |
+
|
5413 |
+
this.dropdown.on('*', function (name, params) {
|
5414 |
+
self.trigger(name, params);
|
5415 |
+
});
|
5416 |
+
};
|
5417 |
+
|
5418 |
+
Select2.prototype._registerResultsEvents = function () {
|
5419 |
+
var self = this;
|
5420 |
+
|
5421 |
+
this.results.on('*', function (name, params) {
|
5422 |
+
self.trigger(name, params);
|
5423 |
+
});
|
5424 |
+
};
|
5425 |
+
|
5426 |
+
Select2.prototype._registerEvents = function () {
|
5427 |
+
var self = this;
|
5428 |
+
|
5429 |
+
this.on('open', function () {
|
5430 |
+
self.$container.addClass('select2-container--open');
|
5431 |
+
});
|
5432 |
+
|
5433 |
+
this.on('close', function () {
|
5434 |
+
self.$container.removeClass('select2-container--open');
|
5435 |
+
});
|
5436 |
+
|
5437 |
+
this.on('enable', function () {
|
5438 |
+
self.$container.removeClass('select2-container--disabled');
|
5439 |
+
});
|
5440 |
+
|
5441 |
+
this.on('disable', function () {
|
5442 |
+
self.$container.addClass('select2-container--disabled');
|
5443 |
+
});
|
5444 |
+
|
5445 |
+
this.on('blur', function () {
|
5446 |
+
self.$container.removeClass('select2-container--focus');
|
5447 |
+
});
|
5448 |
+
|
5449 |
+
this.on('query', function (params) {
|
5450 |
+
if (!self.isOpen()) {
|
5451 |
+
self.trigger('open', {});
|
5452 |
+
}
|
5453 |
+
|
5454 |
+
this.dataAdapter.query(params, function (data) {
|
5455 |
+
self.trigger('results:all', {
|
5456 |
+
data: data,
|
5457 |
+
query: params
|
5458 |
+
});
|
5459 |
+
});
|
5460 |
+
});
|
5461 |
+
|
5462 |
+
this.on('query:append', function (params) {
|
5463 |
+
this.dataAdapter.query(params, function (data) {
|
5464 |
+
self.trigger('results:append', {
|
5465 |
+
data: data,
|
5466 |
+
query: params
|
5467 |
+
});
|
5468 |
+
});
|
5469 |
+
});
|
5470 |
+
|
5471 |
+
this.on('open', function(){
|
5472 |
+
// Focus on the active element when opening dropdown.
|
5473 |
+
// Needs 1 ms delay because of other 1 ms setTimeouts when rendering.
|
5474 |
+
setTimeout(function(){
|
5475 |
+
self.focusOnActiveElement();
|
5476 |
+
}, 1);
|
5477 |
+
});
|
5478 |
+
|
5479 |
+
$(document).on('keydown', function (evt) {
|
5480 |
+
var key = evt.which;
|
5481 |
+
if (self.isOpen()) {
|
5482 |
+
if (key === KEYS.ESC || (key === KEYS.UP && evt.altKey)) {
|
5483 |
+
self.close();
|
5484 |
+
|
5485 |
+
evt.preventDefault();
|
5486 |
+
} else if (key === KEYS.ENTER || key === KEYS.TAB) {
|
5487 |
+
self.trigger('results:select', {});
|
5488 |
+
|
5489 |
+
evt.preventDefault();
|
5490 |
+
} else if ((key === KEYS.SPACE && evt.ctrlKey)) {
|
5491 |
+
self.trigger('results:toggle', {});
|
5492 |
+
|
5493 |
+
evt.preventDefault();
|
5494 |
+
} else if (key === KEYS.UP) {
|
5495 |
+
self.trigger('results:previous', {});
|
5496 |
+
|
5497 |
+
evt.preventDefault();
|
5498 |
+
} else if (key === KEYS.DOWN) {
|
5499 |
+
self.trigger('results:next', {});
|
5500 |
+
|
5501 |
+
evt.preventDefault();
|
5502 |
+
}
|
5503 |
+
|
5504 |
+
var $searchField = self.$dropdown.find('.select2-search__field');
|
5505 |
+
if (! $searchField.length) {
|
5506 |
+
$searchField = self.$container.find('.select2-search__field');
|
5507 |
+
}
|
5508 |
+
|
5509 |
+
// Move the focus to the selected element on keyboard navigation.
|
5510 |
+
// Required for screen readers to work properly.
|
5511 |
+
if (key === KEYS.DOWN || key === KEYS.UP) {
|
5512 |
+
self.focusOnActiveElement();
|
5513 |
+
} else {
|
5514 |
+
// Focus on the search if user starts typing.
|
5515 |
+
$searchField.focus();
|
5516 |
+
// Focus back to active selection when finished typing.
|
5517 |
+
// Small delay so typed character can be read by screen reader.
|
5518 |
+
setTimeout(function(){
|
5519 |
+
self.focusOnActiveElement();
|
5520 |
+
}, 1000);
|
5521 |
+
}
|
5522 |
+
} else if (self.hasFocus()) {
|
5523 |
+
if (key === KEYS.ENTER || key === KEYS.SPACE ||
|
5524 |
+
key === KEYS.DOWN) {
|
5525 |
+
self.open();
|
5526 |
+
evt.preventDefault();
|
5527 |
+
}
|
5528 |
+
}
|
5529 |
+
});
|
5530 |
+
};
|
5531 |
+
|
5532 |
+
Select2.prototype.focusOnActiveElement = function () {
|
5533 |
+
// Don't mess with the focus on touchscreens because it causes havoc with on-screen keyboards.
|
5534 |
+
if (this.isOpen() && ! Utils.isTouchscreen()) {
|
5535 |
+
this.$results.find('li.select2-results__option--highlighted').focus();
|
5536 |
+
}
|
5537 |
+
};
|
5538 |
+
|
5539 |
+
Select2.prototype._syncAttributes = function () {
|
5540 |
+
this.options.set('disabled', this.$element.prop('disabled'));
|
5541 |
+
|
5542 |
+
if (this.options.get('disabled')) {
|
5543 |
+
if (this.isOpen()) {
|
5544 |
+
this.close();
|
5545 |
+
}
|
5546 |
+
|
5547 |
+
this.trigger('disable', {});
|
5548 |
+
} else {
|
5549 |
+
this.trigger('enable', {});
|
5550 |
+
}
|
5551 |
+
};
|
5552 |
+
|
5553 |
+
Select2.prototype._syncSubtree = function (evt, mutations) {
|
5554 |
+
var changed = false;
|
5555 |
+
var self = this;
|
5556 |
+
|
5557 |
+
// Ignore any mutation events raised for elements that aren't options or
|
5558 |
+
// optgroups. This handles the case when the select element is destroyed
|
5559 |
+
if (
|
5560 |
+
evt && evt.target && (
|
5561 |
+
evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP'
|
5562 |
+
)
|
5563 |
+
) {
|
5564 |
+
return;
|
5565 |
+
}
|
5566 |
+
|
5567 |
+
if (!mutations) {
|
5568 |
+
// If mutation events aren't supported, then we can only assume that the
|
5569 |
+
// change affected the selections
|
5570 |
+
changed = true;
|
5571 |
+
} else if (mutations.addedNodes && mutations.addedNodes.length > 0) {
|
5572 |
+
for (var n = 0; n < mutations.addedNodes.length; n++) {
|
5573 |
+
var node = mutations.addedNodes[n];
|
5574 |
+
|
5575 |
+
if (node.selected) {
|
5576 |
+
changed = true;
|
5577 |
+
}
|
5578 |
+
}
|
5579 |
+
} else if (mutations.removedNodes && mutations.removedNodes.length > 0) {
|
5580 |
+
changed = true;
|
5581 |
+
}
|
5582 |
+
|
5583 |
+
// Only re-pull the data if we think there is a change
|
5584 |
+
if (changed) {
|
5585 |
+
this.dataAdapter.current(function (currentData) {
|
5586 |
+
self.trigger('selection:update', {
|
5587 |
+
data: currentData
|
5588 |
+
});
|
5589 |
+
});
|
5590 |
+
}
|
5591 |
+
};
|
5592 |
+
|
5593 |
+
/**
|
5594 |
+
* Override the trigger method to automatically trigger pre-events when
|
5595 |
+
* there are events that can be prevented.
|
5596 |
+
*/
|
5597 |
+
Select2.prototype.trigger = function (name, args) {
|
5598 |
+
var actualTrigger = Select2.__super__.trigger;
|
5599 |
+
var preTriggerMap = {
|
5600 |
+
'open': 'opening',
|
5601 |
+
'close': 'closing',
|
5602 |
+
'select': 'selecting',
|
5603 |
+
'unselect': 'unselecting'
|
5604 |
+
};
|
5605 |
+
|
5606 |
+
if (args === undefined) {
|
5607 |
+
args = {};
|
5608 |
+
}
|
5609 |
+
|
5610 |
+
if (name in preTriggerMap) {
|
5611 |
+
var preTriggerName = preTriggerMap[name];
|
5612 |
+
var preTriggerArgs = {
|
5613 |
+
prevented: false,
|
5614 |
+
name: name,
|
5615 |
+
args: args
|
5616 |
+
};
|
5617 |
+
|
5618 |
+
actualTrigger.call(this, preTriggerName, preTriggerArgs);
|
5619 |
+
|
5620 |
+
if (preTriggerArgs.prevented) {
|
5621 |
+
args.prevented = true;
|
5622 |
+
|
5623 |
+
return;
|
5624 |
+
}
|
5625 |
+
}
|
5626 |
+
|
5627 |
+
actualTrigger.call(this, name, args);
|
5628 |
+
};
|
5629 |
+
|
5630 |
+
Select2.prototype.toggleDropdown = function () {
|
5631 |
+
if (this.options.get('disabled')) {
|
5632 |
+
return;
|
5633 |
+
}
|
5634 |
+
|
5635 |
+
if (this.isOpen()) {
|
5636 |
+
this.close();
|
5637 |
+
} else {
|
5638 |
+
this.open();
|
5639 |
+
}
|
5640 |
+
};
|
5641 |
+
|
5642 |
+
Select2.prototype.open = function () {
|
5643 |
+
if (this.isOpen()) {
|
5644 |
+
return;
|
5645 |
+
}
|
5646 |
+
|
5647 |
+
this.trigger('query', {});
|
5648 |
+
};
|
5649 |
+
|
5650 |
+
Select2.prototype.close = function () {
|
5651 |
+
if (!this.isOpen()) {
|
5652 |
+
return;
|
5653 |
+
}
|
5654 |
+
|
5655 |
+
this.trigger('close', {});
|
5656 |
+
};
|
5657 |
+
|
5658 |
+
Select2.prototype.isOpen = function () {
|
5659 |
+
return this.$container.hasClass('select2-container--open');
|
5660 |
+
};
|
5661 |
+
|
5662 |
+
Select2.prototype.hasFocus = function () {
|
5663 |
+
return this.$container.hasClass('select2-container--focus');
|
5664 |
+
};
|
5665 |
+
|
5666 |
+
Select2.prototype.focus = function (data) {
|
5667 |
+
// No need to re-trigger focus events if we are already focused
|
5668 |
+
if (this.hasFocus()) {
|
5669 |
+
return;
|
5670 |
+
}
|
5671 |
+
|
5672 |
+
this.$container.addClass('select2-container--focus');
|
5673 |
+
this.trigger('focus', {});
|
5674 |
+
};
|
5675 |
+
|
5676 |
+
Select2.prototype.enable = function (args) {
|
5677 |
+
if (this.options.get('debug') && window.console && console.warn) {
|
5678 |
+
console.warn(
|
5679 |
+
'Select2: The `select2("enable")` method has been deprecated and will' +
|
5680 |
+
' be removed in later Select2 versions. Use $element.prop("disabled")' +
|
5681 |
+
' instead.'
|
5682 |
+
);
|
5683 |
+
}
|
5684 |
+
|
5685 |
+
if (args == null || args.length === 0) {
|
5686 |
+
args = [true];
|
5687 |
+
}
|
5688 |
+
|
5689 |
+
var disabled = !args[0];
|
5690 |
+
|
5691 |
+
this.$element.prop('disabled', disabled);
|
5692 |
+
};
|
5693 |
+
|
5694 |
+
Select2.prototype.data = function () {
|
5695 |
+
if (this.options.get('debug') &&
|
5696 |
+
arguments.length > 0 && window.console && console.warn) {
|
5697 |
+
console.warn(
|
5698 |
+
'Select2: Data can no longer be set using `select2("data")`. You ' +
|
5699 |
+
'should consider setting the value instead using `$element.val()`.'
|
5700 |
+
);
|
5701 |
+
}
|
5702 |
+
|
5703 |
+
var data = [];
|
5704 |
+
|
5705 |
+
this.dataAdapter.current(function (currentData) {
|
5706 |
+
data = currentData;
|
5707 |
+
});
|
5708 |
+
|
5709 |
+
return data;
|
5710 |
+
};
|
5711 |
+
|
5712 |
+
Select2.prototype.val = function (args) {
|
5713 |
+
if (this.options.get('debug') && window.console && console.warn) {
|
5714 |
+
console.warn(
|
5715 |
+
'Select2: The `select2("val")` method has been deprecated and will be' +
|
5716 |
+
' removed in later Select2 versions. Use $element.val() instead.'
|
5717 |
+
);
|
5718 |
+
}
|
5719 |
+
|
5720 |
+
if (args == null || args.length === 0) {
|
5721 |
+
return this.$element.val();
|
5722 |
+
}
|
5723 |
+
|
5724 |
+
var newVal = args[0];
|
5725 |
+
|
5726 |
+
if ($.isArray(newVal)) {
|
5727 |
+
newVal = $.map(newVal, function (obj) {
|
5728 |
+
return obj.toString();
|
5729 |
+
});
|
5730 |
+
}
|
5731 |
+
|
5732 |
+
this.$element.val(newVal).trigger('change');
|
5733 |
+
};
|
5734 |
+
|
5735 |
+
Select2.prototype.destroy = function () {
|
5736 |
+
this.$container.remove();
|
5737 |
+
|
5738 |
+
if (this.$element[0].detachEvent) {
|
5739 |
+
this.$element[0].detachEvent('onpropertychange', this._syncA);
|
5740 |
+
}
|
5741 |
+
|
5742 |
+
if (this._observer != null) {
|
5743 |
+
this._observer.disconnect();
|
5744 |
+
this._observer = null;
|
5745 |
+
} else if (this.$element[0].removeEventListener) {
|
5746 |
+
this.$element[0]
|
5747 |
+
.removeEventListener('DOMAttrModified', this._syncA, false);
|
5748 |
+
this.$element[0]
|
5749 |
+
.removeEventListener('DOMNodeInserted', this._syncS, false);
|
5750 |
+
this.$element[0]
|
5751 |
+
.removeEventListener('DOMNodeRemoved', this._syncS, false);
|
5752 |
+
}
|
5753 |
+
|
5754 |
+
this._syncA = null;
|
5755 |
+
this._syncS = null;
|
5756 |
+
|
5757 |
+
this.$element.off('.select2');
|
5758 |
+
this.$element.attr('tabindex', this.$element.data('old-tabindex'));
|
5759 |
+
|
5760 |
+
this.$element.removeClass('select2-hidden-accessible');
|
5761 |
+
this.$element.attr('aria-hidden', 'false');
|
5762 |
+
this.$element.removeData('select2');
|
5763 |
+
|
5764 |
+
this.dataAdapter.destroy();
|
5765 |
+
this.selection.destroy();
|
5766 |
+
this.dropdown.destroy();
|
5767 |
+
this.results.destroy();
|
5768 |
+
|
5769 |
+
this.dataAdapter = null;
|
5770 |
+
this.selection = null;
|
5771 |
+
this.dropdown = null;
|
5772 |
+
this.results = null;
|
5773 |
+
};
|
5774 |
+
|
5775 |
+
Select2.prototype.render = function () {
|
5776 |
+
var $container = $(
|
5777 |
+
'<span class="select2 select2-container">' +
|
5778 |
+
'<span class="selection"></span>' +
|
5779 |
+
'<span class="dropdown-wrapper" aria-hidden="true"></span>' +
|
5780 |
+
'</span>'
|
5781 |
+
);
|
5782 |
+
|
5783 |
+
$container.attr('dir', this.options.get('dir'));
|
5784 |
+
|
5785 |
+
this.$container = $container;
|
5786 |
+
|
5787 |
+
this.$container.addClass('select2-container--' + this.options.get('theme'));
|
5788 |
+
|
5789 |
+
$container.data('element', this.$element);
|
5790 |
+
|
5791 |
+
return $container;
|
5792 |
+
};
|
5793 |
+
|
5794 |
+
return Select2;
|
5795 |
+
});
|
5796 |
+
|
5797 |
+
S2.define('select2/compat/utils',[
|
5798 |
+
'jquery'
|
5799 |
+
], function ($) {
|
5800 |
+
function syncCssClasses ($dest, $src, adapter) {
|
5801 |
+
var classes, replacements = [], adapted;
|
5802 |
+
|
5803 |
+
classes = $.trim($dest.attr('class'));
|
5804 |
+
|
5805 |
+
if (classes) {
|
5806 |
+
classes = '' + classes; // for IE which returns object
|
5807 |
+
|
5808 |
+
$(classes.split(/\s+/)).each(function () {
|
5809 |
+
// Save all Select2 classes
|
5810 |
+
if (this.indexOf('select2-') === 0) {
|
5811 |
+
replacements.push(this);
|
5812 |
+
}
|
5813 |
+
});
|
5814 |
+
}
|
5815 |
+
|
5816 |
+
classes = $.trim($src.attr('class'));
|
5817 |
+
|
5818 |
+
if (classes) {
|
5819 |
+
classes = '' + classes; // for IE which returns object
|
5820 |
+
|
5821 |
+
$(classes.split(/\s+/)).each(function () {
|
5822 |
+
// Only adapt non-Select2 classes
|
5823 |
+
if (this.indexOf('select2-') !== 0) {
|
5824 |
+
adapted = adapter(this);
|
5825 |
+
|
5826 |
+
if (adapted != null) {
|
5827 |
+
replacements.push(adapted);
|
5828 |
+
}
|
5829 |
+
}
|
5830 |
+
});
|
5831 |
+
}
|
5832 |
+
|
5833 |
+
$dest.attr('class', replacements.join(' '));
|
5834 |
+
}
|
5835 |
+
|
5836 |
+
return {
|
5837 |
+
syncCssClasses: syncCssClasses
|
5838 |
+
};
|
5839 |
+
});
|
5840 |
+
|
5841 |
+
S2.define('select2/compat/containerCss',[
|
5842 |
+
'jquery',
|
5843 |
+
'./utils'
|
5844 |
+
], function ($, CompatUtils) {
|
5845 |
+
// No-op CSS adapter that discards all classes by default
|
5846 |
+
function _containerAdapter (clazz) {
|
5847 |
+
return null;
|
5848 |
+
}
|
5849 |
+
|
5850 |
+
function ContainerCSS () { }
|
5851 |
+
|
5852 |
+
ContainerCSS.prototype.render = function (decorated) {
|
5853 |
+
var $container = decorated.call(this);
|
5854 |
+
|
5855 |
+
var containerCssClass = this.options.get('containerCssClass') || '';
|
5856 |
+
|
5857 |
+
if ($.isFunction(containerCssClass)) {
|
5858 |
+
containerCssClass = containerCssClass(this.$element);
|
5859 |
+
}
|
5860 |
+
|
5861 |
+
var containerCssAdapter = this.options.get('adaptContainerCssClass');
|
5862 |
+
containerCssAdapter = containerCssAdapter || _containerAdapter;
|
5863 |
+
|
5864 |
+
if (containerCssClass.indexOf(':all:') !== -1) {
|
5865 |
+
containerCssClass = containerCssClass.replace(':all:', '');
|
5866 |
+
|
5867 |
+
var _cssAdapter = containerCssAdapter;
|
5868 |
+
|
5869 |
+
containerCssAdapter = function (clazz) {
|
5870 |
+
var adapted = _cssAdapter(clazz);
|
5871 |
+
|
5872 |
+
if (adapted != null) {
|
5873 |
+
// Append the old one along with the adapted one
|
5874 |
+
return adapted + ' ' + clazz;
|
5875 |
+
}
|
5876 |
+
|
5877 |
+
return clazz;
|
5878 |
+
};
|
5879 |
+
}
|
5880 |
+
|
5881 |
+
var containerCss = this.options.get('containerCss') || {};
|
5882 |
+
|
5883 |
+
if ($.isFunction(containerCss)) {
|
5884 |
+
containerCss = containerCss(this.$element);
|
5885 |
+
}
|
5886 |
+
|
5887 |
+
CompatUtils.syncCssClasses($container, this.$element, containerCssAdapter);
|
5888 |
+
|
5889 |
+
$container.css(containerCss);
|
5890 |
+
$container.addClass(containerCssClass);
|
5891 |
+
|
5892 |
+
return $container;
|
5893 |
+
};
|
5894 |
+
|
5895 |
+
return ContainerCSS;
|
5896 |
+
});
|
5897 |
+
|
5898 |
+
S2.define('select2/compat/dropdownCss',[
|
5899 |
+
'jquery',
|
5900 |
+
'./utils'
|
5901 |
+
], function ($, CompatUtils) {
|
5902 |
+
// No-op CSS adapter that discards all classes by default
|
5903 |
+
function _dropdownAdapter (clazz) {
|
5904 |
+
return null;
|
5905 |
+
}
|
5906 |
+
|
5907 |
+
function DropdownCSS () { }
|
5908 |
+
|
5909 |
+
DropdownCSS.prototype.render = function (decorated) {
|
5910 |
+
var $dropdown = decorated.call(this);
|
5911 |
+
|
5912 |
+
var dropdownCssClass = this.options.get('dropdownCssClass') || '';
|
5913 |
+
|
5914 |
+
if ($.isFunction(dropdownCssClass)) {
|
5915 |
+
dropdownCssClass = dropdownCssClass(this.$element);
|
5916 |
+
}
|
5917 |
+
|
5918 |
+
var dropdownCssAdapter = this.options.get('adaptDropdownCssClass');
|
5919 |
+
dropdownCssAdapter = dropdownCssAdapter || _dropdownAdapter;
|
5920 |
+
|
5921 |
+
if (dropdownCssClass.indexOf(':all:') !== -1) {
|
5922 |
+
dropdownCssClass = dropdownCssClass.replace(':all:', '');
|
5923 |
+
|
5924 |
+
var _cssAdapter = dropdownCssAdapter;
|
5925 |
+
|
5926 |
+
dropdownCssAdapter = function (clazz) {
|
5927 |
+
var adapted = _cssAdapter(clazz);
|
5928 |
+
|
5929 |
+
if (adapted != null) {
|
5930 |
+
// Append the old one along with the adapted one
|
5931 |
+
return adapted + ' ' + clazz;
|
5932 |
+
}
|
5933 |
+
|
5934 |
+
return clazz;
|
5935 |
+
};
|
5936 |
+
}
|
5937 |
+
|
5938 |
+
var dropdownCss = this.options.get('dropdownCss') || {};
|
5939 |
+
|
5940 |
+
if ($.isFunction(dropdownCss)) {
|
5941 |
+
dropdownCss = dropdownCss(this.$element);
|
5942 |
+
}
|
5943 |
+
|
5944 |
+
CompatUtils.syncCssClasses($dropdown, this.$element, dropdownCssAdapter);
|
5945 |
+
|
5946 |
+
$dropdown.css(dropdownCss);
|
5947 |
+
$dropdown.addClass(dropdownCssClass);
|
5948 |
+
|
5949 |
+
return $dropdown;
|
5950 |
+
};
|
5951 |
+
|
5952 |
+
return DropdownCSS;
|
5953 |
+
});
|
5954 |
+
|
5955 |
+
S2.define('select2/compat/initSelection',[
|
5956 |
+
'jquery'
|
5957 |
+
], function ($) {
|
5958 |
+
function InitSelection (decorated, $element, options) {
|
5959 |
+
if (options.get('debug') && window.console && console.warn) {
|
5960 |
+
console.warn(
|
5961 |
+
'Select2: The `initSelection` option has been deprecated in favor' +
|
5962 |
+
' of a custom data adapter that overrides the `current` method. ' +
|
5963 |
+
'This method is now called multiple times instead of a single ' +
|
5964 |
+
'time when the instance is initialized. Support will be removed ' +
|
5965 |
+
'for the `initSelection` option in future versions of Select2'
|
5966 |
+
);
|
5967 |
+
}
|
5968 |
+
|
5969 |
+
this.initSelection = options.get('initSelection');
|
5970 |
+
this._isInitialized = false;
|
5971 |
+
|
5972 |
+
decorated.call(this, $element, options);
|
5973 |
+
}
|
5974 |
+
|
5975 |
+
InitSelection.prototype.current = function (decorated, callback) {
|
5976 |
+
var self = this;
|
5977 |
+
|
5978 |
+
if (this._isInitialized) {
|
5979 |
+
decorated.call(this, callback);
|
5980 |
+
|
5981 |
+
return;
|
5982 |
+
}
|
5983 |
+
|
5984 |
+
this.initSelection.call(null, this.$element, function (data) {
|
5985 |
+
self._isInitialized = true;
|
5986 |
+
|
5987 |
+
if (!$.isArray(data)) {
|
5988 |
+
data = [data];
|
5989 |
+
}
|
5990 |
+
|
5991 |
+
callback(data);
|
5992 |
+
});
|
5993 |
+
};
|
5994 |
+
|
5995 |
+
return InitSelection;
|
5996 |
+
});
|
5997 |
+
|
5998 |
+
S2.define('select2/compat/inputData',[
|
5999 |
+
'jquery'
|
6000 |
+
], function ($) {
|
6001 |
+
function InputData (decorated, $element, options) {
|
6002 |
+
this._currentData = [];
|
6003 |
+
this._valueSeparator = options.get('valueSeparator') || ',';
|
6004 |
+
|
6005 |
+
if ($element.prop('type') === 'hidden') {
|
6006 |
+
if (options.get('debug') && console && console.warn) {
|
6007 |
+
console.warn(
|
6008 |
+
'Select2: Using a hidden input with Select2 is no longer ' +
|
6009 |
+
'supported and may stop working in the future. It is recommended ' +
|
6010 |
+
'to use a `<select>` element instead.'
|
6011 |
+
);
|
6012 |
+
}
|
6013 |
+
}
|
6014 |
+
|
6015 |
+
decorated.call(this, $element, options);
|
6016 |
+
}
|
6017 |
+
|
6018 |
+
InputData.prototype.current = function (_, callback) {
|
6019 |
+
function getSelected (data, selectedIds) {
|
6020 |
+
var selected = [];
|
6021 |
+
|
6022 |
+
if (data.selected || $.inArray(data.id, selectedIds) !== -1) {
|
6023 |
+
data.selected = true;
|
6024 |
+
selected.push(data);
|
6025 |
+
} else {
|
6026 |
+
data.selected = false;
|
6027 |
+
}
|
6028 |
+
|
6029 |
+
if (data.children) {
|
6030 |
+
selected.push.apply(selected, getSelected(data.children, selectedIds));
|
6031 |
+
}
|
6032 |
+
|
6033 |
+
return selected;
|
6034 |
+
}
|
6035 |
+
|
6036 |
+
var selected = [];
|
6037 |
+
|
6038 |
+
for (var d = 0; d < this._currentData.length; d++) {
|
6039 |
+
var data = this._currentData[d];
|
6040 |
+
|
6041 |
+
selected.push.apply(
|
6042 |
+
selected,
|
6043 |
+
getSelected(
|
6044 |
+
data,
|
6045 |
+
this.$element.val().split(
|
6046 |
+
this._valueSeparator
|
6047 |
+
)
|
6048 |
+
)
|
6049 |
+
);
|
6050 |
+
}
|
6051 |
+
|
6052 |
+
callback(selected);
|
6053 |
+
};
|
6054 |
+
|
6055 |
+
InputData.prototype.select = function (_, data) {
|
6056 |
+
if (!this.options.get('multiple')) {
|
6057 |
+
this.current(function (allData) {
|
6058 |
+
$.map(allData, function (data) {
|
6059 |
+
data.selected = false;
|
6060 |
+
});
|
6061 |
+
});
|
6062 |
+
|
6063 |
+
this.$element.val(data.id);
|
6064 |
+
this.$element.trigger('change');
|
6065 |
+
} else {
|
6066 |
+
var value = this.$element.val();
|
6067 |
+
value += this._valueSeparator + data.id;
|
6068 |
+
|
6069 |
+
this.$element.val(value);
|
6070 |
+
this.$element.trigger('change');
|
6071 |
+
}
|
6072 |
+
};
|
6073 |
+
|
6074 |
+
InputData.prototype.unselect = function (_, data) {
|
6075 |
+
var self = this;
|
6076 |
+
|
6077 |
+
data.selected = false;
|
6078 |
+
|
6079 |
+
this.current(function (allData) {
|
6080 |
+
var values = [];
|
6081 |
+
|
6082 |
+
for (var d = 0; d < allData.length; d++) {
|
6083 |
+
var item = allData[d];
|
6084 |
+
|
6085 |
+
if (data.id == item.id) {
|
6086 |
+
continue;
|
6087 |
+
}
|
6088 |
+
|
6089 |
+
values.push(item.id);
|
6090 |
+
}
|
6091 |
+
|
6092 |
+
self.$element.val(values.join(self._valueSeparator));
|
6093 |
+
self.$element.trigger('change');
|
6094 |
+
});
|
6095 |
+
};
|
6096 |
+
|
6097 |
+
InputData.prototype.query = function (_, params, callback) {
|
6098 |
+
var results = [];
|
6099 |
+
|
6100 |
+
for (var d = 0; d < this._currentData.length; d++) {
|
6101 |
+
var data = this._currentData[d];
|
6102 |
+
|
6103 |
+
var matches = this.matches(params, data);
|
6104 |
+
|
6105 |
+
if (matches !== null) {
|
6106 |
+
results.push(matches);
|
6107 |
+
}
|
6108 |
+
}
|
6109 |
+
|
6110 |
+
callback({
|
6111 |
+
results: results
|
6112 |
+
});
|
6113 |
+
};
|
6114 |
+
|
6115 |
+
InputData.prototype.addOptions = function (_, $options) {
|
6116 |
+
var options = $.map($options, function ($option) {
|
6117 |
+
return $.data($option[0], 'data');
|
6118 |
+
});
|
6119 |
+
|
6120 |
+
this._currentData.push.apply(this._currentData, options);
|
6121 |
+
};
|
6122 |
+
|
6123 |
+
return InputData;
|
6124 |
+
});
|
6125 |
+
|
6126 |
+
S2.define('select2/compat/matcher',[
|
6127 |
+
'jquery'
|
6128 |
+
], function ($) {
|
6129 |
+
function oldMatcher (matcher) {
|
6130 |
+
function wrappedMatcher (params, data) {
|
6131 |
+
var match = $.extend(true, {}, data);
|
6132 |
+
|
6133 |
+
if (params.term == null || $.trim(params.term) === '') {
|
6134 |
+
return match;
|
6135 |
+
}
|
6136 |
+
|
6137 |
+
if (data.children) {
|
6138 |
+
for (var c = data.children.length - 1; c >= 0; c--) {
|
6139 |
+
var child = data.children[c];
|
6140 |
+
|
6141 |
+
// Check if the child object matches
|
6142 |
+
// The old matcher returned a boolean true or false
|
6143 |
+
var doesMatch = matcher(params.term, child.text, child);
|
6144 |
+
|
6145 |
+
// If the child didn't match, pop it off
|
6146 |
+
if (!doesMatch) {
|
6147 |
+
match.children.splice(c, 1);
|
6148 |
+
}
|
6149 |
+
}
|
6150 |
+
|
6151 |
+
if (match.children.length > 0) {
|
6152 |
+
return match;
|
6153 |
+
}
|
6154 |
+
}
|
6155 |
+
|
6156 |
+
if (matcher(params.term, data.text, data)) {
|
6157 |
+
return match;
|
6158 |
+
}
|
6159 |
+
|
6160 |
+
return null;
|
6161 |
+
}
|
6162 |
+
|
6163 |
+
return wrappedMatcher;
|
6164 |
+
}
|
6165 |
+
|
6166 |
+
return oldMatcher;
|
6167 |
+
});
|
6168 |
+
|
6169 |
+
S2.define('select2/compat/query',[
|
6170 |
+
|
6171 |
+
], function () {
|
6172 |
+
function Query (decorated, $element, options) {
|
6173 |
+
if (options.get('debug') && window.console && console.warn) {
|
6174 |
+
console.warn(
|
6175 |
+
'Select2: The `query` option has been deprecated in favor of a ' +
|
6176 |
+
'custom data adapter that overrides the `query` method. Support ' +
|
6177 |
+
'will be removed for the `query` option in future versions of ' +
|
6178 |
+
'Select2.'
|
6179 |
+
);
|
6180 |
+
}
|
6181 |
+
|
6182 |
+
decorated.call(this, $element, options);
|
6183 |
+
}
|
6184 |
+
|
6185 |
+
Query.prototype.query = function (_, params, callback) {
|
6186 |
+
params.callback = callback;
|
6187 |
+
|
6188 |
+
var query = this.options.get('query');
|
6189 |
+
|
6190 |
+
query.call(null, params);
|
6191 |
+
};
|
6192 |
+
|
6193 |
+
return Query;
|
6194 |
+
});
|
6195 |
+
|
6196 |
+
S2.define('select2/dropdown/attachContainer',[
|
6197 |
+
|
6198 |
+
], function () {
|
6199 |
+
function AttachContainer (decorated, $element, options) {
|
6200 |
+
decorated.call(this, $element, options);
|
6201 |
+
}
|
6202 |
+
|
6203 |
+
AttachContainer.prototype.position =
|
6204 |
+
function (decorated, $dropdown, $container) {
|
6205 |
+
var $dropdownContainer = $container.find('.dropdown-wrapper');
|
6206 |
+
$dropdownContainer.append($dropdown);
|
6207 |
+
|
6208 |
+
$dropdown.addClass('select2-dropdown--below');
|
6209 |
+
$container.addClass('select2-container--below');
|
6210 |
+
};
|
6211 |
+
|
6212 |
+
return AttachContainer;
|
6213 |
+
});
|
6214 |
+
|
6215 |
+
S2.define('select2/dropdown/stopPropagation',[
|
6216 |
+
|
6217 |
+
], function () {
|
6218 |
+
function StopPropagation () { }
|
6219 |
+
|
6220 |
+
StopPropagation.prototype.bind = function (decorated, container, $container) {
|
6221 |
+
decorated.call(this, container, $container);
|
6222 |
+
|
6223 |
+
var stoppedEvents = [
|
6224 |
+
'blur',
|
6225 |
+
'change',
|
6226 |
+
'click',
|
6227 |
+
'dblclick',
|
6228 |
+
'focus',
|
6229 |
+
'focusin',
|
6230 |
+
'focusout',
|
6231 |
+
'input',
|
6232 |
+
'keydown',
|
6233 |
+
'keyup',
|
6234 |
+
'keypress',
|
6235 |
+
'mousedown',
|
6236 |
+
'mouseenter',
|
6237 |
+
'mouseleave',
|
6238 |
+
'mousemove',
|
6239 |
+
'mouseover',
|
6240 |
+
'mouseup',
|
6241 |
+
'search',
|
6242 |
+
'touchend',
|
6243 |
+
'touchstart'
|
6244 |
+
];
|
6245 |
+
|
6246 |
+
this.$dropdown.on(stoppedEvents.join(' '), function (evt) {
|
6247 |
+
evt.stopPropagation();
|
6248 |
+
});
|
6249 |
+
};
|
6250 |
+
|
6251 |
+
return StopPropagation;
|
6252 |
+
});
|
6253 |
+
|
6254 |
+
S2.define('select2/selection/stopPropagation',[
|
6255 |
+
|
6256 |
+
], function () {
|
6257 |
+
function StopPropagation () { }
|
6258 |
+
|
6259 |
+
StopPropagation.prototype.bind = function (decorated, container, $container) {
|
6260 |
+
decorated.call(this, container, $container);
|
6261 |
+
|
6262 |
+
var stoppedEvents = [
|
6263 |
+
'blur',
|
6264 |
+
'change',
|
6265 |
+
'click',
|
6266 |
+
'dblclick',
|
6267 |
+
'focus',
|
6268 |
+
'focusin',
|
6269 |
+
'focusout',
|
6270 |
+
'input',
|
6271 |
+
'keydown',
|
6272 |
+
'keyup',
|
6273 |
+
'keypress',
|
6274 |
+
'mousedown',
|
6275 |
+
'mouseenter',
|
6276 |
+
'mouseleave',
|
6277 |
+
'mousemove',
|
6278 |
+
'mouseover',
|
6279 |
+
'mouseup',
|
6280 |
+
'search',
|
6281 |
+
'touchend',
|
6282 |
+
'touchstart'
|
6283 |
+
];
|
6284 |
+
|
6285 |
+
this.$selection.on(stoppedEvents.join(' '), function (evt) {
|
6286 |
+
evt.stopPropagation();
|
6287 |
+
});
|
6288 |
+
};
|
6289 |
+
|
6290 |
+
return StopPropagation;
|
6291 |
+
});
|
6292 |
+
|
6293 |
+
/*!
|
6294 |
+
* jQuery Mousewheel 3.1.13
|
6295 |
+
*
|
6296 |
+
* Copyright jQuery Foundation and other contributors
|
6297 |
+
* Released under the MIT license
|
6298 |
+
* http://jquery.org/license
|
6299 |
+
*/
|
6300 |
+
|
6301 |
+
(function (factory) {
|
6302 |
+
if ( typeof S2.define === 'function' && S2.define.amd ) {
|
6303 |
+
// AMD. Register as an anonymous module.
|
6304 |
+
S2.define('jquery-mousewheel',['jquery'], factory);
|
6305 |
+
} else if (typeof exports === 'object') {
|
6306 |
+
// Node/CommonJS style for Browserify
|
6307 |
+
module.exports = factory;
|
6308 |
+
} else {
|
6309 |
+
// Browser globals
|
6310 |
+
factory(jQuery);
|
6311 |
+
}
|
6312 |
+
}(function ($) {
|
6313 |
+
|
6314 |
+
var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
|
6315 |
+
toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
|
6316 |
+
['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
|
6317 |
+
slice = Array.prototype.slice,
|
6318 |
+
nullLowestDeltaTimeout, lowestDelta;
|
6319 |
+
|
6320 |
+
if ( $.event.fixHooks ) {
|
6321 |
+
for ( var i = toFix.length; i; ) {
|
6322 |
+
$.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
|
6323 |
+
}
|
6324 |
+
}
|
6325 |
+
|
6326 |
+
var special = $.event.special.mousewheel = {
|
6327 |
+
version: '3.1.12',
|
6328 |
+
|
6329 |
+
setup: function() {
|
6330 |
+
if ( this.addEventListener ) {
|
6331 |
+
for ( var i = toBind.length; i; ) {
|
6332 |
+
this.addEventListener( toBind[--i], handler, false );
|
6333 |
+
}
|
6334 |
+
} else {
|
6335 |
+
this.onmousewheel = handler;
|
6336 |
+
}
|
6337 |
+
// Store the line height and page height for this particular element
|
6338 |
+
$.data(this, 'mousewheel-line-height', special.getLineHeight(this));
|
6339 |
+
$.data(this, 'mousewheel-page-height', special.getPageHeight(this));
|
6340 |
+
},
|
6341 |
+
|
6342 |
+
teardown: function() {
|
6343 |
+
if ( this.removeEventListener ) {
|
6344 |
+
for ( var i = toBind.length; i; ) {
|
6345 |
+
this.removeEventListener( toBind[--i], handler, false );
|
6346 |
+
}
|
6347 |
+
} else {
|
6348 |
+
this.onmousewheel = null;
|
6349 |
+
}
|
6350 |
+
// Clean up the data we added to the element
|
6351 |
+
$.removeData(this, 'mousewheel-line-height');
|
6352 |
+
$.removeData(this, 'mousewheel-page-height');
|
6353 |
+
},
|
6354 |
+
|
6355 |
+
getLineHeight: function(elem) {
|
6356 |
+
var $elem = $(elem),
|
6357 |
+
$parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
|
6358 |
+
if (!$parent.length) {
|
6359 |
+
$parent = $('body');
|
6360 |
+
}
|
6361 |
+
return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
|
6362 |
+
},
|
6363 |
+
|
6364 |
+
getPageHeight: function(elem) {
|
6365 |
+
return $(elem).height();
|
6366 |
+
},
|
6367 |
+
|
6368 |
+
settings: {
|
6369 |
+
adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
|
6370 |
+
normalizeOffset: true // calls getBoundingClientRect for each event
|
6371 |
+
}
|
6372 |
+
};
|
6373 |
+
|
6374 |
+
$.fn.extend({
|
6375 |
+
mousewheel: function(fn) {
|
6376 |
+
return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
|
6377 |
+
},
|
6378 |
+
|
6379 |
+
unmousewheel: function(fn) {
|
6380 |
+
return this.unbind('mousewheel', fn);
|
6381 |
+
}
|
6382 |
+
});
|
6383 |
+
|
6384 |
+
|
6385 |
+
function handler(event) {
|
6386 |
+
var orgEvent = event || window.event,
|
6387 |
+
args = slice.call(arguments, 1),
|
6388 |
+
delta = 0,
|
6389 |
+
deltaX = 0,
|
6390 |
+
deltaY = 0,
|
6391 |
+
absDelta = 0,
|
6392 |
+
offsetX = 0,
|
6393 |
+
offsetY = 0;
|
6394 |
+
event = $.event.fix(orgEvent);
|
6395 |
+
event.type = 'mousewheel';
|
6396 |
+
|
6397 |
+
// Old school scrollwheel delta
|
6398 |
+
if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
|
6399 |
+
if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
|
6400 |
+
if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
|
6401 |
+
if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
|
6402 |
+
|
6403 |
+
// Firefox < 17 horizontal scrolling related to DOMMouseScroll event
|
6404 |
+
if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
|
6405 |
+
deltaX = deltaY * -1;
|
6406 |
+
deltaY = 0;
|
6407 |
+
}
|
6408 |
+
|
6409 |
+
// Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
|
6410 |
+
delta = deltaY === 0 ? deltaX : deltaY;
|
6411 |
+
|
6412 |
+
// New school wheel delta (wheel event)
|
6413 |
+
if ( 'deltaY' in orgEvent ) {
|
6414 |
+
deltaY = orgEvent.deltaY * -1;
|
6415 |
+
delta = deltaY;
|
6416 |
+
}
|
6417 |
+
if ( 'deltaX' in orgEvent ) {
|
6418 |
+
deltaX = orgEvent.deltaX;
|
6419 |
+
if ( deltaY === 0 ) { delta = deltaX * -1; }
|
6420 |
+
}
|
6421 |
+
|
6422 |
+
// No change actually happened, no reason to go any further
|
6423 |
+
if ( deltaY === 0 && deltaX === 0 ) { return; }
|
6424 |
+
|
6425 |
+
// Need to convert lines and pages to pixels if we aren't already in pixels
|
6426 |
+
// There are three delta modes:
|
6427 |
+
// * deltaMode 0 is by pixels, nothing to do
|
6428 |
+
// * deltaMode 1 is by lines
|
6429 |
+
// * deltaMode 2 is by pages
|
6430 |
+
if ( orgEvent.deltaMode === 1 ) {
|
6431 |
+
var lineHeight = $.data(this, 'mousewheel-line-height');
|
6432 |
+
delta *= lineHeight;
|
6433 |
+
deltaY *= lineHeight;
|
6434 |
+
deltaX *= lineHeight;
|
6435 |
+
} else if ( orgEvent.deltaMode === 2 ) {
|
6436 |
+
var pageHeight = $.data(this, 'mousewheel-page-height');
|
6437 |
+
delta *= pageHeight;
|
6438 |
+
deltaY *= pageHeight;
|
6439 |
+
deltaX *= pageHeight;
|
6440 |
+
}
|
6441 |
+
|
6442 |
+
// Store lowest absolute delta to normalize the delta values
|
6443 |
+
absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
|
6444 |
+
|
6445 |
+
if ( !lowestDelta || absDelta < lowestDelta ) {
|
6446 |
+
lowestDelta = absDelta;
|
6447 |
+
|
6448 |
+
// Adjust older deltas if necessary
|
6449 |
+
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
|
6450 |
+
lowestDelta /= 40;
|
6451 |
+
}
|
6452 |
+
}
|
6453 |
+
|
6454 |
+
// Adjust older deltas if necessary
|
6455 |
+
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
|
6456 |
+
// Divide all the things by 40!
|
6457 |
+
delta /= 40;
|
6458 |
+
deltaX /= 40;
|
6459 |
+
deltaY /= 40;
|
6460 |
+
}
|
6461 |
+
|
6462 |
+
// Get a whole, normalized value for the deltas
|
6463 |
+
delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
|
6464 |
+
deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
|
6465 |
+
deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
|
6466 |
+
|
6467 |
+
// Normalise offsetX and offsetY properties
|
6468 |
+
if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
|
6469 |
+
var boundingRect = this.getBoundingClientRect();
|
6470 |
+
offsetX = event.clientX - boundingRect.left;
|
6471 |
+
offsetY = event.clientY - boundingRect.top;
|
6472 |
+
}
|
6473 |
+
|
6474 |
+
// Add information to the event object
|
6475 |
+
event.deltaX = deltaX;
|
6476 |
+
event.deltaY = deltaY;
|
6477 |
+
event.deltaFactor = lowestDelta;
|
6478 |
+
event.offsetX = offsetX;
|
6479 |
+
event.offsetY = offsetY;
|
6480 |
+
// Go ahead and set deltaMode to 0 since we converted to pixels
|
6481 |
+
// Although this is a little odd since we overwrite the deltaX/Y
|
6482 |
+
// properties with normalized deltas.
|
6483 |
+
event.deltaMode = 0;
|
6484 |
+
|
6485 |
+
// Add event and delta to the front of the arguments
|
6486 |
+
args.unshift(event, delta, deltaX, deltaY);
|
6487 |
+
|
6488 |
+
// Clearout lowestDelta after sometime to better
|
6489 |
+
// handle multiple device types that give different
|
6490 |
+
// a different lowestDelta
|
6491 |
+
// Ex: trackpad = 3 and mouse wheel = 120
|
6492 |
+
if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
|
6493 |
+
nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
|
6494 |
+
|
6495 |
+
return ($.event.dispatch || $.event.handle).apply(this, args);
|
6496 |
+
}
|
6497 |
+
|
6498 |
+
function nullLowestDelta() {
|
6499 |
+
lowestDelta = null;
|
6500 |
+
}
|
6501 |
+
|
6502 |
+
function shouldAdjustOldDeltas(orgEvent, absDelta) {
|
6503 |
+
// If this is an older event and the delta is divisable by 120,
|
6504 |
+
// then we are assuming that the browser is treating this as an
|
6505 |
+
// older mouse wheel event and that we should divide the deltas
|
6506 |
+
// by 40 to try and get a more usable deltaFactor.
|
6507 |
+
// Side note, this actually impacts the reported scroll distance
|
6508 |
+
// in older browsers and can cause scrolling to be slower than native.
|
6509 |
+
// Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
|
6510 |
+
return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
|
6511 |
+
}
|
6512 |
+
|
6513 |
+
}));
|
6514 |
+
|
6515 |
+
S2.define('jquery.select2',[
|
6516 |
+
'jquery',
|
6517 |
+
'jquery-mousewheel',
|
6518 |
+
|
6519 |
+
'./select2/core',
|
6520 |
+
'./select2/defaults'
|
6521 |
+
], function ($, _, Select2, Defaults) {
|
6522 |
+
if ($.fn.selectWoo == null) {
|
6523 |
+
// All methods that should return the element
|
6524 |
+
var thisMethods = ['open', 'close', 'destroy'];
|
6525 |
+
|
6526 |
+
$.fn.selectWoo = function (options) {
|
6527 |
+
options = options || {};
|
6528 |
+
|
6529 |
+
if (typeof options === 'object') {
|
6530 |
+
this.each(function () {
|
6531 |
+
var instanceOptions = $.extend(true, {}, options);
|
6532 |
+
|
6533 |
+
var instance = new Select2($(this), instanceOptions);
|
6534 |
+
});
|
6535 |
+
|
6536 |
+
return this;
|
6537 |
+
} else if (typeof options === 'string') {
|
6538 |
+
var ret;
|
6539 |
+
var args = Array.prototype.slice.call(arguments, 1);
|
6540 |
+
|
6541 |
+
this.each(function () {
|
6542 |
+
var instance = $(this).data('select2');
|
6543 |
+
|
6544 |
+
if (instance == null && window.console && console.error) {
|
6545 |
+
console.error(
|
6546 |
+
'The select2(\'' + options + '\') method was called on an ' +
|
6547 |
+
'element that is not using Select2.'
|
6548 |
+
);
|
6549 |
+
}
|
6550 |
+
|
6551 |
+
ret = instance[options].apply(instance, args);
|
6552 |
+
});
|
6553 |
+
|
6554 |
+
// Check if we should be returning `this`
|
6555 |
+
if ($.inArray(options, thisMethods) > -1) {
|
6556 |
+
return this;
|
6557 |
+
}
|
6558 |
+
|
6559 |
+
return ret;
|
6560 |
+
} else {
|
6561 |
+
throw new Error('Invalid arguments for Select2: ' + options);
|
6562 |
+
}
|
6563 |
+
};
|
6564 |
+
}
|
6565 |
+
|
6566 |
+
if ($.fn.select2 != null && $.fn.select2.defaults != null) {
|
6567 |
+
$.fn.selectWoo.defaults = $.fn.select2.defaults;
|
6568 |
+
}
|
6569 |
+
|
6570 |
+
if ($.fn.selectWoo.defaults == null) {
|
6571 |
+
$.fn.selectWoo.defaults = Defaults;
|
6572 |
+
}
|
6573 |
+
|
6574 |
+
// Also register selectWoo under select2 if select2 is not already present.
|
6575 |
+
$.fn.select2 = $.fn.select2 || $.fn.selectWoo;
|
6576 |
+
|
6577 |
+
return Select2;
|
6578 |
+
});
|
6579 |
+
|
6580 |
+
// Return the AMD loader configuration so it can be used outside of this file
|
6581 |
+
return {
|
6582 |
+
define: S2.define,
|
6583 |
+
require: S2.require
|
6584 |
+
};
|
6585 |
+
}());
|
6586 |
+
|
6587 |
+
// Autoload the jQuery bindings
|
6588 |
+
// We know that all of the modules exist above this, so we're safe
|
6589 |
+
var select2 = S2.require('jquery.select2');
|
6590 |
+
|
6591 |
+
// Hold the AMD module references on the jQuery function that was just loaded
|
6592 |
+
// This allows Select2 to use the internal loader outside of this file, such
|
6593 |
+
// as in the language files.
|
6594 |
+
jQuery.fn.select2.amd = S2;
|
6595 |
+
jQuery.fn.selectWoo.amd = S2;
|
6596 |
+
|
6597 |
+
// Return the Select2 instance for anyone who is importing it.
|
6598 |
+
return select2;
|
6599 |
+
}));
|
js/admin/selectWoo.full.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
/*! Select2 1.0.8 | https://github.com/select2/select2/blob/master/LICENSE.md */!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===c&&(c="undefined"!=typeof window?require("jquery"):require("jquery")(b)),a(c),c}:a(jQuery)}(function(a){var b=function(){if(a&&a.fn&&a.fn.select2&&a.fn.select2.amd)var b=a.fn.select2.amd;var b;return function(){if(!b||!b.requirejs){b?c=b:b={};var a,c,d;!function(b){function e(a,b){return v.call(a,b)}function f(a,b){var c,d,e,f,g,h,i,j,k,l,m,n,o=b&&b.split("/"),p=t.map,q=p&&p["*"]||{};if(a){for(a=a.split("/"),g=a.length-1,t.nodeIdCompat&&x.test(a[g])&&(a[g]=a[g].replace(x,"")),"."===a[0].charAt(0)&&o&&(n=o.slice(0,o.length-1),a=n.concat(a)),k=0;k<a.length;k++)if("."===(m=a[k]))a.splice(k,1),k-=1;else if(".."===m){if(0===k||1===k&&".."===a[2]||".."===a[k-1])continue;k>0&&(a.splice(k-1,2),k-=2)}a=a.join("/")}if((o||q)&&p){for(c=a.split("/"),k=c.length;k>0;k-=1){if(d=c.slice(0,k).join("/"),o)for(l=o.length;l>0;l-=1)if((e=p[o.slice(0,l).join("/")])&&(e=e[d])){f=e,h=k;break}if(f)break;!i&&q&&q[d]&&(i=q[d],j=k)}!f&&i&&(f=i,h=j),f&&(c.splice(0,h,f),a=c.join("/"))}return a}function g(a,c){return function(){var d=w.call(arguments,0);return"string"!=typeof d[0]&&1===d.length&&d.push(null),o.apply(b,d.concat([a,c]))}}function h(a){return function(b){return f(b,a)}}function i(a){return function(b){r[a]=b}}function j(a){if(e(s,a)){var c=s[a];delete s[a],u[a]=!0,n.apply(b,c)}if(!e(r,a)&&!e(u,a))throw new Error("No "+a);return r[a]}function k(a){var b,c=a?a.indexOf("!"):-1;return c>-1&&(b=a.substring(0,c),a=a.substring(c+1,a.length)),[b,a]}function l(a){return a?k(a):[]}function m(a){return function(){return t&&t.config&&t.config[a]||{}}}var n,o,p,q,r={},s={},t={},u={},v=Object.prototype.hasOwnProperty,w=[].slice,x=/\.js$/;p=function(a,b){var c,d=k(a),e=d[0],g=b[1];return a=d[1],e&&(e=f(e,g),c=j(e)),e?a=c&&c.normalize?c.normalize(a,h(g)):f(a,g):(a=f(a,g),d=k(a),e=d[0],a=d[1],e&&(c=j(e))),{f:e?e+"!"+a:a,n:a,pr:e,p:c}},q={require:function(a){return g(a)},exports:function(a){var b=r[a];return void 0!==b?b:r[a]={}},module:function(a){return{id:a,uri:"",exports:r[a],config:m(a)}}},n=function(a,c,d,f){var h,k,m,n,o,t,v,w=[],x=typeof d;if(f=f||a,t=l(f),"undefined"===x||"function"===x){for(c=!c.length&&d.length?["require","exports","module"]:c,o=0;o<c.length;o+=1)if(n=p(c[o],t),"require"===(k=n.f))w[o]=q.require(a);else if("exports"===k)w[o]=q.exports(a),v=!0;else if("module"===k)h=w[o]=q.module(a);else if(e(r,k)||e(s,k)||e(u,k))w[o]=j(k);else{if(!n.p)throw new Error(a+" missing "+k);n.p.load(n.n,g(f,!0),i(k),{}),w[o]=r[k]}m=d?d.apply(r[a],w):void 0,a&&(h&&h.exports!==b&&h.exports!==r[a]?r[a]=h.exports:m===b&&v||(r[a]=m))}else a&&(r[a]=d)},a=c=o=function(a,c,d,e,f){if("string"==typeof a)return q[a]?q[a](c):j(p(a,l(c)).f);if(!a.splice){if(t=a,t.deps&&o(t.deps,t.callback),!c)return;c.splice?(a=c,c=d,d=null):a=b}return c=c||function(){},"function"==typeof d&&(d=e,e=f),e?n(b,a,c,d):setTimeout(function(){n(b,a,c,d)},4),o},o.config=function(a){return o(a)},a._defined=r,d=function(a,b,c){if("string"!=typeof a)throw new Error("See almond README: incorrect module build, no module name");b.splice||(c=b,b=[]),e(r,a)||e(s,a)||(s[a]=[a,b,c])},d.amd={jQuery:!0}}(),b.requirejs=a,b.require=c,b.define=d}}(),b.define("almond",function(){}),b.define("jquery",[],function(){var b=a||$;return null==b&&console&&console.error&&console.error("Select2: An instance of jQuery or a jQuery-compatible library was not found. Make sure that you are including jQuery before Select2 on your web page."),b}),b.define("select2/utils",["jquery"],function(a){function b(a){var b=a.prototype,c=[];for(var d in b){"function"==typeof b[d]&&("constructor"!==d&&c.push(d))}return c}var c={};c.Extend=function(a,b){function c(){this.constructor=a}var d={}.hasOwnProperty;for(var e in b)d.call(b,e)&&(a[e]=b[e]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},c.Decorate=function(a,c){function d(){var b=Array.prototype.unshift,d=c.prototype.constructor.length,e=a.prototype.constructor;d>0&&(b.call(arguments,a.prototype.constructor),e=c.prototype.constructor),e.apply(this,arguments)}function e(){this.constructor=d}var f=b(c),g=b(a);c.displayName=a.displayName,d.prototype=new e;for(var h=0;h<g.length;h++){var i=g[h];d.prototype[i]=a.prototype[i]}for(var j=(function(a){var b=function(){};a in d.prototype&&(b=d.prototype[a]);var e=c.prototype[a];return function(){return Array.prototype.unshift.call(arguments,b),e.apply(this,arguments)}}),k=0;k<f.length;k++){var l=f[k];d.prototype[l]=j(l)}return d};var d=function(){this.listeners={}};return d.prototype.on=function(a,b){this.listeners=this.listeners||{},a in this.listeners?this.listeners[a].push(b):this.listeners[a]=[b]},d.prototype.trigger=function(a){var b=Array.prototype.slice,c=b.call(arguments,1);this.listeners=this.listeners||{},null==c&&(c=[]),0===c.length&&c.push({}),c[0]._type=a,a in this.listeners&&this.invoke(this.listeners[a],b.call(arguments,1)),"*"in this.listeners&&this.invoke(this.listeners["*"],arguments)},d.prototype.invoke=function(a,b){for(var c=0,d=a.length;c<d;c++)a[c].apply(this,b)},c.Observable=d,c.generateChars=function(a){for(var b="",c=0;c<a;c++){b+=Math.floor(36*Math.random()).toString(36)}return b},c.bind=function(a,b){return function(){a.apply(b,arguments)}},c._convertData=function(a){for(var b in a){var c=b.split("-"),d=a;if(1!==c.length){for(var e=0;e<c.length;e++){var f=c[e];f=f.substring(0,1).toLowerCase()+f.substring(1),f in d||(d[f]={}),e==c.length-1&&(d[f]=a[b]),d=d[f]}delete a[b]}}return a},c.hasScroll=function(b,c){var d=a(c),e=c.style.overflowX,f=c.style.overflowY;return(e!==f||"hidden"!==f&&"visible"!==f)&&("scroll"===e||"scroll"===f||(d.innerHeight()<c.scrollHeight||d.innerWidth()<c.scrollWidth))},c.escapeMarkup=function(a){var b={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return"string"!=typeof a?a:String(a).replace(/[&<>"'\/\\]/g,function(a){return b[a]})},c.entityDecode=function(a){var b=document.createElement("textarea");return b.innerHTML=a,b.value},c.appendMany=function(b,c){if("1.7"===a.fn.jquery.substr(0,3)){var d=a();a.map(c,function(a){d=d.add(a)}),c=d}b.append(c)},c.isTouchscreen=function(){return void 0===c._isTouchscreenCache&&(c._isTouchscreenCache="ontouchstart"in document.documentElement),c._isTouchscreenCache},c}),b.define("select2/results",["jquery","./utils"],function(a,b){function c(a,b,d){this.$element=a,this.data=d,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<ul class="select2-results__options" role="listbox" tabindex="-1"></ul>');return this.options.get("multiple")&&b.attr("aria-multiselectable","true"),this.$results=b,b},c.prototype.clear=function(){this.$results.empty()},c.prototype.displayMessage=function(b){var c=this.options.get("escapeMarkup");this.clear(),this.hideLoading();var d=a('<li role="alert" aria-live="assertive" class="select2-results__option"></li>'),e=this.options.get("translations").get(b.message);d.append(c(e(b.args))),d[0].className+=" select2-results__message",this.$results.append(d)},c.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},c.prototype.append=function(a){this.hideLoading();var b=[];if(null==a.results||0===a.results.length)return void(0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"}));a.results=this.sort(a.results);for(var c=0;c<a.results.length;c++){var d=a.results[c],e=this.option(d);b.push(e)}this.$results.append(b)},c.prototype.position=function(a,b){b.find(".select2-results").append(a)},c.prototype.sort=function(a){return this.options.get("sorter")(a)},c.prototype.highlightFirstItem=function(){var a=this.$results.find(".select2-results__option[data-selected]"),b=a.filter("[data-selected=true]");b.length>0?b.first().trigger("mouseenter"):a.first().trigger("mouseenter"),this.ensureHighlightVisible()},c.prototype.setClasses=function(){var b=this;this.data.current(function(c){var d=a.map(c,function(a){return a.id.toString()});b.$results.find(".select2-results__option[data-selected]").each(function(){var b=a(this),c=a.data(this,"data"),e=""+c.id;null!=c.element&&c.element.selected||null==c.element&&a.inArray(e,d)>-1?b.attr("data-selected","true"):b.attr("data-selected","false")})})},c.prototype.showLoading=function(a){this.hideLoading();var b=this.options.get("translations").get("searching"),c={disabled:!0,loading:!0,text:b(a)},d=this.option(c);d.className+=" loading-results",this.$results.prepend(d)},c.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()},c.prototype.option=function(b){var c=document.createElement("li");c.className="select2-results__option";var d={role:"option","data-selected":"false",tabindex:-1};b.disabled&&(delete d["data-selected"],d["aria-disabled"]="true"),null==b.id&&delete d["data-selected"],null!=b._resultId&&(c.id=b._resultId),b.title&&(c.title=b.title),b.children&&(d["aria-label"]=b.text,delete d["data-selected"]);for(var e in d){var f=d[e];c.setAttribute(e,f)}if(b.children){var g=a(c),h=document.createElement("strong");h.className="select2-results__group";var i=a(h);this.template(b,h),i.attr("role","presentation");for(var j=[],k=0;k<b.children.length;k++){var l=b.children[k],m=this.option(l);j.push(m)}var n=a("<ul></ul>",{class:"select2-results__options select2-results__options--nested",role:"listbox"});n.append(j),g.attr("role","list"),g.append(h),g.append(n)}else this.template(b,c);return a.data(c,"data",b),c},c.prototype.bind=function(b,c){var d=this,e=b.id+"-results";this.$results.attr("id",e),b.on("results:all",function(a){d.clear(),d.append(a.data),b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("results:append",function(a){d.append(a.data),b.isOpen()&&d.setClasses()}),b.on("query",function(a){d.hideMessages(),d.showLoading(a)}),b.on("select",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("unselect",function(){b.isOpen()&&(d.setClasses(),d.highlightFirstItem())}),b.on("open",function(){d.$results.attr("aria-expanded","true"),d.$results.attr("aria-hidden","false"),d.setClasses(),d.ensureHighlightVisible()}),b.on("close",function(){d.$results.attr("aria-expanded","false"),d.$results.attr("aria-hidden","true"),d.$results.removeAttr("aria-activedescendant")}),b.on("results:toggle",function(){var a=d.getHighlightedResults();0!==a.length&&a.trigger("mouseup")}),b.on("results:select",function(){var a=d.getHighlightedResults();if(0!==a.length){var b=a.data("data");"true"==a.attr("data-selected")?d.trigger("close",{}):d.trigger("select",{data:b})}}),b.on("results:previous",function(){var a=d.getHighlightedResults(),b=d.$results.find("[data-selected]"),c=b.index(a);if(0!==c){var e=c-1;0===a.length&&(e=0);var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top,h=f.offset().top,i=d.$results.scrollTop()+(h-g);0===e?d.$results.scrollTop(0):h-g<0&&d.$results.scrollTop(i)}}),b.on("results:next",function(){var a=d.getHighlightedResults(),b=d.$results.find("[data-selected]"),c=b.index(a),e=c+1;if(!(e>=b.length)){var f=b.eq(e);f.trigger("mouseenter");var g=d.$results.offset().top+d.$results.outerHeight(!1),h=f.offset().top+f.outerHeight(!1),i=d.$results.scrollTop()+h-g;0===e?d.$results.scrollTop(0):h>g&&d.$results.scrollTop(i)}}),b.on("results:focus",function(a){a.element.addClass("select2-results__option--highlighted").attr("aria-selected","true"),d.$results.attr("aria-activedescendant",a.element.attr("id"))}),b.on("results:message",function(a){d.displayMessage(a)}),a.fn.mousewheel&&this.$results.on("mousewheel",function(a){var b=d.$results.scrollTop(),c=d.$results.get(0).scrollHeight-b+a.deltaY,e=a.deltaY>0&&b-a.deltaY<=0,f=a.deltaY<0&&c<=d.$results.height();e?(d.$results.scrollTop(0),a.preventDefault(),a.stopPropagation()):f&&(d.$results.scrollTop(d.$results.get(0).scrollHeight-d.$results.height()),a.preventDefault(),a.stopPropagation())}),this.$results.on("mouseup",".select2-results__option[data-selected]",function(b){var c=a(this),e=c.data("data");if("true"===c.attr("data-selected"))return void(d.options.get("multiple")?d.trigger("unselect",{originalEvent:b,data:e}):d.trigger("close",{}));d.trigger("select",{originalEvent:b,data:e})}),this.$results.on("mouseenter",".select2-results__option[data-selected]",function(b){var c=a(this).data("data");d.getHighlightedResults().removeClass("select2-results__option--highlighted").attr("aria-selected","false"),d.trigger("results:focus",{data:c,element:a(this)})})},c.prototype.getHighlightedResults=function(){return this.$results.find(".select2-results__option--highlighted")},c.prototype.destroy=function(){this.$results.remove()},c.prototype.ensureHighlightVisible=function(){var a=this.getHighlightedResults();if(0!==a.length){var b=this.$results.find("[data-selected]"),c=b.index(a),d=this.$results.offset().top,e=a.offset().top,f=this.$results.scrollTop()+(e-d),g=e-d;f-=2*a.outerHeight(!1),c<=2?this.$results.scrollTop(0):(g>this.$results.outerHeight()||g<0)&&this.$results.scrollTop(f)}},c.prototype.template=function(b,c){var d=this.options.get("templateResult"),e=this.options.get("escapeMarkup"),f=d(b,c);null==f?c.style.display="none":"string"==typeof f?c.innerHTML=e(f):a(c).append(f)},c}),b.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),b.define("select2/selection/base",["jquery","../utils","../keys"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,b.Observable),d.prototype.render=function(){var b=a('<span class="select2-selection" aria-haspopup="true" aria-expanded="false"></span>');return this._tabindex=0,null!=this.$element.data("old-tabindex")?this._tabindex=this.$element.data("old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),b.attr("title",this.$element.attr("title")),b.attr("tabindex",this._tabindex),this.$selection=b,b},d.prototype.bind=function(a,b){var d=this,e=(a.id,a.id+"-results");this.options.get("minimumResultsForSearch");this.container=a,this.$selection.on("focus",function(a){d.trigger("focus",a)}),this.$selection.on("blur",function(a){d._handleBlur(a)}),this.$selection.on("keydown",function(a){d.trigger("keypress",a),a.which===c.SPACE&&a.preventDefault()}),a.on("results:focus",function(a){d.$selection.attr("aria-activedescendant",a.data._resultId)}),a.on("selection:update",function(a){d.update(a.data)}),a.on("open",function(){d.$selection.attr("aria-expanded","true"),d.$selection.attr("aria-owns",e),d._attachCloseHandler(a)}),a.on("close",function(){d.$selection.attr("aria-expanded","false"),d.$selection.removeAttr("aria-activedescendant"),d.$selection.removeAttr("aria-owns"),window.setTimeout(function(){d.$selection.focus()},1),d._detachCloseHandler(a)}),a.on("enable",function(){d.$selection.attr("tabindex",d._tabindex)}),a.on("disable",function(){d.$selection.attr("tabindex","-1")})},d.prototype._handleBlur=function(b){var c=this;window.setTimeout(function(){document.activeElement==c.$selection[0]||a.contains(c.$selection[0],document.activeElement)||c.trigger("blur",b)},1)},d.prototype._attachCloseHandler=function(b){a(document.body).on("mousedown.select2."+b.id,function(b){var c=a(b.target),d=c.closest(".select2");a(".select2.select2-container--open").each(function(){var b=a(this);this!=d[0]&&(b.data("element").select2("close"),setTimeout(function(){b.find("*:focus").blur(),c.focus()},1))})})},d.prototype._detachCloseHandler=function(b){a(document.body).off("mousedown.select2."+b.id)},d.prototype.position=function(a,b){b.find(".selection").append(a)},d.prototype.destroy=function(){this._detachCloseHandler(this.container)},d.prototype.update=function(a){throw new Error("The `update` method must be defined in child classes.")},d}),b.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(a,b,c,d){function e(){e.__super__.constructor.apply(this,arguments)}return c.Extend(e,b),e.prototype.render=function(){var a=e.__super__.render.call(this);return a.addClass("select2-selection--single"),a.html('<span class="select2-selection__rendered"></span><span class="select2-selection__arrow" role="presentation"><b role="presentation"></b></span>'),a},e.prototype.bind=function(a,b){var c=this;e.__super__.bind.apply(this,arguments);var d=a.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",d).attr("role","textbox").attr("aria-readonly","true"),this.$selection.attr("aria-labelledby",d),this.$selection.attr("role","combobox"),this.$selection.on("mousedown",function(a){1===a.which&&c.trigger("toggle",{originalEvent:a})}),this.$selection.on("focus",function(a){}),this.$selection.on("keydown",function(b){!a.isOpen()&&b.which>=48&&b.which<=90&&a.open()}),this.$selection.on("blur",function(a){}),a.on("focus",function(b){a.isOpen()||c.$selection.focus()}),a.on("selection:update",function(a){c.update(a.data)})},e.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},e.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},e.prototype.selectionContainer=function(){return a("<span></span>")},e.prototype.update=function(a){if(0===a.length)return void this.clear();var b=a[0],d=this.$selection.find(".select2-selection__rendered"),e=c.entityDecode(this.display(b,d));d.empty().text(e),d.prop("title",b.title||b.text)},e}),b.define("select2/selection/multiple",["jquery","./base","../utils"],function(a,b,c){function d(a,b){d.__super__.constructor.apply(this,arguments)}return c.Extend(d,b),d.prototype.render=function(){var a=d.__super__.render.call(this);return a.addClass("select2-selection--multiple"),a.html('<ul class="select2-selection__rendered" aria-live="polite" aria-relevant="additions removals" aria-atomic="true"></ul>'),a},d.prototype.bind=function(b,c){var e=this;d.__super__.bind.apply(this,arguments),this.$selection.on("click",function(a){e.trigger("toggle",{originalEvent:a})}),this.$selection.on("click",".select2-selection__choice__remove",function(b){if(!e.options.get("disabled")){var c=a(this),d=c.parent(),f=d.data("data");e.trigger("unselect",{originalEvent:b,data:f})}}),this.$selection.on("keydown",function(a){!b.isOpen()&&a.which>=48&&a.which<=90&&b.open()}),b.on("focus",function(){e.focusOnSearch()})},d.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()},d.prototype.display=function(a,b){var c=this.options.get("templateSelection");return this.options.get("escapeMarkup")(c(a,b))},d.prototype.selectionContainer=function(){return a('<li class="select2-selection__choice"><span class="select2-selection__choice__remove" role="presentation" aria-hidden="true">×</span></li>')},d.prototype.focusOnSearch=function(){var a=this;void 0!==a.$search&&setTimeout(function(){a._keyUpPrevented=!0,a.$search.focus()},1)},d.prototype.update=function(a){if(this.clear(),0!==a.length){for(var b=[],d=0;d<a.length;d++){var e=a[d],f=this.selectionContainer(),g=f.html(),h=this.display(e,f);"string"==typeof h&&(h=c.entityDecode(h.trim())),f.text(h),f.prepend(g),f.prop("title",e.title||e.text),f.data("data",e),b.push(f)}var i=this.$selection.find(".select2-selection__rendered");c.appendMany(i,b)}},d}),b.define("select2/selection/placeholder",["../utils"],function(a){function b(a,b,c){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c)}return b.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},b.prototype.createPlaceholder=function(b,c){var d=this.selectionContainer();return d.text(a.entityDecode(this.display(c))),d.addClass("select2-selection__placeholder").removeClass("select2-selection__choice"),d},b.prototype.update=function(a,b){var c=1==b.length&&b[0].id!=this.placeholder.id;if(b.length>1||c)return a.call(this,b);this.clear();var d=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append(d)},b}),b.define("select2/selection/allowClear",["jquery","../keys"],function(a,b){function c(){}return c.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),null==this.placeholder&&this.options.get("debug")&&window.console&&console.error&&console.error("Select2: The `allowClear` option should be used in combination with the `placeholder` option."),this.$selection.on("mousedown",".select2-selection__clear",function(a){d._handleClear(a)}),b.on("keypress",function(a){d._handleKeyboardClear(a,b)})},c.prototype._handleClear=function(a,b){if(!this.options.get("disabled")){var c=this.$selection.find(".select2-selection__clear");if(0!==c.length){b.stopPropagation();for(var d=c.data("data"),e=0;e<d.length;e++){var f={data:d[e]};if(this.trigger("unselect",f),f.prevented)return}this.$element.val(this.placeholder.id).trigger("change"),this.trigger("toggle",{})}}},c.prototype._handleKeyboardClear=function(a,c,d){d.isOpen()||c.which!=b.DELETE&&c.which!=b.BACKSPACE||this._handleClear(c)},c.prototype.update=function(b,c){if(b.call(this,c),!(this.$selection.find(".select2-selection__placeholder").length>0||0===c.length)){var d=a('<span class="select2-selection__clear">×</span>');d.data("data",c),this.$selection.find(".select2-selection__rendered").prepend(d)}},c}),b.define("select2/selection/search",["jquery","../utils","../keys"],function(a,b,c){function d(a,b,c){a.call(this,b,c)}return d.prototype.render=function(b){var c=a('<li class="select2-search select2-search--inline"><input class="select2-search__field" type="text" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="textbox" aria-autocomplete="list" /></li>');this.$searchContainer=c,this.$search=c.find("input");var d=b.call(this);return this._transferTabIndex(),d},d.prototype.bind=function(a,b,d){var e=this,f=b.id+"-results";a.call(this,b,d),b.on("open",function(){e.$search.attr("aria-owns",f),e.$search.trigger("focus")}),b.on("close",function(){e.$search.val(""),e.$search.removeAttr("aria-activedescendant"),e.$search.removeAttr("aria-owns"),e.$search.trigger("focus")}),b.on("enable",function(){e.$search.prop("disabled",!1),e._transferTabIndex()}),b.on("disable",function(){e.$search.prop("disabled",!0)}),b.on("focus",function(a){e.$search.trigger("focus")}),b.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.data._resultId)}),this.$selection.on("focusin",".select2-search--inline",function(a){e.trigger("focus",a)}),this.$selection.on("focusout",".select2-search--inline",function(a){e._handleBlur(a)}),this.$selection.on("keydown",".select2-search--inline",function(a){if(a.stopPropagation(),e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented(),a.which===c.BACKSPACE&&""===e.$search.val()){var d=e.$searchContainer.prev(".select2-selection__choice");if(d.length>0){var f=d.data("data");e.searchRemoveChoice(f),a.preventDefault()}}else a.which===c.ENTER&&(b.open(),a.preventDefault())});var g=document.documentMode,h=g&&g<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(a){if(h)return void e.$selection.off("input.search input.searchcheck");e.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(a){if(h&&"input"===a.type)return void e.$selection.off("input.search input.searchcheck");var b=a.which;b!=c.SHIFT&&b!=c.CTRL&&b!=c.ALT&&b!=c.TAB&&e.handleSearch(a)})},d.prototype._transferTabIndex=function(a){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},d.prototype.createPlaceholder=function(a,b){this.$search.attr("placeholder",b.text)},d.prototype.update=function(a,b){var c=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),a.call(this,b),this.$selection.find(".select2-selection__rendered").append(this.$searchContainer),this.resizeSearch(),c&&this.$search.focus()},d.prototype.handleSearch=function(){if(this.resizeSearch(),!this._keyUpPrevented){var a=this.$search.val();this.trigger("query",{term:a})}this._keyUpPrevented=!1},d.prototype.searchRemoveChoice=function(a,b){this.trigger("unselect",{data:b}),this.$search.val(b.text),this.handleSearch()},d.prototype.resizeSearch=function(){this.$search.css("width","25px");var a="";if(""!==this.$search.attr("placeholder"))a=this.$selection.find(".select2-selection__rendered").innerWidth();else{a=.75*(this.$search.val().length+1)+"em"}this.$search.css("width",a)},d}),b.define("select2/selection/eventRelay",["jquery"],function(a){function b(){}return b.prototype.bind=function(b,c,d){var e=this,f=["open","opening","close","closing","select","selecting","unselect","unselecting"],g=["opening","closing","selecting","unselecting"];b.call(this,c,d),c.on("*",function(b,c){if(-1!==a.inArray(b,f)){c=c||{};var d=a.Event("select2:"+b,{params:c});e.$element.trigger(d),-1!==a.inArray(b,g)&&(c.prevented=d.isDefaultPrevented())}})},b}),b.define("select2/translation",["jquery","require"],function(a,b){function c(a){this.dict=a||{}}return c.prototype.all=function(){return this.dict},c.prototype.get=function(a){return this.dict[a]},c.prototype.extend=function(b){this.dict=a.extend({},b.all(),this.dict)},c._cache={},c.loadPath=function(a){if(!(a in c._cache)){var d=b(a);c._cache[a]=d}return new c(c._cache[a])},c}),b.define("select2/diacritics",[],function(){return{"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"}}),b.define("select2/data/base",["../utils"],function(a){function b(a,c){b.__super__.constructor.call(this)}return a.Extend(b,a.Observable),b.prototype.current=function(a){throw new Error("The `current` method must be defined in child classes.")},b.prototype.query=function(a,b){throw new Error("The `query` method must be defined in child classes.")},b.prototype.bind=function(a,b){},b.prototype.destroy=function(){},b.prototype.generateResultId=function(b,c){var d="";return d+=null!=b?b.id:a.generateChars(4),d+="-result-",d+=a.generateChars(4),null!=c.id?d+="-"+c.id.toString():d+="-"+a.generateChars(4),d},b}),b.define("select2/data/select",["./base","../utils","jquery"],function(a,b,c){function d(a,b){this.$element=a,this.options=b,d.__super__.constructor.call(this)}return b.Extend(d,a),d.prototype.current=function(a){var b=[],d=this;this.$element.find(":selected").each(function(){var a=c(this),e=d.item(a);b.push(e)}),a(b)},d.prototype.select=function(a){var b=this;if(a.selected=!0,c(a.element).is("option"))return a.element.selected=!0,void this.$element.trigger("change");if(this.$element.prop("multiple"))this.current(function(d){var e=[];a=[a],a.push.apply(a,d);for(var f=0;f<a.length;f++){var g=a[f].id;-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")});else{var d=a.id;this.$element.val(d),this.$element.trigger("change")}},d.prototype.unselect=function(a){var b=this;if(this.$element.prop("multiple")){if(a.selected=!1,c(a.element).is("option"))return a.element.selected=!1,void this.$element.trigger("change");this.current(function(d){for(var e=[],f=0;f<d.length;f++){var g=d[f].id;g!==a.id&&-1===c.inArray(g,e)&&e.push(g)}b.$element.val(e),b.$element.trigger("change")})}},d.prototype.bind=function(a,b){var c=this;this.container=a,a.on("select",function(a){c.select(a.data)}),a.on("unselect",function(a){c.unselect(a.data)})},d.prototype.destroy=function(){this.$element.find("*").each(function(){c.removeData(this,"data")})},d.prototype.query=function(a,b){var d=[],e=this;this.$element.children().each(function(){var b=c(this);if(b.is("option")||b.is("optgroup")){var f=e.item(b),g=e.matches(a,f);null!==g&&d.push(g)}}),b({results:d})},d.prototype.addOptions=function(a){b.appendMany(this.$element,a)},d.prototype.option=function(a){var b;a.children?(b=document.createElement("optgroup"),b.label=a.text):(b=document.createElement("option"),void 0!==b.textContent?b.textContent=a.text:b.innerText=a.text),void 0!==a.id&&(b.value=a.id),a.disabled&&(b.disabled=!0),a.selected&&(b.selected=!0),a.title&&(b.title=a.title);var d=c(b),e=this._normalizeItem(a);return e.element=b,c.data(b,"data",e),d},d.prototype.item=function(a){var b={};if(null!=(b=c.data(a[0],"data")))return b;if(a.is("option"))b={id:a.val(),text:a.text(),disabled:a.prop("disabled"),selected:a.prop("selected"),title:a.prop("title")};else if(a.is("optgroup")){b={text:a.prop("label"),children:[],title:a.prop("title")};for(var d=a.children("option"),e=[],f=0;f<d.length;f++){var g=c(d[f]),h=this.item(g);e.push(h)}b.children=e}return b=this._normalizeItem(b),b.element=a[0],c.data(a[0],"data",b),b},d.prototype._normalizeItem=function(a){c.isPlainObject(a)||(a={id:a,text:a}),a=c.extend({},{text:""},a);var b={selected:!1,disabled:!1};return null!=a.id&&(a.id=a.id.toString()),null!=a.text&&(a.text=a.text.toString()),null==a._resultId&&a.id&&(a._resultId=this.generateResultId(this.container,a)),c.extend({},b,a)},d.prototype.matches=function(a,b){return this.options.get("matcher")(a,b)},d}),b.define("select2/data/array",["./select","../utils","jquery"],function(a,b,c){function d(a,b){var c=b.get("data")||[];d.__super__.constructor.call(this,a,b),this.addOptions(this.convertToOptions(c))}return b.Extend(d,a),d.prototype.select=function(a){var b=this.$element.find("option").filter(function(b,c){return c.value==a.id.toString()});0===b.length&&(b=this.option(a),this.addOptions(b)),d.__super__.select.call(this,a)},d.prototype.convertToOptions=function(a){function d(a){return function(){return c(this).val()==a.id}}for(var e=this,f=this.$element.find("option"),g=f.map(function(){return e.item(c(this)).id}).get(),h=[],i=0;i<a.length;i++){var j=this._normalizeItem(a[i]);if(c.inArray(j.id,g)>=0){var k=f.filter(d(j)),l=this.item(k),m=c.extend(!0,{},j,l),n=this.option(m);k.replaceWith(n)}else{var o=this.option(j);if(j.children){var p=this.convertToOptions(j.children);b.appendMany(o,p)}h.push(o)}}return h},d}),b.define("select2/data/ajax",["./array","../utils","jquery"],function(a,b,c){function d(a,b){this.ajaxOptions=this._applyDefaults(b.get("ajax")),null!=this.ajaxOptions.processResults&&(this.processResults=this.ajaxOptions.processResults),d.__super__.constructor.call(this,a,b)}return b.Extend(d,a),d.prototype._applyDefaults=function(a){var b={data:function(a){return c.extend({},a,{q:a.term})},transport:function(a,b,d){var e=c.ajax(a);return e.then(b),e.fail(d),e}};return c.extend({},b,a,!0)},d.prototype.processResults=function(a){return a},d.prototype.query=function(a,b){function d(){var d=f.transport(f,function(d){var f=e.processResults(d,a);e.options.get("debug")&&window.console&&console.error&&(f&&f.results&&c.isArray(f.results)||console.error("Select2: The AJAX results did not return an array in the `results` key of the response.")),b(f),e.container.focusOnActiveElement()},function(){d.status&&"0"===d.status||e.trigger("results:message",{message:"errorLoading"})});e._request=d}var e=this;null!=this._request&&(c.isFunction(this._request.abort)&&this._request.abort(),this._request=null);var f=c.extend({type:"GET"},this.ajaxOptions);"function"==typeof f.url&&(f.url=f.url.call(this.$element,a)),"function"==typeof f.data&&(f.data=f.data.call(this.$element,a)),this.ajaxOptions.delay&&null!=a.term?(this._queryTimeout&&window.clearTimeout(this._queryTimeout),this._queryTimeout=window.setTimeout(d,this.ajaxOptions.delay)):d()},d}),b.define("select2/data/tags",["jquery"],function(a){function b(b,c,d){var e=d.get("tags"),f=d.get("createTag");void 0!==f&&(this.createTag=f);var g=d.get("insertTag");if(void 0!==g&&(this.insertTag=g),b.call(this,c,d),a.isArray(e))for(var h=0;h<e.length;h++){var i=e[h],j=this._normalizeItem(i),k=this.option(j);this.$element.append(k)}}return b.prototype.query=function(a,b,c){function d(a,f){for(var g=a.results,h=0;h<g.length;h++){var i=g[h],j=null!=i.children&&!d({results:i.children},!0);if((i.text||"").toUpperCase()===(b.term||"").toUpperCase()||j)return!f&&(a.data=g,void c(a))}if(f)return!0;var k=e.createTag(b);if(null!=k){var l=e.option(k);l.attr("data-select2-tag",!0),e.addOptions([l]),e.insertTag(g,k)}a.results=g,c(a)}var e=this;if(this._removeOldTags(),null==b.term||null!=b.page)return void a.call(this,b,c);a.call(this,b,d)},b.prototype.createTag=function(b,c){var d=a.trim(c.term);return""===d?null:{id:d,text:d}},b.prototype.insertTag=function(a,b,c){b.unshift(c)},b.prototype._removeOldTags=function(b){this._lastTag;this.$element.find("option[data-select2-tag]").each(function(){this.selected||a(this).remove()})},b}),b.define("select2/data/tokenizer",["jquery"],function(a){function b(a,b,c){var d=c.get("tokenizer");void 0!==d&&(this.tokenizer=d),a.call(this,b,c)}return b.prototype.bind=function(a,b,c){a.call(this,b,c),this.$search=b.dropdown.$search||b.selection.$search||c.find(".select2-search__field")},b.prototype.query=function(b,c,d){function e(b){var c=g._normalizeItem(b);if(!g.$element.find("option").filter(function(){return a(this).val()===c.id}).length){var d=g.option(c);d.attr("data-select2-tag",!0),g._removeOldTags(),g.addOptions([d])}f(c)}function f(a){g.trigger("select",{data:a})}var g=this;c.term=c.term||"";var h=this.tokenizer(c,this.options,e);h.term!==c.term&&(this.$search.length&&(this.$search.val(h.term),this.$search.focus()),c.term=h.term),b.call(this,c,d)},b.prototype.tokenizer=function(b,c,d,e){for(var f=d.get("tokenSeparators")||[],g=c.term,h=0,i=this.createTag||function(a){return{id:a.term,text:a.term}};h<g.length;){var j=g[h];if(-1!==a.inArray(j,f)){var k=g.substr(0,h),l=a.extend({},c,{term:k}),m=i(l);null!=m?(e(m),g=g.substr(h+1)||"",h=0):h++}else h++}return{term:g}},b}),b.define("select2/data/minimumInputLength",[],function(){function a(a,b,c){this.minimumInputLength=c.get("minimumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){if(b.term=b.term||"",b.term.length<this.minimumInputLength)return void this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumInputLength",[],function(){function a(a,b,c){this.maximumInputLength=c.get("maximumInputLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){if(b.term=b.term||"",this.maximumInputLength>0&&b.term.length>this.maximumInputLength)return void this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:b.term,params:b}});a.call(this,b,c)},a}),b.define("select2/data/maximumSelectionLength",[],function(){function a(a,b,c){this.maximumSelectionLength=c.get("maximumSelectionLength"),a.call(this,b,c)}return a.prototype.query=function(a,b,c){var d=this;this.current(function(e){var f=null!=e?e.length:0;if(d.maximumSelectionLength>0&&f>=d.maximumSelectionLength)return void d.trigger("results:message",{message:"maximumSelected",args:{maximum:d.maximumSelectionLength}});a.call(d,b,c)})},a}),b.define("select2/dropdown",["jquery","./utils"],function(a,b){function c(a,b){this.$element=a,this.options=b,c.__super__.constructor.call(this)}return b.Extend(c,b.Observable),c.prototype.render=function(){var b=a('<span class="select2-dropdown"><span class="select2-results"></span></span>');return b.attr("dir",this.options.get("dir")),this.$dropdown=b,b},c.prototype.bind=function(){},c.prototype.position=function(a,b){},c.prototype.destroy=function(){this.$dropdown.remove()},c}),b.define("select2/dropdown/search",["jquery","../utils"],function(a,b){function c(){}return c.prototype.render=function(b){var c=b.call(this),d=a('<span class="select2-search select2-search--dropdown"><input class="select2-search__field" type="text" tabindex="-1" autocomplete="off" autocorrect="off" autocapitalize="none" spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="true" /></span>');return this.$searchContainer=d,this.$search=d.find("input"),c.prepend(d),c},c.prototype.bind=function(b,c,d){var e=this,f=c.id+"-results";b.call(this,c,d),this.$search.on("keydown",function(a){e.trigger("keypress",a),e._keyUpPrevented=a.isDefaultPrevented()}),this.$search.on("input",function(b){a(this).off("keyup")}),this.$search.on("keyup input",function(a){e.handleSearch(a)}),c.on("open",function(){e.$search.attr("tabindex",0),e.$search.attr("aria-owns",f),e.$search.focus(),window.setTimeout(function(){e.$search.focus()},0)}),c.on("close",function(){e.$search.attr("tabindex",-1),e.$search.removeAttr("aria-activedescendant"),e.$search.removeAttr("aria-owns"),e.$search.val("")}),c.on("focus",function(){c.isOpen()||e.$search.focus()}),c.on("results:all",function(a){if(null==a.query.term||""===a.query.term){e.showSearch(a)?e.$searchContainer.removeClass("select2-search--hide"):e.$searchContainer.addClass("select2-search--hide")}}),c.on("results:focus",function(a){e.$search.attr("aria-activedescendant",a.data._resultId)})},c.prototype.handleSearch=function(a){if(!this._keyUpPrevented){var b=this.$search.val();this.trigger("query",{term:b})}this._keyUpPrevented=!1},c.prototype.showSearch=function(a,b){return!0},c}),b.define("select2/dropdown/hidePlaceholder",[],function(){function a(a,b,c,d){this.placeholder=this.normalizePlaceholder(c.get("placeholder")),a.call(this,b,c,d)}return a.prototype.append=function(a,b){b.results=this.removePlaceholder(b.results),a.call(this,b)},a.prototype.normalizePlaceholder=function(a,b){return"string"==typeof b&&(b={id:"",text:b}),b},a.prototype.removePlaceholder=function(a,b){for(var c=b.slice(0),d=b.length-1;d>=0;d--){var e=b[d];this.placeholder.id===e.id&&c.splice(d,1)}return c},a}),b.define("select2/dropdown/infiniteScroll",["jquery"],function(a){function b(a,b,c,d){this.lastParams={},a.call(this,b,c,d),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return b.prototype.append=function(a,b){this.$loadingMore.remove(),this.loading=!1,a.call(this,b),this.showLoadingMore(b)&&this.$results.append(this.$loadingMore)},b.prototype.bind=function(b,c,d){var e=this;b.call(this,c,d),c.on("query",function(a){e.lastParams=a,e.loading=!0}),c.on("query:append",function(a){e.lastParams=a,e.loading=!0}),this.$results.on("scroll",function(){var b=a.contains(document.documentElement,e.$loadingMore[0]);if(!e.loading&&b){e.$results.offset().top+e.$results.outerHeight(!1)+50>=e.$loadingMore.offset().top+e.$loadingMore.outerHeight(!1)&&e.loadMore()}})},b.prototype.loadMore=function(){this.loading=!0;var b=a.extend({},{page:1},this.lastParams);b.page++,this.trigger("query:append",b)},b.prototype.showLoadingMore=function(a,b){return b.pagination&&b.pagination.more},b.prototype.createLoadingMore=function(){var b=a('<li class="select2-results__option select2-results__option--load-more"role="option" aria-disabled="true"></li>'),c=this.options.get("translations").get("loadingMore");return b.html(c(this.lastParams)),b},b}),b.define("select2/dropdown/attachBody",["jquery","../utils"],function(a,b){function c(b,c,d){this.$dropdownParent=d.get("dropdownParent")||a(document.body),b.call(this,c,d)}return c.prototype.bind=function(a,b,c){var d=this,e=!1;a.call(this,b,c),b.on("open",function(){d._showDropdown(),d._attachPositioningHandler(b),e||(e=!0,b.on("results:all",function(){d._positionDropdown(),d._resizeDropdown()}),b.on("results:append",function(){d._positionDropdown(),d._resizeDropdown()}))}),b.on("close",function(){d._hideDropdown(),d._detachPositioningHandler(b)}),this.$dropdownContainer.on("mousedown",function(a){a.stopPropagation()})},c.prototype.destroy=function(a){a.call(this),this.$dropdownContainer.remove()},c.prototype.position=function(a,b,c){b.attr("class",c.attr("class")),b.removeClass("select2"),b.addClass("select2-container--open"),b.css({position:"absolute",top:-999999}),this.$container=c},c.prototype.render=function(b){var c=a("<span></span>"),d=b.call(this);return c.append(d),this.$dropdownContainer=c,c},c.prototype._hideDropdown=function(a){this.$dropdownContainer.detach()},c.prototype._attachPositioningHandler=function(c,d){var e=this,f="scroll.select2."+d.id,g="resize.select2."+d.id,h="orientationchange.select2."+d.id,i=this.$container.parents().filter(b.hasScroll);i.each(function(){a(this).data("select2-scroll-position",{x:a(this).scrollLeft(),y:a(this).scrollTop()})}),i.on(f,function(b){var c=a(this).data("select2-scroll-position");a(this).scrollTop(c.y)}),a(window).on(f+" "+g+" "+h,function(a){e._positionDropdown(),e._resizeDropdown()})},c.prototype._detachPositioningHandler=function(c,d){var e="scroll.select2."+d.id,f="resize.select2."+d.id,g="orientationchange.select2."+d.id;this.$container.parents().filter(b.hasScroll).off(e),a(window).off(e+" "+f+" "+g)},c.prototype._positionDropdown=function(){var b=a(window),c=this.$dropdown.hasClass("select2-dropdown--above"),d=this.$dropdown.hasClass("select2-dropdown--below"),e=null,f=this.$container.offset();f.bottom=f.top+this.$container.outerHeight(!1);var g={height:this.$container.outerHeight(!1)};g.top=f.top,g.bottom=f.top+g.height;var h={height:this.$dropdown.outerHeight(!1)},i={top:b.scrollTop(),bottom:b.scrollTop()+b.height()},j=i.top<f.top-h.height,k=i.bottom>f.bottom+h.height,l={left:f.left,top:g.bottom},m=this.$dropdownParent;"static"===m.css("position")&&(m=m.offsetParent());var n=m.offset();l.top-=n.top,l.left-=n.left,c||d||(e="below"),k||!j||c?!j&&k&&c&&(e="below"):e="above",("above"==e||c&&"below"!==e)&&(l.top=g.top-n.top-h.height),null!=e&&(this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+e),this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+e)),this.$dropdownContainer.css(l)},c.prototype._resizeDropdown=function(){var a={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(a.minWidth=a.width,a.position="relative",a.width="auto"),this.$dropdown.css(a)},c.prototype._showDropdown=function(a){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},c}),b.define("select2/dropdown/minimumResultsForSearch",[],function(){function a(b){for(var c=0,d=0;d<b.length;d++){var e=b[d];e.children?c+=a(e.children):c++}return c}function b(a,b,c,d){this.minimumResultsForSearch=c.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),a.call(this,b,c,d)}return b.prototype.showSearch=function(b,c){return!(a(c.data.results)<this.minimumResultsForSearch)&&b.call(this,c)},b}),b.define("select2/dropdown/selectOnClose",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("close",function(a){d._handleSelectOnClose(a)})},a.prototype._handleSelectOnClose=function(a,b){if(b&&null!=b.originalSelect2Event){var c=b.originalSelect2Event;if("select"===c._type||"unselect"===c._type)return}var d=this.getHighlightedResults();if(!(d.length<1)){var e=d.data("data");null!=e.element&&e.element.selected||null==e.element&&e.selected||this.trigger("select",{data:e})}},a}),b.define("select2/dropdown/closeOnSelect",[],function(){function a(){}return a.prototype.bind=function(a,b,c){var d=this;a.call(this,b,c),b.on("select",function(a){d._selectTriggered(a)}),b.on("unselect",function(a){d._selectTriggered(a)})},a.prototype._selectTriggered=function(a,b){var c=b.originalEvent;c&&c.ctrlKey||this.trigger("close",{originalEvent:c,originalSelect2Event:b})},a}),b.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(a){var b=a.input.length-a.maximum,c="Please delete "+b+" character";return 1!=b&&(c+="s"),c},inputTooShort:function(a){return"Please enter "+(a.minimum-a.input.length)+" or more characters"},loadingMore:function(){return"Loading more results…"},maximumSelected:function(a){var b="You can only select "+a.maximum+" item";return 1!=a.maximum&&(b+="s"),b},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}}),b.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C){function D(){this.reset()}return D.prototype.apply=function(l){if(l=a.extend(!0,{},this.defaults,l),null==l.dataAdapter){if(null!=l.ajax?l.dataAdapter=o:null!=l.data?l.dataAdapter=n:l.dataAdapter=m,l.minimumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,r)),l.maximumInputLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,s)),l.maximumSelectionLength>0&&(l.dataAdapter=j.Decorate(l.dataAdapter,t)),l.tags&&(l.dataAdapter=j.Decorate(l.dataAdapter,p)),null==l.tokenSeparators&&null==l.tokenizer||(l.dataAdapter=j.Decorate(l.dataAdapter,q)),null!=l.query){var C=b(l.amdBase+"compat/query");l.dataAdapter=j.Decorate(l.dataAdapter,C)}if(null!=l.initSelection){var D=b(l.amdBase+"compat/initSelection");l.dataAdapter=j.Decorate(l.dataAdapter,D)}}if(null==l.resultsAdapter&&(l.resultsAdapter=c,null!=l.ajax&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,x)),null!=l.placeholder&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,w)),l.selectOnClose&&(l.resultsAdapter=j.Decorate(l.resultsAdapter,A))),null==l.dropdownAdapter){if(l.multiple)l.dropdownAdapter=u;else{var E=j.Decorate(u,v);l.dropdownAdapter=E}if(0!==l.minimumResultsForSearch&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,z)),l.closeOnSelect&&(l.dropdownAdapter=j.Decorate(l.dropdownAdapter,B)),null!=l.dropdownCssClass||null!=l.dropdownCss||null!=l.adaptDropdownCssClass){var F=b(l.amdBase+"compat/dropdownCss");l.dropdownAdapter=j.Decorate(l.dropdownAdapter,F)}l.dropdownAdapter=j.Decorate(l.dropdownAdapter,y)}if(null==l.selectionAdapter){if(l.multiple?l.selectionAdapter=e:l.selectionAdapter=d,null!=l.placeholder&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,f)),l.allowClear&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,g)),l.multiple&&(l.selectionAdapter=j.Decorate(l.selectionAdapter,h)),null!=l.containerCssClass||null!=l.containerCss||null!=l.adaptContainerCssClass){var G=b(l.amdBase+"compat/containerCss");l.selectionAdapter=j.Decorate(l.selectionAdapter,G)}l.selectionAdapter=j.Decorate(l.selectionAdapter,i)}if("string"==typeof l.language)if(l.language.indexOf("-")>0){var H=l.language.split("-"),I=H[0];l.language=[l.language,I]}else l.language=[l.language];if(a.isArray(l.language)){var J=new k;l.language.push("en");for(var K=l.language,L=0;L<K.length;L++){var M=K[L],N={};try{N=k.loadPath(M)}catch(a){try{M=this.defaults.amdLanguageBase+M,N=k.loadPath(M)}catch(a){l.debug&&window.console&&console.warn&&console.warn('Select2: The language file for "'+M+'" could not be automatically loaded. A fallback will be used instead.');continue}}J.extend(N)}l.translations=J}else{var O=k.loadPath(this.defaults.amdLanguageBase+"en"),P=new k(l.language);P.extend(O),l.translations=P}return l},D.prototype.reset=function(){function b(a){function b(a){return l[a]||a}return a.replace(/[^\u0000-\u007E]/g,b)}function c(d,e){if(""===a.trim(d.term))return e;if(e.children&&e.children.length>0){for(var f=a.extend(!0,{},e),g=e.children.length-1;g>=0;g--){null==c(d,e.children[g])&&f.children.splice(g,1)}return f.children.length>0?f:c(d,f)}var h=b(e.text).toUpperCase(),i=b(d.term).toUpperCase();return h.indexOf(i)>-1?e:null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:!0,debug:!1,dropdownAutoWidth:!1,escapeMarkup:j.escapeMarkup,language:C,matcher:c,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:!1,sorter:function(a){return a},templateResult:function(a){return a.text},templateSelection:function(a){return a.text},theme:"default",width:"resolve"}},D.prototype.set=function(b,c){var d=a.camelCase(b),e={};e[d]=c;var f=j._convertData(e);a.extend(this.defaults,f)},new D}),b.define("select2/options",["require","jquery","./defaults","./utils"],function(a,b,c,d){function e(b,e){if(this.options=b,null!=e&&this.fromElement(e),this.options=c.apply(this.options),e&&e.is("input")){var f=a(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=d.Decorate(this.options.dataAdapter,f)}}return e.prototype.fromElement=function(a){var c=["select2"];null==this.options.multiple&&(this.options.multiple=a.prop("multiple")),null==this.options.disabled&&(this.options.disabled=a.prop("disabled")),null==this.options.language&&(a.prop("lang")?this.options.language=a.prop("lang").toLowerCase():a.closest("[lang]").prop("lang")&&(this.options.language=a.closest("[lang]").prop("lang"))),null==this.options.dir&&(a.prop("dir")?this.options.dir=a.prop("dir"):a.closest("[dir]").prop("dir")?this.options.dir=a.closest("[dir]").prop("dir"):this.options.dir="ltr"),a.prop("disabled",this.options.disabled),a.prop("multiple",this.options.multiple),a.data("select2Tags")&&(this.options.debug&&window.console&&console.warn&&console.warn('Select2: The `data-select2-tags` attribute has been changed to use the `data-data` and `data-tags="true"` attributes and will be removed in future versions of Select2.'),a.data("data",a.data("select2Tags")),a.data("tags",!0)),a.data("ajaxUrl")&&(this.options.debug&&window.console&&console.warn&&console.warn("Select2: The `data-ajax-url` attribute has been changed to `data-ajax--url` and support for the old attribute will be removed in future versions of Select2."),a.attr("ajax--url",a.data("ajaxUrl")),a.data("ajax--url",a.data("ajaxUrl")));var e={};e=b.fn.jquery&&"1."==b.fn.jquery.substr(0,2)&&a[0].dataset?b.extend(!0,{},a[0].dataset,a.data()):a.data();var f=b.extend(!0,{},e);f=d._convertData(f);for(var g in f)b.inArray(g,c)>-1||(b.isPlainObject(this.options[g])?b.extend(this.options[g],f[g]):this.options[g]=f[g]);return this},e.prototype.get=function(a){return this.options[a]},e.prototype.set=function(a,b){this.options[a]=b},e}),b.define("select2/core",["jquery","./options","./utils","./keys"],function(a,b,c,d){var e=function(a,c){null!=a.data("select2")&&a.data("select2").destroy(),this.$element=a,this.id=this._generateId(a),c=c||{},this.options=new b(c,a),e.__super__.constructor.call(this);var d=a.attr("tabindex")||0;a.data("old-tabindex",d),a.attr("tabindex","-1");var f=this.options.get("dataAdapter");this.dataAdapter=new f(a,this.options);var g=this.render();this._placeContainer(g);var h=this.options.get("selectionAdapter");this.selection=new h(a,this.options),this.$selection=this.selection.render(),this.selection.position(this.$selection,g);var i=this.options.get("dropdownAdapter");this.dropdown=new i(a,this.options),this.$dropdown=this.dropdown.render(),this.dropdown.position(this.$dropdown,g);var j=this.options.get("resultsAdapter");this.results=new j(a,this.options,this.dataAdapter),this.$results=this.results.render(),this.results.position(this.$results,this.$dropdown);var k=this;this._bindAdapters(),this._registerDomEvents(),this._registerDataEvents(),this._registerSelectionEvents(),this._registerDropdownEvents(),this._registerResultsEvents(),this._registerEvents(),this.dataAdapter.current(function(a){k.trigger("selection:update",{data:a})}),a.addClass("select2-hidden-accessible"),a.attr("aria-hidden","true"),this._syncAttributes(),a.data("select2",this)};return c.Extend(e,c.Observable),e.prototype._generateId=function(a){var b="";return b=null!=a.attr("id")?a.attr("id"):null!=a.attr("name")?a.attr("name")+"-"+c.generateChars(2):c.generateChars(4),b=b.replace(/(:|\.|\[|\]|,)/g,""),b="select2-"+b},e.prototype._placeContainer=function(a){a.insertAfter(this.$element);var b=this._resolveWidth(this.$element,this.options.get("width"));null!=b&&a.css("width",b)},e.prototype._resolveWidth=function(a,b){var c=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if("resolve"==b){var d=this._resolveWidth(a,"style");return null!=d?d:this._resolveWidth(a,"element")}if("element"==b){var e=a.outerWidth(!1);return e<=0?"auto":e+"px"}if("style"==b){var f=a.attr("style");if("string"!=typeof f)return null;for(var g=f.split(";"),h=0,i=g.length;h<i;h+=1){var j=g[h].replace(/\s/g,""),k=j.match(c);if(null!==k&&k.length>=1)return k[1]}return null}return b},e.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container),this.selection.bind(this,this.$container),this.dropdown.bind(this,this.$container),this.results.bind(this,this.$container)},e.prototype._registerDomEvents=function(){var b=this;this.$element.on("change.select2",function(){b.dataAdapter.current(function(a){b.trigger("selection:update",{data:a})})}),this.$element.on("focus.select2",function(a){b.trigger("focus",a)}),this._syncA=c.bind(this._syncAttributes,this),this._syncS=c.bind(this._syncSubtree,this),this.$element[0].attachEvent&&this.$element[0].attachEvent("onpropertychange",this._syncA);var d=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;null!=d?(this._observer=new d(function(c){a.each(c,b._syncA),a.each(c,b._syncS)}),this._observer.observe(this.$element[0],{attributes:!0,childList:!0,subtree:!1})):this.$element[0].addEventListener&&(this.$element[0].addEventListener("DOMAttrModified",b._syncA,!1),this.$element[0].addEventListener("DOMNodeInserted",b._syncS,!1),this.$element[0].addEventListener("DOMNodeRemoved",b._syncS,!1))},e.prototype._registerDataEvents=function(){var a=this;this.dataAdapter.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerSelectionEvents=function(){var b=this,c=["toggle","focus"];this.selection.on("toggle",function(){b.toggleDropdown()}),this.selection.on("focus",function(a){b.focus(a)}),this.selection.on("*",function(d,e){-1===a.inArray(d,c)&&b.trigger(d,e)})},e.prototype._registerDropdownEvents=function(){var a=this;this.dropdown.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerResultsEvents=function(){var a=this;this.results.on("*",function(b,c){a.trigger(b,c)})},e.prototype._registerEvents=function(){var b=this;this.on("open",function(){b.$container.addClass("select2-container--open")}),this.on("close",function(){b.$container.removeClass("select2-container--open")}),this.on("enable",function(){b.$container.removeClass("select2-container--disabled")}),this.on("disable",function(){b.$container.addClass("select2-container--disabled")}),this.on("blur",function(){b.$container.removeClass("select2-container--focus")}),this.on("query",function(a){b.isOpen()||b.trigger("open",{}),this.dataAdapter.query(a,function(c){b.trigger("results:all",{data:c,query:a})})}),this.on("query:append",function(a){this.dataAdapter.query(a,function(c){b.trigger("results:append",{data:c,query:a})})}),this.on("open",function(){setTimeout(function(){b.focusOnActiveElement()},1)}),a(document).on("keydown",function(a){var c=a.which;if(b.isOpen()){c===d.ESC||c===d.UP&&a.altKey?(b.close(),a.preventDefault()):c===d.ENTER||c===d.TAB?(b.trigger("results:select",{}),a.preventDefault()):c===d.SPACE&&a.ctrlKey?(b.trigger("results:toggle",{}),a.preventDefault()):c===d.UP?(b.trigger("results:previous",{}),a.preventDefault()):c===d.DOWN&&(b.trigger("results:next",{}),a.preventDefault());var e=b.$dropdown.find(".select2-search__field");e.length||(e=b.$container.find(".select2-search__field")),c===d.DOWN||c===d.UP?b.focusOnActiveElement():(e.focus(),setTimeout(function(){b.focusOnActiveElement()},1e3))}else b.hasFocus()&&(c!==d.ENTER&&c!==d.SPACE&&c!==d.DOWN||(b.open(),a.preventDefault()))})},e.prototype.focusOnActiveElement=function(){this.isOpen()&&!c.isTouchscreen()&&this.$results.find("li.select2-results__option--highlighted").focus()},e.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled")),this.options.get("disabled")?(this.isOpen()&&this.close(),this.trigger("disable",{})):this.trigger("enable",{})},e.prototype._syncSubtree=function(a,b){var c=!1,d=this;if(!a||!a.target||"OPTION"===a.target.nodeName||"OPTGROUP"===a.target.nodeName){if(b)if(b.addedNodes&&b.addedNodes.length>0)for(var e=0;e<b.addedNodes.length;e++){var f=b.addedNodes[e];f.selected&&(c=!0)}else b.removedNodes&&b.removedNodes.length>0&&(c=!0);else c=!0;c&&this.dataAdapter.current(function(a){d.trigger("selection:update",{data:a})})}},e.prototype.trigger=function(a,b){var c=e.__super__.trigger,d={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(void 0===b&&(b={}),a in d){var f=d[a],g={prevented:!1,name:a,args:b};if(c.call(this,f,g),g.prevented)return void(b.prevented=!0)}c.call(this,a,b)},e.prototype.toggleDropdown=function(){this.options.get("disabled")||(this.isOpen()?this.close():this.open())},e.prototype.open=function(){this.isOpen()||this.trigger("query",{})},e.prototype.close=function(){this.isOpen()&&this.trigger("close",{})},e.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")},e.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")},e.prototype.focus=function(a){this.hasFocus()||(this.$container.addClass("select2-container--focus"),this.trigger("focus",{}))},e.prototype.enable=function(a){this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("enable")` method has been deprecated and will be removed in later Select2 versions. Use $element.prop("disabled") instead.'),null!=a&&0!==a.length||(a=[!0]);var b=!a[0];this.$element.prop("disabled",b)},e.prototype.data=function(){this.options.get("debug")&&arguments.length>0&&window.console&&console.warn&&console.warn('Select2: Data can no longer be set using `select2("data")`. You should consider setting the value instead using `$element.val()`.');var a=[];return this.dataAdapter.current(function(b){a=b}),a},e.prototype.val=function(b){if(this.options.get("debug")&&window.console&&console.warn&&console.warn('Select2: The `select2("val")` method has been deprecated and will be removed in later Select2 versions. Use $element.val() instead.'),null==b||0===b.length)return this.$element.val();var c=b[0];a.isArray(c)&&(c=a.map(c,function(a){return a.toString()})),this.$element.val(c).trigger("change")},e.prototype.destroy=function(){this.$container.remove(),this.$element[0].detachEvent&&this.$element[0].detachEvent("onpropertychange",this._syncA),null!=this._observer?(this._observer.disconnect(),this._observer=null):this.$element[0].removeEventListener&&(this.$element[0].removeEventListener("DOMAttrModified",this._syncA,!1),this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,!1),this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,!1)),this._syncA=null,this._syncS=null,this.$element.off(".select2"),this.$element.attr("tabindex",this.$element.data("old-tabindex")),this.$element.removeClass("select2-hidden-accessible"),this.$element.attr("aria-hidden","false"),this.$element.removeData("select2"),this.dataAdapter.destroy(),this.selection.destroy(),this.dropdown.destroy(),this.results.destroy(),this.dataAdapter=null,this.selection=null,this.dropdown=null,this.results=null},e.prototype.render=function(){var b=a('<span class="select2 select2-container"><span class="selection"></span><span class="dropdown-wrapper" aria-hidden="true"></span></span>');return b.attr("dir",this.options.get("dir")),this.$container=b,this.$container.addClass("select2-container--"+this.options.get("theme")),b.data("element",this.$element),b},e}),b.define("select2/compat/utils",["jquery"],function(a){function b(b,c,d){var e,f,g=[];e=a.trim(b.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0===this.indexOf("select2-")&&g.push(this)})),e=a.trim(c.attr("class")),e&&(e=""+e,a(e.split(/\s+/)).each(function(){0!==this.indexOf("select2-")&&null!=(f=d(this))&&g.push(f)})),b.attr("class",g.join(" "))}return{syncCssClasses:b}}),b.define("select2/compat/containerCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("containerCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptContainerCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("containerCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/dropdownCss",["jquery","./utils"],function(a,b){function c(a){return null}function d(){}return d.prototype.render=function(d){var e=d.call(this),f=this.options.get("dropdownCssClass")||"";a.isFunction(f)&&(f=f(this.$element));var g=this.options.get("adaptDropdownCssClass");if(g=g||c,-1!==f.indexOf(":all:")){f=f.replace(":all:","");var h=g;g=function(a){var b=h(a);return null!=b?b+" "+a:a}}var i=this.options.get("dropdownCss")||{};return a.isFunction(i)&&(i=i(this.$element)),b.syncCssClasses(e,this.$element,g),e.css(i),e.addClass(f),e},d}),b.define("select2/compat/initSelection",["jquery"],function(a){function b(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `initSelection` option has been deprecated in favor of a custom data adapter that overrides the `current` method. This method is now called multiple times instead of a single time when the instance is initialized. Support will be removed for the `initSelection` option in future versions of Select2"),this.initSelection=c.get("initSelection"),this._isInitialized=!1,a.call(this,b,c)}return b.prototype.current=function(b,c){var d=this;if(this._isInitialized)return void b.call(this,c);this.initSelection.call(null,this.$element,function(b){d._isInitialized=!0,a.isArray(b)||(b=[b]),c(b)})},b}),b.define("select2/compat/inputData",["jquery"],function(a){function b(a,b,c){this._currentData=[],this._valueSeparator=c.get("valueSeparator")||",","hidden"===b.prop("type")&&c.get("debug")&&console&&console.warn&&console.warn("Select2: Using a hidden input with Select2 is no longer supported and may stop working in the future. It is recommended to use a `<select>` element instead."),a.call(this,b,c)}return b.prototype.current=function(b,c){function d(b,c){var e=[];return b.selected||-1!==a.inArray(b.id,c)?(b.selected=!0,e.push(b)):b.selected=!1,b.children&&e.push.apply(e,d(b.children,c)),e}for(var e=[],f=0;f<this._currentData.length;f++){var g=this._currentData[f];e.push.apply(e,d(g,this.$element.val().split(this._valueSeparator)))}c(e)},b.prototype.select=function(b,c){if(this.options.get("multiple")){var d=this.$element.val();d+=this._valueSeparator+c.id,this.$element.val(d),this.$element.trigger("change")}else this.current(function(b){a.map(b,function(a){a.selected=!1})}),this.$element.val(c.id),this.$element.trigger("change")},b.prototype.unselect=function(a,b){var c=this;b.selected=!1,this.current(function(a){for(var d=[],e=0;e<a.length;e++){var f=a[e];b.id!=f.id&&d.push(f.id)}c.$element.val(d.join(c._valueSeparator)),c.$element.trigger("change")})},b.prototype.query=function(a,b,c){for(var d=[],e=0;e<this._currentData.length;e++){var f=this._currentData[e],g=this.matches(b,f);null!==g&&d.push(g)}c({results:d})},b.prototype.addOptions=function(b,c){var d=a.map(c,function(b){return a.data(b[0],"data")});this._currentData.push.apply(this._currentData,d)},b}),b.define("select2/compat/matcher",["jquery"],function(a){function b(b){function c(c,d){var e=a.extend(!0,{},d);if(null==c.term||""===a.trim(c.term))return e;if(d.children){for(var f=d.children.length-1;f>=0;f--){var g=d.children[f];b(c.term,g.text,g)||e.children.splice(f,1)}if(e.children.length>0)return e}return b(c.term,d.text,d)?e:null}return c}return b}),b.define("select2/compat/query",[],function(){function a(a,b,c){c.get("debug")&&window.console&&console.warn&&console.warn("Select2: The `query` option has been deprecated in favor of a custom data adapter that overrides the `query` method. Support will be removed for the `query` option in future versions of Select2."),a.call(this,b,c)}return a.prototype.query=function(a,b,c){b.callback=c,this.options.get("query").call(null,b)},a}),b.define("select2/dropdown/attachContainer",[],function(){function a(a,b,c){a.call(this,b,c)}return a.prototype.position=function(a,b,c){c.find(".dropdown-wrapper").append(b),b.addClass("select2-dropdown--below"),c.addClass("select2-container--below")},a}),b.define("select2/dropdown/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$dropdown.on(d.join(" "),function(a){a.stopPropagation()})},a}),b.define("select2/selection/stopPropagation",[],function(){function a(){}return a.prototype.bind=function(a,b,c){a.call(this,b,c);var d=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$selection.on(d.join(" "),function(a){a.stopPropagation()})},a}),function(c){"function"==typeof b.define&&b.define.amd?b.define("jquery-mousewheel",["jquery"],c):"object"==typeof exports?module.exports=c:c(a)}(function(a){function b(b){var g=b||window.event,h=i.call(arguments,1),j=0,l=0,m=0,n=0,o=0,p=0;if(b=a.event.fix(g),b.type="mousewheel","detail"in g&&(m=-1*g.detail),"wheelDelta"in g&&(m=g.wheelDelta),"wheelDeltaY"in g&&(m=g.wheelDeltaY),"wheelDeltaX"in g&&(l=-1*g.wheelDeltaX),"axis"in g&&g.axis===g.HORIZONTAL_AXIS&&(l=-1*m,m=0),j=0===m?l:m,"deltaY"in g&&(m=-1*g.deltaY,j=m),"deltaX"in g&&(l=g.deltaX,0===m&&(j=-1*l)),0!==m||0!==l){if(1===g.deltaMode){var q=a.data(this,"mousewheel-line-height");j*=q,m*=q,l*=q}else if(2===g.deltaMode){var r=a.data(this,"mousewheel-page-height");j*=r,m*=r,l*=r}if(n=Math.max(Math.abs(m),Math.abs(l)),(!f||n<f)&&(f=n,d(g,n)&&(f/=40)),d(g,n)&&(j/=40,l/=40,m/=40),j=Math[j>=1?"floor":"ceil"](j/f),l=Math[l>=1?"floor":"ceil"](l/f),m=Math[m>=1?"floor":"ceil"](m/f),k.settings.normalizeOffset&&this.getBoundingClientRect){var s=this.getBoundingClientRect();o=b.clientX-s.left,p=b.clientY-s.top}return b.deltaX=l,b.deltaY=m,b.deltaFactor=f,b.offsetX=o,b.offsetY=p,b.deltaMode=0,h.unshift(b,j,l,m),e&&clearTimeout(e),e=setTimeout(c,200),(a.event.dispatch||a.event.handle).apply(this,h)}}function c(){f=null}function d(a,b){return k.settings.adjustOldDeltas&&"mousewheel"===a.type&&b%120==0}var e,f,g=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],h="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],i=Array.prototype.slice;if(a.event.fixHooks)for(var j=g.length;j;)a.event.fixHooks[g[--j]]=a.event.mouseHooks;var k=a.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var c=h.length;c;)this.addEventListener(h[--c],b,!1);else this.onmousewheel=b;a.data(this,"mousewheel-line-height",k.getLineHeight(this)),a.data(this,"mousewheel-page-height",k.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var c=h.length;c;)this.removeEventListener(h[--c],b,!1);else this.onmousewheel=null;a.removeData(this,"mousewheel-line-height"),a.removeData(this,"mousewheel-page-height")},getLineHeight:function(b){var c=a(b),d=c["offsetParent"in a.fn?"offsetParent":"parent"]();return d.length||(d=a("body")),parseInt(d.css("fontSize"),10)||parseInt(c.css("fontSize"),10)||16},getPageHeight:function(b){return a(b).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};a.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})}),b.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function(a,b,c,d){if(null==a.fn.selectWoo){var e=["open","close","destroy"];a.fn.selectWoo=function(b){if("object"==typeof(b=b||{}))return this.each(function(){var d=a.extend(!0,{},b);new c(a(this),d)}),this;if("string"==typeof b){var d,f=Array.prototype.slice.call(arguments,1);return this.each(function(){var c=a(this).data("select2");null==c&&window.console&&console.error&&console.error("The select2('"+b+"') method was called on an element that is not using Select2."),d=c[b].apply(c,f)}),a.inArray(b,e)>-1?this:d}throw new Error("Invalid arguments for Select2: "+b)}}return null!=a.fn.select2&&null!=a.fn.select2.defaults&&(a.fn.selectWoo.defaults=a.fn.select2.defaults),null==a.fn.selectWoo.defaults&&(a.fn.selectWoo.defaults=d),a.fn.select2=a.fn.select2||a.fn.selectWoo,c}),{define:b.define,require:b.require}}(),c=b.require("jquery.select2");return a.fn.select2.amd=b,a.fn.selectWoo.amd=b,c});
|
1 |
+
(function(factory){if(typeof define==="function"&&define.amd){define(["jquery"],factory)}else if(typeof module==="object"&&module.exports){module.exports=function(root,jQuery){if(jQuery===undefined){if(typeof window!=="undefined"){jQuery=require("jquery")}else{jQuery=require("jquery")(root)}}factory(jQuery);return jQuery}}else{factory(jQuery)}})(function(jQuery){var S2=function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd){var S2=jQuery.fn.select2.amd}var S2;(function(){if(!S2||!S2.requirejs){if(!S2){S2={}}else{require=S2}var requirejs,require,define;(function(undef){var main,req,makeMap,handlers,defined={},waiting={},config={},defining={},hasOwn=Object.prototype.hasOwnProperty,aps=[].slice,jsSuffixRegExp=/\.js$/;function hasProp(obj,prop){return hasOwn.call(obj,prop)}function normalize(name,baseName){var nameParts,nameSegment,mapValue,foundMap,lastIndex,foundI,foundStarMap,starI,i,j,part,normalizedBaseParts,baseParts=baseName&&baseName.split("/"),map=config.map,starMap=map&&map["*"]||{};if(name){name=name.split("/");lastIndex=name.length-1;if(config.nodeIdCompat&&jsSuffixRegExp.test(name[lastIndex])){name[lastIndex]=name[lastIndex].replace(jsSuffixRegExp,"")}if(name[0].charAt(0)==="."&&baseParts){normalizedBaseParts=baseParts.slice(0,baseParts.length-1);name=normalizedBaseParts.concat(name)}for(i=0;i<name.length;i++){part=name[i];if(part==="."){name.splice(i,1);i-=1}else if(part===".."){if(i===0||i===1&&name[2]===".."||name[i-1]===".."){continue}else if(i>0){name.splice(i-1,2);i-=2}}}name=name.join("/")}if((baseParts||starMap)&&map){nameParts=name.split("/");for(i=nameParts.length;i>0;i-=1){nameSegment=nameParts.slice(0,i).join("/");if(baseParts){for(j=baseParts.length;j>0;j-=1){mapValue=map[baseParts.slice(0,j).join("/")];if(mapValue){mapValue=mapValue[nameSegment];if(mapValue){foundMap=mapValue;foundI=i;break}}}}if(foundMap){break}if(!foundStarMap&&starMap&&starMap[nameSegment]){foundStarMap=starMap[nameSegment];starI=i}}if(!foundMap&&foundStarMap){foundMap=foundStarMap;foundI=starI}if(foundMap){nameParts.splice(0,foundI,foundMap);name=nameParts.join("/")}}return name}function makeRequire(relName,forceSync){return function(){var args=aps.call(arguments,0);if(typeof args[0]!=="string"&&args.length===1){args.push(null)}return req.apply(undef,args.concat([relName,forceSync]))}}function makeNormalize(relName){return function(name){return normalize(name,relName)}}function makeLoad(depName){return function(value){defined[depName]=value}}function callDep(name){if(hasProp(waiting,name)){var args=waiting[name];delete waiting[name];defining[name]=true;main.apply(undef,args)}if(!hasProp(defined,name)&&!hasProp(defining,name)){throw new Error("No "+name)}return defined[name]}function splitPrefix(name){var prefix,index=name?name.indexOf("!"):-1;if(index>-1){prefix=name.substring(0,index);name=name.substring(index+1,name.length)}return[prefix,name]}function makeRelParts(relName){return relName?splitPrefix(relName):[]}makeMap=function(name,relParts){var plugin,parts=splitPrefix(name),prefix=parts[0],relResourceName=relParts[1];name=parts[1];if(prefix){prefix=normalize(prefix,relResourceName);plugin=callDep(prefix)}if(prefix){if(plugin&&plugin.normalize){name=plugin.normalize(name,makeNormalize(relResourceName))}else{name=normalize(name,relResourceName)}}else{name=normalize(name,relResourceName);parts=splitPrefix(name);prefix=parts[0];name=parts[1];if(prefix){plugin=callDep(prefix)}}return{f:prefix?prefix+"!"+name:name,n:name,pr:prefix,p:plugin}};function makeConfig(name){return function(){return config&&config.config&&config.config[name]||{}}}handlers={require:function(name){return makeRequire(name)},exports:function(name){var e=defined[name];if(typeof e!=="undefined"){return e}else{return defined[name]={}}},module:function(name){return{id:name,uri:"",exports:defined[name],config:makeConfig(name)}}};main=function(name,deps,callback,relName){var cjsModule,depName,ret,map,i,relParts,args=[],callbackType=typeof callback,usingExports;relName=relName||name;relParts=makeRelParts(relName);if(callbackType==="undefined"||callbackType==="function"){deps=!deps.length&&callback.length?["require","exports","module"]:deps;for(i=0;i<deps.length;i+=1){map=makeMap(deps[i],relParts);depName=map.f;if(depName==="require"){args[i]=handlers.require(name)}else if(depName==="exports"){args[i]=handlers.exports(name);usingExports=true}else if(depName==="module"){cjsModule=args[i]=handlers.module(name)}else if(hasProp(defined,depName)||hasProp(waiting,depName)||hasProp(defining,depName)){args[i]=callDep(depName)}else if(map.p){map.p.load(map.n,makeRequire(relName,true),makeLoad(depName),{});args[i]=defined[depName]}else{throw new Error(name+" missing "+depName)}}ret=callback?callback.apply(defined[name],args):undefined;if(name){if(cjsModule&&cjsModule.exports!==undef&&cjsModule.exports!==defined[name]){defined[name]=cjsModule.exports}else if(ret!==undef||!usingExports){defined[name]=ret}}}else if(name){defined[name]=callback}};requirejs=require=req=function(deps,callback,relName,forceSync,alt){if(typeof deps==="string"){if(handlers[deps]){return handlers[deps](callback)}return callDep(makeMap(deps,makeRelParts(callback)).f)}else if(!deps.splice){config=deps;if(config.deps){req(config.deps,config.callback)}if(!callback){return}if(callback.splice){deps=callback;callback=relName;relName=null}else{deps=undef}}callback=callback||function(){};if(typeof relName==="function"){relName=forceSync;forceSync=alt}if(forceSync){main(undef,deps,callback,relName)}else{setTimeout(function(){main(undef,deps,callback,relName)},4)}return req};req.config=function(cfg){return req(cfg)};requirejs._defined=defined;define=function(name,deps,callback){if(typeof name!=="string"){throw new Error("See almond README: incorrect module build, no module name")}if(!deps.splice){callback=deps;deps=[]}if(!hasProp(defined,name)&&!hasProp(waiting,name)){waiting[name]=[name,deps,callback]}};define.amd={jQuery:true}})();S2.requirejs=requirejs;S2.require=require;S2.define=define}})();S2.define("almond",function(){});S2.define("jquery",[],function(){var _$=jQuery||$;if(_$==null&&console&&console.error){console.error("Select2: An instance of jQuery or a jQuery-compatible library was not "+"found. Make sure that you are including jQuery before Select2 on your "+"web page.")}return _$});S2.define("select2/utils",["jquery"],function($){var Utils={};Utils.Extend=function(ChildClass,SuperClass){var __hasProp={}.hasOwnProperty;function BaseConstructor(){this.constructor=ChildClass}for(var key in SuperClass){if(__hasProp.call(SuperClass,key)){ChildClass[key]=SuperClass[key]}}BaseConstructor.prototype=SuperClass.prototype;ChildClass.prototype=new BaseConstructor;ChildClass.__super__=SuperClass.prototype;return ChildClass};function getMethods(theClass){var proto=theClass.prototype;var methods=[];for(var methodName in proto){var m=proto[methodName];if(typeof m!=="function"){continue}if(methodName==="constructor"){continue}methods.push(methodName)}return methods}Utils.Decorate=function(SuperClass,DecoratorClass){var decoratedMethods=getMethods(DecoratorClass);var superMethods=getMethods(SuperClass);function DecoratedClass(){var unshift=Array.prototype.unshift;var argCount=DecoratorClass.prototype.constructor.length;var calledConstructor=SuperClass.prototype.constructor;if(argCount>0){unshift.call(arguments,SuperClass.prototype.constructor);calledConstructor=DecoratorClass.prototype.constructor}calledConstructor.apply(this,arguments)}DecoratorClass.displayName=SuperClass.displayName;function ctr(){this.constructor=DecoratedClass}DecoratedClass.prototype=new ctr;for(var m=0;m<superMethods.length;m++){var superMethod=superMethods[m];DecoratedClass.prototype[superMethod]=SuperClass.prototype[superMethod]}var calledMethod=function(methodName){var originalMethod=function(){};if(methodName in DecoratedClass.prototype){originalMethod=DecoratedClass.prototype[methodName]}var decoratedMethod=DecoratorClass.prototype[methodName];return function(){var unshift=Array.prototype.unshift;unshift.call(arguments,originalMethod);return decoratedMethod.apply(this,arguments)}};for(var d=0;d<decoratedMethods.length;d++){var decoratedMethod=decoratedMethods[d];DecoratedClass.prototype[decoratedMethod]=calledMethod(decoratedMethod)}return DecoratedClass};var Observable=function(){this.listeners={}};Observable.prototype.on=function(event,callback){this.listeners=this.listeners||{};if(event in this.listeners){this.listeners[event].push(callback)}else{this.listeners[event]=[callback]}};Observable.prototype.trigger=function(event){var slice=Array.prototype.slice;var params=slice.call(arguments,1);this.listeners=this.listeners||{};if(params==null){params=[]}if(params.length===0){params.push({})}params[0]._type=event;if(event in this.listeners){this.invoke(this.listeners[event],slice.call(arguments,1))}if("*"in this.listeners){this.invoke(this.listeners["*"],arguments)}};Observable.prototype.invoke=function(listeners,params){for(var i=0,len=listeners.length;i<len;i++){listeners[i].apply(this,params)}};Utils.Observable=Observable;Utils.generateChars=function(length){var chars="";for(var i=0;i<length;i++){var randomChar=Math.floor(Math.random()*36);chars+=randomChar.toString(36)}return chars};Utils.bind=function(func,context){return function(){func.apply(context,arguments)}};Utils._convertData=function(data){for(var originalKey in data){var keys=originalKey.split("-");var dataLevel=data;if(keys.length===1){continue}for(var k=0;k<keys.length;k++){var key=keys[k];key=key.substring(0,1).toLowerCase()+key.substring(1);if(!(key in dataLevel)){dataLevel[key]={}}if(k==keys.length-1){dataLevel[key]=data[originalKey]}dataLevel=dataLevel[key]}delete data[originalKey]}return data};Utils.hasScroll=function(index,el){var $el=$(el);var overflowX=el.style.overflowX;var overflowY=el.style.overflowY;if(overflowX===overflowY&&(overflowY==="hidden"||overflowY==="visible")){return false}if(overflowX==="scroll"||overflowY==="scroll"){return true}return $el.innerHeight()<el.scrollHeight||$el.innerWidth()<el.scrollWidth};Utils.escapeMarkup=function(markup){var replaceMap={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};if(typeof markup!=="string"){return markup}return String(markup).replace(/[&<>"'\/\\]/g,function(match){return replaceMap[match]})};Utils.entityDecode=function(html){var txt=document.createElement("textarea");txt.innerHTML=html;return txt.value};Utils.appendMany=function($element,$nodes){if($.fn.jquery.substr(0,3)==="1.7"){var $jqNodes=$();$.map($nodes,function(node){$jqNodes=$jqNodes.add(node)});$nodes=$jqNodes}$element.append($nodes)};Utils.isTouchscreen=function(){if("undefined"===typeof Utils._isTouchscreenCache){Utils._isTouchscreenCache="ontouchstart"in document.documentElement}return Utils._isTouchscreenCache};return Utils});S2.define("select2/results",["jquery","./utils"],function($,Utils){function Results($element,options,dataAdapter){this.$element=$element;this.data=dataAdapter;this.options=options;Results.__super__.constructor.call(this)}Utils.Extend(Results,Utils.Observable);Results.prototype.render=function(){var $results=$('<ul class="select2-results__options" role="listbox" tabindex="-1"></ul>');if(this.options.get("multiple")){$results.attr("aria-multiselectable","true")}this.$results=$results;return $results};Results.prototype.clear=function(){this.$results.empty()};Results.prototype.displayMessage=function(params){var escapeMarkup=this.options.get("escapeMarkup");this.clear();this.hideLoading();var $message=$('<li role="alert" aria-live="assertive"'+' class="select2-results__option"></li>');var message=this.options.get("translations").get(params.message);$message.append(escapeMarkup(message(params.args)));$message[0].className+=" select2-results__message";this.$results.append($message)};Results.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()};Results.prototype.append=function(data){this.hideLoading();var $options=[];if(data.results==null||data.results.length===0){if(this.$results.children().length===0){this.trigger("results:message",{message:"noResults"})}return}data.results=this.sort(data.results);for(var d=0;d<data.results.length;d++){var item=data.results[d];var $option=this.option(item);$options.push($option)}this.$results.append($options)};Results.prototype.position=function($results,$dropdown){var $resultsContainer=$dropdown.find(".select2-results");$resultsContainer.append($results)};Results.prototype.sort=function(data){var sorter=this.options.get("sorter");return sorter(data)};Results.prototype.highlightFirstItem=function(){var $options=this.$results.find(".select2-results__option[data-selected]");var $selected=$options.filter("[data-selected=true]");if($selected.length>0){$selected.first().trigger("mouseenter")}else{$options.first().trigger("mouseenter")}this.ensureHighlightVisible()};Results.prototype.setClasses=function(){var self=this;this.data.current(function(selected){var selectedIds=$.map(selected,function(s){return s.id.toString()});var $options=self.$results.find(".select2-results__option[data-selected]");$options.each(function(){var $option=$(this);var item=$.data(this,"data");var id=""+item.id;if(item.element!=null&&item.element.selected||item.element==null&&$.inArray(id,selectedIds)>-1){$option.attr("data-selected","true")}else{$option.attr("data-selected","false")}})})};Results.prototype.showLoading=function(params){this.hideLoading();var loadingMore=this.options.get("translations").get("searching");var loading={disabled:true,loading:true,text:loadingMore(params)};var $loading=this.option(loading);$loading.className+=" loading-results";this.$results.prepend($loading)};Results.prototype.hideLoading=function(){this.$results.find(".loading-results").remove()};Results.prototype.option=function(data){var option=document.createElement("li");option.className="select2-results__option";var attrs={role:"option","data-selected":"false",tabindex:-1};if(data.disabled){delete attrs["data-selected"];attrs["aria-disabled"]="true"}if(data.id==null){delete attrs["data-selected"]}if(data._resultId!=null){option.id=data._resultId}if(data.title){option.title=data.title}if(data.children){attrs["aria-label"]=data.text;delete attrs["data-selected"]}for(var attr in attrs){var val=attrs[attr];option.setAttribute(attr,val)}if(data.children){var $option=$(option);var label=document.createElement("strong");label.className="select2-results__group";var $label=$(label);this.template(data,label);$label.attr("role","presentation");var $children=[];for(var c=0;c<data.children.length;c++){var child=data.children[c];var $child=this.option(child);$children.push($child)}var $childrenContainer=$("<ul></ul>",{class:"select2-results__options select2-results__options--nested",role:"listbox"});$childrenContainer.append($children);$option.attr("role","list");$option.append(label);$option.append($childrenContainer)}else{this.template(data,option)}$.data(option,"data",data);return option};Results.prototype.bind=function(container,$container){var self=this;var id=container.id+"-results";this.$results.attr("id",id);container.on("results:all",function(params){self.clear();self.append(params.data);if(container.isOpen()){self.setClasses();self.highlightFirstItem()}});container.on("results:append",function(params){self.append(params.data);if(container.isOpen()){self.setClasses()}});container.on("query",function(params){self.hideMessages();self.showLoading(params)});container.on("select",function(){if(!container.isOpen()){return}self.setClasses();self.highlightFirstItem()});container.on("unselect",function(){if(!container.isOpen()){return}self.setClasses();self.highlightFirstItem()});container.on("open",function(){self.$results.attr("aria-expanded","true");self.$results.attr("aria-hidden","false");self.setClasses();self.ensureHighlightVisible()});container.on("close",function(){self.$results.attr("aria-expanded","false");self.$results.attr("aria-hidden","true");self.$results.removeAttr("aria-activedescendant")});container.on("results:toggle",function(){var $highlighted=self.getHighlightedResults();if($highlighted.length===0){return}$highlighted.trigger("mouseup")});container.on("results:select",function(){var $highlighted=self.getHighlightedResults();if($highlighted.length===0){return}var data=$highlighted.data("data");if($highlighted.attr("data-selected")=="true"){self.trigger("close",{})}else{self.trigger("select",{data:data})}});container.on("results:previous",function(){var $highlighted=self.getHighlightedResults();var $options=self.$results.find("[data-selected]");var currentIndex=$options.index($highlighted);if(currentIndex===0){return}var nextIndex=currentIndex-1;if($highlighted.length===0){nextIndex=0}var $next=$options.eq(nextIndex);$next.trigger("mouseenter");var currentOffset=self.$results.offset().top;var nextTop=$next.offset().top;var nextOffset=self.$results.scrollTop()+(nextTop-currentOffset);if(nextIndex===0){self.$results.scrollTop(0)}else if(nextTop-currentOffset<0){self.$results.scrollTop(nextOffset)}});container.on("results:next",function(){var $highlighted=self.getHighlightedResults();var $options=self.$results.find("[data-selected]");var currentIndex=$options.index($highlighted);var nextIndex=currentIndex+1;if(nextIndex>=$options.length){return}var $next=$options.eq(nextIndex);$next.trigger("mouseenter");var currentOffset=self.$results.offset().top+self.$results.outerHeight(false);var nextBottom=$next.offset().top+$next.outerHeight(false);var nextOffset=self.$results.scrollTop()+nextBottom-currentOffset;if(nextIndex===0){self.$results.scrollTop(0)}else if(nextBottom>currentOffset){self.$results.scrollTop(nextOffset)}});container.on("results:focus",function(params){params.element.addClass("select2-results__option--highlighted").attr("aria-selected","true");self.$results.attr("aria-activedescendant",params.element.attr("id"))});container.on("results:message",function(params){self.displayMessage(params)});if($.fn.mousewheel){this.$results.on("mousewheel",function(e){var top=self.$results.scrollTop();var bottom=self.$results.get(0).scrollHeight-top+e.deltaY;var isAtTop=e.deltaY>0&&top-e.deltaY<=0;var isAtBottom=e.deltaY<0&&bottom<=self.$results.height();if(isAtTop){self.$results.scrollTop(0);e.preventDefault();e.stopPropagation()}else if(isAtBottom){self.$results.scrollTop(self.$results.get(0).scrollHeight-self.$results.height());e.preventDefault();e.stopPropagation()}})}this.$results.on("mouseup",".select2-results__option[data-selected]",function(evt){var $this=$(this);var data=$this.data("data");if($this.attr("data-selected")==="true"){if(self.options.get("multiple")){self.trigger("unselect",{originalEvent:evt,data:data})}else{self.trigger("close",{})}return}self.trigger("select",{originalEvent:evt,data:data})});this.$results.on("mouseenter",".select2-results__option[data-selected]",function(evt){var data=$(this).data("data");self.getHighlightedResults().removeClass("select2-results__option--highlighted").attr("aria-selected","false");self.trigger("results:focus",{data:data,element:$(this)})})};Results.prototype.getHighlightedResults=function(){var $highlighted=this.$results.find(".select2-results__option--highlighted");return $highlighted};Results.prototype.destroy=function(){this.$results.remove()};Results.prototype.ensureHighlightVisible=function(){var $highlighted=this.getHighlightedResults();if($highlighted.length===0){return}var $options=this.$results.find("[data-selected]");var currentIndex=$options.index($highlighted);var currentOffset=this.$results.offset().top;var nextTop=$highlighted.offset().top;var nextOffset=this.$results.scrollTop()+(nextTop-currentOffset);var offsetDelta=nextTop-currentOffset;nextOffset-=$highlighted.outerHeight(false)*2;if(currentIndex<=2){this.$results.scrollTop(0)}else if(offsetDelta>this.$results.outerHeight()||offsetDelta<0){this.$results.scrollTop(nextOffset)}};Results.prototype.template=function(result,container){var template=this.options.get("templateResult");var escapeMarkup=this.options.get("escapeMarkup");var content=template(result,container);if(content==null){container.style.display="none"}else if(typeof content==="string"){container.innerHTML=escapeMarkup(content)}else{$(container).append(content)}};return Results});S2.define("select2/keys",[],function(){var KEYS={BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};return KEYS});S2.define("select2/selection/base",["jquery","../utils","../keys"],function($,Utils,KEYS){function BaseSelection($element,options){this.$element=$element;this.options=options;BaseSelection.__super__.constructor.call(this)}Utils.Extend(BaseSelection,Utils.Observable);BaseSelection.prototype.render=function(){var $selection=$('<span class="select2-selection" '+' aria-haspopup="true" aria-expanded="false">'+"</span>");this._tabindex=0;if(this.$element.data("old-tabindex")!=null){this._tabindex=this.$element.data("old-tabindex")}else if(this.$element.attr("tabindex")!=null){this._tabindex=this.$element.attr("tabindex")}$selection.attr("title",this.$element.attr("title"));$selection.attr("tabindex",this._tabindex);this.$selection=$selection;return $selection};BaseSelection.prototype.bind=function(container,$container){var self=this;var id=container.id+"-container";var resultsId=container.id+"-results";var searchHidden=this.options.get("minimumResultsForSearch")===Infinity;this.container=container;this.$selection.on("focus",function(evt){self.trigger("focus",evt)});this.$selection.on("blur",function(evt){self._handleBlur(evt)});this.$selection.on("keydown",function(evt){self.trigger("keypress",evt);if(evt.which===KEYS.SPACE){evt.preventDefault()}});container.on("results:focus",function(params){self.$selection.attr("aria-activedescendant",params.data._resultId)});container.on("selection:update",function(params){self.update(params.data)});container.on("open",function(){self.$selection.attr("aria-expanded","true");self.$selection.attr("aria-owns",resultsId);self._attachCloseHandler(container)});container.on("close",function(){self.$selection.attr("aria-expanded","false");self.$selection.removeAttr("aria-activedescendant");self.$selection.removeAttr("aria-owns");window.setTimeout(function(){self.$selection.focus()},1);self._detachCloseHandler(container)});container.on("enable",function(){self.$selection.attr("tabindex",self._tabindex)});container.on("disable",function(){self.$selection.attr("tabindex","-1")})};BaseSelection.prototype._handleBlur=function(evt){var self=this;window.setTimeout(function(){if(document.activeElement==self.$selection[0]||$.contains(self.$selection[0],document.activeElement)){return}self.trigger("blur",evt)},1)};BaseSelection.prototype._attachCloseHandler=function(container){var self=this;$(document.body).on("mousedown.select2."+container.id,function(e){var $target=$(e.target);var $select=$target.closest(".select2");var $all=$(".select2.select2-container--open");$all.each(function(){var $this=$(this);if(this==$select[0]){return}var $element=$this.data("element");$element.select2("close");setTimeout(function(){$this.find("*:focus").blur();$target.focus()},1)})})};BaseSelection.prototype._detachCloseHandler=function(container){$(document.body).off("mousedown.select2."+container.id)};BaseSelection.prototype.position=function($selection,$container){var $selectionContainer=$container.find(".selection");$selectionContainer.append($selection)};BaseSelection.prototype.destroy=function(){this._detachCloseHandler(this.container)};BaseSelection.prototype.update=function(data){throw new Error("The `update` method must be defined in child classes.")};return BaseSelection});S2.define("select2/selection/single",["jquery","./base","../utils","../keys"],function($,BaseSelection,Utils,KEYS){function SingleSelection(){SingleSelection.__super__.constructor.apply(this,arguments)}Utils.Extend(SingleSelection,BaseSelection);SingleSelection.prototype.render=function(){var $selection=SingleSelection.__super__.render.call(this);$selection.addClass("select2-selection--single");$selection.html('<span class="select2-selection__rendered"></span>'+'<span class="select2-selection__arrow" role="presentation">'+'<b role="presentation"></b>'+"</span>");return $selection};SingleSelection.prototype.bind=function(container,$container){var self=this;SingleSelection.__super__.bind.apply(this,arguments);var id=container.id+"-container";this.$selection.find(".select2-selection__rendered").attr("id",id).attr("role","textbox").attr("aria-readonly","true");var label=this.options.get("label");if(typeof label==="string"){this.$selection.attr("aria-label",label)}else{this.$selection.attr("aria-labelledby",id)}this.$selection.attr("role","combobox");this.$selection.on("mousedown",function(evt){if(evt.which!==1){return}self.trigger("toggle",{originalEvent:evt})});this.$selection.on("focus",function(evt){});this.$selection.on("keydown",function(evt){if(!container.isOpen()&&evt.which>=48&&evt.which<=90){container.open()}});this.$selection.on("blur",function(evt){});container.on("focus",function(evt){if(!container.isOpen()){self.$selection.focus()}});container.on("selection:update",function(params){self.update(params.data)})};SingleSelection.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()};SingleSelection.prototype.display=function(data,container){var template=this.options.get("templateSelection");var escapeMarkup=this.options.get("escapeMarkup");return escapeMarkup(template(data,container))};SingleSelection.prototype.selectionContainer=function(){return $("<span></span>")};SingleSelection.prototype.update=function(data){if(data.length===0){this.clear();return}var selection=data[0];var $rendered=this.$selection.find(".select2-selection__rendered");var formatted=Utils.entityDecode(this.display(selection,$rendered));$rendered.empty().text(formatted);$rendered.prop("title",selection.title||selection.text)};return SingleSelection});S2.define("select2/selection/multiple",["jquery","./base","../utils"],function($,BaseSelection,Utils){function MultipleSelection($element,options){MultipleSelection.__super__.constructor.apply(this,arguments)}Utils.Extend(MultipleSelection,BaseSelection);MultipleSelection.prototype.render=function(){var $selection=MultipleSelection.__super__.render.call(this);$selection.addClass("select2-selection--multiple");$selection.html('<ul class="select2-selection__rendered" aria-live="polite" aria-relevant="additions removals" aria-atomic="true"></ul>');return $selection};MultipleSelection.prototype.bind=function(container,$container){var self=this;MultipleSelection.__super__.bind.apply(this,arguments);this.$selection.on("click",function(evt){self.trigger("toggle",{originalEvent:evt})});this.$selection.on("click",".select2-selection__choice__remove",function(evt){if(self.options.get("disabled")){return}var $remove=$(this);var $selection=$remove.parent();var data=$selection.data("data");self.trigger("unselect",{originalEvent:evt,data:data})});this.$selection.on("keydown",function(evt){if(!container.isOpen()&&evt.which>=48&&evt.which<=90){container.open()}});container.on("focus",function(){self.focusOnSearch()})};MultipleSelection.prototype.clear=function(){this.$selection.find(".select2-selection__rendered").empty()};MultipleSelection.prototype.display=function(data,container){var template=this.options.get("templateSelection");var escapeMarkup=this.options.get("escapeMarkup");return escapeMarkup(template(data,container))};MultipleSelection.prototype.selectionContainer=function(){var $container=$('<li class="select2-selection__choice">'+'<span class="select2-selection__choice__remove" role="presentation" aria-hidden="true">'+"×"+"</span>"+"</li>");return $container};MultipleSelection.prototype.focusOnSearch=function(){var self=this;if("undefined"!==typeof self.$search){setTimeout(function(){self._keyUpPrevented=true;self.$search.focus()},1)}};MultipleSelection.prototype.update=function(data){this.clear();if(data.length===0){return}var $selections=[];for(var d=0;d<data.length;d++){var selection=data[d];var $selection=this.selectionContainer();var removeItemTag=$selection.html();var formatted=this.display(selection,$selection);if("string"===typeof formatted){formatted=Utils.entityDecode(formatted.trim())}$selection.text(formatted);$selection.prepend(removeItemTag);$selection.prop("title",selection.title||selection.text);$selection.data("data",selection);$selections.push($selection)}var $rendered=this.$selection.find(".select2-selection__rendered");Utils.appendMany($rendered,$selections)};return MultipleSelection});S2.define("select2/selection/placeholder",["../utils"],function(Utils){function Placeholder(decorated,$element,options){this.placeholder=this.normalizePlaceholder(options.get("placeholder"));decorated.call(this,$element,options)}Placeholder.prototype.normalizePlaceholder=function(_,placeholder){if(typeof placeholder==="string"){placeholder={id:"",text:placeholder}}return placeholder};Placeholder.prototype.createPlaceholder=function(decorated,placeholder){var $placeholder=this.selectionContainer();$placeholder.text(Utils.entityDecode(this.display(placeholder)));$placeholder.addClass("select2-selection__placeholder").removeClass("select2-selection__choice");return $placeholder};Placeholder.prototype.update=function(decorated,data){var singlePlaceholder=data.length==1&&data[0].id!=this.placeholder.id;var multipleSelections=data.length>1;if(multipleSelections||singlePlaceholder){return decorated.call(this,data)}this.clear();var $placeholder=this.createPlaceholder(this.placeholder);this.$selection.find(".select2-selection__rendered").append($placeholder)};return Placeholder});S2.define("select2/selection/allowClear",["jquery","../keys"],function($,KEYS){function AllowClear(){}AllowClear.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);if(this.placeholder==null){if(this.options.get("debug")&&window.console&&console.error){console.error("Select2: The `allowClear` option should be used in combination "+"with the `placeholder` option.")}}this.$selection.on("mousedown",".select2-selection__clear",function(evt){self._handleClear(evt)});container.on("keypress",function(evt){self._handleKeyboardClear(evt,container)})};AllowClear.prototype._handleClear=function(_,evt){if(this.options.get("disabled")){return}var $clear=this.$selection.find(".select2-selection__clear");if($clear.length===0){return}evt.stopPropagation();var data=$clear.data("data");for(var d=0;d<data.length;d++){var unselectData={data:data[d]};this.trigger("unselect",unselectData);if(unselectData.prevented){return}}this.$element.val(this.placeholder.id).trigger("change");this.trigger("toggle",{})};AllowClear.prototype._handleKeyboardClear=function(_,evt,container){if(container.isOpen()){return}if(evt.which==KEYS.DELETE||evt.which==KEYS.BACKSPACE){this._handleClear(evt)}};AllowClear.prototype.update=function(decorated,data){decorated.call(this,data);if(this.$selection.find(".select2-selection__placeholder").length>0||data.length===0){return}var $remove=$('<span class="select2-selection__clear">'+"×"+"</span>");$remove.data("data",data);this.$selection.find(".select2-selection__rendered").prepend($remove)};return AllowClear});S2.define("select2/selection/search",["jquery","../utils","../keys"],function($,Utils,KEYS){function Search(decorated,$element,options){decorated.call(this,$element,options)}Search.prototype.render=function(decorated){var $search=$('<li class="select2-search select2-search--inline">'+'<input class="select2-search__field" type="text" tabindex="-1"'+' autocomplete="off" autocorrect="off" autocapitalize="none"'+' spellcheck="false" role="textbox" aria-autocomplete="list" />'+"</li>");this.$searchContainer=$search;this.$search=$search.find("input");var $rendered=decorated.call(this);this._transferTabIndex();return $rendered};Search.prototype.bind=function(decorated,container,$container){var self=this;var resultsId=container.id+"-results";decorated.call(this,container,$container);container.on("open",function(){self.$search.attr("aria-owns",resultsId);self.$search.trigger("focus")});container.on("close",function(){self.$search.val("");self.$search.removeAttr("aria-activedescendant");self.$search.removeAttr("aria-owns");self.$search.trigger("focus")});container.on("enable",function(){self.$search.prop("disabled",false);self._transferTabIndex()});container.on("disable",function(){self.$search.prop("disabled",true)});container.on("focus",function(evt){self.$search.trigger("focus")});container.on("results:focus",function(params){self.$search.attr("aria-activedescendant",params.data._resultId)});this.$selection.on("focusin",".select2-search--inline",function(evt){self.trigger("focus",evt)});this.$selection.on("focusout",".select2-search--inline",function(evt){self._handleBlur(evt)});this.$selection.on("keydown",".select2-search--inline",function(evt){evt.stopPropagation();self.trigger("keypress",evt);self._keyUpPrevented=evt.isDefaultPrevented();var key=evt.which;if(key===KEYS.BACKSPACE&&self.$search.val()===""){var $previousChoice=self.$searchContainer.prev(".select2-selection__choice");if($previousChoice.length>0){var item=$previousChoice.data("data");self.searchRemoveChoice(item);evt.preventDefault()}}else if(evt.which===KEYS.ENTER){container.open();evt.preventDefault()}});var msie=document.documentMode;var disableInputEvents=msie&&msie<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(evt){if(disableInputEvents){self.$selection.off("input.search input.searchcheck");return}self.$selection.off("keyup.search")});this.$selection.on("keyup.search input.search",".select2-search--inline",function(evt){if(disableInputEvents&&evt.type==="input"){self.$selection.off("input.search input.searchcheck");return}var key=evt.which;if(key==KEYS.SHIFT||key==KEYS.CTRL||key==KEYS.ALT){return}if(key==KEYS.TAB){return}self.handleSearch(evt)})};Search.prototype._transferTabIndex=function(decorated){this.$search.attr("tabindex",this.$selection.attr("tabindex"));this.$selection.attr("tabindex","-1")};Search.prototype.createPlaceholder=function(decorated,placeholder){this.$search.attr("placeholder",placeholder.text)};Search.prototype.update=function(decorated,data){var searchHadFocus=this.$search[0]==document.activeElement;this.$search.attr("placeholder","");decorated.call(this,data);this.$selection.find(".select2-selection__rendered").append(this.$searchContainer);this.resizeSearch();if(searchHadFocus){this.$search.focus()}};Search.prototype.handleSearch=function(){this.resizeSearch();if(!this._keyUpPrevented){var input=this.$search.val();this.trigger("query",{term:input})}this._keyUpPrevented=false};Search.prototype.searchRemoveChoice=function(decorated,item){this.trigger("unselect",{data:item});this.$search.val(item.text);this.handleSearch()};Search.prototype.resizeSearch=function(){this.$search.css("width","25px");var width="";if(this.$search.attr("placeholder")!==""){width=this.$selection.find(".select2-selection__rendered").innerWidth()}else{var minimumWidth=this.$search.val().length+1;width=minimumWidth*.75+"em"}this.$search.css("width",width)};return Search});S2.define("select2/selection/eventRelay",["jquery"],function($){function EventRelay(){}EventRelay.prototype.bind=function(decorated,container,$container){var self=this;var relayEvents=["open","opening","close","closing","select","selecting","unselect","unselecting"];var preventableEvents=["opening","closing","selecting","unselecting"];decorated.call(this,container,$container);container.on("*",function(name,params){if($.inArray(name,relayEvents)===-1){return}params=params||{};var evt=$.Event("select2:"+name,{params:params});self.$element.trigger(evt);if($.inArray(name,preventableEvents)===-1){return}params.prevented=evt.isDefaultPrevented()})};return EventRelay});S2.define("select2/translation",["jquery","require"],function($,require){function Translation(dict){this.dict=dict||{}}Translation.prototype.all=function(){return this.dict};Translation.prototype.get=function(key){return this.dict[key]};Translation.prototype.extend=function(translation){this.dict=$.extend({},translation.all(),this.dict)};Translation._cache={};Translation.loadPath=function(path){if(!(path in Translation._cache)){var translations=require(path);Translation._cache[path]=translations}return new Translation(Translation._cache[path])};return Translation});S2.define("select2/diacritics",[],function(){var diacritics={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};return diacritics});S2.define("select2/data/base",["../utils"],function(Utils){function BaseAdapter($element,options){BaseAdapter.__super__.constructor.call(this)}Utils.Extend(BaseAdapter,Utils.Observable);BaseAdapter.prototype.current=function(callback){throw new Error("The `current` method must be defined in child classes.")};BaseAdapter.prototype.query=function(params,callback){throw new Error("The `query` method must be defined in child classes.")};BaseAdapter.prototype.bind=function(container,$container){};BaseAdapter.prototype.destroy=function(){};BaseAdapter.prototype.generateResultId=function(container,data){var id="";if(container!=null){id+=container.id}else{id+=Utils.generateChars(4)}id+="-result-";id+=Utils.generateChars(4);if(data.id!=null){id+="-"+data.id.toString()}else{id+="-"+Utils.generateChars(4)}return id};return BaseAdapter});S2.define("select2/data/select",["./base","../utils","jquery"],function(BaseAdapter,Utils,$){function SelectAdapter($element,options){this.$element=$element;this.options=options;SelectAdapter.__super__.constructor.call(this)}Utils.Extend(SelectAdapter,BaseAdapter);SelectAdapter.prototype.current=function(callback){var data=[];var self=this;this.$element.find(":selected").each(function(){var $option=$(this);var option=self.item($option);data.push(option)});callback(data)};SelectAdapter.prototype.select=function(data){var self=this;data.selected=true;if($(data.element).is("option")){data.element.selected=true;this.$element.trigger("change");return}if(this.$element.prop("multiple")){this.current(function(currentData){var val=[];data=[data];data.push.apply(data,currentData);for(var d=0;d<data.length;d++){var id=data[d].id;if($.inArray(id,val)===-1){val.push(id)}}self.$element.val(val);self.$element.trigger("change")})}else{var val=data.id;this.$element.val(val);this.$element.trigger("change")}};SelectAdapter.prototype.unselect=function(data){var self=this;if(!this.$element.prop("multiple")){return}data.selected=false;if($(data.element).is("option")){data.element.selected=false;this.$element.trigger("change");return}this.current(function(currentData){var val=[];for(var d=0;d<currentData.length;d++){var id=currentData[d].id;if(id!==data.id&&$.inArray(id,val)===-1){val.push(id)}}self.$element.val(val);self.$element.trigger("change")})};SelectAdapter.prototype.bind=function(container,$container){var self=this;this.container=container;container.on("select",function(params){self.select(params.data)});container.on("unselect",function(params){self.unselect(params.data)})};SelectAdapter.prototype.destroy=function(){this.$element.find("*").each(function(){$.removeData(this,"data")})};SelectAdapter.prototype.query=function(params,callback){var data=[];var self=this;var $options=this.$element.children();$options.each(function(){var $option=$(this);if(!$option.is("option")&&!$option.is("optgroup")){return}var option=self.item($option);var matches=self.matches(params,option);if(matches!==null){data.push(matches)}});callback({results:data})};SelectAdapter.prototype.addOptions=function($options){Utils.appendMany(this.$element,$options)};SelectAdapter.prototype.option=function(data){var option;if(data.children){option=document.createElement("optgroup");option.label=data.text}else{option=document.createElement("option");if(option.textContent!==undefined){option.textContent=data.text}else{option.innerText=data.text}}if(data.id!==undefined){option.value=data.id}if(data.disabled){option.disabled=true}if(data.selected){option.selected=true}if(data.title){option.title=data.title}var $option=$(option);var normalizedData=this._normalizeItem(data);normalizedData.element=option;$.data(option,"data",normalizedData);return $option};SelectAdapter.prototype.item=function($option){var data={};data=$.data($option[0],"data");if(data!=null){return data}if($option.is("option")){data={id:$option.val(),text:$option.text(),disabled:$option.prop("disabled"),selected:$option.prop("selected"),title:$option.prop("title")}}else if($option.is("optgroup")){data={text:$option.prop("label"),children:[],title:$option.prop("title")};var $children=$option.children("option");var children=[];for(var c=0;c<$children.length;c++){var $child=$($children[c]);var child=this.item($child);children.push(child)}data.children=children}data=this._normalizeItem(data);data.element=$option[0];$.data($option[0],"data",data);return data};SelectAdapter.prototype._normalizeItem=function(item){if(!$.isPlainObject(item)){item={id:item,text:item}}item=$.extend({},{text:""},item);var defaults={selected:false,disabled:false};if(item.id!=null){item.id=item.id.toString()}if(item.text!=null){item.text=item.text.toString()}if(item._resultId==null&&item.id){item._resultId=this.generateResultId(this.container,item)}return $.extend({},defaults,item)};SelectAdapter.prototype.matches=function(params,data){var matcher=this.options.get("matcher");return matcher(params,data)};return SelectAdapter});S2.define("select2/data/array",["./select","../utils","jquery"],function(SelectAdapter,Utils,$){function ArrayAdapter($element,options){var data=options.get("data")||[];ArrayAdapter.__super__.constructor.call(this,$element,options);this.addOptions(this.convertToOptions(data))}Utils.Extend(ArrayAdapter,SelectAdapter);ArrayAdapter.prototype.select=function(data){var $option=this.$element.find("option").filter(function(i,elm){return elm.value==data.id.toString()});if($option.length===0){$option=this.option(data);this.addOptions($option)}ArrayAdapter.__super__.select.call(this,data)};ArrayAdapter.prototype.convertToOptions=function(data){var self=this;var $existing=this.$element.find("option");var existingIds=$existing.map(function(){return self.item($(this)).id}).get();var $options=[];function onlyItem(item){return function(){return $(this).val()==item.id}}for(var d=0;d<data.length;d++){var item=this._normalizeItem(data[d]);if($.inArray(item.id,existingIds)>=0){var $existingOption=$existing.filter(onlyItem(item));var existingData=this.item($existingOption);var newData=$.extend(true,{},item,existingData);var $newOption=this.option(newData);$existingOption.replaceWith($newOption);continue}var $option=this.option(item);if(item.children){var $children=this.convertToOptions(item.children);Utils.appendMany($option,$children)}$options.push($option)}return $options};return ArrayAdapter});S2.define("select2/data/ajax",["./array","../utils","jquery"],function(ArrayAdapter,Utils,$){function AjaxAdapter($element,options){this.ajaxOptions=this._applyDefaults(options.get("ajax"));if(this.ajaxOptions.processResults!=null){this.processResults=this.ajaxOptions.processResults}AjaxAdapter.__super__.constructor.call(this,$element,options)}Utils.Extend(AjaxAdapter,ArrayAdapter);AjaxAdapter.prototype._applyDefaults=function(options){var defaults={data:function(params){return $.extend({},params,{q:params.term})},transport:function(params,success,failure){var $request=$.ajax(params);$request.then(success);$request.fail(failure);return $request}};return $.extend({},defaults,options,true)};AjaxAdapter.prototype.processResults=function(results){return results};AjaxAdapter.prototype.query=function(params,callback){var matches=[];var self=this;if(this._request!=null){if($.isFunction(this._request.abort)){this._request.abort()}this._request=null}var options=$.extend({type:"GET"},this.ajaxOptions);if(typeof options.url==="function"){options.url=options.url.call(this.$element,params)}if(typeof options.data==="function"){options.data=options.data.call(this.$element,params)}function request(){var $request=options.transport(options,function(data){var results=self.processResults(data,params);if(self.options.get("debug")&&window.console&&console.error){if(!results||!results.results||!$.isArray(results.results)){console.error("Select2: The AJAX results did not return an array in the "+"`results` key of the response.")}}callback(results);self.container.focusOnActiveElement()},function(){if($request.status&&$request.status==="0"){return}self.trigger("results:message",{message:"errorLoading"})});self._request=$request}if(this.ajaxOptions.delay&¶ms.term!=null){if(this._queryTimeout){window.clearTimeout(this._queryTimeout)}this._queryTimeout=window.setTimeout(request,this.ajaxOptions.delay)}else{request()}};return AjaxAdapter});S2.define("select2/data/tags",["jquery"],function($){function Tags(decorated,$element,options){var tags=options.get("tags");var createTag=options.get("createTag");if(createTag!==undefined){this.createTag=createTag}var insertTag=options.get("insertTag");if(insertTag!==undefined){this.insertTag=insertTag}decorated.call(this,$element,options);if($.isArray(tags)){for(var t=0;t<tags.length;t++){var tag=tags[t];var item=this._normalizeItem(tag);var $option=this.option(item);this.$element.append($option)}}}Tags.prototype.query=function(decorated,params,callback){var self=this;this._removeOldTags();if(params.term==null||params.page!=null){decorated.call(this,params,callback);return}function wrapper(obj,child){var data=obj.results;for(var i=0;i<data.length;i++){var option=data[i];var checkChildren=option.children!=null&&!wrapper({results:option.children},true);var optionText=(option.text||"").toUpperCase();var paramsTerm=(params.term||"").toUpperCase();var checkText=optionText===paramsTerm;if(checkText||checkChildren){if(child){return false}obj.data=data;callback(obj);return}}if(child){return true}var tag=self.createTag(params);if(tag!=null){var $option=self.option(tag);$option.attr("data-select2-tag",true);self.addOptions([$option]);self.insertTag(data,tag)}obj.results=data;callback(obj)}decorated.call(this,params,wrapper)};Tags.prototype.createTag=function(decorated,params){var term=$.trim(params.term);if(term===""){return null}return{id:term,text:term}};Tags.prototype.insertTag=function(_,data,tag){data.unshift(tag)};Tags.prototype._removeOldTags=function(_){var tag=this._lastTag;var $options=this.$element.find("option[data-select2-tag]");$options.each(function(){if(this.selected){return}$(this).remove()})};return Tags});S2.define("select2/data/tokenizer",["jquery"],function($){function Tokenizer(decorated,$element,options){var tokenizer=options.get("tokenizer");if(tokenizer!==undefined){this.tokenizer=tokenizer}decorated.call(this,$element,options)}Tokenizer.prototype.bind=function(decorated,container,$container){decorated.call(this,container,$container);this.$search=container.dropdown.$search||container.selection.$search||$container.find(".select2-search__field")};Tokenizer.prototype.query=function(decorated,params,callback){var self=this;function createAndSelect(data){var item=self._normalizeItem(data);var $existingOptions=self.$element.find("option").filter(function(){return $(this).val()===item.id});if(!$existingOptions.length){var $option=self.option(item);$option.attr("data-select2-tag",true);self._removeOldTags();self.addOptions([$option])}select(item)}function select(data){self.trigger("select",{data:data})}params.term=params.term||"";var tokenData=this.tokenizer(params,this.options,createAndSelect);if(tokenData.term!==params.term){if(this.$search.length){this.$search.val(tokenData.term);this.$search.focus()}params.term=tokenData.term}decorated.call(this,params,callback)};Tokenizer.prototype.tokenizer=function(_,params,options,callback){var separators=options.get("tokenSeparators")||[];var term=params.term;var i=0;var createTag=this.createTag||function(params){return{id:params.term,text:params.term}};while(i<term.length){var termChar=term[i];if($.inArray(termChar,separators)===-1){i++;continue}var part=term.substr(0,i);var partParams=$.extend({},params,{term:part});var data=createTag(partParams);if(data==null){i++;continue}callback(data);term=term.substr(i+1)||"";i=0}return{term:term}};return Tokenizer});S2.define("select2/data/minimumInputLength",[],function(){function MinimumInputLength(decorated,$e,options){this.minimumInputLength=options.get("minimumInputLength");decorated.call(this,$e,options)}MinimumInputLength.prototype.query=function(decorated,params,callback){params.term=params.term||"";if(params.term.length<this.minimumInputLength){this.trigger("results:message",{message:"inputTooShort",args:{minimum:this.minimumInputLength,input:params.term,params:params}});return}decorated.call(this,params,callback)};return MinimumInputLength});S2.define("select2/data/maximumInputLength",[],function(){function MaximumInputLength(decorated,$e,options){this.maximumInputLength=options.get("maximumInputLength");decorated.call(this,$e,options)}MaximumInputLength.prototype.query=function(decorated,params,callback){params.term=params.term||"";if(this.maximumInputLength>0&¶ms.term.length>this.maximumInputLength){this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:params.term,params:params}});return}decorated.call(this,params,callback)};return MaximumInputLength});S2.define("select2/data/maximumSelectionLength",[],function(){function MaximumSelectionLength(decorated,$e,options){this.maximumSelectionLength=options.get("maximumSelectionLength");decorated.call(this,$e,options)}MaximumSelectionLength.prototype.query=function(decorated,params,callback){var self=this;this.current(function(currentData){var count=currentData!=null?currentData.length:0;if(self.maximumSelectionLength>0&&count>=self.maximumSelectionLength){self.trigger("results:message",{message:"maximumSelected",args:{maximum:self.maximumSelectionLength}});return}decorated.call(self,params,callback)})};return MaximumSelectionLength});S2.define("select2/dropdown",["jquery","./utils"],function($,Utils){function Dropdown($element,options){this.$element=$element;this.options=options;Dropdown.__super__.constructor.call(this)}Utils.Extend(Dropdown,Utils.Observable);Dropdown.prototype.render=function(){var $dropdown=$('<span class="select2-dropdown">'+'<span class="select2-results"></span>'+"</span>");$dropdown.attr("dir",this.options.get("dir"));this.$dropdown=$dropdown;return $dropdown};Dropdown.prototype.bind=function(){};Dropdown.prototype.position=function($dropdown,$container){};Dropdown.prototype.destroy=function(){this.$dropdown.remove()};return Dropdown});S2.define("select2/dropdown/search",["jquery","../utils"],function($,Utils){function Search(){}Search.prototype.render=function(decorated){var $rendered=decorated.call(this);var $search=$('<span class="select2-search select2-search--dropdown">'+'<input class="select2-search__field" type="text" tabindex="-1"'+' autocomplete="off" autocorrect="off" autocapitalize="none"'+' spellcheck="false" role="combobox" aria-autocomplete="list" aria-expanded="true" />'+"</span>");this.$searchContainer=$search;this.$search=$search.find("input");$rendered.prepend($search);return $rendered};Search.prototype.bind=function(decorated,container,$container){var self=this;var resultsId=container.id+"-results";decorated.call(this,container,$container);this.$search.on("keydown",function(evt){self.trigger("keypress",evt);self._keyUpPrevented=evt.isDefaultPrevented()});this.$search.on("input",function(evt){$(this).off("keyup")});this.$search.on("keyup input",function(evt){self.handleSearch(evt)});container.on("open",function(){self.$search.attr("tabindex",0);self.$search.attr("aria-owns",resultsId);self.$search.focus();window.setTimeout(function(){self.$search.focus()},0)});container.on("close",function(){self.$search.attr("tabindex",-1);self.$search.removeAttr("aria-activedescendant");self.$search.removeAttr("aria-owns");self.$search.val("")});container.on("focus",function(){if(!container.isOpen()){self.$search.focus()}});container.on("results:all",function(params){if(params.query.term==null||params.query.term===""){var showSearch=self.showSearch(params);if(showSearch){self.$searchContainer.removeClass("select2-search--hide")}else{self.$searchContainer.addClass("select2-search--hide")}}});container.on("results:focus",function(params){self.$search.attr("aria-activedescendant",params.data._resultId)})};Search.prototype.handleSearch=function(evt){if(!this._keyUpPrevented){var input=this.$search.val();this.trigger("query",{term:input})}this._keyUpPrevented=false};Search.prototype.showSearch=function(_,params){return true};return Search});S2.define("select2/dropdown/hidePlaceholder",[],function(){function HidePlaceholder(decorated,$element,options,dataAdapter){this.placeholder=this.normalizePlaceholder(options.get("placeholder"));decorated.call(this,$element,options,dataAdapter)}HidePlaceholder.prototype.append=function(decorated,data){data.results=this.removePlaceholder(data.results);decorated.call(this,data)};HidePlaceholder.prototype.normalizePlaceholder=function(_,placeholder){if(typeof placeholder==="string"){placeholder={id:"",text:placeholder}}return placeholder};HidePlaceholder.prototype.removePlaceholder=function(_,data){var modifiedData=data.slice(0);for(var d=data.length-1;d>=0;d--){var item=data[d];if(this.placeholder.id===item.id){modifiedData.splice(d,1)}}return modifiedData};return HidePlaceholder});S2.define("select2/dropdown/infiniteScroll",["jquery"],function($){function InfiniteScroll(decorated,$element,options,dataAdapter){this.lastParams={};decorated.call(this,$element,options,dataAdapter);this.$loadingMore=this.createLoadingMore();this.loading=false}InfiniteScroll.prototype.append=function(decorated,data){this.$loadingMore.remove();this.loading=false;decorated.call(this,data);if(this.showLoadingMore(data)){this.$results.append(this.$loadingMore)}};InfiniteScroll.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);container.on("query",function(params){self.lastParams=params;self.loading=true});container.on("query:append",function(params){self.lastParams=params;self.loading=true});this.$results.on("scroll",function(){var isLoadMoreVisible=$.contains(document.documentElement,self.$loadingMore[0]);if(self.loading||!isLoadMoreVisible){return}var currentOffset=self.$results.offset().top+self.$results.outerHeight(false);var loadingMoreOffset=self.$loadingMore.offset().top+self.$loadingMore.outerHeight(false);if(currentOffset+50>=loadingMoreOffset){self.loadMore()}})};InfiniteScroll.prototype.loadMore=function(){this.loading=true;var params=$.extend({},{page:1},this.lastParams);params.page++;this.trigger("query:append",params)};InfiniteScroll.prototype.showLoadingMore=function(_,data){return data.pagination&&data.pagination.more};InfiniteScroll.prototype.createLoadingMore=function(){var $option=$("<li "+'class="select2-results__option select2-results__option--load-more"'+'role="option" aria-disabled="true"></li>');var message=this.options.get("translations").get("loadingMore");$option.html(message(this.lastParams));return $option};return InfiniteScroll});S2.define("select2/dropdown/attachBody",["jquery","../utils"],function($,Utils){function AttachBody(decorated,$element,options){this.$dropdownParent=options.get("dropdownParent")||$(document.body);decorated.call(this,$element,options)}AttachBody.prototype.bind=function(decorated,container,$container){var self=this;var setupResultsEvents=false;decorated.call(this,container,$container);container.on("open",function(){self._showDropdown();self._attachPositioningHandler(container);if(!setupResultsEvents){setupResultsEvents=true;container.on("results:all",function(){self._positionDropdown();self._resizeDropdown()});container.on("results:append",function(){self._positionDropdown();self._resizeDropdown()})}});container.on("close",function(){self._hideDropdown();self._detachPositioningHandler(container)});this.$dropdownContainer.on("mousedown",function(evt){evt.stopPropagation()})};AttachBody.prototype.destroy=function(decorated){decorated.call(this);this.$dropdownContainer.remove()};AttachBody.prototype.position=function(decorated,$dropdown,$container){$dropdown.attr("class",$container.attr("class"));$dropdown.removeClass("select2");$dropdown.addClass("select2-container--open");$dropdown.css({position:"absolute",top:-999999});this.$container=$container};AttachBody.prototype.render=function(decorated){var $container=$("<span></span>");var $dropdown=decorated.call(this);$container.append($dropdown);this.$dropdownContainer=$container;return $container};AttachBody.prototype._hideDropdown=function(decorated){this.$dropdownContainer.detach()};AttachBody.prototype._attachPositioningHandler=function(decorated,container){var self=this;var scrollEvent="scroll.select2."+container.id;var resizeEvent="resize.select2."+container.id;var orientationEvent="orientationchange.select2."+container.id;var $watchers=this.$container.parents().filter(Utils.hasScroll);$watchers.each(function(){$(this).data("select2-scroll-position",{x:$(this).scrollLeft(),y:$(this).scrollTop()})});$watchers.on(scrollEvent,function(ev){var position=$(this).data("select2-scroll-position");$(this).scrollTop(position.y)});$(window).on(scrollEvent+" "+resizeEvent+" "+orientationEvent,function(e){self._positionDropdown();self._resizeDropdown()})};AttachBody.prototype._detachPositioningHandler=function(decorated,container){var scrollEvent="scroll.select2."+container.id;var resizeEvent="resize.select2."+container.id;var orientationEvent="orientationchange.select2."+container.id;var $watchers=this.$container.parents().filter(Utils.hasScroll);$watchers.off(scrollEvent);$(window).off(scrollEvent+" "+resizeEvent+" "+orientationEvent)};AttachBody.prototype._positionDropdown=function(){var $window=$(window);var isCurrentlyAbove=this.$dropdown.hasClass("select2-dropdown--above");var isCurrentlyBelow=this.$dropdown.hasClass("select2-dropdown--below");var newDirection=null;var offset=this.$container.offset();offset.bottom=offset.top+this.$container.outerHeight(false);var container={height:this.$container.outerHeight(false)};container.top=offset.top;container.bottom=offset.top+container.height;var dropdown={height:this.$dropdown.outerHeight(false)};var viewport={top:$window.scrollTop(),bottom:$window.scrollTop()+$window.height()};var enoughRoomAbove=viewport.top<offset.top-dropdown.height;var enoughRoomBelow=viewport.bottom>offset.bottom+dropdown.height;var css={left:offset.left,top:container.bottom};var $offsetParent=this.$dropdownParent;if($offsetParent.css("position")==="static"){$offsetParent=$offsetParent.offsetParent()}var parentOffset=$offsetParent.offset();css.left-=parentOffset.left;if(!isCurrentlyAbove&&!isCurrentlyBelow){newDirection="below"}if(!enoughRoomBelow&&enoughRoomAbove&&!isCurrentlyAbove){newDirection="above"}else if(!enoughRoomAbove&&enoughRoomBelow&&isCurrentlyAbove){newDirection="below"}if(newDirection=="above"||isCurrentlyAbove&&newDirection!=="below"){css.top=container.top-dropdown.height}if(newDirection!=null){this.$dropdown.removeClass("select2-dropdown--below select2-dropdown--above").addClass("select2-dropdown--"+newDirection);this.$container.removeClass("select2-container--below select2-container--above").addClass("select2-container--"+newDirection)}this.$dropdownContainer.css(css)};AttachBody.prototype._resizeDropdown=function(){var css={width:this.$container.outerWidth(false)+"px"};if(this.options.get("dropdownAutoWidth")){css.minWidth=css.width;css.position="relative";css.width="auto"}this.$dropdown.css(css)};AttachBody.prototype._showDropdown=function(decorated){this.$dropdownContainer.appendTo(this.$dropdownParent);this._positionDropdown();this._resizeDropdown()};return AttachBody});S2.define("select2/dropdown/minimumResultsForSearch",[],function(){function countResults(data){var count=0;for(var d=0;d<data.length;d++){var item=data[d];if(item.children){count+=countResults(item.children)}else{count++}}return count}function MinimumResultsForSearch(decorated,$element,options,dataAdapter){this.minimumResultsForSearch=options.get("minimumResultsForSearch");if(this.minimumResultsForSearch<0){this.minimumResultsForSearch=Infinity}decorated.call(this,$element,options,dataAdapter)}MinimumResultsForSearch.prototype.showSearch=function(decorated,params){if(countResults(params.data.results)<this.minimumResultsForSearch){return false}return decorated.call(this,params)};return MinimumResultsForSearch});S2.define("select2/dropdown/selectOnClose",[],function(){function SelectOnClose(){}SelectOnClose.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);container.on("close",function(params){self._handleSelectOnClose(params)})};SelectOnClose.prototype._handleSelectOnClose=function(_,params){if(params&¶ms.originalSelect2Event!=null){var event=params.originalSelect2Event;if(event._type==="select"||event._type==="unselect"){return}}var $highlightedResults=this.getHighlightedResults();if($highlightedResults.length<1){return}var data=$highlightedResults.data("data");if(data.element!=null&&data.element.selected||data.element==null&&data.selected){return}this.trigger("select",{data:data})};return SelectOnClose});S2.define("select2/dropdown/closeOnSelect",[],function(){function CloseOnSelect(){}CloseOnSelect.prototype.bind=function(decorated,container,$container){var self=this;decorated.call(this,container,$container);container.on("select",function(evt){self._selectTriggered(evt)});container.on("unselect",function(evt){self._selectTriggered(evt)})};CloseOnSelect.prototype._selectTriggered=function(_,evt){var originalEvent=evt.originalEvent;if(originalEvent&&originalEvent.ctrlKey){return}this.trigger("close",{originalEvent:originalEvent,originalSelect2Event:evt})};return CloseOnSelect});S2.define("select2/i18n/en",[],function(){return{errorLoading:function(){return"The results could not be loaded."},inputTooLong:function(args){var overChars=args.input.length-args.maximum;var message="Please delete "+overChars+" character";if(overChars!=1){message+="s"}return message},inputTooShort:function(args){var remainingChars=args.minimum-args.input.length;var message="Please enter "+remainingChars+" or more characters";return message},loadingMore:function(){return"Loading more results…"},maximumSelected:function(args){var message="You can only select "+args.maximum+" item";if(args.maximum!=1){message+="s"}return message},noResults:function(){return"No results found"},searching:function(){return"Searching…"}}});S2.define("select2/defaults",["jquery","require","./results","./selection/single","./selection/multiple","./selection/placeholder","./selection/allowClear","./selection/search","./selection/eventRelay","./utils","./translation","./diacritics","./data/select","./data/array","./data/ajax","./data/tags","./data/tokenizer","./data/minimumInputLength","./data/maximumInputLength","./data/maximumSelectionLength","./dropdown","./dropdown/search","./dropdown/hidePlaceholder","./dropdown/infiniteScroll","./dropdown/attachBody","./dropdown/minimumResultsForSearch","./dropdown/selectOnClose","./dropdown/closeOnSelect","./i18n/en"],function($,require,ResultsList,SingleSelection,MultipleSelection,Placeholder,AllowClear,SelectionSearch,EventRelay,Utils,Translation,DIACRITICS,SelectData,ArrayData,AjaxData,Tags,Tokenizer,MinimumInputLength,MaximumInputLength,MaximumSelectionLength,Dropdown,DropdownSearch,HidePlaceholder,InfiniteScroll,AttachBody,MinimumResultsForSearch,SelectOnClose,CloseOnSelect,EnglishTranslation){function Defaults(){this.reset()}Defaults.prototype.apply=function(options){options=$.extend(true,{},this.defaults,options);if(options.dataAdapter==null){if(options.ajax!=null){options.dataAdapter=AjaxData}else if(options.data!=null){options.dataAdapter=ArrayData}else{options.dataAdapter=SelectData}if(options.minimumInputLength>0){options.dataAdapter=Utils.Decorate(options.dataAdapter,MinimumInputLength)}if(options.maximumInputLength>0){options.dataAdapter=Utils.Decorate(options.dataAdapter,MaximumInputLength)}if(options.maximumSelectionLength>0){options.dataAdapter=Utils.Decorate(options.dataAdapter,MaximumSelectionLength)}if(options.tags){options.dataAdapter=Utils.Decorate(options.dataAdapter,Tags)}if(options.tokenSeparators!=null||options.tokenizer!=null){options.dataAdapter=Utils.Decorate(options.dataAdapter,Tokenizer)}if(options.query!=null){var Query=require(options.amdBase+"compat/query");options.dataAdapter=Utils.Decorate(options.dataAdapter,Query)}if(options.initSelection!=null){var InitSelection=require(options.amdBase+"compat/initSelection");options.dataAdapter=Utils.Decorate(options.dataAdapter,InitSelection)}}if(options.resultsAdapter==null){options.resultsAdapter=ResultsList;if(options.ajax!=null){options.resultsAdapter=Utils.Decorate(options.resultsAdapter,InfiniteScroll)}if(options.placeholder!=null){options.resultsAdapter=Utils.Decorate(options.resultsAdapter,HidePlaceholder)}if(options.selectOnClose){options.resultsAdapter=Utils.Decorate(options.resultsAdapter,SelectOnClose)}}if(options.dropdownAdapter==null){if(options.multiple){options.dropdownAdapter=Dropdown}else{var SearchableDropdown=Utils.Decorate(Dropdown,DropdownSearch);options.dropdownAdapter=SearchableDropdown}if(options.minimumResultsForSearch!==0){options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,MinimumResultsForSearch)}if(options.closeOnSelect){options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,CloseOnSelect)}if(options.dropdownCssClass!=null||options.dropdownCss!=null||options.adaptDropdownCssClass!=null){var DropdownCSS=require(options.amdBase+"compat/dropdownCss");options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,DropdownCSS)}options.dropdownAdapter=Utils.Decorate(options.dropdownAdapter,AttachBody)}if(options.selectionAdapter==null){if(options.multiple){options.selectionAdapter=MultipleSelection}else{options.selectionAdapter=SingleSelection}if(options.placeholder!=null){options.selectionAdapter=Utils.Decorate(options.selectionAdapter,Placeholder)}if(options.allowClear){options.selectionAdapter=Utils.Decorate(options.selectionAdapter,AllowClear)}if(options.multiple){options.selectionAdapter=Utils.Decorate(options.selectionAdapter,SelectionSearch)}if(options.containerCssClass!=null||options.containerCss!=null||options.adaptContainerCssClass!=null){var ContainerCSS=require(options.amdBase+"compat/containerCss");options.selectionAdapter=Utils.Decorate(options.selectionAdapter,ContainerCSS)}options.selectionAdapter=Utils.Decorate(options.selectionAdapter,EventRelay)}if(typeof options.language==="string"){if(options.language.indexOf("-")>0){var languageParts=options.language.split("-");var baseLanguage=languageParts[0];options.language=[options.language,baseLanguage]}else{options.language=[options.language]}}if($.isArray(options.language)){var languages=new Translation;options.language.push("en");var languageNames=options.language;for(var l=0;l<languageNames.length;l++){var name=languageNames[l];var language={};try{language=Translation.loadPath(name)}catch(e){try{name=this.defaults.amdLanguageBase+name;language=Translation.loadPath(name)}catch(ex){if(options.debug&&window.console&&console.warn){console.warn('Select2: The language file for "'+name+'" could not be '+"automatically loaded. A fallback will be used instead.")}continue}}languages.extend(language)}options.translations=languages}else{var baseTranslation=Translation.loadPath(this.defaults.amdLanguageBase+"en");var customTranslation=new Translation(options.language);customTranslation.extend(baseTranslation);options.translations=customTranslation}return options};Defaults.prototype.reset=function(){function stripDiacritics(text){function match(a){return DIACRITICS[a]||a}return text.replace(/[^\u0000-\u007E]/g,match)}function matcher(params,data){if($.trim(params.term)===""){return data}if(data.children&&data.children.length>0){var match=$.extend(true,{},data);for(var c=data.children.length-1;c>=0;c--){var child=data.children[c];var matches=matcher(params,child);if(matches==null){match.children.splice(c,1)}}if(match.children.length>0){return match}return matcher(params,match)}var original=stripDiacritics(data.text).toUpperCase();var term=stripDiacritics(params.term).toUpperCase();if(original.indexOf(term)>-1){return data}return null}this.defaults={amdBase:"./",amdLanguageBase:"./i18n/",closeOnSelect:true,debug:false,dropdownAutoWidth:false,escapeMarkup:Utils.escapeMarkup,language:EnglishTranslation,matcher:matcher,minimumInputLength:0,maximumInputLength:0,maximumSelectionLength:0,minimumResultsForSearch:0,selectOnClose:false,sorter:function(data){return data},templateResult:function(result){return result.text},templateSelection:function(selection){return selection.text},theme:"default",width:"resolve"}};Defaults.prototype.set=function(key,value){var camelKey=$.camelCase(key);var data={};data[camelKey]=value;var convertedData=Utils._convertData(data);$.extend(this.defaults,convertedData)};var defaults=new Defaults;return defaults});S2.define("select2/options",["require","jquery","./defaults","./utils"],function(require,$,Defaults,Utils){function Options(options,$element){this.options=options;if($element!=null){this.fromElement($element)}this.options=Defaults.apply(this.options);if($element&&$element.is("input")){var InputCompat=require(this.get("amdBase")+"compat/inputData");this.options.dataAdapter=Utils.Decorate(this.options.dataAdapter,InputCompat)}}Options.prototype.fromElement=function($e){var excludedData=["select2"];if(this.options.multiple==null){this.options.multiple=$e.prop("multiple")}if(this.options.disabled==null){this.options.disabled=$e.prop("disabled")}if(this.options.language==null){if($e.prop("lang")){this.options.language=$e.prop("lang").toLowerCase()}else if($e.closest("[lang]").prop("lang")){this.options.language=$e.closest("[lang]").prop("lang")}}if(this.options.dir==null){if($e.prop("dir")){this.options.dir=$e.prop("dir")}else if($e.closest("[dir]").prop("dir")){this.options.dir=$e.closest("[dir]").prop("dir")}else{this.options.dir="ltr"}}$e.prop("disabled",this.options.disabled);$e.prop("multiple",this.options.multiple);if($e.data("select2Tags")){if(this.options.debug&&window.console&&console.warn){console.warn("Select2: The `data-select2-tags` attribute has been changed to "+'use the `data-data` and `data-tags="true"` attributes and will be '+"removed in future versions of Select2.")}$e.data("data",$e.data("select2Tags"));$e.data("tags",true)}if($e.data("ajaxUrl")){if(this.options.debug&&window.console&&console.warn){console.warn("Select2: The `data-ajax-url` attribute has been changed to "+"`data-ajax--url` and support for the old attribute will be removed"+" in future versions of Select2.")}$e.attr("ajax--url",$e.data("ajaxUrl"));$e.data("ajax--url",$e.data("ajaxUrl"))}var dataset={};if($.fn.jquery&&$.fn.jquery.substr(0,2)=="1."&&$e[0].dataset){dataset=$.extend(true,{},$e[0].dataset,$e.data())}else{dataset=$e.data()}var data=$.extend(true,{},dataset);data=Utils._convertData(data);for(var key in data){if($.inArray(key,excludedData)>-1){continue}if($.isPlainObject(this.options[key])){$.extend(this.options[key],data[key])}else{this.options[key]=data[key]}}return this};Options.prototype.get=function(key){return this.options[key]};Options.prototype.set=function(key,val){this.options[key]=val};return Options});S2.define("select2/core",["jquery","./options","./utils","./keys"],function($,Options,Utils,KEYS){var Select2=function($element,options){if($element.data("select2")!=null){$element.data("select2").destroy()}this.$element=$element;this.id=this._generateId($element);options=options||{};this.options=new Options(options,$element);Select2.__super__.constructor.call(this);var tabindex=$element.attr("tabindex")||0;$element.data("old-tabindex",tabindex);$element.attr("tabindex","-1");var DataAdapter=this.options.get("dataAdapter");this.dataAdapter=new DataAdapter($element,this.options);var $container=this.render();this._placeContainer($container);var SelectionAdapter=this.options.get("selectionAdapter");this.selection=new SelectionAdapter($element,this.options);this.$selection=this.selection.render();this.selection.position(this.$selection,$container);var DropdownAdapter=this.options.get("dropdownAdapter");this.dropdown=new DropdownAdapter($element,this.options);this.$dropdown=this.dropdown.render();this.dropdown.position(this.$dropdown,$container);var ResultsAdapter=this.options.get("resultsAdapter");this.results=new ResultsAdapter($element,this.options,this.dataAdapter);this.$results=this.results.render();this.results.position(this.$results,this.$dropdown);var self=this;this._bindAdapters();this._registerDomEvents();this._registerDataEvents();this._registerSelectionEvents();this._registerDropdownEvents();this._registerResultsEvents();this._registerEvents();this.dataAdapter.current(function(initialData){self.trigger("selection:update",{data:initialData})});$element.addClass("select2-hidden-accessible");$element.attr("aria-hidden","true");this._syncAttributes();$element.data("select2",this)};Utils.Extend(Select2,Utils.Observable);Select2.prototype._generateId=function($element){var id="";if($element.attr("id")!=null){id=$element.attr("id")}else if($element.attr("name")!=null){id=$element.attr("name")+"-"+Utils.generateChars(2)}else{id=Utils.generateChars(4)}id=id.replace(/(:|\.|\[|\]|,)/g,"");id="select2-"+id;return id};Select2.prototype._placeContainer=function($container){$container.insertAfter(this.$element);var width=this._resolveWidth(this.$element,this.options.get("width"));if(width!=null){$container.css("width",width)}};Select2.prototype._resolveWidth=function($element,method){var WIDTH=/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i;if(method=="resolve"){var styleWidth=this._resolveWidth($element,"style");if(styleWidth!=null){return styleWidth}return this._resolveWidth($element,"element")}if(method=="element"){var elementWidth=$element.outerWidth(false);if(elementWidth<=0){return"auto"}return elementWidth+"px"}if(method=="style"){var style=$element.attr("style");if(typeof style!=="string"){return null}var attrs=style.split(";");for(var i=0,l=attrs.length;i<l;i=i+1){var attr=attrs[i].replace(/\s/g,"");var matches=attr.match(WIDTH);if(matches!==null&&matches.length>=1){return matches[1]}}return null}return method};Select2.prototype._bindAdapters=function(){this.dataAdapter.bind(this,this.$container);this.selection.bind(this,this.$container);this.dropdown.bind(this,this.$container);this.results.bind(this,this.$container)};Select2.prototype._registerDomEvents=function(){var self=this;this.$element.on("change.select2",function(){self.dataAdapter.current(function(data){self.trigger("selection:update",{data:data})})});this.$element.on("focus.select2",function(evt){self.trigger("focus",evt)});this._syncA=Utils.bind(this._syncAttributes,this);this._syncS=Utils.bind(this._syncSubtree,this);if(this.$element[0].attachEvent){this.$element[0].attachEvent("onpropertychange",this._syncA)}var observer=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;if(observer!=null){this._observer=new observer(function(mutations){$.each(mutations,self._syncA);$.each(mutations,self._syncS)});this._observer.observe(this.$element[0],{attributes:true,childList:true,subtree:false})}else if(this.$element[0].addEventListener){this.$element[0].addEventListener("DOMAttrModified",self._syncA,false);this.$element[0].addEventListener("DOMNodeInserted",self._syncS,false);this.$element[0].addEventListener("DOMNodeRemoved",self._syncS,false)}};Select2.prototype._registerDataEvents=function(){var self=this;this.dataAdapter.on("*",function(name,params){self.trigger(name,params)})};Select2.prototype._registerSelectionEvents=function(){var self=this;var nonRelayEvents=["toggle","focus"];this.selection.on("toggle",function(){self.toggleDropdown()});this.selection.on("focus",function(params){self.focus(params)});this.selection.on("*",function(name,params){if($.inArray(name,nonRelayEvents)!==-1){return}self.trigger(name,params)})};Select2.prototype._registerDropdownEvents=function(){var self=this;this.dropdown.on("*",function(name,params){self.trigger(name,params)})};Select2.prototype._registerResultsEvents=function(){var self=this;this.results.on("*",function(name,params){self.trigger(name,params)})};Select2.prototype._registerEvents=function(){var self=this;this.on("open",function(){self.$container.addClass("select2-container--open")});this.on("close",function(){self.$container.removeClass("select2-container--open")});this.on("enable",function(){self.$container.removeClass("select2-container--disabled")});this.on("disable",function(){self.$container.addClass("select2-container--disabled")});this.on("blur",function(){self.$container.removeClass("select2-container--focus")});this.on("query",function(params){if(!self.isOpen()){self.trigger("open",{})}this.dataAdapter.query(params,function(data){self.trigger("results:all",{data:data,query:params})})});this.on("query:append",function(params){this.dataAdapter.query(params,function(data){self.trigger("results:append",{data:data,query:params})})});this.on("open",function(){setTimeout(function(){self.focusOnActiveElement()},1)});$(document).on("keydown",function(evt){var key=evt.which;if(self.isOpen()){if(key===KEYS.ESC||key===KEYS.UP&&evt.altKey){self.close();evt.preventDefault()}else if(key===KEYS.ENTER||key===KEYS.TAB){self.trigger("results:select",{});evt.preventDefault()}else if(key===KEYS.SPACE&&evt.ctrlKey){self.trigger("results:toggle",{});evt.preventDefault()}else if(key===KEYS.UP){self.trigger("results:previous",{});evt.preventDefault()}else if(key===KEYS.DOWN){self.trigger("results:next",{});evt.preventDefault()}var $searchField=self.$dropdown.find(".select2-search__field");if(!$searchField.length){$searchField=self.$container.find(".select2-search__field")}if(key===KEYS.DOWN||key===KEYS.UP){self.focusOnActiveElement()}else{$searchField.focus();setTimeout(function(){self.focusOnActiveElement()},1e3)}}else if(self.hasFocus()){if(key===KEYS.ENTER||key===KEYS.SPACE||key===KEYS.DOWN){self.open();evt.preventDefault()}}})};Select2.prototype.focusOnActiveElement=function(){if(this.isOpen()&&!Utils.isTouchscreen()){this.$results.find("li.select2-results__option--highlighted").focus()}};Select2.prototype._syncAttributes=function(){this.options.set("disabled",this.$element.prop("disabled"));if(this.options.get("disabled")){if(this.isOpen()){this.close()}this.trigger("disable",{})}else{this.trigger("enable",{})}};Select2.prototype._syncSubtree=function(evt,mutations){var changed=false;var self=this;if(evt&&evt.target&&(evt.target.nodeName!=="OPTION"&&evt.target.nodeName!=="OPTGROUP")){return}if(!mutations){changed=true}else if(mutations.addedNodes&&mutations.addedNodes.length>0){for(var n=0;n<mutations.addedNodes.length;n++){var node=mutations.addedNodes[n];if(node.selected){changed=true}}}else if(mutations.removedNodes&&mutations.removedNodes.length>0){changed=true}if(changed){this.dataAdapter.current(function(currentData){self.trigger("selection:update",{data:currentData})})}};Select2.prototype.trigger=function(name,args){var actualTrigger=Select2.__super__.trigger;var preTriggerMap={open:"opening",close:"closing",select:"selecting",unselect:"unselecting"};if(args===undefined){args={}}if(name in preTriggerMap){var preTriggerName=preTriggerMap[name];var preTriggerArgs={prevented:false,name:name,args:args};actualTrigger.call(this,preTriggerName,preTriggerArgs);if(preTriggerArgs.prevented){args.prevented=true;return}}actualTrigger.call(this,name,args)};Select2.prototype.toggleDropdown=function(){if(this.options.get("disabled")){return}if(this.isOpen()){this.close()}else{this.open()}};Select2.prototype.open=function(){if(this.isOpen()){return}this.trigger("query",{})};Select2.prototype.close=function(){if(!this.isOpen()){return}this.trigger("close",{})};Select2.prototype.isOpen=function(){return this.$container.hasClass("select2-container--open")};Select2.prototype.hasFocus=function(){return this.$container.hasClass("select2-container--focus")};Select2.prototype.focus=function(data){if(this.hasFocus()){return}this.$container.addClass("select2-container--focus");this.trigger("focus",{})};Select2.prototype.enable=function(args){if(this.options.get("debug")&&window.console&&console.warn){console.warn('Select2: The `select2("enable")` method has been deprecated and will'+' be removed in later Select2 versions. Use $element.prop("disabled")'+" instead.")}if(args==null||args.length===0){args=[true]}var disabled=!args[0];this.$element.prop("disabled",disabled)};Select2.prototype.data=function(){if(this.options.get("debug")&&arguments.length>0&&window.console&&console.warn){console.warn('Select2: Data can no longer be set using `select2("data")`. You '+"should consider setting the value instead using `$element.val()`.")}var data=[];this.dataAdapter.current(function(currentData){data=currentData});return data};Select2.prototype.val=function(args){if(this.options.get("debug")&&window.console&&console.warn){console.warn('Select2: The `select2("val")` method has been deprecated and will be'+" removed in later Select2 versions. Use $element.val() instead.")}if(args==null||args.length===0){return this.$element.val()}var newVal=args[0];if($.isArray(newVal)){newVal=$.map(newVal,function(obj){return obj.toString()})}this.$element.val(newVal).trigger("change")};Select2.prototype.destroy=function(){this.$container.remove();if(this.$element[0].detachEvent){this.$element[0].detachEvent("onpropertychange",this._syncA)}if(this._observer!=null){this._observer.disconnect();this._observer=null}else if(this.$element[0].removeEventListener){this.$element[0].removeEventListener("DOMAttrModified",this._syncA,false);this.$element[0].removeEventListener("DOMNodeInserted",this._syncS,false);this.$element[0].removeEventListener("DOMNodeRemoved",this._syncS,false)}this._syncA=null;this._syncS=null;this.$element.off(".select2");this.$element.attr("tabindex",this.$element.data("old-tabindex"));this.$element.removeClass("select2-hidden-accessible");this.$element.attr("aria-hidden","false");this.$element.removeData("select2");this.dataAdapter.destroy();this.selection.destroy();this.dropdown.destroy();this.results.destroy();this.dataAdapter=null;this.selection=null;this.dropdown=null;this.results=null};Select2.prototype.render=function(){var $container=$('<span class="select2 select2-container">'+'<span class="selection"></span>'+'<span class="dropdown-wrapper" aria-hidden="true"></span>'+"</span>");$container.attr("dir",this.options.get("dir"));this.$container=$container;this.$container.addClass("select2-container--"+this.options.get("theme"));$container.data("element",this.$element);return $container};return Select2});S2.define("select2/compat/utils",["jquery"],function($){function syncCssClasses($dest,$src,adapter){var classes,replacements=[],adapted;classes=$.trim($dest.attr("class"));if(classes){classes=""+classes;$(classes.split(/\s+/)).each(function(){if(this.indexOf("select2-")===0){replacements.push(this)}})}classes=$.trim($src.attr("class"));if(classes){classes=""+classes;$(classes.split(/\s+/)).each(function(){if(this.indexOf("select2-")!==0){adapted=adapter(this);if(adapted!=null){replacements.push(adapted)}}})}$dest.attr("class",replacements.join(" "))}return{syncCssClasses:syncCssClasses}});S2.define("select2/compat/containerCss",["jquery","./utils"],function($,CompatUtils){function _containerAdapter(clazz){return null}function ContainerCSS(){}ContainerCSS.prototype.render=function(decorated){var $container=decorated.call(this);var containerCssClass=this.options.get("containerCssClass")||"";if($.isFunction(containerCssClass)){containerCssClass=containerCssClass(this.$element)}var containerCssAdapter=this.options.get("adaptContainerCssClass");containerCssAdapter=containerCssAdapter||_containerAdapter;if(containerCssClass.indexOf(":all:")!==-1){containerCssClass=containerCssClass.replace(":all:","");var _cssAdapter=containerCssAdapter;containerCssAdapter=function(clazz){var adapted=_cssAdapter(clazz);if(adapted!=null){return adapted+" "+clazz}return clazz}}var containerCss=this.options.get("containerCss")||{};if($.isFunction(containerCss)){containerCss=containerCss(this.$element)}CompatUtils.syncCssClasses($container,this.$element,containerCssAdapter);$container.css(containerCss);$container.addClass(containerCssClass);return $container};return ContainerCSS});S2.define("select2/compat/dropdownCss",["jquery","./utils"],function($,CompatUtils){function _dropdownAdapter(clazz){return null}function DropdownCSS(){}DropdownCSS.prototype.render=function(decorated){var $dropdown=decorated.call(this);var dropdownCssClass=this.options.get("dropdownCssClass")||"";if($.isFunction(dropdownCssClass)){dropdownCssClass=dropdownCssClass(this.$element)}var dropdownCssAdapter=this.options.get("adaptDropdownCssClass");dropdownCssAdapter=dropdownCssAdapter||_dropdownAdapter;if(dropdownCssClass.indexOf(":all:")!==-1){dropdownCssClass=dropdownCssClass.replace(":all:","");var _cssAdapter=dropdownCssAdapter;dropdownCssAdapter=function(clazz){var adapted=_cssAdapter(clazz);if(adapted!=null){return adapted+" "+clazz}return clazz}}var dropdownCss=this.options.get("dropdownCss")||{};if($.isFunction(dropdownCss)){dropdownCss=dropdownCss(this.$element)}CompatUtils.syncCssClasses($dropdown,this.$element,dropdownCssAdapter);$dropdown.css(dropdownCss);$dropdown.addClass(dropdownCssClass);return $dropdown};return DropdownCSS});S2.define("select2/compat/initSelection",["jquery"],function($){function InitSelection(decorated,$element,options){if(options.get("debug")&&window.console&&console.warn){console.warn("Select2: The `initSelection` option has been deprecated in favor"+" of a custom data adapter that overrides the `current` method. "+"This method is now called multiple times instead of a single "+"time when the instance is initialized. Support will be removed "+"for the `initSelection` option in future versions of Select2")}this.initSelection=options.get("initSelection");this._isInitialized=false;decorated.call(this,$element,options)}InitSelection.prototype.current=function(decorated,callback){var self=this;if(this._isInitialized){decorated.call(this,callback);return}this.initSelection.call(null,this.$element,function(data){self._isInitialized=true;if(!$.isArray(data)){data=[data]}callback(data)})};return InitSelection});S2.define("select2/compat/inputData",["jquery"],function($){function InputData(decorated,$element,options){this._currentData=[];this._valueSeparator=options.get("valueSeparator")||",";if($element.prop("type")==="hidden"){if(options.get("debug")&&console&&console.warn){console.warn("Select2: Using a hidden input with Select2 is no longer "+"supported and may stop working in the future. It is recommended "+"to use a `<select>` element instead.")}}decorated.call(this,$element,options)}InputData.prototype.current=function(_,callback){function getSelected(data,selectedIds){var selected=[];if(data.selected||$.inArray(data.id,selectedIds)!==-1){data.selected=true;selected.push(data)}else{data.selected=false}if(data.children){selected.push.apply(selected,getSelected(data.children,selectedIds))}return selected}var selected=[];for(var d=0;d<this._currentData.length;d++){var data=this._currentData[d];selected.push.apply(selected,getSelected(data,this.$element.val().split(this._valueSeparator)))}callback(selected)};InputData.prototype.select=function(_,data){if(!this.options.get("multiple")){this.current(function(allData){$.map(allData,function(data){data.selected=false})});this.$element.val(data.id);this.$element.trigger("change")}else{var value=this.$element.val();value+=this._valueSeparator+data.id;this.$element.val(value);this.$element.trigger("change")}};InputData.prototype.unselect=function(_,data){var self=this;data.selected=false;this.current(function(allData){var values=[];for(var d=0;d<allData.length;d++){var item=allData[d];if(data.id==item.id){continue}values.push(item.id)}self.$element.val(values.join(self._valueSeparator));self.$element.trigger("change")})};InputData.prototype.query=function(_,params,callback){var results=[];for(var d=0;d<this._currentData.length;d++){var data=this._currentData[d];var matches=this.matches(params,data);if(matches!==null){results.push(matches)}}callback({results:results})};InputData.prototype.addOptions=function(_,$options){var options=$.map($options,function($option){return $.data($option[0],"data")});this._currentData.push.apply(this._currentData,options)};return InputData});S2.define("select2/compat/matcher",["jquery"],function($){function oldMatcher(matcher){function wrappedMatcher(params,data){var match=$.extend(true,{},data);if(params.term==null||$.trim(params.term)===""){return match}if(data.children){for(var c=data.children.length-1;c>=0;c--){var child=data.children[c];var doesMatch=matcher(params.term,child.text,child);if(!doesMatch){match.children.splice(c,1)}}if(match.children.length>0){return match}}if(matcher(params.term,data.text,data)){return match}return null}return wrappedMatcher}return oldMatcher});S2.define("select2/compat/query",[],function(){function Query(decorated,$element,options){if(options.get("debug")&&window.console&&console.warn){console.warn("Select2: The `query` option has been deprecated in favor of a "+"custom data adapter that overrides the `query` method. Support "+"will be removed for the `query` option in future versions of "+"Select2.")}decorated.call(this,$element,options)}Query.prototype.query=function(_,params,callback){params.callback=callback;var query=this.options.get("query");query.call(null,params)};return Query});S2.define("select2/dropdown/attachContainer",[],function(){function AttachContainer(decorated,$element,options){decorated.call(this,$element,options)}AttachContainer.prototype.position=function(decorated,$dropdown,$container){var $dropdownContainer=$container.find(".dropdown-wrapper");$dropdownContainer.append($dropdown);$dropdown.addClass("select2-dropdown--below");$container.addClass("select2-container--below")};return AttachContainer});S2.define("select2/dropdown/stopPropagation",[],function(){function StopPropagation(){}StopPropagation.prototype.bind=function(decorated,container,$container){decorated.call(this,container,$container);var stoppedEvents=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$dropdown.on(stoppedEvents.join(" "),function(evt){evt.stopPropagation()})};return StopPropagation});S2.define("select2/selection/stopPropagation",[],function(){function StopPropagation(){}StopPropagation.prototype.bind=function(decorated,container,$container){decorated.call(this,container,$container);var stoppedEvents=["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"];this.$selection.on(stoppedEvents.join(" "),function(evt){evt.stopPropagation()})};return StopPropagation});(function(factory){if(typeof S2.define==="function"&&S2.define.amd){S2.define("jquery-mousewheel",["jquery"],factory)}else if(typeof exports==="object"){module.exports=factory}else{factory(jQuery)}})(function($){var toFix=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],toBind="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],slice=Array.prototype.slice,nullLowestDeltaTimeout,lowestDelta;if($.event.fixHooks){for(var i=toFix.length;i;){$.event.fixHooks[toFix[--i]]=$.event.mouseHooks}}var special=$.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener){for(var i=toBind.length;i;){this.addEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=handler}$.data(this,"mousewheel-line-height",special.getLineHeight(this));$.data(this,"mousewheel-page-height",special.getPageHeight(this))},teardown:function(){if(this.removeEventListener){for(var i=toBind.length;i;){this.removeEventListener(toBind[--i],handler,false)}}else{this.onmousewheel=null}$.removeData(this,"mousewheel-line-height");$.removeData(this,"mousewheel-page-height")},getLineHeight:function(elem){var $elem=$(elem),$parent=$elem["offsetParent"in $.fn?"offsetParent":"parent"]();if(!$parent.length){$parent=$("body")}return parseInt($parent.css("fontSize"),10)||parseInt($elem.css("fontSize"),10)||16},getPageHeight:function(elem){return $(elem).height()},settings:{adjustOldDeltas:true,normalizeOffset:true}};$.fn.extend({mousewheel:function(fn){return fn?this.bind("mousewheel",fn):this.trigger("mousewheel")},unmousewheel:function(fn){return this.unbind("mousewheel",fn)}});function handler(event){var orgEvent=event||window.event,args=slice.call(arguments,1),delta=0,deltaX=0,deltaY=0,absDelta=0,offsetX=0,offsetY=0;event=$.event.fix(orgEvent);event.type="mousewheel";if("detail"in orgEvent){deltaY=orgEvent.detail*-1}if("wheelDelta"in orgEvent){deltaY=orgEvent.wheelDelta}if("wheelDeltaY"in orgEvent){deltaY=orgEvent.wheelDeltaY}if("wheelDeltaX"in orgEvent){deltaX=orgEvent.wheelDeltaX*-1}if("axis"in orgEvent&&orgEvent.axis===orgEvent.HORIZONTAL_AXIS){deltaX=deltaY*-1;deltaY=0}delta=deltaY===0?deltaX:deltaY;if("deltaY"in orgEvent){deltaY=orgEvent.deltaY*-1;delta=deltaY}if("deltaX"in orgEvent){deltaX=orgEvent.deltaX;if(deltaY===0){delta=deltaX*-1}}if(deltaY===0&&deltaX===0){return}if(orgEvent.deltaMode===1){var lineHeight=$.data(this,"mousewheel-line-height");delta*=lineHeight;deltaY*=lineHeight;deltaX*=lineHeight}else if(orgEvent.deltaMode===2){var pageHeight=$.data(this,"mousewheel-page-height");delta*=pageHeight;deltaY*=pageHeight;deltaX*=pageHeight}absDelta=Math.max(Math.abs(deltaY),Math.abs(deltaX));if(!lowestDelta||absDelta<lowestDelta){lowestDelta=absDelta;if(shouldAdjustOldDeltas(orgEvent,absDelta)){lowestDelta/=40}}if(shouldAdjustOldDeltas(orgEvent,absDelta)){delta/=40;deltaX/=40;deltaY/=40}delta=Math[delta>=1?"floor":"ceil"](delta/lowestDelta);deltaX=Math[deltaX>=1?"floor":"ceil"](deltaX/lowestDelta);deltaY=Math[deltaY>=1?"floor":"ceil"](deltaY/lowestDelta);if(special.settings.normalizeOffset&&this.getBoundingClientRect){var boundingRect=this.getBoundingClientRect();offsetX=event.clientX-boundingRect.left;offsetY=event.clientY-boundingRect.top}event.deltaX=deltaX;event.deltaY=deltaY;event.deltaFactor=lowestDelta;event.offsetX=offsetX;event.offsetY=offsetY;event.deltaMode=0;args.unshift(event,delta,deltaX,deltaY);if(nullLowestDeltaTimeout){clearTimeout(nullLowestDeltaTimeout)}nullLowestDeltaTimeout=setTimeout(nullLowestDelta,200);return($.event.dispatch||$.event.handle).apply(this,args)}function nullLowestDelta(){lowestDelta=null}function shouldAdjustOldDeltas(orgEvent,absDelta){return special.settings.adjustOldDeltas&&orgEvent.type==="mousewheel"&&absDelta%120===0}});S2.define("jquery.select2",["jquery","jquery-mousewheel","./select2/core","./select2/defaults"],function($,_,Select2,Defaults){if($.fn.selectWoo==null){var thisMethods=["open","close","destroy"];$.fn.selectWoo=function(options){options=options||{};if(typeof options==="object"){this.each(function(){var instanceOptions=$.extend(true,{},options);var instance=new Select2($(this),instanceOptions)});return this}else if(typeof options==="string"){var ret;var args=Array.prototype.slice.call(arguments,1);this.each(function(){var instance=$(this).data("select2");if(instance==null&&window.console&&console.error){console.error("The select2('"+options+"') method was called on an "+"element that is not using Select2.")}ret=instance[options].apply(instance,args)});if($.inArray(options,thisMethods)>-1){return this}return ret}else{throw new Error("Invalid arguments for Select2: "+options)}}}if($.fn.select2!=null&&$.fn.select2.defaults!=null){$.fn.selectWoo.defaults=$.fn.select2.defaults}if($.fn.selectWoo.defaults==null){$.fn.selectWoo.defaults=Defaults}$.fn.select2=$.fn.select2||$.fn.selectWoo;return Select2});return{define:S2.define,require:S2.require}}();var select2=S2.require("jquery.select2");jQuery.fn.select2.amd=S2;jQuery.fn.selectWoo.amd=S2;return select2});
|
js/public/wpm-public.p1.min.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
-
(()=>{var e={164:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.pixel_id||null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.facebook)&&void 0!==n&&n.loaded||wpm.canIFire("ads","facebook-ads")&&wpm.loadFacebookPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToCart",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToCart",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e){try{var t,o,a;if(null===(t=wpmDataLayer)||void 0===t||null===(o=t.pixels)||void 0===o||null===(a=o.facebook)||void 0===a||!a.loaded)return;let e=wpm.getRandomEventId();fbq("track","InitiateCheckout",{},{eventID:e}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"InitiateCheckout",event_id:e,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToWishlist",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToWishlist",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;wpm.fbViewContent(t)}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;let a=wpm.getRandomEventId();fbq("track","Search",{},{eventID:a}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"Search",event_id:a,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmLoadAlways",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;wpm.setFbUserData()}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;fbq("track","Purchase",{content_type:"product",value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,content_ids:wpm.facebookContentIds()},{eventID:wpmDataLayer.order.id})}catch(e){console.error(e)}}))},1:()=>{!function(e,t,o){let a;e.loadFacebookPixel=function(){try{wpmDataLayer.pixels.facebook.loaded=!0,e=window,t=document,o="script",e.fbq||(a=e.fbq=function(){a.callMethod?a.callMethod.apply(a,arguments):a.queue.push(arguments)},e._fbq||(e._fbq=a),a.push=a,a.loaded=!0,a.version="2.0",a.queue=[],(r=t.createElement(o)).async=!0,r.src="https://connect.facebook.net/en_US/fbevents.js",(n=t.getElementsByTagName(o)[0]).parentNode.insertBefore(r,n)),fbq("init",wpmDataLayer.pixels.facebook.pixel_id),fbq("track","PageView")}catch(o){console.error(o)}var e,t,o,a,r,n},e.getRandomEventId=function(){return(Math.random()+1).toString(36).substring(2)},e.getFbUserData=function(){return a||e.getFbUserDataFromBrowser()},e.setFbUserData=function(){a=e.getFbUserDataFromBrowser()},e.getFbUserDataFromBrowser=function(){return{fbp:e.getCookie("_fbp"),fbc:e.getCookie("_fbc"),client_user_agent:navigator.userAgent}},e.fbViewContent=function(t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let n=e.getRandomEventId();fbq("track","ViewContent",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],currency:wpmDataLayer.shop.currency,value:t.price},{eventID:n}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"ViewContent",event_id:n,user_data:e.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}},e.facebookContentIds=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))}return e}}(window.wpm=window.wpm||{},jQuery)},12:(e,t,o)=>{o(1),o(164)},165:()=>{jQuery(document).on("wpmViewItemList",(function(e,t){try{var o,a,r,n,i,s,d,l,c,u,p;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;if(null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.general)&&void 0!==p&&p.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;if(!t)return;wpm.gtagLoaded().then((function(){gtag("event","view_item_list",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var o,a,r,n,i,s,d,l,c;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","add_to_cart",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:t.quantity*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var o,a,r,n,i,s,d,l,c;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","view_item",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:(t.quantity?t.quantity:1)*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity?t.quantity:1,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let u=[];for(const[e,t]of Object.entries(wpmDataLayer.products)){var l,c;if(null!==(l=wpmDataLayer)&&void 0!==l&&null!==(c=l.general)&&void 0!==c&&c.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;u.push({id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical})}wpm.gtagLoaded().then((function(){gtag("event","view_search_results",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:u})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:wpmDataLayer.order.value_filtered,items:wpm.getGoogleAdsDynamicRemarketingOrderItems()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmLogin",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","login",{send_to:wpm.getGoogleAdsConversionIdentifiers()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(!wpm.googleConfigConditionsMet("ads"))return;let i={},s={};i={send_to:wpm.getGoogleAdsConversionIdentifiersWithLabel(),transaction_id:wpmDataLayer.order.number,value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,new_customer:wpmDataLayer.order.new_customer},null!==(r=wpmDataLayer)&&void 0!==r&&null!==(n=r.order)&&void 0!==n&&n.aw_merchant_id&&(s={discount:wpmDataLayer.order.discount,aw_merchant_id:wpmDataLayer.order.aw_merchant_id,aw_feed_country:wpmDataLayer.order.aw_feed_country,aw_feed_language:wpmDataLayer.order.aw_feed_language,items:wpm.getGoogleAdsRegularOrderItems()}),wpm.gtagLoaded().then((function(){gtag("event","conversion",{...i,...s})}))}catch(e){console.error(e)}}))},42:()=>{!function(e,t,o){let a=[];e.getGoogleAdsConversionIdentifiersWithLabel=function(){for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))a.push(e+"/"+t);return a},e.getGoogleAdsConversionIdentifiers=function(){let e=[];for(const[t,o]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))e.push(t);return e},e.getGoogleAdsRegularOrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a)):(a.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a))}return e},e.getGoogleAdsDynamicRemarketingOrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a)):(a.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a))}return e}}(window.wpm=window.wpm||{},jQuery)},190:(e,t,o)=>{o(42),o(165)},625:()=>{jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d,l;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.analytics)||void 0===a||null===(r=a.universal)||void 0===r||!r.property_id)return;if(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.universal)&&void 0!==l&&l.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.universal.property_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGAUAOrderItems()})}))}catch(e){console.error(e)}}))},19:()=>{!function(e,t,o){e.getGAUAOrderItems=function(){let t=[];for(const[r,n]of Object.entries(wpmDataLayer.order.items)){var o,a;let r;r={quantity:n.quantity,price:n.price,name:n.name,currency:wpmDataLayer.order.currency,category:wpmDataLayer.products[n.id].category.join("/")},null!==(o=wpmDataLayer)&&void 0!==o&&null!==(a=o.general)&&void 0!==a&&a.variationsOutput&&0!==n.variation_id?(r.id=String(wpmDataLayer.products[n.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.variant=wpmDataLayer.products[n.variation_id].variant_name,r.brand=wpmDataLayer.products[n.variation_id].brand):(r.id=String(wpmDataLayer.products[n.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.brand=wpmDataLayer.products[n.id].brand),r=e.ga3AddListNameToProduct(r),t.push(r)}return t},e.ga3AddListNameToProduct=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:null;return e.list_name=wpmDataLayer.shop.list_name,t&&(e.list_position=t),e}}(window.wpm=window.wpm||{},jQuery)},562:(e,t,o)=>{o(19),o(625)},572:()=>{jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d,l;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.analytics)||void 0===a||null===(r=a.ga4)||void 0===r||!r.measurement_id)return;if(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.ga4.measurement_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGA4OrderItems()})}))}catch(e){console.error(e)}}))},228:()=>{!function(e,t,o){e.getGA4OrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price,item_name:r.name,currency:wpmDataLayer.order.currency,item_category:wpmDataLayer.products[r.id].category.join("/")},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.item_id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),a.item_variant=wpmDataLayer.products[r.variation_id].variant_name,a.item_brand=wpmDataLayer.products[r.variation_id].brand):(a.item_id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),a.item_brand=wpmDataLayer.products[r.id].brand),e.push(a)}return e}}(window.wpm=window.wpm||{},jQuery)},522:(e,t,o)=>{o(228),o(572)},774:(e,t,o)=>{o(562),o(522)},294:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o;void 0===(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o?void 0:o.state)&&(wpm.canGoogleLoad()?wpm.loadGoogle():wpm.logPreventedPixelLoading("google","analytics / ads"))}))},860:()=>{!function(e,t,o){e.googleConfigConditionsMet=function(t){var o,a,r,n;return!(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.consent_mode)||void 0===n||!n.active)||("category"===e.getConsentValues().mode?!0===e.getConsentValues().categories[t]:"pixel"===e.getConsentValues().mode&&e.getConsentValues().pixels.includes("google-"+t))},e.getVisitorConsentStatusAndUpdateGoogleConsentSettings=function(t){return"category"===e.getConsentValues().mode?(e.getConsentValues().categories.analytics&&(t.analytics_storage="granted"),e.getConsentValues().categories.ads&&(t.ad_storage="granted")):"pixel"===e.getConsentValues().mode&&(t.analytics_storage=e.getConsentValues().pixels.includes("google-analytics")?"granted":"denied",t.ad_storage=e.getConsentValues().pixels.includes("google-ads")?"granted":"denied"),t},e.updateGoogleConsentMode=function(){let e=!(arguments.length>0&&arguments[0]!==o)||arguments[0],t=!(arguments.length>1&&arguments[1]!==o)||arguments[1];try{if(!window.gtag||!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent)return;gtag("consent","update",{analytics_storage:e?"granted":"denied",ad_storage:t?"granted":"denied"})}catch(e){console.error(e)}},e.fireGtagGoogleAds=function(){try{var e,t,o,a,r,n,i,s,d,l,c,u,p,g,m,y,w,v,f,_,h;if(wpmDataLayer.pixels.google.ads.state="loading",null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.ads)&&void 0!==a&&null!==(r=a.enhanced_conversions)&&void 0!==r&&r.active)for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e,{allow_enhanced_conversions:!0});else for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e);null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.ads)&&void 0!==d&&d.conversionIds&&null!==(l=wpmDataLayer)&&void 0!==l&&null!==(c=l.pixels)&&void 0!==c&&null!==(u=c.google)&&void 0!==u&&null!==(p=u.ads)&&void 0!==p&&p.phone_conversion_label&&null!==(g=wpmDataLayer)&&void 0!==g&&null!==(m=g.pixels)&&void 0!==m&&null!==(y=m.google)&&void 0!==y&&null!==(w=y.ads)&&void 0!==w&&w.phone_conversion_number&>ag("config",Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]+"/"+wpmDataLayer.pixels.google.ads.phone_conversion_label,{phone_conversion_number:wpmDataLayer.pixels.google.ads.phone_conversion_number}),"order_received_page"===wpmDataLayer.shop.page_type&&null!==(v=wpmDataLayer)&&void 0!==v&&null!==(f=v.order)&&void 0!==f&&null!==(_=f.google)&&void 0!==_&&null!==(h=_.ads)&&void 0!==h&&h.enhanced_conversion_data&&(window.enhanced_conversion_data=wpmDataLayer.order.google.ads.enhanced_conversion_data),wpmDataLayer.pixels.google.ads.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsUA=function(){try{wpmDataLayer.pixels.google.analytics.universal.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.universal.property_id,wpmDataLayer.pixels.google.analytics.universal.parameters),wpmDataLayer.pixels.google.analytics.universal.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsGA4=function(){try{wpmDataLayer.pixels.google.analytics.ga4.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.ga4.measurement_id,wpmDataLayer.pixels.google.analytics.ga4.parameters),wpmDataLayer.pixels.google.analytics.ga4.state="ready"}catch(e){console.error(e)}},e.isGoogleActive=function(){var e,t,o,a,r,n,i,s,d,l,c,u,p,g;return!(!(null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.analytics)&&void 0!==a&&null!==(r=a.universal)&&void 0!==r&&r.property_id||null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.measurement_id)&&jQuery.isEmptyObject(null===(c=wpmDataLayer)||void 0===c||null===(u=c.pixels)||void 0===u||null===(p=u.google)||void 0===p||null===(g=p.ads)||void 0===g?void 0:g.conversionIds))},e.getGoogleGtagId=function(){var e,t,o,a,r,n,i,s,d,l;return null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.analytics)&&void 0!==a&&null!==(r=a.universal)&&void 0!==r&&r.property_id?wpmDataLayer.pixels.google.analytics.universal.property_id:null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.measurement_id?wpmDataLayer.pixels.google.analytics.ga4.measurement_id:Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]},e.loadGoogle=function(){e.isGoogleActive()&&(wpmDataLayer.pixels.google.state="loading",e.loadScriptAndCacheIt("https://www.googletagmanager.com/gtag/js?id="+e.getGoogleGtagId()).done((function(t,o){try{var a,r,n,i,s,d,l,c,u,p,g,m,y,w,v,f,_,h,L,D,C,b;if(window.dataLayer=window.dataLayer||[],window.gtag=function(){dataLayer.push(arguments)},null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.google)&&void 0!==n&&null!==(i=n.consent_mode)&&void 0!==i&&i.active){var j,x,k,I;let t={ad_storage:wpmDataLayer.pixels.google.consent_mode.ad_storage,analytics_storage:wpmDataLayer.pixels.google.consent_mode.analytics_storage,wait_for_update:wpmDataLayer.pixels.google.consent_mode.wait_for_update};null!==(j=wpmDataLayer)&&void 0!==j&&null!==(x=j.pixels)&&void 0!==x&&null!==(k=x.google)&&void 0!==k&&null!==(I=k.consent_mode)&&void 0!==I&&I.region&&(t.region=wpmDataLayer.pixels.google.consent_mode.region),t=e.getVisitorConsentStatusAndUpdateGoogleConsentSettings(t),gtag("consent","default",t),gtag("set","ads_data_redaction",wpmDataLayer.pixels.google.consent_mode.ads_data_redaction),gtag("set","url_passthrough",wpmDataLayer.pixels.google.consent_mode.url_passthrough)}null!==(s=wpmDataLayer)&&void 0!==s&&null!==(d=s.pixels)&&void 0!==d&&null!==(l=d.google)&&void 0!==l&&null!==(c=l.linker)&&void 0!==c&&c.settings&>ag("set","linker",wpmDataLayer.pixels.google.linker.settings),gtag("js",new Date),jQuery.isEmptyObject(null===(u=wpmDataLayer)||void 0===u||null===(p=u.pixels)||void 0===p||null===(g=p.google)||void 0===g||null===(m=g.ads)||void 0===m?void 0:m.conversionIds)||(e.googleConfigConditionsMet("ads")?e.fireGtagGoogleAds():e.logPreventedPixelLoading("google-ads","ads")),null!==(y=wpmDataLayer)&&void 0!==y&&null!==(w=y.pixels)&&void 0!==w&&null!==(v=w.google)&&void 0!==v&&null!==(f=v.analytics)&&void 0!==f&&null!==(_=f.universal)&&void 0!==_&&_.property_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsUA():e.logPreventedPixelLoading("google-universal-analytics","analytics")),null!==(h=wpmDataLayer)&&void 0!==h&&null!==(L=h.pixels)&&void 0!==L&&null!==(D=L.google)&&void 0!==D&&null!==(C=D.analytics)&&void 0!==C&&null!==(b=C.ga4)&&void 0!==b&&b.measurement_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsGA4():e.logPreventedPixelLoading("ga4","analytics")),wpmDataLayer.pixels.google.state="ready"}catch(e){console.error(e)}})))},e.canGoogleLoad=function(){var t,o,a,r;return!(null===(t=wpmDataLayer)||void 0===t||null===(o=t.pixels)||void 0===o||null===(a=o.google)||void 0===a||null===(r=a.consent_mode)||void 0===r||!r.active)||("category"===e.getConsentValues().mode?!(!e.getConsentValues().categories.ads&&!e.getConsentValues().categories.analytics):"pixel"===e.getConsentValues().mode?e.getConsentValues().pixels.includes("google-ads")||e.getConsentValues().pixels.includes("google-analytics"):(console.error("Couldn't find a valid load condition for Google mode in wpmConsentValues"),!1))},e.gtagLoaded=function(){return new Promise((function(e,t){var o,a,r;void 0===(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r?void 0:r.state)&&t();let n=0;!function o(){var a,r,i;return"ready"===(null===(a=wpmDataLayer)||void 0===a||null===(r=a.pixels)||void 0===r||null===(i=r.google)||void 0===i?void 0:i.state)?e():n>=5e3?t():(n+=200,void setTimeout(o,200))}()}))}}(window.wpm=window.wpm||{},jQuery)},580:(e,t,o)=>{o(860),o(294)},69:(e,t,o)=>{o(580),o(190),o(774),o(463)},945:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n,i,s;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.optimize)||void 0===a||!a.container_id||null!==(r=wpmDataLayer)&&void 0!==r&&null!==(n=r.pixels)&&void 0!==n&&null!==(i=n.google)&&void 0!==i&&null!==(s=i.optimize)&&void 0!==s&&s.loaded||wpm.canIFire("analytics","google-optimize")&&wpm.load_google_optimize_pixel()}))},962:()=>{!function(e,t,o){e.load_google_optimize_pixel=function(){try{wpmDataLayer.pixels.google.optimize.loaded=!0,e.loadScriptAndCacheIt("https://www.googleoptimize.com/optimize.js?id="+wpmDataLayer.pixels.google.optimize.container_id)}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery)},463:(e,t,o)=>{o(962),o(945)},300:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n,i,s,d;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.hotjar)||void 0===o||!o.site_id||null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.hotjar)&&void 0!==n&&n.loaded||!wpm.canIFire("analytics","hotjar")||null!==(i=wpmDataLayer)&&void 0!==i&&null!==(s=i.pixels)&&void 0!==s&&null!==(d=s.hotjar)&&void 0!==d&&d.loaded||wpm.load_hotjar_pixel()}))},376:()=>{!function(e,t,o){e.load_hotjar_pixel=function(){try{wpmDataLayer.pixels.hotjar.loaded=!0,e=window,t=document,e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6},o=t.getElementsByTagName("head")[0],(a=t.createElement("script")).async=1,a.src="https://static.hotjar.com/c/hotjar-"+e._hjSettings.hjid+".js?sv="+e._hjSettings.hjsv,o.appendChild(a)}catch(e){console.error(e)}var e,t,o,a}}(window.wpm=window.wpm||{},jQuery)},787:(e,t,o)=>{o(376),o(300)},299:()=>{jQuery(document).on("click",".remove_from_cart_button, .remove",(function(){try{let e=new URL(jQuery(this).attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e);wpm.removeProductFromCart(t)}catch(e){console.error(e)}})),jQuery(document).on("click",".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button",(function(){try{if("product"===wpmDataLayer.shop.page_type){if(void 0!==jQuery(this).attr("href")&&jQuery(this).attr("href").includes("add-to-cart")){let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}else if("simple"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).val();wpm.addProductToCart(t,e)}else if("variable"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("[name='variation_id']").val();wpm.addProductToCart(t,e)}else if("grouped"===wpmDataLayer.shop.product_type)jQuery(".woocommerce-grouped-product-list-item").each((function(){let e=Number(jQuery(this).find(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).attr("class"),o=wpm.getPostIdFromString(t);wpm.addProductToCart(o,e)}));else if("bundle"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("input[name=add-to-cart]").val();wpm.addProductToCart(t,e)}}else{let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}}catch(e){console.error(e)}})),jQuery(document).one("click","a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)",(function(e){try{if(jQuery(e.target).closest("a").attr("href")){let t=jQuery(e.target).closest("a").attr("href");if(t.includes("add-to-cart=")){let e=t.match(/(add-to-cart=)(\d+)/);e&&wpm.addProductToCart(e[2],1)}}}catch(e){console.error(e)}})),jQuery(document).on("click",".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product",(function(){try{let e=jQuery(this).nextAll(".wpmProductId:first").data("id");if(e){if(e=getIdBasedOndVariationsOutputSetting(e),!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmSelectContentGaUa",t),jQuery(document).trigger("wpmSelectItem",t)}}}catch(e){console.error(e)}})),jQuery(document).one("click",".checkout-button, .cart-checkout-button, .button.checkout",(function(){jQuery(document).trigger("wpmBeginCheckout")})),jQuery(document).on("input","#billing_email",(function(){wpm.isEmail(jQuery(this).val())&&(wpm.fireCheckoutProgress(2),wpm.emailSelected=!0)})),jQuery(document).on("click",".wc_payment_methods",(function(){!1===wpm.paymentMethodSelected&&wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val()),wpm.paymentMethodSelected=!0})),jQuery(document).one("click","#place_order",(function(){!1===wpm.emailSelected&&wpm.fireCheckoutProgress(2),!1===wpm.paymentMethodSelected&&(wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val())),wpm.fireCheckoutProgress(4)})),jQuery(document).on("click","[name='update_cart']",(function(){try{jQuery(".cart_item").each((function(){let e=new URL(jQuery(this).find(".product-remove").find("a").attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e),o=jQuery(this).find(".qty").val();0===o?wpm.removeProductFromCart(t):o<wpmDataLayer.cart[t].quantity?wpm.removeProductFromCart(t,wpmDataLayer.cart[t].quantity-o):o>wpmDataLayer.cart[t].quantity&&wpm.addProductToCart(t,o-wpmDataLayer.cart[t].quantity)}))}catch(e){console.error(e),wpm.getCartItemsFromBackend()}})),jQuery(document).on("click",".add_to_wishlist, .wl-add-to",(function(){try{let e;if(jQuery(this).data("productid")?e=jQuery(this).data("productid"):jQuery(this).data("product-id")&&(e=jQuery(this).data("product-id")),!e)throw Error("Wasn't able to retrieve a productId");let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmAddToWishlist",t)}catch(e){console.error(e)}})),jQuery(document).on("updated_cart_totals",(function(){jQuery(document).trigger("wpmViewCart")})),jQuery((function(){jQuery(".single_variation_wrap").on("show_variation",(function(e,t){try{let e=getIdBasedOndVariationsOutputSetting(t.variation_id);if(!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmViewItem",t)}}catch(e){console.error(e)}}))})),jQuery((function(){jQuery(".single_variation_wrap").on("hide_variation",(function(){try{var e,t;let o=jQuery("body").attr("class").match(/(postid-)(\d+)/)[2];if(!o)throw Error("Wasn't able to retrieve a productId");if("variable"===wpmDataLayer.shop.product_type&&null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.general)&&void 0!==t&&t.variationsOutput)for(const[e,t]of Object.entries(wpmDataLayer.products))if("parentId"in t){o=t.id;break}if(wpmDataLayer.products&&wpmDataLayer.products[o]){let e=wpm.getProductDetailsFormattedForEvent(o);jQuery(document).trigger("wpmViewItem",e)}}catch(e){console.error(e)}}))})),jQuery(window).on("wpmLoad",(function(){try{wpm.doesWooCommerceCartExist()&&wpm.getCartItems()}catch(e){console.error(e)}})),jQuery(window).on("wpmLoad",(function(){wpmDataLayer.products=wpmDataLayer.products||{};let e=wpm.getAddToCartLinkProductIds();wpm.getProductsFromBackend(e)})),jQuery(window).on("wpmLoad",(function(){if(!wpm.getCookie("wpmReferrer"))if(document.referrer){let e=new URL(document.referrer).hostname;e!==window.location.host?wpm.setCookie("wpmReferrer",e):wpm.setCookie("wpmReferrer","")}else wpm.setCookie("wpmReferrer","")})),jQuery(window).on("wpmLoad",(function(){try{var e;if("undefined"!=typeof wpmDataLayer&&(null===(e=wpmDataLayer)||void 0===e||!e.wpmLoadFired)){var t,o;if(jQuery(document).trigger("wpmLoadAlways"),"product"===wpmDataLayer.shop.page_type&&"variable"!==wpmDataLayer.shop.product_type&&wpm.getMainProductIdFromProductPage()){let e=wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage());jQuery(document).trigger("wpmViewItem",e)}else"product_category"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmCategory"):"search"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmSearch"):"cart"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmViewCart"):"order_received_page"===wpmDataLayer.shop.page_type&&wpmDataLayer.order?wpm.isOrderIdStored(wpmDataLayer.order.id)||(jQuery(document).trigger("wpmOrderReceivedPage"),wpm.writeOrderIdToStorage(wpmDataLayer.order.id)):jQuery(document).trigger("wpmEverywhereElse");null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.user)&&void 0!==o&&o.id&&!wpm.hasLoginEventFired()&&(jQuery(document).trigger("wpmLogin"),wpm.setLoginEventFired()),wpmDataLayer.wpmLoadFired=!0}}catch(e){console.error(e)}})),jQuery(window).on("wpmPreLoadPixels",(function(){var e,t,o;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.shop)&&void 0!==t&&null!==(o=t.cookie_consent_mgmt)&&void 0!==o&&o.explicit_consent&&wpm.updateConsentCookieValues(!0),jQuery(document).trigger("wpmLoadPixels",{})}))},584:()=>{!function(e,t,o){const a="_wpm_order_ids",r="_wpm_endpoint_available",n="/wp-json/";function i(){return""!==e.getCookie(a)}e.emailSelected=!1,e.paymentMethodSelected=!1,e.useRestEndpoint=function(){return e.isSessionStorageAvailable()&&e.isRestEndpointAvailable()&&e.isBelowRestErrorThreshold()},e.isBelowRestErrorThreshold=function(){return window.sessionStorage.getItem(0)<=10},e.isRestEndpointAvailable=function(){if(window.sessionStorage.getItem(r))return JSON.parse(window.sessionStorage.getItem(r));e.testEndpoint()},e.isSessionStorageAvailable=function(){return!!window.sessionStorage},e.testEndpoint=function(){let e=arguments.length>0&&arguments[0]!==o?arguments[0]:location.protocol+"//"+location.host+n,t=arguments.length>1&&arguments[1]!==o?arguments[1]:r;jQuery.ajax(e,{type:"HEAD",timeout:1e3,statusCode:{200:function(e){window.sessionStorage.setItem(t,JSON.stringify(!0))},404:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))},0:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))}}}).then((e=>{}))},e.isWpmRestEndpointAvailable=function(){let t=arguments.length>0&&arguments[0]!==o?arguments[0]:r;return!!e.getCookie(t)},e.writeOrderIdToStorage=function(t){if(window.Storage)if(null===localStorage.getItem(a)){let e=[];e.push(t),window.localStorage.setItem(a,JSON.stringify(e))}else{let e=JSON.parse(localStorage.getItem(a));e.includes(t)||(e.push(t),window.localStorage.setItem(a,JSON.stringify(e)))}else{let o=new Date;o.setDate(o.getDate()+365);let r=[];i()&&(r=JSON.parse(e.getCookie(a))),r.includes(t)||(r.push(t),document.cookie="_wpm_order_ids="+JSON.stringify(r)+";expires="+o.toUTCString())}"function"==typeof e.storeOrderIdOnServer&&wpmDataLayer.orderDeduplication&&e.storeOrderIdOnServer(t)},e.isOrderIdStored=function(t){return wpmDataLayer.orderDeduplication?window.Storage?null!==localStorage.getItem(a)&&JSON.parse(localStorage.getItem(a)).includes(t):!!i()&&JSON.parse(e.getCookie(a)).includes(t):(console.log("order duplication prevention: off"),!1)},e.isEmail=function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},e.removeProductFromCart=function(t){let a=arguments.length>1&&arguments[1]!==o?arguments[1]:null;try{if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");let o;if(o=null==a?wpmDataLayer.cart[t].quantity:a,wpmDataLayer.cart[t]){let r=e.getProductDetailsFormattedForEvent(t,o);jQuery(document).trigger("wpmRemoveFromCart",r),null==a||wpmDataLayer.cart[t].quantity===a?(delete wpmDataLayer.cart[t],sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))):(wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity-o,sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart)))}}catch(e){console.error(e)}},getIdBasedOndVariationsOutputSetting=function(e){try{var t,o;return null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput?e:wpmDataLayer.products[e].isVariation?wpmDataLayer.products[e].parentId:e}catch(e){console.error(e)}},e.addProductToCart=function(t,o){try{var a;if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");if(null!==(a=wpmDataLayer)&&void 0!==a&&a.products[t]){var r;let a=e.getProductDetailsFormattedForEvent(t,o);jQuery(document).trigger("wpmAddToCart",a),null!==(r=wpmDataLayer)&&void 0!==r&&r.cart[t]?wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity+o:("cart"in wpmDataLayer||(wpmDataLayer.cart={}),wpmDataLayer.cart[t]=e.getProductDetailsFormattedForEvent(t,o)),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))}}catch(t){console.error(t),e.getCartItemsFromBackend()}},e.getCartItems=function(){sessionStorage?sessionStorage.getItem("wpmDataLayerCart")&&"order_received_page"!==wpmDataLayer.shop.page_type?e.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem("wpmDataLayerCart"))):sessionStorage.setItem("wpmDataLayerCart",JSON.stringify({})):e.getCartItemsFromBackend()},e.getCartItemsFromBackend=function(){try{let t={action:"wpm_get_cart_items"};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:t,success:function(t){t.cart||(t.cart={}),e.saveCartObjectToDataLayer(t.cart),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(t.cart))}})}catch(e){console.error(e)}},e.getProductsFromBackend=function(t){if((t=t.filter((e=>!wpmDataLayer.products.hasOwnProperty(e))))&&0!==t.length)try{let o={action:"wpm_get_product_ids",productIds:t};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:o,success:function(e){wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.saveCartObjectToDataLayer=function(e){wpmDataLayer.cart=e,wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},e.fireCheckoutOption=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:null,a=arguments.length>2&&arguments[2]!==o?arguments[2]:null,r={step:e,checkout_option:t,value:a};jQuery(document).trigger("wpmFireCheckoutOption",r)},e.fireCheckoutProgress=function(e){let t={step:e};jQuery(document).trigger("wpmFireCheckoutProgress",t)},e.getPostIdFromString=function(e){try{return e.match(/(post-)(\d+)/)[2]}catch(e){console.error(e)}},e.triggerViewItemList=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");jQuery(document).trigger("wpmViewItemList",e.getProductDataForViewItemEvent(t))},e.getProductDataForViewItemEvent=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");try{if(wpmDataLayer.products[t])return e.getProductDetailsFormattedForEvent(t)}catch(e){console.error(e)}},e.getMainProductIdFromProductPage=function(){try{return["simple","variable","grouped","composite","bundle"].indexOf(wpmDataLayer.shop.product_type)>=0&&jQuery(".wpmProductId:first").data("id")}catch(e){console.error(e)}},e.viewItemListTriggerTestMode=function(e){jQuery(e).css({position:"relative"}),jQuery(e).append('<div id="viewItemListTriggerOverlay"></div>'),jQuery(e).find("#viewItemListTriggerOverlay").css({"z-index":"10",display:"block",position:"absolute",height:"100%",top:"0",left:"0",right:"0",opacity:wpmDataLayer.viewItemListTrigger.opacity,"background-color":wpmDataLayer.viewItemListTrigger.backgroundColor})},e.getSearchTermFromUrl=function(){try{return new URLSearchParams(window.location.search).get("s")}catch(e){console.error(e)}};let s,d={};e.observerCallback=function(t,o){t.forEach((t=>{try{let a,r=jQuery(t.target).data("ioid");if(a=jQuery(t.target).next(".wpmProductId").length?jQuery(t.target).next(".wpmProductId").data("id"):jQuery(t.target).find(".wpmProductId").data("id"),!a)throw Error("wpmProductId element not found");t.isIntersecting?d[r]=setTimeout((()=>{e.triggerViewItemList(a),wpmDataLayer.viewItemListTrigger.testMode&&e.viewItemListTriggerTestMode(t.target),!1===wpmDataLayer.viewItemListTrigger.repeat&&o.unobserve(t.target)}),wpmDataLayer.viewItemListTrigger.timeout):(clearTimeout(d[r]),wpmDataLayer.viewItemListTrigger.testMode&&jQuery(t.target).find("#viewItemListTriggerOverlay").remove())}catch(e){console.error(e)}}))};let l,c=0;e.startIntersectionObserverToWatch=function(){try{e.urlHasParameter("vildemomode")&&(wpmDataLayer.viewItemListTrigger.testMode=!0),s=new IntersectionObserver(e.observerCallback,{threshold:wpmDataLayer.viewItemListTrigger.threshold}),l=jQuery(".wpmProductId").map((function(e,t){return jQuery(t).parent().hasClass("type-product")||jQuery(t).parent().hasClass("product")||jQuery(t).parent().hasClass("product-item-inner")?jQuery(t).parent():jQuery(t).prev().hasClass("wc-block-grid__product")||jQuery(t).prev().hasClass("product")||jQuery(t).prev().hasClass("product-small")||jQuery(t).prev().hasClass("woocommerce-LoopProduct-link")?jQuery(this).prev():jQuery(t).closest(".product").length?jQuery(t).closest(".product"):void 0})),l.each((function(e,t){jQuery(t[0]).data("ioid",c++),s.observe(t[0])}))}catch(e){console.error(e)}},e.startProductsMutationObserverToWatch=function(){try{let e=jQuery(".wpmProductId:eq(0)").parents().has(jQuery(".wpmProductId:eq(1)").parents()).first();e.length&&u.observe(e[0],{attributes:!0,childList:!0,characterData:!0})}catch(e){console.error(e)}};let u=new MutationObserver((function(e){e.forEach((function(e){let t=e.addedNodes;null!==t&&jQuery(t).each((function(){(jQuery(this).hasClass("type-product")||jQuery(this).hasClass("product-small")||jQuery(this).hasClass("wc-block-grid__product"))&&p(this)&&(jQuery(this).data("ioid",c++),s.observe(this))}))}))})),p=function(e){return!(!jQuery(e).find(".wpmProductId").length&&!jQuery(e).siblings(".wpmProductId").length)};e.setCookie=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:"",a=arguments.length>2&&arguments[2]!==o?arguments[2]:null;if(a){let o=new Date;o.setTime(o.getTime()+24*a*60*60*1e3);let r="expires="+o.toUTCString();document.cookie=e+"="+t+";"+r+";path=/"}else document.cookie=e+"="+t+";path=/"},e.getCookie=function(e){let t=e+"=",o=decodeURIComponent(document.cookie).split(";");for(let e=0;e<o.length;e++){let a=o[e];for(;" "==a.charAt(0);)a=a.substring(1);if(0==a.indexOf(t))return a.substring(t.length,a.length)}return""},e.getWpmSessionData=function(){if(window.sessionStorage){let e=window.sessionStorage.getItem("_wpm");return null!==e?JSON.parse(e):{}}return{}},e.setWpmSessionData=function(e){window.sessionStorage&&window.sessionStorage.setItem("_wpm",JSON.stringify(e))},e.storeOrderIdOnServer=function(t){try{let o={action:"wpm_purchase_pixels_fired",order_id:t,nonce:e.nonce};jQuery.ajax({type:"post",dataType:"json",url:e.ajax_url,data:o,success:function(e){!1===e.success&&console.log(e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.getProductIdByCartItemKeyUrl=function(e){let t,o=new URLSearchParams(e.search).get("remove_item");return t=0===wpmDataLayer.cartItemKeys[o].variation_id?wpmDataLayer.cartItemKeys[o].product_id:wpmDataLayer.cartItemKeys[o].variation_id,t},e.getAddToCartLinkProductIds=function(){return jQuery("a").map((function(){let e=jQuery(this).attr("href");if(e&&e.includes("?add-to-cart=")){let t=e.match(/(add-to-cart=)(\d+)/);if(t)return t[2]}})).get()},e.getProductDetailsFormattedForEvent=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:1,a={id:e.toString(),dyn_r_ids:wpmDataLayer.products[e].dyn_r_ids,name:wpmDataLayer.products[e].name,list_name:wpmDataLayer.shop.list_name,brand:wpmDataLayer.products[e].brand,category:wpmDataLayer.products[e].category,variant:wpmDataLayer.products[e].variant,list_position:wpmDataLayer.products[e].position,quantity:t,price:wpmDataLayer.products[e].price,currency:wpmDataLayer.shop.currency,isVariable:wpmDataLayer.products[e].isVariable,isVariation:wpmDataLayer.products[e].isVariation,parentId:wpmDataLayer.products[e].parentId};return a.isVariation&&(a.parentId_dyn_r_ids=wpmDataLayer.products[e].parentId_dyn_r_ids),a},e.setReferrerToCookie=function(){e.getCookie("wpmReferrer")||e.setCookie("wpmReferrer",document.referrer)},e.getReferrerFromCookie=function(){return e.getCookie("wpmReferrer")?e.getCookie("wpmReferrer"):null},e.getClidFromBrowser=function(){let t,a=arguments.length>0&&arguments[0]!==o?arguments[0]:"gclid";return t={gclid:"_gcl_aw",dclid:"_gcl_dc"},e.getCookie(t[a])?e.getCookie(t[a]).match(/(GCL.[\d]*.)(.*)/)[2]:""},e.getUserAgent=function(){return navigator.userAgent},e.getViewPort=function(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}};let g=function(){let t=e.getCookie("cmplz_statistics"),o=e.getCookie("cmplz_marketing");return!(!e.getCookie("cmplz_consent_status")&&!e.getCookie("cmplz_banner-status"))&&{analytics:"allow"===t,ads:"allow"===o,visitorHasChosen:!0}},m=function(){let t=e.getCookie("cookielawinfo-checkbox-analytics")||e.getCookie("cookielawinfo-checkbox-analytiques"),o=e.getCookie("cookielawinfo-checkbox-advertisement")||e.getCookie("cookielawinfo-checkbox-publicite"),a=e.getCookie("CookieLawInfoConsent");return!(!t&&!o)&&{analytics:"yes"===t,ads:"yes"===o,visitorHasChosen:!!a}},y={categories:{},pixels:[],mode:"category",visitorHasChosen:!1};e.getConsentValues=function(){return y},e.setConsentValueCategories=function(){let e=arguments.length>0&&arguments[0]!==o&&arguments[0],t=arguments.length>1&&arguments[1]!==o&&arguments[1];y.categories.analytics=e,y.categories.ads=t},e.updateConsentCookieValues=function(){let t,a=arguments.length>0&&arguments[0]!==o&&arguments[0];if(t=e.getCookie("CookieConsent"))t=decodeURI(t),y.categories.analytics=t.indexOf("statistics:true")>=0,y.categories.ads=t.indexOf("marketing:true")>=0,y.visitorHasChosen=!0;else if(t=e.getCookie("CookieScriptConsent"))t=JSON.parse(t),"reject"===t.action?(y.categories.analytics=!1,y.categories.ads=!1):2===t.categories.length?(y.categories.analytics=!0,y.categories.ads=!0):(y.categories.analytics=t.categories.indexOf("performance")>=0,y.categories.ads=t.categories.indexOf("targeting")>=0),y.visitorHasChosen=!0;else if(t=e.getCookie("borlabs-cookie")){var r,n,i,s,d,l,c,u;t=decodeURI(t),t=JSON.parse(t),y.categories.analytics=!(null===(r=t)||void 0===r||null===(n=r.consents)||void 0===n||!n.statistics),y.categories.ads=!(null===(i=t)||void 0===i||null===(s=i.consents)||void 0===s||!s.marketing),y.visitorHasChosen=!0,y.pixels=[...(null===(d=t)||void 0===d||null===(l=d.consents)||void 0===l?void 0:l.statistics)||[],...(null===(c=t)||void 0===c||null===(u=c.consents)||void 0===u?void 0:u.marketing)||[]],y.mode="pixel"}else(t=g())?(y.categories.analytics=!0===t.analytics,y.categories.ads=!0===t.ads,y.visitorHasChosen=t.visitorHasChosen):(t=e.getCookie("cookie_notice_accepted"))?(y.categories.analytics=!0,y.categories.ads=!0,y.visitorHasChosen=!0):(t=e.getCookie("hu-consent"))?(t=JSON.parse(t),y.categories.analytics=!!t.categories[3],y.categories.ads=!!t.categories[4],y.visitorHasChosen=!0):(t=m())?(y.categories.analytics=!0===t.analytics,y.categories.ads=!0===t.ads,y.visitorHasChosen=!0===t.visitorHasChosen):(t=e.getCookie("moove_gdpr_popup"))?(t=JSON.parse(t),y.categories.analytics="1"===t.thirdparty,y.categories.ads="1"===t.advanced,y.visitorHasChosen=!0):(y.categories.analytics=!a,y.categories.ads=!a)},e.updateConsentCookieValues(),e.setConsentDefaultValuesToExplicit=function(){y.categories={analytics:!1,ads:!1}},e.canIFire=function(t,o){let a;return"category"===y.mode?a=!!y.categories[t]:"pixel"===y.mode?a=y.pixels.includes(o):(console.error("Couldn't find a valid consent mode in wpmConsentValues"),a=!1),!!a||(e.logPreventedPixelLoading(o,t),!1)},e.logPreventedPixelLoading=function(e,t){var o,a,r;null!==(o=wpmDataLayer)&&void 0!==o&&null!==(a=o.shop)&&void 0!==a&&null!==(r=a.cookie_consent_mgmt)&&void 0!==r&&r.explicit_consent?console.log('WooCommerce Pixel Manager: The "'+e+" (category: "+t+')" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)'):console.log('WooCommerce Pixel Manager: The "'+e+" (category: "+t+')" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)')},e.scriptTagObserver=new MutationObserver((o=>{o.forEach((o=>{let{addedNodes:a}=o;[...a].forEach((o=>{t(o).data("wpm-cookie-category")&&(e.shouldScriptBeActive(o)?e.unblockScript(o):e.blockScript(o))}))}))})),e.scriptTagObserver.observe(document.head,{childList:!0,subtree:!0}),window.addEventListener("DOMContentLoaded",(()=>e.scriptTagObserver.disconnect())),e.shouldScriptBeActive=function(e){var o,a,r,n;return!((wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent||y.visitorHasChosen)&&("category"!==y.mode||!t(e).data("wpm-cookie-category").split(",").some((e=>y.categories[e])))&&("pixel"!==y.mode||!y.pixels.includes(t(e).data("wpm-pixel-name")))&&("pixel"!==y.mode||"google"!==t(e).data("wpm-pixel-name")||!["google-analytics","google-ads"].some((e=>y.pixels.includes(e))))&&(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.consent_mode)||void 0===n||!n.active||"google"!==t(e).data("wpm-pixel-name")))},e.unblockScript=function(e){let a=arguments.length>1&&arguments[1]!==o&&arguments[1];a&&t(e).remove();let r=t(e).data("wpm-src");r&&t(e).attr("src",r),e.type="text/javascript",a&&t(e).appendTo("head"),jQuery(document).trigger("wpmPreLoadPixels",{})},e.blockScript=function(e){let a=arguments.length>1&&arguments[1]!==o&&arguments[1];a&&t(e).remove(),t(e).attr("src")&&t(e).removeAttr("src"),e.type="blocked/javascript",a&&t(e).appendTo("head")},e.unblockAllScripts=function(){let a=!(arguments.length>0&&arguments[0]!==o)||arguments[0],r=!(arguments.length>1&&arguments[1]!==o)||arguments[1];t.each(t('script[type="blocked/javascript"]'),(function(o,n){(t(n).data("wpm-cookie-category").includes("analytics")&&a||t(n).data("wpm-cookie-category").includes("ads")&&r)&&e.unblockScript(n,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},e.unblockSelectedPixels=function(){t.each(t('script[type="blocked/javascript"]'),(function(o,a){(y.pixels.includes(t(a).data("wpm-pixel-name"))||"google"===t(a).data("wpm-pixel-name")&&["google-analytics","google-ads"].some((e=>y.pixels.includes(e))))&&e.unblockScript(a,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},window.addEventListener("borlabs-cookie-consent-saved",(function(){e.updateConsentCookieValues(),"pixel"===y.mode?(e.unblockSelectedPixels(),e.updateGoogleConsentMode(y.pixels.includes("google-analytics"),y.pixels.includes("google-ads"))):(e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads))})),window.addEventListener("CookiebotOnAccept",(function(){Cookiebot.consent.statistics&&(y.categories.analytics=!0),Cookiebot.consent.marketing&&(y.categories.ads=!0),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)}),!1),window.addEventListener("CookieScriptAccept",(function(t){t.detail.categories.includes("performance")&&(y.categories.analytics=!0),t.detail.categories.includes("targeting")&&(y.categories.ads=!0),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),window.addEventListener("CookieScriptAcceptAll",(function(){e.unblockAllScripts(!0,!0),e.updateGoogleConsentMode(!0,!0)})),document.addEventListener("cmplzStatusChange",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),document.addEventListener("setCookieNotice",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),e.huObserver=new MutationObserver((function(t){t.forEach((t=>{let{addedNodes:o}=t;[...o].forEach((t=>{"hu"===t.id&&jQuery(".hu-cookies-save").on("click",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)}))}))}))})),window.hu&&e.huObserver.observe(document.documentElement||document.body,{childList:!0,subtree:!0}),e.version=function(){console.log(wpmDataLayer.version)},e.loadScriptAndCacheIt=function(e,t){return t=jQuery.extend(t||{},{dataType:"script",cache:!0,url:e}),jQuery.ajax(t)},e.getOrderItemPrice=function(e){return(e.total+e.total_tax)/e.quantity},e.hasLoginEventFired=function(){let t=e.getWpmSessionData();return null==t?void 0:t.loginEventFired},e.setLoginEventFired=function(){let t=e.getWpmSessionData();t.loginEventFired=!0,e.setWpmSessionData(t)},e.wpmDataLayerExists=function(){return new Promise((function(e){!function t(){if("undefined"!=typeof wpmDataLayer)return e();setTimeout(t,50)}()}))},e.jQueryExists=function(){return new Promise((function(e){!function t(){if("undefined"!=typeof jQuery)return e();setTimeout(t,100)}()}))},e.pageLoaded=function(){return new Promise((function(e){!function t(){if("complete"===document.readyState)return e();setTimeout(t,50)}()}))},e.pageReady=function(){return new Promise((function(e){!function t(){if("interactive"===document.readyState||"complete"===document.readyState)return e();setTimeout(t,50)}()}))},e.isMiniCartActive=function(){if(window.sessionStorage){for(const[e,t]of Object.entries(window.sessionStorage))if(e.includes("wc_fragments"))return!0;return!1}return!1},e.doesWooCommerceCartExist=function(){return document.cookie.includes("woocommerce_items_in_cart")},e.urlHasParameter=function(e){return new URLSearchParams(window.location.search).has(e)}}(window.wpm=window.wpm||{},jQuery)},534:(e,t,o)=>{o(584)},207:()=>{wpm.wpmDataLayerExists().then((function(){console.log("WooCommerce Pixel Manager: "+(wpmDataLayer.version.pro?"Pro":"Free")+" Version "+wpmDataLayer.version.number+" loaded"),jQuery(document).trigger("wpmPreLoadPixels",{})})).then((function(){wpm.pageLoaded().then((function(){jQuery(document).trigger("wpmLoad",{})}))})),wpm.pageReady().then((function(){wpm.wpmDataLayerExists().then((function(){wpm.startIntersectionObserverToWatch(),wpm.startProductsMutationObserverToWatch()}))}))}},t={};function o(a){var r=t[a];if(void 0!==r)return r.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,o),n.exports}o(534),wpm.jQueryExists().then((function(){o(299),o(69),o(12),o(787),o(207)}))})();
|
2 |
//# sourceMappingURL=wpm-public.p1.min.js.map
|
1 |
+
(()=>{var e={164:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.pixel_id||null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.facebook)&&void 0!==n&&n.loaded||wpm.canIFire("ads","facebook-ads")&&wpm.loadFacebookPixel()})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToCart",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToCart",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmBeginCheckout",(function(e){try{var t,o,a;if(null===(t=wpmDataLayer)||void 0===t||null===(o=t.pixels)||void 0===o||null===(a=o.facebook)||void 0===a||!a.loaded)return;let e=wpm.getRandomEventId();fbq("track","InitiateCheckout",{},{eventID:e}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"InitiateCheckout",event_id:e,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToWishlist",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let e=wpm.getRandomEventId();fbq("track","AddToWishlist",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],value:parseFloat(t.quantity*t.price),currency:t.currency},{eventID:e}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"AddToWishlist",event_id:e,user_data:wpm.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;wpm.fbViewContent(t)}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;let a=wpm.getRandomEventId();fbq("track","Search",{},{eventID:a}),jQuery(document).trigger("wpmFbCapiEvent",{event_name:"Search",event_id:a,user_data:wpm.getFbUserData(),event_source_url:window.location.href})}catch(e){console.error(e)}})),jQuery(document).on("wpmLoadAlways",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;wpm.setFbUserData()}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.facebook)||void 0===o||!o.loaded)return;fbq("track","Purchase",{content_type:"product",value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,content_ids:wpm.facebookContentIds()},{eventID:wpmDataLayer.order.id})}catch(e){console.error(e)}}))},1:()=>{!function(e,t,o){let a;e.loadFacebookPixel=function(){try{wpmDataLayer.pixels.facebook.loaded=!0,e=window,t=document,o="script",e.fbq||(a=e.fbq=function(){a.callMethod?a.callMethod.apply(a,arguments):a.queue.push(arguments)},e._fbq||(e._fbq=a),a.push=a,a.loaded=!0,a.version="2.0",a.queue=[],(r=t.createElement(o)).async=!0,r.src="https://connect.facebook.net/en_US/fbevents.js",(n=t.getElementsByTagName(o)[0]).parentNode.insertBefore(r,n)),fbq("init",wpmDataLayer.pixels.facebook.pixel_id),fbq("track","PageView")}catch(o){console.error(o)}var e,t,o,a,r,n},e.getRandomEventId=function(){return(Math.random()+1).toString(36).substring(2)},e.getFbUserData=function(){return a||e.getFbUserDataFromBrowser()},e.setFbUserData=function(){a=e.getFbUserDataFromBrowser()},e.getFbUserDataFromBrowser=function(){return{fbp:e.getCookie("_fbp"),fbc:e.getCookie("_fbc"),client_user_agent:navigator.userAgent}},e.fbViewContent=function(t){try{var o,a,r;if(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.facebook)||void 0===r||!r.loaded)return;let n=e.getRandomEventId();fbq("track","ViewContent",{content_type:"product",content_name:t.name,content_ids:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],currency:wpmDataLayer.shop.currency,value:t.price},{eventID:n}),t.currency=wpmDataLayer.shop.currency,jQuery(document).trigger("wpmFbCapiEvent",{event_name:"ViewContent",event_id:n,user_data:e.getFbUserData(),product_data:t,product_id:t.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],event_source_url:window.location.href})}catch(e){console.error(e)}},e.facebookContentIds=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?e.push(String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type])):e.push(String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))}return e}}(window.wpm=window.wpm||{},jQuery)},12:(e,t,o)=>{o(1),o(164)},165:()=>{jQuery(document).on("wpmViewItemList",(function(e,t){try{var o,a,r,n,i,s,d,l,c,u,p;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;if(null!==(u=wpmDataLayer)&&void 0!==u&&null!==(p=u.general)&&void 0!==p&&p.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;if(!t)return;wpm.gtagLoaded().then((function(){gtag("event","view_item_list",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmAddToCart",(function(e,t){try{var o,a,r,n,i,s,d,l,c;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","add_to_cart",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:t.quantity*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmViewItem",(function(e,t){try{var o,a,r,n,i,s,d,l,c;if(jQuery.isEmptyObject(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.ads)||void 0===n?void 0:n.conversionIds))return;if(null===(i=wpmDataLayer)||void 0===i||null===(s=i.pixels)||void 0===s||null===(d=s.google)||void 0===d||null===(l=d.ads)||void 0===l||null===(c=l.dynamic_remarketing)||void 0===c||!c.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","view_item",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:(t.quantity?t.quantity:1)*t.price,items:[{id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],quantity:t.quantity?t.quantity:1,price:t.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical}]})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmSearch",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;let u=[];for(const[e,t]of Object.entries(wpmDataLayer.products)){var l,c;if(null!==(l=wpmDataLayer)&&void 0!==l&&null!==(c=l.general)&&void 0!==c&&c.variationsOutput&&t.isVariable&&!1===wpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids)return;u.push({id:t.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical})}wpm.gtagLoaded().then((function(){gtag("event","view_search_results",{send_to:wpm.getGoogleAdsConversionIdentifiers(),items:u})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:wpm.getGoogleAdsConversionIdentifiers(),value:wpmDataLayer.order.value_filtered,items:wpm.getGoogleAdsDynamicRemarketingOrderItems()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmLogin",(function(){try{var e,t,o,a,r,n,i,s,d;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(null===(r=wpmDataLayer)||void 0===r||null===(n=r.pixels)||void 0===n||null===(i=n.google)||void 0===i||null===(s=i.ads)||void 0===s||null===(d=s.dynamic_remarketing)||void 0===d||!d.status)return;if(!wpm.googleConfigConditionsMet("ads"))return;wpm.gtagLoaded().then((function(){gtag("event","login",{send_to:wpm.getGoogleAdsConversionIdentifiers()})}))}catch(e){console.error(e)}})),jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n;if(jQuery.isEmptyObject(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.ads)||void 0===a?void 0:a.conversionIds))return;if(!wpm.googleConfigConditionsMet("ads"))return;let i={},s={};i={send_to:wpm.getGoogleAdsConversionIdentifiersWithLabel(),transaction_id:wpmDataLayer.order.number,value:wpmDataLayer.order.value_filtered,currency:wpmDataLayer.order.currency,new_customer:wpmDataLayer.order.new_customer},null!==(r=wpmDataLayer)&&void 0!==r&&null!==(n=r.order)&&void 0!==n&&n.aw_merchant_id&&(s={discount:wpmDataLayer.order.discount,aw_merchant_id:wpmDataLayer.order.aw_merchant_id,aw_feed_country:wpmDataLayer.order.aw_feed_country,aw_feed_language:wpmDataLayer.order.aw_feed_language,items:wpm.getGoogleAdsRegularOrderItems()}),wpm.gtagLoaded().then((function(){gtag("event","conversion",{...i,...s})}))}catch(e){console.error(e)}}))},42:()=>{!function(e,t,o){let a=[];e.getGoogleAdsConversionIdentifiersWithLabel=function(){for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))a.push(e+"/"+t);return a},e.getGoogleAdsConversionIdentifiers=function(){let e=[];for(const[t,o]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))e.push(t);return e},e.getGoogleAdsRegularOrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a)):(a.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a))}return e},e.getGoogleAdsDynamicRemarketingOrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price,google_business_vertical:wpmDataLayer.pixels.google.ads.google_business_vertical},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a)):(a.id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type]),e.push(a))}return e}}(window.wpm=window.wpm||{},jQuery)},190:(e,t,o)=>{o(42),o(165)},625:()=>{jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d,l;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.analytics)||void 0===a||null===(r=a.universal)||void 0===r||!r.property_id)return;if(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.universal)&&void 0!==l&&l.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.universal.property_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGAUAOrderItems()})}))}catch(e){console.error(e)}}))},19:()=>{!function(e,t,o){e.getGAUAOrderItems=function(){let t=[];for(const[r,n]of Object.entries(wpmDataLayer.order.items)){var o,a;let r;r={quantity:n.quantity,price:n.price,name:n.name,currency:wpmDataLayer.order.currency,category:wpmDataLayer.products[n.id].category.join("/")},null!==(o=wpmDataLayer)&&void 0!==o&&null!==(a=o.general)&&void 0!==a&&a.variationsOutput&&0!==n.variation_id?(r.id=String(wpmDataLayer.products[n.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.variant=wpmDataLayer.products[n.variation_id].variant_name,r.brand=wpmDataLayer.products[n.variation_id].brand):(r.id=String(wpmDataLayer.products[n.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),r.brand=wpmDataLayer.products[n.id].brand),r=e.ga3AddListNameToProduct(r),t.push(r)}return t},e.ga3AddListNameToProduct=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:null;return e.list_name=wpmDataLayer.shop.list_name,t&&(e.list_position=t),e}}(window.wpm=window.wpm||{},jQuery)},562:(e,t,o)=>{o(19),o(625)},572:()=>{jQuery(document).on("wpmOrderReceivedPage",(function(){try{var e,t,o,a,r,n,i,s,d,l;if(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.analytics)||void 0===a||null===(r=a.ga4)||void 0===r||!r.measurement_id)return;if(null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.mp_active)return;if(!wpm.googleConfigConditionsMet("analytics"))return;wpm.gtagLoaded().then((function(){gtag("event","purchase",{send_to:[wpmDataLayer.pixels.google.analytics.ga4.measurement_id],transaction_id:wpmDataLayer.order.number,affiliation:wpmDataLayer.order.affiliation,currency:wpmDataLayer.order.currency,value:wpmDataLayer.order.value_regular,discount:wpmDataLayer.order.discount,tax:wpmDataLayer.order.tax,shipping:wpmDataLayer.order.shipping,coupon:wpmDataLayer.order.coupon,items:wpm.getGA4OrderItems()})}))}catch(e){console.error(e)}}))},228:()=>{!function(e,t,o){e.getGA4OrderItems=function(){let e=[];for(const[a,r]of Object.entries(wpmDataLayer.order.items)){var t,o;let a;a={quantity:r.quantity,price:r.price,item_name:r.name,currency:wpmDataLayer.order.currency,item_category:wpmDataLayer.products[r.id].category.join("/")},null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput&&0!==r.variation_id?(a.item_id=String(wpmDataLayer.products[r.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),a.item_variant=wpmDataLayer.products[r.variation_id].variant_name,a.item_brand=wpmDataLayer.products[r.variation_id].brand):(a.item_id=String(wpmDataLayer.products[r.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type]),a.item_brand=wpmDataLayer.products[r.id].brand),e.push(a)}return e}}(window.wpm=window.wpm||{},jQuery)},522:(e,t,o)=>{o(228),o(572)},774:(e,t,o)=>{o(562),o(522)},294:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o;void 0===(null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o?void 0:o.state)&&(wpm.canGoogleLoad()?wpm.loadGoogle():wpm.logPreventedPixelLoading("google","analytics / ads"))}))},860:()=>{!function(e,t,o){e.googleConfigConditionsMet=function(t){var o,a,r,n;return!(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.consent_mode)||void 0===n||!n.active)||("category"===e.getConsentValues().mode?!0===e.getConsentValues().categories[t]:"pixel"===e.getConsentValues().mode&&e.getConsentValues().pixels.includes("google-"+t))},e.getVisitorConsentStatusAndUpdateGoogleConsentSettings=function(t){return"category"===e.getConsentValues().mode?(e.getConsentValues().categories.analytics&&(t.analytics_storage="granted"),e.getConsentValues().categories.ads&&(t.ad_storage="granted")):"pixel"===e.getConsentValues().mode&&(t.analytics_storage=e.getConsentValues().pixels.includes("google-analytics")?"granted":"denied",t.ad_storage=e.getConsentValues().pixels.includes("google-ads")?"granted":"denied"),t},e.updateGoogleConsentMode=function(){let e=!(arguments.length>0&&arguments[0]!==o)||arguments[0],t=!(arguments.length>1&&arguments[1]!==o)||arguments[1];try{if(!window.gtag||!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent)return;gtag("consent","update",{analytics_storage:e?"granted":"denied",ad_storage:t?"granted":"denied"})}catch(e){console.error(e)}},e.fireGtagGoogleAds=function(){try{var e,t,o,a,r,n,i,s,d,l,c,u,p,g,m,y,w,v,f,_,h;if(wpmDataLayer.pixels.google.ads.state="loading",null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.ads)&&void 0!==a&&null!==(r=a.enhanced_conversions)&&void 0!==r&&r.active)for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e,{allow_enhanced_conversions:!0});else for(const[e,t]of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds))gtag("config",e);null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.ads)&&void 0!==d&&d.conversionIds&&null!==(l=wpmDataLayer)&&void 0!==l&&null!==(c=l.pixels)&&void 0!==c&&null!==(u=c.google)&&void 0!==u&&null!==(p=u.ads)&&void 0!==p&&p.phone_conversion_label&&null!==(g=wpmDataLayer)&&void 0!==g&&null!==(m=g.pixels)&&void 0!==m&&null!==(y=m.google)&&void 0!==y&&null!==(w=y.ads)&&void 0!==w&&w.phone_conversion_number&>ag("config",Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]+"/"+wpmDataLayer.pixels.google.ads.phone_conversion_label,{phone_conversion_number:wpmDataLayer.pixels.google.ads.phone_conversion_number}),"order_received_page"===wpmDataLayer.shop.page_type&&null!==(v=wpmDataLayer)&&void 0!==v&&null!==(f=v.order)&&void 0!==f&&null!==(_=f.google)&&void 0!==_&&null!==(h=_.ads)&&void 0!==h&&h.enhanced_conversion_data&&(window.enhanced_conversion_data=wpmDataLayer.order.google.ads.enhanced_conversion_data),wpmDataLayer.pixels.google.ads.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsUA=function(){try{wpmDataLayer.pixels.google.analytics.universal.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.universal.property_id,wpmDataLayer.pixels.google.analytics.universal.parameters),wpmDataLayer.pixels.google.analytics.universal.state="ready"}catch(e){console.error(e)}},e.fireGtagGoogleAnalyticsGA4=function(){try{wpmDataLayer.pixels.google.analytics.ga4.state="loading",gtag("config",wpmDataLayer.pixels.google.analytics.ga4.measurement_id,wpmDataLayer.pixels.google.analytics.ga4.parameters),wpmDataLayer.pixels.google.analytics.ga4.state="ready"}catch(e){console.error(e)}},e.isGoogleActive=function(){var e,t,o,a,r,n,i,s,d,l,c,u,p,g;return!(!(null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.analytics)&&void 0!==a&&null!==(r=a.universal)&&void 0!==r&&r.property_id||null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.measurement_id)&&jQuery.isEmptyObject(null===(c=wpmDataLayer)||void 0===c||null===(u=c.pixels)||void 0===u||null===(p=u.google)||void 0===p||null===(g=p.ads)||void 0===g?void 0:g.conversionIds))},e.getGoogleGtagId=function(){var e,t,o,a,r,n,i,s,d,l;return null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.pixels)&&void 0!==t&&null!==(o=t.google)&&void 0!==o&&null!==(a=o.analytics)&&void 0!==a&&null!==(r=a.universal)&&void 0!==r&&r.property_id?wpmDataLayer.pixels.google.analytics.universal.property_id:null!==(n=wpmDataLayer)&&void 0!==n&&null!==(i=n.pixels)&&void 0!==i&&null!==(s=i.google)&&void 0!==s&&null!==(d=s.analytics)&&void 0!==d&&null!==(l=d.ga4)&&void 0!==l&&l.measurement_id?wpmDataLayer.pixels.google.analytics.ga4.measurement_id:Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]},e.loadGoogle=function(){e.isGoogleActive()&&(wpmDataLayer.pixels.google.state="loading",e.loadScriptAndCacheIt("https://www.googletagmanager.com/gtag/js?id="+e.getGoogleGtagId()).done((function(t,o){try{var a,r,n,i,s,d,l,c,u,p,g,m,y,w,v,f,_,h,L,D,C,b;if(window.dataLayer=window.dataLayer||[],window.gtag=function(){dataLayer.push(arguments)},null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.google)&&void 0!==n&&null!==(i=n.consent_mode)&&void 0!==i&&i.active){var j,x,k,I;let t={ad_storage:wpmDataLayer.pixels.google.consent_mode.ad_storage,analytics_storage:wpmDataLayer.pixels.google.consent_mode.analytics_storage,wait_for_update:wpmDataLayer.pixels.google.consent_mode.wait_for_update};null!==(j=wpmDataLayer)&&void 0!==j&&null!==(x=j.pixels)&&void 0!==x&&null!==(k=x.google)&&void 0!==k&&null!==(I=k.consent_mode)&&void 0!==I&&I.region&&(t.region=wpmDataLayer.pixels.google.consent_mode.region),t=e.getVisitorConsentStatusAndUpdateGoogleConsentSettings(t),gtag("consent","default",t),gtag("set","ads_data_redaction",wpmDataLayer.pixels.google.consent_mode.ads_data_redaction),gtag("set","url_passthrough",wpmDataLayer.pixels.google.consent_mode.url_passthrough)}null!==(s=wpmDataLayer)&&void 0!==s&&null!==(d=s.pixels)&&void 0!==d&&null!==(l=d.google)&&void 0!==l&&null!==(c=l.linker)&&void 0!==c&&c.settings&>ag("set","linker",wpmDataLayer.pixels.google.linker.settings),gtag("js",new Date),jQuery.isEmptyObject(null===(u=wpmDataLayer)||void 0===u||null===(p=u.pixels)||void 0===p||null===(g=p.google)||void 0===g||null===(m=g.ads)||void 0===m?void 0:m.conversionIds)||(e.googleConfigConditionsMet("ads")?e.fireGtagGoogleAds():e.logPreventedPixelLoading("google-ads","ads")),null!==(y=wpmDataLayer)&&void 0!==y&&null!==(w=y.pixels)&&void 0!==w&&null!==(v=w.google)&&void 0!==v&&null!==(f=v.analytics)&&void 0!==f&&null!==(_=f.universal)&&void 0!==_&&_.property_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsUA():e.logPreventedPixelLoading("google-universal-analytics","analytics")),null!==(h=wpmDataLayer)&&void 0!==h&&null!==(L=h.pixels)&&void 0!==L&&null!==(D=L.google)&&void 0!==D&&null!==(C=D.analytics)&&void 0!==C&&null!==(b=C.ga4)&&void 0!==b&&b.measurement_id&&(e.googleConfigConditionsMet("analytics")?e.fireGtagGoogleAnalyticsGA4():e.logPreventedPixelLoading("ga4","analytics")),wpmDataLayer.pixels.google.state="ready"}catch(e){console.error(e)}})))},e.canGoogleLoad=function(){var t,o,a,r;return!(null===(t=wpmDataLayer)||void 0===t||null===(o=t.pixels)||void 0===o||null===(a=o.google)||void 0===a||null===(r=a.consent_mode)||void 0===r||!r.active)||("category"===e.getConsentValues().mode?!(!e.getConsentValues().categories.ads&&!e.getConsentValues().categories.analytics):"pixel"===e.getConsentValues().mode?e.getConsentValues().pixels.includes("google-ads")||e.getConsentValues().pixels.includes("google-analytics"):(console.error("Couldn't find a valid load condition for Google mode in wpmConsentValues"),!1))},e.gtagLoaded=function(){return new Promise((function(e,t){var o,a,r;void 0===(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r?void 0:r.state)&&t();let n=0;!function o(){var a,r,i;return"ready"===(null===(a=wpmDataLayer)||void 0===a||null===(r=a.pixels)||void 0===r||null===(i=r.google)||void 0===i?void 0:i.state)?e():n>=5e3?t():(n+=200,void setTimeout(o,200))}()}))}}(window.wpm=window.wpm||{},jQuery)},580:(e,t,o)=>{o(860),o(294)},69:(e,t,o)=>{o(580),o(190),o(774),o(463)},945:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n,i,s;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.google)||void 0===o||null===(a=o.optimize)||void 0===a||!a.container_id||null!==(r=wpmDataLayer)&&void 0!==r&&null!==(n=r.pixels)&&void 0!==n&&null!==(i=n.google)&&void 0!==i&&null!==(s=i.optimize)&&void 0!==s&&s.loaded||wpm.canIFire("analytics","google-optimize")&&wpm.load_google_optimize_pixel()}))},962:()=>{!function(e,t,o){e.load_google_optimize_pixel=function(){try{wpmDataLayer.pixels.google.optimize.loaded=!0,e.loadScriptAndCacheIt("https://www.googleoptimize.com/optimize.js?id="+wpmDataLayer.pixels.google.optimize.container_id)}catch(e){console.error(e)}}}(window.wpm=window.wpm||{},jQuery)},463:(e,t,o)=>{o(962),o(945)},300:()=>{jQuery(document).on("wpmLoadPixels",(function(){var e,t,o,a,r,n,i,s,d;null===(e=wpmDataLayer)||void 0===e||null===(t=e.pixels)||void 0===t||null===(o=t.hotjar)||void 0===o||!o.site_id||null!==(a=wpmDataLayer)&&void 0!==a&&null!==(r=a.pixels)&&void 0!==r&&null!==(n=r.hotjar)&&void 0!==n&&n.loaded||!wpm.canIFire("analytics","hotjar")||null!==(i=wpmDataLayer)&&void 0!==i&&null!==(s=i.pixels)&&void 0!==s&&null!==(d=s.hotjar)&&void 0!==d&&d.loaded||wpm.load_hotjar_pixel()}))},376:()=>{!function(e,t,o){e.load_hotjar_pixel=function(){try{wpmDataLayer.pixels.hotjar.loaded=!0,e=window,t=document,e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6},o=t.getElementsByTagName("head")[0],(a=t.createElement("script")).async=1,a.src="https://static.hotjar.com/c/hotjar-"+e._hjSettings.hjid+".js?sv="+e._hjSettings.hjsv,o.appendChild(a)}catch(e){console.error(e)}var e,t,o,a}}(window.wpm=window.wpm||{},jQuery)},787:(e,t,o)=>{o(376),o(300)},299:()=>{jQuery(document).on("click",".remove_from_cart_button, .remove",(function(){try{let e=new URL(jQuery(this).attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e);wpm.removeProductFromCart(t)}catch(e){console.error(e)}})),jQuery(document).on("click",".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button",(function(){try{if("product"===wpmDataLayer.shop.page_type){if(void 0!==jQuery(this).attr("href")&&jQuery(this).attr("href").includes("add-to-cart")){let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}else if("simple"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).val();wpm.addProductToCart(t,e)}else if("variable"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("[name='variation_id']").val();wpm.addProductToCart(t,e)}else if("grouped"===wpmDataLayer.shop.product_type)jQuery(".woocommerce-grouped-product-list-item").each((function(){let e=Number(jQuery(this).find(".input-text.qty").val());e||0===e||(e=1);let t=jQuery(this).attr("class"),o=wpm.getPostIdFromString(t);wpm.addProductToCart(o,e)}));else if("bundle"===wpmDataLayer.shop.product_type){let e=Number(jQuery(".input-text.qty").val());e||0===e||(e=1);let t=jQuery("input[name=add-to-cart]").val();wpm.addProductToCart(t,e)}}else{let e=1,t=jQuery(this).data("product_id");wpm.addProductToCart(t,e)}}catch(e){console.error(e)}})),jQuery(document).one("click","a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)",(function(e){try{if(jQuery(e.target).closest("a").attr("href")){let t=jQuery(e.target).closest("a").attr("href");if(t.includes("add-to-cart=")){let e=t.match(/(add-to-cart=)(\d+)/);e&&wpm.addProductToCart(e[2],1)}}}catch(e){console.error(e)}})),jQuery(document).on("click",".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product",(function(){try{let e=jQuery(this).nextAll(".wpmProductId:first").data("id");if(e){if(e=wpm.getIdBasedOndVariationsOutputSetting(e),!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmSelectContentGaUa",t),jQuery(document).trigger("wpmSelectItem",t)}}}catch(e){console.error(e)}})),jQuery(document).one("click",".checkout-button, .cart-checkout-button, .button.checkout",(function(){jQuery(document).trigger("wpmBeginCheckout")})),jQuery(document).on("input","#billing_email",(function(){wpm.isEmail(jQuery(this).val())&&(wpm.fireCheckoutProgress(2),wpm.emailSelected=!0)})),jQuery(document).on("click",".wc_payment_methods",(function(){!1===wpm.paymentMethodSelected&&wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val()),wpm.paymentMethodSelected=!0})),jQuery(document).one("click","#place_order",(function(){!1===wpm.emailSelected&&wpm.fireCheckoutProgress(2),!1===wpm.paymentMethodSelected&&(wpm.fireCheckoutProgress(3),wpm.fireCheckoutOption(3,jQuery("input[name='payment_method']:checked").val())),wpm.fireCheckoutProgress(4)})),jQuery(document).on("click","[name='update_cart']",(function(){try{jQuery(".cart_item").each((function(){let e=new URL(jQuery(this).find(".product-remove").find("a").attr("href")),t=wpm.getProductIdByCartItemKeyUrl(e),o=jQuery(this).find(".qty").val();0===o?wpm.removeProductFromCart(t):o<wpmDataLayer.cart[t].quantity?wpm.removeProductFromCart(t,wpmDataLayer.cart[t].quantity-o):o>wpmDataLayer.cart[t].quantity&&wpm.addProductToCart(t,o-wpmDataLayer.cart[t].quantity)}))}catch(e){console.error(e),wpm.getCartItemsFromBackend()}})),jQuery(document).on("click",".add_to_wishlist, .wl-add-to",(function(){try{let e;if(jQuery(this).data("productid")?e=jQuery(this).data("productid"):jQuery(this).data("product-id")&&(e=jQuery(this).data("product-id")),!e)throw Error("Wasn't able to retrieve a productId");let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmAddToWishlist",t)}catch(e){console.error(e)}})),jQuery(document).on("updated_cart_totals",(function(){jQuery(document).trigger("wpmViewCart")})),jQuery((function(){jQuery(".single_variation_wrap").on("show_variation",(function(e,t){try{let e=wpm.getIdBasedOndVariationsOutputSetting(t.variation_id);if(!e)throw Error("Wasn't able to retrieve a productId");if(wpmDataLayer.products&&wpmDataLayer.products[e]){let t=wpm.getProductDetailsFormattedForEvent(e);jQuery(document).trigger("wpmViewItem",t)}}catch(e){console.error(e)}}))})),jQuery((function(){jQuery(".single_variation_wrap").on("hide_variation",(function(){try{var e,t;let o=jQuery("body").attr("class").match(/(postid-)(\d+)/)[2];if(!o)throw Error("Wasn't able to retrieve a productId");if("variable"===wpmDataLayer.shop.product_type&&null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.general)&&void 0!==t&&t.variationsOutput)for(const[e,t]of Object.entries(wpmDataLayer.products))if("parentId"in t){o=t.id;break}if(wpmDataLayer.products&&wpmDataLayer.products[o]){let e=wpm.getProductDetailsFormattedForEvent(o);jQuery(document).trigger("wpmViewItem",e)}}catch(e){console.error(e)}}))})),jQuery(window).on("wpmLoad",(function(){try{wpm.doesWooCommerceCartExist()&&wpm.getCartItems()}catch(e){console.error(e)}})),jQuery(window).on("wpmLoad",(function(){wpmDataLayer.products=wpmDataLayer.products||{};let e=wpm.getAddToCartLinkProductIds();wpm.getProductsFromBackend(e)})),jQuery(window).on("wpmLoad",(function(){if(!wpm.getCookie("wpmReferrer"))if(document.referrer){let e=new URL(document.referrer).hostname;e!==window.location.host?wpm.setCookie("wpmReferrer",e):wpm.setCookie("wpmReferrer","")}else wpm.setCookie("wpmReferrer","")})),jQuery(window).on("wpmLoad",(function(){try{var e;if("undefined"!=typeof wpmDataLayer&&(null===(e=wpmDataLayer)||void 0===e||!e.wpmLoadFired)){var t,o;if(jQuery(document).trigger("wpmLoadAlways"),"product"===wpmDataLayer.shop.page_type&&"variable"!==wpmDataLayer.shop.product_type&&wpm.getMainProductIdFromProductPage()){let e=wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage());jQuery(document).trigger("wpmViewItem",e)}else"product_category"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmCategory"):"search"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmSearch"):"cart"===wpmDataLayer.shop.page_type?jQuery(document).trigger("wpmViewCart"):"order_received_page"===wpmDataLayer.shop.page_type&&wpmDataLayer.order?wpm.isOrderIdStored(wpmDataLayer.order.id)||(jQuery(document).trigger("wpmOrderReceivedPage"),wpm.writeOrderIdToStorage(wpmDataLayer.order.id)):jQuery(document).trigger("wpmEverywhereElse");null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.user)&&void 0!==o&&o.id&&!wpm.hasLoginEventFired()&&(jQuery(document).trigger("wpmLogin"),wpm.setLoginEventFired()),wpmDataLayer.wpmLoadFired=!0}}catch(e){console.error(e)}})),jQuery(window).on("wpmPreLoadPixels",(function(){var e,t,o;null!==(e=wpmDataLayer)&&void 0!==e&&null!==(t=e.shop)&&void 0!==t&&null!==(o=t.cookie_consent_mgmt)&&void 0!==o&&o.explicit_consent&&wpm.updateConsentCookieValues(!0),jQuery(document).trigger("wpmLoadPixels",{})}))},584:()=>{!function(e,t,o){const a="_wpm_order_ids",r="_wpm_endpoint_available",n="/wp-json/";function i(){return""!==e.getCookie(a)}e.emailSelected=!1,e.paymentMethodSelected=!1,e.useRestEndpoint=function(){return e.isSessionStorageAvailable()&&e.isRestEndpointAvailable()&&e.isBelowRestErrorThreshold()},e.isBelowRestErrorThreshold=function(){return window.sessionStorage.getItem(0)<=10},e.isRestEndpointAvailable=function(){if(window.sessionStorage.getItem(r))return JSON.parse(window.sessionStorage.getItem(r));e.testEndpoint()},e.isSessionStorageAvailable=function(){return!!window.sessionStorage},e.testEndpoint=function(){let e=arguments.length>0&&arguments[0]!==o?arguments[0]:location.protocol+"//"+location.host+n,t=arguments.length>1&&arguments[1]!==o?arguments[1]:r;jQuery.ajax(e,{type:"HEAD",timeout:1e3,statusCode:{200:function(e){window.sessionStorage.setItem(t,JSON.stringify(!0))},404:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))},0:function(e){window.sessionStorage.setItem(t,JSON.stringify(!1))}}}).then((e=>{}))},e.isWpmRestEndpointAvailable=function(){let t=arguments.length>0&&arguments[0]!==o?arguments[0]:r;return!!e.getCookie(t)},e.writeOrderIdToStorage=function(t){if(window.Storage)if(null===localStorage.getItem(a)){let e=[];e.push(t),window.localStorage.setItem(a,JSON.stringify(e))}else{let e=JSON.parse(localStorage.getItem(a));e.includes(t)||(e.push(t),window.localStorage.setItem(a,JSON.stringify(e)))}else{let o=new Date;o.setDate(o.getDate()+365);let r=[];i()&&(r=JSON.parse(e.getCookie(a))),r.includes(t)||(r.push(t),document.cookie="_wpm_order_ids="+JSON.stringify(r)+";expires="+o.toUTCString())}"function"==typeof e.storeOrderIdOnServer&&wpmDataLayer.orderDeduplication&&e.storeOrderIdOnServer(t)},e.isOrderIdStored=function(t){return wpmDataLayer.orderDeduplication?window.Storage?null!==localStorage.getItem(a)&&JSON.parse(localStorage.getItem(a)).includes(t):!!i()&&JSON.parse(e.getCookie(a)).includes(t):(console.log("order duplication prevention: off"),!1)},e.isEmail=function(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)},e.removeProductFromCart=function(t){let a=arguments.length>1&&arguments[1]!==o?arguments[1]:null;try{if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=e.getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");let o;if(o=null==a?wpmDataLayer.cart[t].quantity:a,wpmDataLayer.cart[t]){let r=e.getProductDetailsFormattedForEvent(t,o);jQuery(document).trigger("wpmRemoveFromCart",r),null==a||wpmDataLayer.cart[t].quantity===a?(delete wpmDataLayer.cart[t],sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))):(wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity-o,sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart)))}}catch(e){console.error(e)}},e.getIdBasedOndVariationsOutputSetting=function(e){try{var t,o;return null!==(t=wpmDataLayer)&&void 0!==t&&null!==(o=t.general)&&void 0!==o&&o.variationsOutput?e:wpmDataLayer.products[e].isVariation?wpmDataLayer.products[e].parentId:e}catch(e){console.error(e)}},e.addProductToCart=function(t,o){try{var a;if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=e.getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");if(null!==(a=wpmDataLayer)&&void 0!==a&&a.products[t]){var r;let a=e.getProductDetailsFormattedForEvent(t,o);jQuery(document).trigger("wpmAddToCart",a),null!==(r=wpmDataLayer)&&void 0!==r&&r.cart[t]?wpmDataLayer.cart[t].quantity=wpmDataLayer.cart[t].quantity+o:("cart"in wpmDataLayer||(wpmDataLayer.cart={}),wpmDataLayer.cart[t]=e.getProductDetailsFormattedForEvent(t,o)),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(wpmDataLayer.cart))}}catch(t){console.error(t),e.getCartItemsFromBackend()}},e.getCartItems=function(){sessionStorage?sessionStorage.getItem("wpmDataLayerCart")&&"order_received_page"!==wpmDataLayer.shop.page_type?e.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem("wpmDataLayerCart"))):sessionStorage.setItem("wpmDataLayerCart",JSON.stringify({})):e.getCartItemsFromBackend()},e.getCartItemsFromBackend=function(){try{let t={action:"wpm_get_cart_items"};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:t,success:function(t){t.cart||(t.cart={}),e.saveCartObjectToDataLayer(t.cart),sessionStorage&&sessionStorage.setItem("wpmDataLayerCart",JSON.stringify(t.cart))}})}catch(e){console.error(e)}},e.getProductsFromBackend=function(t){if((t=t.filter((e=>!wpmDataLayer.products.hasOwnProperty(e))))&&0!==t.length)try{let o={action:"wpm_get_product_ids",productIds:t};jQuery.ajax({type:"get",dataType:"json",url:e.ajax_url,data:o,success:function(e){wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.saveCartObjectToDataLayer=function(e){wpmDataLayer.cart=e,wpmDataLayer.products=Object.assign({},wpmDataLayer.products,e)},e.fireCheckoutOption=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:null,a=arguments.length>2&&arguments[2]!==o?arguments[2]:null,r={step:e,checkout_option:t,value:a};jQuery(document).trigger("wpmFireCheckoutOption",r)},e.fireCheckoutProgress=function(e){let t={step:e};jQuery(document).trigger("wpmFireCheckoutProgress",t)},e.getPostIdFromString=function(e){try{return e.match(/(post-)(\d+)/)[2]}catch(e){console.error(e)}},e.triggerViewItemList=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");if(!(t=e.getIdBasedOndVariationsOutputSetting(t)))throw Error("Wasn't able to retrieve a productId");jQuery(document).trigger("wpmViewItemList",e.getProductDataForViewItemEvent(t))},e.getProductDataForViewItemEvent=function(t){if(!t)throw Error("Wasn't able to retrieve a productId");try{if(wpmDataLayer.products[t])return e.getProductDetailsFormattedForEvent(t)}catch(e){console.error(e)}},e.getMainProductIdFromProductPage=function(){try{return["simple","variable","grouped","composite","bundle"].indexOf(wpmDataLayer.shop.product_type)>=0&&jQuery(".wpmProductId:first").data("id")}catch(e){console.error(e)}},e.viewItemListTriggerTestMode=function(e){jQuery(e).css({position:"relative"}),jQuery(e).append('<div id="viewItemListTriggerOverlay"></div>'),jQuery(e).find("#viewItemListTriggerOverlay").css({"z-index":"10",display:"block",position:"absolute",height:"100%",top:"0",left:"0",right:"0",opacity:wpmDataLayer.viewItemListTrigger.opacity,"background-color":wpmDataLayer.viewItemListTrigger.backgroundColor})},e.getSearchTermFromUrl=function(){try{return new URLSearchParams(window.location.search).get("s")}catch(e){console.error(e)}};let s,d={};e.observerCallback=function(t,o){t.forEach((t=>{try{let a,r=jQuery(t.target).data("ioid");if(a=jQuery(t.target).next(".wpmProductId").length?jQuery(t.target).next(".wpmProductId").data("id"):jQuery(t.target).find(".wpmProductId").data("id"),!a)throw Error("wpmProductId element not found");t.isIntersecting?d[r]=setTimeout((()=>{e.triggerViewItemList(a),wpmDataLayer.viewItemListTrigger.testMode&&e.viewItemListTriggerTestMode(t.target),!1===wpmDataLayer.viewItemListTrigger.repeat&&o.unobserve(t.target)}),wpmDataLayer.viewItemListTrigger.timeout):(clearTimeout(d[r]),wpmDataLayer.viewItemListTrigger.testMode&&jQuery(t.target).find("#viewItemListTriggerOverlay").remove())}catch(e){console.error(e)}}))};let l,c=0;e.startIntersectionObserverToWatch=function(){try{e.urlHasParameter("vildemomode")&&(wpmDataLayer.viewItemListTrigger.testMode=!0),s=new IntersectionObserver(e.observerCallback,{threshold:wpmDataLayer.viewItemListTrigger.threshold}),l=jQuery(".wpmProductId").map((function(e,t){return jQuery(t).parent().hasClass("type-product")||jQuery(t).parent().hasClass("product")||jQuery(t).parent().hasClass("product-item-inner")?jQuery(t).parent():jQuery(t).prev().hasClass("wc-block-grid__product")||jQuery(t).prev().hasClass("product")||jQuery(t).prev().hasClass("product-small")||jQuery(t).prev().hasClass("woocommerce-LoopProduct-link")?jQuery(this).prev():jQuery(t).closest(".product").length?jQuery(t).closest(".product"):void 0})),l.each((function(e,t){jQuery(t[0]).data("ioid",c++),s.observe(t[0])}))}catch(e){console.error(e)}},e.startProductsMutationObserverToWatch=function(){try{let e=jQuery(".wpmProductId:eq(0)").parents().has(jQuery(".wpmProductId:eq(1)").parents()).first();e.length&&u.observe(e[0],{attributes:!0,childList:!0,characterData:!0})}catch(e){console.error(e)}};let u=new MutationObserver((function(e){e.forEach((function(e){let t=e.addedNodes;null!==t&&jQuery(t).each((function(){(jQuery(this).hasClass("type-product")||jQuery(this).hasClass("product-small")||jQuery(this).hasClass("wc-block-grid__product"))&&p(this)&&(jQuery(this).data("ioid",c++),s.observe(this))}))}))})),p=function(e){return!(!jQuery(e).find(".wpmProductId").length&&!jQuery(e).siblings(".wpmProductId").length)};e.setCookie=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:"",a=arguments.length>2&&arguments[2]!==o?arguments[2]:null;if(a){let o=new Date;o.setTime(o.getTime()+24*a*60*60*1e3);let r="expires="+o.toUTCString();document.cookie=e+"="+t+";"+r+";path=/"}else document.cookie=e+"="+t+";path=/"},e.getCookie=function(e){let t=e+"=",o=decodeURIComponent(document.cookie).split(";");for(let e=0;e<o.length;e++){let a=o[e];for(;" "==a.charAt(0);)a=a.substring(1);if(0==a.indexOf(t))return a.substring(t.length,a.length)}return""},e.getWpmSessionData=function(){if(window.sessionStorage){let e=window.sessionStorage.getItem("_wpm");return null!==e?JSON.parse(e):{}}return{}},e.setWpmSessionData=function(e){window.sessionStorage&&window.sessionStorage.setItem("_wpm",JSON.stringify(e))},e.storeOrderIdOnServer=function(t){try{let o={action:"wpm_purchase_pixels_fired",order_id:t,nonce:e.nonce};jQuery.ajax({type:"post",dataType:"json",url:e.ajax_url,data:o,success:function(e){!1===e.success&&console.log(e)},error:function(e){console.log(e)}})}catch(e){console.error(e)}},e.getProductIdByCartItemKeyUrl=function(e){let t,o=new URLSearchParams(e.search).get("remove_item");return t=0===wpmDataLayer.cartItemKeys[o].variation_id?wpmDataLayer.cartItemKeys[o].product_id:wpmDataLayer.cartItemKeys[o].variation_id,t},e.getAddToCartLinkProductIds=function(){return jQuery("a").map((function(){let e=jQuery(this).attr("href");if(e&&e.includes("?add-to-cart=")){let t=e.match(/(add-to-cart=)(\d+)/);if(t)return t[2]}})).get()},e.getProductDetailsFormattedForEvent=function(e){let t=arguments.length>1&&arguments[1]!==o?arguments[1]:1,a={id:e.toString(),dyn_r_ids:wpmDataLayer.products[e].dyn_r_ids,name:wpmDataLayer.products[e].name,list_name:wpmDataLayer.shop.list_name,brand:wpmDataLayer.products[e].brand,category:wpmDataLayer.products[e].category,variant:wpmDataLayer.products[e].variant,list_position:wpmDataLayer.products[e].position,quantity:t,price:wpmDataLayer.products[e].price,currency:wpmDataLayer.shop.currency,isVariable:wpmDataLayer.products[e].isVariable,isVariation:wpmDataLayer.products[e].isVariation,parentId:wpmDataLayer.products[e].parentId};return a.isVariation&&(a.parentId_dyn_r_ids=wpmDataLayer.products[e].parentId_dyn_r_ids),a},e.setReferrerToCookie=function(){e.getCookie("wpmReferrer")||e.setCookie("wpmReferrer",document.referrer)},e.getReferrerFromCookie=function(){return e.getCookie("wpmReferrer")?e.getCookie("wpmReferrer"):null},e.getClidFromBrowser=function(){let t,a=arguments.length>0&&arguments[0]!==o?arguments[0]:"gclid";return t={gclid:"_gcl_aw",dclid:"_gcl_dc"},e.getCookie(t[a])?e.getCookie(t[a]).match(/(GCL.[\d]*.)(.*)/)[2]:""},e.getUserAgent=function(){return navigator.userAgent},e.getViewPort=function(){return{width:Math.max(document.documentElement.clientWidth||0,window.innerWidth||0),height:Math.max(document.documentElement.clientHeight||0,window.innerHeight||0)}};let g=function(){let t=e.getCookie("cmplz_statistics"),o=e.getCookie("cmplz_marketing");return!(!e.getCookie("cmplz_consent_status")&&!e.getCookie("cmplz_banner-status"))&&{analytics:"allow"===t,ads:"allow"===o,visitorHasChosen:!0}},m=function(){let t=e.getCookie("cookielawinfo-checkbox-analytics")||e.getCookie("cookielawinfo-checkbox-analytiques"),o=e.getCookie("cookielawinfo-checkbox-advertisement")||e.getCookie("cookielawinfo-checkbox-publicite"),a=e.getCookie("CookieLawInfoConsent");return!(!t&&!o)&&{analytics:"yes"===t,ads:"yes"===o,visitorHasChosen:!!a}},y={categories:{},pixels:[],mode:"category",visitorHasChosen:!1};e.getConsentValues=function(){return y},e.setConsentValueCategories=function(){let e=arguments.length>0&&arguments[0]!==o&&arguments[0],t=arguments.length>1&&arguments[1]!==o&&arguments[1];y.categories.analytics=e,y.categories.ads=t},e.updateConsentCookieValues=function(){let t,a=arguments.length>0&&arguments[0]!==o&&arguments[0];if(t=e.getCookie("CookieConsent"))t=decodeURI(t),y.categories.analytics=t.indexOf("statistics:true")>=0,y.categories.ads=t.indexOf("marketing:true")>=0,y.visitorHasChosen=!0;else if(t=e.getCookie("CookieScriptConsent"))t=JSON.parse(t),"reject"===t.action?(y.categories.analytics=!1,y.categories.ads=!1):2===t.categories.length?(y.categories.analytics=!0,y.categories.ads=!0):(y.categories.analytics=t.categories.indexOf("performance")>=0,y.categories.ads=t.categories.indexOf("targeting")>=0),y.visitorHasChosen=!0;else if(t=e.getCookie("borlabs-cookie")){var r,n,i,s,d,l,c,u;t=decodeURI(t),t=JSON.parse(t),y.categories.analytics=!(null===(r=t)||void 0===r||null===(n=r.consents)||void 0===n||!n.statistics),y.categories.ads=!(null===(i=t)||void 0===i||null===(s=i.consents)||void 0===s||!s.marketing),y.visitorHasChosen=!0,y.pixels=[...(null===(d=t)||void 0===d||null===(l=d.consents)||void 0===l?void 0:l.statistics)||[],...(null===(c=t)||void 0===c||null===(u=c.consents)||void 0===u?void 0:u.marketing)||[]],y.mode="pixel"}else(t=g())?(y.categories.analytics=!0===t.analytics,y.categories.ads=!0===t.ads,y.visitorHasChosen=t.visitorHasChosen):(t=e.getCookie("cookie_notice_accepted"))?(y.categories.analytics=!0,y.categories.ads=!0,y.visitorHasChosen=!0):(t=e.getCookie("hu-consent"))?(t=JSON.parse(t),y.categories.analytics=!!t.categories[3],y.categories.ads=!!t.categories[4],y.visitorHasChosen=!0):(t=m())?(y.categories.analytics=!0===t.analytics,y.categories.ads=!0===t.ads,y.visitorHasChosen=!0===t.visitorHasChosen):(t=e.getCookie("moove_gdpr_popup"))?(t=JSON.parse(t),y.categories.analytics="1"===t.thirdparty,y.categories.ads="1"===t.advanced,y.visitorHasChosen=!0):(y.categories.analytics=!a,y.categories.ads=!a)},e.updateConsentCookieValues(),e.setConsentDefaultValuesToExplicit=function(){y.categories={analytics:!1,ads:!1}},e.canIFire=function(t,o){let a;return"category"===y.mode?a=!!y.categories[t]:"pixel"===y.mode?a=y.pixels.includes(o):(console.error("Couldn't find a valid consent mode in wpmConsentValues"),a=!1),!!a||(e.logPreventedPixelLoading(o,t),!1)},e.logPreventedPixelLoading=function(e,t){var o,a,r;null!==(o=wpmDataLayer)&&void 0!==o&&null!==(a=o.shop)&&void 0!==a&&null!==(r=a.cookie_consent_mgmt)&&void 0!==r&&r.explicit_consent?console.log('WooCommerce Pixel Manager: The "'+e+" (category: "+t+')" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)'):console.log('WooCommerce Pixel Manager: The "'+e+" (category: "+t+')" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)')},e.scriptTagObserver=new MutationObserver((o=>{o.forEach((o=>{let{addedNodes:a}=o;[...a].forEach((o=>{t(o).data("wpm-cookie-category")&&(e.shouldScriptBeActive(o)?e.unblockScript(o):e.blockScript(o))}))}))})),e.scriptTagObserver.observe(document.head,{childList:!0,subtree:!0}),window.addEventListener("DOMContentLoaded",(()=>e.scriptTagObserver.disconnect())),e.shouldScriptBeActive=function(e){var o,a,r,n;return!((wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent||y.visitorHasChosen)&&("category"!==y.mode||!t(e).data("wpm-cookie-category").split(",").some((e=>y.categories[e])))&&("pixel"!==y.mode||!y.pixels.includes(t(e).data("wpm-pixel-name")))&&("pixel"!==y.mode||"google"!==t(e).data("wpm-pixel-name")||!["google-analytics","google-ads"].some((e=>y.pixels.includes(e))))&&(null===(o=wpmDataLayer)||void 0===o||null===(a=o.pixels)||void 0===a||null===(r=a.google)||void 0===r||null===(n=r.consent_mode)||void 0===n||!n.active||"google"!==t(e).data("wpm-pixel-name")))},e.unblockScript=function(e){let a=arguments.length>1&&arguments[1]!==o&&arguments[1];a&&t(e).remove();let r=t(e).data("wpm-src");r&&t(e).attr("src",r),e.type="text/javascript",a&&t(e).appendTo("head"),jQuery(document).trigger("wpmPreLoadPixels",{})},e.blockScript=function(e){let a=arguments.length>1&&arguments[1]!==o&&arguments[1];a&&t(e).remove(),t(e).attr("src")&&t(e).removeAttr("src"),e.type="blocked/javascript",a&&t(e).appendTo("head")},e.unblockAllScripts=function(){let a=!(arguments.length>0&&arguments[0]!==o)||arguments[0],r=!(arguments.length>1&&arguments[1]!==o)||arguments[1];t.each(t('script[type="blocked/javascript"]'),(function(o,n){(t(n).data("wpm-cookie-category").includes("analytics")&&a||t(n).data("wpm-cookie-category").includes("ads")&&r)&&e.unblockScript(n,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},e.unblockSelectedPixels=function(){t.each(t('script[type="blocked/javascript"]'),(function(o,a){(y.pixels.includes(t(a).data("wpm-pixel-name"))||"google"===t(a).data("wpm-pixel-name")&&["google-analytics","google-ads"].some((e=>y.pixels.includes(e))))&&e.unblockScript(a,!0)})),jQuery(document).trigger("wpmPreLoadPixels",{})},window.addEventListener("borlabs-cookie-consent-saved",(function(){e.updateConsentCookieValues(),"pixel"===y.mode?(e.unblockSelectedPixels(),e.updateGoogleConsentMode(y.pixels.includes("google-analytics"),y.pixels.includes("google-ads"))):(e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads))})),window.addEventListener("CookiebotOnAccept",(function(){Cookiebot.consent.statistics&&(y.categories.analytics=!0),Cookiebot.consent.marketing&&(y.categories.ads=!0),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)}),!1),window.addEventListener("CookieScriptAccept",(function(t){t.detail.categories.includes("performance")&&(y.categories.analytics=!0),t.detail.categories.includes("targeting")&&(y.categories.ads=!0),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),window.addEventListener("CookieScriptAcceptAll",(function(){e.unblockAllScripts(!0,!0),e.updateGoogleConsentMode(!0,!0)})),document.addEventListener("cmplzStatusChange",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),document.addEventListener("setCookieNotice",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)})),e.huObserver=new MutationObserver((function(t){t.forEach((t=>{let{addedNodes:o}=t;[...o].forEach((t=>{"hu"===t.id&&jQuery(".hu-cookies-save").on("click",(function(){e.updateConsentCookieValues(),e.unblockAllScripts(y.categories.analytics,y.categories.ads),e.updateGoogleConsentMode(y.categories.analytics,y.categories.ads)}))}))}))})),window.hu&&e.huObserver.observe(document.documentElement||document.body,{childList:!0,subtree:!0}),e.version=function(){console.log(wpmDataLayer.version)},e.loadScriptAndCacheIt=function(e,t){return t=jQuery.extend(t||{},{dataType:"script",cache:!0,url:e}),jQuery.ajax(t)},e.getOrderItemPrice=function(e){return(e.total+e.total_tax)/e.quantity},e.hasLoginEventFired=function(){let t=e.getWpmSessionData();return null==t?void 0:t.loginEventFired},e.setLoginEventFired=function(){let t=e.getWpmSessionData();t.loginEventFired=!0,e.setWpmSessionData(t)},e.wpmDataLayerExists=function(){return new Promise((function(e){!function t(){if("undefined"!=typeof wpmDataLayer)return e();setTimeout(t,50)}()}))},e.jQueryExists=function(){return new Promise((function(e){!function t(){if("undefined"!=typeof jQuery)return e();setTimeout(t,100)}()}))},e.pageLoaded=function(){return new Promise((function(e){!function t(){if("complete"===document.readyState)return e();setTimeout(t,50)}()}))},e.pageReady=function(){return new Promise((function(e){!function t(){if("interactive"===document.readyState||"complete"===document.readyState)return e();setTimeout(t,50)}()}))},e.isMiniCartActive=function(){if(window.sessionStorage){for(const[e,t]of Object.entries(window.sessionStorage))if(e.includes("wc_fragments"))return!0;return!1}return!1},e.doesWooCommerceCartExist=function(){return document.cookie.includes("woocommerce_items_in_cart")},e.urlHasParameter=function(e){return new URLSearchParams(window.location.search).has(e)}}(window.wpm=window.wpm||{},jQuery)},534:(e,t,o)=>{o(584)},207:()=>{wpm.wpmDataLayerExists().then((function(){console.log("WooCommerce Pixel Manager: "+(wpmDataLayer.version.pro?"Pro":"Free")+" Version "+wpmDataLayer.version.number+" loaded"),jQuery(document).trigger("wpmPreLoadPixels",{})})).then((function(){wpm.pageLoaded().then((function(){jQuery(document).trigger("wpmLoad",{})}))})),wpm.pageReady().then((function(){wpm.wpmDataLayerExists().then((function(){wpm.startIntersectionObserverToWatch(),wpm.startProductsMutationObserverToWatch()}))}))}},t={};function o(a){var r=t[a];if(void 0!==r)return r.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,o),n.exports}o(534),wpm.jQueryExists().then((function(){o(299),o(69),o(12),o(787),o(207)}))})();
|
2 |
//# sourceMappingURL=wpm-public.p1.min.js.map
|
js/public/wpm-public.p1.min.js.map
CHANGED
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"file":"wpm-public.p1.min.js","mappings":"sBAKAA,OAAOC,UAAUC,GAAG,iBAAiB,WAAY,gBAEhC,QAAZ,EAAAC,oBAAA,mBAAcC,cAAd,mBAAsBC,gBAAtB,UAAgCC,UAAY,UAACH,oBAAD,iBAAC,EAAcC,cAAf,iBAAC,EAAsBC,gBAAvB,OAAC,EAAgCE,QAC5EC,IAAIC,SAAS,MAAO,iBAAiBD,IAAIE,uBAK/CV,OAAOC,UAAUC,GAAG,gBAAgB,SAAUS,EAAOC,GAEpD,IAAI,UACH,GAAI,UAACT,oBAAD,iBAAC,EAAcC,cAAf,iBAAC,EAAsBC,gBAAvB,QAAC,EAAgCE,OAAQ,OAE7C,IAAIM,EAAUL,IAAIM,mBAIlBC,IAAI,QAAS,YAAa,CACzBC,aAAc,UACdC,aAAcL,EAAQM,KACtBC,YAAcP,EAAQQ,UAAUjB,aAAaC,OAAOC,SAASgB,oBAAoBC,SACjFC,MAAcC,WAAWZ,EAAQa,SAAWb,EAAQc,OACpDC,SAAcf,EAAQe,UACpB,CACFC,QAASf,IAIVD,EAAO,SAAeT,aAAa0B,KAAKF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AIqc,qBACFtW,MAAK,WAEL/F,IAAImV,mCAGJnV,IAAI8V,+CC1CHiH,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBta,IAAjBua,EACH,OAAOA,EAAaC,QAGrB,IAAIC,EAASL,EAAyBE,GAAY,CAGjDE,QAAS,IAOV,OAHAE,EAAoBJ,GAAUG,EAAQA,EAAOD,QAASH,GAG/CI,EAAOD,QCjBf9X,EAAQ,KAGRrF,IAAIuc,eAAexW,MAAK,WAEvBV,EAAQ,KAERA,EAAQ,IACRA,EAAQ,IACRA,EAAQ,KAuBRA,EAAQ,S","sources":["webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/ads/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/ads/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/ads/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga3/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga3/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga3/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga4/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga4/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga4/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/base/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/base/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/base/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/optimize/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/optimize/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/optimize/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/hotjar/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/hotjar/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/hotjar/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/functions_loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/init.js","webpack://WooCommerce-Pixel-Manager/webpack/bootstrap","webpack://WooCommerce-Pixel-Manager/./src/js/public/main.js"],"sourcesContent":["/**\n * All event listeners\n * */\n\n// Load pixel event\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.facebook?.pixel_id && !wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tif (wpm.canIFire(\"ads\", \"facebook-ads\")) wpm.loadFacebookPixel()\n\t}\n})\n\n// AddToCart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t// console.log('eventId: ' + eventId);\n\n\t\tfbq(\"track\", \"AddToCart\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToCart\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// InitiateCheckout event\njQuery(document).on(\"wpmBeginCheckout\", function (event) {\n\n\ttry {\n\t\t// console.log('firing facebook ads InitiateCheckout event');\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"InitiateCheckout\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"InitiateCheckout\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// AddToWishlist event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\t\t// console.log('firing facebook ads AddToWishlist event');\n\t\t// console.log(product);\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"AddToWishlist\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToWishlist\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// ViewContent event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\t// console.log('firing facebook ads ViewContent event');\n\t\t// console.log(product);\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.fbViewContent(product)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"Search\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"Search\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// load always event\njQuery(document).on(\"wpmLoadAlways\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.setFbUserData()\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// https://developers.pinterest.com/docs/tag/conversion/\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"Purchase\",\n\t\t\t{\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tcontent_ids : wpm.facebookContentIds(),\n\t\t\t},\n\t\t\t{eventID: wpmDataLayer.order.id},\n\t\t)\n\n\n\t\t// console.log(wpm.facebookContentIds())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Facebook\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet fBUserData\n\n\twpm.loadFacebookPixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.facebook.loaded = true\n\n\t\t\t// @formatter:off\n\t\t\t!function(f,b,e,v,n,t,s)\n\t\t\t{if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n\t\t\t\tn.callMethod.apply(n,arguments):n.queue.push(arguments)};\n\t\t\t\tif(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n\t\t\t\tn.queue=[];t=b.createElement(e);t.async=!0;\n\t\t\t\tt.src=v;s=b.getElementsByTagName(e)[0];\n\t\t\t\ts.parentNode.insertBefore(t,s)}(window, document,'script',\n\t\t\t\t'https://connect.facebook.net/en_US/fbevents.js');\n\t\t\t// @formatter:on\n\n\t\t\tfbq(\"init\", wpmDataLayer.pixels.facebook.pixel_id)\n\t\t\tfbq(\"track\", \"PageView\")\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getRandomEventId = function () {\n\t\treturn (Math.random() + 1).toString(36).substring(2)\n\t}\n\n\twpm.getFbUserData = function () {\n\t\t// We need the first one for InitiateCheckout\n\t\t// where getting the user_data from the browser is too slow\n\t\t// using wpm.getCookie(), so we cache the user_data earlier.\n\t\t// And we need the second one because the ViewContent hit happens too fast\n\t\t// after adding a variation to the cart because the function to cache\n\t\t// the user_data is too slow. But we can get the user_data using wpm.getCookie()\n\t\t// because we don't move away from the page and can wait for the browser\n\t\t// to get it.\n\t\tif (fBUserData) {\n\t\t\treturn fBUserData\n\t\t} else {\n\t\t\treturn wpm.getFbUserDataFromBrowser()\n\t\t}\n\t}\n\n\twpm.setFbUserData = function () {\n\t\tfBUserData = wpm.getFbUserDataFromBrowser()\n\t}\n\n\twpm.getFbUserDataFromBrowser = function () {\n\t\treturn {\n\t\t\tfbp : wpm.getCookie(\"_fbp\"),\n\t\t\tfbc : wpm.getCookie(\"_fbc\"),\n\t\t\tclient_user_agent: navigator.userAgent,\n\t\t}\n\t}\n\n\twpm.fbViewContent = function (product) {\n\n\t\ttry {\n\t\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t\tfbq(\"track\", \"ViewContent\", {\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tcontent_name: product.name,\n\t\t\t\t// content_category: product.category,\n\t\t\t\tcontent_ids: product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t\tvalue : product.price,\n\t\t\t}, {\n\t\t\t\teventID: eventId,\n\t\t\t})\n\n\t\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\t\tevent_name : \"ViewContent\",\n\t\t\t\tevent_id : eventId,\n\t\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\t\tproduct_data : product,\n\t\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tevent_source_url: window.location.href,\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.facebookContentIds = function () {\n\t\tlet prodIds = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn prodIds\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Facebook loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n\n","/**\n * Load Google Ads event listeners\n * */\n\n// view_item_list event\njQuery(document).on(\"wpmViewItemList\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tif (\n\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\tproduct.isVariable &&\n\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t) return\n\n\t\t// try to prevent that WC sends cached hits to Google\n\t\tif (!product) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_item_list\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\titems : [{\n\t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t\t}],\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"add_to_cart\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\tvalue : product.quantity * product.price,\n\t\t\t\titems : [{\n\t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\tquantity : product.quantity,\n\t\t\t\t\tprice : product.price,\n\t\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t\t}],\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_item event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_item\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\tvalue : (product.quantity ? product.quantity : 1) * product.price,\n\t\t\t\titems : [{\n\t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\tquantity : (product.quantity ? product.quantity : 1),\n\t\t\t\t\tprice : product.price,\n\t\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t\t}],\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tlet products = []\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\n\t\t\tif (\n\t\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\t\tproduct.isVariable &&\n\t\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t\t) return\n\n\t\t\tproducts.push({\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t})\n\t\t}\n\n\t\t// console.log(products);\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_search_results\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\t// value : 1 * product.price,\n\t\t\t\titems: products,\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\n// TODO distinguish with or without cart data active\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\t\titems : wpm.getGoogleAdsDynamicRemarketingOrderItems(),\n\t\t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGoogleAdsDynamicRemarketingOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// user log in event\njQuery(document).on(\"wpmLogin\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"login\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// new_customer parameter: https://support.google.com/google-ads/answer/9917012\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data_basic = {}\n\t\tlet data_with_cart = {}\n\n\t\tdata_basic = {\n\t\t\tsend_to : wpm.getGoogleAdsConversionIdentifiersWithLabel(),\n\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\tnew_customer : wpmDataLayer.order.new_customer,\n\t\t}\n\n\t\tif (wpmDataLayer?.order?.aw_merchant_id) {\n\t\t\tdata_with_cart = {\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\taw_merchant_id : wpmDataLayer.order.aw_merchant_id,\n\t\t\t\taw_feed_country : wpmDataLayer.order.aw_feed_country,\n\t\t\t\taw_feed_language: wpmDataLayer.order.aw_feed_language,\n\t\t\t\titems : wpm.getGoogleAdsRegularOrderItems(),\n\t\t\t}\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"conversion\", {...data_basic, ...data_with_cart})\n\t\t})\n\n\t\t// console.log({...data_basic,...data_with_cart})\n\n\t\t// console.log(wpm.getGoogleAdsOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n\n\n\n","/**\n * Load Google Ads functions\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet conversionIdentifiers = []\n\n\twpm.getGoogleAdsConversionIdentifiersWithLabel = function () {\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key + \"/\" + item)\n\t\t}\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsConversionIdentifiers = function () {\n\n\t\tlet conversionIdentifiers = []\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key)\n\t\t}\n\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsRegularOrderItems = function () {\n\t\t// \"id\" : \"gla_34\",\n\t\t// \"quantity\": 1,\n\t\t// \"price\" : 45\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\twpm.getGoogleAdsDynamicRemarketingOrderItems = function () {\n\t\t// \"id\" : \"gla_34\",\n\t\t// \"quantity\" : 1,\n\t\t// \"price\" : 45,\n\t\t// \"google_business_vertical\": \"retail\"\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Load Google Ads\n */\n\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Load Google Universal Analytics (GA3) event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.universal.property_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGAUAOrderItems(),\n\t\t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGAUAOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Google Analytics Universal\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGAUAOrderItems = function () {\n\n\t\t// \"id\" : \"34\",\n\t\t// \"name\" : \"Hoodie\",\n\t\t// \"brand\" : \"\",\n\t\t// \"category\" : \"Hoodies\",\n\t\t// \"list_position\": 1,\n\t\t// \"price\" : 45,\n\t\t// \"quantity\" : 1,\n\t\t// \"variant\" : \"Color: blue | Logo: yes\"\n\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tname : item.name,\n\t\t\t\tcurrency: wpmDataLayer.order.currency,\n\t\t\t\tcategory: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItem = wpm.ga3AddListNameToProduct(orderItem)\n\n\t\t\torderItems.push(orderItem)\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\twpm.ga3AddListNameToProduct = function (item_data, productPosition = null) {\n\n\t\t// if (wpm.ga3CanProductListBeSet(item_data.id)) {\n\t\t// \titem_data.listname = wpmDataLayer.shop.list_name\n\t\t//\n\t\t// \tif (productPosition) {\n\t\t// \t\titem_data.list_position = productPosition\n\t\t// \t}\n\t\t// }\n\n\t\titem_data.list_name = wpmDataLayer.shop.list_name\n\n\t\tif (productPosition) {\n\t\t\titem_data.list_position = productPosition\n\t\t}\n\n\t\treturn item_data\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Google Universal Analytics (GA3) loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Load GA4 event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.ga4.measurement_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGA4OrderItems(),\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Load GA4 functions\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGA4OrderItems = function () {\n\n\t\t// \"item_id\" : \"34\",\n\t\t// \"item_name\" : \"Hoodie\",\n\t\t// \"quantity\" : 1,\n\t\t// \"item_brand\" : \"\",\n\t\t// \"item_variant\" : \"Color: blue | Logo: yes\",\n\t\t// \"price\" : 45,\n\t\t// \"currency\" : \"CHF\",\n\t\t// \"item_category\": \"Hoodies\"\n\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\titem_name : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\titem_category: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItems.push(orderItem)\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * GA4 loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Google Analytics loader\n */\n\nrequire(\"./ga3/loader\")\nrequire(\"./ga4/loader\")\n","/**\n * Load Google base event listeners\n */\n\n// Pixel load event listener\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") {\n\t\tif (wpm.canGoogleLoad()) {\n\t\t\twpm.loadGoogle()\n\t\t} else {\n\t\t\twpm.logPreventedPixelLoading(\"google\", \"analytics / ads\")\n\t\t}\n\t}\n})\n","/**\n * Load Google base functions\n */\n\n(function (wpm, $, undefined) {\n\n\twpm.googleConfigConditionsMet = function (type) {\n\t\t// always returns true if Google Consent Mode is active\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (wpm.getConsentValues().mode === \"category\") {\n\t\t\treturn wpm.getConsentValues().categories[type] === true\n\t\t} else if (wpm.getConsentValues().mode === \"pixel\") {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-\" + type)\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings = function (google_consent_settings) {\n\n\t\tif (wpm.getConsentValues().mode === \"category\") {\n\t\t\tif (wpm.getConsentValues().categories.analytics) google_consent_settings.analytics_storage = \"granted\"\n\t\t\tif (wpm.getConsentValues().categories.ads) google_consent_settings.ad_storage = \"granted\"\n\t\t} else if ((wpm.getConsentValues().mode === \"pixel\")) {\n\t\t\tgoogle_consent_settings.analytics_storage = wpm.getConsentValues().pixels.includes(\"google-analytics\") ? \"granted\" : \"denied\"\n\t\t\tgoogle_consent_settings.ad_storage = wpm.getConsentValues().pixels.includes(\"google-ads\") ? \"granted\" : \"denied\"\n\t\t}\n\n\t\treturn google_consent_settings\n\t}\n\n\twpm.updateGoogleConsentMode = function (analytics = true, ads = true) {\n\n\t\ttry {\n\t\t\tif (\n\t\t\t\t!window.gtag ||\n\t\t\t\t!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent\n\t\t\t) return\n\n\t\t\tgtag(\"consent\", \"update\", {\n\t\t\t\tanalytics_storage: analytics ? \"granted\" : \"denied\",\n\t\t\t\tad_storage : ads ? \"granted\" : \"denied\",\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAds = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.ads.state = \"loading\"\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.enhanced_conversions?.active) {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key, {\"allow_enhanced_conversions\": true})\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.conversionIds && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_label && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_number) {\n\t\t\t\tgtag(\"config\", Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0] + \"/\" + wpmDataLayer.pixels.google.ads.phone_conversion_label, {\n\t\t\t\t\tphone_conversion_number: wpmDataLayer.pixels.google.ads.phone_conversion_number,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// ! enhanced_conversion_data needs to be var\n\t\t\t// https://support.google.com/google-ads/answer/9888145#zippy=%2Cvalidate-your-implementation-using-chrome-developer-tools\n\t\t\tif (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer?.order?.google?.ads?.enhanced_conversion_data) {\n\t\t\t\twindow.enhanced_conversion_data = wpmDataLayer.order.google.ads.enhanced_conversion_data\n\t\t\t}\n\n\t\t\twpmDataLayer.pixels.google.ads.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsUA = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.universal.property_id, wpmDataLayer.pixels.google.analytics.universal.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsGA4 = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.ga4.measurement_id, wpmDataLayer.pixels.google.analytics.ga4.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.isGoogleActive = function () {\n\t\tif (\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.universal?.property_id ||\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id ||\n\t\t\t!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)\n\t\t) {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getGoogleGtagId = function () {\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.universal.property_id\n\t\t} else if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.ga4.measurement_id\n\t\t} else {\n\t\t\treturn Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]\n\t\t}\n\t}\n\n\twpm.loadGoogle = function () {\n\n\t\tif (wpm.isGoogleActive()) {\n\n\t\t\twpmDataLayer.pixels.google.state = \"loading\"\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googletagmanager.com/gtag/js?id=\" + wpm.getGoogleGtagId())\n\t\t\t\t.done(function (script, textStatus) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// console.log('Google Optimize loaded')\n\t\t\t\t\t\t// alert('Google Optimize loaded')\n\n\t\t\t\t\t\t// Initiate Google dataLayer and gtag\n\t\t\t\t\t\twindow.dataLayer = window.dataLayer || []\n\t\t\t\t\t\twindow.gtag = function gtag() {\n\t\t\t\t\t\t\tdataLayer.push(arguments)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Consent Mode\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\n\t\t\t\t\t\t\tlet google_consent_settings = {\n\t\t\t\t\t\t\t\t\"ad_storage\" : wpmDataLayer.pixels.google.consent_mode.ad_storage,\n\t\t\t\t\t\t\t\t\"analytics_storage\": wpmDataLayer.pixels.google.consent_mode.analytics_storage,\n\t\t\t\t\t\t\t\t\"wait_for_update\" : wpmDataLayer.pixels.google.consent_mode.wait_for_update,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.region) {\n\t\t\t\t\t\t\t\tgoogle_consent_settings.region = wpmDataLayer.pixels.google.consent_mode.region\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgoogle_consent_settings = wpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings)\n\n\t\t\t\t\t\t\tgtag(\"consent\", \"default\", google_consent_settings)\n\t\t\t\t\t\t\tgtag(\"set\", \"ads_data_redaction\", wpmDataLayer.pixels.google.consent_mode.ads_data_redaction)\n\t\t\t\t\t\t\tgtag(\"set\", \"url_passthrough\", wpmDataLayer.pixels.google.consent_mode.url_passthrough)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Linker\n\t\t\t\t\t\t// https://developers.google.com/gtagjs/devguide/linker\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.linker?.settings) {\n\t\t\t\t\t\t\tgtag(\"set\", \"linker\", wpmDataLayer.pixels.google.linker.settings)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgtag(\"js\", new Date())\n\n\t\t\t\t\t\t// Google Ads loader\n\t\t\t\t\t\tif (!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) { // Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"ads\")) { \t\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAds()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-ads\", \"ads\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t// Google Universal Analytics loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) { \t\t// Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsUA()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-universal-analytics\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// GA4 loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) { \t\t\t// Only run if the pixel has set up\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsGA4()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"ga4\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\twpmDataLayer.pixels.google.state = \"ready\"\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tconsole.error(e)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t}\n\t}\n\n\twpm.canGoogleLoad = function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (\"category\" === wpm.getConsentValues().mode) {\n\t\t\treturn !!(wpm.getConsentValues().categories[\"ads\"] || wpm.getConsentValues().categories[\"analytics\"])\n\t\t} else if (\"pixel\" === wpm.getConsentValues().mode) {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-ads\") || wpm.getConsentValues().pixels.includes(\"google-analytics\")\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid load condition for Google mode in wpmConsentValues\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.gtagLoaded = function () {\n\t\treturn new Promise(function (resolve, reject) {\n\n\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject()\n\n\t\t\tlet startTime = 0\n\t\t\tlet timeout = 5000\n\t\t\tlet frequency = 200;\n\n\t\t\t(function wait() {\n\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t\t\t\tif (startTime >= timeout) return reject()\n\t\t\t\tstartTime += frequency\n\t\t\t\tsetTimeout(wait, frequency)\n\t\t\t})()\n\t\t})\n\t}\n\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Load Google base\n */\n\n// Load base\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Load Google\n */\n\n// Load base\nrequire(\"./base/loader\")\n\n//Load additional Google libraries\nrequire(\"./ads/loader\")\nrequire(\"./analytics/loader\")\nrequire(\"./optimize/loader\")\n\n\n","/**\n * Load Google Optimize event listeners\n */\n\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.google?.optimize?.container_id && !wpmDataLayer?.pixels?.google?.optimize?.loaded) {\n\t\tif (wpm.canIFire(\"analytics\", \"google-optimize\")) wpm.load_google_optimize_pixel()\n\t}\n})\n","/**\n * Load Google Optimize functions\n */\n\n\n(function (wpm, $, undefined) {\n\n\twpm.load_google_optimize_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.optimize.loaded = true\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googleoptimize.com/optimize.js?id=\" + wpmDataLayer.pixels.google.optimize.container_id)\n\t\t\t// .done(function (script, textStatus) {\n\t\t\t// \t\tconsole.log('Google Optimize loaded')\n\t\t\t// });\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Load Google Optimize\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Load Hotjar event listeners\n */\n\n// Pixel load event listener\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.hotjar?.site_id && !wpmDataLayer?.pixels?.hotjar?.loaded) {\n\t\tif (wpm.canIFire(\"analytics\", \"hotjar\") && !wpmDataLayer?.pixels?.hotjar?.loaded) wpm.load_hotjar_pixel()\n\t}\n})\n","/**\n * Load Hotjar functions\n */\n\n(function (wpm, $, undefined) {\n\n\twpm.load_hotjar_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.hotjar.loaded = true;\n\n\t\t\t// @formatter:off\n\t\t\t(function(h,o,t,j,a,r){\n\t\t\t\th.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n\t\t\t\th._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6};\n\t\t\t\ta=o.getElementsByTagName('head')[0];\n\t\t\t\tr=o.createElement('script');r.async=1;\n\t\t\t\tr.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n\t\t\t\ta.appendChild(r);\n\t\t\t})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n\t\t\t// @formatter:on\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Hotjar loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Register event listeners\n */\n\n// remove_from_cart event\njQuery(document).on(\"click\", \".remove_from_cart_button, .remove\", function () {\n\t// jQuery('.remove_from_cart_button, .remove').on('click', function (e) {\n\n\ttry {\n\t\t// console.log('remove_from_cart: ' + jQuery(this).data('product_id'));\n\n\t\tlet url = new URL(jQuery(this).attr(\"href\"))\n\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\t\twpm.removeProductFromCart(productId)\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// add_to_cart event\njQuery(document).on(\"click\", \".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button\", function () {\n\t// jQuery('.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .js-ajax-add-to-cart, .single_add_to_cart_button, .btn_color-2').on('click', function (e) {\n\n\ttry {\n\t\t// console.log('add_to_cart');\n\n\t\tif (wpmDataLayer.shop.page_type === \"product\") {\n\n\t\t\t// first process related and upsell products\n\t\t\tif (typeof jQuery(this).attr(\"href\") !== \"undefined\" && jQuery(this).attr(\"href\").includes(\"add-to-cart\")) {\n\t\t\t\t// console.log('add-to-cart on upsell and related products');\n\t\t\t\tlet quantity = 1\n\t\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t} else {\n\n\t\t\t\tif (wpmDataLayer.shop.product_type === \"simple\") {\n\n\t\t\t\t\t// console.log('test');\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(this).val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"variable\") {\n\n\t\t\t\t\t// console.log('variable');\n\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(\"[name='variation_id']\").val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"grouped\") {\n\n\t\t\t\t\t// console.log('grouped');\n\n\t\t\t\t\tjQuery(\".woocommerce-grouped-product-list-item\").each(function () {\n\n\t\t\t\t\t\tlet quantity = Number(jQuery(this).find(\".input-text.qty\").val())\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\t\tlet classes = jQuery(this).attr(\"class\")\n\t\t\t\t\t\tlet productId = wpm.getPostIdFromString(classes)\n\n\t\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t\t})\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"bundle\") {\n\n\t\t\t\t\t// console.log('bundle');\n\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(\"input[name=add-to-cart]\").val()\n\n\t\t\t\t\t// console.log('productId: ' + productId);\n\t\t\t\t\t// console.log('quantity: ' + quantity);\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\n\t\t\t// console.log('non product page');\n\n\t\t\tlet quantity = 1\n\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\t\t\t// console.log('productId: ' + productId);\n\t\t\twpm.addProductToCart(productId, quantity)\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// if someone clicks anywhere on a custom /?add-to-cart=123 link\n// trigger the add to cart event\n// body.one('click', function (e) {\n//\n// try {\n// if (jQuery(this)[0].URL) {\n//\n// let href = new URL(jQuery(this)[0].URL);\n// let searchParams = new URLSearchParams(href.search);\n//\n// if (searchParams.has('add-to-cart')) {\n// // console.log('non product page, /?add-to-cart=123 link');\n//\n// let productId = searchParams.get('add-to-cart');\n// wpm.addProductToCart(productId, 1);\n// }\n// }\n// } catch (e) {\n// console.error(e);\n// }\n// });\n\n\n/**\n * If someone clicks anywhere on a custom /?add-to-cart=123 link\n * trigger the add to cart event\n */\njQuery(document).one(\"click\", \"a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)\", function (event) {\n\t// jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {\n\n\ttry {\n\t\tif (jQuery(event.target).closest(\"a\").attr(\"href\")) {\n\n\t\t\tlet href = jQuery(event.target).closest(\"a\").attr(\"href\")\n\n\t\t\tif (href.includes(\"add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\t// console.log('pid: ' + matches[2])\n\t\t\t\tif (matches) wpm.addProductToCart(matches[2], 1)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// select_content GA UA event\n// select_item GA 4 event\n// jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {\njQuery(document).on(\"click\", \".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product\", function () {\n\t// jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {\n\n\ttry {\n\n\t\t/**\n\t\t *\n\t\t * On some pages the event fires multiple times, and on product pages\n\t\t * even on page load. Using e.stopPropagation helps to prevent this,\n\t\t * but I dont know why. We don't even have to use this, since only a real\n\t\t * product click yields a valid productId. So we filter the invalid click\n\t\t * events out later down the code. I'll keep it that way because this is\n\t\t * the most compatible way across shops.\n\t\t * e.stopPropagation();\n\t\t * */\n\n\t\t\t// console.log('select_content and select_item');\n\n\t\tlet productId = jQuery(this).nextAll(\".wpmProductId:first\").data(\"id\")\n\t\t// console.log('select_content and select_item: ' + productId);\n\n\n\t\t/**\n\t\t * On product pages, for some reason, the click event is triggered on the main product on page load.\n\t\t * In that case no ID is found. But we can discard it, since we only want to trigger the event on\n\t\t * related products, which are found below.\n\t\t */\n\n\t\tif (productId) {\n\n\t\t\t// console.log('select_content and select_item: ' + productId);\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\t// console.log('prodid: ' + productId);\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmSelectContentGaUa\", product)\n\t\t\t\tjQuery(document).trigger(\"wpmSelectItem\", product)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// begin_checkout event\njQuery(document).one(\"click\", \".checkout-button, .cart-checkout-button, .button.checkout\", function () {\n\t// jQuery('.checkout-button, .cart-checkout-button, .button.checkout').one('click', function (e) {\n\t// console.log('begin_checkout');\n\n\tjQuery(document).trigger(\"wpmBeginCheckout\")\n})\n\n\n// checkout_progress event\n// track checkout option event: entered valid billing email\njQuery(document).on(\"input\", \"#billing_email\", function () {\n\t// jQuery('#billing_email').on('input', function () {\n\n\tif (wpm.isEmail(jQuery(this).val())) {\n\t\t// wpm.fireCheckoutOption(2);\n\t\twpm.fireCheckoutProgress(2)\n\t\twpm.emailSelected = true\n\t}\n})\n\n// track checkout option event: purchase click\njQuery(document).on(\"click\", \".wc_payment_methods\", function () {\n\t// jQuery('.wc_payment_methods').on('click', function () {\n\n\tif (false === wpm.paymentMethodSelected) {\n\t\twpm.fireCheckoutProgress(3)\n\t}\n\n\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\twpm.paymentMethodSelected = true\n})\n\n// track checkout option event: purchase click\njQuery(document).one(\"click\", \"#place_order\", function () {\n\t// jQuery('#place_order').one('click', function () {\n\n\tif (false === wpm.emailSelected) {\n\t\twpm.fireCheckoutProgress(2)\n\t}\n\n\tif (false === wpm.paymentMethodSelected) {\n\t\twpm.fireCheckoutProgress(3)\n\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\t}\n\n\twpm.fireCheckoutProgress(4)\n})\n\n// update cart event\njQuery(document).on(\"click\", \"[name='update_cart']\", function () {\n\t// jQuery(\"[name='update_cart']\").on('click', function (e) {\n\n\ttry {\n\t\tjQuery(\".cart_item\").each(function () {\n\n\t\t\t// let productId = jQuery(this).find('[data-product_id]').data('product_id');\n\n\t\t\tlet url = new URL(jQuery(this).find(\".product-remove\").find(\"a\").attr(\"href\"))\n\t\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\n\t\t\tlet quantity = jQuery(this).find(\".qty\").val()\n\n\t\t\tif (quantity === 0) {\n\t\t\t\twpm.removeProductFromCart(productId)\n\t\t\t} else if (quantity < wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.removeProductFromCart(productId, wpmDataLayer.cart[productId].quantity - quantity)\n\t\t\t} else if (quantity > wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.addProductToCart(productId, quantity - wpmDataLayer.cart[productId].quantity)\n\t\t\t}\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t\twpm.getCartItemsFromBackend()\n\t}\n})\n\n\n// add_to_wishlist\njQuery(document).on(\"click\", \".add_to_wishlist, .wl-add-to\", function () {\n\t// jQuery('.add_to_wishlist, .wl-add-to').on('click', function () {\n\n\ttry {\n\t\t// console.log('add_to_wishlist');\n\t\t// console.log('this:' + jQuery(this).data('product-id'));\n\n\t\tlet productId\n\n\t\tif (jQuery(this).data(\"productid\")) { // for the WooCommerce wishlist plugin\n\t\t\tproductId = jQuery(this).data(\"productid\")\n\t\t} else if (jQuery(this).data(\"product-id\")) { // for the YITH wishlist plugin\n\t\t\tproductId = jQuery(this).data(\"product-id\")\n\t\t}\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t// console.log('add_to_wishlist');\n\t\t// console.log(product);\n\n\t\tjQuery(document).trigger(\"wpmAddToWishlist\", product)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\njQuery(document).on(\"updated_cart_totals\", function () {\n\tjQuery(document).trigger(\"wpmViewCart\")\n})\n\n\n/**\n * Called when the user selects all the required dropdowns / attributes\n *\n * Has to be hooked after document ready\n *\n * https://stackoverflow.com/a/27849208/4688612\n * https://stackoverflow.com/a/65065335/4688612\n */\n\njQuery(function () {\n\n\tjQuery(\".single_variation_wrap\").on(\"show_variation\", function (event, variation) {\n\n\t\ttry {\n\t\t\tlet productId = getIdBasedOndVariationsOutputSetting(variation.variation_id)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\t// console.log('productId: ' + productId);\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n})\n\n\n/**\n * Called on variable products when no selection has been done yet\n * or when the visitor deselects his choice.\n *\n * Has to be hooked after document ready\n */\n\njQuery(function () {\n\n\tjQuery(\".single_variation_wrap\").on(\"hide_variation\", function () {\n\n\t\ttry {\n\t\t\tlet classes = jQuery(\"body\").attr(\"class\")\n\t\t\tlet productId = classes.match(/(postid-)(\\d+)/)[2]\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\t/**\n\t\t\t * If we have a variable product with no preset,\n\t\t\t * and variations output is enabled,\n\t\t\t * then we send a viewItem event with the first\n\t\t\t * variation we find for the parent.\n\t\t\t * If variations output is disabled,\n\t\t\t * we just send the parent ID.\n\t\t\t */\n\t\t\tif (\n\t\t\t\t\"variable\" === wpmDataLayer.shop.product_type &&\n\t\t\t\twpmDataLayer?.general?.variationsOutput\n\t\t\t) {\n\t\t\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\t\t\t\t\tif (\"parentId\" in product) {\n\t\t\t\t\t\t// console.log('pid: ' + value.parentId)\n\t\t\t\t\t\tproductId = product.id\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\t// console.log('productId: ' + productId);\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t\t}\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n})\n\n\n\n/**\n * Set up wpm events\n */\n\n\n// populate the wpmDataLayer with the cart items\njQuery(window).on(\"wpmLoad\", function () {\n\n\ttry {\n\t\t// When a new session is initiated there are no items in the cart,\n\t\t// so we can save the call to get the cart items\n\t\tif (wpm.doesWooCommerceCartExist()) wpm.getCartItems()\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// get all add-to-cart= products from backend\njQuery(window).on(\"wpmLoad\", function () {\n\n\twpmDataLayer.products = wpmDataLayer.products || {}\n\n\t// scan page for add-to-cart= links\n\tlet productIds = wpm.getAddToCartLinkProductIds()\n\n\twpm.getProductsFromBackend(productIds)\n})\n\n/**\n * Save the referrer into a cookie\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\n\t// can't use session storage as we can't read it from the server\n\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\n\t\tif (document.referrer) {\n\t\t\tlet referrerUrl = new URL(document.referrer)\n\t\t\tlet referrerHostname = referrerUrl.hostname\n\n\t\t\tif (referrerHostname !== window.location.host) {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", referrerHostname)\n\t\t\t} else {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t\t}\n\n\t\t} else {\n\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t}\n\t}\n})\n\n\n/**\n * Create our own load event in order to better handle script flow execution when JS \"optimizers\" shuffle the code.\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\ttry {\n\t\tif (typeof wpmDataLayer != \"undefined\" && !wpmDataLayer?.wpmLoadFired) {\n\n\t\t\tjQuery(document).trigger(\"wpmLoadAlways\")\n\n\t\t\tif (\"product\" === wpmDataLayer.shop.page_type && wpmDataLayer.shop.product_type !== \"variable\" && wpm.getMainProductIdFromProductPage()) {\n\n\t\t\t\tlet product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage())\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\n\t\t\t} else if (\"product_category\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmCategory\")\n\n\t\t\t} else if (\"search\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmSearch\")\n\n\t\t\t} else if (\"cart\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewCart\")\n\n\t\t\t} else if (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer.order) {\n\n\t\t\t\tif (!wpm.isOrderIdStored(wpmDataLayer.order.id)) {\n\n\t\t\t\t\tjQuery(document).trigger(\"wpmOrderReceivedPage\")\n\t\t\t\t\twpm.writeOrderIdToStorage(wpmDataLayer.order.id)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tjQuery(document).trigger(\"wpmEverywhereElse\")\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.user?.id && !wpm.hasLoginEventFired()) {\n\t\t\t\tjQuery(document).trigger(\"wpmLogin\")\n\t\t\t\twpm.setLoginEventFired()\n\t\t\t}\n\n\t\t\t// /**\n\t\t\t// * Load mini cart fragments into a wpm session storage key,\n\t\t\t// * after the document load event.\n\t\t\t// */\n\t\t\t// jQuery(document).ajaxSend(function (event, jqxhr, settings) {\n\t\t\t// \t// console.log('settings.url: ' + settings.url);\n\t\t\t//\n\t\t\t// \tif (settings.url.includes(\"get_refreshed_fragments\") && sessionStorage) {\n\t\t\t// \t\tif (!sessionStorage.getItem(\"wpmMiniCartActive\")) {\n\t\t\t// \t\t\tsessionStorage.setItem(\"wpmMiniCartActive\", JSON.stringify(true))\n\t\t\t// \t\t}\n\t\t\t// \t}\n\t\t\t// })\n\n\t\t\twpmDataLayer.wpmLoadFired = true\n\t\t}\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// jQuery(window).on(\"load\", function () {\n// \tjQuery(document).trigger(\"wpmLoad\", {})\n// })\n\njQuery(window).on(\"wpmPreLoadPixels\", function () {\n\n\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\twpm.updateConsentCookieValues(true)\n\t}\n\tjQuery(document).trigger(\"wpmLoadPixels\", {})\n})\n","/**\n * Create a wpm namespace under which all functions are declared\n */\n\n// https://stackoverflow.com/a/5947280/4688612\n(function (wpm, $, undefined) {\n\n\tconst wpmDeduper = {\n\t\tkeyName : \"_wpm_order_ids\",\n\t\tcookieExpiresDays: 365,\n\t}\n\n\tconst wpmRestSettings = {\n\t\t// cookiesAvailable : '_wpm_cookies_are_available',\n\t\tcookieWpmRestEndpointAvailable: \"_wpm_endpoint_available\",\n\t\trestEndpoint : \"/wp-json/\",\n\t\trestFails : 0,\n\t\trestFailsThreshold : 10,\n\t}\n\n\twpm.emailSelected = false\n\twpm.paymentMethodSelected = false\n\n\t// wpm.checkIfCookiesAvailable = function () {\n\t//\n\t// // read the cookie if previously set, if it is return true, otherwise continue\n\t// if (wpm.getCookie(wpmRestSettings.cookiesAvailable)) {\n\t// return true;\n\t// }\n\t//\n\t// // set the cookie for the session\n\t// Cookies.set(wpmRestSettings.cookiesAvailable, true);\n\t//\n\t// // read cookie, true if ok, false if not ok\n\t// return !!wpm.getCookie(wpmRestSettings.cookiesAvailable);\n\t// }\n\n\twpm.useRestEndpoint = function () {\n\n\t\t// only if sessionStorage is available\n\n\t\t// only if REST API endpoint is generally accessible\n\t\t// check in sessionStorage if we checked before and return answer\n\t\t// otherwise check if the endpoint is available, save answer in sessionStorage and return answer\n\n\t\t// only if not too many REST API errors happened\n\n\t\treturn wpm.isSessionStorageAvailable() &&\n\t\t\twpm.isRestEndpointAvailable() &&\n\t\t\twpm.isBelowRestErrorThreshold()\n\t}\n\n\twpm.isBelowRestErrorThreshold = function () {\n\t\treturn window.sessionStorage.getItem(wpmRestSettings.restFails) <= wpmRestSettings.restFailsThreshold\n\t}\n\n\twpm.isRestEndpointAvailable = function () {\n\n\t\tif (window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable)) {\n\t\t\treturn JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable))\n\t\t} else {\n\t\t\t// return wpm.testEndpoint();\n\t\t\t// just set the value whenever possible in order not to wait or block the main thread\n\t\t\twpm.testEndpoint()\n\t\t}\n\t}\n\n\twpm.isSessionStorageAvailable = function () {\n\n\t\treturn !!window.sessionStorage\n\t}\n\n\twpm.testEndpoint = function (\n\t\turl = location.protocol + \"//\" + location.host + wpmRestSettings.restEndpoint,\n\t\tcookieName = wpmRestSettings.cookieWpmRestEndpointAvailable,\n\t) {\n\t\t// console.log('testing endpoint');\n\n\t\tjQuery.ajax(url, {\n\t\t\ttype : \"HEAD\",\n\t\t\ttimeout: 1000,\n\t\t\t// async: false,\n\t\t\tstatusCode: {\n\t\t\t\t200: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, true);\n\t\t\t\t\t// console.log('endpoint works');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(true))\n\t\t\t\t},\n\t\t\t\t404: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t\t0 : function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t},\n\t\t}).then(response => {\n\t\t\t// console.log('test done')\n\t\t\t// console.log('result: ' + JSON.parse(window.sessionStorage.getItem(cookieName)));\n\t\t\t// return JSON.parse(window.sessionStorage.getItem(cookieName));\n\t\t})\n\t}\n\n\twpm.isWpmRestEndpointAvailable = function (cookieName = wpmRestSettings.cookieWpmRestEndpointAvailable) {\n\n\t\treturn !!wpm.getCookie(cookieName)\n\t}\n\n\twpm.writeOrderIdToStorage = function (orderId, expireDays = 365) {\n\n\t\t// save the order ID in the browser storage\n\n\t\tif (!window.Storage) {\n\t\t\tlet expiresDate = new Date()\n\t\t\texpiresDate.setDate(expiresDate.getDate() + wpmDeduper.cookieExpiresDays)\n\n\t\t\tlet ids = []\n\t\t\tif (checkCookie()) {\n\t\t\t\tids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t}\n\n\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\tids.push(orderId)\n\t\t\t\tdocument.cookie = wpmDeduper.keyName + \"=\" + JSON.stringify(ids) + \";expires=\" + expiresDate.toUTCString()\n\t\t\t}\n\n\t\t} else {\n\t\t\tif (localStorage.getItem(wpmDeduper.keyName) === null) {\n\t\t\t\tlet ids = []\n\t\t\t\tids.push(orderId)\n\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\n\t\t\t} else {\n\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\t\tids.push(orderId)\n\t\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (typeof wpm.storeOrderIdOnServer === \"function\" && wpmDataLayer.orderDeduplication) {\n\t\t\twpm.storeOrderIdOnServer(orderId)\n\t\t}\n\t}\n\n\tfunction checkCookie() {\n\t\tlet key = wpm.getCookie(wpmDeduper.keyName)\n\t\treturn key !== \"\"\n\t}\n\n\twpm.isOrderIdStored = function (orderId) {\n\n\t\t// console.log('deduper: ' + wpmDataLayer.orderDeduplication);\n\t\tif (wpmDataLayer.orderDeduplication) {\n\t\t\t// console.log('order deduplication: on');\n\t\t\tif (!window.Storage) {\n\n\t\t\t\tif (checkCookie()) {\n\t\t\t\t\tlet ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (localStorage.getItem(wpmDeduper.keyName) !== null) {\n\t\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log(\"order duplication prevention: off\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.isEmail = function (email) {\n\t\t// https://emailregex.com/\n\t\tlet regex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\n\t\treturn regex.test(email)\n\t}\n\n\twpm.removeProductFromCart = function (productId, quantityToRemove = null) {\n\t\t// console.log('product_id: ' + productId + ' | quantityToRemove: ' + quantityToRemove);\n\n\t\ttry {\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tlet quantity\n\n\t\t\tif (quantityToRemove == null) {\n\t\t\t\tquantity = wpmDataLayer.cart[productId].quantity\n\t\t\t} else {\n\t\t\t\tquantity = quantityToRemove\n\t\t\t}\n\n\t\t\t// console.log('product_id: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log(productId);\n\t\t\t// console.log(wpmDataLayer.cart);\n\t\t\t// console.log(wpmDataLayer.cart[productId]);\n\n\t\t\tif (wpmDataLayer.cart[productId]) {\n\n\t\t\t\t// let product = {\n\t\t\t\t// id : productId.toString(),\n\t\t\t\t// dyn_r_ids: wpmDataLayer.cart[productId].dyn_r_ids,\n\t\t\t\t// name : wpmDataLayer.cart[productId].name,\n\t\t\t\t// // list_name: wpmDataLayer.shop.list_name, // doesn't make sense on mini_cart\n\t\t\t\t// brand : wpmDataLayer.cart[productId].brand,\n\t\t\t\t// category: wpmDataLayer.cart[productId].category,\n\t\t\t\t// variant : wpmDataLayer.cart[productId].variant,\n\t\t\t\t// // list_position: wpmDataLayer.cart[productId].position, // doesn't make sense on mini_cart\n\t\t\t\t// quantity : quantity,\n\t\t\t\t// price : wpmDataLayer.cart[productId].price,\n\t\t\t\t// isVariation: wpmDataLayer.products[productId].isVariation,\n\t\t\t\t// };\n\t\t\t\t//\n\t\t\t\t// if (product.isVariation) product['parentId_dyn_r_ids'] = wpmDataLayer.products[productId].parentId_dyn_r_ids;\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t// console.log('removing');\n\t\t\t\t// console.log(data);\n\n\t\t\t\tjQuery(document).trigger(\"wpmRemoveFromCart\", product)\n\n\t\t\t\tif (quantityToRemove == null || wpmDataLayer.cart[productId].quantity === quantityToRemove) {\n\t\t\t\t\tdelete wpmDataLayer.cart[productId]\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t} else {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity - quantity\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\t// console.log('getting cart from back end');\n\t\t\t// wpm.getCartItemsFromBackend();\n\t\t\t// console.log('getting cart from back end done');\n\n\t\t}\n\t}\n\n\tgetIdBasedOndVariationsOutputSetting = function (productId) {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.general?.variationsOutput) {\n\t\t\t\t// console.log('test');\n\t\t\t\treturn productId\n\t\t\t} else {\n\t\t\t\tif (wpmDataLayer.products[productId].isVariation) {\n\t\t\t\t\treturn wpmDataLayer.products[productId].parentId\n\t\t\t\t} else {\n\t\t\t\t\treturn productId\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// add_to_cart\n\twpm.addProductToCart = function (productId, quantity) {\n\n\t\ttry {\n\t\t\t// console.log('productId: ' + productId + ' | qty: ' + quantity);\n\t\t\t// console.log('productId: ' + productId + ' | variationId: ' + variationId + ' | qty: ' + quantity);\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer?.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\t// console.log(productId)\n\t\t\t\t// console.log(wpmDataLayer.cart)\n\n\t\t\t\tjQuery(document).trigger(\"wpmAddToCart\", product)\n\n\t\t\t\t// add product to cart wpmDataLayer['cart']\n\n\t\t\t\t// if the product already exists in the object, only add the additional quantity\n\t\t\t\t// otherwise create that product object in the wpmDataLayer['cart']\n\t\t\t\tif (wpmDataLayer?.cart[productId]) {\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity + quantity\n\t\t\t\t} else {\n\n\t\t\t\t\tif (!(\"cart\" in wpmDataLayer)) wpmDataLayer.cart = {}\n\t\t\t\t\twpmDataLayer.cart[productId] = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\t\t\t\t}\n\n\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\n\t\t\t// fallback if wpmDataLayer.cart and wpmDataLayer.products got out of sync in case cart caching has an issue\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\twpm.getCartItems = function () {\n\n\t\t// console.log('get cart items');\n\n\t\tif (sessionStorage) {\n\t\t\tif (!sessionStorage.getItem(\"wpmDataLayerCart\") || wpmDataLayer.shop.page_type === \"order_received_page\") {\n\t\t\t\tsessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify({}))\n\t\t\t} else {\n\t\t\t\twpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem(\"wpmDataLayerCart\")))\n\t\t\t}\n\t\t} else {\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\t// get all cart items from the backend\n\twpm.getCartItemsFromBackend = function () {\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction: \"wpm_get_cart_items\",\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (cartItems) {\n\n\t\t\t\t\t\t// save all cart items into wpmDataLayer\n\n\t\t\t\t\t\tif (!cartItems[\"cart\"]) cartItems[\"cart\"] = {}\n\n\t\t\t\t\t\twpm.saveCartObjectToDataLayer(cartItems[\"cart\"])\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(cartItems[\"cart\"]))\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductsFromBackend = function (productIds) {\n\t\t// console.log('getting pids from back-end: ' + productIds)\n\t\t// get productIds from the backend\n\n\t\t// reduce productIds by products already in the dataLayer\n\t\tproductIds = productIds.filter(item => !wpmDataLayer.products.hasOwnProperty(item))\n\n\t\t// if no products IDs are in the object, don't try to get anything from the server\n\t\tif (!productIds || productIds.length === 0) return\n\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_get_product_ids\",\n\t\t\t\tproductIds: productIds,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (products) {\n\n\t\t\t\t\t\t// merge products into wpmDataLayer.products\n\t\t\t\t\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, products)\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.saveCartObjectToDataLayer = function (cartObject) {\n\t\twpmDataLayer.cart = cartObject\n\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, cartObject)\n\t}\n\n\twpm.fireCheckoutOption = function (step, checkout_option = null, value = null) {\n\n\t\tlet data = {\n\t\t\tstep : step,\n\t\t\tcheckout_option: checkout_option,\n\t\t\tvalue : value,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutOption\", data)\n\t}\n\n\twpm.fireCheckoutProgress = function (step) {\n\n\t\tlet data = {\n\t\t\tstep: step,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutProgress\", data)\n\t}\n\n\twpm.getPostIdFromString = function (string) {\n\t\t// console.log(string);\n\t\ttry {\n\t\t\treturn string.match(/(post-)(\\d+)/)[2]\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.triggerViewItemList = function (productId) {\n\n\t\t// productId = null;\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tproductId = getIdBasedOndVariationsOutputSetting(productId)\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tjQuery(document).trigger(\"wpmViewItemList\", wpm.getProductDataForViewItemEvent(productId))\n\t}\n\n\twpm.getProductDataForViewItemEvent = function (productId) {\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\ttry {\n\t\t\tif (wpmDataLayer.products[productId]) {\n\n\t\t\t\treturn wpm.getProductDetailsFormattedForEvent(productId)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\twpm.getMainProductIdFromProductPage = function () {\n\t\ttry {\n\t\t\tif ([\"simple\", \"variable\", \"grouped\", \"composite\", \"bundle\"].indexOf(wpmDataLayer.shop.product_type) >= 0) {\n\t\t\t\treturn jQuery(\".wpmProductId:first\").data(\"id\")\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.viewItemListTriggerTestMode = function (target) {\n\n\t\tjQuery(target).css({\"position\": \"relative\"})\n\t\tjQuery(target).append(\"<div id=\\\"viewItemListTriggerOverlay\\\"></div>\")\n\t\tjQuery(target).find(\"#viewItemListTriggerOverlay\").css({\n\t\t\t\"z-index\" : \"10\",\n\t\t\t\"display\" : \"block\",\n\t\t\t\"position\" : \"absolute\",\n\t\t\t\"height\" : \"100%\",\n\t\t\t\"top\" : \"0\",\n\t\t\t\"left\" : \"0\",\n\t\t\t\"right\" : \"0\",\n\t\t\t\"opacity\" : wpmDataLayer.viewItemListTrigger.opacity,\n\t\t\t\"background-color\": wpmDataLayer.viewItemListTrigger.backgroundColor,\n\t\t})\n\t}\n\n\twpm.getSearchTermFromUrl = function () {\n\t\ttry {\n\t\t\tlet urlParameters = new URLSearchParams(window.location.search)\n\t\t\treturn urlParameters.get(\"s\")\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// we need this to track timeouts for intersection observers\n\tlet ioTimeouts = {}\n\n\twpm.observerCallback = function (entries, observer) {\n\n\t\tentries.forEach((entry) => {\n\n\t\t\ttry {\n\t\t\t\tlet productId\n\n\t\t\t\tlet elementId = jQuery(entry.target).data(\"ioid\")\n\n\t\t\t\t// Get the productId from next element, if wpmProductId is a sibling, like in Gutenberg blocks\n\t\t\t\t// otherwise go search in children, like in regular WC loop items\n\t\t\t\tif (jQuery(entry.target).next(\".wpmProductId\").length) {\n\t\t\t\t\t// console.log('test 1');\n\t\t\t\t\tproductId = jQuery(entry.target).next(\".wpmProductId\").data(\"id\")\n\t\t\t\t} else {\n\t\t\t\t\tproductId = jQuery(entry.target).find(\".wpmProductId\").data(\"id\")\n\t\t\t\t}\n\n\t\t\t\t// productId = null;\n\n\t\t\t\tif (!productId) throw Error(\"wpmProductId element not found\")\n\n\t\t\t\tif (entry.isIntersecting) {\n\n\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\tioTimeouts[elementId] = setTimeout(() => {\n\t\t\t\t\t\t// console.log('prodid: ' + productId);\n\t\t\t\t\t\twpm.triggerViewItemList(productId)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) wpm.viewItemListTriggerTestMode(entry.target)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.repeat === false) observer.unobserve(entry.target)\n\t\t\t\t\t}, wpmDataLayer.viewItemListTrigger.timeout)\n\n\t\t\t\t} else {\n\n\t\t\t\t\tclearTimeout(ioTimeouts[elementId])\n\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) jQuery(entry.target).find(\"#viewItemListTriggerOverlay\").remove()\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t}\n\t\t})\n\t}\n\n\t// fire view_item_list only on products that have become visible\n\tlet io\n\tlet ioid = 0\n\tlet allIoElementsToWatch\n\n\tlet getAllElementsToWatch = function () {\n\n\t\tallIoElementsToWatch = jQuery(\".wpmProductId\")\n\t\t\t.map(function (i, elem) {\n\t\t\t\t// console.log(elem);\n\t\t\t\tif (\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"type-product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product-item-inner\")\n\t\t\t\t) {\n\t\t\t\t\t// console.log(elem);\n\t\t\t\t\treturn jQuery(elem).parent()\n\t\t\t\t} else if (\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"wc-block-grid__product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product-small\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"woocommerce-LoopProduct-link\")\n\t\t\t\t) {\n\t\t\t\t\treturn jQuery(this).prev()\n\t\t\t\t} else if (jQuery(elem).closest(\".product\").length) {\n\t\t\t\t\treturn jQuery(elem).closest(\".product\")\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\twpm.startIntersectionObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// enable view_item_list test mode from browser\n\t\t\tif (wpm.urlHasParameter(\"vildemomode\")) wpmDataLayer.viewItemListTrigger.testMode = true\n\n\t\t\t// set up intersection observer\n\t\t\tio = new IntersectionObserver(wpm.observerCallback, {\n\t\t\t\tthreshold: wpmDataLayer.viewItemListTrigger.threshold,\n\t\t\t})\n\n\t\t\tgetAllElementsToWatch()\n\n\t\t\t// console.log(allElementsToWatch);\n\n\t\t\tallIoElementsToWatch.each(function (i, elem) {\n\t\t\t\t// console.log(elem[0]);\n\t\t\t\t// jQuery(elem[0]).attr('data-ioid', ioid++);\n\t\t\t\tjQuery(elem[0]).data(\"ioid\", ioid++)\n\n\t\t\t\tio.observe(elem[0])\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// watch DOM for new lazy loaded products and add them to the intersection observer\n\twpm.startProductsMutationObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// Pass in the target node, as well as the observer options\n\n\t\t\t// selects the most common parent node\n\t\t\t// https://stackoverflow.com/a/7648323/4688612\n\t\t\tlet productsNode = jQuery(\".wpmProductId:eq(0)\").parents().has(jQuery(\".wpmProductId:eq(1)\").parents()).first()\n\n\t\t\tif (productsNode.length) {\n\t\t\t\tproductsMutationObserver.observe(productsNode[0], {\n\t\t\t\t\tattributes : true,\n\t\t\t\t\tchildList : true,\n\t\t\t\t\tcharacterData: true,\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// Create an observer instance\n\tlet productsMutationObserver = new MutationObserver(function (mutations) {\n\n\t\tmutations.forEach(function (mutation) {\n\t\t\tlet newNodes = mutation.addedNodes // DOM NodeList\n\t\t\tif (newNodes !== null) { // If there are new nodes added\n\t\t\t\tlet nodes = jQuery(newNodes) // jQuery set\n\t\t\t\tnodes.each(function () {\n\t\t\t\t\tif (\n\t\t\t\t\t\tjQuery(this).hasClass(\"type-product\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"product-small\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"wc-block-grid__product\")\n\t\t\t\t\t) {\n\t\t\t\t\t\t// check if the node has a child or sibling wpmProductId\n\t\t\t\t\t\t// if yes add it to the intersectionObserver\n\t\t\t\t\t\tif (hasWpmProductIdElement(this)) {\n\t\t\t\t\t\t\tjQuery(this).data(\"ioid\", ioid++)\n\t\t\t\t\t\t\tio.observe(this)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t})\n\n\tlet hasWpmProductIdElement = function (elem) {\n\t\treturn !!(jQuery(elem).find(\".wpmProductId\").length ||\n\t\t\tjQuery(elem).siblings(\".wpmProductId\").length)\n\t}\n\n\twpm.setCookie = function (cookieName, cookieValue = \"\", expiryDays = null) {\n\t\tif (expiryDays) {\n\t\t\tlet d = new Date()\n\t\t\td.setTime(d.getTime() + (expiryDays * 24 * 60 * 60 * 1000))\n\t\t\tlet expires = \"expires=\" + d.toUTCString()\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";\" + expires + \";path=/\"\n\t\t} else {\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";path=/\"\n\t\t}\n\t}\n\n\twpm.getCookie = function (cookieName) {\n\t\tlet name = cookieName + \"=\"\n\t\tlet decodedCookie = decodeURIComponent(document.cookie)\n\t\tlet ca = decodedCookie.split(\";\")\n\t\tfor (let i = 0; i < ca.length; i++) {\n\t\t\tlet c = ca[i]\n\t\t\twhile (c.charAt(0) == \" \") {\n\t\t\t\tc = c.substring(1)\n\t\t\t}\n\t\t\tif (c.indexOf(name) == 0) {\n\t\t\t\treturn c.substring(name.length, c.length)\n\t\t\t}\n\t\t}\n\t\treturn \"\"\n\t}\n\n\twpm.getWpmSessionData = function () {\n\t\tif (window.sessionStorage) {\n\n\t\t\tlet data = window.sessionStorage.getItem(\"_wpm\")\n\t\t\tif (data !== null) {\n\t\t\t\treturn JSON.parse(data)\n\t\t\t} else {\n\t\t\t\treturn {}\n\t\t\t}\n\t\t} else {\n\t\t\treturn {}\n\t\t}\n\t}\n\n\twpm.setWpmSessionData = function (data) {\n\t\tif (window.sessionStorage) {\n\t\t\twindow.sessionStorage.setItem(\"_wpm\", JSON.stringify(data))\n\t\t}\n\t}\n\n\twpm.storeOrderIdOnServer = function (orderId) {\n\n\t\t// console.log('saving wpm_purchase_pixels_fired');\n\n\t\t// console.log('url: ' + wpm_premium_only_ajax_object.ajax_url);\n\t\t// console.log('nonce: ' + wpm_premium_only_ajax_object.nonce);\n\t\t// console.log('url: ' + wpm.ajax_url);\n\t\t// console.log('nonce: ' + wpm.nonce);\n\n\t\ttry {\n\t\t\t// save the state in the database\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_purchase_pixels_fired\",\n\t\t\t\torder_id: orderId,\n\t\t\t\t// nonce : ajax_object.nonce,\n\t\t\t\tnonce: wpm.nonce,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"post\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (response) {\n\t\t\t\t\t\tif (response.success === false) {\n\t\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductIdByCartItemKeyUrl = function (url) {\n\t\tlet searchParams = new URLSearchParams(url.search)\n\t\tlet cartItemKey = searchParams.get(\"remove_item\")\n\n\t\tlet productId\n\n\t\tif (wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"] === 0) {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"product_id\"]\n\t\t} else {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"]\n\t\t}\n\n\t\treturn productId\n\t}\n\n\twpm.getAddToCartLinkProductIds = function () {\n\t\treturn jQuery(\"a\").map(function () {\n\t\t\tlet href = jQuery(this).attr(\"href\")\n\n\t\t\tif (href && href.includes(\"?add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\tif (matches) return matches[2]\n\t\t\t}\n\t\t}).get()\n\t}\n\n\twpm.getProductDetailsFormattedForEvent = function (productId, quantity = 1) {\n\n\t\t// console.log(wpmDataLayer.products[productId].dyn_r_ids)\n\n\t\tlet product = {\n\t\t\tid : productId.toString(),\n\t\t\tdyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\tname : wpmDataLayer.products[productId].name,\n\t\t\tlist_name : wpmDataLayer.shop.list_name,\n\t\t\tbrand : wpmDataLayer.products[productId].brand,\n\t\t\tcategory : wpmDataLayer.products[productId].category,\n\t\t\tvariant : wpmDataLayer.products[productId].variant,\n\t\t\tlist_position: wpmDataLayer.products[productId].position,\n\t\t\tquantity : quantity,\n\t\t\tprice : wpmDataLayer.products[productId].price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tisVariable : wpmDataLayer.products[productId].isVariable,\n\t\t\tisVariation : wpmDataLayer.products[productId].isVariation,\n\t\t\tparentId : wpmDataLayer.products[productId].parentId,\n\t\t}\n\n\t\tif (product.isVariation) product[\"parentId_dyn_r_ids\"] = wpmDataLayer.products[productId].parentId_dyn_r_ids\n\n\t\treturn product\n\t}\n\n\twpm.setReferrerToCookie = function () {\n\t\t// can't use session storage as we can't read it from the server\n\t\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\t\t\twpm.setCookie(\"wpmReferrer\", document.referrer)\n\t\t}\n\t}\n\n\twpm.getReferrerFromCookie = function () {\n\t\tif (wpm.getCookie(\"wpmReferrer\")) {\n\t\t\treturn wpm.getCookie(\"wpmReferrer\")\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t}\n\n\twpm.getClidFromBrowser = function (clidId = \"gclid\") {\n\n\t\tlet clidCookieId\n\n\t\tclidCookieId = {\n\t\t\tgclid: \"_gcl_aw\",\n\t\t\tdclid: \"_gcl_dc\",\n\t\t}\n\n\t\tif (wpm.getCookie(clidCookieId[clidId])) {\n\t\t\tlet clidCookie = wpm.getCookie(clidCookieId[clidId])\n\t\t\tlet matches = clidCookie.match(/(GCL.[\\d]*.)(.*)/)\n\t\t\treturn matches[2]\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\twpm.getUserAgent = function () {\n\t\treturn navigator.userAgent\n\t}\n\n\twpm.getViewPort = function () {\n\t\treturn {\n\t\t\twidth : Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),\n\t\t\theight: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0),\n\t\t}\n\t}\n\n\t/*\n\t* Handle Cookie Management Platforms\n\t* */\n\n\tlet getComplianzCookies = function () {\n\n\t\tlet cmplz_statistics = wpm.getCookie(\"cmplz_statistics\")\n\t\tlet cmplz_marketing = wpm.getCookie(\"cmplz_marketing\")\n\t\tlet cmplz_consent_status = wpm.getCookie(\"cmplz_consent_status\") || wpm.getCookie(\"cmplz_banner-status\")\n\n\n\t\tif (cmplz_consent_status) {\n\t\t\treturn {\n\t\t\t\tanalytics : cmplz_statistics === \"allow\",\n\t\t\t\tads : cmplz_marketing === \"allow\",\n\t\t\t\tvisitorHasChosen: true,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tlet getCookieLawInfoCookies = function () {\n\n\t\tlet analyticsCookie = wpm.getCookie(\"cookielawinfo-checkbox-analytics\") || wpm.getCookie(\"cookielawinfo-checkbox-analytiques\")\n\t\tlet adsCookie = wpm.getCookie(\"cookielawinfo-checkbox-advertisement\") || wpm.getCookie(\"cookielawinfo-checkbox-publicite\")\n\t\tlet visitorHasChosen = wpm.getCookie(\"CookieLawInfoConsent\")\n\n\t\tif (analyticsCookie || adsCookie) {\n\n\t\t\treturn {\n\t\t\t\tanalytics : analyticsCookie === \"yes\",\n\t\t\t\tads : adsCookie === \"yes\",\n\t\t\t\tvisitorHasChosen: !!visitorHasChosen,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\n\tlet\n\t\twpmConsentValues = {}\n\twpmConsentValues.categories = {}\n\twpmConsentValues.pixels = []\n\twpmConsentValues.mode = \"category\"\n\twpmConsentValues.visitorHasChosen = false\n\n\twpm.getConsentValues = function () {\n\t\treturn wpmConsentValues\n\t}\n\n\twpm.setConsentValueCategories = function (analytics = false, ads = false) {\n\t\twpmConsentValues.categories.analytics = analytics\n\t\twpmConsentValues.categories.ads = ads\n\t}\n\n\twpm.updateConsentCookieValues = function (explicitConsent = false) {\n\n\t\t// ad_storage\n\t\t// analytics_storage\n\t\t// functionality_storage\n\t\t// personalization_storage\n\t\t// security_storage\n\n\t\t// console.log('exp cons: ' + explicitConsent)\n\n\t\tlet cookie\n\n\t\tif (cookie = wpm.getCookie(\"CookieConsent\")) {\n\t\t\t// Cookiebot\n\t\t\t// https://wordpress.org/plugins/cookiebot/\n\t\t\tcookie = decodeURI(cookie)\n\n\t\t\t// console.log(cookie.indexOf('statistics:true'))\n\t\t\t// console.log(cookie.indexOf('marketing:true'))\n\n\t\t\twpmConsentValues.categories.analytics = cookie.indexOf(\"statistics:true\") >= 0\n\t\t\twpmConsentValues.categories.ads = cookie.indexOf(\"marketing:true\") >= 0\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"CookieScriptConsent\")) {\n\t\t\t// Cookie Script\n\t\t\t// https://wordpress.org/plugins/cookie-script-com/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\t// console.log(cookie)\n\t\t\t// console.log(cookie.action)\n\t\t\t// console.log('cat length: ' + cookie.categories.length)\n\t\t\t// console.log(cookie.categories.indexOf('performance'))\n\n\t\t\tif (cookie.action === \"reject\") {\n\t\t\t\twpmConsentValues.categories.analytics = false\n\t\t\t\twpmConsentValues.categories.ads = false\n\t\t\t} else if (cookie.categories.length === 2) {\n\t\t\t\twpmConsentValues.categories.analytics = true\n\t\t\t\twpmConsentValues.categories.ads = true\n\t\t\t} else {\n\t\t\t\twpmConsentValues.categories.analytics = cookie.categories.indexOf(\"performance\") >= 0\n\t\t\t\twpmConsentValues.categories.ads = cookie.categories.indexOf(\"targeting\") >= 0\n\t\t\t}\n\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie(\"borlabs-cookie\")) {\n\t\t\t// Borlabs Cookie\n\t\t\t// https://borlabs.io/borlabs-cookie/\n\n\t\t\tcookie = decodeURI(cookie)\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie?.consents?.statistics\n\t\t\twpmConsentValues.categories.ads = !!cookie?.consents?.marketing\n\t\t\twpmConsentValues.visitorHasChosen = true\n\t\t\twpmConsentValues.pixels = [...cookie?.consents?.statistics || [], ...cookie?.consents?.marketing || []]\n\t\t\twpmConsentValues.mode = \"pixel\"\n\n\t\t} else if (cookie = getComplianzCookies()) {\n\t\t\t// Complianz Cookie\n\t\t\t// https://wordpress.org/plugins/complianz-gdpr/\n\n\t\t\t// console.log(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else if (cookie = wpm.getCookie(\"cookie_notice_accepted\")) {\n\t\t\t// Cookie Compliance (free version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\twpmConsentValues.categories.analytics = true\n\t\t\twpmConsentValues.categories.ads = true\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"hu-consent\")) {\n\t\t\t// Cookie Compliance (pro version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie.categories[\"3\"]\n\t\t\twpmConsentValues.categories.ads = !!cookie.categories[\"4\"]\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = getCookieLawInfoCookies()) {\n\t\t\t// CookieYes, GDPR Cookie Consent (Cookie Law Info)\n\t\t\t// https://wordpress.org/plugins/cookie-law-info/\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen === true\n\n\t\t} else if (cookie = wpm.getCookie(\"moove_gdpr_popup\")) {\n\t\t\t// GDPR Cookie Compliance Plugin by Moove Agency\n\t\t\t// https://wordpress.org/plugins/gdpr-cookie-compliance/\n\t\t\t// TODO write documentation on how to set up the plugin in order for this to work properly\n\n\t\t\tcookie = JSON.parse(cookie)\n\t\t\t// console.log('moove cookie thirdparty: ' + cookie.thirdparty)\n\t\t\t// console.log('moove cookie advanced: ' + cookie.advanced)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.thirdparty === \"1\"\n\t\t\twpmConsentValues.categories.ads = cookie.advanced === \"1\"\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t\t// console.log(wpmConsentValues)\n\n\t\t} else {\n\t\t\t// consentValues.categories.analytics = true\n\t\t\t// consentValues.categories.ads = true\n\n\t\t\twpmConsentValues.categories.analytics = !explicitConsent\n\t\t\twpmConsentValues.categories.ads = !explicitConsent\n\t\t}\n\t}\n\n\twpm.updateConsentCookieValues()\n\n\twpm.setConsentDefaultValuesToExplicit = function () {\n\t\twpmConsentValues.categories = {\n\t\t\tanalytics: false,\n\t\t\tads : false,\n\t\t}\n\t}\n\n\twpm.canIFire = function (category, pixelName) {\n\n\t\tlet canIFireMode\n\n\t\tif (\"category\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = !!wpmConsentValues.categories[category]\n\t\t} else if (\"pixel\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = wpmConsentValues.pixels.includes(pixelName)\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid consent mode in wpmConsentValues\")\n\t\t\tcanIFireMode = false\n\t\t}\n\n\t\tif (canIFireMode) {\n\t\t\treturn true\n\t\t} else {\n\t\t\tif (true || wpm.urlHasParameter(\"debugConsentMode\")) {\n\t\t\t\twpm.logPreventedPixelLoading(pixelName, category)\n\t\t\t}\n\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.logPreventedPixelLoading = function (pixelName, category) {\n\t\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)\")\n\t\t} else {\n\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)\")\n\t\t}\n\t}\n\n\t/**\n\t * Runs through each script in <head> and blocks / unblocks it according to the plugin settings\n\t * and user consent.\n\t */\n\n\t// https://stackoverflow.com/q/65453565/4688612\n\twpm.scriptTagObserver = new MutationObserver((mutations) => {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif ($(node).data(\"wpm-cookie-category\")) {\n\n\t\t\t\t\t\t// console.log(node)\n\n\t\t\t\t\t\t// If the pixel category has been approved > unblock\n\t\t\t\t\t\t// If the pixel belongs to more than one category, then unblock if one of the categories has been approved\n\t\t\t\t\t\t// If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts\n\n\t\t\t\t\t\tif (wpm.shouldScriptBeActive(node)) {\n\t\t\t\t\t\t\twpm.unblockScript(node)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twpm.blockScript(node)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\twpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true})\n\twindow.addEventListener(\"DOMContentLoaded\", () => wpm.scriptTagObserver.disconnect())\n\n\twpm.shouldScriptBeActive = function (node) {\n\n\t\tif (\n\t\t\twpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||\n\t\t\twpmConsentValues.visitorHasChosen\n\t\t) {\n\n\t\t\tif (wpmConsentValues.mode === \"category\" && $(node).data(\"wpm-cookie-category\").split(\",\").some(element => wpmConsentValues.categories[element])) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && $(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data(\"wpm-pixel-name\") === \"google\") {\n\t\t\t\treturn true\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\n\n\twpm.unblockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tlet wpmSrc = $(scriptNode).data(\"wpm-src\")\n\t\tif (wpmSrc) $(scriptNode).attr(\"src\", wpmSrc)\n\n\t\tscriptNode.type = \"text/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.blockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tif ($(scriptNode).attr(\"src\")) $(scriptNode).removeAttr(\"src\")\n\t\tscriptNode.type = \"blocked/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\t}\n\n\twpm.unblockAllScripts = function (analytics = true, ads = true) {\n\t\t// console.log('unblocking all scripts')\n\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, scriptNode) {\n\n\t\t\t\tif ($(scriptNode).data(\"wpm-cookie-category\").includes(\"analytics\") && analytics) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t} else if ($(scriptNode).data(\"wpm-cookie-category\").includes(\"ads\") && ads) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.unblockSelectedPixels = function () {\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, node) {\n\n\t\t\t\tif (wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t} else if ($(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\n\t/**\n\t * Block or unblock scripts for each CMP immediately after cookie consent has been updated\n\t * by the visitor.\n\t */\n\n\t// Borlabs Cookie\n\t// If visitor accepts cookies in Borlabs Cookie unblock the scripts\n\twindow.addEventListener(\"borlabs-cookie-consent-saved\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\tif (wpmConsentValues.mode === \"pixel\") {\n\n\t\t\twpm.unblockSelectedPixels()\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.pixels.includes(\"google-analytics\"), wpmConsentValues.pixels.includes(\"google-ads\"))\n\t\t} else {\n\n\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t}\n\t})\n\n\t// Cookiebot\n\t// If visitor accepts cookies in Cookiebot unblock the scripts\n\t// https://www.cookiebot.com/en/developer/\n\twindow.addEventListener(\"CookiebotOnAccept\", function () {\n\t\tif (Cookiebot.consent.statistics) wpmConsentValues.categories.analytics = true\n\t\tif (Cookiebot.consent.marketing) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\n\t}, false)\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/article/20-custom-events\n\t */\n\twindow.addEventListener(\"CookieScriptAccept\", function (e) {\n\t\tif (e.detail.categories.includes(\"performance\")) wpmConsentValues.categories.analytics = true\n\t\tif (e.detail.categories.includes(\"targeting\")) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/\n\t */\n\twindow.addEventListener(\"CookieScriptAcceptAll\", function () {\n\t\twpm.unblockAllScripts(true, true)\n\t\twpm.updateGoogleConsentMode(true, true)\n\t})\n\n\t// Complianz Cookie\n\t// If visitor accepts cookies in Complianz unblock the scripts\n\tdocument.addEventListener(\"cmplzStatusChange\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t// Cookie Compliance by hu-manity.co (free and pro)\n\t// If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)\n\t// https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\tdocument.addEventListener(\"setCookieNotice\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\t// console.log(wpmConsentValues)\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Compliance by hu-manity.co (free and pro)\n\t * If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)\n\t * https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\t * Because Cookie Notice has no documented API or event that is being triggered on consent save or update\n\t * we have to solve this by using a mutation observer.\n\t *\n\t * @type {MutationObserver}\n\t */\n\n\twpm.huObserver = new MutationObserver(function (mutations) {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif (node.id === \"hu\") {\n\n\t\t\t\t\t\tjQuery(\".hu-cookies-save\").on(\"click\", function () {\n\t\t\t\t\t\t\twpm.updateConsentCookieValues()\n\t\t\t\t\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\tif (window.hu) {\n\t\twpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true})\n\t}\n\n\twpm.version = function () {\n\t\tconsole.log(wpmDataLayer.version)\n\t}\n\n\t// https://api.jquery.com/jquery.getscript/\n\twpm.loadScriptAndCacheIt = function (url, options) {\n\n\t\t// Allow user to set any option except for dataType, cache, and url\n\t\toptions = jQuery.extend(options || {}, {\n\t\t\tdataType: \"script\",\n\t\t\tcache : true,\n\t\t\turl : url,\n\t\t})\n\n\t\t// Use $.ajax() since it is more flexible than $.getScript\n\t\t// Return the jqXHR object so we can chain callbacks\n\t\treturn jQuery.ajax(options)\n\t}\n\n\twpm.getOrderItemPrice = function (orderItem) {\n\t\treturn (orderItem.total + orderItem.total_tax) / orderItem.quantity\n\t}\n\n\twpm.hasLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\treturn data?.loginEventFired\n\t}\n\n\twpm.setLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\tdata[\"loginEventFired\"] = true\n\t\twpm.setWpmSessionData(data)\n\t}\n\n\twpm.wpmDataLayerExists = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (typeof wpmDataLayer !== \"undefined\") return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.jQueryExists = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForjQuery() {\n\t\t\t\tif (typeof jQuery !== \"undefined\") return resolve()\n\t\t\t\tsetTimeout(waitForjQuery, 100)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.pageLoaded = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.pageReady = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"interactive\" === document.readyState || \"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.isMiniCartActive = function () {\n\t\tif (window.sessionStorage) {\n\t\t\tfor (const [key, value] of Object.entries(window.sessionStorage)) {\n\t\t\t\tif (key.includes(\"wc_fragments\")) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.doesWooCommerceCartExist = function () {\n\t\treturn document.cookie.includes(\"woocommerce_items_in_cart\")\n\t}\n\n\twpm.urlHasParameter = function (parameter) {\n\t\tlet urlParams = new URLSearchParams(window.location.search)\n\t\treturn urlParams.has(parameter)\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Load all WPM functions\n *\n * Ignore event listeners. They need to be loaded after\n * we made sure that jQuery has been loaded.\n */\n\nrequire(\"./functions\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// #endif\n","/**\n * After wpm is loaded\n * we first check if wpmDataLayer is loaded,\n * and as soon as it is, we load the pixels,\n * and as soon as the page load is complete,\n * we fire the wpmLoad event.\n *\n * @param {{pro:bool}} wpmDataLayer.version\n *\n * https://stackoverflow.com/a/25868457/4688612\n * https://stackoverflow.com/a/44093516/4688612\n */\n\nwpm.wpmDataLayerExists()\n\t.then(function () {\n\t\tconsole.log(\"WooCommerce Pixel Manager: \" + (wpmDataLayer.version.pro ? \"Pro\" : \"Free\") +\" Version \" + wpmDataLayer.version.number + \" loaded\")\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t})\n\t.then(function () {\n\t\twpm.pageLoaded().then(function () {\n\t\t\tjQuery(document).trigger(\"wpmLoad\", {})\n\t\t})\n\t})\n\n\n\n/**\n * Run when page is ready\n *\n */\n\nwpm.pageReady().then(function () {\n\n\t/**\n\t * Run as soon as wpm namespace is loaded\n\t */\n\n\twpm.wpmDataLayerExists()\n\t\t.then(function () {\n\t\t\t// watch for products visible in viewport\n\t\t\twpm.startIntersectionObserverToWatch()\n\n\t\t\t// watch for lazy loaded products\n\t\t\twpm.startProductsMutationObserverToWatch()\n\t\t})\n})\n\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/**\n * Load all essential scripts first\n */\n\nrequire(\"./wpm/functions_loader\")\n\n// Only load the event listeners after jQuery has been loaded for sure\nwpm.jQueryExists().then(function () {\n\n\trequire(\"./wpm/event_listeners\")\n\n\trequire(\"./google/loader\")\n\trequire(\"./facebook/loader\")\n\trequire(\"./hotjar/loader\")\n\n\n\t/**\n\t * Load all premium scripts\n\t */\n\n\t// #if process.env.TIER === 'premium'\n// \trequire(\"./microsoft-ads/loader\")\n// \trequire(\"./pinterest/loader\")\n// \trequire(\"./snapchat/loader\")\n// \trequire(\"./tiktok/loader\")\n// \trequire(\"./twitter/loader\")\n\t// #endif\n\n\n\t/**\n\t * Initiate WPM.\n\t *\n\t * It makes sure that the script flow gets executed correctly,\n\t * no matter how JS \"optimizers\" shuffle the code.\n\t */\n\n\trequire(\"./wpm/init\")\n})\n\n"],"names":["jQuery","document","on","wpmDataLayer","pixels","facebook","pixel_id","loaded","wpm","canIFire","loadFacebookPixel","event","product","eventId","getRandomEventId","fbq","content_type","content_name","name","content_ids","dyn_r_ids","dynamic_remarketing","id_type","value","parseFloat","quantity","price","currency","eventID","shop","trigger","event_name","event_id","user_data","getFbUserData","product_data","product_id","event_source_url","window","location","href","e","console","error","fbViewContent","setFbUserData","order","value_filtered","facebookContentIds","id","$","undefined","fBUserData","f","b","n","callMethod","apply","arguments","queue","push","_fbq","version","t","createElement","async","src","s","getElementsByTagName","parentNode","insertBefore","Math","random","toString","substring","getFbUserDataFromBrowser","fbp","getCookie","fbc","client_user_agent","navigator","userAgent","prodIds","key","item","Object","entries","items","general","variationsOutput","variation_id","String","products","require","isEmptyObject","google","ads","conversionIds","status","googleConfigConditionsMet","isVariable","send_events_with_parent_ids","gtagLoaded","then","gtag","send_to","getGoogleAdsConversionIdentifiers","google_business_vertical","getGoogleAdsDynamicRemarketingOrderItems","data_basic","data_with_cart","getGoogleAdsConversionIdentifiersWithLabel","transaction_id","number","new_customer","aw_merchant_id","discount","aw_feed_country","aw_feed_language","getGoogleAdsRegularOrderItems","conversionIdentifiers","orderItems","orderItem","analytics","universal","property_id","mp_active","affiliation","value_regular","tax","shipping","coupon","getGAUAOrderItems","category","join","variant","variant_name","brand","ga3AddListNameToProduct","item_data","productPosition","list_name","list_position","ga4","measurement_id","getGA4OrderItems","item_name","item_category","item_id","item_variant","item_brand","state","canGoogleLoad","loadGoogle","logPreventedPixelLoading","type","consent_mode","active","getConsentValues","mode","categories","includes","getVisitorConsentStatusAndUpdateGoogleConsentSettings","google_consent_settings","analytics_storage","ad_storage","updateGoogleConsentMode","cookie_consent_mgmt","explicit_consent","fireGtagGoogleAds","enhanced_conversions","phone_conversion_label","phone_conversion_number","keys","page_type","enhanced_conversion_data","fireGtagGoogleAnalyticsUA","parameters","fireGtagGoogleAnalyticsGA4","isGoogleActive","getGoogleGtagId","loadScriptAndCacheIt","done","script","textStatus","dataLayer","wait_for_update","region","ads_data_redaction","url_passthrough","linker","settings","Date","Promise","resolve","reject","startTime","wait","setTimeout","optimize","container_id","load_google_optimize_pixel","hotjar","site_id","load_hotjar_pixel","h","o","hj","q","_hjSettings","hjid","hjsv","a","r","appendChild","url","URL","this","attr","productId","getProductIdByCartItemKeyUrl","removeProductFromCart","data","addProductToCart","product_type","Number","val","each","find","classes","getPostIdFromString","one","target","closest","matches","match","nextAll","getIdBasedOndVariationsOutputSetting","Error","getProductDetailsFormattedForEvent","isEmail","fireCheckoutProgress","emailSelected","paymentMethodSelected","fireCheckoutOption","cart","getCartItemsFromBackend","variation","doesWooCommerceCartExist","getCartItems","productIds","getAddToCartLinkProductIds","getProductsFromBackend","referrer","referrerHostname","hostname","host","setCookie","wpmLoadFired","getMainProductIdFromProductPage","getProductDataForViewItemEvent","isOrderIdStored","writeOrderIdToStorage","user","hasLoginEventFired","setLoginEventFired","updateConsentCookieValues","wpmDeduper","wpmRestSettings","checkCookie","useRestEndpoint","isSessionStorageAvailable","isRestEndpointAvailable","isBelowRestErrorThreshold","sessionStorage","getItem","JSON","parse","testEndpoint","protocol","cookieName","ajax","timeout","statusCode","response","setItem","stringify","isWpmRestEndpointAvailable","orderId","Storage","localStorage","ids","expiresDate","setDate","getDate","cookie","toUTCString","storeOrderIdOnServer","orderDeduplication","log","email","test","quantityToRemove","isVariation","parentId","saveCartObjectToDataLayer","action","dataType","ajax_url","success","cartItems","filter","hasOwnProperty","length","assign","cartObject","step","checkout_option","string","triggerViewItemList","indexOf","viewItemListTriggerTestMode","css","append","viewItemListTrigger","opacity","backgroundColor","getSearchTermFromUrl","URLSearchParams","search","get","io","ioTimeouts","observerCallback","observer","forEach","entry","elementId","next","isIntersecting","testMode","repeat","unobserve","clearTimeout","remove","allIoElementsToWatch","ioid","startIntersectionObserverToWatch","urlHasParameter","IntersectionObserver","threshold","map","i","elem","parent","hasClass","prev","observe","startProductsMutationObserverToWatch","productsNode","parents","has","first","productsMutationObserver","attributes","childList","characterData","MutationObserver","mutations","mutation","newNodes","addedNodes","hasWpmProductIdElement","siblings","cookieValue","expiryDays","d","setTime","getTime","expires","ca","decodeURIComponent","split","c","charAt","getWpmSessionData","setWpmSessionData","order_id","nonce","cartItemKey","cartItemKeys","position","parentId_dyn_r_ids","setReferrerToCookie","getReferrerFromCookie","getClidFromBrowser","clidCookieId","clidId","gclid","dclid","getUserAgent","getViewPort","width","max","documentElement","clientWidth","innerWidth","height","clientHeight","innerHeight","getComplianzCookies","cmplz_statistics","cmplz_marketing","visitorHasChosen","getCookieLawInfoCookies","analyticsCookie","adsCookie","wpmConsentValues","setConsentValueCategories","explicitConsent","decodeURI","consents","statistics","marketing","thirdparty","advanced","setConsentDefaultValuesToExplicit","pixelName","canIFireMode","scriptTagObserver","node","shouldScriptBeActive","unblockScript","blockScript","head","subtree","addEventListener","disconnect","some","element","scriptNode","removeAttach","wpmSrc","appendTo","removeAttr","unblockAllScripts","index","unblockSelectedPixels","Cookiebot","consent","detail","huObserver","hu","body","options","extend","cache","getOrderItemPrice","total","total_tax","loginEventFired","wpmDataLayerExists","waitForVar","jQueryExists","waitForjQuery","pageLoaded","readyState","pageReady","isMiniCartActive","parameter","pro","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__"],"sourceRoot":""}
|
1 |
+
{"version":3,"file":"wpm-public.p1.min.js","mappings":"sBAKAA,OAAOC,UAAUC,GAAG,iBAAiB,WAAY,gBAEhC,QAAZ,EAAAC,oBAAA,mBAAcC,cAAd,mBAAsBC,gBAAtB,UAAgCC,UAAY,UAACH,oBAAD,iBAAC,EAAcC,cAAf,iBAAC,EAAsBC,gBAAvB,OAAC,EAAgCE,QAC5EC,IAAIC,SAAS,MAAO,iBAAiBD,IAAIE,uBAK/CV,OAAOC,UAAUC,GAAG,gBAAgB,SAAUS,EAAOC,GAEpD,IAAI,UACH,GAAI,UAACT,oBAAD,iBAAC,EAAcC,cAAf,iBAAC,EAAsBC,gBAAvB,QAAC,EAAgCE,OAAQ,OAE7C,IAAIM,EAAUL,IAAIM,mBAElBC,IAAI,QAAS,YAAa,CACzBC,aAAc,UACdC,aAAcL,EAAQM,KACtBC,YAAcP,EAAQQ,UAAUjB,aAAaC,OAAOC,SAASgB,oBAAoBC,SACjFC,MAAcC,WAAWZ,EAAQa,SAAWb,EAAQc,OACpDC,SAAcf,EAAQe,UACpB,CACFC,QAASf,IAGVD,EAAO,SAAeT,aAAa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OAAOC,UAAU6B,QAAQ,UAAW,UAWvCtB,IAAI2c,YAAY5W,MAAK,WAMpB/F,IAAIqc,qBACFtW,MAAK,WAEL/F,IAAImV,mCAGJnV,IAAI8V,+CC1CHiH,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBta,IAAjBua,EACH,OAAOA,EAAaC,QAGrB,IAAIC,EAASL,EAAyBE,GAAY,CAGjDE,QAAS,IAOV,OAHAE,EAAoBJ,GAAUG,EAAQA,EAAOD,QAASH,GAG/CI,EAAOD,QCjBf9X,EAAQ,KAGRrF,IAAIuc,eAAexW,MAAK,WAEvBV,EAAQ,KAERA,EAAQ,IACRA,EAAQ,IACRA,EAAQ,KAuBRA,EAAQ,S","sources":["webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/facebook/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/ads/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/ads/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/ads/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga3/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga3/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga3/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga4/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga4/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/ga4/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/analytics/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/base/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/base/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/base/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/optimize/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/optimize/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/google/optimize/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/hotjar/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/hotjar/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/hotjar/loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/event_listeners.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/functions.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/functions_loader.js","webpack://WooCommerce-Pixel-Manager/./src/js/public/wpm/init.js","webpack://WooCommerce-Pixel-Manager/webpack/bootstrap","webpack://WooCommerce-Pixel-Manager/./src/js/public/main.js"],"sourcesContent":["/**\n * All event listeners\n * */\n\n// Load pixel event\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.facebook?.pixel_id && !wpmDataLayer?.pixels?.facebook?.loaded) {\n\t\tif (wpm.canIFire(\"ads\", \"facebook-ads\")) wpm.loadFacebookPixel()\n\t}\n})\n\n// AddToCart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"AddToCart\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToCart\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// InitiateCheckout event\njQuery(document).on(\"wpmBeginCheckout\", function (event) {\n\n\ttry {\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"InitiateCheckout\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"InitiateCheckout\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// AddToWishlist event\njQuery(document).on(\"wpmAddToWishlist\", function (event, product) {\n\n\ttry {\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"AddToWishlist\", {\n\t\t\tcontent_type: \"product\",\n\t\t\tcontent_name: product.name,\n\t\t\tcontent_ids : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tvalue : parseFloat(product.quantity * product.price),\n\t\t\tcurrency : product.currency,\n\t\t}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"AddToWishlist\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tproduct_data : product,\n\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// ViewContent event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.fbViewContent(product)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tlet eventId = wpm.getRandomEventId()\n\n\t\tfbq(\"track\", \"Search\", {}, {\n\t\t\teventID: eventId,\n\t\t})\n\n\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\tevent_name : \"Search\",\n\t\t\tevent_id : eventId,\n\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\tevent_source_url: window.location.href,\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// load always event\njQuery(document).on(\"wpmLoadAlways\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\twpm.setFbUserData()\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// https://developers.pinterest.com/docs/tag/conversion/\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\n\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\tfbq(\"track\", \"Purchase\",\n\t\t\t{\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tcontent_ids : wpm.facebookContentIds(),\n\t\t\t},\n\t\t\t{eventID: wpmDataLayer.order.id},\n\t\t)\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Facebook\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet fBUserData\n\n\twpm.loadFacebookPixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.facebook.loaded = true\n\n\t\t\t// @formatter:off\n\t\t\t!function(f,b,e,v,n,t,s)\n\t\t\t{if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n\t\t\t\tn.callMethod.apply(n,arguments):n.queue.push(arguments)};\n\t\t\t\tif(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n\t\t\t\tn.queue=[];t=b.createElement(e);t.async=!0;\n\t\t\t\tt.src=v;s=b.getElementsByTagName(e)[0];\n\t\t\t\ts.parentNode.insertBefore(t,s)}(window, document,'script',\n\t\t\t\t'https://connect.facebook.net/en_US/fbevents.js');\n\t\t\t// @formatter:on\n\n\t\t\tfbq(\"init\", wpmDataLayer.pixels.facebook.pixel_id)\n\t\t\tfbq(\"track\", \"PageView\")\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getRandomEventId = function () {\n\t\treturn (Math.random() + 1).toString(36).substring(2)\n\t}\n\n\twpm.getFbUserData = function () {\n\n\t\t/**\n\t\t * We need the first one for InitiateCheckout\n\t\t * where getting the user_data from the browser is too slow\n\t\t * using wpm.getCookie(), so we cache the user_data earlier.\n\t\t * And we need the second one because the ViewContent hit happens too fast\n\t\t * after adding a variation to the cart because the function to cache\n\t\t * the user_data is too slow. But we can get the user_data using wpm.getCookie()\n\t\t * because we don't move away from the page and can wait for the browser\n\t\t * to get it.\n\t\t */\n\n\t\tif (fBUserData) {\n\t\t\treturn fBUserData\n\t\t} else {\n\t\t\treturn wpm.getFbUserDataFromBrowser()\n\t\t}\n\t}\n\n\twpm.setFbUserData = function () {\n\t\tfBUserData = wpm.getFbUserDataFromBrowser()\n\t}\n\n\twpm.getFbUserDataFromBrowser = function () {\n\t\treturn {\n\t\t\tfbp : wpm.getCookie(\"_fbp\"),\n\t\t\tfbc : wpm.getCookie(\"_fbc\"),\n\t\t\tclient_user_agent: navigator.userAgent,\n\t\t}\n\t}\n\n\twpm.fbViewContent = function (product) {\n\n\t\ttry {\n\t\t\tif (!wpmDataLayer?.pixels?.facebook?.loaded) return\n\n\t\t\tlet eventId = wpm.getRandomEventId()\n\n\t\t\tfbq(\"track\", \"ViewContent\", {\n\t\t\t\tcontent_type: \"product\",\n\t\t\t\tcontent_name: product.name,\n\t\t\t\t// content_category: product.category,\n\t\t\t\tcontent_ids: product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\t\tvalue : product.price,\n\t\t\t}, {\n\t\t\t\teventID: eventId,\n\t\t\t})\n\n\t\t\tproduct[\"currency\"] = wpmDataLayer.shop.currency\n\n\t\t\tjQuery(document).trigger(\"wpmFbCapiEvent\", {\n\t\t\t\tevent_name : \"ViewContent\",\n\t\t\t\tevent_id : eventId,\n\t\t\t\tuser_data : wpm.getFbUserData(),\n\t\t\t\tproduct_data : product,\n\t\t\t\tproduct_id : product.dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type],\n\t\t\t\tevent_source_url: window.location.href,\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.facebookContentIds = function () {\n\t\tlet prodIds = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t} else {\n\t\t\t\tprodIds.push(String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.facebook.dynamic_remarketing.id_type]))\n\t\t\t}\n\t\t}\n\n\t\treturn prodIds\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Facebook loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n\n","/**\n * Load Google Ads event listeners\n * */\n\n// view_item_list event\njQuery(document).on(\"wpmViewItemList\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tif (\n\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\tproduct.isVariable &&\n\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t) return\n\n\t\t// try to prevent that WC sends cached hits to Google\n\t\tif (!product) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_item_list\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\titems : [{\n\t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t\t}],\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// add_to_cart event\njQuery(document).on(\"wpmAddToCart\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"add_to_cart\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\tvalue : product.quantity * product.price,\n\t\t\t\titems : [{\n\t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\tquantity : product.quantity,\n\t\t\t\t\tprice : product.price,\n\t\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t\t}],\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view_item event\njQuery(document).on(\"wpmViewItem\", function (event, product) {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_item\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\tvalue : (product.quantity ? product.quantity : 1) * product.price,\n\t\t\t\titems : [{\n\t\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\t\tquantity : (product.quantity ? product.quantity : 1),\n\t\t\t\t\tprice : product.price,\n\t\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t\t}],\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view search event\njQuery(document).on(\"wpmSearch\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\tlet products = []\n\n\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\n\t\t\tif (\n\t\t\t\twpmDataLayer?.general?.variationsOutput &&\n\t\t\t\tproduct.isVariable &&\n\t\t\t\twpmDataLayer.pixels.google.ads.dynamic_remarketing.send_events_with_parent_ids === false\n\t\t\t) return\n\n\t\t\tproducts.push({\n\t\t\t\tid : product.dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type],\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t})\n\t\t}\n\n\t\t// console.log(products);\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"view_search_results\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\t// value : 1 * product.price,\n\t\t\t\titems: products,\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// view order received page event\n// TODO distinguish with or without cart data active\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\t\titems : wpm.getGoogleAdsDynamicRemarketingOrderItems(),\n\t\t\t})\n\t\t})\n\n\t\t// console.log(wpm.getGoogleAdsDynamicRemarketingOrderItems())\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// user log in event\njQuery(document).on(\"wpmLogin\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpmDataLayer?.pixels?.google?.ads?.dynamic_remarketing?.status) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"login\", {\n\t\t\t\tsend_to: wpm.getGoogleAdsConversionIdentifiers(),\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// view order received page event\n// new_customer parameter: https://support.google.com/google-ads/answer/9917012\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif(jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) return\n\t\tif (!wpm.googleConfigConditionsMet(\"ads\")) return\n\n\t\tlet data_basic = {}\n\t\tlet data_with_cart = {}\n\n\t\tdata_basic = {\n\t\t\tsend_to : wpm.getGoogleAdsConversionIdentifiersWithLabel(),\n\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\tvalue : wpmDataLayer.order.value_filtered,\n\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\tnew_customer : wpmDataLayer.order.new_customer,\n\t\t}\n\n\t\tif (wpmDataLayer?.order?.aw_merchant_id) {\n\t\t\tdata_with_cart = {\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\taw_merchant_id : wpmDataLayer.order.aw_merchant_id,\n\t\t\t\taw_feed_country : wpmDataLayer.order.aw_feed_country,\n\t\t\t\taw_feed_language: wpmDataLayer.order.aw_feed_language,\n\t\t\t\titems : wpm.getGoogleAdsRegularOrderItems(),\n\t\t\t}\n\t\t}\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"conversion\", {...data_basic, ...data_with_cart})\n\t\t})\n\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n\n\n\n","/**\n * Load Google Ads functions\n * */\n\n(function (wpm, $, undefined) {\n\n\tlet conversionIdentifiers = []\n\n\twpm.getGoogleAdsConversionIdentifiersWithLabel = function () {\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key + \"/\" + item)\n\t\t}\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsConversionIdentifiers = function () {\n\n\t\tlet conversionIdentifiers = []\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\tconversionIdentifiers.push(key)\n\t\t}\n\n\t\treturn conversionIdentifiers\n\t}\n\n\twpm.getGoogleAdsRegularOrderItems = function () {\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\twpm.getGoogleAdsDynamicRemarketingOrderItems = function () {\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tgoogle_business_vertical: wpmDataLayer.pixels.google.ads.google_business_vertical,\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.ads.dynamic_remarketing.id_type])\n\t\t\t\torderItems.push(orderItem)\n\t\t\t}\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Load Google Ads\n */\n\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Load Google Universal Analytics (GA3) event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.universal.property_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGAUAOrderItems(),\n\t\t\t})\n\t\t})\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Add functions for Google Analytics Universal\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGAUAOrderItems = function () {\n\n\t\t// \"id\" : \"34\",\n\t\t// \"name\" : \"Hoodie\",\n\t\t// \"brand\" : \"\",\n\t\t// \"category\" : \"Hoodies\",\n\t\t// \"list_position\": 1,\n\t\t// \"price\" : 45,\n\t\t// \"quantity\" : 1,\n\t\t// \"variant\" : \"Color: blue | Logo: yes\"\n\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity: item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\tname : item.name,\n\t\t\t\tcurrency: wpmDataLayer.order.currency,\n\t\t\t\tcategory: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItem = wpm.ga3AddListNameToProduct(orderItem)\n\n\t\t\torderItems.push(orderItem)\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n\twpm.ga3AddListNameToProduct = function (item_data, productPosition = null) {\n\n\t\t// if (wpm.ga3CanProductListBeSet(item_data.id)) {\n\t\t// \titem_data.listname = wpmDataLayer.shop.list_name\n\t\t//\n\t\t// \tif (productPosition) {\n\t\t// \t\titem_data.list_position = productPosition\n\t\t// \t}\n\t\t// }\n\n\t\titem_data.list_name = wpmDataLayer.shop.list_name\n\n\t\tif (productPosition) {\n\t\t\titem_data.list_position = productPosition\n\t\t}\n\n\t\treturn item_data\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Google Universal Analytics (GA3) loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Load GA4 event listeners\n * */\n\n\n// view order received page event\njQuery(document).on(\"wpmOrderReceivedPage\", function () {\n\n\ttry {\n\t\tif (!wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) return\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.mp_active) return\n\t\tif (!wpm.googleConfigConditionsMet(\"analytics\")) return\n\n\t\twpm.gtagLoaded().then(function () {\n\t\t\tgtag(\"event\", \"purchase\", {\n\t\t\t\tsend_to : [wpmDataLayer.pixels.google.analytics.ga4.measurement_id],\n\t\t\t\ttransaction_id: wpmDataLayer.order.number,\n\t\t\t\taffiliation : wpmDataLayer.order.affiliation,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\tvalue : wpmDataLayer.order.value_regular,\n\t\t\t\tdiscount : wpmDataLayer.order.discount,\n\t\t\t\ttax : wpmDataLayer.order.tax,\n\t\t\t\tshipping : wpmDataLayer.order.shipping,\n\t\t\t\tcoupon : wpmDataLayer.order.coupon,\n\t\t\t\titems : wpm.getGA4OrderItems(),\n\t\t\t})\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n","/**\n * Load GA4 functions\n * */\n\n(function (wpm, $, undefined) {\n\n\twpm.getGA4OrderItems = function () {\n\n\t\t// \"item_id\" : \"34\",\n\t\t// \"item_name\" : \"Hoodie\",\n\t\t// \"quantity\" : 1,\n\t\t// \"item_brand\" : \"\",\n\t\t// \"item_variant\" : \"Color: blue | Logo: yes\",\n\t\t// \"price\" : 45,\n\t\t// \"currency\" : \"CHF\",\n\t\t// \"item_category\": \"Hoodies\"\n\n\n\t\tlet orderItems = []\n\n\t\tfor (const [key, item] of Object.entries(wpmDataLayer.order.items)) {\n\n\t\t\tlet orderItem\n\n\t\t\torderItem = {\n\t\t\t\tquantity : item.quantity,\n\t\t\t\tprice : item.price,\n\t\t\t\titem_name : item.name,\n\t\t\t\tcurrency : wpmDataLayer.order.currency,\n\t\t\t\titem_category: wpmDataLayer.products[item.id].category.join(\"/\"),\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.general?.variationsOutput && 0 !== item.variation_id) {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.variation_id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_variant = wpmDataLayer.products[item.variation_id].variant_name\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.variation_id].brand\n\t\t\t} else {\n\n\t\t\t\torderItem.item_id = String(wpmDataLayer.products[item.id].dyn_r_ids[wpmDataLayer.pixels.google.analytics.id_type])\n\t\t\t\torderItem.item_brand = wpmDataLayer.products[item.id].brand\n\t\t\t}\n\n\t\t\torderItems.push(orderItem)\n\t\t}\n\n\t\treturn orderItems\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * GA4 loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Google Analytics loader\n */\n\nrequire(\"./ga3/loader\")\nrequire(\"./ga4/loader\")\n","/**\n * Load Google base event listeners\n */\n\n// Pixel load event listener\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") {\n\t\tif (wpm.canGoogleLoad()) {\n\t\t\twpm.loadGoogle()\n\t\t} else {\n\t\t\twpm.logPreventedPixelLoading(\"google\", \"analytics / ads\")\n\t\t}\n\t}\n})\n","/**\n * Load Google base functions\n */\n\n(function (wpm, $, undefined) {\n\n\twpm.googleConfigConditionsMet = function (type) {\n\n\t\t// always returns true if Google Consent Mode is active\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (wpm.getConsentValues().mode === \"category\") {\n\t\t\treturn wpm.getConsentValues().categories[type] === true\n\t\t} else if (wpm.getConsentValues().mode === \"pixel\") {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-\" + type)\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings = function (google_consent_settings) {\n\n\t\tif (wpm.getConsentValues().mode === \"category\") {\n\n\t\t\tif (wpm.getConsentValues().categories.analytics) google_consent_settings.analytics_storage = \"granted\"\n\t\t\tif (wpm.getConsentValues().categories.ads) google_consent_settings.ad_storage = \"granted\"\n\t\t} else if ((wpm.getConsentValues().mode === \"pixel\")) {\n\n\t\t\tgoogle_consent_settings.analytics_storage = wpm.getConsentValues().pixels.includes(\"google-analytics\") ? \"granted\" : \"denied\"\n\t\t\tgoogle_consent_settings.ad_storage = wpm.getConsentValues().pixels.includes(\"google-ads\") ? \"granted\" : \"denied\"\n\t\t}\n\n\t\treturn google_consent_settings\n\t}\n\n\twpm.updateGoogleConsentMode = function (analytics = true, ads = true) {\n\n\t\ttry {\n\t\t\tif (\n\t\t\t\t!window.gtag ||\n\t\t\t\t!wpmDataLayer.shop.cookie_consent_mgmt.explicit_consent\n\t\t\t) return\n\n\t\t\tgtag(\"consent\", \"update\", {\n\t\t\t\tanalytics_storage: analytics ? \"granted\" : \"denied\",\n\t\t\t\tad_storage : ads ? \"granted\" : \"denied\",\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAds = function () {\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.ads.state = \"loading\"\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.enhanced_conversions?.active) {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key, {\"allow_enhanced_conversions\": true})\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const [key, item] of Object.entries(wpmDataLayer.pixels.google.ads.conversionIds)) {\n\t\t\t\t\tgtag(\"config\", key)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.pixels?.google?.ads?.conversionIds && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_label && wpmDataLayer?.pixels?.google?.ads?.phone_conversion_number) {\n\t\t\t\tgtag(\"config\", Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0] + \"/\" + wpmDataLayer.pixels.google.ads.phone_conversion_label, {\n\t\t\t\t\tphone_conversion_number: wpmDataLayer.pixels.google.ads.phone_conversion_number,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\t// ! enhanced_conversion_data needs to set on the window object\n\t\t\t// https://support.google.com/google-ads/answer/9888145#zippy=%2Cvalidate-your-implementation-using-chrome-developer-tools\n\t\t\tif (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer?.order?.google?.ads?.enhanced_conversion_data) {\n\t\t\t\twindow.enhanced_conversion_data = wpmDataLayer.order.google.ads.enhanced_conversion_data\n\t\t\t}\n\n\t\t\twpmDataLayer.pixels.google.ads.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsUA = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.universal.property_id, wpmDataLayer.pixels.google.analytics.universal.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.universal.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.fireGtagGoogleAnalyticsGA4 = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"loading\"\n\n\t\t\tgtag(\"config\", wpmDataLayer.pixels.google.analytics.ga4.measurement_id, wpmDataLayer.pixels.google.analytics.ga4.parameters)\n\t\t\twpmDataLayer.pixels.google.analytics.ga4.state = \"ready\"\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.isGoogleActive = function () {\n\n\t\tif (\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.universal?.property_id ||\n\t\t\twpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id ||\n\t\t\t!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)\n\t\t) {\n\t\t\treturn true\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.getGoogleGtagId = function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.universal.property_id\n\t\t} else if (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) {\n\t\t\treturn wpmDataLayer.pixels.google.analytics.ga4.measurement_id\n\t\t} else {\n\t\t\treturn Object.keys(wpmDataLayer.pixels.google.ads.conversionIds)[0]\n\t\t}\n\t}\n\n\twpm.loadGoogle = function () {\n\n\t\tif (wpm.isGoogleActive()) {\n\n\t\t\twpmDataLayer.pixels.google.state = \"loading\"\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googletagmanager.com/gtag/js?id=\" + wpm.getGoogleGtagId())\n\t\t\t\t.done(function (script, textStatus) {\n\n\t\t\t\t\ttry {\n\n\t\t\t\t\t\t// Initiate Google dataLayer and gtag\n\t\t\t\t\t\twindow.dataLayer = window.dataLayer || []\n\t\t\t\t\t\twindow.gtag = function gtag() {\n\t\t\t\t\t\t\tdataLayer.push(arguments)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Consent Mode\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\n\t\t\t\t\t\t\tlet google_consent_settings = {\n\t\t\t\t\t\t\t\t\"ad_storage\" : wpmDataLayer.pixels.google.consent_mode.ad_storage,\n\t\t\t\t\t\t\t\t\"analytics_storage\": wpmDataLayer.pixels.google.consent_mode.analytics_storage,\n\t\t\t\t\t\t\t\t\"wait_for_update\" : wpmDataLayer.pixels.google.consent_mode.wait_for_update,\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.region) {\n\t\t\t\t\t\t\t\tgoogle_consent_settings.region = wpmDataLayer.pixels.google.consent_mode.region\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tgoogle_consent_settings = wpm.getVisitorConsentStatusAndUpdateGoogleConsentSettings(google_consent_settings)\n\n\t\t\t\t\t\t\tgtag(\"consent\", \"default\", google_consent_settings)\n\t\t\t\t\t\t\tgtag(\"set\", \"ads_data_redaction\", wpmDataLayer.pixels.google.consent_mode.ads_data_redaction)\n\t\t\t\t\t\t\tgtag(\"set\", \"url_passthrough\", wpmDataLayer.pixels.google.consent_mode.url_passthrough)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Google Linker\n\t\t\t\t\t\t// https://developers.google.com/gtagjs/devguide/linker\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.linker?.settings) {\n\t\t\t\t\t\t\tgtag(\"set\", \"linker\", wpmDataLayer.pixels.google.linker.settings)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tgtag(\"js\", new Date())\n\n\t\t\t\t\t\t// Google Ads loader\n\t\t\t\t\t\tif (!jQuery.isEmptyObject(wpmDataLayer?.pixels?.google?.ads?.conversionIds)) { // Only run if the pixel has set up\n\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"ads\")) { \t\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAds()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-ads\", \"ads\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t// Google Universal Analytics loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.universal?.property_id) { \t\t// Only run if the pixel has set up\n\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsUA()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"google-universal-analytics\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// GA4 loader\n\t\t\t\t\t\tif (wpmDataLayer?.pixels?.google?.analytics?.ga4?.measurement_id) { \t\t\t// Only run if the pixel has set up\n\n\t\t\t\t\t\t\tif (wpm.googleConfigConditionsMet(\"analytics\")) {\t\t\t\t\t\t// Only run if cookie consent has been given\n\t\t\t\t\t\t\t\twpm.fireGtagGoogleAnalyticsGA4()\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\twpm.logPreventedPixelLoading(\"ga4\", \"analytics\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\twpmDataLayer.pixels.google.state = \"ready\"\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\tconsole.error(e)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t}\n\t}\n\n\twpm.canGoogleLoad = function () {\n\n\t\tif (wpmDataLayer?.pixels?.google?.consent_mode?.active) {\n\t\t\treturn true\n\t\t} else if (\"category\" === wpm.getConsentValues().mode) {\n\t\t\treturn !!(wpm.getConsentValues().categories[\"ads\"] || wpm.getConsentValues().categories[\"analytics\"])\n\t\t} else if (\"pixel\" === wpm.getConsentValues().mode) {\n\t\t\treturn wpm.getConsentValues().pixels.includes(\"google-ads\") || wpm.getConsentValues().pixels.includes(\"google-analytics\")\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid load condition for Google mode in wpmConsentValues\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.gtagLoaded = function () {\n\t\treturn new Promise(function (resolve, reject) {\n\n\t\t\tif (typeof wpmDataLayer?.pixels?.google?.state === \"undefined\") reject()\n\n\t\t\tlet startTime = 0\n\t\t\tlet timeout = 5000\n\t\t\tlet frequency = 200;\n\n\t\t\t(function wait() {\n\t\t\t\tif (wpmDataLayer?.pixels?.google?.state === \"ready\") return resolve()\n\t\t\t\tif (startTime >= timeout) return reject()\n\t\t\t\tstartTime += frequency\n\t\t\t\tsetTimeout(wait, frequency)\n\t\t\t})()\n\t\t})\n\t}\n\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Load Google base\n */\n\n// Load base\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// require(\"./event_listeners_premium\")\n// #endif\n","/**\n * Load Google\n */\n\n// Load base\nrequire(\"./base/loader\")\n\n//Load additional Google libraries\nrequire(\"./ads/loader\")\nrequire(\"./analytics/loader\")\nrequire(\"./optimize/loader\")\n\n\n","/**\n * Load Google Optimize event listeners\n */\n\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.google?.optimize?.container_id && !wpmDataLayer?.pixels?.google?.optimize?.loaded) {\n\t\tif (wpm.canIFire(\"analytics\", \"google-optimize\")) wpm.load_google_optimize_pixel()\n\t}\n})\n","/**\n * Load Google Optimize functions\n */\n\n\n(function (wpm, $, undefined) {\n\n\twpm.load_google_optimize_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.google.optimize.loaded = true\n\n\t\t\twpm.loadScriptAndCacheIt(\"https://www.googleoptimize.com/optimize.js?id=\" + wpmDataLayer.pixels.google.optimize.container_id)\n\t\t\t// .done(function (script, textStatus) {\n\t\t\t// \t\tconsole.log('Google Optimize loaded')\n\t\t\t// });\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Load Google Optimize\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Load Hotjar event listeners\n */\n\n// Pixel load event listener\njQuery(document).on(\"wpmLoadPixels\", function () {\n\n\tif (wpmDataLayer?.pixels?.hotjar?.site_id && !wpmDataLayer?.pixels?.hotjar?.loaded) {\n\t\tif (wpm.canIFire(\"analytics\", \"hotjar\") && !wpmDataLayer?.pixels?.hotjar?.loaded) wpm.load_hotjar_pixel()\n\t}\n})\n","/**\n * Load Hotjar functions\n */\n\n(function (wpm, $, undefined) {\n\n\twpm.load_hotjar_pixel = function () {\n\n\t\ttry {\n\t\t\twpmDataLayer.pixels.hotjar.loaded = true;\n\n\t\t\t// @formatter:off\n\t\t\t(function(h,o,t,j,a,r){\n\t\t\t\th.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};\n\t\t\t\th._hjSettings={hjid:wpmDataLayer.pixels.hotjar.site_id,hjsv:6};\n\t\t\t\ta=o.getElementsByTagName('head')[0];\n\t\t\t\tr=o.createElement('script');r.async=1;\n\t\t\t\tr.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;\n\t\t\t\ta.appendChild(r);\n\t\t\t})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');\n\t\t\t// @formatter:on\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery));\n","/**\n * Hotjar loader\n */\n\nrequire(\"./functions\")\nrequire(\"./event_listeners\")\n","/**\n * Register event listeners\n */\n\n// remove_from_cart event\n// jQuery('.remove_from_cart_button, .remove').on('click', function (e) {\njQuery(document).on(\"click\", \".remove_from_cart_button, .remove\", function () {\n\n\ttry {\n\n\t\tlet url = new URL(jQuery(this).attr(\"href\"))\n\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\t\twpm.removeProductFromCart(productId)\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n// add_to_cart event\n// jQuery('.add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .js-ajax-add-to-cart, .single_add_to_cart_button, .btn_color-2').on('click', function (e) {\njQuery(document).on(\"click\", \".add_to_cart_button:not(.product_type_variable), .ajax_add_to_cart, .single_add_to_cart_button\", function () {\n\n\ttry {\n\n\t\tif (wpmDataLayer.shop.page_type === \"product\") {\n\n\t\t\t// First process related and upsell products\n\t\t\tif (typeof jQuery(this).attr(\"href\") !== \"undefined\" && jQuery(this).attr(\"href\").includes(\"add-to-cart\")) {\n\n\t\t\t\tlet quantity = 1\n\t\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\n\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t} else {\n\n\t\t\t\tif (wpmDataLayer.shop.product_type === \"simple\") {\n\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(this).val()\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"variable\") {\n\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(\"[name='variation_id']\").val()\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"grouped\") {\n\n\t\t\t\t\tjQuery(\".woocommerce-grouped-product-list-item\").each(function () {\n\n\t\t\t\t\t\tlet quantity = Number(jQuery(this).find(\".input-text.qty\").val())\n\n\t\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\t\tlet classes = jQuery(this).attr(\"class\")\n\t\t\t\t\t\tlet productId = wpm.getPostIdFromString(classes)\n\n\t\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t\t})\n\t\t\t\t} else if (wpmDataLayer.shop.product_type === \"bundle\") {\n\n\t\t\t\t\tlet quantity = Number(jQuery(\".input-text.qty\").val())\n\n\t\t\t\t\tif (!quantity && quantity !== 0) quantity = 1\n\n\t\t\t\t\tlet productId = jQuery(\"input[name=add-to-cart]\").val()\n\n\t\t\t\t\twpm.addProductToCart(productId, quantity)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\n\t\t\tlet quantity = 1\n\t\t\tlet productId = jQuery(this).data(\"product_id\")\n\n\t\t\twpm.addProductToCart(productId, quantity)\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n\n/**\n * If someone clicks anywhere on a custom /?add-to-cart=123 link\n * trigger the add to cart event\n */\n// jQuery('a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)').one('click', function (event) {\njQuery(document).one(\"click\", \"a:not(.add_to_cart_button, .ajax_add_to_cart, .single_add_to_cart_button)\", function (event) {\n\n\ttry {\n\t\tif (jQuery(event.target).closest(\"a\").attr(\"href\")) {\n\n\t\t\tlet href = jQuery(event.target).closest(\"a\").attr(\"href\")\n\n\t\t\tif (href.includes(\"add-to-cart=\")) {\n\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\tif (matches) wpm.addProductToCart(matches[2], 1)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// select_content GA UA event\n// select_item GA 4 event\n// jQuery(document).on('click', '.woocommerce-LoopProduct-link, .wc-block-grid__product, .product-small.box', function (e) {\n// jQuery('.woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product').on('click', function (e) {\njQuery(document).on(\"click\", \".woocommerce-LoopProduct-link, .wc-block-grid__product, .product, .product-small, .type-product\", function () {\n\n\ttry {\n\n\t\t/**\n\t\t * On some pages the event fires multiple times, and on product pages\n\t\t * even on page load. Using e.stopPropagation helps to prevent this,\n\t\t * but I don't know why. We don't even have to use this, since only a real\n\t\t * product click yields a valid productId. So we filter the invalid click\n\t\t * events out later down in the code. I'll keep it that way because this is\n\t\t * the most compatible way across shops.\n\t\t *\n\t\t * e.stopPropagation();\n\t\t * */\n\n\t\tlet productId = jQuery(this).nextAll(\".wpmProductId:first\").data(\"id\")\n\n\t\t/**\n\t\t * On product pages, for some reason, the click event is triggered on the main product on page load.\n\t\t * In that case no ID is found. But we can discard it, since we only want to trigger the event on\n\t\t * related products, which are found below.\n\t\t */\n\n\t\tif (productId) {\n\n\t\t\tproductId = wpm.getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmSelectContentGaUa\", product)\n\t\t\t\tjQuery(document).trigger(\"wpmSelectItem\", product)\n\t\t\t}\n\t\t}\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// begin_checkout event\n// jQuery('.checkout-button, .cart-checkout-button, .button.checkout').one('click', function (e) {\njQuery(document).one(\"click\", \".checkout-button, .cart-checkout-button, .button.checkout\", function () {\n\tjQuery(document).trigger(\"wpmBeginCheckout\")\n})\n\n\n// checkout_progress event\n// track checkout option event: entered valid billing email\n// jQuery('#billing_email').on('input', function () {\njQuery(document).on(\"input\", \"#billing_email\", function () {\n\n\tif (wpm.isEmail(jQuery(this).val())) {\n\t\t// wpm.fireCheckoutOption(2);\n\t\twpm.fireCheckoutProgress(2)\n\t\twpm.emailSelected = true\n\t}\n})\n\n// track checkout option event: purchase click\n// jQuery('.wc_payment_methods').on('click', function () {\njQuery(document).on(\"click\", \".wc_payment_methods\", function () {\n\n\tif (false === wpm.paymentMethodSelected) {\n\t\twpm.fireCheckoutProgress(3)\n\t}\n\n\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\twpm.paymentMethodSelected = true\n})\n\n// track checkout option event: purchase click\n// jQuery('#place_order').one('click', function () {\njQuery(document).one(\"click\", \"#place_order\", function () {\n\n\tif (false === wpm.emailSelected) {\n\t\twpm.fireCheckoutProgress(2)\n\t}\n\n\tif (false === wpm.paymentMethodSelected) {\n\t\twpm.fireCheckoutProgress(3)\n\t\twpm.fireCheckoutOption(3, jQuery(\"input[name='payment_method']:checked\").val())\n\t}\n\n\twpm.fireCheckoutProgress(4)\n})\n\n// update cart event\n// jQuery(\"[name='update_cart']\").on('click', function (e) {\njQuery(document).on(\"click\", \"[name='update_cart']\", function () {\n\n\ttry {\n\t\tjQuery(\".cart_item\").each(function () {\n\n\t\t\tlet url = new URL(jQuery(this).find(\".product-remove\").find(\"a\").attr(\"href\"))\n\t\t\tlet productId = wpm.getProductIdByCartItemKeyUrl(url)\n\n\n\t\t\tlet quantity = jQuery(this).find(\".qty\").val()\n\n\t\t\tif (quantity === 0) {\n\t\t\t\twpm.removeProductFromCart(productId)\n\t\t\t} else if (quantity < wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.removeProductFromCart(productId, wpmDataLayer.cart[productId].quantity - quantity)\n\t\t\t} else if (quantity > wpmDataLayer.cart[productId].quantity) {\n\t\t\t\twpm.addProductToCart(productId, quantity - wpmDataLayer.cart[productId].quantity)\n\t\t\t}\n\t\t})\n\t} catch (e) {\n\t\tconsole.error(e)\n\t\twpm.getCartItemsFromBackend()\n\t}\n})\n\n\n// add_to_wishlist\n// jQuery('.add_to_wishlist, .wl-add-to').on('click', function () {\njQuery(document).on(\"click\", \".add_to_wishlist, .wl-add-to\", function () {\n\n\ttry {\n\n\t\tlet productId\n\n\t\tif (jQuery(this).data(\"productid\")) { // for the WooCommerce wishlist plugin\n\n\t\t\tproductId = jQuery(this).data(\"productid\")\n\t\t} else if (jQuery(this).data(\"product-id\")) { // for the YITH wishlist plugin\n\n\t\t\tproductId = jQuery(this).data(\"product-id\")\n\t\t}\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\tjQuery(document).trigger(\"wpmAddToWishlist\", product)\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\njQuery(document).on(\"updated_cart_totals\", function () {\n\tjQuery(document).trigger(\"wpmViewCart\")\n})\n\n\n/**\n * Called when the user selects all the required dropdowns / attributes\n *\n * Has to be hooked after document ready !\n *\n * https://stackoverflow.com/a/27849208/4688612\n * https://stackoverflow.com/a/65065335/4688612\n */\n\njQuery(function () {\n\n\tjQuery(\".single_variation_wrap\").on(\"show_variation\", function (event, variation) {\n\n\t\ttry {\n\t\t\tlet productId = wpm.getIdBasedOndVariationsOutputSetting(variation.variation_id)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n})\n\n\n/**\n * Called on variable products when no selection has been done yet\n * or when the visitor deselects his choice.\n *\n * Has to be hooked after document ready !\n */\n\njQuery(function () {\n\n\tjQuery(\".single_variation_wrap\").on(\"hide_variation\", function () {\n\n\t\ttry {\n\t\t\tlet classes = jQuery(\"body\").attr(\"class\")\n\t\t\tlet productId = classes.match(/(postid-)(\\d+)/)[2]\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\t/**\n\t\t\t * If we have a variable product with no preset,\n\t\t\t * and variations output is enabled,\n\t\t\t * then we send a viewItem event with the first\n\t\t\t * variation we find for the parent.\n\t\t\t * If variations output is disabled,\n\t\t\t * we just send the parent ID.\n\t\t\t */\n\t\t\tif (\n\t\t\t\t\"variable\" === wpmDataLayer.shop.product_type &&\n\t\t\t\twpmDataLayer?.general?.variationsOutput\n\t\t\t) {\n\t\t\t\tfor (const [key, product] of Object.entries(wpmDataLayer.products)) {\n\t\t\t\t\tif (\"parentId\" in product) {\n\n\t\t\t\t\t\tproductId = product.id\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (wpmDataLayer.products && wpmDataLayer.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId)\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\t\t\t}\n\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t})\n})\n\n\n\n/**\n * Set up wpm events\n */\n\n// populate the wpmDataLayer with the cart items\njQuery(window).on(\"wpmLoad\", function () {\n\n\ttry {\n\t\t// When a new session is initiated there are no items in the cart,\n\t\t// so we can save the call to get the cart items\n\t\tif (wpm.doesWooCommerceCartExist()) wpm.getCartItems()\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n// get all add-to-cart= products from backend\njQuery(window).on(\"wpmLoad\", function () {\n\n\twpmDataLayer.products = wpmDataLayer.products || {}\n\n\t// scan page for add-to-cart= links\n\tlet productIds = wpm.getAddToCartLinkProductIds()\n\n\twpm.getProductsFromBackend(productIds)\n})\n\n/**\n * Save the referrer into a cookie\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\n\t// can't use session storage as we can't read it from the server\n\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\n\t\tif (document.referrer) {\n\t\t\tlet referrerUrl = new URL(document.referrer)\n\t\t\tlet referrerHostname = referrerUrl.hostname\n\n\t\t\tif (referrerHostname !== window.location.host) {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", referrerHostname)\n\t\t\t} else {\n\t\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t\t}\n\n\t\t} else {\n\t\t\twpm.setCookie(\"wpmReferrer\", \"\")\n\t\t}\n\t}\n})\n\n\n/**\n * Create our own load event in order to better handle script flow execution when JS \"optimizers\" shuffle the code.\n */\n\njQuery(window).on(\"wpmLoad\", function () {\n\ttry {\n\t\tif (typeof wpmDataLayer != \"undefined\" && !wpmDataLayer?.wpmLoadFired) {\n\n\t\t\tjQuery(document).trigger(\"wpmLoadAlways\")\n\n\t\t\tif (\"product\" === wpmDataLayer.shop.page_type && wpmDataLayer.shop.product_type !== \"variable\" && wpm.getMainProductIdFromProductPage()) {\n\n\t\t\t\tlet product = wpm.getProductDataForViewItemEvent(wpm.getMainProductIdFromProductPage())\n\t\t\t\tjQuery(document).trigger(\"wpmViewItem\", product)\n\n\t\t\t} else if (\"product_category\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmCategory\")\n\n\t\t\t} else if (\"search\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmSearch\")\n\n\t\t\t} else if (\"cart\" === wpmDataLayer.shop.page_type) {\n\n\t\t\t\tjQuery(document).trigger(\"wpmViewCart\")\n\n\t\t\t} else if (\"order_received_page\" === wpmDataLayer.shop.page_type && wpmDataLayer.order) {\n\n\t\t\t\tif (!wpm.isOrderIdStored(wpmDataLayer.order.id)) {\n\n\t\t\t\t\tjQuery(document).trigger(\"wpmOrderReceivedPage\")\n\t\t\t\t\twpm.writeOrderIdToStorage(wpmDataLayer.order.id)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tjQuery(document).trigger(\"wpmEverywhereElse\")\n\t\t\t}\n\n\t\t\tif (wpmDataLayer?.user?.id && !wpm.hasLoginEventFired()) {\n\t\t\t\tjQuery(document).trigger(\"wpmLogin\")\n\t\t\t\twpm.setLoginEventFired()\n\t\t\t}\n\n\t\t\t// /**\n\t\t\t// * Load mini cart fragments into a wpm session storage key,\n\t\t\t// * after the document load event.\n\t\t\t// */\n\t\t\t// jQuery(document).ajaxSend(function (event, jqxhr, settings) {\n\t\t\t// \t// console.log('settings.url: ' + settings.url);\n\t\t\t//\n\t\t\t// \tif (settings.url.includes(\"get_refreshed_fragments\") && sessionStorage) {\n\t\t\t// \t\tif (!sessionStorage.getItem(\"wpmMiniCartActive\")) {\n\t\t\t// \t\t\tsessionStorage.setItem(\"wpmMiniCartActive\", JSON.stringify(true))\n\t\t\t// \t\t}\n\t\t\t// \t}\n\t\t\t// })\n\n\t\t\twpmDataLayer.wpmLoadFired = true\n\t\t}\n\n\t} catch (e) {\n\t\tconsole.error(e)\n\t}\n})\n\n/**\n * Load all pixels\n */\njQuery(window).on(\"wpmPreLoadPixels\", function () {\n\n\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\twpm.updateConsentCookieValues(true)\n\t}\n\t\n\tjQuery(document).trigger(\"wpmLoadPixels\", {})\n})\n","/**\n * Create a wpm namespace under which all functions are declared\n */\n\n// https://stackoverflow.com/a/5947280/4688612\n\n(function (wpm, $, undefined) {\n\n\tconst wpmDeduper = {\n\t\tkeyName : \"_wpm_order_ids\",\n\t\tcookieExpiresDays: 365,\n\t}\n\n\tconst wpmRestSettings = {\n\t\t// cookiesAvailable : '_wpm_cookies_are_available',\n\t\tcookieWpmRestEndpointAvailable: \"_wpm_endpoint_available\",\n\t\trestEndpoint : \"/wp-json/\",\n\t\trestFails : 0,\n\t\trestFailsThreshold : 10,\n\t}\n\n\twpm.emailSelected = false\n\twpm.paymentMethodSelected = false\n\n\t// wpm.checkIfCookiesAvailable = function () {\n\t//\n\t// // read the cookie if previously set, if it is return true, otherwise continue\n\t// if (wpm.getCookie(wpmRestSettings.cookiesAvailable)) {\n\t// return true;\n\t// }\n\t//\n\t// // set the cookie for the session\n\t// Cookies.set(wpmRestSettings.cookiesAvailable, true);\n\t//\n\t// // read cookie, true if ok, false if not ok\n\t// return !!wpm.getCookie(wpmRestSettings.cookiesAvailable);\n\t// }\n\n\twpm.useRestEndpoint = function () {\n\n\t\t// only if sessionStorage is available\n\n\t\t// only if REST API endpoint is generally accessible\n\t\t// check in sessionStorage if we checked before and return answer\n\t\t// otherwise check if the endpoint is available, save answer in sessionStorage and return answer\n\n\t\t// only if not too many REST API errors happened\n\n\t\treturn wpm.isSessionStorageAvailable() &&\n\t\t\twpm.isRestEndpointAvailable() &&\n\t\t\twpm.isBelowRestErrorThreshold()\n\t}\n\n\twpm.isBelowRestErrorThreshold = function () {\n\t\treturn window.sessionStorage.getItem(wpmRestSettings.restFails) <= wpmRestSettings.restFailsThreshold\n\t}\n\n\twpm.isRestEndpointAvailable = function () {\n\n\t\tif (window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable)) {\n\t\t\treturn JSON.parse(window.sessionStorage.getItem(wpmRestSettings.cookieWpmRestEndpointAvailable))\n\t\t} else {\n\t\t\t// return wpm.testEndpoint();\n\t\t\t// just set the value whenever possible in order not to wait or block the main thread\n\t\t\twpm.testEndpoint()\n\t\t}\n\t}\n\n\twpm.isSessionStorageAvailable = function () {\n\n\t\treturn !!window.sessionStorage\n\t}\n\n\twpm.testEndpoint = function (\n\t\turl = location.protocol + \"//\" + location.host + wpmRestSettings.restEndpoint,\n\t\tcookieName = wpmRestSettings.cookieWpmRestEndpointAvailable,\n\t) {\n\t\t// console.log('testing endpoint');\n\n\t\tjQuery.ajax(url, {\n\t\t\ttype : \"HEAD\",\n\t\t\ttimeout: 1000,\n\t\t\t// async: false,\n\t\t\tstatusCode: {\n\t\t\t\t200: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, true);\n\t\t\t\t\t// console.log('endpoint works');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(true))\n\t\t\t\t},\n\t\t\t\t404: function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t\t0 : function (response) {\n\t\t\t\t\t// Cookies.set(cookieName, false);\n\t\t\t\t\t// console.log('endpoint doesn\\'t work');\n\t\t\t\t\twindow.sessionStorage.setItem(cookieName, JSON.stringify(false))\n\t\t\t\t},\n\t\t\t},\n\t\t}).then(response => {\n\t\t\t// console.log('test done')\n\t\t\t// console.log('result: ' + JSON.parse(window.sessionStorage.getItem(cookieName)));\n\t\t\t// return JSON.parse(window.sessionStorage.getItem(cookieName));\n\t\t})\n\t}\n\n\twpm.isWpmRestEndpointAvailable = function (cookieName = wpmRestSettings.cookieWpmRestEndpointAvailable) {\n\n\t\treturn !!wpm.getCookie(cookieName)\n\t}\n\n\twpm.writeOrderIdToStorage = function (orderId, expireDays = 365) {\n\n\t\t// save the order ID in the browser storage\n\n\t\tif (!window.Storage) {\n\t\t\tlet expiresDate = new Date()\n\t\t\texpiresDate.setDate(expiresDate.getDate() + wpmDeduper.cookieExpiresDays)\n\n\t\t\tlet ids = []\n\t\t\tif (checkCookie()) {\n\t\t\t\tids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t}\n\n\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\tids.push(orderId)\n\t\t\t\tdocument.cookie = wpmDeduper.keyName + \"=\" + JSON.stringify(ids) + \";expires=\" + expiresDate.toUTCString()\n\t\t\t}\n\n\t\t} else {\n\t\t\tif (localStorage.getItem(wpmDeduper.keyName) === null) {\n\t\t\t\tlet ids = []\n\t\t\t\tids.push(orderId)\n\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\n\t\t\t} else {\n\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\tif (!ids.includes(orderId)) {\n\t\t\t\t\tids.push(orderId)\n\t\t\t\t\twindow.localStorage.setItem(wpmDeduper.keyName, JSON.stringify(ids))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (typeof wpm.storeOrderIdOnServer === \"function\" && wpmDataLayer.orderDeduplication) {\n\t\t\twpm.storeOrderIdOnServer(orderId)\n\t\t}\n\t}\n\n\tfunction checkCookie() {\n\t\tlet key = wpm.getCookie(wpmDeduper.keyName)\n\t\treturn key !== \"\"\n\t}\n\n\twpm.isOrderIdStored = function (orderId) {\n\n\t\tif (wpmDataLayer.orderDeduplication) {\n\n\t\t\tif (!window.Storage) {\n\n\t\t\t\tif (checkCookie()) {\n\t\t\t\t\tlet ids = JSON.parse(wpm.getCookie(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (localStorage.getItem(wpmDeduper.keyName) !== null) {\n\t\t\t\t\tlet ids = JSON.parse(localStorage.getItem(wpmDeduper.keyName))\n\t\t\t\t\treturn ids.includes(orderId)\n\t\t\t\t} else {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tconsole.log(\"order duplication prevention: off\")\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.isEmail = function (email) {\n\n\t\t// https://emailregex.com/\n\n\t\tlet regex = /^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/\n\n\t\treturn regex.test(email)\n\t}\n\n\twpm.removeProductFromCart = function (productId, quantityToRemove = null) {\n\n\t\ttry {\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = wpm.getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tlet quantity\n\n\t\t\tif (quantityToRemove == null) {\n\t\t\t\tquantity = wpmDataLayer.cart[productId].quantity\n\t\t\t} else {\n\t\t\t\tquantity = quantityToRemove\n\t\t\t}\n\n\t\t\tif (wpmDataLayer.cart[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\tjQuery(document).trigger(\"wpmRemoveFromCart\", product)\n\n\t\t\t\tif (quantityToRemove == null || wpmDataLayer.cart[productId].quantity === quantityToRemove) {\n\n\t\t\t\t\tdelete wpmDataLayer.cart[productId]\n\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t} else {\n\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity - quantity\n\n\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\t// console.log('getting cart from back end');\n\t\t\t// wpm.getCartItemsFromBackend();\n\t\t\t// console.log('getting cart from back end done');\n\t\t}\n\t}\n\n\twpm.getIdBasedOndVariationsOutputSetting = function (productId) {\n\n\t\ttry {\n\t\t\tif (wpmDataLayer?.general?.variationsOutput) {\n\n\t\t\t\treturn productId\n\t\t\t} else {\n\t\t\t\tif (wpmDataLayer.products[productId].isVariation) {\n\n\t\t\t\t\treturn wpmDataLayer.products[productId].parentId\n\t\t\t\t} else {\n\n\t\t\t\t\treturn productId\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// add_to_cart\n\twpm.addProductToCart = function (productId, quantity) {\n\n\t\ttry {\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tproductId = wpm.getIdBasedOndVariationsOutputSetting(productId)\n\n\t\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\t\tif (wpmDataLayer?.products[productId]) {\n\n\t\t\t\tlet product = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\n\t\t\t\tjQuery(document).trigger(\"wpmAddToCart\", product)\n\n\t\t\t\t// add product to cart wpmDataLayer['cart']\n\n\t\t\t\t// if the product already exists in the object, only add the additional quantity\n\t\t\t\t// otherwise create that product object in the wpmDataLayer['cart']\n\t\t\t\tif (wpmDataLayer?.cart[productId]) {\n\n\t\t\t\t\twpmDataLayer.cart[productId].quantity = wpmDataLayer.cart[productId].quantity + quantity\n\t\t\t\t} else {\n\n\t\t\t\t\tif (!(\"cart\" in wpmDataLayer)) wpmDataLayer.cart = {}\n\n\t\t\t\t\twpmDataLayer.cart[productId] = wpm.getProductDetailsFormattedForEvent(productId, quantity)\n\t\t\t\t}\n\n\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(wpmDataLayer.cart))\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\n\t\t\t// fallback if wpmDataLayer.cart and wpmDataLayer.products got out of sync in case cart caching has an issue\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\twpm.getCartItems = function () {\n\n\t\tif (sessionStorage) {\n\t\t\tif (!sessionStorage.getItem(\"wpmDataLayerCart\") || wpmDataLayer.shop.page_type === \"order_received_page\") {\n\t\t\t\tsessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify({}))\n\t\t\t} else {\n\t\t\t\twpm.saveCartObjectToDataLayer(JSON.parse(sessionStorage.getItem(\"wpmDataLayerCart\")))\n\t\t\t}\n\t\t} else {\n\t\t\twpm.getCartItemsFromBackend()\n\t\t}\n\t}\n\n\t// get all cart items from the backend\n\twpm.getCartItemsFromBackend = function () {\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction: \"wpm_get_cart_items\",\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (cartItems) {\n\n\t\t\t\t\t\t// save all cart items into wpmDataLayer\n\n\t\t\t\t\t\tif (!cartItems[\"cart\"]) cartItems[\"cart\"] = {}\n\n\t\t\t\t\t\twpm.saveCartObjectToDataLayer(cartItems[\"cart\"])\n\n\t\t\t\t\t\tif (sessionStorage) sessionStorage.setItem(\"wpmDataLayerCart\", JSON.stringify(cartItems[\"cart\"]))\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// get productIds from the backend\n\twpm.getProductsFromBackend = function (productIds) {\n\n\n\t\t// reduce productIds by products already in the dataLayer\n\t\tproductIds = productIds.filter(item => !wpmDataLayer.products.hasOwnProperty(item))\n\n\t\t// if no products IDs are in the object, don't try to get anything from the server\n\t\tif (!productIds || productIds.length === 0) return\n\n\t\ttry {\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_get_product_ids\",\n\t\t\t\tproductIds: productIds,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"get\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (products) {\n\n\t\t\t\t\t\t// merge products into wpmDataLayer.products\n\t\t\t\t\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, products)\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.saveCartObjectToDataLayer = function (cartObject) {\n\n\t\twpmDataLayer.cart = cartObject\n\t\twpmDataLayer.products = Object.assign({}, wpmDataLayer.products, cartObject)\n\t}\n\n\twpm.fireCheckoutOption = function (step, checkout_option = null, value = null) {\n\n\t\tlet data = {\n\t\t\tstep : step,\n\t\t\tcheckout_option: checkout_option,\n\t\t\tvalue : value,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutOption\", data)\n\t}\n\n\twpm.fireCheckoutProgress = function (step) {\n\n\t\tlet data = {\n\t\t\tstep: step,\n\t\t}\n\n\t\tjQuery(document).trigger(\"wpmFireCheckoutProgress\", data)\n\t}\n\n\twpm.getPostIdFromString = function (string) {\n\n\t\ttry {\n\t\t\treturn string.match(/(post-)(\\d+)/)[2]\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.triggerViewItemList = function (productId) {\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tproductId = wpm.getIdBasedOndVariationsOutputSetting(productId)\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\tjQuery(document).trigger(\"wpmViewItemList\", wpm.getProductDataForViewItemEvent(productId))\n\t}\n\n\twpm.getProductDataForViewItemEvent = function (productId) {\n\n\t\tif (!productId) throw Error(\"Wasn't able to retrieve a productId\")\n\n\t\ttry {\n\t\t\tif (wpmDataLayer.products[productId]) {\n\n\t\t\t\treturn wpm.getProductDetailsFormattedForEvent(productId)\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getMainProductIdFromProductPage = function () {\n\n\t\ttry {\n\t\t\tif ([\"simple\", \"variable\", \"grouped\", \"composite\", \"bundle\"].indexOf(wpmDataLayer.shop.product_type) >= 0) {\n\t\t\t\treturn jQuery(\".wpmProductId:first\").data(\"id\")\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.viewItemListTriggerTestMode = function (target) {\n\n\t\tjQuery(target).css({\"position\": \"relative\"})\n\t\tjQuery(target).append(\"<div id=\\\"viewItemListTriggerOverlay\\\"></div>\")\n\t\tjQuery(target).find(\"#viewItemListTriggerOverlay\").css({\n\t\t\t\"z-index\" : \"10\",\n\t\t\t\"display\" : \"block\",\n\t\t\t\"position\" : \"absolute\",\n\t\t\t\"height\" : \"100%\",\n\t\t\t\"top\" : \"0\",\n\t\t\t\"left\" : \"0\",\n\t\t\t\"right\" : \"0\",\n\t\t\t\"opacity\" : wpmDataLayer.viewItemListTrigger.opacity,\n\t\t\t\"background-color\": wpmDataLayer.viewItemListTrigger.backgroundColor,\n\t\t})\n\t}\n\n\twpm.getSearchTermFromUrl = function () {\n\n\t\ttry {\n\t\t\tlet urlParameters = new URLSearchParams(window.location.search)\n\t\t\treturn urlParameters.get(\"s\")\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// we need this to track timeouts for intersection observers\n\tlet ioTimeouts = {}\n\n\twpm.observerCallback = function (entries, observer) {\n\n\t\tentries.forEach((entry) => {\n\n\t\t\ttry {\n\t\t\t\tlet productId\n\n\t\t\t\tlet elementId = jQuery(entry.target).data(\"ioid\")\n\n\t\t\t\t// Get the productId from next element, if wpmProductId is a sibling, like in Gutenberg blocks\n\t\t\t\t// otherwise go search in children, like in regular WC loop items\n\t\t\t\tif (jQuery(entry.target).next(\".wpmProductId\").length) {\n\t\t\t\t\t// console.log('test 1');\n\t\t\t\t\tproductId = jQuery(entry.target).next(\".wpmProductId\").data(\"id\")\n\t\t\t\t} else {\n\t\t\t\t\tproductId = jQuery(entry.target).find(\".wpmProductId\").data(\"id\")\n\t\t\t\t}\n\n\n\t\t\t\tif (!productId) throw Error(\"wpmProductId element not found\")\n\n\t\t\t\tif (entry.isIntersecting) {\n\n\t\t\t\t\tioTimeouts[elementId] = setTimeout(() => {\n\n\t\t\t\t\t\twpm.triggerViewItemList(productId)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) wpm.viewItemListTriggerTestMode(entry.target)\n\t\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.repeat === false) observer.unobserve(entry.target)\n\t\t\t\t\t}, wpmDataLayer.viewItemListTrigger.timeout)\n\n\t\t\t\t} else {\n\n\t\t\t\t\tclearTimeout(ioTimeouts[elementId])\n\t\t\t\t\tif (wpmDataLayer.viewItemListTrigger.testMode) jQuery(entry.target).find(\"#viewItemListTriggerOverlay\").remove()\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\tconsole.error(e)\n\t\t\t}\n\t\t})\n\t}\n\n\t// fire view_item_list only on products that have become visible\n\tlet io\n\tlet ioid = 0\n\tlet allIoElementsToWatch\n\n\tlet getAllElementsToWatch = function () {\n\n\t\tallIoElementsToWatch = jQuery(\".wpmProductId\")\n\t\t\t.map(function (i, elem) {\n\n\t\t\t\tif (\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"type-product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).parent().hasClass(\"product-item-inner\")\n\t\t\t\t) {\n\t\t\t\t\treturn jQuery(elem).parent()\n\t\t\t\t} else if (\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"wc-block-grid__product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"product-small\") ||\n\t\t\t\t\tjQuery(elem).prev().hasClass(\"woocommerce-LoopProduct-link\")\n\t\t\t\t) {\n\t\t\t\t\treturn jQuery(this).prev()\n\t\t\t\t} else if (jQuery(elem).closest(\".product\").length) {\n\t\t\t\t\treturn jQuery(elem).closest(\".product\")\n\t\t\t\t}\n\t\t\t})\n\t}\n\n\twpm.startIntersectionObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// enable view_item_list test mode from browser\n\t\t\tif (wpm.urlHasParameter(\"vildemomode\")) wpmDataLayer.viewItemListTrigger.testMode = true\n\n\t\t\t// set up intersection observer\n\t\t\tio = new IntersectionObserver(wpm.observerCallback, {\n\t\t\t\tthreshold: wpmDataLayer.viewItemListTrigger.threshold,\n\t\t\t})\n\n\t\t\tgetAllElementsToWatch()\n\n\t\t\tallIoElementsToWatch.each(function (i, elem) {\n\n\t\t\t\tjQuery(elem[0]).data(\"ioid\", ioid++)\n\n\t\t\t\tio.observe(elem[0])\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// watch DOM for new lazy loaded products and add them to the intersection observer\n\twpm.startProductsMutationObserverToWatch = function () {\n\n\t\ttry {\n\t\t\t// Pass in the target node, as well as the observer options\n\n\t\t\t// selects the most common parent node\n\t\t\t// https://stackoverflow.com/a/7648323/4688612\n\t\t\tlet productsNode = jQuery(\".wpmProductId:eq(0)\").parents().has(jQuery(\".wpmProductId:eq(1)\").parents()).first()\n\n\t\t\tif (productsNode.length) {\n\t\t\t\tproductsMutationObserver.observe(productsNode[0], {\n\t\t\t\t\tattributes : true,\n\t\t\t\t\tchildList : true,\n\t\t\t\t\tcharacterData: true,\n\t\t\t\t})\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\t// Create an observer instance\n\tlet productsMutationObserver = new MutationObserver(function (mutations) {\n\n\t\tmutations.forEach(function (mutation) {\n\t\t\tlet newNodes = mutation.addedNodes // DOM NodeList\n\t\t\tif (newNodes !== null) { // If there are new nodes added\n\t\t\t\tlet nodes = jQuery(newNodes) // jQuery set\n\t\t\t\tnodes.each(function () {\n\t\t\t\t\tif (\n\t\t\t\t\t\tjQuery(this).hasClass(\"type-product\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"product-small\") ||\n\t\t\t\t\t\tjQuery(this).hasClass(\"wc-block-grid__product\")\n\t\t\t\t\t) {\n\t\t\t\t\t\t// check if the node has a child or sibling wpmProductId\n\t\t\t\t\t\t// if yes add it to the intersectionObserver\n\t\t\t\t\t\tif (hasWpmProductIdElement(this)) {\n\t\t\t\t\t\t\tjQuery(this).data(\"ioid\", ioid++)\n\t\t\t\t\t\t\tio.observe(this)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t})\n\n\tlet hasWpmProductIdElement = function (elem) {\n\t\treturn !!(jQuery(elem).find(\".wpmProductId\").length ||\n\t\t\tjQuery(elem).siblings(\".wpmProductId\").length)\n\t}\n\n\twpm.setCookie = function (cookieName, cookieValue = \"\", expiryDays = null) {\n\n\t\tif (expiryDays) {\n\n\t\t\tlet d = new Date()\n\t\t\td.setTime(d.getTime() + (expiryDays * 24 * 60 * 60 * 1000))\n\t\t\tlet expires = \"expires=\" + d.toUTCString()\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";\" + expires + \";path=/\"\n\t\t} else {\n\t\t\tdocument.cookie = cookieName + \"=\" + cookieValue + \";path=/\"\n\t\t}\n\t}\n\n\twpm.getCookie = function (cookieName) {\n\n\t\tlet name = cookieName + \"=\"\n\t\tlet decodedCookie = decodeURIComponent(document.cookie)\n\t\tlet ca = decodedCookie.split(\";\")\n\n\t\tfor (let i = 0; i < ca.length; i++) {\n\n\t\t\tlet c = ca[i]\n\n\t\t\twhile (c.charAt(0) == \" \") {\n\t\t\t\tc = c.substring(1)\n\t\t\t}\n\n\t\t\tif (c.indexOf(name) == 0) {\n\t\t\t\treturn c.substring(name.length, c.length)\n\t\t\t}\n\t\t}\n\n\t\treturn \"\"\n\t}\n\n\twpm.getWpmSessionData = function () {\n\n\t\tif (window.sessionStorage) {\n\n\t\t\tlet data = window.sessionStorage.getItem(\"_wpm\")\n\t\t\t\n\t\t\tif (data !== null) {\n\t\t\t\treturn JSON.parse(data)\n\t\t\t} else {\n\t\t\t\treturn {}\n\t\t\t}\n\t\t} else {\n\t\t\treturn {}\n\t\t}\n\t}\n\n\twpm.setWpmSessionData = function (data) {\n\t\tif (window.sessionStorage) {\n\t\t\twindow.sessionStorage.setItem(\"_wpm\", JSON.stringify(data))\n\t\t}\n\t}\n\n\twpm.storeOrderIdOnServer = function (orderId) {\n\n\t\ttry {\n\t\t\t// save the state in the database\n\t\t\tlet data = {\n\t\t\t\taction : \"wpm_purchase_pixels_fired\",\n\t\t\t\torder_id: orderId,\n\t\t\t\t// nonce : ajax_object.nonce,\n\t\t\t\tnonce: wpm.nonce,\n\t\t\t}\n\n\t\t\tjQuery.ajax(\n\t\t\t\t{\n\t\t\t\t\ttype : \"post\",\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\t// url : ajax_object.ajax_url,\n\t\t\t\t\turl : wpm.ajax_url,\n\t\t\t\t\tdata : data,\n\t\t\t\t\tsuccess: function (response) {\n\t\t\t\t\t\tif (response.success === false) {\n\t\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\terror : function (response) {\n\t\t\t\t\t\tconsole.log(response)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t}\n\t}\n\n\twpm.getProductIdByCartItemKeyUrl = function (url) {\n\n\t\tlet searchParams = new URLSearchParams(url.search)\n\t\tlet cartItemKey = searchParams.get(\"remove_item\")\n\n\t\tlet productId\n\n\t\tif (wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"] === 0) {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"product_id\"]\n\t\t} else {\n\t\t\tproductId = wpmDataLayer.cartItemKeys[cartItemKey][\"variation_id\"]\n\t\t}\n\n\t\treturn productId\n\t}\n\n\twpm.getAddToCartLinkProductIds = function () {\n\n\t\treturn jQuery(\"a\").map(function () {\n\t\t\tlet href = jQuery(this).attr(\"href\")\n\n\t\t\tif (href && href.includes(\"?add-to-cart=\")) {\n\t\t\t\tlet matches = href.match(/(add-to-cart=)(\\d+)/)\n\t\t\t\tif (matches) return matches[2]\n\t\t\t}\n\t\t}).get()\n\t}\n\n\twpm.getProductDetailsFormattedForEvent = function (productId, quantity = 1) {\n\n\t\tlet product = {\n\t\t\tid : productId.toString(),\n\t\t\tdyn_r_ids : wpmDataLayer.products[productId].dyn_r_ids,\n\t\t\tname : wpmDataLayer.products[productId].name,\n\t\t\tlist_name : wpmDataLayer.shop.list_name,\n\t\t\tbrand : wpmDataLayer.products[productId].brand,\n\t\t\tcategory : wpmDataLayer.products[productId].category,\n\t\t\tvariant : wpmDataLayer.products[productId].variant,\n\t\t\tlist_position: wpmDataLayer.products[productId].position,\n\t\t\tquantity : quantity,\n\t\t\tprice : wpmDataLayer.products[productId].price,\n\t\t\tcurrency : wpmDataLayer.shop.currency,\n\t\t\tisVariable : wpmDataLayer.products[productId].isVariable,\n\t\t\tisVariation : wpmDataLayer.products[productId].isVariation,\n\t\t\tparentId : wpmDataLayer.products[productId].parentId,\n\t\t}\n\n\t\tif (product.isVariation) product[\"parentId_dyn_r_ids\"] = wpmDataLayer.products[productId].parentId_dyn_r_ids\n\n\t\treturn product\n\t}\n\n\twpm.setReferrerToCookie = function () {\n\n\t\t// can't use session storage as we can't read it from the server\n\t\tif (!wpm.getCookie(\"wpmReferrer\")) {\n\t\t\twpm.setCookie(\"wpmReferrer\", document.referrer)\n\t\t}\n\t}\n\n\twpm.getReferrerFromCookie = function () {\n\n\t\tif (wpm.getCookie(\"wpmReferrer\")) {\n\t\t\treturn wpm.getCookie(\"wpmReferrer\")\n\t\t} else {\n\t\t\treturn null\n\t\t}\n\t}\n\n\twpm.getClidFromBrowser = function (clidId = \"gclid\") {\n\n\t\tlet clidCookieId\n\n\t\tclidCookieId = {\n\t\t\tgclid: \"_gcl_aw\",\n\t\t\tdclid: \"_gcl_dc\",\n\t\t}\n\n\t\tif (wpm.getCookie(clidCookieId[clidId])) {\n\n\t\t\tlet clidCookie = wpm.getCookie(clidCookieId[clidId])\n\t\t\tlet matches = clidCookie.match(/(GCL.[\\d]*.)(.*)/)\n\t\t\treturn matches[2]\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\twpm.getUserAgent = function () {\n\t\treturn navigator.userAgent\n\t}\n\n\twpm.getViewPort = function () {\n\t\treturn {\n\t\t\twidth : Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0),\n\t\t\theight: Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0),\n\t\t}\n\t}\n\n\t/**\n\t * Handle Cookie Management Platforms\n\t */\n\n\tlet getComplianzCookies = function () {\n\n\t\tlet cmplz_statistics = wpm.getCookie(\"cmplz_statistics\")\n\t\tlet cmplz_marketing = wpm.getCookie(\"cmplz_marketing\")\n\t\tlet cmplz_consent_status = wpm.getCookie(\"cmplz_consent_status\") || wpm.getCookie(\"cmplz_banner-status\")\n\n\t\tif (cmplz_consent_status) {\n\t\t\treturn {\n\t\t\t\tanalytics : cmplz_statistics === \"allow\",\n\t\t\t\tads : cmplz_marketing === \"allow\",\n\t\t\t\tvisitorHasChosen: true,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tlet getCookieLawInfoCookies = function () {\n\n\t\tlet analyticsCookie = wpm.getCookie(\"cookielawinfo-checkbox-analytics\") || wpm.getCookie(\"cookielawinfo-checkbox-analytiques\")\n\t\tlet adsCookie = wpm.getCookie(\"cookielawinfo-checkbox-advertisement\") || wpm.getCookie(\"cookielawinfo-checkbox-publicite\")\n\t\tlet visitorHasChosen = wpm.getCookie(\"CookieLawInfoConsent\")\n\n\t\tif (analyticsCookie || adsCookie) {\n\n\t\t\treturn {\n\t\t\t\tanalytics : analyticsCookie === \"yes\",\n\t\t\t\tads : adsCookie === \"yes\",\n\t\t\t\tvisitorHasChosen: !!visitorHasChosen,\n\t\t\t}\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\n\tlet\n\t\twpmConsentValues = {}\n\twpmConsentValues.categories = {}\n\twpmConsentValues.pixels = []\n\twpmConsentValues.mode = \"category\"\n\twpmConsentValues.visitorHasChosen = false\n\n\twpm.getConsentValues = function () {\n\t\treturn wpmConsentValues\n\t}\n\n\twpm.setConsentValueCategories = function (analytics = false, ads = false) {\n\t\twpmConsentValues.categories.analytics = analytics\n\t\twpmConsentValues.categories.ads = ads\n\t}\n\n\twpm.updateConsentCookieValues = function (explicitConsent = false) {\n\n\t\t// ad_storage\n\t\t// analytics_storage\n\t\t// functionality_storage\n\t\t// personalization_storage\n\t\t// security_storage\n\n\t\tlet cookie\n\n\t\tif (cookie = wpm.getCookie(\"CookieConsent\")) {\n\n\t\t\t// Cookiebot\n\t\t\t// https://wordpress.org/plugins/cookiebot/\n\t\t\tcookie = decodeURI(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.indexOf(\"statistics:true\") >= 0\n\t\t\twpmConsentValues.categories.ads = cookie.indexOf(\"marketing:true\") >= 0\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"CookieScriptConsent\")) {\n\t\t\t\n\t\t\t// Cookie Script\n\t\t\t// https://wordpress.org/plugins/cookie-script-com/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\tif (cookie.action === \"reject\") {\n\t\t\t\twpmConsentValues.categories.analytics = false\n\t\t\t\twpmConsentValues.categories.ads = false\n\t\t\t} else if (cookie.categories.length === 2) {\n\t\t\t\twpmConsentValues.categories.analytics = true\n\t\t\t\twpmConsentValues.categories.ads = true\n\t\t\t} else {\n\t\t\t\twpmConsentValues.categories.analytics = cookie.categories.indexOf(\"performance\") >= 0\n\t\t\t\twpmConsentValues.categories.ads = cookie.categories.indexOf(\"targeting\") >= 0\n\t\t\t}\n\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"borlabs-cookie\")) {\n\t\t\t\n\t\t\t// Borlabs Cookie\n\t\t\t// https://borlabs.io/borlabs-cookie/\n\n\t\t\tcookie = decodeURI(cookie)\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie?.consents?.statistics\n\t\t\twpmConsentValues.categories.ads = !!cookie?.consents?.marketing\n\t\t\twpmConsentValues.visitorHasChosen = true\n\t\t\twpmConsentValues.pixels = [...cookie?.consents?.statistics || [], ...cookie?.consents?.marketing || []]\n\t\t\twpmConsentValues.mode = \"pixel\"\n\n\t\t} else if (cookie = getComplianzCookies()) {\n\n\t\t\t// Complianz Cookie\n\t\t\t// https://wordpress.org/plugins/complianz-gdpr/\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen\n\n\t\t} else if (cookie = wpm.getCookie(\"cookie_notice_accepted\")) {\n\n\t\t\t// Cookie Compliance (free version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\twpmConsentValues.categories.analytics = true\n\t\t\twpmConsentValues.categories.ads = true\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = wpm.getCookie(\"hu-consent\")) {\n\n\t\t\t// Cookie Compliance (pro version)\n\t\t\t// https://wordpress.org/plugins/cookie-notice/\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = !!cookie.categories[\"3\"]\n\t\t\twpmConsentValues.categories.ads = !!cookie.categories[\"4\"]\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else if (cookie = getCookieLawInfoCookies()) {\n\n\t\t\t// CookieYes, GDPR Cookie Consent (Cookie Law Info)\n\t\t\t// https://wordpress.org/plugins/cookie-law-info/\n\n\t\t\twpmConsentValues.categories.analytics = cookie.analytics === true\n\t\t\twpmConsentValues.categories.ads = cookie.ads === true\n\t\t\twpmConsentValues.visitorHasChosen = cookie.visitorHasChosen === true\n\n\t\t} else if (cookie = wpm.getCookie(\"moove_gdpr_popup\")) {\n\n\t\t\t// GDPR Cookie Compliance Plugin by Moove Agency\n\t\t\t// https://wordpress.org/plugins/gdpr-cookie-compliance/\n\t\t\t// TODO write documentation on how to set up the plugin in order for this to work properly\n\n\t\t\tcookie = JSON.parse(cookie)\n\n\t\t\twpmConsentValues.categories.analytics = cookie.thirdparty === \"1\"\n\t\t\twpmConsentValues.categories.ads = cookie.advanced === \"1\"\n\t\t\twpmConsentValues.visitorHasChosen = true\n\n\t\t} else {\n\t\t\t// consentValues.categories.analytics = true\n\t\t\t// consentValues.categories.ads = true\n\n\t\t\twpmConsentValues.categories.analytics = !explicitConsent\n\t\t\twpmConsentValues.categories.ads = !explicitConsent\n\t\t}\n\t}\n\n\twpm.updateConsentCookieValues()\n\n\twpm.setConsentDefaultValuesToExplicit = function () {\n\t\twpmConsentValues.categories = {\n\t\t\tanalytics: false,\n\t\t\tads : false,\n\t\t}\n\t}\n\n\twpm.canIFire = function (category, pixelName) {\n\n\t\tlet canIFireMode\n\n\t\tif (\"category\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = !!wpmConsentValues.categories[category]\n\t\t} else if (\"pixel\" === wpmConsentValues.mode) {\n\t\t\tcanIFireMode = wpmConsentValues.pixels.includes(pixelName)\n\t\t} else {\n\t\t\tconsole.error(\"Couldn't find a valid consent mode in wpmConsentValues\")\n\t\t\tcanIFireMode = false\n\t\t}\n\n\t\tif (canIFireMode) {\n\t\t\treturn true\n\t\t} else {\n\t\t\tif (true || wpm.urlHasParameter(\"debugConsentMode\")) {\n\t\t\t\twpm.logPreventedPixelLoading(pixelName, category)\n\t\t\t}\n\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.logPreventedPixelLoading = function (pixelName, category) {\n\n\t\tif (wpmDataLayer?.shop?.cookie_consent_mgmt?.explicit_consent) {\n\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have not given consent for it yet. (WPM is in explicit consent mode.)\")\n\t\t} else {\n\t\t\tconsole.log(\"WooCommerce Pixel Manager: The \\\"\" + pixelName + \" (category: \" + category + \")\\\" pixel has not fired because you have removed consent for this pixel. (WPM is in implicit consent mode.)\")\n\t\t}\n\t}\n\n\t/**\n\t * Runs through each script in <head> and blocks / unblocks it according to the plugin settings\n\t * and user consent.\n\t */\n\n\t// https://stackoverflow.com/q/65453565/4688612\n\twpm.scriptTagObserver = new MutationObserver((mutations) => {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif ($(node).data(\"wpm-cookie-category\")) {\n\n\t\t\t\t\t\t// If the pixel category has been approved > unblock\n\t\t\t\t\t\t// If the pixel belongs to more than one category, then unblock if one of the categories has been approved\n\t\t\t\t\t\t// If no category has been approved, but the Google Consent Mode is active, then only unblock the Google scripts\n\n\t\t\t\t\t\tif (wpm.shouldScriptBeActive(node)) {\n\t\t\t\t\t\t\twpm.unblockScript(node)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twpm.blockScript(node)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\twpm.scriptTagObserver.observe(document.head, {childList: true, subtree: true})\n\twindow.addEventListener(\"DOMContentLoaded\", () => wpm.scriptTagObserver.disconnect())\n\n\twpm.shouldScriptBeActive = function (node) {\n\n\t\tif (\n\t\t\twpmDataLayer.shop.cookie_consent_mgmt.explicit_consent ||\n\t\t\twpmConsentValues.visitorHasChosen\n\t\t) {\n\n\t\t\tif (wpmConsentValues.mode === \"category\" && $(node).data(\"wpm-cookie-category\").split(\",\").some(element => wpmConsentValues.categories[element])) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmConsentValues.mode === \"pixel\" && $(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\treturn true\n\t\t\t} else if (wpmDataLayer?.pixels?.google?.consent_mode?.active && $(node).data(\"wpm-pixel-name\") === \"google\") {\n\t\t\t\treturn true\n\t\t\t} else {\n\t\t\t\treturn false\n\t\t\t}\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\n\n\twpm.unblockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tlet wpmSrc = $(scriptNode).data(\"wpm-src\")\n\t\tif (wpmSrc) $(scriptNode).attr(\"src\", wpmSrc)\n\n\t\tscriptNode.type = \"text/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.blockScript = function (scriptNode, removeAttach = false) {\n\n\t\tif (removeAttach) $(scriptNode).remove()\n\n\t\tif ($(scriptNode).attr(\"src\")) $(scriptNode).removeAttr(\"src\")\n\t\tscriptNode.type = \"blocked/javascript\"\n\n\t\tif (removeAttach) $(scriptNode).appendTo(\"head\")\n\t}\n\n\twpm.unblockAllScripts = function (analytics = true, ads = true) {\n\t\t// console.log('unblocking all scripts')\n\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, scriptNode) {\n\n\t\t\t\tif ($(scriptNode).data(\"wpm-cookie-category\").includes(\"analytics\") && analytics) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t} else if ($(scriptNode).data(\"wpm-cookie-category\").includes(\"ads\") && ads) {\n\t\t\t\t\twpm.unblockScript(scriptNode, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\twpm.unblockSelectedPixels = function () {\n\t\t$.each(\n\t\t\t$(\"script[type=\\\"blocked/javascript\\\"]\"), function (index, node) {\n\n\t\t\t\tif (wpmConsentValues.pixels.includes($(node).data(\"wpm-pixel-name\"))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t} else if ($(node).data(\"wpm-pixel-name\") === \"google\" && [\"google-analytics\", \"google-ads\"].some(element => wpmConsentValues.pixels.includes(element))) {\n\t\t\t\t\twpm.unblockScript(node, true)\n\t\t\t\t}\n\t\t\t})\n\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t}\n\n\n\t/**\n\t * Block or unblock scripts for each CMP immediately after cookie consent has been updated\n\t * by the visitor.\n\t */\n\n\t// Borlabs Cookie\n\t// If visitor accepts cookies in Borlabs Cookie unblock the scripts\n\twindow.addEventListener(\"borlabs-cookie-consent-saved\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\tif (wpmConsentValues.mode === \"pixel\") {\n\n\t\t\twpm.unblockSelectedPixels()\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.pixels.includes(\"google-analytics\"), wpmConsentValues.pixels.includes(\"google-ads\"))\n\t\t} else {\n\n\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t}\n\t})\n\n\t// Cookiebot\n\t// If visitor accepts cookies in Cookiebot unblock the scripts\n\t// https://www.cookiebot.com/en/developer/\n\twindow.addEventListener(\"CookiebotOnAccept\", function () {\n\n\t\tif (Cookiebot.consent.statistics) wpmConsentValues.categories.analytics = true\n\t\tif (Cookiebot.consent.marketing) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\n\t}, false)\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/article/20-custom-events\n\t */\n\twindow.addEventListener(\"CookieScriptAccept\", function (e) {\n\n\t\tif (e.detail.categories.includes(\"performance\")) wpmConsentValues.categories.analytics = true\n\t\tif (e.detail.categories.includes(\"targeting\")) wpmConsentValues.categories.ads = true\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Script\n\t * If visitor accepts cookies in Cookie Script unblock the scripts\n\t * https://support.cookie-script.com/\n\t */\n\twindow.addEventListener(\"CookieScriptAcceptAll\", function () {\n\n\t\twpm.unblockAllScripts(true, true)\n\t\twpm.updateGoogleConsentMode(true, true)\n\t})\n\n\t// Complianz Cookie\n\t// If visitor accepts cookies in Complianz unblock the scripts\n\tdocument.addEventListener(\"cmplzStatusChange\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t// Cookie Compliance by hu-manity.co (free and pro)\n\t// If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (free version)\n\t// https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\tdocument.addEventListener(\"setCookieNotice\", function () {\n\n\t\twpm.updateConsentCookieValues()\n\n\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t})\n\n\t/**\n\t * Cookie Compliance by hu-manity.co (free and pro)\n\t * If visitor accepts cookies in Cookie Notice by hu-manity.co unblock the scripts (pro version)\n\t * https://wordpress.org/support/topic/events-on-consent-change/#post-15202792\n\t * Because Cookie Notice has no documented API or event that is being triggered on consent save or update\n\t * we have to solve this by using a mutation observer.\n\t *\n\t * @type {MutationObserver}\n\t */\n\n\twpm.huObserver = new MutationObserver(function (mutations) {\n\t\tmutations.forEach(({addedNodes}) => {\n\t\t\t[...addedNodes]\n\t\t\t\t.forEach(node => {\n\n\t\t\t\t\tif (node.id === \"hu\") {\n\n\t\t\t\t\t\tjQuery(\".hu-cookies-save\").on(\"click\", function () {\n\t\t\t\t\t\t\twpm.updateConsentCookieValues()\n\t\t\t\t\t\t\twpm.unblockAllScripts(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t\twpm.updateGoogleConsentMode(wpmConsentValues.categories.analytics, wpmConsentValues.categories.ads)\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t})\n\t})\n\n\tif (window.hu) {\n\t\twpm.huObserver.observe(document.documentElement || document.body, {childList: true, subtree: true})\n\t}\n\n\twpm.version = function () {\n\t\tconsole.log(wpmDataLayer.version)\n\t}\n\n\t// https://api.jquery.com/jquery.getscript/\n\twpm.loadScriptAndCacheIt = function (url, options) {\n\n\t\t// Allow user to set any option except for dataType, cache, and url\n\t\toptions = jQuery.extend(options || {}, {\n\t\t\tdataType: \"script\",\n\t\t\tcache : true,\n\t\t\turl : url,\n\t\t})\n\n\t\t// Use $.ajax() since it is more flexible than $.getScript\n\t\t// Return the jqXHR object so we can chain callbacks\n\t\treturn jQuery.ajax(options)\n\t}\n\n\twpm.getOrderItemPrice = function (orderItem) {\n\t\treturn (orderItem.total + orderItem.total_tax) / orderItem.quantity\n\t}\n\n\twpm.hasLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\treturn data?.loginEventFired\n\t}\n\n\twpm.setLoginEventFired = function () {\n\t\tlet data = wpm.getWpmSessionData()\n\t\tdata[\"loginEventFired\"] = true\n\t\twpm.setWpmSessionData(data)\n\t}\n\n\twpm.wpmDataLayerExists = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (typeof wpmDataLayer !== \"undefined\") return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.jQueryExists = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForjQuery() {\n\t\t\t\tif (typeof jQuery !== \"undefined\") return resolve()\n\t\t\t\tsetTimeout(waitForjQuery, 100)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.pageLoaded = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.pageReady = function () {\n\t\treturn new Promise(function (resolve) {\n\t\t\t(function waitForVar() {\n\t\t\t\tif (\"interactive\" === document.readyState || \"complete\" === document.readyState) return resolve()\n\t\t\t\tsetTimeout(waitForVar, 50)\n\t\t\t})()\n\t\t})\n\t}\n\n\twpm.isMiniCartActive = function () {\n\t\tif (window.sessionStorage) {\n\t\t\tfor (const [key, value] of Object.entries(window.sessionStorage)) {\n\t\t\t\tif (key.includes(\"wc_fragments\")) {\n\t\t\t\t\treturn true\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t} else {\n\t\t\treturn false\n\t\t}\n\t}\n\n\twpm.doesWooCommerceCartExist = function () {\n\t\treturn document.cookie.includes(\"woocommerce_items_in_cart\")\n\t}\n\n\twpm.urlHasParameter = function (parameter) {\n\t\tlet urlParams = new URLSearchParams(window.location.search)\n\t\treturn urlParams.has(parameter)\n\t}\n\n}(window.wpm = window.wpm || {}, jQuery))\n","/**\n * Load all WPM functions\n *\n * Ignore event listeners. They need to be loaded after\n * we made sure that jQuery has been loaded.\n */\n\nrequire(\"./functions\")\n\n// #if process.env.TIER === 'premium'\n// require(\"./functions_premium\")\n// #endif\n","/**\n * After WPM is loaded\n * we first check if wpmDataLayer is loaded,\n * and as soon as it is, we load the pixels,\n * and as soon as the page load is complete,\n * we fire the wpmLoad event.\n *\n * @param {{pro:bool}} wpmDataLayer.version\n *\n * https://stackoverflow.com/a/25868457/4688612\n * https://stackoverflow.com/a/44093516/4688612\n */\n\nwpm.wpmDataLayerExists()\n\t.then(function () {\n\t\tconsole.log(\"WooCommerce Pixel Manager: \" + (wpmDataLayer.version.pro ? \"Pro\" : \"Free\") +\" Version \" + wpmDataLayer.version.number + \" loaded\")\n\t\tjQuery(document).trigger(\"wpmPreLoadPixels\", {})\n\t})\n\t.then(function () {\n\t\twpm.pageLoaded().then(function () {\n\t\t\tjQuery(document).trigger(\"wpmLoad\", {})\n\t\t})\n\t})\n\n\n\n/**\n * Run when page is ready\n *\n */\n\nwpm.pageReady().then(function () {\n\n\t/**\n\t * Run as soon as wpm namespace is loaded\n\t */\n\n\twpm.wpmDataLayerExists()\n\t\t.then(function () {\n\t\t\t// watch for products visible in viewport\n\t\t\twpm.startIntersectionObserverToWatch()\n\n\t\t\t// watch for lazy loaded products\n\t\t\twpm.startProductsMutationObserverToWatch()\n\t\t})\n})\n\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","/**\n * Load all essential scripts first\n */\n\nrequire(\"./wpm/functions_loader\")\n\n// Only load the event listeners after jQuery has been loaded for sure\nwpm.jQueryExists().then(function () {\n\n\trequire(\"./wpm/event_listeners\")\n\n\trequire(\"./google/loader\")\n\trequire(\"./facebook/loader\")\n\trequire(\"./hotjar/loader\")\n\n\n\t/**\n\t * Load all premium scripts\n\t */\n\n\t// #if process.env.TIER === 'premium'\n// \trequire(\"./microsoft-ads/loader\")\n// \trequire(\"./pinterest/loader\")\n// \trequire(\"./snapchat/loader\")\n// \trequire(\"./tiktok/loader\")\n// \trequire(\"./twitter/loader\")\n\t// #endif\n\n\n\t/**\n\t * Initiate WPM.\n\t *\n\t * It makes sure that the script flow gets executed correctly,\n\t * no matter how JS \"optimizers\" shuffle the code.\n\t */\n\n\trequire(\"./wpm/init\")\n})\n\n"],"names":["jQuery","document","on","wpmDataLayer","pixels","facebook","pixel_id","loaded","wpm","canIFire","loadFacebookPixel","event","product","eventId","getRandomEventId","fbq","content_type","content_name","name","content_ids","dyn_r_ids","dynamic_remarketing","id_type","value","parseFloat","quantity","price","currency","eventID","shop","trigger","event_name","event_id","user_data","getFbUserData","product_data","product_id","event_source_url","window","location","href","e","console","error","fbViewContent","setFbUserData","order","value_filtered","facebookContentIds","id","$","undefined","fBUserData","f","b","n","callMethod","apply","arguments","queue","push","_fbq","version","t","createElement","async","src","s","getElementsByTagName","parentNode","insertBefore","Math","random","toString","substring","getFbUserDataFromBrowser","fbp","getCookie","fbc","client_user_agent","navigator","userAgent","prodIds","key","item","Object","entries","items","general","variationsOutput","variation_id","String","products","require","isEmptyObject","google","ads","conversionIds","status","googleConfigConditionsMet","isVariable","send_events_with_parent_ids","gtagLoaded","then","gtag","send_to","getGoogleAdsConversionIdentifiers","google_business_vertical","getGoogleAdsDynamicRemarketingOrderItems","data_basic","data_with_cart","getGoogleAdsConversionIdentifiersWithLabel","transaction_id","number","new_customer","aw_merchant_id","discount","aw_feed_country","aw_feed_language","getGoogleAdsRegularOrderItems","conversionIdentifiers","orderItems","orderItem","analytics","universal","property_id","mp_active","affiliation","value_regular","tax","shipping","coupon","getGAUAOrderItems","category","join","variant","variant_name","brand","ga3AddListNameToProduct","item_data","productPosition","list_name","list_position","ga4","measurement_id","getGA4OrderItems","item_name","item_category","item_id","item_variant","item_brand","state","canGoogleLoad","loadGoogle","logPreventedPixelLoading","type","consent_mode","active","getConsentValues","mode","categories","includes","getVisitorConsentStatusAndUpdateGoogleConsentSettings","google_consent_settings","analytics_storage","ad_storage","updateGoogleConsentMode","cookie_consent_mgmt","explicit_consent","fireGtagGoogleAds","enhanced_conversions","phone_conversion_label","phone_conversion_number","keys","page_type","enhanced_conversion_data","fireGtagGoogleAnalyticsUA","parameters","fireGtagGoogleAnalyticsGA4","isGoogleActive","getGoogleGtagId","loadScriptAndCacheIt","done","script","textStatus","dataLayer","wait_for_update","region","ads_data_redaction","url_passthrough","linker","settings","Date","Promise","resolve","reject","startTime","wait","setTimeout","optimize","container_id","load_google_optimize_pixel","hotjar","site_id","load_hotjar_pixel","h","o","hj","q","_hjSettings","hjid","hjsv","a","r","appendChild","url","URL","this","attr","productId","getProductIdByCartItemKeyUrl","removeProductFromCart","data","addProductToCart","product_type","Number","val","each","find","classes","getPostIdFromString","one","target","closest","matches","match","nextAll","getIdBasedOndVariationsOutputSetting","Error","getProductDetailsFormattedForEvent","isEmail","fireCheckoutProgress","emailSelected","paymentMethodSelected","fireCheckoutOption","cart","getCartItemsFromBackend","variation","doesWooCommerceCartExist","getCartItems","productIds","getAddToCartLinkProductIds","getProductsFromBackend","referrer","referrerHostname","hostname","host","setCookie","wpmLoadFired","getMainProductIdFromProductPage","getProductDataForViewItemEvent","isOrderIdStored","writeOrderIdToStorage","user","hasLoginEventFired","setLoginEventFired","updateConsentCookieValues","wpmDeduper","wpmRestSettings","checkCookie","useRestEndpoint","isSessionStorageAvailable","isRestEndpointAvailable","isBelowRestErrorThreshold","sessionStorage","getItem","JSON","parse","testEndpoint","protocol","cookieName","ajax","timeout","statusCode","response","setItem","stringify","isWpmRestEndpointAvailable","orderId","Storage","localStorage","ids","expiresDate","setDate","getDate","cookie","toUTCString","storeOrderIdOnServer","orderDeduplication","log","email","test","quantityToRemove","isVariation","parentId","saveCartObjectToDataLayer","action","dataType","ajax_url","success","cartItems","filter","hasOwnProperty","length","assign","cartObject","step","checkout_option","string","triggerViewItemList","indexOf","viewItemListTriggerTestMode","css","append","viewItemListTrigger","opacity","backgroundColor","getSearchTermFromUrl","URLSearchParams","search","get","io","ioTimeouts","observerCallback","observer","forEach","entry","elementId","next","isIntersecting","testMode","repeat","unobserve","clearTimeout","remove","allIoElementsToWatch","ioid","startIntersectionObserverToWatch","urlHasParameter","IntersectionObserver","threshold","map","i","elem","parent","hasClass","prev","observe","startProductsMutationObserverToWatch","productsNode","parents","has","first","productsMutationObserver","attributes","childList","characterData","MutationObserver","mutations","mutation","newNodes","addedNodes","hasWpmProductIdElement","siblings","cookieValue","expiryDays","d","setTime","getTime","expires","ca","decodeURIComponent","split","c","charAt","getWpmSessionData","setWpmSessionData","order_id","nonce","cartItemKey","cartItemKeys","position","parentId_dyn_r_ids","setReferrerToCookie","getReferrerFromCookie","getClidFromBrowser","clidCookieId","clidId","gclid","dclid","getUserAgent","getViewPort","width","max","documentElement","clientWidth","innerWidth","height","clientHeight","innerHeight","getComplianzCookies","cmplz_statistics","cmplz_marketing","visitorHasChosen","getCookieLawInfoCookies","analyticsCookie","adsCookie","wpmConsentValues","setConsentValueCategories","explicitConsent","decodeURI","consents","statistics","marketing","thirdparty","advanced","setConsentDefaultValuesToExplicit","pixelName","canIFireMode","scriptTagObserver","node","shouldScriptBeActive","unblockScript","blockScript","head","subtree","addEventListener","disconnect","some","element","scriptNode","removeAttach","wpmSrc","appendTo","removeAttr","unblockAllScripts","index","unblockSelectedPixels","Cookiebot","consent","detail","huObserver","hu","body","options","extend","cache","getOrderItemPrice","total","total_tax","loginEventFired","wpmDataLayerExists","waitForVar","jQueryExists","waitForjQuery","pageLoaded","readyState","pageReady","isMiniCartActive","parameter","pro","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","__webpack_modules__"],"sourceRoot":""}
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== WooCommerce Pixel Manager ===
|
2 |
-
Contributors: alekv, wolfbaer
|
3 |
Tags: woocommerce, google ads, google analytics, facebook pixel, conversion tracking, dynamic retargeting, remarketing, meta pixel, facebook conversion api, woocommerce google, woocommerce facebook
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 5.9
|
6 |
Requires PHP: 7.3
|
7 |
-
Stable tag: 1.16.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -91,9 +91,9 @@ The plugin supports and works with following third party plugins.
|
|
91 |
* WooCommerce Composite Products
|
92 |
* WooCommerce Google Product Feed
|
93 |
* WooCommerce Wishlists
|
94 |
-
* YITH WooCommerce Brands
|
95 |
-
* YITH WooCommerce Wishlist
|
96 |
-
* Woo Discount Rules
|
97 |
* WP Marketing Robot Feed Manager
|
98 |
|
99 |
<strong>Documentation</strong>
|
@@ -186,6 +186,17 @@ You can send the link to the front page of your shop too if you think it would b
|
|
186 |
|
187 |
== Changelog ==
|
188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
189 |
= 1.16.8 = 14.04.2022
|
190 |
|
191 |
Tweak: Added more page type outputs (for better product list performance analysis in GA)
|
@@ -193,7 +204,6 @@ Tweak: Refactored GA3 and GA4 product data collection
|
|
193 |
Fix: Fix for view item events on single variation pages
|
194 |
|
195 |
|
196 |
-
|
197 |
= 1.16.6 = 11.04.2022
|
198 |
|
199 |
* Tweak: Safeguard for JavaScript optimizers that ignore the jQuery dependency of WPM and load jQuery after WPM
|
1 |
=== WooCommerce Pixel Manager ===
|
2 |
+
Contributors: alekv, welovesweetcode, wolfbaer
|
3 |
Tags: woocommerce, google ads, google analytics, facebook pixel, conversion tracking, dynamic retargeting, remarketing, meta pixel, facebook conversion api, woocommerce google, woocommerce facebook
|
4 |
Requires at least: 3.7
|
5 |
Tested up to: 5.9
|
6 |
Requires PHP: 7.3
|
7 |
+
Stable tag: 1.16.9
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
91 |
* WooCommerce Composite Products
|
92 |
* WooCommerce Google Product Feed
|
93 |
* WooCommerce Wishlists
|
94 |
+
* YITH WooCommerce Brands
|
95 |
+
* YITH WooCommerce Wishlist
|
96 |
+
* Woo Discount Rules
|
97 |
* WP Marketing Robot Feed Manager
|
98 |
|
99 |
<strong>Documentation</strong>
|
186 |
|
187 |
== Changelog ==
|
188 |
|
189 |
+
= 1.16.9 = 19.04.2022
|
190 |
+
|
191 |
+
|
192 |
+
* Tweak: Refactored some of the GA4 functions
|
193 |
+
* Tweak: Changed escaping method for outputting the titles and names into the wpmDataLayer in order to properly deal with characters like a dash, ampersand, etc.
|
194 |
+
* Tweak: Load categories for variations from parent product, because on some installs the variations don't inherit the parent product's categories
|
195 |
+
* Tweak: Removed more cruft from the code and improved the syntax here and there
|
196 |
+
* Tweak: Adjusted validation for the Google Merchant Center ID
|
197 |
+
* Tweak: Updated selectWoo.full.*.js
|
198 |
+
* Tweak: Tested up to WooCommerce 6.4
|
199 |
+
|
200 |
= 1.16.8 = 14.04.2022
|
201 |
|
202 |
Tweak: Added more page type outputs (for better product list performance analysis in GA)
|
204 |
Fix: Fix for view item events on single variation pages
|
205 |
|
206 |
|
|
|
207 |
= 1.16.6 = 11.04.2022
|
208 |
|
209 |
* Tweak: Safeguard for JavaScript optimizers that ignore the jQuery dependency of WPM and load jQuery after WPM
|
wgact.php
CHANGED
@@ -10,17 +10,17 @@
|
|
10 |
* Developer URI: https://sweetcode.com
|
11 |
* Text Domain: woocommerce-google-adwords-conversion-tracking-tag
|
12 |
* Domain path: /languages
|
13 |
-
* * Version: 1.16.
|
14 |
*
|
15 |
* WC requires at least: 3.7
|
16 |
-
* WC tested up to: 6.
|
17 |
*
|
18 |
* License: GNU General Public License v3.0
|
19 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
20 |
*
|
21 |
*
|
22 |
**/
|
23 |
-
const WPM_CURRENT_VERSION = '1.16.
|
24 |
// TODO export settings function
|
25 |
// TODO add option checkbox on uninstall and ask if user wants to delete options from db
|
26 |
|
10 |
* Developer URI: https://sweetcode.com
|
11 |
* Text Domain: woocommerce-google-adwords-conversion-tracking-tag
|
12 |
* Domain path: /languages
|
13 |
+
* * Version: 1.16.9
|
14 |
*
|
15 |
* WC requires at least: 3.7
|
16 |
+
* WC tested up to: 6.4
|
17 |
*
|
18 |
* License: GNU General Public License v3.0
|
19 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
20 |
*
|
21 |
*
|
22 |
**/
|
23 |
+
const WPM_CURRENT_VERSION = '1.16.9' ;
|
24 |
// TODO export settings function
|
25 |
// TODO add option checkbox on uninstall and ask if user wants to delete options from db
|
26 |
|