algoliasearch - Version 1.6.0

Version Notes

Change Log: https://github.com/algolia/algoliasearch-magento/blob/master/CHANGELOG.md

Download this release

Release Info

Developer Algolia Team
Extension algoliasearch
Version 1.6.0
Comparing to
See all releases


Code changes from version 1.5.5 to 1.6.0

Files changed (66) hide show
  1. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/AbstractField.php +90 -0
  2. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/AdditionalSections.php +61 -0
  3. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/CategoryAdditionalAttributes.php +61 -0
  4. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/CustomRankingCategoryAttributes.php +44 -0
  5. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/CustomRankingProductAttributes.php +44 -0
  6. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Custompages.php +0 -62
  7. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Customrankingcategory.php +0 -81
  8. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Customrankingproduct.php +0 -79
  9. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Customsortorder.php +0 -73
  10. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Customsortordercategory.php +0 -119
  11. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Customsortorderproduct.php +0 -118
  12. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/ExcludedPages.php +37 -0
  13. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Facets.php +40 -76
  14. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/OnewaySynonyms.php +24 -0
  15. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/ProductAdditionalAttributes.php +61 -0
  16. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Sections.php +0 -85
  17. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Select.php +6 -4
  18. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Sorts.php +38 -79
  19. app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Synonyms.php +20 -0
  20. app/code/community/Algolia/Algoliasearch/Helper/Algoliahelper.php +69 -42
  21. app/code/community/Algolia/Algoliasearch/Helper/Config.php +216 -128
  22. app/code/community/Algolia/Algoliasearch/Helper/Data.php +263 -194
  23. app/code/community/Algolia/Algoliasearch/Helper/Entity/Additionalsectionshelper.php +32 -29
  24. app/code/community/Algolia/Algoliasearch/Helper/Entity/Categoryhelper.php +70 -60
  25. app/code/community/Algolia/Algoliasearch/Helper/Entity/Helper.php +123 -99
  26. app/code/community/Algolia/Algoliasearch/Helper/Entity/Pagehelper.php +27 -14
  27. app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php +514 -388
  28. app/code/community/Algolia/Algoliasearch/Helper/Entity/Suggestionhelper.php +27 -25
  29. app/code/community/Algolia/Algoliasearch/Helper/Image.php +15 -9
  30. app/code/community/Algolia/Algoliasearch/Helper/Logger.php +19 -11
  31. app/code/community/Algolia/Algoliasearch/Model/Indexer/Abstract.php +90 -0
  32. app/code/community/Algolia/Algoliasearch/Model/Indexer/Algolia.php +76 -106
  33. app/code/community/Algolia/Algoliasearch/Model/Indexer/Algoliaadditionalsections.php +15 -8
  34. app/code/community/Algolia/Algoliasearch/Model/Indexer/Algoliacategories.php +63 -83
  35. app/code/community/Algolia/Algoliasearch/Model/Indexer/Algoliapages.php +15 -8
  36. app/code/community/Algolia/Algoliasearch/Model/Indexer/Algoliaqueuerunner.php +10 -5
  37. app/code/community/Algolia/Algoliasearch/Model/Indexer/Algoliasuggestions.php +15 -8
  38. app/code/community/Algolia/Algoliasearch/Model/Observer.php +74 -69
  39. app/code/community/Algolia/Algoliasearch/Model/Queue.php +74 -60
  40. app/code/community/Algolia/Algoliasearch/Model/Resource/Engine.php +186 -148
  41. app/code/community/Algolia/Algoliasearch/Model/Resource/Fulltext.php +24 -17
  42. app/code/community/Algolia/Algoliasearch/Model/Resource/Fulltext/Collection.php +18 -15
  43. app/code/community/Algolia/Algoliasearch/Model/System/Config/Backend/SynonymsFile.php +9 -0
  44. app/code/community/Algolia/Algoliasearch/Model/System/Imagetype.php +6 -7
  45. app/code/community/Algolia/Algoliasearch/Model/System/Removewords.php +7 -8
  46. app/code/community/Algolia/Algoliasearch/etc/adminhtml.xml +1 -1
  47. app/code/community/Algolia/Algoliasearch/etc/config.xml +20 -1
  48. app/code/community/Algolia/Algoliasearch/etc/system.xml +125 -19
  49. app/code/community/Algolia/Algoliasearch/sql/algoliasearch_setup/mysql4-install-0.1.0.php +2 -1
  50. app/code/community/Algolia/Algoliasearch/sql/algoliasearch_setup/mysql4-upgrade-0.1.0-1.4.8.php +3 -2
  51. app/code/community/Algolia/Algoliasearch/sql/algoliasearch_setup/mysql4-upgrade-1.4.8-1.5.0.php +5 -4
  52. app/code/community/Algolia/Algoliasearch/sql/algoliasearch_setup/mysql4-upgrade-1.5.5-1.6.0.php +11 -0
  53. app/design/adminhtml/default/default/layout/algoliasearch.xml +1 -1
  54. app/design/adminhtml/default/default/template/algoliasearch/adminjs.phtml +8 -0
  55. app/design/frontend/base/default/layout/algoliasearch.xml +12 -6
  56. app/design/frontend/base/default/template/algoliasearch/autocomplete.phtml +271 -0
  57. app/design/frontend/base/default/template/algoliasearch/instantsearch.phtml +601 -0
  58. app/design/frontend/base/default/template/algoliasearch/{beforecontent.phtml → internals/beforecontent.phtml} +0 -0
  59. app/design/frontend/base/default/template/algoliasearch/{beforetopsearch.phtml → internals/commonjs.phtml} +56 -29
  60. app/design/frontend/base/default/template/algoliasearch/{frontjs.phtml → internals/frontjs.phtml} +0 -0
  61. app/design/frontend/base/default/template/algoliasearch/internals/templateloader.phtml +4 -0
  62. app/design/frontend/base/default/template/algoliasearch/topsearch.phtml +0 -802
  63. app/etc/modules/Algolia_Algoliasearch.xml +1 -1
  64. app/locale/en_GB/Algolia_Algoliasearch.csv +72 -0
  65. js/algoliasearch/admin_scripts.js +38 -0
  66. js/algoliasearch/algoliaAdminBundle.min.js +0 -31
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/AbstractField.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+ protected $settings;
6
+ protected $selectFields = [];
7
+
8
+ public function __construct()
9
+ {
10
+ if (!isset($this->settings)) {
11
+ throw new Exception('Please, specify columns settings.');
12
+ }
13
+
14
+ foreach ($this->settings['columns'] as $columnName => $columnSettings) {
15
+ $fieldSettings = [];
16
+
17
+ if (isset($columnSettings['label'])) {
18
+ $fieldSettings['label'] = Mage::helper('adminhtml')->__($columnSettings['label']);
19
+ }
20
+
21
+ if (isset($columnSettings['options'])) {
22
+ $fieldSettings['renderer'] = $this->getRenderer($columnName, $columnSettings);
23
+ }
24
+
25
+ if (isset($columnSettings['class'])) {
26
+ $fieldSettings['class'] = $columnSettings['class'];
27
+ }
28
+
29
+ if (isset($columnSettings['style'])) {
30
+ $fieldSettings['style'] = $columnSettings['style'];
31
+ }
32
+
33
+ $this->addColumn($columnName, $fieldSettings);
34
+ }
35
+
36
+ $this->_addAfter = $this->settings['addAfter'];
37
+ $this->_addButtonLabel = Mage::helper('adminhtml')->__($this->settings['buttonLabel']);
38
+
39
+ parent::__construct();
40
+ }
41
+
42
+ protected function _prepareArrayRow(Varien_Object $row)
43
+ {
44
+ foreach ($this->settings['columns'] as $columnName => $columnSettings) {
45
+ if (!isset($columnSettings['options']) || !isset($columnSettings['rowMethod'])) {
46
+ continue;
47
+ }
48
+
49
+ $row->setData('option_extra_attr_'.$this->getRenderer($columnName, $columnSettings)->calcOptionHash($row->{$columnSettings['rowMethod']}()), 'selected="selected"');
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Creates and populates a select block to represent each column in the configuration property.
55
+ *
56
+ * @param $columnId string The name of the column defined in addColumn
57
+ * @param $columnSettings array Settings for select box
58
+ *
59
+ * @return Algolia_Algoliasearch_Block_System_Config_Form_Field_Select
60
+ *
61
+ * @throws Exception
62
+ */
63
+ protected function getRenderer($columnId, array $columnSettings)
64
+ {
65
+ if (array_key_exists($columnId, $this->selectFields) && $this->selectFields[$columnId]) {
66
+ return $this->selectFields[$columnId];
67
+ }
68
+
69
+ $options = $columnSettings['options'];
70
+ if (!is_array($options) && is_callable($options)) {
71
+ $options = $options();
72
+ }
73
+
74
+ $width = 100;
75
+ if (isset($columnSettings['width'])) {
76
+ $width = $columnSettings['width'];
77
+ }
78
+
79
+ /** @var Algolia_Algoliasearch_Block_System_Config_Form_Field_Select $selectField */
80
+ $selectField = Mage::app()->getLayout()->createBlock('algoliasearch/system_config_form_field_select');
81
+
82
+ $selectField->setIsRenderToJsTemplate(true);
83
+ $selectField->setOptions($options);
84
+ $selectField->setExtraParams('style="width:'.$width.'px;"');
85
+
86
+ $this->selectFields[$columnId] = $selectField;
87
+
88
+ return $this->selectFields[$columnId];
89
+ }
90
+ }
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/AdditionalSections.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Algolia custom sort order field.
5
+ */
6
+ class Algolia_Algoliasearch_Block_System_Config_Form_Field_AdditionalSections extends Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField
7
+ {
8
+ public function __construct()
9
+ {
10
+ $this->settings = [
11
+ 'columns' => [
12
+ 'name' => [
13
+ 'label' => 'Section',
14
+ 'options' => function () {
15
+ $options = [];
16
+
17
+ $sections = [
18
+ ['name' => 'pages', 'label' => 'Pages'],
19
+ ];
20
+
21
+ /** @var Algolia_Algoliasearch_Helper_Config $config */
22
+ $config = Mage::helper('algoliasearch/config');
23
+
24
+ $attributes = $config->getFacets();
25
+ foreach ($attributes as $attribute) {
26
+ if ($attribute['attribute'] == 'price' || $attribute['attribute'] == 'category' || $attribute['attribute'] == 'categories') {
27
+ continue;
28
+ }
29
+
30
+ $sections[] = [
31
+ 'name' => $attribute['attribute'],
32
+ 'label' => $attribute['label'] ? $attribute['label'] : $attribute['attribute']
33
+ ];
34
+ }
35
+
36
+ foreach ($sections as $section) {
37
+ $options[$section['name']] = $section['label'];
38
+ }
39
+
40
+ return $options;
41
+ },
42
+ 'rowMethod' => 'getName',
43
+ 'width' => 130,
44
+ ],
45
+ 'label' => [
46
+ 'label' => 'Label',
47
+ 'style' => 'width: 100px;',
48
+ ],
49
+ 'hitsPerPage' => [
50
+ 'label' => 'Hits per page',
51
+ 'style' => 'width: 100px;',
52
+ 'class' => 'required-entry input-text validate-number',
53
+ ],
54
+ ],
55
+ 'buttonLabel' => 'Add Section',
56
+ 'addAfter' => false,
57
+ ];
58
+
59
+ parent::__construct();
60
+ }
61
+ }
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/CategoryAdditionalAttributes.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Algolia custom sort order field.
5
+ */
6
+ class Algolia_Algoliasearch_Block_System_Config_Form_Field_CategoryAdditionalAttributes extends Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField
7
+ {
8
+ public function __construct()
9
+ {
10
+ $this->settings = [
11
+ 'columns' => [
12
+ 'attribute' => [
13
+ 'label' => 'Attribute',
14
+ 'options' => function () {
15
+ $options = [];
16
+
17
+ /** @var Algolia_Algoliasearch_Helper_Entity_Categoryhelper $category_helper */
18
+ $category_helper = Mage::helper('algoliasearch/entity_categoryhelper');
19
+
20
+ $searchableAttributes = $category_helper->getAllAttributes();
21
+ foreach ($searchableAttributes as $key => $label) {
22
+ $options[$key] = $key ? $key : $label;
23
+ }
24
+
25
+ return $options;
26
+ },
27
+ 'rowMethod' => 'getAttribute',
28
+ 'width' => 160,
29
+ ],
30
+ 'searchable' => [
31
+ 'label' => 'Searchable',
32
+ 'options' => [
33
+ '1' => 'Yes',
34
+ '0' => 'No',
35
+ ],
36
+ 'rowMethod' => 'getSearchable',
37
+ ],
38
+ 'retrievable' => [
39
+ 'label' => 'Retrievable',
40
+ 'options' => [
41
+ '1' => 'Yes',
42
+ '0' => 'No',
43
+ ],
44
+ 'rowMethod' => 'getRetrievable',
45
+ ],
46
+ 'order' => [
47
+ 'label' => 'Ordered',
48
+ 'options' => [
49
+ 'ordered' => 'Ordered',
50
+ 'unordered' => 'Unordered',
51
+ ],
52
+ 'rowMethod' => 'getOrder',
53
+ ],
54
+ ],
55
+ 'buttonLabel' => 'Add Attribute',
56
+ 'addAfter' => false,
57
+ ];
58
+
59
+ parent::__construct();
60
+ }
61
+ }
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/CustomRankingCategoryAttributes.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Algolia custom sort order field.
5
+ */
6
+ class Algolia_Algoliasearch_Block_System_Config_Form_Field_CustomRankingCategoryAttributes extends Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField
7
+ {
8
+ public function __construct()
9
+ {
10
+ $this->settings = [
11
+ 'columns' => [
12
+ 'attribute' => [
13
+ 'label' => 'Attribute',
14
+ 'options' => function () {
15
+ $options = [];
16
+
17
+ /** @var Algolia_Algoliasearch_Helper_Config $config */
18
+ $config = Mage::helper('algoliasearch/config');
19
+
20
+ $attributes = $config->getCategoryAdditionalAttributes();
21
+ foreach ($attributes as $attribute) {
22
+ $options[$attribute['attribute']] = $attribute['attribute'];
23
+ }
24
+
25
+ return $options;
26
+ },
27
+ 'rowMethod' => 'getAttribute',
28
+ ],
29
+ 'order' => [
30
+ 'label' => 'Asc / Desc',
31
+ 'options' => [
32
+ 'desc' => 'Descending',
33
+ 'asc' => 'Ascending',
34
+ ],
35
+ 'rowMethod' => 'getOrder',
36
+ ],
37
+ ],
38
+ 'buttonLabel' => 'Add Ranking Criterion',
39
+ 'addAfter' => false,
40
+ ];
41
+
42
+ parent::__construct();
43
+ }
44
+ }
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/CustomRankingProductAttributes.php ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Algolia custom sort order field.
5
+ */
6
+ class Algolia_Algoliasearch_Block_System_Config_Form_Field_CustomRankingProductAttributes extends Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField
7
+ {
8
+ public function __construct()
9
+ {
10
+ $this->settings = [
11
+ 'columns' => [
12
+ 'attribute' => [
13
+ 'label' => 'Attribute',
14
+ 'options' => function () {
15
+ $options = [];
16
+
17
+ /** @var Algolia_Algoliasearch_Helper_Config $config */
18
+ $config = Mage::helper('algoliasearch/config');
19
+
20
+ $attributes = $config->getProductAdditionalAttributes();
21
+ foreach ($attributes as $attribute) {
22
+ $options[$attribute['attribute']] = $attribute['attribute'];
23
+ }
24
+
25
+ return $options;
26
+ },
27
+ 'rowMethod' => 'getAttribute',
28
+ ],
29
+ 'order' => [
30
+ 'label' => 'Asc / Desc',
31
+ 'options' => [
32
+ 'desc' => 'Descending',
33
+ 'asc' => 'Ascending',
34
+ ],
35
+ 'rowMethod' => 'getOrder',
36
+ ],
37
+ ],
38
+ 'buttonLabel' => 'Add Ranking Criterion',
39
+ 'addAfter' => false,
40
+ ];
41
+
42
+ parent::__construct();
43
+ }
44
+ }
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Custompages.php DELETED
@@ -1,62 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Algolia custom sort order field
5
- */
6
- class Algolia_Algoliasearch_Block_System_Config_Form_Field_Custompages extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
7
- {
8
- protected $selectFields = array();
9
-
10
- /**
11
- * Creates and populates a select block to represent each column in the configuration property.
12
- *
13
- * @param $columnId String The name of the column defined in addColumn
14
- * @return Algolia_Algoliasearch_Block_System_Config_Form_Field_Select
15
- * @throws Exception
16
- */
17
- protected function getRenderer($columnId) {
18
- if (!array_key_exists($columnId, $this->selectFields) || !$this->selectFields[$columnId]) {
19
- $aOptions = array();
20
- switch($columnId) {
21
- case 'pages': // Populate the attribute column with a list of searchable attributes
22
- $magento_pages = Mage::getModel('cms/page')->getCollection()->addFieldToFilter('is_active',1);
23
-
24
- $ids = $magento_pages->toOptionArray();
25
-
26
- foreach ($ids as $id)
27
- $aOptions[$id['value']] = $id['value'];
28
-
29
- break;
30
- default:
31
- throw new Exception('Unknown attribute id ' . $columnId);
32
- }
33
-
34
- $selectField = Mage::app()->getLayout()->createBlock('algoliasearch/system_config_form_field_select')->setIsRenderToJsTemplate(true);
35
- $selectField->setOptions($aOptions);
36
- $selectField->setExtraParams('style="width:160px;"');
37
- $this->selectFields[$columnId] = $selectField;
38
- }
39
-
40
- return $this->selectFields[$columnId];
41
- }
42
-
43
- public function __construct()
44
- {
45
- $this->addColumn('pages', array(
46
- 'label' => Mage::helper('adminhtml')->__('Pages'),
47
- 'renderer'=> $this->getRenderer('pages'),
48
- ));
49
- $this->_addAfter = false;
50
- $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Excluded Page');
51
- parent::__construct();
52
- }
53
-
54
- protected function _prepareArrayRow(Varien_Object $row)
55
- {
56
- $row->setData(
57
- 'option_extra_attr_' . $this->getRenderer('pages')->calcOptionHash(
58
- $row->getPages()),
59
- 'selected="selected"'
60
- );
61
- }
62
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Customrankingcategory.php DELETED
@@ -1,81 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Algolia custom sort order field
5
- */
6
- class Algolia_Algoliasearch_Block_System_Config_Form_Field_Customrankingcategory extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
7
- {
8
- protected $selectFields = array();
9
-
10
- /**
11
- * Creates and populates a select block to represent each column in the configuration property.
12
- *
13
- * @param $columnId String The name of the column defined in addColumn
14
- * @return Algolia_Algoliasearch_Block_System_Config_Form_Field_Select
15
- * @throws Exception
16
- */
17
- protected function getRenderer($columnId)
18
- {
19
- if (!array_key_exists($columnId, $this->selectFields) || !$this->selectFields[$columnId])
20
- {
21
- $config = Mage::helper('algoliasearch/config');
22
-
23
- $aOptions = array();
24
-
25
- switch($columnId) {
26
- case 'attribute': // Populate the attribute column with a list of searchable attributes
27
- $searchableAttributes = $config->getCategoryAdditionalAttributes();
28
-
29
- foreach ($searchableAttributes as $attribute) {
30
- $aOptions[$attribute['attribute']] = $attribute['attribute'];
31
- }
32
-
33
- break;
34
- case 'order':
35
- $aOptions = array(
36
- 'desc' => 'Descending',
37
- 'asc' => 'Ascending',
38
- );
39
- break;
40
- default:
41
- throw new Exception('Unknown attribute id ' . $columnId);
42
- }
43
-
44
- $selectField = Mage::app()->getLayout()->createBlock('algoliasearch/system_config_form_field_select')->setIsRenderToJsTemplate(true);
45
- $selectField->setOptions($aOptions);
46
- $selectField->setExtraParams('style="width:160px;"');
47
- $this->selectFields[$columnId] = $selectField;
48
- }
49
-
50
- return $this->selectFields[$columnId];
51
- }
52
-
53
- public function __construct()
54
- {
55
- $this->addColumn('attribute', array(
56
- 'label' => Mage::helper('adminhtml')->__('Attribute'),
57
- 'renderer'=> $this->getRenderer('attribute'),
58
- ));
59
- $this->addColumn('order', array(
60
- 'label' => Mage::helper('adminhtml')->__('Asc / Desc'),
61
- 'renderer'=> $this->getRenderer('order'),
62
- ));
63
- $this->_addAfter = false;
64
- $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Ranking Criterion');
65
- parent::__construct();
66
- }
67
-
68
- protected function _prepareArrayRow(Varien_Object $row)
69
- {
70
- $row->setData(
71
- 'option_extra_attr_' . $this->getRenderer('attribute')->calcOptionHash(
72
- $row->getAttribute()),
73
- 'selected="selected"'
74
- );
75
- $row->setData(
76
- 'option_extra_attr_' . $this->getRenderer('order')->calcOptionHash(
77
- $row->getOrder()),
78
- 'selected="selected"'
79
- );
80
- }
81
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Customrankingproduct.php DELETED
@@ -1,79 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Algolia custom sort order field
5
- */
6
- class Algolia_Algoliasearch_Block_System_Config_Form_Field_Customrankingproduct extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
7
- {
8
- protected $selectFields = array();
9
-
10
- /**
11
- * Creates and populates a select block to represent each column in the configuration property.
12
- *
13
- * @param $columnId String The name of the column defined in addColumn
14
- * @return Algolia_Algoliasearch_Block_System_Config_Form_Field_Select
15
- * @throws Exception
16
- */
17
- protected function getRenderer($columnId)
18
- {
19
- if (!array_key_exists($columnId, $this->selectFields) || !$this->selectFields[$columnId])
20
- {
21
- $config = Mage::helper('algoliasearch/config');
22
-
23
- $aOptions = array();
24
-
25
- switch($columnId) {
26
- case 'attribute': // Populate the attribute column with a list of searchable attributes
27
- $attributes = $config->getProductAdditionalAttributes();
28
-
29
- foreach ($attributes as $attribute)
30
- $aOptions[$attribute['attribute']] = $attribute['attribute'];
31
-
32
- break;
33
- case 'order':
34
- $aOptions = array(
35
- 'desc' => 'Descending',
36
- 'asc' => 'Ascending',
37
- );
38
- break;
39
- default:
40
- throw new Exception('Unknown attribute id ' . $columnId);
41
- }
42
-
43
- $selectField = Mage::app()->getLayout()->createBlock('algoliasearch/system_config_form_field_select')->setIsRenderToJsTemplate(true);
44
- $selectField->setOptions($aOptions);
45
- $selectField->setExtraParams('style="width:160px;"');
46
- $this->selectFields[$columnId] = $selectField;
47
- }
48
- return $this->selectFields[$columnId];
49
- }
50
-
51
- public function __construct()
52
- {
53
- $this->addColumn('attribute', array(
54
- 'label' => Mage::helper('adminhtml')->__('Attribute'),
55
- 'renderer'=> $this->getRenderer('attribute'),
56
- ));
57
- $this->addColumn('order', array(
58
- 'label' => Mage::helper('adminhtml')->__('Ordered'),
59
- 'renderer'=> $this->getRenderer('order'),
60
- ));
61
- $this->_addAfter = false;
62
- $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Ranking Criterion');
63
- parent::__construct();
64
- }
65
-
66
- protected function _prepareArrayRow(Varien_Object $row)
67
- {
68
- $row->setData(
69
- 'option_extra_attr_' . $this->getRenderer('attribute')->calcOptionHash(
70
- $row->getAttribute()),
71
- 'selected="selected"'
72
- );
73
- $row->setData(
74
- 'option_extra_attr_' . $this->getRenderer('order')->calcOptionHash(
75
- $row->getOrder()),
76
- 'selected="selected"'
77
- );
78
- }
79
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Customsortorder.php DELETED
@@ -1,73 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Algolia custom sort order field
5
- */
6
- class Algolia_Algoliasearch_Block_System_Config_Form_Field_Customsortorder extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
7
- {
8
- protected $selectFields = array();
9
-
10
- /**
11
- * Creates and populates a select block to represent each column in the configuration property.
12
- *
13
- * @param $columnId String The name of the column defined in addColumn
14
- * @return Algolia_Algoliasearch_Block_System_Config_Form_Field_Select
15
- * @throws Exception
16
- */
17
- protected function getRenderer($columnId) {
18
- if (!array_key_exists($columnId, $this->selectFields) || !$this->selectFields[$columnId]) {
19
- $aOptions = array('popularity' => Mage::helper('algoliasearch')->__('Popularity'));
20
- switch($columnId) {
21
- case 'attribute': // Populate the attribute column with a list of searchable attributes
22
- $searchableAttributes = Mage::getResourceModel('algoliasearch/fulltext')->getSearchableAttributes();
23
- foreach ($searchableAttributes as $attribute){
24
- $aOptions[$attribute->getAttributecode()] = $attribute->getFrontendLabel();
25
- }
26
- break;
27
- case 'order':
28
- $aOptions = array(
29
- 'desc' => 'Descending',
30
- 'asc' => 'Ascending',
31
- );
32
- break;
33
- default:
34
- throw new Exception('Unknown attribute id ' . $columnId);
35
- }
36
-
37
- $selectField = Mage::app()->getLayout()->createBlock('algoliasearch/system_config_form_field_select')->setIsRenderToJsTemplate(true);
38
- $selectField->setOptions($aOptions);
39
- $selectField->setExtraParams('style="width:160px;"');
40
- $this->selectFields[$columnId] = $selectField;
41
- }
42
- return $this->selectFields[$columnId];
43
- }
44
-
45
- public function __construct()
46
- {
47
- $this->addColumn('attribute', array(
48
- 'label' => Mage::helper('adminhtml')->__('Attribute'),
49
- 'renderer'=> $this->getRenderer('attribute'),
50
- ));
51
- $this->addColumn('order', array(
52
- 'label' => Mage::helper('adminhtml')->__('Sort Order'),
53
- 'renderer'=> $this->getRenderer('order'),
54
- ));
55
- $this->_addAfter = false;
56
- $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Custom Sort Order');
57
- parent::__construct();
58
- }
59
-
60
- protected function _prepareArrayRow(Varien_Object $row)
61
- {
62
- $row->setData(
63
- 'option_extra_attr_' . $this->getRenderer('attribute')->calcOptionHash(
64
- $row->getAttribute()),
65
- 'selected="selected"'
66
- );
67
- $row->setData(
68
- 'option_extra_attr_' . $this->getRenderer('order')->calcOptionHash(
69
- $row->getOrder()),
70
- 'selected="selected"'
71
- );
72
- }
73
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Customsortordercategory.php DELETED
@@ -1,119 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Algolia custom sort order field
5
- */
6
- class Algolia_Algoliasearch_Block_System_Config_Form_Field_Customsortordercategory extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
7
- {
8
- protected $selectFields = array();
9
-
10
- /**
11
- * Creates and populates a select block to represent each column in the configuration property.
12
- *
13
- * @param $columnId String The name of the column defined in addColumn
14
- * @return Algolia_Algoliasearch_Block_System_Config_Form_Field_Select
15
- * @throws Exception
16
- */
17
- protected function getRenderer($columnId)
18
- {
19
- if (!array_key_exists($columnId, $this->selectFields) || !$this->selectFields[$columnId])
20
- {
21
- $category_helper = Mage::helper('algoliasearch/entity_categoryhelper');
22
-
23
- $aOptions = array();
24
-
25
- $selectField = Mage::app()->getLayout()->createBlock('algoliasearch/system_config_form_field_select')->setIsRenderToJsTemplate(true);
26
-
27
- switch($columnId) {
28
- case 'attribute': // Populate the attribute column with a list of searchable attributes
29
- $searchableAttributes = $category_helper->getAllAttributes();
30
-
31
- foreach ($searchableAttributes as $key => $label) {
32
- $aOptions[$key] = $key ? $key : $label;
33
- }
34
-
35
- $selectField->setExtraParams('style="width:160px;"');
36
-
37
- break;
38
- case 'searchable':
39
- $aOptions = array(
40
- '1' => 'Yes',
41
- '0' => 'No',
42
- );
43
-
44
- $selectField->setExtraParams('style="width:100px;"');
45
- break;
46
- case 'retrievable':
47
- $aOptions = array(
48
- '1' => 'Yes',
49
- '0' => 'No',
50
- );
51
-
52
- $selectField->setExtraParams('style="width:100px;"');
53
- break;
54
- case 'order':
55
- $aOptions = array(
56
- 'ordered' => 'Ordered',
57
- 'unordered' => 'Unordered',
58
- );
59
-
60
- $selectField->setExtraParams('style="width:100px;"');
61
- break;
62
- default:
63
- throw new Exception('Unknown attribute id ' . $columnId);
64
- }
65
-
66
- $selectField->setOptions($aOptions);
67
- $this->selectFields[$columnId] = $selectField;
68
- }
69
-
70
- return $this->selectFields[$columnId];
71
- }
72
-
73
- public function __construct()
74
- {
75
- $this->addColumn('attribute', array(
76
- 'label' => Mage::helper('adminhtml')->__('Attribute'),
77
- 'renderer'=> $this->getRenderer('attribute'),
78
- ));
79
- $this->addColumn('searchable', array(
80
- 'label' => Mage::helper('adminhtml')->__('Searchable'),
81
- 'renderer'=> $this->getRenderer('searchable'),
82
- ));
83
- $this->addColumn('retrievable', array(
84
- 'label' => Mage::helper('adminhtml')->__('Retrievable'),
85
- 'renderer'=> $this->getRenderer('retrievable'),
86
- ));
87
- $this->addColumn('order', array(
88
- 'label' => Mage::helper('adminhtml')->__('Ordered'),
89
- 'renderer'=> $this->getRenderer('order'),
90
- ));
91
- $this->_addAfter = false;
92
- $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Attribute');
93
- parent::__construct();
94
- }
95
-
96
- protected function _prepareArrayRow(Varien_Object $row)
97
- {
98
- $row->setData(
99
- 'option_extra_attr_' . $this->getRenderer('attribute')->calcOptionHash(
100
- $row->getAttribute()),
101
- 'selected="selected"'
102
- );
103
- $row->setData(
104
- 'option_extra_attr_' . $this->getRenderer('searchable')->calcOptionHash(
105
- $row->getSearchable()),
106
- 'selected="selected"'
107
- );
108
- $row->setData(
109
- 'option_extra_attr_' . $this->getRenderer('searchable')->calcOptionHash(
110
- $row->getRetrievable()),
111
- 'selected="selected"'
112
- );
113
- $row->setData(
114
- 'option_extra_attr_' . $this->getRenderer('order')->calcOptionHash(
115
- $row->getOrder()),
116
- 'selected="selected"'
117
- );
118
- }
119
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Customsortorderproduct.php DELETED
@@ -1,118 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Algolia custom sort order field
5
- */
6
- class Algolia_Algoliasearch_Block_System_Config_Form_Field_Customsortorderproduct extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
7
- {
8
- protected $selectFields = array();
9
-
10
- /**
11
- * Creates and populates a select block to represent each column in the configuration property.
12
- *
13
- * @param $columnId String The name of the column defined in addColumn
14
- * @return Algolia_Algoliasearch_Block_System_Config_Form_Field_Select
15
- * @throws Exception
16
- */
17
- protected function getRenderer($columnId)
18
- {
19
- if (!array_key_exists($columnId, $this->selectFields) || !$this->selectFields[$columnId])
20
- {
21
- $product_helper = Mage::helper('algoliasearch/entity_producthelper');
22
-
23
- $aOptions = array();
24
-
25
- $selectField = Mage::app()->getLayout()->createBlock('algoliasearch/system_config_form_field_select')->setIsRenderToJsTemplate(true);
26
-
27
- switch($columnId) {
28
- case 'attribute': // Populate the attribute column with a list of searchable attributes
29
- $searchableAttributes = $product_helper->getAllAttributes();
30
-
31
- foreach ($searchableAttributes as $key => $label) {
32
- $aOptions[$key] = $key ? $key : $label;
33
- }
34
-
35
- $selectField->setExtraParams('style="width:160px;"');
36
-
37
- break;
38
- case 'searchable':
39
- $aOptions = array(
40
- '1' => 'Yes',
41
- '0' => 'No',
42
- );
43
-
44
- $selectField->setExtraParams('style="width:100px;"');
45
- break;
46
- case 'retrievable':
47
- $aOptions = array(
48
- '1' => 'Yes',
49
- '0' => 'No',
50
- );
51
-
52
- $selectField->setExtraParams('style="width:100px;"');
53
- break;
54
- case 'order':
55
- $aOptions = array(
56
- 'ordered' => 'Ordered',
57
- 'unordered' => 'Unordered',
58
- );
59
-
60
- $selectField->setExtraParams('style="width:100px;"');
61
- break;
62
- default:
63
- throw new Exception('Unknown attribute id ' . $columnId);
64
- }
65
-
66
- $selectField->setOptions($aOptions);
67
- $this->selectFields[$columnId] = $selectField;
68
- }
69
- return $this->selectFields[$columnId];
70
- }
71
-
72
- public function __construct()
73
- {
74
- $this->addColumn('attribute', array(
75
- 'label' => Mage::helper('adminhtml')->__('Attribute'),
76
- 'renderer'=> $this->getRenderer('attribute'),
77
- ));
78
- $this->addColumn('searchable', array(
79
- 'label' => Mage::helper('adminhtml')->__('Searchable'),
80
- 'renderer'=> $this->getRenderer('searchable'),
81
- ));
82
- $this->addColumn('retrievable', array(
83
- 'label' => Mage::helper('adminhtml')->__('Retrievable'),
84
- 'renderer'=> $this->getRenderer('retrievable'),
85
- ));
86
- $this->addColumn('order', array(
87
- 'label' => Mage::helper('adminhtml')->__('Ordered'),
88
- 'renderer'=> $this->getRenderer('order'),
89
- ));
90
- $this->_addAfter = false;
91
- $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Attribute');
92
- parent::__construct();
93
- }
94
-
95
- protected function _prepareArrayRow(Varien_Object $row)
96
- {
97
- $row->setData(
98
- 'option_extra_attr_' . $this->getRenderer('attribute')->calcOptionHash(
99
- $row->getAttribute()),
100
- 'selected="selected"'
101
- );
102
- $row->setData(
103
- 'option_extra_attr_' . $this->getRenderer('searchable')->calcOptionHash(
104
- $row->getSearchable()),
105
- 'selected="selected"'
106
- );
107
- $row->setData(
108
- 'option_extra_attr_' . $this->getRenderer('retrievable')->calcOptionHash(
109
- $row->getRetrievable()),
110
- 'selected="selected"'
111
- );
112
- $row->setData(
113
- 'option_extra_attr_' . $this->getRenderer('order')->calcOptionHash(
114
- $row->getOrder()),
115
- 'selected="selected"'
116
- );
117
- }
118
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/ExcludedPages.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Algolia custom sort order field.
5
+ */
6
+ class Algolia_Algoliasearch_Block_System_Config_Form_Field_ExcludedPages extends Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField
7
+ {
8
+ public function __construct()
9
+ {
10
+ $this->settings = [
11
+ 'columns' => [
12
+ 'pages' => [
13
+ 'label' => 'Pages',
14
+ 'options' => function () {
15
+ $options = [];
16
+
17
+ /** @var Mage_Cms_Model_Resource_Page_Collection $magento_pages */
18
+ $magento_pages = Mage::getModel('cms/page')->getCollection()->addFieldToFilter('is_active', 1);
19
+
20
+ $ids = $magento_pages->toOptionArray();
21
+ foreach ($ids as $id) {
22
+ $options[$id['value']] = $id['value'];
23
+ }
24
+
25
+ return $options;
26
+ },
27
+ 'rowMethod' => 'getPages',
28
+ 'width' => 230,
29
+ ],
30
+ ],
31
+ 'buttonLabel' => 'Add Excluded Page',
32
+ 'addAfter' => false,
33
+ ];
34
+
35
+ parent::__construct();
36
+ }
37
+ }
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Facets.php CHANGED
@@ -1,87 +1,51 @@
1
  <?php
2
 
3
  /**
4
- * Algolia custom sort order field
5
  */
6
- class Algolia_Algoliasearch_Block_System_Config_Form_Field_Facets extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
7
  {
8
- protected $selectFields = array();
9
-
10
- protected function getRenderer($columnId) {
11
- if (!array_key_exists($columnId, $this->selectFields) || !$this->selectFields[$columnId])
12
- {
13
- $aOptions = array();
14
-
15
- $selectField = Mage::app()->getLayout()->createBlock('algoliasearch/system_config_form_field_select')->setIsRenderToJsTemplate(true);
16
-
17
- $config = Mage::helper('algoliasearch/config');
18
-
19
- switch($columnId) {
20
- case 'attribute': // Populate the attribute column with a list of searchable attributes
21
- $attributes = $config->getProductAdditionalAttributes();
22
-
23
- foreach ($attributes as $attribute) {
24
- $aOptions[$attribute['attribute']] = $attribute['attribute'];
25
- }
26
-
27
- $selectField->setExtraParams('style="width:160px;"');
28
-
29
- break;
30
- case 'type':
31
- $aOptions = array(
32
- 'conjunctive' => 'Conjunctive',
33
- 'disjunctive' => 'Disjunctive',
34
- 'slider' => 'Slider',
35
- 'priceRanges' => 'Price Ranges'
36
- );
37
-
38
- $selectField->setExtraParams('style="width:100px;"');
39
-
40
- break;
41
- default:
42
- throw new Exception('Unknown attribute id ' . $columnId);
43
- }
44
-
45
- $selectField->setOptions($aOptions);
46
- $this->selectFields[$columnId] = $selectField;
47
- }
48
- return $this->selectFields[$columnId];
49
- }
50
-
51
  public function __construct()
52
  {
53
- $this->addColumn('attribute', array(
54
- 'label' => Mage::helper('adminhtml')->__('Attribute'),
55
- 'renderer'=> $this->getRenderer('attribute'),
56
- ));
57
-
58
- $this->addColumn('type', array(
59
- 'label' => Mage::helper('adminhtml')->__('Facet type'),
60
- 'renderer'=> $this->getRenderer('type'),
61
- ));
62
-
63
- $this->addColumn('label', array(
64
- 'label' => Mage::helper('adminhtml')->__('Label'),
65
- 'style' => 'width: 100px;'
66
- ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
- $this->_addAfter = false;
69
- $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Attribute');
70
  parent::__construct();
71
  }
72
-
73
- protected function _prepareArrayRow(Varien_Object $row)
74
- {
75
- $row->setData(
76
- 'option_extra_attr_' . $this->getRenderer('attribute')->calcOptionHash(
77
- $row->getAttribute()),
78
- 'selected="selected"'
79
- );
80
-
81
- $row->setData(
82
- 'option_extra_attr_' . $this->getRenderer('type')->calcOptionHash(
83
- $row->getType()),
84
- 'selected="selected"'
85
- );
86
- }
87
  }
1
  <?php
2
 
3
  /**
4
+ * Algolia custom sort order field.
5
  */
6
+ class Algolia_Algoliasearch_Block_System_Config_Form_Field_Facets extends Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField
7
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  public function __construct()
9
  {
10
+ $this->settings = [
11
+ 'columns' => [
12
+ 'attribute' => [
13
+ 'label' => 'Attribute',
14
+ 'options' => function () {
15
+ $options = [];
16
+
17
+ /** @var Algolia_Algoliasearch_Helper_Entity_Producthelper $product_helper */
18
+ $product_helper = Mage::helper('algoliasearch/entity_producthelper');
19
+
20
+ $attributes = $product_helper->getAllAttributes();
21
+ foreach ($attributes as $key => $label) {
22
+ $options[$key] = $key ?: $label;
23
+ }
24
+
25
+ return $options;
26
+ },
27
+ 'rowMethod' => 'getAttribute',
28
+ 'width' => 160,
29
+ ],
30
+ 'type' => [
31
+ 'label' => 'Facet type',
32
+ 'options' => [
33
+ 'conjunctive' => 'Conjunctive',
34
+ 'disjunctive' => 'Disjunctive',
35
+ 'slider' => 'Slider',
36
+ 'priceRanges' => 'Price Ranges',
37
+ ],
38
+ 'rowMethod' => 'getType',
39
+ ],
40
+ 'label' => [
41
+ 'label' => 'Label',
42
+ 'style' => 'width: 100px;',
43
+ ],
44
+ ],
45
+ 'buttonLabel' => 'Add Facet',
46
+ 'addAfter' => false,
47
+ ];
48
 
 
 
49
  parent::__construct();
50
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  }
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/OnewaySynonyms.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Algolia_Algoliasearch_Block_System_Config_Form_Field_OnewaySynonyms extends Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField
4
+ {
5
+ public function __construct()
6
+ {
7
+ $this->settings = [
8
+ 'columns' => [
9
+ 'input' => [
10
+ 'label' => 'Input',
11
+ 'style' => 'width: 100px;',
12
+ ],
13
+ 'synonyms' => [
14
+ 'label' => 'Synonyms (comma-separated)',
15
+ 'style' => 'width: 435px;',
16
+ ],
17
+ ],
18
+ 'buttonLabel' => 'Add One-way Synonyms',
19
+ 'addAfter' => false,
20
+ ];
21
+
22
+ parent::__construct();
23
+ }
24
+ }
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/ProductAdditionalAttributes.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Algolia custom sort order field.
5
+ */
6
+ class Algolia_Algoliasearch_Block_System_Config_Form_Field_ProductAdditionalAttributes extends Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField
7
+ {
8
+ public function __construct()
9
+ {
10
+ $this->settings = [
11
+ 'columns' => [
12
+ 'attribute' => [
13
+ 'label' => 'Attribute',
14
+ 'options' => function () {
15
+ $options = [];
16
+
17
+ /** @var Algolia_Algoliasearch_Helper_Entity_Producthelper $product_helper */
18
+ $product_helper = Mage::helper('algoliasearch/entity_producthelper');
19
+
20
+ $searchableAttributes = $product_helper->getAllAttributes();
21
+ foreach ($searchableAttributes as $key => $label) {
22
+ $options[$key] = $key ?: $label;
23
+ }
24
+
25
+ return $options;
26
+ },
27
+ 'rowMethod' => 'getAttribute',
28
+ 'width' => 160,
29
+ ],
30
+ 'searchable' => [
31
+ 'label' => 'Searchable',
32
+ 'options' => [
33
+ '1' => 'Yes',
34
+ '0' => 'No',
35
+ ],
36
+ 'rowMethod' => 'getSearchable',
37
+ ],
38
+ 'retrievable' => [
39
+ 'label' => 'Retrievable',
40
+ 'options' => [
41
+ '1' => 'Yes',
42
+ '0' => 'No',
43
+ ],
44
+ 'rowMethod' => 'getRetrievable',
45
+ ],
46
+ 'order' => [
47
+ 'label' => 'Ordered',
48
+ 'options' => [
49
+ 'ordered' => 'Ordered',
50
+ 'unordered' => 'Unordered',
51
+ ],
52
+ 'rowMethod' => 'getOrder',
53
+ ],
54
+ ],
55
+ 'buttonLabel' => 'Add Attribute',
56
+ 'addAfter' => false,
57
+ ];
58
+
59
+ parent::__construct();
60
+ }
61
+ }
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Sections.php DELETED
@@ -1,85 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Algolia custom sort order field
5
- */
6
- class Algolia_Algoliasearch_Block_System_Config_Form_Field_Sections extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
7
- {
8
- protected $selectFields = array();
9
-
10
- protected function getRenderer($columnId) {
11
- if (!array_key_exists($columnId, $this->selectFields) || !$this->selectFields[$columnId])
12
- {
13
- $aOptions = array();
14
-
15
- $selectField = Mage::app()->getLayout()->createBlock('algoliasearch/system_config_form_field_select')->setIsRenderToJsTemplate(true);
16
-
17
- $config = Mage::helper('algoliasearch/config');
18
-
19
- switch($columnId) {
20
- case 'name': // Populate the attribute column with a list of searchable attributes
21
-
22
- $sections = array(
23
- array('name' => 'pages', 'label' => 'Pages'),
24
- );
25
-
26
- $attributes = $config->getFacets();
27
-
28
- foreach ($attributes as $attribute) {
29
- if ($attribute['attribute'] == 'price')
30
- continue;
31
-
32
- if ($attribute['attribute'] == 'category' || $attribute['attribute'] == 'categories')
33
- continue;
34
-
35
- $sections[] = array('name' => $attribute['attribute'], 'label' => $attribute['label'] ? $attribute['label'] : $attribute['attribute']);
36
- }
37
-
38
- foreach ($sections as $section)
39
- $aOptions[$section['name']] = $section['label'];
40
-
41
- $selectField->setExtraParams('style="width:130px;"');
42
-
43
- break;
44
- default:
45
- throw new Exception('Unknown attribute id ' . $columnId);
46
- }
47
-
48
- $selectField->setOptions($aOptions);
49
- $this->selectFields[$columnId] = $selectField;
50
- }
51
- return $this->selectFields[$columnId];
52
- }
53
-
54
- public function __construct()
55
- {
56
- $this->addColumn('name', array(
57
- 'label' => Mage::helper('adminhtml')->__('Section'),
58
- 'renderer' => $this->getRenderer('name'),
59
- ));
60
-
61
- $this->addColumn('label', array(
62
- 'label' => Mage::helper('adminhtml')->__('Label'),
63
- 'style' => 'width: 100px;'
64
- ));
65
-
66
- $this->addColumn('hitsPerPage', array(
67
- 'label' => Mage::helper('adminhtml')->__('Hits per page'),
68
- 'style' => 'width: 100px;',
69
- 'class' => 'required-entry input-text validate-number'
70
- ));
71
-
72
- $this->_addAfter = false;
73
- $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Attribute');
74
- parent::__construct();
75
- }
76
-
77
- protected function _prepareArrayRow(Varien_Object $row)
78
- {
79
- $row->setData(
80
- 'option_extra_attr_' . $this->getRenderer('name')->calcOptionHash(
81
- $row->getName()),
82
- 'selected="selected"'
83
- );
84
- }
85
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Select.php CHANGED
@@ -1,10 +1,12 @@
1
  <?php
2
- class Algolia_Algoliasearch_Block_System_Config_Form_Field_Select extends Mage_Adminhtml_Block_Html_Select {
 
 
3
  protected function _toHtml()
4
  {
5
  $this->setName($this->getInputName());
6
  $this->setClass('select');
7
- return trim(preg_replace('/\s+/', ' ',parent::_toHtml()));
8
- }
9
 
10
- }
 
 
1
  <?php
2
+
3
+ class Algolia_Algoliasearch_Block_System_Config_Form_Field_Select extends Mage_Adminhtml_Block_Html_Select
4
+ {
5
  protected function _toHtml()
6
  {
7
  $this->setName($this->getInputName());
8
  $this->setClass('select');
 
 
9
 
10
+ return trim(preg_replace('/\s+/', ' ', parent::_toHtml()));
11
+ }
12
+ }
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Sorts.php CHANGED
@@ -1,90 +1,49 @@
1
  <?php
2
 
3
  /**
4
- * Algolia custom sort order field
5
  */
6
- class Algolia_Algoliasearch_Block_System_Config_Form_Field_Sorts extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
7
  {
8
- protected $selectFields = array();
9
-
10
- /**
11
- * Creates and populates a select block to represent each column in the configuration property.
12
- *
13
- * @param $columnId String The name of the column defined in addColumn
14
- * @return Algolia_Algoliasearch_Block_System_Config_Form_Field_Select
15
- * @throws Exception
16
- */
17
- protected function getRenderer($columnId) {
18
- if (!array_key_exists($columnId, $this->selectFields) || !$this->selectFields[$columnId])
19
- {
20
- $aOptions = array();
21
-
22
- $selectField = Mage::app()->getLayout()->createBlock('algoliasearch/system_config_form_field_select')->setIsRenderToJsTemplate(true);
23
-
24
- $config = Mage::helper('algoliasearch/config');
25
-
26
- switch($columnId) {
27
- case 'attribute': // Populate the attribute column with a list of searchable attributes
28
- $attributes = $config->getProductAdditionalAttributes();
29
-
30
- foreach ($attributes as $attribute) {
31
- $aOptions[$attribute['attribute']] = $attribute['attribute'];
32
- }
33
-
34
- $selectField->setExtraParams('style="width:160px;"');
35
- break;
36
- case 'sort':
37
- $aOptions = array(
38
- 'asc' => 'Ascending',
39
- 'desc' => 'Descending',
40
- );
41
-
42
- $selectField->setExtraParams('style="width:100px;"');
43
- break;
44
- default:
45
- throw new Exception('Unknown attribute id ' . $columnId);
46
- }
47
-
48
- $selectField->setOptions($aOptions);
49
- $this->selectFields[$columnId] = $selectField;
50
- }
51
- return $this->selectFields[$columnId];
52
- }
53
-
54
  public function __construct()
55
  {
56
- $this->addColumn('attribute', array(
57
- 'label' => Mage::helper('adminhtml')->__('Attribute'),
58
- 'renderer'=> $this->getRenderer('attribute'),
59
- ));
60
-
61
- $this->addColumn('sort', array(
62
- 'label' => Mage::helper('adminhtml')->__('Sort'),
63
- 'renderer'=> $this->getRenderer('sort'),
64
- ));
65
-
66
- $this->addColumn('label', array(
67
- 'label' => Mage::helper('adminhtml')->__('Label'),
68
- 'style' => 'width: 200px;'
69
- ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
- $this->_addAfter = false;
72
- $this->_addButtonLabel = Mage::helper('adminhtml')->__('Add Attribute');
73
  parent::__construct();
74
  }
75
-
76
- protected function _prepareArrayRow(Varien_Object $row)
77
- {
78
- $row->setData(
79
- 'option_extra_attr_' . $this->getRenderer('attribute')->calcOptionHash(
80
- $row->getAttribute()),
81
- 'selected="selected"'
82
- );
83
-
84
- $row->setData(
85
- 'option_extra_attr_' . $this->getRenderer('sort')->calcOptionHash(
86
- $row->getSort()),
87
- 'selected="selected"'
88
- );
89
- }
90
  }
1
  <?php
2
 
3
  /**
4
+ * Algolia custom sort order field.
5
  */
6
+ class Algolia_Algoliasearch_Block_System_Config_Form_Field_Sorts extends Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField
7
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  public function __construct()
9
  {
10
+ $this->settings = [
11
+ 'columns' => [
12
+ 'attribute' => [
13
+ 'label' => 'Attribute',
14
+ 'options' => function () {
15
+ $options = [];
16
+
17
+ /** @var Algolia_Algoliasearch_Helper_Config $config */
18
+ $config = Mage::helper('algoliasearch/config');
19
+
20
+ $attributes = $config->getProductAdditionalAttributes();
21
+ foreach ($attributes as $attribute) {
22
+ $options[$attribute['attribute']] = $attribute['attribute'];
23
+ }
24
+
25
+ return $options;
26
+ },
27
+ 'rowMethod' => 'getAttribute',
28
+ 'width' => 160,
29
+ ],
30
+ 'sort' => [
31
+ 'label' => 'Sort',
32
+ 'options' => [
33
+ 'asc' => 'Ascending',
34
+ 'desc' => 'Descending',
35
+ ],
36
+ 'rowMethod' => 'getSort',
37
+ ],
38
+ 'label' => [
39
+ 'label' => 'Label',
40
+ 'style' => 'width: 200px;',
41
+ ],
42
+ ],
43
+ 'buttonLabel' => 'Add Sorting Attribute',
44
+ 'addAfter' => false,
45
+ ];
46
 
 
 
47
  parent::__construct();
48
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  }
app/code/community/Algolia/Algoliasearch/Block/System/Config/Form/Field/Synonyms.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Algolia_Algoliasearch_Block_System_Config_Form_Field_Synonyms extends Algolia_Algoliasearch_Block_System_Config_Form_Field_AbstractField
4
+ {
5
+ public function __construct()
6
+ {
7
+ $this->settings = [
8
+ 'columns' => [
9
+ 'synonyms' => [
10
+ 'label' => 'Synonyms (comma-separated)',
11
+ 'style' => 'width: 550px;',
12
+ ],
13
+ ],
14
+ 'buttonLabel' => 'Add Synonyms',
15
+ 'addAfter' => false,
16
+ ];
17
+
18
+ parent::__construct();
19
+ }
20
+ }
app/code/community/Algolia/Algoliasearch/Helper/Algoliahelper.php CHANGED
@@ -1,35 +1,34 @@
1
  <?php
2
 
3
- if (class_exists('AlgoliaSearch\Client', false) == false)
4
- {
5
- require_once Mage::getBaseDir('lib').'/AlgoliaSearch/Version.php';
6
- require_once Mage::getBaseDir('lib').'/AlgoliaSearch/AlgoliaException.php';
7
- require_once Mage::getBaseDir('lib').'/AlgoliaSearch/ClientContext.php';
8
- require_once Mage::getBaseDir('lib').'/AlgoliaSearch/Client.php';
9
- require_once Mage::getBaseDir('lib').'/AlgoliaSearch/Index.php';
10
- require_once Mage::getBaseDir('lib').'/AlgoliaSearch/PlacesIndex.php';
11
- require_once Mage::getBaseDir('lib').'/AlgoliaSearch/IndexBrowser.php';
12
  }
13
 
14
  class Algolia_Algoliasearch_Helper_Algoliahelper extends Mage_Core_Helper_Abstract
15
  {
16
  /** @var \AlgoliaSearch\Client */
17
  protected $client;
 
 
18
  protected $config;
19
 
20
  public function __construct()
21
  {
22
  $this->config = Mage::helper('algoliasearch/config');
23
  $this->resetCredentialsFromConfig();
 
 
 
24
  }
25
 
26
  public function resetCredentialsFromConfig()
27
  {
28
- if ($this->config->getApplicationID() && $this->config->getAPIKey())
29
  $this->client = new \AlgoliaSearch\Client($this->config->getApplicationID(), $this->config->getAPIKey());
 
30
  }
31
 
32
- public function generateSearchSecuredApiKey($key, $params = array())
33
  {
34
  return $this->client->generateSecuredApiKey($key, $params);
35
  }
@@ -75,68 +74,66 @@ class Algolia_Algoliasearch_Helper_Algoliahelper extends Mage_Core_Helper_Abstra
75
 
76
  public function mergeSettings($index_name, $settings)
77
  {
78
- $onlineSettings = array();
79
 
80
- try
81
- {
82
  $onlineSettings = $this->getIndex($index_name)->getSettings();
83
- }
84
- catch(\Exception $e)
85
- {
86
  }
87
 
88
- $removes = array('slaves');
89
 
90
- foreach ($removes as $remove)
91
- if (isset($onlineSettings[$remove]))
92
  unset($onlineSettings[$remove]);
 
 
93
 
94
- foreach ($settings as $key => $value)
95
  $onlineSettings[$key] = $value;
 
96
 
97
  return $onlineSettings;
98
  }
99
 
100
  public function handleTooBigRecords(&$objects, $index_name)
101
  {
102
- $long_attributes = array('description', 'short_description', 'meta_description', 'content');
103
 
104
  $good_size = true;
105
 
106
- $ids = array();
107
 
108
- foreach ($objects as $key => &$object)
109
- {
110
  $size = mb_strlen(json_encode($object));
111
 
112
- if ($size > 20000)
113
- {
114
- foreach ($long_attributes as $attribute)
115
- {
116
- if (isset($object[$attribute]))
117
- {
118
  unset($object[$attribute]);
119
  $ids[$index_name.' objectID('.$object['objectID'].')'] = true;
120
- $good_size = false;
121
  }
122
-
123
  }
124
 
125
  $size = mb_strlen(json_encode($object));
126
 
127
- if ($size > 20000)
128
- {
129
  unset($objects[$key]);
130
  }
131
  }
132
  }
133
 
134
- if (count($objects) <= 0)
135
  return;
 
136
 
137
- if ($good_size === false)
138
- {
139
- Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing : You have some records ('.implode(',', array_keys($ids)).') that are too big. They have either been truncated or skipped');
 
 
140
  }
141
  }
142
 
@@ -146,9 +143,39 @@ class Algolia_Algoliasearch_Helper_Algoliahelper extends Mage_Core_Helper_Abstra
146
 
147
  $index = $this->getIndex($index_name);
148
 
149
- if ($this->config->isPartialUpdateEnabled())
150
  $index->partialUpdateObjects($objects);
151
- else
152
  $index->addObjects($objects);
 
153
  }
154
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
3
+ if (class_exists('AlgoliaSearch\Client', false) == false) {
4
+ require_once Mage::getBaseDir('lib').'/AlgoliaSearch/loader.php';
 
 
 
 
 
 
 
5
  }
6
 
7
  class Algolia_Algoliasearch_Helper_Algoliahelper extends Mage_Core_Helper_Abstract
8
  {
9
  /** @var \AlgoliaSearch\Client */
10
  protected $client;
11
+
12
+ /** @var Algolia_Algoliasearch_Helper_Config */
13
  protected $config;
14
 
15
  public function __construct()
16
  {
17
  $this->config = Mage::helper('algoliasearch/config');
18
  $this->resetCredentialsFromConfig();
19
+
20
+ $version = $this->config->getExtensionVersion();
21
+ \AlgoliaSearch\Version::$custom_value = ' Magento ('.$version.')';
22
  }
23
 
24
  public function resetCredentialsFromConfig()
25
  {
26
+ if ($this->config->getApplicationID() && $this->config->getAPIKey()) {
27
  $this->client = new \AlgoliaSearch\Client($this->config->getApplicationID(), $this->config->getAPIKey());
28
+ }
29
  }
30
 
31
+ public function generateSearchSecuredApiKey($key, $params = [])
32
  {
33
  return $this->client->generateSecuredApiKey($key, $params);
34
  }
74
 
75
  public function mergeSettings($index_name, $settings)
76
  {
77
+ $onlineSettings = [];
78
 
79
+ try {
 
80
  $onlineSettings = $this->getIndex($index_name)->getSettings();
81
+ } catch (\Exception $e) {
 
 
82
  }
83
 
84
+ $removes = ['slaves'];
85
 
86
+ foreach ($removes as $remove) {
87
+ if (isset($onlineSettings[$remove])) {
88
  unset($onlineSettings[$remove]);
89
+ }
90
+ }
91
 
92
+ foreach ($settings as $key => $value) {
93
  $onlineSettings[$key] = $value;
94
+ }
95
 
96
  return $onlineSettings;
97
  }
98
 
99
  public function handleTooBigRecords(&$objects, $index_name)
100
  {
101
+ $long_attributes = ['description', 'short_description', 'meta_description', 'content'];
102
 
103
  $good_size = true;
104
 
105
+ $ids = [];
106
 
107
+ foreach ($objects as $key => &$object) {
 
108
  $size = mb_strlen(json_encode($object));
109
 
110
+ if ($size > 20000) {
111
+ $good_size = false;
112
+
113
+ foreach ($long_attributes as $attribute) {
114
+ if (isset($object[$attribute])) {
 
115
  unset($object[$attribute]);
116
  $ids[$index_name.' objectID('.$object['objectID'].')'] = true;
 
117
  }
 
118
  }
119
 
120
  $size = mb_strlen(json_encode($object));
121
 
122
+ if ($size > 20000) {
 
123
  unset($objects[$key]);
124
  }
125
  }
126
  }
127
 
128
+ if (count($objects) <= 0) {
129
  return;
130
+ }
131
 
132
+ if ($good_size === false) {
133
+ /** @var Mage_Adminhtml_Model_Session $session */
134
+ $session = Mage::getSingleton('adminhtml/session');
135
+ $session->addError('Algolia reindexing : You have some records ('.implode(',',
136
+ array_keys($ids)).') that are too big. They have either been truncated or skipped');
137
  }
138
  }
139
 
143
 
144
  $index = $this->getIndex($index_name);
145
 
146
+ if ($this->config->isPartialUpdateEnabled()) {
147
  $index->partialUpdateObjects($objects);
148
+ } else {
149
  $index->addObjects($objects);
150
+ }
151
  }
152
+
153
+ public function setSynonyms($index_name, $synonyms)
154
+ {
155
+ $index = $this->getIndex($index_name);
156
+
157
+ /**
158
+ * Placeholders and alternative corrections are handled directly in Algolia dashboard.
159
+ * To keep it works, we need to merge it before setting synonyms to Algolia indices.
160
+ */
161
+ $hitsPerPage = 100;
162
+ $page = 0;
163
+ do {
164
+ $complexSynonyms = $index->searchSynonyms('', ['altCorrection1', 'altCorrection2', 'placeholder'], $page, $hitsPerPage);
165
+ foreach ($complexSynonyms['hits'] as $hit) {
166
+ unset($hit['_highlightResult']);
167
+
168
+ $synonyms[] = $hit;
169
+ }
170
+
171
+ $page++;
172
+ } while (($page * $hitsPerPage) < $complexSynonyms['nbHits']);
173
+
174
+ if (empty($synonyms)) {
175
+ $index->clearSynonyms(true);
176
+ return;
177
+ }
178
+
179
+ $index->batchSynonyms($synonyms, true, true);
180
+ }
181
+ }
app/code/community/Algolia/Algoliasearch/Helper/Config.php CHANGED
@@ -2,66 +2,70 @@
2
 
3
  class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
4
  {
5
- const MINIMAL_QUERY_LENGTH = 'algoliasearch/ui/minimal_query_length';
6
- const SEARCH_DELAY = 'algoliasearch/ui/search_delay';
7
-
8
- const ENABLE_FRONTEND = 'algoliasearch/credentials/enable_frontend';
9
- const ENABLE_BACKEND = 'algoliasearch/credentials/enable_backend';
10
- const IS_POPUP_ENABLED = 'algoliasearch/credentials/is_popup_enabled';
11
- const APPLICATION_ID = 'algoliasearch/credentials/application_id';
12
- const API_KEY = 'algoliasearch/credentials/api_key';
13
- const SEARCH_ONLY_API_KEY = 'algoliasearch/credentials/search_only_api_key';
14
- const INDEX_PREFIX = 'algoliasearch/credentials/index_prefix';
15
- const IS_INSTANT_ENABLED = 'algoliasearch/credentials/is_instant_enabled';
16
-
17
- const REPLACE_CATEGORIES = 'algoliasearch/instant/replace_categories';
18
- const INSTANT_SELECTOR = 'algoliasearch/instant/instant_selector';
19
- const FACETS = 'algoliasearch/instant/facets';
20
- const MAX_VALUES_PER_FACET = 'algoliasearch/instant/max_values_per_facet';
21
- const SORTING_INDICES = 'algoliasearch/instant/sorts';
22
- const XML_ADD_TO_CART_ENABLE = 'algoliasearch/instant/add_to_cart_enable';
23
-
24
- const NB_OF_PRODUCTS_SUGGESTIONS = 'algoliasearch/autocomplete/nb_of_products_suggestions';
25
- const NB_OF_CATEGORIES_SUGGESTIONS = 'algoliasearch/autocomplete/nb_of_categories_suggestions';
26
- const NB_OF_QUERIES_SUGGESTIONS = 'algoliasearch/autocomplete/nb_of_queries_suggestions';
27
- const AUTOCOMPLETE_SECTIONS = 'algoliasearch/autocomplete/sections';
28
- const EXCLUDED_PAGES = 'algoliasearch/autocomplete/excluded_pages';
29
- const MIN_POPULARITY = 'algoliasearch/autocomplete/min_popularity';
30
- const MIN_NUMBER_OF_RESULTS = 'algoliasearch/autocomplete/min_number_of_results';
31
- const RENDER_TEMPLATE_DIRECTIVES = 'algoliasearch/autocomplete/render_template_directives';
32
-
33
- const NUMBER_OF_PRODUCT_RESULTS = 'algoliasearch/products/number_product_results';
34
- const PRODUCT_ATTRIBUTES = 'algoliasearch/products/product_additional_attributes';
35
- const PRODUCT_CUSTOM_RANKING = 'algoliasearch/products/custom_ranking_product_attributes';
36
- const RESULTS_LIMIT = 'algoliasearch/products/results_limit';
37
- const SHOW_SUGGESTIONS_NO_RESULTS = 'algoliasearch/products/show_suggestions_on_no_result_page';
38
- const INDEX_OUT_OF_STOCK_OPTIONS = 'algoliasearch/products/index_out_of_stock_options';
39
-
40
- const CATEGORY_ATTRIBUTES = 'algoliasearch/categories/category_additional_attributes2';
41
- const INDEX_PRODUCT_COUNT = 'algoliasearch/categories/index_product_count';
42
- const CATEGORY_CUSTOM_RANKING = 'algoliasearch/categories/custom_ranking_category_attributes';
43
  const SHOW_CATS_NOT_INCLUDED_IN_NAVIGATION = 'algoliasearch/categories/show_cats_not_included_in_navigation';
44
 
 
 
 
45
 
46
- const IS_ACTIVE = 'algoliasearch/queue/active';
47
- const NUMBER_OF_ELEMENT_BY_PAGE = 'algoliasearch/queue/number_of_element_by_page';
48
- const NUMBER_OF_JOB_TO_RUN = 'algoliasearch/queue/number_of_job_to_run';
49
 
50
- const XML_PATH_IMAGE_WIDTH = 'algoliasearch/image/width';
51
- const XML_PATH_IMAGE_HEIGHT = 'algoliasearch/image/height';
52
- const XML_PATH_IMAGE_TYPE = 'algoliasearch/image/type';
53
 
54
- const REMOVE_IF_NO_RESULT = 'algoliasearch/advanced/remove_words_if_no_result';
55
- const PARTIAL_UPDATES = 'algoliasearch/advanced/partial_update';
56
- const CUSTOMER_GROUPS_ENABLE = 'algoliasearch/advanced/customer_groups_enable';
57
- const MAKE_SEO_REQUEST = 'algoliasearch/advanced/make_seo_request';
58
- const REMOVE_BRANDING = 'algoliasearch/advanced/remove_branding';
59
- const AUTOCOMPLETE_SELECTOR = 'algoliasearch/advanced/autocomplete_selector';
 
60
 
61
- const SHOW_OUT_OF_STOCK = 'cataloginventory/options/show_out_of_stock';
62
- const LOGGING_ENABLED = 'algoliasearch/credentials/debug';
63
 
64
- protected $_productTypeMap = array();
65
 
66
  public function indexOutOfStockOptions($storeId = null)
67
  {
@@ -83,6 +87,11 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
83
  return Mage::getStoreConfig(self::AUTOCOMPLETE_SELECTOR, $storeId);
84
  }
85
 
 
 
 
 
 
86
  public function getNumberOfQueriesSuggestions($storeId = null)
87
  {
88
  return Mage::getStoreConfig(self::NB_OF_QUERIES_SUGGESTIONS, $storeId);
@@ -106,7 +115,8 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
106
  public function isEnabledFrontEnd($storeId = null)
107
  {
108
  // Frontend = Backend + Frontent
109
- return Mage::getStoreConfigFlag(self::ENABLE_BACKEND, $storeId) && Mage::getStoreConfigFlag(self::ENABLE_FRONTEND, $storeId);
 
110
  }
111
 
112
  public function isEnabledBackend($storeId = null)
@@ -137,18 +147,20 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
137
  public function getImageWidth($storeId = null)
138
  {
139
  $imageWidth = Mage::getStoreConfig(self::XML_PATH_IMAGE_WIDTH, $storeId);
140
- if(empty($imageWidth)) {
141
- return null;
142
  }
 
143
  return $imageWidth;
144
  }
145
 
146
  public function getImageHeight($storeId = null)
147
  {
148
  $imageHeight = Mage::getStoreConfig(self::XML_PATH_IMAGE_HEIGHT, $storeId);
149
- if(empty($imageHeight)) {
150
- return null;
151
  }
 
152
  return $imageHeight;
153
  }
154
 
@@ -171,10 +183,11 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
171
  {
172
  $attrs = unserialize(Mage::getStoreConfig(self::AUTOCOMPLETE_SECTIONS, $storeId));
173
 
174
- if (is_array($attrs))
175
  return array_values($attrs);
 
176
 
177
- return array();
178
  }
179
 
180
  public function getNumberOfQuerySuggestions($storeId = null)
@@ -222,113 +235,114 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
222
  return Mage::getStoreConfigFlag(self::IS_ACTIVE, $storeId);
223
  }
224
 
225
- public function getRemoveWordsIfNoResult($storeId = NULL)
226
  {
227
  return Mage::getStoreConfig(self::REMOVE_IF_NO_RESULT, $storeId);
228
  }
229
 
230
- public function getNumberOfProductResults($storeId = NULL)
231
  {
232
  return (int) Mage::getStoreConfig(self::NUMBER_OF_PRODUCT_RESULTS, $storeId);
233
  }
234
 
235
- public function getResultsLimit($storeId = NULL)
236
  {
237
  return Mage::getStoreConfig(self::RESULTS_LIMIT, $storeId);
238
  }
239
 
240
- public function isPopupEnabled($storeId = NULL)
241
  {
242
  return Mage::getStoreConfigFlag(self::IS_POPUP_ENABLED, $storeId);
243
  }
244
 
245
- public function replaceCategories($storeId = NULL)
246
  {
247
  return Mage::getStoreConfigFlag(self::REPLACE_CATEGORIES, $storeId);
248
  }
249
 
250
- public function isAutoCompleteEnabled($storeId = NULL)
251
  {
252
  return Mage::getStoreConfigFlag(self::IS_POPUP_ENABLED, $storeId);
253
  }
254
 
255
- public function isInstantEnabled($storeId = NULL)
256
  {
257
  return Mage::getStoreConfigFlag(self::IS_INSTANT_ENABLED, $storeId);
258
  }
259
 
260
- public function getInstantSelector($storeId = NULL)
261
  {
262
  return Mage::getStoreConfig(self::INSTANT_SELECTOR, $storeId);
263
  }
264
 
265
- public function getExcludedPages($storeId = NULL)
266
  {
267
  $attrs = unserialize(Mage::getStoreConfig(self::EXCLUDED_PAGES, $storeId));
268
 
269
- if (is_array($attrs))
270
  return $attrs;
 
271
 
272
- return array();
273
  }
274
 
275
- public function getRenderTemplateDirectives($storeId = NULL)
276
  {
277
  return Mage::getStoreConfigFlag(self::RENDER_TEMPLATE_DIRECTIVES, $storeId);
278
  }
279
 
280
- public function getSortingIndices($storeId = NULL)
281
  {
 
282
  $product_helper = Mage::helper('algoliasearch/entity_producthelper');
283
 
284
  $attrs = unserialize(Mage::getStoreConfig(self::SORTING_INDICES, $storeId));
285
 
286
- $group_id = Mage::getSingleton('customer/session')->getCustomerGroupId();
 
 
287
 
288
- foreach ($attrs as &$attr)
289
- {
290
- if ($this->isCustomerGroupsEnabled($storeId))
291
- {
292
- if (strpos($attr['attribute'], 'price') !== false)
293
- {
294
- $suffix_index_name = 'group_' . $group_id;
295
 
296
- $attr['name'] = $product_helper->getIndexName($storeId) . '_' . $attr['attribute'] . '_' .$suffix_index_name.'_'.$attr['sort'];
 
 
 
 
 
 
 
 
297
  }
298
- else
299
- $attr['name'] = $product_helper->getIndexName($storeId). '_' .$attr['attribute'] . '_'.$attr['sort'];
300
- }
301
- else
302
- {
303
- if (strpos($attr['attribute'], 'price') !== false)
304
- $attr['name'] = $product_helper->getIndexName($storeId). '_' .$attr['attribute'].'_' . 'default' . '_'.$attr['sort'];
305
- else
306
- $attr['name'] = $product_helper->getIndexName($storeId). '_' .$attr['attribute'] . '_'.$attr['sort'];
307
  }
308
  }
309
 
310
- if (is_array($attrs))
311
  return $attrs;
 
312
 
313
- return array();
314
  }
315
 
316
- public function getApplicationID($storeId = NULL)
317
  {
318
  return trim(Mage::getStoreConfig(self::APPLICATION_ID, $storeId));
319
  }
320
 
321
- public function getAPIKey($storeId = NULL)
322
  {
323
  return trim(Mage::getStoreConfig(self::API_KEY, $storeId));
324
  }
325
 
326
- public function getSearchOnlyAPIKey($storeId = NULL)
327
  {
328
  return trim(Mage::getStoreConfig(self::SEARCH_ONLY_API_KEY, $storeId));
329
  }
330
 
331
- public function getIndexPrefix($storeId = NULL)
332
  {
333
  return trim(Mage::getStoreConfig(self::INDEX_PREFIX, $storeId));
334
  }
@@ -339,16 +353,30 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
339
  return [];
340
  }
341
 
342
- $attributes = array();
343
  foreach ($this->getProductAdditionalAttributes() as $attribute) {
344
  if ($attribute['attribute'] !== 'price') {
345
  $attributes[] = $attribute['attribute'];
346
  }
347
  }
348
 
349
- $attributes = array_merge($attributes, ['objectID', 'name', 'url', 'visibility_search', 'visibility_catalog', 'categories', 'categories_without_path', 'thumbnail_url', 'image_url', 'in_stock', 'type_id']);
350
-
351
- $currencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
352
 
353
  foreach ($currencies as $currency) {
354
  $attributes[] = 'price.'.$currency.'.default';
@@ -359,67 +387,88 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
359
  $attributes[] = 'price.'.$currency.'.special_to_date';
360
  }
361
 
362
-
363
  return ['attributesToRetrieve' => $attributes];
364
  }
365
 
366
- public function getCategoryAdditionalAttributes($storeId = NULL)
367
  {
368
  $attrs = unserialize(Mage::getStoreConfig(self::CATEGORY_ATTRIBUTES, $storeId));
369
 
370
- if (is_array($attrs))
371
  return $attrs;
 
372
 
373
- return array();
374
  }
375
 
376
- public function getProductAdditionalAttributes($storeId = NULL)
377
  {
378
  $attrs = unserialize(Mage::getStoreConfig(self::PRODUCT_ATTRIBUTES, $storeId));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
379
 
380
- if (is_array($attrs))
381
  return $attrs;
 
382
 
383
- return array();
384
  }
385
 
386
- public function getFacets($storeId = NULL)
387
  {
388
  $attrs = unserialize(Mage::getStoreConfig(self::FACETS, $storeId));
389
-
390
- foreach ($attrs as &$attr)
391
- if ($attr['type'] == 'other')
392
  $attr['type'] = $attr['other_type'];
 
 
393
 
394
- if (is_array($attrs))
395
  return array_values($attrs);
 
396
 
397
- return array();
398
  }
399
 
400
- public function getCategoryCustomRanking($storeId = NULL)
401
  {
402
  $attrs = unserialize(Mage::getStoreConfig(self::CATEGORY_CUSTOM_RANKING, $storeId));
403
 
404
- if (is_array($attrs))
405
  return $attrs;
 
406
 
407
- return array();
408
  }
409
 
410
- public function getProductCustomRanking($storeId = NULL)
411
  {
412
  $attrs = unserialize(Mage::getStoreConfig(self::PRODUCT_CUSTOM_RANKING, $storeId));
413
 
414
- if (is_array($attrs))
415
  return $attrs;
 
416
 
417
- return array();
418
  }
419
 
420
- public function getCurrency($storeId = NULL)
421
  {
422
- $currencySymbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
 
423
 
424
  return $currencySymbol;
425
  }
@@ -430,6 +479,7 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
430
  $storeId = Mage::app()->getStore()->getId();
431
  }
432
 
 
433
  $suggestion_helper = Mage::helper('algoliasearch/entity_suggestionhelper');
434
  $popularQueries = $suggestion_helper->getPopularQueries($storeId);
435
 
@@ -437,23 +487,61 @@ class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
437
  }
438
 
439
  /**
440
- * Loads product type mapping from configuration (default) > algoliasearch > product_map > (product type)
441
  *
442
  * @param $originalType
 
443
  * @return string
444
  */
445
  public function getMappedProductType($originalType)
446
  {
447
- if (!isset($this->_productTypeMap[$originalType]))
448
- {
449
- $mappedType = (string)Mage::app()->getConfig()->getNode('default/algoliasearch/product_map/' . $originalType);
450
 
451
- if ($mappedType)
452
  $this->_productTypeMap[$originalType] = $mappedType;
453
- else
454
  $this->_productTypeMap[$originalType] = $originalType;
 
455
  }
456
 
457
  return $this->_productTypeMap[$originalType];
458
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
  }
2
 
3
  class Algolia_Algoliasearch_Helper_Config extends Mage_Core_Helper_Abstract
4
  {
5
+ const MINIMAL_QUERY_LENGTH = 'algoliasearch/ui/minimal_query_length';
6
+ const SEARCH_DELAY = 'algoliasearch/ui/search_delay';
7
+
8
+ const ENABLE_FRONTEND = 'algoliasearch/credentials/enable_frontend';
9
+ const ENABLE_BACKEND = 'algoliasearch/credentials/enable_backend';
10
+ const IS_POPUP_ENABLED = 'algoliasearch/credentials/is_popup_enabled';
11
+ const APPLICATION_ID = 'algoliasearch/credentials/application_id';
12
+ const API_KEY = 'algoliasearch/credentials/api_key';
13
+ const SEARCH_ONLY_API_KEY = 'algoliasearch/credentials/search_only_api_key';
14
+ const INDEX_PREFIX = 'algoliasearch/credentials/index_prefix';
15
+ const IS_INSTANT_ENABLED = 'algoliasearch/credentials/is_instant_enabled';
16
+
17
+ const REPLACE_CATEGORIES = 'algoliasearch/instant/replace_categories';
18
+ const INSTANT_SELECTOR = 'algoliasearch/instant/instant_selector';
19
+ const FACETS = 'algoliasearch/instant/facets';
20
+ const MAX_VALUES_PER_FACET = 'algoliasearch/instant/max_values_per_facet';
21
+ const SORTING_INDICES = 'algoliasearch/instant/sorts';
22
+ const XML_ADD_TO_CART_ENABLE = 'algoliasearch/instant/add_to_cart_enable';
23
+
24
+ const NB_OF_PRODUCTS_SUGGESTIONS = 'algoliasearch/autocomplete/nb_of_products_suggestions';
25
+ const NB_OF_CATEGORIES_SUGGESTIONS = 'algoliasearch/autocomplete/nb_of_categories_suggestions';
26
+ const NB_OF_QUERIES_SUGGESTIONS = 'algoliasearch/autocomplete/nb_of_queries_suggestions';
27
+ const AUTOCOMPLETE_SECTIONS = 'algoliasearch/autocomplete/sections';
28
+ const EXCLUDED_PAGES = 'algoliasearch/autocomplete/excluded_pages';
29
+ const MIN_POPULARITY = 'algoliasearch/autocomplete/min_popularity';
30
+ const MIN_NUMBER_OF_RESULTS = 'algoliasearch/autocomplete/min_number_of_results';
31
+ const RENDER_TEMPLATE_DIRECTIVES = 'algoliasearch/autocomplete/render_template_directives';
32
+
33
+ const NUMBER_OF_PRODUCT_RESULTS = 'algoliasearch/products/number_product_results';
34
+ const PRODUCT_ATTRIBUTES = 'algoliasearch/products/product_additional_attributes';
35
+ const PRODUCT_CUSTOM_RANKING = 'algoliasearch/products/custom_ranking_product_attributes';
36
+ const RESULTS_LIMIT = 'algoliasearch/products/results_limit';
37
+ const SHOW_SUGGESTIONS_NO_RESULTS = 'algoliasearch/products/show_suggestions_on_no_result_page';
38
+ const INDEX_OUT_OF_STOCK_OPTIONS = 'algoliasearch/products/index_out_of_stock_options';
39
+
40
+ const CATEGORY_ATTRIBUTES = 'algoliasearch/categories/category_additional_attributes2';
41
+ const INDEX_PRODUCT_COUNT = 'algoliasearch/categories/index_product_count';
42
+ const CATEGORY_CUSTOM_RANKING = 'algoliasearch/categories/custom_ranking_category_attributes';
43
  const SHOW_CATS_NOT_INCLUDED_IN_NAVIGATION = 'algoliasearch/categories/show_cats_not_included_in_navigation';
44
 
45
+ const IS_ACTIVE = 'algoliasearch/queue/active';
46
+ const NUMBER_OF_ELEMENT_BY_PAGE = 'algoliasearch/queue/number_of_element_by_page';
47
+ const NUMBER_OF_JOB_TO_RUN = 'algoliasearch/queue/number_of_job_to_run';
48
 
49
+ const XML_PATH_IMAGE_WIDTH = 'algoliasearch/image/width';
50
+ const XML_PATH_IMAGE_HEIGHT = 'algoliasearch/image/height';
51
+ const XML_PATH_IMAGE_TYPE = 'algoliasearch/image/type';
52
 
53
+ const SYNONYMS = 'algoliasearch/synonyms/synonyms';
54
+ const ONEWAY_SYNONYMS = 'algoliasearch/synonyms/oneway_synonyms';
55
+ const SYNONYMS_FILE = 'algoliasearch/synonyms/synonyms_file';
56
 
57
+ const REMOVE_IF_NO_RESULT = 'algoliasearch/advanced/remove_words_if_no_result';
58
+ const PARTIAL_UPDATES = 'algoliasearch/advanced/partial_update';
59
+ const CUSTOMER_GROUPS_ENABLE = 'algoliasearch/advanced/customer_groups_enable';
60
+ const MAKE_SEO_REQUEST = 'algoliasearch/advanced/make_seo_request';
61
+ const REMOVE_BRANDING = 'algoliasearch/advanced/remove_branding';
62
+ const AUTOCOMPLETE_SELECTOR = 'algoliasearch/advanced/autocomplete_selector';
63
+ const INDEX_PRODUCT_ON_CATEGORY_PRODUCTS_UPDATE = 'algoliasearch/advanced/index_product_on_category_products_update';
64
 
65
+ const SHOW_OUT_OF_STOCK = 'cataloginventory/options/show_out_of_stock';
66
+ const LOGGING_ENABLED = 'algoliasearch/credentials/debug';
67
 
68
+ protected $_productTypeMap = [];
69
 
70
  public function indexOutOfStockOptions($storeId = null)
71
  {
87
  return Mage::getStoreConfig(self::AUTOCOMPLETE_SELECTOR, $storeId);
88
  }
89
 
90
+ public function indexProductOnCategoryProductsUpdate($storeId = null)
91
+ {
92
+ return Mage::getStoreConfigFlag(self::INDEX_PRODUCT_ON_CATEGORY_PRODUCTS_UPDATE, $storeId);
93
+ }
94
+
95
  public function getNumberOfQueriesSuggestions($storeId = null)
96
  {
97
  return Mage::getStoreConfig(self::NB_OF_QUERIES_SUGGESTIONS, $storeId);
115
  public function isEnabledFrontEnd($storeId = null)
116
  {
117
  // Frontend = Backend + Frontent
118
+ return Mage::getStoreConfigFlag(self::ENABLE_BACKEND,
119
+ $storeId) && Mage::getStoreConfigFlag(self::ENABLE_FRONTEND, $storeId);
120
  }
121
 
122
  public function isEnabledBackend($storeId = null)
147
  public function getImageWidth($storeId = null)
148
  {
149
  $imageWidth = Mage::getStoreConfig(self::XML_PATH_IMAGE_WIDTH, $storeId);
150
+ if (empty($imageWidth)) {
151
+ return;
152
  }
153
+
154
  return $imageWidth;
155
  }
156
 
157
  public function getImageHeight($storeId = null)
158
  {
159
  $imageHeight = Mage::getStoreConfig(self::XML_PATH_IMAGE_HEIGHT, $storeId);
160
+ if (empty($imageHeight)) {
161
+ return;
162
  }
163
+
164
  return $imageHeight;
165
  }
166
 
183
  {
184
  $attrs = unserialize(Mage::getStoreConfig(self::AUTOCOMPLETE_SECTIONS, $storeId));
185
 
186
+ if (is_array($attrs)) {
187
  return array_values($attrs);
188
+ }
189
 
190
+ return [];
191
  }
192
 
193
  public function getNumberOfQuerySuggestions($storeId = null)
235
  return Mage::getStoreConfigFlag(self::IS_ACTIVE, $storeId);
236
  }
237
 
238
+ public function getRemoveWordsIfNoResult($storeId = null)
239
  {
240
  return Mage::getStoreConfig(self::REMOVE_IF_NO_RESULT, $storeId);
241
  }
242
 
243
+ public function getNumberOfProductResults($storeId = null)
244
  {
245
  return (int) Mage::getStoreConfig(self::NUMBER_OF_PRODUCT_RESULTS, $storeId);
246
  }
247
 
248
+ public function getResultsLimit($storeId = null)
249
  {
250
  return Mage::getStoreConfig(self::RESULTS_LIMIT, $storeId);
251
  }
252
 
253
+ public function isPopupEnabled($storeId = null)
254
  {
255
  return Mage::getStoreConfigFlag(self::IS_POPUP_ENABLED, $storeId);
256
  }
257
 
258
+ public function replaceCategories($storeId = null)
259
  {
260
  return Mage::getStoreConfigFlag(self::REPLACE_CATEGORIES, $storeId);
261
  }
262
 
263
+ public function isAutoCompleteEnabled($storeId = null)
264
  {
265
  return Mage::getStoreConfigFlag(self::IS_POPUP_ENABLED, $storeId);
266
  }
267
 
268
+ public function isInstantEnabled($storeId = null)
269
  {
270
  return Mage::getStoreConfigFlag(self::IS_INSTANT_ENABLED, $storeId);
271
  }
272
 
273
+ public function getInstantSelector($storeId = null)
274
  {
275
  return Mage::getStoreConfig(self::INSTANT_SELECTOR, $storeId);
276
  }
277
 
278
+ public function getExcludedPages($storeId = null)
279
  {
280
  $attrs = unserialize(Mage::getStoreConfig(self::EXCLUDED_PAGES, $storeId));
281
 
282
+ if (is_array($attrs)) {
283
  return $attrs;
284
+ }
285
 
286
+ return [];
287
  }
288
 
289
+ public function getRenderTemplateDirectives($storeId = null)
290
  {
291
  return Mage::getStoreConfigFlag(self::RENDER_TEMPLATE_DIRECTIVES, $storeId);
292
  }
293
 
294
+ public function getSortingIndices($storeId = null)
295
  {
296
+ /** @var Algolia_Algoliasearch_Helper_Entity_Producthelper $product_helper */
297
  $product_helper = Mage::helper('algoliasearch/entity_producthelper');
298
 
299
  $attrs = unserialize(Mage::getStoreConfig(self::SORTING_INDICES, $storeId));
300
 
301
+ /** @var Mage_Customer_Model_Session $customerSession */
302
+ $customerSession = Mage::getSingleton('customer/session');
303
+ $group_id = $customerSession->getCustomerGroupId();
304
 
305
+ foreach ($attrs as &$attr) {
306
+ if ($this->isCustomerGroupsEnabled($storeId)) {
307
+ if (strpos($attr['attribute'], 'price') !== false) {
308
+ $suffix_index_name = 'group_'.$group_id;
 
 
 
309
 
310
+ $attr['name'] = $product_helper->getIndexName($storeId).'_'.$attr['attribute'].'_'.$suffix_index_name.'_'.$attr['sort'];
311
+ } else {
312
+ $attr['name'] = $product_helper->getIndexName($storeId).'_'.$attr['attribute'].'_'.$attr['sort'];
313
+ }
314
+ } else {
315
+ if (strpos($attr['attribute'], 'price') !== false) {
316
+ $attr['name'] = $product_helper->getIndexName($storeId).'_'.$attr['attribute'].'_'.'default'.'_'.$attr['sort'];
317
+ } else {
318
+ $attr['name'] = $product_helper->getIndexName($storeId).'_'.$attr['attribute'].'_'.$attr['sort'];
319
  }
 
 
 
 
 
 
 
 
 
320
  }
321
  }
322
 
323
+ if (is_array($attrs)) {
324
  return $attrs;
325
+ }
326
 
327
+ return [];
328
  }
329
 
330
+ public function getApplicationID($storeId = null)
331
  {
332
  return trim(Mage::getStoreConfig(self::APPLICATION_ID, $storeId));
333
  }
334
 
335
+ public function getAPIKey($storeId = null)
336
  {
337
  return trim(Mage::getStoreConfig(self::API_KEY, $storeId));
338
  }
339
 
340
+ public function getSearchOnlyAPIKey($storeId = null)
341
  {
342
  return trim(Mage::getStoreConfig(self::SEARCH_ONLY_API_KEY, $storeId));
343
  }
344
 
345
+ public function getIndexPrefix($storeId = null)
346
  {
347
  return trim(Mage::getStoreConfig(self::INDEX_PREFIX, $storeId));
348
  }
353
  return [];
354
  }
355
 
356
+ $attributes = [];
357
  foreach ($this->getProductAdditionalAttributes() as $attribute) {
358
  if ($attribute['attribute'] !== 'price') {
359
  $attributes[] = $attribute['attribute'];
360
  }
361
  }
362
 
363
+ $attributes = array_merge($attributes, [
364
+ 'objectID',
365
+ 'name',
366
+ 'url',
367
+ 'visibility_search',
368
+ 'visibility_catalog',
369
+ 'categories',
370
+ 'categories_without_path',
371
+ 'thumbnail_url',
372
+ 'image_url',
373
+ 'in_stock',
374
+ 'type_id',
375
+ ]);
376
+
377
+ /** @var Mage_Directory_Model_Currency $currencyDirectory */
378
+ $currencyDirectory = Mage::getModel('directory/currency');
379
+ $currencies = $currencyDirectory->getConfigAllowCurrencies();
380
 
381
  foreach ($currencies as $currency) {
382
  $attributes[] = 'price.'.$currency.'.default';
387
  $attributes[] = 'price.'.$currency.'.special_to_date';
388
  }
389
 
 
390
  return ['attributesToRetrieve' => $attributes];
391
  }
392
 
393
+ public function getCategoryAdditionalAttributes($storeId = null)
394
  {
395
  $attrs = unserialize(Mage::getStoreConfig(self::CATEGORY_ATTRIBUTES, $storeId));
396
 
397
+ if (is_array($attrs)) {
398
  return $attrs;
399
+ }
400
 
401
+ return [];
402
  }
403
 
404
+ public function getProductAdditionalAttributes($storeId = null)
405
  {
406
  $attrs = unserialize(Mage::getStoreConfig(self::PRODUCT_ATTRIBUTES, $storeId));
407
+ $facets = unserialize(Mage::getStoreConfig(self::FACETS, $storeId));
408
+
409
+ foreach ((array) $facets as $facet) {
410
+ foreach ((array) $attrs as $attr) {
411
+ if ($facet['attribute'] == $attr['attribute']) {
412
+ continue 2;
413
+ }
414
+ }
415
+
416
+ $attrs[] = [
417
+ 'attribute' => $facet['attribute'],
418
+ 'searchable' => '0',
419
+ 'retrievable' => '1',
420
+ ];
421
+ }
422
 
423
+ if (is_array($attrs)) {
424
  return $attrs;
425
+ }
426
 
427
+ return [];
428
  }
429
 
430
+ public function getFacets($storeId = null)
431
  {
432
  $attrs = unserialize(Mage::getStoreConfig(self::FACETS, $storeId));
433
+ foreach ($attrs as &$attr) {
434
+ if ($attr['type'] == 'other') {
 
435
  $attr['type'] = $attr['other_type'];
436
+ }
437
+ }
438
 
439
+ if (is_array($attrs)) {
440
  return array_values($attrs);
441
+ }
442
 
443
+ return [];
444
  }
445
 
446
+ public function getCategoryCustomRanking($storeId = null)
447
  {
448
  $attrs = unserialize(Mage::getStoreConfig(self::CATEGORY_CUSTOM_RANKING, $storeId));
449
 
450
+ if (is_array($attrs)) {
451
  return $attrs;
452
+ }
453
 
454
+ return [];
455
  }
456
 
457
+ public function getProductCustomRanking($storeId = null)
458
  {
459
  $attrs = unserialize(Mage::getStoreConfig(self::PRODUCT_CUSTOM_RANKING, $storeId));
460
 
461
+ if (is_array($attrs)) {
462
  return $attrs;
463
+ }
464
 
465
+ return [];
466
  }
467
 
468
+ public function getCurrency($storeId = null)
469
  {
470
+ $currencySymbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())
471
+ ->getSymbol();
472
 
473
  return $currencySymbol;
474
  }
479
  $storeId = Mage::app()->getStore()->getId();
480
  }
481
 
482
+ /** @var Algolia_Algoliasearch_Helper_Entity_Suggestionhelper $suggestion_helper */
483
  $suggestion_helper = Mage::helper('algoliasearch/entity_suggestionhelper');
484
  $popularQueries = $suggestion_helper->getPopularQueries($storeId);
485
 
487
  }
488
 
489
  /**
490
+ * Loads product type mapping from configuration (default) > algoliasearch > product_map > (product type).
491
  *
492
  * @param $originalType
493
+ *
494
  * @return string
495
  */
496
  public function getMappedProductType($originalType)
497
  {
498
+ if (!isset($this->_productTypeMap[$originalType])) {
499
+ $mappedType = (string) Mage::app()->getConfig()->getNode('default/algoliasearch/product_map/'.$originalType);
 
500
 
501
+ if ($mappedType) {
502
  $this->_productTypeMap[$originalType] = $mappedType;
503
+ } else {
504
  $this->_productTypeMap[$originalType] = $originalType;
505
+ }
506
  }
507
 
508
  return $this->_productTypeMap[$originalType];
509
  }
510
+
511
+ public function getExtensionVersion()
512
+ {
513
+ return (string) Mage::getConfig()->getNode()->modules->Algolia_Algoliasearch->version;
514
+ }
515
+
516
+ public function getSynonyms($storeId = null)
517
+ {
518
+ $synonyms = unserialize(Mage::getStoreConfig(self::SYNONYMS, $storeId));
519
+
520
+ if (is_array($synonyms)) {
521
+ return $synonyms;
522
+ }
523
+
524
+ return [];
525
+ }
526
+
527
+ public function getOnewaySynonyms($storeId = null)
528
+ {
529
+ $onewaySynonyms = unserialize(Mage::getStoreConfig(self::ONEWAY_SYNONYMS, $storeId));
530
+
531
+ if (is_array($onewaySynonyms)) {
532
+ return $onewaySynonyms;
533
+ }
534
+
535
+ return [];
536
+ }
537
+
538
+ public function getSynonymsFile($storeId = null)
539
+ {
540
+ $filename = Mage::getStoreConfig(self::SYNONYMS_FILE, $storeId);
541
+ if (!$filename) {
542
+ return null;
543
+ }
544
+
545
+ return Mage::getBaseDir('media'). '/algoliasearch-admin-config-uploads/' . $filename;
546
+ }
547
  }
app/code/community/Algolia/Algoliasearch/Helper/Data.php CHANGED
@@ -1,54 +1,54 @@
1
  <?php
2
 
3
- if (class_exists('AlgoliaSearch\Client', false) == false)
4
- {
5
- require_once Mage::getBaseDir('lib').'/AlgoliaSearch/Version.php';
6
- require_once Mage::getBaseDir('lib').'/AlgoliaSearch/AlgoliaException.php';
7
- require_once Mage::getBaseDir('lib').'/AlgoliaSearch/ClientContext.php';
8
- require_once Mage::getBaseDir('lib').'/AlgoliaSearch/Client.php';
9
- require_once Mage::getBaseDir('lib').'/AlgoliaSearch/Index.php';
10
- require_once Mage::getBaseDir('lib').'/AlgoliaSearch/PlacesIndex.php';
11
- require_once Mage::getBaseDir('lib').'/AlgoliaSearch/IndexBrowser.php';
12
- }
13
-
14
  class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
15
  {
16
  const COLLECTION_PAGE_SIZE = 100;
17
 
 
18
  protected $algolia_helper;
19
 
 
20
  protected $page_helper;
 
 
21
  protected $category_helper;
 
 
22
  protected $product_helper;
23
 
24
  /** @var Algolia_Algoliasearch_Helper_Logger */
25
  protected $logger;
 
 
26
  protected $config;
27
 
 
 
 
 
 
 
28
  public function __construct()
29
  {
30
- \AlgoliaSearch\Version::$custom_value = " Magento (1.5.5)";
31
-
32
- $this->algolia_helper = Mage::helper('algoliasearch/algoliahelper');
33
 
34
- $this->page_helper = Mage::helper('algoliasearch/entity_pagehelper');
35
- $this->category_helper = Mage::helper('algoliasearch/entity_categoryhelper');
36
- $this->product_helper = Mage::helper('algoliasearch/entity_producthelper');
37
- $this->suggestion_helper = Mage::helper('algoliasearch/entity_suggestionhelper');
38
- $this->additionalsections_helper = Mage::helper('algoliasearch/entity_additionalsectionshelper');
39
 
40
- $this->config = Mage::helper('algoliasearch/config');
41
 
42
- $this->logger = Mage::helper('algoliasearch/logger');
43
  }
44
 
45
  public function deleteProductsStoreIndices($storeId = null)
46
  {
47
- if ($storeId !== null)
48
- {
49
- if ($this->config->isEnabledBackEnd($storeId) === false)
50
- {
51
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
52
  return;
53
  }
54
  }
@@ -58,11 +58,10 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
58
 
59
  public function deleteCategoriesStoreIndices($storeId = null)
60
  {
61
- if ($storeId !== null)
62
- {
63
- if ($this->config->isEnabledBackEnd($storeId) === false)
64
- {
65
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
66
  return;
67
  }
68
  }
@@ -70,32 +69,37 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
70
  $this->algolia_helper->deleteIndex($this->category_helper->getIndexName($storeId));
71
  }
72
 
73
- public function saveConfigurationToAlgolia($storeId)
74
  {
75
  $this->algolia_helper->resetCredentialsFromConfig();
76
 
77
- if (! ($this->config->getApplicationID() && $this->config->getAPIKey()))
78
  return;
 
 
 
 
79
 
80
- if ($this->config->isEnabledBackEnd($storeId) === false)
81
- {
82
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
83
  return;
84
  }
85
 
86
- $this->algolia_helper->setSettings($this->category_helper->getIndexName($storeId), $this->category_helper->getIndexSettings($storeId));
87
- $this->algolia_helper->setSettings($this->page_helper->getIndexName($storeId), $this->page_helper->getIndexSettings($storeId));
88
- $this->algolia_helper->setSettings($this->suggestion_helper->getIndexName($storeId), $this->suggestion_helper->getIndexSettings($storeId));
 
 
 
89
 
90
- foreach ($this->config->getAutocompleteSections() as $section)
91
- {
92
- if ($section['name'] === 'products' || $section['name'] === 'categories' || $section['name'] === 'pages' || $section['name'] === 'suggestions')
93
  continue;
 
94
 
95
- $this->algolia_helper->setSettings($this->additionalsections_helper->getIndexName($storeId).'_'.$section['name'], $this->additionalsections_helper->getIndexSettings($storeId));
 
96
  }
97
 
98
- $this->product_helper->setSettings($storeId);
99
  }
100
 
101
  public function getSearchResult($query, $storeId)
@@ -106,59 +110,40 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
106
 
107
  $number_of_results = 1000;
108
 
109
- if ($this->config->isInstantEnabled())
110
  $number_of_results = min($this->config->getNumberOfProductResults($storeId), 1000);
 
111
 
112
- $answer = $this->algolia_helper->query($index_name, $query, array(
113
- 'hitsPerPage' => $number_of_results, // retrieve all the hits (hard limit is 1000)
114
- 'attributesToRetrieve' => 'objectID',
115
- 'attributesToHighlight' => '',
116
- 'attributesToSnippet' => '',
117
- 'numericFilters' => 'visibility_search=1',
118
- 'removeWordsIfNoResults'=> $this->config->getRemoveWordsIfNoResult($storeId),
119
- 'analyticsTags' => 'backend-search'
120
- ));
121
 
122
- $data = array();
123
 
124
- foreach ($answer['hits'] as $i => $hit)
125
- {
126
  $productId = $hit['objectID'];
127
 
128
- if ($productId)
129
  $data[$productId] = $resultsLimit - $i;
 
130
  }
131
 
132
  return $data;
133
  }
134
 
135
- public function removeProducts($ids, $store_id = null)
136
- {
137
- $store_ids = Algolia_Algoliasearch_Helper_Entity_Helper::getStores($store_id);
138
-
139
- foreach ($store_ids as $store_id)
140
- {
141
- if ($this->config->isEnabledBackEnd($store_id) === false)
142
- {
143
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store_id));
144
- continue;
145
- }
146
-
147
- $index_name = $this->product_helper->getIndexName($store_id);
148
-
149
- $this->algolia_helper->deleteObjects($ids, $index_name);
150
- }
151
- }
152
-
153
  public function removeCategories($ids, $store_id = null)
154
  {
155
  $store_ids = Algolia_Algoliasearch_Helper_Entity_Helper::getStores($store_id);
156
 
157
- foreach ($store_ids as $store_id)
158
- {
159
- if ($this->config->isEnabledBackEnd($store_id) === false)
160
- {
161
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store_id));
162
  continue;
163
  }
164
 
@@ -170,37 +155,39 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
170
 
171
  public function rebuildStoreAdditionalSectionsIndex($storeId)
172
  {
173
- if ($this->config->isEnabledBackEnd($storeId) === false)
174
- {
175
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
176
  return;
177
  }
178
 
179
  $additionnal_sections = $this->config->getAutocompleteSections();
180
 
181
- foreach ($additionnal_sections as $section)
182
- {
183
- if ($section['name'] === 'products' || $section['name'] === 'categories' || $section['name'] === 'pages' || $section['name'] === 'suggestions')
184
  continue;
 
185
 
186
  $index_name = $this->additionalsections_helper->getIndexName($storeId).'_'.$section['name'];
187
 
188
  $attribute_values = $this->additionalsections_helper->getAttributeValues($storeId, $section);
189
 
190
- foreach (array_chunk($attribute_values, 100) as $chunk)
191
  $this->algolia_helper->addObjects($chunk, $index_name.'_tmp');
 
192
 
193
  $this->algolia_helper->moveIndex($index_name.'_tmp', $index_name);
194
 
195
- $this->algolia_helper->setSettings($index_name, $this->additionalsections_helper->getIndexSettings($storeId));
 
196
  }
197
  }
198
 
199
  public function rebuildStorePageIndex($storeId)
200
  {
201
- if ($this->config->isEnabledBackEnd($storeId) === false)
202
- {
203
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
204
  return;
205
  }
206
 
@@ -210,8 +197,9 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
210
 
211
  $pages = $this->page_helper->getPages($storeId);
212
 
213
- foreach (array_chunk($pages, 100) as $chunk)
214
  $this->algolia_helper->addObjects($chunk, $index_name.'_tmp');
 
215
 
216
  $this->algolia_helper->moveIndex($index_name.'_tmp', $index_name);
217
 
@@ -222,38 +210,34 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
222
 
223
  public function rebuildStoreCategoryIndex($storeId, $categoryIds = null)
224
  {
225
- if ($this->config->isEnabledBackEnd($storeId) === false)
226
- {
227
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
228
  return;
229
  }
230
 
231
  $emulationInfo = $this->startEmulation($storeId);
232
 
233
- try
234
- {
235
  $collection = $this->category_helper->getCategoryCollectionQuery($storeId, $categoryIds);
236
 
237
  $size = $collection->getSize();
238
 
239
- if ($size > 0)
240
- {
241
  $pages = ceil($size / $this->config->getNumberOfElementByPage());
242
  $collection->clear();
243
  $page = 1;
244
 
245
- while ($page <= $pages)
246
- {
247
- $this->rebuildStoreCategoryIndexPage($storeId, $collection, $page, $this->config->getNumberOfElementByPage(), $emulationInfo);
248
 
249
  $page++;
250
  }
251
 
252
  unset($indexData);
253
  }
254
- }
255
- catch (Exception $e)
256
- {
257
  $this->stopEmulation($emulationInfo);
258
  throw $e;
259
  }
@@ -263,9 +247,9 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
263
 
264
  public function rebuildStoreSuggestionIndex($storeId)
265
  {
266
- if ($this->config->isEnabledBackEnd($storeId) === false)
267
- {
268
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
269
  return;
270
  }
271
 
@@ -273,15 +257,14 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
273
 
274
  $size = $collection->getSize();
275
 
276
- if ($size > 0)
277
- {
278
  $pages = ceil($size / $this->config->getNumberOfElementByPage());
279
  $collection->clear();
280
  $page = 1;
281
 
282
- while ($page <= $pages)
283
- {
284
- $this->rebuildStoreSuggestionIndexPage($storeId, $collection, $page, $this->config->getNumberOfElementByPage());
285
 
286
  $page++;
287
  }
@@ -292,49 +275,58 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
292
 
293
  public function moveStoreSuggestionIndex($storeId)
294
  {
295
- if ($this->config->isEnabledBackEnd($storeId) === false)
296
- {
297
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
298
  return;
299
  }
300
 
301
- $this->algolia_helper->moveIndex($this->suggestion_helper->getIndexName($storeId) . '_tmp', $this->suggestion_helper->getIndexName($storeId));
 
 
 
 
 
 
 
 
 
302
  }
303
 
304
  public function rebuildStoreProductIndex($storeId, $productIds)
305
  {
306
- if ($this->config->isEnabledBackEnd($storeId) === false)
307
- {
308
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
309
  return;
310
  }
311
 
312
  $emulationInfo = $this->startEmulation($storeId);
313
 
314
- try
315
- {
316
- $collection = $this->product_helper->getProductCollectionQuery($storeId, $productIds);
317
-
318
  $size = $collection->getSize();
319
 
320
- $this->logger->log('Store '.$this->logger->getStoreName($storeId). ' collection size : '.$size);
 
 
 
 
321
 
322
- if ($size > 0)
323
- {
324
  $pages = ceil($size / $this->config->getNumberOfElementByPage());
325
- $collection->clear();
326
  $page = 1;
327
 
328
- while ($page <= $pages)
329
- {
330
- $this->rebuildStoreProductIndexPage($storeId, $collection, $page, $this->config->getNumberOfElementByPage(), $emulationInfo);
 
 
331
 
332
  $page++;
333
  }
334
  }
335
- }
336
- catch (Exception $e)
337
- {
338
  $this->stopEmulation($emulationInfo);
339
  throw $e;
340
  }
@@ -344,9 +336,9 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
344
 
345
  public function rebuildStoreSuggestionIndexPage($storeId, $collectionDefault, $page, $pageSize)
346
  {
347
- if ($this->config->isEnabledBackEnd($storeId) === false)
348
- {
349
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
350
  return;
351
  }
352
 
@@ -354,23 +346,28 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
354
  $collection->setCurPage($page)->setPageSize($pageSize);
355
  $collection->load();
356
 
357
- $index_name = $this->suggestion_helper->getIndexName($storeId) . '_tmp';
 
 
 
 
358
 
359
- $indexData = array();
360
 
361
- /** @var $suggestion Mage_Catalog_Model_Category */
362
- foreach ($collection as $suggestion)
363
- {
364
  $suggestion->setStoreId($storeId);
365
 
366
  $suggestion_obj = $this->suggestion_helper->getObject($suggestion);
367
 
368
- if (strlen($suggestion_obj['query']) >= 3)
369
  array_push($indexData, $suggestion_obj);
 
370
  }
371
 
372
- if (count($indexData) > 0)
373
  $this->algolia_helper->addObjects($indexData, $index_name);
 
374
 
375
  unset($indexData);
376
 
@@ -382,16 +379,17 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
382
 
383
  public function rebuildStoreCategoryIndexPage($storeId, $collectionDefault, $page, $pageSize, $emulationInfo = null)
384
  {
385
- if ($this->config->isEnabledBackEnd($storeId) === false)
386
- {
387
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
388
  return;
389
  }
390
 
391
  $emulationInfoPage = null;
392
 
393
- if ($emulationInfo === null)
394
  $emulationInfoPage = $this->startEmulation($storeId);
 
395
 
396
  $collection = clone $collectionDefault;
397
  $collection->setCurPage($page)->setPageSize($pageSize);
@@ -399,24 +397,26 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
399
 
400
  $index_name = $this->category_helper->getIndexName($storeId);
401
 
402
- $indexData = array();
403
 
404
  /** @var $category Mage_Catalog_Model_Category */
405
- foreach ($collection as $category)
406
- {
407
- if ( ! $this->category_helper->isCategoryActive($category->getId(), $storeId))
408
  continue;
 
409
 
410
  $category->setStoreId($storeId);
411
 
412
  $category_obj = $this->category_helper->getObject($category);
413
 
414
- if ($category_obj['product_count'] > 0)
415
  array_push($indexData, $category_obj);
 
416
  }
417
 
418
- if (count($indexData) > 0)
419
  $this->algolia_helper->addObjects($indexData, $index_name);
 
420
 
421
  unset($indexData);
422
 
@@ -425,80 +425,137 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
425
 
426
  unset($collection);
427
 
428
- if ($emulationInfo === null)
429
  $this->stopEmulation($emulationInfoPage);
 
430
  }
431
 
432
- protected function getProductsRecords($storeId, $collection)
433
  {
434
- $indexData = array();
 
 
 
 
 
 
435
 
436
  $this->logger->start('CREATE RECORDS '.$this->logger->getStoreName($storeId));
437
- $this->logger->log(count($collection). ' product records to create');
 
438
  /** @var $product Mage_Catalog_Model_Product */
439
- foreach ($collection as $product)
440
- {
441
  $product->setStoreId($storeId);
442
 
443
- $json = $this->product_helper->getObject($product);
 
 
 
 
 
444
 
445
- array_push($indexData, $json);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
446
  }
 
 
 
447
  $this->logger->stop('CREATE RECORDS '.$this->logger->getStoreName($storeId));
448
 
449
- return $indexData;
 
 
 
450
  }
451
 
452
- public function rebuildStoreProductIndexPage($storeId, $collectionDefault, $page, $pageSize, $emulationInfo = null)
453
  {
454
- if ($this->config->isEnabledBackEnd($storeId) === false)
455
- {
456
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($storeId));
457
  return;
458
  }
459
 
460
- $this->logger->start('rebuildStoreProductIndexPage '.$this->logger->getStoreName($storeId).' page ' . $page . ' pageSize '. $pageSize);
461
  $emulationInfoPage = null;
462
 
463
- if ($emulationInfo === null)
464
  $emulationInfoPage = $this->startEmulation($storeId);
 
465
 
466
  $index_prefix = Mage::getConfig()->getTablePrefix();
467
 
468
  $additionalAttributes = $this->config->getProductAdditionalAttributes($storeId);
469
 
 
470
  $collection = clone $collectionDefault;
 
471
  $collection->setCurPage($page)->setPageSize($pageSize);
472
  $collection->addCategoryIds();
473
  $collection->addUrlRewrite();
474
 
475
- if ($this->product_helper->isAttributeEnabled($additionalAttributes, 'stock_qty'))
476
- $collection->joinField('stock_qty', $index_prefix.'cataloginventory_stock_item', 'qty', 'product_id=entity_id', '{{table}}.stock_id=1', 'left');
 
 
477
 
478
- if ($this->product_helper->isAttributeEnabled($additionalAttributes, 'ordered_qty'))
479
- $collection->getSelect()->columns('(SELECT SUM(qty_ordered) FROM '.$index_prefix.'sales_flat_order_item WHERE '.$index_prefix.'sales_flat_order_item.product_id = e.entity_id) as ordered_qty');
 
 
480
 
481
- if ($this->product_helper->isAttributeEnabled($additionalAttributes, 'total_ordered'))
482
- $collection->getSelect()->columns('(SELECT SUM(row_total) FROM '.$index_prefix.'sales_flat_order_item WHERE '.$index_prefix.'sales_flat_order_item.product_id = e.entity_id) as total_ordered');
 
 
483
 
484
- if ($this->product_helper->isAttributeEnabled($additionalAttributes, 'rating_summary'))
485
- $collection->joinField('rating_summary', $index_prefix.'review_entity_summary', 'rating_summary', 'entity_pk_value=entity_id', '{{table}}.store_id='.$storeId, 'left');
 
 
486
 
487
- $this->logger->start('LOADING '.$this->logger->getStoreName($storeId). ' collection page '. $page . ', pageSize '.$pageSize);
488
 
489
  $collection->load();
490
 
491
  $this->logger->log('Loaded '.count($collection).' products');
492
- $this->logger->stop('LOADING '.$this->logger->getStoreName($storeId). ' collection page '. $page . ', pageSize '.$pageSize);
493
 
494
- $index_name = $this->product_helper->getIndexName($storeId);
495
 
496
- $indexData = $this->getProductsRecords($storeId, $collection);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
497
 
498
- $this->logger->start('SEND TO ALGOLIA');
499
- if (count($indexData) > 0)
500
- $this->algolia_helper->addObjects($indexData, $index_name);
501
- $this->logger->stop('SEND TO ALGOLIA');
502
 
503
  unset($indexData);
504
 
@@ -507,39 +564,51 @@ class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
507
 
508
  unset($collection);
509
 
510
- if ($emulationInfo === null)
511
  $this->stopEmulation($emulationInfoPage);
 
512
 
513
- $this->logger->stop('rebuildStoreProductIndexPage '.$this->logger->getStoreName($storeId).' page ' . $page . ' pageSize '. $pageSize);
514
  }
515
 
516
  public function startEmulation($storeId)
517
  {
518
  $this->logger->start('START EMULATION');
 
 
519
  $appEmulation = Mage::getSingleton('core/app_emulation');
520
 
521
  $info = $appEmulation->startEnvironmentEmulation($storeId);
522
 
523
  $info->setInitialStoreId(Mage::app()->getStore()->getId());
524
  $info->setEmulatedStoreId($storeId);
525
- $info->setUseProductFlat(Mage::getStoreConfigFlag(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT, $storeId));
526
- $info->setUseCategoryFlat(Mage::getStoreConfigFlag(Mage_Catalog_Helper_Category_Flat::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY, $storeId));
 
 
527
  Mage::app()->setCurrentStore($storeId);
528
- Mage::app()->getStore($storeId)->setConfig(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT, FALSE);
529
- Mage::app()->getStore($storeId)->setConfig(Mage_Catalog_Helper_Category_Flat::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY, FALSE);
 
530
 
531
  $this->logger->stop('START EMULATION');
 
532
  return $info;
533
  }
534
 
535
  public function stopEmulation($info)
536
  {
537
  $this->logger->start('STOP EMULATION');
 
 
538
  $appEmulation = Mage::getSingleton('core/app_emulation');
539
 
540
  Mage::app()->setCurrentStore($info->getInitialStoreId());
541
- Mage::app()->getStore($info->getEmulatedStoreId())->setConfig(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT, $info->getUseProductFlat());
542
- Mage::app()->getStore($info->getEmulatedStoreId())->setConfig(Mage_Catalog_Helper_Category_Flat::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY, $info->getUseCategoryFlat());
 
 
 
543
 
544
  $appEmulation->stopEnvironmentEmulation($info);
545
  $this->logger->stop('STOP EMULATION');
1
  <?php
2
 
 
 
 
 
 
 
 
 
 
 
 
3
  class Algolia_Algoliasearch_Helper_Data extends Mage_Core_Helper_Abstract
4
  {
5
  const COLLECTION_PAGE_SIZE = 100;
6
 
7
+ /** @var Algolia_Algoliasearch_Helper_Algoliahelper */
8
  protected $algolia_helper;
9
 
10
+ /** @var Algolia_Algoliasearch_Helper_Entity_Pagehelper */
11
  protected $page_helper;
12
+
13
+ /** @var Algolia_Algoliasearch_Helper_Entity_Categoryhelper */
14
  protected $category_helper;
15
+
16
+ /** @var Algolia_Algoliasearch_Helper_Entity_Producthelper */
17
  protected $product_helper;
18
 
19
  /** @var Algolia_Algoliasearch_Helper_Logger */
20
  protected $logger;
21
+
22
+ /** @var Algolia_Algoliasearch_Helper_Config */
23
  protected $config;
24
 
25
+ /** @var Algolia_Algoliasearch_Helper_Entity_Suggestionhelper */
26
+ protected $suggestion_helper;
27
+
28
+ /** @var Algolia_Algoliasearch_Helper_Entity_Additionalsectionshelper */
29
+ protected $additionalsections_helper;
30
+
31
  public function __construct()
32
  {
33
+ $this->algolia_helper = Mage::helper('algoliasearch/algoliahelper');
 
 
34
 
35
+ $this->page_helper = Mage::helper('algoliasearch/entity_pagehelper');
36
+ $this->category_helper = Mage::helper('algoliasearch/entity_categoryhelper');
37
+ $this->product_helper = Mage::helper('algoliasearch/entity_producthelper');
38
+ $this->suggestion_helper = Mage::helper('algoliasearch/entity_suggestionhelper');
39
+ $this->additionalsections_helper = Mage::helper('algoliasearch/entity_additionalsectionshelper');
40
 
41
+ $this->config = Mage::helper('algoliasearch/config');
42
 
43
+ $this->logger = Mage::helper('algoliasearch/logger');
44
  }
45
 
46
  public function deleteProductsStoreIndices($storeId = null)
47
  {
48
+ if ($storeId !== null) {
49
+ if ($this->config->isEnabledBackend($storeId) === false) {
50
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId));
51
+
 
52
  return;
53
  }
54
  }
58
 
59
  public function deleteCategoriesStoreIndices($storeId = null)
60
  {
61
+ if ($storeId !== null) {
62
+ if ($this->config->isEnabledBackend($storeId) === false) {
63
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId));
64
+
 
65
  return;
66
  }
67
  }
69
  $this->algolia_helper->deleteIndex($this->category_helper->getIndexName($storeId));
70
  }
71
 
72
+ public function saveConfigurationToAlgolia($storeId, $saveToTmpIndicesToo = false)
73
  {
74
  $this->algolia_helper->resetCredentialsFromConfig();
75
 
76
+ if (!($this->config->getApplicationID() && $this->config->getAPIKey())) {
77
  return;
78
+ }
79
+
80
+ if ($this->config->isEnabledBackend($storeId) === false) {
81
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId));
82
 
 
 
 
83
  return;
84
  }
85
 
86
+ $this->algolia_helper->setSettings($this->category_helper->getIndexName($storeId),
87
+ $this->category_helper->getIndexSettings($storeId));
88
+ $this->algolia_helper->setSettings($this->page_helper->getIndexName($storeId),
89
+ $this->page_helper->getIndexSettings($storeId));
90
+ $this->algolia_helper->setSettings($this->suggestion_helper->getIndexName($storeId),
91
+ $this->suggestion_helper->getIndexSettings($storeId));
92
 
93
+ foreach ($this->config->getAutocompleteSections() as $section) {
94
+ if ($section['name'] === 'products' || $section['name'] === 'categories' || $section['name'] === 'pages' || $section['name'] === 'suggestions') {
 
95
  continue;
96
+ }
97
 
98
+ $this->algolia_helper->setSettings($this->additionalsections_helper->getIndexName($storeId).'_'.$section['name'],
99
+ $this->additionalsections_helper->getIndexSettings($storeId));
100
  }
101
 
102
+ $this->product_helper->setSettings($storeId, $saveToTmpIndicesToo);
103
  }
104
 
105
  public function getSearchResult($query, $storeId)
110
 
111
  $number_of_results = 1000;
112
 
113
+ if ($this->config->isInstantEnabled()) {
114
  $number_of_results = min($this->config->getNumberOfProductResults($storeId), 1000);
115
+ }
116
 
117
+ $answer = $this->algolia_helper->query($index_name, $query, [
118
+ 'hitsPerPage' => $number_of_results, // retrieve all the hits (hard limit is 1000)
119
+ 'attributesToRetrieve' => 'objectID',
120
+ 'attributesToHighlight' => '',
121
+ 'attributesToSnippet' => '',
122
+ 'numericFilters' => 'visibility_search=1',
123
+ 'removeWordsIfNoResults' => $this->config->getRemoveWordsIfNoResult($storeId),
124
+ 'analyticsTags' => 'backend-search',
125
+ ]);
126
 
127
+ $data = [];
128
 
129
+ foreach ($answer['hits'] as $i => $hit) {
 
130
  $productId = $hit['objectID'];
131
 
132
+ if ($productId) {
133
  $data[$productId] = $resultsLimit - $i;
134
+ }
135
  }
136
 
137
  return $data;
138
  }
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  public function removeCategories($ids, $store_id = null)
141
  {
142
  $store_ids = Algolia_Algoliasearch_Helper_Entity_Helper::getStores($store_id);
143
 
144
+ foreach ($store_ids as $store_id) {
145
+ if ($this->config->isEnabledBackend($store_id) === false) {
146
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($store_id));
 
 
147
  continue;
148
  }
149
 
155
 
156
  public function rebuildStoreAdditionalSectionsIndex($storeId)
157
  {
158
+ if ($this->config->isEnabledBackend($storeId) === false) {
159
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId));
160
+
161
  return;
162
  }
163
 
164
  $additionnal_sections = $this->config->getAutocompleteSections();
165
 
166
+ foreach ($additionnal_sections as $section) {
167
+ if ($section['name'] === 'products' || $section['name'] === 'categories' || $section['name'] === 'pages' || $section['name'] === 'suggestions') {
 
168
  continue;
169
+ }
170
 
171
  $index_name = $this->additionalsections_helper->getIndexName($storeId).'_'.$section['name'];
172
 
173
  $attribute_values = $this->additionalsections_helper->getAttributeValues($storeId, $section);
174
 
175
+ foreach (array_chunk($attribute_values, 100) as $chunk) {
176
  $this->algolia_helper->addObjects($chunk, $index_name.'_tmp');
177
+ }
178
 
179
  $this->algolia_helper->moveIndex($index_name.'_tmp', $index_name);
180
 
181
+ $this->algolia_helper->setSettings($index_name,
182
+ $this->additionalsections_helper->getIndexSettings($storeId));
183
  }
184
  }
185
 
186
  public function rebuildStorePageIndex($storeId)
187
  {
188
+ if ($this->config->isEnabledBackend($storeId) === false) {
189
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId));
190
+
191
  return;
192
  }
193
 
197
 
198
  $pages = $this->page_helper->getPages($storeId);
199
 
200
+ foreach (array_chunk($pages, 100) as $chunk) {
201
  $this->algolia_helper->addObjects($chunk, $index_name.'_tmp');
202
+ }
203
 
204
  $this->algolia_helper->moveIndex($index_name.'_tmp', $index_name);
205
 
210
 
211
  public function rebuildStoreCategoryIndex($storeId, $categoryIds = null)
212
  {
213
+ if ($this->config->isEnabledBackend($storeId) === false) {
214
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId));
215
+
216
  return;
217
  }
218
 
219
  $emulationInfo = $this->startEmulation($storeId);
220
 
221
+ try {
 
222
  $collection = $this->category_helper->getCategoryCollectionQuery($storeId, $categoryIds);
223
 
224
  $size = $collection->getSize();
225
 
226
+ if ($size > 0) {
 
227
  $pages = ceil($size / $this->config->getNumberOfElementByPage());
228
  $collection->clear();
229
  $page = 1;
230
 
231
+ while ($page <= $pages) {
232
+ $this->rebuildStoreCategoryIndexPage($storeId, $collection, $page,
233
+ $this->config->getNumberOfElementByPage(), $emulationInfo);
234
 
235
  $page++;
236
  }
237
 
238
  unset($indexData);
239
  }
240
+ } catch (Exception $e) {
 
 
241
  $this->stopEmulation($emulationInfo);
242
  throw $e;
243
  }
247
 
248
  public function rebuildStoreSuggestionIndex($storeId)
249
  {
250
+ if ($this->config->isEnabledBackend($storeId) === false) {
251
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId));
252
+
253
  return;
254
  }
255
 
257
 
258
  $size = $collection->getSize();
259
 
260
+ if ($size > 0) {
 
261
  $pages = ceil($size / $this->config->getNumberOfElementByPage());
262
  $collection->clear();
263
  $page = 1;
264
 
265
+ while ($page <= $pages) {
266
+ $this->rebuildStoreSuggestionIndexPage($storeId, $collection, $page,
267
+ $this->config->getNumberOfElementByPage());
268
 
269
  $page++;
270
  }
275
 
276
  public function moveStoreSuggestionIndex($storeId)
277
  {
278
+ if ($this->config->isEnabledBackend($storeId) === false) {
279
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId));
280
+
281
  return;
282
  }
283
 
284
+ $this->algolia_helper->moveIndex($this->suggestion_helper->getIndexName($storeId).'_tmp',
285
+ $this->suggestion_helper->getIndexName($storeId));
286
+ }
287
+
288
+ public function moveProductsIndex($storeId)
289
+ {
290
+ $indexName = $this->product_helper->getIndexName($storeId);
291
+ $tmpIndexName = $this->product_helper->getIndexName($storeId, true);
292
+
293
+ $this->algolia_helper->moveIndex($tmpIndexName, $indexName);
294
  }
295
 
296
  public function rebuildStoreProductIndex($storeId, $productIds)
297
  {
298
+ if ($this->config->isEnabledBackend($storeId) === false) {
299
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId));
300
+
301
  return;
302
  }
303
 
304
  $emulationInfo = $this->startEmulation($storeId);
305
 
306
+ try {
307
+ $collection = $this->product_helper->getProductCollectionQuery($storeId, $productIds, false);
 
 
308
  $size = $collection->getSize();
309
 
310
+ if (!empty($productIds)) {
311
+ $size = max(count($productIds), $size);
312
+ }
313
+
314
+ $this->logger->log('Store '.$this->logger->getStoreName($storeId).' collection size : '.$size);
315
 
316
+ if ($size > 0) {
 
317
  $pages = ceil($size / $this->config->getNumberOfElementByPage());
 
318
  $page = 1;
319
 
320
+ $collection->clear();
321
+
322
+ while ($page <= $pages) {
323
+ $this->rebuildStoreProductIndexPage($storeId, $collection, $page,
324
+ $this->config->getNumberOfElementByPage(), $emulationInfo, $productIds);
325
 
326
  $page++;
327
  }
328
  }
329
+ } catch (Exception $e) {
 
 
330
  $this->stopEmulation($emulationInfo);
331
  throw $e;
332
  }
336
 
337
  public function rebuildStoreSuggestionIndexPage($storeId, $collectionDefault, $page, $pageSize)
338
  {
339
+ if ($this->config->isEnabledBackend($storeId) === false) {
340
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId));
341
+
342
  return;
343
  }
344
 
346
  $collection->setCurPage($page)->setPageSize($pageSize);
347
  $collection->load();
348
 
349
+ $index_name = $this->suggestion_helper->getIndexName($storeId).'_tmp';
350
+
351
+ if ($page == 1) {
352
+ $this->algolia_helper->setSettings($index_name, $this->suggestion_helper->getIndexSettings($storeId));
353
+ }
354
 
355
+ $indexData = [];
356
 
357
+ /** @var Mage_CatalogSearch_Model_Query $suggestion */
358
+ foreach ($collection as $suggestion) {
 
359
  $suggestion->setStoreId($storeId);
360
 
361
  $suggestion_obj = $this->suggestion_helper->getObject($suggestion);
362
 
363
+ if (strlen($suggestion_obj['query']) >= 3) {
364
  array_push($indexData, $suggestion_obj);
365
+ }
366
  }
367
 
368
+ if (count($indexData) > 0) {
369
  $this->algolia_helper->addObjects($indexData, $index_name);
370
+ }
371
 
372
  unset($indexData);
373
 
379
 
380
  public function rebuildStoreCategoryIndexPage($storeId, $collectionDefault, $page, $pageSize, $emulationInfo = null)
381
  {
382
+ if ($this->config->isEnabledBackend($storeId) === false) {
383
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId));
384
+
385
  return;
386
  }
387
 
388
  $emulationInfoPage = null;
389
 
390
+ if ($emulationInfo === null) {
391
  $emulationInfoPage = $this->startEmulation($storeId);
392
+ }
393
 
394
  $collection = clone $collectionDefault;
395
  $collection->setCurPage($page)->setPageSize($pageSize);
397
 
398
  $index_name = $this->category_helper->getIndexName($storeId);
399
 
400
+ $indexData = [];
401
 
402
  /** @var $category Mage_Catalog_Model_Category */
403
+ foreach ($collection as $category) {
404
+ if (!$this->category_helper->isCategoryActive($category->getId(), $storeId)) {
 
405
  continue;
406
+ }
407
 
408
  $category->setStoreId($storeId);
409
 
410
  $category_obj = $this->category_helper->getObject($category);
411
 
412
+ if ($category_obj['product_count'] > 0) {
413
  array_push($indexData, $category_obj);
414
+ }
415
  }
416
 
417
+ if (count($indexData) > 0) {
418
  $this->algolia_helper->addObjects($indexData, $index_name);
419
+ }
420
 
421
  unset($indexData);
422
 
425
 
426
  unset($collection);
427
 
428
+ if ($emulationInfo === null) {
429
  $this->stopEmulation($emulationInfoPage);
430
+ }
431
  }
432
 
433
+ protected function getProductsRecords($storeId, $collection, $potentiallyDeletedProductsIds = null)
434
  {
435
+ $productsToIndex = [];
436
+ $productsToRemove = [];
437
+
438
+ // In $potentiallyDeletedProductsIds there might be IDs of deleted products which will not be in a collection
439
+ if (is_array($potentiallyDeletedProductsIds)) {
440
+ $potentiallyDeletedProductsIds = array_combine($potentiallyDeletedProductsIds, $potentiallyDeletedProductsIds);
441
+ }
442
 
443
  $this->logger->start('CREATE RECORDS '.$this->logger->getStoreName($storeId));
444
+ $this->logger->log(count($collection).' product records to create');
445
+
446
  /** @var $product Mage_Catalog_Model_Product */
447
+ foreach ($collection as $product) {
 
448
  $product->setStoreId($storeId);
449
 
450
+ $productId = $product->getId();
451
+
452
+ // If $productId is in the collection, remove it from $potentiallyDeletedProductsIds so it's not removed without check
453
+ if (isset($potentiallyDeletedProductsIds[$productId])) {
454
+ unset($potentiallyDeletedProductsIds[$productId]);
455
+ }
456
 
457
+ if (isset($productsToIndex[$productId]) || isset($productsToRemove[$productId])) {
458
+ continue;
459
+ }
460
+
461
+ if ($product->isDeleted() === true
462
+ || $product->getStatus() == Mage_Catalog_Model_Product_Status::STATUS_DISABLED
463
+ || (int) $product->getVisibility() <= Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE
464
+ || ($product->getStockItem()->is_in_stock == 0 && !$this->config->getShowOutOfStock($storeId))
465
+ ) {
466
+ $productsToRemove[$productId] = $productId;
467
+ continue;
468
+ }
469
+
470
+ $json = $this->product_helper->getObject($product);
471
+ $productsToIndex[$productId] = $json;
472
  }
473
+
474
+ $productsToRemove = array_merge($productsToRemove, $potentiallyDeletedProductsIds);
475
+
476
  $this->logger->stop('CREATE RECORDS '.$this->logger->getStoreName($storeId));
477
 
478
+ return [
479
+ 'toIndex' => $productsToIndex,
480
+ 'toRemove' => array_unique($productsToRemove),
481
+ ];
482
  }
483
 
484
+ public function rebuildStoreProductIndexPage($storeId, $collectionDefault, $page, $pageSize, $emulationInfo = null, $productIds = null, $useTmpIndex = false)
485
  {
486
+ if ($this->config->isEnabledBackend($storeId) === false) {
487
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId));
488
+
489
  return;
490
  }
491
 
492
+ $this->logger->start('rebuildStoreProductIndexPage '.$this->logger->getStoreName($storeId).' page '.$page.' pageSize '.$pageSize);
493
  $emulationInfoPage = null;
494
 
495
+ if ($emulationInfo === null) {
496
  $emulationInfoPage = $this->startEmulation($storeId);
497
+ }
498
 
499
  $index_prefix = Mage::getConfig()->getTablePrefix();
500
 
501
  $additionalAttributes = $this->config->getProductAdditionalAttributes($storeId);
502
 
503
+ /** @var Mage_Catalog_Model_Resource_Product_Collection $collection */
504
  $collection = clone $collectionDefault;
505
+
506
  $collection->setCurPage($page)->setPageSize($pageSize);
507
  $collection->addCategoryIds();
508
  $collection->addUrlRewrite();
509
 
510
+ if ($this->product_helper->isAttributeEnabled($additionalAttributes, 'stock_qty')) {
511
+ $collection->joinField('stock_qty', $index_prefix.'cataloginventory_stock_item', 'qty',
512
+ 'product_id=entity_id', '{{table}}.stock_id=1', 'left');
513
+ }
514
 
515
+ if ($this->product_helper->isAttributeEnabled($additionalAttributes, 'ordered_qty')) {
516
+ $collection->getSelect()
517
+ ->columns('(SELECT SUM(qty_ordered) FROM '.$index_prefix.'sales_flat_order_item WHERE '.$index_prefix.'sales_flat_order_item.product_id = e.entity_id) as ordered_qty');
518
+ }
519
 
520
+ if ($this->product_helper->isAttributeEnabled($additionalAttributes, 'total_ordered')) {
521
+ $collection->getSelect()
522
+ ->columns('(SELECT SUM(row_total) FROM '.$index_prefix.'sales_flat_order_item WHERE '.$index_prefix.'sales_flat_order_item.product_id = e.entity_id) as total_ordered');
523
+ }
524
 
525
+ if ($this->product_helper->isAttributeEnabled($additionalAttributes, 'rating_summary')) {
526
+ $collection->joinField('rating_summary', $index_prefix.'review_entity_summary', 'rating_summary',
527
+ 'entity_pk_value=entity_id', '{{table}}.store_id='.$storeId, 'left');
528
+ }
529
 
530
+ $this->logger->start('LOADING '.$this->logger->getStoreName($storeId).' collection page '.$page.', pageSize '.$pageSize);
531
 
532
  $collection->load();
533
 
534
  $this->logger->log('Loaded '.count($collection).' products');
535
+ $this->logger->stop('LOADING '.$this->logger->getStoreName($storeId).' collection page '.$page.', pageSize '.$pageSize);
536
 
537
+ $index_name = $this->product_helper->getIndexName($storeId, $useTmpIndex);
538
 
539
+ $indexData = $this->getProductsRecords($storeId, $collection, $productIds);
540
+
541
+ if (!empty($indexData['toIndex'])) {
542
+ $this->logger->start('ADD/UPDATE TO ALGOLIA');
543
+
544
+ $this->algolia_helper->addObjects($indexData['toIndex'], $index_name);
545
+
546
+ $this->logger->log('Product IDs: '.implode(', ', array_keys($indexData['toIndex'])));
547
+ $this->logger->stop('ADD/UPDATE TO ALGOLIA');
548
+ }
549
+
550
+ if (!empty($indexData['toRemove'])) {
551
+ $this->logger->start('REMOVE FROM ALGOLIA');
552
+
553
+ $this->algolia_helper->deleteObjects($indexData['toRemove'], $index_name);
554
+
555
+ $this->logger->log('Product IDs: '.implode(', ', $indexData['toRemove']));
556
+ $this->logger->stop('REMOVE FROM ALGOLIA');
557
+ }
558
 
 
 
 
 
559
 
560
  unset($indexData);
561
 
564
 
565
  unset($collection);
566
 
567
+ if ($emulationInfo === null) {
568
  $this->stopEmulation($emulationInfoPage);
569
+ }
570
 
571
+ $this->logger->stop('rebuildStoreProductIndexPage '.$this->logger->getStoreName($storeId).' page '.$page.' pageSize '.$pageSize);
572
  }
573
 
574
  public function startEmulation($storeId)
575
  {
576
  $this->logger->start('START EMULATION');
577
+
578
+ /** @var Mage_Core_Model_App_Emulation $appEmulation */
579
  $appEmulation = Mage::getSingleton('core/app_emulation');
580
 
581
  $info = $appEmulation->startEnvironmentEmulation($storeId);
582
 
583
  $info->setInitialStoreId(Mage::app()->getStore()->getId());
584
  $info->setEmulatedStoreId($storeId);
585
+ $info->setUseProductFlat(Mage::getStoreConfigFlag(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT,
586
+ $storeId));
587
+ $info->setUseCategoryFlat(Mage::getStoreConfigFlag(Mage_Catalog_Helper_Category_Flat::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY,
588
+ $storeId));
589
  Mage::app()->setCurrentStore($storeId);
590
+ Mage::app()->getStore($storeId)->setConfig(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT, false);
591
+ Mage::app()->getStore($storeId)
592
+ ->setConfig(Mage_Catalog_Helper_Category_Flat::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY, false);
593
 
594
  $this->logger->stop('START EMULATION');
595
+
596
  return $info;
597
  }
598
 
599
  public function stopEmulation($info)
600
  {
601
  $this->logger->start('STOP EMULATION');
602
+
603
+ /** @var Mage_Core_Model_App_Emulation $appEmulation */
604
  $appEmulation = Mage::getSingleton('core/app_emulation');
605
 
606
  Mage::app()->setCurrentStore($info->getInitialStoreId());
607
+ Mage::app()->getStore($info->getEmulatedStoreId())
608
+ ->setConfig(Mage_Catalog_Helper_Product_Flat::XML_PATH_USE_PRODUCT_FLAT, $info->getUseProductFlat());
609
+ Mage::app()->getStore($info->getEmulatedStoreId())
610
+ ->setConfig(Mage_Catalog_Helper_Category_Flat::XML_PATH_IS_ENABLED_FLAT_CATALOG_CATEGORY,
611
+ $info->getUseCategoryFlat());
612
 
613
  $appEmulation->stopEnvironmentEmulation($info);
614
  $this->logger->stop('STOP EMULATION');
app/code/community/Algolia/Algoliasearch/Helper/Entity/Additionalsectionshelper.php CHANGED
@@ -9,55 +9,58 @@ class Algolia_Algoliasearch_Helper_Entity_Additionalsectionshelper extends Algol
9
 
10
  public function getIndexSettings($storeId)
11
  {
12
- return array(
13
- 'attributesToIndex' => array('value'),
14
- );
15
  }
16
 
17
  public function getAttributeValues($storeId, $section)
18
  {
19
- $attributeCode = $section['name'];
 
20
 
21
- $products = Mage::getResourceModel('catalog/product_collection')
22
- ->addStoreFilter($storeId)
23
- ->addAttributeToFilter('visibility', array('in' => Mage::getSingleton('catalog/product_visibility')->getVisibleInSearchIds()))
24
- ->addAttributeToFilter('status', array('eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED))
25
- ->addAttributeToFilter($attributeCode, array('notnull' => true))
26
- ->addAttributeToFilter($attributeCode, array('neq' => ''))
27
- ->addAttributeToSelect($attributeCode);
28
 
29
- $usedAttributeValues = array_keys(array_flip( // array unique
 
 
 
 
 
 
 
 
 
 
30
  explode(',', implode(',', $products->getColumnValues($attributeCode)))));
31
 
32
- $attributeModel = Mage::getSingleton('eav/config')
33
- ->getAttribute('catalog_product', $attributeCode)
34
- ->setStoreId($storeId);
35
 
36
- $values = $attributeModel->getSource()->getOptionText(
37
- implode(',', $usedAttributeValues)
38
- );
39
 
40
- if (! $values || count($values) == 0)
41
- {
 
42
  $values = array_unique($products->getColumnValues($attributeCode));
43
  }
44
 
45
- if ($values && is_array($values) == false)
46
- {
47
- $values = array($values);
48
  }
49
 
50
  $values = array_map(function ($value) use ($section, $storeId) {
51
-
52
- $record = array(
53
- 'objectID' => $value,
54
- 'value' => $value
55
- );
56
 
57
  $transport = new Varien_Object($record);
58
 
59
  Mage::dispatchEvent('algolia_additional_section_item_index_before',
60
- array('section' => $section, 'record' => $transport, 'store_id' => $storeId));
61
 
62
  $record = $transport->getData();
63
 
9
 
10
  public function getIndexSettings($storeId)
11
  {
12
+ return [
13
+ 'attributesToIndex' => ['value'],
14
+ ];
15
  }
16
 
17
  public function getAttributeValues($storeId, $section)
18
  {
19
+ /** @var Mage_Catalog_Model_Product_Visibility $catalogProductVisibility */
20
+ $catalogProductVisibility = Mage::getSingleton('catalog/product_visibility');
21
 
22
+ $attributeCode = $section['name'];
 
 
 
 
 
 
23
 
24
+ /** @var Mage_Catalog_Model_Resource_Product_Collection $products */
25
+ $products = Mage::getResourceModel('catalog/product_collection')->addStoreFilter($storeId)
26
+ ->addAttributeToFilter('visibility',
27
+ ['in' => $catalogProductVisibility->getVisibleInSearchIds()])
28
+ ->addAttributeToFilter('status',
29
+ ['eq' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED])
30
+ ->addAttributeToFilter($attributeCode, ['notnull' => true])
31
+ ->addAttributeToFilter($attributeCode, ['neq' => ''])
32
+ ->addAttributeToSelect($attributeCode);
33
+
34
+ $usedAttributeValues = array_keys(array_flip(// array unique
35
  explode(',', implode(',', $products->getColumnValues($attributeCode)))));
36
 
37
+ /** @var Mage_Eav_Model_Config $eavConfig */
38
+ $eavConfig = Mage::getSingleton('eav/config');
 
39
 
40
+ /** @var Mage_Eav_Model_Attribute $attributeModel */
41
+ $attributeModel = $eavConfig->getAttribute('catalog_product', $attributeCode);
42
+ $attributeModel->setStoreId($storeId);
43
 
44
+ $values = $attributeModel->getSource()->getOptionText(implode(',', $usedAttributeValues));
45
+
46
+ if (!$values || count($values) == 0) {
47
  $values = array_unique($products->getColumnValues($attributeCode));
48
  }
49
 
50
+ if ($values && is_array($values) == false) {
51
+ $values = [$values];
 
52
  }
53
 
54
  $values = array_map(function ($value) use ($section, $storeId) {
55
+ $record = [
56
+ 'objectID' => $value,
57
+ 'value' => $value,
58
+ ];
 
59
 
60
  $transport = new Varien_Object($record);
61
 
62
  Mage::dispatchEvent('algolia_additional_section_item_index_before',
63
+ ['section' => $section, 'record' => $transport, 'store_id' => $storeId]);
64
 
65
  $record = $transport->getData();
66
 
app/code/community/Algolia/Algoliasearch/Helper/Entity/Categoryhelper.php CHANGED
@@ -12,40 +12,41 @@ class Algolia_Algoliasearch_Helper_Entity_Categoryhelper extends Algolia_Algolia
12
 
13
  public function getIndexSettings($storeId)
14
  {
15
- $attributesToIndex = array();
16
- $unretrievableAttributes = array();
17
-
18
- foreach ($this->config->getCategoryAdditionalAttributes($storeId) as $attribute)
19
- {
20
- if ($attribute['searchable'] == '1')
21
- {
22
- if ($attribute['order'] == 'ordered')
23
  $attributesToIndex[] = $attribute['attribute'];
24
- else
25
  $attributesToIndex[] = 'unordered('.$attribute['attribute'].')';
 
26
  }
27
 
28
- if ($attribute['retrievable'] != '1')
29
  $unretrievableAttributes[] = $attribute['attribute'];
 
30
  }
31
 
32
  $customRankings = $this->config->getCategoryCustomRanking($storeId);
33
 
34
- $customRankingsArr = array();
35
 
36
- foreach ($customRankings as $ranking)
37
- $customRankingsArr[] = $ranking['order'] . '(' . $ranking['attribute'] . ')';
 
38
 
39
  // Default index settings
40
- $indexSettings = array(
41
- 'attributesToIndex' => array_values(array_unique($attributesToIndex)),
42
- 'customRanking' => $customRankingsArr,
43
- 'unretrievableAttributes' => $unretrievableAttributes
44
- );
45
 
46
  // Additional index settings from event observer
47
  $transport = new Varien_Object($indexSettings);
48
- Mage::dispatchEvent('algolia_index_settings_prepare', array('store_id' => $storeId, 'index_settings' => $transport));
49
  $indexSettings = $transport->getData();
50
 
51
  $this->algolia_helper->mergeSettings($this->getIndexName($storeId), $indexSettings);
@@ -57,14 +58,15 @@ class Algolia_Algoliasearch_Helper_Entity_Categoryhelper extends Algolia_Algolia
57
  {
58
  $storeRootCategoryPath = sprintf('%d/%d', $this->getRootCategoryId(), Mage::app()->getStore($storeId)->getRootCategoryId());
59
 
60
- $categories = Mage::getResourceModel('catalog/category_collection'); /** @var $categories Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */
61
 
62
  $unserializedCategorysAttrs = $this->config->getCategoryAdditionalAttributes($storeId);
63
 
64
- $additionalAttr = array();
65
 
66
- foreach ($unserializedCategorysAttrs as $attr)
67
  $additionalAttr[] = $attr['attribute'];
 
68
 
69
  $additionalAttr[] = 'include_in_menu';
70
 
@@ -74,40 +76,41 @@ class Algolia_Algoliasearch_Helper_Entity_Categoryhelper extends Algolia_Algolia
74
  ->addUrlRewriteToResult()
75
  ->addIsActiveFilter()
76
  ->setStoreId($storeId)
77
- ->addAttributeToSelect(array_merge(array('name'), $additionalAttr))
78
- ->addFieldToFilter('level', array('gt' => 1));
79
 
80
- if ($categoryIds)
81
- $categories->addFieldToFilter('entity_id', array('in' => $categoryIds));
 
82
 
83
  return $categories;
84
  }
85
 
86
  public function getAllAttributes()
87
  {
88
- if (is_null(self::$_categoryAttributes))
89
- {
90
- self::$_categoryAttributes = array();
91
 
92
  /** @var $config Mage_Eav_Model_Config */
93
  $config = Mage::getSingleton('eav/config');
94
 
95
  $allAttributes = $config->getEntityAttributeCodes('catalog_category');
96
 
97
- $categoryAttributes = array_merge($allAttributes, array('product_count'));
98
 
99
- $excludedAttributes = array(
100
  'all_children', 'available_sort_by', 'children', 'children_count', 'custom_apply_to_products',
101
  'custom_design', 'custom_design_from', 'custom_design_to', 'custom_layout_update', 'custom_use_parent_settings',
102
  'default_sort_by', 'display_mode', 'filter_price_range', 'global_position', 'image', 'include_in_menu', 'is_active',
103
  'is_always_include_in_menu', 'is_anchor', 'landing_page', 'level', 'lower_cms_block',
104
  'page_layout', 'path_in_store', 'position', 'small_image', 'thumbnail', 'url_key', 'url_path',
105
- 'visible_in_menu');
106
 
107
  $categoryAttributes = array_diff($categoryAttributes, $excludedAttributes);
108
 
109
- foreach ($categoryAttributes as $attributeCode)
110
  self::$_categoryAttributes[$attributeCode] = $config->getAttribute('catalog_category', $attributeCode)->getFrontendLabel();
 
111
  }
112
 
113
  return self::$_categoryAttributes;
@@ -115,17 +118,22 @@ class Algolia_Algoliasearch_Helper_Entity_Categoryhelper extends Algolia_Algolia
115
 
116
  public function getObject(Mage_Catalog_Model_Category $category)
117
  {
118
- /** @var $productCollection Mage_Catalog_Model_Resource_Product_Collection */
119
- $productCollection = $category->getProductCollection();
120
- $productCollection = $productCollection->addMinimalPrice();
 
 
 
 
 
 
121
 
122
  $category->setProductCount($productCollection->getSize());
123
 
124
  $transport = new Varien_Object();
125
- Mage::dispatchEvent('algolia_category_index_before', array('category' => $category, 'custom_data' => $transport));
126
  $customData = $transport->getData();
127
 
128
- $storeId = $category->getStoreId();
129
  $category->getUrlInstance()->setStore($storeId);
130
  $path = '';
131
  foreach ($category->getPathIds() as $categoryId) {
@@ -135,49 +143,50 @@ class Algolia_Algoliasearch_Helper_Entity_Categoryhelper extends Algolia_Algolia
135
  $path .= $this->getCategoryName($categoryId, $storeId);
136
  }
137
 
138
- $image_url = NULL;
139
  try {
140
  $image_url = $category->getImageUrl();
141
  } catch (Exception $e) { /* no image, no default: not fatal */
142
  }
143
- $data = array(
144
- 'objectID' => $category->getId(),
145
- 'name' => $category->getName(),
146
- 'path' => $path,
147
- 'level' => $category->getLevel(),
148
- 'url' => $category->getUrl(),
149
- 'include_in_menu' => $category->getIncludeInMenu(),
150
- '_tags' => array('category'),
151
- 'popularity' => 1,
152
- 'product_count' => $category->getProductCount()
153
- );
154
-
155
- if ( ! empty($image_url)) {
156
  $data['image_url'] = $image_url;
157
  }
158
 
159
- foreach ($this->config->getCategoryAdditionalAttributes($storeId) as $attribute)
160
- {
161
  $value = $category->getData($attribute['attribute']);
162
 
163
  $attribute_resource = $category->getResource()->getAttribute($attribute['attribute']);
164
 
165
- if ($attribute_resource)
166
- {
167
  $value = $attribute_resource->getFrontend()->getValue($category);
168
  }
169
 
170
- if (isset($data[$attribute['attribute']]))
171
  $value = $data[$attribute['attribute']];
 
172
 
173
- if ($value)
174
  $data[$attribute['attribute']] = $value;
 
175
  }
176
 
177
  $data = array_merge($data, $customData);
178
 
179
- foreach ($data as &$data0)
180
  $data0 = $this->try_cast($data0);
 
181
 
182
  return $data;
183
  }
@@ -191,6 +200,7 @@ class Algolia_Algoliasearch_Helper_Entity_Categoryhelper extends Algolia_Algolia
191
  $rootCategory = $collection->getFirstItem();
192
  self::$_rootCategoryId = $rootCategory->getId();
193
  }
 
194
  return self::$_rootCategoryId;
195
  }
196
- }
12
 
13
  public function getIndexSettings($storeId)
14
  {
15
+ $attributesToIndex = [];
16
+ $unretrievableAttributes = [];
17
+
18
+ foreach ($this->config->getCategoryAdditionalAttributes($storeId) as $attribute) {
19
+ if ($attribute['searchable'] == '1') {
20
+ if ($attribute['order'] == 'ordered') {
 
 
21
  $attributesToIndex[] = $attribute['attribute'];
22
+ } else {
23
  $attributesToIndex[] = 'unordered('.$attribute['attribute'].')';
24
+ }
25
  }
26
 
27
+ if ($attribute['retrievable'] != '1') {
28
  $unretrievableAttributes[] = $attribute['attribute'];
29
+ }
30
  }
31
 
32
  $customRankings = $this->config->getCategoryCustomRanking($storeId);
33
 
34
+ $customRankingsArr = [];
35
 
36
+ foreach ($customRankings as $ranking) {
37
+ $customRankingsArr[] = $ranking['order'].'('.$ranking['attribute'].')';
38
+ }
39
 
40
  // Default index settings
41
+ $indexSettings = [
42
+ 'attributesToIndex' => array_values(array_unique($attributesToIndex)),
43
+ 'customRanking' => $customRankingsArr,
44
+ 'unretrievableAttributes' => $unretrievableAttributes,
45
+ ];
46
 
47
  // Additional index settings from event observer
48
  $transport = new Varien_Object($indexSettings);
49
+ Mage::dispatchEvent('algolia_index_settings_prepare', ['store_id' => $storeId, 'index_settings' => $transport]);
50
  $indexSettings = $transport->getData();
51
 
52
  $this->algolia_helper->mergeSettings($this->getIndexName($storeId), $indexSettings);
58
  {
59
  $storeRootCategoryPath = sprintf('%d/%d', $this->getRootCategoryId(), Mage::app()->getStore($storeId)->getRootCategoryId());
60
 
61
+ $categories = Mage::getResourceModel('catalog/category_collection'); /* @var $categories Mage_Catalog_Model_Resource_Eav_Mysql4_Category_Collection */
62
 
63
  $unserializedCategorysAttrs = $this->config->getCategoryAdditionalAttributes($storeId);
64
 
65
+ $additionalAttr = [];
66
 
67
+ foreach ($unserializedCategorysAttrs as $attr) {
68
  $additionalAttr[] = $attr['attribute'];
69
+ }
70
 
71
  $additionalAttr[] = 'include_in_menu';
72
 
76
  ->addUrlRewriteToResult()
77
  ->addIsActiveFilter()
78
  ->setStoreId($storeId)
79
+ ->addAttributeToSelect(array_merge(['name'], $additionalAttr))
80
+ ->addFieldToFilter('level', ['gt' => 1]);
81
 
82
+ if ($categoryIds) {
83
+ $categories->addFieldToFilter('entity_id', ['in' => $categoryIds]);
84
+ }
85
 
86
  return $categories;
87
  }
88
 
89
  public function getAllAttributes()
90
  {
91
+ if (is_null(self::$_categoryAttributes)) {
92
+ self::$_categoryAttributes = [];
 
93
 
94
  /** @var $config Mage_Eav_Model_Config */
95
  $config = Mage::getSingleton('eav/config');
96
 
97
  $allAttributes = $config->getEntityAttributeCodes('catalog_category');
98
 
99
+ $categoryAttributes = array_merge($allAttributes, ['product_count']);
100
 
101
+ $excludedAttributes = [
102
  'all_children', 'available_sort_by', 'children', 'children_count', 'custom_apply_to_products',
103
  'custom_design', 'custom_design_from', 'custom_design_to', 'custom_layout_update', 'custom_use_parent_settings',
104
  'default_sort_by', 'display_mode', 'filter_price_range', 'global_position', 'image', 'include_in_menu', 'is_active',
105
  'is_always_include_in_menu', 'is_anchor', 'landing_page', 'level', 'lower_cms_block',
106
  'page_layout', 'path_in_store', 'position', 'small_image', 'thumbnail', 'url_key', 'url_path',
107
+ 'visible_in_menu', ];
108
 
109
  $categoryAttributes = array_diff($categoryAttributes, $excludedAttributes);
110
 
111
+ foreach ($categoryAttributes as $attributeCode) {
112
  self::$_categoryAttributes[$attributeCode] = $config->getAttribute('catalog_category', $attributeCode)->getFrontendLabel();
113
+ }
114
  }
115
 
116
  return self::$_categoryAttributes;
118
 
119
  public function getObject(Mage_Catalog_Model_Category $category)
120
  {
121
+ $storeId = $category->getStoreId();
122
+
123
+ /** @var Algolia_Algoliasearch_Helper_Entity_Producthelper $productHelper */
124
+ $productHelper = Mage::helper('algoliasearch/entity_producthelper');
125
+
126
+ $collection = $productHelper->getProductCollectionQuery($storeId, null, true, true);
127
+
128
+ $productCollection = clone $collection;
129
+ $productCollection = $productCollection->addCategoryFilter($category);
130
 
131
  $category->setProductCount($productCollection->getSize());
132
 
133
  $transport = new Varien_Object();
134
+ Mage::dispatchEvent('algolia_category_index_before', ['category' => $category, 'custom_data' => $transport]);
135
  $customData = $transport->getData();
136
 
 
137
  $category->getUrlInstance()->setStore($storeId);
138
  $path = '';
139
  foreach ($category->getPathIds() as $categoryId) {
143
  $path .= $this->getCategoryName($categoryId, $storeId);
144
  }
145
 
146
+ $image_url = null;
147
  try {
148
  $image_url = $category->getImageUrl();
149
  } catch (Exception $e) { /* no image, no default: not fatal */
150
  }
151
+ $data = [
152
+ 'objectID' => $category->getId(),
153
+ 'name' => $category->getName(),
154
+ 'path' => $path,
155
+ 'level' => $category->getLevel(),
156
+ 'url' => $category->getUrl(),
157
+ 'include_in_menu' => $category->getIncludeInMenu(),
158
+ '_tags' => ['category'],
159
+ 'popularity' => 1,
160
+ 'product_count' => $category->getProductCount(),
161
+ ];
162
+
163
+ if (!empty($image_url)) {
164
  $data['image_url'] = $image_url;
165
  }
166
 
167
+ foreach ($this->config->getCategoryAdditionalAttributes($storeId) as $attribute) {
 
168
  $value = $category->getData($attribute['attribute']);
169
 
170
  $attribute_resource = $category->getResource()->getAttribute($attribute['attribute']);
171
 
172
+ if ($attribute_resource) {
 
173
  $value = $attribute_resource->getFrontend()->getValue($category);
174
  }
175
 
176
+ if (isset($data[$attribute['attribute']])) {
177
  $value = $data[$attribute['attribute']];
178
+ }
179
 
180
+ if ($value) {
181
  $data[$attribute['attribute']] = $value;
182
+ }
183
  }
184
 
185
  $data = array_merge($data, $customData);
186
 
187
+ foreach ($data as &$data0) {
188
  $data0 = $this->try_cast($data0);
189
+ }
190
 
191
  return $data;
192
  }
200
  $rootCategory = $collection->getFirstItem();
201
  self::$_rootCategoryId = $rootCategory->getId();
202
  }
203
+
204
  return self::$_rootCategoryId;
205
  }
206
+ }
app/code/community/Algolia/Algoliasearch/Helper/Entity/Helper.php CHANGED
@@ -2,9 +2,13 @@
2
 
3
  abstract class Algolia_Algoliasearch_Helper_Entity_Helper
4
  {
 
5
  protected $config;
 
6
  /** @var Algolia_Algoliasearch_Helper_Logger */
7
  protected $logger;
 
 
8
  protected $algolia_helper;
9
 
10
  protected static $_activeCategories;
@@ -14,53 +18,62 @@ abstract class Algolia_Algoliasearch_Helper_Entity_Helper
14
 
15
  public function __construct()
16
  {
17
- $this->config = Mage::helper('algoliasearch/config');
18
- $this->algolia_helper = Mage::helper('algoliasearch/algoliahelper');
19
- $this->logger = Mage::helper('algoliasearch/logger');
20
  }
21
 
22
  public function getBaseIndexName($storeId = null)
23
  {
24
- return (string) $this->config->getIndexPrefix($storeId) . Mage::app()->getStore($storeId)->getCode();
25
  }
26
 
27
- public function getIndexName($storeId = null)
28
  {
29
- return (string) $this->getBaseIndexName($storeId) . $this->getIndexNameSuffix();
 
 
 
 
 
 
30
  }
31
 
32
  protected function try_cast($value)
33
  {
34
- if (is_numeric($value) && floatval($value) == floatval(intval($value)))
35
  return intval($value);
 
36
 
37
- if (is_numeric($value))
38
  return floatval($value);
 
39
 
40
  return $value;
41
  }
42
 
43
  protected function castProductObject(&$productData)
44
  {
45
- foreach ($productData as $key => &$data)
46
- {
47
- if ($key === 'sku') {
 
48
  continue;
49
  }
 
50
  $data = $this->try_cast($data);
51
 
52
- if (is_array($data) === false)
53
- {
54
  $data = explode('|', $data);
55
 
56
- if (count($data) == 1)
57
- {
58
  $data = $data[0];
59
  $data = $this->try_cast($data);
60
- }
61
- else
62
- foreach($data as &$element)
63
  $element = $this->try_cast($element);
 
 
64
  }
65
  }
66
  }
@@ -77,16 +90,20 @@ abstract class Algolia_Algoliasearch_Helper_Entity_Helper
77
 
78
  public function isCategoryActive($categoryId, $storeId = null)
79
  {
80
- $storeId = intval($storeId);
81
- $categoryId = intval($categoryId);
 
 
 
82
 
83
- if ($path = $this->getCategoryPath($categoryId, $storeId)) // Check whether the specified category is active
84
- {
85
- $isActive = TRUE; // Check whether all parent categories for the current category are active
86
  $parentCategoryIds = explode('/', $path);
87
 
88
- if (count($parentCategoryIds) <= 2) // Exclude root category
89
- return FALSE;
 
 
 
90
 
91
  array_shift($parentCategoryIds); // Remove root category
92
 
@@ -94,39 +111,37 @@ abstract class Algolia_Algoliasearch_Helper_Entity_Helper
94
 
95
  $parentCategoryIds = array_reverse($parentCategoryIds); // Start from the first parent
96
 
97
- foreach ($parentCategoryIds as $parentCategoryId)
98
- {
99
- if ( ! ($parentCategoryPath = $this->getCategoryPath($parentCategoryId, $storeId)))
100
- {
101
- $isActive = FALSE;
102
  break;
103
  }
104
  }
105
 
106
- if ($isActive)
107
- return TRUE;
 
108
  }
109
- return FALSE;
 
110
  }
111
 
112
  public function getCategoryPath($categoryId, $storeId = null)
113
  {
114
- $categories = $this->getCategories();
115
- $storeId = intval($storeId);
116
- $categoryId = intval($categoryId);
117
- $path = null;
118
- $key = $storeId.'-'.$categoryId;
119
-
120
- if (isset($categories[$key]))
121
- {
122
  $path = ($categories[$key]['value'] == 1) ? strval($categories[$key]['path']) : null;
123
- }
124
- elseif ($storeId !== 0)
125
- {
126
  $key = '0-'.$categoryId;
127
 
128
- if (isset($categories[$key]))
129
  $path = ($categories[$key]['value'] == 1) ? strval($categories[$key]['path']) : null;
 
130
  }
131
 
132
  return $path;
@@ -134,57 +149,64 @@ abstract class Algolia_Algoliasearch_Helper_Entity_Helper
134
 
135
  public function getCategories()
136
  {
137
- if (is_null(self::$_activeCategories))
138
- {
139
- self::$_activeCategories = array();
140
-
141
- $resource = Mage::getResourceModel('catalog/category'); /** @var $resource Mage_Catalog_Model_Resource_Category */
142
-
143
- if ($attribute = $resource->getAttribute('is_active'))
144
- {
145
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read'); /** @var $connection Varien_Db_Adapter_Pdo_Mysql */
146
-
147
- $select = $connection->select()
148
- ->from(array('backend' => $attribute->getBackendTable()), array('key' => new Zend_Db_Expr("CONCAT(backend.store_id, '-', backend.entity_id)"), 'category.path', 'backend.value'))
149
- ->join(array('category' => $resource->getTable('catalog/category')), 'backend.entity_id = category.entity_id', array())
150
- ->where('backend.entity_type_id = ?', $attribute->getEntityTypeId())
151
- ->where('backend.attribute_id = ?', $attribute->getAttributeId())
152
- ->order('backend.store_id')
153
- ->order('backend.entity_id');
 
 
 
154
 
155
  self::$_activeCategories = $connection->fetchAssoc($select);
156
  }
157
  }
 
158
  return self::$_activeCategories;
159
  }
160
 
161
  public function getCategoryName($categoryId, $storeId = null)
162
  {
163
- if ($categoryId instanceof Mage_Catalog_Model_Category)
164
  $categoryId = $categoryId->getId();
 
165
 
166
- if ($storeId instanceof Mage_Core_Model_Store)
167
  $storeId = $storeId->getId();
 
168
 
169
  $categoryId = intval($categoryId);
170
- $storeId = intval($storeId);
171
-
172
- if (is_null(self::$_categoryNames))
173
- {
174
- self::$_categoryNames = array();
175
-
176
- $resource = Mage::getResourceModel('catalog/category'); /** @var $resource Mage_Catalog_Model_Resource_Category */
177
-
178
- if ($attribute = $resource->getAttribute('name'))
179
- {
180
- $connection = Mage::getSingleton('core/resource')->getConnection('core_read'); /** @var $connection Varien_Db_Adapter_Pdo_Mysql */
181
-
182
- $select = $connection->select()
183
- ->from(array('backend' => $attribute->getBackendTable()), array(new Zend_Db_Expr("CONCAT(backend.store_id, '-', backend.entity_id)"), 'backend.value'))
184
- ->join(array('category' => $resource->getTable('catalog/category')), 'backend.entity_id = category.entity_id', array())
185
- ->where('backend.entity_type_id = ?', $attribute->getEntityTypeId())
186
- ->where('backend.attribute_id = ?', $attribute->getAttributeId())
187
- ->where('category.level > ?', 1);
 
188
 
189
  self::$_categoryNames = $connection->fetchPairs($select);
190
  }
@@ -194,16 +216,18 @@ abstract class Algolia_Algoliasearch_Helper_Entity_Helper
194
 
195
  $key = $storeId.'-'.$categoryId;
196
 
197
- if (isset(self::$_categoryNames[$key])) // Check whether the category name is present for the specified store
198
- {
 
199
  $categoryName = strval(self::$_categoryNames[$key]);
200
- }
201
- elseif ($storeId != 0) // Check whether the category name is present for the default store
202
- {
203
  $key = '0-'.$categoryId;
204
 
205
- if (isset(self::$_categoryNames[$key]))
206
  $categoryName = strval(self::$_categoryNames[$key]);
 
207
  }
208
 
209
  return $categoryName;
@@ -211,25 +235,25 @@ abstract class Algolia_Algoliasearch_Helper_Entity_Helper
211
 
212
  public static function getStores($store_id)
213
  {
 
214
  $config = Mage::helper('algoliasearch/config');
215
- $store_ids = array();
216
 
217
- if ($store_id == null)
218
- {
219
- foreach (Mage::app()->getStores() as $store)
220
- {
221
- if ($config->isEnabledBackEnd($store->getId()) === false)
222
  continue;
 
223
 
224
- if ($store->getIsActive())
225
  $store_ids[] = $store->getId();
226
-
227
  }
 
 
228
  }
229
- else
230
- $store_ids = array($store_id);
231
 
232
  return $store_ids;
233
  }
234
-
235
  }
2
 
3
  abstract class Algolia_Algoliasearch_Helper_Entity_Helper
4
  {
5
+ /** @var Algolia_Algoliasearch_Helper_Config */
6
  protected $config;
7
+
8
  /** @var Algolia_Algoliasearch_Helper_Logger */
9
  protected $logger;
10
+
11
+ /** @var Algolia_Algoliasearch_Helper_Algoliahelper */
12
  protected $algolia_helper;
13
 
14
  protected static $_activeCategories;
18
 
19
  public function __construct()
20
  {
21
+ $this->config = Mage::helper('algoliasearch/config');
22
+ $this->algolia_helper = Mage::helper('algoliasearch/algoliahelper');
23
+ $this->logger = Mage::helper('algoliasearch/logger');
24
  }
25
 
26
  public function getBaseIndexName($storeId = null)
27
  {
28
+ return (string) $this->config->getIndexPrefix($storeId).Mage::app()->getStore($storeId)->getCode();
29
  }
30
 
31
+ public function getIndexName($storeId = null, $getTmpIndexName = false)
32
  {
33
+ $indexName = (string) $this->getBaseIndexName($storeId).$this->getIndexNameSuffix();
34
+
35
+ if ($getTmpIndexName === true) {
36
+ $indexName .= '_tmp';
37
+ }
38
+
39
+ return $indexName;
40
  }
41
 
42
  protected function try_cast($value)
43
  {
44
+ if (is_numeric($value) && floatval($value) == floatval(intval($value))) {
45
  return intval($value);
46
+ }
47
 
48
+ if (is_numeric($value)) {
49
  return floatval($value);
50
+ }
51
 
52
  return $value;
53
  }
54
 
55
  protected function castProductObject(&$productData)
56
  {
57
+ $nonCastableAttributes = ['sku', 'name', 'description'];
58
+
59
+ foreach ($productData as $key => &$data) {
60
+ if (in_array($key, $nonCastableAttributes, true) === true) {
61
  continue;
62
  }
63
+
64
  $data = $this->try_cast($data);
65
 
66
+ if (is_array($data) === false) {
 
67
  $data = explode('|', $data);
68
 
69
+ if (count($data) == 1) {
 
70
  $data = $data[0];
71
  $data = $this->try_cast($data);
72
+ } else {
73
+ foreach ($data as &$element) {
 
74
  $element = $this->try_cast($element);
75
+ }
76
+ }
77
  }
78
  }
79
  }
90
 
91
  public function isCategoryActive($categoryId, $storeId = null)
92
  {
93
+ $storeId = intval($storeId);
94
+ $categoryId = intval($categoryId);
95
+
96
+ if ($path = $this->getCategoryPath($categoryId, $storeId)) {
97
+ // Check whether the specified category is active
98
 
99
+ $isActive = true; // Check whether all parent categories for the current category are active
 
 
100
  $parentCategoryIds = explode('/', $path);
101
 
102
+ if (count($parentCategoryIds) <= 2) {
103
+ // Exclude root category
104
+
105
+ return false;
106
+ }
107
 
108
  array_shift($parentCategoryIds); // Remove root category
109
 
111
 
112
  $parentCategoryIds = array_reverse($parentCategoryIds); // Start from the first parent
113
 
114
+ foreach ($parentCategoryIds as $parentCategoryId) {
115
+ if (!($parentCategoryPath = $this->getCategoryPath($parentCategoryId, $storeId))) {
116
+ $isActive = false;
 
 
117
  break;
118
  }
119
  }
120
 
121
+ if ($isActive) {
122
+ return true;
123
+ }
124
  }
125
+
126
+ return false;
127
  }
128
 
129
  public function getCategoryPath($categoryId, $storeId = null)
130
  {
131
+ $categories = $this->getCategories();
132
+ $storeId = intval($storeId);
133
+ $categoryId = intval($categoryId);
134
+ $path = null;
135
+ $key = $storeId.'-'.$categoryId;
136
+
137
+ if (isset($categories[$key])) {
 
138
  $path = ($categories[$key]['value'] == 1) ? strval($categories[$key]['path']) : null;
139
+ } elseif ($storeId !== 0) {
 
 
140
  $key = '0-'.$categoryId;
141
 
142
+ if (isset($categories[$key])) {
143
  $path = ($categories[$key]['value'] == 1) ? strval($categories[$key]['path']) : null;
144
+ }
145
  }
146
 
147
  return $path;
149
 
150
  public function getCategories()
151
  {
152
+ if (is_null(self::$_activeCategories)) {
153
+ self::$_activeCategories = [];
154
+
155
+ /** @var Mage_Catalog_Model_Resource_Category $resource */
156
+ $resource = Mage::getResourceModel('catalog/category');
157
+
158
+ if ($attribute = $resource->getAttribute('is_active')) {
159
+ /** @var Mage_Core_Model_Resource $coreResource */
160
+ $coreResource = Mage::getSingleton('core/resource');
161
+ $connection = $coreResource->getConnection('core_read');
162
+
163
+ $select = $connection->select()->from(['backend' => $attribute->getBackendTable()], [
164
+ 'key' => new Zend_Db_Expr("CONCAT(backend.store_id, '-', backend.entity_id)"),
165
+ 'category.path',
166
+ 'backend.value',
167
+ ])->join(['category' => $resource->getTable('catalog/category')],
168
+ 'backend.entity_id = category.entity_id', [])
169
+ ->where('backend.entity_type_id = ?', $attribute->getEntityTypeId())
170
+ ->where('backend.attribute_id = ?', $attribute->getAttributeId())
171
+ ->order('backend.store_id')->order('backend.entity_id');
172
 
173
  self::$_activeCategories = $connection->fetchAssoc($select);
174
  }
175
  }
176
+
177
  return self::$_activeCategories;
178
  }
179
 
180
  public function getCategoryName($categoryId, $storeId = null)
181
  {
182
+ if ($categoryId instanceof Mage_Catalog_Model_Category) {
183
  $categoryId = $categoryId->getId();
184
+ }
185
 
186
+ if ($storeId instanceof Mage_Core_Model_Store) {
187
  $storeId = $storeId->getId();
188
+ }
189
 
190
  $categoryId = intval($categoryId);
191
+ $storeId = intval($storeId);
192
+
193
+ if (is_null(self::$_categoryNames)) {
194
+ self::$_categoryNames = [];
195
+
196
+ $resource = Mage::getResourceModel('catalog/category');
197
+ /** @var $resource Mage_Catalog_Model_Resource_Category */
198
+ if ($attribute = $resource->getAttribute('name')) {
199
+ /** @var Mage_Core_Model_Resource $coreResource */
200
+ $coreResource = Mage::getSingleton('core/resource');
201
+ $connection = $coreResource->getConnection('core_read');
202
+
203
+ $select = $connection->select()->from(['backend' => $attribute->getBackendTable()],
204
+ [new Zend_Db_Expr("CONCAT(backend.store_id, '-', backend.entity_id)"), 'backend.value'])
205
+ ->join(['category' => $resource->getTable('catalog/category')],
206
+ 'backend.entity_id = category.entity_id', [])
207
+ ->where('backend.entity_type_id = ?', $attribute->getEntityTypeId())
208
+ ->where('backend.attribute_id = ?', $attribute->getAttributeId())
209
+ ->where('category.level > ?', 1);
210
 
211
  self::$_categoryNames = $connection->fetchPairs($select);
212
  }
216
 
217
  $key = $storeId.'-'.$categoryId;
218
 
219
+ if (isset(self::$_categoryNames[$key])) {
220
+ // Check whether the category name is present for the specified store
221
+
222
  $categoryName = strval(self::$_categoryNames[$key]);
223
+ } elseif ($storeId != 0) {
224
+ // Check whether the category name is present for the default store
225
+
226
  $key = '0-'.$categoryId;
227
 
228
+ if (isset(self::$_categoryNames[$key])) {
229
  $categoryName = strval(self::$_categoryNames[$key]);
230
+ }
231
  }
232
 
233
  return $categoryName;
235
 
236
  public static function getStores($store_id)
237
  {
238
+ /** @var Algolia_Algoliasearch_Helper_Config $config */
239
  $config = Mage::helper('algoliasearch/config');
240
+ $store_ids = [];
241
 
242
+ if ($store_id == null) {
243
+ /** @var Mage_Core_Model_Store $store */
244
+ foreach (Mage::app()->getStores() as $store) {
245
+ if ($config->isEnabledBackend($store->getId()) === false) {
 
246
  continue;
247
+ }
248
 
249
+ if ($store->getIsActive()) {
250
  $store_ids[] = $store->getId();
251
+ }
252
  }
253
+ } else {
254
+ $store_ids = [$store_id];
255
  }
 
 
256
 
257
  return $store_ids;
258
  }
 
259
  }
app/code/community/Algolia/Algoliasearch/Helper/Entity/Pagehelper.php CHANGED
@@ -9,50 +9,63 @@ class Algolia_Algoliasearch_Helper_Entity_Pagehelper extends Algolia_Algoliasear
9
 
10
  public function getIndexSettings($storeId)
11
  {
12
- return array(
13
- 'attributesToIndex' => array('slug', 'name', 'unordered(content)'),
14
- 'attributesToSnippet' => array('content:7')
15
- );
16
  }
17
 
18
  public function getPages($storeId)
19
  {
20
- $magento_pages = Mage::getModel('cms/page')->getCollection()->addFieldToFilter('is_active',1);
 
 
 
 
21
 
22
  $ids = $magento_pages->toOptionArray();
23
 
24
  $excluded_pages = array_values($this->config->getExcludedPages());
25
 
26
- foreach ($excluded_pages as &$excluded_page)
27
  $excluded_page = $excluded_page['pages'];
 
28
 
29
- $pages = array();
30
 
31
- foreach ($ids as $key => $value)
32
- {
33
- if (in_array($value['value'], $excluded_pages))
34
  continue;
 
35
 
36
- $page_obj = array();
37
 
38
  $page_obj['slug'] = $value['value'];
39
  $page_obj['name'] = $value['label'];
40
 
 
41
  $page = Mage::getModel('cms/page');
 
42
  $page->setStoreId($storeId);
43
  $page->load($page_obj['slug'], 'identifier');
44
 
45
- if (! $page->getId())
46
  continue;
 
47
 
48
  $content = $page->getContent();
49
  if ($this->config->getRenderTemplateDirectives()) {
50
- $tmplProc = Mage::helper('cms')->getPageTemplateProcessor();
 
 
51
  $content = $tmplProc->filter($content);
52
  }
53
 
 
 
 
54
  $page_obj['objectID'] = $page->getId();
55
- $page_obj['url'] = Mage::helper('cms/page')->getPageUrl($page->getId());
56
  $page_obj['content'] = $this->strip($content);
57
 
58
  $pages[] = $page_obj;
9
 
10
  public function getIndexSettings($storeId)
11
  {
12
+ return [
13
+ 'attributesToIndex' => ['slug', 'name', 'unordered(content)'],
14
+ 'attributesToSnippet' => ['content:7'],
15
+ ];
16
  }
17
 
18
  public function getPages($storeId)
19
  {
20
+ /** @var Mage_Cms_Model_Page $cmsPage */
21
+ $cmsPage = Mage::getModel('cms/page');
22
+
23
+ /** @var Mage_Cms_Model_Resource_Page_Collection $magento_pages */
24
+ $magento_pages = $cmsPage->getCollection()->addStoreFilter($storeId)->addFieldToFilter('is_active', 1);
25
 
26
  $ids = $magento_pages->toOptionArray();
27
 
28
  $excluded_pages = array_values($this->config->getExcludedPages());
29
 
30
+ foreach ($excluded_pages as &$excluded_page) {
31
  $excluded_page = $excluded_page['pages'];
32
+ }
33
 
34
+ $pages = [];
35
 
36
+ foreach ($ids as $key => $value) {
37
+ if (in_array($value['value'], $excluded_pages)) {
 
38
  continue;
39
+ }
40
 
41
+ $page_obj = [];
42
 
43
  $page_obj['slug'] = $value['value'];
44
  $page_obj['name'] = $value['label'];
45
 
46
+ /** @var Mage_Cms_Model_Page $page */
47
  $page = Mage::getModel('cms/page');
48
+
49
  $page->setStoreId($storeId);
50
  $page->load($page_obj['slug'], 'identifier');
51
 
52
+ if (!$page->getId()) {
53
  continue;
54
+ }
55
 
56
  $content = $page->getContent();
57
  if ($this->config->getRenderTemplateDirectives()) {
58
+ /** @var Mage_Cms_Helper_Data $cms_helper */
59
+ $cms_helper = Mage::helper('cms');
60
+ $tmplProc = $cms_helper->getPageTemplateProcessor();
61
  $content = $tmplProc->filter($content);
62
  }
63
 
64
+ /** @var Mage_Cms_Helper_Page $cms_helper_page */
65
+ $cms_helper_page = Mage::helper('cms/page');
66
+
67
  $page_obj['objectID'] = $page->getId();
68
+ $page_obj['url'] = $cms_helper_page->getPageUrl($page->getId());
69
  $page_obj['content'] = $this->strip($content);
70
 
71
  $pages[] = $page_obj;
app/code/community/Algolia/Algoliasearch/Helper/Entity/Producthelper.php CHANGED
@@ -5,15 +5,16 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
5
  protected static $_productAttributes;
6
  protected static $_currencies;
7
 
8
- protected static $_predefinedProductAttributes = array(
9
  'name',
10
  'url_key',
11
  'description',
12
  'image',
13
  'small_image',
14
  'thumbnail',
15
- 'msrp_enabled' // NEEDED to handle msrp behavior
16
- );
 
17
 
18
  protected function getIndexNameSuffix()
19
  {
@@ -22,29 +23,42 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
22
 
23
  public function getAllAttributes($add_empty_row = false)
24
  {
25
- if (is_null(self::$_productAttributes))
26
- {
27
- self::$_productAttributes = array();
28
 
29
  /** @var $config Mage_Eav_Model_Config */
30
  $config = Mage::getSingleton('eav/config');
31
 
32
  $allAttributes = $config->getEntityAttributeCodes('catalog_product');
33
 
34
- $productAttributes = array_merge(array('name', 'path', 'categories', 'categories_without_path', 'description', 'ordered_qty', 'total_ordered', 'stock_qty', 'rating_summary', 'media_gallery'), $allAttributes);
 
 
 
 
 
 
 
 
 
 
 
35
 
36
  $excludedAttributes = $this->getExcludedAttributes();
37
 
38
  $productAttributes = array_diff($productAttributes, $excludedAttributes);
39
 
40
- foreach ($productAttributes as $attributeCode)
41
- self::$_productAttributes[$attributeCode] = $config->getAttribute('catalog_product', $attributeCode)->getFrontendLabel();
 
 
42
  }
43
 
44
  $attributes = self::$_productAttributes;
45
 
46
- if ($add_empty_row === true)
47
  $attributes[''] = '';
 
48
 
49
  uksort($attributes, function ($a, $b) {
50
  return strcmp($a, $b);
@@ -55,293 +69,396 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
55
 
56
  protected function getExcludedAttributes()
57
  {
58
- return array(
59
- 'all_children', 'available_sort_by', 'children', 'children_count', 'custom_apply_to_products',
60
- 'custom_design', 'custom_design_from', 'custom_design_to', 'custom_layout_update', 'custom_use_parent_settings',
61
- 'default_sort_by', 'display_mode', 'filter_price_range', 'global_position', 'image', 'include_in_menu', 'is_active',
62
- 'is_always_include_in_menu', 'is_anchor', 'landing_page', 'level', 'lower_cms_block',
63
- 'page_layout', 'path_in_store', 'position', 'small_image', 'thumbnail', 'url_key', 'url_path',
64
- 'visible_in_menu'
65
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  }
67
 
68
  public function isAttributeEnabled($additionalAttributes, $attr_name)
69
  {
70
- foreach ($additionalAttributes as $attr)
71
- if ($attr['attribute'] === $attr_name)
72
  return true;
 
 
73
 
74
  return false;
75
  }
76
 
77
- public function getProductCollectionQuery($storeId, $productIds = null, $only_visible = true)
78
  {
79
  /** @var $products Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */
80
  $products = Mage::getResourceModel('catalog/product_collection');
81
 
82
- $products = $products->setStoreId($storeId)
83
- ->addStoreFilter($storeId);
84
 
85
- if ($only_visible) {
86
- $products = $products->addAttributeToFilter('visibility', array('in' => Mage::getSingleton('catalog/product_visibility')->getVisibleInSiteIds()));
87
- $products = $products->addFinalPrice();
88
  }
89
 
 
 
 
90
 
91
- if (false === $this->config->getShowOutOfStock($storeId) && $only_visible == true) {
92
- Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($products);
93
  }
94
 
95
- $products = $products->addAttributeToSelect('special_from_date')
96
- ->addAttributeToSelect('special_to_date')
97
- ->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
 
 
 
98
 
99
- $additionalAttr = $this->config->getProductAdditionalAttributes($storeId);
 
 
 
 
100
 
101
- /** Map instead of foreach because otherwise it adds quotes to the last attribute **/
102
- $additionalAttr = array_map(function($attr) {
103
- return $attr['attribute'];
104
- }, $additionalAttr);
105
 
106
- $products = $products->addAttributeToSelect(array_values(array_merge(static::$_predefinedProductAttributes, $additionalAttr)));
 
 
 
107
 
108
- if ($productIds && count($productIds) > 0)
109
- $products = $products->addAttributeToFilter('entity_id', array('in' => $productIds));
110
 
111
- Mage::dispatchEvent('algolia_rebuild_store_product_index_collection_load_before', array('store' => $storeId, 'collection' => $products));
 
 
 
 
 
 
 
 
 
 
112
 
113
  return $products;
114
  }
115
 
116
- public function setSettings($storeId)
117
  {
118
- $attributesToIndex = array();
119
- $unretrievableAttributes = array();
120
- $attributesForFaceting = array();
121
-
122
- foreach ($this->config->getProductAdditionalAttributes($storeId) as $attribute)
123
- {
124
- if ($attribute['searchable'] == '1')
125
- {
126
- if ($attribute['order'] == 'ordered')
127
  $attributesToIndex[] = $attribute['attribute'];
128
- else
129
  $attributesToIndex[] = 'unordered('.$attribute['attribute'].')';
 
130
  }
131
 
132
- if ($attribute['retrievable'] != '1')
133
  $unretrievableAttributes[] = $attribute['attribute'];
 
134
 
135
- if ($attribute['attribute'] == 'categories')
136
- {
137
  $attributesToIndex[] = $attribute['order'] == 'ordered' ? 'categories_without_path' : 'unordered(categories_without_path)';
138
  }
139
  }
140
 
141
  $customRankings = $this->config->getProductCustomRanking($storeId);
142
 
143
- $customRankingsArr = array();
144
 
145
  $facets = $this->config->getFacets();
146
 
147
- $currencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
 
 
148
 
149
- foreach($facets as $facet)
150
- {
151
- if ($facet['attribute'] === 'price')
152
- {
153
- foreach ($currencies as $currency_code)
154
- {
155
  $facet['attribute'] = 'price.'.$currency_code.'.default';
156
 
157
- if ($this->config->isCustomerGroupsEnabled($storeId))
158
- {
159
- foreach ($groups = Mage::getModel('customer/group')->getCollection() as $group)
160
- {
161
- $group_id = (int)$group->getData('customer_group_id');
162
 
163
- $attributesForFaceting[] = 'price.'.$currency_code.'.group_' . $group_id;
164
  }
165
  }
166
 
167
  $attributesForFaceting[] = $facet['attribute'];
168
  }
169
- }
170
- else
171
- {
172
  $attributesForFaceting[] = $facet['attribute'];
173
  }
174
-
175
  }
176
 
 
 
 
177
 
178
- foreach ($customRankings as $ranking)
179
- $customRankingsArr[] = $ranking['order'] . '(' . $ranking['attribute'] . ')';
180
-
181
-
182
- $indexSettings = array(
183
- 'attributesToIndex' => array_values(array_unique($attributesToIndex)),
184
- 'customRanking' => $customRankingsArr,
185
- 'unretrievableAttributes' => $unretrievableAttributes,
186
- 'attributesForFaceting' => $attributesForFaceting,
187
- 'maxValuesPerFacet' => (int) $this->config->getMaxValuesPerFacet($storeId),
188
- 'removeWordsIfNoResults' => $this->config->getRemoveWordsIfNoResult($storeId)
189
- );
190
 
191
  // Additional index settings from event observer
192
  $transport = new Varien_Object($indexSettings);
193
- Mage::dispatchEvent('algolia_index_settings_prepare', array('store_id' => $storeId, 'index_settings' => $transport));
 
194
  $indexSettings = $transport->getData();
195
 
196
- $mergeSettings = $this->algolia_helper->mergeSettings($this->getIndexName($storeId), $indexSettings);
197
 
198
- $this->algolia_helper->setSettings($this->getIndexName($storeId), $mergeSettings);
199
 
200
- /**
 
 
 
 
 
201
  * Handle Slaves
202
  */
203
  $sorting_indices = $this->config->getSortingIndices();
204
 
205
- if (count($sorting_indices) > 0)
206
- {
207
- $slaves = array();
208
 
209
- foreach ($sorting_indices as $values)
210
- {
211
- if ($this->config->isCustomerGroupsEnabled($storeId) && $values['attribute'] === 'price')
212
- {
213
- foreach ($groups = Mage::getModel('customer/group')->getCollection() as $group)
214
- {
215
  $group_id = (int) $group->getData('customer_group_id');
216
-
217
  $suffix_index_name = 'group_'.$group_id;
218
-
219
  $slaves[] = $this->getIndexName($storeId).'_'.$values['attribute'].'_'.$suffix_index_name.'_'.$values['sort'];
220
  }
221
- }
222
- else
223
- {
224
- if ($values['attribute'] === 'price')
225
- $slaves[] = $this->getIndexName($storeId) . '_' .$values['attribute']. '_default_' . $values['sort'];
226
- else
227
- $slaves[] = $this->getIndexName($storeId) . '_' .$values['attribute']. '_' . $values['sort'];
228
  }
229
  }
230
 
231
- $this->algolia_helper->setSettings($this->getIndexName($storeId), array('slaves' => $slaves));
232
 
233
- foreach ($sorting_indices as $values)
234
- {
235
- if ($this->config->isCustomerGroupsEnabled($storeId) && $values['attribute'] === 'price')
236
- {
237
- foreach ($groups = Mage::getModel('customer/group')->getCollection() as $group)
238
- {
239
- $group_id = (int)$group->getData('customer_group_id');
240
-
241
- $suffix_index_name = 'group_' . $group_id;
242
-
243
- $sort_attribute = $values['attribute'] === 'price' ? $values['attribute'] . '.' . $currencies[0] . '.' . $suffix_index_name : $values['attribute'];
244
 
245
- $mergeSettings['ranking'] = array($values['sort'] . '(' . $sort_attribute . ')', 'typo', 'geo', 'words', 'proximity', 'attribute', 'exact', 'custom');
246
 
247
- $this->algolia_helper->setSettings($this->getIndexName($storeId) . '_' . $values['attribute'] . '_' . $suffix_index_name . '_' . $values['sort'], $mergeSettings);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
  }
249
  }
250
- else
251
- {
252
- $sort_attribute = $values['attribute'] === 'price' ? $values['attribute'] . '.' . $currencies[0] . '.' . 'default' : $values['attribute'];
253
 
254
- $mergeSettings['ranking'] = array($values['sort'] . '(' . $sort_attribute . ')', 'typo', 'geo', 'words', 'proximity', 'attribute', 'exact', 'custom');
 
 
 
 
 
 
 
 
 
 
 
 
255
 
256
- if ($values['attribute'] === 'price')
257
- $this->algolia_helper->setSettings($this->getIndexName($storeId) . '_' . $values['attribute'] . '_default_' . $values['sort'], $mergeSettings);
258
- else
259
- $this->algolia_helper->setSettings($this->getIndexName($storeId) . '_' . $values['attribute'] . '_' . $values['sort'], $mergeSettings);
260
- }
 
 
 
261
  }
262
  }
 
 
263
  }
264
 
265
  protected function getFields($store)
266
  {
 
267
  $tax_helper = Mage::helper('tax');
268
 
269
- if ($tax_helper->getPriceDisplayType($store) == Mage_Tax_Model_Config::DISPLAY_TYPE_EXCLUDING_TAX)
270
- return array('price' => false);
 
271
 
272
- if ($tax_helper->getPriceDisplayType($store) == Mage_Tax_Model_Config::DISPLAY_TYPE_INCLUDING_TAX)
273
- return array('price' => true);
 
274
 
275
- return array('price' => false, 'price_with_tax' => true);
276
  }
277
 
278
  protected function formatPrice($price, $includeContainer, $currency_code)
279
  {
280
- if (!isset(static::$_currencies[$currency_code]))
281
- {
282
- static::$_currencies[$currency_code] = Mage::getModel('directory/currency')->load($currency_code);
 
 
283
  }
284
 
 
285
  $currency = static::$_currencies[$currency_code];
286
 
287
  if ($currency) {
288
- return $currency->format($price, array(), $includeContainer);
289
  }
 
290
  return $price;
291
  }
292
 
293
- protected function handlePrice(&$product, $sub_products, &$customData)
294
  {
295
- $fields = $this->getFields($product->getStore());
296
- $customer_groups_enabled = $this->config->isCustomerGroupsEnabled($product->getStoreId());
297
- $store = $product->getStore();
298
- $type = $this->config->getMappedProductType($product->getTypeId());
299
- $currencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
300
- $baseCurrencyCode = $store->getBaseCurrencyCode();
 
 
 
 
301
 
302
- $groups = array();
303
 
304
- if ($customer_groups_enabled)
305
  $groups = Mage::getModel('customer/group')->getCollection();
 
 
 
 
306
 
307
- foreach ($fields as $field => $with_tax)
308
- {
309
- $customData[$field] = array();
310
 
311
- foreach ($currencies as $currency_code)
312
- {
313
- $customData[$field][$currency_code] = array();
314
 
315
- $price = (double) Mage::helper('tax')->getPrice($product, $product->getPrice(), $with_tax, null, null, null, $product->getStore(), null);
316
- $price = Mage::helper('directory')->currencyConvert($price, $baseCurrencyCode, $currency_code);
317
 
 
 
318
 
319
  $customData[$field][$currency_code]['default'] = $price;
320
  $customData[$field][$currency_code]['default_formated'] = $this->formatPrice($price, false, $currency_code);
321
 
322
- $special_price = (double) Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), $with_tax, null, null, null, $product->getStore(), null);
323
- $special_price = Mage::helper('directory')->currencyConvert($special_price, $baseCurrencyCode, $currency_code);
 
 
 
324
 
325
- if ($customer_groups_enabled) // If fetch special price for groups
326
- {
327
- foreach ($groups as $group)
328
- {
329
- $group_id = (int)$group->getData('customer_group_id');
330
  $product->setCustomerGroupId($group_id);
331
 
332
  $discounted_price = $product->getPriceModel()->getFinalPrice(1, $product);
333
- $discounted_price = Mage::helper('directory')->currencyConvert($discounted_price, $baseCurrencyCode, $currency_code);
334
-
335
- if ($discounted_price !== false)
336
- {
337
- $customData[$field][$currency_code]['group_' . $group_id] = (double) Mage::helper('tax')->getPrice($product, $discounted_price, $with_tax, null, null, null, $product->getStore(), null);
338
- $customData[$field][$currency_code]['group_' . $group_id] = Mage::helper('directory')->currencyConvert($customData[$field][$currency_code]['group_' . $group_id], $baseCurrencyCode, $currency_code);
339
- $customData[$field][$currency_code]['group_' . $group_id . '_formated'] = $store->formatPrice($customData[$field][$currency_code]['group_' . $group_id], false, $currency_code);
340
- }
341
- else
342
- {
343
- $customData[$field][$currency_code]['group_' . $group_id] = $customData[$field][$currency_code]['default'];
344
- $customData[$field][$currency_code]['group_' . $group_id . '_formated'] = $customData[$field][$currency_code]['default_formated'];
 
 
 
 
 
345
  }
346
  }
347
 
@@ -351,39 +468,33 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
351
  $customData[$field][$currency_code]['special_from_date'] = strtotime($product->getSpecialFromDate());
352
  $customData[$field][$currency_code]['special_to_date'] = strtotime($product->getSpecialToDate());
353
 
354
- if ($customer_groups_enabled)
355
- {
356
- foreach ($groups as $group)
357
- {
358
- $group_id = (int)$group->getData('customer_group_id');
359
 
360
- if ($special_price && $special_price < $customData[$field][$currency_code]['group_' . $group_id])
361
- {
362
- $customData[$field][$currency_code]['group_' . $group_id . '_original_formated'] = $customData[$field][$currency_code]['default_formated'];
363
 
364
- $customData[$field][$currency_code]['group_' . $group_id] = $special_price;
365
- $customData[$field][$currency_code]['group_' . $group_id . '_formated'] = $this->formatPrice($special_price, false, $currency_code);
 
366
  }
367
  }
368
- }
369
- else
370
- {
371
- if ($special_price && $special_price < $customData[$field][$currency_code]['default'])
372
- {
373
  $customData[$field][$currency_code]['default_original_formated'] = $customData[$field][$currency_code]['default_formated'];
374
 
375
  $customData[$field][$currency_code]['default'] = $special_price;
376
- $customData[$field][$currency_code]['default_formated'] = $this->formatPrice($special_price, false, $currency_code);
 
377
  }
378
  }
379
 
380
- if ($type == 'grouped' || $type == 'bundle')
381
- {
382
  $min = PHP_INT_MAX;
383
  $max = 0;
384
 
385
- if ($type == 'bundle')
386
- {
387
  $_priceModel = $product->getPriceModel();
388
 
389
  list($min, $max) = $_priceModel->getTotalPrices($product, null, $with_tax, true);
@@ -391,33 +502,28 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
391
  $max = (double) $max;
392
  }
393
 
394
- if ($type == 'grouped')
395
- {
396
- if (count($sub_products) > 0)
397
- {
398
- foreach ($sub_products as $sub_product)
399
- {
400
- $price = (double) Mage::helper('tax')->getPrice($product, $sub_product->getFinalPrice(), $with_tax, null, null, null, $product->getStore(), null);
401
 
402
  $min = min($min, $price);
403
  $max = max($max, $price);
404
  }
405
- }
406
- else
407
- $min = $max; // avoid to have PHP_INT_MAX in case of no subproducts (Corner case of visibility and stock options)
408
  }
409
 
 
 
 
410
 
411
- if ($min != $max)
412
- {
413
- $min = Mage::helper('directory')->currencyConvert($min, $baseCurrencyCode, $currency_code);
414
- $max = Mage::helper('directory')->currencyConvert($max, $baseCurrencyCode, $currency_code);
415
-
416
- $dashed_format = $this->formatPrice($min, false, $currency_code) . ' - ' . $this->formatPrice($max, false, $currency_code);
417
-
418
- if (isset($customData[$field][$currency_code]['default_original_formated']) === false || $min <= $customData[$field][$currency_code]['default'])
419
- {
420
 
 
421
  $customData[$field][$currency_code]['default_formated'] = $dashed_format;
422
 
423
  //// Do not keep special price that is already taken into account in min max
@@ -428,46 +534,40 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
428
  $customData[$field][$currency_code]['default'] = 0; // will be reset just after
429
  }
430
 
431
- if ($customer_groups_enabled)
432
- {
433
- foreach ($groups as $group)
434
- {
435
- $group_id = (int)$group->getData('customer_group_id');
436
 
437
- if ($min != $max && $min <= $customData[$field][$currency_code]['group_' . $group_id])
438
- {
439
- $customData[$field][$currency_code]['group_' . $group_id] = 0;
440
- }
441
- else
442
- {
443
- $customData[$field][$currency_code]['group_' . $group_id] = $customData[$field][$currency_code]['default'];
444
  }
445
 
446
- $customData[$field][$currency_code]['group_' . $group_id . '_formated'] = $dashed_format;
447
  }
448
  }
449
  }
450
 
451
- if ($customData[$field][$currency_code]['default'] == 0)
452
- {
453
  $customData[$field][$currency_code]['default'] = $min;
454
 
455
- if ($min === $max)
456
- $customData[$field][$currency_code]['default_formated'] = $this->formatPrice($min, false, $currency_code);
 
 
457
  }
458
 
459
- if ($customer_groups_enabled)
460
- {
461
- foreach ($groups as $group)
462
- {
463
- $group_id = (int)$group->getData('customer_group_id');
464
 
465
- if ($customData[$field][$currency_code]['group_' . $group_id] == 0)
466
- {
467
- $customData[$field][$currency_code]['group_' . $group_id] = $min;
468
 
469
- if ($min === $max)
470
- $customData[$field][$currency_code]['group_' . $group_id . '_formated'] = $customData[$field][$currency_code]['default_formated'];
 
471
  }
472
  }
473
  }
@@ -476,172 +576,178 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
476
  }
477
  }
478
 
479
- protected function getValueOrValueText(Mage_Catalog_Model_Product $product, $name, $resource)
480
  {
481
  $value_text = $product->getAttributeText($name);
482
  if (!$value_text) {
483
  $value_text = $resource->getFrontend()->getValue($product);
484
  }
 
485
  return $value_text;
486
  }
487
 
488
  public function getObject(Mage_Catalog_Model_Product $product)
489
  {
490
  $type = $this->config->getMappedProductType($product->getTypeId());
491
- $this->logger->start('CREATE RECORD '.$product->getId(). ' '.$this->logger->getStoreName($product->storeId));
492
- $this->logger->log('Product type ('.$product->getTypeId().', mapped to: ' . $type . ')');
493
- $defaultData = array();
494
 
495
- $transport = new Varien_Object($defaultData);
496
 
497
- Mage::dispatchEvent('algolia_product_index_before', array('product' => $product, 'custom_data' => $transport));
498
 
499
- $defaultData = $transport->getData();
500
 
501
- $defaultData = is_array($defaultData) ? $defaultData : explode("|",$defaultData);
502
 
503
  $visibility = (int) $product->getVisibility();
504
 
505
- $visibleInCatalog = Mage::getSingleton('catalog/product_visibility')->getVisibleInCatalogIds();
506
- $visibleInSearch = Mage::getSingleton('catalog/product_visibility')->getVisibleInSearchIds();
 
 
507
 
508
- $customData = array(
509
- 'objectID' => $product->getId(),
510
- 'name' => $product->getName(),
511
- 'url' => $product->getProductUrl(),
512
  'visibility_search' => (int) (in_array($visibility, $visibleInSearch)),
513
- 'visibility_catalog' => (int) (in_array($visibility, $visibleInCatalog))
514
- );
515
 
516
  $additionalAttributes = $this->config->getProductAdditionalAttributes($product->getStoreId());
517
  $groups = null;
518
 
519
- if ($this->isAttributeEnabled($additionalAttributes, 'description'))
520
  $customData['description'] = $product->getDescription();
 
521
 
522
- $categories = array();
523
- $categories_with_path = array();
524
 
525
  $_categoryIds = $product->getCategoryIds();
526
 
527
- if (is_array($_categoryIds) && count($_categoryIds) > 0)
528
- {
529
- $categoryCollection = Mage::getResourceModel('catalog/category_collection')
530
- ->addAttributeToSelect('name')
531
- ->addAttributeToFilter('entity_id', $_categoryIds)
532
- ->addFieldToFilter('level', array('gt' => 1))
533
- ->addIsActiveFilter();
 
534
 
535
  $rootCat = Mage::app()->getStore($product->getStoreId())->getRootCategoryId();
536
 
537
- foreach ($categoryCollection as $category)
538
- {
539
  // Check and skip all categories that is not
540
  // in the path of the current store.
541
  $path = $category->getPath();
542
- $path_parts = explode("/",$path);
543
  if (isset($path_parts[1]) && $path_parts[1] != $rootCat) {
544
  continue;
545
  }
546
-
547
  $categoryName = $category->getName();
548
 
549
- if ($categoryName)
550
  $categories[] = $categoryName;
 
551
 
552
  $category->getUrlInstance()->setStore($product->getStoreId());
553
- $path = array();
554
 
555
- foreach ($category->getPathIds() as $treeCategoryId)
556
- {
557
  $name = $this->getCategoryName($treeCategoryId, $product->getStoreId());
558
- if ($name)
559
  $path[] = $name;
 
560
  }
561
 
562
  $categories_with_path[] = $path;
563
  }
564
  }
565
 
566
- foreach ($categories_with_path as $result)
567
- {
568
- for ($i = count($result) - 1; $i > 0; $i--)
569
- {
570
  $categories_with_path[] = array_slice($result, 0, $i);
571
  }
572
  }
573
 
574
- $categories_with_path = array_intersect_key($categories_with_path, array_unique(array_map('serialize', $categories_with_path)));
 
575
 
576
- $categories_hierarchical = array();
577
 
578
  $level_name = 'level';
579
 
580
- foreach ($categories_with_path as $category)
581
- {
582
- for ($i = 0; $i < count($category); $i++)
583
- {
584
- if (isset($categories_hierarchical[$level_name.$i]) === false)
585
- $categories_hierarchical[$level_name.$i] = array();
586
 
587
  $categories_hierarchical[$level_name.$i][] = implode(' /// ', array_slice($category, 0, $i + 1));
588
  }
589
  }
590
 
591
- foreach ($categories_hierarchical as &$level)
592
- {
593
  $level = array_values(array_unique($level));
594
  }
595
 
596
- foreach ($categories_with_path as &$category)
597
- $category = implode(' /// ',$category);
 
598
 
599
  $customData['categories'] = $categories_hierarchical;
600
 
601
  $customData['categories_without_path'] = $categories;
602
 
603
- if (false === isset($defaultData['thumbnail_url']))
604
- {
605
- $thumb = Mage::helper('algoliasearch/image')->init($product, 'thumbnail')->resize(75, 75);
 
 
 
606
 
607
- try
608
- {
609
  $customData['thumbnail_url'] = $thumb->toString();
610
- }
611
- catch (\Exception $e)
612
- {
613
  $this->logger->log($e->getMessage());
614
  $this->logger->log($e->getTraceAsString());
615
 
616
- $customData['thumbnail_url'] = str_replace(array('https://', 'http://'), '//', Mage::getDesign()->getSkinUrl($thumb->getPlaceholder()));
 
 
 
617
  }
618
  }
619
 
620
- if (false === isset($defaultData['image_url']))
621
- {
622
- $image = Mage::helper('algoliasearch/image')->init($product, $this->config->getImageType())->resize($this->config->getImageWidth(), $this->config->getImageHeight());
 
623
 
624
- try
625
- {
626
  $customData['image_url'] = $image->toString();
627
- }
628
- catch (\Exception $e)
629
- {
630
  $this->logger->log($e->getMessage());
631
  $this->logger->log($e->getTraceAsString());
632
 
633
- $customData['image_url'] = str_replace(array('https://', 'http://'), '//', Mage::getDesign()->getSkinUrl($image->getPlaceholder()));
 
 
 
634
  }
635
 
636
- if ($this->isAttributeEnabled($additionalAttributes, 'media_gallery'))
637
- {
638
  $product->load('media_gallery');
639
 
640
- $customData['media_gallery'] = array();
641
 
642
- foreach ($product->getMediaGalleryImages() as $image)
643
- {
644
- $customData['media_gallery'][] = str_replace(array('https://', 'http://'), '//', $image->getUrl());
645
  }
646
  }
647
  }
@@ -649,133 +755,138 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
649
  $sub_products = null;
650
  $ids = null;
651
 
652
- if ($type == 'configurable' || $type == 'grouped' || $type == 'bundle')
653
- {
654
- if ($type == 'bundle')
655
- {
656
- $ids = array();
657
 
658
- $selection = $product->getTypeInstance(true)->getSelectionsCollection($product->getTypeInstance(true)->getOptionsIds($product), $product);
 
 
659
 
660
- foreach ($selection as $option)
661
  $ids[] = $option->product_id;
 
662
  }
663
 
664
- if ($type == 'configurable' || $type == 'grouped')
665
- {
666
  $ids = $product->getTypeInstance(true)->getChildrenIds($product->getId());
667
  $ids = call_user_func_array('array_merge', $ids);
668
  }
669
 
670
- if (count($ids))
671
- {
672
- $sub_products = $this->getProductCollectionQuery($product->getStoreId(), $ids, false)->load();
673
- }
674
- else
675
- {
676
- $sub_products = array();
677
  }
678
  }
679
 
680
- if (false === isset($defaultData['in_stock']))
681
- {
682
  $stockItem = $product->getStockItem();
683
 
684
  $customData['in_stock'] = (int) $stockItem->getIsInStock();
685
  }
686
 
687
  // skip default calculation if we have provided these attributes via the observer in $defaultData
688
- if (false === isset($defaultData['ordered_qty']) && $this->isAttributeEnabled($additionalAttributes, 'ordered_qty'))
 
 
689
  $customData['ordered_qty'] = (int) $product->getOrderedQty();
 
690
 
691
- if (false === isset($defaultData['total_ordered']) && $this->isAttributeEnabled($additionalAttributes, 'total_ordered'))
 
 
692
  $customData['total_ordered'] = (int) $product->getTotalOrdered();
 
693
 
694
- if (false === isset($defaultData['stock_qty']) && $this->isAttributeEnabled($additionalAttributes, 'stock_qty'))
 
 
695
  $customData['stock_qty'] = (int) $product->getStockQty();
 
696
 
697
- if (Mage::helper('core')->isModuleEnabled('Mage_Review'))
698
- if ($this->isAttributeEnabled($additionalAttributes, 'rating_summary'))
699
- $customData['rating_summary'] = (int) $product->getRatingSummary();
 
 
700
 
701
- foreach ($additionalAttributes as $attribute)
702
- {
703
  $attribute_name = $attribute['attribute'];
704
- if (isset($customData[$attribute_name]))
705
  continue;
 
706
 
707
  $value = $product->getData($attribute_name);
708
 
 
709
  $attribute_resource = $product->getResource()->getAttribute($attribute_name);
710
 
711
- if ($attribute_resource)
712
- {
713
  $attribute_resource->setStoreId($product->getStoreId());
714
 
715
- if ($value === null || 'sku' == $attribute_name)
716
- {
717
- /** Get values as array in children */
718
- if ($type == 'configurable' || $type == 'grouped' || $type == 'bundle')
719
- {
720
- if ($value === null) {
721
- $values = array();
722
- } else {
723
- $values = array($this->getValueOrValueText($product, $attribute_name, $attribute_resource));
724
- }
725
 
726
- $all_sub_products_out_of_stock = true;
727
 
728
- foreach ($sub_products as $sub_product)
729
- {
730
- $isInStock = (int) $sub_product->getStockItem()->getIsInStock();
731
 
732
- if ($isInStock == false && $this->config->indexOutOfStockOptions($product->getStoreId()) == false)
733
- continue;
 
734
 
735
- $all_sub_products_out_of_stock = false;
736
 
737
- $value = $sub_product->getData($attribute_name);
738
 
739
- if ($value)
740
- {
741
- $values[] = $this->getValueOrValueText($sub_product, $attribute_name, $attribute_resource);
742
- }
743
  }
 
744
 
745
- if (is_array($values) && count($values) > 0)
746
- {
747
- $customData[$attribute_name] = array_values(array_unique($values));
748
- }
749
 
750
- if ($customData['in_stock'] && $all_sub_products_out_of_stock) {
751
- // Set main product out of stock if all
752
- // sub-products is out of stock.
753
- $customData['in_stock'] = 0;
754
- }
755
  }
756
- }
757
- else
758
- {
759
  $value = $this->getValueOrValueText($product, $attribute_name, $attribute_resource);
 
760
 
761
- if ($value)
762
- {
763
- $customData[$attribute_name] = $value;
764
- }
765
  }
766
  }
767
  }
768
 
 
 
769
 
770
- $msrpEnabled = method_exists(Mage::helper('catalog'), 'canApplyMsrp') ? (bool) Mage::helper('catalog')->canApplyMsrp($product): false;
771
-
772
- if (false === $msrpEnabled)
773
  $this->handlePrice($product, $sub_products, $customData);
774
- else
775
  unset($customData['price']);
 
776
 
777
  $transport = new Varien_Object($customData);
778
- Mage::dispatchEvent('algolia_subproducts_index', array('custom_data' => $transport, 'sub_products' => $sub_products));
 
779
  $customData = $transport->getData();
780
 
781
  $customData = array_merge($customData, $defaultData);
@@ -784,8 +895,23 @@ class Algolia_Algoliasearch_Helper_Entity_Producthelper extends Algolia_Algolias
784
 
785
  $this->castProductObject($customData);
786
 
787
- $this->logger->stop('CREATE RECORD '.$product->getId(). ' '.$this->logger->getStoreName($product->storeId));
788
 
789
  return $customData;
790
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
791
  }
5
  protected static $_productAttributes;
6
  protected static $_currencies;
7
 
8
+ protected static $_predefinedProductAttributes = [
9
  'name',
10
  'url_key',
11
  'description',
12
  'image',
13
  'small_image',
14
  'thumbnail',
15
+ 'msrp_enabled', // NEEDED to handle msrp behavior
16
+ 'tax_class_id', // Needed for tax calculation
17
+ ];
18
 
19
  protected function getIndexNameSuffix()
20
  {
23
 
24
  public function getAllAttributes($add_empty_row = false)
25
  {
26
+ if (is_null(self::$_productAttributes)) {
27
+ self::$_productAttributes = [];
 
28
 
29
  /** @var $config Mage_Eav_Model_Config */
30
  $config = Mage::getSingleton('eav/config');
31
 
32
  $allAttributes = $config->getEntityAttributeCodes('catalog_product');
33
 
34
+ $productAttributes = array_merge([
35
+ 'name',
36
+ 'path',
37
+ 'categories',
38
+ 'categories_without_path',
39
+ 'description',
40
+ 'ordered_qty',
41
+ 'total_ordered',
42
+ 'stock_qty',
43
+ 'rating_summary',
44
+ 'media_gallery',
45
+ ], $allAttributes);
46
 
47
  $excludedAttributes = $this->getExcludedAttributes();
48
 
49
  $productAttributes = array_diff($productAttributes, $excludedAttributes);
50
 
51
+ foreach ($productAttributes as $attributeCode) {
52
+ self::$_productAttributes[$attributeCode] = $config->getAttribute('catalog_product', $attributeCode)
53
+ ->getFrontendLabel();
54
+ }
55
  }
56
 
57
  $attributes = self::$_productAttributes;
58
 
59
+ if ($add_empty_row === true) {
60
  $attributes[''] = '';
61
+ }
62
 
63
  uksort($attributes, function ($a, $b) {
64
  return strcmp($a, $b);
69
 
70
  protected function getExcludedAttributes()
71
  {
72
+ return [
73
+ 'all_children',
74
+ 'available_sort_by',
75
+ 'children',
76
+ 'children_count',
77
+ 'custom_apply_to_products',
78
+ 'custom_design',
79
+ 'custom_design_from',
80
+ 'custom_design_to',
81
+ 'custom_layout_update',
82
+ 'custom_use_parent_settings',
83
+ 'default_sort_by',
84
+ 'display_mode',
85
+ 'filter_price_range',
86
+ 'global_position',
87
+ 'image',
88
+ 'include_in_menu',
89
+ 'is_active',
90
+ 'is_always_include_in_menu',
91
+ 'is_anchor',
92
+ 'landing_page',
93
+ 'level',
94
+ 'lower_cms_block',
95
+ 'page_layout',
96
+ 'path_in_store',
97
+ 'position',
98
+ 'small_image',
99
+ 'thumbnail',
100
+ 'url_key',
101
+ 'url_path',
102
+ 'visible_in_menu',
103
+ ];
104
  }
105
 
106
  public function isAttributeEnabled($additionalAttributes, $attr_name)
107
  {
108
+ foreach ($additionalAttributes as $attr) {
109
+ if ($attr['attribute'] === $attr_name) {
110
  return true;
111
+ }
112
+ }
113
 
114
  return false;
115
  }
116
 
117
+ public function getProductCollectionQuery($storeId, $productIds = null, $only_visible = true, $withoutData = false)
118
  {
119
  /** @var $products Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */
120
  $products = Mage::getResourceModel('catalog/product_collection');
121
 
122
+ $products = $products->setStoreId($storeId);
123
+ $products = $products->addStoreFilter($storeId);
124
 
125
+ if ($productIds && count($productIds) > 0) {
126
+ $products = $products->addAttributeToFilter('entity_id', ['in' => $productIds]);
 
127
  }
128
 
129
+ if ($only_visible) {
130
+ /** @var Mage_Catalog_Model_Product_Visibility $catalog_productVisibility */
131
+ $catalog_productVisibility = Mage::getSingleton('catalog/product_visibility');
132
 
133
+ $products = $products->addAttributeToFilter('visibility', ['in' => $catalog_productVisibility->getVisibleInSiteIds()]);
134
+ $products = $products->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED);
135
  }
136
 
137
+ if ($withoutData === false) {
138
+ if (false === $this->config->getShowOutOfStock($storeId) && $only_visible == true) {
139
+ /** @var Mage_CatalogInventory_Model_Stock $catalogInventory_stock */
140
+ $catalogInventory_stock = Mage::getSingleton('cataloginventory/stock');
141
+ $catalogInventory_stock->addInStockFilterToCollection($products);
142
+ }
143
 
144
+ $products = $products
145
+ ->addAttributeToSelect('special_from_date')
146
+ ->addAttributeToSelect('special_to_date')
147
+ ->addAttributeToSelect('visibility')
148
+ ->addAttributeToSelect('status');
149
 
150
+ $additionalAttr = $this->config->getProductAdditionalAttributes($storeId);
 
 
 
151
 
152
+ /* Map instead of foreach because otherwise it adds quotes to the last attribute **/
153
+ $additionalAttr = array_map(function ($attr) {
154
+ return $attr['attribute'];
155
+ }, $additionalAttr);
156
 
157
+ $products = $products->addAttributeToSelect(array_values(array_merge(static::$_predefinedProductAttributes,
158
+ $additionalAttr)));
159
 
160
+ $products->addFinalPrice();
161
+
162
+ if ($only_visible === false) {
163
+ $fromPart = $products->getSelect()->getPart(Varien_Db_Select::FROM);
164
+ $fromPart['price_index']['joinType'] = 'left join';
165
+ $products->getSelect()->setPart(Varien_Db_Select::FROM, $fromPart);
166
+ }
167
+ }
168
+
169
+ Mage::dispatchEvent('algolia_rebuild_store_product_index_collection_load_before',
170
+ ['store' => $storeId, 'collection' => $products]);
171
 
172
  return $products;
173
  }
174
 
175
+ public function setSettings($storeId, $saveToTmpIndicesToo = false)
176
  {
177
+ $attributesToIndex = [];
178
+ $unretrievableAttributes = [];
179
+ $attributesForFaceting = [];
180
+
181
+ foreach ($this->config->getProductAdditionalAttributes($storeId) as $attribute) {
182
+ if ($attribute['searchable'] == '1') {
183
+ if ($attribute['order'] == 'ordered') {
 
 
184
  $attributesToIndex[] = $attribute['attribute'];
185
+ } else {
186
  $attributesToIndex[] = 'unordered('.$attribute['attribute'].')';
187
+ }
188
  }
189
 
190
+ if ($attribute['retrievable'] != '1') {
191
  $unretrievableAttributes[] = $attribute['attribute'];
192
+ }
193
 
194
+ if ($attribute['attribute'] == 'categories') {
 
195
  $attributesToIndex[] = $attribute['order'] == 'ordered' ? 'categories_without_path' : 'unordered(categories_without_path)';
196
  }
197
  }
198
 
199
  $customRankings = $this->config->getProductCustomRanking($storeId);
200
 
201
+ $customRankingsArr = [];
202
 
203
  $facets = $this->config->getFacets();
204
 
205
+ /** @var Mage_Directory_Model_Currency $directoryCurrency */
206
+ $directoryCurrency = Mage::getModel('directory/currency');
207
+ $currencies = $directoryCurrency->getConfigAllowCurrencies();
208
 
209
+ foreach ($facets as $facet) {
210
+ if ($facet['attribute'] === 'price') {
211
+ foreach ($currencies as $currency_code) {
 
 
 
212
  $facet['attribute'] = 'price.'.$currency_code.'.default';
213
 
214
+ if ($this->config->isCustomerGroupsEnabled($storeId)) {
215
+ /** @var Mage_Customer_Model_Group $group */
216
+ foreach ($groups = Mage::getModel('customer/group')->getCollection() as $group) {
217
+ $group_id = (int) $group->getData('customer_group_id');
 
218
 
219
+ $attributesForFaceting[] = 'price.'.$currency_code.'.group_'.$group_id;
220
  }
221
  }
222
 
223
  $attributesForFaceting[] = $facet['attribute'];
224
  }
225
+ } else {
 
 
226
  $attributesForFaceting[] = $facet['attribute'];
227
  }
 
228
  }
229
 
230
+ foreach ($customRankings as $ranking) {
231
+ $customRankingsArr[] = $ranking['order'].'('.$ranking['attribute'].')';
232
+ }
233
 
234
+ $indexSettings = [
235
+ 'attributesToIndex' => array_values(array_unique($attributesToIndex)),
236
+ 'customRanking' => $customRankingsArr,
237
+ 'unretrievableAttributes' => $unretrievableAttributes,
238
+ 'attributesForFaceting' => $attributesForFaceting,
239
+ 'maxValuesPerFacet' => (int) $this->config->getMaxValuesPerFacet($storeId),
240
+ 'removeWordsIfNoResults' => $this->config->getRemoveWordsIfNoResult($storeId),
241
+ ];
 
 
 
 
242
 
243
  // Additional index settings from event observer
244
  $transport = new Varien_Object($indexSettings);
245
+ Mage::dispatchEvent('algolia_index_settings_prepare', ['store_id' => $storeId, 'index_settings' => $transport]);
246
+
247
  $indexSettings = $transport->getData();
248
 
249
+ $indexName = $this->getIndexName($storeId);
250
 
251
+ $mergeSettings = $this->algolia_helper->mergeSettings($indexName, $indexSettings);
252
 
253
+ $this->algolia_helper->setSettings($indexName, $mergeSettings);
254
+ if ($saveToTmpIndicesToo === true) {
255
+ $this->algolia_helper->setSettings($indexName.'_tmp', $mergeSettings);
256
+ }
257
+
258
+ /*
259
  * Handle Slaves
260
  */
261
  $sorting_indices = $this->config->getSortingIndices();
262
 
263
+ if (count($sorting_indices) > 0) {
264
+ $slaves = [];
 
265
 
266
+ foreach ($sorting_indices as $values) {
267
+ if ($this->config->isCustomerGroupsEnabled($storeId) && $values['attribute'] === 'price') {
268
+ foreach ($groups = Mage::getModel('customer/group')->getCollection() as $group) {
 
 
 
269
  $group_id = (int) $group->getData('customer_group_id');
270
+
271
  $suffix_index_name = 'group_'.$group_id;
272
+
273
  $slaves[] = $this->getIndexName($storeId).'_'.$values['attribute'].'_'.$suffix_index_name.'_'.$values['sort'];
274
  }
275
+ } else {
276
+ if ($values['attribute'] === 'price') {
277
+ $slaves[] = $this->getIndexName($storeId).'_'.$values['attribute'].'_default_'.$values['sort'];
278
+ } else {
279
+ $slaves[] = $this->getIndexName($storeId).'_'.$values['attribute'].'_'.$values['sort'];
280
+ }
 
281
  }
282
  }
283
 
284
+ $this->algolia_helper->setSettings($this->getIndexName($storeId), ['slaves' => $slaves]);
285
 
286
+ foreach ($sorting_indices as $values) {
287
+ if ($this->config->isCustomerGroupsEnabled($storeId) && $values['attribute'] === 'price') {
288
+ foreach ($groups = Mage::getModel('customer/group')->getCollection() as $group) {
289
+ $group_id = (int) $group->getData('customer_group_id');
 
 
 
 
 
 
 
290
 
291
+ $suffix_index_name = 'group_'.$group_id;
292
 
293
+ $sort_attribute = $values['attribute'] === 'price' ? $values['attribute'].'.'.$currencies[0].'.'.$suffix_index_name : $values['attribute'];
294
+
295
+ $mergeSettings['ranking'] = [
296
+ $values['sort'].'('.$sort_attribute.')',
297
+ 'typo',
298
+ 'geo',
299
+ 'words',
300
+ 'proximity',
301
+ 'attribute',
302
+ 'exact',
303
+ 'custom',
304
+ ];
305
+
306
+ $this->algolia_helper->setSettings($this->getIndexName($storeId).'_'.$values['attribute'].'_'.$suffix_index_name.'_'.$values['sort'],
307
+ $mergeSettings);
308
+ }
309
+ } else {
310
+ $sort_attribute = $values['attribute'] === 'price' ? $values['attribute'].'.'.$currencies[0].'.'.'default' : $values['attribute'];
311
+
312
+ $mergeSettings['ranking'] = [
313
+ $values['sort'].'('.$sort_attribute.')',
314
+ 'typo',
315
+ 'geo',
316
+ 'words',
317
+ 'proximity',
318
+ 'attribute',
319
+ 'exact',
320
+ 'custom',
321
+ ];
322
+
323
+ if ($values['attribute'] === 'price') {
324
+ $this->algolia_helper->setSettings($this->getIndexName($storeId).'_'.$values['attribute'].'_default_'.$values['sort'],
325
+ $mergeSettings);
326
+ } else {
327
+ $this->algolia_helper->setSettings($this->getIndexName($storeId).'_'.$values['attribute'].'_'.$values['sort'],
328
+ $mergeSettings);
329
  }
330
  }
331
+ }
332
+ }
 
333
 
334
+ if ($synonymsFile = $this->config->getSynonymsFile($storeId)) {
335
+ $synonymsToSet = json_decode(file_get_contents($synonymsFile));
336
+ } else {
337
+ $synonymsToSet = [];
338
+
339
+ $synonyms = $this->config->getSynonyms($storeId);
340
+ foreach ($synonyms as $objectID => $synonym) {
341
+ $synonymsToSet[] = [
342
+ 'objectID' => $objectID,
343
+ 'type' => 'synonym',
344
+ 'synonyms' => $this->explodeSynomyms($synonym['synonyms']),
345
+ ];
346
+ }
347
 
348
+ $onewaySynonyms = $this->config->getOnewaySynonyms($storeId);
349
+ foreach ($onewaySynonyms as $objectID => $onewaySynonym) {
350
+ $synonymsToSet[] = [
351
+ 'objectID' => $objectID,
352
+ 'type' => 'oneWaySynonym',
353
+ 'input' => $onewaySynonym['input'],
354
+ 'synonyms' => $this->explodeSynomyms($onewaySynonym['synonyms']),
355
+ ];
356
  }
357
  }
358
+
359
+ $this->algolia_helper->setSynonyms($this->getIndexName($storeId, $saveToTmpIndicesToo), $synonymsToSet);
360
  }
361
 
362
  protected function getFields($store)
363
  {
364
+ /** @var Mage_Tax_Helper_Data $tax_helper */
365
  $tax_helper = Mage::helper('tax');
366
 
367
+ if ($tax_helper->getPriceDisplayType($store) == Mage_Tax_Model_Config::DISPLAY_TYPE_EXCLUDING_TAX) {
368
+ return ['price' => false];
369
+ }
370
 
371
+ if ($tax_helper->getPriceDisplayType($store) == Mage_Tax_Model_Config::DISPLAY_TYPE_INCLUDING_TAX) {
372
+ return ['price' => true];
373
+ }
374
 
375
+ return ['price' => false, 'price_with_tax' => true];
376
  }
377
 
378
  protected function formatPrice($price, $includeContainer, $currency_code)
379
  {
380
+ /** @var Mage_Directory_Model_Currency $directoryCurrency */
381
+ $directoryCurrency = Mage::getModel('directory/currency');
382
+
383
+ if (!isset(static::$_currencies[$currency_code])) {
384
+ static::$_currencies[$currency_code] = $directoryCurrency->load($currency_code);
385
  }
386
 
387
+ /** @var Mage_Directory_Model_Currency $currency */
388
  $currency = static::$_currencies[$currency_code];
389
 
390
  if ($currency) {
391
+ return $currency->format($price, [], $includeContainer);
392
  }
393
+
394
  return $price;
395
  }
396
 
397
+ protected function handlePrice(Mage_Catalog_Model_Product &$product, $sub_products, &$customData)
398
  {
399
+ $fields = $this->getFields($product->getStore());
400
+ $customer_groups_enabled = $this->config->isCustomerGroupsEnabled($product->getStoreId());
401
+ $store = $product->getStore();
402
+ $type = $this->config->getMappedProductType($product->getTypeId());
403
+
404
+ /** @var Mage_Directory_Model_Currency $directoryCurrency */
405
+ $directoryCurrency = Mage::getModel('directory/currency');
406
+ $currencies = $directoryCurrency->getConfigAllowCurrencies();
407
+
408
+ $baseCurrencyCode = $store->getBaseCurrencyCode();
409
 
410
+ $groups = [];
411
 
412
+ if ($customer_groups_enabled) {
413
  $groups = Mage::getModel('customer/group')->getCollection();
414
+ }
415
+
416
+ /** @var Mage_Tax_Helper_Data $taxHelper */
417
+ $taxHelper = Mage::helper('tax');
418
 
419
+ /** @var Mage_Directory_Helper_Data $directoryHelper */
420
+ $directoryHelper = Mage::helper('directory');
 
421
 
422
+ foreach ($fields as $field => $with_tax) {
423
+ $customData[$field] = [];
 
424
 
425
+ foreach ($currencies as $currency_code) {
426
+ $customData[$field][$currency_code] = [];
427
 
428
+ $price = (double) $taxHelper->getPrice($product, $product->getPrice(), $with_tax, null, null, null, $product->getStore(), null);
429
+ $price = $directoryHelper->currencyConvert($price, $baseCurrencyCode, $currency_code);
430
 
431
  $customData[$field][$currency_code]['default'] = $price;
432
  $customData[$field][$currency_code]['default_formated'] = $this->formatPrice($price, false, $currency_code);
433
 
434
+ $special_price = (double) $taxHelper->getPrice($product, $product->getFinalPrice(), $with_tax, null, null, null, $product->getStore(), null);
435
+ $special_price = $directoryHelper->currencyConvert($special_price, $baseCurrencyCode, $currency_code);
436
+
437
+ if ($customer_groups_enabled) {
438
+ // If fetch special price for groups
439
 
440
+ foreach ($groups as $group) {
441
+ $group_id = (int) $group->getData('customer_group_id');
 
 
 
442
  $product->setCustomerGroupId($group_id);
443
 
444
  $discounted_price = $product->getPriceModel()->getFinalPrice(1, $product);
445
+ $discounted_price = $directoryHelper->currencyConvert($discounted_price, $baseCurrencyCode, $currency_code);
446
+
447
+ if ($discounted_price !== false) {
448
+ $customData[$field][$currency_code]['group_'.$group_id] = (double) $taxHelper->getPrice($product,
449
+ $discounted_price,
450
+ $with_tax, null,
451
+ null, null,
452
+ $product->getStore(),
453
+ null);
454
+ $customData[$field][$currency_code]['group_'.$group_id] = $directoryHelper->currencyConvert($customData[$field][$currency_code]['group_'.$group_id],
455
+ $baseCurrencyCode,
456
+ $currency_code);
457
+ $customData[$field][$currency_code]['group_'.$group_id.'_formated'] = $store->formatPrice($customData[$field][$currency_code]['group_'.$group_id],
458
+ false, $currency_code);
459
+ } else {
460
+ $customData[$field][$currency_code]['group_'.$group_id] = $customData[$field][$currency_code]['default'];
461
+ $customData[$field][$currency_code]['group_'.$group_id.'_formated'] = $customData[$field][$currency_code]['default_formated'];
462
  }
463
  }
464
 
468
  $customData[$field][$currency_code]['special_from_date'] = strtotime($product->getSpecialFromDate());
469
  $customData[$field][$currency_code]['special_to_date'] = strtotime($product->getSpecialToDate());
470
 
471
+ if ($customer_groups_enabled) {
472
+ foreach ($groups as $group) {
473
+ $group_id = (int) $group->getData('customer_group_id');
 
 
474
 
475
+ if ($special_price && $special_price < $customData[$field][$currency_code]['group_'.$group_id]) {
476
+ $customData[$field][$currency_code]['group_'.$group_id.'_original_formated'] = $customData[$field][$currency_code]['default_formated'];
 
477
 
478
+ $customData[$field][$currency_code]['group_'.$group_id] = $special_price;
479
+ $customData[$field][$currency_code]['group_'.$group_id.'_formated'] = $this->formatPrice($special_price,
480
+ false, $currency_code);
481
  }
482
  }
483
+ } else {
484
+ if ($special_price && $special_price < $customData[$field][$currency_code]['default']) {
 
 
 
485
  $customData[$field][$currency_code]['default_original_formated'] = $customData[$field][$currency_code]['default_formated'];
486
 
487
  $customData[$field][$currency_code]['default'] = $special_price;
488
+ $customData[$field][$currency_code]['default_formated'] = $this->formatPrice($special_price,
489
+ false, $currency_code);
490
  }
491
  }
492
 
493
+ if ($type == 'grouped' || $type == 'bundle') {
 
494
  $min = PHP_INT_MAX;
495
  $max = 0;
496
 
497
+ if ($type == 'bundle') {
 
498
  $_priceModel = $product->getPriceModel();
499
 
500
  list($min, $max) = $_priceModel->getTotalPrices($product, null, $with_tax, true);
502
  $max = (double) $max;
503
  }
504
 
505
+ if ($type == 'grouped') {
506
+ if (count($sub_products) > 0) {
507
+ foreach ($sub_products as $sub_product) {
508
+ $price = (double) $taxHelper->getPrice($product, $sub_product->getFinalPrice(), $with_tax,
509
+ null, null, null, $product->getStore(), null);
 
 
510
 
511
  $min = min($min, $price);
512
  $max = max($max, $price);
513
  }
514
+ } else {
515
+ $min = $max;
516
+ } // avoid to have PHP_INT_MAX in case of no subproducts (Corner case of visibility and stock options)
517
  }
518
 
519
+ if ($min != $max) {
520
+ $min = $directoryHelper->currencyConvert($min, $baseCurrencyCode, $currency_code);
521
+ $max = $directoryHelper->currencyConvert($max, $baseCurrencyCode, $currency_code);
522
 
523
+ $dashed_format = $this->formatPrice($min, false, $currency_code).' - '.$this->formatPrice($max,
524
+ false, $currency_code);
 
 
 
 
 
 
 
525
 
526
+ if (isset($customData[$field][$currency_code]['default_original_formated']) === false || $min <= $customData[$field][$currency_code]['default']) {
527
  $customData[$field][$currency_code]['default_formated'] = $dashed_format;
528
 
529
  //// Do not keep special price that is already taken into account in min max
534
  $customData[$field][$currency_code]['default'] = 0; // will be reset just after
535
  }
536
 
537
+ if ($customer_groups_enabled) {
538
+ foreach ($groups as $group) {
539
+ $group_id = (int) $group->getData('customer_group_id');
 
 
540
 
541
+ if ($min != $max && $min <= $customData[$field][$currency_code]['group_'.$group_id]) {
542
+ $customData[$field][$currency_code]['group_'.$group_id] = 0;
543
+ } else {
544
+ $customData[$field][$currency_code]['group_'.$group_id] = $customData[$field][$currency_code]['default'];
 
 
 
545
  }
546
 
547
+ $customData[$field][$currency_code]['group_'.$group_id.'_formated'] = $dashed_format;
548
  }
549
  }
550
  }
551
 
552
+ if ($customData[$field][$currency_code]['default'] == 0) {
 
553
  $customData[$field][$currency_code]['default'] = $min;
554
 
555
+ if ($min === $max) {
556
+ $customData[$field][$currency_code]['default_formated'] = $this->formatPrice($min, false,
557
+ $currency_code);
558
+ }
559
  }
560
 
561
+ if ($customer_groups_enabled) {
562
+ foreach ($groups as $group) {
563
+ $group_id = (int) $group->getData('customer_group_id');
 
 
564
 
565
+ if ($customData[$field][$currency_code]['group_'.$group_id] == 0) {
566
+ $customData[$field][$currency_code]['group_'.$group_id] = $min;
 
567
 
568
+ if ($min === $max) {
569
+ $customData[$field][$currency_code]['group_'.$group_id.'_formated'] = $customData[$field][$currency_code]['default_formated'];
570
+ }
571
  }
572
  }
573
  }
576
  }
577
  }
578
 
579
+ protected function getValueOrValueText(Mage_Catalog_Model_Product $product, $name, Mage_Catalog_Model_Resource_Eav_Attribute $resource)
580
  {
581
  $value_text = $product->getAttributeText($name);
582
  if (!$value_text) {
583
  $value_text = $resource->getFrontend()->getValue($product);
584
  }
585
+
586
  return $value_text;
587
  }
588
 
589
  public function getObject(Mage_Catalog_Model_Product $product)
590
  {
591
  $type = $this->config->getMappedProductType($product->getTypeId());
592
+ $this->logger->start('CREATE RECORD '.$product->getId().' '.$this->logger->getStoreName($product->storeId));
593
+ $this->logger->log('Product type ('.$product->getTypeId().', mapped to: '.$type.')');
594
+ $defaultData = [];
595
 
596
+ $transport = new Varien_Object($defaultData);
597
 
598
+ Mage::dispatchEvent('algolia_product_index_before', ['product' => $product, 'custom_data' => $transport]);
599
 
600
+ $defaultData = $transport->getData();
601
 
602
+ $defaultData = is_array($defaultData) ? $defaultData : explode('|', $defaultData);
603
 
604
  $visibility = (int) $product->getVisibility();
605
 
606
+ /** @var Mage_Catalog_Model_Product_Visibility $catalogProductVisibility */
607
+ $catalogProductVisibility = Mage::getSingleton('catalog/product_visibility');
608
+ $visibleInCatalog = $catalogProductVisibility->getVisibleInCatalogIds();
609
+ $visibleInSearch = $catalogProductVisibility->getVisibleInSearchIds();
610
 
611
+ $customData = [
612
+ 'objectID' => $product->getId(),
613
+ 'name' => $product->getName(),
614
+ 'url' => $product->getProductUrl(),
615
  'visibility_search' => (int) (in_array($visibility, $visibleInSearch)),
616
+ 'visibility_catalog' => (int) (in_array($visibility, $visibleInCatalog)),
617
+ ];
618
 
619
  $additionalAttributes = $this->config->getProductAdditionalAttributes($product->getStoreId());
620
  $groups = null;
621
 
622
+ if ($this->isAttributeEnabled($additionalAttributes, 'description')) {
623
  $customData['description'] = $product->getDescription();
624
+ }
625
 
626
+ $categories = [];
627
+ $categories_with_path = [];
628
 
629
  $_categoryIds = $product->getCategoryIds();
630
 
631
+ if (is_array($_categoryIds) && count($_categoryIds) > 0) {
632
+ $categoryCollection = Mage::getResourceModel('catalog/category_collection')->addAttributeToSelect('name')
633
+ ->addAttributeToFilter('entity_id', $_categoryIds)
634
+ ->addFieldToFilter('level', ['gt' => 1])->addIsActiveFilter();
635
+
636
+ if ($this->config->showCatsNotIncludedInNavigation($product->getStoreId()) == false) {
637
+ $categoryCollection->addAttributeToFilter('include_in_menu', '1');
638
+ }
639
 
640
  $rootCat = Mage::app()->getStore($product->getStoreId())->getRootCategoryId();
641
 
642
+ /** @var Mage_Catalog_Model_Category $category */
643
+ foreach ($categoryCollection as $category) {
644
  // Check and skip all categories that is not
645
  // in the path of the current store.
646
  $path = $category->getPath();
647
+ $path_parts = explode('/', $path);
648
  if (isset($path_parts[1]) && $path_parts[1] != $rootCat) {
649
  continue;
650
  }
651
+
652
  $categoryName = $category->getName();
653
 
654
+ if ($categoryName) {
655
  $categories[] = $categoryName;
656
+ }
657
 
658
  $category->getUrlInstance()->setStore($product->getStoreId());
659
+ $path = [];
660
 
661
+ foreach ($category->getPathIds() as $treeCategoryId) {
 
662
  $name = $this->getCategoryName($treeCategoryId, $product->getStoreId());
663
+ if ($name) {
664
  $path[] = $name;
665
+ }
666
  }
667
 
668
  $categories_with_path[] = $path;
669
  }
670
  }
671
 
672
+ foreach ($categories_with_path as $result) {
673
+ for ($i = count($result) - 1; $i > 0; $i--) {
 
 
674
  $categories_with_path[] = array_slice($result, 0, $i);
675
  }
676
  }
677
 
678
+ $categories_with_path = array_intersect_key($categories_with_path,
679
+ array_unique(array_map('serialize', $categories_with_path)));
680
 
681
+ $categories_hierarchical = [];
682
 
683
  $level_name = 'level';
684
 
685
+ foreach ($categories_with_path as $category) {
686
+ for ($i = 0; $i < count($category); $i++) {
687
+ if (isset($categories_hierarchical[$level_name.$i]) === false) {
688
+ $categories_hierarchical[$level_name.$i] = [];
689
+ }
 
690
 
691
  $categories_hierarchical[$level_name.$i][] = implode(' /// ', array_slice($category, 0, $i + 1));
692
  }
693
  }
694
 
695
+ foreach ($categories_hierarchical as &$level) {
 
696
  $level = array_values(array_unique($level));
697
  }
698
 
699
+ foreach ($categories_with_path as &$category) {
700
+ $category = implode(' /// ', $category);
701
+ }
702
 
703
  $customData['categories'] = $categories_hierarchical;
704
 
705
  $customData['categories_without_path'] = $categories;
706
 
707
+ /** @var Algolia_Algoliasearch_Helper_Image $image_helper */
708
+ $image_helper = Mage::helper('algoliasearch/image');
709
+
710
+ if (false === isset($defaultData['thumbnail_url'])) {
711
+ /** @var Algolia_Algoliasearch_Helper_Image $thumb */
712
+ $thumb = $image_helper->init($product, 'thumbnail')->resize(75, 75);
713
 
714
+ try {
 
715
  $customData['thumbnail_url'] = $thumb->toString();
716
+ } catch (\Exception $e) {
 
 
717
  $this->logger->log($e->getMessage());
718
  $this->logger->log($e->getTraceAsString());
719
 
720
+ $baseUrl = Mage::getBaseUrl();
721
+ $placeholderUrl = Mage::getDesign()->getSkinUrl($thumb->getPlaceholder());
722
+
723
+ $customData['thumbnail_url'] = str_replace($baseUrl, '', $placeholderUrl);
724
  }
725
  }
726
 
727
+ if (false === isset($defaultData['image_url'])) {
728
+ /** @var Algolia_Algoliasearch_Helper_Image $image */
729
+ $image = $image_helper->init($product, $this->config->getImageType())
730
+ ->resize($this->config->getImageWidth(), $this->config->getImageHeight());
731
 
732
+ try {
 
733
  $customData['image_url'] = $image->toString();
734
+ } catch (\Exception $e) {
 
 
735
  $this->logger->log($e->getMessage());
736
  $this->logger->log($e->getTraceAsString());
737
 
738
+ $baseUrl = Mage::getBaseUrl();
739
+ $placeholderUrl = Mage::getDesign()->getSkinUrl($image->getPlaceholder());
740
+
741
+ $customData['image_url'] = str_replace($baseUrl, '', $placeholderUrl);
742
  }
743
 
744
+ if ($this->isAttributeEnabled($additionalAttributes, 'media_gallery')) {
 
745
  $product->load('media_gallery');
746
 
747
+ $customData['media_gallery'] = [];
748
 
749
+ foreach ($product->getMediaGalleryImages() as $image) {
750
+ $customData['media_gallery'][] = str_replace(['https://', 'http://'], '//', $image->getUrl());
 
751
  }
752
  }
753
  }
755
  $sub_products = null;
756
  $ids = null;
757
 
758
+ if ($type == 'configurable' || $type == 'grouped' || $type == 'bundle') {
759
+ if ($type == 'bundle') {
760
+ $ids = [];
 
 
761
 
762
+ $selection = $product->getTypeInstance(true)->getSelectionsCollection($product->getTypeInstance(true)
763
+ ->getOptionsIds($product),
764
+ $product);
765
 
766
+ foreach ($selection as $option) {
767
  $ids[] = $option->product_id;
768
+ }
769
  }
770
 
771
+ if ($type == 'configurable' || $type == 'grouped') {
 
772
  $ids = $product->getTypeInstance(true)->getChildrenIds($product->getId());
773
  $ids = call_user_func_array('array_merge', $ids);
774
  }
775
 
776
+ if (count($ids)) {
777
+ $collection = $this->getProductCollectionQuery($product->getStoreId(), $ids, false);
778
+ $sub_products = $collection->load();
779
+ } else {
780
+ $sub_products = [];
 
 
781
  }
782
  }
783
 
784
+ if (false === isset($defaultData['in_stock'])) {
 
785
  $stockItem = $product->getStockItem();
786
 
787
  $customData['in_stock'] = (int) $stockItem->getIsInStock();
788
  }
789
 
790
  // skip default calculation if we have provided these attributes via the observer in $defaultData
791
+ if (false === isset($defaultData['ordered_qty']) && $this->isAttributeEnabled($additionalAttributes,
792
+ 'ordered_qty')
793
+ ) {
794
  $customData['ordered_qty'] = (int) $product->getOrderedQty();
795
+ }
796
 
797
+ if (false === isset($defaultData['total_ordered']) && $this->isAttributeEnabled($additionalAttributes,
798
+ 'total_ordered')
799
+ ) {
800
  $customData['total_ordered'] = (int) $product->getTotalOrdered();
801
+ }
802
 
803
+ if (false === isset($defaultData['stock_qty']) && $this->isAttributeEnabled($additionalAttributes,
804
+ 'stock_qty')
805
+ ) {
806
  $customData['stock_qty'] = (int) $product->getStockQty();
807
+ }
808
 
809
+ if (Mage::helper('core')->isModuleEnabled('Mage_Review')) {
810
+ if ($this->isAttributeEnabled($additionalAttributes, 'rating_summary')) {
811
+ $customData['rating_summary'] = (int) $product->getRatingSummary();
812
+ }
813
+ }
814
 
815
+ foreach ($additionalAttributes as $attribute) {
 
816
  $attribute_name = $attribute['attribute'];
817
+ if (isset($customData[$attribute_name])) {
818
  continue;
819
+ }
820
 
821
  $value = $product->getData($attribute_name);
822
 
823
+ /** @var Mage_Catalog_Model_Resource_Eav_Attribute $attribute_resource */
824
  $attribute_resource = $product->getResource()->getAttribute($attribute_name);
825
 
826
+ if ($attribute_resource) {
 
827
  $attribute_resource->setStoreId($product->getStoreId());
828
 
829
+ /**
830
+ * if $value is missing or if the attribute is SKU,
831
+ * use values from child products
832
+ */
833
+ if (($value === null || 'sku' == $attribute_name) && ($type == 'configurable' || $type == 'grouped' || $type == 'bundle')) {
834
+ if ($value === null) {
835
+ $values = [];
836
+ } else {
837
+ $values = [$this->getValueOrValueText($product, $attribute_name, $attribute_resource)];
838
+ }
839
 
840
+ $all_sub_products_out_of_stock = true;
841
 
842
+ foreach ($sub_products as $sub_product) {
843
+ $isInStock = (int) $sub_product->getStockItem()->getIsInStock();
 
844
 
845
+ if ($isInStock == false && $this->config->indexOutOfStockOptions($product->getStoreId()) == false) {
846
+ continue;
847
+ }
848
 
849
+ $all_sub_products_out_of_stock = false;
850
 
851
+ $value = $sub_product->getData($attribute_name);
852
 
853
+ if ($value) {
854
+ $values[] = $this->getValueOrValueText($sub_product, $attribute_name,
855
+ $attribute_resource);
 
856
  }
857
+ }
858
 
859
+ if (is_array($values) && count($values) > 0) {
860
+ $customData[$attribute_name] = array_values(array_unique($values));
861
+ }
 
862
 
863
+ // Set main product out of stock if all
864
+ // sub-products are out of stock.
865
+ if ($customData['in_stock'] && $all_sub_products_out_of_stock) {
866
+ $customData['in_stock'] = 0;
 
867
  }
868
+ } elseif (!is_array($value)) {
 
 
869
  $value = $this->getValueOrValueText($product, $attribute_name, $attribute_resource);
870
+ }
871
 
872
+ if ($value && !isset($customData[$attribute_name])) {
873
+ $customData[$attribute_name] = $value;
 
 
874
  }
875
  }
876
  }
877
 
878
+ $msrpEnabled = method_exists(Mage::helper('catalog'), 'canApplyMsrp') ? (bool) Mage::helper('catalog')
879
+ ->canApplyMsrp($product) : false;
880
 
881
+ if (false === $msrpEnabled) {
 
 
882
  $this->handlePrice($product, $sub_products, $customData);
883
+ } else {
884
  unset($customData['price']);
885
+ }
886
 
887
  $transport = new Varien_Object($customData);
888
+ Mage::dispatchEvent('algolia_subproducts_index',
889
+ ['custom_data' => $transport, 'sub_products' => $sub_products]);
890
  $customData = $transport->getData();
891
 
892
  $customData = array_merge($customData, $defaultData);
895
 
896
  $this->castProductObject($customData);
897
 
898
+ $this->logger->stop('CREATE RECORD '.$product->getId().' '.$this->logger->getStoreName($product->storeId));
899
 
900
  return $customData;
901
  }
902
+
903
+ public function getAllProductIds($storeId)
904
+ {
905
+ $products = Mage::getModel('catalog/product')->getCollection();
906
+
907
+ $products = $products->setStoreId($storeId);
908
+ $products = $products->addStoreFilter($storeId);
909
+
910
+ return $products->getAllIds();
911
+ }
912
+
913
+ private function explodeSynomyms($synonyms)
914
+ {
915
+ return array_map('trim', explode(',', $synonyms));
916
+ }
917
  }
app/code/community/Algolia/Algoliasearch/Helper/Entity/Suggestionhelper.php CHANGED
@@ -3,7 +3,7 @@
3
  class Algolia_Algoliasearch_Helper_Entity_Suggestionhelper extends Algolia_Algoliasearch_Helper_Entity_Helper
4
  {
5
  protected $_popularQueries = null;
6
- protected $_popularQueriesCacheId = "algoliasearch_popular_queries_cache_tag";
7
 
8
  protected function getIndexNameSuffix()
9
  {
@@ -12,23 +12,23 @@ class Algolia_Algoliasearch_Helper_Entity_Suggestionhelper extends Algolia_Algol
12
 
13
  public function getIndexSettings($storeId)
14
  {
15
- return array(
16
- 'attributesToIndex' => array('query'),
17
- 'customRanking' => array('desc(popularity)', 'desc(number_of_results)', 'asc(date)'),
18
- 'typoTolerance' => false,
19
- 'attributesToRetrieve' => array('query')
20
- );
21
  }
22
 
23
  public function getObject(Mage_CatalogSearch_Model_Query $suggestion)
24
  {
25
- $suggestion_obj = array(
26
- 'objectID' => $suggestion->getData('query_id'),
27
- 'query' => $suggestion->getData('query_text'),
28
- 'number_of_results' => (int) $suggestion->getData('num_results'),
29
- 'popularity' => (int) $suggestion->getData('popularity'),
30
- 'updated_at' => (int) strtotime($suggestion->getData('updated_at')),
31
- );
32
 
33
  return $suggestion_obj;
34
  }
@@ -43,34 +43,35 @@ class Algolia_Algoliasearch_Helper_Entity_Suggestionhelper extends Algolia_Algol
43
  $this->_popularQueries = unserialize($cachedPopularQueries);
44
  } else {
45
  $collection = Mage::getResourceModel('catalogsearch/query_collection');
46
- $collection->getSelect()->where('num_results >= ' . $this->config->getMinNumberOfResults() . ' AND popularity >= ' . $this->config->getMinPopularity() . ' AND query_text != "__empty__"');
47
  $collection->getSelect()->limit(12);
48
  $collection->setOrder('popularity', 'DESC');
49
  $collection->setOrder('num_results', 'DESC');
50
  $collection->setOrder('updated_at', 'ASC');
51
 
52
  if ($storeId) {
53
- $collection->getSelect()->where('store_id = ?', (int)$storeId);
54
  }
55
 
56
  $collection->load();
57
 
58
- $suggestions = array();
59
 
60
  /** @var $suggestion Mage_Catalog_Model_Category */
61
- foreach ($collection as $suggestion)
62
- if (strlen($suggestion['query_text']) >= 3)
63
  $suggestions[] = $suggestion['query_text'];
 
 
64
 
65
  $this->_popularQueries = array_slice($suggestions, 0, 9);
66
  try { //save to cache
67
  $cacheContent = serialize($this->_popularQueries);
68
- $tags = array(
69
- Mage_CatalogSearch_Model_Query::CACHE_TAG
70
- );
71
 
72
  Mage::app()->saveCache($cacheContent, $this->_popularQueriesCacheId, $tags, 604800);
73
-
74
  } catch (Exception $e) {
75
  // Exception = no caching
76
  Mage::logException($e);
@@ -83,12 +84,13 @@ class Algolia_Algoliasearch_Helper_Entity_Suggestionhelper extends Algolia_Algol
83
 
84
  public function getSuggestionCollectionQuery($storeId)
85
  {
 
86
  $collection = Mage::getResourceModel('catalogsearch/query_collection')
87
  ->addStoreFilter($storeId)
88
  ->setStoreId($storeId);
89
 
90
- $collection->getSelect()->where('num_results >= '.$this->config->getMinNumberOfResults().' AND popularity >= ' . $this->config->getMinPopularity() .' AND query_text != "__empty__"');
91
 
92
  return $collection;
93
  }
94
- }
3
  class Algolia_Algoliasearch_Helper_Entity_Suggestionhelper extends Algolia_Algoliasearch_Helper_Entity_Helper
4
  {
5
  protected $_popularQueries = null;
6
+ protected $_popularQueriesCacheId = 'algoliasearch_popular_queries_cache_tag';
7
 
8
  protected function getIndexNameSuffix()
9
  {
12
 
13
  public function getIndexSettings($storeId)
14
  {
15
+ return [
16
+ 'attributesToIndex' => ['query'],
17
+ 'customRanking' => ['desc(popularity)', 'desc(number_of_results)', 'asc(date)'],
18
+ 'typoTolerance' => false,
19
+ 'attributesToRetrieve' => ['query'],
20
+ ];
21
  }
22
 
23
  public function getObject(Mage_CatalogSearch_Model_Query $suggestion)
24
  {
25
+ $suggestion_obj = [
26
+ 'objectID' => $suggestion->getData('query_id'),
27
+ 'query' => $suggestion->getData('query_text'),
28
+ 'number_of_results' => (int) $suggestion->getData('num_results'),
29
+ 'popularity' => (int) $suggestion->getData('popularity'),
30
+ 'updated_at' => (int) strtotime($suggestion->getData('updated_at')),
31
+ ];
32
 
33
  return $suggestion_obj;
34
  }
43
  $this->_popularQueries = unserialize($cachedPopularQueries);
44
  } else {
45
  $collection = Mage::getResourceModel('catalogsearch/query_collection');
46
+ $collection->getSelect()->where('num_results >= '.$this->config->getMinNumberOfResults().' AND popularity >= '.$this->config->getMinPopularity().' AND query_text != "__empty__"');
47
  $collection->getSelect()->limit(12);
48
  $collection->setOrder('popularity', 'DESC');
49
  $collection->setOrder('num_results', 'DESC');
50
  $collection->setOrder('updated_at', 'ASC');
51
 
52
  if ($storeId) {
53
+ $collection->getSelect()->where('store_id = ?', (int) $storeId);
54
  }
55
 
56
  $collection->load();
57
 
58
+ $suggestions = [];
59
 
60
  /** @var $suggestion Mage_Catalog_Model_Category */
61
+ foreach ($collection as $suggestion) {
62
+ if (strlen($suggestion['query_text']) >= 3) {
63
  $suggestions[] = $suggestion['query_text'];
64
+ }
65
+ }
66
 
67
  $this->_popularQueries = array_slice($suggestions, 0, 9);
68
  try { //save to cache
69
  $cacheContent = serialize($this->_popularQueries);
70
+ $tags = [
71
+ Mage_CatalogSearch_Model_Query::CACHE_TAG,
72
+ ];
73
 
74
  Mage::app()->saveCache($cacheContent, $this->_popularQueriesCacheId, $tags, 604800);
 
75
  } catch (Exception $e) {
76
  // Exception = no caching
77
  Mage::logException($e);
84
 
85
  public function getSuggestionCollectionQuery($storeId)
86
  {
87
+ /** @var Mage_CatalogSearch_Model_Resource_Query_Collection $collection */
88
  $collection = Mage::getResourceModel('catalogsearch/query_collection')
89
  ->addStoreFilter($storeId)
90
  ->setStoreId($storeId);
91
 
92
+ $collection->getSelect()->where('num_results >= '.$this->config->getMinNumberOfResults().' AND popularity >= '.$this->config->getMinPopularity().' AND query_text != "__empty__"');
93
 
94
  return $collection;
95
  }
96
+ }
app/code/community/Algolia/Algoliasearch/Helper/Image.php CHANGED
@@ -9,30 +9,36 @@ class Algolia_Algoliasearch_Helper_Image extends Mage_Catalog_Helper_Image
9
  {
10
  $model = $this->_getModel();
11
 
12
- if ($this->getImageFile())
13
  $model->setBaseFile($this->getImageFile());
14
- else
15
  $model->setBaseFile($this->getProduct()->getData($model->getDestinationSubdir()));
 
16
 
17
- if ($model->isCached())
18
  return $this->getUrl($model);
 
19
 
20
- if ($this->_scheduleRotate)
21
  $model->rotate($this->getAngle());
 
22
 
23
- if ($this->_scheduleResize)
24
  $model->resize();
 
25
 
26
- if ($this->getWatermark())
27
  $model->setWatermark($this->getWatermark());
 
28
 
29
  return $this->getUrl($model->saveFile());
30
  }
31
 
32
- public function getUrl($model)
33
  {
34
- $baseDir = Mage::getBaseDir('media');
35
- $path = str_replace($baseDir . DS, "", $model->getNewFile());
 
36
  $url = str_replace(DS, '/', $path);
37
 
38
  return $url;
9
  {
10
  $model = $this->_getModel();
11
 
12
+ if ($this->getImageFile()) {
13
  $model->setBaseFile($this->getImageFile());
14
+ } else {
15
  $model->setBaseFile($this->getProduct()->getData($model->getDestinationSubdir()));
16
+ }
17
 
18
+ if ($model->isCached()) {
19
  return $this->getUrl($model);
20
+ }
21
 
22
+ if ($this->_scheduleRotate) {
23
  $model->rotate($this->getAngle());
24
+ }
25
 
26
+ if ($this->_scheduleResize) {
27
  $model->resize();
28
+ }
29
 
30
+ if ($this->getWatermark()) {
31
  $model->setWatermark($this->getWatermark());
32
+ }
33
 
34
  return $this->getUrl($model->saveFile());
35
  }
36
 
37
+ public function getUrl(Mage_Catalog_Model_Product_Image $model)
38
  {
39
+ $baseDir = Mage::getBaseDir();
40
+ $path = str_replace($baseDir.DS, '', $model->getNewFile());
41
+
42
  $url = str_replace(DS, '/', $path);
43
 
44
  return $url;
app/code/community/Algolia/Algoliasearch/Helper/Logger.php CHANGED
@@ -2,18 +2,22 @@
2
 
3
  class Algolia_Algoliasearch_Helper_Logger extends Mage_Core_Helper_Abstract
4
  {
5
- protected $enabled;
6
  protected $config;
7
- protected $timers = array();
8
- protected $stores = array();
 
 
9
 
10
  public function __construct()
11
  {
12
  $this->config = Mage::helper('algoliasearch/config');
13
  $this->enabled = $this->config->isLoggingEnabled();
14
 
15
- foreach (Mage::app()->getStores() as $store)
 
16
  $this->stores[$store->getId()] = $store->getName();
 
17
  }
18
 
19
  public function isEnable()
@@ -23,16 +27,18 @@ class Algolia_Algoliasearch_Helper_Logger extends Mage_Core_Helper_Abstract
23
 
24
  public function getStoreName($storeId)
25
  {
26
- if ($storeId === null)
27
  return 'undefined store';
 
28
 
29
- return $storeId . ' (' . $this->stores[$storeId] . ')';
30
  }
31
 
32
  public function start($action)
33
  {
34
- if ($this->enabled == false)
35
  return;
 
36
 
37
  $this->log('');
38
  $this->log('');
@@ -42,13 +48,15 @@ class Algolia_Algoliasearch_Helper_Logger extends Mage_Core_Helper_Abstract
42
 
43
  public function stop($action)
44
  {
45
- if ($this->enabled == false)
46
  return;
 
47
 
48
- if (false === isset($this->timers[$action]))
49
- throw new Exception("Algolia Logger => non existing action");
 
50
 
51
- $this->log('<<<<< END ' .$action. ' (' . $this->formatTime($this->timers[$action], microtime(true)) . ')');
52
  }
53
 
54
  public function log($message, $forceLog = false)
2
 
3
  class Algolia_Algoliasearch_Helper_Logger extends Mage_Core_Helper_Abstract
4
  {
5
+ /** @var Algolia_Algoliasearch_Helper_Config */
6
  protected $config;
7
+
8
+ protected $enabled;
9
+ protected $timers = [];
10
+ protected $stores = [];
11
 
12
  public function __construct()
13
  {
14
  $this->config = Mage::helper('algoliasearch/config');
15
  $this->enabled = $this->config->isLoggingEnabled();
16
 
17
+ /** @var Mage_Core_Model_Store $store */
18
+ foreach (Mage::app()->getStores() as $store) {
19
  $this->stores[$store->getId()] = $store->getName();
20
+ }
21
  }
22
 
23
  public function isEnable()
27
 
28
  public function getStoreName($storeId)
29
  {
30
+ if ($storeId === null) {
31
  return 'undefined store';
32
+ }
33
 
34
+ return $storeId.' ('.$this->stores[$storeId].')';
35
  }
36
 
37
  public function start($action)
38
  {
39
+ if ($this->enabled == false) {
40
  return;
41
+ }
42
 
43
  $this->log('');
44
  $this->log('');
48
 
49
  public function stop($action)
50
  {
51
+ if ($this->enabled == false) {
52
  return;
53
+ }
54
 
55
+ if (false === isset($this->timers[$action])) {
56
+ throw new Exception('Algolia Logger => non existing action');
57
+ }
58
 
59
+ $this->log('<<<<< END '.$action.' ('.$this->formatTime($this->timers[$action], microtime(true)).')');
60
  }
61
 
62
  public function log($message, $forceLog = false)
app/code/community/Algolia/Algoliasearch/Model/Indexer/Abstract.php ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ abstract class Algolia_Algoliasearch_Model_Indexer_Abstract extends Mage_Index_Model_Indexer_Abstract
4
+ {
5
+ /** @var Algolia_Algoliasearch_Model_Resource_Engine */
6
+ protected $engine;
7
+
8
+ protected $enableQueueMsg = 'Please enable the queueing system to do it asynchronously (CRON) if you have a lot of products in System > Configuration > Algolia Search > Queue configuration';
9
+
10
+ public function __construct()
11
+ {
12
+ parent::__construct();
13
+
14
+ $this->engine = new Algolia_Algoliasearch_Model_Resource_Engine();
15
+ }
16
+
17
+ /**
18
+ * This function will update all the requested categories and their child
19
+ * categories in Algolia. You can provide either a single category ID or an
20
+ * array of category IDs. A category ID should be either a string or an
21
+ * integer.
22
+ *
23
+ * @param array|string|int $updateCategoryIds
24
+ */
25
+ public function reindexSpecificCategories($updateCategoryIds)
26
+ {
27
+ $updateCategoryIds = (array) $updateCategoryIds;
28
+
29
+ foreach ($updateCategoryIds as $id) {
30
+ /** @var Mage_Catalog_Model_Category $categoryModel */
31
+ $categoryModel = Mage::getModel('catalog/category');
32
+ $categories = $categoryModel->getCategories($id);
33
+
34
+ foreach ($categories as $category) {
35
+ $updateCategoryIds[] = $category->getId();
36
+ }
37
+ }
38
+
39
+ $this->engine->rebuildCategoryIndex(null, $updateCategoryIds);
40
+ }
41
+
42
+ /**
43
+ * This function will update all the requested products and their parent
44
+ * products in Algolia. You can provide either a single product ID or an
45
+ * array of product IDs. A product ID should be either a string or an
46
+ * integer.
47
+ *
48
+ * @param array|string|int $updateProductIds
49
+ */
50
+ public function reindexSpecificProducts($updateProductIds)
51
+ {
52
+ $updateProductIds = (array) $updateProductIds;
53
+ $productIds = $updateProductIds;
54
+
55
+ foreach ($updateProductIds as $updateProductId) {
56
+ if (!$this->_isProductComposite($updateProductId)) {
57
+ $parentIds = $this->_getResource()->getRelationsByChild($updateProductId);
58
+
59
+ if (!empty($parentIds)) {
60
+ $productIds = array_merge($productIds, $parentIds);
61
+ }
62
+ }
63
+ }
64
+
65
+ if (!empty($productIds)) {
66
+ $this->engine->rebuildProductIndex(null, $productIds);
67
+ }
68
+ }
69
+
70
+ /**
71
+ * @return Mage_CatalogSearch_Model_Resource_Indexer_Fulltext
72
+ */
73
+ protected function _getResource()
74
+ {
75
+ return Mage::getResourceSingleton('catalogsearch/indexer_fulltext');
76
+ }
77
+
78
+ /**
79
+ * Check whether a product is composite
80
+ *
81
+ * @param int $productId
82
+ * @return bool
83
+ */
84
+ protected function _isProductComposite($productId)
85
+ {
86
+ /** @var Mage_Catalog_Model_Product $product */
87
+ $product = Mage::getModel('catalog/product')->load($productId);
88
+ return $product->isComposite();
89
+ }
90
+ }
app/code/community/Algolia/Algoliasearch/Model/Indexer/Algolia.php CHANGED
@@ -1,76 +1,74 @@
1
  <?php
2
 
3
- class Algolia_Algoliasearch_Model_Indexer_Algolia extends Mage_Index_Model_Indexer_Abstract
4
  {
5
  const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';
6
 
7
- /** @var Algolia_Algoliasearch_Model_Resource_Engine */
8
- protected $engine;
9
  protected $config;
10
 
11
- public static $product_categories = array();
12
- protected static $credential_error = false;
13
-
14
  /** @var Algolia_Algoliasearch_Helper_Logger */
15
  protected $logger;
16
 
 
 
 
17
  public function __construct()
18
  {
19
  parent::__construct();
20
 
21
- $this->engine = new Algolia_Algoliasearch_Model_Resource_Engine();
22
  $this->config = Mage::helper('algoliasearch/config');
23
  $this->logger = Mage::helper('algoliasearch/logger');
24
  }
25
 
26
- protected $_matchedEntities = array(
27
- Mage_Catalog_Model_Product::ENTITY => array(
28
  Mage_Index_Model_Event::TYPE_SAVE,
29
  Mage_Index_Model_Event::TYPE_MASS_ACTION,
30
- Mage_Index_Model_Event::TYPE_DELETE
31
- ),
32
- Mage_Catalog_Model_Resource_Eav_Attribute::ENTITY => array(
33
  Mage_Index_Model_Event::TYPE_SAVE,
34
  Mage_Index_Model_Event::TYPE_DELETE,
35
- ),
36
- Mage_Core_Model_Store::ENTITY => array(
37
  Mage_Index_Model_Event::TYPE_SAVE,
38
- Mage_Index_Model_Event::TYPE_DELETE
39
- ),
40
- Mage_Core_Model_Store_Group::ENTITY => array(
41
- Mage_Index_Model_Event::TYPE_SAVE
42
- ),
43
- Mage_Core_Model_Config_Data::ENTITY => array(
44
- Mage_Index_Model_Event::TYPE_SAVE
45
- ),
46
- Mage_Catalog_Model_Convert_Adapter_Product::ENTITY => array(
47
- Mage_Index_Model_Event::TYPE_SAVE
48
- ),
49
- Mage_Catalog_Model_Category::ENTITY => array(
50
  Mage_Index_Model_Event::TYPE_SAVE,
51
- Mage_Index_Model_Event::TYPE_DELETE
52
- )
53
- );
54
-
55
- protected function _getResource()
56
- {
57
- return Mage::getResourceSingleton('catalogsearch/indexer_fulltext');
58
- }
 
 
 
 
59
 
60
  public function getName()
61
  {
62
- return Mage::helper('algoliasearch')->__('Algolia Search');
63
  }
64
 
65
  public function getDescription()
66
  {
67
- return Mage::helper('algoliasearch')->__('Rebuild product index.
68
- Please enable the queueing system to do it asynchronously (CRON) if you have a lot of products in System > Configuration > Algolia Search > Queue configuration');
 
 
 
69
  }
70
 
71
  public function matchEvent(Mage_Index_Model_Event $event)
72
  {
73
- $process = Mage::getModel('index/indexer')->getProcessByCode('algolia_search_indexer');
 
 
74
 
75
  $result = $process->getMode() !== Mage_Index_Model_Process::MODE_MANUAL;
76
 
@@ -83,39 +81,41 @@ class Algolia_Algoliasearch_Model_Indexer_Algolia extends Mage_Index_Model_Index
83
 
84
  protected function _registerEvent(Mage_Index_Model_Event $event)
85
  {
86
- $event->addNewData(self::EVENT_MATCH_RESULT_KEY, TRUE);
87
  switch ($event->getEntity()) {
88
  case Mage_Catalog_Model_Product::ENTITY:
89
  $this->_registerCatalogProductEvent($event);
90
  break;
91
  case Mage_Catalog_Model_Convert_Adapter_Product::ENTITY:
92
- $event->addNewData('algoliasearch_reindex_all', TRUE);
93
  break;
94
  case Mage_Core_Model_Store_Group::ENTITY:
95
- $event->addNewData('algoliasearch_reindex_all', TRUE);
96
  break;
97
  case Mage_CatalogInventory_Model_Stock_Item::ENTITY:
98
- if (false == $this->config->getShowOutOfStock())
99
  $this->_registerCatalogInventoryStockItemEvent($event);
 
100
  break;
101
  }
102
  }
103
 
104
  protected function _registerCatalogInventoryStockItemEvent(Mage_Index_Model_Event $event)
105
  {
106
- if ($event->getType() == Mage_Index_Model_Event::TYPE_SAVE)
107
- {
108
  $object = $event->getDataObject();
109
 
110
- $product = Mage::getModel('catalog/product')->load($object->getProductId());
 
 
 
 
 
 
 
111
 
112
- try // In case of wrong credentials or overquota or block account. To avoid checkout process to fail
113
- {
114
- $event->addNewData('catalogsearch_delete_product_id', $product->getId());
115
  $event->addNewData('catalogsearch_update_category_id', $product->getCategoryIds());
116
- }
117
- catch(\Exception $e)
118
- {
119
  $this->logger->log('Error while trying to update stock');
120
  $this->logger->log($e->getMessage());
121
  $this->logger->log($e->getTraceAsString());
@@ -129,54 +129,49 @@ class Algolia_Algoliasearch_Model_Indexer_Algolia extends Mage_Index_Model_Index
129
  case Mage_Index_Model_Event::TYPE_SAVE:
130
  /** @var $product Mage_Catalog_Model_Product */
131
  $product = $event->getDataObject();
 
132
  $event->addNewData('catalogsearch_update_product_id', $product->getId());
133
  $event->addNewData('catalogsearch_update_category_id', $product->getCategoryIds());
134
 
135
  /* product_categories is filled in Observer::saveProduct */
136
- if (isset(static::$product_categories[$product->getId()]))
137
- {
138
  $oldCategories = static::$product_categories[$product->getId()];
139
  $newCategories = $product->getCategoryIds();
140
 
141
- $diffCategories = array_merge(array_diff($oldCategories, $newCategories), array_diff($newCategories, $oldCategories));
 
142
 
143
  $event->addNewData('catalogsearch_update_category_id', $diffCategories);
144
  }
 
145
 
146
  case Mage_Index_Model_Event::TYPE_DELETE:
147
-
148
  /** @var $product Mage_Catalog_Model_Product */
149
  $product = $event->getDataObject();
 
150
  $event->addNewData('catalogsearch_update_product_id', $product->getId());
151
  $event->addNewData('catalogsearch_update_category_id', $product->getCategoryIds());
152
  break;
153
 
154
  case Mage_Index_Model_Event::TYPE_MASS_ACTION:
155
- /** @var $actionObject Varien_Object */
156
  $actionObject = $event->getDataObject();
157
 
158
  $event->addNewData('catalogsearch_update_product_id', $actionObject->getProductIds());
159
-
160
  break;
161
  }
162
 
163
  return $this;
164
  }
165
 
166
- protected function _isProductComposite($productId)
167
- {
168
- /** @var $product Mage_Catalog_Model_Product */
169
- $product = Mage::getModel('catalog/product')->load($productId);
170
- return $product->isComposite();
171
- }
172
-
173
  protected function _processEvent(Mage_Index_Model_Event $event)
174
  {
175
- if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
176
- {
177
- if (self::$credential_error === false)
178
- {
179
- Mage::getSingleton('adminhtml/session')->addError('Algolia indexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
 
180
  self::$credential_error = true;
181
  }
182
 
@@ -188,60 +183,35 @@ class Algolia_Algoliasearch_Model_Indexer_Algolia extends Mage_Index_Model_Index
188
  /*
189
  * Reindex all products
190
  */
191
- if ( ! empty($data['algoliasearch_reindex_all'])) {
192
  $process = $event->getProcess();
193
  $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
194
  }
195
 
196
- if ( ! empty($data['catalogsearch_update_category_id'])) {
197
- $updateCategoryIds = $data['catalogsearch_update_category_id'];
198
- $updateCategoryIds = is_array($updateCategoryIds) ? $updateCategoryIds : array($updateCategoryIds);
199
-
200
- foreach ($updateCategoryIds as $id) {
201
- $categories = Mage::getModel('catalog/category')->getCategories($id);
202
-
203
- foreach ($categories as $category)
204
- $updateCategoryIds[] = $category->getId();
205
- }
206
-
207
- $this->engine->rebuildCategoryIndex(null, $updateCategoryIds);
208
  }
209
 
210
  /*
211
  * Reindex products.
212
  */
213
- if ( ! empty($data['catalogsearch_update_product_id']))
214
- {
215
- $updateProductIds = $data['catalogsearch_update_product_id'];
216
- $updateProductIds = is_array($updateProductIds) ? $updateProductIds : array($updateProductIds);
217
- $productIds = $updateProductIds;
218
-
219
- foreach ($updateProductIds as $updateProductId) {
220
- if (! $this->_isProductComposite($updateProductId)) {
221
- $parentIds = $this->_getResource()->getRelationsByChild($updateProductId);
222
-
223
- if (! empty($parentIds)) {
224
- $productIds = array_merge($productIds, $parentIds);
225
- }
226
- }
227
- }
228
-
229
- if (!empty($productIds)) {
230
- $this->engine->removeProducts(null, $productIds);
231
- $this->engine->rebuildProductIndex(null, $productIds);
232
- }
233
  }
234
  }
235
 
236
  /**
237
- * Rebuild all index data
238
  */
239
  public function reindexAll()
240
  {
241
- if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
242
- {
243
- Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
 
 
244
  $this->logger->log('ERROR Credentials not configured correctly');
 
245
  return;
246
  }
247
 
1
  <?php
2
 
3
+ class Algolia_Algoliasearch_Model_Indexer_Algolia extends Algolia_Algoliasearch_Model_Indexer_Abstract
4
  {
5
  const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';
6
 
7
+ /** @var Algolia_Algoliasearch_Helper_Config */
 
8
  protected $config;
9
 
 
 
 
10
  /** @var Algolia_Algoliasearch_Helper_Logger */
11
  protected $logger;
12
 
13
+ public static $product_categories = [];
14
+ protected static $credential_error = false;
15
+
16
  public function __construct()
17
  {
18
  parent::__construct();
19
 
 
20
  $this->config = Mage::helper('algoliasearch/config');
21
  $this->logger = Mage::helper('algoliasearch/logger');
22
  }
23
 
24
+ protected $_matchedEntities = [
25
+ Mage_Catalog_Model_Product::ENTITY => [
26
  Mage_Index_Model_Event::TYPE_SAVE,
27
  Mage_Index_Model_Event::TYPE_MASS_ACTION,
28
+ Mage_Index_Model_Event::TYPE_DELETE,
29
+ ],
30
+ Mage_Catalog_Model_Resource_Eav_Attribute::ENTITY => [
31
  Mage_Index_Model_Event::TYPE_SAVE,
32
  Mage_Index_Model_Event::TYPE_DELETE,
33
+ ],
34
+ Mage_Core_Model_Store::ENTITY => [
35
  Mage_Index_Model_Event::TYPE_SAVE,
36
+ Mage_Index_Model_Event::TYPE_DELETE,
37
+ ],
38
+ Mage_Core_Model_Store_Group::ENTITY => [
 
 
 
 
 
 
 
 
 
39
  Mage_Index_Model_Event::TYPE_SAVE,
40
+ ],
41
+ Mage_Core_Model_Config_Data::ENTITY => [
42
+ Mage_Index_Model_Event::TYPE_SAVE,
43
+ ],
44
+ Mage_Catalog_Model_Convert_Adapter_Product::ENTITY => [
45
+ Mage_Index_Model_Event::TYPE_SAVE,
46
+ ],
47
+ Mage_Catalog_Model_Category::ENTITY => [
48
+ Mage_Index_Model_Event::TYPE_SAVE,
49
+ Mage_Index_Model_Event::TYPE_DELETE,
50
+ ],
51
+ ];
52
 
53
  public function getName()
54
  {
55
+ return Mage::helper('algoliasearch')->__('Algolia Search Products');
56
  }
57
 
58
  public function getDescription()
59
  {
60
+ /** @var Algolia_Algoliasearch_Helper_Data $helper */
61
+ $helper = Mage::helper('algoliasearch');
62
+ $decription = $helper->__('Rebuild products.').' '.$helper->__($this->enableQueueMsg);
63
+
64
+ return $decription;
65
  }
66
 
67
  public function matchEvent(Mage_Index_Model_Event $event)
68
  {
69
+ /** @var Mage_Index_Model_Indexer $indexer */
70
+ $indexer = Mage::getModel('index/indexer');
71
+ $process = $indexer->getProcessByCode('algolia_search_indexer');
72
 
73
  $result = $process->getMode() !== Mage_Index_Model_Process::MODE_MANUAL;
74
 
81
 
82
  protected function _registerEvent(Mage_Index_Model_Event $event)
83
  {
84
+ $event->addNewData(self::EVENT_MATCH_RESULT_KEY, true);
85
  switch ($event->getEntity()) {
86
  case Mage_Catalog_Model_Product::ENTITY:
87
  $this->_registerCatalogProductEvent($event);
88
  break;
89
  case Mage_Catalog_Model_Convert_Adapter_Product::ENTITY:
90
+ $event->addNewData('algoliasearch_reindex_all', true);
91
  break;
92
  case Mage_Core_Model_Store_Group::ENTITY:
93
+ $event->addNewData('algoliasearch_reindex_all', true);
94
  break;
95
  case Mage_CatalogInventory_Model_Stock_Item::ENTITY:
96
+ if (false == $this->config->getShowOutOfStock()) {
97
  $this->_registerCatalogInventoryStockItemEvent($event);
98
+ }
99
  break;
100
  }
101
  }
102
 
103
  protected function _registerCatalogInventoryStockItemEvent(Mage_Index_Model_Event $event)
104
  {
105
+ if ($event->getType() == Mage_Index_Model_Event::TYPE_SAVE) {
 
106
  $object = $event->getDataObject();
107
 
108
+ /** @var Mage_Catalog_Model_Abstract $modelProduct */
109
+ $modelProduct = Mage::getModel('catalog/product');
110
+
111
+ /** @var Mage_Catalog_Model_Product $product */
112
+ $product = $modelProduct->load($object->getProductId());
113
+
114
+ try {
115
+ // In case of wrong credentials or overquota or block account. To avoid checkout process to fail
116
 
 
 
 
117
  $event->addNewData('catalogsearch_update_category_id', $product->getCategoryIds());
118
+ } catch (\Exception $e) {
 
 
119
  $this->logger->log('Error while trying to update stock');
120
  $this->logger->log($e->getMessage());
121
  $this->logger->log($e->getTraceAsString());
129
  case Mage_Index_Model_Event::TYPE_SAVE:
130
  /** @var $product Mage_Catalog_Model_Product */
131
  $product = $event->getDataObject();
132
+
133
  $event->addNewData('catalogsearch_update_product_id', $product->getId());
134
  $event->addNewData('catalogsearch_update_category_id', $product->getCategoryIds());
135
 
136
  /* product_categories is filled in Observer::saveProduct */
137
+ if (isset(static::$product_categories[$product->getId()])) {
 
138
  $oldCategories = static::$product_categories[$product->getId()];
139
  $newCategories = $product->getCategoryIds();
140
 
141
+ $diffCategories = array_merge(array_diff($oldCategories, $newCategories),
142
+ array_diff($newCategories, $oldCategories));
143
 
144
  $event->addNewData('catalogsearch_update_category_id', $diffCategories);
145
  }
146
+ break;
147
 
148
  case Mage_Index_Model_Event::TYPE_DELETE:
 
149
  /** @var $product Mage_Catalog_Model_Product */
150
  $product = $event->getDataObject();
151
+
152
  $event->addNewData('catalogsearch_update_product_id', $product->getId());
153
  $event->addNewData('catalogsearch_update_category_id', $product->getCategoryIds());
154
  break;
155
 
156
  case Mage_Index_Model_Event::TYPE_MASS_ACTION:
157
+ /** @var Varien_Object $actionObject */
158
  $actionObject = $event->getDataObject();
159
 
160
  $event->addNewData('catalogsearch_update_product_id', $actionObject->getProductIds());
 
161
  break;
162
  }
163
 
164
  return $this;
165
  }
166
 
 
 
 
 
 
 
 
167
  protected function _processEvent(Mage_Index_Model_Event $event)
168
  {
169
+ if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) {
170
+ if (self::$credential_error === false) {
171
+ /** @var Mage_Adminhtml_Model_Session $session */
172
+ $session = Mage::getSingleton('adminhtml/session');
173
+ $session->addError('Algolia indexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
174
+
175
  self::$credential_error = true;
176
  }
177
 
183
  /*
184
  * Reindex all products
185
  */
186
+ if (!empty($data['algoliasearch_reindex_all'])) {
187
  $process = $event->getProcess();
188
  $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
189
  }
190
 
191
+ if (!empty($data['catalogsearch_update_category_id'])) {
192
+ $this->reindexSpecificCategories($data['catalogsearch_update_category_id']);
 
 
 
 
 
 
 
 
 
 
193
  }
194
 
195
  /*
196
  * Reindex products.
197
  */
198
+ if (!empty($data['catalogsearch_update_product_id'])) {
199
+ $this->reindexSpecificProducts($data['catalogsearch_update_product_id']);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
200
  }
201
  }
202
 
203
  /**
204
+ * Rebuild all index data.
205
  */
206
  public function reindexAll()
207
  {
208
+ if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) {
209
+ /** @var Mage_Adminhtml_Model_Session $session */
210
+ $session = Mage::getSingleton('adminhtml/session');
211
+ $session->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
212
+
213
  $this->logger->log('ERROR Credentials not configured correctly');
214
+
215
  return;
216
  }
217
 
app/code/community/Algolia/Algoliasearch/Model/Indexer/Algoliaadditionalsections.php CHANGED
@@ -1,11 +1,13 @@
1
  <?php
2
 
3
- class Algolia_Algoliasearch_Model_Indexer_Algoliaadditionalsections extends Mage_Index_Model_Indexer_Abstract
4
  {
5
  const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';
6
 
7
  /** @var Algolia_Algoliasearch_Model_Resource_Engine */
8
  protected $engine;
 
 
9
  protected $config;
10
 
11
  public function __construct()
@@ -16,7 +18,7 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliaadditionalsections extends Mage
16
  $this->config = Mage::helper('algoliasearch/config');
17
  }
18
 
19
- protected $_matchedEntities = array();
20
 
21
  protected function _getResource()
22
  {
@@ -30,8 +32,11 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliaadditionalsections extends Mage
30
 
31
  public function getDescription()
32
  {
33
- return Mage::helper('algoliasearch')->__('Rebuild additional sections.
34
- Please enable the queueing system to do it asynchronously (CRON) if you have a lot of products in System > Configuration > Algolia Search > Queue configuration');
 
 
 
35
  }
36
 
37
  public function matchEvent(Mage_Index_Model_Event $event)
@@ -59,13 +64,15 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliaadditionalsections extends Mage
59
  }
60
 
61
  /**
62
- * Rebuild all index data
63
  */
64
  public function reindexAll()
65
  {
66
- if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
67
- {
68
- Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
 
 
69
  return;
70
  }
71
 
1
  <?php
2
 
3
+ class Algolia_Algoliasearch_Model_Indexer_Algoliaadditionalsections extends Algolia_Algoliasearch_Model_Indexer_Abstract
4
  {
5
  const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';
6
 
7
  /** @var Algolia_Algoliasearch_Model_Resource_Engine */
8
  protected $engine;
9
+
10
+ /** @var Algolia_Algoliasearch_Helper_Config */
11
  protected $config;
12
 
13
  public function __construct()
18
  $this->config = Mage::helper('algoliasearch/config');
19
  }
20
 
21
+ protected $_matchedEntities = [];
22
 
23
  protected function _getResource()
24
  {
32
 
33
  public function getDescription()
34
  {
35
+ /** @var Algolia_Algoliasearch_Helper_Data $helper */
36
+ $helper = Mage::helper('algoliasearch');
37
+ $decription = $helper->__('Rebuild additional sections.').' '.$helper->__($this->enableQueueMsg);
38
+
39
+ return $decription;
40
  }
41
 
42
  public function matchEvent(Mage_Index_Model_Event $event)
64
  }
65
 
66
  /**
67
+ * Rebuild all index data.
68
  */
69
  public function reindexAll()
70
  {
71
+ if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) {
72
+ /** @var Mage_Adminhtml_Model_Session $session */
73
+ $session = Mage::getSingleton('adminhtml/session');
74
+ $session->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
75
+
76
  return;
77
  }
78
 
app/code/community/Algolia/Algoliasearch/Model/Indexer/Algoliacategories.php CHANGED
@@ -1,11 +1,10 @@
1
  <?php
2
 
3
- class Algolia_Algoliasearch_Model_Indexer_Algoliacategories extends Mage_Index_Model_Indexer_Abstract
4
  {
5
  const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';
6
 
7
- /** @var Algolia_Algoliasearch_Model_Resource_Engine */
8
- protected $engine;
9
  protected $config;
10
 
11
  protected static $credential_error = false;
@@ -14,21 +13,15 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliacategories extends Mage_Index_M
14
  {
15
  parent::__construct();
16
 
17
- $this->engine = new Algolia_Algoliasearch_Model_Resource_Engine();
18
  $this->config = Mage::helper('algoliasearch/config');
19
  }
20
 
21
- protected $_matchedEntities = array(
22
- Mage_Catalog_Model_Category::ENTITY => array(
23
  Mage_Index_Model_Event::TYPE_SAVE,
24
- Mage_Index_Model_Event::TYPE_DELETE
25
- )
26
- );
27
-
28
- protected function _getResource()
29
- {
30
- return Mage::getResourceSingleton('catalogsearch/indexer_fulltext');
31
- }
32
 
33
  public function getName()
34
  {
@@ -37,13 +30,16 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliacategories extends Mage_Index_M
37
 
38
  public function getDescription()
39
  {
40
- return Mage::helper('algoliasearch')->__('Rebuild category index.
41
- Please enable the queueing system to do it asynchronously (CRON) if you have a lot of products in System > Configuration > Algolia Search > Queue configuration');
 
 
 
42
  }
43
 
44
  public function matchEvent(Mage_Index_Model_Event $event)
45
  {
46
- $result = $event->getEntity() !== 'core_config_data';;
47
 
48
  $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
49
 
@@ -52,7 +48,7 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliacategories extends Mage_Index_M
52
 
53
  protected function _registerEvent(Mage_Index_Model_Event $event)
54
  {
55
- $event->addNewData(self::EVENT_MATCH_RESULT_KEY, TRUE);
56
 
57
  switch ($event->getEntity()) {
58
  case Mage_Catalog_Model_Category::ENTITY:
@@ -66,31 +62,24 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliacategories extends Mage_Index_M
66
  switch ($event->getType()) {
67
  case Mage_Index_Model_Event::TYPE_SAVE:
68
 
69
- /** @var $category Mage_Catalog_Model_Category */
70
- $category = $event->getDataObject();
71
  $productIds = $category->getAffectedProductIds();
72
 
73
- if (! $category->getData('is_active'))
74
- {
75
- $event->addNewData('catalogsearch_delete_category_id', array_merge(array($category->getId()), $category->getAllChildren(TRUE)));
76
 
77
- if ($productIds)
78
- {
79
  $event->addNewData('catalogsearch_update_product_id', $productIds);
80
  }
81
- }
82
- elseif ($productIds)
83
- {
84
  $event->addNewData('catalogsearch_update_product_id', $productIds);
85
- $event->addNewData('catalogsearch_update_category_id', array($category->getId()));
86
- }
87
- elseif ($movedCategoryId = $category->getMovedCategoryId())
88
- {
89
- $event->addNewData('catalogsearch_update_category_id', array($movedCategoryId));
90
- }
91
- else
92
- {
93
- $event->addNewData('catalogsearch_update_category_id', array($category->getId()));
94
  }
95
 
96
  break;
@@ -108,20 +97,14 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliacategories extends Mage_Index_M
108
  return $this;
109
  }
110
 
111
- protected function _isProductComposite($productId)
112
- {
113
- /** @var $product Mage_Catalog_Model_Product */
114
- $product = Mage::getModel('catalog/product')->load($productId);
115
- return $product->isComposite();
116
- }
117
-
118
  protected function _processEvent(Mage_Index_Model_Event $event)
119
  {
120
- if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
121
- {
122
- if (self::$credential_error === false)
123
- {
124
- Mage::getSingleton('adminhtml/session')->addError('Algolia indexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
 
125
  self::$credential_error = true;
126
  }
127
 
@@ -133,26 +116,25 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliacategories extends Mage_Index_M
133
  /*
134
  * Reindex all products and all categories and update index settings
135
  */
136
- if ( ! empty($data['algoliasearch_reindex_all'])) {
137
  $process = $event->getProcess();
138
  $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
139
- }
140
-
141
- /*
142
- * Clear indexer for the deleted category including all children categories and update index for the related products.
143
- */
144
- else if ( ! empty($data['catalogsearch_delete_category_id'])) {
145
- $categoryIds = $data['catalogsearch_delete_category_id'];
146
- $this->engine
147
- ->removeCategories(null, $categoryIds);
148
  /*
149
- * Change indexer status as need to reindex related products to update the list of categories.
150
- * It's low priority so no need to automatically reindex all related products after deleting each category.
151
- * Do not reindex all if affected products are given or product count is not indexed.
152
  */
153
- if ( ! isset($data['catalogsearch_update_product_id'])) {
154
- $process = $event->getProcess();
155
- $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
 
 
 
 
 
 
 
 
 
156
  }
157
  }
158
 
@@ -160,32 +142,30 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliacategories extends Mage_Index_M
160
  * Reindex categories.
161
  * Category products are tracked separately. The specified categories are active. See _registerCatalogCategoryEvent().
162
  */
163
- if ( ! empty($data['catalogsearch_update_category_id'])) {
164
- $updateCategoryIds = $data['catalogsearch_update_category_id'];
165
- $updateCategoryIds = is_array($updateCategoryIds) ? $updateCategoryIds : array($updateCategoryIds);
166
-
167
- foreach ($updateCategoryIds as $id)
168
- {
169
- $categories = Mage::getModel('catalog/category')->getCategories($id);
170
-
171
- foreach ($categories as $category)
172
- $updateCategoryIds[] = $category->getId();
173
- }
174
 
175
- $this->engine
176
- ->rebuildCategoryIndex(null, $updateCategoryIds);
 
 
 
 
177
  }
178
  }
179
 
180
  /**
181
- * Rebuild all index data
182
  */
183
  public function reindexAll()
184
  {
185
- if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
186
- {
187
- Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
188
- return;
 
 
189
  }
190
 
191
  $this->engine->rebuildCategories();
1
  <?php
2
 
3
+ class Algolia_Algoliasearch_Model_Indexer_Algoliacategories extends Algolia_Algoliasearch_Model_Indexer_Abstract
4
  {
5
  const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';
6
 
7
+ /** @var Algolia_Algoliasearch_Helper_Config */
 
8
  protected $config;
9
 
10
  protected static $credential_error = false;
13
  {
14
  parent::__construct();
15
 
 
16
  $this->config = Mage::helper('algoliasearch/config');
17
  }
18
 
19
+ protected $_matchedEntities = [
20
+ Mage_Catalog_Model_Category::ENTITY => [
21
  Mage_Index_Model_Event::TYPE_SAVE,
22
+ Mage_Index_Model_Event::TYPE_DELETE,
23
+ ],
24
+ ];
 
 
 
 
 
25
 
26
  public function getName()
27
  {
30
 
31
  public function getDescription()
32
  {
33
+ /** @var Algolia_Algoliasearch_Helper_Data $helper */
34
+ $helper = Mage::helper('algoliasearch');
35
+ $decription = $helper->__('Rebuild categories.').' '.$helper->__($this->enableQueueMsg);
36
+
37
+ return $decription;
38
  }
39
 
40
  public function matchEvent(Mage_Index_Model_Event $event)
41
  {
42
+ $result = $event->getEntity() !== 'core_config_data';
43
 
44
  $event->addNewData(self::EVENT_MATCH_RESULT_KEY, $result);
45
 
48
 
49
  protected function _registerEvent(Mage_Index_Model_Event $event)
50
  {
51
+ $event->addNewData(self::EVENT_MATCH_RESULT_KEY, true);
52
 
53
  switch ($event->getEntity()) {
54
  case Mage_Catalog_Model_Category::ENTITY:
62
  switch ($event->getType()) {
63
  case Mage_Index_Model_Event::TYPE_SAVE:
64
 
65
+ /** @var Mage_Catalog_Model_Category $category*/
66
+ $category = $event->getDataObject();
67
  $productIds = $category->getAffectedProductIds();
68
 
69
+ if (!$category->getData('is_active')) {
70
+ $event->addNewData('catalogsearch_delete_category_id',
71
+ array_merge([$category->getId()], $category->getAllChildren(true)));
72
 
73
+ if ($productIds) {
 
74
  $event->addNewData('catalogsearch_update_product_id', $productIds);
75
  }
76
+ } elseif ($productIds) {
 
 
77
  $event->addNewData('catalogsearch_update_product_id', $productIds);
78
+ $event->addNewData('catalogsearch_update_category_id', [$category->getId()]);
79
+ } elseif ($movedCategoryId = $category->getMovedCategoryId()) {
80
+ $event->addNewData('catalogsearch_update_category_id', [$movedCategoryId]);
81
+ } else {
82
+ $event->addNewData('catalogsearch_update_category_id', [$category->getId()]);
 
 
 
 
83
  }
84
 
85
  break;
97
  return $this;
98
  }
99
 
 
 
 
 
 
 
 
100
  protected function _processEvent(Mage_Index_Model_Event $event)
101
  {
102
+ if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) {
103
+ if (self::$credential_error === false) {
104
+ /** @var Mage_Adminhtml_Model_Session $session */
105
+ $session = Mage::getSingleton('adminhtml/session');
106
+ $session->addError('Algolia indexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
107
+
108
  self::$credential_error = true;
109
  }
110
 
116
  /*
117
  * Reindex all products and all categories and update index settings
118
  */
119
+ if (!empty($data['algoliasearch_reindex_all'])) {
120
  $process = $event->getProcess();
121
  $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
122
+ } else {
 
 
 
 
 
 
 
 
123
  /*
124
+ * Clear indexer for the deleted category including all children categories and update index for the related products.
 
 
125
  */
126
+ if (!empty($data['catalogsearch_delete_category_id'])) {
127
+ $categoryIds = $data['catalogsearch_delete_category_id'];
128
+ $this->engine->removeCategories(null, $categoryIds);
129
+ /*
130
+ * Change indexer status as need to reindex related products to update the list of categories.
131
+ * It's low priority so no need to automatically reindex all related products after deleting each category.
132
+ * Do not reindex all if affected products are given or product count is not indexed.
133
+ */
134
+ if (!isset($data['catalogsearch_update_product_id'])) {
135
+ $process = $event->getProcess();
136
+ $process->changeStatus(Mage_Index_Model_Process::STATUS_REQUIRE_REINDEX);
137
+ }
138
  }
139
  }
140
 
142
  * Reindex categories.
143
  * Category products are tracked separately. The specified categories are active. See _registerCatalogCategoryEvent().
144
  */
145
+ if (!empty($data['catalogsearch_update_category_id'])) {
146
+ $this->reindexSpecificCategories($data['catalogsearch_update_category_id']);
147
+ }
 
 
 
 
 
 
 
 
148
 
149
+ /*
150
+ * If we have added any new products to a category then we need to
151
+ * update these products in Algolia indices.
152
+ */
153
+ if ($this->config->indexProductOnCategoryProductsUpdate() && !empty($data['catalogsearch_update_product_id'])) {
154
+ $this->reindexSpecificProducts($data['catalogsearch_update_product_id']);
155
  }
156
  }
157
 
158
  /**
159
+ * Rebuild all index data.
160
  */
161
  public function reindexAll()
162
  {
163
+ if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) {
164
+ /** @var Mage_Adminhtml_Model_Session $session */
165
+ $session = Mage::getSingleton('adminhtml/session');
166
+ $session->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
167
+
168
+ return $this;
169
  }
170
 
171
  $this->engine->rebuildCategories();
app/code/community/Algolia/Algoliasearch/Model/Indexer/Algoliapages.php CHANGED
@@ -1,11 +1,13 @@
1
  <?php
2
 
3
- class Algolia_Algoliasearch_Model_Indexer_Algoliapages extends Mage_Index_Model_Indexer_Abstract
4
  {
5
  const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';
6
 
7
  /** @var Algolia_Algoliasearch_Model_Resource_Engine */
8
  protected $engine;
 
 
9
  protected $config;
10
 
11
  public function __construct()
@@ -16,7 +18,7 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliapages extends Mage_Index_Model_
16
  $this->config = Mage::helper('algoliasearch/config');
17
  }
18
 
19
- protected $_matchedEntities = array();
20
 
21
  protected function _getResource()
22
  {
@@ -30,8 +32,11 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliapages extends Mage_Index_Model_
30
 
31
  public function getDescription()
32
  {
33
- return Mage::helper('algoliasearch')->__('Rebuild pages.
34
- Please enable the queueing system to do it asynchronously (CRON) if you have a lot of products in System > Configuration > Algolia Search > Queue configuration');
 
 
 
35
  }
36
 
37
  public function matchEvent(Mage_Index_Model_Event $event)
@@ -59,13 +64,15 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliapages extends Mage_Index_Model_
59
  }
60
 
61
  /**
62
- * Rebuild all index data
63
  */
64
  public function reindexAll()
65
  {
66
- if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
67
- {
68
- Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
 
 
69
  return;
70
  }
71
 
1
  <?php
2
 
3
+ class Algolia_Algoliasearch_Model_Indexer_Algoliapages extends Algolia_Algoliasearch_Model_Indexer_Abstract
4
  {
5
  const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';
6
 
7
  /** @var Algolia_Algoliasearch_Model_Resource_Engine */
8
  protected $engine;
9
+
10
+ /** @var Algolia_Algoliasearch_Helper_Config */
11
  protected $config;
12
 
13
  public function __construct()
18
  $this->config = Mage::helper('algoliasearch/config');
19
  }
20
 
21
+ protected $_matchedEntities = [];
22
 
23
  protected function _getResource()
24
  {
32
 
33
  public function getDescription()
34
  {
35
+ /** @var Algolia_Algoliasearch_Helper_Data $helper */
36
+ $helper = Mage::helper('algoliasearch');
37
+ $decription = $helper->__('Rebuild pages.').' '.$helper->__($this->enableQueueMsg);
38
+
39
+ return $decription;
40
  }
41
 
42
  public function matchEvent(Mage_Index_Model_Event $event)
64
  }
65
 
66
  /**
67
+ * Rebuild all index data.
68
  */
69
  public function reindexAll()
70
  {
71
+ if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) {
72
+ /** @var Mage_Adminhtml_Model_Session $session */
73
+ $session = Mage::getSingleton('adminhtml/session');
74
+ $session->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
75
+
76
  return;
77
  }
78
 
app/code/community/Algolia/Algoliasearch/Model/Indexer/Algoliaqueuerunner.php CHANGED
@@ -3,7 +3,10 @@
3
  class Algolia_Algoliasearch_Model_Indexer_Algoliaqueuerunner extends Mage_Index_Model_Indexer_Abstract
4
  {
5
  const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';
 
 
6
  protected $config;
 
7
  /** @var Algolia_Algoliasearch_Model_Queue */
8
  protected $queue;
9
 
@@ -14,7 +17,7 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliaqueuerunner extends Mage_Index_
14
  $this->queue = Mage::getSingleton('algoliasearch/queue');
15
  }
16
 
17
- protected $_matchedEntities = array();
18
 
19
  protected function _getResource()
20
  {
@@ -56,13 +59,15 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliaqueuerunner extends Mage_Index_
56
  }
57
 
58
  /**
59
- * Rebuild all index data
60
  */
61
  public function reindexAll()
62
  {
63
- if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
64
- {
65
- Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
 
 
66
  return;
67
  }
68
 
3
  class Algolia_Algoliasearch_Model_Indexer_Algoliaqueuerunner extends Mage_Index_Model_Indexer_Abstract
4
  {
5
  const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';
6
+
7
+ /** @var Algolia_Algoliasearch_Helper_Config */
8
  protected $config;
9
+
10
  /** @var Algolia_Algoliasearch_Model_Queue */
11
  protected $queue;
12
 
17
  $this->queue = Mage::getSingleton('algoliasearch/queue');
18
  }
19
 
20
+ protected $_matchedEntities = [];
21
 
22
  protected function _getResource()
23
  {
59
  }
60
 
61
  /**
62
+ * Rebuild all index data.
63
  */
64
  public function reindexAll()
65
  {
66
+ if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) {
67
+ /** @var Mage_Adminhtml_Model_Session $session */
68
+ $session = Mage::getSingleton('adminhtml/session');
69
+ $session->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
70
+
71
  return;
72
  }
73
 
app/code/community/Algolia/Algoliasearch/Model/Indexer/Algoliasuggestions.php CHANGED
@@ -1,11 +1,13 @@
1
  <?php
2
 
3
- class Algolia_Algoliasearch_Model_Indexer_Algoliasuggestions extends Mage_Index_Model_Indexer_Abstract
4
  {
5
  const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';
6
 
7
  /** @var Algolia_Algoliasearch_Model_Resource_Engine */
8
  protected $engine;
 
 
9
  protected $config;
10
 
11
  public function __construct()
@@ -16,7 +18,7 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliasuggestions extends Mage_Index_
16
  $this->config = Mage::helper('algoliasearch/config');
17
  }
18
 
19
- protected $_matchedEntities = array();
20
 
21
  protected function _getResource()
22
  {
@@ -30,8 +32,11 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliasuggestions extends Mage_Index_
30
 
31
  public function getDescription()
32
  {
33
- return Mage::helper('algoliasearch')->__('Rebuild suggestions.
34
- Please enable the queueing system to do it asynchronously (CRON) if you have a lot of products in System > Configuration > Algolia Search > Queue configuration');
 
 
 
35
  }
36
 
37
  public function matchEvent(Mage_Index_Model_Event $event)
@@ -63,13 +68,15 @@ class Algolia_Algoliasearch_Model_Indexer_Algoliasuggestions extends Mage_Index_
63
  }
64
 
65
  /**
66
- * Rebuild all index data
67
  */
68
  public function reindexAll()
69
  {
70
- if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
71
- {
72
- Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
 
 
73
  return;
74
  }
75
 
1
  <?php
2
 
3
+ class Algolia_Algoliasearch_Model_Indexer_Algoliasuggestions extends Algolia_Algoliasearch_Model_Indexer_Abstract
4
  {
5
  const EVENT_MATCH_RESULT_KEY = 'algoliasearch_match_result';
6
 
7
  /** @var Algolia_Algoliasearch_Model_Resource_Engine */
8
  protected $engine;
9
+
10
+ /** @var Algolia_Algoliasearch_Helper_Config */
11
  protected $config;
12
 
13
  public function __construct()
18
  $this->config = Mage::helper('algoliasearch/config');
19
  }
20
 
21
+ protected $_matchedEntities = [];
22
 
23
  protected function _getResource()
24
  {
32
 
33
  public function getDescription()
34
  {
35
+ /** @var Algolia_Algoliasearch_Helper_Data $helper */
36
+ $helper = Mage::helper('algoliasearch');
37
+ $decription = $helper->__('Rebuild suggestions.').' '.$helper->__($this->enableQueueMsg);
38
+
39
+ return $decription;
40
  }
41
 
42
  public function matchEvent(Mage_Index_Model_Event $event)
68
  }
69
 
70
  /**
71
+ * Rebuild all index data.
72
  */
73
  public function reindexAll()
74
  {
75
+ if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) {
76
+ /** @var Mage_Adminhtml_Model_Session $session */
77
+ $session = Mage::getSingleton('adminhtml/session');
78
+ $session->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
79
+
80
  return;
81
  }
82
 
app/code/community/Algolia/Algoliasearch/Model/Observer.php CHANGED
@@ -1,66 +1,74 @@
1
  <?php
2
 
3
  /**
4
- * Algolia search observer model
5
  */
6
  class Algolia_Algoliasearch_Model_Observer
7
  {
 
8
  protected $config;
 
 
9
  protected $product_helper;
 
 
 
 
 
 
 
 
10
  protected $helper;
11
 
12
  public function __construct()
13
  {
14
- $this->config = Mage::helper('algoliasearch/config');
15
- $this->product_helper = Mage::helper('algoliasearch/entity_producthelper');
16
- $this->category_helper = Mage::helper('algoliasearch/entity_categoryhelper');
17
- $this->suggestion_helper = Mage::helper('algoliasearch/entity_suggestionhelper');
18
-
19
- $this->helper = Mage::helper('algoliasearch');
20
  }
21
 
22
  /**
23
- * On config save
24
  */
25
  public function configSaved(Varien_Event_Observer $observer)
26
  {
27
  $this->saveSettings();
28
  }
29
 
30
- public function saveSettings()
31
  {
32
- foreach (Mage::app()->getStores() as $store) /** @var $store Mage_Core_Model_Store */
33
- if ($store->getIsActive())
34
- $this->helper->saveConfigurationToAlgolia($store->getId());
 
 
 
35
  }
36
 
37
  public function addBundleToAdmin(Varien_Event_Observer $observer)
38
  {
39
- $req = Mage::app()->getRequest();
40
 
41
- if (strpos($req->getPathInfo(), 'system_config/edit/section/algoliasearch') !== false)
42
  $observer->getLayout()->getUpdate()->addHandle('algolia_bundle_handle');
 
43
  }
44
 
45
  /**
46
- * Call algoliasearch.xml To load js / css / phtml
47
  */
48
  public function useAlgoliaSearchPopup(Varien_Event_Observer $observer)
49
  {
50
- if ($this->config->isEnabledFrontEnd())
51
- {
52
- if ($this->config->getApplicationID() && $this->config->getAPIKey())
53
- {
54
- if ($this->config->isPopupEnabled() || $this->config->isInstantEnabled())
55
- {
56
  $observer->getLayout()->getUpdate()->addHandle('algolia_search_handle');
57
 
58
- if ($this->config->isDefaultSelector())
59
- {
60
  $observer->getLayout()->getUpdate()->addHandle('algolia_search_handle_with_topsearch');
61
- }
62
- else
63
- {
64
  $observer->getLayout()->getUpdate()->addHandle('algolia_search_handle_no_topsearch');
65
  }
66
  }
@@ -92,14 +100,6 @@ class Algolia_Algoliasearch_Model_Observer
92
  $this->helper->deleteCategoriesStoreIndices($storeId);
93
  }
94
 
95
- public function removeProducts(Varien_Object $event)
96
- {
97
- $storeId = $event->getStoreId();
98
- $product_ids = $event->getProductIds();
99
-
100
- $this->helper->removeProducts($product_ids, $storeId);
101
- }
102
-
103
  public function removeCategories(Varien_Object $event)
104
  {
105
  $storeId = $event->getStoreId();
@@ -129,22 +129,21 @@ class Algolia_Algoliasearch_Model_Observer
129
  $page = $event->getPage();
130
  $pageSize = $event->getPageSize();
131
 
132
- if (is_null($storeId) && ! empty($categoryIds))
133
- {
134
- foreach (Mage::app()->getStores() as $storeId => $store)
135
- {
136
- if ( ! $store->getIsActive())
137
  continue;
 
138
 
139
- $this->helper->rebuildStoreSuggestionIndex($storeId, $categoryIds);
140
  }
141
- }
142
- else
143
- {
144
- if (! empty($page) && ! empty($pageSize))
145
- $this->helper->rebuildStoreSuggestionIndexPage($storeId, $this->suggestion_helper->getSuggestionCollectionQuery($storeId), $page, $pageSize);
146
- else
147
  $this->helper->rebuildStoreSuggestionIndex($storeId);
 
148
  }
149
 
150
  return $this;
@@ -165,28 +164,26 @@ class Algolia_Algoliasearch_Model_Observer
165
  $page = $event->getPage();
166
  $pageSize = $event->getPageSize();
167
 
168
- if (is_null($storeId) && ! empty($categoryIds))
169
- {
170
- foreach (Mage::app()->getStores() as $storeId => $store)
171
- {
172
- if ( ! $store->getIsActive())
173
  continue;
 
174
 
175
  $this->helper->rebuildStoreCategoryIndex($storeId, $categoryIds);
176
  }
177
- }
178
- else
179
- {
180
- if (! empty($page) && ! empty($pageSize))
181
- $this->helper->rebuildStoreCategoryIndexPage($storeId, $this->category_helper->getCategoryCollectionQuery($storeId, $categoryIds), $page, $pageSize);
182
- else
183
  $this->helper->rebuildStoreCategoryIndex($storeId, $categoryIds);
 
184
  }
185
 
186
  return $this;
187
  }
188
 
189
-
190
  public function rebuildProductIndex(Varien_Object $event)
191
  {
192
  $storeId = $event->getStoreId();
@@ -195,24 +192,32 @@ class Algolia_Algoliasearch_Model_Observer
195
  $page = $event->getPage();
196
  $pageSize = $event->getPageSize();
197
 
198
- if (is_null($storeId) && ! empty($productIds))
199
- {
200
- foreach (Mage::app()->getStores() as $storeId => $store)
201
- {
202
- if ( ! $store->getIsActive())
203
  continue;
 
204
 
205
  $this->helper->rebuildStoreProductIndex($storeId, $productIds);
206
  }
207
- }
208
- else
209
- {
210
- if (! empty($page) && ! empty($pageSize))
211
- $this->helper->rebuildStoreProductIndexPage($storeId, $this->product_helper->getProductCollectionQuery($storeId, $productIds), $page, $pageSize);
212
- else
213
  $this->helper->rebuildStoreProductIndex($storeId, $productIds);
 
214
  }
215
 
216
  return $this;
217
  }
 
 
 
 
 
 
 
218
  }
1
  <?php
2
 
3
  /**
4
+ * Algolia search observer model.
5
  */
6
  class Algolia_Algoliasearch_Model_Observer
7
  {
8
+ /** @var Algolia_Algoliasearch_Helper_Config */
9
  protected $config;
10
+
11
+ /** @var Algolia_Algoliasearch_Helper_Entity_Producthelper */
12
  protected $product_helper;
13
+
14
+ /** @var Algolia_Algoliasearch_Helper_Entity_Categoryhelper **/
15
+ protected $category_helper;
16
+
17
+ /** @var Algolia_Algoliasearch_Helper_Entity_Suggestionhelper */
18
+ protected $suggestion_helper;
19
+
20
+ /** @var Algolia_Algoliasearch_Helper_Data */
21
  protected $helper;
22
 
23
  public function __construct()
24
  {
25
+ $this->config = Mage::helper('algoliasearch/config');
26
+ $this->product_helper = Mage::helper('algoliasearch/entity_producthelper');
27
+ $this->category_helper = Mage::helper('algoliasearch/entity_categoryhelper');
28
+ $this->suggestion_helper = Mage::helper('algoliasearch/entity_suggestionhelper');
29
+ $this->helper = Mage::helper('algoliasearch');
 
30
  }
31
 
32
  /**
33
+ * On config save.
34
  */
35
  public function configSaved(Varien_Event_Observer $observer)
36
  {
37
  $this->saveSettings();
38
  }
39
 
40
+ public function saveSettings($isFullProductReindex = false)
41
  {
42
+ foreach (Mage::app()->getStores() as $store) {/* @var $store Mage_Core_Model_Store */
43
+ if ($store->getIsActive()) {
44
+ $saveToTmpIndicesToo = ($isFullProductReindex && $this->config->isQueueActive($store->getId()));
45
+ $this->helper->saveConfigurationToAlgolia($store->getId(), $saveToTmpIndicesToo);
46
+ }
47
+ }
48
  }
49
 
50
  public function addBundleToAdmin(Varien_Event_Observer $observer)
51
  {
52
+ $req = Mage::app()->getRequest();
53
 
54
+ if (strpos($req->getPathInfo(), 'system_config/edit/section/algoliasearch') !== false) {
55
  $observer->getLayout()->getUpdate()->addHandle('algolia_bundle_handle');
56
+ }
57
  }
58
 
59
  /**
60
+ * Call algoliasearch.xml To load js / css / phtml.
61
  */
62
  public function useAlgoliaSearchPopup(Varien_Event_Observer $observer)
63
  {
64
+ if ($this->config->isEnabledFrontEnd()) {
65
+ if ($this->config->getApplicationID() && $this->config->getAPIKey()) {
66
+ if ($this->config->isPopupEnabled() || $this->config->isInstantEnabled()) {
 
 
 
67
  $observer->getLayout()->getUpdate()->addHandle('algolia_search_handle');
68
 
69
+ if ($this->config->isDefaultSelector()) {
 
70
  $observer->getLayout()->getUpdate()->addHandle('algolia_search_handle_with_topsearch');
71
+ } else {
 
 
72
  $observer->getLayout()->getUpdate()->addHandle('algolia_search_handle_no_topsearch');
73
  }
74
  }
100
  $this->helper->deleteCategoriesStoreIndices($storeId);
101
  }
102
 
 
 
 
 
 
 
 
 
103
  public function removeCategories(Varien_Object $event)
104
  {
105
  $storeId = $event->getStoreId();
129
  $page = $event->getPage();
130
  $pageSize = $event->getPageSize();
131
 
132
+ if (is_null($storeId) && !empty($categoryIds)) {
133
+ foreach (Mage::app()->getStores() as $storeId => $store) {
134
+ if (!$store->getIsActive()) {
 
 
135
  continue;
136
+ }
137
 
138
+ $this->helper->rebuildStoreSuggestionIndex($storeId);
139
  }
140
+ } else {
141
+ if (!empty($page) && !empty($pageSize)) {
142
+ $this->helper->rebuildStoreSuggestionIndexPage($storeId,
143
+ $this->suggestion_helper->getSuggestionCollectionQuery($storeId), $page, $pageSize);
144
+ } else {
 
145
  $this->helper->rebuildStoreSuggestionIndex($storeId);
146
+ }
147
  }
148
 
149
  return $this;
164
  $page = $event->getPage();
165
  $pageSize = $event->getPageSize();
166
 
167
+ if (is_null($storeId) && !empty($categoryIds)) {
168
+ foreach (Mage::app()->getStores() as $storeId => $store) {
169
+ if (!$store->getIsActive()) {
 
 
170
  continue;
171
+ }
172
 
173
  $this->helper->rebuildStoreCategoryIndex($storeId, $categoryIds);
174
  }
175
+ } else {
176
+ if (!empty($page) && !empty($pageSize)) {
177
+ $this->helper->rebuildStoreCategoryIndexPage($storeId,
178
+ $this->category_helper->getCategoryCollectionQuery($storeId, $categoryIds), $page, $pageSize);
179
+ } else {
 
180
  $this->helper->rebuildStoreCategoryIndex($storeId, $categoryIds);
181
+ }
182
  }
183
 
184
  return $this;
185
  }
186
 
 
187
  public function rebuildProductIndex(Varien_Object $event)
188
  {
189
  $storeId = $event->getStoreId();
192
  $page = $event->getPage();
193
  $pageSize = $event->getPageSize();
194
 
195
+ $useTmpIndex = (bool) $event->getUseTmpIndex();
196
+
197
+ if (is_null($storeId) && !empty($productIds)) {
198
+ foreach (Mage::app()->getStores() as $storeId => $store) {
199
+ if (!$store->getIsActive()) {
200
  continue;
201
+ }
202
 
203
  $this->helper->rebuildStoreProductIndex($storeId, $productIds);
204
  }
205
+ } else {
206
+ if (!empty($page) && !empty($pageSize)) {
207
+ $collection = $this->product_helper->getProductCollectionQuery($storeId, $productIds, $useTmpIndex);
208
+ $this->helper->rebuildStoreProductIndexPage($storeId, $collection, $page, $pageSize, null, $productIds, $useTmpIndex);
209
+ } else {
 
210
  $this->helper->rebuildStoreProductIndex($storeId, $productIds);
211
+ }
212
  }
213
 
214
  return $this;
215
  }
216
+
217
+ public function moveProductsTmpIndex(Varien_Object $event)
218
+ {
219
+ $storeId = $event->getStoreId();
220
+
221
+ $this->helper->moveProductsIndex($storeId);
222
+ }
223
  }
app/code/community/Algolia/Algoliasearch/Model/Queue.php CHANGED
@@ -3,12 +3,14 @@
3
  class Algolia_Algoliasearch_Model_Queue
4
  {
5
  const SUCCESS_LOG = 'algoliasearch_queue_log.txt';
6
- const ERROR_LOG = 'algoliasearch_queue_errors.log';
7
 
8
  protected $table;
9
  protected $db;
10
 
 
11
  protected $config;
 
12
  /** @var Algolia_Algoliasearch_Helper_Logger */
13
  protected $logger;
14
 
@@ -16,8 +18,11 @@ class Algolia_Algoliasearch_Model_Queue
16
 
17
  public function __construct()
18
  {
19
- $this->table = Mage::getSingleton('core/resource')->getTableName('algoliasearch/queue');
20
- $this->db = Mage::getSingleton('core/resource')->getConnection('core_write');
 
 
 
21
 
22
  $this->config = Mage::helper('algoliasearch/config');
23
  $this->logger = Mage::helper('algoliasearch/logger');
@@ -28,53 +33,59 @@ class Algolia_Algoliasearch_Model_Queue
28
  public function add($class, $method, $data, $data_size)
29
  {
30
  // Insert a row for the new job
31
- $this->db->insert($this->table, array(
32
- 'class' => $class,
33
- 'method' => $method,
34
- 'data' => json_encode($data),
35
  'data_size' => $data_size,
36
- 'pid' => NULL,
37
- ));
38
  }
39
 
40
  public function runCron()
41
  {
42
- if ( ! $this->config->isQueueActive())
43
  return;
 
44
 
45
  $nbJobs = $this->config->getNumberOfJobToRun();
46
 
47
- if (getenv('EMPTY_QUEUE') && getenv('EMPTY_QUEUE') == '1')
48
  $nbJobs = -1;
49
-
50
 
51
  $this->run($nbJobs);
52
  }
53
 
54
  protected function mergeable($j1, $j2)
55
  {
56
- if ($j1['class'] !== $j2['class'])
57
  return false;
 
58
 
59
- if ($j1['method'] !== $j2['method'])
60
  return false;
 
61
 
62
- if ($j1['data']['store_id'] !== $j2['data']['store_id'])
63
  return false;
 
64
 
65
- if ((! isset($j1['data']['product_ids']) || count($j1['data']['product_ids']) <= 0)
66
- && (! isset($j1['data']['category_ids']) || count($j1['data']['category_ids']) < 0))
67
  return false;
 
68
 
69
- if ((! isset($j2['data']['product_ids']) || count($j2['data']['product_ids']) <= 0)
70
- && (! isset($j2['data']['category_ids']) || count($j2['data']['category_ids']) < 0))
71
  return false;
 
72
 
73
- if (isset($j1['data']['product_ids']) && count($j1['data']['product_ids']) + count($j2['data']['product_ids']) > $this->by_page)
74
  return false;
 
75
 
76
- if (isset($j1['data']['category_ids']) && count($j1['data']['category_ids']) + count($j2['data']['category_ids']) > $this->by_page)
77
  return false;
 
78
 
79
  return true;
80
  }
@@ -82,38 +93,46 @@ class Algolia_Algoliasearch_Model_Queue
82
  protected function sortAndMergeJob($old_jobs)
83
  {
84
  usort($old_jobs, function ($a, $b) {
85
- if (strcmp($a['class'], $b['class']) !== 0)
86
  return strcmp($a['class'], $b['class']);
 
87
 
88
- if ($a['data']['store_id'] !== $b['data']['store_id'])
89
  return $a['data']['store_id'] > $b['data']['store_id'];
 
90
 
91
  return $a['job_id'] - $b['job_id'];
92
  });
93
 
94
- $jobs = array();
95
 
96
  $current_job = array_shift($old_jobs);
97
  $next_job = null;
98
 
99
- while ($current_job !== null)
100
- {
101
- if (count($old_jobs) > 0)
102
- {
103
  $next_job = array_shift($old_jobs);
104
 
105
- if ($this->mergeable($current_job, $next_job))
106
- {
107
- if (isset($current_job['data']['product_ids']))
108
  $current_job['data']['product_ids'] = array_merge($current_job['data']['product_ids'], $next_job['data']['product_ids']);
109
- else
110
  $current_job['data']['category_ids'] = array_merge($current_job['data']['category_ids'], $next_job['data']['category_ids']);
 
111
 
112
  continue;
113
  }
114
- }
115
- else
116
  $next_job = null;
 
 
 
 
 
 
 
 
 
117
 
118
  $jobs[] = $current_job;
119
  $current_job = $next_job;
@@ -128,36 +147,36 @@ class Algolia_Algoliasearch_Model_Queue
128
  $limit = $full_reindex ? 1 : $limit;
129
 
130
  $element_count = 0;
131
- $jobs = array();
132
  $offset = 0;
133
  $max_size = $this->config->getNumberOfElementByPage() * $limit;
134
 
135
- while ($element_count < $max_size)
136
- {
137
- $data = $this->db->query($this->db->select()->from($this->table, '*')->where('pid IS NULL')->order(array('job_id'))->limit($limit, $limit * $offset));
138
  $data = $data->fetchAll();
139
 
140
  $offset++;
141
 
142
- if (count($data) <= 0)
143
  break;
 
144
 
145
- foreach ($data as $job)
146
- {
147
  $job_size = (int) $job['data_size'];
148
 
149
- if ($element_count + $job_size <= $max_size)
150
- {
151
  $jobs[] = $job;
152
  $element_count += $job_size;
153
- }
154
- else
155
  break 2;
 
156
  }
157
  }
158
 
159
- if (count($jobs) <= 0)
160
  return;
 
161
 
162
  $first_id = $jobs[0]['job_id'];
163
  $last_id = $jobs[count($jobs) - 1]['job_id'];
@@ -165,27 +184,24 @@ class Algolia_Algoliasearch_Model_Queue
165
  $pid = getmypid();
166
 
167
  // Reserve all new jobs since last run
168
- $this->db->query("UPDATE {$this->db->quoteIdentifier($this->table,true)} SET pid = ". $pid . " WHERE job_id >= " . $first_id . " AND job_id <= $last_id");
169
 
170
- foreach ($jobs as &$job)
171
  $job['data'] = json_decode($job['data'], true);
 
172
 
173
  $jobs = $this->sortAndMergeJob($jobs);
174
 
175
  // Run all reserved jobs
176
- foreach ($jobs as $job)
177
- {
178
- try
179
- {
180
  $model = Mage::getSingleton($job['class']);
181
  $method = $job['method'];
182
  $model->$method(new Varien_Object($job['data']));
183
- }
184
- catch(Exception $e)
185
- {
186
  // Increment retries and log error information
187
- $this->logger->log("Queue processing {$job['pid']} [KO]: Mage::getSingleton({$job['class']})->{$job['method']}(".json_encode($job['data']).")");
188
- $this->logger->log(date('c')." ERROR: ".get_class($e).": '{$e->getMessage()}' in {$e->getFile()}:{$e->getLine()}\n". "Stack trace:\n". $e->getTraceAsString());
189
  }
190
  }
191
 
@@ -193,9 +209,7 @@ class Algolia_Algoliasearch_Model_Queue
193
  $where = $this->db->quoteInto('pid = ?', $pid);
194
  $this->db->delete($this->table, $where);
195
 
196
-
197
- if ($full_reindex)
198
- {
199
  $this->run(-1);
200
  }
201
  }
3
  class Algolia_Algoliasearch_Model_Queue
4
  {
5
  const SUCCESS_LOG = 'algoliasearch_queue_log.txt';
6
+ const ERROR_LOG = 'algoliasearch_queue_errors.log';
7
 
8
  protected $table;
9
  protected $db;
10
 
11
+ /** @var Algolia_Algoliasearch_Helper_Config */
12
  protected $config;
13
+
14
  /** @var Algolia_Algoliasearch_Helper_Logger */
15
  protected $logger;
16
 
18
 
19
  public function __construct()
20
  {
21
+ /** @var Mage_Core_Model_Resource $coreResource */
22
+ $coreResource = Mage::getSingleton('core/resource');
23
+
24
+ $this->table = $coreResource->getTableName('algoliasearch/queue');
25
+ $this->db = $coreResource->getConnection('core_write');
26
 
27
  $this->config = Mage::helper('algoliasearch/config');
28
  $this->logger = Mage::helper('algoliasearch/logger');
33
  public function add($class, $method, $data, $data_size)
34
  {
35
  // Insert a row for the new job
36
+ $this->db->insert($this->table, [
37
+ 'class' => $class,
38
+ 'method' => $method,
39
+ 'data' => json_encode($data),
40
  'data_size' => $data_size,
41
+ 'pid' => null,
42
+ ]);
43
  }
44
 
45
  public function runCron()
46
  {
47
+ if (!$this->config->isQueueActive()) {
48
  return;
49
+ }
50
 
51
  $nbJobs = $this->config->getNumberOfJobToRun();
52
 
53
+ if (getenv('EMPTY_QUEUE') && getenv('EMPTY_QUEUE') == '1') {
54
  $nbJobs = -1;
55
+ }
56
 
57
  $this->run($nbJobs);
58
  }
59
 
60
  protected function mergeable($j1, $j2)
61
  {
62
+ if ($j1['class'] !== $j2['class']) {
63
  return false;
64
+ }
65
 
66
+ if ($j1['method'] !== $j2['method']) {
67
  return false;
68
+ }
69
 
70
+ if ($j1['data']['store_id'] !== $j2['data']['store_id']) {
71
  return false;
72
+ }
73
 
74
+ if ((!isset($j1['data']['product_ids']) || count($j1['data']['product_ids']) <= 0) && (!isset($j1['data']['category_ids']) || count($j1['data']['category_ids']) < 0)) {
 
75
  return false;
76
+ }
77
 
78
+ if ((!isset($j2['data']['product_ids']) || count($j2['data']['product_ids']) <= 0) && (!isset($j2['data']['category_ids']) || count($j2['data']['category_ids']) < 0)) {
 
79
  return false;
80
+ }
81
 
82
+ if (isset($j1['data']['product_ids']) && count($j1['data']['product_ids']) + count($j2['data']['product_ids']) > $this->by_page) {
83
  return false;
84
+ }
85
 
86
+ if (isset($j1['data']['category_ids']) && count($j1['data']['category_ids']) + count($j2['data']['category_ids']) > $this->by_page) {
87
  return false;
88
+ }
89
 
90
  return true;
91
  }
93
  protected function sortAndMergeJob($old_jobs)
94
  {
95
  usort($old_jobs, function ($a, $b) {
96
+ if (strcmp($a['class'], $b['class']) !== 0) {
97
  return strcmp($a['class'], $b['class']);
98
+ }
99
 
100
+ if ($a['data']['store_id'] !== $b['data']['store_id']) {
101
  return $a['data']['store_id'] > $b['data']['store_id'];
102
+ }
103
 
104
  return $a['job_id'] - $b['job_id'];
105
  });
106
 
107
+ $jobs = [];
108
 
109
  $current_job = array_shift($old_jobs);
110
  $next_job = null;
111
 
112
+ while ($current_job !== null) {
113
+ if (count($old_jobs) > 0) {
 
 
114
  $next_job = array_shift($old_jobs);
115
 
116
+ if ($this->mergeable($current_job, $next_job)) {
117
+ if (isset($current_job['data']['product_ids'])) {
 
118
  $current_job['data']['product_ids'] = array_merge($current_job['data']['product_ids'], $next_job['data']['product_ids']);
119
+ } else {
120
  $current_job['data']['category_ids'] = array_merge($current_job['data']['category_ids'], $next_job['data']['category_ids']);
121
+ }
122
 
123
  continue;
124
  }
125
+ } else {
 
126
  $next_job = null;
127
+ }
128
+
129
+ if (isset($current_job['data']['product_ids'])) {
130
+ $current_job['data']['product_ids'] = array_unique($current_job['data']['product_ids']);
131
+ }
132
+
133
+ if (isset($current_job['data']['category_ids'])) {
134
+ $current_job['data']['category_ids'] = array_unique($current_job['data']['category_ids']);
135
+ }
136
 
137
  $jobs[] = $current_job;
138
  $current_job = $next_job;
147
  $limit = $full_reindex ? 1 : $limit;
148
 
149
  $element_count = 0;
150
+ $jobs = [];
151
  $offset = 0;
152
  $max_size = $this->config->getNumberOfElementByPage() * $limit;
153
 
154
+ while ($element_count < $max_size) {
155
+ $data = $this->db->query($this->db->select()->from($this->table, '*')->where('pid IS NULL')
156
+ ->order(['job_id'])->limit($limit, $limit * $offset));
157
  $data = $data->fetchAll();
158
 
159
  $offset++;
160
 
161
+ if (count($data) <= 0) {
162
  break;
163
+ }
164
 
165
+ foreach ($data as $job) {
 
166
  $job_size = (int) $job['data_size'];
167
 
168
+ if ($element_count + $job_size <= $max_size) {
 
169
  $jobs[] = $job;
170
  $element_count += $job_size;
171
+ } else {
 
172
  break 2;
173
+ }
174
  }
175
  }
176
 
177
+ if (count($jobs) <= 0) {
178
  return;
179
+ }
180
 
181
  $first_id = $jobs[0]['job_id'];
182
  $last_id = $jobs[count($jobs) - 1]['job_id'];
184
  $pid = getmypid();
185
 
186
  // Reserve all new jobs since last run
187
+ $this->db->query("UPDATE {$this->db->quoteIdentifier($this->table, true)} SET pid = ".$pid.' WHERE job_id >= '.$first_id." AND job_id <= $last_id");
188
 
189
+ foreach ($jobs as &$job) {
190
  $job['data'] = json_decode($job['data'], true);
191
+ }
192
 
193
  $jobs = $this->sortAndMergeJob($jobs);
194
 
195
  // Run all reserved jobs
196
+ foreach ($jobs as $job) {
197
+ try {
 
 
198
  $model = Mage::getSingleton($job['class']);
199
  $method = $job['method'];
200
  $model->$method(new Varien_Object($job['data']));
201
+ } catch (Exception $e) {
 
 
202
  // Increment retries and log error information
203
+ $this->logger->log("Queue processing {$job['pid']} [KO]: Mage::getSingleton({$job['class']})->{$job['method']}(".json_encode($job['data']).')');
204
+ $this->logger->log(date('c').' ERROR: '.get_class($e).": '{$e->getMessage()}' in {$e->getFile()}:{$e->getLine()}\n"."Stack trace:\n".$e->getTraceAsString());
205
  }
206
  }
207
 
209
  $where = $this->db->quoteInto('pid = ?', $pid);
210
  $this->db->delete($this->table, $where);
211
 
212
+ if ($full_reindex) {
 
 
213
  $this->run(-1);
214
  }
215
  }
app/code/community/Algolia/Algoliasearch/Model/Resource/Engine.php CHANGED
@@ -1,16 +1,28 @@
1
  <?php
 
2
  /**
3
  * Algolia search engine model.
4
  */
5
  class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Model_Resource_Fulltext_Engine
6
  {
7
  const ONE_TIME_AMOUNT = 100;
 
8
  /** @var Algolia_Algoliasearch_Helper_Logger */
9
  protected $logger;
 
 
10
  protected $queue;
 
 
11
  protected $config;
 
 
12
  protected $product_helper;
 
 
13
  protected $category_helper;
 
 
14
  protected $suggestion_helper;
15
 
16
  public function _construct()
@@ -27,64 +39,45 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
27
 
28
  public function addToQueue($observer, $method, $data, $data_size)
29
  {
30
- if ($this->config->isQueueActive())
31
  $this->queue->add($observer, $method, $data, $data_size);
32
- else
33
  Mage::getSingleton($observer)->$method(new Varien_Object($data));
34
- }
35
-
36
- public function removeProducts($storeId = null, $product_ids = null)
37
- {
38
- $ids = Algolia_Algoliasearch_Helper_Entity_Helper::getStores($storeId);
39
-
40
- if (is_array($product_ids) == false)
41
- $product_ids = array($product_ids);
42
-
43
- foreach ($ids as $id)
44
- {
45
- $by_page = $this->config->getNumberOfElementByPage();
46
-
47
- if (is_array($product_ids) && count($product_ids) > $by_page)
48
- {
49
- foreach (array_chunk($product_ids, $by_page) as $chunk)
50
- $this->addToQueue('algoliasearch/observer', 'removeProducts', array('store_id' => $id, 'product_ids' => $chunk), count($chunk));
51
- }
52
- else
53
- $this->addToQueue('algoliasearch/observer', 'removeProducts', array('store_id' => $id, 'product_ids' => $product_ids), count($product_ids));
54
  }
55
-
56
- return $this;
57
  }
58
 
59
  public function removeCategories($storeId = null, $category_ids = null)
60
  {
61
  $ids = Algolia_Algoliasearch_Helper_Entity_Helper::getStores($storeId);
62
 
63
- foreach ($ids as $id)
64
- {
65
- if (is_array($category_ids) == false)
66
- $category_ids = array($category_ids);
67
 
68
  $by_page = $this->config->getNumberOfElementByPage();
69
 
70
- if (is_array($category_ids) && count($category_ids) > $by_page)
71
- {
72
- foreach (array_chunk($category_ids, $by_page) as $chunk)
73
- $this->addToQueue('algoliasearch/observer', 'removeCategories', array('store_id' => $id, 'category_ids' => $chunk), count($chunk));
 
 
 
 
74
  }
75
- else
76
- $this->addToQueue('algoliasearch/observer', 'removeCategories', array('store_id' => $id, 'category_ids' => $category_ids), count($category_ids));
77
 
78
  return $this;
79
  }
 
 
80
  }
81
 
82
  public function rebuildCategoryIndex($storeId = null, $categoryIds = null)
83
  {
84
  $ids = Algolia_Algoliasearch_Helper_Entity_Helper::getStores($storeId);
85
 
86
- foreach ($ids as $id)
87
- {
88
  $by_page = $this->config->getNumberOfElementByPage();
89
 
90
  if (is_array($categoryIds) && count($categoryIds) > $by_page) {
@@ -101,136 +94,160 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
101
 
102
  public function rebuildPages()
103
  {
104
- foreach (Mage::app()->getStores() as $store)
105
- {
106
- if ($this->config->isEnabledBackEnd($store->getId()) === false)
107
- {
108
- if (php_sapi_name() === 'cli')
109
- echo '[ALGOLIA] INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId())."\n";
110
-
111
- Mage::getSingleton('adminhtml/session')->addWarning('[ALGOLIA] INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
112
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
 
 
 
 
113
  continue;
114
  }
115
 
116
- $this->addToQueue('algoliasearch/observer', 'rebuildPageIndex', array('store_id' => $store->getId()), 1);
117
  }
118
  }
119
 
120
  public function rebuildAdditionalSections()
121
  {
122
- foreach (Mage::app()->getStores() as $store)
123
- {
124
- if ($this->config->isEnabledBackEnd($store->getId()) === false)
125
- {
126
- if (php_sapi_name() === 'cli')
127
- echo '[ALGOLIA] INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId())."\n";
128
-
129
- Mage::getSingleton('adminhtml/session')->addWarning('[ALGOLIA] INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
130
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
 
 
 
 
131
  continue;
132
  }
133
 
134
- $this->addToQueue('algoliasearch/observer', 'rebuildAdditionalSectionsIndex', array('store_id' => $store->getId()), 1);
 
135
  }
136
  }
137
 
138
  public function rebuildSuggestions()
139
  {
140
- foreach (Mage::app()->getStores() as $store)
141
- {
142
- if ($this->config->isEnabledBackEnd($store->getId()) === false)
143
- {
144
- if (php_sapi_name() === 'cli')
145
- echo '[ALGOLIA] INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId())."\n";
146
-
147
- Mage::getSingleton('adminhtml/session')->addWarning('[ALGOLIA] INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
148
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
 
 
 
 
149
  continue;
150
  }
151
 
152
- $size = $this->suggestion_helper->getSuggestionCollectionQuery($store->getId())->getSize();
153
- $by_page = $this->config->getNumberOfElementByPage();
154
- $nb_page = ceil($size / $by_page);
155
 
156
- for ($i = 1; $i <= $nb_page; $i++)
157
- {
158
- $data = array('store_id' => $store->getId(), 'page_size' => $by_page, 'page' => $i);
159
  $this->addToQueue('algoliasearch/observer', 'rebuildSuggestionIndex', $data, 1);
160
  }
161
 
162
- $this->addToQueue('algoliasearch/observer', 'moveStoreSuggestionIndex', array('store_id' => $store->getId()), 1);
 
163
  }
164
 
165
-
166
  return $this;
167
  }
168
 
169
  public function rebuildProducts()
170
  {
171
- foreach (Mage::app()->getStores() as $store)
172
- {
173
- if ($this->config->isEnabledBackEnd($store->getId()) === false)
174
- {
175
- if (php_sapi_name() === 'cli')
176
- echo '[ALGOLIA] INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId())."\n";
177
-
178
- Mage::getSingleton('adminhtml/session')->addWarning('[ALGOLIA] INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
179
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
 
 
 
 
 
 
 
 
180
  continue;
181
  }
182
 
183
- if ($store->getIsActive())
184
- {
185
- $this->_rebuildProductIndex($store->getId(), array());
186
- }
187
- else
188
- {
189
- $this->addToQueue('algoliasearch/observer', 'deleteProductsStoreIndices', array('store_id' => $store->getId()), 1);
 
 
 
190
  }
191
  }
192
  }
193
 
194
  public function rebuildCategories()
195
  {
196
- foreach (Mage::app()->getStores() as $store)
197
- {
198
- if ($this->config->isEnabledBackEnd($store->getId()) === false)
199
- {
200
- if (php_sapi_name() === 'cli')
201
- echo '[ALGOLIA] INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId())."\n";
202
-
203
- Mage::getSingleton('adminhtml/session')->addWarning('[ALGOLIA] INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
204
- $this->logger->log('INDEXING IS DISABLED FOR '. $this->logger->getStoreName($store->getId()));
 
 
 
 
205
  continue;
206
  }
207
 
208
- if ($store->getIsActive())
209
- {
210
- $this->addToQueue('algoliasearch/observer', 'rebuildCategoryIndex', array('store_id' => $store->getId(), 'category_ids' => array()), 1);
211
- }
212
- else
213
- {
214
- $this->addToQueue('algoliasearch/observer', 'deleteCategoriesStoreIndices', array('store_id' => $store->getId()), 1);
215
  }
216
  }
217
  }
218
 
219
  public function rebuildProductIndex($storeId = null, $productIds = null)
220
  {
221
- $ids = Algolia_Algoliasearch_Helper_Entity_Helper::getStores($storeId);
 
222
 
223
- foreach ($ids as $id)
224
- {
225
- $by_page = $this->config->getNumberOfElementByPage();
226
-
227
- if (is_array($productIds) && count($productIds) > $by_page)
228
- {
229
- foreach (array_chunk($productIds, $by_page) as $chunk)
230
- $this->_rebuildProductIndex($id, $chunk);
231
  }
232
- else
233
- $this->_rebuildProductIndex($id, $productIds);
234
  }
235
 
236
  return $this;
@@ -238,63 +255,84 @@ class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Mod
238
 
239
  protected function _rebuildCategoryIndex($storeId, $categoryIds = null)
240
  {
241
- if ($categoryIds == null || count($categoryIds) == 0)
242
- {
243
- $size = $this->category_helper->getCategoryCollectionQuery($storeId, $categoryIds)->getSize();
244
- $by_page = $this->config->getNumberOfElementByPage();
245
- $nb_page = ceil($size / $by_page);
246
-
247
- for ($i = 1; $i <= $nb_page; $i++)
248
- {
249
- $data = array('store_id' => $storeId, 'category_ids' => $categoryIds, 'page_size' => $by_page, 'page' => $i);
 
 
 
 
250
  $this->addToQueue('algoliasearch/observer', 'rebuildCategoryIndex', $data, $by_page);
251
  }
 
 
 
252
  }
253
- else
254
- $this->addToQueue('algoliasearch/observer', 'rebuildCategoryIndex', array('store_id' => $storeId, 'category_ids' => $categoryIds), count($categoryIds));
255
-
256
 
257
  return $this;
258
  }
259
 
260
- protected function _rebuildProductIndex($storeId, $productIds = null)
261
  {
262
- if ($productIds == null || count($productIds) == 0)
263
- {
264
- $size = $this->product_helper->getProductCollectionQuery($storeId, $productIds)->getSize();
265
- $by_page = $this->config->getNumberOfElementByPage();
266
- $nb_page = ceil($size / $by_page);
267
-
268
- for ($i = 1; $i <= $nb_page; $i++)
269
- {
270
- $data = array('store_id' => $storeId, 'product_ids' => $productIds, 'page_size' => $by_page, 'page' => $i);
 
 
 
 
 
 
 
 
 
 
 
271
  $this->addToQueue('algoliasearch/observer', 'rebuildProductIndex', $data, $by_page);
272
  }
 
 
 
273
  }
274
- else
275
- $this->addToQueue('algoliasearch/observer', 'rebuildProductIndex', array('store_id' => $storeId, 'product_ids' => $productIds), count($productIds));
276
-
277
 
278
  return $this;
279
  }
280
 
281
  public function prepareEntityIndex($index, $separator = ' ')
282
  {
283
- if ($this->config->isEnabledBackEnd(Mage::app()->getStore()->getId()) === false)
284
  return parent::prepareEntityIndex($index, $separator);
 
285
 
286
  foreach ($index as $key => $value) {
287
- if (is_array($value) && ! empty($value)) {
288
- $index[$key] = join($separator, array_unique(array_filter($value)));
289
- } else if (empty($index[$key])) {
290
- unset($index[$key]);
 
 
291
  }
292
  }
 
293
  return $index;
294
  }
295
 
296
- public function saveSettings()
297
  {
298
- Mage::getSingleton('algoliasearch/observer')->saveSettings();
 
 
299
  }
300
  }
1
  <?php
2
+
3
  /**
4
  * Algolia search engine model.
5
  */
6
  class Algolia_Algoliasearch_Model_Resource_Engine extends Mage_CatalogSearch_Model_Resource_Fulltext_Engine
7
  {
8
  const ONE_TIME_AMOUNT = 100;
9
+
10
  /** @var Algolia_Algoliasearch_Helper_Logger */
11
  protected $logger;
12
+
13
+ /** @var Algolia_Algoliasearch_Model_Queue */
14
  protected $queue;
15
+
16
+ /** @var Algolia_Algoliasearch_Helper_Config */
17
  protected $config;
18
+
19
+ /** @var Algolia_Algoliasearch_Helper_Entity_Producthelper */
20
  protected $product_helper;
21
+
22
+ /** @var Algolia_Algoliasearch_Helper_Entity_Categoryhelper */
23
  protected $category_helper;
24
+
25
+ /** @var Algolia_Algoliasearch_Helper_Entity_Suggestionhelper */
26
  protected $suggestion_helper;
27
 
28
  public function _construct()
39
 
40
  public function addToQueue($observer, $method, $data, $data_size)
41
  {
42
+ if ($this->config->isQueueActive()) {
43
  $this->queue->add($observer, $method, $data, $data_size);
44
+ } else {
45
  Mage::getSingleton($observer)->$method(new Varien_Object($data));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
  }
 
 
47
  }
48
 
49
  public function removeCategories($storeId = null, $category_ids = null)
50
  {
51
  $ids = Algolia_Algoliasearch_Helper_Entity_Helper::getStores($storeId);
52
 
53
+ foreach ($ids as $id) {
54
+ if (is_array($category_ids) == false) {
55
+ $category_ids = [$category_ids];
56
+ }
57
 
58
  $by_page = $this->config->getNumberOfElementByPage();
59
 
60
+ if (is_array($category_ids) && count($category_ids) > $by_page) {
61
+ foreach (array_chunk($category_ids, $by_page) as $chunk) {
62
+ $this->addToQueue('algoliasearch/observer', 'removeCategories',
63
+ ['store_id' => $id, 'category_ids' => $chunk], count($chunk));
64
+ }
65
+ } else {
66
+ $this->addToQueue('algoliasearch/observer', 'removeCategories',
67
+ ['store_id' => $id, 'category_ids' => $category_ids], count($category_ids));
68
  }
 
 
69
 
70
  return $this;
71
  }
72
+
73
+ return $this;
74
  }
75
 
76
  public function rebuildCategoryIndex($storeId = null, $categoryIds = null)
77
  {
78
  $ids = Algolia_Algoliasearch_Helper_Entity_Helper::getStores($storeId);
79
 
80
+ foreach ($ids as $id) {
 
81
  $by_page = $this->config->getNumberOfElementByPage();
82
 
83
  if (is_array($categoryIds) && count($categoryIds) > $by_page) {
94
 
95
  public function rebuildPages()
96
  {
97
+ /** @var Mage_Core_Model_Store $store */
98
+ foreach (Mage::app()->getStores() as $store) {
99
+ if ($this->config->isEnabledBackend($store->getId()) === false) {
100
+ if (php_sapi_name() === 'cli') {
101
+ echo '[ALGOLIA] INDEXING IS DISABLED FOR '.$this->logger->getStoreName($store->getId())."\n";
102
+ }
103
+
104
+ /** @var Mage_Adminhtml_Model_Session $session */
105
+ $session = Mage::getSingleton('adminhtml/session');
106
+ $session->addWarning('[ALGOLIA] INDEXING IS DISABLED FOR '.$this->logger->getStoreName($store->getId()));
107
+
108
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($store->getId()));
109
+
110
  continue;
111
  }
112
 
113
+ $this->addToQueue('algoliasearch/observer', 'rebuildPageIndex', ['store_id' => $store->getId()], 1);
114
  }
115
  }
116
 
117
  public function rebuildAdditionalSections()
118
  {
119
+ /** @var Mage_Core_Model_Store $store */
120
+ foreach (Mage::app()->getStores() as $store) {
121
+ if ($this->config->isEnabledBackend($store->getId()) === false) {
122
+ if (php_sapi_name() === 'cli') {
123
+ echo '[ALGOLIA] INDEXING IS DISABLED FOR '.$this->logger->getStoreName($store->getId())."\n";
124
+ }
125
+
126
+ /** @var Mage_Adminhtml_Model_Session $session */
127
+ $session = Mage::getSingleton('adminhtml/session');
128
+ $session->addWarning('[ALGOLIA] INDEXING IS DISABLED FOR '.$this->logger->getStoreName($store->getId()));
129
+
130
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($store->getId()));
131
+
132
  continue;
133
  }
134
 
135
+ $this->addToQueue('algoliasearch/observer', 'rebuildAdditionalSectionsIndex',
136
+ ['store_id' => $store->getId()], 1);
137
  }
138
  }
139
 
140
  public function rebuildSuggestions()
141
  {
142
+ /** @var Mage_Core_Model_Store $store */
143
+ foreach (Mage::app()->getStores() as $store) {
144
+ if ($this->config->isEnabledBackend($store->getId()) === false) {
145
+ if (php_sapi_name() === 'cli') {
146
+ echo '[ALGOLIA] INDEXING IS DISABLED FOR '.$this->logger->getStoreName($store->getId())."\n";
147
+ }
148
+
149
+ /** @var Mage_Adminhtml_Model_Session $session */
150
+ $session = Mage::getSingleton('adminhtml/session');
151
+ $session->addWarning('[ALGOLIA] INDEXING IS DISABLED FOR '.$this->logger->getStoreName($store->getId()));
152
+
153
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($store->getId()));
154
+
155
  continue;
156
  }
157
 
158
+ $size = $this->suggestion_helper->getSuggestionCollectionQuery($store->getId())->getSize();
159
+ $by_page = $this->config->getNumberOfElementByPage();
160
+ $nb_page = ceil($size / $by_page);
161
 
162
+ for ($i = 1; $i <= $nb_page; $i++) {
163
+ $data = ['store_id' => $store->getId(), 'page_size' => $by_page, 'page' => $i];
 
164
  $this->addToQueue('algoliasearch/observer', 'rebuildSuggestionIndex', $data, 1);
165
  }
166
 
167
+ $this->addToQueue('algoliasearch/observer', 'moveStoreSuggestionIndex',
168
+ ['store_id' => $store->getId()], 1);
169
  }
170
 
 
171
  return $this;
172
  }
173
 
174
  public function rebuildProducts()
175
  {
176
+ $this->saveSettings(true);
177
+
178
+ /** @var Mage_Core_Model_Store $store */
179
+ foreach (Mage::app()->getStores() as $store) {
180
+ $storeId = $store->getId();
181
+
182
+ if ($this->config->isEnabledBackend($storeId) === false) {
183
+ if (php_sapi_name() === 'cli') {
184
+ echo '[ALGOLIA] INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId)."\n";
185
+ }
186
+
187
+ /** @var Mage_Adminhtml_Model_Session $session */
188
+ $session = Mage::getSingleton('adminhtml/session');
189
+ $session->addWarning('[ALGOLIA] INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId));
190
+
191
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($storeId));
192
+
193
  continue;
194
  }
195
 
196
+ if ($store->getIsActive()) {
197
+ $useTmpIndex = $this->config->isQueueActive($storeId);
198
+ $this->_rebuildProductIndex($storeId, [], $useTmpIndex);
199
+
200
+ if ($this->config->isQueueActive($storeId)) {
201
+ $this->addToQueue('algoliasearch/observer', 'moveProductsTmpIndex', ['store_id' => $storeId], 1);
202
+ }
203
+ } else {
204
+ $this->addToQueue('algoliasearch/observer', 'deleteProductsStoreIndices',
205
+ ['store_id' => $storeId], 1);
206
  }
207
  }
208
  }
209
 
210
  public function rebuildCategories()
211
  {
212
+ /** @var Mage_Core_Model_Store $store */
213
+ foreach (Mage::app()->getStores() as $store) {
214
+ if ($this->config->isEnabledBackend($store->getId()) === false) {
215
+ if (php_sapi_name() === 'cli') {
216
+ echo '[ALGOLIA] INDEXING IS DISABLED FOR '.$this->logger->getStoreName($store->getId())."\n";
217
+ }
218
+
219
+ /** @var Mage_Adminhtml_Model_Session $session */
220
+ $session = Mage::getSingleton('adminhtml/session');
221
+ $session->addWarning('[ALGOLIA] INDEXING IS DISABLED FOR '.$this->logger->getStoreName($store->getId()));
222
+
223
+ $this->logger->log('INDEXING IS DISABLED FOR '.$this->logger->getStoreName($store->getId()));
224
+
225
  continue;
226
  }
227
 
228
+ if ($store->getIsActive()) {
229
+ $this->addToQueue('algoliasearch/observer', 'rebuildCategoryIndex',
230
+ ['store_id' => $store->getId(), 'category_ids' => []], 1);
231
+ } else {
232
+ $this->addToQueue('algoliasearch/observer', 'deleteCategoriesStoreIndices',
233
+ ['store_id' => $store->getId()], 1);
 
234
  }
235
  }
236
  }
237
 
238
  public function rebuildProductIndex($storeId = null, $productIds = null)
239
  {
240
+ $storeIds = Algolia_Algoliasearch_Helper_Entity_Helper::getStores($storeId);
241
+ $by_page = $this->config->getNumberOfElementByPage();
242
 
243
+ foreach ($storeIds as $storeId) {
244
+ if (is_array($productIds) && count($productIds) > $by_page) {
245
+ foreach (array_chunk($productIds, $by_page) as $chunk) {
246
+ $this->_rebuildProductIndex($storeId, $chunk);
247
+ }
248
+ } else {
249
+ $this->_rebuildProductIndex($storeId, $productIds);
 
250
  }
 
 
251
  }
252
 
253
  return $this;
255
 
256
  protected function _rebuildCategoryIndex($storeId, $categoryIds = null)
257
  {
258
+ if ($categoryIds == null || count($categoryIds) == 0) {
259
+ $size = $this->category_helper->getCategoryCollectionQuery($storeId, $categoryIds)->getSize();
260
+ $by_page = $this->config->getNumberOfElementByPage();
261
+ $nb_page = ceil($size / $by_page);
262
+
263
+ for ($i = 1; $i <= $nb_page; $i++) {
264
+ $data = [
265
+ 'store_id' => $storeId,
266
+ 'category_ids' => $categoryIds,
267
+ 'page_size' => $by_page,
268
+ 'page' => $i,
269
+ ];
270
+
271
  $this->addToQueue('algoliasearch/observer', 'rebuildCategoryIndex', $data, $by_page);
272
  }
273
+ } else {
274
+ $this->addToQueue('algoliasearch/observer', 'rebuildCategoryIndex',
275
+ ['store_id' => $storeId, 'category_ids' => $categoryIds], count($categoryIds));
276
  }
 
 
 
277
 
278
  return $this;
279
  }
280
 
281
+ protected function _rebuildProductIndex($storeId, $productIds = null, $useTmpIndex = false)
282
  {
283
+ if ($productIds == null || count($productIds) == 0) {
284
+ $collection = $this->product_helper->getProductCollectionQuery($storeId, $productIds, $useTmpIndex);
285
+ $size = $collection->getSize();
286
+
287
+ if (!empty($productIds)) {
288
+ $size = max(count($productIds), $size);
289
+ }
290
+
291
+ $by_page = $this->config->getNumberOfElementByPage();
292
+ $nb_page = ceil($size / $by_page);
293
+
294
+ for ($i = 1; $i <= $nb_page; $i++) {
295
+ $data = [
296
+ 'store_id' => $storeId,
297
+ 'product_ids' => $productIds,
298
+ 'page_size' => $by_page,
299
+ 'page' => $i,
300
+ 'use_tmp_index' => $useTmpIndex,
301
+ ];
302
+
303
  $this->addToQueue('algoliasearch/observer', 'rebuildProductIndex', $data, $by_page);
304
  }
305
+ } else {
306
+ $this->addToQueue('algoliasearch/observer', 'rebuildProductIndex',
307
+ ['store_id' => $storeId, 'product_ids' => $productIds], count($productIds));
308
  }
 
 
 
309
 
310
  return $this;
311
  }
312
 
313
  public function prepareEntityIndex($index, $separator = ' ')
314
  {
315
+ if ($this->config->isEnabledBackend(Mage::app()->getStore()->getId()) === false) {
316
  return parent::prepareEntityIndex($index, $separator);
317
+ }
318
 
319
  foreach ($index as $key => $value) {
320
+ if (is_array($value) && !empty($value)) {
321
+ $index[$key] = implode($separator, array_unique(array_filter($value)));
322
+ } else {
323
+ if (empty($index[$key])) {
324
+ unset($index[$key]);
325
+ }
326
  }
327
  }
328
+
329
  return $index;
330
  }
331
 
332
+ public function saveSettings($isFullProductReindex = false)
333
  {
334
+ /** @var Algolia_Algoliasearch_Model_Observer $observer */
335
+ $observer = Mage::getSingleton('algoliasearch/observer');
336
+ $observer->saveSettings($isFullProductReindex);
337
  }
338
  }
app/code/community/Algolia/Algoliasearch/Model/Resource/Fulltext.php CHANGED
@@ -2,10 +2,10 @@
2
 
3
  class Algolia_Algoliasearch_Model_Resource_Fulltext extends Mage_CatalogSearch_Model_Resource_Fulltext
4
  {
5
-
6
  /** Empty because we need it to do nothing (no mysql stuff), Indexing is handled by Model/Indexer/Algolia */
7
-
8
  protected $engine;
 
 
9
  protected $config;
10
 
11
  /** @var Algolia_Algoliasearch_Helper_Logger */
@@ -14,6 +14,7 @@ class Algolia_Algoliasearch_Model_Resource_Fulltext extends Mage_CatalogSearch_M
14
  public function __construct()
15
  {
16
  parent::__construct();
 
17
  $this->engine = new Algolia_Algoliasearch_Model_Resource_Engine();
18
  $this->config = Mage::helper('algoliasearch/config');
19
  $this->logger = Mage::helper('algoliasearch/logger');
@@ -21,46 +22,52 @@ class Algolia_Algoliasearch_Model_Resource_Fulltext extends Mage_CatalogSearch_M
21
 
22
  public function prepareResult($object, $queryText, $query)
23
  {
24
- if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || $this->config->isEnabledFrontEnd() === false)
25
  return parent::prepareResult($object, $queryText, $query);
 
26
 
27
  return $this;
28
  }
29
 
30
  protected function _saveProductIndexes($storeId, $productIndexes)
31
  {
32
- if ($this->config->isEnabledBackEnd(Mage::app()->getStore()->getId()) === false)
33
  return parent::_saveProductIndexes($storeId, $productIndexes);
 
34
 
35
  return $this;
36
  }
37
 
38
  /**
39
- * Only used when reindexing everything. Otherwise Model/Indexer/Algolia will take care of the rest
40
  */
41
  public function rebuildIndex($storeId = null, $productIds = null)
42
  {
43
- if ($this->config->isEnabledBackEnd(Mage::app()->getStore()->getId()) === false)
44
  return parent::rebuildIndex($storeId, $productIds);
 
 
 
 
 
 
45
 
46
- if (! $this->config->getApplicationID() || ! $this->config->getAPIKey() || ! $this->config->getSearchOnlyAPIKey())
47
- {
48
- Mage::getSingleton('adminhtml/session')->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
49
  return;
50
  }
51
 
52
- /** Avoid Indexing twice */
53
- if (is_array($productIds) && $productIds > 0)
54
  return $this;
 
55
 
56
- if ($storeId == null)
57
- {
58
- foreach (Mage::app()->getStores() as $id => $store)
59
  $this->engine->rebuildProductIndex($id, null);
60
- }
61
- else
62
  $this->engine->rebuildProductIndex($storeId, null);
 
63
 
64
  return $this;
65
  }
66
- }
2
 
3
  class Algolia_Algoliasearch_Model_Resource_Fulltext extends Mage_CatalogSearch_Model_Resource_Fulltext
4
  {
 
5
  /** Empty because we need it to do nothing (no mysql stuff), Indexing is handled by Model/Indexer/Algolia */
 
6
  protected $engine;
7
+
8
+ /** @var Algolia_Algoliasearch_Helper_Config */
9
  protected $config;
10
 
11
  /** @var Algolia_Algoliasearch_Helper_Logger */
14
  public function __construct()
15
  {
16
  parent::__construct();
17
+
18
  $this->engine = new Algolia_Algoliasearch_Model_Resource_Engine();
19
  $this->config = Mage::helper('algoliasearch/config');
20
  $this->logger = Mage::helper('algoliasearch/logger');
22
 
23
  public function prepareResult($object, $queryText, $query)
24
  {
25
+ if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || $this->config->isEnabledFrontEnd() === false) {
26
  return parent::prepareResult($object, $queryText, $query);
27
+ }
28
 
29
  return $this;
30
  }
31
 
32
  protected function _saveProductIndexes($storeId, $productIndexes)
33
  {
34
+ if ($this->config->isEnabledBackend(Mage::app()->getStore()->getId()) === false) {
35
  return parent::_saveProductIndexes($storeId, $productIndexes);
36
+ }
37
 
38
  return $this;
39
  }
40
 
41
  /**
42
+ * Only used when reindexing everything. Otherwise Model/Indexer/Algolia will take care of the rest.
43
  */
44
  public function rebuildIndex($storeId = null, $productIds = null)
45
  {
46
+ if ($this->config->isEnabledBackend(Mage::app()->getStore()->getId()) === false) {
47
  return parent::rebuildIndex($storeId, $productIds);
48
+ }
49
+
50
+ if (!$this->config->getApplicationID() || !$this->config->getAPIKey() || !$this->config->getSearchOnlyAPIKey()) {
51
+ /** @var Mage_Adminhtml_Model_Session $session */
52
+ $session = Mage::getSingleton('adminhtml/session');
53
+ $session->addError('Algolia reindexing failed: You need to configure your Algolia credentials in System > Configuration > Algolia Search.');
54
 
 
 
 
55
  return;
56
  }
57
 
58
+ /* Avoid Indexing twice */
59
+ if (is_array($productIds) && $productIds > 0) {
60
  return $this;
61
+ }
62
 
63
+ if ($storeId == null) {
64
+ foreach (Mage::app()->getStores() as $id => $store) {
 
65
  $this->engine->rebuildProductIndex($id, null);
66
+ }
67
+ } else {
68
  $this->engine->rebuildProductIndex($storeId, null);
69
+ }
70
 
71
  return $this;
72
  }
73
+ }
app/code/community/Algolia/Algoliasearch/Model/Resource/Fulltext/Collection.php CHANGED
@@ -3,31 +3,32 @@
3
  class Algolia_Algoliasearch_Model_Resource_Fulltext_Collection extends Mage_CatalogSearch_Model_Resource_Fulltext_Collection
4
  {
5
  /**
6
- * Intercept query
7
  */
8
  public function addSearchFilter($query)
9
  {
 
10
  $config = Mage::helper('algoliasearch/config');
 
11
  $storeId = Mage::app()->getStore()->getId();
12
 
13
- if (! $config->getApplicationID() || ! $config->getAPIKey() || $config->isEnabledFrontEnd($storeId) === false)
14
- {
15
  return parent::addSearchFilter($query);
16
  }
17
 
18
- $data = array();
19
 
20
- if ($config->isInstantEnabled($storeId) === false || $config->makeSeoRequest($storeId))
21
- {
22
  $algolia_query = $query !== '__empty__' ? $query : '';
23
 
24
- try
25
- {
26
- $data = Mage::helper('algoliasearch')->getSearchResult($algolia_query, $storeId);
27
- }
28
- catch (\Exception $e)
29
- {
30
  $logger = Mage::helper('algoliasearch/logger');
 
31
  $logger->log($e->getMessage(), true);
32
  $logger->log($e->getTraceAsString(), true);
33
 
@@ -35,12 +36,14 @@ class Algolia_Algoliasearch_Model_Resource_Fulltext_Collection extends Mage_Cata
35
  }
36
  }
37
 
38
-
39
  $sortedIds = array_reverse(array_keys($data));
40
 
41
- $this->getSelect()->columns(array('relevance' => new Zend_Db_Expr("FIND_IN_SET(e.entity_id, '".implode(',',$sortedIds)."')")));
 
 
 
42
  $this->getSelect()->where('e.entity_id IN (?)', $sortedIds);
43
 
44
  return $this;
45
  }
46
- }
3
  class Algolia_Algoliasearch_Model_Resource_Fulltext_Collection extends Mage_CatalogSearch_Model_Resource_Fulltext_Collection
4
  {
5
  /**
6
+ * Intercept query.
7
  */
8
  public function addSearchFilter($query)
9
  {
10
+ /** @var Algolia_Algoliasearch_Helper_Config $config */
11
  $config = Mage::helper('algoliasearch/config');
12
+
13
  $storeId = Mage::app()->getStore()->getId();
14
 
15
+ if (!$config->getApplicationID() || !$config->getAPIKey() || $config->isEnabledFrontEnd($storeId) === false) {
 
16
  return parent::addSearchFilter($query);
17
  }
18
 
19
+ $data = [];
20
 
21
+ if ($config->isInstantEnabled($storeId) === false || $config->makeSeoRequest($storeId)) {
 
22
  $algolia_query = $query !== '__empty__' ? $query : '';
23
 
24
+ try {
25
+ /** @var Algolia_Algoliasearch_Helper_Data $helper */
26
+ $helper = Mage::helper('algoliasearch');
27
+ $data = $helper->getSearchResult($algolia_query, $storeId);
28
+ } catch (\Exception $e) {
29
+ /** @var Algolia_Algoliasearch_Helper_Logger $logger */
30
  $logger = Mage::helper('algoliasearch/logger');
31
+
32
  $logger->log($e->getMessage(), true);
33
  $logger->log($e->getTraceAsString(), true);
34
 
36
  }
37
  }
38
 
 
39
  $sortedIds = array_reverse(array_keys($data));
40
 
41
+ $this->getSelect()->columns([
42
+ 'relevance' => new Zend_Db_Expr("FIND_IN_SET(e.entity_id, '".implode(',', $sortedIds)."')"),
43
+ ]);
44
+
45
  $this->getSelect()->where('e.entity_id IN (?)', $sortedIds);
46
 
47
  return $this;
48
  }
49
+ }
app/code/community/Algolia/Algoliasearch/Model/System/Config/Backend/SynonymsFile.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Algolia_Algoliasearch_Model_System_Config_Backend_SynonymsFile extends Mage_Adminhtml_Model_System_Config_Backend_File
4
+ {
5
+ protected function _getAllowedExtensions()
6
+ {
7
+ return ['json'];
8
+ }
9
+ }
app/code/community/Algolia/Algoliasearch/Model/System/Imagetype.php CHANGED
@@ -1,16 +1,15 @@
1
  <?php
2
  /**
3
- * Source model for select image type
4
  */
5
-
6
  class Algolia_Algoliasearch_Model_System_Imagetype
7
  {
8
  public function toOptionArray()
9
  {
10
- return array(
11
- array('value'=>'image', 'label' => Mage::helper('core')->__('Base Image')),
12
- array('value'=>'small_image', 'label' => Mage::helper('core')->__('Small Image')),
13
- array('value'=>'thumbnail', 'label' => Mage::helper('core')->__('Thumbnail')),
14
- );
15
  }
16
  }
1
  <?php
2
  /**
3
+ * Source model for select image type.
4
  */
 
5
  class Algolia_Algoliasearch_Model_System_Imagetype
6
  {
7
  public function toOptionArray()
8
  {
9
+ return [
10
+ ['value' => 'image', 'label' => Mage::helper('core')->__('Base Image')],
11
+ ['value' => 'small_image', 'label' => Mage::helper('core')->__('Small Image')],
12
+ ['value' => 'thumbnail', 'label' => Mage::helper('core')->__('Thumbnail')],
13
+ ];
14
  }
15
  }
app/code/community/Algolia/Algoliasearch/Model/System/Removewords.php CHANGED
@@ -1,17 +1,16 @@
1
  <?php
2
  /**
3
- * Source model for algolia remove words if no result
4
  */
5
-
6
  class Algolia_Algoliasearch_Model_System_Removewords
7
  {
8
  public function toOptionArray()
9
  {
10
- return array(
11
- array('value'=>'none', 'label' => Mage::helper('algoliasearch')->__('None')),
12
- array('value'=>'allOptional', 'label' => Mage::helper('algoliasearch')->__('AllOptional')),
13
- array('value'=>'lastWords', 'label' => Mage::helper('algoliasearch')->__('LastWords')),
14
- array('value'=>'firstWords', 'label' => Mage::helper('algoliasearch')->__('FirstWords')),
15
- );
16
  }
17
  }
1
  <?php
2
  /**
3
+ * Source model for algolia remove words if no result.
4
  */
 
5
  class Algolia_Algoliasearch_Model_System_Removewords
6
  {
7
  public function toOptionArray()
8
  {
9
+ return [
10
+ ['value' => 'none', 'label' => Mage::helper('algoliasearch')->__('None')],
11
+ ['value' => 'allOptional', 'label' => Mage::helper('algoliasearch')->__('AllOptional')],
12
+ ['value' => 'lastWords', 'label' => Mage::helper('algoliasearch')->__('LastWords')],
13
+ ['value' => 'firstWords', 'label' => Mage::helper('algoliasearch')->__('FirstWords')],
14
+ ];
15
  }
16
  }
app/code/community/Algolia/Algoliasearch/etc/adminhtml.xml CHANGED
@@ -9,7 +9,7 @@
9
  <config>
10
  <children>
11
  <algoliasearch translate="title" module="algoliasearch">
12
- <title>Configuration Section</title>
13
  <sort_order>100</sort_order>
14
  </algoliasearch>
15
  </children>
9
  <config>
10
  <children>
11
  <algoliasearch translate="title" module="algoliasearch">
12
+ <title>Algolia Search Configuration</title>
13
  <sort_order>100</sort_order>
14
  </algoliasearch>
15
  </children>
app/code/community/Algolia/Algoliasearch/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Algolia_Algoliasearch>
5
- <version>1.5.5</version>
6
  </Algolia_Algoliasearch>
7
  </modules>
8
  <frontend>
@@ -24,6 +24,15 @@
24
  </observers>
25
  </controller_action_layout_load_before>
26
  </events>
 
 
 
 
 
 
 
 
 
27
  </frontend>
28
  <adminhtml>
29
  <layout>
@@ -44,6 +53,15 @@
44
  </observers>
45
  </controller_action_layout_load_before>
46
  </events>
 
 
 
 
 
 
 
 
 
47
  </adminhtml>
48
  <global>
49
  <helpers>
@@ -192,6 +210,7 @@
192
  <make_seo_request>1</make_seo_request>
193
  <remove_branding>0</remove_branding>
194
  <autocomplete_selector>.algolia-search-input</autocomplete_selector>
 
195
  </advanced>
196
  <product_map>
197
  <!--
2
  <config>
3
  <modules>
4
  <Algolia_Algoliasearch>
5
+ <version>1.6.0</version>
6
  </Algolia_Algoliasearch>
7
  </modules>
8
  <frontend>
24
  </observers>
25
  </controller_action_layout_load_before>
26
  </events>
27
+ <translate>
28
+ <modules>
29
+ <Algolia_Algoliasearch>
30
+ <files>
31
+ <default>Algolia_Algoliasearch.csv</default>
32
+ </files>
33
+ </Algolia_Algoliasearch>
34
+ </modules>
35
+ </translate>
36
  </frontend>
37
  <adminhtml>
38
  <layout>
53
  </observers>
54
  </controller_action_layout_load_before>
55
  </events>
56
+ <translate>
57
+ <modules>
58
+ <Algolia_Algoliasearch>
59
+ <files>
60
+ <default>Algolia_Algoliasearch.csv</default>
61
+ </files>
62
+ </Algolia_Algoliasearch>
63
+ </modules>
64
+ </translate>
65
  </adminhtml>
66
  <global>
67
  <helpers>
210
  <make_seo_request>1</make_seo_request>
211
  <remove_branding>0</remove_branding>
212
  <autocomplete_selector>.algolia-search-input</autocomplete_selector>
213
+ <index_product_on_category_products_update>1</index_product_on_category_products_update>
214
  </advanced>
215
  <product_map>
216
  <!--
app/code/community/Algolia/Algoliasearch/etc/system.xml CHANGED
@@ -4,7 +4,7 @@
4
  <algoliasearch translate="label" module="algoliasearch">
5
  <label>
6
  <![CDATA[
7
- Algolia Search 1.5.5
8
  <style>
9
  .algoliasearch-admin-menu span {
10
  padding-left: 38px !important;
@@ -15,6 +15,13 @@
15
  background: white url("/skin/frontend/base/default/algoliasearch/algolia-admin-menu.png") 20px 4px no-repeat !important;
16
  border-bottom: none;
17
  }
 
 
 
 
 
 
 
18
  </style>
19
  ]]>
20
  </label>
@@ -162,7 +169,7 @@
162
  <![CDATA[
163
  If set to Yes, the products inside the results pages will be searchable the refined results updated as-you-type. It requires your theme to expose a <code>top.search</code> and <code>content</code> block.
164
  <br><br>
165
- <span style="font-size: 30px; color: #D83900">&#9888;</span> Enabling instant search can potentially break your design, some work will be required to have a good integration into your theme
166
  products.
167
  ]]>
168
  </comment>
@@ -234,7 +241,7 @@
234
  </min_number_of_results>
235
  <sections>
236
  <label>Additional Sections</label>
237
- <frontend_model>algoliasearch/system_config_form_field_sections</frontend_model>
238
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
239
  <sort_order>10</sort_order>
240
  <show_in_default>1</show_in_default>
@@ -244,13 +251,13 @@
244
  <comment>
245
  <![CDATA[
246
  Configure here the additional auto-completion menu sections you want include in the dropdown menu (Ex. Suggestions, Pages, Manufacturer, Colors).<br /><br>
247
- <span style="color: #D83900">&#9888;</span> All attributes used here must have been initially included in the <strong>Attributes Configuration</strong> panel and configured as a facet in the <strong>Instant Search Results Page Configuration</strong> panel to be able to refine on the specific attribute.
248
  ]]>
249
  </comment>
250
  </sections>
251
  <excluded_pages translate="label comment">
252
  <label>Excluded Pages</label>
253
- <frontend_model>algoliasearch/system_config_form_field_custompages</frontend_model>
254
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
255
  <sort_order>20</sort_order>
256
  <show_in_default>1</show_in_default>
@@ -273,7 +280,7 @@
273
  <comment>
274
  <![CDATA[
275
  For CMS pages, template directives (e.g. <code>{{block type="core/template" ...}}</code>) will be processed by default. Set this to "No" if you don't want to have template content indexed.<br><br>
276
- <span style="font-size: 20px; color: #D83900">&#9888;</span> Do not forget to trigger the Algolia Search indexers whenever you modify those settings.
277
  ]]>
278
  </comment>
279
  </render_template_directives>
@@ -399,7 +406,7 @@
399
  </number_product_results>
400
  <product_additional_attributes translate="label comment">
401
  <label>Attributes</label>
402
- <frontend_model>algoliasearch/system_config_form_field_customsortorderproduct</frontend_model>
403
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
404
  <sort_order>30</sort_order>
405
  <show_in_default>1</show_in_default>
@@ -409,13 +416,13 @@
409
  <![CDATA[
410
  Choose here the product attributes your users can search on, the ones you want to use as filters and sorts options and the ones required to display the search results.<br><br>
411
  The order of the searchable attributes matters: a query matching the first searchable attribute of a product will put this product before the others in the results. Chose "Ordered" if you want the position of the matching word(s) inside the attribute to matter. A match at the beginning of an attribute will be considered more important: for the query "iPhone", "iPhone 5s" will be ranked before "case for iPhone".<br />
412
- <br><span style="font-size: 20px; color: #D83900">&#9888;</span> Do not forget to reindex your Algolia Search index after you've modified this panel.
413
  ]]>
414
  </comment>
415
  </product_additional_attributes>
416
  <custom_ranking_product_attributes translate="label comment">
417
  <label>Ranking</label>
418
- <frontend_model>algoliasearch/system_config_form_field_customrankingproduct</frontend_model>
419
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
420
  <sort_order>40</sort_order>
421
  <show_in_default>1</show_in_default>
@@ -424,7 +431,7 @@
424
  <comment>
425
  <![CDATA[
426
  Configure here the attributes that reflect the popularity of your product (number of orders, number of likes, number of views, ...).<br />
427
- <span style="color: #D83900">&#9888;</span> All attributes used here must have been initially included in the Attributes configuration panel.
428
  ]]>
429
  </comment>
430
  </custom_ranking_product_attributes>
@@ -438,7 +445,7 @@
438
  <show_in_store>1</show_in_store>
439
  <comment>
440
  <![CDATA[
441
- Choose here if you want to show most popular queries suggestions when there are no results/
442
  ]]>
443
  </comment>
444
  </show_suggestions_on_no_result_page>
@@ -474,7 +481,7 @@
474
  <fields>
475
  <category_additional_attributes2 translate="label comment">
476
  <label>Attributes</label>
477
- <frontend_model>algoliasearch/system_config_form_field_customsortordercategory</frontend_model>
478
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
479
  <sort_order>10</sort_order>
480
  <show_in_default>1</show_in_default>
@@ -483,13 +490,13 @@
483
  <comment>
484
  <![CDATA[
485
  Configure here the category attributes your users can search on. The order of these attributes matters: the higher in the list, the more important to rank the results.<br />
486
- <span style="color: #D83900">&#9888;</span> Do not forget to reindex your Algolia Search index after you've modified this panel.
487
  ]]>
488
  </comment>
489
  </category_additional_attributes2>
490
  <custom_ranking_category_attributes translate="label comment">
491
  <label>Ranking</label>
492
- <frontend_model>algoliasearch/system_config_form_field_customrankingcategory</frontend_model>
493
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
494
  <sort_order>30</sort_order>
495
  <show_in_default>1</show_in_default>
@@ -498,7 +505,7 @@
498
  <comment>
499
  <![CDATA[
500
  Choose here the attributes that reflect the popularity of your categories (number of products, total number of sales of the category,etc.).<br />
501
- <span style="color: #D83900">&#9888;</span> All attributes used here must have been included before in the Attributes chart.
502
  ]]>
503
  </comment>
504
  </custom_ranking_category_attributes>
@@ -512,7 +519,7 @@
512
  <show_in_store>1</show_in_store>
513
  <comment>
514
  <![CDATA[
515
- If set to Yes, Algolia will display all categories in the autocomplete menu ignoring the setting: "Include in navigation menu". Default value: false
516
  ]]>
517
  </comment>
518
  </show_cats_not_included_in_navigation>
@@ -583,7 +590,7 @@
583
  To schedule the run you need to add this in your crontab:<br>
584
  */5 * * * * php -f /absolute/path/to/magento/shell/indexer.php -- -reindex algolia_queue_runner
585
  <br><br>
586
- <span style="color: #D83900">&#9888;</span> Enabling this option is recommended in production or if your store has a lot of products.
587
  ]]>
588
  </comment>
589
  </active>
@@ -609,14 +616,97 @@
609
  <![CDATA[
610
  Number of jobs to run each time the cron is run. Default value is 10.
611
  <br><br>
612
- <span style="font-size: 20px; color: #D83900">&#9888;</span> Each time the cron runs it will process ("Max number of element per indexing job" * "Number of jobs to run each time the cron is run")
613
  products.
614
  ]]>
615
  </comment>
616
- <depends><active>1</active></depends>
 
 
617
  </number_of_job_to_run>
618
  </fields>
619
  </queue>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
620
  <advanced translate="label">
621
  <label>Advanced</label>
622
  <expanded>0</expanded>
@@ -698,6 +788,22 @@
698
  <show_in_store>1</show_in_store>
699
  <comment>If you don't have the top.search block you can specify the selector of your search input here to use it. Default value is .algolia-search-input</comment>
700
  </autocomplete_selector>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
701
  </fields>
702
  </advanced>
703
  </groups>
4
  <algoliasearch translate="label" module="algoliasearch">
5
  <label>
6
  <![CDATA[
7
+ Algolia Search 1.6.0
8
  <style>
9
  .algoliasearch-admin-menu span {
10
  padding-left: 38px !important;
15
  background: white url("/skin/frontend/base/default/algoliasearch/algolia-admin-menu.png") 20px 4px no-repeat !important;
16
  border-bottom: none;
17
  }
18
+
19
+ span.algolia-config-warning {
20
+ font-size: 25px;
21
+ color: #D83900;
22
+ position: relative;
23
+ top: 4px;
24
+ }
25
  </style>
26
  ]]>
27
  </label>
169
  <![CDATA[
170
  If set to Yes, the products inside the results pages will be searchable the refined results updated as-you-type. It requires your theme to expose a <code>top.search</code> and <code>content</code> block.
171
  <br><br>
172
+ <span class="algolia-config-warning">&#9888;</span> Enabling instant search can potentially break your design, some work will be required to have a good integration into your theme
173
  products.
174
  ]]>
175
  </comment>
241
  </min_number_of_results>
242
  <sections>
243
  <label>Additional Sections</label>
244
+ <frontend_model>algoliasearch/system_config_form_field_additionalSections</frontend_model>
245
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
246
  <sort_order>10</sort_order>
247
  <show_in_default>1</show_in_default>
251
  <comment>
252
  <![CDATA[
253
  Configure here the additional auto-completion menu sections you want include in the dropdown menu (Ex. Suggestions, Pages, Manufacturer, Colors).<br /><br>
254
+ <span class="algolia-config-warning">&#9888;</span> All attributes used here must have been initially included in the <strong>Attributes Configuration</strong> panel and configured as a facet in the <strong>Instant Search Results Page Configuration</strong> panel to be able to refine on the specific attribute.
255
  ]]>
256
  </comment>
257
  </sections>
258
  <excluded_pages translate="label comment">
259
  <label>Excluded Pages</label>
260
+ <frontend_model>algoliasearch/system_config_form_field_excludedPages</frontend_model>
261
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
262
  <sort_order>20</sort_order>
263
  <show_in_default>1</show_in_default>
280
  <comment>
281
  <![CDATA[
282
  For CMS pages, template directives (e.g. <code>{{block type="core/template" ...}}</code>) will be processed by default. Set this to "No" if you don't want to have template content indexed.<br><br>
283
+ <span class="algolia-config-warning">&#9888;</span> Do not forget to trigger the Algolia Search indexers whenever you modify those settings.
284
  ]]>
285
  </comment>
286
  </render_template_directives>
406
  </number_product_results>
407
  <product_additional_attributes translate="label comment">
408
  <label>Attributes</label>
409
+ <frontend_model>algoliasearch/system_config_form_field_productAdditionalAttributes</frontend_model>
410
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
411
  <sort_order>30</sort_order>
412
  <show_in_default>1</show_in_default>
416
  <![CDATA[
417
  Choose here the product attributes your users can search on, the ones you want to use as filters and sorts options and the ones required to display the search results.<br><br>
418
  The order of the searchable attributes matters: a query matching the first searchable attribute of a product will put this product before the others in the results. Chose "Ordered" if you want the position of the matching word(s) inside the attribute to matter. A match at the beginning of an attribute will be considered more important: for the query "iPhone", "iPhone 5s" will be ranked before "case for iPhone".<br />
419
+ <br><span class="algolia-config-warning">&#9888;</span> Do not forget to reindex your Algolia Search index after you've modified this panel.
420
  ]]>
421
  </comment>
422
  </product_additional_attributes>
423
  <custom_ranking_product_attributes translate="label comment">
424
  <label>Ranking</label>
425
+ <frontend_model>algoliasearch/system_config_form_field_customRankingProductAttributes</frontend_model>
426
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
427
  <sort_order>40</sort_order>
428
  <show_in_default>1</show_in_default>
431
  <comment>
432
  <![CDATA[
433
  Configure here the attributes that reflect the popularity of your product (number of orders, number of likes, number of views, ...).<br />
434
+ <span class="algolia-config-warning">&#9888;</span> All attributes used here must have been initially included in the Attributes configuration panel.
435
  ]]>
436
  </comment>
437
  </custom_ranking_product_attributes>
445
  <show_in_store>1</show_in_store>
446
  <comment>
447
  <![CDATA[
448
+ Choose here if you want to show most popular queries suggestions when there are no results
449
  ]]>
450
  </comment>
451
  </show_suggestions_on_no_result_page>
481
  <fields>
482
  <category_additional_attributes2 translate="label comment">
483
  <label>Attributes</label>
484
+ <frontend_model>algoliasearch/system_config_form_field_categoryAdditionalAttributes</frontend_model>
485
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
486
  <sort_order>10</sort_order>
487
  <show_in_default>1</show_in_default>
490
  <comment>
491
  <![CDATA[
492
  Configure here the category attributes your users can search on. The order of these attributes matters: the higher in the list, the more important to rank the results.<br />
493
+ <span class="algolia-config-warning">&#9888;</span> Do not forget to reindex your Algolia Search index after you've modified this panel.
494
  ]]>
495
  </comment>
496
  </category_additional_attributes2>
497
  <custom_ranking_category_attributes translate="label comment">
498
  <label>Ranking</label>
499
+ <frontend_model>algoliasearch/system_config_form_field_customRankingCategoryAttributes</frontend_model>
500
  <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
501
  <sort_order>30</sort_order>
502
  <show_in_default>1</show_in_default>
505
  <comment>
506
  <![CDATA[
507
  Choose here the attributes that reflect the popularity of your categories (number of products, total number of sales of the category,etc.).<br />
508
+ <span class="algolia-config-warning">&#9888;</span> All attributes used here must have been included before in the Attributes chart.
509
  ]]>
510
  </comment>
511
  </custom_ranking_category_attributes>
519
  <show_in_store>1</show_in_store>
520
  <comment>
521
  <![CDATA[
522
+ If set to Yes, Algolia will display all categories in both the autocomplete menu and instant search page ignoring the setting: "Include in navigation menu". Default value: No
523
  ]]>
524
  </comment>
525
  </show_cats_not_included_in_navigation>
590
  To schedule the run you need to add this in your crontab:<br>
591
  */5 * * * * php -f /absolute/path/to/magento/shell/indexer.php -- -reindex algolia_queue_runner
592
  <br><br>
593
+ <span class="algolia-config-warning">&#9888;</span> Enabling this option is recommended in production or if your store has a lot of products.
594
  ]]>
595
  </comment>
596
  </active>
616
  <![CDATA[
617
  Number of jobs to run each time the cron is run. Default value is 10.
618
  <br><br>
619
+ <span class="algolia-config-warning">&#9888;</span> Each time the cron runs it will process ("Max number of element per indexing job" * "Number of jobs to run each time the cron is run")
620
  products.
621
  ]]>
622
  </comment>
623
+ <depends>
624
+ <active>1</active>
625
+ </depends>
626
  </number_of_job_to_run>
627
  </fields>
628
  </queue>
629
+ <synonyms translate="label">
630
+ <label>Synonyms</label>
631
+ <expanded>0</expanded>
632
+ <frontend_type>text</frontend_type>
633
+ <sort_order>85</sort_order>
634
+ <show_in_default>1</show_in_default>
635
+ <show_in_website>1</show_in_website>
636
+ <show_in_store>1</show_in_store>
637
+ <comment>
638
+ <![CDATA[
639
+ <table>
640
+ <tr>
641
+ <td>Synonyms documentation:</td>
642
+ <td><a target="_blank" href="https://www.algolia.com/doc/synonyms">https://www.algolia.com/doc/synonyms</a></td>
643
+ </tr>
644
+ </table>
645
+ <br>
646
+ <hr>
647
+ <br>
648
+ ]]>
649
+ </comment>
650
+ <fields>
651
+ <synonyms translate="label comment">
652
+ <label>Synonyms</label>
653
+ <frontend_model>algoliasearch/system_config_form_field_synonyms</frontend_model>
654
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
655
+ <sort_order>10</sort_order>
656
+ <show_in_default>1</show_in_default>
657
+ <show_in_website>1</show_in_website>
658
+ <show_in_store>1</show_in_store>
659
+ <comment>
660
+ <![CDATA[
661
+ Synonyms are defined by a comma-separated list of words that should be considered equivalent by the Algolia engine.<br>
662
+ For instance: <code>tv, television, tv set</code><br>
663
+ Using that set, if a record contains “television” and a user searches for “TV”, this record will be returned.<br>
664
+ Documentation: <a href="https://www.algolia.com/doc/synonyms#synonyms" target="_blank">https://www.algolia.com/doc/synonyms#synonyms</a>
665
+ ]]>
666
+ </comment>
667
+ </synonyms>
668
+ <oneway_synonyms translate="label comment">
669
+ <label>One-way Synonyms</label>
670
+ <frontend_model>algoliasearch/system_config_form_field_onewaySynonyms</frontend_model>
671
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
672
+ <sort_order>20</sort_order>
673
+ <show_in_default>1</show_in_default>
674
+ <show_in_website>1</show_in_website>
675
+ <show_in_store>1</show_in_store>
676
+ <comment>
677
+ <![CDATA[
678
+ One-way synonyms allow you to define alternative words for a search term, which are not synonyms to each others.<br>
679
+ Let’s take an example: when a user searches for “tablet”, you want him to be able to find iPads and Galaxy Note tablets alike, but you might not want Android tablets to show up when he searches for “iPad”.<br>
680
+ To do this, you’d define a one-way synonyms set between <code>tablet</code> (as input) and <code>ipad, galaxy note</code> (as synonyms). When the user types in “tablet”, records containing “iPad” and “Galaxy Note” will be returned. However records containing only “tablet” or “Galaxy Note” won’t be returned if he searches for “iPad”.<br>
681
+ Documentation: <a href="https://www.algolia.com/doc/synonyms#one-way-synonyms" target="_blank">https://www.algolia.com/doc/synonyms#one-way-synonyms</a>
682
+ <br>
683
+ <br>
684
+ Algolia offers more synonymys’ types - placeholders and alternative corrections. These types can be managed directly from your <a href="https://www.algolia.com/dashboard" target="_blank">Algolia’s dashboard</a>.
685
+ Any changes you will make to placeholders and alternative corrections in Algolia’s dashboard won’t be overriden.
686
+ ]]>
687
+ </comment>
688
+ </oneway_synonyms>
689
+ <synonyms_file translate="label comment">
690
+ <label>Synonyms File</label>
691
+ <frontend_type>file</frontend_type>
692
+ <backend_model>algoliasearch/system_config_backend_SynonymsFile</backend_model>
693
+ <upload_dir config="system/filesystem/media" scope_info="1">algoliasearch-admin-config-uploads</upload_dir>
694
+ <base_url type="media" scope_info="1">algoliasearch-admin-config-uploads</base_url>
695
+ <sort_order>30</sort_order>
696
+ <show_in_default>1</show_in_default>
697
+ <show_in_website>1</show_in_website>
698
+ <show_in_store>1</show_in_store>
699
+ <comment>
700
+ <![CDATA[
701
+ If you have large amount of synonyms (appr. more than hundred), you don't have to fill it into inputs above and you can upload a JSON file with synonyms instead.
702
+ The documentation with the file structure can be found <a href="https://www.algolia.com/doc/relevance/synonyms#synonyms" target="_blank">here</a>.<br><br>
703
+ <span class="algolia-config-warning">&#9888;</span>
704
+ When you upload a JSON file, all the synonyms settings from above will be ignored and only synonyms from the JSON file will be pushed to Algolia.
705
+ ]]>
706
+ </comment>
707
+ </synonyms_file>
708
+ </fields>
709
+ </synonyms>
710
  <advanced translate="label">
711
  <label>Advanced</label>
712
  <expanded>0</expanded>
788
  <show_in_store>1</show_in_store>
789
  <comment>If you don't have the top.search block you can specify the selector of your search input here to use it. Default value is .algolia-search-input</comment>
790
  </autocomplete_selector>
791
+ <index_product_on_category_products_update translate="label comment">
792
+ <label>Update product on category products update</label>
793
+ <frontend_type>select</frontend_type>
794
+ <source_model>adminhtml/system_config_source_yesno</source_model>
795
+ <sort_order>70</sort_order>
796
+ <show_in_default>1</show_in_default>
797
+ <show_in_website>1</show_in_website>
798
+ <show_in_store>1</show_in_store>
799
+ <comment>
800
+ <![CDATA[
801
+ This feature enables the extension to automatically update the product index when a product is added to or removed from a category via the "Manage Categories" menu.
802
+ By default the feature is turned on. <br />
803
+ Setting it to "No" will disable its behavior. It is useful when you hava a lot of products in catalog and saving the category will synchronize them all with Algolia even though there is no real change.
804
+ ]]>
805
+ </comment>
806
+ </index_product_on_category_products_update>
807
  </fields>
808
  </advanced>
809
  </groups>
app/code/community/Algolia/Algoliasearch/sql/algoliasearch_setup/mysql4-install-0.1.0.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
 
3
- $installer = $this; /** @var $installer Mage_Core_Model_Resource_Setup */
 
4
 
5
  $installer->startSetup();
6
 
1
  <?php
2
 
3
+ /** @var Mage_Core_Model_Resource_Setup $installer */
4
+ $installer = $this;
5
 
6
  $installer->startSetup();
7
 
app/code/community/Algolia/Algoliasearch/sql/algoliasearch_setup/mysql4-upgrade-0.1.0-1.4.8.php CHANGED
@@ -1,6 +1,7 @@
1
  <?php
2
 
3
- $installer = $this; /** @var $installer Mage_Core_Model_Resource_Setup */
 
4
 
5
  $installer->startSetup();
6
 
@@ -10,4 +11,4 @@ $installer->run("ALTER TABLE `{$table}` ADD INDEX `IDX_ALGOLIA_SALES_FLAT_ORDER_
10
  $table = Mage::getConfig()->getTablePrefix().'review_entity_summary';
11
  $installer->run("ALTER TABLE `{$table}` ADD INDEX `IDX_ALGOLIA_REVIEW_ENTITY_SUMMARY_ENTITY_PK_VALUE_STORE_ID` (`store_id`, `entity_pk_value`);");
12
 
13
- $installer->endSetup();
1
  <?php
2
 
3
+ /** @var Mage_Core_Model_Resource_Setup $installer */
4
+ $installer = $this;
5
 
6
  $installer->startSetup();
7
 
11
  $table = Mage::getConfig()->getTablePrefix().'review_entity_summary';
12
  $installer->run("ALTER TABLE `{$table}` ADD INDEX `IDX_ALGOLIA_REVIEW_ENTITY_SUMMARY_ENTITY_PK_VALUE_STORE_ID` (`store_id`, `entity_pk_value`);");
13
 
14
+ $installer->endSetup();
app/code/community/Algolia/Algoliasearch/sql/algoliasearch_setup/mysql4-upgrade-1.4.8-1.5.0.php CHANGED
@@ -1,14 +1,15 @@
1
  <?php
2
 
3
- $installer = $this; /** @var $installer Mage_Core_Model_Resource_Setup */
 
4
 
5
  $installer->startSetup();
6
 
7
- /** Need a truncate since now everything is json_encoded and not serialized */
8
  $installer->run("TRUNCATE TABLE `{$installer->getTable('algoliasearch/queue')}`");
9
  $installer->run("ALTER TABLE `{$installer->getTable('algoliasearch/queue')}` ADD data_size INT(11);");
10
 
11
  $index_prefix = Mage::getConfig()->getTablePrefix();
12
- $installer->run("DELETE FROM `".$index_prefix."core_config_data` WHERE `path` LIKE '%algolia%'");
13
 
14
- $installer->endSetup();
1
  <?php
2
 
3
+ /** @var Mage_Core_Model_Resource_Setup $installer */
4
+ $installer = $this;
5
 
6
  $installer->startSetup();
7
 
8
+ /* Need a truncate since now everything is json_encoded and not serialized */
9
  $installer->run("TRUNCATE TABLE `{$installer->getTable('algoliasearch/queue')}`");
10
  $installer->run("ALTER TABLE `{$installer->getTable('algoliasearch/queue')}` ADD data_size INT(11);");
11
 
12
  $index_prefix = Mage::getConfig()->getTablePrefix();
13
+ $installer->run('DELETE FROM `'.$index_prefix."core_config_data` WHERE `path` LIKE '%algolia%'");
14
 
15
+ $installer->endSetup();
app/code/community/Algolia/Algoliasearch/sql/algoliasearch_setup/mysql4-upgrade-1.5.5-1.6.0.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /** @var Mage_Core_Model_Resource_Setup $installer */
4
+ $installer = $this;
5
+
6
+ $installer->startSetup();
7
+
8
+ // Need to transform "removeProducts" to "rebuildProductIndex" as re-indexing was refactored and "removeProducts" do not exists anymore
9
+ $installer->run("DELETE FROM `{$installer->getTable('algoliasearch/queue')}`");
10
+
11
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/algoliasearch.xml CHANGED
@@ -2,7 +2,7 @@
2
  <layout>
3
  <algolia_bundle_handle>
4
  <reference name="before_body_end">
5
- <block type="core/template" template="algoliasearch/adminjs.phtml"/>
6
  </reference>
7
  </algolia_bundle_handle>
8
  </layout>
2
  <layout>
3
  <algolia_bundle_handle>
4
  <reference name="before_body_end">
5
+ <block type="core/template" template="algoliasearch/adminjs.phtml" name="algolia-admin-beforebodyend"/>
6
  </reference>
7
  </algolia_bundle_handle>
8
  </layout>
app/design/adminhtml/default/default/template/algoliasearch/adminjs.phtml CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  <script src="<?php echo Mage::getBaseUrl('js'); ?>algoliasearch/algoliaAdminBundle.min.js"></script>
2
  <script src="<?php echo Mage::getBaseUrl('js'); ?>algoliasearch/admin_scripts.js"></script>
3
  <script>
1
+ <?php
2
+
3
+ /** @var Algolia_Algoliasearch_Helper_Config $config */
4
+ $config = Mage::helper('algoliasearch/config');
5
+
6
+ ?>
7
+
8
+ <script>var algoliaSearchExtentionsVersion = "<?php echo $config->getExtensionVersion(); ?>"</script>
9
  <script src="<?php echo Mage::getBaseUrl('js'); ?>algoliasearch/algoliaAdminBundle.min.js"></script>
10
  <script src="<?php echo Mage::getBaseUrl('js'); ?>algoliasearch/admin_scripts.js"></script>
11
  <script>
app/design/frontend/base/default/layout/algoliasearch.xml CHANGED
@@ -13,23 +13,29 @@
13
  </text>
14
  </action>
15
  </block>
16
- <block type="core/template" template="algoliasearch/beforetopsearch.phtml"/>
17
  </reference>
18
  <reference name="before_body_end">
19
- <block type="core/template" template="algoliasearch/frontjs.phtml"/>
20
  </reference>
21
  <reference name="content">
22
- <block type="core/template" before="content" template="algoliasearch/beforecontent.phtml"/>
23
  </reference>
24
  </algolia_search_handle>
25
  <algolia_search_handle_with_topsearch>
26
- <reference name="top.search">
27
- <action method="setTemplate"><template>algoliasearch/topsearch.phtml</template></action>
 
 
 
 
28
  </reference>
29
  </algolia_search_handle_with_topsearch>
30
  <algolia_search_handle_no_topsearch>
31
  <reference name="head">
32
- <block type="core/template" template="algoliasearch/topsearch.phtml"/>
 
 
33
  </reference>
34
  </algolia_search_handle_no_topsearch>
35
  </layout>
13
  </text>
14
  </action>
15
  </block>
16
+ <block type="core/template" template="algoliasearch/internals/commonjs.phtml" name="algolia-beforetopsearch"/>
17
  </reference>
18
  <reference name="before_body_end">
19
+ <block type="core/template" template="algoliasearch/internals/frontjs.phtml" name="algolia-beforebodyend"/>
20
  </reference>
21
  <reference name="content">
22
+ <block type="core/template" before="content" template="algoliasearch/internals/beforecontent.phtml" name="algolia-beforecontent"/>
23
  </reference>
24
  </algolia_search_handle>
25
  <algolia_search_handle_with_topsearch>
26
+ <reference name="header">
27
+ <block type="core/template" name="top.search" as="topSearch" template="algoliasearch/internals/templateloader.phtml">
28
+ <!-- Autocomplete.phtml must be loaded after Instantsearch.phtml to be able to bind to the recreated <div id="algolia-autocomplete-container"></div> -->
29
+ <block type="core/template" template="algoliasearch/instantsearch.phtml" as="algolia-instantsearch" name="algolia-instantsearch"/>
30
+ <block type="core/template" template="algoliasearch/autocomplete.phtml" as="algolia-autocomplete" name="algolia-autocomplete"/>
31
+ </block>
32
  </reference>
33
  </algolia_search_handle_with_topsearch>
34
  <algolia_search_handle_no_topsearch>
35
  <reference name="head">
36
+ <!-- Autocomplete.phtml must be loaded after Instantsearch.phtml to be able to bind to the recreated <div id="algolia-autocomplete-container"></div> -->
37
+ <block type="core/template" template="algoliasearch/instantsearch.phtml" name="algolia-instantsearch"/>
38
+ <block type="core/template" template="algoliasearch/autocomplete.phtml" name="algolia-autocomplete"/>
39
  </reference>
40
  </algolia_search_handle_no_topsearch>
41
  </layout>
app/design/frontend/base/default/template/algoliasearch/autocomplete.phtml ADDED
@@ -0,0 +1,271 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /** @var Algolia_Algoliasearch_Helper_Config $config */
4
+ $config = Mage::helper('algoliasearch/config');
5
+
6
+ /** @var Mage_CatalogSearch_Helper_Data $catalogSearchHelper */
7
+ $catalogSearchHelper = $this->helper('catalogsearch');
8
+
9
+ /** @var Mage_Customer_Model_Session $session */
10
+ $session = Mage::getSingleton('customer/session');
11
+ $group_id = $session->getCustomerGroupId();
12
+
13
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
14
+ $price_key = $config->isCustomerGroupsEnabled(Mage::app()->getStore()->getStoreId()) ? '.'.$currency_code.'.group_'.$group_id : '.'.$currency_code.'.default';
15
+
16
+ $image_base_url = Mage::getBaseUrl();
17
+
18
+ $placeholder = $this->__('Search for products, categories, ...');
19
+
20
+ /** Render form with autocomplete input **/
21
+ if ($config->isDefaultSelector()): ?>
22
+ <form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
23
+ <div id="algolia-searchbox">
24
+ <label for="search"><?php echo $this->__('Search:') ?></label>
25
+ <input id="search" type="text" name="<?php echo $catalogSearchHelper->getQueryParamName() ?>" class="input-text algolia-search-input" autocomplete="off" spellcheck="false" autocorrect="off" autocapitalize="off" placeholder="<?php echo $placeholder; ?>" />
26
+ <img class="clear-query-autocomplete" src="<?php echo $this->getSkinUrl('algoliasearch/cross.png') ?>" />
27
+ <svg id="algolia-glass" xmlns="http://www.w3.org/2000/svg" class="magnifying-glass" width="24" height="24" viewBox="0 0 128 128" >
28
+ <g transform="scale(4)">
29
+ <path stroke-width="3" d="M19.5 19.582l9.438 9.438"></path>
30
+ <circle stroke-width="3" cx="12" cy="12" r="10.5" fill="none"></circle>
31
+ <path d="M23.646 20.354l-3.293 3.293c-.195.195-.195.512 0 .707l7.293 7.293c.195.195.512.195.707 0l3.293-3.293c.195-.195.195-.512 0-.707l-7.293-7.293c-.195-.195-.512-.195-.707 0z" ></path>
32
+ </g>
33
+ </svg>
34
+ </div>
35
+ </form>
36
+ <?php endif; ?>
37
+
38
+ <!-- Product hit template -->
39
+ <script type="text/template" id="autocomplete_products_template">
40
+ <a class="algoliasearch-autocomplete-hit" href="{{url}}">
41
+ {{#thumbnail_url}}
42
+ <div class="thumb"><img src="<?php echo $image_base_url; ?>{{thumbnail_url}}" /></div>
43
+ {{/thumbnail_url}}
44
+
45
+ <div class="info">
46
+ {{{_highlightResult.name.value}}}
47
+
48
+ <div class="algoliasearch-autocomplete-category">
49
+ {{#categories_without_path}}
50
+ <?php echo $this->__('in'); ?> {{{categories_without_path}}}
51
+ {{/categories_without_path}}
52
+
53
+ {{#_highlightResult.color}}
54
+ {{#_highlightResult.color.value}}
55
+ <span>
56
+ {{#categories_without_path}} | {{/categories_without_path}} Color: {{{_highlightResult.color.value}}}
57
+ </span>
58
+ {{/_highlightResult.color.value}}
59
+ {{/_highlightResult.color}}
60
+ </div>
61
+
62
+ <div class="algoliasearch-autocomplete-price">
63
+ <span class="after_special {{#price<?php echo $price_key; ?>_original_formated}}promotion{{/price<?php echo $price_key; ?>_original_formated}}">
64
+ {{price<?php echo $price_key; ?>_formated}}
65
+ </span>
66
+
67
+ {{#price<?php echo $price_key; ?>_original_formated}}
68
+ <span class="before_special">
69
+ {{price<?php echo $price_key; ?>_original_formated}}
70
+ </span>
71
+ {{/price<?php echo $price_key; ?>_original_formated}}
72
+ </div>
73
+ </div>
74
+ </a>
75
+ </script>
76
+
77
+ <!-- Category hit template -->
78
+ <script type="text/template" id="autocomplete_categories_template">
79
+ <a class="algoliasearch-autocomplete-hit" href="{{url}}">
80
+ {{#image_url}}
81
+ <div class="thumb">
82
+ <img src="<?php echo $image_base_url; ?>{{image_url}}" />
83
+ </div>
84
+ {{/image_url}}
85
+
86
+ {{#image_url}}
87
+ <div class="info">
88
+ {{/image_url}}
89
+ {{^image_url}}
90
+ <div class="info-without-thumb">
91
+ {{#_highlightResult.path}}
92
+ {{{_highlightResult.path.value}}}
93
+ {{/_highlightResult.path}}
94
+ {{^_highlightResult.path}}
95
+ {{{path}}}
96
+ {{/_highlightResult.path}}
97
+
98
+ {{#product_count}}
99
+ <small>({{product_count}})</small>
100
+ {{/product_count}}
101
+
102
+ </div>
103
+ <div class="clearfix"></div>
104
+ {{/image_url}}
105
+ </div>
106
+ </a>
107
+ </script>
108
+
109
+ <!-- Page hit template -->
110
+ <script type="text/template" id="autocomplete_pages_template">
111
+ <a class="algoliasearch-autocomplete-hit" href="{{url}}">
112
+ <div class="info-without-thumb">
113
+ {{{_highlightResult.name.value}}}
114
+ {{#content}}
115
+ <div class="details">
116
+ {{{content}}}
117
+ </div>
118
+ {{/content}}
119
+ </div>
120
+ <div class="clearfix"></div>
121
+ </a>
122
+ </script>
123
+
124
+ <!-- Extra attribute hit template -->
125
+ <script type="text/template" id="autocomplete_extra_template">
126
+ <a class="algoliasearch-autocomplete-hit" href="{{url}}">
127
+ <div class="info-without-thumb">
128
+ {{{_highlightResult.value.value}}}
129
+ </div>
130
+ <div class="clearfix"></div>
131
+ </a>
132
+ </script>
133
+
134
+ <!-- Suggestion hit template -->
135
+ <script type="text/template" id="autocomplete_suggestions_template">
136
+ <a class="algoliasearch-autocomplete-hit" href="{{url}}">
137
+ <svg xmlns="http://www.w3.org/2000/svg" class="algolia-glass-suggestion magnifying-glass" width="24" height="24" viewBox="0 0 128 128" >
138
+ <g transform="scale(2.5)">
139
+ <path stroke-width="3" d="M19.5 19.582l9.438 9.438"></path>
140
+ <circle stroke-width="3" cx="12" cy="12" r="10.5" fill="none"></circle>
141
+ <path d="M23.646 20.354l-3.293 3.293c-.195.195-.195.512 0 .707l7.293 7.293c.195.195.512.195.707 0l3.293-3.293c.195-.195.195-.512 0-.707l-7.293-7.293c-.195-.195-.512-.195-.707 0z" ></path>
142
+ </g>
143
+ </svg>
144
+ <div class="info-without-thumb">
145
+ {{{_highlightResult.query.value}}}
146
+
147
+ {{#category}}
148
+ <span class="text-muted"><?php echo $this->__('in'); ?></span> <span class="category-tag">{{category}}</span>
149
+ {{/category}}
150
+ </div>
151
+ <div class="clearfix"></div>
152
+ </a>
153
+ </script>
154
+
155
+ <!-- General autocomplete menu template -->
156
+ <script type="text/template" id="menu-template">
157
+ <div class="autocomplete-wrapper">
158
+ <div class="col9">
159
+ <div class="aa-dataset-products"></div>
160
+ </div>
161
+ <div class="col3">
162
+ <div class="other-sections">
163
+ <div class="aa-dataset-suggestions"></div>
164
+ <?php for ($i = 0; $i < 10; $i++): ?>
165
+ <div class="aa-dataset-<?php echo $i; ?>"></div>
166
+ <?php endfor; ?>
167
+ </div>
168
+ </div>
169
+ </div>
170
+ </script>
171
+
172
+ <script type="text/javascript">
173
+ //<![CDATA[
174
+
175
+ document.addEventListener("DOMContentLoaded", function(event) {
176
+ algoliaBundle.$(function ($) {
177
+
178
+ /** We have nothing to do here if autocomplete is disabled **/
179
+ if (!algoliaConfig.autocomplete.enabled) {
180
+ return;
181
+ }
182
+
183
+ /**
184
+ * Set autocomplete templates
185
+ * For templating is used Hogan library
186
+ * Docs: http://twitter.github.io/hogan.js/
187
+ **/
188
+ algoliaConfig.autocomplete.templates = {
189
+ suggestions: algoliaBundle.Hogan.compile($('#autocomplete_suggestions_template').html()),
190
+ products: algoliaBundle.Hogan.compile($('#autocomplete_products_template').html()),
191
+ categories: algoliaBundle.Hogan.compile($('#autocomplete_categories_template').html()),
192
+ pages: algoliaBundle.Hogan.compile($('#autocomplete_pages_template').html()),
193
+ additionnalSection: algoliaBundle.Hogan.compile($('#autocomplete_extra_template').html())
194
+ };
195
+
196
+ /**
197
+ * Initialise Algolia client
198
+ * Docs: https://www.algolia.com/doc/javascript
199
+ **/
200
+ var algolia_client = algoliaBundle.algoliasearch(algoliaConfig.applicationId, algoliaConfig.apiKey);
201
+ algolia_client.addAlgoliaAgent('Magento ' + algoliaConfig.extensionVersion);
202
+
203
+ /** Add products and categories that are required sections **/
204
+ var nb_cat = algoliaConfig.autocomplete.nbOfCategoriesSuggestions >= 1 ? algoliaConfig.autocomplete.nbOfCategoriesSuggestions : 2;
205
+ var nb_pro = algoliaConfig.autocomplete.nbOfProductsSuggestions >= 1 ? algoliaConfig.autocomplete.nbOfProductsSuggestions : 6;
206
+ var nb_que = algoliaConfig.autocomplete.nbOfQueriesSuggestions >= 0 ? algoliaConfig.autocomplete.nbOfQueriesSuggestions : 0;
207
+
208
+ if (nb_que > 0) {
209
+ algoliaConfig.autocomplete.sections.unshift({ hitsPerPage: nb_que, label: '', name: "suggestions"});
210
+ }
211
+
212
+ algoliaConfig.autocomplete.sections.unshift({ hitsPerPage: nb_cat, label: <?php echo json_encode($this->__('Categories')); ?>, name: "categories"});
213
+ algoliaConfig.autocomplete.sections.unshift({ hitsPerPage: nb_pro, label: <?php echo json_encode($this->__('Products')); ?>, name: "products"});
214
+
215
+ /** Setup autocomplete data sources **/
216
+ var sources = [],
217
+ i = 0;
218
+ $.each(algoliaConfig.autocomplete.sections, function (name, section) {
219
+ var source = getAutocompleteSource(section, algolia_client, $, i);
220
+
221
+ if (source) {
222
+ sources.push(source);
223
+ }
224
+
225
+ /** Those sections have already specific placeholder, so do not use the default aa-dataset-{i} class **/
226
+ if (section.name !== 'suggestions' && section.name !== 'products') {
227
+ i++;
228
+ }
229
+ });
230
+
231
+ /**
232
+ * Setup the autocomplete search input
233
+ * For autocomplete feature is used Algolia's autocomplete.js library
234
+ * Docs: https://github.com/algolia/autocomplete.js
235
+ **/
236
+ $(algoliaConfig.autocomplete.selector).each(function (i) {
237
+ var menu = $(this);
238
+ var options = {
239
+ hint: false,
240
+ templates: {
241
+ dropdownMenu: '#menu-template'
242
+ },
243
+ dropdownMenuContainer: "#algolia-autocomplete-container",
244
+ debug: false
245
+ };
246
+
247
+ if (algoliaConfig.removeBranding === false) {
248
+ options.templates.footer = '<div class="footer_algolia"><span><?php echo $this->__('Search by'); ?></span> <a href="https://www.algolia.com/?utm_source=magento&utm_medium=link&utm_campaign=magento_autocompletion_menu" target="_blank"><img src="<?php echo $this->getSkinUrl('algoliasearch/algolia-logo.png'); ?>" /></a></div>';
249
+ }
250
+
251
+ /** Bind autocomplete feature to the input */
252
+ $(this)
253
+ .autocomplete(options, sources)
254
+ .parent()
255
+ .attr('id', 'algolia-autocomplete-tt')
256
+ .on('autocomplete:updated', function (e) {
257
+ fixAutocompleteCssSticky(menu);
258
+ })
259
+ .on('autocomplete:updated', function (e) {
260
+ fixAutocompleteCssHeight(menu);
261
+ });
262
+
263
+ $(window).resize(function () {
264
+ fixAutocompleteCssSticky(menu);
265
+ });
266
+ });
267
+ });
268
+ });
269
+
270
+ //]]>
271
+ </script>
app/design/frontend/base/default/template/algoliasearch/instantsearch.phtml ADDED
@@ -0,0 +1,601 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /** @var Algolia_Algoliasearch_Helper_Config $config */
4
+ $config = Mage::helper('algoliasearch/config');
5
+
6
+ /** @var Mage_CatalogSearch_Helper_Data $catalogSearchHelper */
7
+ $catalogSearchHelper = $this->helper('catalogsearch');
8
+
9
+ /** @var Mage_Customer_Model_Session $session */
10
+ $session = Mage::getSingleton('customer/session');
11
+ $group_id = $session->getCustomerGroupId();
12
+
13
+ $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
14
+ $price_key = $config->isCustomerGroupsEnabled(Mage::app()->getStore()->getStoreId()) ? '.'.$currency_code.'.group_'.$group_id : '.'.$currency_code.'.default';
15
+
16
+ $image_base_url = Mage::getBaseUrl();
17
+
18
+ $title = '';
19
+ $description = '';
20
+ $content = '';
21
+ $imgHtml = '';
22
+
23
+ if ($config->isInstantEnabled() && $config->replaceCategories() && Mage::app()->getRequest()->getControllerName() == 'category') {
24
+ $category = Mage::registry('current_category');
25
+ $title = $category->getName();
26
+
27
+ if ($category && $category->getDisplayMode() !== 'PAGE') {
28
+ $category->getUrlInstance()->setStore(Mage::app()->getStore()->getStoreId());
29
+
30
+ if ($category->getDisplayMode() == 'PRODUCTS_AND_PAGE') {
31
+ $page = $category->getLandingPage();
32
+ $cms_block = Mage::getModel('cms/block')->load($page);
33
+
34
+ $description = $category->getDescription();
35
+ $content = $this->getLayout()->createBlock('cms/block')->setBlockId($page)->toHtml();
36
+
37
+ if ($category->getImageUrl()) {
38
+ $imgHtml = '<p class="category-image"><img src="'.$category->getImageUrl().'" alt="'.$this->escapeHtml($category->getName()).'" title="'.$this->escapeHtml($category->getName()).'" /></p>';
39
+ $imgHtml = $this->helper('catalog/output')->categoryAttribute($category, $imgHtml, 'image');
40
+ }
41
+ }
42
+ }
43
+ }
44
+
45
+ ?>
46
+
47
+ <!-- Instantsearch wrapper template -->
48
+ <script type="text/template" id="instant_wrapper_template">
49
+ {{#findAutocomplete}}
50
+ <div id="algolia-autocomplete-container"></div>
51
+ {{/findAutocomplete}}
52
+ <div id="algolia_instant_selector" class="<?php echo count($config->getFacets()) > 0 ? ' with-facets' : '' ?>">
53
+
54
+ <?php if ($title || $imgHtml || $description || $content): ?>
55
+ <div class="row">
56
+ <div class="col-md-12">
57
+ <div id="algolia-static-content">
58
+ <div class="page-title category-title">
59
+ <h1><?php echo $title; ?></h1>
60
+ </div>
61
+ <div>
62
+ <?php echo $imgHtml; ?>
63
+ </div>
64
+ <div class="category-description std">
65
+ <?php echo $description; ?>
66
+ </div>
67
+ <?php echo $content; ?>
68
+ </div>
69
+ </div>
70
+ </div>
71
+ <?php endif; ?>
72
+
73
+ <div class="row">
74
+ <div class="col-md-3" id="algolia-left-container">
75
+ <div id="refine-toggle" class="visible-xs visible-sm">+ <?php echo $this->__('Refine'); ?></div>
76
+ <div class="hidden-xs hidden-sm" id="instant-search-facets-container">
77
+ <div id="current-refinements"></div>
78
+ </div>
79
+ </div>
80
+
81
+ <div class="col-md-9" id="algolia-right-container">
82
+ <div class="row">
83
+ <div class="col-md-12">
84
+ <div>
85
+ {{#second_bar}}
86
+ <div id="instant-search-bar-container">
87
+ <div id="instant-search-box">
88
+ <div class="instant-search-bar-label">
89
+ <svg xmlns="http://www.w3.org/2000/svg" class="magnifying-glass" width="24"
90
+ height="24" viewBox="0 0 128 128">
91
+ <g transform="scale(4)">
92
+ <path stroke-width="3" d="M19.5 19.582l9.438 9.438"></path>
93
+ <circle stroke-width="3" cx="12" cy="12" r="10.5" fill="none"></circle>
94
+ <path
95
+ d="M23.646 20.354l-3.293 3.293c-.195.195-.195.512 0 .707l7.293 7.293c.195.195.512.195.707 0l3.293-3.293c.195-.195.195-.512 0-.707l-7.293-7.293c-.195-.195-.512-.195-.707 0z"></path>
96
+ </g>
97
+ </svg>
98
+ <span><?php echo $this->__('Current search'); ?></span>
99
+ </div>
100
+ <div class="instant-search-bar-wrapper">
101
+ <label for="instant-search-bar">
102
+ <?php echo $this->__('Search:'); ?>
103
+ </label>
104
+
105
+ <input placeholder="<?php echo $this->__('Search for products'); ?>"
106
+ id="instant-search-bar" type="text" autocomplete="off" spellcheck="false"
107
+ autocorrect="off" autocapitalize="off"/>
108
+
109
+ <img class="clear-query-instant"
110
+ src="<?php echo $this->getSkinUrl('algoliasearch/cross.png') ?>"/>
111
+ </div>
112
+ </div>
113
+ </div>
114
+ {{/second_bar}}
115
+ </div>
116
+ </div>
117
+ </div>
118
+ <div class="row">
119
+ <div>
120
+ <div class="hits">
121
+ <div class="infos">
122
+ <div class="pull-left" id="algolia-stats"></div>
123
+ <div class="pull-right">
124
+ <div class="sort-by-label pull-left">
125
+ <?php echo $this->__('SORT BY'); ?>
126
+ </div>
127
+ <div class="pull-left" id="algolia-sorts"></div>
128
+ </div>
129
+ <div class="clearfix"></div>
130
+ </div>
131
+ <div id="instant-search-results-container"></div>
132
+ </div>
133
+ </div>
134
+ <div class="clearfix"></div>
135
+ </div>
136
+
137
+ <div class="text-center">
138
+ <div id="instant-search-pagination-container"></div>
139
+ </div>
140
+ </div>
141
+ </div>
142
+
143
+ </div>
144
+ </script>
145
+
146
+ <!-- Product hit template -->
147
+ <script type="text/template" id="instant-hit-template">
148
+ <div class="col-md-4 col-sm-6">
149
+ <div class="result-wrapper">
150
+ <a href="{{url}}" class="result">
151
+ <div class="result-content">
152
+ <div class="result-thumbnail">
153
+ {{#image_url}}<img src="<?php echo $image_base_url; ?>{{{ image_url }}}"/>{{/image_url}}
154
+ {{^image_url}}<span class="no-image"></span>{{/image_url}}
155
+ </div>
156
+ <div class="result-sub-content">
157
+ <h3 class="result-title text-ellipsis">
158
+ {{{ _highlightResult.name.value }}}
159
+ </h3>
160
+ <div class="ratings">
161
+ <div class="result-sub-content">
162
+ <div class="ratings">
163
+ <div class="rating-box">
164
+ <div class="rating" style="width:{{rating_summary}}%" width="148"
165
+ height="148"></div>
166
+ </div>
167
+ </div>
168
+ <div class="price">
169
+ <div class="price-wrapper">
170
+ <div>
171
+ <span
172
+ class="after_special {{#price<?php echo $price_key; ?>_original_formated}}promotion{{/price<?php echo $price_key; ?>_original_formated}}">
173
+ {{price<?php echo $price_key; ?>_formated}}
174
+ </span>
175
+
176
+ {{#price<?php echo $price_key; ?>_original_formated}}
177
+ <span class="before_special">
178
+ {{price<?php echo $price_key; ?>_original_formated}}
179
+ </span>
180
+ {{/price<?php echo $price_key; ?>_original_formated}}
181
+ </div>
182
+ </div>
183
+ </div>
184
+ </div>
185
+ </div>
186
+ <div class="result-description text-ellipsis">{{{ _highlightResult.description.value }}}</div>
187
+
188
+ {{#isAddToCartEnabled}}
189
+ {{#in_stock}}
190
+ <form action="<?php echo Mage::getBaseUrl(); ?>/checkout/cart/add/product/{{objectID}}"
191
+ method="post">
192
+ <input type="hidden" name="form_key"
193
+ value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>"/>
194
+ <input type="hidden" name="qty" value="1">
195
+ <button type="submit"><?php echo $this->__('Add to Cart'); ?></button>
196
+ </form>
197
+ {{/in_stock}}
198
+ {{/isAddToCartEnabled}}
199
+ </div>
200
+ </div>
201
+ <div class="clearfix"></div>
202
+ </a>
203
+ </div>
204
+ </div>
205
+ </script>
206
+
207
+ <!-- Search statistics template (used for displaying hits' count and time of query) -->
208
+ <script type="text/template" id="instant-stats-template">
209
+ {{#hasOneResult}}<strong>1</strong> <?php echo $this->__('result'); ?> found{{/hasOneResult}}
210
+ {{#hasManyResults}}{{^hasNoResults}}{{first}}-{{last}} out of{{/hasNoResults}} <strong>{{#helpers.formatNumber}}{{nbHits}}{{/helpers.formatNumber}} <?php echo $this->__('results found'); ?></strong>{{/hasManyResults}}
211
+ <?php echo $this->__('in'); ?> {{seconds}} <?php echo $this->__('seconds'); ?>
212
+ </script>
213
+
214
+ <!-- Basic facet template -->
215
+ <script type="text/template" id="facet-template">
216
+ <div class="sub_facet {{#isRefined}}checked{{/isRefined}}">
217
+ <input class="facet_value" {{#isRefined}}checked{{/isRefined}} type="checkbox">
218
+ {{name}}
219
+ <span class="count">{{count}}</span>
220
+ </div>
221
+ </script>
222
+
223
+ <!-- Current refinements template -->
224
+ <script type="text/template" id="current-refinements-template">
225
+ <div class="cross-wrapper">
226
+ <img src="<?php echo $this->getSkinUrl('algoliasearch/cross.png') ?>"/>
227
+ </div>
228
+ <div class="current-refinement-wrapper">
229
+ {{#label}}
230
+ <span class="current-refinement-label">{{label}}{{^operator}}:{{/operator}}</span>
231
+ {{/label}}
232
+ {{#operator}}
233
+ {{{displayOperator}}}
234
+ {{/operator}}
235
+ {{#exclude}}-{{/exclude}}
236
+ <span class="current-refinement-name">{{name}}</span>
237
+ </div>
238
+ </script>
239
+
240
+ <script type="text/javascript">
241
+ //<![CDATA[
242
+
243
+ document.addEventListener("DOMContentLoaded", function (event) {
244
+ algoliaBundle.$(function ($) {
245
+
246
+ /** We have nothing to do here if instantsearch is not enabled **/
247
+ if (!algoliaConfig.instant.enabled || !(algoliaConfig.isSearchPage || !algoliaConfig.autocomplete.enabled)) {
248
+ return;
249
+ }
250
+
251
+ if ($(algoliaConfig.instant.selector).length <= 0) {
252
+ throw '[Algolia] Invalid instant-search selector: ' + algoliaConfig.instant.selector;
253
+ }
254
+
255
+ if (algoliaConfig.autocomplete.enabled && $(algoliaConfig.instant.selector).find(algoliaConfig.autocomplete.selector).length > 0) {
256
+ throw '[Algolia] You can\'t have a search input matching "' + algoliaConfig.autocomplete.selector +
257
+ '" inside you instant selector "' + algoliaConfig.instant.selector + '"';
258
+ }
259
+
260
+ var findAutocomplete = algoliaConfig.autocomplete.enabled && $(algoliaConfig.instant.selector).find('#algolia-autocomplete-container').length > 0;
261
+ if (findAutocomplete) {
262
+ $(algoliaConfig.instant.selector).find('#algolia-autocomplete-container').remove();
263
+ }
264
+
265
+ /**
266
+ * Setup wrapper
267
+ *
268
+ * For templating is used Hogan library
269
+ * Docs: http://twitter.github.io/hogan.js/
270
+ **/
271
+ var wrapperTemplate = algoliaBundle.Hogan.compile($('#instant_wrapper_template').html());
272
+ var instant_selector = !algoliaConfig.autocomplete.enabled ? algoliaConfig.autocomplete.selector : "#instant-search-bar";
273
+
274
+ var div = document.createElement('div');
275
+ $(div).addClass('algolia-instant-results-wrapper');
276
+
277
+ $(algoliaConfig.instant.selector).addClass('algolia-instant-replaced-content');
278
+ $(algoliaConfig.instant.selector).wrap(div);
279
+
280
+ $('.algolia-instant-results-wrapper').append('<div class="algolia-instant-selector-results"></div>');
281
+ $('.algolia-instant-selector-results').html(wrapperTemplate.render({
282
+ second_bar: algoliaConfig.autocomplete.enabled,
283
+ findAutocomplete: findAutocomplete
284
+ })).show();
285
+
286
+ /**
287
+ * Initialise instant search
288
+ * For rendering instant search page is used Algolia's instantsearch.js library
289
+ * Docs: https://community.algolia.com/instantsearch.js/documentation/
290
+ **/
291
+ var search = algoliaBundle.instantsearch({
292
+ appId: algoliaConfig.applicationId,
293
+ apiKey: algoliaConfig.apiKey,
294
+ indexName: algoliaConfig.indexName + '_products',
295
+ urlSync: {
296
+ useHash: true,
297
+ trackedParameters: ['query', 'page', 'attribute:*', 'index']
298
+ }
299
+ });
300
+
301
+ search.client.addAlgoliaAgent('Magento ' + algoliaConfig.extensionVersion);
302
+
303
+ /**
304
+ * Custom widget - this widget is used to refine results for search page or catalog page
305
+ * Docs: https://community.algolia.com/instantsearch.js/documentation/#custom-widgets
306
+ **/
307
+ search.addWidget({
308
+ getConfiguration: function () {
309
+ if (algoliaConfig.request.query.length > 0 && location.hash.length < 1) {
310
+ return {query: algoliaConfig.request.query}
311
+ }
312
+ return {};
313
+ },
314
+ init: function (data) {
315
+ if (algoliaConfig.request.refinement_key.length > 0) {
316
+ data.helper.toggleRefine(algoliaConfig.request.refinement_key, algoliaConfig.request.refinement_value);
317
+ }
318
+
319
+ if (algoliaConfig.isCategoryPage) {
320
+ data.helper.addNumericRefinement('visibility_catalog', '=', 1);
321
+ }
322
+ else {
323
+ data.helper.addNumericRefinement('visibility_search', '=', 1);
324
+ }
325
+ },
326
+ render: function (data) {
327
+ if (!algoliaConfig.isSearchPage) {
328
+ if (data.results.query.length === 0) {
329
+ $('.algolia-instant-replaced-content').show();
330
+ $('.algolia-instant-selector-results').hide();
331
+ }
332
+ else {
333
+ $('.algolia-instant-replaced-content').hide();
334
+ $('.algolia-instant-selector-results').show();
335
+ }
336
+ }
337
+ }
338
+ });
339
+
340
+ /**
341
+ * Search box
342
+ * Docs: https://community.algolia.com/instantsearch.js/documentation/#searchbox
343
+ **/
344
+ search.addWidget(
345
+ algoliaBundle.instantsearch.widgets.searchBox({
346
+ container: instant_selector,
347
+ placeholder: '<?php echo $this->__('Search for products'); ?>'
348
+ })
349
+ );
350
+
351
+ /**
352
+ * Stats
353
+ * Docs: https://community.algolia.com/instantsearch.js/documentation/#stats
354
+ **/
355
+ search.addWidget(
356
+ algoliaBundle.instantsearch.widgets.stats({
357
+ container: '#algolia-stats',
358
+ templates: {
359
+ body: $('#instant-stats-template').html()
360
+ },
361
+ transformData: function (data) {
362
+ data.first = data.page * data.hitsPerPage + 1;
363
+ data.last = Math.min(data.page * data.hitsPerPage + data.hitsPerPage, data.nbHits);
364
+ data.seconds = data.processingTimeMS / 1000;
365
+
366
+ return data;
367
+ }
368
+ })
369
+ );
370
+
371
+ /**
372
+ * Sorting
373
+ * Docs: https://community.algolia.com/instantsearch.js/documentation/#sortbyselector
374
+ **/
375
+ algoliaConfig.sortingIndices.unshift({
376
+ name: algoliaConfig.indexName + '_products',
377
+ label: '<?php echo $this->__('Relevance'); ?>'
378
+ });
379
+
380
+ search.addWidget(
381
+ algoliaBundle.instantsearch.widgets.sortBySelector({
382
+ container: '#algolia-sorts',
383
+ indices: algoliaConfig.sortingIndices,
384
+ cssClass: 'form-control'
385
+ })
386
+ );
387
+
388
+ /**
389
+ * Products' hits
390
+ * This widget renders all products into result page
391
+ * Docs: https://community.algolia.com/instantsearch.js/documentation/#hits
392
+ **/
393
+ search.addWidget(
394
+ algoliaBundle.instantsearch.widgets.hits({
395
+ container: '#instant-search-results-container',
396
+ templates: {
397
+ item: $('#instant-hit-template').html()
398
+ },
399
+ transformData: {
400
+ item: function (hit) {
401
+ hit = transformHit(hit, algoliaConfig.priceKey);
402
+ hit.isAddToCartEnabled = algoliaConfig.instant.isAddToCartEnabled;
403
+
404
+ return hit;
405
+ }
406
+ },
407
+ hitsPerPage: algoliaConfig.hitsPerPage
408
+ })
409
+ );
410
+
411
+ /**
412
+ * Custom widget - Suggestions
413
+ * This widget renders suggestion queries which might be interesting for your customer
414
+ * Docs: https://community.algolia.com/instantsearch.js/documentation/#custom-widgets
415
+ **/
416
+ search.addWidget({
417
+ suggestions: [],
418
+ init: function () {
419
+ if (algoliaConfig.showSuggestionsOnNoResultsPage) {
420
+ var $this = this;
421
+ $.each(algoliaConfig.popularQueries.slice(0, Math.min(4, algoliaConfig.popularQueries.length)), function (i, query) {
422
+ query = $('<div>').html(query).text(); //xss
423
+ $this.suggestions.push('<a href="' + algoliaConfig.baseUrl + '/catalogsearch/result/?q=' + encodeURIComponent(query) + '">' + query + '</a>');
424
+ });
425
+ }
426
+ },
427
+ render: function (data) {
428
+ if (data.results.hits.length === 0) {
429
+ var content = '<div class="no-results">';
430
+ content += '<div><b><?php echo $this->__('No products for query'); ?> "' + $("<div>").text(data.results.query).html() + '</b>"</div>';
431
+ content += '<div class="popular-searches">';
432
+
433
+ if (algoliaConfig.showSuggestionsOnNoResultsPage && this.suggestions.length > 0) {
434
+ content += '<div><?php echo $this->__('You can try one of the popular search queries'); ?></div>' + this.suggestions.join(', ');
435
+ }
436
+
437
+ content += '</div>';
438
+ content += '<?php echo $this->__('or'); ?> <a href="' + algoliaConfig.baseUrl + '/catalogsearch/result/?q=__empty__"><?php echo $this->__('See all products'); ?></a>'
439
+
440
+ content += '</div>';
441
+
442
+ $('#instant-search-results-container').html(content);
443
+ }
444
+ }
445
+ });
446
+
447
+ /** Setup attributes for current refinements widget **/
448
+ var attributes = [];
449
+ $.each(algoliaConfig.facets, function (i, facet) {
450
+ var name = facet.attribute;
451
+
452
+ if (name === 'categories') {
453
+ if (algoliaConfig.isCategoryPage) {
454
+ return;
455
+ }
456
+ name = 'categories.level0';
457
+ }
458
+
459
+ if (name === 'price') {
460
+ name = facet.attribute + algoliaConfig.priceKey
461
+ }
462
+
463
+ attributes.push({
464
+ name: name,
465
+ label: facet.label ? facet.label : facet.attribute
466
+ });
467
+ });
468
+
469
+ /**
470
+ * Widget name: Current refinements
471
+ * Widget displays all filters and refinements applied on query. It also let your customer to clear them one by one
472
+ * Docs: https://community.algolia.com/instantsearch.js/documentation/#currentrefinedvalues
473
+ **/
474
+ search.addWidget(
475
+ algoliaBundle.instantsearch.widgets.currentRefinedValues({
476
+ container: '#current-refinements',
477
+ cssClasses: {
478
+ root: 'facet'
479
+ },
480
+ templates: {
481
+ header: '<div class="name">' + '<?php echo $this->__('Selected Filters'); ?>' + '</div>',
482
+ clearAll: '<?php echo $this->__('Clear all'); ?>',
483
+ item: $('#current-refinements-template').html()
484
+ },
485
+ attributes: attributes,
486
+ onlyListedAttributes: true
487
+ })
488
+ );
489
+
490
+ /**
491
+ * Here are specified custom attributes widgets which require special code to run properly
492
+ * Custom widgets can be added to this object like [attributeName]: function(facet, templates)
493
+ * Function must return instantsearch.widget object
494
+ * Docs: https://community.algolia.com/instantsearch.js/documentation/#widgets
495
+ **/
496
+ var customAttributeFacet = {
497
+ categories: function (facet, templates) {
498
+ var hierarchical_levels = [];
499
+ for (var l = 0; l < 10; l++)
500
+ hierarchical_levels.push('categories.level' + l.toString());
501
+
502
+ var hierarchicalMenuParams = {
503
+ container: facet.wrapper.appendChild(document.createElement('div')),
504
+ attributes: hierarchical_levels,
505
+ separator: ' /// ',
506
+ alwaysGetRootLevel: true,
507
+ limit: algoliaConfig.maxValuesPerFacet,
508
+ templates: templates,
509
+ sortBy: ['name:asc'],
510
+ cssClasses: {
511
+ list: 'hierarchical',
512
+ root: 'facet hierarchical'
513
+ }
514
+ };
515
+
516
+ hierarchicalMenuParams.templates.item = '' +
517
+ '<div class="ais-hierearchical-link-wrapper">' +
518
+ '<a class="{{cssClasses.link}}" href="{{url}}">{{name}}' +
519
+ '{{#isRefined}}<img class="cross-circle" src="<?php echo $this->getSkinUrl('algoliasearch/cross-circle.png') ?>"/>{{/isRefined}}' +
520
+ '<span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span></a>' +
521
+ '</div>';
522
+
523
+ if (algoliaConfig.request.path.length > 0) {
524
+ hierarchicalMenuParams.rootPath = algoliaConfig.request.path;
525
+ }
526
+
527
+ return algoliaBundle.instantsearch.widgets.hierarchicalMenu(hierarchicalMenuParams);
528
+ }
529
+ };
530
+
531
+ /** Add all facet widgets to instatnsearch object **/
532
+ var wrapper = document.getElementById('instant-search-facets-container');
533
+ $.each(algoliaConfig.facets, function (i, facet) {
534
+
535
+ if (facet.attribute.indexOf("price") !== -1)
536
+ facet.attribute = facet.attribute + algoliaConfig.priceKey;
537
+
538
+ facet.wrapper = wrapper;
539
+
540
+ var templates = {
541
+ header: '<div class="name">' + (facet.label ? facet.label : facet.attribute) + '</div>'
542
+ };
543
+
544
+ var widget = customAttributeFacet[facet.attribute] !== undefined ?
545
+ customAttributeFacet[facet.attribute](facet, templates) :
546
+ getFacetWidget(facet, templates);
547
+
548
+ search.addWidget(widget);
549
+ });
550
+
551
+ /**
552
+ * Pagination
553
+ * Docs: https://community.algolia.com/instantsearch.js/documentation/#pagination
554
+ **/
555
+ search.addWidget(
556
+ algoliaBundle.instantsearch.widgets.pagination({
557
+ container: '#instant-search-pagination-container',
558
+ cssClass: 'algolia-pagination',
559
+ showFirstLast: false,
560
+ maxPages: 1000,
561
+ labels: {
562
+ previous: '<?php echo $this->__('Previous page'); ?>',
563
+ next: '<?php echo $this->__('Next page'); ?>'
564
+ },
565
+ scrollTo: 'body'
566
+ })
567
+ );
568
+
569
+ var isStarted = false;
570
+ function startInstantSearch() {
571
+ if(isStarted == true) {
572
+ return;
573
+ }
574
+
575
+ search.start();
576
+
577
+ handleInputCrossInstant($(instant_selector));
578
+
579
+ var instant_search_bar = $(instant_selector);
580
+ if (instant_search_bar.is(":focus") === false) {
581
+ focusInstantSearchBar(search, instant_search_bar);
582
+ }
583
+
584
+ if (algoliaConfig.autocomplete.enabled) {
585
+ $('#search_mini_form').addClass('search-page');
586
+ }
587
+
588
+ $(document).on('click', '.ais-hierarchical-menu--link, .ais-refinement-list--checkbox', function () {
589
+ focusInstantSearchBar(search, instant_search_bar);
590
+ });
591
+
592
+ isStarted = true;
593
+ }
594
+
595
+ /** Initialise searching **/
596
+ startInstantSearch();
597
+ });
598
+ });
599
+
600
+ //]]>
601
+ </script>
app/design/frontend/base/default/template/algoliasearch/{beforecontent.phtml → internals/beforecontent.phtml} RENAMED
File without changes
app/design/frontend/base/default/template/algoliasearch/{beforetopsearch.phtml → internals/commonjs.phtml} RENAMED
@@ -1,18 +1,30 @@
1
  <?php
2
 
 
3
  $config = Mage::helper('algoliasearch/config');
4
- $catalogSearchHelper = $this->helper('catalogsearch'); /** @var $catalogSearchHelper Mage_CatalogSearch_Helper_Data */
5
- $algoliaSearchHelper = $this->helper('algoliasearch'); /** @var $algoliaSearchHelper Algolia_Algoliasearch_Helper_Data */
 
 
 
 
 
 
6
  $product_helper = Mage::helper('algoliasearch/entity_producthelper');
 
 
7
  $algolia_helper = Mage::helper('algoliasearch/algoliahelper');
8
 
9
- $base_url = Mage::getBaseUrl();
10
 
11
  $isSearchPage = false;
12
  $isCategoryPage = false;
13
 
14
  $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
15
- $group_id = Mage::getSingleton('customer/session')->getCustomerGroupId();
 
 
 
16
 
17
  $price_key = $config->isCustomerGroupsEnabled(Mage::app()->getStore()->getStoreId()) ? '.'.$currency_code.'.group_'.$group_id : '.'.$currency_code.'.default';
18
 
@@ -26,12 +38,10 @@ $path = '';
26
  /**
27
  * Handle category replacement
28
  */
29
- if($config->isInstantEnabled() && $config->replaceCategories() && Mage::app()->getRequest()->getControllerName() == 'category')
30
- {
31
  $category = Mage::registry('current_category');
32
 
33
- if ($category && $category->getDisplayMode() !== 'PAGE')
34
- {
35
  $category->getUrlInstance()->setStore(Mage::app()->getStore()->getStoreId());
36
 
37
  foreach ($category->getPathIds() as $treeCategoryId) {
@@ -52,39 +62,38 @@ if($config->isInstantEnabled() && $config->replaceCategories() && Mage::app()->g
52
  /**
53
  * Handle search
54
  */
55
- if ($config->isInstantEnabled())
56
- {
57
  $pageIdentifier = Mage::app()->getFrontController()->getAction()->getFullActionName();
58
 
59
- if ($pageIdentifier === 'catalogsearch_result_index')
60
- {
61
  $query = $catalogSearchHelper->getEscapedQueryText();
62
 
63
- if ($query == '__empty__')
64
  $query = '';
 
65
 
66
  $product_helper = Mage::helper('algoliasearch/entity_producthelper');
67
 
68
  $refinement_key = Mage::app()->getRequest()->getParam('refinement_key');
69
 
70
- if ($refinement_key !== null)
71
- {
72
  $refinement_value = $query;
73
  $query = "";
74
  }
75
- else
76
  $refinement_key = "";
 
77
 
78
  $isSearchPage = true;
79
  }
80
  }
81
 
82
- if ($base_url[strlen($base_url) - 1] == '/')
83
- $base_url = substr($base_url, 0, strlen($base_url) - 1);
84
-
85
  if ($config->isInstantEnabled() && $isSearchPage) {
86
- // hide the instant-search selector ASAP to remove flickering. Will be re-displayed later with JS
87
- echo '<style>' . $config->getInstantSelector() . '{ display: none; }</style>';
 
 
88
  }
89
 
90
  ?>
@@ -106,6 +115,7 @@ if ($config->isInstantEnabled() && $isSearchPage) {
106
  nbOfCategoriesSuggestions: '<?php echo $config->getNumberOfCategoriesSuggestions(); ?>',
107
  nbOfQueriesSuggestions: '<?php echo $config->getNumberOfQueriesSuggestions(); ?>'
108
  },
 
109
  applicationId: '<?php echo $config->getApplicationID() ?>',
110
  indexName: '<?php echo $product_helper->getBaseIndexName(); ?>',
111
  apiKey: '<?php echo $algolia_helper->generateSearchSecuredApiKey($config->getSearchOnlyAPIKey(), $config->getAttributesToRetrieve($group_id)) ?>',
@@ -205,7 +215,7 @@ if ($config->isInstantEnabled() && $isSearchPage) {
205
 
206
  var listItemTemplate = '<label class="{{cssClasses.label}}">' +
207
  '<input type="checkbox" class="{{cssClasses.checkbox}}" value="{{name}}" {{#isRefined}}checked{{/isRefined}} />{{name}}' +
208
- '{{#isRefined}}<img class="cross-circle" src="<?php echo Mage::getBaseUrl(); ?>/skin/frontend/base/default/algoliasearch/cross-circle.png"/>{{/isRefined}}' +
209
  '<span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span>' +
210
  '</label>';
211
 
@@ -315,7 +325,7 @@ if ($config->isInstantEnabled() && $isSearchPage) {
315
  source: $.fn.autocomplete.sources.hits(algolia_client.initIndex(algoliaConfig.indexName + "_" + section.name), options),
316
  name: i,
317
  templates: {
318
- empty: '<div class="aa-no-results">No results</div>',
319
  suggestion: function (hit) {
320
  if (section.name === 'categories') {
321
  hit.displayKey = hit.path;
@@ -405,7 +415,7 @@ if ($config->isInstantEnabled() && $isSearchPage) {
405
  source.templates.footer = function (query, content) {
406
  var keys = [];
407
  for (var key in content.facets['categories.level0']) {
408
- var url = algoliaConfig.baseUrl + '/catalogsearch/result/?q=' + query.query + '#q=' + query.query + '&hFR[categories.level0][0]=' + encodeURIComponent(key) + '&idx=' + algoliaConfig.indexName + '_products';
409
  keys.push({
410
  key: key,
411
  value: content.facets['categories.level0'][key],
@@ -426,9 +436,17 @@ if ($config->isInstantEnabled() && $isSearchPage) {
426
  if (keys.length > 1) {
427
  ors += ', <span><a href="' + keys[1].url + '">' + keys[1].key + '</a></span>';
428
  }
 
 
 
 
 
 
 
 
 
429
 
430
- var allUrl = algoliaConfig.baseUrl + '/catalogsearch/result/?q=' + query.query;
431
- return '<div id="autocomplete-products-footer">See products in <span><a href="' + allUrl + '">All departments</a></span> (' + content.nbHits + ') or in ' + ors + '</div>';
432
  }
433
  }
434
 
@@ -548,6 +566,11 @@ if ($config->isInstantEnabled() && $isSearchPage) {
548
  $(document).on('click', '.clear-query-autocomplete', function () {
549
  var input = $(this).closest('#algolia-searchbox').find('input');
550
  input.val('');
 
 
 
 
 
551
  handleInputCrossAutocomplete(input);
552
  });
553
 
@@ -557,9 +580,9 @@ if ($config->isInstantEnabled() && $isSearchPage) {
557
  $('body').on('click', '#refine-toggle', function () {
558
  $('#instant-search-facets-container').toggleClass('hidden-sm').toggleClass('hidden-xs');
559
  if ($(this).html()[0] === '+')
560
- $(this).html('- Refine');
561
  else
562
- $(this).html('+ Refine');
563
  });
564
 
565
  $.fn.focusWithoutScrolling = function(){
@@ -573,6 +596,10 @@ if ($config->isInstantEnabled() && $isSearchPage) {
573
 
574
  <!--[if lte IE 9]>
575
  <script>
576
- algoliaConfig.autofocus = false;
 
 
 
 
577
  </script>
578
  <![endif]-->
1
  <?php
2
 
3
+ /** @var Algolia_Algoliasearch_Helper_Config $config */
4
  $config = Mage::helper('algoliasearch/config');
5
+
6
+ /** @var Mage_CatalogSearch_Helper_Data $catalogSearchHelper */
7
+ $catalogSearchHelper = $this->helper('catalogsearch');
8
+
9
+ /** @var Algolia_Algoliasearch_Helper_Data $algoliaSearchHelper */
10
+ $algoliaSearchHelper = $this->helper('algoliasearch');
11
+
12
+ /** @var Algolia_Algoliasearch_Helper_Entity_Producthelper $product_helper **/
13
  $product_helper = Mage::helper('algoliasearch/entity_producthelper');
14
+
15
+ /** @var Algolia_Algoliasearch_Helper_Algoliahelper $algolia_helper **/
16
  $algolia_helper = Mage::helper('algoliasearch/algoliahelper');
17
 
18
+ $base_url = rtrim(Mage::getBaseUrl(), '/');
19
 
20
  $isSearchPage = false;
21
  $isCategoryPage = false;
22
 
23
  $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
24
+
25
+ /** @var Mage_Customer_Model_Session $session */
26
+ $session = Mage::getSingleton('customer/session');
27
+ $group_id = $session->getCustomerGroupId();
28
 
29
  $price_key = $config->isCustomerGroupsEnabled(Mage::app()->getStore()->getStoreId()) ? '.'.$currency_code.'.group_'.$group_id : '.'.$currency_code.'.default';
30
 
38
  /**
39
  * Handle category replacement
40
  */
41
+ if ($config->isInstantEnabled() && $config->replaceCategories() && Mage::app()->getRequest()->getControllerName() == 'category') {
 
42
  $category = Mage::registry('current_category');
43
 
44
+ if ($category && $category->getDisplayMode() !== 'PAGE') {
 
45
  $category->getUrlInstance()->setStore(Mage::app()->getStore()->getStoreId());
46
 
47
  foreach ($category->getPathIds() as $treeCategoryId) {
62
  /**
63
  * Handle search
64
  */
65
+ if ($config->isInstantEnabled()) {
 
66
  $pageIdentifier = Mage::app()->getFrontController()->getAction()->getFullActionName();
67
 
68
+ if ($pageIdentifier === 'catalogsearch_result_index') {
 
69
  $query = $catalogSearchHelper->getEscapedQueryText();
70
 
71
+ if ($query == '__empty__') {
72
  $query = '';
73
+ }
74
 
75
  $product_helper = Mage::helper('algoliasearch/entity_producthelper');
76
 
77
  $refinement_key = Mage::app()->getRequest()->getParam('refinement_key');
78
 
79
+ if ($refinement_key !== null) {
 
80
  $refinement_value = $query;
81
  $query = "";
82
  }
83
+ else {
84
  $refinement_key = "";
85
+ }
86
 
87
  $isSearchPage = true;
88
  }
89
  }
90
 
91
+ // Hide the instant-search selector ASAP to remove flickering. Will be re-displayed later with JS.
 
 
92
  if ($config->isInstantEnabled() && $isSearchPage) {
93
+ echo '
94
+ <script>
95
+ document.write(\'<style type="text/css"> ' . $config->getInstantSelector() . '{display:none}</style>\');
96
+ </script>';
97
  }
98
 
99
  ?>
115
  nbOfCategoriesSuggestions: '<?php echo $config->getNumberOfCategoriesSuggestions(); ?>',
116
  nbOfQueriesSuggestions: '<?php echo $config->getNumberOfQueriesSuggestions(); ?>'
117
  },
118
+ extensionVersion: '<?php echo $config->getExtensionVersion() ?>',
119
  applicationId: '<?php echo $config->getApplicationID() ?>',
120
  indexName: '<?php echo $product_helper->getBaseIndexName(); ?>',
121
  apiKey: '<?php echo $algolia_helper->generateSearchSecuredApiKey($config->getSearchOnlyAPIKey(), $config->getAttributesToRetrieve($group_id)) ?>',
215
 
216
  var listItemTemplate = '<label class="{{cssClasses.label}}">' +
217
  '<input type="checkbox" class="{{cssClasses.checkbox}}" value="{{name}}" {{#isRefined}}checked{{/isRefined}} />{{name}}' +
218
+ '{{#isRefined}}<img class="cross-circle" src="<?php echo $this->getSkinUrl('algoliasearch/cross-circle.png') ?>"/>{{/isRefined}}' +
219
  '<span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span>' +
220
  '</label>';
221
 
325
  source: $.fn.autocomplete.sources.hits(algolia_client.initIndex(algoliaConfig.indexName + "_" + section.name), options),
326
  name: i,
327
  templates: {
328
+ empty: '<div class="aa-no-results"><?php echo $this->__("No results"); ?></div>',
329
  suggestion: function (hit) {
330
  if (section.name === 'categories') {
331
  hit.displayKey = hit.path;
415
  source.templates.footer = function (query, content) {
416
  var keys = [];
417
  for (var key in content.facets['categories.level0']) {
418
+ var url = algoliaConfig.baseUrl + '/catalogsearch/result/?q=' + encodeURIComponent(query.query) + '#q=' + encodeURIComponent(query.query) + '&hFR[categories.level0][0]=' + encodeURIComponent(key) + '&idx=' + algoliaConfig.indexName + '_products';
419
  keys.push({
420
  key: key,
421
  value: content.facets['categories.level0'][key],
436
  if (keys.length > 1) {
437
  ors += ', <span><a href="' + keys[1].url + '">' + keys[1].key + '</a></span>';
438
  }
439
+
440
+ var allUrl = algoliaConfig.baseUrl + '/catalogsearch/result/?q=' + encodeURIComponent(query.query);
441
+ var returnFooter = '<div id="autocomplete-products-footer"><?php echo $this->__('See products in'); ?> <span><a href="' + allUrl + '"><?php echo $this->__('All departments'); ?></a></span> (' + content.nbHits + ')';
442
+
443
+ if(ors && algoliaConfig.instant.enabled) {
444
+ returnFooter += ' <?php echo $this->__('or in'); ?> ' + ors;
445
+ }
446
+
447
+ returnFooter += '</div>';
448
 
449
+ return returnFooter;
 
450
  }
451
  }
452
 
566
  $(document).on('click', '.clear-query-autocomplete', function () {
567
  var input = $(this).closest('#algolia-searchbox').find('input');
568
  input.val('');
569
+
570
+ if(!algoliaConfig.autocomplete.enabled && algoliaConfig.instant.enabled) {
571
+ input.get(0).dispatchEvent(new Event('input'));
572
+ }
573
+
574
  handleInputCrossAutocomplete(input);
575
  });
576
 
580
  $('body').on('click', '#refine-toggle', function () {
581
  $('#instant-search-facets-container').toggleClass('hidden-sm').toggleClass('hidden-xs');
582
  if ($(this).html()[0] === '+')
583
+ $(this).html('- <?php echo $this->__("Refine"); ?>');
584
  else
585
+ $(this).html('+ <?php echo $this->__("Refine"); ?>');
586
  });
587
 
588
  $.fn.focusWithoutScrolling = function(){
596
 
597
  <!--[if lte IE 9]>
598
  <script>
599
+ document.addEventListener("DOMContentLoaded", function(event) {
600
+ algoliaBundle.$(function ($) {
601
+ window.algoliaConfig.autofocus = false;
602
+ });
603
+ });
604
  </script>
605
  <![endif]-->
app/design/frontend/base/default/template/algoliasearch/{frontjs.phtml → internals/frontjs.phtml} RENAMED
File without changes
app/design/frontend/base/default/template/algoliasearch/internals/templateloader.phtml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ <?php
2
+
3
+ echo $this->getChildHtml('algolia-instantsearch');
4
+ echo $this->getChildHtml('algolia-autocomplete');
app/design/frontend/base/default/template/algoliasearch/topsearch.phtml DELETED
@@ -1,802 +0,0 @@
1
- <!--
2
- //================================
3
- //
4
- // Search box
5
- //
6
- //================================
7
- -->
8
-
9
- <?php
10
- $config = Mage::helper('algoliasearch/config');
11
- $catalogSearchHelper = $this->helper('catalogsearch');
12
- $group_id = Mage::getSingleton('customer/session')->getCustomerGroupId();
13
- $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
14
- $price_key = $config->isCustomerGroupsEnabled(Mage::app()->getStore()->getStoreId()) ? '.'.$currency_code.'.group_'.$group_id : '.'.$currency_code.'.default';
15
-
16
- $image_base_url = Mage::getBaseUrl('media');
17
-
18
- $title = '';
19
- $description = '';
20
- $content = '';
21
- $imgHtml = '';
22
-
23
- if($config->isInstantEnabled() && $config->replaceCategories() && Mage::app()->getRequest()->getControllerName() == 'category')
24
- {
25
- $category = Mage::registry('current_category');
26
- $title = $category->getName();
27
-
28
- if ($category && $category->getDisplayMode() !== 'PAGE')
29
- {
30
- $category->getUrlInstance()->setStore(Mage::app()->getStore()->getStoreId());
31
-
32
- if ($category->getDisplayMode() == 'PRODUCTS_AND_PAGE')
33
- {
34
- $page = $category->getLandingPage();
35
- $cms_block = Mage::getModel('cms/block')->load($page);
36
-
37
- $description = $category->getDescription();
38
- $content = $this->getLayout()->createBlock('cms/block')->setBlockId($page)->toHtml();
39
-
40
- if ($category->getImageUrl())
41
- {
42
- $imgHtml = '<p class="category-image"><img src="'.$category->getImageUrl().'" alt="'.$this->escapeHtml($category->getName()).'" title="'.$this->escapeHtml($category->getName()).'" /></p>';
43
- $imgHtml = $this->helper('catalog/output')->categoryAttribute($category, $imgHtml, 'image');
44
- }
45
- }
46
- }
47
- }
48
-
49
- $placeholder = $this->__('Search for products, categories, ...');
50
-
51
- ?>
52
-
53
- <?php if ($config->isDefaultSelector()): ?>
54
- <form id="search_mini_form" action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
55
- <div id="algolia-searchbox">
56
- <label for="search"><?php echo $this->__('Search:') ?></label>
57
- <input id="search" type="text" name="<?php echo $catalogSearchHelper->getQueryParamName() ?>" class="input-text algolia-search-input" autocomplete="off" spellcheck="false" autocorrect="off" autocapitalize="off" placeholder="<?php echo $placeholder; ?>" />
58
- <img class="clear-query-autocomplete" src="<?php echo Mage::getBaseUrl(); ?>/skin/frontend/base/default/algoliasearch/cross.png" />
59
- <svg id="algolia-glass" xmlns="http://www.w3.org/2000/svg" class="magnifying-glass" width="24" height="24" viewBox="0 0 128 128" >
60
- <g transform="scale(4)">
61
- <path stroke-width="3" d="M19.5 19.582l9.438 9.438"></path>
62
- <circle stroke-width="3" cx="12" cy="12" r="10.5" fill="none"></circle>
63
- <path d="M23.646 20.354l-3.293 3.293c-.195.195-.195.512 0 .707l7.293 7.293c.195.195.512.195.707 0l3.293-3.293c.195-.195.195-.512 0-.707l-7.293-7.293c-.195-.195-.512-.195-.707 0z" ></path>
64
- </g>
65
- </svg>
66
- </div>
67
- </form>
68
- <?php endif; ?>
69
-
70
- <!--
71
- //================================
72
- //
73
- // Multi-category Autocomplete
74
- //
75
- //================================
76
- -->
77
-
78
- <!-- Product hit template -->
79
- <script type="text/template" id="autocomplete_products_template">
80
- <a class="algoliasearch-autocomplete-hit" href="{{url}}">
81
- {{#thumbnail_url}}
82
- <div class="thumb"><img src="<?php echo $image_base_url; ?>{{thumbnail_url}}" /></div>
83
- {{/thumbnail_url}}
84
-
85
- <div class="info">
86
- {{{_highlightResult.name.value}}}
87
-
88
- <div class="algoliasearch-autocomplete-category">
89
- {{#categories_without_path}}
90
- <?php echo $this->__('in'); ?> {{{categories_without_path}}}
91
- {{/categories_without_path}}
92
-
93
- {{#_highlightResult.color}}
94
- {{#_highlightResult.color.value}}
95
- <span>
96
- {{#categories_without_path}} | {{/categories_without_path}} Color: {{{_highlightResult.color.value}}}
97
- </span>
98
- {{/_highlightResult.color.value}}
99
- {{/_highlightResult.color}}
100
- </div>
101
-
102
- <div class="algoliasearch-autocomplete-price">
103
- <span class="after_special {{#price<?php echo $price_key; ?>_original_formated}}promotion{{/price<?php echo $price_key; ?>_original_formated}}">
104
- {{price<?php echo $price_key; ?>_formated}}
105
- </span>
106
-
107
- {{#price<?php echo $price_key; ?>_original_formated}}
108
- <span class="before_special">
109
- {{price<?php echo $price_key; ?>_original_formated}}
110
- </span>
111
- {{/price<?php echo $price_key; ?>_original_formated}}
112
- </div>
113
- </div>
114
- </a>
115
- </script>
116
-
117
- <!-- Category hit template -->
118
- <script type="text/template" id="autocomplete_categories_template">
119
- <a class="algoliasearch-autocomplete-hit" href="{{url}}">
120
- {{#image_url}}
121
- <div class="thumb">
122
- <img src="<?php echo $image_base_url; ?>{{image_url}}" />
123
- </div>
124
- {{/image_url}}
125
-
126
- {{#image_url}}
127
- <div class="info">
128
- {{/image_url}}
129
- {{^image_url}}
130
- <div class="info-without-thumb">
131
- {{#_highlightResult.path}}
132
- {{{_highlightResult.path.value}}}
133
- {{/_highlightResult.path}}
134
- {{^_highlightResult.path}}
135
- {{{path}}}
136
- {{/_highlightResult.path}}
137
-
138
- {{#product_count}}
139
- <small>({{product_count}})</small>
140
- {{/product_count}}
141
-
142
- </div>
143
- <div class="clearfix"></div>
144
- {{/image_url}}
145
- </div>
146
- </a>
147
- </script>
148
-
149
- <!-- Page hit template -->
150
- <script type="text/template" id="autocomplete_pages_template">
151
- <a class="algoliasearch-autocomplete-hit" href="{{url}}">
152
- <div class="info-without-thumb">
153
- {{{_highlightResult.name.value}}}
154
- {{#content}}
155
- <div class="details">
156
- {{{content}}}
157
- </div>
158
- {{/content}}
159
- </div>
160
- <div class="clearfix"></div>
161
- </a>
162
- </script>
163
-
164
- <!-- Extra attribute hit template -->
165
- <script type="text/template" id="autocomplete_extra_template">
166
- <a class="algoliasearch-autocomplete-hit" href="{{url}}">
167
- <div class="info-without-thumb">
168
- {{{_highlightResult.value.value}}}
169
- </div>
170
- <div class="clearfix"></div>
171
- </a>
172
- </script>
173
-
174
- <!-- Suggestion hit template -->
175
- <script type="text/template" id="autocomplete_suggestions_template">
176
- <a class="algoliasearch-autocomplete-hit" href="{{url}}">
177
- <svg xmlns="http://www.w3.org/2000/svg" class="algolia-glass-suggestion magnifying-glass" width="24" height="24" viewBox="0 0 128 128" >
178
- <g transform="scale(2.5)">
179
- <path stroke-width="3" d="M19.5 19.582l9.438 9.438"></path>
180
- <circle stroke-width="3" cx="12" cy="12" r="10.5" fill="none"></circle>
181
- <path d="M23.646 20.354l-3.293 3.293c-.195.195-.195.512 0 .707l7.293 7.293c.195.195.512.195.707 0l3.293-3.293c.195-.195.195-.512 0-.707l-7.293-7.293c-.195-.195-.512-.195-.707 0z" ></path>
182
- </g>
183
- </svg>
184
- <div class="info-without-thumb">
185
- {{{_highlightResult.query.value}}}
186
-
187
- {{#category}}
188
- <span class="text-muted"><?php echo $this->__('in'); ?></span> <span class="category-tag">{{category}}</span>
189
- {{/category}}
190
- </div>
191
- <div class="clearfix"></div>
192
- </a>
193
- </script>
194
-
195
-
196
- <!--
197
- //================================
198
- //
199
- // Instant search results page
200
- //
201
- //================================
202
- -->
203
-
204
-
205
-
206
- <!-- Wrapping template -->
207
- <script type="text/template" id="instant_wrapper_template">
208
- {{#findAutocomplete}}
209
- <div id="algolia-autocomplete-container"></div>
210
- {{/findAutocomplete}}
211
- <div id="algolia_instant_selector" class="<?php echo count($config->getFacets()) > 0 ? ' with-facets' : '' ?>">
212
-
213
- <?php if ($title || $imgHtml || $description || $content): ?>
214
- <div class="row">
215
- <div class="col-md-12">
216
- <div id="algolia-static-content">
217
- <div class="page-title category-title">
218
- <h1><?php echo $title; ?></h1>
219
- </div>
220
- <div>
221
- <?php echo $imgHtml; ?>
222
- </div>
223
- <div class="category-description std">
224
- <?php echo $description; ?>
225
- </div>
226
- <?php echo $content; ?>
227
- </div>
228
- </div>
229
- </div>
230
- <?php endif; ?>
231
-
232
- <div class="row">
233
- <div class="col-md-3" id="algolia-left-container">
234
- <div id="refine-toggle" class="visible-xs visible-sm">+ <?php echo $this->__('Refine'); ?></div>
235
- <div class="hidden-xs hidden-sm" id="instant-search-facets-container">
236
- <div id="current-refinements"></div>
237
- </div>
238
- </div>
239
-
240
- <div class="col-md-9" id="algolia-right-container">
241
- <div class="row">
242
- <div class="col-md-12">
243
- <div>
244
- {{#second_bar}}
245
- <div id="instant-search-bar-container">
246
- <div id="instant-search-box">
247
- <div class="instant-search-bar-label">
248
- <svg xmlns="http://www.w3.org/2000/svg" class="magnifying-glass" width="24" height="24" viewBox="0 0 128 128">
249
- <g transform="scale(4)">
250
- <path stroke-width="3" d="M19.5 19.582l9.438 9.438"></path>
251
- <circle stroke-width="3" cx="12" cy="12" r="10.5" fill="none"></circle>
252
- <path d="M23.646 20.354l-3.293 3.293c-.195.195-.195.512 0 .707l7.293 7.293c.195.195.512.195.707 0l3.293-3.293c.195-.195.195-.512 0-.707l-7.293-7.293c-.195-.195-.512-.195-.707 0z"></path>
253
- </g>
254
- </svg>
255
- <span>Current search</span>
256
- </div>
257
- <div class="instant-search-bar-wrapper">
258
- <label for="instant-search-bar">
259
- <?php echo $this->__('Search :'); ?>
260
- </label>
261
-
262
- <input placeholder="<?php echo $this->__('Search for products'); ?>" id="instant-search-bar" type="text" autocomplete="off" spellcheck="false" autocorrect="off" autocapitalize="off" />
263
-
264
- <img class="clear-query-instant" src="<?php echo Mage::getBaseUrl(); ?>/skin/frontend/base/default/algoliasearch/cross.png" />
265
- </div>
266
- </div>
267
- </div>
268
- {{/second_bar}}
269
- </div>
270
- </div>
271
- </div>
272
- <div class="row">
273
- <div>
274
- <div class="hits">
275
- <div class="infos">
276
- <div class="pull-left" id="algolia-stats"></div>
277
- <div class="pull-right">
278
- <div class="sort-by-label pull-left">
279
- <?php echo $this->__('SORT BY'); ?>
280
- </div>
281
- <div class="pull-left" id="algolia-sorts"></div>
282
- </div>
283
- <div class="clearfix"></div>
284
- </div>
285
- <div id="instant-search-results-container"></div>
286
- </div>
287
- </div>
288
- <div class="clearfix"></div>
289
- </div>
290
-
291
- <div class="text-center">
292
- <div id="instant-search-pagination-container"></div>
293
- </div>
294
- </div>
295
- </div>
296
-
297
- </div>
298
- </script>
299
-
300
- <script type="text/template" id="instant-hit-template">
301
- <div class="col-md-4 col-sm-6">
302
- <div class="result-wrapper">
303
- <a href="{{url}}" class="result">
304
- <div class="result-content">
305
- <div class="result-thumbnail">
306
- {{#image_url}}<img src="<?php echo $image_base_url; ?>{{{ image_url }}}" />{{/image_url}}
307
- {{^image_url}}<span class="no-image"></span>{{/image_url}}
308
- </div>
309
- <div class="result-sub-content">
310
- <h3 class="result-title text-ellipsis">
311
- {{{ _highlightResult.name.value }}}
312
- </h3>
313
- <div class="ratings">
314
- <div class="result-sub-content">
315
- <div class="ratings">
316
- <div class="rating-box">
317
- <div class="rating" style="width:{{rating_summary}}%" width="148" height="148"></div>
318
- </div>
319
- </div>
320
- <div class="price">
321
- <div class="price-wrapper">
322
- <div>
323
- <span class="after_special {{#price<?php echo $price_key; ?>_original_formated}}promotion{{/price<?php echo $price_key; ?>_original_formated}}">
324
- {{price<?php echo $price_key; ?>_formated}}
325
- </span>
326
-
327
- {{#price<?php echo $price_key; ?>_original_formated}}
328
- <span class="before_special">
329
- {{price<?php echo $price_key; ?>_original_formated}}
330
- </span>
331
- {{/price<?php echo $price_key; ?>_original_formated}}
332
- </div>
333
- </div>
334
- </div>
335
- </div>
336
- </div>
337
- <div class="result-description text-ellipsis">{{{ _highlightResult.description.value }}}</div>
338
-
339
- {{#isAddToCartEnabled}}
340
- {{#in_stock}}
341
- <form action="<?php echo Mage::getBaseUrl(); ?>/checkout/cart/add/product/{{objectID}}" method="post">
342
- <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
343
- <input type="hidden" name="qty" value="1">
344
- <button type="submit"><?php echo $this->__('Add to Cart'); ?></button>
345
- </form>
346
- {{/in_stock}}
347
- {{/isAddToCartEnabled}}
348
- </div>
349
- </div>
350
- <div class="clearfix"></div>
351
- </a>
352
- </div>
353
- </div>
354
- </script>
355
-
356
- <script type="text/template" id="instant-stats-template">
357
- {{#hasOneResult}}<strong>1</strong> <?php echo $this->__('result'); ?> found{{/hasOneResult}}
358
- {{#hasManyResults}}{{^hasNoResults}}{{first}}-{{last}} out of{{/hasNoResults}} <strong>{{#helpers.formatNumber}}{{nbHits}}{{/helpers.formatNumber}} <?php echo $this->__('results found'); ?></strong>{{/hasManyResults}}
359
- <?php echo $this->__('in'); ?> {{seconds}} <?php echo $this->__('seconds'); ?>
360
- </script>
361
-
362
- <script type="text/template" id="facet-template">
363
- <div class="sub_facet {{#isRefined}}checked{{/isRefined}}">
364
- <input class="facet_value" {{#isRefined}}checked{{/isRefined}} type="checkbox">
365
- {{name}}
366
- <span class="count">{{count}}</span>
367
- </div>
368
- </script>
369
-
370
-
371
- <script type="text/template" id="current-refinements-template">
372
- <div class="cross-wrapper">
373
- <img src="<?php echo Mage::getBaseUrl(); ?>/skin/frontend/base/default/algoliasearch/cross.png" />
374
- </div>
375
- <div class="current-refinement-wrapper">
376
- {{#label}}
377
- <span class="current-refinement-label">{{label}}{{^operator}}:{{/operator}}</span>
378
- {{/label}}
379
- {{#operator}}
380
- {{{displayOperator}}}
381
- {{/operator}}
382
- {{#exclude}}-{{/exclude}}
383
- <span class="current-refinement-name">{{name}}</span>
384
- </div>
385
- </script>
386
-
387
- <script type="text/template" id="menu-template">
388
- <div class="autocomplete-wrapper">
389
- <div class="col9">
390
- <div class="aa-dataset-products"></div>
391
- </div>
392
- <div class="col3">
393
- <div class="other-sections">
394
- <div class="aa-dataset-suggestions"></div>
395
- <?php for ($i = 0; $i < 10; $i++): ?>
396
- <div class="aa-dataset-<?php echo $i; ?>"></div>
397
- <?php endfor; ?>
398
- </div>
399
- </div>
400
- </div>
401
- </script>
402
-
403
- <!--
404
- //================================
405
- //
406
- // JavaScript
407
- //
408
- //================================
409
- -->
410
-
411
-
412
- <script type="text/javascript">
413
- //<![CDATA[
414
-
415
- document.addEventListener("DOMContentLoaded", function(event) {
416
- algoliaBundle.$(function ($) {
417
- algoliaConfig.autocomplete.templates = {
418
- suggestions: algoliaBundle.Hogan.compile($('#autocomplete_suggestions_template').html()),
419
- products: algoliaBundle.Hogan.compile($('#autocomplete_products_template').html()),
420
- categories: algoliaBundle.Hogan.compile($('#autocomplete_categories_template').html()),
421
- pages: algoliaBundle.Hogan.compile($('#autocomplete_pages_template').html()),
422
- additionnalSection: algoliaBundle.Hogan.compile($('#autocomplete_extra_template').html())
423
- };
424
-
425
- var algolia_client = algoliaBundle.algoliasearch(algoliaConfig.applicationId, algoliaConfig.apiKey);
426
-
427
- if (algoliaConfig.instant.enabled && (algoliaConfig.isSearchPage || !algoliaConfig.autocomplete.enabled))
428
- {
429
- if ($(algoliaConfig.instant.selector).length <= 0)
430
- throw '[Algolia] Invalid instant-search selector: ' + algoliaConfig.instant.selector;
431
-
432
- if (algoliaConfig.autocomplete.enabled && $(algoliaConfig.instant.selector).find(algoliaConfig.autocomplete.selector).length > 0)
433
- throw '[Algolia] You can\'t have a search input matching "' + algoliaConfig.autocomplete.selector +
434
- '" inside you instant selector "' + algoliaConfig.instant.selector + '"';
435
-
436
- var instant_selector = !algoliaConfig.autocomplete.enabled ? ".algolia-search-input" : "#instant-search-bar";
437
-
438
- var wrapperTemplate = algoliaBundle.Hogan.compile($('#instant_wrapper_template').html());
439
-
440
- var findAutocomplete = algoliaConfig.autocomplete.enabled && $(algoliaConfig.instant.selector).find('#algolia-autocomplete-container').length > 0;
441
-
442
- if (findAutocomplete) {
443
- $(algoliaConfig.instant.selector).find('#algolia-autocomplete-container').remove();
444
- }
445
-
446
- var div = document.createElement('div');
447
- $(div).addClass('algolia-instant-results-wrapper');
448
- $(algoliaConfig.instant.selector).addClass('algolia-instant-replaced-content');
449
- $(algoliaConfig.instant.selector).wrap(div);
450
- $('.algolia-instant-results-wrapper').append('<div class="algolia-instant-selector-results"></div>');
451
-
452
- $('.algolia-instant-selector-results').html(wrapperTemplate.render({second_bar: algoliaConfig.autocomplete.enabled, findAutocomplete: findAutocomplete})).show();
453
-
454
- /** Initialise instant search **/
455
- var search = algoliaBundle.instantsearch({
456
- appId: algoliaConfig.applicationId,
457
- apiKey: algoliaConfig.apiKey,
458
- indexName: algoliaConfig.indexName + '_products',
459
- urlSync: {
460
- useHash: true,
461
- trackedParameters: ['query', 'page', 'attribute:*', 'index']
462
- }
463
- });
464
-
465
- search.addWidget({
466
- getConfiguration: function () {
467
- if (algoliaConfig.request.query.length > 0 && location.hash.length < 1) {
468
- return { query: algoliaConfig.request.query }
469
- }
470
- return {};
471
- },
472
- init: function(data) {
473
- if (algoliaConfig.request.refinement_key.length > 0) {
474
- data.helper.toggleRefine(algoliaConfig.request.refinement_key, algoliaConfig.request.refinement_value);
475
- }
476
-
477
- if (algoliaConfig.isCategoryPage) {
478
- data.helper.addNumericRefinement('visibility_catalog', '=', 1);
479
- }
480
- else {
481
- data.helper.addNumericRefinement('visibility_search', '=', 1);
482
- }
483
- },
484
- render: function (data) {
485
- if (! algoliaConfig.isSearchPage) {
486
- if (data.results.query.length === 0) {
487
- $('.algolia-instant-replaced-content').show();
488
- $('.algolia-instant-selector-results').hide();
489
- }
490
- else {
491
- $('.algolia-instant-replaced-content').hide();
492
- $('.algolia-instant-selector-results').show();
493
- }
494
- }
495
- }
496
- });
497
-
498
- /** Search bar **/
499
- search.addWidget(
500
- algoliaBundle.instantsearch.widgets.searchBox({
501
- container: instant_selector,
502
- placeholder: 'Search for products'
503
- })
504
- );
505
-
506
- /** Stats **/
507
- search.addWidget(
508
- algoliaBundle.instantsearch.widgets.stats({
509
- container: '#algolia-stats',
510
- templates: {
511
- body: $('#instant-stats-template').html()
512
- },
513
- transformData: function (data) {
514
- data.first = data.page * data.hitsPerPage + 1;
515
- data.last = Math.min(data.page * data.hitsPerPage + data.hitsPerPage, data.nbHits);
516
- data.seconds = data.processingTimeMS / 1000;
517
-
518
- return data;
519
- }
520
- })
521
- );
522
-
523
- /** Sorts **/
524
- algoliaConfig.sortingIndices.unshift({
525
- name: algoliaConfig.indexName + '_products',
526
- label: '<?php echo $this->__('Relevance'); ?>'
527
- });
528
-
529
- search.addWidget(
530
- algoliaBundle.instantsearch.widgets.sortBySelector({
531
- container: '#algolia-sorts',
532
- indices: algoliaConfig.sortingIndices,
533
- cssClass: 'form-control'
534
- })
535
- );
536
-
537
- /** Hits **/
538
- search.addWidget(
539
- algoliaBundle.instantsearch.widgets.hits({
540
- container: '#instant-search-results-container',
541
- templates: {
542
- item: $('#instant-hit-template').html()
543
- },
544
- transformData: {
545
- item: function (hit) {
546
- hit = transformHit(hit, algoliaConfig.priceKey);
547
- hit.isAddToCartEnabled = algoliaConfig.instant.isAddToCartEnabled;
548
-
549
- return hit;
550
- }
551
- },
552
- hitsPerPage: algoliaConfig.hitsPerPage
553
- })
554
- );
555
-
556
- search.addWidget({
557
- suggestions: [],
558
- init: function () {
559
- if (algoliaConfig.showSuggestionsOnNoResultsPage) {
560
- var $this = this;
561
- $.each(algoliaConfig.popularQueries.slice(0, Math.min(4, algoliaConfig.popularQueries.length)), function (i, query) {
562
- query = $('<div>').html(query).text(); //xss
563
- $this.suggestions.push('<a href="' + algoliaConfig.baseUrl + '/catalogsearch/result/?q=' + encodeURIComponent(query) + '">' + query + '</a>');
564
- });
565
- }
566
- },
567
- render: function (data) {
568
- if (data.results.hits.length === 0) {
569
- var content = '<div class="no-results">';
570
- content += '<div><b><?php echo $this->__('No products for query'); ?> "' + $("<div>").text(data.results.query).html() + '</b>"</div>';
571
- content += '<div class="popular-searches">';
572
-
573
- if (algoliaConfig.showSuggestionsOnNoResultsPage && this.suggestions.length > 0) {
574
- content += '<div><?php echo $this->__('You can can try one of the popular search queries'); ?></div>' + this.suggestions.join(', ');
575
- }
576
-
577
- content += '</div>';
578
- content += '<?php echo $this->__('or'); ?> <a href="' + algoliaConfig.baseUrl + '/catalogsearch/result/?q=__empty__"><?php echo $this->__('See all products'); ?></a>'
579
-
580
- content += '</div>';
581
-
582
- $('#instant-search-results-container').html(content);
583
- }
584
- }
585
- });
586
-
587
- /** Facets **/
588
- var wrapper = document.getElementById('instant-search-facets-container');
589
-
590
- var attributes = [];
591
-
592
- $.each(algoliaConfig.facets, function (i, facet) {
593
- var name = facet.attribute;
594
-
595
- if (name === 'categories') {
596
- if (algoliaConfig.isCategoryPage) {
597
- return;
598
- }
599
- name = 'categories.level0';
600
- }
601
-
602
- if (name === 'price') {
603
- name = facet.attribute + algoliaConfig.priceKey
604
- }
605
-
606
- attributes.push({
607
- name: name,
608
- label: facet.label ? facet.label : facet.attribute
609
- });
610
- });
611
-
612
- search.addWidget(
613
- algoliaBundle.instantsearch.widgets.currentRefinedValues({
614
- container: '#current-refinements',
615
- cssClasses: {
616
- root: 'facet'
617
- },
618
- templates: {
619
- header: '<div class="name">' + '<?php echo $this->__('Selected Filters'); ?>' + '</div>',
620
- item: $('#current-refinements-template').html()
621
- },
622
- attributes: attributes,
623
- onlyListedAttributes: true
624
- })
625
- );
626
-
627
- var customAttributeFacet = {
628
- categories: function(facet, templates) {
629
- var hierarchical_levels = [];
630
- for (var l = 0; l < 10; l++)
631
- hierarchical_levels.push('categories.level' + l.toString());
632
-
633
- var hierarchicalMenuParams = {
634
- container: facet.wrapper.appendChild(document.createElement('div')),
635
- attributes: hierarchical_levels,
636
- separator: ' /// ',
637
- alwaysGetRootLevel: true,
638
- limit: algoliaConfig.maxValuesPerFacet,
639
- templates: templates,
640
- sortBy: ['name:asc'],
641
- cssClasses: {
642
- list: 'hierarchical',
643
- root: 'facet hierarchical'
644
- }
645
- };
646
-
647
- hierarchicalMenuParams.templates.item = '' +
648
- '<div class="ais-hierearchical-link-wrapper">' +
649
- '<a class="{{cssClasses.link}}" href="{{url}}">{{name}}' +
650
- '{{#isRefined}}<img class="cross-circle" src="<?php echo Mage::getBaseUrl(); ?>/skin/frontend/base/default/algoliasearch/cross-circle.png"/>{{/isRefined}}' +
651
- '<span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span></a>' +
652
- '</div>';
653
-
654
- if (algoliaConfig.request.path.length > 0) {
655
- hierarchicalMenuParams.rootPath = algoliaConfig.request.path;
656
- }
657
-
658
- return algoliaBundle.instantsearch.widgets.hierarchicalMenu(hierarchicalMenuParams);
659
- }
660
- };
661
-
662
- $.each(algoliaConfig.facets, function (i, facet) {
663
-
664
- if (facet.attribute.indexOf("price") !== -1)
665
- facet.attribute = facet.attribute + algoliaConfig.priceKey;
666
-
667
- facet.wrapper = wrapper;
668
-
669
- var templates = {
670
- header: '<div class="name">' + (facet.label ? facet.label : facet.attribute) + '</div>'
671
- };
672
-
673
- var widget = customAttributeFacet[facet.attribute] !== undefined ?
674
- customAttributeFacet[facet.attribute](facet, templates) :
675
- getFacetWidget(facet, templates);
676
-
677
- search.addWidget(widget);
678
- });
679
-
680
- /** Pagination **/
681
- search.addWidget(
682
- algoliaBundle.instantsearch.widgets.pagination({
683
- container: '#instant-search-pagination-container',
684
- cssClass: 'algolia-pagination',
685
- showFirstLast: false,
686
- maxPages: 1000,
687
- labels: {
688
- previous: '<?php echo $this->__('Previous page'); ?>',
689
- next: '<?php echo $this->__('Next page'); ?>'
690
- },
691
- scrollTo: 'body'
692
- })
693
- );
694
-
695
- function startInstantSearch() {
696
- search.start();
697
-
698
- handleInputCrossInstant($(instant_selector));
699
-
700
- var instant_search_bar = $(instant_selector);
701
- if (instant_search_bar.is(":focus") === false) {
702
- focusInstantSearchBar(search, instant_search_bar);
703
- }
704
-
705
- if (algoliaConfig.autocomplete.enabled) {
706
- $('#search_mini_form').addClass('search-page');
707
- }
708
-
709
- $(document).on('click', '.ais-hierarchical-menu--link, .ais-refinement-list--checkbox', function () {
710
- focusInstantSearchBar(search, instant_search_bar);
711
- });
712
- }
713
-
714
- if (algoliaConfig.isSearchPage) {
715
- startInstantSearch();
716
- }
717
- else {
718
- (function () {
719
- var isStarted = false;
720
-
721
- $(instant_selector).one('focus', (function () {
722
- if (!isStarted) {
723
- startInstantSearch();
724
- }
725
- isStarted = true;
726
- }));
727
- })();
728
- }
729
- }
730
-
731
- /*****************
732
- **
733
- ** AUTOCOMPLETION MENU
734
- **
735
- *****************/
736
-
737
- /** keep it after instant search to be able to bind to the recreated <div id="algolia-autocomplete-container"></div> **/
738
- if (algoliaConfig.autocomplete.enabled) {
739
- var sources = [];
740
-
741
- /** Add products and categories that are required sections **/
742
- var nb_cat = algoliaConfig.autocomplete.nbOfCategoriesSuggestions >= 1 ? algoliaConfig.autocomplete.nbOfCategoriesSuggestions: 2;
743
- var nb_pro = algoliaConfig.autocomplete.nbOfProductsSuggestions >= 1 ? algoliaConfig.autocomplete.nbOfProductsSuggestions : 6;
744
- var nb_que = algoliaConfig.autocomplete.nbOfQueriesSuggestions >= 0 ? algoliaConfig.autocomplete.nbOfQueriesSuggestions : 0;
745
-
746
- if (nb_que > 0) {
747
- algoliaConfig.autocomplete.sections.unshift({ hitsPerPage: nb_que, label: '', name: "suggestions"});
748
- }
749
-
750
- algoliaConfig.autocomplete.sections.unshift({ hitsPerPage: nb_cat, label: <?php echo json_encode($this->__('Categories')); ?>, name: "categories"});
751
- algoliaConfig.autocomplete.sections.unshift({ hitsPerPage: nb_pro, label: <?php echo json_encode($this->__('Products')); ?>, name: "products"});
752
-
753
- var i = 0;
754
- $.each(algoliaConfig.autocomplete.sections, function (name, section) {
755
- var source = getAutocompleteSource(section, algolia_client, $, i);
756
-
757
- if (source)
758
- sources.push(source);
759
-
760
- /* Those sections have already specific placeholder, so do not use the default aa-dataset-{i} class */
761
- if (section.name !== 'suggestions' && section.name !== 'products')
762
- i++;
763
-
764
- });
765
-
766
- // setup the auto-completed search input
767
- $(algoliaConfig.autocomplete.selector).each(function (i) {
768
- var menu = $(this);
769
- var options = {
770
- hint: false,
771
- templates: {
772
- dropdownMenu: '#menu-template'
773
- },
774
- dropdownMenuContainer: "#algolia-autocomplete-container",
775
- debug: false
776
- };
777
-
778
- if (algoliaConfig.removeBranding === false) {
779
- options.templates.footer = '<div class="footer_algolia"><span>Search by</span> <a href="https://www.algolia.com/?utm_source=magento&utm_medium=link&utm_campaign=magento_autocompletion_menu" target="_blank"><img src="<?php echo Mage::getBaseUrl(); ?>/skin/frontend/base/default/algoliasearch/algolia-logo.png" /></a></div>';
780
- }
781
-
782
- $(this)
783
- .autocomplete(options, sources)
784
- .parent()
785
- .attr('id', 'algolia-autocomplete-tt')
786
- .on('autocomplete:updated', function (e) {
787
- fixAutocompleteCssSticky(menu);
788
- })
789
- .on('autocomplete:updated', function (e) {
790
- fixAutocompleteCssHeight(menu);
791
- });
792
-
793
- $(window).resize(function () {
794
- fixAutocompleteCssSticky(menu);
795
- });
796
- });
797
- }
798
- });
799
- });
800
-
801
- //]]>
802
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/etc/modules/Algolia_Algoliasearch.xml CHANGED
@@ -4,7 +4,7 @@
4
  <Algolia_Algoliasearch>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
- <version>1.5.5</version>
8
  </Algolia_Algoliasearch>
9
  </modules>
10
  </config>
4
  <Algolia_Algoliasearch>
5
  <active>true</active>
6
  <codePool>community</codePool>
7
+ <version>1.6.0</version>
8
  </Algolia_Algoliasearch>
9
  </modules>
10
  </config>
app/locale/en_GB/Algolia_Algoliasearch.csv ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "Algolia Search Products", "Algolia Search Products"
2
+ "Rebuild products.", "Rebuild products."
3
+ "Algolia Search Categories", "Algolia Search Categories"
4
+ "Rebuild categories.", "Rebuild categories."
5
+ "Algolia Search Pages", "Algolia Search Pages"
6
+ "Rebuild pages.", "Rebuild pages."
7
+ "Algolia Search Suggestions", "Algolia Search Suggestions"
8
+ "Rebuild suggestions.", "Rebuild suggestions."
9
+ "Rebuild additional sections.", "Rebuild additional sections."
10
+ "Please enable the queueing system to do it asynchronously (CRON) if you have a lot of products in System > Configuration > Algolia Search > Queue configuration", "Please enable the queueing system to do it asynchronously (CRON) if you have a lot of products in System > Configuration > Algolia Search > Queue configuration"
11
+ "Algolia Search Queue Runner", "Algolia Search Queue Runner"
12
+ "Process the queue if enabled. This allow to run jobs in the queue", "Process the queue if enabled. This allow to run jobs in the queue"
13
+ "Section", "Section"
14
+ "Label", "Label"
15
+ "Hits per page", "Hits per page"
16
+ "Add Section", "Add Section"
17
+ "Attribute", "Attribute"
18
+ "Searchable", "Searchable"
19
+ "Retrievable", "Retrievable"
20
+ "Ordered", "Ordered"
21
+ "Add Attribute", "Add Attribute"
22
+ "Asc / Desc", "Asc / Desc"
23
+ "Add Ranking Criterion", "Add Ranking Criterion"
24
+ "Facet type", "Facet type"
25
+ "Add Facet", "Add Facet"
26
+ "Sort", "Sort"
27
+ "Add Sorting Attribute", "Add Sorting Attribute"
28
+ "Pages", "Pages"
29
+ "Add Excluded Page", "Add Excluded Page"
30
+ "Search by", "Search by"
31
+ "Search for products, categories, ...", "Search for products, categories, ..."
32
+ "Search:", "Search:"
33
+ "in", "in"
34
+ "Categories", "Categories"
35
+ "Products", "Products"
36
+ "Refine", "Refine"
37
+ "Current search", "Current search"
38
+ "Search for products", "Search for products"
39
+ "SORT BY", "SORT BY"
40
+ "Add to Cart", "Add to Cart"
41
+ "result", "result"
42
+ "results found", "results found"
43
+ "seconds", "seconds"
44
+ "Relevance", "Relevance"
45
+ "No products for query", "No products for query"
46
+ "You can try one of the popular search queries", "You can try one of the popular search queries"
47
+ "or", "or"
48
+ "See all products", "See all products"
49
+ "Selected Filters", "Selected Filters"
50
+ "Clear all", "Clear all"
51
+ "Previous page", "Previous page"
52
+ "Next page", "Next page"
53
+ "to", "to"
54
+ "Go", "Go"
55
+ "No results", "No results"
56
+ "All departments", "All departments"
57
+ "See products in", "See products in"
58
+ "or in", "or in"
59
+ "Base Image", "Base Image"
60
+ "Small Image", "Small Image"
61
+ "Thumbnail", "Thumbnail"
62
+ "None", "None"
63
+ "AllOptional", "AllOptional"
64
+ "LastWords", "LastWords"
65
+ "FirstWords", "FirstWords"
66
+ "Synonyms (comma-separated)", "Synonyms (comma-separated)"
67
+ "Add Synonyms", "Add Synonyms"
68
+ "Add One-way Synonyms", "Add One-way Synonyms"
69
+ "Input", "Input"
70
+ "Synonyms", "Synonyms"
71
+ "One-way Synonyms", "One-way Synonyms"
72
+ "Synonyms File", "Synonyms File"
js/algoliasearch/admin_scripts.js CHANGED
@@ -16,4 +16,42 @@ algoliaAdminBundle.$(function($) {
16
  });
17
 
18
  $('.grid tr:not(:first-child):not(:last-child) td').css('cursor', 'move');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  });
16
  });
17
 
18
  $('.grid tr:not(:first-child):not(:last-child) td').css('cursor', 'move');
19
+
20
+ $.getJSON('https://api.github.com/repos/algolia/algoliasearch-magento/releases/latest', function(payload) {
21
+ var latestVersion = payload.name;
22
+
23
+ if(compareVersion(algoliaSearchExtentionsVersion, latestVersion) > 0) {
24
+ $('.content-header h3').after('</td><td style="font-size: 1.25em; color: #D83900; padding: 3px 8px; border: 1px solid;">' +
25
+ '<span style="font-size: 30px; position: relative; top: 5px;">⚠</span>' +
26
+ ' You are using old version of Algolia extension. ' +
27
+ 'Latest version of the extension is '+latestVersion+'. ' +
28
+ 'You can get it on ' +
29
+ '<a href="https://www.magentocommerce.com/magento-connect/search-algolia-search.html" target="_blank">Magento Connect</a>.<br />' +
30
+ '<small style="color: #2f2f2f; font-size: .8em; padding-left: 36px;">' +
31
+ 'It\'s highly recommended to update your version to avoid any unexpecting issues and to get new features.' +
32
+ '</small></td>');
33
+ }
34
+ });
35
+
36
+ function compareVersion(left, right) {
37
+ left = sanitizeVersion(left);
38
+ right = sanitizeVersion(right);
39
+
40
+ for (var i = 0; i < Math.max(left.length, right.length); i++) {
41
+ if (left[i] > right[i]) {
42
+ return -1;
43
+ }
44
+ if (left[i] < right[i]) {
45
+ return 1;
46
+ }
47
+ }
48
+
49
+ return 0;
50
+ }
51
+
52
+ function sanitizeVersion(input) {
53
+ return input.split('.').map(function (n) {
54
+ return parseInt(n, 10);
55
+ });
56
+ }
57
  });
js/algoliasearch/algoliaAdminBundle.min.js CHANGED
@@ -1,36 +1,32 @@
1
- /*! algoliaAdminBundle 4.3.1 | © Algolia SAS | algolia.com */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.algoliaAdminBundle=t():e.algoliaAdminBundle=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports={$:n(1),instantsearch:n(2),algoliasearch:n(8),algoliasearchHelper:n(101),Hogan:n(568),autocomplete:n(642),angular:n(658)},n(660)},function(e,t){var n,r;!function(t,n){"object"==typeof e&&"object"==typeof e.exports?e.exports=t.document?n(t,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return n(e)}:n(t)}("undefined"!=typeof window?window:this,function(i,o){function a(e){var t=!!e&&"length"in e&&e.length,n=ge.type(e);return"function"===n||ge.isWindow(e)?!1:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function s(e,t,n){if(ge.isFunction(t))return ge.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return ge.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(Pe.test(t))return ge.filter(t,e,n);t=ge.filter(t,e)}return ge.grep(e,function(e){return ge.inArray(e,t)>-1!==n})}function u(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function c(e){var t={};return ge.each(e.match(Ae)||[],function(e,n){t[n]=!0}),t}function l(){se.addEventListener?(se.removeEventListener("DOMContentLoaded",f),i.removeEventListener("load",f)):(se.detachEvent("onreadystatechange",f),i.detachEvent("onload",f))}function f(){(se.addEventListener||"load"===i.event.type||"complete"===se.readyState)&&(l(),ge.ready())}function p(e,t,n){if(void 0===n&&1===e.nodeType){var r="data-"+t.replace(Fe,"-$1").toLowerCase();if(n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:Ie.test(n)?ge.parseJSON(n):n}catch(i){}ge.data(e,t,n)}else n=void 0}return n}function d(e){var t;for(t in e)if(("data"!==t||!ge.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function h(e,t,n,r){if(De(e)){var i,o,a=ge.expando,s=e.nodeType,u=s?ge.cache:e,c=s?e[a]:e[a]&&a;if(c&&u[c]&&(r||u[c].data)||void 0!==n||"string"!=typeof t)return c||(c=s?e[a]=ae.pop()||ge.guid++:a),u[c]||(u[c]=s?{}:{toJSON:ge.noop}),("object"==typeof t||"function"==typeof t)&&(r?u[c]=ge.extend(u[c],t):u[c].data=ge.extend(u[c].data,t)),o=u[c],r||(o.data||(o.data={}),o=o.data),void 0!==n&&(o[ge.camelCase(t)]=n),"string"==typeof t?(i=o[t],null==i&&(i=o[ge.camelCase(t)])):i=o,i}}function m(e,t,n){if(De(e)){var r,i,o=e.nodeType,a=o?ge.cache:e,s=o?e[ge.expando]:ge.expando;if(a[s]){if(t&&(r=n?a[s]:a[s].data)){ge.isArray(t)?t=t.concat(ge.map(t,ge.camelCase)):t in r?t=[t]:(t=ge.camelCase(t),t=t in r?[t]:t.split(" ")),i=t.length;for(;i--;)delete r[t[i]];if(n?!d(r):!ge.isEmptyObject(r))return}(n||(delete a[s].data,d(a[s])))&&(o?ge.cleanData([e],!0):me.deleteExpando||a!=a.window?delete a[s]:a[s]=void 0)}}}function v(e,t,n,r){var i,o=1,a=20,s=r?function(){return r.cur()}:function(){return ge.css(e,t,"")},u=s(),c=n&&n[3]||(ge.cssNumber[t]?"":"px"),l=(ge.cssNumber[t]||"px"!==c&&+u)&&Ue.exec(ge.css(e,t));if(l&&l[3]!==c){c=c||l[3],n=n||[],l=+u||1;do o=o||".5",l/=o,ge.style(e,t,l+c);while(o!==(o=s()/u)&&1!==o&&--a)}return n&&(l=+l||+u||0,i=n[1]?l+(n[1]+1)*n[2]:+n[2],r&&(r.unit=c,r.start=l,r.end=i)),i}function g(e){var t=Qe.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function y(e,t){var n,r,i=0,o="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):void 0;if(!o)for(o=[],n=e.childNodes||e;null!=(r=n[i]);i++)!t||ge.nodeName(r,t)?o.push(r):ge.merge(o,y(r,t));return void 0===t||t&&ge.nodeName(e,t)?ge.merge([e],o):o}function b(e,t){for(var n,r=0;null!=(n=e[r]);r++)ge._data(n,"globalEval",!t||ge._data(t[r],"globalEval"))}function x(e){Be.test(e.type)&&(e.defaultChecked=e.checked)}function w(e,t,n,r,i){for(var o,a,s,u,c,l,f,p=e.length,d=g(t),h=[],m=0;p>m;m++)if(a=e[m],a||0===a)if("object"===ge.type(a))ge.merge(h,a.nodeType?[a]:a);else if(Ye.test(a)){for(u=u||d.appendChild(t.createElement("div")),c=(We.exec(a)||["",""])[1].toLowerCase(),f=Ge[c]||Ge._default,u.innerHTML=f[1]+ge.htmlPrefilter(a)+f[2],o=f[0];o--;)u=u.lastChild;if(!me.leadingWhitespace&&Ke.test(a)&&h.push(t.createTextNode(Ke.exec(a)[0])),!me.tbody)for(a="table"!==c||Xe.test(a)?"<table>"!==f[1]||Xe.test(a)?0:u:u.firstChild,o=a&&a.childNodes.length;o--;)ge.nodeName(l=a.childNodes[o],"tbody")&&!l.childNodes.length&&a.removeChild(l);for(ge.merge(h,u.childNodes),u.textContent="";u.firstChild;)u.removeChild(u.firstChild);u=d.lastChild}else h.push(t.createTextNode(a));for(u&&d.removeChild(u),me.appendChecked||ge.grep(y(h,"input"),x),m=0;a=h[m++];)if(r&&ge.inArray(a,r)>-1)i&&i.push(a);else if(s=ge.contains(a.ownerDocument,a),u=y(d.appendChild(a),"script"),s&&b(u),n)for(o=0;a=u[o++];)ze.test(a.type||"")&&n.push(a);return u=null,d}function _(){return!0}function C(){return!1}function $(){try{return se.activeElement}catch(e){}}function S(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)S(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),i===!1)i=C;else if(!i)return e;return 1===o&&(a=i,i=function(e){return ge().off(e),a.apply(this,arguments)},i.guid=a.guid||(a.guid=ge.guid++)),e.each(function(){ge.event.add(this,t,i,r,n)})}function E(e,t){return ge.nodeName(e,"table")&&ge.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function P(e){return e.type=(null!==ge.find.attr(e,"type"))+"/"+e.type,e}function k(e){var t=ut.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function T(e,t){if(1===t.nodeType&&ge.hasData(e)){var n,r,i,o=ge._data(e),a=ge._data(t,o),s=o.events;if(s){delete a.handle,a.events={};for(n in s)for(r=0,i=s[n].length;i>r;r++)ge.event.add(t,n,s[n][r])}a.data&&(a.data=ge.extend({},a.data))}}function O(e,t){var n,r,i;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!me.noCloneEvent&&t[ge.expando]){i=ge._data(t);for(r in i.events)ge.removeEvent(t,r,i.handle);t.removeAttribute(ge.expando)}"script"===n&&t.text!==e.text?(P(t).text=e.text,k(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),me.html5Clone&&e.innerHTML&&!ge.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&Be.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}function R(e,t,n,r){t=ce.apply([],t);var i,o,a,s,u,c,l=0,f=e.length,p=f-1,d=t[0],h=ge.isFunction(d);if(h||f>1&&"string"==typeof d&&!me.checkClone&&st.test(d))return e.each(function(i){var o=e.eq(i);h&&(t[0]=d.call(this,i,o.html())),R(o,t,n,r)});if(f&&(c=w(t,e[0].ownerDocument,!1,e,r),i=c.firstChild,1===c.childNodes.length&&(c=i),i||r)){for(s=ge.map(y(c,"script"),P),a=s.length;f>l;l++)o=c,l!==p&&(o=ge.clone(o,!0,!0),a&&ge.merge(s,y(o,"script"))),n.call(e[l],o,l);if(a)for(u=s[s.length-1].ownerDocument,ge.map(s,k),l=0;a>l;l++)o=s[l],ze.test(o.type||"")&&!ge._data(o,"globalEval")&&ge.contains(u,o)&&(o.src?ge._evalUrl&&ge._evalUrl(o.src):ge.globalEval((o.text||o.textContent||o.innerHTML||"").replace(ct,"")));c=i=null}return e}function N(e,t,n){for(var r,i=t?ge.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||ge.cleanData(y(r)),r.parentNode&&(n&&ge.contains(r.ownerDocument,r)&&b(y(r,"script")),r.parentNode.removeChild(r));return e}function A(e,t){var n=ge(t.createElement(e)).appendTo(t.body),r=ge.css(n[0],"display");return n.detach(),r}function j(e){var t=se,n=dt[e];return n||(n=A(e,t),"none"!==n&&n||(pt=(pt||ge("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement),t=(pt[0].contentWindow||pt[0].contentDocument).document,t.write(),t.close(),n=A(e,t),pt.detach()),dt[e]=n),n}function M(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function D(e){if(e in kt)return e;for(var t=e.charAt(0).toUpperCase()+e.slice(1),n=Pt.length;n--;)if(e=Pt[n]+t,e in kt)return e}function I(e,t){for(var n,r,i,o=[],a=0,s=e.length;s>a;a++)r=e[a],r.style&&(o[a]=ge._data(r,"olddisplay"),n=r.style.display,t?(o[a]||"none"!==n||(r.style.display=""),""===r.style.display&&Ve(r)&&(o[a]=ge._data(r,"olddisplay",j(r.nodeName)))):(i=Ve(r),(n&&"none"!==n||!i)&&ge._data(r,"olddisplay",i?n:ge.css(r,"display"))));for(a=0;s>a;a++)r=e[a],r.style&&(t&&"none"!==r.style.display&&""!==r.style.display||(r.style.display=t?o[a]||"":"none"));return e}function F(e,t,n){var r=$t.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function L(e,t,n,r,i){for(var o=n===(r?"border":"content")?4:"width"===t?1:0,a=0;4>o;o+=2)"margin"===n&&(a+=ge.css(e,n+He[o],!0,i)),r?("content"===n&&(a-=ge.css(e,"padding"+He[o],!0,i)),"margin"!==n&&(a-=ge.css(e,"border"+He[o]+"Width",!0,i))):(a+=ge.css(e,"padding"+He[o],!0,i),"padding"!==n&&(a+=ge.css(e,"border"+He[o]+"Width",!0,i)));return a}function U(e,t,n){var r=!0,o="width"===t?e.offsetWidth:e.offsetHeight,a=yt(e),s=me.boxSizing&&"border-box"===ge.css(e,"boxSizing",!1,a);if(se.msFullscreenElement&&i.top!==i&&e.getClientRects().length&&(o=Math.round(100*e.getBoundingClientRect()[t])),0>=o||null==o){if(o=bt(e,t,a),(0>o||null==o)&&(o=e.style[t]),mt.test(o))return o;r=s&&(me.boxSizingReliable()||o===e.style[t]),o=parseFloat(o)||0}return o+L(e,t,n||(s?"border":"content"),r,a)+"px"}function H(e,t,n,r,i){return new H.prototype.init(e,t,n,r,i)}function V(){return i.setTimeout(function(){Tt=void 0}),Tt=ge.now()}function q(e,t){var n,r={height:e},i=0;for(t=t?1:0;4>i;i+=2-t)n=He[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function B(e,t,n){for(var r,i=(K.tweeners[t]||[]).concat(K.tweeners["*"]),o=0,a=i.length;a>o;o++)if(r=i[o].call(n,t,e))return r}function W(e,t,n){var r,i,o,a,s,u,c,l,f=this,p={},d=e.style,h=e.nodeType&&Ve(e),m=ge._data(e,"fxshow");n.queue||(s=ge._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,u=s.empty.fire,s.empty.fire=function(){s.unqueued||u()}),s.unqueued++,f.always(function(){f.always(function(){s.unqueued--,ge.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[d.overflow,d.overflowX,d.overflowY],c=ge.css(e,"display"),l="none"===c?ge._data(e,"olddisplay")||j(e.nodeName):c,"inline"===l&&"none"===ge.css(e,"float")&&(me.inlineBlockNeedsLayout&&"inline"!==j(e.nodeName)?d.zoom=1:d.display="inline-block")),n.overflow&&(d.overflow="hidden",me.shrinkWrapBlocks()||f.always(function(){d.overflow=n.overflow[0],d.overflowX=n.overflow[1],d.overflowY=n.overflow[2]}));for(r in t)if(i=t[r],Rt.exec(i)){if(delete t[r],o=o||"toggle"===i,i===(h?"hide":"show")){if("show"!==i||!m||void 0===m[r])continue;h=!0}p[r]=m&&m[r]||ge.style(e,r)}else c=void 0;if(ge.isEmptyObject(p))"inline"===("none"===c?j(e.nodeName):c)&&(d.display=c);else{m?"hidden"in m&&(h=m.hidden):m=ge._data(e,"fxshow",{}),o&&(m.hidden=!h),h?ge(e).show():f.done(function(){ge(e).hide()}),f.done(function(){var t;ge._removeData(e,"fxshow");for(t in p)ge.style(e,t,p[t])});for(r in p)a=B(h?m[r]:0,r,f),r in m||(m[r]=a.start,h&&(a.end=a.start,a.start="width"===r||"height"===r?1:0))}}function z(e,t){var n,r,i,o,a;for(n in e)if(r=ge.camelCase(n),i=t[r],o=e[n],ge.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),a=ge.cssHooks[r],a&&"expand"in a){o=a.expand(o),delete e[r];for(n in o)n in e||(e[n]=o[n],t[n]=i)}else t[r]=i}function K(e,t,n){var r,i,o=0,a=K.prefilters.length,s=ge.Deferred().always(function(){delete u.elem}),u=function(){if(i)return!1;for(var t=Tt||V(),n=Math.max(0,c.startTime+c.duration-t),r=n/c.duration||0,o=1-r,a=0,u=c.tweens.length;u>a;a++)c.tweens[a].run(o);return s.notifyWith(e,[c,o,n]),1>o&&u?n:(s.resolveWith(e,[c]),!1)},c=s.promise({elem:e,props:ge.extend({},t),opts:ge.extend(!0,{specialEasing:{},easing:ge.easing._default},n),originalProperties:t,originalOptions:n,startTime:Tt||V(),duration:n.duration,tweens:[],createTween:function(t,n){var r=ge.Tween(e,c.opts,t,n,c.opts.specialEasing[t]||c.opts.easing);return c.tweens.push(r),r},stop:function(t){var n=0,r=t?c.tweens.length:0;if(i)return this;for(i=!0;r>n;n++)c.tweens[n].run(1);return t?(s.notifyWith(e,[c,1,0]),s.resolveWith(e,[c,t])):s.rejectWith(e,[c,t]),this}}),l=c.props;for(z(l,c.opts.specialEasing);a>o;o++)if(r=K.prefilters[o].call(c,e,l,c.opts))return ge.isFunction(r.stop)&&(ge._queueHooks(c.elem,c.opts.queue).stop=ge.proxy(r.stop,r)),r;return ge.map(l,B,c),ge.isFunction(c.opts.start)&&c.opts.start.call(e,c),ge.fx.timer(ge.extend(u,{elem:e,anim:c,queue:c.opts.queue})),c.progress(c.opts.progress).done(c.opts.done,c.opts.complete).fail(c.opts.fail).always(c.opts.always)}function Q(e){return ge.attr(e,"class")||""}function G(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(Ae)||[];if(ge.isFunction(n))for(;r=o[i++];)"+"===r.charAt(0)?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function Y(e,t,n,r){function i(s){var u;return o[s]=!0,ge.each(e[s]||[],function(e,s){var c=s(t,n,r);return"string"!=typeof c||a||o[c]?a?!(u=c):void 0:(t.dataTypes.unshift(c),i(c),!1)}),u}var o={},a=e===tn;return i(t.dataTypes[0])||!o["*"]&&i("*")}function X(e,t){var n,r,i=ge.ajaxSettings.flatOptions||{};for(r in t)void 0!==t[r]&&((i[r]?e:n||(n={}))[r]=t[r]);return n&&ge.extend(!0,e,n),e}function J(e,t,n){for(var r,i,o,a,s=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===i&&(i=e.mimeType||t.getResponseHeader("Content-Type"));if(i)for(a in s)if(s[a]&&s[a].test(i)){u.unshift(a);break}if(u[0]in n)o=u[0];else{for(a in n){if(!u[0]||e.converters[a+" "+u[0]]){o=a;break}r||(r=a)}o=o||r}return o?(o!==u[0]&&u.unshift(o),n[o]):void 0}function Z(e,t,n,r){var i,o,a,s,u,c={},l=e.dataTypes.slice();if(l[1])for(a in e.converters)c[a.toLowerCase()]=e.converters[a];for(o=l.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=l.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(a=c[u+" "+o]||c["* "+o],!a)for(i in c)if(s=i.split(" "),s[1]===o&&(a=c[u+" "+s[0]]||c["* "+s[0]])){a===!0?a=c[i]:c[i]!==!0&&(o=s[0],l.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(f){return{state:"parsererror",error:a?f:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}function ee(e){return e.style&&e.style.display||ge.css(e,"display")}function te(e){for(;e&&1===e.nodeType;){if("none"===ee(e)||"hidden"===e.type)return!0;e=e.parentNode}return!1}function ne(e,t,n,r){var i;if(ge.isArray(t))ge.each(t,function(t,i){n||sn.test(e)?r(e,i):ne(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==ge.type(t))r(e,t);else for(i in t)ne(e+"["+i+"]",t[i],n,r)}function re(){try{return new i.XMLHttpRequest}catch(e){}}function ie(){try{return new i.ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}function oe(e){return ge.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var ae=[],se=i.document,ue=ae.slice,ce=ae.concat,le=ae.push,fe=ae.indexOf,pe={},de=pe.toString,he=pe.hasOwnProperty,me={},ve="1.12.1",ge=function(e,t){return new ge.fn.init(e,t)},ye=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,be=/^-ms-/,xe=/-([\da-z])/gi,we=function(e,t){return t.toUpperCase()};ge.fn=ge.prototype={jquery:ve,constructor:ge,selector:"",length:0,toArray:function(){return ue.call(this)},get:function(e){return null!=e?0>e?this[e+this.length]:this[e]:ue.call(this)},pushStack:function(e){var t=ge.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e){return ge.each(this,e)},map:function(e){return this.pushStack(ge.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(ue.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:le,sort:ae.sort,splice:ae.splice},ge.extend=ge.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,c=!1;for("boolean"==typeof a&&(c=a,a=arguments[s]||{},s++),"object"==typeof a||ge.isFunction(a)||(a={}),s===u&&(a=this,s--);u>s;s++)if(null!=(i=arguments[s]))for(r in i)e=a[r],n=i[r],a!==n&&(c&&n&&(ge.isPlainObject(n)||(t=ge.isArray(n)))?(t?(t=!1,o=e&&ge.isArray(e)?e:[]):o=e&&ge.isPlainObject(e)?e:{},a[r]=ge.extend(c,o,n)):void 0!==n&&(a[r]=n));return a},ge.extend({expando:"jQuery"+(ve+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return"function"===ge.type(e)},isArray:Array.isArray||function(e){return"array"===ge.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){var t=e&&e.toString();return!ge.isArray(e)&&t-parseFloat(t)+1>=0},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},isPlainObject:function(e){var t;if(!e||"object"!==ge.type(e)||e.nodeType||ge.isWindow(e))return!1;try{if(e.constructor&&!he.call(e,"constructor")&&!he.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}if(!me.ownFirst)for(t in e)return he.call(e,t);for(t in e);return void 0===t||he.call(e,t)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?pe[de.call(e)]||"object":typeof e},globalEval:function(e){e&&ge.trim(e)&&(i.execScript||function(e){i.eval.call(i,e)})(e)},camelCase:function(e){return e.replace(be,"ms-").replace(xe,we)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t){var n,r=0;if(a(e))for(n=e.length;n>r&&t.call(e[r],r,e[r])!==!1;r++);else for(r in e)if(t.call(e[r],r,e[r])===!1)break;return e},trim:function(e){return null==e?"":(e+"").replace(ye,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(a(Object(e))?ge.merge(n,"string"==typeof e?[e]:e):le.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(fe)return fe.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;n>r;)e[i++]=t[r++];if(n!==n)for(;void 0!==t[r];)e[i++]=t[r++];return e.length=i,e},grep:function(e,t,n){for(var r,i=[],o=0,a=e.length,s=!n;a>o;o++)r=!t(e[o],o),r!==s&&i.push(e[o]);return i},map:function(e,t,n){var r,i,o=0,s=[];if(a(e))for(r=e.length;r>o;o++)i=t(e[o],o,n),null!=i&&s.push(i);else for(o in e)i=t(e[o],o,n),null!=i&&s.push(i);return ce.apply([],s)},guid:1,proxy:function(e,t){var n,r,i;return"string"==typeof t&&(i=e[t],t=e,e=i),ge.isFunction(e)?(n=ue.call(arguments,2),r=function(){return e.apply(t||this,n.concat(ue.call(arguments)))},r.guid=e.guid=e.guid||ge.guid++,r):void 0},now:function(){return+new Date},support:me}),"function"==typeof Symbol&&(ge.fn[Symbol.iterator]=ae[Symbol.iterator]),ge.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){pe["[object "+t+"]"]=t.toLowerCase()});var _e=function(e){function t(e,t,n,r){var i,o,a,s,u,c,f,d,h=t&&t.ownerDocument,m=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==m&&9!==m&&11!==m)return n;if(!r&&((t?t.ownerDocument||t:U)!==N&&R(t),t=t||N,j)){if(11!==m&&(c=ge.exec(e)))if(i=c[1]){if(9===m){if(!(a=t.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(h&&(a=h.getElementById(i))&&F(t,a)&&a.id===i)return n.push(a),n}else{if(c[2])return J.apply(n,t.getElementsByTagName(e)),n;if((i=c[3])&&w.getElementsByClassName&&t.getElementsByClassName)return J.apply(n,t.getElementsByClassName(i)),n}if(!(!w.qsa||W[e+" "]||M&&M.test(e))){if(1!==m)h=t,d=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(be,"\\$&"):t.setAttribute("id",s=L),f=S(e),o=f.length,u=pe.test(s)?"#"+s:"[id='"+s+"']";o--;)f[o]=u+" "+p(f[o]);d=f.join(","),h=ye.test(e)&&l(t.parentNode)||t}if(d)try{return J.apply(n,h.querySelectorAll(d)),n}catch(v){}finally{s===L&&t.removeAttribute("id")}}}return P(e.replace(se,"$1"),t,n,r)}function n(){function e(n,r){return t.push(n+" ")>_.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[L]=!0,e}function i(e){var t=N.createElement("div");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function o(e,t){for(var n=e.split("|"),r=n.length;r--;)_.attrHandle[n[r]]=t}function a(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&(~t.sourceIndex||K)-(~e.sourceIndex||K);if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function u(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function c(e){return r(function(t){return t=+t,r(function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function l(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}function f(){}function p(e){for(var t=0,n=e.length,r="";n>t;t++)r+=e[t].value;return r}function d(e,t,n){var r=t.dir,i=n&&"parentNode"===r,o=V++;return t.first?function(t,n,o){for(;t=t[r];)if(1===t.nodeType||i)return e(t,n,o)}:function(t,n,a){var s,u,c,l=[H,o];if(a){for(;t=t[r];)if((1===t.nodeType||i)&&e(t,n,a))return!0}else for(;t=t[r];)if(1===t.nodeType||i){if(c=t[L]||(t[L]={}),u=c[t.uniqueID]||(c[t.uniqueID]={}),(s=u[r])&&s[0]===H&&s[1]===o)return l[2]=s[2];if(u[r]=l,l[2]=e(t,n,a))return!0}}}function h(e){return e.length>1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function m(e,n,r){for(var i=0,o=n.length;o>i;i++)t(e,n[i],r);return r}function v(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,c=null!=t;u>s;s++)(o=e[s])&&(!n||n(o,r,i))&&(a.push(o),c&&t.push(s));return a}function g(e,t,n,i,o,a){return i&&!i[L]&&(i=g(i)),o&&!o[L]&&(o=g(o,a)),r(function(r,a,s,u){var c,l,f,p=[],d=[],h=a.length,g=r||m(t||"*",s.nodeType?[s]:s,[]),y=!e||!r&&t?g:v(g,p,e,s,u),b=n?o||(r?e:h||i)?[]:a:y;if(n&&n(y,b,s,u),i)for(c=v(b,d),i(c,[],s,u),l=c.length;l--;)(f=c[l])&&(b[d[l]]=!(y[d[l]]=f));if(r){if(o||e){if(o){for(c=[],l=b.length;l--;)(f=b[l])&&c.push(y[l]=f);o(null,b=[],c,u)}for(l=b.length;l--;)(f=b[l])&&(c=o?ee(r,f):p[l])>-1&&(r[c]=!(a[c]=f))}}else b=v(b===a?b.splice(h,b.length):b),o?o(null,a,b,u):J.apply(a,b)})}function y(e){for(var t,n,r,i=e.length,o=_.relative[e[0].type],a=o||_.relative[" "],s=o?1:0,u=d(function(e){return e===t},a,!0),c=d(function(e){return ee(t,e)>-1},a,!0),l=[function(e,n,r){var i=!o&&(r||n!==k)||((t=n).nodeType?u(e,n,r):c(e,n,r));return t=null,i}];i>s;s++)if(n=_.relative[e[s].type])l=[d(h(l),n)];else{if(n=_.filter[e[s].type].apply(null,e[s].matches),n[L]){for(r=++s;i>r&&!_.relative[e[r].type];r++);return g(s>1&&h(l),s>1&&p(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(se,"$1"),n,r>s&&y(e.slice(s,r)),i>r&&y(e=e.slice(r)),i>r&&p(e))}l.push(n)}return h(l)}function b(e,n){var i=n.length>0,o=e.length>0,a=function(r,a,s,u,c){var l,f,p,d=0,h="0",m=r&&[],g=[],y=k,b=r||o&&_.find.TAG("*",c),x=H+=null==y?1:Math.random()||.1,w=b.length;for(c&&(k=a===N||a||c);h!==w&&null!=(l=b[h]);h++){if(o&&l){for(f=0,a||l.ownerDocument===N||(R(l),s=!j);p=e[f++];)if(p(l,a||N,s)){u.push(l);break}c&&(H=x)}i&&((l=!p&&l)&&d--,r&&m.push(l))}if(d+=h,i&&h!==d){for(f=0;p=n[f++];)p(m,g,a,s);if(r){if(d>0)for(;h--;)m[h]||g[h]||(g[h]=Y.call(u));g=v(g)}J.apply(u,g),c&&!r&&g.length>0&&d+n.length>1&&t.uniqueSort(u)}return c&&(H=x,k=y),m};return i?r(a):a}var x,w,_,C,$,S,E,P,k,T,O,R,N,A,j,M,D,I,F,L="sizzle"+1*new Date,U=e.document,H=0,V=0,q=n(),B=n(),W=n(),z=function(e,t){return e===t&&(O=!0),0},K=1<<31,Q={}.hasOwnProperty,G=[],Y=G.pop,X=G.push,J=G.push,Z=G.slice,ee=function(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1},te="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ne="[\\x20\\t\\r\\n\\f]",re="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",ie="\\["+ne+"*("+re+")(?:"+ne+"*([*^$|!~]?=)"+ne+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+re+"))|)"+ne+"*\\]",oe=":("+re+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+ie+")*)|.*)\\)|)",ae=new RegExp(ne+"+","g"),se=new RegExp("^"+ne+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ne+"+$","g"),ue=new RegExp("^"+ne+"*,"+ne+"*"),ce=new RegExp("^"+ne+"*([>+~]|"+ne+")"+ne+"*"),le=new RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),fe=new RegExp(oe),pe=new RegExp("^"+re+"$"),de={ID:new RegExp("^#("+re+")"),CLASS:new RegExp("^\\.("+re+")"),TAG:new RegExp("^("+re+"|[*])"),ATTR:new RegExp("^"+ie),PSEUDO:new RegExp("^"+oe),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:new RegExp("^(?:"+te+")$","i"),needsContext:new RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},he=/^(?:input|select|textarea|button)$/i,me=/^h\d$/i,ve=/^[^{]+\{\s*\[native \w/,ge=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ye=/[+~]/,be=/'|\\/g,xe=new RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),we=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},_e=function(){R()};try{J.apply(G=Z.call(U.childNodes),U.childNodes),G[U.childNodes.length].nodeType}catch(Ce){J={apply:G.length?function(e,t){X.apply(e,Z.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}w=t.support={},$=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},R=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:U;return r!==N&&9===r.nodeType&&r.documentElement?(N=r,A=N.documentElement,j=!$(N),(n=N.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",_e,!1):n.attachEvent&&n.attachEvent("onunload",_e)),w.attributes=i(function(e){return e.className="i",!e.getAttribute("className")}),w.getElementsByTagName=i(function(e){return e.appendChild(N.createComment("")),!e.getElementsByTagName("*").length}),w.getElementsByClassName=ve.test(N.getElementsByClassName),w.getById=i(function(e){return A.appendChild(e).id=L,!N.getElementsByName||!N.getElementsByName(L).length}),w.getById?(_.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&j){var n=t.getElementById(e);return n?[n]:[]}},_.filter.ID=function(e){var t=e.replace(xe,we);return function(e){return e.getAttribute("id")===t}}):(delete _.find.ID,_.filter.ID=function(e){var t=e.replace(xe,we);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}}),_.find.TAG=w.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):w.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},_.find.CLASS=w.getElementsByClassName&&function(e,t){return"undefined"!=typeof t.getElementsByClassName&&j?t.getElementsByClassName(e):void 0},D=[],M=[],(w.qsa=ve.test(N.querySelectorAll))&&(i(function(e){A.appendChild(e).innerHTML="<a id='"+L+"'></a><select id='"+L+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&M.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||M.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+L+"-]").length||M.push("~="),e.querySelectorAll(":checked").length||M.push(":checked"),e.querySelectorAll("a#"+L+"+*").length||M.push(".#.+[+~]")}),i(function(e){var t=N.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&M.push("name"+ne+"*[*^$|!~]?="),e.querySelectorAll(":enabled").length||M.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),M.push(",.*:")})),(w.matchesSelector=ve.test(I=A.matches||A.webkitMatchesSelector||A.mozMatchesSelector||A.oMatchesSelector||A.msMatchesSelector))&&i(function(e){w.disconnectedMatch=I.call(e,"div"),I.call(e,"[s!='']:x"),D.push("!=",oe)}),M=M.length&&new RegExp(M.join("|")),D=D.length&&new RegExp(D.join("|")),t=ve.test(A.compareDocumentPosition),F=t||ve.test(A.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},z=t?function(e,t){if(e===t)return O=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!w.sortDetached&&t.compareDocumentPosition(e)===n?e===N||e.ownerDocument===U&&F(U,e)?-1:t===N||t.ownerDocument===U&&F(U,t)?1:T?ee(T,e)-ee(T,t):0:4&n?-1:1)}:function(e,t){if(e===t)return O=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,s=[e],u=[t];if(!i||!o)return e===N?-1:t===N?1:i?-1:o?1:T?ee(T,e)-ee(T,t):0;if(i===o)return a(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;s[r]===u[r];)r++;return r?a(s[r],u[r]):s[r]===U?-1:u[r]===U?1:0},N):N},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==N&&R(e),n=n.replace(le,"='$1']"),!(!w.matchesSelector||!j||W[n+" "]||D&&D.test(n)||M&&M.test(n)))try{var r=I.call(e,n);if(r||w.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(i){}return t(n,N,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==N&&R(e),F(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==N&&R(e);var n=_.attrHandle[t.toLowerCase()],r=n&&Q.call(_.attrHandle,t.toLowerCase())?n(e,t,!j):void 0;return void 0!==r?r:w.attributes||!j?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,i=0;if(O=!w.detectDuplicates,T=!w.sortStable&&e.slice(0),e.sort(z),O){for(;t=e[i++];)t===e[i]&&(r=n.push(i));for(;r--;)e.splice(n[r],1)}return T=null,e},C=t.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=C(e)}else if(3===i||4===i)return e.nodeValue}else for(;t=e[r++];)n+=C(t);return n},_=t.selectors={cacheLength:50,createPseudo:r,match:de,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(xe,we),e[3]=(e[3]||e[4]||e[5]||"").replace(xe,we),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return de.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&fe.test(n)&&(t=S(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(xe,we).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=q[e+" "];return t||(t=new RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&q(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(i){var o=t.attr(i,e);return null==o?"!="===n:n?(o+="","="===n?o===r:"!="===n?o!==r:"^="===n?r&&0===o.indexOf(r):"*="===n?r&&o.indexOf(r)>-1:"$="===n?r&&o.slice(-r.length)===r:"~="===n?(" "+o.replace(ae," ")+" ").indexOf(r)>-1:"|="===n?o===r||o.slice(0,r.length+1)===r+"-":!1):!0;
3
-
4
- }},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var c,l,f,p,d,h,m=o!==a?"nextSibling":"previousSibling",v=t.parentNode,g=s&&t.nodeName.toLowerCase(),y=!u&&!s,b=!1;if(v){if(o){for(;m;){for(p=t;p=p[m];)if(s?p.nodeName.toLowerCase()===g:1===p.nodeType)return!1;h=m="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?v.firstChild:v.lastChild],a&&y){for(p=v,f=p[L]||(p[L]={}),l=f[p.uniqueID]||(f[p.uniqueID]={}),c=l[e]||[],d=c[0]===H&&c[1],b=d&&c[2],p=d&&v.childNodes[d];p=++d&&p&&p[m]||(b=d=0)||h.pop();)if(1===p.nodeType&&++b&&p===t){l[e]=[H,d,b];break}}else if(y&&(p=t,f=p[L]||(p[L]={}),l=f[p.uniqueID]||(f[p.uniqueID]={}),c=l[e]||[],d=c[0]===H&&c[1],b=d),b===!1)for(;(p=++d&&p&&p[m]||(b=d=0)||h.pop())&&((s?p.nodeName.toLowerCase()!==g:1!==p.nodeType)||!++b||(y&&(f=p[L]||(p[L]={}),l=f[p.uniqueID]||(f[p.uniqueID]={}),l[e]=[H,b]),p!==t)););return b-=i,b===r||b%r===0&&b/r>=0}}},PSEUDO:function(e,n){var i,o=_.pseudos[e]||_.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return o[L]?o(n):o.length>1?(i=[e,e,"",n],_.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,i=o(e,n),a=i.length;a--;)r=ee(e,i[a]),e[r]=!(t[r]=i[a])}):function(e){return o(e,0,i)}):o}},pseudos:{not:r(function(e){var t=[],n=[],i=E(e.replace(se,"$1"));return i[L]?r(function(e,t,n,r){for(var o,a=i(e,null,r,[]),s=e.length;s--;)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,r,o){return t[0]=e,i(t,null,o,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(xe,we),function(t){return(t.textContent||t.innerText||C(t)).indexOf(e)>-1}}),lang:r(function(e){return pe.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(xe,we).toLowerCase(),function(t){var n;do if(n=j?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===A},focus:function(e){return e===N.activeElement&&(!N.hasFocus||N.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!_.pseudos.empty(e)},header:function(e){return me.test(e.nodeName)},input:function(e){return he.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:c(function(){return[0]}),last:c(function(e,t){return[t-1]}),eq:c(function(e,t,n){return[0>n?n+t:n]}),even:c(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:c(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:c(function(e,t,n){for(var r=0>n?n+t:n;--r>=0;)e.push(r);return e}),gt:c(function(e,t,n){for(var r=0>n?n+t:n;++r<t;)e.push(r);return e})}},_.pseudos.nth=_.pseudos.eq;for(x in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})_.pseudos[x]=s(x);for(x in{submit:!0,reset:!0})_.pseudos[x]=u(x);return f.prototype=_.filters=_.pseudos,_.setFilters=new f,S=t.tokenize=function(e,n){var r,i,o,a,s,u,c,l=B[e+" "];if(l)return n?0:l.slice(0);for(s=e,u=[],c=_.preFilter;s;){(!r||(i=ue.exec(s)))&&(i&&(s=s.slice(i[0].length)||s),u.push(o=[])),r=!1,(i=ce.exec(s))&&(r=i.shift(),o.push({value:r,type:i[0].replace(se," ")}),s=s.slice(r.length));for(a in _.filter)!(i=de[a].exec(s))||c[a]&&!(i=c[a](i))||(r=i.shift(),o.push({value:r,type:a,matches:i}),s=s.slice(r.length));if(!r)break}return n?s.length:s?t.error(e):B(e,u).slice(0)},E=t.compile=function(e,t){var n,r=[],i=[],o=W[e+" "];if(!o){for(t||(t=S(e)),n=t.length;n--;)o=y(t[n]),o[L]?r.push(o):i.push(o);o=W(e,b(i,r)),o.selector=e}return o},P=t.select=function(e,t,n,r){var i,o,a,s,u,c="function"==typeof e&&e,f=!r&&S(e=c.selector||e);if(n=n||[],1===f.length){if(o=f[0]=f[0].slice(0),o.length>2&&"ID"===(a=o[0]).type&&w.getById&&9===t.nodeType&&j&&_.relative[o[1].type]){if(t=(_.find.ID(a.matches[0].replace(xe,we),t)||[])[0],!t)return n;c&&(t=t.parentNode),e=e.slice(o.shift().value.length)}for(i=de.needsContext.test(e)?0:o.length;i--&&(a=o[i],!_.relative[s=a.type]);)if((u=_.find[s])&&(r=u(a.matches[0].replace(xe,we),ye.test(o[0].type)&&l(t.parentNode)||t))){if(o.splice(i,1),e=r.length&&p(o),!e)return J.apply(n,r),n;break}}return(c||E(e,f))(r,t,!j,n,!t||ye.test(e)&&l(t.parentNode)||t),n},w.sortStable=L.split("").sort(z).join("")===L,w.detectDuplicates=!!O,R(),w.sortDetached=i(function(e){return 1&e.compareDocumentPosition(N.createElement("div"))}),i(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||o("type|href|height|width",function(e,t,n){return n?void 0:e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),w.attributes&&i(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||o("value",function(e,t,n){return n||"input"!==e.nodeName.toLowerCase()?void 0:e.defaultValue}),i(function(e){return null==e.getAttribute("disabled")})||o(te,function(e,t,n){var r;return n?void 0:e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(i);ge.find=_e,ge.expr=_e.selectors,ge.expr[":"]=ge.expr.pseudos,ge.uniqueSort=ge.unique=_e.uniqueSort,ge.text=_e.getText,ge.isXMLDoc=_e.isXML,ge.contains=_e.contains;var Ce=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&ge(e).is(n))break;r.push(e)}return r},$e=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},Se=ge.expr.match.needsContext,Ee=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,Pe=/^.[^:#\[\.,]*$/;ge.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?ge.find.matchesSelector(r,e)?[r]:[]:ge.find.matches(e,ge.grep(t,function(e){return 1===e.nodeType}))},ge.fn.extend({find:function(e){var t,n=[],r=this,i=r.length;if("string"!=typeof e)return this.pushStack(ge(e).filter(function(){for(t=0;i>t;t++)if(ge.contains(r[t],this))return!0}));for(t=0;i>t;t++)ge.find(e,r[t],n);return n=this.pushStack(i>1?ge.unique(n):n),n.selector=this.selector?this.selector+" "+e:e,n},filter:function(e){return this.pushStack(s(this,e||[],!1))},not:function(e){return this.pushStack(s(this,e||[],!0))},is:function(e){return!!s(this,"string"==typeof e&&Se.test(e)?ge(e):e||[],!1).length}});var ke,Te=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,Oe=ge.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||ke,"string"==typeof e){if(r="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:Te.exec(e),!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ge?t[0]:t,ge.merge(this,ge.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:se,!0)),Ee.test(r[1])&&ge.isPlainObject(t))for(r in t)ge.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}if(i=se.getElementById(r[2]),i&&i.parentNode){if(i.id!==r[2])return ke.find(e);this.length=1,this[0]=i}return this.context=se,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):ge.isFunction(e)?"undefined"!=typeof n.ready?n.ready(e):e(ge):(void 0!==e.selector&&(this.selector=e.selector,this.context=e.context),ge.makeArray(e,this))};Oe.prototype=ge.fn,ke=ge(se);var Re=/^(?:parents|prev(?:Until|All))/,Ne={children:!0,contents:!0,next:!0,prev:!0};ge.fn.extend({has:function(e){var t,n=ge(e,this),r=n.length;return this.filter(function(){for(t=0;r>t;t++)if(ge.contains(this,n[t]))return!0})},closest:function(e,t){for(var n,r=0,i=this.length,o=[],a=Se.test(e)||"string"!=typeof e?ge(e,t||this.context):0;i>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?a.index(n)>-1:1===n.nodeType&&ge.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?ge.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?ge.inArray(this[0],ge(e)):ge.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(ge.uniqueSort(ge.merge(this.get(),ge(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ge.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return Ce(e,"parentNode")},parentsUntil:function(e,t,n){return Ce(e,"parentNode",n)},next:function(e){return u(e,"nextSibling")},prev:function(e){return u(e,"previousSibling")},nextAll:function(e){return Ce(e,"nextSibling")},prevAll:function(e){return Ce(e,"previousSibling")},nextUntil:function(e,t,n){return Ce(e,"nextSibling",n)},prevUntil:function(e,t,n){return Ce(e,"previousSibling",n)},siblings:function(e){return $e((e.parentNode||{}).firstChild,e)},children:function(e){return $e(e.firstChild)},contents:function(e){return ge.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:ge.merge([],e.childNodes)}},function(e,t){ge.fn[e]=function(n,r){var i=ge.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=ge.filter(r,i)),this.length>1&&(Ne[e]||(i=ge.uniqueSort(i)),Re.test(e)&&(i=i.reverse())),this.pushStack(i)}});var Ae=/\S+/g;ge.Callbacks=function(e){e="string"==typeof e?c(e):ge.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=e.once,r=t=!0;a.length;s=-1)for(n=a.shift();++s<o.length;)o[s].apply(n[0],n[1])===!1&&e.stopOnFalse&&(s=o.length,n=!1);e.memory||(n=!1),t=!1,i&&(o=n?[]:"")},l={add:function(){return o&&(n&&!t&&(s=o.length-1,a.push(n)),function r(t){ge.each(t,function(t,n){ge.isFunction(n)?e.unique&&l.has(n)||o.push(n):n&&n.length&&"string"!==ge.type(n)&&r(n)})}(arguments),n&&!t&&u()),this},remove:function(){return ge.each(arguments,function(e,t){for(var n;(n=ge.inArray(t,o,n))>-1;)o.splice(n,1),s>=n&&s--}),this},has:function(e){return e?ge.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=!0,n||l.disable(),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=n||[],n=[e,n.slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l},ge.extend({Deferred:function(e){var t=[["resolve","done",ge.Callbacks("once memory"),"resolved"],["reject","fail",ge.Callbacks("once memory"),"rejected"],["notify","progress",ge.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return ge.Deferred(function(n){ge.each(t,function(t,o){var a=ge.isFunction(e[t])&&e[t];i[o[1]](function(){var e=a&&a.apply(this,arguments);e&&ge.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[o[0]+"With"](this===r?n.promise():this,a?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?ge.extend(e,r):r}},i={};return r.pipe=r.then,ge.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t,n,r,i=0,o=ue.call(arguments),a=o.length,s=1!==a||e&&ge.isFunction(e.promise)?a:0,u=1===s?e:ge.Deferred(),c=function(e,n,r){return function(i){n[e]=this,r[e]=arguments.length>1?ue.call(arguments):i,r===t?u.notifyWith(n,r):--s||u.resolveWith(n,r)}};if(a>1)for(t=new Array(a),n=new Array(a),r=new Array(a);a>i;i++)o[i]&&ge.isFunction(o[i].promise)?o[i].promise().progress(c(i,n,t)).done(c(i,r,o)).fail(u.reject):--s;return s||u.resolveWith(r,o),u.promise()}});var je;ge.fn.ready=function(e){return ge.ready.promise().done(e),this},ge.extend({isReady:!1,readyWait:1,holdReady:function(e){e?ge.readyWait++:ge.ready(!0)},ready:function(e){(e===!0?--ge.readyWait:ge.isReady)||(ge.isReady=!0,e!==!0&&--ge.readyWait>0||(je.resolveWith(se,[ge]),ge.fn.triggerHandler&&(ge(se).triggerHandler("ready"),ge(se).off("ready"))))}}),ge.ready.promise=function(e){if(!je)if(je=ge.Deferred(),"complete"===se.readyState||"loading"!==se.readyState&&!se.documentElement.doScroll)i.setTimeout(ge.ready);else if(se.addEventListener)se.addEventListener("DOMContentLoaded",f),i.addEventListener("load",f);else{se.attachEvent("onreadystatechange",f),i.attachEvent("onload",f);var t=!1;try{t=null==i.frameElement&&se.documentElement}catch(n){}t&&t.doScroll&&!function r(){if(!ge.isReady){try{t.doScroll("left")}catch(e){return i.setTimeout(r,50)}l(),ge.ready()}}()}return je.promise(e)},ge.ready.promise();var Me;for(Me in ge(me))break;me.ownFirst="0"===Me,me.inlineBlockNeedsLayout=!1,ge(function(){var e,t,n,r;n=se.getElementsByTagName("body")[0],n&&n.style&&(t=se.createElement("div"),r=se.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),"undefined"!=typeof t.style.zoom&&(t.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",me.inlineBlockNeedsLayout=e=3===t.offsetWidth,e&&(n.style.zoom=1)),n.removeChild(r))}),function(){var e=se.createElement("div");me.deleteExpando=!0;try{delete e.test}catch(t){me.deleteExpando=!1}e=null}();var De=function(e){var t=ge.noData[(e.nodeName+" ").toLowerCase()],n=+e.nodeType||1;return 1!==n&&9!==n?!1:!t||t!==!0&&e.getAttribute("classid")===t},Ie=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,Fe=/([A-Z])/g;ge.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?ge.cache[e[ge.expando]]:e[ge.expando],!!e&&!d(e)},data:function(e,t,n){return h(e,t,n)},removeData:function(e,t){return m(e,t)},_data:function(e,t,n){return h(e,t,n,!0)},_removeData:function(e,t){return m(e,t,!0)}}),ge.fn.extend({data:function(e,t){var n,r,i,o=this[0],a=o&&o.attributes;if(void 0===e){if(this.length&&(i=ge.data(o),1===o.nodeType&&!ge._data(o,"parsedAttrs"))){for(n=a.length;n--;)a[n]&&(r=a[n].name,0===r.indexOf("data-")&&(r=ge.camelCase(r.slice(5)),p(o,r,i[r])));ge._data(o,"parsedAttrs",!0)}return i}return"object"==typeof e?this.each(function(){ge.data(this,e)}):arguments.length>1?this.each(function(){ge.data(this,e,t)}):o?p(o,e,ge.data(o,e)):void 0},removeData:function(e){return this.each(function(){ge.removeData(this,e)})}}),ge.extend({queue:function(e,t,n){var r;return e?(t=(t||"fx")+"queue",r=ge._data(e,t),n&&(!r||ge.isArray(n)?r=ge._data(e,t,ge.makeArray(n)):r.push(n)),r||[]):void 0},dequeue:function(e,t){t=t||"fx";var n=ge.queue(e,t),r=n.length,i=n.shift(),o=ge._queueHooks(e,t),a=function(){ge.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return ge._data(e,n)||ge._data(e,n,{empty:ge.Callbacks("once memory").add(function(){ge._removeData(e,t+"queue"),ge._removeData(e,n)})})}}),ge.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length<n?ge.queue(this[0],e):void 0===t?this:this.each(function(){var n=ge.queue(this,e,t);ge._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&ge.dequeue(this,e)})},dequeue:function(e){return this.each(function(){ge.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=ge.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";a--;)n=ge._data(o[a],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}}),function(){var e;me.shrinkWrapBlocks=function(){if(null!=e)return e;e=!1;var t,n,r;return n=se.getElementsByTagName("body")[0],n&&n.style?(t=se.createElement("div"),r=se.createElement("div"),r.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",n.appendChild(r).appendChild(t),"undefined"!=typeof t.style.zoom&&(t.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1",t.appendChild(se.createElement("div")).style.width="5px",e=3!==t.offsetWidth),n.removeChild(r),e):void 0}}();var Le=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,Ue=new RegExp("^(?:([+-])=|)("+Le+")([a-z%]*)$","i"),He=["Top","Right","Bottom","Left"],Ve=function(e,t){return e=t||e,"none"===ge.css(e,"display")||!ge.contains(e.ownerDocument,e)},qe=function(e,t,n,r,i,o,a){var s=0,u=e.length,c=null==n;if("object"===ge.type(n)){i=!0;for(s in n)qe(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,ge.isFunction(r)||(a=!0),c&&(a?(t.call(e,r),t=null):(c=t,t=function(e,t,n){return c.call(ge(e),n)})),t))for(;u>s;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:c?t.call(e):u?t(e[0],n):o},Be=/^(?:checkbox|radio)$/i,We=/<([\w:-]+)/,ze=/^$|\/(?:java|ecma)script/i,Ke=/^\s+/,Qe="abbr|article|aside|audio|bdi|canvas|data|datalist|details|dialog|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|picture|progress|section|summary|template|time|video";!function(){var e=se.createElement("div"),t=se.createDocumentFragment(),n=se.createElement("input");e.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",me.leadingWhitespace=3===e.firstChild.nodeType,me.tbody=!e.getElementsByTagName("tbody").length,me.htmlSerialize=!!e.getElementsByTagName("link").length,me.html5Clone="<:nav></:nav>"!==se.createElement("nav").cloneNode(!0).outerHTML,n.type="checkbox",n.checked=!0,t.appendChild(n),me.appendChecked=n.checked,e.innerHTML="<textarea>x</textarea>",me.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue,t.appendChild(e),n=se.createElement("input"),n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),e.appendChild(n),me.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,me.noCloneEvent=!!e.addEventListener,e[ge.expando]=1,me.attributes=!e.getAttribute(ge.expando)}();var Ge={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:me.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]};Ge.optgroup=Ge.option,Ge.tbody=Ge.tfoot=Ge.colgroup=Ge.caption=Ge.thead,Ge.th=Ge.td;var Ye=/<|&#?\w+;/,Xe=/<tbody/i;!function(){var e,t,n=se.createElement("div");for(e in{submit:!0,change:!0,focusin:!0})t="on"+e,(me[e]=t in i)||(n.setAttribute(t,"t"),me[e]=n.attributes[t].expando===!1);n=null}();var Je=/^(?:input|select|textarea)$/i,Ze=/^key/,et=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,tt=/^(?:focusinfocus|focusoutblur)$/,nt=/^([^.]*)(?:\.(.+)|)/;ge.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,c,l,f,p,d,h,m,v=ge._data(e);if(v){for(n.handler&&(u=n,n=u.handler,i=u.selector),n.guid||(n.guid=ge.guid++),(a=v.events)||(a=v.events={}),(l=v.handle)||(l=v.handle=function(e){return"undefined"==typeof ge||e&&ge.event.triggered===e.type?void 0:ge.event.dispatch.apply(l.elem,arguments)},l.elem=e),t=(t||"").match(Ae)||[""],s=t.length;s--;)o=nt.exec(t[s])||[],d=m=o[1],h=(o[2]||"").split(".").sort(),d&&(c=ge.event.special[d]||{},d=(i?c.delegateType:c.bindType)||d,c=ge.event.special[d]||{},f=ge.extend({type:d,origType:m,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&ge.expr.match.needsContext.test(i),namespace:h.join(".")},u),(p=a[d])||(p=a[d]=[],p.delegateCount=0,c.setup&&c.setup.call(e,r,h,l)!==!1||(e.addEventListener?e.addEventListener(d,l,!1):e.attachEvent&&e.attachEvent("on"+d,l))),c.add&&(c.add.call(e,f),f.handler.guid||(f.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,f):p.push(f),ge.event.global[d]=!0);e=null}},remove:function(e,t,n,r,i){var o,a,s,u,c,l,f,p,d,h,m,v=ge.hasData(e)&&ge._data(e);if(v&&(l=v.events)){for(t=(t||"").match(Ae)||[""],c=t.length;c--;)if(s=nt.exec(t[c])||[],d=m=s[1],h=(s[2]||"").split(".").sort(),d){for(f=ge.event.special[d]||{},d=(r?f.delegateType:f.bindType)||d,p=l[d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),u=o=p.length;o--;)a=p[o],!i&&m!==a.origType||n&&n.guid!==a.guid||s&&!s.test(a.namespace)||r&&r!==a.selector&&("**"!==r||!a.selector)||(p.splice(o,1),a.selector&&p.delegateCount--,f.remove&&f.remove.call(e,a));u&&!p.length&&(f.teardown&&f.teardown.call(e,h,v.handle)!==!1||ge.removeEvent(e,d,v.handle),delete l[d])}else for(d in l)ge.event.remove(e,d+t[c],n,r,!0);ge.isEmptyObject(l)&&(delete v.handle,ge._removeData(e,"events"))}},trigger:function(e,t,n,r){var o,a,s,u,c,l,f,p=[n||se],d=he.call(e,"type")?e.type:e,h=he.call(e,"namespace")?e.namespace.split("."):[];if(s=l=n=n||se,3!==n.nodeType&&8!==n.nodeType&&!tt.test(d+ge.event.triggered)&&(d.indexOf(".")>-1&&(h=d.split("."),d=h.shift(),h.sort()),a=d.indexOf(":")<0&&"on"+d,e=e[ge.expando]?e:new ge.Event(d,"object"==typeof e&&e),e.isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:ge.makeArray(t,[e]),c=ge.event.special[d]||{},r||!c.trigger||c.trigger.apply(n,t)!==!1)){if(!r&&!c.noBubble&&!ge.isWindow(n)){for(u=c.delegateType||d,tt.test(u+d)||(s=s.parentNode);s;s=s.parentNode)p.push(s),l=s;l===(n.ownerDocument||se)&&p.push(l.defaultView||l.parentWindow||i)}for(f=0;(s=p[f++])&&!e.isPropagationStopped();)e.type=f>1?u:c.bindType||d,o=(ge._data(s,"events")||{})[e.type]&&ge._data(s,"handle"),o&&o.apply(s,t),o=a&&s[a],o&&o.apply&&De(s)&&(e.result=o.apply(s,t),e.result===!1&&e.preventDefault());if(e.type=d,!r&&!e.isDefaultPrevented()&&(!c._default||c._default.apply(p.pop(),t)===!1)&&De(n)&&a&&n[d]&&!ge.isWindow(n)){l=n[a],l&&(n[a]=null),ge.event.triggered=d;try{n[d]()}catch(m){}ge.event.triggered=void 0,l&&(n[a]=l)}return e.result}},dispatch:function(e){e=ge.event.fix(e);var t,n,r,i,o,a=[],s=ue.call(arguments),u=(ge._data(this,"events")||{})[e.type]||[],c=ge.event.special[e.type]||{};if(s[0]=e,e.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,e)!==!1){for(a=ge.event.handlers.call(this,e,u),t=0;(i=a[t++])&&!e.isPropagationStopped();)for(e.currentTarget=i.elem,n=0;(o=i.handlers[n++])&&!e.isImmediatePropagationStopped();)(!e.rnamespace||e.rnamespace.test(o.namespace))&&(e.handleObj=o,e.data=o.data,r=((ge.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s),void 0!==r&&(e.result=r)===!1&&(e.preventDefault(),e.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,e),e.result}},handlers:function(e,t){var n,r,i,o,a=[],s=t.delegateCount,u=e.target;if(s&&u.nodeType&&("click"!==e.type||isNaN(e.button)||e.button<1))for(;u!=this;u=u.parentNode||this)if(1===u.nodeType&&(u.disabled!==!0||"click"!==e.type)){for(r=[],n=0;s>n;n++)o=t[n],i=o.selector+" ",void 0===r[i]&&(r[i]=o.needsContext?ge(i,this).index(u)>-1:ge.find(i,this,null,[u]).length),r[i]&&r.push(o);r.length&&a.push({elem:u,handlers:r})}return s<t.length&&a.push({elem:this,handlers:t.slice(s)}),a},fix:function(e){if(e[ge.expando])return e;var t,n,r,i=e.type,o=e,a=this.fixHooks[i];for(a||(this.fixHooks[i]=a=et.test(i)?this.mouseHooks:Ze.test(i)?this.keyHooks:{}),r=a.props?this.props.concat(a.props):this.props,e=new ge.Event(o),t=r.length;t--;)n=r[t],e[n]=o[n];return e.target||(e.target=o.srcElement||se),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,a.filter?a.filter(e,o):e},props:"altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,t){var n,r,i,o=t.button,a=t.fromElement;return null==e.pageX&&null!=t.clientX&&(r=e.target.ownerDocument||se,i=r.documentElement,n=r.body,e.pageX=t.clientX+(i&&i.scrollLeft||n&&n.scrollLeft||0)-(i&&i.clientLeft||n&&n.clientLeft||0),e.pageY=t.clientY+(i&&i.scrollTop||n&&n.scrollTop||0)-(i&&i.clientTop||n&&n.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?t.toElement:a),e.which||void 0===o||(e.which=1&o?1:2&o?3:4&o?2:0),e}},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==$()&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===$()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return ge.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):void 0},_default:function(e){return ge.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n){var r=ge.extend(new ge.Event,n,{type:e,isSimulated:!0});ge.event.trigger(r,null,t),r.isDefaultPrevented()&&n.preventDefault()}},ge.removeEvent=se.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)}:function(e,t,n){var r="on"+t;e.detachEvent&&("undefined"==typeof e[r]&&(e[r]=null),e.detachEvent(r,n))},ge.Event=function(e,t){return this instanceof ge.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&e.returnValue===!1?_:C):this.type=e,t&&ge.extend(this,t),this.timeStamp=e&&e.timeStamp||ge.now(),void(this[ge.expando]=!0)):new ge.Event(e,t)},ge.Event.prototype={constructor:ge.Event,isDefaultPrevented:C,isPropagationStopped:C,isImmediatePropagationStopped:C,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=_,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=_,e&&!this.isSimulated&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=_,e&&e.stopImmediatePropagation&&e.stopImmediatePropagation(),this.stopPropagation()}},ge.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){ge.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,o=e.handleObj;return(!i||i!==r&&!ge.contains(r,i))&&(e.type=o.origType,n=o.handler.apply(this,arguments),e.type=t),n}}}),me.submit||(ge.event.special.submit={setup:function(){return ge.nodeName(this,"form")?!1:void ge.event.add(this,"click._submit keypress._submit",function(e){var t=e.target,n=ge.nodeName(t,"input")||ge.nodeName(t,"button")?ge.prop(t,"form"):void 0;n&&!ge._data(n,"submit")&&(ge.event.add(n,"submit._submit",function(e){e._submitBubble=!0}),ge._data(n,"submit",!0))})},postDispatch:function(e){e._submitBubble&&(delete e._submitBubble,this.parentNode&&!e.isTrigger&&ge.event.simulate("submit",this.parentNode,e))},teardown:function(){return ge.nodeName(this,"form")?!1:void ge.event.remove(this,"._submit")}}),me.change||(ge.event.special.change={setup:function(){return Je.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(ge.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._justChanged=!0)}),ge.event.add(this,"click._change",function(e){this._justChanged&&!e.isTrigger&&(this._justChanged=!1),ge.event.simulate("change",this,e)})),!1):void ge.event.add(this,"beforeactivate._change",function(e){var t=e.target;Je.test(t.nodeName)&&!ge._data(t,"change")&&(ge.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||ge.event.simulate("change",this.parentNode,e)}),ge._data(t,"change",!0))})},handle:function(e){var t=e.target;return this!==t||e.isSimulated||e.isTrigger||"radio"!==t.type&&"checkbox"!==t.type?e.handleObj.handler.apply(this,arguments):void 0},teardown:function(){return ge.event.remove(this,"._change"),!Je.test(this.nodeName)}}),me.focusin||ge.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){ge.event.simulate(t,e.target,ge.event.fix(e))};ge.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=ge._data(r,t);i||r.addEventListener(e,n,!0),ge._data(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=ge._data(r,t)-1;i?ge._data(r,t,i):(r.removeEventListener(e,n,!0),ge._removeData(r,t))}}}),ge.fn.extend({on:function(e,t,n,r){return S(this,e,t,n,r)},one:function(e,t,n,r){return S(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,ge(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return(t===!1||"function"==typeof t)&&(n=t,t=void 0),n===!1&&(n=C),this.each(function(){ge.event.remove(this,e,n,t)})},trigger:function(e,t){return this.each(function(){ge.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];return n?ge.event.trigger(e,t,n,!0):void 0}});var rt=/ jQuery\d+="(?:null|\d+)"/g,it=new RegExp("<(?:"+Qe+")[\\s/>]","i"),ot=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,at=/<script|<style|<link/i,st=/checked\s*(?:[^=]|=\s*.checked.)/i,ut=/^true\/(.*)/,ct=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,lt=g(se),ft=lt.appendChild(se.createElement("div"));ge.extend({htmlPrefilter:function(e){return e.replace(ot,"<$1></$2>")},clone:function(e,t,n){var r,i,o,a,s,u=ge.contains(e.ownerDocument,e);if(me.html5Clone||ge.isXMLDoc(e)||!it.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(ft.innerHTML=e.outerHTML,ft.removeChild(o=ft.firstChild)),!(me.noCloneEvent&&me.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ge.isXMLDoc(e)))for(r=y(o),s=y(e),a=0;null!=(i=s[a]);++a)r[a]&&O(i,r[a]);if(t)if(n)for(s=s||y(e),r=r||y(o),a=0;null!=(i=s[a]);a++)T(i,r[a]);else T(e,o);return r=y(o,"script"),r.length>0&&b(r,!u&&y(e,"script")),r=s=i=null,o},cleanData:function(e,t){for(var n,r,i,o,a=0,s=ge.expando,u=ge.cache,c=me.attributes,l=ge.event.special;null!=(n=e[a]);a++)if((t||De(n))&&(i=n[s],o=i&&u[i])){if(o.events)for(r in o.events)l[r]?ge.event.remove(n,r):ge.removeEvent(n,r,o.handle);u[i]&&(delete u[i],c||"undefined"==typeof n.removeAttribute?n[s]=void 0:n.removeAttribute(s),ae.push(i))}}}),ge.fn.extend({domManip:R,detach:function(e){return N(this,e,!0)},remove:function(e){return N(this,e)},text:function(e){return qe(this,function(e){return void 0===e?ge.text(this):this.empty().append((this[0]&&this[0].ownerDocument||se).createTextNode(e))},null,e,arguments.length)},append:function(){return R(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=E(this,e);t.appendChild(e)}})},prepend:function(){return R(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=E(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return R(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return R(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&ge.cleanData(y(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&ge.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return ge.clone(this,e,t)})},html:function(e){
5
- return qe(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e)return 1===t.nodeType?t.innerHTML.replace(rt,""):void 0;if(!("string"!=typeof e||at.test(e)||!me.htmlSerialize&&it.test(e)||!me.leadingWhitespace&&Ke.test(e)||Ge[(We.exec(e)||["",""])[1].toLowerCase()])){e=ge.htmlPrefilter(e);try{for(;r>n;n++)t=this[n]||{},1===t.nodeType&&(ge.cleanData(y(t,!1)),t.innerHTML=e);t=0}catch(i){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return R(this,arguments,function(t){var n=this.parentNode;ge.inArray(this,e)<0&&(ge.cleanData(y(this)),n&&n.replaceChild(t,this))},e)}}),ge.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){ge.fn[e]=function(e){for(var n,r=0,i=[],o=ge(e),a=o.length-1;a>=r;r++)n=r===a?this:this.clone(!0),ge(o[r])[t](n),le.apply(i,n.get());return this.pushStack(i)}});var pt,dt={HTML:"block",BODY:"block"},ht=/^margin/,mt=new RegExp("^("+Le+")(?!px)[a-z%]+$","i"),vt=function(e,t,n,r){var i,o,a={};for(o in t)a[o]=e.style[o],e.style[o]=t[o];i=n.apply(e,r||[]);for(o in t)e.style[o]=a[o];return i},gt=se.documentElement;!function(){function e(){var e,l,f=se.documentElement;f.appendChild(u),c.style.cssText="-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",t=r=s=!1,n=a=!0,i.getComputedStyle&&(l=i.getComputedStyle(c),t="1%"!==(l||{}).top,s="2px"===(l||{}).marginLeft,r="4px"===(l||{width:"4px"}).width,c.style.marginRight="50%",n="4px"===(l||{marginRight:"4px"}).marginRight,e=c.appendChild(se.createElement("div")),e.style.cssText=c.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",e.style.marginRight=e.style.width="0",c.style.width="1px",a=!parseFloat((i.getComputedStyle(e)||{}).marginRight),c.removeChild(e)),c.style.display="none",o=0===c.getClientRects().length,o&&(c.style.display="",c.innerHTML="<table><tr><td></td><td>t</td></tr></table>",e=c.getElementsByTagName("td"),e[0].style.cssText="margin:0;border:0;padding:0;display:none",o=0===e[0].offsetHeight,o&&(e[0].style.display="",e[1].style.display="none",o=0===e[0].offsetHeight)),f.removeChild(u)}var t,n,r,o,a,s,u=se.createElement("div"),c=se.createElement("div");c.style&&(c.style.cssText="float:left;opacity:.5",me.opacity="0.5"===c.style.opacity,me.cssFloat=!!c.style.cssFloat,c.style.backgroundClip="content-box",c.cloneNode(!0).style.backgroundClip="",me.clearCloneStyle="content-box"===c.style.backgroundClip,u=se.createElement("div"),u.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",c.innerHTML="",u.appendChild(c),me.boxSizing=""===c.style.boxSizing||""===c.style.MozBoxSizing||""===c.style.WebkitBoxSizing,ge.extend(me,{reliableHiddenOffsets:function(){return null==t&&e(),o},boxSizingReliable:function(){return null==t&&e(),r},pixelMarginRight:function(){return null==t&&e(),n},pixelPosition:function(){return null==t&&e(),t},reliableMarginRight:function(){return null==t&&e(),a},reliableMarginLeft:function(){return null==t&&e(),s}}))}();var yt,bt,xt=/^(top|right|bottom|left)$/;i.getComputedStyle?(yt=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=i),t.getComputedStyle(e)},bt=function(e,t,n){var r,i,o,a,s=e.style;return n=n||yt(e),a=n?n.getPropertyValue(t)||n[t]:void 0,""!==a&&void 0!==a||ge.contains(e.ownerDocument,e)||(a=ge.style(e,t)),n&&!me.pixelMarginRight()&&mt.test(a)&&ht.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o),void 0===a?a:a+""}):gt.currentStyle&&(yt=function(e){return e.currentStyle},bt=function(e,t,n){var r,i,o,a,s=e.style;return n=n||yt(e),a=n?n[t]:void 0,null==a&&s&&s[t]&&(a=s[t]),mt.test(a)&&!xt.test(t)&&(r=s.left,i=e.runtimeStyle,o=i&&i.left,o&&(i.left=e.currentStyle.left),s.left="fontSize"===t?"1em":a,a=s.pixelLeft+"px",s.left=r,o&&(i.left=o)),void 0===a?a:a+""||"auto"});var wt=/alpha\([^)]*\)/i,_t=/opacity\s*=\s*([^)]*)/i,Ct=/^(none|table(?!-c[ea]).+)/,$t=new RegExp("^("+Le+")(.*)$","i"),St={position:"absolute",visibility:"hidden",display:"block"},Et={letterSpacing:"0",fontWeight:"400"},Pt=["Webkit","O","Moz","ms"],kt=se.createElement("div").style;ge.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=bt(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":me.cssFloat?"cssFloat":"styleFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=ge.camelCase(t),u=e.style;if(t=ge.cssProps[s]||(ge.cssProps[s]=D(s)||s),a=ge.cssHooks[t]||ge.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:u[t];if(o=typeof n,"string"===o&&(i=Ue.exec(n))&&i[1]&&(n=v(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(ge.cssNumber[s]?"":"px")),me.clearCloneStyle||""!==n||0!==t.indexOf("background")||(u[t]="inherit"),!(a&&"set"in a&&void 0===(n=a.set(e,n,r)))))try{u[t]=n}catch(c){}}},css:function(e,t,n,r){var i,o,a,s=ge.camelCase(t);return t=ge.cssProps[s]||(ge.cssProps[s]=D(s)||s),a=ge.cssHooks[t]||ge.cssHooks[s],a&&"get"in a&&(o=a.get(e,!0,n)),void 0===o&&(o=bt(e,t,r)),"normal"===o&&t in Et&&(o=Et[t]),""===n||n?(i=parseFloat(o),n===!0||isFinite(i)?i||0:o):o}}),ge.each(["height","width"],function(e,t){ge.cssHooks[t]={get:function(e,n,r){return n?Ct.test(ge.css(e,"display"))&&0===e.offsetWidth?vt(e,St,function(){return U(e,t,r)}):U(e,t,r):void 0},set:function(e,n,r){var i=r&&yt(e);return F(e,n,r?L(e,t,r,me.boxSizing&&"border-box"===ge.css(e,"boxSizing",!1,i),i):0)}}}),me.opacity||(ge.cssHooks.opacity={get:function(e,t){return _t.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=ge.isNumeric(t)?"alpha(opacity="+100*t+")":"",o=r&&r.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===ge.trim(o.replace(wt,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||r&&!r.filter)||(n.filter=wt.test(o)?o.replace(wt,i):o+" "+i)}}),ge.cssHooks.marginRight=M(me.reliableMarginRight,function(e,t){return t?vt(e,{display:"inline-block"},bt,[e,"marginRight"]):void 0}),ge.cssHooks.marginLeft=M(me.reliableMarginLeft,function(e,t){return t?(parseFloat(bt(e,"marginLeft"))||(ge.contains(e.ownerDocument,e)?e.getBoundingClientRect().left-vt(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}):0))+"px":void 0}),ge.each({margin:"",padding:"",border:"Width"},function(e,t){ge.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];4>r;r++)i[e+He[r]+t]=o[r]||o[r-2]||o[0];return i}},ht.test(e)||(ge.cssHooks[e+t].set=F)}),ge.fn.extend({css:function(e,t){return qe(this,function(e,t,n){var r,i,o={},a=0;if(ge.isArray(t)){for(r=yt(e),i=t.length;i>a;a++)o[t[a]]=ge.css(e,t[a],!1,r);return o}return void 0!==n?ge.style(e,t,n):ge.css(e,t)},e,t,arguments.length>1)},show:function(){return I(this,!0)},hide:function(){return I(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Ve(this)?ge(this).show():ge(this).hide()})}}),ge.Tween=H,H.prototype={constructor:H,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||ge.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(ge.cssNumber[n]?"":"px")},cur:function(){var e=H.propHooks[this.prop];return e&&e.get?e.get(this):H.propHooks._default.get(this)},run:function(e){var t,n=H.propHooks[this.prop];return this.pos=t=this.options.duration?ge.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):H.propHooks._default.set(this),this}},H.prototype.init.prototype=H.prototype,H.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=ge.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){ge.fx.step[e.prop]?ge.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[ge.cssProps[e.prop]]&&!ge.cssHooks[e.prop]?e.elem[e.prop]=e.now:ge.style(e.elem,e.prop,e.now+e.unit)}}},H.propHooks.scrollTop=H.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ge.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},ge.fx=H.prototype.init,ge.fx.step={};var Tt,Ot,Rt=/^(?:toggle|show|hide)$/,Nt=/queueHooks$/;ge.Animation=ge.extend(K,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return v(n.elem,e,Ue.exec(t),n),n}]},tweener:function(e,t){ge.isFunction(e)?(t=e,e=["*"]):e=e.match(Ae);for(var n,r=0,i=e.length;i>r;r++)n=e[r],K.tweeners[n]=K.tweeners[n]||[],K.tweeners[n].unshift(t)},prefilters:[W],prefilter:function(e,t){t?K.prefilters.unshift(e):K.prefilters.push(e)}}),ge.speed=function(e,t,n){var r=e&&"object"==typeof e?ge.extend({},e):{complete:n||!n&&t||ge.isFunction(e)&&e,duration:e,easing:n&&t||t&&!ge.isFunction(t)&&t};return r.duration=ge.fx.off?0:"number"==typeof r.duration?r.duration:r.duration in ge.fx.speeds?ge.fx.speeds[r.duration]:ge.fx.speeds._default,(null==r.queue||r.queue===!0)&&(r.queue="fx"),r.old=r.complete,r.complete=function(){ge.isFunction(r.old)&&r.old.call(this),r.queue&&ge.dequeue(this,r.queue)},r},ge.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Ve).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=ge.isEmptyObject(e),o=ge.speed(t,n,r),a=function(){var t=K(this,ge.extend({},e),o);(i||ge._data(this,"finish"))&&t.stop(!0)};return a.finish=a,i||o.queue===!1?this.each(a):this.queue(o.queue,a)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,i=null!=e&&e+"queueHooks",o=ge.timers,a=ge._data(this);if(i)a[i]&&a[i].stop&&r(a[i]);else for(i in a)a[i]&&a[i].stop&&Nt.test(i)&&r(a[i]);for(i=o.length;i--;)o[i].elem!==this||null!=e&&o[i].queue!==e||(o[i].anim.stop(n),t=!1,o.splice(i,1));(t||!n)&&ge.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=ge._data(this),r=n[e+"queue"],i=n[e+"queueHooks"],o=ge.timers,a=r?r.length:0;for(n.finish=!0,ge.queue(this,e,[]),i&&i.stop&&i.stop.call(this,!0),t=o.length;t--;)o[t].elem===this&&o[t].queue===e&&(o[t].anim.stop(!0),o.splice(t,1));for(t=0;a>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),ge.each(["toggle","show","hide"],function(e,t){var n=ge.fn[t];ge.fn[t]=function(e,r,i){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(q(t,!0),e,r,i)}}),ge.each({slideDown:q("show"),slideUp:q("hide"),slideToggle:q("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){ge.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),ge.timers=[],ge.fx.tick=function(){var e,t=ge.timers,n=0;for(Tt=ge.now();n<t.length;n++)e=t[n],e()||t[n]!==e||t.splice(n--,1);t.length||ge.fx.stop(),Tt=void 0},ge.fx.timer=function(e){ge.timers.push(e),e()?ge.fx.start():ge.timers.pop()},ge.fx.interval=13,ge.fx.start=function(){Ot||(Ot=i.setInterval(ge.fx.tick,ge.fx.interval))},ge.fx.stop=function(){i.clearInterval(Ot),Ot=null},ge.fx.speeds={slow:600,fast:200,_default:400},ge.fn.delay=function(e,t){return e=ge.fx?ge.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=i.setTimeout(t,e);n.stop=function(){i.clearTimeout(r)}})},function(){var e,t=se.createElement("input"),n=se.createElement("div"),r=se.createElement("select"),i=r.appendChild(se.createElement("option"));n=se.createElement("div"),n.setAttribute("className","t"),n.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",e=n.getElementsByTagName("a")[0],t.setAttribute("type","checkbox"),n.appendChild(t),e=n.getElementsByTagName("a")[0],e.style.cssText="top:1px",me.getSetAttribute="t"!==n.className,me.style=/top/.test(e.getAttribute("style")),me.hrefNormalized="/a"===e.getAttribute("href"),me.checkOn=!!t.value,me.optSelected=i.selected,me.enctype=!!se.createElement("form").enctype,r.disabled=!0,me.optDisabled=!i.disabled,t=se.createElement("input"),t.setAttribute("value",""),me.input=""===t.getAttribute("value"),t.value="t",t.setAttribute("type","radio"),me.radioValue="t"===t.value}();var At=/\r/g;ge.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=ge.isFunction(e),this.each(function(n){var i;1===this.nodeType&&(i=r?e.call(this,n,ge(this).val()):e,null==i?i="":"number"==typeof i?i+="":ge.isArray(i)&&(i=ge.map(i,function(e){return null==e?"":e+""})),t=ge.valHooks[this.type]||ge.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return t=ge.valHooks[i.type]||ge.valHooks[i.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:(n=i.value,"string"==typeof n?n.replace(At,""):null==n?"":n)}}}),ge.extend({valHooks:{option:{get:function(e){var t=ge.find.attr(e,"value");return null!=t?t:ge.trim(ge.text(e))}},select:{get:function(e){for(var t,n,r=e.options,i=e.selectedIndex,o="select-one"===e.type||0>i,a=o?null:[],s=o?i+1:r.length,u=0>i?s:o?i:0;s>u;u++)if(n=r[u],!(!n.selected&&u!==i||(me.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&ge.nodeName(n.parentNode,"optgroup"))){if(t=ge(n).val(),o)return t;a.push(t)}return a},set:function(e,t){for(var n,r,i=e.options,o=ge.makeArray(t),a=i.length;a--;)if(r=i[a],ge.inArray(ge.valHooks.option.get(r),o)>=0)try{r.selected=n=!0}catch(s){r.scrollHeight}else r.selected=!1;return n||(e.selectedIndex=-1),i}}}}),ge.each(["radio","checkbox"],function(){ge.valHooks[this]={set:function(e,t){return ge.isArray(t)?e.checked=ge.inArray(ge(e).val(),t)>-1:void 0}},me.checkOn||(ge.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var jt,Mt,Dt=ge.expr.attrHandle,It=/^(?:checked|selected)$/i,Ft=me.getSetAttribute,Lt=me.input;ge.fn.extend({attr:function(e,t){return qe(this,ge.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){ge.removeAttr(this,e)})}}),ge.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?ge.prop(e,t,n):(1===o&&ge.isXMLDoc(e)||(t=t.toLowerCase(),i=ge.attrHooks[t]||(ge.expr.match.bool.test(t)?Mt:jt)),void 0!==n?null===n?void ge.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:(r=ge.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!me.radioValue&&"radio"===t&&ge.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r,i=0,o=t&&t.match(Ae);if(o&&1===e.nodeType)for(;n=o[i++];)r=ge.propFix[n]||n,ge.expr.match.bool.test(n)?Lt&&Ft||!It.test(n)?e[r]=!1:e[ge.camelCase("default-"+n)]=e[r]=!1:ge.attr(e,n,""),e.removeAttribute(Ft?n:r)}}),Mt={set:function(e,t,n){return t===!1?ge.removeAttr(e,n):Lt&&Ft||!It.test(n)?e.setAttribute(!Ft&&ge.propFix[n]||n,n):e[ge.camelCase("default-"+n)]=e[n]=!0,n}},ge.each(ge.expr.match.bool.source.match(/\w+/g),function(e,t){var n=Dt[t]||ge.find.attr;Dt[t]=Lt&&Ft||!It.test(t)?function(e,t,r){var i,o;return r||(o=Dt[t],Dt[t]=i,i=null!=n(e,t,r)?t.toLowerCase():null,Dt[t]=o),i}:function(e,t,n){return n?void 0:e[ge.camelCase("default-"+t)]?t.toLowerCase():null}}),Lt&&Ft||(ge.attrHooks.value={set:function(e,t,n){return ge.nodeName(e,"input")?void(e.defaultValue=t):jt&&jt.set(e,t,n)}}),Ft||(jt={set:function(e,t,n){var r=e.getAttributeNode(n);return r||e.setAttributeNode(r=e.ownerDocument.createAttribute(n)),r.value=t+="","value"===n||t===e.getAttribute(n)?t:void 0}},Dt.id=Dt.name=Dt.coords=function(e,t,n){var r;return n?void 0:(r=e.getAttributeNode(t))&&""!==r.value?r.value:null},ge.valHooks.button={get:function(e,t){var n=e.getAttributeNode(t);return n&&n.specified?n.value:void 0},set:jt.set},ge.attrHooks.contenteditable={set:function(e,t,n){jt.set(e,""===t?!1:t,n)}},ge.each(["width","height"],function(e,t){ge.attrHooks[t]={set:function(e,n){return""===n?(e.setAttribute(t,"auto"),n):void 0}}})),me.style||(ge.attrHooks.style={get:function(e){return e.style.cssText||void 0},set:function(e,t){return e.style.cssText=t+""}});var Ut=/^(?:input|select|textarea|button|object)$/i,Ht=/^(?:a|area)$/i;ge.fn.extend({prop:function(e,t){return qe(this,ge.prop,e,t,arguments.length>1)},removeProp:function(e){return e=ge.propFix[e]||e,this.each(function(){try{this[e]=void 0,delete this[e]}catch(t){}})}}),ge.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&ge.isXMLDoc(e)||(t=ge.propFix[t]||t,i=ge.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=ge.find.attr(e,"tabindex");return t?parseInt(t,10):Ut.test(e.nodeName)||Ht.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),me.hrefNormalized||ge.each(["href","src"],function(e,t){ge.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}}),me.optSelected||(ge.propHooks.selected={get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}}),ge.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ge.propFix[this.toLowerCase()]=this}),me.enctype||(ge.propFix.enctype="encoding");var Vt=/[\t\r\n\f]/g;ge.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(ge.isFunction(e))return this.each(function(t){ge(this).addClass(e.call(this,t,Q(this)))});if("string"==typeof e&&e)for(t=e.match(Ae)||[];n=this[u++];)if(i=Q(n),r=1===n.nodeType&&(" "+i+" ").replace(Vt," ")){for(a=0;o=t[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");s=ge.trim(r),i!==s&&ge.attr(n,"class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(ge.isFunction(e))return this.each(function(t){ge(this).removeClass(e.call(this,t,Q(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(Ae)||[];n=this[u++];)if(i=Q(n),r=1===n.nodeType&&(" "+i+" ").replace(Vt," ")){for(a=0;o=t[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");s=ge.trim(r),i!==s&&ge.attr(n,"class",s)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):this.each(ge.isFunction(e)?function(n){ge(this).toggleClass(e.call(this,n,Q(this),t),t)}:function(){var t,r,i,o;if("string"===n)for(r=0,i=ge(this),o=e.match(Ae)||[];t=o[r++];)i.hasClass(t)?i.removeClass(t):i.addClass(t);else(void 0===e||"boolean"===n)&&(t=Q(this),t&&ge._data(this,"__className__",t),ge.attr(this,"class",t||e===!1?"":ge._data(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+Q(n)+" ").replace(Vt," ").indexOf(t)>-1)return!0;return!1}}),ge.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){ge.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),ge.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}});var qt=i.location,Bt=ge.now(),Wt=/\?/,zt=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;ge.parseJSON=function(e){if(i.JSON&&i.JSON.parse)return i.JSON.parse(e+"");var t,n=null,r=ge.trim(e+"");return r&&!ge.trim(r.replace(zt,function(e,r,i,o){return t&&r&&(n=0),0===n?e:(t=i||r,n+=!o-!i,"")}))?Function("return "+r)():ge.error("Invalid JSON: "+e)},ge.parseXML=function(e){var t,n;if(!e||"string"!=typeof e)return null;try{i.DOMParser?(n=new i.DOMParser,t=n.parseFromString(e,"text/xml")):(t=new i.ActiveXObject("Microsoft.XMLDOM"),t.async="false",t.loadXML(e))}catch(r){t=void 0}return t&&t.documentElement&&!t.getElementsByTagName("parsererror").length||ge.error("Invalid XML: "+e),t};var Kt=/#.*$/,Qt=/([?&])_=[^&]*/,Gt=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Yt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Xt=/^(?:GET|HEAD)$/,Jt=/^\/\//,Zt=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,en={},tn={},nn="*/".concat("*"),rn=qt.href,on=Zt.exec(rn.toLowerCase())||[];ge.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:rn,type:"GET",isLocal:Yt.test(on[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":nn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":ge.parseJSON,"text xml":ge.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?X(X(e,ge.ajaxSettings),t):X(ge.ajaxSettings,e)},ajaxPrefilter:G(en),ajaxTransport:G(tn),ajax:function(e,t){function n(e,t,n,r){var o,f,y,b,w,C=t;2!==x&&(x=2,u&&i.clearTimeout(u),l=void 0,s=r||"",_.readyState=e>0?4:0,o=e>=200&&300>e||304===e,n&&(b=J(p,_,n)),b=Z(p,b,_,o),o?(p.ifModified&&(w=_.getResponseHeader("Last-Modified"),w&&(ge.lastModified[a]=w),w=_.getResponseHeader("etag"),w&&(ge.etag[a]=w)),204===e||"HEAD"===p.type?C="nocontent":304===e?C="notmodified":(C=b.state,f=b.data,y=b.error,o=!y)):(y=C,(e||!C)&&(C="error",0>e&&(e=0))),_.status=e,_.statusText=(t||C)+"",o?m.resolveWith(d,[f,C,_]):m.rejectWith(d,[_,C,y]),_.statusCode(g),g=void 0,c&&h.trigger(o?"ajaxSuccess":"ajaxError",[_,p,o?f:y]),v.fireWith(d,[_,C]),c&&(h.trigger("ajaxComplete",[_,p]),--ge.active||ge.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var r,o,a,s,u,c,l,f,p=ge.ajaxSetup({},t),d=p.context||p,h=p.context&&(d.nodeType||d.jquery)?ge(d):ge.event,m=ge.Deferred(),v=ge.Callbacks("once memory"),g=p.statusCode||{},y={},b={},x=0,w="canceled",_={readyState:0,getResponseHeader:function(e){var t;if(2===x){if(!f)for(f={};t=Gt.exec(s);)f[t[1].toLowerCase()]=t[2];t=f[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===x?s:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return x||(e=b[n]=b[n]||e,y[e]=t),this},overrideMimeType:function(e){return x||(p.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>x)for(t in e)g[t]=[g[t],e[t]];else _.always(e[_.status]);return this},abort:function(e){var t=e||w;return l&&l.abort(t),n(0,t),this}};if(m.promise(_).complete=v.add,_.success=_.done,_.error=_.fail,p.url=((e||p.url||rn)+"").replace(Kt,"").replace(Jt,on[1]+"//"),p.type=t.method||t.type||p.method||p.type,p.dataTypes=ge.trim(p.dataType||"*").toLowerCase().match(Ae)||[""],null==p.crossDomain&&(r=Zt.exec(p.url.toLowerCase()),p.crossDomain=!(!r||r[1]===on[1]&&r[2]===on[2]&&(r[3]||("http:"===r[1]?"80":"443"))===(on[3]||("http:"===on[1]?"80":"443")))),p.data&&p.processData&&"string"!=typeof p.data&&(p.data=ge.param(p.data,p.traditional)),Y(en,p,t,_),2===x)return _;c=ge.event&&p.global,c&&0===ge.active++&&ge.event.trigger("ajaxStart"),p.type=p.type.toUpperCase(),p.hasContent=!Xt.test(p.type),a=p.url,p.hasContent||(p.data&&(a=p.url+=(Wt.test(a)?"&":"?")+p.data,delete p.data),p.cache===!1&&(p.url=Qt.test(a)?a.replace(Qt,"$1_="+Bt++):a+(Wt.test(a)?"&":"?")+"_="+Bt++)),p.ifModified&&(ge.lastModified[a]&&_.setRequestHeader("If-Modified-Since",ge.lastModified[a]),ge.etag[a]&&_.setRequestHeader("If-None-Match",ge.etag[a])),(p.data&&p.hasContent&&p.contentType!==!1||t.contentType)&&_.setRequestHeader("Content-Type",p.contentType),_.setRequestHeader("Accept",p.dataTypes[0]&&p.accepts[p.dataTypes[0]]?p.accepts[p.dataTypes[0]]+("*"!==p.dataTypes[0]?", "+nn+"; q=0.01":""):p.accepts["*"]);for(o in p.headers)_.setRequestHeader(o,p.headers[o]);if(p.beforeSend&&(p.beforeSend.call(d,_,p)===!1||2===x))return _.abort();w="abort";for(o in{success:1,error:1,complete:1})_[o](p[o]);if(l=Y(tn,p,t,_)){if(_.readyState=1,c&&h.trigger("ajaxSend",[_,p]),2===x)return _;p.async&&p.timeout>0&&(u=i.setTimeout(function(){_.abort("timeout")},p.timeout));try{x=1,l.send(y,n)}catch(C){if(!(2>x))throw C;n(-1,C)}}else n(-1,"No Transport");return _},getJSON:function(e,t,n){return ge.get(e,t,n,"json")},getScript:function(e,t){return ge.get(e,void 0,t,"script")}}),ge.each(["get","post"],function(e,t){ge[t]=function(e,n,r,i){return ge.isFunction(n)&&(i=i||r,r=n,n=void 0),ge.ajax(ge.extend({url:e,type:t,dataType:i,data:n,success:r},ge.isPlainObject(e)&&e))}}),ge._evalUrl=function(e){return ge.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},ge.fn.extend({wrapAll:function(e){if(ge.isFunction(e))return this.each(function(t){ge(this).wrapAll(e.call(this,t))});if(this[0]){var t=ge(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return this.each(ge.isFunction(e)?function(t){ge(this).wrapInner(e.call(this,t))}:function(){var t=ge(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=ge.isFunction(e);return this.each(function(n){ge(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){ge.nodeName(this,"body")||ge(this).replaceWith(this.childNodes)}).end()}}),ge.expr.filters.hidden=function(e){return me.reliableHiddenOffsets()?e.offsetWidth<=0&&e.offsetHeight<=0&&!e.getClientRects().length:te(e)},ge.expr.filters.visible=function(e){return!ge.expr.filters.hidden(e)};var an=/%20/g,sn=/\[\]$/,un=/\r?\n/g,cn=/^(?:submit|button|image|reset|file)$/i,ln=/^(?:input|select|textarea|keygen)/i;ge.param=function(e,t){var n,r=[],i=function(e,t){t=ge.isFunction(t)?t():null==t?"":t,r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(void 0===t&&(t=ge.ajaxSettings&&ge.ajaxSettings.traditional),ge.isArray(e)||e.jquery&&!ge.isPlainObject(e))ge.each(e,function(){i(this.name,this.value)});else for(n in e)ne(n,e[n],t,i);return r.join("&").replace(an,"+")},ge.fn.extend({serialize:function(){return ge.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ge.prop(this,"elements");return e?ge.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ge(this).is(":disabled")&&ln.test(this.nodeName)&&!cn.test(e)&&(this.checked||!Be.test(e))}).map(function(e,t){var n=ge(this).val();return null==n?null:ge.isArray(n)?ge.map(n,function(e){return{name:t.name,value:e.replace(un,"\r\n")}}):{name:t.name,value:n.replace(un,"\r\n")}}).get()}}),ge.ajaxSettings.xhr=void 0!==i.ActiveXObject?function(){return this.isLocal?ie():se.documentMode>8?re():/^(get|post|head|put|delete|options)$/i.test(this.type)&&re()||ie()}:re;var fn=0,pn={},dn=ge.ajaxSettings.xhr();i.attachEvent&&i.attachEvent("onunload",function(){for(var e in pn)pn[e](void 0,!0)}),me.cors=!!dn&&"withCredentials"in dn,dn=me.ajax=!!dn,dn&&ge.ajaxTransport(function(e){if(!e.crossDomain||me.cors){var t;return{send:function(n,r){var o,a=e.xhr(),s=++fn;if(a.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(o in e.xhrFields)a[o]=e.xhrFields[o];e.mimeType&&a.overrideMimeType&&a.overrideMimeType(e.mimeType),e.crossDomain||n["X-Requested-With"]||(n["X-Requested-With"]="XMLHttpRequest");for(o in n)void 0!==n[o]&&a.setRequestHeader(o,n[o]+"");a.send(e.hasContent&&e.data||null),t=function(n,i){var o,u,c;if(t&&(i||4===a.readyState))if(delete pn[s],t=void 0,a.onreadystatechange=ge.noop,i)4!==a.readyState&&a.abort();else{c={},o=a.status,"string"==typeof a.responseText&&(c.text=a.responseText);try{u=a.statusText}catch(l){u=""}o||!e.isLocal||e.crossDomain?1223===o&&(o=204):o=c.text?200:404}c&&r(o,u,c,a.getAllResponseHeaders())},e.async?4===a.readyState?i.setTimeout(t):a.onreadystatechange=pn[s]=t:t()},abort:function(){t&&t(void 0,!0)}}}}),ge.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),ge.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return ge.globalEval(e),e}}}),ge.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),ge.ajaxTransport("script",function(e){if(e.crossDomain){var t,n=se.head||ge("head")[0]||se.documentElement;return{send:function(r,i){t=se.createElement("script"),t.async=!0,e.scriptCharset&&(t.charset=e.scriptCharset),t.src=e.url,t.onload=t.onreadystatechange=function(e,n){(n||!t.readyState||/loaded|complete/.test(t.readyState))&&(t.onload=t.onreadystatechange=null,t.parentNode&&t.parentNode.removeChild(t),t=null,n||i(200,"success"))},n.insertBefore(t,n.firstChild)},abort:function(){t&&t.onload(void 0,!0)}}}});var hn=[],mn=/(=)\?(?=&|$)|\?\?/;ge.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=hn.pop()||ge.expando+"_"+Bt++;return this[e]=!0,e}}),ge.ajaxPrefilter("json jsonp",function(e,t,n){var r,o,a,s=e.jsonp!==!1&&(mn.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&mn.test(e.data)&&"data");return s||"jsonp"===e.dataTypes[0]?(r=e.jsonpCallback=ge.isFunction(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,s?e[s]=e[s].replace(mn,"$1"+r):e.jsonp!==!1&&(e.url+=(Wt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return a||ge.error(r+" was not called"),a[0]},e.dataTypes[0]="json",o=i[r],i[r]=function(){a=arguments},n.always(function(){void 0===o?ge(i).removeProp(r):i[r]=o,e[r]&&(e.jsonpCallback=t.jsonpCallback,hn.push(r)),a&&ge.isFunction(o)&&o(a[0]),a=o=void 0}),"script"):void 0}),me.createHTMLDocument=function(){if(!se.implementation.createHTMLDocument)return!1;var e=se.implementation.createHTMLDocument("");return e.body.innerHTML="<form></form><form></form>",2===e.body.childNodes.length}(),ge.parseHTML=function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||(me.createHTMLDocument?se.implementation.createHTMLDocument(""):se);var r=Ee.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=w([e],t,i),i&&i.length&&ge(i).remove(),ge.merge([],r.childNodes))};var vn=ge.fn.load;ge.fn.load=function(e,t,n){if("string"!=typeof e&&vn)return vn.apply(this,arguments);var r,i,o,a=this,s=e.indexOf(" ");return s>-1&&(r=ge.trim(e.slice(s,e.length)),e=e.slice(0,s)),ge.isFunction(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),a.length>0&&ge.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?ge("<div>").append(ge.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(a,o||[e.responseText,t,e])})}),this},ge.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){ge.fn[t]=function(e){return this.on(t,e)}}),ge.expr.filters.animated=function(e){return ge.grep(ge.timers,function(t){return e===t.elem}).length},ge.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,c,l=ge.css(e,"position"),f=ge(e),p={};"static"===l&&(e.style.position="relative"),s=f.offset(),o=ge.css(e,"top"),u=ge.css(e,"left"),c=("absolute"===l||"fixed"===l)&&ge.inArray("auto",[o,u])>-1,c?(r=f.position(),a=r.top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),ge.isFunction(t)&&(t=t.call(e,n,ge.extend({},s))),null!=t.top&&(p.top=t.top-s.top+a),null!=t.left&&(p.left=t.left-s.left+i),"using"in t?t.using.call(e,p):f.css(p)}},ge.fn.extend({offset:function(e){if(arguments.length)return void 0===e?this:this.each(function(t){
6
- ge.offset.setOffset(this,e,t)});var t,n,r={top:0,left:0},i=this[0],o=i&&i.ownerDocument;if(o)return t=o.documentElement,ge.contains(t,i)?("undefined"!=typeof i.getBoundingClientRect&&(r=i.getBoundingClientRect()),n=oe(o),{top:r.top+(n.pageYOffset||t.scrollTop)-(t.clientTop||0),left:r.left+(n.pageXOffset||t.scrollLeft)-(t.clientLeft||0)}):r},position:function(){if(this[0]){var e,t,n={top:0,left:0},r=this[0];return"fixed"===ge.css(r,"position")?t=r.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),ge.nodeName(e[0],"html")||(n=e.offset()),n.top+=ge.css(e[0],"borderTopWidth",!0),n.left+=ge.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-ge.css(r,"marginTop",!0),left:t.left-n.left-ge.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent;e&&!ge.nodeName(e,"html")&&"static"===ge.css(e,"position");)e=e.offsetParent;return e||gt})}}),ge.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,t){var n=/Y/.test(t);ge.fn[e]=function(r){return qe(this,function(e,r,i){var o=oe(e);return void 0===i?o?t in o?o[t]:o.document.documentElement[r]:e[r]:void(o?o.scrollTo(n?ge(o).scrollLeft():i,n?i:ge(o).scrollTop()):e[r]=i)},e,r,arguments.length,null)}}),ge.each(["top","left"],function(e,t){ge.cssHooks[t]=M(me.pixelPosition,function(e,n){return n?(n=bt(e,t),mt.test(n)?ge(e).position()[t]+"px":n):void 0})}),ge.each({Height:"height",Width:"width"},function(e,t){ge.each({padding:"inner"+e,content:t,"":"outer"+e},function(n,r){ge.fn[r]=function(r,i){var o=arguments.length&&(n||"boolean"!=typeof r),a=n||(r===!0||i===!0?"margin":"border");return qe(this,function(t,n,r){var i;return ge.isWindow(t)?t.document.documentElement["client"+e]:9===t.nodeType?(i=t.documentElement,Math.max(t.body["scroll"+e],i["scroll"+e],t.body["offset"+e],i["offset"+e],i["client"+e])):void 0===r?ge.css(t,n,a):ge.style(t,n,r,a)},t,o?r:void 0,o,null)}})}),ge.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)}}),ge.fn.size=function(){return this.length},ge.fn.andSelf=ge.fn.addBack,n=[],r=function(){return ge}.apply(t,n),!(void 0!==r&&(e.exports=r));var gn=i.jQuery,yn=i.$;return ge.noConflict=function(e){return i.$===ge&&(i.$=yn),e&&i.jQuery===ge&&(i.jQuery=gn),ge},o||(i.jQuery=i.$=ge),ge})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var i=n(3),o=r(i);e.exports=o["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0}),n(4),n(5);var i=n(6),o=r(i),a=n(7),s=r(a),u=n(101),c=r(u),l=n(349),f=r(l),p=n(573),d=r(p),h=n(584),m=r(h),v=n(588),g=r(v),y=n(591),b=r(y),x=n(596),w=r(x),_=n(600),C=r(_),$=n(602),S=r($),E=n(607),P=r(E),k=n(608),T=r(k),O=n(620),R=r(O),N=n(625),A=r(N),j=n(627),M=r(j),D=n(631),I=r(D),F=n(634),L=r(F),U=n(637),H=r(U),V=n(640),q=r(V),B=n(340),W=r(B),z=o["default"](s["default"]);z.widgets={clearAll:f["default"],currentRefinedValues:d["default"],hierarchicalMenu:m["default"],hits:g["default"],hitsPerPageSelector:b["default"],menu:w["default"],refinementList:C["default"],numericRefinementList:S["default"],numericSelector:P["default"],pagination:T["default"],priceRanges:R["default"],searchBox:A["default"],rangeSlider:M["default"],sortBySelector:I["default"],starRating:L["default"],stats:H["default"],toggle:q["default"]},z.version=W["default"],z.createQueryString=c["default"].url.getQueryStringFromState,t["default"]=z},function(){"use strict";Object.freeze||(Object.freeze=function(e){if(Object(e)!==e)throw new TypeError("Object.freeze can only be called on Objects.");return e})},function(){"use strict";var e={};if(!Object.setPrototypeOf&&!e.__proto__){var t=Object.getPrototypeOf;Object.getPrototypeOf=function(e){return e.__proto__?e.__proto__:t.call(Object,e)}}},function(e){"use strict";function t(e){var t=function(){for(var t=arguments.length,r=Array(t),i=0;t>i;i++)r[i]=arguments[i];return new(n.apply(e,[null].concat(r)))};return t.__proto__=e,t.prototype=e.prototype,t}var n=Function.prototype.bind;e.exports=t},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(){return"#"}function u(e,t){if(!t.getConfiguration)return e;var n=t.getConfiguration(e);return y["default"]({},e,n,function(e,t){return Array.isArray(e)?x["default"](e,t):void 0})}Object.defineProperty(t,"__esModule",{value:!0});var c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=n(8),p=r(f),d=n(101),h=r(d),m=n(283),v=r(m),g=n(309),y=r(g),b=n(321),x=r(b),w=n(331),_=r(w),C=n(338),$=n(339),S=r($),E=n(340),P=r(E),k=n(348),T=r(k),O=function(e){function t(e){var n=e.appId,r=void 0===n?null:n,a=e.apiKey,s=void 0===a?null:a,u=e.indexName,l=void 0===u?null:u,f=e.numberLocale,d=e.searchParameters,h=void 0===d?{}:d,m=e.urlSync,v=void 0===m?null:m,g=e.searchFunction;i(this,t);var y=o(this,Object.getPrototypeOf(t).call(this));if(null===r||null===s||null===l){var b="\nUsage: instantsearch({\n appId: 'my_application_id',\n apiKey: 'my_search_api_key',\n indexName: 'my_index_name'\n});";throw new Error(b)}var x=p["default"](r,s);return x.addAlgoliaAgent("instantsearch.js "+P["default"]),y.client=x,y.helper=null,y.indexName=l,y.searchParameters=c({},h,{index:l}),y.widgets=[],y.templatesConfig={helpers:T["default"]({numberLocale:f}),compileOptions:{}},g&&(y._searchFunction=g),y.urlSync=v===!0?{}:v,y}return a(t,e),l(t,[{key:"addWidget",value:function(e){if(void 0===e.render&&void 0===e.init)throw new Error("Widget definition missing render or init method");this.widgets.push(e)}},{key:"start",value:function(){if(!this.widgets)throw new Error("No widgets were added to instantsearch.js");if(this.urlSync){var e=S["default"](this.urlSync);this._createURL=e.createURL.bind(e),this._onHistoryChange=e.onHistoryChange.bind(e),this.widgets.push(e)}else this._createURL=s,this._onHistoryChange=function(){};this.searchParameters=this.widgets.reduce(u,this.searchParameters);var t=h["default"](this.client,this.searchParameters.index||this.indexName,this.searchParameters);this._searchFunction&&(this._originalHelperSearch=t.search.bind(t),t.search=this._wrappedSearch.bind(this)),this.helper=t,this._init(t.state,t),t.on("result",this._render.bind(this,t)),t.search()}},{key:"_wrappedSearch",value:function(){var e=_["default"](this.helper);e.search=this._originalHelperSearch,this._searchFunction(e)}},{key:"createURL",value:function(e){if(!this._createURL)throw new Error("You need to call start() before calling createURL()");return this._createURL(this.helper.state.setQueryParameters(e))}},{key:"_render",value:function(e,t,n){v["default"](this.widgets,function(r){r.render&&r.render({templatesConfig:this.templatesConfig,results:t,state:n,helper:e,createURL:this._createURL})},this),this.emit("render")}},{key:"_init",value:function(e,t){var n=this._onHistoryChange,r=this.templatesConfig;v["default"](this.widgets,function(i){i.init&&i.init({state:e,helper:t,templatesConfig:r,createURL:this._createURL,onHistoryChange:n})},this)}}]),t}(C.EventEmitter);t["default"]=O},function(e,t,n){"use strict";function r(e,t,o){var a=n(98),s=n(99);return o=a(o||{}),void 0===o.protocol&&(o.protocol=s()),o._ua=o._ua||r.ua,new i(e,t,o)}function i(){s.apply(this,arguments)}e.exports=r;var o=n(9),a=window.Promise||n(10).Promise,s=n(15),u=n(16),c=n(92),l=n(96),f=n(97);"development"==={NODE_ENV:"production"}.APP_ENV&&n(44).enable("algoliasearch*"),r.version=n(100),r.ua="Algolia for vanilla JavaScript "+r.version,r.initPlaces=f(r),window.__algolia={debug:n(44),algoliasearch:r};var p={hasXMLHttpRequest:"XMLHttpRequest"in window,hasXDomainRequest:"XDomainRequest"in window,cors:"withCredentials"in new XMLHttpRequest,timeout:"timeout"in new XMLHttpRequest};o(i,s),i.prototype._request=function(e,t){return new a(function(n,r){function i(){if(!l){p.timeout||clearTimeout(s);var e;try{e={body:JSON.parse(d.responseText),responseText:d.responseText,statusCode:d.status,headers:d.getAllResponseHeaders&&d.getAllResponseHeaders()||{}}}catch(t){e=new u.UnparsableJSON({more:d.responseText})}e instanceof u.UnparsableJSON?r(e):n(e)}}function o(e){l||(p.timeout||clearTimeout(s),r(new u.Network({more:e})))}function a(){p.timeout||(l=!0,d.abort()),r(new u.RequestTimeout)}if(!p.cors&&!p.hasXDomainRequest)return void r(new u.Network("CORS not supported"));e=c(e,t.headers);var s,l,f=t.body,d=p.cors?new XMLHttpRequest:new XDomainRequest;d instanceof XMLHttpRequest?d.open(t.method,e,!0):d.open(t.method,e),p.cors&&(f&&("POST"===t.method?d.setRequestHeader("content-type","application/x-www-form-urlencoded"):d.setRequestHeader("content-type","application/json")),d.setRequestHeader("accept","application/json")),d.onprogress=function(){},d.onload=i,d.onerror=o,p.timeout?(d.timeout=t.timeout,d.ontimeout=a):s=setTimeout(a,t.timeout),d.send(f)})},i.prototype._request.fallback=function(e,t){return e=c(e,t.headers),new a(function(n,r){l(e,t,function(e,t){return e?void r(e):void n(t)})})},i.prototype._promise={reject:function(e){return a.reject(e)},resolve:function(e){return a.resolve(e)},delay:function(e){return new a(function(t){setTimeout(t,e)})}}},function(e){e.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){var r;(function(e,i,o){(function(){"use strict";function a(e){return"function"==typeof e||"object"==typeof e&&null!==e}function s(e){return"function"==typeof e}function u(e){K=e}function c(e){X=e}function l(){return function(){e.nextTick(m)}}function f(){return function(){z(m)}}function p(){var e=0,t=new ee(m),n=document.createTextNode("");return t.observe(n,{characterData:!0}),function(){n.data=e=++e%2}}function d(){var e=new MessageChannel;return e.port1.onmessage=m,function(){e.port2.postMessage(0)}}function h(){return function(){setTimeout(m,1)}}function m(){for(var e=0;Y>e;e+=2){var t=re[e],n=re[e+1];t(n),re[e]=void 0,re[e+1]=void 0}Y=0}function v(){try{var e=n(13);return z=e.runOnLoop||e.runOnContext,f()}catch(t){return h()}}function g(e,t){var n=this,r=n._state;if(r===se&&!e||r===ue&&!t)return this;var i=new this.constructor(b),o=n._result;if(r){var a=arguments[r-1];X(function(){M(r,i,a,o)})}else R(n,i,e,t);return i}function y(e){var t=this;if(e&&"object"==typeof e&&e.constructor===t)return e;var n=new t(b);return P(n,e),n}function b(){}function x(){return new TypeError("You cannot resolve a promise with itself")}function w(){return new TypeError("A promises callback cannot return that same promise.")}function _(e){try{return e.then}catch(t){return ce.error=t,ce}}function C(e,t,n,r){try{e.call(t,n,r)}catch(i){return i}}function $(e,t,n){X(function(e){var r=!1,i=C(n,t,function(n){r||(r=!0,t!==n?P(e,n):T(e,n))},function(t){r||(r=!0,O(e,t))},"Settle: "+(e._label||" unknown promise"));!r&&i&&(r=!0,O(e,i))},e)}function S(e,t){t._state===se?T(e,t._result):t._state===ue?O(e,t._result):R(t,void 0,function(t){P(e,t)},function(t){O(e,t)})}function E(e,t,n){t.constructor===e.constructor&&n===ie&&constructor.resolve===oe?S(e,t):n===ce?O(e,ce.error):void 0===n?T(e,t):s(n)?$(e,t,n):T(e,t)}function P(e,t){e===t?O(e,x()):a(t)?E(e,t,_(t)):T(e,t)}function k(e){e._onerror&&e._onerror(e._result),N(e)}function T(e,t){e._state===ae&&(e._result=t,e._state=se,0!==e._subscribers.length&&X(N,e))}function O(e,t){e._state===ae&&(e._state=ue,e._result=t,X(k,e))}function R(e,t,n,r){var i=e._subscribers,o=i.length;e._onerror=null,i[o]=t,i[o+se]=n,i[o+ue]=r,0===o&&e._state&&X(N,e)}function N(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var r,i,o=e._result,a=0;a<t.length;a+=3)r=t[a],i=t[a+n],r?M(n,r,i,o):i(o);e._subscribers.length=0}}function A(){this.error=null}function j(e,t){try{return e(t)}catch(n){return le.error=n,le}}function M(e,t,n,r){var i,o,a,u,c=s(n);if(c){if(i=j(n,r),i===le?(u=!0,o=i.error,i=null):a=!0,t===i)return void O(t,w())}else i=r,a=!0;t._state!==ae||(c&&a?P(t,i):u?O(t,o):e===se?T(t,i):e===ue&&O(t,i))}function D(e,t){try{t(function(t){P(e,t)},function(t){O(e,t)})}catch(n){O(e,n)}}function I(e){return new ve(this,e).promise}function F(e){function t(e){P(i,e)}function n(e){O(i,e)}var r=this,i=new r(b);if(!G(e))return O(i,new TypeError("You must pass an array to race.")),i;for(var o=e.length,a=0;i._state===ae&&o>a;a++)R(r.resolve(e[a]),void 0,t,n);return i}function L(e){var t=this,n=new t(b);return O(n,e),n}function U(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function H(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function V(e){this._id=he++,this._state=void 0,this._result=void 0,this._subscribers=[],b!==e&&("function"!=typeof e&&U(),this instanceof V?D(this,e):H())}function q(e,t){this._instanceConstructor=e,this.promise=new e(b),Array.isArray(t)?(this._input=t,this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?T(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&T(this.promise,this._result))):O(this.promise,this._validationError())}function B(){var e;if("undefined"!=typeof i)e=i;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=e.Promise;(!n||"[object Promise]"!==Object.prototype.toString.call(n.resolve())||n.cast)&&(e.Promise=me)}var W;W=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)};var z,K,Q,G=W,Y=0,X=function(e,t){re[Y]=e,re[Y+1]=t,Y+=2,2===Y&&(K?K(m):Q())},J="undefined"!=typeof window?window:void 0,Z=J||{},ee=Z.MutationObserver||Z.WebKitMutationObserver,te="undefined"!=typeof e&&"[object process]"==={}.toString.call(e),ne="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,re=new Array(1e3);Q=te?l():ee?p():ne?d():void 0===J?v():h();var ie=g,oe=y,ae=void 0,se=1,ue=2,ce=new A,le=new A,fe=I,pe=F,de=L,he=0,me=V;V.all=fe,V.race=pe,V.resolve=oe,V.reject=de,V._setScheduler=u,V._setAsap=c,V._asap=X,V.prototype={constructor:V,then:ie,"catch":function(e){return this.then(null,e)}};var ve=q;q.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},q.prototype._enumerate=function(){for(var e=this.length,t=this._input,n=0;this._state===ae&&e>n;n++)this._eachEntry(t[n],n)},q.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,r=n.resolve;if(r===oe){var i=_(e);if(i===ie&&e._state!==ae)this._settledAt(e._state,t,e._result);else if("function"!=typeof i)this._remaining--,this._result[t]=e;else if(n===me){var o=new n(b);E(o,e,i),this._willSettleAt(o,t)}else this._willSettleAt(new n(function(t){t(e)}),t)}else this._willSettleAt(r(e),t)},q.prototype._settledAt=function(e,t,n){var r=this.promise;r._state===ae&&(this._remaining--,e===ue?O(r,n):this._result[t]=n),0===this._remaining&&T(r,this._result)},q.prototype._willSettleAt=function(e,t){var n=this;R(e,void 0,function(e){n._settledAt(se,t,e)},function(e){n._settledAt(ue,t,e)})};var ge=B,ye={Promise:me,polyfill:ge};n(14).amd?(r=function(){return ye}.call(t,n,t,o),!(void 0!==r&&(o.exports=r))):"undefined"!=typeof o&&o.exports?o.exports=ye:"undefined"!=typeof this&&(this.ES6Promise=ye),ge()}).call(this)}).call(t,n(11),function(){return this}(),n(12)(e))},function(e){function t(){u=!1,o.length?s=o.concat(s):c=-1,s.length&&n()}function n(){if(!u){var e=setTimeout(t);u=!0;for(var n=s.length;n;){for(o=s,s=[];++c<n;)o&&o[c].run();c=-1,n=s.length}o=null,u=!1,clearTimeout(e)}}function r(e,t){this.fun=e,this.array=t}function i(){}var o,a=e.exports={},s=[],u=!1,c=-1;a.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];s.push(new r(e,t)),1!==s.length||u||setTimeout(n,0)},r.prototype.run=function(){this.fun.apply(null,this.array)},a.title="browser",a.browser=!0,a.env={},a.argv=[],a.version="",a.versions={},a.on=i,a.addListener=i,a.once=i,a.off=i,a.removeListener=i,a.removeAllListeners=i,a.emit=i,a.binding=function(){throw new Error("process.binding is not supported")},a.cwd=function(){return"/"},a.chdir=function(){throw new Error("process.chdir is not supported")},a.umask=function(){return 0}},function(e){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(){},function(e){e.exports=function(){throw new Error("define cannot be used indirect")}},function(e,t,n){"use strict";function r(e,t,r){var o=n(44)("algoliasearch"),a=n(47),s=n(36),u=n(57),c="Usage: algoliasearch(applicationID, apiKey, opts)";if(!e)throw new l.AlgoliaSearchError("Please provide an application ID. "+c);if(!t)throw new l.AlgoliaSearchError("Please provide an API key. "+c);this.applicationID=e,this.apiKey=t;var f=[this.applicationID+"-1.algolianet.com",this.applicationID+"-2.algolianet.com",this.applicationID+"-3.algolianet.com"];this.hosts={read:[],write:[]},this.hostIndex={read:0,write:0},r=r||{};var p=r.protocol||"https:",d=void 0===r.timeout?2e3:r.timeout;if(/:$/.test(p)||(p+=":"),"http:"!==r.protocol&&"https:"!==r.protocol)throw new l.AlgoliaSearchError("protocol must be `http:` or `https:` (was `"+r.protocol+"`)");r.hosts?s(r.hosts)?(this.hosts.read=a(r.hosts),this.hosts.write=a(r.hosts)):(this.hosts.read=a(r.hosts.read),this.hosts.write=a(r.hosts.write)):(this.hosts.read=[this.applicationID+"-dsn.algolia.net"].concat(f),this.hosts.write=[this.applicationID+".algolia.net"].concat(f)),this.hosts.read=u(this.hosts.read,i(p)),this.hosts.write=u(this.hosts.write,i(p)),this.requestTimeout=d,this.extraHeaders=[],this.cache=r._cache||{},this._ua=r._ua,this._useCache=void 0===r._useCache||r._cache?!0:r._useCache,this._useFallback=void 0===r.useFallback?!0:r.useFallback,this._setTimeout=r._setTimeout,o("init done, %j",this)}function i(e){return function(t){return e+"//"+t.toLowerCase()}}function o(){var e="Not implemented in this environment.\nIf you feel this is a mistake, write to support@algolia.com";throw new l.AlgoliaSearchError(e)}function a(e,t){var n=e.toLowerCase().replace(".","").replace("()","");return"algoliasearch: `"+e+"` was replaced by `"+t+"`. Please see https://github.com/algolia/algoliasearch-client-js/wiki/Deprecated#"+n}function s(e,t){t(e,0)}function u(e,t){function n(){return r||(console.log(t),r=!0),e.apply(this,arguments)}var r=!1;return n}function c(e){if(void 0===Array.prototype.toJSON)return JSON.stringify(e);var t=Array.prototype.toJSON;delete Array.prototype.toJSON;var n=JSON.stringify(e);return Array.prototype.toJSON=t,n}e.exports=r;var l=n(16),f=n(43),p=500;r.prototype={deleteIndex:function(e,t){return this._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(e),hostType:"write",callback:t})},moveIndex:function(e,t,n){var r={operation:"move",destination:t};return this._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(e)+"/operation",body:r,hostType:"write",callback:n})},copyIndex:function(e,t,n){var r={operation:"copy",destination:t};return this._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(e)+"/operation",body:r,hostType:"write",callback:n})},getLogs:function(e,t,n){return 0===arguments.length||"function"==typeof e?(n=e,e=0,t=10):(1===arguments.length||"function"==typeof t)&&(n=t,t=10),this._jsonRequest({method:"GET",url:"/1/logs?offset="+e+"&length="+t,hostType:"read",callback:n})},listIndexes:function(e,t){var n="";return void 0===e||"function"==typeof e?t=e:n="?page="+e,this._jsonRequest({method:"GET",url:"/1/indexes"+n,hostType:"read",callback:t})},initIndex:function(e){return new this.Index(this,e)},listUserKeys:function(e){return this._jsonRequest({method:"GET",url:"/1/keys",hostType:"read",callback:e})},getUserKeyACL:function(e,t){return this._jsonRequest({method:"GET",url:"/1/keys/"+e,hostType:"read",callback:t})},deleteUserKey:function(e,t){return this._jsonRequest({method:"DELETE",url:"/1/keys/"+e,hostType:"write",callback:t})},addUserKey:function(e,t,r){var i=n(36),o="Usage: client.addUserKey(arrayOfAcls[, params, callback])";if(!i(e))throw new Error(o);(1===arguments.length||"function"==typeof t)&&(r=t,t=null);var a={acl:e};return t&&(a.validity=t.validity,a.maxQueriesPerIPPerHour=t.maxQueriesPerIPPerHour,a.maxHitsPerQuery=t.maxHitsPerQuery,a.indexes=t.indexes,a.description=t.description,t.queryParameters&&(a.queryParameters=this._getSearchParams(t.queryParameters,"")),a.referers=t.referers),this._jsonRequest({method:"POST",url:"/1/keys",body:a,hostType:"write",callback:r})},addUserKeyWithValidity:u(function(e,t,n){return this.addUserKey(e,t,n)},a("client.addUserKeyWithValidity()","client.addUserKey()")),updateUserKey:function(e,t,r,i){var o=n(36),a="Usage: client.updateUserKey(key, arrayOfAcls[, params, callback])";if(!o(t))throw new Error(a);(2===arguments.length||"function"==typeof r)&&(i=r,r=null);var s={acl:t};return r&&(s.validity=r.validity,s.maxQueriesPerIPPerHour=r.maxQueriesPerIPPerHour,s.maxHitsPerQuery=r.maxHitsPerQuery,s.indexes=r.indexes,s.description=r.description,r.queryParameters&&(s.queryParameters=this._getSearchParams(r.queryParameters,"")),s.referers=r.referers),this._jsonRequest({method:"PUT",url:"/1/keys/"+e,body:s,hostType:"write",callback:i})},setSecurityTags:function(e){if("[object Array]"===Object.prototype.toString.call(e)){for(var t=[],n=0;n<e.length;++n)if("[object Array]"===Object.prototype.toString.call(e[n])){for(var r=[],i=0;i<e[n].length;++i)r.push(e[n][i]);t.push("("+r.join(",")+")")}else t.push(e[n]);e=t.join(",")}this.securityTags=e},setUserToken:function(e){this.userToken=e},startQueriesBatch:u(function(){this._batch=[]},a("client.startQueriesBatch()","client.search()")),addQueryInBatch:u(function(e,t,n){this._batch.push({indexName:e,query:t,params:n})},a("client.addQueryInBatch()","client.search()")),clearCache:function(){this.cache={}},sendQueriesBatch:u(function(e){return this.search(this._batch,e)},a("client.sendQueriesBatch()","client.search()")),setRequestTimeout:function(e){e&&(this.requestTimeout=parseInt(e,10))},search:function(e,t){var r=n(36),i=n(57),o="Usage: client.search(arrayOfQueries[, callback])";if(!r(e))throw new Error(o);var a=this,s={requests:i(e,function(e){var t="";return void 0!==e.query&&(t+="query="+encodeURIComponent(e.query)),{indexName:e.indexName,params:a._getSearchParams(e.params,t)}})},u=i(s.requests,function(e,t){return t+"="+encodeURIComponent("/1/indexes/"+encodeURIComponent(e.indexName)+"?"+e.params)}).join("&");return this._jsonRequest({cache:this.cache,method:"POST",url:"/1/indexes/*/queries",body:s,hostType:"read",fallback:{method:"GET",url:"/1/indexes/*",body:{params:u}},callback:t})},batch:function(e,t){var r=n(36),i="Usage: client.batch(operations[, callback])";if(!r(e))throw new Error(i);return this._jsonRequest({method:"POST",url:"/1/indexes/*/batch",body:{requests:e},hostType:"write",callback:t})},destroy:o,enableRateLimitForward:o,disableRateLimitForward:o,useSecuredAPIKey:o,disableSecuredAPIKey:o,generateSecuredApiKey:o,Index:function(e,t){this.indexName=t,this.as=e,this.typeAheadArgs=null,this.typeAheadValueOption=null,this.cache={}},setExtraHeader:function(e,t){this.extraHeaders.push({name:e.toLowerCase(),value:t})},addAlgoliaAgent:function(e){this._ua+=";"+e},_jsonRequest:function(e){function t(n,s){function p(e){var t=e&&e.body&&e.body.message&&e.body.status||e.statusCode||e&&e.body&&200;o("received response: statusCode: %s, computed statusCode: %d, headers: %j",e.statusCode,t,e.headers);var n=200===t||201===t,r=!n&&4!==Math.floor(t/100)&&1!==Math.floor(t/100);if(u._useCache&&n&&a&&(a[g]=e.responseText),n)return e.body;if(r)return f+=1,v();var i=new l.AlgoliaSearchError(e.body&&e.body.message);return u._promise.reject(i)}function m(r){return o("error: %s, stack: %s",r.message,r.stack),r instanceof l.AlgoliaSearchError||(r=new l.Unknown(r&&r.message,r)),f+=1,r instanceof l.Unknown||r instanceof l.UnparsableJSON||f>=u.hosts[e.hostType].length&&(d||!h)?u._promise.reject(r):(u.hostIndex[e.hostType]=++u.hostIndex[e.hostType]%u.hosts[e.hostType].length,r instanceof l.RequestTimeout?v():(d||(f=1/0),t(n,s)))}function v(){return u.hostIndex[e.hostType]=++u.hostIndex[e.hostType]%u.hosts[e.hostType].length,s.timeout=u.requestTimeout*(f+1),t(n,s)}var g;if(u._useCache&&(g=e.url),u._useCache&&r&&(g+="_body_"+s.body),u._useCache&&a&&void 0!==a[g])return o("serving response from cache"),u._promise.resolve(JSON.parse(a[g]));if(f>=u.hosts[e.hostType].length)return!h||d?(o("could not get any response"),u._promise.reject(new l.AlgoliaSearchError("Cannot connect to the AlgoliaSearch API. Send an email to support@algolia.com to report and resolve the issue. Application id was: "+u.applicationID))):(o("switching to fallback"),f=0,s.method=e.fallback.method,s.url=e.fallback.url,s.jsonBody=e.fallback.body,s.jsonBody&&(s.body=c(s.jsonBody)),i=u._computeRequestHeaders(),s.timeout=u.requestTimeout*(f+1),u.hostIndex[e.hostType]=0,d=!0,t(u._request.fallback,s));var y=u.hosts[e.hostType][u.hostIndex[e.hostType]]+s.url,b={body:s.body,jsonBody:s.jsonBody,method:s.method,headers:i,timeout:s.timeout,debug:o};return o("method: %s, url: %s, headers: %j, timeout: %d",b.method,y,b.headers,b.timeout),n===u._request.fallback&&o("using fallback"),n.call(u,y,b).then(p,m)}var r,i,o=n(44)("algoliasearch:"+e.url),a=e.cache,u=this,f=0,d=!1,h=u._useFallback&&u._request.fallback&&e.fallback;this.apiKey.length>p&&void 0!==e.body&&void 0!==e.body.params?(e.body.apiKey=this.apiKey,i=this._computeRequestHeaders(!1)):i=this._computeRequestHeaders(),void 0!==e.body&&(r=c(e.body)),o("request start");var m=t(u._request,{url:e.url,method:e.method,body:r,jsonBody:e.body,timeout:u.requestTimeout*(f+1)});return e.callback?void m.then(function(t){s(function(){e.callback(null,t)},u._setTimeout||setTimeout)},function(t){s(function(){e.callback(t)},u._setTimeout||setTimeout)}):m},_getSearchParams:function(e,t){if(void 0===e||null===e)return t;for(var n in e)null!==n&&void 0!==e[n]&&e.hasOwnProperty(n)&&(t+=""===t?"":"&",t+=n+"="+encodeURIComponent("[object Array]"===Object.prototype.toString.call(e[n])?c(e[n]):e[n]));return t},_computeRequestHeaders:function(e){var t=n(17),r={"x-algolia-agent":this._ua,"x-algolia-application-id":this.applicationID};return e!==!1&&(r["x-algolia-api-key"]=this.apiKey),this.userToken&&(r["x-algolia-usertoken"]=this.userToken),this.securityTags&&(r["x-algolia-tagfilters"]=this.securityTags),this.extraHeaders&&t(this.extraHeaders,function(e){r[e.name]=e.value}),r}},r.prototype.Index.prototype={clearCache:function(){this.cache={}},addObject:function(e,t,n){var r=this;return(1===arguments.length||"function"==typeof t)&&(n=t,t=void 0),this.as._jsonRequest({method:void 0!==t?"PUT":"POST",url:"/1/indexes/"+encodeURIComponent(r.indexName)+(void 0!==t?"/"+encodeURIComponent(t):""),body:e,hostType:"write",callback:n})},addObjects:function(e,t){var r=n(36),i="Usage: index.addObjects(arrayOfObjects[, callback])";if(!r(e))throw new Error(i);for(var o=this,a={requests:[]},s=0;s<e.length;++s){var u={action:"addObject",body:e[s]};a.requests.push(u)}return this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(o.indexName)+"/batch",body:a,hostType:"write",callback:t})},getObject:function(e,t,n){var r=this;(1===arguments.length||"function"==typeof t)&&(n=t,t=void 0);var i="";if(void 0!==t){i="?attributes=";for(var o=0;o<t.length;++o)0!==o&&(i+=","),i+=t[o]}return this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(r.indexName)+"/"+encodeURIComponent(e)+i,hostType:"read",callback:n})},getObjects:function(e,t,r){var i=n(36),o=n(57),a="Usage: index.getObjects(arrayOfObjectIDs[, callback])";if(!i(e))throw new Error(a);var s=this;(1===arguments.length||"function"==typeof t)&&(r=t,t=void 0);var u={requests:o(e,function(e){var n={indexName:s.indexName,objectID:e};return t&&(n.attributesToRetrieve=t.join(",")),n})};return this.as._jsonRequest({method:"POST",url:"/1/indexes/*/objects",hostType:"read",body:u,callback:r})},partialUpdateObject:function(e,t,n){(1===arguments.length||"function"==typeof t)&&(n=t,t=void 0);var r=this,i="/1/indexes/"+encodeURIComponent(r.indexName)+"/"+encodeURIComponent(e.objectID)+"/partial";return t===!1&&(i+="?createIfNotExists=false"),this.as._jsonRequest({method:"POST",url:i,body:e,hostType:"write",callback:n})},partialUpdateObjects:function(e,t){var r=n(36),i="Usage: index.partialUpdateObjects(arrayOfObjects[, callback])";if(!r(e))throw new Error(i);for(var o=this,a={requests:[]},s=0;s<e.length;++s){var u={action:"partialUpdateObject",objectID:e[s].objectID,body:e[s]};a.requests.push(u)}return this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(o.indexName)+"/batch",body:a,hostType:"write",callback:t})},saveObject:function(e,t){var n=this;return this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(n.indexName)+"/"+encodeURIComponent(e.objectID),body:e,hostType:"write",callback:t})},saveObjects:function(e,t){var r=n(36),i="Usage: index.saveObjects(arrayOfObjects[, callback])";if(!r(e))throw new Error(i);for(var o=this,a={requests:[]},s=0;s<e.length;++s){var u={action:"updateObject",objectID:e[s].objectID,body:e[s]};a.requests.push(u)}return this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(o.indexName)+"/batch",body:a,hostType:"write",callback:t})},deleteObject:function(e,t){if("function"==typeof e||"string"!=typeof e&&"number"!=typeof e){var n=new l.AlgoliaSearchError("Cannot delete an object without an objectID");return t=e,"function"==typeof t?t(n):this.as._promise.reject(n)}var r=this;return this.as._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(r.indexName)+"/"+encodeURIComponent(e),hostType:"write",callback:t})},deleteObjects:function(e,t){var r=n(36),i=n(57),o="Usage: index.deleteObjects(arrayOfObjectIDs[, callback])";if(!r(e))throw new Error(o);var a=this,s={requests:i(e,function(e){return{action:"deleteObject",objectID:e,body:{objectID:e}}})};return this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(a.indexName)+"/batch",body:s,hostType:"write",callback:t})},deleteByQuery:function(e,t,r){function i(e){if(0===e.nbHits)return e;var t=f(e.hits,function(e){return e.objectID});return p.deleteObjects(t).then(o).then(a)}function o(e){return p.waitTask(e.taskID)}function a(){return p.deleteByQuery(e,t)}function u(){s(function(){r(null)},d._setTimeout||setTimeout)}function c(e){s(function(){r(e)},d._setTimeout||setTimeout)}var l=n(47),f=n(57),p=this,d=p.as;1===arguments.length||"function"==typeof t?(r=t,t={}):t=l(t),t.attributesToRetrieve="objectID",t.hitsPerPage=1e3,t.distinct=!1,
7
- this.clearCache();var h=this.search(e,t).then(i);return r?void h.then(u,c):h},search:f("query"),similarSearch:f("similarQuery"),browse:function(e,t,r){var i,o,a=n(82),s=this;0===arguments.length||1===arguments.length&&"function"==typeof arguments[0]?(i=0,r=arguments[0],e=void 0):"number"==typeof arguments[0]?(i=arguments[0],"number"==typeof arguments[1]?o=arguments[1]:"function"==typeof arguments[1]&&(r=arguments[1],o=void 0),e=void 0,t=void 0):"object"==typeof arguments[0]?("function"==typeof arguments[1]&&(r=arguments[1]),t=arguments[0],e=void 0):"string"==typeof arguments[0]&&"function"==typeof arguments[1]&&(r=arguments[1],t=void 0),t=a({},t||{},{page:i,hitsPerPage:o,query:e});var u=this.as._getSearchParams(t,"");return this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(s.indexName)+"/browse?"+u,hostType:"read",callback:r})},browseFrom:function(e,t){return this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/browse?cursor="+encodeURIComponent(e),hostType:"read",callback:t})},browseAll:function(e,t){function r(e){if(!s._stopped){var t;t=void 0!==e?"cursor="+encodeURIComponent(e):l,u._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/browse?"+t,hostType:"read",callback:i})}}function i(e,t){return s._stopped?void 0:e?void s._error(e):(s._result(t),void 0===t.cursor?void s._end():void r(t.cursor))}"object"==typeof e&&(t=e,e=void 0);var o=n(82),a=n(90),s=new a,u=this.as,c=this,l=u._getSearchParams(o({},t||{},{query:e}),"");return r(),s},ttAdapter:function(e){var t=this;return function(n,r,i){var o;o="function"==typeof i?i:r,t.search(n,e,function(e,t){return e?void o(e):void o(t.hits)})}},waitTask:function(e,t){function n(){return l._jsonRequest({method:"GET",hostType:"read",url:"/1/indexes/"+encodeURIComponent(c.indexName)+"/task/"+e}).then(function(e){u++;var t=o*u*u;return t>a&&(t=a),"published"!==e.status?l._promise.delay(t).then(n):e})}function r(e){s(function(){t(null,e)},l._setTimeout||setTimeout)}function i(e){s(function(){t(e)},l._setTimeout||setTimeout)}var o=100,a=5e3,u=0,c=this,l=c.as,f=n();return t?void f.then(r,i):f},clearIndex:function(e){var t=this;return this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(t.indexName)+"/clear",hostType:"write",callback:e})},getSettings:function(e){var t=this;return this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(t.indexName)+"/settings",hostType:"read",callback:e})},setSettings:function(e,t){var n=this;return this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(n.indexName)+"/settings",hostType:"write",body:e,callback:t})},listUserKeys:function(e){var t=this;return this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(t.indexName)+"/keys",hostType:"read",callback:e})},getUserKeyACL:function(e,t){var n=this;return this.as._jsonRequest({method:"GET",url:"/1/indexes/"+encodeURIComponent(n.indexName)+"/keys/"+e,hostType:"read",callback:t})},deleteUserKey:function(e,t){var n=this;return this.as._jsonRequest({method:"DELETE",url:"/1/indexes/"+encodeURIComponent(n.indexName)+"/keys/"+e,hostType:"write",callback:t})},addUserKey:function(e,t,r){var i=n(36),o="Usage: index.addUserKey(arrayOfAcls[, params, callback])";if(!i(e))throw new Error(o);(1===arguments.length||"function"==typeof t)&&(r=t,t=null);var a={acl:e};return t&&(a.validity=t.validity,a.maxQueriesPerIPPerHour=t.maxQueriesPerIPPerHour,a.maxHitsPerQuery=t.maxHitsPerQuery,a.description=t.description,t.queryParameters&&(a.queryParameters=this.as._getSearchParams(t.queryParameters,"")),a.referers=t.referers),this.as._jsonRequest({method:"POST",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/keys",body:a,hostType:"write",callback:r})},addUserKeyWithValidity:u(function(e,t,n){return this.addUserKey(e,t,n)},a("index.addUserKeyWithValidity()","index.addUserKey()")),updateUserKey:function(e,t,r,i){var o=n(36),a="Usage: index.updateUserKey(key, arrayOfAcls[, params, callback])";if(!o(t))throw new Error(a);(2===arguments.length||"function"==typeof r)&&(i=r,r=null);var s={acl:t};return r&&(s.validity=r.validity,s.maxQueriesPerIPPerHour=r.maxQueriesPerIPPerHour,s.maxHitsPerQuery=r.maxHitsPerQuery,s.description=r.description,r.queryParameters&&(s.queryParameters=this.as._getSearchParams(r.queryParameters,"")),s.referers=r.referers),this.as._jsonRequest({method:"PUT",url:"/1/indexes/"+encodeURIComponent(this.indexName)+"/keys/"+e,body:s,hostType:"write",callback:i})},_search:function(e,t,n){return this.as._jsonRequest({cache:this.cache,method:"POST",url:t||"/1/indexes/"+encodeURIComponent(this.indexName)+"/query",body:{params:e},hostType:"read",fallback:{method:"GET",url:"/1/indexes/"+encodeURIComponent(this.indexName),body:{params:e}},callback:n})},as:null,indexName:null,typeAheadArgs:null,typeAheadValueOption:null}},function(e,t,n){"use strict";function r(e,t){var r=n(17),i=this;"function"==typeof Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):i.stack=(new Error).stack||"Cannot get a stacktrace, browser is too old",this.name=this.constructor.name,this.message=e||"Unknown error",t&&r(t,function(e,t){i[t]=e})}function i(e,t){function n(){var n=Array.prototype.slice.call(arguments,0);"string"!=typeof n[0]&&n.unshift(t),r.apply(this,n),this.name="AlgoliaSearch"+e+"Error"}return o(n,r),n}var o=n(9);o(r,Error),e.exports={AlgoliaSearchError:r,UnparsableJSON:i("UnparsableJSON","Could not parse the incoming response as JSON, see err.more for details"),RequestTimeout:i("RequestTimeout","Request timedout before getting a response"),Network:i("Network","Network issue, see err.more for details"),JSONPScriptFail:i("JSONPScriptFail","<script> was loaded but did not call our provided callback"),JSONPScriptError:i("JSONPScriptError","<script> unable to load due to an `error` event on it"),Unknown:i("Unknown","Unknown error occured")}},function(e,t,n){var r=n(18),i=n(19),o=n(40),a=o(r,i);e.exports=a},function(e){function t(e,t){for(var n=-1,r=e.length;++n<r&&t(e[n],n,e)!==!1;);return e}e.exports=t},function(e,t,n){var r=n(20),i=n(39),o=i(r);e.exports=o},function(e,t,n){function r(e,t){return i(e,t,o)}var i=n(21),o=n(25);e.exports=r},function(e,t,n){var r=n(22),i=r();e.exports=i},function(e,t,n){function r(e){return function(t,n,r){for(var o=i(t),a=r(t),s=a.length,u=e?s:-1;e?u--:++u<s;){var c=a[u];if(n(o[c],c,o)===!1)break}return t}}var i=n(23);e.exports=r},function(e,t,n){function r(e){return i(e)?e:Object(e)}var i=n(24);e.exports=r},function(e){function t(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=t},function(e,t,n){var r=n(26),i=n(30),o=n(24),a=n(34),s=r(Object,"keys"),u=s?function(e){var t=null==e?void 0:e.constructor;return"function"==typeof t&&t.prototype===e||"function"!=typeof e&&i(e)?a(e):o(e)?s(e):[]}:a;e.exports=u},function(e,t,n){function r(e,t){var n=null==e?void 0:e[t];return i(n)?n:void 0}var i=n(27);e.exports=r},function(e,t,n){function r(e){return null==e?!1:i(e)?l.test(u.call(e)):o(e)&&a.test(e)}var i=n(28),o=n(29),a=/^\[object .+?Constructor\]$/,s=Object.prototype,u=Function.prototype.toString,c=s.hasOwnProperty,l=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},function(e,t,n){function r(e){return i(e)&&s.call(e)==o}var i=n(24),o="[object Function]",a=Object.prototype,s=a.toString;e.exports=r},function(e){function t(e){return!!e&&"object"==typeof e}e.exports=t},function(e,t,n){function r(e){return null!=e&&o(i(e))}var i=n(31),o=n(33);e.exports=r},function(e,t,n){var r=n(32),i=r("length");e.exports=i},function(e){function t(e){return function(t){return null==t?void 0:t[e]}}e.exports=t},function(e){function t(e){return"number"==typeof e&&e>-1&&e%1==0&&n>=e}var n=9007199254740991;e.exports=t},function(e,t,n){function r(e){for(var t=u(e),n=t.length,r=n&&e.length,c=!!r&&s(r)&&(o(e)||i(e)),f=-1,p=[];++f<n;){var d=t[f];(c&&a(d,r)||l.call(e,d))&&p.push(d)}return p}var i=n(35),o=n(36),a=n(37),s=n(33),u=n(38),c=Object.prototype,l=c.hasOwnProperty;e.exports=r},function(e,t,n){function r(e){return o(e)&&i(e)&&s.call(e,"callee")&&!u.call(e,"callee")}var i=n(30),o=n(29),a=Object.prototype,s=a.hasOwnProperty,u=a.propertyIsEnumerable;e.exports=r},function(e,t,n){var r=n(26),i=n(33),o=n(29),a="[object Array]",s=Object.prototype,u=s.toString,c=r(Array,"isArray"),l=c||function(e){return o(e)&&i(e.length)&&u.call(e)==a};e.exports=l},function(e){function t(e,t){return e="number"==typeof e||n.test(e)?+e:-1,t=null==t?r:t,e>-1&&e%1==0&&t>e}var n=/^\d+$/,r=9007199254740991;e.exports=t},function(e,t,n){function r(e){if(null==e)return[];u(e)||(e=Object(e));var t=e.length;t=t&&s(t)&&(o(e)||i(e))&&t||0;for(var n=e.constructor,r=-1,c="function"==typeof n&&n.prototype===e,f=Array(t),p=t>0;++r<t;)f[r]=r+"";for(var d in e)p&&a(d,t)||"constructor"==d&&(c||!l.call(e,d))||f.push(d);return f}var i=n(35),o=n(36),a=n(37),s=n(33),u=n(24),c=Object.prototype,l=c.hasOwnProperty;e.exports=r},function(e,t,n){function r(e,t){return function(n,r){var s=n?i(n):0;if(!o(s))return e(n,r);for(var u=t?s:-1,c=a(n);(t?u--:++u<s)&&r(c[u],u,c)!==!1;);return n}}var i=n(31),o=n(33),a=n(23);e.exports=r},function(e,t,n){function r(e,t){return function(n,r,a){return"function"==typeof r&&void 0===a&&o(n)?e(n,r):t(n,i(r,a,3))}}var i=n(41),o=n(36);e.exports=r},function(e,t,n){function r(e,t,n){if("function"!=typeof e)return i;if(void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,o){return e.call(t,n,r,i,o)};case 5:return function(n,r,i,o,a){return e.call(t,n,r,i,o,a)}}return function(){return e.apply(t,arguments)}}var i=n(42);e.exports=r},function(e){function t(e){return e}e.exports=t},function(e,t,n){function r(e,t){return function(n,r,o){if("function"==typeof n&&"object"==typeof r||"object"==typeof o)throw new i.AlgoliaSearchError("index.search usage is index.search(query, params, cb)");0===arguments.length||"function"==typeof n?(o=n,n=""):(1===arguments.length||"function"==typeof r)&&(o=r,r=void 0),"object"==typeof n&&null!==n?(r=n,n=void 0):(void 0===n||null===n)&&(n="");var a="";return void 0!==n&&(a+=e+"="+encodeURIComponent(n)),void 0!==r&&(a=this.as._getSearchParams(r,a)),this._search(a,t,o)}}e.exports=r;var i=n(16)},function(e,t,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 i(){var e=arguments,n=this.useColors;if(e[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+e[0]+(n?"%c ":" ")+"+"+t.humanize(this.diff),!n)return e;var r="color: "+this.color;e=[e[0],r,"color: inherit"].concat(Array.prototype.slice.call(e,1));var i=0,o=0;return e[0].replace(/%[a-z%]/g,function(e){"%%"!==e&&(i++,"%c"===e&&(o=i))}),e.splice(o,0,r),e}function o(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(e){try{null==e?t.storage.removeItem("debug"):t.storage.debug=e}catch(n){}}function s(){var e;try{e=t.storage.debug}catch(n){}return e}function u(){try{return window.localStorage}catch(e){}}t=e.exports=n(45),t.log=o,t.formatArgs=i,t.save=a,t.load=s,t.useColors=r,t.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(e){return JSON.stringify(e)},t.enable(s())},function(e,t,n){function r(){return t.colors[l++%t.colors.length]}function i(e){function n(){}function i(){var e=i,n=+new Date,o=n-(c||n);e.diff=o,e.prev=c,e.curr=n,c=n,null==e.useColors&&(e.useColors=t.useColors()),null==e.color&&e.useColors&&(e.color=r());var a=Array.prototype.slice.call(arguments);a[0]=t.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var s=0;a[0]=a[0].replace(/%([a-z%])/g,function(n,r){if("%%"===n)return n;s++;var i=t.formatters[r];if("function"==typeof i){var o=a[s];n=i.call(e,o),a.splice(s,1),s--}return n}),"function"==typeof t.formatArgs&&(a=t.formatArgs.apply(e,a));var u=i.log||t.log||console.log.bind(console);u.apply(e,a)}n.enabled=!1,i.enabled=!0;var o=t.enabled(e)?i:n;return o.namespace=e,o}function o(e){t.save(e);for(var n=(e||"").split(/[\s,]+/),r=n.length,i=0;r>i;i++)n[i]&&(e=n[i].replace(/\*/g,".*?"),"-"===e[0]?t.skips.push(new RegExp("^"+e.substr(1)+"$")):t.names.push(new RegExp("^"+e+"$")))}function a(){t.enable("")}function s(e){var n,r;for(n=0,r=t.skips.length;r>n;n++)if(t.skips[n].test(e))return!1;for(n=0,r=t.names.length;r>n;n++)if(t.names[n].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}t=e.exports=i,t.coerce=u,t.disable=a,t.enable=o,t.enabled=s,t.humanize=n(46),t.names=[],t.skips=[],t.formatters={};var c,l=0},function(e){function t(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var n=parseFloat(t[1]),r=(t[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*c;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"hrs":case"hr":case"h":return n*s;case"minutes":case"minute":case"mins":case"min":case"m":return n*a;case"seconds":case"second":case"secs":case"sec":case"s":return n*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n}}}}function n(e){return e>=u?Math.round(e/u)+"d":e>=s?Math.round(e/s)+"h":e>=a?Math.round(e/a)+"m":e>=o?Math.round(e/o)+"s":e+"ms"}function r(e){return i(e,u,"day")||i(e,s,"hour")||i(e,a,"minute")||i(e,o,"second")||e+" ms"}function i(e,t,n){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+n:Math.ceil(e/t)+" "+n+"s"}var o=1e3,a=60*o,s=60*a,u=24*s,c=365.25*u;e.exports=function(e,i){return i=i||{},"string"==typeof e?t(e):i["long"]?r(e):n(e)}},function(e,t,n){function r(e,t,n,r){return t&&"boolean"!=typeof t&&a(e,t,n)?t=!1:"function"==typeof t&&(r=n,n=t,t=!1),"function"==typeof n?i(e,t,o(n,r,3)):i(e,t)}var i=n(48),o=n(41),a=n(56);e.exports=r},function(e,t,n){function r(e,t,n,h,m,v,g){var b;if(n&&(b=m?n(e,h,m):n(e)),void 0!==b)return b;if(!p(e))return e;var x=f(e);if(x){if(b=u(e),!t)return i(e,b)}else{var _=F.call(e),C=_==y;if(_!=w&&_!=d&&(!C||m))return D[_]?c(e,_,t):m?e:{};if(b=l(C?{}:e),!t)return a(b,e)}v||(v=[]),g||(g=[]);for(var $=v.length;$--;)if(v[$]==e)return g[$];return v.push(e),g.push(b),(x?o:s)(e,function(i,o){b[o]=r(i,t,n,o,e,v,g)}),b}var i=n(49),o=n(18),a=n(50),s=n(20),u=n(52),c=n(53),l=n(55),f=n(36),p=n(24),d="[object Arguments]",h="[object Array]",m="[object Boolean]",v="[object Date]",g="[object Error]",y="[object Function]",b="[object Map]",x="[object Number]",w="[object Object]",_="[object RegExp]",C="[object Set]",$="[object String]",S="[object WeakMap]",E="[object ArrayBuffer]",P="[object Float32Array]",k="[object Float64Array]",T="[object Int8Array]",O="[object Int16Array]",R="[object Int32Array]",N="[object Uint8Array]",A="[object Uint8ClampedArray]",j="[object Uint16Array]",M="[object Uint32Array]",D={};D[d]=D[h]=D[E]=D[m]=D[v]=D[P]=D[k]=D[T]=D[O]=D[R]=D[x]=D[w]=D[_]=D[$]=D[N]=D[A]=D[j]=D[M]=!0,D[g]=D[y]=D[b]=D[C]=D[S]=!1;var I=Object.prototype,F=I.toString;e.exports=r},function(e){function t(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}e.exports=t},function(e,t,n){function r(e,t){return null==t?e:i(t,o(t),e)}var i=n(51),o=n(25);e.exports=r},function(e){function t(e,t,n){n||(n={});for(var r=-1,i=t.length;++r<i;){var o=t[r];n[o]=e[o]}return n}e.exports=t},function(e){function t(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&r.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var n=Object.prototype,r=n.hasOwnProperty;e.exports=t},function(e,t,n){function r(e,t,n){var r=e.constructor;switch(t){case l:return i(e);case o:case a:return new r(+e);case f:case p:case d:case h:case m:case v:case g:case y:case b:var w=e.buffer;return new r(n?i(w):w,e.byteOffset,e.length);case s:case c:return new r(e);case u:var _=new r(e.source,x.exec(e));_.lastIndex=e.lastIndex}return _}var i=n(54),o="[object Boolean]",a="[object Date]",s="[object Number]",u="[object RegExp]",c="[object String]",l="[object ArrayBuffer]",f="[object Float32Array]",p="[object Float64Array]",d="[object Int8Array]",h="[object Int16Array]",m="[object Int32Array]",v="[object Uint8Array]",g="[object Uint8ClampedArray]",y="[object Uint16Array]",b="[object Uint32Array]",x=/\w*$/;e.exports=r},function(e,t){(function(t){function n(e){var t=new r(e.byteLength),n=new i(t);return n.set(new i(e)),t}var r=t.ArrayBuffer,i=t.Uint8Array;e.exports=n}).call(t,function(){return this}())},function(e){function t(e){var t=e.constructor;return"function"==typeof t&&t instanceof t||(t=Object),new t}e.exports=t},function(e,t,n){function r(e,t,n){if(!a(n))return!1;var r=typeof t;if("number"==r?i(n)&&o(t,n.length):"string"==r&&t in n){var s=n[t];return e===e?e===s:s!==s}return!1}var i=n(30),o=n(37),a=n(24);e.exports=r},function(e,t,n){function r(e,t,n){var r=s(e)?i:a;return t=o(t,n,3),r(e,t)}var i=n(58),o=n(59),a=n(81),s=n(36);e.exports=r},function(e){function t(e,t){for(var n=-1,r=e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}e.exports=t},function(e,t,n){function r(e,t,n){var r=typeof e;return"function"==r?void 0===t?e:a(e,t,n):null==e?s:"object"==r?i(e):void 0===t?u(e):o(e,t)}var i=n(60),o=n(72),a=n(41),s=n(42),u=n(79);e.exports=r},function(e,t,n){function r(e){var t=o(e);if(1==t.length&&t[0][2]){var n=t[0][0],r=t[0][1];return function(e){return null==e?!1:e[n]===r&&(void 0!==r||n in a(e))}}return function(e){return i(e,t)}}var i=n(61),o=n(69),a=n(23);e.exports=r},function(e,t,n){function r(e,t,n){var r=t.length,a=r,s=!n;if(null==e)return!a;for(e=o(e);r--;){var u=t[r];if(s&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++r<a;){u=t[r];var c=u[0],l=e[c],f=u[1];if(s&&u[2]){if(void 0===l&&!(c in e))return!1}else{var p=n?n(l,f,c):void 0;if(!(void 0===p?i(f,l,n,!0):p))return!1}}return!0}var i=n(62),o=n(23);e.exports=r},function(e,t,n){function r(e,t,n,s,u,c){return e===t?!0:null==e||null==t||!o(e)&&!a(t)?e!==e&&t!==t:i(e,t,r,n,s,u,c)}var i=n(63),o=n(24),a=n(29);e.exports=r},function(e,t,n){function r(e,t,n,r,p,m,v){var g=s(e),y=s(t),b=l,x=l;g||(b=h.call(e),b==c?b=f:b!=f&&(g=u(e))),y||(x=h.call(t),x==c?x=f:x!=f&&(y=u(t)));var w=b==f,_=x==f,C=b==x;if(C&&!g&&!w)return o(e,t,b);if(!p){var $=w&&d.call(e,"__wrapped__"),S=_&&d.call(t,"__wrapped__");if($||S)return n($?e.value():e,S?t.value():t,r,p,m,v)}if(!C)return!1;m||(m=[]),v||(v=[]);for(var E=m.length;E--;)if(m[E]==e)return v[E]==t;m.push(e),v.push(t);var P=(g?i:a)(e,t,n,r,p,m,v);return m.pop(),v.pop(),P}var i=n(64),o=n(66),a=n(67),s=n(36),u=n(68),c="[object Arguments]",l="[object Array]",f="[object Object]",p=Object.prototype,d=p.hasOwnProperty,h=p.toString;e.exports=r},function(e,t,n){function r(e,t,n,r,o,a,s){var u=-1,c=e.length,l=t.length;if(c!=l&&!(o&&l>c))return!1;for(;++u<c;){var f=e[u],p=t[u],d=r?r(o?p:f,o?f:p,u):void 0;if(void 0!==d){if(d)continue;return!1}if(o){if(!i(t,function(e){return f===e||n(f,e,r,o,a,s)}))return!1}else if(f!==p&&!n(f,p,r,o,a,s))return!1}return!0}var i=n(65);e.exports=r},function(e){function t(e,t){for(var n=-1,r=e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}e.exports=t},function(e){function t(e,t,u){switch(u){case n:case r:return+e==+t;case i:return e.name==t.name&&e.message==t.message;case o:return e!=+e?t!=+t:e==+t;case a:case s:return e==t+""}return!1}var n="[object Boolean]",r="[object Date]",i="[object Error]",o="[object Number]",a="[object RegExp]",s="[object String]";e.exports=t},function(e,t,n){function r(e,t,n,r,o,s,u){var c=i(e),l=c.length,f=i(t),p=f.length;if(l!=p&&!o)return!1;for(var d=l;d--;){var h=c[d];if(!(o?h in t:a.call(t,h)))return!1}for(var m=o;++d<l;){h=c[d];var v=e[h],g=t[h],y=r?r(o?g:v,o?v:g,h):void 0;if(!(void 0===y?n(v,g,r,o,s,u):y))return!1;m||(m="constructor"==h)}if(!m){var b=e.constructor,x=t.constructor;if(b!=x&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x))return!1}return!0}var i=n(25),o=Object.prototype,a=o.hasOwnProperty;e.exports=r},function(e,t,n){function r(e){return o(e)&&i(e.length)&&!!T[R.call(e)]}var i=n(33),o=n(29),a="[object Arguments]",s="[object Array]",u="[object Boolean]",c="[object Date]",l="[object Error]",f="[object Function]",p="[object Map]",d="[object Number]",h="[object Object]",m="[object RegExp]",v="[object Set]",g="[object String]",y="[object WeakMap]",b="[object ArrayBuffer]",x="[object Float32Array]",w="[object Float64Array]",_="[object Int8Array]",C="[object Int16Array]",$="[object Int32Array]",S="[object Uint8Array]",E="[object Uint8ClampedArray]",P="[object Uint16Array]",k="[object Uint32Array]",T={};T[x]=T[w]=T[_]=T[C]=T[$]=T[S]=T[E]=T[P]=T[k]=!0,T[a]=T[s]=T[b]=T[u]=T[c]=T[l]=T[f]=T[p]=T[d]=T[h]=T[m]=T[v]=T[g]=T[y]=!1;var O=Object.prototype,R=O.toString;e.exports=r},function(e,t,n){function r(e){for(var t=o(e),n=t.length;n--;)t[n][2]=i(t[n][1]);return t}var i=n(70),o=n(71);e.exports=r},function(e,t,n){function r(e){return e===e&&!i(e)}var i=n(24);e.exports=r},function(e,t,n){function r(e){e=o(e);for(var t=-1,n=i(e),r=n.length,a=Array(r);++t<r;){var s=n[t];a[t]=[s,e[s]]}return a}var i=n(25),o=n(23);e.exports=r},function(e,t,n){function r(e,t){var n=s(e),r=u(e)&&c(t),d=e+"";return e=p(e),function(s){if(null==s)return!1;var u=d;if(s=f(s),!(!n&&r||u in s)){if(s=1==e.length?s:i(s,a(e,0,-1)),null==s)return!1;u=l(e),s=f(s)}return s[u]===t?void 0!==t||u in s:o(t,s[u],void 0,!0)}}var i=n(73),o=n(62),a=n(74),s=n(36),u=n(75),c=n(70),l=n(76),f=n(23),p=n(77);e.exports=r},function(e,t,n){function r(e,t,n){if(null!=e){void 0!==n&&n in i(e)&&(t=[n]);for(var r=0,o=t.length;null!=e&&o>r;)e=e[t[r++]];return r&&r==o?e:void 0}}var i=n(23);e.exports=r},function(e){function t(e,t,n){var r=-1,i=e.length;t=null==t?0:+t||0,0>t&&(t=-t>i?0:i+t),n=void 0===n||n>i?i:+n||0,0>n&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}e.exports=t},function(e,t,n){function r(e,t){var n=typeof e;if("string"==n&&s.test(e)||"number"==n)return!0;if(i(e))return!1;var r=!a.test(e);return r||null!=t&&e in o(t)}var i=n(36),o=n(23),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=r},function(e){function t(e){var t=e?e.length:0;return t?e[t-1]:void 0}e.exports=t},function(e,t,n){function r(e){if(o(e))return e;var t=[];return i(e).replace(a,function(e,n,r,i){t.push(r?i.replace(s,"$1"):n||e)}),t}var i=n(78),o=n(36),a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,s=/\\(\\)?/g;e.exports=r},function(e){function t(e){return null==e?"":e+""}e.exports=t},function(e,t,n){function r(e){return a(e)?i(e):o(e)}var i=n(32),o=n(80),a=n(75);e.exports=r},function(e,t,n){function r(e){var t=e+"";return e=o(e),function(n){return i(n,e,t)}}var i=n(73),o=n(77);e.exports=r},function(e,t,n){function r(e,t){var n=-1,r=o(e)?Array(e.length):[];return i(e,function(e,i,o){r[++n]=t(e,i,o)}),r}var i=n(19),o=n(30);e.exports=r},function(e,t,n){var r=n(83),i=n(88),o=i(r);e.exports=o},function(e,t,n){function r(e,t,n,p,d){if(!u(e))return e;var h=s(t)&&(a(t)||l(t)),m=h?void 0:f(t);return i(m||t,function(i,a){if(m&&(a=i,i=t[a]),c(i))p||(p=[]),d||(d=[]),o(e,t,a,r,n,p,d);else{var s=e[a],u=n?n(s,i,a,e,t):void 0,l=void 0===u;l&&(u=i),void 0===u&&(!h||a in e)||!l&&(u===u?u===s:s!==s)||(e[a]=u)}}),e}var i=n(18),o=n(84),a=n(36),s=n(30),u=n(24),c=n(29),l=n(68),f=n(25);e.exports=r},function(e,t,n){function r(e,t,n,r,f,p,d){for(var h=p.length,m=t[n];h--;)if(p[h]==m)return void(e[n]=d[h]);var v=e[n],g=f?f(v,m,n,e,t):void 0,y=void 0===g;y&&(g=m,s(m)&&(a(m)||c(m))?g=a(v)?v:s(v)?i(v):[]:u(m)||o(m)?g=o(v)?l(v):u(v)?v:{}:y=!1),p.push(m),d.push(g),y?e[n]=r(g,m,f,p,d):(g===g?g!==v:v===v)&&(e[n]=g)}var i=n(49),o=n(35),a=n(36),s=n(30),u=n(85),c=n(68),l=n(87);e.exports=r},function(e,t,n){function r(e){var t;if(!a(e)||l.call(e)!=s||o(e)||!c.call(e,"constructor")&&(t=e.constructor,"function"==typeof t&&!(t instanceof t)))return!1;var n;return i(e,function(e,t){n=t}),void 0===n||c.call(e,n)}var i=n(86),o=n(35),a=n(29),s="[object Object]",u=Object.prototype,c=u.hasOwnProperty,l=u.toString;e.exports=r},function(e,t,n){function r(e,t){return i(e,t,o)}var i=n(21),o=n(38);e.exports=r},function(e,t,n){function r(e){return i(e,o(e))}var i=n(51),o=n(38);e.exports=r},function(e,t,n){function r(e){return a(function(t,n){var r=-1,a=null==t?0:n.length,s=a>2?n[a-2]:void 0,u=a>2?n[2]:void 0,c=a>1?n[a-1]:void 0;for("function"==typeof s?(s=i(s,c,5),a-=2):(s="function"==typeof c?c:void 0,a-=s?1:0),u&&o(n[0],n[1],u)&&(s=3>a?void 0:s,a=1);++r<a;){var l=n[r];l&&e(t,l,s)}return t})}var i=n(41),o=n(56),a=n(89);e.exports=r},function(e){function t(e,t){if("function"!=typeof e)throw new TypeError(n);return t=r(void 0===t?e.length-1:+t||0,0),function(){for(var n=arguments,i=-1,o=r(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];switch(t){case 0:return e.call(this,a);case 1:return e.call(this,n[0],a);case 2:return e.call(this,n[0],n[1],a)}var s=Array(t+1);for(i=-1;++i<t;)s[i]=n[i];return s[t]=a,e.apply(this,s)}}var n="Expected a function",r=Math.max;e.exports=t},function(e,t,n){"use strict";function r(){}e.exports=r;var i=n(9),o=n(91).EventEmitter;i(r,o),r.prototype.stop=function(){this._stopped=!0,this._clean()},r.prototype._end=function(){this.emit("end"),this._clean()},r.prototype._error=function(e){this.emit("error",e),this._clean()},r.prototype._result=function(e){this.emit("result",e)},r.prototype._clean=function(){this.removeAllListeners("stop"),this.removeAllListeners("end"),this.removeAllListeners("error"),this.removeAllListeners("result")}},function(e){function t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function r(e){return"number"==typeof e}function i(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=t,t.EventEmitter=t,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.prototype.setMaxListeners=function(e){if(!r(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},t.prototype.emit=function(e){var t,r,a,s,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[e],o(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(i(r))for(s=Array.prototype.slice.call(arguments,1),c=r.slice(),a=c.length,u=0;a>u;u++)c[u].apply(this,s);return!0},t.prototype.addListener=function(e,r){var a;if(!n(r))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(r.listener)?r.listener:r),this._events[e]?i(this._events[e])?this._events[e].push(r):this._events[e]=[this._events[e],r]:this._events[e]=r,i(this._events[e])&&!this._events[e].warned&&(a=o(this._maxListeners)?t.defaultMaxListeners:this._maxListeners,a&&a>0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},t.prototype.removeListener=function(e,t){var r,o,a,s;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],a=r.length,o=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(r)){for(s=a;s-->0;)if(r[s]===t||r[s].listener&&r[s].listener===t){o=s;break}if(0>o)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},t.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e,t){return e+=/\?/.test(e)?"&":"?",e+i.encode(t)}e.exports=r;var i=n(93)},function(e,t,n){"use strict";t.decode=t.parse=n(94),t.encode=t.stringify=n(95)},function(e){"use strict";function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,n,r,i){n=n||"&",r=r||"=";var o={};if("string"!=typeof e||0===e.length)return o;var a=/\+/g;e=e.split(n);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var u=e.length;s>0&&u>s&&(u=s);for(var c=0;u>c;++c){var l,f,p,d,h=e[c].replace(a,"%20"),m=h.indexOf(r);m>=0?(l=h.substr(0,m),f=h.substr(m+1)):(l=h,f=""),p=decodeURIComponent(l),d=decodeURIComponent(f),t(o,p)?Array.isArray(o[p])?o[p].push(d):o[p]=[o[p],d]:o[p]=d}return o}},function(e){"use strict";var t=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,n,r,i){return n=n||"&",r=r||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(i){var o=encodeURIComponent(t(i))+r;return Array.isArray(e[i])?e[i].map(function(e){return o+encodeURIComponent(t(e))}).join(n):o+encodeURIComponent(t(e[i]))}).join(n):i?encodeURIComponent(t(i))+r+encodeURIComponent(t(e)):""}},function(e,t,n){"use strict";function r(e,t,n){function r(){t.debug("JSONP: success"),m||f||(m=!0,l||(t.debug("JSONP: Fail. Script loaded but did not call the callback"),s(),n(new i.JSONPScriptFail)))}function a(){("loaded"===this.readyState||"complete"===this.readyState)&&r()}function s(){clearTimeout(v),d.onload=null,d.onreadystatechange=null,d.onerror=null,p.removeChild(d);try{delete window[h],delete window[h+"_loaded"]}catch(e){window[h]=null,window[h+"_loaded"]=null}}function u(){t.debug("JSONP: Script timeout"),f=!0,s(),n(new i.RequestTimeout)}function c(){t.debug("JSONP: Script error"),m||f||(s(),n(new i.JSONPScriptError))}if("GET"!==t.method)return void n(new Error("Method "+t.method+" "+e+" is not supported by JSONP."));t.debug("JSONP: start");var l=!1,f=!1;o+=1;var p=document.getElementsByTagName("head")[0],d=document.createElement("script"),h="algoliaJSONP_"+o,m=!1;window[h]=function(e){try{delete window[h]}catch(t){window[h]=void 0}f||(l=!0,s(),n(null,{body:e}))},e+="&callback="+h,t.jsonBody&&t.jsonBody.params&&(e+="&"+t.jsonBody.params);var v=setTimeout(u,t.timeout);d.onreadystatechange=a,d.onload=r,d.onerror=c,d.async=!0,d.defer=!0,d.src=e,p.appendChild(d)}e.exports=r;var i=n(16),o=0},function(e,t,n){function r(e){return function(t,r,o){var a=n(98);o=o&&a(o)||{},o.hosts=o.hosts||["places-dsn.algolia.net","places-1.algolianet.com","places-2.algolianet.com","places-3.algolianet.com"];
8
-
9
- var s=e(t,r,o),u=s.initIndex("places");return u.search=i("query","/1/places/query"),u}}e.exports=r;var i=n(43)},function(e,t,n){function r(e,t,n){return"function"==typeof t?i(e,!0,o(t,n,3)):i(e,!0)}var i=n(48),o=n(41);e.exports=r},function(e){"use strict";function t(){var e=window.document.location.protocol;return"http:"!==e&&"https:"!==e&&(e="http:"),e}e.exports=t},function(e){"use strict";e.exports="3.13.0"},function(e,t,n){"use strict";function r(e,t,n){return new i(e,t,n)}var i=n(102),o=n(103),a=n(238);r.version=n(282),r.AlgoliaSearchHelper=i,r.SearchParameters=o,r.SearchResults=a,r.url=n(272),e.exports=r},function(e,t,n){"use strict";function r(e,t,n){this.client=e;var r=n||{};r.index=t,this.state=a.make(r),this.lastResults=null,this._queryId=0,this._lastQueryIdReceived=-1}function i(e){if(0>e)throw new Error("Page requested below 0.");return this.state=this.state.setPage(e),this._change(),this}function o(){return this.state.page}var a=n(103),s=n(238),u=n(267),c=n(268),l=n(271),f=n(135),p=n(165),d=n(208),h=n(182),m=n(260),v=n(272);c.inherits(r,l.EventEmitter),r.prototype.search=function(){return this._search(),this},r.prototype.searchOnce=function(e,t){var n=this.state.setQueryParameters(e),r=u._getQueries(n.index,n);return t?this.client.search(r,function(e,r){t(e,new s(n,r),n)}):this.client.search(r).then(function(e){return{content:new s(n,e),state:n}})},r.prototype.setQuery=function(e){return this.state=this.state.setQuery(e),this._change(),this},r.prototype.clearRefinements=function(e){return this.state=this.state.clearRefinements(e),this._change(),this},r.prototype.clearTags=function(){return this.state=this.state.clearTags(),this._change(),this},r.prototype.addDisjunctiveFacetRefinement=function(e,t){return this.state=this.state.addDisjunctiveFacetRefinement(e,t),this._change(),this},r.prototype.addDisjunctiveRefine=function(){return this.addDisjunctiveFacetRefinement.apply(this,arguments)},r.prototype.addNumericRefinement=function(e,t,n){return this.state=this.state.addNumericRefinement(e,t,n),this._change(),this},r.prototype.addFacetRefinement=function(e,t){return this.state=this.state.addFacetRefinement(e,t),this._change(),this},r.prototype.addRefine=function(){return this.addFacetRefinement.apply(this,arguments)},r.prototype.addFacetExclusion=function(e,t){return this.state=this.state.addExcludeRefinement(e,t),this._change(),this},r.prototype.addExclude=function(){return this.addFacetExclusion.apply(this,arguments)},r.prototype.addTag=function(e){return this.state=this.state.addTagRefinement(e),this._change(),this},r.prototype.removeNumericRefinement=function(e,t,n){return this.state=this.state.removeNumericRefinement(e,t,n),this._change(),this},r.prototype.removeDisjunctiveFacetRefinement=function(e,t){return this.state=this.state.removeDisjunctiveFacetRefinement(e,t),this._change(),this},r.prototype.removeDisjunctiveRefine=function(){return this.removeDisjunctiveFacetRefinement.apply(this,arguments)},r.prototype.removeFacetRefinement=function(e,t){return this.state=this.state.removeFacetRefinement(e,t),this._change(),this},r.prototype.removeRefine=function(){return this.removeFacetRefinement.apply(this,arguments)},r.prototype.removeFacetExclusion=function(e,t){return this.state=this.state.removeExcludeRefinement(e,t),this._change(),this},r.prototype.removeExclude=function(){return this.removeFacetExclusion.apply(this,arguments)},r.prototype.removeTag=function(e){return this.state=this.state.removeTagRefinement(e),this._change(),this},r.prototype.toggleFacetExclusion=function(e,t){return this.state=this.state.toggleExcludeFacetRefinement(e,t),this._change(),this},r.prototype.toggleExclude=function(){return this.toggleFacetExclusion.apply(this,arguments)},r.prototype.toggleRefinement=function(e,t){return this.state=this.state.toggleRefinement(e,t),this._change(),this},r.prototype.toggleRefine=function(){return this.toggleRefinement.apply(this,arguments)},r.prototype.toggleTag=function(e){return this.state=this.state.toggleTagRefinement(e),this._change(),this},r.prototype.nextPage=function(){return this.setPage(this.state.page+1)},r.prototype.previousPage=function(){return this.setPage(this.state.page-1)},r.prototype.setCurrentPage=i,r.prototype.setPage=i,r.prototype.setIndex=function(e){return this.state=this.state.setIndex(e),this._change(),this},r.prototype.setQueryParameter=function(e,t){var n=this.state.setQueryParameter(e,t);return this.state===n?this:(this.state=n,this._change(),this)},r.prototype.setState=function(e){return this.state=new a(e),this._change(),this},r.prototype.getState=function(e){return void 0===e?this.state:this.state.filter(e)},r.prototype.getStateAsQueryString=function(e){var t=e&&e.filters||["query","attribute:*"],n=this.getState(t);return v.getQueryStringFromState(n,e)},r.getConfigurationFromQueryString=v.getStateFromQueryString,r.getForeignConfigurationInQueryString=v.getUnrecognizedParametersInQueryString,r.prototype.setStateFromQueryString=function(e,t){var n=t&&t.triggerChange||!1,r=v.getStateFromQueryString(e,t),i=this.state.setQueryParameters(r);n?this.setState(i):this.overrideStateWithoutTriggeringChangeEvent(i)},r.prototype.overrideStateWithoutTriggeringChangeEvent=function(e){return this.state=new a(e),this},r.prototype.isRefined=function(e,t){if(this.state.isConjunctiveFacet(e))return this.state.isFacetRefined(e,t);if(this.state.isDisjunctiveFacet(e))return this.state.isDisjunctiveFacetRefined(e,t);throw new Error(e+" is not properly defined in this helper configuration(use the facets or disjunctiveFacets keys to configure it)")},r.prototype.hasRefinements=function(e){return h(this.state.getNumericRefinements(e))?this.state.isConjunctiveFacet(e)?this.state.isFacetRefined(e):this.state.isDisjunctiveFacet(e)?this.state.isDisjunctiveFacetRefined(e):this.state.isHierarchicalFacet(e)?this.state.isHierarchicalFacetRefined(e):!1:!0},r.prototype.isExcluded=function(e,t){return this.state.isExcludeRefined(e,t)},r.prototype.isDisjunctiveRefined=function(e,t){return this.state.isDisjunctiveFacetRefined(e,t)},r.prototype.hasTag=function(e){return this.state.isTagRefined(e)},r.prototype.isTagRefined=function(){return this.hasTagRefinements.apply(this,arguments)},r.prototype.getIndex=function(){return this.state.index},r.prototype.getCurrentPage=o,r.prototype.getPage=o,r.prototype.getTags=function(){return this.state.tagRefinements},r.prototype.getQueryParameter=function(e){return this.state.getQueryParameter(e)},r.prototype.getRefinements=function(e){var t=[];if(this.state.isConjunctiveFacet(e)){var n=this.state.getConjunctiveRefinements(e);f(n,function(e){t.push({value:e,type:"conjunctive"})});var r=this.state.getExcludeRefinements(e);f(r,function(e){t.push({value:e,type:"exclude"})})}else if(this.state.isDisjunctiveFacet(e)){var i=this.state.getDisjunctiveRefinements(e);f(i,function(e){t.push({value:e,type:"disjunctive"})})}var o=this.state.getNumericRefinements(e);return f(o,function(e,n){t.push({value:e,operator:n,type:"numeric"})}),t},r.prototype.getNumericRefinement=function(e,t){return this.state.getNumericRefinement(e,t)},r.prototype.getHierarchicalFacetBreadcrumb=function(e){return p(this.state.getHierarchicalRefinement(e)[0].split(this.state._getHierarchicalFacetSeparator(this.state.getHierarchicalFacetByName(e))),function(e){return m(e)})},r.prototype._search=function(){var e=this.state,t=u._getQueries(e.index,e);this.emit("search",e,this.lastResults),this.client.search(t,d(this._handleResponse,this,e,this._queryId++))},r.prototype._handleResponse=function(e,t,n,r){if(!(t<this._lastQueryIdReceived)){if(this._lastQueryIdReceived=t,n)return void this.emit("error",n);var i=this.lastResults=new s(e,r);this.emit("result",i,e)}},r.prototype.containsRefinement=function(e,t,n,r){return e||0!==t.length||0!==n.length||0!==r.length},r.prototype._hasDisjunctiveRefinements=function(e){return this.state.disjunctiveRefinements[e]&&this.state.disjunctiveRefinements[e].length>0},r.prototype._change=function(){this.emit("change",this.state,this.lastResults)},e.exports=r},function(e,t,n){"use strict";function r(e,t){return x(e,function(e){return v(e,t)})}function i(e){var t=e?i._parseNumbers(e):{};this.index=t.index||"",this.query=t.query||"",this.facets=t.facets||[],this.disjunctiveFacets=t.disjunctiveFacets||[],this.hierarchicalFacets=t.hierarchicalFacets||[],this.facetsRefinements=t.facetsRefinements||{},this.facetsExcludes=t.facetsExcludes||{},this.disjunctiveFacetsRefinements=t.disjunctiveFacetsRefinements||{},this.numericRefinements=t.numericRefinements||{},this.tagRefinements=t.tagRefinements||[],this.hierarchicalFacetsRefinements=t.hierarchicalFacetsRefinements||{},this.numericFilters=t.numericFilters,this.tagFilters=t.tagFilters,this.optionalTagFilters=t.optionalTagFilters,this.optionalFacetFilters=t.optionalFacetFilters,this.hitsPerPage=t.hitsPerPage,this.maxValuesPerFacet=t.maxValuesPerFacet,this.page=t.page||0,this.queryType=t.queryType,this.typoTolerance=t.typoTolerance,this.minWordSizefor1Typo=t.minWordSizefor1Typo,this.minWordSizefor2Typos=t.minWordSizefor2Typos,this.minProximity=t.minProximity,this.allowTyposOnNumericTokens=t.allowTyposOnNumericTokens,this.ignorePlurals=t.ignorePlurals,this.restrictSearchableAttributes=t.restrictSearchableAttributes,this.advancedSyntax=t.advancedSyntax,this.analytics=t.analytics,this.analyticsTags=t.analyticsTags,this.synonyms=t.synonyms,this.replaceSynonymsInHighlight=t.replaceSynonymsInHighlight,this.optionalWords=t.optionalWords,this.removeWordsIfNoResults=t.removeWordsIfNoResults,this.attributesToRetrieve=t.attributesToRetrieve,this.attributesToHighlight=t.attributesToHighlight,this.highlightPreTag=t.highlightPreTag,this.highlightPostTag=t.highlightPostTag,this.attributesToSnippet=t.attributesToSnippet,this.getRankingInfo=t.getRankingInfo,this.distinct=t.distinct,this.aroundLatLng=t.aroundLatLng,this.aroundLatLngViaIP=t.aroundLatLngViaIP,this.aroundRadius=t.aroundRadius,this.minimumAroundRadius=t.minimumAroundRadius,this.aroundPrecision=t.aroundPrecision,this.insideBoundingBox=t.insideBoundingBox,this.insidePolygon=t.insidePolygon,this.snippetEllipsisText=t.snippetEllipsisText,this.disableExactOnAttributes=t.disableExactOnAttributes,this.enableExactOnSingleWordQuery=t.enableExactOnSingleWordQuery,this.offset=t.offset,this.length=t.length,s(t,function(e,t){if(-1===i.PARAMETERS.indexOf(t)){this[t]=e;var n="Unknown SearchParameter: `"+t+"` (this might raise an error in the Algolia API)";S(n)}},this)}var o=n(104),a=n(119),s=n(127),u=n(135),c=n(140),l=n(165),f=n(168),p=n(172),d=n(179),h=n(116),m=n(182),v=n(184),g=n(185),y=n(183),b=n(107),x=n(186),w=n(190),_=n(191),C=n(200),$=n(206),S=n(207),E=n(234),P=n(236),k=n(237);i.PARAMETERS=o(new i),i._parseNumbers=function(e){var t={},n=["aroundPrecision","aroundRadius","getRankingInfo","minWordSizefor2Typos","minWordSizefor1Typo","page","maxValuesPerFacet","distinct","minimumAroundRadius","hitsPerPage","minProximity"];if(u(n,function(n){var r=e[n];y(r)&&(t[n]=parseFloat(e[n]))}),e.numericRefinements){var r={};u(e.numericRefinements,function(e,t){r[t]={},u(e,function(e,n){var i=l(e,function(e){return h(e)?l(e,function(e){return y(e)?parseFloat(e):e}):y(e)?parseFloat(e):e});r[t][n]=i})}),t.numericRefinements=r}return C({},e,t)},i.make=function(e){var t=new i(e);return u(e.hierarchicalFacets,function(e){if(e.rootPath){var n=t.getHierarchicalRefinement(e.name);n.length>0&&0!==n[0].indexOf(e.rootPath)&&(t=t.clearRefinements(e.name)),n=t.getHierarchicalRefinement(e.name),0===n.length&&(t=t.toggleHierarchicalFacetRefinement(e.name,e.rootPath))}}),$(t)},i.validate=function(e,t){var n=t||{},r=o(n),a=c(r,function(e){return-1===i.PARAMETERS.indexOf(e)});return 1===a.length?S("Unknown parameter "+a[0]+" (this might rise an error in the Algolia API)"):a.length>1&&S("Unknown parameters "+a.join(", ")+" (this might raise an error in the Algolia API)"),e.tagFilters&&n.tagRefinements&&n.tagRefinements.length>0?new Error("[Tags] Cannot switch from the managed tag API to the advanced API. It is probably an error, if it is really what you want, you should first clear the tags with clearTags method."):e.tagRefinements.length>0&&n.tagFilters?new Error("[Tags] Cannot switch from the advanced tag API to the managed API. It is probably an error, if it is not, you should first clear the tags with clearTags method."):e.numericFilters&&n.numericRefinements&&!m(n.numericRefinements)?new Error("[Numeric filters] Can't switch from the advanced to the managed API. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):!m(e.numericRefinements)&&n.numericFilters?new Error("[Numeric filters] Can't switch from the managed API to the advanced. It is probably an error, if this is really what you want, you have to first clear the numeric filters."):null},i.prototype={constructor:i,clearRefinements:function(e){var t=k.clearRefinement;return this.setQueryParameters({page:0,numericRefinements:this._clearNumericRefinements(e),facetsRefinements:t(this.facetsRefinements,e,"conjunctiveFacet"),facetsExcludes:t(this.facetsExcludes,e,"exclude"),disjunctiveFacetsRefinements:t(this.disjunctiveFacetsRefinements,e,"disjunctiveFacet"),hierarchicalFacetsRefinements:t(this.hierarchicalFacetsRefinements,e,"hierarchicalFacet")})},clearTags:function(){return void 0===this.tagFilters&&0===this.tagRefinements.length?this:this.setQueryParameters({page:0,tagFilters:void 0,tagRefinements:[]})},setIndex:function(e){return e===this.index?this:this.setQueryParameters({index:e,page:0})},setQuery:function(e){return e===this.query?this:this.setQueryParameters({query:e,page:0})},setPage:function(e){return e===this.page?this:this.setQueryParameters({page:e})},setFacets:function(e){return this.setQueryParameters({facets:e})},setDisjunctiveFacets:function(e){return this.setQueryParameters({disjunctiveFacets:e})},setHitsPerPage:function(e){return this.hitsPerPage===e?this:this.setQueryParameters({hitsPerPage:e,page:0})},setTypoTolerance:function(e){return this.typoTolerance===e?this:this.setQueryParameters({typoTolerance:e,page:0})},addNumericRefinement:function(e,t,n){var r=E(n);if(this.isNumericRefined(e,t,r))return this;var i=C({},this.numericRefinements);return i[e]=C({},i[e]),i[e][t]?(i[e][t]=i[e][t].slice(),i[e][t].push(r)):i[e][t]=[r],this.setQueryParameters({page:0,numericRefinements:i})},getConjunctiveRefinements:function(e){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.facetsRefinements[e]||[]},getDisjunctiveRefinements:function(e){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.disjunctiveFacetsRefinements[e]||[]},getHierarchicalRefinement:function(e){return this.hierarchicalFacetsRefinements[e]||[]},getExcludeRefinements:function(e){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.facetsExcludes[e]||[]},removeNumericRefinement:function(e,t,n){if(void 0!==n){var r=E(n);return this.isNumericRefined(e,t,r)?this.setQueryParameters({page:0,numericRefinements:this._clearNumericRefinements(function(n,i){return i===e&&n.op===t&&v(n.val,r)})}):this}return void 0!==t?this.isNumericRefined(e,t)?this.setQueryParameters({page:0,numericRefinements:this._clearNumericRefinements(function(n,r){return r===e&&n.op===t})}):this:this.isNumericRefined(e)?this.setQueryParameters({page:0,numericRefinements:this._clearNumericRefinements(function(t,n){return n===e})}):this},getNumericRefinements:function(e){return this.numericRefinements[e]||{}},getNumericRefinement:function(e,t){return this.numericRefinements[e]&&this.numericRefinements[e][t]},_clearNumericRefinements:function(e){return g(e)?{}:y(e)?p(this.numericRefinements,e):b(e)?f(this.numericRefinements,function(t,n,r){var i={};return u(n,function(t,n){var o=[];u(t,function(t){var i=e({val:t,op:n},r,"numeric");i||o.push(t)}),m(o)||(i[n]=o)}),m(i)||(t[r]=i),t},{}):void 0},addFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return k.isRefined(this.facetsRefinements,e,t)?this:this.setQueryParameters({page:0,facetsRefinements:k.addRefinement(this.facetsRefinements,e,t)})},addExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return k.isRefined(this.facetsExcludes,e,t)?this:this.setQueryParameters({page:0,facetsExcludes:k.addRefinement(this.facetsExcludes,e,t)})},addDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return k.isRefined(this.disjunctiveFacetsRefinements,e,t)?this:this.setQueryParameters({page:0,disjunctiveFacetsRefinements:k.addRefinement(this.disjunctiveFacetsRefinements,e,t)})},addTagRefinement:function(e){if(this.isTagRefined(e))return this;var t={page:0,tagRefinements:this.tagRefinements.concat(e)};return this.setQueryParameters(t)},removeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return k.isRefined(this.facetsRefinements,e,t)?this.setQueryParameters({page:0,facetsRefinements:k.removeRefinement(this.facetsRefinements,e,t)}):this},removeExcludeRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return k.isRefined(this.facetsExcludes,e,t)?this.setQueryParameters({page:0,facetsExcludes:k.removeRefinement(this.facetsExcludes,e,t)}):this},removeDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return k.isRefined(this.disjunctiveFacetsRefinements,e,t)?this.setQueryParameters({page:0,disjunctiveFacetsRefinements:k.removeRefinement(this.disjunctiveFacetsRefinements,e,t)}):this},removeTagRefinement:function(e){if(!this.isTagRefined(e))return this;var t={page:0,tagRefinements:c(this.tagRefinements,function(t){return t!==e})};return this.setQueryParameters(t)},toggleRefinement:function(e,t){if(this.isHierarchicalFacet(e))return this.toggleHierarchicalFacetRefinement(e,t);if(this.isConjunctiveFacet(e))return this.toggleFacetRefinement(e,t);if(this.isDisjunctiveFacet(e))return this.toggleDisjunctiveFacetRefinement(e,t);throw new Error("Cannot refine the undeclared facet "+e+"; it should be added to the helper options facets, disjunctiveFacets or hierarchicalFacets")},toggleFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({page:0,facetsRefinements:k.toggleRefinement(this.facetsRefinements,e,t)})},toggleExcludeFacetRefinement:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return this.setQueryParameters({page:0,facetsExcludes:k.toggleRefinement(this.facetsExcludes,e,t)})},toggleDisjunctiveFacetRefinement:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return this.setQueryParameters({page:0,disjunctiveFacetsRefinements:k.toggleRefinement(this.disjunctiveFacetsRefinements,e,t)})},toggleHierarchicalFacetRefinement:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var n=this._getHierarchicalFacetSeparator(this.getHierarchicalFacetByName(e)),r={},i=void 0!==this.hierarchicalFacetsRefinements[e]&&this.hierarchicalFacetsRefinements[e].length>0&&(this.hierarchicalFacetsRefinements[e][0]===t||0===this.hierarchicalFacetsRefinements[e][0].indexOf(t+n));return r[e]=i?-1===t.indexOf(n)?[]:[t.slice(0,t.lastIndexOf(n))]:[t],this.setQueryParameters({page:0,hierarchicalFacetsRefinements:_({},r,this.hierarchicalFacetsRefinements)})},toggleTagRefinement:function(e){return this.isTagRefined(e)?this.removeTagRefinement(e):this.addTagRefinement(e)},isDisjunctiveFacet:function(e){return d(this.disjunctiveFacets,e)>-1},isHierarchicalFacet:function(e){return void 0!==this.getHierarchicalFacetByName(e)},isConjunctiveFacet:function(e){return d(this.facets,e)>-1},isFacetRefined:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return k.isRefined(this.facetsRefinements,e,t)},isExcludeRefined:function(e,t){if(!this.isConjunctiveFacet(e))throw new Error(e+" is not defined in the facets attribute of the helper configuration");return k.isRefined(this.facetsExcludes,e,t)},isDisjunctiveFacetRefined:function(e,t){if(!this.isDisjunctiveFacet(e))throw new Error(e+" is not defined in the disjunctiveFacets attribute of the helper configuration");return k.isRefined(this.disjunctiveFacetsRefinements,e,t)},isHierarchicalFacetRefined:function(e,t){if(!this.isHierarchicalFacet(e))throw new Error(e+" is not defined in the hierarchicalFacets attribute of the helper configuration");var n=this.getHierarchicalRefinement(e);return t?-1!==d(n,t):n.length>0},isNumericRefined:function(e,t,n){if(g(n)&&g(t))return!!this.numericRefinements[e];var i=this.numericRefinements[e]&&!g(this.numericRefinements[e][t]);if(g(n)||!i)return i;var o=E(n),a=!g(r(this.numericRefinements[e][t],o));return i&&a},isTagRefined:function(e){return-1!==d(this.tagRefinements,e)},getRefinedDisjunctiveFacets:function(){var e=a(o(this.numericRefinements),this.disjunctiveFacets);return o(this.disjunctiveFacetsRefinements).concat(e).concat(this.getRefinedHierarchicalFacets())},getRefinedHierarchicalFacets:function(){return a(w(this.hierarchicalFacets,"name"),o(this.hierarchicalFacetsRefinements))},getUnrefinedDisjunctiveFacets:function(){var e=this.getRefinedDisjunctiveFacets();return c(this.disjunctiveFacets,function(t){return-1===d(e,t)})},managedParameters:["index","facets","disjunctiveFacets","facetsRefinements","facetsExcludes","disjunctiveFacetsRefinements","numericRefinements","tagRefinements","hierarchicalFacets","hierarchicalFacetsRefinements"],getQueryParams:function(){var e=this.managedParameters,t={};return s(this,function(n,r){-1===d(e,r)&&void 0!==n&&(t[r]=n)}),t},getQueryParameter:function(e){if(!this.hasOwnProperty(e))throw new Error("Parameter '"+e+"' is not an attribute of SearchParameters (http://algolia.github.io/algoliasearch-helper-js/docs/SearchParameters.html)");return this[e]},setQueryParameter:function(e,t){if(this[e]===t)return this;var n={};return n[e]=t,this.setQueryParameters(n)},setQueryParameters:function(e){var t=i.validate(this,e);if(t)throw t;var n=i._parseNumbers(e);return this.mutateMe(function(t){var r=o(e);return u(r,function(e){t[e]=n[e]}),t})},filter:function(e){return P(this,e)},mutateMe:function(e){var t=new this.constructor(this);return e(t,this),$(t)},_getHierarchicalFacetSortBy:function(e){return e.sortBy||["isRefined:desc","name:asc"]},_getHierarchicalFacetSeparator:function(e){return e.separator||" > "},_getHierarchicalRootPath:function(e){return e.rootPath||null},_getHierarchicalShowParentLevel:function(e){return"boolean"==typeof e.showParentLevel?e.showParentLevel:!0},getHierarchicalFacetByName:function(e){return x(this.hierarchicalFacets,{name:e})}},e.exports=i},function(e,t,n){var r=n(105),i=n(110),o=n(108),a=n(114),s=r(Object,"keys"),u=s?function(e){var t=null==e?void 0:e.constructor;return"function"==typeof t&&t.prototype===e||"function"!=typeof e&&i(e)?a(e):o(e)?s(e):[]}:a;e.exports=u},function(e,t,n){function r(e,t){var n=null==e?void 0:e[t];return i(n)?n:void 0}var i=n(106);e.exports=r},function(e,t,n){function r(e){return null==e?!1:i(e)?l.test(u.call(e)):o(e)&&a.test(e)}var i=n(107),o=n(109),a=/^\[object .+?Constructor\]$/,s=Object.prototype,u=Function.prototype.toString,c=s.hasOwnProperty,l=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},function(e,t,n){function r(e){return i(e)&&s.call(e)==o}var i=n(108),o="[object Function]",a=Object.prototype,s=a.toString;e.exports=r},function(e){function t(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}e.exports=t},function(e){function t(e){return!!e&&"object"==typeof e}e.exports=t},function(e,t,n){function r(e){return null!=e&&o(i(e))}var i=n(111),o=n(113);e.exports=r},function(e,t,n){var r=n(112),i=r("length");e.exports=i},function(e){function t(e){return function(t){return null==t?void 0:t[e]}}e.exports=t},function(e){function t(e){return"number"==typeof e&&e>-1&&e%1==0&&n>=e}var n=9007199254740991;e.exports=t},function(e,t,n){function r(e){for(var t=u(e),n=t.length,r=n&&e.length,c=!!r&&s(r)&&(o(e)||i(e)),f=-1,p=[];++f<n;){var d=t[f];(c&&a(d,r)||l.call(e,d))&&p.push(d)}return p}var i=n(115),o=n(116),a=n(117),s=n(113),u=n(118),c=Object.prototype,l=c.hasOwnProperty;e.exports=r},function(e,t,n){function r(e){return o(e)&&i(e)&&s.call(e,"callee")&&!u.call(e,"callee")}var i=n(110),o=n(109),a=Object.prototype,s=a.hasOwnProperty,u=a.propertyIsEnumerable;e.exports=r},function(e,t,n){var r=n(105),i=n(113),o=n(109),a="[object Array]",s=Object.prototype,u=s.toString,c=r(Array,"isArray"),l=c||function(e){return o(e)&&i(e.length)&&u.call(e)==a};e.exports=l},function(e){function t(e,t){return e="number"==typeof e||n.test(e)?+e:-1,t=null==t?r:t,e>-1&&e%1==0&&t>e}var n=/^\d+$/,r=9007199254740991;e.exports=t},function(e,t,n){function r(e){if(null==e)return[];u(e)||(e=Object(e));var t=e.length;t=t&&s(t)&&(o(e)||i(e))&&t||0;for(var n=e.constructor,r=-1,c="function"==typeof n&&n.prototype===e,f=Array(t),p=t>0;++r<t;)f[r]=r+"";for(var d in e)p&&a(d,t)||"constructor"==d&&(c||!l.call(e,d))||f.push(d);return f}var i=n(115),o=n(116),a=n(117),s=n(113),u=n(108),c=Object.prototype,l=c.hasOwnProperty;e.exports=r},function(e,t,n){var r=n(120),i=n(122),o=n(123),a=n(110),s=n(126),u=s(function(e){for(var t=e.length,n=t,s=Array(h),u=r,c=!0,l=[];n--;){var f=e[n]=a(f=e[n])?f:[];s[n]=c&&f.length>=120?o(n&&f):null}var p=e[0],d=-1,h=p?p.length:0,m=s[0];e:for(;++d<h;)if(f=p[d],(m?i(m,f):u(l,f,0))<0){for(var n=t;--n;){var v=s[n];if((v?i(v,f):u(e[n],f,0))<0)continue e}m&&m.push(f),l.push(f)}return l});e.exports=u},function(e,t,n){function r(e,t,n){if(t!==t)return i(e,n);for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}var i=n(121);e.exports=r},function(e){function t(e,t,n){for(var r=e.length,i=t+(n?0:-1);n?i--:++i<r;){var o=e[i];if(o!==o)return i}return-1}e.exports=t},function(e,t,n){function r(e,t){var n=e.data,r="string"==typeof t||i(t)?n.set.has(t):n.hash[t];return r?0:-1}var i=n(108);e.exports=r},function(e,t,n){(function(t){function r(e){return s&&a?new i(e):null}var i=n(124),o=n(105),a=o(t,"Set"),s=o(Object,"create");e.exports=r}).call(t,function(){return this}())},function(e,t,n){(function(t){function r(e){var t=e?e.length:0;for(this.data={hash:s(null),set:new a};t--;)this.push(e[t])}var i=n(125),o=n(105),a=o(t,"Set"),s=o(Object,"create");r.prototype.push=i,e.exports=r}).call(t,function(){return this}())},function(e,t,n){function r(e){var t=this.data;"string"==typeof e||i(e)?t.set.add(e):t.hash[e]=!0}var i=n(108);e.exports=r},function(e){function t(e,t){if("function"!=typeof e)throw new TypeError(n);return t=r(void 0===t?e.length-1:+t||0,0),function(){for(var n=arguments,i=-1,o=r(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];switch(t){case 0:return e.call(this,a);case 1:return e.call(this,n[0],a);case 2:return e.call(this,n[0],n[1],a)}var s=Array(t+1);for(i=-1;++i<t;)s[i]=n[i];return s[t]=a,e.apply(this,s)}}var n="Expected a function",r=Math.max;e.exports=t},function(e,t,n){var r=n(128),i=n(132),o=i(r);e.exports=o},function(e,t,n){function r(e,t){return i(e,t,o)}var i=n(129),o=n(104);e.exports=r},function(e,t,n){var r=n(130),i=r();e.exports=i},function(e,t,n){function r(e){return function(t,n,r){for(var o=i(t),a=r(t),s=a.length,u=e?s:-1;e?u--:++u<s;){var c=a[u];if(n(o[c],c,o)===!1)break}return t}}var i=n(131);e.exports=r},function(e,t,n){function r(e){return i(e)?e:Object(e)}var i=n(108);e.exports=r},function(e,t,n){function r(e){return function(t,n,r){return("function"!=typeof n||void 0!==r)&&(n=i(n,r,3)),e(t,n)}}var i=n(133);e.exports=r},function(e,t,n){function r(e,t,n){if("function"!=typeof e)return i;if(void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,o){return e.call(t,n,r,i,o)};case 5:return function(n,r,i,o,a){return e.call(t,n,r,i,o,a)}}return function(){return e.apply(t,arguments)}}var i=n(134);e.exports=r},function(e){function t(e){return e}e.exports=t},function(e,t,n){var r=n(136),i=n(137),o=n(139),a=o(r,i);e.exports=a},function(e){function t(e,t){for(var n=-1,r=e.length;++n<r&&t(e[n],n,e)!==!1;);return e}e.exports=t},function(e,t,n){var r=n(128),i=n(138),o=i(r);e.exports=o},function(e,t,n){function r(e,t){return function(n,r){var s=n?i(n):0;if(!o(s))return e(n,r);for(var u=t?s:-1,c=a(n);(t?u--:++u<s)&&r(c[u],u,c)!==!1;);return n}}var i=n(111),o=n(113),a=n(131);e.exports=r},function(e,t,n){function r(e,t){return function(n,r,a){return"function"==typeof r&&void 0===a&&o(n)?e(n,r):t(n,i(r,a,3))}}var i=n(133),o=n(116);e.exports=r},function(e,t,n){function r(e,t,n){var r=s(e)?i:a;return t=o(t,n,3),r(e,t)}var i=n(141),o=n(142),a=n(164),s=n(116);e.exports=r},function(e){function t(e,t){for(var n=-1,r=e.length,i=-1,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[++i]=a)}return o}e.exports=t},function(e,t,n){function r(e,t,n){var r=typeof e;return"function"==r?void 0===t?e:a(e,t,n):null==e?s:"object"==r?i(e):void 0===t?u(e):o(e,t)}var i=n(143),o=n(155),a=n(133),s=n(134),u=n(162);e.exports=r},function(e,t,n){function r(e){var t=o(e);if(1==t.length&&t[0][2]){var n=t[0][0],r=t[0][1];return function(e){return null==e?!1:e[n]===r&&(void 0!==r||n in a(e))}}return function(e){return i(e,t)}}var i=n(144),o=n(152),a=n(131);e.exports=r},function(e,t,n){function r(e,t,n){var r=t.length,a=r,s=!n;if(null==e)return!a;for(e=o(e);r--;){var u=t[r];if(s&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++r<a;){u=t[r];var c=u[0],l=e[c],f=u[1];if(s&&u[2]){if(void 0===l&&!(c in e))return!1}else{var p=n?n(l,f,c):void 0;if(!(void 0===p?i(f,l,n,!0):p))return!1}}return!0}var i=n(145),o=n(131);e.exports=r},function(e,t,n){function r(e,t,n,s,u,c){return e===t?!0:null==e||null==t||!o(e)&&!a(t)?e!==e&&t!==t:i(e,t,r,n,s,u,c)}var i=n(146),o=n(108),a=n(109);e.exports=r},function(e,t,n){function r(e,t,n,r,p,m,v){var g=s(e),y=s(t),b=l,x=l;g||(b=h.call(e),b==c?b=f:b!=f&&(g=u(e))),y||(x=h.call(t),x==c?x=f:x!=f&&(y=u(t)));var w=b==f,_=x==f,C=b==x;if(C&&!g&&!w)return o(e,t,b);if(!p){var $=w&&d.call(e,"__wrapped__"),S=_&&d.call(t,"__wrapped__");if($||S)return n($?e.value():e,S?t.value():t,r,p,m,v)}if(!C)return!1;m||(m=[]),v||(v=[]);for(var E=m.length;E--;)if(m[E]==e)return v[E]==t;m.push(e),v.push(t);var P=(g?i:a)(e,t,n,r,p,m,v);return m.pop(),v.pop(),P}var i=n(147),o=n(149),a=n(150),s=n(116),u=n(151),c="[object Arguments]",l="[object Array]",f="[object Object]",p=Object.prototype,d=p.hasOwnProperty,h=p.toString;e.exports=r},function(e,t,n){function r(e,t,n,r,o,a,s){var u=-1,c=e.length,l=t.length;if(c!=l&&!(o&&l>c))return!1;for(;++u<c;){var f=e[u],p=t[u],d=r?r(o?p:f,o?f:p,u):void 0;if(void 0!==d){if(d)continue;return!1}if(o){if(!i(t,function(e){return f===e||n(f,e,r,o,a,s)}))return!1}else if(f!==p&&!n(f,p,r,o,a,s))return!1}return!0}var i=n(148);e.exports=r},function(e){function t(e,t){for(var n=-1,r=e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}e.exports=t},function(e){function t(e,t,u){switch(u){case n:case r:return+e==+t;case i:return e.name==t.name&&e.message==t.message;case o:return e!=+e?t!=+t:e==+t;
10
-
11
- case a:case s:return e==t+""}return!1}var n="[object Boolean]",r="[object Date]",i="[object Error]",o="[object Number]",a="[object RegExp]",s="[object String]";e.exports=t},function(e,t,n){function r(e,t,n,r,o,s,u){var c=i(e),l=c.length,f=i(t),p=f.length;if(l!=p&&!o)return!1;for(var d=l;d--;){var h=c[d];if(!(o?h in t:a.call(t,h)))return!1}for(var m=o;++d<l;){h=c[d];var v=e[h],g=t[h],y=r?r(o?g:v,o?v:g,h):void 0;if(!(void 0===y?n(v,g,r,o,s,u):y))return!1;m||(m="constructor"==h)}if(!m){var b=e.constructor,x=t.constructor;if(b!=x&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x))return!1}return!0}var i=n(104),o=Object.prototype,a=o.hasOwnProperty;e.exports=r},function(e,t,n){function r(e){return o(e)&&i(e.length)&&!!T[R.call(e)]}var i=n(113),o=n(109),a="[object Arguments]",s="[object Array]",u="[object Boolean]",c="[object Date]",l="[object Error]",f="[object Function]",p="[object Map]",d="[object Number]",h="[object Object]",m="[object RegExp]",v="[object Set]",g="[object String]",y="[object WeakMap]",b="[object ArrayBuffer]",x="[object Float32Array]",w="[object Float64Array]",_="[object Int8Array]",C="[object Int16Array]",$="[object Int32Array]",S="[object Uint8Array]",E="[object Uint8ClampedArray]",P="[object Uint16Array]",k="[object Uint32Array]",T={};T[x]=T[w]=T[_]=T[C]=T[$]=T[S]=T[E]=T[P]=T[k]=!0,T[a]=T[s]=T[b]=T[u]=T[c]=T[l]=T[f]=T[p]=T[d]=T[h]=T[m]=T[v]=T[g]=T[y]=!1;var O=Object.prototype,R=O.toString;e.exports=r},function(e,t,n){function r(e){for(var t=o(e),n=t.length;n--;)t[n][2]=i(t[n][1]);return t}var i=n(153),o=n(154);e.exports=r},function(e,t,n){function r(e){return e===e&&!i(e)}var i=n(108);e.exports=r},function(e,t,n){function r(e){e=o(e);for(var t=-1,n=i(e),r=n.length,a=Array(r);++t<r;){var s=n[t];a[t]=[s,e[s]]}return a}var i=n(104),o=n(131);e.exports=r},function(e,t,n){function r(e,t){var n=s(e),r=u(e)&&c(t),d=e+"";return e=p(e),function(s){if(null==s)return!1;var u=d;if(s=f(s),!(!n&&r||u in s)){if(s=1==e.length?s:i(s,a(e,0,-1)),null==s)return!1;u=l(e),s=f(s)}return s[u]===t?void 0!==t||u in s:o(t,s[u],void 0,!0)}}var i=n(156),o=n(145),a=n(157),s=n(116),u=n(158),c=n(153),l=n(159),f=n(131),p=n(160);e.exports=r},function(e,t,n){function r(e,t,n){if(null!=e){void 0!==n&&n in i(e)&&(t=[n]);for(var r=0,o=t.length;null!=e&&o>r;)e=e[t[r++]];return r&&r==o?e:void 0}}var i=n(131);e.exports=r},function(e){function t(e,t,n){var r=-1,i=e.length;t=null==t?0:+t||0,0>t&&(t=-t>i?0:i+t),n=void 0===n||n>i?i:+n||0,0>n&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}e.exports=t},function(e,t,n){function r(e,t){var n=typeof e;if("string"==n&&s.test(e)||"number"==n)return!0;if(i(e))return!1;var r=!a.test(e);return r||null!=t&&e in o(t)}var i=n(116),o=n(131),a=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,s=/^\w*$/;e.exports=r},function(e){function t(e){var t=e?e.length:0;return t?e[t-1]:void 0}e.exports=t},function(e,t,n){function r(e){if(o(e))return e;var t=[];return i(e).replace(a,function(e,n,r,i){t.push(r?i.replace(s,"$1"):n||e)}),t}var i=n(161),o=n(116),a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,s=/\\(\\)?/g;e.exports=r},function(e){function t(e){return null==e?"":e+""}e.exports=t},function(e,t,n){function r(e){return a(e)?i(e):o(e)}var i=n(112),o=n(163),a=n(158);e.exports=r},function(e,t,n){function r(e){var t=e+"";return e=o(e),function(n){return i(n,e,t)}}var i=n(156),o=n(160);e.exports=r},function(e,t,n){function r(e,t){var n=[];return i(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}var i=n(137);e.exports=r},function(e,t,n){function r(e,t,n){var r=s(e)?i:a;return t=o(t,n,3),r(e,t)}var i=n(166),o=n(142),a=n(167),s=n(116);e.exports=r},function(e){function t(e,t){for(var n=-1,r=e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}e.exports=t},function(e,t,n){function r(e,t){var n=-1,r=o(e)?Array(e.length):[];return i(e,function(e,i,o){r[++n]=t(e,i,o)}),r}var i=n(137),o=n(110);e.exports=r},function(e,t,n){var r=n(169),i=n(137),o=n(170),a=o(r,i);e.exports=a},function(e){function t(e,t,n,r){var i=-1,o=e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}e.exports=t},function(e,t,n){function r(e,t){return function(n,r,s,u){var c=arguments.length<3;return"function"==typeof r&&void 0===u&&a(n)?e(n,r,s,c):o(n,i(r,u,4),s,c,t)}}var i=n(142),o=n(171),a=n(116);e.exports=r},function(e){function t(e,t,n,r,i){return i(e,function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)}),n}e.exports=t},function(e,t,n){var r=n(166),i=n(173),o=n(174),a=n(133),s=n(118),u=n(176),c=n(177),l=n(126),f=l(function(e,t){if(null==e)return{};if("function"!=typeof t[0]){var t=r(o(t),String);return u(e,i(s(e),t))}var n=a(t[0],t[1],3);return c(e,function(e,t,r){return!n(e,t,r)})});e.exports=f},function(e,t,n){function r(e,t){var n=e?e.length:0,r=[];if(!n)return r;var u=-1,c=i,l=!0,f=l&&t.length>=s?a(t):null,p=t.length;f&&(c=o,l=!1,t=f);e:for(;++u<n;){var d=e[u];if(l&&d===d){for(var h=p;h--;)if(t[h]===d)continue e;r.push(d)}else c(t,d,0)<0&&r.push(d)}return r}var i=n(120),o=n(122),a=n(123),s=200;e.exports=r},function(e,t,n){function r(e,t,n,c){c||(c=[]);for(var l=-1,f=e.length;++l<f;){var p=e[l];u(p)&&s(p)&&(n||a(p)||o(p))?t?r(p,t,n,c):i(c,p):n||(c[c.length]=p)}return c}var i=n(175),o=n(115),a=n(116),s=n(110),u=n(109);e.exports=r},function(e){function t(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}e.exports=t},function(e,t,n){function r(e,t){e=i(e);for(var n=-1,r=t.length,o={};++n<r;){var a=t[n];a in e&&(o[a]=e[a])}return o}var i=n(131);e.exports=r},function(e,t,n){function r(e,t){var n={};return i(e,function(e,r,i){t(e,r,i)&&(n[r]=e)}),n}var i=n(178);e.exports=r},function(e,t,n){function r(e,t){return i(e,t,o)}var i=n(129),o=n(118);e.exports=r},function(e,t,n){function r(e,t,n){var r=e?e.length:0;if(!r)return-1;if("number"==typeof n)n=0>n?a(r+n,0):n;else if(n){var s=o(e,t);return r>s&&(t===t?t===e[s]:e[s]!==e[s])?s:-1}return i(e,t,n||0)}var i=n(120),o=n(180),a=Math.max;e.exports=r},function(e,t,n){function r(e,t,n){var r=0,a=e?e.length:r;if("number"==typeof t&&t===t&&s>=a){for(;a>r;){var u=r+a>>>1,c=e[u];(n?t>=c:t>c)&&null!==c?r=u+1:a=u}return a}return i(e,t,o,n)}var i=n(181),o=n(134),a=4294967295,s=a>>>1;e.exports=r},function(e){function t(e,t,i,a){t=i(t);for(var s=0,u=e?e.length:0,c=t!==t,l=null===t,f=void 0===t;u>s;){var p=n((s+u)/2),d=i(e[p]),h=void 0!==d,m=d===d;if(c)var v=m||a;else v=l?m&&h&&(a||null!=d):f?m&&(a||h):null==d?!1:a?t>=d:t>d;v?s=p+1:u=p}return r(u,o)}var n=Math.floor,r=Math.min,i=4294967295,o=i-1;e.exports=t},function(e,t,n){function r(e){return null==e?!0:a(e)&&(o(e)||c(e)||i(e)||u(e)&&s(e.splice))?!e.length:!l(e).length}var i=n(115),o=n(116),a=n(110),s=n(107),u=n(109),c=n(183),l=n(104);e.exports=r},function(e,t,n){function r(e){return"string"==typeof e||i(e)&&s.call(e)==o}var i=n(109),o="[object String]",a=Object.prototype,s=a.toString;e.exports=r},function(e,t,n){function r(e,t,n,r){n="function"==typeof n?o(n,r,3):void 0;var a=n?n(e,t):void 0;return void 0===a?i(e,t,n):!!a}var i=n(145),o=n(133);e.exports=r},function(e){function t(e){return void 0===e}e.exports=t},function(e,t,n){var r=n(137),i=n(187),o=i(r);e.exports=o},function(e,t,n){function r(e,t){return function(n,r,u){if(r=i(r,u,3),s(n)){var c=a(n,r,t);return c>-1?n[c]:void 0}return o(n,r,e)}}var i=n(142),o=n(188),a=n(189),s=n(116);e.exports=r},function(e){function t(e,t,n,r){var i;return n(e,function(e,n,o){return t(e,n,o)?(i=r?n:e,!1):void 0}),i}e.exports=t},function(e){function t(e,t,n){for(var r=e.length,i=n?r:-1;n?i--:++i<r;)if(t(e[i],i,e))return i;return-1}e.exports=t},function(e,t,n){function r(e,t){return i(e,o(t))}var i=n(165),o=n(162);e.exports=r},function(e,t,n){var r=n(192),i=n(198),o=n(199),a=o(r,i);e.exports=a},function(e,t,n){var r=n(193),i=n(194),o=n(196),a=o(function(e,t,n){return n?r(e,t,n):i(e,t)});e.exports=a},function(e,t,n){function r(e,t,n){for(var r=-1,o=i(t),a=o.length;++r<a;){var s=o[r],u=e[s],c=n(u,t[s],s,e,t);(c===c?c===u:u!==u)&&(void 0!==u||s in e)||(e[s]=c)}return e}var i=n(104);e.exports=r},function(e,t,n){function r(e,t){return null==t?e:i(t,o(t),e)}var i=n(195),o=n(104);e.exports=r},function(e){function t(e,t,n){n||(n={});for(var r=-1,i=t.length;++r<i;){var o=t[r];n[o]=e[o]}return n}e.exports=t},function(e,t,n){function r(e){return a(function(t,n){var r=-1,a=null==t?0:n.length,s=a>2?n[a-2]:void 0,u=a>2?n[2]:void 0,c=a>1?n[a-1]:void 0;for("function"==typeof s?(s=i(s,c,5),a-=2):(s="function"==typeof c?c:void 0,a-=s?1:0),u&&o(n[0],n[1],u)&&(s=3>a?void 0:s,a=1);++r<a;){var l=n[r];l&&e(t,l,s)}return t})}var i=n(133),o=n(197),a=n(126);e.exports=r},function(e,t,n){function r(e,t,n){if(!a(n))return!1;var r=typeof t;if("number"==r?i(n)&&o(t,n.length):"string"==r&&t in n){var s=n[t];return e===e?e===s:s!==s}return!1}var i=n(110),o=n(117),a=n(108);e.exports=r},function(e){function t(e,t){return void 0===e?t:e}e.exports=t},function(e,t,n){function r(e,t){return i(function(n){var r=n[0];return null==r?r:(n.push(t),e.apply(void 0,n))})}var i=n(126);e.exports=r},function(e,t,n){var r=n(201),i=n(196),o=i(r);e.exports=o},function(e,t,n){function r(e,t,n,p,d){if(!u(e))return e;var h=s(t)&&(a(t)||l(t)),m=h?void 0:f(t);return i(m||t,function(i,a){if(m&&(a=i,i=t[a]),c(i))p||(p=[]),d||(d=[]),o(e,t,a,r,n,p,d);else{var s=e[a],u=n?n(s,i,a,e,t):void 0,l=void 0===u;l&&(u=i),void 0===u&&(!h||a in e)||!l&&(u===u?u===s:s!==s)||(e[a]=u)}}),e}var i=n(136),o=n(202),a=n(116),s=n(110),u=n(108),c=n(109),l=n(151),f=n(104);e.exports=r},function(e,t,n){function r(e,t,n,r,f,p,d){for(var h=p.length,m=t[n];h--;)if(p[h]==m)return void(e[n]=d[h]);var v=e[n],g=f?f(v,m,n,e,t):void 0,y=void 0===g;y&&(g=m,s(m)&&(a(m)||c(m))?g=a(v)?v:s(v)?i(v):[]:u(m)||o(m)?g=o(v)?l(v):u(v)?v:{}:y=!1),p.push(m),d.push(g),y?e[n]=r(g,m,f,p,d):(g===g?g!==v:v===v)&&(e[n]=g)}var i=n(203),o=n(115),a=n(116),s=n(110),u=n(204),c=n(151),l=n(205);e.exports=r},function(e){function t(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}e.exports=t},function(e,t,n){function r(e){var t;if(!a(e)||l.call(e)!=s||o(e)||!c.call(e,"constructor")&&(t=e.constructor,"function"==typeof t&&!(t instanceof t)))return!1;var n;return i(e,function(e,t){n=t}),void 0===n||c.call(e,n)}var i=n(178),o=n(115),a=n(109),s="[object Object]",u=Object.prototype,c=u.hasOwnProperty,l=u.toString;e.exports=r},function(e,t,n){function r(e){return i(e,o(e))}var i=n(195),o=n(118);e.exports=r},function(e,t,n){"use strict";var r=n(135),i=n(134),o=n(108),a=function(e){return o(e)?(r(e,a),Object.isFrozen(e)||Object.freeze(e),e):e};e.exports=Object.freeze?a:i},function(e,t,n){"use strict";var r=n(208);try{var i;i="undefined"!=typeof window?window.console&&r(window.console.warn,console):r(console.warn,console);var o=function(e){var t=[];return function(n){-1===t.indexOf(n)&&(e(n),t.push(n))}}(i);e.exports=o}catch(a){e.exports=function(){}}},function(e,t,n){var r=n(209),i=n(229),o=n(126),a=1,s=32,u=o(function(e,t,n){var o=a;if(n.length){var c=i(n,u.placeholder);o|=s}return r(e,o,t,n,c)});u.placeholder={},e.exports=u},function(e,t,n){function r(e,t,n,r,g,y,b,x){var w=t&p;if(!w&&"function"!=typeof e)throw new TypeError(m);var _=r?r.length:0;if(_||(t&=~(d|h),r=g=void 0),_-=g?g.length:0,t&h){var C=r,$=g;r=g=void 0}var S=w?void 0:u(e),E=[e,t,n,r,g,C,$,y,b,x];if(S&&(c(E,S),t=E[1],x=E[9]),E[9]=null==x?w?0:e.length:v(x-_,0)||0,t==f)var P=o(E[0],E[2]);else P=t!=d&&t!=(f|d)||E[4].length?a.apply(void 0,E):s.apply(void 0,E);var k=S?i:l;return k(P,E)}var i=n(210),o=n(212),a=n(215),s=n(232),u=n(221),c=n(233),l=n(230),f=1,p=2,d=32,h=64,m="Expected a function",v=Math.max;e.exports=r},function(e,t,n){var r=n(134),i=n(211),o=i?function(e,t){return i.set(e,t),e}:r;e.exports=o},function(e,t,n){(function(t){var r=n(105),i=r(t,"WeakMap"),o=i&&new i;e.exports=o}).call(t,function(){return this}())},function(e,t,n){(function(t){function r(e,n){function r(){var i=this&&this!==t&&this instanceof r?o:e;return i.apply(n,arguments)}var o=i(e);return r}var i=n(213);e.exports=r}).call(t,function(){return this}())},function(e,t,n){function r(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=i(e.prototype),r=e.apply(n,t);return o(r)?r:n}}var i=n(214),o=n(108);e.exports=r},function(e,t,n){var r=n(108),i=function(){function e(){}return function(t){if(r(t)){e.prototype=t;var n=new e;e.prototype=void 0}return n||{}}}();e.exports=i},function(e,t,n){(function(t){function r(e,n,w,_,C,$,S,E,P,k){function T(){for(var h=arguments.length,m=h,v=Array(h);m--;)v[m]=arguments[m];if(_&&(v=o(v,_,C)),$&&(v=a(v,$,S)),A||M){var b=T.placeholder,I=l(v,b);if(h-=I.length,k>h){var F=E?i(E):void 0,L=x(k-h,0),U=A?I:void 0,H=A?void 0:I,V=A?v:void 0,q=A?void 0:v;n|=A?g:y,n&=~(A?y:g),j||(n&=~(p|d));var B=[e,n,w,V,U,q,H,F,P,L],W=r.apply(void 0,B);return u(e)&&f(W,B),W.placeholder=b,W}}var z=R?w:this,K=N?z[e]:e;return E&&(v=c(v,E)),O&&P<v.length&&(v.length=P),this&&this!==t&&this instanceof T&&(K=D||s(e)),K.apply(z,v)}var O=n&b,R=n&p,N=n&d,A=n&m,j=n&h,M=n&v,D=N?void 0:s(e);return T}var i=n(203),o=n(216),a=n(217),s=n(213),u=n(218),c=n(228),l=n(229),f=n(230),p=1,d=2,h=4,m=8,v=16,g=32,y=64,b=128,x=Math.max;e.exports=r}).call(t,function(){return this}())},function(e){function t(e,t,r){for(var i=r.length,o=-1,a=n(e.length-i,0),s=-1,u=t.length,c=Array(u+a);++s<u;)c[s]=t[s];for(;++o<i;)c[r[o]]=e[o];for(;a--;)c[s++]=e[o++];return c}var n=Math.max;e.exports=t},function(e){function t(e,t,r){for(var i=-1,o=r.length,a=-1,s=n(e.length-o,0),u=-1,c=t.length,l=Array(s+c);++a<s;)l[a]=e[a];for(var f=a;++u<c;)l[f+u]=t[u];for(;++i<o;)l[f+r[i]]=e[a++];return l}var n=Math.max;e.exports=t},function(e,t,n){function r(e){var t=a(e),n=s[t];if("function"!=typeof n||!(t in i.prototype))return!1;if(e===n)return!0;var r=o(n);return!!r&&e===r[0]}var i=n(219),o=n(221),a=n(223),s=n(225);e.exports=r},function(e,t,n){function r(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=a,this.__views__=[]}var i=n(214),o=n(220),a=Number.POSITIVE_INFINITY;r.prototype=i(o.prototype),r.prototype.constructor=r,e.exports=r},function(e){function t(){}e.exports=t},function(e,t,n){var r=n(211),i=n(222),o=r?function(e){return r.get(e)}:i;e.exports=o},function(e){function t(){}e.exports=t},function(e,t,n){function r(e){for(var t=e.name+"",n=i[t],r=n?n.length:0;r--;){var o=n[r],a=o.func;if(null==a||a==e)return o.name}return t}var i=n(224);e.exports=r},function(e){var t={};e.exports=t},function(e,t,n){function r(e){if(u(e)&&!s(e)&&!(e instanceof i)){if(e instanceof o)return e;if(f.call(e,"__chain__")&&f.call(e,"__wrapped__"))return c(e)}return new o(e)}var i=n(219),o=n(226),a=n(220),s=n(116),u=n(109),c=n(227),l=Object.prototype,f=l.hasOwnProperty;r.prototype=a.prototype,e.exports=r},function(e,t,n){function r(e,t,n){this.__wrapped__=e,this.__actions__=n||[],this.__chain__=!!t}var i=n(214),o=n(220);r.prototype=i(o.prototype),r.prototype.constructor=r,e.exports=r},function(e,t,n){function r(e){return e instanceof i?e.clone():new o(e.__wrapped__,e.__chain__,a(e.__actions__))}var i=n(219),o=n(226),a=n(203);e.exports=r},function(e,t,n){function r(e,t){for(var n=e.length,r=a(t.length,n),s=i(e);r--;){var u=t[r];e[r]=o(u,n)?s[u]:void 0}return e}var i=n(203),o=n(117),a=Math.min;e.exports=r},function(e){function t(e,t){for(var r=-1,i=e.length,o=-1,a=[];++r<i;)e[r]===t&&(e[r]=n,a[++o]=r);return a}var n="__lodash_placeholder__";e.exports=t},function(e,t,n){var r=n(210),i=n(231),o=150,a=16,s=function(){var e=0,t=0;return function(n,s){var u=i(),c=a-(u-t);if(t=u,c>0){if(++e>=o)return n}else e=0;return r(n,s)}}();e.exports=s},function(e,t,n){var r=n(105),i=r(Date,"now"),o=i||function(){return(new Date).getTime()};e.exports=o},function(e,t,n){(function(t){function r(e,n,r,a){function s(){for(var n=-1,i=arguments.length,o=-1,l=a.length,f=Array(l+i);++o<l;)f[o]=a[o];for(;i--;)f[o++]=arguments[++n];var p=this&&this!==t&&this instanceof s?c:e;return p.apply(u?r:this,f)}var u=n&o,c=i(e);return s}var i=n(213),o=1;e.exports=r}).call(t,function(){return this}())},function(e,t,n){function r(e,t){var n=e[1],r=t[1],m=n|r,v=f>m,g=r==f&&n==l||r==f&&n==p&&e[7].length<=t[8]||r==(f|p)&&n==l;if(!v&&!g)return e;r&u&&(e[2]=t[2],m|=n&u?0:c);var y=t[3];if(y){var b=e[3];e[3]=b?o(b,y,t[4]):i(y),e[4]=b?s(e[3],d):i(t[4])}return y=t[5],y&&(b=e[5],e[5]=b?a(b,y,t[6]):i(y),e[6]=b?s(e[5],d):i(t[6])),y=t[7],y&&(e[7]=i(y)),r&f&&(e[8]=null==e[8]?t[8]:h(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=m,e}var i=n(203),o=n(216),a=n(217),s=n(229),u=1,c=4,l=8,f=128,p=256,d="__lodash_placeholder__",h=Math.min;e.exports=r},function(e,t,n){"use strict";function r(e){if(a(e))return e;if(s(e))return parseFloat(e);if(o(e))return i(e,r);throw new Error("The value should be a number, a parseable string or an array of those.")}var i=n(165),o=n(116),a=n(235),s=n(183);e.exports=r},function(e,t,n){function r(e){return"number"==typeof e||i(e)&&s.call(e)==o}var i=n(109),o="[object Number]",a=Object.prototype,s=a.toString;e.exports=r},function(e,t,n){"use strict";function r(e,t){var n={},r=o(t,function(e){return-1!==e.indexOf("attribute:")}),c=a(r,function(e){return e.split(":")[1]});-1===u(c,"*")?i(c,function(t){e.isConjunctiveFacet(t)&&e.isFacetRefined(t)&&(n.facetsRefinements||(n.facetsRefinements={}),n.facetsRefinements[t]=e.facetsRefinements[t]),e.isDisjunctiveFacet(t)&&e.isDisjunctiveFacetRefined(t)&&(n.disjunctiveFacetsRefinements||(n.disjunctiveFacetsRefinements={}),n.disjunctiveFacetsRefinements[t]=e.disjunctiveFacetsRefinements[t]);var r=e.getNumericRefinements(t);s(r)||(n.numericRefinements||(n.numericRefinements={}),n.numericRefinements[t]=e.numericRefinements[t])}):(s(e.numericRefinements)||(n.numericRefinements=e.numericRefinements),s(e.facetsRefinements)||(n.facetsRefinements=e.facetsRefinements),s(e.disjunctiveFacetsRefinements)||(n.disjunctiveFacetsRefinements=e.disjunctiveFacetsRefinements),s(e.hierarchicalFacetsRefinements)||(n.hierarchicalFacetsRefinements=e.hierarchicalFacetsRefinements));var l=o(t,function(e){return-1===e.indexOf("attribute:")});return i(l,function(t){n[t]=e[t]}),n}var i=n(135),o=n(140),a=n(165),s=n(182),u=n(179);e.exports=r},function(e,t,n){"use strict";var r=n(185),i=n(183),o=n(107),a=n(182),s=n(191),u=n(168),c=n(140),l=n(172),f={addRefinement:function(e,t,n){if(f.isRefined(e,t,n))return e;var r=""+n,i=e[t]?e[t].concat(r):[r],o={};return o[t]=i,s({},o,e)},removeRefinement:function(e,t,n){if(r(n))return f.clearRefinement(e,t);var i=""+n;return f.clearRefinement(e,function(e,n){return t===n&&i===e})},toggleRefinement:function(e,t,n){if(r(n))throw new Error("toggleRefinement should be used with a value");return f.isRefined(e,t,n)?f.removeRefinement(e,t,n):f.addRefinement(e,t,n)},clearRefinement:function(e,t,n){return r(t)?{}:i(t)?l(e,t):o(t)?u(e,function(e,r,i){var o=c(r,function(e){return!t(e,i,n)});return a(o)||(e[i]=o),e},{}):void 0},isRefined:function(e,t,i){var o=n(179),a=!!e[t]&&e[t].length>0;if(r(i)||!a)return a;var s=""+i;return-1!==o(e[t],s)}};e.exports=f},function(e,t,n){"use strict";function r(e){var t={};return f(e,function(e,n){t[e]=n}),t}function i(e,t,n){t&&t[n]&&(e.stats=t[n])}function o(e,t){return v(e,function(e){return g(e.attributes,t)})}function a(e,t){var n=t.results[0];this.query=n.query,this.parsedQuery=n.parsedQuery,this.hits=n.hits,this.index=n.index,this.hitsPerPage=n.hitsPerPage,this.nbHits=n.nbHits,this.nbPages=n.nbPages,this.page=n.page,this.processingTimeMS=m(t.results,"processingTimeMS"),this.aroundLatLng=n.aroundLatLng,this.automaticRadius=n.automaticRadius,this.serverUsed=n.serverUsed,this.timeoutCounts=n.timeoutCounts,this.timeoutHits=n.timeoutHits,this.disjunctiveFacets=[],this.hierarchicalFacets=y(e.hierarchicalFacets,function(){return[]}),this.facets=[];var a=e.getRefinedDisjunctiveFacets(),s=r(e.facets),u=r(e.disjunctiveFacets),c=1;f(n.facets,function(t,r){var a=o(e.hierarchicalFacets,r);if(a){var c=a.attributes.indexOf(r);this.hierarchicalFacets[h(e.hierarchicalFacets,{name:a.name})][c]={attribute:r,data:t,exhaustive:n.exhaustiveFacetsCount}}else{var l,f=-1!==d(e.disjunctiveFacets,r),p=-1!==d(e.facets,r);f&&(l=u[r],this.disjunctiveFacets[l]={name:r,data:t,exhaustive:n.exhaustiveFacetsCount},i(this.disjunctiveFacets[l],n.facets_stats,r)),p&&(l=s[r],this.facets[l]={name:r,data:t,exhaustive:n.exhaustiveFacetsCount},i(this.facets[l],n.facets_stats,r))}},this),this.hierarchicalFacets=p(this.hierarchicalFacets),f(a,function(r){var o=t.results[c],a=e.getHierarchicalFacetByName(r);f(o.facets,function(t,r){var s;if(a){s=h(e.hierarchicalFacets,{name:a.name});var c=h(this.hierarchicalFacets[s],{attribute:r});if(-1===c)return;this.hierarchicalFacets[s][c].data=w({},this.hierarchicalFacets[s][c].data,t)}else{s=u[r];var l=n.facets&&n.facets[r]||{};this.disjunctiveFacets[s]={name:r,data:x({},t,l),exhaustive:o.exhaustiveFacetsCount},i(this.disjunctiveFacets[s],o.facets_stats,r),e.disjunctiveFacetsRefinements[r]&&f(e.disjunctiveFacetsRefinements[r],function(t){!this.disjunctiveFacets[s].data[t]&&d(e.disjunctiveFacetsRefinements[r],t)>-1&&(this.disjunctiveFacets[s].data[t]=0)},this)}},this),c++},this),f(e.getRefinedHierarchicalFacets(),function(n){var r=e.getHierarchicalFacetByName(n),i=e._getHierarchicalFacetSeparator(r),o=e.getHierarchicalRefinement(n);if(!(0===o.length||o[0].split(i).length<2)){var a=t.results[c];f(a.facets,function(t,n){var a=h(e.hierarchicalFacets,{name:r.name}),s=h(this.hierarchicalFacets[a],{attribute:n});if(-1!==s){var u={};if(o.length>0){var c=o[0].split(i)[0];u[c]=this.hierarchicalFacets[a][s].data[c]}this.hierarchicalFacets[a][s].data=x(u,t,this.hierarchicalFacets[a][s].data)}},this),c++}},this),f(e.facetsExcludes,function(e,t){var r=s[t];this.facets[r]={name:t,data:n.facets[t],exhaustive:n.exhaustiveFacetsCount},f(e,function(e){this.facets[r]=this.facets[r]||{name:t},this.facets[r].data=this.facets[r].data||{},this.facets[r].data[e]=0},this)},this),this.hierarchicalFacets=y(this.hierarchicalFacets,P(e)),this.facets=p(this.facets),this.disjunctiveFacets=p(this.disjunctiveFacets),this._state=e}function s(e,t){var n={name:t};if(e._state.isConjunctiveFacet(t)){var r=v(e.facets,n);return r?y(r.data,function(n,r){return{name:r,count:n,isRefined:e._state.isFacetRefined(t,r)}}):[]}if(e._state.isDisjunctiveFacet(t)){var i=v(e.disjunctiveFacets,n);return i?y(i.data,function(n,r){return{name:r,count:n,isRefined:e._state.isDisjunctiveFacetRefined(t,r)}}):[]}return e._state.isHierarchicalFacet(t)?v(e.hierarchicalFacets,n):void 0}function u(e,t){if(!t.data||0===t.data.length)return t;var n=y(t.data,$(u,e)),r=e(n),i=w({},t,{data:r});return i}function c(e,t){return t.sort(e)}function l(e,t){var n=v(e,{name:t});return n&&n.stats}var f=n(135),p=n(239),d=n(179),h=n(240),m=n(242),v=n(186),g=n(249),y=n(165),b=n(250),x=n(191),w=n(200),_=n(116),C=n(107),$=n(255),S=n(257),E=n(258),P=n(259);a.prototype.getFacetByName=function(e){var t={name:e};return v(this.facets,t)||v(this.disjunctiveFacets,t)||v(this.hierarchicalFacets,t)},a.DEFAULT_SORT=["isRefined:desc","count:desc","name:asc"],a.prototype.getFacetValues=function(e,t){var n=s(this,e);if(!n)throw new Error(e+" is not a retrieved facet.");var r=x({},t,{sortBy:a.DEFAULT_SORT});if(_(r.sortBy)){var i=E(r.sortBy);return _(n)?b(n,i[0],i[1]):u(S(b,i[0],i[1]),n)}if(C(r.sortBy))return _(n)?n.sort(r.sortBy):u($(c,r.sortBy),n);throw new Error("options.sortBy is optional but if defined it must be either an array of string (predicates) or a sorting function")},a.prototype.getFacetStats=function(e){if(this._state.isConjunctiveFacet(e))return l(this.facets,e);if(this._state.isDisjunctiveFacet(e))return l(this.disjunctiveFacets,e);throw new Error(e+" is not present in `facets` or `disjunctiveFacets`")},e.exports=a},function(e){function t(e){for(var t=-1,n=e?e.length:0,r=-1,i=[];++t<n;){var o=e[t];o&&(i[++r]=o)}return i}e.exports=t},function(e,t,n){var r=n(241),i=r();e.exports=i},function(e,t,n){function r(e){return function(t,n,r){return t&&t.length?(n=i(n,r,3),o(t,n,e)):-1}}var i=n(142),o=n(189);e.exports=r},function(e,t,n){e.exports=n(243)},function(e,t,n){function r(e,t,n){return n&&u(e,t,n)&&(t=void 0),t=o(t,n,3),1==t.length?i(s(e)?e:c(e),t):a(e,t)}var i=n(244),o=n(142),a=n(245),s=n(116),u=n(197),c=n(246);e.exports=r},function(e){function t(e,t){for(var n=e.length,r=0;n--;)r+=+t(e[n])||0;return r}e.exports=t},function(e,t,n){function r(e,t){var n=0;return i(e,function(e,r,i){n+=+t(e,r,i)||0}),n}var i=n(137);e.exports=r},function(e,t,n){function r(e){return null==e?[]:i(e)?o(e)?e:Object(e):a(e)}var i=n(110),o=n(108),a=n(247);e.exports=r},function(e,t,n){function r(e){return i(e,o(e))}var i=n(248),o=n(104);e.exports=r},function(e){function t(e,t){for(var n=-1,r=t.length,i=Array(r);++n<r;)i[n]=e[t[n]];return i}e.exports=t},function(e,t,n){function r(e,t,n,r){var p=e?o(e):0;return u(p)||(e=l(e),p=e.length),n="number"!=typeof n||r&&s(t,n,r)?0:0>n?f(p+n,0):n||0,"string"==typeof e||!a(e)&&c(e)?p>=n&&e.indexOf(t,n)>-1:!!p&&i(e,t,n)>-1}var i=n(120),o=n(111),a=n(116),s=n(197),u=n(113),c=n(183),l=n(247),f=Math.max;e.exports=r},function(e,t,n){function r(e,t,n,r){return null==e?[]:(r&&a(t,n,r)&&(n=void 0),o(t)||(t=null==t?[]:[t]),o(n)||(n=null==n?[]:[n]),i(e,t,n))}var i=n(251),o=n(116),a=n(197);e.exports=r},function(e,t,n){function r(e,t,n){var r=-1;t=i(t,function(e){return o(e)});var c=a(e,function(e){var n=i(t,function(t){return t(e)});return{criteria:n,index:++r,value:e}});return s(c,function(e,t){return u(e,t,n)})}var i=n(166),o=n(142),a=n(167),s=n(252),u=n(253);e.exports=r},function(e){function t(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}e.exports=t},function(e,t,n){function r(e,t,n){for(var r=-1,o=e.criteria,a=t.criteria,s=o.length,u=n.length;++r<s;){var c=i(o[r],a[r]);if(c){if(r>=u)return c;var l=n[r];return c*("asc"===l||l===!0?1:-1)}}return e.index-t.index}var i=n(254);e.exports=r},function(e){function t(e,t){if(e!==t){var n=null===e,r=void 0===e,i=e===e,o=null===t,a=void 0===t,s=t===t;if(e>t&&!o||!i||n&&!a&&s||r&&s)return 1;if(t>e&&!n||!s||o&&!r&&i||a&&i)return-1}return 0}e.exports=t},function(e,t,n){var r=n(256),i=32,o=r(i);o.placeholder={},e.exports=o},function(e,t,n){function r(e){var t=a(function(n,r){var a=o(r,t.placeholder);return i(n,e,void 0,r,a)});return t}var i=n(209),o=n(229),a=n(126);e.exports=r},function(e,t,n){var r=n(256),i=64,o=r(i);o.placeholder={},e.exports=o},function(e,t,n){"use strict";var r=n(168);e.exports=function(e){return r(e,function(e,t){var n=t.split(":");return e[0].push(n[0]),e[1].push(n[1]),e},[[],[]])}},function(e,t,n){"use strict";function r(e){return function(t,n){var r=e.hierarchicalFacets[n],o=e.hierarchicalFacetsRefinements[r.name]&&e.hierarchicalFacetsRefinements[r.name][0]||"",a=e._getHierarchicalFacetSeparator(r),s=e._getHierarchicalRootPath(r),u=e._getHierarchicalShowParentLevel(r),l=h(e._getHierarchicalFacetSortBy(r)),f=i(l,a,s,u,o),p=t;return s&&(p=t.slice(s.split(a).length)),c(p,f,{name:e.hierarchicalFacets[n].name,count:null,isRefined:!0,path:null,data:null})}}function i(e,t,n,r,i){return function(s,c,f){var h=s;if(f>0){var m=0;for(h=s;f>m;)h=h&&p(h.data,{isRefined:!0}),m++}if(h){var v=o(h.path||n,i,t,n,r);h.data=l(u(d(c.data,v),a(t,i)),e[0],e[1])}return s}}function o(e,t,n,r,i){return function(o,a){return!r||0===a.indexOf(r)&&r!==a?!r&&-1===a.indexOf(n)||r&&a.split(n).length-r.split(n).length===1||-1===a.indexOf(n)&&-1===t.indexOf(n)||0===t.indexOf(a)||0===a.indexOf(e+n)&&(i||0===a.indexOf(t)):!1}}function a(e,t){return function(n,r){return{name:f(s(r.split(e))),path:r,count:n,isRefined:t===r||0===t.indexOf(r+e),data:null}}}e.exports=r;var s=n(159),u=n(165),c=n(168),l=n(250),f=n(260),p=n(186),d=n(266),h=n(258)},function(e,t,n){function r(e,t,n){var r=e;return(e=i(e))?(n?s(r,t,n):null==t)?e.slice(u(e),c(e)+1):(t+="",e.slice(o(e,t),a(e,t)+1)):e}var i=n(161),o=n(261),a=n(262),s=n(197),u=n(263),c=n(265);e.exports=r},function(e){function t(e,t){for(var n=-1,r=e.length;++n<r&&t.indexOf(e.charAt(n))>-1;);return n}e.exports=t},function(e){function t(e,t){for(var n=e.length;n--&&t.indexOf(e.charAt(n))>-1;);return n}e.exports=t},function(e,t,n){function r(e){for(var t=-1,n=e.length;++t<n&&i(e.charCodeAt(t)););return t}var i=n(264);e.exports=r},function(e){function t(e){return 160>=e&&e>=9&&13>=e||32==e||160==e||5760==e||6158==e||e>=8192&&(8202>=e||8232==e||8233==e||8239==e||8287==e||12288==e||65279==e)}e.exports=t},function(e,t,n){function r(e){for(var t=e.length;t--&&i(e.charCodeAt(t)););return t}var i=n(264);e.exports=r},function(e,t,n){var r=n(174),i=n(133),o=n(176),a=n(177),s=n(126),u=s(function(e,t){return null==e?{}:"function"==typeof t[0]?a(e,i(t[0],t[1],3)):o(e,r(t))});e.exports=u},function(e,t,n){"use strict";var r=n(135),i=n(165),o=n(168),a=n(200),s=n(116),u={_getQueries:function(e,t){var n=[];return n.push({indexName:e,params:this._getHitsSearchParams(t)}),r(t.getRefinedDisjunctiveFacets(),function(r){n.push({indexName:e,params:this._getDisjunctiveFacetSearchParams(t,r)})},this),r(t.getRefinedHierarchicalFacets(),function(r){var i=t.getHierarchicalFacetByName(r),o=t.getHierarchicalRefinement(r);o.length>0&&o[0].split(t._getHierarchicalFacetSeparator(i)).length>1&&n.push({indexName:e,params:this._getDisjunctiveFacetSearchParams(t,r,!0)})},this),n},_getHitsSearchParams:function(e){var t=e.facets.concat(e.disjunctiveFacets).concat(this._getHitsHierarchicalFacetsAttributes(e)),n=this._getFacetFilters(e),r=this._getNumericFilters(e),i=this._getTagFilters(e),o={facets:t,tagFilters:i};return n.length>0&&(o.facetFilters=n),r.length>0&&(o.numericFilters=r),a(e.getQueryParams(),o)},_getDisjunctiveFacetSearchParams:function(e,t,n){var r=this._getFacetFilters(e,t,n),i=this._getNumericFilters(e,t),o=this._getTagFilters(e),s={hitsPerPage:1,page:0,attributesToRetrieve:[],attributesToHighlight:[],attributesToSnippet:[],tagFilters:o},u=e.getHierarchicalFacetByName(t);return s.facets=u?this._getDisjunctiveHierarchicalFacetAttribute(e,u,n):t,i.length>0&&(s.numericFilters=i),r.length>0&&(s.facetFilters=r),a(e.getQueryParams(),s)},_getNumericFilters:function(e,t){if(e.numericFilters)return e.numericFilters;var n=[];return r(e.numericRefinements,function(e,o){r(e,function(e,a){t!==o&&r(e,function(e){if(s(e)){var t=i(e,function(e){return o+a+e});n.push(t)}else n.push(o+a+e)})})}),n},_getTagFilters:function(e){return e.tagFilters?e.tagFilters:e.tagRefinements.join(",")},_getFacetFilters:function(e,t,n){var i=[];return r(e.facetsRefinements,function(e,t){r(e,function(e){i.push(t+":"+e)})}),r(e.facetsExcludes,function(e,t){r(e,function(e){i.push(t+":-"+e)})}),r(e.disjunctiveFacetsRefinements,function(e,n){if(n!==t&&e&&0!==e.length){var o=[];r(e,function(e){o.push(n+":"+e)}),i.push(o)}}),r(e.hierarchicalFacetsRefinements,function(r,o){var a=r[0];if(void 0!==a){var s,u,c=e.getHierarchicalFacetByName(o),l=e._getHierarchicalFacetSeparator(c),f=e._getHierarchicalRootPath(c);if(t===o){if(-1===a.indexOf(l)||!f&&n===!0||f&&f.split(l).length===a.split(l).length)return;f?(u=f.split(l).length-1,a=f):(u=a.split(l).length-2,a=a.slice(0,a.lastIndexOf(l))),s=c.attributes[u]}else u=a.split(l).length-1,s=c.attributes[u];s&&i.push([s+":"+a])}}),i},_getHitsHierarchicalFacetsAttributes:function(e){var t=[];return o(e.hierarchicalFacets,function(t,n){var r=e.getHierarchicalRefinement(n.name)[0];if(!r)return t.push(n.attributes[0]),t;var i=r.split(e._getHierarchicalFacetSeparator(n)).length,o=n.attributes.slice(0,i+1);return t.concat(o)},t)},_getDisjunctiveHierarchicalFacetAttribute:function(e,t,n){var r=e._getHierarchicalFacetSeparator(t);if(n===!0){var i=e._getHierarchicalRootPath(t),o=0;return i&&(o=i.split(r).length),[t.attributes[o]]}var a=e.getHierarchicalRefinement(t.name)[0]||"",s=a.split(r).length-1;return t.attributes.slice(0,s+1)}};e.exports=u;
12
-
13
- },function(e,t,n){(function(e,r){function i(e,n){var r={seen:[],stylize:a};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),m(n)?r.showHidden=n:n&&t._extend(r,n),w(r.showHidden)&&(r.showHidden=!1),w(r.depth)&&(r.depth=2),w(r.colors)&&(r.colors=!1),w(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),u(r,e,r.depth)}function o(e,t){var n=i.styles[t];return n?"["+i.colors[n][0]+"m"+e+"["+i.colors[n][1]+"m":e}function a(e){return e}function s(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function u(e,n,r){if(e.customInspect&&n&&E(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return b(i)||(i=u(e,i,r)),i}var o=c(e,n);if(o)return o;var a=Object.keys(n),m=s(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(n)),S(n)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return l(n);if(0===a.length){if(E(n)){var v=n.name?": "+n.name:"";return e.stylize("[Function"+v+"]","special")}if(_(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if($(n))return e.stylize(Date.prototype.toString.call(n),"date");if(S(n))return l(n)}var g="",y=!1,x=["{","}"];if(h(n)&&(y=!0,x=["[","]"]),E(n)){var w=n.name?": "+n.name:"";g=" [Function"+w+"]"}if(_(n)&&(g=" "+RegExp.prototype.toString.call(n)),$(n)&&(g=" "+Date.prototype.toUTCString.call(n)),S(n)&&(g=" "+l(n)),0===a.length&&(!y||0==n.length))return x[0]+g+x[1];if(0>r)return _(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special");e.seen.push(n);var C;return C=y?f(e,n,r,m,a):a.map(function(t){return p(e,n,r,m,t,y)}),e.seen.pop(),d(C,g,x)}function c(e,t){if(w(t))return e.stylize("undefined","undefined");if(b(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}return y(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):v(t)?e.stylize("null","null"):void 0}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,n,r,i){for(var o=[],a=0,s=t.length;s>a;++a)o.push(R(t,String(a))?p(e,t,n,r,String(a),!0):"");return i.forEach(function(i){i.match(/^\d+$/)||o.push(p(e,t,n,r,i,!0))}),o}function p(e,t,n,r,i,o){var a,s,c;if(c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},c.get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),R(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(c.value)<0?(s=v(n)?u(e,c.value,null):u(e,c.value,n-1),s.indexOf("\n")>-1&&(s=o?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),w(a)){if(o&&i.match(/^\d+$/))return s;a=JSON.stringify(""+i),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function d(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function h(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function v(e){return null===e}function g(e){return null==e}function y(e){return"number"==typeof e}function b(e){return"string"==typeof e}function x(e){return"symbol"==typeof e}function w(e){return void 0===e}function _(e){return C(e)&&"[object RegExp]"===k(e)}function C(e){return"object"==typeof e&&null!==e}function $(e){return C(e)&&"[object Date]"===k(e)}function S(e){return C(e)&&("[object Error]"===k(e)||e instanceof Error)}function E(e){return"function"==typeof e}function P(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function k(e){return Object.prototype.toString.call(e)}function T(e){return 10>e?"0"+e.toString(10):e.toString(10)}function O(){var e=new Date,t=[T(e.getHours()),T(e.getMinutes()),T(e.getSeconds())].join(":");return[e.getDate(),M[e.getMonth()],t].join(" ")}function R(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var N=/%[sdj%]/g;t.format=function(e){if(!b(e)){for(var t=[],n=0;n<arguments.length;n++)t.push(i(arguments[n]));return t.join(" ")}for(var n=1,r=arguments,o=r.length,a=String(e).replace(N,function(e){if("%%"===e)return"%";if(n>=o)return e;switch(e){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return e}}),s=r[n];o>n;s=r[++n])a+=v(s)||!C(s)?" "+s:" "+i(s);return a},t.deprecate=function(n,i){function o(){if(!a){if(r.throwDeprecation)throw new Error(i);r.traceDeprecation?console.trace(i):console.error(i),a=!0}return n.apply(this,arguments)}if(w(e.process))return function(){return t.deprecate(n,i).apply(this,arguments)};if(r.noDeprecation===!0)return n;var a=!1;return o};var A,j={};t.debuglog=function(e){if(w(A)&&(A={NODE_ENV:"production"}.NODE_DEBUG||""),e=e.toUpperCase(),!j[e])if(new RegExp("\\b"+e+"\\b","i").test(A)){var n=r.pid;j[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else j[e]=function(){};return j[e]},t.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=h,t.isBoolean=m,t.isNull=v,t.isNullOrUndefined=g,t.isNumber=y,t.isString=b,t.isSymbol=x,t.isUndefined=w,t.isRegExp=_,t.isObject=C,t.isDate=$,t.isError=S,t.isFunction=E,t.isPrimitive=P,t.isBuffer=n(269);var M=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];t.log=function(){console.log("%s - %s",O(),t.format.apply(t,arguments))},t.inherits=n(270),t._extend=function(e,t){if(!t||!C(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}}).call(t,function(){return this}(),n(11))},function(e){e.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},function(e){e.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e){function t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function r(e){return"number"==typeof e}function i(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=t,t.EventEmitter=t,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.prototype.setMaxListeners=function(e){if(!r(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},t.prototype.emit=function(e){var t,r,a,s,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[e],o(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(i(r))for(s=Array.prototype.slice.call(arguments,1),c=r.slice(),a=c.length,u=0;a>u;u++)c[u].apply(this,s);return!0},t.prototype.addListener=function(e,r){var a;if(!n(r))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(r.listener)?r.listener:r),this._events[e]?i(this._events[e])?this._events[e].push(r):this._events[e]=[this._events[e],r]:this._events[e]=r,i(this._events[e])&&!this._events[e].warned&&(a=o(this._maxListeners)?t.defaultMaxListeners:this._maxListeners,a&&a>0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},t.prototype.removeListener=function(e,t){var r,o,a,s;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],a=r.length,o=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(r)){for(s=a;s-->0;)if(r[s]===t||r[s].listener&&r[s].listener===t){o=s;break}if(0>o)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},t.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e){return m(e)?d(e,r):v(e)?f(e,r):h(e)?y(e):e}function i(e,t,n,r){if(null!==e&&(n=n.replace(e,""),r=r.replace(e,"")),n=t[n]||n,r=t[r]||r,-1!==x.indexOf(n)||-1!==x.indexOf(r)){if("q"===n)return-1;if("q"===r)return 1;var i=-1!==b.indexOf(n),o=-1!==b.indexOf(r);if(i&&!o)return 1;if(o&&!i)return-1}return n.localeCompare(r)}var o=n(273),a=n(103),s=n(275),u=n(208),c=n(135),l=n(266),f=n(165),p=n(279),d=n(281),h=n(183),m=n(204),v=n(116),g=n(274),y=n(277).encode,b=["dFR","fR","nR","hFR","tR"],x=o.ENCODED_PARAMETERS;t.getStateFromQueryString=function(e,t){var n=t&&t.prefix||"",r=t&&t.mapping||{},i=g(r),u=s.parse(e),c=new RegExp("^"+n),f=p(u,function(e,t){var r=n&&c.test(t),a=r?t.replace(c,""):t,s=o.decode(i[a]||a);return s||a}),d=a._parseNumbers(f);return l(d,a.PARAMETERS)},t.getUnrecognizedParametersInQueryString=function(e,t){var n=t&&t.prefix,r=t&&t.mapping||{},i=g(r),a={},u=s.parse(e);if(n){var l=new RegExp("^"+n);c(u,function(e,t){l.test(t)||(a[t]=e)})}else c(u,function(e,t){o.decode(i[t]||t)||(a[t]=e)});return a},t.getQueryStringFromState=function(e,t){var n=t&&t.moreAttributes,a=t&&t.prefix||"",c=t&&t.mapping||{},l=g(c),f=r(e),d=p(f,function(e,t){var n=o.encode(t);return a+(c[n]||n)}),h=""===a?null:new RegExp("^"+a),m=u(i,null,h,l);if(n){var v=s.stringify(d,{encode:!1,sort:m}),y=s.stringify(n,{encode:!1});return v?v+"&"+y:y}return s.stringify(d,{encode:!1,sort:m})}},function(e,t,n){"use strict";var r=n(274),i=n(104),o={advancedSyntax:"aS",allowTyposOnNumericTokens:"aTONT",analyticsTags:"aT",analytics:"a",aroundLatLngViaIP:"aLLVIP",aroundLatLng:"aLL",aroundPrecision:"aP",aroundRadius:"aR",attributesToHighlight:"aTH",attributesToRetrieve:"aTR",attributesToSnippet:"aTS",disjunctiveFacetsRefinements:"dFR",disjunctiveFacets:"dF",distinct:"d",facetsExcludes:"fE",facetsRefinements:"fR",facets:"f",getRankingInfo:"gRI",hierarchicalFacetsRefinements:"hFR",hierarchicalFacets:"hF",highlightPostTag:"hPoT",highlightPreTag:"hPrT",hitsPerPage:"hPP",ignorePlurals:"iP",index:"idx",insideBoundingBox:"iBB",insidePolygon:"iPg",length:"l",maxValuesPerFacet:"mVPF",minimumAroundRadius:"mAR",minProximity:"mP",minWordSizefor1Typo:"mWS1T",minWordSizefor2Typos:"mWS2T",numericFilters:"nF",numericRefinements:"nR",offset:"o",optionalWords:"oW",page:"p",queryType:"qT",query:"q",removeWordsIfNoResults:"rWINR",replaceSynonymsInHighlight:"rSIH",restrictSearchableAttributes:"rSA",synonyms:"s",tagFilters:"tF",tagRefinements:"tR",typoTolerance:"tT",optionalTagFilters:"oTF",optionalFacetFilters:"oFF",snippetEllipsisText:"sET",disableExactOnAttributes:"dEOA",enableExactOnSingleWordQuery:"eEOSWQ"},a=r(o);e.exports={ENCODED_PARAMETERS:i(a),decode:function(e){return a[e]},encode:function(e){return o[e]}}},function(e,t,n){function r(e,t,n){n&&i(e,t,n)&&(t=void 0);for(var r=-1,a=o(e),u=a.length,c={};++r<u;){var l=a[r],f=e[l];t?s.call(c,f)?c[f].push(l):c[f]=[l]:c[f]=l}return c}var i=n(197),o=n(104),a=Object.prototype,s=a.hasOwnProperty;e.exports=r},function(e,t,n){var r=n(276),i=n(278);e.exports={stringify:r,parse:i}},function(e,t,n){var r=n(277),i={delimiter:"&",arrayPrefixGenerators:{brackets:function(e){return e+"[]"},indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},strictNullHandling:!1,skipNulls:!1,encode:!0};i.stringify=function(e,t,n,o,a,s,u,c){if("function"==typeof u)e=u(t,e);else if(r.isBuffer(e))e=e.toString();else if(e instanceof Date)e=e.toISOString();else if(null===e){if(o)return s?r.encode(t):t;e=""}if("string"==typeof e||"number"==typeof e||"boolean"==typeof e)return s?[r.encode(t)+"="+r.encode(e)]:[t+"="+e];var l=[];if("undefined"==typeof e)return l;var f;if(Array.isArray(u))f=u;else{var p=Object.keys(e);f=c?p.sort(c):p}for(var d=0,h=f.length;h>d;++d){var m=f[d];a&&null===e[m]||(l=l.concat(Array.isArray(e)?i.stringify(e[m],n(t,m),n,o,a,s,u):i.stringify(e[m],t+"["+m+"]",n,o,a,s,u)))}return l},e.exports=function(e,t){t=t||{};var n,r,o="undefined"==typeof t.delimiter?i.delimiter:t.delimiter,a="boolean"==typeof t.strictNullHandling?t.strictNullHandling:i.strictNullHandling,s="boolean"==typeof t.skipNulls?t.skipNulls:i.skipNulls,u="boolean"==typeof t.encode?t.encode:i.encode,c="function"==typeof t.sort?t.sort:null;"function"==typeof t.filter?(r=t.filter,e=r("",e)):Array.isArray(t.filter)&&(n=r=t.filter);var l=[];if("object"!=typeof e||null===e)return"";var f;f=t.arrayFormat in i.arrayPrefixGenerators?t.arrayFormat:"indices"in t?t.indices?"indices":"repeat":"indices";var p=i.arrayPrefixGenerators[f];n||(n=Object.keys(e)),c&&n.sort(c);for(var d=0,h=n.length;h>d;++d){var m=n[d];s&&null===e[m]||(l=l.concat(i.stringify(e[m],m,p,a,s,u,r,c)))}return l.join(o)}},function(e,t){var n={};n.hexTable=new Array(256);for(var r=0;256>r;++r)n.hexTable[r]="%"+((16>r?"0":"")+r.toString(16)).toUpperCase();t.arrayToObject=function(e,t){for(var n=t.plainObjects?Object.create(null):{},r=0,i=e.length;i>r;++r)"undefined"!=typeof e[r]&&(n[r]=e[r]);return n},t.merge=function(e,n,r){if(!n)return e;if("object"!=typeof n)return Array.isArray(e)?e.push(n):"object"==typeof e?e[n]=!0:e=[e,n],e;if("object"!=typeof e)return e=[e].concat(n);Array.isArray(e)&&!Array.isArray(n)&&(e=t.arrayToObject(e,r));for(var i=Object.keys(n),o=0,a=i.length;a>o;++o){var s=i[o],u=n[s];e[s]=Object.prototype.hasOwnProperty.call(e,s)?t.merge(e[s],u,r):u}return e},t.decode=function(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(t){return e}},t.encode=function(e){if(0===e.length)return e;"string"!=typeof e&&(e=""+e);for(var t="",r=0,i=e.length;i>r;++r){var o=e.charCodeAt(r);45===o||46===o||95===o||126===o||o>=48&&57>=o||o>=65&&90>=o||o>=97&&122>=o?t+=e[r]:128>o?t+=n.hexTable[o]:2048>o?t+=n.hexTable[192|o>>6]+n.hexTable[128|63&o]:55296>o||o>=57344?t+=n.hexTable[224|o>>12]+n.hexTable[128|o>>6&63]+n.hexTable[128|63&o]:(++r,o=65536+((1023&o)<<10|1023&e.charCodeAt(r)),t+=n.hexTable[240|o>>18]+n.hexTable[128|o>>12&63]+n.hexTable[128|o>>6&63]+n.hexTable[128|63&o])}return t},t.compact=function(e,n){if("object"!=typeof e||null===e)return e;n=n||[];var r=n.indexOf(e);if(-1!==r)return n[r];if(n.push(e),Array.isArray(e)){for(var i=[],o=0,a=e.length;a>o;++o)"undefined"!=typeof e[o]&&i.push(e[o]);return i}var s=Object.keys(e);for(o=0,a=s.length;a>o;++o){var u=s[o];e[u]=t.compact(e[u],n)}return e},t.isRegExp=function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},t.isBuffer=function(e){return null===e||"undefined"==typeof e?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))}},function(e,t,n){var r=n(277),i={delimiter:"&",depth:5,arrayLimit:20,parameterLimit:1e3,strictNullHandling:!1,plainObjects:!1,allowPrototypes:!1,allowDots:!1};i.parseValues=function(e,t){for(var n={},i=e.split(t.delimiter,t.parameterLimit===1/0?void 0:t.parameterLimit),o=0,a=i.length;a>o;++o){var s=i[o],u=-1===s.indexOf("]=")?s.indexOf("="):s.indexOf("]=")+1;if(-1===u)n[r.decode(s)]="",t.strictNullHandling&&(n[r.decode(s)]=null);else{var c=r.decode(s.slice(0,u)),l=r.decode(s.slice(u+1));n[c]=Object.prototype.hasOwnProperty.call(n,c)?[].concat(n[c]).concat(l):l}}return n},i.parseObject=function(e,t,n){if(!e.length)return t;var r,o=e.shift();if("[]"===o)r=[],r=r.concat(i.parseObject(e,t,n));else{r=n.plainObjects?Object.create(null):{};var a="["===o[0]&&"]"===o[o.length-1]?o.slice(1,o.length-1):o,s=parseInt(a,10),u=""+s;!isNaN(s)&&o!==a&&u===a&&s>=0&&n.parseArrays&&s<=n.arrayLimit?(r=[],r[s]=i.parseObject(e,t,n)):r[a]=i.parseObject(e,t,n)}return r},i.parseKeys=function(e,t,n){if(e){n.allowDots&&(e=e.replace(/\.([^\.\[]+)/g,"[$1]"));var r=/^([^\[\]]*)/,o=/(\[[^\[\]]*\])/g,a=r.exec(e),s=[];if(a[1]){if(!n.plainObjects&&Object.prototype.hasOwnProperty(a[1])&&!n.allowPrototypes)return;s.push(a[1])}for(var u=0;null!==(a=o.exec(e))&&u<n.depth;)++u,(n.plainObjects||!Object.prototype.hasOwnProperty(a[1].replace(/\[|\]/g,""))||n.allowPrototypes)&&s.push(a[1]);return a&&s.push("["+e.slice(a.index)+"]"),i.parseObject(s,t,n)}},e.exports=function(e,t){if(t=t||{},t.delimiter="string"==typeof t.delimiter||r.isRegExp(t.delimiter)?t.delimiter:i.delimiter,t.depth="number"==typeof t.depth?t.depth:i.depth,t.arrayLimit="number"==typeof t.arrayLimit?t.arrayLimit:i.arrayLimit,t.parseArrays=t.parseArrays!==!1,t.allowDots="boolean"==typeof t.allowDots?t.allowDots:i.allowDots,t.plainObjects="boolean"==typeof t.plainObjects?t.plainObjects:i.plainObjects,t.allowPrototypes="boolean"==typeof t.allowPrototypes?t.allowPrototypes:i.allowPrototypes,t.parameterLimit="number"==typeof t.parameterLimit?t.parameterLimit:i.parameterLimit,t.strictNullHandling="boolean"==typeof t.strictNullHandling?t.strictNullHandling:i.strictNullHandling,""===e||null===e||"undefined"==typeof e)return t.plainObjects?Object.create(null):{};for(var n="string"==typeof e?i.parseValues(e,t):e,o=t.plainObjects?Object.create(null):{},a=Object.keys(n),s=0,u=a.length;u>s;++s){var c=a[s],l=i.parseKeys(c,n[c],t);o=r.merge(o,l,t)}return r.compact(o)}},function(e,t,n){var r=n(280),i=r(!0);e.exports=i},function(e,t,n){function r(e){return function(t,n,r){var a={};return n=i(n,r,3),o(t,function(t,r,i){var o=n(t,r,i);r=e?o:r,t=e?t:o,a[r]=t}),a}}var i=n(142),o=n(128);e.exports=r},function(e,t,n){var r=n(280),i=r();e.exports=i},function(e){"use strict";e.exports="2.9.0"},function(e,t,n){"use strict";var r=n(284),i=n(285),o=n(306),a=o(r,i);e.exports=a},function(e){"use strict";function t(e,t){for(var n=-1,r=e.length;++n<r&&t(e[n],n,e)!==!1;);return e}e.exports=t},function(e,t,n){"use strict";var r=n(286),i=n(305),o=i(r);e.exports=o},function(e,t,n){"use strict";function r(e,t){return i(e,t,o)}var i=n(287),o=n(291);e.exports=r},function(e,t,n){"use strict";var r=n(288),i=r();e.exports=i},function(e,t,n){"use strict";function r(e){return function(t,n,r){for(var o=i(t),a=r(t),s=a.length,u=e?s:-1;e?u--:++u<s;){var c=a[u];if(n(o[c],c,o)===!1)break}return t}}var i=n(289);e.exports=r},function(e,t,n){"use strict";function r(e){return i(e)?e:Object(e)}var i=n(290);e.exports=r},function(e){"use strict";function t(e){var t="undefined"==typeof e?"undefined":n(e);return!!e&&("object"==t||"function"==t)}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};e.exports=t},function(e,t,n){"use strict";var r=n(292),i=n(296),o=n(290),a=n(300),s=r(Object,"keys"),u=s?function(e){var t=null==e?void 0:e.constructor;return"function"==typeof t&&t.prototype===e||"function"!=typeof e&&i(e)?a(e):o(e)?s(e):[]}:a;e.exports=u},function(e,t,n){"use strict";function r(e,t){var n=null==e?void 0:e[t];return i(n)?n:void 0}var i=n(293);e.exports=r},function(e,t,n){"use strict";function r(e){return null==e?!1:i(e)?l.test(u.call(e)):o(e)&&a.test(e)}var i=n(294),o=n(295),a=/^\[object .+?Constructor\]$/,s=Object.prototype,u=Function.prototype.toString,c=s.hasOwnProperty,l=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},function(e,t,n){"use strict";function r(e){return i(e)&&s.call(e)==o}var i=n(290),o="[object Function]",a=Object.prototype,s=a.toString;e.exports=r},function(e){"use strict";function t(e){return!!e&&"object"==("undefined"==typeof e?"undefined":n(e))}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};e.exports=t},function(e,t,n){"use strict";function r(e){return null!=e&&o(i(e))}var i=n(297),o=n(299);e.exports=r},function(e,t,n){"use strict";var r=n(298),i=r("length");e.exports=i},function(e){"use strict";function t(e){return function(t){return null==t?void 0:t[e]}}e.exports=t},function(e){"use strict";function t(e){return"number"==typeof e&&e>-1&&e%1==0&&n>=e}var n=9007199254740991;e.exports=t},function(e,t,n){"use strict";function r(e){for(var t=u(e),n=t.length,r=n&&e.length,c=!!r&&s(r)&&(o(e)||i(e)),f=-1,p=[];++f<n;){var d=t[f];(c&&a(d,r)||l.call(e,d))&&p.push(d)}return p}var i=n(301),o=n(302),a=n(303),s=n(299),u=n(304),c=Object.prototype,l=c.hasOwnProperty;e.exports=r},function(e,t,n){"use strict";function r(e){return o(e)&&i(e)&&s.call(e,"callee")&&!u.call(e,"callee")}var i=n(296),o=n(295),a=Object.prototype,s=a.hasOwnProperty,u=a.propertyIsEnumerable;e.exports=r},function(e,t,n){"use strict";var r=n(292),i=n(299),o=n(295),a="[object Array]",s=Object.prototype,u=s.toString,c=r(Array,"isArray"),l=c||function(e){return o(e)&&i(e.length)&&u.call(e)==a};e.exports=l},function(e){"use strict";function t(e,t){return e="number"==typeof e||n.test(e)?+e:-1,t=null==t?r:t,e>-1&&e%1==0&&t>e}var n=/^\d+$/,r=9007199254740991;e.exports=t},function(e,t,n){"use strict";function r(e){if(null==e)return[];u(e)||(e=Object(e));var t=e.length;t=t&&s(t)&&(o(e)||i(e))&&t||0;for(var n=e.constructor,r=-1,c="function"==typeof n&&n.prototype===e,f=Array(t),p=t>0;++r<t;)f[r]=r+"";for(var d in e)p&&a(d,t)||"constructor"==d&&(c||!l.call(e,d))||f.push(d);return f}var i=n(301),o=n(302),a=n(303),s=n(299),u=n(290),c=Object.prototype,l=c.hasOwnProperty;e.exports=r},function(e,t,n){"use strict";function r(e,t){return function(n,r){var s=n?i(n):0;if(!o(s))return e(n,r);for(var u=t?s:-1,c=a(n);(t?u--:++u<s)&&r(c[u],u,c)!==!1;);return n}}var i=n(297),o=n(299),a=n(289);e.exports=r},function(e,t,n){"use strict";function r(e,t){return function(n,r,a){return"function"==typeof r&&void 0===a&&o(n)?e(n,r):t(n,i(r,a,3))}}var i=n(307),o=n(302);e.exports=r},function(e,t,n){"use strict";function r(e,t,n){if("function"!=typeof e)return i;if(void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 3:return function(n,r,i){return e.call(t,n,r,i)};case 4:return function(n,r,i,o){return e.call(t,n,r,i,o)};case 5:return function(n,r,i,o,a){return e.call(t,n,r,i,o,a)}}return function(){return e.apply(t,arguments)}}var i=n(308);e.exports=r},function(e){"use strict";function t(e){return e}e.exports=t},function(e,t,n){"use strict";var r=n(310),i=n(318),o=i(r);e.exports=o},function(e,t,n){"use strict";function r(e,t,n,p,d){if(!u(e))return e;var h=s(t)&&(a(t)||l(t)),m=h?void 0:f(t);return i(m||t,function(i,a){if(m&&(a=i,i=t[a]),c(i))p||(p=[]),d||(d=[]),o(e,t,a,r,n,p,d);else{var s=e[a],u=n?n(s,i,a,e,t):void 0,l=void 0===u;l&&(u=i),void 0===u&&(!h||a in e)||!l&&(u===u?u===s:s!==s)||(e[a]=u)}}),e}var i=n(284),o=n(311),a=n(302),s=n(296),u=n(290),c=n(295),l=n(315),f=n(291);e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,f,p,d){for(var h=p.length,m=t[n];h--;)if(p[h]==m)return void(e[n]=d[h]);var v=e[n],g=f?f(v,m,n,e,t):void 0,y=void 0===g;y&&(g=m,s(m)&&(a(m)||c(m))?g=a(v)?v:s(v)?i(v):[]:u(m)||o(m)?g=o(v)?l(v):u(v)?v:{}:y=!1),p.push(m),d.push(g),y?e[n]=r(g,m,f,p,d):(g===g?g!==v:v===v)&&(e[n]=g)}var i=n(312),o=n(301),a=n(302),s=n(296),u=n(313),c=n(315),l=n(316);e.exports=r},function(e){"use strict";function t(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}e.exports=t},function(e,t,n){"use strict";function r(e){var t;if(!a(e)||l.call(e)!=s||o(e)||!c.call(e,"constructor")&&(t=e.constructor,"function"==typeof t&&!(t instanceof t)))return!1;var n;return i(e,function(e,t){n=t}),void 0===n||c.call(e,n)}var i=n(314),o=n(301),a=n(295),s="[object Object]",u=Object.prototype,c=u.hasOwnProperty,l=u.toString;e.exports=r},function(e,t,n){"use strict";function r(e,t){return i(e,t,o)}var i=n(287),o=n(304);e.exports=r},function(e,t,n){"use strict";function r(e){return o(e)&&i(e.length)&&!!T[R.call(e)]}var i=n(299),o=n(295),a="[object Arguments]",s="[object Array]",u="[object Boolean]",c="[object Date]",l="[object Error]",f="[object Function]",p="[object Map]",d="[object Number]",h="[object Object]",m="[object RegExp]",v="[object Set]",g="[object String]",y="[object WeakMap]",b="[object ArrayBuffer]",x="[object Float32Array]",w="[object Float64Array]",_="[object Int8Array]",C="[object Int16Array]",$="[object Int32Array]",S="[object Uint8Array]",E="[object Uint8ClampedArray]",P="[object Uint16Array]",k="[object Uint32Array]",T={};T[x]=T[w]=T[_]=T[C]=T[$]=T[S]=T[E]=T[P]=T[k]=!0,T[a]=T[s]=T[b]=T[u]=T[c]=T[l]=T[f]=T[p]=T[d]=T[h]=T[m]=T[v]=T[g]=T[y]=!1;var O=Object.prototype,R=O.toString;e.exports=r},function(e,t,n){"use strict";function r(e){return i(e,o(e))}var i=n(317),o=n(304);e.exports=r},function(e){"use strict";function t(e,t,n){n||(n={});for(var r=-1,i=t.length;++r<i;){var o=t[r];n[o]=e[o]}return n}e.exports=t},function(e,t,n){"use strict";function r(e){return a(function(t,n){var r=-1,a=null==t?0:n.length,s=a>2?n[a-2]:void 0,u=a>2?n[2]:void 0,c=a>1?n[a-1]:void 0;for("function"==typeof s?(s=i(s,c,5),a-=2):(s="function"==typeof c?c:void 0,a-=s?1:0),u&&o(n[0],n[1],u)&&(s=3>a?void 0:s,a=1);++r<a;){var l=n[r];l&&e(t,l,s)}return t})}var i=n(307),o=n(319),a=n(320);e.exports=r},function(e,t,n){"use strict";function r(e,t,n){if(!s(n))return!1;var r="undefined"==typeof t?"undefined":i(t);if("number"==r?o(n)&&a(t,n.length):"string"==r&&t in n){var u=n[t];return e===e?e===u:u!==u}return!1}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=n(296),a=n(303),s=n(290);e.exports=r},function(e){"use strict";function t(e,t){if("function"!=typeof e)throw new TypeError(n);return t=r(void 0===t?e.length-1:+t||0,0),function(){for(var n=arguments,i=-1,o=r(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];switch(t){case 0:return e.call(this,a);case 1:return e.call(this,n[0],a);case 2:return e.call(this,n[0],n[1],a)}var s=Array(t+1);for(i=-1;++i<t;)s[i]=n[i];return s[t]=a,e.apply(this,s)}}var n="Expected a function",r=Math.max;e.exports=t},function(e,t,n){"use strict";var r=n(322),i=n(324),o=n(320),a=o(function(e){return i(r(e,!1,!0))});e.exports=a},function(e,t,n){"use strict";function r(e,t,n,c){c||(c=[]);for(var l=-1,f=e.length;++l<f;){var p=e[l];u(p)&&s(p)&&(n||a(p)||o(p))?t?r(p,t,n,c):i(c,p):n||(c[c.length]=p)}return c}var i=n(323),o=n(301),a=n(302),s=n(296),u=n(295);e.exports=r},function(e){"use strict";function t(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}e.exports=t},function(e,t,n){"use strict";function r(e,t){var n=-1,r=i,u=e.length,c=!0,l=c&&u>=s,f=l?a():null,p=[];f?(r=o,c=!1):(l=!1,f=t?[]:p);e:for(;++n<u;){var d=e[n],h=t?t(d,n,e):d;if(c&&d===d){for(var m=f.length;m--;)if(f[m]===h)continue e;t&&f.push(h),p.push(d)}else r(f,h,0)<0&&((t||l)&&f.push(h),p.push(d))}return p}var i=n(325),o=n(327),a=n(328),s=200;e.exports=r},function(e,t,n){"use strict";function r(e,t,n){if(t!==t)return i(e,n);for(var r=n-1,o=e.length;++r<o;)if(e[r]===t)return r;return-1}var i=n(326);e.exports=r},function(e){"use strict";function t(e,t,n){for(var r=e.length,i=t+(n?0:-1);n?i--:++i<r;){var o=e[i];if(o!==o)return i}return-1}e.exports=t},function(e,t,n){"use strict";function r(e,t){var n=e.data,r="string"==typeof t||i(t)?n.set.has(t):n.hash[t];return r?0:-1}var i=n(290);e.exports=r},function(e,t,n){(function(t){"use strict";function r(e){return s&&a?new i(e):null}var i=n(329),o=n(292),a=o(t,"Set"),s=o(Object,"create");e.exports=r}).call(t,function(){return this}())},function(e,t,n){(function(t){"use strict";function r(e){var t=e?e.length:0;for(this.data={hash:s(null),set:new a};t--;)this.push(e[t])}var i=n(330),o=n(292),a=o(t,"Set"),s=o(Object,"create");r.prototype.push=i,e.exports=r}).call(t,function(){return this}())},function(e,t,n){"use strict";function r(e){var t=this.data;"string"==typeof e||i(e)?t.set.add(e):t.hash[e]=!0}var i=n(290);e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){return t&&"boolean"!=typeof t&&a(e,t,n)?t=!1:"function"==typeof t&&(r=n,n=t,t=!1),"function"==typeof n?i(e,t,o(n,r,3)):i(e,t)}var i=n(332),o=n(307),a=n(319);e.exports=r},function(e,t,n){"use strict";function r(e,t,n,h,m,v,g){var b;if(n&&(b=m?n(e,h,m):n(e)),void 0!==b)return b;if(!p(e))return e;var x=f(e);if(x){if(b=u(e),!t)return i(e,b)}else{var _=F.call(e),C=_==y;if(_!=w&&_!=d&&(!C||m))return D[_]?c(e,_,t):m?e:{};if(b=l(C?{}:e),!t)return a(b,e)}v||(v=[]),g||(g=[]);for(var $=v.length;$--;)if(v[$]==e)return g[$];return v.push(e),g.push(b),(x?o:s)(e,function(i,o){b[o]=r(i,t,n,o,e,v,g)}),b}var i=n(312),o=n(284),a=n(333),s=n(286),u=n(334),c=n(335),l=n(337),f=n(302),p=n(290),d="[object Arguments]",h="[object Array]",m="[object Boolean]",v="[object Date]",g="[object Error]",y="[object Function]",b="[object Map]",x="[object Number]",w="[object Object]",_="[object RegExp]",C="[object Set]",$="[object String]",S="[object WeakMap]",E="[object ArrayBuffer]",P="[object Float32Array]",k="[object Float64Array]",T="[object Int8Array]",O="[object Int16Array]",R="[object Int32Array]",N="[object Uint8Array]",A="[object Uint8ClampedArray]",j="[object Uint16Array]",M="[object Uint32Array]",D={};D[d]=D[h]=D[E]=D[m]=D[v]=D[P]=D[k]=D[T]=D[O]=D[R]=D[x]=D[w]=D[_]=D[$]=D[N]=D[A]=D[j]=D[M]=!0,D[g]=D[y]=D[b]=D[C]=D[S]=!1;var I=Object.prototype,F=I.toString;e.exports=r},function(e,t,n){"use strict";function r(e,t){return null==t?e:i(t,o(t),e)}var i=n(317),o=n(291);e.exports=r},function(e){"use strict";function t(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&r.call(e,"index")&&(n.index=e.index,n.input=e.input),n}var n=Object.prototype,r=n.hasOwnProperty;e.exports=t},function(e,t,n){"use strict";function r(e,t,n){var r=e.constructor;switch(t){case l:return i(e);case o:case a:return new r(+e);case f:case p:case d:case h:case m:case v:case g:case y:case b:var w=e.buffer;return new r(n?i(w):w,e.byteOffset,e.length);case s:case c:return new r(e);case u:var _=new r(e.source,x.exec(e));_.lastIndex=e.lastIndex}return _}var i=n(336),o="[object Boolean]",a="[object Date]",s="[object Number]",u="[object RegExp]",c="[object String]",l="[object ArrayBuffer]",f="[object Float32Array]",p="[object Float64Array]",d="[object Int8Array]",h="[object Int16Array]",m="[object Int32Array]",v="[object Uint8Array]",g="[object Uint8ClampedArray]",y="[object Uint16Array]",b="[object Uint32Array]",x=/\w*$/;
14
-
15
- e.exports=r},function(e,t){(function(t){"use strict";function n(e){var t=new r(e.byteLength),n=new i(t);return n.set(new i(e)),t}var r=t.ArrayBuffer,i=t.Uint8Array;e.exports=n}).call(t,function(){return this}())},function(e){"use strict";function t(e){var t=e.constructor;return"function"==typeof t&&t instanceof t||(t=Object),new t}e.exports=t},function(e){"use strict";function t(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function r(e){return"number"==typeof e}function i(e){return"object"===("undefined"==typeof e?"undefined":a(e))&&null!==e}function o(e){return void 0===e}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};e.exports=t,t.EventEmitter=t,t.prototype._events=void 0,t.prototype._maxListeners=void 0,t.defaultMaxListeners=10,t.prototype.setMaxListeners=function(e){if(!r(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},t.prototype.emit=function(e){var t,r,a,s,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[e],o(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(i(r))for(s=Array.prototype.slice.call(arguments,1),c=r.slice(),a=c.length,u=0;a>u;u++)c[u].apply(this,s);return!0},t.prototype.addListener=function(e,r){var a;if(!n(r))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(r.listener)?r.listener:r),this._events[e]?i(this._events[e])?this._events[e].push(r):this._events[e]=[this._events[e],r]:this._events[e]=r,i(this._events[e])&&!this._events[e].warned&&(a=o(this._maxListeners)?t.defaultMaxListeners:this._maxListeners,a&&a>0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},t.prototype.on=t.prototype.addListener,t.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},t.prototype.removeListener=function(e,t){var r,o,a,s;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],a=r.length,o=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(r)){for(s=a;s-->0;)if(r[s]===t||r[s].listener&&r[s].listener===t){o=s;break}if(0>o)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},t.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},t.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},t.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},t.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){var t=e;return function(){var e=Date.now(),n=e-t;return t=e,n}}function a(e){return s()+window.location.pathname+e}function s(){return window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}function u(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.useHash||!1,n=t?_:C;return new $(n,e)}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(101),f=r(l),p=n(340),d=r(p),h=n(272),m=r(h),v=n(341),g=r(v),y=n(309),b=r(y),x=f["default"].AlgoliaSearchHelper,w=d["default"].split(".")[0],_={character:"#",onpopstate:function(e){window.addEventListener("hashchange",e)},pushState:function(e){window.location.assign(a(this.createURL(e)))},replaceState:function(e){window.location.replace(a(this.createURL(e)))},createURL:function(e){return window.location.search+this.character+e},readUrl:function(){return window.location.hash.slice(1)}},C={character:"?",onpopstate:function(e){window.addEventListener("popstate",e)},pushState:function(e){window.history.pushState(null,"",a(this.createURL(e)))},replaceState:function(e){window.history.replaceState(null,"",a(this.createURL(e)))},createURL:function(e){return this.character+e+document.location.hash},readUrl:function(){return window.location.search.slice(1)}},$=function(){function e(t,n){i(this,e),this.urlUtils=t,this.originalConfig=null,this.timer=o(Date.now()),this.threshold=n.threshold||700,this.trackedParameters=n.trackedParameters||["query","attribute:*","index","page","hitsPerPage"]}return c(e,[{key:"getConfiguration",value:function(e){this.originalConfig=e;var t=this.urlUtils.readUrl(),n=x.getConfigurationFromQueryString(t);return n}},{key:"init",value:function(e){var t=this,n=e.helper;n.on("change",function(e){t.renderURLFromState(e)}),this.onHistoryChange(this.onPopState.bind(this,n))}},{key:"onPopState",value:function(e,t){var n=e.getState(this.trackedParameters),r=b["default"]({},this.originalConfig,n);g["default"](r,t)||e.overrideStateWithoutTriggeringChangeEvent(t).search()}},{key:"renderURLFromState",value:function(e){var t=this.urlUtils.readUrl(),n=x.getForeignConfigurationInQueryString(t);n.is_v=w;var r=m["default"].getQueryStringFromState(e.filter(this.trackedParameters),{moreAttributes:n});this.timer()<this.threshold?this.urlUtils.replaceState(r):this.urlUtils.pushState(r)}},{key:"createURL",value:function(e){var t=this.urlUtils.readUrl(),n=e.filter(this.trackedParameters),r=f["default"].url.getUnrecognizedParametersInQueryString(t);return r.is_v=w,this.urlUtils.createURL(f["default"].url.getQueryStringFromState(n))}},{key:"onHistoryChange",value:function(e){var t=this;this.urlUtils.onpopstate(function(){var n=t.urlUtils.readUrl(),r=x.getConfigurationFromQueryString(n),i=b["default"]({},t.originalConfig,r);e(i)})}}]),e}();t["default"]=u},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]="1.3.3"},function(e,t,n){"use strict";function r(e,t,n,r){n="function"==typeof n?o(n,r,3):void 0;var a=n?n(e,t):void 0;return void 0===a?i(e,t,n):!!a}var i=n(342),o=n(307);e.exports=r},function(e,t,n){"use strict";function r(e,t,n,s,u,c){return e===t?!0:null==e||null==t||!o(e)&&!a(t)?e!==e&&t!==t:i(e,t,r,n,s,u,c)}var i=n(343),o=n(290),a=n(295);e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,p,m,v){var g=s(e),y=s(t),b=l,x=l;g||(b=h.call(e),b==c?b=f:b!=f&&(g=u(e))),y||(x=h.call(t),x==c?x=f:x!=f&&(y=u(t)));var w=b==f,_=x==f,C=b==x;if(C&&!g&&!w)return o(e,t,b);if(!p){var $=w&&d.call(e,"__wrapped__"),S=_&&d.call(t,"__wrapped__");if($||S)return n($?e.value():e,S?t.value():t,r,p,m,v)}if(!C)return!1;m||(m=[]),v||(v=[]);for(var E=m.length;E--;)if(m[E]==e)return v[E]==t;m.push(e),v.push(t);var P=(g?i:a)(e,t,n,r,p,m,v);return m.pop(),v.pop(),P}var i=n(344),o=n(346),a=n(347),s=n(302),u=n(315),c="[object Arguments]",l="[object Array]",f="[object Object]",p=Object.prototype,d=p.hasOwnProperty,h=p.toString;e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,o,a,s){var u=-1,c=e.length,l=t.length;if(c!=l&&!(o&&l>c))return!1;for(;++u<c;){var f=e[u],p=t[u],d=r?r(o?p:f,o?f:p,u):void 0;if(void 0!==d){if(d)continue;return!1}if(o){if(!i(t,function(e){return f===e||n(f,e,r,o,a,s)}))return!1}else if(f!==p&&!n(f,p,r,o,a,s))return!1}return!0}var i=n(345);e.exports=r},function(e){"use strict";function t(e,t){for(var n=-1,r=e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}e.exports=t},function(e){"use strict";function t(e,t,u){switch(u){case n:case r:return+e==+t;case i:return e.name==t.name&&e.message==t.message;case o:return e!=+e?t!=+t:e==+t;case a:case s:return e==t+""}return!1}var n="[object Boolean]",r="[object Date]",i="[object Error]",o="[object Number]",a="[object RegExp]",s="[object String]";e.exports=t},function(e,t,n){"use strict";function r(e,t,n,r,o,s,u){var c=i(e),l=c.length,f=i(t),p=f.length;if(l!=p&&!o)return!1;for(var d=l;d--;){var h=c[d];if(!(o?h in t:a.call(t,h)))return!1}for(var m=o;++d<l;){h=c[d];var v=e[h],g=t[h],y=r?r(o?g:v,o?v:g,h):void 0;if(!(void 0===y?n(v,g,r,o,s,u):y))return!1;m||(m="constructor"==h)}if(!m){var b=e.constructor,x=t.constructor;if(b!=x&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x))return!1}return!0}var i=n(291),o=Object.prototype,a=o.hasOwnProperty;e.exports=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=function(e){var t=e.numberLocale;return{formatNumber:function(e,n){return Number(n(e)).toLocaleString(t)}}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.templates,r=void 0===n?g["default"]:n,i=e.cssClasses,a=void 0===i?{}:i,s=e.collapsible,l=void 0===s?!1:s,p=e.autoHideContainer,h=void 0===p?!0:p;if(!t)throw new Error(w);var v=c.getContainerNode(t),y=m["default"](b["default"]);h===!0&&(y=d["default"](y));var _={root:f["default"](x(null),a.root),header:f["default"](x("header"),a.header),body:f["default"](x("body"),a.body),footer:f["default"](x("footer"),a.footer),link:f["default"](x("link"),a.link)};return{init:function(e){var t=e.helper,n=e.templatesConfig;this._clearRefinementsAndSearch=c.clearRefinementsAndSearch.bind(null,t),this._templateProps=c.prepareTemplateProps({defaultTemplates:g["default"],templatesConfig:n,templates:r})},render:function(e){var t=e.results,n=e.state,r=e.createURL,i=0!==c.getRefinements(t,n).length,a=r(c.clearRefinementsFromState(n));u["default"].render(o(y,{clearAll:this._clearRefinementsAndSearch,collapsible:l,cssClasses:_,hasRefinements:i,shouldAutoHideContainer:!i,templateProps:this._templateProps,url:a}),v)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),a=n(350),s=(r(a),n(502)),u=r(s),c=n(503),l=n(534),f=r(l),p=n(536),d=r(p),h=n(537),m=r(h),v=n(571),g=r(v),y=n(572),b=r(y),x=c.bemHelper("ais-clear-all"),w="Usage:\nclearAll({\n container,\n [ cssClasses.{root,header,body,footer,link}={} ],\n [ templates.{header,link,footer}={header: '', link: 'Clear all', footer: ''} ],\n [ autoHideContainer=true ],\n [ collapsible=false ]\n})";t["default"]=i},function(e,t,n){"use strict";e.exports=n(351)},function(e,t,n){"use strict";var r=n(352),i=n(492),o=n(496),a=n(387),s=n(501),u={};a(u,o),a(u,{findDOMNode:s("findDOMNode","ReactDOM","react-dom",r,r.findDOMNode),render:s("render","ReactDOM","react-dom",r,r.render),unmountComponentAtNode:s("unmountComponentAtNode","ReactDOM","react-dom",r,r.unmountComponentAtNode),renderToString:s("renderToString","ReactDOMServer","react-dom/server",i,i.renderToString),renderToStaticMarkup:s("renderToStaticMarkup","ReactDOMServer","react-dom/server",i,i.renderToStaticMarkup)}),u.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=r,u.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=i,e.exports=u},function(e,t,n){"use strict";{var r=n(353),i=n(354),o=n(419),a=n(393),s=n(376),u=n(366),c=n(398),l=n(402),f=n(490),p=n(439),d=n(491);n(373)}o.inject();var h=u.measure("React","render",s.render),m={findDOMNode:p,render:h,unmountComponentAtNode:s.unmountComponentAtNode,version:f,unstable_batchedUpdates:l.batchedUpdates,unstable_renderSubtreeIntoContainer:d};"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:r,InstanceHandles:a,Mount:s,Reconciler:c,TextComponent:i});e.exports=m},function(e){"use strict";var t={current:null};e.exports=t},function(e,t,n){"use strict";var r=n(355),i=n(370),o=n(374),a=n(376),s=n(387),u=n(369),c=n(368),l=(n(418),function(){});s(l.prototype,{construct:function(e){this._currentElement=e,this._stringText=""+e,this._rootNodeID=null,this._mountIndex=0},mountComponent:function(e,t,n){if(this._rootNodeID=e,t.useCreateElement){var r=n[a.ownerDocumentContextKey],o=r.createElement("span");return i.setAttributeForID(o,e),a.getID(o),c(o,this._stringText),o}var s=u(this._stringText);return t.renderToStaticMarkup?s:"<span "+i.createMarkupForID(e)+">"+s+"</span>"},receiveComponent:function(e){if(e!==this._currentElement){this._currentElement=e;var t=""+e;if(t!==this._stringText){this._stringText=t;var n=a.getNode(this._rootNodeID);r.updateTextContent(n,t)}}},unmountComponent:function(){o.unmountIDFromEnvironment(this._rootNodeID)}}),e.exports=l},function(e,t,n){"use strict";function r(e,t,n){var r=n>=e.childNodes.length?null:e.childNodes.item(n);e.insertBefore(t,r)}var i=n(356),o=n(364),a=n(366),s=n(367),u=n(368),c=n(361),l={dangerouslyReplaceNodeWithMarkup:i.dangerouslyReplaceNodeWithMarkup,updateTextContent:u,processUpdates:function(e,t){for(var n,a=null,l=null,f=0;f<e.length;f++)if(n=e[f],n.type===o.MOVE_EXISTING||n.type===o.REMOVE_NODE){var p=n.fromIndex,d=n.parentNode.childNodes[p],h=n.parentID;d?void 0:c(!1),a=a||{},a[h]=a[h]||[],a[h][p]=d,l=l||[],l.push(d)}var m;if(m=t.length&&"string"==typeof t[0]?i.dangerouslyRenderMarkup(t):t,l)for(var v=0;v<l.length;v++)l[v].parentNode.removeChild(l[v]);for(var g=0;g<e.length;g++)switch(n=e[g],n.type){case o.INSERT_MARKUP:r(n.parentNode,m[n.markupIndex],n.toIndex);break;case o.MOVE_EXISTING:r(n.parentNode,a[n.parentID][n.fromIndex],n.toIndex);break;case o.SET_MARKUP:s(n.parentNode,n.content);break;case o.TEXT_CONTENT:u(n.parentNode,n.content);break;case o.REMOVE_NODE:}}};a.measureMethods(l,"DOMChildrenOperations",{updateTextContent:"updateTextContent"}),e.exports=l},function(e,t,n){"use strict";function r(e){return e.substring(1,e.indexOf(" "))}var i=n(357),o=n(358),a=n(363),s=n(362),u=n(361),c=/^(<[^ \/>]+)/,l="data-danger-index",f={dangerouslyRenderMarkup:function(e){i.canUseDOM?void 0:u(!1);for(var t,n={},f=0;f<e.length;f++)e[f]?void 0:u(!1),t=r(e[f]),t=s(t)?t:"*",n[t]=n[t]||[],n[t][f]=e[f];var p=[],d=0;for(t in n)if(n.hasOwnProperty(t)){var h,m=n[t];for(h in m)if(m.hasOwnProperty(h)){var v=m[h];m[h]=v.replace(c,"$1 "+l+'="'+h+'" ')}for(var g=o(m.join(""),a),y=0;y<g.length;++y){var b=g[y];b.hasAttribute&&b.hasAttribute(l)&&(h=+b.getAttribute(l),b.removeAttribute(l),p.hasOwnProperty(h)?u(!1):void 0,p[h]=b,d+=1)}}return d!==p.length?u(!1):void 0,p.length!==e.length?u(!1):void 0,p},dangerouslyReplaceNodeWithMarkup:function(e,t){i.canUseDOM?void 0:u(!1),t?void 0:u(!1),"html"===e.tagName.toLowerCase()?u(!1):void 0;var n;n="string"==typeof t?o(t,a)[0]:t,e.parentNode.replaceChild(n,e)}};e.exports=f},function(e){"use strict";var t=!("undefined"==typeof window||!window.document||!window.document.createElement),n={canUseDOM:t,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:t&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:t&&!!window.screen,isInWorker:!t};e.exports=n},function(e,t,n){"use strict";function r(e){var t=e.match(l);return t&&t[1].toLowerCase()}function i(e,t){var n=c;c?void 0:u(!1);var i=r(e),o=i&&s(i);if(o){n.innerHTML=o[1]+e+o[2];for(var l=o[0];l--;)n=n.lastChild}else n.innerHTML=e;var f=n.getElementsByTagName("script");f.length&&(t?void 0:u(!1),a(f).forEach(t));for(var p=a(n.childNodes);n.lastChild;)n.removeChild(n.lastChild);return p}var o=n(357),a=n(359),s=n(362),u=n(361),c=o.canUseDOM?document.createElement("div"):null,l=/^\s*<(\w+)/;e.exports=i},function(e,t,n){"use strict";function r(e){return!!e&&("object"==("undefined"==typeof e?"undefined":o(e))||"function"==typeof e)&&"length"in e&&!("setInterval"in e)&&"number"!=typeof e.nodeType&&(Array.isArray(e)||"callee"in e||"item"in e)}function i(e){return r(e)?Array.isArray(e)?e.slice():a(e):[e]}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},a=n(360);e.exports=i},function(e,t,n){"use strict";function r(e){var t=e.length;if(Array.isArray(e)||"object"!==("undefined"==typeof e?"undefined":i(e))&&"function"!=typeof e?o(!1):void 0,"number"!=typeof t?o(!1):void 0,0===t||t-1 in e?void 0:o(!1),e.hasOwnProperty)try{return Array.prototype.slice.call(e)}catch(n){}for(var r=Array(t),a=0;t>a;a++)r[a]=e[a];return r}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=n(361);e.exports=r},function(e){"use strict";function t(e,t,n,r,i,o,a,s){if(!e){var u;if(void 0===t)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,i,o,a,s],l=0;u=new Error(t.replace(/%s/g,function(){return c[l++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}}e.exports=t},function(e,t,n){"use strict";function r(e){return a?void 0:o(!1),p.hasOwnProperty(e)||(e="*"),s.hasOwnProperty(e)||(a.innerHTML="*"===e?"<link />":"<"+e+"></"+e+">",s[e]=!a.firstChild),s[e]?p[e]:null}var i=n(357),o=n(361),a=i.canUseDOM?document.createElement("div"):null,s={},u=[1,'<select multiple="true">',"</select>"],c=[1,"<table>","</table>"],l=[3,"<table><tbody><tr>","</tr></tbody></table>"],f=[1,'<svg xmlns="http://www.w3.org/2000/svg">',"</svg>"],p={"*":[1,"?<div>","</div>"],area:[1,"<map>","</map>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],legend:[1,"<fieldset>","</fieldset>"],param:[1,"<object>","</object>"],tr:[2,"<table><tbody>","</tbody></table>"],optgroup:u,option:u,caption:c,colgroup:c,tbody:c,tfoot:c,thead:c,td:l,th:l},d=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];d.forEach(function(e){p[e]=f,s[e]=!0}),e.exports=r},function(e){"use strict";function t(e){return function(){return e}}function n(){}n.thatReturns=t,n.thatReturnsFalse=t(!1),n.thatReturnsTrue=t(!0),n.thatReturnsNull=t(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(e){return e},e.exports=n},function(e,t,n){"use strict";var r=n(365),i=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,SET_MARKUP:null,TEXT_CONTENT:null});e.exports=i},function(e,t,n){"use strict";var r=n(361),i=function(e){var t,n={};e instanceof Object&&!Array.isArray(e)?void 0:r(!1);for(t in e)e.hasOwnProperty(t)&&(n[t]=t);return n};e.exports=i},function(e){"use strict";function t(e,t,n){return n}var n={enableMeasure:!1,storedMeasure:t,measureMethods:function(e,t,n){},measure:function(e,t,n){return n},injection:{injectMeasure:function(e){n.storedMeasure=e}}};e.exports=n},function(e,t,n){"use strict";var r=n(357),i=/^[ \r\n\t\f]/,o=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,a=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(a=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var s=document.createElement("div");s.innerHTML=" ",""===s.innerHTML&&(a=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),i.test(t)||"<"===t[0]&&o.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}e.exports=a},function(e,t,n){"use strict";var r=n(357),i=n(369),o=n(367),a=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(a=function(e,t){o(e,i(t))})),e.exports=a},function(e){"use strict";function t(e){return r[e]}function n(e){return(""+e).replace(i,t)}var r={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},i=/[&><"']/g;e.exports=n},function(e,t,n){"use strict";function r(e){return l.hasOwnProperty(e)?!0:c.hasOwnProperty(e)?!1:u.test(e)?(l[e]=!0,!0):(c[e]=!0,!1)}function i(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&1>t||e.hasOverloadedBooleanValue&&t===!1}var o=n(371),a=n(366),s=n(372),u=(n(373),/^[a-zA-Z_][\w\.\-]*$/),c={},l={},f={createMarkupForID:function(e){return o.ID_ATTRIBUTE_NAME+"="+s(e)},setAttributeForID:function(e,t){e.setAttribute(o.ID_ATTRIBUTE_NAME,t)},createMarkupForProperty:function(e,t){var n=o.properties.hasOwnProperty(e)?o.properties[e]:null;if(n){if(i(n,t))return"";var r=n.attributeName;return n.hasBooleanValue||n.hasOverloadedBooleanValue&&t===!0?r+'=""':r+"="+s(t)}return o.isCustomAttribute(e)?null==t?"":e+"="+s(t):null},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+s(t):""},setValueForProperty:function(e,t,n){var r=o.properties.hasOwnProperty(t)?o.properties[t]:null;if(r){var a=r.mutationMethod;if(a)a(e,n);else if(i(r,n))this.deleteValueForProperty(e,t);else if(r.mustUseAttribute){var s=r.attributeName,u=r.attributeNamespace;u?e.setAttributeNS(u,s,""+n):r.hasBooleanValue||r.hasOverloadedBooleanValue&&n===!0?e.setAttribute(s,""):e.setAttribute(s,""+n)}else{var c=r.propertyName;r.hasSideEffects&&""+e[c]==""+n||(e[c]=n)}}else o.isCustomAttribute(t)&&f.setValueForAttribute(e,t,n)},setValueForAttribute:function(e,t,n){r(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,t){var n=o.properties.hasOwnProperty(t)?o.properties[t]:null;if(n){var r=n.mutationMethod;if(r)r(e,void 0);else if(n.mustUseAttribute)e.removeAttribute(n.attributeName);else{var i=n.propertyName,a=o.getDefaultValueForProperty(e.nodeName,i);n.hasSideEffects&&""+e[i]===a||(e[i]=a)}}else o.isCustomAttribute(t)&&e.removeAttribute(t)}};a.measureMethods(f,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),e.exports=f},function(e,t,n){"use strict";function r(e,t){return(e&t)===t}var i=n(361),o={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var t=o,n=e.Properties||{},a=e.DOMAttributeNamespaces||{},u=e.DOMAttributeNames||{},c=e.DOMPropertyNames||{},l=e.DOMMutationMethods||{};e.isCustomAttribute&&s._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var f in n){s.properties.hasOwnProperty(f)?i(!1):void 0;var p=f.toLowerCase(),d=n[f],h={attributeName:p,attributeNamespace:null,propertyName:f,mutationMethod:null,mustUseAttribute:r(d,t.MUST_USE_ATTRIBUTE),mustUseProperty:r(d,t.MUST_USE_PROPERTY),hasSideEffects:r(d,t.HAS_SIDE_EFFECTS),hasBooleanValue:r(d,t.HAS_BOOLEAN_VALUE),hasNumericValue:r(d,t.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(d,t.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(d,t.HAS_OVERLOADED_BOOLEAN_VALUE)};if(h.mustUseAttribute&&h.mustUseProperty?i(!1):void 0,!h.mustUseProperty&&h.hasSideEffects?i(!1):void 0,h.hasBooleanValue+h.hasNumericValue+h.hasOverloadedBooleanValue<=1?void 0:i(!1),u.hasOwnProperty(f)){var m=u[f];h.attributeName=m}a.hasOwnProperty(f)&&(h.attributeNamespace=a[f]),c.hasOwnProperty(f)&&(h.propertyName=c[f]),l.hasOwnProperty(f)&&(h.mutationMethod=l[f]),s.properties[f]=h}}},a={},s={ID_ATTRIBUTE_NAME:"data-reactid",properties:{},getPossibleStandardName:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t<s._isCustomAttributeFunctions.length;t++){var n=s._isCustomAttributeFunctions[t];if(n(e))return!0}return!1},getDefaultValueForProperty:function(e,t){var n,r=a[e];return r||(a[e]=r={}),t in r||(n=document.createElement(e),r[t]=n[t]),r[t]},injection:o};e.exports=s},function(e,t,n){"use strict";function r(e){return'"'+i(e)+'"'}var i=n(369);e.exports=r},function(e,t,n){"use strict";var r=n(363),i=r;e.exports=i},function(e,t,n){"use strict";var r=n(375),i=n(376),o={processChildrenUpdates:r.dangerouslyProcessChildrenUpdates,replaceNodeWithMarkupByID:r.dangerouslyReplaceNodeWithMarkupByID,unmountIDFromEnvironment:function(e){i.purgeID(e)}};e.exports=o},function(e,t,n){"use strict";var r=n(355),i=n(370),o=n(376),a=n(366),s=n(361),u={dangerouslySetInnerHTML:"`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.",style:"`style` must be set using `updateStylesByID()`."},c={updatePropertyByID:function(e,t,n){var r=o.getNode(e);u.hasOwnProperty(t)?s(!1):void 0,null!=n?i.setValueForProperty(r,t,n):i.deleteValueForProperty(r,t)},dangerouslyReplaceNodeWithMarkupByID:function(e,t){var n=o.getNode(e);r.dangerouslyReplaceNodeWithMarkup(n,t)},dangerouslyProcessChildrenUpdates:function(e,t){for(var n=0;n<e.length;n++)e[n].parentNode=o.getNode(e[n].parentID);r.processUpdates(e,t)}};a.measureMethods(c,"ReactDOMIDOperations",{dangerouslyReplaceNodeWithMarkupByID:"dangerouslyReplaceNodeWithMarkupByID",dangerouslyProcessChildrenUpdates:"dangerouslyProcessChildrenUpdates"}),e.exports=c},function(e,t,n){"use strict";function r(e,t){for(var n=Math.min(e.length,t.length),r=0;n>r;r++)if(e.charAt(r)!==t.charAt(r))return r;return e.length===t.length?-1:n}function i(e){return e?e.nodeType===V?e.documentElement:e.firstChild:null}function o(e){var t=i(e);return t&&Y.getID(t)}function a(e){var t=s(e);if(t)if(U.hasOwnProperty(t)){var n=U[t];n!==e&&(f(n,t)?D(!1):void 0,U[t]=e)}else U[t]=e;return t}function s(e){return e&&e.getAttribute&&e.getAttribute(L)||""}function u(e,t){var n=s(e);n!==t&&delete U[n],e.setAttribute(L,t),U[t]=e}function c(e){return U.hasOwnProperty(e)&&f(U[e],e)||(U[e]=Y.findReactNodeByID(e)),U[e]}function l(e){var t=E.get(e)._rootNodeID;return $.isNullComponentID(t)?null:(U.hasOwnProperty(t)&&f(U[t],t)||(U[t]=Y.findReactNodeByID(t)),U[t])}function f(e,t){if(e){s(e)!==t?D(!1):void 0;var n=Y.findReactContainerForID(t);if(n&&j(n,e))return!0}return!1}function p(e){delete U[e]}function d(e){var t=U[e];return t&&f(t,e)?void(Q=t):!1}function h(e){Q=null,S.traverseAncestors(e,d);var t=Q;return Q=null,t}function m(e,t,n,r,i,o){_.useCreateElement&&(o=N({},o),o[B]=n.nodeType===V?n:n.ownerDocument);var a=T.mountComponent(e,t,r,o);e._renderedComponent._topLevelWrapper=e,Y._mountImageIntoNode(a,n,i,r)}function v(e,t,n,r,i){var o=R.ReactReconcileTransaction.getPooled(r);o.perform(m,null,e,t,n,o,r,i),R.ReactReconcileTransaction.release(o)}function g(e,t){for(T.unmountComponent(e),t.nodeType===V&&(t=t.documentElement);t.lastChild;)t.removeChild(t.lastChild)}function y(e){var t=o(e);return t?t!==S.getReactRootIDFromNodeID(t):!1}function b(e){for(;e&&e.parentNode!==e;e=e.parentNode)if(1===e.nodeType){var t=s(e);if(t){var n,r=S.getReactRootIDFromNodeID(t),i=e;do if(n=s(i),i=i.parentNode,null==i)return null;while(n!==r);if(i===z[r])return e}}return null}var x=n(371),w=n(377),_=(n(353),n(389)),C=n(390),$=n(392),S=n(393),E=n(395),P=n(396),k=n(366),T=n(398),O=n(401),R=n(402),N=n(387),A=n(406),j=n(407),M=n(410),D=n(361),I=n(367),F=n(415),L=(n(418),n(373),x.ID_ATTRIBUTE_NAME),U={},H=1,V=9,q=11,B="__ReactMount_ownerDocument$"+Math.random().toString(36).slice(2),W={},z={},K=[],Q=null,G=function(){};G.prototype.isReactComponent={},G.prototype.render=function(){return this.props};var Y={TopLevelWrapper:G,_instancesByReactRootID:W,scrollMonitor:function(e,t){t()},_updateRootComponent:function(e,t,n,r){return Y.scrollMonitor(n,function(){O.enqueueElementInternal(e,t),r&&O.enqueueCallbackInternal(e,r)}),e},_registerComponent:function(e,t){!t||t.nodeType!==H&&t.nodeType!==V&&t.nodeType!==q?D(!1):void 0,w.ensureScrollValueMonitoring();var n=Y.registerContainer(t);return W[n]=e,n},_renderNewRootComponent:function(e,t,n,r){var i=M(e,null),o=Y._registerComponent(i,t);return R.batchedUpdates(v,i,o,t,n,r),i},renderSubtreeIntoContainer:function(e,t,n,r){return null==e||null==e._reactInternalInstance?D(!1):void 0,Y._renderSubtreeIntoContainer(e,t,n,r)},_renderSubtreeIntoContainer:function(e,t,n,r){C.isValidElement(t)?void 0:D(!1);var a=new C(G,null,null,null,null,null,t),u=W[o(n)];if(u){var c=u._currentElement,l=c.props;if(F(l,t)){var f=u._renderedComponent.getPublicInstance(),p=r&&function(){r.call(f)};return Y._updateRootComponent(u,a,n,p),f}Y.unmountComponentAtNode(n)}var d=i(n),h=d&&!!s(d),m=y(n),v=h&&!u&&!m,g=Y._renderNewRootComponent(a,n,v,null!=e?e._reactInternalInstance._processChildContext(e._reactInternalInstance._context):A)._renderedComponent.getPublicInstance();return r&&r.call(g),g},render:function(e,t,n){return Y._renderSubtreeIntoContainer(null,e,t,n)},registerContainer:function(e){var t=o(e);return t&&(t=S.getReactRootIDFromNodeID(t)),t||(t=S.createReactRootID()),z[t]=e,t},unmountComponentAtNode:function(e){!e||e.nodeType!==H&&e.nodeType!==V&&e.nodeType!==q?D(!1):void 0;var t=o(e),n=W[t];if(!n){{var r=(y(e),s(e));r&&r===S.getReactRootIDFromNodeID(r)}return!1}return R.batchedUpdates(g,n,e),delete W[t],delete z[t],!0},findReactContainerForID:function(e){var t=S.getReactRootIDFromNodeID(e),n=z[t];return n},findReactNodeByID:function(e){var t=Y.findReactContainerForID(e);return Y.findComponentRoot(t,e)},getFirstReactDOM:function(e){return b(e)},findComponentRoot:function(e,t){var n=K,r=0,i=h(t)||e;for(n[0]=i.firstChild,n.length=1;r<n.length;){for(var o,a=n[r++];a;){var s=Y.getID(a);s?t===s?o=a:S.isAncestorIDOf(s,t)&&(n.length=r=0,n.push(a.firstChild)):n.push(a.firstChild),a=a.nextSibling}if(o)return n.length=0,o}n.length=0,D(!1)},_mountImageIntoNode:function(e,t,n,o){if(!t||t.nodeType!==H&&t.nodeType!==V&&t.nodeType!==q?D(!1):void 0,n){var a=i(t);if(P.canReuseMarkup(e,a))return;var s=a.getAttribute(P.CHECKSUM_ATTR_NAME);a.removeAttribute(P.CHECKSUM_ATTR_NAME);var u=a.outerHTML;a.setAttribute(P.CHECKSUM_ATTR_NAME,s);{var c=e,l=r(c,u);" (client) "+c.substring(l-20,l+20)+"\n (server) "+u.substring(l-20,l+20)}t.nodeType===V?D(!1):void 0}if(t.nodeType===V?D(!1):void 0,o.useCreateElement){for(;t.lastChild;)t.removeChild(t.lastChild);t.appendChild(e)}else I(t,e)},ownerDocumentContextKey:B,getReactRootID:o,getID:a,setID:u,getNode:c,getNodeFromInstance:l,isValid:f,purgeID:p};k.measureMethods(Y,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),e.exports=Y},function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,v)||(e[v]=h++,p[e[v]]={}),p[e[v]]}var i=n(378),o=n(379),a=n(380),s=n(385),u=n(366),c=n(386),l=n(387),f=n(388),p={},d=!1,h=0,m={topAbort:"abort",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",
16
- topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},v="_reactListenersID"+String(Math.random()).slice(2),g=l({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(g.handleTopLevel),g.ReactEventListener=e}},setEnabled:function(e){g.ReactEventListener&&g.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!g.ReactEventListener||!g.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,o=r(n),s=a.registrationNameDependencies[e],u=i.topLevelTypes,c=0;c<s.length;c++){var l=s[c];o.hasOwnProperty(l)&&o[l]||(l===u.topWheel?f("wheel")?g.ReactEventListener.trapBubbledEvent(u.topWheel,"wheel",n):f("mousewheel")?g.ReactEventListener.trapBubbledEvent(u.topWheel,"mousewheel",n):g.ReactEventListener.trapBubbledEvent(u.topWheel,"DOMMouseScroll",n):l===u.topScroll?f("scroll",!0)?g.ReactEventListener.trapCapturedEvent(u.topScroll,"scroll",n):g.ReactEventListener.trapBubbledEvent(u.topScroll,"scroll",g.ReactEventListener.WINDOW_HANDLE):l===u.topFocus||l===u.topBlur?(f("focus",!0)?(g.ReactEventListener.trapCapturedEvent(u.topFocus,"focus",n),g.ReactEventListener.trapCapturedEvent(u.topBlur,"blur",n)):f("focusin")&&(g.ReactEventListener.trapBubbledEvent(u.topFocus,"focusin",n),g.ReactEventListener.trapBubbledEvent(u.topBlur,"focusout",n)),o[u.topBlur]=!0,o[u.topFocus]=!0):m.hasOwnProperty(l)&&g.ReactEventListener.trapBubbledEvent(l,m[l],n),o[l]=!0)}},trapBubbledEvent:function(e,t,n){return g.ReactEventListener.trapBubbledEvent(e,t,n)},trapCapturedEvent:function(e,t,n){return g.ReactEventListener.trapCapturedEvent(e,t,n)},ensureScrollValueMonitoring:function(){if(!d){var e=c.refreshScrollValues;g.ReactEventListener.monitorScrollValue(e),d=!0}},eventNameDispatchConfigs:o.eventNameDispatchConfigs,registrationNameModules:o.registrationNameModules,putListener:o.putListener,getListener:o.getListener,deleteListener:o.deleteListener,deleteAllListeners:o.deleteAllListeners});u.measureMethods(g,"ReactBrowserEventEmitter",{putListener:"putListener",deleteListener:"deleteListener"}),e.exports=g},function(e,t,n){"use strict";var r=n(365),i=r({bubbled:null,captured:null}),o=r({topAbort:null,topBlur:null,topCanPlay:null,topCanPlayThrough:null,topChange:null,topClick:null,topCompositionEnd:null,topCompositionStart:null,topCompositionUpdate:null,topContextMenu:null,topCopy:null,topCut:null,topDoubleClick:null,topDrag:null,topDragEnd:null,topDragEnter:null,topDragExit:null,topDragLeave:null,topDragOver:null,topDragStart:null,topDrop:null,topDurationChange:null,topEmptied:null,topEncrypted:null,topEnded:null,topError:null,topFocus:null,topInput:null,topKeyDown:null,topKeyPress:null,topKeyUp:null,topLoad:null,topLoadedData:null,topLoadedMetadata:null,topLoadStart:null,topMouseDown:null,topMouseMove:null,topMouseOut:null,topMouseOver:null,topMouseUp:null,topPaste:null,topPause:null,topPlay:null,topPlaying:null,topProgress:null,topRateChange:null,topReset:null,topScroll:null,topSeeked:null,topSeeking:null,topSelectionChange:null,topStalled:null,topSubmit:null,topSuspend:null,topTextInput:null,topTimeUpdate:null,topTouchCancel:null,topTouchEnd:null,topTouchMove:null,topTouchStart:null,topVolumeChange:null,topWaiting:null,topWheel:null}),a={topLevelTypes:o,PropagationPhases:i};e.exports=a},function(e,t,n){"use strict";var r=("function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},n(380)),i=n(381),o=n(382),a=n(383),s=n(384),u=n(361),c=(n(373),{}),l=null,f=function(e,t){e&&(i.executeDispatchesInOrder(e,t),e.isPersistent()||e.constructor.release(e))},p=function(e){return f(e,!0)},d=function(e){return f(e,!1)},h=null,m={injection:{injectMount:i.injection.injectMount,injectInstanceHandle:function(e){h=e},getInstanceHandle:function(){return h},injectEventPluginOrder:r.injectEventPluginOrder,injectEventPluginsByName:r.injectEventPluginsByName},eventNameDispatchConfigs:r.eventNameDispatchConfigs,registrationNameModules:r.registrationNameModules,putListener:function(e,t,n){"function"!=typeof n?u(!1):void 0;var i=c[t]||(c[t]={});i[e]=n;var o=r.registrationNameModules[t];o&&o.didPutListener&&o.didPutListener(e,t,n)},getListener:function(e,t){var n=c[t];return n&&n[e]},deleteListener:function(e,t){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t);var i=c[t];i&&delete i[e]},deleteAllListeners:function(e){for(var t in c)if(c[t][e]){var n=r.registrationNameModules[t];n&&n.willDeleteListener&&n.willDeleteListener(e,t),delete c[t][e]}},extractEvents:function(e,t,n,i,o){for(var s,u=r.plugins,c=0;c<u.length;c++){var l=u[c];if(l){var f=l.extractEvents(e,t,n,i,o);f&&(s=a(s,f))}}return s},enqueueEvents:function(e){e&&(l=a(l,e))},processEventQueue:function(e){var t=l;l=null,e?s(t,p):s(t,d),l?u(!1):void 0,o.rethrowCaughtError()},__purge:function(){c={}},__getListenerBank:function(){return c}};e.exports=m},function(e,t,n){"use strict";function r(){if(s)for(var e in u){var t=u[e],n=s.indexOf(e);if(n>-1?void 0:a(!1),!c.plugins[n]){t.extractEvents?void 0:a(!1),c.plugins[n]=t;var r=t.eventTypes;for(var o in r)i(r[o],t,o)?void 0:a(!1)}}}function i(e,t,n){c.eventNameDispatchConfigs.hasOwnProperty(n)?a(!1):void 0,c.eventNameDispatchConfigs[n]=e;var r=e.phasedRegistrationNames;if(r){for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];o(s,t,n)}return!0}return e.registrationName?(o(e.registrationName,t,n),!0):!1}function o(e,t,n){c.registrationNameModules[e]?a(!1):void 0,c.registrationNameModules[e]=t,c.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var a=n(361),s=null,u={},c={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){s?a(!1):void 0,s=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var i=e[n];u.hasOwnProperty(n)&&u[n]===i||(u[n]?a(!1):void 0,u[n]=i,t=!0)}t&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return c.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=c.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){s=null;for(var e in u)u.hasOwnProperty(e)&&delete u[e];c.plugins.length=0;var t=c.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=c.registrationNameModules;for(var i in r)r.hasOwnProperty(i)&&delete r[i]}};e.exports=c},function(e,t,n){"use strict";function r(e){return e===v.topMouseUp||e===v.topTouchEnd||e===v.topTouchCancel}function i(e){return e===v.topMouseMove||e===v.topTouchMove}function o(e){return e===v.topMouseDown||e===v.topTouchStart}function a(e,t,n,r){var i=e.type||"unknown-event";e.currentTarget=m.Mount.getNode(r),t?d.invokeGuardedCallbackWithCatch(i,n,e,r):d.invokeGuardedCallback(i,n,e,r),e.currentTarget=null}function s(e,t){var n=e._dispatchListeners,r=e._dispatchIDs;if(Array.isArray(n))for(var i=0;i<n.length&&!e.isPropagationStopped();i++)a(e,t,n[i],r[i]);else n&&a(e,t,n,r);e._dispatchListeners=null,e._dispatchIDs=null}function u(e){var t=e._dispatchListeners,n=e._dispatchIDs;if(Array.isArray(t)){for(var r=0;r<t.length&&!e.isPropagationStopped();r++)if(t[r](e,n[r]))return n[r]}else if(t&&t(e,n))return n;return null}function c(e){var t=u(e);return e._dispatchIDs=null,e._dispatchListeners=null,t}function l(e){var t=e._dispatchListeners,n=e._dispatchIDs;Array.isArray(t)?h(!1):void 0;var r=t?t(e,n):null;return e._dispatchListeners=null,e._dispatchIDs=null,r}function f(e){return!!e._dispatchListeners}var p=n(378),d=n(382),h=n(361),m=(n(373),{Mount:null,injectMount:function(e){m.Mount=e}}),v=p.topLevelTypes,g={isEndish:r,isMoveish:i,isStartish:o,executeDirectDispatch:l,executeDispatchesInOrder:s,executeDispatchesInOrderStopAtTrue:c,hasDispatches:f,getNode:function(e){return m.Mount.getNode(e)},getID:function(e){return m.Mount.getID(e)},injection:m};e.exports=g},function(e){"use strict";function t(e,t,r,i){try{return t(r,i)}catch(o){return void(null===n&&(n=o))}}var n=null,r={invokeGuardedCallback:t,invokeGuardedCallbackWithCatch:t,rethrowCaughtError:function(){if(n){var e=n;throw n=null,e}}};e.exports=r},function(e,t,n){"use strict";function r(e,t){if(null==t?i(!1):void 0,null==e)return t;var n=Array.isArray(e),r=Array.isArray(t);return n&&r?(e.push.apply(e,t),e):n?(e.push(t),e):r?[e].concat(t):[e,t]}var i=n(361);e.exports=r},function(e){"use strict";var t=function(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)};e.exports=t},function(e,t,n){"use strict";function r(e){i.enqueueEvents(e),i.processEventQueue(!1)}var i=n(379),o={handleTopLevel:function(e,t,n,o,a){var s=i.extractEvents(e,t,n,o,a);r(s)}};e.exports=o},function(e){"use strict";var t={currentScrollLeft:0,currentScrollTop:0,refreshScrollValues:function(e){t.currentScrollLeft=e.x,t.currentScrollTop=e.y}};e.exports=t},function(e){"use strict";function t(e){if(null==e)throw new TypeError("Object.assign target cannot be null or undefined");for(var t=Object(e),n=Object.prototype.hasOwnProperty,r=1;r<arguments.length;r++){var i=arguments[r];if(null!=i){var o=Object(i);for(var a in o)n.call(o,a)&&(t[a]=o[a])}}return t}e.exports=t},function(e,t,n){"use strict";function r(e,t){if(!o.canUseDOM||t&&!("addEventListener"in document))return!1;var n="on"+e,r=n in document;if(!r){var a=document.createElement("div");a.setAttribute(n,"return;"),r="function"==typeof a[n]}return!r&&i&&"wheel"===e&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var i,o=n(357);o.canUseDOM&&(i=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0),e.exports=r},function(e){"use strict";var t={useCreateElement:!1};e.exports=t},function(e,t,n){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},i=n(353),o=n(387),a=(n(391),"function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103),s={key:!0,ref:!0,__self:!0,__source:!0},u=function(e,t,n,r,i,o,s){var u={$$typeof:a,type:e,key:t,ref:n,props:s,_owner:o};return u};u.createElement=function(e,t,n){var r,o={},a=null,c=null,l=null,f=null;if(null!=t){c=void 0===t.ref?null:t.ref,a=void 0===t.key?null:""+t.key,l=void 0===t.__self?null:t.__self,f=void 0===t.__source?null:t.__source;for(r in t)t.hasOwnProperty(r)&&!s.hasOwnProperty(r)&&(o[r]=t[r])}var p=arguments.length-2;if(1===p)o.children=n;else if(p>1){for(var d=Array(p),h=0;p>h;h++)d[h]=arguments[h+2];o.children=d}if(e&&e.defaultProps){var m=e.defaultProps;for(r in m)"undefined"==typeof o[r]&&(o[r]=m[r])}return u(e,a,c,l,f,i.current,o)},u.createFactory=function(e){var t=u.createElement.bind(null,e);return t.type=e,t},u.cloneAndReplaceKey=function(e,t){var n=u(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n},u.cloneAndReplaceProps=function(e,t){var n=u(e.type,e.key,e.ref,e._self,e._source,e._owner,t);return n},u.cloneElement=function(e,t,n){var r,a=o({},e.props),c=e.key,l=e.ref,f=e._self,p=e._source,d=e._owner;if(null!=t){void 0!==t.ref&&(l=t.ref,d=i.current),void 0!==t.key&&(c=""+t.key);for(r in t)t.hasOwnProperty(r)&&!s.hasOwnProperty(r)&&(a[r]=t[r])}var h=arguments.length-2;if(1===h)a.children=n;else if(h>1){for(var m=Array(h),v=0;h>v;v++)m[v]=arguments[v+2];a.children=m}return u(e.type,c,l,f,p,d,a)},u.isValidElement=function(e){return"object"===("undefined"==typeof e?"undefined":r(e))&&null!==e&&e.$$typeof===a},e.exports=u},function(e){"use strict";var t=!1;e.exports=t},function(e){"use strict";function t(e){return!!i[e]}function n(e){i[e]=!0}function r(e){delete i[e]}var i={},o={isNullComponentID:t,registerNullComponentID:n,deregisterNullComponentID:r};e.exports=o},function(e,t,n){"use strict";function r(e){return d+e.toString(36)}function i(e,t){return e.charAt(t)===d||t===e.length}function o(e){return""===e||e.charAt(0)===d&&e.charAt(e.length-1)!==d}function a(e,t){return 0===t.indexOf(e)&&i(t,e.length)}function s(e){return e?e.substr(0,e.lastIndexOf(d)):""}function u(e,t){if(o(e)&&o(t)?void 0:p(!1),a(e,t)?void 0:p(!1),e===t)return e;var n,r=e.length+h;for(n=r;n<t.length&&!i(t,n);n++);return t.substr(0,n)}function c(e,t){var n=Math.min(e.length,t.length);if(0===n)return"";for(var r=0,a=0;n>=a;a++)if(i(e,a)&&i(t,a))r=a;else if(e.charAt(a)!==t.charAt(a))break;var s=e.substr(0,r);return o(s)?void 0:p(!1),s}function l(e,t,n,r,i,o){e=e||"",t=t||"",e===t?p(!1):void 0;var c=a(t,e);c||a(e,t)?void 0:p(!1);for(var l=0,f=c?s:u,d=e;;d=f(d,t)){var h;if(i&&d===e||o&&d===t||(h=n(d,c,r)),h===!1||d===t)break;l++<m?void 0:p(!1)}}var f=n(394),p=n(361),d=".",h=d.length,m=1e4,v={createReactRootID:function(){return r(f.createReactRootIndex())},createReactID:function(e,t){return e+t},getReactRootIDFromNodeID:function(e){if(e&&e.charAt(0)===d&&e.length>1){var t=e.indexOf(d,1);return t>-1?e.substr(0,t):e}return null},traverseEnterLeave:function(e,t,n,r,i){var o=c(e,t);o!==e&&l(e,o,n,r,!1,!0),o!==t&&l(o,t,n,i,!0,!1)},traverseTwoPhase:function(e,t,n){e&&(l("",e,t,n,!0,!1),l(e,"",t,n,!1,!0))},traverseTwoPhaseSkipTarget:function(e,t,n){e&&(l("",e,t,n,!0,!0),l(e,"",t,n,!0,!0))},traverseAncestors:function(e,t,n){l("",e,t,n,!0,!1)},getFirstCommonAncestorID:c,_getNextDescendantID:u,isAncestorIDOf:a,SEPARATOR:d};e.exports=v},function(e){"use strict";var t={injectCreateReactRootIndex:function(e){n.createReactRootIndex=e}},n={createReactRootIndex:null,injection:t};e.exports=n},function(e){"use strict";var t={remove:function(e){e._reactInternalInstance=void 0},get:function(e){return e._reactInternalInstance},has:function(e){return void 0!==e._reactInternalInstance},set:function(e,t){e._reactInternalInstance=t}};e.exports=t},function(e,t,n){"use strict";var r=n(397),i=/\/?>/,o={CHECKSUM_ATTR_NAME:"data-react-checksum",addChecksumToMarkup:function(e){var t=r(e);return e.replace(i," "+o.CHECKSUM_ATTR_NAME+'="'+t+'"$&')},canReuseMarkup:function(e,t){var n=t.getAttribute(o.CHECKSUM_ATTR_NAME);n=n&&parseInt(n,10);var i=r(e);return i===n}};e.exports=o},function(e){"use strict";function t(e){for(var t=1,r=0,i=0,o=e.length,a=-4&o;a>i;){for(;i<Math.min(i+4096,a);i+=4)r+=(t+=e.charCodeAt(i))+(t+=e.charCodeAt(i+1))+(t+=e.charCodeAt(i+2))+(t+=e.charCodeAt(i+3));t%=n,r%=n}for(;o>i;i++)r+=t+=e.charCodeAt(i);return t%=n,r%=n,t|r<<16}var n=65521;e.exports=t},function(e,t,n){"use strict";function r(){i.attachRefs(this,this._currentElement)}var i=n(399),o={mountComponent:function(e,t,n,i){var o=e.mountComponent(t,n,i);return e._currentElement&&null!=e._currentElement.ref&&n.getReactMountReady().enqueue(r,e),o},unmountComponent:function(e){i.detachRefs(e,e._currentElement),e.unmountComponent()},receiveComponent:function(e,t,n,o){var a=e._currentElement;if(t!==a||o!==e._context){var s=i.shouldUpdateRefs(a,t);s&&i.detachRefs(e,a),e.receiveComponent(t,n,o),s&&e._currentElement&&null!=e._currentElement.ref&&n.getReactMountReady().enqueue(r,e)}},performUpdateIfNecessary:function(e,t){e.performUpdateIfNecessary(t)}};e.exports=o},function(e,t,n){"use strict";function r(e,t,n){"function"==typeof e?e(t.getPublicInstance()):o.addComponentAsRefTo(t,e,n)}function i(e,t,n){"function"==typeof e?e(null):o.removeComponentAsRefFrom(t,e,n)}var o=n(400),a={};a.attachRefs=function(e,t){if(null!==t&&t!==!1){var n=t.ref;null!=n&&r(n,e,t._owner)}},a.shouldUpdateRefs=function(e,t){var n=null===e||e===!1,r=null===t||t===!1;return n||r||t._owner!==e._owner||t.ref!==e.ref},a.detachRefs=function(e,t){if(null!==t&&t!==!1){var n=t.ref;null!=n&&i(n,e,t._owner)}},e.exports=a},function(e,t,n){"use strict";var r=n(361),i={isValidOwner:function(e){return!(!e||"function"!=typeof e.attachRef||"function"!=typeof e.detachRef)},addComponentAsRefTo:function(e,t,n){i.isValidOwner(n)?void 0:r(!1),n.attachRef(t,e)},removeComponentAsRefFrom:function(e,t,n){i.isValidOwner(n)?void 0:r(!1),n.getPublicInstance().refs[t]===e.getPublicInstance()&&n.detachRef(t)}};e.exports=i},function(e,t,n){"use strict";function r(e){s.enqueueUpdate(e)}function i(e,t){var n=a.get(e);return n?n:null}var o=(n(353),n(390)),a=n(395),s=n(402),u=n(387),c=n(361),l=(n(373),{isMounted:function(e){var t=a.get(e);return t?!!t._renderedComponent:!1},enqueueCallback:function(e,t){"function"!=typeof t?c(!1):void 0;var n=i(e);return n?(n._pendingCallbacks?n._pendingCallbacks.push(t):n._pendingCallbacks=[t],void r(n)):null},enqueueCallbackInternal:function(e,t){"function"!=typeof t?c(!1):void 0,e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],r(e)},enqueueForceUpdate:function(e){var t=i(e,"forceUpdate");t&&(t._pendingForceUpdate=!0,r(t))},enqueueReplaceState:function(e,t){var n=i(e,"replaceState");n&&(n._pendingStateQueue=[t],n._pendingReplaceState=!0,r(n))},enqueueSetState:function(e,t){var n=i(e,"setState");if(n){var o=n._pendingStateQueue||(n._pendingStateQueue=[]);o.push(t),r(n)}},enqueueSetProps:function(e,t){var n=i(e,"setProps");n&&l.enqueueSetPropsInternal(n,t)},enqueueSetPropsInternal:function(e,t){var n=e._topLevelWrapper;n?void 0:c(!1);var i=n._pendingElement||n._currentElement,a=i.props,s=u({},a.props,t);n._pendingElement=o.cloneAndReplaceProps(i,o.cloneAndReplaceProps(a,s)),r(n)},enqueueReplaceProps:function(e,t){var n=i(e,"replaceProps");n&&l.enqueueReplacePropsInternal(n,t)},enqueueReplacePropsInternal:function(e,t){var n=e._topLevelWrapper;n?void 0:c(!1);var i=n._pendingElement||n._currentElement,a=i.props;n._pendingElement=o.cloneAndReplaceProps(i,o.cloneAndReplaceProps(a,t)),r(n)},enqueueElementInternal:function(e,t){e._pendingElement=t,r(e)}});e.exports=l},function(e,t,n){"use strict";function r(){E.ReactReconcileTransaction&&x?void 0:v(!1)}function i(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=l.getPooled(),this.reconcileTransaction=E.ReactReconcileTransaction.getPooled(!1)}function o(e,t,n,i,o,a){r(),x.batchedUpdates(e,t,n,i,o,a)}function a(e,t){return e._mountOrder-t._mountOrder}function s(e){var t=e.dirtyComponentsLength;t!==g.length?v(!1):void 0,g.sort(a);for(var n=0;t>n;n++){var r=g[n],i=r._pendingCallbacks;if(r._pendingCallbacks=null,d.performUpdateIfNecessary(r,e.reconcileTransaction),i)for(var o=0;o<i.length;o++)e.callbackQueue.enqueue(i[o],r.getPublicInstance())}}function u(e){return r(),x.isBatchingUpdates?void g.push(e):void x.batchedUpdates(u,e)}function c(e,t){x.isBatchingUpdates?void 0:v(!1),y.enqueue(e,t),b=!0}var l=n(403),f=n(404),p=n(366),d=n(398),h=n(405),m=n(387),v=n(361),g=[],y=l.getPooled(),b=!1,x=null,w={initialize:function(){this.dirtyComponentsLength=g.length},close:function(){this.dirtyComponentsLength!==g.length?(g.splice(0,this.dirtyComponentsLength),$()):g.length=0}},_={initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}},C=[w,_];m(i.prototype,h.Mixin,{getTransactionWrappers:function(){return C},destructor:function(){this.dirtyComponentsLength=null,l.release(this.callbackQueue),this.callbackQueue=null,E.ReactReconcileTransaction.release(this.reconcileTransaction),this.reconcileTransaction=null},perform:function(e,t,n){return h.Mixin.perform.call(this,this.reconcileTransaction.perform,this.reconcileTransaction,e,t,n)}}),f.addPoolingTo(i);var $=function(){for(;g.length||b;){if(g.length){var e=i.getPooled();e.perform(s,null,e),i.release(e)}if(b){b=!1;var t=y;y=l.getPooled(),t.notifyAll(),l.release(t)}}};$=p.measure("ReactUpdates","flushBatchedUpdates",$);var S={injectReconcileTransaction:function(e){e?void 0:v(!1),E.ReactReconcileTransaction=e},injectBatchingStrategy:function(e){e?void 0:v(!1),"function"!=typeof e.batchedUpdates?v(!1):void 0,"boolean"!=typeof e.isBatchingUpdates?v(!1):void 0,x=e}},E={ReactReconcileTransaction:null,batchedUpdates:o,enqueueUpdate:u,flushBatchedUpdates:$,injection:S,asap:c};e.exports=E},function(e,t,n){"use strict";function r(){this._callbacks=null,this._contexts=null}var i=n(404),o=n(387),a=n(361);o(r.prototype,{enqueue:function(e,t){this._callbacks=this._callbacks||[],this._contexts=this._contexts||[],this._callbacks.push(e),this._contexts.push(t)},notifyAll:function(){var e=this._callbacks,t=this._contexts;if(e){e.length!==t.length?a(!1):void 0,this._callbacks=null,this._contexts=null;for(var n=0;n<e.length;n++)e[n].call(t[n]);e.length=0,t.length=0}},reset:function(){this._callbacks=null,this._contexts=null},destructor:function(){this.reset()}}),i.addPoolingTo(r),e.exports=r},function(e,t,n){"use strict";var r=n(361),i=function(e){var t=this;if(t.instancePool.length){var n=t.instancePool.pop();return t.call(n,e),n}return new t(e)},o=function(e,t){var n=this;if(n.instancePool.length){var r=n.instancePool.pop();return n.call(r,e,t),r}return new n(e,t)},a=function(e,t,n){var r=this;if(r.instancePool.length){var i=r.instancePool.pop();return r.call(i,e,t,n),i}return new r(e,t,n)},s=function(e,t,n,r){var i=this;if(i.instancePool.length){var o=i.instancePool.pop();return i.call(o,e,t,n,r),o}return new i(e,t,n,r)},u=function(e,t,n,r,i){var o=this;if(o.instancePool.length){var a=o.instancePool.pop();return o.call(a,e,t,n,r,i),a}return new o(e,t,n,r,i)},c=function(e){var t=this;e instanceof t?void 0:r(!1),e.destructor(),t.instancePool.length<t.poolSize&&t.instancePool.push(e)},l=10,f=i,p=function(e,t){var n=e;return n.instancePool=[],n.getPooled=t||f,n.poolSize||(n.poolSize=l),n.release=c,n},d={addPoolingTo:p,oneArgumentPooler:i,twoArgumentPooler:o,threeArgumentPooler:a,fourArgumentPooler:s,fiveArgumentPooler:u};e.exports=d},function(e,t,n){"use strict";var r=n(361),i={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(e,t,n,i,o,a,s,u){this.isInTransaction()?r(!1):void 0;var c,l;try{this._isInTransaction=!0,c=!0,this.initializeAll(0),l=e.call(t,n,i,o,a,s,u),c=!1}finally{try{if(c)try{this.closeAll(0)}catch(f){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return l},initializeAll:function(e){for(var t=this.transactionWrappers,n=e;n<t.length;n++){var r=t[n];try{this.wrapperInitData[n]=o.OBSERVED_ERROR,this.wrapperInitData[n]=r.initialize?r.initialize.call(this):null}finally{if(this.wrapperInitData[n]===o.OBSERVED_ERROR)try{this.initializeAll(n+1)}catch(i){}}}},closeAll:function(e){this.isInTransaction()?void 0:r(!1);for(var t=this.transactionWrappers,n=e;n<t.length;n++){var i,a=t[n],s=this.wrapperInitData[n];try{i=!0,s!==o.OBSERVED_ERROR&&a.close&&a.close.call(this,s),i=!1}finally{if(i)try{this.closeAll(n+1)}catch(u){}}}this.wrapperInitData.length=0}},o={Mixin:i,OBSERVED_ERROR:{}};e.exports=o},function(e){"use strict";var t={};e.exports=t},function(e,t,n){"use strict";function r(e,t){var n=!0;e:for(;n;){var r=e,o=t;if(n=!1,r&&o){if(r===o)return!0;if(i(r))return!1;if(i(o)){e=r,t=o.parentNode,n=!0;continue e}return r.contains?r.contains(o):r.compareDocumentPosition?!!(16&r.compareDocumentPosition(o)):!1}return!1}}var i=n(408);e.exports=r},function(e,t,n){"use strict";function r(e){return i(e)&&3==e.nodeType}var i=n(409);e.exports=r},function(e){"use strict";function t(e){return!(!e||!("function"==typeof Node?e instanceof Node:"object"===("undefined"==typeof e?"undefined":n(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};e.exports=t},function(e,t,n){"use strict";function r(e){return"function"==typeof e&&"undefined"!=typeof e.prototype&&"function"==typeof e.prototype.mountComponent&&"function"==typeof e.prototype.receiveComponent}function i(e){var t;if(null===e||e===!1)t=new s(i);else if("object"===("undefined"==typeof e?"undefined":o(e))){var n=e;!n||"function"!=typeof n.type&&"string"!=typeof n.type?l(!1):void 0,t="string"==typeof n.type?u.createInternalComponent(n):r(n.type)?new n.type(n):new f}else"string"==typeof e||"number"==typeof e?t=u.createInstanceForText(e):l(!1);return t.construct(e),t._mountIndex=0,t._mountImage=null,t}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},a=n(411),s=n(416),u=n(417),c=n(387),l=n(361),f=(n(373),function(){});c(f.prototype,a.Mixin,{_instantiateReactComponent:i}),e.exports=i},function(e,t,n){"use strict";function r(e){var t=e._currentElement._owner||null;if(t){var n=t.getName();if(n)return" Check the render method of `"+n+"`."}return""}function i(){}{var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},a=n(412),s=n(353),u=n(390),c=n(395),l=n(366),f=n(413),p=(n(414),n(398)),d=n(401),h=n(387),m=n(406),v=n(361),g=n(415);n(373)}i.prototype.render=function(){var e=c.get(this)._currentElement.type;return e(this.props,this.context,this.updater)};var y=1,b={construct:function(e){this._currentElement=e,this._rootNodeID=null,this._instance=null,this._pendingElement=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._renderedComponent=null,this._context=null,this._mountOrder=0,this._topLevelWrapper=null,this._pendingCallbacks=null},mountComponent:function(e,t,n){this._context=n,this._mountOrder=y++,this._rootNodeID=e;var r,a,s=this._processProps(this._currentElement.props),l=this._processContext(n),f=this._currentElement.type,h="prototype"in f;h&&(r=new f(s,l,d)),(!h||null===r||r===!1||u.isValidElement(r))&&(a=r,r=new i(f)),r.props=s,r.context=l,r.refs=m,r.updater=d,this._instance=r,c.set(r,this);var g=r.state;void 0===g&&(r.state=g=null),"object"!==("undefined"==typeof g?"undefined":o(g))||Array.isArray(g)?v(!1):void 0,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,r.componentWillMount&&(r.componentWillMount(),this._pendingStateQueue&&(r.state=this._processPendingState(r.props,r.context))),void 0===a&&(a=this._renderValidatedComponent()),this._renderedComponent=this._instantiateReactComponent(a);var b=p.mountComponent(this._renderedComponent,e,t,this._processChildContext(n));return r.componentDidMount&&t.getReactMountReady().enqueue(r.componentDidMount,r),b},unmountComponent:function(){var e=this._instance;e.componentWillUnmount&&e.componentWillUnmount(),p.unmountComponent(this._renderedComponent),this._renderedComponent=null,this._instance=null,this._pendingStateQueue=null,this._pendingReplaceState=!1,this._pendingForceUpdate=!1,this._pendingCallbacks=null,this._pendingElement=null,this._context=null,this._rootNodeID=null,this._topLevelWrapper=null,c.remove(e)},_maskContext:function(e){var t=null,n=this._currentElement.type,r=n.contextTypes;if(!r)return m;t={};for(var i in r)t[i]=e[i];return t},_processContext:function(e){var t=this._maskContext(e);return t},_processChildContext:function(e){var t=this._currentElement.type,n=this._instance,r=n.getChildContext&&n.getChildContext();if(r){"object"!==o(t.childContextTypes)?v(!1):void 0;for(var i in r)i in t.childContextTypes?void 0:v(!1);return h({},e,r)}return e},_processProps:function(e){return e},_checkPropTypes:function(e,t,n){var i=this.getName();for(var o in e)if(e.hasOwnProperty(o)){var a;try{"function"!=typeof e[o]?v(!1):void 0,a=e[o](t,o,i,n)}catch(s){a=s}if(a instanceof Error){{r(this)}n===f.prop}}},receiveComponent:function(e,t,n){var r=this._currentElement,i=this._context;this._pendingElement=null,this.updateComponent(t,r,e,i,n)},performUpdateIfNecessary:function(e){null!=this._pendingElement&&p.receiveComponent(this,this._pendingElement||this._currentElement,e,this._context),(null!==this._pendingStateQueue||this._pendingForceUpdate)&&this.updateComponent(e,this._currentElement,this._currentElement,this._context,this._context)},updateComponent:function(e,t,n,r,i){var o,a=this._instance,s=this._context===i?a.context:this._processContext(i);t===n?o=n.props:(o=this._processProps(n.props),a.componentWillReceiveProps&&a.componentWillReceiveProps(o,s));var u=this._processPendingState(o,s),c=this._pendingForceUpdate||!a.shouldComponentUpdate||a.shouldComponentUpdate(o,u,s);c?(this._pendingForceUpdate=!1,this._performComponentUpdate(n,o,u,s,e,i)):(this._currentElement=n,this._context=i,a.props=o,a.state=u,a.context=s)},_processPendingState:function(e,t){var n=this._instance,r=this._pendingStateQueue,i=this._pendingReplaceState;if(this._pendingReplaceState=!1,this._pendingStateQueue=null,!r)return n.state;if(i&&1===r.length)return r[0];for(var o=h({},i?r[0]:n.state),a=i?1:0;a<r.length;a++){var s=r[a];h(o,"function"==typeof s?s.call(n,o,e,t):s)}return o},_performComponentUpdate:function(e,t,n,r,i,o){var a,s,u,c=this._instance,l=Boolean(c.componentDidUpdate);l&&(a=c.props,s=c.state,u=c.context),c.componentWillUpdate&&c.componentWillUpdate(t,n,r),this._currentElement=e,this._context=o,c.props=t,c.state=n,c.context=r,this._updateRenderedComponent(i,o),l&&i.getReactMountReady().enqueue(c.componentDidUpdate.bind(c,a,s,u),c)},_updateRenderedComponent:function(e,t){var n=this._renderedComponent,r=n._currentElement,i=this._renderValidatedComponent();if(g(r,i))p.receiveComponent(n,i,e,this._processChildContext(t));else{var o=this._rootNodeID,a=n._rootNodeID;p.unmountComponent(n),this._renderedComponent=this._instantiateReactComponent(i);var s=p.mountComponent(this._renderedComponent,o,e,this._processChildContext(t));this._replaceNodeWithMarkupByID(a,s)}},_replaceNodeWithMarkupByID:function(e,t){a.replaceNodeWithMarkupByID(e,t)},_renderValidatedComponentWithoutOwnerOrContext:function(){var e=this._instance,t=e.render();return t},_renderValidatedComponent:function(){var e;s.current=this;try{e=this._renderValidatedComponentWithoutOwnerOrContext()}finally{s.current=null}return null===e||e===!1||u.isValidElement(e)?void 0:v(!1),e},attachRef:function(e,t){var n=this.getPublicInstance();null==n?v(!1):void 0;var r=t.getPublicInstance(),i=n.refs===m?n.refs={}:n.refs;i[e]=r},detachRef:function(e){var t=this.getPublicInstance().refs;delete t[e]},getName:function(){var e=this._currentElement.type,t=this._instance&&this._instance.constructor;return e.displayName||t&&t.displayName||e.name||t&&t.name||null},getPublicInstance:function(){var e=this._instance;return e instanceof i?null:e},_instantiateReactComponent:null};l.measureMethods(b,"ReactCompositeComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent",_renderValidatedComponent:"_renderValidatedComponent"});var x={Mixin:b};e.exports=x;
17
-
18
- },function(e,t,n){"use strict";var r=n(361),i=!1,o={unmountIDFromEnvironment:null,replaceNodeWithMarkupByID:null,processChildrenUpdates:null,injection:{injectEnvironment:function(e){i?r(!1):void 0,o.unmountIDFromEnvironment=e.unmountIDFromEnvironment,o.replaceNodeWithMarkupByID=e.replaceNodeWithMarkupByID,o.processChildrenUpdates=e.processChildrenUpdates,i=!0}}};e.exports=o},function(e,t,n){"use strict";var r=n(365),i=r({prop:null,context:null,childContext:null});e.exports=i},function(e){"use strict";var t={};e.exports=t},function(e){"use strict";function t(e,t){var r=null===e||e===!1,i=null===t||t===!1;if(r||i)return r===i;var o="undefined"==typeof e?"undefined":n(e),a="undefined"==typeof t?"undefined":n(t);return"string"===o||"number"===o?"string"===a||"number"===a:"object"===a&&e.type===t.type&&e.key===t.key}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};e.exports=t},function(e,t,n){"use strict";var r,i=n(390),o=n(392),a=n(398),s=n(387),u={injectEmptyComponent:function(e){r=i.createElement(e)}},c=function(e){this._currentElement=null,this._rootNodeID=null,this._renderedComponent=e(r)};s(c.prototype,{construct:function(){},mountComponent:function(e,t,n){return o.registerNullComponentID(e),this._rootNodeID=e,a.mountComponent(this._renderedComponent,e,t,n)},receiveComponent:function(){},unmountComponent:function(){a.unmountComponent(this._renderedComponent),o.deregisterNullComponentID(this._rootNodeID),this._rootNodeID=null,this._renderedComponent=null}}),c.injection=u,e.exports=c},function(e,t,n){"use strict";function r(e){if("function"==typeof e.type)return e.type;var t=e.type,n=f[t];return null==n&&(f[t]=n=c(t)),n}function i(e){return l?void 0:u(!1),new l(e.type,e.props)}function o(e){return new p(e)}function a(e){return e instanceof p}var s=n(387),u=n(361),c=null,l=null,f={},p=null,d={injectGenericComponentClass:function(e){l=e},injectTextComponentClass:function(e){p=e},injectComponentClasses:function(e){s(f,e)}},h={getComponentClassForElement:r,createInternalComponent:i,createInstanceForText:o,isTextComponent:a,injection:d};e.exports=h},function(e,t,n){"use strict";var r=(n(387),n(363)),i=(n(373),r);e.exports=i},function(e,t,n){"use strict";function r(){if(!S){S=!0,g.EventEmitter.injectReactEventListener(v),g.EventPluginHub.injectEventPluginOrder(s),g.EventPluginHub.injectInstanceHandle(y),g.EventPluginHub.injectMount(b),g.EventPluginHub.injectEventPluginsByName({SimpleEventPlugin:C,EnterLeaveEventPlugin:u,ChangeEventPlugin:o,SelectEventPlugin:w,BeforeInputEventPlugin:i}),g.NativeComponent.injectGenericComponentClass(h),g.NativeComponent.injectTextComponentClass(m),g.Class.injectMixin(f),g.DOMProperty.injectDOMPropertyConfig(l),g.DOMProperty.injectDOMPropertyConfig($),g.EmptyComponent.injectEmptyComponent("noscript"),g.Updates.injectReconcileTransaction(x),g.Updates.injectBatchingStrategy(d),g.RootIndex.injectCreateReactRootIndex(c.canUseDOM?a.createReactRootIndex:_.createReactRootIndex),g.Component.injectEnvironment(p)}}var i=n(420),o=n(428),a=n(431),s=n(432),u=n(433),c=n(357),l=n(437),f=n(438),p=n(374),d=n(440),h=n(441),m=n(354),v=n(466),g=n(469),y=n(393),b=n(376),x=n(473),w=n(478),_=n(479),C=n(480),$=n(489),S=!1;e.exports={inject:r}},function(e,t,n){"use strict";function r(){var e=window.opera;return"object"===("undefined"==typeof e?"undefined":d(e))&&"function"==typeof e.version&&parseInt(e.version(),10)<=12}function i(e){return(e.ctrlKey||e.altKey||e.metaKey)&&!(e.ctrlKey&&e.altKey)}function o(e){switch(e){case T.topCompositionStart:return O.compositionStart;case T.topCompositionEnd:return O.compositionEnd;case T.topCompositionUpdate:return O.compositionUpdate}}function a(e,t){return e===T.topKeyDown&&t.keyCode===_}function s(e,t){switch(e){case T.topKeyUp:return-1!==w.indexOf(t.keyCode);case T.topKeyDown:return t.keyCode!==_;case T.topKeyPress:case T.topMouseDown:case T.topBlur:return!0;default:return!1}}function u(e){var t=e.detail;return"object"===("undefined"==typeof t?"undefined":d(t))&&"data"in t?t.data:null}function c(e,t,n,r,i){var c,l;if(C?c=o(e):N?s(e,r)&&(c=O.compositionEnd):a(e,r)&&(c=O.compositionStart),!c)return null;E&&(N||c!==O.compositionStart?c===O.compositionEnd&&N&&(l=N.getData()):N=g.getPooled(t));var f=y.getPooled(c,n,r,i);if(l)f.data=l;else{var p=u(r);null!==p&&(f.data=p)}return m.accumulateTwoPhaseDispatches(f),f}function l(e,t){switch(e){case T.topCompositionEnd:return u(t);case T.topKeyPress:var n=t.which;return n!==P?null:(R=!0,k);case T.topTextInput:var r=t.data;return r===k&&R?null:r;default:return null}}function f(e,t){if(N){if(e===T.topCompositionEnd||s(e,t)){var n=N.getData();return g.release(N),N=null,n}return null}switch(e){case T.topPaste:return null;case T.topKeyPress:return t.which&&!i(t)?String.fromCharCode(t.which):null;case T.topCompositionEnd:return E?null:t.data;default:return null}}function p(e,t,n,r,i){var o;if(o=S?l(e,r):f(e,r),!o)return null;var a=b.getPooled(O.beforeInput,n,r,i);return a.data=o,m.accumulateTwoPhaseDispatches(a),a}var d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},h=n(378),m=n(421),v=n(357),g=n(422),y=n(424),b=n(426),x=n(427),w=[9,13,27,32],_=229,C=v.canUseDOM&&"CompositionEvent"in window,$=null;v.canUseDOM&&"documentMode"in document&&($=document.documentMode);var S=v.canUseDOM&&"TextEvent"in window&&!$&&!r(),E=v.canUseDOM&&(!C||$&&$>8&&11>=$),P=32,k=String.fromCharCode(P),T=h.topLevelTypes,O={beforeInput:{phasedRegistrationNames:{bubbled:x({onBeforeInput:null}),captured:x({onBeforeInputCapture:null})},dependencies:[T.topCompositionEnd,T.topKeyPress,T.topTextInput,T.topPaste]},compositionEnd:{phasedRegistrationNames:{bubbled:x({onCompositionEnd:null}),captured:x({onCompositionEndCapture:null})},dependencies:[T.topBlur,T.topCompositionEnd,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]},compositionStart:{phasedRegistrationNames:{bubbled:x({onCompositionStart:null}),captured:x({onCompositionStartCapture:null})},dependencies:[T.topBlur,T.topCompositionStart,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]},compositionUpdate:{phasedRegistrationNames:{bubbled:x({onCompositionUpdate:null}),captured:x({onCompositionUpdateCapture:null})},dependencies:[T.topBlur,T.topCompositionUpdate,T.topKeyDown,T.topKeyPress,T.topKeyUp,T.topMouseDown]}},R=!1,N=null,A={eventTypes:O,extractEvents:function(e,t,n,r,i){return[c(e,t,n,r,i),p(e,t,n,r,i)]}};e.exports=A},function(e,t,n){"use strict";function r(e,t,n){var r=t.dispatchConfig.phasedRegistrationNames[n];return y(e,r)}function i(e,t,n){var i=t?g.bubbled:g.captured,o=r(e,n,i);o&&(n._dispatchListeners=m(n._dispatchListeners,o),n._dispatchIDs=m(n._dispatchIDs,e))}function o(e){e&&e.dispatchConfig.phasedRegistrationNames&&h.injection.getInstanceHandle().traverseTwoPhase(e.dispatchMarker,i,e)}function a(e){e&&e.dispatchConfig.phasedRegistrationNames&&h.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(e.dispatchMarker,i,e)}function s(e,t,n){if(n&&n.dispatchConfig.registrationName){var r=n.dispatchConfig.registrationName,i=y(e,r);i&&(n._dispatchListeners=m(n._dispatchListeners,i),n._dispatchIDs=m(n._dispatchIDs,e))}}function u(e){e&&e.dispatchConfig.registrationName&&s(e.dispatchMarker,null,e)}function c(e){v(e,o)}function l(e){v(e,a)}function f(e,t,n,r){h.injection.getInstanceHandle().traverseEnterLeave(n,r,s,e,t)}function p(e){v(e,u)}var d=n(378),h=n(379),m=(n(373),n(383)),v=n(384),g=d.PropagationPhases,y=h.getListener,b={accumulateTwoPhaseDispatches:c,accumulateTwoPhaseDispatchesSkipTarget:l,accumulateDirectDispatches:p,accumulateEnterLeaveDispatches:f};e.exports=b},function(e,t,n){"use strict";function r(e){this._root=e,this._startText=this.getText(),this._fallbackText=null}var i=n(404),o=n(387),a=n(423);o(r.prototype,{destructor:function(){this._root=null,this._startText=null,this._fallbackText=null},getText:function(){return"value"in this._root?this._root.value:this._root[a()]},getData:function(){if(this._fallbackText)return this._fallbackText;var e,t,n=this._startText,r=n.length,i=this.getText(),o=i.length;for(e=0;r>e&&n[e]===i[e];e++);var a=r-e;for(t=1;a>=t&&n[r-t]===i[o-t];t++);var s=t>1?1-t:void 0;return this._fallbackText=i.slice(e,s),this._fallbackText}}),i.addPoolingTo(r),e.exports=r},function(e,t,n){"use strict";function r(){return!o&&i.canUseDOM&&(o="textContent"in document.documentElement?"textContent":"innerText"),o}var i=n(357),o=null;e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){i.call(this,e,t,n,r)}var i=n(425),o={data:null};i.augmentClass(r,o),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this.dispatchMarker=t,this.nativeEvent=n;var i=this.constructor.Interface;for(var o in i)if(i.hasOwnProperty(o)){var s=i[o];s?this[o]=s(n):"target"===o?this.target=r:this[o]=n[o]}var u=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;this.isDefaultPrevented=u?a.thatReturnsTrue:a.thatReturnsFalse,this.isPropagationStopped=a.thatReturnsFalse}var i=n(404),o=n(387),a=n(363),s=(n(373),{type:null,target:null,currentTarget:a.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null});o(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():e.returnValue=!1,this.isDefaultPrevented=a.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():e.cancelBubble=!0,this.isPropagationStopped=a.thatReturnsTrue)},persist:function(){this.isPersistent=a.thatReturnsTrue},isPersistent:a.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;this.dispatchConfig=null,this.dispatchMarker=null,this.nativeEvent=null}}),r.Interface=s,r.augmentClass=function(e,t){var n=this,r=Object.create(n.prototype);o(r,e.prototype),e.prototype=r,e.prototype.constructor=e,e.Interface=o({},n.Interface,t),e.augmentClass=n.augmentClass,i.addPoolingTo(e,i.fourArgumentPooler)},i.addPoolingTo(r,i.fourArgumentPooler),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){i.call(this,e,t,n,r)}var i=n(425),o={data:null};i.augmentClass(r,o),e.exports=r},function(e){"use strict";var t=function(e){var t;for(t in e)if(e.hasOwnProperty(t))return t;return null};e.exports=t},function(e,t,n){"use strict";function r(e){var t=e.nodeName&&e.nodeName.toLowerCase();return"select"===t||"input"===t&&"file"===e.type}function i(e){var t=C.getPooled(T.change,R,e,$(e));x.accumulateTwoPhaseDispatches(t),_.batchedUpdates(o,t)}function o(e){b.enqueueEvents(e),b.processEventQueue(!1)}function a(e,t){O=e,R=t,O.attachEvent("onchange",i)}function s(){O&&(O.detachEvent("onchange",i),O=null,R=null)}function u(e,t,n){return e===k.topChange?n:void 0}function c(e,t,n){e===k.topFocus?(s(),a(t,n)):e===k.topBlur&&s()}function l(e,t){O=e,R=t,N=e.value,A=Object.getOwnPropertyDescriptor(e.constructor.prototype,"value"),Object.defineProperty(O,"value",D),O.attachEvent("onpropertychange",p)}function f(){O&&(delete O.value,O.detachEvent("onpropertychange",p),O=null,R=null,N=null,A=null)}function p(e){if("value"===e.propertyName){var t=e.srcElement.value;t!==N&&(N=t,i(e))}}function d(e,t,n){return e===k.topInput?n:void 0}function h(e,t,n){e===k.topFocus?(f(),l(t,n)):e===k.topBlur&&f()}function m(e){return e!==k.topSelectionChange&&e!==k.topKeyUp&&e!==k.topKeyDown||!O||O.value===N?void 0:(N=O.value,R)}function v(e){return e.nodeName&&"input"===e.nodeName.toLowerCase()&&("checkbox"===e.type||"radio"===e.type)}function g(e,t,n){return e===k.topClick?n:void 0}var y=n(378),b=n(379),x=n(421),w=n(357),_=n(402),C=n(425),$=n(429),S=n(388),E=n(430),P=n(427),k=y.topLevelTypes,T={change:{phasedRegistrationNames:{bubbled:P({onChange:null}),captured:P({onChangeCapture:null})},dependencies:[k.topBlur,k.topChange,k.topClick,k.topFocus,k.topInput,k.topKeyDown,k.topKeyUp,k.topSelectionChange]}},O=null,R=null,N=null,A=null,j=!1;w.canUseDOM&&(j=S("change")&&(!("documentMode"in document)||document.documentMode>8));var M=!1;w.canUseDOM&&(M=S("input")&&(!("documentMode"in document)||document.documentMode>9));var D={get:function(){return A.get.call(this)},set:function(e){N=""+e,A.set.call(this,e)}},I={eventTypes:T,extractEvents:function(e,t,n,i,o){var a,s;if(r(t)?j?a=u:s=c:E(t)?M?a=d:(a=m,s=h):v(t)&&(a=g),a){var l=a(e,t,n);if(l){var f=C.getPooled(T.change,l,i,o);return f.type="change",x.accumulateTwoPhaseDispatches(f),f}}s&&s(e,t,n)}};e.exports=I},function(e){"use strict";function t(e){var t=e.target||e.srcElement||window;return 3===t.nodeType?t.parentNode:t}e.exports=t},function(e){"use strict";function t(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&n[e.type]||"textarea"===t)}var n={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};e.exports=t},function(e){"use strict";var t=0,n={createReactRootIndex:function(){return t++}};e.exports=n},function(e,t,n){"use strict";var r=n(427),i=[r({ResponderEventPlugin:null}),r({SimpleEventPlugin:null}),r({TapEventPlugin:null}),r({EnterLeaveEventPlugin:null}),r({ChangeEventPlugin:null}),r({SelectEventPlugin:null}),r({BeforeInputEventPlugin:null})];e.exports=i},function(e,t,n){"use strict";var r=n(378),i=n(421),o=n(434),a=n(376),s=n(427),u=r.topLevelTypes,c=a.getFirstReactDOM,l={mouseEnter:{registrationName:s({onMouseEnter:null}),dependencies:[u.topMouseOut,u.topMouseOver]},mouseLeave:{registrationName:s({onMouseLeave:null}),dependencies:[u.topMouseOut,u.topMouseOver]}},f=[null,null],p={eventTypes:l,extractEvents:function(e,t,n,r,s){if(e===u.topMouseOver&&(r.relatedTarget||r.fromElement))return null;if(e!==u.topMouseOut&&e!==u.topMouseOver)return null;var p;if(t.window===t)p=t;else{var d=t.ownerDocument;p=d?d.defaultView||d.parentWindow:window}var h,m,v="",g="";if(e===u.topMouseOut?(h=t,v=n,m=c(r.relatedTarget||r.toElement),m?g=a.getID(m):m=p,m=m||p):(h=p,m=t,g=n),h===m)return null;var y=o.getPooled(l.mouseLeave,v,r,s);y.type="mouseleave",y.target=h,y.relatedTarget=m;var b=o.getPooled(l.mouseEnter,g,r,s);return b.type="mouseenter",b.target=m,b.relatedTarget=h,i.accumulateEnterLeaveDispatches(y,b,v,g),f[0]=y,f[1]=b,f}};e.exports=p},function(e,t,n){"use strict";function r(e,t,n,r){i.call(this,e,t,n,r)}var i=n(435),o=n(386),a=n(436),s={screenX:null,screenY:null,clientX:null,clientY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:a,button:function u(e){var u=e.button;return"which"in e?u:2===u?2:4===u?1:0},buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},pageX:function(e){return"pageX"in e?e.pageX:e.clientX+o.currentScrollLeft},pageY:function(e){return"pageY"in e?e.pageY:e.clientY+o.currentScrollTop}};i.augmentClass(r,s),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){i.call(this,e,t,n,r)}var i=n(425),o=n(429),a={view:function(e){if(e.view)return e.view;var t=o(e);if(null!=t&&t.window===t)return t;var n=t.ownerDocument;return n?n.defaultView||n.parentWindow:window},detail:function(e){return e.detail||0}};i.augmentClass(r,a),e.exports=r},function(e){"use strict";function t(e){var t=this,n=t.nativeEvent;if(n.getModifierState)return n.getModifierState(e);var i=r[e];return i?!!n[i]:!1}function n(){return t}var r={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};e.exports=n},function(e,t,n){"use strict";var r,i=n(371),o=n(357),a=i.injection.MUST_USE_ATTRIBUTE,s=i.injection.MUST_USE_PROPERTY,u=i.injection.HAS_BOOLEAN_VALUE,c=i.injection.HAS_SIDE_EFFECTS,l=i.injection.HAS_NUMERIC_VALUE,f=i.injection.HAS_POSITIVE_NUMERIC_VALUE,p=i.injection.HAS_OVERLOADED_BOOLEAN_VALUE;if(o.canUseDOM){var d=document.implementation;r=d&&d.hasFeature&&d.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")}var h={isCustomAttribute:RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),Properties:{accept:null,acceptCharset:null,accessKey:null,action:null,allowFullScreen:a|u,allowTransparency:a,alt:null,async:u,autoComplete:null,autoPlay:u,capture:a|u,cellPadding:null,cellSpacing:null,charSet:a,challenge:a,checked:s|u,classID:a,className:r?a:s,cols:a|f,colSpan:null,content:null,contentEditable:null,contextMenu:a,controls:s|u,coords:null,crossOrigin:null,data:null,dateTime:a,"default":u,defer:u,dir:null,disabled:a|u,download:p,draggable:null,encType:null,form:a,formAction:a,formEncType:a,formMethod:a,formNoValidate:u,formTarget:a,frameBorder:a,headers:null,height:a,hidden:a|u,high:null,href:null,hrefLang:null,htmlFor:null,httpEquiv:null,icon:null,id:s,inputMode:a,integrity:null,is:a,keyParams:a,keyType:a,kind:null,label:null,lang:null,list:a,loop:s|u,low:null,manifest:a,marginHeight:null,marginWidth:null,max:null,maxLength:a,media:a,mediaGroup:null,method:null,min:null,minLength:a,multiple:s|u,muted:s|u,name:null,nonce:a,noValidate:u,open:u,optimum:null,pattern:null,placeholder:null,poster:null,preload:null,radioGroup:null,readOnly:s|u,rel:null,required:u,reversed:u,role:a,rows:a|f,rowSpan:null,sandbox:null,scope:null,scoped:u,scrolling:null,seamless:a|u,selected:s|u,shape:null,size:a|f,sizes:a,span:f,spellCheck:null,src:null,srcDoc:s,srcLang:null,srcSet:a,start:l,step:null,style:null,summary:null,tabIndex:null,target:null,title:null,type:null,useMap:null,value:s|c,width:a,wmode:a,wrap:null,about:a,datatype:a,inlist:a,prefix:a,property:a,resource:a,"typeof":a,vocab:a,autoCapitalize:a,autoCorrect:a,autoSave:null,color:null,itemProp:a,itemScope:a|u,itemType:a,itemID:a,itemRef:a,results:null,security:a,unselectable:a},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"},DOMPropertyNames:{autoComplete:"autocomplete",autoFocus:"autofocus",autoPlay:"autoplay",autoSave:"autosave",encType:"encoding",hrefLang:"hreflang",radioGroup:"radiogroup",spellCheck:"spellcheck",srcDoc:"srcdoc",srcSet:"srcset"}};e.exports=h},function(e,t,n){"use strict";var r=(n(395),n(439)),i=(n(373),"_getDOMNodeDidWarn"),o={getDOMNode:function(){return this.constructor[i]=!0,r(this)}};e.exports=o},function(e,t,n){"use strict";function r(e){return null==e?null:1===e.nodeType?e:i.has(e)?o.getNodeFromInstance(e):(null!=e.render&&"function"==typeof e.render?a(!1):void 0,void a(!1))}{var i=(n(353),n(395)),o=n(376),a=n(361);n(373)}e.exports=r},function(e,t,n){"use strict";function r(){this.reinitializeTransaction()}var i=n(402),o=n(405),a=n(387),s=n(363),u={initialize:s,close:function(){p.isBatchingUpdates=!1}},c={initialize:s,close:i.flushBatchedUpdates.bind(i)},l=[c,u];a(r.prototype,o.Mixin,{getTransactionWrappers:function(){return l}});var f=new r,p={isBatchingUpdates:!1,batchedUpdates:function(e,t,n,r,i,o){var a=p.isBatchingUpdates;p.isBatchingUpdates=!0,a?e(t,n,r,i,o):f.perform(e,null,t,n,r,i,o)}};e.exports=p},function(e,t,n){"use strict";function r(){return this}function i(){var e=this._reactInternalComponent;return!!e}function o(){}function a(e,t){var n=this._reactInternalComponent;n&&(A.enqueueSetPropsInternal(n,e),t&&A.enqueueCallbackInternal(n,t))}function s(e,t){var n=this._reactInternalComponent;n&&(A.enqueueReplacePropsInternal(n,e),t&&A.enqueueCallbackInternal(n,t))}function u(e,t){t&&(null!=t.dangerouslySetInnerHTML&&(null!=t.children?I(!1):void 0,"object"===g(t.dangerouslySetInnerHTML)&&K in t.dangerouslySetInnerHTML?void 0:I(!1)),null!=t.style&&"object"!==g(t.style)?I(!1):void 0)}function c(e,t,n,r){var i=O.findReactContainerForID(e);if(i){var o=i.nodeType===Q?i.ownerDocument:i;V(t,o)}r.getReactMountReady().enqueue(l,{id:e,registrationName:t,listener:n})}function l(){var e=this;C.putListener(e.id,e.registrationName,e.listener)}function f(){var e=this;e._rootNodeID?void 0:I(!1);var t=O.getNode(e._rootNodeID);switch(t?void 0:I(!1),e._tag){case"iframe":e._wrapperState.listeners=[C.trapBubbledEvent(_.topLevelTypes.topLoad,"load",t)];break;case"video":case"audio":e._wrapperState.listeners=[];for(var n in G)G.hasOwnProperty(n)&&e._wrapperState.listeners.push(C.trapBubbledEvent(_.topLevelTypes[n],G[n],t));break;case"img":e._wrapperState.listeners=[C.trapBubbledEvent(_.topLevelTypes.topError,"error",t),C.trapBubbledEvent(_.topLevelTypes.topLoad,"load",t)];break;case"form":e._wrapperState.listeners=[C.trapBubbledEvent(_.topLevelTypes.topReset,"reset",t),C.trapBubbledEvent(_.topLevelTypes.topSubmit,"submit",t)]}}function p(){E.mountReadyWrapper(this)}function d(){k.postUpdateWrapper(this)}function h(e){ee.call(Z,e)||(J.test(e)?void 0:I(!1),Z[e]=!0)}function m(e,t){return e.indexOf("-")>=0||null!=t.is}function v(e){h(e),this._tag=e.toLowerCase(),this._renderedChildren=null,this._previousStyle=null,this._previousStyleCopy=null,this._rootNodeID=null,this._wrapperState=null,this._topLevelWrapper=null,this._nodeWithLegacyProperties=null}var g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},y=n(442),b=n(444),x=n(371),w=n(370),_=n(378),C=n(377),$=n(374),S=n(452),E=n(453),P=n(457),k=n(460),T=n(461),O=n(376),R=n(462),N=n(366),A=n(401),j=n(387),M=n(391),D=n(369),I=n(361),F=(n(388),n(427)),L=n(367),U=n(368),H=(n(465),n(418),n(373),C.deleteListener),V=C.listenTo,q=C.registrationNameModules,B={string:!0,number:!0},W=F({children:null}),z=F({style:null}),K=F({__html:null}),Q=1,G={topAbort:"abort",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topSeeked:"seeked",topSeeking:"seeking",topStalled:"stalled",topSuspend:"suspend",topTimeUpdate:"timeupdate",topVolumeChange:"volumechange",topWaiting:"waiting"},Y={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0},X={listing:!0,pre:!0,textarea:!0},J=(j({menuitem:!0},Y),/^[a-zA-Z][a-zA-Z:_\.\-\d]*$/),Z={},ee={}.hasOwnProperty;v.displayName="ReactDOMComponent",v.Mixin={construct:function(e){this._currentElement=e},mountComponent:function(e,t,n){this._rootNodeID=e;var r=this._currentElement.props;switch(this._tag){case"iframe":case"img":case"form":case"video":case"audio":this._wrapperState={listeners:null},t.getReactMountReady().enqueue(f,this);break;case"button":r=S.getNativeProps(this,r,n);break;case"input":E.mountWrapper(this,r,n),r=E.getNativeProps(this,r,n);break;case"option":P.mountWrapper(this,r,n),r=P.getNativeProps(this,r,n);break;case"select":k.mountWrapper(this,r,n),r=k.getNativeProps(this,r,n),n=k.processChildContext(this,r,n);break;case"textarea":T.mountWrapper(this,r,n),r=T.getNativeProps(this,r,n)}u(this,r);var i;if(t.useCreateElement){var o=n[O.ownerDocumentContextKey],a=o.createElement(this._currentElement.type);w.setAttributeForID(a,this._rootNodeID),O.getID(a),this._updateDOMProperties({},r,t,a),this._createInitialChildren(t,r,n,a),i=a}else{var s=this._createOpenTagMarkupAndPutListeners(t,r),c=this._createContentMarkup(t,r,n);i=!c&&Y[this._tag]?s+"/>":s+">"+c+"</"+this._currentElement.type+">"}switch(this._tag){case"input":t.getReactMountReady().enqueue(p,this);case"button":case"select":case"textarea":r.autoFocus&&t.getReactMountReady().enqueue(y.focusDOMComponent,this)}return i},_createOpenTagMarkupAndPutListeners:function(e,t){var n="<"+this._currentElement.type;for(var r in t)if(t.hasOwnProperty(r)){var i=t[r];if(null!=i)if(q.hasOwnProperty(r))i&&c(this._rootNodeID,r,i,e);else{r===z&&(i&&(i=this._previousStyleCopy=j({},t.style)),i=b.createMarkupForStyles(i));var o=null;null!=this._tag&&m(this._tag,t)?r!==W&&(o=w.createMarkupForCustomAttribute(r,i)):o=w.createMarkupForProperty(r,i),o&&(n+=" "+o)}}if(e.renderToStaticMarkup)return n;var a=w.createMarkupForID(this._rootNodeID);return n+" "+a},_createContentMarkup:function(e,t,n){var r="",i=t.dangerouslySetInnerHTML;if(null!=i)null!=i.__html&&(r=i.__html);else{var o=B[g(t.children)]?t.children:null,a=null!=o?null:t.children;if(null!=o)r=D(o);else if(null!=a){var s=this.mountChildren(a,e,n);r=s.join("")}}return X[this._tag]&&"\n"===r.charAt(0)?"\n"+r:r},_createInitialChildren:function(e,t,n,r){var i=t.dangerouslySetInnerHTML;if(null!=i)null!=i.__html&&L(r,i.__html);else{var o=B[g(t.children)]?t.children:null,a=null!=o?null:t.children;if(null!=o)U(r,o);else if(null!=a)for(var s=this.mountChildren(a,e,n),u=0;u<s.length;u++)r.appendChild(s[u])}},receiveComponent:function(e,t,n){var r=this._currentElement;this._currentElement=e,this.updateComponent(t,r,e,n)},updateComponent:function(e,t,n,r){var i=t.props,o=this._currentElement.props;switch(this._tag){case"button":i=S.getNativeProps(this,i),o=S.getNativeProps(this,o);break;case"input":E.updateWrapper(this),i=E.getNativeProps(this,i),o=E.getNativeProps(this,o);break;case"option":i=P.getNativeProps(this,i),o=P.getNativeProps(this,o);break;case"select":i=k.getNativeProps(this,i),o=k.getNativeProps(this,o);break;case"textarea":T.updateWrapper(this),i=T.getNativeProps(this,i),o=T.getNativeProps(this,o)}u(this,o),this._updateDOMProperties(i,o,e,null),this._updateDOMChildren(i,o,e,r),!M&&this._nodeWithLegacyProperties&&(this._nodeWithLegacyProperties.props=o),"select"===this._tag&&e.getReactMountReady().enqueue(d,this)},_updateDOMProperties:function(e,t,n,r){var i,o,a;for(i in e)if(!t.hasOwnProperty(i)&&e.hasOwnProperty(i))if(i===z){var s=this._previousStyleCopy;for(o in s)s.hasOwnProperty(o)&&(a=a||{},a[o]="");this._previousStyleCopy=null}else q.hasOwnProperty(i)?e[i]&&H(this._rootNodeID,i):(x.properties[i]||x.isCustomAttribute(i))&&(r||(r=O.getNode(this._rootNodeID)),w.deleteValueForProperty(r,i));for(i in t){var u=t[i],l=i===z?this._previousStyleCopy:e[i];if(t.hasOwnProperty(i)&&u!==l)if(i===z)if(u?u=this._previousStyleCopy=j({},u):this._previousStyleCopy=null,l){for(o in l)!l.hasOwnProperty(o)||u&&u.hasOwnProperty(o)||(a=a||{},a[o]="");for(o in u)u.hasOwnProperty(o)&&l[o]!==u[o]&&(a=a||{},a[o]=u[o])}else a=u;else q.hasOwnProperty(i)?u?c(this._rootNodeID,i,u,n):l&&H(this._rootNodeID,i):m(this._tag,t)?(r||(r=O.getNode(this._rootNodeID)),i===W&&(u=null),w.setValueForAttribute(r,i,u)):(x.properties[i]||x.isCustomAttribute(i))&&(r||(r=O.getNode(this._rootNodeID)),null!=u?w.setValueForProperty(r,i,u):w.deleteValueForProperty(r,i))}a&&(r||(r=O.getNode(this._rootNodeID)),b.setValueForStyles(r,a))},_updateDOMChildren:function(e,t,n,r){var i=B[g(e.children)]?e.children:null,o=B[g(t.children)]?t.children:null,a=e.dangerouslySetInnerHTML&&e.dangerouslySetInnerHTML.__html,s=t.dangerouslySetInnerHTML&&t.dangerouslySetInnerHTML.__html,u=null!=i?null:e.children,c=null!=o?null:t.children,l=null!=i||null!=a,f=null!=o||null!=s;null!=u&&null==c?this.updateChildren(null,n,r):l&&!f&&this.updateTextContent(""),null!=o?i!==o&&this.updateTextContent(""+o):null!=s?a!==s&&this.updateMarkup(""+s):null!=c&&this.updateChildren(c,n,r)},unmountComponent:function(){switch(this._tag){case"iframe":case"img":case"form":case"video":case"audio":var e=this._wrapperState.listeners;if(e)for(var t=0;t<e.length;t++)e[t].remove();break;case"input":E.unmountWrapper(this);break;case"html":case"head":case"body":I(!1)}if(this.unmountChildren(),C.deleteAllListeners(this._rootNodeID),$.unmountIDFromEnvironment(this._rootNodeID),this._rootNodeID=null,this._wrapperState=null,this._nodeWithLegacyProperties){var n=this._nodeWithLegacyProperties;n._reactInternalComponent=null,this._nodeWithLegacyProperties=null}},getPublicInstance:function(){if(!this._nodeWithLegacyProperties){var e=O.getNode(this._rootNodeID);e._reactInternalComponent=this,e.getDOMNode=r,e.isMounted=i,e.setState=o,e.replaceState=o,e.forceUpdate=o,e.setProps=a,e.replaceProps=s,e.props=this._currentElement.props,this._nodeWithLegacyProperties=e}return this._nodeWithLegacyProperties}},N.measureMethods(v,"ReactDOMComponent",{mountComponent:"mountComponent",updateComponent:"updateComponent"}),j(v.prototype,v.Mixin,R.Mixin),e.exports=v},function(e,t,n){"use strict";var r=n(376),i=n(439),o=n(443),a={componentDidMount:function(){this.props.autoFocus&&o(i(this))}},s={Mixin:a,focusDOMComponent:function(){o(r.getNode(this._rootNodeID))}};e.exports=s},function(e){"use strict";function t(e){try{e.focus()}catch(t){}}e.exports=t},function(e,t,n){"use strict";var r=n(445),i=n(357),o=n(366),a=(n(446),n(448)),s=n(449),u=n(451),c=(n(373),u(function(e){return s(e)})),l=!1,f="cssFloat";if(i.canUseDOM){var p=document.createElement("div").style;try{p.font=""}catch(d){l=!0}void 0===document.documentElement.style.cssFloat&&(f="styleFloat")}var h={createMarkupForStyles:function(e){var t="";for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];null!=r&&(t+=c(n)+":",t+=a(n,r)+";")}return t||null},setValueForStyles:function(e,t){var n=e.style;for(var i in t)if(t.hasOwnProperty(i)){var o=a(i,t[i]);if("float"===i&&(i=f),o)n[i]=o;else{var s=l&&r.shorthandPropertyExpansions[i];if(s)for(var u in s)n[u]="";else n[i]=""}}}};o.measureMethods(h,"CSSPropertyOperations",{setValueForStyles:"setValueForStyles"}),e.exports=h},function(e){"use strict";function t(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}var n={animationIterationCount:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,stopOpacity:!0,strokeDashoffset:!0,strokeOpacity:!0,strokeWidth:!0},r=["Webkit","ms","Moz","O"];Object.keys(n).forEach(function(e){r.forEach(function(r){n[t(r,e)]=n[e]})});var i={background:{backgroundAttachment:!0,backgroundColor:!0,backgroundImage:!0,backgroundPositionX:!0,backgroundPositionY:!0,backgroundRepeat:!0},backgroundPosition:{backgroundPositionX:!0,backgroundPositionY:!0},border:{borderWidth:!0,borderStyle:!0,borderColor:!0},borderBottom:{borderBottomWidth:!0,borderBottomStyle:!0,borderBottomColor:!0},borderLeft:{borderLeftWidth:!0,borderLeftStyle:!0,borderLeftColor:!0},borderRight:{borderRightWidth:!0,borderRightStyle:!0,borderRightColor:!0},borderTop:{borderTopWidth:!0,borderTopStyle:!0,borderTopColor:!0},font:{fontStyle:!0,fontVariant:!0,fontWeight:!0,fontSize:!0,lineHeight:!0,fontFamily:!0},outline:{outlineWidth:!0,outlineStyle:!0,outlineColor:!0}},o={isUnitlessNumber:n,shorthandPropertyExpansions:i};e.exports=o},function(e,t,n){"use strict";function r(e){return i(e.replace(o,"ms-"))}var i=n(447),o=/^-ms-/;e.exports=r},function(e){"use strict";function t(e){return e.replace(n,function(e,t){return t.toUpperCase()})}var n=/-(.)/g;e.exports=t},function(e,t,n){"use strict";function r(e,t){var n=null==t||"boolean"==typeof t||""===t;if(n)return"";var r=isNaN(t);return r||0===t||o.hasOwnProperty(e)&&o[e]?""+t:("string"==typeof t&&(t=t.trim()),t+"px")}var i=n(445),o=i.isUnitlessNumber;e.exports=r},function(e,t,n){"use strict";function r(e){return i(e).replace(o,"-ms-")}var i=n(450),o=/^ms-/;e.exports=r},function(e){"use strict";function t(e){return e.replace(n,"-$1").toLowerCase()}var n=/([A-Z])/g;e.exports=t},function(e){"use strict";function t(e){var t={};return function(n){return t.hasOwnProperty(n)||(t[n]=e.call(this,n)),t[n]}}e.exports=t},function(e){"use strict";var t={onClick:!0,onDoubleClick:!0,onMouseDown:!0,onMouseMove:!0,onMouseUp:!0,onClickCapture:!0,onDoubleClickCapture:!0,onMouseDownCapture:!0,onMouseMoveCapture:!0,onMouseUpCapture:!0},n={getNativeProps:function(e,n){if(!n.disabled)return n;var r={};for(var i in n)n.hasOwnProperty(i)&&!t[i]&&(r[i]=n[i]);return r}};e.exports=n},function(e,t,n){"use strict";function r(){this._rootNodeID&&p.updateWrapper(this);
19
-
20
- }function i(e){var t=this._currentElement.props,n=a.executeOnChange(t,e);u.asap(r,this);var i=t.name;if("radio"===t.type&&null!=i){for(var o=s.getNode(this._rootNodeID),c=o;c.parentNode;)c=c.parentNode;for(var p=c.querySelectorAll("input[name="+JSON.stringify(""+i)+'][type="radio"]'),d=0;d<p.length;d++){var h=p[d];if(h!==o&&h.form===o.form){var m=s.getID(h);m?void 0:l(!1);var v=f[m];v?void 0:l(!1),u.asap(r,v)}}}return n}var o=n(375),a=n(454),s=n(376),u=n(402),c=n(387),l=n(361),f={},p={getNativeProps:function(e,t){var n=a.getValue(t),r=a.getChecked(t),i=c({},t,{defaultChecked:void 0,defaultValue:void 0,value:null!=n?n:e._wrapperState.initialValue,checked:null!=r?r:e._wrapperState.initialChecked,onChange:e._wrapperState.onChange});return i},mountWrapper:function(e,t){var n=t.defaultValue;e._wrapperState={initialChecked:t.defaultChecked||!1,initialValue:null!=n?n:null,onChange:i.bind(e)}},mountReadyWrapper:function(e){f[e._rootNodeID]=e},unmountWrapper:function(e){delete f[e._rootNodeID]},updateWrapper:function(e){var t=e._currentElement.props,n=t.checked;null!=n&&o.updatePropertyByID(e._rootNodeID,"checked",n||!1);var r=a.getValue(t);null!=r&&o.updatePropertyByID(e._rootNodeID,"value",""+r)}};e.exports=p},function(e,t,n){"use strict";function r(e){null!=e.checkedLink&&null!=e.valueLink?c(!1):void 0}function i(e){r(e),null!=e.value||null!=e.onChange?c(!1):void 0}function o(e){r(e),null!=e.checked||null!=e.onChange?c(!1):void 0}function a(e){if(e){var t=e.getName();if(t)return" Check the render method of `"+t+"`."}return""}var s=n(455),u=n(413),c=n(361),l=(n(373),{button:!0,checkbox:!0,image:!0,hidden:!0,radio:!0,reset:!0,submit:!0}),f={value:function(e,t){return!e[t]||l[e.type]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `value` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultValue`. Otherwise, set either `onChange` or `readOnly`.")},checked:function(e,t){return!e[t]||e.onChange||e.readOnly||e.disabled?null:new Error("You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.")},onChange:s.func},p={},d={checkPropTypes:function(e,t,n){for(var r in f){if(f.hasOwnProperty(r))var i=f[r](t,r,e,u.prop);if(i instanceof Error&&!(i.message in p)){p[i.message]=!0;{a(n)}}}},getValue:function(e){return e.valueLink?(i(e),e.valueLink.value):e.value},getChecked:function(e){return e.checkedLink?(o(e),e.checkedLink.value):e.checked},executeOnChange:function(e,t){return e.valueLink?(i(e),e.valueLink.requestChange(t.target.value)):e.checkedLink?(o(e),e.checkedLink.requestChange(t.target.checked)):e.onChange?e.onChange.call(void 0,t):void 0}};e.exports=d},function(e,t,n){"use strict";function r(e){function t(t,n,r,i,o,a){if(i=i||C,a=a||r,null==n[r]){var s=x[o];return t?new Error("Required "+s+" `"+a+"` was not specified in "+("`"+i+"`.")):null}return e(n,r,i,o,a)}var n=t.bind(null,!1);return n.isRequired=t.bind(null,!0),n}function i(e){function t(t,n,r,i,o){var a=t[n],s=m(a);if(s!==e){var u=x[i],c=v(a);return new Error("Invalid "+u+" `"+o+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return r(t)}function o(){return r(w.thatReturns(null))}function a(e){function t(t,n,r,i,o){var a=t[n];if(!Array.isArray(a)){var s=x[i],u=m(a);return new Error("Invalid "+s+" `"+o+"` of type "+("`"+u+"` supplied to `"+r+"`, expected an array."))}for(var c=0;c<a.length;c++){var l=e(a,c,r,i,o+"["+c+"]");if(l instanceof Error)return l}return null}return r(t)}function s(){function e(e,t,n,r,i){if(!b.isValidElement(e[t])){var o=x[r];return new Error("Invalid "+o+" `"+i+"` supplied to "+("`"+n+"`, expected a single ReactElement."))}return null}return r(e)}function u(e){function t(t,n,r,i,o){if(!(t[n]instanceof e)){var a=x[i],s=e.name||C,u=g(t[n]);return new Error("Invalid "+a+" `"+o+"` of type "+("`"+u+"` supplied to `"+r+"`, expected ")+("instance of `"+s+"`."))}return null}return r(t)}function c(e){function t(t,n,r,i,o){for(var a=t[n],s=0;s<e.length;s++)if(a===e[s])return null;var u=x[i],c=JSON.stringify(e);return new Error("Invalid "+u+" `"+o+"` of value `"+a+"` "+("supplied to `"+r+"`, expected one of "+c+"."))}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOf, expected an instance of array.")})}function l(e){function t(t,n,r,i,o){var a=t[n],s=m(a);if("object"!==s){var u=x[i];return new Error("Invalid "+u+" `"+o+"` of type "+("`"+s+"` supplied to `"+r+"`, expected an object."))}for(var c in a)if(a.hasOwnProperty(c)){var l=e(a,c,r,i,o+"."+c);if(l instanceof Error)return l}return null}return r(t)}function f(e){function t(t,n,r,i,o){for(var a=0;a<e.length;a++){var s=e[a];if(null==s(t,n,r,i,o))return null}var u=x[i];return new Error("Invalid "+u+" `"+o+"` supplied to "+("`"+r+"`."))}return r(Array.isArray(e)?t:function(){return new Error("Invalid argument supplied to oneOfType, expected an instance of array.")})}function p(){function e(e,t,n,r,i){if(!h(e[t])){var o=x[r];return new Error("Invalid "+o+" `"+i+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return null}return r(e)}function d(e){function t(t,n,r,i,o){var a=t[n],s=m(a);if("object"!==s){var u=x[i];return new Error("Invalid "+u+" `"+o+"` of type `"+s+"` "+("supplied to `"+r+"`, expected `object`."))}for(var c in e){var l=e[c];if(l){var f=l(a,c,r,i,o+"."+c);if(f)return f}}return null}return r(t)}function h(e){switch("undefined"==typeof e?"undefined":y(e)){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(h);if(null===e||b.isValidElement(e))return!0;var t=_(e);if(!t)return!1;var n,r=t.call(e);if(t!==e.entries){for(;!(n=r.next()).done;)if(!h(n.value))return!1}else for(;!(n=r.next()).done;){var i=n.value;if(i&&!h(i[1]))return!1}return!0;default:return!1}}function m(e){var t="undefined"==typeof e?"undefined":y(e);return Array.isArray(e)?"array":e instanceof RegExp?"object":t}function v(e){var t=m(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function g(e){return e.constructor&&e.constructor.name?e.constructor.name:"<<anonymous>>"}var y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},b=n(390),x=n(414),w=n(363),_=n(456),C="<<anonymous>>",$={array:i("array"),bool:i("boolean"),func:i("function"),number:i("number"),object:i("object"),string:i("string"),any:o(),arrayOf:a,element:s(),instanceOf:u,node:p(),objectOf:l,oneOf:c,oneOfType:f,shape:d};e.exports=$},function(e){"use strict";function t(e){var t=e&&(n&&e[n]||e[r]);return"function"==typeof t?t:void 0}var n="function"==typeof Symbol&&Symbol.iterator,r="@@iterator";e.exports=t},function(e,t,n){"use strict";var r=n(458),i=n(460),o=n(387),a=(n(373),i.valueContextKey),s={mountWrapper:function(e,t,n){var r=n[a],i=null;if(null!=r)if(i=!1,Array.isArray(r)){for(var o=0;o<r.length;o++)if(""+r[o]==""+t.value){i=!0;break}}else i=""+r==""+t.value;e._wrapperState={selected:i}},getNativeProps:function(e,t){var n=o({selected:void 0,children:void 0},t);null!=e._wrapperState.selected&&(n.selected=e._wrapperState.selected);var i="";return r.forEach(t.children,function(e){null!=e&&("string"==typeof e||"number"==typeof e)&&(i+=e)}),i&&(n.children=i),n}};e.exports=s},function(e,t,n){"use strict";function r(e){return(""+e).replace(x,"//")}function i(e,t){this.func=e,this.context=t,this.count=0}function o(e,t){var n=e.func,r=e.context;n.call(r,t,e.count++)}function a(e,t,n){if(null==e)return e;var r=i.getPooled(t,n);g(e,o,r),i.release(r)}function s(e,t,n,r){this.result=e,this.keyPrefix=t,this.func=n,this.context=r,this.count=0}function u(e,t,n){var i=e.result,o=e.keyPrefix,a=e.func,s=e.context,u=a.call(s,t,e.count++);Array.isArray(u)?c(u,i,n,v.thatReturnsArgument):null!=u&&(m.isValidElement(u)&&(u=m.cloneAndReplaceKey(u,o+(u!==t?r(u.key||"")+"/":"")+n)),i.push(u))}function c(e,t,n,i,o){var a="";null!=n&&(a=r(n)+"/");var c=s.getPooled(t,a,i,o);g(e,u,c),s.release(c)}function l(e,t,n){if(null==e)return e;var r=[];return c(e,r,null,t,n),r}function f(){return null}function p(e){return g(e,f,null)}function d(e){var t=[];return c(e,t,null,v.thatReturnsArgument),t}var h=n(404),m=n(390),v=n(363),g=n(459),y=h.twoArgumentPooler,b=h.fourArgumentPooler,x=/\/(?!\/)/g;i.prototype.destructor=function(){this.func=null,this.context=null,this.count=0},h.addPoolingTo(i,y),s.prototype.destructor=function(){this.result=null,this.keyPrefix=null,this.func=null,this.context=null,this.count=0},h.addPoolingTo(s,b);var w={forEach:a,map:l,mapIntoWithKeyPrefixInternal:c,count:p,toArray:d};e.exports=w},function(e,t,n){"use strict";function r(e){return v[e]}function i(e,t){return e&&null!=e.key?a(e.key):t.toString(36)}function o(e){return(""+e).replace(g,r)}function a(e){return"$"+o(e)}function s(e,t,n,r){var o="undefined"==typeof e?"undefined":c(e);if(("undefined"===o||"boolean"===o)&&(e=null),null===e||"string"===o||"number"===o||l.isValidElement(e))return n(r,e,""===t?h+i(e,0):t),1;var u,f,v=0,g=""===t?h:t+m;if(Array.isArray(e))for(var y=0;y<e.length;y++)u=e[y],f=g+i(u,y),v+=s(u,f,n,r);else{var b=p(e);if(b){var x,w=b.call(e);if(b!==e.entries)for(var _=0;!(x=w.next()).done;)u=x.value,f=g+i(u,_++),v+=s(u,f,n,r);else for(;!(x=w.next()).done;){var C=x.value;C&&(u=C[1],f=g+a(C[0])+m+i(u,0),v+=s(u,f,n,r))}}else if("object"===o){{String(e)}d(!1)}}return v}function u(e,t,n){return null==e?0:s(e,"",t,n)}var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},l=(n(353),n(390)),f=n(393),p=n(456),d=n(361),h=(n(373),f.SEPARATOR),m=":",v={"=":"=0",".":"=1",":":"=2"},g=/[=.:]/g;e.exports=u},function(e,t,n){"use strict";function r(){if(this._rootNodeID&&this._wrapperState.pendingUpdate){this._wrapperState.pendingUpdate=!1;var e=this._currentElement.props,t=a.getValue(e);null!=t&&i(this,Boolean(e.multiple),t)}}function i(e,t,n){var r,i,o=s.getNode(e._rootNodeID).options;if(t){for(r={},i=0;i<n.length;i++)r[""+n[i]]=!0;for(i=0;i<o.length;i++){var a=r.hasOwnProperty(o[i].value);o[i].selected!==a&&(o[i].selected=a)}}else{for(r=""+n,i=0;i<o.length;i++)if(o[i].value===r)return void(o[i].selected=!0);o.length&&(o[0].selected=!0)}}function o(e){var t=this._currentElement.props,n=a.executeOnChange(t,e);return this._wrapperState.pendingUpdate=!0,u.asap(r,this),n}var a=n(454),s=n(376),u=n(402),c=n(387),l=(n(373),"__ReactDOMSelect_value$"+Math.random().toString(36).slice(2)),f={valueContextKey:l,getNativeProps:function(e,t){return c({},t,{onChange:e._wrapperState.onChange,value:void 0})},mountWrapper:function(e,t){var n=a.getValue(t);e._wrapperState={pendingUpdate:!1,initialValue:null!=n?n:t.defaultValue,onChange:o.bind(e),wasMultiple:Boolean(t.multiple)}},processChildContext:function(e,t,n){var r=c({},n);return r[l]=e._wrapperState.initialValue,r},postUpdateWrapper:function(e){var t=e._currentElement.props;e._wrapperState.initialValue=void 0;var n=e._wrapperState.wasMultiple;e._wrapperState.wasMultiple=Boolean(t.multiple);var r=a.getValue(t);null!=r?(e._wrapperState.pendingUpdate=!1,i(e,Boolean(t.multiple),r)):n!==Boolean(t.multiple)&&(null!=t.defaultValue?i(e,Boolean(t.multiple),t.defaultValue):i(e,Boolean(t.multiple),t.multiple?[]:""))}};e.exports=f},function(e,t,n){"use strict";function r(){this._rootNodeID&&l.updateWrapper(this)}function i(e){var t=this._currentElement.props,n=o.executeOnChange(t,e);return s.asap(r,this),n}var o=n(454),a=n(375),s=n(402),u=n(387),c=n(361),l=(n(373),{getNativeProps:function(e,t){null!=t.dangerouslySetInnerHTML?c(!1):void 0;var n=u({},t,{defaultValue:void 0,value:void 0,children:e._wrapperState.initialValue,onChange:e._wrapperState.onChange});return n},mountWrapper:function(e,t){var n=t.defaultValue,r=t.children;null!=r&&(null!=n?c(!1):void 0,Array.isArray(r)&&(r.length<=1?void 0:c(!1),r=r[0]),n=""+r),null==n&&(n="");var a=o.getValue(t);e._wrapperState={initialValue:""+(null!=a?a:n),onChange:i.bind(e)}},updateWrapper:function(e){var t=e._currentElement.props,n=o.getValue(t);null!=n&&a.updatePropertyByID(e._rootNodeID,"value",""+n)}});e.exports=l},function(e,t,n){"use strict";function r(e,t,n){v.push({parentID:e,parentNode:null,type:f.INSERT_MARKUP,markupIndex:g.push(t)-1,content:null,fromIndex:null,toIndex:n})}function i(e,t,n){v.push({parentID:e,parentNode:null,type:f.MOVE_EXISTING,markupIndex:null,content:null,fromIndex:t,toIndex:n})}function o(e,t){v.push({parentID:e,parentNode:null,type:f.REMOVE_NODE,markupIndex:null,content:null,fromIndex:t,toIndex:null})}function a(e,t){v.push({parentID:e,parentNode:null,type:f.SET_MARKUP,markupIndex:null,content:t,fromIndex:null,toIndex:null})}function s(e,t){v.push({parentID:e,parentNode:null,type:f.TEXT_CONTENT,markupIndex:null,content:t,fromIndex:null,toIndex:null})}function u(){v.length&&(l.processChildrenUpdates(v,g),c())}function c(){v.length=0,g.length=0}var l=n(412),f=n(364),p=(n(353),n(398)),d=n(463),h=n(464),m=0,v=[],g=[],y={Mixin:{_reconcilerInstantiateChildren:function(e,t,n){return d.instantiateChildren(e,t,n)},_reconcilerUpdateChildren:function(e,t,n,r){var i;return i=h(t),d.updateChildren(e,i,n,r)},mountChildren:function(e,t,n){var r=this._reconcilerInstantiateChildren(e,t,n);this._renderedChildren=r;var i=[],o=0;for(var a in r)if(r.hasOwnProperty(a)){var s=r[a],u=this._rootNodeID+a,c=p.mountComponent(s,u,t,n);s._mountIndex=o++,i.push(c)}return i},updateTextContent:function(e){m++;var t=!0;try{var n=this._renderedChildren;d.unmountChildren(n);for(var r in n)n.hasOwnProperty(r)&&this._unmountChild(n[r]);this.setTextContent(e),t=!1}finally{m--,m||(t?c():u())}},updateMarkup:function(e){m++;var t=!0;try{var n=this._renderedChildren;d.unmountChildren(n);for(var r in n)n.hasOwnProperty(r)&&this._unmountChildByName(n[r],r);this.setMarkup(e),t=!1}finally{m--,m||(t?c():u())}},updateChildren:function(e,t,n){m++;var r=!0;try{this._updateChildren(e,t,n),r=!1}finally{m--,m||(r?c():u())}},_updateChildren:function(e,t,n){var r=this._renderedChildren,i=this._reconcilerUpdateChildren(r,e,t,n);if(this._renderedChildren=i,i||r){var o,a=0,s=0;for(o in i)if(i.hasOwnProperty(o)){var u=r&&r[o],c=i[o];u===c?(this.moveChild(u,s,a),a=Math.max(u._mountIndex,a),u._mountIndex=s):(u&&(a=Math.max(u._mountIndex,a),this._unmountChild(u)),this._mountChildByNameAtIndex(c,o,s,t,n)),s++}for(o in r)!r.hasOwnProperty(o)||i&&i.hasOwnProperty(o)||this._unmountChild(r[o])}},unmountChildren:function(){var e=this._renderedChildren;d.unmountChildren(e),this._renderedChildren=null},moveChild:function(e,t,n){e._mountIndex<n&&i(this._rootNodeID,e._mountIndex,t)},createChild:function(e,t){r(this._rootNodeID,t,e._mountIndex)},removeChild:function(e){o(this._rootNodeID,e._mountIndex)},setTextContent:function(e){s(this._rootNodeID,e)},setMarkup:function(e){a(this._rootNodeID,e)},_mountChildByNameAtIndex:function(e,t,n,r,i){var o=this._rootNodeID+t,a=p.mountComponent(e,o,r,i);e._mountIndex=n,this.createChild(e,a)},_unmountChild:function(e){this.removeChild(e),e._mountIndex=null}}};e.exports=y},function(e,t,n){"use strict";function r(e,t,n){var r=void 0===e[n];null!=t&&r&&(e[n]=o(t,null))}var i=n(398),o=n(410),a=n(415),s=n(459),u=(n(373),{instantiateChildren:function(e){if(null==e)return null;var t={};return s(e,r,t),t},updateChildren:function(e,t,n,r){if(!t&&!e)return null;var s;for(s in t)if(t.hasOwnProperty(s)){var u=e&&e[s],c=u&&u._currentElement,l=t[s];if(null!=u&&a(c,l))i.receiveComponent(u,l,n,r),t[s]=u;else{u&&i.unmountComponent(u,s);var f=o(l,null);t[s]=f}}for(s in e)!e.hasOwnProperty(s)||t&&t.hasOwnProperty(s)||i.unmountComponent(e[s]);return t},unmountChildren:function(e){for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];i.unmountComponent(n)}}});e.exports=u},function(e,t,n){"use strict";function r(e,t,n){var r=e,i=void 0===r[n];i&&null!=t&&(r[n]=t)}function i(e){if(null==e)return e;var t={};return o(e,r,t),t}{var o=n(459);n(373)}e.exports=i},function(e){"use strict";function t(e,t){if(e===t)return!0;if("object"!==("undefined"==typeof e?"undefined":n(e))||null===e||"object"!==("undefined"==typeof t?"undefined":n(t))||null===t)return!1;var i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(var a=r.bind(t),s=0;s<i.length;s++)if(!a(i[s])||e[i[s]]!==t[i[s]])return!1;return!0}var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},r=Object.prototype.hasOwnProperty;e.exports=t},function(e,t,n){"use strict";function r(e){var t=p.getID(e),n=f.getReactRootIDFromNodeID(t),r=p.findReactContainerForID(n),i=p.getFirstReactDOM(r);return i}function i(e,t){this.topLevelType=e,this.nativeEvent=t,this.ancestors=[]}function o(e){a(e)}function a(e){for(var t=p.getFirstReactDOM(m(e.nativeEvent))||window,n=t;n;)e.ancestors.push(n),n=r(n);for(var i=0;i<e.ancestors.length;i++){t=e.ancestors[i];var o=p.getID(t)||"";g._handleTopLevel(e.topLevelType,t,o,e.nativeEvent,m(e.nativeEvent))}}function s(e){var t=v(window);e(t)}var u=n(467),c=n(357),l=n(404),f=n(393),p=n(376),d=n(402),h=n(387),m=n(429),v=n(468);h(i.prototype,{destructor:function(){this.topLevelType=null,this.nativeEvent=null,this.ancestors.length=0}}),l.addPoolingTo(i,l.twoArgumentPooler);var g={_enabled:!0,_handleTopLevel:null,WINDOW_HANDLE:c.canUseDOM?window:null,setHandleTopLevel:function(e){g._handleTopLevel=e},setEnabled:function(e){g._enabled=!!e},isEnabled:function(){return g._enabled},trapBubbledEvent:function(e,t,n){var r=n;return r?u.listen(r,t,g.dispatchEvent.bind(null,e)):null},trapCapturedEvent:function(e,t,n){var r=n;return r?u.capture(r,t,g.dispatchEvent.bind(null,e)):null},monitorScrollValue:function(e){var t=s.bind(null,e);u.listen(window,"scroll",t)},dispatchEvent:function(e,t){if(g._enabled){var n=i.getPooled(e,t);try{d.batchedUpdates(o,n)}finally{i.release(n)}}}};e.exports=g},function(e,t,n){"use strict";var r=n(363),i={listen:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!1),{remove:function(){e.removeEventListener(t,n,!1)}}):e.attachEvent?(e.attachEvent("on"+t,n),{remove:function(){e.detachEvent("on"+t,n)}}):void 0},capture:function(e,t,n){return e.addEventListener?(e.addEventListener(t,n,!0),{remove:function(){e.removeEventListener(t,n,!0)}}):{remove:r}},registerDefault:function(){}};e.exports=i},function(e){"use strict";function t(e){return e===window?{x:window.pageXOffset||document.documentElement.scrollLeft,y:window.pageYOffset||document.documentElement.scrollTop}:{x:e.scrollLeft,y:e.scrollTop}}e.exports=t},function(e,t,n){"use strict";var r=n(371),i=n(379),o=n(412),a=n(470),s=n(416),u=n(377),c=n(417),l=n(366),f=n(394),p=n(402),d={Component:o.injection,Class:a.injection,DOMProperty:r.injection,EmptyComponent:s.injection,EventPluginHub:i.injection,EventEmitter:u.injection,NativeComponent:c.injection,Perf:l.injection,RootIndex:f.injection,Updates:p.injection};e.exports=d},function(e,t,n){"use strict";function r(e,t){var n=C.hasOwnProperty(t)?C[t]:null;S.hasOwnProperty(t)&&(n!==w.OVERRIDE_BASE?g(!1):void 0),e.hasOwnProperty(t)&&(n!==w.DEFINE_MANY&&n!==w.DEFINE_MANY_MERGED?g(!1):void 0)}function i(e,t){if(t){"function"==typeof t?g(!1):void 0,d.isValidElement(t)?g(!1):void 0;var n=e.prototype;t.hasOwnProperty(x)&&$.mixins(e,t.mixins);for(var i in t)if(t.hasOwnProperty(i)&&i!==x){var o=t[i];if(r(n,i),$.hasOwnProperty(i))$[i](e,o);else{var a=C.hasOwnProperty(i),c=n.hasOwnProperty(i),l="function"==typeof o,f=l&&!a&&!c&&t.autobind!==!1;if(f)n.__reactAutoBindMap||(n.__reactAutoBindMap={}),n.__reactAutoBindMap[i]=o,n[i]=o;else if(c){var p=C[i];!a||p!==w.DEFINE_MANY_MERGED&&p!==w.DEFINE_MANY?g(!1):void 0,p===w.DEFINE_MANY_MERGED?n[i]=s(n[i],o):p===w.DEFINE_MANY&&(n[i]=u(n[i],o))}else n[i]=o}}}}function o(e,t){if(t)for(var n in t){var r=t[n];if(t.hasOwnProperty(n)){var i=n in $;i?g(!1):void 0;var o=n in e;o?g(!1):void 0,e[n]=r}}}function a(e,t){e&&t&&"object"===("undefined"==typeof e?"undefined":f(e))&&"object"===("undefined"==typeof t?"undefined":f(t))?void 0:g(!1);for(var n in t)t.hasOwnProperty(n)&&(void 0!==e[n]?g(!1):void 0,e[n]=t[n]);return e}function s(e,t){return function(){var n=e.apply(this,arguments),r=t.apply(this,arguments);if(null==n)return r;if(null==r)return n;var i={};return a(i,n),a(i,r),i}}function u(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function c(e,t){var n=t.bind(e);return n}function l(e){for(var t in e.__reactAutoBindMap)if(e.__reactAutoBindMap.hasOwnProperty(t)){var n=e.__reactAutoBindMap[t];e[t]=c(e,n)}}var f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},p=n(471),d=n(390),h=(n(413),n(414),n(472)),m=n(387),v=n(406),g=n(361),y=n(365),b=n(427),x=(n(373),b({mixins:null})),w=y({DEFINE_ONCE:null,DEFINE_MANY:null,OVERRIDE_BASE:null,DEFINE_MANY_MERGED:null}),_=[],C={mixins:w.DEFINE_MANY,statics:w.DEFINE_MANY,propTypes:w.DEFINE_MANY,contextTypes:w.DEFINE_MANY,childContextTypes:w.DEFINE_MANY,getDefaultProps:w.DEFINE_MANY_MERGED,getInitialState:w.DEFINE_MANY_MERGED,getChildContext:w.DEFINE_MANY_MERGED,render:w.DEFINE_ONCE,componentWillMount:w.DEFINE_MANY,componentDidMount:w.DEFINE_MANY,componentWillReceiveProps:w.DEFINE_MANY,shouldComponentUpdate:w.DEFINE_ONCE,componentWillUpdate:w.DEFINE_MANY,componentDidUpdate:w.DEFINE_MANY,componentWillUnmount:w.DEFINE_MANY,updateComponent:w.OVERRIDE_BASE},$={displayName:function(e,t){e.displayName=t},mixins:function(e,t){if(t)for(var n=0;n<t.length;n++)i(e,t[n])},childContextTypes:function(e,t){e.childContextTypes=m({},e.childContextTypes,t)},contextTypes:function(e,t){e.contextTypes=m({},e.contextTypes,t)},getDefaultProps:function(e,t){e.getDefaultProps=e.getDefaultProps?s(e.getDefaultProps,t):t},propTypes:function(e,t){e.propTypes=m({},e.propTypes,t)},statics:function(e,t){o(e,t)},autobind:function(){}},S={replaceState:function(e,t){this.updater.enqueueReplaceState(this,e),t&&this.updater.enqueueCallback(this,t)},isMounted:function(){return this.updater.isMounted(this)},setProps:function(e,t){this.updater.enqueueSetProps(this,e),t&&this.updater.enqueueCallback(this,t)},replaceProps:function(e,t){this.updater.enqueueReplaceProps(this,e),t&&this.updater.enqueueCallback(this,t)}},E=function(){};m(E.prototype,p.prototype,S);var P={createClass:function(e){var t=function r(e,t,n){this.__reactAutoBindMap&&l(this),this.props=e,this.context=t,this.refs=v,this.updater=n||h,this.state=null;var r=this.getInitialState?this.getInitialState():null;"object"!==("undefined"==typeof r?"undefined":f(r))||Array.isArray(r)?g(!1):void 0,this.state=r};t.prototype=new E,t.prototype.constructor=t,_.forEach(i.bind(null,t)),i(t,e),t.getDefaultProps&&(t.defaultProps=t.getDefaultProps()),t.prototype.render?void 0:g(!1);for(var n in C)t.prototype[n]||(t.prototype[n]=null);return t},injection:{injectMixin:function(e){_.push(e)}}};e.exports=P},function(e,t,n){"use strict";function r(e,t,n){this.props=e,this.context=t,this.refs=a,this.updater=n||o}{var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=n(472),a=(n(391),n(406)),s=n(361);n(373)}r.prototype.isReactComponent={},r.prototype.setState=function(e,t){"object"!==("undefined"==typeof e?"undefined":i(e))&&"function"!=typeof e&&null!=e?s(!1):void 0,this.updater.enqueueSetState(this,e),t&&this.updater.enqueueCallback(this,t)},r.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this),e&&this.updater.enqueueCallback(this,e)};e.exports=r},function(e,t,n){"use strict";function r(e,t){}var i=(n(373),{isMounted:function(){return!1},enqueueCallback:function(){},enqueueForceUpdate:function(e){r(e,"forceUpdate")},enqueueReplaceState:function(e){r(e,"replaceState")},enqueueSetState:function(e){r(e,"setState")},enqueueSetProps:function(e){r(e,"setProps")},enqueueReplaceProps:function(e){r(e,"replaceProps")}});e.exports=i},function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=!1,this.reactMountReady=i.getPooled(null),this.useCreateElement=!e&&s.useCreateElement}var i=n(403),o=n(404),a=n(377),s=n(389),u=n(474),c=n(405),l=n(387),f={initialize:u.getSelectionInformation,close:u.restoreSelection},p={initialize:function(){var e=a.isEnabled();return a.setEnabled(!1),e},close:function(e){a.setEnabled(e)}},d={initialize:function(){this.reactMountReady.reset()},close:function(){this.reactMountReady.notifyAll()}},h=[f,p,d],m={getTransactionWrappers:function(){return h},getReactMountReady:function(){return this.reactMountReady},destructor:function(){i.release(this.reactMountReady),this.reactMountReady=null}};l(r.prototype,c.Mixin,m),o.addPoolingTo(r),e.exports=r},function(e,t,n){"use strict";function r(e){return o(document.documentElement,e)}var i=n(475),o=n(407),a=n(443),s=n(477),u={hasSelectionCapabilities:function(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&"text"===e.type||"textarea"===t||"true"===e.contentEditable)},getSelectionInformation:function(){var e=s();return{focusedElem:e,selectionRange:u.hasSelectionCapabilities(e)?u.getSelection(e):null}},restoreSelection:function(e){var t=s(),n=e.focusedElem,i=e.selectionRange;t!==n&&r(n)&&(u.hasSelectionCapabilities(n)&&u.setSelection(n,i),a(n))},getSelection:function(e){var t;if("selectionStart"in e)t={start:e.selectionStart,end:e.selectionEnd};else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var n=document.selection.createRange();n.parentElement()===e&&(t={start:-n.moveStart("character",-e.value.length),end:-n.moveEnd("character",-e.value.length)})}else t=i.getOffsets(e);return t||{start:0,end:0}},setSelection:function(e,t){var n=t.start,r=t.end;if("undefined"==typeof r&&(r=n),"selectionStart"in e)e.selectionStart=n,e.selectionEnd=Math.min(r,e.value.length);else if(document.selection&&e.nodeName&&"input"===e.nodeName.toLowerCase()){var o=e.createTextRange();o.collapse(!0),o.moveStart("character",n),o.moveEnd("character",r-n),o.select()}else i.setOffsets(e,t)}};e.exports=u},function(e,t,n){"use strict";function r(e,t,n,r){return e===n&&t===r}function i(e){var t=document.selection,n=t.createRange(),r=n.text.length,i=n.duplicate();i.moveToElementText(e),i.setEndPoint("EndToStart",n);var o=i.text.length,a=o+r;return{start:o,end:a}}function o(e){var t=window.getSelection&&window.getSelection();if(!t||0===t.rangeCount)return null;var n=t.anchorNode,i=t.anchorOffset,o=t.focusNode,a=t.focusOffset,s=t.getRangeAt(0);try{s.startContainer.nodeType,s.endContainer.nodeType}catch(u){return null}var c=r(t.anchorNode,t.anchorOffset,t.focusNode,t.focusOffset),l=c?0:s.toString().length,f=s.cloneRange();f.selectNodeContents(e),f.setEnd(s.startContainer,s.startOffset);var p=r(f.startContainer,f.startOffset,f.endContainer,f.endOffset),d=p?0:f.toString().length,h=d+l,m=document.createRange();m.setStart(n,i),m.setEnd(o,a);var v=m.collapsed;return{start:v?h:d,end:v?d:h}}function a(e,t){var n,r,i=document.selection.createRange().duplicate();"undefined"==typeof t.end?(n=t.start,r=n):t.start>t.end?(n=t.end,r=t.start):(n=t.start,r=t.end),i.moveToElementText(e),i.moveStart("character",n),i.setEndPoint("EndToStart",i),i.moveEnd("character",r-n),i.select()}function s(e,t){if(window.getSelection){var n=window.getSelection(),r=e[l()].length,i=Math.min(t.start,r),o="undefined"==typeof t.end?i:Math.min(t.end,r);if(!n.extend&&i>o){var a=o;o=i,i=a}var s=c(e,i),u=c(e,o);if(s&&u){var f=document.createRange();f.setStart(s.node,s.offset),n.removeAllRanges(),i>o?(n.addRange(f),n.extend(u.node,u.offset)):(f.setEnd(u.node,u.offset),n.addRange(f))}}}var u=n(357),c=n(476),l=n(423),f=u.canUseDOM&&"selection"in document&&!("getSelection"in window),p={getOffsets:f?i:o,setOffsets:f?a:s};e.exports=p},function(e){"use strict";function t(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function n(e){for(;e;){if(e.nextSibling)return e.nextSibling;e=e.parentNode}}function r(e,r){for(var i=t(e),o=0,a=0;i;){if(3===i.nodeType){if(a=o+i.textContent.length,r>=o&&a>=r)return{node:i,offset:r-o};o=a}i=t(n(i))}}e.exports=r},function(e){"use strict";function t(){if("undefined"==typeof document)return null;try{return document.activeElement||document.body}catch(e){return document.body}}e.exports=t},function(e,t,n){"use strict";function r(e){if("selectionStart"in e&&u.hasSelectionCapabilities(e))return{start:e.selectionStart,end:e.selectionEnd};if(window.getSelection){var t=window.getSelection();return{anchorNode:t.anchorNode,anchorOffset:t.anchorOffset,focusNode:t.focusNode,focusOffset:t.focusOffset}}if(document.selection){var n=document.selection.createRange();return{parentElement:n.parentElement(),text:n.text,top:n.boundingTop,left:n.boundingLeft}}}function i(e,t){if(x||null==g||g!==l())return null;var n=r(g);if(!b||!d(b,n)){b=n;var i=c.getPooled(v.select,y,e,t);return i.type="select",i.target=g,a.accumulateTwoPhaseDispatches(i),i}return null}var o=n(378),a=n(421),s=n(357),u=n(474),c=n(425),l=n(477),f=n(430),p=n(427),d=n(465),h=o.topLevelTypes,m=s.canUseDOM&&"documentMode"in document&&document.documentMode<=11,v={select:{phasedRegistrationNames:{bubbled:p({onSelect:null}),captured:p({onSelectCapture:null})},dependencies:[h.topBlur,h.topContextMenu,h.topFocus,h.topKeyDown,h.topMouseDown,h.topMouseUp,h.topSelectionChange]}},g=null,y=null,b=null,x=!1,w=!1,_=p({onSelect:null}),C={eventTypes:v,extractEvents:function(e,t,n,r,o){if(!w)return null;switch(e){case h.topFocus:(f(t)||"true"===t.contentEditable)&&(g=t,y=n,b=null);break;case h.topBlur:g=null,y=null,b=null;break;case h.topMouseDown:x=!0;break;case h.topContextMenu:case h.topMouseUp:return x=!1,i(r,o);case h.topSelectionChange:if(m)break;case h.topKeyDown:case h.topKeyUp:return i(r,o)}return null},didPutListener:function(e,t){t===_&&(w=!0)}};e.exports=C},function(e){"use strict";var t=Math.pow(2,53),n={createReactRootIndex:function(){return Math.ceil(Math.random()*t)}};e.exports=n},function(e,t,n){"use strict";var r=n(378),i=n(467),o=n(421),a=n(376),s=n(481),u=n(425),c=n(482),l=n(483),f=n(434),p=n(486),d=n(487),h=n(435),m=n(488),v=n(363),g=n(484),y=n(361),b=n(427),x=r.topLevelTypes,w={abort:{phasedRegistrationNames:{bubbled:b({onAbort:!0}),captured:b({onAbortCapture:!0})}},blur:{phasedRegistrationNames:{bubbled:b({onBlur:!0}),captured:b({onBlurCapture:!0})}},canPlay:{phasedRegistrationNames:{bubbled:b({onCanPlay:!0}),captured:b({onCanPlayCapture:!0})}},canPlayThrough:{phasedRegistrationNames:{bubbled:b({onCanPlayThrough:!0}),captured:b({onCanPlayThroughCapture:!0})}},click:{phasedRegistrationNames:{bubbled:b({onClick:!0}),captured:b({onClickCapture:!0})}},contextMenu:{phasedRegistrationNames:{bubbled:b({onContextMenu:!0}),captured:b({onContextMenuCapture:!0})}},copy:{phasedRegistrationNames:{bubbled:b({onCopy:!0}),captured:b({onCopyCapture:!0})}},cut:{phasedRegistrationNames:{bubbled:b({onCut:!0}),captured:b({onCutCapture:!0})}},doubleClick:{phasedRegistrationNames:{bubbled:b({onDoubleClick:!0}),captured:b({onDoubleClickCapture:!0})}},drag:{phasedRegistrationNames:{bubbled:b({onDrag:!0}),captured:b({onDragCapture:!0})}},dragEnd:{phasedRegistrationNames:{bubbled:b({onDragEnd:!0}),captured:b({onDragEndCapture:!0})}},dragEnter:{phasedRegistrationNames:{bubbled:b({onDragEnter:!0}),captured:b({onDragEnterCapture:!0})}},dragExit:{phasedRegistrationNames:{bubbled:b({onDragExit:!0}),captured:b({onDragExitCapture:!0})}},dragLeave:{phasedRegistrationNames:{bubbled:b({onDragLeave:!0}),captured:b({onDragLeaveCapture:!0})}},dragOver:{phasedRegistrationNames:{bubbled:b({onDragOver:!0}),captured:b({onDragOverCapture:!0})}},dragStart:{phasedRegistrationNames:{
21
- bubbled:b({onDragStart:!0}),captured:b({onDragStartCapture:!0})}},drop:{phasedRegistrationNames:{bubbled:b({onDrop:!0}),captured:b({onDropCapture:!0})}},durationChange:{phasedRegistrationNames:{bubbled:b({onDurationChange:!0}),captured:b({onDurationChangeCapture:!0})}},emptied:{phasedRegistrationNames:{bubbled:b({onEmptied:!0}),captured:b({onEmptiedCapture:!0})}},encrypted:{phasedRegistrationNames:{bubbled:b({onEncrypted:!0}),captured:b({onEncryptedCapture:!0})}},ended:{phasedRegistrationNames:{bubbled:b({onEnded:!0}),captured:b({onEndedCapture:!0})}},error:{phasedRegistrationNames:{bubbled:b({onError:!0}),captured:b({onErrorCapture:!0})}},focus:{phasedRegistrationNames:{bubbled:b({onFocus:!0}),captured:b({onFocusCapture:!0})}},input:{phasedRegistrationNames:{bubbled:b({onInput:!0}),captured:b({onInputCapture:!0})}},keyDown:{phasedRegistrationNames:{bubbled:b({onKeyDown:!0}),captured:b({onKeyDownCapture:!0})}},keyPress:{phasedRegistrationNames:{bubbled:b({onKeyPress:!0}),captured:b({onKeyPressCapture:!0})}},keyUp:{phasedRegistrationNames:{bubbled:b({onKeyUp:!0}),captured:b({onKeyUpCapture:!0})}},load:{phasedRegistrationNames:{bubbled:b({onLoad:!0}),captured:b({onLoadCapture:!0})}},loadedData:{phasedRegistrationNames:{bubbled:b({onLoadedData:!0}),captured:b({onLoadedDataCapture:!0})}},loadedMetadata:{phasedRegistrationNames:{bubbled:b({onLoadedMetadata:!0}),captured:b({onLoadedMetadataCapture:!0})}},loadStart:{phasedRegistrationNames:{bubbled:b({onLoadStart:!0}),captured:b({onLoadStartCapture:!0})}},mouseDown:{phasedRegistrationNames:{bubbled:b({onMouseDown:!0}),captured:b({onMouseDownCapture:!0})}},mouseMove:{phasedRegistrationNames:{bubbled:b({onMouseMove:!0}),captured:b({onMouseMoveCapture:!0})}},mouseOut:{phasedRegistrationNames:{bubbled:b({onMouseOut:!0}),captured:b({onMouseOutCapture:!0})}},mouseOver:{phasedRegistrationNames:{bubbled:b({onMouseOver:!0}),captured:b({onMouseOverCapture:!0})}},mouseUp:{phasedRegistrationNames:{bubbled:b({onMouseUp:!0}),captured:b({onMouseUpCapture:!0})}},paste:{phasedRegistrationNames:{bubbled:b({onPaste:!0}),captured:b({onPasteCapture:!0})}},pause:{phasedRegistrationNames:{bubbled:b({onPause:!0}),captured:b({onPauseCapture:!0})}},play:{phasedRegistrationNames:{bubbled:b({onPlay:!0}),captured:b({onPlayCapture:!0})}},playing:{phasedRegistrationNames:{bubbled:b({onPlaying:!0}),captured:b({onPlayingCapture:!0})}},progress:{phasedRegistrationNames:{bubbled:b({onProgress:!0}),captured:b({onProgressCapture:!0})}},rateChange:{phasedRegistrationNames:{bubbled:b({onRateChange:!0}),captured:b({onRateChangeCapture:!0})}},reset:{phasedRegistrationNames:{bubbled:b({onReset:!0}),captured:b({onResetCapture:!0})}},scroll:{phasedRegistrationNames:{bubbled:b({onScroll:!0}),captured:b({onScrollCapture:!0})}},seeked:{phasedRegistrationNames:{bubbled:b({onSeeked:!0}),captured:b({onSeekedCapture:!0})}},seeking:{phasedRegistrationNames:{bubbled:b({onSeeking:!0}),captured:b({onSeekingCapture:!0})}},stalled:{phasedRegistrationNames:{bubbled:b({onStalled:!0}),captured:b({onStalledCapture:!0})}},submit:{phasedRegistrationNames:{bubbled:b({onSubmit:!0}),captured:b({onSubmitCapture:!0})}},suspend:{phasedRegistrationNames:{bubbled:b({onSuspend:!0}),captured:b({onSuspendCapture:!0})}},timeUpdate:{phasedRegistrationNames:{bubbled:b({onTimeUpdate:!0}),captured:b({onTimeUpdateCapture:!0})}},touchCancel:{phasedRegistrationNames:{bubbled:b({onTouchCancel:!0}),captured:b({onTouchCancelCapture:!0})}},touchEnd:{phasedRegistrationNames:{bubbled:b({onTouchEnd:!0}),captured:b({onTouchEndCapture:!0})}},touchMove:{phasedRegistrationNames:{bubbled:b({onTouchMove:!0}),captured:b({onTouchMoveCapture:!0})}},touchStart:{phasedRegistrationNames:{bubbled:b({onTouchStart:!0}),captured:b({onTouchStartCapture:!0})}},volumeChange:{phasedRegistrationNames:{bubbled:b({onVolumeChange:!0}),captured:b({onVolumeChangeCapture:!0})}},waiting:{phasedRegistrationNames:{bubbled:b({onWaiting:!0}),captured:b({onWaitingCapture:!0})}},wheel:{phasedRegistrationNames:{bubbled:b({onWheel:!0}),captured:b({onWheelCapture:!0})}}},_={topAbort:w.abort,topBlur:w.blur,topCanPlay:w.canPlay,topCanPlayThrough:w.canPlayThrough,topClick:w.click,topContextMenu:w.contextMenu,topCopy:w.copy,topCut:w.cut,topDoubleClick:w.doubleClick,topDrag:w.drag,topDragEnd:w.dragEnd,topDragEnter:w.dragEnter,topDragExit:w.dragExit,topDragLeave:w.dragLeave,topDragOver:w.dragOver,topDragStart:w.dragStart,topDrop:w.drop,topDurationChange:w.durationChange,topEmptied:w.emptied,topEncrypted:w.encrypted,topEnded:w.ended,topError:w.error,topFocus:w.focus,topInput:w.input,topKeyDown:w.keyDown,topKeyPress:w.keyPress,topKeyUp:w.keyUp,topLoad:w.load,topLoadedData:w.loadedData,topLoadedMetadata:w.loadedMetadata,topLoadStart:w.loadStart,topMouseDown:w.mouseDown,topMouseMove:w.mouseMove,topMouseOut:w.mouseOut,topMouseOver:w.mouseOver,topMouseUp:w.mouseUp,topPaste:w.paste,topPause:w.pause,topPlay:w.play,topPlaying:w.playing,topProgress:w.progress,topRateChange:w.rateChange,topReset:w.reset,topScroll:w.scroll,topSeeked:w.seeked,topSeeking:w.seeking,topStalled:w.stalled,topSubmit:w.submit,topSuspend:w.suspend,topTimeUpdate:w.timeUpdate,topTouchCancel:w.touchCancel,topTouchEnd:w.touchEnd,topTouchMove:w.touchMove,topTouchStart:w.touchStart,topVolumeChange:w.volumeChange,topWaiting:w.waiting,topWheel:w.wheel};for(var C in _)_[C].dependencies=[C];var $=b({onClick:null}),S={},E={eventTypes:w,extractEvents:function(e,t,n,r,i){var a=_[e];if(!a)return null;var v;switch(e){case x.topAbort:case x.topCanPlay:case x.topCanPlayThrough:case x.topDurationChange:case x.topEmptied:case x.topEncrypted:case x.topEnded:case x.topError:case x.topInput:case x.topLoad:case x.topLoadedData:case x.topLoadedMetadata:case x.topLoadStart:case x.topPause:case x.topPlay:case x.topPlaying:case x.topProgress:case x.topRateChange:case x.topReset:case x.topSeeked:case x.topSeeking:case x.topStalled:case x.topSubmit:case x.topSuspend:case x.topTimeUpdate:case x.topVolumeChange:case x.topWaiting:v=u;break;case x.topKeyPress:if(0===g(r))return null;case x.topKeyDown:case x.topKeyUp:v=l;break;case x.topBlur:case x.topFocus:v=c;break;case x.topClick:if(2===r.button)return null;case x.topContextMenu:case x.topDoubleClick:case x.topMouseDown:case x.topMouseMove:case x.topMouseOut:case x.topMouseOver:case x.topMouseUp:v=f;break;case x.topDrag:case x.topDragEnd:case x.topDragEnter:case x.topDragExit:case x.topDragLeave:case x.topDragOver:case x.topDragStart:case x.topDrop:v=p;break;case x.topTouchCancel:case x.topTouchEnd:case x.topTouchMove:case x.topTouchStart:v=d;break;case x.topScroll:v=h;break;case x.topWheel:v=m;break;case x.topCopy:case x.topCut:case x.topPaste:v=s}v?void 0:y(!1);var b=v.getPooled(a,n,r,i);return o.accumulateTwoPhaseDispatches(b),b},didPutListener:function(e,t){if(t===$){var n=a.getNode(e);S[e]||(S[e]=i.listen(n,"click",v))}},willDeleteListener:function(e,t){t===$&&(S[e].remove(),delete S[e])}};e.exports=E},function(e,t,n){"use strict";function r(e,t,n,r){i.call(this,e,t,n,r)}var i=n(425),o={clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}};i.augmentClass(r,o),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){i.call(this,e,t,n,r)}var i=n(435),o={relatedTarget:null};i.augmentClass(r,o),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){i.call(this,e,t,n,r)}var i=n(435),o=n(484),a=n(485),s=n(436),u={key:a,location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:s,charCode:function(e){return"keypress"===e.type?o(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?o(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}};i.augmentClass(r,u),e.exports=r},function(e){"use strict";function t(e){var t,n=e.keyCode;return"charCode"in e?(t=e.charCode,0===t&&13===n&&(t=13)):t=n,t>=32||13===t?t:0}e.exports=t},function(e,t,n){"use strict";function r(e){if(e.key){var t=o[e.key]||e.key;if("Unidentified"!==t)return t}if("keypress"===e.type){var n=i(e);return 13===n?"Enter":String.fromCharCode(n)}return"keydown"===e.type||"keyup"===e.type?a[e.keyCode]||"Unidentified":""}var i=n(484),o={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},a={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"};e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){i.call(this,e,t,n,r)}var i=n(434),o={dataTransfer:null};i.augmentClass(r,o),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){i.call(this,e,t,n,r)}var i=n(435),o=n(436),a={touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:o};i.augmentClass(r,a),e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){i.call(this,e,t,n,r)}var i=n(434),o={deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null};i.augmentClass(r,o),e.exports=r},function(e,t,n){"use strict";var r=n(371),i=r.injection.MUST_USE_ATTRIBUTE,o={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},a={Properties:{clipPath:i,cx:i,cy:i,d:i,dx:i,dy:i,fill:i,fillOpacity:i,fontFamily:i,fontSize:i,fx:i,fy:i,gradientTransform:i,gradientUnits:i,markerEnd:i,markerMid:i,markerStart:i,offset:i,opacity:i,patternContentUnits:i,patternUnits:i,points:i,preserveAspectRatio:i,r:i,rx:i,ry:i,spreadMethod:i,stopColor:i,stopOpacity:i,stroke:i,strokeDasharray:i,strokeLinecap:i,strokeOpacity:i,strokeWidth:i,textAnchor:i,transform:i,version:i,viewBox:i,x1:i,x2:i,x:i,xlinkActuate:i,xlinkArcrole:i,xlinkHref:i,xlinkRole:i,xlinkShow:i,xlinkTitle:i,xlinkType:i,xmlBase:i,xmlLang:i,xmlSpace:i,y1:i,y2:i,y:i},DOMAttributeNamespaces:{xlinkActuate:o.xlink,xlinkArcrole:o.xlink,xlinkHref:o.xlink,xlinkRole:o.xlink,xlinkShow:o.xlink,xlinkTitle:o.xlink,xlinkType:o.xlink,xmlBase:o.xml,xmlLang:o.xml,xmlSpace:o.xml},DOMAttributeNames:{clipPath:"clip-path",fillOpacity:"fill-opacity",fontFamily:"font-family",fontSize:"font-size",gradientTransform:"gradientTransform",gradientUnits:"gradientUnits",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",patternContentUnits:"patternContentUnits",patternUnits:"patternUnits",preserveAspectRatio:"preserveAspectRatio",spreadMethod:"spreadMethod",stopColor:"stop-color",stopOpacity:"stop-opacity",strokeDasharray:"stroke-dasharray",strokeLinecap:"stroke-linecap",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",viewBox:"viewBox",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlLang:"xml:lang",xmlSpace:"xml:space"}};e.exports=a},function(e){"use strict";e.exports="0.14.7"},function(e,t,n){"use strict";var r=n(376);e.exports=r.renderSubtreeIntoContainer},function(e,t,n){"use strict";var r=n(419),i=n(493),o=n(490);r.inject();var a={renderToString:i.renderToString,renderToStaticMarkup:i.renderToStaticMarkup,version:o};e.exports=a},function(e,t,n){"use strict";function r(e){a.isValidElement(e)?void 0:h(!1);var t;try{f.injection.injectBatchingStrategy(c);var n=s.createReactRootID();return t=l.getPooled(!1),t.perform(function(){var r=d(e,null),i=r.mountComponent(n,t,p);return u.addChecksumToMarkup(i)},null)}finally{l.release(t),f.injection.injectBatchingStrategy(o)}}function i(e){a.isValidElement(e)?void 0:h(!1);var t;try{f.injection.injectBatchingStrategy(c);var n=s.createReactRootID();return t=l.getPooled(!0),t.perform(function(){var r=d(e,null);return r.mountComponent(n,t,p)},null)}finally{l.release(t),f.injection.injectBatchingStrategy(o)}}var o=n(440),a=n(390),s=n(393),u=n(396),c=n(494),l=n(495),f=n(402),p=n(406),d=n(410),h=n(361);e.exports={renderToString:r,renderToStaticMarkup:i}},function(e){"use strict";var t={isBatchingUpdates:!1,batchedUpdates:function(){}};e.exports=t},function(e,t,n){"use strict";function r(e){this.reinitializeTransaction(),this.renderToStaticMarkup=e,this.reactMountReady=o.getPooled(null),this.useCreateElement=!1}var i=n(404),o=n(403),a=n(405),s=n(387),u=n(363),c={initialize:function(){this.reactMountReady.reset()},close:u},l=[c],f={getTransactionWrappers:function(){return l},getReactMountReady:function(){return this.reactMountReady},destructor:function(){o.release(this.reactMountReady),this.reactMountReady=null}};s(r.prototype,a.Mixin,f),i.addPoolingTo(r),e.exports=r},function(e,t,n){"use strict";var r=n(458),i=n(471),o=n(470),a=n(497),s=n(390),u=(n(498),n(455)),c=n(490),l=n(387),f=n(500),p=s.createElement,d=s.createFactory,h=s.cloneElement,m={Children:{map:r.map,forEach:r.forEach,count:r.count,toArray:r.toArray,only:f},Component:i,createElement:p,cloneElement:h,isValidElement:s.isValidElement,PropTypes:u,createClass:o.createClass,createFactory:d,createMixin:function(e){return e},DOM:a,version:c,__spread:l};e.exports=m},function(e,t,n){"use strict";function r(e){return i.createFactory(e)}var i=n(390),o=(n(498),n(499)),a=o({a:"a",abbr:"abbr",address:"address",area:"area",article:"article",aside:"aside",audio:"audio",b:"b",base:"base",bdi:"bdi",bdo:"bdo",big:"big",blockquote:"blockquote",body:"body",br:"br",button:"button",canvas:"canvas",caption:"caption",cite:"cite",code:"code",col:"col",colgroup:"colgroup",data:"data",datalist:"datalist",dd:"dd",del:"del",details:"details",dfn:"dfn",dialog:"dialog",div:"div",dl:"dl",dt:"dt",em:"em",embed:"embed",fieldset:"fieldset",figcaption:"figcaption",figure:"figure",footer:"footer",form:"form",h1:"h1",h2:"h2",h3:"h3",h4:"h4",h5:"h5",h6:"h6",head:"head",header:"header",hgroup:"hgroup",hr:"hr",html:"html",i:"i",iframe:"iframe",img:"img",input:"input",ins:"ins",kbd:"kbd",keygen:"keygen",label:"label",legend:"legend",li:"li",link:"link",main:"main",map:"map",mark:"mark",menu:"menu",menuitem:"menuitem",meta:"meta",meter:"meter",nav:"nav",noscript:"noscript",object:"object",ol:"ol",optgroup:"optgroup",option:"option",output:"output",p:"p",param:"param",picture:"picture",pre:"pre",progress:"progress",q:"q",rp:"rp",rt:"rt",ruby:"ruby",s:"s",samp:"samp",script:"script",section:"section",select:"select",small:"small",source:"source",span:"span",strong:"strong",style:"style",sub:"sub",summary:"summary",sup:"sup",table:"table",tbody:"tbody",td:"td",textarea:"textarea",tfoot:"tfoot",th:"th",thead:"thead",time:"time",title:"title",tr:"tr",track:"track",u:"u",ul:"ul","var":"var",video:"video",wbr:"wbr",circle:"circle",clipPath:"clipPath",defs:"defs",ellipse:"ellipse",g:"g",image:"image",line:"line",linearGradient:"linearGradient",mask:"mask",path:"path",pattern:"pattern",polygon:"polygon",polyline:"polyline",radialGradient:"radialGradient",rect:"rect",stop:"stop",svg:"svg",text:"text",tspan:"tspan"},r);e.exports=a},function(e,t,n){"use strict";function r(){if(p.current){var e=p.current.getName();if(e)return" Check the render method of `"+e+"`."}return""}function i(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;{o("uniqueKey",e,t)}}}function o(e,t,n){var i=r();if(!i){var o="string"==typeof n?n:n.displayName||n.name;o&&(i=" Check the top-level render call using <"+o+">.")}var a=m[e]||(m[e]={});if(a[i])return null;a[i]=!0;var s={parentOrOwner:i,url:" See https://fb.me/react-warning-keys for more information.",childOwner:null};return t&&t._owner&&t._owner!==p.current&&(s.childOwner=" It was passed a child from "+t._owner.getName()+"."),s}function a(e,t){if("object"===("undefined"==typeof e?"undefined":c(e)))if(Array.isArray(e))for(var n=0;n<e.length;n++){var r=e[n];l.isValidElement(r)&&i(r,t)}else if(l.isValidElement(e))e._store&&(e._store.validated=!0);else if(e){var o=d(e);if(o&&o!==e.entries)for(var a,s=o.call(e);!(a=s.next()).done;)l.isValidElement(a.value)&&i(a.value,t)}}function s(e,t,n,i){for(var o in t)if(t.hasOwnProperty(o)){var a;try{"function"!=typeof t[o]?h(!1):void 0,a=t[o](n,o,e,i)}catch(s){a=s}if(a instanceof Error&&!(a.message in v)){v[a.message]=!0;{r()}}}}function u(e){var t=e.type;if("function"==typeof t){var n=t.displayName||t.name;t.propTypes&&s(n,t.propTypes,e.props,f.prop),"function"==typeof t.getDefaultProps}}var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},l=n(390),f=n(413),p=(n(414),n(353)),d=(n(391),n(456)),h=n(361),m=(n(373),{}),v={},g={createElement:function(e){var t="string"==typeof e||"function"==typeof e,n=l.createElement.apply(this,arguments);if(null==n)return n;if(t)for(var r=2;r<arguments.length;r++)a(arguments[r],e);return u(n),n},createFactory:function(e){var t=g.createElement.bind(null,e);return t.type=e,t},cloneElement:function(){for(var e=l.cloneElement.apply(this,arguments),t=2;t<arguments.length;t++)a(arguments[t],e.type);return u(e),e}};e.exports=g},function(e){"use strict";function t(e,t,r){if(!e)return null;var i={};for(var o in e)n.call(e,o)&&(i[o]=t.call(r,e[o],o,e));return i}var n=Object.prototype.hasOwnProperty;e.exports=t},function(e,t,n){"use strict";function r(e){return i.isValidElement(e)?void 0:o(!1),e}var i=n(390),o=n(361);e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,i){return i}n(387),n(373);e.exports=r},function(e,t,n){"use strict";e.exports=n(352)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e){var t="string"==typeof e,n=void 0;if(n=t?document.querySelector(e):e,!a(n)){var r="Container must be `string` or `HTMLElement`.";throw t&&(r+=" Unable to find "+e),new Error(r)}return n}function a(e){return e instanceof HTMLElement||!!e&&e.nodeType>0}function s(e){var t=1===e.button;return t||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}function u(e){return function(t,n){return t||n?t&&!n?e+"--"+t:t&&n?e+"--"+t+"__"+n:!t&&n?e+"__"+n:void 0:e}}function c(e){var t=e.transformData,n=e.defaultTemplates,r=e.templates,i=e.templatesConfig,o=l(n,r);return v({transformData:t,templatesConfig:i},o)}function l(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=O["default"]([].concat(i(k["default"](e)),i(k["default"](t))));return y["default"](n,function(n,r){var i=e[r],o=t[r],a=void 0!==o&&o!==i;return n.templates[r]=a?o:i,n.useCustomCompileOptions[r]=a,n},{templates:{},useCustomCompileOptions:{}})}function f(e,t,n,r,i){var o={type:t,attributeName:n,name:r},a=_["default"](i,{name:n}),s=void 0;if("hierarchical"===t){var u=e.getHierarchicalFacetByName(n),c=r.split(u.separator);o.name=c[c.length-1];for(var l=0;void 0!==a&&l<c.length;++l)a=_["default"](a.data,{name:c[l]});s=$["default"](a,"count")}else s=$["default"](a,'data["'+o.name+'"]');var f=$["default"](a,"exhaustive");return void 0!==s&&(o.count=s),void 0!==f&&(o.exhaustive=f),o}function p(e,t){var n=[];return x["default"](t.facetsRefinements,function(r,i){x["default"](r,function(r){n.push(f(t,"facet",i,r,e.facets))})}),x["default"](t.facetsExcludes,function(e,t){x["default"](e,function(e){n.push({type:"exclude",attributeName:t,name:e,exclude:!0})})}),x["default"](t.disjunctiveFacetsRefinements,function(r,i){x["default"](r,function(r){n.push(f(t,"disjunctive",i,r,e.disjunctiveFacets))})}),x["default"](t.hierarchicalFacetsRefinements,function(r,i){x["default"](r,function(r){n.push(f(t,"hierarchical",i,r,e.hierarchicalFacets))})}),x["default"](t.numericRefinements,function(e,t){x["default"](e,function(e,r){x["default"](e,function(e){n.push({type:"numeric",attributeName:t,name:e+"",numericValue:e,operator:r})})})}),x["default"](t.tagRefinements,function(e){n.push({type:"tag",attributeName:"_tags",name:e})}),n}function d(e,t){return E["default"](t)?(e=e.clearTags(),e=e.clearRefinements()):(x["default"](t,function(t){e="_tags"===t?e.clearTags():e.clearRefinements(t)}),e)}function h(e,t){e.setState(d(e.state,t)).search()}function m(e,t){return t?N["default"](t,function(t,n){return e+n}):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t.prefixKeys=t.clearRefinementsAndSearch=t.clearRefinementsFromState=t.getRefinements=t.isDomElement=t.isSpecialClick=t.prepareTemplateProps=t.bemHelper=t.getContainerNode=void 0;var v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},g=n(504),y=r(g),b=n(283),x=r(b),w=n(523),_=r(w),C=n(527),$=r(C),S=n(528),E=r(S),P=n(291),k=r(P),T=n(530),O=r(T),R=n(532),N=r(R);t.getContainerNode=o,t.bemHelper=u,t.prepareTemplateProps=c,t.isSpecialClick=s,t.isDomElement=a,t.getRefinements=p,t.clearRefinementsFromState=d,t.clearRefinementsAndSearch=h,t.prefixKeys=m},function(e,t,n){"use strict";var r=n(505),i=n(285),o=n(506),a=o(r,i);e.exports=a},function(e){"use strict";function t(e,t,n,r){var i=-1,o=e.length;for(r&&o&&(n=e[++i]);++i<o;)n=t(n,e[i],i,e);return n}e.exports=t},function(e,t,n){"use strict";function r(e,t){return function(n,r,s,u){var c=arguments.length<3;return"function"==typeof r&&void 0===u&&a(n)?e(n,r,s,c):o(n,i(r,u,4),s,c,t)}}var i=n(507),o=n(522),a=n(302);e.exports=r},function(e,t,n){"use strict";function r(e,t,n){var r="undefined"==typeof e?"undefined":i(e);return"function"==r?void 0===t?e:s(e,t,n):null==e?u:"object"==r?o(e):void 0===t?c(e):a(e,t)}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=n(508),a=n(513),s=n(307),u=n(308),c=n(520);e.exports=r},function(e,t,n){"use strict";function r(e){var t=o(e);if(1==t.length&&t[0][2]){var n=t[0][0],r=t[0][1];return function(e){return null==e?!1:e[n]===r&&(void 0!==r||n in a(e))}}return function(e){return i(e,t)}}var i=n(509),o=n(510),a=n(289);e.exports=r},function(e,t,n){"use strict";function r(e,t,n){var r=t.length,a=r,s=!n;if(null==e)return!a;for(e=o(e);r--;){var u=t[r];if(s&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++r<a;){u=t[r];var c=u[0],l=e[c],f=u[1];if(s&&u[2]){if(void 0===l&&!(c in e))return!1}else{var p=n?n(l,f,c):void 0;if(!(void 0===p?i(f,l,n,!0):p))return!1}}return!0}var i=n(342),o=n(289);e.exports=r},function(e,t,n){"use strict";function r(e){for(var t=o(e),n=t.length;n--;)t[n][2]=i(t[n][1]);return t}var i=n(511),o=n(512);e.exports=r},function(e,t,n){"use strict";function r(e){return e===e&&!i(e)}var i=n(290);e.exports=r},function(e,t,n){"use strict";function r(e){e=o(e);for(var t=-1,n=i(e),r=n.length,a=Array(r);++t<r;){var s=n[t];a[t]=[s,e[s]]}return a}var i=n(291),o=n(289);e.exports=r},function(e,t,n){"use strict";function r(e,t){var n=s(e),r=u(e)&&c(t),d=e+"";return e=p(e),function(s){if(null==s)return!1;var u=d;if(s=f(s),!(!n&&r||u in s)){if(s=1==e.length?s:i(s,a(e,0,-1)),null==s)return!1;u=l(e),s=f(s)}return s[u]===t?void 0!==t||u in s:o(t,s[u],void 0,!0)}}var i=n(514),o=n(342),a=n(515),s=n(302),u=n(516),c=n(511),l=n(517),f=n(289),p=n(518);e.exports=r},function(e,t,n){"use strict";function r(e,t,n){if(null!=e){void 0!==n&&n in i(e)&&(t=[n]);for(var r=0,o=t.length;null!=e&&o>r;)e=e[t[r++]];return r&&r==o?e:void 0}}var i=n(289);e.exports=r},function(e){"use strict";function t(e,t,n){var r=-1,i=e.length;t=null==t?0:+t||0,0>t&&(t=-t>i?0:i+t),n=void 0===n||n>i?i:+n||0,0>n&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r<i;)o[r]=e[r+t];return o}e.exports=t},function(e,t,n){"use strict";function r(e,t){var n="undefined"==typeof e?"undefined":i(e);if("string"==n&&u.test(e)||"number"==n)return!0;if(o(e))return!1;var r=!s.test(e);return r||null!=t&&e in a(t)}var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},o=n(302),a=n(289),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,u=/^\w*$/;e.exports=r},function(e){"use strict";function t(e){var t=e?e.length:0;return t?e[t-1]:void 0}e.exports=t},function(e,t,n){"use strict";function r(e){if(o(e))return e;var t=[];return i(e).replace(a,function(e,n,r,i){t.push(r?i.replace(s,"$1"):n||e)}),t}var i=n(519),o=n(302),a=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,s=/\\(\\)?/g;e.exports=r},function(e){"use strict";function t(e){return null==e?"":e+""}e.exports=t},function(e,t,n){"use strict";function r(e){return a(e)?i(e):o(e)}var i=n(298),o=n(521),a=n(516);e.exports=r},function(e,t,n){"use strict";function r(e){var t=e+"";return e=o(e),function(n){return i(n,e,t)}}var i=n(514),o=n(518);e.exports=r},function(e){"use strict";function t(e,t,n,r,i){return i(e,function(e,i,o){n=r?(r=!1,e):t(n,e,i,o)}),n}e.exports=t},function(e,t,n){"use strict";var r=n(285),i=n(524),o=i(r);e.exports=o},function(e,t,n){"use strict";function r(e,t){return function(n,r,u){if(r=i(r,u,3),s(n)){var c=a(n,r,t);return c>-1?n[c]:void 0}return o(n,r,e)}}var i=n(507),o=n(525),a=n(526),s=n(302);e.exports=r},function(e){"use strict";function t(e,t,n,r){var i;return n(e,function(e,n,o){return t(e,n,o)?(i=r?n:e,!1):void 0}),i}e.exports=t},function(e){"use strict";function t(e,t,n){for(var r=e.length,i=n?r:-1;n?i--:++i<r;)if(t(e[i],i,e))return i;return-1}e.exports=t},function(e,t,n){"use strict";function r(e,t,n){var r=null==e?void 0:i(e,o(t),t+"");return void 0===r?n:r}var i=n(514),o=n(518);e.exports=r},function(e,t,n){"use strict";function r(e){return null==e?!0:a(e)&&(o(e)||c(e)||i(e)||u(e)&&s(e.splice))?!e.length:!l(e).length}var i=n(301),o=n(302),a=n(296),s=n(294),u=n(295),c=n(529),l=n(291);e.exports=r},function(e,t,n){"use strict";function r(e){return"string"==typeof e||i(e)&&s.call(e)==o}var i=n(295),o="[object String]",a=Object.prototype,s=a.toString;e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r){var u=e?e.length:0;return u?(null!=t&&"boolean"!=typeof t&&(r=n,n=a(e,t,r)?void 0:t,t=!1),n=null==n?n:i(n,r,3),t?s(e,n):o(e,n)):[]}var i=n(507),o=n(324),a=n(319),s=n(531);e.exports=r},function(e){"use strict";function t(e,t){for(var n,r=-1,i=e.length,o=-1,a=[];++r<i;){var s=e[r],u=t?t(s,r,e):s;r&&n===u||(n=u,a[++o]=s)}return a}e.exports=t},function(e,t,n){"use strict";var r=n(533),i=r(!0);e.exports=i},function(e,t,n){"use strict";function r(e){return function(t,n,r){var a={};return n=i(n,r,3),o(t,function(t,r,i){var o=n(t,r,i);r=e?o:r,t=e?t:o,a[r]=t}),a}}var i=n(507),o=n(286);e.exports=r},function(e,t,n){var r,i,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};!function(){"use strict";function a(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var r="undefined"==typeof n?"undefined":o(n);if("string"===r||"number"===r)e.push(n);else if(Array.isArray(n))e.push(a.apply(null,n));else if("object"===r)for(var i in n)s.call(n,i)&&n[i]&&e.push(i)}}return e.join(" ")}var s={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=a:"object"===o(n(535))&&n(535)?(r=[],i=function(){return a}.apply(t,r),!(void 0!==i&&(e.exports=i))):window.classNames=a}()},function(e,t){(function(t){e.exports=t}).call(t,{})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=function(t){function n(){return i(this,n),o(this,Object.getPrototypeOf(n).apply(this,arguments))}return a(n,t),u(n,[{key:"componentDidMount",value:function(){this._hideOrShowContainer(this.props)}},{key:"componentWillReceiveProps",value:function(e){this.props.shouldAutoHideContainer!==e.shouldAutoHideContainer&&this._hideOrShowContainer(e)}},{key:"shouldComponentUpdate",value:function(e){return e.shouldAutoHideContainer===!1}},{key:"_hideOrShowContainer",value:function(e){var t=p["default"].findDOMNode(this).parentNode;t.style.display=e.shouldAutoHideContainer===!0?"none":""}},{key:"render",value:function(){return l["default"].createElement(e,this.props)}}]),n}(l["default"].Component);return t.displayName=e.name+"-AutoHide",t}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(350),l=r(c),f=n(502),p=r(f);t["default"]=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t=function(t){function n(e){i(this,n);var t=o(this,Object.getPrototypeOf(n).call(this,e));return t.handleHeaderClick=t.handleHeaderClick.bind(t),t.state={collapsed:e.collapsible&&e.collapsible.collapsed},t._headerElement=t._getElement({type:"header",handleClick:e.collapsible?t.handleHeaderClick:null}),t._cssClasses={root:h["default"]("ais-root",t.props.cssClasses.root),body:h["default"]("ais-body",t.props.cssClasses.body)},t._footerElement=t._getElement({type:"footer"}),t}return a(n,t),l(n,[{key:"shouldComponentUpdate",value:function(e,t){return t.collapsed===!1||t!==this.state}},{key:"_getElement",value:function(e){var t=e.type,n=e.handleClick,r=void 0===n?null:n,i=this.props.templateProps.templates;if(!i||!i[t])return null;var o=h["default"](this.props.cssClasses[t],"ais-"+t);return p["default"].createElement(v["default"],c({},this.props.templateProps,{rootProps:{className:o,onClick:r},templateKey:t,transformData:null}))}},{key:"handleHeaderClick",value:function(){this.setState({collapsed:!this.state.collapsed})}},{key:"render",value:function(){var t=[this._cssClasses.root];this.props.collapsible&&t.push("ais-root__collapsible"),this.state.collapsed&&t.push("ais-root__collapsed");var n=c({},this._cssClasses,{root:h["default"](t)});return u("div",{className:n.root},void 0,this._headerElement,u("div",{className:n.body},void 0,p["default"].createElement(e,this.props)),this._footerElement)}}]),n}(p["default"].Component);return t.defaultProps={cssClasses:{},collapsible:!1},t.displayName=e.name+"-HeaderFooter",t}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);
22
- else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=n(350),p=r(f),d=n(534),h=r(d),m=n(538),v=r(m);t["default"]=s},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t,n){if(!e)return n;var r=y["default"](n),i=void 0,o="undefined"==typeof e?"undefined":l(e);if("function"===o)i=e(r);else{if("object"!==o)throw new Error("transformData must be a function or an object, was "+o+" (key : "+t+")");i=e[t]?e[t](r):n}var a="undefined"==typeof i?"undefined":l(i),s="undefined"==typeof n?"undefined":l(n);if(a!==s)throw new Error("`transformData` must return a `"+s+"`, got `"+a+"`.");return i}function u(e){var t=e.templates,n=e.templateKey,r=e.compileOptions,i=e.helpers,o=e.data,a=t[n],s="undefined"==typeof a?"undefined":l(a),u="string"===s,p="function"===s;if(u||p){if(p)return a(o);var d=c(i,r,o),h=f({},o,{helpers:d});return _["default"].compile(a,r).render(h)}throw new Error("Template must be 'string' or 'function', was '"+s+"' (key: "+n+")")}function c(e,t,n){return x["default"](e,function(e){return v["default"](function(r){var i=this,o=function(e){return _["default"].compile(e,t).render(i)};return e.call(n,r,o)})})}Object.defineProperty(t,"__esModule",{value:!0});var l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},f=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=n(350),h=r(d),m=n(539),v=r(m),g=n(566),y=r(g),b=n(567),x=r(b),w=n(568),_=r(w),C=n(341),$=r(C),S=function(e){function t(e){return i(this,t),o(this,Object.getPrototypeOf(t).call(this,e))}return a(t,e),p(t,[{key:"shouldComponentUpdate",value:function(e){return!$["default"](this.props.data,e.data)||this.props.templateKey!==e.templateKey}},{key:"render",value:function(){var e=this.props.useCustomCompileOptions[this.props.templateKey],t=e?this.props.templatesConfig.compileOptions:{},n=u({templates:this.props.templates,templateKey:this.props.templateKey,compileOptions:t,helpers:this.props.templatesConfig.helpers,data:s(this.props.transformData,this.props.templateKey,this.props.data)});return null===n?null:h["default"].isValidElement(n)?h["default"].createElement("div",this.props.rootProps,n):h["default"].createElement("div",f({},this.props.rootProps,{dangerouslySetInnerHTML:{__html:n}}))}}]),t}(h["default"].Component);S.defaultProps={data:{},useCustomCompileOptions:{},templates:{},templatesConfig:{}},t["default"]=S},function(e,t,n){"use strict";var r=n(540),i=8,o=r(i);o.placeholder={},e.exports=o},function(e,t,n){"use strict";function r(e){function t(n,r,a){a&&o(n,r,a)&&(r=void 0);var s=i(n,e,void 0,void 0,void 0,void 0,void 0,r);return s.placeholder=t.placeholder,s}return t}var i=n(541),o=n(319);e.exports=r},function(e,t,n){"use strict";function r(e,t,n,r,g,y,b,x){var w=t&p;if(!w&&"function"!=typeof e)throw new TypeError(m);var _=r?r.length:0;if(_||(t&=~(d|h),r=g=void 0),_-=g?g.length:0,t&h){var C=r,$=g;r=g=void 0}var S=w?void 0:u(e),E=[e,t,n,r,g,C,$,y,b,x];if(S&&(c(E,S),t=E[1],x=E[9]),E[9]=null==x?w?0:e.length:v(x-_,0)||0,t==f)var P=o(E[0],E[2]);else P=t!=d&&t!=(f|d)||E[4].length?a.apply(void 0,E):s.apply(void 0,E);var k=S?i:l;return k(P,E)}var i=n(542),o=n(544),a=n(547),s=n(564),u=n(553),c=n(565),l=n(562),f=1,p=2,d=32,h=64,m="Expected a function",v=Math.max;e.exports=r},function(e,t,n){"use strict";var r=n(308),i=n(543),o=i?function(e,t){return i.set(e,t),e}:r;e.exports=o},function(e,t,n){(function(t){"use strict";var r=n(292),i=r(t,"WeakMap"),o=i&&new i;e.exports=o}).call(t,function(){return this}())},function(e,t,n){(function(t){"use strict";function r(e,n){function r(){var i=this&&this!==t&&this instanceof r?o:e;return i.apply(n,arguments)}var o=i(e);return r}var i=n(545);e.exports=r}).call(t,function(){return this}())},function(e,t,n){"use strict";function r(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=i(e.prototype),r=e.apply(n,t);return o(r)?r:n}}var i=n(546),o=n(290);e.exports=r},function(e,t,n){"use strict";var r=n(290),i=function(){function e(){}return function(t){if(r(t)){e.prototype=t;var n=new e;e.prototype=void 0}return n||{}}}();e.exports=i},function(e,t,n){(function(t){"use strict";function r(e,n,w,_,C,$,S,E,P,k){function T(){for(var h=arguments.length,m=h,v=Array(h);m--;)v[m]=arguments[m];if(_&&(v=o(v,_,C)),$&&(v=a(v,$,S)),A||M){var b=T.placeholder,I=l(v,b);if(h-=I.length,k>h){var F=E?i(E):void 0,L=x(k-h,0),U=A?I:void 0,H=A?void 0:I,V=A?v:void 0,q=A?void 0:v;n|=A?g:y,n&=~(A?y:g),j||(n&=~(p|d));var B=[e,n,w,V,U,q,H,F,P,L],W=r.apply(void 0,B);return u(e)&&f(W,B),W.placeholder=b,W}}var z=R?w:this,K=N?z[e]:e;return E&&(v=c(v,E)),O&&P<v.length&&(v.length=P),this&&this!==t&&this instanceof T&&(K=D||s(e)),K.apply(z,v)}var O=n&b,R=n&p,N=n&d,A=n&m,j=n&h,M=n&v,D=N?void 0:s(e);return T}var i=n(312),o=n(548),a=n(549),s=n(545),u=n(550),c=n(560),l=n(561),f=n(562),p=1,d=2,h=4,m=8,v=16,g=32,y=64,b=128,x=Math.max;e.exports=r}).call(t,function(){return this}())},function(e){"use strict";function t(e,t,r){for(var i=r.length,o=-1,a=n(e.length-i,0),s=-1,u=t.length,c=Array(u+a);++s<u;)c[s]=t[s];for(;++o<i;)c[r[o]]=e[o];for(;a--;)c[s++]=e[o++];return c}var n=Math.max;e.exports=t},function(e){"use strict";function t(e,t,r){for(var i=-1,o=r.length,a=-1,s=n(e.length-o,0),u=-1,c=t.length,l=Array(s+c);++a<s;)l[a]=e[a];for(var f=a;++u<c;)l[f+u]=t[u];for(;++i<o;)l[f+r[i]]=e[a++];return l}var n=Math.max;e.exports=t},function(e,t,n){"use strict";function r(e){var t=a(e),n=s[t];if("function"!=typeof n||!(t in i.prototype))return!1;if(e===n)return!0;var r=o(n);return!!r&&e===r[0]}var i=n(551),o=n(553),a=n(555),s=n(557);e.exports=r},function(e,t,n){"use strict";function r(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=a,this.__views__=[]}var i=n(546),o=n(552),a=Number.POSITIVE_INFINITY;r.prototype=i(o.prototype),r.prototype.constructor=r,e.exports=r},function(e){"use strict";function t(){}e.exports=t},function(e,t,n){"use strict";var r=n(543),i=n(554),o=r?function(e){return r.get(e)}:i;e.exports=o},function(e){"use strict";function t(){}e.exports=t},function(e,t,n){"use strict";function r(e){for(var t=e.name+"",n=i[t],r=n?n.length:0;r--;){var o=n[r],a=o.func;if(null==a||a==e)return o.name}return t}var i=n(556);e.exports=r},function(e){"use strict";var t={};e.exports=t},function(e,t,n){"use strict";function r(e){if(u(e)&&!s(e)&&!(e instanceof i)){if(e instanceof o)return e;if(f.call(e,"__chain__")&&f.call(e,"__wrapped__"))return c(e)}return new o(e)}var i=n(551),o=n(558),a=n(552),s=n(302),u=n(295),c=n(559),l=Object.prototype,f=l.hasOwnProperty;r.prototype=a.prototype,e.exports=r},function(e,t,n){"use strict";function r(e,t,n){this.__wrapped__=e,this.__actions__=n||[],this.__chain__=!!t}var i=n(546),o=n(552);r.prototype=i(o.prototype),r.prototype.constructor=r,e.exports=r},function(e,t,n){"use strict";function r(e){return e instanceof i?e.clone():new o(e.__wrapped__,e.__chain__,a(e.__actions__))}var i=n(551),o=n(558),a=n(312);e.exports=r},function(e,t,n){"use strict";function r(e,t){for(var n=e.length,r=a(t.length,n),s=i(e);r--;){var u=t[r];e[r]=o(u,n)?s[u]:void 0}return e}var i=n(312),o=n(303),a=Math.min;e.exports=r},function(e){"use strict";function t(e,t){for(var r=-1,i=e.length,o=-1,a=[];++r<i;)e[r]===t&&(e[r]=n,a[++o]=r);return a}var n="__lodash_placeholder__";e.exports=t},function(e,t,n){"use strict";var r=n(542),i=n(563),o=150,a=16,s=function(){var e=0,t=0;return function(n,s){var u=i(),c=a-(u-t);if(t=u,c>0){if(++e>=o)return n}else e=0;return r(n,s)}}();e.exports=s},function(e,t,n){"use strict";var r=n(292),i=r(Date,"now"),o=i||function(){return(new Date).getTime()};e.exports=o},function(e,t,n){(function(t){"use strict";function r(e,n,r,a){function s(){for(var n=-1,i=arguments.length,o=-1,l=a.length,f=Array(l+i);++o<l;)f[o]=a[o];for(;i--;)f[o++]=arguments[++n];var p=this&&this!==t&&this instanceof s?c:e;return p.apply(u?r:this,f)}var u=n&o,c=i(e);return s}var i=n(545),o=1;e.exports=r}).call(t,function(){return this}())},function(e,t,n){"use strict";function r(e,t){var n=e[1],r=t[1],m=n|r,v=f>m,g=r==f&&n==l||r==f&&n==p&&e[7].length<=t[8]||r==(f|p)&&n==l;if(!v&&!g)return e;r&u&&(e[2]=t[2],m|=n&u?0:c);var y=t[3];if(y){var b=e[3];e[3]=b?o(b,y,t[4]):i(y),e[4]=b?s(e[3],d):i(t[4])}return y=t[5],y&&(b=e[5],e[5]=b?a(b,y,t[6]):i(y),e[6]=b?s(e[5],d):i(t[6])),y=t[7],y&&(e[7]=i(y)),r&f&&(e[8]=null==e[8]?t[8]:h(e[8],t[8])),null==e[9]&&(e[9]=t[9]),e[0]=t[0],e[1]=m,e}var i=n(312),o=n(548),a=n(549),s=n(561),u=1,c=4,l=8,f=128,p=256,d="__lodash_placeholder__",h=Math.min;e.exports=r},function(e,t,n){"use strict";function r(e,t,n){return"function"==typeof t?i(e,!0,o(t,n,3)):i(e,!0)}var i=n(332),o=n(307);e.exports=r},function(e,t,n){"use strict";var r=n(533),i=r();e.exports=i},function(e,t,n){var r=n(569);r.Template=n(570).Template,r.template=r.Template,e.exports=r},function(e,t){!function(e){function t(e){"}"===e.n.substr(e.n.length-1)&&(e.n=e.n.substring(0,e.n.length-1))}function n(e){return e.trim?e.trim():e.replace(/^\s*|\s*$/g,"")}function r(e,t,n){if(t.charAt(n)!=e.charAt(0))return!1;for(var r=1,i=e.length;i>r;r++)if(t.charAt(n+r)!=e.charAt(r))return!1;return!0}function i(t,n,r,s){var u=[],c=null,l=null,f=null;for(l=r[r.length-1];t.length>0;){if(f=t.shift(),l&&"<"==l.tag&&!(f.tag in w))throw new Error("Illegal content in < super tag.");if(e.tags[f.tag]<=e.tags.$||o(f,s))r.push(f),f.nodes=i(t,f.tag,r,s);else{if("/"==f.tag){if(0===r.length)throw new Error("Closing tag without opener: /"+f.n);if(c=r.pop(),f.n!=c.n&&!a(f.n,c.n,s))throw new Error("Nesting error: "+c.n+" vs. "+f.n);return c.end=f.i,u}"\n"==f.tag&&(f.last=0==t.length||"\n"==t[0].tag)}u.push(f)}if(r.length>0)throw new Error("missing closing tag: "+r.pop().n);return u}function o(e,t){for(var n=0,r=t.length;r>n;n++)if(t[n].o==e.n)return e.tag="#",!0}function a(e,t,n){for(var r=0,i=n.length;i>r;r++)if(n[r].c==e&&n[r].o==t)return!0}function s(e){var t=[];for(var n in e)t.push('"'+c(n)+'": function(c,p,t,i) {'+e[n]+"}");return"{ "+t.join(",")+" }"}function u(e){var t=[];for(var n in e.partials)t.push('"'+c(n)+'":{name:"'+c(e.partials[n].name)+'", '+u(e.partials[n])+"}");return"partials: {"+t.join(",")+"}, subs: "+s(e.subs)}function c(e){return e.replace(y,"\\\\").replace(m,'\\"').replace(v,"\\n").replace(g,"\\r").replace(b,"\\u2028").replace(x,"\\u2029")}function l(e){return~e.indexOf(".")?"d":"f"}function f(e,t){var n="<"+(t.prefix||""),r=n+e.n+_++;return t.partials[r]={name:e.n,partials:{}},t.code+='t.b(t.rp("'+c(r)+'",c,p,"'+(e.indent||"")+'"));',r}function p(e,t){t.code+="t.b(t.t(t."+l(e.n)+'("'+c(e.n)+'",c,p,0)));'}function d(e){return"t.b("+e+");"}var h=/\S/,m=/\"/g,v=/\n/g,g=/\r/g,y=/\\/g,b=/\u2028/,x=/\u2029/;e.tags={"#":1,"^":2,"<":3,$:4,"/":5,"!":6,">":7,"=":8,_v:9,"{":10,"&":11,_t:12},e.scan=function(i,o){function a(){y.length>0&&(b.push({tag:"_t",text:new String(y)}),y="")}function s(){for(var t=!0,n=_;n<b.length;n++)if(t=e.tags[b[n].tag]<e.tags._v||"_t"==b[n].tag&&null===b[n].text.match(h),!t)return!1;return t}function u(e,t){if(a(),e&&s())for(var n,r=_;r<b.length;r++)b[r].text&&((n=b[r+1])&&">"==n.tag&&(n.indent=b[r].text.toString()),b.splice(r,1));else t||b.push({tag:"\n"});x=!1,_=b.length}function c(e,t){var r="="+$,i=e.indexOf(r,t),o=n(e.substring(e.indexOf("=",t)+1,i)).split(" ");return C=o[0],$=o[o.length-1],i+r.length-1}var l=i.length,f=0,p=1,d=2,m=f,v=null,g=null,y="",b=[],x=!1,w=0,_=0,C="{{",$="}}";for(o&&(o=o.split(" "),C=o[0],$=o[1]),w=0;l>w;w++)m==f?r(C,i,w)?(--w,a(),m=p):"\n"==i.charAt(w)?u(x):y+=i.charAt(w):m==p?(w+=C.length-1,g=e.tags[i.charAt(w+1)],v=g?i.charAt(w+1):"_v","="==v?(w=c(i,w),m=f):(g&&w++,m=d),x=w):r($,i,w)?(b.push({tag:v,n:n(y),otag:C,ctag:$,i:"/"==v?x-C.length:w+$.length}),y="",w+=$.length-1,m=f,"{"==v&&("}}"==$?w++:t(b[b.length-1]))):y+=i.charAt(w);return u(x,!0),b};var w={_t:!0,"\n":!0,$:!0,"/":!0};e.stringify=function(t){return"{code: function (c,p,i) { "+e.wrapMain(t.code)+" },"+u(t)+"}"};var _=0;e.generate=function(t,n,r){_=0;var i={code:"",subs:{},partials:{}};return e.walk(t,i),r.asString?this.stringify(i,n,r):this.makeTemplate(i,n,r)},e.wrapMain=function(e){return'var t=this;t.b(i=i||"");'+e+"return t.fl();"},e.template=e.Template,e.makeTemplate=function(e,t,n){var r=this.makePartials(e);return r.code=new Function("c","p","i",this.wrapMain(e.code)),new this.template(r,t,this,n)},e.makePartials=function(e){var t,n={subs:{},partials:e.partials,name:e.name};for(t in n.partials)n.partials[t]=this.makePartials(n.partials[t]);for(t in e.subs)n.subs[t]=new Function("c","p","t","i",e.subs[t]);return n},e.codegen={"#":function(t,n){n.code+="if(t.s(t."+l(t.n)+'("'+c(t.n)+'",c,p,1),c,p,0,'+t.i+","+t.end+',"'+t.otag+" "+t.ctag+'")){t.rs(c,p,function(c,p,t){',e.walk(t.nodes,n),n.code+="});c.pop();}"},"^":function(t,n){n.code+="if(!t.s(t."+l(t.n)+'("'+c(t.n)+'",c,p,1),c,p,1,0,0,"")){',e.walk(t.nodes,n),n.code+="};"},">":f,"<":function(t,n){var r={partials:{},code:"",subs:{},inPartial:!0};e.walk(t.nodes,r);var i=n.partials[f(t,n)];i.subs=r.subs,i.partials=r.partials},$:function(t,n){var r={subs:{},code:"",partials:n.partials,prefix:t.n};e.walk(t.nodes,r),n.subs[t.n]=r.code,n.inPartial||(n.code+='t.sub("'+c(t.n)+'",c,p,i);')},"\n":function(e,t){t.code+=d('"\\n"'+(e.last?"":" + i"))},_v:function(e,t){t.code+="t.b(t.v(t."+l(e.n)+'("'+c(e.n)+'",c,p,0)));'},_t:function(e,t){t.code+=d('"'+c(e.text)+'"')},"{":p,"&":p},e.walk=function(t,n){for(var r,i=0,o=t.length;o>i;i++)r=e.codegen[t[i].tag],r&&r(t[i],n);return n},e.parse=function(e,t,n){return n=n||{},i(e,"",[],n.sectionTags||[])},e.cache={},e.cacheKey=function(e,t){return[e,!!t.asString,!!t.disableLambda,t.delimiters,!!t.modelGet].join("||")},e.compile=function(t,n){n=n||{};var r=e.cacheKey(t,n),i=this.cache[r];if(i){var o=i.partials;for(var a in o)delete o[a].instance;return i}return i=this.generate(this.parse(this.scan(t,n.delimiters),t,n),t,n),this.cache[r]=i}}(t)},function(e,t){!function(e){function t(e,t,n){var r;return t&&"object"==typeof t&&(void 0!==t[e]?r=t[e]:n&&t.get&&"function"==typeof t.get&&(r=t.get(e))),r}function n(e,t,n,r,i,o){function a(){}function s(){}a.prototype=e,s.prototype=e.subs;var u,c=new a;c.subs=new s,c.subsText={},c.buf="",r=r||{},c.stackSubs=r,c.subsText=o;for(u in t)r[u]||(r[u]=t[u]);for(u in r)c.subs[u]=r[u];i=i||{},c.stackPartials=i;for(u in n)i[u]||(i[u]=n[u]);for(u in i)c.partials[u]=i[u];return c}function r(e){return String(null===e||void 0===e?"":e)}function i(e){return e=r(e),l.test(e)?e.replace(o,"&amp;").replace(a,"&lt;").replace(s,"&gt;").replace(u,"&#39;").replace(c,"&quot;"):e}e.Template=function(e,t,n,r){e=e||{},this.r=e.code||this.r,this.c=n,this.options=r||{},this.text=t||"",this.partials=e.partials||{},this.subs=e.subs||{},this.buf=""},e.Template.prototype={r:function(){return""},v:i,t:r,render:function(e,t,n){return this.ri([e],t||{},n)},ri:function(e,t,n){return this.r(e,t,n)},ep:function(e,t){var r=this.partials[e],i=t[r.name];if(r.instance&&r.base==i)return r.instance;if("string"==typeof i){if(!this.c)throw new Error("No compiler available.");i=this.c.compile(i,this.options)}if(!i)return null;if(this.partials[e].base=i,r.subs){t.stackText||(t.stackText={});for(key in r.subs)t.stackText[key]||(t.stackText[key]=void 0!==this.activeSub&&t.stackText[this.activeSub]?t.stackText[this.activeSub]:this.text);i=n(i,r.subs,r.partials,this.stackSubs,this.stackPartials,t.stackText)}return this.partials[e].instance=i,i},rp:function(e,t,n,r){var i=this.ep(e,n);return i?i.ri(t,n,r):""},rs:function(e,t,n){var r=e[e.length-1];if(!f(r))return void n(e,t,this);for(var i=0;i<r.length;i++)e.push(r[i]),n(e,t,this),e.pop()},s:function(e,t,n,r,i,o,a){var s;return f(e)&&0===e.length?!1:("function"==typeof e&&(e=this.ms(e,t,n,r,i,o,a)),s=!!e,!r&&s&&t&&t.push("object"==typeof e?e:t[t.length-1]),s)},d:function(e,n,r,i){var o,a=e.split("."),s=this.f(a[0],n,r,i),u=this.options.modelGet,c=null;if("."===e&&f(n[n.length-2]))s=n[n.length-1];else for(var l=1;l<a.length;l++)o=t(a[l],s,u),void 0!==o?(c=s,s=o):s="";return i&&!s?!1:(i||"function"!=typeof s||(n.push(c),s=this.mv(s,n,r),n.pop()),s)},f:function(e,n,r,i){for(var o=!1,a=null,s=!1,u=this.options.modelGet,c=n.length-1;c>=0;c--)if(a=n[c],o=t(e,a,u),void 0!==o){s=!0;break}return s?(i||"function"!=typeof o||(o=this.mv(o,n,r)),o):i?!1:""},ls:function(e,t,n,i,o){var a=this.options.delimiters;return this.options.delimiters=o,this.b(this.ct(r(e.call(t,i)),t,n)),this.options.delimiters=a,!1},ct:function(e,t,n){if(this.options.disableLambda)throw new Error("Lambda features disabled.");return this.c.compile(e,this.options).render(t,n)},b:function(e){this.buf+=e},fl:function(){var e=this.buf;return this.buf="",e},ms:function(e,t,n,r,i,o,a){var s,u=t[t.length-1],c=e.call(u);return"function"==typeof c?r?!0:(s=this.activeSub&&this.subsText&&this.subsText[this.activeSub]?this.subsText[this.activeSub]:this.text,this.ls(c,u,n,s.substring(i,o),a)):c},mv:function(e,t,n){var i=t[t.length-1],o=e.call(i);return"function"==typeof o?this.ct(r(o.call(i)),i,n):o},sub:function(e,t,n,r){var i=this.subs[e];i&&(this.activeSub=e,i(t,n,this,r),this.activeSub=!1)}};var o=/&/g,a=/</g,s=/>/g,u=/\'/g,c=/\"/g,l=/[&<>\"\']/,f=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}}(t)},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={header:"",link:"Clear all",footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(350),f=r(l),p=n(538),d=r(p),h=n(503),m=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),c(t,[{key:"componentWillMount",value:function(){this.handleClick=this.handleClick.bind(this)}},{key:"shouldComponentUpdate",value:function(e){return this.props.url!==e.url||this.props.hasRefinements!==e.hasRefinements}},{key:"handleClick",value:function(e){h.isSpecialClick(e)||(e.preventDefault(),this.props.clearAll())}},{key:"render",value:function(){var e={hasRefinements:this.props.hasRefinements};return u("a",{className:this.props.cssClasses.link,href:this.props.url,onClick:this.handleClick},void 0,f["default"].createElement(d["default"],s({data:e,templateKey:"link"},this.props.templateProps)))}}]),t}(f["default"].Component);t["default"]=m},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=e.container,n=e.attributes,r=void 0===n?[]:n,i=e.onlyListedAttributes,o=void 0===i?!1:i,a=e.clearAll,f=void 0===a?"before":a,p=e.templates,m=void 0===p?V["default"]:p,g=e.collapsible,b=void 0===g?!1:g,w=e.transformData,C=e.autoHideContainer,S=void 0===C?!0:C,P=e.cssClasses,T=void 0===P?{}:P,O=$["default"](r)&&j["default"](r,function(e,t){return e&&E["default"](t)&&_["default"](t.name)&&(y["default"](t.label)||_["default"](t.label))&&(y["default"](t.template)||_["default"](t.template)||k["default"](t.template))&&(y["default"](t.transformData)||k["default"](t.transformData))},!0),R=["header","item","clearAll","footer"],A=E["default"](m)&&j["default"](m,function(e,t,n){return e&&-1!==R.indexOf(n)&&(_["default"](t)||k["default"](t))},!0),M=["root","header","body","clearAll","list","item","link","count","footer"],D=E["default"](T)&&j["default"](T,function(e,t,n){return e&&-1!==M.indexOf(n)&&_["default"](t)||$["default"](t)},!0),I=!((_["default"](t)||h.isDomElement(t))&&$["default"](r)&&O&&x["default"](o)&&-1!==[!1,"before","after"].indexOf(f)&&E["default"](m)&&A&&(y["default"](w)||k["default"](w))&&x["default"](S)&&D);if(I)throw new Error(z);var L=h.getContainerNode(t),H=F["default"](B["default"]);S===!0&&(H=U["default"](H));var q=N["default"](r,function(e){return e.name}),K=o?q:[],Q=j["default"](r,function(e,t){return e[t.name]=t,e},{});return{init:function(e){var t=e.helper;this._clearRefinementsAndSearch=h.clearRefinementsAndSearch.bind(null,t,K)},render:function(e){var t=e.results,n=e.helper,r=e.state,i=e.templatesConfig,a=e.createURL,p={root:v["default"](W(null),T.root),header:v["default"](W("header"),T.header),body:v["default"](W("body"),T.body),clearAll:v["default"](W("clear-all"),T.clearAll),list:v["default"](W("list"),T.list),item:v["default"](W("item"),T.item),link:v["default"](W("link"),T.link),count:v["default"](W("count"),T.count),footer:v["default"](W("footer"),T.footer)},g=h.prepareTemplateProps({defaultTemplates:V["default"],templatesConfig:i,templates:m}),y=a(h.clearRefinementsFromState(r,K)),x=s(t,r,q,o),w=x.map(function(e){return a(u(r,e))}),_=x.map(function(e){return c.bind(null,n,e)}),C=0===x.length;d["default"].render(l(H,{attributes:Q,clearAllClick:this._clearRefinementsAndSearch,clearAllPosition:f,clearAllURL:y,clearRefinementClicks:_,clearRefinementURLs:w,collapsible:b,cssClasses:p,refinements:x,shouldAutoHideContainer:C,templateProps:g}),L)}}}function o(e,t,n){var r=e.indexOf(n);return-1!==r?r:e.length+t.indexOf(n)}function a(e,t,n,r){var i=o(e,t,n.attributeName),a=o(e,t,r.attributeName);return i===a?n.name===r.name?0:n.name<r.name?-1:1:a>i?-1:1}function s(e,t,n,r){var i=h.getRefinements(e,t),o=j["default"](i,function(e,t){return-1===n.indexOf(t.attributeName)&&e.indexOf(-1===t.attributeName)&&e.push(t.attributeName),e},[]);return i=i.sort(a.bind(null,n,o)),r&&!O["default"](n)&&(i=D["default"](i,function(e){return-1!==n.indexOf(e.attributeName)})),i}function u(e,t){switch(t.type){case"facet":return e.removeFacetRefinement(t.attributeName,t.name);case"disjunctive":return e.removeDisjunctiveFacetRefinement(t.attributeName,t.name);case"hierarchical":return e.clearRefinements(t.attributeName);case"exclude":return e.removeExcludeRefinement(t.attributeName,t.name);case"numeric":return e.removeNumericRefinement(t.attributeName,t.operator,t.numericValue);case"tag":return e.removeTagRefinement(t.name);default:throw new Error("clearRefinement: type "+t.type+"isn't handled")}}function c(e,t){e.setState(u(e.state,t)).search()}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),f=n(350),p=(r(f),n(502)),d=r(p),h=n(503),m=n(534),v=r(m),g=n(574),y=r(g),b=n(575),x=r(b),w=n(529),_=r(w),C=n(302),$=r(C),S=n(313),E=r(S),P=n(294),k=r(P),T=n(528),O=r(T),R=n(576),N=r(R),A=n(504),j=r(A),M=n(579),D=r(M),I=n(537),F=r(I),L=n(536),U=r(L),H=n(582),V=r(H),q=n(583),B=r(q),W=h.bemHelper("ais-current-refined-values"),z="Usage:\ncurrentRefinedValues({\n container,\n [ attributes: [{name[, label, template, transformData]}] ],\n [ onlyListedAttributes = false ],\n [ clearAll = 'before' ] // One of ['before', 'after', false]\n [ templates.{header = '', item, clearAll, footer = ''} ],\n [ transformData ],\n [ autoHideContainer = true ],\n [ cssClasses.{root, header, body, clearAll, list, item, link, count, footer} = {} ],\n [ collapsible=false ]\n})";t["default"]=i},function(e){"use strict";function t(e){return void 0===e}e.exports=t},function(e,t,n){"use strict";function r(e){return e===!0||e===!1||i(e)&&s.call(e)==o}var i=n(295),o="[object Boolean]",a=Object.prototype,s=a.toString;e.exports=r},function(e,t,n){"use strict";function r(e,t,n){var r=s(e)?i:a;return t=o(t,n,3),r(e,t)}var i=n(577),o=n(507),a=n(578),s=n(302);e.exports=r},function(e){"use strict";function t(e,t){for(var n=-1,r=e.length,i=Array(r);++n<r;)i[n]=t(e[n],n,e);return i}e.exports=t},function(e,t,n){"use strict";function r(e,t){var n=-1,r=o(e)?Array(e.length):[];return i(e,function(e,i,o){r[++n]=t(e,i,o)}),r}var i=n(285),o=n(296);e.exports=r},function(e,t,n){"use strict";function r(e,t,n){var r=s(e)?i:a;return t=o(t,n,3),r(e,t)}var i=n(580),o=n(507),a=n(581),s=n(302);e.exports=r},function(e){"use strict";function t(e,t){for(var n=-1,r=e.length,i=-1,o=[];++n<r;){var a=e[n];t(a,n,e)&&(o[++i]=a)}return o}e.exports=t},function(e,t,n){"use strict";function r(e,t){var n=[];return i(e,function(e,r,i){t(e,r,i)&&n.push(e)}),n}var i=n(285);e.exports=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={header:"",item:'{{#label}}{{label}}{{^operator}}:{{/operator}} {{/label}}{{#operator}}{{{displayOperator}}} {{/operator}}{{#exclude}}-{{/exclude}}{{name}} <span class="{{cssClasses.count}}">{{count}}</span>',clearAll:"Clear all",footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){var t={};return void 0!==e.template&&(t.templates={item:e.template}),void 0!==e.transformData&&(t.transformData=e.transformData),t}function u(e,t,n){var r=w["default"](t);return r.cssClasses=n,void 0!==e.label&&(r.label=e.label),void 0!==r.operator&&(r.displayOperator=r.operator,">="===r.operator&&(r.displayOperator="&ge;"),"<="===r.operator&&(r.displayOperator="&le;")),r}function c(e){return function(t){g.isSpecialClick(t)||(t.preventDefault(),e())}}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),d=n(350),h=r(d),m=n(538),v=r(m),g=n(503),y=n(576),b=r(y),x=n(566),w=r(x),_=n(341),C=r(_),$=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),p(t,[{key:"shouldComponentUpdate",value:function(e){return!C["default"](this.props.refinements,e.refinements)}},{key:"_clearAllElement",value:function(e,t){return t!==e?void 0:f("a",{className:this.props.cssClasses.clearAll,href:this.props.clearAllURL,onClick:c(this.props.clearAllClick)},void 0,h["default"].createElement(v["default"],l({templateKey:"clearAll"},this.props.templateProps)))}},{key:"_refinementElement",value:function(e,t){var n=this.props.attributes[e.attributeName]||{},r=u(n,e,this.props.cssClasses),i=s(n),o=e.attributeName+(e.operator?e.operator:":")+(e.exclude?e.exclude:"")+e.name;return f("div",{className:this.props.cssClasses.item},o,f("a",{className:this.props.cssClasses.link,href:this.props.clearRefinementURLs[t],onClick:c(this.props.clearRefinementClicks[t])},void 0,h["default"].createElement(v["default"],l({data:r,templateKey:"item"},this.props.templateProps,i))))}},{key:"render",value:function(){return f("div",{},void 0,this._clearAllElement("before",this.props.clearAllPosition),f("div",{className:this.props.cssClasses.list},void 0,b["default"](this.props.refinements,this._refinementElement,this)),this._clearAllElement("after",this.props.clearAllPosition))}}]),t}(h["default"].Component);t["default"]=$},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributes,r=e.separator,i=void 0===r?" > ":r,a=e.rootPath,s=void 0===a?null:a,l=e.showParentLevel,p=void 0===l?!0:l,h=e.limit,v=void 0===h?10:h,y=e.sortBy,_=void 0===y?["name:asc"]:y,C=e.cssClasses,$=void 0===C?{}:C,S=e.autoHideContainer,E=void 0===S?!0:S,P=e.templates,k=void 0===P?g["default"]:P,T=e.collapsible,O=void 0===T?!1:T,R=e.transformData;if(!t||!n||!n.length)throw new Error(w);var N=c.getContainerNode(t),A=m["default"](b["default"]);E===!0&&(A=d["default"](A));var j=n[0],M={root:f["default"](x(null),$.root),
23
- header:f["default"](x("header"),$.header),body:f["default"](x("body"),$.body),footer:f["default"](x("footer"),$.footer),list:f["default"](x("list"),$.list),depth:x("list","lvl"),item:f["default"](x("item"),$.item),active:f["default"](x("item","active"),$.active),link:f["default"](x("link"),$.link),count:f["default"](x("count"),$.count)};return{getConfiguration:function(e){return{hierarchicalFacets:[{name:j,attributes:n,separator:i,rootPath:s,showParentLevel:p}],maxValuesPerFacet:void 0!==e.maxValuesPerFacet?Math.max(e.maxValuesPerFacet,v):v}},init:function(e){var t=e.helper,n=e.templatesConfig,r=e.createURL;this._toggleRefinement=function(e){return t.toggleRefinement(j,e).search()},this._createURL=function(e,t){return r(e.toggleRefinement(j,t))},this._templateProps=c.prepareTemplateProps({transformData:R,defaultTemplates:g["default"],templatesConfig:n,templates:k})},_prepareFacetValues:function(e,t){var n=this;return e.slice(0,v).map(function(e){return Array.isArray(e.data)&&(e.data=n._prepareFacetValues(e.data,t)),e.url=n._createURL(t,e),e})},render:function(e){var t=e.results,n=e.state,r=t.getFacetValues(j,{sortBy:_}).data||[];r=this._prepareFacetValues(r,n),u["default"].render(o(A,{attributeNameKey:"path",collapsible:O,cssClasses:M,facetValues:r,shouldAutoHideContainer:0===r.length,templateProps:this._templateProps,toggleRefinement:this._toggleRefinement}),N)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),a=n(350),s=(r(a),n(502)),u=r(s),c=n(503),l=n(534),f=r(l),p=n(536),d=r(p),h=n(537),m=r(h),v=n(585),g=r(v),y=n(586),b=r(y),x=c.bemHelper("ais-hierarchical-menu"),w="Usage:\nhierarchicalMenu({\n container,\n attributes,\n [ separator=' > ' ],\n [ rootPath ],\n [ showParentLevel=true ],\n [ limit=10 ],\n [ sortBy=['name:asc'] ],\n [ cssClasses.{root , header, body, footer, list, depth, item, active, link}={} ],\n [ templates.{header, item, footer} ],\n [ transformData ],\n [ autoHideContainer=true ],\n [ collapsible=false ]\n})";t["default"]=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={header:"",item:'<a class="{{cssClasses.link}}" href="{{url}}">{{name}} <span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span></a>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=n(350),p=r(f),d=n(534),h=r(d),m=n(503),v=n(538),g=r(v),y=n(587),b=r(y),x=n(341),w=r(x),_=function(e){function t(e){o(this,t);var n=a(this,Object.getPrototypeOf(t).call(this,e));return n.state={isShowMoreOpen:!1},n.handleItemClick=n.handleItemClick.bind(n),n.handleClickShowMore=n.handleClickShowMore.bind(n),n}return s(t,e),l(t,[{key:"shouldComponentUpdate",value:function(e,t){return t!==this.state||!w["default"](this.props.facetValues,e.facetValues)}},{key:"refine",value:function(e,t){this.props.toggleRefinement(e,t)}},{key:"_generateFacetItem",value:function(e){var n=void 0,r=e.data&&e.data.length>0;r&&(n=p["default"].createElement(t,c({},this.props,{depth:this.props.depth+1,facetValues:e.data})));var o=c({},e,{cssClasses:this.props.cssClasses}),a=h["default"](this.props.cssClasses.item,i({},this.props.cssClasses.active,e.isRefined)),s=e[this.props.attributeNameKey];return void 0!==e.isRefined&&(s+="/"+e.isRefined),void 0!==e.count&&(s+="/"+e.count),u(b["default"],{facetValueToRefine:e[this.props.attributeNameKey],handleClick:this.handleItemClick,isRefined:e.isRefined,itemClassName:a,subItems:n,templateData:o,templateKey:"item",templateProps:this.props.templateProps},s)}},{key:"handleItemClick",value:function(e){var t=e.facetValueToRefine,n=e.originalEvent,r=e.isRefined;if(!m.isSpecialClick(n)){if("INPUT"===n.target.tagName)return void this.refine(t,r);for(var i=n.target;i!==n.currentTarget;){if("LABEL"===i.tagName&&(i.querySelector('input[type="checkbox"]')||i.querySelector('input[type="radio"]')))return;"A"===i.tagName&&i.href&&n.preventDefault(),i=i.parentNode}n.stopPropagation(),this.refine(t,r)}}},{key:"handleClickShowMore",value:function(){var e=!this.state.isShowMoreOpen;this.setState({isShowMoreOpen:e})}},{key:"render",value:function(){var e=[this.props.cssClasses.list];this.props.cssClasses.depth&&e.push(""+this.props.cssClasses.depth+this.props.depth);var t=this.state.isShowMoreOpen?this.props.limitMax:this.props.limitMin,n=this.props.showMore?p["default"].createElement(g["default"],c({rootProps:{onClick:this.handleClickShowMore},templateKey:"show-more-"+(this.state.isShowMoreOpen?"active":"inactive")},this.props.templateProps)):void 0;return u("div",{className:h["default"](e)},void 0,this.props.facetValues.map(this._generateFacetItem,this).slice(0,t),n)}}]),t}(p["default"].Component);_.defaultProps={cssClasses:{},depth:0,attributeNameKey:"name"},t["default"]=_},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(350),f=r(l),p=n(538),d=r(p),h=n(341),m=r(h),v=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),c(t,[{key:"componentWillMount",value:function(){this.handleClick=this.handleClick.bind(this)}},{key:"shouldComponentUpdate",value:function(e){return!m["default"](this.props,e)}},{key:"handleClick",value:function(e){this.props.handleClick({facetValueToRefine:this.props.facetValueToRefine,isRefined:this.props.isRefined,originalEvent:e})}},{key:"render",value:function(){return u("div",{className:this.props.itemClassName,onClick:this.handleClick},void 0,f["default"].createElement(d["default"],s({data:this.props.templateData,templateKey:this.props.templateKey},this.props.templateProps)),this.props.subItems)}}]),t}(f["default"].Component);t["default"]=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.cssClasses,r=void 0===n?{}:n,i=e.templates,a=void 0===i?m["default"]:i,s=e.transformData,l=e.hitsPerPage,p=void 0===l?20:l;if(!t)throw new Error("Must provide a container."+g);if(a.item&&a.allItems)throw new Error("Must contain only allItems OR item template."+g);var h=c.getContainerNode(t),y={root:f["default"](v(null),r.root),item:f["default"](v("item"),r.item),empty:f["default"](v(null,"empty"),r.empty)};return{getConfiguration:function(){return{hitsPerPage:p}},init:function(e){var t=e.templatesConfig;this._templateProps=c.prepareTemplateProps({transformData:s,defaultTemplates:m["default"],templatesConfig:t,templates:a})},render:function(e){var t=e.results;u["default"].render(o(d["default"],{cssClasses:y,hits:t.hits,results:t,templateProps:this._templateProps}),h)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),a=n(350),s=(r(a),n(502)),u=r(s),c=n(503),l=n(534),f=r(l),p=n(589),d=r(p),h=n(590),m=r(h),v=c.bemHelper("ais-hits"),g="\nUsage:\nhits({\n container,\n [ cssClasses.{root,empty,item}={} ],\n [ templates.{empty,item} | templates.{empty, allItems} ],\n [ transformData.{empty=identity,item=identity} | transformData.{empty, allItems} ],\n [ hitsPerPage=20 ]\n})";t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(350),f=r(l),p=n(576),d=r(p),h=n(538),m=r(h),v=n(341),g=r(v),y=n(534),b=r(y),x=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),c(t,[{key:"shouldComponentUpdate",value:function(e){return 0===this.props.results.hits.length||this.props.results.hits.length!==e.results.hits.length||!g["default"](this.props.results.hits,e.results.hits)}},{key:"renderWithResults",value:function(){var e=this,t=d["default"](this.props.results.hits,function(t){return f["default"].createElement(m["default"],u({data:t,key:t.objectID,rootProps:{className:e.props.cssClasses.item},templateKey:"item"},e.props.templateProps))});return s("div",{className:this.props.cssClasses.root},void 0,t)}},{key:"renderAllResults",value:function(){return f["default"].createElement(m["default"],u({data:this.props.results,rootProps:{className:this.props.cssClasses.allItems},templateKey:"allItems"},this.props.templateProps))}},{key:"renderNoResults",value:function(){return f["default"].createElement(m["default"],u({data:this.props.results,rootProps:{className:b["default"](this.props.cssClasses.root,this.props.cssClasses.empty)},templateKey:"empty"},this.props.templateProps))}},{key:"render",value:function(){if(this.props.results.hits.length>0){var e=this.props.templateProps&&this.props.templateProps.templates&&this.props.templateProps.templates.allItems;return e?this.renderAllResults():this.renderWithResults()}return this.renderNoResults()}}]),t}(f["default"].Component);x.defaultProps={results:{hits:[]}},t["default"]=x},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={empty:"No results",item:function(e){return JSON.stringify(e,null,2)}}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.options,r=e.cssClasses,i=void 0===r?{}:r,a=e.autoHideContainer,s=void 0===a?!1:a;if(!t||!n)throw new Error(b);var l=c.getContainerNode(t),p=g["default"];s===!0&&(p=m["default"](p));var h={root:d["default"](y(null),i.root),item:d["default"](y("item"),i.item)};return{init:function(e){var t=e.helper,r=e.state,i=f["default"](n,function(e){return+r.hitsPerPage===+e.value});i||(void 0===r.hitsPerPage?window.console&&window.console.log("[Warning][hitsPerPageSelector] hitsPerPage not defined. You should probably used a `hits` widget or set the value `hitsPerPage` using the searchParameters attribute of the instantsearch constructor."):window.console&&window.console.log("[Warning][hitsPerPageSelector] No option in `options` with `value: hitsPerPage` (hitsPerPage: "+r.hitsPerPage+")"),n=[{value:void 0,label:""}].concat(n)),this.setHitsPerPage=function(e){return t.setQueryParameter("hitsPerPage",+e).search()}},render:function(e){var t=e.state,r=e.results,i=t.hitsPerPage,a=0===r.nbHits;u["default"].render(o(p,{cssClasses:h,currentValue:i,options:n,setValue:this.setHitsPerPage,shouldAutoHideContainer:a}),l)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),a=n(350),s=(r(a),n(502)),u=r(s),c=n(503),l=n(592),f=r(l),p=n(534),d=r(p),h=n(536),m=r(h),v=n(595),g=r(v),y=c.bemHelper("ais-hits-per-page-selector"),b="Usage:\nhitsPerPageSelector({\n container,\n options,\n [ cssClasses.{root,item}={} ],\n [ autoHideContainer=false ]\n})";t["default"]=i},function(e,t,n){"use strict";e.exports=n(593)},function(e,t,n){"use strict";function r(e,t,n){var r=s(e)?i:a;return n&&u(e,t,n)&&(t=void 0),("function"!=typeof t||void 0!==n)&&(t=o(t,n,3)),r(e,t)}var i=n(345),o=n(507),a=n(594),s=n(302),u=n(319);e.exports=r},function(e,t,n){"use strict";function r(e,t){var n;return i(e,function(e,r,i){return n=t(e,r,i),!n}),!!n}var i=n(285);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(350),l=r(c),f=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),u(t,[{key:"componentWillMount",value:function(){this.handleChange=this.handleChange.bind(this)}},{key:"shouldComponentUpdate",value:function(){return!1}},{key:"handleChange",value:function(e){this.props.setValue(e.target.value)}},{key:"render",value:function(){var e=this,t=this.props,n=t.currentValue,r=t.options;return s("select",{className:this.props.cssClasses.root,defaultValue:n,onChange:this.handleChange},void 0,r.map(function(t){return s("option",{className:e.props.cssClasses.item,value:t.value},t.value,t.label)}))}}]),t}(l["default"].Component);t["default"]=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributeName,r=e.sortBy,i=void 0===r?["count:desc","name:asc"]:r,s=e.limit,u=void 0===s?10:s,f=e.cssClasses,d=void 0===f?{}:f,m=e.templates,g=void 0===m?x["default"]:m,b=e.collapsible,w=void 0===b?!1:b,S=e.transformData,E=e.autoHideContainer,P=void 0===E?!0:E,k=e.showMore,T=void 0===k?!1:k,O=y["default"](T);if(O&&O.limit<u)throw new Error("showMore.limit configuration should be > than the limit in the main configuration");var R=O&&O.limit||u;if(!t||!n)throw new Error($);var N=l.getContainerNode(t),A=v["default"](_["default"]);P===!0&&(A=h["default"](A));var j=n,M=O&&l.prefixKeys("show-more-",O.templates),D=M?a({},g,M):g,I={root:p["default"](C(null),d.root),header:p["default"](C("header"),d.header),body:p["default"](C("body"),d.body),footer:p["default"](C("footer"),d.footer),list:p["default"](C("list"),d.list),item:p["default"](C("item"),d.item),active:p["default"](C("item","active"),d.active),link:p["default"](C("link"),d.link),count:p["default"](C("count"),d.count)};return{getConfiguration:function(e){var t={hierarchicalFacets:[{name:j,attributes:[n]}]},r=e.maxValuesPerFacet||0;return t.maxValuesPerFacet=Math.max(r,R),t},init:function(e){var t=e.templatesConfig,n=e.helper,r=e.createURL;this._templateProps=l.prepareTemplateProps({transformData:S,defaultTemplates:x["default"],templatesConfig:t,templates:D}),this._createURL=function(e,t){return r(e.toggleRefinement(j,t))},this._toggleRefinement=function(e){return n.toggleRefinement(j,e).search()}},_prepareFacetValues:function(e,t){var n=this;return e.map(function(e){return e.url=n._createURL(t,e),e})},render:function(e){var t=e.results,n=e.state,r=t.getFacetValues(j,{sortBy:i}).data||[];r=this._prepareFacetValues(r,n),c["default"].render(o(A,{collapsible:w,cssClasses:I,facetValues:r,limitMax:R,limitMin:u,shouldAutoHideContainer:0===r.length,showMore:null!==O,templateProps:this._templateProps,toggleRefinement:this._toggleRefinement}),N)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=n(350),u=(r(s),n(502)),c=r(u),l=n(503),f=n(534),p=r(f),d=n(536),h=r(d),m=n(537),v=r(m),g=n(597),y=r(g),b=n(599),x=r(b),w=n(586),_=r(w),C=l.bemHelper("ais-menu"),$="Usage:\nmenu({\n container,\n attributeName,\n [ sortBy=['count:desc', 'name:asc'] ],\n [ limit=10 ],\n [ cssClasses.{root,list,item} ],\n [ templates.{header,item,footer} ],\n [ transformData ],\n [ autoHideContainer ],\n [ showMore.{templates: {active, inactive}, limit} ],\n [ collapsible=false ]\n})";t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(!e)return null;if(e===!0)return u;var t=o({},e);return e.templates||(t.templates=u.templates),e.limit||(t.limit=u.limit),t}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t["default"]=i;var a=n(598),s=r(a),u={templates:s["default"],limit:100}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={active:'<a class="ais-show-more ais-show-more__active">Show less</a>',inactive:'<a class="ais-show-more ais-show-more__inactive">Show more</a>'}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={header:"",item:'<a class="{{cssClasses.link}}" href="{{url}}">{{name}} <span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span></a>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){var t=e.container,n=e.attributeName,r=e.operator,o=void 0===r?"or":r,u=e.sortBy,c=void 0===u?["count:desc","name:asc"]:u,p=e.limit,h=void 0===p?10:p,v=e.cssClasses,y=void 0===v?{}:v,x=e.templates,_=void 0===x?w["default"]:x,E=e.collapsible,P=void 0===E?!1:E,k=e.transformData,T=e.autoHideContainer,O=void 0===T?!0:T,R=e.showMore,N=void 0===R?!1:R,A=b["default"](N);if(A&&A.limit<h)throw new Error("showMore.limit configuration should be > than the limit in the main configuration");var j=A&&A.limit||h,M=C["default"];if(!t||!n)throw new Error(S);M=g["default"](M),O===!0&&(M=m["default"](M));var D=f.getContainerNode(t);if(o&&(o=o.toLowerCase(),"and"!==o&&"or"!==o))throw new Error(S);var I=A&&f.prefixKeys("show-more-",A.templates),F=I?s({},_,I):_,L={root:d["default"]($(null),y.root),header:d["default"]($("header"),y.header),body:d["default"]($("body"),y.body),footer:d["default"]($("footer"),y.footer),list:d["default"]($("list"),y.list),item:d["default"]($("item"),y.item),active:d["default"]($("item","active"),y.active),label:d["default"]($("label"),y.label),checkbox:d["default"]($("checkbox"),y.checkbox),count:d["default"]($("count"),y.count)};return{getConfiguration:function(e){var t=i({},"and"===o?"facets":"disjunctiveFacets",[n]),r=e.maxValuesPerFacet||0;return t.maxValuesPerFacet=Math.max(r,j),t},init:function(e){var t=e.templatesConfig,r=e.helper,i=e.createURL;this._templateProps=f.prepareTemplateProps({transformData:k,defaultTemplates:w["default"],templatesConfig:t,templates:F}),this._createURL=function(e,t){return i(e.toggleRefinement(n,t))},this.toggleRefinement=function(e){return r.toggleRefinement(n,e).search()}},render:function(e){var t=this,r=e.results,i=e.state,o=r.getFacetValues(n,{sortBy:c}).map(function(e){return e.url=t._createURL(i,e),e});l["default"].render(a(M,{collapsible:P,cssClasses:L,facetValues:o,limitMax:j,limitMin:h,shouldAutoHideContainer:0===o.length,showMore:null!==A,templateProps:this._templateProps,toggleRefinement:this.toggleRefinement}),D)}}}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=n(350),c=(r(u),n(502)),l=r(c),f=n(503),p=n(534),d=r(p),h=n(536),m=r(h),v=n(537),g=r(v),y=n(597),b=r(y),x=n(601),w=r(x),_=n(586),C=r(_),$=f.bemHelper("ais-refinement-list"),S="Usage:\nrefinementList({\n container,\n attributeName,\n [ operator='or' ],\n [ sortBy=['count:desc', 'name:asc'] ],\n [ limit=10 ],\n [ cssClasses.{root, header, body, footer, list, item, active, label, checkbox, count}],\n [ templates.{header,item,footer} ],\n [ transformData ],\n [ autoHideContainer=true ],\n [ collapsible=false ],\n [ showMore.{templates: {active, inactive}, limit} ],\n [ collapsible=false ]\n})";t["default"]=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={header:"",item:'<label class="{{cssClasses.label}}">\n <input type="checkbox" class="{{cssClasses.checkbox}}" value="{{name}}" {{#isRefined}}checked{{/isRefined}} />{{name}}\n <span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span>\n</label>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=e.container,n=e.attributeName,r=e.options,i=e.cssClasses,s=void 0===i?{}:i,c=e.templates,l=void 0===c?$["default"]:c,d=e.collapsible,m=void 0===d?!1:d,v=e.transformData,g=e.autoHideContainer,y=void 0===g?!0:g;if(!t||!n||!r)throw new Error(k);var b=p.getContainerNode(t),w=_["default"](E["default"]);y===!0&&(w=x["default"](w));var C={root:h["default"](P(null),s.root),header:h["default"](P("header"),s.header),body:h["default"](P("body"),s.body),footer:h["default"](P("footer"),s.footer),list:h["default"](P("list"),s.list),item:h["default"](P("item"),s.item),label:h["default"](P("label"),s.label),radio:h["default"](P("radio"),s.radio),active:h["default"](P("item","active"),s.active)};return{init:function(e){var t=e.templatesConfig,i=e.helper;this._templateProps=p.prepareTemplateProps({transformData:v,defaultTemplates:$["default"],templatesConfig:t,templates:l}),this._toggleRefinement=function(e){return i.setState(a(i.state,n,r,e)).search()}},render:function(e){var t=e.results,i=e.state,s=e.createURL,c=r.map(function(e){return e.isRefined=o(i,n,e),e.attributeName=n,e.url=s(a(i,n,r,e.name)),e});f["default"].render(u(w,{collapsible:m,cssClasses:C,facetValues:c,shouldAutoHideContainer:0===t.nbHits,templateProps:this._templateProps,toggleRefinement:this._toggleRefinement}),b)}}}function o(e,t,n){var r=e.getNumericRefinements(t);return void 0!==n.start&&void 0!==n.end&&n.start===n.end?s(r,"=",n.start):void 0!==n.start?s(r,">=",n.start):void 0!==n.end?s(r,"<=",n.end):void 0===n.start&&void 0===n.end?0===Object.keys(r).length:void 0}function a(e,t,n,r){var i=v["default"](n,{name:r}),a=e.getNumericRefinements(t);if(void 0===i.start&&void 0===i.end)return e.clearRefinements(t);if(o(e,t,i)||(e=e.clearRefinements(t)),void 0!==i.start&&void 0!==i.end){if(i.start>i.end)throw new Error("option.start should be > to option.end");if(i.start===i.end)return e=s(a,"=",i.start)?e.removeNumericRefinement(t,"=",i.start):e.addNumericRefinement(t,"=",i.start)}return void 0!==i.start&&(e=s(a,">=",i.start)?e.removeNumericRefinement(t,">=",i.start):e.addNumericRefinement(t,">=",i.start)),void 0!==i.end&&(e=s(a,"<=",i.end)?e.removeNumericRefinement(t,"<=",i.end):e.addNumericRefinement(t,"<=",i.end)),e}function s(e,t,n){var r=void 0!==e[t],i=y["default"](e[t],n);return r&&i}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),c=n(350),l=(r(c),n(502)),f=r(l),p=n(503),d=n(534),h=r(d),m=n(523),v=r(m),g=n(603),y=r(g),b=n(536),x=r(b),w=n(537),_=r(w),C=n(606),$=r(C),S=n(586),E=r(S),P=p.bemHelper("ais-refinement-list"),k="Usage:\nnumericRefinementList({\n container,\n attributeName,\n options,\n [ cssClasses.{root,header,body,footer,list,item,active,label,checkbox,count} ],\n [ templates.{header,item,footer} ],\n [ transformData ],\n [ autoHideContainer ],\n [ collapsible=false ]\n})";t["default"]=i},function(e,t,n){"use strict";function r(e,t,n,r){var p=e?o(e):0;return u(p)||(e=l(e),p=e.length),n="number"!=typeof n||r&&s(t,n,r)?0:0>n?f(p+n,0):n||0,"string"==typeof e||!a(e)&&c(e)?p>=n&&e.indexOf(t,n)>-1:!!p&&i(e,t,n)>-1}var i=n(325),o=n(297),a=n(302),s=n(319),u=n(299),c=n(529),l=n(604),f=Math.max;e.exports=r},function(e,t,n){"use strict";function r(e){return i(e,o(e))}var i=n(605),o=n(291);e.exports=r},function(e){"use strict";function t(e,t){for(var n=-1,r=t.length,i=Array(r);++n<r;)i[n]=e[t[n]];return i}e.exports=t},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={header:"",item:'<label class="{{cssClasses.label}}">\n <input type="radio" class="{{cssClasses.checkbox}}" name="{{attributeName}}" {{#isRefined}}checked{{/isRefined}} />{{name}}\n</label>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=e.container,n=e.operator,r=void 0===n?"=":n,i=e.attributeName,a=e.options,s=e.cssClasses,l=void 0===s?{}:s,p=e.autoHideContainer,h=void 0===p?!1:p,v=c.getContainerNode(t),b="Usage: numericSelector({container, attributeName, options[, cssClasses.{root,item}, autoHideContainer]})",x=g["default"];if(h===!0&&(x=m["default"](x)),!t||!a||0===a.length||!i)throw new Error(b);var w={root:f["default"](y(null),l.root),item:f["default"](y("item"),l.item)};return{init:function(e){var t=e.helper,n=this._getRefinedValue(t)||a[0].value;void 0!==n&&t.addNumericRefinement(i,r,n),this._refine=function(e){t.clearRefinements(i),void 0!==e&&t.addNumericRefinement(i,r,e),t.search()}},render:function(e){var t=e.helper,n=e.results;u["default"].render(o(x,{
24
- cssClasses:w,currentValue:this._getRefinedValue(t),options:a,setValue:this._refine,shouldAutoHideContainer:0===n.nbHits}),v)},_getRefinedValue:function(e){var t=e.getRefinements(i),n=d["default"](t,{operator:r});return n&&void 0!==n.value&&void 0!==n.value[0]?n.value[0]:void 0}}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),a=n(350),s=(r(a),n(502)),u=r(s),c=n(503),l=n(534),f=r(l),p=n(523),d=r(p),h=n(536),m=r(h),v=n(595),g=r(v),y=c.bemHelper("ais-numeric-selector");t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.cssClasses,r=void 0===n?{}:n,i=e.labels,a=void 0===i?{}:i,s=e.maxPages,c=e.padding,f=void 0===c?3:c,h=e.showFirstLast,v=void 0===h?!0:h,w=e.autoHideContainer,_=void 0===w?!0:w,C=e.scrollTo,$=void 0===C?"body":C;if(!t)throw new Error(x);$===!0&&($="body");var S=d.getContainerNode(t),E=$!==!1?d.getContainerNode($):!1,P=g["default"];_===!0&&(P=m["default"](P));var k={root:p["default"](b(null),r.root),item:p["default"](b("item"),r.item),link:p["default"](b("link"),r.link),page:p["default"](b("item","page"),r.page),previous:p["default"](b("item","previous"),r.previous),next:p["default"](b("item","next"),r.next),first:p["default"](b("item","first"),r.first),last:p["default"](b("item","last"),r.last),active:p["default"](b("item","active"),r.active),disabled:p["default"](b("item","disabled"),r.disabled)};return a=l["default"](a,y),{init:function(e){var t=e.helper;this.setCurrentPage=function(e){t.setCurrentPage(e),E!==!1&&E.scrollIntoView(),t.search()}},getMaxPage:function(e){return void 0!==s?Math.min(s,e.nbPages):e.nbPages},render:function(e){var t=e.results,n=e.state,r=e.createURL;u["default"].render(o(P,{createURL:function(e){return r(n.setPage(e))},cssClasses:k,currentPage:t.page,labels:a,nbHits:t.nbHits,nbPages:this.getMaxPage(t),padding:f,setCurrentPage:this.setCurrentPage,shouldAutoHideContainer:0===t.nbHits,showFirstLast:v}),S)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),a=n(350),s=(r(a),n(502)),u=r(s),c=n(609),l=r(c),f=n(534),p=r(f),d=n(503),h=n(536),m=r(h),v=n(614),g=r(v),y={previous:"‹",next:"›",first:"«",last:"»"},b=d.bemHelper("ais-pagination"),x="Usage:\npagination({\n container,\n [ cssClasses.{root,item,page,previous,next,first,last,active,disabled}={} ],\n [ labels.{previous,next,first,last} ],\n [ maxPages ],\n [ padding=3 ],\n [ showFirstLast=true ],\n [ autoHideContainer=true ],\n [ scrollTo='body' ]\n})";t["default"]=i},function(e,t,n){"use strict";var r=n(610),i=n(612),o=n(613),a=o(r,i);e.exports=a},function(e,t,n){"use strict";var r=n(611),i=n(333),o=n(318),a=o(function(e,t,n){return n?r(e,t,n):i(e,t)});e.exports=a},function(e,t,n){"use strict";function r(e,t,n){for(var r=-1,o=i(t),a=o.length;++r<a;){var s=o[r],u=e[s],c=n(u,t[s],s,e,t);(c===c?c===u:u!==u)&&(void 0!==u||s in e)||(e[s]=c)}return e}var i=n(291);e.exports=r},function(e){"use strict";function t(e,t){return void 0===e?t:e}e.exports=t},function(e,t,n){"use strict";function r(e,t){return i(function(n){var r=n[0];return null==r?r:(n.push(t),e.apply(void 0,n))})}var i=n(320);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(350),l=r(c),f=n(283),p=r(f),d=n(615),h=r(d),m=n(503),v=n(617),g=r(v),y=n(619),b=r(y),x=n(534),w=r(x),_=function(e){function t(e){i(this,t);var n=o(this,Object.getPrototypeOf(t).call(this,h["default"](e,t.defaultProps)));return n.handleClick=n.handleClick.bind(n),n}return a(t,e),u(t,[{key:"pageLink",value:function(e){var t=e.label,n=e.ariaLabel,r=e.pageNumber,i=e.additionalClassName,o=void 0===i?null:i,a=e.isDisabled,u=void 0===a?!1:a,c=e.isActive,l=void 0===c?!1:c,f=e.createURL,p={item:w["default"](this.props.cssClasses.item,o),link:w["default"](this.props.cssClasses.link)};u?p.item=w["default"](p.item,this.props.cssClasses.disabled):l&&(p.item=w["default"](p.item,this.props.cssClasses.active));var d=f&&!u?f(r):"#";return s(b["default"],{ariaLabel:n,cssClasses:p,handleClick:this.handleClick,label:t,pageNumber:r,url:d},t+r)}},{key:"previousPageLink",value:function(e,t){return this.pageLink({ariaLabel:"Previous",additionalClassName:this.props.cssClasses.previous,isDisabled:e.isFirstPage(),label:this.props.labels.previous,pageNumber:e.currentPage-1,createURL:t})}},{key:"nextPageLink",value:function(e,t){return this.pageLink({ariaLabel:"Next",additionalClassName:this.props.cssClasses.next,isDisabled:e.isLastPage(),label:this.props.labels.next,pageNumber:e.currentPage+1,createURL:t})}},{key:"firstPageLink",value:function(e,t){return this.pageLink({ariaLabel:"First",additionalClassName:this.props.cssClasses.first,isDisabled:e.isFirstPage(),label:this.props.labels.first,pageNumber:0,createURL:t})}},{key:"lastPageLink",value:function(e,t){return this.pageLink({ariaLabel:"Last",additionalClassName:this.props.cssClasses.last,isDisabled:e.isLastPage(),label:this.props.labels.last,pageNumber:e.total-1,createURL:t})}},{key:"pages",value:function n(e,t){var r=this,n=[];return p["default"](e.pages(),function(i){var o=i===e.currentPage;n.push(r.pageLink({ariaLabel:i+1,additionalClassName:r.props.cssClasses.page,isActive:o,label:i+1,pageNumber:i,createURL:t}))}),n}},{key:"handleClick",value:function(e,t){m.isSpecialClick(t)||(t.preventDefault(),this.props.setCurrentPage(e))}},{key:"render",value:function(){var e=new g["default"]({currentPage:this.props.currentPage,total:this.props.nbPages,padding:this.props.padding}),t=this.props.createURL;return s("ul",{className:this.props.cssClasses.root},void 0,this.props.showFirstLast?this.firstPageLink(e,t):null,this.previousPageLink(e,t),this.pages(e,t),this.nextPageLink(e,t),this.props.showFirstLast?this.lastPageLink(e,t):null)}}]),t}(l["default"].Component);_.defaultProps={nbHits:0,currentPage:0,nbPages:0},t["default"]=_},function(e,t,n){"use strict";var r=n(613),i=n(309),o=n(616),a=r(i,o);e.exports=a},function(e,t,n){"use strict";function r(e,t){return void 0===e?t:i(e,t,r)}var i=n(309);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=n(618),s=r(a),u=function(){function e(t){i(this,e),this.currentPage=t.currentPage,this.total=t.total,this.padding=t.padding}return o(e,[{key:"pages",value:function(){var e=this.total,t=this.currentPage,n=this.padding,r=this.nbPagesDisplayed(n,e);if(r===e)return s["default"](0,e);var i=this.calculatePaddingLeft(t,n,e,r),o=r-i,a=t-i,u=t+o;return s["default"](a,u)}},{key:"nbPagesDisplayed",value:function(e,t){return Math.min(2*e+1,t)}},{key:"calculatePaddingLeft",value:function(e,t,n,r){return t>=e?e:e>=n-t?r-(n-e):t}},{key:"isLastPage",value:function(){return this.currentPage===this.total-1}},{key:"isFirstPage",value:function(){return 0===this.currentPage}}]),e}();t["default"]=u},function(e,t,n){"use strict";function r(e,t,n){n&&i(e,t,n)&&(t=n=void 0),e=+e||0,n=null==n?1:+n||0,null==t?(t=e,e=0):t=+t||0;for(var r=-1,s=a(o((t-e)/(n||1)),0),u=Array(s);++r<s;)u[r]=e,e+=n;return u}var i=n(319),o=Math.ceil,a=Math.max;e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(350),l=r(c),f=n(341),p=r(f),d=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),u(t,[{key:"componentWillMount",value:function(){this.handleClick=this.handleClick.bind(this)}},{key:"shouldComponentUpdate",value:function(e){return!p["default"](this.props,e)}},{key:"handleClick",value:function(e){this.props.handleClick(this.props.pageNumber,e)}},{key:"render",value:function(){var e=this.props,t=e.cssClasses,n=e.label,r=e.ariaLabel,i=e.url;return s("li",{className:t.item},void 0,s("a",{ariaLabel:r,className:t.link,dangerouslySetInnerHTML:{__html:n},href:i,onClick:this.handleClick}))}}]),t}(l["default"].Component);t["default"]=d},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributeName,r=e.cssClasses,i=void 0===r?{}:r,s=e.templates,u=void 0===s?h["default"]:s,f=e.collapsible,d=void 0===f?!1:f,m=e.labels,g=void 0===m?{}:m,b=e.currency,w=void 0===b?"$":b,S=e.autoHideContainer,E=void 0===S?!0:S;if(!t||!n)throw new Error($);var P=l.getContainerNode(t),k=y["default"](_["default"]);E===!0&&(k=v["default"](k));var T=a({button:"Go",separator:"to"},g),O={root:x["default"](C(null),i.root),header:x["default"](C("header"),i.header),body:x["default"](C("body"),i.body),list:x["default"](C("list"),i.list),link:x["default"](C("link"),i.link),item:x["default"](C("item"),i.item),active:x["default"](C("item","active"),i.active),form:x["default"](C("form"),i.form),label:x["default"](C("label"),i.label),input:x["default"](C("input"),i.input),currency:x["default"](C("currency"),i.currency),button:x["default"](C("button"),i.button),separator:x["default"](C("separator"),i.separator),footer:x["default"](C("footer"),i.footer)};return void 0!==g.currency&&g.currency!==w&&(w=g.currency),{getConfiguration:function(){return{facets:[n]}},_generateRanges:function(e){var t=e.getFacetStats(n);return p["default"](t)},_extractRefinedRange:function(e){var t=e.getRefinements(n),r=void 0,i=void 0;return 0===t.length?[]:(t.forEach(function(e){-1!==e.operator.indexOf(">")?r=Math.floor(e.value[0]):-1!==e.operator.indexOf("<")&&(i=Math.ceil(e.value[0]))}),[{from:r,to:i,isRefined:!0}])},_refine:function(e,t,r){var i=this._extractRefinedRange(e);e.clearRefinements(n),(0===i.length||i[0].from!==t||i[0].to!==r)&&("undefined"!=typeof t&&e.addNumericRefinement(n,">=",Math.floor(t)),"undefined"!=typeof r&&e.addNumericRefinement(n,"<=",Math.ceil(r))),e.search()},init:function(e){var t=e.helper,n=e.templatesConfig;this._refine=this._refine.bind(this,t),this._templateProps=l.prepareTemplateProps({defaultTemplates:h["default"],templatesConfig:n,templates:u})},render:function(e){var t=e.results,r=e.helper,i=e.state,a=e.createURL,s=void 0;t.hits.length>0?(s=this._extractRefinedRange(r),0===s.length&&(s=this._generateRanges(t))):s=[],s.map(function(e){var t=i.clearRefinements(n);return e.isRefined||(void 0!==e.from&&(t=t.addNumericRefinement(n,">=",Math.floor(e.from))),void 0!==e.to&&(t=t.addNumericRefinement(n,"<=",Math.ceil(e.to)))),e.url=a(t),e}),c["default"].render(o(k,{collapsible:d,cssClasses:O,currency:w,facetValues:s,labels:T,refine:this._refine,shouldAutoHideContainer:0===s.length,templateProps:this._templateProps}),P)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),a=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=n(350),u=(r(s),n(502)),c=r(u),l=n(503),f=n(621),p=r(f),d=n(622),h=r(d),m=n(536),v=r(m),g=n(537),y=r(g),b=n(534),x=r(b),w=n(623),_=r(w),C=l.bemHelper("ais-price-ranges"),$="Usage:\npriceRanges({\n container,\n attributeName,\n [ currency=$ ],\n [ cssClasses.{root,header,body,list,item,active,link,form,label,input,currency,separator,button,footer} ],\n [ templates.{header,item,footer} ],\n [ labels.{currency,separator,button} ],\n [ autoHideContainer=true ],\n [ collapsible=false ]\n})";t["default"]=i},function(e,t){"use strict";function n(e,t){var n=Math.round(e/t)*t;return 1>n&&(n=1),n}function r(e){var t=void 0;t=e.avg<100?1:e.avg<1e3?10:100;for(var r=n(Math.round(e.avg),t),i=Math.ceil(e.min),o=n(Math.floor(e.max),t);o>e.max;)o-=t;var a=void 0,s=void 0,u=[];if(i!==o){for(a=i,u.push({to:a});r>a;)s=u[u.length-1].to,a=n(s+(r-i)/3,t),s>=a&&(a=s+1),u.push({from:s,to:a});for(;o>a;)s=u[u.length-1].to,a=n(s+(o-r)/3,t),s>=a&&(a=s+1),u.push({from:s,to:a});1===u.length&&a!==r&&(u.push({from:a,to:r}),a=r),1===u.length?(u[0].from=e.min,u[0].to=e.max):delete u[u.length-1].to}return u}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={header:"",item:"\n {{#from}}\n {{^to}}\n &ge;\n {{/to}}\n {{currency}}{{from}}\n {{/from}}\n {{#to}}\n {{#from}}\n -\n {{/from}}\n {{^from}}\n &le;\n {{/from}}\n {{to}}\n {{/to}}\n ",footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},l=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),f=n(350),p=r(f),d=n(538),h=r(d),m=n(624),v=r(m),g=n(534),y=r(g),b=n(341),x=r(b),w=function(e){function t(){return o(this,t),a(this,Object.getPrototypeOf(t).apply(this,arguments))}return s(t,e),l(t,[{key:"componentWillMount",value:function(){this.refine=this.refine.bind(this),this.form=this.getForm()}},{key:"shouldComponentUpdate",value:function(e){return!x["default"](this.props.facetValues,e.facetValues)}},{key:"getForm",value:function(){var e=c({currency:this.props.currency},this.props.labels);return u(v["default"],{cssClasses:this.props.cssClasses,labels:e,refine:this.refine})}},{key:"getItemFromFacetValue",value:function(e){var t=y["default"](this.props.cssClasses.item,i({},this.props.cssClasses.active,e.isRefined)),n=e.from+"_"+e.to,r=this.refine.bind(this,e.from,e.to),o=c({currency:this.props.currency},e);return u("div",{className:t},n,u("a",{className:this.props.cssClasses.link,href:e.url,onClick:r},void 0,p["default"].createElement(h["default"],c({data:o,templateKey:"item"},this.props.templateProps))))}},{key:"refine",value:function(e,t,n){n.preventDefault(),this.props.refine(e,t)}},{key:"render",value:function(){var e=this;return u("div",{},void 0,u("div",{className:this.props.cssClasses.list},void 0,this.props.facetValues.map(function(t){return e.getItemFromFacetValue(t)})),this.form)}}]),t}(p["default"].Component);w.defaultProps={cssClasses:{}},t["default"]=w},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(350),l=r(c),f=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),u(t,[{key:"componentWillMount",value:function(){this.handleSubmit=this.handleSubmit.bind(this)}},{key:"shouldComponentUpdate",value:function(){return!1}},{key:"getInput",value:function(e){return s("label",{className:this.props.cssClasses.label},void 0,s("span",{className:this.props.cssClasses.currency},void 0,this.props.labels.currency," "),l["default"].createElement("input",{className:this.props.cssClasses.input,ref:e,type:"number"}))}},{key:"handleSubmit",value:function(e){var t=+this.refs.from.value||void 0,n=+this.refs.to.value||void 0;this.props.refine(t,n,e)}},{key:"render",value:function(){var e=this.getInput("from"),t=this.getInput("to"),n=this.handleSubmit;return l["default"].createElement("form",{className:this.props.cssClasses.form,onSubmit:n,ref:"form"},e,s("span",{className:this.props.cssClasses.separator},void 0," ",this.props.labels.separator," "),t,s("button",{className:this.props.cssClasses.button,type:"submit"},void 0,this.props.labels.button))}}]),t}(l["default"].Component);f.defaultProps={cssClasses:{},labels:{}},t["default"]=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=e.container,n=e.placeholder,r=void 0===n?"":n,i=e.cssClasses,a=void 0===i?{}:i,l=e.poweredBy,f=void 0===l?!1:l,h=e.wrapInput,v=void 0===h?!0:h,y=e.autofocus,$=void 0===y?"auto":y,S=e.searchOnEnterKeyPressOnly,E=void 0===S?!1:S,P=e.queryHook,k=window.addEventListener?"input":"propertychange";if(!t)throw new Error(C);return t=d.getContainerNode(t),"boolean"!=typeof $&&($="auto"),{getInput:function(){return"INPUT"===t.tagName?t:document.createElement("input")},wrapInput:function(e){var t=document.createElement("div"),n=g["default"](x(null),a.root).split(" ");return t.classList.add.apply(t.classList,n),t.appendChild(e),t},addDefaultAttributesToInput:function(e,t){var n={autocapitalize:"off",autocomplete:"off",autocorrect:"off",placeholder:r,role:"textbox",spellcheck:"false",type:"text",value:t};m["default"](n,function(t,n){e.hasAttribute(n)||e.setAttribute(n,t)});var i=g["default"](x("input"),a.input).split(" ");e.classList.add.apply(e.classList,i)},addPoweredBy:function(e){var t=document.createElement("div");e.parentNode.insertBefore(t,e.nextSibling);var n={root:g["default"](x("powered-by"),a.poweredBy),link:x("powered-by-link")},r="https://www.algolia.com/?utm_source=instantsearch.js&utm_medium=website&"+("utm_content="+location.hostname+"&")+"utm_campaign=poweredby";p["default"].render(c(b["default"],{cssClasses:n,link:r}),t)},init:function(e){function n(e){return P?void P(e,r):void r(e)}function r(e){a.setQuery(e),a.search()}var i=e.state,a=e.helper,c=e.onHistoryChange,l="INPUT"===t.tagName,p=this._input=this.getInput();if(this.addDefaultAttributesToInput(p,i.query),E?o(p,"keyup",s(w,u(n))):(o(p,k,u(n)),("propertychange"===k||window.attachEvent)&&o(p,"keyup",s(_,u(n)))),l){var d=document.createElement("div");p.parentNode.insertBefore(d,p);var h=p.parentNode,m=v?this.wrapInput(p):p;h.replaceChild(m,d)}else{var g=v?this.wrapInput(p):p;t.appendChild(g)}f&&this.addPoweredBy(p),c(function(e){p.value=e.query||""}),($===!0||"auto"===$&&""===a.state.query)&&p.focus()},render:function(e){var t=e.helper;t.state.query!==this._input.value&&(this._input.value=t.state.query)}}}function o(e,t,n){e.addEventListener?e.addEventListener(t,n):e.attachEvent("on"+t,n)}function a(e){return(e.currentTarget?e.currentTarget:e.srcElement).value}function s(e,t){return function(n){return n.keyCode===e&&t(n)}}function u(e){return function(t){return e(a(t))}}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),l=n(350),f=(r(l),n(502)),p=r(f),d=n(503),h=n(283),m=r(h),v=n(534),g=r(v),y=n(626),b=r(y),x=d.bemHelper("ais-search-box"),w=13,_=8,C="Usage:\nsearchBox({\n container,\n [ placeholder ],\n [ cssClasses.{input,poweredBy} ],\n [ poweredBy ],\n [ wrapInput ],\n [ autofocus ],\n [ searchOnEnterKeyPressOnly ],\n [ queryHook ]\n})";t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(350),l=r(c),f=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),u(t,[{key:"shouldComponentUpdate",value:function(){return!1}},{key:"render",value:function(){return s("div",{className:this.props.cssClasses.root},void 0,"Search by",s("a",{className:this.props.cssClasses.link,href:this.props.link,target:"_blank"},void 0,"Algolia"))}}]),t}(l["default"].Component);t["default"]=f},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributeName,r=e.tooltips,o=void 0===r?!0:r,s=e.templates,u=void 0===s?_:s,f=e.collapsible,d=void 0===f?!1:f,m=e.cssClasses,g=void 0===m?{}:m,b=e.step,$=void 0===b?1:b,S=e.pips,E=void 0===S?!0:S,P=e.autoHideContainer,k=void 0===P?!0:P,T=e.min,O=e.max;if(!t||!n)throw new Error(C);var R=l.getContainerNode(t),N=v["default"](x["default"]);k===!0&&(N=h["default"](N));var A={root:y["default"](w(null),g.root),header:y["default"](w("header"),g.header),body:y["default"](w("body"),g.body),footer:y["default"](w("footer"),g.footer)};return{getConfiguration:function(e){var t={disjunctiveFacets:[n]};return void 0===T&&void 0===O||e&&(!e.numericRefinements||void 0!==e.numericRefinements[n])||(t.numericRefinements=i({},n,{}),void 0!==T&&(t.numericRefinements[n][">="]=[T]),void 0!==O&&(t.numericRefinements[n]["<="]=[O])),t},_getCurrentRefinement:function(e){var t=e.state.getNumericRefinement(n,">="),r=e.state.getNumericRefinement(n,"<=");return t=t&&t.length?t[0]:-(1/0),r=r&&r.length?r[0]:1/0,{min:t,max:r}},_refine:function(e,t,r){e.clearRefinements(n),r[0]>t.min&&e.addNumericRefinement(n,">=",Math.round(r[0])),r[1]<t.max&&e.addNumericRefinement(n,"<=",Math.round(r[1])),e.search()},init:function(e){var t=e.templatesConfig;this._templateProps=l.prepareTemplateProps({defaultTemplates:_,templatesConfig:t,templates:u})},render:function(e){var t=e.results,r=e.helper,i=p["default"](t.disjunctiveFacets,{name:n}),s=void 0;void 0!==T||void 0!==O?(s={},void 0!==T&&(s.min=T),void 0!==O&&(s.max=O)):s=void 0!==i&&void 0!==i.stats?i.stats:{min:null,max:null};var u=this._getCurrentRefinement(r);void 0!==o.format&&(o=[{to:o.format},{to:o.format}]),c["default"].render(a(N,{collapsible:d,cssClasses:A,onChange:this._refine.bind(this,r,s),pips:E,range:{min:Math.floor(s.min),max:Math.ceil(s.max)},shouldAutoHideContainer:s.min===s.max,start:[u.min,u.max],step:$,templateProps:this._templateProps,tooltips:o}),R)}}}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),s=n(350),u=(r(s),n(502)),c=r(u),l=n(503),f=n(523),p=r(f),d=n(536),h=r(d),m=n(537),v=r(m),g=n(534),y=r(g),b=n(628),x=r(b),w=l.bemHelper("ais-range-slider"),_={header:"",footer:""},C="Usage:\nrangeSlider({\n container,\n attributeName,\n [ tooltips=true ],\n [ templates.{header, footer} ],\n [ cssClasses.{root, header, body, footer} ],\n [ step=1 ],\n [ pips=true ],\n [ autoHideContainer=true ],\n [ collapsible=false ],\n [ min ],\n [ max ]\n});\n";t["default"]=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(350),l=r(c),f=n(629),p=r(f),d=n(341),h=r(d),m="ais-range-slider--",v=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),u(t,[{key:"componentWillMount",value:function(){this.handleChange=this.handleChange.bind(this)}},{key:"shouldComponentUpdate",value:function(e){return!h["default"](this.props.range,e.range)||!h["default"](this.props.start,e.start);
25
-
26
- }},{key:"handleChange",value:function(e,t,n){this.props.onChange(n)}},{key:"render",value:function(){if(this.props.range.min===this.props.range.max)return null;var e=void 0;return e=this.props.pips===!1?void 0:this.props.pips===!0||"undefined"==typeof this.props.pips?{mode:"positions",density:3,values:[0,50,100],stepped:!0,format:{to:function(e){return Number(e).toLocaleString()}}}:this.props.pips,l["default"].createElement(p["default"],s({},this.props,{animate:!1,behaviour:"snap",connect:!0,cssPrefix:m,onChange:this.handleChange,pips:e}))}}]),t}(l["default"].Component);t["default"]=v},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":a(t)));e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=function(e,t,n){for(var r=!0;r;){var i=e,o=t,a=n;r=!1,null===i&&(i=Function.prototype);var s=Object.getOwnPropertyDescriptor(i,o);if(void 0!==s){if("value"in s)return s.value;var u=s.get;return void 0===u?void 0:u.call(a)}var c=Object.getPrototypeOf(i);if(null===c)return void 0;e=c,t=o,n=a,r=!0,s=c=void 0}},l=n(350),f=r(l),p=n(630),d=r(p),h=function(e){function t(){i(this,t),c(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return o(t,e),u(t,[{key:"componentDidMount",value:function(){this.props.disabled?this.sliderContainer.setAttribute("disabled",!0):this.sliderContainer.removeAttribute("disabled"),this.createSlider()}},{key:"componentDidUpdate",value:function(){this.props.disabled?this.sliderContainer.setAttribute("disabled",!0):this.sliderContainer.removeAttribute("disabled"),this.slider.destroy(),this.createSlider()}},{key:"componentWillUnmount",value:function(){this.slider.destroy()}},{key:"createSlider",value:function(){var e=this.slider=d["default"].create(this.sliderContainer,s({},this.props));this.props.onUpdate&&e.on("update",this.props.onUpdate),this.props.onChange&&e.on("change",this.props.onChange),this.props.onSlide&&e.on("slide",this.props.onSlide)}},{key:"render",value:function(){var e=this;return f["default"].createElement("div",{ref:function(t){e.sliderContainer=t}})}}]),t}(f["default"].Component);h.propTypes={animate:f["default"].PropTypes.bool,behaviour:f["default"].PropTypes.string,connect:f["default"].PropTypes.oneOfType([f["default"].PropTypes.oneOf(["lower","upper"]),f["default"].PropTypes.bool]),cssPrefix:f["default"].PropTypes.string,direction:f["default"].PropTypes.oneOf(["ltr","rtl"]),disabled:f["default"].PropTypes.bool,limit:f["default"].PropTypes.number,margin:f["default"].PropTypes.number,onChange:f["default"].PropTypes.func,onSlide:f["default"].PropTypes.func,onUpdate:f["default"].PropTypes.func,orientation:f["default"].PropTypes.oneOf(["horizontal","vertical"]),pips:f["default"].PropTypes.object,range:f["default"].PropTypes.object.isRequired,start:f["default"].PropTypes.arrayOf(f["default"].PropTypes.number).isRequired,step:f["default"].PropTypes.number,tooltips:f["default"].PropTypes.oneOfType([f["default"].PropTypes.bool,f["default"].PropTypes.arrayOf(f["default"].PropTypes.shape({to:f["default"].PropTypes.func}))])},e.exports=h},function(e,t){var n,r,i,o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};!function(o){r=[],n=o,i="function"==typeof n?n.apply(t,r):n,!(void 0!==i&&(e.exports=i))}(function(){"use strict";function e(e){return e.filter(function(e){return this[e]?!1:this[e]=!0},{})}function t(e,t){return Math.round(e/t)*t}function n(e){var t=e.getBoundingClientRect(),n=e.ownerDocument,r=n.documentElement,i=d();return/webkit.*Chrome.*Mobile/i.test(navigator.userAgent)&&(i.x=0),{top:t.top+i.y-r.clientTop,left:t.left+i.x-r.clientLeft}}function r(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)}function i(e){var t=Math.pow(10,7);return Number((Math.round(e*t)/t).toFixed(7))}function a(e,t,n){l(e,t),setTimeout(function(){f(e,t)},n)}function s(e){return Math.max(Math.min(e,100),0)}function u(e){return Array.isArray(e)?e:[e]}function c(e){var t=e.split(".");return t.length>1?t[1].length:0}function l(e,t){e.classList?e.classList.add(t):e.className+=" "+t}function f(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")}function p(e,t){return e.classList?e.classList.contains(t):new RegExp("\\b"+t+"\\b").test(e.className)}function d(){var e=void 0!==window.pageXOffset,t="CSS1Compat"===(document.compatMode||""),n=e?window.pageXOffset:t?document.documentElement.scrollLeft:document.body.scrollLeft,r=e?window.pageYOffset:t?document.documentElement.scrollTop:document.body.scrollTop;return{x:n,y:r}}function h(e){e.stopPropagation()}function m(e){return function(t){return e+t}}function v(){W||(W=window.navigator.pointerEnabled?{start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled?{start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}:{start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"})}function g(e,t){return 100/(t-e)}function y(e,t){return 100*t/(e[1]-e[0])}function b(e,t){return y(e,e[0]<0?t+Math.abs(e[0]):t-e[0])}function x(e,t){return t*(e[1]-e[0])/100+e[0]}function w(e,t){for(var n=1;e>=t[n];)n+=1;return n}function _(e,t,n){if(n>=e.slice(-1)[0])return 100;var r,i,o,a,s=w(n,e);return r=e[s-1],i=e[s],o=t[s-1],a=t[s],o+b([r,i],n)/g(o,a)}function C(e,t,n){if(n>=100)return e.slice(-1)[0];var r,i,o,a,s=w(n,t);return r=e[s-1],i=e[s],o=t[s-1],a=t[s],x([r,i],(n-o)*g(o,a))}function $(e,n,r,i){if(100===i)return i;var o,a,s=w(i,e);return r?(o=e[s-1],a=e[s],i-o>(a-o)/2?a:o):n[s-1]?e[s-1]+t(i-e[s-1],n[s-1]):i}function S(e,t,n){var i;if("number"==typeof t&&(t=[t]),"[object Array]"!==Object.prototype.toString.call(t))throw new Error("noUiSlider: 'range' contains invalid value.");if(i="min"===e?0:"max"===e?100:parseFloat(e),!r(i)||!r(t[0]))throw new Error("noUiSlider: 'range' value isn't numeric.");n.xPct.push(i),n.xVal.push(t[0]),i?n.xSteps.push(isNaN(t[1])?!1:t[1]):isNaN(t[1])||(n.xSteps[0]=t[1])}function E(e,t,n){return t?void(n.xSteps[e]=y([n.xVal[e],n.xVal[e+1]],t)/g(n.xPct[e],n.xPct[e+1])):!0}function P(e,t,n,r){this.xPct=[],this.xVal=[],this.xSteps=[r||!1],this.xNumSteps=[!1],this.snap=t,this.direction=n;var i,a=[];for(i in e)e.hasOwnProperty(i)&&a.push([e[i],i]);for(a.sort(a.length&&"object"===o(a[0][0])?function(e,t){return e[0][0]-t[0][0]}:function(e,t){return e[0]-t[0]}),i=0;i<a.length;i++)S(a[i][1],a[i][0],this);for(this.xNumSteps=this.xSteps.slice(0),i=0;i<this.xNumSteps.length;i++)E(i,this.xNumSteps[i],this)}function k(e,t){if(!r(t))throw new Error("noUiSlider: 'step' is not numeric.");e.singleStep=t}function T(e,t){if("object"!==("undefined"==typeof t?"undefined":o(t))||Array.isArray(t))throw new Error("noUiSlider: 'range' is not an object.");if(void 0===t.min||void 0===t.max)throw new Error("noUiSlider: Missing 'min' or 'max' in 'range'.");if(t.min===t.max)throw new Error("noUiSlider: 'range' 'min' and 'max' cannot be equal.");e.spectrum=new P(t,e.snap,e.dir,e.singleStep)}function O(e,t){if(t=u(t),!Array.isArray(t)||!t.length||t.length>2)throw new Error("noUiSlider: 'start' option is incorrect.");e.handles=t.length,e.start=t}function R(e,t){if(e.snap=t,"boolean"!=typeof t)throw new Error("noUiSlider: 'snap' option must be a boolean.")}function N(e,t){if(e.animate=t,"boolean"!=typeof t)throw new Error("noUiSlider: 'animate' option must be a boolean.")}function A(e,t){if("lower"===t&&1===e.handles)e.connect=1;else if("upper"===t&&1===e.handles)e.connect=2;else if(t===!0&&2===e.handles)e.connect=3;else{if(t!==!1)throw new Error("noUiSlider: 'connect' option doesn't match handle count.");e.connect=0}}function j(e,t){switch(t){case"horizontal":e.ort=0;break;case"vertical":e.ort=1;break;default:throw new Error("noUiSlider: 'orientation' option is invalid.")}}function M(e,t){if(!r(t))throw new Error("noUiSlider: 'margin' option must be numeric.");if(0!==t&&(e.margin=e.spectrum.getMargin(t),!e.margin))throw new Error("noUiSlider: 'margin' option is only supported on linear sliders.")}function D(e,t){if(!r(t))throw new Error("noUiSlider: 'limit' option must be numeric.");if(e.limit=e.spectrum.getMargin(t),!e.limit)throw new Error("noUiSlider: 'limit' option is only supported on linear sliders.")}function I(e,t){switch(t){case"ltr":e.dir=0;break;case"rtl":e.dir=1,e.connect=[0,2,1,3][e.connect];break;default:throw new Error("noUiSlider: 'direction' option was not recognized.")}}function F(e,t){if("string"!=typeof t)throw new Error("noUiSlider: 'behaviour' must be a string containing options.");var n=t.indexOf("tap")>=0,r=t.indexOf("drag")>=0,i=t.indexOf("fixed")>=0,o=t.indexOf("snap")>=0,a=t.indexOf("hover")>=0;if(r&&!e.connect)throw new Error("noUiSlider: 'drag' behaviour must be used with 'connect': true.");e.events={tap:n||o,drag:r,fixed:i,snap:o,hover:a}}function L(e,t){var n;if(t!==!1)if(t===!0)for(e.tooltips=[],n=0;n<e.handles;n++)e.tooltips.push(!0);else{if(e.tooltips=u(t),e.tooltips.length!==e.handles)throw new Error("noUiSlider: must pass a formatter for all handles.");e.tooltips.forEach(function(e){if("boolean"!=typeof e&&("object"!==("undefined"==typeof e?"undefined":o(e))||"function"!=typeof e.to))throw new Error("noUiSlider: 'tooltips' must be passed a formatter or 'false'.")})}}function U(e,t){if(e.format=t,"function"==typeof t.to&&"function"==typeof t.from)return!0;throw new Error("noUiSlider: 'format' requires 'to' and 'from' methods.")}function H(e,t){if(void 0!==t&&"string"!=typeof t)throw new Error("noUiSlider: 'cssPrefix' must be a string.");e.cssPrefix=t}function V(e){var t,n={margin:0,limit:0,animate:!0,format:K};t={step:{r:!1,t:k},start:{r:!0,t:O},connect:{r:!0,t:A},direction:{r:!0,t:I},snap:{r:!1,t:R},animate:{r:!1,t:N},range:{r:!0,t:T},orientation:{r:!1,t:j},margin:{r:!1,t:M},limit:{r:!1,t:D},behaviour:{r:!0,t:F},format:{r:!1,t:U},tooltips:{r:!1,t:L},cssPrefix:{r:!1,t:H}};var r={connect:!1,direction:"ltr",behaviour:"tap",orientation:"horizontal"};return Object.keys(t).forEach(function(i){if(void 0===e[i]&&void 0===r[i]){if(t[i].r)throw new Error("noUiSlider: '"+i+"' is required.");return!0}t[i].t(n,void 0===e[i]?r[i]:e[i])}),n.pips=e.pips,n.style=n.ort?"top":"left",n}function q(t,r){function i(e,t,n){var r=e+t[0],i=e+t[1];return n?(0>r&&(i+=Math.abs(r)),i>100&&(r-=i-100),[s(r),s(i)]):[r,i]}function o(e,t){e.preventDefault();var n,r,i=0===e.type.indexOf("touch"),o=0===e.type.indexOf("mouse"),a=0===e.type.indexOf("pointer"),s=e;return 0===e.type.indexOf("MSPointer")&&(a=!0),i&&(n=e.changedTouches[0].pageX,r=e.changedTouches[0].pageY),t=t||d(),(o||a)&&(n=e.clientX+t.x,r=e.clientY+t.y),s.pageOffset=t,s.points=[n,r],s.cursor=o||a,s}function g(e,t){var n=document.createElement("div"),r=document.createElement("div"),i=["-lower","-upper"];return e&&i.reverse(),l(r,ie[3]),l(r,ie[3]+i[t]),l(n,ie[2]),n.appendChild(r),n}function y(e,t,n){switch(e){case 1:l(t,ie[7]),l(n[0],ie[6]);break;case 3:l(n[1],ie[6]);case 2:l(n[0],ie[7]);case 0:l(t,ie[6])}}function b(e,t,n){var r,i=[];for(r=0;e>r;r+=1)i.push(n.appendChild(g(t,r)));return i}function x(e,t,n){l(n,ie[0]),l(n,ie[8+e]),l(n,ie[4+t]);var r=document.createElement("div");return l(r,ie[1]),n.appendChild(r),r}function w(e,t){if(!r.tooltips[t])return!1;var n=document.createElement("div");return n.className=ie[18],e.firstChild.appendChild(n)}function _(){r.dir&&r.tooltips.reverse();var e=X.map(w);r.dir&&(e.reverse(),r.tooltips.reverse()),K("update",function(t,n,i){e[n]&&(e[n].innerHTML=r.tooltips[n]===!0?t[n]:r.tooltips[n].to(i[n]))})}function C(e,t,n){if("range"===e||"steps"===e)return te.xVal;if("count"===e){var r,i=100/(t-1),o=0;for(t=[];(r=o++*i)<=100;)t.push(r);e="positions"}return"positions"===e?t.map(function(e){return te.fromStepping(n?te.getStep(e):e)}):"values"===e?n?t.map(function(e){return te.fromStepping(te.getStep(te.toStepping(e)))}):t:void 0}function $(t,n,r){function i(e,t){return(e+t).toFixed(7)/1}var o=te.direction,a={},s=te.xVal[0],u=te.xVal[te.xVal.length-1],c=!1,l=!1,f=0;return te.direction=0,r=e(r.slice().sort(function(e,t){return e-t})),r[0]!==s&&(r.unshift(s),c=!0),r[r.length-1]!==u&&(r.push(u),l=!0),r.forEach(function(e,o){var s,u,p,d,h,m,v,g,y,b,x=e,w=r[o+1];if("steps"===n&&(s=te.xNumSteps[o]),s||(s=w-x),x!==!1&&void 0!==w)for(u=x;w>=u;u=i(u,s)){for(d=te.toStepping(u),h=d-f,g=h/t,y=Math.round(g),b=h/y,p=1;y>=p;p+=1)m=f+p*b,a[m.toFixed(5)]=["x",0];v=r.indexOf(u)>-1?1:"steps"===n?2:0,!o&&c&&(v=0),u===w&&l||(a[d.toFixed(5)]=[u,v]),f=d}}),te.direction=o,a}function S(e,t,n){function i(e){return["-normal","-large","-sub"][e]}function o(e,t,n){return'class="'+t+" "+t+"-"+s+" "+t+i(n[1])+'" style="'+r.style+": "+e+'%"'}function a(e,r){te.direction&&(e=100-e),r[1]=r[1]&&t?t(r[0],r[1]):r[1],c+="<div "+o(e,ie[21],r)+"></div>",r[1]&&(c+="<div "+o(e,ie[22],r)+">"+n.to(r[0])+"</div>")}var s=["horizontal","vertical"][r.ort],u=document.createElement("div"),c="";return l(u,ie[20]),l(u,ie[20]+"-"+s),Object.keys(e).forEach(function(t){a(t,e[t])}),u.innerHTML=c,u}function E(e){var t=e.mode,n=e.density||1,r=e.filter||!1,i=e.values||!1,o=e.stepped||!1,a=C(t,i,o),s=$(n,t,a),u=e.format||{to:Math.round};return Z.appendChild(S(s,r,u))}function P(){var e=Y.getBoundingClientRect(),t="offset"+["Width","Height"][r.ort];return 0===r.ort?e.width||Y[t]:e.height||Y[t]}function k(e,t,n){void 0!==t&&1!==r.handles&&(t=Math.abs(t-r.dir)),Object.keys(re).forEach(function(r){var i=r.split(".")[0];e===i&&re[r].forEach(function(e){e.call(J,u(H()),t,u(T(Array.prototype.slice.call(ne))),n||!1,ee)})})}function T(e){return 1===e.length?e[0]:r.dir?e.reverse():e}function O(e,t,n,i){var a=function(t){return Z.hasAttribute("disabled")?!1:p(Z,ie[14])?!1:(t=o(t,i.pageOffset),e===W.start&&void 0!==t.buttons&&t.buttons>1?!1:i.hover&&t.buttons?!1:(t.calcPoint=t.points[r.ort],void n(t,i)))},s=[];return e.split(" ").forEach(function(e){t.addEventListener(e,a,!1),s.push([e,a])}),s}function R(e,t){if(-1===navigator.appVersion.indexOf("MSIE 9")&&0===e.buttons&&0!==t.buttonsProperty)return N(e,t);var n,r,o=t.handles||X,a=!1,s=100*(e.calcPoint-t.start)/t.baseSize,u=o[0]===X[0]?0:1;if(n=i(s,t.positions,o.length>1),a=F(o[0],n[u],1===o.length),o.length>1){if(a=F(o[1],n[u?0:1],!1)||a)for(r=0;r<t.handles.length;r++)k("slide",r)}else a&&k("slide",u)}function N(e,t){var n=Y.querySelector("."+ie[15]),r=t.handles[0]===X[0]?0:1;null!==n&&f(n,ie[15]),e.cursor&&(document.body.style.cursor="",document.body.removeEventListener("selectstart",document.body.noUiListener));var i=document.documentElement;i.noUiListeners.forEach(function(e){i.removeEventListener(e[0],e[1])}),f(Z,ie[12]),k("set",r),k("change",r),void 0!==t.handleNumber&&k("end",t.handleNumber)}function A(e,t){"mouseout"===e.type&&"HTML"===e.target.nodeName&&null===e.relatedTarget&&N(e,t)}function j(e,t){var n=document.documentElement;if(1===t.handles.length&&(l(t.handles[0].children[0],ie[15]),t.handles[0].hasAttribute("disabled")))return!1;e.preventDefault(),e.stopPropagation();var r=O(W.move,n,R,{start:e.calcPoint,baseSize:P(),pageOffset:e.pageOffset,handles:t.handles,handleNumber:t.handleNumber,buttonsProperty:e.buttons,positions:[ee[0],ee[X.length-1]]}),i=O(W.end,n,N,{handles:t.handles,handleNumber:t.handleNumber}),o=O("mouseout",n,A,{handles:t.handles,handleNumber:t.handleNumber});if(n.noUiListeners=r.concat(i,o),e.cursor){document.body.style.cursor=getComputedStyle(e.target).cursor,X.length>1&&l(Z,ie[12]);var a=function(){return!1};document.body.noUiListener=a,document.body.addEventListener("selectstart",a,!1)}void 0!==t.handleNumber&&k("start",t.handleNumber)}function M(e){var t,i,o=e.calcPoint,s=0;return e.stopPropagation(),X.forEach(function(e){s+=n(e)[r.style]}),t=s/2>o||1===X.length?0:1,X[t].hasAttribute("disabled")&&(t=t?0:1),o-=n(Y)[r.style],i=100*o/P(),r.events.snap||a(Z,ie[14],300),X[t].hasAttribute("disabled")?!1:(F(X[t],i),k("slide",t,!0),k("set",t,!0),k("change",t,!0),void(r.events.snap&&j(e,{handles:[X[t]]})))}function D(e){var t=e.calcPoint-n(Y)[r.style],i=te.getStep(100*t/P()),o=te.fromStepping(i);Object.keys(re).forEach(function(e){"hover"===e.split(".")[0]&&re[e].forEach(function(e){e.call(J,o)})})}function I(e){var t,n;if(!e.fixed)for(t=0;t<X.length;t+=1)O(W.start,X[t].children[0],j,{handles:[X[t]],handleNumber:t});if(e.tap&&O(W.start,Y,M,{handles:X}),e.hover)for(O(W.move,Y,D,{hover:!0}),t=0;t<X.length;t+=1)["mousemove MSPointerMove pointermove"].forEach(function(e){X[t].children[0].addEventListener(e,h,!1)});e.drag&&(n=[Y.querySelector("."+ie[7])],l(n[0],ie[10]),e.fixed&&n.push(X[n[0]===X[0]?1:0].children[0]),n.forEach(function(e){O(W.start,e,j,{handles:X})}))}function F(e,t,n){var i=e!==X[0]?1:0,o=ee[0]+r.margin,a=ee[1]-r.margin,u=ee[0]+r.limit,c=ee[1]-r.limit;return X.length>1&&(t=i?Math.max(t,o):Math.min(t,a)),n!==!1&&r.limit&&X.length>1&&(t=i?Math.min(t,u):Math.max(t,c)),t=te.getStep(t),t=s(parseFloat(t.toFixed(7))),t===ee[i]?!1:(window.requestAnimationFrame?window.requestAnimationFrame(function(){e.style[r.style]=t+"%"}):e.style[r.style]=t+"%",e.previousSibling||(f(e,ie[17]),t>50&&l(e,ie[17])),ee[i]=t,ne[i]=te.fromStepping(t),k("update",i),!0)}function L(e,t){var n,i,o;for(r.limit&&(e+=1),n=0;e>n;n+=1)i=n%2,o=t[i],null!==o&&o!==!1&&("number"==typeof o&&(o=String(o)),o=r.format.from(o),(o===!1||isNaN(o)||F(X[i],te.toStepping(o),n===3-r.dir)===!1)&&k("update",i))}function U(e){var t,n,i=u(e);for(r.dir&&r.handles>1&&i.reverse(),r.animate&&-1!==ee[0]&&a(Z,ie[14],300),t=X.length>1?3:1,1===i.length&&(t=1),L(t,i),n=0;n<X.length;n++)null!==i[n]&&k("set",n)}function H(){var e,t=[];for(e=0;e<r.handles;e+=1)t[e]=r.format.to(ne[e]);return T(t)}function q(){for(ie.forEach(function(e){e&&f(Z,e)});Z.firstChild;)Z.removeChild(Z.firstChild);delete Z.noUiSlider}function B(){var e=ee.map(function(e,t){var n=te.getApplicableStep(e),r=c(String(n[2])),i=ne[t],o=100===e?null:n[2],a=Number((i-n[2]).toFixed(r)),s=0===e?null:a>=n[1]?n[2]:n[0]||!1;return[s,o]});return T(e)}function K(e,t){re[e]=re[e]||[],re[e].push(t),"update"===e.split(".")[0]&&X.forEach(function(e,t){k("update",t)})}function Q(e){var t=e.split(".")[0],n=e.substring(t.length);Object.keys(re).forEach(function(e){var r=e.split(".")[0],i=e.substring(r.length);t&&t!==r||n&&n!==i||delete re[e]})}function G(e){var t,n=H(),i=V({start:[0,0],margin:e.margin,limit:e.limit,step:e.step,range:e.range,animate:e.animate,snap:void 0===e.snap?r.snap:e.snap});for(["margin","limit","step","range","animate"].forEach(function(t){void 0!==e[t]&&(r[t]=e[t])}),i.spectrum.direction=te.direction,te=i.spectrum,ee=[-1,-1],U(n),t=0;t<X.length;t++)k("update",t)}v();var Y,X,J,Z=t,ee=[-1,-1],te=r.spectrum,ne=[],re={},ie=["target","base","origin","handle","horizontal","vertical","background","connect","ltr","rtl","draggable","","state-drag","","state-tap","active","","stacking","tooltip","","pips","marker","value"].map(m(r.cssPrefix||z));if(Z.noUiSlider)throw new Error("Slider was already initialized.");return Y=x(r.dir,r.ort,Z),X=b(r.handles,r.dir,Y),y(r.connect,Z,X),r.pips&&E(r.pips),r.tooltips&&_(),J={destroy:q,steps:B,on:K,off:Q,get:H,set:U,updateOptions:G,options:r,target:Z,pips:E},I(r.events),J}function B(e,t){if(!e.nodeName)throw new Error("noUiSlider.create requires a single element.");var n=V(t,e),r=q(e,n);return r.set(n.start),e.noUiSlider=r,r}var W,z="noUi-";P.prototype.getMargin=function(e){return 2===this.xPct.length?y(this.xVal,e):!1},P.prototype.toStepping=function(e){return e=_(this.xVal,this.xPct,e),this.direction&&(e=100-e),e},P.prototype.fromStepping=function(e){return this.direction&&(e=100-e),i(C(this.xVal,this.xPct,e))},P.prototype.getStep=function(e){return this.direction&&(e=100-e),e=$(this.xPct,this.xSteps,this.snap,e),this.direction&&(e=100-e),e},P.prototype.getApplicableStep=function(e){var t=w(e,this.xPct),n=100===e?2:1;return[this.xNumSteps[t-2],this.xVal[t-n],this.xNumSteps[t-n]]},P.prototype.convert=function(e){return this.getStep(this.toStepping(e))};var K={to:function(e){return void 0!==e&&e.toFixed(2)},from:Number};return{create:B}})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.indices,r=e.cssClasses,i=void 0===r?{}:r,a=e.autoHideContainer,s=void 0===a?!1:a;if(!t||!n)throw new Error(w);var c=d.getContainerNode(t),f=b["default"];s===!0&&(f=g["default"](f));var h=p["default"](n,function(e){return{label:e.label,value:e.name}}),v={root:m["default"](x(null),i.root),item:m["default"](x("item"),i.item)};return{init:function(e){var t=e.helper,r=t.getIndex(),i=-1!==l["default"](n,{name:r});if(!i)throw new Error("[sortBySelector]: Index "+r+" not present in `indices`");this.setIndex=function(e){return t.setIndex(e).search()}},render:function(e){var t=e.helper,n=e.results;u["default"].render(o(f,{cssClasses:v,currentValue:t.getIndex(),options:h,setValue:this.setIndex,shouldAutoHideContainer:0===n.nbHits}),c)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),a=n(350),s=(r(a),n(502)),u=r(s),c=n(632),l=r(c),f=n(576),p=r(f),d=n(503),h=n(534),m=r(h),v=n(536),g=r(v),y=n(595),b=r(y),x=d.bemHelper("ais-sort-by-selector"),w="Usage:\nsortBySelector({\n container,\n indices,\n [cssClasses.{root,item}={}],\n [autoHideContainer=false]\n})";t["default"]=i},function(e,t,n){"use strict";var r=n(633),i=r();e.exports=i},function(e,t,n){"use strict";function r(e){return function(t,n,r){return t&&t.length?(n=i(n,r,3),o(t,n,e)):-1}}var i=n(507),o=n(526);e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=e.container,n=e.attributeName,r=e.max,i=void 0===r?5:r,a=e.cssClasses,s=void 0===a?{}:a,l=e.labels,p=void 0===l?b["default"]:l,h=e.templates,v=void 0===h?g["default"]:h,y=e.collapsible,x=void 0===y?!1:y,$=e.transformData,S=e.autoHideContainer,E=void 0===S?!0:S,P=c.getContainerNode(t),k=m["default"](w["default"]);if(E===!0&&(k=d["default"](k)),!t||!n)throw new Error(C);var T={root:f["default"](_(null),s.root),header:f["default"](_("header"),s.header),body:f["default"](_("body"),s.body),footer:f["default"](_("footer"),s.footer),list:f["default"](_("list"),s.list),item:f["default"](_("item"),s.item),link:f["default"](_("link"),s.link),disabledLink:f["default"](_("link","disabled"),s.disabledLink),count:f["default"](_("count"),s.count),star:f["default"](_("star"),s.star),emptyStar:f["default"](_("star","empty"),s.emptyStar),active:f["default"](_("item","active"),s.active)};return{getConfiguration:function(){return{disjunctiveFacets:[n]}},init:function(e){var t=e.templatesConfig,n=e.helper;this._templateProps=c.prepareTemplateProps({transformData:$,defaultTemplates:g["default"],templatesConfig:t,templates:v}),this._toggleRefinement=this._toggleRefinement.bind(this,n)},render:function(e){for(var t=e.helper,r=e.results,a=e.state,s=e.createURL,c=[],l={},f=i-1;f>=0;--f)l[f]=0;r.getFacetValues(n).forEach(function(e){var t=Math.round(e.name);if(t&&!(t>i-1))for(var n=t;n>=1;--n)l[n]+=e.count});for(var d=this._getRefinedStar(t),h=i-1;h>=1;--h){var m=l[h];if(!d||h===d||0!==m){for(var v=[],g=1;i>=g;++g)v.push(h>=g);c.push({stars:v,name:""+h,count:m,isRefined:d===h,url:s(a.toggleRefinement(n,v)),labels:p})}}u["default"].render(o(k,{collapsible:x,cssClasses:T,facetValues:c,shouldAutoHideContainer:0===r.nbHits,templateProps:this._templateProps,toggleRefinement:this._toggleRefinement}),P)},_toggleRefinement:function(e,t){var r=this._getRefinedStar(e)===+t;if(e.clearRefinements(n),!r)for(var o=+t;i>=o;++o)e.addDisjunctiveFacetRefinement(n,o);e.search()},_getRefinedStar:function(e){var t=void 0,r=e.getRefinements(n);return r.forEach(function(e){(!t||+e.value<t)&&(t=+e.value)}),t}}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),a=n(350),s=(r(a),n(502)),u=r(s),c=n(503),l=n(534),f=r(l),p=n(536),d=r(p),h=n(537),m=r(h),v=n(635),g=r(v),y=n(636),b=r(y),x=n(586),w=r(x),_=c.bemHelper("ais-star-rating"),C="Usage:\nstarRating({\n container,\n attributeName,\n [ max=5 ],\n [ cssClasses.{root,header,body,footer,list,item,active,link,disabledLink,star,emptyStar,count} ],\n [ templates.{header,item,footer} ],\n [ labels.{andUp} ],\n [ transformData ],\n [ autoHideContainer=true ],\n [ collapsible=false ]\n})";t["default"]=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={header:"",item:'<a class="{{cssClasses.link}}{{^count}} {{cssClasses.disabledLink}}{{/count}}" {{#count}}href="{{href}}"{{/count}}>\n {{#stars}}<span class="{{#.}}{{cssClasses.star}}{{/.}}{{^.}}{{cssClasses.emptyStar}}{{/.}}"></span>{{/stars}}\n {{labels.andUp}}\n {{#count}}<span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span>{{/count}}\n</a>',footer:""}},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={andUp:"& Up"}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.cssClasses,r=void 0===n?{}:n,i=e.autoHideContainer,a=void 0===i?!0:i,s=e.templates,l=void 0===s?b["default"]:s,p=e.collapsible,h=void 0===p?!1:p,v=e.transformData;if(!t)throw new Error(w);var y=c.getContainerNode(t),_=d["default"](m["default"]);if(a===!0&&(_=f["default"](_)),!y)throw new Error(w);var C={body:g["default"](x("body"),r.body),footer:g["default"](x("footer"),r.footer),header:g["default"](x("header"),r.header),root:g["default"](x(null),r.root),time:g["default"](x("time"),r.time)};return{init:function(e){var t=e.templatesConfig;this._templateProps=c.prepareTemplateProps({transformData:v,defaultTemplates:b["default"],templatesConfig:t,templates:l})},render:function(e){var t=e.results;u["default"].render(o(_,{collapsible:h,cssClasses:C,hitsPerPage:t.hitsPerPage,nbHits:t.nbHits,nbPages:t.nbPages,page:t.page,processingTimeMS:t.processingTimeMS,query:t.query,shouldAutoHideContainer:0===t.nbHits,templateProps:this._templateProps}),y)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),a=n(350),s=(r(a),n(502)),u=r(s),c=n(503),l=n(536),f=r(l),p=n(537),d=r(p),h=n(638),m=r(h),v=n(534),g=r(v),y=n(639),b=r(y),x=c.bemHelper("ais-stats"),w="Usage:\nstats({\n container,\n [ template ],\n [ transformData ],\n [ autoHideContainer]\n})";t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=n(350),l=r(c),f=n(538),p=r(f),d=function(e){function t(){return i(this,t),o(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),u(t,[{key:"shouldComponentUpdate",value:function(e){return this.props.nbHits!==e.hits||this.props.processingTimeMS!==e.processingTimeMS}},{key:"render",value:function(){var e={hasManyResults:this.props.nbHits>1,hasNoResults:0===this.props.nbHits,hasOneResult:1===this.props.nbHits,hitsPerPage:this.props.hitsPerPage,nbHits:this.props.nbHits,nbPages:this.props.nbPages,page:this.props.page,processingTimeMS:this.props.processingTimeMS,query:this.props.query,cssClasses:this.props.cssClasses};return l["default"].createElement(p["default"],s({data:e,templateKey:"body"},this.props.templateProps))}}]),t}(l["default"].Component);t["default"]=d},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={header:"",body:'{{#hasNoResults}}No results{{/hasNoResults}}\n {{#hasOneResult}}1 result{{/hasOneResult}}\n {{#hasManyResults}}{{#helpers.formatNumber}}{{nbHits}}{{/helpers.formatNumber}} results{{/hasManyResults}}\n <span class="{{cssClasses.time}}">found in {{processingTimeMS}}ms</span>',footer:""}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function i(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.container,n=e.attributeName,r=e.label,i=e.values,a=void 0===i?{on:!0,off:void 0}:i,u=e.templates,c=void 0===u?b["default"]:u,p=e.collapsible,h=void 0===p?!1:p,v=e.cssClasses,y=void 0===v?{}:v,x=e.transformData,$=e.autoHideContainer,S=void 0===$?!0:$,E=f.getContainerNode(t),P=g["default"](w["default"]);if(S===!0&&(P=m["default"](P)),!t||!n||!r)throw new Error(C);var k=void 0!==a.off,T={root:d["default"](_(null),y.root),header:d["default"](_("header"),y.header),body:d["default"](_("body"),y.body),footer:d["default"](_("footer"),y.footer),list:d["default"](_("list"),y.list),item:d["default"](_("item"),y.item),active:d["default"](_("item","active"),y.active),label:d["default"](_("label"),y.label),checkbox:d["default"](_("checkbox"),y.checkbox),count:d["default"](_("count"),y.count)};return{getConfiguration:function(){return{facets:[n]}},init:function(e){var t=e.state,r=e.helper,i=e.templatesConfig;if(this._templateProps=f.prepareTemplateProps({transformData:x,
27
- defaultTemplates:b["default"],templatesConfig:i,templates:c}),this.toggleRefinement=this.toggleRefinement.bind(this,r),void 0!==a.off){var o=t.isFacetRefined(n,a.on);o||r.addFacetRefinement(n,a.off)}},toggleRefinement:function(e,t,r){var i=a.on,o=a.off;r?(e.removeFacetRefinement(n,i),k&&e.addFacetRefinement(n,o)):(k&&e.removeFacetRefinement(n,o),e.addFacetRefinement(n,i)),e.search()},render:function(e){var t=e.helper,i=e.results,u=e.state,c=e.createURL,f=t.state.isFacetRefined(n,a.on),p=s["default"](i.getFacetValues(n),{name:f.toString()}),d={name:r,isRefined:f,count:p&&p.count||null,url:c(u.toggleRefinement(n,f))};l["default"].render(o(P,{collapsible:h,cssClasses:T,facetValues:[d],shouldAutoHideContainer:0===i.nbHits,templateProps:this._templateProps,toggleRefinement:this.toggleRefinement}),E)}}}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){var e="function"==typeof Symbol&&Symbol["for"]&&Symbol["for"]("react.element")||60103;return function(t,n,r,i){var o=t&&t.defaultProps,a=arguments.length-3;if(n||0===a||(n={}),n&&o)for(var s in o)void 0===n[s]&&(n[s]=o[s]);else n||(n=o||{});if(1===a)n.children=i;else if(a>1){for(var u=Array(a),c=0;a>c;c++)u[c]=arguments[c+3];n.children=u}return{$$typeof:e,type:t,key:void 0===r?null:""+r,ref:null,props:n,_owner:null}}}(),a=n(523),s=r(a),u=n(350),c=(r(u),n(502)),l=r(c),f=n(503),p=n(534),d=r(p),h=n(536),m=r(h),v=n(537),g=r(v),y=n(641),b=r(y),x=n(586),w=r(x),_=f.bemHelper("ais-toggle"),C="Usage:\ntoggle({\n container,\n attributeName,\n label,\n [ userValues={on: true, off: undefined} ],\n [ cssClasses.{root,header,body,footer,list,item,active,label,checkbox,count} ],\n [ templates.{header,item,footer} ],\n [ transformData ],\n [ autoHideContainer=true ],\n [ collapsible=false ]\n})";t["default"]=i},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={header:"",item:'<label class="{{cssClasses.label}}">\n <input type="checkbox" class="{{cssClasses.checkbox}}" value="{{name}}" {{#isRefined}}checked{{/isRefined}} />{{name}}\n <span class="{{cssClasses.count}}">{{#helpers.formatNumber}}{{count}}{{/helpers.formatNumber}}</span>\n</label>',footer:""}},function(e,t,n){"use strict";e.exports=n(643)},function(e,t,n){"use strict";var r=n(644),i=n(1);r.element=i;var o=n(645);o.isArray=i.isArray,o.isFunction=i.isFunction,o.isObject=i.isPlainObject,o.bind=i.proxy,o.each=function(e,t){function n(e,n){return t(n,e)}i.each(e,n)},o.map=i.map,o.mixin=i.extend;var a,s,u,c=n(646),l=n(647);a=i.fn.autocomplete,s="aaAutocomplete",u={initialize:function(e,t){function n(){var n,r=i(this),o=new l({el:r});n=new c({input:r,eventBus:o,dropdownMenuContainer:e.dropdownMenuContainer,hint:void 0===e.hint?!0:!!e.hint,minLength:e.minLength,autoselect:e.autoselect,openOnFocus:e.openOnFocus,templates:e.templates,debug:e.debug,datasets:t}),r.data(s,n)}return t=o.isArray(t)?t:[].slice.call(arguments,1),e=e||{},this.each(n)},open:function(){function e(){var e,t=i(this);(e=t.data(s))&&e.open()}return this.each(e)},close:function(){function e(){var e,t=i(this);(e=t.data(s))&&e.close()}return this.each(e)},val:function(e){function t(){var t,n=i(this);(t=n.data(s))&&t.setVal(e)}function n(e){var t,n;return(t=e.data(s))&&(n=t.getVal()),n}return arguments.length?this.each(t):n(this.first())},destroy:function(){function e(){var e,t=i(this);(e=t.data(s))&&(e.destroy(),t.removeData(s))}return this.each(e)}},i.fn.autocomplete=function(e){var t;return u[e]&&"initialize"!==e?(t=this.filter(function(){return!!i(this).data(s)}),u[e].apply(t,[].slice.call(arguments,1))):u.initialize.apply(this,arguments)},i.fn.autocomplete.noConflict=function(){return i.fn.autocomplete=a,this},i.fn.autocomplete.sources=c.sources,e.exports=i.fn.autocomplete},function(e){"use strict";e.exports={element:null}},function(e,t,n){"use strict";var r=n(644);e.exports={isArray:null,isFunction:null,isObject:null,bind:null,each:null,map:null,mixin:null,isMsie:function(){return/(msie|trident)/i.test(navigator.userAgent)?navigator.userAgent.match(/(msie |rv:)(\d+(.\d+)?)/i)[2]:!1},escapeRegExChars:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},isNumber:function(e){return"number"==typeof e},toStr:function(e){return void 0===e||null===e?"":e+""},cloneDeep:function(e){var t=this.mixin({},e),n=this;return this.each(t,function(e,r){e&&(n.isArray(e)?t[r]=[].concat(e):n.isObject(e)&&(t[r]=n.cloneDeep(e)))}),t},error:function(e){throw new Error(e)},every:function(e,t){var n=!0;return e?(this.each(e,function(r,i){return n=t.call(null,r,i,e),n?void 0:!1}),!!n):n},getUniqueId:function(){var e=0;return function(){return e++}}(),templatify:function(e){if(this.isFunction(e))return e;var t=r.element(e);return"SCRIPT"===t.prop("tagName")?function(){return t.text()}:function(){return String(e)}},defer:function(e){setTimeout(e,0)},noop:function(){}}},function(e,t,n){"use strict";function r(e){var t,n,o;e=e||{},e.input||u.error("missing input"),this.isActivated=!1,this.debug=!!e.debug,this.autoselect=!!e.autoselect,this.openOnFocus=!!e.openOnFocus,this.minLength=u.isNumber(e.minLength)?e.minLength:1,this.$node=i(e),t=this.$node.find(".aa-dropdown-menu"),n=this.$node.find(".aa-input"),o=this.$node.find(".aa-hint"),e.dropdownMenuContainer&&c.element(e.dropdownMenuContainer).css("position","relative").append(t.css("top","0")),n.on("blur.aa",function(e){var r=document.activeElement;u.isMsie()&&(t.is(r)||t.has(r).length>0)&&(e.preventDefault(),e.stopImmediatePropagation(),u.defer(function(){n.focus()}))}),t.on("mousedown.aa",function(e){e.preventDefault()}),this.eventBus=e.eventBus||new l({el:n}),this.dropdown=new r.Dropdown({menu:t,datasets:e.datasets,templates:e.templates}).onSync("suggestionClicked",this._onSuggestionClicked,this).onSync("cursorMoved",this._onCursorMoved,this).onSync("cursorRemoved",this._onCursorRemoved,this).onSync("opened",this._onOpened,this).onSync("closed",this._onClosed,this).onAsync("datasetRendered",this._onDatasetRendered,this),this.input=new r.Input({input:n,hint:o}).onSync("focused",this._onFocused,this).onSync("blurred",this._onBlurred,this).onSync("enterKeyed",this._onEnterKeyed,this).onSync("tabKeyed",this._onTabKeyed,this).onSync("escKeyed",this._onEscKeyed,this).onSync("upKeyed",this._onUpKeyed,this).onSync("downKeyed",this._onDownKeyed,this).onSync("leftKeyed",this._onLeftKeyed,this).onSync("rightKeyed",this._onRightKeyed,this).onSync("queryChanged",this._onQueryChanged,this).onSync("whitespaceChanged",this._onWhitespaceChanged,this),this._setLanguageDirection()}function i(e){var t,n,r,i;t=c.element(e.input),n=c.element(d.wrapper).css(h.wrapper),"block"===t.css("display")&&"table"===t.parent().css("display")&&n.css("display","table-cell"),r=c.element(d.dropdown).css(h.dropdown),e.templates&&e.templates.dropdownMenu&&r.html(u.templatify(e.templates.dropdownMenu)()),i=t.clone().css(h.hint).css(o(t)),i.val("").addClass("aa-hint").removeAttr("id name placeholder required").prop("readonly",!0).attr({autocomplete:"off",spellcheck:"false",tabindex:-1}),i.removeData&&i.removeData(),t.data(s,{dir:t.attr("dir"),autocomplete:t.attr("autocomplete"),spellcheck:t.attr("spellcheck"),style:t.attr("style")}),t.addClass("aa-input").attr({autocomplete:"off",spellcheck:!1}).css(e.hint?h.input:h.inputWithNoHint);try{t.attr("dir")||t.attr("dir","auto")}catch(a){}return t.wrap(n).parent().prepend(e.hint?i:null).append(r)}function o(e){return{backgroundAttachment:e.css("background-attachment"),backgroundClip:e.css("background-clip"),backgroundColor:e.css("background-color"),backgroundImage:e.css("background-image"),backgroundOrigin:e.css("background-origin"),backgroundPosition:e.css("background-position"),backgroundRepeat:e.css("background-repeat"),backgroundSize:e.css("background-size")}}function a(e){var t=e.find(".aa-input");u.each(t.data(s),function(e,n){void 0===e?t.removeAttr(n):t.attr(n,e)}),t.detach().removeClass("aa-input").insertAfter(e),t.removeData&&t.removeData(s),e.remove()}var s="aaAttrs",u=n(645),c=n(644),l=n(647),f=n(648),p=n(651),d=n(653),h=n(654);u.mixin(r.prototype,{_onSuggestionClicked:function(e,t){var n;(n=this.dropdown.getDatumForSuggestion(t))&&this._select(n)},_onCursorMoved:function(){var e=this.dropdown.getDatumForCursor();this.input.setInputValue(e.value,!0),this.eventBus.trigger("cursorchanged",e.raw,e.datasetName)},_onCursorRemoved:function(){this.input.resetInputValue(),this._updateHint()},_onDatasetRendered:function(){this._updateHint(),this.eventBus.trigger("updated")},_onOpened:function(){this._updateHint(),this.eventBus.trigger("opened")},_onClosed:function(){this.input.clearHint(),this.eventBus.trigger("closed")},_onFocused:function(){if(this.isActivated=!0,this.openOnFocus){var e=this.input.getQuery();e.length>=this.minLength?this.dropdown.update(e):this.dropdown.empty(),this.dropdown.open()}},_onBlurred:function(){this.debug||(this.isActivated=!1,this.dropdown.empty(),this.dropdown.close())},_onEnterKeyed:function(e,t){var n,r;n=this.dropdown.getDatumForCursor(),r=this.dropdown.getDatumForTopSuggestion(),n?(this._select(n),t.preventDefault()):this.autoselect&&r&&(this._select(r),t.preventDefault())},_onTabKeyed:function(e,t){var n;(n=this.dropdown.getDatumForCursor())?(this._select(n),t.preventDefault()):this._autocomplete(!0)},_onEscKeyed:function(){this.dropdown.close(),this.input.resetInputValue()},_onUpKeyed:function(){var e=this.input.getQuery();this.dropdown.isEmpty&&e.length>=this.minLength?this.dropdown.update(e):this.dropdown.moveCursorUp(),this.dropdown.open()},_onDownKeyed:function(){var e=this.input.getQuery();this.dropdown.isEmpty&&e.length>=this.minLength?this.dropdown.update(e):this.dropdown.moveCursorDown(),this.dropdown.open()},_onLeftKeyed:function(){"rtl"===this.dir&&this._autocomplete()},_onRightKeyed:function(){"ltr"===this.dir&&this._autocomplete()},_onQueryChanged:function(e,t){this.input.clearHintIfInvalid(),t.length>=this.minLength?this.dropdown.update(t):this.dropdown.empty(),this.dropdown.open(),this._setLanguageDirection()},_onWhitespaceChanged:function(){this._updateHint(),this.dropdown.open()},_setLanguageDirection:function(){var e=this.input.getLanguageDirection();this.dir!==e&&(this.dir=e,this.$node.css("direction",e),this.dropdown.setLanguageDirection(e))},_updateHint:function(){var e,t,n,r,i,o;e=this.dropdown.getDatumForTopSuggestion(),e&&this.dropdown.isVisible()&&!this.input.hasOverflow()?(t=this.input.getInputValue(),n=f.normalizeQuery(t),r=u.escapeRegExChars(n),i=new RegExp("^(?:"+r+")(.+$)","i"),o=i.exec(e.value),o?this.input.setHint(t+o[1]):this.input.clearHint()):this.input.clearHint()},_autocomplete:function(e){var t,n,r,i;t=this.input.getHint(),n=this.input.getQuery(),r=e||this.input.isCursorAtEnd(),t&&n!==t&&r&&(i=this.dropdown.getDatumForTopSuggestion(),i&&this.input.setInputValue(i.value),this.eventBus.trigger("autocompleted",i.raw,i.datasetName))},_select:function(e){"undefined"!=typeof e.value&&this.input.setQuery(e.value),this.input.setInputValue(e.value,!0),this._setLanguageDirection(),this.eventBus.trigger("selected",e.raw,e.datasetName),this.dropdown.close(),u.defer(u.bind(this.dropdown.empty,this.dropdown))},open:function(){if(!this.isActivated){var e=this.input.getInputValue();e.length>=this.minLength?this.dropdown.update(e):this.dropdown.empty()}this.dropdown.open()},close:function(){this.dropdown.close()},setVal:function(e){e=u.toStr(e),this.isActivated?this.input.setInputValue(e):(this.input.setQuery(e),this.input.setInputValue(e,!0)),this._setLanguageDirection()},getVal:function(){return this.input.getQuery()},destroy:function(){this.input.destroy(),this.dropdown.destroy(),a(this.$node),this.$node=null}}),r.Dropdown=p,r.Input=f,r.sources=n(655),e.exports=r},function(e,t,n){"use strict";function r(e){e&&e.el||o.error("EventBus initialized without el"),this.$el=a.element(e.el)}var i="autocomplete:",o=n(645),a=n(644);o.mixin(r.prototype,{trigger:function(e){var t=[].slice.call(arguments,1);this.$el.trigger(i+e,t)}}),e.exports=r},function(e,t,n){"use strict";function r(e){var t,n,r,o,a=this;e=e||{},e.input||u.error("input is missing"),t=u.bind(this._onBlur,this),n=u.bind(this._onFocus,this),r=u.bind(this._onKeydown,this),o=u.bind(this._onInput,this),this.$hint=c.element(e.hint),this.$input=c.element(e.input).on("blur.aa",t).on("focus.aa",n).on("keydown.aa",r),0===this.$hint.length&&(this.setHint=this.getHint=this.clearHint=this.clearHintIfInvalid=u.noop),u.isMsie()?this.$input.on("keydown.aa keypress.aa cut.aa paste.aa",function(e){s[e.which||e.keyCode]||u.defer(u.bind(a._onInput,a,e))}):this.$input.on("input.aa",o),this.query=this.$input.val(),this.$overflowHelper=i(this.$input)}function i(e){return c.element('<pre aria-hidden="true"></pre>').css({position:"absolute",visibility:"hidden",whiteSpace:"pre",fontFamily:e.css("font-family"),fontSize:e.css("font-size"),fontStyle:e.css("font-style"),fontVariant:e.css("font-variant"),fontWeight:e.css("font-weight"),wordSpacing:e.css("word-spacing"),letterSpacing:e.css("letter-spacing"),textIndent:e.css("text-indent"),textRendering:e.css("text-rendering"),textTransform:e.css("text-transform")}).insertAfter(e)}function o(e,t){return r.normalizeQuery(e)===r.normalizeQuery(t)}function a(e){return e.altKey||e.ctrlKey||e.metaKey||e.shiftKey}var s;s={9:"tab",27:"esc",37:"left",39:"right",13:"enter",38:"up",40:"down"};var u=n(645),c=n(644),l=n(649);r.normalizeQuery=function(e){return(e||"").replace(/^\s*/g,"").replace(/\s{2,}/g," ")},u.mixin(r.prototype,l,{_onBlur:function(){this.resetInputValue(),this.trigger("blurred")},_onFocus:function(){this.trigger("focused")},_onKeydown:function(e){var t=s[e.which||e.keyCode];this._managePreventDefault(t,e),t&&this._shouldTrigger(t,e)&&this.trigger(t+"Keyed",e)},_onInput:function(){this._checkInputValue()},_managePreventDefault:function(e,t){var n,r,i;switch(e){case"tab":r=this.getHint(),i=this.getInputValue(),n=r&&r!==i&&!a(t);break;case"up":case"down":n=!a(t);break;default:n=!1}n&&t.preventDefault()},_shouldTrigger:function(e,t){var n;switch(e){case"tab":n=!a(t);break;default:n=!0}return n},_checkInputValue:function(){var e,t,n;e=this.getInputValue(),t=o(e,this.query),n=t&&this.query?this.query.length!==e.length:!1,this.query=e,t?n&&this.trigger("whitespaceChanged",this.query):this.trigger("queryChanged",this.query)},focus:function(){this.$input.focus()},blur:function(){this.$input.blur()},getQuery:function(){return this.query},setQuery:function(e){this.query=e},getInputValue:function(){return this.$input.val()},setInputValue:function(e,t){"undefined"==typeof e&&(e=this.query),this.$input.val(e),t?this.clearHint():this._checkInputValue()},resetInputValue:function(){this.setInputValue(this.query,!0)},getHint:function(){return this.$hint.val()},setHint:function(e){this.$hint.val(e)},clearHint:function(){this.setHint("")},clearHintIfInvalid:function(){var e,t,n,r;e=this.getInputValue(),t=this.getHint(),n=e!==t&&0===t.indexOf(e),r=""!==e&&n&&!this.hasOverflow(),r||this.clearHint()},getLanguageDirection:function(){return(this.$input.css("direction")||"ltr").toLowerCase()},hasOverflow:function(){var e=this.$input.width()-2;return this.$overflowHelper.text(this.getInputValue()),this.$overflowHelper.width()>=e},isCursorAtEnd:function(){var e,t,n;return e=this.$input.val().length,t=this.$input[0].selectionStart,u.isNumber(t)?t===e:document.selection?(n=document.selection.createRange(),n.moveStart("character",-e),e===n.text.length):!0},destroy:function(){this.$hint.off(".aa"),this.$input.off(".aa"),this.$hint=this.$input=this.$overflowHelper=null}}),e.exports=r},function(e,t,n){(function(t){"use strict";function n(e,t,n,r){var i;if(!n)return this;for(t=t.split(l),n=r?c(n,r):n,this._callbacks=this._callbacks||{};i=t.shift();)this._callbacks[i]=this._callbacks[i]||{sync:[],async:[]},this._callbacks[i][e].push(n);return this}function r(e,t,r){return n.call(this,"async",e,t,r)}function i(e,t,r){return n.call(this,"sync",e,t,r)}function o(e){var t;if(!this._callbacks)return this;for(e=e.split(l);t=e.shift();)delete this._callbacks[t];return this}function a(e){var t,n,r,i,o;if(!this._callbacks)return this;for(e=e.split(l),r=[].slice.call(arguments,1);(t=e.shift())&&(n=this._callbacks[t]);)i=s(n.sync,this,[t].concat(r)),o=s(n.async,this,[t].concat(r)),i()&&f(o);return this}function s(e,t,n){function r(){for(var r,i=0,o=e.length;!r&&o>i;i+=1)r=e[i].apply(t,n)===!1;return!r}return r}function u(){var e;return e=window.setImmediate?function(e){t(function(){e()})}:function(e){setTimeout(function(){e()},0)}}function c(e,t){return e.bind?e.bind(t):function(){e.apply(t,[].slice.call(arguments,0))}}var l=/\s+/,f=u();e.exports={onSync:i,onAsync:r,off:o,trigger:a}}).call(t,n(650).setImmediate)},function(e,t,n){(function(e,r){function i(e,t){this._id=e,this._clearFn=t}var o=n(11).nextTick,a=Function.prototype.apply,s=Array.prototype.slice,u={},c=0;t.setTimeout=function(){return new i(a.call(setTimeout,window,arguments),clearTimeout)},t.setInterval=function(){return new i(a.call(setInterval,window,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(window,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},t.setImmediate="function"==typeof e?e:function(e){var n=c++,r=arguments.length<2?!1:s.call(arguments,1);return u[n]=!0,o(function(){u[n]&&(r?e.apply(null,r):e.call(null),t.clearImmediate(n))}),n},t.clearImmediate="function"==typeof r?r:function(e){delete u[e]}}).call(t,n(650).setImmediate,n(650).clearImmediate)},function(e,t,n){"use strict";function r(e){var t,n,r,s=this;e=e||{},e.menu||o.error("menu is required"),o.isArray(e.datasets)||o.isObject(e.datasets)||o.error("1 or more datasets required"),e.datasets||o.error("datasets is required"),this.isOpen=!1,this.isEmpty=!0,t=o.bind(this._onSuggestionClick,this),n=o.bind(this._onSuggestionMouseEnter,this),r=o.bind(this._onSuggestionMouseLeave,this),this.$menu=a.element(e.menu).on("click.aa",".aa-suggestion",t).on("mouseenter.aa",".aa-suggestion",n).on("mouseleave.aa",".aa-suggestion",r),e.templates&&e.templates.header&&this.$menu.prepend(o.templatify(e.templates.header)()),this.datasets=o.map(e.datasets,function(e){return i(s.$menu,e)}),o.each(this.datasets,function(e){var t=e.getRoot();t&&0===t.parent().length&&s.$menu.append(t),e.onSync("rendered",s._onRendered,s)}),e.templates&&e.templates.footer&&this.$menu.append(o.templatify(e.templates.footer)())}function i(e,t){return new r.Dataset(o.mixin({$menu:e},t))}var o=n(645),a=n(644),s=n(649),u=n(652),c=n(654);o.mixin(r.prototype,s,{_onSuggestionClick:function(e){this.trigger("suggestionClicked",a.element(e.currentTarget))},_onSuggestionMouseEnter:function(e){this._removeCursor(),this._setCursor(a.element(e.currentTarget),!0)},_onSuggestionMouseLeave:function(){this._removeCursor()},_onRendered:function(){function e(e){return e.isEmpty()}this.isEmpty=o.every(this.datasets,e),this.isEmpty?this._hide():this.isOpen&&this._show(),this.trigger("datasetRendered")},_hide:function(){this.$menu.hide()},_show:function(){this.$menu.css("display","block")},_getSuggestions:function(){return this.$menu.find(".aa-suggestion")},_getCursor:function(){return this.$menu.find(".aa-cursor").first()},_setCursor:function(e,t){e.first().addClass("aa-cursor"),t||this.trigger("cursorMoved")},_removeCursor:function(){this._getCursor().removeClass("aa-cursor")},_moveCursor:function(e){var t,n,r,i;if(this.isOpen){if(n=this._getCursor(),t=this._getSuggestions(),this._removeCursor(),r=t.index(n)+e,r=(r+1)%(t.length+1)-1,-1===r)return void this.trigger("cursorRemoved");-1>r&&(r=t.length-1),this._setCursor(i=t.eq(r)),this._ensureVisible(i)}},_ensureVisible:function(e){var t,n,r,i;t=e.position().top,n=t+e.height()+parseInt(e.css("margin-top"),10)+parseInt(e.css("margin-bottom"),10),r=this.$menu.scrollTop(),i=this.$menu.height()+parseInt(this.$menu.css("paddingTop"),10)+parseInt(this.$menu.css("paddingBottom"),10),0>t?this.$menu.scrollTop(r+t):n>i&&this.$menu.scrollTop(r+(n-i))},close:function(){this.isOpen&&(this.isOpen=!1,this._removeCursor(),this._hide(),this.trigger("closed"))},open:function(){this.isOpen||(this.isOpen=!0,this.isEmpty||this._show(),this.trigger("opened"))},setLanguageDirection:function(e){this.$menu.css("ltr"===e?c.ltr:c.rtl)},moveCursorUp:function(){this._moveCursor(-1)},moveCursorDown:function(){this._moveCursor(1)},getDatumForSuggestion:function(e){var t=null;return e.length&&(t={raw:u.extractDatum(e),value:u.extractValue(e),datasetName:u.extractDatasetName(e)}),t},getDatumForCursor:function(){return this.getDatumForSuggestion(this._getCursor().first())},getDatumForTopSuggestion:function(){return this.getDatumForSuggestion(this._getSuggestions().first())},update:function(e){function t(t){t.update(e)}o.each(this.datasets,t)},empty:function(){function e(e){e.clear()}o.each(this.datasets,e),this.isEmpty=!0},isVisible:function(){return this.isOpen&&!this.isEmpty},destroy:function(){function e(e){e.destroy()}this.$menu.off(".aa"),this.$menu=null,o.each(this.datasets,e)}}),r.Dataset=u,e.exports=r},function(e,t,n){"use strict";function r(e){e=e||{},e.templates=e.templates||{},e.source||l.error("missing source"),e.name&&!a(e.name)&&l.error("invalid dataset name: "+e.name),this.query=null,this.highlight=!!e.highlight,this.name="undefined"==typeof e.name||null===e.name?l.getUniqueId():e.name,this.source=e.source,this.displayFn=i(e.display||e.displayKey),this.templates=o(e.templates,this.displayFn),this.$el=f.element(e.$menu&&e.$menu.find(".aa-dataset-"+this.name).length>0?e.$menu.find(".aa-dataset-"+this.name)[0]:p.dataset.replace("%CLASS%",this.name)),this.$menu=e.$menu}function i(e){function t(t){return t[e]}return e=e||"value",l.isFunction(e)?e:t}function o(e,t){function n(e){return"<p>"+t(e)+"</p>"}return{empty:e.empty&&l.templatify(e.empty),header:e.header&&l.templatify(e.header),footer:e.footer&&l.templatify(e.footer),suggestion:e.suggestion||n}}function a(e){return/^[_a-zA-Z0-9-]+$/.test(e)}var s="aaDataset",u="aaValue",c="aaDatum",l=n(645),f=n(644),p=n(653),d=n(654),h=n(649);r.extractDatasetName=function(e){return f.element(e).data(s)},r.extractValue=function(e){return f.element(e).data(u)},r.extractDatum=function(e){var t=f.element(e).data(c);return"string"==typeof t&&(t=JSON.parse(t)),t},l.mixin(r.prototype,h,{_render:function(e,t){function n(){var t=[].slice.call(arguments,0);return t=[{query:e,isEmpty:!0}].concat(t),h.templates.empty.apply(this,t)}function r(){function e(e){var t;return t=f.element(p.suggestion).append(h.templates.suggestion.apply(this,[e].concat(i))),t.data(s,h.name),t.data(u,h.displayFn(e)||void 0),t.data(c,JSON.stringify(e)),t.children().each(function(){f.element(this).css(d.suggestionChild)}),t}var n,r,i=[].slice.call(arguments,0);return n=f.element(p.suggestions).css(d.suggestions),r=l.map(t,e),n.append.apply(n,r),n}function i(){var t=[].slice.call(arguments,0);return t=[{query:e,isEmpty:!a}].concat(t),h.templates.header.apply(this,t)}function o(){var t=[].slice.call(arguments,0);return t=[{query:e,isEmpty:!a}].concat(t),h.templates.footer.apply(this,t)}if(this.$el){var a,h=this,m=[].slice.call(arguments,2);this.$el.empty(),a=t&&t.length,!a&&this.templates.empty?this.$el.html(n.apply(this,m)).prepend(h.templates.header?i.apply(this,m):null).append(h.templates.footer?o.apply(this,m):null):a&&this.$el.html(r.apply(this,m)).prepend(h.templates.header?i.apply(this,m):null).append(h.templates.footer?o.apply(this,m):null),this.$menu&&this.$menu.addClass("aa-"+(a?"with":"without")+"-"+this.name).removeClass("aa-"+(a?"without":"with")+"-"+this.name),this.trigger("rendered")}},getRoot:function(){return this.$el},update:function(e){function t(t){if(!n.canceled&&e===n.query){var r=[].slice.call(arguments,1);r=[e,t].concat(r),n._render.apply(n,r)}}var n=this;this.query=e,this.canceled=!1,this.source(e,t)},cancel:function(){this.canceled=!0},clear:function(){this.cancel(),this.$el.empty(),this.trigger("rendered")},isEmpty:function(){return this.$el.is(":empty")},destroy:function(){this.$el=null}}),e.exports=r},function(e){"use strict";e.exports={wrapper:'<span class="algolia-autocomplete"></span>',dropdown:'<span class="aa-dropdown-menu"></span>',dataset:'<div class="aa-dataset-%CLASS%"></div>',suggestions:'<span class="aa-suggestions"></span>',suggestion:'<div class="aa-suggestion"></div>'}},function(e,t,n){"use strict";var r=n(645),i={wrapper:{position:"relative",display:"inline-block"},hint:{position:"absolute",top:"0",left:"0",borderColor:"transparent",boxShadow:"none",opacity:"1"},input:{position:"relative",verticalAlign:"top",backgroundColor:"transparent"},inputWithNoHint:{position:"relative",verticalAlign:"top"},dropdown:{position:"absolute",top:"100%",left:"0",zIndex:"100",display:"none"},suggestions:{display:"block"},suggestion:{whiteSpace:"nowrap",cursor:"pointer"},suggestionChild:{whiteSpace:"normal"},ltr:{left:"0",right:"auto"},rtl:{left:"auto",right:"0"}};r.isMsie()&&r.mixin(i.input,{backgroundImage:"url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)"}),r.isMsie()&&r.isMsie()<=7&&r.mixin(i.input,{marginTop:"-1px"}),e.exports=i},function(e,t,n){"use strict";e.exports={hits:n(656),popularIn:n(657)}},function(e,t,n){"use strict";var r=n(645);e.exports=function(e,t){function n(n,i){e.search(n,t,function(e,t){return e?void r.error(e.message):void i(t.hits,t)})}return n}},function(e,t,n){"use strict";var r=n(645);e.exports=function(e,t,n,i){function o(o,u){e.search(o,t,function(e,t){if(e)return void r.error(e.message);if(t.hits.length>0){var o=t.hits[0],c=r.mixin({hitsPerPage:0},n);return delete c.source,delete c.index,void s.search(a(o),c,function(e,n){if(e)return void r.error(e.message);var a=[];if(i.includeAll){var s=i.allTitle||"All departments";a.push(r.mixin({facet:{value:s,count:n.nbHits}},r.cloneDeep(o)))}r.each(n.facets,function(e,t){r.each(e,function(e,n){a.push(r.mixin({facet:{facet:t,value:n,count:e}},r.cloneDeep(o)))})});for(var c=1;c<t.hits.length;++c)a.push(t.hits[c]);u(a,t)})}u([])})}if(!n.source)return r.error("Missing 'source' key");var a=r.isFunction(n.source)?n.source:function(e){return e[n.source]};if(!n.index)return r.error("Missing 'index' key");var s=n.index;return i=i||{},o}},function(e,t,n){n(659),e.exports=angular},function(){!function(e,t,n){"use strict";function r(e,t){return t=t||Error,function(){var n,r,i=2,o=arguments,a=o[0],s="["+(e?e+":":"")+a+"] ",u=o[1];for(s+=u.replace(/\{\d+\}/g,function(e){var t=+e.slice(1,-1),n=t+i;return n<o.length?be(o[n]):e}),s+="\nhttp://errors.angularjs.org/1.4.7/"+(e?e+"/":"")+a,r=i,n="?";r<o.length;r++,n="&")s+=n+"p"+(r-i)+"="+encodeURIComponent(be(o[r]));return new t(s)}}function i(e){if(null==e||k(e))return!1;var t="length"in Object(e)&&e.length;return e.nodeType===Kr&&t?!0:C(e)||Fr(e)||0===t||"number"==typeof t&&t>0&&t-1 in e}function o(e,t,n){var r,a;if(e)if(E(e))for(r in e)"prototype"==r||"length"==r||"name"==r||e.hasOwnProperty&&!e.hasOwnProperty(r)||t.call(n,e[r],r,e);else if(Fr(e)||i(e)){var s="object"!=typeof e;for(r=0,a=e.length;a>r;r++)(s||r in e)&&t.call(n,e[r],r,e)}else if(e.forEach&&e.forEach!==o)e.forEach(t,n,e);else if(_(e))for(r in e)t.call(n,e[r],r,e);else if("function"==typeof e.hasOwnProperty)for(r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r,e);else for(r in e)wr.call(e,r)&&t.call(n,e[r],r,e);return e}function a(e,t,n){for(var r=Object.keys(e).sort(),i=0;i<r.length;i++)t.call(n,e[r[i]],r[i]);return r}function s(e){return function(t,n){e(n,t)}}function u(){return++Dr}function c(e,t){t?e.$$hashKey=t:delete e.$$hashKey}function l(e,t,n){for(var r=e.$$hashKey,i=0,o=t.length;o>i;++i){var a=t[i];if(w(a)||E(a))for(var s=Object.keys(a),u=0,f=s.length;f>u;u++){var p=s[u],d=a[p];n&&w(d)?S(d)?e[p]=new Date(d.valueOf()):P(d)?e[p]=new RegExp(d):(w(e[p])||(e[p]=Fr(d)?[]:{}),l(e[p],[d],!0)):e[p]=d}}return c(e,r),e}function f(e){return l(e,Tr.call(arguments,1),!1)}function p(e){return l(e,Tr.call(arguments,1),!0)}function d(e){return parseInt(e,10)}function h(e,t){return f(Object.create(e),t)}function m(){}function v(e){return e}function g(e){return function(){return e}}function y(e){return E(e.toString)&&e.toString!==Object.prototype.toString}function b(e){return"undefined"==typeof e}function x(e){return"undefined"!=typeof e}function w(e){return null!==e&&"object"==typeof e}function _(e){return null!==e&&"object"==typeof e&&!Ar(e)}function C(e){return"string"==typeof e}function $(e){return"number"==typeof e}function S(e){return"[object Date]"===Nr.call(e)}function E(e){return"function"==typeof e}function P(e){return"[object RegExp]"===Nr.call(e)}function k(e){return e&&e.window===e}function T(e){return e&&e.$evalAsync&&e.$watch}function O(e){return"[object File]"===Nr.call(e)}function R(e){return"[object FormData]"===Nr.call(e)}function N(e){return"[object Blob]"===Nr.call(e)}function A(e){return"boolean"==typeof e}function j(e){return e&&E(e.then)}function M(e){return Lr.test(Nr.call(e))}function D(e){return!(!e||!(e.nodeName||e.prop&&e.attr&&e.find))}function I(e){var t,n={},r=e.split(",");for(t=0;t<r.length;t++)n[r[t]]=!0;return n}function F(e){return xr(e.nodeName||e[0]&&e[0].nodeName)}function L(e,t){var n=e.indexOf(t);return n>=0&&e.splice(n,1),n}function U(e,t,n,r){if(k(e)||T(e))throw jr("cpws","Can't copy! Making copies of Window or Scope instances is not supported.");if(M(t))throw jr("cpta","Can't copy! TypedArray destination cannot be mutated.");if(t){if(e===t)throw jr("cpi","Can't copy! Source and destination are identical.");n=n||[],r=r||[],w(e)&&(n.push(e),r.push(t));var i;if(Fr(e)){t.length=0;for(var a=0;a<e.length;a++)t.push(U(e[a],null,n,r))}else{var s=t.$$hashKey;if(Fr(t)?t.length=0:o(t,function(e,n){delete t[n]}),_(e))for(i in e)t[i]=U(e[i],null,n,r);else if(e&&"function"==typeof e.hasOwnProperty)for(i in e)e.hasOwnProperty(i)&&(t[i]=U(e[i],null,n,r));else for(i in e)wr.call(e,i)&&(t[i]=U(e[i],null,n,r));c(t,s)}}else if(t=e,w(e)){var u;if(n&&-1!==(u=n.indexOf(e)))return r[u];if(Fr(e))return U(e,[],n,r);if(M(e))t=new e.constructor(e);else if(S(e))t=new Date(e.getTime());else if(P(e))t=new RegExp(e.source,e.toString().match(/[^\/]*$/)[0]),t.lastIndex=e.lastIndex;else{if(!E(e.cloneNode)){var l=Object.create(Ar(e));return U(e,l,n,r)}t=e.cloneNode(!0)}r&&(n.push(e),r.push(t))}return t}function H(e,t){if(Fr(e)){t=t||[];for(var n=0,r=e.length;r>n;n++)t[n]=e[n]}else if(w(e)){t=t||{};for(var i in e)("$"!==i.charAt(0)||"$"!==i.charAt(1))&&(t[i]=e[i])}return t||e}function V(e,t){if(e===t)return!0;if(null===e||null===t)return!1;if(e!==e&&t!==t)return!0;var n,r,i,o=typeof e,a=typeof t;if(o==a&&"object"==o){if(!Fr(e)){if(S(e))return S(t)?V(e.getTime(),t.getTime()):!1;if(P(e))return P(t)?e.toString()==t.toString():!1;if(T(e)||T(t)||k(e)||k(t)||Fr(t)||S(t)||P(t))return!1;i=ve();for(r in e)if("$"!==r.charAt(0)&&!E(e[r])){if(!V(e[r],t[r]))return!1;i[r]=!0}for(r in t)if(!(r in i)&&"$"!==r.charAt(0)&&x(t[r])&&!E(t[r]))return!1;return!0}if(!Fr(t))return!1;if((n=e.length)==t.length){for(r=0;n>r;r++)if(!V(e[r],t[r]))return!1;return!0}}return!1}function q(e,t,n){return e.concat(Tr.call(t,n))}function B(e,t){return Tr.call(e,t||0)}function W(e,t){var n=arguments.length>2?B(arguments,2):[];return!E(t)||t instanceof RegExp?t:n.length?function(){return arguments.length?t.apply(e,q(n,arguments,0)):t.apply(e,n)}:function(){return arguments.length?t.apply(e,arguments):t.call(e)}}function z(e,r){var i=r;return"string"==typeof e&&"$"===e.charAt(0)&&"$"===e.charAt(1)?i=n:k(r)?i="$WINDOW":r&&t===r?i="$DOCUMENT":T(r)&&(i="$SCOPE"),i}function K(e,t){return"undefined"==typeof e?n:($(t)||(t=t?2:null),JSON.stringify(e,z,t))}function Q(e){return C(e)?JSON.parse(e):e}function G(e,t){var n=Date.parse("Jan 01, 1970 00:00:00 "+e)/6e4;return isNaN(n)?t:n;
28
-
29
- }function Y(e,t){return e=new Date(e.getTime()),e.setMinutes(e.getMinutes()+t),e}function X(e,t,n){n=n?-1:1;var r=G(t,e.getTimezoneOffset());return Y(e,n*(r-e.getTimezoneOffset()))}function J(e){e=Er(e).clone();try{e.empty()}catch(t){}var n=Er("<div>").append(e).html();try{return e[0].nodeType===Gr?xr(n):n.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(e,t){return"<"+xr(t)})}catch(t){return xr(n)}}function Z(e){try{return decodeURIComponent(e)}catch(t){}}function ee(e){var t={};return o((e||"").split("&"),function(e){var n,r,i;e&&(r=e=e.replace(/\+/g,"%20"),n=e.indexOf("="),-1!==n&&(r=e.substring(0,n),i=e.substring(n+1)),r=Z(r),x(r)&&(i=x(i)?Z(i):!0,wr.call(t,r)?Fr(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i))}),t}function te(e){var t=[];return o(e,function(e,n){Fr(e)?o(e,function(e){t.push(re(n,!0)+(e===!0?"":"="+re(e,!0)))}):t.push(re(n,!0)+(e===!0?"":"="+re(e,!0)))}),t.length?t.join("&"):""}function ne(e){return re(e,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function re(e,t){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,t?"%20":"+")}function ie(e,t){var n,r,i=Br.length;for(r=0;i>r;++r)if(n=Br[r]+t,C(n=e.getAttribute(n)))return n;return null}function oe(e,t){var n,r,i={};o(Br,function(t){var i=t+"app";!n&&e.hasAttribute&&e.hasAttribute(i)&&(n=e,r=e.getAttribute(i))}),o(Br,function(t){var i,o=t+"app";!n&&(i=e.querySelector("["+o.replace(":","\\:")+"]"))&&(n=i,r=i.getAttribute(o))}),n&&(i.strictDi=null!==ie(n,"strict-di"),t(n,r?[r]:[],i))}function ae(n,r,i){w(i)||(i={});var a={strictDi:!1};i=f(a,i);var s=function(){if(n=Er(n),n.injector()){var e=n[0]===t?"document":J(n);throw jr("btstrpd","App Already Bootstrapped with this Element '{0}'",e.replace(/</,"&lt;").replace(/>/,"&gt;"))}r=r||[],r.unshift(["$provide",function(e){e.value("$rootElement",n)}]),i.debugInfoEnabled&&r.push(["$compileProvider",function(e){e.debugInfoEnabled(!0)}]),r.unshift("ng");var o=Je(r,i.strictDi);return o.invoke(["$rootScope","$rootElement","$compile","$injector",function(e,t,n,r){e.$apply(function(){t.data("$injector",r),n(t)(e)})}]),o},u=/^NG_ENABLE_DEBUG_INFO!/,c=/^NG_DEFER_BOOTSTRAP!/;return e&&u.test(e.name)&&(i.debugInfoEnabled=!0,e.name=e.name.replace(u,"")),e&&!c.test(e.name)?s():(e.name=e.name.replace(c,""),Mr.resumeBootstrap=function(e){return o(e,function(e){r.push(e)}),s()},void(E(Mr.resumeDeferredBootstrap)&&Mr.resumeDeferredBootstrap()))}function se(){e.name="NG_ENABLE_DEBUG_INFO!"+e.name,e.location.reload()}function ue(e){var t=Mr.element(e).injector();if(!t)throw jr("test","no injector found for element argument to getTestability");return t.get("$$testability")}function ce(e,t){return t=t||"_",e.replace(Wr,function(e,n){return(n?t:"")+e.toLowerCase()})}function le(){var t;if(!zr){var r=qr();Pr=b(r)?e.jQuery:r?e[r]:n,Pr&&Pr.fn.on?(Er=Pr,f(Pr.fn,{scope:di.scope,isolateScope:di.isolateScope,controller:di.controller,injector:di.injector,inheritedData:di.inheritedData}),t=Pr.cleanData,Pr.cleanData=function(e){var n;if(Ir)Ir=!1;else for(var r,i=0;null!=(r=e[i]);i++)n=Pr._data(r,"events"),n&&n.$destroy&&Pr(r).triggerHandler("$destroy");t(e)}):Er=ke,Mr.element=Er,zr=!0}}function fe(e,t,n){if(!e)throw jr("areq","Argument '{0}' is {1}",t||"?",n||"required");return e}function pe(e,t,n){return n&&Fr(e)&&(e=e[e.length-1]),fe(E(e),t,"not a function, got "+(e&&"object"==typeof e?e.constructor.name||"Object":typeof e)),e}function de(e,t){if("hasOwnProperty"===e)throw jr("badname","hasOwnProperty is not a valid {0} name",t)}function he(e,t,n){if(!t)return e;for(var r,i=t.split("."),o=e,a=i.length,s=0;a>s;s++)r=i[s],e&&(e=(o=e)[r]);return!n&&E(e)?W(o,e):e}function me(e){for(var t,n=e[0],r=e[e.length-1],i=1;n!==r&&(n=n.nextSibling);i++)(t||e[i]!==n)&&(t||(t=Er(Tr.call(e,0,i))),t.push(n));return t||e}function ve(){return Object.create(null)}function ge(e){function t(e,t,n){return e[t]||(e[t]=n())}var n=r("$injector"),i=r("ng"),o=t(e,"angular",Object);return o.$$minErr=o.$$minErr||r,t(o,"module",function(){var e={};return function(r,o,a){var s=function(e,t){if("hasOwnProperty"===e)throw i("badname","hasOwnProperty is not a valid {0} name",t)};return s(r,"module"),o&&e.hasOwnProperty(r)&&(e[r]=null),t(e,r,function(){function e(e,t,n,r){return r||(r=i),function(){return r[n||"push"]([e,t,arguments]),l}}function t(e,t){return function(n,o){return o&&E(o)&&(o.$$moduleName=r),i.push([e,t,arguments]),l}}if(!o)throw n("nomod","Module '{0}' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.",r);var i=[],s=[],u=[],c=e("$injector","invoke","push",s),l={_invokeQueue:i,_configBlocks:s,_runBlocks:u,requires:o,name:r,provider:t("$provide","provider"),factory:t("$provide","factory"),service:t("$provide","service"),value:e("$provide","value"),constant:e("$provide","constant","unshift"),decorator:t("$provide","decorator"),animation:t("$animateProvider","register"),filter:t("$filterProvider","register"),controller:t("$controllerProvider","register"),directive:t("$compileProvider","directive"),config:c,run:function(e){return u.push(e),this}};return a&&c(a),l})}})}function ye(e){var t=[];return JSON.stringify(e,function(e,n){if(n=z(e,n),w(n)){if(t.indexOf(n)>=0)return"...";t.push(n)}return n})}function be(e){return"function"==typeof e?e.toString().replace(/ \{[\s\S]*$/,""):b(e)?"undefined":"string"!=typeof e?ye(e):e}function xe(t){f(t,{bootstrap:ae,copy:U,extend:f,merge:p,equals:V,element:Er,forEach:o,injector:Je,noop:m,bind:W,toJson:K,fromJson:Q,identity:v,isUndefined:b,isDefined:x,isString:C,isFunction:E,isObject:w,isNumber:$,isElement:D,isArray:Fr,version:Zr,isDate:S,lowercase:xr,uppercase:_r,callbacks:{counter:0},getTestability:ue,$$minErr:r,$$csp:Vr,reloadWithDebugInfo:se}),(kr=ge(e))("ng",["ngLocale"],["$provide",function(e){e.provider({$$sanitizeUri:gn}),e.provider("$compile",ut).directive({a:ho,input:Ro,textarea:Ro,form:bo,script:Ca,select:Ea,style:ka,option:Pa,ngBind:jo,ngBindHtml:Do,ngBindTemplate:Mo,ngClass:Fo,ngClassEven:Uo,ngClassOdd:Lo,ngCloak:Ho,ngController:Vo,ngForm:xo,ngHide:ga,ngIf:Wo,ngInclude:zo,ngInit:Qo,ngNonBindable:ua,ngPluralize:pa,ngRepeat:da,ngShow:va,ngStyle:ya,ngSwitch:ba,ngSwitchWhen:xa,ngSwitchDefault:wa,ngOptions:fa,ngTransclude:_a,ngModel:oa,ngList:Go,ngChange:Io,pattern:Oa,ngPattern:Oa,required:Ta,ngRequired:Ta,minlength:Na,ngMinlength:Na,maxlength:Ra,ngMaxlength:Ra,ngValue:Ao,ngModelOptions:sa}).directive({ngInclude:Ko}).directive(mo).directive(qo),e.provider({$anchorScroll:Ze,$animate:ki,$animateCss:Ti,$$animateQueue:Pi,$$AnimateRunner:Ei,$browser:ot,$cacheFactory:at,$controller:dt,$document:ht,$exceptionHandler:mt,$filter:Rn,$$forceReflow:ji,$interpolate:Tt,$interval:Ot,$http:St,$httpParamSerializer:gt,$httpParamSerializerJQLike:yt,$httpBackend:Pt,$xhrFactory:Et,$location:Bt,$log:Wt,$parse:fn,$rootScope:vn,$q:pn,$$q:dn,$sce:wn,$sceDelegate:xn,$sniffer:_n,$templateCache:st,$templateRequest:Cn,$$testability:$n,$timeout:Sn,$window:kn,$$rAF:mn,$$jqLite:Ke,$$HashMap:gi,$$cookieReader:On})}])}function we(){return++ti}function _e(e){return e.replace(ii,function(e,t,n,r){return r?n.toUpperCase():n}).replace(oi,"Moz$1")}function Ce(e){return!ci.test(e)}function $e(e){var t=e.nodeType;return t===Kr||!t||t===Xr}function Se(e){for(var t in ei[e.ng339])return!0;return!1}function Ee(e,t){var n,r,i,a,s=t.createDocumentFragment(),u=[];if(Ce(e))u.push(t.createTextNode(e));else{for(n=n||s.appendChild(t.createElement("div")),r=(li.exec(e)||["",""])[1].toLowerCase(),i=pi[r]||pi._default,n.innerHTML=i[1]+e.replace(fi,"<$1></$2>")+i[2],a=i[0];a--;)n=n.lastChild;u=q(u,n.childNodes),n=s.firstChild,n.textContent=""}return s.textContent="",s.innerHTML="",o(u,function(e){s.appendChild(e)}),s}function Pe(e,n){n=n||t;var r;return(r=ui.exec(e))?[n.createElement(r[1])]:(r=Ee(e,n))?r.childNodes:[]}function ke(e){if(e instanceof ke)return e;var t;if(C(e)&&(e=Ur(e),t=!0),!(this instanceof ke)){if(t&&"<"!=e.charAt(0))throw si("nosel","Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element");return new ke(e)}t?Fe(this,Pe(e)):Fe(this,e)}function Te(e){return e.cloneNode(!0)}function Oe(e,t){if(t||Ne(e),e.querySelectorAll)for(var n=e.querySelectorAll("*"),r=0,i=n.length;i>r;r++)Ne(n[r])}function Re(e,t,n,r){if(x(r))throw si("offargs","jqLite#off() does not support the `selector` argument");var i=Ae(e),a=i&&i.events,s=i&&i.handle;if(s)if(t)o(t.split(" "),function(t){if(x(n)){var r=a[t];if(L(r||[],n),r&&r.length>0)return}ri(e,t,s),delete a[t]});else for(t in a)"$destroy"!==t&&ri(e,t,s),delete a[t]}function Ne(e,t){var r=e.ng339,i=r&&ei[r];if(i){if(t)return void delete i.data[t];i.handle&&(i.events.$destroy&&i.handle({},"$destroy"),Re(e)),delete ei[r],e.ng339=n}}function Ae(e,t){var r=e.ng339,i=r&&ei[r];return t&&!i&&(e.ng339=r=we(),i=ei[r]={events:{},data:{},handle:n}),i}function je(e,t,n){if($e(e)){var r=x(n),i=!r&&t&&!w(t),o=!t,a=Ae(e,!i),s=a&&a.data;if(r)s[t]=n;else{if(o)return s;if(i)return s&&s[t];f(s,t)}}}function Me(e,t){return e.getAttribute?(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+t+" ")>-1:!1}function De(e,t){t&&e.setAttribute&&o(t.split(" "),function(t){e.setAttribute("class",Ur((" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").replace(" "+Ur(t)+" "," ")))})}function Ie(e,t){if(t&&e.setAttribute){var n=(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");o(t.split(" "),function(e){e=Ur(e),-1===n.indexOf(" "+e+" ")&&(n+=e+" ")}),e.setAttribute("class",Ur(n))}}function Fe(e,t){if(t)if(t.nodeType)e[e.length++]=t;else{var n=t.length;if("number"==typeof n&&t.window!==t){if(n)for(var r=0;n>r;r++)e[e.length++]=t[r]}else e[e.length++]=t}}function Le(e,t){return Ue(e,"$"+(t||"ngController")+"Controller")}function Ue(e,t,n){e.nodeType==Xr&&(e=e.documentElement);for(var r=Fr(t)?t:[t];e;){for(var i=0,o=r.length;o>i;i++)if(x(n=Er.data(e,r[i])))return n;e=e.parentNode||e.nodeType===Jr&&e.host}}function He(e){for(Oe(e,!0);e.firstChild;)e.removeChild(e.firstChild)}function Ve(e,t){t||Oe(e);var n=e.parentNode;n&&n.removeChild(e)}function qe(t,n){n=n||e,"complete"===n.document.readyState?n.setTimeout(t):Er(n).on("load",t)}function Be(e,t){var n=hi[t.toLowerCase()];return n&&mi[F(e)]&&n}function We(e){return vi[e]}function ze(e,t){var n=function(n,r){n.isDefaultPrevented=function(){return n.defaultPrevented};var i=t[r||n.type],o=i?i.length:0;if(o){if(b(n.immediatePropagationStopped)){var a=n.stopImmediatePropagation;n.stopImmediatePropagation=function(){n.immediatePropagationStopped=!0,n.stopPropagation&&n.stopPropagation(),a&&a.call(n)}}n.isImmediatePropagationStopped=function(){return n.immediatePropagationStopped===!0},o>1&&(i=H(i));for(var s=0;o>s;s++)n.isImmediatePropagationStopped()||i[s].call(e,n)}};return n.elem=e,n}function Ke(){this.$get=function(){return f(ke,{hasClass:function(e,t){return e.attr&&(e=e[0]),Me(e,t)},addClass:function(e,t){return e.attr&&(e=e[0]),Ie(e,t)},removeClass:function(e,t){return e.attr&&(e=e[0]),De(e,t)}})}}function Qe(e,t){var n=e&&e.$$hashKey;if(n)return"function"==typeof n&&(n=e.$$hashKey()),n;var r=typeof e;return n="function"==r||"object"==r&&null!==e?e.$$hashKey=r+":"+(t||u)():r+":"+e}function Ge(e,t){if(t){var n=0;this.nextUid=function(){return++n}}o(e,this.put,this)}function Ye(e){var t=e.toString().replace(wi,""),n=t.match(yi);return n?"function("+(n[1]||"").replace(/[\s\r\n]+/," ")+")":"fn"}function Xe(e,t,n){var r,i,a,s;if("function"==typeof e){if(!(r=e.$inject)){if(r=[],e.length){if(t)throw C(n)&&n||(n=e.name||Ye(e)),_i("strictdi","{0} is not using explicit annotation and cannot be invoked in strict mode",n);i=e.toString().replace(wi,""),a=i.match(yi),o(a[1].split(bi),function(e){e.replace(xi,function(e,t,n){r.push(n)})})}e.$inject=r}}else Fr(e)?(s=e.length-1,pe(e[s],"fn"),r=e.slice(0,s)):pe(e,"fn",!0);return r}function Je(e,t){function r(e){return function(t,n){return w(t)?void o(t,s(e)):e(t,n)}}function i(e,t){if(de(e,"service"),(E(t)||Fr(t))&&(t=$.instantiate(t)),!t.$get)throw _i("pget","Provider '{0}' must define $get factory method.",e);return _[e+v]=t}function a(e,t){return function(){var n=P.invoke(t,this);if(b(n))throw _i("undef","Provider '{0}' must return a value from $get factory method.",e);return n}}function u(e,t,n){return i(e,{$get:n!==!1?a(e,t):t})}function c(e,t){return u(e,["$injector",function(e){return e.instantiate(t)}])}function l(e,t){return u(e,g(t),!1)}function f(e,t){de(e,"constant"),_[e]=t,S[e]=t}function p(e,t){var n=$.get(e+v),r=n.$get;n.$get=function(){var e=P.invoke(r,n);return P.invoke(t,null,{$delegate:e})}}function d(e){fe(b(e)||Fr(e),"modulesToLoad","not an array");var t,n=[];return o(e,function(e){function r(e){var t,n;for(t=0,n=e.length;n>t;t++){var r=e[t],i=$.get(r[0]);i[r[1]].apply(i,r[2])}}if(!x.get(e)){x.put(e,!0);try{C(e)?(t=kr(e),n=n.concat(d(t.requires)).concat(t._runBlocks),r(t._invokeQueue),r(t._configBlocks)):E(e)?n.push($.invoke(e)):Fr(e)?n.push($.invoke(e)):pe(e,"module")}catch(i){throw Fr(e)&&(e=e[e.length-1]),i.message&&i.stack&&-1==i.stack.indexOf(i.message)&&(i=i.message+"\n"+i.stack),_i("modulerr","Failed to instantiate module {0} due to:\n{1}",e,i.stack||i.message||i)}}}),n}function h(e,n){function r(t,r){if(e.hasOwnProperty(t)){if(e[t]===m)throw _i("cdep","Circular dependency found: {0}",t+" <- "+y.join(" <- "));return e[t]}try{return y.unshift(t),e[t]=m,e[t]=n(t,r)}catch(i){throw e[t]===m&&delete e[t],i}finally{y.shift()}}function i(e,n,i,o){"string"==typeof i&&(o=i,i=null);var a,s,u,c=[],l=Je.$$annotate(e,t,o);for(s=0,a=l.length;a>s;s++){if(u=l[s],"string"!=typeof u)throw _i("itkn","Incorrect injection token! Expected service name as string, got {0}",u);c.push(i&&i.hasOwnProperty(u)?i[u]:r(u,o))}return Fr(e)&&(e=e[a]),e.apply(n,c)}function o(e,t,n){var r=Object.create((Fr(e)?e[e.length-1]:e).prototype||null),o=i(e,r,t,n);return w(o)||E(o)?o:r}return{invoke:i,instantiate:o,get:r,annotate:Je.$$annotate,has:function(t){return _.hasOwnProperty(t+v)||e.hasOwnProperty(t)}}}t=t===!0;var m={},v="Provider",y=[],x=new Ge([],!0),_={$provide:{provider:r(i),factory:r(u),service:r(c),value:r(l),constant:r(f),decorator:p}},$=_.$injector=h(_,function(e,t){throw Mr.isString(t)&&y.push(t),_i("unpr","Unknown provider: {0}",y.join(" <- "))}),S={},P=S.$injector=h(S,function(e,t){var r=$.get(e+v,t);return P.invoke(r.$get,r,n,e)});return o(d(e),function(e){e&&P.invoke(e)}),P}function Ze(){var e=!0;this.disableAutoScrolling=function(){e=!1},this.$get=["$window","$location","$rootScope",function(t,n,r){function i(e){var t=null;return Array.prototype.some.call(e,function(e){return"a"===F(e)?(t=e,!0):void 0}),t}function o(){var e=s.yOffset;if(E(e))e=e();else if(D(e)){var n=e[0],r=t.getComputedStyle(n);e="fixed"!==r.position?0:n.getBoundingClientRect().bottom}else $(e)||(e=0);return e}function a(e){if(e){e.scrollIntoView();var n=o();if(n){var r=e.getBoundingClientRect().top;t.scrollBy(0,r-n)}}else t.scrollTo(0,0)}function s(e){e=C(e)?e:n.hash();var t;e?(t=u.getElementById(e))?a(t):(t=i(u.getElementsByName(e)))?a(t):"top"===e&&a(null):a(null)}var u=t.document;return e&&r.$watch(function(){return n.hash()},function(e,t){(e!==t||""!==e)&&qe(function(){r.$evalAsync(s)})}),s}]}function et(e,t){return e||t?e?t?(Fr(e)&&(e=e.join(" ")),Fr(t)&&(t=t.join(" ")),e+" "+t):e:t:""}function tt(e){for(var t=0;t<e.length;t++){var n=e[t];if(n.nodeType===$i)return n}}function nt(e){C(e)&&(e=e.split(" "));var t=ve();return o(e,function(e){e.length&&(t[e]=!0)}),t}function rt(e){return w(e)?e:{}}function it(e,t,n,r){function i(e){try{e.apply(null,B(arguments,1))}finally{if(y--,0===y)for(;x.length;)try{x.pop()()}catch(t){n.error(t)}}}function a(e){var t=e.indexOf("#");return-1===t?"":e.substr(t)}function s(){S=null,c(),l()}function u(){try{return d.state}catch(e){}}function c(){w=u(),w=b(w)?null:w,V(w,k)&&(w=k),k=w}function l(){(C!==f.url()||_!==w)&&(C=f.url(),_=w,o(E,function(e){e(f.url(),w)}))}var f=this,p=(t[0],e.location),d=e.history,h=e.setTimeout,v=e.clearTimeout,g={};f.isMock=!1;var y=0,x=[];f.$$completeOutstandingRequest=i,f.$$incOutstandingRequestCount=function(){y++},f.notifyWhenNoOutstandingRequests=function(e){0===y?e():x.push(e)};var w,_,C=p.href,$=t.find("base"),S=null;c(),_=w,f.url=function(t,n,i){if(b(i)&&(i=null),p!==e.location&&(p=e.location),d!==e.history&&(d=e.history),t){var o=_===i;if(C===t&&(!r.history||o))return f;var s=C&&Mt(C)===Mt(t);return C=t,_=i,!r.history||s&&o?((!s||S)&&(S=t),n?p.replace(t):s?p.hash=a(t):p.href=t,p.href!==t&&(S=t)):(d[n?"replaceState":"pushState"](i,"",t),c(),_=w),f}return S||p.href.replace(/%27/g,"'")},f.state=function(){return w};var E=[],P=!1,k=null;f.onUrlChange=function(t){return P||(r.history&&Er(e).on("popstate",s),Er(e).on("hashchange",s),P=!0),E.push(t),t},f.$$applicationDestroyed=function(){Er(e).off("hashchange popstate",s)},f.$$checkUrlChange=l,f.baseHref=function(){var e=$.attr("href");return e?e.replace(/^(https?\:)?\/\/[^\/]*/,""):""},f.defer=function(e,t){var n;return y++,n=h(function(){delete g[n],i(e)},t||0),g[n]=!0,n},f.defer.cancel=function(e){return g[e]?(delete g[e],v(e),i(m),!0):!1}}function ot(){this.$get=["$window","$log","$sniffer","$document",function(e,t,n,r){return new it(e,r,t,n)}]}function at(){this.$get=function(){function e(e,n){function i(e){e!=p&&(d?d==e&&(d=e.n):d=e,o(e.n,e.p),o(e,p),p=e,p.n=null)}function o(e,t){e!=t&&(e&&(e.p=t),t&&(t.n=e))}if(e in t)throw r("$cacheFactory")("iid","CacheId '{0}' is already taken!",e);var a=0,s=f({},n,{id:e}),u={},c=n&&n.capacity||Number.MAX_VALUE,l={},p=null,d=null;return t[e]={put:function(e,t){if(!b(t)){if(c<Number.MAX_VALUE){var n=l[e]||(l[e]={key:e});i(n)}return e in u||a++,u[e]=t,a>c&&this.remove(d.key),t}},get:function(e){if(c<Number.MAX_VALUE){var t=l[e];if(!t)return;i(t)}return u[e]},remove:function(e){if(c<Number.MAX_VALUE){var t=l[e];if(!t)return;t==p&&(p=t.p),t==d&&(d=t.n),o(t.n,t.p),delete l[e]}delete u[e],a--},removeAll:function(){u={},a=0,l={},p=d=null},destroy:function(){u=null,s=null,l=null,delete t[e]},info:function(){return f({},s,{size:a})}}}var t={};return e.info=function(){var e={};return o(t,function(t,n){e[n]=t.info()}),e},e.get=function(e){return t[e]},e}}function st(){this.$get=["$cacheFactory",function(e){return e("templates")}]}function ut(e,r){function i(e,t,n){var r=/^\s*([@&]|=(\*?))(\??)\s*(\w*)\s*$/,i={};return o(e,function(e,o){var a=e.match(r);if(!a)throw Oi("iscp","Invalid {3} for directive '{0}'. Definition: {... {1}: '{2}' ...}",t,o,e,n?"controller bindings definition":"isolate scope definition");i[o]={mode:a[1][0],collection:"*"===a[2],optional:"?"===a[3],attrName:a[4]||o}}),i}function a(e,t){var n={isolateScope:null,bindToController:null};if(w(e.scope)&&(e.bindToController===!0?(n.bindToController=i(e.scope,t,!0),n.isolateScope={}):n.isolateScope=i(e.scope,t,!1)),w(e.bindToController)&&(n.bindToController=i(e.bindToController,t,!0)),w(n.bindToController)){var r=e.controller,o=e.controllerAs;if(!r)throw Oi("noctrl","Cannot bind to controller without directive '{0}'s controller.",t);if(!pt(r,o))throw Oi("noident","Cannot bind to controller without identifier for directive '{0}'.",t)}return n}function u(e){var t=e.charAt(0);if(!t||t!==xr(t))throw Oi("baddir","Directive name '{0}' is invalid. The first character must be a lowercase letter",e);if(e!==e.trim())throw Oi("baddir","Directive name '{0}' is invalid. The name should not contain leading or trailing whitespaces",e)}var c={},l="Directive",p=/^\s*directive\:\s*([\w\-]+)\s+(.*)$/,d=/(([\w\-]+)(?:\:([^;]+))?;?)/,y=I("ngSrc,ngSrcset,src,srcset"),_=/^(?:(\^\^?)?(\?)?(\^\^?)?)?/,$=/^(on[a-z]+|formaction)$/;this.directive=function P(t,n){return de(t,"directive"),C(t)?(u(t),fe(n,"directiveFactory"),c.hasOwnProperty(t)||(c[t]=[],e.factory(t+l,["$injector","$exceptionHandler",function(e,n){var r=[];return o(c[t],function(i,o){try{var s=e.invoke(i);E(s)?s={compile:g(s)}:!s.compile&&s.link&&(s.compile=g(s.link)),s.priority=s.priority||0,s.index=o,s.name=s.name||t,s.require=s.require||s.controller&&s.name,s.restrict=s.restrict||"EA";var u=s.$$bindings=a(s,s.name);w(u.isolateScope)&&(s.$$isolateBindings=u.isolateScope),s.$$moduleName=i.$$moduleName,r.push(s)}catch(c){n(c)}}),r}])),c[t].push(n)):o(t,s(P)),this},this.aHrefSanitizationWhitelist=function(e){return x(e)?(r.aHrefSanitizationWhitelist(e),this):r.aHrefSanitizationWhitelist()},this.imgSrcSanitizationWhitelist=function(e){return x(e)?(r.imgSrcSanitizationWhitelist(e),this):r.imgSrcSanitizationWhitelist()};var S=!0;this.debugInfoEnabled=function(e){return x(e)?(S=e,this):S},this.$get=["$injector","$interpolate","$exceptionHandler","$templateRequest","$parse","$controller","$rootScope","$document","$sce","$animate","$$sanitizeUri",function(e,r,i,a,s,u,g,x,P,k,O){function R(e,t){try{e.addClass(t)}catch(n){}}function N(e,t,n,r,i){e instanceof Er||(e=Er(e)),o(e,function(t,n){t.nodeType==Gr&&t.nodeValue.match(/\S+/)&&(e[n]=Er(t).wrap("<span></span>").parent()[0])});var a=j(e,t,e,n,r,i);N.$$addScopeClass(e);var s=null;return function(t,n,r){fe(t,"scope"),r=r||{};var i=r.parentBoundTranscludeFn,o=r.transcludeControllers,u=r.futureParentElement;i&&i.$$boundTransclude&&(i=i.$$boundTransclude),s||(s=A(u));var c;if(c="html"!==s?Er(Z(s,Er("<div>").append(e).html())):n?di.clone.call(e):e,o)for(var l in o)c.data("$"+l+"Controller",o[l].instance);return N.$$addScopeInfo(c,t),n&&n(c,t),a&&a(t,c,c,i),c}}function A(e){var t=e&&e[0];return t&&"foreignobject"!==F(t)&&t.toString().match(/SVG/)?"svg":"html"}function j(e,t,r,i,o,a){function s(e,r,i,o){var a,s,u,c,l,f,p,d,v;if(h){var g=r.length;for(v=new Array(g),l=0;l<m.length;l+=3)p=m[l],v[p]=r[p]}else v=r;for(l=0,f=m.length;f>l;)if(u=v[m[l++]],a=m[l++],s=m[l++],a){if(a.scope){c=e.$new(),N.$$addScopeInfo(Er(u),c);var y=a.$$destroyBindings;y&&(a.$$destroyBindings=null,c.$on("$destroyed",y))}else c=e;d=a.transcludeOnThisElement?M(e,a.transclude,o):!a.templateOnThisElement&&o?o:!o&&t?M(e,t):null,a(s,c,u,i,d,a)}else s&&s(e,u.childNodes,n,o)}for(var u,c,l,f,p,d,h,m=[],v=0;v<e.length;v++)u=new ae,c=D(e[v],[],u,0===v?i:n,o),l=c.length?H(c,e[v],u,t,r,null,[],[],a):null,l&&l.scope&&N.$$addScopeClass(u.$$element),p=l&&l.terminal||!(f=e[v].childNodes)||!f.length?null:j(f,l?(l.transcludeOnThisElement||!l.templateOnThisElement)&&l.transclude:t),(l||p)&&(m.push(v,l,p),d=!0,h=h||l),a=null;return d?s:null}function M(e,t,n){var r=function(r,i,o,a,s){return r||(r=e.$new(!1,s),r.$$transcluded=!0),t(r,i,{parentBoundTranscludeFn:n,transcludeControllers:o,futureParentElement:a})};return r}function D(e,t,n,r,i){var o,a,s=e.nodeType,u=n.$attr;switch(s){case Kr:W(t,ct(F(e)),"E",r,i);for(var c,l,f,h,m,v,g=e.attributes,y=0,b=g&&g.length;b>y;y++){var x=!1,_=!1;c=g[y],l=c.name,m=Ur(c.value),h=ct(l),(v=pe.test(h))&&(l=l.replace(Ri,"").substr(8).replace(/_(.)/g,function(e,t){return t.toUpperCase()}));var $=h.replace(/(Start|End)$/,"");z($)&&h===$+"Start"&&(x=l,_=l.substr(0,l.length-5)+"end",l=l.substr(0,l.length-6)),f=ct(l.toLowerCase()),u[f]=l,(v||!n.hasOwnProperty(f))&&(n[f]=m,Be(e,f)&&(n[f]=!0)),te(e,t,m,f,v),W(t,f,"A",r,i,x,_)}if(a=e.className,w(a)&&(a=a.animVal),C(a)&&""!==a)for(;o=d.exec(a);)f=ct(o[2]),W(t,f,"C",r,i)&&(n[f]=Ur(o[3])),a=a.substr(o.index+o[0].length);break;case Gr:if(11===Sr)for(;e.parentNode&&e.nextSibling&&e.nextSibling.nodeType===Gr;)e.nodeValue=e.nodeValue+e.nextSibling.nodeValue,e.parentNode.removeChild(e.nextSibling);X(t,e.nodeValue);break;case Yr:try{o=p.exec(e.nodeValue),o&&(f=ct(o[1]),W(t,f,"M",r,i)&&(n[f]=Ur(o[2])))}catch(S){}}return t.sort(G),t}function I(e,t,n){var r=[],i=0;if(t&&e.hasAttribute&&e.hasAttribute(t)){do{if(!e)throw Oi("uterdir","Unterminated attribute, found '{0}' but no matching '{1}' found.",t,n);e.nodeType==Kr&&(e.hasAttribute(t)&&i++,e.hasAttribute(n)&&i--),r.push(e),e=e.nextSibling}while(i>0)}else r.push(e);return Er(r)}function U(e,t,n){return function(r,i,o,a,s){return i=I(i[0],t,n),e(r,i,o,a,s)}}function H(e,r,o,a,s,c,l,f,p){function d(e,t,n,r){e&&(n&&(e=U(e,n,r)),e.require=g.require,e.directiveName=y,(O===g||g.$$isolateScope)&&(e=re(e,{isolateScope:!0})),l.push(e)),t&&(n&&(t=U(t,n,r)),t.require=g.require,t.directiveName=y,(O===g||g.$$isolateScope)&&(t=re(t,{isolateScope:!0})),f.push(t))}function h(e,t,n,r){var i;if(C(t)){var o=t.match(_),a=t.substring(o[0].length),s=o[1]||o[3],u="?"===o[2];if("^^"===s?n=n.parent():(i=r&&r[a],i=i&&i.instance),!i){var c="$"+a+"Controller";i=s?n.inheritedData(c):n.data(c)}if(!i&&!u)throw Oi("ctreq","Controller '{0}', required by directive '{1}', can't be found!",a,e)}else if(Fr(t)){i=[];for(var l=0,f=t.length;f>l;l++)i[l]=h(e,t[l],n,r)}return i||null}function m(e,t,n,r,i,o){var a=ve();for(var s in r){var c=r[s],l={$scope:c===O||c.$$isolateScope?i:o,$element:e,$attrs:t,$transclude:n},f=c.controller;"@"==f&&(f=t[c.name]);var p=u(f,l,!0,c.controllerAs);a[c.name]=p,F||e.data("$"+c.name+"Controller",p.instance)}return a}function v(e,t,i,a,s,u){function c(e,t,r){var i;return T(e)||(r=t,t=e,e=n),F&&(i=b),r||(r=F?w.parent():w),s(e,t,i,r,A)}var p,d,v,g,y,b,x,w,_;if(r===i?(_=o,w=o.$$element):(w=Er(i),_=new ae(w,o)),O&&(y=t.$new(!0)),s&&(x=c,x.$$boundTransclude=s),k&&(b=m(w,_,x,k,y,t)),O&&(N.$$addScopeInfo(w,y,!0,!(R&&(R===O||R===O.$$originalDirective))),N.$$addScopeClass(w,!0),y.$$isolateBindings=O.$$isolateBindings,oe(t,_,y,y.$$isolateBindings,O,y)),b){var C,$,S=O||P;S&&b[S.name]&&(C=S.$$bindings.bindToController,g=b[S.name],g&&g.identifier&&C&&($=g,u.$$destroyBindings=oe(t,_,g.instance,C,S)));for(p in b){g=b[p];var E=g();E!==g.instance&&(g.instance=E,w.data("$"+p+"Controller",E),g===$&&(u.$$destroyBindings(),u.$$destroyBindings=oe(t,_,E,C,S)))}}for(p=0,d=l.length;d>p;p++)v=l[p],ie(v,v.isolateScope?y:t,w,_,v.require&&h(v.directiveName,v.require,w,b),x);var A=t;for(O&&(O.template||null===O.templateUrl)&&(A=y),e&&e(A,i.childNodes,n,s),p=f.length-1;p>=0;p--)v=f[p],ie(v,v.isolateScope?y:t,w,_,v.require&&h(v.directiveName,v.require,w,b),x)}p=p||{};for(var g,y,b,x,$,S=-Number.MAX_VALUE,P=p.newScopeDirective,k=p.controllerDirectives,O=p.newIsolateScopeDirective,R=p.templateDirective,A=p.nonTlbTranscludeDirective,j=!1,M=!1,F=p.hasElementTranscludeDirective,L=o.$$element=Er(r),H=c,V=a,W=0,z=e.length;z>W;W++){g=e[W];var G=g.$$start,X=g.$$end;if(G&&(L=I(r,G,X)),b=n,S>g.priority)break;if(($=g.scope)&&(g.templateUrl||(w($)?(Y("new/isolated scope",O||P,g,L),O=g):Y("new/isolated scope",O,g,L)),P=P||g),y=g.name,!g.templateUrl&&g.controller&&($=g.controller,k=k||ve(),Y("'"+y+"' controller",k[y],g,L),k[y]=g),($=g.transclude)&&(j=!0,g.$$tlb||(Y("transclusion",A,g,L),A=g),"element"==$?(F=!0,S=g.priority,b=L,L=o.$$element=Er(t.createComment(" "+y+": "+o[y]+" ")),r=L[0],ne(s,B(b),r),V=N(b,a,S,H&&H.name,{nonTlbTranscludeDirective:A})):(b=Er(Te(r)).contents(),L.empty(),V=N(b,a))),g.template)if(M=!0,Y("template",R,g,L),R=g,$=E(g.template)?g.template(L,o):g.template,$=le($),g.replace){if(H=g,b=Ce($)?[]:ft(Z(g.templateNamespace,Ur($))),r=b[0],1!=b.length||r.nodeType!==Kr)throw Oi("tplrt","Template for directive '{0}' must have exactly one root element. {1}",y,"");ne(s,L,r);var ee={$attr:{}},te=D(r,[],ee),se=e.splice(W+1,e.length-(W+1));O&&q(te),e=e.concat(te).concat(se),K(o,ee),z=e.length}else L.html($);if(g.templateUrl)M=!0,Y("template",R,g,L),R=g,g.replace&&(H=g),v=Q(e.splice(W,e.length-W),L,o,s,j&&V,l,f,{controllerDirectives:k,newScopeDirective:P!==g&&P,newIsolateScopeDirective:O,templateDirective:R,nonTlbTranscludeDirective:A}),z=e.length;else if(g.compile)try{x=g.compile(L,o,V),E(x)?d(null,x,G,X):x&&d(x.pre,x.post,G,X)}catch(ue){i(ue,J(L))}g.terminal&&(v.terminal=!0,S=Math.max(S,g.priority))}return v.scope=P&&P.scope===!0,v.transcludeOnThisElement=j,v.templateOnThisElement=M,v.transclude=V,p.hasElementTranscludeDirective=F,v}function q(e){for(var t=0,n=e.length;n>t;t++)e[t]=h(e[t],{$$isolateScope:!0})}function W(t,n,r,o,a,s,u){if(n===a)return null;var f=null;if(c.hasOwnProperty(n))for(var p,d=e.get(n+l),m=0,v=d.length;v>m;m++)try{p=d[m],(b(o)||o>p.priority)&&-1!=p.restrict.indexOf(r)&&(s&&(p=h(p,{$$start:s,$$end:u})),t.push(p),f=p)}catch(g){i(g)}return f}function z(t){if(c.hasOwnProperty(t))for(var n,r=e.get(t+l),i=0,o=r.length;o>i;i++)if(n=r[i],n.multiElement)return!0;return!1}function K(e,t){var n=t.$attr,r=e.$attr,i=e.$$element;o(e,function(r,i){"$"!=i.charAt(0)&&(t[i]&&t[i]!==r&&(r+=("style"===i?";":" ")+t[i]),e.$set(i,r,!0,n[i]))}),o(t,function(t,o){"class"==o?(R(i,t),e["class"]=(e["class"]?e["class"]+" ":"")+t):"style"==o?(i.attr("style",i.attr("style")+";"+t),e.style=(e.style?e.style+";":"")+t):"$"==o.charAt(0)||e.hasOwnProperty(o)||(e[o]=t,r[o]=n[o])})}function Q(e,t,n,r,i,s,u,c){var l,f,p=[],d=t[0],m=e.shift(),v=h(m,{templateUrl:null,transclude:null,replace:null,$$originalDirective:m}),g=E(m.templateUrl)?m.templateUrl(t,n):m.templateUrl,y=m.templateNamespace;return t.empty(),a(g).then(function(a){var h,b,x,_;if(a=le(a),m.replace){if(x=Ce(a)?[]:ft(Z(y,Ur(a))),h=x[0],1!=x.length||h.nodeType!==Kr)throw Oi("tplrt","Template for directive '{0}' must have exactly one root element. {1}",m.name,g);b={$attr:{}},ne(r,t,h);var C=D(h,[],b);w(m.scope)&&q(C),e=C.concat(e),K(n,b)}else h=d,t.html(a);for(e.unshift(v),l=H(e,h,n,i,t,m,s,u,c),o(r,function(e,n){e==h&&(r[n]=t[0])}),f=j(t[0].childNodes,i);p.length;){var $=p.shift(),S=p.shift(),E=p.shift(),P=p.shift(),k=t[0];if(!$.$$destroyed){if(S!==d){var T=S.className;c.hasElementTranscludeDirective&&m.replace||(k=Te(h)),ne(E,Er(S),k),R(Er(k),T)}_=l.transcludeOnThisElement?M($,l.transclude,P):P,l(f,$,k,r,_,l)}}p=null}),function(e,t,n,r,i){var o=i;t.$$destroyed||(p?p.push(t,n,r,o):(l.transcludeOnThisElement&&(o=M(t,l.transclude,i)),l(f,t,n,r,o,l)))}}function G(e,t){var n=t.priority-e.priority;return 0!==n?n:e.name!==t.name?e.name<t.name?-1:1:e.index-t.index}function Y(e,t,n,r){function i(e){return e?" (module: "+e+")":""}if(t)throw Oi("multidir","Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}",t.name,i(t.$$moduleName),n.name,i(n.$$moduleName),e,J(r))}function X(e,t){var n=r(t,!0);n&&e.push({priority:0,compile:function(e){var t=e.parent(),r=!!t.length;return r&&N.$$addBindingClass(t),function(e,t){var i=t.parent();r||N.$$addBindingClass(i),N.$$addBindingInfo(i,n.expressions),e.$watch(n,function(e){t[0].nodeValue=e})}}})}function Z(e,n){switch(e=xr(e||"html")){case"svg":case"math":var r=t.createElement("div");return r.innerHTML="<"+e+">"+n+"</"+e+">",r.childNodes[0].childNodes;default:return n}}function ee(e,t){if("srcdoc"==t)return P.HTML;var n=F(e);return"xlinkHref"==t||"form"==n&&"action"==t||"img"!=n&&("src"==t||"ngSrc"==t)?P.RESOURCE_URL:void 0}function te(e,t,n,i,o){var a=ee(e,i);o=y[i]||o;var s=r(n,!0,a,o);if(s){if("multiple"===i&&"select"===F(e))throw Oi("selmulti","Binding to the 'multiple' attribute is not supported. Element: {0}",J(e));t.push({priority:100,compile:function(){return{pre:function(e,t,u){var c=u.$$observers||(u.$$observers=ve());if($.test(i))throw Oi("nodomevents","Interpolations for HTML DOM event attributes are disallowed. Please use the ng- versions (such as ng-click instead of onclick) instead.");var l=u[i];l!==n&&(s=l&&r(l,!0,a,o),n=l),s&&(u[i]=s(e),(c[i]||(c[i]=[])).$$inter=!0,(u.$$observers&&u.$$observers[i].$$scope||e).$watch(s,function(e,t){"class"===i&&e!=t?u.$updateClass(e,t):u.$set(i,e)}))}}}})}}function ne(e,n,r){var i,o,a=n[0],s=n.length,u=a.parentNode;if(e)for(i=0,o=e.length;o>i;i++)if(e[i]==a){e[i++]=r;for(var c=i,l=c+s-1,f=e.length;f>c;c++,l++)f>l?e[c]=e[l]:delete e[c];e.length-=s-1,e.context===a&&(e.context=r);break}u&&u.replaceChild(r,a);var p=t.createDocumentFragment();p.appendChild(a),Er.hasData(a)&&(Er(r).data(Er(a).data()),Pr?(Ir=!0,Pr.cleanData([a])):delete Er.cache[a[Er.expando]]);for(var d=1,h=n.length;h>d;d++){var m=n[d];Er(m).remove(),p.appendChild(m),delete n[d]}n[0]=r,n.length=1}function re(e,t){return f(function(){return e.apply(null,arguments)},e,t)}function ie(e,t,n,r,o,a){try{e(t,n,r,o,a)}catch(s){i(s,J(n))}}function oe(e,t,n,i,a,u){
30
- var c;o(i,function(i,o){var u,l,f,p,d=i.attrName,h=i.optional,v=i.mode;switch(v){case"@":h||wr.call(t,d)||(n[o]=t[d]=void 0),t.$observe(d,function(e){C(e)&&(n[o]=e)}),t.$$observers[d].$$scope=e,C(t[d])&&(n[o]=r(t[d])(e));break;case"=":if(!wr.call(t,d)){if(h)break;t[d]=void 0}if(h&&!t[d])break;l=s(t[d]),p=l.literal?V:function(e,t){return e===t||e!==e&&t!==t},f=l.assign||function(){throw u=n[o]=l(e),Oi("nonassign","Expression '{0}' used with directive '{1}' is non-assignable!",t[d],a.name)},u=n[o]=l(e);var g=function(t){return p(t,n[o])||(p(t,u)?f(e,t=n[o]):n[o]=t),u=t};g.$stateful=!0;var y;y=i.collection?e.$watchCollection(t[d],g):e.$watch(s(t[d],g),null,l.literal),c=c||[],c.push(y);break;case"&":if(l=t.hasOwnProperty(d)?s(t[d]):m,l===m&&h)break;n[o]=function(t){return l(e,t)}}});var l=c?function(){for(var e=0,t=c.length;t>e;++e)c[e]()}:m;return u&&l!==m?(u.$on("$destroy",l),m):l}var ae=function(e,t){if(t){var n,r,i,o=Object.keys(t);for(n=0,r=o.length;r>n;n++)i=o[n],this[i]=t[i]}else this.$attr={};this.$$element=e};ae.prototype={$normalize:ct,$addClass:function(e){e&&e.length>0&&k.addClass(this.$$element,e)},$removeClass:function(e){e&&e.length>0&&k.removeClass(this.$$element,e)},$updateClass:function(e,t){var n=lt(e,t);n&&n.length&&k.addClass(this.$$element,n);var r=lt(t,e);r&&r.length&&k.removeClass(this.$$element,r)},$set:function(e,t,n,r){var a,s=this.$$element[0],u=Be(s,e),c=We(e),l=e;if(u?(this.$$element.prop(e,t),r=u):c&&(this[c]=t,l=c),this[e]=t,r?this.$attr[e]=r:(r=this.$attr[e],r||(this.$attr[e]=r=ce(e,"-"))),a=F(this.$$element),"a"===a&&"href"===e||"img"===a&&"src"===e)this[e]=t=O(t,"src"===e);else if("img"===a&&"srcset"===e){for(var f="",p=Ur(t),d=/(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/,h=/\s/.test(p)?d:/(,)/,m=p.split(h),v=Math.floor(m.length/2),g=0;v>g;g++){var y=2*g;f+=O(Ur(m[y]),!0),f+=" "+Ur(m[y+1])}var x=Ur(m[2*g]).split(/\s/);f+=O(Ur(x[0]),!0),2===x.length&&(f+=" "+Ur(x[1])),this[e]=t=f}n!==!1&&(null===t||b(t)?this.$$element.removeAttr(r):this.$$element.attr(r,t));var w=this.$$observers;w&&o(w[l],function(e){try{e(t)}catch(n){i(n)}})},$observe:function(e,t){var n=this,r=n.$$observers||(n.$$observers=ve()),i=r[e]||(r[e]=[]);return i.push(t),g.$evalAsync(function(){i.$$inter||!n.hasOwnProperty(e)||b(n[e])||t(n[e])}),function(){L(i,t)}}};var se=r.startSymbol(),ue=r.endSymbol(),le="{{"==se||"}}"==ue?v:function(e){return e.replace(/\{\{/g,se).replace(/}}/g,ue)},pe=/^ngAttr[A-Z]/;return N.$$addBindingInfo=S?function(e,t){var n=e.data("$binding")||[];Fr(t)?n=n.concat(t):n.push(t),e.data("$binding",n)}:m,N.$$addBindingClass=S?function(e){R(e,"ng-binding")}:m,N.$$addScopeInfo=S?function(e,t,n,r){var i=n?r?"$isolateScopeNoTemplate":"$isolateScope":"$scope";e.data(i,t)}:m,N.$$addScopeClass=S?function(e,t){R(e,t?"ng-isolate-scope":"ng-scope")}:m,N}]}function ct(e){return _e(e.replace(Ri,""))}function lt(e,t){var n="",r=e.split(/\s+/),i=t.split(/\s+/);e:for(var o=0;o<r.length;o++){for(var a=r[o],s=0;s<i.length;s++)if(a==i[s])continue e;n+=(n.length>0?" ":"")+a}return n}function ft(e){e=Er(e);var t=e.length;if(1>=t)return e;for(;t--;){var n=e[t];n.nodeType===Yr&&Or.call(e,t,1)}return e}function pt(e,t){if(t&&C(t))return t;if(C(e)){var n=Ai.exec(e);if(n)return n[3]}}function dt(){var e={},t=!1;this.register=function(t,n){de(t,"controller"),w(t)?f(e,t):e[t]=n},this.allowGlobals=function(){t=!0},this.$get=["$injector","$window",function(i,o){function a(e,t,n,i){if(!e||!w(e.$scope))throw r("$controller")("noscp","Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.",i,t);e.$scope[t]=n}return function(r,s,u,c){var l,p,d,h;if(u=u===!0,c&&C(c)&&(h=c),C(r)){if(p=r.match(Ai),!p)throw Ni("ctrlfmt","Badly formed controller string '{0}'. Must match `__name__ as __id__` or `__name__`.",r);d=p[1],h=h||p[3],r=e.hasOwnProperty(d)?e[d]:he(s.$scope,d,!0)||(t?he(o,d,!0):n),pe(r,d,!0)}if(u){var m=(Fr(r)?r[r.length-1]:r).prototype;l=Object.create(m||null),h&&a(s,h,l,d||r.name);var v;return v=f(function(){var e=i.invoke(r,l,s,d);return e!==l&&(w(e)||E(e))&&(l=e,h&&a(s,h,l,d||r.name)),l},{instance:l,identifier:h})}return l=i.instantiate(r,s,d),h&&a(s,h,l,d||r.name),l}}]}function ht(){this.$get=["$window",function(e){return Er(e.document)}]}function mt(){this.$get=["$log",function(e){return function(){e.error.apply(e,arguments)}}]}function vt(e){return w(e)?S(e)?e.toISOString():K(e):e}function gt(){this.$get=function(){return function(e){if(!e)return"";var t=[];return a(e,function(e,n){null===e||b(e)||(Fr(e)?o(e,function(e){t.push(re(n)+"="+re(vt(e)))}):t.push(re(n)+"="+re(vt(e))))}),t.join("&")}}}function yt(){this.$get=function(){return function(e){function t(e,r,i){null===e||b(e)||(Fr(e)?o(e,function(e,n){t(e,r+"["+(w(e)?n:"")+"]")}):w(e)&&!S(e)?a(e,function(e,n){t(e,r+(i?"":"[")+n+(i?"":"]"))}):n.push(re(r)+"="+re(vt(e))))}if(!e)return"";var n=[];return t(e,"",!0),n.join("&")}}}function bt(e,t){if(C(e)){var n=e.replace(Li,"").trim();if(n){var r=t("Content-Type");(r&&0===r.indexOf(Mi)||xt(n))&&(e=Q(n))}}return e}function xt(e){var t=e.match(Ii);return t&&Fi[t[0]].test(e)}function wt(e){function t(e,t){e&&(r[e]=r[e]?r[e]+", "+t:t)}var n,r=ve();return C(e)?o(e.split("\n"),function(e){n=e.indexOf(":"),t(xr(Ur(e.substr(0,n))),Ur(e.substr(n+1)))}):w(e)&&o(e,function(e,n){t(xr(n),Ur(e))}),r}function _t(e){var t;return function(n){if(t||(t=wt(e)),n){var r=t[xr(n)];return void 0===r&&(r=null),r}return t}}function Ct(e,t,n,r){return E(r)?r(e,t,n):(o(r,function(r){e=r(e,t,n)}),e)}function $t(e){return e>=200&&300>e}function St(){var e=this.defaults={transformResponse:[bt],transformRequest:[function(e){return!w(e)||O(e)||N(e)||R(e)?e:K(e)}],headers:{common:{Accept:"application/json, text/plain, */*"},post:H(Di),put:H(Di),patch:H(Di)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer"},t=!1;this.useApplyAsync=function(e){return x(e)?(t=!!e,this):t};var i=!0;this.useLegacyPromiseExtensions=function(e){return x(e)?(i=!!e,this):i};var a=this.interceptors=[];this.$get=["$httpBackend","$$cookieReader","$cacheFactory","$rootScope","$q","$injector",function(s,u,c,l,p,d){function h(t){function a(e){var t=f({},e);return t.data=e.data?Ct(e.data,e.headers,e.status,c.transformResponse):e.data,$t(e.status)?t:p.reject(t)}function s(e,t){var n,r={};return o(e,function(e,i){E(e)?(n=e(t),null!=n&&(r[i]=n)):r[i]=e}),r}function u(t){var n,r,i,o=e.headers,a=f({},t.headers);o=f({},o.common,o[xr(t.method)]);e:for(n in o){r=xr(n);for(i in a)if(xr(i)===r)continue e;a[n]=o[n]}return s(a,H(t))}if(!Mr.isObject(t))throw r("$http")("badreq","Http request configuration must be an object. Received: {0}",t);var c=f({method:"get",transformRequest:e.transformRequest,transformResponse:e.transformResponse,paramSerializer:e.paramSerializer},t);c.headers=u(t),c.method=_r(c.method),c.paramSerializer=C(c.paramSerializer)?d.get(c.paramSerializer):c.paramSerializer;var l=function(t){var r=t.headers,i=Ct(t.data,_t(r),n,t.transformRequest);return b(i)&&o(r,function(e,t){"content-type"===xr(t)&&delete r[t]}),b(t.withCredentials)&&!b(e.withCredentials)&&(t.withCredentials=e.withCredentials),g(t,i).then(a,a)},h=[l,n],m=p.when(c);for(o($,function(e){(e.request||e.requestError)&&h.unshift(e.request,e.requestError),(e.response||e.responseError)&&h.push(e.response,e.responseError)});h.length;){var v=h.shift(),y=h.shift();m=m.then(v,y)}return i?(m.success=function(e){return pe(e,"fn"),m.then(function(t){e(t.data,t.status,t.headers,c)}),m},m.error=function(e){return pe(e,"fn"),m.then(null,function(t){e(t.data,t.status,t.headers,c)}),m}):(m.success=Hi("success"),m.error=Hi("error")),m}function m(){o(arguments,function(e){h[e]=function(t,n){return h(f({},n||{},{method:e,url:t}))}})}function v(){o(arguments,function(e){h[e]=function(t,n,r){return h(f({},r||{},{method:e,url:t,data:n}))}})}function g(r,i){function o(e,n,r,i){function o(){a(n,e,r,i)}d&&($t(e)?d.put($,[e,n,wt(r),i]):d.remove($)),t?l.$applyAsync(o):(o(),l.$$phase||l.$apply())}function a(e,t,n,i){t=t>=-1?t:0,($t(t)?v.resolve:v.reject)({data:e,status:t,headers:_t(n),config:r,statusText:i})}function c(e){a(e.data,e.status,H(e.headers()),e.statusText)}function f(){var e=h.pendingRequests.indexOf(r);-1!==e&&h.pendingRequests.splice(e,1)}var d,m,v=p.defer(),g=v.promise,C=r.headers,$=y(r.url,r.paramSerializer(r.params));if(h.pendingRequests.push(r),g.then(f,f),!r.cache&&!e.cache||r.cache===!1||"GET"!==r.method&&"JSONP"!==r.method||(d=w(r.cache)?r.cache:w(e.cache)?e.cache:_),d&&(m=d.get($),x(m)?j(m)?m.then(c,c):Fr(m)?a(m[1],m[0],H(m[2]),m[3]):a(m,200,{},"OK"):d.put($,g)),b(m)){var S=Pn(r.url)?u()[r.xsrfCookieName||e.xsrfCookieName]:n;S&&(C[r.xsrfHeaderName||e.xsrfHeaderName]=S),s(r.method,$,i,o,C,r.timeout,r.withCredentials,r.responseType)}return g}function y(e,t){return t.length>0&&(e+=(-1==e.indexOf("?")?"?":"&")+t),e}var _=c("$http");e.paramSerializer=C(e.paramSerializer)?d.get(e.paramSerializer):e.paramSerializer;var $=[];return o(a,function(e){$.unshift(C(e)?d.get(e):d.invoke(e))}),h.pendingRequests=[],m("get","delete","head","jsonp"),v("post","put","patch"),h.defaults=e,h}]}function Et(){this.$get=function(){return function(){return new e.XMLHttpRequest}}}function Pt(){this.$get=["$browser","$window","$document","$xhrFactory",function(e,t,n,r){return kt(e,r,e.defer,t.angular.callbacks,n[0])}]}function kt(e,t,n,r,i){function a(e,t,n){var o=i.createElement("script"),a=null;return o.type="text/javascript",o.src=e,o.async=!0,a=function(e){ri(o,"load",a),ri(o,"error",a),i.body.removeChild(o),o=null;var s=-1,u="unknown";e&&("load"!==e.type||r[t].called||(e={type:"error"}),u=e.type,s="error"===e.type?404:200),n&&n(s,u)},ni(o,"load",a),ni(o,"error",a),i.body.appendChild(o),a}return function(i,s,u,c,l,f,p,d){function h(){y&&y(),w&&w.abort()}function v(t,r,i,o,a){x($)&&n.cancel($),y=w=null,t(r,i,o,a),e.$$completeOutstandingRequest(m)}if(e.$$incOutstandingRequestCount(),s=s||e.url(),"jsonp"==xr(i)){var g="_"+(r.counter++).toString(36);r[g]=function(e){r[g].data=e,r[g].called=!0};var y=a(s.replace("JSON_CALLBACK","angular.callbacks."+g),g,function(e,t){v(c,e,r[g].data,"",t),r[g]=m})}else{var w=t(i,s);w.open(i,s,!0),o(l,function(e,t){x(e)&&w.setRequestHeader(t,e)}),w.onload=function(){var e=w.statusText||"",t="response"in w?w.response:w.responseText,n=1223===w.status?204:w.status;0===n&&(n=t?200:"file"==En(s).protocol?404:0),v(c,n,t,w.getAllResponseHeaders(),e)};var _=function(){v(c,-1,null,null,"")};if(w.onerror=_,w.onabort=_,p&&(w.withCredentials=!0),d)try{w.responseType=d}catch(C){if("json"!==d)throw C}w.send(b(u)?null:u)}if(f>0)var $=n(h,f);else j(f)&&f.then(h)}}function Tt(){var e="{{",t="}}";this.startSymbol=function(t){return t?(e=t,this):e},this.endSymbol=function(e){return e?(t=e,this):t},this.$get=["$parse","$exceptionHandler","$sce",function(n,r,i){function o(e){return"\\\\\\"+e}function a(n){return n.replace(p,e).replace(d,t)}function s(e){if(null==e)return"";switch(typeof e){case"string":break;case"number":e=""+e;break;default:e=K(e)}return e}function u(o,u,p,d){function h(e){try{return e=k(e),d&&!x(e)?e:s(e)}catch(t){r(Vi.interr(o,t))}}d=!!d;for(var m,v,g,y=0,w=[],_=[],C=o.length,$=[],S=[];C>y;){if(-1==(m=o.indexOf(e,y))||-1==(v=o.indexOf(t,m+c))){y!==C&&$.push(a(o.substring(y)));break}y!==m&&$.push(a(o.substring(y,m))),g=o.substring(m+c,v),w.push(g),_.push(n(g,h)),y=v+l,S.push($.length),$.push("")}if(p&&$.length>1&&Vi.throwNoconcat(o),!u||w.length){var P=function(e){for(var t=0,n=w.length;n>t;t++){if(d&&b(e[t]))return;$[S[t]]=e[t]}return $.join("")},k=function(e){return p?i.getTrusted(p,e):i.valueOf(e)};return f(function(e){var t=0,n=w.length,i=new Array(n);try{for(;n>t;t++)i[t]=_[t](e);return P(i)}catch(a){r(Vi.interr(o,a))}},{exp:o,expressions:w,$$watchDelegate:function(e,t){var n;return e.$watchGroup(_,function(r,i){var o=P(r);E(t)&&t.call(this,o,r!==i?n:o,e),n=o})}})}}var c=e.length,l=t.length,p=new RegExp(e.replace(/./g,o),"g"),d=new RegExp(t.replace(/./g,o),"g");return u.startSymbol=function(){return e},u.endSymbol=function(){return t},u}]}function Ot(){this.$get=["$rootScope","$window","$q","$$q",function(e,t,n,r){function i(i,a,s,u){var c=arguments.length>4,l=c?B(arguments,4):[],f=t.setInterval,p=t.clearInterval,d=0,h=x(u)&&!u,m=(h?r:n).defer(),v=m.promise;return s=x(s)?s:0,v.then(null,null,c?function(){i.apply(null,l)}:i),v.$$intervalId=f(function(){m.notify(d++),s>0&&d>=s&&(m.resolve(d),p(v.$$intervalId),delete o[v.$$intervalId]),h||e.$apply()},a),o[v.$$intervalId]=m,v}var o={};return i.cancel=function(e){return e&&e.$$intervalId in o?(o[e.$$intervalId].reject("canceled"),t.clearInterval(e.$$intervalId),delete o[e.$$intervalId],!0):!1},i}]}function Rt(e){for(var t=e.split("/"),n=t.length;n--;)t[n]=ne(t[n]);return t.join("/")}function Nt(e,t){var n=En(e);t.$$protocol=n.protocol,t.$$host=n.hostname,t.$$port=d(n.port)||Bi[n.protocol]||null}function At(e,t){var n="/"!==e.charAt(0);n&&(e="/"+e);var r=En(e);t.$$path=decodeURIComponent(n&&"/"===r.pathname.charAt(0)?r.pathname.substring(1):r.pathname),t.$$search=ee(r.search),t.$$hash=decodeURIComponent(r.hash),t.$$path&&"/"!=t.$$path.charAt(0)&&(t.$$path="/"+t.$$path)}function jt(e,t){return 0===t.indexOf(e)?t.substr(e.length):void 0}function Mt(e){var t=e.indexOf("#");return-1==t?e:e.substr(0,t)}function Dt(e){return e.replace(/(#.+)|#$/,"$1")}function It(e){return e.substr(0,Mt(e).lastIndexOf("/")+1)}function Ft(e){return e.substring(0,e.indexOf("/",e.indexOf("//")+2))}function Lt(e,t,n){this.$$html5=!0,n=n||"",Nt(e,this),this.$$parse=function(e){var n=jt(t,e);if(!C(n))throw Wi("ipthprfx",'Invalid url "{0}", missing path prefix "{1}".',e,t);At(n,this),this.$$path||(this.$$path="/"),this.$$compose()},this.$$compose=function(){var e=te(this.$$search),n=this.$$hash?"#"+ne(this.$$hash):"";this.$$url=Rt(this.$$path)+(e?"?"+e:"")+n,this.$$absUrl=t+this.$$url.substr(1)},this.$$parseLinkUrl=function(r,i){if(i&&"#"===i[0])return this.hash(i.slice(1)),!0;var o,a,s;return x(o=jt(e,r))?(a=o,s=x(o=jt(n,o))?t+(jt("/",o)||o):e+a):x(o=jt(t,r))?s=t+o:t==r+"/"&&(s=t),s&&this.$$parse(s),!!s}}function Ut(e,t,n){Nt(e,this),this.$$parse=function(r){function i(e,t,n){var r,i=/^\/[A-Z]:(\/.*)/;return 0===t.indexOf(n)&&(t=t.replace(n,"")),i.exec(t)?e:(r=i.exec(e),r?r[1]:e)}var o,a=jt(e,r)||jt(t,r);b(a)||"#"!==a.charAt(0)?this.$$html5?o=a:(o="",b(a)&&(e=r,this.replace())):(o=jt(n,a),b(o)&&(o=a)),At(o,this),this.$$path=i(this.$$path,o,e),this.$$compose()},this.$$compose=function(){var t=te(this.$$search),r=this.$$hash?"#"+ne(this.$$hash):"";this.$$url=Rt(this.$$path)+(t?"?"+t:"")+r,this.$$absUrl=e+(this.$$url?n+this.$$url:"")},this.$$parseLinkUrl=function(t){return Mt(e)==Mt(t)?(this.$$parse(t),!0):!1}}function Ht(e,t,n){this.$$html5=!0,Ut.apply(this,arguments),this.$$parseLinkUrl=function(r,i){if(i&&"#"===i[0])return this.hash(i.slice(1)),!0;var o,a;return e==Mt(r)?o=r:(a=jt(t,r))?o=e+n+a:t===r+"/"&&(o=t),o&&this.$$parse(o),!!o},this.$$compose=function(){var t=te(this.$$search),r=this.$$hash?"#"+ne(this.$$hash):"";this.$$url=Rt(this.$$path)+(t?"?"+t:"")+r,this.$$absUrl=e+n+this.$$url}}function Vt(e){return function(){return this[e]}}function qt(e,t){return function(n){return b(n)?this[e]:(this[e]=t(n),this.$$compose(),this)}}function Bt(){var e="",t={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(t){return x(t)?(e=t,this):e},this.html5Mode=function(e){return A(e)?(t.enabled=e,this):w(e)?(A(e.enabled)&&(t.enabled=e.enabled),A(e.requireBase)&&(t.requireBase=e.requireBase),A(e.rewriteLinks)&&(t.rewriteLinks=e.rewriteLinks),this):t},this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(n,r,i,o,a){function s(e,t,n){var i=c.url(),o=c.$$state;try{r.url(e,t,n),c.$$state=r.state()}catch(a){throw c.url(i),c.$$state=o,a}}function u(e,t){n.$broadcast("$locationChangeSuccess",c.absUrl(),e,c.$$state,t)}var c,l,f,p=r.baseHref(),d=r.url();if(t.enabled){if(!p&&t.requireBase)throw Wi("nobase","$location in HTML5 mode requires a <base> tag to be present!");f=Ft(d)+(p||"/"),l=i.history?Lt:Ht}else f=Mt(d),l=Ut;var h=It(f);c=new l(f,h,"#"+e),c.$$parseLinkUrl(d,d),c.$$state=r.state();var m=/^\s*(javascript|mailto):/i;o.on("click",function(e){if(t.rewriteLinks&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&2!=e.which&&2!=e.button){for(var i=Er(e.target);"a"!==F(i[0]);)if(i[0]===o[0]||!(i=i.parent())[0])return;var s=i.prop("href"),u=i.attr("href")||i.attr("xlink:href");w(s)&&"[object SVGAnimatedString]"===s.toString()&&(s=En(s.animVal).href),m.test(s)||!s||i.attr("target")||e.isDefaultPrevented()||c.$$parseLinkUrl(s,u)&&(e.preventDefault(),c.absUrl()!=r.url()&&(n.$apply(),a.angular["ff-684208-preventDefault"]=!0))}}),Dt(c.absUrl())!=Dt(d)&&r.url(c.absUrl(),!0);var v=!0;return r.onUrlChange(function(e,t){return b(jt(h,e))?void(a.location.href=e):(n.$evalAsync(function(){var r,i=c.absUrl(),o=c.$$state;c.$$parse(e),c.$$state=t,r=n.$broadcast("$locationChangeStart",e,i,t,o).defaultPrevented,c.absUrl()===e&&(r?(c.$$parse(i),c.$$state=o,s(i,!1,o)):(v=!1,u(i,o)))}),void(n.$$phase||n.$digest()))}),n.$watch(function(){var e=Dt(r.url()),t=Dt(c.absUrl()),o=r.state(),a=c.$$replace,l=e!==t||c.$$html5&&i.history&&o!==c.$$state;(v||l)&&(v=!1,n.$evalAsync(function(){var t=c.absUrl(),r=n.$broadcast("$locationChangeStart",t,e,c.$$state,o).defaultPrevented;c.absUrl()===t&&(r?(c.$$parse(e),c.$$state=o):(l&&s(t,a,o===c.$$state?null:c.$$state),u(e,o)))})),c.$$replace=!1}),c}]}function Wt(){var e=!0,t=this;this.debugEnabled=function(t){return x(t)?(e=t,this):e},this.$get=["$window",function(n){function r(e){return e instanceof Error&&(e.stack?e=e.message&&-1===e.stack.indexOf(e.message)?"Error: "+e.message+"\n"+e.stack:e.stack:e.sourceURL&&(e=e.message+"\n"+e.sourceURL+":"+e.line)),e}function i(e){var t=n.console||{},i=t[e]||t.log||m,a=!1;try{a=!!i.apply}catch(s){}return a?function(){var e=[];return o(arguments,function(t){e.push(r(t))}),i.apply(t,e)}:function(e,t){i(e,null==t?"":t)}}return{log:i("log"),info:i("info"),warn:i("warn"),error:i("error"),debug:function(){var n=i("debug");return function(){e&&n.apply(t,arguments)}}()}}]}function zt(e,t){if("__defineGetter__"===e||"__defineSetter__"===e||"__lookupGetter__"===e||"__lookupSetter__"===e||"__proto__"===e)throw Ki("isecfld","Attempting to access a disallowed field in Angular expressions! Expression: {0}",t);return e}function Kt(e,t){if(e+="",!C(e))throw Ki("iseccst","Cannot convert object to primitive value! Expression: {0}",t);return e}function Qt(e,t){if(e){if(e.constructor===e)throw Ki("isecfn","Referencing Function in Angular expressions is disallowed! Expression: {0}",t);if(e.window===e)throw Ki("isecwindow","Referencing the Window in Angular expressions is disallowed! Expression: {0}",t);if(e.children&&(e.nodeName||e.prop&&e.attr&&e.find))throw Ki("isecdom","Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}",t);if(e===Object)throw Ki("isecobj","Referencing Object in Angular expressions is disallowed! Expression: {0}",t)}return e}function Gt(e,t){if(e){if(e.constructor===e)throw Ki("isecfn","Referencing Function in Angular expressions is disallowed! Expression: {0}",t);if(e===Qi||e===Gi||e===Yi)throw Ki("isecff","Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}",t)}}function Yt(e,t){if(e&&(e===0..constructor||e===(!1).constructor||e==="".constructor||e==={}.constructor||e===[].constructor||e===Function.constructor))throw Ki("isecaf","Assigning to a constructor is disallowed! Expression: {0}",t)}function Xt(e,t){return"undefined"!=typeof e?e:t}function Jt(e,t){return"undefined"==typeof e?t:"undefined"==typeof t?e:e+t}function Zt(e,t){var n=e(t);return!n.$stateful}function en(e,t){var n,r;switch(e.type){case eo.Program:n=!0,o(e.body,function(e){en(e.expression,t),n=n&&e.expression.constant}),e.constant=n;break;case eo.Literal:e.constant=!0,e.toWatch=[];break;case eo.UnaryExpression:en(e.argument,t),e.constant=e.argument.constant,e.toWatch=e.argument.toWatch;break;case eo.BinaryExpression:en(e.left,t),en(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.left.toWatch.concat(e.right.toWatch);break;case eo.LogicalExpression:en(e.left,t),en(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=e.constant?[]:[e];break;case eo.ConditionalExpression:en(e.test,t),en(e.alternate,t),en(e.consequent,t),e.constant=e.test.constant&&e.alternate.constant&&e.consequent.constant,e.toWatch=e.constant?[]:[e];break;case eo.Identifier:e.constant=!1,e.toWatch=[e];break;case eo.MemberExpression:en(e.object,t),e.computed&&en(e.property,t),e.constant=e.object.constant&&(!e.computed||e.property.constant),e.toWatch=[e];break;case eo.CallExpression:n=e.filter?Zt(t,e.callee.name):!1,r=[],o(e.arguments,function(e){en(e,t),n=n&&e.constant,e.constant||r.push.apply(r,e.toWatch)}),e.constant=n,e.toWatch=e.filter&&Zt(t,e.callee.name)?r:[e];break;case eo.AssignmentExpression:en(e.left,t),en(e.right,t),e.constant=e.left.constant&&e.right.constant,e.toWatch=[e];break;case eo.ArrayExpression:n=!0,r=[],o(e.elements,function(e){en(e,t),n=n&&e.constant,e.constant||r.push.apply(r,e.toWatch)}),e.constant=n,e.toWatch=r;break;case eo.ObjectExpression:n=!0,r=[],o(e.properties,function(e){en(e.value,t),n=n&&e.value.constant,e.value.constant||r.push.apply(r,e.value.toWatch)}),e.constant=n,e.toWatch=r;break;case eo.ThisExpression:e.constant=!1,e.toWatch=[]}}function tn(e){if(1==e.length){var t=e[0].expression,r=t.toWatch;return 1!==r.length?r:r[0]!==t?r:n}}function nn(e){return e.type===eo.Identifier||e.type===eo.MemberExpression}function rn(e){return 1===e.body.length&&nn(e.body[0].expression)?{type:eo.AssignmentExpression,left:e.body[0].expression,right:{type:eo.NGValueParameter},operator:"="}:void 0}function on(e){return 0===e.body.length||1===e.body.length&&(e.body[0].expression.type===eo.Literal||e.body[0].expression.type===eo.ArrayExpression||e.body[0].expression.type===eo.ObjectExpression)}function an(e){return e.constant}function sn(e,t){this.astBuilder=e,this.$filter=t}function un(e,t){this.astBuilder=e,this.$filter=t}function cn(e){return"constructor"==e}function ln(e){return E(e.valueOf)?e.valueOf():no.call(e)}function fn(){var e=ve(),t=ve();this.$get=["$filter",function(r){function i(e,t){return null==e||null==t?e===t:"object"==typeof e&&(e=ln(e),"object"==typeof e)?!1:e===t||e!==e&&t!==t}function a(e,t,r,o,a){var s,u=o.inputs;if(1===u.length){var c=i;return u=u[0],e.$watch(function(e){var t=u(e);return i(t,c)||(s=o(e,n,n,[t]),c=t&&ln(t)),s},t,r,a)}for(var l=[],f=[],p=0,d=u.length;d>p;p++)l[p]=i,f[p]=null;return e.$watch(function(e){for(var t=!1,r=0,a=u.length;a>r;r++){var c=u[r](e);(t||(t=!i(c,l[r])))&&(f[r]=c,l[r]=c&&ln(c))}return t&&(s=o(e,n,n,f)),s},t,r,a)}function s(e,t,n,r){var i,o;return i=e.$watch(function(e){return r(e)},function(e,n,r){o=e,E(t)&&t.apply(this,arguments),x(e)&&r.$$postDigest(function(){x(o)&&i()})},n)}function u(e,t,n,r){function i(e){var t=!0;return o(e,function(e){x(e)||(t=!1)}),t}var a,s;return a=e.$watch(function(e){return r(e)},function(e,n,r){s=e,E(t)&&t.call(this,e,n,r),i(e)&&r.$$postDigest(function(){i(s)&&a()})},n)}function c(e,t,n,r){var i;return i=e.$watch(function(e){return r(e)},function(){E(t)&&t.apply(this,arguments),i()},n)}function l(e,t){if(!t)return e;var n=e.$$watchDelegate,r=n!==u&&n!==s,i=r?function(n,r,i,o){var a=e(n,r,i,o);return t(a,n,r)}:function(n,r,i,o){var a=e(n,r,i,o),s=t(a,n,r);return x(a)?s:a};return e.$$watchDelegate&&e.$$watchDelegate!==a?i.$$watchDelegate=e.$$watchDelegate:t.$stateful||(i.$$watchDelegate=a,i.inputs=e.inputs?e.inputs:[e]),i}var f=Vr().noUnsafeEval,p={csp:f,expensiveChecks:!1},d={csp:f,expensiveChecks:!0};return function(n,i,o){var f,h,v;switch(typeof n){case"string":n=n.trim(),v=n;var g=o?t:e;if(f=g[v],!f){":"===n.charAt(0)&&":"===n.charAt(1)&&(h=!0,n=n.substring(2));var y=o?d:p,b=new Zi(y),x=new to(b,r,y);f=x.parse(n),f.constant?f.$$watchDelegate=c:h?f.$$watchDelegate=f.literal?u:s:f.inputs&&(f.$$watchDelegate=a),g[v]=f}return l(f,i);case"function":return l(n,i);default:return m}}}]}function pn(){this.$get=["$rootScope","$exceptionHandler",function(e,t){return hn(function(t){e.$evalAsync(t)},t)}]}function dn(){this.$get=["$browser","$exceptionHandler",function(e,t){return hn(function(t){e.defer(t)},t)}]}function hn(e,t){function i(e,t,n){function r(t){return function(n){i||(i=!0,t.call(e,n))}}var i=!1;return[r(t),r(n)]}function a(){this.$$state={status:0}}function s(e,t){return function(n){t.call(e,n)}}function u(e){var r,i,o;o=e.pending,e.processScheduled=!1,e.pending=n;for(var a=0,s=o.length;s>a;++a){i=o[a][0],r=o[a][e.status];try{E(r)?i.resolve(r(e.value)):1===e.status?i.resolve(e.value):i.reject(e.value)}catch(u){i.reject(u),t(u)}}}function c(t){!t.processScheduled&&t.pending&&(t.processScheduled=!0,e(function(){u(t)}))}function l(){this.promise=new a,this.resolve=s(this,this.resolve),this.reject=s(this,this.reject),this.notify=s(this,this.notify)}function p(e){var t=new l,n=0,r=Fr(e)?[]:{};return o(e,function(e,i){n++,y(e).then(function(e){r.hasOwnProperty(i)||(r[i]=e,--n||t.resolve(r))},function(e){r.hasOwnProperty(i)||t.reject(e)})}),0===n&&t.resolve(r),t.promise}var d=r("$q",TypeError),h=function(){return new l};f(a.prototype,{then:function(e,t,n){if(b(e)&&b(t)&&b(n))return this;var r=new l;return this.$$state.pending=this.$$state.pending||[],this.$$state.pending.push([r,e,t,n]),this.$$state.status>0&&c(this.$$state),r.promise},"catch":function(e){return this.then(null,e)},"finally":function(e,t){return this.then(function(t){return g(t,!0,e)},function(t){return g(t,!1,e)},t)}}),f(l.prototype,{resolve:function(e){this.promise.$$state.status||(e===this.promise?this.$$reject(d("qcycle","Expected promise to be resolved with value other than itself '{0}'",e)):this.$$resolve(e))},$$resolve:function(e){var n,r;r=i(this,this.$$resolve,this.$$reject);try{(w(e)||E(e))&&(n=e&&e.then),E(n)?(this.promise.$$state.status=-1,n.call(e,r[0],r[1],this.notify)):(this.promise.$$state.value=e,this.promise.$$state.status=1,c(this.promise.$$state))}catch(o){r[1](o),t(o)}},reject:function(e){this.promise.$$state.status||this.$$reject(e)},$$reject:function(e){this.promise.$$state.value=e,this.promise.$$state.status=2,c(this.promise.$$state)},notify:function(n){var r=this.promise.$$state.pending;this.promise.$$state.status<=0&&r&&r.length&&e(function(){for(var e,i,o=0,a=r.length;a>o;o++){i=r[o][0],e=r[o][3];try{i.notify(E(e)?e(n):n)}catch(s){t(s)}}})}});var m=function(e){var t=new l;return t.reject(e),t.promise},v=function(e,t){var n=new l;return t?n.resolve(e):n.reject(e),n.promise},g=function(e,t,n){var r=null;try{E(n)&&(r=n())}catch(i){return v(i,!1)}return j(r)?r.then(function(){return v(e,t)},function(e){return v(e,!1)}):v(e,t)},y=function(e,t,n,r){var i=new l;return i.resolve(e),i.promise.then(t,n,r)},x=y,_=function C(e){function t(e){r.resolve(e)}function n(e){r.reject(e)}if(!E(e))throw d("norslvr","Expected resolverFn, got '{0}'",e);if(!(this instanceof C))return new C(e);var r=new l;return e(t,n),r.promise};return _.defer=h,_.reject=m,_.when=y,_.resolve=x,_.all=p,_}function mn(){this.$get=["$window","$timeout",function(e,t){var n=e.requestAnimationFrame||e.webkitRequestAnimationFrame,r=e.cancelAnimationFrame||e.webkitCancelAnimationFrame||e.webkitCancelRequestAnimationFrame,i=!!n,o=i?function(e){var t=n(e);return function(){r(t)}}:function(e){var n=t(e,16.66,!1);return function(){t.cancel(n)}};return o.supported=i,o}]}function vn(){function e(e){function t(){this.$$watchers=this.$$nextSibling=this.$$childHead=this.$$childTail=null,this.$$listeners={},this.$$listenerCount={},this.$$watchersCount=0,this.$id=u(),this.$$ChildScope=null}return t.prototype=e,t}var t=10,n=r("$rootScope"),a=null,s=null;this.digestTtl=function(e){return arguments.length&&(t=e),t},this.$get=["$injector","$exceptionHandler","$parse","$browser",function(r,c,l,f){function p(e){e.currentScope.$$destroyed=!0}function d(){this.$id=u(),this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null,this.$root=this,this.$$destroyed=!1,this.$$listeners={},this.$$listenerCount={},this.$$watchersCount=0,this.$$isolateBindings=null}function h(e){if($.$$phase)throw n("inprog","{0} already in progress",$.$$phase);$.$$phase=e}function v(){$.$$phase=null}function g(e,t){do e.$$watchersCount+=t;while(e=e.$parent)}function y(e,t,n){do e.$$listenerCount[n]-=t,0===e.$$listenerCount[n]&&delete e.$$listenerCount[n];while(e=e.$parent)}function x(){}function _(){for(;k.length;)try{k.shift()()}catch(e){c(e)}s=null}function C(){null===s&&(s=f.defer(function(){$.$apply(_)}))}d.prototype={constructor:d,$new:function(t,n){var r;return n=n||this,t?(r=new d,r.$root=this.$root):(this.$$ChildScope||(this.$$ChildScope=e(this)),r=new this.$$ChildScope),r.$parent=n,r.$$prevSibling=n.$$childTail,n.$$childHead?(n.$$childTail.$$nextSibling=r,n.$$childTail=r):n.$$childHead=n.$$childTail=r,(t||n!=this)&&r.$on("$destroy",p),r},$watch:function(e,t,n,r){var i=l(e);if(i.$$watchDelegate)return i.$$watchDelegate(this,t,n,i,e);var o=this,s=o.$$watchers,u={fn:t,last:x,get:i,exp:r||e,eq:!!n};return a=null,E(t)||(u.fn=m),s||(s=o.$$watchers=[]),s.unshift(u),g(this,1),function(){L(s,u)>=0&&g(o,-1),a=null}},$watchGroup:function(e,t){function n(){u=!1,c?(c=!1,t(i,i,s)):t(i,r,s)}var r=new Array(e.length),i=new Array(e.length),a=[],s=this,u=!1,c=!0;if(!e.length){var l=!0;return s.$evalAsync(function(){l&&t(i,i,s)}),function(){l=!1}}return 1===e.length?this.$watch(e[0],function(e,n,o){i[0]=e,r[0]=n,t(i,e===n?i:r,o)}):(o(e,function(e,t){var o=s.$watch(e,function(e,o){i[t]=e,r[t]=o,u||(u=!0,s.$evalAsync(n))});a.push(o)}),function(){for(;a.length;)a.shift()()})},$watchCollection:function(e,t){function n(e){o=e;var t,n,r,s,u;if(!b(o)){if(w(o))if(i(o)){a!==d&&(a=d,v=a.length=0,f++),t=o.length,v!==t&&(f++,a.length=v=t);for(var c=0;t>c;c++)u=a[c],s=o[c],r=u!==u&&s!==s,r||u===s||(f++,a[c]=s)}else{a!==h&&(a=h={},v=0,f++),t=0;for(n in o)wr.call(o,n)&&(t++,s=o[n],u=a[n],n in a?(r=u!==u&&s!==s,r||u===s||(f++,a[n]=s)):(v++,a[n]=s,f++));if(v>t){f++;for(n in a)wr.call(o,n)||(v--,delete a[n])}}else a!==o&&(a=o,f++);return f}}function r(){if(m?(m=!1,t(o,o,u)):t(o,s,u),c)if(w(o))if(i(o)){s=new Array(o.length);for(var e=0;e<o.length;e++)s[e]=o[e]}else{s={};for(var n in o)wr.call(o,n)&&(s[n]=o[n])}else s=o}n.$stateful=!0;var o,a,s,u=this,c=t.length>1,f=0,p=l(e,n),d=[],h={},m=!0,v=0;return this.$watch(p,r)},$digest:function(){var e,r,i,o,u,l,p,d,m,g,y=t,b=this,w=[];h("$digest"),f.$$checkUrlChange(),this===$&&null!==s&&(f.defer.cancel(s),_()),a=null;do{for(l=!1,d=b;S.length;){try{g=S.shift(),g.scope.$eval(g.expression,g.locals)}catch(C){c(C)}a=null}e:do{if(o=d.$$watchers)for(u=o.length;u--;)try{if(e=o[u])if((r=e.get(d))===(i=e.last)||(e.eq?V(r,i):"number"==typeof r&&"number"==typeof i&&isNaN(r)&&isNaN(i))){if(e===a){l=!1;break e}}else l=!0,a=e,e.last=e.eq?U(r,null):r,e.fn(r,i===x?r:i,d),5>y&&(m=4-y,w[m]||(w[m]=[]),w[m].push({msg:E(e.exp)?"fn: "+(e.exp.name||e.exp.toString()):e.exp,newVal:r,oldVal:i}))}catch(C){c(C)}if(!(p=d.$$watchersCount&&d.$$childHead||d!==b&&d.$$nextSibling))for(;d!==b&&!(p=d.$$nextSibling);)d=d.$parent}while(d=p);if((l||S.length)&&!y--)throw v(),n("infdig","{0} $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: {1}",t,w)}while(l||S.length);for(v();P.length;)try{P.shift()()}catch(C){c(C)}},$destroy:function(){if(!this.$$destroyed){var e=this.$parent;this.$broadcast("$destroy"),this.$$destroyed=!0,this===$&&f.$$applicationDestroyed(),g(this,-this.$$watchersCount);for(var t in this.$$listenerCount)y(this,this.$$listenerCount[t],t);e&&e.$$childHead==this&&(e.$$childHead=this.$$nextSibling),e&&e.$$childTail==this&&(e.$$childTail=this.$$prevSibling),this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling),this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling),this.$destroy=this.$digest=this.$apply=this.$evalAsync=this.$applyAsync=m,this.$on=this.$watch=this.$watchGroup=function(){return m},this.$$listeners={},
31
- this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=this.$root=this.$$watchers=null}},$eval:function(e,t){return l(e)(this,t)},$evalAsync:function(e,t){$.$$phase||S.length||f.defer(function(){S.length&&$.$digest()}),S.push({scope:this,expression:e,locals:t})},$$postDigest:function(e){P.push(e)},$apply:function(e){try{h("$apply");try{return this.$eval(e)}finally{v()}}catch(t){c(t)}finally{try{$.$digest()}catch(t){throw c(t),t}}},$applyAsync:function(e){function t(){n.$eval(e)}var n=this;e&&k.push(t),C()},$on:function(e,t){var n=this.$$listeners[e];n||(this.$$listeners[e]=n=[]),n.push(t);var r=this;do r.$$listenerCount[e]||(r.$$listenerCount[e]=0),r.$$listenerCount[e]++;while(r=r.$parent);var i=this;return function(){var r=n.indexOf(t);-1!==r&&(n[r]=null,y(i,1,e))}},$emit:function(e){var t,n,r,i=[],o=this,a=!1,s={name:e,targetScope:o,stopPropagation:function(){a=!0},preventDefault:function(){s.defaultPrevented=!0},defaultPrevented:!1},u=q([s],arguments,1);do{for(t=o.$$listeners[e]||i,s.currentScope=o,n=0,r=t.length;r>n;n++)if(t[n])try{t[n].apply(null,u)}catch(l){c(l)}else t.splice(n,1),n--,r--;if(a)return s.currentScope=null,s;o=o.$parent}while(o);return s.currentScope=null,s},$broadcast:function(e){var t=this,n=t,r=t,i={name:e,targetScope:t,preventDefault:function(){i.defaultPrevented=!0},defaultPrevented:!1};if(!t.$$listenerCount[e])return i;for(var o,a,s,u=q([i],arguments,1);n=r;){for(i.currentScope=n,o=n.$$listeners[e]||[],a=0,s=o.length;s>a;a++)if(o[a])try{o[a].apply(null,u)}catch(l){c(l)}else o.splice(a,1),a--,s--;if(!(r=n.$$listenerCount[e]&&n.$$childHead||n!==t&&n.$$nextSibling))for(;n!==t&&!(r=n.$$nextSibling);)n=n.$parent}return i.currentScope=null,i}};var $=new d,S=$.$$asyncQueue=[],P=$.$$postDigestQueue=[],k=$.$$applyAsyncQueue=[];return $}]}function gn(){var e=/^\s*(https?|ftp|mailto|tel|file):/,t=/^\s*((https?|ftp|file|blob):|data:image\/)/;this.aHrefSanitizationWhitelist=function(t){return x(t)?(e=t,this):e},this.imgSrcSanitizationWhitelist=function(e){return x(e)?(t=e,this):t},this.$get=function(){return function(n,r){var i,o=r?t:e;return i=En(n).href,""===i||i.match(o)?n:"unsafe:"+i}}}function yn(e){if("self"===e)return e;if(C(e)){if(e.indexOf("***")>-1)throw ro("iwcard","Illegal sequence *** in string matcher. String: {0}",e);return e=Hr(e).replace("\\*\\*",".*").replace("\\*","[^:/.?&;]*"),new RegExp("^"+e+"$")}if(P(e))return new RegExp("^"+e.source+"$");throw ro("imatcher",'Matchers may only be "self", string patterns or RegExp objects')}function bn(e){var t=[];return x(e)&&o(e,function(e){t.push(yn(e))}),t}function xn(){this.SCE_CONTEXTS=io;var e=["self"],t=[];this.resourceUrlWhitelist=function(t){return arguments.length&&(e=bn(t)),e},this.resourceUrlBlacklist=function(e){return arguments.length&&(t=bn(e)),t},this.$get=["$injector",function(n){function r(e,t){return"self"===e?Pn(t):!!e.exec(t.href)}function i(n){var i,o,a=En(n.toString()),s=!1;for(i=0,o=e.length;o>i;i++)if(r(e[i],a)){s=!0;break}if(s)for(i=0,o=t.length;o>i;i++)if(r(t[i],a)){s=!1;break}return s}function o(e){var t=function(e){this.$$unwrapTrustedValue=function(){return e}};return e&&(t.prototype=new e),t.prototype.valueOf=function(){return this.$$unwrapTrustedValue()},t.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()},t}function a(e,t){var n=f.hasOwnProperty(e)?f[e]:null;if(!n)throw ro("icontext","Attempted to trust a value in invalid context. Context: {0}; Value: {1}",e,t);if(null===t||b(t)||""===t)return t;if("string"!=typeof t)throw ro("itype","Attempted to trust a non-string value in a content requiring a string: Context: {0}",e);return new n(t)}function s(e){return e instanceof l?e.$$unwrapTrustedValue():e}function u(e,t){if(null===t||b(t)||""===t)return t;var n=f.hasOwnProperty(e)?f[e]:null;if(n&&t instanceof n)return t.$$unwrapTrustedValue();if(e===io.RESOURCE_URL){if(i(t))return t;throw ro("insecurl","Blocked loading resource from url not allowed by $sceDelegate policy. URL: {0}",t.toString())}if(e===io.HTML)return c(t);throw ro("unsafe","Attempting to use an unsafe value in a safe context.")}var c=function(){throw ro("unsafe","Attempting to use an unsafe value in a safe context.")};n.has("$sanitize")&&(c=n.get("$sanitize"));var l=o(),f={};return f[io.HTML]=o(l),f[io.CSS]=o(l),f[io.URL]=o(l),f[io.JS]=o(l),f[io.RESOURCE_URL]=o(f[io.URL]),{trustAs:a,getTrusted:u,valueOf:s}}]}function wn(){var e=!0;this.enabled=function(t){return arguments.length&&(e=!!t),e},this.$get=["$parse","$sceDelegate",function(t,n){if(e&&8>Sr)throw ro("iequirks","Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks mode. You can fix this by adding the text <!doctype html> to the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more information.");var r=H(io);r.isEnabled=function(){return e},r.trustAs=n.trustAs,r.getTrusted=n.getTrusted,r.valueOf=n.valueOf,e||(r.trustAs=r.getTrusted=function(e,t){return t},r.valueOf=v),r.parseAs=function(e,n){var i=t(n);return i.literal&&i.constant?i:t(n,function(t){return r.getTrusted(e,t)})};var i=r.parseAs,a=r.getTrusted,s=r.trustAs;return o(io,function(e,t){var n=xr(t);r[_e("parse_as_"+n)]=function(t){return i(e,t)},r[_e("get_trusted_"+n)]=function(t){return a(e,t)},r[_e("trust_as_"+n)]=function(t){return s(e,t)}}),r}]}function _n(){this.$get=["$window","$document",function(e,t){var n,r,i={},o=d((/android (\d+)/.exec(xr((e.navigator||{}).userAgent))||[])[1]),a=/Boxee/i.test((e.navigator||{}).userAgent),s=t[0]||{},u=/^(Moz|webkit|ms)(?=[A-Z])/,c=s.body&&s.body.style,l=!1,f=!1;if(c){for(var p in c)if(r=u.exec(p)){n=r[0],n=n.substr(0,1).toUpperCase()+n.substr(1);break}n||(n="WebkitOpacity"in c&&"webkit"),l=!!("transition"in c||n+"Transition"in c),f=!!("animation"in c||n+"Animation"in c),!o||l&&f||(l=C(c.webkitTransition),f=C(c.webkitAnimation))}return{history:!(!e.history||!e.history.pushState||4>o||a),hasEvent:function(e){if("input"===e&&11>=Sr)return!1;if(b(i[e])){var t=s.createElement("div");i[e]="on"+e in t}return i[e]},csp:Vr(),vendorPrefix:n,transitions:l,animations:f,android:o}}]}function Cn(){this.$get=["$templateCache","$http","$q","$sce",function(e,t,n,r){function i(o,a){function s(e){if(!a)throw Oi("tpload","Failed to load template: {0} (HTTP status: {1} {2})",o,e.status,e.statusText);return n.reject(e)}i.totalPendingRequests++,C(o)&&e.get(o)||(o=r.getTrustedResourceUrl(o));var u=t.defaults&&t.defaults.transformResponse;Fr(u)?u=u.filter(function(e){return e!==bt}):u===bt&&(u=null);var c={cache:e,transformResponse:u};return t.get(o,c)["finally"](function(){i.totalPendingRequests--}).then(function(t){return e.put(o,t.data),t.data},s)}return i.totalPendingRequests=0,i}]}function $n(){this.$get=["$rootScope","$browser","$location",function(e,t,n){var r={};return r.findBindings=function(e,t,n){var r=e.getElementsByClassName("ng-binding"),i=[];return o(r,function(e){var r=Mr.element(e).data("$binding");r&&o(r,function(r){if(n){var o=new RegExp("(^|\\s)"+Hr(t)+"(\\s|\\||$)");o.test(r)&&i.push(e)}else-1!=r.indexOf(t)&&i.push(e)})}),i},r.findModels=function(e,t,n){for(var r=["ng-","data-ng-","ng\\:"],i=0;i<r.length;++i){var o=n?"=":"*=",a="["+r[i]+"model"+o+'"'+t+'"]',s=e.querySelectorAll(a);if(s.length)return s}},r.getLocation=function(){return n.url()},r.setLocation=function(t){t!==n.url()&&(n.url(t),e.$digest())},r.whenStable=function(e){t.notifyWhenNoOutstandingRequests(e)},r}]}function Sn(){this.$get=["$rootScope","$browser","$q","$$q","$exceptionHandler",function(e,t,n,r,i){function o(o,s,u){E(o)||(u=s,s=o,o=m);var c,l=B(arguments,3),f=x(u)&&!u,p=(f?r:n).defer(),d=p.promise;return c=t.defer(function(){try{p.resolve(o.apply(null,l))}catch(t){p.reject(t),i(t)}finally{delete a[d.$$timeoutId]}f||e.$apply()},s),d.$$timeoutId=c,a[c]=p,d}var a={};return o.cancel=function(e){return e&&e.$$timeoutId in a?(a[e.$$timeoutId].reject("canceled"),delete a[e.$$timeoutId],t.defer.cancel(e.$$timeoutId)):!1},o}]}function En(e){var t=e;return Sr&&(oo.setAttribute("href",t),t=oo.href),oo.setAttribute("href",t),{href:oo.href,protocol:oo.protocol?oo.protocol.replace(/:$/,""):"",host:oo.host,search:oo.search?oo.search.replace(/^\?/,""):"",hash:oo.hash?oo.hash.replace(/^#/,""):"",hostname:oo.hostname,port:oo.port,pathname:"/"===oo.pathname.charAt(0)?oo.pathname:"/"+oo.pathname}}function Pn(e){var t=C(e)?En(e):e;return t.protocol===ao.protocol&&t.host===ao.host}function kn(){this.$get=g(e)}function Tn(e){function t(e){try{return decodeURIComponent(e)}catch(t){return e}}var n=e[0]||{},r={},i="";return function(){var e,o,a,s,u,c=n.cookie||"";if(c!==i)for(i=c,e=i.split("; "),r={},a=0;a<e.length;a++)o=e[a],s=o.indexOf("="),s>0&&(u=t(o.substring(0,s)),b(r[u])&&(r[u]=t(o.substring(s+1))));return r}}function On(){this.$get=Tn}function Rn(e){function t(r,i){if(w(r)){var a={};return o(r,function(e,n){a[n]=t(n,e)}),a}return e.factory(r+n,i)}var n="Filter";this.register=t,this.$get=["$injector",function(e){return function(t){return e.get(t+n)}}],t("currency",Dn),t("date",Gn),t("filter",Nn),t("json",Yn),t("limitTo",Xn),t("lowercase",fo),t("number",In),t("orderBy",Jn),t("uppercase",po)}function Nn(){return function(e,t,n){if(!i(e)){if(null==e)return e;throw r("filter")("notarray","Expected array but received: {0}",e)}var o,a,s=Mn(t);switch(s){case"function":o=t;break;case"boolean":case"null":case"number":case"string":a=!0;case"object":o=An(t,n,a);break;default:return e}return Array.prototype.filter.call(e,o)}}function An(e,t,n){var r,i=w(e)&&"$"in e;return t===!0?t=V:E(t)||(t=function(e,t){return b(e)?!1:null===e||null===t?e===t:w(t)||w(e)&&!y(e)?!1:(e=xr(""+e),t=xr(""+t),-1!==e.indexOf(t))}),r=function(r){return i&&!w(r)?jn(r,e.$,t,!1):jn(r,e,t,n)}}function jn(e,t,n,r,i){var o=Mn(e),a=Mn(t);if("string"===a&&"!"===t.charAt(0))return!jn(e,t.substring(1),n,r);if(Fr(e))return e.some(function(e){return jn(e,t,n,r)});switch(o){case"object":var s;if(r){for(s in e)if("$"!==s.charAt(0)&&jn(e[s],t,n,!0))return!0;return i?!1:jn(e,t,n,!1)}if("object"===a){for(s in t){var u=t[s];if(!E(u)&&!b(u)){var c="$"===s,l=c?e:e[s];if(!jn(l,u,n,c,c))return!1}}return!0}return n(e,t);case"function":return!1;default:return n(e,t)}}function Mn(e){return null===e?"null":typeof e}function Dn(e){var t=e.NUMBER_FORMATS;return function(e,n,r){return b(n)&&(n=t.CURRENCY_SYM),b(r)&&(r=t.PATTERNS[1].maxFrac),null==e?e:Fn(e,t.PATTERNS[1],t.GROUP_SEP,t.DECIMAL_SEP,r).replace(/\u00A4/g,n)}}function In(e){var t=e.NUMBER_FORMATS;return function(e,n){return null==e?e:Fn(e,t.PATTERNS[0],t.GROUP_SEP,t.DECIMAL_SEP,n)}}function Fn(e,t,n,r,i){if(w(e))return"";var o=0>e;e=Math.abs(e);var a=e===1/0;if(!a&&!isFinite(e))return"";var s=e+"",u="",c=!1,l=[];if(a&&(u="∞"),!a&&-1!==s.indexOf("e")){var f=s.match(/([\d\.]+)e(-?)(\d+)/);f&&"-"==f[2]&&f[3]>i+1?e=0:(u=s,c=!0)}if(a||c)i>0&&1>e&&(u=e.toFixed(i),e=parseFloat(u),u=u.replace(so,r));else{var p=(s.split(so)[1]||"").length;b(i)&&(i=Math.min(Math.max(t.minFrac,p),t.maxFrac)),e=+(Math.round(+(e.toString()+"e"+i)).toString()+"e"+-i);var d=(""+e).split(so),h=d[0];d=d[1]||"";var m,v=0,g=t.lgSize,y=t.gSize;if(h.length>=g+y)for(v=h.length-g,m=0;v>m;m++)(v-m)%y===0&&0!==m&&(u+=n),u+=h.charAt(m);for(m=v;m<h.length;m++)(h.length-m)%g===0&&0!==m&&(u+=n),u+=h.charAt(m);for(;d.length<i;)d+="0";i&&"0"!==i&&(u+=r+d.substr(0,i))}return 0===e&&(o=!1),l.push(o?t.negPre:t.posPre,u,o?t.negSuf:t.posSuf),l.join("")}function Ln(e,t,n){var r="";for(0>e&&(r="-",e=-e),e=""+e;e.length<t;)e="0"+e;return n&&(e=e.substr(e.length-t)),r+e}function Un(e,t,n,r){return n=n||0,function(i){var o=i["get"+e]();return(n>0||o>-n)&&(o+=n),0===o&&-12==n&&(o=12),Ln(o,t,r)}}function Hn(e,t){return function(n,r){var i=n["get"+e](),o=_r(t?"SHORT"+e:e);return r[o][i]}}function Vn(e,t,n){var r=-1*n,i=r>=0?"+":"";return i+=Ln(Math[r>0?"floor":"ceil"](r/60),2)+Ln(Math.abs(r%60),2)}function qn(e){var t=new Date(e,0,1).getDay();return new Date(e,0,(4>=t?5:12)-t)}function Bn(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate()+(4-e.getDay()))}function Wn(e){return function(t){var n=qn(t.getFullYear()),r=Bn(t),i=+r-+n,o=1+Math.round(i/6048e5);return Ln(o,e)}}function zn(e,t){return e.getHours()<12?t.AMPMS[0]:t.AMPMS[1]}function Kn(e,t){return e.getFullYear()<=0?t.ERAS[0]:t.ERAS[1]}function Qn(e,t){return e.getFullYear()<=0?t.ERANAMES[0]:t.ERANAMES[1]}function Gn(e){function t(e){var t;if(t=e.match(n)){var r=new Date(0),i=0,o=0,a=t[8]?r.setUTCFullYear:r.setFullYear,s=t[8]?r.setUTCHours:r.setHours;t[9]&&(i=d(t[9]+t[10]),o=d(t[9]+t[11])),a.call(r,d(t[1]),d(t[2])-1,d(t[3]));var u=d(t[4]||0)-i,c=d(t[5]||0)-o,l=d(t[6]||0),f=Math.round(1e3*parseFloat("0."+(t[7]||0)));return s.call(r,u,c,l,f),r}return e}var n=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(n,r,i){var a,s,u="",c=[];if(r=r||"mediumDate",r=e.DATETIME_FORMATS[r]||r,C(n)&&(n=lo.test(n)?d(n):t(n)),$(n)&&(n=new Date(n)),!S(n)||!isFinite(n.getTime()))return n;for(;r;)s=co.exec(r),s?(c=q(c,s,1),r=c.pop()):(c.push(r),r=null);var l=n.getTimezoneOffset();return i&&(l=G(i,n.getTimezoneOffset()),n=X(n,i,!0)),o(c,function(t){a=uo[t],u+=a?a(n,e.DATETIME_FORMATS,l):t.replace(/(^'|'$)/g,"").replace(/''/g,"'")}),u}}function Yn(){return function(e,t){return b(t)&&(t=2),K(e,t)}}function Xn(){return function(e,t,n){return t=Math.abs(Number(t))===1/0?Number(t):d(t),isNaN(t)?e:($(e)&&(e=e.toString()),Fr(e)||C(e)?(n=!n||isNaN(n)?0:d(n),n=0>n&&n>=-e.length?e.length+n:n,t>=0?e.slice(n,n+t):0===n?e.slice(t,e.length):e.slice(Math.max(0,n+t),n)):e)}}function Jn(e){function t(t,n){return n=n?-1:1,t.map(function(t){var r=1,i=v;if(E(t))i=t;else if(C(t)&&(("+"==t.charAt(0)||"-"==t.charAt(0))&&(r="-"==t.charAt(0)?-1:1,t=t.substring(1)),""!==t&&(i=e(t),i.constant))){var o=i();i=function(e){return e[o]}}return{get:i,descending:r*n}})}function n(e){switch(typeof e){case"number":case"boolean":case"string":return!0;default:return!1}}function r(e,t){return"function"==typeof e.valueOf&&(e=e.valueOf(),n(e))?e:y(e)&&(e=e.toString(),n(e))?e:t}function o(e,t){var n=typeof e;return null===e?(n="string",e="null"):"string"===n?e=e.toLowerCase():"object"===n&&(e=r(e,t)),{value:e,type:n}}function a(e,t){var n=0;return e.type===t.type?e.value!==t.value&&(n=e.value<t.value?-1:1):n=e.type<t.type?-1:1,n}return function(e,n,r){function s(e,t){return{value:e,predicateValues:c.map(function(n){return o(n.get(e),t)})}}function u(e,t){for(var n=0,r=0,i=c.length;i>r&&!(n=a(e.predicateValues[r],t.predicateValues[r])*c[r].descending);++r);return n}if(!i(e))return e;Fr(n)||(n=[n]),0===n.length&&(n=["+"]);var c=t(n,r);c.push({get:function(){return{}},descending:r?-1:1});var l=Array.prototype.map.call(e,s);return l.sort(u),e=l.map(function(e){return e.value})}}function Zn(e){return E(e)&&(e={link:e}),e.restrict=e.restrict||"AC",g(e)}function er(e,t){e.$name=t}function tr(e,t,r,i,a){var s=this,u=[];s.$error={},s.$$success={},s.$pending=n,s.$name=a(t.name||t.ngForm||"")(r),s.$dirty=!1,s.$pristine=!0,s.$valid=!0,s.$invalid=!1,s.$submitted=!1,s.$$parentForm=vo,s.$rollbackViewValue=function(){o(u,function(e){e.$rollbackViewValue()})},s.$commitViewValue=function(){o(u,function(e){e.$commitViewValue()})},s.$addControl=function(e){de(e.$name,"input"),u.push(e),e.$name&&(s[e.$name]=e),e.$$parentForm=s},s.$$renameControl=function(e,t){var n=e.$name;s[n]===e&&delete s[n],s[t]=e,e.$name=t},s.$removeControl=function(e){e.$name&&s[e.$name]===e&&delete s[e.$name],o(s.$pending,function(t,n){s.$setValidity(n,null,e)}),o(s.$error,function(t,n){s.$setValidity(n,null,e)}),o(s.$$success,function(t,n){s.$setValidity(n,null,e)}),L(u,e),e.$$parentForm=vo},vr({ctrl:this,$element:e,set:function(e,t,n){var r=e[t];if(r){var i=r.indexOf(n);-1===i&&r.push(n)}else e[t]=[n]},unset:function(e,t,n){var r=e[t];r&&(L(r,n),0===r.length&&delete e[t])},$animate:i}),s.$setDirty=function(){i.removeClass(e,Jo),i.addClass(e,Zo),s.$dirty=!0,s.$pristine=!1,s.$$parentForm.$setDirty()},s.$setPristine=function(){i.setClass(e,Jo,Zo+" "+go),s.$dirty=!1,s.$pristine=!0,s.$submitted=!1,o(u,function(e){e.$setPristine()})},s.$setUntouched=function(){o(u,function(e){e.$setUntouched()})},s.$setSubmitted=function(){i.addClass(e,go),s.$submitted=!0,s.$$parentForm.$setSubmitted()}}function nr(e){e.$formatters.push(function(t){return e.$isEmpty(t)?t:t.toString()})}function rr(e,t,n,r,i,o){ir(e,t,n,r,i,o),nr(r)}function ir(e,t,n,r,i,o){var a=xr(t[0].type);if(!i.android){var s=!1;t.on("compositionstart",function(){s=!0}),t.on("compositionend",function(){s=!1,u()})}var u=function(e){if(c&&(o.defer.cancel(c),c=null),!s){var i=t.val(),u=e&&e.type;"password"===a||n.ngTrim&&"false"===n.ngTrim||(i=Ur(i)),(r.$viewValue!==i||""===i&&r.$$hasNativeValidators)&&r.$setViewValue(i,u)}};if(i.hasEvent("input"))t.on("input",u);else{var c,l=function(e,t,n){c||(c=o.defer(function(){c=null,t&&t.value===n||u(e)}))};t.on("keydown",function(e){var t=e.keyCode;91===t||t>15&&19>t||t>=37&&40>=t||l(e,this,this.value)}),i.hasEvent("paste")&&t.on("paste cut",l)}t.on("change",u),r.$render=function(){var e=r.$isEmpty(r.$viewValue)?"":r.$viewValue;t.val()!==e&&t.val(e)}}function or(e,t){if(S(e))return e;if(C(e)){Po.lastIndex=0;var n=Po.exec(e);if(n){var r=+n[1],i=+n[2],o=0,a=0,s=0,u=0,c=qn(r),l=7*(i-1);return t&&(o=t.getHours(),a=t.getMinutes(),s=t.getSeconds(),u=t.getMilliseconds()),new Date(r,0,c.getDate()+l,o,a,s,u)}}return 0/0}function ar(e,t){return function(n,r){var i,a;if(S(n))return n;if(C(n)){if('"'==n.charAt(0)&&'"'==n.charAt(n.length-1)&&(n=n.substring(1,n.length-1)),wo.test(n))return new Date(n);if(e.lastIndex=0,i=e.exec(n))return i.shift(),a=r?{yyyy:r.getFullYear(),MM:r.getMonth()+1,dd:r.getDate(),HH:r.getHours(),mm:r.getMinutes(),ss:r.getSeconds(),sss:r.getMilliseconds()/1e3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},o(i,function(e,n){n<t.length&&(a[t[n]]=+e)}),new Date(a.yyyy,a.MM-1,a.dd,a.HH,a.mm,a.ss||0,1e3*a.sss||0)}return 0/0}}function sr(e,t,r,i){return function(o,a,s,u,c,l,f){function p(e){return e&&!(e.getTime&&e.getTime()!==e.getTime())}function d(e){return x(e)&&!S(e)?r(e)||n:e}ur(o,a,s,u),ir(o,a,s,u,c,l);var h,m=u&&u.$options&&u.$options.timezone;if(u.$$parserName=e,u.$parsers.push(function(e){if(u.$isEmpty(e))return null;if(t.test(e)){var i=r(e,h);return m&&(i=X(i,m)),i}return n}),u.$formatters.push(function(e){if(e&&!S(e))throw ra("datefmt","Expected `{0}` to be a date",e);return p(e)?(h=e,h&&m&&(h=X(h,m,!0)),f("date")(e,i,m)):(h=null,"")}),x(s.min)||s.ngMin){var v;u.$validators.min=function(e){return!p(e)||b(v)||r(e)>=v},s.$observe("min",function(e){v=d(e),u.$validate()})}if(x(s.max)||s.ngMax){var g;u.$validators.max=function(e){return!p(e)||b(g)||r(e)<=g},s.$observe("max",function(e){g=d(e),u.$validate()})}}}function ur(e,t,r,i){var o=t[0],a=i.$$hasNativeValidators=w(o.validity);a&&i.$parsers.push(function(e){var r=t.prop(br)||{};return r.badInput&&!r.typeMismatch?n:e})}function cr(e,t,r,i,o,a){if(ur(e,t,r,i),ir(e,t,r,i,o,a),i.$$parserName="number",i.$parsers.push(function(e){return i.$isEmpty(e)?null:$o.test(e)?parseFloat(e):n}),i.$formatters.push(function(e){if(!i.$isEmpty(e)){if(!$(e))throw ra("numfmt","Expected `{0}` to be a number",e);e=e.toString()}return e}),x(r.min)||r.ngMin){var s;i.$validators.min=function(e){return i.$isEmpty(e)||b(s)||e>=s},r.$observe("min",function(e){x(e)&&!$(e)&&(e=parseFloat(e,10)),s=$(e)&&!isNaN(e)?e:n,i.$validate()})}if(x(r.max)||r.ngMax){var u;i.$validators.max=function(e){return i.$isEmpty(e)||b(u)||u>=e},r.$observe("max",function(e){x(e)&&!$(e)&&(e=parseFloat(e,10)),u=$(e)&&!isNaN(e)?e:n,i.$validate()})}}function lr(e,t,n,r,i,o){ir(e,t,n,r,i,o),nr(r),r.$$parserName="url",r.$validators.url=function(e,t){var n=e||t;return r.$isEmpty(n)||_o.test(n)}}function fr(e,t,n,r,i,o){ir(e,t,n,r,i,o),nr(r),r.$$parserName="email",r.$validators.email=function(e,t){var n=e||t;return r.$isEmpty(n)||Co.test(n)}}function pr(e,t,n,r){b(n.name)&&t.attr("name",u());var i=function(e){t[0].checked&&r.$setViewValue(n.value,e&&e.type)};t.on("click",i),r.$render=function(){var e=n.value;t[0].checked=e==r.$viewValue},n.$observe("value",r.$render)}function dr(e,t,n,r,i){var o;if(x(r)){if(o=e(r),!o.constant)throw ra("constexpr","Expected constant expression for `{0}`, but saw `{1}`.",n,r);return o(t)}return i}function hr(e,t,n,r,i,o,a,s){var u=dr(s,e,"ngTrueValue",n.ngTrueValue,!0),c=dr(s,e,"ngFalseValue",n.ngFalseValue,!1),l=function(e){r.$setViewValue(t[0].checked,e&&e.type)};t.on("click",l),r.$render=function(){t[0].checked=r.$viewValue},r.$isEmpty=function(e){return e===!1},r.$formatters.push(function(e){return V(e,u)}),r.$par