Driveback_DigitalDataLayer - Version 1.0.0

Version Notes

First stable version with most of required data structures.

Download this release

Release Info

Developer Driveback LLC
Extension Driveback_DigitalDataLayer
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

app/code/community/Driveback/DigitalDataLayer/Helper/Data.php ADDED
@@ -0,0 +1,133 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Driveback_DigitalDataLayer_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ const CONFIG_KEY_DIGITAL_DATA_MANAGER_ENABLED = 'driveback_ddl/digital_data_manager/enabled';
6
+ const CONFIG_KEY_DIGITAL_DATA_LAYER_ENABLED = 'driveback_ddl/settings/enabled';
7
+
8
+ /**
9
+ * @return bool
10
+ */
11
+ public function digitalDataManagerEnabled()
12
+ {
13
+ return Mage::getStoreConfigFlag(self::CONFIG_KEY_DIGITAL_DATA_MANAGER_ENABLED);
14
+ }
15
+
16
+ /**
17
+ * @return bool
18
+ */
19
+ public function digitalDataLayerEnabled()
20
+ {
21
+ return Mage::getStoreConfigFlag(self::CONFIG_KEY_DIGITAL_DATA_LAYER_ENABLED);
22
+ }
23
+
24
+ /**
25
+ * @return Driveback_DigitalDataLayer_Model_Ddl
26
+ */
27
+ public function getDdl()
28
+ {
29
+ return Mage::getSingleton('driveback_ddl/ddl');
30
+ }
31
+
32
+ /**
33
+ * @return string
34
+ */
35
+ public function getRequestPath()
36
+ {
37
+ $r = Mage::app()->getRequest();
38
+ $path = array($r->getRouteName(), $r->getControllerName(), $r->getActionName());
39
+ return implode('_', $path);
40
+ }
41
+
42
+ /**
43
+ * @return bool
44
+ */
45
+ public function isHomePage()
46
+ {
47
+ return 'cms_index_index' == $this->getRequestPath();
48
+ }
49
+
50
+ /**
51
+ * @return bool
52
+ */
53
+ public function isContentPage()
54
+ {
55
+ return 'cms_page_view' == $this->getRequestPath();
56
+ }
57
+
58
+ /**
59
+ * @return bool
60
+ */
61
+ public function isCategoryPage()
62
+ {
63
+ return 'catalog_category_view' == $this->getRequestPath();
64
+ }
65
+
66
+ /**
67
+ * @return bool
68
+ */
69
+ public function isSearchPage()
70
+ {
71
+ return 'catalogsearch_advanced_result' == $this->getRequestPath()
72
+ || 'catalogsearch_result_index' == $this->getRequestPath();
73
+ }
74
+
75
+ /**
76
+ * @return bool
77
+ */
78
+ public function isProductPage()
79
+ {
80
+ $p = Mage::registry('current_product');
81
+ return $p instanceof Mage_Catalog_Model_Product && $p->getId();
82
+ }
83
+
84
+ /**
85
+ * @return bool
86
+ */
87
+ public function isCartPage()
88
+ {
89
+ return 'checkout_cart_index' == $this->getRequestPath();
90
+ }
91
+
92
+ /**
93
+ * @return bool
94
+ */
95
+ public function isCheckoutPage()
96
+ {
97
+ $r = Mage::app()->getRequest();
98
+ return false !== strpos($r->getRouteName(), 'checkout') && 'success' != $r->getActionName();
99
+ }
100
+
101
+ public function isConfirmationPage()
102
+ {
103
+ /*
104
+ * default controllerName is "onepage"
105
+ * relax the check, only check if contains checkout
106
+ * somecheckout systems has different prefix/postfix,
107
+ * but all contains checkout
108
+ */
109
+ $r = Mage::app()->getRequest();
110
+ return false !== strpos($r->getRouteName(), 'checkout') && 'success' == $r->getActionName();
111
+ }
112
+
113
+ /**
114
+ * @param Mage_Customer_Model_Customer $customer
115
+ * @return bool
116
+ */
117
+ public function hasCustomerTransacted(Mage_Customer_Model_Customer $customer)
118
+ {
119
+ if (!$customer->getId()) {
120
+ return false;
121
+ }
122
+
123
+ /** @var Mage_Core_Model_Resource $r */
124
+ $r = Mage::getSingleton('core/resource');
125
+
126
+ $read = $r->getConnection('core_read');
127
+ $select = $read->select()
128
+ ->from($r->getTableName('sales/order'), array('c' => new Zend_Db_Expr('COUNT(*)')))
129
+ ->where('customer_id = ?', $customer->getId());
130
+
131
+ return $read->fetchOne($select) > 0;
132
+ }
133
+ }
app/code/community/Driveback/DigitalDataLayer/Model/Ddl.php ADDED
@@ -0,0 +1,381 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Class Driveback_DigitalDataLayer_Model_Ddl
5
+ *
6
+ * @method Driveback_DigitalDataLayer_Model_Ddl setVersion() setVersion(mixed $version)
7
+ * @method Driveback_DigitalDataLayer_Model_Ddl setEvents() setEvents(array $events)
8
+ * @method Driveback_DigitalDataLayer_Model_Ddl setProduct() setProduct($data)
9
+ * @method Driveback_DigitalDataLayer_Model_Ddl setPage() setPage($data)
10
+ * @method Driveback_DigitalDataLayer_Model_Ddl setUser() setUser($data)
11
+ * @method Driveback_DigitalDataLayer_Model_Ddl setListing() setListing($data)
12
+ * @method Driveback_DigitalDataLayer_Model_Ddl setCart() setCart($data)
13
+ * @method Driveback_DigitalDataLayer_Model_Ddl setTransaction() setTransaction($data)
14
+ * @method Driveback_DigitalDataLayer_Model_Ddl setMagentoVersion() setMagentoVersion(mixed $version)
15
+ */
16
+
17
+ class Driveback_DigitalDataLayer_Model_Ddl extends Varien_Object
18
+ {
19
+
20
+ /**
21
+ * This is the DDL specification Version
22
+ * @var string
23
+ */
24
+ protected $_version = "1.0.0";
25
+
26
+ protected function _construct()
27
+ {
28
+ $this
29
+ ->setVersion($this->_version)
30
+ ->setEvents(array())
31
+ ->_initUser()
32
+ ->_initPage();
33
+
34
+ if ($this->helper()->isProductPage()) {
35
+ $this->_initProduct();
36
+ }
37
+
38
+ if ($this->helper()->isCategoryPage() || $this->helper()->isSearchPage()) {
39
+ $this->_initListing();
40
+ }
41
+
42
+ if (!$this->helper()->isConfirmationPage()) {
43
+ $this->_initCart();
44
+ }
45
+
46
+ if ($this->helper()->isConfirmationPage()) {
47
+ $this->_initTransaction();
48
+ }
49
+ }
50
+
51
+ /**
52
+ * @return string json encoded DDL data
53
+ */
54
+ public function getDigitalData()
55
+ {
56
+ $data = $this->toArray(array('version', 'page', 'user', 'product', 'cart', 'listing', 'transaction', 'events'));
57
+
58
+ foreach ($data as $key => $value) {
59
+ if ($key !== 'events' && empty($data[$key])) {
60
+ unset($data[$key]);
61
+ }
62
+ }
63
+
64
+ $transport = new Varien_Object($data);
65
+ Mage::dispatchEvent('driveback_ddl_before_to_json', array('ddl' => $transport));
66
+
67
+ return Zend_Json::encode($transport->getData());
68
+ }
69
+
70
+ /**
71
+ * @return Driveback_DigitalDataLayer_Helper_Data
72
+ */
73
+ protected function helper() {
74
+ return Mage::helper('driveback_ddl');
75
+ }
76
+
77
+ protected function _initPage()
78
+ {
79
+ $breadcrumb = array();
80
+ foreach (Mage::helper('catalog')->getBreadcrumbPath() as $category) {
81
+ $breadcrumb[] = $category['label'];
82
+ }
83
+
84
+ if ($this->helper()->isHomePage()) {
85
+ $type = 'home';
86
+ } elseif ($this->helper()->isContentPage()) {
87
+ $type = 'content';
88
+ } elseif ($this->helper()->isCategoryPage()) {
89
+ $type = 'category';
90
+ } elseif ($this->helper()->isSearchPage()) {
91
+ $type = 'search';
92
+ } elseif ($this->helper()->isProductPage()) {
93
+ $type = 'product';
94
+ } elseif ($this->helper()->isCartPage()) {
95
+ $type = 'cart';
96
+ } elseif ($this->helper()->isCheckoutPage()) {
97
+ $type = 'checkout';
98
+ } elseif ($this->helper()->isConfirmationPage()) {
99
+ $type = 'confirmation';
100
+ } else {
101
+ $type = trim(Mage::app()->getRequest()->getRequestUri(), '/');
102
+ }
103
+
104
+ $page = array(
105
+ 'type' => $type,
106
+ 'breadcrumb' => $breadcrumb,
107
+ );
108
+
109
+ if ($type === 'category') {
110
+ $page = array_merge($page, array(
111
+ 'categoryId' => Mage::registry('current_category')->getId()
112
+ ));
113
+ }
114
+
115
+ $this->setPage($page);
116
+
117
+ return $this;
118
+ }
119
+
120
+ protected function _initUser()
121
+ {
122
+ /** @var Mage_Customer_Model_Customer $user */
123
+ $user = Mage::helper('customer')->getCustomer();
124
+
125
+ if ($this->helper()->isConfirmationPage()) {
126
+ if ($orderId = Mage::getSingleton('checkout/session')->getLastOrderId()) {
127
+ $order = Mage::getModel('sales/order')->load($orderId);
128
+ $email = $order->getCustomerEmail();
129
+ $firstName = $order->getCustomerFirstname();
130
+ $lastName = $order->getCustomerLastname();
131
+ }
132
+ } else {
133
+ $email = $user->getEmail();
134
+ $firstName = $user->getFirstname();
135
+ $lastName = $user->getLastname();
136
+ }
137
+
138
+ $data = array();
139
+ if (!empty($email)) {
140
+ $data['email'] = $email;
141
+ }
142
+
143
+ if (!empty($firstName)) {
144
+ $data['firstName'] = $firstName;
145
+ }
146
+ if (!empty($lastName)) {
147
+ $data['lastName'] = $lastName;
148
+ }
149
+
150
+ $data['hasTransacted'] = false;
151
+ if ($user->getId()) {
152
+ $data['userId'] = (string)$user->getId();
153
+ $data['hasTransacted'] = $this->helper()->hasCustomerTransacted($user);
154
+ }
155
+
156
+ $data['customerGroup'] = Mage::getSingleton('customer/session')->getCustomerGroupId();
157
+ $data['isReturning'] = $user->getId() ? true : false;
158
+ $data['language'] = Mage::getStoreConfig('general/locale/code');
159
+
160
+ $this->setUser($data);
161
+ return $this;
162
+ }
163
+
164
+ /**
165
+ * @param Mage_Customer_Model_Address_Abstract $address
166
+ * @return array
167
+ */
168
+ protected function _getAddressData(Mage_Customer_Model_Address_Abstract $address)
169
+ {
170
+ $data = array();
171
+ if ($address) {
172
+ $data['firstName'] = $address->getFirstname();
173
+ $data['lastName'] = $address->getLastname();
174
+ $data['address'] = $address->getStreetFull();
175
+ $data['city'] = $address->getCity();
176
+ $data['postalCode'] = $address->getPostcode();
177
+ $data['country'] = $address->getCountry();
178
+ $data['stateProvince'] = $address->getRegion() ? $address->getRegion() : '';
179
+ }
180
+
181
+ return $data;
182
+ }
183
+
184
+ /**
185
+ * @return string
186
+ */
187
+ protected function _getCurrency()
188
+ {
189
+ return Mage::app()->getStore()->getCurrentCurrencyCode();
190
+ }
191
+
192
+ /**
193
+ * @param Mage_Catalog_Model_Product $product
194
+ * @return array
195
+ */
196
+ public function getProductData(Mage_Catalog_Model_Product $product)
197
+ {
198
+ $data = array(
199
+ 'id' => $product->getId(),
200
+ 'url' => $product->getProductUrl(),
201
+ 'imageUrl' => (string)Mage::helper('catalog/image')->init($product, 'image')->resize(265),
202
+ 'thumbnailUrl' => (string)Mage::helper('catalog/image')->init($product, 'thumbnail')->resize(75, 75),
203
+ 'name' => $product->getName(),
204
+ 'unitPrice' => (float)$product->getPrice(),
205
+ 'unitSalePrice' => (float)$product->getFinalPrice(),
206
+ 'currency' => $this->_getCurrency(),
207
+ 'description' => strip_tags($product->getShortDescription()),
208
+ 'skuCode' => $product->getSku()
209
+ );
210
+
211
+ $data['stock'] = (int)Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty();
212
+
213
+ $catIndex = $catNames = array();
214
+ $limit = 2; $k = 0;
215
+ foreach ($product->getCategoryIds() as $catId) {
216
+ if (++$k > $limit) {
217
+ break;
218
+ }
219
+ if (!isset($catIndex[$catId])) {
220
+ $catIndex[$catId] = Mage::getModel('catalog/category')->load($catId);
221
+ }
222
+ $catNames[] = $catIndex[$catId]->getName();
223
+ }
224
+
225
+ if (isset($catNames[0])) {
226
+ $data['category'] = $catNames[0];
227
+ }
228
+ if (isset($catNames[1])) {
229
+ $data['subcategory'] = $catNames[1];
230
+ }
231
+
232
+ return $data;
233
+ }
234
+
235
+ protected function _getLineItems($items, $pageType)
236
+ {
237
+ $data = array();
238
+ foreach ($items as $item) {
239
+ /** @var Mage_Catalog_Model_Product $product */
240
+ $product = Mage::getModel('catalog/product')->load($item->getProductId());
241
+ // product needs to be visible
242
+ if (!$product->isVisibleInSiteVisibility()) {
243
+ continue;
244
+ }
245
+
246
+ $line = array();
247
+ $line['product'] = $this->getProductData($product);
248
+ $line['subtotal'] = (float)$item->getRowTotalInclTax();
249
+ $line['totalDiscount'] = (float)$item->getDiscountAmount();
250
+
251
+ $line['quantity'] = $pageType == 'cart' ? (float)$item->getQty() : (float)$item->getQtyOrdered();
252
+
253
+ $line['product']['unitSalePrice'] -= $line['totalDiscount'] / $line['quantity'];
254
+
255
+ $data[] = $line;
256
+ }
257
+
258
+ return $data;
259
+ }
260
+
261
+ /**
262
+ * None of the listing variables can be properly set here
263
+ * since the product collection is being loaded
264
+ * in the Mage_Catalog_Block_Product_List::_beforeToHtml method
265
+ *
266
+ * @see Driveback_DigitalDataLayer_Model_Observer::processListingData
267
+ */
268
+ protected function _initListing()
269
+ {
270
+ $data = array();
271
+ if ($this->helper()->isSearchPage()) {
272
+ $data['query'] = Mage::helper('catalogsearch')->getQueryText();
273
+ }
274
+
275
+ $this->setListing($data);
276
+ return $this;
277
+ }
278
+
279
+ protected function _initProduct()
280
+ {
281
+ $product = Mage::registry('current_product');
282
+ if (!$product instanceof Mage_Catalog_Model_Product || !$product->getId()) {
283
+ return false;
284
+ }
285
+
286
+ $this->setProduct($this->getProductData($product));
287
+ return $this;
288
+ }
289
+
290
+ protected function _initCart()
291
+ {
292
+ /** @var Mage_Sales_Model_Quote $quote */
293
+ $quote = Mage::getSingleton('checkout/session')->getQuote();
294
+
295
+ if ($quote->getItemsCount() > 0) {
296
+
297
+ $data = array();
298
+ if ($quote->getId()) {
299
+ $data['id'] = (string)$quote->getId();
300
+ }
301
+
302
+ $data['currency'] = $this->_getCurrency();
303
+ $data['subtotal'] = (float)$quote->getSubtotal();
304
+ $data['tax'] = (float)$quote->getShippingAddress()->getTaxAmount();
305
+ $data['subtotalIncludeTax'] = (boolean)$this->_doesSubtotalIncludeTax($quote, $data['tax']);
306
+ $data['shippingCost'] = (float)$quote->getShippingAmount();
307
+ $data['shippingMethod'] = $quote->getShippingMethod() ? $quote->getShippingMethod() : '';
308
+ $data['total'] = (float)$quote->getGrandTotal();
309
+ $data['lineItems'] = $this->_getLineItems($quote->getAllVisibleItems(), 'cart');
310
+ } else {
311
+ $data['subtotal'] = 0;
312
+ $data['total'] = 0;
313
+ $data['lineItems'] = array();
314
+ }
315
+
316
+ $this->setCart($data);
317
+ return $this;
318
+ }
319
+
320
+ /**
321
+ * @param $order
322
+ * @param $tax
323
+ * @return bool
324
+ */
325
+ protected function _doesSubtotalIncludeTax($order, $tax)
326
+ {
327
+ /* Conditions:
328
+ - if tax is zero, then set to false
329
+ - Assume that if grand total is bigger than total after subtracting shipping, then subtotal does NOT include tax
330
+ */
331
+ $grandTotalWithoutShipping = $order->getGrandTotal() - $order->getShippingAmount();
332
+ return !($tax == 0 || $grandTotalWithoutShipping > $order->getSubtotal());
333
+ }
334
+
335
+ protected function _initTransaction()
336
+ {
337
+ $orderId = Mage::getSingleton('checkout/session')->getLastOrderId();
338
+ if (!$orderId) {
339
+ return $this;
340
+ }
341
+
342
+ /** @var Mage_Sales_Model_Order $order */
343
+ $order = Mage::getModel('sales/order')->load($orderId);
344
+
345
+ $transaction = array();
346
+
347
+ $transaction['orderId'] = $order->getIncrementId();
348
+ $transaction['currency'] = $this->_getCurrency();
349
+ $transaction['subtotal'] = (float)$order->getSubtotal();
350
+ $transaction['tax'] = (float)$order->getTaxAmount();
351
+ $transaction['subtotalIncludeTax'] = $this->_doesSubtotalIncludeTax($order, $transaction['tax']);
352
+ $transaction['paymentType'] = $order->getPayment()->getMethodInstance()->getTitle();
353
+ $transaction['total'] = (float)$order->getGrandTotal();
354
+
355
+ if ($order->getCouponCode()) {
356
+ $transaction['voucher'] = array($order->getCouponCode());
357
+ }
358
+
359
+ if ($order->getDiscountAmount() > 0) {
360
+ $transaction['voucherDiscount'] = -1 * $order->getDiscountAmount();
361
+ }
362
+
363
+ $transaction['shippingCost'] = (float)$order->getShippingAmount();
364
+ $transaction['shippingMethod'] = $order->getShippingMethod() ? $order->getShippingMethod() : '';
365
+
366
+ // Get addresses
367
+ $shippingAddress = $order->getShippingAddress();
368
+ if ($shippingAddress instanceof Mage_Sales_Model_Order_Address) {
369
+ $transaction['delivery'] = $this->_getAddressData($shippingAddress);
370
+ }
371
+
372
+ $transaction['billing'] = $this->_getAddressData($order->getBillingAddress());
373
+
374
+ // Get items
375
+ $transaction['lineItems'] = $this->_getLineItems($order->getAllVisibleItems(), 'transaction');
376
+
377
+ $this->setTransaction($transaction);
378
+ return $this;
379
+ }
380
+
381
+ }
app/code/community/Driveback/DigitalDataLayer/Model/Observer.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Driveback_DigitalDataLayer_Model_Observer
4
+ {
5
+ /**
6
+ * Observes controller_action_layout_render_before
7
+ * @param Varien_Event_Observer $observer
8
+ */
9
+ public function processListingData(Varien_Event_Observer $observer)
10
+ {
11
+ /** @var Driveback_DigitalDataLayer_Helper_Data $helper */
12
+ $helper = Mage::helper('driveback_ddl');
13
+
14
+ $layout = Mage::app()->getLayout();
15
+
16
+ /** @var Mage_Catalog_Block_Product_List $block */
17
+ $block = $layout->getBlock('product_list');
18
+ if (!$block instanceof Mage_Catalog_Block_Product_List) {
19
+ $block = $layout->getBlock('search_result_list');
20
+ if (!$block instanceof Mage_Catalog_Block_Product_List) {
21
+ return;
22
+ }
23
+ }
24
+
25
+ $ddl = $helper->getDdl();
26
+ $listing = $ddl->getListing();
27
+
28
+ /** @var Mage_Catalog_Model_Resource_Product_Collection $collection */
29
+ $collection = $block->getLoadedProductCollection();
30
+
31
+ $listing['resultCount'] = $collection->getSize();
32
+ $listing['items'] = array();
33
+ foreach($collection as $product) {
34
+ $listing['items'][] = $ddl->getProductData($product);
35
+ }
36
+
37
+ $toolbar = $block->getToolbarBlock();
38
+ $listing['sortBy'] = $toolbar->getCurrentOrder() . '_' . $toolbar->getCurrentDirection();
39
+ $listing['layout'] = $toolbar->getCurrentMode();
40
+
41
+ $ddl->setListing($listing);
42
+ }
43
+ }
app/code/community/Driveback/DigitalDataLayer/etc/adminhtml.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <config>
3
+ <acl>
4
+ <resources>
5
+ <admin>
6
+ <children>
7
+ <system>
8
+ <children>
9
+ <config>
10
+ <children>
11
+ <driveback_ddl translate="title" module="driveback_ddl">
12
+ <sort_order>1000</sort_order>
13
+ <title>Manage Digital Data Layer</title>
14
+ </driveback_ddl>
15
+ </children>
16
+ </config>
17
+ </children>
18
+ </system>
19
+ </children>
20
+ </admin>
21
+ </resources>
22
+ </acl>
23
+ </config>
app/code/community/Driveback/DigitalDataLayer/etc/config.xml ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Driveback_DigitalDataLayer>
5
+ <version>0.0.1</version>
6
+ </Driveback_DigitalDataLayer>
7
+ </modules>
8
+
9
+ <global>
10
+ <models>
11
+ <driveback_ddl>
12
+ <class>Driveback_DigitalDataLayer_Model</class>
13
+ </driveback_ddl>
14
+ </models>
15
+ <helpers>
16
+ <driveback_ddl>
17
+ <class>Driveback_DigitalDataLayer_Helper</class>
18
+ </driveback_ddl>
19
+ </helpers>
20
+ </global>
21
+
22
+ <frontend>
23
+ <layout>
24
+ <updates>
25
+ <driveback_digital_data_layer>
26
+ <file>driveback/ddl.xml</file>
27
+ </driveback_digital_data_layer>
28
+ </updates>
29
+ </layout>
30
+ <translate>
31
+ <modules>
32
+ <Driveback_DigitalDataLayer>
33
+ <files>
34
+ <default>Driveback_DigitalDataLayer.csv</default>
35
+ </files>
36
+ </Driveback_DigitalDataLayer>
37
+ </modules>
38
+ </translate>
39
+ <events>
40
+ <controller_action_layout_render_before>
41
+ <observers>
42
+ <driveback_ddl_process_listing_data>
43
+ <class>driveback_ddl/observer</class>
44
+ <method>processListingData</method>
45
+ </driveback_ddl_process_listing_data>
46
+ </observers>
47
+ </controller_action_layout_render_before>
48
+ </events>
49
+ </frontend>
50
+
51
+ <adminhtml>
52
+ <translate>
53
+ <modules>
54
+ <Driveback_DigitalDataLayer>
55
+ <files>
56
+ <default>Driveback_DigitalDataLayer.csv</default>
57
+ </files>
58
+ </Driveback_DigitalDataLayer>
59
+ </modules>
60
+ </translate>
61
+ </adminhtml>
62
+
63
+ <default>
64
+ <driveback_ddl>
65
+ <settings>
66
+ <enabled>1</enabled>
67
+ </settings>
68
+ <digital_data_manager>
69
+ <enabled>1</enabled>
70
+ </digital_data_manager>
71
+ </driveback_ddl>
72
+ </default>
73
+ </config>
app/code/community/Driveback/DigitalDataLayer/etc/system.xml ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <driveback_ddl translate="label">
5
+ <label>Digital Data Layer</label>
6
+ <sort_order>1000</sort_order>
7
+ </driveback_ddl>
8
+ </tabs>
9
+
10
+ <sections>
11
+ <driveback_ddl translate="label">
12
+ <label>Configuration</label>
13
+ <tab>driveback_ddl</tab>
14
+ <frontend_type>text</frontend_type>
15
+ <sort_order>10</sort_order>
16
+ <show_in_default>1</show_in_default>
17
+ <show_in_website>1</show_in_website>
18
+ <show_in_store>1</show_in_store>
19
+
20
+ <groups>
21
+ <settings translate="label">
22
+ <label>Digital Data Layer Configuration</label>
23
+ <sort_order>1</sort_order>
24
+ <show_in_default>1</show_in_default>
25
+ <show_in_website>1</show_in_website>
26
+ <show_in_store>1</show_in_store>
27
+ <fields>
28
+ <enabled translate="label comment">
29
+ <label>Enable Digital Data Layer</label>
30
+ <frontend_type>select</frontend_type>
31
+ <source_model>adminhtml/system_config_source_yesno</source_model>
32
+ <sort_order>1</sort_order>
33
+ <show_in_default>1</show_in_default>
34
+ <show_in_website>1</show_in_website>
35
+ <show_in_store>1</show_in_store>
36
+ </enabled>
37
+ </fields>
38
+ </settings>
39
+
40
+ <digital_data_manager translate="label">
41
+ <label>Digital Data Manager Configuration</label>
42
+ <sort_order>2</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ <fields>
47
+ <enabled translate="label">
48
+ <label>Enable Digital Data Manager</label>
49
+ <frontend_type>select</frontend_type>
50
+ <source_model>adminhtml/system_config_source_yesno</source_model>
51
+ <sort_order>1</sort_order>
52
+ <show_in_default>1</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ </enabled>
56
+ </fields>
57
+ </digital_data_manager>
58
+
59
+ </groups>
60
+ </driveback_ddl>
61
+ </sections>
62
+ </config>
app/design/frontend/base/default/layout/driveback/ddl.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <layout version="0.1.0">
4
+ <default>
5
+ <reference name="head">
6
+ <block type="core/template" name="driveback_ddl" template="driveback/ddl.phtml"/>
7
+ </reference>
8
+ </default>
9
+ </layout>
app/design/frontend/base/default/template/driveback/ddl.phtml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* @var $helper Driveback_DigitalDataLayer_Helper_Data */
3
+ $helper = $this->helper('driveback_ddl');
4
+
5
+ $ddl = $helper->getDdl();
6
+ ?>
7
+
8
+ <?php if ($helper->digitalDataLayerEnabled()): ?>
9
+ <script type="text/javascript">
10
+ (function () {
11
+ var digitalDataTemp = <?php echo $ddl->getDigitalData(); ?>;
12
+ window.digitalData = $H(window.digitalData || {}).merge(digitalDataTemp).toObject();
13
+ })();
14
+ </script>
15
+ <?php endif;?>
16
+ <?php if ($helper->digitalDataManagerEnabled()): ?>
17
+ <script type="text/javascript">
18
+ (function(){var a=window.ddManager=window.ddManager||[];window.ddListener=window.ddListener||[];var b=window.digitalData=window.digitalData||{};b.events=b.events||[];if(!a.initialize)if(a.invoked)window.console&&console.error&&console.error("Digital Data Manager snippet included twice.");else for(a.invoked=!0,a.methods=["initialize","addIntegration","on","once","off"],a.factory=function(b){return function(){var c=Array.prototype.slice.call(arguments);c.unshift(b);a.push(c);return a}},b=0;b<a.methods.length;b++){var c=
19
+ a.methods[b];a[c]=a.factory(c)}})();
20
+ </script>
21
+ <script type="text/javascript" src="/js/driveback/dd-manager.min.js" async defer></script>
22
+ <?php endif;?>
app/etc/modules/Driveback_DigitalDataLayer.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version = "1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Driveback_DigitalDataLayer>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </Driveback_DigitalDataLayer>
8
+ </modules>
9
+ </config>
app/locale/en_US/Driveback_DigitalDataLayer.csv ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ Digital Data Layer,Digital Data Layer
2
+ Configuration,Configuration
3
+ Digital Data Layer Configuration,Digital Data Layer Configuration
4
+ Enable Digital Data Layer,Enable Digital Data Layer
5
+ Digital Data Manager Configuration,Digital Data Manager Configuration
6
+ Enable Digital Data Manager,Enable Digital Data Manager
7
+ Manage Digital Data Layer,Manage Digital Data Layer
app/locale/ru_RU/Driveback_DigitalDataLayer.csv ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ Digital Data Layer,Digital Data Layer
2
+ Configuration,Конфигурация
3
+ Digital Data Layer Configuration,Конфигурация Digital Data Layer
4
+ Enable Digital Data Layer,Включить Digital Data Layer
5
+ Digital Data Manager Configuration,Конфигурация Digital Data Manager
6
+ Enable Digital Data Manager,Включить Digital Data Manager
7
+ Manage Digital Data Layer,Управление Digital Data Layer
js/driveback/dd-manager.min.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ !function t(e,n,r){function o(a,u){if(!n[a]){if(!e[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[a]={exports:{}};e[a][0].call(f.exports,function(t){var n=e[a][1][t];return o(n?n:t)},f,f.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(t,e,n){(function(t,n){!function(){function r(){}function o(t){return t}function i(t){return!!t}function a(t){return!t}function u(t){return function(){if(null===t)throw new Error("Callback was already called.");t.apply(this,arguments),t=null}}function s(t){return function(){null!==t&&(t.apply(this,arguments),t=null)}}function c(t){return U(t)||"number"==typeof t.length&&t.length>=0&&t.length%1===0}function f(t,e){for(var n=-1,r=t.length;++n<r;)e(t[n],n,t)}function l(t,e){for(var n=-1,r=t.length,o=Array(r);++n<r;)o[n]=e(t[n],n,t);return o}function d(t){return l(Array(t),function(t,e){return e})}function p(t,e,n){return f(t,function(t,r,o){n=e(n,t,r,o)}),n}function h(t,e){f(Y(t),function(n){e(t[n],n)})}function g(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return n;return-1}function y(t){var e,n,r=-1;return c(t)?(e=t.length,function(){return r++,e>r?r:null}):(n=Y(t),e=n.length,function(){return r++,e>r?n[r]:null})}function v(t,e){return e=null==e?t.length-1:+e,function(){for(var n=Math.max(arguments.length-e,0),r=Array(n),o=0;n>o;o++)r[o]=arguments[o+e];switch(e){case 0:return t.call(this,r);case 1:return t.call(this,arguments[0],r)}}}function w(t){return function(e,n,r){return t(e,r)}}function m(t){return function(e,n,o){o=s(o||r),e=e||[];var i=y(e);if(0>=t)return o(null);var a=!1,c=0,f=!1;!function l(){if(a&&0>=c)return o(null);for(;t>c&&!f;){var r=i();if(null===r)return a=!0,void(0>=c&&o(null));c+=1,n(e[r],r,u(function(t){c-=1,t?(o(t),f=!0):l()}))}}()}}function b(t){return function(e,n,r){return t(B.eachOf,e,n,r)}}function E(t){return function(e,n,r,o){return t(m(n),e,r,o)}}function _(t){return function(e,n,r){return t(B.eachOfSeries,e,n,r)}}function A(t,e,n,o){o=s(o||r),e=e||[];var i=c(e)?[]:{};t(e,function(t,e,r){n(t,function(t,n){i[e]=n,r(t)})},function(t){o(t,i)})}function j(t,e,n,r){var o=[];t(e,function(t,e,r){n(t,function(n){n&&o.push({index:e,value:t}),r()})},function(){r(l(o.sort(function(t,e){return t.index-e.index}),function(t){return t.value}))})}function k(t,e,n,r){j(t,e,function(t,e){n(t,function(t){e(!t)})},r)}function I(t,e,n){return function(r,o,i,a){function u(){a&&a(n(!1,void 0))}function s(t,r,o){return a?void i(t,function(r){a&&e(r)&&(a(n(!0,t)),a=i=!1),o()}):o()}arguments.length>3?t(r,o,s,u):(a=i,i=o,t(r,s,u))}}function O(t,e){return e}function P(t,e,n){n=n||r;var o=c(e)?[]:{};t(e,function(t,e,n){t(v(function(t,r){r.length<=1&&(r=r[0]),o[e]=r,n(t)}))},function(t){n(t,o)})}function S(t,e,n,r){var o=[];t(e,function(t,e,r){n(t,function(t,e){o=o.concat(e||[]),r(t)})},function(t){r(t,o)})}function $(t,e,n){function o(t,e,n,o){if(null!=o&&"function"!=typeof o)throw new Error("task callback must be a function");return t.started=!0,U(e)||(e=[e]),0===e.length&&t.idle()?B.setImmediate(function(){t.drain()}):(f(e,function(e){var i={data:e,callback:o||r};n?t.tasks.unshift(i):t.tasks.push(i),t.tasks.length===t.concurrency&&t.saturated()}),void B.setImmediate(t.process))}function i(t,e){return function(){a-=1;var n=!1,r=arguments;f(e,function(t){f(s,function(e,r){e!==t||n||(s.splice(r,1),n=!0)}),t.callback.apply(t,r)}),t.tasks.length+a===0&&t.drain(),t.process()}}if(null==e)e=1;else if(0===e)throw new Error("Concurrency must not be zero");var a=0,s=[],c={tasks:[],concurrency:e,payload:n,saturated:r,empty:r,drain:r,started:!1,paused:!1,push:function(t,e){o(c,t,!1,e)},kill:function(){c.drain=r,c.tasks=[]},unshift:function(t,e){o(c,t,!0,e)},process:function(){if(!c.paused&&a<c.concurrency&&c.tasks.length)for(;a<c.concurrency&&c.tasks.length;){var e=c.payload?c.tasks.splice(0,c.payload):c.tasks.splice(0,c.tasks.length),n=l(e,function(t){return t.data});0===c.tasks.length&&c.empty(),a+=1,s.push(e[0]);var r=u(i(c,e));t(n,r)}},length:function(){return c.tasks.length},running:function(){return a},workersList:function(){return s},idle:function(){return c.tasks.length+a===0},pause:function(){c.paused=!0},resume:function(){if(c.paused!==!1){c.paused=!1;for(var t=Math.min(c.concurrency,c.tasks.length),e=1;t>=e;e++)B.setImmediate(c.process)}}};return c}function D(t){return v(function(e,n){e.apply(null,n.concat([v(function(e,n){"object"==typeof console&&(e?console.error&&console.error(e):console[t]&&f(n,function(e){console[t](e)}))})]))})}function x(t){return function(e,n,r){t(d(e),n,r)}}function T(t){return v(function(e,n){var r=v(function(n){var r=this,o=n.pop();return t(e,function(t,e,o){t.apply(r,n.concat([o]))},o)});return n.length?r.apply(this,n):r})}function L(t){return v(function(e){var n=e.pop();e.push(function(){var t=arguments;r?B.setImmediate(function(){n.apply(null,t)}):n.apply(null,t)});var r=!0;t.apply(this,e),r=!1})}var R,B={},M="object"==typeof self&&self.self===self&&self||"object"==typeof n&&n.global===n&&n||this;null!=M&&(R=M.async),B.noConflict=function(){return M.async=R,B};var C=Object.prototype.toString,U=Array.isArray||function(t){return"[object Array]"===C.call(t)},N=function(t){var e=typeof t;return"function"===e||"object"===e&&!!t},Y=Object.keys||function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e},F="function"==typeof setImmediate&&setImmediate,V=F?function(t){F(t)}:function(t){setTimeout(t,0)};"object"==typeof t&&"function"==typeof t.nextTick?B.nextTick=t.nextTick:B.nextTick=V,B.setImmediate=F?V:B.nextTick,B.forEach=B.each=function(t,e,n){return B.eachOf(t,w(e),n)},B.forEachSeries=B.eachSeries=function(t,e,n){return B.eachOfSeries(t,w(e),n)},B.forEachLimit=B.eachLimit=function(t,e,n,r){return m(e)(t,w(n),r)},B.forEachOf=B.eachOf=function(t,e,n){function o(t){c--,t?n(t):null===i&&0>=c&&n(null)}n=s(n||r),t=t||[];for(var i,a=y(t),c=0;null!=(i=a());)c+=1,e(t[i],i,u(o));0===c&&n(null)},B.forEachOfSeries=B.eachOfSeries=function(t,e,n){function o(){var r=!0;return null===a?n(null):(e(t[a],a,u(function(t){if(t)n(t);else{if(a=i(),null===a)return n(null);r?B.setImmediate(o):o()}})),void(r=!1))}n=s(n||r),t=t||[];var i=y(t),a=i();o()},B.forEachOfLimit=B.eachOfLimit=function(t,e,n,r){m(e)(t,n,r)},B.map=b(A),B.mapSeries=_(A),B.mapLimit=E(A),B.inject=B.foldl=B.reduce=function(t,e,n,r){B.eachOfSeries(t,function(t,r,o){n(e,t,function(t,n){e=n,o(t)})},function(t){r(t,e)})},B.foldr=B.reduceRight=function(t,e,n,r){var i=l(t,o).reverse();B.reduce(i,e,n,r)},B.transform=function(t,e,n,r){3===arguments.length&&(r=n,n=e,e=U(t)?[]:{}),B.eachOf(t,function(t,r,o){n(e,t,r,o)},function(t){r(t,e)})},B.select=B.filter=b(j),B.selectLimit=B.filterLimit=E(j),B.selectSeries=B.filterSeries=_(j),B.reject=b(k),B.rejectLimit=E(k),B.rejectSeries=_(k),B.any=B.some=I(B.eachOf,i,o),B.someLimit=I(B.eachOfLimit,i,o),B.all=B.every=I(B.eachOf,a,a),B.everyLimit=I(B.eachOfLimit,a,a),B.detect=I(B.eachOf,o,O),B.detectSeries=I(B.eachOfSeries,o,O),B.detectLimit=I(B.eachOfLimit,o,O),B.sortBy=function(t,e,n){function r(t,e){var n=t.criteria,r=e.criteria;return r>n?-1:n>r?1:0}B.map(t,function(t,n){e(t,function(e,r){e?n(e):n(null,{value:t,criteria:r})})},function(t,e){return t?n(t):void n(null,l(e.sort(r),function(t){return t.value}))})},B.auto=function(t,e,n){function o(t){y.unshift(t)}function i(t){var e=g(y,t);e>=0&&y.splice(e,1)}function a(){c--,f(y.slice(0),function(t){t()})}n||(n=e,e=null),n=s(n||r);var u=Y(t),c=u.length;if(!c)return n(null);e||(e=c);var l={},d=0,y=[];o(function(){c||n(null,l)}),f(u,function(r){function u(){return e>d&&p(w,function(t,e){return t&&l.hasOwnProperty(e)},!0)&&!l.hasOwnProperty(r)}function s(){u()&&(d++,i(s),f[f.length-1](y,l))}for(var c,f=U(t[r])?t[r]:[t[r]],y=v(function(t,e){if(d--,e.length<=1&&(e=e[0]),t){var o={};h(l,function(t,e){o[e]=t}),o[r]=e,n(t,o)}else l[r]=e,B.setImmediate(a)}),w=f.slice(0,f.length-1),m=w.length;m--;){if(!(c=t[w[m]]))throw new Error("Has inexistant dependency");if(U(c)&&g(c,r)>=0)throw new Error("Has cyclic dependencies")}u()?(d++,f[f.length-1](y,l)):o(s)})},B.retry=function(t,e,n){function r(t,e){if("number"==typeof e)t.times=parseInt(e,10)||i;else{if("object"!=typeof e)throw new Error("Unsupported argument type for 'times': "+typeof e);t.times=parseInt(e.times,10)||i,t.interval=parseInt(e.interval,10)||a}}function o(t,e){function n(t,n){return function(r){t(function(t,e){r(!t||n,{err:t,result:e})},e)}}function r(t){return function(e){setTimeout(function(){e(null)},t)}}for(;s.times;){var o=!(s.times-=1);u.push(n(s.task,o)),!o&&s.interval>0&&u.push(r(s.interval))}B.series(u,function(e,n){n=n[n.length-1],(t||s.callback)(n.err,n.result)})}var i=5,a=0,u=[],s={times:i,interval:a},c=arguments.length;if(1>c||c>3)throw new Error("Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)");return 2>=c&&"function"==typeof t&&(n=e,e=t),"function"!=typeof t&&r(s,t),s.callback=n,s.task=e,s.callback?o():o},B.waterfall=function(t,e){function n(t){return v(function(r,o){if(r)e.apply(null,[r].concat(o));else{var i=t.next();i?o.push(n(i)):o.push(e),L(t).apply(null,o)}})}if(e=s(e||r),!U(t)){var o=new Error("First argument to waterfall must be an array of functions");return e(o)}return t.length?void n(B.iterator(t))():e()},B.parallel=function(t,e){P(B.eachOf,t,e)},B.parallelLimit=function(t,e,n){P(m(e),t,n)},B.series=function(t,e){P(B.eachOfSeries,t,e)},B.iterator=function(t){function e(n){function r(){return t.length&&t[n].apply(null,arguments),r.next()}return r.next=function(){return n<t.length-1?e(n+1):null},r}return e(0)},B.apply=v(function(t,e){return v(function(n){return t.apply(null,e.concat(n))})}),B.concat=b(S),B.concatSeries=_(S),B.whilst=function(t,e,n){if(n=n||r,t()){var o=v(function(r,i){r?n(r):t.apply(this,i)?e(o):n(null)});e(o)}else n(null)},B.doWhilst=function(t,e,n){var r=0;return B.whilst(function(){return++r<=1||e.apply(this,arguments)},t,n)},B.until=function(t,e,n){return B.whilst(function(){return!t.apply(this,arguments)},e,n)},B.doUntil=function(t,e,n){return B.doWhilst(t,function(){return!e.apply(this,arguments)},n)},B.during=function(t,e,n){n=n||r;var o=v(function(e,r){e?n(e):(r.push(i),t.apply(this,r))}),i=function(t,r){t?n(t):r?e(o):n(null)};t(i)},B.doDuring=function(t,e,n){var r=0;B.during(function(t){r++<1?t(null,!0):e.apply(this,arguments)},t,n)},B.queue=function(t,e){var n=$(function(e,n){t(e[0],n)},e,1);return n},B.priorityQueue=function(t,e){function n(t,e){return t.priority-e.priority}function o(t,e,n){for(var r=-1,o=t.length-1;o>r;){var i=r+(o-r+1>>>1);n(e,t[i])>=0?r=i:o=i-1}return r}function i(t,e,i,a){if(null!=a&&"function"!=typeof a)throw new Error("task callback must be a function");return t.started=!0,U(e)||(e=[e]),0===e.length?B.setImmediate(function(){t.drain()}):void f(e,function(e){var u={data:e,priority:i,callback:"function"==typeof a?a:r};t.tasks.splice(o(t.tasks,u,n)+1,0,u),t.tasks.length===t.concurrency&&t.saturated(),B.setImmediate(t.process)})}var a=B.queue(t,e);return a.push=function(t,e,n){i(a,t,e,n)},delete a.unshift,a},B.cargo=function(t,e){return $(t,1,e)},B.log=D("log"),B.dir=D("dir"),B.memoize=function(t,e){var n={},r={};e=e||o;var i=v(function(o){var i=o.pop(),a=e.apply(null,o);a in n?B.setImmediate(function(){i.apply(null,n[a])}):a in r?r[a].push(i):(r[a]=[i],t.apply(null,o.concat([v(function(t){n[a]=t;var e=r[a];delete r[a];for(var o=0,i=e.length;i>o;o++)e[o].apply(null,t)})])))});return i.memo=n,i.unmemoized=t,i},B.unmemoize=function(t){return function(){return(t.unmemoized||t).apply(null,arguments)}},B.times=x(B.map),B.timesSeries=x(B.mapSeries),B.timesLimit=function(t,e,n,r){return B.mapLimit(d(t),e,n,r)},B.seq=function(){var t=arguments;return v(function(e){var n=this,o=e[e.length-1];"function"==typeof o?e.pop():o=r,B.reduce(t,e,function(t,e,r){e.apply(n,t.concat([v(function(t,e){r(t,e)})]))},function(t,e){o.apply(n,[t].concat(e))})})},B.compose=function(){return B.seq.apply(null,Array.prototype.reverse.call(arguments))},B.applyEach=T(B.eachOf),B.applyEachSeries=T(B.eachOfSeries),B.forever=function(t,e){function n(t){return t?o(t):void i(n)}var o=u(e||r),i=L(t);n()},B.ensureAsync=L,B.constant=v(function(t){var e=[null].concat(t);return function(t){return t.apply(this,e)}}),B.wrapSync=B.asyncify=function(t){return v(function(e){var n,r=e.pop();try{n=t.apply(this,e)}catch(o){return r(o)}N(n)&&"function"==typeof n.then?n.then(function(t){r(null,t)})["catch"](function(t){r(t.message?t:new Error(t))}):r(null,n)})},"object"==typeof e&&e.exports?e.exports=B:"function"==typeof define&&define.amd?define([],function(){return B}):M.async=B}()}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:49}],2:[function(t,e,n){var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(t){"use strict";function e(t){var e=t.charCodeAt(0);return e===a||e===l?62:e===u||e===d?63:s>e?-1:s+10>e?e-s+26+26:f+26>e?e-f:c+26>e?e-c+26:void 0}function n(t){function n(t){c[l++]=t}var r,o,a,u,s,c;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var f=t.length;s="="===t.charAt(f-2)?2:"="===t.charAt(f-1)?1:0,c=new i(3*t.length/4-s),a=s>0?t.length-4:t.length;var l=0;for(r=0,o=0;a>r;r+=4,o+=3)u=e(t.charAt(r))<<18|e(t.charAt(r+1))<<12|e(t.charAt(r+2))<<6|e(t.charAt(r+3)),n((16711680&u)>>16),n((65280&u)>>8),n(255&u);return 2===s?(u=e(t.charAt(r))<<2|e(t.charAt(r+1))>>4,n(255&u)):1===s&&(u=e(t.charAt(r))<<10|e(t.charAt(r+1))<<4|e(t.charAt(r+2))>>2,n(u>>8&255),n(255&u)),c}function o(t){function e(t){return r.charAt(t)}function n(t){return e(t>>18&63)+e(t>>12&63)+e(t>>6&63)+e(63&t)}var o,i,a,u=t.length%3,s="";for(o=0,a=t.length-u;a>o;o+=3)i=(t[o]<<16)+(t[o+1]<<8)+t[o+2],s+=n(i);switch(u){case 1:i=t[t.length-1],s+=e(i>>2),s+=e(i<<4&63),s+="==";break;case 2:i=(t[t.length-2]<<8)+t[t.length-1],s+=e(i>>10),s+=e(i>>4&63),s+=e(i<<2&63),s+="="}return s}var i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="+".charCodeAt(0),u="/".charCodeAt(0),s="0".charCodeAt(0),c="a".charCodeAt(0),f="A".charCodeAt(0),l="-".charCodeAt(0),d="_".charCodeAt(0);t.toByteArray=n,t.fromByteArray=o}("undefined"==typeof n?this.base64js={}:n)},{}],3:[function(t,e,n){(function(e){function r(){function t(){}try{var e=new Uint8Array(1);return e.foo=function(){return 42},e.constructor=t,42===e.foo()&&e.constructor===t&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(n){return!1}}function o(){return i.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(t){return this instanceof i?(this.length=0,this.parent=void 0,"number"==typeof t?a(this,t):"string"==typeof t?u(this,t,arguments.length>1?arguments[1]:"utf8"):s(this,t)):arguments.length>1?new i(t,arguments[1]):new i(t)}function a(t,e){if(t=g(t,0>e?0:0|y(e)),!i.TYPED_ARRAY_SUPPORT)for(var n=0;e>n;n++)t[n]=0;return t}function u(t,e,n){("string"!=typeof n||""===n)&&(n="utf8");var r=0|w(e,n);return t=g(t,r),t.write(e,n),t}function s(t,e){if(i.isBuffer(e))return c(t,e);if(Q(e))return f(t,e);if(null==e)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(e.buffer instanceof ArrayBuffer)return l(t,e);if(e instanceof ArrayBuffer)return d(t,e)}return e.length?p(t,e):h(t,e)}function c(t,e){var n=0|y(e.length);return t=g(t,n),e.copy(t,0,0,n),t}function f(t,e){var n=0|y(e.length);t=g(t,n);for(var r=0;n>r;r+=1)t[r]=255&e[r];return t}function l(t,e){var n=0|y(e.length);t=g(t,n);for(var r=0;n>r;r+=1)t[r]=255&e[r];return t}function d(t,e){return i.TYPED_ARRAY_SUPPORT?(e.byteLength,t=i._augment(new Uint8Array(e))):t=l(t,new Uint8Array(e)),t}function p(t,e){var n=0|y(e.length);t=g(t,n);for(var r=0;n>r;r+=1)t[r]=255&e[r];return t}function h(t,e){var n,r=0;"Buffer"===e.type&&Q(e.data)&&(n=e.data,r=0|y(n.length)),t=g(t,r);for(var o=0;r>o;o+=1)t[o]=255&n[o];return t}function g(t,e){i.TYPED_ARRAY_SUPPORT?(t=i._augment(new Uint8Array(e)),t.__proto__=i.prototype):(t.length=e,t._isBuffer=!0);var n=0!==e&&e<=i.poolSize>>>1;return n&&(t.parent=W),t}function y(t){if(t>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function v(t,e){if(!(this instanceof v))return new v(t,e);var n=new i(t,e);return delete n.parent,n}function w(t,e){"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"binary":case"raw":case"raws":return n;case"utf8":case"utf-8":return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return H(t).length;default:if(r)return V(t).length;e=(""+e).toLowerCase(),r=!0}}function m(t,e,n){var r=!1;if(e=0|e,n=void 0===n||n===1/0?this.length:0|n,t||(t="utf8"),0>e&&(e=0),n>this.length&&(n=this.length),e>=n)return"";for(;;)switch(t){case"hex":return D(this,e,n);case"utf8":case"utf-8":return O(this,e,n);case"ascii":return S(this,e,n);case"binary":return $(this,e,n);case"base64":return I(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function b(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r),r>o&&(r=o)):r=o;var i=e.length;if(i%2!==0)throw new Error("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;r>a;a++){var u=parseInt(e.substr(2*a,2),16);if(isNaN(u))throw new Error("Invalid hex string");t[n+a]=u}return a}function E(t,e,n,r){return J(V(e,t.length-n),t,n,r)}function _(t,e,n,r){return J(z(e),t,n,r)}function A(t,e,n,r){return _(t,e,n,r)}function j(t,e,n,r){return J(H(e),t,n,r)}function k(t,e,n,r){return J(q(e,t.length-n),t,n,r)}function I(t,e,n){return 0===e&&n===t.length?G.fromByteArray(t):G.fromByteArray(t.slice(e,n))}function O(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;n>o;){var i=t[o],a=null,u=i>239?4:i>223?3:i>191?2:1;if(n>=o+u){var s,c,f,l;switch(u){case 1:128>i&&(a=i);break;case 2:s=t[o+1],128===(192&s)&&(l=(31&i)<<6|63&s,l>127&&(a=l));break;case 3:s=t[o+1],c=t[o+2],128===(192&s)&&128===(192&c)&&(l=(15&i)<<12|(63&s)<<6|63&c,l>2047&&(55296>l||l>57343)&&(a=l));break;case 4:s=t[o+1],c=t[o+2],f=t[o+3],128===(192&s)&&128===(192&c)&&128===(192&f)&&(l=(15&i)<<18|(63&s)<<12|(63&c)<<6|63&f,l>65535&&1114112>l&&(a=l))}}null===a?(a=65533,u=1):a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|1023&a),r.push(a),o+=u}return P(r)}function P(t){var e=t.length;if(Z>=e)return String.fromCharCode.apply(String,t);for(var n="",r=0;e>r;)n+=String.fromCharCode.apply(String,t.slice(r,r+=Z));return n}function S(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;n>o;o++)r+=String.fromCharCode(127&t[o]);return r}function $(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;n>o;o++)r+=String.fromCharCode(t[o]);return r}function D(t,e,n){var r=t.length;(!e||0>e)&&(e=0),(!n||0>n||n>r)&&(n=r);for(var o="",i=e;n>i;i++)o+=F(t[i]);return o}function x(t,e,n){for(var r=t.slice(e,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function T(t,e,n){if(t%1!==0||0>t)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function L(t,e,n,r,o,a){if(!i.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");if(e>o||a>e)throw new RangeError("value is out of bounds");if(n+r>t.length)throw new RangeError("index out of range")}function R(t,e,n,r){0>e&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-n,2);i>o;o++)t[n+o]=(e&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function B(t,e,n,r){0>e&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-n,4);i>o;o++)t[n+o]=e>>>8*(r?o:3-o)&255}function M(t,e,n,r,o,i){if(e>o||i>e)throw new RangeError("value is out of bounds");if(n+r>t.length)throw new RangeError("index out of range");if(0>n)throw new RangeError("index out of range")}function C(t,e,n,r,o){return o||M(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(t,e,n,r,23,4),n+4}function U(t,e,n,r,o){return o||M(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(t,e,n,r,52,8),n+8}function N(t){if(t=Y(t).replace(tt,""),t.length<2)return"";for(;t.length%4!==0;)t+="=";return t}function Y(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function F(t){return 16>t?"0"+t.toString(16):t.toString(16)}function V(t,e){e=e||1/0;for(var n,r=t.length,o=null,i=[],a=0;r>a;a++){if(n=t.charCodeAt(a),n>55295&&57344>n){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(56320>n){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=(o-55296<<10|n-56320)+65536}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,128>n){if((e-=1)<0)break;i.push(n)}else if(2048>n){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(65536>n){if((e-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(1114112>n))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function z(t){for(var e=[],n=0;n<t.length;n++)e.push(255&t.charCodeAt(n));return e}function q(t,e){for(var n,r,o,i=[],a=0;a<t.length&&!((e-=2)<0);a++)n=t.charCodeAt(a),r=n>>8,o=n%256,i.push(o),i.push(r);return i}function H(t){return G.toByteArray(N(t))}function J(t,e,n,r){for(var o=0;r>o&&!(o+n>=e.length||o>=t.length);o++)e[o+n]=t[o];return o}var G=t("base64-js"),K=t("ieee754"),Q=t("is-array");n.Buffer=i,n.SlowBuffer=v,n.INSPECT_MAX_BYTES=50,i.poolSize=8192;var W={};i.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:r(),i.TYPED_ARRAY_SUPPORT&&(i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array),i.isBuffer=function(t){return!(null==t||!t._isBuffer)},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,o=0,a=Math.min(n,r);a>o&&t[o]===e[o];)++o;return o!==a&&(n=t[o],r=e[o]),r>n?-1:n>r?1:0},i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(t,e){if(!Q(t))throw new TypeError("list argument must be an Array of Buffers.");if(0===t.length)return new i(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;n++)e+=t[n].length;var r=new i(e),o=0;for(n=0;n<t.length;n++){var a=t[n];a.copy(r,o),o+=a.length}return r},i.byteLength=w,i.prototype.length=void 0,i.prototype.parent=void 0,i.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?O(this,0,t):m.apply(this,arguments)},i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:0===i.compare(this,t)},i.prototype.inspect=function(){var t="",e=n.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},i.prototype.compare=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?0:i.compare(this,t)},i.prototype.indexOf=function(t,e){function n(t,e,n){for(var r=-1,o=0;n+o<t.length;o++)if(t[n+o]===e[-1===r?0:o-r]){if(-1===r&&(r=o),o-r+1===e.length)return n+r}else r=-1;return-1}if(e>2147483647?e=2147483647:-2147483648>e&&(e=-2147483648),e>>=0,0===this.length)return-1;if(e>=this.length)return-1;if(0>e&&(e=Math.max(this.length+e,0)),"string"==typeof t)return 0===t.length?-1:String.prototype.indexOf.call(this,t,e);if(i.isBuffer(t))return n(this,t,e);if("number"==typeof t)return i.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,t,e):n(this,[t],e);throw new TypeError("val must be string, number or Buffer")},i.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},i.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},i.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else if(isFinite(e))e=0|e,isFinite(n)?(n=0|n,void 0===r&&(r="utf8")):(r=n,n=void 0);else{var o=r;r=e,e=0|n,n=o}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(0>n||0>e)||e>this.length)throw new RangeError("attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":return _(this,t,e,n);case"binary":return A(this,t,e,n);case"base64":return j(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,e,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;i.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,0>t?(t+=n,0>t&&(t=0)):t>n&&(t=n),0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),t>e&&(e=t);var r;if(i.TYPED_ARRAY_SUPPORT)r=i._augment(this.subarray(t,e));else{var o=e-t;r=new i(o,void 0);for(var a=0;o>a;a++)r[a]=this[a+t]}return r.length&&(r.parent=this.parent||this),r},i.prototype.readUIntLE=function(t,e,n){t=0|t,e=0|e,n||T(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r},i.prototype.readUIntBE=function(t,e,n){t=0|t,e=0|e,n||T(t,e,this.length);for(var r=this[t+--e],o=1;e>0&&(o*=256);)r+=this[t+--e]*o;return r},i.prototype.readUInt8=function(t,e){return e||T(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return e||T(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return e||T(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return e||T(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},i.prototype.readUInt32BE=function(t,e){return e||T(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},i.prototype.readIntLE=function(t,e,n){t=0|t,e=0|e,n||T(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*e)),r},i.prototype.readIntBE=function(t,e,n){t=0|t,e=0|e,n||T(t,e,this.length);for(var r=e,o=1,i=this[t+--r];r>0&&(o*=256);)i+=this[t+--r]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*e)),i},i.prototype.readInt8=function(t,e){return e||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){e||T(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt16BE=function(t,e){e||T(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},i.prototype.readInt32LE=function(t,e){return e||T(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},i.prototype.readInt32BE=function(t,e){return e||T(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},i.prototype.readFloatLE=function(t,e){return e||T(t,4,this.length),K.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return e||T(t,4,this.length),K.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return e||T(t,8,this.length),K.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return e||T(t,8,this.length),K.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,n,r){t=+t,e=0|e,n=0|n,r||L(this,t,e,n,Math.pow(2,8*n),0);var o=1,i=0;for(this[e]=255&t;++i<n&&(o*=256);)this[e+i]=t/o&255;return e+n},i.prototype.writeUIntBE=function(t,e,n,r){t=+t,e=0|e,n=0|n,r||L(this,t,e,n,Math.pow(2,8*n),0);var o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},i.prototype.writeUInt8=function(t,e,n){return t=+t,e=0|e,n||L(this,t,e,1,255,0),i.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},i.prototype.writeUInt16LE=function(t,e,n){return t=+t,e=0|e,n||L(this,t,e,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):R(this,t,e,!0),e+2},i.prototype.writeUInt16BE=function(t,e,n){return t=+t,e=0|e,n||L(this,t,e,2,65535,0),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):R(this,t,e,!1),e+2},i.prototype.writeUInt32LE=function(t,e,n){return t=+t,e=0|e,n||L(this,t,e,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):B(this,t,e,!0),e+4},i.prototype.writeUInt32BE=function(t,e,n){return t=+t,e=0|e,n||L(this,t,e,4,4294967295,0),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},i.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e=0|e,!r){var o=Math.pow(2,8*n-1);L(this,t,e,n,o-1,-o)}var i=0,a=1,u=0>t?1:0;for(this[e]=255&t;++i<n&&(a*=256);)this[e+i]=(t/a>>0)-u&255;return e+n},i.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e=0|e,!r){var o=Math.pow(2,8*n-1);L(this,t,e,n,o-1,-o)}var i=n-1,a=1,u=0>t?1:0;for(this[e+i]=255&t;--i>=0&&(a*=256);)this[e+i]=(t/a>>0)-u&255;return e+n},i.prototype.writeInt8=function(t,e,n){return t=+t,e=0|e,n||L(this,t,e,1,127,-128),i.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),0>t&&(t=255+t+1),this[e]=255&t,e+1},i.prototype.writeInt16LE=function(t,e,n){return t=+t,e=0|e,n||L(this,t,e,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):R(this,t,e,!0),e+2},i.prototype.writeInt16BE=function(t,e,n){return t=+t,e=0|e,n||L(this,t,e,2,32767,-32768),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):R(this,t,e,!1),e+2},i.prototype.writeInt32LE=function(t,e,n){return t=+t,e=0|e,n||L(this,t,e,4,2147483647,-2147483648),i.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):B(this,t,e,!0),e+4},i.prototype.writeInt32BE=function(t,e,n){return t=+t,e=0|e,n||L(this,t,e,4,2147483647,-2147483648),0>t&&(t=4294967295+t+1),i.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):B(this,t,e,!1),e+4},i.prototype.writeFloatLE=function(t,e,n){return C(this,t,e,!0,n)},i.prototype.writeFloatBE=function(t,e,n){return C(this,t,e,!1,n)},i.prototype.writeDoubleLE=function(t,e,n){return U(this,t,e,!0,n)},i.prototype.writeDoubleBE=function(t,e,n){return U(this,t,e,!1,n)},i.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&n>r&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(0>e)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>r)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var o,a=r-n;if(this===t&&e>n&&r>e)for(o=a-1;o>=0;o--)t[o+e]=this[o+n];else if(1e3>a||!i.TYPED_ARRAY_SUPPORT)for(o=0;a>o;o++)t[o+e]=this[o+n];else t._set(this.subarray(n,n+a),e);return a},i.prototype.fill=function(t,e,n){if(t||(t=0),e||(e=0),n||(n=this.length),e>n)throw new RangeError("end < start");if(n!==e&&0!==this.length){if(0>e||e>=this.length)throw new RangeError("start out of bounds");if(0>n||n>this.length)throw new RangeError("end out of bounds");var r;if("number"==typeof t)for(r=e;n>r;r++)this[r]=t;else{var o=V(t.toString()),i=o.length;for(r=e;n>r;r++)this[r]=o[r%i]}return this}},i.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(i.TYPED_ARRAY_SUPPORT)return new i(this).buffer;for(var t=new Uint8Array(this.length),e=0,n=t.length;n>e;e+=1)t[e]=this[e];return t.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var X=i.prototype;i._augment=function(t){return t.constructor=i,t._isBuffer=!0,t._set=t.set,t.get=X.get,t.set=X.set,t.write=X.write,t.toString=X.toString,t.toLocaleString=X.toString,t.toJSON=X.toJSON,t.equals=X.equals,t.compare=X.compare,t.indexOf=X.indexOf,t.copy=X.copy,t.slice=X.slice,t.readUIntLE=X.readUIntLE,t.readUIntBE=X.readUIntBE,t.readUInt8=X.readUInt8,t.readUInt16LE=X.readUInt16LE,t.readUInt16BE=X.readUInt16BE,t.readUInt32LE=X.readUInt32LE,t.readUInt32BE=X.readUInt32BE,t.readIntLE=X.readIntLE,t.readIntBE=X.readIntBE,
2
+ t.readInt8=X.readInt8,t.readInt16LE=X.readInt16LE,t.readInt16BE=X.readInt16BE,t.readInt32LE=X.readInt32LE,t.readInt32BE=X.readInt32BE,t.readFloatLE=X.readFloatLE,t.readFloatBE=X.readFloatBE,t.readDoubleLE=X.readDoubleLE,t.readDoubleBE=X.readDoubleBE,t.writeUInt8=X.writeUInt8,t.writeUIntLE=X.writeUIntLE,t.writeUIntBE=X.writeUIntBE,t.writeUInt16LE=X.writeUInt16LE,t.writeUInt16BE=X.writeUInt16BE,t.writeUInt32LE=X.writeUInt32LE,t.writeUInt32BE=X.writeUInt32BE,t.writeIntLE=X.writeIntLE,t.writeIntBE=X.writeIntBE,t.writeInt8=X.writeInt8,t.writeInt16LE=X.writeInt16LE,t.writeInt16BE=X.writeInt16BE,t.writeInt32LE=X.writeInt32LE,t.writeInt32BE=X.writeInt32BE,t.writeFloatLE=X.writeFloatLE,t.writeFloatBE=X.writeFloatBE,t.writeDoubleLE=X.writeDoubleLE,t.writeDoubleBE=X.writeDoubleBE,t.fill=X.fill,t.inspect=X.inspect,t.toArrayBuffer=X.toArrayBuffer,t};var tt=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":2,ieee754:46,"is-array":47}],4:[function(t,e,n){function r(t){switch(o(t)){case"object":var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=r(t[n]));return e;case"array":for(var e=new Array(t.length),i=0,a=t.length;a>i;i++)e[i]=r(t[i]);return e;case"regexp":var u="";return u+=t.multiline?"m":"",u+=t.global?"g":"",u+=t.ignoreCase?"i":"",new RegExp(t.source,u);case"date":return new Date(t.getTime());default:return t}}var o;try{o=t("component-type")}catch(i){o=t("type")}e.exports=r},{"component-type":6,type:6}],5:[function(t,e,n){function r(t){return t?o(t):void 0}function o(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){r.off(t,n),e.apply(this,arguments)}var r=this;return this._callbacks=this._callbacks||{},n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks[t];if(!n)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var r,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return this},r.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks[t];if(n){n=n.slice(0);for(var r=0,o=n.length;o>r;++r)n[r].apply(this,e)}return this},r.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},r.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],6:[function(t,e,n){(function(t){var n=Object.prototype.toString;e.exports=function(e){switch(n.call(e)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===e?"null":void 0===e?"undefined":e!==e?"nan":e&&1===e.nodeType?"element":"undefined"!=typeof t&&t.isBuffer(e)?"buffer":(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e),typeof e)}}).call(this,t("buffer").Buffer)},{buffer:3}],7:[function(t,e,n){e.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},{}],8:[function(t,e,n){var r=t("./$.is-object");e.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},{"./$.is-object":27}],9:[function(t,e,n){var r=t("./$.to-iobject"),o=t("./$.to-length"),i=t("./$.to-index");e.exports=function(t){return function(e,n,a){var u,s=r(e),c=o(s.length),f=i(a,c);if(t&&n!=n){for(;c>f;)if(u=s[f++],u!=u)return!0}else for(;c>f;f++)if((t||f in s)&&s[f]===n)return t||f;return!t&&-1}}},{"./$.to-index":34,"./$.to-iobject":36,"./$.to-length":37}],10:[function(t,e,n){var r=t("./$.ctx"),o=t("./$.iobject"),i=t("./$.to-object"),a=t("./$.to-length"),u=t("./$.array-species-create");e.exports=function(t){var e=1==t,n=2==t,s=3==t,c=4==t,f=6==t,l=5==t||f;return function(d,p,h){for(var g,y,v=i(d),w=o(v),m=r(p,h,3),b=a(w.length),E=0,_=e?u(d,b):n?u(d,0):void 0;b>E;E++)if((l||E in w)&&(g=w[E],y=m(g,E,v),t))if(e)_[E]=y;else if(y)switch(t){case 3:return!0;case 5:return g;case 6:return E;case 2:_.push(g)}else if(c)return!1;return f?-1:s||c?c:_}}},{"./$.array-species-create":11,"./$.ctx":14,"./$.iobject":25,"./$.to-length":37,"./$.to-object":38}],11:[function(t,e,n){var r=t("./$.is-object"),o=t("./$.is-array"),i=t("./$.wks")("species");e.exports=function(t,e){var n;return o(t)&&(n=t.constructor,"function"!=typeof n||n!==Array&&!o(n.prototype)||(n=void 0),r(n)&&(n=n[i],null===n&&(n=void 0))),new(void 0===n?Array:n)(e)}},{"./$.is-array":26,"./$.is-object":27,"./$.wks":40}],12:[function(t,e,n){var r={}.toString;e.exports=function(t){return r.call(t).slice(8,-1)}},{}],13:[function(t,e,n){var r=e.exports={version:"1.2.6"};"number"==typeof __e&&(__e=r)},{}],14:[function(t,e,n){var r=t("./$.a-function");e.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},{"./$.a-function":7}],15:[function(t,e,n){e.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},{}],16:[function(t,e,n){e.exports=!t("./$.fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./$.fails":19}],17:[function(t,e,n){var r=t("./$.is-object"),o=t("./$.global").document,i=r(o)&&r(o.createElement);e.exports=function(t){return i?o.createElement(t):{}}},{"./$.global":20,"./$.is-object":27}],18:[function(t,e,n){var r=t("./$.global"),o=t("./$.core"),i=t("./$.hide"),a=t("./$.redefine"),u=t("./$.ctx"),s="prototype",c=function(t,e,n){var f,l,d,p,h=t&c.F,g=t&c.G,y=t&c.S,v=t&c.P,w=t&c.B,m=g?r:y?r[e]||(r[e]={}):(r[e]||{})[s],b=g?o:o[e]||(o[e]={}),E=b[s]||(b[s]={});g&&(n=e);for(f in n)l=!h&&m&&f in m,d=(l?m:n)[f],p=w&&l?u(d,r):v&&"function"==typeof d?u(Function.call,d):d,m&&!l&&a(m,f,d),b[f]!=d&&i(b,f,p),v&&E[f]!=d&&(E[f]=d)};r.core=o,c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,e.exports=c},{"./$.core":13,"./$.ctx":14,"./$.global":20,"./$.hide":22,"./$.redefine":31}],19:[function(t,e,n){e.exports=function(t){try{return!!t()}catch(e){return!0}}},{}],20:[function(t,e,n){var r=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},{}],21:[function(t,e,n){var r={}.hasOwnProperty;e.exports=function(t,e){return r.call(t,e)}},{}],22:[function(t,e,n){var r=t("./$"),o=t("./$.property-desc");e.exports=t("./$.descriptors")?function(t,e,n){return r.setDesc(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},{"./$":28,"./$.descriptors":16,"./$.property-desc":30}],23:[function(t,e,n){e.exports=t("./$.global").document&&document.documentElement},{"./$.global":20}],24:[function(t,e,n){e.exports=function(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},{}],25:[function(t,e,n){var r=t("./$.cof");e.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},{"./$.cof":12}],26:[function(t,e,n){var r=t("./$.cof");e.exports=Array.isArray||function(t){return"Array"==r(t)}},{"./$.cof":12}],27:[function(t,e,n){e.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},{}],28:[function(t,e,n){var r=Object;e.exports={create:r.create,getProto:r.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:r.getOwnPropertyDescriptor,setDesc:r.defineProperty,setDescs:r.defineProperties,getKeys:r.keys,getNames:r.getOwnPropertyNames,getSymbols:r.getOwnPropertySymbols,each:[].forEach}},{}],29:[function(t,e,n){var r=t("./$"),o=t("./$.to-object"),i=t("./$.iobject");e.exports=t("./$.fails")(function(){var t=Object.assign,e={},n={},r=Symbol(),o="abcdefghijklmnopqrst";return e[r]=7,o.split("").forEach(function(t){n[t]=t}),7!=t({},e)[r]||Object.keys(t({},n)).join("")!=o})?function(t,e){for(var n=o(t),a=arguments,u=a.length,s=1,c=r.getKeys,f=r.getSymbols,l=r.isEnum;u>s;)for(var d,p=i(a[s++]),h=f?c(p).concat(f(p)):c(p),g=h.length,y=0;g>y;)l.call(p,d=h[y++])&&(n[d]=p[d]);return n}:Object.assign},{"./$":28,"./$.fails":19,"./$.iobject":25,"./$.to-object":38}],30:[function(t,e,n){e.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},{}],31:[function(t,e,n){var r=t("./$.global"),o=t("./$.hide"),i=t("./$.uid")("src"),a="toString",u=Function[a],s=(""+u).split(a);t("./$.core").inspectSource=function(t){return u.call(t)},(e.exports=function(t,e,n,a){"function"==typeof n&&(n.hasOwnProperty(i)||o(n,i,t[e]?""+t[e]:s.join(String(e))),n.hasOwnProperty("name")||o(n,"name",e)),t===r?t[e]=n:(a||delete t[e],o(t,e,n))})(Function.prototype,a,function(){return"function"==typeof this&&this[i]||u.call(this)})},{"./$.core":13,"./$.global":20,"./$.hide":22,"./$.uid":39}],32:[function(t,e,n){var r=t("./$.global"),o="__core-js_shared__",i=r[o]||(r[o]={});e.exports=function(t){return i[t]||(i[t]={})}},{"./$.global":20}],33:[function(t,e,n){var r=t("./$.export"),o=t("./$.defined"),i=t("./$.fails"),a=" \n\x0B\f\r  ᠎              \u2028\u2029\ufeff",u="["+a+"]",s="​…",c=RegExp("^"+u+u+"*"),f=RegExp(u+u+"*$"),l=function(t,e){var n={};n[t]=e(d),r(r.P+r.F*i(function(){return!!a[t]()||s[t]()!=s}),"String",n)},d=l.trim=function(t,e){return t=String(o(t)),1&e&&(t=t.replace(c,"")),2&e&&(t=t.replace(f,"")),t};e.exports=l},{"./$.defined":15,"./$.export":18,"./$.fails":19}],34:[function(t,e,n){var r=t("./$.to-integer"),o=Math.max,i=Math.min;e.exports=function(t,e){return t=r(t),0>t?o(t+e,0):i(t,e)}},{"./$.to-integer":35}],35:[function(t,e,n){var r=Math.ceil,o=Math.floor;e.exports=function(t){return isNaN(t=+t)?0:(t>0?o:r)(t)}},{}],36:[function(t,e,n){var r=t("./$.iobject"),o=t("./$.defined");e.exports=function(t){return r(o(t))}},{"./$.defined":15,"./$.iobject":25}],37:[function(t,e,n){var r=t("./$.to-integer"),o=Math.min;e.exports=function(t){return t>0?o(r(t),9007199254740991):0}},{"./$.to-integer":35}],38:[function(t,e,n){var r=t("./$.defined");e.exports=function(t){return Object(r(t))}},{"./$.defined":15}],39:[function(t,e,n){var r=0,o=Math.random();e.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+o).toString(36))}},{}],40:[function(t,e,n){var r=t("./$.shared")("wks"),o=t("./$.uid"),i=t("./$.global").Symbol;e.exports=function(t){return r[t]||(r[t]=i&&i[t]||(i||o)("Symbol."+t))}},{"./$.global":20,"./$.shared":32,"./$.uid":39}],41:[function(t,e,n){"use strict";var r,o=t("./$"),i=t("./$.export"),a=t("./$.descriptors"),u=t("./$.property-desc"),s=t("./$.html"),c=t("./$.dom-create"),f=t("./$.has"),l=t("./$.cof"),d=t("./$.invoke"),p=t("./$.fails"),h=t("./$.an-object"),g=t("./$.a-function"),y=t("./$.is-object"),v=t("./$.to-object"),w=t("./$.to-iobject"),m=t("./$.to-integer"),b=t("./$.to-index"),E=t("./$.to-length"),_=t("./$.iobject"),A=t("./$.uid")("__proto__"),j=t("./$.array-methods"),k=t("./$.array-includes")(!1),I=Object.prototype,O=Array.prototype,P=O.slice,S=O.join,$=o.setDesc,D=o.getDesc,x=o.setDescs,T={};a||(r=!p(function(){return 7!=$(c("div"),"a",{get:function(){return 7}}).a}),o.setDesc=function(t,e,n){if(r)try{return $(t,e,n)}catch(o){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(h(t)[e]=n.value),t},o.getDesc=function(t,e){if(r)try{return D(t,e)}catch(n){}return f(t,e)?u(!I.propertyIsEnumerable.call(t,e),t[e]):void 0},o.setDescs=x=function(t,e){h(t);for(var n,r=o.getKeys(e),i=r.length,a=0;i>a;)o.setDesc(t,n=r[a++],e[n]);return t}),i(i.S+i.F*!a,"Object",{getOwnPropertyDescriptor:o.getDesc,defineProperty:o.setDesc,defineProperties:x});var L="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),R=L.concat("length","prototype"),B=L.length,M=function(){var t,e=c("iframe"),n=B,r=">";for(e.style.display="none",s.appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write("<script>document.F=Object</script"+r),t.close(),M=t.F;n--;)delete M.prototype[L[n]];return M()},C=function(t,e){return function(n){var r,o=w(n),i=0,a=[];for(r in o)r!=A&&f(o,r)&&a.push(r);for(;e>i;)f(o,r=t[i++])&&(~k(a,r)||a.push(r));return a}},U=function(){};i(i.S,"Object",{getPrototypeOf:o.getProto=o.getProto||function(t){return t=v(t),f(t,A)?t[A]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?I:null},getOwnPropertyNames:o.getNames=o.getNames||C(R,R.length,!0),create:o.create=o.create||function(t,e){var n;return null!==t?(U.prototype=h(t),n=new U,U.prototype=null,n[A]=t):n=M(),void 0===e?n:x(n,e)},keys:o.getKeys=o.getKeys||C(L,B,!1)});var N=function(t,e,n){if(!(e in T)){for(var r=[],o=0;e>o;o++)r[o]="a["+o+"]";T[e]=Function("F,a","return new F("+r.join(",")+")")}return T[e](t,n)};i(i.P,"Function",{bind:function(t){var e=g(this),n=P.call(arguments,1),r=function(){var o=n.concat(P.call(arguments));return this instanceof r?N(e,o.length,o):d(e,o,t)};return y(e.prototype)&&(r.prototype=e.prototype),r}}),i(i.P+i.F*p(function(){s&&P.call(s)}),"Array",{slice:function(t,e){var n=E(this.length),r=l(this);if(e=void 0===e?n:e,"Array"==r)return P.call(this,t,e);for(var o=b(t,n),i=b(e,n),a=E(i-o),u=Array(a),s=0;a>s;s++)u[s]="String"==r?this.charAt(o+s):this[o+s];return u}}),i(i.P+i.F*(_!=Object),"Array",{join:function(t){return S.call(_(this),void 0===t?",":t)}}),i(i.S,"Array",{isArray:t("./$.is-array")});var Y=function(t){return function(e,n){g(e);var r=_(this),o=E(r.length),i=t?o-1:0,a=t?-1:1;if(arguments.length<2)for(;;){if(i in r){n=r[i],i+=a;break}if(i+=a,t?0>i:i>=o)throw TypeError("Reduce of empty array with no initial value")}for(;t?i>=0:o>i;i+=a)i in r&&(n=e(n,r[i],i,this));return n}},F=function(t){return function(e){return t(this,e,arguments[1])}};i(i.P,"Array",{forEach:o.each=o.each||F(j(0)),map:F(j(1)),filter:F(j(2)),some:F(j(3)),every:F(j(4)),reduce:Y(!1),reduceRight:Y(!0),indexOf:F(k),lastIndexOf:function(t,e){var n=w(this),r=E(n.length),o=r-1;for(arguments.length>1&&(o=Math.min(o,m(e))),0>o&&(o=E(r+o));o>=0;o--)if(o in n&&n[o]===t)return o;return-1}}),i(i.S,"Date",{now:function(){return+new Date}});var V=function(t){return t>9?t:"0"+t};i(i.P+i.F*(p(function(){return"0385-07-25T07:06:39.999Z"!=new Date(-5e13-1).toISOString()})||!p(function(){new Date(NaN).toISOString()})),"Date",{toISOString:function(){if(!isFinite(this))throw RangeError("Invalid time value");var t=this,e=t.getUTCFullYear(),n=t.getUTCMilliseconds(),r=0>e?"-":e>9999?"+":"";return r+("00000"+Math.abs(e)).slice(r?-6:-4)+"-"+V(t.getUTCMonth()+1)+"-"+V(t.getUTCDate())+"T"+V(t.getUTCHours())+":"+V(t.getUTCMinutes())+":"+V(t.getUTCSeconds())+"."+(n>99?n:"0"+V(n))+"Z"}})},{"./$":28,"./$.a-function":7,"./$.an-object":8,"./$.array-includes":9,"./$.array-methods":10,"./$.cof":12,"./$.descriptors":16,"./$.dom-create":17,"./$.export":18,"./$.fails":19,"./$.has":21,"./$.html":23,"./$.invoke":24,"./$.iobject":25,"./$.is-array":26,"./$.is-object":27,"./$.property-desc":30,"./$.to-index":34,"./$.to-integer":35,"./$.to-iobject":36,"./$.to-length":37,"./$.to-object":38,"./$.uid":39}],42:[function(t,e,n){var r=t("./$.export");r(r.S+r.F,"Object",{assign:t("./$.object-assign")})},{"./$.export":18,"./$.object-assign":29}],43:[function(t,e,n){"use strict";t("./$.string-trim")("trim",function(t){return function(){return t(this,3)}})},{"./$.string-trim":33}],44:[function(t,e,n){function r(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function o(){var t=arguments,e=this.useColors;if(t[0]=(e?"%c":"")+this.namespace+(e?" %c":" ")+t[0]+(e?"%c ":" ")+"+"+n.humanize(this.diff),!e)return t;var r="color: "+this.color;t=[t[0],r,"color: inherit"].concat(Array.prototype.slice.call(t,1));var o=0,i=0;return t[0].replace(/%[a-z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(i=o))}),t.splice(i,0,r),t}function i(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(t){try{null==t?n.storage.removeItem("debug"):n.storage.debug=t}catch(e){}}function u(){var t;try{t=n.storage.debug}catch(e){}return t}function s(){try{return window.localStorage}catch(t){}}n=e.exports=t("./debug"),n.log=i,n.formatArgs=o,n.save=a,n.load=u,n.useColors=r,n.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:s(),n.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],n.formatters.j=function(t){return JSON.stringify(t)},n.enable(u())},{"./debug":45}],45:[function(t,e,n){function r(){return n.colors[f++%n.colors.length]}function o(t){function e(){}function o(){var t=o,e=+new Date,i=e-(c||e);t.diff=i,t.prev=c,t.curr=e,c=e,null==t.useColors&&(t.useColors=n.useColors()),null==t.color&&t.useColors&&(t.color=r());var a=Array.prototype.slice.call(arguments);a[0]=n.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var u=0;a[0]=a[0].replace(/%([a-z%])/g,function(e,r){if("%%"===e)return e;u++;var o=n.formatters[r];if("function"==typeof o){var i=a[u];e=o.call(t,i),a.splice(u,1),u--}return e}),"function"==typeof n.formatArgs&&(a=n.formatArgs.apply(t,a));var s=o.log||n.log||console.log.bind(console);s.apply(t,a)}e.enabled=!1,o.enabled=!0;var i=n.enabled(t)?o:e;return i.namespace=t,i}function i(t){n.save(t);for(var e=(t||"").split(/[\s,]+/),r=e.length,o=0;r>o;o++)e[o]&&(t=e[o].replace(/\*/g,".*?"),"-"===t[0]?n.skips.push(new RegExp("^"+t.substr(1)+"$")):n.names.push(new RegExp("^"+t+"$")))}function a(){n.enable("")}function u(t){var e,r;for(e=0,r=n.skips.length;r>e;e++)if(n.skips[e].test(t))return!1;for(e=0,r=n.names.length;r>e;e++)if(n.names[e].test(t))return!0;return!1}function s(t){return t instanceof Error?t.stack||t.message:t}n=e.exports=o,n.coerce=s,n.disable=a,n.enable=i,n.enabled=u,n.humanize=t("ms"),n.names=[],n.skips=[],n.formatters={};var c,f=0},{ms:48}],46:[function(t,e,n){n.read=function(t,e,n,r,o){var i,a,u=8*o-r-1,s=(1<<u)-1,c=s>>1,f=-7,l=n?o-1:0,d=n?-1:1,p=t[e+l];for(l+=d,i=p&(1<<-f)-1,p>>=-f,f+=u;f>0;i=256*i+t[e+l],l+=d,f-=8);for(a=i&(1<<-f)-1,i>>=-f,f+=r;f>0;a=256*a+t[e+l],l+=d,f-=8);if(0===i)i=1-c;else{if(i===s)return a?NaN:(p?-1:1)*(1/0);a+=Math.pow(2,r),i-=c}return(p?-1:1)*a*Math.pow(2,i-r)},n.write=function(t,e,n,r,o,i){var a,u,s,c=8*i-o-1,f=(1<<c)-1,l=f>>1,d=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,h=r?1:-1,g=0>e||0===e&&0>1/e?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(u=isNaN(e)?1:0,a=f):(a=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-a))<1&&(a--,s*=2),e+=a+l>=1?d/s:d*Math.pow(2,1-l),e*s>=2&&(a++,s/=2),a+l>=f?(u=0,a=f):a+l>=1?(u=(e*s-1)*Math.pow(2,o),a+=l):(u=e*Math.pow(2,l-1)*Math.pow(2,o),a=0));o>=8;t[n+p]=255&u,p+=h,u/=256,o-=8);for(a=a<<o|u,c+=o;c>0;t[n+p]=255&a,p+=h,a/=256,c-=8);t[n+p-h]|=128*g}},{}],47:[function(t,e,n){var r=Array.isArray,o=Object.prototype.toString;e.exports=r||function(t){return!!t&&"[object Array]"==o.call(t)}},{}],48:[function(t,e,n){function r(t){if(t=""+t,!(t.length>1e4)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*l;case"days":case"day":case"d":return n*f;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*s;case"seconds":case"second":case"secs":case"sec":case"s":return n*u;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function o(t){return t>=f?Math.round(t/f)+"d":t>=c?Math.round(t/c)+"h":t>=s?Math.round(t/s)+"m":t>=u?Math.round(t/u)+"s":t+"ms"}function i(t){return a(t,f,"day")||a(t,c,"hour")||a(t,s,"minute")||a(t,u,"second")||t+" ms"}function a(t,e,n){return e>t?void 0:1.5*e>t?Math.floor(t/e)+" "+n:Math.ceil(t/e)+" "+n+"s"}var u=1e3,s=60*u,c=60*s,f=24*c,l=365.25*f;e.exports=function(t,e){return e=e||{},"string"==typeof t?r(t):e["long"]?i(t):o(t)}},{}],49:[function(t,e,n){function r(){f=!1,u.length?c=u.concat(c):l=-1,c.length&&o()}function o(){if(!f){var t=setTimeout(r);f=!0;for(var e=c.length;e;){for(u=c,c=[];++l<e;)u&&u[l].run();l=-1,e=c.length}u=null,f=!1,clearTimeout(t)}}function i(t,e){this.fun=t,this.array=e}function a(){}var u,s=e.exports={},c=[],f=!1,l=-1;s.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new i(t,e)),1!==c.length||f||setTimeout(o,0)},i.prototype.run=function(){this.fun.apply(null,this.array)},s.title="browser",s.browser=!0,s.env={},s.argv=[],s.version="",s.versions={},s.on=a,s.addListener=a,s.once=a,s.off=a,s.removeListener=a,s.removeAllListeners=a,s.emit=a,s.binding=function(t){throw new Error("process.binding is not supported")},s.cwd=function(){return"/"},s.chdir=function(t){throw new Error("process.chdir is not supported")},s.umask=function(){return 0}},{}],50:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}n.__esModule=!0;var o=function(){function t(e){r(this,t),this.digitalData=e}return t.prototype.fire=function(){this.fireViewedPage(),this.digitalData.page&&("category"===this.digitalData.page.type&&this.fireViewedProductCategory(),"product"===this.digitalData.page.type&&this.fireViewedProductDetail(),("cart"===this.digitalData.page.type||"checkout"===this.digitalData.page.type)&&this.fireViewedCheckoutStep()),this.digitalData.transaction&&this.digitalData.transaction.isReturning!==!0&&this.fireCompletedTransaction(),this.digitalData.listing&&this.fireViewedProducts(this.digitalData.listing),this.digitalData.recommendation&&this.fireViewedProducts(this.digitalData.recommendation),this.digitalData.campaigns&&this.fireViewedCampaigns(this.digitalData.campaigns)},t.prototype.fireViewedProducts=function(t){if(t.items&&t.items.length>0){for(var e=[],n=t.items,r=Array.isArray(n),o=0,n=r?n:n[Symbol.iterator]();;){var i;if(r){if(o>=n.length)break;i=n[o++]}else{if(o=n.next(),o.done)break;i=o.value}var a=i;a.wasViewed&&e.push(a.id)}var u={updateDigitalData:!1,name:"Viewed Product",category:"Ecommerce",items:e};t.listName&&(u.listName=t.listName),this.digitalData.events.push(u)}},t.prototype.fireViewedCampaigns=function(t){if(t.length>0){for(var e=[],n=t,r=Array.isArray(n),o=0,n=r?n:n[Symbol.iterator]();;){var i;if(r){if(o>=n.length)break;i=n[o++]}else{if(o=n.next(),o.done)break;i=o.value}var a=i;a.wasViewed&&e.push(a.id)}this.digitalData.events.push({updateDigitalData:!1,name:"Viewed Campaign",category:"Promo",campaigns:e})}},t.prototype.fireViewedPage=function(){this.digitalData.events.push({updateDigitalData:!1,name:"Viewed Page",category:"Content"})},t.prototype.fireViewedProductCategory=function(){this.digitalData.events.push({updateDigitalData:!1,name:"Viewed Product Category",category:"Ecommerce"})},t.prototype.fireViewedProductDetail=function(){this.digitalData.events.push({updateDigitalData:!1,name:"Viewed Product Detail",category:"Ecommerce"})},t.prototype.fireViewedCheckoutStep=function(){this.digitalData.events.push({updateDigitalData:!1,name:"Viewed Checkout Step",category:"Ecommerce"})},t.prototype.fireCompletedTransaction=function(){this.digitalData.events.push({updateDigitalData:!1,name:"Completed Transaction",category:"Ecommerce"})},t}();n["default"]=o},{}],51:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t){return t=t.trim(),""===t?[]:(t=t.replace(/\[(\w+)\]/g,".$1"),t=t.replace(/^\./,""),t.split("."))}n.__esModule=!0;var a=t("component-clone"),u=r(a),s=function(){function t(){o(this,t)}return t.get=function(t,e){for(var n=i(t),r=(0,u["default"])(e);n.length>0;){var o=n.shift();if(!r.hasOwnProperty(o))return;r=r[o]}return r},t.getProduct=function(t){console.log(t)},t.getCampaign=function(t){console.log(t)},t}();n["default"]=s},{"component-clone":4}],52:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t){var e=(0,s["default"])(t);return(0,h["default"])(e,"events"),e}function a(t,e){return"string"!=typeof t&&(t=JSON.stringify(t)),"string"!=typeof e&&(e=JSON.stringify(e)),t===e}n.__esModule=!0;var u=t("component-clone"),s=r(u),c=t("async"),f=r(c),l=t("debug"),d=r(l),p=t("./functions/deleteProperty.js"),h=r(p),g=t("./functions/size.js"),y=r(g),v=t("./functions/after.js"),w=r(v),m=t("./DDHelper.js"),b=r(m),E={},_=[],A={},j={},k=void 0,I=function(t){t&&(0,d["default"])("ddListener callback error: %s",t)},O=function(){function t(e,n){o(this,t),j=e||j,Array.isArray(j.events)||(j.events=[]),_=n||_,A=i(j)}return t.prototype.initialize=function(){var t=this,e=j.events;this.addEarlyCallbacks(),_.push=function(e){t.addCallback(e),_[_.length]=e},this.fireUnfiredEvents(),e.push=function(n){t.fireEvent(n),e[e.length]=n},k=setInterval(function(){t.checkForChanges()},100)},t.prototype.checkForChanges=function(){if(E.change&&E.change.length>0){var t=i(j);if(!a(A,t)){var e=i(A);A=(0,s["default"])(t),this.fireChange(t,e)}}},t.prototype.addCallback=function(t){if(Array.isArray(t)&&!(t.length<2)){if("on"===t[0]){if(t.length<3)return;var e=f["default"].asyncify(t[2]);this.on(t[1],e)}"off"===t[0]}},t.prototype.fireChange=function(t,e){var n=void 0;if(E.change)for(var r=E.change,o=Array.isArray(r),i=0,r=o?r:r[Symbol.iterator]();;){if(o){if(i>=r.length)break;n=r[i++]}else{if(i=r.next(),i.done)break;n=i.value}if(n.key){var u=n.key,s=b["default"].get(u,t),c=b["default"].get(u,e);a(s,c)||n.handler(s,c,I)}else n.handler(t,e,I)}},t.prototype.fireEvent=function(t){var e=void 0;t.time=(new Date).getTime(),E.event?!function(){for(var n=[],r=[],o=(0,w["default"])((0,y["default"])(E.event),function(){"function"==typeof t.callback&&t.callback(n,r)}),i=function(t,e){void 0!==e&&n.push(e),t&&r.push(t),I(t),o()},a=E.event,u=Array.isArray(a),c=0,a=u?a:a[Symbol.iterator]();;){if(u){if(c>=a.length)break;e=a[c++]}else{if(c=a.next(),c.done)break;e=c.value}var f=(0,s["default"])(t);(0,h["default"])(f,"updateDigitalData"),(0,h["default"])(f,"callback"),e.handler(f,i)}}():"function"==typeof t.callback&&t.callback(),t.hasFired=!0},t.prototype.on=function(t,e){var n=t.split(":"),r=n[0],o=n[1];E[r]=E[r]||[],o?E[r].push({key:o,handler:e}):E[r].push({handler:e})},t.prototype.fireUnfiredEvents=function(){for(var t=j.events,e=void 0,n=t,r=Array.isArray(n),o=0,n=r?n:n[Symbol.iterator]();;){if(r){if(o>=n.length)break;e=n[o++]}else{if(o=n.next(),o.done)break;e=o.value}e.hasFired||this.fireEvent(e)}},t.prototype.addEarlyCallbacks=function(){for(var t=void 0,e=_,n=Array.isArray(e),r=0,e=n?e:e[Symbol.iterator]();;){if(n){if(r>=e.length)break;t=e[r++]}else{if(r=e.next(),r.done)break;t=r.value}this.addCallback(t)}},t.prototype.reset=function(){clearInterval(k),_.push=Array.prototype.push,E={}},t}();n["default"]=O},{"./DDHelper.js":51,"./functions/after.js":56,"./functions/deleteProperty.js":57,"./functions/size.js":66,async:1,"component-clone":4,debug:44}],53:[function(t,e,n){"use strict";function r(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function o(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==("undefined"==typeof e?"undefined":r(e))&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof e?"undefined":r(e)));t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}n.__esModule=!0;var s=t("./functions/loadScript.js"),c=o(s),f=t("./functions/loadIframe.js"),l=o(f),d=t("./functions/loadPixel.js"),p=o(d),h=t("./functions/format.js"),g=o(h),y=t("./functions/noop.js"),v=o(y),w=t("./functions/each.js"),m=o(w),b=t("./functions/deleteProperty.js"),E=o(b),_=t("debug"),A=o(_),j=t("async"),k=o(j),I=t("component-emitter"),O=o(I),P=t("./DDHelper.js"),S=o(P),$=function(t){function e(n,r){i(this,e);var o=a(this,t.call(this));return o._options=r,o._tags={},o._digitalData=n,o.ready=o.ready.bind(o),o}return u(e,t),e.prototype.initialize=function(){var t=this.ready;k["default"].nextTick(t)},e.prototype.setName=function(t){return this._name=t,this},e.prototype.getName=function(){return this._name||this.constructor.getName()},e.prototype.load=function(t,e){"function"==typeof t&&(e=t,t=null),t=t||"library";var n=this._tags[t];if(!n)throw new Error((0,g["default"])('tag "%s" not defined.',t));e=e||v["default"];var r=void 0,o=n.attr;switch(n.type){case"img":o.width=1,o.height=1,r=(0,p["default"])(o,e);break;case"script":r=(0,c["default"])(o,function(n){return n?void(0,A["default"])('error loading "%s" error="%s"',t,n):e()}),(0,E["default"])(o,"src"),(0,m["default"])(o,function(t,e){r.setAttribute(t,e)});break;case"iframe":r=(0,l["default"])(o,e)}return r},e.prototype.isLoaded=function(){return!1},e.prototype.ready=function(){this.emit("ready")},e.prototype.addTag=function(t,e){return e||(e=t,t="library"),this._tags[t]=e,this},e.prototype.getTag=function(t){return t||(t="library"),this._tags[t]},e.prototype.setOption=function(t,e){return this._options[t]=e,this},e.prototype.getOption=function(t){return this._options[t]},e.prototype.get=function(t){return S["default"].get(t,this._digitalData)},e.prototype.reset=function(){},e.prototype.trackEvent=function(){},e}(O["default"]);n["default"]=$},{"./DDHelper.js":51,"./functions/deleteProperty.js":57,"./functions/each.js":58,"./functions/format.js":59,"./functions/loadIframe.js":61,"./functions/loadPixel.js":62,"./functions/loadScript.js":63,"./functions/noop.js":64,async:1,"component-emitter":5,debug:44}],54:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var o;n.__esModule=!0;var i=t("./integrations/GoogleTagManager.js"),a=r(i),u=t("./integrations/Driveback.js"),s=r(u),c=t("./integrations/RetailRocket.js"),f=r(c),l=(o={},o[a["default"].getName()]=a["default"],o[s["default"].getName()]=s["default"],o[f["default"].getName()]=f["default"],o);n["default"]=l},{"./integrations/Driveback.js":69,"./integrations/GoogleTagManager.js":70,"./integrations/RetailRocket.js":71}],55:[function(t,e,n){"use strict";function r(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function o(t){return t&&t.__esModule?t:{"default":t}}function i(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":"undefined"==typeof t?"undefined":r(t)}function a(){"object"===i(window[O])?$=window[O]:window[O]=$,$.page=$.page||{},$.user=$.user||{},$.page.type&&"confirmation"===$.page.type||($.cart=$.cart||{}),Array.isArray(window[P])?D=window[P]:window[P]=D}n.__esModule=!0;var u=t("component-clone"),s=o(u),c=t("async"),f=o(c),l=t("./functions/size.js"),d=o(l),p=t("./functions/after.js"),h=o(p),g=t("./functions/each.js"),y=o(g),v=t("component-emitter"),w=o(v),m=t("./Integration.js"),b=o(m),E=t("./EventManager.js"),_=o(E),A=t("./AutoEvents.js"),j=o(A),k=t("./DDHelper.js"),I=o(k),O="digitalData",P="ddListener",S="ddManager",$={},D=[],x=void 0,T=void 0,L=void 0,R={},B=!1,M=!1,C={
3
+ setAvailableIntegrations:function(t){x=t},processEarlyStubCalls:function(){for(var t=window[S]||[],e=function(t,e){return function(){C[t].apply(C,e)}};t.length>0;){var n=t.shift(),r=n.shift();C[r]&&("initialize"===r&&t.length>0?f["default"].nextTick(e(r,n)):C[r].apply(C,n))}},initialize:function(t){if(t=Object.assign({autoEvents:!0},t),B)throw new Error("ddManager is already initialized");if(a(),T=new _["default"]($,D),t.autoEvents&&(L=new j["default"]($)),t&&"object"===("undefined"==typeof t?"undefined":i(t))){var e=t.integrations;e&&(0,y["default"])(e,function(t,e){if("function"==typeof x[t]){var n=new x[t]($,(0,s["default"])(e));C.addIntegration(n)}})}var n=(0,h["default"])((0,d["default"])(R),function(){T.initialize(),L&&L instanceof j["default"]&&L.fire(),M=!0,C.emit("ready")});(0,d["default"])(R)>0?(0,y["default"])(R,function(t,e){e.isLoaded()?n():(e.once("ready",n),e.initialize()),T.addCallback(["on","event",function(t){e.trackEvent(t)}])}):n(),B=!0,C.emit("initialize",t)},isInitialized:function(){return B},isReady:function(){return M},addIntegration:function(t){if(B)throw new Error("Adding integrations after ddManager initialization is not allowed");if(!t instanceof b["default"]||!t.getName())throw new TypeError("attempted to add an invalid integration");var e=t.getName();R[e]=t},getIntegration:function(t){return R[t]},get:function(t){return I["default"].get(t,$)},reset:function(){T instanceof _["default"]&&T.reset(),(0,y["default"])(R,function(t,e){e.removeAllListeners(),e.reset()}),C.removeAllListeners(),T=null,R={},B=!1,M=!1}};(0,w["default"])(C);var U=C.on;C.on=C.addEventListener=function(t,e){if("ready"===t){if(M)return void e()}else if("initialize"===t&&B)return void e();U.call(C,t,e)},n["default"]=C},{"./AutoEvents.js":50,"./DDHelper.js":51,"./EventManager.js":52,"./Integration.js":53,"./functions/after.js":56,"./functions/each.js":58,"./functions/size.js":66,async:1,"component-clone":4,"component-emitter":5}],56:[function(t,e,n){"use strict";n.__esModule=!0,n["default"]=function(t,e){var n=t;return function(){return--n<1?e.apply(this,arguments):void 0}}},{}],57:[function(t,e,n){"use strict";n.__esModule=!0,n["default"]=function(t,e){try{delete t[e]}catch(n){t[e]=void 0}}},{}],58:[function(t,e,n){"use strict";n.__esModule=!0,n["default"]=function(t,e){for(var n in t)t.hasOwnProperty(n)&&e(n,t[n])}},{}],59:[function(t,e,n){"use strict";function r(t){var e=[].slice.call(arguments,1),n=0;return t.replace(/%([a-z])/gi,function(t,r){return i[r]?i[r](e[n++]):t+r})}n.__esModule=!0,n["default"]=r;var o=window.JSON?JSON.stringify:String,i={o:o,s:String,d:parseInt}},{}],60:[function(t,e,n){"use strict";function r(t,e){e||(e=location.search),t=t.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+t+"=([^&#]*)"),r=n.exec(e);return null===r?"":decodeURIComponent(r[1].replace(/\+/g," "))}n.__esModule=!0,n["default"]=r},{}],61:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}n.__esModule=!0,n["default"]=function(t,e){if(!t)throw new Error("Cant load nothing...");"string"==typeof t&&(t={src:t});var n="https:"===document.location.protocol||"chrome-extension:"===document.location.protocol;t.src&&0===t.src.indexOf("//")&&(t.src=n?"https:"+t.src:"http:"+t.src),n&&t.https?t.src=t.https:!n&&t.http&&(t.src=t.http);var r=document.createElement("iframe");return r.src=t.src,r.width=t.width||1,r.height=t.height||1,r.style.display="none","function"==typeof e&&(0,i["default"])(r,e),u["default"].nextTick(function(){var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(r,t)}),r};var o=t("./scriptOnLoad.js"),i=r(o),a=t("async"),u=r(a)},{"./scriptOnLoad.js":65,async:1}],62:[function(t,e,n){"use strict";function r(t,e,n){return function(r){r=r||window.event;var o=new Error(e);o.event=r,o.source=n,t(o)}}n.__esModule=!0,n["default"]=function(t,e){e=e||function(){};var n=new Image;return n.onerror=r(e,"failed to load pixel",n),n.onload=e,n.src=t.src,n.width=1,n.height=1,n}},{}],63:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}n.__esModule=!0,n["default"]=function(t,e){if(!t)throw new Error("Cant load nothing...");"string"==typeof t&&(t={src:t});var n="https:"===document.location.protocol||"chrome-extension:"===document.location.protocol;t.src&&0===t.src.indexOf("//")&&(t.src=n?"https:"+t.src:"http:"+t.src),n&&t.https?t.src=t.https:!n&&t.http&&(t.src=t.http);var r=document.createElement("script");return r.type="text/javascript",r.async=!0,r.src=t.src,"function"==typeof e&&(0,i["default"])(r,e),u["default"].nextTick(function(){var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(r,t)}),r};var o=t("./scriptOnLoad.js"),i=r(o),a=t("async"),u=r(a)},{"./scriptOnLoad.js":65,async:1}],64:[function(t,e,n){"use strict";n.__esModule=!0,n["default"]=function(){}},{}],65:[function(t,e,n){"use strict";function r(t,e){t.addEventListener("load",function(t,n){e(null,n)},!1),t.addEventListener("error",function(n){var r=new Error('script error "'+t.src+'"');r.event=n,e(r)},!1)}function o(t,e){t.attachEvent("onreadystatechange",function(n){/complete|loaded/.test(t.readyState)&&("loaded"===t.readyState?setTimeout(function(){e(null,n)},500):e(null,n))}),t.attachEvent("onerror",function(n){var r=new Error('failed to load the script "'+t.src+'"');r.event=n||window.event,e(r)})}n.__esModule=!0,n["default"]=function(t,e){return t.addEventListener?r(t,e):o(t,e)}},{}],66:[function(t,e,n){"use strict";n.__esModule=!0,n["default"]=function(t){var e=0;for(var n in t)t.hasOwnProperty(n)&&e++;return e}},{}],67:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}function o(t,e){1===arguments.length&&(e=t,t="error");var n={code:t,message:e};throw(0,a["default"])(e),n}n.__esModule=!0,n["default"]=o;var i=t("debug"),a=r(i)},{debug:44}],68:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}t("./polyfill.js");var o=t("./ddManager.js"),i=r(o),a=t("./availableIntegrations.js"),u=r(a);i["default"].setAvailableIntegrations(u["default"]),i["default"].processEarlyStubCalls(),window.ddManager=i["default"]},{"./availableIntegrations.js":54,"./ddManager.js":55,"./polyfill.js":72}],69:[function(t,e,n){"use strict";function r(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function o(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==("undefined"==typeof e?"undefined":r(e))&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof e?"undefined":r(e)));t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}n.__esModule=!0;var s=t("./../Integration.js"),c=o(s),f=t("./../functions/deleteProperty.js"),l=o(f),d=function(t){function e(n,r){i(this,e);var o=Object.assign({websiteToken:""},r),u=a(this,t.call(this,n,o));return u.addTag({type:"script",attr:{id:"driveback-sdk",src:"//cdn.driveback.ru/js/loader.js"}}),u}return u(e,t),e.getName=function(){return"Driveback"},e.prototype.initialize=function(){var t=this;this.getOption("websiteToken")?(window.DrivebackNamespace="Driveback",window.Driveback=window.Driveback||{},window.DrivebackOnLoad=window.DrivebackOnLoad||[],window.DrivebackLoaderAsyncInit=function(){window.Driveback.Loader.init(t.getOption("websiteToken"))},this.load(this.ready)):this.ready()},e.prototype.isLoaded=function(){return!(!window.Driveback||!window.Driveback.Loader)},e.prototype.reset=function(){(0,l["default"])(window,"Driveback"),(0,l["default"])(window,"DriveBack"),(0,l["default"])(window,"DrivebackNamespace"),(0,l["default"])(window,"DrivebackOnLoad"),(0,l["default"])(window,"DrivebackLoaderAsyncInit"),(0,l["default"])(window,"DrivebackAsyncInit")},e}(c["default"]);n["default"]=d},{"./../Integration.js":53,"./../functions/deleteProperty.js":57}],70:[function(t,e,n){"use strict";function r(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function o(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==("undefined"==typeof e?"undefined":r(e))&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof e?"undefined":r(e)));t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}n.__esModule=!0;var s=t("./../Integration.js"),c=o(s),f=t("./../functions/deleteProperty.js"),l=o(f),d=function(t){function e(n,r){i(this,e);var o=Object.assign({containerId:null},r),u=a(this,t.call(this,n,o));return u.addTag({type:"script",attr:{src:"//www.googletagmanager.com/gtm.js?id="+r.containerId+"&l=dataLayer"}}),u}return u(e,t),e.getName=function(){return"Google Tag Manager"},e.prototype.initialize=function(){this.getOption("containerId")?(window.dataLayer=window.dataLayer||[],window.dataLayer.push({"gtm.start":Number(new Date),event:"gtm.js"}),this.load(this.ready)):this.ready()},e.prototype.isLoaded=function(){return!(!window.dataLayer||Array.prototype.push===window.dataLayer.push)},e.prototype.reset=function(){(0,l["default"])(window,"dataLayer"),(0,l["default"])(window,"google_tag_manager")},e.prototype.trackEvent=function(t){var e=t.name,n=t.category;(0,l["default"])(t,"name"),(0,l["default"])(t,"category"),t.event=e,t.eventCategory=n,window.dataLayer.push(t)},e}(c["default"]);n["default"]=d},{"./../Integration.js":53,"./../functions/deleteProperty.js":57}],71:[function(t,e,n){"use strict";function r(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}function o(t){return t&&t.__esModule?t:{"default":t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==("undefined"==typeof e?"undefined":r(e))&&"function"!=typeof e?t:e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof e?"undefined":r(e)));t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}n.__esModule=!0;var s=t("./../Integration.js"),c=o(s),f=t("./../functions/deleteProperty.js"),l=o(f),d=t("./../functions/throwError.js"),p=o(d),h=t("component-type"),g=o(h),y=t("./../functions/format.js"),v=o(y),w=t("./../functions/getQueryParam.js"),m=o(w),b=function(t){function e(n,r){i(this,e);var o=Object.assign({partnerId:"",trackAllEmails:!1},r),u=a(this,t.call(this,n,o));return u.addTag({type:"script",attr:{id:"rrApi-jssdk",src:"//cdn.retailrocket.ru/content/javascript/api.js"}}),u}return u(e,t),e.getName=function(){return"Retail Rocket"},e.prototype.initialize=function(){this.getOption("partnerId")?(window.rrPartnerId=this.getOption("partnerId"),window.rrApi={},window.rrApiOnReady=window.rrApiOnReady||[],window.rrApi.addToBasket=window.rrApi.order=window.rrApi.categoryView=window.rrApi.view=window.rrApi.recomMouseDown=window.rrApi.recomAddToCart=function(){},this.trackEmail(),this.load(this.ready)):this.ready()},e.prototype.isLoaded=function(){return!(!window.rrApi||"function"!=typeof window.rrApi._initialize)},e.prototype.reset=function(){(0,l["default"])(window,"rrPartnerId"),(0,l["default"])(window,"rrApi"),(0,l["default"])(window,"rrApiOnReady"),(0,l["default"])(window,"rcApi"),(0,l["default"])(window,"retailrocket"),(0,l["default"])(window,"retailrocket_products"),(0,l["default"])(window,"rrLibrary");var t=document.getElementById("rrApi-jssdk");t&&t.parentNode&&t.parentNode.removeChild(t)},e.prototype.trackEvent=function(t){"Viewed Product Category"===t.name?this.onViewedProductCategory(t.page):"Added Product"===t.name?this.onAddedProduct(t.product):"Viewed Product Detail"===t.name?this.onViewedProductDetail(t.product):"Completed Transaction"===t.name?this.onCompletedTransaction(t.transaction):"Subscribed"===t.name&&this.onSubscribed(t.user)},e.prototype.trackEmail=function(){var t=this;if(this.get("user.email"))(this.getOption("trackAllEmails")===!0||this.get("user.isSubscribed")===!0)&&this.onSubscribed();else{var e=(0,m["default"])("rr_setemail",this.getQueryString());e?window.digitalData.user.email=e:window.ddListener.push(["on","change:user.email",function(){(t.getOption("trackAllEmails")===!0||t.get("user.isSubscribed")===!0)&&t.onSubscribed()}])}},e.prototype.onViewedProductCategory=function(t){var e=this;t=t||{};var n=t.categoryId||this.get("page.categoryId");return n?void window.rrApiOnReady.push(function(){try{window.rrApi.categoryView(n)}catch(t){e.onError(t)}}):void this.onValidationError("page.categoryId")},e.prototype.onViewedProductDetail=function(t){var e=this,n=this.getProductId(t);return n?void window.rrApiOnReady.push(function(){try{window.rrApi.view(n)}catch(t){e.onError(t)}}):void this.onValidationError("product.id")},e.prototype.onAddedProduct=function(t){var e=this,n=this.getProductId(t);return n?void window.rrApiOnReady.push(function(){try{window.rrApi.addToBasket(n)}catch(t){e.onError(t)}}):void this.onValidationError("product.id")},e.prototype.onCompletedTransaction=function(t){var e=this;if(t=t||this.get("transaction")||{},this.validateTransaction(t)){for(var n=[],r=t.lineItems,o=0,i=r.length;i>o;o++)if(this.validateLineItem(r[o],o)){var a=r[o].product;n.push({id:a.id,qnt:r[o].quantity,price:a.unitSalePrice||a.unitPrice})}window.rrApiOnReady.push(function(){try{window.rrApi.order({transaction:t.orderId,items:n})}catch(r){e.onError(r)}})}},e.prototype.onSubscribed=function(t){var e=this;return t=t||this.get("user")||{},t.email?void window.rrApiOnReady.push(function(){try{window.rrApi.setEmail(t.email)}catch(n){e.onError(n)}}):void this.onValidationError("user.email")},e.prototype.validateTransaction=function(t){var e=!0;t.orderId||(this.onValidationError("transaction.orderId"),e=!1);var n=t.lineItems;return n&&Array.isArray(n)&&0!==n.length||(this.onValidationError("transaction.lineItems"),e=!1),e},e.prototype.validateLineItem=function(t,e){var n=!0;t.product||(this.onValidationError((0,v["default"])("transaction.lineItems[%d].product",e)),n=!1);var r=t.product;return r.id||(this.onValidationError((0,v["default"])("transaction.lineItems[%d].product.id",e)),n=!1),r.unitSalePrice||r.unitPrice||(this.onValidationError((0,v["default"])("transaction.lineItems[%d].product.unitSalePrice",e)),n=!1),t.quantity||(this.onValidationError((0,v["default"])("transaction.lineItems[%d].quantity",e)),n=!1),n},e.prototype.getProductId=function(t){t=t||{};var e=void 0;return e="object"===(0,g["default"])(t)?t.id||this.get("product.id"):t},e.prototype.onError=function(t){(0,p["default"])("external_error",(0,v["default"])('Retail Rocket integration error: "%s"',t))},e.prototype.onValidationError=function(t){(0,p["default"])("validation_error",(0,v["default"])('Retail Rocket integration error: DDL or event variable "%s" is not defined or empty',t))},e.prototype.getQueryString=function(){return window.location.search},e}(c["default"]);n["default"]=b},{"./../Integration.js":53,"./../functions/deleteProperty.js":57,"./../functions/format.js":59,"./../functions/getQueryParam.js":60,"./../functions/throwError.js":67,"component-type":6}],72:[function(t,e,n){"use strict";t("core-js/modules/es5"),t("core-js/modules/es6.object.assign"),t("core-js/modules/es6.string.trim")},{"core-js/modules/es5":41,"core-js/modules/es6.object.assign":42,"core-js/modules/es6.string.trim":43}]},{},[68]);
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Driveback_DigitalDataLayer</name>
4
+ <version>1.0.0</version>
5
+ <stability>devel</stability>
6
+ <license uri="http://opensource.org/licenses/MIT">MIT</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>The most efficient way to exchange data and events between marketing tags and your pages.</summary>
10
+ <description>Digital Data Layer provides a standardised JSON structure for data relating to the user journey of your visitors, such user details, products viewed and transactions. Data contained in Digital Data Layer can be automatically pushed to any marketing tool or tag management system. This extension plugs into your Magento installation and automatically inserts Digital Data Layer and Digital Data Manager to the top of your pages, taking away 99% of the development work of implementing Digital Data Layer on your site.</description>
11
+ <notes>First stable version with most of required data structures.</notes>
12
+ <authors><author><name>Driveback LLC</name><user>Driveback</user><email>opensource@driveback.ru</email></author></authors>
13
+ <date>2015-12-30</date>
14
+ <time>08:58:26</time>
15
+ <contents><target name="magecommunity"><dir name="Driveback"><dir name="DigitalDataLayer"><dir name="Helper"><file name="Data.php" hash="54e22963c88ead90b0f37d7952833181"/></dir><dir name="Model"><file name="Ddl.php" hash="90aef755b0e3f3b7d496ef592a4b15d7"/><file name="Observer.php" hash="c0e1e4e11e3abbb1909297a1ad9d93d4"/></dir><dir name="etc"><file name="adminhtml.xml" hash="8962fbdb65d1571667cb4205fe88d37c"/><file name="config.xml" hash="c24e54ed52e988a53b3488c5a601f2aa"/><file name="system.xml" hash="acbf953d0f479e743b56974efc39cef4"/></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="driveback"><file name="ddl.xml" hash="4e9377be694d7e576f6ca726d75d0e98"/></dir></dir><dir name="template"><dir name="driveback"><file name="ddl.phtml" hash="5c98d2ae644d5b67281b1b791175dc99"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Driveback_DigitalDataLayer.xml" hash="55b311d09f0e2d5783564a57c05d69cb"/></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Driveback_DigitalDataLayer.csv" hash="eeb6318cfa16ba066959b5401579eb61"/></dir><dir name="ru_RU"><file name="Driveback_DigitalDataLayer.csv" hash="c25b11537f7f7472812d7a69c05eff90"/></dir></dir></target><target name="mageweb"><dir name="js"><dir name="driveback"><file name="dd-manager.min.js" hash="a666bf16a05825614a285ebde902ba6a"/></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>