WooCommerce Gutenberg Products Block - Version 8.5.0

Version Description

  • 2022-09-12 =

Enhancements

  • Improve the alignment of the Remove button in the Filter by Attribute block. (7088)
  • Enhance the display of the Active filters block changing the sizes of the text. (7087)
  • Add loading placeholders to Active Filters block. (7083)
  • Improved many of the labels to be less technical and more user-friendly. (7045)
  • Featured Item Blocks: Remove inline default color so that custom colors from Global Styles are applied correctly. (7036)
  • Update "remove filter" icon on the Active Filters block to use Icon component in both layouts. (7035)
  • Update filter by price skeleton design. (6997)
  • Update filter by attribute skeleton design. (6990)

Bug Fixes

  • Fix checkbox label when count is zero. (7073)
  • Fix incompatible Classic Template block notice in the Editor for Woo specific templates. (7033)
  • Update - remove __experimentalDuotone from Featured Product and Featured Category blocks. (7000)

Documentation

  • Add steps to retrieve products variations in Store API documentation. (7076)
Download this release

Release Info

Developer automattic
Plugin Icon 128x128 WooCommerce Gutenberg Products Block
Version 8.5.0
Comparing to
See all releases

Code changes from version 8.4.0 to 8.5.0

Files changed (113) hide show
  1. assets/js/atomic/blocks/product-elements/category-list/constants.tsx +1 -1
  2. assets/js/atomic/blocks/product-elements/image/{attributes.js → attributes.ts} +5 -3
  3. assets/js/atomic/blocks/product-elements/image/block.js +14 -15
  4. assets/js/atomic/blocks/product-elements/image/constants.js +0 -17
  5. assets/js/atomic/blocks/product-elements/image/edit.js +67 -54
  6. assets/js/atomic/blocks/product-elements/image/frontend.js +1 -1
  7. assets/js/atomic/blocks/product-elements/image/index.js +29 -14
  8. assets/js/atomic/blocks/product-elements/image/save.tsx +0 -21
  9. assets/js/atomic/blocks/product-elements/image/supports.ts +2 -1
  10. assets/js/atomic/blocks/product-elements/save.js +4 -0
  11. assets/js/atomic/blocks/product-elements/shared/config.tsx +1 -4
  12. assets/js/atomic/blocks/product-elements/tag-list/constants.js +1 -1
  13. assets/js/base/components/chip/style.scss +3 -5
  14. assets/js/base/components/filter-element-label/index.tsx +2 -2
  15. assets/js/base/components/filter-placeholder/index.tsx +18 -0
  16. assets/js/base/components/filter-placeholder/style.scss +22 -0
  17. assets/js/base/components/filter-reset-button/style.scss +1 -3
  18. assets/js/base/components/filter-submit-button/index.tsx +3 -0
  19. assets/js/base/components/filter-submit-button/style.scss +9 -0
  20. assets/js/base/components/price-slider/index.tsx +99 -74
  21. assets/js/base/components/price-slider/style.scss +33 -0
  22. assets/js/base/context/providers/add-to-cart-form/form-state/index.js +1 -1
  23. assets/js/base/context/providers/add-to-cart-form/form/submit/index.js +1 -1
  24. assets/js/base/context/providers/cart-checkout/checkout-processor.js +1 -1
  25. assets/js/base/context/providers/cart-checkout/checkout-state/index.tsx +1 -1
  26. assets/js/base/context/providers/cart-checkout/checkout-state/utils.ts +1 -1
  27. assets/js/base/hooks/index.js +1 -0
  28. assets/js/base/hooks/use-is-mounted.ts +38 -0
  29. assets/js/blocks/active-filters/active-attribute-filters.tsx +15 -7
  30. assets/js/blocks/active-filters/block.json +1 -1
  31. assets/js/blocks/active-filters/block.tsx +87 -33
  32. assets/js/blocks/active-filters/filter-placeholders.tsx +30 -0
  33. assets/js/blocks/active-filters/index.tsx +1 -1
  34. assets/js/blocks/active-filters/style.scss +89 -7
  35. assets/js/blocks/active-filters/utils.tsx +94 -40
  36. assets/js/blocks/attribute-filter/block.json +2 -2
  37. assets/js/blocks/attribute-filter/block.tsx +42 -21
  38. assets/js/blocks/attribute-filter/checkbox-filter.tsx +47 -0
  39. assets/js/blocks/attribute-filter/edit.tsx +5 -16
  40. assets/js/blocks/attribute-filter/index.tsx +1 -1
  41. assets/js/blocks/attribute-filter/style.scss +36 -7
  42. assets/js/blocks/cart-checkout-shared/payment-methods/express-payment/cart-express-payment.js +1 -1
  43. assets/js/blocks/cart-checkout-shared/payment-methods/no-payment-methods/index.js +1 -1
  44. assets/js/blocks/cart-checkout-shared/payment-methods/payment-method-error-boundary.js +1 -1
  45. assets/js/blocks/cart/block.js +4 -1
  46. assets/js/blocks/cart/inner-blocks/cart-express-payment-block/edit.tsx +1 -1
  47. assets/js/blocks/checkout/block.tsx +1 -1
  48. assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/attributes.tsx +1 -1
  49. assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/edit.tsx +1 -1
  50. assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/edit.tsx +1 -1
  51. assets/js/blocks/checkout/inner-blocks/checkout-terms-block/block.json +1 -1
  52. assets/js/blocks/checkout/inner-blocks/checkout-terms-block/edit.tsx +1 -1
  53. assets/js/blocks/checkout/inner-blocks/checkout-terms-block/test/edit.js +1 -1
  54. assets/js/blocks/classic-template/constants.ts +6 -2
  55. assets/js/blocks/classic-template/index.tsx +29 -27
  56. assets/js/blocks/classic-template/test/utils.ts +47 -0
  57. assets/js/blocks/classic-template/types.ts +1 -0
  58. assets/js/blocks/classic-template/utils.ts +49 -0
  59. assets/js/blocks/featured-items/featured-category/block.json +10 -13
  60. assets/js/blocks/featured-items/featured-product/block.json +4 -12
  61. assets/js/blocks/featured-items/featured-product/block.tsx +1 -1
  62. assets/js/blocks/featured-items/inspector-controls.tsx +2 -2
  63. assets/js/blocks/handpicked-products/edit-mode.tsx +1 -1
  64. assets/js/blocks/mini-cart/edit.tsx +1 -1
  65. assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/block.json +2 -2
  66. assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/block.json +2 -2
  67. assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.json +1 -1
  68. assets/js/blocks/price-filter/block.json +1 -1
  69. assets/js/blocks/price-filter/block.tsx +23 -5
  70. assets/js/blocks/price-filter/edit.tsx +2 -2
  71. assets/js/blocks/price-filter/style.scss +13 -2
  72. assets/js/blocks/product-best-sellers/block.json +1 -1
  73. assets/js/blocks/product-categories/block.js +1 -34
  74. assets/js/blocks/product-category/edit-mode.tsx +2 -2
  75. assets/js/blocks/product-query/constants.ts +36 -1
  76. assets/js/blocks/product-query/variations/product-query.tsx +2 -10
  77. assets/js/blocks/product-query/variations/products-on-sale.tsx +2 -10
  78. assets/js/blocks/product-search/edit.js +0 -11
  79. assets/js/blocks/product-tag/block.js +1 -1
  80. assets/js/blocks/products/all-products/edit.js +2 -2
  81. assets/js/blocks/reviews/reviews-by-category/edit.js +1 -1
  82. assets/js/blocks/reviews/reviews-by-product/index.js +1 -1
  83. assets/js/blocks/stock-filter/block.tsx +28 -10
  84. assets/js/blocks/stock-filter/edit.tsx +3 -14
  85. assets/js/blocks/stock-filter/index.tsx +1 -1
  86. assets/js/blocks/stock-filter/style.scss +31 -13
  87. assets/js/blocks/stock-filter/test/__snapshots__/block.js.snap +23 -23
  88. assets/js/editor-components/error-placeholder/error-message.tsx +1 -1
  89. assets/js/editor-components/grid-content-control/index.js +0 -55
  90. assets/js/editor-components/grid-layout-control/index.js +2 -2
  91. assets/js/editor-components/product-tag-control/index.js +1 -1
  92. assets/js/shared/context/product-data-context.js +3 -1
  93. assets/js/shared/hocs/with-product-data-context.js +21 -31
  94. build/active-filters-frontend.asset.php +1 -1
  95. build/active-filters-frontend.js +8 -8
  96. build/active-filters.asset.php +1 -1
  97. build/active-filters.js +9 -9
  98. build/active-filters/block.json +1 -1
  99. build/all-products-frontend.asset.php +1 -1
  100. build/all-products-frontend.js +4 -4
  101. build/all-products.asset.php +1 -1
  102. build/all-products.js +15 -15
  103. build/all-reviews.asset.php +1 -1
  104. build/all-reviews.js +3 -3
  105. build/attribute-filter-frontend.asset.php +1 -1
  106. build/attribute-filter-frontend.js +12 -12
  107. build/attribute-filter.asset.php +1 -1
  108. build/attribute-filter.js +9 -9
  109. build/attribute-filter/block.json +2 -2
  110. build/blocks-checkout.asset.php +1 -1
  111. build/blocks-checkout.js +3 -3
  112. build/cart-blocks/cart-accepted-payment-methods-frontend.js +1 -1
  113. build/cart-blocks/cart-express-payment-frontend.js +2 -2
assets/js/atomic/blocks/product-elements/category-list/constants.tsx CHANGED
@@ -12,6 +12,6 @@ export const BLOCK_ICON: JSX.Element = (
12
  <Icon icon={ archive } className="wc-block-editor-components-block-icon" />
13
  );
14
  export const BLOCK_DESCRIPTION: string = __(
15
- 'Display a list of categories belonging to a product.',
16
  'woo-gutenberg-products-block'
17
  );
12
  <Icon icon={ archive } className="wc-block-editor-components-block-icon" />
13
  );
14
  export const BLOCK_DESCRIPTION: string = __(
15
+ 'Display the list of categories that are assigned to a product.',
16
  'woo-gutenberg-products-block'
17
  );
assets/js/atomic/blocks/product-elements/image/{attributes.js → attributes.ts} RENAMED
@@ -1,4 +1,4 @@
1
- export const blockAttributes = {
2
  showProductLink: {
3
  type: 'boolean',
4
  default: true,
@@ -19,6 +19,8 @@ export const blockAttributes = {
19
  type: 'number',
20
  default: 0,
21
  },
 
 
 
 
22
  };
23
-
24
- export default blockAttributes;
1
+ export const attributes = {
2
  showProductLink: {
3
  type: 'boolean',
4
  default: true,
19
  type: 'number',
20
  default: 0,
21
  },
22
+ isDescendentOfQueryLoop: {
23
+ type: 'boolean',
24
+ default: false,
25
+ },
26
  };
 
 
assets/js/atomic/blocks/product-elements/image/block.js CHANGED
@@ -2,7 +2,7 @@
2
  * External dependencies
3
  */
4
  import PropTypes from 'prop-types';
5
- import { useState, Fragment } from '@wordpress/element';
6
  import { __, sprintf } from '@wordpress/i18n';
7
  import classnames from 'classnames';
8
  import { PLACEHOLDER_IMG_SRC } from '@woocommerce/settings';
@@ -21,18 +21,19 @@ import { useStoreEvents } from '@woocommerce/base-context/hooks';
21
  /**
22
  * Internal dependencies
23
  */
24
- import ProductSaleBadge from './../sale-badge/block';
25
  import './style.scss';
26
 
27
  /**
28
  * Product Image Block Component.
29
  *
30
- * @param {Object} props Incoming props.
31
- * @param {string} [props.className] CSS Class name for the component.
32
- * @param {string} [props.imageSizing] Size of image to use.
33
- * @param {boolean} [props.showProductLink] Whether or not to display a link to the product page.
34
- * @param {boolean} [props.showSaleBadge] Whether or not to display the on sale badge.
35
- * @param {string} [props.saleBadgeAlign] How should the sale badge be aligned if displayed.
 
36
  * @return {*} The component.
37
  */
38
  export const Block = ( props ) => {
@@ -45,8 +46,8 @@ export const Block = ( props ) => {
45
  } = props;
46
 
47
  const { parentClassName } = useInnerBlockLayoutContext();
48
- const { product } = useProductDataContext();
49
- const [ imageLoaded, setImageLoaded ] = useState( false );
50
  const { dispatchStoreEvent } = useStoreEvents();
51
 
52
  const typographyProps = useTypographyProps( props );
@@ -119,8 +120,7 @@ export const Block = ( props ) => {
119
  <Image
120
  fallbackAlt={ product.name }
121
  image={ image }
122
- onLoad={ () => setImageLoaded( true ) }
123
- loaded={ imageLoaded }
124
  showFullSize={ imageSizing !== 'cropped' }
125
  />
126
  </ParentComponent>
@@ -134,11 +134,10 @@ const ImagePlaceholder = () => {
134
  );
135
  };
136
 
137
- const Image = ( { image, onLoad, loaded, showFullSize, fallbackAlt } ) => {
138
  const { thumbnail, src, srcset, sizes, alt } = image || {};
139
  const imageProps = {
140
  alt: alt || fallbackAlt,
141
- onLoad,
142
  hidden: ! loaded,
143
  src: thumbnail,
144
  ...( showFullSize && { src, srcSet: srcset, sizes } ),
@@ -150,7 +149,7 @@ const Image = ( { image, onLoad, loaded, showFullSize, fallbackAlt } ) => {
150
  /* eslint-disable-next-line jsx-a11y/alt-text */
151
  <img data-testid="product-image" { ...imageProps } />
152
  ) }
153
- { ! loaded && <ImagePlaceholder /> }
154
  </>
155
  );
156
  };
2
  * External dependencies
3
  */
4
  import PropTypes from 'prop-types';
5
+ import { Fragment } from '@wordpress/element';
6
  import { __, sprintf } from '@wordpress/i18n';
7
  import classnames from 'classnames';
8
  import { PLACEHOLDER_IMG_SRC } from '@woocommerce/settings';
21
  /**
22
  * Internal dependencies
23
  */
24
+ import ProductSaleBadge from '../sale-badge/block';
25
  import './style.scss';
26
 
27
  /**
28
  * Product Image Block Component.
29
  *
30
+ * @param {Object} props Incoming props.
31
+ * @param {string} [props.className] CSS Class name for the component.
32
+ * @param {string} [props.imageSizing] Size of image to use.
33
+ * @param {boolean} [props.showProductLink] Whether or not to display a link to the product page.
34
+ * @param {boolean} [props.showSaleBadge] Whether or not to display the on sale badge.
35
+ * @param {string} [props.saleBadgeAlign] How should the sale badge be aligned if displayed.
36
+ * @param {boolean} [props.isDescendentOfQueryLoop] Whether or not be a children of Query Loop Block.
37
  * @return {*} The component.
38
  */
39
  export const Block = ( props ) => {
46
  } = props;
47
 
48
  const { parentClassName } = useInnerBlockLayoutContext();
49
+ const { product, isLoading } = useProductDataContext();
50
+
51
  const { dispatchStoreEvent } = useStoreEvents();
52
 
53
  const typographyProps = useTypographyProps( props );
120
  <Image
121
  fallbackAlt={ product.name }
122
  image={ image }
123
+ loaded={ ! isLoading }
 
124
  showFullSize={ imageSizing !== 'cropped' }
125
  />
126
  </ParentComponent>
134
  );
135
  };
136
 
137
+ const Image = ( { image, loaded, showFullSize, fallbackAlt } ) => {
138
  const { thumbnail, src, srcset, sizes, alt } = image || {};
139
  const imageProps = {
140
  alt: alt || fallbackAlt,
 
141
  hidden: ! loaded,
142
  src: thumbnail,
143
  ...( showFullSize && { src, srcSet: srcset, sizes } ),
149
  /* eslint-disable-next-line jsx-a11y/alt-text */
150
  <img data-testid="product-image" { ...imageProps } />
151
  ) }
152
+ { ! image && <ImagePlaceholder /> }
153
  </>
154
  );
155
  };
assets/js/atomic/blocks/product-elements/image/constants.js DELETED
@@ -1,17 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { __ } from '@wordpress/i18n';
5
- import { image, Icon } from '@wordpress/icons';
6
-
7
- export const BLOCK_TITLE = __(
8
- 'Product Image',
9
- 'woo-gutenberg-products-block'
10
- );
11
- export const BLOCK_ICON = (
12
- <Icon icon={ image } className="wc-block-editor-components-block-icon" />
13
- );
14
- export const BLOCK_DESCRIPTION = __(
15
- 'Display the main product image',
16
- 'woo-gutenberg-products-block'
17
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/atomic/blocks/product-elements/image/edit.js CHANGED
@@ -3,8 +3,9 @@
3
  */
4
  import { __ } from '@wordpress/i18n';
5
  import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
6
- import { createInterpolateElement } from '@wordpress/element';
7
- import { getAdminLink } from '@woocommerce/settings';
 
8
  import {
9
  Disabled,
10
  PanelBody,
@@ -19,15 +20,32 @@ import {
19
  * Internal dependencies
20
  */
21
  import Block from './block';
22
- import withProductSelector from '../shared/with-product-selector';
23
- import { BLOCK_TITLE, BLOCK_ICON } from './constants';
24
 
25
- const Edit = ( { attributes, setAttributes } ) => {
26
  const { showProductLink, imageSizing, showSaleBadge, saleBadgeAlign } =
27
  attributes;
28
 
29
  const blockProps = useBlockProps();
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  return (
32
  <div { ...blockProps }>
33
  <InspectorControls>
@@ -56,7 +74,7 @@ const Edit = ( { attributes, setAttributes } ) => {
56
  'woo-gutenberg-products-block'
57
  ) }
58
  help={ __(
59
- 'Overlay a "sale" badge if the product is on-sale.',
60
  'woo-gutenberg-products-block'
61
  ) }
62
  checked={ showSaleBadge }
@@ -100,63 +118,58 @@ const Edit = ( { attributes, setAttributes } ) => {
100
  />
101
  </ToggleGroupControl>
102
  ) }
103
- <ToggleGroupControl
104
- label={ __(
105
- 'Image Sizing',
106
- 'woo-gutenberg-products-block'
107
- ) }
108
- help={ createInterpolateElement(
109
- __(
110
- 'Product image cropping can be modified in the <a>Customizer</a>.',
111
- 'woo-gutenberg-products-block'
112
- ),
113
- {
114
- a: (
115
- // eslint-disable-next-line jsx-a11y/anchor-has-content
116
- <a
117
- href={ `${ getAdminLink(
118
- 'customize.php'
119
- ) }?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images` }
120
- target="_blank"
121
- rel="noopener noreferrer"
122
- />
123
- ),
124
- }
125
- ) }
126
- value={ imageSizing }
127
- onChange={ ( value ) =>
128
- setAttributes( { imageSizing: value } )
129
- }
130
- >
131
- <ToggleGroupControlOption
132
- value="full-size"
133
  label={ __(
134
- 'Full Size',
135
  'woo-gutenberg-products-block'
136
  ) }
137
- />
138
- <ToggleGroupControlOption
139
- value="cropped"
140
- label={ __(
141
- 'Cropped',
142
- 'woo-gutenberg-products-block'
 
 
 
 
 
 
 
 
 
 
 
143
  ) }
144
- />
145
- </ToggleGroupControl>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  </PanelBody>
147
  </InspectorControls>
148
  <Disabled>
149
- <Block { ...attributes } />
150
  </Disabled>
151
  </div>
152
  );
153
  };
154
 
155
- export default withProductSelector( {
156
- icon: BLOCK_ICON,
157
- label: BLOCK_TITLE,
158
- description: __(
159
- 'Choose a product to display its image.',
160
- 'woo-gutenberg-products-block'
161
- ),
162
- } )( Edit );
3
  */
4
  import { __ } from '@wordpress/i18n';
5
  import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
6
+ import { createInterpolateElement, useEffect } from '@wordpress/element';
7
+ import { getAdminLink, getSettingWithCoercion } from '@woocommerce/settings';
8
+ import { isBoolean } from '@woocommerce/types';
9
  import {
10
  Disabled,
11
  PanelBody,
20
  * Internal dependencies
21
  */
22
  import Block from './block';
 
 
23
 
24
+ const Edit = ( { attributes, setAttributes, context } ) => {
25
  const { showProductLink, imageSizing, showSaleBadge, saleBadgeAlign } =
26
  attributes;
27
 
28
  const blockProps = useBlockProps();
29
 
30
+ const isDescendentOfQueryLoop = Number.isFinite( context.queryId );
31
+
32
+ useEffect(
33
+ () => setAttributes( { isDescendentOfQueryLoop } ),
34
+ [ setAttributes, isDescendentOfQueryLoop ]
35
+ );
36
+
37
+ const isBlockThemeEnabled = getSettingWithCoercion(
38
+ 'is_block_theme_enabled',
39
+ false,
40
+ isBoolean
41
+ );
42
+
43
+ useEffect( () => {
44
+ if ( isBlockThemeEnabled && attributes.imageSizing !== 'full-size' ) {
45
+ setAttributes( { imageSizing: 'full-size' } );
46
+ }
47
+ }, [ attributes.imageSizing, isBlockThemeEnabled, setAttributes ] );
48
+
49
  return (
50
  <div { ...blockProps }>
51
  <InspectorControls>
74
  'woo-gutenberg-products-block'
75
  ) }
76
  help={ __(
77
+ 'Display a sale badge if the product is on-sale.',
78
  'woo-gutenberg-products-block'
79
  ) }
80
  checked={ showSaleBadge }
118
  />
119
  </ToggleGroupControl>
120
  ) }
121
+ { ! isBlockThemeEnabled && (
122
+ <ToggleGroupControl
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  label={ __(
124
+ 'Image Sizing',
125
  'woo-gutenberg-products-block'
126
  ) }
127
+ help={ createInterpolateElement(
128
+ __(
129
+ 'Product image cropping can be modified in the <a>Customizer</a>.',
130
+ 'woo-gutenberg-products-block'
131
+ ),
132
+ {
133
+ a: (
134
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
135
+ <a
136
+ href={ `${ getAdminLink(
137
+ 'customize.php'
138
+ ) }?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images` }
139
+ target="_blank"
140
+ rel="noopener noreferrer"
141
+ />
142
+ ),
143
+ }
144
  ) }
145
+ value={ imageSizing }
146
+ onChange={ ( value ) =>
147
+ setAttributes( { imageSizing: value } )
148
+ }
149
+ >
150
+ <ToggleGroupControlOption
151
+ value="full-size"
152
+ label={ __(
153
+ 'Full Size',
154
+ 'woo-gutenberg-products-block'
155
+ ) }
156
+ />
157
+ <ToggleGroupControlOption
158
+ value="cropped"
159
+ label={ __(
160
+ 'Cropped',
161
+ 'woo-gutenberg-products-block'
162
+ ) }
163
+ />
164
+ </ToggleGroupControl>
165
+ ) }
166
  </PanelBody>
167
  </InspectorControls>
168
  <Disabled>
169
+ <Block { ...{ ...attributes, ...context } } />
170
  </Disabled>
171
  </div>
172
  );
173
  };
174
 
175
+ export default Edit;
 
 
 
 
 
 
 
assets/js/atomic/blocks/product-elements/image/frontend.js CHANGED
@@ -7,6 +7,6 @@ import { withFilteredAttributes } from '@woocommerce/shared-hocs';
7
  * Internal dependencies
8
  */
9
  import Block from './block';
10
- import attributes from './attributes';
11
 
12
  export default withFilteredAttributes( attributes )( Block );
7
  * Internal dependencies
8
  */
9
  import Block from './block';
10
+ import { attributes } from './attributes';
11
 
12
  export default withFilteredAttributes( attributes )( Block );
assets/js/atomic/blocks/product-elements/image/index.js CHANGED
@@ -2,30 +2,45 @@
2
  * External dependencies
3
  */
4
  import { registerBlockType } from '@wordpress/blocks';
 
 
5
 
6
  /**
7
  * Internal dependencies
8
  */
9
- import sharedConfig from '../shared/config';
10
- import attributes from './attributes';
11
- import { supports } from './supports';
12
- import { Save } from './save';
13
  import edit from './edit';
14
- import {
15
- BLOCK_TITLE as title,
16
- BLOCK_ICON as icon,
17
- BLOCK_DESCRIPTION as description,
18
- } from './constants';
19
 
20
  const blockConfig = {
21
  apiVersion: 2,
22
- title,
23
- description,
24
- icon: { src: icon },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  attributes,
26
- edit,
27
  supports,
28
- save: Save,
29
  };
30
 
31
  registerBlockType( 'woocommerce/product-image', {
2
  * External dependencies
3
  */
4
  import { registerBlockType } from '@wordpress/blocks';
5
+ import { image, Icon } from '@wordpress/icons';
6
+ import { __ } from '@wordpress/i18n';
7
 
8
  /**
9
  * Internal dependencies
10
  */
 
 
 
 
11
  import edit from './edit';
12
+
13
+ import { supports } from './supports';
14
+ import { attributes } from './attributes';
15
+ import sharedConfig from '../shared/config';
 
16
 
17
  const blockConfig = {
18
  apiVersion: 2,
19
+ name: 'woocommerce/product-image',
20
+ title: __( 'Product Image', 'woo-gutenberg-products-block' ),
21
+ icon: {
22
+ src: (
23
+ <Icon
24
+ icon={ image }
25
+ className="wc-block-editor-components-block-icon"
26
+ />
27
+ ),
28
+ },
29
+ keywords: [ 'WooCommerce' ],
30
+ description: __(
31
+ 'Display the main product image.',
32
+ 'woo-gutenberg-products-block'
33
+ ),
34
+ usesContext: [ 'query', 'queryId', 'postId' ],
35
+ parent: [
36
+ '@woocommerce/all-products',
37
+ '@woocommerce/single-product',
38
+ 'core/post-template',
39
+ ],
40
+ textdomain: 'woo-gutenberg-products-block',
41
  attributes,
 
42
  supports,
43
+ edit,
44
  };
45
 
46
  registerBlockType( 'woocommerce/product-image', {
assets/js/atomic/blocks/product-elements/image/save.tsx DELETED
@@ -1,21 +0,0 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { useBlockProps } from '@wordpress/block-editor';
5
- import classnames from 'classnames';
6
-
7
- type Props = {
8
- attributes: Record< string, unknown > & {
9
- className?: string;
10
- };
11
- };
12
-
13
- export const Save = ( { attributes }: Props ): JSX.Element => {
14
- return (
15
- <div
16
- { ...useBlockProps.save( {
17
- className: classnames( 'is-loading', attributes.className ),
18
- } ) }
19
- />
20
- );
21
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/js/atomic/blocks/product-elements/image/supports.ts CHANGED
@@ -2,13 +2,14 @@
2
  * External dependencies
3
  */
4
  import { isFeaturePluginBuild } from '@woocommerce/block-settings';
 
5
 
6
  /**
7
  * Internal dependencies
8
  */
9
- import { hasSpacingStyleSupport } from '../../../../utils/global-style';
10
 
11
  export const supports = {
 
12
  ...( isFeaturePluginBuild() && {
13
  __experimentalBorder: {
14
  radius: true,
2
  * External dependencies
3
  */
4
  import { isFeaturePluginBuild } from '@woocommerce/block-settings';
5
+ import { hasSpacingStyleSupport } from '@woocommerce/utils';
6
 
7
  /**
8
  * Internal dependencies
9
  */
 
10
 
11
  export const supports = {
12
+ html: false,
13
  ...( isFeaturePluginBuild() && {
14
  __experimentalBorder: {
15
  radius: true,
assets/js/atomic/blocks/product-elements/save.js CHANGED
@@ -4,6 +4,10 @@
4
  import classnames from 'classnames';
5
 
6
  const save = ( { attributes } ) => {
 
 
 
 
7
  return (
8
  <div className={ classnames( 'is-loading', attributes.className ) } />
9
  );
4
  import classnames from 'classnames';
5
 
6
  const save = ( { attributes } ) => {
7
+ if ( attributes.isDescendentOfQueryLoop ) {
8
+ return null;
9
+ }
10
+
11
  return (
12
  <div className={ classnames( 'is-loading', attributes.className ) } />
13
  );
assets/js/atomic/blocks/product-elements/shared/config.tsx CHANGED
@@ -3,7 +3,6 @@
3
  */
4
  import { __ } from '@wordpress/i18n';
5
  import { Icon, grid } from '@wordpress/icons';
6
- import { isExperimentalBuild } from '@woocommerce/block-settings';
7
  import type { BlockConfiguration } from '@wordpress/blocks';
8
 
9
  /**
@@ -29,9 +28,7 @@ const sharedConfig: Omit< BlockConfiguration, 'attributes' | 'title' > = {
29
  supports: {
30
  html: false,
31
  },
32
- parent: isExperimentalBuild()
33
- ? undefined
34
- : [ '@woocommerce/all-products', '@woocommerce/single-product' ],
35
  save,
36
  deprecated: [
37
  {
3
  */
4
  import { __ } from '@wordpress/i18n';
5
  import { Icon, grid } from '@wordpress/icons';
 
6
  import type { BlockConfiguration } from '@wordpress/blocks';
7
 
8
  /**
28
  supports: {
29
  html: false,
30
  },
31
+ parent: [ '@woocommerce/all-products', '@woocommerce/single-product' ],
 
 
32
  save,
33
  deprecated: [
34
  {
assets/js/atomic/blocks/product-elements/tag-list/constants.js CHANGED
@@ -12,6 +12,6 @@ export const BLOCK_ICON = (
12
  <Icon icon={ tag } className="wc-block-editor-components-block-icon" />
13
  );
14
  export const BLOCK_DESCRIPTION = __(
15
- 'Display a list of tags belonging to a product.',
16
  'woo-gutenberg-products-block'
17
  );
12
  <Icon icon={ tag } className="wc-block-editor-components-block-icon" />
13
  );
14
  export const BLOCK_DESCRIPTION = __(
15
+ 'Display the list of tags that are assigned to a product.',
16
  'woo-gutenberg-products-block'
17
  );
assets/js/base/components/chip/style.scss CHANGED
@@ -28,17 +28,15 @@
28
  &.wc-block-components-chip--radius-large {
29
  border-radius: 2em;
30
  padding-left: 0.75em;
31
- padding-right: 0.75em;
32
  }
33
  .wc-block-components-chip__text {
34
- @include font-size(smaller);
35
  flex-grow: 1;
36
  }
37
  &.is-removable .wc-block-components-chip__text {
38
- padding-right: 0.25em;
39
  }
40
  .wc-block-components-chip__remove {
41
- @include font-size(smaller);
42
  background: $gray-200;
43
  border: 0;
44
  border-radius: 25px;
@@ -46,11 +44,11 @@
46
  padding: 0;
47
  height: 16px;
48
  width: 16px;
 
49
  margin: 0;
50
  }
51
 
52
  .wc-block-components-chip__remove-icon {
53
- vertical-align: middle;
54
  fill: $gray-900;
55
  }
56
  }
28
  &.wc-block-components-chip--radius-large {
29
  border-radius: 2em;
30
  padding-left: 0.75em;
31
+ padding-right: 0.25em;
32
  }
33
  .wc-block-components-chip__text {
 
34
  flex-grow: 1;
35
  }
36
  &.is-removable .wc-block-components-chip__text {
37
+ padding-right: 0.5em;
38
  }
39
  .wc-block-components-chip__remove {
 
40
  background: $gray-200;
41
  border: 0;
42
  border-radius: 25px;
44
  padding: 0;
45
  height: 16px;
46
  width: 16px;
47
+ line-height: 16px;
48
  margin: 0;
49
  }
50
 
51
  .wc-block-components-chip__remove-icon {
 
52
  fill: $gray-900;
53
  }
54
  }
assets/js/base/components/filter-element-label/index.tsx CHANGED
@@ -14,7 +14,7 @@ interface FilterElementLabelProps {
14
  count: number | null;
15
  }
16
  /**
17
- * The label for an filter elements.
18
  *
19
  * @param {Object} props Incoming props for the component.
20
  * @param {string} props.name The name for the label.
@@ -27,7 +27,7 @@ const FilterElementLabel = ( {
27
  return (
28
  <>
29
  { name }
30
- { count && Number.isFinite( count ) && (
31
  <Label
32
  label={ count.toString() }
33
  screenReaderLabel={ sprintf(
14
  count: number | null;
15
  }
16
  /**
17
+ * The label for a filter element.
18
  *
19
  * @param {Object} props Incoming props for the component.
20
  * @param {string} props.name The name for the label.
27
  return (
28
  <>
29
  { name }
30
+ { count !== null && Number.isFinite( count ) && (
31
  <Label
32
  label={ count.toString() }
33
  screenReaderLabel={ sprintf(
assets/js/base/components/filter-placeholder/index.tsx ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import './style.scss';
5
+
6
+ interface FilterTitlePlaceholderProps {
7
+ children?: React.ReactNode;
8
+ }
9
+
10
+ const FilterTitlePlaceholder = ( {
11
+ children,
12
+ }: FilterTitlePlaceholderProps ): JSX.Element => {
13
+ return (
14
+ <div className="wc-block-filter-title-placeholder">{ children }</div>
15
+ );
16
+ };
17
+
18
+ export default FilterTitlePlaceholder;
assets/js/base/components/filter-placeholder/style.scss ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .wc-block-filter-title-placeholder {
2
+ @include placeholder();
3
+ background-color: $gray-400 !important;
4
+ border-radius: em(26px);
5
+ box-shadow: none;
6
+ min-width: 80px;
7
+ margin-top: $gap-small;
8
+ margin-bottom: $gap-small;
9
+ max-width: max-content !important;
10
+
11
+ &::after {
12
+ background-image: linear-gradient(90deg, $gray-400, $gray-200, $gray-400);
13
+ }
14
+
15
+ .wc-block-stock-filter__title,
16
+ .wc-block-price-filter__title,
17
+ .wc-block-active-filters__title,
18
+ .wc-block-attribute-filter__title {
19
+ margin: 0;
20
+ height: 1em;
21
+ }
22
+ }
assets/js/base/components/filter-reset-button/style.scss CHANGED
@@ -1,8 +1,6 @@
1
  .wc-block-components-filter-reset-button {
2
- background: transparent;
3
- border: none;
4
  cursor: pointer;
5
- font-size: inherit;
6
 
7
  &:not([disabled]):hover {
8
  text-decoration: underline;
1
  .wc-block-components-filter-reset-button {
2
+ @include text-button();
 
3
  cursor: pointer;
 
4
 
5
  &:not([disabled]):hover {
6
  text-decoration: underline;
assets/js/base/components/filter-submit-button/index.tsx CHANGED
@@ -12,6 +12,7 @@ import './style.scss';
12
 
13
  interface FilterSubmitButtonProps {
14
  className?: string;
 
15
  disabled?: boolean;
16
  label?: string;
17
  onClick: () => void;
@@ -20,6 +21,7 @@ interface FilterSubmitButtonProps {
20
 
21
  const FilterSubmitButton = ( {
22
  className,
 
23
  disabled,
24
  /* translators: Submit button text for filters. */
25
  label = __( 'Apply', 'woo-gutenberg-products-block' ),
@@ -33,6 +35,7 @@ const FilterSubmitButton = ( {
33
  'wp-block-button__link',
34
  'wc-block-filter-submit-button',
35
  'wc-block-components-filter-submit-button',
 
36
  className
37
  ) }
38
  disabled={ disabled }
12
 
13
  interface FilterSubmitButtonProps {
14
  className?: string;
15
+ isLoading?: boolean;
16
  disabled?: boolean;
17
  label?: string;
18
  onClick: () => void;
21
 
22
  const FilterSubmitButton = ( {
23
  className,
24
+ isLoading,
25
  disabled,
26
  /* translators: Submit button text for filters. */
27
  label = __( 'Apply', 'woo-gutenberg-products-block' ),
35
  'wp-block-button__link',
36
  'wc-block-filter-submit-button',
37
  'wc-block-components-filter-submit-button',
38
+ { 'is-loading': isLoading },
39
  className
40
  ) }
41
  disabled={ disabled }
assets/js/base/components/filter-submit-button/style.scss CHANGED
@@ -3,4 +3,13 @@
3
  display: block;
4
  margin-left: auto;
5
  white-space: nowrap;
 
 
 
 
 
 
 
 
 
6
  }
3
  display: block;
4
  margin-left: auto;
5
  white-space: nowrap;
6
+
7
+ &.is-loading {
8
+ @include placeholder();
9
+ margin-top: $gap;
10
+ width: max-content;
11
+ box-shadow: none;
12
+ border-radius: 0;
13
+ line-height: initial;
14
+ }
15
  }
assets/js/base/components/price-slider/index.tsx CHANGED
@@ -33,6 +33,10 @@ export interface PriceSliderProps {
33
  * Whether values are loading or not.
34
  */
35
  isLoading?: boolean;
 
 
 
 
36
  /**
37
  * Maximum constraint.
38
  */
@@ -87,6 +91,7 @@ const PriceSlider = ( {
87
  showFilterButton = false,
88
  inlineInput = true,
89
  isLoading = false,
 
90
  onSubmit = () => void 0,
91
  }: PriceSliderProps ): JSX.Element => {
92
  const minRange = useRef< HTMLInputElement >( null );
@@ -301,7 +306,6 @@ const PriceSlider = ( {
301
  showFilterButton && 'wc-block-price-filter--has-filter-button',
302
  showFilterButton &&
303
  'wc-block-components-price-slider--has-filter-button',
304
- isLoading && 'is-loading',
305
  ! hasValidConstraints && 'is-disabled',
306
  ( inlineInput || wrapperWidth <= 300 ) &&
307
  'wc-block-components-price-slider--is-input-inline'
@@ -326,7 +330,11 @@ const PriceSlider = ( {
326
 
327
  const slider = (
328
  <div
329
- className="wc-block-price-filter__range-input-wrapper wc-block-components-price-slider__range-input-wrapper"
 
 
 
 
330
  onMouseMove={ findClosestRange }
331
  onFocus={ findClosestRange }
332
  >
@@ -388,58 +396,68 @@ const PriceSlider = ( {
388
  { ( ! inlineInputAvailable || ! showInputFields ) && slider }
389
  { showInputFields && (
390
  <div className="wc-block-price-filter__controls wc-block-components-price-slider__controls">
391
- <FormattedMonetaryAmount
392
- currency={ currency }
393
- displayType="input"
394
- className="wc-block-price-filter__amount wc-block-price-filter__amount--min wc-block-form-text-input wc-block-components-price-slider__amount wc-block-components-price-slider__amount--min"
395
- aria-label={ __(
396
- 'Filter products by minimum price',
397
- 'woo-gutenberg-products-block'
398
- ) }
399
- allowNegative={ false }
400
- isAllowed={ isValidMinValue( {
401
- minConstraint,
402
- minorUnit: currency.minorUnit,
403
- currentMaxValue: maxPriceInput,
404
- } ) }
405
- onValueChange={ ( value ) => {
406
- if ( value === minPriceInput ) {
407
- return;
408
- }
409
- setMinPriceInput( value );
410
- } }
411
- onBlur={ priceInputOnBlur }
412
- disabled={ isLoading || ! hasValidConstraints }
413
- value={ minPriceInput }
414
- />
 
 
 
 
 
415
  { inlineInputAvailable && slider }
416
- <FormattedMonetaryAmount
417
- currency={ currency }
418
- displayType="input"
419
- className="wc-block-price-filter__amount wc-block-price-filter__amount--max wc-block-form-text-input wc-block-components-price-slider__amount wc-block-components-price-slider__amount--max"
420
- aria-label={ __(
421
- 'Filter products by maximum price',
422
- 'woo-gutenberg-products-block'
423
- ) }
424
- isAllowed={ isValidMaxValue( {
425
- maxConstraint,
426
- minorUnit: currency.minorUnit,
427
- } ) }
428
- onValueChange={ ( value ) => {
429
- if ( value === maxPriceInput ) {
430
- return;
431
- }
432
- setMaxPriceInput( value );
433
- } }
434
- onBlur={ priceInputOnBlur }
435
- disabled={ isLoading || ! hasValidConstraints }
436
- value={ maxPriceInput }
437
- />
 
 
 
 
 
438
  </div>
439
  ) }
440
 
441
  { ! showInputFields &&
442
- ! isLoading &&
443
  Number.isFinite( minPrice ) &&
444
  Number.isFinite( maxPrice ) && (
445
  <div className="wc-block-price-filter__range-text wc-block-components-price-slider__range-text">
@@ -453,32 +471,39 @@ const PriceSlider = ( {
453
  />
454
  </div>
455
  ) }
456
- <div className="wc-block-components-price-slider__actions">
457
- { ( minPrice !== minConstraint ||
458
- maxPrice !== maxConstraint ) && (
459
- <FilterResetButton
460
- onClick={ () => {
461
- onChange( [ minConstraint, maxConstraint ] );
462
- debouncedUpdateQuery();
463
- } }
464
- screenReaderLabel={ __(
465
- 'Reset price filter',
466
- 'woo-gutenberg-products-block'
467
- ) }
468
- />
469
- ) }
470
- { showFilterButton && (
471
- <FilterSubmitButton
472
- className="wc-block-price-filter__button wc-block-components-price-slider__button"
473
- disabled={ isLoading || ! hasValidConstraints }
474
- onClick={ onSubmit }
475
- screenReaderLabel={ __(
476
- 'Apply price filter',
477
- 'woo-gutenberg-products-block'
478
  ) }
479
- />
480
- ) }
481
- </div>
 
 
 
 
 
 
 
 
 
 
 
482
  </div>
483
  );
484
  };
33
  * Whether values are loading or not.
34
  */
35
  isLoading?: boolean;
36
+ /**
37
+ * Whether values are updating or not. The update starts when the price slider is changed.
38
+ */
39
+ isUpdating?: boolean;
40
  /**
41
  * Maximum constraint.
42
  */
91
  showFilterButton = false,
92
  inlineInput = true,
93
  isLoading = false,
94
+ isUpdating = false,
95
  onSubmit = () => void 0,
96
  }: PriceSliderProps ): JSX.Element => {
97
  const minRange = useRef< HTMLInputElement >( null );
306
  showFilterButton && 'wc-block-price-filter--has-filter-button',
307
  showFilterButton &&
308
  'wc-block-components-price-slider--has-filter-button',
 
309
  ! hasValidConstraints && 'is-disabled',
310
  ( inlineInput || wrapperWidth <= 300 ) &&
311
  'wc-block-components-price-slider--is-input-inline'
330
 
331
  const slider = (
332
  <div
333
+ className={ classnames(
334
+ 'wc-block-price-filter__range-input-wrapper',
335
+ 'wc-block-components-price-slider__range-input-wrapper',
336
+ { 'is-loading': isLoading && isUpdating }
337
+ ) }
338
  onMouseMove={ findClosestRange }
339
  onFocus={ findClosestRange }
340
  >
396
  { ( ! inlineInputAvailable || ! showInputFields ) && slider }
397
  { showInputFields && (
398
  <div className="wc-block-price-filter__controls wc-block-components-price-slider__controls">
399
+ { ! isUpdating ? (
400
+ <FormattedMonetaryAmount
401
+ currency={ currency }
402
+ displayType="input"
403
+ className="wc-block-price-filter__amount wc-block-price-filter__amount--min wc-block-form-text-input wc-block-components-price-slider__amount wc-block-components-price-slider__amount--min"
404
+ aria-label={ __(
405
+ 'Filter products by minimum price',
406
+ 'woo-gutenberg-products-block'
407
+ ) }
408
+ allowNegative={ false }
409
+ isLoading={ isLoading }
410
+ isAllowed={ isValidMinValue( {
411
+ minConstraint,
412
+ minorUnit: currency.minorUnit,
413
+ currentMaxValue: maxPriceInput,
414
+ } ) }
415
+ onValueChange={ ( value ) => {
416
+ if ( value === minPriceInput ) {
417
+ return;
418
+ }
419
+ setMinPriceInput( value );
420
+ } }
421
+ onBlur={ priceInputOnBlur }
422
+ disabled={ isLoading || ! hasValidConstraints }
423
+ value={ minPriceInput }
424
+ />
425
+ ) : (
426
+ <div className="input-loading"></div>
427
+ ) }
428
  { inlineInputAvailable && slider }
429
+ { ! isUpdating ? (
430
+ <FormattedMonetaryAmount
431
+ currency={ currency }
432
+ displayType="input"
433
+ className="wc-block-price-filter__amount wc-block-price-filter__amount--max wc-block-form-text-input wc-block-components-price-slider__amount wc-block-components-price-slider__amount--max"
434
+ aria-label={ __(
435
+ 'Filter products by maximum price',
436
+ 'woo-gutenberg-products-block'
437
+ ) }
438
+ isLoading={ isLoading }
439
+ isAllowed={ isValidMaxValue( {
440
+ maxConstraint,
441
+ minorUnit: currency.minorUnit,
442
+ } ) }
443
+ onValueChange={ ( value ) => {
444
+ if ( value === maxPriceInput ) {
445
+ return;
446
+ }
447
+ setMaxPriceInput( value );
448
+ } }
449
+ onBlur={ priceInputOnBlur }
450
+ disabled={ isLoading || ! hasValidConstraints }
451
+ value={ maxPriceInput }
452
+ />
453
+ ) : (
454
+ <div className="input-loading"></div>
455
+ ) }
456
  </div>
457
  ) }
458
 
459
  { ! showInputFields &&
460
+ ! isUpdating &&
461
  Number.isFinite( minPrice ) &&
462
  Number.isFinite( maxPrice ) && (
463
  <div className="wc-block-price-filter__range-text wc-block-components-price-slider__range-text">
471
  />
472
  </div>
473
  ) }
474
+ {
475
+ <div className="wc-block-components-price-slider__actions">
476
+ { ! isUpdating &&
477
+ ( minPrice !== minConstraint ||
478
+ maxPrice !== maxConstraint ) && (
479
+ <FilterResetButton
480
+ onClick={ () => {
481
+ onChange( [
482
+ minConstraint,
483
+ maxConstraint,
484
+ ] );
485
+ debouncedUpdateQuery();
486
+ } }
487
+ screenReaderLabel={ __(
488
+ 'Reset price filter',
489
+ 'woo-gutenberg-products-block'
490
+ ) }
491
+ />
 
 
 
 
492
  ) }
493
+ { showFilterButton && (
494
+ <FilterSubmitButton
495
+ className="wc-block-price-filter__button wc-block-components-price-slider__button"
496
+ isLoading={ isUpdating }
497
+ disabled={ isLoading || ! hasValidConstraints }
498
+ onClick={ onSubmit }
499
+ screenReaderLabel={ __(
500
+ 'Apply price filter',
501
+ 'woo-gutenberg-products-block'
502
+ ) }
503
+ />
504
+ ) }
505
+ </div>
506
+ }
507
  </div>
508
  );
509
  };
assets/js/base/components/price-slider/style.scss CHANGED
@@ -23,9 +23,11 @@
23
  @include thumbFocus;
24
  }
25
  }
 
26
  @mixin thumbFocus {
27
  background: $gray-900;
28
  }
 
29
  /* stylelint-enable */
30
  @mixin track {
31
  cursor: default;
@@ -35,6 +37,7 @@
35
  -moz-appearance: none;
36
  appearance: none;
37
  }
 
38
  @mixin reset {
39
  margin: 0;
40
  /* Use !important to prevent theme input styles from breaking the component.
@@ -83,6 +86,12 @@
83
  height: 4px;
84
  margin: 15px 0;
85
  position: relative;
 
 
 
 
 
 
86
  }
87
 
88
  .wc-block-components-price-slider__range-input-progress {
@@ -116,6 +125,12 @@
116
  .wc-block-components-price-slider--is-input-inline & {
117
  max-width: 60px;
118
  }
 
 
 
 
 
 
119
  }
120
  }
121
 
@@ -154,10 +169,12 @@
154
  &::-webkit-slider-runnable-track {
155
  @include track;
156
  }
 
157
  &::-webkit-slider-thumb {
158
  @include thumb;
159
  margin: -5px 0 0 0;
160
  }
 
161
  &::-webkit-slider-progress {
162
  @include reset;
163
  }
@@ -165,12 +182,15 @@
165
  &::-moz-focus-outer {
166
  border: 0;
167
  }
 
168
  &::-moz-range-track {
169
  @include track;
170
  }
 
171
  &::-moz-range-progress {
172
  @include reset;
173
  }
 
174
  &::-moz-range-thumb {
175
  @include thumb;
176
  }
@@ -183,9 +203,11 @@
183
  &::-webkit-slider-thumb {
184
  @include thumbFocus;
185
  }
 
186
  &::-moz-range-thumb {
187
  @include thumbFocus;
188
  }
 
189
  &::-ms-thumb {
190
  @include thumbFocus;
191
  }
@@ -198,10 +220,12 @@
198
  margin-left: -2px;
199
  background-position-x: left;
200
  }
 
201
  &::-moz-range-thumb {
202
  background-position-x: left;
203
  transform: translate(-2px, 2px);
204
  }
 
205
  &::-ms-thumb {
206
  background-position-x: left;
207
  }
@@ -214,10 +238,12 @@
214
  background-position-x: right;
215
  margin-left: 2px;
216
  }
 
217
  &::-moz-range-thumb {
218
  background-position-x: right;
219
  transform: translate(2px, 2px);
220
  }
 
221
  &::-ms-thumb {
222
  background-position-x: right;
223
  }
@@ -258,16 +284,20 @@
258
  /*remove default tick marks*/
259
  color: transparent;
260
  }
 
261
  &::-ms-fill-lower {
262
  background: #e1e1e1;
263
  box-shadow: 0 0 0 1px inset #b8b8b8;
264
  }
 
265
  &::-ms-fill-upper {
266
  background: transparent;
267
  }
 
268
  &::-ms-tooltip {
269
  display: none;
270
  }
 
271
  &::-ms-thumb {
272
  transform: translate(1px, 0);
273
  pointer-events: auto;
@@ -278,6 +308,7 @@
278
  background: #e1e1e1;
279
  box-shadow: 0 0 0 1px inset #b8b8b8;
280
  }
 
281
  &::-ms-fill-lower {
282
  background: transparent;
283
  }
@@ -333,9 +364,11 @@
333
  &::-webkit-slider-thumb {
334
  filter: none;
335
  }
 
336
  &::-moz-range-thumb {
337
  filter: none;
338
  }
 
339
  &::-ms-thumb {
340
  filter: none;
341
  }
23
  @include thumbFocus;
24
  }
25
  }
26
+
27
  @mixin thumbFocus {
28
  background: $gray-900;
29
  }
30
+
31
  /* stylelint-enable */
32
  @mixin track {
33
  cursor: default;
37
  -moz-appearance: none;
38
  appearance: none;
39
  }
40
+
41
  @mixin reset {
42
  margin: 0;
43
  /* Use !important to prevent theme input styles from breaking the component.
86
  height: 4px;
87
  margin: 15px 0;
88
  position: relative;
89
+
90
+ &.is-loading {
91
+ @include placeholder();
92
+ height: em(9px);
93
+ border-radius: 0;
94
+ }
95
  }
96
 
97
  .wc-block-components-price-slider__range-input-progress {
125
  .wc-block-components-price-slider--is-input-inline & {
126
  max-width: 60px;
127
  }
128
+
129
+ &.is-loading {
130
+ @include placeholder();
131
+ border-radius: 0 !important;
132
+ width: max-content;
133
+ }
134
  }
135
  }
136
 
169
  &::-webkit-slider-runnable-track {
170
  @include track;
171
  }
172
+
173
  &::-webkit-slider-thumb {
174
  @include thumb;
175
  margin: -5px 0 0 0;
176
  }
177
+
178
  &::-webkit-slider-progress {
179
  @include reset;
180
  }
182
  &::-moz-focus-outer {
183
  border: 0;
184
  }
185
+
186
  &::-moz-range-track {
187
  @include track;
188
  }
189
+
190
  &::-moz-range-progress {
191
  @include reset;
192
  }
193
+
194
  &::-moz-range-thumb {
195
  @include thumb;
196
  }
203
  &::-webkit-slider-thumb {
204
  @include thumbFocus;
205
  }
206
+
207
  &::-moz-range-thumb {
208
  @include thumbFocus;
209
  }
210
+
211
  &::-ms-thumb {
212
  @include thumbFocus;
213
  }
220
  margin-left: -2px;
221
  background-position-x: left;
222
  }
223
+
224
  &::-moz-range-thumb {
225
  background-position-x: left;
226
  transform: translate(-2px, 2px);
227
  }
228
+
229
  &::-ms-thumb {
230
  background-position-x: left;
231
  }
238
  background-position-x: right;
239
  margin-left: 2px;
240
  }
241
+
242
  &::-moz-range-thumb {
243
  background-position-x: right;
244
  transform: translate(2px, 2px);
245
  }
246
+
247
  &::-ms-thumb {
248
  background-position-x: right;
249
  }
284
  /*remove default tick marks*/
285
  color: transparent;
286
  }
287
+
288
  &::-ms-fill-lower {
289
  background: #e1e1e1;
290
  box-shadow: 0 0 0 1px inset #b8b8b8;
291
  }
292
+
293
  &::-ms-fill-upper {
294
  background: transparent;
295
  }
296
+
297
  &::-ms-tooltip {
298
  display: none;
299
  }
300
+
301
  &::-ms-thumb {
302
  transform: translate(1px, 0);
303
  pointer-events: auto;
308
  background: #e1e1e1;
309
  box-shadow: 0 0 0 1px inset #b8b8b8;
310
  }
311
+
312
  &::-ms-fill-lower {
313
  background: transparent;
314
  }
364
  &::-webkit-slider-thumb {
365
  filter: none;
366
  }
367
+
368
  &::-moz-range-thumb {
369
  filter: none;
370
  }
371
+
372
  &::-ms-thumb {
373
  filter: none;
374
  }
assets/js/base/context/providers/add-to-cart-form/form-state/index.js CHANGED
@@ -245,7 +245,7 @@ export const AddToCartFormStateContextProvider = ( {
245
  const message =
246
  data.processingResponse?.message ||
247
  __(
248
- 'Something went wrong. Please contact us to get assistance.',
249
  'woo-gutenberg-products-block'
250
  );
251
  createErrorNotice( message, {
245
  const message =
246
  data.processingResponse?.message ||
247
  __(
248
+ 'Something went wrong. Please contact us for assistance.',
249
  'woo-gutenberg-products-block'
250
  );
251
  createErrorNotice( message, {
assets/js/base/context/providers/add-to-cart-form/form/submit/index.js CHANGED
@@ -101,7 +101,7 @@ const FormSubmit = () => {
101
  } else {
102
  createErrorNotice(
103
  __(
104
- 'Something went wrong. Please contact us to get assistance.',
105
  'woo-gutenberg-products-block'
106
  ),
107
  {
101
  } else {
102
  createErrorNotice(
103
  __(
104
+ 'Something went wrong. Please contact us for assistance.',
105
  'woo-gutenberg-products-block'
106
  ),
107
  {
assets/js/base/context/providers/cart-checkout/checkout-processor.js CHANGED
@@ -257,7 +257,7 @@ const CheckoutProcessor = () => {
257
  ),
258
  errorResponse?.message ??
259
  __(
260
- 'Something went wrong.',
261
  'woo-gutenberg-products-block'
262
  )
263
  ),
257
  ),
258
  errorResponse?.message ??
259
  __(
260
+ 'Something went wrong. Please contact us for assistance.',
261
  'woo-gutenberg-products-block'
262
  )
263
  ),
assets/js/base/context/providers/cart-checkout/checkout-state/index.tsx CHANGED
@@ -265,7 +265,7 @@ export const CheckoutStateProvider = ( {
265
  const message =
266
  data.processingResponse?.message ||
267
  __(
268
- 'Something went wrong. Please contact us to get assistance.',
269
  'woo-gutenberg-products-block'
270
  );
271
  createErrorNotice( message, {
265
  const message =
266
  data.processingResponse?.message ||
267
  __(
268
+ 'Something went wrong. Please contact us for assistance.',
269
  'woo-gutenberg-products-block'
270
  );
271
  createErrorNotice( message, {
assets/js/base/context/providers/cart-checkout/checkout-state/utils.ts CHANGED
@@ -53,7 +53,7 @@ export const getPaymentResultFromCheckoutResponse = (
53
  response.data.status > 299
54
  ) {
55
  paymentResult.message = __(
56
- 'Something went wrong. Please contact us to get assistance.',
57
  'woo-gutenberg-products-block'
58
  );
59
  }
53
  response.data.status > 299
54
  ) {
55
  paymentResult.message = __(
56
+ 'Something went wrong. Please contact us for assistance.',
57
  'woo-gutenberg-products-block'
58
  );
59
  }
assets/js/base/hooks/index.js CHANGED
@@ -8,3 +8,4 @@ export * from './use-spacing-props';
8
  export * from './use-typography-props';
9
  export * from './use-color-props';
10
  export * from './use-border-props';
 
8
  export * from './use-typography-props';
9
  export * from './use-color-props';
10
  export * from './use-border-props';
11
+ export * from './use-is-mounted';
assets/js/base/hooks/use-is-mounted.ts ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { useCallback, useEffect, useRef } from '@wordpress/element';
5
+
6
+ /**
7
+ * Returns a boolean value based on whether the current component has been mounted.
8
+ *
9
+ * @return {boolean} If the component has been mounted.
10
+ *
11
+ * @example
12
+ *
13
+ * ```js
14
+ * const App = () => {
15
+ * const isMounted = useIsMounted();
16
+ *
17
+ * if ( ! isMounted() ) {
18
+ * return null;
19
+ * }
20
+ *
21
+ * return </div>;
22
+ * };
23
+ * ```
24
+ */
25
+
26
+ export function useIsMounted() {
27
+ const isMounted = useRef( false );
28
+
29
+ useEffect( () => {
30
+ isMounted.current = true;
31
+
32
+ return () => {
33
+ isMounted.current = false;
34
+ };
35
+ }, [] );
36
+
37
+ return useCallback( () => isMounted.current, [] );
38
+ }
assets/js/blocks/active-filters/active-attribute-filters.tsx CHANGED
@@ -1,6 +1,7 @@
1
  /**
2
  * External dependencies
3
  */
 
4
  import {
5
  useCollection,
6
  useQueryStateByKey,
@@ -26,22 +27,25 @@ interface ActiveAttributeFiltersProps {
26
  operator: 'and' | 'in';
27
  slugs: string[];
28
  attributeObject: AttributeObject;
 
29
  }
30
 
31
  /**
32
  * Component that renders active attribute (terms) filters.
33
  *
34
- * @param {Object} props Incoming props for the component.
35
- * @param {Object} props.attributeObject The attribute object.
36
- * @param {Array} props.slugs The slugs for attributes.
37
- * @param {string} props.operator The operator for the filter.
38
- * @param {string} props.displayStyle The style used for displaying the filters.
 
39
  */
40
  const ActiveAttributeFilters = ( {
41
  attributeObject,
42
  slugs = [],
43
  operator = 'in',
44
  displayStyle,
 
45
  }: ActiveAttributeFiltersProps ) => {
46
  const { results, isLoading } = useCollection( {
47
  namespace: '/wc/store/v1',
@@ -54,8 +58,11 @@ const ActiveAttributeFilters = ( {
54
  []
55
  );
56
 
 
 
 
 
57
  if (
58
- isLoading ||
59
  ! Array.isArray( results ) ||
60
  ! isAttributeTermCollection( results ) ||
61
  ! isAttributeQueryCollection( productAttributes )
@@ -91,7 +98,7 @@ const ActiveAttributeFilters = ( {
91
  if ( index > 0 && operator === 'and' ) {
92
  prefix = (
93
  <span className="wc-block-active-filters__list-item-operator">
94
- { __( 'and', 'woo-gutenberg-products-block' ) }
95
  </span>
96
  );
97
  }
@@ -100,6 +107,7 @@ const ActiveAttributeFilters = ( {
100
  type: attributeLabel,
101
  name: decodeEntities( termObject.name || slug ),
102
  prefix,
 
103
  removeCallback: () => {
104
  const currentAttribute = productAttributes.find(
105
  ( { attribute } ) =>
1
  /**
2
  * External dependencies
3
  */
4
+ import { useEffect } from '@wordpress/element';
5
  import {
6
  useCollection,
7
  useQueryStateByKey,
27
  operator: 'and' | 'in';
28
  slugs: string[];
29
  attributeObject: AttributeObject;
30
+ isLoadingCallback: ( val: boolean ) => void;
31
  }
32
 
33
  /**
34
  * Component that renders active attribute (terms) filters.
35
  *
36
+ * @param {Object} props Incoming props for the component.
37
+ * @param {Object} props.attributeObject The attribute object.
38
+ * @param {Array} props.slugs The slugs for attributes.
39
+ * @param {string} props.operator The operator for the filter.
40
+ * @param {string} props.displayStyle The style used for displaying the filters.
41
+ * @param {string} props.isLoadingCallback The callback to trigger the loading complete state.
42
  */
43
  const ActiveAttributeFilters = ( {
44
  attributeObject,
45
  slugs = [],
46
  operator = 'in',
47
  displayStyle,
48
+ isLoadingCallback,
49
  }: ActiveAttributeFiltersProps ) => {
50
  const { results, isLoading } = useCollection( {
51
  namespace: '/wc/store/v1',
58
  []
59
  );
60
 
61
+ useEffect( () => {
62
+ isLoadingCallback( isLoading );
63
+ }, [ isLoading, isLoadingCallback ] );
64
+
65
  if (
 
66
  ! Array.isArray( results ) ||
67
  ! isAttributeTermCollection( results ) ||
68
  ! isAttributeQueryCollection( productAttributes )
98
  if ( index > 0 && operator === 'and' ) {
99
  prefix = (
100
  <span className="wc-block-active-filters__list-item-operator">
101
+ { __( 'All', 'woo-gutenberg-products-block' ) }
102
  </span>
103
  );
104
  }
107
  type: attributeLabel,
108
  name: decodeEntities( termObject.name || slug ),
109
  prefix,
110
+ isLoading,
111
  removeCallback: () => {
112
  const currentAttribute = productAttributes.find(
113
  ( { attribute } ) =>
assets/js/blocks/active-filters/block.json CHANGED
@@ -2,7 +2,7 @@
2
  "name": "woocommerce/active-filters",
3
  "version": "1.0.0",
4
  "title": "Active Product Filters",
5
- "description": "Show the currently active product filters. Works in combination with the All Products and filters blocks.",
6
  "category": "woocommerce",
7
  "keywords": [ "WooCommerce" ],
8
  "supports": {
2
  "name": "woocommerce/active-filters",
3
  "version": "1.0.0",
4
  "title": "Active Product Filters",
5
+ "description": "Display the currently active product filters.",
6
  "category": "woocommerce",
7
  "keywords": [ "WooCommerce" ],
8
  "supports": {
assets/js/blocks/active-filters/block.tsx CHANGED
@@ -4,7 +4,7 @@
4
  import { __, sprintf } from '@wordpress/i18n';
5
  import { useQueryStateByKey } from '@woocommerce/base-context/hooks';
6
  import { getSetting, getSettingWithCoercion } from '@woocommerce/settings';
7
- import { useMemo, useEffect } from '@wordpress/element';
8
  import classnames from 'classnames';
9
  import PropTypes from 'prop-types';
10
  import Label from '@woocommerce/base-components/label';
@@ -16,6 +16,8 @@ import {
16
  isStockStatusOptions,
17
  } from '@woocommerce/types';
18
  import { getUrlParameter } from '@woocommerce/utils';
 
 
19
 
20
  /**
21
  * Internal dependencies
@@ -27,8 +29,11 @@ import {
27
  renderRemovableListItem,
28
  removeArgsFromFilterUrl,
29
  cleanFilterUrl,
 
 
30
  } from './utils';
31
  import ActiveAttributeFilters from './active-attribute-filters';
 
32
  import { Attributes } from './types';
33
 
34
  /**
@@ -45,11 +50,20 @@ const ActiveFiltersBlock = ( {
45
  attributes: Attributes;
46
  isEditor?: boolean;
47
  } ) => {
 
 
48
  const filteringForPhpTemplate = getSettingWithCoercion(
49
  'is_rendering_php_template',
50
  false,
51
  isBoolean
52
  );
 
 
 
 
 
 
 
53
  const [ productAttributes, setProductAttributes ] = useQueryStateByKey(
54
  'attributes',
55
  []
@@ -62,8 +76,10 @@ const ActiveFiltersBlock = ( {
62
  const [ maxPrice, setMaxPrice ] = useQueryStateByKey( 'max_price' );
63
 
64
  const STOCK_STATUS_OPTIONS = getSetting( 'stockStatusOptions', [] );
 
65
  const activeStockStatusFilters = useMemo( () => {
66
  if (
 
67
  productStockStatus.length === 0 ||
68
  ! isStockStatusQueryCollection( productStockStatus ) ||
69
  ! isStockStatusOptions( STOCK_STATUS_OPTIONS )
@@ -92,6 +108,7 @@ const ActiveFiltersBlock = ( {
92
  } );
93
  } );
94
  }, [
 
95
  STOCK_STATUS_OPTIONS,
96
  productStockStatus,
97
  setProductStockStatus,
@@ -100,7 +117,10 @@ const ActiveFiltersBlock = ( {
100
  ] );
101
 
102
  const activePriceFilters = useMemo( () => {
103
- if ( ! Number.isFinite( minPrice ) && ! Number.isFinite( maxPrice ) ) {
 
 
 
104
  return null;
105
  }
106
  return renderRemovableListItem( {
@@ -116,6 +136,7 @@ const ActiveFiltersBlock = ( {
116
  displayStyle: blockAttributes.displayStyle,
117
  } );
118
  }, [
 
119
  minPrice,
120
  maxPrice,
121
  blockAttributes.displayStyle,
@@ -125,7 +146,13 @@ const ActiveFiltersBlock = ( {
125
  ] );
126
 
127
  const activeAttributeFilters = useMemo( () => {
128
- if ( ! isAttributeQueryCollection( productAttributes ) ) {
 
 
 
 
 
 
129
  return null;
130
  }
131
 
@@ -135,6 +162,7 @@ const ActiveFiltersBlock = ( {
135
  );
136
 
137
  if ( ! attributeObject ) {
 
138
  return null;
139
  }
140
 
@@ -145,10 +173,16 @@ const ActiveFiltersBlock = ( {
145
  slugs={ attribute.slug }
146
  key={ attribute.attribute }
147
  operator={ attribute.operator }
 
148
  />
149
  );
150
  } );
151
- }, [ productAttributes, blockAttributes.displayStyle ] );
 
 
 
 
 
152
 
153
  const [ productRatings, setProductRatings ] =
154
  useQueryStateByKey( 'ratings' );
@@ -177,6 +211,7 @@ const ActiveFiltersBlock = ( {
177
 
178
  const activeRatingFilters = useMemo( () => {
179
  if (
 
180
  productRatings.length === 0 ||
181
  ! isRatingQueryCollection( productRatings )
182
  ) {
@@ -206,6 +241,7 @@ const ActiveFiltersBlock = ( {
206
  } );
207
  } );
208
  }, [
 
209
  productRatings,
210
  setProductRatings,
211
  blockAttributes.displayStyle,
@@ -222,12 +258,25 @@ const ActiveFiltersBlock = ( {
222
  );
223
  };
224
 
225
- if ( ! hasFilters() && ! isEditor ) {
226
  return null;
227
  }
228
 
229
  const TagName =
230
  `h${ blockAttributes.headingLevel }` as keyof JSX.IntrinsicElements;
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  const hasFilterableProducts = getSettingWithCoercion(
232
  'has_filterable_products',
233
  false,
@@ -241,15 +290,12 @@ const ActiveFiltersBlock = ( {
241
  const listClasses = classnames( 'wc-block-active-filters__list', {
242
  'wc-block-active-filters__list--chips':
243
  blockAttributes.displayStyle === 'chips',
 
244
  } );
245
 
246
  return (
247
  <>
248
- { ! isEditor && blockAttributes.heading && (
249
- <TagName className="wc-block-active-filters__title">
250
- { blockAttributes.heading }
251
- </TagName>
252
- ) }
253
  <div className="wc-block-active-filters">
254
  <ul className={ listClasses }>
255
  { isEditor ? (
@@ -279,6 +325,10 @@ const ActiveFiltersBlock = ( {
279
  </>
280
  ) : (
281
  <>
 
 
 
 
282
  { activePriceFilters }
283
  { activeStockStatusFilters }
284
  { activeAttributeFilters }
@@ -286,29 +336,33 @@ const ActiveFiltersBlock = ( {
286
  </>
287
  ) }
288
  </ul>
289
- <button
290
- className="wc-block-active-filters__clear-all"
291
- onClick={ () => {
292
- cleanFilterUrl();
293
- if ( ! filteringForPhpTemplate ) {
294
- setMinPrice( undefined );
295
- setMaxPrice( undefined );
296
- setProductAttributes( [] );
297
- setProductStockStatus( [] );
298
- }
299
- } }
300
- >
301
- <Label
302
- label={ __(
303
- 'Clear All',
304
- 'woo-gutenberg-products-block'
305
- ) }
306
- screenReaderLabel={ __(
307
- 'Clear All Filters',
308
- 'woo-gutenberg-products-block'
309
- ) }
310
- />
311
- </button>
 
 
 
 
312
  </div>
313
  </>
314
  );
4
  import { __, sprintf } from '@wordpress/i18n';
5
  import { useQueryStateByKey } from '@woocommerce/base-context/hooks';
6
  import { getSetting, getSettingWithCoercion } from '@woocommerce/settings';
7
+ import { useMemo, useEffect, useState } from '@wordpress/element';
8
  import classnames from 'classnames';
9
  import PropTypes from 'prop-types';
10
  import Label from '@woocommerce/base-components/label';
16
  isStockStatusOptions,
17
  } from '@woocommerce/types';
18
  import { getUrlParameter } from '@woocommerce/utils';
19
+ import FilterTitlePlaceholder from '@woocommerce/base-components/filter-placeholder';
20
+ import { useIsMounted } from '@woocommerce/base-hooks';
21
 
22
  /**
23
  * Internal dependencies
29
  renderRemovableListItem,
30
  removeArgsFromFilterUrl,
31
  cleanFilterUrl,
32
+ maybeUrlContainsFilters,
33
+ urlContainsAttributeFilter,
34
  } from './utils';
35
  import ActiveAttributeFilters from './active-attribute-filters';
36
+ import FilterPlaceholders from './filter-placeholders';
37
  import { Attributes } from './types';
38
 
39
  /**
50
  attributes: Attributes;
51
  isEditor?: boolean;
52
  } ) => {
53
+ const isMounted = useIsMounted();
54
+ const componentHasMounted = isMounted();
55
  const filteringForPhpTemplate = getSettingWithCoercion(
56
  'is_rendering_php_template',
57
  false,
58
  isBoolean
59
  );
60
+ const [ isLoading, setIsLoading ] = useState( true );
61
+ /*
62
+ activeAttributeFilters is the only async query in this block. Because of this the rest of the filters will render null
63
+ when in a loading state and activeAttributeFilters renders the placeholders.
64
+ */
65
+ const shouldShowLoadingPlaceholders =
66
+ maybeUrlContainsFilters() && ! isEditor && isLoading;
67
  const [ productAttributes, setProductAttributes ] = useQueryStateByKey(
68
  'attributes',
69
  []
76
  const [ maxPrice, setMaxPrice ] = useQueryStateByKey( 'max_price' );
77
 
78
  const STOCK_STATUS_OPTIONS = getSetting( 'stockStatusOptions', [] );
79
+ const STORE_ATTRIBUTES = getSetting( 'attributes', [] );
80
  const activeStockStatusFilters = useMemo( () => {
81
  if (
82
+ shouldShowLoadingPlaceholders ||
83
  productStockStatus.length === 0 ||
84
  ! isStockStatusQueryCollection( productStockStatus ) ||
85
  ! isStockStatusOptions( STOCK_STATUS_OPTIONS )
108
  } );
109
  } );
110
  }, [
111
+ shouldShowLoadingPlaceholders,
112
  STOCK_STATUS_OPTIONS,
113
  productStockStatus,
114
  setProductStockStatus,
117
  ] );
118
 
119
  const activePriceFilters = useMemo( () => {
120
+ if (
121
+ shouldShowLoadingPlaceholders ||
122
+ ( ! Number.isFinite( minPrice ) && ! Number.isFinite( maxPrice ) )
123
+ ) {
124
  return null;
125
  }
126
  return renderRemovableListItem( {
136
  displayStyle: blockAttributes.displayStyle,
137
  } );
138
  }, [
139
+ shouldShowLoadingPlaceholders,
140
  minPrice,
141
  maxPrice,
142
  blockAttributes.displayStyle,
146
  ] );
147
 
148
  const activeAttributeFilters = useMemo( () => {
149
+ if (
150
+ ( ! isAttributeQueryCollection( productAttributes ) &&
151
+ componentHasMounted ) ||
152
+ ( ! productAttributes.length &&
153
+ ! urlContainsAttributeFilter( STORE_ATTRIBUTES ) )
154
+ ) {
155
+ setIsLoading( false );
156
  return null;
157
  }
158
 
162
  );
163
 
164
  if ( ! attributeObject ) {
165
+ setIsLoading( false );
166
  return null;
167
  }
168
 
173
  slugs={ attribute.slug }
174
  key={ attribute.attribute }
175
  operator={ attribute.operator }
176
+ isLoadingCallback={ setIsLoading }
177
  />
178
  );
179
  } );
180
+ }, [
181
+ componentHasMounted,
182
+ setIsLoading,
183
+ productAttributes,
184
+ blockAttributes.displayStyle,
185
+ ] );
186
 
187
  const [ productRatings, setProductRatings ] =
188
  useQueryStateByKey( 'ratings' );
211
 
212
  const activeRatingFilters = useMemo( () => {
213
  if (
214
+ shouldShowLoadingPlaceholders ||
215
  productRatings.length === 0 ||
216
  ! isRatingQueryCollection( productRatings )
217
  ) {
241
  } );
242
  } );
243
  }, [
244
+ shouldShowLoadingPlaceholders,
245
  productRatings,
246
  setProductRatings,
247
  blockAttributes.displayStyle,
258
  );
259
  };
260
 
261
+ if ( ! shouldShowLoadingPlaceholders && ! hasFilters() && ! isEditor ) {
262
  return null;
263
  }
264
 
265
  const TagName =
266
  `h${ blockAttributes.headingLevel }` as keyof JSX.IntrinsicElements;
267
+
268
+ const heading = (
269
+ <TagName className="wc-block-active-filters__title">
270
+ { blockAttributes.heading }
271
+ </TagName>
272
+ );
273
+
274
+ const filterHeading = shouldShowLoadingPlaceholders ? (
275
+ <FilterTitlePlaceholder>{ heading }</FilterTitlePlaceholder>
276
+ ) : (
277
+ heading
278
+ );
279
+
280
  const hasFilterableProducts = getSettingWithCoercion(
281
  'has_filterable_products',
282
  false,
290
  const listClasses = classnames( 'wc-block-active-filters__list', {
291
  'wc-block-active-filters__list--chips':
292
  blockAttributes.displayStyle === 'chips',
293
+ 'wc-block-active-filters--loading': shouldShowLoadingPlaceholders,
294
  } );
295
 
296
  return (
297
  <>
298
+ { ! isEditor && blockAttributes.heading && filterHeading }
 
 
 
 
299
  <div className="wc-block-active-filters">
300
  <ul className={ listClasses }>
301
  { isEditor ? (
325
  </>
326
  ) : (
327
  <>
328
+ <FilterPlaceholders
329
+ isLoading={ shouldShowLoadingPlaceholders }
330
+ displayStyle={ blockAttributes.displayStyle }
331
+ />
332
  { activePriceFilters }
333
  { activeStockStatusFilters }
334
  { activeAttributeFilters }
336
  </>
337
  ) }
338
  </ul>
339
+ { shouldShowLoadingPlaceholders ? (
340
+ <span className="wc-block-active-filters__clear-all-placeholder" />
341
+ ) : (
342
+ <button
343
+ className="wc-block-active-filters__clear-all"
344
+ onClick={ () => {
345
+ cleanFilterUrl();
346
+ if ( ! filteringForPhpTemplate ) {
347
+ setMinPrice( undefined );
348
+ setMaxPrice( undefined );
349
+ setProductAttributes( [] );
350
+ setProductStockStatus( [] );
351
+ }
352
+ } }
353
+ >
354
+ <Label
355
+ label={ __(
356
+ 'Clear All',
357
+ 'woo-gutenberg-products-block'
358
+ ) }
359
+ screenReaderLabel={ __(
360
+ 'Clear All Filters',
361
+ 'woo-gutenberg-products-block'
362
+ ) }
363
+ />
364
+ </button>
365
+ ) }
366
  </div>
367
  </>
368
  );
assets/js/blocks/active-filters/filter-placeholders.tsx ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const FilterPlaceholders = ( {
2
+ displayStyle,
3
+ isLoading,
4
+ }: {
5
+ isLoading: boolean;
6
+ displayStyle: string;
7
+ } ) => {
8
+ if ( ! isLoading ) {
9
+ return null;
10
+ }
11
+
12
+ return (
13
+ <>
14
+ { [ ...Array( displayStyle === 'list' ? 2 : 3 ) ].map( ( x, i ) => (
15
+ <li
16
+ className={
17
+ displayStyle === 'list'
18
+ ? 'show-loading-state-list'
19
+ : 'show-loading-state-chips'
20
+ }
21
+ key={ i }
22
+ >
23
+ <span className="show-loading-state__inner" />
24
+ </li>
25
+ ) ) }
26
+ </>
27
+ );
28
+ };
29
+
30
+ export default FilterPlaceholders;
assets/js/blocks/active-filters/index.tsx CHANGED
@@ -19,7 +19,7 @@ import { Attributes } from './types';
19
  registerBlockType( metadata, {
20
  title: __( 'Active Product Filters', 'woo-gutenberg-products-block' ),
21
  description: __(
22
- 'Show the currently active product filters. Works in combination with the All Products and filters blocks.',
23
  'woo-gutenberg-products-block'
24
  ),
25
  icon: {
19
  registerBlockType( metadata, {
20
  title: __( 'Active Product Filters', 'woo-gutenberg-products-block' ),
21
  description: __(
22
+ 'Display the currently active product filters.',
23
  'woo-gutenberg-products-block'
24
  ),
25
  icon: {
assets/js/blocks/active-filters/style.scss CHANGED
@@ -7,6 +7,17 @@
7
  h6 {
8
  text-transform: inherit;
9
  }
 
 
 
 
 
 
 
 
 
 
 
10
  }
11
 
12
  .wc-block-active-filters {
@@ -14,12 +25,13 @@
14
  overflow: hidden;
15
 
16
  .wc-block-active-filters__clear-all {
17
- @include font-size(smaller);
18
  border: none;
19
  margin-top: 15px;
20
  padding: 0;
21
  text-decoration: underline;
22
  cursor: pointer;
 
23
 
24
  &,
25
  &:hover,
@@ -30,12 +42,35 @@
30
  }
31
  }
32
 
 
 
 
 
 
 
 
 
 
33
  .wc-block-active-filters__list {
34
  margin: 0 0 $gap-smallest;
35
  padding: 0;
36
  list-style: none outside;
37
  clear: both;
38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
  li {
40
  margin: 9px 0 0;
41
  padding: 0;
@@ -56,6 +91,46 @@
56
  > li:first-child {
57
  margin: 0;
58
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  }
60
 
61
  .wc-block-active-filters__list-item-type {
@@ -73,7 +148,6 @@
73
  }
74
 
75
  .wc-block-active-filters__list-item-name {
76
- @include font-size(smaller);
77
  display: flex;
78
  align-items: center;
79
  position: relative;
@@ -81,17 +155,26 @@
81
  }
82
 
83
  .wc-block-active-filters__list-item-remove {
84
- background: transparent;
 
85
  border: 0;
 
86
  appearance: none;
 
87
  height: 16px;
88
  width: 16px;
 
89
  padding: 0;
90
- margin: 0 16px 0 0;
91
  color: currentColor;
92
 
93
- &:hover {
94
- color: $gray-600;
 
 
 
 
 
95
  }
96
 
97
  &:disabled {
@@ -111,7 +194,6 @@
111
  }
112
 
113
  .wc-block-components-chip {
114
- @include font-size(small);
115
  margin-top: em($gap-small * 0.25);
116
  margin-bottom: em($gap-small * 0.25);
117
  }
7
  h6 {
8
  text-transform: inherit;
9
  }
10
+
11
+ .wc-block-filter-title-placeholder {
12
+ .wc-block-active-filters__title {
13
+ height: 1em;
14
+ }
15
+ }
16
+
17
+ > .wc-block-active-filters__title {
18
+ margin-top: $gap-small;
19
+ margin-bottom: $gap-small;
20
+ }
21
  }
22
 
23
  .wc-block-active-filters {
25
  overflow: hidden;
26
 
27
  .wc-block-active-filters__clear-all {
28
+ @include font-size(small);
29
  border: none;
30
  margin-top: 15px;
31
  padding: 0;
32
  text-decoration: underline;
33
  cursor: pointer;
34
+ float: right;
35
 
36
  &,
37
  &:hover,
42
  }
43
  }
44
 
45
+ .wc-block-active-filters__clear-all-placeholder {
46
+ @include placeholder();
47
+ display: inline-block;
48
+ width: 80px;
49
+ height: 1em;
50
+ float: right;
51
+ border-radius: 0;
52
+ }
53
+
54
  .wc-block-active-filters__list {
55
  margin: 0 0 $gap-smallest;
56
  padding: 0;
57
  list-style: none outside;
58
  clear: both;
59
 
60
+ &.wc-block-active-filters--loading {
61
+ margin-top: $gap-small;
62
+ display: flex;
63
+ flex-direction: column;
64
+ flex-wrap: nowrap;
65
+
66
+ &.wc-block-active-filters__list--chips {
67
+ flex-direction: row;
68
+ flex-wrap: wrap;
69
+ align-items: flex-end;
70
+ gap: 0 10px;
71
+ }
72
+ }
73
+
74
  li {
75
  margin: 9px 0 0;
76
  padding: 0;
91
  > li:first-child {
92
  margin: 0;
93
  }
94
+ li.show-loading-state-list {
95
+ display: inline-block;
96
+
97
+ > span {
98
+ @include placeholder();
99
+ display: inline-block;
100
+ box-shadow: none;
101
+ border-radius: 0;
102
+ height: 1em;
103
+ width: 100%;
104
+ }
105
+ }
106
+
107
+ li.show-loading-state-chips {
108
+ display: inline-block;
109
+
110
+ > span {
111
+ @include placeholder();
112
+ display: inline-block;
113
+ box-shadow: none;
114
+ border-radius: 13px;
115
+ height: 1em;
116
+ width: 100%;
117
+ min-width: 70px;
118
+ margin-right: 15px !important;
119
+ }
120
+
121
+ &:last-of-type > span {
122
+ margin-right: 0 !important;
123
+ }
124
+
125
+ &:nth-child(3) {
126
+ flex-grow: 1;
127
+ max-width: 200px;
128
+ }
129
+ }
130
+
131
+ > .wc-block-active-filters__list-item .wc-block-active-filters__list-item-name {
132
+ margin: 9px 0 0;
133
+ }
134
  }
135
 
136
  .wc-block-active-filters__list-item-type {
148
  }
149
 
150
  .wc-block-active-filters__list-item-name {
 
151
  display: flex;
152
  align-items: center;
153
  position: relative;
155
  }
156
 
157
  .wc-block-active-filters__list-item-remove {
158
+ @include font-size(smaller);
159
+ background: $gray-200;
160
  border: 0;
161
+ border-radius: 25px;
162
  appearance: none;
163
+ padding: 0;
164
  height: 16px;
165
  width: 16px;
166
+ line-height: 16px;
167
  padding: 0;
168
+ margin: 0 0.5em 0 0;
169
  color: currentColor;
170
 
171
+ &:hover,
172
+ &:focus {
173
+ background: $gray-600;
174
+
175
+ .wc-block-components-chip__remove-icon {
176
+ fill: #fff;
177
+ }
178
  }
179
 
180
  &:disabled {
194
  }
195
 
196
  .wc-block-components-chip {
 
197
  margin-top: em($gap-small * 0.25);
198
  margin-bottom: em($gap-small * 0.25);
199
  }
assets/js/blocks/active-filters/utils.tsx CHANGED
@@ -7,6 +7,7 @@ import { RemovableChip } from '@woocommerce/base-components/chip';
7
  import Label from '@woocommerce/base-components/label';
8
  import { getQueryArgs, addQueryArgs, removeQueryArgs } from '@wordpress/url';
9
  import { changeUrl } from '@woocommerce/utils';
 
10
 
11
  /**
12
  * Format a min/max price range to display.
@@ -44,6 +45,7 @@ interface RemovableListItemProps {
44
  name: string;
45
  prefix?: string | JSX.Element;
46
  showLabel?: boolean;
 
47
  displayStyle: string;
48
  removeCallback?: () => void;
49
  }
@@ -107,39 +109,11 @@ export const renderRemovableListItem = ( {
107
  className="wc-block-active-filters__list-item-remove"
108
  onClick={ removeCallback }
109
  >
110
- <svg
111
- width="16"
112
- height="16"
113
- viewBox="0 0 16 16"
114
- fill="none"
115
- xmlns="http://www.w3.org/2000/svg"
116
- >
117
- <ellipse
118
- cx="8"
119
- cy="8"
120
- rx="8"
121
- ry="8"
122
- transform="rotate(-180 8 8)"
123
- fill="currentColor"
124
- fillOpacity="0.7"
125
- />
126
- <rect
127
- x="10.636"
128
- y="3.94983"
129
- width="2"
130
- height="9.9466"
131
- transform="rotate(45 10.636 3.94983)"
132
- fill="white"
133
- />
134
- <rect
135
- x="12.0503"
136
- y="11.0209"
137
- width="2"
138
- height="9.9466"
139
- transform="rotate(135 12.0503 11.0209)"
140
- fill="white"
141
- />
142
- </svg>
143
  <Label screenReaderLabel={ removeText } />
144
  </button>
145
  { prefixedName }
@@ -190,6 +164,35 @@ export const removeArgsFromFilterUrl = (
190
  changeUrl( newUrl );
191
  };
192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  /**
194
  * Clean the filter URL.
195
  */
@@ -204,13 +207,7 @@ export const cleanFilterUrl = () => {
204
  const remainingArgs = Object.fromEntries(
205
  Object.keys( args )
206
  .filter( ( arg ) => {
207
- if (
208
- arg.includes( 'min_price' ) ||
209
- arg.includes( 'max_price' ) ||
210
- arg.includes( 'rating_filter' ) ||
211
- arg.includes( 'filter_' ) ||
212
- arg.includes( 'query_type_' )
213
- ) {
214
  return false;
215
  }
216
 
@@ -223,3 +220,60 @@ export const cleanFilterUrl = () => {
223
 
224
  changeUrl( newUrl );
225
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  import Label from '@woocommerce/base-components/label';
8
  import { getQueryArgs, addQueryArgs, removeQueryArgs } from '@wordpress/url';
9
  import { changeUrl } from '@woocommerce/utils';
10
+ import { Icon, closeSmall } from '@wordpress/icons';
11
 
12
  /**
13
  * Format a min/max price range to display.
45
  name: string;
46
  prefix?: string | JSX.Element;
47
  showLabel?: boolean;
48
+ isLoading?: boolean;
49
  displayStyle: string;
50
  removeCallback?: () => void;
51
  }
109
  className="wc-block-active-filters__list-item-remove"
110
  onClick={ removeCallback }
111
  >
112
+ <Icon
113
+ className="wc-block-components-chip__remove-icon"
114
+ icon={ closeSmall }
115
+ size={ 16 }
116
+ />
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  <Label screenReaderLabel={ removeText } />
118
  </button>
119
  { prefixedName }
164
  changeUrl( newUrl );
165
  };
166
 
167
+ /**
168
+ * Prefixes typically expected before filters in the URL.
169
+ */
170
+ const FILTER_QUERY_VALUES = [
171
+ 'min_price',
172
+ 'max_price',
173
+ 'rating_filter',
174
+ 'filter_',
175
+ 'query_type_',
176
+ ];
177
+
178
+ /**
179
+ * Check if the URL contains arguments that could be Woo filter keys.
180
+ */
181
+ const keyIsAFilter = ( key: string ): boolean => {
182
+ let keyIsFilter = false;
183
+
184
+ for ( let i = 0; FILTER_QUERY_VALUES.length > i; i++ ) {
185
+ const keyToMatch = FILTER_QUERY_VALUES[ i ];
186
+ const trimmedKey = key.substring( 0, keyToMatch.length );
187
+ if ( keyToMatch === trimmedKey ) {
188
+ keyIsFilter = true;
189
+ break;
190
+ }
191
+ }
192
+
193
+ return keyIsFilter;
194
+ };
195
+
196
  /**
197
  * Clean the filter URL.
198
  */
207
  const remainingArgs = Object.fromEntries(
208
  Object.keys( args )
209
  .filter( ( arg ) => {
210
+ if ( keyIsAFilter( arg ) ) {
 
 
 
 
 
 
211
  return false;
212
  }
213
 
220
 
221
  changeUrl( newUrl );
222
  };
223
+
224
+ export const maybeUrlContainsFilters = (): boolean => {
225
+ if ( ! window ) {
226
+ return false;
227
+ }
228
+
229
+ const url = window.location.href;
230
+ const args = getQueryArgs( url );
231
+ const filterKeys = Object.keys( args );
232
+ let maybeHasFilter = false;
233
+
234
+ for ( let i = 0; filterKeys.length > i; i++ ) {
235
+ const key = filterKeys[ i ];
236
+ if ( keyIsAFilter( key ) ) {
237
+ maybeHasFilter = true;
238
+ break;
239
+ }
240
+ }
241
+
242
+ return maybeHasFilter;
243
+ };
244
+
245
+ interface StoreAttributes {
246
+ attribute_id: string;
247
+ attribute_label: string;
248
+ attribute_name: string;
249
+ attribute_orderby: string;
250
+ attribute_public: number;
251
+ attribute_type: string;
252
+ }
253
+
254
+ export const urlContainsAttributeFilter = (
255
+ attributes: StoreAttributes[]
256
+ ): boolean => {
257
+ if ( ! window ) {
258
+ return false;
259
+ }
260
+
261
+ const storeAttributeKeys = attributes.map(
262
+ ( attr ) => `filter_${ attr.attribute_name }`
263
+ );
264
+
265
+ const url = window.location.href;
266
+ const args = getQueryArgs( url );
267
+ const urlFilterKeys = Object.keys( args );
268
+ let filterIsInUrl = false;
269
+
270
+ for ( let i = 0; urlFilterKeys.length > i; i++ ) {
271
+ const urlKey = urlFilterKeys[ i ];
272
+ if ( storeAttributeKeys.includes( urlKey ) ) {
273
+ filterIsInUrl = true;
274
+ break;
275
+ }
276
+ }
277
+
278
+ return filterIsInUrl;
279
+ };
assets/js/blocks/attribute-filter/block.json CHANGED
@@ -2,7 +2,7 @@
2
  "name": "woocommerce/attribute-filter",
3
  "version": "1.0.0",
4
  "title": "Filter by Attribute",
5
- "description": "Allow customers to filter the grid by product attribute, such as color.",
6
  "category": "woocommerce",
7
  "keywords": [ "WooCommerce" ],
8
  "supports": {
@@ -48,7 +48,7 @@
48
  },
49
  "selectType": {
50
  "type": "string",
51
- "default": "multiple"
52
  },
53
  "isPreview": {
54
  "type": "boolean",
2
  "name": "woocommerce/attribute-filter",
3
  "version": "1.0.0",
4
  "title": "Filter by Attribute",
5
+ "description": "Enable customers to filter the product grid by selecting one or more attributes, such as color.",
6
  "category": "woocommerce",
7
  "keywords": [ "WooCommerce" ],
8
  "supports": {
48
  },
49
  "selectType": {
50
  "type": "string",
51
+ "default": "multiple"
52
  },
53
  "isPreview": {
54
  "type": "boolean",
assets/js/blocks/attribute-filter/block.tsx CHANGED
@@ -14,7 +14,6 @@ import {
14
  useCollectionData,
15
  } from '@woocommerce/base-context/hooks';
16
  import { useCallback, useEffect, useState, useMemo } from '@wordpress/element';
17
- import CheckboxList from '@woocommerce/base-components/checkbox-list';
18
  import Label from '@woocommerce/base-components/filter-element-label';
19
  import FilterResetButton from '@woocommerce/base-components/filter-reset-button';
20
  import FilterSubmitButton from '@woocommerce/base-components/filter-submit-button';
@@ -38,7 +37,8 @@ import {
38
  } from '@woocommerce/utils';
39
  import { difference } from 'lodash';
40
  import FormTokenField from '@woocommerce/base-components/form-token-field';
41
- import classNames from 'classnames';
 
42
 
43
  /**
44
  * Internal dependencies
@@ -57,6 +57,7 @@ import {
57
  generateUniqueId,
58
  } from './utils';
59
  import { BlockAttributes, DisplayOption } from './types';
 
60
 
61
  /**
62
  * Formats filter values into a string for the URL parameters needed for filtering PHP templates.
@@ -237,6 +238,7 @@ const AttributeFilterBlock = ( {
237
  .filter( ( option ): option is DisplayOption => !! option );
238
 
239
  setDisplayedOptions( newOptions );
 
240
  }, [
241
  attributeObject?.taxonomy,
242
  attributeTerms,
@@ -493,39 +495,55 @@ const AttributeFilterBlock = ( {
493
  <Notice status="warning" isDismissible={ false }>
494
  <p>
495
  { __(
496
- 'The selected attribute does not have any term assigned to products.',
497
  'woo-gutenberg-products-block'
498
  ) }
499
  </p>
500
  </Notice>
501
  );
502
  }
503
- return null;
504
  }
505
 
506
  const TagName =
507
  `h${ blockAttributes.headingLevel }` as keyof JSX.IntrinsicElements;
508
- const isLoading = ! blockAttributes.isPreview && attributeTermsLoading;
509
- const isDisabled = ! blockAttributes.isPreview && filteredCountsLoading;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
510
 
511
  return (
512
  <>
513
- { ! isEditor &&
514
- blockAttributes.heading &&
515
- displayedOptions.length > 0 && (
516
- <TagName className="wc-block-attribute-filter__title">
517
- { blockAttributes.heading }
518
- </TagName>
519
- ) }
520
  <div
521
- className={ `wc-block-attribute-filter style-${ blockAttributes.displayStyle }` }
 
 
 
522
  >
523
  { blockAttributes.displayStyle === 'dropdown' ? (
524
  <>
525
  <FormTokenField
526
  key={ remountKey }
527
- className={ classNames( borderProps.className, {
528
  'single-selection': ! multiple,
 
529
  } ) }
530
  style={ {
531
  ...borderProps.style,
@@ -537,7 +555,7 @@ const AttributeFilterBlock = ( {
537
  ! checked.includes( option.value )
538
  )
539
  .map( ( option ) => option.formattedValue ) }
540
- disabled={ isDisabled }
541
  placeholder={ sprintf(
542
  /* translators: %s attribute name. */
543
  __(
@@ -625,18 +643,18 @@ const AttributeFilterBlock = ( {
625
  ) }
626
  </>
627
  ) : (
628
- <CheckboxList
629
- className={ 'wc-block-attribute-filter-list' }
630
  options={ displayedOptions }
631
  checked={ checked }
632
  onChange={ onChange }
633
  isLoading={ isLoading }
634
- isDisabled={ isDisabled }
635
  />
636
  ) }
637
  </div>
 
638
  <div className="wc-block-attribute-filter__actions">
639
- { checked.length > 0 && (
640
  <FilterResetButton
641
  onClick={ () => {
642
  setChecked( [] );
@@ -654,8 +672,11 @@ const AttributeFilterBlock = ( {
654
  { blockAttributes.showFilterButton && (
655
  <FilterSubmitButton
656
  className="wc-block-attribute-filter__button"
 
657
  disabled={
658
- isLoading || isDisabled || checked.length === 0
 
 
659
  }
660
  onClick={ () => onSubmit( checked ) }
661
  />
14
  useCollectionData,
15
  } from '@woocommerce/base-context/hooks';
16
  import { useCallback, useEffect, useState, useMemo } from '@wordpress/element';
 
17
  import Label from '@woocommerce/base-components/filter-element-label';
18
  import FilterResetButton from '@woocommerce/base-components/filter-reset-button';
19
  import FilterSubmitButton from '@woocommerce/base-components/filter-submit-button';
37
  } from '@woocommerce/utils';
38
  import { difference } from 'lodash';
39
  import FormTokenField from '@woocommerce/base-components/form-token-field';
40
+ import FilterTitlePlaceholder from '@woocommerce/base-components/filter-placeholder';
41
+ import classnames from 'classnames';
42
 
43
  /**
44
  * Internal dependencies
57
  generateUniqueId,
58
  } from './utils';
59
  import { BlockAttributes, DisplayOption } from './types';
60
+ import CheckboxFilter from './checkbox-filter';
61
 
62
  /**
63
  * Formats filter values into a string for the URL parameters needed for filtering PHP templates.
238
  .filter( ( option ): option is DisplayOption => !! option );
239
 
240
  setDisplayedOptions( newOptions );
241
+ setRemountKey( generateUniqueId() );
242
  }, [
243
  attributeObject?.taxonomy,
244
  attributeTerms,
495
  <Notice status="warning" isDismissible={ false }>
496
  <p>
497
  { __(
498
+ 'There are no products with the selected attributes.',
499
  'woo-gutenberg-products-block'
500
  ) }
501
  </p>
502
  </Notice>
503
  );
504
  }
 
505
  }
506
 
507
  const TagName =
508
  `h${ blockAttributes.headingLevel }` as keyof JSX.IntrinsicElements;
509
+ const termsLoading = ! blockAttributes.isPreview && attributeTermsLoading;
510
+ const countsLoading = ! blockAttributes.isPreview && filteredCountsLoading;
511
+
512
+ const isLoading =
513
+ ( termsLoading || countsLoading ) && displayedOptions.length === 0;
514
+
515
+ if ( ! isLoading && displayedOptions.length === 0 ) {
516
+ return null;
517
+ }
518
+
519
+ const heading = (
520
+ <TagName className="wc-block-attribute-filter__title">
521
+ { blockAttributes.heading }
522
+ </TagName>
523
+ );
524
+
525
+ const filterHeading = isLoading ? (
526
+ <FilterTitlePlaceholder>{ heading }</FilterTitlePlaceholder>
527
+ ) : (
528
+ heading
529
+ );
530
 
531
  return (
532
  <>
533
+ { ! isEditor && blockAttributes.heading && filterHeading }
 
 
 
 
 
 
534
  <div
535
+ className={ classnames(
536
+ 'wc-block-attribute-filter',
537
+ `style-${ blockAttributes.displayStyle }`
538
+ ) }
539
  >
540
  { blockAttributes.displayStyle === 'dropdown' ? (
541
  <>
542
  <FormTokenField
543
  key={ remountKey }
544
+ className={ classnames( borderProps.className, {
545
  'single-selection': ! multiple,
546
+ 'is-loading': isLoading,
547
  } ) }
548
  style={ {
549
  ...borderProps.style,
555
  ! checked.includes( option.value )
556
  )
557
  .map( ( option ) => option.formattedValue ) }
558
+ disabled={ isLoading }
559
  placeholder={ sprintf(
560
  /* translators: %s attribute name. */
561
  __(
643
  ) }
644
  </>
645
  ) : (
646
+ <CheckboxFilter
 
647
  options={ displayedOptions }
648
  checked={ checked }
649
  onChange={ onChange }
650
  isLoading={ isLoading }
651
+ isDisabled={ isLoading }
652
  />
653
  ) }
654
  </div>
655
+
656
  <div className="wc-block-attribute-filter__actions">
657
+ { checked.length > 0 && ! isLoading && (
658
  <FilterResetButton
659
  onClick={ () => {
660
  setChecked( [] );
672
  { blockAttributes.showFilterButton && (
673
  <FilterSubmitButton
674
  className="wc-block-attribute-filter__button"
675
+ isLoading={ isLoading }
676
  disabled={
677
+ termsLoading ||
678
+ countsLoading ||
679
+ checked.length === 0
680
  }
681
  onClick={ () => onSubmit( checked ) }
682
  />
assets/js/blocks/attribute-filter/checkbox-filter.tsx ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import CheckboxList from '@woocommerce/base-components/checkbox-list';
5
+ /**
6
+ * Internal dependencies
7
+ */
8
+ import { DisplayOption } from './types';
9
+
10
+ interface CheckboxFilterProps {
11
+ className?: string;
12
+ isLoading?: boolean;
13
+ isDisabled?: boolean;
14
+ limit?: number;
15
+ checked?: string[];
16
+ onChange: ( value: string ) => void;
17
+ options?: DisplayOption[];
18
+ }
19
+
20
+ const CheckboxFilter = ( {
21
+ isLoading = false,
22
+ options,
23
+ checked,
24
+ onChange,
25
+ }: CheckboxFilterProps ) => {
26
+ if ( isLoading ) {
27
+ return (
28
+ <>
29
+ <span className="is-loading"></span>
30
+ <span className="is-loading"></span>
31
+ </>
32
+ );
33
+ }
34
+
35
+ return (
36
+ <CheckboxList
37
+ className="wc-block-attribute-filter-list"
38
+ options={ options }
39
+ checked={ checked }
40
+ onChange={ onChange }
41
+ isLoading={ isLoading }
42
+ isDisabled={ isLoading }
43
+ />
44
+ );
45
+ };
46
+
47
+ export default CheckboxFilter;
assets/js/blocks/attribute-filter/edit.tsx CHANGED
@@ -176,17 +176,6 @@ const Edit = ( { attributes, setAttributes, debouncedSpeak }: EditProps ) => {
176
  'Include product count',
177
  'woo-gutenberg-products-block'
178
  ) }
179
- help={
180
- showCounts
181
- ? __(
182
- 'Show the product count with results.',
183
- 'woo-gutenberg-products-block'
184
- )
185
- : __(
186
- 'Product count is hidden.',
187
- 'woo-gutenberg-products-block'
188
- )
189
- }
190
  checked={ showCounts }
191
  onChange={ () =>
192
  setAttributes( {
@@ -314,11 +303,11 @@ const Edit = ( { attributes, setAttributes, debouncedSpeak }: EditProps ) => {
314
  help={
315
  showFilterButton
316
  ? __(
317
- 'Products will only update when the button is pressed.',
318
  'woo-gutenberg-products-block'
319
  )
320
  : __(
321
- 'Products will update as options are selected.',
322
  'woo-gutenberg-products-block'
323
  )
324
  }
@@ -352,7 +341,7 @@ const Edit = ( { attributes, setAttributes, debouncedSpeak }: EditProps ) => {
352
  'woo-gutenberg-products-block'
353
  ) }
354
  instructions={ __(
355
- 'Display a list of filters based on a chosen attribute.',
356
  'woo-gutenberg-products-block'
357
  ) }
358
  >
@@ -387,7 +376,7 @@ const Edit = ( { attributes, setAttributes, debouncedSpeak }: EditProps ) => {
387
  setIsEditing( false );
388
  debouncedSpeak(
389
  __(
390
- 'Showing Filter by Attribute block preview.',
391
  'woo-gutenberg-products-block'
392
  )
393
  );
@@ -403,7 +392,7 @@ const Edit = ( { attributes, setAttributes, debouncedSpeak }: EditProps ) => {
403
  'woo-gutenberg-products-block'
404
  ) }
405
  instructions={ __(
406
- 'Display a list of filters based on a chosen attribute.',
407
  'woo-gutenberg-products-block'
408
  ) }
409
  >
176
  'Include product count',
177
  'woo-gutenberg-products-block'
178
  ) }
 
 
 
 
 
 
 
 
 
 
 
179
  checked={ showCounts }
180
  onChange={ () =>
181
  setAttributes( {
303
  help={
304
  showFilterButton
305
  ? __(
306
+ 'Products will only update when the button is clicked.',
307
  'woo-gutenberg-products-block'
308
  )
309
  : __(
310
+ 'Products will update as soon as attributes are selected.',
311
  'woo-gutenberg-products-block'
312
  )
313
  }
341
  'woo-gutenberg-products-block'
342
  ) }
343
  instructions={ __(
344
+ 'Display a list of filters based on the selected attributes.',
345
  'woo-gutenberg-products-block'
346
  ) }
347
  >
376
  setIsEditing( false );
377
  debouncedSpeak(
378
  __(
379
+ 'Now displaying a preview of the Filter Products by Attribute block.',
380
  'woo-gutenberg-products-block'
381
  )
382
  );
392
  'woo-gutenberg-products-block'
393
  ) }
394
  instructions={ __(
395
+ 'Display a list of filters based on the selected attributes.',
396
  'woo-gutenberg-products-block'
397
  ) }
398
  >
assets/js/blocks/attribute-filter/index.tsx CHANGED
@@ -19,7 +19,7 @@ import metadata from './block.json';
19
  registerBlockType( metadata, {
20
  title: __( 'Filter by Attribute', 'woo-gutenberg-products-block' ),
21
  description: __(
22
- 'Allow customers to filter the grid by product attribute, such as color.',
23
  'woo-gutenberg-products-block'
24
  ),
25
  icon: {
19
  registerBlockType( metadata, {
20
  title: __( 'Filter by Attribute', 'woo-gutenberg-products-block' ),
21
  description: __(
22
+ 'Enable customers to filter the product grid by selecting one or more attributes, such as color.',
23
  'woo-gutenberg-products-block'
24
  ),
25
  icon: {
assets/js/blocks/attribute-filter/style.scss CHANGED
@@ -11,6 +11,11 @@
11
  h6 {
12
  text-transform: inherit;
13
  }
 
 
 
 
 
14
  }
15
 
16
  .wc-block-attribute-filter {
@@ -18,12 +23,18 @@
18
  border-radius: inherit;
19
  border-color: inherit;
20
 
 
 
 
 
 
 
 
 
21
  &.style-dropdown {
22
  position: relative;
23
  display: flex;
24
  gap: $gap;
25
- border-radius: inherit;
26
- border-color: inherit;
27
  align-items: flex-start;
28
 
29
  .wc-block-components-filter-submit-button {
@@ -59,6 +70,16 @@
59
  flex-grow: 1;
60
  max-width: unset;
61
  width: 0;
 
 
 
 
 
 
 
 
 
 
62
  }
63
 
64
  .is-single .wc-block-attribute-filter-list-count,
@@ -67,8 +88,7 @@
67
  }
68
 
69
  .wc-blocks-components-form-token-field-wrapper .components-form-token-field__input-container {
70
- border: 1px solid $gray-700;
71
- border-radius: 4px;
72
  padding: $gap-smaller;
73
 
74
  .components-form-token-field__input::placeholder {
@@ -90,6 +110,13 @@
90
  }
91
  }
92
  }
 
 
 
 
 
 
 
93
  }
94
 
95
  .wc-block-attribute-filter__multiple-toggle,
@@ -142,8 +169,7 @@
142
  border: 1px solid;
143
  border-right: 0;
144
  border-radius: 25px 0 0 25px;
145
- padding: em($gap-smallest);
146
- padding-left: em($gap-small);
147
  }
148
 
149
  .components-button.components-form-token-field__remove-token {
@@ -151,7 +177,7 @@
151
  border: 1px solid;
152
  border-left: 0;
153
  border-radius: 0 25px 25px 0;
154
- padding: 0 em($gap-smaller) 0 0;
155
 
156
  &.has-icon svg {
157
  background-color: $gray-200;
@@ -164,4 +190,7 @@
164
  .wc-block-attribute-filter__button.wc-block-attribute-filter__button {
165
  padding: em($gap-smaller) em($gap);
166
  @include font-size(small);
 
 
 
167
  }
11
  h6 {
12
  text-transform: inherit;
13
  }
14
+
15
+ > .wc-block-attribute-filter__title {
16
+ margin-top: $gap-small;
17
+ margin-bottom: $gap-small;
18
+ }
19
  }
20
 
21
  .wc-block-attribute-filter {
23
  border-radius: inherit;
24
  border-color: inherit;
25
 
26
+ .is-loading {
27
+ @include placeholder();
28
+ box-shadow: none;
29
+ border-radius: 0;
30
+ height: 1em;
31
+ margin-top: $gap;
32
+ }
33
+
34
  &.style-dropdown {
35
  position: relative;
36
  display: flex;
37
  gap: $gap;
 
 
38
  align-items: flex-start;
39
 
40
  .wc-block-components-filter-submit-button {
70
  flex-grow: 1;
71
  max-width: unset;
72
  width: 0;
73
+ height: max-content;
74
+
75
+ &:not(.is-loading) {
76
+ border: 1px solid $gray-700 !important;
77
+ border-radius: 4px;
78
+ }
79
+
80
+ &.is-loading {
81
+ border-radius: em(4px);
82
+ }
83
  }
84
 
85
  .is-single .wc-block-attribute-filter-list-count,
88
  }
89
 
90
  .wc-blocks-components-form-token-field-wrapper .components-form-token-field__input-container {
91
+ border: 0;
 
92
  padding: $gap-smaller;
93
 
94
  .components-form-token-field__input::placeholder {
110
  }
111
  }
112
  }
113
+ .wc-blocks-components-form-token-field-wrapper:not(.single-selection) .components-form-token-field__input-container {
114
+ width: calc(100% - 50px);
115
+
116
+ .components-form-token-field__suggestions-list {
117
+ width: calc(100% + 50px);
118
+ }
119
+ }
120
  }
121
 
122
  .wc-block-attribute-filter__multiple-toggle,
169
  border: 1px solid;
170
  border-right: 0;
171
  border-radius: 25px 0 0 25px;
172
+ padding: em($gap-smallest) em($gap-smaller) em($gap-smallest) em($gap-small);
 
173
  }
174
 
175
  .components-button.components-form-token-field__remove-token {
177
  border: 1px solid;
178
  border-left: 0;
179
  border-radius: 0 25px 25px 0;
180
+ padding: 1px em($gap-smallest) 0 0;
181
 
182
  &.has-icon svg {
183
  background-color: $gray-200;
190
  .wc-block-attribute-filter__button.wc-block-attribute-filter__button {
191
  padding: em($gap-smaller) em($gap);
192
  @include font-size(small);
193
+ height: max-content;
194
+ line-height: normal;
195
+ width: max-content;
196
  }
assets/js/blocks/cart-checkout-shared/payment-methods/express-payment/cart-express-payment.js CHANGED
@@ -66,7 +66,7 @@ const CartExpressPayment = () => {
66
  </LoadingMask>
67
  <div className="wc-block-components-express-payment-continue-rule wc-block-components-express-payment-continue-rule--cart">
68
  { /* translators: Shown in the Cart block between the express payment methods and the Proceed to Checkout button */ }
69
- { __( 'Or', 'woo-gutenberg-products-block' ) }
70
  </div>
71
  </>
72
  );
66
  </LoadingMask>
67
  <div className="wc-block-components-express-payment-continue-rule wc-block-components-express-payment-continue-rule--cart">
68
  { /* translators: Shown in the Cart block between the express payment methods and the Proceed to Checkout button */ }
69
+ { __( 'Any', 'woo-gutenberg-products-block' ) }
70
  </div>
71
  </>
72
  );
assets/js/blocks/cart-checkout-shared/payment-methods/no-payment-methods/index.js CHANGED
@@ -38,7 +38,7 @@ const NoPaymentMethodsPlaceholder = () => {
38
  >
39
  <span className="wc-block-checkout__no-payment-methods-placeholder-description">
40
  { __(
41
- 'Your store does not have any payment methods configured that support the checkout block. Once you have configured a compatible payment method it will be shown here.',
42
  'woo-gutenberg-products-block'
43
  ) }
44
  </span>
38
  >
39
  <span className="wc-block-checkout__no-payment-methods-placeholder-description">
40
  { __(
41
+ 'Your store does not have any payment methods that support the Checkout block. Once you have configured a compatible payment method it will be displayed here.',
42
  'woo-gutenberg-products-block'
43
  ) }
44
  </span>
assets/js/blocks/cart-checkout-shared/payment-methods/payment-method-error-boundary.js CHANGED
@@ -24,7 +24,7 @@ class PaymentMethodErrorBoundary extends Component {
24
 
25
  if ( hasError ) {
26
  let errorText = __(
27
- 'This site is experiencing difficulties with this payment method. Please contact the owner of the site for assistance.',
28
  'woo-gutenberg-products-block'
29
  );
30
  if ( isEditor || CURRENT_USER_IS_ADMIN ) {
24
 
25
  if ( hasError ) {
26
  let errorText = __(
27
+ 'We are experiencing difficulties with this payment method. Please contact us for assistance.',
28
  'woo-gutenberg-products-block'
29
  );
30
  if ( isEditor || CURRENT_USER_IS_ADMIN ) {
assets/js/blocks/cart/block.js CHANGED
@@ -74,7 +74,10 @@ const ScrollOnError = ( { scrollToTop } ) => {
74
  };
75
  const Block = ( { attributes, children, scrollToTop } ) => (
76
  <BlockErrorBoundary
77
- header={ __( 'Something went wrong…', 'woo-gutenberg-products-block' ) }
 
 
 
78
  text={ __(
79
  'The cart has encountered an unexpected error. If the error persists, please get in touch with us for help.',
80
  'woo-gutenberg-products-block'
74
  };
75
  const Block = ( { attributes, children, scrollToTop } ) => (
76
  <BlockErrorBoundary
77
+ header={ __(
78
+ 'Something went wrong. Please contact us for assistance.',
79
+ 'woo-gutenberg-products-block'
80
+ ) }
81
  text={ __(
82
  'The cart has encountered an unexpected error. If the error persists, please get in touch with us for help.',
83
  'woo-gutenberg-products-block'
assets/js/blocks/cart/inner-blocks/cart-express-payment-block/edit.tsx CHANGED
@@ -27,7 +27,7 @@ const NoExpressPaymentMethodsPlaceholder = () => {
27
  >
28
  <span className="wp-block-woocommerce-checkout-express-payment-block-placeholder__description">
29
  { __(
30
- "Your store doesn't have any Payment Methods that support the Express Checkout Block. If they are added, they will be shown here.",
31
  'woo-gutenberg-products-block'
32
  ) }
33
  </span>
27
  >
28
  <span className="wp-block-woocommerce-checkout-express-payment-block-placeholder__description">
29
  { __(
30
+ 'Your store does not have any payment methods that support the Express Checkout block. Once you have configured a compatible payment method, it will be displayed here.',
31
  'woo-gutenberg-products-block'
32
  ) }
33
  </span>
assets/js/blocks/checkout/block.tsx CHANGED
@@ -145,7 +145,7 @@ const Block = ( {
145
  return (
146
  <BlockErrorBoundary
147
  header={ __(
148
- 'Something went wrong',
149
  'woo-gutenberg-products-block'
150
  ) }
151
  text={ createInterpolateElement(
145
  return (
146
  <BlockErrorBoundary
147
  header={ __(
148
+ 'Something went wrong. Please contact us for assistance.',
149
  'woo-gutenberg-products-block'
150
  ) }
151
  text={ createInterpolateElement(
assets/js/blocks/checkout/inner-blocks/checkout-billing-address-block/attributes.tsx CHANGED
@@ -12,7 +12,7 @@ export default {
12
  ...formStepAttributes( {
13
  defaultTitle: __( 'Billing address', 'woo-gutenberg-products-block' ),
14
  defaultDescription: __(
15
- 'Enter the address that matches your card or payment method.',
16
  'woo-gutenberg-products-block'
17
  ),
18
  } ),
12
  ...formStepAttributes( {
13
  defaultTitle: __( 'Billing address', 'woo-gutenberg-products-block' ),
14
  defaultDescription: __(
15
+ 'Enter the billing address that matches your payment method.',
16
  'woo-gutenberg-products-block'
17
  ),
18
  } ),
assets/js/blocks/checkout/inner-blocks/checkout-express-payment-block/edit.tsx CHANGED
@@ -27,7 +27,7 @@ const NoExpressPaymentMethodsPlaceholder = () => {
27
  >
28
  <span className="wp-block-woocommerce-checkout-express-payment-block-placeholder__description">
29
  { __(
30
- "Your store doesn't have any Payment Methods that support the Express Checkout Block. If they are added, they will be shown here.",
31
  'woo-gutenberg-products-block'
32
  ) }
33
  </span>
27
  >
28
  <span className="wp-block-woocommerce-checkout-express-payment-block-placeholder__description">
29
  { __(
30
+ 'Your store does not have any payment methods that support the Express Checkout block. Once you have configured a compatible payment method, it will be displayed here.',
31
  'woo-gutenberg-products-block'
32
  ) }
33
  </span>
assets/js/blocks/checkout/inner-blocks/checkout-shipping-methods-block/edit.tsx CHANGED
@@ -65,7 +65,7 @@ export const Edit = ( {
65
  >
66
  <p className="wc-block-checkout__controls-text">
67
  { __(
68
- 'You currently have the following shipping integrations active.',
69
  'woo-gutenberg-products-block'
70
  ) }
71
  </p>
65
  >
66
  <p className="wc-block-checkout__controls-text">
67
  { __(
68
+ 'The following shipping integrations are active on your store.',
69
  'woo-gutenberg-products-block'
70
  ) }
71
  </p>
assets/js/blocks/checkout/inner-blocks/checkout-terms-block/block.json CHANGED
@@ -2,7 +2,7 @@
2
  "name": "woocommerce/checkout-terms-block",
3
  "version": "1.0.0",
4
  "title": "Terms and Conditions",
5
- "description": "Ensure customers agree to your terms and conditions and privacy policy.",
6
  "category": "woocommerce",
7
  "supports": {
8
  "align": false,
2
  "name": "woocommerce/checkout-terms-block",
3
  "version": "1.0.0",
4
  "title": "Terms and Conditions",
5
+ "description": "Ensure that customers agree to your Terms & Conditions and Privacy Policy.",
6
  "category": "woocommerce",
7
  "supports": {
8
  "align": false,
assets/js/blocks/checkout/inner-blocks/checkout-terms-block/edit.tsx CHANGED
@@ -134,7 +134,7 @@ export const Edit = ( {
134
  >
135
  <p>
136
  { __(
137
- "You don't seem to have a Terms and Conditions and/or a Privacy Policy pages setup.",
138
  'woo-gutenberg-products-block'
139
  ) }
140
  </p>
134
  >
135
  <p>
136
  { __(
137
+ "You don't have any Terms and Conditions and/or Privacy Policy pages set up.",
138
  'woo-gutenberg-products-block'
139
  ) }
140
  </p>
assets/js/blocks/checkout/inner-blocks/checkout-terms-block/test/edit.js CHANGED
@@ -59,7 +59,7 @@ describe( 'Edit', () => {
59
  expect(
60
  queryByText(
61
  container,
62
- "You don't seem to have a Terms and Conditions and/or a Privacy Policy pages setup."
63
  )
64
  ).toBeInTheDocument();
65
  } );
59
  expect(
60
  queryByText(
61
  container,
62
+ "You don't have any Terms and Conditions and/or Privacy Policy pages set up."
63
  )
64
  ).toBeInTheDocument();
65
  } );
assets/js/blocks/classic-template/constants.ts CHANGED
@@ -2,10 +2,14 @@
2
  * External dependencies
3
  */
4
  import { __ } from '@wordpress/i18n';
5
-
6
  export const BLOCK_SLUG = 'woocommerce/legacy-template';
7
 
8
- export const TEMPLATES: Record< string, Record< string, string > > = {
 
 
 
 
 
9
  'single-product': {
10
  title: __(
11
  'WooCommerce Single Product Block',
2
  * External dependencies
3
  */
4
  import { __ } from '@wordpress/i18n';
 
5
  export const BLOCK_SLUG = 'woocommerce/legacy-template';
6
 
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { TemplateDetails } from './types';
11
+
12
+ export const TEMPLATES: TemplateDetails = {
13
  'single-product': {
14
  title: __(
15
  'WooCommerce Single Product Block',
assets/js/blocks/classic-template/index.tsx CHANGED
@@ -2,7 +2,6 @@
2
  * External dependencies
3
  */
4
  import {
5
- Block,
6
  BlockEditProps,
7
  createBlock,
8
  getBlockType,
@@ -26,6 +25,11 @@ import { useEffect } from '@wordpress/element';
26
  import './editor.scss';
27
  import './style.scss';
28
  import { BLOCK_SLUG, TEMPLATES } from './constants';
 
 
 
 
 
29
 
30
  type Attributes = {
31
  template: string;
@@ -40,10 +44,12 @@ const Edit = ( {
40
  const { replaceBlock } = useDispatch( 'core/block-editor' );
41
 
42
  const blockProps = useBlockProps();
43
- const templateTitle =
44
- TEMPLATES[ attributes.template ]?.title ?? attributes.template;
45
- const templatePlaceholder =
46
- TEMPLATES[ attributes.template ]?.placeholder ?? 'fallback';
 
 
47
 
48
  useEffect(
49
  () =>
@@ -65,12 +71,12 @@ const Edit = ( {
65
  <p className="wp-block-woocommerce-classic-template__placeholder-warning">
66
  <strong>
67
  { __(
68
- 'Attention: Do not remove this block!',
69
  'woo-gutenberg-products-block'
70
  ) }
71
  </strong>{ ' ' }
72
  { __(
73
- 'Removal will cause unintended effects on your store.',
74
  'woo-gutenberg-products-block'
75
  ) }
76
  </p>
@@ -78,7 +84,7 @@ const Edit = ( {
78
  { sprintf(
79
  /* translators: %s is the template title */
80
  __(
81
- 'This is an editor placeholder for the %s. On your store this will be replaced by the template and display with your product image(s), title, price, etc. You can move this placeholder around and add further blocks around it to extend the template.',
82
  'woo-gutenberg-products-block'
83
  ),
84
  templateTitle
@@ -118,8 +124,6 @@ const Edit = ( {
118
  );
119
  };
120
 
121
- const templates = Object.keys( TEMPLATES );
122
-
123
  const registerClassicTemplateBlock = ( {
124
  template,
125
  inserter,
@@ -136,12 +140,13 @@ const registerClassicTemplateBlock = ( {
136
  * See https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/5861 for more context
137
  */
138
  registerBlockType( BLOCK_SLUG, {
139
- title: template
140
- ? TEMPLATES[ template ].title
141
- : __(
142
- 'WooCommerce Classic Template',
143
- 'woo-gutenberg-products-block'
144
- ),
 
145
  icon: (
146
  <Icon
147
  icon={ box }
@@ -202,15 +207,6 @@ const registerClassicTemplateBlock = ( {
202
  } );
203
  };
204
 
205
- const isClassicTemplateBlockRegisteredWithAnotherTitle = (
206
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
207
- block: Block< any > | undefined,
208
- parsedTemplate: string
209
- ) => block?.title !== TEMPLATES[ parsedTemplate ].title;
210
-
211
- const hasTemplateSupportForClassicTemplateBlock = ( parsedTemplate: string ) =>
212
- templates.includes( parsedTemplate );
213
-
214
  // @todo Refactor when there will be possible to show a block according on a template/post with a Gutenberg API. https://github.com/WordPress/gutenberg/pull/41718
215
 
216
  let currentTemplateId: string | undefined;
@@ -235,7 +231,10 @@ if ( isExperimentalBuild() ) {
235
 
236
  if (
237
  block !== undefined &&
238
- ( ! hasTemplateSupportForClassicTemplateBlock( parsedTemplate ) ||
 
 
 
239
  isClassicTemplateBlockRegisteredWithAnotherTitle(
240
  block,
241
  parsedTemplate
@@ -248,7 +247,10 @@ if ( isExperimentalBuild() ) {
248
 
249
  if (
250
  block === undefined &&
251
- hasTemplateSupportForClassicTemplateBlock( parsedTemplate )
 
 
 
252
  ) {
253
  registerClassicTemplateBlock( {
254
  template: parsedTemplate,
2
  * External dependencies
3
  */
4
  import {
 
5
  BlockEditProps,
6
  createBlock,
7
  getBlockType,
25
  import './editor.scss';
26
  import './style.scss';
27
  import { BLOCK_SLUG, TEMPLATES } from './constants';
28
+ import {
29
+ isClassicTemplateBlockRegisteredWithAnotherTitle,
30
+ hasTemplateSupportForClassicTemplateBlock,
31
+ getTemplateDetailsBySlug,
32
+ } from './utils';
33
 
34
  type Attributes = {
35
  template: string;
44
  const { replaceBlock } = useDispatch( 'core/block-editor' );
45
 
46
  const blockProps = useBlockProps();
47
+ const templateDetails = getTemplateDetailsBySlug(
48
+ attributes.template,
49
+ TEMPLATES
50
+ );
51
+ const templateTitle = templateDetails?.title ?? attributes.template;
52
+ const templatePlaceholder = templateDetails?.placeholder ?? 'fallback';
53
 
54
  useEffect(
55
  () =>
71
  <p className="wp-block-woocommerce-classic-template__placeholder-warning">
72
  <strong>
73
  { __(
74
+ 'Do not remove this block!',
75
  'woo-gutenberg-products-block'
76
  ) }
77
  </strong>{ ' ' }
78
  { __(
79
+ 'Removing this will cause unintended effects on your store.',
80
  'woo-gutenberg-products-block'
81
  ) }
82
  </p>
84
  { sprintf(
85
  /* translators: %s is the template title */
86
  __(
87
+ 'This is a placeholder for the %s. In your store it will display the actual product image, title, price, etc. You can move this placeholder around and add more blocks around it to customize the template.',
88
  'woo-gutenberg-products-block'
89
  ),
90
  templateTitle
124
  );
125
  };
126
 
 
 
127
  const registerClassicTemplateBlock = ( {
128
  template,
129
  inserter,
140
  * See https://github.com/woocommerce/woocommerce-gutenberg-products-block/issues/5861 for more context
141
  */
142
  registerBlockType( BLOCK_SLUG, {
143
+ title:
144
+ template && TEMPLATES[ template ]
145
+ ? TEMPLATES[ template ].title
146
+ : __(
147
+ 'WooCommerce Classic Template',
148
+ 'woo-gutenberg-products-block'
149
+ ),
150
  icon: (
151
  <Icon
152
  icon={ box }
207
  } );
208
  };
209
 
 
 
 
 
 
 
 
 
 
210
  // @todo Refactor when there will be possible to show a block according on a template/post with a Gutenberg API. https://github.com/WordPress/gutenberg/pull/41718
211
 
212
  let currentTemplateId: string | undefined;
231
 
232
  if (
233
  block !== undefined &&
234
+ ( ! hasTemplateSupportForClassicTemplateBlock(
235
+ parsedTemplate,
236
+ TEMPLATES
237
+ ) ||
238
  isClassicTemplateBlockRegisteredWithAnotherTitle(
239
  block,
240
  parsedTemplate
247
 
248
  if (
249
  block === undefined &&
250
+ hasTemplateSupportForClassicTemplateBlock(
251
+ parsedTemplate,
252
+ TEMPLATES
253
+ )
254
  ) {
255
  registerClassicTemplateBlock( {
256
  template: parsedTemplate,
assets/js/blocks/classic-template/test/utils.ts ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { getTemplateDetailsBySlug } from '../utils';
5
+
6
+ const TEMPLATES = {
7
+ 'single-product': {
8
+ title: 'Single Product Title',
9
+ placeholder: 'Single Product Placeholder',
10
+ },
11
+ 'archive-product': {
12
+ title: 'Product Archive Title',
13
+ placeholder: 'Product Archive Placeholder',
14
+ },
15
+ 'archive-product': {
16
+ title: 'Product Archive Title',
17
+ placeholder: 'Product Archive Placeholder',
18
+ },
19
+ 'taxonomy-product_cat': {
20
+ title: 'Product Taxonomy Title',
21
+ placeholder: 'Product Taxonomy Placeholder',
22
+ },
23
+ };
24
+
25
+ describe( 'getTemplateDetailsBySlug', function () {
26
+ it( 'should return single-product object when given an exact match', () => {
27
+ expect(
28
+ getTemplateDetailsBySlug( 'single-product', TEMPLATES )
29
+ ).toBeTruthy();
30
+ expect(
31
+ getTemplateDetailsBySlug( 'single-product', TEMPLATES )
32
+ ).toStrictEqual( TEMPLATES[ 'single-product' ] );
33
+ } );
34
+
35
+ it( 'should return single-product object when given a partial match', () => {
36
+ expect(
37
+ getTemplateDetailsBySlug( 'single-product-hoodie', TEMPLATES )
38
+ ).toBeTruthy();
39
+ expect(
40
+ getTemplateDetailsBySlug( 'single-product-hoodie', TEMPLATES )
41
+ ).toStrictEqual( TEMPLATES[ 'single-product' ] );
42
+ } );
43
+
44
+ it( 'should return null object when given an incorrect match', () => {
45
+ expect( getTemplateDetailsBySlug( 'void', TEMPLATES ) ).toBeNull();
46
+ } );
47
+ } );
assets/js/blocks/classic-template/types.ts ADDED
@@ -0,0 +1 @@
 
1
+ export type TemplateDetails = Record< string, Record< string, string > >;
assets/js/blocks/classic-template/utils.ts ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { Block } from '@wordpress/blocks';
5
+
6
+ /**
7
+ * Internal dependencies
8
+ */
9
+ import { TEMPLATES } from './constants';
10
+ import { TemplateDetails } from './types';
11
+
12
+ // Finds the most appropriate template details object for specific template keys such as single-product-hoodie.
13
+ export function getTemplateDetailsBySlug(
14
+ parsedTemplate: string,
15
+ templates: TemplateDetails
16
+ ) {
17
+ const templateKeys = Object.keys( templates );
18
+ let templateDetails = null;
19
+
20
+ for ( let i = 0; templateKeys.length > i; i++ ) {
21
+ const keyToMatch = parsedTemplate.substr( 0, templateKeys[ i ].length );
22
+ const maybeTemplate = templates[ keyToMatch ];
23
+ if ( maybeTemplate ) {
24
+ templateDetails = maybeTemplate;
25
+ break;
26
+ }
27
+ }
28
+
29
+ return templateDetails;
30
+ }
31
+
32
+ export function isClassicTemplateBlockRegisteredWithAnotherTitle(
33
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
+ block: Block< any > | undefined,
35
+ parsedTemplate: string
36
+ ) {
37
+ const templateDetails = getTemplateDetailsBySlug(
38
+ parsedTemplate,
39
+ TEMPLATES
40
+ );
41
+ return block?.title !== templateDetails?.title;
42
+ }
43
+
44
+ export function hasTemplateSupportForClassicTemplateBlock(
45
+ parsedTemplate: string,
46
+ templates: TemplateDetails
47
+ ): boolean {
48
+ return getTemplateDetailsBySlug( parsedTemplate, templates ) ? true : false;
49
+ }
assets/js/blocks/featured-items/featured-category/block.json CHANGED
@@ -3,15 +3,19 @@
3
  "version": "1.0.0",
4
  "title": "Featured Category",
5
  "category": "woocommerce",
6
- "keywords": [ "WooCommerce" ],
 
 
7
  "description": "Visually highlight a product category and encourage prompt action.",
8
  "supports": {
9
- "align": [ "wide", "full" ],
 
 
 
10
  "html": false,
11
  "color": {
12
  "background": true,
13
- "text": true,
14
- "__experimentalDuotone": ".wc-block-featured-category__background-image"
15
  },
16
  "spacing": {
17
  "padding": true,
@@ -95,16 +99,9 @@
95
  "showDesc": {
96
  "type": "boolean",
97
  "default": true
98
- },
99
- "style": {
100
- "type": "object",
101
- "default": {
102
- "color": {
103
- "text": "#ffffff"
104
- }
105
- }
106
  }
107
  },
108
  "textdomain": "woo-gutenberg-products-block",
109
- "apiVersion": 2
 
110
  }
3
  "version": "1.0.0",
4
  "title": "Featured Category",
5
  "category": "woocommerce",
6
+ "keywords": [
7
+ "WooCommerce"
8
+ ],
9
  "description": "Visually highlight a product category and encourage prompt action.",
10
  "supports": {
11
+ "align": [
12
+ "wide",
13
+ "full"
14
+ ],
15
  "html": false,
16
  "color": {
17
  "background": true,
18
+ "text": true
 
19
  },
20
  "spacing": {
21
  "padding": true,
99
  "showDesc": {
100
  "type": "boolean",
101
  "default": true
 
 
 
 
 
 
 
 
102
  }
103
  },
104
  "textdomain": "woo-gutenberg-products-block",
105
+ "apiVersion": 2,
106
+ "$schema": "https://schemas.wp.org/trunk/block.json"
107
  }
assets/js/blocks/featured-items/featured-product/block.json CHANGED
@@ -2,7 +2,7 @@
2
  "name": "woocommerce/featured-product",
3
  "version": "1.0.0",
4
  "title": "Featured Product",
5
- "description": "Visually highlight a product or variation and encourage prompt action.",
6
  "category": "woocommerce",
7
  "keywords": [ "WooCommerce" ],
8
  "supports": {
@@ -10,8 +10,7 @@
10
  "html": false,
11
  "color": {
12
  "background": true,
13
- "text": true,
14
- "__experimentalDuotone": ".wc-block-featured-product__background-image"
15
  },
16
  "spacing": {
17
  "padding": true,
@@ -101,16 +100,9 @@
101
  "showPrice": {
102
  "type": "boolean",
103
  "default": true
104
- },
105
- "style": {
106
- "type": "object",
107
- "default": {
108
- "color": {
109
- "text": "#ffffff"
110
- }
111
- }
112
  }
113
  },
114
  "textdomain": "woo-gutenberg-products-block",
115
- "apiVersion": 2
 
116
  }
2
  "name": "woocommerce/featured-product",
3
  "version": "1.0.0",
4
  "title": "Featured Product",
5
+ "description": "Highlight a product or variation.",
6
  "category": "woocommerce",
7
  "keywords": [ "WooCommerce" ],
8
  "supports": {
10
  "html": false,
11
  "color": {
12
  "background": true,
13
+ "text": true
 
14
  },
15
  "spacing": {
16
  "padding": true,
100
  "showPrice": {
101
  "type": "boolean",
102
  "default": true
 
 
 
 
 
 
 
 
103
  }
104
  },
105
  "textdomain": "woo-gutenberg-products-block",
106
+ "apiVersion": 2,
107
+ "$schema": "https://schemas.wp.org/trunk/block.json"
108
  }
assets/js/blocks/featured-items/featured-product/block.tsx CHANGED
@@ -41,7 +41,7 @@ const CONTENT_CONFIG = {
41
  const EDIT_MODE_CONFIG = {
42
  ...GENERIC_CONFIG,
43
  description: __(
44
- 'Visually highlight a product or variation and encourage prompt action',
45
  'woo-gutenberg-products-block'
46
  ),
47
  editLabel: __(
41
  const EDIT_MODE_CONFIG = {
42
  ...GENERIC_CONFIG,
43
  description: __(
44
+ 'Highlight a product or variation.',
45
  'woo-gutenberg-products-block'
46
  ),
47
  editLabel: __(
assets/js/blocks/featured-items/inspector-controls.tsx CHANGED
@@ -162,13 +162,13 @@ export const InspectorControls = ( {
162
  } }
163
  >
164
  { __(
165
- 'Choose “Cover” if you want the image to scale automatically to always fit its container.',
166
  'woo-gutenberg-products-block'
167
  ) }
168
  </span>
169
  <span>
170
  { __(
171
- 'Note: by choosing “Cover” you will lose the ability to freely move the focal point precisely.',
172
  'woo-gutenberg-products-block'
173
  ) }
174
  </span>
162
  } }
163
  >
164
  { __(
165
+ 'Select “Cover” to have the image automatically fit its container.',
166
  'woo-gutenberg-products-block'
167
  ) }
168
  </span>
169
  <span>
170
  { __(
171
+ 'This may affect your ability to freely move the focal point of the image.',
172
  'woo-gutenberg-products-block'
173
  ) }
174
  </span>
assets/js/blocks/handpicked-products/edit-mode.tsx CHANGED
@@ -30,7 +30,7 @@ export const HandpickedProductsEditMode = (
30
  setIsEditing( ! isEditing );
31
  debouncedSpeak(
32
  __(
33
- 'Showing Hand-picked Products block preview.',
34
  'woo-gutenberg-products-block'
35
  )
36
  );
30
  setIsEditing( ! isEditing );
31
  debouncedSpeak(
32
  __(
33
+ 'Now displaying a preview of the Hand-picked Products block.',
34
  'woo-gutenberg-products-block'
35
  )
36
  );
assets/js/blocks/mini-cart/edit.tsx CHANGED
@@ -111,7 +111,7 @@ const Edit = ( { attributes, setAttributes }: Props ): ReactElement => {
111
  >
112
  <p>
113
  { __(
114
- 'Edit the appearance of your empty and filled mini cart contents.',
115
  'woo-gutenberg-products-block'
116
  ) }
117
  </p>
111
  >
112
  <p>
113
  { __(
114
+ 'Edit the appearance of the Mini Cart.',
115
  'woo-gutenberg-products-block'
116
  ) }
117
  </p>
assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/empty-mini-cart-contents-block/block.json CHANGED
@@ -1,8 +1,8 @@
1
  {
2
  "name": "woocommerce/empty-mini-cart-contents-block",
3
  "version": "1.0.0",
4
- "title": "Empty Mini Cart Contents",
5
- "description": "Contains blocks that are displayed when the mini cart is empty.",
6
  "category": "woocommerce",
7
  "supports": {
8
  "align": false,
1
  {
2
  "name": "woocommerce/empty-mini-cart-contents-block",
3
  "version": "1.0.0",
4
+ "title": "Empty Mini Cart view.",
5
+ "description": "Blocks that are displayed when the Mini Cart is empty.",
6
  "category": "woocommerce",
7
  "supports": {
8
  "align": false,
assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/filled-mini-cart-contents-block/block.json CHANGED
@@ -1,8 +1,8 @@
1
  {
2
  "name": "woocommerce/filled-mini-cart-contents-block",
3
  "version": "1.0.0",
4
- "title": "Filled Mini Cart Contents",
5
- "description": "Contains blocks that are displayed when the mini cart has products.",
6
  "category": "woocommerce",
7
  "supports": {
8
  "align": false,
1
  {
2
  "name": "woocommerce/filled-mini-cart-contents-block",
3
  "version": "1.0.0",
4
+ "title": "Filled Mini Cart view",
5
+ "description": "Contains blocks that display the content of the Mini Cart.",
6
  "category": "woocommerce",
7
  "supports": {
8
  "align": false,
assets/js/blocks/mini-cart/mini-cart-contents/inner-blocks/mini-cart-shopping-button-block/block.json CHANGED
@@ -2,7 +2,7 @@
2
  "name": "woocommerce/mini-cart-shopping-button-block",
3
  "version": "1.0.0",
4
  "title": "Mini Cart Shopping Button",
5
- "description": "Block that displays the shopping button for the Mini Cart block.",
6
  "category": "woocommerce",
7
  "supports": {
8
  "align": false,
2
  "name": "woocommerce/mini-cart-shopping-button-block",
3
  "version": "1.0.0",
4
  "title": "Mini Cart Shopping Button",
5
+ "description": "Block that displays the shopping button when the Mini Cart is empty.",
6
  "category": "woocommerce",
7
  "supports": {
8
  "align": false,
assets/js/blocks/price-filter/block.json CHANGED
@@ -2,7 +2,7 @@
2
  "name": "woocommerce/price-filter",
3
  "version": "1.0.0",
4
  "title": "Filter by Price",
5
- "description": "Allow customers to filter products by price range.",
6
  "category": "woocommerce",
7
  "keywords": [ "WooCommerce" ],
8
  "supports": {
2
  "name": "woocommerce/price-filter",
3
  "version": "1.0.0",
4
  "title": "Filter by Price",
5
+ "description": "Enable customers to filter the product grid by choosing a price range.",
6
  "category": "woocommerce",
7
  "keywords": [ "WooCommerce" ],
8
  "supports": {
assets/js/blocks/price-filter/block.tsx CHANGED
@@ -9,6 +9,7 @@ import {
9
  } from '@woocommerce/base-context/hooks';
10
  import { useCallback, useState, useEffect } from '@wordpress/element';
11
  import PriceSlider from '@woocommerce/base-components/price-slider';
 
12
  import { useDebouncedCallback } from 'use-debounce';
13
  import PropTypes from 'prop-types';
14
  import { getCurrencyFromPriceResponse } from '@woocommerce/price-format';
@@ -164,6 +165,8 @@ const PriceFilterBlock = ( {
164
  setMinPriceQuery,
165
  ] );
166
 
 
 
167
  // Updates the query based on slider values.
168
  const onSubmit = useCallback(
169
  ( newMinPrice, newMaxPrice ) => {
@@ -206,6 +209,7 @@ const PriceFilterBlock = ( {
206
  // Callback when slider or input fields are changed.
207
  const onChange = useCallback(
208
  ( prices ) => {
 
209
  if ( prices[ 0 ] !== minPrice ) {
210
  setMinPrice( prices[ 0 ] );
211
  }
@@ -303,13 +307,26 @@ const PriceFilterBlock = ( {
303
  const TagName =
304
  `h${ attributes.headingLevel }` as keyof JSX.IntrinsicElements;
305
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  return (
307
  <>
308
- { ! isEditor && attributes.heading && (
309
- <TagName className="wc-block-price-filter__title">
310
- { attributes.heading }
311
- </TagName>
312
- ) }
313
  <div className="wc-block-price-slider">
314
  <PriceSlider
315
  minConstraint={ minConstraint }
@@ -323,6 +340,7 @@ const PriceFilterBlock = ( {
323
  onChange={ onChange }
324
  onSubmit={ () => onSubmit( minPrice, maxPrice ) }
325
  isLoading={ isLoading }
 
326
  />
327
  </div>
328
  </>
9
  } from '@woocommerce/base-context/hooks';
10
  import { useCallback, useState, useEffect } from '@wordpress/element';
11
  import PriceSlider from '@woocommerce/base-components/price-slider';
12
+ import FilterTitlePlaceholder from '@woocommerce/base-components/filter-placeholder';
13
  import { useDebouncedCallback } from 'use-debounce';
14
  import PropTypes from 'prop-types';
15
  import { getCurrencyFromPriceResponse } from '@woocommerce/price-format';
165
  setMinPriceQuery,
166
  ] );
167
 
168
+ const [ isUpdating, setIsUpdating ] = useState( isLoading );
169
+
170
  // Updates the query based on slider values.
171
  const onSubmit = useCallback(
172
  ( newMinPrice, newMaxPrice ) => {
209
  // Callback when slider or input fields are changed.
210
  const onChange = useCallback(
211
  ( prices ) => {
212
+ setIsUpdating( true );
213
  if ( prices[ 0 ] !== minPrice ) {
214
  setMinPrice( prices[ 0 ] );
215
  }
307
  const TagName =
308
  `h${ attributes.headingLevel }` as keyof JSX.IntrinsicElements;
309
 
310
+ if ( ! isLoading && isUpdating ) {
311
+ setIsUpdating( false );
312
+ }
313
+
314
+ const heading = (
315
+ <TagName className="wc-block-price-filter__title">
316
+ { attributes.heading }
317
+ </TagName>
318
+ );
319
+
320
+ const filterHeading =
321
+ isLoading && isUpdating ? (
322
+ <FilterTitlePlaceholder>{ heading }</FilterTitlePlaceholder>
323
+ ) : (
324
+ heading
325
+ );
326
+
327
  return (
328
  <>
329
+ { ! isEditor && attributes.heading && filterHeading }
 
 
 
 
330
  <div className="wc-block-price-slider">
331
  <PriceSlider
332
  minConstraint={ minConstraint }
340
  onChange={ onChange }
341
  onSubmit={ () => onSubmit( minPrice, maxPrice ) }
342
  isLoading={ isLoading }
343
+ isUpdating={ isUpdating }
344
  />
345
  </div>
346
  </>
assets/js/blocks/price-filter/edit.tsx CHANGED
@@ -102,7 +102,7 @@ export default function ( {
102
  help={
103
  showFilterButton
104
  ? __(
105
- 'Products will only update when the button is pressed.',
106
  'woo-gutenberg-products-block'
107
  )
108
  : __(
@@ -149,7 +149,7 @@ export default function ( {
149
  >
150
  <p>
151
  { __(
152
- "Products with prices are needed for filtering by price. You haven't created any products yet.",
153
  'woo-gutenberg-products-block'
154
  ) }
155
  </p>
102
  help={
103
  showFilterButton
104
  ? __(
105
+ 'Products will only update when the button is clicked.',
106
  'woo-gutenberg-products-block'
107
  )
108
  : __(
149
  >
150
  <p>
151
  { __(
152
+ 'To filter your products by price you first need to assign prices to your products.',
153
  'woo-gutenberg-products-block'
154
  ) }
155
  </p>
assets/js/blocks/price-filter/style.scss CHANGED
@@ -11,6 +11,11 @@
11
  h6 {
12
  text-transform: inherit;
13
  }
 
 
 
 
 
14
  }
15
 
16
  .wc-block-price-slider {
@@ -23,17 +28,23 @@
23
  border-color: inherit;
24
  }
25
 
26
-
27
  .wc-block-price-filter__controls {
28
  border-radius: inherit;
29
  border-color: inherit;
30
 
31
- // Force inherting style is required for global style.
32
  input {
33
  border-radius: inherit !important;
34
  border-color: inherit !important;
35
  border-style: solid;
36
  }
 
 
 
 
 
 
 
37
  }
38
 
39
  .editor-styles-wrapper .wc-block-price-filter__button.wc-block-components-price-slider__button,
11
  h6 {
12
  text-transform: inherit;
13
  }
14
+
15
+ > .wc-block-price-filter__title {
16
+ margin-top: $gap-small;
17
+ margin-bottom: $gap-small;
18
+ }
19
  }
20
 
21
  .wc-block-price-slider {
28
  border-color: inherit;
29
  }
30
 
 
31
  .wc-block-price-filter__controls {
32
  border-radius: inherit;
33
  border-color: inherit;
34
 
35
+ // Force inheriting style is required for global style.
36
  input {
37
  border-radius: inherit !important;
38
  border-color: inherit !important;
39
  border-style: solid;
40
  }
41
+
42
+ .input-loading {
43
+ @include placeholder();
44
+ border-radius: 0;
45
+ height: em(32px);
46
+ width: em(90px);
47
+ }
48
  }
49
 
50
  .editor-styles-wrapper .wc-block-price-filter__button.wc-block-components-price-slider__button,
assets/js/blocks/product-best-sellers/block.json CHANGED
@@ -88,7 +88,7 @@
88
  "title",
89
  "menu_order"
90
  ],
91
- "default": "date"
92
  }
93
  },
94
  "textdomain": "woo-gutenberg-products-block",
88
  "title",
89
  "menu_order"
90
  ],
91
+ "default": "popularity"
92
  }
93
  },
94
  "textdomain": "woo-gutenberg-products-block",
assets/js/blocks/product-categories/block.js CHANGED
@@ -27,7 +27,7 @@ const EmptyPlaceholder = () => (
27
  className="wc-block-product-categories"
28
  >
29
  { __(
30
- "This block shows product categories for your store. To use it, you'll first need to create a product and assign it to a category.",
31
  'woo-gutenberg-products-block'
32
  ) }
33
  </Placeholder>
@@ -92,17 +92,6 @@ const ProductCategoriesBlock = ( { attributes, setAttributes, name } ) => {
92
  'Show product count',
93
  'woo-gutenberg-products-block'
94
  ) }
95
- help={
96
- hasCount
97
- ? __(
98
- 'Product count is visible.',
99
- 'woo-gutenberg-products-block'
100
- )
101
- : __(
102
- 'Product count is hidden.',
103
- 'woo-gutenberg-products-block'
104
- )
105
- }
106
  checked={ hasCount }
107
  onChange={ () =>
108
  setAttributes( { hasCount: ! hasCount } )
@@ -136,17 +125,6 @@ const ProductCategoriesBlock = ( { attributes, setAttributes, name } ) => {
136
  'Show hierarchy',
137
  'woo-gutenberg-products-block'
138
  ) }
139
- help={
140
- isHierarchical
141
- ? __(
142
- 'Hierarchy is visible.',
143
- 'woo-gutenberg-products-block'
144
- )
145
- : __(
146
- 'Hierarchy is hidden.',
147
- 'woo-gutenberg-products-block'
148
- )
149
- }
150
  checked={ isHierarchical }
151
  onChange={ () =>
152
  setAttributes( {
@@ -159,17 +137,6 @@ const ProductCategoriesBlock = ( { attributes, setAttributes, name } ) => {
159
  'Show empty categories',
160
  'woo-gutenberg-products-block'
161
  ) }
162
- help={
163
- hasEmpty
164
- ? __(
165
- 'Empty categories are visible.',
166
- 'woo-gutenberg-products-block'
167
- )
168
- : __(
169
- 'Empty categories are hidden.',
170
- 'woo-gutenberg-products-block'
171
- )
172
- }
173
  checked={ hasEmpty }
174
  onChange={ () =>
175
  setAttributes( { hasEmpty: ! hasEmpty } )
27
  className="wc-block-product-categories"
28
  >
29
  { __(
30
+ 'This block displays the product categories for your store. To use it you first need to create a product and assign it to a category.',
31
  'woo-gutenberg-products-block'
32
  ) }
33
  </Placeholder>
92
  'Show product count',
93
  'woo-gutenberg-products-block'
94
  ) }
 
 
 
 
 
 
 
 
 
 
 
95
  checked={ hasCount }
96
  onChange={ () =>
97
  setAttributes( { hasCount: ! hasCount } )
125
  'Show hierarchy',
126
  'woo-gutenberg-products-block'
127
  ) }
 
 
 
 
 
 
 
 
 
 
 
128
  checked={ isHierarchical }
129
  onChange={ () =>
130
  setAttributes( {
137
  'Show empty categories',
138
  'woo-gutenberg-products-block'
139
  ) }
 
 
 
 
 
 
 
 
 
 
 
140
  checked={ hasEmpty }
141
  onChange={ () =>
142
  setAttributes( { hasEmpty: ! hasEmpty } )
assets/js/blocks/product-category/edit-mode.tsx CHANGED
@@ -47,7 +47,7 @@ export const ProductsByCategoryEditMode = (
47
  save();
48
  debouncedSpeak(
49
  __(
50
- 'Showing Products by Category block preview.',
51
  'woo-gutenberg-products-block'
52
  )
53
  );
@@ -57,7 +57,7 @@ export const ProductsByCategoryEditMode = (
57
  stopEditing();
58
  debouncedSpeak(
59
  __(
60
- 'Showing Products by Category block preview.',
61
  'woo-gutenberg-products-block'
62
  )
63
  );
47
  save();
48
  debouncedSpeak(
49
  __(
50
+ 'Now displaying a preview of the reviews for the products in the selected categories.',
51
  'woo-gutenberg-products-block'
52
  )
53
  );
57
  stopEditing();
58
  debouncedSpeak(
59
  __(
60
+ 'Now displaying a preview of the reviews for the products in the selected categories.',
61
  'woo-gutenberg-products-block'
62
  )
63
  );
assets/js/blocks/product-query/constants.ts CHANGED
@@ -1,9 +1,24 @@
 
 
 
 
 
1
  /**
2
  * Internal dependencies
3
  */
4
  import { QueryBlockQuery } from './types';
5
 
6
- export const QUERY_DEFAULT_ATTRIBUTES: { query: QueryBlockQuery } = {
 
 
 
 
 
 
 
 
 
 
7
  query: {
8
  perPage: 6,
9
  pages: 0,
@@ -18,3 +33,23 @@ export const QUERY_DEFAULT_ATTRIBUTES: { query: QueryBlockQuery } = {
18
  inherit: false,
19
  },
20
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { InnerBlockTemplate } from '@wordpress/blocks';
5
+
6
  /**
7
  * Internal dependencies
8
  */
9
  import { QueryBlockQuery } from './types';
10
 
11
+ export const QUERY_DEFAULT_ATTRIBUTES: {
12
+ query: QueryBlockQuery;
13
+ displayLayout: {
14
+ type: 'flex' | 'list';
15
+ columns?: number;
16
+ };
17
+ } = {
18
+ displayLayout: {
19
+ type: 'flex',
20
+ columns: 3,
21
+ },
22
  query: {
23
  perPage: 6,
24
  pages: 0,
33
  inherit: false,
34
  },
35
  };
36
+
37
+ export const INNER_BLOCKS_TEMPLATE: InnerBlockTemplate[] = [
38
+ [
39
+ 'core/post-template',
40
+ {},
41
+ [
42
+ [ 'woocommerce/product-image', undefined, [] ],
43
+ [
44
+ 'core/post-title',
45
+ {
46
+ level: 3,
47
+ fontSize: 'large',
48
+ },
49
+ [],
50
+ ],
51
+ ],
52
+ ],
53
+ [ 'core/query-pagination', undefined, [] ],
54
+ [ 'core/query-no-results', undefined, [] ],
55
+ ];
assets/js/blocks/product-query/variations/product-query.tsx CHANGED
@@ -10,7 +10,7 @@ import { sparkles } from '@wordpress/icons';
10
  /**
11
  * Internal dependencies
12
  */
13
- import { QUERY_DEFAULT_ATTRIBUTES } from '../constants';
14
 
15
  if ( isExperimentalBuild() ) {
16
  registerBlockVariation( 'core/query', {
@@ -36,15 +36,7 @@ if ( isExperimentalBuild() ) {
36
  name: 'product-query',
37
  },
38
  },
39
- innerBlocks: [
40
- [
41
- 'core/post-template',
42
- {},
43
- [ [ 'core/post-title' ], [ 'core/post-featured-image' ] ],
44
- ],
45
- [ 'core/query-pagination' ],
46
- [ 'core/query-no-results' ],
47
- ],
48
  scope: [ 'block', 'inserter' ],
49
  } );
50
  }
10
  /**
11
  * Internal dependencies
12
  */
13
+ import { INNER_BLOCKS_TEMPLATE, QUERY_DEFAULT_ATTRIBUTES } from '../constants';
14
 
15
  if ( isExperimentalBuild() ) {
16
  registerBlockVariation( 'core/query', {
36
  name: 'product-query',
37
  },
38
  },
39
+ innerBlocks: INNER_BLOCKS_TEMPLATE,
 
 
 
 
 
 
 
 
40
  scope: [ 'block', 'inserter' ],
41
  } );
42
  }
assets/js/blocks/product-query/variations/products-on-sale.tsx CHANGED
@@ -9,7 +9,7 @@ import { Icon, percent } from '@wordpress/icons';
9
  /**
10
  * Internal dependencies
11
  */
12
- import { QUERY_DEFAULT_ATTRIBUTES } from '../constants';
13
 
14
  if ( isExperimentalBuild() ) {
15
  registerBlockVariation( 'core/query', {
@@ -39,15 +39,7 @@ if ( isExperimentalBuild() ) {
39
  },
40
  },
41
  },
42
- innerBlocks: [
43
- [
44
- 'core/post-template',
45
- {},
46
- [ [ 'core/post-title' ], [ 'core/post-featured-image' ] ],
47
- ],
48
- [ 'core/query-pagination' ],
49
- [ 'core/query-no-results' ],
50
- ],
51
  scope: [ 'block', 'inserter' ],
52
  } );
53
  }
9
  /**
10
  * Internal dependencies
11
  */
12
+ import { INNER_BLOCKS_TEMPLATE, QUERY_DEFAULT_ATTRIBUTES } from '../constants';
13
 
14
  if ( isExperimentalBuild() ) {
15
  registerBlockVariation( 'core/query', {
39
  },
40
  },
41
  },
42
+ innerBlocks: INNER_BLOCKS_TEMPLATE,
 
 
 
 
 
 
 
 
43
  scope: [ 'block', 'inserter' ],
44
  } );
45
  }
assets/js/blocks/product-search/edit.js CHANGED
@@ -60,17 +60,6 @@ const Edit = ( {
60
  'Show search field label',
61
  'woo-gutenberg-products-block'
62
  ) }
63
- help={
64
- hasLabel
65
- ? __(
66
- 'Label is visible.',
67
- 'woo-gutenberg-products-block'
68
- )
69
- : __(
70
- 'Label is hidden.',
71
- 'woo-gutenberg-products-block'
72
- )
73
- }
74
  checked={ hasLabel }
75
  onChange={ () =>
76
  setAttributes( { hasLabel: ! hasLabel } )
60
  'Show search field label',
61
  'woo-gutenberg-products-block'
62
  ) }
 
 
 
 
 
 
 
 
 
 
 
63
  checked={ hasLabel }
64
  onChange={ () =>
65
  setAttributes( { hasLabel: ! hasLabel } )
assets/js/blocks/product-tag/block.js CHANGED
@@ -311,7 +311,7 @@ class ProductsByTagBlock extends Component {
311
  className="wc-block-products-grid wc-block-product-tag"
312
  >
313
  { __(
314
- "This block displays products from selected tags. In order to preview this you'll first need to create a product and assign it some tags.",
315
  'woo-gutenberg-products-block'
316
  ) }
317
  </Placeholder>
311
  className="wc-block-products-grid wc-block-product-tag"
312
  >
313
  { __(
314
+ 'This block displays products from selected tags. To use it you first need to create products and assign tags to them.',
315
  'woo-gutenberg-products-block'
316
  ) }
317
  </Placeholder>
assets/js/blocks/products/all-products/edit.js CHANGED
@@ -149,7 +149,7 @@ class Editor extends Component {
149
  {
150
  icon: 'edit',
151
  title: __(
152
- 'Edit inner product layout',
153
  'woo-gutenberg-products-block'
154
  ),
155
  onClick: () => this.togglePreview(),
@@ -208,7 +208,7 @@ class Editor extends Component {
208
  <div className="wc-block-all-products-grid-item-template">
209
  <Tip>
210
  { __(
211
- 'Edit the blocks inside the preview below to change the content displayed for each product within the product grid.',
212
  'woo-gutenberg-products-block'
213
  ) }
214
  </Tip>
149
  {
150
  icon: 'edit',
151
  title: __(
152
+ 'Edit the layout of each product',
153
  'woo-gutenberg-products-block'
154
  ),
155
  onClick: () => this.togglePreview(),
208
  <div className="wc-block-all-products-grid-item-template">
209
  <Tip>
210
  { __(
211
+ 'Edit the blocks inside the example below to change the content displayed for all products within the product grid.',
212
  'woo-gutenberg-products-block'
213
  ) }
214
  </Tip>
assets/js/blocks/reviews/reviews-by-category/edit.js CHANGED
@@ -94,7 +94,7 @@ const ReviewsByCategoryEditor = ( {
94
  setAttributes( { editMode: false } );
95
  debouncedSpeak(
96
  __(
97
- 'Showing Reviews by Category block preview.',
98
  'woo-gutenberg-products-block'
99
  )
100
  );
94
  setAttributes( { editMode: false } );
95
  debouncedSpeak(
96
  __(
97
+ 'Now displaying a preview of the reviews for the products in the selected categories.',
98
  'woo-gutenberg-products-block'
99
  )
100
  );
assets/js/blocks/reviews/reviews-by-product/index.js CHANGED
@@ -30,7 +30,7 @@ registerBlockType( 'woocommerce/reviews-by-product', {
30
  category: 'woocommerce',
31
  keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
32
  description: __(
33
- 'Show reviews of your products to build trust.',
34
  'woo-gutenberg-products-block'
35
  ),
36
  supports: {
30
  category: 'woocommerce',
31
  keywords: [ __( 'WooCommerce', 'woo-gutenberg-products-block' ) ],
32
  description: __(
33
+ 'Display reviews for your products.',
34
  'woo-gutenberg-products-block'
35
  ),
36
  supports: {
assets/js/blocks/stock-filter/block.tsx CHANGED
@@ -20,12 +20,14 @@ import {
20
  import CheckboxList from '@woocommerce/base-components/checkbox-list';
21
  import FilterSubmitButton from '@woocommerce/base-components/filter-submit-button';
22
  import FilterResetButton from '@woocommerce/base-components/filter-reset-button';
 
23
  import Label from '@woocommerce/base-components/filter-element-label';
24
  import isShallowEqual from '@wordpress/is-shallow-equal';
25
  import { decodeEntities } from '@wordpress/html-entities';
26
  import { isBoolean, objectHasProp } from '@woocommerce/types';
27
  import { addQueryArgs, removeQueryArgs } from '@wordpress/url';
28
  import { changeUrl, PREFIX_QUERY_ARG_FILTER_TYPE } from '@woocommerce/utils';
 
29
 
30
  /**
31
  * Internal dependencies
@@ -339,14 +341,15 @@ const StockStatusFilterBlock = ( {
339
  [ checked, displayedOptions ]
340
  );
341
 
342
- if ( displayedOptions.length === 0 ) {
343
  return null;
344
  }
345
 
346
  const TagName =
347
  `h${ blockAttributes.headingLevel }` as keyof JSX.IntrinsicElements;
348
  const isLoading =
349
- ! blockAttributes.isPreview && ! STOCK_STATUS_OPTIONS.current;
 
350
  const isDisabled = ! blockAttributes.isPreview && filteredCountsLoading;
351
 
352
  const hasFilterableProducts = getSettingWithCoercion(
@@ -359,14 +362,26 @@ const StockStatusFilterBlock = ( {
359
  return null;
360
  }
361
 
 
 
 
 
 
 
 
 
 
 
 
 
362
  return (
363
  <>
364
- { ! isEditor && blockAttributes.heading && (
365
- <TagName className="wc-block-stock-filter__title">
366
- { blockAttributes.heading }
367
- </TagName>
368
- ) }
369
- <div className="wc-block-stock-filter">
370
  <CheckboxList
371
  className={ 'wc-block-stock-filter-list' }
372
  options={ displayedOptions }
@@ -375,8 +390,10 @@ const StockStatusFilterBlock = ( {
375
  isLoading={ isLoading }
376
  isDisabled={ isDisabled }
377
  />
 
 
378
  <div className="wc-block-stock-filter__actions">
379
- { checked.length > 0 && (
380
  <FilterResetButton
381
  onClick={ () => {
382
  setChecked( [] );
@@ -391,12 +408,13 @@ const StockStatusFilterBlock = ( {
391
  { blockAttributes.showFilterButton && (
392
  <FilterSubmitButton
393
  className="wc-block-stock-filter__button"
 
394
  disabled={ isLoading || isDisabled }
395
  onClick={ () => onSubmit( checked ) }
396
  />
397
  ) }
398
  </div>
399
- </div>
400
  </>
401
  );
402
  };
20
  import CheckboxList from '@woocommerce/base-components/checkbox-list';
21
  import FilterSubmitButton from '@woocommerce/base-components/filter-submit-button';
22
  import FilterResetButton from '@woocommerce/base-components/filter-reset-button';
23
+ import FilterTitlePlaceholder from '@woocommerce/base-components/filter-placeholder';
24
  import Label from '@woocommerce/base-components/filter-element-label';
25
  import isShallowEqual from '@wordpress/is-shallow-equal';
26
  import { decodeEntities } from '@wordpress/html-entities';
27
  import { isBoolean, objectHasProp } from '@woocommerce/types';
28
  import { addQueryArgs, removeQueryArgs } from '@wordpress/url';
29
  import { changeUrl, PREFIX_QUERY_ARG_FILTER_TYPE } from '@woocommerce/utils';
30
+ import classnames from 'classnames';
31
 
32
  /**
33
  * Internal dependencies
341
  [ checked, displayedOptions ]
342
  );
343
 
344
+ if ( ! filteredCountsLoading && displayedOptions.length === 0 ) {
345
  return null;
346
  }
347
 
348
  const TagName =
349
  `h${ blockAttributes.headingLevel }` as keyof JSX.IntrinsicElements;
350
  const isLoading =
351
+ ( ! blockAttributes.isPreview && ! STOCK_STATUS_OPTIONS.current ) ||
352
+ displayedOptions.length === 0;
353
  const isDisabled = ! blockAttributes.isPreview && filteredCountsLoading;
354
 
355
  const hasFilterableProducts = getSettingWithCoercion(
362
  return null;
363
  }
364
 
365
+ const heading = (
366
+ <TagName className="wc-block-stock-filter__title">
367
+ { blockAttributes.heading }
368
+ </TagName>
369
+ );
370
+
371
+ const filterHeading = isLoading ? (
372
+ <FilterTitlePlaceholder>{ heading }</FilterTitlePlaceholder>
373
+ ) : (
374
+ heading
375
+ );
376
+
377
  return (
378
  <>
379
+ { ! isEditor && blockAttributes.heading && filterHeading }
380
+ <div
381
+ className={ classnames( 'wc-block-stock-filter', {
382
+ 'is-loading': isLoading,
383
+ } ) }
384
+ >
385
  <CheckboxList
386
  className={ 'wc-block-stock-filter-list' }
387
  options={ displayedOptions }
390
  isLoading={ isLoading }
391
  isDisabled={ isDisabled }
392
  />
393
+ </div>
394
+ {
395
  <div className="wc-block-stock-filter__actions">
396
+ { checked.length > 0 && ! isLoading && (
397
  <FilterResetButton
398
  onClick={ () => {
399
  setChecked( [] );
408
  { blockAttributes.showFilterButton && (
409
  <FilterSubmitButton
410
  className="wc-block-stock-filter__button"
411
+ isLoading={ isLoading }
412
  disabled={ isLoading || isDisabled }
413
  onClick={ () => onSubmit( checked ) }
414
  />
415
  ) }
416
  </div>
417
+ }
418
  </>
419
  );
420
  };
assets/js/blocks/stock-filter/edit.tsx CHANGED
@@ -40,20 +40,9 @@ const Edit = ( {
40
  >
41
  <ToggleControl
42
  label={ __(
43
- 'Product count',
44
  'woo-gutenberg-products-block'
45
  ) }
46
- help={
47
- showCounts
48
- ? __(
49
- 'Product count is visible.',
50
- 'woo-gutenberg-products-block'
51
- )
52
- : __(
53
- 'Product count is hidden.',
54
- 'woo-gutenberg-products-block'
55
- )
56
- }
57
  checked={ showCounts }
58
  onChange={ () =>
59
  setAttributes( {
@@ -73,11 +62,11 @@ const Edit = ( {
73
  help={
74
  showFilterButton
75
  ? __(
76
- 'Products will only update when the button is pressed.',
77
  'woo-gutenberg-products-block'
78
  )
79
  : __(
80
- 'Products will update as options are selected.',
81
  'woo-gutenberg-products-block'
82
  )
83
  }
40
  >
41
  <ToggleControl
42
  label={ __(
43
+ 'Display product count',
44
  'woo-gutenberg-products-block'
45
  ) }
 
 
 
 
 
 
 
 
 
 
 
46
  checked={ showCounts }
47
  onChange={ () =>
48
  setAttributes( {
62
  help={
63
  showFilterButton
64
  ? __(
65
+ 'Products will only update when the button is clicked.',
66
  'woo-gutenberg-products-block'
67
  )
68
  : __(
69
+ 'Products will update as soon as attributes are selected.',
70
  'woo-gutenberg-products-block'
71
  )
72
  }
assets/js/blocks/stock-filter/index.tsx CHANGED
@@ -18,7 +18,7 @@ import type { Attributes } from './types';
18
  registerBlockType( metadata, {
19
  title: __( 'Filter Products by Stock', 'woo-gutenberg-products-block' ),
20
  description: __(
21
- 'Allow customers to filter the grid by products stock status. Works in combination with the All Products block.',
22
  'woo-gutenberg-products-block'
23
  ),
24
  icon: {
18
  registerBlockType( metadata, {
19
  title: __( 'Filter Products by Stock', 'woo-gutenberg-products-block' ),
20
  description: __(
21
+ 'Enable customers to filter the product grid by stock status.',
22
  'woo-gutenberg-products-block'
23
  ),
24
  icon: {
assets/js/blocks/stock-filter/style.scss CHANGED
@@ -7,9 +7,21 @@
7
  h6 {
8
  text-transform: inherit;
9
  }
 
 
 
 
 
10
  }
11
 
12
  .wc-block-stock-filter {
 
 
 
 
 
 
 
13
  margin-bottom: $gap-large;
14
 
15
  .wc-block-stock-filter-list {
@@ -32,23 +44,29 @@
32
  opacity: 0.6;
33
  }
34
 
35
- .wc-block-stock-filter__actions {
36
- align-items: center;
37
- display: flex;
38
- gap: $gap;
39
- justify-content: flex-end;
40
- margin-top: $gap;
41
 
42
- // The specificity here is needed to overwrite the margin-top that is inherited on WC block template pages such as Shop.
43
- button[type="submit"]:not(.wp-block-search__button).wc-block-components-filter-submit-button {
44
- margin-left: 0;
45
- margin-top: 0;
46
- }
 
 
 
 
 
 
 
 
 
 
 
 
47
  }
48
  }
49
 
50
- .editor-styles-wrapper .wc-block-stock-filter .wc-block-stock-filter__button,
51
- .wc-block-stock-filter .wc-block-stock-filter__button {
52
  margin-top: em($gap-smaller);
53
  padding: em($gap-smaller) em($gap);
54
  @include font-size(small);
7
  h6 {
8
  text-transform: inherit;
9
  }
10
+
11
+ > .wc-block-stock-filter__title {
12
+ margin-top: $gap-small;
13
+ margin-bottom: $gap-small;
14
+ }
15
  }
16
 
17
  .wc-block-stock-filter {
18
+ &.is-loading {
19
+ @include placeholder();
20
+ margin-top: $gap;
21
+ box-shadow: none;
22
+ border-radius: 0;
23
+ }
24
+
25
  margin-bottom: $gap-large;
26
 
27
  .wc-block-stock-filter-list {
44
  opacity: 0.6;
45
  }
46
 
47
+ }
 
 
 
 
 
48
 
49
+ .wc-block-stock-filter__actions {
50
+ align-items: center;
51
+ display: flex;
52
+ gap: $gap;
53
+ justify-content: flex-end;
54
+ margin-top: $gap;
55
+
56
+ // The specificity here is needed to overwrite the margin-top that is inherited on WC block template pages such as Shop.
57
+ button[type="submit"]:not(.wp-block-search__button).wc-block-components-filter-submit-button {
58
+ margin-left: 0;
59
+ margin-top: 0;
60
+ }
61
+
62
+ .wc-block-stock-filter__button {
63
+ margin-top: em($gap-smaller);
64
+ padding: em($gap-smaller) em($gap);
65
+ @include font-size(small);
66
  }
67
  }
68
 
69
+ .editor-styles-wrapper .wc-block-stock-filter .wc-block-stock-filter__button {
 
70
  margin-top: em($gap-smaller);
71
  padding: em($gap-smaller) em($gap);
72
  @include font-size(small);
assets/js/blocks/stock-filter/test/__snapshots__/block.js.snap CHANGED
@@ -102,10 +102,10 @@ exports[`Testing stock filter renders the stock filter block 1`] = `
102
  </div>
103
  </li>
104
  </ul>
105
- <div
106
- class="wc-block-stock-filter__actions"
107
- />
108
  </div>
 
 
 
109
  </div>
110
  `;
111
 
@@ -211,25 +211,25 @@ exports[`Testing stock filter renders the stock filter block with the filter but
211
  </div>
212
  </li>
213
  </ul>
214
- <div
215
- class="wc-block-stock-filter__actions"
 
 
 
 
 
216
  >
217
- <button
218
- class="wp-block-button__link wc-block-filter-submit-button wc-block-components-filter-submit-button wc-block-stock-filter__button"
219
- type="submit"
220
  >
221
- <span
222
- aria-hidden="true"
223
- >
224
- Apply
225
- </span>
226
- <span
227
- class="screen-reader-text"
228
- >
229
- Apply filter
230
- </span>
231
- </button>
232
- </div>
233
  </div>
234
  </div>
235
  `;
@@ -378,9 +378,9 @@ exports[`Testing stock filter renders the stock filter block with the product co
378
  </div>
379
  </li>
380
  </ul>
381
- <div
382
- class="wc-block-stock-filter__actions"
383
- />
384
  </div>
 
 
 
385
  </div>
386
  `;
102
  </div>
103
  </li>
104
  </ul>
 
 
 
105
  </div>
106
+ <div
107
+ class="wc-block-stock-filter__actions"
108
+ />
109
  </div>
110
  `;
111
 
211
  </div>
212
  </li>
213
  </ul>
214
+ </div>
215
+ <div
216
+ class="wc-block-stock-filter__actions"
217
+ >
218
+ <button
219
+ class="wp-block-button__link wc-block-filter-submit-button wc-block-components-filter-submit-button wc-block-stock-filter__button"
220
+ type="submit"
221
  >
222
+ <span
223
+ aria-hidden="true"
 
224
  >
225
+ Apply
226
+ </span>
227
+ <span
228
+ class="screen-reader-text"
229
+ >
230
+ Apply filter
231
+ </span>
232
+ </button>
 
 
 
 
233
  </div>
234
  </div>
235
  `;
378
  </div>
379
  </li>
380
  </ul>
 
 
 
381
  </div>
382
+ <div
383
+ class="wc-block-stock-filter__actions"
384
+ />
385
  </div>
386
  `;
assets/js/editor-components/error-placeholder/error-message.tsx CHANGED
@@ -19,7 +19,7 @@ export interface ErrorMessageProps {
19
  const getErrorMessage = ( { message, type }: ErrorObject ) => {
20
  if ( ! message ) {
21
  return __(
22
- 'An unknown error occurred which prevented the block from being updated.',
23
  'woo-gutenberg-products-block'
24
  );
25
  }
19
  const getErrorMessage = ( { message, type }: ErrorObject ) => {
20
  if ( ! message ) {
21
  return __(
22
+ 'An error has prevented the block from being updated.',
23
  'woo-gutenberg-products-block'
24
  );
25
  }
assets/js/editor-components/grid-content-control/index.js CHANGED
@@ -21,17 +21,6 @@ const GridContentControl = ( { onChange, settings } ) => {
21
  <>
22
  <ToggleControl
23
  label={ __( 'Product image', 'woo-gutenberg-products-block' ) }
24
- help={
25
- imageIsVisible
26
- ? __(
27
- 'Product image is visible.',
28
- 'woo-gutenberg-products-block'
29
- )
30
- : __(
31
- 'Product image is hidden.',
32
- 'woo-gutenberg-products-block'
33
- )
34
- }
35
  checked={ imageIsVisible }
36
  onChange={ () =>
37
  onChange( { ...settings, image: ! imageIsVisible } )
@@ -39,49 +28,16 @@ const GridContentControl = ( { onChange, settings } ) => {
39
  />
40
  <ToggleControl
41
  label={ __( 'Product title', 'woo-gutenberg-products-block' ) }
42
- help={
43
- title
44
- ? __(
45
- 'Product title is visible.',
46
- 'woo-gutenberg-products-block'
47
- )
48
- : __(
49
- 'Product title is hidden.',
50
- 'woo-gutenberg-products-block'
51
- )
52
- }
53
  checked={ title }
54
  onChange={ () => onChange( { ...settings, title: ! title } ) }
55
  />
56
  <ToggleControl
57
  label={ __( 'Product price', 'woo-gutenberg-products-block' ) }
58
- help={
59
- price
60
- ? __(
61
- 'Product price is visible.',
62
- 'woo-gutenberg-products-block'
63
- )
64
- : __(
65
- 'Product price is hidden.',
66
- 'woo-gutenberg-products-block'
67
- )
68
- }
69
  checked={ price }
70
  onChange={ () => onChange( { ...settings, price: ! price } ) }
71
  />
72
  <ToggleControl
73
  label={ __( 'Product rating', 'woo-gutenberg-products-block' ) }
74
- help={
75
- rating
76
- ? __(
77
- 'Product rating is visible.',
78
- 'woo-gutenberg-products-block'
79
- )
80
- : __(
81
- 'Product rating is hidden.',
82
- 'woo-gutenberg-products-block'
83
- )
84
- }
85
  checked={ rating }
86
  onChange={ () => onChange( { ...settings, rating: ! rating } ) }
87
  />
@@ -90,17 +46,6 @@ const GridContentControl = ( { onChange, settings } ) => {
90
  'Add to Cart button',
91
  'woo-gutenberg-products-block'
92
  ) }
93
- help={
94
- button
95
- ? __(
96
- 'Add to Cart button is visible.',
97
- 'woo-gutenberg-products-block'
98
- )
99
- : __(
100
- 'Add to Cart button is hidden.',
101
- 'woo-gutenberg-products-block'
102
- )
103
- }
104
  checked={ button }
105
  onChange={ () => onChange( { ...settings, button: ! button } ) }
106
  />
21
  <>
22
  <ToggleControl
23
  label={ __( 'Product image', 'woo-gutenberg-products-block' ) }
 
 
 
 
 
 
 
 
 
 
 
24
  checked={ imageIsVisible }
25
  onChange={ () =>
26
  onChange( { ...settings, image: ! imageIsVisible } )
28
  />
29
  <ToggleControl
30
  label={ __( 'Product title', 'woo-gutenberg-products-block' ) }
 
 
 
 
 
 
 
 
 
 
 
31
  checked={ title }
32
  onChange={ () => onChange( { ...settings, title: ! title } ) }
33
  />
34
  <ToggleControl
35
  label={ __( 'Product price', 'woo-gutenberg-products-block' ) }
 
 
 
 
 
 
 
 
 
 
 
36
  checked={ price }
37
  onChange={ () => onChange( { ...settings, price: ! price } ) }
38
  />
39
  <ToggleControl
40
  label={ __( 'Product rating', 'woo-gutenberg-products-block' ) }
 
 
 
 
 
 
 
 
 
 
 
41
  checked={ rating }
42
  onChange={ () => onChange( { ...settings, rating: ! rating } ) }
43
  />
46
  'Add to Cart button',
47
  'woo-gutenberg-products-block'
48
  ) }
 
 
 
 
 
 
 
 
 
 
 
49
  checked={ button }
50
  onChange={ () => onChange( { ...settings, button: ! button } ) }
51
  />
assets/js/editor-components/grid-layout-control/index.js CHANGED
@@ -57,13 +57,13 @@ const GridLayoutControl = ( {
57
  />
58
  <ToggleControl
59
  label={ __(
60
- 'Align Last Block',
61
  'woo-gutenberg-products-block'
62
  ) }
63
  help={
64
  alignButtons
65
  ? __(
66
- 'The last inner block will be aligned vertically.',
67
  'woo-gutenberg-products-block'
68
  )
69
  : __(
57
  />
58
  <ToggleControl
59
  label={ __(
60
+ 'Align the last block to the bottom',
61
  'woo-gutenberg-products-block'
62
  ) }
63
  help={
64
  alignButtons
65
  ? __(
66
+ 'Align the last block to the bottom.',
67
  'woo-gutenberg-products-block'
68
  )
69
  : __(
assets/js/editor-components/product-tag-control/index.js CHANGED
@@ -103,7 +103,7 @@ class ProductTagControl extends Component {
103
  ),
104
  list: __( 'Product Tags', 'woo-gutenberg-products-block' ),
105
  noItems: __(
106
- "Your store doesn't have any product tags.",
107
  'woo-gutenberg-products-block'
108
  ),
109
  search: __(
103
  ),
104
  list: __( 'Product Tags', 'woo-gutenberg-products-block' ),
105
  noItems: __(
106
+ 'You have not set up any product tags on your store.',
107
  'woo-gutenberg-products-block'
108
  ),
109
  search: __(
assets/js/shared/context/product-data-context.js CHANGED
@@ -63,6 +63,7 @@ const defaultProductData = {
63
  const ProductDataContext = createContext( {
64
  product: defaultProductData,
65
  hasContext: false,
 
66
  } );
67
 
68
  export const useProductDataContext = () => useContext( ProductDataContext );
@@ -70,10 +71,11 @@ export const useProductDataContext = () => useContext( ProductDataContext );
70
  export const ProductDataContextProvider = ( {
71
  product = null,
72
  children,
73
- isLoading = false,
74
  } ) => {
75
  const contextValue = {
76
  product: product || defaultProductData,
 
77
  hasContext: true,
78
  };
79
 
63
  const ProductDataContext = createContext( {
64
  product: defaultProductData,
65
  hasContext: false,
66
+ isLoading: false,
67
  } );
68
 
69
  export const useProductDataContext = () => useContext( ProductDataContext );
71
  export const ProductDataContextProvider = ( {
72
  product = null,
73
  children,
74
+ isLoading,
75
  } ) => {
76
  const contextValue = {
77
  product: product || defaultProductData,
78
+ isLoading,
79
  hasContext: true,
80
  };
81
 
assets/js/shared/hocs/with-product-data-context.js CHANGED
@@ -1,12 +1,11 @@
1
  /**
2
  * External dependencies
3
  */
4
- import apiFetch from '@wordpress/api-fetch';
5
  import {
6
  ProductDataContextProvider,
7
  useProductDataContext,
8
  } from '@woocommerce/shared-context';
9
- import { useState, useEffect } from '@wordpress/element';
10
 
11
  /**
12
  * Loads the product from the API and adds to the context provider.
@@ -14,41 +13,32 @@ import { useState, useEffect } from '@wordpress/element';
14
  * @param {Object} props Component props.
15
  */
16
  const OriginalComponentWithContext = ( props ) => {
17
- const { productId, OriginalComponent } = props;
18
- const [ product, setProduct ] = useState( null );
19
- const [ isLoading, setIsLoading ] = useState( true );
20
 
21
- useEffect( () => {
22
- if ( !! props.product ) {
23
- setProduct( props.product );
24
- setIsLoading( false );
25
- }
26
- }, [ props.product ] );
27
 
28
- useEffect( () => {
29
- if ( productId > 0 ) {
30
- setIsLoading( true );
31
- apiFetch( {
32
- path: `/wc/store/v1/products/${ productId }`,
33
- } )
34
- .then( ( receivedProduct ) => {
35
- setProduct( receivedProduct );
36
- } )
37
- .catch( async () => {
38
- setProduct( null );
39
- } )
40
- .finally( () => {
41
- setIsLoading( false );
42
- } );
43
- }
44
- }, [ productId ] );
45
 
46
- if ( ! isLoading && ! product ) {
47
- return null;
 
 
 
 
48
  }
49
 
50
  return (
51
- <ProductDataContextProvider product={ product } isLoading={ isLoading }>
 
 
 
52
  <OriginalComponent { ...props } />
53
  </ProductDataContextProvider>
54
  );
1
  /**
2
  * External dependencies
3
  */
4
+ import { useStoreProducts } from '@woocommerce/base-context/hooks';
5
  import {
6
  ProductDataContextProvider,
7
  useProductDataContext,
8
  } from '@woocommerce/shared-context';
 
9
 
10
  /**
11
  * Loads the product from the API and adds to the context provider.
13
  * @param {Object} props Component props.
14
  */
15
  const OriginalComponentWithContext = ( props ) => {
16
+ const { productId, OriginalComponent, postId, product } = props;
 
 
17
 
18
+ const id = props?.isDescendentOfQueryLoop ? postId : productId;
 
 
 
 
 
19
 
20
+ const { products, productsLoading } = useStoreProducts( {
21
+ include: id,
22
+ } );
23
+
24
+ const productFromAPI = {
25
+ product: id > 0 && products.length > 0 ? products[ 0 ] : null,
26
+ isLoading: productsLoading,
27
+ };
 
 
 
 
 
 
 
 
 
28
 
29
+ if ( product ) {
30
+ return (
31
+ <ProductDataContextProvider product={ product } isLoading={ false }>
32
+ <OriginalComponent { ...props } />
33
+ </ProductDataContextProvider>
34
+ );
35
  }
36
 
37
  return (
38
+ <ProductDataContextProvider
39
+ product={ productFromAPI.product }
40
+ isLoading={ productFromAPI.isLoading }
41
+ >
42
  <OriginalComponent { ...props } />
43
  </ProductDataContextProvider>
44
  );
build/active-filters-frontend.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-price-format', 'wc-settings', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '8b3aad3f7ec9858db3a28cf592a937f7');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-price-format', 'wc-settings', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '0fe9207903410057efbca54cfa50ccc6');
build/active-filters-frontend.js CHANGED
@@ -1,15 +1,15 @@
1
- !function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=228)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},102:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return c}));var n=r(3);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const c=e.filter(e=>e.attribute===r.taxonomy),s=c.length?c[0]:null;if(!(s&&s.slug&&Array.isArray(s.slug)&&s.slug.includes(o)))return;const a=s.slug.filter(e=>e!==o),i=e.filter(e=>e.attribute!==r.taxonomy);a.length>0&&(s.slug=a.sort(),i.push(s)),t(Object(n.sortBy)(i,"attribute"))},c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],c=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!r||!r.taxonomy)return[];const s=e.filter(e=>e.attribute!==r.taxonomy);return 0===o.length?t(s):(s.push({attribute:r.taxonomy,operator:c,slug:o.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(s,"attribute"))),s}},106:function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{icon:t,size:r=24,...o}=e;return Object(n.cloneElement)(t,{width:r,height:r,...o})}},11:function(e,t){e.exports=window.wp.isShallowEqual},112:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return s}));var n=r(2);const o=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;var n;return r&&r.id&&e.push(r),e},[]),c=e=>{if(e)return o.find(t=>t.id===e)},s=e=>{if(e)return o.find(t=>t.taxonomy===e)}},12:function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,r.apply(this,arguments)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},126:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return i})),r.d(t,"d",(function(){return l})),r.d(t,"c",(function(){return u}));var n=r(14),o=r(2),c=r(78);const s=Object(o.getSettingWithCoercion)("is_rendering_php_template",!1,c.a),a="query_type_",i="filter_";function l(e){return window?Object(n.getQueryArg)(window.location.href,e):null}function u(e){s?window.location.href=e:window.history.replaceState({},"",e)}},13:function(e,t){e.exports=window.wp.primitives},136:function(e){e.exports=JSON.parse('{"name":"woocommerce/active-filters","version":"1.0.0","title":"Active Product Filters","description":"Show the currently active product filters. Works in combination with the All Products and filters blocks.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"color":{"text":true,"background":false}},"attributes":{"displayStyle":{"type":"string","default":"list"},"headingLevel":{"type":"number","default":3}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},14:function(e,t){e.exports=window.wp.url},15:function(e,t,r){"use strict";var n=r(19),o=r.n(n),c=r(0),s=r(5),a=r(1),i=r(48),l=e=>{let{imageUrl:t=i.l+"/block-error.svg",header:r=Object(a.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(a.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:s=Object(a.__)("Error:","woo-gutenberg-products-block"),button:l,showErrorBlock:u=!0}=e;return u?Object(c.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(c.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(c.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},r&&Object(c.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(c.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),o&&Object(c.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},s?s+" ":"",o),l&&Object(c.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};r(35);class u extends s.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:r=!0,showErrorBlock:n=!0,text:o,errorMessagePrefix:s,renderError:a,button:i}=this.props,{errorMessage:u,hasError:b}=this.state;return b?"function"==typeof a?a({errorMessage:u}):Object(c.createElement)(l,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:s,button:i}):this.props.children}}t.a=u},17:function(e,t){e.exports=window.wp.htmlEntities},18:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return o}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return n(e)&&t in e}},19:function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},2:function(e,t){e.exports=window.wc.wcSettings},20:function(e,t,r){"use strict";var n=r(0),o=r(4),c=r.n(o);t.a=e=>{let t,{label:r,screenReaderLabel:o,wrapperElement:s,wrapperProps:a={}}=e;const i=null!=r,l=null!=o;return!i&&l?(t=s||"span",a={...a,className:c()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,o)):(t=s||n.Fragment,i&&l&&r!==o?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},o)):Object(n.createElement)(t,a,r))}},203:function(e,t){},224:function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return a}));var n=r(18);const o=e=>Object(n.b)(e,"count")&&Object(n.b)(e,"description")&&Object(n.b)(e,"id")&&Object(n.b)(e,"name")&&Object(n.b)(e,"parent")&&Object(n.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,c=e=>Array.isArray(e)&&e.every(o),s=e=>Object(n.b)(e,"attribute")&&Object(n.b)(e,"operator")&&Object(n.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),a=e=>Array.isArray(e)&&e.every(s)},228:function(e,t,r){e.exports=r(247)},229:function(e,t){},247:function(e,t,r){"use strict";r.r(t);var n=r(52),o=r(0),c=r(1),s=r(39),a=r(2),i=r(4),l=r.n(i),u=r(20),b=r(78),p=r(18),d=r(224),f=r(126),m=(r(229),r(112)),g=r(41),O=r(257),j=r(14);const y=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(c.sprintf)(
2
  /* translators: %1$s min price, %2$s max price */
3
- Object(c.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(g.formatPrice)(e),Object(g.formatPrice)(t)):Number.isFinite(e)?Object(c.sprintf)(
4
  /* translators: %s min price */
5
- Object(c.__)("From %s","woo-gutenberg-products-block"),Object(g.formatPrice)(e)):Object(c.sprintf)(
6
  /* translators: %s max price */
7
- Object(c.__)("Up to %s","woo-gutenberg-products-block"),Object(g.formatPrice)(t)),_=e=>{let{type:t,name:r,prefix:n="",removeCallback:s=(()=>null),showLabel:a=!0,displayStyle:i}=e;const l=n?Object(o.createElement)(o.Fragment,null,n," ",r):r,b=Object(c.sprintf)(
8
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
9
- Object(c.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(o.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},a&&Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===i?Object(o.createElement)(O.a,{element:"span",text:l,onRemove:s,radius:"large",ariaLabel:b}):Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-name"},Object(o.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:s},Object(o.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(o.createElement)("ellipse",{cx:"8",cy:"8",rx:"8",ry:"8",transform:"rotate(-180 8 8)",fill:"currentColor",fillOpacity:"0.7"}),Object(o.createElement)("rect",{x:"10.636",y:"3.94983",width:"2",height:"9.9466",transform:"rotate(45 10.636 3.94983)",fill:"white"}),Object(o.createElement)("rect",{x:"12.0503",y:"11.0209",width:"2",height:"9.9466",transform:"rotate(135 12.0503 11.0209)",fill:"white"})),Object(o.createElement)(u.a,{screenReaderLabel:b})),l))},w=function(){if(!window)return;const e=window.location.href,t=Object(j.getQueryArgs)(e),r=Object(j.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,o=new Array(n),c=0;c<n;c++)o[c]=arguments[c];o.forEach(e=>{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].toString().split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const s=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t})),a=Object(j.addQueryArgs)(r,s);Object(f.c)(a)};var h=r(65),v=r(17),E=r(102),k=e=>{let{attributeObject:t,slugs:r=[],operator:n="in",displayStyle:i}=e;const{results:l,isLoading:u}=Object(h.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[p,f]=Object(s.b)("attributes",[]);if(u||!Array.isArray(l)||!Object(d.b)(l)||!Object(d.a)(p))return null;const m=t.label,g=Object(a.getSettingWithCoercion)("is_rendering_php_template",!1,b.a);return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},m,":"),Object(o.createElement)("ul",null,r.map((e,r)=>{const s=l.find(t=>t.slug===e);if(!s)return null;let a="";return r>0&&"and"===n&&(a=Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(c.__)("and","woo-gutenberg-products-block"))),_({type:m,name:Object(v.decodeEntities)(s.name||e),prefix:a,removeCallback:()=>{const r=p.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name});1===(null==r?void 0:r.slug.length)?w("query_type_"+t.name,"filter_"+t.name):w({["filter_"+t.name]:e}),g||Object(E.a)(p,f,t,e)},showLabel:!1,displayStyle:i})})))},S=r(136);const x={heading:{type:"string",default:Object(c.__)("Active filters","woo-gutenberg-products-block")}};Object(n.a)({selector:".wp-block-woocommerce-active-filters",Block:e=>{let{attributes:t,isEditor:r=!1}=e;const n=Object(a.getSettingWithCoercion)("is_rendering_php_template",!1,b.a),[i,g]=Object(s.b)("attributes",[]),[O,h]=Object(s.b)("stock_status",[]),[v,E]=Object(s.b)("min_price"),[S,x]=Object(s.b)("max_price"),A=Object(a.getSetting)("stockStatusOptions",[]),P=Object(o.useMemo)(()=>{return 0!==O.length&&(e=O,Array.isArray(e)&&e.every(e=>["instock","outofstock","onbackorder"].includes(e)))&&(e=>Object(p.a)(e)&&Object.keys(e).every(e=>["instock","outofstock","onbackorder"].includes(e)))(A)?O.map(e=>_({type:Object(c.__)("Stock Status","woo-gutenberg-products-block"),name:A[e],removeCallback:()=>{if(w({filter_stock_status:e}),!n){const t=O.filter(t=>t!==e);h(t)}},displayStyle:t.displayStyle})):null;var e},[A,O,h,t.displayStyle,n]),N=Object(o.useMemo)(()=>Number.isFinite(v)||Number.isFinite(S)?_({type:Object(c.__)("Price","woo-gutenberg-products-block"),name:y(v,S),removeCallback:()=>{w("max_price","min_price"),n||(E(void 0),x(void 0))},displayStyle:t.displayStyle}):null,[v,S,t.displayStyle,E,x,n]),R=Object(o.useMemo)(()=>Object(d.a)(i)?i.map(e=>{const r=Object(m.b)(e.attribute);return r?Object(o.createElement)(k,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator}):null}):null,[i,t.displayStyle]),[C,T]=Object(s.b)("ratings");Object(o.useEffect)(()=>{var e;if(!n)return;if(C.length&&C.length>0)return;const t=null===(e=Object(f.d)("rating_filter"))||void 0===e?void 0:e.toString();t&&T(t.split(","))},[n,C,T]);const B=Object(o.useMemo)(()=>{return 0!==C.length&&(e=C,Array.isArray(e)&&e.every(e=>["1","2","3","4","5"].includes(e)))?C.map(e=>_({type:Object(c.__)("Rating","woo-gutenberg-products-block"),name:Object(c.sprintf)(
10
  /* translators: %s is referring to the average rating value */
11
- Object(c.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(n)return w({rating_filter:e});const t=C.filter(t=>t!==e);T(t)},displayStyle:t.displayStyle})):null;var e},[C,T,t.displayStyle,n]);if(!(i.length>0||O.length>0||C.length>0||Number.isFinite(v)||Number.isFinite(S)||r))return null;const L="h"+t.headingLevel;if(!Object(a.getSettingWithCoercion)("has_filterable_products",!1,b.a))return null;const M=l()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return Object(o.createElement)(o.Fragment,null,!r&&t.heading&&Object(o.createElement)(L,{className:"wc-block-active-filters__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-active-filters"},Object(o.createElement)("ul",{className:M},r?Object(o.createElement)(o.Fragment,null,_({type:Object(c.__)("Size","woo-gutenberg-products-block"),name:Object(c.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),_({type:Object(c.__)("Color","woo-gutenberg-products-block"),name:Object(c.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(o.createElement)(o.Fragment,null,N,P,R,B)),Object(o.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{(()=>{if(!window)return;const e=window.location.href,t=Object(j.getQueryArgs)(e),r=Object(j.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!(e.includes("min_price")||e.includes("max_price")||e.includes("rating_filter")||e.includes("filter_")||e.includes("query_type_"))).map(e=>[e,t[e]])),o=Object(j.addQueryArgs)(r,n);Object(f.c)(o)})(),n||(E(void 0),x(void 0),g([]),h([]))}},Object(o.createElement)(u.a,{label:Object(c.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(c.__)("Clear All Filters","woo-gutenberg-products-block")}))))},getProps:e=>({attributes:{displayStyle:e.dataset.displayStyle||S.attributes.displayStyle.default,heading:e.dataset.heading||x.heading.default,headingLevel:e.dataset.headingLevel?parseInt(e.dataset.headingLevel,10):S.attributes.headingLevel.default},isEditor:!1})})},257:function(e,t,r){"use strict";var n=r(12),o=r.n(n),c=r(0),s=r(4),a=r.n(s),i=r(1),l=r(106),u=r(13),b=Object(c.createElement)(u.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(u.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));r(203);var p=e=>{let{text:t,screenReaderText:r="",element:n="li",className:s="",radius:i="small",children:l=null,...u}=e;const b=n,p=a()(s,"wc-block-components-chip","wc-block-components-chip--radius-"+i),d=Boolean(r&&r!==t);return Object(c.createElement)(b,o()({className:p},u),Object(c.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(c.createElement)("span",{className:"screen-reader-text"},r),l)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:s=(()=>{}),removeOnAnyClick:u=!1,text:d,screenReaderText:f="",...m}=e;const g=u?"span":"button";if(!t){const e=f&&"string"==typeof f?f:d;t="string"!=typeof e?
12
  /* translators: Remove chip. */
13
- Object(i.__)("Remove","woo-gutenberg-products-block"):Object(i.sprintf)(
14
  /* translators: %s text of the chip to remove. */
15
- Object(i.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const O={"aria-label":t,disabled:n,onClick:s,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||s()}},j=u?O:{},y=u?{"aria-hidden":!0}:O;return Object(c.createElement)(p,o()({},m,j,{className:a()(r,"is-removable"),element:u?"button":m.element,screenReaderText:f,text:d}),Object(c.createElement)(g,o()({className:"wc-block-components-chip__remove"},y),Object(c.createElement)(l.a,{className:"wc-block-components-chip__remove-icon",icon:b,size:16})))}},26:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const o=Object(n.createContext)("page"),c=()=>Object(n.useContext)(o);o.Provider},3:function(e,t){e.exports=window.lodash},31:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),o=r(11),c=r.n(o);function s(e){const t=Object(n.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},35:function(e,t){},39:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return d}));var n=r(6),o=r(7),c=r(0),s=r(11),a=r.n(s),i=r(31),l=r(61),u=r(26);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(o.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:s}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(c.useCallback)(t=>{s(e,t)},[e,s])]},p=(e,t,r)=>{const s=Object(u.a)();r=r||s;const a=Object(o.useSelect)(o=>o(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:i}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(c.useCallback)(t=>{i(r,e,t)},[r,e,i])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,o]=b(t),s=Object(i.a)(n),p=Object(i.a)(e),d=Object(l.a)(p),f=Object(c.useRef)(!1);return Object(c.useEffect)(()=>{a()(d,p)||(o(Object.assign({},s,p)),f.current=!0)},[s,p,d,o]),f.current?[n,o]:[e,o]}},4:function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var c=typeof n;if("string"===c||"number"===c)e.push(n);else if(Array.isArray(n)){if(n.length){var s=o.apply(null,n);s&&e.push(s)}}else if("object"===c)if(n.toString===Object.prototype.toString)for(var a in n)r.call(n,a)&&n[a]&&e.push(a);else e.push(n.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},41:function(e,t){e.exports=window.wc.priceFormat},48:function(e,t,r){"use strict";r.d(t,"n",(function(){return c})),r.d(t,"l",(function(){return s})),r.d(t,"k",(function(){return a})),r.d(t,"m",(function(){return i})),r.d(t,"i",(function(){return l})),r.d(t,"d",(function(){return u})),r.d(t,"f",(function(){return b})),r.d(t,"j",(function(){return p})),r.d(t,"c",(function(){return d})),r.d(t,"e",(function(){return f})),r.d(t,"g",(function(){return m})),r.d(t,"a",(function(){return g})),r.d(t,"h",(function(){return O})),r.d(t,"b",(function(){return j}));var n,o=r(2);const c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),s=c.pluginUrl+"images/",a=c.pluginUrl+"build/",i=c.buildPhase,l=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),b=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),d=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),f=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),m=Object(o.getSetting)("shippingCountries",{}),g=Object(o.getSetting)("allowedCountries",{}),O=Object(o.getSetting)("shippingStates",{}),j=Object(o.getSetting)("allowedStates",{})},5:function(e,t){e.exports=window.React},52:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(12),o=r.n(n),c=r(0),s=r(15);const a=[".wp-block-woocommerce-cart"],i=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:a=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const i=n(e,r),l=a(e,r),u={...e.dataset,...i.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:a={},errorBoundaryProps:i={}}=e;Object(c.render)(Object(c.createElement)(s.a,i,Object(c.createElement)(c.Suspense,{fallback:Object(c.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(c.createElement)(t,o()({},a,{attributes:n})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:i,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(a.join(",")),{Block:r,getProps:n,getErrorBoundaryProps:o,selector:c}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrappers:c}=e;const s=document.body.querySelectorAll(o);c&&c.length>0&&Array.prototype.filter.call(s,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,c)),i({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({Block:r,getProps:n,getErrorBoundaryProps:o,selector:c,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrapper:c}=e;const s=c.querySelectorAll(o);i({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},6:function(e,t){e.exports=window.wc.wcBlocksData},61:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(5);function o(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},65:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(6),o=r(7),c=r(0),s=r(31),a=r(73);const i=e=>{const{namespace:t,resourceName:r,resourceValues:i=[],query:l={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(c.useRef)({results:[],isLoading:!0}),p=Object(s.a)(l),d=Object(s.a)(i),f=Object(a.a)(),m=Object(o.useSelect)(e=>{if(!u)return null;const o=e(n.COLLECTIONS_STORE_KEY),c=[t,r,p,d],s=o.getCollectionError(...c);if(s){if(!(s instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");f(s)}return{results:o.getCollection(...c),isLoading:!o.hasFinishedResolution("getCollection",c)}},[t,r,d,p,u]);return null!==m&&(b.current=m),b.current}},7:function(e,t){e.exports=window.wp.data},73:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const o=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},78:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e}});
1
+ !function(e){var t={};function r(n){if(t[n])return t[n].exports;var c=t[n]={i:n,l:!1,exports:{}};return e[n].call(c.exports,c,c.exports,r),c.l=!0,c.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)r.d(n,c,function(t){return e[t]}.bind(null,c));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=230)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},104:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(3);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===r.taxonomy),s=o.length?o[0]:null;if(!(s&&s.slug&&Array.isArray(s.slug)&&s.slug.includes(c)))return;const a=s.slug.filter(e=>e!==c),l=e.filter(e=>e.attribute!==r.taxonomy);a.length>0&&(s.slug=a.sort(),l.push(s)),t(Object(n.sortBy)(l,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!r||!r.taxonomy)return[];const s=e.filter(e=>e.attribute!==r.taxonomy);return 0===c.length?t(s):(s.push({attribute:r.taxonomy,operator:o,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(s,"attribute"))),s}},108:function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{icon:t,size:r=24,...c}=e;return Object(n.cloneElement)(t,{width:r,height:r,...c})}},11:function(e,t){e.exports=window.wp.isShallowEqual},114:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return s}));var n=r(2);const c=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;var n;return r&&r.id&&e.push(r),e},[]),o=e=>{if(e)return c.find(t=>t.id===e)},s=e=>{if(e)return c.find(t=>t.taxonomy===e)}},12:function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,r.apply(this,arguments)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},128:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return l})),r.d(t,"d",(function(){return i})),r.d(t,"c",(function(){return u}));var n=r(14),c=r(2),o=r(80);const s=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),a="query_type_",l="filter_";function i(e){return window?Object(n.getQueryArg)(window.location.href,e):null}function u(e){s?window.location.href=e:window.history.replaceState({},"",e)}},13:function(e,t){e.exports=window.wp.primitives},138:function(e){e.exports=JSON.parse('{"name":"woocommerce/active-filters","version":"1.0.0","title":"Active Product Filters","description":"Display the currently active product filters.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"color":{"text":true,"background":false}},"attributes":{"displayStyle":{"type":"string","default":"list"},"headingLevel":{"type":"number","default":3}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},14:function(e,t){e.exports=window.wp.url},15:function(e,t,r){"use strict";var n=r(19),c=r.n(n),o=r(0),s=r(5),a=r(1),l=r(48),i=e=>{let{imageUrl:t=l.l+"/block-error.svg",header:r=Object(a.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(a.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:c,errorMessagePrefix:s=Object(a.__)("Error:","woo-gutenberg-products-block"),button:i,showErrorBlock:u=!0}=e;return u?Object(o.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(o.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(o.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},r&&Object(o.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(o.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),c&&Object(o.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},s?s+" ":"",c),i&&Object(o.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},i))):null};r(35);class u extends s.Component{constructor(){super(...arguments),c()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(o.createElement)(o.Fragment,null,Object(o.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:r=!0,showErrorBlock:n=!0,text:c,errorMessagePrefix:s,renderError:a,button:l}=this.props,{errorMessage:u,hasError:b}=this.state;return b?"function"==typeof a?a({errorMessage:u}):Object(o.createElement)(i,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:c,errorMessagePrefix:s,button:l}):this.props.children}}t.a=u},17:function(e,t){e.exports=window.wp.htmlEntities},18:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return n(e)&&t in e}},19:function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},2:function(e,t){e.exports=window.wc.wcSettings},20:function(e,t,r){"use strict";var n=r(0),c=r(4),o=r.n(c);t.a=e=>{let t,{label:r,screenReaderLabel:c,wrapperElement:s,wrapperProps:a={}}=e;const l=null!=r,i=null!=c;return!l&&i?(t=s||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,c)):(t=s||n.Fragment,l&&i&&r!==c?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},c)):Object(n.createElement)(t,a,r))}},205:function(e,t){},226:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return a}));var n=r(18);const c=e=>Object(n.b)(e,"count")&&Object(n.b)(e,"description")&&Object(n.b)(e,"id")&&Object(n.b)(e,"name")&&Object(n.b)(e,"parent")&&Object(n.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,o=e=>Array.isArray(e)&&e.every(c),s=e=>Object(n.b)(e,"attribute")&&Object(n.b)(e,"operator")&&Object(n.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),a=e=>Array.isArray(e)&&e.every(s)},230:function(e,t,r){e.exports=r(247)},231:function(e,t){},247:function(e,t,r){"use strict";r.r(t);var n=r(52),c=r(0),o=r(1),s=r(39),a=r(2),l=r(4),i=r.n(l),u=r(20),b=r(80),p=r(18),d=r(226),f=r(128),m=r(62);r(231);var g=r(114),O=r(41),j=r(260),y=r(14),_=r(108),w=r(259);const h=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(o.sprintf)(
2
  /* translators: %1$s min price, %2$s max price */
3
+ Object(o.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(O.formatPrice)(e),Object(O.formatPrice)(t)):Number.isFinite(e)?Object(o.sprintf)(
4
  /* translators: %s min price */
5
+ Object(o.__)("From %s","woo-gutenberg-products-block"),Object(O.formatPrice)(e)):Object(o.sprintf)(
6
  /* translators: %s max price */
7
+ Object(o.__)("Up to %s","woo-gutenberg-products-block"),Object(O.formatPrice)(t)),E=e=>{let{type:t,name:r,prefix:n="",removeCallback:s=(()=>null),showLabel:a=!0,displayStyle:l}=e;const i=n?Object(c.createElement)(c.Fragment,null,n," ",r):r,b=Object(o.sprintf)(
8
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
9
+ Object(o.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(c.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},a&&Object(c.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===l?Object(c.createElement)(j.a,{element:"span",text:i,onRemove:s,radius:"large",ariaLabel:b}):Object(c.createElement)("span",{className:"wc-block-active-filters__list-item-name"},Object(c.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:s},Object(c.createElement)(_.a,{className:"wc-block-components-chip__remove-icon",icon:w.a,size:16}),Object(c.createElement)(u.a,{screenReaderLabel:b})),i))},v=function(){if(!window)return;const e=window.location.href,t=Object(y.getQueryArgs)(e),r=Object(y.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,c=new Array(n),o=0;o<n;o++)c[o]=arguments[o];c.forEach(e=>{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].toString().split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const s=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t})),a=Object(y.addQueryArgs)(r,s);Object(f.c)(a)},k=["min_price","max_price","rating_filter","filter_","query_type_"],S=e=>{let t=!1;for(let r=0;k.length>r;r++){const n=k[r];if(n===e.substring(0,n.length)){t=!0;break}}return t};var x=r(66),A=r(17),P=r(104),N=e=>{let{attributeObject:t,slugs:r=[],operator:n="in",displayStyle:l,isLoadingCallback:i}=e;const{results:u,isLoading:p}=Object(x.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[f,m]=Object(s.b)("attributes",[]);if(Object(c.useEffect)(()=>{i(p)},[p,i]),!Array.isArray(u)||!Object(d.b)(u)||!Object(d.a)(f))return null;const g=t.label,O=Object(a.getSettingWithCoercion)("is_rendering_php_template",!1,b.a);return Object(c.createElement)("li",null,Object(c.createElement)("span",{className:"wc-block-active-filters__list-item-type"},g,":"),Object(c.createElement)("ul",null,r.map((e,r)=>{const s=u.find(t=>t.slug===e);if(!s)return null;let a="";return r>0&&"and"===n&&(a=Object(c.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(o.__)("All","woo-gutenberg-products-block"))),E({type:g,name:Object(A.decodeEntities)(s.name||e),prefix:a,isLoading:p,removeCallback:()=>{const r=f.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name});1===(null==r?void 0:r.slug.length)?v("query_type_"+t.name,"filter_"+t.name):v({["filter_"+t.name]:e}),O||Object(P.a)(f,m,t,e)},showLabel:!1,displayStyle:l})})))},R=e=>{let{displayStyle:t,isLoading:r}=e;return r?Object(c.createElement)(c.Fragment,null,[...Array("list"===t?2:3)].map((e,r)=>Object(c.createElement)("li",{className:"list"===t?"show-loading-state-list":"show-loading-state-chips",key:r},Object(c.createElement)("span",{className:"show-loading-state__inner"})))):null},C=r(138);const T={heading:{type:"string",default:Object(o.__)("Active filters","woo-gutenberg-products-block")}};Object(n.a)({selector:".wp-block-woocommerce-active-filters",Block:e=>{let{attributes:t,isEditor:r=!1}=e;const n=function(){const e=Object(c.useRef)(!1);return Object(c.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),Object(c.useCallback)(()=>e.current,[])}()(),l=Object(a.getSettingWithCoercion)("is_rendering_php_template",!1,b.a),[O,j]=Object(c.useState)(!0),_=(()=>{if(!window)return!1;const e=window.location.href,t=Object(y.getQueryArgs)(e),r=Object.keys(t);let n=!1;for(let e=0;r.length>e;e++){const t=r[e];if(S(t)){n=!0;break}}return n})()&&!r&&O,[w,k]=Object(s.b)("attributes",[]),[x,A]=Object(s.b)("stock_status",[]),[P,C]=Object(s.b)("min_price"),[T,B]=Object(s.b)("max_price"),L=Object(a.getSetting)("stockStatusOptions",[]),F=Object(a.getSetting)("attributes",[]),M=Object(c.useMemo)(()=>{return!_&&0!==x.length&&(e=x,Array.isArray(e)&&e.every(e=>["instock","outofstock","onbackorder"].includes(e)))&&(e=>Object(p.a)(e)&&Object.keys(e).every(e=>["instock","outofstock","onbackorder"].includes(e)))(L)?x.map(e=>E({type:Object(o.__)("Stock Status","woo-gutenberg-products-block"),name:L[e],removeCallback:()=>{if(v({filter_stock_status:e}),!l){const t=x.filter(t=>t!==e);A(t)}},displayStyle:t.displayStyle})):null;var e},[_,L,x,A,t.displayStyle,l]),Q=Object(c.useMemo)(()=>_||!Number.isFinite(P)&&!Number.isFinite(T)?null:E({type:Object(o.__)("Price","woo-gutenberg-products-block"),name:h(P,T),removeCallback:()=>{v("max_price","min_price"),l||(C(void 0),B(void 0))},displayStyle:t.displayStyle}),[_,P,T,t.displayStyle,C,B,l]),G=Object(c.useMemo)(()=>!Object(d.a)(w)&&n||!w.length&&!(e=>{if(!window)return!1;const t=e.map(e=>"filter_"+e.attribute_name),r=window.location.href,n=Object(y.getQueryArgs)(r),c=Object.keys(n);let o=!1;for(let e=0;c.length>e;e++){const r=c[e];if(t.includes(r)){o=!0;break}}return o})(F)?(j(!1),null):w.map(e=>{const r=Object(g.b)(e.attribute);return r?Object(c.createElement)(N,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator,isLoadingCallback:j}):(j(!1),null)}),[n,j,w,t.displayStyle]),[U,Y]=Object(s.b)("ratings");Object(c.useEffect)(()=>{var e;if(!l)return;if(U.length&&U.length>0)return;const t=null===(e=Object(f.d)("rating_filter"))||void 0===e?void 0:e.toString();t&&Y(t.split(","))},[l,U,Y]);const q=Object(c.useMemo)(()=>{return!_&&0!==U.length&&(e=U,Array.isArray(e)&&e.every(e=>["1","2","3","4","5"].includes(e)))?U.map(e=>E({type:Object(o.__)("Rating","woo-gutenberg-products-block"),name:Object(o.sprintf)(
10
  /* translators: %s is referring to the average rating value */
11
+ Object(o.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(l)return v({rating_filter:e});const t=U.filter(t=>t!==e);Y(t)},displayStyle:t.displayStyle})):null;var e},[_,U,Y,t.displayStyle,l]);if(!_&&!(w.length>0||x.length>0||U.length>0||Number.isFinite(P)||Number.isFinite(T))&&!r)return null;const V="h"+t.headingLevel,D=Object(c.createElement)(V,{className:"wc-block-active-filters__title"},t.heading),K=_?Object(c.createElement)(m.a,null,D):D;if(!Object(a.getSettingWithCoercion)("has_filterable_products",!1,b.a))return null;const z=i()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle,"wc-block-active-filters--loading":_});return Object(c.createElement)(c.Fragment,null,!r&&t.heading&&K,Object(c.createElement)("div",{className:"wc-block-active-filters"},Object(c.createElement)("ul",{className:z},r?Object(c.createElement)(c.Fragment,null,E({type:Object(o.__)("Size","woo-gutenberg-products-block"),name:Object(o.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),E({type:Object(o.__)("Color","woo-gutenberg-products-block"),name:Object(o.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(R,{isLoading:_,displayStyle:t.displayStyle}),Q,M,G,q)),_?Object(c.createElement)("span",{className:"wc-block-active-filters__clear-all-placeholder"}):Object(c.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{(()=>{if(!window)return;const e=window.location.href,t=Object(y.getQueryArgs)(e),r=Object(y.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!S(e)).map(e=>[e,t[e]])),c=Object(y.addQueryArgs)(r,n);Object(f.c)(c)})(),l||(C(void 0),B(void 0),k([]),A([]))}},Object(c.createElement)(u.a,{label:Object(o.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Clear All Filters","woo-gutenberg-products-block")}))))},getProps:e=>({attributes:{displayStyle:e.dataset.displayStyle||C.attributes.displayStyle.default,heading:e.dataset.heading||T.heading.default,headingLevel:e.dataset.headingLevel?parseInt(e.dataset.headingLevel,10):C.attributes.headingLevel.default},isEditor:!1})})},259:function(e,t,r){"use strict";var n=r(0),c=r(13);const o=Object(n.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(c.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=o},26:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const c=Object(n.createContext)("page"),o=()=>Object(n.useContext)(c);c.Provider},260:function(e,t,r){"use strict";var n=r(12),c=r.n(n),o=r(0),s=r(4),a=r.n(s),l=r(1),i=r(108),u=r(259);r(205);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:s="",radius:l="small",children:i=null,...u}=e;const b=n,p=a()(s,"wc-block-components-chip","wc-block-components-chip--radius-"+l),d=Boolean(r&&r!==t);return Object(o.createElement)(b,c()({className:p},u),Object(o.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(o.createElement)("span",{className:"screen-reader-text"},r),i)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:s=(()=>{}),removeOnAnyClick:p=!1,text:d,screenReaderText:f="",...m}=e;const g=p?"span":"button";if(!t){const e=f&&"string"==typeof f?f:d;t="string"!=typeof e?
12
  /* translators: Remove chip. */
13
+ Object(l.__)("Remove","woo-gutenberg-products-block"):Object(l.sprintf)(
14
  /* translators: %s text of the chip to remove. */
15
+ Object(l.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const O={"aria-label":t,disabled:n,onClick:s,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||s()}},j=p?O:{},y=p?{"aria-hidden":!0}:O;return Object(o.createElement)(b,c()({},m,j,{className:a()(r,"is-removable"),element:p?"button":m.element,screenReaderText:f,text:d}),Object(o.createElement)(g,c()({className:"wc-block-components-chip__remove"},y),Object(o.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},3:function(e,t){e.exports=window.lodash},31:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),c=r(11),o=r.n(c);function s(e){const t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},35:function(e,t){},39:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return d}));var n=r(6),c=r(7),o=r(0),s=r(11),a=r.n(s),l=r(31),i=r(61),u=r(26);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(c.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:s}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(o.useCallback)(t=>{s(e,t)},[e,s])]},p=(e,t,r)=>{const s=Object(u.a)();r=r||s;const a=Object(c.useSelect)(c=>c(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:l}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{l(r,e,t)},[r,e,l])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,c]=b(t),s=Object(l.a)(n),p=Object(l.a)(e),d=Object(i.a)(p),f=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(d,p)||(c(Object.assign({},s,p)),f.current=!0)},[s,p,d,c]),f.current?[n,c]:[e,c]}},4:function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function c(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var o=typeof n;if("string"===o||"number"===o)e.push(n);else if(Array.isArray(n)){if(n.length){var s=c.apply(null,n);s&&e.push(s)}}else if("object"===o)if(n.toString===Object.prototype.toString)for(var a in n)r.call(n,a)&&n[a]&&e.push(a);else e.push(n.toString())}}return e.join(" ")}e.exports?(c.default=c,e.exports=c):void 0===(n=function(){return c}.apply(t,[]))||(e.exports=n)}()},41:function(e,t){e.exports=window.wc.priceFormat},48:function(e,t,r){"use strict";r.d(t,"n",(function(){return o})),r.d(t,"l",(function(){return s})),r.d(t,"k",(function(){return a})),r.d(t,"m",(function(){return l})),r.d(t,"i",(function(){return i})),r.d(t,"d",(function(){return u})),r.d(t,"f",(function(){return b})),r.d(t,"j",(function(){return p})),r.d(t,"c",(function(){return d})),r.d(t,"e",(function(){return f})),r.d(t,"g",(function(){return m})),r.d(t,"a",(function(){return g})),r.d(t,"h",(function(){return O})),r.d(t,"b",(function(){return j}));var n,c=r(2);const o=Object(c.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),s=o.pluginUrl+"images/",a=o.pluginUrl+"build/",l=o.buildPhase,i=null===(n=c.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=(c.STORE_PAGES.checkout.id,c.STORE_PAGES.checkout.permalink),b=c.STORE_PAGES.privacy.permalink,p=(c.STORE_PAGES.privacy.title,c.STORE_PAGES.terms.permalink),d=(c.STORE_PAGES.terms.title,c.STORE_PAGES.cart.id,c.STORE_PAGES.cart.permalink),f=c.STORE_PAGES.myaccount.permalink?c.STORE_PAGES.myaccount.permalink:Object(c.getSetting)("wpLoginUrl","/wp-login.php"),m=Object(c.getSetting)("shippingCountries",{}),g=Object(c.getSetting)("allowedCountries",{}),O=Object(c.getSetting)("shippingStates",{}),j=Object(c.getSetting)("allowedStates",{})},5:function(e,t){e.exports=window.React},52:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(12),c=r.n(n),o=r(0),s=r(15);const a=[".wp-block-woocommerce-cart"],l=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:a=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const l=n(e,r),i=a(e,r),u={...e.dataset,...l.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:a={},errorBoundaryProps:l={}}=e;Object(o.render)(Object(o.createElement)(s.a,l,Object(o.createElement)(o.Suspense,{fallback:Object(o.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(o.createElement)(t,c()({},a,{attributes:n})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:l,attributes:u,errorBoundaryProps:i})})},i=e=>{const t=document.body.querySelectorAll(a.join(",")),{Block:r,getProps:n,getErrorBoundaryProps:c,selector:o}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:c,wrappers:o}=e;const s=document.body.querySelectorAll(c);o&&o.length>0&&Array.prototype.filter.call(s,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,o)),l({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({Block:r,getProps:n,getErrorBoundaryProps:c,selector:o,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:c,wrapper:o}=e;const s=o.querySelectorAll(c);l({Block:t,containers:s,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},6:function(e,t){e.exports=window.wc.wcBlocksData},61:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(5);function c(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},62:function(e,t,r){"use strict";var n=r(0);r(85),t.a=e=>{let{children:t}=e;return Object(n.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},66:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(6),c=r(7),o=r(0),s=r(31),a=r(75);const l=e=>{const{namespace:t,resourceName:r,resourceValues:l=[],query:i={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(o.useRef)({results:[],isLoading:!0}),p=Object(s.a)(i),d=Object(s.a)(l),f=Object(a.a)(),m=Object(c.useSelect)(e=>{if(!u)return null;const c=e(n.COLLECTIONS_STORE_KEY),o=[t,r,p,d],s=c.getCollectionError(...o);if(s){if(!(s instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");f(s)}return{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,r,d,p,u]);return null!==m&&(b.current=m),b.current}},7:function(e,t){e.exports=window.wp.data},75:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const c=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},80:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},85:function(e,t){}});
build/active-filters.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-price-format', 'wc-settings', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '0f35403917d4c27aaf443f566b9a6e4b');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-price-format', 'wc-settings', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url'), 'version' => '4b2083cfd7451c422a7fc207c4fcc1f7');
build/active-filters.js CHANGED
@@ -1,17 +1,17 @@
1
- this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["active-filters"]=function(e){function t(t){for(var n,l,i=t[0],s=t[1],a=t[2],b=0,p=[];b<i.length;b++)l=i[b],Object.prototype.hasOwnProperty.call(c,l)&&c[l]&&p.push(c[l][0]),c[l]=0;for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n]);for(u&&u(t);p.length;)p.shift()();return o.push.apply(o,a||[]),r()}function r(){for(var e,t=0;t<o.length;t++){for(var r=o[t],n=!0,i=1;i<r.length;i++){var s=r[i];0!==c[s]&&(n=!1)}n&&(o.splice(t--,1),e=l(l.s=r[0]))}return e}var n={},c={5:0},o=[];function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.m=e,l.c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var a=0;a<i.length;a++)t(i[a]);var u=s;return o.push([403,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.compose},109:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(12);function c(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},11:function(e,t){e.exports=window.wp.primitives},12:function(e,t){e.exports=window.React},120:function(e,t,r){"use strict";var n=r(0),c=r(5),o=r(10),l=r(1);r(160),t.a=Object(o.withInstanceId)(e=>{let{className:t,headingLevel:r,onChange:o,heading:i,instanceId:s}=e;const a="h"+r;return Object(n.createElement)(a,{className:t},Object(n.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+s},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(n.createElement)(c.PlainText,{id:"block-title-"+s,className:"wc-block-editor-components-title",value:i,onChange:o}))})},124:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const c=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},125:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(17),c=r(9),o=r(0),l=r(49),i=r(124);const s=e=>{const{namespace:t,resourceName:r,resourceValues:s=[],query:a={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(o.useRef)({results:[],isLoading:!0}),p=Object(l.a)(a),d=Object(l.a)(s),m=Object(i.a)(),f=Object(c.useSelect)(e=>{if(!u)return null;const c=e(n.COLLECTIONS_STORE_KEY),o=[t,r,p,d],l=c.getCollectionError(...o);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(l)}return{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,r,d,p,u]);return null!==f&&(b.current=f),b.current}},14:function(e,t){e.exports=window.wp.htmlEntities},15:function(e,t){e.exports=window.wp.url},150:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},160:function(e,t){},17:function(e,t){e.exports=window.wc.wcBlocksData},173:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(7);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===r.taxonomy),l=o.length?o[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(c)))return;const i=l.slug.filter(e=>e!==c),s=e.filter(e=>e.attribute!==r.taxonomy);i.length>0&&(l.slug=i.sort(),s.push(l)),t(Object(n.sortBy)(s,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!r||!r.taxonomy)return[];const l=e.filter(e=>e.attribute!==r.taxonomy);return 0===c.length?t(l):(l.push({attribute:r.taxonomy,operator:o,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(l,"attribute"))),l}},188:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},207:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return l}));var n=r(2);const c=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;var n;return r&&r.id&&e.push(r),e},[]),o=e=>{if(e)return c.find(t=>t.id===e)},l=e=>{if(e)return c.find(t=>t.taxonomy===e)}},22:function(e,t){e.exports=window.wp.isShallowEqual},236:function(e,t,r){"use strict";var n=r(6),c=r.n(n),o=r(0),l=r(4),i=r.n(l),s=r(1),a=r(113),u=r(530);r(188);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:l="",radius:s="small",children:a=null,...u}=e;const b=n,p=i()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+s),d=Boolean(r&&r!==t);return Object(o.createElement)(b,c()({className:p},u),Object(o.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(o.createElement)("span",{className:"screen-reader-text"},r),a)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:l=(()=>{}),removeOnAnyClick:p=!1,text:d,screenReaderText:m="",...f}=e;const g=p?"span":"button";if(!t){const e=m&&"string"==typeof m?m:d;t="string"!=typeof e?
2
  /* translators: Remove chip. */
3
- Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
4
  /* translators: %s text of the chip to remove. */
5
- Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const O={"aria-label":t,disabled:n,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},j=p?O:{},h=p?{"aria-hidden":!0}:O;return Object(o.createElement)(b,c()({},f,j,{className:i()(r,"is-removable"),element:p?"button":f.element,screenReaderText:m,text:d}),Object(o.createElement)(g,c()({className:"wc-block-components-chip__remove"},h),Object(o.createElement)(a.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},249:function(e,t,r){"use strict";r.d(t,"b",(function(){return i})),r.d(t,"a",(function(){return s})),r.d(t,"d",(function(){return a})),r.d(t,"c",(function(){return u}));var n=r(15),c=r(2),o=r(150);const l=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),i="query_type_",s="filter_";function a(e){return window?Object(n.getQueryArg)(window.location.href,e):null}function u(e){l?window.location.href=e:window.history.replaceState({},"",e)}},26:function(e,t){e.exports=window.wc.priceFormat},28:function(e,t,r){"use strict";var n=r(0),c=r(4),o=r.n(c);t.a=e=>{let t,{label:r,screenReaderLabel:c,wrapperElement:l,wrapperProps:i={}}=e;const s=null!=r,a=null!=c;return!s&&a?(t=l||"span",i={...i,className:o()(i.className,"screen-reader-text")},Object(n.createElement)(t,i,c)):(t=l||n.Fragment,s&&a&&r!==c?Object(n.createElement)(t,i,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},c)):Object(n.createElement)(t,i,r))}},282:function(e){e.exports=JSON.parse('{"name":"woocommerce/active-filters","version":"1.0.0","title":"Active Product Filters","description":"Show the currently active product filters. Works in combination with the All Products and filters blocks.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"color":{"text":true,"background":false}},"attributes":{"displayStyle":{"type":"string","default":"list"},"headingLevel":{"type":"number","default":3}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},3:function(e,t){e.exports=window.wp.components},35:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return n(e)&&t in e}},396:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return i}));var n=r(35);const c=e=>Object(n.b)(e,"count")&&Object(n.b)(e,"description")&&Object(n.b)(e,"id")&&Object(n.b)(e,"name")&&Object(n.b)(e,"parent")&&Object(n.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,o=e=>Array.isArray(e)&&e.every(c),l=e=>Object(n.b)(e,"attribute")&&Object(n.b)(e,"operator")&&Object(n.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),i=e=>Array.isArray(e)&&e.every(l)},403:function(e,t,r){e.exports=r(464)},404:function(e,t){},405:function(e,t){},464:function(e,t,r){"use strict";r.r(t);var n=r(6),c=r.n(n),o=r(0),l=r(1),i=r(8),s=r(11),a=Object(o.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(o.createElement)("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zm0-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"})),u=r(113),b=r(4),p=r.n(b),d=r(5),m=r(99),f=r(120),g=r(3),O=r(75),j=r(2),h=r(28),v=r(150),w=r(35),y=r(396),_=r(249),k=(r(405),r(207)),E=r(26),x=r(236),S=r(15);const C=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(l.sprintf)(
6
  /* translators: %1$s min price, %2$s max price */
7
- Object(l.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(E.formatPrice)(e),Object(E.formatPrice)(t)):Number.isFinite(e)?Object(l.sprintf)(
8
  /* translators: %s min price */
9
- Object(l.__)("From %s","woo-gutenberg-products-block"),Object(E.formatPrice)(e)):Object(l.sprintf)(
10
  /* translators: %s max price */
11
- Object(l.__)("Up to %s","woo-gutenberg-products-block"),Object(E.formatPrice)(t)),N=e=>{let{type:t,name:r,prefix:n="",removeCallback:c=(()=>null),showLabel:i=!0,displayStyle:s}=e;const a=n?Object(o.createElement)(o.Fragment,null,n," ",r):r,u=Object(l.sprintf)(
12
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
13
- Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(o.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},i&&Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===s?Object(o.createElement)(x.a,{element:"span",text:a,onRemove:c,radius:"large",ariaLabel:u}):Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-name"},Object(o.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:c},Object(o.createElement)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Object(o.createElement)("ellipse",{cx:"8",cy:"8",rx:"8",ry:"8",transform:"rotate(-180 8 8)",fill:"currentColor",fillOpacity:"0.7"}),Object(o.createElement)("rect",{x:"10.636",y:"3.94983",width:"2",height:"9.9466",transform:"rotate(45 10.636 3.94983)",fill:"white"}),Object(o.createElement)("rect",{x:"12.0503",y:"11.0209",width:"2",height:"9.9466",transform:"rotate(135 12.0503 11.0209)",fill:"white"})),Object(o.createElement)(h.a,{screenReaderLabel:u})),a))},A=function(){if(!window)return;const e=window.location.href,t=Object(S.getQueryArgs)(e),r=Object(S.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,c=new Array(n),o=0;o<n;o++)c[o]=arguments[o];c.forEach(e=>{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].toString().split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const l=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t})),i=Object(S.addQueryArgs)(r,l);Object(_.c)(i)};var L=r(125),R=r(14),T=r(173),H=e=>{let{attributeObject:t,slugs:r=[],operator:n="in",displayStyle:c}=e;const{results:i,isLoading:s}=Object(L.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[a,u]=Object(O.b)("attributes",[]);if(s||!Array.isArray(i)||!Object(y.b)(i)||!Object(y.a)(a))return null;const b=t.label,p=Object(j.getSettingWithCoercion)("is_rendering_php_template",!1,v.a);return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},b,":"),Object(o.createElement)("ul",null,r.map((e,r)=>{const s=i.find(t=>t.slug===e);if(!s)return null;let d="";return r>0&&"and"===n&&(d=Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(l.__)("and","woo-gutenberg-products-block"))),N({type:b,name:Object(R.decodeEntities)(s.name||e),prefix:d,removeCallback:()=>{const r=a.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name});1===(null==r?void 0:r.slug.length)?A("query_type_"+t.name,"filter_"+t.name):A({["filter_"+t.name]:e}),p||Object(T.a)(a,u,t,e)},showLabel:!1,displayStyle:c})})))},V=e=>{let{attributes:t,isEditor:r=!1}=e;const n=Object(j.getSettingWithCoercion)("is_rendering_php_template",!1,v.a),[c,i]=Object(O.b)("attributes",[]),[s,a]=Object(O.b)("stock_status",[]),[u,b]=Object(O.b)("min_price"),[d,m]=Object(O.b)("max_price"),f=Object(j.getSetting)("stockStatusOptions",[]),g=Object(o.useMemo)(()=>{return 0!==s.length&&(e=s,Array.isArray(e)&&e.every(e=>["instock","outofstock","onbackorder"].includes(e)))&&(e=>Object(w.a)(e)&&Object.keys(e).every(e=>["instock","outofstock","onbackorder"].includes(e)))(f)?s.map(e=>N({type:Object(l.__)("Stock Status","woo-gutenberg-products-block"),name:f[e],removeCallback:()=>{if(A({filter_stock_status:e}),!n){const t=s.filter(t=>t!==e);a(t)}},displayStyle:t.displayStyle})):null;var e},[f,s,a,t.displayStyle,n]),E=Object(o.useMemo)(()=>Number.isFinite(u)||Number.isFinite(d)?N({type:Object(l.__)("Price","woo-gutenberg-products-block"),name:C(u,d),removeCallback:()=>{A("max_price","min_price"),n||(b(void 0),m(void 0))},displayStyle:t.displayStyle}):null,[u,d,t.displayStyle,b,m,n]),x=Object(o.useMemo)(()=>Object(y.a)(c)?c.map(e=>{const r=Object(k.b)(e.attribute);return r?Object(o.createElement)(H,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator}):null}):null,[c,t.displayStyle]),[L,R]=Object(O.b)("ratings");Object(o.useEffect)(()=>{var e;if(!n)return;if(L.length&&L.length>0)return;const t=null===(e=Object(_.d)("rating_filter"))||void 0===e?void 0:e.toString();t&&R(t.split(","))},[n,L,R]);const T=Object(o.useMemo)(()=>{return 0!==L.length&&(e=L,Array.isArray(e)&&e.every(e=>["1","2","3","4","5"].includes(e)))?L.map(e=>N({type:Object(l.__)("Rating","woo-gutenberg-products-block"),name:Object(l.sprintf)(
14
  /* translators: %s is referring to the average rating value */
15
- Object(l.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(n)return A({rating_filter:e});const t=L.filter(t=>t!==e);R(t)},displayStyle:t.displayStyle})):null;var e},[L,R,t.displayStyle,n]);if(!(c.length>0||s.length>0||L.length>0||Number.isFinite(u)||Number.isFinite(d)||r))return null;const V="h"+t.headingLevel;if(!Object(j.getSettingWithCoercion)("has_filterable_products",!1,v.a))return null;const P=p()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle});return Object(o.createElement)(o.Fragment,null,!r&&t.heading&&Object(o.createElement)(V,{className:"wc-block-active-filters__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-active-filters"},Object(o.createElement)("ul",{className:P},r?Object(o.createElement)(o.Fragment,null,N({type:Object(l.__)("Size","woo-gutenberg-products-block"),name:Object(l.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),N({type:Object(l.__)("Color","woo-gutenberg-products-block"),name:Object(l.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(o.createElement)(o.Fragment,null,E,g,x,T)),Object(o.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{(()=>{if(!window)return;const e=window.location.href,t=Object(S.getQueryArgs)(e),r=Object(S.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!(e.includes("min_price")||e.includes("max_price")||e.includes("rating_filter")||e.includes("filter_")||e.includes("query_type_"))).map(e=>[e,t[e]])),c=Object(S.addQueryArgs)(r,n);Object(_.c)(c)})(),n||(b(void 0),m(void 0),i([]),a([]))}},Object(o.createElement)(h.a,{label:Object(l.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(l.__)("Clear All Filters","woo-gutenberg-products-block")}))))};r(404);var P=Object(g.withSpokenMessages)(e=>{let{attributes:t,setAttributes:r}=e;const{className:n,displayStyle:c,heading:i,headingLevel:s}=t,a=Object(d.useBlockProps)({className:n});return Object(o.createElement)("div",a,Object(o.createElement)(d.InspectorControls,{key:"inspector"},Object(o.createElement)(g.PanelBody,{title:Object(l.__)("Display Settings","woo-gutenberg-products-block")},Object(o.createElement)(g.__experimentalToggleGroupControl,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:c,onChange:e=>r({displayStyle:e}),className:"wc-block-active-filter__style-toggle"},Object(o.createElement)(g.__experimentalToggleGroupControlOption,{value:"list",label:Object(l.__)("List","woo-gutenberg-products-block")}),Object(o.createElement)(g.__experimentalToggleGroupControlOption,{value:"chips",label:Object(l.__)("Chips","woo-gutenberg-products-block")})),Object(o.createElement)("p",null,Object(l.__)("Heading Level","woo-gutenberg-products-block")),Object(o.createElement)(m.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:s,onChange:e=>r({headingLevel:e})}))),Object(o.createElement)(f.a,{className:"wc-block-active-filters__title",headingLevel:s,heading:i,onChange:e=>r({heading:e})}),Object(o.createElement)(g.Disabled,null,Object(o.createElement)(V,{attributes:t,isEditor:!0})))}),F=r(282);const z={heading:{type:"string",default:Object(l.__)("Active filters","woo-gutenberg-products-block")}};Object(i.registerBlockType)(F,{title:Object(l.__)("Active Product Filters","woo-gutenberg-products-block"),description:Object(l.__)("Show the currently active product filters. Works in combination with the All Products and filters blocks.","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(u.a,{icon:a,className:"wc-block-editor-components-block-icon"})},attributes:{...F.attributes,...z},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:r}=e;return"woocommerce_layered_nav_filters"===t&&!(null==r||!r.raw)},transform:e=>{var t;let{instance:r}=e;return Object(i.createBlock)("woocommerce/active-filters",{displayStyle:"list",heading:(null==r||null===(t=r.raw)||void 0===t?void 0:t.title)||Object(l.__)("Active filters","woo-gutenberg-products-block"),headingLevel:3})}}]},edit:P,save(e){let{attributes:t}=e;const{className:r,displayStyle:n,heading:l,headingLevel:i}=t,s={"data-display-style":n,"data-heading":l,"data-heading-level":i};return Object(o.createElement)("div",c()({},d.useBlockProps.save({className:p()("is-loading",r)}),s),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-active-product-filters__placeholder"}))}})},49:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(0),c=r(22),o=r.n(c);function l(e){const t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},5:function(e,t){e.exports=window.wp.blockEditor},52:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const c=Object(n.createContext)("page"),o=()=>Object(n.useContext)(c);c.Provider},7:function(e,t){e.exports=window.lodash},75:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return d}));var n=r(17),c=r(9),o=r(0),l=r(22),i=r.n(l),s=r(49),a=r(109),u=r(52);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(c.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(o.useCallback)(t=>{l(e,t)},[e,l])]},p=(e,t,r)=>{const l=Object(u.a)();r=r||l;const i=Object(c.useSelect)(c=>c(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:s}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[i,Object(o.useCallback)(t=>{s(r,e,t)},[r,e,s])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,c]=b(t),l=Object(s.a)(n),p=Object(s.a)(e),d=Object(a.a)(p),m=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{i()(d,p)||(c(Object.assign({},l,p)),m.current=!0)},[l,p,d,c]),m.current?[n,c]:[e,c]}},8:function(e,t){e.exports=window.wp.blocks},9:function(e,t){e.exports=window.wp.data},99:function(e,t,r){"use strict";var n=r(0),c=r(7),o=r(1),l=r(3),i=r(11);function s(e){let{level:t}=e;const r={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return r.hasOwnProperty(t)?Object(n.createElement)(i.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)(i.Path,{d:r[t]})):null}class a extends n.Component{createLevelControl(e,t,r){const c=e===t;return{icon:Object(n.createElement)(s,{level:e}),title:Object(o.sprintf)(
16
  /* translators: %s: heading level e.g: "2", "3", "4" */
17
- Object(o.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:c,onClick:()=>r(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:r,selectedLevel:o,onChange:i}=this.props;return Object(n.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(n.createElement)(s,{level:o}),controls:Object(c.range)(t,r).map(e=>this.createLevelControl(e,o,i))})}}t.a=a}});
1
+ this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["active-filters"]=function(e){function t(t){for(var n,l,a=t[0],i=t[1],s=t[2],b=0,p=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(c,l)&&c[l]&&p.push(c[l][0]),c[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(u&&u(t);p.length;)p.shift()();return o.push.apply(o,s||[]),r()}function r(){for(var e,t=0;t<o.length;t++){for(var r=o[t],n=!0,a=1;a<r.length;a++){var i=r[a];0!==c[i]&&(n=!1)}n&&(o.splice(t--,1),e=l(l.s=r[0]))}return e}var n={},c={5:0},o=[];function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.m=e,l.c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=a.push.bind(a);a.push=t,a=a.slice();for(var s=0;s<a.length;s++)t(a[s]);var u=i;return o.push([405,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.compose},109:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(12);function c(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},11:function(e,t){e.exports=window.wp.primitives},12:function(e,t){e.exports=window.React},120:function(e,t,r){"use strict";var n=r(0),c=r(5),o=r(10),l=r(1);r(161),t.a=Object(o.withInstanceId)(e=>{let{className:t,headingLevel:r,onChange:o,heading:a,instanceId:i}=e;const s="h"+r;return Object(n.createElement)(s,{className:t},Object(n.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+i},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(n.createElement)(c.PlainText,{id:"block-title-"+i,className:"wc-block-editor-components-title",value:a,onChange:o}))})},121:function(e,t,r){"use strict";var n=r(0);r(162),t.a=e=>{let{children:t}=e;return Object(n.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},125:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const c=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},126:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(17),c=r(9),o=r(0),l=r(49),a=r(125);const i=e=>{const{namespace:t,resourceName:r,resourceValues:i=[],query:s={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(o.useRef)({results:[],isLoading:!0}),p=Object(l.a)(s),d=Object(l.a)(i),m=Object(a.a)(),f=Object(c.useSelect)(e=>{if(!u)return null;const c=e(n.COLLECTIONS_STORE_KEY),o=[t,r,p,d],l=c.getCollectionError(...o);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(l)}return{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,r,d,p,u]);return null!==f&&(b.current=f),b.current}},136:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},14:function(e,t){e.exports=window.wp.htmlEntities},15:function(e,t){e.exports=window.wp.url},161:function(e,t){},162:function(e,t){},17:function(e,t){e.exports=window.wc.wcBlocksData},175:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return o}));var n=r(7);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===r.taxonomy),l=o.length?o[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(c)))return;const a=l.slug.filter(e=>e!==c),i=e.filter(e=>e.attribute!==r.taxonomy);a.length>0&&(l.slug=a.sort(),i.push(l)),t(Object(n.sortBy)(i,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!r||!r.taxonomy)return[];const l=e.filter(e=>e.attribute!==r.taxonomy);return 0===c.length?t(l):(l.push({attribute:r.taxonomy,operator:o,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(n.sortBy)(l,"attribute"))),l}},190:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},209:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return l}));var n=r(2);const c=Object(n.getSetting)("attributes",[]).reduce((e,t)=>{const r=(n=t)&&n.attribute_name?{id:parseInt(n.attribute_id,10),name:n.attribute_name,taxonomy:"pa_"+n.attribute_name,label:n.attribute_label}:null;var n;return r&&r.id&&e.push(r),e},[]),o=e=>{if(e)return c.find(t=>t.id===e)},l=e=>{if(e)return c.find(t=>t.taxonomy===e)}},22:function(e,t){e.exports=window.wp.isShallowEqual},238:function(e,t,r){"use strict";var n=r(6),c=r.n(n),o=r(0),l=r(4),a=r.n(l),i=r(1),s=r(113),u=r(532);r(190);var b=e=>{let{text:t,screenReaderText:r="",element:n="li",className:l="",radius:i="small",children:s=null,...u}=e;const b=n,p=a()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+i),d=Boolean(r&&r!==t);return Object(o.createElement)(b,c()({className:p},u),Object(o.createElement)("span",{"aria-hidden":d,className:"wc-block-components-chip__text"},t),d&&Object(o.createElement)("span",{className:"screen-reader-text"},r),s)};t.a=e=>{let{ariaLabel:t="",className:r="",disabled:n=!1,onRemove:l=(()=>{}),removeOnAnyClick:p=!1,text:d,screenReaderText:m="",...f}=e;const g=p?"span":"button";if(!t){const e=m&&"string"==typeof m?m:d;t="string"!=typeof e?
2
  /* translators: Remove chip. */
3
+ Object(i.__)("Remove","woo-gutenberg-products-block"):Object(i.sprintf)(
4
  /* translators: %s text of the chip to remove. */
5
+ Object(i.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const O={"aria-label":t,disabled:n,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},j=p?O:{},v=p?{"aria-hidden":!0}:O;return Object(o.createElement)(b,c()({},f,j,{className:a()(r,"is-removable"),element:p?"button":f.element,screenReaderText:m,text:d}),Object(o.createElement)(g,c()({className:"wc-block-components-chip__remove"},v),Object(o.createElement)(s.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},251:function(e,t,r){"use strict";r.d(t,"b",(function(){return a})),r.d(t,"a",(function(){return i})),r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return u}));var n=r(15),c=r(2),o=r(136);const l=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),a="query_type_",i="filter_";function s(e){return window?Object(n.getQueryArg)(window.location.href,e):null}function u(e){l?window.location.href=e:window.history.replaceState({},"",e)}},26:function(e,t){e.exports=window.wc.priceFormat},28:function(e,t,r){"use strict";var n=r(0),c=r(4),o=r.n(c);t.a=e=>{let t,{label:r,screenReaderLabel:c,wrapperElement:l,wrapperProps:a={}}=e;const i=null!=r,s=null!=c;return!i&&s?(t=l||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(n.createElement)(t,a,c)):(t=l||n.Fragment,i&&s&&r!==c?Object(n.createElement)(t,a,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},c)):Object(n.createElement)(t,a,r))}},284:function(e){e.exports=JSON.parse('{"name":"woocommerce/active-filters","version":"1.0.0","title":"Active Product Filters","description":"Display the currently active product filters.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"color":{"text":true,"background":false}},"attributes":{"displayStyle":{"type":"string","default":"list"},"headingLevel":{"type":"number","default":3}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},3:function(e,t){e.exports=window.wp.components},35:function(e,t,r){"use strict";r.d(t,"a",(function(){return n})),r.d(t,"b",(function(){return c}));const n=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return n(e)&&t in e}},398:function(e,t,r){"use strict";r.d(t,"b",(function(){return o})),r.d(t,"a",(function(){return a}));var n=r(35);const c=e=>Object(n.b)(e,"count")&&Object(n.b)(e,"description")&&Object(n.b)(e,"id")&&Object(n.b)(e,"name")&&Object(n.b)(e,"parent")&&Object(n.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,o=e=>Array.isArray(e)&&e.every(c),l=e=>Object(n.b)(e,"attribute")&&Object(n.b)(e,"operator")&&Object(n.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),a=e=>Array.isArray(e)&&e.every(l)},405:function(e,t,r){e.exports=r(464)},406:function(e,t){},407:function(e,t){},464:function(e,t,r){"use strict";r.r(t);var n=r(6),c=r.n(n),o=r(0),l=r(1),a=r(8),i=r(11),s=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(o.createElement)("path",{fill:"none",d:"M0 0h24v24H0z"}),Object(o.createElement)("path",{d:"M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6zm0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4zm0-7c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"})),u=r(113),b=r(4),p=r.n(b),d=r(5),m=r(99),f=r(120),g=r(3),O=r(75),j=r(2),v=r(28),y=r(136),h=r(35),w=r(398),_=r(251),k=r(121);r(407);var E=r(209),S=r(26),x=r(238),C=r(15),N=r(532);const A=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(l.sprintf)(
6
  /* translators: %1$s min price, %2$s max price */
7
+ Object(l.__)("Between %1$s and %2$s","woo-gutenberg-products-block"),Object(S.formatPrice)(e),Object(S.formatPrice)(t)):Number.isFinite(e)?Object(l.sprintf)(
8
  /* translators: %s min price */
9
+ Object(l.__)("From %s","woo-gutenberg-products-block"),Object(S.formatPrice)(e)):Object(l.sprintf)(
10
  /* translators: %s max price */
11
+ Object(l.__)("Up to %s","woo-gutenberg-products-block"),Object(S.formatPrice)(t)),L=e=>{let{type:t,name:r,prefix:n="",removeCallback:c=(()=>null),showLabel:a=!0,displayStyle:i}=e;const s=n?Object(o.createElement)(o.Fragment,null,n," ",r):r,b=Object(l.sprintf)(
12
  /* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
13
+ Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),r);return Object(o.createElement)("li",{className:"wc-block-active-filters__list-item",key:t+":"+r},a&&Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},t+": "),"chips"===i?Object(o.createElement)(x.a,{element:"span",text:s,onRemove:c,radius:"large",ariaLabel:b}):Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-name"},Object(o.createElement)("button",{className:"wc-block-active-filters__list-item-remove",onClick:c},Object(o.createElement)(u.a,{className:"wc-block-components-chip__remove-icon",icon:N.a,size:16}),Object(o.createElement)(v.a,{screenReaderLabel:b})),s))},R=function(){if(!window)return;const e=window.location.href,t=Object(C.getQueryArgs)(e),r=Object(C.removeQueryArgs)(e,...Object.keys(t));for(var n=arguments.length,c=new Array(n),o=0;o<n;o++)c[o]=arguments[o];c.forEach(e=>{if("string"==typeof e)return delete t[e];if("object"==typeof e){const r=Object.keys(e)[0],n=t[r].toString().split(",");t[r]=n.filter(t=>t!==e[r]).join(",")}});const l=Object.fromEntries(Object.entries(t).filter(e=>{let[,t]=e;return t})),a=Object(C.addQueryArgs)(r,l);Object(_.c)(a)},T=["min_price","max_price","rating_filter","filter_","query_type_"],H=e=>{let t=!1;for(let r=0;T.length>r;r++){const n=T[r];if(n===e.substring(0,n.length)){t=!0;break}}return t};var V=r(126),F=r(14),P=r(175),z=e=>{let{attributeObject:t,slugs:r=[],operator:n="in",displayStyle:c,isLoadingCallback:a}=e;const{results:i,isLoading:s}=Object(V.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[t.id]}),[u,b]=Object(O.b)("attributes",[]);if(Object(o.useEffect)(()=>{a(s)},[s,a]),!Array.isArray(i)||!Object(w.b)(i)||!Object(w.a)(u))return null;const p=t.label,d=Object(j.getSettingWithCoercion)("is_rendering_php_template",!1,y.a);return Object(o.createElement)("li",null,Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-type"},p,":"),Object(o.createElement)("ul",null,r.map((e,r)=>{const a=i.find(t=>t.slug===e);if(!a)return null;let m="";return r>0&&"and"===n&&(m=Object(o.createElement)("span",{className:"wc-block-active-filters__list-item-operator"},Object(l.__)("All","woo-gutenberg-products-block"))),L({type:p,name:Object(F.decodeEntities)(a.name||e),prefix:m,isLoading:s,removeCallback:()=>{const r=u.find(e=>{let{attribute:r}=e;return r==="pa_"+t.name});1===(null==r?void 0:r.slug.length)?R("query_type_"+t.name,"filter_"+t.name):R({["filter_"+t.name]:e}),d||Object(P.a)(u,b,t,e)},showLabel:!1,displayStyle:c})})))},M=e=>{let{displayStyle:t,isLoading:r}=e;return r?Object(o.createElement)(o.Fragment,null,[...Array("list"===t?2:3)].map((e,r)=>Object(o.createElement)("li",{className:"list"===t?"show-loading-state-list":"show-loading-state-chips",key:r},Object(o.createElement)("span",{className:"show-loading-state__inner"})))):null},B=e=>{let{attributes:t,isEditor:r=!1}=e;const n=function(){const e=Object(o.useRef)(!1);return Object(o.useEffect)(()=>(e.current=!0,()=>{e.current=!1}),[]),Object(o.useCallback)(()=>e.current,[])}()(),c=Object(j.getSettingWithCoercion)("is_rendering_php_template",!1,y.a),[a,i]=Object(o.useState)(!0),s=(()=>{if(!window)return!1;const e=window.location.href,t=Object(C.getQueryArgs)(e),r=Object.keys(t);let n=!1;for(let e=0;r.length>e;e++){const t=r[e];if(H(t)){n=!0;break}}return n})()&&!r&&a,[u,b]=Object(O.b)("attributes",[]),[d,m]=Object(O.b)("stock_status",[]),[f,g]=Object(O.b)("min_price"),[S,x]=Object(O.b)("max_price"),N=Object(j.getSetting)("stockStatusOptions",[]),T=Object(j.getSetting)("attributes",[]),V=Object(o.useMemo)(()=>{return!s&&0!==d.length&&(e=d,Array.isArray(e)&&e.every(e=>["instock","outofstock","onbackorder"].includes(e)))&&(e=>Object(h.a)(e)&&Object.keys(e).every(e=>["instock","outofstock","onbackorder"].includes(e)))(N)?d.map(e=>L({type:Object(l.__)("Stock Status","woo-gutenberg-products-block"),name:N[e],removeCallback:()=>{if(R({filter_stock_status:e}),!c){const t=d.filter(t=>t!==e);m(t)}},displayStyle:t.displayStyle})):null;var e},[s,N,d,m,t.displayStyle,c]),F=Object(o.useMemo)(()=>s||!Number.isFinite(f)&&!Number.isFinite(S)?null:L({type:Object(l.__)("Price","woo-gutenberg-products-block"),name:A(f,S),removeCallback:()=>{R("max_price","min_price"),c||(g(void 0),x(void 0))},displayStyle:t.displayStyle}),[s,f,S,t.displayStyle,g,x,c]),P=Object(o.useMemo)(()=>!Object(w.a)(u)&&n||!u.length&&!(e=>{if(!window)return!1;const t=e.map(e=>"filter_"+e.attribute_name),r=window.location.href,n=Object(C.getQueryArgs)(r),c=Object.keys(n);let o=!1;for(let e=0;c.length>e;e++){const r=c[e];if(t.includes(r)){o=!0;break}}return o})(T)?(i(!1),null):u.map(e=>{const r=Object(E.b)(e.attribute);return r?Object(o.createElement)(z,{attributeObject:r,displayStyle:t.displayStyle,slugs:e.slug,key:e.attribute,operator:e.operator,isLoadingCallback:i}):(i(!1),null)}),[n,i,u,t.displayStyle]),[B,Q]=Object(O.b)("ratings");Object(o.useEffect)(()=>{var e;if(!c)return;if(B.length&&B.length>0)return;const t=null===(e=Object(_.d)("rating_filter"))||void 0===e?void 0:e.toString();t&&Q(t.split(","))},[c,B,Q]);const D=Object(o.useMemo)(()=>{return!s&&0!==B.length&&(e=B,Array.isArray(e)&&e.every(e=>["1","2","3","4","5"].includes(e)))?B.map(e=>L({type:Object(l.__)("Rating","woo-gutenberg-products-block"),name:Object(l.sprintf)(
14
  /* translators: %s is referring to the average rating value */
15
+ Object(l.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(c)return R({rating_filter:e});const t=B.filter(t=>t!==e);Q(t)},displayStyle:t.displayStyle})):null;var e},[s,B,Q,t.displayStyle,c]);if(!s&&!(u.length>0||d.length>0||B.length>0||Number.isFinite(f)||Number.isFinite(S))&&!r)return null;const Y="h"+t.headingLevel,G=Object(o.createElement)(Y,{className:"wc-block-active-filters__title"},t.heading),K=s?Object(o.createElement)(k.a,null,G):G;if(!Object(j.getSettingWithCoercion)("has_filterable_products",!1,y.a))return null;const W=p()("wc-block-active-filters__list",{"wc-block-active-filters__list--chips":"chips"===t.displayStyle,"wc-block-active-filters--loading":s});return Object(o.createElement)(o.Fragment,null,!r&&t.heading&&K,Object(o.createElement)("div",{className:"wc-block-active-filters"},Object(o.createElement)("ul",{className:W},r?Object(o.createElement)(o.Fragment,null,L({type:Object(l.__)("Size","woo-gutenberg-products-block"),name:Object(l.__)("Small","woo-gutenberg-products-block"),displayStyle:t.displayStyle}),L({type:Object(l.__)("Color","woo-gutenberg-products-block"),name:Object(l.__)("Blue","woo-gutenberg-products-block"),displayStyle:t.displayStyle})):Object(o.createElement)(o.Fragment,null,Object(o.createElement)(M,{isLoading:s,displayStyle:t.displayStyle}),F,V,P,D)),s?Object(o.createElement)("span",{className:"wc-block-active-filters__clear-all-placeholder"}):Object(o.createElement)("button",{className:"wc-block-active-filters__clear-all",onClick:()=>{(()=>{if(!window)return;const e=window.location.href,t=Object(C.getQueryArgs)(e),r=Object(C.removeQueryArgs)(e,...Object.keys(t)),n=Object.fromEntries(Object.keys(t).filter(e=>!H(e)).map(e=>[e,t[e]])),c=Object(C.addQueryArgs)(r,n);Object(_.c)(c)})(),c||(g(void 0),x(void 0),b([]),m([]))}},Object(o.createElement)(v.a,{label:Object(l.__)("Clear All","woo-gutenberg-products-block"),screenReaderLabel:Object(l.__)("Clear All Filters","woo-gutenberg-products-block")}))))};r(406);var Q=Object(g.withSpokenMessages)(e=>{let{attributes:t,setAttributes:r}=e;const{className:n,displayStyle:c,heading:a,headingLevel:i}=t,s=Object(d.useBlockProps)({className:n});return Object(o.createElement)("div",s,Object(o.createElement)(d.InspectorControls,{key:"inspector"},Object(o.createElement)(g.PanelBody,{title:Object(l.__)("Display Settings","woo-gutenberg-products-block")},Object(o.createElement)(g.__experimentalToggleGroupControl,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:c,onChange:e=>r({displayStyle:e}),className:"wc-block-active-filter__style-toggle"},Object(o.createElement)(g.__experimentalToggleGroupControlOption,{value:"list",label:Object(l.__)("List","woo-gutenberg-products-block")}),Object(o.createElement)(g.__experimentalToggleGroupControlOption,{value:"chips",label:Object(l.__)("Chips","woo-gutenberg-products-block")})),Object(o.createElement)("p",null,Object(l.__)("Heading Level","woo-gutenberg-products-block")),Object(o.createElement)(m.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:i,onChange:e=>r({headingLevel:e})}))),Object(o.createElement)(f.a,{className:"wc-block-active-filters__title",headingLevel:i,heading:a,onChange:e=>r({heading:e})}),Object(o.createElement)(g.Disabled,null,Object(o.createElement)(B,{attributes:t,isEditor:!0})))}),D=r(284);const Y={heading:{type:"string",default:Object(l.__)("Active filters","woo-gutenberg-products-block")}};Object(a.registerBlockType)(D,{title:Object(l.__)("Active Product Filters","woo-gutenberg-products-block"),description:Object(l.__)("Display the currently active product filters.","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(u.a,{icon:s,className:"wc-block-editor-components-block-icon"})},attributes:{...D.attributes,...Y},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:r}=e;return"woocommerce_layered_nav_filters"===t&&!(null==r||!r.raw)},transform:e=>{var t;let{instance:r}=e;return Object(a.createBlock)("woocommerce/active-filters",{displayStyle:"list",heading:(null==r||null===(t=r.raw)||void 0===t?void 0:t.title)||Object(l.__)("Active filters","woo-gutenberg-products-block"),headingLevel:3})}}]},edit:Q,save(e){let{attributes:t}=e;const{className:r,displayStyle:n,heading:l,headingLevel:a}=t,i={"data-display-style":n,"data-heading":l,"data-heading-level":a};return Object(o.createElement)("div",c()({},d.useBlockProps.save({className:p()("is-loading",r)}),i),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-active-product-filters__placeholder"}))}})},49:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(0),c=r(22),o=r.n(c);function l(e){const t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},5:function(e,t){e.exports=window.wp.blockEditor},52:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const c=Object(n.createContext)("page"),o=()=>Object(n.useContext)(c);c.Provider},7:function(e,t){e.exports=window.lodash},75:function(e,t,r){"use strict";r.d(t,"a",(function(){return b})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return d}));var n=r(17),c=r(9),o=r(0),l=r(22),a=r.n(l),i=r(49),s=r(109),u=r(52);const b=e=>{const t=Object(u.a)();e=e||t;const r=Object(c.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(o.useCallback)(t=>{l(e,t)},[e,l])]},p=(e,t,r)=>{const l=Object(u.a)();r=r||l;const a=Object(c.useSelect)(c=>c(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:i}=Object(c.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{i(r,e,t)},[r,e,i])]},d=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,c]=b(t),l=Object(i.a)(n),p=Object(i.a)(e),d=Object(s.a)(p),m=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(d,p)||(c(Object.assign({},l,p)),m.current=!0)},[l,p,d,c]),m.current?[n,c]:[e,c]}},8:function(e,t){e.exports=window.wp.blocks},9:function(e,t){e.exports=window.wp.data},99:function(e,t,r){"use strict";var n=r(0),c=r(7),o=r(1),l=r(3),a=r(11);function i(e){let{level:t}=e;const r={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return r.hasOwnProperty(t)?Object(n.createElement)(a.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(n.createElement)(a.Path,{d:r[t]})):null}class s extends n.Component{createLevelControl(e,t,r){const c=e===t;return{icon:Object(n.createElement)(i,{level:e}),title:Object(o.sprintf)(
16
  /* translators: %s: heading level e.g: "2", "3", "4" */
17
+ Object(o.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:c,onClick:()=>r(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:r,selectedLevel:o,onChange:a}=this.props;return Object(n.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(n.createElement)(i,{level:o}),controls:Object(c.range)(t,r).map(e=>this.createLevelControl(e,o,a))})}}t.a=s}});
build/active-filters/block.json CHANGED
@@ -2,7 +2,7 @@
2
  "name": "woocommerce/active-filters",
3
  "version": "1.0.0",
4
  "title": "Active Product Filters",
5
- "description": "Show the currently active product filters. Works in combination with the All Products and filters blocks.",
6
  "category": "woocommerce",
7
  "keywords": [ "WooCommerce" ],
8
  "supports": {
2
  "name": "woocommerce/active-filters",
3
  "version": "1.0.0",
4
  "title": "Active Product Filters",
5
+ "description": "Display the currently active product filters.",
6
  "category": "woocommerce",
7
  "keywords": [ "WooCommerce" ],
8
  "supports": {
build/all-products-frontend.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-context', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => 'f2396644a7ce22751852fa588ef95cec');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-context', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => 'f0e031b49604c6ccd82f4db4a6206e17');
build/all-products-frontend.js CHANGED
@@ -1,11 +1,11 @@
1
- !function(e){function t(t){for(var r,o,c=t[0],i=t[1],s=0,l=[];s<c.length;s++)o=c[s],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&l.push(n[o][0]),n[o]=0;for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);for(a&&a(t);l.length;)l.shift()()}var r={},n={9:0,73:0};function o(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.e=function(e){var t=[],r=n[e];if(0!==r)if(r)t.push(r[2]);else{var c=new Promise((function(t,o){r=n[e]=[t,o]}));t.push(r[2]=c);var i,s=document.createElement("script");s.charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.src=function(e){return o.p+""+({0:"vendors--cart-blocks/cart-line-items--cart-blocks/cart-order-summary--cart-blocks/order-summary-shi--c02aad66",1:"vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--decc3dc6",58:"product-add-to-cart",59:"product-button",60:"product-category-list",61:"product-image",62:"product-price",63:"product-rating",64:"product-sale-badge",65:"product-sku",66:"product-stock-indicator",67:"product-summary",68:"product-tag-list",69:"product-title",74:"vendors--product-add-to-cart"}[e]||e)+"-frontend.js?ver="+{0:"37ba7733b9ab487c5261",1:"86f573a127131167ae67",58:"87ada28fbaa5f30a25e2",59:"7c9b66eef0d510abc4a0",60:"249f4cce98fd34286e7c",61:"79f31febba1d36705c2f",62:"ae6f77adc19896e2dcab",63:"3f229a7a0fbb0320750e",64:"2d2b9bcefab20d79bf13",65:"d062344f3e77a4ed517e",66:"0746b639175f30828c45",67:"e6c57e16d5dab991518a",68:"bb425117c6c641293bea",69:"50a79e69da32c53897e5",74:"310a5765b5d61eb775ce"}[e]}(e);var a=new Error;i=function(t){s.onerror=s.onload=null,clearTimeout(l);var r=n[e];if(0!==r){if(r){var o=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+o+": "+c+")",a.name="ChunkLoadError",a.type=o,a.request=c,r[1](a)}n[e]=void 0}};var l=setTimeout((function(){i({type:"timeout",target:s})}),12e4);s.onerror=s.onload=i,document.head.appendChild(s)}return Promise.all(t)},o.m=e,o.c=r,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o.oe=function(e){throw console.error(e),e};var c=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=c.push.bind(c);c.push=t,c=c.slice();for(var s=0;s<c.length;s++)t(c[s]);var a=i;o(o.s=215)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.lodash},function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var c=typeof n;if("string"===c||"number"===c)e.push(n);else if(Array.isArray(n)){if(n.length){var i=o.apply(null,n);i&&e.push(i)}}else if("object"===c)if(n.toString===Object.prototype.toString)for(var s in n)r.call(n,s)&&n[s]&&e.push(s);else e.push(n.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t){e.exports=window.wp.data},function(e,t,r){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}r.d(t,"a",(function(){return n}))},,function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.isShallowEqual},function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,r.apply(this,arguments)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=window.wp.primitives},function(e,t){e.exports=window.wp.url},function(e,t,r){"use strict";var n=r(19),o=r.n(n),c=r(0),i=r(5),s=r(1),a=r(48),l=e=>{let{imageUrl:t=a.l+"/block-error.svg",header:r=Object(s.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(s.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:i=Object(s.__)("Error:","woo-gutenberg-products-block"),button:l,showErrorBlock:u=!0}=e;return u?Object(c.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(c.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(c.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},r&&Object(c.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(c.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),o&&Object(c.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},i?i+" ":"",o),l&&Object(c.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};r(35);class u extends i.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:r=!0,showErrorBlock:n=!0,text:o,errorMessagePrefix:i,renderError:s,button:a}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof s?s({errorMessage:u}):Object(c.createElement)(l,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:i,button:a}):this.props.children}}t.a=u},function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t){e.exports=window.wp.htmlEntities},,function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";var n=r(0),o=r(4),c=r.n(o);t.a=e=>{let t,{label:r,screenReaderLabel:o,wrapperElement:i,wrapperProps:s={}}=e;const a=null!=r,l=null!=o;return!a&&l?(t=i||"span",s={...s,className:c()(s.className,"screen-reader-text")},Object(n.createElement)(t,s,o)):(t=i||n.Fragment,a&&l&&r!==o?Object(n.createElement)(t,s,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},o)):Object(n.createElement)(t,s,r))}},,,function(e,t){e.exports=window.wp.a11y},function(e,t,r){"use strict";(function(e){var n=r(0);r(37);const o=Object(n.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,r(55))},function(e,t){e.exports=window.wp.deprecated},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const o=Object(n.createContext)("page"),c=()=>Object(n.useContext)(o);o.Provider},function(e,t){e.exports=window.wp.apiFetch},,function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);r(7);const o=Object(n.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),c=()=>Object(n.useContext)(o)},,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),o=r(11),c=r.n(o);function i(e){const t=Object(n.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},function(e,t,r){"use strict";r.d(t,"a",(function(){return O}));var n=r(3),o=r(0),c=r(6),i=r(7),s=r(17),a=r(120),l=r(29),u=r(70);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(i.dispatch)(c.CART_STORE_KEY).invalidateResolutionForStore()},p=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},b=()=>{Object(o.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(u.b)("added_to_cart","wc-blocks_added_to_cart"),t=Object(u.b)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",d),document.body.addEventListener("wc-blocks_removed_from_cart",d),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",d),document.body.removeEventListener("wc-blocks_removed_from_cart",d)}}window.wcBlocksStoreCartListeners.count++})(),p),[])},m={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},f={...m,email:""},g={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:c.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},h=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,r]=e;return[t,Object(s.decodeEntities)(r)]})),E={cartCoupons:c.EMPTY_CART_COUPONS,cartItems:c.EMPTY_CART_ITEMS,cartFees:c.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:g,cartIsLoading:!0,cartErrors:c.EMPTY_CART_ERRORS,billingAddress:f,shippingAddress:m,shippingRates:c.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:c.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:c.EMPTY_EXTENSIONS},O=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:r}=Object(l.a)(),s=null==r?void 0:r.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();b();const p=Object(i.useSelect)((e,r)=>{let{dispatch:n}=r;if(!u)return E;if(t)return{cartCoupons:s.coupons,cartItems:s.items,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:c.EMPTY_CART_ERRORS,billingData:f,billingAddress:f,shippingAddress:m,extensions:c.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const o=e(c.CART_STORE_KEY),i=o.getCartData(),l=o.getCartErrors(),d=o.getCartTotals(),p=!o.hasFinishedResolution("getCartData"),b=o.isCustomerDataUpdating(),{receiveCart:g}=n(c.CART_STORE_KEY),O=h(i.billingAddress),w=i.needsShipping?h(i.shippingAddress):O,j=i.fees.length>0?i.fees.map(e=>h(e)):c.EMPTY_CART_FEES;return{cartCoupons:i.coupons.length>0?i.coupons.map(e=>({...e,label:e.code})):c.EMPTY_CART_COUPONS,cartItems:i.items,cartFees:j,cartItemsCount:i.itemsCount,cartItemsWeight:i.itemsWeight,cartNeedsPayment:i.needsPayment,cartNeedsShipping:i.needsShipping,cartItemErrors:i.errors,cartTotals:d,cartIsLoading:p,cartErrors:l,billingData:Object(a.a)(O),billingAddress:Object(a.a)(O),shippingAddress:Object(a.a)(w),extensions:i.extensions,shippingRates:i.shippingRates,isLoadingRates:b,cartHasCalculatedShipping:i.hasCalculatedShipping,paymentRequirements:i.paymentRequirements,receiveCart:g}},[u]);return d.current&&Object(n.isEqual)(d.current,p)||(d.current=p),d.current}},,function(e,t,r){"use strict";var n=r(4),o=r.n(n),c=r(0);t.a=Object(c.forwardRef)((function({as:e="div",className:t,...r},n){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(c.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...r,ref:n})}))},function(e,t){},,function(e,t){e.exports=window.wp.warning},function(e,t,r){"use strict";var n=r(8),o=r(0),c=r(13),i=function({icon:e,className:t,...r}){const c=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(n.a)({className:c},r))};t.a=function({icon:e=null,size:t=24,...r}){if("string"==typeof e)return Object(o.createElement)(i,Object(n.a)({icon:e},r));if(Object(o.isValidElement)(e)&&i===e.type)return Object(o.cloneElement)(e,{...r});if("function"==typeof e)return e.prototype instanceof o.Component?Object(o.createElement)(e,{size:t,...r}):e({size:t,...r});if(e&&("svg"===e.type||e.type===c.SVG)){const n={width:t,height:t,...e.props,...r};return Object(o.createElement)(c.SVG,n)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...r}):e}},function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return b}));var n=r(6),o=r(7),c=r(0),i=r(11),s=r.n(i),a=r(31),l=r(61),u=r(26);const d=e=>{const t=Object(u.a)();e=e||t;const r=Object(o.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:i}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(c.useCallback)(t=>{i(e,t)},[e,i])]},p=(e,t,r)=>{const i=Object(u.a)();r=r||i;const s=Object(o.useSelect)(o=>o(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:a}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[s,Object(c.useCallback)(t=>{a(r,e,t)},[r,e,a])]},b=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,o]=d(t),i=Object(a.a)(n),p=Object(a.a)(e),b=Object(l.a)(p),m=Object(c.useRef)(!1);return Object(c.useEffect)(()=>{s()(b,p)||(o(Object.assign({},i,p)),m.current=!0)},[i,p,b,o]),m.current?[n,o]:[e,o]}},,function(e,t){e.exports=window.wc.priceFormat},function(e,t,r){"use strict";var n=r(8),o=r(0),c=r(4),i=r.n(c),s=r(3),a=r(25),l=r.n(a),u=r(10),d=r(44),p=r(71),b=r(1);function m(e,t,r){const{defaultView:n}=t,{frameElement:o}=n;if(!o||t===r.ownerDocument)return e;const c=o.getBoundingClientRect();return new n.DOMRect(e.left+c.left,e.top+c.top,e.width,e.height)}let f=0;function g(e){const t=document.scrollingElement||document.body;e&&(f=t.scrollTop);const r=e?"add":"remove";t.classList[r]("lockscroll"),document.documentElement.classList[r]("lockscroll"),e||(t.scrollTop=f)}let h=0;function E(){return Object(o.useEffect)(()=>(0===h&&g(!0),++h,()=>{1===h&&g(!1),--h}),[]),null}var O=r(24);function w(e){const t=Object(o.useContext)(O.a),r=t.slots[e]||{},n=t.fills[e],c=Object(o.useMemo)(()=>n||[],[n]);return{...r,updateSlot:Object(o.useCallback)(r=>{t.updateSlot(e,r)},[e,t.updateSlot]),unregisterSlot:Object(o.useCallback)(r=>{t.unregisterSlot(e,r)},[e,t.unregisterSlot]),fills:c,registerFill:Object(o.useCallback)(r=>{t.registerFill(e,r)},[e,t.registerFill]),unregisterFill:Object(o.useCallback)(r=>{t.unregisterFill(e,r)},[e,t.unregisterFill])}}var j=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function v({name:e,children:t,registerFill:r,unregisterFill:n}){const c=(e=>{const{getSlot:t,subscribe:r}=Object(o.useContext)(j),[n,c]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(c(t(e)),r(()=>{c(t(e))})),[e]),n})(e),i=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(r(e,i.current),()=>n(e,i.current)),[]),Object(o.useLayoutEffect)(()=>{i.current.children=t,c&&c.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==i.current.name&&(n(i.current.name,i.current),i.current.name=e,r(e,i.current))},[e]),c&&c.node?(Object(s.isFunction)(t)&&(t=t(c.props.fillProps)),Object(o.createPortal)(t,c.node)):null}var y=e=>Object(o.createElement)(j.Consumer,null,({registerFill:t,unregisterFill:r})=>Object(o.createElement)(v,Object(n.a)({},e,{registerFill:t,unregisterFill:r})));class _ extends o.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:r,registerSlot:n}=this.props;e.name!==t&&(r(e.name),n(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:r={},getFills:n}=this.props,c=Object(s.map)(n(t,this),e=>{const t=Object(s.isFunction)(e.children)?e.children(r):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(s.isString)(e))return e;const r=e.key||t;return Object(o.cloneElement)(e,{key:r})})}).filter(Object(s.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(s.isFunction)(e)?e(c):c)}}var x=e=>Object(o.createElement)(j.Consumer,null,({registerSlot:t,unregisterSlot:r,getFills:c})=>Object(o.createElement)(_,Object(n.a)({},e,{registerSlot:t,unregisterSlot:r,getFills:c})));function k(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function S({name:e,children:t}){const r=w(e),n=Object(o.useRef)({rerender:k()});return Object(o.useEffect)(()=>(r.registerFill(n),()=>{r.unregisterFill(n)}),[r.registerFill,r.unregisterFill]),r.ref&&r.ref.current?("function"==typeof t&&(t=t(r.fillProps)),Object(o.createPortal)(t,r.ref.current)):null}var C=Object(o.forwardRef)((function({name:e,fillProps:t={},as:r="div",...c},i){const s=Object(o.useContext)(O.a),a=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(s.registerSlot(e,a,t),()=>{s.unregisterSlot(e,a)}),[s.registerSlot,s.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{s.updateSlot(e,t)}),Object(o.createElement)(r,Object(n.a)({ref:Object(u.useMergeRefs)([i,a])},c))}));function P(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(y,e),Object(o.createElement)(S,e))}r(11),o.Component;const R=Object(o.forwardRef)(({bubblesVirtually:e,...t},r)=>e?Object(o.createElement)(C,Object(n.a)({},t,{ref:r})):Object(o.createElement)(x,t));function N(e){return"appear"===e?"top":"left"}function T(e,t){const{paddingTop:r,paddingBottom:n,paddingLeft:o,paddingRight:c}=(i=t).ownerDocument.defaultView.getComputedStyle(i);var i;const s=r?parseInt(r,10):0,a=n?parseInt(n,10):0,l=o?parseInt(o,10):0,u=c?parseInt(c,10):0;return{x:e.left+l,y:e.top+s,width:e.width-l-u,height:e.height-s-a,left:e.left+l,right:e.right-u,top:e.top+s,bottom:e.bottom-a}}function L(e,t,r){r?e.getAttribute(t)!==r&&e.setAttribute(t,r):e.hasAttribute(t)&&e.removeAttribute(t)}function B(e,t,r=""){e.style[t]!==r&&(e.style[t]=r)}function A(e,t,r){r?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const M=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:r,className:c,noArrow:s=!0,isAlternate:a,position:f="bottom right",range:g,focusOnMount:h="firstElement",anchorRef:O,shouldAnchorIncludePadding:j,anchorRect:v,getAnchorRect:y,expandOnMobile:_,animate:x=!0,onClickOutside:k,onFocusOutside:S,__unstableStickyBoundaryElement:C,__unstableSlotName:R="Popover",__unstableObserveElement:M,__unstableBoundaryParent:F,__unstableForcePosition:I,__unstableForceXAlignment:D,...z},H)=>{const W=Object(o.useRef)(null),V=Object(o.useRef)(null),Y=Object(o.useRef)(),U=Object(u.useViewportMatch)("medium","<"),[q,G]=Object(o.useState)(),K=w(R),X=_&&U,[J,Z]=Object(u.useResizeObserver)();s=X||s,Object(o.useLayoutEffect)(()=>{if(X)return A(Y.current,"is-without-arrow",s),A(Y.current,"is-alternate",a),L(Y.current,"data-x-axis"),L(Y.current,"data-y-axis"),B(Y.current,"top"),B(Y.current,"left"),B(V.current,"maxHeight"),void B(V.current,"maxWidth");const e=()=>{if(!Y.current||!V.current)return;let e=function(e,t,r,n=!1,o,c){if(t)return t;if(r){if(!e.current)return;const t=r(e.current);return m(t,t.ownerDocument||e.current.ownerDocument,c)}if(!1!==n){if(!(n&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==n?void 0:n.cloneRange))return m(Object(d.getRectangleFromRange)(n),n.endContainer.ownerDocument,c);if("function"==typeof(null==n?void 0:n.getBoundingClientRect)){const e=m(n.getBoundingClientRect(),n.ownerDocument,c);return o?e:T(e,n)}const{top:e,bottom:t}=n,r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),s=m(new window.DOMRect(r.left,r.top,r.width,i.bottom-r.top),e.ownerDocument,c);return o?s:T(s,n)}if(!e.current)return;const{parentNode:i}=e.current,s=i.getBoundingClientRect();return o?s:T(s,i)}(W,v,y,O,j,Y.current);if(!e)return;const{offsetParent:t,ownerDocument:r}=Y.current;let n,o=0;if(t&&t!==r.body){const r=t.getBoundingClientRect();o=r.top,e=new window.DOMRect(e.left-r.left,e.top-r.top,e.width,e.height)}var c;F&&(n=null===(c=Y.current.closest(".popover-slot"))||void 0===c?void 0:c.parentNode);const i=Z.height?Z:V.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:p,yAxis:g,contentHeight:h,contentWidth:E}=function(e,t,r="top",n,o,c,i,s,a){const[l,u="center",d]=r.split(" "),p=function(e,t,r,n,o,c,i,s){const{height:a}=t;if(o){const t=o.getBoundingClientRect().top+a-i;if(e.top<=t)return{yAxis:r,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===n?l=e.bottom:"top"===n&&(l=e.top);const u={popoverTop:l,contentHeight:(l-a/2>0?a/2:l)+(l+a/2>window.innerHeight?window.innerHeight-l:a/2)},d={popoverTop:e.top,contentHeight:e.top-10-a>0?a:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+a>window.innerHeight?window.innerHeight-10-e.bottom:a};let b,m=r,f=null;if(!o&&!s)if("middle"===r&&u.contentHeight===a)m="middle";else if("top"===r&&d.contentHeight===a)m="top";else if("bottom"===r&&p.contentHeight===a)m="bottom";else{m=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===m?d.contentHeight:p.contentHeight;f=e!==a?e:null}return b="middle"===m?u.popoverTop:"top"===m?d.popoverTop:p.popoverTop,{yAxis:m,popoverTop:b,contentHeight:f}}(e,t,l,d,n,0,c,s);return{...function(e,t,r,n,o,c,i,s,a){const{width:l}=t;"left"===r&&Object(b.isRTL)()?r="right":"right"===r&&Object(b.isRTL)()&&(r="left"),"left"===n&&Object(b.isRTL)()?n="right":"right"===n&&Object(b.isRTL)()&&(n="left");const u=Math.round(e.left+e.width/2),d={popoverLeft:u,contentWidth:(u-l/2>0?l/2:u)+(u+l/2>window.innerWidth?window.innerWidth-u:l/2)};let p=e.left;"right"===n?p=e.right:"middle"===c||a||(p=u);let m=e.right;"left"===n?m=e.left:"middle"===c||a||(m=u);const f={popoverLeft:p,contentWidth:p-l>0?l:p},g={popoverLeft:m,contentWidth:m+l>window.innerWidth?window.innerWidth-m:l};let h,E=r,O=null;if(!o&&!s)if("center"===r&&d.contentWidth===l)E="center";else if("left"===r&&f.contentWidth===l)E="left";else if("right"===r&&g.contentWidth===l)E="right";else{E=f.contentWidth>g.contentWidth?"left":"right";const e="left"===E?f.contentWidth:g.contentWidth;l>window.innerWidth&&(O=window.innerWidth),e!==l&&(E="center",d.popoverLeft=window.innerWidth/2)}if(h="center"===E?d.popoverLeft:"left"===E?f.popoverLeft:g.popoverLeft,i){const e=i.getBoundingClientRect();h=Math.min(h,e.right-l),Object(b.isRTL)()||(h=Math.max(h,0))}return{xAxis:E,popoverLeft:h,contentWidth:O}}(e,t,u,d,n,p.yAxis,i,s,a),...p}}(e,i,f,C,Y.current,o,n,I,D);"number"==typeof l&&"number"==typeof u&&(B(Y.current,"top",l+"px"),B(Y.current,"left",u+"px")),A(Y.current,"is-without-arrow",s||"center"===p&&"middle"===g),A(Y.current,"is-alternate",a),L(Y.current,"data-x-axis",p),L(Y.current,"data-y-axis",g),B(V.current,"maxHeight","number"==typeof h?h+"px":""),B(V.current,"maxWidth","number"==typeof E?E+"px":""),G(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[g]||"middle"))};e();const{ownerDocument:t}=Y.current,{defaultView:r}=t,n=r.setInterval(e,500);let o;const c=()=>{r.cancelAnimationFrame(o),o=r.requestAnimationFrame(e)};r.addEventListener("click",c),r.addEventListener("resize",e),r.addEventListener("scroll",e,!0);const i=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(O);let l;return i&&i!==t&&(i.defaultView.addEventListener("resize",e),i.defaultView.addEventListener("scroll",e,!0)),M&&(l=new r.MutationObserver(e),l.observe(M,{attributes:!0})),()=>{r.clearInterval(n),r.removeEventListener("resize",e),r.removeEventListener("scroll",e,!0),r.removeEventListener("click",c),r.cancelAnimationFrame(o),i&&i!==t&&(i.defaultView.removeEventListener("resize",e),i.defaultView.removeEventListener("scroll",e,!0)),l&&l.disconnect()}},[X,v,y,O,j,f,Z,C,M,F]);const $=(e,r)=>{if("focus-outside"===e&&S)S(r);else if("focus-outside"===e&&k){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>r.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),k(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:h,__unstableOnClose:$,onClose:$}),re=Object(u.useMergeRefs)([Y,ee,H]),ne=Boolean(x&&q)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:r=N(t)}=e;if("appear"===t){const[e,t="center"]=r.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+r):void 0}({type:"appear",origin:q});let oe=Object(o.createElement)("div",Object(n.a)({className:i()("components-popover",c,ne,{"is-expanded":X,"is-without-arrow":s,"is-alternate":a})},z,{ref:re},te,{tabIndex:"-1"}),X&&Object(o.createElement)(E,null),X&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(Q,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:V,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},J,r)));return K.ref&&(oe=Object(o.createElement)(P,{name:R},oe)),O||v?oe:Object(o.createElement)("span",{ref:W},oe)});M.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(R,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var F=M,I=function({shortcut:e,className:t}){if(!e)return null;let r,n;return Object(s.isString)(e)&&(r=e),Object(s.isObject)(e)&&(r=e.display,n=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":n},r)};const D=Object(o.createElement)("div",{className:"event-catcher"}),z=({eventHandlers:e,child:t,childrenWithPopover:r})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(D,e),Object(o.cloneElement)(t,{children:r}),","),e),H=({child:e,eventHandlers:t,childrenWithPopover:r})=>Object(o.cloneElement)(e,{...t,children:r}),W=(e,t,r)=>{if(1!==o.Children.count(e))return;const n=o.Children.only(e);"function"==typeof n.props[t]&&n.props[t](r)};var V=function({children:e,position:t,text:r,shortcut:n}){const[c,i]=Object(o.useState)(!1),[a,l]=Object(o.useState)(!1),d=Object(u.useDebounce)(l,700),p=t=>{W(e,"onMouseDown",t),document.addEventListener("mouseup",f),i(!0)},b=t=>{W(e,"onMouseUp",t),document.removeEventListener("mouseup",f),i(!1)},m=e=>"mouseUp"===e?b:"mouseDown"===e?p:void 0,f=m("mouseUp"),g=(t,r)=>n=>{if(W(e,t,n),n.currentTarget.disabled)return;if("focus"===n.type&&c)return;d.cancel();const o=Object(s.includes)(["focus","mouseenter"],n.type);o!==a&&(r?d(o):l(o))},h=()=>{d.cancel(),document.removeEventListener("mouseup",f)};if(Object(o.useEffect)(()=>h,[]),1!==o.Children.count(e))return e;const E={onMouseEnter:g("onMouseEnter",!0),onMouseLeave:g("onMouseLeave"),onClick:g("onClick"),onFocus:g("onFocus"),onBlur:g("onBlur"),onMouseDown:m("mouseDown")},O=o.Children.only(e),{children:w,disabled:j}=O.props;return(j?z:H)({child:O,eventHandlers:E,childrenWithPopover:(({grandchildren:e,isOver:t,position:r,text:n,shortcut:c})=>Object(o.concatChildren)(e,t&&Object(o.createElement)(F,{focusOnMount:!1,position:r,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},n,Object(o.createElement)(I,{className:"components-tooltip__shortcut",shortcut:c}))))({grandchildren:w,isOver:a,position:t,text:r,shortcut:n})})},Y=r(38),U=r(34);const q=["onMouseDown","onClick"];var Q=t.a=Object(o.forwardRef)((function(e,t){const{href:r,target:c,isSmall:a,isPressed:u,isBusy:d,isDestructive:p,className:b,disabled:m,icon:f,iconPosition:g="left",iconSize:h,showTooltip:E,tooltipPosition:O,shortcut:w,label:j,children:v,text:y,variant:_,__experimentalIsFocusable:x,describedBy:k,...S}=function({isDefault:e,isPrimary:t,isSecondary:r,isTertiary:n,isLink:o,variant:c,...i}){let s=c;var a,u,d,p,b;return t&&(null!==(a=s)&&void 0!==a||(s="primary")),n&&(null!==(u=s)&&void 0!==u||(s="tertiary")),r&&(null!==(d=s)&&void 0!==d||(s="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=s)&&void 0!==p||(s="secondary")),o&&(null!==(b=s)&&void 0!==b||(s="link")),{...i,variant:s}}(e),C=i()("components-button",b,{"is-secondary":"secondary"===_,"is-primary":"primary"===_,"is-small":a,"is-tertiary":"tertiary"===_,"is-pressed":u,"is-busy":d,"is-link":"link"===_,"is-destructive":p,"has-text":!!f&&!!v,"has-icon":!!f}),P=m&&!x,R=void 0===r||P?"button":"a",N="a"===R?{href:r,target:c}:{type:"button",disabled:P,"aria-pressed":u};if(m&&x){N["aria-disabled"]=!0;for(const e of q)S[e]=e=>{e.stopPropagation(),e.preventDefault()}}const T=!P&&(E&&j||w||!!j&&(!v||Object(s.isArray)(v)&&!v.length)&&!1!==E),L=k?Object(s.uniqueId)():null,B=S["aria-describedby"]||L,A=Object(o.createElement)(R,Object(n.a)({},N,S,{className:C,"aria-label":S["aria-label"]||j,"aria-describedby":B,ref:t}),f&&"left"===g&&Object(o.createElement)(Y.a,{icon:f,size:h}),y&&Object(o.createElement)(o.Fragment,null,y),f&&"right"===g&&Object(o.createElement)(Y.a,{icon:f,size:h}),v);return T?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(V,{text:k||j,shortcut:w,position:O},A),k&&Object(o.createElement)(U.a,null,Object(o.createElement)("span",{id:L},k))):Object(o.createElement)(o.Fragment,null,A,k&&Object(o.createElement)(U.a,null,Object(o.createElement)("span",{id:L},k)))}))},function(e,t){e.exports=window.wp.hooks},function(e,t){e.exports=window.wp.dom},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},,function(e,t){e.exports=window.wc.wcBlocksSharedContext},function(e,t,r){"use strict";r.d(t,"n",(function(){return c})),r.d(t,"l",(function(){return i})),r.d(t,"k",(function(){return s})),r.d(t,"m",(function(){return a})),r.d(t,"i",(function(){return l})),r.d(t,"d",(function(){return u})),r.d(t,"f",(function(){return d})),r.d(t,"j",(function(){return p})),r.d(t,"c",(function(){return b})),r.d(t,"e",(function(){return m})),r.d(t,"g",(function(){return f})),r.d(t,"a",(function(){return g})),r.d(t,"h",(function(){return h})),r.d(t,"b",(function(){return E}));var n,o=r(2);const c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=c.pluginUrl+"images/",s=c.pluginUrl+"build/",a=c.buildPhase,l=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),d=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),b=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),m=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),f=Object(o.getSetting)("shippingCountries",{}),g=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),E=Object(o.getSetting)("allowedStates",{})},function(e,t,r){"use strict";var n=r(2),o=r(1),c=r(72),i=r(45);const s=Object(n.getSetting)("countryLocale",{}),a=e=>{const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=Object(o.sprintf)(
2
  /* translators: %s Field label. */
3
- Object(o.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(c.a)(e.priority)&&(t.index=e.priority),Object(i.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},l=Object.entries(s).map(e=>{let[t,r]=e;return[t,Object.entries(r).map(e=>{let[t,r]=e;return[t,a(r)]}).reduce((e,t)=>{let[r,n]=t;return e[r]=n,e},{})]}).reduce((e,t)=>{let[r,n]=t;return e[r]=n,e},{});t.a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const o=r&&void 0!==l[r]?l[r]:{};return e.map(e=>({key:e,...n.defaultAddressFields[e]||{},...o[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(12),o=r.n(n),c=r(0),i=r(15);const s=[".wp-block-woocommerce-cart"],a=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:s=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const a=n(e,r),l=s(e,r),u={...e.dataset,...a.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:s={},errorBoundaryProps:a={}}=e;Object(c.render)(Object(c.createElement)(i.a,a,Object(c.createElement)(c.Suspense,{fallback:Object(c.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(c.createElement)(t,o()({},s,{attributes:n})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:a,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(s.join(",")),{Block:r,getProps:n,getErrorBoundaryProps:o,selector:c}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrappers:c}=e;const i=document.body.querySelectorAll(o);c&&c.length>0&&Array.prototype.filter.call(i,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,c)),a({Block:t,containers:i,getProps:r,getErrorBoundaryProps:n})})({Block:r,getProps:n,getErrorBoundaryProps:o,selector:c,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrapper:c}=e;const i=c.querySelectorAll(o);a({Block:t,containers:i,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},,,function(e,t){var r,n,o=e.exports={};function c(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===c||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:c}catch(e){r=c}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var a,l=[],u=!1,d=-1;function p(){u&&a&&(u=!1,a.length?l=a.concat(l):d=-1,l.length&&b())}function b(){if(!u){var e=s(p);u=!0;for(var t=l.length;t;){for(a=l,l=[];++d<t;)a&&a[d].run();d=-1,t=l.length}a=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function f(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new m(e,t)),1!==l.length||u||s(b)},m.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=f,o.addListener=f,o.once=f,o.off=f,o.removeListener=f,o.removeAllListeners=f,o.emit=f,o.prependListener=f,o.prependOnceListener=f,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(43),o=r(0),c=r(32);const i=()=>{const e=Object(c.a)(),t=Object(o.useRef)(e);return Object(o.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(n.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(n.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...r,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return i}));var n=r(0);const o=Object(n.createContext)({setIsSuppressed:e=>{},isSuppressed:!1}),c=()=>Object(n.useContext)(o),i=e=>{let{children:t}=e;const[r,c]=Object(n.useState)(!1),i={setIsSuppressed:c,isSuppressed:r};return Object(n.createElement)(o.Provider,{value:i},t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(5);function o(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(6),o=r(7),c=r(0),i=r(31),s=r(73);const a=e=>{const{namespace:t,resourceName:r,resourceValues:a=[],query:l={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(c.useRef)({results:[],isLoading:!0}),p=Object(i.a)(l),b=Object(i.a)(a),m=Object(s.a)(),f=Object(o.useSelect)(e=>{if(!u)return null;const o=e(n.COLLECTIONS_STORE_KEY),c=[t,r,p,b],i=o.getCollectionError(...c);if(i){if(!(i instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(i)}return{results:o.getCollection(...c),isLoading:!o.hasFinishedResolution("getCollection",c)}},[t,r,b,p,u]);return null!==f&&(d.current=f),d.current}},,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"d",(function(){return i})),r.d(t,"c",(function(){return s})),r.d(t,"b",(function(){return a}));const n=window.CustomEvent||null,o=(e,t)=>{let{bubbles:r=!1,cancelable:o=!1,element:c,detail:i={}}=t;if(!n)return;c||(c=document.body);const s=new n(e,{bubbles:r,cancelable:o,detail:i});c.dispatchEvent(s)};let c;const i=()=>{c&&clearTimeout(c),c=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},s=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const c=()=>{o(t,{bubbles:r,cancelable:n})};return jQuery(document).on(e,c),()=>jQuery(document).off(e,c)}},function(e,t,r){"use strict";var n=r(0),o=r(13);const c=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(o.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));t.a=c},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"number"==typeof e},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const o=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},function(e,t,r){"use strict";var n=r(12),o=r.n(n),c=r(0);r(108);const i=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};t.a=e=>t=>{const r=Object(c.useRef)(null);return Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:r,"aria-hidden":!0}),Object(c.createElement)(e,o()({},t,{scrollToTop:e=>{null!==r.current&&((e,t)=>{const{focusableSelector:r}=t||{};window&&Number.isFinite(window.innerHeight)&&(r?((e,t)=>{var r;const n=(null===(r=e.parentElement)||void 0===r?void 0:r.querySelectorAll(t))||[];if(n.length){const e=n[0];i(e),null==e||e.focus()}else i(e)})(e,r):i(e))})(r.current,e)}})))}},,,function(e,t,r){"use strict";var n=r(0),o=r(3),c=r(4),i=r.n(c),s=r(1),a=r(23),l=r(71),u=r(42);function d(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}t.a=function({className:e,status:t="info",children:r,spokenMessage:c=r,onRemove:p=o.noop,isDismissible:b=!0,actions:m=[],politeness:f=d(t),__unstableHTML:g,onDismiss:h=o.noop}){!function(e,t){const r="string"==typeof e?e:Object(n.renderToString)(e);Object(n.useEffect)(()=>{r&&Object(a.speak)(r,t)},[r,t])}(c,f);const E=i()(e,"components-notice","is-"+t,{"is-dismissible":b});return g&&(r=Object(n.createElement)(n.RawHTML,null,r)),Object(n.createElement)("div",{className:E},Object(n.createElement)("div",{className:"components-notice__content"},r,Object(n.createElement)("div",{className:"components-notice__actions"},m.map(({className:e,label:t,isPrimary:r,variant:o,noDefaultClasses:c=!1,onClick:s,url:a},l)=>{let d=o;return"primary"===o||c||(d=a?"link":"secondary"),void 0===d&&r&&(d="primary"),Object(n.createElement)(u.a,{key:l,href:a,variant:d,onClick:a?void 0:s,className:i()("components-notice__action",e)},t)}))),b&&Object(n.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(s.__)("Dismiss this notice"),onClick:e=>{var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),h(),p()},showTooltip:!1}))}},,,,,,function(e,t){},,,,,,,,,,,,,,,,,,,,,function(e,t){e.exports=window.wp.blocks},,function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{icon:t,size:r=24,...o}=e;return Object(n.cloneElement)(t,{width:r,height:r,...o})}},,function(e,t){},,,function(e,t,r){"use strict";var n=r(0),o=r(4),c=r.n(o),i=r(20),s=r(10);r(124),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:r,label:o="",onChange:s,options:a,screenReaderLabel:l,value:u=""}=e;const d="wc-block-components-sort-select__select-"+r;return Object(n.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(n.createElement)(i.a,{label:o,screenReaderLabel:l,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(n.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,value:u},a&&a.map(e=>Object(n.createElement)("option",{key:e.key,value:e.key},e.label))))})},,,,,,function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.wp.wordcount},function(e,t){e.exports=window.wp.autop},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return i}));var n=r(49),o=(r(14),r(2));const c=(e,t)=>Object.keys(o.defaultAddressFields).every(r=>e[r]===t[r]),i=e=>{const t=Object.keys(o.defaultAddressFields),r=Object(n.a)(t,{},e.country),c=Object.assign({},e);return r.forEach(t=>{let{key:r="",hidden:n=!1}=t;n&&((e,t)=>e in t)(r,e)&&(c[r]="")}),c}},function(e,t){e.exports=window.wc.wcBlocksSharedHocs},,,function(e,t){},function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(12),o=r.n(n),c=r(0),i=r(4),s=r.n(i),a=r(77),l=r(7),u=(r(83),r(60));const d=e=>{let{status:t="default"}=e;switch(t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""},p=e=>{let{className:t,context:r="default",additionalNotices:n=[]}=e;const{isSuppressed:i}=Object(u.b)(),{notices:p}=Object(l.useSelect)(e=>({notices:e("core/notices").getNotices(r)})),{removeNotice:b}=Object(l.useDispatch)("core/notices"),m=p.filter(e=>"snackbar"!==e.type).concat(n);if(!m.length)return null;const f=s()(t,"wc-block-components-notices");return i?null:Object(c.createElement)("div",{className:f},m.map(e=>Object(c.createElement)(a.a,o()({key:"store-notice-"+e.id},e,{className:s()("wc-block-components-notices__notice",d(e)),onRemove:()=>{e.isDismissible&&b(e.id,r)}}),e.content)))}},,,,,,,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(16),o=r(0),c=r(48);r.p=c.k,Object(n.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([r.e(0),r.e(62)]).then(r.bind(null,403)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>r.e(61).then(r.bind(null,447)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>r.e(69).then(r.bind(null,448)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>r.e(63).then(r.bind(null,404)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>r.e(59).then(r.bind(null,405)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>r.e(67).then(r.bind(null,406)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>r.e(64).then(r.bind(null,324)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>r.e(65).then(r.bind(null,407)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>r.e(60).then(r.bind(null,408)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>r.e(68).then(r.bind(null,409)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>r.e(66).then(r.bind(null,410)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([r.e(1),r.e(74),r.e(58)]).then(r.bind(null,430)))});const i=e=>Object(n.getRegisteredBlockComponents)(e)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){e.exports=r(240)},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";r.r(t);var n=r(0),o=r(60),c=r(52),i=r(5),s=r(1),a=r(3),l=r(4),u=r.n(l),d=r(20);r(218);var p=e=>{let{currentPage:t,displayFirstAndLastPages:r=!0,displayNextAndPreviousArrows:o=!0,pagesToDisplay:c=3,onPageChange:i,totalPages:a}=e,{minIndex:l,maxIndex:p}=((e,t,r)=>{if(r<=2)return{minIndex:null,maxIndex:null};const n=e-1,o=Math.max(Math.floor(t-n/2),2),c=Math.min(Math.ceil(t+(n-(t-o))),r-1);return{minIndex:Math.max(Math.floor(t-(n-(c-t))),2),maxIndex:c}})(c,t,a);const b=r&&Boolean(1!==l),m=r&&Boolean(p!==a),f=r&&Boolean(l&&l>3),g=r&&Boolean(p&&p<a-2);b&&3===l&&(l-=1),m&&p===a-2&&(p+=1);const h=[];if(l&&p)for(let e=l;e<=p;e++)h.push(e);return Object(n.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(n.createElement)(d.a,{screenReaderLabel:Object(s.__)("Navigate to another page","woo-gutenberg-products-block")}),o&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>i(t-1),title:Object(s.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(n.createElement)(d.a,{label:"←",screenReaderLabel:Object(s.__)("Previous page","woo-gutenberg-products-block")})),b&&Object(n.createElement)("button",{className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:()=>i(1),disabled:1===t},Object(n.createElement)(d.a,{label:"1",screenReaderLabel:Object(s.sprintf)(
4
  /* translators: %d is the page number (1, 2, 3...). */
5
  Object(s.__)("Page %d","woo-gutenberg-products-block"),1)})),f&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(s.__)("…","woo-gutenberg-products-block")),h.map(e=>Object(n.createElement)("button",{key:e,className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?void 0:()=>i(e),disabled:t===e},Object(n.createElement)(d.a,{label:e.toString(),screenReaderLabel:Object(s.sprintf)(
6
  /* translators: %d is the page number (1, 2, 3...). */
7
  Object(s.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(s.__)("…","woo-gutenberg-products-block")),m&&Object(n.createElement)("button",{className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===a,"wc-block-components-pagination__page--active":t===a}),onClick:()=>i(a),disabled:t===a},Object(n.createElement)(d.a,{label:a.toString(),screenReaderLabel:Object(s.sprintf)(
8
  /* translators: %d is the page number (1, 2, 3...). */
9
- Object(s.__)("Page %d","woo-gutenberg-products-block"),a)})),o&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>i(t+1),title:Object(s.__)("Next page","woo-gutenberg-products-block"),disabled:t>=a},Object(n.createElement)(d.a,{label:"→",screenReaderLabel:Object(s.__)("Next page","woo-gutenberg-products-block")})))},b=r(61),m=r(39),f=r(65),g=r(6),h=r(7),E=r(31);var O=r(59),w=r(74),j=r(47),v=r(23),y=r(106),_=r(13),x=Object(n.createElement)(_.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(n.createElement)(_.Path,{d:"M10 2c4.42 0 8 3.58 8 8s-3.58 8-8 8-8-3.58-8-8 3.58-8 8-8zm1.13 9.38l.35-6.46H8.52l.35 6.46h2.26zm-.09 3.36c.24-.23.37-.55.37-.96 0-.42-.12-.74-.36-.97s-.59-.35-1.06-.35-.82.12-1.07.35-.37.55-.37.97c0 .41.13.73.38.96.26.23.61.34 1.06.34s.8-.11 1.05-.34z"})),k=()=>{const{parentClassName:e}=Object(j.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:e+"__no-products"},Object(n.createElement)(y.a,{className:e+"__no-products-image",icon:x,size:100}),Object(n.createElement)("strong",{className:e+"__no-products-title"},Object(s.__)("No products","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:e+"__no-products-description"},Object(s.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},S=Object(n.createElement)(_.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(_.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"})),C=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:r}=Object(j.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:r+"__no-products"},Object(n.createElement)(y.a,{className:r+"__no-products-image",icon:S,size:100}),Object(n.createElement)("strong",{className:r+"__no-products-title"},Object(s.__)("No products found","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:r+"__no-products-description"},Object(s.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(n.createElement)("button",{onClick:t},Object(s.__)("Reset Search","woo-gutenberg-products-block")))},P=r(111);r(217);var R=e=>{let{onChange:t,value:r}=e;return Object(n.createElement)(P.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",onChange:t,options:[{key:"menu_order",label:Object(s.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(s.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(s.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(s.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(s.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(s.__)("Price: high to low","woo-gutenberg-products-block")}],screenReaderLabel:Object(s.__)("Order products by","woo-gutenberg-products-block"),value:r})},N=r(10),T=r(12),L=r.n(T),B=r(135);const A=(e,t,r,o)=>{if(!r)return;const c=Object(B.a)(e);return r.map((r,i)=>{let[s,a={}]=r,l=[];a.children&&a.children.length>0&&(l=A(e,t,a.children,o));const u=c[s];if(!u)return null;const d=t.id||0,p=["layout",s,i,o,d];return Object(n.createElement)(n.Suspense,{key:p.join("_"),fallback:Object(n.createElement)("div",{className:"wc-block-placeholder"})},Object(n.createElement)(u,L()({},a,{children:l,product:t})))})};var M=Object(N.withInstanceId)(e=>{let{product:t={},attributes:r,instanceId:o}=e;const{layoutConfig:c}=r,{parentClassName:i,parentName:s}=Object(j.useInnerBlockLayoutContext)(),a=0===Object.keys(t).length,l=u()(i+"__product","wc-block-layout",{"is-loading":a});return Object(n.createElement)("li",{className:l,"aria-hidden":a},A(s,t,c,o))});r(216);const F=e=>{switch(e){case"menu_order":case"popularity":case"rating":case"price":return{orderby:e,order:"asc"};case"price-desc":return{orderby:"price",order:"desc"};case"date":return{orderby:"date",order:"desc"}}},I=function(e){let{totalQuery:t,totalProducts:r}=e,{totalQuery:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(a.isEqual)(t,n)&&Number.isFinite(r)};var D=Object(w.a)(e=>{let{attributes:t,currentPage:r,onPageChange:o,onSortChange:c,sortValue:i,scrollToTop:l}=e;const[d,w]=Object(m.b)("attributes",[]),[y,_]=Object(m.b)("stock_status",[]),[x,S]=Object(m.b)("min_price"),[P,N]=Object(m.b)("max_price"),[T]=Object(m.c)((e=>{let{sortValue:t,currentPage:r,attributes:n}=e;const{columns:o,rows:c}=n;return{...F(t),catalog_visibility:"catalog",per_page:o*c,page:r}})({attributes:t,sortValue:i,currentPage:r})),{products:L,totalProducts:B,productsLoading:A}=(e=>{const t={namespace:"/wc/store/v1",resourceName:"products"},{results:r,isLoading:n}=Object(f.a)({...t,query:e}),{value:o}=((e,t)=>{const{namespace:r,resourceName:n,resourceValues:o=[],query:c={}}=t;if(!r||!n)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const i=Object(E.a)(c),s=Object(E.a)(o),{value:a,isLoading:l=!0}=Object(h.useSelect)(e=>{const t=e(g.COLLECTIONS_STORE_KEY),o=["x-wp-total",r,n,i,s];return{value:t.getCollectionHeader(...o),isLoading:t.hasFinishedResolution("getCollectionHeader",o)}},["x-wp-total",r,n,s,i]);return{value:a,isLoading:l}})(0,{...t,query:e});return{products:r,totalProducts:parseInt(o,10),productsLoading:n}})(T),{parentClassName:D,parentName:z}=Object(j.useInnerBlockLayoutContext)(),H=(e=>{const{order:t,orderby:r,page:n,per_page:o,...c}=e;return c||{}})(T),{dispatchStoreEvent:W}=Object(O.a)(),V=Object(b.a)({totalQuery:H,totalProducts:B},I);Object(n.useEffect)(()=>{W("product-list-render",{products:L,listName:z})},[L,z,W]),Object(n.useEffect)(()=>{Object(a.isEqual)(H,null==V?void 0:V.totalQuery)||(o(1),null!=V&&V.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(v.speak)(Object(s.__)("No products found","woo-gutenberg-products-block")):Object(v.speak)(Object(s.sprintf)(
10
  /* translators: %s is an integer higher than 0 (1, 2, 3...) */
11
- Object(s._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(B))},[null==V?void 0:V.totalQuery,B,o,H]);const{contentVisibility:Y}=t,U=t.columns*t.rows,q=!Number.isFinite(B)&&Number.isFinite(null==V?void 0:V.totalProducts)&&Object(a.isEqual)(H,null==V?void 0:V.totalQuery)?Math.ceil(((null==V?void 0:V.totalProducts)||0)/U):Math.ceil(B/U),Q=L.length?L:Array.from({length:U}),G=0!==L.length||A,K=d.length>0||y.length>0||Number.isFinite(x)||Number.isFinite(P);return Object(n.createElement)("div",{className:(()=>{const{columns:e,rows:r,alignButtons:n,align:o}=t,c=void 0!==o?"align"+o:"";return u()(D,c,"has-"+e+"-columns",{"has-multiple-rows":r>1,"has-aligned-buttons":n})})()},(null==Y?void 0:Y.orderBy)&&G&&Object(n.createElement)(R,{onChange:c,value:i}),!G&&K&&Object(n.createElement)(C,{resetCallback:()=>{w([]),_([]),S(null),N(null)}}),!G&&!K&&Object(n.createElement)(k,null),G&&Object(n.createElement)("ul",{className:u()(D+"__products",{"is-loading-products":A})},Q.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return Object(n.createElement)(M,{key:e.id||r,attributes:t,product:e})}))),q>1&&Object(n.createElement)(p,{currentPage:r,onPageChange:e=>{l({focusableSelector:"a, button"}),o(e)},totalPages:q}))}),z=e=>{let{attributes:t}=e;const[r,o]=Object(n.useState)(1),[c,i]=Object(n.useState)(t.orderby);return Object(n.useEffect)(()=>{i(t.orderby)},[t.orderby]),Object(n.createElement)(D,{attributes:t,currentPage:r,onPageChange:e=>{o(e)},onSortChange:e=>{var t;const r=null==e||null===(t=e.target)||void 0===t?void 0:t.value;i(r),o(1)},sortValue:c})};const H=Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(n.createElement)("title",null,"Grid Block Preview"),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}));var W=r(125);class V extends i.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?H:Object(n.createElement)(j.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)(o.a,null,Object(n.createElement)(W.a,{context:"wc/all-products"})),Object(n.createElement)(z,{attributes:e,urlParameterSuffix:t}))}}var Y=V;Object(c.a)({selector:".wp-block-woocommerce-all-products",Block:e=>Object(n.createElement)(o.a,{context:"wc/all-products"},Object(n.createElement)(Y,e)),getProps:e=>({attributes:JSON.parse(e.dataset.attributes)})})}]);
1
+ !function(e){function t(t){for(var r,o,c=t[0],i=t[1],s=0,l=[];s<c.length;s++)o=c[s],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&l.push(n[o][0]),n[o]=0;for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);for(a&&a(t);l.length;)l.shift()()}var r={},n={9:0,73:0};function o(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,o),n.l=!0,n.exports}o.e=function(e){var t=[],r=n[e];if(0!==r)if(r)t.push(r[2]);else{var c=new Promise((function(t,o){r=n[e]=[t,o]}));t.push(r[2]=c);var i,s=document.createElement("script");s.charset="utf-8",s.timeout=120,o.nc&&s.setAttribute("nonce",o.nc),s.src=function(e){return o.p+""+({0:"vendors--cart-blocks/cart-line-items--cart-blocks/cart-order-summary--cart-blocks/order-summary-shi--c02aad66",1:"vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--decc3dc6",58:"product-add-to-cart",59:"product-button",60:"product-category-list",61:"product-image",62:"product-price",63:"product-rating",64:"product-sale-badge",65:"product-sku",66:"product-stock-indicator",67:"product-summary",68:"product-tag-list",69:"product-title",74:"vendors--product-add-to-cart"}[e]||e)+"-frontend.js?ver="+{0:"3875b19bb2588595fed6",1:"91078ac4f02004868f45",58:"79c078ce89f57ac5d112",59:"853190fbef5f7c647782",60:"f4776515617c07f88261",61:"92b27c20ed546780124a",62:"438bb40a58bfbb88c707",63:"850b7c3f930ac7a709a1",64:"d05f225d48f60f9a56fc",65:"2de71abc2bc7b512c2e7",66:"c83c7c5e7b4d773745dd",67:"c34c0e7a77c0f5c48af3",68:"11b452106d26780d3563",69:"a3dc1f37ce8353892b99",74:"8990bbbd3b4d9f54c999"}[e]}(e);var a=new Error;i=function(t){s.onerror=s.onload=null,clearTimeout(l);var r=n[e];if(0!==r){if(r){var o=t&&("load"===t.type?"missing":t.type),c=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+o+": "+c+")",a.name="ChunkLoadError",a.type=o,a.request=c,r[1](a)}n[e]=void 0}};var l=setTimeout((function(){i({type:"timeout",target:s})}),12e4);s.onerror=s.onload=i,document.head.appendChild(s)}return Promise.all(t)},o.m=e,o.c=r,o.d=function(e,t,r){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)o.d(r,n,function(t){return e[t]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o.oe=function(e){throw console.error(e),e};var c=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],i=c.push.bind(c);c.push=t,c=c.slice();for(var s=0;s<c.length;s++)t(c[s]);var a=i;o(o.s=217)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.lodash},function(e,t,r){var n;!function(){"use strict";var r={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var c=typeof n;if("string"===c||"number"===c)e.push(n);else if(Array.isArray(n)){if(n.length){var i=o.apply(null,n);i&&e.push(i)}}else if("object"===c)if(n.toString===Object.prototype.toString)for(var s in n)r.call(n,s)&&n[s]&&e.push(s);else e.push(n.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(n=function(){return o}.apply(t,[]))||(e.exports=n)}()},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t){e.exports=window.wp.data},function(e,t,r){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}r.d(t,"a",(function(){return n}))},,function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.isShallowEqual},function(e,t){function r(){return e.exports=r=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,r.apply(this,arguments)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=window.wp.primitives},function(e,t){e.exports=window.wp.url},function(e,t,r){"use strict";var n=r(19),o=r.n(n),c=r(0),i=r(5),s=r(1),a=r(48),l=e=>{let{imageUrl:t=a.l+"/block-error.svg",header:r=Object(s.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(s.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:i=Object(s.__)("Error:","woo-gutenberg-products-block"),button:l,showErrorBlock:u=!0}=e;return u?Object(c.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(c.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(c.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},r&&Object(c.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(c.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),o&&Object(c.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},i?i+" ":"",o),l&&Object(c.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};r(35);class u extends i.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(c.createElement)(c.Fragment,null,Object(c.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:r=!0,showErrorBlock:n=!0,text:o,errorMessagePrefix:i,renderError:s,button:a}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof s?s({errorMessage:u}):Object(c.createElement)(l,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:i,button:a}):this.props.children}}t.a=u},function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t){e.exports=window.wp.htmlEntities},,function(e,t){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";var n=r(0),o=r(4),c=r.n(o);t.a=e=>{let t,{label:r,screenReaderLabel:o,wrapperElement:i,wrapperProps:s={}}=e;const a=null!=r,l=null!=o;return!a&&l?(t=i||"span",s={...s,className:c()(s.className,"screen-reader-text")},Object(n.createElement)(t,s,o)):(t=i||n.Fragment,a&&l&&r!==o?Object(n.createElement)(t,s,Object(n.createElement)("span",{"aria-hidden":"true"},r),Object(n.createElement)("span",{className:"screen-reader-text"},o)):Object(n.createElement)(t,s,r))}},,,function(e,t){e.exports=window.wp.a11y},function(e,t,r){"use strict";(function(e){var n=r(0);r(37);const o=Object(n.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,r(55))},function(e,t){e.exports=window.wp.deprecated},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);const o=Object(n.createContext)("page"),c=()=>Object(n.useContext)(o);o.Provider},,function(e,t){e.exports=window.wp.apiFetch},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(0);r(7);const o=Object(n.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),c=()=>Object(n.useContext)(o)},,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(0),o=r(11),c=r.n(o);function i(e){const t=Object(n.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},function(e,t,r){"use strict";r.d(t,"a",(function(){return O}));var n=r(3),o=r(0),c=r(6),i=r(7),s=r(17),a=r(122),l=r(29),u=r(71);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(i.dispatch)(c.CART_STORE_KEY).invalidateResolutionForStore()},p=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},b=()=>{Object(o.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(u.b)("added_to_cart","wc-blocks_added_to_cart"),t=Object(u.b)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",d),document.body.addEventListener("wc-blocks_removed_from_cart",d),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",d),document.body.removeEventListener("wc-blocks_removed_from_cart",d)}}window.wcBlocksStoreCartListeners.count++})(),p),[])},m={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},f={...m,email:""},g={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:c.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},h=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,r]=e;return[t,Object(s.decodeEntities)(r)]})),E={cartCoupons:c.EMPTY_CART_COUPONS,cartItems:c.EMPTY_CART_ITEMS,cartFees:c.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:g,cartIsLoading:!0,cartErrors:c.EMPTY_CART_ERRORS,billingAddress:f,shippingAddress:m,shippingRates:c.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:c.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:c.EMPTY_EXTENSIONS},O=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:r}=Object(l.a)(),s=null==r?void 0:r.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();b();const p=Object(i.useSelect)((e,r)=>{let{dispatch:n}=r;if(!u)return E;if(t)return{cartCoupons:s.coupons,cartItems:s.items,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:c.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:c.EMPTY_CART_ERRORS,billingData:f,billingAddress:f,shippingAddress:m,extensions:c.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const o=e(c.CART_STORE_KEY),i=o.getCartData(),l=o.getCartErrors(),d=o.getCartTotals(),p=!o.hasFinishedResolution("getCartData"),b=o.isCustomerDataUpdating(),{receiveCart:g}=n(c.CART_STORE_KEY),O=h(i.billingAddress),w=i.needsShipping?h(i.shippingAddress):O,j=i.fees.length>0?i.fees.map(e=>h(e)):c.EMPTY_CART_FEES;return{cartCoupons:i.coupons.length>0?i.coupons.map(e=>({...e,label:e.code})):c.EMPTY_CART_COUPONS,cartItems:i.items,cartFees:j,cartItemsCount:i.itemsCount,cartItemsWeight:i.itemsWeight,cartNeedsPayment:i.needsPayment,cartNeedsShipping:i.needsShipping,cartItemErrors:i.errors,cartTotals:d,cartIsLoading:p,cartErrors:l,billingData:Object(a.a)(O),billingAddress:Object(a.a)(O),shippingAddress:Object(a.a)(w),extensions:i.extensions,shippingRates:i.shippingRates,isLoadingRates:b,cartHasCalculatedShipping:i.hasCalculatedShipping,paymentRequirements:i.paymentRequirements,receiveCart:g}},[u]);return d.current&&Object(n.isEqual)(d.current,p)||(d.current=p),d.current}},,function(e,t,r){"use strict";var n=r(4),o=r.n(n),c=r(0);t.a=Object(c.forwardRef)((function({as:e="div",className:t,...r},n){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(c.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...r,ref:n})}))},function(e,t){},,function(e,t){e.exports=window.wp.warning},function(e,t,r){"use strict";var n=r(8),o=r(0),c=r(13),i=function({icon:e,className:t,...r}){const c=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(n.a)({className:c},r))};t.a=function({icon:e=null,size:t=24,...r}){if("string"==typeof e)return Object(o.createElement)(i,Object(n.a)({icon:e},r));if(Object(o.isValidElement)(e)&&i===e.type)return Object(o.cloneElement)(e,{...r});if("function"==typeof e)return e.prototype instanceof o.Component?Object(o.createElement)(e,{size:t,...r}):e({size:t,...r});if(e&&("svg"===e.type||e.type===c.SVG)){const n={width:t,height:t,...e.props,...r};return Object(o.createElement)(c.SVG,n)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...r}):e}},function(e,t,r){"use strict";r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return p})),r.d(t,"c",(function(){return b}));var n=r(6),o=r(7),c=r(0),i=r(11),s=r.n(i),a=r(31),l=r(61),u=r(26);const d=e=>{const t=Object(u.a)();e=e||t;const r=Object(o.useSelect)(t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:i}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,Object(c.useCallback)(t=>{i(e,t)},[e,i])]},p=(e,t,r)=>{const i=Object(u.a)();r=r||i;const s=Object(o.useSelect)(o=>o(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t),[r,e]),{setQueryValue:a}=Object(o.useDispatch)(n.QUERY_STATE_STORE_KEY);return[s,Object(c.useCallback)(t=>{a(r,e,t)},[r,e,a])]},b=(e,t)=>{const r=Object(u.a)();t=t||r;const[n,o]=d(t),i=Object(a.a)(n),p=Object(a.a)(e),b=Object(l.a)(p),m=Object(c.useRef)(!1);return Object(c.useEffect)(()=>{s()(b,p)||(o(Object.assign({},i,p)),m.current=!0)},[i,p,b,o]),m.current?[n,o]:[e,o]}},,function(e,t){e.exports=window.wc.priceFormat},function(e,t,r){"use strict";var n=r(8),o=r(0),c=r(4),i=r.n(c),s=r(3),a=r(25),l=r.n(a),u=r(10),d=r(44),p=r(72),b=r(1);function m(e,t,r){const{defaultView:n}=t,{frameElement:o}=n;if(!o||t===r.ownerDocument)return e;const c=o.getBoundingClientRect();return new n.DOMRect(e.left+c.left,e.top+c.top,e.width,e.height)}let f=0;function g(e){const t=document.scrollingElement||document.body;e&&(f=t.scrollTop);const r=e?"add":"remove";t.classList[r]("lockscroll"),document.documentElement.classList[r]("lockscroll"),e||(t.scrollTop=f)}let h=0;function E(){return Object(o.useEffect)(()=>(0===h&&g(!0),++h,()=>{1===h&&g(!1),--h}),[]),null}var O=r(24);function w(e){const t=Object(o.useContext)(O.a),r=t.slots[e]||{},n=t.fills[e],c=Object(o.useMemo)(()=>n||[],[n]);return{...r,updateSlot:Object(o.useCallback)(r=>{t.updateSlot(e,r)},[e,t.updateSlot]),unregisterSlot:Object(o.useCallback)(r=>{t.unregisterSlot(e,r)},[e,t.unregisterSlot]),fills:c,registerFill:Object(o.useCallback)(r=>{t.registerFill(e,r)},[e,t.registerFill]),unregisterFill:Object(o.useCallback)(r=>{t.unregisterFill(e,r)},[e,t.unregisterFill])}}var j=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function v({name:e,children:t,registerFill:r,unregisterFill:n}){const c=(e=>{const{getSlot:t,subscribe:r}=Object(o.useContext)(j),[n,c]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(c(t(e)),r(()=>{c(t(e))})),[e]),n})(e),i=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(r(e,i.current),()=>n(e,i.current)),[]),Object(o.useLayoutEffect)(()=>{i.current.children=t,c&&c.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==i.current.name&&(n(i.current.name,i.current),i.current.name=e,r(e,i.current))},[e]),c&&c.node?(Object(s.isFunction)(t)&&(t=t(c.props.fillProps)),Object(o.createPortal)(t,c.node)):null}var y=e=>Object(o.createElement)(j.Consumer,null,({registerFill:t,unregisterFill:r})=>Object(o.createElement)(v,Object(n.a)({},e,{registerFill:t,unregisterFill:r})));class _ extends o.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:r,registerSlot:n}=this.props;e.name!==t&&(r(e.name),n(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:r={},getFills:n}=this.props,c=Object(s.map)(n(t,this),e=>{const t=Object(s.isFunction)(e.children)?e.children(r):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(s.isString)(e))return e;const r=e.key||t;return Object(o.cloneElement)(e,{key:r})})}).filter(Object(s.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(s.isFunction)(e)?e(c):c)}}var x=e=>Object(o.createElement)(j.Consumer,null,({registerSlot:t,unregisterSlot:r,getFills:c})=>Object(o.createElement)(_,Object(n.a)({},e,{registerSlot:t,unregisterSlot:r,getFills:c})));function k(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function S({name:e,children:t}){const r=w(e),n=Object(o.useRef)({rerender:k()});return Object(o.useEffect)(()=>(r.registerFill(n),()=>{r.unregisterFill(n)}),[r.registerFill,r.unregisterFill]),r.ref&&r.ref.current?("function"==typeof t&&(t=t(r.fillProps)),Object(o.createPortal)(t,r.ref.current)):null}var C=Object(o.forwardRef)((function({name:e,fillProps:t={},as:r="div",...c},i){const s=Object(o.useContext)(O.a),a=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(s.registerSlot(e,a,t),()=>{s.unregisterSlot(e,a)}),[s.registerSlot,s.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{s.updateSlot(e,t)}),Object(o.createElement)(r,Object(n.a)({ref:Object(u.useMergeRefs)([i,a])},c))}));function P(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(y,e),Object(o.createElement)(S,e))}r(11),o.Component;const R=Object(o.forwardRef)(({bubblesVirtually:e,...t},r)=>e?Object(o.createElement)(C,Object(n.a)({},t,{ref:r})):Object(o.createElement)(x,t));function N(e){return"appear"===e?"top":"left"}function T(e,t){const{paddingTop:r,paddingBottom:n,paddingLeft:o,paddingRight:c}=(i=t).ownerDocument.defaultView.getComputedStyle(i);var i;const s=r?parseInt(r,10):0,a=n?parseInt(n,10):0,l=o?parseInt(o,10):0,u=c?parseInt(c,10):0;return{x:e.left+l,y:e.top+s,width:e.width-l-u,height:e.height-s-a,left:e.left+l,right:e.right-u,top:e.top+s,bottom:e.bottom-a}}function L(e,t,r){r?e.getAttribute(t)!==r&&e.setAttribute(t,r):e.hasAttribute(t)&&e.removeAttribute(t)}function B(e,t,r=""){e.style[t]!==r&&(e.style[t]=r)}function A(e,t,r){r?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const M=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:r,className:c,noArrow:s=!0,isAlternate:a,position:f="bottom right",range:g,focusOnMount:h="firstElement",anchorRef:O,shouldAnchorIncludePadding:j,anchorRect:v,getAnchorRect:y,expandOnMobile:_,animate:x=!0,onClickOutside:k,onFocusOutside:S,__unstableStickyBoundaryElement:C,__unstableSlotName:R="Popover",__unstableObserveElement:M,__unstableBoundaryParent:F,__unstableForcePosition:I,__unstableForceXAlignment:D,...z},H)=>{const W=Object(o.useRef)(null),V=Object(o.useRef)(null),Y=Object(o.useRef)(),U=Object(u.useViewportMatch)("medium","<"),[q,G]=Object(o.useState)(),K=w(R),X=_&&U,[J,Z]=Object(u.useResizeObserver)();s=X||s,Object(o.useLayoutEffect)(()=>{if(X)return A(Y.current,"is-without-arrow",s),A(Y.current,"is-alternate",a),L(Y.current,"data-x-axis"),L(Y.current,"data-y-axis"),B(Y.current,"top"),B(Y.current,"left"),B(V.current,"maxHeight"),void B(V.current,"maxWidth");const e=()=>{if(!Y.current||!V.current)return;let e=function(e,t,r,n=!1,o,c){if(t)return t;if(r){if(!e.current)return;const t=r(e.current);return m(t,t.ownerDocument||e.current.ownerDocument,c)}if(!1!==n){if(!(n&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==n?void 0:n.cloneRange))return m(Object(d.getRectangleFromRange)(n),n.endContainer.ownerDocument,c);if("function"==typeof(null==n?void 0:n.getBoundingClientRect)){const e=m(n.getBoundingClientRect(),n.ownerDocument,c);return o?e:T(e,n)}const{top:e,bottom:t}=n,r=e.getBoundingClientRect(),i=t.getBoundingClientRect(),s=m(new window.DOMRect(r.left,r.top,r.width,i.bottom-r.top),e.ownerDocument,c);return o?s:T(s,n)}if(!e.current)return;const{parentNode:i}=e.current,s=i.getBoundingClientRect();return o?s:T(s,i)}(W,v,y,O,j,Y.current);if(!e)return;const{offsetParent:t,ownerDocument:r}=Y.current;let n,o=0;if(t&&t!==r.body){const r=t.getBoundingClientRect();o=r.top,e=new window.DOMRect(e.left-r.left,e.top-r.top,e.width,e.height)}var c;F&&(n=null===(c=Y.current.closest(".popover-slot"))||void 0===c?void 0:c.parentNode);const i=Z.height?Z:V.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:p,yAxis:g,contentHeight:h,contentWidth:E}=function(e,t,r="top",n,o,c,i,s,a){const[l,u="center",d]=r.split(" "),p=function(e,t,r,n,o,c,i,s){const{height:a}=t;if(o){const t=o.getBoundingClientRect().top+a-i;if(e.top<=t)return{yAxis:r,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===n?l=e.bottom:"top"===n&&(l=e.top);const u={popoverTop:l,contentHeight:(l-a/2>0?a/2:l)+(l+a/2>window.innerHeight?window.innerHeight-l:a/2)},d={popoverTop:e.top,contentHeight:e.top-10-a>0?a:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+a>window.innerHeight?window.innerHeight-10-e.bottom:a};let b,m=r,f=null;if(!o&&!s)if("middle"===r&&u.contentHeight===a)m="middle";else if("top"===r&&d.contentHeight===a)m="top";else if("bottom"===r&&p.contentHeight===a)m="bottom";else{m=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===m?d.contentHeight:p.contentHeight;f=e!==a?e:null}return b="middle"===m?u.popoverTop:"top"===m?d.popoverTop:p.popoverTop,{yAxis:m,popoverTop:b,contentHeight:f}}(e,t,l,d,n,0,c,s);return{...function(e,t,r,n,o,c,i,s,a){const{width:l}=t;"left"===r&&Object(b.isRTL)()?r="right":"right"===r&&Object(b.isRTL)()&&(r="left"),"left"===n&&Object(b.isRTL)()?n="right":"right"===n&&Object(b.isRTL)()&&(n="left");const u=Math.round(e.left+e.width/2),d={popoverLeft:u,contentWidth:(u-l/2>0?l/2:u)+(u+l/2>window.innerWidth?window.innerWidth-u:l/2)};let p=e.left;"right"===n?p=e.right:"middle"===c||a||(p=u);let m=e.right;"left"===n?m=e.left:"middle"===c||a||(m=u);const f={popoverLeft:p,contentWidth:p-l>0?l:p},g={popoverLeft:m,contentWidth:m+l>window.innerWidth?window.innerWidth-m:l};let h,E=r,O=null;if(!o&&!s)if("center"===r&&d.contentWidth===l)E="center";else if("left"===r&&f.contentWidth===l)E="left";else if("right"===r&&g.contentWidth===l)E="right";else{E=f.contentWidth>g.contentWidth?"left":"right";const e="left"===E?f.contentWidth:g.contentWidth;l>window.innerWidth&&(O=window.innerWidth),e!==l&&(E="center",d.popoverLeft=window.innerWidth/2)}if(h="center"===E?d.popoverLeft:"left"===E?f.popoverLeft:g.popoverLeft,i){const e=i.getBoundingClientRect();h=Math.min(h,e.right-l),Object(b.isRTL)()||(h=Math.max(h,0))}return{xAxis:E,popoverLeft:h,contentWidth:O}}(e,t,u,d,n,p.yAxis,i,s,a),...p}}(e,i,f,C,Y.current,o,n,I,D);"number"==typeof l&&"number"==typeof u&&(B(Y.current,"top",l+"px"),B(Y.current,"left",u+"px")),A(Y.current,"is-without-arrow",s||"center"===p&&"middle"===g),A(Y.current,"is-alternate",a),L(Y.current,"data-x-axis",p),L(Y.current,"data-y-axis",g),B(V.current,"maxHeight","number"==typeof h?h+"px":""),B(V.current,"maxWidth","number"==typeof E?E+"px":""),G(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[g]||"middle"))};e();const{ownerDocument:t}=Y.current,{defaultView:r}=t,n=r.setInterval(e,500);let o;const c=()=>{r.cancelAnimationFrame(o),o=r.requestAnimationFrame(e)};r.addEventListener("click",c),r.addEventListener("resize",e),r.addEventListener("scroll",e,!0);const i=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(O);let l;return i&&i!==t&&(i.defaultView.addEventListener("resize",e),i.defaultView.addEventListener("scroll",e,!0)),M&&(l=new r.MutationObserver(e),l.observe(M,{attributes:!0})),()=>{r.clearInterval(n),r.removeEventListener("resize",e),r.removeEventListener("scroll",e,!0),r.removeEventListener("click",c),r.cancelAnimationFrame(o),i&&i!==t&&(i.defaultView.removeEventListener("resize",e),i.defaultView.removeEventListener("scroll",e,!0)),l&&l.disconnect()}},[X,v,y,O,j,f,Z,C,M,F]);const $=(e,r)=>{if("focus-outside"===e&&S)S(r);else if("focus-outside"===e&&k){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>r.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),k(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:h,__unstableOnClose:$,onClose:$}),re=Object(u.useMergeRefs)([Y,ee,H]),ne=Boolean(x&&q)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:r=N(t)}=e;if("appear"===t){const[e,t="center"]=r.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+r):void 0}({type:"appear",origin:q});let oe=Object(o.createElement)("div",Object(n.a)({className:i()("components-popover",c,ne,{"is-expanded":X,"is-without-arrow":s,"is-alternate":a})},z,{ref:re},te,{tabIndex:"-1"}),X&&Object(o.createElement)(E,null),X&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(Q,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:V,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},J,r)));return K.ref&&(oe=Object(o.createElement)(P,{name:R},oe)),O||v?oe:Object(o.createElement)("span",{ref:W},oe)});M.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(R,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var F=M,I=function({shortcut:e,className:t}){if(!e)return null;let r,n;return Object(s.isString)(e)&&(r=e),Object(s.isObject)(e)&&(r=e.display,n=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":n},r)};const D=Object(o.createElement)("div",{className:"event-catcher"}),z=({eventHandlers:e,child:t,childrenWithPopover:r})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(D,e),Object(o.cloneElement)(t,{children:r}),","),e),H=({child:e,eventHandlers:t,childrenWithPopover:r})=>Object(o.cloneElement)(e,{...t,children:r}),W=(e,t,r)=>{if(1!==o.Children.count(e))return;const n=o.Children.only(e);"function"==typeof n.props[t]&&n.props[t](r)};var V=function({children:e,position:t,text:r,shortcut:n}){const[c,i]=Object(o.useState)(!1),[a,l]=Object(o.useState)(!1),d=Object(u.useDebounce)(l,700),p=t=>{W(e,"onMouseDown",t),document.addEventListener("mouseup",f),i(!0)},b=t=>{W(e,"onMouseUp",t),document.removeEventListener("mouseup",f),i(!1)},m=e=>"mouseUp"===e?b:"mouseDown"===e?p:void 0,f=m("mouseUp"),g=(t,r)=>n=>{if(W(e,t,n),n.currentTarget.disabled)return;if("focus"===n.type&&c)return;d.cancel();const o=Object(s.includes)(["focus","mouseenter"],n.type);o!==a&&(r?d(o):l(o))},h=()=>{d.cancel(),document.removeEventListener("mouseup",f)};if(Object(o.useEffect)(()=>h,[]),1!==o.Children.count(e))return e;const E={onMouseEnter:g("onMouseEnter",!0),onMouseLeave:g("onMouseLeave"),onClick:g("onClick"),onFocus:g("onFocus"),onBlur:g("onBlur"),onMouseDown:m("mouseDown")},O=o.Children.only(e),{children:w,disabled:j}=O.props;return(j?z:H)({child:O,eventHandlers:E,childrenWithPopover:(({grandchildren:e,isOver:t,position:r,text:n,shortcut:c})=>Object(o.concatChildren)(e,t&&Object(o.createElement)(F,{focusOnMount:!1,position:r,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},n,Object(o.createElement)(I,{className:"components-tooltip__shortcut",shortcut:c}))))({grandchildren:w,isOver:a,position:t,text:r,shortcut:n})})},Y=r(38),U=r(34);const q=["onMouseDown","onClick"];var Q=t.a=Object(o.forwardRef)((function(e,t){const{href:r,target:c,isSmall:a,isPressed:u,isBusy:d,isDestructive:p,className:b,disabled:m,icon:f,iconPosition:g="left",iconSize:h,showTooltip:E,tooltipPosition:O,shortcut:w,label:j,children:v,text:y,variant:_,__experimentalIsFocusable:x,describedBy:k,...S}=function({isDefault:e,isPrimary:t,isSecondary:r,isTertiary:n,isLink:o,variant:c,...i}){let s=c;var a,u,d,p,b;return t&&(null!==(a=s)&&void 0!==a||(s="primary")),n&&(null!==(u=s)&&void 0!==u||(s="tertiary")),r&&(null!==(d=s)&&void 0!==d||(s="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=s)&&void 0!==p||(s="secondary")),o&&(null!==(b=s)&&void 0!==b||(s="link")),{...i,variant:s}}(e),C=i()("components-button",b,{"is-secondary":"secondary"===_,"is-primary":"primary"===_,"is-small":a,"is-tertiary":"tertiary"===_,"is-pressed":u,"is-busy":d,"is-link":"link"===_,"is-destructive":p,"has-text":!!f&&!!v,"has-icon":!!f}),P=m&&!x,R=void 0===r||P?"button":"a",N="a"===R?{href:r,target:c}:{type:"button",disabled:P,"aria-pressed":u};if(m&&x){N["aria-disabled"]=!0;for(const e of q)S[e]=e=>{e.stopPropagation(),e.preventDefault()}}const T=!P&&(E&&j||w||!!j&&(!v||Object(s.isArray)(v)&&!v.length)&&!1!==E),L=k?Object(s.uniqueId)():null,B=S["aria-describedby"]||L,A=Object(o.createElement)(R,Object(n.a)({},N,S,{className:C,"aria-label":S["aria-label"]||j,"aria-describedby":B,ref:t}),f&&"left"===g&&Object(o.createElement)(Y.a,{icon:f,size:h}),y&&Object(o.createElement)(o.Fragment,null,y),f&&"right"===g&&Object(o.createElement)(Y.a,{icon:f,size:h}),v);return T?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(V,{text:k||j,shortcut:w,position:O},A),k&&Object(o.createElement)(U.a,null,Object(o.createElement)("span",{id:L},k))):Object(o.createElement)(o.Fragment,null,A,k&&Object(o.createElement)(U.a,null,Object(o.createElement)("span",{id:L},k)))}))},function(e,t){e.exports=window.wp.hooks},function(e,t){e.exports=window.wp.dom},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},,function(e,t){e.exports=window.wc.wcBlocksSharedContext},function(e,t,r){"use strict";r.d(t,"n",(function(){return c})),r.d(t,"l",(function(){return i})),r.d(t,"k",(function(){return s})),r.d(t,"m",(function(){return a})),r.d(t,"i",(function(){return l})),r.d(t,"d",(function(){return u})),r.d(t,"f",(function(){return d})),r.d(t,"j",(function(){return p})),r.d(t,"c",(function(){return b})),r.d(t,"e",(function(){return m})),r.d(t,"g",(function(){return f})),r.d(t,"a",(function(){return g})),r.d(t,"h",(function(){return h})),r.d(t,"b",(function(){return E}));var n,o=r(2);const c=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=c.pluginUrl+"images/",s=c.pluginUrl+"build/",a=c.buildPhase,l=null===(n=o.STORE_PAGES.shop)||void 0===n?void 0:n.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),d=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),b=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),m=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),f=Object(o.getSetting)("shippingCountries",{}),g=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),E=Object(o.getSetting)("allowedStates",{})},function(e,t,r){"use strict";var n=r(2),o=r(1),c=r(73),i=r(45);const s=Object(n.getSetting)("countryLocale",{}),a=e=>{const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=Object(o.sprintf)(
2
  /* translators: %s Field label. */
3
+ Object(o.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(c.a)(e.priority)&&(t.index=e.priority),Object(i.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},l=Object.entries(s).map(e=>{let[t,r]=e;return[t,Object.entries(r).map(e=>{let[t,r]=e;return[t,a(r)]}).reduce((e,t)=>{let[r,n]=t;return e[r]=n,e},{})]}).reduce((e,t)=>{let[r,n]=t;return e[r]=n,e},{});t.a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const o=r&&void 0!==l[r]?l[r]:{};return e.map(e=>({key:e,...n.defaultAddressFields[e]||{},...o[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(12),o=r.n(n),c=r(0),i=r(15);const s=[".wp-block-woocommerce-cart"],a=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:s=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const a=n(e,r),l=s(e,r),u={...e.dataset,...a.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:s={},errorBoundaryProps:a={}}=e;Object(c.render)(Object(c.createElement)(i.a,a,Object(c.createElement)(c.Suspense,{fallback:Object(c.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(c.createElement)(t,o()({},s,{attributes:n})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:a,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(s.join(",")),{Block:r,getProps:n,getErrorBoundaryProps:o,selector:c}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrappers:c}=e;const i=document.body.querySelectorAll(o);c&&c.length>0&&Array.prototype.filter.call(i,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,c)),a({Block:t,containers:i,getProps:r,getErrorBoundaryProps:n})})({Block:r,getProps:n,getErrorBoundaryProps:o,selector:c,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrapper:c}=e;const i=c.querySelectorAll(o);a({Block:t,containers:i,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},,,function(e,t){var r,n,o=e.exports={};function c(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function s(e){if(r===setTimeout)return setTimeout(e,0);if((r===c||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:c}catch(e){r=c}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var a,l=[],u=!1,d=-1;function p(){u&&a&&(u=!1,a.length?l=a.concat(l):d=-1,l.length&&b())}function b(){if(!u){var e=s(p);u=!0;for(var t=l.length;t;){for(a=l,l=[];++d<t;)a&&a[d].run();d=-1,t=l.length}a=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function m(e,t){this.fun=e,this.array=t}function f(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];l.push(new m(e,t)),1!==l.length||u||s(b)},m.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=f,o.addListener=f,o.once=f,o.off=f,o.removeListener=f,o.removeAllListeners=f,o.emit=f,o.prependListener=f,o.prependOnceListener=f,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(43),o=r(0),c=r(32);const i=()=>{const e=Object(c.a)(),t=Object(o.useRef)(e);return Object(o.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(n.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(n.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...r,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return i}));var n=r(0);const o=Object(n.createContext)({setIsSuppressed:e=>{},isSuppressed:!1}),c=()=>Object(n.useContext)(o),i=e=>{let{children:t}=e;const[r,c]=Object(n.useState)(!1),i={setIsSuppressed:c,isSuppressed:r};return Object(n.createElement)(o.Provider,{value:i},t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(5);function o(e,t){const r=Object(n.useRef)();return Object(n.useEffect)(()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)},[e,t]),r.current}},,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(6),o=r(7),c=r(0),i=r(31),s=r(75);const a=e=>{const{namespace:t,resourceName:r,resourceValues:a=[],query:l={},shouldSelect:u=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(c.useRef)({results:[],isLoading:!0}),p=Object(i.a)(l),b=Object(i.a)(a),m=Object(s.a)(),f=Object(o.useSelect)(e=>{if(!u)return null;const o=e(n.COLLECTIONS_STORE_KEY),c=[t,r,p,b],i=o.getCollectionError(...c);if(i){if(!(i instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(i)}return{results:o.getCollection(...c),isLoading:!o.hasFinishedResolution("getCollection",c)}},[t,r,b,p,u]);return null!==f&&(d.current=f),d.current}},,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"d",(function(){return i})),r.d(t,"c",(function(){return s})),r.d(t,"b",(function(){return a}));const n=window.CustomEvent||null,o=(e,t)=>{let{bubbles:r=!1,cancelable:o=!1,element:c,detail:i={}}=t;if(!n)return;c||(c=document.body);const s=new n(e,{bubbles:r,cancelable:o,detail:i});c.dispatchEvent(s)};let c;const i=()=>{c&&clearTimeout(c),c=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},s=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},a=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const c=()=>{o(t,{bubbles:r,cancelable:n})};return jQuery(document).on(e,c),()=>jQuery(document).off(e,c)}},function(e,t,r){"use strict";var n=r(0),o=r(13);const c=Object(n.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(o.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));t.a=c},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"number"==typeof e},,function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(0);const o=()=>{const[,e]=Object(n.useState)();return Object(n.useCallback)(t=>{e(()=>{throw t})},[])}},function(e,t,r){"use strict";var n=r(12),o=r.n(n),c=r(0);r(110);const i=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};t.a=e=>t=>{const r=Object(c.useRef)(null);return Object(c.createElement)(c.Fragment,null,Object(c.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:r,"aria-hidden":!0}),Object(c.createElement)(e,o()({},t,{scrollToTop:e=>{null!==r.current&&((e,t)=>{const{focusableSelector:r}=t||{};window&&Number.isFinite(window.innerHeight)&&(r?((e,t)=>{var r;const n=(null===(r=e.parentElement)||void 0===r?void 0:r.querySelectorAll(t))||[];if(n.length){const e=n[0];i(e),null==e||e.focus()}else i(e)})(e,r):i(e))})(r.current,e)}})))}},,,function(e,t,r){"use strict";var n=r(0),o=r(3),c=r(4),i=r.n(c),s=r(1),a=r(23),l=r(72),u=r(42);function d(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}t.a=function({className:e,status:t="info",children:r,spokenMessage:c=r,onRemove:p=o.noop,isDismissible:b=!0,actions:m=[],politeness:f=d(t),__unstableHTML:g,onDismiss:h=o.noop}){!function(e,t){const r="string"==typeof e?e:Object(n.renderToString)(e);Object(n.useEffect)(()=>{r&&Object(a.speak)(r,t)},[r,t])}(c,f);const E=i()(e,"components-notice","is-"+t,{"is-dismissible":b});return g&&(r=Object(n.createElement)(n.RawHTML,null,r)),Object(n.createElement)("div",{className:E},Object(n.createElement)("div",{className:"components-notice__content"},r,Object(n.createElement)("div",{className:"components-notice__actions"},m.map(({className:e,label:t,isPrimary:r,variant:o,noDefaultClasses:c=!1,onClick:s,url:a},l)=>{let d=o;return"primary"===o||c||(d=a?"link":"secondary"),void 0===d&&r&&(d="primary"),Object(n.createElement)(u.a,{key:l,href:a,variant:d,onClick:a?void 0:s,className:i()("components-notice__action",e)},t)}))),b&&Object(n.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(s.__)("Dismiss this notice"),onClick:e=>{var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),h(),p()},showTooltip:!1}))}},,,,,function(e,t){},,,,,,,,,,,,,,,,,,,,,,function(e,t){e.exports=window.wp.blocks},,function(e,t,r){"use strict";var n=r(0);t.a=function(e){let{icon:t,size:r=24,...o}=e;return Object(n.cloneElement)(t,{width:r,height:r,...o})}},,function(e,t){},,,function(e,t,r){"use strict";var n=r(0),o=r(4),c=r.n(o),i=r(20),s=r(10);r(126),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:r,label:o="",onChange:s,options:a,screenReaderLabel:l,value:u=""}=e;const d="wc-block-components-sort-select__select-"+r;return Object(n.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(n.createElement)(i.a,{label:o,screenReaderLabel:l,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(n.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,value:u},a&&a.map(e=>Object(n.createElement)("option",{key:e.key,value:e.key},e.label))))})},,,,,,function(e,t){e.exports=window.wp.blockEditor},function(e,t){e.exports=window.wp.wordcount},function(e,t){e.exports=window.wp.autop},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return i}));var n=r(49),o=(r(14),r(2));const c=(e,t)=>Object.keys(o.defaultAddressFields).every(r=>e[r]===t[r]),i=e=>{const t=Object.keys(o.defaultAddressFields),r=Object(n.a)(t,{},e.country),c=Object.assign({},e);return r.forEach(t=>{let{key:r="",hidden:n=!1}=t;n&&((e,t)=>e in t)(r,e)&&(c[r]="")}),c}},function(e,t){e.exports=window.wc.wcBlocksSharedHocs},,,function(e,t){},function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(12),o=r.n(n),c=r(0),i=r(4),s=r.n(i),a=r(79),l=r(7),u=(r(84),r(60));const d=e=>{let{status:t="default"}=e;switch(t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""},p=e=>{let{className:t,context:r="default",additionalNotices:n=[]}=e;const{isSuppressed:i}=Object(u.b)(),{notices:p}=Object(l.useSelect)(e=>({notices:e("core/notices").getNotices(r)})),{removeNotice:b}=Object(l.useDispatch)("core/notices"),m=p.filter(e=>"snackbar"!==e.type).concat(n);if(!m.length)return null;const f=s()(t,"wc-block-components-notices");return i?null:Object(c.createElement)("div",{className:f},m.map(e=>Object(c.createElement)(a.a,o()({key:"store-notice-"+e.id},e,{className:s()("wc-block-components-notices__notice",d(e)),onRemove:()=>{e.isDismissible&&b(e.id,r)}}),e.content)))}},,,,,,,,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(16),o=r(0),c=r(48);r.p=c.k,Object(n.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([r.e(0),r.e(62)]).then(r.bind(null,406)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>r.e(61).then(r.bind(null,450)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>r.e(69).then(r.bind(null,451)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>r.e(63).then(r.bind(null,407)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>r.e(59).then(r.bind(null,408)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>r.e(67).then(r.bind(null,409)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>r.e(64).then(r.bind(null,327)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>r.e(65).then(r.bind(null,410)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>r.e(60).then(r.bind(null,411)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>r.e(68).then(r.bind(null,412)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>r.e(66).then(r.bind(null,413)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([r.e(1),r.e(74),r.e(58)]).then(r.bind(null,433)))});const i=e=>Object(n.getRegisteredBlockComponents)(e)},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,r){e.exports=r(242)},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,function(e,t,r){"use strict";r.r(t);var n=r(0),o=r(60),c=r(52),i=r(5),s=r(1),a=r(3),l=r(4),u=r.n(l),d=r(20);r(220);var p=e=>{let{currentPage:t,displayFirstAndLastPages:r=!0,displayNextAndPreviousArrows:o=!0,pagesToDisplay:c=3,onPageChange:i,totalPages:a}=e,{minIndex:l,maxIndex:p}=((e,t,r)=>{if(r<=2)return{minIndex:null,maxIndex:null};const n=e-1,o=Math.max(Math.floor(t-n/2),2),c=Math.min(Math.ceil(t+(n-(t-o))),r-1);return{minIndex:Math.max(Math.floor(t-(n-(c-t))),2),maxIndex:c}})(c,t,a);const b=r&&Boolean(1!==l),m=r&&Boolean(p!==a),f=r&&Boolean(l&&l>3),g=r&&Boolean(p&&p<a-2);b&&3===l&&(l-=1),m&&p===a-2&&(p+=1);const h=[];if(l&&p)for(let e=l;e<=p;e++)h.push(e);return Object(n.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(n.createElement)(d.a,{screenReaderLabel:Object(s.__)("Navigate to another page","woo-gutenberg-products-block")}),o&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>i(t-1),title:Object(s.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(n.createElement)(d.a,{label:"←",screenReaderLabel:Object(s.__)("Previous page","woo-gutenberg-products-block")})),b&&Object(n.createElement)("button",{className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:()=>i(1),disabled:1===t},Object(n.createElement)(d.a,{label:"1",screenReaderLabel:Object(s.sprintf)(
4
  /* translators: %d is the page number (1, 2, 3...). */
5
  Object(s.__)("Page %d","woo-gutenberg-products-block"),1)})),f&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(s.__)("…","woo-gutenberg-products-block")),h.map(e=>Object(n.createElement)("button",{key:e,className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?void 0:()=>i(e),disabled:t===e},Object(n.createElement)(d.a,{label:e.toString(),screenReaderLabel:Object(s.sprintf)(
6
  /* translators: %d is the page number (1, 2, 3...). */
7
  Object(s.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(s.__)("…","woo-gutenberg-products-block")),m&&Object(n.createElement)("button",{className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===a,"wc-block-components-pagination__page--active":t===a}),onClick:()=>i(a),disabled:t===a},Object(n.createElement)(d.a,{label:a.toString(),screenReaderLabel:Object(s.sprintf)(
8
  /* translators: %d is the page number (1, 2, 3...). */
9
+ Object(s.__)("Page %d","woo-gutenberg-products-block"),a)})),o&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>i(t+1),title:Object(s.__)("Next page","woo-gutenberg-products-block"),disabled:t>=a},Object(n.createElement)(d.a,{label:"→",screenReaderLabel:Object(s.__)("Next page","woo-gutenberg-products-block")})))},b=r(61),m=r(39),f=r(66),g=r(6),h=r(7),E=r(31);var O=r(59),w=r(76),j=r(47),v=r(23),y=r(108),_=r(13),x=Object(n.createElement)(_.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"-2 -2 24 24"},Object(n.createElement)(_.Path,{d:"M10 2c4.42 0 8 3.58 8 8s-3.58 8-8 8-8-3.58-8-8 3.58-8 8-8zm1.13 9.38l.35-6.46H8.52l.35 6.46h2.26zm-.09 3.36c.24-.23.37-.55.37-.96 0-.42-.12-.74-.36-.97s-.59-.35-1.06-.35-.82.12-1.07.35-.37.55-.37.97c0 .41.13.73.38.96.26.23.61.34 1.06.34s.8-.11 1.05-.34z"})),k=()=>{const{parentClassName:e}=Object(j.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:e+"__no-products"},Object(n.createElement)(y.a,{className:e+"__no-products-image",icon:x,size:100}),Object(n.createElement)("strong",{className:e+"__no-products-title"},Object(s.__)("No products","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:e+"__no-products-description"},Object(s.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},S=Object(n.createElement)(_.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)(_.Path,{d:"M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"})),C=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:r}=Object(j.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:r+"__no-products"},Object(n.createElement)(y.a,{className:r+"__no-products-image",icon:S,size:100}),Object(n.createElement)("strong",{className:r+"__no-products-title"},Object(s.__)("No products found","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:r+"__no-products-description"},Object(s.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(n.createElement)("button",{onClick:t},Object(s.__)("Reset Search","woo-gutenberg-products-block")))},P=r(113);r(219);var R=e=>{let{onChange:t,value:r}=e;return Object(n.createElement)(P.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",onChange:t,options:[{key:"menu_order",label:Object(s.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(s.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(s.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(s.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(s.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(s.__)("Price: high to low","woo-gutenberg-products-block")}],screenReaderLabel:Object(s.__)("Order products by","woo-gutenberg-products-block"),value:r})},N=r(10),T=r(12),L=r.n(T),B=r(137);const A=(e,t,r,o)=>{if(!r)return;const c=Object(B.a)(e);return r.map((r,i)=>{let[s,a={}]=r,l=[];a.children&&a.children.length>0&&(l=A(e,t,a.children,o));const u=c[s];if(!u)return null;const d=t.id||0,p=["layout",s,i,o,d];return Object(n.createElement)(n.Suspense,{key:p.join("_"),fallback:Object(n.createElement)("div",{className:"wc-block-placeholder"})},Object(n.createElement)(u,L()({},a,{children:l,product:t})))})};var M=Object(N.withInstanceId)(e=>{let{product:t={},attributes:r,instanceId:o}=e;const{layoutConfig:c}=r,{parentClassName:i,parentName:s}=Object(j.useInnerBlockLayoutContext)(),a=0===Object.keys(t).length,l=u()(i+"__product","wc-block-layout",{"is-loading":a});return Object(n.createElement)("li",{className:l,"aria-hidden":a},A(s,t,c,o))});r(218);const F=e=>{switch(e){case"menu_order":case"popularity":case"rating":case"price":return{orderby:e,order:"asc"};case"price-desc":return{orderby:"price",order:"desc"};case"date":return{orderby:"date",order:"desc"}}},I=function(e){let{totalQuery:t,totalProducts:r}=e,{totalQuery:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(a.isEqual)(t,n)&&Number.isFinite(r)};var D=Object(w.a)(e=>{let{attributes:t,currentPage:r,onPageChange:o,onSortChange:c,sortValue:i,scrollToTop:l}=e;const[d,w]=Object(m.b)("attributes",[]),[y,_]=Object(m.b)("stock_status",[]),[x,S]=Object(m.b)("min_price"),[P,N]=Object(m.b)("max_price"),[T]=Object(m.c)((e=>{let{sortValue:t,currentPage:r,attributes:n}=e;const{columns:o,rows:c}=n;return{...F(t),catalog_visibility:"catalog",per_page:o*c,page:r}})({attributes:t,sortValue:i,currentPage:r})),{products:L,totalProducts:B,productsLoading:A}=(e=>{const t={namespace:"/wc/store/v1",resourceName:"products"},{results:r,isLoading:n}=Object(f.a)({...t,query:e}),{value:o}=((e,t)=>{const{namespace:r,resourceName:n,resourceValues:o=[],query:c={}}=t;if(!r||!n)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const i=Object(E.a)(c),s=Object(E.a)(o),{value:a,isLoading:l=!0}=Object(h.useSelect)(e=>{const t=e(g.COLLECTIONS_STORE_KEY),o=["x-wp-total",r,n,i,s];return{value:t.getCollectionHeader(...o),isLoading:t.hasFinishedResolution("getCollectionHeader",o)}},["x-wp-total",r,n,s,i]);return{value:a,isLoading:l}})(0,{...t,query:e});return{products:r,totalProducts:parseInt(o,10),productsLoading:n}})(T),{parentClassName:D,parentName:z}=Object(j.useInnerBlockLayoutContext)(),H=(e=>{const{order:t,orderby:r,page:n,per_page:o,...c}=e;return c||{}})(T),{dispatchStoreEvent:W}=Object(O.a)(),V=Object(b.a)({totalQuery:H,totalProducts:B},I);Object(n.useEffect)(()=>{W("product-list-render",{products:L,listName:z})},[L,z,W]),Object(n.useEffect)(()=>{Object(a.isEqual)(H,null==V?void 0:V.totalQuery)||(o(1),null!=V&&V.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(v.speak)(Object(s.__)("No products found","woo-gutenberg-products-block")):Object(v.speak)(Object(s.sprintf)(
10
  /* translators: %s is an integer higher than 0 (1, 2, 3...) */
11
+ Object(s._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(B))},[null==V?void 0:V.totalQuery,B,o,H]);const{contentVisibility:Y}=t,U=t.columns*t.rows,q=!Number.isFinite(B)&&Number.isFinite(null==V?void 0:V.totalProducts)&&Object(a.isEqual)(H,null==V?void 0:V.totalQuery)?Math.ceil(((null==V?void 0:V.totalProducts)||0)/U):Math.ceil(B/U),Q=L.length?L:Array.from({length:U}),G=0!==L.length||A,K=d.length>0||y.length>0||Number.isFinite(x)||Number.isFinite(P);return Object(n.createElement)("div",{className:(()=>{const{columns:e,rows:r,alignButtons:n,align:o}=t,c=void 0!==o?"align"+o:"";return u()(D,c,"has-"+e+"-columns",{"has-multiple-rows":r>1,"has-aligned-buttons":n})})()},(null==Y?void 0:Y.orderBy)&&G&&Object(n.createElement)(R,{onChange:c,value:i}),!G&&K&&Object(n.createElement)(C,{resetCallback:()=>{w([]),_([]),S(null),N(null)}}),!G&&!K&&Object(n.createElement)(k,null),G&&Object(n.createElement)("ul",{className:u()(D+"__products",{"is-loading-products":A})},Q.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;return Object(n.createElement)(M,{key:e.id||r,attributes:t,product:e})}))),q>1&&Object(n.createElement)(p,{currentPage:r,onPageChange:e=>{l({focusableSelector:"a, button"}),o(e)},totalPages:q}))}),z=e=>{let{attributes:t}=e;const[r,o]=Object(n.useState)(1),[c,i]=Object(n.useState)(t.orderby);return Object(n.useEffect)(()=>{i(t.orderby)},[t.orderby]),Object(n.createElement)(D,{attributes:t,currentPage:r,onPageChange:e=>{o(e)},onSortChange:e=>{var t;const r=null==e||null===(t=e.target)||void 0===t?void 0:t.value;i(r),o(1)},sortValue:c})};const H=Object(n.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(n.createElement)("title",null,"Grid Block Preview"),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(n.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(n.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}));var W=r(127);class V extends i.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?H:Object(n.createElement)(j.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)(o.a,null,Object(n.createElement)(W.a,{context:"wc/all-products"})),Object(n.createElement)(z,{attributes:e,urlParameterSuffix:t}))}}var Y=V;Object(c.a)({selector:".wp-block-woocommerce-all-products",Block:e=>Object(n.createElement)(o.a,{context:"wc/all-products"},Object(n.createElement)(Y,e)),getProps:e=>({attributes:JSON.parse(e.dataset.attributes)})})}]);
build/all-products.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-context', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => '488a4bd90e95bb96fdc78d2947cc8dd0');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-context', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-escape-html', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => '0b8916dd68b02cefce63aea57c2412f2');
build/all-products.js CHANGED
@@ -1,36 +1,36 @@
1
- this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-products"]=function(e){function t(t){for(var r,a,s=t[0],l=t[1],i=t[2],d=0,b=[];d<s.length;d++)a=s[d],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&b.push(o[a][0]),o[a]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(u&&u(t);b.length;)b.shift()();return n.push.apply(n,i||[]),c()}function c(){for(var e,t=0;t<n.length;t++){for(var c=n[t],r=!0,s=1;s<c.length;s++){var l=c[s];0!==o[l]&&(r=!1)}r&&(n.splice(t--,1),e=a(a.s=c[0]))}return e}var r={},o={6:0,1:0,2:0,3:0,4:0,20:0,23:0,27:0,29:0,30:0,32:0,33:0,34:0,36:0},n=[];function a(t){if(r[t])return r[t].exports;var c=r[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,a),c.l=!0,c.exports}a.e=function(e){var t=[],c=o[e];if(0!==c)if(c)t.push(c[2]);else{var r=new Promise((function(t,r){c=o[e]=[t,r]}));t.push(c[2]=r);var n,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=function(e){return a.p+""+({1:"product-add-to-cart--product-button--product-category-list--product-image--product-price--product-r--a0326d00",2:"product-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01",3:"product-button--product-image--product-rating--product-sale-badge--product-title",4:"product-add-to-cart--product-button--product-image--product-title",18:"product-add-to-cart",20:"product-button",23:"product-category-list",24:"product-image",27:"product-price",29:"product-rating",30:"product-sale-badge",32:"product-sku",33:"product-stock-indicator",34:"product-summary",36:"product-tag-list",37:"product-title"}[e]||e)+".js?ver="+{1:"3911ab4b9696a0c7af87",2:"658025733ebed4d5aee4",3:"c0024171e5ca7375a0b4",4:"6019c4decb0e318beefa",18:"ae1ec13a687a932f40d1",20:"dc8e04090105d2f34217",23:"d9dc8be936d2fbdfa506",24:"cfc3a9ec8ddf9cd92c9f",27:"bef6e85b43bc445ab1d0",29:"20f24f7eceeb31ba269c",30:"4d9cc62b19526ce1e76d",32:"1cfc1ed9026372e99ada",33:"e738e0d66e80bb998197",34:"85d4efd648587e9c6196",36:"714c8085138d8c4c4863",37:"d2760adae547cd70c493"}[e]}(e);var l=new Error;n=function(t){s.onerror=s.onload=null,clearTimeout(i);var c=o[e];if(0!==c){if(c){var r=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+r+": "+n+")",l.name="ChunkLoadError",l.type=r,l.request=n,c[1](l)}o[e]=void 0}};var i=setTimeout((function(){n({type:"timeout",target:s})}),12e4);s.onerror=s.onload=n,document.head.appendChild(s)}return Promise.all(t)},a.m=e,a.c=r,a.d=function(e,t,c){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(a.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(c,r,function(t){return e[t]}.bind(null,r));return c},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a.oe=function(e){throw console.error(e),e};var s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=s.push.bind(s);s.push=t,s=s.slice();for(var i=0;i<s.length;i++)t(s[i]);var u=l;return n.push([378,0]),c()}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.wp.components},,function(e,t){e.exports=window.wp.blockEditor},,function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.primitives},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.url},,function(e,t){e.exports=window.wc.wcBlocksData},,function(e,t,c){"use strict";c.d(t,"a",(function(){return a})),c.d(t,"c",(function(){return l})),c.d(t,"d",(function(){return i})),c.d(t,"b",(function(){return u}));var r=c(0),o=c(7),n=c(1);const a={clear:Object(n.__)("Clear all selected items","woo-gutenberg-products-block"),noItems:Object(n.__)("No items found.","woo-gutenberg-products-block"),
2
  /* Translators: %s search term */
3
  noResults:Object(n.__)("No results for %s","woo-gutenberg-products-block"),search:Object(n.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(n.sprintf)(
4
  /* translators: Number of items selected from list. */
5
- Object(n._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(n.__)("Search results updated.","woo-gutenberg-products-block")},s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=Object(o.groupBy)(e,"parent"),r=Object(o.keyBy)(t,"id"),n=["0"],a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=a(r[e.parent]);return[...t,e.name]},s=e=>e.map(e=>{const t=c[e.id];return n.push(""+e.id),{...e,breadcrumbs:a(r[e.parent]),children:t&&t.length?s(t):[]}}),l=s(c[0]||[]);return Object.entries(c).forEach(e=>{let[t,c]=e;n.includes(t)||l.push(...s(c||[]))}),l},l=(e,t,c)=>{if(!t)return c?s(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map(e=>!!r.test(e.name)&&e).filter(Boolean);return c?s(o,e):o},i=(e,t)=>{if(!t)return e;const c=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(c).map((e,t)=>c.test(e)?Object(r.createElement)("strong",{key:t},e):Object(r.createElement)(r.Fragment,{key:t},e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},,,function(e,t){e.exports=window.wp.isShallowEqual},function(e,t,c){"use strict";c.d(t,"o",(function(){return n})),c.d(t,"m",(function(){return a})),c.d(t,"l",(function(){return s})),c.d(t,"n",(function(){return l})),c.d(t,"j",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"f",(function(){return d})),c.d(t,"g",(function(){return b})),c.d(t,"k",(function(){return p})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return g})),c.d(t,"h",(function(){return O})),c.d(t,"a",(function(){return j})),c.d(t,"i",(function(){return h})),c.d(t,"b",(function(){return _}));var r,o=c(2);const n=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=n.pluginUrl+"images/",s=n.pluginUrl+"build/",l=n.buildPhase,i=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=o.STORE_PAGES.checkout.id,d=o.STORE_PAGES.checkout.permalink,b=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),m=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id),g=o.STORE_PAGES.cart.permalink,O=(o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),Object(o.getSetting)("shippingCountries",{})),j=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),_=Object(o.getSetting)("allowedStates",{})},,function(e,t,c){"use strict";c.d(t,"h",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"b",(function(){return d})),c.d(t,"i",(function(){return b})),c.d(t,"f",(function(){return p})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return g})),c.d(t,"g",(function(){return O})),c.d(t,"a",(function(){return j}));var r=c(15),o=c(13),n=c.n(o),a=c(7),s=c(2),l=c(23);const i=e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const s=(e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const n=l.o.productCount>100,a={per_page:n?100:0,catalog_visibility:"any",search:c,orderby:"title",order:"asc"},s=[Object(r.addQueryArgs)("/wc/store/v1/products",{...a,...o})];return n&&t.length&&s.push(Object(r.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:t,per_page:0})),s})({selected:t,search:c,queryArgs:o});return Promise.all(s.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id").map(e=>({...e,parent:0}))).catch(e=>{throw e})},u=e=>n()({path:"/wc/store/v1/products/"+e}),d=()=>n()({path:"wc/store/v1/products/attributes"}),b=e=>n()({path:`wc/store/v1/products/attributes/${e}/terms`}),p=e=>{let{selected:t=[],search:c}=e;const o=(e=>{let{selected:t=[],search:c}=e;const o=Object(s.getSetting)("limitTags",!1),n=[Object(r.addQueryArgs)("wc/store/v1/products/tags",{per_page:o?100:0,orderby:o?"count":"name",order:o?"desc":"asc",search:c})];return o&&t.length&&n.push(Object(r.addQueryArgs)("wc/store/v1/products/tags",{include:t})),n})({selected:t,search:c});return Promise.all(o.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id"))},m=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products/categories",{per_page:0,...e})}),g=e=>n()({path:"wc/store/v1/products/categories/"+e}),O=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products",{per_page:0,type:"variation",parent:e})}),j=(e,t)=>{if(!e.title.raw)return e.slug;const c=1===t.filter(t=>t.title.raw===e.title.raw).length;return e.title.raw+(c?"":" - "+e.slug)}},function(e,t){e.exports=window.wc.priceFormat},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return a}));var r=c(1),o=c(14);const n=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}},a=e=>{if(e.data&&"rest_invalid_param"===e.code){const t=Object.values(e.data.params);if(t[0])return t[0]}return null!=e&&e.message?Object(o.decodeEntities)(e.message):Object(r.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o);t.a=e=>{let t,{label:c,screenReaderLabel:o,wrapperElement:a,wrapperProps:s={}}=e;const l=null!=c,i=null!=o;return!l&&i?(t=a||"span",s={...s,className:n()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,o)):(t=a||r.Fragment,l&&i&&c!==o?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},c),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,s,c))}},,function(e,t){e.exports=window.wc.wcBlocksSharedContext},,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(33);t.a=e=>{let{error:t}=e;return Object(r.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:c}=e;return t?"general"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned","woo-gutenberg-products-block"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):"api"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):t:Object(o.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},function(e,t){e.exports=window.wp.escapeHtml},,function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(6),o=c.n(r),n=c(0),a=c(19);const s=e=>{let{countLabel:t,className:c,depth:r=0,controlId:s="",item:l,isSelected:i,isSingle:u,onSelect:d,search:b="",...p}=e;const m=null!=t&&void 0!==l.count&&null!==l.count,g=[c,"woocommerce-search-list__item"];g.push("depth-"+r),u&&g.push("is-radio-button"),m&&g.push("has-count");const O=l.breadcrumbs&&l.breadcrumbs.length,j=p.name||"search-list-item-"+s,h=`${j}-${l.id}`;return Object(n.createElement)("label",{htmlFor:h,className:g.join(" ")},u?Object(n.createElement)("input",o()({type:"radio",id:h,name:j,value:l.value,onChange:d(l),checked:i,className:"woocommerce-search-list__item-input"},p)):Object(n.createElement)("input",o()({type:"checkbox",id:h,name:j,value:l.value,onChange:d(l),checked:i,className:"woocommerce-search-list__item-input"},p)),Object(n.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(n.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(a.b)(l.breadcrumbs)):null,Object(n.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(a.d)(l.name,b))),!!m&&Object(n.createElement)("span",{className:"woocommerce-search-list__item-count"},t||l.count))};t.b=s},function(e,t,c){"use strict";c.d(t,"c",(function(){return n})),c.d(t,"a",(function(){return l})),c.d(t,"b",(function(){return i})),c.d(t,"d",(function(){return d}));var r=c(35);let o,n;!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(o||(o={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(n||(n={}));const a=(e,t)=>Object(r.a)(e)&&"type"in e&&e.type===t,s=e=>a(e,o.SUCCESS),l=e=>a(e,o.ERROR),i=e=>a(e,o.FAIL),u=e=>!Object(r.a)(e)||void 0===e.retry||!0===e.retry,d=()=>({responseTypes:o,noticeContexts:n,shouldRetry:u,isSuccessResponse:s,isErrorResponse:l,isFailResponse:i})},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(126),s=c(4),l=c.n(s);c(131);const i=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});t.a=e=>{let{className:t,value:c,currency:r,onValueChange:s,displayType:u="text",...d}=e;const b="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(b))return null;const p=b/10**r.minorUnit;if(!Number.isFinite(p))return null;const m=l()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),g={...d,...i(r),value:void 0,currency:void 0,onValueChange:void 0},O=s?e=>{const t=+e.value*10**r.minorUnit;s(t)}:()=>{};return Object(n.createElement)(a.a,o()({className:m,displayType:u},g,{value:p,onValueChange:O}))}},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return _}));var r=c(7),o=c(0),n=c(17),a=c(9),s=c(14),l=c(241),i=c(59),u=c(240);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(a.dispatch)(n.CART_STORE_KEY).invalidateResolutionForStore()},b=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},p=()=>{Object(o.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(u.a)("added_to_cart","wc-blocks_added_to_cart"),t=Object(u.a)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",d),document.body.addEventListener("wc-blocks_removed_from_cart",d),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",d),document.body.removeEventListener("wc-blocks_removed_from_cart",d)}}window.wcBlocksStoreCartListeners.count++})(),b),[])},m={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},g={...m,email:""},O={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:n.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},j=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,c]=e;return[t,Object(s.decodeEntities)(c)]})),h={cartCoupons:n.EMPTY_CART_COUPONS,cartItems:n.EMPTY_CART_ITEMS,cartFees:n.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:O,cartIsLoading:!0,cartErrors:n.EMPTY_CART_ERRORS,billingAddress:g,shippingAddress:m,shippingRates:n.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:n.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:n.EMPTY_EXTENSIONS},_=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:c}=Object(i.b)(),s=null==c?void 0:c.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();p();const b=Object(a.useSelect)((e,c)=>{let{dispatch:r}=c;if(!u)return h;if(t)return{cartCoupons:s.coupons,cartItems:s.items,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:n.EMPTY_CART_ERRORS,billingData:g,billingAddress:g,shippingAddress:m,extensions:n.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const o=e(n.CART_STORE_KEY),a=o.getCartData(),i=o.getCartErrors(),d=o.getCartTotals(),b=!o.hasFinishedResolution("getCartData"),p=o.isCustomerDataUpdating(),{receiveCart:O}=r(n.CART_STORE_KEY),_=j(a.billingAddress),E=a.needsShipping?j(a.shippingAddress):_,w=a.fees.length>0?a.fees.map(e=>j(e)):n.EMPTY_CART_FEES;return{cartCoupons:a.coupons.length>0?a.coupons.map(e=>({...e,label:e.code})):n.EMPTY_CART_COUPONS,cartItems:a.items,cartFees:w,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:d,cartIsLoading:b,cartErrors:i,billingData:Object(l.a)(_),billingAddress:Object(l.a)(_),shippingAddress:Object(l.a)(E),extensions:a.extensions,shippingRates:a.shippingRates,isLoadingRates:p,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:O}},[u]);return d.current&&Object(r.isEqual)(d.current,b)||(d.current=b),d.current}},function(e,t){e.exports=window.wc.wcBlocksRegistry},,function(e,t){e.exports=window.wp.hooks},,function(e,t){e.exports=window.wp.a11y},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(0),o=c(22),n=c.n(o);function a(e){const t=Object(r.useRef)(e);return n()(e,t.current)||(t.current=e),t.current}},,function(e,t){e.exports=window.wp.deprecated},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0);const o=Object(r.createContext)("page"),n=()=>Object(r.useContext)(o);o.Provider},,,,,,function(e,t){e.exports=window.wc.wcBlocksSharedHocs},function(e,t,c){"use strict";c.d(t,"b",(function(){return a})),c.d(t,"a",(function(){return s}));var r=c(0),o=c(9);const n=Object(r.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),a=()=>Object(r.useContext)(n),s=e=>{let{children:t,currentPostId:c=0,currentView:a="",previewData:s={}}=e;const l=Object(o.useSelect)(e=>c||e("core/editor").getCurrentPostId(),[c]),i=Object(r.useCallback)(e=>e in s?s[e]:{},[s]),u={isEditor:!0,currentPostId:l,currentView:a,previewData:s,getPreviewData:i};return Object(r.createElement)(n.Provider,{value:u},t)}},function(e,t){e.exports=window.wp.autop},,,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(7),a=c(3);t.a=e=>{let{columns:t,rows:c,setAttributes:s,alignButtons:l,minColumns:i=1,maxColumns:u=6,minRows:d=1,maxRows:b=6}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.RangeControl,{label:Object(o.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:e=>{const t=Object(n.clamp)(e,i,u);s({columns:Number.isNaN(t)?"":t})},min:i,max:u}),Object(r.createElement)(a.RangeControl,{label:Object(o.__)("Rows","woo-gutenberg-products-block"),value:c,onChange:e=>{const t=Object(n.clamp)(e,d,b);s({rows:Number.isNaN(t)?"":t})},min:d,max:b}),Object(r.createElement)(a.ToggleControl,{label:Object(o.__)("Align Last Block","woo-gutenberg-products-block"),help:l?Object(o.__)("The last inner block will be aligned vertically.","woo-gutenberg-products-block"):Object(o.__)("The last inner block will follow other content.","woo-gutenberg-products-block"),checked:l,onChange:()=>s({alignButtons:!l})}))}},,,,,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(130),s=c(4),l=c.n(s),i=c(91);c(155),t.a=e=>{let{className:t,showSpinner:c=!1,children:r,variant:s="contained",...u}=e;const d=l()("wc-block-components-button",t,s,{"wc-block-components-button--loading":c});return Object(n.createElement)(a.a,o()({className:d},u),c&&Object(n.createElement)(i.a,null),Object(n.createElement)("span",{className:"wc-block-components-button__text"},r))}},,,function(e,t){e.exports=window.wp.dom},,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return d})),c.d(t,"b",(function(){return b})),c.d(t,"c",(function(){return p}));var r=c(17),o=c(9),n=c(0),a=c(22),s=c.n(a),l=c(49),i=c(109),u=c(52);const d=e=>{const t=Object(u.a)();e=e||t;const c=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:a}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[c,Object(n.useCallback)(t=>{a(e,t)},[e,a])]},b=(e,t,c)=>{const a=Object(u.a)();c=c||a;const s=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:l}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[s,Object(n.useCallback)(t=>{l(c,e,t)},[c,e,l])]},p=(e,t)=>{const c=Object(u.a)();t=t||c;const[r,o]=d(t),a=Object(l.a)(r),b=Object(l.a)(e),p=Object(i.a)(b),m=Object(n.useRef)(!1);return Object(n.useEffect)(()=>{s()(p,b)||(o(Object.assign({},a,b)),m.current=!0)},[a,b,p,o]),m.current?[r,o]:[e,o]}},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(44),o=c(0),n=c(41);const a=()=>{const e=Object(n.a)(),t=Object(o.useRef)(e);return Object(o.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...c,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},,,,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(36),s=c(3),l=c(4),i=c.n(l);t.a=e=>{let{className:t,item:c,isSelected:r,isLoading:l,onSelect:u,disabled:d,...b}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.a,o()({},b,{key:c.id,className:t,isSelected:r,item:c,onSelect:u,isSingle:!0,disabled:d})),r&&l&&Object(n.createElement)("div",{key:"loading",className:i()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},Object(n.createElement)(s.Spinner,null)))}},,,,,function(e,t){e.exports=window.wp.wordcount},,,function(e,t,c){"use strict";var r=c(2),o=c(1),n=c(161),a=c(100);const s=Object(r.getSetting)("countryLocale",{}),l=e=>{const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=Object(o.sprintf)(
6
  /* translators: %s Field label. */
7
- Object(o.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(n.a)(e.priority)&&(t.index=e.priority),Object(a.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},i=Object.entries(s).map(e=>{let[t,c]=e;return[t,Object.entries(c).map(e=>{let[t,c]=e;return[t,l(c)]}).reduce((e,t)=>{let[c,r]=t;return e[c]=r,e},{})]}).reduce((e,t)=>{let[c,r]=t;return e[c]=r,e},{});t.a=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const o=c&&void 0!==i[c]?i[c]:{};return e.map(e=>({key:e,...r.defaultAddressFields[e]||{},...o[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},function(e,t,c){"use strict";var r=c(0);c(156),t.a=()=>Object(r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(38),a=c(4),s=c.n(a),l=c(26);c(154);const i=e=>{let{currency:t,maxPrice:c,minPrice:a,priceClassName:i,priceStyle:u={}}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.sprintf)(
8
  /* translators: %1$s min price, %2$s max price */
9
- Object(o.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(l.formatPrice)(a),Object(l.formatPrice)(c))),Object(r.createElement)("span",{"aria-hidden":!0},Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:a,style:u})," — ",Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:c,style:u})))},u=e=>{let{currency:t,regularPriceClassName:c,regularPriceStyle:a,regularPrice:l,priceClassName:i,priceStyle:u,price:d}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Previous price:","woo-gutenberg-products-block")),Object(r.createElement)(n.a,{currency:t,renderText:e=>Object(r.createElement)("del",{className:s()("wc-block-components-product-price__regular",c),style:a},e),value:l}),Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Discounted price:","woo-gutenberg-products-block")),Object(r.createElement)(n.a,{currency:t,renderText:e=>Object(r.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",i),style:u},e),value:d}))};t.a=e=>{let{align:t,className:c,currency:o,format:a="<price/>",maxPrice:l,minPrice:d,price:b,priceClassName:p,priceStyle:m,regularPrice:g,regularPriceClassName:O,regularPriceStyle:j}=e;const h=s()(c,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+t]:t});a.includes("<price/>")||(a="<price/>",console.error("Price formats need to include the `<price/>` tag."));const _=g&&b!==g;let E=Object(r.createElement)("span",{className:s()("wc-block-components-product-price__value",p)});return _?E=Object(r.createElement)(u,{currency:o,price:b,priceClassName:p,priceStyle:m,regularPrice:g,regularPriceClassName:O,regularPriceStyle:j}):void 0!==d&&void 0!==l?E=Object(r.createElement)(i,{currency:o,maxPrice:l,minPrice:d,priceClassName:p,priceStyle:m}):b&&(E=Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",p),currency:o,value:b,style:m})),Object(r.createElement)("span",{className:h},Object(r.createInterpolateElement)(a,{price:E}))}},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(7),l=c(36),i=c(97),u=c(10),d=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{render(){const{selected:t}=this.props,c=null==t;return Array.isArray(t)?Object(n.createElement)(e,this.props):Object(n.createElement)(e,o()({},this.props,{selected:c?[]:[t]}))}}return t.defaultProps={selected:null},t},"withTransformSingleSelectToMultipleSelect"),b=c(179),p=c(24),m=c.n(p),g=c(22),O=c.n(g),j=c(25),h=c(27),_=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{constructor(){super(...arguments),m()(this,"state",{error:null,loading:!1,variations:{}}),m()(this,"loadVariations",()=>{const{products:e}=this.props,{loading:t,variations:c}=this.state;if(t)return;const r=this.getExpandedProduct();if(!r||c[r])return;const o=e.find(e=>e.id===r);o.variations&&0!==o.variations.length?(this.setState({loading:!0}),Object(j.g)(r).then(e=>{const t=e.map(e=>({...e,parent:r}));this.setState({variations:{...this.state.variations,[r]:t},loading:!1,error:null})}).catch(async e=>{const t=await Object(h.a)(e);this.setState({variations:{...this.state.variations,[r]:null},loading:!1,error:t})})):this.setState({variations:{...this.state.variations,[r]:null},loading:!1,error:null})})}componentDidMount(){const{selected:e,showVariations:t}=this.props;e&&t&&this.loadVariations()}componentDidUpdate(e){const{isLoading:t,selected:c,showVariations:r}=this.props;r&&(!O()(e.selected,c)||e.isLoading&&!t)&&this.loadVariations()}isProductId(e){const{products:t}=this.props;return t.some(t=>t.id===e)}findParentProduct(e){var t;const{products:c}=this.props;return null===(t=c.filter(t=>t.variations&&t.variations.find(t=>{let{id:c}=t;return c===e}))[0])||void 0===t?void 0:t.id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:c}=this.props;if(!c)return null;let r=t&&t.length?t[0]:null;return r?this.prevSelectedItem=r:this.prevSelectedItem&&(e||this.isProductId(this.prevSelectedItem)||(r=this.prevSelectedItem)),!e&&r?this.isProductId(r)?r:this.findParentProduct(r):null}render(){const{error:t,isLoading:c}=this.props,{error:r,loading:a,variations:s}=this.state;return Object(n.createElement)(e,o()({},this.props,{error:r||t,expandedProduct:this.getExpandedProduct(),isLoading:c,variations:s,variationsLoading:a}))}}return m()(t,"defaultProps",{selected:[],showVariations:!1}),t},"withProductVariations"),E=c(32),w=c(4),f=c.n(w),k=c(82);c(134);const y={list:Object(a.__)("Products","woo-gutenberg-products-block"),noItems:Object(a.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(a.__)("Search for a product to display","woo-gutenberg-products-block"),updated:Object(a.__)("Product search results updated.","woo-gutenberg-products-block")},v=e=>{let{expandedProduct:t,error:c,instanceId:r,isCompact:u,isLoading:d,onChange:b,onSearch:p,products:m,renderItem:g,selected:O,showVariations:j,variations:h,variationsLoading:_}=e;if(c)return Object(n.createElement)(E.a,{error:c});const w=[...m,...h&&h[t]?h[t]:[]];return Object(n.createElement)(i.a,{className:"woocommerce-products",list:w,isCompact:u,isLoading:d,isSingle:!0,selected:w.filter(e=>{let{id:t}=e;return O.includes(t)}),onChange:b,renderItem:g||(j?e=>{const{item:t,search:c,depth:i=0,isSelected:u,onSelect:b}=e,p=t.variations&&Array.isArray(t.variations)?t.variations.length:0,m=f()("woocommerce-search-product__item","woocommerce-search-list__item","depth-"+i,"has-count",{"is-searching":c.length>0,"is-skip-level":0===i&&0!==t.parent,"is-variable":p>0});if(!t.breadcrumbs.length)return Object(n.createElement)(k.a,o()({},e,{className:f()(m,{"is-selected":u}),isSelected:u,item:t,onSelect:()=>()=>{b(t)()},isLoading:d||_,countLabel:t.variations.length>0?Object(a.sprintf)(
10
  /* translators: %1$d is the number of variations of a product product. */
11
  Object(a.__)("%1$d variations","woo-gutenberg-products-block"),t.variations.length):null,name:"products-"+r,"aria-label":Object(a.sprintf)(
12
  /* translators: %1$s is the product name, %2$d is the number of variations of that product. */
13
- Object(a._n)("%1$s, has %2$d variation","%1$s, has %2$d variations",t.variations.length,"woo-gutenberg-products-block"),t.name,t.variations.length)}));const g=Object(s.isEmpty)(t.variation)?e:{...e,item:{...e.item,name:t.variation},"aria-label":`${t.breadcrumbs[0]}: ${t.variation}`};return Object(n.createElement)(l.a,o()({},g,{className:m,name:"variations-"+r}))}:null),onSearch:p,messages:y,isHierarchical:!0})};v.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=d(Object(b.a)(_(Object(u.withInstanceId)(v))))},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return s}));var r=c(7);let o;!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(o||(o={}));const n={addEventCallback:function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(r.uniqueId)(),type:o.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:c}},removeEventCallback:(e,t)=>({id:t,type:o.REMOVE_EVENT_CALLBACK,eventType:e})},a={},s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,{type:t,eventType:c,id:r,callback:n,priority:s}=arguments.length>1?arguments[1]:void 0;const l=e.hasOwnProperty(c)?new Map(e[c]):new Map;switch(t){case o.ADD_EVENT_CALLBACK:return l.set(r,{priority:s,callback:n}),{...e,[c]:l};case o.REMOVE_EVENT_CALLBACK:return l.delete(r),{...e,[c]:l}}}},function(e,t,c){"use strict";c.d(t,"c",(function(){return n})),c.d(t,"a",(function(){return a})),c.d(t,"b",(function(){return s}));var r=c(8),o=c(23);const n=(e,t)=>{if(o.n>2)return Object(r.registerBlockType)(e,t)},a=()=>o.n>2,s=()=>o.n>1},,function(e,t,c){"use strict";c.d(t,"a",(function(){return k}));var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(3),l=c(113),i=c(506),u=c(4),d=c.n(u),b=c(10),p=c(19),m=c(36),g=c(505),O=c(14);const j=e=>{let{id:t,label:c,popoverContents:r,remove:o,screenReaderLabel:i,className:u=""}=e;const[p,m]=Object(n.useState)(!1),h=Object(b.useInstanceId)(j);if(i=i||c,!c)return null;c=Object(O.decodeEntities)(c);const _=d()("woocommerce-tag",u,{"has-remove":!!o}),E="woocommerce-tag__label-"+h,w=Object(n.createElement)(n.Fragment,null,Object(n.createElement)("span",{className:"screen-reader-text"},i),Object(n.createElement)("span",{"aria-hidden":"true"},c));return Object(n.createElement)("span",{className:_},r?Object(n.createElement)(s.Button,{className:"woocommerce-tag__text",id:E,onClick:()=>m(!0)},w):Object(n.createElement)("span",{className:"woocommerce-tag__text",id:E},w),r&&p&&Object(n.createElement)(s.Popover,{onClose:()=>m(!1)},r),o&&Object(n.createElement)(s.Button,{className:"woocommerce-tag__remove",onClick:o(t),label:Object(a.sprintf)(// Translators: %s label.
14
  Object(a.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":E},Object(n.createElement)(l.a,{icon:g.a,size:20,className:"clear-icon"})))};var h=j;const _=e=>Object(n.createElement)(m.b,e),E=e=>{const{list:t,selected:c,renderItem:r,depth:a=0,onSelect:s,instanceId:l,isSingle:i,search:u}=e;return t?Object(n.createElement)(n.Fragment,null,t.map(t=>{const d=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(n.createElement)(n.Fragment,{key:t.id},Object(n.createElement)("li",null,r({item:t,isSelected:d,onSelect:s,isSingle:i,search:u,depth:a,controlId:l})),Object(n.createElement)(E,o()({},e,{list:t.children,depth:a+1})))})):null},w=e=>{let{isLoading:t,isSingle:c,selected:r,messages:o,onChange:l,onRemove:i}=e;if(t||c||!r)return null;const u=r.length;return Object(n.createElement)("div",{className:"woocommerce-search-list__selected"},Object(n.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(n.createElement)("strong",null,o.selected(u)),u>0?Object(n.createElement)(s.Button,{isLink:!0,isDestructive:!0,onClick:()=>l([]),"aria-label":o.clear},Object(a.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(n.createElement)("ul",null,r.map((e,t)=>Object(n.createElement)("li",{key:t},Object(n.createElement)(h,{label:e.name,id:e.id,remove:i})))):null)},f=e=>{let{filteredList:t,search:c,onSelect:r,instanceId:o,...s}=e;const{messages:u,renderItem:d,selected:b,isSingle:p}=s,m=d||_;return 0===t.length?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(n.createElement)(l.a,{icon:i.a})),Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(a.sprintf)(u.noResults,c):u.noItems)):Object(n.createElement)("ul",{className:"woocommerce-search-list__list"},Object(n.createElement)(E,{list:t,selected:b,renderItem:m,onSelect:r,instanceId:o,isSingle:p,search:c}))},k=e=>{const{className:t="",isCompact:c,isHierarchical:r,isLoading:a,isSingle:l,list:i,messages:u=p.a,onChange:m,onSearch:g,selected:O,debouncedSpeak:j}=e,[h,_]=Object(n.useState)(""),E=Object(b.useInstanceId)(k),y=Object(n.useMemo)(()=>({...p.a,...u}),[u]),v=Object(n.useMemo)(()=>Object(p.c)(i,h,r),[i,h,r]);Object(n.useEffect)(()=>{j&&j(y.updated)},[j,y]),Object(n.useEffect)(()=>{"function"==typeof g&&g(h)},[h,g]);const S=Object(n.useCallback)(e=>()=>{l&&m([]);const t=O.findIndex(t=>{let{id:c}=t;return c===e});m([...O.slice(0,t),...O.slice(t+1)])},[l,O,m]),C=Object(n.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:c}=t;return c===e.id})?m(l?[e]:[...O,e]):S(e.id)()},[l,S,m,O]);return Object(n.createElement)("div",{className:d()("woocommerce-search-list",t,{"is-compact":c})},Object(n.createElement)(w,o()({},e,{onRemove:S,messages:y})),Object(n.createElement)("div",{className:"woocommerce-search-list__search"},Object(n.createElement)(s.TextControl,{label:y.search,type:"search",value:h,onChange:e=>_(e)})),a?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(n.createElement)(s.Spinner,null)):Object(n.createElement)(f,o()({},e,{search:h,filteredList:v,messages:y,onSelect:C,instanceId:E})))};Object(s.withSpokenMessages)(k)},,function(e,t,c){"use strict";var r=c(0),o=c(7),n=c(1),a=c(3),s=c(11);function l(e){let{level:t}=e;const c={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return c.hasOwnProperty(t)?Object(r.createElement)(s.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(s.Path,{d:c[t]})):null}class i extends r.Component{createLevelControl(e,t,c){const o=e===t;return{icon:Object(r.createElement)(l,{level:e}),title:Object(n.sprintf)(
15
  /* translators: %s: heading level e.g: "2", "3", "4" */
16
- Object(n.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:o,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:n,onChange:s}=this.props;return Object(r.createElement)(a.ToolbarGroup,{isCollapsed:e,icon:Object(r.createElement)(l,{level:n}),controls:Object(o.range)(t,c).map(e=>this.createLevelControl(e,n,s))})}}t.a=i},function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},function(e,t){e.exports=window.wp.warning},function(e,t,c){"use strict";c.d(t,"b",(function(){return l})),c.d(t,"a",(function(){return i}));var r=c(0),o=c(7),n=c(22),a=c.n(n);const s=Object(r.createContext)({getValidationError:()=>"",setValidationErrors:e=>{},clearValidationError:e=>{},clearAllValidationErrors:()=>{},hideValidationError:()=>{},showValidationError:()=>{},showAllValidationErrors:()=>{},hasValidationErrors:!1,getValidationErrorId:e=>e}),l=()=>Object(r.useContext)(s),i=e=>{let{children:t}=e;const[c,n]=Object(r.useState)({}),l=Object(r.useCallback)(e=>c[e],[c]),i=Object(r.useCallback)(e=>{const t=c[e];return!t||t.hidden?"":"validate-error-"+e},[c]),u=Object(r.useCallback)(e=>{n(t=>{if(!t[e])return t;const{[e]:c,...r}=t;return r})},[]),d=Object(r.useCallback)(()=>{n({})},[]),b=Object(r.useCallback)(e=>{e&&n(t=>(e=Object(o.pickBy)(e,(e,c)=>!("string"!=typeof e.message||t.hasOwnProperty(c)&&a()(t[c],e))),0===Object.values(e).length?t:{...t,...e}))},[]),p=Object(r.useCallback)((e,t)=>{n(c=>{if(!c.hasOwnProperty(e))return c;const r={...c[e],...t};return a()(c[e],r)?c:{...c,[e]:r}})},[]),m={getValidationError:l,setValidationErrors:b,clearValidationError:u,clearAllValidationErrors:d,hideValidationError:Object(r.useCallback)(e=>{p(e,{hidden:!0})},[p]),showValidationError:Object(r.useCallback)(e=>{p(e,{hidden:!1})},[p]),showAllValidationErrors:Object(r.useCallback)(()=>{n(e=>{const t={};return Object.keys(e).forEach(c=>{e[c].hidden&&(t[c]={...e[c],hidden:!1})}),0===Object.values(t).length?e:{...e,...t}})},[]),hasValidationErrors:Object.keys(c).length>0,getValidationErrorId:i};return Object(r.createElement)(s.Provider,{value:m},t)}},function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(113),a=c(239),s=c(2),l=c(5),i=c(30);t.a=e=>{const t=(Object(i.useProductDataContext)().product||{}).id||e.productId||0;return t?Object(r.createElement)(l.InspectorControls,null,Object(r.createElement)("div",{className:"wc-block-single-product__edit-card"},Object(r.createElement)("div",{className:"wc-block-single-product__edit-card-title"},Object(r.createElement)("a",{href:`${s.ADMIN_URL}post.php?post=${t}&action=edit`,target:"_blank",rel:"noopener noreferrer"},Object(o.__)("Edit this product's details","woo-gutenberg-products-block"),Object(r.createElement)(n.a,{icon:a.a,size:16}))),Object(r.createElement)("div",{className:"wc-block-single-product__edit-card-description"},Object(o.__)("Edit details such as title, price, description and more.","woo-gutenberg-products-block")))):null}},,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(12);function o(e,t){const c=Object(r.useRef)();return Object(r.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},,,,,,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(14),s=c(4),l=c.n(s);c(153),t.a=e=>{let{className:t="",disabled:c=!1,name:r,permalink:s="",target:i,rel:u,style:d,onClick:b,...p}=e;const m=l()("wc-block-components-product-name",t);if(c){const e=p;return Object(n.createElement)("span",o()({className:m},e,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)}}))}return Object(n.createElement)("a",o()({className:m,href:s,target:i},p,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)},style:d}))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(9);const o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const c=Object(r.select)("core/notices").getNotices(),{removeNotice:o}=Object(r.dispatch)("core/notices"),n=c.filter(t=>t.status===e);n.forEach(e=>o(e.id,t))}},function(e,t,c){"use strict";var r=c(0),o=c(87),n=c(60);const a=e=>{const t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)},s=e=>e.replace(/<\/?[a-z][^>]*?>/gi,""),l=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,i=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"&hellip;";const r=s(e),o=r.split(" ").splice(0,t).join(" ");return Object(n.autop)(l(o,c))},u=function(e,t){let c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"&hellip;";const o=s(e),a=o.slice(0,t);if(c)return Object(n.autop)(l(a,r));const i=a.match(/([\s]+)/g),u=i?i.length:0,d=o.slice(0,t+u);return Object(n.autop)(l(d,r))};t.a=e=>{let{source:t,maxLength:c=15,countType:s="words",className:l="",style:d={}}=e;const b=Object(r.useMemo)(()=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"words";const r=Object(n.autop)(e),s=Object(o.count)(r,c);if(s<=t)return r;const l=a(r),d=Object(o.count)(l,c);return d<=t?l:"words"===c?i(l,t):u(l,t,"characters_including_spaces"===c)}(t,c,s),[t,c,s]);return Object(r.createElement)(r.RawHTML,{style:d,className:l},b)}},,function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(28),s=c(10);c(159),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:c,label:o="",onChange:s,options:l,screenReaderLabel:i,value:u=""}=e;const d="wc-block-components-sort-select__select-"+c;return Object(r.createElement)("div",{className:n()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(r.createElement)(a.a,{label:o,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(r.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,value:u},l&&l.map(e=>Object(r.createElement)("option",{key:e.key,value:e.key},e.label))))})},,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(5);const o=()=>"function"==typeof r.__experimentalGetSpacingClassesAndStyles},,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(35),o=c(152);const n=e=>{const t=Object(r.a)(e)?e:{},c=Object(o.a)(t.style),n=Object(r.a)(c.typography)?c.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:n.fontSize,lineHeight:n.lineHeight,fontWeight:n.fontWeight,textTransform:n.textTransform,fontFamily:t.fontFamily}}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(0);const o=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var r=c(17),o=c(9),n=c(0),a=c(49),s=c(124);const l=e=>{const{namespace:t,resourceName:c,resourceValues:l=[],query:i={},shouldSelect:u=!0}=e;if(!t||!c)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(n.useRef)({results:[],isLoading:!0}),b=Object(a.a)(i),p=Object(a.a)(l),m=Object(s.a)(),g=Object(o.useSelect)(e=>{if(!u)return null;const o=e(r.COLLECTIONS_STORE_KEY),n=[t,c,b,p],a=o.getCollectionError(...n);if(a){if(!(a instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(a)}return{results:o.getCollection(...n),isLoading:!o.hasFinishedResolution("getCollection",n)}},[t,c,p,b,u]);return null!==g&&(d.current=g),d.current}},,,,,,function(e,t){},,,function(e,t){},,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(5),o=c(95),n=c(35),a=c(152);const s=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(n.a)(e)?e:{},c=Object(a.a)(t.style);return Object(r.__experimentalUseColorProps)({...t,style:c})}},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(0);const o=Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(r.createElement)("title",null,"Grid Block Preview"),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}))},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(3),s=c(4),l=c.n(s);c(180),t.a=function(e){let{className:t="",...c}=e;const r=l()("wc-block-text-toolbar-button",t);return Object(n.createElement)(a.Button,o()({className:r},c))}},,,function(e,t,c){"use strict";c.d(t,"b",(function(){return n})),c.d(t,"a",(function(){return a}));var r=c(0);const o=Object(r.createContext)({setIsSuppressed:e=>{},isSuppressed:!1}),n=()=>Object(r.useContext)(o),a=e=>{let{children:t}=e;const[c,n]=Object(r.useState)(!1),a={setIsSuppressed:n,isSuppressed:c};return Object(r.createElement)(o.Provider,{value:a},t)}},,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(100),o=c(35);const n=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(o.a)(e)?e:{}},function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,function(e,t){},,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"number"==typeof e},,,,,,,,,,,,,,,function(e,t){},,,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(23),s=c(25),l=c(112),i=c(27);t.a=e=>t=>{let{selected:c,...r}=t;const[u,d]=Object(n.useState)(!0),[b,p]=Object(n.useState)(null),[m,g]=Object(n.useState)([]),O=a.o.productCount>100,j=async e=>{const t=await Object(i.a)(e);p(t),d(!1)},h=Object(n.useRef)(c);Object(n.useEffect)(()=>{Object(s.h)({selected:h.current}).then(e=>{g(e),d(!1)}).catch(j)},[h]);const _=Object(l.a)(e=>{Object(s.h)({selected:c,search:e}).then(e=>{g(e),d(!1)}).catch(j)},400),E=Object(n.useCallback)(e=>{d(!0),_(e)},[d,_]);return Object(n.createElement)(e,o()({},r,{selected:c,error:b,products:m,isLoading:u,onSearch:O?E:null}))}},function(e,t){},,,,,function(e,t){},,,,,,,,,,,,,,,,,,,,,function(e){e.exports=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":1,"textdomain":"woo-gutenberg-products-block","name":"woocommerce/all-products","title":"All Products","category":"woocommerce","keywords":["WooCommerce"],"description":"Display products from your store in a grid layout.","supports":{"align":["wide","full"],"html":false,"multiple":false},"example":{"attributes":{"isPreview":true}},"attributes":{"columns":{"type":"number"},"rows":{"type":"number"},"alignButtons":{"type":"boolean"},"contentVisibility":{"type":"object"},"orderby":{"type":"string"},"layoutConfig":{"type":"array"},"isPreview":{"type":"boolean","default":false}}}')},,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var r=c(5),o=c(95),n=c(35),a=c(121),s=c(152);const l=e=>{if(!Object(o.b)()||!Object(a.a)())return{style:{}};const t=Object(n.a)(e)?e:{},c=Object(s.a)(t.style);return Object(r.__experimentalGetSpacingClassesAndStyles)({...t,style:c})}},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(28),l=c(30),i=c(223),u=c(138),d=c(123),b=c(219),p=c(58);c(333),t.default=Object(p.withProductDataContext)(e=>{const{className:t,align:c}=e,{parentClassName:n}=Object(l.useInnerBlockLayoutContext)(),{product:p}=Object(l.useProductDataContext)(),m=Object(i.a)(e),g=Object(u.a)(e),O=Object(d.a)(e),j=Object(b.a)(e);if(!p.id||!p.on_sale)return null;const h="string"==typeof c?"wc-block-components-product-sale-badge--align-"+c:"";return Object(r.createElement)("div",{className:a()("wc-block-components-product-sale-badge",t,h,{[n+"__product-onsale"]:n},g.className,m.className),style:{...g.style,...m.style,...O.style,...j.style}},Object(r.createElement)(s.a,{label:Object(o.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Product on sale","woo-gutenberg-products-block")}))})},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(5),o=c(95),n=c(35),a=c(152);const s=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(n.a)(e)?e:{},c=Object(a.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:c})}},,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0),o=c(102);c(176);const n=e=>{let{errorMessage:t="",propertyName:c="",elementId:n=""}=e;const{getValidationError:a,getValidationErrorId:s}=Object(o.b)();if(!t||"string"!=typeof t){const e=a(c)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(r.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(r.createElement)("p",{id:s(n)},t))}},,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return b}));var r=c(6),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(286),i=c(9),u=(c(185),c(145));const d=e=>{let{status:t="default"}=e;switch(t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""},b=e=>{let{className:t,context:c="default",additionalNotices:r=[]}=e;const{isSuppressed:a}=Object(u.b)(),{notices:b}=Object(i.useSelect)(e=>({notices:e("core/notices").getNotices(c)})),{removeNotice:p}=Object(i.useDispatch)("core/notices"),m=b.filter(e=>"snackbar"!==e.type).concat(r);if(!m.length)return null;const g=s()(t,"wc-block-components-notices");return a?null:Object(n.createElement)("div",{className:g},m.map(e=>Object(n.createElement)(l.a,o()({key:"store-notice-"+e.id},e,{className:s()("wc-block-components-notices__notice",d(e)),onRemove:()=>{e.isDismissible&&p(e.id,c)}}),e.content)))}},,,,,,,,function(e,t,c){"use strict";c.d(t,"c",(function(){return a})),c.d(t,"b",(function(){return s})),c.d(t,"a",(function(){return l}));const r=window.CustomEvent||null,o=(e,t)=>{let{bubbles:c=!1,cancelable:o=!1,element:n,detail:a={}}=t;if(!r)return;n||(n=document.body);const s=new r(e,{bubbles:c,cancelable:o,detail:a});n.dispatchEvent(s)};let n;const a=()=>{n&&clearTimeout(n),n=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},s=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},l=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const n=()=>{o(t,{bubbles:c,cancelable:r})};return jQuery(document).on(e,n),()=>jQuery(document).off(e,n)}},function(e,t,c){"use strict";c.d(t,"b",(function(){return n})),c.d(t,"a",(function(){return a}));var r=c(90),o=(c(15),c(2));const n=(e,t)=>Object.keys(o.defaultAddressFields).every(c=>e[c]===t[c]),a=e=>{const t=Object.keys(o.defaultAddressFields),c=Object(r.a)(t,{},e.country),n=Object.assign({},e);return c.forEach(t=>{let{key:c="",hidden:r=!1}=t;r&&((e,t)=>e in t)(c,e)&&(n[c]="")}),n}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(94);const o=(e,t)=>function(c){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const n=r.a.addEventCallback(e,c,o);return t(n),()=>{t(r.a.removeEventCallback(e,n.id))}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return a}));const r=(e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[];var o=c(37);const n=async(e,t,c)=>{const o=r(e,t),n=[];for(const e of o)try{const t=await Promise.resolve(e.callback(c));"object"==typeof t&&n.push(t)}catch(e){console.error(e)}return!n.length||n},a=async(e,t,c)=>{const n=[],a=r(e,t);for(const e of a)try{const t=await Promise.resolve(e.callback(c));if("object"!=typeof t||null===t)continue;if(!t.hasOwnProperty("type"))throw new Error("Returned objects from event emitter observers must return an object with a type property");if(Object(o.a)(t)||Object(o.b)(t))return n.push(t),n;n.push(t)}catch(e){return console.error(e),n.push({type:"error"}),n}return n}},,,,,function(e,t,c){"use strict";var r=c(0),o=c(11);const n=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(r.createElement)("path",{d:"M15.55 13c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.37-.66-.11-1.48-.87-1.48H5.21l-.94-2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7l1.1-2h7.45zM6.16 6h12.15l-2.76 5H8.53L6.16 6zM7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"}));t.a=n},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t){},function(e,t,c){"use strict";var r=c(95);let o={headingLevel:{type:"number",default:2},showProductLink:{type:"boolean",default:!0},linkTarget:{type:"string"},productId:{type:"number",default:0}};Object(r.b)()&&(o={...o,align:{type:"string"}}),t.a=o},function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(30),s=c(95),l=c(58),i=c(115),u=c(78),d=c(138),b=c(219),p=c(123);c(334);const m=e=>{let{children:t,headingLevel:c,elementType:o="h"+c,...n}=e;return Object(r.createElement)(o,n,t)};t.a=Object(l.withProductDataContext)(e=>{const{className:t,headingLevel:c=2,showProductLink:o=!0,linkTarget:l,align:g}=e,{parentClassName:O}=Object(a.useInnerBlockLayoutContext)(),{product:j}=Object(a.useProductDataContext)(),{dispatchStoreEvent:h}=Object(u.a)(),_=Object(d.a)(e),E=Object(b.a)(e),w=Object(p.a)(e);return j.id?Object(r.createElement)(m,{headingLevel:c,className:n()(t,_.className,"wc-block-components-product-title",{[O+"__product-title"]:O,["wc-block-components-product-title--align-"+g]:g&&Object(s.b)()}),style:Object(s.b)()?{...E.style,...w.style,..._.style}:{}},Object(r.createElement)(i.a,{disabled:!o,name:j.name,permalink:j.permalink,target:l,onClick:()=>{h("product-view-link",{product:j})}})):Object(r.createElement)(m,{headingLevel:c,className:n()(t,_.className,"wc-block-components-product-title",{[O+"__product-title"]:O,["wc-block-components-product-title--align-"+g]:g&&Object(s.b)()}),style:Object(s.b)()?{...E.style,...w.style,..._.style}:{}})})},function(e,t,c){"use strict";t.a={showProductLink:{type:"boolean",default:!0},showSaleBadge:{type:"boolean",default:!0},saleBadgeAlign:{type:"string",default:"right"},imageSizing:{type:"string",default:"full-size"},productId:{type:"number",default:0}}},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(4),l=c.n(s),i=c(2),u=c(30),d=c(123),b=c(223),p=c(219),m=c(58),g=c(78),O=c(220);c(335);const j=()=>Object(n.createElement)("img",{src:i.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500}),h=e=>{let{image:t,onLoad:c,loaded:r,showFullSize:a,fallbackAlt:s}=e;const{thumbnail:l,src:i,srcset:u,sizes:d,alt:b}=t||{},p={alt:b||s,onLoad:c,hidden:!r,src:l,...a&&{src:i,srcSet:u,sizes:d}};return Object(n.createElement)(n.Fragment,null,p.src&&Object(n.createElement)("img",o()({"data-testid":"product-image"},p)),!r&&Object(n.createElement)(j,null))};t.a=Object(m.withProductDataContext)(e=>{const{className:t,imageSizing:c="full-size",showProductLink:r=!0,showSaleBadge:o,saleBadgeAlign:s="right"}=e,{parentClassName:i}=Object(u.useInnerBlockLayoutContext)(),{product:m}=Object(u.useProductDataContext)(),[_,E]=Object(n.useState)(!1),{dispatchStoreEvent:w}=Object(g.a)(),f=Object(d.a)(e),k=Object(b.a)(e),y=Object(p.a)(e);if(!m.id)return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},k.className),style:{...f.style,...k.style,...y.style}},Object(n.createElement)(j,null));const v=!!m.images.length,S=v?m.images[0]:null,C=r?"a":n.Fragment,x=Object(a.sprintf)(
17
  /* translators: %s is referring to the product name */
18
- Object(a.__)("Link to %s","woo-gutenberg-products-block"),m.name),N={href:m.permalink,...!v&&{"aria-label":x},onClick:()=>{w("product-view-link",{product:m})}};return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},k.className),style:{...f.style,...k.style,...y.style}},Object(n.createElement)(C,r&&N,!!o&&Object(n.createElement)(O.default,{align:s,product:m}),Object(n.createElement)(h,{fallbackAlt:m.name,image:S,onLoad:()=>E(!0),loaded:_,showFullSize:"cropped"!==c})))})},function(e,t,c){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(1),s=c(49),l=c(495),i=c(9);const u={PRISTINE:"pristine",IDLE:"idle",DISABLED:"disabled",PROCESSING:"processing",BEFORE_PROCESSING:"before_processing",AFTER_PROCESSING:"after_processing"},d={status:u.PRISTINE,hasError:!1,quantity:0,processingResponse:null,requestParams:{}},b={SET_PRISTINE:"set_pristine",SET_IDLE:"set_idle",SET_DISABLED:"set_disabled",SET_PROCESSING:"set_processing",SET_BEFORE_PROCESSING:"set_before_processing",SET_AFTER_PROCESSING:"set_after_processing",SET_PROCESSING_RESPONSE:"set_processing_response",SET_HAS_ERROR:"set_has_error",SET_NO_ERROR:"set_no_error",SET_QUANTITY:"set_quantity",SET_REQUEST_PARAMS:"set_request_params"},{SET_PRISTINE:p,SET_IDLE:m,SET_DISABLED:g,SET_PROCESSING:O,SET_BEFORE_PROCESSING:j,SET_AFTER_PROCESSING:h,SET_PROCESSING_RESPONSE:_,SET_HAS_ERROR:E,SET_NO_ERROR:w,SET_QUANTITY:f,SET_REQUEST_PARAMS:k}=b,y=()=>({type:m}),v=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=e?E:w;return{type:t}},{SET_PRISTINE:S,SET_IDLE:C,SET_DISABLED:x,SET_PROCESSING:N,SET_BEFORE_PROCESSING:P,SET_AFTER_PROCESSING:T,SET_PROCESSING_RESPONSE:R,SET_HAS_ERROR:I,SET_NO_ERROR:A,SET_QUANTITY:B,SET_REQUEST_PARAMS:L}=b,{PRISTINE:D,IDLE:V,DISABLED:F,PROCESSING:M,BEFORE_PROCESSING:z,AFTER_PROCESSING:H}=u,q=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,{quantity:c,type:r,data:o}=arguments.length>1?arguments[1]:void 0;switch(r){case S:e=d;break;case C:e=t.status!==V?{...t,status:V}:t;break;case x:e=t.status!==F?{...t,status:F}:t;break;case B:e=c!==t.quantity?{...t,quantity:c}:t;break;case L:e={...t,requestParams:{...t.requestParams,...o}};break;case R:e={...t,processingResponse:o};break;case N:e=t.status!==M?{...t,status:M,hasError:!1}:t,e=!1===e.hasError?e:{...e,hasError:!1};break;case P:e=t.status!==z?{...t,status:z,hasError:!1}:t;break;case T:e=t.status!==H?{...t,status:H}:t;break;case I:e=t.hasError?t:{...t,hasError:!0},e=t.status===M||t.status===z?{...e,status:V}:e;break;case A:e=t.hasError?{...t,hasError:!1}:t}return e!==t&&r!==S&&e.status===D&&(e.status=V),e};var G=c(94),Q=c(242);const Y=e=>({onAddToCartAfterProcessingWithSuccess:Object(Q.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(Q.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(Q.a)("add_to_cart_before_processing",e)});var U=c(243),W=c(102),$=c(37),K=c(116);const J=Object(r.createContext)({product:{},productType:"simple",productIsPurchasable:!0,productHasOptions:!1,supportsFormElements:!0,showFormElements:!1,quantity:0,minQuantity:1,maxQuantity:99,requestParams:{},isIdle:!1,isDisabled:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,eventRegistration:{onAddToCartAfterProcessingWithSuccess:e=>{},onAddToCartAfterProcessingWithError:e=>{},onAddToCartBeforeProcessing:e=>{}},dispatchActions:{resetForm:()=>{},submitForm:()=>{},setQuantity:e=>{},setHasError:e=>{},setAfterProcessing:e=>{},setRequestParams:e=>{}}}),X=()=>Object(r.useContext)(J),Z=e=>{var t,c,o,n;let{children:b,product:m,showFormElements:E}=e;const[w,S]=Object(r.useReducer)(q,d),[C,x]=Object(r.useReducer)(G.b,{}),N=Object(s.a)(C),{createErrorNotice:P}=Object(i.useDispatch)("core/notices"),{setValidationErrors:T}=Object(W.b)(),{isSuccessResponse:R,isErrorResponse:I,isFailResponse:A}=Object($.d)(),B=Object(r.useMemo)(()=>({onAddToCartAfterProcessingWithSuccess:Y(x).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:Y(x).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:Y(x).onAddToCartBeforeProcessing}),[x]),L=Object(r.useMemo)(()=>({resetForm:()=>{S({type:p})},submitForm:()=>{S({type:j})},setQuantity:e=>{S((e=>({type:f,quantity:e}))(e))},setHasError:e=>{S(v(e))},setRequestParams:e=>{S((e=>({type:k,data:e}))(e))},setAfterProcessing:e=>{S({type:_,data:e}),S({type:h})}}),[]);Object(r.useEffect)(()=>{const e=w.status,t=!m.id||!Object(l.a)(m);e!==u.DISABLED||t?e!==u.DISABLED&&t&&S({type:g}):S(y())},[w.status,m,S]),Object(r.useEffect)(()=>{w.status===u.BEFORE_PROCESSING&&(Object(K.a)("error","wc/add-to-cart"),Object(U.a)(N,"add_to_cart_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:c}=e;t&&P(t,{context:"wc/add-to-cart"}),c&&T(c)}),S(y())):S({type:O})}))},[w.status,T,P,S,N,null==m?void 0:m.id]),Object(r.useEffect)(()=>{if(w.status===u.AFTER_PROCESSING){const e={processingResponse:w.processingResponse},t=e=>{let t=!1;return e.forEach(e=>{const{message:c,messageContext:r}=e;(I(e)||A(e))&&c&&(t=!0,P(c,r?{context:r}:void 0))}),t};if(w.hasError)return void Object(U.b)(N,"add_to_cart_after_processing_with_error",e).then(c=>{if(!t(c)){var r;const t=(null===(r=e.processingResponse)||void 0===r?void 0:r.message)||Object(a.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");P(t,{id:"add-to-cart",context:"woocommerce/single-product/"+((null==m?void 0:m.id)||0)})}S(y())});Object(U.b)(N,"add_to_cart_after_processing_with_success",e).then(e=>{t(e)?S(v(!0)):S(y())})}},[w.status,w.hasError,w.processingResponse,L,P,I,A,R,N,null==m?void 0:m.id]);const D=Object(l.b)(m),V={product:m,productType:m.type||"simple",productIsPurchasable:Object(l.a)(m),productHasOptions:m.has_options||!1,supportsFormElements:D,showFormElements:E&&D,quantity:w.quantity||(null==m||null===(t=m.add_to_cart)||void 0===t?void 0:t.minimum)||1,minQuantity:(null==m||null===(c=m.add_to_cart)||void 0===c?void 0:c.minimum)||1,maxQuantity:(null==m||null===(o=m.add_to_cart)||void 0===o?void 0:o.maximum)||99,multipleOf:(null==m||null===(n=m.add_to_cart)||void 0===n?void 0:n.multiple_of)||1,requestParams:w.requestParams,isIdle:w.status===u.IDLE,isDisabled:w.status===u.DISABLED,isProcessing:w.status===u.PROCESSING,isBeforeProcessing:w.status===u.BEFORE_PROCESSING,isAfterProcessing:w.status===u.AFTER_PROCESSING,hasError:w.hasError,eventRegistration:B,dispatchActions:L};return Object(r.createElement)(J.Provider,{value:V},b)};var ee=c(13),te=c.n(ee),ce=c(14),re=c(240),oe=c(41),ne=()=>{const{dispatchActions:e,product:t,quantity:c,eventRegistration:o,hasError:n,isProcessing:s,requestParams:l}=X(),{hasValidationErrors:u,showAllValidationErrors:d}=Object(W.b)(),{createErrorNotice:b,removeNotice:p}=Object(i.useDispatch)("core/notices"),{receiveCart:m}=Object(oe.a)(),[g,O]=Object(r.useState)(!1),j=!n&&s,h=Object(r.useCallback)(()=>!u||(d(),{type:"error"}),[u,d]);Object(r.useEffect)(()=>{const e=o.onAddToCartBeforeProcessing(h,0);return()=>{e()}},[o,h]);const _=Object(r.useCallback)(()=>{O(!0),p("add-to-cart","woocommerce/single-product/"+((null==t?void 0:t.id)||0));const r={id:t.id||0,quantity:c,...l};te()({path:"/wc/store/v1/cart/add-item",method:"POST",data:r,cache:"no-store",parse:!1}).then(c=>{te.a.setNonce(c.headers),c.json().then((function(r){c.ok?m(r):(r.body&&r.body.message?b(Object(ce.decodeEntities)(r.body.message),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}):b(Object(a.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block"),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}),e.setHasError()),Object(re.b)({preserveCartData:!0}),e.setAfterProcessing(r),O(!1)}))}).catch(t=>{t.json().then((function(t){var c;null!==(c=t.data)&&void 0!==c&&c.cart&&m(t.data.cart),e.setHasError(),e.setAfterProcessing(t),O(!1)}))})},[t,b,p,m,e,c,l]);return Object(r.useEffect)(()=>{j&&!g&&_()},[j,_,g]),null};const ae=e=>{let{children:t,product:c,showFormElements:o}=e;return Object(r.createElement)(W.a,null,Object(r.createElement)(Z,{product:c,showFormElements:o},t,Object(r.createElement)(ne,null)))};var se=c(30),le=c(7),ie=c(58),ue=(c(288),c(68)),de=c(113),be=c(525),pe=c(78),me=c(344);const ge=e=>{let{className:t,href:c,text:o,onClick:n}=e;return Object(r.createElement)(ue.a,{className:t,href:c,onClick:n,rel:"nofollow"},o)},Oe=e=>{let{className:t,quantityInCart:c,isProcessing:o,isDisabled:n,isDone:s,onClick:l}=e;return Object(r.createElement)(ue.a,{className:t,disabled:n,showSpinner:o,onClick:l},s&&c>0?Object(a.sprintf)(
19
  /* translators: %s number of products in cart. */
20
- Object(a._n)("%d in cart","%d in cart",c,"woo-gutenberg-products-block"),c):Object(a.__)("Add to cart","woo-gutenberg-products-block"),!!s&&Object(r.createElement)(de.a,{icon:be.a}))};var je=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:c,product:o,productType:n,isDisabled:s,isProcessing:l,eventRegistration:i,hasError:u,dispatchActions:d}=X(),{parentName:b}=Object(se.useInnerBlockLayoutContext)(),{dispatchStoreEvent:p}=Object(pe.a)(),{cartQuantity:m}=Object(me.a)(o.id||0),[g,O]=Object(r.useState)(!1),j=o.add_to_cart||{url:"",text:""};return Object(r.useEffect)(()=>{const e=i.onAddToCartAfterProcessingWithSuccess(()=>(u||O(!0),!0),0);return()=>{e()}},[i,u]),(e||!c&&"simple"===n)&&t?Object(r.createElement)(Oe,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:m,isDisabled:s,isProcessing:l,isDone:g,onClick:()=>{d.submitForm("woocommerce/single-product/"+((null==o?void 0:o.id)||0)),p("cart-add-item",{product:o,listName:b})}}):Object(r.createElement)(ge,{className:"wc-block-components-product-add-to-cart-button",href:j.url,text:j.text||Object(a.__)("View Product","woo-gutenberg-products-block"),onClick:()=>{p("product-view-link",{product:o,listName:b})}})},he=c(112),_e=e=>{let{disabled:t,min:c,max:o,step:n=1,value:a,onChange:s}=e;const l=void 0!==o,i=Object(he.a)(e=>{let t=e;l&&(t=Math.min(t,Math.floor(o/n)*n)),t=Math.max(t,Math.ceil(c/n)*n),t=Math.floor(t/n)*n,t!==e&&s(t)},300);return Object(r.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:a,min:c,max:o,step:n,hidden:1===o,disabled:t,onChange:e=>{s(e.target.value),i(e.target.value)}})},Ee=e=>{let{reason:t=Object(a.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block")}=e;return Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},t)},we=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:o,multipleOf:n,dispatchActions:s,isDisabled:l}=X();return e.id&&!e.is_purchasable?Object(r.createElement)(Ee,null):e.id&&!e.is_in_stock?Object(r.createElement)(Ee,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(_e,{value:t,min:c,max:o,step:n,disabled:l,onChange:s.setQuantity}),Object(r.createElement)(je,null))},fe=(c(343),c(542)),ke=c(12),ye=c(225);const ve={value:"",label:Object(a.__)("Select an option","woo-gutenberg-products-block")};var Se=e=>{let{attributeName:t,options:c=[],value:o="",onChange:s=(()=>{}),errorMessage:l=Object(a.__)("Please select a value.","woo-gutenberg-products-block")}=e;const{getValidationError:i,setValidationErrors:u,clearValidationError:d}=Object(W.b)(),b=t,p=i(b)||{};return Object(ke.useEffect)(()=>{o?d(b):u({[b]:{message:l,hidden:!0}})},[o,b,l,d,u]),Object(ke.useEffect)(()=>()=>{d(b)},[b,d]),Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(r.createElement)(fe.a,{label:Object(ce.decodeEntities)(t),value:o||"",options:[ve,...c],onChange:s,required:!0,className:n()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":p.message&&!p.hidden})}),Object(r.createElement)(ye.a,{propertyName:b,elementId:b}))},Ce=c(35);const xe=(e,t,c)=>{const r=Object.values(t).map(e=>{let{id:t}=e;return t});if(Object.values(c).every(e=>""===e))return r;const o=Object.keys(e);return r.filter(e=>o.every(r=>{const o=c[r]||"",n=t["id:"+e].attributes[r];return""===o||null===n||n===o}))};var Ne=e=>{let{attributes:t,variationAttributes:c,setRequestParams:o}=e;const n=Object(s.a)(t),a=Object(s.a)(c),[l,i]=Object(r.useState)(0),[u,d]=Object(r.useState)({}),[b,p]=Object(r.useState)(!1),m=Object(r.useMemo)(()=>((e,t,c)=>{const r={},o=Object.keys(e),n=Object.values(c).filter(Boolean).length>0;return o.forEach(o=>{const a=e[o],s={...c,[o]:null},l=n?xe(e,t,s):null,i=null!==l?l.map(e=>t["id:"+e].attributes[o]):null;r[o]=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(e).map(e=>{let{name:c,slug:r}=e;return null===t||t.includes(null)||t.includes(r)?{value:r,label:Object(ce.decodeEntities)(c)}:null}).filter(Boolean)}(a.terms,i)}),r})(n,a,u),[u,n,a]);return Object(r.useEffect)(()=>{if(!b){const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Object(Ce.a)(e))return{};const t=Object.keys(e),c={};return 0===t.length||t.forEach(t=>{const r=e[t],o=r.terms.filter(e=>e.default);var n;o.length>0&&(c[r.name]=null===(n=o[0])||void 0===n?void 0:n.slug)}),c}(t);e&&d({...e}),p(!0)}},[u,t,b]),Object(r.useEffect)(()=>{Object.values(u).filter(e=>""!==e).length===Object.keys(n).length?i(((e,t,c)=>xe(e,t,c)[0]||0)(n,a,u)):l>0&&i(0)},[u,l,n,a]),Object(r.useEffect)(()=>{o({id:l,variation:Object.keys(u).map(e=>({attribute:e,value:u[e]}))})},[o,l,u]),Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(n).map(e=>Object(r.createElement)(Se,{key:e,attributeName:e,options:m[e],value:u[e],onChange:t=>{d({...u,[e]:t})}})))},Pe=e=>{let{product:t,dispatchers:c}=e;const o=(e=>e?Object(le.keyBy)(Object.values(e).filter(e=>{let{has_variations:t}=e;return t}),"name"):{})(t.attributes),n=(e=>{if(!e)return{};const t={};return e.forEach(e=>{let{id:c,attributes:r}=e;t["id:"+c]={id:c,attributes:r.reduce((e,t)=>{let{name:c,value:r}=t;return e[c]=r,e},{})}}),t})(t.variations);return 0===Object.keys(o).length||0===n.length?null:Object(r.createElement)(Ne,{attributes:o,variationAttributes:n,setRequestParams:c.setRequestParams})},Te=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:o,multipleOf:n,dispatchActions:s,isDisabled:l}=X();return e.id&&!e.is_purchasable?Object(r.createElement)(Ee,null):e.id&&!e.is_in_stock?Object(r.createElement)(Ee,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Pe,{product:e,dispatchers:s}),Object(r.createElement)(_e,{value:t,min:c,max:o,step:n,disabled:l,onChange:s.setQuantity}),Object(r.createElement)(je,null))},Re=()=>Object(r.createElement)(je,null),Ie=c(527),Ae=()=>Object(r.createElement)(Ie.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element."),Be=()=>Object(r.createElement)(Ae,null);const Le=()=>{const{showFormElements:e,productType:t}=X();return e?"variable"===t?Object(r.createElement)(Te,null):"grouped"===t?Object(r.createElement)(Be,null):"external"===t?Object(r.createElement)(Re,null):"simple"===t||"variation"===t?Object(r.createElement)(we,null):null:Object(r.createElement)(je,null)};t.a=Object(ie.withProductDataContext)(e=>{let{className:t,showFormElements:c}=e;const{product:o}=Object(se.useProductDataContext)(),a=n()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(le.isEmpty)(o)});return Object(r.createElement)(ae,{product:o,showFormElements:c},Object(r.createElement)("div",{className:a},Object(r.createElement)(Le,null)))})},,,,,,,,,,function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(4),n=c.n(o),a=c(92),s=c(26),l=c(30),i=c(138),u=c(123),d=c(58);t.default=Object(d.withProductDataContext)(e=>{var t,c;const{className:o,textAlign:d}=e,{parentClassName:b}=Object(l.useInnerBlockLayoutContext)(),{product:p}=Object(l.useProductDataContext)(),m=Object(i.a)(e),g=Object(u.a)(e),O=n()("wc-block-components-product-price",o,m.className,{[b+"__product-price"]:b}),j={...g.style,...m.style};if(!p.id)return Object(r.createElement)(a.a,{align:d,className:O});const h=p.prices,_=Object(s.getCurrencyFromPriceResponse)(h),E=h.price!==h.regular_price,w=n()({[b+"__product-price__value"]:b,[b+"__product-price__value--on-sale"]:E});return Object(r.createElement)(a.a,{align:d,className:O,priceStyle:j,regularPriceStyle:j,priceClassName:w,currency:_,price:h.price,minPrice:null==h||null===(t=h.price_range)||void 0===t?void 0:t.min_amount,maxPrice:null==h||null===(c=h.price_range)||void 0===c?void 0:c.max_amount,regularPrice:h.regular_price,regularPriceClassName:n()({[b+"__product-price__regular"]:b})})})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(30),l=c(138),i=c(123),u=c(219),d=c(58);c(336);t.default=Object(d.withProductDataContext)(e=>{const{parentClassName:t}=Object(s.useInnerBlockLayoutContext)(),{product:c}=Object(s.useProductDataContext)(),n=(e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0})(c),d=Object(l.a)(e),b=Object(i.a)(e),p=Object(u.a)(e);if(!n)return null;const m={width:n/5*100+"%"},g=Object(o.sprintf)(
21
  /* translators: %f is referring to the average rating value */
22
  Object(o.__)("Rated %f out of 5","woo-gutenberg-products-block"),n),O=(e=>{const t=parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0})(c),j={__html:Object(o.sprintf)(
23
  /* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
24
- Object(o._n)("Rated %1$s out of 5 based on %2$s customer rating","Rated %1$s out of 5 based on %2$s customer ratings",O,"woo-gutenberg-products-block"),Object(o.sprintf)('<strong class="rating">%f</strong>',n),Object(o.sprintf)('<span class="rating">%d</span>',O))};return Object(r.createElement)("div",{className:a()(d.className,"wc-block-components-product-rating",{[t+"__product-rating"]:t}),style:{...d.style,...b.style,...p.style}},Object(r.createElement)("div",{className:a()("wc-block-components-product-rating__stars",t+"__product-rating__stars"),role:"img","aria-label":g},Object(r.createElement)("span",{style:m,dangerouslySetInnerHTML:j})))})},function(e,t,c){"use strict";c.r(t);var r=c(6),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(1),i=c(78),u=c(344),d=c(138),b=c(223),p=c(123),m=c(219),g=c(14),O=c(23),j=c(2),h=c(30),_=c(58);c(337);const E=e=>{let{product:t,colorStyles:c,borderStyles:r,typographyStyles:a,spacingStyles:d}=e;const{id:b,permalink:p,add_to_cart:m,has_options:h,is_purchasable:_,is_in_stock:E}=t,{dispatchStoreEvent:w}=Object(i.a)(),{cartQuantity:f,addingToCart:k,addToCart:y}=Object(u.a)(b,"woocommerce/single-product/"+(b||0)),v=Number.isFinite(f)&&f>0,S=!h&&_&&E,C=Object(g.decodeEntities)((null==m?void 0:m.description)||""),x=v?Object(l.sprintf)(
25
  /* translators: %s number of products in cart. */
26
- Object(l._n)("%d in cart","%d in cart",f,"woo-gutenberg-products-block"),f):Object(g.decodeEntities)((null==m?void 0:m.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),N=S?"button":"a",P={};return S?P.onClick=async()=>{await y(),w("cart-add-item",{product:t});const{cartRedirectAfterAdd:e}=Object(j.getSetting)("productsSettings");e&&(window.location.href=O.d)}:(P.href=p,P.rel="nofollow",P.onClick=()=>{w("product-view-link",{product:t})}),Object(n.createElement)(N,o()({"aria-label":C,className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",c.className,r.className,{loading:k,added:v}),style:{...c.style,...r.style,...a.style,...d.style},disabled:k},P),x)},w=e=>{let{colorStyles:t,borderStyles:c,typographyStyles:r,spacingStyles:o}=e;return Object(n.createElement)("button",{className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder",t.className,c.className),style:{...t.style,...c.style,...r.style,...o.style},disabled:!0})};t.default=Object(_.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(h.useInnerBlockLayoutContext)(),{product:r}=Object(h.useProductDataContext)(),o=Object(d.a)(e),a=Object(b.a)(e),l=Object(p.a)(e),i=Object(m.a)(e);return Object(n.createElement)("div",{className:s()(t,"wp-block-button","wc-block-components-product-button",{[c+"__product-add-to-cart"]:c})},r.id?Object(n.createElement)(E,{product:r,colorStyles:o,borderStyles:a,typographyStyles:l,spacingStyles:i}):Object(n.createElement)(w,{colorStyles:o,borderStyles:a,typographyStyles:l,spacingStyles:i}))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(4),n=c.n(o),a=c(117),s=c(23),l=c(30),i=c(138),u=c(123),d=c(58);c(338),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(l.useInnerBlockLayoutContext)(),{product:o}=Object(l.useProductDataContext)(),d=Object(i.a)(e),b=Object(u.a)(e);if(!o)return Object(r.createElement)("div",{className:n()(t,"wc-block-components-product-summary",{[c+"__product-summary"]:c})});const p=o.short_description?o.short_description:o.description;return p?Object(r.createElement)(a.a,{className:n()(t,d.className,"wc-block-components-product-summary",{[c+"__product-summary"]:c}),source:p,maxLength:150,countType:s.o.wordCountType||"words",style:{...d.style,...b.style}}):null})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(30),l=c(58);c(339),t.default=Object(l.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),l=n.sku;return l?Object(r.createElement)("div",{className:a()(t,"wc-block-components-product-sku",{[c+"__product-sku"]:c})},Object(o.__)("SKU:","woo-gutenberg-products-block")," ",Object(r.createElement)("strong",null,l)):null})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(30),l=c(138),i=c(123),u=c(7),d=c(58);c(340),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),d=Object(l.a)(e),b=Object(i.a)(e);return Object(u.isEmpty)(n.categories)?null:Object(r.createElement)("div",{className:a()(t,"wc-block-components-product-category-list",d.className,{[c+"__product-category-list"]:c}),style:{...d.style,...b.style}},Object(o.__)("Categories:","woo-gutenberg-products-block")," ",Object(r.createElement)("ul",null,Object.values(n.categories).map(e=>{let{name:t,link:c,slug:o}=e;return Object(r.createElement)("li",{key:"category-list-item-"+o},Object(r.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(30),l=c(138),i=c(123),u=c(7),d=c(58);c(341),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),d=Object(l.a)(e),b=Object(i.a)(e);return Object(u.isEmpty)(n.tags)?null:Object(r.createElement)("div",{className:a()(t,d.className,"wc-block-components-product-tag-list",{[c+"__product-tag-list"]:c}),style:{...d.style,...b.style}},Object(o.__)("Tags:","woo-gutenberg-products-block")," ",Object(r.createElement)("ul",null,Object.values(n.tags).map(e=>{let{name:t,link:c,slug:o}=e;return Object(r.createElement)("li",{key:"tag-list-item-"+o},Object(r.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(30),l=c(138),i=c(123),u=c(58);c(342);t.default=Object(u.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),u=Object(l.a)(e),d=Object(i.a)(e);if(!n.id||!n.is_purchasable)return null;const b=!!n.is_in_stock,p=n.low_stock_remaining,m=n.is_on_backorder;return Object(r.createElement)("div",{className:a()(t,u.className,"wc-block-components-product-stock-indicator",{[c+"__stock-indicator"]:c,"wc-block-components-product-stock-indicator--in-stock":b,"wc-block-components-product-stock-indicator--out-of-stock":!b,"wc-block-components-product-stock-indicator--low-stock":!!p,"wc-block-components-product-stock-indicator--available-on-backorder":!!m}),style:{...u.style,...d.style}},p?(e=>Object(o.sprintf)(
27
  /* translators: %d stock amount (number of items in stock for product) */
28
- Object(o.__)("%d left in stock","woo-gutenberg-products-block"),e))(p):((e,t)=>t?Object(o.__)("Available on backorder","woo-gutenberg-products-block"):e?Object(o.__)("In Stock","woo-gutenberg-products-block"):Object(o.__)("Out of Stock","woo-gutenberg-products-block"))(b,m))})},,,,,,,,,,,,,,,,,,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return i}));var r=c(0),o=c(9),n=c(17),a=c(14),s=c(41);const l=(e,t)=>{const c=e.find(e=>{let{id:c}=e;return c===t});return c?c.quantity:0},i=e=>{const{addItemToCart:t}=Object(o.useDispatch)(n.CART_STORE_KEY),{cartItems:c,cartIsLoading:i}=Object(s.a)(),{createErrorNotice:u,removeNotice:d}=Object(o.useDispatch)("core/notices"),[b,p]=Object(r.useState)(!1),m=Object(r.useRef)(l(c,e));return Object(r.useEffect)(()=>{const t=l(c,e);t!==m.current&&(m.current=t)},[c,e]),{cartQuantity:Number.isFinite(m.current)?m.current:0,addingToCart:b,cartIsLoading:i,addToCart:function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return p(!0),t(e,c).then(()=>{d("add-to-cart")}).catch(e=>{u(Object(a.decodeEntities)(e.message),{id:"add-to-cart",context:"wc/all-products",isDismissible:!0})}).finally(()=>{p(!1)})}}}},,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(1),o=c(23);const n=[{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:Object(r.__)("Fly your WordPress banner with this beauty! Deck out your office space or add it to your kids walls. This banner will spruce up any space it’s hung!","woo-gutenberg-products-block"),description:"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",price:"7.99",price_html:'<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>7.99</span>',images:[{id:1,src:o.m+"previews/pennant.jpg",thumbnail:o.m+"previews/pennant.jpg",name:"pennant-1.jpg",alt:"WordPress Pennant",srcset:"",sizes:""}],average_rating:5,categories:[{id:1,name:"Decor",slug:"decor",link:"https://example.org"}],review_count:1,prices:{currency_code:"GBP",decimal_separator:".",thousand_separator:",",decimals:2,price_prefix:"£",price_suffix:"",price:"7.99",regular_price:"9.99",sale_price:"7.99",price_range:null},add_to_cart:{text:Object(r.__)("Add to cart","woo-gutenberg-products-block"),description:Object(r.__)("Add to cart","woo-gutenberg-products-block")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}]},,,,,,,,,,function(e,t,c){e.exports=c(459)},function(e,t){},function(e,t){},function(e,t){},,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.r(t),c.d(t,"metadata",(function(){return ot})),c.d(t,"name",(function(){return Zt}));var r=c(0),o=c(8),n=c(113),a=c(517),s=c(95),l=c(1),i=c(4),u=c.n(i),d={category:"woocommerce-product-elements",keywords:[Object(l.__)("WooCommerce","woo-gutenberg-products-block")],icon:{src:Object(r.createElement)(n.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},supports:{html:!1},parent:Object(s.a)()?void 0:["@woocommerce/all-products","@woocommerce/single-product"],save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",{className:u()("is-loading",t.className)})},deprecated:[{attributes:{},save:()=>null}]},b=c(289),p=c(3),m=c(10),g=c(5),O=c(99),j=c(290),h=c(93),_=c(142),E=c(30);c(379);var w=e=>t=>c=>{const o=Object(E.useProductDataContext)(),{attributes:n,setAttributes:a}=c,{productId:s}=n,[i,u]=Object(r.useState)(!s);return o.hasContext?Object(r.createElement)(t,c):Object(r.createElement)(r.Fragment,null,i?Object(r.createElement)(p.Placeholder,{icon:e.icon||"",label:e.label||"",className:"wc-atomic-blocks-product"},!!e.description&&Object(r.createElement)("div",null,e.description),Object(r.createElement)("div",{className:"wc-atomic-blocks-product__selection"},Object(r.createElement)(h.a,{selected:s||0,showVariations:!0,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];a({productId:e[0]?e[0].id:0})}}),Object(r.createElement)(p.Button,{isSecondary:!0,disabled:!s,onClick:()=>{u(!1)}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(g.BlockControls,null,Object(r.createElement)(p.ToolbarGroup,null,Object(r.createElement)(_.a,{onClick:()=>u(!0)},Object(l.__)("Switch product…","woo-gutenberg-products-block")))),Object(r.createElement)(t,c)))},f=c(518);const k=Object(l.__)("Product Title","woo-gutenberg-products-block"),y=Object(r.createElement)(n.a,{icon:f.a,className:"wc-block-editor-components-block-icon"}),v=Object(l.__)("Display the title of a product.","woo-gutenberg-products-block");c(380);const S=e=>{let{attributes:t,setAttributes:c}=e;const o=Object(g.useBlockProps)(),{headingLevel:n,showProductLink:a,align:i,linkTarget:u}=t;return Object(r.createElement)("div",o,Object(r.createElement)(g.BlockControls,null,Object(r.createElement)(O.a,{isCollapsed:!0,minLevel:1,maxLevel:7,selectedLevel:n,onChange:e=>c({headingLevel:e})}),Object(s.b)()&&Object(r.createElement)(g.AlignmentToolbar,{value:i,onChange:e=>{c({align:e})}})),Object(r.createElement)(g.InspectorControls,null,Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Link settings","woo-gutenberg-products-block")},Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Make title a link","woo-gutenberg-products-block"),checked:a,onChange:()=>c({showProductLink:!a})}),a&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Open in new tab","woo-gutenberg-products-block"),onChange:e=>c({linkTarget:e?"_blank":"_self"}),checked:"_blank"===u})))),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(j.a,t)))};var C=Object(s.b)()?Object(m.compose)([w({icon:y,label:k,description:Object(l.__)("Choose a product to display its title.","woo-gutenberg-products-block")})])(S):S;const x=e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))};var N=c(121);const P={...d,apiVersion:2,title:k,description:v,icon:{src:y},attributes:b.a,edit:C,save:x,supports:{...d.supports,...Object(s.b)()&&{typography:{fontSize:!0,lineHeight:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0},color:{text:!0,background:!0,link:!1,gradients:!0,__experimentalSkipSerialization:!0},...Object(N.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-title"}}};Object(o.registerBlockType)("woocommerce/product-title",P);var T=c(304),R=c(519);const I=Object(l.__)("Product Price","woo-gutenberg-products-block"),A=Object(r.createElement)(n.a,{icon:R.a,className:"wc-block-editor-components-block-icon"}),B=Object(l.__)("Display the price of a product.","woo-gutenberg-products-block");var L=w({icon:A,label:I,description:Object(l.__)("Choose a product to display its price.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const o=Object(g.useBlockProps)();return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(g.BlockControls,null,Object(s.b)()&&Object(r.createElement)(g.AlignmentToolbar,{value:t.textAlign,onChange:e=>{c({textAlign:e})}})),Object(r.createElement)("div",o,Object(r.createElement)(T.default,t)))});let D={productId:{type:"number",default:0}};Object(s.b)()&&(D={...D,textAlign:{type:"string"}});var V=D;const F={...d,apiVersion:2,title:I,description:B,icon:{src:A},attributes:V,edit:L,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))},supports:{...d.supports,...Object(s.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-price"}}};Object(o.registerBlockType)("woocommerce/product-price",F);var M=c(291);const z={...Object(s.b)()&&{__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(N.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-image"}};var H=c(2),q=c(292),G=c(520);const Q=Object(l.__)("Product Image","woo-gutenberg-products-block"),Y=Object(r.createElement)(n.a,{icon:G.a,className:"wc-block-editor-components-block-icon"}),U=Object(l.__)("Display the main product image","woo-gutenberg-products-block");var W=w({icon:Y,label:Q,description:Object(l.__)("Choose a product to display its image.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{showProductLink:o,imageSizing:n,showSaleBadge:a,saleBadgeAlign:s}=t,i=Object(g.useBlockProps)();return Object(r.createElement)("div",i,Object(r.createElement)(g.InspectorControls,null,Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Content","woo-gutenberg-products-block")},Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(l.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:o,onChange:()=>c({showProductLink:!o})}),Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Show On-Sale Badge","woo-gutenberg-products-block"),help:Object(l.__)('Overlay a "sale" badge if the product is on-sale.',"woo-gutenberg-products-block"),checked:a,onChange:()=>c({showSaleBadge:!a})}),a&&Object(r.createElement)(p.__experimentalToggleGroupControl,{label:Object(l.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:s,onChange:e=>c({saleBadgeAlign:e})},Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"left",label:Object(l.__)("Left","woo-gutenberg-products-block")}),Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"center",label:Object(l.__)("Center","woo-gutenberg-products-block")}),Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"right",label:Object(l.__)("Right","woo-gutenberg-products-block")})),Object(r.createElement)(p.__experimentalToggleGroupControl,{label:Object(l.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(r.createInterpolateElement)(Object(l.__)("Product image cropping can be modified in the <a>Customizer</a>.","woo-gutenberg-products-block"),{a:Object(r.createElement)("a",{href:Object(H.getAdminLink)("customize.php")+"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images",target:"_blank",rel:"noopener noreferrer"})}),value:n,onChange:e=>c({imageSizing:e})},Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"full-size",label:Object(l.__)("Full Size","woo-gutenberg-products-block")}),Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"cropped",label:Object(l.__)("Cropped","woo-gutenberg-products-block")})))),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(q.a,t)))});const $={apiVersion:2,title:Q,description:U,icon:{src:Y},attributes:M.a,edit:W,supports:z,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(o.registerBlockType)("woocommerce/product-image",{...d,...$});var K=c(305),J=c(513);const X=Object(l.__)("Product Rating","woo-gutenberg-products-block"),Z=Object(r.createElement)(n.a,{icon:J.a,className:"wc-block-editor-components-block-icon"}),ee=Object(l.__)("Display the average rating of a product.","woo-gutenberg-products-block");var te=w({icon:Z,label:X,description:Object(l.__)("Choose a product to display its rating.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)({className:"wp-block-woocommerce-product-rating"});return Object(r.createElement)("div",c,Object(r.createElement)(K.default,t))});const ce={apiVersion:2,title:X,description:ee,icon:{src:Z},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(N.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-rating"}},edit:te,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(o.registerBlockType)("woocommerce/product-rating",{...d,...ce});var re=c(306),oe=c(521);const ne=Object(l.__)("Add to Cart Button","woo-gutenberg-products-block"),ae=Object(r.createElement)(n.a,{icon:oe.a,className:"wc-block-editor-components-block-icon"}),se=Object(l.__)("Display a call to action button which either adds the product to the cart, or links to the product page.","woo-gutenberg-products-block");var le=w({icon:ae,label:ne,description:Object(l.__)("Choose a product to display its add to cart button.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(p.Disabled,null,Object(r.createElement)(re.default,t)))});const ie={apiVersion:2,title:ne,description:se,icon:{src:ae},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},...Object(N.a)()&&{spacing:{padding:!0,__experimentalSkipSerialization:!0}},typography:{fontSize:!0,__experimentalFontWeight:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button"}},edit:le,save:x};Object(o.registerBlockType)("woocommerce/product-button",{...d,...ie});var ue=c(307),de=c(522);const be=Object(l.__)("Product Summary","woo-gutenberg-products-block"),pe=Object(r.createElement)(n.a,{icon:de.a,className:"wc-block-editor-components-block-icon"}),me=Object(l.__)("Display a short description about a product.","woo-gutenberg-products-block");c(381);var ge=w({icon:pe,label:be,description:Object(l.__)("Choose a product to display its short description.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(ue.default,t))});const Oe={apiVersion:2,title:be,description:me,icon:{src:pe},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-summary"}},edit:ge,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(o.registerBlockType)("woocommerce/product-summary",{...d,...Oe});var je=c(220),he=c(511);const _e=Object(l.__)("On-Sale Badge","woo-gutenberg-products-block"),Ee=Object(r.createElement)(n.a,{icon:he.a,className:"wc-block-editor-components-block-icon"}),we=Object(l.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block");var fe=w({icon:Ee,label:_e,description:Object(l.__)("Choose a product to display its sale-badge.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(je.default,t))});const ke={title:_e,description:we,icon:{src:Ee},apiVersion:2,supports:{html:!1,...Object(s.b)()&&{color:{gradients:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSkipSerialization:!0},...Object(N.a)()&&{spacing:{padding:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-sale-badge"}},attributes:{productId:{type:"number",default:0}},edit:fe,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(o.registerBlockType)("woocommerce/product-sale-badge",{...d,...ke});var ye=c(103),ve=c(308),Se=c(11),Ce=Object(r.createElement)(Se.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)("path",{d:"M2 6h2v12H2V6m3 0h1v12H5V6m2 0h3v12H7V6m4 0h1v12h-1V6m3 0h2v12h-2V6m3 0h3v12h-3V6m4 0h1v12h-1V6z"}));const xe=Object(l.__)("Product SKU","woo-gutenberg-products-block"),Ne=Object(r.createElement)(n.a,{icon:Ce,className:"wc-block-editor-components-block-icon"}),Pe={title:xe,description:Object(l.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:Ne},attributes:{productId:{type:"number",default:0}},edit:w({icon:Ne,label:xe,description:Object(l.__)("Choose a product to display its SKU.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(ye.a,null),Object(r.createElement)(ve.default,t))})};Object(s.c)("woocommerce/product-sku",{...d,...Pe});var Te=c(309),Re=c(523);const Ie=Object(l.__)("Product Category List","woo-gutenberg-products-block"),Ae=Object(r.createElement)(n.a,{icon:Re.a,className:"wc-block-editor-components-block-icon"}),Be=Object(l.__)("Display a list of categories belonging to a product.","woo-gutenberg-products-block");var Le=w({icon:Ae,label:Ie,description:Object(l.__)("Choose a product to display its categories.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(ye.a,null),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(Te.default,t)))});const De={...d,apiVersion:2,title:Ie,description:Be,icon:{src:Ae},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,link:!0,background:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-category-list"}},save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))},edit:Le};Object(s.c)("woocommerce/product-category-list",De);var Ve=c(310),Fe=c(516);const Me=Object(l.__)("Product Tag List","woo-gutenberg-products-block"),ze=Object(r.createElement)(n.a,{icon:Fe.a,className:"wc-block-editor-components-block-icon"}),He=Object(l.__)("Display a list of tags belonging to a product.","woo-gutenberg-products-block");var qe=w({icon:ze,label:Me,description:Object(l.__)("Choose a product to display its tags.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(ye.a,null),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(Ve.default,t)))});const Ge={apiVersion:2,title:Me,description:He,icon:{src:ze},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!0},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-tag-list"}},edit:qe,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(s.c)("woocommerce/product-tag-list",{...d,...Ge});var Qe=c(311),Ye=c(524);const Ue=Object(l.__)("Product Stock Indicator","woo-gutenberg-products-block"),We=Object(r.createElement)(n.a,{icon:Ye.a,className:"wc-block-editor-components-block-icon"}),$e=Object(l.__)("Display product stock status.","woo-gutenberg-products-block");var Ke=w({icon:We,label:Ue,description:Object(l.__)("Choose a product to display its stock.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(ye.a,null),Object(r.createElement)(Qe.default,t))});const Je={apiVersion:2,title:Ue,description:$e,icon:{src:We},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-stock-indicator"}},edit:Ke,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(s.c)("woocommerce/product-stock-indicator",{...d,...Je});var Xe=c(495),Ze=(c(288),c(294)),et=c(248);const tt=Object(l.__)("Add to Cart","woo-gutenberg-products-block"),ct=Object(r.createElement)(n.a,{icon:et.a,className:"wc-block-editor-components-block-icon"}),rt={title:tt,description:Object(l.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:ct},edit:w({icon:ct,label:tt,description:Object(l.__)("Choose a product to display its add to cart form.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{product:o}=Object(E.useProductDataContext)(),{className:n,showFormElements:a}=t;return Object(r.createElement)("div",{className:u()(n,"wc-block-components-product-add-to-cart")},Object(r.createElement)(ye.a,{productId:o.id}),Object(r.createElement)(g.InspectorControls,null,Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Layout","woo-gutenberg-products-block")},Object(Xe.b)(o)?Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Display form elements","woo-gutenberg-products-block"),help:Object(l.__)("Depending on product type, allow customers to select a quantity, variations etc.","woo-gutenberg-products-block"),checked:a,onChange:()=>c({showFormElements:!a})}):Object(r.createElement)(p.Notice,{className:"wc-block-components-product-add-to-cart-notice",isDismissible:!1,status:"info"},Object(l.__)("This product does not support the block based add to cart form. A link to the product page will be shown instead.","woo-gutenberg-products-block")))),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(Ze.a,t)))}),attributes:c(293).a};Object(s.c)("woocommerce/product-add-to-cart",{...d,...rt});var ot=c(206),nt=c(6),at=c.n(nt);const st=(e,t)=>{const{className:c,contentVisibility:r}=t;return u()(e,c,{"has-image":r&&r.image,"has-title":r&&r.title,"has-rating":r&&r.rating,"has-price":r&&r.price,"has-button":r&&r.button})},{attributes:lt}=ot;var it=[{attributes:Object.assign({},lt,{rows:{type:"number",default:1}}),save(e){let{attributes:t}=e;const c={"data-attributes":JSON.stringify(t)};return Object(r.createElement)("div",at()({className:st("wc-block-all-products",t)},c),Object(r.createElement)(g.InnerBlocks.Content,null))}}],ut=c(24),dt=c.n(ut),bt=c(9),pt=c(63),mt=c(487),gt=c(368),Ot=c(23),jt=c(239);const ht=[["woocommerce/product-image",{imageSizing:"cropped"}],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],_t=e=>e&&0!==e.length?e.map(e=>[e.name,{...e.attributes,product:void 0,children:e.innerBlocks.length>0?_t(e.innerBlocks):[]}]):[];var Et=c(12),wt=c(7),ft=c(28);c(387);var kt=e=>{let{currentPage:t,displayFirstAndLastPages:c=!0,displayNextAndPreviousArrows:o=!0,pagesToDisplay:n=3,onPageChange:a,totalPages:s}=e,{minIndex:i,maxIndex:d}=((e,t,c)=>{if(c<=2)return{minIndex:null,maxIndex:null};const r=e-1,o=Math.max(Math.floor(t-r/2),2),n=Math.min(Math.ceil(t+(r-(t-o))),c-1);return{minIndex:Math.max(Math.floor(t-(r-(n-t))),2),maxIndex:n}})(n,t,s);const b=c&&Boolean(1!==i),p=c&&Boolean(d!==s),m=c&&Boolean(i&&i>3),g=c&&Boolean(d&&d<s-2);b&&3===i&&(i-=1),p&&d===s-2&&(d+=1);const O=[];if(i&&d)for(let e=i;e<=d;e++)O.push(e);return Object(r.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(r.createElement)(ft.a,{screenReaderLabel:Object(l.__)("Navigate to another page","woo-gutenberg-products-block")}),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>a(t-1),title:Object(l.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(r.createElement)(ft.a,{label:"←",screenReaderLabel:Object(l.__)("Previous page","woo-gutenberg-products-block")})),b&&Object(r.createElement)("button",{className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:()=>a(1),disabled:1===t},Object(r.createElement)(ft.a,{label:"1",screenReaderLabel:Object(l.sprintf)(
29
  /* translators: %d is the page number (1, 2, 3...). */
30
- Object(l.__)("Page %d","woo-gutenberg-products-block"),1)})),m&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(l.__)("…","woo-gutenberg-products-block")),O.map(e=>Object(r.createElement)("button",{key:e,className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?void 0:()=>a(e),disabled:t===e},Object(r.createElement)(ft.a,{label:e.toString(),screenReaderLabel:Object(l.sprintf)(
31
  /* translators: %d is the page number (1, 2, 3...). */
32
- Object(l.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(l.__)("…","woo-gutenberg-products-block")),p&&Object(r.createElement)("button",{className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===s,"wc-block-components-pagination__page--active":t===s}),onClick:()=>a(s),disabled:t===s},Object(r.createElement)(ft.a,{label:s.toString(),screenReaderLabel:Object(l.sprintf)(
33
  /* translators: %d is the page number (1, 2, 3...). */
34
- Object(l.__)("Page %d","woo-gutenberg-products-block"),s)})),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>a(t+1),title:Object(l.__)("Next page","woo-gutenberg-products-block"),disabled:t>=s},Object(r.createElement)(ft.a,{label:"→",screenReaderLabel:Object(l.__)("Next page","woo-gutenberg-products-block")})))},yt=c(109),vt=c(75),St=c(125),Ct=c(17),xt=c(49);var Nt=c(78);c(388);const Pt=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};var Tt=c(46),Rt=c(175),It=()=>{const{parentClassName:e}=Object(E.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:e+"__no-products"},Object(r.createElement)(n.a,{className:e+"__no-products-image",icon:Rt.a,size:100}),Object(r.createElement)("strong",{className:e+"__no-products-title"},Object(l.__)("No products","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:e+"__no-products-description"},Object(l.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},At=c(515),Bt=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:c}=Object(E.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:c+"__no-products"},Object(r.createElement)(n.a,{className:c+"__no-products-image",icon:At.a,size:100}),Object(r.createElement)("strong",{className:c+"__no-products-title"},Object(l.__)("No products found","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:c+"__no-products-description"},Object(l.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(r.createElement)("button",{onClick:t},Object(l.__)("Reset Search","woo-gutenberg-products-block")))},Lt=c(119);c(386);var Dt=e=>{let{onChange:t,value:c}=e;return Object(r.createElement)(Lt.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",onChange:t,options:[{key:"menu_order",label:Object(l.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(l.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(l.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(l.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(l.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(l.__)("Price: high to low","woo-gutenberg-products-block")}],screenReaderLabel:Object(l.__)("Order products by","woo-gutenberg-products-block"),value:c})};const Vt=(e,t,c,o)=>{if(!c)return;const n=Object(mt.a)(e);return c.map((c,a)=>{let[s,l={}]=c,i=[];l.children&&l.children.length>0&&(i=Vt(e,t,l.children,o));const u=n[s];if(!u)return null;const d=t.id||0,b=["layout",s,a,o,d];return Object(r.createElement)(r.Suspense,{key:b.join("_"),fallback:Object(r.createElement)("div",{className:"wc-block-placeholder"})},Object(r.createElement)(u,at()({},l,{children:i,product:t})))})};var Ft=Object(m.withInstanceId)(e=>{let{product:t={},attributes:c,instanceId:o}=e;const{layoutConfig:n}=c,{parentClassName:a,parentName:s}=Object(E.useInnerBlockLayoutContext)(),l=0===Object.keys(t).length,i=u()(a+"__product","wc-block-layout",{"is-loading":l});return Object(r.createElement)("li",{className:i,"aria-hidden":l},Vt(s,t,n,o))});c(385);const Mt=e=>{switch(e){case"menu_order":case"popularity":case"rating":case"price":return{orderby:e,order:"asc"};case"price-desc":return{orderby:"price",order:"desc"};case"date":return{orderby:"date",order:"desc"}}},zt=function(e){let{totalQuery:t,totalProducts:c}=e,{totalQuery:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(wt.isEqual)(t,r)&&Number.isFinite(c)};var Ht,qt=(Ht=e=>{let{attributes:t,currentPage:c,onPageChange:o,onSortChange:n,sortValue:a,scrollToTop:s}=e;const[i,d]=Object(vt.b)("attributes",[]),[b,p]=Object(vt.b)("stock_status",[]),[m,g]=Object(vt.b)("min_price"),[O,j]=Object(vt.b)("max_price"),[h]=Object(vt.c)((e=>{let{sortValue:t,currentPage:c,attributes:r}=e;const{columns:o,rows:n}=r;return{...Mt(t),catalog_visibility:"catalog",per_page:o*n,page:c}})({attributes:t,sortValue:a,currentPage:c})),{products:_,totalProducts:w,productsLoading:f}=(e=>{const t={namespace:"/wc/store/v1",resourceName:"products"},{results:c,isLoading:r}=Object(St.a)({...t,query:e}),{value:o}=((e,t)=>{const{namespace:c,resourceName:r,resourceValues:o=[],query:n={}}=t;if(!c||!r)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const a=Object(xt.a)(n),s=Object(xt.a)(o),{value:l,isLoading:i=!0}=Object(bt.useSelect)(e=>{const t=e(Ct.COLLECTIONS_STORE_KEY),o=["x-wp-total",c,r,a,s];return{value:t.getCollectionHeader(...o),isLoading:t.hasFinishedResolution("getCollectionHeader",o)}},["x-wp-total",c,r,s,a]);return{value:l,isLoading:i}})(0,{...t,query:e});return{products:c,totalProducts:parseInt(o,10),productsLoading:r}})(h),{parentClassName:k,parentName:y}=Object(E.useInnerBlockLayoutContext)(),v=(e=>{const{order:t,orderby:c,page:r,per_page:o,...n}=e;return n||{}})(h),{dispatchStoreEvent:S}=Object(Nt.a)(),C=Object(yt.a)({totalQuery:v,totalProducts:w},zt);Object(r.useEffect)(()=>{S("product-list-render",{products:_,listName:y})},[_,y,S]),Object(r.useEffect)(()=>{Object(wt.isEqual)(v,null==C?void 0:C.totalQuery)||(o(1),null!=C&&C.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(Tt.speak)(Object(l.__)("No products found","woo-gutenberg-products-block")):Object(Tt.speak)(Object(l.sprintf)(
35
  /* translators: %s is an integer higher than 0 (1, 2, 3...) */
36
- Object(l._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(w))},[null==C?void 0:C.totalQuery,w,o,v]);const{contentVisibility:x}=t,N=t.columns*t.rows,P=!Number.isFinite(w)&&Number.isFinite(null==C?void 0:C.totalProducts)&&Object(wt.isEqual)(v,null==C?void 0:C.totalQuery)?Math.ceil(((null==C?void 0:C.totalProducts)||0)/N):Math.ceil(w/N),T=_.length?_:Array.from({length:N}),R=0!==_.length||f,I=i.length>0||b.length>0||Number.isFinite(m)||Number.isFinite(O);return Object(r.createElement)("div",{className:(()=>{const{columns:e,rows:c,alignButtons:r,align:o}=t,n=void 0!==o?"align"+o:"";return u()(k,n,"has-"+e+"-columns",{"has-multiple-rows":c>1,"has-aligned-buttons":r})})()},(null==x?void 0:x.orderBy)&&R&&Object(r.createElement)(Dt,{onChange:n,value:a}),!R&&I&&Object(r.createElement)(Bt,{resetCallback:()=>{d([]),p([]),g(null),j(null)}}),!R&&!I&&Object(r.createElement)(It,null),R&&Object(r.createElement)("ul",{className:u()(k+"__products",{"is-loading-products":f})},T.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=arguments.length>1?arguments[1]:void 0;return Object(r.createElement)(Ft,{key:e.id||c,attributes:t,product:e})}))),P>1&&Object(r.createElement)(kt,{currentPage:c,onPageChange:e=>{s({focusableSelector:"a, button"}),o(e)},totalPages:P}))},e=>{const t=Object(r.useRef)(null);return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:t,"aria-hidden":!0}),Object(r.createElement)(Ht,at()({},e,{scrollToTop:e=>{null!==t.current&&((e,t)=>{const{focusableSelector:c}=t||{};window&&Number.isFinite(window.innerHeight)&&(c?((e,t)=>{var c;const r=(null===(c=e.parentElement)||void 0===c?void 0:c.querySelectorAll(t))||[];if(r.length){const e=r[0];Pt(e),null==e||e.focus()}else Pt(e)})(e,c):Pt(e))})(t.current,e)}})))}),Gt=e=>{let{attributes:t}=e;const[c,o]=Object(r.useState)(1),[n,a]=Object(r.useState)(t.orderby);return Object(r.useEffect)(()=>{a(t.orderby)},[t.orderby]),Object(r.createElement)(qt,{attributes:t,currentPage:c,onPageChange:e=>{o(e)},onSortChange:e=>{var t;const c=null==e||null===(t=e.target)||void 0===t?void 0:t.value;a(c),o(1)},sortValue:n})},Qt=c(141),Yt=c(145),Ut=c(232);class Wt extends Et.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?Qt.a:Object(r.createElement)(E.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(r.createElement)(Yt.a,null,Object(r.createElement)(Ut.a,{context:"wc/all-products"})),Object(r.createElement)(Gt,{attributes:e,urlParameterSuffix:t}))}}var $t=Wt;c(384);class Kt extends r.Component{constructor(){super(...arguments),dt()(this,"state",{isEditing:!1,innerBlocks:[]}),dt()(this,"blockMap",Object(mt.a)("woocommerce/all-products")),dt()(this,"componentDidMount",()=>{const{block:e}=this.props;this.setState({innerBlocks:e.innerBlocks})}),dt()(this,"getTitle",()=>Object(l.__)("All Products","woo-gutenberg-products-block")),dt()(this,"getIcon",()=>Object(r.createElement)(n.a,{icon:a.a})),dt()(this,"togglePreview",()=>{const{debouncedSpeak:e}=this.props;this.setState({isEditing:!this.state.isEditing}),this.state.isEditing||e(Object(l.__)("Showing All Products block preview.","woo-gutenberg-products-block"))}),dt()(this,"getInspectorControls",()=>{const{attributes:e,setAttributes:t}=this.props,{columns:c,rows:o,alignButtons:n}=e;return Object(r.createElement)(g.InspectorControls,{key:"inspector"},Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(r.createElement)(pt.a,{columns:c,rows:o,alignButtons:n,setAttributes:t,minColumns:Object(H.getSetting)("min_columns",1),maxColumns:Object(H.getSetting)("max_columns",6),minRows:Object(H.getSetting)("min_rows",1),maxRows:Object(H.getSetting)("max_rows",6)})),Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Content Settings","woo-gutenberg-products-block")},((e,t)=>{const{contentVisibility:c}=e;return Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:c.orderBy,onChange:()=>t({contentVisibility:{...c,orderBy:!c.orderBy}})})})(e,t),((e,t)=>Object(r.createElement)(p.SelectControl,{label:Object(l.__)("Order Products By","woo-gutenberg-products-block"),value:e.orderby,options:[{label:Object(l.__)("Default sorting (menu order)","woo-gutenberg-products-block"),value:"menu_order"},{label:Object(l.__)("Popularity","woo-gutenberg-products-block"),value:"popularity"},{label:Object(l.__)("Average rating","woo-gutenberg-products-block"),value:"rating"},{label:Object(l.__)("Latest","woo-gutenberg-products-block"),value:"date"},{label:Object(l.__)("Price: low to high","woo-gutenberg-products-block"),value:"price"},{label:Object(l.__)("Price: high to low","woo-gutenberg-products-block"),value:"price-desc"}],onChange:e=>t({orderby:e})}))(e,t)))}),dt()(this,"getBlockControls",()=>{const{isEditing:e}=this.state;return Object(r.createElement)(g.BlockControls,null,Object(r.createElement)(p.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit inner product layout","woo-gutenberg-products-block"),onClick:()=>this.togglePreview(),isActive:e}]}))}),dt()(this,"renderEditMode",()=>{const e={template:this.props.attributes.layoutConfig,templateLock:!1,allowedBlocks:Object.keys(this.blockMap)};return 0!==this.props.attributes.layoutConfig.length&&(e.renderAppender=!1),Object(r.createElement)(p.Placeholder,{icon:this.getIcon(),label:this.getTitle()},Object(l.__)("Display all products from your store as a grid.","woo-gutenberg-products-block"),Object(r.createElement)("div",{className:"wc-block-all-products-grid-item-template"},Object(r.createElement)(p.Tip,null,Object(l.__)("Edit the blocks inside the preview below to change the content displayed for each product within the product grid.","woo-gutenberg-products-block")),Object(r.createElement)(E.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(r.createElement)("div",{className:"wc-block-grid wc-block-layout has-1-columns"},Object(r.createElement)("ul",{className:"wc-block-grid__products"},Object(r.createElement)("li",{className:"wc-block-grid__product"},Object(r.createElement)(E.ProductDataContextProvider,{product:gt.a[0]},Object(r.createElement)(g.InnerBlocks,e)))))),Object(r.createElement)("div",{className:"wc-block-all-products__actions"},Object(r.createElement)(p.Button,{className:"wc-block-all-products__done-button",isPrimary:!0,onClick:()=>{const{block:e,setAttributes:t}=this.props;t({layoutConfig:_t(e.innerBlocks)}),this.setState({innerBlocks:e.innerBlocks}),this.togglePreview()}},Object(l.__)("Done","woo-gutenberg-products-block")),Object(r.createElement)(p.Button,{className:"wc-block-all-products__cancel-button",isTertiary:!0,onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,{innerBlocks:c}=this.state;t(e.clientId,c,!1),this.togglePreview()}},Object(l.__)("Cancel","woo-gutenberg-products-block")),Object(r.createElement)(p.Button,{className:"wc-block-all-products__reset-button",icon:Object(r.createElement)(n.a,{icon:a.a}),label:Object(l.__)("Reset layout to default","woo-gutenberg-products-block"),onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,c=[];ht.map(e=>{let[t,r]=e;return c.push(Object(o.createBlock)(t,r)),!0}),t(e.clientId,c,!1),this.setState({innerBlocks:e.innerBlocks})}},Object(l.__)("Reset Layout","woo-gutenberg-products-block")))))}),dt()(this,"renderViewMode",()=>{const{attributes:e}=this.props,{layoutConfig:t}=e,c=t&&0!==t.length,o=this.getTitle(),n=this.getIcon();return c?Object(r.createElement)(p.Disabled,null,Object(r.createElement)($t,{attributes:e})):((e,t)=>Object(r.createElement)(p.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(l.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")))(o,n)}),dt()(this,"render",()=>{const{attributes:e}=this.props,{isEditing:t}=this.state,c=this.getTitle(),o=this.getIcon();return 0===Ot.o.productCount?((e,t)=>Object(r.createElement)(p.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(r.createElement)("p",null,Object(l.__)("You haven't published any products to list here yet.","woo-gutenberg-products-block")),Object(r.createElement)(p.Button,{className:"wc-block-products__add-product-button",isSecondary:!0,href:H.ADMIN_URL+"post-new.php?post_type=product"},Object(l.__)("Add new product","woo-gutenberg-products-block")+" ",Object(r.createElement)(n.a,{icon:jt.a})),Object(r.createElement)(p.Button,{className:"wc-block-products__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-products/"},Object(l.__)("Learn more","woo-gutenberg-products-block"))))(c,o):Object(r.createElement)("div",{className:st("wc-block-all-products",e)},this.getBlockControls(),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())})}}var Jt=Object(m.compose)(p.withSpokenMessages,Object(bt.withSelect)((e,t)=>{let{clientId:c}=t;const{getBlock:r}=e("core/block-editor");return{block:r(c)}}),Object(bt.withDispatch)(e=>{const{replaceInnerBlocks:t}=e("core/block-editor");return{replaceInnerBlocks:t}}))(Kt),Xt={columns:Object(H.getSetting)("default_columns",3),rows:Object(H.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:ht,isPreview:!1};const{name:Zt}=ot,ec={icon:{src:Object(r.createElement)(n.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},edit:Jt,save:function(e){let{attributes:t}=e;const c={};Object.keys(t).sort().forEach(e=>{c[e]=t[e]});const o={"data-attributes":JSON.stringify(c)};return Object(r.createElement)("div",at()({className:st("wc-block-all-products",t)},o),Object(r.createElement)(g.InnerBlocks.Content,null))},deprecated:it,defaults:Xt};Object(o.registerBlockType)(Zt,ec)},,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(42),o=c(0),n=c(23);c.p=n.l,Object(r.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(2),c.e(27)]).then(c.bind(null,304)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(24)]).then(c.bind(null,546)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(37)]).then(c.bind(null,547)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(29)]).then(c.bind(null,305)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(20)]).then(c.bind(null,306)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(34)]).then(c.bind(null,307)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(30)]).then(c.bind(null,220)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>c.e(32).then(c.bind(null,308)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(23)]).then(c.bind(null,309)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(36)]).then(c.bind(null,310)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(33)]).then(c.bind(null,311)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(4),c.e(18)]).then(c.bind(null,548)))});const a=e=>Object(r.getRegisteredBlockComponents)(e)},,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));const r=e=>e.is_purchasable||!1,o=e=>["simple","variable"].includes(e.type||"simple")}]);
1
+ this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-products"]=function(e){function t(t){for(var r,a,s=t[0],l=t[1],i=t[2],d=0,b=[];d<s.length;d++)a=s[d],Object.prototype.hasOwnProperty.call(o,a)&&o[a]&&b.push(o[a][0]),o[a]=0;for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(e[r]=l[r]);for(u&&u(t);b.length;)b.shift()();return n.push.apply(n,i||[]),c()}function c(){for(var e,t=0;t<n.length;t++){for(var c=n[t],r=!0,s=1;s<c.length;s++){var l=c[s];0!==o[l]&&(r=!1)}r&&(n.splice(t--,1),e=a(a.s=c[0]))}return e}var r={},o={6:0,1:0,2:0,3:0,4:0,20:0,23:0,27:0,29:0,30:0,32:0,33:0,34:0,36:0},n=[];function a(t){if(r[t])return r[t].exports;var c=r[t]={i:t,l:!1,exports:{}};return e[t].call(c.exports,c,c.exports,a),c.l=!0,c.exports}a.e=function(e){var t=[],c=o[e];if(0!==c)if(c)t.push(c[2]);else{var r=new Promise((function(t,r){c=o[e]=[t,r]}));t.push(c[2]=r);var n,s=document.createElement("script");s.charset="utf-8",s.timeout=120,a.nc&&s.setAttribute("nonce",a.nc),s.src=function(e){return a.p+""+({1:"product-add-to-cart--product-button--product-category-list--product-image--product-price--product-r--a0326d00",2:"product-button--product-category-list--product-image--product-price--product-rating--product-sale-b--e17c7c01",3:"product-button--product-image--product-rating--product-sale-badge--product-title",4:"product-add-to-cart--product-button--product-image--product-title",18:"product-add-to-cart",20:"product-button",23:"product-category-list",24:"product-image",27:"product-price",29:"product-rating",30:"product-sale-badge",32:"product-sku",33:"product-stock-indicator",34:"product-summary",36:"product-tag-list",37:"product-title"}[e]||e)+".js?ver="+{1:"3911ab4b9696a0c7af87",2:"55129ac02a98575a57e7",3:"dac8aa5ee71e261b7380",4:"30954d25b97ef2c12ae7",18:"9c3fc6ac98d216d0843f",20:"88913fdcff2dec9119b3",23:"3e11c1312b371b23cb2c",24:"2e37c7db57776041238f",27:"1b6974ca3c10760e56a2",29:"ad24d96c185a1fd3d5a6",30:"b710cc03711153f16b3d",32:"8a3196ed7fdba602f18c",33:"57ab144d7bab8ec7762b",34:"d76fe062d1f336afd759",36:"1d41ccaa253656f721f0",37:"8d489782fe266a43658b"}[e]}(e);var l=new Error;n=function(t){s.onerror=s.onload=null,clearTimeout(i);var c=o[e];if(0!==c){if(c){var r=t&&("load"===t.type?"missing":t.type),n=t&&t.target&&t.target.src;l.message="Loading chunk "+e+" failed.\n("+r+": "+n+")",l.name="ChunkLoadError",l.type=r,l.request=n,c[1](l)}o[e]=void 0}};var i=setTimeout((function(){n({type:"timeout",target:s})}),12e4);s.onerror=s.onload=n,document.head.appendChild(s)}return Promise.all(t)},a.m=e,a.c=r,a.d=function(e,t,c){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var c=Object.create(null);if(a.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)a.d(c,r,function(t){return e[t]}.bind(null,r));return c},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a.oe=function(e){throw console.error(e),e};var s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=s.push.bind(s);s.push=t,s=s.slice();for(var i=0;i<s.length;i++)t(s[i]);var u=l;return n.push([380,0]),c()}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.wp.components},,function(e,t){e.exports=window.wp.blockEditor},,function(e,t){e.exports=window.lodash},function(e,t){e.exports=window.wp.blocks},function(e,t){e.exports=window.wp.data},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.primitives},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wp.apiFetch},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.url},,function(e,t){e.exports=window.wc.wcBlocksData},,function(e,t,c){"use strict";c.d(t,"a",(function(){return a})),c.d(t,"c",(function(){return l})),c.d(t,"d",(function(){return i})),c.d(t,"b",(function(){return u}));var r=c(0),o=c(7),n=c(1);const a={clear:Object(n.__)("Clear all selected items","woo-gutenberg-products-block"),noItems:Object(n.__)("No items found.","woo-gutenberg-products-block"),
2
  /* Translators: %s search term */
3
  noResults:Object(n.__)("No results for %s","woo-gutenberg-products-block"),search:Object(n.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(n.sprintf)(
4
  /* translators: Number of items selected from list. */
5
+ Object(n._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(n.__)("Search results updated.","woo-gutenberg-products-block")},s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const c=Object(o.groupBy)(e,"parent"),r=Object(o.keyBy)(t,"id"),n=["0"],a=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=a(r[e.parent]);return[...t,e.name]},s=e=>e.map(e=>{const t=c[e.id];return n.push(""+e.id),{...e,breadcrumbs:a(r[e.parent]),children:t&&t.length?s(t):[]}}),l=s(c[0]||[]);return Object.entries(c).forEach(e=>{let[t,c]=e;n.includes(t)||l.push(...s(c||[]))}),l},l=(e,t,c)=>{if(!t)return c?s(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),o=e.map(e=>!!r.test(e.name)&&e).filter(Boolean);return c?s(o,e):o},i=(e,t)=>{if(!t)return e;const c=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(c).map((e,t)=>c.test(e)?Object(r.createElement)("strong",{key:t},e):Object(r.createElement)(r.Fragment,{key:t},e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},,,function(e,t){e.exports=window.wp.isShallowEqual},function(e,t,c){"use strict";c.d(t,"o",(function(){return n})),c.d(t,"m",(function(){return a})),c.d(t,"l",(function(){return s})),c.d(t,"n",(function(){return l})),c.d(t,"j",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"f",(function(){return d})),c.d(t,"g",(function(){return b})),c.d(t,"k",(function(){return p})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return g})),c.d(t,"h",(function(){return O})),c.d(t,"a",(function(){return j})),c.d(t,"i",(function(){return h})),c.d(t,"b",(function(){return _}));var r,o=c(2);const n=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=n.pluginUrl+"images/",s=n.pluginUrl+"build/",l=n.buildPhase,i=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=o.STORE_PAGES.checkout.id,d=o.STORE_PAGES.checkout.permalink,b=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),m=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id),g=o.STORE_PAGES.cart.permalink,O=(o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),Object(o.getSetting)("shippingCountries",{})),j=Object(o.getSetting)("allowedCountries",{}),h=Object(o.getSetting)("shippingStates",{}),_=Object(o.getSetting)("allowedStates",{})},,function(e,t,c){"use strict";c.d(t,"h",(function(){return i})),c.d(t,"e",(function(){return u})),c.d(t,"b",(function(){return d})),c.d(t,"i",(function(){return b})),c.d(t,"f",(function(){return p})),c.d(t,"c",(function(){return m})),c.d(t,"d",(function(){return g})),c.d(t,"g",(function(){return O})),c.d(t,"a",(function(){return j}));var r=c(15),o=c(13),n=c.n(o),a=c(7),s=c(2),l=c(23);const i=e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const s=(e=>{let{selected:t=[],search:c="",queryArgs:o={}}=e;const n=l.o.productCount>100,a={per_page:n?100:0,catalog_visibility:"any",search:c,orderby:"title",order:"asc"},s=[Object(r.addQueryArgs)("/wc/store/v1/products",{...a,...o})];return n&&t.length&&s.push(Object(r.addQueryArgs)("/wc/store/v1/products",{catalog_visibility:"any",include:t,per_page:0})),s})({selected:t,search:c,queryArgs:o});return Promise.all(s.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id").map(e=>({...e,parent:0}))).catch(e=>{throw e})},u=e=>n()({path:"/wc/store/v1/products/"+e}),d=()=>n()({path:"wc/store/v1/products/attributes"}),b=e=>n()({path:`wc/store/v1/products/attributes/${e}/terms`}),p=e=>{let{selected:t=[],search:c}=e;const o=(e=>{let{selected:t=[],search:c}=e;const o=Object(s.getSetting)("limitTags",!1),n=[Object(r.addQueryArgs)("wc/store/v1/products/tags",{per_page:o?100:0,orderby:o?"count":"name",order:o?"desc":"asc",search:c})];return o&&t.length&&n.push(Object(r.addQueryArgs)("wc/store/v1/products/tags",{include:t})),n})({selected:t,search:c});return Promise.all(o.map(e=>n()({path:e}))).then(e=>Object(a.uniqBy)(Object(a.flatten)(e),"id"))},m=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products/categories",{per_page:0,...e})}),g=e=>n()({path:"wc/store/v1/products/categories/"+e}),O=e=>n()({path:Object(r.addQueryArgs)("wc/store/v1/products",{per_page:0,type:"variation",parent:e})}),j=(e,t)=>{if(!e.title.raw)return e.slug;const c=1===t.filter(t=>t.title.raw===e.title.raw).length;return e.title.raw+(c?"":" - "+e.slug)}},function(e,t){e.exports=window.wc.priceFormat},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return a}));var r=c(1),o=c(14);const n=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}},a=e=>{if(e.data&&"rest_invalid_param"===e.code){const t=Object.values(e.data.params);if(t[0])return t[0]}return null!=e&&e.message?Object(o.decodeEntities)(e.message):Object(r.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o);t.a=e=>{let t,{label:c,screenReaderLabel:o,wrapperElement:a,wrapperProps:s={}}=e;const l=null!=c,i=null!=o;return!l&&i?(t=a||"span",s={...s,className:n()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,o)):(t=a||r.Fragment,l&&i&&c!==o?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},c),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,s,c))}},,function(e,t){e.exports=window.wc.wcBlocksSharedContext},,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(33);t.a=e=>{let{error:t}=e;return Object(r.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:c}=e;return t?"general"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned","woo-gutenberg-products-block"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):"api"===c?Object(r.createElement)("span",null,Object(o.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(r.createElement)("br",null),Object(r.createElement)("code",null,Object(n.escapeHTML)(t))):t:Object(o.__)("An error has prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},function(e,t){e.exports=window.wp.escapeHtml},,function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}},function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(6),o=c.n(r),n=c(0),a=c(19);const s=e=>{let{countLabel:t,className:c,depth:r=0,controlId:s="",item:l,isSelected:i,isSingle:u,onSelect:d,search:b="",...p}=e;const m=null!=t&&void 0!==l.count&&null!==l.count,g=[c,"woocommerce-search-list__item"];g.push("depth-"+r),u&&g.push("is-radio-button"),m&&g.push("has-count");const O=l.breadcrumbs&&l.breadcrumbs.length,j=p.name||"search-list-item-"+s,h=`${j}-${l.id}`;return Object(n.createElement)("label",{htmlFor:h,className:g.join(" ")},u?Object(n.createElement)("input",o()({type:"radio",id:h,name:j,value:l.value,onChange:d(l),checked:i,className:"woocommerce-search-list__item-input"},p)):Object(n.createElement)("input",o()({type:"checkbox",id:h,name:j,value:l.value,onChange:d(l),checked:i,className:"woocommerce-search-list__item-input"},p)),Object(n.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(n.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(a.b)(l.breadcrumbs)):null,Object(n.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(a.d)(l.name,b))),!!m&&Object(n.createElement)("span",{className:"woocommerce-search-list__item-count"},t||l.count))};t.b=s},function(e,t,c){"use strict";c.d(t,"c",(function(){return n})),c.d(t,"a",(function(){return l})),c.d(t,"b",(function(){return i})),c.d(t,"d",(function(){return d}));var r=c(35);let o,n;!function(e){e.SUCCESS="success",e.FAIL="failure",e.ERROR="error"}(o||(o={})),function(e){e.PAYMENTS="wc/payment-area",e.EXPRESS_PAYMENTS="wc/express-payment-area"}(n||(n={}));const a=(e,t)=>Object(r.a)(e)&&"type"in e&&e.type===t,s=e=>a(e,o.SUCCESS),l=e=>a(e,o.ERROR),i=e=>a(e,o.FAIL),u=e=>!Object(r.a)(e)||void 0===e.retry||!0===e.retry,d=()=>({responseTypes:o,noticeContexts:n,shouldRetry:u,isSuccessResponse:s,isErrorResponse:l,isFailResponse:i})},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(127),s=c(4),l=c.n(s);c(132);const i=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});t.a=e=>{let{className:t,value:c,currency:r,onValueChange:s,displayType:u="text",...d}=e;const b="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(b))return null;const p=b/10**r.minorUnit;if(!Number.isFinite(p))return null;const m=l()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),g={...d,...i(r),value:void 0,currency:void 0,onValueChange:void 0},O=s?e=>{const t=+e.value*10**r.minorUnit;s(t)}:()=>{};return Object(n.createElement)(a.a,o()({className:m,displayType:u},g,{value:p,onValueChange:O}))}},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return _}));var r=c(7),o=c(0),n=c(17),a=c(9),s=c(14),l=c(243),i=c(59),u=c(242);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(a.dispatch)(n.CART_STORE_KEY).invalidateResolutionForStore()},b=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},p=()=>{Object(o.useEffect)(()=>((()=>{if(window.wcBlocksStoreCartListeners||(window.wcBlocksStoreCartListeners={count:0,remove:()=>{}}),0===window.wcBlocksStoreCartListeners.count){const e=Object(u.a)("added_to_cart","wc-blocks_added_to_cart"),t=Object(u.a)("removed_from_cart","wc-blocks_removed_from_cart");document.body.addEventListener("wc-blocks_added_to_cart",d),document.body.addEventListener("wc-blocks_removed_from_cart",d),window.wcBlocksStoreCartListeners.count=0,window.wcBlocksStoreCartListeners.remove=()=>{e(),t(),document.body.removeEventListener("wc-blocks_added_to_cart",d),document.body.removeEventListener("wc-blocks_removed_from_cart",d)}}window.wcBlocksStoreCartListeners.count++})(),b),[])},m={first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},g={...m,email:""},O={total_items:"",total_items_tax:"",total_fees:"",total_fees_tax:"",total_discount:"",total_discount_tax:"",total_shipping:"",total_shipping_tax:"",total_price:"",total_tax:"",tax_lines:n.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},j=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,c]=e;return[t,Object(s.decodeEntities)(c)]})),h={cartCoupons:n.EMPTY_CART_COUPONS,cartItems:n.EMPTY_CART_ITEMS,cartFees:n.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:O,cartIsLoading:!0,cartErrors:n.EMPTY_CART_ERRORS,billingAddress:g,shippingAddress:m,shippingRates:n.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:n.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:n.EMPTY_EXTENSIONS},_=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:c}=Object(i.b)(),s=null==c?void 0:c.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();p();const b=Object(a.useSelect)((e,c)=>{let{dispatch:r}=c;if(!u)return h;if(t)return{cartCoupons:s.coupons,cartItems:s.items,cartFees:s.fees,cartItemsCount:s.items_count,cartItemsWeight:s.items_weight,cartNeedsPayment:s.needs_payment,cartNeedsShipping:s.needs_shipping,cartItemErrors:n.EMPTY_CART_ITEM_ERRORS,cartTotals:s.totals,cartIsLoading:!1,cartErrors:n.EMPTY_CART_ERRORS,billingData:g,billingAddress:g,shippingAddress:m,extensions:n.EMPTY_EXTENSIONS,shippingRates:s.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:s.has_calculated_shipping,paymentRequirements:s.paymentRequirements,receiveCart:"function"==typeof(null==s?void 0:s.receiveCart)?s.receiveCart:()=>{}};const o=e(n.CART_STORE_KEY),a=o.getCartData(),i=o.getCartErrors(),d=o.getCartTotals(),b=!o.hasFinishedResolution("getCartData"),p=o.isCustomerDataUpdating(),{receiveCart:O}=r(n.CART_STORE_KEY),_=j(a.billingAddress),E=a.needsShipping?j(a.shippingAddress):_,w=a.fees.length>0?a.fees.map(e=>j(e)):n.EMPTY_CART_FEES;return{cartCoupons:a.coupons.length>0?a.coupons.map(e=>({...e,label:e.code})):n.EMPTY_CART_COUPONS,cartItems:a.items,cartFees:w,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:d,cartIsLoading:b,cartErrors:i,billingData:Object(l.a)(_),billingAddress:Object(l.a)(_),shippingAddress:Object(l.a)(E),extensions:a.extensions,shippingRates:a.shippingRates,isLoadingRates:p,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:O}},[u]);return d.current&&Object(r.isEqual)(d.current,b)||(d.current=b),d.current}},function(e,t){e.exports=window.wc.wcBlocksRegistry},,function(e,t){e.exports=window.wp.hooks},,function(e,t){e.exports=window.wp.a11y},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(0),o=c(22),n=c.n(o);function a(e){const t=Object(r.useRef)(e);return n()(e,t.current)||(t.current=e),t.current}},,function(e,t){e.exports=window.wp.deprecated},function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0);const o=Object(r.createContext)("page"),n=()=>Object(r.useContext)(o);o.Provider},,,,,,function(e,t){e.exports=window.wc.wcBlocksSharedHocs},function(e,t,c){"use strict";c.d(t,"b",(function(){return a})),c.d(t,"a",(function(){return s}));var r=c(0),o=c(9);const n=Object(r.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),a=()=>Object(r.useContext)(n),s=e=>{let{children:t,currentPostId:c=0,currentView:a="",previewData:s={}}=e;const l=Object(o.useSelect)(e=>c||e("core/editor").getCurrentPostId(),[c]),i=Object(r.useCallback)(e=>e in s?s[e]:{},[s]),u={isEditor:!0,currentPostId:l,currentView:a,previewData:s,getPreviewData:i};return Object(r.createElement)(n.Provider,{value:u},t)}},function(e,t){e.exports=window.wp.autop},,,function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(7),a=c(3);t.a=e=>{let{columns:t,rows:c,setAttributes:s,alignButtons:l,minColumns:i=1,maxColumns:u=6,minRows:d=1,maxRows:b=6}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(a.RangeControl,{label:Object(o.__)("Columns","woo-gutenberg-products-block"),value:t,onChange:e=>{const t=Object(n.clamp)(e,i,u);s({columns:Number.isNaN(t)?"":t})},min:i,max:u}),Object(r.createElement)(a.RangeControl,{label:Object(o.__)("Rows","woo-gutenberg-products-block"),value:c,onChange:e=>{const t=Object(n.clamp)(e,d,b);s({rows:Number.isNaN(t)?"":t})},min:d,max:b}),Object(r.createElement)(a.ToggleControl,{label:Object(o.__)("Align the last block to the bottom","woo-gutenberg-products-block"),help:l?Object(o.__)("Align the last block to the bottom.","woo-gutenberg-products-block"):Object(o.__)("The last inner block will follow other content.","woo-gutenberg-products-block"),checked:l,onChange:()=>s({alignButtons:!l})}))}},,,,,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(131),s=c(4),l=c.n(s),i=c(91);c(156),t.a=e=>{let{className:t,showSpinner:c=!1,children:r,variant:s="contained",...u}=e;const d=l()("wc-block-components-button",t,s,{"wc-block-components-button--loading":c});return Object(n.createElement)(a.a,o()({className:d},u),c&&Object(n.createElement)(i.a,null),Object(n.createElement)("span",{className:"wc-block-components-button__text"},r))}},,,function(e,t){e.exports=window.wp.dom},,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return d})),c.d(t,"b",(function(){return b})),c.d(t,"c",(function(){return p}));var r=c(17),o=c(9),n=c(0),a=c(22),s=c.n(a),l=c(49),i=c(109),u=c(52);const d=e=>{const t=Object(u.a)();e=e||t;const c=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:a}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[c,Object(n.useCallback)(t=>{a(e,t)},[e,a])]},b=(e,t,c)=>{const a=Object(u.a)();c=c||a;const s=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(c,e,t),[c,e]),{setQueryValue:l}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[s,Object(n.useCallback)(t=>{l(c,e,t)},[c,e,l])]},p=(e,t)=>{const c=Object(u.a)();t=t||c;const[r,o]=d(t),a=Object(l.a)(r),b=Object(l.a)(e),p=Object(i.a)(b),m=Object(n.useRef)(!1);return Object(n.useEffect)(()=>{s()(p,b)||(o(Object.assign({},a,b)),m.current=!0)},[a,b,p,o]),m.current?[r,o]:[e,o]}},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(44),o=c(0),n=c(41);const a=()=>{const e=Object(n.a)(),t=Object(o.useRef)(e);return Object(o.useEffect)(()=>{t.current=e},[e]),{dispatchStoreEvent:Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-"+e,t)}catch(e){console.error(e)}}),[]),dispatchCheckoutEvent:Object(o.useCallback)((function(e){let c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};try{Object(r.doAction)("experimental__woocommerce_blocks-checkout-"+e,{...c,storeCart:t.current})}catch(e){console.error(e)}}),[])}}},,,,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(36),s=c(3),l=c(4),i=c.n(l);t.a=e=>{let{className:t,item:c,isSelected:r,isLoading:l,onSelect:u,disabled:d,...b}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(a.a,o()({},b,{key:c.id,className:t,isSelected:r,item:c,onSelect:u,isSingle:!0,disabled:d})),r&&l&&Object(n.createElement)("div",{key:"loading",className:i()("woocommerce-search-list__item","woocommerce-product-attributes__item","depth-1","is-loading","is-not-active")},Object(n.createElement)(s.Spinner,null)))}},,,,,function(e,t){e.exports=window.wp.wordcount},,,function(e,t,c){"use strict";var r=c(2),o=c(1),n=c(163),a=c(100);const s=Object(r.getSetting)("countryLocale",{}),l=e=>{const t={};return void 0!==e.label&&(t.label=e.label),void 0!==e.required&&(t.required=e.required),void 0!==e.hidden&&(t.hidden=e.hidden),void 0===e.label||e.optionalLabel||(t.optionalLabel=Object(o.sprintf)(
6
  /* translators: %s Field label. */
7
+ Object(o.__)("%s (optional)","woo-gutenberg-products-block"),e.label)),e.priority&&(Object(n.a)(e.priority)&&(t.index=e.priority),Object(a.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},i=Object.entries(s).map(e=>{let[t,c]=e;return[t,Object.entries(c).map(e=>{let[t,c]=e;return[t,l(c)]}).reduce((e,t)=>{let[c,r]=t;return e[c]=r,e},{})]}).reduce((e,t)=>{let[c,r]=t;return e[c]=r,e},{});t.a=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";const o=c&&void 0!==i[c]?i[c]:{};return e.map(e=>({key:e,...r.defaultAddressFields[e]||{},...o[e]||{},...t[e]||{}})).sort((e,t)=>e.index-t.index)}},function(e,t,c){"use strict";var r=c(0);c(157),t.a=()=>Object(r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(38),a=c(4),s=c.n(a),l=c(26);c(155);const i=e=>{let{currency:t,maxPrice:c,minPrice:a,priceClassName:i,priceStyle:u={}}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.sprintf)(
8
  /* translators: %1$s min price, %2$s max price */
9
+ Object(o.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(l.formatPrice)(a),Object(l.formatPrice)(c))),Object(r.createElement)("span",{"aria-hidden":!0},Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:a,style:u})," — ",Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",i),currency:t,value:c,style:u})))},u=e=>{let{currency:t,regularPriceClassName:c,regularPriceStyle:a,regularPrice:l,priceClassName:i,priceStyle:u,price:d}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Previous price:","woo-gutenberg-products-block")),Object(r.createElement)(n.a,{currency:t,renderText:e=>Object(r.createElement)("del",{className:s()("wc-block-components-product-price__regular",c),style:a},e),value:l}),Object(r.createElement)("span",{className:"screen-reader-text"},Object(o.__)("Discounted price:","woo-gutenberg-products-block")),Object(r.createElement)(n.a,{currency:t,renderText:e=>Object(r.createElement)("ins",{className:s()("wc-block-components-product-price__value","is-discounted",i),style:u},e),value:d}))};t.a=e=>{let{align:t,className:c,currency:o,format:a="<price/>",maxPrice:l,minPrice:d,price:b,priceClassName:p,priceStyle:m,regularPrice:g,regularPriceClassName:O,regularPriceStyle:j}=e;const h=s()(c,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+t]:t});a.includes("<price/>")||(a="<price/>",console.error("Price formats need to include the `<price/>` tag."));const _=g&&b!==g;let E=Object(r.createElement)("span",{className:s()("wc-block-components-product-price__value",p)});return _?E=Object(r.createElement)(u,{currency:o,price:b,priceClassName:p,priceStyle:m,regularPrice:g,regularPriceClassName:O,regularPriceStyle:j}):void 0!==d&&void 0!==l?E=Object(r.createElement)(i,{currency:o,maxPrice:l,minPrice:d,priceClassName:p,priceStyle:m}):b&&(E=Object(r.createElement)(n.a,{className:s()("wc-block-components-product-price__value",p),currency:o,value:b,style:m})),Object(r.createElement)("span",{className:h},Object(r.createInterpolateElement)(a,{price:E}))}},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(7),l=c(36),i=c(97),u=c(10),d=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{render(){const{selected:t}=this.props,c=null==t;return Array.isArray(t)?Object(n.createElement)(e,this.props):Object(n.createElement)(e,o()({},this.props,{selected:c?[]:[t]}))}}return t.defaultProps={selected:null},t},"withTransformSingleSelectToMultipleSelect"),b=c(181),p=c(24),m=c.n(p),g=c(22),O=c.n(g),j=c(25),h=c(27),_=Object(u.createHigherOrderComponent)(e=>{class t extends n.Component{constructor(){super(...arguments),m()(this,"state",{error:null,loading:!1,variations:{}}),m()(this,"loadVariations",()=>{const{products:e}=this.props,{loading:t,variations:c}=this.state;if(t)return;const r=this.getExpandedProduct();if(!r||c[r])return;const o=e.find(e=>e.id===r);o.variations&&0!==o.variations.length?(this.setState({loading:!0}),Object(j.g)(r).then(e=>{const t=e.map(e=>({...e,parent:r}));this.setState({variations:{...this.state.variations,[r]:t},loading:!1,error:null})}).catch(async e=>{const t=await Object(h.a)(e);this.setState({variations:{...this.state.variations,[r]:null},loading:!1,error:t})})):this.setState({variations:{...this.state.variations,[r]:null},loading:!1,error:null})})}componentDidMount(){const{selected:e,showVariations:t}=this.props;e&&t&&this.loadVariations()}componentDidUpdate(e){const{isLoading:t,selected:c,showVariations:r}=this.props;r&&(!O()(e.selected,c)||e.isLoading&&!t)&&this.loadVariations()}isProductId(e){const{products:t}=this.props;return t.some(t=>t.id===e)}findParentProduct(e){var t;const{products:c}=this.props;return null===(t=c.filter(t=>t.variations&&t.variations.find(t=>{let{id:c}=t;return c===e}))[0])||void 0===t?void 0:t.id}getExpandedProduct(){const{isLoading:e,selected:t,showVariations:c}=this.props;if(!c)return null;let r=t&&t.length?t[0]:null;return r?this.prevSelectedItem=r:this.prevSelectedItem&&(e||this.isProductId(this.prevSelectedItem)||(r=this.prevSelectedItem)),!e&&r?this.isProductId(r)?r:this.findParentProduct(r):null}render(){const{error:t,isLoading:c}=this.props,{error:r,loading:a,variations:s}=this.state;return Object(n.createElement)(e,o()({},this.props,{error:r||t,expandedProduct:this.getExpandedProduct(),isLoading:c,variations:s,variationsLoading:a}))}}return m()(t,"defaultProps",{selected:[],showVariations:!1}),t},"withProductVariations"),E=c(32),w=c(4),f=c.n(w),k=c(82);c(134);const y={list:Object(a.__)("Products","woo-gutenberg-products-block"),noItems:Object(a.__)("Your store doesn't have any products.","woo-gutenberg-products-block"),search:Object(a.__)("Search for a product to display","woo-gutenberg-products-block"),updated:Object(a.__)("Product search results updated.","woo-gutenberg-products-block")},v=e=>{let{expandedProduct:t,error:c,instanceId:r,isCompact:u,isLoading:d,onChange:b,onSearch:p,products:m,renderItem:g,selected:O,showVariations:j,variations:h,variationsLoading:_}=e;if(c)return Object(n.createElement)(E.a,{error:c});const w=[...m,...h&&h[t]?h[t]:[]];return Object(n.createElement)(i.a,{className:"woocommerce-products",list:w,isCompact:u,isLoading:d,isSingle:!0,selected:w.filter(e=>{let{id:t}=e;return O.includes(t)}),onChange:b,renderItem:g||(j?e=>{const{item:t,search:c,depth:i=0,isSelected:u,onSelect:b}=e,p=t.variations&&Array.isArray(t.variations)?t.variations.length:0,m=f()("woocommerce-search-product__item","woocommerce-search-list__item","depth-"+i,"has-count",{"is-searching":c.length>0,"is-skip-level":0===i&&0!==t.parent,"is-variable":p>0});if(!t.breadcrumbs.length)return Object(n.createElement)(k.a,o()({},e,{className:f()(m,{"is-selected":u}),isSelected:u,item:t,onSelect:()=>()=>{b(t)()},isLoading:d||_,countLabel:t.variations.length>0?Object(a.sprintf)(
10
  /* translators: %1$d is the number of variations of a product product. */
11
  Object(a.__)("%1$d variations","woo-gutenberg-products-block"),t.variations.length):null,name:"products-"+r,"aria-label":Object(a.sprintf)(
12
  /* translators: %1$s is the product name, %2$d is the number of variations of that product. */
13
+ Object(a._n)("%1$s, has %2$d variation","%1$s, has %2$d variations",t.variations.length,"woo-gutenberg-products-block"),t.name,t.variations.length)}));const g=Object(s.isEmpty)(t.variation)?e:{...e,item:{...e.item,name:t.variation},"aria-label":`${t.breadcrumbs[0]}: ${t.variation}`};return Object(n.createElement)(l.a,o()({},g,{className:m,name:"variations-"+r}))}:null),onSearch:p,messages:y,isHierarchical:!0})};v.defaultProps={isCompact:!1,expandedProduct:null,selected:[],showVariations:!1},t.a=d(Object(b.a)(_(Object(u.withInstanceId)(v))))},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return s}));var r=c(7);let o;!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(o||(o={}));const n={addEventCallback:function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(r.uniqueId)(),type:o.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:c}},removeEventCallback:(e,t)=>({id:t,type:o.REMOVE_EVENT_CALLBACK,eventType:e})},a={},s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,{type:t,eventType:c,id:r,callback:n,priority:s}=arguments.length>1?arguments[1]:void 0;const l=e.hasOwnProperty(c)?new Map(e[c]):new Map;switch(t){case o.ADD_EVENT_CALLBACK:return l.set(r,{priority:s,callback:n}),{...e,[c]:l};case o.REMOVE_EVENT_CALLBACK:return l.delete(r),{...e,[c]:l}}}},function(e,t,c){"use strict";c.d(t,"c",(function(){return n})),c.d(t,"a",(function(){return a})),c.d(t,"b",(function(){return s}));var r=c(8),o=c(23);const n=(e,t)=>{if(o.n>2)return Object(r.registerBlockType)(e,t)},a=()=>o.n>2,s=()=>o.n>1},,function(e,t,c){"use strict";c.d(t,"a",(function(){return k}));var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(3),l=c(113),i=c(508),u=c(4),d=c.n(u),b=c(10),p=c(19),m=c(36),g=c(507),O=c(14);const j=e=>{let{id:t,label:c,popoverContents:r,remove:o,screenReaderLabel:i,className:u=""}=e;const[p,m]=Object(n.useState)(!1),h=Object(b.useInstanceId)(j);if(i=i||c,!c)return null;c=Object(O.decodeEntities)(c);const _=d()("woocommerce-tag",u,{"has-remove":!!o}),E="woocommerce-tag__label-"+h,w=Object(n.createElement)(n.Fragment,null,Object(n.createElement)("span",{className:"screen-reader-text"},i),Object(n.createElement)("span",{"aria-hidden":"true"},c));return Object(n.createElement)("span",{className:_},r?Object(n.createElement)(s.Button,{className:"woocommerce-tag__text",id:E,onClick:()=>m(!0)},w):Object(n.createElement)("span",{className:"woocommerce-tag__text",id:E},w),r&&p&&Object(n.createElement)(s.Popover,{onClose:()=>m(!1)},r),o&&Object(n.createElement)(s.Button,{className:"woocommerce-tag__remove",onClick:o(t),label:Object(a.sprintf)(// Translators: %s label.
14
  Object(a.__)("Remove %s","woo-gutenberg-products-block"),c),"aria-describedby":E},Object(n.createElement)(l.a,{icon:g.a,size:20,className:"clear-icon"})))};var h=j;const _=e=>Object(n.createElement)(m.b,e),E=e=>{const{list:t,selected:c,renderItem:r,depth:a=0,onSelect:s,instanceId:l,isSingle:i,search:u}=e;return t?Object(n.createElement)(n.Fragment,null,t.map(t=>{const d=-1!==c.findIndex(e=>{let{id:c}=e;return c===t.id});return Object(n.createElement)(n.Fragment,{key:t.id},Object(n.createElement)("li",null,r({item:t,isSelected:d,onSelect:s,isSingle:i,search:u,depth:a,controlId:l})),Object(n.createElement)(E,o()({},e,{list:t.children,depth:a+1})))})):null},w=e=>{let{isLoading:t,isSingle:c,selected:r,messages:o,onChange:l,onRemove:i}=e;if(t||c||!r)return null;const u=r.length;return Object(n.createElement)("div",{className:"woocommerce-search-list__selected"},Object(n.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(n.createElement)("strong",null,o.selected(u)),u>0?Object(n.createElement)(s.Button,{isLink:!0,isDestructive:!0,onClick:()=>l([]),"aria-label":o.clear},Object(a.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(n.createElement)("ul",null,r.map((e,t)=>Object(n.createElement)("li",{key:t},Object(n.createElement)(h,{label:e.name,id:e.id,remove:i})))):null)},f=e=>{let{filteredList:t,search:c,onSelect:r,instanceId:o,...s}=e;const{messages:u,renderItem:d,selected:b,isSingle:p}=s,m=d||_;return 0===t.length?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(n.createElement)(l.a,{icon:i.a})),Object(n.createElement)("span",{className:"woocommerce-search-list__not-found-text"},c?Object(a.sprintf)(u.noResults,c):u.noItems)):Object(n.createElement)("ul",{className:"woocommerce-search-list__list"},Object(n.createElement)(E,{list:t,selected:b,renderItem:m,onSelect:r,instanceId:o,isSingle:p,search:c}))},k=e=>{const{className:t="",isCompact:c,isHierarchical:r,isLoading:a,isSingle:l,list:i,messages:u=p.a,onChange:m,onSearch:g,selected:O,debouncedSpeak:j}=e,[h,_]=Object(n.useState)(""),E=Object(b.useInstanceId)(k),y=Object(n.useMemo)(()=>({...p.a,...u}),[u]),v=Object(n.useMemo)(()=>Object(p.c)(i,h,r),[i,h,r]);Object(n.useEffect)(()=>{j&&j(y.updated)},[j,y]),Object(n.useEffect)(()=>{"function"==typeof g&&g(h)},[h,g]);const S=Object(n.useCallback)(e=>()=>{l&&m([]);const t=O.findIndex(t=>{let{id:c}=t;return c===e});m([...O.slice(0,t),...O.slice(t+1)])},[l,O,m]),C=Object(n.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:c}=t;return c===e.id})?m(l?[e]:[...O,e]):S(e.id)()},[l,S,m,O]);return Object(n.createElement)("div",{className:d()("woocommerce-search-list",t,{"is-compact":c})},Object(n.createElement)(w,o()({},e,{onRemove:S,messages:y})),Object(n.createElement)("div",{className:"woocommerce-search-list__search"},Object(n.createElement)(s.TextControl,{label:y.search,type:"search",value:h,onChange:e=>_(e)})),a?Object(n.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(n.createElement)(s.Spinner,null)):Object(n.createElement)(f,o()({},e,{search:h,filteredList:v,messages:y,onSelect:C,instanceId:E})))};Object(s.withSpokenMessages)(k)},,function(e,t,c){"use strict";var r=c(0),o=c(7),n=c(1),a=c(3),s=c(11);function l(e){let{level:t}=e;const c={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return c.hasOwnProperty(t)?Object(r.createElement)(s.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(s.Path,{d:c[t]})):null}class i extends r.Component{createLevelControl(e,t,c){const o=e===t;return{icon:Object(r.createElement)(l,{level:e}),title:Object(n.sprintf)(
15
  /* translators: %s: heading level e.g: "2", "3", "4" */
16
+ Object(n.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:o,onClick:()=>c(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:c,selectedLevel:n,onChange:s}=this.props;return Object(r.createElement)(a.ToolbarGroup,{isCollapsed:e,icon:Object(r.createElement)(l,{level:n}),controls:Object(o.range)(t,c).map(e=>this.createLevelControl(e,n,s))})}}t.a=i},function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},function(e,t){e.exports=window.wp.warning},function(e,t,c){"use strict";c.d(t,"b",(function(){return l})),c.d(t,"a",(function(){return i}));var r=c(0),o=c(7),n=c(22),a=c.n(n);const s=Object(r.createContext)({getValidationError:()=>"",setValidationErrors:e=>{},clearValidationError:e=>{},clearAllValidationErrors:()=>{},hideValidationError:()=>{},showValidationError:()=>{},showAllValidationErrors:()=>{},hasValidationErrors:!1,getValidationErrorId:e=>e}),l=()=>Object(r.useContext)(s),i=e=>{let{children:t}=e;const[c,n]=Object(r.useState)({}),l=Object(r.useCallback)(e=>c[e],[c]),i=Object(r.useCallback)(e=>{const t=c[e];return!t||t.hidden?"":"validate-error-"+e},[c]),u=Object(r.useCallback)(e=>{n(t=>{if(!t[e])return t;const{[e]:c,...r}=t;return r})},[]),d=Object(r.useCallback)(()=>{n({})},[]),b=Object(r.useCallback)(e=>{e&&n(t=>(e=Object(o.pickBy)(e,(e,c)=>!("string"!=typeof e.message||t.hasOwnProperty(c)&&a()(t[c],e))),0===Object.values(e).length?t:{...t,...e}))},[]),p=Object(r.useCallback)((e,t)=>{n(c=>{if(!c.hasOwnProperty(e))return c;const r={...c[e],...t};return a()(c[e],r)?c:{...c,[e]:r}})},[]),m={getValidationError:l,setValidationErrors:b,clearValidationError:u,clearAllValidationErrors:d,hideValidationError:Object(r.useCallback)(e=>{p(e,{hidden:!0})},[p]),showValidationError:Object(r.useCallback)(e=>{p(e,{hidden:!1})},[p]),showAllValidationErrors:Object(r.useCallback)(()=>{n(e=>{const t={};return Object.keys(e).forEach(c=>{e[c].hidden&&(t[c]={...e[c],hidden:!1})}),0===Object.values(t).length?e:{...e,...t}})},[]),hasValidationErrors:Object.keys(c).length>0,getValidationErrorId:i};return Object(r.createElement)(s.Provider,{value:m},t)}},function(e,t,c){"use strict";var r=c(0),o=c(1),n=c(113),a=c(241),s=c(2),l=c(5),i=c(30);t.a=e=>{const t=(Object(i.useProductDataContext)().product||{}).id||e.productId||0;return t?Object(r.createElement)(l.InspectorControls,null,Object(r.createElement)("div",{className:"wc-block-single-product__edit-card"},Object(r.createElement)("div",{className:"wc-block-single-product__edit-card-title"},Object(r.createElement)("a",{href:`${s.ADMIN_URL}post.php?post=${t}&action=edit`,target:"_blank",rel:"noopener noreferrer"},Object(o.__)("Edit this product's details","woo-gutenberg-products-block"),Object(r.createElement)(n.a,{icon:a.a,size:16}))),Object(r.createElement)("div",{className:"wc-block-single-product__edit-card-description"},Object(o.__)("Edit details such as title, price, description and more.","woo-gutenberg-products-block")))):null}},,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(12);function o(e,t){const c=Object(r.useRef)();return Object(r.useEffect)(()=>{c.current===e||t&&!t(e,c.current)||(c.current=e)},[e,t]),c.current}},,,,,,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(14),s=c(4),l=c.n(s);c(154),t.a=e=>{let{className:t="",disabled:c=!1,name:r,permalink:s="",target:i,rel:u,style:d,onClick:b,...p}=e;const m=l()("wc-block-components-product-name",t);if(c){const e=p;return Object(n.createElement)("span",o()({className:m},e,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)}}))}return Object(n.createElement)("a",o()({className:m,href:s,target:i},p,{dangerouslySetInnerHTML:{__html:Object(a.decodeEntities)(r)},style:d}))}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(9);const o=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const c=Object(r.select)("core/notices").getNotices(),{removeNotice:o}=Object(r.dispatch)("core/notices"),n=c.filter(t=>t.status===e);n.forEach(e=>o(e.id,t))}},function(e,t,c){"use strict";var r=c(0),o=c(87),n=c(60);const a=e=>{const t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)},s=e=>e.replace(/<\/?[a-z][^>]*?>/gi,""),l=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,i=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"&hellip;";const r=s(e),o=r.split(" ").splice(0,t).join(" ");return Object(n.autop)(l(o,c))},u=function(e,t){let c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"&hellip;";const o=s(e),a=o.slice(0,t);if(c)return Object(n.autop)(l(a,r));const i=a.match(/([\s]+)/g),u=i?i.length:0,d=o.slice(0,t+u);return Object(n.autop)(l(d,r))};t.a=e=>{let{source:t,maxLength:c=15,countType:s="words",className:l="",style:d={}}=e;const b=Object(r.useMemo)(()=>function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:15,c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"words";const r=Object(n.autop)(e),s=Object(o.count)(r,c);if(s<=t)return r;const l=a(r),d=Object(o.count)(l,c);return d<=t?l:"words"===c?i(l,t):u(l,t,"characters_including_spaces"===c)}(t,c,s),[t,c,s]);return Object(r.createElement)(r.RawHTML,{style:d,className:l},b)}},,function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(28),s=c(10);c(160),t.a=Object(s.withInstanceId)(e=>{let{className:t,instanceId:c,label:o="",onChange:s,options:l,screenReaderLabel:i,value:u=""}=e;const d="wc-block-components-sort-select__select-"+c;return Object(r.createElement)("div",{className:n()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(r.createElement)(a.a,{label:o,screenReaderLabel:i,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:d}}),Object(r.createElement)("select",{id:d,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:s,value:u},l&&l.map(e=>Object(r.createElement)("option",{key:e.key,value:e.key},e.label))))})},,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(35),o=c(153);const n=e=>{const t=Object(r.a)(e)?e:{},c=Object(o.a)(t.style),n=Object(r.a)(c.typography)?c.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:n.fontSize,lineHeight:n.lineHeight,fontWeight:n.fontWeight,textTransform:n.textTransform,fontFamily:t.fontFamily}}}},,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(0);const o=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var r=c(17),o=c(9),n=c(0),a=c(49),s=c(125);const l=e=>{const{namespace:t,resourceName:c,resourceValues:l=[],query:i={},shouldSelect:u=!0}=e;if(!t||!c)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(n.useRef)({results:[],isLoading:!0}),b=Object(a.a)(i),p=Object(a.a)(l),m=Object(s.a)(),g=Object(o.useSelect)(e=>{if(!u)return null;const o=e(r.COLLECTIONS_STORE_KEY),n=[t,c,b,p],a=o.getCollectionError(...n);if(a){if(!(a instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");m(a)}return{results:o.getCollection(...n),isLoading:!o.hasFinishedResolution("getCollection",n)}},[t,c,p,b,u]);return null!==g&&(d.current=g),d.current}},,,,,,function(e,t){},,function(e,t){},,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(5);const o=()=>"function"==typeof r.__experimentalGetSpacingClassesAndStyles},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(5),o=c(95),n=c(35),a=c(153);const s=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(n.a)(e)?e:{},c=Object(a.a)(t.style);return Object(r.__experimentalUseColorProps)({...t,style:c})}},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(0);const o=Object(r.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 230 250",style:{width:"100%"}},Object(r.createElement)("title",null,"Grid Block Preview"),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:".162",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"9.216",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"1.565",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"82.478",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"91.532",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"83.882",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:".779",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"76.153",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"101.448",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"65.374",height:"65.374",x:"164.788",y:"136.277",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"47.266",height:"5.148",x:"173.843",y:"211.651",fill:"#E1E3E6",rx:"2.574"}),Object(r.createElement)("rect",{width:"62.8",height:"15",x:"166.192",y:"236.946",fill:"#E1E3E6",rx:"5"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"86.301",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"13.283",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"21.498",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"29.713",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"37.927",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"46.238",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"95.599",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"103.814",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"112.029",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"120.243",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"128.554",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"177.909",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"186.124",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"194.339",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"202.553",y:"221.798",fill:"#E1E3E6",rx:"3"}),Object(r.createElement)("rect",{width:"6.177",height:"6.177",x:"210.864",y:"221.798",fill:"#E1E3E6",rx:"3"}))},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(3),s=c(4),l=c.n(s);c(182),t.a=function(e){let{className:t="",...c}=e;const r=l()("wc-block-text-toolbar-button",t);return Object(n.createElement)(a.Button,o()({className:r},c))}},,,function(e,t,c){"use strict";c.d(t,"b",(function(){return n})),c.d(t,"a",(function(){return a}));var r=c(0);const o=Object(r.createContext)({setIsSuppressed:e=>{},isSuppressed:!1}),n=()=>Object(r.useContext)(o),a=e=>{let{children:t}=e;const[c,n]=Object(r.useState)(!1),a={setIsSuppressed:n,isSuppressed:c};return Object(r.createElement)(o.Provider,{value:a},t)}},,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(100),o=c(35);const n=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(o.a)(e)?e:{}},function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,function(e,t){},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r=e=>"number"==typeof e},,,,,,,,,,,,,,,function(e,t){},,,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(23),s=c(25),l=c(112),i=c(27);t.a=e=>t=>{let{selected:c,...r}=t;const[u,d]=Object(n.useState)(!0),[b,p]=Object(n.useState)(null),[m,g]=Object(n.useState)([]),O=a.o.productCount>100,j=async e=>{const t=await Object(i.a)(e);p(t),d(!1)},h=Object(n.useRef)(c);Object(n.useEffect)(()=>{Object(s.h)({selected:h.current}).then(e=>{g(e),d(!1)}).catch(j)},[h]);const _=Object(l.a)(e=>{Object(s.h)({selected:c,search:e}).then(e=>{g(e),d(!1)}).catch(j)},400),E=Object(n.useCallback)(e=>{d(!0),_(e)},[d,_]);return Object(n.createElement)(e,o()({},r,{selected:c,error:b,products:m,isLoading:u,onSearch:O?E:null}))}},function(e,t){},,,,,function(e,t){},,,,,,,,,,,,,,,,,,,,,function(e){e.exports=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":1,"textdomain":"woo-gutenberg-products-block","name":"woocommerce/all-products","title":"All Products","category":"woocommerce","keywords":["WooCommerce"],"description":"Display products from your store in a grid layout.","supports":{"align":["wide","full"],"html":false,"multiple":false},"example":{"attributes":{"isPreview":true}},"attributes":{"columns":{"type":"number"},"rows":{"type":"number"},"alignButtons":{"type":"boolean"},"contentVisibility":{"type":"object"},"orderby":{"type":"string"},"layoutConfig":{"type":"array"},"isPreview":{"type":"boolean","default":false}}}')},,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return l}));var r=c(5),o=c(95),n=c(35),a=c(137),s=c(153);const l=e=>{if(!Object(o.b)()||!Object(a.a)())return{style:{}};const t=Object(n.a)(e)?e:{},c=Object(s.a)(t.style);return Object(r.__experimentalGetSpacingClassesAndStyles)({...t,style:c})}},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(28),l=c(30),i=c(225),u=c(140),d=c(123),b=c(221),p=c(58);c(335),t.default=Object(p.withProductDataContext)(e=>{const{className:t,align:c}=e,{parentClassName:n}=Object(l.useInnerBlockLayoutContext)(),{product:p}=Object(l.useProductDataContext)(),m=Object(i.a)(e),g=Object(u.a)(e),O=Object(d.a)(e),j=Object(b.a)(e);if(!p.id||!p.on_sale)return null;const h="string"==typeof c?"wc-block-components-product-sale-badge--align-"+c:"";return Object(r.createElement)("div",{className:a()("wc-block-components-product-sale-badge",t,h,{[n+"__product-onsale"]:n},g.className,m.className),style:{...g.style,...m.style,...O.style,...j.style}},Object(r.createElement)(s.a,{label:Object(o.__)("Sale","woo-gutenberg-products-block"),screenReaderLabel:Object(o.__)("Product on sale","woo-gutenberg-products-block")}))})},,,function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var r=c(5),o=c(95),n=c(35),a=c(153);const s=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(n.a)(e)?e:{},c=Object(a.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:c})}},,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0),o=c(102);c(178);const n=e=>{let{errorMessage:t="",propertyName:c="",elementId:n=""}=e;const{getValidationError:a,getValidationErrorId:s}=Object(o.b)();if(!t||"string"!=typeof t){const e=a(c)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(r.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(r.createElement)("p",{id:s(n)},t))}},,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return b}));var r=c(6),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(288),i=c(9),u=(c(187),c(147));const d=e=>{let{status:t="default"}=e;switch(t){case"error":return"woocommerce-error";case"success":return"woocommerce-message";case"info":case"warning":return"woocommerce-info"}return""},b=e=>{let{className:t,context:c="default",additionalNotices:r=[]}=e;const{isSuppressed:a}=Object(u.b)(),{notices:b}=Object(i.useSelect)(e=>({notices:e("core/notices").getNotices(c)})),{removeNotice:p}=Object(i.useDispatch)("core/notices"),m=b.filter(e=>"snackbar"!==e.type).concat(r);if(!m.length)return null;const g=s()(t,"wc-block-components-notices");return a?null:Object(n.createElement)("div",{className:g},m.map(e=>Object(n.createElement)(l.a,o()({key:"store-notice-"+e.id},e,{className:s()("wc-block-components-notices__notice",d(e)),onRemove:()=>{e.isDismissible&&p(e.id,c)}}),e.content)))}},,,,,,,,function(e,t,c){"use strict";c.d(t,"c",(function(){return a})),c.d(t,"b",(function(){return s})),c.d(t,"a",(function(){return l}));const r=window.CustomEvent||null,o=(e,t)=>{let{bubbles:c=!1,cancelable:o=!1,element:n,detail:a={}}=t;if(!r)return;n||(n=document.body);const s=new r(e,{bubbles:c,cancelable:o,detail:a});n.dispatchEvent(s)};let n;const a=()=>{n&&clearTimeout(n),n=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},s=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},l=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if("function"!=typeof jQuery)return()=>{};const n=()=>{o(t,{bubbles:c,cancelable:r})};return jQuery(document).on(e,n),()=>jQuery(document).off(e,n)}},function(e,t,c){"use strict";c.d(t,"b",(function(){return n})),c.d(t,"a",(function(){return a}));var r=c(90),o=(c(15),c(2));const n=(e,t)=>Object.keys(o.defaultAddressFields).every(c=>e[c]===t[c]),a=e=>{const t=Object.keys(o.defaultAddressFields),c=Object(r.a)(t,{},e.country),n=Object.assign({},e);return c.forEach(t=>{let{key:c="",hidden:r=!1}=t;r&&((e,t)=>e in t)(c,e)&&(n[c]="")}),n}},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(94);const o=(e,t)=>function(c){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const n=r.a.addEventCallback(e,c,o);return t(n),()=>{t(r.a.removeEventCallback(e,n.id))}}},function(e,t,c){"use strict";c.d(t,"a",(function(){return n})),c.d(t,"b",(function(){return a}));const r=(e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[];var o=c(37);const n=async(e,t,c)=>{const o=r(e,t),n=[];for(const e of o)try{const t=await Promise.resolve(e.callback(c));"object"==typeof t&&n.push(t)}catch(e){console.error(e)}return!n.length||n},a=async(e,t,c)=>{const n=[],a=r(e,t);for(const e of a)try{const t=await Promise.resolve(e.callback(c));if("object"!=typeof t||null===t)continue;if(!t.hasOwnProperty("type"))throw new Error("Returned objects from event emitter observers must return an object with a type property");if(Object(o.a)(t)||Object(o.b)(t))return n.push(t),n;n.push(t)}catch(e){return console.error(e),n.push({type:"error"}),n}return n}},,,,,function(e,t,c){"use strict";var r=c(0),o=c(11);const n=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)("path",{fill:"none",d:"M0 0h24v24H0V0z"}),Object(r.createElement)("path",{d:"M15.55 13c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.37-.66-.11-1.48-.87-1.48H5.21l-.94-2H1v2h2l3.6 7.59-1.35 2.44C4.52 15.37 5.48 17 7 17h12v-2H7l1.1-2h7.45zM6.16 6h12.15l-2.76 5H8.53L6.16 6zM7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"}));t.a=n},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t){},function(e,t,c){"use strict";var r=c(95);let o={headingLevel:{type:"number",default:2},showProductLink:{type:"boolean",default:!0},linkTarget:{type:"string"},productId:{type:"number",default:0}};Object(r.b)()&&(o={...o,align:{type:"string"}}),t.a=o},function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(30),s=c(95),l=c(58),i=c(115),u=c(78),d=c(140),b=c(221),p=c(123);c(336);const m=e=>{let{children:t,headingLevel:c,elementType:o="h"+c,...n}=e;return Object(r.createElement)(o,n,t)};t.a=Object(l.withProductDataContext)(e=>{const{className:t,headingLevel:c=2,showProductLink:o=!0,linkTarget:l,align:g}=e,{parentClassName:O}=Object(a.useInnerBlockLayoutContext)(),{product:j}=Object(a.useProductDataContext)(),{dispatchStoreEvent:h}=Object(u.a)(),_=Object(d.a)(e),E=Object(b.a)(e),w=Object(p.a)(e);return j.id?Object(r.createElement)(m,{headingLevel:c,className:n()(t,_.className,"wc-block-components-product-title",{[O+"__product-title"]:O,["wc-block-components-product-title--align-"+g]:g&&Object(s.b)()}),style:Object(s.b)()?{...E.style,...w.style,..._.style}:{}},Object(r.createElement)(i.a,{disabled:!o,name:j.name,permalink:j.permalink,target:l,onClick:()=>{h("product-view-link",{product:j})}})):Object(r.createElement)(m,{headingLevel:c,className:n()(t,_.className,"wc-block-components-product-title",{[O+"__product-title"]:O,["wc-block-components-product-title--align-"+g]:g&&Object(s.b)()}),style:Object(s.b)()?{...E.style,...w.style,..._.style}:{}})})},function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(4),l=c.n(s),i=c(2),u=c(30),d=c(123),b=c(225),p=c(221),m=c(58),g=c(78),O=c(222);c(337);const j=()=>Object(n.createElement)("img",{src:i.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500}),h=e=>{let{image:t,loaded:c,showFullSize:r,fallbackAlt:a}=e;const{thumbnail:s,src:l,srcset:i,sizes:u,alt:d}=t||{},b={alt:d||a,hidden:!c,src:s,...r&&{src:l,srcSet:i,sizes:u}};return Object(n.createElement)(n.Fragment,null,b.src&&Object(n.createElement)("img",o()({"data-testid":"product-image"},b)),!t&&Object(n.createElement)(j,null))};t.a=Object(m.withProductDataContext)(e=>{const{className:t,imageSizing:c="full-size",showProductLink:r=!0,showSaleBadge:o,saleBadgeAlign:s="right"}=e,{parentClassName:i}=Object(u.useInnerBlockLayoutContext)(),{product:m,isLoading:_}=Object(u.useProductDataContext)(),{dispatchStoreEvent:E}=Object(g.a)(),w=Object(d.a)(e),f=Object(b.a)(e),k=Object(p.a)(e);if(!m.id)return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},f.className),style:{...w.style,...f.style,...k.style}},Object(n.createElement)(j,null));const y=!!m.images.length,v=y?m.images[0]:null,S=r?"a":n.Fragment,C=Object(a.sprintf)(
17
  /* translators: %s is referring to the product name */
18
+ Object(a.__)("Link to %s","woo-gutenberg-products-block"),m.name),x={href:m.permalink,...!y&&{"aria-label":C},onClick:()=>{E("product-view-link",{product:m})}};return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},f.className),style:{...w.style,...f.style,...k.style}},Object(n.createElement)(S,r&&x,!!o&&Object(n.createElement)(O.default,{align:s,product:m}),Object(n.createElement)(h,{fallbackAlt:m.name,image:v,loaded:!_,showFullSize:"cropped"!==c})))})},function(e,t,c){"use strict";c.d(t,"a",(function(){return r}));const r={showProductLink:{type:"boolean",default:!0},showSaleBadge:{type:"boolean",default:!0},saleBadgeAlign:{type:"string",default:"right"},imageSizing:{type:"string",default:"full-size"},productId:{type:"number",default:0},isDescendentOfQueryLoop:{type:"boolean",default:!1}}},function(e,t,c){"use strict";t.a={showFormElements:{type:"boolean",default:!1},productId:{type:"number",default:0}}},function(e,t,c){"use strict";var r=c(0),o=c(4),n=c.n(o),a=c(1),s=c(49),l=c(497),i=c(9);const u={PRISTINE:"pristine",IDLE:"idle",DISABLED:"disabled",PROCESSING:"processing",BEFORE_PROCESSING:"before_processing",AFTER_PROCESSING:"after_processing"},d={status:u.PRISTINE,hasError:!1,quantity:0,processingResponse:null,requestParams:{}},b={SET_PRISTINE:"set_pristine",SET_IDLE:"set_idle",SET_DISABLED:"set_disabled",SET_PROCESSING:"set_processing",SET_BEFORE_PROCESSING:"set_before_processing",SET_AFTER_PROCESSING:"set_after_processing",SET_PROCESSING_RESPONSE:"set_processing_response",SET_HAS_ERROR:"set_has_error",SET_NO_ERROR:"set_no_error",SET_QUANTITY:"set_quantity",SET_REQUEST_PARAMS:"set_request_params"},{SET_PRISTINE:p,SET_IDLE:m,SET_DISABLED:g,SET_PROCESSING:O,SET_BEFORE_PROCESSING:j,SET_AFTER_PROCESSING:h,SET_PROCESSING_RESPONSE:_,SET_HAS_ERROR:E,SET_NO_ERROR:w,SET_QUANTITY:f,SET_REQUEST_PARAMS:k}=b,y=()=>({type:m}),v=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=e?E:w;return{type:t}},{SET_PRISTINE:S,SET_IDLE:C,SET_DISABLED:x,SET_PROCESSING:N,SET_BEFORE_PROCESSING:P,SET_AFTER_PROCESSING:T,SET_PROCESSING_RESPONSE:R,SET_HAS_ERROR:I,SET_NO_ERROR:A,SET_QUANTITY:B,SET_REQUEST_PARAMS:L}=b,{PRISTINE:D,IDLE:V,DISABLED:F,PROCESSING:z,BEFORE_PROCESSING:M,AFTER_PROCESSING:q}=u,H=function(){let e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,{quantity:c,type:r,data:o}=arguments.length>1?arguments[1]:void 0;switch(r){case S:e=d;break;case C:e=t.status!==V?{...t,status:V}:t;break;case x:e=t.status!==F?{...t,status:F}:t;break;case B:e=c!==t.quantity?{...t,quantity:c}:t;break;case L:e={...t,requestParams:{...t.requestParams,...o}};break;case R:e={...t,processingResponse:o};break;case N:e=t.status!==z?{...t,status:z,hasError:!1}:t,e=!1===e.hasError?e:{...e,hasError:!1};break;case P:e=t.status!==M?{...t,status:M,hasError:!1}:t;break;case T:e=t.status!==q?{...t,status:q}:t;break;case I:e=t.hasError?t:{...t,hasError:!0},e=t.status===z||t.status===M?{...e,status:V}:e;break;case A:e=t.hasError?{...t,hasError:!1}:t}return e!==t&&r!==S&&e.status===D&&(e.status=V),e};var G=c(94),Q=c(244);const Y=e=>({onAddToCartAfterProcessingWithSuccess:Object(Q.a)("add_to_cart_after_processing_with_success",e),onAddToCartProcessingWithError:Object(Q.a)("add_to_cart_after_processing_with_error",e),onAddToCartBeforeProcessing:Object(Q.a)("add_to_cart_before_processing",e)});var U=c(245),W=c(102),$=c(37),K=c(116);const J=Object(r.createContext)({product:{},productType:"simple",productIsPurchasable:!0,productHasOptions:!1,supportsFormElements:!0,showFormElements:!1,quantity:0,minQuantity:1,maxQuantity:99,requestParams:{},isIdle:!1,isDisabled:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,eventRegistration:{onAddToCartAfterProcessingWithSuccess:e=>{},onAddToCartAfterProcessingWithError:e=>{},onAddToCartBeforeProcessing:e=>{}},dispatchActions:{resetForm:()=>{},submitForm:()=>{},setQuantity:e=>{},setHasError:e=>{},setAfterProcessing:e=>{},setRequestParams:e=>{}}}),X=()=>Object(r.useContext)(J),Z=e=>{var t,c,o,n;let{children:b,product:m,showFormElements:E}=e;const[w,S]=Object(r.useReducer)(H,d),[C,x]=Object(r.useReducer)(G.b,{}),N=Object(s.a)(C),{createErrorNotice:P}=Object(i.useDispatch)("core/notices"),{setValidationErrors:T}=Object(W.b)(),{isSuccessResponse:R,isErrorResponse:I,isFailResponse:A}=Object($.d)(),B=Object(r.useMemo)(()=>({onAddToCartAfterProcessingWithSuccess:Y(x).onAddToCartAfterProcessingWithSuccess,onAddToCartAfterProcessingWithError:Y(x).onAddToCartAfterProcessingWithError,onAddToCartBeforeProcessing:Y(x).onAddToCartBeforeProcessing}),[x]),L=Object(r.useMemo)(()=>({resetForm:()=>{S({type:p})},submitForm:()=>{S({type:j})},setQuantity:e=>{S((e=>({type:f,quantity:e}))(e))},setHasError:e=>{S(v(e))},setRequestParams:e=>{S((e=>({type:k,data:e}))(e))},setAfterProcessing:e=>{S({type:_,data:e}),S({type:h})}}),[]);Object(r.useEffect)(()=>{const e=w.status,t=!m.id||!Object(l.a)(m);e!==u.DISABLED||t?e!==u.DISABLED&&t&&S({type:g}):S(y())},[w.status,m,S]),Object(r.useEffect)(()=>{w.status===u.BEFORE_PROCESSING&&(Object(K.a)("error","wc/add-to-cart"),Object(U.a)(N,"add_to_cart_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:c}=e;t&&P(t,{context:"wc/add-to-cart"}),c&&T(c)}),S(y())):S({type:O})}))},[w.status,T,P,S,N,null==m?void 0:m.id]),Object(r.useEffect)(()=>{if(w.status===u.AFTER_PROCESSING){const e={processingResponse:w.processingResponse},t=e=>{let t=!1;return e.forEach(e=>{const{message:c,messageContext:r}=e;(I(e)||A(e))&&c&&(t=!0,P(c,r?{context:r}:void 0))}),t};if(w.hasError)return void Object(U.b)(N,"add_to_cart_after_processing_with_error",e).then(c=>{if(!t(c)){var r;const t=(null===(r=e.processingResponse)||void 0===r?void 0:r.message)||Object(a.__)("Something went wrong. Please contact us for assistance.","woo-gutenberg-products-block");P(t,{id:"add-to-cart",context:"woocommerce/single-product/"+((null==m?void 0:m.id)||0)})}S(y())});Object(U.b)(N,"add_to_cart_after_processing_with_success",e).then(e=>{t(e)?S(v(!0)):S(y())})}},[w.status,w.hasError,w.processingResponse,L,P,I,A,R,N,null==m?void 0:m.id]);const D=Object(l.b)(m),V={product:m,productType:m.type||"simple",productIsPurchasable:Object(l.a)(m),productHasOptions:m.has_options||!1,supportsFormElements:D,showFormElements:E&&D,quantity:w.quantity||(null==m||null===(t=m.add_to_cart)||void 0===t?void 0:t.minimum)||1,minQuantity:(null==m||null===(c=m.add_to_cart)||void 0===c?void 0:c.minimum)||1,maxQuantity:(null==m||null===(o=m.add_to_cart)||void 0===o?void 0:o.maximum)||99,multipleOf:(null==m||null===(n=m.add_to_cart)||void 0===n?void 0:n.multiple_of)||1,requestParams:w.requestParams,isIdle:w.status===u.IDLE,isDisabled:w.status===u.DISABLED,isProcessing:w.status===u.PROCESSING,isBeforeProcessing:w.status===u.BEFORE_PROCESSING,isAfterProcessing:w.status===u.AFTER_PROCESSING,hasError:w.hasError,eventRegistration:B,dispatchActions:L};return Object(r.createElement)(J.Provider,{value:V},b)};var ee=c(13),te=c.n(ee),ce=c(14),re=c(242),oe=c(41),ne=()=>{const{dispatchActions:e,product:t,quantity:c,eventRegistration:o,hasError:n,isProcessing:s,requestParams:l}=X(),{hasValidationErrors:u,showAllValidationErrors:d}=Object(W.b)(),{createErrorNotice:b,removeNotice:p}=Object(i.useDispatch)("core/notices"),{receiveCart:m}=Object(oe.a)(),[g,O]=Object(r.useState)(!1),j=!n&&s,h=Object(r.useCallback)(()=>!u||(d(),{type:"error"}),[u,d]);Object(r.useEffect)(()=>{const e=o.onAddToCartBeforeProcessing(h,0);return()=>{e()}},[o,h]);const _=Object(r.useCallback)(()=>{O(!0),p("add-to-cart","woocommerce/single-product/"+((null==t?void 0:t.id)||0));const r={id:t.id||0,quantity:c,...l};te()({path:"/wc/store/v1/cart/add-item",method:"POST",data:r,cache:"no-store",parse:!1}).then(c=>{te.a.setNonce(c.headers),c.json().then((function(r){c.ok?m(r):(r.body&&r.body.message?b(Object(ce.decodeEntities)(r.body.message),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}):b(Object(a.__)("Something went wrong. Please contact us for assistance.","woo-gutenberg-products-block"),{id:"add-to-cart",context:"woocommerce/single-product/"+((null==t?void 0:t.id)||0)}),e.setHasError()),Object(re.b)({preserveCartData:!0}),e.setAfterProcessing(r),O(!1)}))}).catch(t=>{t.json().then((function(t){var c;null!==(c=t.data)&&void 0!==c&&c.cart&&m(t.data.cart),e.setHasError(),e.setAfterProcessing(t),O(!1)}))})},[t,b,p,m,e,c,l]);return Object(r.useEffect)(()=>{j&&!g&&_()},[j,_,g]),null};const ae=e=>{let{children:t,product:c,showFormElements:o}=e;return Object(r.createElement)(W.a,null,Object(r.createElement)(Z,{product:c,showFormElements:o},t,Object(r.createElement)(ne,null)))};var se=c(30),le=c(7),ie=c(58),ue=(c(290),c(68)),de=c(113),be=c(527),pe=c(78),me=c(346);const ge=e=>{let{className:t,href:c,text:o,onClick:n}=e;return Object(r.createElement)(ue.a,{className:t,href:c,onClick:n,rel:"nofollow"},o)},Oe=e=>{let{className:t,quantityInCart:c,isProcessing:o,isDisabled:n,isDone:s,onClick:l}=e;return Object(r.createElement)(ue.a,{className:t,disabled:n,showSpinner:o,onClick:l},s&&c>0?Object(a.sprintf)(
19
  /* translators: %s number of products in cart. */
20
+ Object(a._n)("%d in cart","%d in cart",c,"woo-gutenberg-products-block"),c):Object(a.__)("Add to cart","woo-gutenberg-products-block"),!!s&&Object(r.createElement)(de.a,{icon:be.a}))};var je=()=>{const{showFormElements:e,productIsPurchasable:t,productHasOptions:c,product:o,productType:n,isDisabled:s,isProcessing:l,eventRegistration:i,hasError:u,dispatchActions:d}=X(),{parentName:b}=Object(se.useInnerBlockLayoutContext)(),{dispatchStoreEvent:p}=Object(pe.a)(),{cartQuantity:m}=Object(me.a)(o.id||0),[g,O]=Object(r.useState)(!1),j=o.add_to_cart||{url:"",text:""};return Object(r.useEffect)(()=>{const e=i.onAddToCartAfterProcessingWithSuccess(()=>(u||O(!0),!0),0);return()=>{e()}},[i,u]),(e||!c&&"simple"===n)&&t?Object(r.createElement)(Oe,{className:"wc-block-components-product-add-to-cart-button",quantityInCart:m,isDisabled:s,isProcessing:l,isDone:g,onClick:()=>{d.submitForm("woocommerce/single-product/"+((null==o?void 0:o.id)||0)),p("cart-add-item",{product:o,listName:b})}}):Object(r.createElement)(ge,{className:"wc-block-components-product-add-to-cart-button",href:j.url,text:j.text||Object(a.__)("View Product","woo-gutenberg-products-block"),onClick:()=>{p("product-view-link",{product:o,listName:b})}})},he=c(112),_e=e=>{let{disabled:t,min:c,max:o,step:n=1,value:a,onChange:s}=e;const l=void 0!==o,i=Object(he.a)(e=>{let t=e;l&&(t=Math.min(t,Math.floor(o/n)*n)),t=Math.max(t,Math.ceil(c/n)*n),t=Math.floor(t/n)*n,t!==e&&s(t)},300);return Object(r.createElement)("input",{className:"wc-block-components-product-add-to-cart-quantity",type:"number",value:a,min:c,max:o,step:n,hidden:1===o,disabled:t,onChange:e=>{s(e.target.value),i(e.target.value)}})},Ee=e=>{let{reason:t=Object(a.__)("Sorry, this product cannot be purchased.","woo-gutenberg-products-block")}=e;return Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-unavailable"},t)},we=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:o,multipleOf:n,dispatchActions:s,isDisabled:l}=X();return e.id&&!e.is_purchasable?Object(r.createElement)(Ee,null):e.id&&!e.is_in_stock?Object(r.createElement)(Ee,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(_e,{value:t,min:c,max:o,step:n,disabled:l,onChange:s.setQuantity}),Object(r.createElement)(je,null))},fe=(c(345),c(544)),ke=c(12),ye=c(227);const ve={value:"",label:Object(a.__)("Select an option","woo-gutenberg-products-block")};var Se=e=>{let{attributeName:t,options:c=[],value:o="",onChange:s=(()=>{}),errorMessage:l=Object(a.__)("Please select a value.","woo-gutenberg-products-block")}=e;const{getValidationError:i,setValidationErrors:u,clearValidationError:d}=Object(W.b)(),b=t,p=i(b)||{};return Object(ke.useEffect)(()=>{o?d(b):u({[b]:{message:l,hidden:!0}})},[o,b,l,d,u]),Object(ke.useEffect)(()=>()=>{d(b)},[b,d]),Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker__container"},Object(r.createElement)(fe.a,{label:Object(ce.decodeEntities)(t),value:o||"",options:[ve,...c],onChange:s,required:!0,className:n()("wc-block-components-product-add-to-cart-attribute-picker__select",{"has-error":p.message&&!p.hidden})}),Object(r.createElement)(ye.a,{propertyName:b,elementId:b}))},Ce=c(35);const xe=(e,t,c)=>{const r=Object.values(t).map(e=>{let{id:t}=e;return t});if(Object.values(c).every(e=>""===e))return r;const o=Object.keys(e);return r.filter(e=>o.every(r=>{const o=c[r]||"",n=t["id:"+e].attributes[r];return""===o||null===n||n===o}))};var Ne=e=>{let{attributes:t,variationAttributes:c,setRequestParams:o}=e;const n=Object(s.a)(t),a=Object(s.a)(c),[l,i]=Object(r.useState)(0),[u,d]=Object(r.useState)({}),[b,p]=Object(r.useState)(!1),m=Object(r.useMemo)(()=>((e,t,c)=>{const r={},o=Object.keys(e),n=Object.values(c).filter(Boolean).length>0;return o.forEach(o=>{const a=e[o],s={...c,[o]:null},l=n?xe(e,t,s):null,i=null!==l?l.map(e=>t["id:"+e].attributes[o]):null;r[o]=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return Object.values(e).map(e=>{let{name:c,slug:r}=e;return null===t||t.includes(null)||t.includes(r)?{value:r,label:Object(ce.decodeEntities)(c)}:null}).filter(Boolean)}(a.terms,i)}),r})(n,a,u),[u,n,a]);return Object(r.useEffect)(()=>{if(!b){const e=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!Object(Ce.a)(e))return{};const t=Object.keys(e),c={};return 0===t.length||t.forEach(t=>{const r=e[t],o=r.terms.filter(e=>e.default);var n;o.length>0&&(c[r.name]=null===(n=o[0])||void 0===n?void 0:n.slug)}),c}(t);e&&d({...e}),p(!0)}},[u,t,b]),Object(r.useEffect)(()=>{Object.values(u).filter(e=>""!==e).length===Object.keys(n).length?i(((e,t,c)=>xe(e,t,c)[0]||0)(n,a,u)):l>0&&i(0)},[u,l,n,a]),Object(r.useEffect)(()=>{o({id:l,variation:Object.keys(u).map(e=>({attribute:e,value:u[e]}))})},[o,l,u]),Object(r.createElement)("div",{className:"wc-block-components-product-add-to-cart-attribute-picker"},Object.keys(n).map(e=>Object(r.createElement)(Se,{key:e,attributeName:e,options:m[e],value:u[e],onChange:t=>{d({...u,[e]:t})}})))},Pe=e=>{let{product:t,dispatchers:c}=e;const o=(e=>e?Object(le.keyBy)(Object.values(e).filter(e=>{let{has_variations:t}=e;return t}),"name"):{})(t.attributes),n=(e=>{if(!e)return{};const t={};return e.forEach(e=>{let{id:c,attributes:r}=e;t["id:"+c]={id:c,attributes:r.reduce((e,t)=>{let{name:c,value:r}=t;return e[c]=r,e},{})}}),t})(t.variations);return 0===Object.keys(o).length||0===n.length?null:Object(r.createElement)(Ne,{attributes:o,variationAttributes:n,setRequestParams:c.setRequestParams})},Te=()=>{const{product:e,quantity:t,minQuantity:c,maxQuantity:o,multipleOf:n,dispatchActions:s,isDisabled:l}=X();return e.id&&!e.is_purchasable?Object(r.createElement)(Ee,null):e.id&&!e.is_in_stock?Object(r.createElement)(Ee,{reason:Object(a.__)("This product is currently out of stock and cannot be purchased.","woo-gutenberg-products-block")}):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(Pe,{product:e,dispatchers:s}),Object(r.createElement)(_e,{value:t,min:c,max:o,step:n,disabled:l,onChange:s.setQuantity}),Object(r.createElement)(je,null))},Re=()=>Object(r.createElement)(je,null),Ie=c(529),Ae=()=>Object(r.createElement)(Ie.a,{className:"wc-block-components-product-add-to-cart-group-list"},"This is a placeholder for the grouped products form element."),Be=()=>Object(r.createElement)(Ae,null);const Le=()=>{const{showFormElements:e,productType:t}=X();return e?"variable"===t?Object(r.createElement)(Te,null):"grouped"===t?Object(r.createElement)(Be,null):"external"===t?Object(r.createElement)(Re,null):"simple"===t||"variation"===t?Object(r.createElement)(we,null):null:Object(r.createElement)(je,null)};t.a=Object(ie.withProductDataContext)(e=>{let{className:t,showFormElements:c}=e;const{product:o}=Object(se.useProductDataContext)(),a=n()(t,"wc-block-components-product-add-to-cart",{"wc-block-components-product-add-to-cart--placeholder":Object(le.isEmpty)(o)});return Object(r.createElement)(ae,{product:o,showFormElements:c},Object(r.createElement)("div",{className:a},Object(r.createElement)(Le,null)))})},,,,,,,,,,function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(4),n=c.n(o),a=c(92),s=c(26),l=c(30),i=c(140),u=c(123),d=c(58);t.default=Object(d.withProductDataContext)(e=>{var t,c;const{className:o,textAlign:d}=e,{parentClassName:b}=Object(l.useInnerBlockLayoutContext)(),{product:p}=Object(l.useProductDataContext)(),m=Object(i.a)(e),g=Object(u.a)(e),O=n()("wc-block-components-product-price",o,m.className,{[b+"__product-price"]:b}),j={...g.style,...m.style};if(!p.id)return Object(r.createElement)(a.a,{align:d,className:O});const h=p.prices,_=Object(s.getCurrencyFromPriceResponse)(h),E=h.price!==h.regular_price,w=n()({[b+"__product-price__value"]:b,[b+"__product-price__value--on-sale"]:E});return Object(r.createElement)(a.a,{align:d,className:O,priceStyle:j,regularPriceStyle:j,priceClassName:w,currency:_,price:h.price,minPrice:null==h||null===(t=h.price_range)||void 0===t?void 0:t.min_amount,maxPrice:null==h||null===(c=h.price_range)||void 0===c?void 0:c.max_amount,regularPrice:h.regular_price,regularPriceClassName:n()({[b+"__product-price__regular"]:b})})})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(30),l=c(140),i=c(123),u=c(221),d=c(58);c(338);t.default=Object(d.withProductDataContext)(e=>{const{parentClassName:t}=Object(s.useInnerBlockLayoutContext)(),{product:c}=Object(s.useProductDataContext)(),n=(e=>{const t=parseFloat(e.average_rating);return Number.isFinite(t)&&t>0?t:0})(c),d=Object(l.a)(e),b=Object(i.a)(e),p=Object(u.a)(e);if(!n)return null;const m={width:n/5*100+"%"},g=Object(o.sprintf)(
21
  /* translators: %f is referring to the average rating value */
22
  Object(o.__)("Rated %f out of 5","woo-gutenberg-products-block"),n),O=(e=>{const t=parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0})(c),j={__html:Object(o.sprintf)(
23
  /* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
24
+ Object(o._n)("Rated %1$s out of 5 based on %2$s customer rating","Rated %1$s out of 5 based on %2$s customer ratings",O,"woo-gutenberg-products-block"),Object(o.sprintf)('<strong class="rating">%f</strong>',n),Object(o.sprintf)('<span class="rating">%d</span>',O))};return Object(r.createElement)("div",{className:a()(d.className,"wc-block-components-product-rating",{[t+"__product-rating"]:t}),style:{...d.style,...b.style,...p.style}},Object(r.createElement)("div",{className:a()("wc-block-components-product-rating__stars",t+"__product-rating__stars"),role:"img","aria-label":g},Object(r.createElement)("span",{style:m,dangerouslySetInnerHTML:j})))})},function(e,t,c){"use strict";c.r(t);var r=c(6),o=c.n(r),n=c(0),a=c(4),s=c.n(a),l=c(1),i=c(78),u=c(346),d=c(140),b=c(225),p=c(123),m=c(221),g=c(14),O=c(23),j=c(2),h=c(30),_=c(58);c(339);const E=e=>{let{product:t,colorStyles:c,borderStyles:r,typographyStyles:a,spacingStyles:d}=e;const{id:b,permalink:p,add_to_cart:m,has_options:h,is_purchasable:_,is_in_stock:E}=t,{dispatchStoreEvent:w}=Object(i.a)(),{cartQuantity:f,addingToCart:k,addToCart:y}=Object(u.a)(b,"woocommerce/single-product/"+(b||0)),v=Number.isFinite(f)&&f>0,S=!h&&_&&E,C=Object(g.decodeEntities)((null==m?void 0:m.description)||""),x=v?Object(l.sprintf)(
25
  /* translators: %s number of products in cart. */
26
+ Object(l._n)("%d in cart","%d in cart",f,"woo-gutenberg-products-block"),f):Object(g.decodeEntities)((null==m?void 0:m.text)||Object(l.__)("Add to cart","woo-gutenberg-products-block")),N=S?"button":"a",P={};return S?P.onClick=async()=>{await y(),w("cart-add-item",{product:t});const{cartRedirectAfterAdd:e}=Object(j.getSetting)("productsSettings");e&&(window.location.href=O.d)}:(P.href=p,P.rel="nofollow",P.onClick=()=>{w("product-view-link",{product:t})}),Object(n.createElement)(N,o()({"aria-label":C,className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button",c.className,r.className,{loading:k,added:v}),style:{...c.style,...r.style,...a.style,...d.style},disabled:k},P),x)},w=e=>{let{colorStyles:t,borderStyles:c,typographyStyles:r,spacingStyles:o}=e;return Object(n.createElement)("button",{className:s()("wp-block-button__link","add_to_cart_button","wc-block-components-product-button__button","wc-block-components-product-button__button--placeholder",t.className,c.className),style:{...t.style,...c.style,...r.style,...o.style},disabled:!0})};t.default=Object(_.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(h.useInnerBlockLayoutContext)(),{product:r}=Object(h.useProductDataContext)(),o=Object(d.a)(e),a=Object(b.a)(e),l=Object(p.a)(e),i=Object(m.a)(e);return Object(n.createElement)("div",{className:s()(t,"wp-block-button","wc-block-components-product-button",{[c+"__product-add-to-cart"]:c})},r.id?Object(n.createElement)(E,{product:r,colorStyles:o,borderStyles:a,typographyStyles:l,spacingStyles:i}):Object(n.createElement)(w,{colorStyles:o,borderStyles:a,typographyStyles:l,spacingStyles:i}))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(4),n=c.n(o),a=c(117),s=c(23),l=c(30),i=c(140),u=c(123),d=c(58);c(340),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(l.useInnerBlockLayoutContext)(),{product:o}=Object(l.useProductDataContext)(),d=Object(i.a)(e),b=Object(u.a)(e);if(!o)return Object(r.createElement)("div",{className:n()(t,"wc-block-components-product-summary",{[c+"__product-summary"]:c})});const p=o.short_description?o.short_description:o.description;return p?Object(r.createElement)(a.a,{className:n()(t,d.className,"wc-block-components-product-summary",{[c+"__product-summary"]:c}),source:p,maxLength:150,countType:s.o.wordCountType||"words",style:{...d.style,...b.style}}):null})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(30),l=c(58);c(341),t.default=Object(l.withProductDataContext)(e=>{let{className:t}=e;const{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),l=n.sku;return l?Object(r.createElement)("div",{className:a()(t,"wc-block-components-product-sku",{[c+"__product-sku"]:c})},Object(o.__)("SKU:","woo-gutenberg-products-block")," ",Object(r.createElement)("strong",null,l)):null})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(30),l=c(140),i=c(123),u=c(7),d=c(58);c(342),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),d=Object(l.a)(e),b=Object(i.a)(e);return Object(u.isEmpty)(n.categories)?null:Object(r.createElement)("div",{className:a()(t,"wc-block-components-product-category-list",d.className,{[c+"__product-category-list"]:c}),style:{...d.style,...b.style}},Object(o.__)("Categories:","woo-gutenberg-products-block")," ",Object(r.createElement)("ul",null,Object.values(n.categories).map(e=>{let{name:t,link:c,slug:o}=e;return Object(r.createElement)("li",{key:"category-list-item-"+o},Object(r.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(30),l=c(140),i=c(123),u=c(7),d=c(58);c(343),t.default=Object(d.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),d=Object(l.a)(e),b=Object(i.a)(e);return Object(u.isEmpty)(n.tags)?null:Object(r.createElement)("div",{className:a()(t,d.className,"wc-block-components-product-tag-list",{[c+"__product-tag-list"]:c}),style:{...d.style,...b.style}},Object(o.__)("Tags:","woo-gutenberg-products-block")," ",Object(r.createElement)("ul",null,Object.values(n.tags).map(e=>{let{name:t,link:c,slug:o}=e;return Object(r.createElement)("li",{key:"tag-list-item-"+o},Object(r.createElement)("a",{href:c},t))})))})},function(e,t,c){"use strict";c.r(t);var r=c(0),o=c(1),n=c(4),a=c.n(n),s=c(30),l=c(140),i=c(123),u=c(58);c(344);t.default=Object(u.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),u=Object(l.a)(e),d=Object(i.a)(e);if(!n.id||!n.is_purchasable)return null;const b=!!n.is_in_stock,p=n.low_stock_remaining,m=n.is_on_backorder;return Object(r.createElement)("div",{className:a()(t,u.className,"wc-block-components-product-stock-indicator",{[c+"__stock-indicator"]:c,"wc-block-components-product-stock-indicator--in-stock":b,"wc-block-components-product-stock-indicator--out-of-stock":!b,"wc-block-components-product-stock-indicator--low-stock":!!p,"wc-block-components-product-stock-indicator--available-on-backorder":!!m}),style:{...u.style,...d.style}},p?(e=>Object(o.sprintf)(
27
  /* translators: %d stock amount (number of items in stock for product) */
28
+ Object(o.__)("%d left in stock","woo-gutenberg-products-block"),e))(p):((e,t)=>t?Object(o.__)("Available on backorder","woo-gutenberg-products-block"):e?Object(o.__)("In Stock","woo-gutenberg-products-block"):Object(o.__)("Out of Stock","woo-gutenberg-products-block"))(b,m))})},,,,,,,,,,,,,,,,,,,,,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t,c){"use strict";c.d(t,"a",(function(){return i}));var r=c(0),o=c(9),n=c(17),a=c(14),s=c(41);const l=(e,t)=>{const c=e.find(e=>{let{id:c}=e;return c===t});return c?c.quantity:0},i=e=>{const{addItemToCart:t}=Object(o.useDispatch)(n.CART_STORE_KEY),{cartItems:c,cartIsLoading:i}=Object(s.a)(),{createErrorNotice:u,removeNotice:d}=Object(o.useDispatch)("core/notices"),[b,p]=Object(r.useState)(!1),m=Object(r.useRef)(l(c,e));return Object(r.useEffect)(()=>{const t=l(c,e);t!==m.current&&(m.current=t)},[c,e]),{cartQuantity:Number.isFinite(m.current)?m.current:0,addingToCart:b,cartIsLoading:i,addToCart:function(){let c=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return p(!0),t(e,c).then(()=>{d("add-to-cart")}).catch(e=>{u(Object(a.decodeEntities)(e.message),{id:"add-to-cart",context:"wc/all-products",isDismissible:!0})}).finally(()=>{p(!1)})}}}},,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(1),o=c(23);const n=[{id:1,name:"WordPress Pennant",variation:"",permalink:"https://example.org",sku:"wp-pennant",short_description:Object(r.__)("Fly your WordPress banner with this beauty! Deck out your office space or add it to your kids walls. This banner will spruce up any space it’s hung!","woo-gutenberg-products-block"),description:"Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo.",price:"7.99",price_html:'<span class="woocommerce-Price-amount amount"><span class="woocommerce-Price-currencySymbol">$</span>7.99</span>',images:[{id:1,src:o.m+"previews/pennant.jpg",thumbnail:o.m+"previews/pennant.jpg",name:"pennant-1.jpg",alt:"WordPress Pennant",srcset:"",sizes:""}],average_rating:5,categories:[{id:1,name:"Decor",slug:"decor",link:"https://example.org"}],review_count:1,prices:{currency_code:"GBP",decimal_separator:".",thousand_separator:",",decimals:2,price_prefix:"£",price_suffix:"",price:"7.99",regular_price:"9.99",sale_price:"7.99",price_range:null},add_to_cart:{text:Object(r.__)("Add to cart","woo-gutenberg-products-block"),description:Object(r.__)("Add to cart","woo-gutenberg-products-block")},has_options:!1,is_purchasable:!0,is_in_stock:!0,on_sale:!0}]},,,,,,,,,,function(e,t,c){e.exports=c(461)},function(e,t){},function(e,t){},function(e,t){},,,function(e,t){},function(e,t){},function(e,t){},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.r(t),c.d(t,"metadata",(function(){return rt})),c.d(t,"name",(function(){return Kt}));var r=c(0),o=c(8),n=c(113),a=c(519),s=c(95),l=c(1),i=c(4),u=c.n(i),d={category:"woocommerce-product-elements",keywords:[Object(l.__)("WooCommerce","woo-gutenberg-products-block")],icon:{src:Object(r.createElement)(n.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},supports:{html:!1},parent:["@woocommerce/all-products","@woocommerce/single-product"],save:e=>{let{attributes:t}=e;return t.isDescendentOfQueryLoop?null:Object(r.createElement)("div",{className:u()("is-loading",t.className)})},deprecated:[{attributes:{},save:()=>null}]},b=c(291),p=c(3),m=c(10),g=c(5),O=c(99),j=c(292),h=c(93),_=c(144),E=c(30);c(381);var w=e=>t=>c=>{const o=Object(E.useProductDataContext)(),{attributes:n,setAttributes:a}=c,{productId:s}=n,[i,u]=Object(r.useState)(!s);return o.hasContext?Object(r.createElement)(t,c):Object(r.createElement)(r.Fragment,null,i?Object(r.createElement)(p.Placeholder,{icon:e.icon||"",label:e.label||"",className:"wc-atomic-blocks-product"},!!e.description&&Object(r.createElement)("div",null,e.description),Object(r.createElement)("div",{className:"wc-atomic-blocks-product__selection"},Object(r.createElement)(h.a,{selected:s||0,showVariations:!0,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];a({productId:e[0]?e[0].id:0})}}),Object(r.createElement)(p.Button,{isSecondary:!0,disabled:!s,onClick:()=>{u(!1)}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(r.createElement)(r.Fragment,null,Object(r.createElement)(g.BlockControls,null,Object(r.createElement)(p.ToolbarGroup,null,Object(r.createElement)(_.a,{onClick:()=>u(!0)},Object(l.__)("Switch product…","woo-gutenberg-products-block")))),Object(r.createElement)(t,c)))},f=c(520);const k=Object(l.__)("Product Title","woo-gutenberg-products-block"),y=Object(r.createElement)(n.a,{icon:f.a,className:"wc-block-editor-components-block-icon"}),v=Object(l.__)("Display the title of a product.","woo-gutenberg-products-block");c(382);const S=e=>{let{attributes:t,setAttributes:c}=e;const o=Object(g.useBlockProps)(),{headingLevel:n,showProductLink:a,align:i,linkTarget:u}=t;return Object(r.createElement)("div",o,Object(r.createElement)(g.BlockControls,null,Object(r.createElement)(O.a,{isCollapsed:!0,minLevel:1,maxLevel:7,selectedLevel:n,onChange:e=>c({headingLevel:e})}),Object(s.b)()&&Object(r.createElement)(g.AlignmentToolbar,{value:i,onChange:e=>{c({align:e})}})),Object(r.createElement)(g.InspectorControls,null,Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Link settings","woo-gutenberg-products-block")},Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Make title a link","woo-gutenberg-products-block"),checked:a,onChange:()=>c({showProductLink:!a})}),a&&Object(r.createElement)(r.Fragment,null,Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Open in new tab","woo-gutenberg-products-block"),onChange:e=>c({linkTarget:e?"_blank":"_self"}),checked:"_blank"===u})))),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(j.a,t)))};var C=Object(s.b)()?Object(m.compose)([w({icon:y,label:k,description:Object(l.__)("Choose a product to display its title.","woo-gutenberg-products-block")})])(S):S;const x=e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))};var N=c(137);const P={...d,apiVersion:2,title:k,description:v,icon:{src:y},attributes:b.a,edit:C,save:x,supports:{...d.supports,...Object(s.b)()&&{typography:{fontSize:!0,lineHeight:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0},color:{text:!0,background:!0,link:!1,gradients:!0,__experimentalSkipSerialization:!0},...Object(N.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-title"}}};Object(o.registerBlockType)("woocommerce/product-title",P);var T=c(306),R=c(521);const I=Object(l.__)("Product Price","woo-gutenberg-products-block"),A=Object(r.createElement)(n.a,{icon:R.a,className:"wc-block-editor-components-block-icon"}),B=Object(l.__)("Display the price of a product.","woo-gutenberg-products-block");var L=w({icon:A,label:I,description:Object(l.__)("Choose a product to display its price.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const o=Object(g.useBlockProps)();return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(g.BlockControls,null,Object(s.b)()&&Object(r.createElement)(g.AlignmentToolbar,{value:t.textAlign,onChange:e=>{c({textAlign:e})}})),Object(r.createElement)("div",o,Object(r.createElement)(T.default,t)))});let D={productId:{type:"number",default:0}};Object(s.b)()&&(D={...D,textAlign:{type:"string"}});var V=D;const F={...d,apiVersion:2,title:I,description:B,icon:{src:A},attributes:V,edit:L,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))},supports:{...d.supports,...Object(s.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalFontWeight:!0,__experimentalFontStyle:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-price"}}};Object(o.registerBlockType)("woocommerce/product-price",F);var z=c(522),M=c(6),q=c.n(M),H=c(2),G=c(136),Q=c(293);const Y={html:!1,...Object(s.b)()&&{__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(N.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-image"}};var U=c(294);const W={apiVersion:2,name:"woocommerce/product-image",title:Object(l.__)("Product Image","woo-gutenberg-products-block"),icon:{src:Object(r.createElement)(n.a,{icon:z.a,className:"wc-block-editor-components-block-icon"})},keywords:["WooCommerce"],description:Object(l.__)("Display the main product image.","woo-gutenberg-products-block"),usesContext:["query","queryId","postId"],parent:["@woocommerce/all-products","@woocommerce/single-product","core/post-template"],textdomain:"woo-gutenberg-products-block",attributes:U.a,supports:Y,edit:e=>{let{attributes:t,setAttributes:c,context:o}=e;const{showProductLink:n,imageSizing:a,showSaleBadge:s,saleBadgeAlign:i}=t,u=Object(g.useBlockProps)(),d=Number.isFinite(o.queryId);Object(r.useEffect)(()=>c({isDescendentOfQueryLoop:d}),[c,d]);const b=Object(H.getSettingWithCoercion)("is_block_theme_enabled",!1,G.a);return Object(r.useEffect)(()=>{b&&"full-size"!==t.imageSizing&&c({imageSizing:"full-size"})},[t.imageSizing,b,c]),Object(r.createElement)("div",u,Object(r.createElement)(g.InspectorControls,null,Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Content","woo-gutenberg-products-block")},Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(l.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:n,onChange:()=>c({showProductLink:!n})}),Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Show On-Sale Badge","woo-gutenberg-products-block"),help:Object(l.__)("Display a “sale” badge if the product is on-sale.","woo-gutenberg-products-block"),checked:s,onChange:()=>c({showSaleBadge:!s})}),s&&Object(r.createElement)(p.__experimentalToggleGroupControl,{label:Object(l.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:i,onChange:e=>c({saleBadgeAlign:e})},Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"left",label:Object(l.__)("Left","woo-gutenberg-products-block")}),Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"center",label:Object(l.__)("Center","woo-gutenberg-products-block")}),Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"right",label:Object(l.__)("Right","woo-gutenberg-products-block")})),!b&&Object(r.createElement)(p.__experimentalToggleGroupControl,{label:Object(l.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(r.createInterpolateElement)(Object(l.__)("Product image cropping can be modified in the <a>Customizer</a>.","woo-gutenberg-products-block"),{a:Object(r.createElement)("a",{href:Object(H.getAdminLink)("customize.php")+"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images",target:"_blank",rel:"noopener noreferrer"})}),value:a,onChange:e=>c({imageSizing:e})},Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"full-size",label:Object(l.__)("Full Size","woo-gutenberg-products-block")}),Object(r.createElement)(p.__experimentalToggleGroupControlOption,{value:"cropped",label:Object(l.__)("Cropped","woo-gutenberg-products-block")})))),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(Q.a,q()({},t,o))))}};Object(o.registerBlockType)("woocommerce/product-image",{...d,...W});var $=c(307),K=c(515);const J=Object(l.__)("Product Rating","woo-gutenberg-products-block"),X=Object(r.createElement)(n.a,{icon:K.a,className:"wc-block-editor-components-block-icon"}),Z=Object(l.__)("Display the average rating of a product.","woo-gutenberg-products-block");var ee=w({icon:X,label:J,description:Object(l.__)("Choose a product to display its rating.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)({className:"wp-block-woocommerce-product-rating"});return Object(r.createElement)("div",c,Object(r.createElement)($.default,t))});const te={apiVersion:2,title:J,description:Z,icon:{src:X},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(N.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-rating"}},edit:ee,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(o.registerBlockType)("woocommerce/product-rating",{...d,...te});var ce=c(308),re=c(523);const oe=Object(l.__)("Add to Cart Button","woo-gutenberg-products-block"),ne=Object(r.createElement)(n.a,{icon:re.a,className:"wc-block-editor-components-block-icon"}),ae=Object(l.__)("Display a call to action button which either adds the product to the cart, or links to the product page.","woo-gutenberg-products-block");var se=w({icon:ne,label:oe,description:Object(l.__)("Choose a product to display its add to cart button.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(p.Disabled,null,Object(r.createElement)(ce.default,t)))});const le={apiVersion:2,title:oe,description:ae,icon:{src:ne},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},...Object(N.a)()&&{spacing:{padding:!0,__experimentalSkipSerialization:!0}},typography:{fontSize:!0,__experimentalFontWeight:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wp-block-button.wc-block-components-product-button .wc-block-components-product-button__button"}},edit:se,save:x};Object(o.registerBlockType)("woocommerce/product-button",{...d,...le});var ie=c(309),ue=c(524);const de=Object(l.__)("Product Summary","woo-gutenberg-products-block"),be=Object(r.createElement)(n.a,{icon:ue.a,className:"wc-block-editor-components-block-icon"}),pe=Object(l.__)("Display a short description about a product.","woo-gutenberg-products-block");c(383);var me=w({icon:be,label:de,description:Object(l.__)("Choose a product to display its short description.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(ie.default,t))});const ge={apiVersion:2,title:de,description:pe,icon:{src:be},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-summary"}},edit:me,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(o.registerBlockType)("woocommerce/product-summary",{...d,...ge});var Oe=c(222),je=c(513);const he=Object(l.__)("On-Sale Badge","woo-gutenberg-products-block"),_e=Object(r.createElement)(n.a,{icon:je.a,className:"wc-block-editor-components-block-icon"}),Ee=Object(l.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block");var we=w({icon:_e,label:he,description:Object(l.__)("Choose a product to display its sale-badge.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(Oe.default,t))});const fe={title:he,description:Ee,icon:{src:_e},apiVersion:2,supports:{html:!1,...Object(s.b)()&&{color:{gradients:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},__experimentalBorder:{color:!0,radius:!0,width:!0,__experimentalSkipSerialization:!0},...Object(N.a)()&&{spacing:{padding:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-sale-badge"}},attributes:{productId:{type:"number",default:0}},edit:we,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(o.registerBlockType)("woocommerce/product-sale-badge",{...d,...fe});var ke=c(103),ye=c(310),ve=c(11),Se=Object(r.createElement)(ve.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)("path",{d:"M2 6h2v12H2V6m3 0h1v12H5V6m2 0h3v12H7V6m4 0h1v12h-1V6m3 0h2v12h-2V6m3 0h3v12h-3V6m4 0h1v12h-1V6z"}));const Ce=Object(l.__)("Product SKU","woo-gutenberg-products-block"),xe=Object(r.createElement)(n.a,{icon:Se,className:"wc-block-editor-components-block-icon"}),Ne={title:Ce,description:Object(l.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:xe},attributes:{productId:{type:"number",default:0}},edit:w({icon:xe,label:Ce,description:Object(l.__)("Choose a product to display its SKU.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(ke.a,null),Object(r.createElement)(ye.default,t))})};Object(s.c)("woocommerce/product-sku",{...d,...Ne});var Pe=c(311),Te=c(525);const Re=Object(l.__)("Product Category List","woo-gutenberg-products-block"),Ie=Object(r.createElement)(n.a,{icon:Te.a,className:"wc-block-editor-components-block-icon"}),Ae=Object(l.__)("Display the list of categories that are assigned to a product.","woo-gutenberg-products-block");var Be=w({icon:Ie,label:Re,description:Object(l.__)("Choose a product to display its categories.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(ke.a,null),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(Pe.default,t)))});const Le={...d,apiVersion:2,title:Re,description:Ae,icon:{src:Ie},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,link:!0,background:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,lineHeight:!0,__experimentalFontStyle:!0,__experimentalFontWeight:!0,__experimentalSkipSerialization:!0},__experimentalSelector:".wc-block-components-product-category-list"}},save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))},edit:Be};Object(s.c)("woocommerce/product-category-list",Le);var De=c(312),Ve=c(518);const Fe=Object(l.__)("Product Tag List","woo-gutenberg-products-block"),ze=Object(r.createElement)(n.a,{icon:Ve.a,className:"wc-block-editor-components-block-icon"}),Me=Object(l.__)("Display the list of tags that are assigned to a product.","woo-gutenberg-products-block");var qe=w({icon:ze,label:Fe,description:Object(l.__)("Choose a product to display its tags.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(ke.a,null),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(De.default,t)))});const He={apiVersion:2,title:Fe,description:Me,icon:{src:ze},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!0},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-tag-list"}},edit:qe,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(s.c)("woocommerce/product-tag-list",{...d,...He});var Ge=c(313),Qe=c(526);const Ye=Object(l.__)("Product Stock Indicator","woo-gutenberg-products-block"),Ue=Object(r.createElement)(n.a,{icon:Qe.a,className:"wc-block-editor-components-block-icon"}),We=Object(l.__)("Display product stock status.","woo-gutenberg-products-block");var $e=w({icon:Ue,label:Ye,description:Object(l.__)("Choose a product to display its stock.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(g.useBlockProps)();return Object(r.createElement)("div",c,Object(r.createElement)(ke.a,null),Object(r.createElement)(Ge.default,t))});const Ke={apiVersion:2,title:Ye,description:We,icon:{src:Ue},attributes:{productId:{type:"number",default:0}},supports:{...Object(s.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-stock-indicator"}},edit:$e,save:e=>{let{attributes:t}=e;return Object(r.createElement)("div",g.useBlockProps.save({className:u()("is-loading",t.className)}))}};Object(s.c)("woocommerce/product-stock-indicator",{...d,...Ke});var Je=c(497),Xe=(c(290),c(296)),Ze=c(250);const et=Object(l.__)("Add to Cart","woo-gutenberg-products-block"),tt=Object(r.createElement)(n.a,{icon:Ze.a,className:"wc-block-editor-components-block-icon"}),ct={title:et,description:Object(l.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:tt},edit:w({icon:tt,label:et,description:Object(l.__)("Choose a product to display its add to cart form.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{product:o}=Object(E.useProductDataContext)(),{className:n,showFormElements:a}=t;return Object(r.createElement)("div",{className:u()(n,"wc-block-components-product-add-to-cart")},Object(r.createElement)(ke.a,{productId:o.id}),Object(r.createElement)(g.InspectorControls,null,Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Layout","woo-gutenberg-products-block")},Object(Je.b)(o)?Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Display form elements","woo-gutenberg-products-block"),help:Object(l.__)("Depending on product type, allow customers to select a quantity, variations etc.","woo-gutenberg-products-block"),checked:a,onChange:()=>c({showFormElements:!a})}):Object(r.createElement)(p.Notice,{className:"wc-block-components-product-add-to-cart-notice",isDismissible:!1,status:"info"},Object(l.__)("This product does not support the block based add to cart form. A link to the product page will be shown instead.","woo-gutenberg-products-block")))),Object(r.createElement)(p.Disabled,null,Object(r.createElement)(Xe.a,t)))}),attributes:c(295).a};Object(s.c)("woocommerce/product-add-to-cart",{...d,...ct});var rt=c(208);const ot=(e,t)=>{const{className:c,contentVisibility:r}=t;return u()(e,c,{"has-image":r&&r.image,"has-title":r&&r.title,"has-rating":r&&r.rating,"has-price":r&&r.price,"has-button":r&&r.button})},{attributes:nt}=rt;var at=[{attributes:Object.assign({},nt,{rows:{type:"number",default:1}}),save(e){let{attributes:t}=e;const c={"data-attributes":JSON.stringify(t)};return Object(r.createElement)("div",q()({className:ot("wc-block-all-products",t)},c),Object(r.createElement)(g.InnerBlocks.Content,null))}}],st=c(24),lt=c.n(st),it=c(9),ut=c(63),dt=c(489),bt=c(370),pt=c(23),mt=c(241);const gt=[["woocommerce/product-image",{imageSizing:"cropped"}],["woocommerce/product-title"],["woocommerce/product-price"],["woocommerce/product-rating"],["woocommerce/product-button"]],Ot=e=>e&&0!==e.length?e.map(e=>[e.name,{...e.attributes,product:void 0,children:e.innerBlocks.length>0?Ot(e.innerBlocks):[]}]):[];var jt=c(12),ht=c(7),_t=c(28);c(389);var Et=e=>{let{currentPage:t,displayFirstAndLastPages:c=!0,displayNextAndPreviousArrows:o=!0,pagesToDisplay:n=3,onPageChange:a,totalPages:s}=e,{minIndex:i,maxIndex:d}=((e,t,c)=>{if(c<=2)return{minIndex:null,maxIndex:null};const r=e-1,o=Math.max(Math.floor(t-r/2),2),n=Math.min(Math.ceil(t+(r-(t-o))),c-1);return{minIndex:Math.max(Math.floor(t-(r-(n-t))),2),maxIndex:n}})(n,t,s);const b=c&&Boolean(1!==i),p=c&&Boolean(d!==s),m=c&&Boolean(i&&i>3),g=c&&Boolean(d&&d<s-2);b&&3===i&&(i-=1),p&&d===s-2&&(d+=1);const O=[];if(i&&d)for(let e=i;e<=d;e++)O.push(e);return Object(r.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(r.createElement)(_t.a,{screenReaderLabel:Object(l.__)("Navigate to another page","woo-gutenberg-products-block")}),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>a(t-1),title:Object(l.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(r.createElement)(_t.a,{label:"←",screenReaderLabel:Object(l.__)("Previous page","woo-gutenberg-products-block")})),b&&Object(r.createElement)("button",{className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":1===t,"wc-block-components-pagination__page--active":1===t}),onClick:()=>a(1),disabled:1===t},Object(r.createElement)(_t.a,{label:"1",screenReaderLabel:Object(l.sprintf)(
29
  /* translators: %d is the page number (1, 2, 3...). */
30
+ Object(l.__)("Page %d","woo-gutenberg-products-block"),1)})),m&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(l.__)("…","woo-gutenberg-products-block")),O.map(e=>Object(r.createElement)("button",{key:e,className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===e,"wc-block-components-pagination__page--active":t===e}),onClick:t===e?void 0:()=>a(e),disabled:t===e},Object(r.createElement)(_t.a,{label:e.toString(),screenReaderLabel:Object(l.sprintf)(
31
  /* translators: %d is the page number (1, 2, 3...). */
32
+ Object(l.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(r.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(l.__)("…","woo-gutenberg-products-block")),p&&Object(r.createElement)("button",{className:u()("wc-block-pagination-page","wc-block-components-pagination__page",{"wc-block-pagination-page--active":t===s,"wc-block-components-pagination__page--active":t===s}),onClick:()=>a(s),disabled:t===s},Object(r.createElement)(_t.a,{label:s.toString(),screenReaderLabel:Object(l.sprintf)(
33
  /* translators: %d is the page number (1, 2, 3...). */
34
+ Object(l.__)("Page %d","woo-gutenberg-products-block"),s)})),o&&Object(r.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>a(t+1),title:Object(l.__)("Next page","woo-gutenberg-products-block"),disabled:t>=s},Object(r.createElement)(_t.a,{label:"→",screenReaderLabel:Object(l.__)("Next page","woo-gutenberg-products-block")})))},wt=c(109),ft=c(75),kt=c(126),yt=c(17),vt=c(49);var St=c(78);c(390);const Ct=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};var xt=c(46),Nt=c(177),Pt=()=>{const{parentClassName:e}=Object(E.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:e+"__no-products"},Object(r.createElement)(n.a,{className:e+"__no-products-image",icon:Nt.a,size:100}),Object(r.createElement)("strong",{className:e+"__no-products-title"},Object(l.__)("No products","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:e+"__no-products-description"},Object(l.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},Tt=c(517),Rt=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:c}=Object(E.useInnerBlockLayoutContext)();return Object(r.createElement)("div",{className:c+"__no-products"},Object(r.createElement)(n.a,{className:c+"__no-products-image",icon:Tt.a,size:100}),Object(r.createElement)("strong",{className:c+"__no-products-title"},Object(l.__)("No products found","woo-gutenberg-products-block")),Object(r.createElement)("p",{className:c+"__no-products-description"},Object(l.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(r.createElement)("button",{onClick:t},Object(l.__)("Reset Search","woo-gutenberg-products-block")))},It=c(119);c(388);var At=e=>{let{onChange:t,value:c}=e;return Object(r.createElement)(It.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",onChange:t,options:[{key:"menu_order",label:Object(l.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(l.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(l.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(l.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(l.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(l.__)("Price: high to low","woo-gutenberg-products-block")}],screenReaderLabel:Object(l.__)("Order products by","woo-gutenberg-products-block"),value:c})};const Bt=(e,t,c,o)=>{if(!c)return;const n=Object(dt.a)(e);return c.map((c,a)=>{let[s,l={}]=c,i=[];l.children&&l.children.length>0&&(i=Bt(e,t,l.children,o));const u=n[s];if(!u)return null;const d=t.id||0,b=["layout",s,a,o,d];return Object(r.createElement)(r.Suspense,{key:b.join("_"),fallback:Object(r.createElement)("div",{className:"wc-block-placeholder"})},Object(r.createElement)(u,q()({},l,{children:i,product:t})))})};var Lt=Object(m.withInstanceId)(e=>{let{product:t={},attributes:c,instanceId:o}=e;const{layoutConfig:n}=c,{parentClassName:a,parentName:s}=Object(E.useInnerBlockLayoutContext)(),l=0===Object.keys(t).length,i=u()(a+"__product","wc-block-layout",{"is-loading":l});return Object(r.createElement)("li",{className:i,"aria-hidden":l},Bt(s,t,n,o))});c(387);const Dt=e=>{switch(e){case"menu_order":case"popularity":case"rating":case"price":return{orderby:e,order:"asc"};case"price-desc":return{orderby:"price",order:"desc"};case"date":return{orderby:"date",order:"desc"}}},Vt=function(e){let{totalQuery:t,totalProducts:c}=e,{totalQuery:r}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return!Object(ht.isEqual)(t,r)&&Number.isFinite(c)};var Ft,zt=(Ft=e=>{let{attributes:t,currentPage:c,onPageChange:o,onSortChange:n,sortValue:a,scrollToTop:s}=e;const[i,d]=Object(ft.b)("attributes",[]),[b,p]=Object(ft.b)("stock_status",[]),[m,g]=Object(ft.b)("min_price"),[O,j]=Object(ft.b)("max_price"),[h]=Object(ft.c)((e=>{let{sortValue:t,currentPage:c,attributes:r}=e;const{columns:o,rows:n}=r;return{...Dt(t),catalog_visibility:"catalog",per_page:o*n,page:c}})({attributes:t,sortValue:a,currentPage:c})),{products:_,totalProducts:w,productsLoading:f}=(e=>{const t={namespace:"/wc/store/v1",resourceName:"products"},{results:c,isLoading:r}=Object(kt.a)({...t,query:e}),{value:o}=((e,t)=>{const{namespace:c,resourceName:r,resourceValues:o=[],query:n={}}=t;if(!c||!r)throw new Error("The options object must have valid values for the namespace and the resource name properties.");const a=Object(vt.a)(n),s=Object(vt.a)(o),{value:l,isLoading:i=!0}=Object(it.useSelect)(e=>{const t=e(yt.COLLECTIONS_STORE_KEY),o=["x-wp-total",c,r,a,s];return{value:t.getCollectionHeader(...o),isLoading:t.hasFinishedResolution("getCollectionHeader",o)}},["x-wp-total",c,r,s,a]);return{value:l,isLoading:i}})(0,{...t,query:e});return{products:c,totalProducts:parseInt(o,10),productsLoading:r}})(h),{parentClassName:k,parentName:y}=Object(E.useInnerBlockLayoutContext)(),v=(e=>{const{order:t,orderby:c,page:r,per_page:o,...n}=e;return n||{}})(h),{dispatchStoreEvent:S}=Object(St.a)(),C=Object(wt.a)({totalQuery:v,totalProducts:w},Vt);Object(r.useEffect)(()=>{S("product-list-render",{products:_,listName:y})},[_,y,S]),Object(r.useEffect)(()=>{Object(ht.isEqual)(v,null==C?void 0:C.totalQuery)||(o(1),null!=C&&C.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(xt.speak)(Object(l.__)("No products found","woo-gutenberg-products-block")):Object(xt.speak)(Object(l.sprintf)(
35
  /* translators: %s is an integer higher than 0 (1, 2, 3...) */
36
+ Object(l._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(w))},[null==C?void 0:C.totalQuery,w,o,v]);const{contentVisibility:x}=t,N=t.columns*t.rows,P=!Number.isFinite(w)&&Number.isFinite(null==C?void 0:C.totalProducts)&&Object(ht.isEqual)(v,null==C?void 0:C.totalQuery)?Math.ceil(((null==C?void 0:C.totalProducts)||0)/N):Math.ceil(w/N),T=_.length?_:Array.from({length:N}),R=0!==_.length||f,I=i.length>0||b.length>0||Number.isFinite(m)||Number.isFinite(O);return Object(r.createElement)("div",{className:(()=>{const{columns:e,rows:c,alignButtons:r,align:o}=t,n=void 0!==o?"align"+o:"";return u()(k,n,"has-"+e+"-columns",{"has-multiple-rows":c>1,"has-aligned-buttons":r})})()},(null==x?void 0:x.orderBy)&&R&&Object(r.createElement)(At,{onChange:n,value:a}),!R&&I&&Object(r.createElement)(Rt,{resetCallback:()=>{d([]),p([]),g(null),j(null)}}),!R&&!I&&Object(r.createElement)(Pt,null),R&&Object(r.createElement)("ul",{className:u()(k+"__products",{"is-loading-products":f})},T.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=arguments.length>1?arguments[1]:void 0;return Object(r.createElement)(Lt,{key:e.id||c,attributes:t,product:e})}))),P>1&&Object(r.createElement)(Et,{currentPage:c,onPageChange:e=>{s({focusableSelector:"a, button"}),o(e)},totalPages:P}))},e=>{const t=Object(r.useRef)(null);return Object(r.createElement)(r.Fragment,null,Object(r.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:t,"aria-hidden":!0}),Object(r.createElement)(Ft,q()({},e,{scrollToTop:e=>{null!==t.current&&((e,t)=>{const{focusableSelector:c}=t||{};window&&Number.isFinite(window.innerHeight)&&(c?((e,t)=>{var c;const r=(null===(c=e.parentElement)||void 0===c?void 0:c.querySelectorAll(t))||[];if(r.length){const e=r[0];Ct(e),null==e||e.focus()}else Ct(e)})(e,c):Ct(e))})(t.current,e)}})))}),Mt=e=>{let{attributes:t}=e;const[c,o]=Object(r.useState)(1),[n,a]=Object(r.useState)(t.orderby);return Object(r.useEffect)(()=>{a(t.orderby)},[t.orderby]),Object(r.createElement)(zt,{attributes:t,currentPage:c,onPageChange:e=>{o(e)},onSortChange:e=>{var t;const c=null==e||null===(t=e.target)||void 0===t?void 0:t.value;a(c),o(1)},sortValue:n})},qt=c(143),Ht=c(147),Gt=c(234);class Qt extends jt.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?qt.a:Object(r.createElement)(E.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(r.createElement)(Ht.a,null,Object(r.createElement)(Gt.a,{context:"wc/all-products"})),Object(r.createElement)(Mt,{attributes:e,urlParameterSuffix:t}))}}var Yt=Qt;c(386);class Ut extends r.Component{constructor(){super(...arguments),lt()(this,"state",{isEditing:!1,innerBlocks:[]}),lt()(this,"blockMap",Object(dt.a)("woocommerce/all-products")),lt()(this,"componentDidMount",()=>{const{block:e}=this.props;this.setState({innerBlocks:e.innerBlocks})}),lt()(this,"getTitle",()=>Object(l.__)("All Products","woo-gutenberg-products-block")),lt()(this,"getIcon",()=>Object(r.createElement)(n.a,{icon:a.a})),lt()(this,"togglePreview",()=>{const{debouncedSpeak:e}=this.props;this.setState({isEditing:!this.state.isEditing}),this.state.isEditing||e(Object(l.__)("Showing All Products block preview.","woo-gutenberg-products-block"))}),lt()(this,"getInspectorControls",()=>{const{attributes:e,setAttributes:t}=this.props,{columns:c,rows:o,alignButtons:n}=e;return Object(r.createElement)(g.InspectorControls,{key:"inspector"},Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(r.createElement)(ut.a,{columns:c,rows:o,alignButtons:n,setAttributes:t,minColumns:Object(H.getSetting)("min_columns",1),maxColumns:Object(H.getSetting)("max_columns",6),minRows:Object(H.getSetting)("min_rows",1),maxRows:Object(H.getSetting)("max_rows",6)})),Object(r.createElement)(p.PanelBody,{title:Object(l.__)("Content Settings","woo-gutenberg-products-block")},((e,t)=>{const{contentVisibility:c}=e;return Object(r.createElement)(p.ToggleControl,{label:Object(l.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:c.orderBy,onChange:()=>t({contentVisibility:{...c,orderBy:!c.orderBy}})})})(e,t),((e,t)=>Object(r.createElement)(p.SelectControl,{label:Object(l.__)("Order Products By","woo-gutenberg-products-block"),value:e.orderby,options:[{label:Object(l.__)("Default sorting (menu order)","woo-gutenberg-products-block"),value:"menu_order"},{label:Object(l.__)("Popularity","woo-gutenberg-products-block"),value:"popularity"},{label:Object(l.__)("Average rating","woo-gutenberg-products-block"),value:"rating"},{label:Object(l.__)("Latest","woo-gutenberg-products-block"),value:"date"},{label:Object(l.__)("Price: low to high","woo-gutenberg-products-block"),value:"price"},{label:Object(l.__)("Price: high to low","woo-gutenberg-products-block"),value:"price-desc"}],onChange:e=>t({orderby:e})}))(e,t)))}),lt()(this,"getBlockControls",()=>{const{isEditing:e}=this.state;return Object(r.createElement)(g.BlockControls,null,Object(r.createElement)(p.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit the layout of each product","woo-gutenberg-products-block"),onClick:()=>this.togglePreview(),isActive:e}]}))}),lt()(this,"renderEditMode",()=>{const e={template:this.props.attributes.layoutConfig,templateLock:!1,allowedBlocks:Object.keys(this.blockMap)};return 0!==this.props.attributes.layoutConfig.length&&(e.renderAppender=!1),Object(r.createElement)(p.Placeholder,{icon:this.getIcon(),label:this.getTitle()},Object(l.__)("Display all products from your store as a grid.","woo-gutenberg-products-block"),Object(r.createElement)("div",{className:"wc-block-all-products-grid-item-template"},Object(r.createElement)(p.Tip,null,Object(l.__)("Edit the blocks inside the example below to change the content displayed for all products within the product grid.","woo-gutenberg-products-block")),Object(r.createElement)(E.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(r.createElement)("div",{className:"wc-block-grid wc-block-layout has-1-columns"},Object(r.createElement)("ul",{className:"wc-block-grid__products"},Object(r.createElement)("li",{className:"wc-block-grid__product"},Object(r.createElement)(E.ProductDataContextProvider,{product:bt.a[0]},Object(r.createElement)(g.InnerBlocks,e)))))),Object(r.createElement)("div",{className:"wc-block-all-products__actions"},Object(r.createElement)(p.Button,{className:"wc-block-all-products__done-button",isPrimary:!0,onClick:()=>{const{block:e,setAttributes:t}=this.props;t({layoutConfig:Ot(e.innerBlocks)}),this.setState({innerBlocks:e.innerBlocks}),this.togglePreview()}},Object(l.__)("Done","woo-gutenberg-products-block")),Object(r.createElement)(p.Button,{className:"wc-block-all-products__cancel-button",isTertiary:!0,onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,{innerBlocks:c}=this.state;t(e.clientId,c,!1),this.togglePreview()}},Object(l.__)("Cancel","woo-gutenberg-products-block")),Object(r.createElement)(p.Button,{className:"wc-block-all-products__reset-button",icon:Object(r.createElement)(n.a,{icon:a.a}),label:Object(l.__)("Reset layout to default","woo-gutenberg-products-block"),onClick:()=>{const{block:e,replaceInnerBlocks:t}=this.props,c=[];gt.map(e=>{let[t,r]=e;return c.push(Object(o.createBlock)(t,r)),!0}),t(e.clientId,c,!1),this.setState({innerBlocks:e.innerBlocks})}},Object(l.__)("Reset Layout","woo-gutenberg-products-block")))))}),lt()(this,"renderViewMode",()=>{const{attributes:e}=this.props,{layoutConfig:t}=e,c=t&&0!==t.length,o=this.getTitle(),n=this.getIcon();return c?Object(r.createElement)(p.Disabled,null,Object(r.createElement)(Yt,{attributes:e})):((e,t)=>Object(r.createElement)(p.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(l.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")))(o,n)}),lt()(this,"render",()=>{const{attributes:e}=this.props,{isEditing:t}=this.state,c=this.getTitle(),o=this.getIcon();return 0===pt.o.productCount?((e,t)=>Object(r.createElement)(p.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(r.createElement)("p",null,Object(l.__)("You haven't published any products to list here yet.","woo-gutenberg-products-block")),Object(r.createElement)(p.Button,{className:"wc-block-products__add-product-button",isSecondary:!0,href:H.ADMIN_URL+"post-new.php?post_type=product"},Object(l.__)("Add new product","woo-gutenberg-products-block")+" ",Object(r.createElement)(n.a,{icon:mt.a})),Object(r.createElement)(p.Button,{className:"wc-block-products__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-products/"},Object(l.__)("Learn more","woo-gutenberg-products-block"))))(c,o):Object(r.createElement)("div",{className:ot("wc-block-all-products",e)},this.getBlockControls(),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())})}}var Wt=Object(m.compose)(p.withSpokenMessages,Object(it.withSelect)((e,t)=>{let{clientId:c}=t;const{getBlock:r}=e("core/block-editor");return{block:r(c)}}),Object(it.withDispatch)(e=>{const{replaceInnerBlocks:t}=e("core/block-editor");return{replaceInnerBlocks:t}}))(Ut),$t={columns:Object(H.getSetting)("default_columns",3),rows:Object(H.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:gt,isPreview:!1};const{name:Kt}=rt,Jt={icon:{src:Object(r.createElement)(n.a,{icon:a.a,className:"wc-block-editor-components-block-icon"})},edit:Wt,save:function(e){let{attributes:t}=e;const c={};Object.keys(t).sort().forEach(e=>{c[e]=t[e]});const o={"data-attributes":JSON.stringify(c)};return Object(r.createElement)("div",q()({className:ot("wc-block-all-products",t)},o),Object(r.createElement)(g.InnerBlocks.Content,null))},deprecated:at,defaults:$t};Object(o.registerBlockType)(Kt,Jt)},,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(42),o=c(0),n=c(23);c.p=n.l,Object(r.registerBlockComponent)({blockName:"woocommerce/product-price",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(2),c.e(27)]).then(c.bind(null,306)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(24)]).then(c.bind(null,548)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(37)]).then(c.bind(null,549)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(29)]).then(c.bind(null,307)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(4),c.e(20)]).then(c.bind(null,308)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(34)]).then(c.bind(null,309)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(30)]).then(c.bind(null,222)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>c.e(32).then(c.bind(null,310)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(23)]).then(c.bind(null,311)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(36)]).then(c.bind(null,312)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(33)]).then(c.bind(null,313)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(4),c.e(18)]).then(c.bind(null,550)))});const a=e=>Object(r.getRegisteredBlockComponents)(e)},,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return r})),c.d(t,"b",(function(){return o}));const r=e=>e.is_purchasable||!1,o=e=>["simple","variable"].includes(e.type||"simple")}]);
build/all-reviews.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-settings', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives'), 'version' => '0c767b97f6f978a50b9844c44a311a64');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-settings', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-element', 'wp-escape-html', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives'), 'version' => 'ab29e5ab7d474e428f02f4192e2e3d46');
build/all-reviews.js CHANGED
@@ -1,9 +1,9 @@
1
- this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-reviews"]=function(e){function t(t){for(var o,a,i=t[0],s=t[1],l=t[2],u=0,b=[];u<i.length;u++)a=i[u],Object.prototype.hasOwnProperty.call(n,a)&&n[a]&&b.push(n[a][0]),n[a]=0;for(o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o]);for(d&&d(t);b.length;)b.shift()();return c.push.apply(c,l||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],o=!0,i=1;i<r.length;i++){var s=r[i];0!==n[s]&&(o=!1)}o&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var o={},n={7:0},c=[];function a(t){if(o[t])return o[t].exports;var r=o[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=o,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)a.d(r,o,function(t){return e[t]}.bind(null,o));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var d=s;return c.push([369,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.compose},105:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return d}));var o=r(0),n=r(1),c=r(5),a=r(2),i=r(3);const s=(e,t,r)=>Object(o.createElement)(c.BlockControls,null,Object(o.createElement)(i.ToolbarGroup,{controls:[{icon:"edit",title:r,onClick:()=>t({editMode:!e}),isActive:e}]})),l=(e,t)=>{const r=Object(a.getSetting)("showAvatars",!0),c=Object(a.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:()=>t({showReviewRating:!e.showReviewRating})}),e.showReviewRating&&!c&&Object(o.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(o.createInterpolateElement)(Object(n.__)("Product rating is disabled in your <a>store settings</a>.","woo-gutenberg-products-block"),{a:Object(o.createElement)("a",{href:Object(a.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:()=>t({showReviewerName:!e.showReviewerName})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:()=>t({showReviewImage:!e.showReviewImage})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:()=>t({showReviewDate:!e.showReviewDate})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Review content","woo-gutenberg-products-block"),checked:e.showReviewContent,onChange:()=>t({showReviewContent:!e.showReviewContent})}),e.showReviewImage&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.__experimentalToggleGroupControl,{label:Object(n.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,onChange:e=>t({imageType:e})},Object(o.createElement)(i.__experimentalToggleGroupControlOption,{value:"reviewer",label:Object(n.__)("Reviewer photo","woo-gutenberg-products-block")}),Object(o.createElement)(i.__experimentalToggleGroupControlOption,{value:"product",label:Object(n.__)("Product","woo-gutenberg-products-block")})),"reviewer"===e.imageType&&!r&&Object(o.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(o.createInterpolateElement)(Object(n.__)("Reviewer photo is disabled in your <a>site settings</a>.","woo-gutenberg-products-block"),{a:Object(o.createElement)("a",{href:Object(a.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},d=(e,t)=>Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:()=>t({showOrderby:!e.showOrderby})}),Object(o.createElement)(i.SelectControl,{label:Object(n.__)("Order Product Reviews by","woo-gutenberg-products-block"),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:e=>t({orderby:e})}),Object(o.createElement)(i.RangeControl,{label:Object(n.__)("Starting Number of Reviews","woo-gutenberg-products-block"),value:e.reviewsOnPageLoad,onChange:e=>t({reviewsOnPageLoad:e}),max:20,min:1}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:()=>t({showLoadMore:!e.showLoadMore})}),e.showLoadMore&&Object(o.createElement)(i.RangeControl,{label:Object(n.__)("Load More Reviews","woo-gutenberg-products-block"),value:e.reviewsOnLoadMore,onChange:e=>t({reviewsOnLoadMore:e}),max:20,min:1}))},11:function(e,t){e.exports=window.wp.primitives},114:function(e,t){},119:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n),a=r(28),i=r(10);r(159),t.a=Object(i.withInstanceId)(e=>{let{className:t,instanceId:r,label:n="",onChange:i,options:s,screenReaderLabel:l,value:d=""}=e;const u="wc-block-components-sort-select__select-"+r;return Object(o.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(o.createElement)(a.a,{label:n,screenReaderLabel:l,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:u}}),Object(o.createElement)("select",{id:u,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:i,value:d},s&&s.map(e=>Object(o.createElement)("option",{key:e.key,value:e.key},e.label))))})},12:function(e,t){e.exports=window.React},122:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var o=r(1),n=r(23);const c={attributes:{editMode:!1,imageType:"reviewer",orderby:"most-recent",reviewsOnLoadMore:10,reviewsOnPageLoad:10,showLoadMore:!0,showOrderby:!0,showReviewDate:!0,showReviewerName:!0,showReviewImage:!0,showReviewRating:!0,showReviewContent:!0,previewReviews:[{id:1,date_created:"2019-07-15T17:05:04",formatted_date_created:Object(o.__)("July 15, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-15T15:05:04",product_id:0,product_name:Object(o.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",
2
  /* translators: An example person name used for the block previews. */
3
  reviewer:Object(o.__)("Alice","woo-gutenberg-products-block"),review:`<p>${Object(o.__)("I bought this product last week and I'm very happy with it.","woo-gutenberg-products-block")}</p>\n`,reviewer_avatar_urls:{48:n.o.defaultAvatar,96:n.o.defaultAvatar},rating:5,verified:!0},{id:2,date_created:"2019-07-12T12:39:39",formatted_date_created:Object(o.__)("July 12, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-12T10:39:39",product_id:0,product_name:Object(o.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",
4
  /* translators: An example person name used for the block previews. */
5
- reviewer:Object(o.__)("Bob","woo-gutenberg-products-block"),review:`<p>${Object(o.__)("This product is awesome, I love it!","woo-gutenberg-products-block")}</p>\n`,reviewer_avatar_urls:{48:n.o.defaultAvatar,96:n.o.defaultAvatar},rating:null,verified:!1}]}}},13:function(e,t){e.exports=window.wp.apiFetch},14:function(e,t){e.exports=window.wp.htmlEntities},143:function(e,t,r){"use strict";t.a={editMode:{type:"boolean",default:!0},imageType:{type:"string",default:"reviewer"},orderby:{type:"string",default:"most-recent"},reviewsOnLoadMore:{type:"number",default:10},reviewsOnPageLoad:{type:"number",default:10},showLoadMore:{type:"boolean",default:!0},showOrderby:{type:"boolean",default:!0},showReviewDate:{type:"boolean",default:!0},showReviewerName:{type:"boolean",default:!0},showReviewImage:{type:"boolean",default:!0},showReviewRating:{type:"boolean",default:!0},showReviewContent:{type:"boolean",default:!0},previewReviews:{type:"array",default:null}}},144:function(e,t,r){"use strict";var o=r(6),n=r.n(o),c=r(0),a=r(5),i=(r(158),r(57));t.a=e=>{let{attributes:t}=e;return Object(c.createElement)("div",n()({},a.useBlockProps.save({className:Object(i.a)(t)}),Object(i.b)(t)))}},148:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(7),a=r(3),i=r(5),s=r(12),l=r(2),d=r(73),u=r(28);r(184);var b=e=>{let{onClick:t,label:r=Object(n.__)("Load more","woo-gutenberg-products-block"),screenReaderLabel:c=Object(n.__)("Load more","woo-gutenberg-products-block")}=e;return Object(o.createElement)("div",{className:"wp-block-button wc-block-load-more wc-block-components-load-more"},Object(o.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(o.createElement)(u.a,{label:r,screenReaderLabel:c})))},w=r(119);r(181);var p=e=>{let{onChange:t,readOnly:r,value:c}=e;return Object(o.createElement)(w.a,{className:"wc-block-review-sort-select wc-block-components-review-sort-select",label:Object(n.__)("Order by","woo-gutenberg-products-block"),onChange:t,options:[{key:"most-recent",label:Object(n.__)("Most recent","woo-gutenberg-products-block")},{key:"highest-rating",label:Object(n.__)("Highest rating","woo-gutenberg-products-block")},{key:"lowest-rating",label:Object(n.__)("Lowest rating","woo-gutenberg-products-block")}],readOnly:r,screenReaderLabel:Object(n.__)("Order reviews by","woo-gutenberg-products-block"),value:c})},m=r(4),g=r.n(m),v=r(24),h=r.n(v),_=r(170),O=r.n(_);const j=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";const o=O()(e,{suffix:r,limit:t});return o.html},f=(e,t,r)=>(t<=r?e.start=e.middle+1:e.end=e.middle-1,e),k=(e,t,r,o)=>{const n=((e,t,r)=>{let o={start:0,middle:0,end:e.length};for(;o.start<=o.end;)o.middle=Math.floor((o.start+o.end)/2),t.innerHTML=j(e,o.middle),o=f(o,t.clientHeight,r);return o.middle})(e,t,r);return j(e,n-o.length,o)},y={className:"read-more-content",ellipsis:"&hellip;",lessText:Object(n.__)("Read less","woo-gutenberg-products-block"),maxLines:3,moreText:Object(n.__)("Read more","woo-gutenberg-products-block")};class R extends s.Component{constructor(e){super(e),this.state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},this.reviewContent=Object(s.createRef)(),this.reviewSummary=Object(s.createRef)(),this.getButton=this.getButton.bind(this),this.onClick=this.onClick.bind(this)}componentDidMount(){this.setSummary()}componentDidUpdate(e){e.maxLines===this.props.maxLines&&e.children===this.props.children||this.setState({clampEnabled:null,summary:"."},this.setSummary)}setSummary(){if(this.props.children){const{maxLines:e,ellipsis:t}=this.props;if(!this.reviewSummary.current||!this.reviewContent.current)return;const r=(this.reviewSummary.current.clientHeight+1)*e+1,o=this.reviewContent.current.clientHeight+1>r;this.setState({clampEnabled:o}),o&&this.setState({summary:k(this.reviewContent.current.innerHTML,this.reviewSummary.current,r,t)})}}getButton(){const{isExpanded:e}=this.state,{className:t,lessText:r,moreText:n}=this.props,c=e?r:n;if(c)return Object(o.createElement)("a",{href:"#more",className:t+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}onClick(e){e.preventDefault();const{isExpanded:t}=this.state;this.setState({isExpanded:!t})}render(){const{className:e}=this.props,{content:t,summary:r,clampEnabled:n,isExpanded:c}=this.state;return t?!1===n?Object(o.createElement)("div",{className:e},Object(o.createElement)("div",{ref:this.reviewContent},t)):Object(o.createElement)("div",{className:e},(!c||null===n)&&Object(o.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:r}}),(c||null===n)&&Object(o.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},t),this.getButton()):null}}h()(R,"defaultProps",y);var E=R;r(183);var S=e=>{let{attributes:t,review:r={}}=e;const{imageType:c,showReviewDate:a,showReviewerName:i,showReviewImage:s,showReviewRating:l,showReviewContent:d,showProductName:u}=t,{rating:b}=r,w=!Object.keys(r).length>0,p=Number.isFinite(b)&&l;return Object(o.createElement)("li",{className:g()("wc-block-review-list-item__item","wc-block-components-review-list-item__item",{"is-loading":w,"wc-block-components-review-list-item__item--has-image":s}),"aria-hidden":w},(u||a||i||s||p)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},s&&function(e,t,r){var c,a;return r||!e?Object(o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"}):Object(o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"},"product"===t?Object(o.createElement)("img",{"aria-hidden":"true",alt:(null===(c=e.product_image)||void 0===c?void 0:c.alt)||"",src:(null===(a=e.product_image)||void 0===a?void 0:a.thumbnail)||""}):Object(o.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[96]||""}),e.verified&&Object(o.createElement)("div",{className:"wc-block-review-list-item__verified wc-block-components-review-list-item__verified",title:Object(n.__)("Verified buyer","woo-gutenberg-products-block")},Object(n.__)("Verified buyer","woo-gutenberg-products-block")))}(r,c,w),(u||i||p||a)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__meta wc-block-components-review-list-item__meta"},p&&function(e){const{rating:t}=e,r={width:t/5*100+"%"},c=Object(n.sprintf)(
6
  /* translators: %f is referring to the average rating value */
7
  Object(n.__)("Rated %f out of 5","woo-gutenberg-products-block"),t),a={__html:Object(n.sprintf)(
8
  /* translators: %s is referring to the average rating value */
9
- Object(n.__)("Rated %s out of 5","woo-gutenberg-products-block"),Object(n.sprintf)('<strong class="rating">%f</strong>',t))};return Object(o.createElement)("div",{className:"wc-block-review-list-item__rating wc-block-components-review-list-item__rating"},Object(o.createElement)("div",{className:"wc-block-review-list-item__rating__stars wc-block-components-review-list-item__rating__stars",role:"img","aria-label":c},Object(o.createElement)("span",{style:r,dangerouslySetInnerHTML:a})))}(r),u&&function(e){return Object(o.createElement)("div",{className:"wc-block-review-list-item__product wc-block-components-review-list-item__product"},Object(o.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(r),i&&function(e){const{reviewer:t=""}=e;return Object(o.createElement)("div",{className:"wc-block-review-list-item__author wc-block-components-review-list-item__author"},t)}(r),a&&function(e){const{date_created:t,formatted_date_created:r}=e;return Object(o.createElement)("time",{className:"wc-block-review-list-item__published-date wc-block-components-review-list-item__published-date",dateTime:t},r)}(r))),d&&function(e){return Object(o.createElement)(E,{maxLines:10,moreText:Object(n.__)("Read full review","woo-gutenberg-products-block"),lessText:Object(n.__)("Hide full review","woo-gutenberg-products-block"),className:"wc-block-review-list-item__text wc-block-components-review-list-item__text"},Object(o.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(r))};r(182);var C=e=>{let{attributes:t,reviews:r}=e;const n=Object(l.getSetting)("showAvatars",!0),c=Object(l.getSetting)("reviewRatingsEnabled",!0),a=(n||"product"===t.imageType)&&t.showReviewImage,i=c&&t.showReviewRating,s={...t,showReviewImage:a,showReviewRating:i};return Object(o.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(o.createElement)(S,{attributes:s}):r.map((e,t)=>Object(o.createElement)(S,{key:e.id||t,attributes:s,review:e})))},T=r(6),P=r.n(T),N=r(22),L=r.n(N),x=r(57),A=r(27);class M extends s.Component{render(){const{attributes:e,error:t,isLoading:r,noReviewsPlaceholder:c,reviews:i,totalReviews:s}=this.props;if(t)return Object(o.createElement)(d.a,{className:"wc-block-featured-product-error",error:t,isLoading:r});if(0===i.length&&!r)return Object(o.createElement)(c,{attributes:e});const u=Object(l.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(a.Disabled,null,e.showOrderby&&u&&Object(o.createElement)(p,{readOnly:!0,value:e.orderby}),Object(o.createElement)(C,{attributes:e,reviews:i}),e.showLoadMore&&s>i.length&&Object(o.createElement)(b,{screenReaderLabel:Object(n.__)("Load more reviews","woo-gutenberg-products-block")}))}}var I=(e=>{class t extends s.Component{constructor(){super(...arguments),h()(this,"isPreview",!!this.props.attributes.previewReviews),h()(this,"delayedAppendReviews",this.props.delayFunction(this.appendReviews)),h()(this,"isMounted",!1),h()(this,"state",{error:null,loading:!0,reviews:this.isPreview?this.props.attributes.previewReviews:[],totalReviews:this.isPreview?this.props.attributes.previewReviews.length:0}),h()(this,"setError",async e=>{if(!this.isMounted)return;const{onReviewsLoadError:t}=this.props,r=await Object(A.a)(e);this.setState({reviews:[],loading:!1,error:r}),t(r)})}componentDidMount(){this.isMounted=!0,this.replaceReviews()}componentDidUpdate(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}shouldReplaceReviews(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!L()(e.categoryIds,t.categoryIds)}componentWillUnmount(){this.isMounted=!1,this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}getArgs(e){const{categoryIds:t,order:r,orderby:o,productId:n,reviewsToDisplay:c}=this.props,a={order:r,orderby:o,per_page:c-e,offset:e};if(t){const e=Array.isArray(t)?t:JSON.parse(t);a.category_id=Array.isArray(e)?e.join(","):e}return n&&(a.product_id=n),a}replaceReviews(){if(this.isPreview)return;const{onReviewsReplaced:e}=this.props;this.updateListOfReviews().then(e)}appendReviews(){if(this.isPreview)return;const{onReviewsAppended:e,reviewsToDisplay:t}=this.props,{reviews:r}=this.state;t<=r.length||this.updateListOfReviews(r).then(e)}updateListOfReviews(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{reviewsToDisplay:t}=this.props,{totalReviews:r}=this.state,o=Math.min(r,t)-e.length;return this.setState({loading:!0,reviews:e.concat(Array(o).fill({}))}),Object(x.c)(this.getArgs(e.length)).then(t=>{let{reviews:r,totalReviews:o}=t;return this.isMounted&&this.setState({reviews:e.filter(e=>Object.keys(e).length).concat(r),totalReviews:o,loading:!1,error:null}),{newReviews:r}}).catch(this.setError)}render(){const{reviewsToDisplay:t}=this.props,{error:r,loading:n,reviews:c,totalReviews:a}=this.state;return Object(o.createElement)(e,P()({},this.props,{error:r,isLoading:n,reviews:c.slice(0,t),totalReviews:a}))}}h()(t,"defaultProps",{delayFunction:e=>e,onReviewsAppended:()=>{},onReviewsLoadError:()=>{},onReviewsReplaced:()=>{}});const{displayName:r=e.name||"Component"}=e;return t.displayName=`WithReviews( ${r} )`,t})(M);t.a=e=>{let{attributes:t,icon:r,name:s,noReviewsPlaceholder:l}=e;const{categoryIds:d,productId:u,reviewsOnPageLoad:b,showProductName:w,showReviewDate:p,showReviewerName:m,showReviewContent:g,showReviewImage:v,showReviewRating:h}=t,{order:_,orderby:O}=Object(x.d)(t.orderby),j=!(g||h||p||m||v||w),f=Object(i.useBlockProps)({className:Object(x.a)(t)});return j?Object(o.createElement)(a.Placeholder,{icon:r,label:s},Object(n.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")):Object(o.createElement)("div",f,Object(o.createElement)(I,{attributes:t,categoryIds:d,delayFunction:e=>Object(c.debounce)(e,400),noReviewsPlaceholder:l,orderby:O,order:_,productId:u,reviewsToDisplay:b}))}},158:function(e,t){},159:function(e,t){},181:function(e,t){},182:function(e,t){},183:function(e,t){},184:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},22:function(e,t){e.exports=window.wp.isShallowEqual},23:function(e,t,r){"use strict";r.d(t,"o",(function(){return c})),r.d(t,"m",(function(){return a})),r.d(t,"l",(function(){return i})),r.d(t,"n",(function(){return s})),r.d(t,"j",(function(){return l})),r.d(t,"e",(function(){return d})),r.d(t,"f",(function(){return u})),r.d(t,"g",(function(){return b})),r.d(t,"k",(function(){return w})),r.d(t,"c",(function(){return p})),r.d(t,"d",(function(){return m})),r.d(t,"h",(function(){return g})),r.d(t,"a",(function(){return v})),r.d(t,"i",(function(){return h})),r.d(t,"b",(function(){return _}));var o,n=r(2);const c=Object(n.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"images/",i=c.pluginUrl+"build/",s=c.buildPhase,l=null===(o=n.STORE_PAGES.shop)||void 0===o?void 0:o.permalink,d=n.STORE_PAGES.checkout.id,u=n.STORE_PAGES.checkout.permalink,b=n.STORE_PAGES.privacy.permalink,w=(n.STORE_PAGES.privacy.title,n.STORE_PAGES.terms.permalink),p=(n.STORE_PAGES.terms.title,n.STORE_PAGES.cart.id),m=n.STORE_PAGES.cart.permalink,g=(n.STORE_PAGES.myaccount.permalink?n.STORE_PAGES.myaccount.permalink:Object(n.getSetting)("wpLoginUrl","/wp-login.php"),Object(n.getSetting)("shippingCountries",{})),v=Object(n.getSetting)("allowedCountries",{}),h=Object(n.getSetting)("shippingStates",{}),_=Object(n.getSetting)("allowedStates",{})},27:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return a}));var o=r(1),n=r(14);const c=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}},a=e=>{if(e.data&&"rest_invalid_param"===e.code){const t=Object.values(e.data.params);if(t[0])return t[0]}return null!=e&&e.message?Object(n.decodeEntities)(e.message):Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},28:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n);t.a=e=>{let t,{label:r,screenReaderLabel:n,wrapperElement:a,wrapperProps:i={}}=e;const s=null!=r,l=null!=n;return!s&&l?(t=a||"span",i={...i,className:c()(i.className,"screen-reader-text")},Object(o.createElement)(t,i,n)):(t=a||o.Fragment,s&&l&&r!==n?Object(o.createElement)(t,i,Object(o.createElement)("span",{"aria-hidden":"true"},r),Object(o.createElement)("span",{className:"screen-reader-text"},n)):Object(o.createElement)(t,i,r))}},3:function(e,t){e.exports=window.wp.components},32:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(33);t.a=e=>{let{error:t}=e;return Object(o.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:r}=e;return t?"general"===r?Object(o.createElement)("span",null,Object(n.__)("The following error was returned","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):"api"===r?Object(o.createElement)("span",null,Object(n.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):t:Object(n.__)("An unknown error occurred which prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},33:function(e,t){e.exports=window.wp.escapeHtml},369:function(e,t,r){e.exports=r(480)},480:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(8),a=r(113),i=r(514),s=(r(158),r(5)),l=r(3),d=r(148),u=()=>Object(o.createElement)(l.Placeholder,{className:"wc-block-all-reviews",icon:Object(o.createElement)(a.a,{icon:i.a,className:"block-editor-block-icon"}),label:Object(n.__)("All Reviews","woo-gutenberg-products-block")},Object(n.__)("This block shows a list of all product reviews. Your store does not have any reviews yet, but they will show up here when it does.","woo-gutenberg-products-block")),b=r(105),w=r(143),p=r(144),m=r(122);Object(c.registerBlockType)("woocommerce/all-reviews",{apiVersion:2,title:Object(n.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(a.a,{icon:i.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(n.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(n.__)("Show a list of all product reviews.","woo-gutenberg-products-block"),supports:{html:!1,color:{background:!1},typography:{fontSize:!0}},example:{...m.a,attributes:{...m.a.attributes,showProductName:!0}},attributes:{...w.a,showProductName:{type:"boolean",default:!0}},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:r}=e;return"woocommerce_recent_reviews"===t&&!(null==r||!r.raw)},transform:e=>{let{instance:t}=e;return Object(c.createBlock)("woocommerce/all-reviews",{reviewsOnPageLoad:t.raw.number,imageType:"product",showLoadMore:!1,showOrderby:!1,showReviewDate:!1,showReviewContent:!1})}}]},edit:e=>{let{attributes:t,setAttributes:r}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(s.InspectorControls,{key:"inspector"},Object(o.createElement)(l.PanelBody,{title:Object(n.__)("Content","woo-gutenberg-products-block")},Object(o.createElement)(l.ToggleControl,{label:Object(n.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:()=>r({showProductName:!t.showProductName})}),Object(b.b)(t,r)),Object(o.createElement)(l.PanelBody,{title:Object(n.__)("List Settings","woo-gutenberg-products-block")},Object(b.c)(t,r))),Object(o.createElement)(d.a,{attributes:t,icon:Object(o.createElement)(a.a,{icon:i.a,className:"block-editor-block-icon"}),name:Object(n.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:u}))},save:p.a})},5:function(e,t){e.exports=window.wp.blockEditor},57:function(e,t,r){"use strict";r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return u}));var o=r(13),n=r.n(o),c=r(4),a=r.n(c),i=r(2);const s=e=>{if(Object(i.getSetting)("reviewRatingsEnabled",!0)){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},l=e=>n()({path:"/wc/store/v1/products/reviews?"+Object.entries(e).map(e=>e.join("=")).join("&"),parse:!1}).then(e=>e.json().then(t=>({reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}))),d=e=>{const{className:t,categoryIds:r,productId:o,showReviewDate:n,showReviewerName:c,showReviewContent:i,showProductName:s,showReviewImage:l,showReviewRating:d}=e;let u="wc-block-all-reviews";return o&&(u="wc-block-reviews-by-product"),Array.isArray(r)&&(u="wc-block-reviews-by-category"),a()(u,t,{"has-image":l,"has-name":c,"has-date":n,"has-rating":d,"has-content":i,"has-product-name":s})},u=e=>{const{categoryIds:t,imageType:r,orderby:o,productId:n,reviewsOnPageLoad:c,reviewsOnLoadMore:a,showLoadMore:i,showOrderby:s}=e,l={"data-image-type":r,"data-orderby":o,"data-reviews-on-page-load":c,"data-reviews-on-load-more":a,"data-show-load-more":i,"data-show-orderby":s};return n&&(l["data-product-id"]=n),Array.isArray(t)&&(l["data-category-ids"]=t.join(",")),l}},7:function(e,t){e.exports=window.lodash},73:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(113),a=r(175),i=r(4),s=r.n(i),l=r(3),d=r(32);r(114),t.a=e=>{let{className:t,error:r,isLoading:i=!1,onRetry:u}=e;return Object(o.createElement)(l.Placeholder,{icon:Object(o.createElement)(c.a,{icon:a.a}),label:Object(n.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:s()("wc-block-api-error",t)},Object(o.createElement)(d.a,{error:r}),u&&Object(o.createElement)(o.Fragment,null,i?Object(o.createElement)(l.Spinner,null):Object(o.createElement)(l.Button,{isSecondary:!0,onClick:u},Object(n.__)("Retry","woo-gutenberg-products-block"))))}},8:function(e,t){e.exports=window.wp.blocks}});
1
+ this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["all-reviews"]=function(e){function t(t){for(var o,a,i=t[0],s=t[1],l=t[2],u=0,b=[];u<i.length;u++)a=i[u],Object.prototype.hasOwnProperty.call(n,a)&&n[a]&&b.push(n[a][0]),n[a]=0;for(o in s)Object.prototype.hasOwnProperty.call(s,o)&&(e[o]=s[o]);for(d&&d(t);b.length;)b.shift()();return c.push.apply(c,l||[]),r()}function r(){for(var e,t=0;t<c.length;t++){for(var r=c[t],o=!0,i=1;i<r.length;i++){var s=r[i];0!==n[s]&&(o=!1)}o&&(c.splice(t--,1),e=a(a.s=r[0]))}return e}var o={},n={7:0},c=[];function a(t){if(o[t])return o[t].exports;var r=o[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,a),r.l=!0,r.exports}a.m=e,a.c=o,a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(a.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)a.d(r,o,function(t){return e[t]}.bind(null,o));return r},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="";var i=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=i.push.bind(i);i.push=t,i=i.slice();for(var l=0;l<i.length;l++)t(i[l]);var d=s;return c.push([371,0]),r()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.compose},105:function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return l})),r.d(t,"c",(function(){return d}));var o=r(0),n=r(1),c=r(5),a=r(2),i=r(3);const s=(e,t,r)=>Object(o.createElement)(c.BlockControls,null,Object(o.createElement)(i.ToolbarGroup,{controls:[{icon:"edit",title:r,onClick:()=>t({editMode:!e}),isActive:e}]})),l=(e,t)=>{const r=Object(a.getSetting)("showAvatars",!0),c=Object(a.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Product rating","woo-gutenberg-products-block"),checked:e.showReviewRating,onChange:()=>t({showReviewRating:!e.showReviewRating})}),e.showReviewRating&&!c&&Object(o.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(o.createInterpolateElement)(Object(n.__)("Product rating is disabled in your <a>store settings</a>.","woo-gutenberg-products-block"),{a:Object(o.createElement)("a",{href:Object(a.getAdminLink)("admin.php?page=wc-settings&tab=products"),target:"_blank",rel:"noopener noreferrer"})})),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Reviewer name","woo-gutenberg-products-block"),checked:e.showReviewerName,onChange:()=>t({showReviewerName:!e.showReviewerName})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Image","woo-gutenberg-products-block"),checked:e.showReviewImage,onChange:()=>t({showReviewImage:!e.showReviewImage})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Review date","woo-gutenberg-products-block"),checked:e.showReviewDate,onChange:()=>t({showReviewDate:!e.showReviewDate})}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Review content","woo-gutenberg-products-block"),checked:e.showReviewContent,onChange:()=>t({showReviewContent:!e.showReviewContent})}),e.showReviewImage&&Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.__experimentalToggleGroupControl,{label:Object(n.__)("Review image","woo-gutenberg-products-block"),value:e.imageType,onChange:e=>t({imageType:e})},Object(o.createElement)(i.__experimentalToggleGroupControlOption,{value:"reviewer",label:Object(n.__)("Reviewer photo","woo-gutenberg-products-block")}),Object(o.createElement)(i.__experimentalToggleGroupControlOption,{value:"product",label:Object(n.__)("Product","woo-gutenberg-products-block")})),"reviewer"===e.imageType&&!r&&Object(o.createElement)(i.Notice,{className:"wc-block-base-control-notice",isDismissible:!1},Object(o.createInterpolateElement)(Object(n.__)("Reviewer photo is disabled in your <a>site settings</a>.","woo-gutenberg-products-block"),{a:Object(o.createElement)("a",{href:Object(a.getAdminLink)("options-discussion.php"),target:"_blank",rel:"noopener noreferrer"})}))))},d=(e,t)=>Object(o.createElement)(o.Fragment,null,Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Order by","woo-gutenberg-products-block"),checked:e.showOrderby,onChange:()=>t({showOrderby:!e.showOrderby})}),Object(o.createElement)(i.SelectControl,{label:Object(n.__)("Order Product Reviews by","woo-gutenberg-products-block"),value:e.orderby,options:[{label:"Most recent",value:"most-recent"},{label:"Highest Rating",value:"highest-rating"},{label:"Lowest Rating",value:"lowest-rating"}],onChange:e=>t({orderby:e})}),Object(o.createElement)(i.RangeControl,{label:Object(n.__)("Starting Number of Reviews","woo-gutenberg-products-block"),value:e.reviewsOnPageLoad,onChange:e=>t({reviewsOnPageLoad:e}),max:20,min:1}),Object(o.createElement)(i.ToggleControl,{label:Object(n.__)("Load more","woo-gutenberg-products-block"),checked:e.showLoadMore,onChange:()=>t({showLoadMore:!e.showLoadMore})}),e.showLoadMore&&Object(o.createElement)(i.RangeControl,{label:Object(n.__)("Load More Reviews","woo-gutenberg-products-block"),value:e.reviewsOnLoadMore,onChange:e=>t({reviewsOnLoadMore:e}),max:20,min:1}))},11:function(e,t){e.exports=window.wp.primitives},114:function(e,t){},119:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n),a=r(28),i=r(10);r(160),t.a=Object(i.withInstanceId)(e=>{let{className:t,instanceId:r,label:n="",onChange:i,options:s,screenReaderLabel:l,value:d=""}=e;const u="wc-block-components-sort-select__select-"+r;return Object(o.createElement)("div",{className:c()("wc-block-sort-select","wc-block-components-sort-select",t)},Object(o.createElement)(a.a,{label:n,screenReaderLabel:l,wrapperElement:"label",wrapperProps:{className:"wc-block-sort-select__label wc-block-components-sort-select__label",htmlFor:u}}),Object(o.createElement)("select",{id:u,className:"wc-block-sort-select__select wc-block-components-sort-select__select",onChange:i,value:d},s&&s.map(e=>Object(o.createElement)("option",{key:e.key,value:e.key},e.label))))})},12:function(e,t){e.exports=window.React},122:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var o=r(1),n=r(23);const c={attributes:{editMode:!1,imageType:"reviewer",orderby:"most-recent",reviewsOnLoadMore:10,reviewsOnPageLoad:10,showLoadMore:!0,showOrderby:!0,showReviewDate:!0,showReviewerName:!0,showReviewImage:!0,showReviewRating:!0,showReviewContent:!0,previewReviews:[{id:1,date_created:"2019-07-15T17:05:04",formatted_date_created:Object(o.__)("July 15, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-15T15:05:04",product_id:0,product_name:Object(o.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",
2
  /* translators: An example person name used for the block previews. */
3
  reviewer:Object(o.__)("Alice","woo-gutenberg-products-block"),review:`<p>${Object(o.__)("I bought this product last week and I'm very happy with it.","woo-gutenberg-products-block")}</p>\n`,reviewer_avatar_urls:{48:n.o.defaultAvatar,96:n.o.defaultAvatar},rating:5,verified:!0},{id:2,date_created:"2019-07-12T12:39:39",formatted_date_created:Object(o.__)("July 12, 2019","woo-gutenberg-products-block"),date_created_gmt:"2019-07-12T10:39:39",product_id:0,product_name:Object(o.__)("WordPress Pennant","woo-gutenberg-products-block"),product_permalink:"#",
4
  /* translators: An example person name used for the block previews. */
5
+ reviewer:Object(o.__)("Bob","woo-gutenberg-products-block"),review:`<p>${Object(o.__)("This product is awesome, I love it!","woo-gutenberg-products-block")}</p>\n`,reviewer_avatar_urls:{48:n.o.defaultAvatar,96:n.o.defaultAvatar},rating:null,verified:!1}]}}},13:function(e,t){e.exports=window.wp.apiFetch},14:function(e,t){e.exports=window.wp.htmlEntities},145:function(e,t,r){"use strict";t.a={editMode:{type:"boolean",default:!0},imageType:{type:"string",default:"reviewer"},orderby:{type:"string",default:"most-recent"},reviewsOnLoadMore:{type:"number",default:10},reviewsOnPageLoad:{type:"number",default:10},showLoadMore:{type:"boolean",default:!0},showOrderby:{type:"boolean",default:!0},showReviewDate:{type:"boolean",default:!0},showReviewerName:{type:"boolean",default:!0},showReviewImage:{type:"boolean",default:!0},showReviewRating:{type:"boolean",default:!0},showReviewContent:{type:"boolean",default:!0},previewReviews:{type:"array",default:null}}},146:function(e,t,r){"use strict";var o=r(6),n=r.n(o),c=r(0),a=r(5),i=(r(159),r(57));t.a=e=>{let{attributes:t}=e;return Object(c.createElement)("div",n()({},a.useBlockProps.save({className:Object(i.a)(t)}),Object(i.b)(t)))}},150:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(7),a=r(3),i=r(5),s=r(12),l=r(2),d=r(73),u=r(28);r(186);var b=e=>{let{onClick:t,label:r=Object(n.__)("Load more","woo-gutenberg-products-block"),screenReaderLabel:c=Object(n.__)("Load more","woo-gutenberg-products-block")}=e;return Object(o.createElement)("div",{className:"wp-block-button wc-block-load-more wc-block-components-load-more"},Object(o.createElement)("button",{className:"wp-block-button__link",onClick:t},Object(o.createElement)(u.a,{label:r,screenReaderLabel:c})))},w=r(119);r(183);var p=e=>{let{onChange:t,readOnly:r,value:c}=e;return Object(o.createElement)(w.a,{className:"wc-block-review-sort-select wc-block-components-review-sort-select",label:Object(n.__)("Order by","woo-gutenberg-products-block"),onChange:t,options:[{key:"most-recent",label:Object(n.__)("Most recent","woo-gutenberg-products-block")},{key:"highest-rating",label:Object(n.__)("Highest rating","woo-gutenberg-products-block")},{key:"lowest-rating",label:Object(n.__)("Lowest rating","woo-gutenberg-products-block")}],readOnly:r,screenReaderLabel:Object(n.__)("Order reviews by","woo-gutenberg-products-block"),value:c})},m=r(4),g=r.n(m),v=r(24),h=r.n(v),_=r(172),O=r.n(_);const j=function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";const o=O()(e,{suffix:r,limit:t});return o.html},f=(e,t,r)=>(t<=r?e.start=e.middle+1:e.end=e.middle-1,e),k=(e,t,r,o)=>{const n=((e,t,r)=>{let o={start:0,middle:0,end:e.length};for(;o.start<=o.end;)o.middle=Math.floor((o.start+o.end)/2),t.innerHTML=j(e,o.middle),o=f(o,t.clientHeight,r);return o.middle})(e,t,r);return j(e,n-o.length,o)},y={className:"read-more-content",ellipsis:"&hellip;",lessText:Object(n.__)("Read less","woo-gutenberg-products-block"),maxLines:3,moreText:Object(n.__)("Read more","woo-gutenberg-products-block")};class R extends s.Component{constructor(e){super(e),this.state={isExpanded:!1,clampEnabled:null,content:e.children,summary:"."},this.reviewContent=Object(s.createRef)(),this.reviewSummary=Object(s.createRef)(),this.getButton=this.getButton.bind(this),this.onClick=this.onClick.bind(this)}componentDidMount(){this.setSummary()}componentDidUpdate(e){e.maxLines===this.props.maxLines&&e.children===this.props.children||this.setState({clampEnabled:null,summary:"."},this.setSummary)}setSummary(){if(this.props.children){const{maxLines:e,ellipsis:t}=this.props;if(!this.reviewSummary.current||!this.reviewContent.current)return;const r=(this.reviewSummary.current.clientHeight+1)*e+1,o=this.reviewContent.current.clientHeight+1>r;this.setState({clampEnabled:o}),o&&this.setState({summary:k(this.reviewContent.current.innerHTML,this.reviewSummary.current,r,t)})}}getButton(){const{isExpanded:e}=this.state,{className:t,lessText:r,moreText:n}=this.props,c=e?r:n;if(c)return Object(o.createElement)("a",{href:"#more",className:t+"__read_more",onClick:this.onClick,"aria-expanded":!e,role:"button"},c)}onClick(e){e.preventDefault();const{isExpanded:t}=this.state;this.setState({isExpanded:!t})}render(){const{className:e}=this.props,{content:t,summary:r,clampEnabled:n,isExpanded:c}=this.state;return t?!1===n?Object(o.createElement)("div",{className:e},Object(o.createElement)("div",{ref:this.reviewContent},t)):Object(o.createElement)("div",{className:e},(!c||null===n)&&Object(o.createElement)("div",{ref:this.reviewSummary,"aria-hidden":c,dangerouslySetInnerHTML:{__html:r}}),(c||null===n)&&Object(o.createElement)("div",{ref:this.reviewContent,"aria-hidden":!c},t),this.getButton()):null}}h()(R,"defaultProps",y);var E=R;r(185);var S=e=>{let{attributes:t,review:r={}}=e;const{imageType:c,showReviewDate:a,showReviewerName:i,showReviewImage:s,showReviewRating:l,showReviewContent:d,showProductName:u}=t,{rating:b}=r,w=!Object.keys(r).length>0,p=Number.isFinite(b)&&l;return Object(o.createElement)("li",{className:g()("wc-block-review-list-item__item","wc-block-components-review-list-item__item",{"is-loading":w,"wc-block-components-review-list-item__item--has-image":s}),"aria-hidden":w},(u||a||i||s||p)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__info wc-block-components-review-list-item__info"},s&&function(e,t,r){var c,a;return r||!e?Object(o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"}):Object(o.createElement)("div",{className:"wc-block-review-list-item__image wc-block-components-review-list-item__image"},"product"===t?Object(o.createElement)("img",{"aria-hidden":"true",alt:(null===(c=e.product_image)||void 0===c?void 0:c.alt)||"",src:(null===(a=e.product_image)||void 0===a?void 0:a.thumbnail)||""}):Object(o.createElement)("img",{"aria-hidden":"true",alt:"",src:e.reviewer_avatar_urls[96]||""}),e.verified&&Object(o.createElement)("div",{className:"wc-block-review-list-item__verified wc-block-components-review-list-item__verified",title:Object(n.__)("Verified buyer","woo-gutenberg-products-block")},Object(n.__)("Verified buyer","woo-gutenberg-products-block")))}(r,c,w),(u||i||p||a)&&Object(o.createElement)("div",{className:"wc-block-review-list-item__meta wc-block-components-review-list-item__meta"},p&&function(e){const{rating:t}=e,r={width:t/5*100+"%"},c=Object(n.sprintf)(
6
  /* translators: %f is referring to the average rating value */
7
  Object(n.__)("Rated %f out of 5","woo-gutenberg-products-block"),t),a={__html:Object(n.sprintf)(
8
  /* translators: %s is referring to the average rating value */
9
+ Object(n.__)("Rated %s out of 5","woo-gutenberg-products-block"),Object(n.sprintf)('<strong class="rating">%f</strong>',t))};return Object(o.createElement)("div",{className:"wc-block-review-list-item__rating wc-block-components-review-list-item__rating"},Object(o.createElement)("div",{className:"wc-block-review-list-item__rating__stars wc-block-components-review-list-item__rating__stars",role:"img","aria-label":c},Object(o.createElement)("span",{style:r,dangerouslySetInnerHTML:a})))}(r),u&&function(e){return Object(o.createElement)("div",{className:"wc-block-review-list-item__product wc-block-components-review-list-item__product"},Object(o.createElement)("a",{href:e.product_permalink,dangerouslySetInnerHTML:{__html:e.product_name}}))}(r),i&&function(e){const{reviewer:t=""}=e;return Object(o.createElement)("div",{className:"wc-block-review-list-item__author wc-block-components-review-list-item__author"},t)}(r),a&&function(e){const{date_created:t,formatted_date_created:r}=e;return Object(o.createElement)("time",{className:"wc-block-review-list-item__published-date wc-block-components-review-list-item__published-date",dateTime:t},r)}(r))),d&&function(e){return Object(o.createElement)(E,{maxLines:10,moreText:Object(n.__)("Read full review","woo-gutenberg-products-block"),lessText:Object(n.__)("Hide full review","woo-gutenberg-products-block"),className:"wc-block-review-list-item__text wc-block-components-review-list-item__text"},Object(o.createElement)("div",{dangerouslySetInnerHTML:{__html:e.review||""}}))}(r))};r(184);var C=e=>{let{attributes:t,reviews:r}=e;const n=Object(l.getSetting)("showAvatars",!0),c=Object(l.getSetting)("reviewRatingsEnabled",!0),a=(n||"product"===t.imageType)&&t.showReviewImage,i=c&&t.showReviewRating,s={...t,showReviewImage:a,showReviewRating:i};return Object(o.createElement)("ul",{className:"wc-block-review-list wc-block-components-review-list"},0===r.length?Object(o.createElement)(S,{attributes:s}):r.map((e,t)=>Object(o.createElement)(S,{key:e.id||t,attributes:s,review:e})))},T=r(6),P=r.n(T),N=r(22),L=r.n(N),x=r(57),A=r(27);class M extends s.Component{render(){const{attributes:e,error:t,isLoading:r,noReviewsPlaceholder:c,reviews:i,totalReviews:s}=this.props;if(t)return Object(o.createElement)(d.a,{className:"wc-block-featured-product-error",error:t,isLoading:r});if(0===i.length&&!r)return Object(o.createElement)(c,{attributes:e});const u=Object(l.getSetting)("reviewRatingsEnabled",!0);return Object(o.createElement)(a.Disabled,null,e.showOrderby&&u&&Object(o.createElement)(p,{readOnly:!0,value:e.orderby}),Object(o.createElement)(C,{attributes:e,reviews:i}),e.showLoadMore&&s>i.length&&Object(o.createElement)(b,{screenReaderLabel:Object(n.__)("Load more reviews","woo-gutenberg-products-block")}))}}var I=(e=>{class t extends s.Component{constructor(){super(...arguments),h()(this,"isPreview",!!this.props.attributes.previewReviews),h()(this,"delayedAppendReviews",this.props.delayFunction(this.appendReviews)),h()(this,"isMounted",!1),h()(this,"state",{error:null,loading:!0,reviews:this.isPreview?this.props.attributes.previewReviews:[],totalReviews:this.isPreview?this.props.attributes.previewReviews.length:0}),h()(this,"setError",async e=>{if(!this.isMounted)return;const{onReviewsLoadError:t}=this.props,r=await Object(A.a)(e);this.setState({reviews:[],loading:!1,error:r}),t(r)})}componentDidMount(){this.isMounted=!0,this.replaceReviews()}componentDidUpdate(e){e.reviewsToDisplay<this.props.reviewsToDisplay?this.delayedAppendReviews():this.shouldReplaceReviews(e,this.props)&&this.replaceReviews()}shouldReplaceReviews(e,t){return e.orderby!==t.orderby||e.order!==t.order||e.productId!==t.productId||!L()(e.categoryIds,t.categoryIds)}componentWillUnmount(){this.isMounted=!1,this.delayedAppendReviews.cancel&&this.delayedAppendReviews.cancel()}getArgs(e){const{categoryIds:t,order:r,orderby:o,productId:n,reviewsToDisplay:c}=this.props,a={order:r,orderby:o,per_page:c-e,offset:e};if(t){const e=Array.isArray(t)?t:JSON.parse(t);a.category_id=Array.isArray(e)?e.join(","):e}return n&&(a.product_id=n),a}replaceReviews(){if(this.isPreview)return;const{onReviewsReplaced:e}=this.props;this.updateListOfReviews().then(e)}appendReviews(){if(this.isPreview)return;const{onReviewsAppended:e,reviewsToDisplay:t}=this.props,{reviews:r}=this.state;t<=r.length||this.updateListOfReviews(r).then(e)}updateListOfReviews(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const{reviewsToDisplay:t}=this.props,{totalReviews:r}=this.state,o=Math.min(r,t)-e.length;return this.setState({loading:!0,reviews:e.concat(Array(o).fill({}))}),Object(x.c)(this.getArgs(e.length)).then(t=>{let{reviews:r,totalReviews:o}=t;return this.isMounted&&this.setState({reviews:e.filter(e=>Object.keys(e).length).concat(r),totalReviews:o,loading:!1,error:null}),{newReviews:r}}).catch(this.setError)}render(){const{reviewsToDisplay:t}=this.props,{error:r,loading:n,reviews:c,totalReviews:a}=this.state;return Object(o.createElement)(e,P()({},this.props,{error:r,isLoading:n,reviews:c.slice(0,t),totalReviews:a}))}}h()(t,"defaultProps",{delayFunction:e=>e,onReviewsAppended:()=>{},onReviewsLoadError:()=>{},onReviewsReplaced:()=>{}});const{displayName:r=e.name||"Component"}=e;return t.displayName=`WithReviews( ${r} )`,t})(M);t.a=e=>{let{attributes:t,icon:r,name:s,noReviewsPlaceholder:l}=e;const{categoryIds:d,productId:u,reviewsOnPageLoad:b,showProductName:w,showReviewDate:p,showReviewerName:m,showReviewContent:g,showReviewImage:v,showReviewRating:h}=t,{order:_,orderby:O}=Object(x.d)(t.orderby),j=!(g||h||p||m||v||w),f=Object(i.useBlockProps)({className:Object(x.a)(t)});return j?Object(o.createElement)(a.Placeholder,{icon:r,label:s},Object(n.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")):Object(o.createElement)("div",f,Object(o.createElement)(I,{attributes:t,categoryIds:d,delayFunction:e=>Object(c.debounce)(e,400),noReviewsPlaceholder:l,orderby:O,order:_,productId:u,reviewsToDisplay:b}))}},159:function(e,t){},160:function(e,t){},183:function(e,t){},184:function(e,t){},185:function(e,t){},186:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},22:function(e,t){e.exports=window.wp.isShallowEqual},23:function(e,t,r){"use strict";r.d(t,"o",(function(){return c})),r.d(t,"m",(function(){return a})),r.d(t,"l",(function(){return i})),r.d(t,"n",(function(){return s})),r.d(t,"j",(function(){return l})),r.d(t,"e",(function(){return d})),r.d(t,"f",(function(){return u})),r.d(t,"g",(function(){return b})),r.d(t,"k",(function(){return w})),r.d(t,"c",(function(){return p})),r.d(t,"d",(function(){return m})),r.d(t,"h",(function(){return g})),r.d(t,"a",(function(){return v})),r.d(t,"i",(function(){return h})),r.d(t,"b",(function(){return _}));var o,n=r(2);const c=Object(n.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=c.pluginUrl+"images/",i=c.pluginUrl+"build/",s=c.buildPhase,l=null===(o=n.STORE_PAGES.shop)||void 0===o?void 0:o.permalink,d=n.STORE_PAGES.checkout.id,u=n.STORE_PAGES.checkout.permalink,b=n.STORE_PAGES.privacy.permalink,w=(n.STORE_PAGES.privacy.title,n.STORE_PAGES.terms.permalink),p=(n.STORE_PAGES.terms.title,n.STORE_PAGES.cart.id),m=n.STORE_PAGES.cart.permalink,g=(n.STORE_PAGES.myaccount.permalink?n.STORE_PAGES.myaccount.permalink:Object(n.getSetting)("wpLoginUrl","/wp-login.php"),Object(n.getSetting)("shippingCountries",{})),v=Object(n.getSetting)("allowedCountries",{}),h=Object(n.getSetting)("shippingStates",{}),_=Object(n.getSetting)("allowedStates",{})},27:function(e,t,r){"use strict";r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return a}));var o=r(1),n=r(14);const c=async e=>{if("function"==typeof e.json)try{const t=await e.json();return{message:t.message,type:t.type||"api"}}catch(e){return{message:e.message,type:"general"}}return{message:e.message,type:e.type||"general"}},a=e=>{if(e.data&&"rest_invalid_param"===e.code){const t=Object.values(e.data.params);if(t[0])return t[0]}return null!=e&&e.message?Object(n.decodeEntities)(e.message):Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},28:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n);t.a=e=>{let t,{label:r,screenReaderLabel:n,wrapperElement:a,wrapperProps:i={}}=e;const s=null!=r,l=null!=n;return!s&&l?(t=a||"span",i={...i,className:c()(i.className,"screen-reader-text")},Object(o.createElement)(t,i,n)):(t=a||o.Fragment,s&&l&&r!==n?Object(o.createElement)(t,i,Object(o.createElement)("span",{"aria-hidden":"true"},r),Object(o.createElement)("span",{className:"screen-reader-text"},n)):Object(o.createElement)(t,i,r))}},3:function(e,t){e.exports=window.wp.components},32:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(33);t.a=e=>{let{error:t}=e;return Object(o.createElement)("div",{className:"wc-block-error-message"},(e=>{let{message:t,type:r}=e;return t?"general"===r?Object(o.createElement)("span",null,Object(n.__)("The following error was returned","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):"api"===r?Object(o.createElement)("span",null,Object(n.__)("The following error was returned from the API","woo-gutenberg-products-block"),Object(o.createElement)("br",null),Object(o.createElement)("code",null,Object(c.escapeHTML)(t))):t:Object(n.__)("An error has prevented the block from being updated.","woo-gutenberg-products-block")})(t))}},33:function(e,t){e.exports=window.wp.escapeHtml},371:function(e,t,r){e.exports=r(482)},482:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(8),a=r(113),i=r(516),s=(r(159),r(5)),l=r(3),d=r(150),u=()=>Object(o.createElement)(l.Placeholder,{className:"wc-block-all-reviews",icon:Object(o.createElement)(a.a,{icon:i.a,className:"block-editor-block-icon"}),label:Object(n.__)("All Reviews","woo-gutenberg-products-block")},Object(n.__)("This block shows a list of all product reviews. Your store does not have any reviews yet, but they will show up here when it does.","woo-gutenberg-products-block")),b=r(105),w=r(145),p=r(146),m=r(122);Object(c.registerBlockType)("woocommerce/all-reviews",{apiVersion:2,title:Object(n.__)("All Reviews","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(a.a,{icon:i.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(n.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(n.__)("Show a list of all product reviews.","woo-gutenberg-products-block"),supports:{html:!1,color:{background:!1},typography:{fontSize:!0}},example:{...m.a,attributes:{...m.a.attributes,showProductName:!0}},attributes:{...w.a,showProductName:{type:"boolean",default:!0}},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:r}=e;return"woocommerce_recent_reviews"===t&&!(null==r||!r.raw)},transform:e=>{let{instance:t}=e;return Object(c.createBlock)("woocommerce/all-reviews",{reviewsOnPageLoad:t.raw.number,imageType:"product",showLoadMore:!1,showOrderby:!1,showReviewDate:!1,showReviewContent:!1})}}]},edit:e=>{let{attributes:t,setAttributes:r}=e;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(s.InspectorControls,{key:"inspector"},Object(o.createElement)(l.PanelBody,{title:Object(n.__)("Content","woo-gutenberg-products-block")},Object(o.createElement)(l.ToggleControl,{label:Object(n.__)("Product name","woo-gutenberg-products-block"),checked:t.showProductName,onChange:()=>r({showProductName:!t.showProductName})}),Object(b.b)(t,r)),Object(o.createElement)(l.PanelBody,{title:Object(n.__)("List Settings","woo-gutenberg-products-block")},Object(b.c)(t,r))),Object(o.createElement)(d.a,{attributes:t,icon:Object(o.createElement)(a.a,{icon:i.a,className:"block-editor-block-icon"}),name:Object(n.__)("All Reviews","woo-gutenberg-products-block"),noReviewsPlaceholder:u}))},save:p.a})},5:function(e,t){e.exports=window.wp.blockEditor},57:function(e,t,r){"use strict";r.d(t,"d",(function(){return s})),r.d(t,"c",(function(){return l})),r.d(t,"a",(function(){return d})),r.d(t,"b",(function(){return u}));var o=r(13),n=r.n(o),c=r(4),a=r.n(c),i=r(2);const s=e=>{if(Object(i.getSetting)("reviewRatingsEnabled",!0)){if("lowest-rating"===e)return{order:"asc",orderby:"rating"};if("highest-rating"===e)return{order:"desc",orderby:"rating"}}return{order:"desc",orderby:"date_gmt"}},l=e=>n()({path:"/wc/store/v1/products/reviews?"+Object.entries(e).map(e=>e.join("=")).join("&"),parse:!1}).then(e=>e.json().then(t=>({reviews:t,totalReviews:parseInt(e.headers.get("x-wp-total"),10)}))),d=e=>{const{className:t,categoryIds:r,productId:o,showReviewDate:n,showReviewerName:c,showReviewContent:i,showProductName:s,showReviewImage:l,showReviewRating:d}=e;let u="wc-block-all-reviews";return o&&(u="wc-block-reviews-by-product"),Array.isArray(r)&&(u="wc-block-reviews-by-category"),a()(u,t,{"has-image":l,"has-name":c,"has-date":n,"has-rating":d,"has-content":i,"has-product-name":s})},u=e=>{const{categoryIds:t,imageType:r,orderby:o,productId:n,reviewsOnPageLoad:c,reviewsOnLoadMore:a,showLoadMore:i,showOrderby:s}=e,l={"data-image-type":r,"data-orderby":o,"data-reviews-on-page-load":c,"data-reviews-on-load-more":a,"data-show-load-more":i,"data-show-orderby":s};return n&&(l["data-product-id"]=n),Array.isArray(t)&&(l["data-category-ids"]=t.join(",")),l}},7:function(e,t){e.exports=window.lodash},73:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(113),a=r(177),i=r(4),s=r.n(i),l=r(3),d=r(32);r(114),t.a=e=>{let{className:t,error:r,isLoading:i=!1,onRetry:u}=e;return Object(o.createElement)(l.Placeholder,{icon:Object(o.createElement)(c.a,{icon:a.a}),label:Object(n.__)("Sorry, an error occurred","woo-gutenberg-products-block"),className:s()("wc-block-api-error",t)},Object(o.createElement)(d.a,{error:r}),u&&Object(o.createElement)(o.Fragment,null,i?Object(o.createElement)(l.Spinner,null):Object(o.createElement)(l.Button,{isSecondary:!0,onClick:u},Object(n.__)("Retry","woo-gutenberg-products-block"))))}},8:function(e,t){e.exports=window.wp.blocks}});
build/attribute-filter-frontend.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', 'wp-block-editor', 'wp-blocks', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning'), 'version' => 'd1bee1c2a3316e72bd2af813b5927af2');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', 'wp-block-editor', 'wp-blocks', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning'), 'version' => 'd73a3f9e06440008094beabfea050486');
build/attribute-filter-frontend.js CHANGED
@@ -1,25 +1,25 @@
1
- !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=222)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.lodash},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var s=typeof r;if("string"===s||"number"===s)e.push(r);else if(Array.isArray(r)){if(r.length){var i=o.apply(null,r);i&&e.push(i)}}else if("object"===s)if(r.toString===Object.prototype.toString)for(var c in r)n.call(r,c)&&r[c]&&e.push(c);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t){e.exports=window.wp.data},function(e,t,n){"use strict";function r(){return(r=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}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},function(e,t){e.exports=window.wc.blocksCheckout},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.isShallowEqual},function(e,t){function n(){return e.exports=n=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},e.exports.__esModule=!0,e.exports.default=e.exports,n.apply(this,arguments)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=window.wp.primitives},function(e,t){e.exports=window.wp.url},function(e,t,n){"use strict";var r=n(19),o=n.n(r),s=n(0),i=n(5),c=n(1),a=n(48),l=e=>{let{imageUrl:t=a.l+"/block-error.svg",header:n=Object(c.__)("Oops!","woo-gutenberg-products-block"),text:r=Object(c.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:i=Object(c.__)("Error:","woo-gutenberg-products-block"),button:l,showErrorBlock:u=!0}=e;return u?Object(s.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(s.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(s.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},n&&Object(s.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},n),r&&Object(s.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},r),o&&Object(s.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},i?i+" ":"",o),l&&Object(s.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};n(35);class u extends i.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(s.createElement)(s.Fragment,null,Object(s.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:n=!0,showErrorBlock:r=!0,text:o,errorMessagePrefix:i,renderError:c,button:a}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof c?c({errorMessage:u}):Object(s.createElement)(l,{showErrorBlock:r,errorMessage:n?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:i,button:a}):this.props.children}}t.a=u},,function(e,t){e.exports=window.wp.htmlEntities},function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){"use strict";var r=n(0),o=n(4),s=n.n(o);t.a=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:i,wrapperProps:c={}}=e;const a=null!=n,l=null!=o;return!a&&l?(t=i||"span",c={...c,className:s()(c.className,"screen-reader-text")},Object(r.createElement)(t,c,o)):(t=i||r.Fragment,a&&l&&n!==o?Object(r.createElement)(t,c,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,c,n))}},,,function(e,t){e.exports=window.wp.a11y},function(e,t,n){"use strict";(function(e){var r=n(0);n(37);const o=Object(r.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,n(55))},function(e,t){e.exports=window.wp.deprecated},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(0);const o=Object(r.createContext)("page"),s=()=>Object(r.useContext)(o);o.Provider},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),o=n(11),s=n.n(o);function i(e){const t=Object(r.useRef)(e);return s()(e,t.current)||(t.current=e),t.current}},,,function(e,t,n){"use strict";var r=n(4),o=n.n(r),s=n(0);t.a=Object(s.forwardRef)((function({as:e="div",className:t,...n},r){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(s.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...n,ref:r})}))},function(e,t){},,function(e,t){e.exports=window.wp.warning},function(e,t,n){"use strict";var r=n(8),o=n(0),s=n(13),i=function({icon:e,className:t,...n}){const s=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(r.a)({className:s},n))};t.a=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return Object(o.createElement)(i,Object(r.a)({icon:e},n));if(Object(o.isValidElement)(e)&&i===e.type)return Object(o.cloneElement)(e,{...n});if("function"==typeof e)return e.prototype instanceof o.Component?Object(o.createElement)(e,{size:t,...n}):e({size:t,...n});if(e&&("svg"===e.type||e.type===s.SVG)){const r={width:t,height:t,...e.props,...n};return Object(o.createElement)(s.SVG,r)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...n}):e}},function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return f}));var r=n(6),o=n(7),s=n(0),i=n(11),c=n.n(i),a=n(31),l=n(61),u=n(26);const d=e=>{const t=Object(u.a)();e=e||t;const n=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:i}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(s.useCallback)(t=>{i(e,t)},[e,i])]},p=(e,t,n)=>{const i=Object(u.a)();n=n||i;const c=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:a}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[c,Object(s.useCallback)(t=>{a(n,e,t)},[n,e,a])]},f=(e,t)=>{const n=Object(u.a)();t=t||n;const[r,o]=d(t),i=Object(a.a)(r),p=Object(a.a)(e),f=Object(l.a)(p),b=Object(s.useRef)(!1);return Object(s.useEffect)(()=>{c()(f,p)||(o(Object.assign({},i,p)),b.current=!0)},[i,p,f,o]),b.current?[r,o]:[e,o]}},,,function(e,t,n){"use strict";var r=n(8),o=n(0),s=n(4),i=n.n(s),c=n(3),a=n(25),l=n.n(a),u=n(10),d=n(44),p=n(71),f=n(1);function b(e,t,n){const{defaultView:r}=t,{frameElement:o}=r;if(!o||t===n.ownerDocument)return e;const s=o.getBoundingClientRect();return new r.DOMRect(e.left+s.left,e.top+s.top,e.width,e.height)}let m=0;function h(e){const t=document.scrollingElement||document.body;e&&(m=t.scrollTop);const n=e?"add":"remove";t.classList[n]("lockscroll"),document.documentElement.classList[n]("lockscroll"),e||(t.scrollTop=m)}let g=0;function v(){return Object(o.useEffect)(()=>(0===g&&h(!0),++g,()=>{1===g&&h(!1),--g}),[]),null}var O=n(24);function w(e){const t=Object(o.useContext)(O.a),n=t.slots[e]||{},r=t.fills[e],s=Object(o.useMemo)(()=>r||[],[r]);return{...n,updateSlot:Object(o.useCallback)(n=>{t.updateSlot(e,n)},[e,t.updateSlot]),unregisterSlot:Object(o.useCallback)(n=>{t.unregisterSlot(e,n)},[e,t.unregisterSlot]),fills:s,registerFill:Object(o.useCallback)(n=>{t.registerFill(e,n)},[e,t.registerFill]),unregisterFill:Object(o.useCallback)(n=>{t.unregisterFill(e,n)},[e,t.unregisterFill])}}var j=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function y({name:e,children:t,registerFill:n,unregisterFill:r}){const s=(e=>{const{getSlot:t,subscribe:n}=Object(o.useContext)(j),[r,s]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(s(t(e)),n(()=>{s(t(e))})),[e]),r})(e),i=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(n(e,i.current),()=>r(e,i.current)),[]),Object(o.useLayoutEffect)(()=>{i.current.children=t,s&&s.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==i.current.name&&(r(i.current.name,i.current),i.current.name=e,n(e,i.current))},[e]),s&&s.node?(Object(c.isFunction)(t)&&(t=t(s.props.fillProps)),Object(o.createPortal)(t,s.node)):null}var E=e=>Object(o.createElement)(j.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(o.createElement)(y,Object(r.a)({},e,{registerFill:t,unregisterFill:n})));class k extends o.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:n,registerSlot:r}=this.props;e.name!==t&&(n(e.name),r(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:n={},getFills:r}=this.props,s=Object(c.map)(r(t,this),e=>{const t=Object(c.isFunction)(e.children)?e.children(n):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(c.isString)(e))return e;const n=e.key||t;return Object(o.cloneElement)(e,{key:n})})}).filter(Object(c.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(c.isFunction)(e)?e(s):s)}}var _=e=>Object(o.createElement)(j.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:s})=>Object(o.createElement)(k,Object(r.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:s})));function S(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function x({name:e,children:t}){const n=w(e),r=Object(o.useRef)({rerender:S()});return Object(o.useEffect)(()=>(n.registerFill(r),()=>{n.unregisterFill(r)}),[n.registerFill,n.unregisterFill]),n.ref&&n.ref.current?("function"==typeof t&&(t=t(n.fillProps)),Object(o.createPortal)(t,n.ref.current)):null}var T=Object(o.forwardRef)((function({name:e,fillProps:t={},as:n="div",...s},i){const c=Object(o.useContext)(O.a),a=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(c.registerSlot(e,a,t),()=>{c.unregisterSlot(e,a)}),[c.registerSlot,c.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{c.updateSlot(e,t)}),Object(o.createElement)(n,Object(r.a)({ref:Object(u.useMergeRefs)([i,a])},s))}));function C(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(E,e),Object(o.createElement)(x,e))}n(11),o.Component;const L=Object(o.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(o.createElement)(T,Object(r.a)({},t,{ref:n})):Object(o.createElement)(_,t));function I(e){return"appear"===e?"top":"left"}function A(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:s}=(i=t).ownerDocument.defaultView.getComputedStyle(i);var i;const c=n?parseInt(n,10):0,a=r?parseInt(r,10):0,l=o?parseInt(o,10):0,u=s?parseInt(s,10):0;return{x:e.left+l,y:e.top+c,width:e.width-l-u,height:e.height-c-a,left:e.left+l,right:e.right-u,top:e.top+c,bottom:e.bottom-a}}function R(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function F(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function P(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const M=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:n,className:s,noArrow:c=!0,isAlternate:a,position:m="bottom right",range:h,focusOnMount:g="firstElement",anchorRef:O,shouldAnchorIncludePadding:j,anchorRect:y,getAnchorRect:E,expandOnMobile:k,animate:_=!0,onClickOutside:S,onFocusOutside:x,__unstableStickyBoundaryElement:T,__unstableSlotName:L="Popover",__unstableObserveElement:M,__unstableBoundaryParent:N,__unstableForcePosition:B,__unstableForceXAlignment:D,...V},W)=>{const H=Object(o.useRef)(null),q=Object(o.useRef)(null),z=Object(o.useRef)(),K=Object(u.useViewportMatch)("medium","<"),[U,$]=Object(o.useState)(),Q=w(L),Y=k&&K,[J,X]=Object(u.useResizeObserver)();c=Y||c,Object(o.useLayoutEffect)(()=>{if(Y)return P(z.current,"is-without-arrow",c),P(z.current,"is-alternate",a),R(z.current,"data-x-axis"),R(z.current,"data-y-axis"),F(z.current,"top"),F(z.current,"left"),F(q.current,"maxHeight"),void F(q.current,"maxWidth");const e=()=>{if(!z.current||!q.current)return;let e=function(e,t,n,r=!1,o,s){if(t)return t;if(n){if(!e.current)return;const t=n(e.current);return b(t,t.ownerDocument||e.current.ownerDocument,s)}if(!1!==r){if(!(r&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==r?void 0:r.cloneRange))return b(Object(d.getRectangleFromRange)(r),r.endContainer.ownerDocument,s);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=b(r.getBoundingClientRect(),r.ownerDocument,s);return o?e:A(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),c=b(new window.DOMRect(n.left,n.top,n.width,i.bottom-n.top),e.ownerDocument,s);return o?c:A(c,r)}if(!e.current)return;const{parentNode:i}=e.current,c=i.getBoundingClientRect();return o?c:A(c,i)}(H,y,E,O,j,z.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=z.current;let r,o=0;if(t&&t!==n.body){const n=t.getBoundingClientRect();o=n.top,e=new window.DOMRect(e.left-n.left,e.top-n.top,e.width,e.height)}var s;N&&(r=null===(s=z.current.closest(".popover-slot"))||void 0===s?void 0:s.parentNode);const i=X.height?X:q.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:p,yAxis:h,contentHeight:g,contentWidth:v}=function(e,t,n="top",r,o,s,i,c,a){const[l,u="center",d]=n.split(" "),p=function(e,t,n,r,o,s,i,c){const{height:a}=t;if(o){const t=o.getBoundingClientRect().top+a-i;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===r?l=e.bottom:"top"===r&&(l=e.top);const u={popoverTop:l,contentHeight:(l-a/2>0?a/2:l)+(l+a/2>window.innerHeight?window.innerHeight-l:a/2)},d={popoverTop:e.top,contentHeight:e.top-10-a>0?a:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+a>window.innerHeight?window.innerHeight-10-e.bottom:a};let f,b=n,m=null;if(!o&&!c)if("middle"===n&&u.contentHeight===a)b="middle";else if("top"===n&&d.contentHeight===a)b="top";else if("bottom"===n&&p.contentHeight===a)b="bottom";else{b=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===b?d.contentHeight:p.contentHeight;m=e!==a?e:null}return f="middle"===b?u.popoverTop:"top"===b?d.popoverTop:p.popoverTop,{yAxis:b,popoverTop:f,contentHeight:m}}(e,t,l,d,r,0,s,c);return{...function(e,t,n,r,o,s,i,c,a){const{width:l}=t;"left"===n&&Object(f.isRTL)()?n="right":"right"===n&&Object(f.isRTL)()&&(n="left"),"left"===r&&Object(f.isRTL)()?r="right":"right"===r&&Object(f.isRTL)()&&(r="left");const u=Math.round(e.left+e.width/2),d={popoverLeft:u,contentWidth:(u-l/2>0?l/2:u)+(u+l/2>window.innerWidth?window.innerWidth-u:l/2)};let p=e.left;"right"===r?p=e.right:"middle"===s||a||(p=u);let b=e.right;"left"===r?b=e.left:"middle"===s||a||(b=u);const m={popoverLeft:p,contentWidth:p-l>0?l:p},h={popoverLeft:b,contentWidth:b+l>window.innerWidth?window.innerWidth-b:l};let g,v=n,O=null;if(!o&&!c)if("center"===n&&d.contentWidth===l)v="center";else if("left"===n&&m.contentWidth===l)v="left";else if("right"===n&&h.contentWidth===l)v="right";else{v=m.contentWidth>h.contentWidth?"left":"right";const e="left"===v?m.contentWidth:h.contentWidth;l>window.innerWidth&&(O=window.innerWidth),e!==l&&(v="center",d.popoverLeft=window.innerWidth/2)}if(g="center"===v?d.popoverLeft:"left"===v?m.popoverLeft:h.popoverLeft,i){const e=i.getBoundingClientRect();g=Math.min(g,e.right-l),Object(f.isRTL)()||(g=Math.max(g,0))}return{xAxis:v,popoverLeft:g,contentWidth:O}}(e,t,u,d,r,p.yAxis,i,c,a),...p}}(e,i,m,T,z.current,o,r,B,D);"number"==typeof l&&"number"==typeof u&&(F(z.current,"top",l+"px"),F(z.current,"left",u+"px")),P(z.current,"is-without-arrow",c||"center"===p&&"middle"===h),P(z.current,"is-alternate",a),R(z.current,"data-x-axis",p),R(z.current,"data-y-axis",h),F(q.current,"maxHeight","number"==typeof g?g+"px":""),F(q.current,"maxWidth","number"==typeof v?v+"px":""),$(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[h]||"middle"))};e();const{ownerDocument:t}=z.current,{defaultView:n}=t,r=n.setInterval(e,500);let o;const s=()=>{n.cancelAnimationFrame(o),o=n.requestAnimationFrame(e)};n.addEventListener("click",s),n.addEventListener("resize",e),n.addEventListener("scroll",e,!0);const i=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(O);let l;return i&&i!==t&&(i.defaultView.addEventListener("resize",e),i.defaultView.addEventListener("scroll",e,!0)),M&&(l=new n.MutationObserver(e),l.observe(M,{attributes:!0})),()=>{n.clearInterval(r),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",s),n.cancelAnimationFrame(o),i&&i!==t&&(i.defaultView.removeEventListener("resize",e),i.defaultView.removeEventListener("scroll",e,!0)),l&&l.disconnect()}},[Y,y,E,O,j,m,X,T,M,N]);const Z=(e,n)=>{if("focus-outside"===e&&x)x(n);else if("focus-outside"===e&&S){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),S(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:g,__unstableOnClose:Z,onClose:Z}),ne=Object(u.useMergeRefs)([z,ee,W]),re=Boolean(_&&U)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:n=I(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+n):void 0}({type:"appear",origin:U});let oe=Object(o.createElement)("div",Object(r.a)({className:i()("components-popover",s,re,{"is-expanded":Y,"is-without-arrow":c,"is-alternate":a})},V,{ref:ne},te,{tabIndex:"-1"}),Y&&Object(o.createElement)(v,null),Y&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(G,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:q,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},J,n)));return Q.ref&&(oe=Object(o.createElement)(C,{name:L},oe)),O||y?oe:Object(o.createElement)("span",{ref:H},oe)});M.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(L,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var N=M,B=function({shortcut:e,className:t}){if(!e)return null;let n,r;return Object(c.isString)(e)&&(n=e),Object(c.isObject)(e)&&(n=e.display,r=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":r},n)};const D=Object(o.createElement)("div",{className:"event-catcher"}),V=({eventHandlers:e,child:t,childrenWithPopover:n})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(D,e),Object(o.cloneElement)(t,{children:n}),","),e),W=({child:e,eventHandlers:t,childrenWithPopover:n})=>Object(o.cloneElement)(e,{...t,children:n}),H=(e,t,n)=>{if(1!==o.Children.count(e))return;const r=o.Children.only(e);"function"==typeof r.props[t]&&r.props[t](n)};var q=function({children:e,position:t,text:n,shortcut:r}){const[s,i]=Object(o.useState)(!1),[a,l]=Object(o.useState)(!1),d=Object(u.useDebounce)(l,700),p=t=>{H(e,"onMouseDown",t),document.addEventListener("mouseup",m),i(!0)},f=t=>{H(e,"onMouseUp",t),document.removeEventListener("mouseup",m),i(!1)},b=e=>"mouseUp"===e?f:"mouseDown"===e?p:void 0,m=b("mouseUp"),h=(t,n)=>r=>{if(H(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&s)return;d.cancel();const o=Object(c.includes)(["focus","mouseenter"],r.type);o!==a&&(n?d(o):l(o))},g=()=>{d.cancel(),document.removeEventListener("mouseup",m)};if(Object(o.useEffect)(()=>g,[]),1!==o.Children.count(e))return e;const v={onMouseEnter:h("onMouseEnter",!0),onMouseLeave:h("onMouseLeave"),onClick:h("onClick"),onFocus:h("onFocus"),onBlur:h("onBlur"),onMouseDown:b("mouseDown")},O=o.Children.only(e),{children:w,disabled:j}=O.props;return(j?V:W)({child:O,eventHandlers:v,childrenWithPopover:(({grandchildren:e,isOver:t,position:n,text:r,shortcut:s})=>Object(o.concatChildren)(e,t&&Object(o.createElement)(N,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},r,Object(o.createElement)(B,{className:"components-tooltip__shortcut",shortcut:s}))))({grandchildren:w,isOver:a,position:t,text:n,shortcut:r})})},z=n(38),K=n(34);const U=["onMouseDown","onClick"];var G=t.a=Object(o.forwardRef)((function(e,t){const{href:n,target:s,isSmall:a,isPressed:u,isBusy:d,isDestructive:p,className:f,disabled:b,icon:m,iconPosition:h="left",iconSize:g,showTooltip:v,tooltipPosition:O,shortcut:w,label:j,children:y,text:E,variant:k,__experimentalIsFocusable:_,describedBy:S,...x}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:s,...i}){let c=s;var a,u,d,p,f;return t&&(null!==(a=c)&&void 0!==a||(c="primary")),r&&(null!==(u=c)&&void 0!==u||(c="tertiary")),n&&(null!==(d=c)&&void 0!==d||(c="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=c)&&void 0!==p||(c="secondary")),o&&(null!==(f=c)&&void 0!==f||(c="link")),{...i,variant:c}}(e),T=i()("components-button",f,{"is-secondary":"secondary"===k,"is-primary":"primary"===k,"is-small":a,"is-tertiary":"tertiary"===k,"is-pressed":u,"is-busy":d,"is-link":"link"===k,"is-destructive":p,"has-text":!!m&&!!y,"has-icon":!!m}),C=b&&!_,L=void 0===n||C?"button":"a",I="a"===L?{href:n,target:s}:{type:"button",disabled:C,"aria-pressed":u};if(b&&_){I["aria-disabled"]=!0;for(const e of U)x[e]=e=>{e.stopPropagation(),e.preventDefault()}}const A=!C&&(v&&j||w||!!j&&(!y||Object(c.isArray)(y)&&!y.length)&&!1!==v),R=S?Object(c.uniqueId)():null,F=x["aria-describedby"]||R,P=Object(o.createElement)(L,Object(r.a)({},I,x,{className:T,"aria-label":x["aria-label"]||j,"aria-describedby":F,ref:t}),m&&"left"===h&&Object(o.createElement)(z.a,{icon:m,size:g}),E&&Object(o.createElement)(o.Fragment,null,E),m&&"right"===h&&Object(o.createElement)(z.a,{icon:m,size:g}),y);return A?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(q,{text:S||j,shortcut:w,position:O},P),S&&Object(o.createElement)(K.a,null,Object(o.createElement)("span",{id:R},S))):Object(o.createElement)(o.Fragment,null,P,S&&Object(o.createElement)(K.a,null,Object(o.createElement)("span",{id:R},S)))}))},,function(e,t){e.exports=window.wp.dom},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},,,function(e,t,n){"use strict";n.d(t,"n",(function(){return s})),n.d(t,"l",(function(){return i})),n.d(t,"k",(function(){return c})),n.d(t,"m",(function(){return a})),n.d(t,"i",(function(){return l})),n.d(t,"d",(function(){return u})),n.d(t,"f",(function(){return d})),n.d(t,"j",(function(){return p})),n.d(t,"c",(function(){return f})),n.d(t,"e",(function(){return b})),n.d(t,"g",(function(){return m})),n.d(t,"a",(function(){return h})),n.d(t,"h",(function(){return g})),n.d(t,"b",(function(){return v}));var r,o=n(2);const s=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=s.pluginUrl+"images/",c=s.pluginUrl+"build/",a=s.buildPhase,l=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),d=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),f=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),b=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),m=Object(o.getSetting)("shippingCountries",{}),h=Object(o.getSetting)("allowedCountries",{}),g=Object(o.getSetting)("shippingStates",{}),v=Object(o.getSetting)("allowedStates",{})},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(5);function o(e,t,n){var o=this,s=Object(r.useRef)(null),i=Object(r.useRef)(0),c=Object(r.useRef)(null),a=Object(r.useRef)([]),l=Object(r.useRef)(),u=Object(r.useRef)(),d=Object(r.useRef)(e),p=Object(r.useRef)(!0);d.current=e;var f=!t&&0!==t&&"undefined"!=typeof window;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var b=!!(n=n||{}).leading,m=!("trailing"in n)||!!n.trailing,h="maxWait"in n,g=h?Math.max(+n.maxWait||0,t):null;return Object(r.useEffect)((function(){return p.current=!0,function(){p.current=!1}}),[]),Object(r.useMemo)((function(){var e=function(e){var t=a.current,n=l.current;return a.current=l.current=null,i.current=e,u.current=d.current.apply(n,t)},n=function(e,t){f&&cancelAnimationFrame(c.current),c.current=f?requestAnimationFrame(e):setTimeout(e,t)},r=function(e){if(!p.current)return!1;var n=e-s.current,r=e-i.current;return!s.current||n>=t||n<0||h&&r>=g},v=function(t){return c.current=null,m&&a.current?e(t):(a.current=l.current=null,u.current)},O=function(){var e=Date.now();if(r(e))return v(e);if(p.current){var o=e-s.current,c=e-i.current,a=t-o,l=h?Math.min(a,g-c):a;n(O,l)}},w=function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];var m=Date.now(),g=r(m);if(a.current=d,l.current=o,s.current=m,g){if(!c.current&&p.current)return i.current=s.current,n(O,t),b?e(s.current):u.current;if(h)return n(O,t),e(s.current)}return c.current||n(O,t),u.current};return w.cancel=function(){c.current&&(f?cancelAnimationFrame(c.current):clearTimeout(c.current)),i.current=0,a.current=s.current=l.current=c.current=null},w.isPending=function(){return!!c.current},w.flush=function(){return c.current?v(Date.now()):u.current},w}),[b,h,t,g,m,f])}},function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(12),o=n.n(r),s=n(0),i=n(15);const c=[".wp-block-woocommerce-cart"],a=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:c=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const a=r(e,n),l=c(e,n),u={...e.dataset,...a.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:c={},errorBoundaryProps:a={}}=e;Object(s.render)(Object(s.createElement)(i.a,a,Object(s.createElement)(s.Suspense,{fallback:Object(s.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(s.createElement)(t,o()({},c,{attributes:r})))),n,()=>{n.classList&&n.classList.remove("is-loading")})})({Block:t,container:e,props:a,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(c.join(",")),{Block:n,getProps:r,getErrorBoundaryProps:o,selector:s}=e;(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrappers:s}=e;const i=document.body.querySelectorAll(o);s&&s.length>0&&Array.prototype.filter.call(i,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,s)),a({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})})({Block:n,getProps:r,getErrorBoundaryProps:o,selector:s,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrapper:s}=e;const i=s.querySelectorAll(o);a({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})})({...e,wrapper:t})})})}},function(e,t){e.exports=window.wp.keycodes},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(20);n(127),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,n&&Number.isFinite(n)&&Object(r.createElement)(s.a,{label:n.toString(),screenReaderLabel:Object(o.sprintf)(
2
  /* translators: %s number of products. */
3
- Object(o._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},function(e,t){var n,r,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function c(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var a,l=[],u=!1,d=-1;function p(){u&&a&&(u=!1,a.length?l=a.concat(l):d=-1,l.length&&f())}function f(){if(!u){var e=c(p);u=!0;for(var t=l.length;t;){for(a=l,l=[];++d<t;)a&&a[d].run();d=-1,t=l.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function b(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new b(e,t)),1!==l.length||u||c(f)},b.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(5);function o(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(6),o=n(7),s=n(0),i=n(31),c=n(73);const a=e=>{const{namespace:t,resourceName:n,resourceValues:a=[],query:l={},shouldSelect:u=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(s.useRef)({results:[],isLoading:!0}),p=Object(i.a)(l),f=Object(i.a)(a),b=Object(c.a)(),m=Object(o.useSelect)(e=>{if(!u)return null;const o=e(r.COLLECTIONS_STORE_KEY),s=[t,n,p,f],i=o.getCollectionError(...s);if(i){if(!(i instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");b(i)}return{results:o.getCollection(...s),isLoading:!o.hasFinishedResolution("getCollection",s)}},[t,n,f,p,u]);return null!==m&&(d.current=m),d.current}},,,,,,function(e,t,n){"use strict";var r=n(0),o=n(13);const s=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));t.a=s},,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0);const o=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},,function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(4),i=n.n(s),c=n(20);n(109),t.a=e=>{let{className:t,label:
4
  /* translators: Reset button text for filters. */
5
- n=Object(o.__)("Reset","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:a=Object(o.__)("Reset filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{className:i()("wc-block-components-filter-reset-button",t),onClick:s},Object(r.createElement)(c.a,{label:n,screenReaderLabel:a}))}},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(4),i=n.n(s),c=n(20);n(110),t.a=e=>{let{className:t,disabled:n,label:
6
  /* translators: Submit button text for filters. */
7
- s=Object(o.__)("Apply","woo-gutenberg-products-block"),onClick:a,screenReaderLabel:l=Object(o.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:i()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",t),disabled:n,onClick:a},Object(r.createElement)(c.a,{label:s,screenReaderLabel:l}))}},function(e,t,n){"use strict";var r=n(0),o=n(3),s=n(4),i=n.n(s),c=n(1),a=n(23),l=n(71),u=n(42);function d(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}t.a=function({className:e,status:t="info",children:n,spokenMessage:s=n,onRemove:p=o.noop,isDismissible:f=!0,actions:b=[],politeness:m=d(t),__unstableHTML:h,onDismiss:g=o.noop}){!function(e,t){const n="string"==typeof e?e:Object(r.renderToString)(e);Object(r.useEffect)(()=>{n&&Object(a.speak)(n,t)},[n,t])}(s,m);const v=i()(e,"components-notice","is-"+t,{"is-dismissible":f});return h&&(n=Object(r.createElement)(r.RawHTML,null,n)),Object(r.createElement)("div",{className:v},Object(r.createElement)("div",{className:"components-notice__content"},n,Object(r.createElement)("div",{className:"components-notice__actions"},b.map(({className:e,label:t,isPrimary:n,variant:o,noDefaultClasses:s=!1,onClick:c,url:a},l)=>{let d=o;return"primary"===o||s||(d=a?"link":"secondary"),void 0===d&&n&&(d="primary"),Object(r.createElement)(u.a,{key:l,href:a,variant:d,onClick:a?void 0:c,className:i()("components-notice__action",e)},t)}))),f&&Object(r.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(c.__)("Dismiss this notice"),onClick:e=>{var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),g(),p()},showTooltip:!1}))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(5),o=n(51);function s(e,t){return e===t}function i(e){return"function"==typeof e?function(){return e}:e}function c(e,t,n){var c=n&&n.equalityFn||s,a=function(e){var t=Object(r.useState)(i(e)),n=t[0],o=t[1];return[n,Object(r.useCallback)((function(e){return o(i(e))}),[])]}(e),l=a[0],u=a[1],d=Object(o.a)(Object(r.useCallback)((function(e){return u(e)}),[u]),t,n),p=Object(r.useRef)(e);return c(p.current,e)||(d(e),p.current=e),[l,d]}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return s}));var r=n(3);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const s=e.filter(e=>e.attribute===n.taxonomy),i=s.length?s[0]:null;if(!(i&&i.slug&&Array.isArray(i.slug)&&i.slug.includes(o)))return;const c=i.slug.filter(e=>e!==o),a=e.filter(e=>e.attribute!==n.taxonomy);c.length>0&&(i.slug=c.sort(),a.push(i)),t(Object(r.sortBy)(a,"attribute"))},s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!n||!n.taxonomy)return[];const i=e.filter(e=>e.attribute!==n.taxonomy);return 0===o.length?t(i):(i.push({attribute:n.taxonomy,operator:s,slug:o.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(r.sortBy)(i,"attribute"))),i}},,function(e,t){e.exports=window.wp.blocks},,function(e,t,n){"use strict";var r=n(0);t.a=function(e){let{icon:t,size:n=24,...o}=e;return Object(r.cloneElement)(t,{width:n,height:n,...o})}},,,function(e,t){},function(e,t){},,function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i}));var r=n(2);const o=Object(r.getSetting)("attributes",[]).reduce((e,t)=>{const n=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label}:null;var r;return n&&n.id&&e.push(n),e},[]),s=e=>{if(e)return o.find(t=>t.id===e)},i=e=>{if(e)return o.find(t=>t.taxonomy===e)}},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(4),i=n.n(s),c=n(9);n(128),t.a=e=>{let{className:t,onChange:n,options:s=[],checked:a=[],isLoading:l=!1,isDisabled:u=!1,limit:d=10}=e;const[p,f]=Object(r.useState)(!1),b=Object(r.useMemo)(()=>[...Array(5)].map((e,t)=>Object(r.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),m=Object(r.useMemo)(()=>{const e=s.length-d;return!p&&Object(r.createElement)("li",{key:"show-more",className:"show-more"},Object(r.createElement)("button",{onClick:()=>{f(!0)},"aria-expanded":!1,"aria-label":Object(o.sprintf)(
8
  /* translators: %s is referring the remaining count of options */
9
  Object(o._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(o.sprintf)(
10
  /* translators: %s number of options to reveal. */
11
- Object(o._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[s,d,p]),h=Object(r.useMemo)(()=>p&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{f(!1)},"aria-expanded":!0,"aria-label":Object(o.__)("Show less options","woo-gutenberg-products-block")},Object(o.__)("Show less","woo-gutenberg-products-block"))),[p]),g=Object(r.useMemo)(()=>{const e=s.length>d+5;return Object(r.createElement)(r.Fragment,null,s.map((t,o)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!p&&o>=d&&{hidden:!0},Object(r.createElement)(c.CheckboxControl,{id:t.value,className:"wc-block-checkbox-list__checkbox",label:t.label,checked:a.includes(t.value),onChange:()=>{n(t.value)}})),e&&o===d-1&&m)),e&&h)},[s,n,a,p,d,h,m,u]),v=i()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":l},t);return Object(r.createElement)("ul",{className:v},l?b:g)}},,,function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter by Attribute","description":"Allow customers to filter the grid by product attribute, such as color.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"color":{"text":true,"background":false}},"example":{"attributes":{"isPreview":true}},"attributes":{"className":{"type":"string","default":""},"attributeId":{"type":"number","default":0},"showCounts":{"type":"boolean","default":true},"queryType":{"type":"string","default":"or"},"headingLevel":{"type":"number","default":3},"displayStyle":{"type":"string","default":"list"},"showFilterButton":{"type":"boolean","default":false},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},function(e,t){e.exports=window.wp.blockEditor},,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(45),o=n(18);const s=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(o.a)(e)?e:{}},,,function(e,t,n){"use strict";n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return a})),n.d(t,"d",(function(){return l})),n.d(t,"c",(function(){return u}));var r=n(14),o=n(2),s=n(78);const i=Object(o.getSettingWithCoercion)("is_rendering_php_template",!1,s.a),c="query_type_",a="filter_";function l(e){return window?Object(r.getQueryArg)(window.location.href,e):null}function u(e){i?window.location.href=e:window.history.replaceState({},"",e)}},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(8),o=n(0),s=n(4),i=n.n(s);class c extends o.Component{constructor(){super(...arguments),this.onChange=this.onChange.bind(this),this.bindInput=this.bindInput.bind(this)}focus(){this.input.focus()}hasFocus(){return this.input===this.input.ownerDocument.activeElement}bindInput(e){this.input=e}onChange(e){this.props.onChange({value:e.target.value})}render(){const{value:e,isExpanded:t,instanceId:n,selectedSuggestionIndex:s,className:c,...a}=this.props,l=e?e.length+1:0;return Object(o.createElement)("input",Object(r.a)({ref:this.bindInput,id:"components-form-token-input-"+n,type:"text"},a,{value:e||"",onChange:this.onChange,size:l,className:i()(c,"components-form-token-field__input"),autoComplete:"off",role:"combobox","aria-expanded":t,"aria-autocomplete":"list","aria-owns":t?"components-form-token-suggestions-"+n:void 0,"aria-activedescendant":-1!==s?`components-form-token-suggestions-${n}-${s}`:void 0,"aria-describedby":"components-form-token-suggestions-howto-"+n}))}}t.a=c},function(e,t,n){"use strict";var r=n(0),o=n(3),s=n(146),i=n.n(s),c=n(4),a=n.n(c),l=n(10);class u extends r.Component{constructor(){super(...arguments),this.handleMouseDown=this.handleMouseDown.bind(this),this.bindList=this.bindList.bind(this)}componentDidUpdate(){this.props.selectedIndex>-1&&this.props.scrollIntoView&&this.list.children[this.props.selectedIndex]&&(this.scrollingIntoView=!0,i()(this.list.children[this.props.selectedIndex],this.list,{onlyScrollIfNeeded:!0}),this.props.setTimeout(()=>{this.scrollingIntoView=!1},100))}bindList(e){this.list=e}handleHover(e){return()=>{this.scrollingIntoView||this.props.onHover(e)}}handleClick(e){return()=>{this.props.onSelect(e)}}handleMouseDown(e){e.preventDefault()}computeSuggestionMatch(e){const t=this.props.displayTransform(this.props.match||"").toLocaleLowerCase();if(0===t.length)return null;const n=(e=this.props.displayTransform(e)).toLocaleLowerCase().indexOf(t);return{suggestionBeforeMatch:e.substring(0,n),suggestionMatch:e.substring(n,n+t.length),suggestionAfterMatch:e.substring(n+t.length)}}render(){return Object(r.createElement)("ul",{ref:this.bindList,className:"components-form-token-field__suggestions-list",id:"components-form-token-suggestions-"+this.props.instanceId,role:"listbox"},Object(o.map)(this.props.suggestions,(e,t)=>{const n=this.computeSuggestionMatch(e),o=a()("components-form-token-field__suggestion",{"is-selected":t===this.props.selectedIndex});return Object(r.createElement)("li",{id:`components-form-token-suggestions-${this.props.instanceId}-${t}`,role:"option",className:o,key:null!=e&&e.value?e.value:this.props.displayTransform(e),onMouseDown:this.handleMouseDown,onClick:this.handleClick(e),onMouseEnter:this.handleHover(e),"aria-selected":t===this.props.selectedIndex},n?Object(r.createElement)("span",{"aria-label":this.props.displayTransform(e)},n.suggestionBeforeMatch,Object(r.createElement)("strong",{className:"components-form-token-field__suggestion-match"},n.suggestionMatch),n.suggestionAfterMatch):this.props.displayTransform(e))}))}}u.defaultProps={match:"",onHover:()=>{},onSelect:()=>{},suggestions:Object.freeze([])},t.a=Object(l.withSafeTimeout)(u)},function(e,t,n){"use strict";e.exports=n(204)},function(e,t,n){"use strict";n.d(t,"a",(function(){return d}));var r=n(0),o=n(101),s=n(3),i=n(31),c=n(18),a=n(39),l=n(65),u=n(26);const d=e=>{let{queryAttribute:t,queryPrices:n,queryStock:d,queryState:p}=e,f=Object(u.a)();f+="-collection-data";const[b]=Object(a.a)(f),[m,h]=Object(a.b)("calculate_attribute_counts",[],f),[g,v]=Object(a.b)("calculate_price_range",null,f),[O,w]=Object(a.b)("calculate_stock_status_counts",null,f),j=Object(i.a)(t||{}),y=Object(i.a)(n),E=Object(i.a)(d);Object(r.useEffect)(()=>{"object"==typeof j&&Object.keys(j).length&&(m.find(e=>Object(c.b)(j,"taxonomy")&&e.taxonomy===j.taxonomy)||h([...m,j]))},[j,m,h]),Object(r.useEffect)(()=>{g!==y&&void 0!==y&&v(y)},[y,v,g]),Object(r.useEffect)(()=>{O!==E&&void 0!==E&&w(E)},[E,w,O]);const[k,_]=Object(r.useState)(!1),[S]=Object(o.a)(k,200);k||_(!0);const x=Object(r.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(s.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(b),[b]);return Object(l.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...p,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...x},shouldSelect:S})}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n(104);var r=n(48);const o=()=>r.m>1},,function(e,t,n){"use strict";var r=n(205);e.exports=function(e,t,n){n=n||{},9===t.nodeType&&(t=r.getWindow(t));var o=n.allowHorizontalScroll,s=n.onlyScrollIfNeeded,i=n.alignWithTop,c=n.alignWithLeft,a=n.offsetTop||0,l=n.offsetLeft||0,u=n.offsetBottom||0,d=n.offsetRight||0;o=void 0===o||o;var p=r.isWindow(t),f=r.offset(e),b=r.outerHeight(e),m=r.outerWidth(e),h=void 0,g=void 0,v=void 0,O=void 0,w=void 0,j=void 0,y=void 0,E=void 0,k=void 0,_=void 0;p?(y=t,_=r.height(y),k=r.width(y),E={left:r.scrollLeft(y),top:r.scrollTop(y)},w={left:f.left-E.left-l,top:f.top-E.top-a},j={left:f.left+m-(E.left+k)+d,top:f.top+b-(E.top+_)+u},O=E):(h=r.offset(t),g=t.clientHeight,v=t.clientWidth,O={left:t.scrollLeft,top:t.scrollTop},w={left:f.left-(h.left+(parseFloat(r.css(t,"borderLeftWidth"))||0))-l,top:f.top-(h.top+(parseFloat(r.css(t,"borderTopWidth"))||0))-a},j={left:f.left+m-(h.left+v+(parseFloat(r.css(t,"borderRightWidth"))||0))+d,top:f.top+b-(h.top+g+(parseFloat(r.css(t,"borderBottomWidth"))||0))+u}),w.top<0||j.top>0?!0===i?r.scrollTop(t,O.top+w.top):!1===i?r.scrollTop(t,O.top+j.top):w.top<0?r.scrollTop(t,O.top+w.top):r.scrollTop(t,O.top+j.top):s||((i=void 0===i||!!i)?r.scrollTop(t,O.top+w.top):r.scrollTop(t,O.top+j.top)),o&&(w.left<0||j.left>0?!0===c?r.scrollLeft(t,O.left+w.left):!1===c?r.scrollLeft(t,O.left+j.left):w.left<0?r.scrollLeft(t,O.left+w.left):r.scrollLeft(t,O.left+j.left):s||((c=void 0===c||!!c)?r.scrollLeft(t,O.left+w.left):r.scrollLeft(t,O.left+j.left)))}},function(e,t,n){"use strict";var r=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},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 s(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],r="scroll"+(t?"Top":"Left");if("number"!=typeof n){var o=e.document;"number"!=typeof(n=o.documentElement[r])&&(n=o.body[r])}return n}function i(e){return s(e)}function c(e){return s(e,!0)}function a(e){var t=function(e){var t,n=void 0,r=void 0,o=e.ownerDocument,s=o.body,i=o&&o.documentElement;return n=(t=e.getBoundingClientRect()).left,r=t.top,{left:n-=i.clientLeft||s.clientLeft||0,top:r-=i.clientTop||s.clientTop||0}}(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=i(r),t.top+=c(r),t}var l=new RegExp("^("+/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source+")(?!px)[a-z%]+$","i"),u=/^(top|right|bottom|left)$/,d="left",p=void 0;function f(e,t){for(var n=0;n<e.length;n++)t(e[n])}function b(e){return"border-box"===p(e,"boxSizing")}"undefined"!=typeof window&&(p=window.getComputedStyle?function(e,t,n){var r="",o=e.ownerDocument,s=n||o.defaultView.getComputedStyle(e,null);return s&&(r=s.getPropertyValue(t)||s[t]),r}:function(e,t){var n=e.currentStyle&&e.currentStyle[t];if(l.test(n)&&!u.test(t)){var r=e.style,o=r[d],s=e.runtimeStyle[d];e.runtimeStyle[d]=e.currentStyle[d],r[d]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[d]=o,e.runtimeStyle[d]=s}return""===n?"auto":n});var m=["margin","border","padding"];function h(e,t,n){var r={},o=e.style,s=void 0;for(s in t)t.hasOwnProperty(s)&&(r[s]=o[s],o[s]=t[s]);for(s in n.call(e),t)t.hasOwnProperty(s)&&(o[s]=r[s])}function g(e,t,n){var r=0,o=void 0,s=void 0,i=void 0;for(s=0;s<t.length;s++)if(o=t[s])for(i=0;i<n.length;i++){var c;c="border"===o?o+n[i]+"Width":o+n[i],r+=parseFloat(p(e,c))||0}return r}function v(e){return null!=e&&e==e.window}var O={};function w(e,t,n){if(v(e))return"width"===t?O.viewportWidth(e):O.viewportHeight(e);if(9===e.nodeType)return"width"===t?O.docWidth(e):O.docHeight(e);var r="width"===t?["Left","Right"]:["Top","Bottom"],o="width"===t?e.offsetWidth:e.offsetHeight,s=(p(e),b(e)),i=0;(null==o||o<=0)&&(o=void 0,(null==(i=p(e,t))||Number(i)<0)&&(i=e.style[t]||0),i=parseFloat(i)||0),void 0===n&&(n=s?1:-1);var c=void 0!==o||s,a=o||i;if(-1===n)return c?a-g(e,["border","padding"],r):i;if(c){var l=2===n?-g(e,["border"],r):g(e,["margin"],r);return a+(1===n?0:l)}return i+g(e,m.slice(n),r)}f(["Width","Height"],(function(e){O["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],O["viewport"+e](n))},O["viewport"+e]=function(t){var n="client"+e,r=t.document,o=r.body,s=r.documentElement[n];return"CSS1Compat"===r.compatMode&&s||o&&o[n]||s}}));var j={position:"absolute",visibility:"hidden",display:"block"};function y(e){var t=void 0,n=arguments;return 0!==e.offsetWidth?t=w.apply(void 0,n):h(e,j,(function(){t=w.apply(void 0,n)})),t}function E(e,t,n){var r=n;if("object"!==(void 0===t?"undefined":o(t)))return void 0!==r?("number"==typeof r&&(r+="px"),void(e.style[t]=r)):p(e,t);for(var s in t)t.hasOwnProperty(s)&&E(e,s,t[s])}f(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);O["outer"+t]=function(t,n){return t&&y(t,e,n?0:1)};var n="width"===e?["Left","Right"]:["Top","Bottom"];O[e]=function(t,r){return void 0===r?t&&y(t,e,-1):t?(p(t),b(t)&&(r+=g(t,["padding","border"],n)),E(t,e,r)):void 0}})),e.exports=r({getWindow:function(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},offset:function(e,t){if(void 0===t)return a(e);!function(e,t){"static"===E(e,"position")&&(e.style.position="relative");var n=a(e),r={},o=void 0,s=void 0;for(s in t)t.hasOwnProperty(s)&&(o=parseFloat(E(e,s))||0,r[s]=o+t[s]-n[s]);E(e,r)}(e,t)},isWindow:v,each:f,css:E,clone:function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);if(e.overflow)for(var n in e)e.hasOwnProperty(n)&&(t.overflow[n]=e.overflow[n]);return t},scrollLeft:function(e,t){if(v(e)){if(void 0===t)return i(e);window.scrollTo(t,c(e))}else{if(void 0===t)return e.scrollLeft;e.scrollLeft=t}},scrollTop:function(e,t){if(v(e)){if(void 0===t)return c(e);window.scrollTo(i(e),t)}else{if(void 0===t)return e.scrollTop;e.scrollTop=t}},viewportWidth:0,viewportHeight:0},O)},,,,,,,,,,,,,,,,,function(e,t,n){e.exports=n(243)},function(e,t){},function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return c}));var r=n(18);const o=e=>Object(r.b)(e,"count")&&Object(r.b)(e,"description")&&Object(r.b)(e,"id")&&Object(r.b)(e,"name")&&Object(r.b)(e,"parent")&&Object(r.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,s=e=>Array.isArray(e)&&e.every(o),i=e=>Object(r.b)(e,"attribute")&&Object(r.b)(e,"operator")&&Object(r.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),c=e=>Array.isArray(e)&&e.every(i)},function(e,t){},,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(52),o=n(0),s=n(1),i=n(255),c=n(31),a=n(61),l=n(39),u=n(65),d=n(147),p=n(113),f=n(54),b=n(75),m=n(76),h=n(11),g=n.n(h),v=n(17),O=n(77),w=n(2),j=n(14),y=n(78),E=n(45),k=n(18),_=n(224),S=n(106),x=n(13),T=Object(o.createElement)(x.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(o.createElement)(x.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),C=n(126),L=n(3),I=n(12),A=n.n(I),R=n(4),F=n.n(R),P=n(10),M=n(53),N=n(258),B=n(42),D=n(34);function V({value:e,status:t,title:n,displayTransform:r,isBorderless:i=!1,disabled:c=!1,onClickRemove:a=L.noop,onMouseEnter:l,onMouseLeave:u,messages:d,termPosition:p,termsCount:f}){const b=Object(P.useInstanceId)(V),m=F()("components-form-token-field__token",{"is-error":"error"===t,"is-success":"success"===t,"is-validating":"validating"===t,"is-borderless":i,"is-disabled":c}),h=r(e),g=Object(s.sprintf)(
12
  /* translators: 1: term name, 2: term position in a set of terms, 3: total term set count. */
13
- Object(s.__)("%1$s (%2$s of %3$s)"),h,p,f);return Object(o.createElement)("span",{className:m,onMouseEnter:l,onMouseLeave:u,title:n},Object(o.createElement)("span",{className:"components-form-token-field__token-text",id:"components-form-token-field__token-text-"+b},Object(o.createElement)(D.a,{as:"span"},g),Object(o.createElement)("span",{"aria-hidden":"true"},h)),Object(o.createElement)(B.a,{className:"components-form-token-field__remove-token",icon:N.a,onClick:!c&&(()=>a({value:e})),label:d.remove,"aria-describedby":"components-form-token-field__token-text-"+b}))}var W=n(144),H=n(145),q=n(8),z=n(23),K=Object(P.createHigherOrderComponent)(e=>t=>Object(o.createElement)(e,Object(q.a)({},t,{speak:z.speak,debouncedSpeak:Object(P.useDebounce)(z.speak,500)})),"withSpokenMessages");const U={incompleteTokenValue:"",inputOffsetFromEnd:0,isActive:!1,isExpanded:!1,selectedSuggestionIndex:-1,selectedSuggestionScroll:!1};class G extends o.Component{constructor(){super(...arguments),this.state=U,this.onKeyDown=this.onKeyDown.bind(this),this.onKeyPress=this.onKeyPress.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.deleteTokenBeforeInput=this.deleteTokenBeforeInput.bind(this),this.deleteTokenAfterInput=this.deleteTokenAfterInput.bind(this),this.addCurrentToken=this.addCurrentToken.bind(this),this.onContainerTouched=this.onContainerTouched.bind(this),this.renderToken=this.renderToken.bind(this),this.onTokenClickRemove=this.onTokenClickRemove.bind(this),this.onSuggestionHovered=this.onSuggestionHovered.bind(this),this.onSuggestionSelected=this.onSuggestionSelected.bind(this),this.onInputChange=this.onInputChange.bind(this),this.bindInput=this.bindInput.bind(this),this.bindTokensAndInput=this.bindTokensAndInput.bind(this),this.updateSuggestions=this.updateSuggestions.bind(this)}componentDidUpdate(e){this.state.isActive&&!this.input.hasFocus()&&this.input.focus();const{suggestions:t,value:n}=this.props,r=!g()(t,e.suggestions);(r||n!==e.value)&&this.updateSuggestions(r)}static getDerivedStateFromProps(e,t){return e.disabled&&t.isActive?{isActive:!1,incompleteTokenValue:""}:null}bindInput(e){this.input=e}bindTokensAndInput(e){this.tokensAndInput=e}onFocus(e){const{__experimentalExpandOnFocus:t}=this.props;this.input.hasFocus()||e.target===this.tokensAndInput?this.setState({isActive:!0,isExpanded:!!t||this.state.isExpanded}):this.setState({isActive:!1}),"function"==typeof this.props.onFocus&&this.props.onFocus(e)}onBlur(){this.inputHasValidValue()?this.setState({isActive:!1}):this.setState(U)}onKeyDown(e){let t=!1;switch(e.keyCode){case M.BACKSPACE:t=this.handleDeleteKey(this.deleteTokenBeforeInput);break;case M.ENTER:t=this.addCurrentToken();break;case M.LEFT:t=this.handleLeftArrowKey();break;case M.UP:t=this.handleUpArrowKey();break;case M.RIGHT:t=this.handleRightArrowKey();break;case M.DOWN:t=this.handleDownArrowKey();break;case M.DELETE:t=this.handleDeleteKey(this.deleteTokenAfterInput);break;case M.SPACE:this.props.tokenizeOnSpace&&(t=this.addCurrentToken());break;case M.ESCAPE:t=this.handleEscapeKey(e),e.stopPropagation()}t&&e.preventDefault()}onKeyPress(e){let t=!1;switch(e.charCode){case 44:t=this.handleCommaKey()}t&&e.preventDefault()}onContainerTouched(e){e.target===this.tokensAndInput&&this.state.isActive&&e.preventDefault()}onTokenClickRemove(e){this.deleteToken(e.value),this.input.focus()}onSuggestionHovered(e){const t=this.getMatchingSuggestions().indexOf(e);t>=0&&this.setState({selectedSuggestionIndex:t,selectedSuggestionScroll:!1})}onSuggestionSelected(e){this.addNewToken(e)}onInputChange(e){const t=e.value,n=this.props.tokenizeOnSpace?/[ ,\t]+/:/[,\t]+/,r=t.split(n),o=Object(L.last)(r)||"";r.length>1&&this.addNewTokens(r.slice(0,-1)),this.setState({incompleteTokenValue:o},this.updateSuggestions),this.props.onInputChange(o)}handleDeleteKey(e){let t=!1;return this.input.hasFocus()&&this.isInputEmpty()&&(e(),t=!0),t}handleLeftArrowKey(){let e=!1;return this.isInputEmpty()&&(this.moveInputBeforePreviousToken(),e=!0),e}handleRightArrowKey(){let e=!1;return this.isInputEmpty()&&(this.moveInputAfterNextToken(),e=!0),e}handleUpArrowKey(){return this.setState((e,t)=>({selectedSuggestionIndex:(0===e.selectedSuggestionIndex?this.getMatchingSuggestions(e.incompleteTokenValue,t.suggestions,t.value,t.maxSuggestions,t.saveTransform).length:e.selectedSuggestionIndex)-1,selectedSuggestionScroll:!0})),!0}handleDownArrowKey(){return this.setState((e,t)=>({selectedSuggestionIndex:(e.selectedSuggestionIndex+1)%this.getMatchingSuggestions(e.incompleteTokenValue,t.suggestions,t.value,t.maxSuggestions,t.saveTransform).length,selectedSuggestionScroll:!0})),!0}handleEscapeKey(e){return this.setState({incompleteTokenValue:e.target.value,isExpanded:!1,selectedSuggestionIndex:-1,selectedSuggestionScroll:!1}),!0}handleCommaKey(){return this.inputHasValidValue()&&this.addNewToken(this.state.incompleteTokenValue),!0}moveInputToIndex(e){this.setState((t,n)=>({inputOffsetFromEnd:n.value.length-Math.max(e,-1)-1}))}moveInputBeforePreviousToken(){this.setState((e,t)=>({inputOffsetFromEnd:Math.min(e.inputOffsetFromEnd+1,t.value.length)}))}moveInputAfterNextToken(){this.setState(e=>({inputOffsetFromEnd:Math.max(e.inputOffsetFromEnd-1,0)}))}deleteTokenBeforeInput(){const e=this.getIndexOfInput()-1;e>-1&&this.deleteToken(this.props.value[e])}deleteTokenAfterInput(){const e=this.getIndexOfInput();e<this.props.value.length&&(this.deleteToken(this.props.value[e]),this.moveInputToIndex(e))}addCurrentToken(){let e=!1;const t=this.getSelectedSuggestion();return t?(this.addNewToken(t),e=!0):this.inputHasValidValue()&&(this.addNewToken(this.state.incompleteTokenValue),e=!0),e}addNewTokens(e){const t=Object(L.uniq)(e.map(this.props.saveTransform).filter(Boolean).filter(e=>!this.valueContainsToken(e)));if(t.length>0){const e=Object(L.clone)(this.props.value);e.splice.apply(e,[this.getIndexOfInput(),0].concat(t)),this.props.onChange(e)}}addNewToken(e){const{__experimentalExpandOnFocus:t,__experimentalValidateInput:n}=this.props;n(e)?(this.addNewTokens([e]),this.props.speak(this.props.messages.added,"assertive"),this.setState({incompleteTokenValue:"",selectedSuggestionIndex:-1,selectedSuggestionScroll:!1,isExpanded:!t}),this.state.isActive&&this.input.focus()):this.props.speak(this.props.messages.__experimentalInvalid,"assertive")}deleteToken(e){const t=this.props.value.filter(t=>this.getTokenValue(t)!==this.getTokenValue(e));this.props.onChange(t),this.props.speak(this.props.messages.removed,"assertive")}getTokenValue(e){return"object"==typeof e?e.value:e}getMatchingSuggestions(e=this.state.incompleteTokenValue,t=this.props.suggestions,n=this.props.value,r=this.props.maxSuggestions,o=this.props.saveTransform){let s=o(e);const i=[],c=[];return 0===s.length?t=Object(L.difference)(t,n):(s=s.toLocaleLowerCase(),Object(L.each)(t,e=>{const t=e.toLocaleLowerCase().indexOf(s);-1===n.indexOf(e)&&(0===t?i.push(e):t>0&&c.push(e))}),t=i.concat(c)),Object(L.take)(t,r)}getSelectedSuggestion(){if(-1!==this.state.selectedSuggestionIndex)return this.getMatchingSuggestions()[this.state.selectedSuggestionIndex]}valueContainsToken(e){return Object(L.some)(this.props.value,t=>this.getTokenValue(e)===this.getTokenValue(t))}getIndexOfInput(){return this.props.value.length-this.state.inputOffsetFromEnd}isInputEmpty(){return 0===this.state.incompleteTokenValue.length}inputHasValidValue(){return this.props.saveTransform(this.state.incompleteTokenValue).length>0}updateSuggestions(e=!0){const{__experimentalExpandOnFocus:t}=this.props,{incompleteTokenValue:n}=this.state,r=n.trim().length>1,o=this.getMatchingSuggestions(n),i=o.length>0,c={isExpanded:t||r&&i};if(e&&(c.selectedSuggestionIndex=-1,c.selectedSuggestionScroll=!1),this.setState(c),r){const{debouncedSpeak:e}=this.props;e(i?Object(s.sprintf)(
14
  /* translators: %d: number of results. */
15
- Object(s._n)("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",o.length),o.length):Object(s.__)("No results."),"assertive")}}renderTokensAndInput(){const e=Object(L.map)(this.props.value,this.renderToken);return e.splice(this.getIndexOfInput(),0,this.renderInput()),e}renderToken(e,t,n){const r=this.getTokenValue(e),s=e.status?e.status:void 0,i=t+1,c=n.length;return Object(o.createElement)(V,{key:"token-"+r,value:r,status:s,title:e.title,displayTransform:this.props.displayTransform,onClickRemove:this.onTokenClickRemove,isBorderless:e.isBorderless||this.props.isBorderless,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,disabled:"error"!==s&&this.props.disabled,messages:this.props.messages,termsCount:c,termPosition:i})}renderInput(){const{autoCapitalize:e,autoComplete:t,maxLength:n,placeholder:r,value:s,instanceId:i}=this.props;let c={instanceId:i,autoCapitalize:e,autoComplete:t,placeholder:0===s.length?r:"",ref:this.bindInput,key:"input",disabled:this.props.disabled,value:this.state.incompleteTokenValue,onBlur:this.onBlur,isExpanded:this.state.isExpanded,selectedSuggestionIndex:this.state.selectedSuggestionIndex};return n&&s.length>=n||(c={...c,onChange:this.onInputChange}),Object(o.createElement)(W.a,c)}render(){const{disabled:e,label:t=Object(s.__)("Add item"),instanceId:n,className:r,__experimentalShowHowTo:i}=this.props,{isExpanded:c}=this.state,a=F()(r,"components-form-token-field__input-container",{"is-active":this.state.isActive,"is-disabled":e});let l={className:"components-form-token-field",tabIndex:"-1"};const u=this.getMatchingSuggestions();return e||(l=Object.assign({},l,{onKeyDown:this.onKeyDown,onKeyPress:this.onKeyPress,onFocus:this.onFocus})),Object(o.createElement)("div",l,Object(o.createElement)("label",{htmlFor:"components-form-token-input-"+n,className:"components-form-token-field__label"},t),Object(o.createElement)("div",{ref:this.bindTokensAndInput,className:a,tabIndex:"-1",onMouseDown:this.onContainerTouched,onTouchStart:this.onContainerTouched},this.renderTokensAndInput(),c&&Object(o.createElement)(H.a,{instanceId:n,match:this.props.saveTransform(this.state.incompleteTokenValue),displayTransform:this.props.displayTransform,suggestions:u,selectedIndex:this.state.selectedSuggestionIndex,scrollIntoView:this.state.selectedSuggestionScroll,onHover:this.onSuggestionHovered,onSelect:this.onSuggestionSelected})),i&&Object(o.createElement)("p",{id:"components-form-token-suggestions-howto-"+n,className:"components-form-token-field__help"},this.props.tokenizeOnSpace?Object(s.__)("Separate with commas, spaces, or the Enter key."):Object(s.__)("Separate with commas or the Enter key.")))}}G.defaultProps={suggestions:Object.freeze([]),maxSuggestions:100,value:Object.freeze([]),displayTransform:L.identity,saveTransform:e=>e.trim(),onChange:()=>{},onInputChange:()=>{},isBorderless:!1,disabled:!1,tokenizeOnSpace:!1,messages:{added:Object(s.__)("Item added."),removed:Object(s.__)("Item removed."),remove:Object(s.__)("Remove item"),__experimentalInvalid:Object(s.__)("Invalid item")},__experimentalExpandOnFocus:!1,__experimentalValidateInput:()=>!0,__experimentalShowHowTo:!0};var $=K(Object(P.withInstanceId)(G));n(225);var Q=e=>{let{className:t,style:n,suggestions:r,multiple:s=!0,saveTransform:i=(e=>e.trim().replace(/\s/g,"-")),messages:c={},validateInput:a=(e=>r.includes(e)),label:l="",...u}=e;return Object(o.createElement)("div",{className:F()("wc-blocks-components-form-token-field-wrapper",t,{"single-selection":!s}),style:n},Object(o.createElement)($,A()({label:l,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:a,saveTransform:i,maxLength:s?void 0:1,suggestions:r,messages:c},u)))},Y=n(112),J=n(102);const X=[{value:"preview-1",formattedValue:"preview-1",name:"Blue",label:Object(o.createElement)(f.a,{name:"Blue",count:3}),textLabel:"Blue (3)"},{value:"preview-2",formattedValue:"preview-2",name:"Green",label:Object(o.createElement)(f.a,{name:"Green",count:3}),textLabel:"Green (3)"},{value:"preview-3",formattedValue:"preview-3",name:"Red",label:Object(o.createElement)(f.a,{name:"Red",count:2}),textLabel:"Red (2)"}],Z={id:0,name:"preview",taxonomy:"preview",label:"Preview"};function ee(){return Math.floor(Math.random()*Date.now())}n(223);const te=e=>e.replace("pa_",""),ne=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:r,operator:o}=e,s=te(t),i=r.join(","),c=`${C.b}${s}`,a="in"===o?"or":"and";n[`${C.a}${s}`]=i,n[c]=a});const r=Object(j.removeQueryArgs)(e,...Object.keys(n));return Object(j.addQueryArgs)(r,n)},re=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,r]=t;return n.includes("query_type")?e:{...e,[n]:r}},{});return Object.entries(n).reduce((t,n)=>{let[r,o]=n;return e[r]===o&&t},!0)},oe=e=>e.trim().replace(/\s/g,"-").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,"");const se={heading:{type:"string",default:Object(s.__)("Filter by attribute","woo-gutenberg-products-block")}};var ie=n(116);Object(r.a)({selector:".wp-block-woocommerce-attribute-filter",Block:e=>{let{attributes:t,isEditor:n=!1}=e;const r=Object(w.getSettingWithCoercion)("has_filterable_products",!1,y.a),h=Object(w.getSettingWithCoercion)("is_rendering_php_template",!1,y.a),x=Object(w.getSettingWithCoercion)("page_url",window.location.href,E.a),[I,A]=Object(o.useState)(!1),R=t.isPreview&&!t.attributeId?Z:Object(Y.a)(t.attributeId),P=Object(o.useMemo)(()=>(e=>{if(e){const t=Object(C.d)("filter_"+e.name);return"string"==typeof t?t.split(","):[]}return[]})(R),[R]),[M,N]=Object(o.useState)(P),[B,D]=Object(o.useState)(ee()),[V,W]=Object(o.useState)(t.isPreview&&!t.attributeId?X:[]),H=Object(i.a)(t),[q]=Object(l.a)(),[z,K]=Object(l.b)("attributes",[]),{results:U,isLoading:G}=Object(u.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==R?void 0:R.id)||0],shouldSelect:t.attributeId>0}),$="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:se,isLoading:ie}=Object(d.a)({queryAttribute:{taxonomy:(null==R?void 0:R.taxonomy)||"",queryType:t.queryType},queryState:{...q,attributes:$?q.attributes:null}}),ce=Object(o.useCallback)(e=>Object(k.b)(se,"attribute_counts")&&Array.isArray(se.attribute_counts)?se.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[se]);Object(o.useEffect)(()=>{if(G||ie)return;if(!Array.isArray(U))return;const e=U.map(e=>{const n=ce(e.id);if(!(n||M.includes(e.slug)||(r=e.slug,null!=q&&q.attributes&&q.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==R?void 0:R.taxonomy)&&n.includes(r)}))))return null;var r;const s=n?n.count:0;return{formattedValue:oe(e.slug),value:e.slug,name:Object(v.decodeEntities)(e.name),label:Object(o.createElement)(f.a,{name:Object(v.decodeEntities)(e.name),count:t.showCounts?s:null}),textLabel:t.showCounts?`${Object(v.decodeEntities)(e.name)} (${s})`:Object(v.decodeEntities)(e.name)}}).filter(e=>!!e);W(e)},[null==R?void 0:R.taxonomy,U,G,t.showCounts,ie,ce,M,q.attributes]);const ae=Object(o.useCallback)(e=>Array.isArray(U)?U.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[U]),le=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(null==R||!R.taxonomy)return;const t=Object.keys(Object(j.getQueryArgs)(window.location.href)),n=te(R.taxonomy),r=t.reduce((e,t)=>t.includes(C.b+n)||t.includes(C.a+n)?Object(j.removeQueryArgs)(e,t):e,window.location.href),o=ne(r,e);Object(C.c)(o)}else{const t=ne(x,e),n=Object(j.getQueryArgs)(window.location.href),r=Object(j.getQueryArgs)(t);re(n,r)||Object(C.c)(t)}}),[x,null==R?void 0:R.taxonomy]),ue=e=>{const n=Object(J.b)(z,K,R,ae(e),"or"===t.queryType?"in":"and");le(n,0===e.length)},de=Object(o.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||(N(e),!r&&t.showFilterButton||Object(J.b)(z,K,R,ae(e),"or"===t.queryType?"in":"and"))}),[n,N,z,K,R,ae,t.queryType,t.showFilterButton]),pe=Object(o.useMemo)(()=>Object(_.a)(z)?z.filter(e=>{let{attribute:t}=e;return t===(null==R?void 0:R.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[z,null==R?void 0:R.taxonomy]),fe=Object(c.a)(pe),be=Object(a.a)(fe);Object(o.useEffect)(()=>{!be||g()(be,fe)||g()(M,fe)||de(fe)},[M,fe,be,de]);const me="single"!==t.selectType,he=Object(o.useCallback)(e=>{const t=M.includes(e);let n;me?(n=M.filter(t=>t!==e),t||(n.push(e),n.sort())):n=t?[]:[e],de(n)},[M,me,de]);if(Object(o.useEffect)(()=>{R&&!t.showFilterButton&&((e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length})({currentCheckedFilters:M,hasSetFilterDefaultsFromUrl:I})?le(z,!0):le(z,!1))},[I,le,z,R,M,t.showFilterButton]),Object(o.useEffect)(()=>{if(!I&&!G)return P.length>0?(A(!0),void de(P,!0)):void(h||A(!0))},[R,I,G,de,P,h]),!r)return null;if(!R)return n?Object(o.createElement)(O.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(s.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):null;if(0===V.length&&!G)return n?Object(o.createElement)(O.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(s.__)("The selected attribute does not have any term assigned to products.","woo-gutenberg-products-block"))):null;const ge="h"+t.headingLevel,ve=!t.isPreview&&G,Oe=!t.isPreview&&ie;return Object(o.createElement)(o.Fragment,null,!n&&t.heading&&V.length>0&&Object(o.createElement)(ge,{className:"wc-block-attribute-filter__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-attribute-filter style-"+t.displayStyle},"dropdown"===t.displayStyle?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(Q,{key:B,className:F()(H.className,{"single-selection":!me}),style:{...H.style,borderStyle:"none"},suggestions:V.filter(e=>!M.includes(e.value)).map(e=>e.formattedValue),disabled:Oe,placeholder:Object(s.sprintf)(
16
  /* translators: %s attribute name. */
17
- Object(s.__)("Select %s","woo-gutenberg-products-block"),R.label),onChange:e=>{!me&&e.length>1&&(e=[e[e.length-1]]),e=e.map(e=>{const t=V.find(t=>t.formattedValue===e);return t?t.value:e});const t=Object(L.difference)(e,M);if(1===t.length)return he(t[0]);const n=Object(L.difference)(M,e);1===n.length&&he(n[0])},value:M,displayTransform:e=>{const t=V.find(t=>[t.value,t.formattedValue].includes(e));return t?t.textLabel:e},saveTransform:oe,messages:{added:Object(s.sprintf)(
18
  /* translators: %s is the attribute label. */
19
- Object(s.__)("%s filter added.","woo-gutenberg-products-block"),R.label),removed:Object(s.sprintf)(
20
  /* translators: %s is the attribute label. */
21
- Object(s.__)("%s filter removed.","woo-gutenberg-products-block"),R.label),remove:Object(s.sprintf)(
22
  /* translators: %s is the attribute label. */
23
- Object(s.__)("Remove %s filter.","woo-gutenberg-products-block"),R.label.toLocaleLowerCase()),__experimentalInvalid:Object(s.sprintf)(
24
  /* translators: %s is the attribute label. */
25
- Object(s.__)("Invalid %s filter.","woo-gutenberg-products-block"),R.label.toLocaleLowerCase())}}),me&&Object(o.createElement)(S.a,{icon:T,size:30})):Object(o.createElement)(p.a,{className:"wc-block-attribute-filter-list",options:V,checked:M,onChange:he,isLoading:ve,isDisabled:Oe})),Object(o.createElement)("div",{className:"wc-block-attribute-filter__actions"},M.length>0&&Object(o.createElement)(b.a,{onClick:()=>{N([]),D(ee()),I&&ue([])},screenReaderLabel:Object(s.__)("Reset attribute filter","woo-gutenberg-products-block")}),t.showFilterButton&&Object(o.createElement)(m.a,{className:"wc-block-attribute-filter__button",disabled:ve||Oe||0===M.length,onClick:()=>ue(M)})))},getProps:e=>({isEditor:!1,attributes:{attributeId:parseInt(e.dataset.attributeId||"0",10),showCounts:"true"===e.dataset.showCounts,queryType:e.dataset.queryType||ie.attributes.queryType.default,heading:e.dataset.heading||se.heading.default,headingLevel:e.dataset.headingLevel?parseInt(e.dataset.headingLevel,10):ie.attributes.headingLevel.default,displayStyle:e.dataset.displayStyle||ie.attributes.displayStyle.default,showFilterButton:"true"===e.dataset.showFilterButton,selectType:e.dataset.selectType||ie.attributes.selectType.default}})})},,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(117),o=n(202),s=n(18),i=n(123);const c=e=>{if(!Object(o.a)())return{className:"",style:{}};const t=Object(s.a)(e)?e:{},n=Object(i.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:n})}},,,function(e,t,n){"use strict";var r=n(0),o=n(13);const s=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=s}]);
1
+ !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=224)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.lodash},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var s=typeof r;if("string"===s||"number"===s)e.push(r);else if(Array.isArray(r)){if(r.length){var i=o.apply(null,r);i&&e.push(i)}}else if("object"===s)if(r.toString===Object.prototype.toString)for(var c in r)n.call(r,c)&&r[c]&&e.push(c);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},function(e,t){e.exports=window.React},function(e,t){e.exports=window.wc.wcBlocksData},function(e,t){e.exports=window.wp.data},function(e,t,n){"use strict";function r(){return(r=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}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},function(e,t){e.exports=window.wc.blocksCheckout},function(e,t){e.exports=window.wp.compose},function(e,t){e.exports=window.wp.isShallowEqual},function(e,t){function n(){return e.exports=n=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},e.exports.__esModule=!0,e.exports.default=e.exports,n.apply(this,arguments)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=window.wp.primitives},function(e,t){e.exports=window.wp.url},function(e,t,n){"use strict";var r=n(19),o=n.n(r),s=n(0),i=n(5),c=n(1),a=n(48),l=e=>{let{imageUrl:t=a.l+"/block-error.svg",header:n=Object(c.__)("Oops!","woo-gutenberg-products-block"),text:r=Object(c.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:i=Object(c.__)("Error:","woo-gutenberg-products-block"),button:l,showErrorBlock:u=!0}=e;return u?Object(s.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(s.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(s.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},n&&Object(s.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},n),r&&Object(s.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},r),o&&Object(s.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},i?i+" ":"",o),l&&Object(s.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};n(35);class u extends i.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(s.createElement)(s.Fragment,null,Object(s.createElement)("strong",null,e.status),": ",e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{header:e,imageUrl:t,showErrorMessage:n=!0,showErrorBlock:r=!0,text:o,errorMessagePrefix:i,renderError:c,button:a}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof c?c({errorMessage:u}):Object(s.createElement)(l,{showErrorBlock:r,errorMessage:n?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:i,button:a}):this.props.children}}t.a=u},,function(e,t){e.exports=window.wp.htmlEntities},function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,n){"use strict";var r=n(0),o=n(4),s=n.n(o);t.a=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:i,wrapperProps:c={}}=e;const a=null!=n,l=null!=o;return!a&&l?(t=i||"span",c={...c,className:s()(c.className,"screen-reader-text")},Object(r.createElement)(t,c,o)):(t=i||r.Fragment,a&&l&&n!==o?Object(r.createElement)(t,c,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,c,n))}},,,function(e,t){e.exports=window.wp.a11y},function(e,t,n){"use strict";(function(e){var r=n(0);n(37);const o=Object(r.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,n(55))},function(e,t){e.exports=window.wp.deprecated},function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(0);const o=Object(r.createContext)("page"),s=()=>Object(r.useContext)(o);o.Provider},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0),o=n(11),s=n.n(o);function i(e){const t=Object(r.useRef)(e);return s()(e,t.current)||(t.current=e),t.current}},,,function(e,t,n){"use strict";var r=n(4),o=n.n(r),s=n(0);t.a=Object(s.forwardRef)((function({as:e="div",className:t,...n},r){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(s.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...n,ref:r})}))},function(e,t){},,function(e,t){e.exports=window.wp.warning},function(e,t,n){"use strict";var r=n(8),o=n(0),s=n(13),i=function({icon:e,className:t,...n}){const s=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(r.a)({className:s},n))};t.a=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return Object(o.createElement)(i,Object(r.a)({icon:e},n));if(Object(o.isValidElement)(e)&&i===e.type)return Object(o.cloneElement)(e,{...n});if("function"==typeof e)return e.prototype instanceof o.Component?Object(o.createElement)(e,{size:t,...n}):e({size:t,...n});if(e&&("svg"===e.type||e.type===s.SVG)){const r={width:t,height:t,...e.props,...n};return Object(o.createElement)(s.SVG,r)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...n}):e}},function(e,t,n){"use strict";n.d(t,"a",(function(){return d})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return f}));var r=n(6),o=n(7),s=n(0),i=n(11),c=n.n(i),a=n(31),l=n(61),u=n(26);const d=e=>{const t=Object(u.a)();e=e||t;const n=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:i}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(s.useCallback)(t=>{i(e,t)},[e,i])]},p=(e,t,n)=>{const i=Object(u.a)();n=n||i;const c=Object(o.useSelect)(o=>o(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:a}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[c,Object(s.useCallback)(t=>{a(n,e,t)},[n,e,a])]},f=(e,t)=>{const n=Object(u.a)();t=t||n;const[r,o]=d(t),i=Object(a.a)(r),p=Object(a.a)(e),f=Object(l.a)(p),b=Object(s.useRef)(!1);return Object(s.useEffect)(()=>{c()(f,p)||(o(Object.assign({},i,p)),b.current=!0)},[i,p,f,o]),b.current?[r,o]:[e,o]}},,,function(e,t,n){"use strict";var r=n(8),o=n(0),s=n(4),i=n.n(s),c=n(3),a=n(25),l=n.n(a),u=n(10),d=n(44),p=n(72),f=n(1);function b(e,t,n){const{defaultView:r}=t,{frameElement:o}=r;if(!o||t===n.ownerDocument)return e;const s=o.getBoundingClientRect();return new r.DOMRect(e.left+s.left,e.top+s.top,e.width,e.height)}let m=0;function h(e){const t=document.scrollingElement||document.body;e&&(m=t.scrollTop);const n=e?"add":"remove";t.classList[n]("lockscroll"),document.documentElement.classList[n]("lockscroll"),e||(t.scrollTop=m)}let g=0;function v(){return Object(o.useEffect)(()=>(0===g&&h(!0),++g,()=>{1===g&&h(!1),--g}),[]),null}var O=n(24);function w(e){const t=Object(o.useContext)(O.a),n=t.slots[e]||{},r=t.fills[e],s=Object(o.useMemo)(()=>r||[],[r]);return{...n,updateSlot:Object(o.useCallback)(n=>{t.updateSlot(e,n)},[e,t.updateSlot]),unregisterSlot:Object(o.useCallback)(n=>{t.unregisterSlot(e,n)},[e,t.unregisterSlot]),fills:s,registerFill:Object(o.useCallback)(n=>{t.registerFill(e,n)},[e,t.registerFill]),unregisterFill:Object(o.useCallback)(n=>{t.unregisterFill(e,n)},[e,t.unregisterFill])}}var j=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function y({name:e,children:t,registerFill:n,unregisterFill:r}){const s=(e=>{const{getSlot:t,subscribe:n}=Object(o.useContext)(j),[r,s]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(s(t(e)),n(()=>{s(t(e))})),[e]),r})(e),i=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(n(e,i.current),()=>r(e,i.current)),[]),Object(o.useLayoutEffect)(()=>{i.current.children=t,s&&s.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==i.current.name&&(r(i.current.name,i.current),i.current.name=e,n(e,i.current))},[e]),s&&s.node?(Object(c.isFunction)(t)&&(t=t(s.props.fillProps)),Object(o.createPortal)(t,s.node)):null}var E=e=>Object(o.createElement)(j.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(o.createElement)(y,Object(r.a)({},e,{registerFill:t,unregisterFill:n})));class k extends o.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:n,registerSlot:r}=this.props;e.name!==t&&(n(e.name),r(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:n={},getFills:r}=this.props,s=Object(c.map)(r(t,this),e=>{const t=Object(c.isFunction)(e.children)?e.children(n):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(c.isString)(e))return e;const n=e.key||t;return Object(o.cloneElement)(e,{key:n})})}).filter(Object(c.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(c.isFunction)(e)?e(s):s)}}var _=e=>Object(o.createElement)(j.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:s})=>Object(o.createElement)(k,Object(r.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:s})));function S(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function x({name:e,children:t}){const n=w(e),r=Object(o.useRef)({rerender:S()});return Object(o.useEffect)(()=>(n.registerFill(r),()=>{n.unregisterFill(r)}),[n.registerFill,n.unregisterFill]),n.ref&&n.ref.current?("function"==typeof t&&(t=t(n.fillProps)),Object(o.createPortal)(t,n.ref.current)):null}var T=Object(o.forwardRef)((function({name:e,fillProps:t={},as:n="div",...s},i){const c=Object(o.useContext)(O.a),a=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(c.registerSlot(e,a,t),()=>{c.unregisterSlot(e,a)}),[c.registerSlot,c.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{c.updateSlot(e,t)}),Object(o.createElement)(n,Object(r.a)({ref:Object(u.useMergeRefs)([i,a])},s))}));function C(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(E,e),Object(o.createElement)(x,e))}n(11),o.Component;const L=Object(o.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(o.createElement)(T,Object(r.a)({},t,{ref:n})):Object(o.createElement)(_,t));function I(e){return"appear"===e?"top":"left"}function A(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:s}=(i=t).ownerDocument.defaultView.getComputedStyle(i);var i;const c=n?parseInt(n,10):0,a=r?parseInt(r,10):0,l=o?parseInt(o,10):0,u=s?parseInt(s,10):0;return{x:e.left+l,y:e.top+c,width:e.width-l-u,height:e.height-c-a,left:e.left+l,right:e.right-u,top:e.top+c,bottom:e.bottom-a}}function R(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function F(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function P(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const N=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:n,className:s,noArrow:c=!0,isAlternate:a,position:m="bottom right",range:h,focusOnMount:g="firstElement",anchorRef:O,shouldAnchorIncludePadding:j,anchorRect:y,getAnchorRect:E,expandOnMobile:k,animate:_=!0,onClickOutside:S,onFocusOutside:x,__unstableStickyBoundaryElement:T,__unstableSlotName:L="Popover",__unstableObserveElement:N,__unstableBoundaryParent:M,__unstableForcePosition:B,__unstableForceXAlignment:D,...V},W)=>{const H=Object(o.useRef)(null),q=Object(o.useRef)(null),z=Object(o.useRef)(),K=Object(u.useViewportMatch)("medium","<"),[U,$]=Object(o.useState)(),Q=w(L),Y=k&&K,[J,X]=Object(u.useResizeObserver)();c=Y||c,Object(o.useLayoutEffect)(()=>{if(Y)return P(z.current,"is-without-arrow",c),P(z.current,"is-alternate",a),R(z.current,"data-x-axis"),R(z.current,"data-y-axis"),F(z.current,"top"),F(z.current,"left"),F(q.current,"maxHeight"),void F(q.current,"maxWidth");const e=()=>{if(!z.current||!q.current)return;let e=function(e,t,n,r=!1,o,s){if(t)return t;if(n){if(!e.current)return;const t=n(e.current);return b(t,t.ownerDocument||e.current.ownerDocument,s)}if(!1!==r){if(!(r&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==r?void 0:r.cloneRange))return b(Object(d.getRectangleFromRange)(r),r.endContainer.ownerDocument,s);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=b(r.getBoundingClientRect(),r.ownerDocument,s);return o?e:A(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),i=t.getBoundingClientRect(),c=b(new window.DOMRect(n.left,n.top,n.width,i.bottom-n.top),e.ownerDocument,s);return o?c:A(c,r)}if(!e.current)return;const{parentNode:i}=e.current,c=i.getBoundingClientRect();return o?c:A(c,i)}(H,y,E,O,j,z.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=z.current;let r,o=0;if(t&&t!==n.body){const n=t.getBoundingClientRect();o=n.top,e=new window.DOMRect(e.left-n.left,e.top-n.top,e.width,e.height)}var s;M&&(r=null===(s=z.current.closest(".popover-slot"))||void 0===s?void 0:s.parentNode);const i=X.height?X:q.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:p,yAxis:h,contentHeight:g,contentWidth:v}=function(e,t,n="top",r,o,s,i,c,a){const[l,u="center",d]=n.split(" "),p=function(e,t,n,r,o,s,i,c){const{height:a}=t;if(o){const t=o.getBoundingClientRect().top+a-i;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===r?l=e.bottom:"top"===r&&(l=e.top);const u={popoverTop:l,contentHeight:(l-a/2>0?a/2:l)+(l+a/2>window.innerHeight?window.innerHeight-l:a/2)},d={popoverTop:e.top,contentHeight:e.top-10-a>0?a:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+a>window.innerHeight?window.innerHeight-10-e.bottom:a};let f,b=n,m=null;if(!o&&!c)if("middle"===n&&u.contentHeight===a)b="middle";else if("top"===n&&d.contentHeight===a)b="top";else if("bottom"===n&&p.contentHeight===a)b="bottom";else{b=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===b?d.contentHeight:p.contentHeight;m=e!==a?e:null}return f="middle"===b?u.popoverTop:"top"===b?d.popoverTop:p.popoverTop,{yAxis:b,popoverTop:f,contentHeight:m}}(e,t,l,d,r,0,s,c);return{...function(e,t,n,r,o,s,i,c,a){const{width:l}=t;"left"===n&&Object(f.isRTL)()?n="right":"right"===n&&Object(f.isRTL)()&&(n="left"),"left"===r&&Object(f.isRTL)()?r="right":"right"===r&&Object(f.isRTL)()&&(r="left");const u=Math.round(e.left+e.width/2),d={popoverLeft:u,contentWidth:(u-l/2>0?l/2:u)+(u+l/2>window.innerWidth?window.innerWidth-u:l/2)};let p=e.left;"right"===r?p=e.right:"middle"===s||a||(p=u);let b=e.right;"left"===r?b=e.left:"middle"===s||a||(b=u);const m={popoverLeft:p,contentWidth:p-l>0?l:p},h={popoverLeft:b,contentWidth:b+l>window.innerWidth?window.innerWidth-b:l};let g,v=n,O=null;if(!o&&!c)if("center"===n&&d.contentWidth===l)v="center";else if("left"===n&&m.contentWidth===l)v="left";else if("right"===n&&h.contentWidth===l)v="right";else{v=m.contentWidth>h.contentWidth?"left":"right";const e="left"===v?m.contentWidth:h.contentWidth;l>window.innerWidth&&(O=window.innerWidth),e!==l&&(v="center",d.popoverLeft=window.innerWidth/2)}if(g="center"===v?d.popoverLeft:"left"===v?m.popoverLeft:h.popoverLeft,i){const e=i.getBoundingClientRect();g=Math.min(g,e.right-l),Object(f.isRTL)()||(g=Math.max(g,0))}return{xAxis:v,popoverLeft:g,contentWidth:O}}(e,t,u,d,r,p.yAxis,i,c,a),...p}}(e,i,m,T,z.current,o,r,B,D);"number"==typeof l&&"number"==typeof u&&(F(z.current,"top",l+"px"),F(z.current,"left",u+"px")),P(z.current,"is-without-arrow",c||"center"===p&&"middle"===h),P(z.current,"is-alternate",a),R(z.current,"data-x-axis",p),R(z.current,"data-y-axis",h),F(q.current,"maxHeight","number"==typeof g?g+"px":""),F(q.current,"maxWidth","number"==typeof v?v+"px":""),$(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[h]||"middle"))};e();const{ownerDocument:t}=z.current,{defaultView:n}=t,r=n.setInterval(e,500);let o;const s=()=>{n.cancelAnimationFrame(o),o=n.requestAnimationFrame(e)};n.addEventListener("click",s),n.addEventListener("resize",e),n.addEventListener("scroll",e,!0);const i=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(O);let l;return i&&i!==t&&(i.defaultView.addEventListener("resize",e),i.defaultView.addEventListener("scroll",e,!0)),N&&(l=new n.MutationObserver(e),l.observe(N,{attributes:!0})),()=>{n.clearInterval(r),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",s),n.cancelAnimationFrame(o),i&&i!==t&&(i.defaultView.removeEventListener("resize",e),i.defaultView.removeEventListener("scroll",e,!0)),l&&l.disconnect()}},[Y,y,E,O,j,m,X,T,N,M]);const Z=(e,n)=>{if("focus-outside"===e&&x)x(n);else if("focus-outside"===e&&S){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),S(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:g,__unstableOnClose:Z,onClose:Z}),ne=Object(u.useMergeRefs)([z,ee,W]),re=Boolean(_&&U)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:n=I(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+n):void 0}({type:"appear",origin:U});let oe=Object(o.createElement)("div",Object(r.a)({className:i()("components-popover",s,re,{"is-expanded":Y,"is-without-arrow":c,"is-alternate":a})},V,{ref:ne},te,{tabIndex:"-1"}),Y&&Object(o.createElement)(v,null),Y&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(G,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:q,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},J,n)));return Q.ref&&(oe=Object(o.createElement)(C,{name:L},oe)),O||y?oe:Object(o.createElement)("span",{ref:H},oe)});N.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(L,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var M=N,B=function({shortcut:e,className:t}){if(!e)return null;let n,r;return Object(c.isString)(e)&&(n=e),Object(c.isObject)(e)&&(n=e.display,r=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":r},n)};const D=Object(o.createElement)("div",{className:"event-catcher"}),V=({eventHandlers:e,child:t,childrenWithPopover:n})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(D,e),Object(o.cloneElement)(t,{children:n}),","),e),W=({child:e,eventHandlers:t,childrenWithPopover:n})=>Object(o.cloneElement)(e,{...t,children:n}),H=(e,t,n)=>{if(1!==o.Children.count(e))return;const r=o.Children.only(e);"function"==typeof r.props[t]&&r.props[t](n)};var q=function({children:e,position:t,text:n,shortcut:r}){const[s,i]=Object(o.useState)(!1),[a,l]=Object(o.useState)(!1),d=Object(u.useDebounce)(l,700),p=t=>{H(e,"onMouseDown",t),document.addEventListener("mouseup",m),i(!0)},f=t=>{H(e,"onMouseUp",t),document.removeEventListener("mouseup",m),i(!1)},b=e=>"mouseUp"===e?f:"mouseDown"===e?p:void 0,m=b("mouseUp"),h=(t,n)=>r=>{if(H(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&s)return;d.cancel();const o=Object(c.includes)(["focus","mouseenter"],r.type);o!==a&&(n?d(o):l(o))},g=()=>{d.cancel(),document.removeEventListener("mouseup",m)};if(Object(o.useEffect)(()=>g,[]),1!==o.Children.count(e))return e;const v={onMouseEnter:h("onMouseEnter",!0),onMouseLeave:h("onMouseLeave"),onClick:h("onClick"),onFocus:h("onFocus"),onBlur:h("onBlur"),onMouseDown:b("mouseDown")},O=o.Children.only(e),{children:w,disabled:j}=O.props;return(j?V:W)({child:O,eventHandlers:v,childrenWithPopover:(({grandchildren:e,isOver:t,position:n,text:r,shortcut:s})=>Object(o.concatChildren)(e,t&&Object(o.createElement)(M,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},r,Object(o.createElement)(B,{className:"components-tooltip__shortcut",shortcut:s}))))({grandchildren:w,isOver:a,position:t,text:n,shortcut:r})})},z=n(38),K=n(34);const U=["onMouseDown","onClick"];var G=t.a=Object(o.forwardRef)((function(e,t){const{href:n,target:s,isSmall:a,isPressed:u,isBusy:d,isDestructive:p,className:f,disabled:b,icon:m,iconPosition:h="left",iconSize:g,showTooltip:v,tooltipPosition:O,shortcut:w,label:j,children:y,text:E,variant:k,__experimentalIsFocusable:_,describedBy:S,...x}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:s,...i}){let c=s;var a,u,d,p,f;return t&&(null!==(a=c)&&void 0!==a||(c="primary")),r&&(null!==(u=c)&&void 0!==u||(c="tertiary")),n&&(null!==(d=c)&&void 0!==d||(c="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=c)&&void 0!==p||(c="secondary")),o&&(null!==(f=c)&&void 0!==f||(c="link")),{...i,variant:c}}(e),T=i()("components-button",f,{"is-secondary":"secondary"===k,"is-primary":"primary"===k,"is-small":a,"is-tertiary":"tertiary"===k,"is-pressed":u,"is-busy":d,"is-link":"link"===k,"is-destructive":p,"has-text":!!m&&!!y,"has-icon":!!m}),C=b&&!_,L=void 0===n||C?"button":"a",I="a"===L?{href:n,target:s}:{type:"button",disabled:C,"aria-pressed":u};if(b&&_){I["aria-disabled"]=!0;for(const e of U)x[e]=e=>{e.stopPropagation(),e.preventDefault()}}const A=!C&&(v&&j||w||!!j&&(!y||Object(c.isArray)(y)&&!y.length)&&!1!==v),R=S?Object(c.uniqueId)():null,F=x["aria-describedby"]||R,P=Object(o.createElement)(L,Object(r.a)({},I,x,{className:T,"aria-label":x["aria-label"]||j,"aria-describedby":F,ref:t}),m&&"left"===h&&Object(o.createElement)(z.a,{icon:m,size:g}),E&&Object(o.createElement)(o.Fragment,null,E),m&&"right"===h&&Object(o.createElement)(z.a,{icon:m,size:g}),y);return A?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(q,{text:S||j,shortcut:w,position:O},P),S&&Object(o.createElement)(K.a,null,Object(o.createElement)("span",{id:R},S))):Object(o.createElement)(o.Fragment,null,P,S&&Object(o.createElement)(K.a,null,Object(o.createElement)("span",{id:R},S)))}))},,function(e,t){e.exports=window.wp.dom},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},,,function(e,t,n){"use strict";n.d(t,"n",(function(){return s})),n.d(t,"l",(function(){return i})),n.d(t,"k",(function(){return c})),n.d(t,"m",(function(){return a})),n.d(t,"i",(function(){return l})),n.d(t,"d",(function(){return u})),n.d(t,"f",(function(){return d})),n.d(t,"j",(function(){return p})),n.d(t,"c",(function(){return f})),n.d(t,"e",(function(){return b})),n.d(t,"g",(function(){return m})),n.d(t,"a",(function(){return h})),n.d(t,"h",(function(){return g})),n.d(t,"b",(function(){return v}));var r,o=n(2);const s=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=s.pluginUrl+"images/",c=s.pluginUrl+"build/",a=s.buildPhase,l=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=(o.STORE_PAGES.checkout.id,o.STORE_PAGES.checkout.permalink),d=o.STORE_PAGES.privacy.permalink,p=(o.STORE_PAGES.privacy.title,o.STORE_PAGES.terms.permalink),f=(o.STORE_PAGES.terms.title,o.STORE_PAGES.cart.id,o.STORE_PAGES.cart.permalink),b=o.STORE_PAGES.myaccount.permalink?o.STORE_PAGES.myaccount.permalink:Object(o.getSetting)("wpLoginUrl","/wp-login.php"),m=Object(o.getSetting)("shippingCountries",{}),h=Object(o.getSetting)("allowedCountries",{}),g=Object(o.getSetting)("shippingStates",{}),v=Object(o.getSetting)("allowedStates",{})},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(5);function o(e,t,n){var o=this,s=Object(r.useRef)(null),i=Object(r.useRef)(0),c=Object(r.useRef)(null),a=Object(r.useRef)([]),l=Object(r.useRef)(),u=Object(r.useRef)(),d=Object(r.useRef)(e),p=Object(r.useRef)(!0);d.current=e;var f=!t&&0!==t&&"undefined"!=typeof window;if("function"!=typeof e)throw new TypeError("Expected a function");t=+t||0;var b=!!(n=n||{}).leading,m=!("trailing"in n)||!!n.trailing,h="maxWait"in n,g=h?Math.max(+n.maxWait||0,t):null;return Object(r.useEffect)((function(){return p.current=!0,function(){p.current=!1}}),[]),Object(r.useMemo)((function(){var e=function(e){var t=a.current,n=l.current;return a.current=l.current=null,i.current=e,u.current=d.current.apply(n,t)},n=function(e,t){f&&cancelAnimationFrame(c.current),c.current=f?requestAnimationFrame(e):setTimeout(e,t)},r=function(e){if(!p.current)return!1;var n=e-s.current,r=e-i.current;return!s.current||n>=t||n<0||h&&r>=g},v=function(t){return c.current=null,m&&a.current?e(t):(a.current=l.current=null,u.current)},O=function(){var e=Date.now();if(r(e))return v(e);if(p.current){var o=e-s.current,c=e-i.current,a=t-o,l=h?Math.min(a,g-c):a;n(O,l)}},w=function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];var m=Date.now(),g=r(m);if(a.current=d,l.current=o,s.current=m,g){if(!c.current&&p.current)return i.current=s.current,n(O,t),b?e(s.current):u.current;if(h)return n(O,t),e(s.current)}return c.current||n(O,t),u.current};return w.cancel=function(){c.current&&(f?cancelAnimationFrame(c.current):clearTimeout(c.current)),i.current=0,a.current=s.current=l.current=c.current=null},w.isPending=function(){return!!c.current},w.flush=function(){return c.current?v(Date.now()):u.current},w}),[b,h,t,g,m,f])}},function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(12),o=n.n(r),s=n(0),i=n(15);const c=[".wp-block-woocommerce-cart"],a=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:c=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const a=r(e,n),l=c(e,n),u={...e.dataset,...a.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:c={},errorBoundaryProps:a={}}=e;Object(s.render)(Object(s.createElement)(i.a,a,Object(s.createElement)(s.Suspense,{fallback:Object(s.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(s.createElement)(t,o()({},c,{attributes:r})))),n,()=>{n.classList&&n.classList.remove("is-loading")})})({Block:t,container:e,props:a,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(c.join(",")),{Block:n,getProps:r,getErrorBoundaryProps:o,selector:s}=e;(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrappers:s}=e;const i=document.body.querySelectorAll(o);s&&s.length>0&&Array.prototype.filter.call(i,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,s)),a({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})})({Block:n,getProps:r,getErrorBoundaryProps:o,selector:s,wrappers:t}),Array.prototype.forEach.call(t,t=>{t.addEventListener("wc-blocks_render_blocks_frontend",()=>{(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrapper:s}=e;const i=s.querySelectorAll(o);a({Block:t,containers:i,getProps:n,getErrorBoundaryProps:r})})({...e,wrapper:t})})})}},function(e,t){e.exports=window.wp.keycodes},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(20);n(129),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,null!==n&&Number.isFinite(n)&&Object(r.createElement)(s.a,{label:n.toString(),screenReaderLabel:Object(o.sprintf)(
2
  /* translators: %s number of products. */
3
+ Object(o._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},function(e,t){var n,r,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function c(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:i}catch(e){r=i}}();var a,l=[],u=!1,d=-1;function p(){u&&a&&(u=!1,a.length?l=a.concat(l):d=-1,l.length&&f())}function f(){if(!u){var e=c(p);u=!0;for(var t=l.length;t;){for(a=l,l=[];++d<t;)a&&a[d].run();d=-1,t=l.length}a=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===i||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function b(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new b(e,t)),1!==l.length||u||c(f)},b.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(5);function o(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},function(e,t,n){"use strict";var r=n(0);n(85),t.a=e=>{let{children:t}=e;return Object(r.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(6),o=n(7),s=n(0),i=n(31),c=n(75);const a=e=>{const{namespace:t,resourceName:n,resourceValues:a=[],query:l={},shouldSelect:u=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=Object(s.useRef)({results:[],isLoading:!0}),p=Object(i.a)(l),f=Object(i.a)(a),b=Object(c.a)(),m=Object(o.useSelect)(e=>{if(!u)return null;const o=e(r.COLLECTIONS_STORE_KEY),s=[t,n,p,f],i=o.getCollectionError(...s);if(i){if(!(i instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");b(i)}return{results:o.getCollection(...s),isLoading:!o.hasFinishedResolution("getCollection",s)}},[t,n,f,p,u]);return null!==m&&(d.current=m),d.current}},,,,,,function(e,t,n){"use strict";var r=n(0),o=n(13);const s=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));t.a=s},,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0);const o=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},,function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(4),i=n.n(s),c=n(20);n(111),t.a=e=>{let{className:t,label:
4
  /* translators: Reset button text for filters. */
5
+ n=Object(o.__)("Reset","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:a=Object(o.__)("Reset filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{className:i()("wc-block-components-filter-reset-button",t),onClick:s},Object(r.createElement)(c.a,{label:n,screenReaderLabel:a}))}},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(4),i=n.n(s),c=n(20);n(112),t.a=e=>{let{className:t,isLoading:n,disabled:s,label:
6
  /* translators: Submit button text for filters. */
7
+ a=Object(o.__)("Apply","woo-gutenberg-products-block"),onClick:l,screenReaderLabel:u=Object(o.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:i()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":n},t),disabled:s,onClick:l},Object(r.createElement)(c.a,{label:a,screenReaderLabel:u}))}},function(e,t,n){"use strict";var r=n(0),o=n(3),s=n(4),i=n.n(s),c=n(1),a=n(23),l=n(72),u=n(42);function d(e){switch(e){case"success":case"warning":case"info":return"polite";case"error":default:return"assertive"}}t.a=function({className:e,status:t="info",children:n,spokenMessage:s=n,onRemove:p=o.noop,isDismissible:f=!0,actions:b=[],politeness:m=d(t),__unstableHTML:h,onDismiss:g=o.noop}){!function(e,t){const n="string"==typeof e?e:Object(r.renderToString)(e);Object(r.useEffect)(()=>{n&&Object(a.speak)(n,t)},[n,t])}(s,m);const v=i()(e,"components-notice","is-"+t,{"is-dismissible":f});return h&&(n=Object(r.createElement)(r.RawHTML,null,n)),Object(r.createElement)("div",{className:v},Object(r.createElement)("div",{className:"components-notice__content"},n,Object(r.createElement)("div",{className:"components-notice__actions"},b.map(({className:e,label:t,isPrimary:n,variant:o,noDefaultClasses:s=!1,onClick:c,url:a},l)=>{let d=o;return"primary"===o||s||(d=a?"link":"secondary"),void 0===d&&n&&(d="primary"),Object(r.createElement)(u.a,{key:l,href:a,variant:d,onClick:a?void 0:c,className:i()("components-notice__action",e)},t)}))),f&&Object(r.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(c.__)("Dismiss this notice"),onClick:e=>{var t;null==e||null===(t=e.preventDefault)||void 0===t||t.call(e),g(),p()},showTooltip:!1}))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},,,,,function(e,t){},,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(5),o=n(51);function s(e,t){return e===t}function i(e){return"function"==typeof e?function(){return e}:e}function c(e,t,n){var c=n&&n.equalityFn||s,a=function(e){var t=Object(r.useState)(i(e)),n=t[0],o=t[1];return[n,Object(r.useCallback)((function(e){return o(i(e))}),[])]}(e),l=a[0],u=a[1],d=Object(o.a)(Object(r.useCallback)((function(e){return u(e)}),[u]),t,n),p=Object(r.useRef)(e);return c(p.current,e)||(d(e),p.current=e),[l,d]}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return s}));var r=n(3);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const s=e.filter(e=>e.attribute===n.taxonomy),i=s.length?s[0]:null;if(!(i&&i.slug&&Array.isArray(i.slug)&&i.slug.includes(o)))return;const c=i.slug.filter(e=>e!==o),a=e.filter(e=>e.attribute!==n.taxonomy);c.length>0&&(i.slug=c.sort(),a.push(i)),t(Object(r.sortBy)(a,"attribute"))},s=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!n||!n.taxonomy)return[];const i=e.filter(e=>e.attribute!==n.taxonomy);return 0===o.length?t(i):(i.push({attribute:n.taxonomy,operator:s,slug:o.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(r.sortBy)(i,"attribute"))),i}},,function(e,t){e.exports=window.wp.blocks},,function(e,t,n){"use strict";var r=n(0);t.a=function(e){let{icon:t,size:n=24,...o}=e;return Object(r.cloneElement)(t,{width:n,height:n,...o})}},,,function(e,t){},function(e,t){},,function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return i}));var r=n(2);const o=Object(r.getSetting)("attributes",[]).reduce((e,t)=>{const n=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label}:null;var r;return n&&n.id&&e.push(n),e},[]),s=e=>{if(e)return o.find(t=>t.id===e)},i=e=>{if(e)return o.find(t=>t.taxonomy===e)}},function(e,t,n){"use strict";var r=n(0),o=n(1),s=n(4),i=n.n(s),c=n(9);n(130),t.a=e=>{let{className:t,onChange:n,options:s=[],checked:a=[],isLoading:l=!1,isDisabled:u=!1,limit:d=10}=e;const[p,f]=Object(r.useState)(!1),b=Object(r.useMemo)(()=>[...Array(5)].map((e,t)=>Object(r.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),m=Object(r.useMemo)(()=>{const e=s.length-d;return!p&&Object(r.createElement)("li",{key:"show-more",className:"show-more"},Object(r.createElement)("button",{onClick:()=>{f(!0)},"aria-expanded":!1,"aria-label":Object(o.sprintf)(
8
  /* translators: %s is referring the remaining count of options */
9
  Object(o._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(o.sprintf)(
10
  /* translators: %s number of options to reveal. */
11
+ Object(o._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[s,d,p]),h=Object(r.useMemo)(()=>p&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{f(!1)},"aria-expanded":!0,"aria-label":Object(o.__)("Show less options","woo-gutenberg-products-block")},Object(o.__)("Show less","woo-gutenberg-products-block"))),[p]),g=Object(r.useMemo)(()=>{const e=s.length>d+5;return Object(r.createElement)(r.Fragment,null,s.map((t,o)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!p&&o>=d&&{hidden:!0},Object(r.createElement)(c.CheckboxControl,{id:t.value,className:"wc-block-checkbox-list__checkbox",label:t.label,checked:a.includes(t.value),onChange:()=>{n(t.value)}})),e&&o===d-1&&m)),e&&h)},[s,n,a,p,d,h,m,u]),v=i()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":l},t);return Object(r.createElement)("ul",{className:v},l?b:g)}},,,function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter by Attribute","description":"Enable customers to filter the product grid by selecting one or more attributes, such as color.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"color":{"text":true,"background":false}},"example":{"attributes":{"isPreview":true}},"attributes":{"className":{"type":"string","default":""},"attributeId":{"type":"number","default":0},"showCounts":{"type":"boolean","default":true},"queryType":{"type":"string","default":"or"},"headingLevel":{"type":"number","default":3},"displayStyle":{"type":"string","default":"list"},"showFilterButton":{"type":"boolean","default":false},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},function(e,t){e.exports=window.wp.blockEditor},,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(45),o=n(18);const s=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(o.a)(e)?e:{}},,,function(e,t,n){"use strict";n.d(t,"b",(function(){return c})),n.d(t,"a",(function(){return a})),n.d(t,"d",(function(){return l})),n.d(t,"c",(function(){return u}));var r=n(14),o=n(2),s=n(80);const i=Object(o.getSettingWithCoercion)("is_rendering_php_template",!1,s.a),c="query_type_",a="filter_";function l(e){return window?Object(r.getQueryArg)(window.location.href,e):null}function u(e){i?window.location.href=e:window.history.replaceState({},"",e)}},function(e,t){},function(e,t){},,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(8),o=n(0),s=n(4),i=n.n(s);class c extends o.Component{constructor(){super(...arguments),this.onChange=this.onChange.bind(this),this.bindInput=this.bindInput.bind(this)}focus(){this.input.focus()}hasFocus(){return this.input===this.input.ownerDocument.activeElement}bindInput(e){this.input=e}onChange(e){this.props.onChange({value:e.target.value})}render(){const{value:e,isExpanded:t,instanceId:n,selectedSuggestionIndex:s,className:c,...a}=this.props,l=e?e.length+1:0;return Object(o.createElement)("input",Object(r.a)({ref:this.bindInput,id:"components-form-token-input-"+n,type:"text"},a,{value:e||"",onChange:this.onChange,size:l,className:i()(c,"components-form-token-field__input"),autoComplete:"off",role:"combobox","aria-expanded":t,"aria-autocomplete":"list","aria-owns":t?"components-form-token-suggestions-"+n:void 0,"aria-activedescendant":-1!==s?`components-form-token-suggestions-${n}-${s}`:void 0,"aria-describedby":"components-form-token-suggestions-howto-"+n}))}}t.a=c},function(e,t,n){"use strict";var r=n(0),o=n(3),s=n(148),i=n.n(s),c=n(4),a=n.n(c),l=n(10);class u extends r.Component{constructor(){super(...arguments),this.handleMouseDown=this.handleMouseDown.bind(this),this.bindList=this.bindList.bind(this)}componentDidUpdate(){this.props.selectedIndex>-1&&this.props.scrollIntoView&&this.list.children[this.props.selectedIndex]&&(this.scrollingIntoView=!0,i()(this.list.children[this.props.selectedIndex],this.list,{onlyScrollIfNeeded:!0}),this.props.setTimeout(()=>{this.scrollingIntoView=!1},100))}bindList(e){this.list=e}handleHover(e){return()=>{this.scrollingIntoView||this.props.onHover(e)}}handleClick(e){return()=>{this.props.onSelect(e)}}handleMouseDown(e){e.preventDefault()}computeSuggestionMatch(e){const t=this.props.displayTransform(this.props.match||"").toLocaleLowerCase();if(0===t.length)return null;const n=(e=this.props.displayTransform(e)).toLocaleLowerCase().indexOf(t);return{suggestionBeforeMatch:e.substring(0,n),suggestionMatch:e.substring(n,n+t.length),suggestionAfterMatch:e.substring(n+t.length)}}render(){return Object(r.createElement)("ul",{ref:this.bindList,className:"components-form-token-field__suggestions-list",id:"components-form-token-suggestions-"+this.props.instanceId,role:"listbox"},Object(o.map)(this.props.suggestions,(e,t)=>{const n=this.computeSuggestionMatch(e),o=a()("components-form-token-field__suggestion",{"is-selected":t===this.props.selectedIndex});return Object(r.createElement)("li",{id:`components-form-token-suggestions-${this.props.instanceId}-${t}`,role:"option",className:o,key:null!=e&&e.value?e.value:this.props.displayTransform(e),onMouseDown:this.handleMouseDown,onClick:this.handleClick(e),onMouseEnter:this.handleHover(e),"aria-selected":t===this.props.selectedIndex},n?Object(r.createElement)("span",{"aria-label":this.props.displayTransform(e)},n.suggestionBeforeMatch,Object(r.createElement)("strong",{className:"components-form-token-field__suggestion-match"},n.suggestionMatch),n.suggestionAfterMatch):this.props.displayTransform(e))}))}}u.defaultProps={match:"",onHover:()=>{},onSelect:()=>{},suggestions:Object.freeze([])},t.a=Object(l.withSafeTimeout)(u)},function(e,t,n){"use strict";e.exports=n(206)},function(e,t,n){"use strict";n.d(t,"a",(function(){return d}));var r=n(0),o=n(103),s=n(3),i=n(31),c=n(18),a=n(39),l=n(66),u=n(26);const d=e=>{let{queryAttribute:t,queryPrices:n,queryStock:d,queryState:p}=e,f=Object(u.a)();f+="-collection-data";const[b]=Object(a.a)(f),[m,h]=Object(a.b)("calculate_attribute_counts",[],f),[g,v]=Object(a.b)("calculate_price_range",null,f),[O,w]=Object(a.b)("calculate_stock_status_counts",null,f),j=Object(i.a)(t||{}),y=Object(i.a)(n),E=Object(i.a)(d);Object(r.useEffect)(()=>{"object"==typeof j&&Object.keys(j).length&&(m.find(e=>Object(c.b)(j,"taxonomy")&&e.taxonomy===j.taxonomy)||h([...m,j]))},[j,m,h]),Object(r.useEffect)(()=>{g!==y&&void 0!==y&&v(y)},[y,v,g]),Object(r.useEffect)(()=>{O!==E&&void 0!==E&&w(E)},[E,w,O]);const[k,_]=Object(r.useState)(!1),[S]=Object(o.a)(k,200);k||_(!0);const x=Object(r.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(s.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(b),[b]);return Object(l.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...p,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...x},shouldSelect:S})}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n(106);var r=n(48);const o=()=>r.m>1},,function(e,t,n){"use strict";var r=n(207);e.exports=function(e,t,n){n=n||{},9===t.nodeType&&(t=r.getWindow(t));var o=n.allowHorizontalScroll,s=n.onlyScrollIfNeeded,i=n.alignWithTop,c=n.alignWithLeft,a=n.offsetTop||0,l=n.offsetLeft||0,u=n.offsetBottom||0,d=n.offsetRight||0;o=void 0===o||o;var p=r.isWindow(t),f=r.offset(e),b=r.outerHeight(e),m=r.outerWidth(e),h=void 0,g=void 0,v=void 0,O=void 0,w=void 0,j=void 0,y=void 0,E=void 0,k=void 0,_=void 0;p?(y=t,_=r.height(y),k=r.width(y),E={left:r.scrollLeft(y),top:r.scrollTop(y)},w={left:f.left-E.left-l,top:f.top-E.top-a},j={left:f.left+m-(E.left+k)+d,top:f.top+b-(E.top+_)+u},O=E):(h=r.offset(t),g=t.clientHeight,v=t.clientWidth,O={left:t.scrollLeft,top:t.scrollTop},w={left:f.left-(h.left+(parseFloat(r.css(t,"borderLeftWidth"))||0))-l,top:f.top-(h.top+(parseFloat(r.css(t,"borderTopWidth"))||0))-a},j={left:f.left+m-(h.left+v+(parseFloat(r.css(t,"borderRightWidth"))||0))+d,top:f.top+b-(h.top+g+(parseFloat(r.css(t,"borderBottomWidth"))||0))+u}),w.top<0||j.top>0?!0===i?r.scrollTop(t,O.top+w.top):!1===i?r.scrollTop(t,O.top+j.top):w.top<0?r.scrollTop(t,O.top+w.top):r.scrollTop(t,O.top+j.top):s||((i=void 0===i||!!i)?r.scrollTop(t,O.top+w.top):r.scrollTop(t,O.top+j.top)),o&&(w.left<0||j.left>0?!0===c?r.scrollLeft(t,O.left+w.left):!1===c?r.scrollLeft(t,O.left+j.left):w.left<0?r.scrollLeft(t,O.left+w.left):r.scrollLeft(t,O.left+j.left):s||((c=void 0===c||!!c)?r.scrollLeft(t,O.left+w.left):r.scrollLeft(t,O.left+j.left)))}},function(e,t,n){"use strict";var r=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},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 s(e,t){var n=e["page"+(t?"Y":"X")+"Offset"],r="scroll"+(t?"Top":"Left");if("number"!=typeof n){var o=e.document;"number"!=typeof(n=o.documentElement[r])&&(n=o.body[r])}return n}function i(e){return s(e)}function c(e){return s(e,!0)}function a(e){var t=function(e){var t,n=void 0,r=void 0,o=e.ownerDocument,s=o.body,i=o&&o.documentElement;return n=(t=e.getBoundingClientRect()).left,r=t.top,{left:n-=i.clientLeft||s.clientLeft||0,top:r-=i.clientTop||s.clientTop||0}}(e),n=e.ownerDocument,r=n.defaultView||n.parentWindow;return t.left+=i(r),t.top+=c(r),t}var l=new RegExp("^("+/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source+")(?!px)[a-z%]+$","i"),u=/^(top|right|bottom|left)$/,d="left",p=void 0;function f(e,t){for(var n=0;n<e.length;n++)t(e[n])}function b(e){return"border-box"===p(e,"boxSizing")}"undefined"!=typeof window&&(p=window.getComputedStyle?function(e,t,n){var r="",o=e.ownerDocument,s=n||o.defaultView.getComputedStyle(e,null);return s&&(r=s.getPropertyValue(t)||s[t]),r}:function(e,t){var n=e.currentStyle&&e.currentStyle[t];if(l.test(n)&&!u.test(t)){var r=e.style,o=r[d],s=e.runtimeStyle[d];e.runtimeStyle[d]=e.currentStyle[d],r[d]="fontSize"===t?"1em":n||0,n=r.pixelLeft+"px",r[d]=o,e.runtimeStyle[d]=s}return""===n?"auto":n});var m=["margin","border","padding"];function h(e,t,n){var r={},o=e.style,s=void 0;for(s in t)t.hasOwnProperty(s)&&(r[s]=o[s],o[s]=t[s]);for(s in n.call(e),t)t.hasOwnProperty(s)&&(o[s]=r[s])}function g(e,t,n){var r=0,o=void 0,s=void 0,i=void 0;for(s=0;s<t.length;s++)if(o=t[s])for(i=0;i<n.length;i++){var c;c="border"===o?o+n[i]+"Width":o+n[i],r+=parseFloat(p(e,c))||0}return r}function v(e){return null!=e&&e==e.window}var O={};function w(e,t,n){if(v(e))return"width"===t?O.viewportWidth(e):O.viewportHeight(e);if(9===e.nodeType)return"width"===t?O.docWidth(e):O.docHeight(e);var r="width"===t?["Left","Right"]:["Top","Bottom"],o="width"===t?e.offsetWidth:e.offsetHeight,s=(p(e),b(e)),i=0;(null==o||o<=0)&&(o=void 0,(null==(i=p(e,t))||Number(i)<0)&&(i=e.style[t]||0),i=parseFloat(i)||0),void 0===n&&(n=s?1:-1);var c=void 0!==o||s,a=o||i;if(-1===n)return c?a-g(e,["border","padding"],r):i;if(c){var l=2===n?-g(e,["border"],r):g(e,["margin"],r);return a+(1===n?0:l)}return i+g(e,m.slice(n),r)}f(["Width","Height"],(function(e){O["doc"+e]=function(t){var n=t.document;return Math.max(n.documentElement["scroll"+e],n.body["scroll"+e],O["viewport"+e](n))},O["viewport"+e]=function(t){var n="client"+e,r=t.document,o=r.body,s=r.documentElement[n];return"CSS1Compat"===r.compatMode&&s||o&&o[n]||s}}));var j={position:"absolute",visibility:"hidden",display:"block"};function y(e){var t=void 0,n=arguments;return 0!==e.offsetWidth?t=w.apply(void 0,n):h(e,j,(function(){t=w.apply(void 0,n)})),t}function E(e,t,n){var r=n;if("object"!==(void 0===t?"undefined":o(t)))return void 0!==r?("number"==typeof r&&(r+="px"),void(e.style[t]=r)):p(e,t);for(var s in t)t.hasOwnProperty(s)&&E(e,s,t[s])}f(["width","height"],(function(e){var t=e.charAt(0).toUpperCase()+e.slice(1);O["outer"+t]=function(t,n){return t&&y(t,e,n?0:1)};var n="width"===e?["Left","Right"]:["Top","Bottom"];O[e]=function(t,r){return void 0===r?t&&y(t,e,-1):t?(p(t),b(t)&&(r+=g(t,["padding","border"],n)),E(t,e,r)):void 0}})),e.exports=r({getWindow:function(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow},offset:function(e,t){if(void 0===t)return a(e);!function(e,t){"static"===E(e,"position")&&(e.style.position="relative");var n=a(e),r={},o=void 0,s=void 0;for(s in t)t.hasOwnProperty(s)&&(o=parseFloat(E(e,s))||0,r[s]=o+t[s]-n[s]);E(e,r)}(e,t)},isWindow:v,each:f,css:E,clone:function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);if(e.overflow)for(var n in e)e.hasOwnProperty(n)&&(t.overflow[n]=e.overflow[n]);return t},scrollLeft:function(e,t){if(v(e)){if(void 0===t)return i(e);window.scrollTo(t,c(e))}else{if(void 0===t)return e.scrollLeft;e.scrollLeft=t}},scrollTop:function(e,t){if(v(e)){if(void 0===t)return c(e);window.scrollTo(i(e),t)}else{if(void 0===t)return e.scrollTop;e.scrollTop=t}},viewportWidth:0,viewportHeight:0},O)},,,,,,,,,,,,,,,,,function(e,t,n){e.exports=n(245)},function(e,t){},function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return c}));var r=n(18);const o=e=>Object(r.b)(e,"count")&&Object(r.b)(e,"description")&&Object(r.b)(e,"id")&&Object(r.b)(e,"name")&&Object(r.b)(e,"parent")&&Object(r.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,s=e=>Array.isArray(e)&&e.every(o),i=e=>Object(r.b)(e,"attribute")&&Object(r.b)(e,"operator")&&Object(r.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),c=e=>Array.isArray(e)&&e.every(i)},function(e,t){},,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(52),o=n(0),s=n(1),i=n(257),c=n(31),a=n(61),l=n(39),u=n(66),d=n(149),p=n(54),f=n(77),b=n(78),m=n(11),h=n.n(m),g=n(17),v=n(79),O=n(2),w=n(14),j=n(80),y=n(45),E=n(18),k=n(226),_=n(108),S=n(13),x=Object(o.createElement)(S.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(o.createElement)(S.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"})),T=n(128),C=n(3),L=n(12),I=n.n(L),A=n(4),R=n.n(A),F=n(10),P=n(53),N=n(261),M=n(42),B=n(34);function D({value:e,status:t,title:n,displayTransform:r,isBorderless:i=!1,disabled:c=!1,onClickRemove:a=C.noop,onMouseEnter:l,onMouseLeave:u,messages:d,termPosition:p,termsCount:f}){const b=Object(F.useInstanceId)(D),m=R()("components-form-token-field__token",{"is-error":"error"===t,"is-success":"success"===t,"is-validating":"validating"===t,"is-borderless":i,"is-disabled":c}),h=r(e),g=Object(s.sprintf)(
12
  /* translators: 1: term name, 2: term position in a set of terms, 3: total term set count. */
13
+ Object(s.__)("%1$s (%2$s of %3$s)"),h,p,f);return Object(o.createElement)("span",{className:m,onMouseEnter:l,onMouseLeave:u,title:n},Object(o.createElement)("span",{className:"components-form-token-field__token-text",id:"components-form-token-field__token-text-"+b},Object(o.createElement)(B.a,{as:"span"},g),Object(o.createElement)("span",{"aria-hidden":"true"},h)),Object(o.createElement)(M.a,{className:"components-form-token-field__remove-token",icon:N.a,onClick:!c&&(()=>a({value:e})),label:d.remove,"aria-describedby":"components-form-token-field__token-text-"+b}))}var V=n(146),W=n(147),H=n(8),q=n(23),z=Object(F.createHigherOrderComponent)(e=>t=>Object(o.createElement)(e,Object(H.a)({},t,{speak:q.speak,debouncedSpeak:Object(F.useDebounce)(q.speak,500)})),"withSpokenMessages");const K={incompleteTokenValue:"",inputOffsetFromEnd:0,isActive:!1,isExpanded:!1,selectedSuggestionIndex:-1,selectedSuggestionScroll:!1};class U extends o.Component{constructor(){super(...arguments),this.state=K,this.onKeyDown=this.onKeyDown.bind(this),this.onKeyPress=this.onKeyPress.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.deleteTokenBeforeInput=this.deleteTokenBeforeInput.bind(this),this.deleteTokenAfterInput=this.deleteTokenAfterInput.bind(this),this.addCurrentToken=this.addCurrentToken.bind(this),this.onContainerTouched=this.onContainerTouched.bind(this),this.renderToken=this.renderToken.bind(this),this.onTokenClickRemove=this.onTokenClickRemove.bind(this),this.onSuggestionHovered=this.onSuggestionHovered.bind(this),this.onSuggestionSelected=this.onSuggestionSelected.bind(this),this.onInputChange=this.onInputChange.bind(this),this.bindInput=this.bindInput.bind(this),this.bindTokensAndInput=this.bindTokensAndInput.bind(this),this.updateSuggestions=this.updateSuggestions.bind(this)}componentDidUpdate(e){this.state.isActive&&!this.input.hasFocus()&&this.input.focus();const{suggestions:t,value:n}=this.props,r=!h()(t,e.suggestions);(r||n!==e.value)&&this.updateSuggestions(r)}static getDerivedStateFromProps(e,t){return e.disabled&&t.isActive?{isActive:!1,incompleteTokenValue:""}:null}bindInput(e){this.input=e}bindTokensAndInput(e){this.tokensAndInput=e}onFocus(e){const{__experimentalExpandOnFocus:t}=this.props;this.input.hasFocus()||e.target===this.tokensAndInput?this.setState({isActive:!0,isExpanded:!!t||this.state.isExpanded}):this.setState({isActive:!1}),"function"==typeof this.props.onFocus&&this.props.onFocus(e)}onBlur(){this.inputHasValidValue()?this.setState({isActive:!1}):this.setState(K)}onKeyDown(e){let t=!1;switch(e.keyCode){case P.BACKSPACE:t=this.handleDeleteKey(this.deleteTokenBeforeInput);break;case P.ENTER:t=this.addCurrentToken();break;case P.LEFT:t=this.handleLeftArrowKey();break;case P.UP:t=this.handleUpArrowKey();break;case P.RIGHT:t=this.handleRightArrowKey();break;case P.DOWN:t=this.handleDownArrowKey();break;case P.DELETE:t=this.handleDeleteKey(this.deleteTokenAfterInput);break;case P.SPACE:this.props.tokenizeOnSpace&&(t=this.addCurrentToken());break;case P.ESCAPE:t=this.handleEscapeKey(e),e.stopPropagation()}t&&e.preventDefault()}onKeyPress(e){let t=!1;switch(e.charCode){case 44:t=this.handleCommaKey()}t&&e.preventDefault()}onContainerTouched(e){e.target===this.tokensAndInput&&this.state.isActive&&e.preventDefault()}onTokenClickRemove(e){this.deleteToken(e.value),this.input.focus()}onSuggestionHovered(e){const t=this.getMatchingSuggestions().indexOf(e);t>=0&&this.setState({selectedSuggestionIndex:t,selectedSuggestionScroll:!1})}onSuggestionSelected(e){this.addNewToken(e)}onInputChange(e){const t=e.value,n=this.props.tokenizeOnSpace?/[ ,\t]+/:/[,\t]+/,r=t.split(n),o=Object(C.last)(r)||"";r.length>1&&this.addNewTokens(r.slice(0,-1)),this.setState({incompleteTokenValue:o},this.updateSuggestions),this.props.onInputChange(o)}handleDeleteKey(e){let t=!1;return this.input.hasFocus()&&this.isInputEmpty()&&(e(),t=!0),t}handleLeftArrowKey(){let e=!1;return this.isInputEmpty()&&(this.moveInputBeforePreviousToken(),e=!0),e}handleRightArrowKey(){let e=!1;return this.isInputEmpty()&&(this.moveInputAfterNextToken(),e=!0),e}handleUpArrowKey(){return this.setState((e,t)=>({selectedSuggestionIndex:(0===e.selectedSuggestionIndex?this.getMatchingSuggestions(e.incompleteTokenValue,t.suggestions,t.value,t.maxSuggestions,t.saveTransform).length:e.selectedSuggestionIndex)-1,selectedSuggestionScroll:!0})),!0}handleDownArrowKey(){return this.setState((e,t)=>({selectedSuggestionIndex:(e.selectedSuggestionIndex+1)%this.getMatchingSuggestions(e.incompleteTokenValue,t.suggestions,t.value,t.maxSuggestions,t.saveTransform).length,selectedSuggestionScroll:!0})),!0}handleEscapeKey(e){return this.setState({incompleteTokenValue:e.target.value,isExpanded:!1,selectedSuggestionIndex:-1,selectedSuggestionScroll:!1}),!0}handleCommaKey(){return this.inputHasValidValue()&&this.addNewToken(this.state.incompleteTokenValue),!0}moveInputToIndex(e){this.setState((t,n)=>({inputOffsetFromEnd:n.value.length-Math.max(e,-1)-1}))}moveInputBeforePreviousToken(){this.setState((e,t)=>({inputOffsetFromEnd:Math.min(e.inputOffsetFromEnd+1,t.value.length)}))}moveInputAfterNextToken(){this.setState(e=>({inputOffsetFromEnd:Math.max(e.inputOffsetFromEnd-1,0)}))}deleteTokenBeforeInput(){const e=this.getIndexOfInput()-1;e>-1&&this.deleteToken(this.props.value[e])}deleteTokenAfterInput(){const e=this.getIndexOfInput();e<this.props.value.length&&(this.deleteToken(this.props.value[e]),this.moveInputToIndex(e))}addCurrentToken(){let e=!1;const t=this.getSelectedSuggestion();return t?(this.addNewToken(t),e=!0):this.inputHasValidValue()&&(this.addNewToken(this.state.incompleteTokenValue),e=!0),e}addNewTokens(e){const t=Object(C.uniq)(e.map(this.props.saveTransform).filter(Boolean).filter(e=>!this.valueContainsToken(e)));if(t.length>0){const e=Object(C.clone)(this.props.value);e.splice.apply(e,[this.getIndexOfInput(),0].concat(t)),this.props.onChange(e)}}addNewToken(e){const{__experimentalExpandOnFocus:t,__experimentalValidateInput:n}=this.props;n(e)?(this.addNewTokens([e]),this.props.speak(this.props.messages.added,"assertive"),this.setState({incompleteTokenValue:"",selectedSuggestionIndex:-1,selectedSuggestionScroll:!1,isExpanded:!t}),this.state.isActive&&this.input.focus()):this.props.speak(this.props.messages.__experimentalInvalid,"assertive")}deleteToken(e){const t=this.props.value.filter(t=>this.getTokenValue(t)!==this.getTokenValue(e));this.props.onChange(t),this.props.speak(this.props.messages.removed,"assertive")}getTokenValue(e){return"object"==typeof e?e.value:e}getMatchingSuggestions(e=this.state.incompleteTokenValue,t=this.props.suggestions,n=this.props.value,r=this.props.maxSuggestions,o=this.props.saveTransform){let s=o(e);const i=[],c=[];return 0===s.length?t=Object(C.difference)(t,n):(s=s.toLocaleLowerCase(),Object(C.each)(t,e=>{const t=e.toLocaleLowerCase().indexOf(s);-1===n.indexOf(e)&&(0===t?i.push(e):t>0&&c.push(e))}),t=i.concat(c)),Object(C.take)(t,r)}getSelectedSuggestion(){if(-1!==this.state.selectedSuggestionIndex)return this.getMatchingSuggestions()[this.state.selectedSuggestionIndex]}valueContainsToken(e){return Object(C.some)(this.props.value,t=>this.getTokenValue(e)===this.getTokenValue(t))}getIndexOfInput(){return this.props.value.length-this.state.inputOffsetFromEnd}isInputEmpty(){return 0===this.state.incompleteTokenValue.length}inputHasValidValue(){return this.props.saveTransform(this.state.incompleteTokenValue).length>0}updateSuggestions(e=!0){const{__experimentalExpandOnFocus:t}=this.props,{incompleteTokenValue:n}=this.state,r=n.trim().length>1,o=this.getMatchingSuggestions(n),i=o.length>0,c={isExpanded:t||r&&i};if(e&&(c.selectedSuggestionIndex=-1,c.selectedSuggestionScroll=!1),this.setState(c),r){const{debouncedSpeak:e}=this.props;e(i?Object(s.sprintf)(
14
  /* translators: %d: number of results. */
15
+ Object(s._n)("%d result found, use up and down arrow keys to navigate.","%d results found, use up and down arrow keys to navigate.",o.length),o.length):Object(s.__)("No results."),"assertive")}}renderTokensAndInput(){const e=Object(C.map)(this.props.value,this.renderToken);return e.splice(this.getIndexOfInput(),0,this.renderInput()),e}renderToken(e,t,n){const r=this.getTokenValue(e),s=e.status?e.status:void 0,i=t+1,c=n.length;return Object(o.createElement)(D,{key:"token-"+r,value:r,status:s,title:e.title,displayTransform:this.props.displayTransform,onClickRemove:this.onTokenClickRemove,isBorderless:e.isBorderless||this.props.isBorderless,onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,disabled:"error"!==s&&this.props.disabled,messages:this.props.messages,termsCount:c,termPosition:i})}renderInput(){const{autoCapitalize:e,autoComplete:t,maxLength:n,placeholder:r,value:s,instanceId:i}=this.props;let c={instanceId:i,autoCapitalize:e,autoComplete:t,placeholder:0===s.length?r:"",ref:this.bindInput,key:"input",disabled:this.props.disabled,value:this.state.incompleteTokenValue,onBlur:this.onBlur,isExpanded:this.state.isExpanded,selectedSuggestionIndex:this.state.selectedSuggestionIndex};return n&&s.length>=n||(c={...c,onChange:this.onInputChange}),Object(o.createElement)(V.a,c)}render(){const{disabled:e,label:t=Object(s.__)("Add item"),instanceId:n,className:r,__experimentalShowHowTo:i}=this.props,{isExpanded:c}=this.state,a=R()(r,"components-form-token-field__input-container",{"is-active":this.state.isActive,"is-disabled":e});let l={className:"components-form-token-field",tabIndex:"-1"};const u=this.getMatchingSuggestions();return e||(l=Object.assign({},l,{onKeyDown:this.onKeyDown,onKeyPress:this.onKeyPress,onFocus:this.onFocus})),Object(o.createElement)("div",l,Object(o.createElement)("label",{htmlFor:"components-form-token-input-"+n,className:"components-form-token-field__label"},t),Object(o.createElement)("div",{ref:this.bindTokensAndInput,className:a,tabIndex:"-1",onMouseDown:this.onContainerTouched,onTouchStart:this.onContainerTouched},this.renderTokensAndInput(),c&&Object(o.createElement)(W.a,{instanceId:n,match:this.props.saveTransform(this.state.incompleteTokenValue),displayTransform:this.props.displayTransform,suggestions:u,selectedIndex:this.state.selectedSuggestionIndex,scrollIntoView:this.state.selectedSuggestionScroll,onHover:this.onSuggestionHovered,onSelect:this.onSuggestionSelected})),i&&Object(o.createElement)("p",{id:"components-form-token-suggestions-howto-"+n,className:"components-form-token-field__help"},this.props.tokenizeOnSpace?Object(s.__)("Separate with commas, spaces, or the Enter key."):Object(s.__)("Separate with commas or the Enter key.")))}}U.defaultProps={suggestions:Object.freeze([]),maxSuggestions:100,value:Object.freeze([]),displayTransform:C.identity,saveTransform:e=>e.trim(),onChange:()=>{},onInputChange:()=>{},isBorderless:!1,disabled:!1,tokenizeOnSpace:!1,messages:{added:Object(s.__)("Item added."),removed:Object(s.__)("Item removed."),remove:Object(s.__)("Remove item"),__experimentalInvalid:Object(s.__)("Invalid item")},__experimentalExpandOnFocus:!1,__experimentalValidateInput:()=>!0,__experimentalShowHowTo:!0};var G=z(Object(F.withInstanceId)(U));n(227);var $=e=>{let{className:t,style:n,suggestions:r,multiple:s=!0,saveTransform:i=(e=>e.trim().replace(/\s/g,"-")),messages:c={},validateInput:a=(e=>r.includes(e)),label:l="",...u}=e;return Object(o.createElement)("div",{className:R()("wc-blocks-components-form-token-field-wrapper",t,{"single-selection":!s}),style:n},Object(o.createElement)(G,I()({label:l,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:a,saveTransform:i,maxLength:s?void 0:1,suggestions:r,messages:c},u)))},Q=n(62),Y=n(114),J=n(104);const X=[{value:"preview-1",formattedValue:"preview-1",name:"Blue",label:Object(o.createElement)(p.a,{name:"Blue",count:3}),textLabel:"Blue (3)"},{value:"preview-2",formattedValue:"preview-2",name:"Green",label:Object(o.createElement)(p.a,{name:"Green",count:3}),textLabel:"Green (3)"},{value:"preview-3",formattedValue:"preview-3",name:"Red",label:Object(o.createElement)(p.a,{name:"Red",count:2}),textLabel:"Red (2)"}],Z={id:0,name:"preview",taxonomy:"preview",label:"Preview"};function ee(){return Math.floor(Math.random()*Date.now())}n(225);const te=e=>e.replace("pa_",""),ne=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:r,operator:o}=e,s=te(t),i=r.join(","),c=`${T.b}${s}`,a="in"===o?"or":"and";n[`${T.a}${s}`]=i,n[c]=a});const r=Object(w.removeQueryArgs)(e,...Object.keys(n));return Object(w.addQueryArgs)(r,n)},re=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,r]=t;return n.includes("query_type")?e:{...e,[n]:r}},{});return Object.entries(n).reduce((t,n)=>{let[r,o]=n;return e[r]===o&&t},!0)},oe=e=>e.trim().replace(/\s/g,"-").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,"");var se=n(115),ie=e=>{let{isLoading:t=!1,options:n,checked:r,onChange:s}=e;return t?Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"is-loading"}),Object(o.createElement)("span",{className:"is-loading"})):Object(o.createElement)(se.a,{className:"wc-block-attribute-filter-list",options:n,checked:r,onChange:s,isLoading:t,isDisabled:t})};const ce={heading:{type:"string",default:Object(s.__)("Filter by attribute","woo-gutenberg-products-block")}};var ae=n(118);Object(r.a)({selector:".wp-block-woocommerce-attribute-filter",Block:e=>{let{attributes:t,isEditor:n=!1}=e;const r=Object(O.getSettingWithCoercion)("has_filterable_products",!1,j.a),m=Object(O.getSettingWithCoercion)("is_rendering_php_template",!1,j.a),S=Object(O.getSettingWithCoercion)("page_url",window.location.href,y.a),[L,I]=Object(o.useState)(!1),A=t.isPreview&&!t.attributeId?Z:Object(Y.a)(t.attributeId),F=Object(o.useMemo)(()=>(e=>{if(e){const t=Object(T.d)("filter_"+e.name);return"string"==typeof t?t.split(","):[]}return[]})(A),[A]),[P,N]=Object(o.useState)(F),[M,B]=Object(o.useState)(ee()),[D,V]=Object(o.useState)(t.isPreview&&!t.attributeId?X:[]),W=Object(i.a)(t),[H]=Object(l.a)(),[q,z]=Object(l.b)("attributes",[]),{results:K,isLoading:U}=Object(u.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==A?void 0:A.id)||0],shouldSelect:t.attributeId>0}),G="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:se,isLoading:ce}=Object(d.a)({queryAttribute:{taxonomy:(null==A?void 0:A.taxonomy)||"",queryType:t.queryType},queryState:{...H,attributes:G?H.attributes:null}}),ae=Object(o.useCallback)(e=>Object(E.b)(se,"attribute_counts")&&Array.isArray(se.attribute_counts)?se.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[se]);Object(o.useEffect)(()=>{if(U||ce)return;if(!Array.isArray(K))return;const e=K.map(e=>{const n=ae(e.id);if(!(n||P.includes(e.slug)||(r=e.slug,null!=H&&H.attributes&&H.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==A?void 0:A.taxonomy)&&n.includes(r)}))))return null;var r;const s=n?n.count:0;return{formattedValue:oe(e.slug),value:e.slug,name:Object(g.decodeEntities)(e.name),label:Object(o.createElement)(p.a,{name:Object(g.decodeEntities)(e.name),count:t.showCounts?s:null}),textLabel:t.showCounts?`${Object(g.decodeEntities)(e.name)} (${s})`:Object(g.decodeEntities)(e.name)}}).filter(e=>!!e);V(e),B(ee())},[null==A?void 0:A.taxonomy,K,U,t.showCounts,ce,ae,P,H.attributes]);const le=Object(o.useCallback)(e=>Array.isArray(K)?K.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[K]),ue=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(null==A||!A.taxonomy)return;const t=Object.keys(Object(w.getQueryArgs)(window.location.href)),n=te(A.taxonomy),r=t.reduce((e,t)=>t.includes(T.b+n)||t.includes(T.a+n)?Object(w.removeQueryArgs)(e,t):e,window.location.href),o=ne(r,e);Object(T.c)(o)}else{const t=ne(S,e),n=Object(w.getQueryArgs)(window.location.href),r=Object(w.getQueryArgs)(t);re(n,r)||Object(T.c)(t)}}),[S,null==A?void 0:A.taxonomy]),de=e=>{const n=Object(J.b)(q,z,A,le(e),"or"===t.queryType?"in":"and");ue(n,0===e.length)},pe=Object(o.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||(N(e),!r&&t.showFilterButton||Object(J.b)(q,z,A,le(e),"or"===t.queryType?"in":"and"))}),[n,N,q,z,A,le,t.queryType,t.showFilterButton]),fe=Object(o.useMemo)(()=>Object(k.a)(q)?q.filter(e=>{let{attribute:t}=e;return t===(null==A?void 0:A.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[q,null==A?void 0:A.taxonomy]),be=Object(c.a)(fe),me=Object(a.a)(be);Object(o.useEffect)(()=>{!me||h()(me,be)||h()(P,be)||pe(be)},[P,be,me,pe]);const he="single"!==t.selectType,ge=Object(o.useCallback)(e=>{const t=P.includes(e);let n;he?(n=P.filter(t=>t!==e),t||(n.push(e),n.sort())):n=t?[]:[e],pe(n)},[P,he,pe]);if(Object(o.useEffect)(()=>{A&&!t.showFilterButton&&((e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length})({currentCheckedFilters:P,hasSetFilterDefaultsFromUrl:L})?ue(q,!0):ue(q,!1))},[L,ue,q,A,P,t.showFilterButton]),Object(o.useEffect)(()=>{if(!L&&!U)return F.length>0?(I(!0),void pe(F,!0)):void(m||I(!0))},[A,L,U,pe,F,m]),!r)return null;if(!A)return n?Object(o.createElement)(v.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(s.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):null;if(0===D.length&&!U&&n)return Object(o.createElement)(v.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(s.__)("There are no products with the selected attributes.","woo-gutenberg-products-block")));const ve="h"+t.headingLevel,Oe=!t.isPreview&&U,we=!t.isPreview&&ce,je=(Oe||we)&&0===D.length;if(!je&&0===D.length)return null;const ye=Object(o.createElement)(ve,{className:"wc-block-attribute-filter__title"},t.heading),Ee=je?Object(o.createElement)(Q.a,null,ye):ye;return Object(o.createElement)(o.Fragment,null,!n&&t.heading&&Ee,Object(o.createElement)("div",{className:R()("wc-block-attribute-filter","style-"+t.displayStyle)},"dropdown"===t.displayStyle?Object(o.createElement)(o.Fragment,null,Object(o.createElement)($,{key:M,className:R()(W.className,{"single-selection":!he,"is-loading":je}),style:{...W.style,borderStyle:"none"},suggestions:D.filter(e=>!P.includes(e.value)).map(e=>e.formattedValue),disabled:je,placeholder:Object(s.sprintf)(
16
  /* translators: %s attribute name. */
17
+ Object(s.__)("Select %s","woo-gutenberg-products-block"),A.label),onChange:e=>{!he&&e.length>1&&(e=[e[e.length-1]]),e=e.map(e=>{const t=D.find(t=>t.formattedValue===e);return t?t.value:e});const t=Object(C.difference)(e,P);if(1===t.length)return ge(t[0]);const n=Object(C.difference)(P,e);1===n.length&&ge(n[0])},value:P,displayTransform:e=>{const t=D.find(t=>[t.value,t.formattedValue].includes(e));return t?t.textLabel:e},saveTransform:oe,messages:{added:Object(s.sprintf)(
18
  /* translators: %s is the attribute label. */
19
+ Object(s.__)("%s filter added.","woo-gutenberg-products-block"),A.label),removed:Object(s.sprintf)(
20
  /* translators: %s is the attribute label. */
21
+ Object(s.__)("%s filter removed.","woo-gutenberg-products-block"),A.label),remove:Object(s.sprintf)(
22
  /* translators: %s is the attribute label. */
23
+ Object(s.__)("Remove %s filter.","woo-gutenberg-products-block"),A.label.toLocaleLowerCase()),__experimentalInvalid:Object(s.sprintf)(
24
  /* translators: %s is the attribute label. */
25
+ Object(s.__)("Invalid %s filter.","woo-gutenberg-products-block"),A.label.toLocaleLowerCase())}}),he&&Object(o.createElement)(_.a,{icon:x,size:30})):Object(o.createElement)(ie,{options:D,checked:P,onChange:ge,isLoading:je,isDisabled:je})),Object(o.createElement)("div",{className:"wc-block-attribute-filter__actions"},P.length>0&&!je&&Object(o.createElement)(f.a,{onClick:()=>{N([]),B(ee()),L&&de([])},screenReaderLabel:Object(s.__)("Reset attribute filter","woo-gutenberg-products-block")}),t.showFilterButton&&Object(o.createElement)(b.a,{className:"wc-block-attribute-filter__button",isLoading:je,disabled:Oe||we||0===P.length,onClick:()=>de(P)})))},getProps:e=>({isEditor:!1,attributes:{attributeId:parseInt(e.dataset.attributeId||"0",10),showCounts:"true"===e.dataset.showCounts,queryType:e.dataset.queryType||ae.attributes.queryType.default,heading:e.dataset.heading||ce.heading.default,headingLevel:e.dataset.headingLevel?parseInt(e.dataset.headingLevel,10):ae.attributes.headingLevel.default,displayStyle:e.dataset.displayStyle||ae.attributes.displayStyle.default,showFilterButton:"true"===e.dataset.showFilterButton,selectType:e.dataset.selectType||ae.attributes.selectType.default}})})},,,,,,,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(119),o=n(204),s=n(18),i=n(125);const c=e=>{if(!Object(o.a)())return{className:"",style:{}};const t=Object(s.a)(e)?e:{},n=Object(i.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:n})}},,,,function(e,t,n){"use strict";var r=n(0),o=n(13);const s=Object(r.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(o.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}));t.a=s}]);
build/attribute-filter.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning'), 'version' => '2d5e2ebeef624eb8b7a0c45e2b68d590');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-settings', 'wp-a11y', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning'), 'version' => 'fafeca49dd2c4751cb88d1e94dcdb682');
build/attribute-filter.js CHANGED
@@ -1,20 +1,20 @@
1
- this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["attribute-filter"]=function(e){function t(t){for(var r,l,a=t[0],s=t[1],i=t[2],b=0,d=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(c,l)&&c[l]&&d.push(c[l][0]),c[l]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r]);for(u&&u(t);d.length;)d.shift()();return o.push.apply(o,i||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],r=!0,a=1;a<n.length;a++){var s=n[a];0!==c[s]&&(r=!1)}r&&(o.splice(t--,1),e=l(l.s=n[0]))}return e}var r={},c={8:0,1:0},o=[];function l(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,l),n.l=!0,n.exports}l.m=e,l.c=r,l.d=function(e,t,n){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(l.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)l.d(n,r,function(t){return e[t]}.bind(null,r));return n},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var i=0;i<a.length;i++)t(a[i]);var u=s;return o.push([393,0]),n()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.compose},100:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},101:function(e,t){e.exports=window.wp.warning},106:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(28);n(250),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,n&&Number.isFinite(n)&&Object(r.createElement)(o.a,{label:n.toString(),screenReaderLabel:Object(c.sprintf)(
2
  /* translators: %s number of products. */
3
- Object(c._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},109:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(12);function c(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},11:function(e,t){e.exports=window.wp.primitives},12:function(e,t){e.exports=window.React},120:function(e,t,n){"use strict";var r=n(0),c=n(5),o=n(10),l=n(1);n(160),t.a=Object(o.withInstanceId)(e=>{let{className:t,headingLevel:n,onChange:o,heading:a,instanceId:s}=e;const i="h"+n;return Object(r.createElement)(i,{className:t},Object(r.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+s},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(r.createElement)(c.PlainText,{id:"block-title-"+s,className:"wc-block-editor-components-title",value:a,onChange:o}))})},124:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0);const c=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},125:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(17),c=n(9),o=n(0),l=n(49),a=n(124);const s=e=>{const{namespace:t,resourceName:n,resourceValues:s=[],query:i={},shouldSelect:u=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(o.useRef)({results:[],isLoading:!0}),d=Object(l.a)(i),m=Object(l.a)(s),p=Object(a.a)(),g=Object(c.useSelect)(e=>{if(!u)return null;const c=e(r.COLLECTIONS_STORE_KEY),o=[t,n,d,m],l=c.getCollectionError(...o);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");p(l)}return{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,n,m,d,u]);return null!==g&&(b.current=g),b.current}},14:function(e,t){e.exports=window.wp.htmlEntities},146:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(4),l=n.n(o),a=n(28);n(186),t.a=e=>{let{className:t,label:
4
  /* translators: Reset button text for filters. */
5
- n=Object(c.__)("Reset","woo-gutenberg-products-block"),onClick:o,screenReaderLabel:s=Object(c.__)("Reset filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{className:l()("wc-block-components-filter-reset-button",t),onClick:o},Object(r.createElement)(a.a,{label:n,screenReaderLabel:s}))}},147:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(4),l=n.n(o),a=n(28);n(187),t.a=e=>{let{className:t,disabled:n,label:
6
  /* translators: Submit button text for filters. */
7
- o=Object(c.__)("Apply","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:i=Object(c.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:l()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",t),disabled:n,onClick:s},Object(r.createElement)(a.a,{label:o,screenReaderLabel:i}))}},15:function(e,t){e.exports=window.wp.url},150:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},152:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(100),c=n(35);const o=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(c.a)(e)?e:{}},160:function(e,t){},17:function(e,t){e.exports=window.wc.wcBlocksData},173:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return o}));var r=n(7);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===n.taxonomy),l=o.length?o[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(c)))return;const a=l.slug.filter(e=>e!==c),s=e.filter(e=>e.attribute!==n.taxonomy);a.length>0&&(l.slug=a.sort(),s.push(l)),t(Object(r.sortBy)(s,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!n||!n.taxonomy)return[];const l=e.filter(e=>e.attribute!==n.taxonomy);return 0===c.length?t(l):(l.push({attribute:n.taxonomy,operator:o,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(r.sortBy)(l,"attribute"))),l}},18:function(e,t){e.exports=window.wc.blocksCheckout},186:function(e,t){},187:function(e,t){},19:function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"c",(function(){return s})),n.d(t,"d",(function(){return i})),n.d(t,"b",(function(){return u}));var r=n(0),c=n(7),o=n(1);const l={clear:Object(o.__)("Clear all selected items","woo-gutenberg-products-block"),noItems:Object(o.__)("No items found.","woo-gutenberg-products-block"),
8
  /* Translators: %s search term */
9
  noResults:Object(o.__)("No results for %s","woo-gutenberg-products-block"),search:Object(o.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(o.sprintf)(
10
  /* translators: Number of items selected from list. */
11
- Object(o._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(o.__)("Search results updated.","woo-gutenberg-products-block")},a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const n=Object(c.groupBy)(e,"parent"),r=Object(c.keyBy)(t,"id"),o=["0"],l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=l(r[e.parent]);return[...t,e.name]},a=e=>e.map(e=>{const t=n[e.id];return o.push(""+e.id),{...e,breadcrumbs:l(r[e.parent]),children:t&&t.length?a(t):[]}}),s=a(n[0]||[]);return Object.entries(n).forEach(e=>{let[t,n]=e;o.includes(t)||s.push(...a(n||[]))}),s},s=(e,t,n)=>{if(!t)return n?a(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),c=e.map(e=>!!r.test(e.name)&&e).filter(Boolean);return n?a(c,e):c},i=(e,t)=>{if(!t)return e;const n=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(n).map((e,t)=>n.test(e)?Object(r.createElement)("strong",{key:t},e):Object(r.createElement)(r.Fragment,{key:t},e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},2:function(e,t){e.exports=window.wc.wcSettings},207:function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return l}));var r=n(2);const c=Object(r.getSetting)("attributes",[]).reduce((e,t)=>{const n=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label}:null;var r;return n&&n.id&&e.push(n),e},[]),o=e=>{if(e)return c.find(t=>t.id===e)},l=e=>{if(e)return c.find(t=>t.taxonomy===e)}},208:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(4),l=n.n(o),a=n(18);n(251),t.a=e=>{let{className:t,onChange:n,options:o=[],checked:s=[],isLoading:i=!1,isDisabled:u=!1,limit:b=10}=e;const[d,m]=Object(r.useState)(!1),p=Object(r.useMemo)(()=>[...Array(5)].map((e,t)=>Object(r.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),g=Object(r.useMemo)(()=>{const e=o.length-b;return!d&&Object(r.createElement)("li",{key:"show-more",className:"show-more"},Object(r.createElement)("button",{onClick:()=>{m(!0)},"aria-expanded":!1,"aria-label":Object(c.sprintf)(
12
  /* translators: %s is referring the remaining count of options */
13
  Object(c._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(c.sprintf)(
14
  /* translators: %s number of options to reveal. */
15
- Object(c._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[o,b,d]),O=Object(r.useMemo)(()=>d&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{m(!1)},"aria-expanded":!0,"aria-label":Object(c.__)("Show less options","woo-gutenberg-products-block")},Object(c.__)("Show less","woo-gutenberg-products-block"))),[d]),j=Object(r.useMemo)(()=>{const e=o.length>b+5;return Object(r.createElement)(r.Fragment,null,o.map((t,c)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!d&&c>=b&&{hidden:!0},Object(r.createElement)(a.CheckboxControl,{id:t.value,className:"wc-block-checkbox-list__checkbox",label:t.label,checked:s.includes(t.value),onChange:()=>{n(t.value)}})),e&&c===b-1&&g)),e&&O)},[o,n,s,d,b,O,g,u]),f=l()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":i},t);return Object(r.createElement)("ul",{className:f},i?p:j)}},22:function(e,t){e.exports=window.wp.isShallowEqual},223:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(5),c=n(95),o=n(35),l=n(152);const a=e=>{if(!Object(c.b)())return{className:"",style:{}};const t=Object(o.a)(e)?e:{},n=Object(l.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:n})}},23:function(e,t,n){"use strict";n.d(t,"o",(function(){return o})),n.d(t,"m",(function(){return l})),n.d(t,"l",(function(){return a})),n.d(t,"n",(function(){return s})),n.d(t,"j",(function(){return i})),n.d(t,"e",(function(){return u})),n.d(t,"f",(function(){return b})),n.d(t,"g",(function(){return d})),n.d(t,"k",(function(){return m})),n.d(t,"c",(function(){return p})),n.d(t,"d",(function(){return g})),n.d(t,"h",(function(){return O})),n.d(t,"a",(function(){return j})),n.d(t,"i",(function(){return f})),n.d(t,"b",(function(){return h}));var r,c=n(2);const o=Object(c.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),l=o.pluginUrl+"images/",a=o.pluginUrl+"build/",s=o.buildPhase,i=null===(r=c.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=c.STORE_PAGES.checkout.id,b=c.STORE_PAGES.checkout.permalink,d=c.STORE_PAGES.privacy.permalink,m=(c.STORE_PAGES.privacy.title,c.STORE_PAGES.terms.permalink),p=(c.STORE_PAGES.terms.title,c.STORE_PAGES.cart.id),g=c.STORE_PAGES.cart.permalink,O=(c.STORE_PAGES.myaccount.permalink?c.STORE_PAGES.myaccount.permalink:Object(c.getSetting)("wpLoginUrl","/wp-login.php"),Object(c.getSetting)("shippingCountries",{})),j=Object(c.getSetting)("allowedCountries",{}),f=Object(c.getSetting)("shippingStates",{}),h=Object(c.getSetting)("allowedStates",{})},237:function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter by Attribute","description":"Allow customers to filter the grid by product attribute, such as color.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"color":{"text":true,"background":false}},"example":{"attributes":{"isPreview":true}},"attributes":{"className":{"type":"string","default":""},"attributeId":{"type":"number","default":0},"showCounts":{"type":"boolean","default":true},"queryType":{"type":"string","default":"or"},"headingLevel":{"type":"number","default":3},"displayStyle":{"type":"string","default":"list"},"showFilterButton":{"type":"boolean","default":false},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},249:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return s})),n.d(t,"d",(function(){return i})),n.d(t,"c",(function(){return u}));var r=n(15),c=n(2),o=n(150);const l=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),a="query_type_",s="filter_";function i(e){return window?Object(r.getQueryArg)(window.location.href,e):null}function u(e){l?window.location.href=e:window.history.replaceState({},"",e)}},250:function(e,t){},251:function(e,t){},28:function(e,t,n){"use strict";var r=n(0),c=n(4),o=n.n(c);t.a=e=>{let t,{label:n,screenReaderLabel:c,wrapperElement:l,wrapperProps:a={}}=e;const s=null!=n,i=null!=c;return!s&&i?(t=l||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(r.createElement)(t,a,c)):(t=l||r.Fragment,s&&i&&n!==c?Object(r.createElement)(t,a,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},c)):Object(r.createElement)(t,a,n))}},3:function(e,t){e.exports=window.wp.components},312:function(e,t,n){"use strict";n.d(t,"a",(function(){return b}));var r=n(0),c=n(287),o=n(7),l=n(49),a=n(35),s=n(75),i=n(125),u=n(52);const b=e=>{let{queryAttribute:t,queryPrices:n,queryStock:b,queryState:d}=e,m=Object(u.a)();m+="-collection-data";const[p]=Object(s.a)(m),[g,O]=Object(s.b)("calculate_attribute_counts",[],m),[j,f]=Object(s.b)("calculate_price_range",null,m),[h,w]=Object(s.b)("calculate_stock_status_counts",null,m),_=Object(l.a)(t||{}),y=Object(l.a)(n),v=Object(l.a)(b);Object(r.useEffect)(()=>{"object"==typeof _&&Object.keys(_).length&&(g.find(e=>Object(a.b)(_,"taxonomy")&&e.taxonomy===_.taxonomy)||O([...g,_]))},[_,g,O]),Object(r.useEffect)(()=>{j!==y&&void 0!==y&&f(y)},[y,f,j]),Object(r.useEffect)(()=>{h!==v&&void 0!==v&&w(v)},[v,w,h]);const[E,k]=Object(r.useState)(!1),[S]=Object(c.a)(E,200);E||k(!0);const C=Object(r.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(o.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(p),[p]);return Object(i.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...d,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...C},shouldSelect:S})}},35:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return c}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return r(e)&&t in e}},36:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(6),c=n.n(r),o=n(0),l=n(19);const a=e=>{let{countLabel:t,className:n,depth:r=0,controlId:a="",item:s,isSelected:i,isSingle:u,onSelect:b,search:d="",...m}=e;const p=null!=t&&void 0!==s.count&&null!==s.count,g=[n,"woocommerce-search-list__item"];g.push("depth-"+r),u&&g.push("is-radio-button"),p&&g.push("has-count");const O=s.breadcrumbs&&s.breadcrumbs.length,j=m.name||"search-list-item-"+a,f=`${j}-${s.id}`;return Object(o.createElement)("label",{htmlFor:f,className:g.join(" ")},u?Object(o.createElement)("input",c()({type:"radio",id:f,name:j,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)):Object(o.createElement)("input",c()({type:"checkbox",id:f,name:j,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)),Object(o.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(o.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(l.b)(s.breadcrumbs)):null,Object(o.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(l.d)(s.name,d))),!!p&&Object(o.createElement)("span",{className:"woocommerce-search-list__item-count"},t||s.count))};t.b=a},393:function(e,t,n){e.exports=n(467)},394:function(e,t){},395:function(e,t){},396:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return a}));var r=n(35);const c=e=>Object(r.b)(e,"count")&&Object(r.b)(e,"description")&&Object(r.b)(e,"id")&&Object(r.b)(e,"name")&&Object(r.b)(e,"parent")&&Object(r.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,o=e=>Array.isArray(e)&&e.every(c),l=e=>Object(r.b)(e,"attribute")&&Object(r.b)(e,"operator")&&Object(r.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),a=e=>Array.isArray(e)&&e.every(l)},397:function(e,t){},46:function(e,t){e.exports=window.wp.a11y},467:function(e,t,n){"use strict";n.r(t);var r=n(6),c=n.n(r),o=n(0),l=n(1),a=n(8),s=n(5),i=n(95),u=n(113),b=n(512),d=n(4),m=n.n(d),p=n(239),g=n(97),O=n(7),j=n(2),f=n(99),h=n(120),w=n(3),_=n(223),y=n(49),v=n(109),E=n(75),k=n(125),S=n(312),C=n(208),x=n(106),N=n(146),T=n(147),A=n(22),L=n.n(A),P=n(14),R=n(286),B=n(15),F=n(150),I=n(100),V=n(35),M=n(396),q=n(529),G=n(249),H=n(544);n(397);var D=e=>{let{className:t,style:n,suggestions:r,multiple:l=!0,saveTransform:a=(e=>e.trim().replace(/\s/g,"-")),messages:s={},validateInput:i=(e=>r.includes(e)),label:u="",...b}=e;return Object(o.createElement)("div",{className:m()("wc-blocks-components-form-token-field-wrapper",t,{"single-selection":!l}),style:n},Object(o.createElement)(H.a,c()({label:u,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:i,saveTransform:a,maxLength:l?void 0:1,suggestions:r,messages:s},b)))},z=n(207),Q=n(173);const $=[{value:"preview-1",formattedValue:"preview-1",name:"Blue",label:Object(o.createElement)(x.a,{name:"Blue",count:3}),textLabel:"Blue (3)"},{value:"preview-2",formattedValue:"preview-2",name:"Green",label:Object(o.createElement)(x.a,{name:"Green",count:3}),textLabel:"Green (3)"},{value:"preview-3",formattedValue:"preview-3",name:"Red",label:Object(o.createElement)(x.a,{name:"Red",count:2}),textLabel:"Red (2)"}],U={id:0,name:"preview",taxonomy:"preview",label:"Preview"};function Y(){return Math.floor(Math.random()*Date.now())}n(395);const W=e=>e.replace("pa_",""),K=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:r,operator:c}=e,o=W(t),l=r.join(","),a=`${G.b}${o}`,s="in"===c?"or":"and";n[`${G.a}${o}`]=l,n[a]=s});const r=Object(B.removeQueryArgs)(e,...Object.keys(n));return Object(B.addQueryArgs)(r,n)},J=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,r]=t;return n.includes("query_type")?e:{...e,[n]:r}},{});return Object.entries(n).reduce((t,n)=>{let[r,c]=n;return e[r]===c&&t},!0)},Z=e=>e.trim().replace(/\s/g,"-").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,"");var X=e=>{let{attributes:t,isEditor:n=!1}=e;const r=Object(j.getSettingWithCoercion)("has_filterable_products",!1,F.a),c=Object(j.getSettingWithCoercion)("is_rendering_php_template",!1,F.a),a=Object(j.getSettingWithCoercion)("page_url",window.location.href,I.a),[s,i]=Object(o.useState)(!1),b=t.isPreview&&!t.attributeId?U:Object(z.a)(t.attributeId),d=Object(o.useMemo)(()=>(e=>{if(e){const t=Object(G.d)("filter_"+e.name);return"string"==typeof t?t.split(","):[]}return[]})(b),[b]),[p,g]=Object(o.useState)(d),[f,h]=Object(o.useState)(Y()),[w,A]=Object(o.useState)(t.isPreview&&!t.attributeId?$:[]),H=Object(_.a)(t),[X]=Object(E.a)(),[ee,te]=Object(E.b)("attributes",[]),{results:ne,isLoading:re}=Object(k.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==b?void 0:b.id)||0],shouldSelect:t.attributeId>0}),ce="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:oe,isLoading:le}=Object(S.a)({queryAttribute:{taxonomy:(null==b?void 0:b.taxonomy)||"",queryType:t.queryType},queryState:{...X,attributes:ce?X.attributes:null}}),ae=Object(o.useCallback)(e=>Object(V.b)(oe,"attribute_counts")&&Array.isArray(oe.attribute_counts)?oe.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[oe]);Object(o.useEffect)(()=>{if(re||le)return;if(!Array.isArray(ne))return;const e=ne.map(e=>{const n=ae(e.id);if(!(n||p.includes(e.slug)||(r=e.slug,null!=X&&X.attributes&&X.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==b?void 0:b.taxonomy)&&n.includes(r)}))))return null;var r;const c=n?n.count:0;return{formattedValue:Z(e.slug),value:e.slug,name:Object(P.decodeEntities)(e.name),label:Object(o.createElement)(x.a,{name:Object(P.decodeEntities)(e.name),count:t.showCounts?c:null}),textLabel:t.showCounts?`${Object(P.decodeEntities)(e.name)} (${c})`:Object(P.decodeEntities)(e.name)}}).filter(e=>!!e);A(e)},[null==b?void 0:b.taxonomy,ne,re,t.showCounts,le,ae,p,X.attributes]);const se=Object(o.useCallback)(e=>Array.isArray(ne)?ne.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[ne]),ie=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(null==b||!b.taxonomy)return;const t=Object.keys(Object(B.getQueryArgs)(window.location.href)),n=W(b.taxonomy),r=t.reduce((e,t)=>t.includes(G.b+n)||t.includes(G.a+n)?Object(B.removeQueryArgs)(e,t):e,window.location.href),c=K(r,e);Object(G.c)(c)}else{const t=K(a,e),n=Object(B.getQueryArgs)(window.location.href),r=Object(B.getQueryArgs)(t);J(n,r)||Object(G.c)(t)}}),[a,null==b?void 0:b.taxonomy]),ue=e=>{const n=Object(Q.b)(ee,te,b,se(e),"or"===t.queryType?"in":"and");ie(n,0===e.length)},be=Object(o.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||(g(e),!r&&t.showFilterButton||Object(Q.b)(ee,te,b,se(e),"or"===t.queryType?"in":"and"))}),[n,g,ee,te,b,se,t.queryType,t.showFilterButton]),de=Object(o.useMemo)(()=>Object(M.a)(ee)?ee.filter(e=>{let{attribute:t}=e;return t===(null==b?void 0:b.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[ee,null==b?void 0:b.taxonomy]),me=Object(y.a)(de),pe=Object(v.a)(me);Object(o.useEffect)(()=>{!pe||L()(pe,me)||L()(p,me)||be(me)},[p,me,pe,be]);const ge="single"!==t.selectType,Oe=Object(o.useCallback)(e=>{const t=p.includes(e);let n;ge?(n=p.filter(t=>t!==e),t||(n.push(e),n.sort())):n=t?[]:[e],be(n)},[p,ge,be]);if(Object(o.useEffect)(()=>{b&&!t.showFilterButton&&((e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length})({currentCheckedFilters:p,hasSetFilterDefaultsFromUrl:s})?ie(ee,!0):ie(ee,!1))},[s,ie,ee,b,p,t.showFilterButton]),Object(o.useEffect)(()=>{if(!s&&!re)return d.length>0?(i(!0),void be(d,!0)):void(c||i(!0))},[b,s,re,be,d,c]),!r)return null;if(!b)return n?Object(o.createElement)(R.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(l.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):null;if(0===w.length&&!re)return n?Object(o.createElement)(R.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(l.__)("The selected attribute does not have any term assigned to products.","woo-gutenberg-products-block"))):null;const je="h"+t.headingLevel,fe=!t.isPreview&&re,he=!t.isPreview&&le;return Object(o.createElement)(o.Fragment,null,!n&&t.heading&&w.length>0&&Object(o.createElement)(je,{className:"wc-block-attribute-filter__title"},t.heading),Object(o.createElement)("div",{className:"wc-block-attribute-filter style-"+t.displayStyle},"dropdown"===t.displayStyle?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(D,{key:f,className:m()(H.className,{"single-selection":!ge}),style:{...H.style,borderStyle:"none"},suggestions:w.filter(e=>!p.includes(e.value)).map(e=>e.formattedValue),disabled:he,placeholder:Object(l.sprintf)(
16
  /* translators: %s attribute name. */
17
- Object(l.__)("Select %s","woo-gutenberg-products-block"),b.label),onChange:e=>{!ge&&e.length>1&&(e=[e[e.length-1]]),e=e.map(e=>{const t=w.find(t=>t.formattedValue===e);return t?t.value:e});const t=Object(O.difference)(e,p);if(1===t.length)return Oe(t[0]);const n=Object(O.difference)(p,e);1===n.length&&Oe(n[0])},value:p,displayTransform:e=>{const t=w.find(t=>[t.value,t.formattedValue].includes(e));return t?t.textLabel:e},saveTransform:Z,messages:{added:Object(l.sprintf)(
18
  /* translators: %s is the attribute label. */
19
  Object(l.__)("%s filter added.","woo-gutenberg-products-block"),b.label),removed:Object(l.sprintf)(
20
  /* translators: %s is the attribute label. */
@@ -22,11 +22,11 @@ Object(l.__)("%s filter removed.","woo-gutenberg-products-block"),b.label),remov
22
  /* translators: %s is the attribute label. */
23
  Object(l.__)("Remove %s filter.","woo-gutenberg-products-block"),b.label.toLocaleLowerCase()),__experimentalInvalid:Object(l.sprintf)(
24
  /* translators: %s is the attribute label. */
25
- Object(l.__)("Invalid %s filter.","woo-gutenberg-products-block"),b.label.toLocaleLowerCase())}}),ge&&Object(o.createElement)(u.a,{icon:q.a,size:30})):Object(o.createElement)(C.a,{className:"wc-block-attribute-filter-list",options:w,checked:p,onChange:Oe,isLoading:fe,isDisabled:he})),Object(o.createElement)("div",{className:"wc-block-attribute-filter__actions"},p.length>0&&Object(o.createElement)(N.a,{onClick:()=>{g([]),h(Y()),s&&ue([])},screenReaderLabel:Object(l.__)("Reset attribute filter","woo-gutenberg-products-block")}),t.showFilterButton&&Object(o.createElement)(T.a,{className:"wc-block-attribute-filter__button",disabled:fe||he||0===p.length,onClick:()=>ue(p)})))};n(394);const ee=Object(j.getSetting)("attributes",[]);var te=Object(w.withSpokenMessages)(e=>{let{attributes:t,setAttributes:n,debouncedSpeak:r}=e;const{attributeId:c,className:a,displayStyle:i,heading:d,headingLevel:_,isPreview:y,queryType:v,showCounts:E,showFilterButton:k,selectType:S}=t,[C,x]=Object(o.useState)(!c&&!y),N=Object(s.useBlockProps)(),T=e=>{if(!e||!e.length)return;const t=e[0].id,r=ee.find(e=>e.attribute_id===t.toString());if(!r||c===t)return;const o=r.attribute_label;n({attributeId:t,heading:Object(l.sprintf)(
26
  /* translators: %s attribute name. */
27
  Object(l.__)("Filter by %s","woo-gutenberg-products-block"),o)})},A=e=>{let{isCompact:t}=e;const n={clear:Object(l.__)("Clear selected attribute","woo-gutenberg-products-block"),list:Object(l.__)("Product Attributes","woo-gutenberg-products-block"),noItems:Object(l.__)("Your store doesn't have any product attributes.","woo-gutenberg-products-block"),search:Object(l.__)("Search for a product attribute:","woo-gutenberg-products-block"),selected:e=>Object(l.sprintf)(
28
  /* translators: %d is the number of attributes selected. */
29
- Object(l._n)("%d attribute selected","%d attributes selected",e,"woo-gutenberg-products-block"),e),updated:Object(l.__)("Product attribute search results updated.","woo-gutenberg-products-block")},r=Object(O.sortBy)(ee.map(e=>({id:parseInt(e.attribute_id,10),name:e.attribute_label})),"name");return Object(o.createElement)(g.a,{className:"woocommerce-product-attributes",list:r,selected:r.filter(e=>{let{id:t}=e;return t===c}),onChange:T,messages:n,isSingle:!0,isCompact:t})};return 0===Object.keys(ee).length?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on a chosen attribute.","woo-gutenberg-products-block")},Object(o.createElement)("p",null,Object(l.__)("Attributes are needed for filtering your products. You haven't created any attributes yet.","woo-gutenberg-products-block")),Object(o.createElement)(w.Button,{className:"wc-block-attribute-filter__add-attribute-button",isSecondary:!0,href:Object(j.getAdminLink)("edit.php?post_type=product&page=product_attributes")},Object(l.__)("Add new attribute","woo-gutenberg-products-block")+" ",Object(o.createElement)(u.a,{icon:p.a})),Object(o.createElement)(w.Button,{className:"wc-block-attribute-filter__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-product-taxonomies/"},Object(l.__)("Learn more","woo-gutenberg-products-block"))):Object(o.createElement)("div",N,Object(o.createElement)(s.BlockControls,null,Object(o.createElement)(w.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit","woo-gutenberg-products-block"),onClick:()=>x(!C),isActive:C}]})),Object(o.createElement)(s.InspectorControls,{key:"inspector"},Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Display Settings","woo-gutenberg-products-block")},Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Include product count","woo-gutenberg-products-block"),help:E?Object(l.__)("Show the product count with results.","woo-gutenberg-products-block"):Object(l.__)("Product count is hidden.","woo-gutenberg-products-block"),checked:E,onChange:()=>n({showCounts:!E})}),Object(o.createElement)("p",null,Object(l.__)("Heading Level","woo-gutenberg-products-block")),Object(o.createElement)(f.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:_,onChange:e=>n({headingLevel:e})}),Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Allow selecting multiple options?","woo-gutenberg-products-block"),value:S||"multiple",onChange:e=>n({selectType:e}),className:"wc-block-attribute-filter__multiple-toggle"},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"multiple",label:Object(l.__)("Multiple","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"single",label:Object(l.__)("Single","woo-gutenberg-products-block")})),"multiple"===S&&Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Filter Conditions","woo-gutenberg-products-block"),help:"and"===v?Object(l.__)("Choose to return filter results for all of the attributes selected.","woo-gutenberg-products-block"):Object(l.__)("Choose to return filter results for any of the attributes selected.","woo-gutenberg-products-block"),value:v,onChange:e=>n({queryType:e}),className:"wc-block-attribute-filter__conditions-toggle"},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"and",label:Object(l.__)("All","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"or",label:Object(l.__)("Any","woo-gutenberg-products-block")})),Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:i,onChange:e=>n({displayStyle:e}),className:"wc-block-attribute-filter__display-toggle"},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"list",label:Object(l.__)("List","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"dropdown",label:Object(l.__)("Dropdown","woo-gutenberg-products-block")})),Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Show 'Apply filters' button","woo-gutenberg-products-block"),help:k?Object(l.__)("Products will only update when the button is pressed.","woo-gutenberg-products-block"):Object(l.__)("Products will update as options are selected.","woo-gutenberg-products-block"),checked:k,onChange:e=>n({showFilterButton:e})})),Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Content Settings","woo-gutenberg-products-block"),initialOpen:!1},A({isCompact:!0}))),C?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on a chosen attribute.","woo-gutenberg-products-block")},Object(o.createElement)("div",{className:"wc-block-attribute-filter__selection"},A({isCompact:!1}),Object(o.createElement)(w.Button,{isPrimary:!0,onClick:()=>{x(!1),r(Object(l.__)("Showing Filter by Attribute block preview.","woo-gutenberg-products-block"))}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(o.createElement)("div",{className:m()(a,"wc-block-attribute-filter")},Object(o.createElement)(h.a,{className:"wc-block-attribute-filter__title",headingLevel:_,heading:d,onChange:e=>n({heading:e})}),Object(o.createElement)(w.Disabled,null,Object(o.createElement)(X,{attributes:t,isEditor:!0}))))});const ne={heading:{type:"string",default:Object(l.__)("Filter by attribute","woo-gutenberg-products-block")}};var re=n(237);Object(a.registerBlockType)(re,{title:Object(l.__)("Filter by Attribute","woo-gutenberg-products-block"),description:Object(l.__)("Allow customers to filter the grid by product attribute, such as color.","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(u.a,{icon:b.a,className:"wc-block-editor-components-block-icon"})},supports:{...re.supports,...Object(i.b)()&&{__experimentalBorder:{radius:!1,color:!0,width:!1}}},attributes:{...re.attributes,...ne},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:n}=e;return"woocommerce_layered_nav"===t&&!(null==n||!n.raw)},transform:e=>{var t,n,r,c;let{instance:o}=e;return Object(a.createBlock)("woocommerce/attribute-filter",{attributeId:0,showCounts:!0,queryType:(null==o||null===(t=o.raw)||void 0===t?void 0:t.query_type)||"or",heading:(null==o||null===(n=o.raw)||void 0===n?void 0:n.title)||Object(l.__)("Filter by attribute","woo-gutenberg-products-block"),headingLevel:3,displayStyle:(null==o||null===(r=o.raw)||void 0===r?void 0:r.display_type)||"list",showFilterButton:!1,selectType:(null==o||null===(c=o.raw)||void 0===c?void 0:c.select_type)||"multiple",isPreview:!1})}}]},edit:te,save(e){let{attributes:t}=e;const{className:n,showCounts:r,queryType:l,attributeId:a,heading:i,headingLevel:u,displayStyle:b,showFilterButton:d,selectType:p}=t,g={"data-attribute-id":a,"data-show-counts":r,"data-query-type":l,"data-heading":i,"data-heading-level":u};return"list"!==b&&(g["data-display-style"]=b),d&&(g["data-show-filter-button"]=d),"single"===p&&(g["data-select-type"]=p),Object(o.createElement)("div",c()({},s.useBlockProps.save({className:m()("is-loading",n)}),g),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-attribute-filter__placeholder"}))}})},49:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(0),c=n(22),o=n.n(c);function l(e){const t=Object(r.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},5:function(e,t){e.exports=window.wp.blockEditor},51:function(e,t){e.exports=window.wp.deprecated},52:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0);const c=Object(r.createContext)("page"),o=()=>Object(r.useContext)(c);c.Provider},53:function(e,t){e.exports=window.wp.keycodes},7:function(e,t){e.exports=window.lodash},71:function(e,t){e.exports=window.wp.dom},75:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return d})),n.d(t,"c",(function(){return m}));var r=n(17),c=n(9),o=n(0),l=n(22),a=n.n(l),s=n(49),i=n(109),u=n(52);const b=e=>{const t=Object(u.a)();e=e||t;const n=Object(c.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(c.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(o.useCallback)(t=>{l(e,t)},[e,l])]},d=(e,t,n)=>{const l=Object(u.a)();n=n||l;const a=Object(c.useSelect)(c=>c(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:s}=Object(c.useDispatch)(r.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{s(n,e,t)},[n,e,s])]},m=(e,t)=>{const n=Object(u.a)();t=t||n;const[r,c]=b(t),l=Object(s.a)(r),d=Object(s.a)(e),m=Object(i.a)(d),p=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(m,d)||(c(Object.assign({},l,d)),p.current=!0)},[l,d,m,c]),p.current?[r,c]:[e,c]}},8:function(e,t){e.exports=window.wp.blocks},9:function(e,t){e.exports=window.wp.data},95:function(e,t,n){"use strict";n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return a}));var r=n(8),c=n(23);const o=(e,t)=>{if(c.n>2)return Object(r.registerBlockType)(e,t)},l=()=>c.n>2,a=()=>c.n>1},97:function(e,t,n){"use strict";n.d(t,"a",(function(){return v}));var r=n(6),c=n.n(r),o=n(0),l=n(1),a=n(3),s=n(113),i=n(506),u=n(4),b=n.n(u),d=n(10),m=n(19),p=n(36),g=n(505),O=n(14);const j=e=>{let{id:t,label:n,popoverContents:r,remove:c,screenReaderLabel:i,className:u=""}=e;const[m,p]=Object(o.useState)(!1),f=Object(d.useInstanceId)(j);if(i=i||n,!n)return null;n=Object(O.decodeEntities)(n);const h=b()("woocommerce-tag",u,{"has-remove":!!c}),w="woocommerce-tag__label-"+f,_=Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},i),Object(o.createElement)("span",{"aria-hidden":"true"},n));return Object(o.createElement)("span",{className:h},r?Object(o.createElement)(a.Button,{className:"woocommerce-tag__text",id:w,onClick:()=>p(!0)},_):Object(o.createElement)("span",{className:"woocommerce-tag__text",id:w},_),r&&m&&Object(o.createElement)(a.Popover,{onClose:()=>p(!1)},r),c&&Object(o.createElement)(a.Button,{className:"woocommerce-tag__remove",onClick:c(t),label:Object(l.sprintf)(// Translators: %s label.
30
  Object(l.__)("Remove %s","woo-gutenberg-products-block"),n),"aria-describedby":w},Object(o.createElement)(s.a,{icon:g.a,size:20,className:"clear-icon"})))};var f=j;const h=e=>Object(o.createElement)(p.b,e),w=e=>{const{list:t,selected:n,renderItem:r,depth:l=0,onSelect:a,instanceId:s,isSingle:i,search:u}=e;return t?Object(o.createElement)(o.Fragment,null,t.map(t=>{const b=-1!==n.findIndex(e=>{let{id:n}=e;return n===t.id});return Object(o.createElement)(o.Fragment,{key:t.id},Object(o.createElement)("li",null,r({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(o.createElement)(w,c()({},e,{list:t.children,depth:l+1})))})):null},_=e=>{let{isLoading:t,isSingle:n,selected:r,messages:c,onChange:s,onRemove:i}=e;if(t||n||!r)return null;const u=r.length;return Object(o.createElement)("div",{className:"woocommerce-search-list__selected"},Object(o.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(o.createElement)("strong",null,c.selected(u)),u>0?Object(o.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":c.clear},Object(l.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(o.createElement)("ul",null,r.map((e,t)=>Object(o.createElement)("li",{key:t},Object(o.createElement)(f,{label:e.name,id:e.id,remove:i})))):null)},y=e=>{let{filteredList:t,search:n,onSelect:r,instanceId:c,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:m}=a,p=b||h;return 0===t.length?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(o.createElement)(s.a,{icon:i.a})),Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-text"},n?Object(l.sprintf)(u.noResults,n):u.noItems)):Object(o.createElement)("ul",{className:"woocommerce-search-list__list"},Object(o.createElement)(w,{list:t,selected:d,renderItem:p,onSelect:r,instanceId:c,isSingle:m,search:n}))},v=e=>{const{className:t="",isCompact:n,isHierarchical:r,isLoading:l,isSingle:s,list:i,messages:u=m.a,onChange:p,onSearch:g,selected:O,debouncedSpeak:j}=e,[f,h]=Object(o.useState)(""),w=Object(d.useInstanceId)(v),E=Object(o.useMemo)(()=>({...m.a,...u}),[u]),k=Object(o.useMemo)(()=>Object(m.c)(i,f,r),[i,f,r]);Object(o.useEffect)(()=>{j&&j(E.updated)},[j,E]),Object(o.useEffect)(()=>{"function"==typeof g&&g(f)},[f,g]);const S=Object(o.useCallback)(e=>()=>{s&&p([]);const t=O.findIndex(t=>{let{id:n}=t;return n===e});p([...O.slice(0,t),...O.slice(t+1)])},[s,O,p]),C=Object(o.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:n}=t;return n===e.id})?p(s?[e]:[...O,e]):S(e.id)()},[s,S,p,O]);return Object(o.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":n})},Object(o.createElement)(_,c()({},e,{onRemove:S,messages:E})),Object(o.createElement)("div",{className:"woocommerce-search-list__search"},Object(o.createElement)(a.TextControl,{label:E.search,type:"search",value:f,onChange:e=>h(e)})),l?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(o.createElement)(a.Spinner,null)):Object(o.createElement)(y,c()({},e,{search:f,filteredList:k,messages:E,onSelect:C,instanceId:w})))};Object(a.withSpokenMessages)(v)},99:function(e,t,n){"use strict";var r=n(0),c=n(7),o=n(1),l=n(3),a=n(11);function s(e){let{level:t}=e;const n={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return n.hasOwnProperty(t)?Object(r.createElement)(a.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(a.Path,{d:n[t]})):null}class i extends r.Component{createLevelControl(e,t,n){const c=e===t;return{icon:Object(r.createElement)(s,{level:e}),title:Object(o.sprintf)(
31
  /* translators: %s: heading level e.g: "2", "3", "4" */
32
  Object(o.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:c,onClick:()=>n(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:n,selectedLevel:o,onChange:a}=this.props;return Object(r.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(r.createElement)(s,{level:o}),controls:Object(c.range)(t,n).map(e=>this.createLevelControl(e,o,a))})}}t.a=i}});
1
+ this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["attribute-filter"]=function(e){function t(t){for(var r,l,a=t[0],s=t[1],i=t[2],b=0,d=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(c,l)&&c[l]&&d.push(c[l][0]),c[l]=0;for(r in s)Object.prototype.hasOwnProperty.call(s,r)&&(e[r]=s[r]);for(u&&u(t);d.length;)d.shift()();return o.push.apply(o,i||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],r=!0,a=1;a<n.length;a++){var s=n[a];0!==c[s]&&(r=!1)}r&&(o.splice(t--,1),e=l(l.s=n[0]))}return e}var r={},c={8:0,1:0},o=[];function l(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,l),n.l=!0,n.exports}l.m=e,l.c=r,l.d=function(e,t,n){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(l.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)l.d(n,r,function(t){return e[t]}.bind(null,r));return n},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],s=a.push.bind(a);a.push=t,a=a.slice();for(var i=0;i<a.length;i++)t(a[i]);var u=s;return o.push([395,0]),n()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){e.exports=window.wp.compose},100:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"string"==typeof e},101:function(e,t){e.exports=window.wp.warning},106:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(28);n(252),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,null!==n&&Number.isFinite(n)&&Object(r.createElement)(o.a,{label:n.toString(),screenReaderLabel:Object(c.sprintf)(
2
  /* translators: %s number of products. */
3
+ Object(c._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},109:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(12);function c(e,t){const n=Object(r.useRef)();return Object(r.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},11:function(e,t){e.exports=window.wp.primitives},12:function(e,t){e.exports=window.React},120:function(e,t,n){"use strict";var r=n(0),c=n(5),o=n(10),l=n(1);n(161),t.a=Object(o.withInstanceId)(e=>{let{className:t,headingLevel:n,onChange:o,heading:a,instanceId:s}=e;const i="h"+n;return Object(r.createElement)(i,{className:t},Object(r.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+s},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(r.createElement)(c.PlainText,{id:"block-title-"+s,className:"wc-block-editor-components-title",value:a,onChange:o}))})},121:function(e,t,n){"use strict";var r=n(0);n(162),t.a=e=>{let{children:t}=e;return Object(r.createElement)("div",{className:"wc-block-filter-title-placeholder"},t)}},125:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0);const c=()=>{const[,e]=Object(r.useState)();return Object(r.useCallback)(t=>{e(()=>{throw t})},[])}},126:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var r=n(17),c=n(9),o=n(0),l=n(49),a=n(125);const s=e=>{const{namespace:t,resourceName:n,resourceValues:s=[],query:i={},shouldSelect:u=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const b=Object(o.useRef)({results:[],isLoading:!0}),d=Object(l.a)(i),m=Object(l.a)(s),p=Object(a.a)(),g=Object(c.useSelect)(e=>{if(!u)return null;const c=e(r.COLLECTIONS_STORE_KEY),o=[t,n,d,m],l=c.getCollectionError(...o);if(l){if(!(l instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");p(l)}return{results:c.getCollection(...o),isLoading:!c.hasFinishedResolution("getCollection",o)}},[t,n,m,d,u]);return null!==g&&(b.current=g),b.current}},136:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));const r=e=>"boolean"==typeof e},14:function(e,t){e.exports=window.wp.htmlEntities},148:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(4),l=n.n(o),a=n(28);n(188),t.a=e=>{let{className:t,label:
4
  /* translators: Reset button text for filters. */
5
+ n=Object(c.__)("Reset","woo-gutenberg-products-block"),onClick:o,screenReaderLabel:s=Object(c.__)("Reset filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{className:l()("wc-block-components-filter-reset-button",t),onClick:o},Object(r.createElement)(a.a,{label:n,screenReaderLabel:s}))}},149:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(4),l=n.n(o),a=n(28);n(189),t.a=e=>{let{className:t,isLoading:n,disabled:o,label:
6
  /* translators: Submit button text for filters. */
7
+ s=Object(c.__)("Apply","woo-gutenberg-products-block"),onClick:i,screenReaderLabel:u=Object(c.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:l()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":n},t),disabled:o,onClick:i},Object(r.createElement)(a.a,{label:s,screenReaderLabel:u}))}},15:function(e,t){e.exports=window.wp.url},153:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(100),c=n(35);const o=e=>Object(r.a)(e)?JSON.parse(e)||{}:Object(c.a)(e)?e:{}},161:function(e,t){},162:function(e,t){},17:function(e,t){e.exports=window.wc.wcBlocksData},175:function(e,t,n){"use strict";n.d(t,"a",(function(){return c})),n.d(t,"b",(function(){return o}));var r=n(7);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";const o=e.filter(e=>e.attribute===n.taxonomy),l=o.length?o[0]:null;if(!(l&&l.slug&&Array.isArray(l.slug)&&l.slug.includes(c)))return;const a=l.slug.filter(e=>e!==c),s=e.filter(e=>e.attribute!==n.taxonomy);a.length>0&&(l.slug=a.sort(),s.push(l)),t(Object(r.sortBy)(s,"attribute"))},o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!n||!n.taxonomy)return[];const l=e.filter(e=>e.attribute!==n.taxonomy);return 0===c.length?t(l):(l.push({attribute:n.taxonomy,operator:o,slug:c.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(r.sortBy)(l,"attribute"))),l}},18:function(e,t){e.exports=window.wc.blocksCheckout},188:function(e,t){},189:function(e,t){},19:function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"c",(function(){return s})),n.d(t,"d",(function(){return i})),n.d(t,"b",(function(){return u}));var r=n(0),c=n(7),o=n(1);const l={clear:Object(o.__)("Clear all selected items","woo-gutenberg-products-block"),noItems:Object(o.__)("No items found.","woo-gutenberg-products-block"),
8
  /* Translators: %s search term */
9
  noResults:Object(o.__)("No results for %s","woo-gutenberg-products-block"),search:Object(o.__)("Search for items","woo-gutenberg-products-block"),selected:e=>Object(o.sprintf)(
10
  /* translators: Number of items selected from list. */
11
+ Object(o._n)("%d item selected","%d items selected",e,"woo-gutenberg-products-block"),e),updated:Object(o.__)("Search results updated.","woo-gutenberg-products-block")},a=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;const n=Object(c.groupBy)(e,"parent"),r=Object(c.keyBy)(t,"id"),o=["0"],l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!e.parent)return e.name?[e.name]:[];const t=l(r[e.parent]);return[...t,e.name]},a=e=>e.map(e=>{const t=n[e.id];return o.push(""+e.id),{...e,breadcrumbs:l(r[e.parent]),children:t&&t.length?a(t):[]}}),s=a(n[0]||[]);return Object.entries(n).forEach(e=>{let[t,n]=e;o.includes(t)||s.push(...a(n||[]))}),s},s=(e,t,n)=>{if(!t)return n?a(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),c=e.map(e=>!!r.test(e.name)&&e).filter(Boolean);return n?a(c,e):c},i=(e,t)=>{if(!t)return e;const n=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(n).map((e,t)=>n.test(e)?Object(r.createElement)("strong",{key:t},e):Object(r.createElement)(r.Fragment,{key:t},e))},u=e=>1===e.length?e.slice(0,1).toString():2===e.length?e.slice(0,1).toString()+" › "+e.slice(-1).toString():e.slice(0,1).toString()+" … "+e.slice(-1).toString()},2:function(e,t){e.exports=window.wc.wcSettings},209:function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return l}));var r=n(2);const c=Object(r.getSetting)("attributes",[]).reduce((e,t)=>{const n=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label}:null;var r;return n&&n.id&&e.push(n),e},[]),o=e=>{if(e)return c.find(t=>t.id===e)},l=e=>{if(e)return c.find(t=>t.taxonomy===e)}},210:function(e,t,n){"use strict";var r=n(0),c=n(1),o=n(4),l=n.n(o),a=n(18);n(253),t.a=e=>{let{className:t,onChange:n,options:o=[],checked:s=[],isLoading:i=!1,isDisabled:u=!1,limit:b=10}=e;const[d,m]=Object(r.useState)(!1),p=Object(r.useMemo)(()=>[...Array(5)].map((e,t)=>Object(r.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),g=Object(r.useMemo)(()=>{const e=o.length-b;return!d&&Object(r.createElement)("li",{key:"show-more",className:"show-more"},Object(r.createElement)("button",{onClick:()=>{m(!0)},"aria-expanded":!1,"aria-label":Object(c.sprintf)(
12
  /* translators: %s is referring the remaining count of options */
13
  Object(c._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(c.sprintf)(
14
  /* translators: %s number of options to reveal. */
15
+ Object(c._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[o,b,d]),O=Object(r.useMemo)(()=>d&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{m(!1)},"aria-expanded":!0,"aria-label":Object(c.__)("Show less options","woo-gutenberg-products-block")},Object(c.__)("Show less","woo-gutenberg-products-block"))),[d]),j=Object(r.useMemo)(()=>{const e=o.length>b+5;return Object(r.createElement)(r.Fragment,null,o.map((t,c)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!d&&c>=b&&{hidden:!0},Object(r.createElement)(a.CheckboxControl,{id:t.value,className:"wc-block-checkbox-list__checkbox",label:t.label,checked:s.includes(t.value),onChange:()=>{n(t.value)}})),e&&c===b-1&&g)),e&&O)},[o,n,s,d,b,O,g,u]),f=l()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":i},t);return Object(r.createElement)("ul",{className:f},i?p:j)}},22:function(e,t){e.exports=window.wp.isShallowEqual},225:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(5),c=n(95),o=n(35),l=n(153);const a=e=>{if(!Object(c.b)())return{className:"",style:{}};const t=Object(o.a)(e)?e:{},n=Object(l.a)(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:n})}},23:function(e,t,n){"use strict";n.d(t,"o",(function(){return o})),n.d(t,"m",(function(){return l})),n.d(t,"l",(function(){return a})),n.d(t,"n",(function(){return s})),n.d(t,"j",(function(){return i})),n.d(t,"e",(function(){return u})),n.d(t,"f",(function(){return b})),n.d(t,"g",(function(){return d})),n.d(t,"k",(function(){return m})),n.d(t,"c",(function(){return p})),n.d(t,"d",(function(){return g})),n.d(t,"h",(function(){return O})),n.d(t,"a",(function(){return j})),n.d(t,"i",(function(){return f})),n.d(t,"b",(function(){return h}));var r,c=n(2);const o=Object(c.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),l=o.pluginUrl+"images/",a=o.pluginUrl+"build/",s=o.buildPhase,i=null===(r=c.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,u=c.STORE_PAGES.checkout.id,b=c.STORE_PAGES.checkout.permalink,d=c.STORE_PAGES.privacy.permalink,m=(c.STORE_PAGES.privacy.title,c.STORE_PAGES.terms.permalink),p=(c.STORE_PAGES.terms.title,c.STORE_PAGES.cart.id),g=c.STORE_PAGES.cart.permalink,O=(c.STORE_PAGES.myaccount.permalink?c.STORE_PAGES.myaccount.permalink:Object(c.getSetting)("wpLoginUrl","/wp-login.php"),Object(c.getSetting)("shippingCountries",{})),j=Object(c.getSetting)("allowedCountries",{}),f=Object(c.getSetting)("shippingStates",{}),h=Object(c.getSetting)("allowedStates",{})},239:function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter by Attribute","description":"Enable customers to filter the product grid by selecting one or more attributes, such as color.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"color":{"text":true,"background":false}},"example":{"attributes":{"isPreview":true}},"attributes":{"className":{"type":"string","default":""},"attributeId":{"type":"number","default":0},"showCounts":{"type":"boolean","default":true},"queryType":{"type":"string","default":"or"},"headingLevel":{"type":"number","default":3},"displayStyle":{"type":"string","default":"list"},"showFilterButton":{"type":"boolean","default":false},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},251:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return s})),n.d(t,"d",(function(){return i})),n.d(t,"c",(function(){return u}));var r=n(15),c=n(2),o=n(136);const l=Object(c.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),a="query_type_",s="filter_";function i(e){return window?Object(r.getQueryArg)(window.location.href,e):null}function u(e){l?window.location.href=e:window.history.replaceState({},"",e)}},252:function(e,t){},253:function(e,t){},28:function(e,t,n){"use strict";var r=n(0),c=n(4),o=n.n(c);t.a=e=>{let t,{label:n,screenReaderLabel:c,wrapperElement:l,wrapperProps:a={}}=e;const s=null!=n,i=null!=c;return!s&&i?(t=l||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(r.createElement)(t,a,c)):(t=l||r.Fragment,s&&i&&n!==c?Object(r.createElement)(t,a,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},c)):Object(r.createElement)(t,a,n))}},3:function(e,t){e.exports=window.wp.components},314:function(e,t,n){"use strict";n.d(t,"a",(function(){return b}));var r=n(0),c=n(289),o=n(7),l=n(49),a=n(35),s=n(75),i=n(126),u=n(52);const b=e=>{let{queryAttribute:t,queryPrices:n,queryStock:b,queryState:d}=e,m=Object(u.a)();m+="-collection-data";const[p]=Object(s.a)(m),[g,O]=Object(s.b)("calculate_attribute_counts",[],m),[j,f]=Object(s.b)("calculate_price_range",null,m),[h,w]=Object(s.b)("calculate_stock_status_counts",null,m),_=Object(l.a)(t||{}),y=Object(l.a)(n),v=Object(l.a)(b);Object(r.useEffect)(()=>{"object"==typeof _&&Object.keys(_).length&&(g.find(e=>Object(a.b)(_,"taxonomy")&&e.taxonomy===_.taxonomy)||O([...g,_]))},[_,g,O]),Object(r.useEffect)(()=>{j!==y&&void 0!==y&&f(y)},[y,f,j]),Object(r.useEffect)(()=>{h!==v&&void 0!==v&&w(v)},[v,w,h]);const[E,k]=Object(r.useState)(!1),[S]=Object(c.a)(E,200);E||k(!0);const C=Object(r.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(o.sortBy)(e.calculate_attribute_counts.map(e=>{let{taxonomy:t,queryType:n}=e;return{taxonomy:t,query_type:n}}),["taxonomy","query_type"])),t})(p),[p]);return Object(i.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...d,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...C},shouldSelect:S})}},35:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return c}));const r=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function c(e,t){return r(e)&&t in e}},36:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(6),c=n.n(r),o=n(0),l=n(19);const a=e=>{let{countLabel:t,className:n,depth:r=0,controlId:a="",item:s,isSelected:i,isSingle:u,onSelect:b,search:d="",...m}=e;const p=null!=t&&void 0!==s.count&&null!==s.count,g=[n,"woocommerce-search-list__item"];g.push("depth-"+r),u&&g.push("is-radio-button"),p&&g.push("has-count");const O=s.breadcrumbs&&s.breadcrumbs.length,j=m.name||"search-list-item-"+a,f=`${j}-${s.id}`;return Object(o.createElement)("label",{htmlFor:f,className:g.join(" ")},u?Object(o.createElement)("input",c()({type:"radio",id:f,name:j,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)):Object(o.createElement)("input",c()({type:"checkbox",id:f,name:j,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},m)),Object(o.createElement)("span",{className:"woocommerce-search-list__item-label"},O?Object(o.createElement)("span",{className:"woocommerce-search-list__item-prefix"},Object(l.b)(s.breadcrumbs)):null,Object(o.createElement)("span",{className:"woocommerce-search-list__item-name"},Object(l.d)(s.name,d))),!!p&&Object(o.createElement)("span",{className:"woocommerce-search-list__item-count"},t||s.count))};t.b=a},395:function(e,t,n){e.exports=n(467)},396:function(e,t){},397:function(e,t){},398:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return a}));var r=n(35);const c=e=>Object(r.b)(e,"count")&&Object(r.b)(e,"description")&&Object(r.b)(e,"id")&&Object(r.b)(e,"name")&&Object(r.b)(e,"parent")&&Object(r.b)(e,"slug")&&"number"==typeof e.count&&"string"==typeof e.description&&"number"==typeof e.id&&"string"==typeof e.name&&"number"==typeof e.parent&&"string"==typeof e.slug,o=e=>Array.isArray(e)&&e.every(c),l=e=>Object(r.b)(e,"attribute")&&Object(r.b)(e,"operator")&&Object(r.b)(e,"slug")&&"string"==typeof e.attribute&&"string"==typeof e.operator&&Array.isArray(e.slug)&&e.slug.every(e=>"string"==typeof e),a=e=>Array.isArray(e)&&e.every(l)},399:function(e,t){},46:function(e,t){e.exports=window.wp.a11y},467:function(e,t,n){"use strict";n.r(t);var r=n(6),c=n.n(r),o=n(0),l=n(1),a=n(8),s=n(5),i=n(95),u=n(113),b=n(514),d=n(4),m=n.n(d),p=n(241),g=n(97),O=n(7),j=n(2),f=n(99),h=n(120),w=n(3),_=n(225),y=n(49),v=n(109),E=n(75),k=n(126),S=n(314),C=n(106),x=n(148),N=n(149),T=n(22),A=n.n(T),L=n(14),P=n(288),R=n(15),F=n(136),B=n(100),I=n(35),V=n(398),M=n(531),q=n(251),G=n(546);n(399);var H=e=>{let{className:t,style:n,suggestions:r,multiple:l=!0,saveTransform:a=(e=>e.trim().replace(/\s/g,"-")),messages:s={},validateInput:i=(e=>r.includes(e)),label:u="",...b}=e;return Object(o.createElement)("div",{className:m()("wc-blocks-components-form-token-field-wrapper",t,{"single-selection":!l}),style:n},Object(o.createElement)(G.a,c()({label:u,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:i,saveTransform:a,maxLength:l?void 0:1,suggestions:r,messages:s},b)))},D=n(121),z=n(209),Q=n(175);const $=[{value:"preview-1",formattedValue:"preview-1",name:"Blue",label:Object(o.createElement)(C.a,{name:"Blue",count:3}),textLabel:"Blue (3)"},{value:"preview-2",formattedValue:"preview-2",name:"Green",label:Object(o.createElement)(C.a,{name:"Green",count:3}),textLabel:"Green (3)"},{value:"preview-3",formattedValue:"preview-3",name:"Red",label:Object(o.createElement)(C.a,{name:"Red",count:2}),textLabel:"Red (2)"}],U={id:0,name:"preview",taxonomy:"preview",label:"Preview"};function Y(){return Math.floor(Math.random()*Date.now())}n(397);const W=e=>e.replace("pa_",""),K=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:r,operator:c}=e,o=W(t),l=r.join(","),a=`${q.b}${o}`,s="in"===c?"or":"and";n[`${q.a}${o}`]=l,n[a]=s});const r=Object(R.removeQueryArgs)(e,...Object.keys(n));return Object(R.addQueryArgs)(r,n)},J=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,r]=t;return n.includes("query_type")?e:{...e,[n]:r}},{});return Object.entries(n).reduce((t,n)=>{let[r,c]=n;return e[r]===c&&t},!0)},Z=e=>e.trim().replace(/\s/g,"-").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,"");var X=n(210),ee=e=>{let{isLoading:t=!1,options:n,checked:r,onChange:c}=e;return t?Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"is-loading"}),Object(o.createElement)("span",{className:"is-loading"})):Object(o.createElement)(X.a,{className:"wc-block-attribute-filter-list",options:n,checked:r,onChange:c,isLoading:t,isDisabled:t})},te=e=>{let{attributes:t,isEditor:n=!1}=e;const r=Object(j.getSettingWithCoercion)("has_filterable_products",!1,F.a),c=Object(j.getSettingWithCoercion)("is_rendering_php_template",!1,F.a),a=Object(j.getSettingWithCoercion)("page_url",window.location.href,B.a),[s,i]=Object(o.useState)(!1),b=t.isPreview&&!t.attributeId?U:Object(z.a)(t.attributeId),d=Object(o.useMemo)(()=>(e=>{if(e){const t=Object(q.d)("filter_"+e.name);return"string"==typeof t?t.split(","):[]}return[]})(b),[b]),[p,g]=Object(o.useState)(d),[f,h]=Object(o.useState)(Y()),[w,T]=Object(o.useState)(t.isPreview&&!t.attributeId?$:[]),G=Object(_.a)(t),[X]=Object(E.a)(),[te,ne]=Object(E.b)("attributes",[]),{results:re,isLoading:ce}=Object(k.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==b?void 0:b.id)||0],shouldSelect:t.attributeId>0}),oe="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:le,isLoading:ae}=Object(S.a)({queryAttribute:{taxonomy:(null==b?void 0:b.taxonomy)||"",queryType:t.queryType},queryState:{...X,attributes:oe?X.attributes:null}}),se=Object(o.useCallback)(e=>Object(I.b)(le,"attribute_counts")&&Array.isArray(le.attribute_counts)?le.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[le]);Object(o.useEffect)(()=>{if(ce||ae)return;if(!Array.isArray(re))return;const e=re.map(e=>{const n=se(e.id);if(!(n||p.includes(e.slug)||(r=e.slug,null!=X&&X.attributes&&X.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==b?void 0:b.taxonomy)&&n.includes(r)}))))return null;var r;const c=n?n.count:0;return{formattedValue:Z(e.slug),value:e.slug,name:Object(L.decodeEntities)(e.name),label:Object(o.createElement)(C.a,{name:Object(L.decodeEntities)(e.name),count:t.showCounts?c:null}),textLabel:t.showCounts?`${Object(L.decodeEntities)(e.name)} (${c})`:Object(L.decodeEntities)(e.name)}}).filter(e=>!!e);T(e),h(Y())},[null==b?void 0:b.taxonomy,re,ce,t.showCounts,ae,se,p,X.attributes]);const ie=Object(o.useCallback)(e=>Array.isArray(re)?re.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[re]),ue=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(null==b||!b.taxonomy)return;const t=Object.keys(Object(R.getQueryArgs)(window.location.href)),n=W(b.taxonomy),r=t.reduce((e,t)=>t.includes(q.b+n)||t.includes(q.a+n)?Object(R.removeQueryArgs)(e,t):e,window.location.href),c=K(r,e);Object(q.c)(c)}else{const t=K(a,e),n=Object(R.getQueryArgs)(window.location.href),r=Object(R.getQueryArgs)(t);J(n,r)||Object(q.c)(t)}}),[a,null==b?void 0:b.taxonomy]),be=e=>{const n=Object(Q.b)(te,ne,b,ie(e),"or"===t.queryType?"in":"and");ue(n,0===e.length)},de=Object(o.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||(g(e),!r&&t.showFilterButton||Object(Q.b)(te,ne,b,ie(e),"or"===t.queryType?"in":"and"))}),[n,g,te,ne,b,ie,t.queryType,t.showFilterButton]),me=Object(o.useMemo)(()=>Object(V.a)(te)?te.filter(e=>{let{attribute:t}=e;return t===(null==b?void 0:b.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[te,null==b?void 0:b.taxonomy]),pe=Object(y.a)(me),ge=Object(v.a)(pe);Object(o.useEffect)(()=>{!ge||A()(ge,pe)||A()(p,pe)||de(pe)},[p,pe,ge,de]);const Oe="single"!==t.selectType,je=Object(o.useCallback)(e=>{const t=p.includes(e);let n;Oe?(n=p.filter(t=>t!==e),t||(n.push(e),n.sort())):n=t?[]:[e],de(n)},[p,Oe,de]);if(Object(o.useEffect)(()=>{b&&!t.showFilterButton&&((e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length})({currentCheckedFilters:p,hasSetFilterDefaultsFromUrl:s})?ue(te,!0):ue(te,!1))},[s,ue,te,b,p,t.showFilterButton]),Object(o.useEffect)(()=>{if(!s&&!ce)return d.length>0?(i(!0),void de(d,!0)):void(c||i(!0))},[b,s,ce,de,d,c]),!r)return null;if(!b)return n?Object(o.createElement)(P.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(l.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):null;if(0===w.length&&!ce&&n)return Object(o.createElement)(P.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(l.__)("There are no products with the selected attributes.","woo-gutenberg-products-block")));const fe="h"+t.headingLevel,he=!t.isPreview&&ce,we=!t.isPreview&&ae,_e=(he||we)&&0===w.length;if(!_e&&0===w.length)return null;const ye=Object(o.createElement)(fe,{className:"wc-block-attribute-filter__title"},t.heading),ve=_e?Object(o.createElement)(D.a,null,ye):ye;return Object(o.createElement)(o.Fragment,null,!n&&t.heading&&ve,Object(o.createElement)("div",{className:m()("wc-block-attribute-filter","style-"+t.displayStyle)},"dropdown"===t.displayStyle?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(H,{key:f,className:m()(G.className,{"single-selection":!Oe,"is-loading":_e}),style:{...G.style,borderStyle:"none"},suggestions:w.filter(e=>!p.includes(e.value)).map(e=>e.formattedValue),disabled:_e,placeholder:Object(l.sprintf)(
16
  /* translators: %s attribute name. */
17
+ Object(l.__)("Select %s","woo-gutenberg-products-block"),b.label),onChange:e=>{!Oe&&e.length>1&&(e=[e[e.length-1]]),e=e.map(e=>{const t=w.find(t=>t.formattedValue===e);return t?t.value:e});const t=Object(O.difference)(e,p);if(1===t.length)return je(t[0]);const n=Object(O.difference)(p,e);1===n.length&&je(n[0])},value:p,displayTransform:e=>{const t=w.find(t=>[t.value,t.formattedValue].includes(e));return t?t.textLabel:e},saveTransform:Z,messages:{added:Object(l.sprintf)(
18
  /* translators: %s is the attribute label. */
19
  Object(l.__)("%s filter added.","woo-gutenberg-products-block"),b.label),removed:Object(l.sprintf)(
20
  /* translators: %s is the attribute label. */
22
  /* translators: %s is the attribute label. */
23
  Object(l.__)("Remove %s filter.","woo-gutenberg-products-block"),b.label.toLocaleLowerCase()),__experimentalInvalid:Object(l.sprintf)(
24
  /* translators: %s is the attribute label. */
25
+ Object(l.__)("Invalid %s filter.","woo-gutenberg-products-block"),b.label.toLocaleLowerCase())}}),Oe&&Object(o.createElement)(u.a,{icon:M.a,size:30})):Object(o.createElement)(ee,{options:w,checked:p,onChange:je,isLoading:_e,isDisabled:_e})),Object(o.createElement)("div",{className:"wc-block-attribute-filter__actions"},p.length>0&&!_e&&Object(o.createElement)(x.a,{onClick:()=>{g([]),h(Y()),s&&be([])},screenReaderLabel:Object(l.__)("Reset attribute filter","woo-gutenberg-products-block")}),t.showFilterButton&&Object(o.createElement)(N.a,{className:"wc-block-attribute-filter__button",isLoading:_e,disabled:he||we||0===p.length,onClick:()=>be(p)})))};n(396);const ne=Object(j.getSetting)("attributes",[]);var re=Object(w.withSpokenMessages)(e=>{let{attributes:t,setAttributes:n,debouncedSpeak:r}=e;const{attributeId:c,className:a,displayStyle:i,heading:d,headingLevel:_,isPreview:y,queryType:v,showCounts:E,showFilterButton:k,selectType:S}=t,[C,x]=Object(o.useState)(!c&&!y),N=Object(s.useBlockProps)(),T=e=>{if(!e||!e.length)return;const t=e[0].id,r=ne.find(e=>e.attribute_id===t.toString());if(!r||c===t)return;const o=r.attribute_label;n({attributeId:t,heading:Object(l.sprintf)(
26
  /* translators: %s attribute name. */
27
  Object(l.__)("Filter by %s","woo-gutenberg-products-block"),o)})},A=e=>{let{isCompact:t}=e;const n={clear:Object(l.__)("Clear selected attribute","woo-gutenberg-products-block"),list:Object(l.__)("Product Attributes","woo-gutenberg-products-block"),noItems:Object(l.__)("Your store doesn't have any product attributes.","woo-gutenberg-products-block"),search:Object(l.__)("Search for a product attribute:","woo-gutenberg-products-block"),selected:e=>Object(l.sprintf)(
28
  /* translators: %d is the number of attributes selected. */
29
+ Object(l._n)("%d attribute selected","%d attributes selected",e,"woo-gutenberg-products-block"),e),updated:Object(l.__)("Product attribute search results updated.","woo-gutenberg-products-block")},r=Object(O.sortBy)(ne.map(e=>({id:parseInt(e.attribute_id,10),name:e.attribute_label})),"name");return Object(o.createElement)(g.a,{className:"woocommerce-product-attributes",list:r,selected:r.filter(e=>{let{id:t}=e;return t===c}),onChange:T,messages:n,isSingle:!0,isCompact:t})};return 0===Object.keys(ne).length?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on the selected attributes.","woo-gutenberg-products-block")},Object(o.createElement)("p",null,Object(l.__)("Attributes are needed for filtering your products. You haven't created any attributes yet.","woo-gutenberg-products-block")),Object(o.createElement)(w.Button,{className:"wc-block-attribute-filter__add-attribute-button",isSecondary:!0,href:Object(j.getAdminLink)("edit.php?post_type=product&page=product_attributes")},Object(l.__)("Add new attribute","woo-gutenberg-products-block")+" ",Object(o.createElement)(u.a,{icon:p.a})),Object(o.createElement)(w.Button,{className:"wc-block-attribute-filter__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-product-taxonomies/"},Object(l.__)("Learn more","woo-gutenberg-products-block"))):Object(o.createElement)("div",N,Object(o.createElement)(s.BlockControls,null,Object(o.createElement)(w.ToolbarGroup,{controls:[{icon:"edit",title:Object(l.__)("Edit","woo-gutenberg-products-block"),onClick:()=>x(!C),isActive:C}]})),Object(o.createElement)(s.InspectorControls,{key:"inspector"},Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Display Settings","woo-gutenberg-products-block")},Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Include product count","woo-gutenberg-products-block"),checked:E,onChange:()=>n({showCounts:!E})}),Object(o.createElement)("p",null,Object(l.__)("Heading Level","woo-gutenberg-products-block")),Object(o.createElement)(f.a,{isCollapsed:!1,minLevel:2,maxLevel:7,selectedLevel:_,onChange:e=>n({headingLevel:e})}),Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Allow selecting multiple options?","woo-gutenberg-products-block"),value:S||"multiple",onChange:e=>n({selectType:e}),className:"wc-block-attribute-filter__multiple-toggle"},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"multiple",label:Object(l.__)("Multiple","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"single",label:Object(l.__)("Single","woo-gutenberg-products-block")})),"multiple"===S&&Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Filter Conditions","woo-gutenberg-products-block"),help:"and"===v?Object(l.__)("Choose to return filter results for all of the attributes selected.","woo-gutenberg-products-block"):Object(l.__)("Choose to return filter results for any of the attributes selected.","woo-gutenberg-products-block"),value:v,onChange:e=>n({queryType:e}),className:"wc-block-attribute-filter__conditions-toggle"},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"and",label:Object(l.__)("All","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"or",label:Object(l.__)("Any","woo-gutenberg-products-block")})),Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Display Style","woo-gutenberg-products-block"),value:i,onChange:e=>n({displayStyle:e}),className:"wc-block-attribute-filter__display-toggle"},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"list",label:Object(l.__)("List","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"dropdown",label:Object(l.__)("Dropdown","woo-gutenberg-products-block")})),Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Show 'Apply filters' button","woo-gutenberg-products-block"),help:k?Object(l.__)("Products will only update when the button is clicked.","woo-gutenberg-products-block"):Object(l.__)("Products will update as soon as attributes are selected.","woo-gutenberg-products-block"),checked:k,onChange:e=>n({showFilterButton:e})})),Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Content Settings","woo-gutenberg-products-block"),initialOpen:!1},A({isCompact:!0}))),C?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter by Attribute","woo-gutenberg-products-block"),instructions:Object(l.__)("Display a list of filters based on the selected attributes.","woo-gutenberg-products-block")},Object(o.createElement)("div",{className:"wc-block-attribute-filter__selection"},A({isCompact:!1}),Object(o.createElement)(w.Button,{isPrimary:!0,onClick:()=>{x(!1),r(Object(l.__)("Now displaying a preview of the Filter Products by Attribute block.","woo-gutenberg-products-block"))}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(o.createElement)("div",{className:m()(a,"wc-block-attribute-filter")},Object(o.createElement)(h.a,{className:"wc-block-attribute-filter__title",headingLevel:_,heading:d,onChange:e=>n({heading:e})}),Object(o.createElement)(w.Disabled,null,Object(o.createElement)(te,{attributes:t,isEditor:!0}))))});const ce={heading:{type:"string",default:Object(l.__)("Filter by attribute","woo-gutenberg-products-block")}};var oe=n(239);Object(a.registerBlockType)(oe,{title:Object(l.__)("Filter by Attribute","woo-gutenberg-products-block"),description:Object(l.__)("Enable customers to filter the product grid by selecting one or more attributes, such as color.","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(u.a,{icon:b.a,className:"wc-block-editor-components-block-icon"})},supports:{...oe.supports,...Object(i.b)()&&{__experimentalBorder:{radius:!1,color:!0,width:!1}}},attributes:{...oe.attributes,...ce},transforms:{from:[{type:"block",blocks:["core/legacy-widget"],isMatch:e=>{let{idBase:t,instance:n}=e;return"woocommerce_layered_nav"===t&&!(null==n||!n.raw)},transform:e=>{var t,n,r,c;let{instance:o}=e;return Object(a.createBlock)("woocommerce/attribute-filter",{attributeId:0,showCounts:!0,queryType:(null==o||null===(t=o.raw)||void 0===t?void 0:t.query_type)||"or",heading:(null==o||null===(n=o.raw)||void 0===n?void 0:n.title)||Object(l.__)("Filter by attribute","woo-gutenberg-products-block"),headingLevel:3,displayStyle:(null==o||null===(r=o.raw)||void 0===r?void 0:r.display_type)||"list",showFilterButton:!1,selectType:(null==o||null===(c=o.raw)||void 0===c?void 0:c.select_type)||"multiple",isPreview:!1})}}]},edit:re,save(e){let{attributes:t}=e;const{className:n,showCounts:r,queryType:l,attributeId:a,heading:i,headingLevel:u,displayStyle:b,showFilterButton:d,selectType:p}=t,g={"data-attribute-id":a,"data-show-counts":r,"data-query-type":l,"data-heading":i,"data-heading-level":u};return"list"!==b&&(g["data-display-style"]=b),d&&(g["data-show-filter-button"]=d),"single"===p&&(g["data-select-type"]=p),Object(o.createElement)("div",c()({},s.useBlockProps.save({className:m()("is-loading",n)}),g),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-attribute-filter__placeholder"}))}})},49:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var r=n(0),c=n(22),o=n.n(c);function l(e){const t=Object(r.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},5:function(e,t){e.exports=window.wp.blockEditor},51:function(e,t){e.exports=window.wp.deprecated},52:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(0);const c=Object(r.createContext)("page"),o=()=>Object(r.useContext)(c);c.Provider},53:function(e,t){e.exports=window.wp.keycodes},7:function(e,t){e.exports=window.lodash},71:function(e,t){e.exports=window.wp.dom},75:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return d})),n.d(t,"c",(function(){return m}));var r=n(17),c=n(9),o=n(0),l=n(22),a=n.n(l),s=n(49),i=n(109),u=n(52);const b=e=>{const t=Object(u.a)();e=e||t;const n=Object(c.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(c.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(o.useCallback)(t=>{l(e,t)},[e,l])]},d=(e,t,n)=>{const l=Object(u.a)();n=n||l;const a=Object(c.useSelect)(c=>c(r.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:s}=Object(c.useDispatch)(r.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{s(n,e,t)},[n,e,s])]},m=(e,t)=>{const n=Object(u.a)();t=t||n;const[r,c]=b(t),l=Object(s.a)(r),d=Object(s.a)(e),m=Object(i.a)(d),p=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(m,d)||(c(Object.assign({},l,d)),p.current=!0)},[l,d,m,c]),p.current?[r,c]:[e,c]}},8:function(e,t){e.exports=window.wp.blocks},9:function(e,t){e.exports=window.wp.data},95:function(e,t,n){"use strict";n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return a}));var r=n(8),c=n(23);const o=(e,t)=>{if(c.n>2)return Object(r.registerBlockType)(e,t)},l=()=>c.n>2,a=()=>c.n>1},97:function(e,t,n){"use strict";n.d(t,"a",(function(){return v}));var r=n(6),c=n.n(r),o=n(0),l=n(1),a=n(3),s=n(113),i=n(508),u=n(4),b=n.n(u),d=n(10),m=n(19),p=n(36),g=n(507),O=n(14);const j=e=>{let{id:t,label:n,popoverContents:r,remove:c,screenReaderLabel:i,className:u=""}=e;const[m,p]=Object(o.useState)(!1),f=Object(d.useInstanceId)(j);if(i=i||n,!n)return null;n=Object(O.decodeEntities)(n);const h=b()("woocommerce-tag",u,{"has-remove":!!c}),w="woocommerce-tag__label-"+f,_=Object(o.createElement)(o.Fragment,null,Object(o.createElement)("span",{className:"screen-reader-text"},i),Object(o.createElement)("span",{"aria-hidden":"true"},n));return Object(o.createElement)("span",{className:h},r?Object(o.createElement)(a.Button,{className:"woocommerce-tag__text",id:w,onClick:()=>p(!0)},_):Object(o.createElement)("span",{className:"woocommerce-tag__text",id:w},_),r&&m&&Object(o.createElement)(a.Popover,{onClose:()=>p(!1)},r),c&&Object(o.createElement)(a.Button,{className:"woocommerce-tag__remove",onClick:c(t),label:Object(l.sprintf)(// Translators: %s label.
30
  Object(l.__)("Remove %s","woo-gutenberg-products-block"),n),"aria-describedby":w},Object(o.createElement)(s.a,{icon:g.a,size:20,className:"clear-icon"})))};var f=j;const h=e=>Object(o.createElement)(p.b,e),w=e=>{const{list:t,selected:n,renderItem:r,depth:l=0,onSelect:a,instanceId:s,isSingle:i,search:u}=e;return t?Object(o.createElement)(o.Fragment,null,t.map(t=>{const b=-1!==n.findIndex(e=>{let{id:n}=e;return n===t.id});return Object(o.createElement)(o.Fragment,{key:t.id},Object(o.createElement)("li",null,r({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(o.createElement)(w,c()({},e,{list:t.children,depth:l+1})))})):null},_=e=>{let{isLoading:t,isSingle:n,selected:r,messages:c,onChange:s,onRemove:i}=e;if(t||n||!r)return null;const u=r.length;return Object(o.createElement)("div",{className:"woocommerce-search-list__selected"},Object(o.createElement)("div",{className:"woocommerce-search-list__selected-header"},Object(o.createElement)("strong",null,c.selected(u)),u>0?Object(o.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":c.clear},Object(l.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(o.createElement)("ul",null,r.map((e,t)=>Object(o.createElement)("li",{key:t},Object(o.createElement)(f,{label:e.name,id:e.id,remove:i})))):null)},y=e=>{let{filteredList:t,search:n,onSelect:r,instanceId:c,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:m}=a,p=b||h;return 0===t.length?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-not-found"},Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-icon"},Object(o.createElement)(s.a,{icon:i.a})),Object(o.createElement)("span",{className:"woocommerce-search-list__not-found-text"},n?Object(l.sprintf)(u.noResults,n):u.noItems)):Object(o.createElement)("ul",{className:"woocommerce-search-list__list"},Object(o.createElement)(w,{list:t,selected:d,renderItem:p,onSelect:r,instanceId:c,isSingle:m,search:n}))},v=e=>{const{className:t="",isCompact:n,isHierarchical:r,isLoading:l,isSingle:s,list:i,messages:u=m.a,onChange:p,onSearch:g,selected:O,debouncedSpeak:j}=e,[f,h]=Object(o.useState)(""),w=Object(d.useInstanceId)(v),E=Object(o.useMemo)(()=>({...m.a,...u}),[u]),k=Object(o.useMemo)(()=>Object(m.c)(i,f,r),[i,f,r]);Object(o.useEffect)(()=>{j&&j(E.updated)},[j,E]),Object(o.useEffect)(()=>{"function"==typeof g&&g(f)},[f,g]);const S=Object(o.useCallback)(e=>()=>{s&&p([]);const t=O.findIndex(t=>{let{id:n}=t;return n===e});p([...O.slice(0,t),...O.slice(t+1)])},[s,O,p]),C=Object(o.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:n}=t;return n===e.id})?p(s?[e]:[...O,e]):S(e.id)()},[s,S,p,O]);return Object(o.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":n})},Object(o.createElement)(_,c()({},e,{onRemove:S,messages:E})),Object(o.createElement)("div",{className:"woocommerce-search-list__search"},Object(o.createElement)(a.TextControl,{label:E.search,type:"search",value:f,onChange:e=>h(e)})),l?Object(o.createElement)("div",{className:"woocommerce-search-list__list is-loading"},Object(o.createElement)(a.Spinner,null)):Object(o.createElement)(y,c()({},e,{search:f,filteredList:k,messages:E,onSelect:C,instanceId:w})))};Object(a.withSpokenMessages)(v)},99:function(e,t,n){"use strict";var r=n(0),c=n(7),o=n(1),l=n(3),a=n(11);function s(e){let{level:t}=e;const n={1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z"};return n.hasOwnProperty(t)?Object(r.createElement)(a.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(a.Path,{d:n[t]})):null}class i extends r.Component{createLevelControl(e,t,n){const c=e===t;return{icon:Object(r.createElement)(s,{level:e}),title:Object(o.sprintf)(
31
  /* translators: %s: heading level e.g: "2", "3", "4" */
32
  Object(o.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:c,onClick:()=>n(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:n,selectedLevel:o,onChange:a}=this.props;return Object(r.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(r.createElement)(s,{level:o}),controls:Object(c.range)(t,n).map(e=>this.createLevelControl(e,o,a))})}}t.a=i}});
build/attribute-filter/block.json CHANGED
@@ -2,7 +2,7 @@
2
  "name": "woocommerce/attribute-filter",
3
  "version": "1.0.0",
4
  "title": "Filter by Attribute",
5
- "description": "Allow customers to filter the grid by product attribute, such as color.",
6
  "category": "woocommerce",
7
  "keywords": [ "WooCommerce" ],
8
  "supports": {
@@ -48,7 +48,7 @@
48
  },
49
  "selectType": {
50
  "type": "string",
51
- "default": "multiple"
52
  },
53
  "isPreview": {
54
  "type": "boolean",
2
  "name": "woocommerce/attribute-filter",
3
  "version": "1.0.0",
4
  "title": "Filter by Attribute",
5
+ "description": "Enable customers to filter the product grid by selecting one or more attributes, such as color.",
6
  "category": "woocommerce",
7
  "keywords": [ "WooCommerce" ],
8
  "supports": {
48
  },
49
  "selectType": {
50
  "type": "string",
51
+ "default": "multiple"
52
  },
53
  "isPreview": {
54
  "type": "boolean",
build/blocks-checkout.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-registry', 'wc-settings', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-warning'), 'version' => '800cd4b2c71732de940c112b92a68340');
1
+ <?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-registry', 'wc-settings', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-i18n', 'wp-is-shallow-equal', 'wp-polyfill', 'wp-primitives', 'wp-warning'), 'version' => '284fe2a81c2018b9c52e44d63387db63');
build/blocks-checkout.js CHANGED
@@ -1,5 +1,5 @@
1
- this.wc=this.wc||{},this.wc.blocksCheckout=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=135)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){function n(){return e.exports=n=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},e.exports.__esModule=!0,e.exports.default=e.exports,n.apply(this,arguments)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},12:function(e,t){e.exports=window.wp.compose},128:function(e,t){},129:function(e,t){},130:function(e,t){},131:function(e,t){},132:function(e,t){},133:function(e,t){},134:function(e,t){},135:function(e,t,n){"use strict";n.r(t),n.d(t,"TotalsItem",(function(){return k})),n.d(t,"Subtotal",(function(){return F})),n.d(t,"TotalsTaxes",(function(){return C})),n.d(t,"TotalsFees",(function(){return T})),n.d(t,"TotalsWrapper",(function(){return P})),n.d(t,"ExperimentalOrderMeta",(function(){return me})),n.d(t,"ExperimentalDiscountsMeta",(function(){return he})),n.d(t,"ExperimentalOrderShippingPackages",(function(){return ve})),n.d(t,"Panel",(function(){return je})),n.d(t,"Button",(function(){return Ye})),n.d(t,"Label",(function(){return Ze})),n.d(t,"CheckboxControl",(function(){return Je})),n.d(t,"mustContain",(function(){return Qe})),n.d(t,"extensionCartUpdate",(function(){return nt})),n.d(t,"hasValidFills",(function(){return ae})),n.d(t,"useSlot",(function(){return ce})),n.d(t,"createSlotFill",(function(){return le})),n.d(t,"__experimentalRegisterCheckoutFilters",(function(){return at})),n.d(t,"__experimentalApplyCheckoutFilter",(function(){return pt})),n.d(t,"hasInnerBlocks",(function(){return dt})),n.d(t,"getRegisteredBlocks",(function(){return ht})),n.d(t,"registerCheckoutBlock",(function(){return gt})),n.d(t,"innerBlockAreas",(function(){return mt})),n.d(t,"SlotFillProvider",(function(){return te}));var r=n(0),o=n(2),i=n.n(o),s=n(10),a=n.n(s),c=n(14),l=n.n(c);function u(){}function p(e){return!!(e||"").match(/\d/)}function m(e){return null==e}function f(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function d(e,t){void 0===t&&(t=!0);var n="-"===e[0],r=n&&t,o=(e=e.replace("-","")).split(".");return{beforeDecimal:o[0],afterDecimal:o[1]||"",hasNagation:n,addNegation:r}}function h(e,t,n){for(var r="",o=n?"0":"",i=0;i<=t-1;i++)r+=e[i]||o;return r}function b(e,t){return Array(t+1).join(e)}function g(e,t){if(e.value=e.value,null!==e){if(e.createTextRange){var n=e.createTextRange();return n.move("character",t),n.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}function v(e,t,n){return Math.min(Math.max(e,t),n)}function w(e){return Math.max(e.selectionStart,e.selectionEnd)}var O={displayType:"input",decimalSeparator:".",thousandsGroupStyle:"thousand",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,allowLeadingZeros:!1,isNumericString:!1,type:"text",onValueChange:u,onChange:u,onKeyDown:u,onMouseUp:u,onFocus:u,onBlur:u,isAllowed:function(){return!0}},y=function(e){function t(t){e.call(this,t);var n=t.defaultValue;this.validateProps();var r=this.formatValueProp(n);this.state={value:r,numAsString:this.removeFormatting(r),mounted:!1},this.selectionBeforeInput={selectionStart:0,selectionEnd:0},this.onChange=this.onChange.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.componentDidMount=function(){this.setState({mounted:!0})},t.prototype.componentDidUpdate=function(e){this.updateValueIfRequired(e)},t.prototype.componentWillUnmount=function(){clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout)},t.prototype.updateValueIfRequired=function(e){var t=this.props,n=this.state,r=this.focusedElm,o=n.value,i=n.numAsString;if(void 0===i&&(i=""),e!==t){this.validateProps();var s=this.formatNumString(i),a=m(t.value)?s:this.formatValueProp(),c=this.removeFormatting(a),l=parseFloat(c),u=parseFloat(i);(isNaN(l)&&isNaN(u)||l===u)&&s===o&&(null!==r||a===o)||this.updateValue({formattedValue:a,numAsString:c,input:r,source:"prop",event:null})}},t.prototype.getFloatString=function(e){void 0===e&&(e="");var t=this.props.decimalScale,n=this.getSeparators().decimalSeparator,r=this.getNumberRegex(!0),o="-"===e[0];o&&(e=e.replace("-","")),n&&0===t&&(e=e.split(n)[0]);var i=(e=(e.match(r)||[]).join("").replace(n,".")).indexOf(".");return-1!==i&&(e=e.substring(0,i)+"."+e.substring(i+1,e.length).replace(new RegExp(f(n),"g"),"")),o&&(e="-"+e),e},t.prototype.getNumberRegex=function(e,t){var n=this.props,r=n.format,o=n.decimalScale,i=n.customNumerals,s=this.getSeparators().decimalSeparator;return new RegExp("[0-9"+(i?i.join(""):"")+"]"+(!s||0===o||t||r?"":"|"+f(s)),e?"g":void 0)},t.prototype.getSeparators=function(){var e=this.props.decimalSeparator,t=this.props,n=t.thousandSeparator,r=t.allowedDecimalSeparators;return!0===n&&(n=","),r||(r=[e,"."]),{decimalSeparator:e,thousandSeparator:n,allowedDecimalSeparators:r}},t.prototype.getMaskAtIndex=function(e){var t=this.props.mask;return void 0===t&&(t=" "),"string"==typeof t?t:t[e]||" "},t.prototype.getValueObject=function(e,t){var n=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(n)?void 0:n}},t.prototype.validateProps=function(){var e=this.props.mask,t=this.getSeparators(),n=t.decimalSeparator,r=t.thousandSeparator;if(n===r)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: "+r+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+n+" (default value for decimalSeparator is .)\n ");if(e&&("string"===e?e:e.toString()).match(/\d/g))throw new Error("\n Mask "+e+" should not contain numeric character;\n ")},t.prototype.setPatchedCaretPosition=function(e,t,n){g(e,t),this.caretPositionTimeout=setTimeout((function(){e.value===n&&g(e,t)}),0)},t.prototype.correctCaretPosition=function(e,t,n){var r=this.props,o=r.prefix,i=r.suffix,s=r.format;if(""===e)return 0;if(t=v(t,0,e.length),!s){var a="-"===e[0];return v(t,o.length+(a?1:0),e.length-i.length)}if("function"==typeof s)return t;if("#"===s[t]&&p(e[t]))return t;if("#"===s[t-1]&&p(e[t-1]))return t;var c=s.indexOf("#");t=v(t,c,s.lastIndexOf("#")+1);for(var l=s.substring(t,s.length).indexOf("#"),u=t,m=t+(-1===l?0:l);u>c&&("#"!==s[u]||!p(e[u]));)u-=1;return!p(e[m])||"left"===n&&t!==c||t-u<m-t?p(e[u])?u+1:u:m},t.prototype.getCaretPosition=function(e,t,n){var r,o,i=this.props.format,s=this.state.value,a=this.getNumberRegex(!0),c=(e.match(a)||[]).join(""),l=(t.match(a)||[]).join("");for(r=0,o=0;o<n;o++){var u=e[o]||"",p=t[r]||"";if((u.match(a)||u===p)&&("0"!==u||!p.match(a)||"0"===p||c.length===l.length)){for(;u!==t[r]&&r<t.length;)r++;r++}}return"string"!=typeof i||s||(r=t.length),this.correctCaretPosition(t,r)},t.prototype.removePrefixAndSuffix=function(e){var t=this.props,n=t.format,r=t.prefix,o=t.suffix;if(!n&&e){var i="-"===e[0];i&&(e=e.substring(1,e.length));var s=(e=r&&0===e.indexOf(r)?e.substring(r.length,e.length):e).lastIndexOf(o);e=o&&-1!==s&&s===e.length-o.length?e.substring(0,s):e,i&&(e="-"+e)}return e},t.prototype.removePatternFormatting=function(e){for(var t=this.props.format.split("#").filter((function(e){return""!==e})),n=0,r="",o=0,i=t.length;o<=i;o++){var s=t[o]||"",a=o===i?e.length:e.indexOf(s,n);if(-1===a){r=e;break}r+=e.substring(n,a),n=a+s.length}return(r.match(this.getNumberRegex(!0))||[]).join("")},t.prototype.removeFormatting=function(e){var t=this.props,n=t.format,r=t.removeFormatting;return e?(n?e="string"==typeof n?this.removePatternFormatting(e):"function"==typeof r?r(e):(e.match(this.getNumberRegex(!0))||[]).join(""):(e=this.removePrefixAndSuffix(e),e=this.getFloatString(e)),e):e},t.prototype.formatWithPattern=function(e){for(var t=this.props.format,n=0,r=t.split(""),o=0,i=t.length;o<i;o++)"#"===t[o]&&(r[o]=e[n]||this.getMaskAtIndex(n),n+=1);return r.join("")},t.prototype.formatAsNumber=function(e){var t=this.props,n=t.decimalScale,r=t.fixedDecimalScale,o=t.prefix,i=t.suffix,s=t.allowNegative,a=t.thousandsGroupStyle,c=this.getSeparators(),l=c.thousandSeparator,u=c.decimalSeparator,p=-1!==e.indexOf(".")||n&&r,m=d(e,s),f=m.beforeDecimal,b=m.afterDecimal,g=m.addNegation;return void 0!==n&&(b=h(b,n,r)),l&&(f=function(e,t,n){var r=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}(n),o=e.search(/[1-9]/);return o=-1===o?e.length:o,e.substring(0,o)+e.substring(o,e.length).replace(r,"$1"+t)}(f,l,a)),o&&(f=o+f),i&&(b+=i),g&&(f="-"+f),f+(p&&u||"")+b},t.prototype.formatNumString=function(e){void 0===e&&(e="");var t=this.props,n=t.format,r=t.allowEmptyFormatting,o=t.customNumerals,i=e;if(o&&10===o.length){var s=new RegExp("["+o.join("")+"]","g");i=e.replace(s,(function(e){return o.indexOf(e).toString()}))}return""!==e||r?"-"!==e||n?"string"==typeof n?this.formatWithPattern(i):"function"==typeof n?n(i):this.formatAsNumber(i):"-":""},t.prototype.formatValueProp=function(e){var t=this.props,n=t.format,r=t.decimalScale,o=t.fixedDecimalScale,i=t.allowEmptyFormatting,s=this.props,a=s.value,c=s.isNumericString,l=!(a=m(a)?e:a)&&0!==a;return l&&i&&(a=""),l&&!i?"":("number"==typeof a&&(a=function(e){var t="-"===(e+="")[0]?"-":"";t&&(e=e.substring(1));var n=e.split(/[eE]/g),r=n[0],o=n[1];if(!(o=Number(o)))return t+r;var i=1+o,s=(r=r.replace(".","")).length;return i<0?r="0."+b("0",Math.abs(i))+r:i>=s?r+=b("0",i-s):r=(r.substring(0,i)||"0")+"."+r.substring(i),t+r}(a),c=!0),"Infinity"===a&&c&&(a=""),c&&!n&&"number"==typeof r&&(a=function(e,t,n){if(-1!==["","-"].indexOf(e))return e;var r=-1!==e.indexOf(".")&&t,o=d(e),i=o.beforeDecimal,s=o.afterDecimal,a=o.hasNagation,c=parseFloat("0."+(s||"0")),l=(s.length<=t?"0."+s:c.toFixed(t)).split(".");return(a?"-":"")+i.split("").reverse().reduce((function(e,t,n){return e.length>n?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e}),l[0])+(r?".":"")+h(l[1]||"",Math.min(t,s.length),n)}(a,r,o)),c?this.formatNumString(a):this.formatInput(a))},t.prototype.formatNegation=function(e){void 0===e&&(e="");var t=this.props.allowNegative,n=new RegExp("(-)"),r=new RegExp("(-)(.)*(-)"),o=n.test(e),i=r.test(e);return e=e.replace(/-/g,""),o&&!i&&t&&(e="-"+e),e},t.prototype.formatInput=function(e){return void 0===e&&(e=""),this.props.format||(e=this.removePrefixAndSuffix(e),e=this.formatNegation(e)),e=this.removeFormatting(e),this.formatNumString(e)},t.prototype.isCharacterAFormat=function(e,t){var n=this.props,r=n.format,o=n.prefix,i=n.suffix,s=n.decimalScale,a=n.fixedDecimalScale,c=this.getSeparators().decimalSeparator;return"string"==typeof r&&"#"!==r[e]||!(r||!(e<o.length||e>=t.length-i.length||s&&a&&t[e]===c))},t.prototype.correctInputValue=function(e,t,n){var r=this,o=this.props,i=o.format,s=o.allowNegative,a=o.prefix,c=o.suffix,l=o.decimalScale,u=this.getSeparators(),p=u.allowedDecimalSeparators,m=u.decimalSeparator,f=this.state.numAsString||"",h=this.selectionBeforeInput,b=h.selectionStart,g=h.selectionEnd,v=function(e,t){for(var n=0,r=0,o=e.length,i=t.length;e[n]===t[n]&&n<o;)n++;for(;e[o-1-r]===t[i-1-r]&&i-r>n&&o-r>n;)r++;return{start:n,end:o-r}}(t,n),w=v.start,O=v.end;if(!i&&w===O&&-1!==p.indexOf(n[b])){var y=0===l?"":m;return n.substr(0,b)+y+n.substr(b+1,n.length)}var j=i?0:a.length,E=t.length-(i?0:c.length);if(n.length>t.length||!n.length||w===O||0===b&&g===t.length||0===w&&O===t.length||b===j&&g===E)return n;var S=t.substr(w,O-w);if([].concat(S).find((function(e,n){return r.isCharacterAFormat(n+w,t)}))){var x=t.substr(w),k={},N=[];[].concat(x).forEach((function(e,n){r.isCharacterAFormat(n+w,t)?k[n]=e:n>S.length-1&&N.push(e)})),Object.keys(k).forEach((function(e){N.length>e?N.splice(e,0,k[e]):N.push(k[e])})),n=t.substr(0,w)+N.join("")}if(!i){var _=this.removeFormatting(n),F=d(_,s),C=F.beforeDecimal,T=F.afterDecimal,P=F.addNegation,R=e<n.indexOf(m)+1;if(_.length<f.length&&R&&""===C&&!parseFloat(T))return P?"-":""}return n},t.prototype.updateValue=function(e){var t=e.formattedValue,n=e.input,r=e.setCaretPosition;void 0===r&&(r=!0);var o=e.source,i=e.event,s=e.numAsString,a=e.caretPos,c=this.props.onValueChange,l=this.state.value;if(n){if(void 0===a&&r){var u=e.inputValue||n.value,p=w(n);n.value=t,a=this.getCaretPosition(u,t,p)}n.value=t,r&&this.setPatchedCaretPosition(n,a,t)}void 0===s&&(s=this.removeFormatting(t)),t!==l&&(this.setState({value:t,numAsString:s}),c(this.getValueObject(t,s),{event:i,source:o}))},t.prototype.onChange=function(e){var t=e.target,n=t.value,r=this.state,o=this.props,i=o.isAllowed,s=r.value||"",a=w(t);n=this.correctInputValue(a,s,n);var c=this.formatInput(n)||"",l=this.removeFormatting(c),u=i(this.getValueObject(c,l));u||(c=s),this.updateValue({formattedValue:c,numAsString:l,inputValue:n,input:t,event:e,source:"event"}),u&&o.onChange(e)},t.prototype.onBlur=function(e){var t=this.props,n=this.state,r=t.format,o=t.onBlur,i=t.allowLeadingZeros,s=n.numAsString,a=n.value;if(this.focusedElm=null,clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout),!r){isNaN(parseFloat(s))&&(s=""),i||(s=function(e){if(!e)return e;var t="-"===e[0];t&&(e=e.substring(1,e.length));var n=e.split("."),r=n[0].replace(/^0+/,"")||"0",o=n[1]||"";return(t?"-":"")+r+(o?"."+o:"")}(s));var c=this.formatNumString(s);if(c!==a)return this.updateValue({formattedValue:c,numAsString:s,input:e.target,setCaretPosition:!1,event:e,source:"event"}),void o(e)}o(e)},t.prototype.onKeyDown=function(e){var t,n=e.target,r=e.key,o=n.selectionStart,i=n.selectionEnd,s=n.value;void 0===s&&(s="");var a=this.props,c=a.decimalScale,l=a.fixedDecimalScale,u=a.prefix,p=a.suffix,m=a.format,f=a.onKeyDown,d=void 0!==c&&l,h=this.getNumberRegex(!1,d),b=new RegExp("-"),g="string"==typeof m;if(this.selectionBeforeInput={selectionStart:o,selectionEnd:i},"ArrowLeft"===r||"Backspace"===r?t=o-1:"ArrowRight"===r?t=o+1:"Delete"===r&&(t=o),void 0!==t&&o===i){var v=t,w=g?m.indexOf("#"):u.length,O=g?m.lastIndexOf("#")+1:s.length-p.length;if("ArrowLeft"===r||"ArrowRight"===r){var y="ArrowLeft"===r?"left":"right";v=this.correctCaretPosition(s,t,y)}else if("Delete"!==r||h.test(s[t])||b.test(s[t])){if("Backspace"===r&&!h.test(s[t]))if(o<=w+1&&"-"===s[0]&&void 0===m){var j=s.substring(1);this.updateValue({formattedValue:j,caretPos:v,input:n,event:e,source:"event"})}else if(!b.test(s[t])){for(;!h.test(s[v-1])&&v>w;)v--;v=this.correctCaretPosition(s,v,"left")}}else for(;!h.test(s[v])&&v<O;)v++;(v!==t||t<w||t>O)&&(e.preventDefault(),this.setPatchedCaretPosition(n,v,s)),e.isUnitTestRun&&this.setPatchedCaretPosition(n,v,s),f(e)}else f(e)},t.prototype.onMouseUp=function(e){var t=e.target,n=t.selectionStart,r=t.selectionEnd,o=t.value;if(void 0===o&&(o=""),n===r){var i=this.correctCaretPosition(o,n);i!==n&&this.setPatchedCaretPosition(t,i,o)}this.props.onMouseUp(e)},t.prototype.onFocus=function(e){var t=this;e.persist(),this.focusedElm=e.target,this.focusTimeout=setTimeout((function(){var n=e.target,r=n.selectionStart,o=n.selectionEnd,i=n.value;void 0===i&&(i="");var s=t.correctCaretPosition(i,r);s===r||0===r&&o===i.length||t.setPatchedCaretPosition(n,s,i),t.props.onFocus(e)}),0)},t.prototype.render=function(){var e=this.props,t=e.type,n=e.displayType,r=e.customInput,o=e.renderText,i=e.getInputRef,s=e.format,a=(e.thousandSeparator,e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle,e.decimalScale,e.fixedDecimalScale,e.prefix,e.suffix,e.removeFormatting,e.mask,e.defaultValue,e.isNumericString,e.allowNegative,e.allowEmptyFormatting,e.allowLeadingZeros,e.onValueChange,e.isAllowed,e.customNumerals,e.onChange,e.onKeyDown,e.onMouseUp,e.onFocus,e.onBlur,e.value,function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&-1===t.indexOf(r)&&(n[r]=e[r]);return n}(e,["type","displayType","customInput","renderText","getInputRef","format","thousandSeparator","decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","decimalScale","fixedDecimalScale","prefix","suffix","removeFormatting","mask","defaultValue","isNumericString","allowNegative","allowEmptyFormatting","allowLeadingZeros","onValueChange","isAllowed","customNumerals","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value"])),c=this.state,u=c.value,p=c.mounted&&function(e){return e||"undefined"!=typeof navigator&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}(s)?"numeric":void 0,m=Object.assign({inputMode:p},a,{type:t,value:u,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if("text"===n)return o?o(u,a)||null:l.a.createElement("span",Object.assign({},a,{ref:i}),u);if(r){var f=r;return l.a.createElement(f,Object.assign({},m,{ref:i}))}return l.a.createElement("input",Object.assign({},m,{ref:i}))},t}(l.a.Component);y.defaultProps=O;var j=y;n(129);const E=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});var S=e=>{let{className:t,value:n,currency:o,onValueChange:s,displayType:c="text",...l}=e;const u="string"==typeof n?parseInt(n,10):n;if(!Number.isFinite(u))return null;const p=u/10**o.minorUnit;if(!Number.isFinite(p))return null;const m=i()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),f={...l,...E(o),value:void 0,currency:void 0,onValueChange:void 0},d=s?e=>{const t=+e.value*10**o.minorUnit;s(t)}:()=>{};return Object(r.createElement)(j,a()({className:m,displayType:c},f,{value:p,onValueChange:d}))};n(128);const x=e=>{let{value:t,currency:n}=e;return Object(r.isValidElement)(t)?Object(r.createElement)("div",{className:"wc-block-components-totals-item__value"},t):Number.isFinite(t)?Object(r.createElement)(S,{className:"wc-block-components-totals-item__value",currency:n||{},value:t}):null};var k=e=>{let{className:t,currency:n,label:o,value:s,description:a}=e;return Object(r.createElement)("div",{className:i()("wc-block-components-totals-item",t)},Object(r.createElement)("span",{className:"wc-block-components-totals-item__label"},o),Object(r.createElement)(x,{value:s,currency:n}),Object(r.createElement)("div",{className:"wc-block-components-totals-item__description"},a))},N=n(1),_=n(5),F=e=>{let{currency:t,values:n,className:o}=e;const{total_items:i,total_items_tax:s}=n,a=parseInt(i,10),c=parseInt(s,10);return Object(r.createElement)(k,{className:o,currency:t,label:Object(N.__)("Subtotal","woo-gutenberg-products-block"),value:Object(_.getSetting)("displayCartPricesIncludingTax",!1)?a+c:a})},C=e=>{let{currency:t,values:n,className:o,showRateAfterTaxName:s}=e;const{total_tax:a,tax_lines:c}=n;if(!Object(_.getSetting)("taxesEnabled",!0)&&parseInt(a,10)<=0)return null;const l=Object(_.getSetting)("displayItemizedTaxes",!1),u=l&&c.length>0?Object(r.createElement)(r.Fragment,null,c.map((e,n)=>{let{name:a,rate:c,price:l}=e;const u=`${a}${s?" "+c:""}`;return Object(r.createElement)(k,{key:"tax-line-"+n,className:i()("wc-block-components-totals-taxes",o),currency:t,label:u,value:parseInt(l,10)})})," "):null;return l?u:Object(r.createElement)(r.Fragment,null,Object(r.createElement)(k,{className:i()("wc-block-components-totals-taxes",o),currency:t,label:Object(N.__)("Taxes","woo-gutenberg-products-block"),value:parseInt(a,10),description:null}))},T=e=>{let{currency:t,cartFees:n,className:o}=e;return Object(r.createElement)(r.Fragment,null,n.map((e,n)=>{let{id:s,name:a,totals:c}=e;const l=parseInt(c.total,10);if(!l)return null;const u=parseInt(c.total_tax,10);return Object(r.createElement)(k,{key:s||`${n}-${a}`,className:i()("wc-block-components-totals-fees",o),currency:t,label:a||Object(N.__)("Fee","woo-gutenberg-products-block"),value:Object(_.getSetting)("displayCartPricesIncludingTax",!1)?l+u:l})}))};n(130);var P=e=>{let{children:t,slotWrapper:n=!1,className:o}=e;return c.Children.count(t)?Object(r.createElement)("div",{className:i()(o,"wc-block-components-totals-wrapper",{"slot-wrapper":n})},t):null},R=n(7),M=n.n(R),A=n(6),D=n(19);function I(e){const t=Object(r.useContext)(D.a),n=t.slots[e]||{},o=t.fills[e],i=Object(r.useMemo)(()=>o||[],[o]);return{...n,updateSlot:Object(r.useCallback)(n=>{t.updateSlot(e,n)},[e,t.updateSlot]),unregisterSlot:Object(r.useCallback)(n=>{t.unregisterSlot(e,n)},[e,t.unregisterSlot]),fills:i,registerFill:Object(r.useCallback)(n=>{t.registerFill(e,n)},[e,t.registerFill]),unregisterFill:Object(r.useCallback)(n=>{t.unregisterFill(e,n)},[e,t.unregisterFill])}}var L=n(8),V=n(4),B=Object(r.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function U({name:e,children:t,registerFill:n,unregisterFill:o}){const i=(e=>{const{getSlot:t,subscribe:n}=Object(r.useContext)(B),[o,i]=Object(r.useState)(t(e));return Object(r.useEffect)(()=>(i(t(e)),n(()=>{i(t(e))})),[e]),o})(e),s=Object(r.useRef)({name:e,children:t});return Object(r.useLayoutEffect)(()=>(n(e,s.current),()=>o(e,s.current)),[]),Object(r.useLayoutEffect)(()=>{s.current.children=t,i&&i.forceUpdate()},[t]),Object(r.useLayoutEffect)(()=>{e!==s.current.name&&(o(s.current.name,s.current),s.current.name=e,n(e,s.current))},[e]),i&&i.node?(Object(V.isFunction)(t)&&(t=t(i.props.fillProps)),Object(r.createPortal)(t,i.node)):null}var W=e=>Object(r.createElement)(B.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(r.createElement)(U,Object(L.a)({},e,{registerFill:t,unregisterFill:n})));class H extends r.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:n,registerSlot:r}=this.props;e.name!==t&&(n(e.name),r(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:n={},getFills:o}=this.props,i=Object(V.map)(o(t,this),e=>{const t=Object(V.isFunction)(e.children)?e.children(n):e.children;return r.Children.map(t,(e,t)=>{if(!e||Object(V.isString)(e))return e;const n=e.key||t;return Object(r.cloneElement)(e,{key:n})})}).filter(Object(V.negate)(r.isEmptyElement));return Object(r.createElement)(r.Fragment,null,Object(V.isFunction)(e)?e(i):i)}}var z=e=>Object(r.createElement)(B.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:o})=>Object(r.createElement)(H,Object(L.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:o})));function $(){const[,e]=Object(r.useState)({}),t=Object(r.useRef)(!0);return Object(r.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function K({name:e,children:t}){const n=I(e),o=Object(r.useRef)({rerender:$()});return Object(r.useEffect)(()=>(n.registerFill(o),()=>{n.unregisterFill(o)}),[n.registerFill,n.unregisterFill]),n.ref&&n.ref.current?("function"==typeof t&&(t=t(n.fillProps)),Object(r.createPortal)(t,n.ref.current)):null}var G=n(12),q=Object(r.forwardRef)((function({name:e,fillProps:t={},as:n="div",...o},i){const s=Object(r.useContext)(D.a),a=Object(r.useRef)();return Object(r.useLayoutEffect)(()=>(s.registerSlot(e,a,t),()=>{s.unregisterSlot(e,a)}),[s.registerSlot,s.unregisterSlot,e]),Object(r.useLayoutEffect)(()=>{s.updateSlot(e,t)}),Object(r.createElement)(n,Object(L.a)({ref:Object(G.useMergeRefs)([i,a])},o))})),Y=n(16),Z=n.n(Y);function X({children:e}){const t=function(){const[e,t]=Object(r.useState)({}),[n,o]=Object(r.useState)({}),i=Object(r.useCallback)((e,n,r)=>{t(t=>{const o=t[e]||{};return{...t,[e]:{...o,ref:n||o.ref,fillProps:r||o.fillProps||{}}}})},[]),s=Object(r.useCallback)((e,n)=>{t(t=>{const{[e]:r,...o}=t;return(null==r?void 0:r.ref)===n?o:t})},[]),a=Object(r.useCallback)((t,r)=>{const o=e[t];if(o&&!Z()(o.fillProps,r)){o.fillProps=r;const e=n[t];e&&e.map(e=>e.current.rerender())}},[e,n]),c=Object(r.useCallback)((e,t)=>{o(n=>({...n,[e]:[...n[e]||[],t]}))},[]),l=Object(r.useCallback)((e,t)=>{o(n=>n[e]?{...n,[e]:n[e].filter(e=>e!==t)}:n)},[]);return Object(r.useMemo)(()=>({slots:e,fills:n,registerSlot:i,updateSlot:a,unregisterSlot:s,registerFill:c,unregisterFill:l}),[e,n,i,a,s,c,l])}();return Object(r.createElement)(D.a.Provider,{value:t},e)}class J extends r.Component{constructor(){super(...arguments),this.registerSlot=this.registerSlot.bind(this),this.registerFill=this.registerFill.bind(this),this.unregisterSlot=this.unregisterSlot.bind(this),this.unregisterFill=this.unregisterFill.bind(this),this.getSlot=this.getSlot.bind(this),this.getFills=this.getFills.bind(this),this.hasFills=this.hasFills.bind(this),this.subscribe=this.subscribe.bind(this),this.slots={},this.fills={},this.listeners=[],this.contextValue={registerSlot:this.registerSlot,unregisterSlot:this.unregisterSlot,registerFill:this.registerFill,unregisterFill:this.unregisterFill,getSlot:this.getSlot,getFills:this.getFills,hasFills:this.hasFills,subscribe:this.subscribe}}registerSlot(e,t){const n=this.slots[e];this.slots[e]=t,this.triggerListeners(),this.forceUpdateSlot(e),n&&n.forceUpdate()}registerFill(e,t){this.fills[e]=[...this.fills[e]||[],t],this.forceUpdateSlot(e)}unregisterSlot(e,t){this.slots[e]===t&&(delete this.slots[e],this.triggerListeners())}unregisterFill(e,t){this.fills[e]=Object(V.without)(this.fills[e],t),this.forceUpdateSlot(e)}getSlot(e){return this.slots[e]}getFills(e,t){return this.slots[e]!==t?[]:this.fills[e]}hasFills(e){return this.fills[e]&&!!this.fills[e].length}forceUpdateSlot(e){const t=this.getSlot(e);t&&t.forceUpdate()}triggerListeners(){this.listeners.forEach(e=>e())}subscribe(e){return this.listeners.push(e),()=>{this.listeners=Object(V.without)(this.listeners,e)}}render(){return Object(r.createElement)(B.Provider,{value:this.contextValue},this.props.children)}}function Q(e){return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(W,e),Object(r.createElement)(K,e))}const ee=Object(r.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(r.createElement)(q,Object(L.a)({},t,{ref:n})):Object(r.createElement)(z,t));function te({children:e,...t}){return Object(r.createElement)(J,t,Object(r.createElement)(X,null,e))}function ne(e){const t=t=>Object(r.createElement)(Q,Object(L.a)({name:e},t));t.displayName=e+"Fill";const n=t=>Object(r.createElement)(ee,Object(L.a)({name:e},t));return n.displayName=e+"Slot",n.__unstableName=e,{Fill:t,Slot:n}}var re=n(15),oe=n.n(re);class ie extends c.Component{constructor(){super(...arguments),oe()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(r.createElement)(r.Fragment,null,Object(r.createElement)("strong",null,e.status),": "+e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{renderError:e}=this.props,{errorMessage:t,hasError:n}=this.state;return n?"function"==typeof e?e(t):Object(r.createElement)("p",null,t):this.props.children}}var se=ie;const ae=e=>Array.isArray(e)&&e.filter(Boolean).length>0;let ce;ce=I;const le=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const{Fill:n,Slot:o}=ne(e),i=e=>{let{children:o}=e;return Object(r.createElement)(n,null,e=>r.Children.map(o,n=>Object(r.createElement)(se,{renderError:_.CURRENT_USER_IS_ADMIN?t:()=>null},Object(r.cloneElement)(n,e))))},s=e=>Object(r.createElement)(o,a()({},e,{bubblesVirtually:!0}));return{Fill:i,Slot:s}},{Fill:ue,Slot:pe}=le("__experimentalOrderMeta");ue.Slot=e=>{let{className:t,extensions:n,cart:o,context:s}=e;const{fills:a}=ce("__experimentalOrderMeta");return ae(a)&&Object(r.createElement)(P,{slotWrapper:!0},Object(r.createElement)(pe,{className:i()(t,"wc-block-components-order-meta"),fillProps:{extensions:n,cart:o,context:s}}))};var me=ue;const{Fill:fe,Slot:de}=le("__experimentalDiscountsMeta");fe.Slot=e=>{let{className:t,extensions:n,cart:o,context:s}=e;const{fills:a}=ce("__experimentalDiscountsMeta");return ae(a)&&Object(r.createElement)(P,{slotWrapper:!0},Object(r.createElement)(de,{className:i()(t,"wc-block-components-discounts-meta"),fillProps:{extensions:n,cart:o,context:s}}))};var he=fe;const{Fill:be,Slot:ge}=le("__experimentalOrderShippingPackages");be.Slot=e=>{let{className:t,collapsible:n,noResultsMessage:o,renderOption:s,extensions:a,cart:c,components:l,context:u,shippingRates:p}=e;const{fills:m}=ce("__experimentalOrderShippingPackages"),f=m.length>1||(null==p?void 0:p.length)>1;return Object(r.createElement)(ge,{className:i()("wc-block-components-shipping-rates-control",t),fillProps:{collapsible:n,collapse:f,showItems:f,noResultsMessage:o,renderOption:s,extensions:a,cart:c,components:l,context:u}})};var ve=be,we=function(e){let{icon:t,size:n=24,...o}=e;return Object(r.cloneElement)(t,{width:n,height:n,...o})},Oe=Object(r.createElement)(A.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(A.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),ye=Object(r.createElement)(A.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(A.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));n(131);var je=e=>{let{children:t,className:n,initialOpen:o=!1,hasBorder:s=!1,title:a,titleTag:c="div"}=e;const[l,u]=Object(r.useState)(o);return Object(r.createElement)("div",{className:i()(n,"wc-block-components-panel",{"has-border":s})},Object(r.createElement)(c,null,Object(r.createElement)("button",{"aria-expanded":l,className:"wc-block-components-panel__button",onClick:()=>u(!l)},Object(r.createElement)(we,{"aria-hidden":"true",className:"wc-block-components-panel__button-icon",icon:l?Oe:ye}),a)),l&&Object(r.createElement)("div",{className:"wc-block-components-panel__content"},t))},Ee=n(33),Se=Object(r.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(A.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));function xe(e,t,n){const{defaultView:r}=t,{frameElement:o}=r;if(!o||t===n.ownerDocument)return e;const i=o.getBoundingClientRect();return new r.DOMRect(e.left+i.left,e.top+i.top,e.width,e.height)}let ke=0;function Ne(e){const t=document.scrollingElement||document.body;e&&(ke=t.scrollTop);const n=e?"add":"remove";t.classList[n]("lockscroll"),document.documentElement.classList[n]("lockscroll"),e||(t.scrollTop=ke)}let _e=0;function Fe(){return Object(r.useEffect)(()=>(0===_e&&Ne(!0),++_e,()=>{1===_e&&Ne(!1),--_e}),[]),null}function Ce(e){return"appear"===e?"top":"left"}function Te(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:i}=(s=t).ownerDocument.defaultView.getComputedStyle(s);var s;const a=n?parseInt(n,10):0,c=r?parseInt(r,10):0,l=o?parseInt(o,10):0,u=i?parseInt(i,10):0;return{x:e.left+l,y:e.top+a,width:e.width-l-u,height:e.height-a-c,left:e.left+l,right:e.right-u,top:e.top+a,bottom:e.bottom-c}}function Pe(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function Re(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function Me(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const Ae=Object(r.forwardRef)(({headerTitle:e,onClose:t,children:n,className:o,noArrow:s=!0,isAlternate:a,position:c="bottom right",range:l,focusOnMount:u="firstElement",anchorRef:p,shouldAnchorIncludePadding:m,anchorRect:f,getAnchorRect:d,expandOnMobile:h,animate:b=!0,onClickOutside:g,onFocusOutside:v,__unstableStickyBoundaryElement:w,__unstableSlotName:O="Popover",__unstableObserveElement:y,__unstableBoundaryParent:j,__unstableForcePosition:E,__unstableForceXAlignment:S,...x},k)=>{const _=Object(r.useRef)(null),F=Object(r.useRef)(null),C=Object(r.useRef)(),T=Object(G.useViewportMatch)("medium","<"),[P,R]=Object(r.useState)(),A=I(O),D=h&&T,[V,B]=Object(G.useResizeObserver)();s=D||s,Object(r.useLayoutEffect)(()=>{if(D)return Me(C.current,"is-without-arrow",s),Me(C.current,"is-alternate",a),Pe(C.current,"data-x-axis"),Pe(C.current,"data-y-axis"),Re(C.current,"top"),Re(C.current,"left"),Re(F.current,"maxHeight"),void Re(F.current,"maxWidth");const e=()=>{if(!C.current||!F.current)return;let e=function(e,t,n,r=!1,o,i){if(t)return t;if(n){if(!e.current)return;const t=n(e.current);return xe(t,t.ownerDocument||e.current.ownerDocument,i)}if(!1!==r){if(!(r&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==r?void 0:r.cloneRange))return xe(Object(Ee.getRectangleFromRange)(r),r.endContainer.ownerDocument,i);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=xe(r.getBoundingClientRect(),r.ownerDocument,i);return o?e:Te(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),s=t.getBoundingClientRect(),a=xe(new window.DOMRect(n.left,n.top,n.width,s.bottom-n.top),e.ownerDocument,i);return o?a:Te(a,r)}if(!e.current)return;const{parentNode:s}=e.current,a=s.getBoundingClientRect();return o?a:Te(a,s)}(_,f,d,p,m,C.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=C.current;let r,o=0;if(t&&t!==n.body){const n=t.getBoundingClientRect();o=n.top,e=new window.DOMRect(e.left-n.left,e.top-n.top,e.width,e.height)}var i;j&&(r=null===(i=C.current.closest(".popover-slot"))||void 0===i?void 0:i.parentNode);const l=B.height?B:F.current.getBoundingClientRect(),{popoverTop:u,popoverLeft:h,xAxis:b,yAxis:g,contentHeight:v,contentWidth:O}=function(e,t,n="top",r,o,i,s,a,c){const[l,u="center",p]=n.split(" "),m=function(e,t,n,r,o,i,s,a){const{height:c}=t;if(o){const t=o.getBoundingClientRect().top+c-s;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===r?l=e.bottom:"top"===r&&(l=e.top);const u={popoverTop:l,contentHeight:(l-c/2>0?c/2:l)+(l+c/2>window.innerHeight?window.innerHeight-l:c/2)},p={popoverTop:e.top,contentHeight:e.top-10-c>0?c:e.top-10},m={popoverTop:e.bottom,contentHeight:e.bottom+10+c>window.innerHeight?window.innerHeight-10-e.bottom:c};let f,d=n,h=null;if(!o&&!a)if("middle"===n&&u.contentHeight===c)d="middle";else if("top"===n&&p.contentHeight===c)d="top";else if("bottom"===n&&m.contentHeight===c)d="bottom";else{d=p.contentHeight>m.contentHeight?"top":"bottom";const e="top"===d?p.contentHeight:m.contentHeight;h=e!==c?e:null}return f="middle"===d?u.popoverTop:"top"===d?p.popoverTop:m.popoverTop,{yAxis:d,popoverTop:f,contentHeight:h}}(e,t,l,p,r,0,i,a);return{...function(e,t,n,r,o,i,s,a,c){const{width:l}=t;"left"===n&&Object(N.isRTL)()?n="right":"right"===n&&Object(N.isRTL)()&&(n="left"),"left"===r&&Object(N.isRTL)()?r="right":"right"===r&&Object(N.isRTL)()&&(r="left");const u=Math.round(e.left+e.width/2),p={popoverLeft:u,contentWidth:(u-l/2>0?l/2:u)+(u+l/2>window.innerWidth?window.innerWidth-u:l/2)};let m=e.left;"right"===r?m=e.right:"middle"===i||c||(m=u);let f=e.right;"left"===r?f=e.left:"middle"===i||c||(f=u);const d={popoverLeft:m,contentWidth:m-l>0?l:m},h={popoverLeft:f,contentWidth:f+l>window.innerWidth?window.innerWidth-f:l};let b,g=n,v=null;if(!o&&!a)if("center"===n&&p.contentWidth===l)g="center";else if("left"===n&&d.contentWidth===l)g="left";else if("right"===n&&h.contentWidth===l)g="right";else{g=d.contentWidth>h.contentWidth?"left":"right";const e="left"===g?d.contentWidth:h.contentWidth;l>window.innerWidth&&(v=window.innerWidth),e!==l&&(g="center",p.popoverLeft=window.innerWidth/2)}if(b="center"===g?p.popoverLeft:"left"===g?d.popoverLeft:h.popoverLeft,s){const e=s.getBoundingClientRect();b=Math.min(b,e.right-l),Object(N.isRTL)()||(b=Math.max(b,0))}return{xAxis:g,popoverLeft:b,contentWidth:v}}(e,t,u,p,r,m.yAxis,s,a,c),...m}}(e,l,c,w,C.current,o,r,E,S);"number"==typeof u&&"number"==typeof h&&(Re(C.current,"top",u+"px"),Re(C.current,"left",h+"px")),Me(C.current,"is-without-arrow",s||"center"===b&&"middle"===g),Me(C.current,"is-alternate",a),Pe(C.current,"data-x-axis",b),Pe(C.current,"data-y-axis",g),Re(F.current,"maxHeight","number"==typeof v?v+"px":""),Re(F.current,"maxWidth","number"==typeof O?O+"px":""),R(({left:"right",right:"left"}[b]||"center")+" "+({top:"bottom",bottom:"top"}[g]||"middle"))};e();const{ownerDocument:t}=C.current,{defaultView:n}=t,r=n.setInterval(e,500);let o;const i=()=>{n.cancelAnimationFrame(o),o=n.requestAnimationFrame(e)};n.addEventListener("click",i),n.addEventListener("resize",e),n.addEventListener("scroll",e,!0);const l=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(p);let u;return l&&l!==t&&(l.defaultView.addEventListener("resize",e),l.defaultView.addEventListener("scroll",e,!0)),y&&(u=new n.MutationObserver(e),u.observe(y,{attributes:!0})),()=>{n.clearInterval(r),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",i),n.cancelAnimationFrame(o),l&&l!==t&&(l.defaultView.removeEventListener("resize",e),l.defaultView.removeEventListener("scroll",e,!0)),u&&u.disconnect()}},[D,f,d,p,m,c,B,w,y,j]);const U=(e,n)=>{if("focus-outside"===e&&v)v(n);else if("focus-outside"===e&&g){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),M()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),g(e)}else t&&t()},[W,H]=Object(G.__experimentalUseDialog)({focusOnMount:u,__unstableOnClose:U,onClose:U}),z=Object(G.useMergeRefs)([C,W,k]),$=Boolean(b&&P)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:n=Ce(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+n):void 0}({type:"appear",origin:P});let K=Object(r.createElement)("div",Object(L.a)({className:i()("components-popover",o,$,{"is-expanded":D,"is-without-arrow":s,"is-alternate":a})},x,{ref:z},H,{tabIndex:"-1"}),D&&Object(r.createElement)(Fe,null),D&&Object(r.createElement)("div",{className:"components-popover__header"},Object(r.createElement)("span",{className:"components-popover__header-title"},e),Object(r.createElement)(Ge,{className:"components-popover__close",icon:Se,onClick:t})),Object(r.createElement)("div",{ref:F,className:"components-popover__content"},Object(r.createElement)("div",{style:{position:"relative"}},V,n)));return A.ref&&(K=Object(r.createElement)(Q,{name:O},K)),p||f?K:Object(r.createElement)("span",{ref:_},K)});Ae.Slot=Object(r.forwardRef)((function({name:e="Popover"},t){return Object(r.createElement)(ee,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var De=Ae,Ie=function({shortcut:e,className:t}){if(!e)return null;let n,o;return Object(V.isString)(e)&&(n=e),Object(V.isObject)(e)&&(n=e.display,o=e.ariaLabel),Object(r.createElement)("span",{className:t,"aria-label":o},n)};const Le=Object(r.createElement)("div",{className:"event-catcher"}),Ve=({eventHandlers:e,child:t,childrenWithPopover:n})=>Object(r.cloneElement)(Object(r.createElement)("span",{className:"disabled-element-wrapper"},Object(r.cloneElement)(Le,e),Object(r.cloneElement)(t,{children:n}),","),e),Be=({child:e,eventHandlers:t,childrenWithPopover:n})=>Object(r.cloneElement)(e,{...t,children:n}),Ue=(e,t,n)=>{if(1!==r.Children.count(e))return;const o=r.Children.only(e);"function"==typeof o.props[t]&&o.props[t](n)};var We=function({children:e,position:t,text:n,shortcut:o}){const[i,s]=Object(r.useState)(!1),[a,c]=Object(r.useState)(!1),l=Object(G.useDebounce)(c,700),u=t=>{Ue(e,"onMouseDown",t),document.addEventListener("mouseup",f),s(!0)},p=t=>{Ue(e,"onMouseUp",t),document.removeEventListener("mouseup",f),s(!1)},m=e=>"mouseUp"===e?p:"mouseDown"===e?u:void 0,f=m("mouseUp"),d=(t,n)=>r=>{if(Ue(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&i)return;l.cancel();const o=Object(V.includes)(["focus","mouseenter"],r.type);o!==a&&(n?l(o):c(o))},h=()=>{l.cancel(),document.removeEventListener("mouseup",f)};if(Object(r.useEffect)(()=>h,[]),1!==r.Children.count(e))return e;const b={onMouseEnter:d("onMouseEnter",!0),onMouseLeave:d("onMouseLeave"),onClick:d("onClick"),onFocus:d("onFocus"),onBlur:d("onBlur"),onMouseDown:m("mouseDown")},g=r.Children.only(e),{children:v,disabled:w}=g.props;return(w?Ve:Be)({child:g,eventHandlers:b,childrenWithPopover:(({grandchildren:e,isOver:t,position:n,text:o,shortcut:i})=>Object(r.concatChildren)(e,t&&Object(r.createElement)(De,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},o,Object(r.createElement)(Ie,{className:"components-tooltip__shortcut",shortcut:i}))))({grandchildren:v,isOver:a,position:t,text:n,shortcut:o})})},He=function({icon:e,className:t,...n}){const o=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(r.createElement)("span",Object(L.a)({className:o},n))},ze=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return Object(r.createElement)(He,Object(L.a)({icon:e},n));if(Object(r.isValidElement)(e)&&He===e.type)return Object(r.cloneElement)(e,{...n});if("function"==typeof e)return e.prototype instanceof r.Component?Object(r.createElement)(e,{size:t,...n}):e({size:t,...n});if(e&&("svg"===e.type||e.type===A.SVG)){const o={width:t,height:t,...e.props,...n};return Object(r.createElement)(A.SVG,o)}return Object(r.isValidElement)(e)?Object(r.cloneElement)(e,{size:t,...n}):e},$e=Object(r.forwardRef)((function({as:e="div",className:t,...n},o){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(r.createElement)(e,t)}({as:e,className:i()("components-visually-hidden",t),...n,ref:o})}));const Ke=["onMouseDown","onClick"];var Ge=Object(r.forwardRef)((function(e,t){const{href:n,target:o,isSmall:s,isPressed:a,isBusy:c,isDestructive:l,className:u,disabled:p,icon:m,iconPosition:f="left",iconSize:d,showTooltip:h,tooltipPosition:b,shortcut:g,label:v,children:w,text:O,variant:y,__experimentalIsFocusable:j,describedBy:E,...S}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:i,...s}){let a=i;var c,l,u,p,m;return t&&(null!==(c=a)&&void 0!==c||(a="primary")),r&&(null!==(l=a)&&void 0!==l||(a="tertiary")),n&&(null!==(u=a)&&void 0!==u||(a="secondary")),e&&(M()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=a)&&void 0!==p||(a="secondary")),o&&(null!==(m=a)&&void 0!==m||(a="link")),{...s,variant:a}}(e),x=i()("components-button",u,{"is-secondary":"secondary"===y,"is-primary":"primary"===y,"is-small":s,"is-tertiary":"tertiary"===y,"is-pressed":a,"is-busy":c,"is-link":"link"===y,"is-destructive":l,"has-text":!!m&&!!w,"has-icon":!!m}),k=p&&!j,N=void 0===n||k?"button":"a",_="a"===N?{href:n,target:o}:{type:"button",disabled:k,"aria-pressed":a};if(p&&j){_["aria-disabled"]=!0;for(const e of Ke)S[e]=e=>{e.stopPropagation(),e.preventDefault()}}const F=!k&&(h&&v||g||!!v&&(!w||Object(V.isArray)(w)&&!w.length)&&!1!==h),C=E?Object(V.uniqueId)():null,T=S["aria-describedby"]||C,P=Object(r.createElement)(N,Object(L.a)({},_,S,{className:x,"aria-label":S["aria-label"]||v,"aria-describedby":T,ref:t}),m&&"left"===f&&Object(r.createElement)(ze,{icon:m,size:d}),O&&Object(r.createElement)(r.Fragment,null,O),m&&"right"===f&&Object(r.createElement)(ze,{icon:m,size:d}),w);return F?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(We,{text:E||v,shortcut:g,position:b},P),E&&Object(r.createElement)($e,null,Object(r.createElement)("span",{id:C},E))):Object(r.createElement)(r.Fragment,null,P,E&&Object(r.createElement)($e,null,Object(r.createElement)("span",{id:C},E)))}));n(133);var qe=()=>Object(r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"});n(132);var Ye=e=>{let{className:t,showSpinner:n=!1,children:o,variant:s="contained",...c}=e;const l=i()("wc-block-components-button",t,s,{"wc-block-components-button--loading":n});return Object(r.createElement)(Ge,a()({className:l},c),n&&Object(r.createElement)(qe,null),Object(r.createElement)("span",{className:"wc-block-components-button__text"},o))},Ze=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:s,wrapperProps:a={}}=e;const c=null!=n,l=null!=o;return!c&&l?(t=s||"span",a={...a,className:i()(a.className,"screen-reader-text")},Object(r.createElement)(t,a,o)):(t=s||r.Fragment,c&&l&&n!==o?Object(r.createElement)(t,a,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,a,n))};n(134);const Xe=e=>{let{className:t,label:n,id:o,onChange:s,children:c,hasError:l=!1,checked:u=!1,disabled:p=!1,...m}=e;const f=Object(G.useInstanceId)(Xe),d=o||"checkbox-control-"+f;return Object(r.createElement)("div",{className:i()("wc-block-components-checkbox",{"has-error":l},t)},Object(r.createElement)("label",{htmlFor:d},Object(r.createElement)("input",a()({id:d,className:"wc-block-components-checkbox__input",type:"checkbox",onChange:e=>s(e.target.checked),"aria-invalid":!0===l,checked:u,disabled:p},m)),Object(r.createElement)("svg",{className:"wc-block-components-checkbox__mark","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 20"},Object(r.createElement)("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"})),n&&Object(r.createElement)("span",{className:"wc-block-components-checkbox__label"},n),c))};var Je=Xe;const Qe=(e,t)=>{if(!e.includes(t))throw Error(Object(N.sprintf)(
2
  /* translators: %1$s value passed to filter, %2$s : value that must be included. */
3
- Object(N.__)('Returned value must include %1$s, you passed "%2$s"',"woo-gutenberg-products-block"),t,e));return!0};var et=n(3),tt=n(9);const nt=e=>{const{applyExtensionCartUpdate:t}=Object(et.dispatch)(tt.b);return t(e)},rt=e=>null===e,ot=e=>!rt(e)&&e instanceof Object&&e.constructor===Object,it=()=>!0;let st={};const at=(e,t)=>{Object.keys(t).includes("couponName")&&M()("snackbarNotices",{alternative:"snackbarNoticeVisibility",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4417"}),Object.keys(t).includes("couponName")&&M()("couponName",{alternative:"coupons",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/bb921d21f42e21f38df2b1c87b48e07aa4cb0538/docs/extensibility/available-filters.md#coupons"}),st={...st,[e]:t}},ct={},lt=(e,t,n,r)=>{ct[e]={arg:t,extensions:n,defaultValue:r}},ut=(e,t)=>!(!rt(e)||!rt(t))||ot(e)&&ot(t)&&Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>{return o=n,ot(r=t)&&o in r&&Z()(e[n],t[n]);var r,o}),pt=e=>{let{filterName:t,defaultValue:n,extensions:o=null,arg:i=null,validation:s=it}=e;const a=Object(r.useRef)({});return Object(r.useMemo)(()=>{if(!((e,t,n,r)=>{const o=ct[e];if(!o)return lt(e,t,n,r),!0;const{arg:i={},extensions:s={},defaultValue:a=null}=o;return ut(t,i)?!(r===a&&ut(n,s)||(lt(e,t,n,r),0)):(lt(e,t,n,r),!0)})(t,i,o,n)&&void 0!==a.current[t])return a.current[t];const e=(e=>Object.keys(st).map(t=>st[t][e]).filter(Boolean))(t);let r=n;return e.forEach(e=>{try{const t=e(r,o||{},i);if(typeof t!=typeof r)throw new Error(Object(N.sprintf)(
4
  /* translators: %1$s is the type of the variable passed to the filter function, %2$s is the type of the value returned by the filter function. */
5
- Object(N.__)("The type returned by checkout filters must be the same as the type they receive. The function received %1$s but returned %2$s.","woo-gutenberg-products-block"),typeof r,typeof t));r=s(t)?t:r}catch(e){if(_.CURRENT_USER_IS_ADMIN)throw e;console.error(e)}}),a.current[t]=r,r},[t,n,o,i,s])};let mt;!function(e){e.CHECKOUT="woocommerce/checkout",e.CHECKOUT_FIELDS="woocommerce/checkout-fields-block",e.CHECKOUT_TOTALS="woocommerce/checkout-totals-block",e.CONTACT_INFORMATION="woocommerce/checkout-contact-information-block",e.SHIPPING_ADDRESS="woocommerce/checkout-shipping-address-block",e.BILLING_ADDRESS="woocommerce/checkout-billing-address-block",e.SHIPPING_METHODS="woocommerce/checkout-shipping-methods-block",e.PAYMENT_METHODS="woocommerce/checkout-payment-methods-block",e.CART="woocommerce/cart",e.EMPTY_CART="woocommerce/empty-cart-block",e.FILLED_CART="woocommerce/filled-cart-block",e.CART_ITEMS="woocommerce/cart-items-block",e.CART_TOTALS="woocommerce/cart-totals-block",e.MINI_CART="woocommerce/mini-cart-contents",e.EMPTY_MINI_CART="woocommerce/empty-mini-cart-contents-block",e.FILLED_MINI_CART="woocommerce/filled-mini-cart-contents-block",e.MINI_CART_ITEMS="woocommerce/mini-cart-items-block",e.CART_ORDER_SUMMARY="woocommerce/cart-order-summary-block",e.CHECKOUT_ORDER_SUMMARY="woocommerce/checkout-order-summary-block"}(mt||(mt={}));const ft={},dt=e=>Object.values(mt).includes(e),ht=e=>dt(e)?Object.values(ft).filter(t=>{let{metadata:n}=t;return((null==n?void 0:n.parent)||[]).includes(e)}):[];var bt=n(34);const gt=e=>{var t,n,r,o;((e,t,n)=>{if(!ot(e))return;const r=typeof e.metadata;if("object"!==r)throw new Error(`Incorrect value for the metadata argument when registering a block component. It was a ${r}, but must be a object.`)})(e),(e=>{if(((e,t,n)=>{const r=typeof t;if("string"!==r)throw new Error(`Incorrect value for the blockName argument when registering a checkout block. It was a ${r}, but must be a string.`)})(0,e),!e)throw new Error("Value for the blockName argument must not be empty.")})(e.metadata.name),(e=>{if("string"!=typeof e&&!Array.isArray(e))throw new Error(`Incorrect value for the parent argument when registering a checkout block. It was a ${typeof e}, but must be a string or array of strings.`);if("string"==typeof e&&!dt(e))throw new Error("When registering a checkout block, the parent must be a valid inner block area.");if(Array.isArray(e)&&!e.some(e=>dt(e)))throw new Error("When registering a checkout block, the parent must be a valid inner block area.")})(e.metadata.parent),((e,t)=>{const n=e.component;if(n){if("function"==typeof n)return;if(ot(n)&&n.$$typeof&&n.$$typeof===Symbol.for("react.lazy"))return}throw new Error("Incorrect value for the component argument when registering a block component. Component must be a valid React Element or Lazy callback.")})(e),Object(bt.registerBlockComponent)({blockName:e.metadata.name,component:e.component}),ft[e.metadata.name]={blockName:e.metadata.name,metadata:e.metadata,component:e.component,force:!(null===(t=e.metadata)||void 0===t||null===(n=t.attributes)||void 0===n||null===(r=n.lock)||void 0===r||null===(o=r.default)||void 0===o||!o.remove)}}},14:function(e,t){e.exports=window.React},15:function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},16:function(e,t){e.exports=window.wp.isShallowEqual},19:function(e,t,n){"use strict";(function(e){var r=n(0);n(32);const o=Object(r.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,n(20))},2:function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var s=o.apply(null,r);s&&e.push(s)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var a in r)n.call(r,a)&&r[a]&&e.push(a);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},20:function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,l=[],u=!1,p=-1;function m(){u&&c&&(u=!1,c.length?l=c.concat(l):p=-1,l.length&&f())}function f(){if(!u){var e=a(m);u=!0;for(var t=l.length;t;){for(c=l,l=[];++p<t;)c&&c[p].run();p=-1,t=l.length}c=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function h(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new d(e,t)),1!==l.length||u||a(f)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=h,o.addListener=h,o.once=h,o.off=h,o.removeListener=h,o.removeAllListeners=h,o.emit=h,o.prependListener=h,o.prependOnceListener=h,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},3:function(e,t){e.exports=window.wp.data},32:function(e,t){e.exports=window.wp.warning},33:function(e,t){e.exports=window.wp.dom},34:function(e,t){e.exports=window.wc.wcBlocksRegistry},4:function(e,t){e.exports=window.lodash},5:function(e,t){e.exports=window.wc.wcSettings},6:function(e,t){e.exports=window.wp.primitives},7:function(e,t){e.exports=window.wp.deprecated},8:function(e,t,n){"use strict";function r(){return(r=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}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},9:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return i}));var r=n(1);const o="wc/store/cart",i={code:"cart_api_error",message:Object(r.__)("Unable to get cart data from the API.","woo-gutenberg-products-block"),data:{status:500}}}});
1
+ this.wc=this.wc||{},this.wc.blocksCheckout=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=137)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},10:function(e,t){function n(){return e.exports=n=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},e.exports.__esModule=!0,e.exports.default=e.exports,n.apply(this,arguments)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports},11:function(e,t){e.exports=window.wp.compose},12:function(e,t){e.exports=window.wp.isShallowEqual},130:function(e,t){},131:function(e,t){},132:function(e,t){},133:function(e,t){},134:function(e,t){},135:function(e,t){},136:function(e,t){},137:function(e,t,n){"use strict";n.r(t),n.d(t,"TotalsItem",(function(){return k})),n.d(t,"Subtotal",(function(){return F})),n.d(t,"TotalsTaxes",(function(){return C})),n.d(t,"TotalsFees",(function(){return T})),n.d(t,"TotalsWrapper",(function(){return P})),n.d(t,"ExperimentalOrderMeta",(function(){return me})),n.d(t,"ExperimentalDiscountsMeta",(function(){return he})),n.d(t,"ExperimentalOrderShippingPackages",(function(){return ve})),n.d(t,"Panel",(function(){return je})),n.d(t,"Button",(function(){return Ye})),n.d(t,"Label",(function(){return Ze})),n.d(t,"CheckboxControl",(function(){return Je})),n.d(t,"mustContain",(function(){return Qe})),n.d(t,"extensionCartUpdate",(function(){return nt})),n.d(t,"hasValidFills",(function(){return ae})),n.d(t,"useSlot",(function(){return ce})),n.d(t,"createSlotFill",(function(){return le})),n.d(t,"__experimentalRegisterCheckoutFilters",(function(){return at})),n.d(t,"__experimentalApplyCheckoutFilter",(function(){return pt})),n.d(t,"hasInnerBlocks",(function(){return dt})),n.d(t,"getRegisteredBlocks",(function(){return ht})),n.d(t,"registerCheckoutBlock",(function(){return gt})),n.d(t,"innerBlockAreas",(function(){return mt})),n.d(t,"SlotFillProvider",(function(){return te}));var r=n(0),o=n(3),i=n.n(o),s=n(10),a=n.n(s),c=n(15),l=n.n(c);function u(){}function p(e){return!!(e||"").match(/\d/)}function m(e){return null==e}function f(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function d(e,t){void 0===t&&(t=!0);var n="-"===e[0],r=n&&t,o=(e=e.replace("-","")).split(".");return{beforeDecimal:o[0],afterDecimal:o[1]||"",hasNagation:n,addNegation:r}}function h(e,t,n){for(var r="",o=n?"0":"",i=0;i<=t-1;i++)r+=e[i]||o;return r}function b(e,t){return Array(t+1).join(e)}function g(e,t){if(e.value=e.value,null!==e){if(e.createTextRange){var n=e.createTextRange();return n.move("character",t),n.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}function v(e,t,n){return Math.min(Math.max(e,t),n)}function w(e){return Math.max(e.selectionStart,e.selectionEnd)}var O={displayType:"input",decimalSeparator:".",thousandsGroupStyle:"thousand",fixedDecimalScale:!1,prefix:"",suffix:"",allowNegative:!0,allowEmptyFormatting:!1,allowLeadingZeros:!1,isNumericString:!1,type:"text",onValueChange:u,onChange:u,onKeyDown:u,onMouseUp:u,onFocus:u,onBlur:u,isAllowed:function(){return!0}},y=function(e){function t(t){e.call(this,t);var n=t.defaultValue;this.validateProps();var r=this.formatValueProp(n);this.state={value:r,numAsString:this.removeFormatting(r),mounted:!1},this.selectionBeforeInput={selectionStart:0,selectionEnd:0},this.onChange=this.onChange.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.componentDidMount=function(){this.setState({mounted:!0})},t.prototype.componentDidUpdate=function(e){this.updateValueIfRequired(e)},t.prototype.componentWillUnmount=function(){clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout)},t.prototype.updateValueIfRequired=function(e){var t=this.props,n=this.state,r=this.focusedElm,o=n.value,i=n.numAsString;if(void 0===i&&(i=""),e!==t){this.validateProps();var s=this.formatNumString(i),a=m(t.value)?s:this.formatValueProp(),c=this.removeFormatting(a),l=parseFloat(c),u=parseFloat(i);(isNaN(l)&&isNaN(u)||l===u)&&s===o&&(null!==r||a===o)||this.updateValue({formattedValue:a,numAsString:c,input:r,source:"prop",event:null})}},t.prototype.getFloatString=function(e){void 0===e&&(e="");var t=this.props.decimalScale,n=this.getSeparators().decimalSeparator,r=this.getNumberRegex(!0),o="-"===e[0];o&&(e=e.replace("-","")),n&&0===t&&(e=e.split(n)[0]);var i=(e=(e.match(r)||[]).join("").replace(n,".")).indexOf(".");return-1!==i&&(e=e.substring(0,i)+"."+e.substring(i+1,e.length).replace(new RegExp(f(n),"g"),"")),o&&(e="-"+e),e},t.prototype.getNumberRegex=function(e,t){var n=this.props,r=n.format,o=n.decimalScale,i=n.customNumerals,s=this.getSeparators().decimalSeparator;return new RegExp("[0-9"+(i?i.join(""):"")+"]"+(!s||0===o||t||r?"":"|"+f(s)),e?"g":void 0)},t.prototype.getSeparators=function(){var e=this.props.decimalSeparator,t=this.props,n=t.thousandSeparator,r=t.allowedDecimalSeparators;return!0===n&&(n=","),r||(r=[e,"."]),{decimalSeparator:e,thousandSeparator:n,allowedDecimalSeparators:r}},t.prototype.getMaskAtIndex=function(e){var t=this.props.mask;return void 0===t&&(t=" "),"string"==typeof t?t:t[e]||" "},t.prototype.getValueObject=function(e,t){var n=parseFloat(t);return{formattedValue:e,value:t,floatValue:isNaN(n)?void 0:n}},t.prototype.validateProps=function(){var e=this.props.mask,t=this.getSeparators(),n=t.decimalSeparator,r=t.thousandSeparator;if(n===r)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: "+r+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+n+" (default value for decimalSeparator is .)\n ");if(e&&("string"===e?e:e.toString()).match(/\d/g))throw new Error("\n Mask "+e+" should not contain numeric character;\n ")},t.prototype.setPatchedCaretPosition=function(e,t,n){g(e,t),this.caretPositionTimeout=setTimeout((function(){e.value===n&&g(e,t)}),0)},t.prototype.correctCaretPosition=function(e,t,n){var r=this.props,o=r.prefix,i=r.suffix,s=r.format;if(""===e)return 0;if(t=v(t,0,e.length),!s){var a="-"===e[0];return v(t,o.length+(a?1:0),e.length-i.length)}if("function"==typeof s)return t;if("#"===s[t]&&p(e[t]))return t;if("#"===s[t-1]&&p(e[t-1]))return t;var c=s.indexOf("#");t=v(t,c,s.lastIndexOf("#")+1);for(var l=s.substring(t,s.length).indexOf("#"),u=t,m=t+(-1===l?0:l);u>c&&("#"!==s[u]||!p(e[u]));)u-=1;return!p(e[m])||"left"===n&&t!==c||t-u<m-t?p(e[u])?u+1:u:m},t.prototype.getCaretPosition=function(e,t,n){var r,o,i=this.props.format,s=this.state.value,a=this.getNumberRegex(!0),c=(e.match(a)||[]).join(""),l=(t.match(a)||[]).join("");for(r=0,o=0;o<n;o++){var u=e[o]||"",p=t[r]||"";if((u.match(a)||u===p)&&("0"!==u||!p.match(a)||"0"===p||c.length===l.length)){for(;u!==t[r]&&r<t.length;)r++;r++}}return"string"!=typeof i||s||(r=t.length),this.correctCaretPosition(t,r)},t.prototype.removePrefixAndSuffix=function(e){var t=this.props,n=t.format,r=t.prefix,o=t.suffix;if(!n&&e){var i="-"===e[0];i&&(e=e.substring(1,e.length));var s=(e=r&&0===e.indexOf(r)?e.substring(r.length,e.length):e).lastIndexOf(o);e=o&&-1!==s&&s===e.length-o.length?e.substring(0,s):e,i&&(e="-"+e)}return e},t.prototype.removePatternFormatting=function(e){for(var t=this.props.format.split("#").filter((function(e){return""!==e})),n=0,r="",o=0,i=t.length;o<=i;o++){var s=t[o]||"",a=o===i?e.length:e.indexOf(s,n);if(-1===a){r=e;break}r+=e.substring(n,a),n=a+s.length}return(r.match(this.getNumberRegex(!0))||[]).join("")},t.prototype.removeFormatting=function(e){var t=this.props,n=t.format,r=t.removeFormatting;return e?(n?e="string"==typeof n?this.removePatternFormatting(e):"function"==typeof r?r(e):(e.match(this.getNumberRegex(!0))||[]).join(""):(e=this.removePrefixAndSuffix(e),e=this.getFloatString(e)),e):e},t.prototype.formatWithPattern=function(e){for(var t=this.props.format,n=0,r=t.split(""),o=0,i=t.length;o<i;o++)"#"===t[o]&&(r[o]=e[n]||this.getMaskAtIndex(n),n+=1);return r.join("")},t.prototype.formatAsNumber=function(e){var t=this.props,n=t.decimalScale,r=t.fixedDecimalScale,o=t.prefix,i=t.suffix,s=t.allowNegative,a=t.thousandsGroupStyle,c=this.getSeparators(),l=c.thousandSeparator,u=c.decimalSeparator,p=-1!==e.indexOf(".")||n&&r,m=d(e,s),f=m.beforeDecimal,b=m.afterDecimal,g=m.addNegation;return void 0!==n&&(b=h(b,n,r)),l&&(f=function(e,t,n){var r=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}(n),o=e.search(/[1-9]/);return o=-1===o?e.length:o,e.substring(0,o)+e.substring(o,e.length).replace(r,"$1"+t)}(f,l,a)),o&&(f=o+f),i&&(b+=i),g&&(f="-"+f),f+(p&&u||"")+b},t.prototype.formatNumString=function(e){void 0===e&&(e="");var t=this.props,n=t.format,r=t.allowEmptyFormatting,o=t.customNumerals,i=e;if(o&&10===o.length){var s=new RegExp("["+o.join("")+"]","g");i=e.replace(s,(function(e){return o.indexOf(e).toString()}))}return""!==e||r?"-"!==e||n?"string"==typeof n?this.formatWithPattern(i):"function"==typeof n?n(i):this.formatAsNumber(i):"-":""},t.prototype.formatValueProp=function(e){var t=this.props,n=t.format,r=t.decimalScale,o=t.fixedDecimalScale,i=t.allowEmptyFormatting,s=this.props,a=s.value,c=s.isNumericString,l=!(a=m(a)?e:a)&&0!==a;return l&&i&&(a=""),l&&!i?"":("number"==typeof a&&(a=function(e){var t="-"===(e+="")[0]?"-":"";t&&(e=e.substring(1));var n=e.split(/[eE]/g),r=n[0],o=n[1];if(!(o=Number(o)))return t+r;var i=1+o,s=(r=r.replace(".","")).length;return i<0?r="0."+b("0",Math.abs(i))+r:i>=s?r+=b("0",i-s):r=(r.substring(0,i)||"0")+"."+r.substring(i),t+r}(a),c=!0),"Infinity"===a&&c&&(a=""),c&&!n&&"number"==typeof r&&(a=function(e,t,n){if(-1!==["","-"].indexOf(e))return e;var r=-1!==e.indexOf(".")&&t,o=d(e),i=o.beforeDecimal,s=o.afterDecimal,a=o.hasNagation,c=parseFloat("0."+(s||"0")),l=(s.length<=t?"0."+s:c.toFixed(t)).split(".");return(a?"-":"")+i.split("").reverse().reduce((function(e,t,n){return e.length>n?(Number(e[0])+Number(t)).toString()+e.substring(1,e.length):t+e}),l[0])+(r?".":"")+h(l[1]||"",Math.min(t,s.length),n)}(a,r,o)),c?this.formatNumString(a):this.formatInput(a))},t.prototype.formatNegation=function(e){void 0===e&&(e="");var t=this.props.allowNegative,n=new RegExp("(-)"),r=new RegExp("(-)(.)*(-)"),o=n.test(e),i=r.test(e);return e=e.replace(/-/g,""),o&&!i&&t&&(e="-"+e),e},t.prototype.formatInput=function(e){return void 0===e&&(e=""),this.props.format||(e=this.removePrefixAndSuffix(e),e=this.formatNegation(e)),e=this.removeFormatting(e),this.formatNumString(e)},t.prototype.isCharacterAFormat=function(e,t){var n=this.props,r=n.format,o=n.prefix,i=n.suffix,s=n.decimalScale,a=n.fixedDecimalScale,c=this.getSeparators().decimalSeparator;return"string"==typeof r&&"#"!==r[e]||!(r||!(e<o.length||e>=t.length-i.length||s&&a&&t[e]===c))},t.prototype.correctInputValue=function(e,t,n){var r=this,o=this.props,i=o.format,s=o.allowNegative,a=o.prefix,c=o.suffix,l=o.decimalScale,u=this.getSeparators(),p=u.allowedDecimalSeparators,m=u.decimalSeparator,f=this.state.numAsString||"",h=this.selectionBeforeInput,b=h.selectionStart,g=h.selectionEnd,v=function(e,t){for(var n=0,r=0,o=e.length,i=t.length;e[n]===t[n]&&n<o;)n++;for(;e[o-1-r]===t[i-1-r]&&i-r>n&&o-r>n;)r++;return{start:n,end:o-r}}(t,n),w=v.start,O=v.end;if(!i&&w===O&&-1!==p.indexOf(n[b])){var y=0===l?"":m;return n.substr(0,b)+y+n.substr(b+1,n.length)}var j=i?0:a.length,E=t.length-(i?0:c.length);if(n.length>t.length||!n.length||w===O||0===b&&g===t.length||0===w&&O===t.length||b===j&&g===E)return n;var S=t.substr(w,O-w);if([].concat(S).find((function(e,n){return r.isCharacterAFormat(n+w,t)}))){var x=t.substr(w),k={},N=[];[].concat(x).forEach((function(e,n){r.isCharacterAFormat(n+w,t)?k[n]=e:n>S.length-1&&N.push(e)})),Object.keys(k).forEach((function(e){N.length>e?N.splice(e,0,k[e]):N.push(k[e])})),n=t.substr(0,w)+N.join("")}if(!i){var _=this.removeFormatting(n),F=d(_,s),C=F.beforeDecimal,T=F.afterDecimal,P=F.addNegation,R=e<n.indexOf(m)+1;if(_.length<f.length&&R&&""===C&&!parseFloat(T))return P?"-":""}return n},t.prototype.updateValue=function(e){var t=e.formattedValue,n=e.input,r=e.setCaretPosition;void 0===r&&(r=!0);var o=e.source,i=e.event,s=e.numAsString,a=e.caretPos,c=this.props.onValueChange,l=this.state.value;if(n){if(void 0===a&&r){var u=e.inputValue||n.value,p=w(n);n.value=t,a=this.getCaretPosition(u,t,p)}n.value=t,r&&this.setPatchedCaretPosition(n,a,t)}void 0===s&&(s=this.removeFormatting(t)),t!==l&&(this.setState({value:t,numAsString:s}),c(this.getValueObject(t,s),{event:i,source:o}))},t.prototype.onChange=function(e){var t=e.target,n=t.value,r=this.state,o=this.props,i=o.isAllowed,s=r.value||"",a=w(t);n=this.correctInputValue(a,s,n);var c=this.formatInput(n)||"",l=this.removeFormatting(c),u=i(this.getValueObject(c,l));u||(c=s),this.updateValue({formattedValue:c,numAsString:l,inputValue:n,input:t,event:e,source:"event"}),u&&o.onChange(e)},t.prototype.onBlur=function(e){var t=this.props,n=this.state,r=t.format,o=t.onBlur,i=t.allowLeadingZeros,s=n.numAsString,a=n.value;if(this.focusedElm=null,clearTimeout(this.focusTimeout),clearTimeout(this.caretPositionTimeout),!r){isNaN(parseFloat(s))&&(s=""),i||(s=function(e){if(!e)return e;var t="-"===e[0];t&&(e=e.substring(1,e.length));var n=e.split("."),r=n[0].replace(/^0+/,"")||"0",o=n[1]||"";return(t?"-":"")+r+(o?"."+o:"")}(s));var c=this.formatNumString(s);if(c!==a)return this.updateValue({formattedValue:c,numAsString:s,input:e.target,setCaretPosition:!1,event:e,source:"event"}),void o(e)}o(e)},t.prototype.onKeyDown=function(e){var t,n=e.target,r=e.key,o=n.selectionStart,i=n.selectionEnd,s=n.value;void 0===s&&(s="");var a=this.props,c=a.decimalScale,l=a.fixedDecimalScale,u=a.prefix,p=a.suffix,m=a.format,f=a.onKeyDown,d=void 0!==c&&l,h=this.getNumberRegex(!1,d),b=new RegExp("-"),g="string"==typeof m;if(this.selectionBeforeInput={selectionStart:o,selectionEnd:i},"ArrowLeft"===r||"Backspace"===r?t=o-1:"ArrowRight"===r?t=o+1:"Delete"===r&&(t=o),void 0!==t&&o===i){var v=t,w=g?m.indexOf("#"):u.length,O=g?m.lastIndexOf("#")+1:s.length-p.length;if("ArrowLeft"===r||"ArrowRight"===r){var y="ArrowLeft"===r?"left":"right";v=this.correctCaretPosition(s,t,y)}else if("Delete"!==r||h.test(s[t])||b.test(s[t])){if("Backspace"===r&&!h.test(s[t]))if(o<=w+1&&"-"===s[0]&&void 0===m){var j=s.substring(1);this.updateValue({formattedValue:j,caretPos:v,input:n,event:e,source:"event"})}else if(!b.test(s[t])){for(;!h.test(s[v-1])&&v>w;)v--;v=this.correctCaretPosition(s,v,"left")}}else for(;!h.test(s[v])&&v<O;)v++;(v!==t||t<w||t>O)&&(e.preventDefault(),this.setPatchedCaretPosition(n,v,s)),e.isUnitTestRun&&this.setPatchedCaretPosition(n,v,s),f(e)}else f(e)},t.prototype.onMouseUp=function(e){var t=e.target,n=t.selectionStart,r=t.selectionEnd,o=t.value;if(void 0===o&&(o=""),n===r){var i=this.correctCaretPosition(o,n);i!==n&&this.setPatchedCaretPosition(t,i,o)}this.props.onMouseUp(e)},t.prototype.onFocus=function(e){var t=this;e.persist(),this.focusedElm=e.target,this.focusTimeout=setTimeout((function(){var n=e.target,r=n.selectionStart,o=n.selectionEnd,i=n.value;void 0===i&&(i="");var s=t.correctCaretPosition(i,r);s===r||0===r&&o===i.length||t.setPatchedCaretPosition(n,s,i),t.props.onFocus(e)}),0)},t.prototype.render=function(){var e=this.props,t=e.type,n=e.displayType,r=e.customInput,o=e.renderText,i=e.getInputRef,s=e.format,a=(e.thousandSeparator,e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle,e.decimalScale,e.fixedDecimalScale,e.prefix,e.suffix,e.removeFormatting,e.mask,e.defaultValue,e.isNumericString,e.allowNegative,e.allowEmptyFormatting,e.allowLeadingZeros,e.onValueChange,e.isAllowed,e.customNumerals,e.onChange,e.onKeyDown,e.onMouseUp,e.onFocus,e.onBlur,e.value,function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&-1===t.indexOf(r)&&(n[r]=e[r]);return n}(e,["type","displayType","customInput","renderText","getInputRef","format","thousandSeparator","decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","decimalScale","fixedDecimalScale","prefix","suffix","removeFormatting","mask","defaultValue","isNumericString","allowNegative","allowEmptyFormatting","allowLeadingZeros","onValueChange","isAllowed","customNumerals","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value"])),c=this.state,u=c.value,p=c.mounted&&function(e){return e||"undefined"!=typeof navigator&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}(s)?"numeric":void 0,m=Object.assign({inputMode:p},a,{type:t,value:u,onChange:this.onChange,onKeyDown:this.onKeyDown,onMouseUp:this.onMouseUp,onFocus:this.onFocus,onBlur:this.onBlur});if("text"===n)return o?o(u,a)||null:l.a.createElement("span",Object.assign({},a,{ref:i}),u);if(r){var f=r;return l.a.createElement(f,Object.assign({},m,{ref:i}))}return l.a.createElement("input",Object.assign({},m,{ref:i}))},t}(l.a.Component);y.defaultProps=O;var j=y;n(131);const E=e=>({thousandSeparator:e.thousandSeparator,decimalSeparator:e.decimalSeparator,decimalScale:e.minorUnit,fixedDecimalScale:!0,prefix:e.prefix,suffix:e.suffix,isNumericString:!0});var S=e=>{let{className:t,value:n,currency:o,onValueChange:s,displayType:c="text",...l}=e;const u="string"==typeof n?parseInt(n,10):n;if(!Number.isFinite(u))return null;const p=u/10**o.minorUnit;if(!Number.isFinite(p))return null;const m=i()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),f={...l,...E(o),value:void 0,currency:void 0,onValueChange:void 0},d=s?e=>{const t=+e.value*10**o.minorUnit;s(t)}:()=>{};return Object(r.createElement)(j,a()({className:m,displayType:c},f,{value:p,onValueChange:d}))};n(130);const x=e=>{let{value:t,currency:n}=e;return Object(r.isValidElement)(t)?Object(r.createElement)("div",{className:"wc-block-components-totals-item__value"},t):Number.isFinite(t)?Object(r.createElement)(S,{className:"wc-block-components-totals-item__value",currency:n||{},value:t}):null};var k=e=>{let{className:t,currency:n,label:o,value:s,description:a}=e;return Object(r.createElement)("div",{className:i()("wc-block-components-totals-item",t)},Object(r.createElement)("span",{className:"wc-block-components-totals-item__label"},o),Object(r.createElement)(x,{value:s,currency:n}),Object(r.createElement)("div",{className:"wc-block-components-totals-item__description"},a))},N=n(1),_=n(5),F=e=>{let{currency:t,values:n,className:o}=e;const{total_items:i,total_items_tax:s}=n,a=parseInt(i,10),c=parseInt(s,10);return Object(r.createElement)(k,{className:o,currency:t,label:Object(N.__)("Subtotal","woo-gutenberg-products-block"),value:Object(_.getSetting)("displayCartPricesIncludingTax",!1)?a+c:a})},C=e=>{let{currency:t,values:n,className:o,showRateAfterTaxName:s}=e;const{total_tax:a,tax_lines:c}=n;if(!Object(_.getSetting)("taxesEnabled",!0)&&parseInt(a,10)<=0)return null;const l=Object(_.getSetting)("displayItemizedTaxes",!1),u=l&&c.length>0?Object(r.createElement)(r.Fragment,null,c.map((e,n)=>{let{name:a,rate:c,price:l}=e;const u=`${a}${s?" "+c:""}`;return Object(r.createElement)(k,{key:"tax-line-"+n,className:i()("wc-block-components-totals-taxes",o),currency:t,label:u,value:parseInt(l,10)})})," "):null;return l?u:Object(r.createElement)(r.Fragment,null,Object(r.createElement)(k,{className:i()("wc-block-components-totals-taxes",o),currency:t,label:Object(N.__)("Taxes","woo-gutenberg-products-block"),value:parseInt(a,10),description:null}))},T=e=>{let{currency:t,cartFees:n,className:o}=e;return Object(r.createElement)(r.Fragment,null,n.map((e,n)=>{let{id:s,name:a,totals:c}=e;const l=parseInt(c.total,10);if(!l)return null;const u=parseInt(c.total_tax,10);return Object(r.createElement)(k,{key:s||`${n}-${a}`,className:i()("wc-block-components-totals-fees",o),currency:t,label:a||Object(N.__)("Fee","woo-gutenberg-products-block"),value:Object(_.getSetting)("displayCartPricesIncludingTax",!1)?l+u:l})}))};n(132);var P=e=>{let{children:t,slotWrapper:n=!1,className:o}=e;return c.Children.count(t)?Object(r.createElement)("div",{className:i()(o,"wc-block-components-totals-wrapper",{"slot-wrapper":n})},t):null},R=n(7),M=n.n(R),A=n(6),D=n(19);function I(e){const t=Object(r.useContext)(D.a),n=t.slots[e]||{},o=t.fills[e],i=Object(r.useMemo)(()=>o||[],[o]);return{...n,updateSlot:Object(r.useCallback)(n=>{t.updateSlot(e,n)},[e,t.updateSlot]),unregisterSlot:Object(r.useCallback)(n=>{t.unregisterSlot(e,n)},[e,t.unregisterSlot]),fills:i,registerFill:Object(r.useCallback)(n=>{t.registerFill(e,n)},[e,t.registerFill]),unregisterFill:Object(r.useCallback)(n=>{t.unregisterFill(e,n)},[e,t.unregisterFill])}}var L=n(8),V=n(4),B=Object(r.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function U({name:e,children:t,registerFill:n,unregisterFill:o}){const i=(e=>{const{getSlot:t,subscribe:n}=Object(r.useContext)(B),[o,i]=Object(r.useState)(t(e));return Object(r.useEffect)(()=>(i(t(e)),n(()=>{i(t(e))})),[e]),o})(e),s=Object(r.useRef)({name:e,children:t});return Object(r.useLayoutEffect)(()=>(n(e,s.current),()=>o(e,s.current)),[]),Object(r.useLayoutEffect)(()=>{s.current.children=t,i&&i.forceUpdate()},[t]),Object(r.useLayoutEffect)(()=>{e!==s.current.name&&(o(s.current.name,s.current),s.current.name=e,n(e,s.current))},[e]),i&&i.node?(Object(V.isFunction)(t)&&(t=t(i.props.fillProps)),Object(r.createPortal)(t,i.node)):null}var W=e=>Object(r.createElement)(B.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(r.createElement)(U,Object(L.a)({},e,{registerFill:t,unregisterFill:n})));class H extends r.Component{constructor(){super(...arguments),this.isUnmounted=!1,this.bindNode=this.bindNode.bind(this)}componentDidMount(){const{registerSlot:e}=this.props;e(this.props.name,this)}componentWillUnmount(){const{unregisterSlot:e}=this.props;this.isUnmounted=!0,e(this.props.name,this)}componentDidUpdate(e){const{name:t,unregisterSlot:n,registerSlot:r}=this.props;e.name!==t&&(n(e.name),r(t,this))}bindNode(e){this.node=e}forceUpdate(){this.isUnmounted||super.forceUpdate()}render(){const{children:e,name:t,fillProps:n={},getFills:o}=this.props,i=Object(V.map)(o(t,this),e=>{const t=Object(V.isFunction)(e.children)?e.children(n):e.children;return r.Children.map(t,(e,t)=>{if(!e||Object(V.isString)(e))return e;const n=e.key||t;return Object(r.cloneElement)(e,{key:n})})}).filter(Object(V.negate)(r.isEmptyElement));return Object(r.createElement)(r.Fragment,null,Object(V.isFunction)(e)?e(i):i)}}var z=e=>Object(r.createElement)(B.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:o})=>Object(r.createElement)(H,Object(L.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:o})));function $(){const[,e]=Object(r.useState)({}),t=Object(r.useRef)(!0);return Object(r.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function K({name:e,children:t}){const n=I(e),o=Object(r.useRef)({rerender:$()});return Object(r.useEffect)(()=>(n.registerFill(o),()=>{n.unregisterFill(o)}),[n.registerFill,n.unregisterFill]),n.ref&&n.ref.current?("function"==typeof t&&(t=t(n.fillProps)),Object(r.createPortal)(t,n.ref.current)):null}var G=n(11),q=Object(r.forwardRef)((function({name:e,fillProps:t={},as:n="div",...o},i){const s=Object(r.useContext)(D.a),a=Object(r.useRef)();return Object(r.useLayoutEffect)(()=>(s.registerSlot(e,a,t),()=>{s.unregisterSlot(e,a)}),[s.registerSlot,s.unregisterSlot,e]),Object(r.useLayoutEffect)(()=>{s.updateSlot(e,t)}),Object(r.createElement)(n,Object(L.a)({ref:Object(G.useMergeRefs)([i,a])},o))})),Y=n(12),Z=n.n(Y);function X({children:e}){const t=function(){const[e,t]=Object(r.useState)({}),[n,o]=Object(r.useState)({}),i=Object(r.useCallback)((e,n,r)=>{t(t=>{const o=t[e]||{};return{...t,[e]:{...o,ref:n||o.ref,fillProps:r||o.fillProps||{}}}})},[]),s=Object(r.useCallback)((e,n)=>{t(t=>{const{[e]:r,...o}=t;return(null==r?void 0:r.ref)===n?o:t})},[]),a=Object(r.useCallback)((t,r)=>{const o=e[t];if(o&&!Z()(o.fillProps,r)){o.fillProps=r;const e=n[t];e&&e.map(e=>e.current.rerender())}},[e,n]),c=Object(r.useCallback)((e,t)=>{o(n=>({...n,[e]:[...n[e]||[],t]}))},[]),l=Object(r.useCallback)((e,t)=>{o(n=>n[e]?{...n,[e]:n[e].filter(e=>e!==t)}:n)},[]);return Object(r.useMemo)(()=>({slots:e,fills:n,registerSlot:i,updateSlot:a,unregisterSlot:s,registerFill:c,unregisterFill:l}),[e,n,i,a,s,c,l])}();return Object(r.createElement)(D.a.Provider,{value:t},e)}class J extends r.Component{constructor(){super(...arguments),this.registerSlot=this.registerSlot.bind(this),this.registerFill=this.registerFill.bind(this),this.unregisterSlot=this.unregisterSlot.bind(this),this.unregisterFill=this.unregisterFill.bind(this),this.getSlot=this.getSlot.bind(this),this.getFills=this.getFills.bind(this),this.hasFills=this.hasFills.bind(this),this.subscribe=this.subscribe.bind(this),this.slots={},this.fills={},this.listeners=[],this.contextValue={registerSlot:this.registerSlot,unregisterSlot:this.unregisterSlot,registerFill:this.registerFill,unregisterFill:this.unregisterFill,getSlot:this.getSlot,getFills:this.getFills,hasFills:this.hasFills,subscribe:this.subscribe}}registerSlot(e,t){const n=this.slots[e];this.slots[e]=t,this.triggerListeners(),this.forceUpdateSlot(e),n&&n.forceUpdate()}registerFill(e,t){this.fills[e]=[...this.fills[e]||[],t],this.forceUpdateSlot(e)}unregisterSlot(e,t){this.slots[e]===t&&(delete this.slots[e],this.triggerListeners())}unregisterFill(e,t){this.fills[e]=Object(V.without)(this.fills[e],t),this.forceUpdateSlot(e)}getSlot(e){return this.slots[e]}getFills(e,t){return this.slots[e]!==t?[]:this.fills[e]}hasFills(e){return this.fills[e]&&!!this.fills[e].length}forceUpdateSlot(e){const t=this.getSlot(e);t&&t.forceUpdate()}triggerListeners(){this.listeners.forEach(e=>e())}subscribe(e){return this.listeners.push(e),()=>{this.listeners=Object(V.without)(this.listeners,e)}}render(){return Object(r.createElement)(B.Provider,{value:this.contextValue},this.props.children)}}function Q(e){return Object(r.createElement)(r.Fragment,null,Object(r.createElement)(W,e),Object(r.createElement)(K,e))}const ee=Object(r.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(r.createElement)(q,Object(L.a)({},t,{ref:n})):Object(r.createElement)(z,t));function te({children:e,...t}){return Object(r.createElement)(J,t,Object(r.createElement)(X,null,e))}function ne(e){const t=t=>Object(r.createElement)(Q,Object(L.a)({name:e},t));t.displayName=e+"Fill";const n=t=>Object(r.createElement)(ee,Object(L.a)({name:e},t));return n.displayName=e+"Slot",n.__unstableName=e,{Fill:t,Slot:n}}var re=n(16),oe=n.n(re);class ie extends c.Component{constructor(){super(...arguments),oe()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(r.createElement)(r.Fragment,null,Object(r.createElement)("strong",null,e.status),": "+e.statusText),hasError:!0}:{errorMessage:e.message,hasError:!0}}render(){const{renderError:e}=this.props,{errorMessage:t,hasError:n}=this.state;return n?"function"==typeof e?e(t):Object(r.createElement)("p",null,t):this.props.children}}var se=ie;const ae=e=>Array.isArray(e)&&e.filter(Boolean).length>0;let ce;ce=I;const le=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const{Fill:n,Slot:o}=ne(e),i=e=>{let{children:o}=e;return Object(r.createElement)(n,null,e=>r.Children.map(o,n=>Object(r.createElement)(se,{renderError:_.CURRENT_USER_IS_ADMIN?t:()=>null},Object(r.cloneElement)(n,e))))},s=e=>Object(r.createElement)(o,a()({},e,{bubblesVirtually:!0}));return{Fill:i,Slot:s}},{Fill:ue,Slot:pe}=le("__experimentalOrderMeta");ue.Slot=e=>{let{className:t,extensions:n,cart:o,context:s}=e;const{fills:a}=ce("__experimentalOrderMeta");return ae(a)&&Object(r.createElement)(P,{slotWrapper:!0},Object(r.createElement)(pe,{className:i()(t,"wc-block-components-order-meta"),fillProps:{extensions:n,cart:o,context:s}}))};var me=ue;const{Fill:fe,Slot:de}=le("__experimentalDiscountsMeta");fe.Slot=e=>{let{className:t,extensions:n,cart:o,context:s}=e;const{fills:a}=ce("__experimentalDiscountsMeta");return ae(a)&&Object(r.createElement)(P,{slotWrapper:!0},Object(r.createElement)(de,{className:i()(t,"wc-block-components-discounts-meta"),fillProps:{extensions:n,cart:o,context:s}}))};var he=fe;const{Fill:be,Slot:ge}=le("__experimentalOrderShippingPackages");be.Slot=e=>{let{className:t,collapsible:n,noResultsMessage:o,renderOption:s,extensions:a,cart:c,components:l,context:u,shippingRates:p}=e;const{fills:m}=ce("__experimentalOrderShippingPackages"),f=m.length>1||(null==p?void 0:p.length)>1;return Object(r.createElement)(ge,{className:i()("wc-block-components-shipping-rates-control",t),fillProps:{collapsible:n,collapse:f,showItems:f,noResultsMessage:o,renderOption:s,extensions:a,cart:c,components:l,context:u}})};var ve=be,we=function(e){let{icon:t,size:n=24,...o}=e;return Object(r.cloneElement)(t,{width:n,height:n,...o})},Oe=Object(r.createElement)(A.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(A.Path,{d:"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"})),ye=Object(r.createElement)(A.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},Object(r.createElement)(A.Path,{d:"M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"}));n(133);var je=e=>{let{children:t,className:n,initialOpen:o=!1,hasBorder:s=!1,title:a,titleTag:c="div"}=e;const[l,u]=Object(r.useState)(o);return Object(r.createElement)("div",{className:i()(n,"wc-block-components-panel",{"has-border":s})},Object(r.createElement)(c,null,Object(r.createElement)("button",{"aria-expanded":l,className:"wc-block-components-panel__button",onClick:()=>u(!l)},Object(r.createElement)(we,{"aria-hidden":"true",className:"wc-block-components-panel__button-icon",icon:l?Oe:ye}),a)),l&&Object(r.createElement)("div",{className:"wc-block-components-panel__content"},t))},Ee=n(34),Se=Object(r.createElement)(A.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(r.createElement)(A.Path,{d:"M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"}));function xe(e,t,n){const{defaultView:r}=t,{frameElement:o}=r;if(!o||t===n.ownerDocument)return e;const i=o.getBoundingClientRect();return new r.DOMRect(e.left+i.left,e.top+i.top,e.width,e.height)}let ke=0;function Ne(e){const t=document.scrollingElement||document.body;e&&(ke=t.scrollTop);const n=e?"add":"remove";t.classList[n]("lockscroll"),document.documentElement.classList[n]("lockscroll"),e||(t.scrollTop=ke)}let _e=0;function Fe(){return Object(r.useEffect)(()=>(0===_e&&Ne(!0),++_e,()=>{1===_e&&Ne(!1),--_e}),[]),null}function Ce(e){return"appear"===e?"top":"left"}function Te(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:i}=(s=t).ownerDocument.defaultView.getComputedStyle(s);var s;const a=n?parseInt(n,10):0,c=r?parseInt(r,10):0,l=o?parseInt(o,10):0,u=i?parseInt(i,10):0;return{x:e.left+l,y:e.top+a,width:e.width-l-u,height:e.height-a-c,left:e.left+l,right:e.right-u,top:e.top+a,bottom:e.bottom-c}}function Pe(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function Re(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function Me(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const Ae=Object(r.forwardRef)(({headerTitle:e,onClose:t,children:n,className:o,noArrow:s=!0,isAlternate:a,position:c="bottom right",range:l,focusOnMount:u="firstElement",anchorRef:p,shouldAnchorIncludePadding:m,anchorRect:f,getAnchorRect:d,expandOnMobile:h,animate:b=!0,onClickOutside:g,onFocusOutside:v,__unstableStickyBoundaryElement:w,__unstableSlotName:O="Popover",__unstableObserveElement:y,__unstableBoundaryParent:j,__unstableForcePosition:E,__unstableForceXAlignment:S,...x},k)=>{const _=Object(r.useRef)(null),F=Object(r.useRef)(null),C=Object(r.useRef)(),T=Object(G.useViewportMatch)("medium","<"),[P,R]=Object(r.useState)(),A=I(O),D=h&&T,[V,B]=Object(G.useResizeObserver)();s=D||s,Object(r.useLayoutEffect)(()=>{if(D)return Me(C.current,"is-without-arrow",s),Me(C.current,"is-alternate",a),Pe(C.current,"data-x-axis"),Pe(C.current,"data-y-axis"),Re(C.current,"top"),Re(C.current,"left"),Re(F.current,"maxHeight"),void Re(F.current,"maxWidth");const e=()=>{if(!C.current||!F.current)return;let e=function(e,t,n,r=!1,o,i){if(t)return t;if(n){if(!e.current)return;const t=n(e.current);return xe(t,t.ownerDocument||e.current.ownerDocument,i)}if(!1!==r){if(!(r&&window.Range&&window.Element&&window.DOMRect))return;if("function"==typeof(null==r?void 0:r.cloneRange))return xe(Object(Ee.getRectangleFromRange)(r),r.endContainer.ownerDocument,i);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=xe(r.getBoundingClientRect(),r.ownerDocument,i);return o?e:Te(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),s=t.getBoundingClientRect(),a=xe(new window.DOMRect(n.left,n.top,n.width,s.bottom-n.top),e.ownerDocument,i);return o?a:Te(a,r)}if(!e.current)return;const{parentNode:s}=e.current,a=s.getBoundingClientRect();return o?a:Te(a,s)}(_,f,d,p,m,C.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=C.current;let r,o=0;if(t&&t!==n.body){const n=t.getBoundingClientRect();o=n.top,e=new window.DOMRect(e.left-n.left,e.top-n.top,e.width,e.height)}var i;j&&(r=null===(i=C.current.closest(".popover-slot"))||void 0===i?void 0:i.parentNode);const l=B.height?B:F.current.getBoundingClientRect(),{popoverTop:u,popoverLeft:h,xAxis:b,yAxis:g,contentHeight:v,contentWidth:O}=function(e,t,n="top",r,o,i,s,a,c){const[l,u="center",p]=n.split(" "),m=function(e,t,n,r,o,i,s,a){const{height:c}=t;if(o){const t=o.getBoundingClientRect().top+c-s;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let l=e.top+e.height/2;"bottom"===r?l=e.bottom:"top"===r&&(l=e.top);const u={popoverTop:l,contentHeight:(l-c/2>0?c/2:l)+(l+c/2>window.innerHeight?window.innerHeight-l:c/2)},p={popoverTop:e.top,contentHeight:e.top-10-c>0?c:e.top-10},m={popoverTop:e.bottom,contentHeight:e.bottom+10+c>window.innerHeight?window.innerHeight-10-e.bottom:c};let f,d=n,h=null;if(!o&&!a)if("middle"===n&&u.contentHeight===c)d="middle";else if("top"===n&&p.contentHeight===c)d="top";else if("bottom"===n&&m.contentHeight===c)d="bottom";else{d=p.contentHeight>m.contentHeight?"top":"bottom";const e="top"===d?p.contentHeight:m.contentHeight;h=e!==c?e:null}return f="middle"===d?u.popoverTop:"top"===d?p.popoverTop:m.popoverTop,{yAxis:d,popoverTop:f,contentHeight:h}}(e,t,l,p,r,0,i,a);return{...function(e,t,n,r,o,i,s,a,c){const{width:l}=t;"left"===n&&Object(N.isRTL)()?n="right":"right"===n&&Object(N.isRTL)()&&(n="left"),"left"===r&&Object(N.isRTL)()?r="right":"right"===r&&Object(N.isRTL)()&&(r="left");const u=Math.round(e.left+e.width/2),p={popoverLeft:u,contentWidth:(u-l/2>0?l/2:u)+(u+l/2>window.innerWidth?window.innerWidth-u:l/2)};let m=e.left;"right"===r?m=e.right:"middle"===i||c||(m=u);let f=e.right;"left"===r?f=e.left:"middle"===i||c||(f=u);const d={popoverLeft:m,contentWidth:m-l>0?l:m},h={popoverLeft:f,contentWidth:f+l>window.innerWidth?window.innerWidth-f:l};let b,g=n,v=null;if(!o&&!a)if("center"===n&&p.contentWidth===l)g="center";else if("left"===n&&d.contentWidth===l)g="left";else if("right"===n&&h.contentWidth===l)g="right";else{g=d.contentWidth>h.contentWidth?"left":"right";const e="left"===g?d.contentWidth:h.contentWidth;l>window.innerWidth&&(v=window.innerWidth),e!==l&&(g="center",p.popoverLeft=window.innerWidth/2)}if(b="center"===g?p.popoverLeft:"left"===g?d.popoverLeft:h.popoverLeft,s){const e=s.getBoundingClientRect();b=Math.min(b,e.right-l),Object(N.isRTL)()||(b=Math.max(b,0))}return{xAxis:g,popoverLeft:b,contentWidth:v}}(e,t,u,p,r,m.yAxis,s,a,c),...m}}(e,l,c,w,C.current,o,r,E,S);"number"==typeof u&&"number"==typeof h&&(Re(C.current,"top",u+"px"),Re(C.current,"left",h+"px")),Me(C.current,"is-without-arrow",s||"center"===b&&"middle"===g),Me(C.current,"is-alternate",a),Pe(C.current,"data-x-axis",b),Pe(C.current,"data-y-axis",g),Re(F.current,"maxHeight","number"==typeof v?v+"px":""),Re(F.current,"maxWidth","number"==typeof O?O+"px":""),R(({left:"right",right:"left"}[b]||"center")+" "+({top:"bottom",bottom:"top"}[g]||"middle"))};e();const{ownerDocument:t}=C.current,{defaultView:n}=t,r=n.setInterval(e,500);let o;const i=()=>{n.cancelAnimationFrame(o),o=n.requestAnimationFrame(e)};n.addEventListener("click",i),n.addEventListener("resize",e),n.addEventListener("scroll",e,!0);const l=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(p);let u;return l&&l!==t&&(l.defaultView.addEventListener("resize",e),l.defaultView.addEventListener("scroll",e,!0)),y&&(u=new n.MutationObserver(e),u.observe(y,{attributes:!0})),()=>{n.clearInterval(r),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",i),n.cancelAnimationFrame(o),l&&l!==t&&(l.defaultView.removeEventListener("resize",e),l.defaultView.removeEventListener("scroll",e,!0)),u&&u.disconnect()}},[D,f,d,p,m,c,B,w,y,j]);const U=(e,n)=>{if("focus-outside"===e&&v)v(n);else if("focus-outside"===e&&g){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),M()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),g(e)}else t&&t()},[W,H]=Object(G.__experimentalUseDialog)({focusOnMount:u,__unstableOnClose:U,onClose:U}),z=Object(G.useMergeRefs)([C,W,k]),$=Boolean(b&&P)&&function(e){if("loading"===e.type)return i()("components-animate__loading");const{type:t,origin:n=Ce(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return i()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?i()("components-animate__slide-in","is-from-"+n):void 0}({type:"appear",origin:P});let K=Object(r.createElement)("div",Object(L.a)({className:i()("components-popover",o,$,{"is-expanded":D,"is-without-arrow":s,"is-alternate":a})},x,{ref:z},H,{tabIndex:"-1"}),D&&Object(r.createElement)(Fe,null),D&&Object(r.createElement)("div",{className:"components-popover__header"},Object(r.createElement)("span",{className:"components-popover__header-title"},e),Object(r.createElement)(Ge,{className:"components-popover__close",icon:Se,onClick:t})),Object(r.createElement)("div",{ref:F,className:"components-popover__content"},Object(r.createElement)("div",{style:{position:"relative"}},V,n)));return A.ref&&(K=Object(r.createElement)(Q,{name:O},K)),p||f?K:Object(r.createElement)("span",{ref:_},K)});Ae.Slot=Object(r.forwardRef)((function({name:e="Popover"},t){return Object(r.createElement)(ee,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var De=Ae,Ie=function({shortcut:e,className:t}){if(!e)return null;let n,o;return Object(V.isString)(e)&&(n=e),Object(V.isObject)(e)&&(n=e.display,o=e.ariaLabel),Object(r.createElement)("span",{className:t,"aria-label":o},n)};const Le=Object(r.createElement)("div",{className:"event-catcher"}),Ve=({eventHandlers:e,child:t,childrenWithPopover:n})=>Object(r.cloneElement)(Object(r.createElement)("span",{className:"disabled-element-wrapper"},Object(r.cloneElement)(Le,e),Object(r.cloneElement)(t,{children:n}),","),e),Be=({child:e,eventHandlers:t,childrenWithPopover:n})=>Object(r.cloneElement)(e,{...t,children:n}),Ue=(e,t,n)=>{if(1!==r.Children.count(e))return;const o=r.Children.only(e);"function"==typeof o.props[t]&&o.props[t](n)};var We=function({children:e,position:t,text:n,shortcut:o}){const[i,s]=Object(r.useState)(!1),[a,c]=Object(r.useState)(!1),l=Object(G.useDebounce)(c,700),u=t=>{Ue(e,"onMouseDown",t),document.addEventListener("mouseup",f),s(!0)},p=t=>{Ue(e,"onMouseUp",t),document.removeEventListener("mouseup",f),s(!1)},m=e=>"mouseUp"===e?p:"mouseDown"===e?u:void 0,f=m("mouseUp"),d=(t,n)=>r=>{if(Ue(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&i)return;l.cancel();const o=Object(V.includes)(["focus","mouseenter"],r.type);o!==a&&(n?l(o):c(o))},h=()=>{l.cancel(),document.removeEventListener("mouseup",f)};if(Object(r.useEffect)(()=>h,[]),1!==r.Children.count(e))return e;const b={onMouseEnter:d("onMouseEnter",!0),onMouseLeave:d("onMouseLeave"),onClick:d("onClick"),onFocus:d("onFocus"),onBlur:d("onBlur"),onMouseDown:m("mouseDown")},g=r.Children.only(e),{children:v,disabled:w}=g.props;return(w?Ve:Be)({child:g,eventHandlers:b,childrenWithPopover:(({grandchildren:e,isOver:t,position:n,text:o,shortcut:i})=>Object(r.concatChildren)(e,t&&Object(r.createElement)(De,{focusOnMount:!1,position:n,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},o,Object(r.createElement)(Ie,{className:"components-tooltip__shortcut",shortcut:i}))))({grandchildren:v,isOver:a,position:t,text:n,shortcut:o})})},He=function({icon:e,className:t,...n}){const o=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(r.createElement)("span",Object(L.a)({className:o},n))},ze=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return Object(r.createElement)(He,Object(L.a)({icon:e},n));if(Object(r.isValidElement)(e)&&He===e.type)return Object(r.cloneElement)(e,{...n});if("function"==typeof e)return e.prototype instanceof r.Component?Object(r.createElement)(e,{size:t,...n}):e({size:t,...n});if(e&&("svg"===e.type||e.type===A.SVG)){const o={width:t,height:t,...e.props,...n};return Object(r.createElement)(A.SVG,o)}return Object(r.isValidElement)(e)?Object(r.cloneElement)(e,{size:t,...n}):e},$e=Object(r.forwardRef)((function({as:e="div",className:t,...n},o){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(r.createElement)(e,t)}({as:e,className:i()("components-visually-hidden",t),...n,ref:o})}));const Ke=["onMouseDown","onClick"];var Ge=Object(r.forwardRef)((function(e,t){const{href:n,target:o,isSmall:s,isPressed:a,isBusy:c,isDestructive:l,className:u,disabled:p,icon:m,iconPosition:f="left",iconSize:d,showTooltip:h,tooltipPosition:b,shortcut:g,label:v,children:w,text:O,variant:y,__experimentalIsFocusable:j,describedBy:E,...S}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:i,...s}){let a=i;var c,l,u,p,m;return t&&(null!==(c=a)&&void 0!==c||(a="primary")),r&&(null!==(l=a)&&void 0!==l||(a="tertiary")),n&&(null!==(u=a)&&void 0!==u||(a="secondary")),e&&(M()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=a)&&void 0!==p||(a="secondary")),o&&(null!==(m=a)&&void 0!==m||(a="link")),{...s,variant:a}}(e),x=i()("components-button",u,{"is-secondary":"secondary"===y,"is-primary":"primary"===y,"is-small":s,"is-tertiary":"tertiary"===y,"is-pressed":a,"is-busy":c,"is-link":"link"===y,"is-destructive":l,"has-text":!!m&&!!w,"has-icon":!!m}),k=p&&!j,N=void 0===n||k?"button":"a",_="a"===N?{href:n,target:o}:{type:"button",disabled:k,"aria-pressed":a};if(p&&j){_["aria-disabled"]=!0;for(const e of Ke)S[e]=e=>{e.stopPropagation(),e.preventDefault()}}const F=!k&&(h&&v||g||!!v&&(!w||Object(V.isArray)(w)&&!w.length)&&!1!==h),C=E?Object(V.uniqueId)():null,T=S["aria-describedby"]||C,P=Object(r.createElement)(N,Object(L.a)({},_,S,{className:x,"aria-label":S["aria-label"]||v,"aria-describedby":T,ref:t}),m&&"left"===f&&Object(r.createElement)(ze,{icon:m,size:d}),O&&Object(r.createElement)(r.Fragment,null,O),m&&"right"===f&&Object(r.createElement)(ze,{icon:m,size:d}),w);return F?Object(r.createElement)(r.Fragment,null,Object(r.createElement)(We,{text:E||v,shortcut:g,position:b},P),E&&Object(r.createElement)($e,null,Object(r.createElement)("span",{id:C},E))):Object(r.createElement)(r.Fragment,null,P,E&&Object(r.createElement)($e,null,Object(r.createElement)("span",{id:C},E)))}));n(135);var qe=()=>Object(r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"});n(134);var Ye=e=>{let{className:t,showSpinner:n=!1,children:o,variant:s="contained",...c}=e;const l=i()("wc-block-components-button",t,s,{"wc-block-components-button--loading":n});return Object(r.createElement)(Ge,a()({className:l},c),n&&Object(r.createElement)(qe,null),Object(r.createElement)("span",{className:"wc-block-components-button__text"},o))},Ze=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:s,wrapperProps:a={}}=e;const c=null!=n,l=null!=o;return!c&&l?(t=s||"span",a={...a,className:i()(a.className,"screen-reader-text")},Object(r.createElement)(t,a,o)):(t=s||r.Fragment,c&&l&&n!==o?Object(r.createElement)(t,a,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,a,n))};n(136);const Xe=e=>{let{className:t,label:n,id:o,onChange:s,children:c,hasError:l=!1,checked:u=!1,disabled:p=!1,...m}=e;const f=Object(G.useInstanceId)(Xe),d=o||"checkbox-control-"+f;return Object(r.createElement)("div",{className:i()("wc-block-components-checkbox",{"has-error":l},t)},Object(r.createElement)("label",{htmlFor:d},Object(r.createElement)("input",a()({id:d,className:"wc-block-components-checkbox__input",type:"checkbox",onChange:e=>s(e.target.checked),"aria-invalid":!0===l,checked:u,disabled:p},m)),Object(r.createElement)("svg",{className:"wc-block-components-checkbox__mark","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 20"},Object(r.createElement)("path",{d:"M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"})),n&&Object(r.createElement)("span",{className:"wc-block-components-checkbox__label"},n),c))};var Je=Xe;const Qe=(e,t)=>{if(!e.includes(t))throw Error(Object(N.sprintf)(
2
  /* translators: %1$s value passed to filter, %2$s : value that must be included. */
3
+ Object(N.__)('Returned value must include %1$s, you passed "%2$s"',"woo-gutenberg-products-block"),t,e));return!0};var et=n(2),tt=n(9);const nt=e=>{const{applyExtensionCartUpdate:t}=Object(et.dispatch)(tt.b);return t(e)},rt=e=>null===e,ot=e=>!rt(e)&&e instanceof Object&&e.constructor===Object,it=()=>!0;let st={};const at=(e,t)=>{Object.keys(t).includes("couponName")&&M()("snackbarNotices",{alternative:"snackbarNoticeVisibility",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4417"}),Object.keys(t).includes("couponName")&&M()("couponName",{alternative:"coupons",plugin:"WooCommerce Blocks",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/blob/bb921d21f42e21f38df2b1c87b48e07aa4cb0538/docs/extensibility/available-filters.md#coupons"}),st={...st,[e]:t}},ct={},lt=(e,t,n,r)=>{ct[e]={arg:t,extensions:n,defaultValue:r}},ut=(e,t)=>!(!rt(e)||!rt(t))||ot(e)&&ot(t)&&Object.keys(e).length===Object.keys(t).length&&Object.keys(e).every(n=>{return o=n,ot(r=t)&&o in r&&Z()(e[n],t[n]);var r,o}),pt=e=>{let{filterName:t,defaultValue:n,extensions:o=null,arg:i=null,validation:s=it}=e;const a=Object(r.useRef)({});return Object(r.useMemo)(()=>{if(!((e,t,n,r)=>{const o=ct[e];if(!o)return lt(e,t,n,r),!0;const{arg:i={},extensions:s={},defaultValue:a=null}=o;return ut(t,i)?!(r===a&&ut(n,s)||(lt(e,t,n,r),0)):(lt(e,t,n,r),!0)})(t,i,o,n)&&void 0!==a.current[t])return a.current[t];const e=(e=>Object.keys(st).map(t=>st[t][e]).filter(Boolean))(t);let r=n;return e.forEach(e=>{try{const t=e(r,o||{},i);if(typeof t!=typeof r)throw new Error(Object(N.sprintf)(
4
  /* translators: %1$s is the type of the variable passed to the filter function, %2$s is the type of the value returned by the filter function. */
5
+ Object(N.__)("The type returned by checkout filters must be the same as the type they receive. The function received %1$s but returned %2$s.","woo-gutenberg-products-block"),typeof r,typeof t));r=s(t)?t:r}catch(e){if(_.CURRENT_USER_IS_ADMIN)throw e;console.error(e)}}),a.current[t]=r,r},[t,n,o,i,s])};let mt;!function(e){e.CHECKOUT="woocommerce/checkout",e.CHECKOUT_FIELDS="woocommerce/checkout-fields-block",e.CHECKOUT_TOTALS="woocommerce/checkout-totals-block",e.CONTACT_INFORMATION="woocommerce/checkout-contact-information-block",e.SHIPPING_ADDRESS="woocommerce/checkout-shipping-address-block",e.BILLING_ADDRESS="woocommerce/checkout-billing-address-block",e.SHIPPING_METHODS="woocommerce/checkout-shipping-methods-block",e.PAYMENT_METHODS="woocommerce/checkout-payment-methods-block",e.CART="woocommerce/cart",e.EMPTY_CART="woocommerce/empty-cart-block",e.FILLED_CART="woocommerce/filled-cart-block",e.CART_ITEMS="woocommerce/cart-items-block",e.CART_TOTALS="woocommerce/cart-totals-block",e.MINI_CART="woocommerce/mini-cart-contents",e.EMPTY_MINI_CART="woocommerce/empty-mini-cart-contents-block",e.FILLED_MINI_CART="woocommerce/filled-mini-cart-contents-block",e.MINI_CART_ITEMS="woocommerce/mini-cart-items-block",e.CART_ORDER_SUMMARY="woocommerce/cart-order-summary-block",e.CHECKOUT_ORDER_SUMMARY="woocommerce/checkout-order-summary-block"}(mt||(mt={}));const ft={},dt=e=>Object.values(mt).includes(e),ht=e=>dt(e)?Object.values(ft).filter(t=>{let{metadata:n}=t;return((null==n?void 0:n.parent)||[]).includes(e)}):[];var bt=n(35);const gt=e=>{var t,n,r,o;((e,t,n)=>{if(!ot(e))return;const r=typeof e.metadata;if("object"!==r)throw new Error(`Incorrect value for the metadata argument when registering a block component. It was a ${r}, but must be a object.`)})(e),(e=>{if(((e,t,n)=>{const r=typeof t;if("string"!==r)throw new Error(`Incorrect value for the blockName argument when registering a checkout block. It was a ${r}, but must be a string.`)})(0,e),!e)throw new Error("Value for the blockName argument must not be empty.")})(e.metadata.name),(e=>{if("string"!=typeof e&&!Array.isArray(e))throw new Error(`Incorrect value for the parent argument when registering a checkout block. It was a ${typeof e}, but must be a string or array of strings.`);if("string"==typeof e&&!dt(e))throw new Error("When registering a checkout block, the parent must be a valid inner block area.");if(Array.isArray(e)&&!e.some(e=>dt(e)))throw new Error("When registering a checkout block, the parent must be a valid inner block area.")})(e.metadata.parent),((e,t)=>{const n=e.component;if(n){if("function"==typeof n)return;if(ot(n)&&n.$$typeof&&n.$$typeof===Symbol.for("react.lazy"))return}throw new Error("Incorrect value for the component argument when registering a block component. Component must be a valid React Element or Lazy callback.")})(e),Object(bt.registerBlockComponent)({blockName:e.metadata.name,component:e.component}),ft[e.metadata.name]={blockName:e.metadata.name,metadata:e.metadata,component:e.component,force:!(null===(t=e.metadata)||void 0===t||null===(n=t.attributes)||void 0===n||null===(r=n.lock)||void 0===r||null===(o=r.default)||void 0===o||!o.remove)}}},15:function(e,t){e.exports=window.React},16:function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.__esModule=!0,e.exports.default=e.exports},19:function(e,t,n){"use strict";(function(e){var r=n(0);n(33);const o=Object(r.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,n(20))},2:function(e,t){e.exports=window.wp.data},20:function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var c,l=[],u=!1,p=-1;function m(){u&&c&&(u=!1,c.length?l=c.concat(l):p=-1,l.length&&f())}function f(){if(!u){var e=a(m);u=!0;for(var t=l.length;t;){for(c=l,l=[];++p<t;)c&&c[p].run();p=-1,t=l.length}c=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function d(e,t){this.fun=e,this.array=t}function h(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new d(e,t)),1!==l.length||u||a(f)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=h,o.addListener=h,o.once=h,o.off=h,o.removeListener=h,o.removeAllListeners=h,o.emit=h,o.prependListener=h,o.prependOnceListener=h,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},3:function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function o(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var s=o.apply(null,r);s&&e.push(s)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var a in r)n.call(r,a)&&r[a]&&e.push(a);else e.push(r.toString())}}return e.join(" ")}e.exports?(o.default=o,e.exports=o):void 0===(r=function(){return o}.apply(t,[]))||(e.exports=r)}()},33:function(e,t){e.exports=window.wp.warning},34:function(e,t){e.exports=window.wp.dom},35:function(e,t){e.exports=window.wc.wcBlocksRegistry},4:function(e,t){e.exports=window.lodash},5:function(e,t){e.exports=window.wc.wcSettings},6:function(e,t){e.exports=window.wp.primitives},7:function(e,t){e.exports=window.wp.deprecated},8:function(e,t,n){"use strict";function r(){return(r=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}).apply(this,arguments)}n.d(t,"a",(function(){return r}))},9:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return i}));var r=n(1);const o="wc/store/cart",i={code:"cart_api_error",message:Object(r.__)("Unable to get cart data from the API.","woo-gutenberg-products-block"),data:{status:500}}}});
build/cart-blocks/cart-accepted-payment-methods-frontend.js CHANGED
@@ -1 +1 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{276:function(t,e){},279:function(t,e,s){"use strict";s.d(e,"b",(function(){return o})),s.d(e,"a",(function(){return l}));var a=s(31),n=s(209);const c=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{paymentMethods:e,expressPaymentMethods:s,paymentMethodsInitialized:c,expressPaymentMethodsInitialized:o}=Object(n.b)(),l=Object(a.a)(e),i=Object(a.a)(s);return{paymentMethods:t?i:l,isInitialized:t?o:c}},o=()=>c(!1),l=()=>c(!0)},281:function(t,e,s){"use strict";var a=s(12),n=s.n(a),c=s(0),o=s(4),l=s.n(o);const i=t=>"wc-block-components-payment-method-icon wc-block-components-payment-method-icon--"+t;var r=t=>{let{id:e,src:s=null,alt:a=""}=t;return s?Object(c.createElement)("img",{className:i(e),src:s,alt:a}):null},d=s(48);const m=[{id:"alipay",alt:"Alipay",src:d.l+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:d.l+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:d.l+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:d.l+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:d.l+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:d.l+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:d.l+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:d.l+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:d.l+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:d.l+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:d.l+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:d.l+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:d.l+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:d.l+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:d.l+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:d.l+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:d.l+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:d.l+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:d.l+"payment-methods/wechat.svg"}];var p=s(45);s(276),e.a=t=>{let{icons:e=[],align:s="center",className:a}=t;const o=(t=>{const e={};return t.forEach(t=>{let s={};"string"==typeof t&&(s={id:t,alt:t,src:null}),"object"==typeof t&&(s={id:t.id||"",alt:t.alt||"",src:t.src||null}),s.id&&Object(p.a)(s.id)&&!e[s.id]&&(e[s.id]=s)}),Object.values(e)})(e);if(0===o.length)return null;const i=l()("wc-block-components-payment-method-icons",{"wc-block-components-payment-method-icons--align-left":"left"===s,"wc-block-components-payment-method-icons--align-right":"right"===s},a);return Object(c.createElement)("div",{className:i},o.map(t=>{const e={...t,...(s=t.id,m.find(t=>t.id===s)||{})};var s;return Object(c.createElement)(r,n()({key:"payment-method-icon-"+t.id},e))}))}},379:function(t,e,s){"use strict";s.d(e,"a",(function(){return a}));const a=t=>Object.values(t).reduce((t,e)=>(null!==e.icons&&(t=t.concat(e.icons)),t),[])},452:function(t,e,s){"use strict";s.r(e);var a=s(0),n=s(281),c=s(279),o=s(379);e.default=t=>{let{className:e}=t;const{paymentMethods:s}=Object(c.b)();return Object(a.createElement)(n.a,{className:e,icons:Object(o.a)(s)})}}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[12],{279:function(t,e){},282:function(t,e,s){"use strict";s.d(e,"b",(function(){return o})),s.d(e,"a",(function(){return l}));var a=s(31),n=s(211);const c=function(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{paymentMethods:e,expressPaymentMethods:s,paymentMethodsInitialized:c,expressPaymentMethodsInitialized:o}=Object(n.b)(),l=Object(a.a)(e),i=Object(a.a)(s);return{paymentMethods:t?i:l,isInitialized:t?o:c}},o=()=>c(!1),l=()=>c(!0)},284:function(t,e,s){"use strict";var a=s(12),n=s.n(a),c=s(0),o=s(4),l=s.n(o);const i=t=>"wc-block-components-payment-method-icon wc-block-components-payment-method-icon--"+t;var r=t=>{let{id:e,src:s=null,alt:a=""}=t;return s?Object(c.createElement)("img",{className:i(e),src:s,alt:a}):null},d=s(48);const m=[{id:"alipay",alt:"Alipay",src:d.l+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:d.l+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:d.l+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:d.l+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:d.l+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:d.l+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:d.l+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:d.l+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:d.l+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:d.l+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:d.l+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:d.l+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:d.l+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:d.l+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:d.l+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:d.l+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:d.l+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:d.l+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:d.l+"payment-methods/wechat.svg"}];var p=s(45);s(279),e.a=t=>{let{icons:e=[],align:s="center",className:a}=t;const o=(t=>{const e={};return t.forEach(t=>{let s={};"string"==typeof t&&(s={id:t,alt:t,src:null}),"object"==typeof t&&(s={id:t.id||"",alt:t.alt||"",src:t.src||null}),s.id&&Object(p.a)(s.id)&&!e[s.id]&&(e[s.id]=s)}),Object.values(e)})(e);if(0===o.length)return null;const i=l()("wc-block-components-payment-method-icons",{"wc-block-components-payment-method-icons--align-left":"left"===s,"wc-block-components-payment-method-icons--align-right":"right"===s},a);return Object(c.createElement)("div",{className:i},o.map(t=>{const e={...t,...(s=t.id,m.find(t=>t.id===s)||{})};var s;return Object(c.createElement)(r,n()({key:"payment-method-icon-"+t.id},e))}))}},382:function(t,e,s){"use strict";s.d(e,"a",(function(){return a}));const a=t=>Object.values(t).reduce((t,e)=>(null!==e.icons&&(t=t.concat(e.icons)),t),[])},455:function(t,e,s){"use strict";s.r(e);var a=s(0),n=s(284),c=s(282),o=s(382);e.default=t=>{let{className:e}=t;const{paymentMethods:s}=Object(c.b)();return Object(a.createElement)(n.a,{className:e,icons:Object(o.a)(s)})}}}]);
build/cart-blocks/cart-express-payment-frontend.js CHANGED
@@ -1,5 +1,5 @@
1
- (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[13],{106:function(e,t,n){"use strict";var o=n(0);t.a=function(e){let{icon:t,size:n=24,...s}=e;return Object(o.cloneElement)(t,{width:n,height:n,...s})}},265:function(e,t){},275:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var o=n(1),s=n(7),c=n(6),r=n(17),a=n(32),i=n(201);const l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{cartCoupons:t,cartIsLoading:n}=Object(a.a)(),{createErrorNotice:l}=Object(s.useDispatch)("core/notices"),{createNotice:p}=Object(s.useDispatch)("core/notices"),{setValidationErrors:u}=Object(i.b)(),{applyCoupon:d,removeCoupon:m,isApplyingCoupon:b,isRemovingCoupon:h}=Object(s.useSelect)((e,t)=>{let{dispatch:n}=t;const o=e(c.CART_STORE_KEY),s=n(c.CART_STORE_KEY);return{applyCoupon:s.applyCoupon,removeCoupon:s.removeCoupon,isApplyingCoupon:o.isApplyingCoupon(),isRemovingCoupon:o.isRemovingCoupon(),receiveApplyingCoupon:s.receiveApplyingCoupon}},[l,p]),g=t=>{d(t).then(n=>{!0===n&&p("info",Object(o.sprintf)(
2
  /* translators: %s coupon code. */
3
  Object(o.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(e=>{u({coupon:{message:Object(r.decodeEntities)(e.message),hidden:!1}}),receiveApplyingCoupon("")})},v=t=>{m(t).then(n=>{!0===n&&p("info",Object(o.sprintf)(
4
  /* translators: %s coupon code. */
5
- Object(o.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(t=>{l(t.message,{id:"coupon-form",context:e}),receiveApplyingCoupon("")})};return{appliedCoupons:t,isLoading:n,applyCoupon:g,removeCoupon:v,isApplyingCoupon:b,isRemovingCoupon:h}}},276:function(e,t){},278:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var o=n(0),s=n(201);n(265);const c=e=>{let{errorMessage:t="",propertyName:n="",elementId:c=""}=e;const{getValidationError:r,getValidationErrorId:a}=Object(s.b)();if(!t||"string"!=typeof t){const e=r(n)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(o.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(o.createElement)("p",{id:a(c)},t))}},279:function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return a}));var o=n(31),s=n(209);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{paymentMethods:t,expressPaymentMethods:n,paymentMethodsInitialized:c,expressPaymentMethodsInitialized:r}=Object(s.b)(),a=Object(o.a)(t),i=Object(o.a)(n);return{paymentMethods:e?i:a,isInitialized:e?r:c}},r=()=>c(!1),a=()=>c(!0)},281:function(e,t,n){"use strict";var o=n(12),s=n.n(o),c=n(0),r=n(4),a=n.n(r);const i=e=>"wc-block-components-payment-method-icon wc-block-components-payment-method-icon--"+e;var l=e=>{let{id:t,src:n=null,alt:o=""}=e;return n?Object(c.createElement)("img",{className:i(t),src:n,alt:o}):null},p=n(48);const u=[{id:"alipay",alt:"Alipay",src:p.l+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:p.l+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:p.l+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:p.l+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:p.l+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:p.l+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:p.l+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:p.l+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:p.l+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:p.l+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:p.l+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:p.l+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:p.l+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:p.l+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:p.l+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:p.l+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:p.l+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:p.l+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:p.l+"payment-methods/wechat.svg"}];var d=n(45);n(276),t.a=e=>{let{icons:t=[],align:n="center",className:o}=e;const r=(e=>{const t={};return e.forEach(e=>{let n={};"string"==typeof e&&(n={id:e,alt:e,src:null}),"object"==typeof e&&(n={id:e.id||"",alt:e.alt||"",src:e.src||null}),n.id&&Object(d.a)(n.id)&&!t[n.id]&&(t[n.id]=n)}),Object.values(t)})(t);if(0===r.length)return null;const i=a()("wc-block-components-payment-method-icons",{"wc-block-components-payment-method-icons--align-left":"left"===n,"wc-block-components-payment-method-icons--align-right":"right"===n},o);return Object(c.createElement)("div",{className:i},r.map(e=>{const t={...e,...(n=e.id,u.find(e=>e.id===n)||{})};var n;return Object(c.createElement)(l,s()({key:"payment-method-icon-"+e.id},t))}))}},291:function(e,t){},292:function(e,t,n){"use strict";var o=n(19),s=n.n(o),c=n(0),r=n(1),a=n(5),i=n(2),l=n(125),p=n(30);class u extends a.Component{constructor(){super(...arguments),s()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return{errorMessage:e.message,hasError:!0}}render(){const{hasError:e,errorMessage:t}=this.state,{isEditor:n}=this.props;if(e){let e=Object(r.__)("This site is experiencing difficulties with this payment method. Please contact the owner of the site for assistance.","woo-gutenberg-products-block");(n||i.CURRENT_USER_IS_ADMIN)&&(e=t||Object(r.__)("There was an error with this payment method. Please verify it's configured correctly.","woo-gutenberg-products-block"));const o=[{id:"0",content:e,isDismissible:!1,status:"error"}];return Object(c.createElement)(l.a,{additionalNotices:o,context:p.c.PAYMENTS})}return this.props.children}}u.defaultProps={isEditor:!1},t.a=u},314:function(e,t){},315:function(e,t,n){"use strict";var o=n(0),s=n(1),c=n(343),r=n(279),a=n(29),i=n(209),l=n(25),p=n.n(l),u=n(292);t.a=()=>{const{isEditor:e}=Object(a.a)(),{setActivePaymentMethod:t,setExpressPaymentError:n,activePaymentMethod:l,paymentMethodData:d,setPaymentStatus:m}=Object(i.b)(),b=Object(c.a)(),{paymentMethods:h}=Object(r.a)(),g=Object(o.useRef)(l),v=Object(o.useRef)(d),y=Object(o.useCallback)(e=>()=>{g.current=l,v.current=d,m().started(),t(e)},[l,d,t,m]),j=Object(o.useCallback)(()=>{m().pristine(),t(g.current,v.current)},[t,m]),O=Object(o.useCallback)(e=>{m().error(e),n(e),t(g.current,v.current)},[t,m,n]),E=Object(o.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";p()("Express Payment Methods should use the provided onError handler instead.",{alternative:"onError",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),e?O(e):n("")}),[n,O]),f=Object.entries(h),w=f.length>0?f.map(t=>{let[n,s]=t;const c=e?s.edit:s.content;return Object(o.isValidElement)(c)?Object(o.createElement)("li",{key:n,id:"express-payment-method-"+n},Object(o.cloneElement)(c,{...b,onClick:y(n),onClose:j,onError:O,setExpressPaymentError:E})):null}):Object(o.createElement)("li",{key:"noneRegistered"},Object(s.__)("No registered Payment Methods","woo-gutenberg-products-block"));return Object(o.createElement)(u.a,{isEditor:e},Object(o.createElement)("ul",{className:"wc-block-components-express-payment__event-buttons"},w))}},338:function(e,t,n){"use strict";var o=n(0),s=n(13);const c=Object(o.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(s.Path,{fillRule:"evenodd",d:"M5.5 9.5v-2h13v2h-13zm0 3v4h13v-4h-13zM4 7a1 1 0 011-1h14a1 1 0 011 1v10a1 1 0 01-1 1H5a1 1 0 01-1-1V7z",clipRule:"evenodd"}));t.a=c},343:function(e,t,n){"use strict";n.d(t,"a",(function(){return I}));var o=n(1),s=n(41),c=n(0),r=n(4),a=n.n(r),i=n(13),l=Object(c.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)("g",{fill:"none",fillRule:"evenodd"},Object(c.createElement)("path",{d:"M0 0h24v24H0z"}),Object(c.createElement)("path",{fill:"#000",fillRule:"nonzero",d:"M17.3 8v1c1 .2 1.4.9 1.4 1.7h-1c0-.6-.3-1-1-1-.8 0-1.3.4-1.3.9 0 .4.3.6 1.4 1 1 .2 2 .6 2 1.9 0 .9-.6 1.4-1.5 1.5v1H16v-1c-.9-.1-1.6-.7-1.7-1.7h1c0 .6.4 1 1.3 1 1 0 1.2-.5 1.2-.8 0-.4-.2-.8-1.3-1.1-1.3-.3-2.1-.8-2.1-1.8 0-.9.7-1.5 1.6-1.6V8h1.3zM12 10v1H6v-1h6zm2-2v1H6V8h8zM2 4v16h20V4H2zm2 14V6h16v12H4z"}),Object(c.createElement)("path",{stroke:"#000",strokeLinecap:"round",d:"M6 16c2.6 0 3.9-3 1.7-3-2 0-1 3 1.5 3 1 0 1-.8 2.8-.8"}))),p=Object(c.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(i.Path,{fillRule:"evenodd",d:"M18.646 9H20V8l-1-.5L12 4 5 7.5 4 8v1h14.646zm-3-1.5L12 5.677 8.354 7.5h7.292zm-7.897 9.44v-6.5h-1.5v6.5h1.5zm5-6.5v6.5h-1.5v-6.5h1.5zm5 0v6.5h-1.5v-6.5h1.5zm2.252 8.81c0 .414-.334.75-.748.75H4.752a.75.75 0 010-1.5h14.5a.75.75 0 01.749.75z",clipRule:"evenodd"})),u=Object(c.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(i.Path,{d:"M3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zm-1.338 4.877c-.314.22-.412.452-.412.623 0 .171.098.403.412.623.312.218.783.377 1.338.377.825 0 1.605.233 2.198.648.59.414 1.052 1.057 1.052 1.852 0 .795-.461 1.438-1.052 1.852-.41.286-.907.486-1.448.582v.316a.75.75 0 01-1.5 0v-.316a3.64 3.64 0 01-1.448-.582c-.59-.414-1.052-1.057-1.052-1.852a.75.75 0 011.5 0c0 .171.098.403.412.623.312.218.783.377 1.338.377s1.026-.159 1.338-.377c.314-.22.412-.452.412-.623 0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377-.825 0-1.605-.233-2.198-.648-.59-.414-1.052-1.057-1.052-1.852 0-.795.461-1.438 1.052-1.852a3.64 3.64 0 011.448-.582V7.5a.75.75 0 011.5 0v.316c.54.096 1.039.296 1.448.582.59.414 1.052 1.057 1.052 1.852a.75.75 0 01-1.5 0c0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377s-1.026.159-1.338.377z"})),d=n(338),m=n(106),b=n(45),h=n(18);n(291);const g={bank:p,bill:u,card:d.a,checkPayment:l};var v=e=>{let{icon:t="",text:n=""}=e;const o=!!t,s=Object(c.useCallback)(e=>o&&Object(b.a)(e)&&Object(h.b)(g,e),[o]),r=a()("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":o});return Object(c.createElement)("span",{className:r},s(t)?Object(c.createElement)(m.a,{icon:g[t]}):t,n)},y=n(281),j=n(2),O=n(25),E=n.n(O),f=n(138),w=n(278),k=n(32),C=n(275),S=n(30),P=n(36),x=n(209),_=n(68),R=n(50);const M=(e,t)=>{const n=[],s=(t,n)=>{const o=n+"_tax",s=Object(h.b)(e,n)&&Object(b.a)(e[n])?parseInt(e[n],10):0;return{key:n,label:t,value:s,valueWithTax:s+(Object(h.b)(e,o)&&Object(b.a)(e[o])?parseInt(e[o],10):0)}};return n.push(s(Object(o.__)("Subtotal:","woo-gutenberg-products-block"),"total_items")),n.push(s(Object(o.__)("Fees:","woo-gutenberg-products-block"),"total_fees")),n.push(s(Object(o.__)("Discount:","woo-gutenberg-products-block"),"total_discount")),n.push({key:"total_tax",label:Object(o.__)("Taxes:","woo-gutenberg-products-block"),value:parseInt(e.total_tax,10),valueWithTax:parseInt(e.total_tax,10)}),t&&n.push(s(Object(o.__)("Shipping:","woo-gutenberg-products-block"),"total_shipping")),n};var A=n(66);const I=()=>{const{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r,onCheckoutBeforeProcessing:a,onCheckoutValidationBeforeProcessing:i,onCheckoutAfterProcessingWithSuccess:l,onCheckoutAfterProcessingWithError:p,onSubmit:u,customerId:d}=Object(P.b)(),{currentStatus:m,activePaymentMethod:b,onPaymentProcessing:h,setExpressPaymentError:g,shouldSavePayment:O}=Object(x.b)(),{shippingErrorStatus:I,shippingErrorTypes:z,onShippingRateSuccess:T,onShippingRateFail:N,onShippingRateSelectSuccess:V,onShippingRateSelectFail:D}=Object(_.b)(),{shippingRates:B,isLoadingRates:L,selectedRates:F,isSelectingRate:H,selectShippingRate:W,needsShipping:G}=Object(A.a)(),{billingAddress:Y,shippingAddress:J,setShippingAddress:U}=Object(R.b)(),{cartItems:K,cartFees:X,cartTotals:q,extensions:Q}=Object(k.a)(),{appliedCoupons:Z}=Object(C.a)(),{noticeContexts:$,responseTypes:ee}=Object(S.d)(),te=Object(c.useRef)(M(q,G)),ne=Object(c.useRef)({label:Object(o.__)("Total","woo-gutenberg-products-block"),value:parseInt(q.total_price,10)});Object(c.useEffect)(()=>{te.current=M(q,G),ne.current={label:Object(o.__)("Total","woo-gutenberg-products-block"),value:parseInt(q.total_price,10)}},[q,G]);const oe=Object(c.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";E()("setExpressPaymentError should only be used by Express Payment Methods (using the provided onError handler).",{alternative:"",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),g(e)}),[g]);return{activePaymentMethod:b,billing:{appliedCoupons:Z,billingAddress:Y,billingData:Y,cartTotal:ne.current,cartTotalItems:te.current,currency:Object(s.getCurrencyFromPriceResponse)(q),customerId:d,displayPricesIncludingTax:Object(j.getSetting)("displayCartPricesIncludingTax",!1)},cartData:{cartItems:K,cartFees:X,extensions:Q},checkoutStatus:{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r},components:{LoadingMask:f.a,PaymentMethodIcons:y.a,PaymentMethodLabel:v,ValidationInputError:w.a},emitResponse:{noticeContexts:$,responseTypes:ee},eventRegistration:{onCheckoutAfterProcessingWithError:p,onCheckoutAfterProcessingWithSuccess:l,onCheckoutBeforeProcessing:a,onCheckoutValidationBeforeProcessing:i,onPaymentProcessing:h,onShippingRateFail:N,onShippingRateSelectFail:D,onShippingRateSelectSuccess:V,onShippingRateSuccess:T},onSubmit:u,paymentStatus:m,setExpressPaymentError:oe,shippingData:{isSelectingRate:H,needsShipping:G,selectedRates:F,setSelectedRates:W,setShippingAddress:U,shippingAddress:J,shippingRates:B,shippingRatesLoading:L},shippingStatus:{shippingErrorStatus:I,shippingErrorTypes:z},shouldSavePayment:O}}},439:function(e,t,n){"use strict";n.r(t);var o=n(0),s=n(32),c=n(4),r=n.n(c),a=n(1),i=n(279),l=n(30),p=n(36),u=n(209),d=n(125),m=n(138),b=n(315);n(314);var h=()=>{const{paymentMethods:e,isInitialized:t}=Object(i.a)(),{noticeContexts:n}=Object(l.d)(),{isCalculating:s,isProcessing:c,isAfterProcessing:r,isBeforeProcessing:h,isComplete:g,hasError:v}=Object(p.b)(),{currentStatus:y}=Object(u.b)();if(!t||t&&0===Object.keys(e).length)return null;const j=c||r||h||g&&!v;return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(m.a,{isLoading:s||j||y.isDoingExpressPayment},Object(o.createElement)("div",{className:"wc-block-components-express-payment wc-block-components-express-payment--cart"},Object(o.createElement)("div",{className:"wc-block-components-express-payment__content"},Object(o.createElement)(d.a,{context:n.EXPRESS_PAYMENTS}),Object(o.createElement)(b.a,null)))),Object(o.createElement)("div",{className:"wc-block-components-express-payment-continue-rule wc-block-components-express-payment-continue-rule--cart"},Object(a.__)("Or","woo-gutenberg-products-block")))};t.default=e=>{let{className:t}=e;const{cartNeedsPayment:n}=Object(s.a)();return n?Object(o.createElement)("div",{className:r()("wc-block-cart__payment-options",t)},Object(o.createElement)(h,null)):null}}}]);
1
+ (window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[13],{108:function(e,t,n){"use strict";var o=n(0);t.a=function(e){let{icon:t,size:n=24,...s}=e;return Object(o.cloneElement)(t,{width:n,height:n,...s})}},268:function(e,t){},278:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var o=n(1),s=n(7),c=n(6),r=n(17),a=n(32),i=n(203);const l=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{cartCoupons:t,cartIsLoading:n}=Object(a.a)(),{createErrorNotice:l}=Object(s.useDispatch)("core/notices"),{createNotice:p}=Object(s.useDispatch)("core/notices"),{setValidationErrors:u}=Object(i.b)(),{applyCoupon:d,removeCoupon:m,isApplyingCoupon:b,isRemovingCoupon:h}=Object(s.useSelect)((e,t)=>{let{dispatch:n}=t;const o=e(c.CART_STORE_KEY),s=n(c.CART_STORE_KEY);return{applyCoupon:s.applyCoupon,removeCoupon:s.removeCoupon,isApplyingCoupon:o.isApplyingCoupon(),isRemovingCoupon:o.isRemovingCoupon(),receiveApplyingCoupon:s.receiveApplyingCoupon}},[l,p]),g=t=>{d(t).then(n=>{!0===n&&p("info",Object(o.sprintf)(
2
  /* translators: %s coupon code. */
3
  Object(o.__)('Coupon code "%s" has been applied to your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(e=>{u({coupon:{message:Object(r.decodeEntities)(e.message),hidden:!1}}),receiveApplyingCoupon("")})},v=t=>{m(t).then(n=>{!0===n&&p("info",Object(o.sprintf)(
4
  /* translators: %s coupon code. */
5
+ Object(o.__)('Coupon code "%s" has been removed from your cart.',"woo-gutenberg-products-block"),t),{id:"coupon-form",type:"snackbar",context:e})}).catch(t=>{l(t.message,{id:"coupon-form",context:e}),receiveApplyingCoupon("")})};return{appliedCoupons:t,isLoading:n,applyCoupon:g,removeCoupon:v,isApplyingCoupon:b,isRemovingCoupon:h}}},279:function(e,t){},281:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var o=n(0),s=n(203);n(268);const c=e=>{let{errorMessage:t="",propertyName:n="",elementId:c=""}=e;const{getValidationError:r,getValidationErrorId:a}=Object(s.b)();if(!t||"string"!=typeof t){const e=r(n)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(o.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(o.createElement)("p",{id:a(c)},t))}},282:function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return a}));var o=n(31),s=n(211);const c=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{paymentMethods:t,expressPaymentMethods:n,paymentMethodsInitialized:c,expressPaymentMethodsInitialized:r}=Object(s.b)(),a=Object(o.a)(t),i=Object(o.a)(n);return{paymentMethods:e?i:a,isInitialized:e?r:c}},r=()=>c(!1),a=()=>c(!0)},284:function(e,t,n){"use strict";var o=n(12),s=n.n(o),c=n(0),r=n(4),a=n.n(r);const i=e=>"wc-block-components-payment-method-icon wc-block-components-payment-method-icon--"+e;var l=e=>{let{id:t,src:n=null,alt:o=""}=e;return n?Object(c.createElement)("img",{className:i(t),src:n,alt:o}):null},p=n(48);const u=[{id:"alipay",alt:"Alipay",src:p.l+"payment-methods/alipay.svg"},{id:"amex",alt:"American Express",src:p.l+"payment-methods/amex.svg"},{id:"bancontact",alt:"Bancontact",src:p.l+"payment-methods/bancontact.svg"},{id:"diners",alt:"Diners Club",src:p.l+"payment-methods/diners.svg"},{id:"discover",alt:"Discover",src:p.l+"payment-methods/discover.svg"},{id:"eps",alt:"EPS",src:p.l+"payment-methods/eps.svg"},{id:"giropay",alt:"Giropay",src:p.l+"payment-methods/giropay.svg"},{id:"ideal",alt:"iDeal",src:p.l+"payment-methods/ideal.svg"},{id:"jcb",alt:"JCB",src:p.l+"payment-methods/jcb.svg"},{id:"laser",alt:"Laser",src:p.l+"payment-methods/laser.svg"},{id:"maestro",alt:"Maestro",src:p.l+"payment-methods/maestro.svg"},{id:"mastercard",alt:"Mastercard",src:p.l+"payment-methods/mastercard.svg"},{id:"multibanco",alt:"Multibanco",src:p.l+"payment-methods/multibanco.svg"},{id:"p24",alt:"Przelewy24",src:p.l+"payment-methods/p24.svg"},{id:"sepa",alt:"Sepa",src:p.l+"payment-methods/sepa.svg"},{id:"sofort",alt:"Sofort",src:p.l+"payment-methods/sofort.svg"},{id:"unionpay",alt:"Union Pay",src:p.l+"payment-methods/unionpay.svg"},{id:"visa",alt:"Visa",src:p.l+"payment-methods/visa.svg"},{id:"wechat",alt:"WeChat",src:p.l+"payment-methods/wechat.svg"}];var d=n(45);n(279),t.a=e=>{let{icons:t=[],align:n="center",className:o}=e;const r=(e=>{const t={};return e.forEach(e=>{let n={};"string"==typeof e&&(n={id:e,alt:e,src:null}),"object"==typeof e&&(n={id:e.id||"",alt:e.alt||"",src:e.src||null}),n.id&&Object(d.a)(n.id)&&!t[n.id]&&(t[n.id]=n)}),Object.values(t)})(t);if(0===r.length)return null;const i=a()("wc-block-components-payment-method-icons",{"wc-block-components-payment-method-icons--align-left":"left"===n,"wc-block-components-payment-method-icons--align-right":"right"===n},o);return Object(c.createElement)("div",{className:i},r.map(e=>{const t={...e,...(n=e.id,u.find(e=>e.id===n)||{})};var n;return Object(c.createElement)(l,s()({key:"payment-method-icon-"+e.id},t))}))}},294:function(e,t){},295:function(e,t,n){"use strict";var o=n(19),s=n.n(o),c=n(0),r=n(1),a=n(5),i=n(2),l=n(127),p=n(30);class u extends a.Component{constructor(){super(...arguments),s()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return{errorMessage:e.message,hasError:!0}}render(){const{hasError:e,errorMessage:t}=this.state,{isEditor:n}=this.props;if(e){let e=Object(r.__)("We are experiencing difficulties with this payment method. Please contact us for assistance.","woo-gutenberg-products-block");(n||i.CURRENT_USER_IS_ADMIN)&&(e=t||Object(r.__)("There was an error with this payment method. Please verify it's configured correctly.","woo-gutenberg-products-block"));const o=[{id:"0",content:e,isDismissible:!1,status:"error"}];return Object(c.createElement)(l.a,{additionalNotices:o,context:p.c.PAYMENTS})}return this.props.children}}u.defaultProps={isEditor:!1},t.a=u},317:function(e,t){},318:function(e,t,n){"use strict";var o=n(0),s=n(1),c=n(346),r=n(282),a=n(29),i=n(211),l=n(25),p=n.n(l),u=n(295);t.a=()=>{const{isEditor:e}=Object(a.a)(),{setActivePaymentMethod:t,setExpressPaymentError:n,activePaymentMethod:l,paymentMethodData:d,setPaymentStatus:m}=Object(i.b)(),b=Object(c.a)(),{paymentMethods:h}=Object(r.a)(),g=Object(o.useRef)(l),v=Object(o.useRef)(d),y=Object(o.useCallback)(e=>()=>{g.current=l,v.current=d,m().started(),t(e)},[l,d,t,m]),j=Object(o.useCallback)(()=>{m().pristine(),t(g.current,v.current)},[t,m]),O=Object(o.useCallback)(e=>{m().error(e),n(e),t(g.current,v.current)},[t,m,n]),E=Object(o.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";p()("Express Payment Methods should use the provided onError handler instead.",{alternative:"onError",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),e?O(e):n("")}),[n,O]),f=Object.entries(h),w=f.length>0?f.map(t=>{let[n,s]=t;const c=e?s.edit:s.content;return Object(o.isValidElement)(c)?Object(o.createElement)("li",{key:n,id:"express-payment-method-"+n},Object(o.cloneElement)(c,{...b,onClick:y(n),onClose:j,onError:O,setExpressPaymentError:E})):null}):Object(o.createElement)("li",{key:"noneRegistered"},Object(s.__)("No registered Payment Methods","woo-gutenberg-products-block"));return Object(o.createElement)(u.a,{isEditor:e},Object(o.createElement)("ul",{className:"wc-block-components-express-payment__event-buttons"},w))}},341:function(e,t,n){"use strict";var o=n(0),s=n(13);const c=Object(o.createElement)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)(s.Path,{fillRule:"evenodd",d:"M5.5 9.5v-2h13v2h-13zm0 3v4h13v-4h-13zM4 7a1 1 0 011-1h14a1 1 0 011 1v10a1 1 0 01-1 1H5a1 1 0 01-1-1V7z",clipRule:"evenodd"}));t.a=c},346:function(e,t,n){"use strict";n.d(t,"a",(function(){return I}));var o=n(1),s=n(41),c=n(0),r=n(4),a=n.n(r),i=n(13),l=Object(c.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)("g",{fill:"none",fillRule:"evenodd"},Object(c.createElement)("path",{d:"M0 0h24v24H0z"}),Object(c.createElement)("path",{fill:"#000",fillRule:"nonzero",d:"M17.3 8v1c1 .2 1.4.9 1.4 1.7h-1c0-.6-.3-1-1-1-.8 0-1.3.4-1.3.9 0 .4.3.6 1.4 1 1 .2 2 .6 2 1.9 0 .9-.6 1.4-1.5 1.5v1H16v-1c-.9-.1-1.6-.7-1.7-1.7h1c0 .6.4 1 1.3 1 1 0 1.2-.5 1.2-.8 0-.4-.2-.8-1.3-1.1-1.3-.3-2.1-.8-2.1-1.8 0-.9.7-1.5 1.6-1.6V8h1.3zM12 10v1H6v-1h6zm2-2v1H6V8h8zM2 4v16h20V4H2zm2 14V6h16v12H4z"}),Object(c.createElement)("path",{stroke:"#000",strokeLinecap:"round",d:"M6 16c2.6 0 3.9-3 1.7-3-2 0-1 3 1.5 3 1 0 1-.8 2.8-.8"}))),p=Object(c.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(i.Path,{fillRule:"evenodd",d:"M18.646 9H20V8l-1-.5L12 4 5 7.5 4 8v1h14.646zm-3-1.5L12 5.677 8.354 7.5h7.292zm-7.897 9.44v-6.5h-1.5v6.5h1.5zm5-6.5v6.5h-1.5v-6.5h1.5zm5 0v6.5h-1.5v-6.5h1.5zm2.252 8.81c0 .414-.334.75-.748.75H4.752a.75.75 0 010-1.5h14.5a.75.75 0 01.749.75z",clipRule:"evenodd"})),u=Object(c.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(i.Path,{d:"M3.25 12a8.75 8.75 0 1117.5 0 8.75 8.75 0 01-17.5 0zM12 4.75a7.25 7.25 0 100 14.5 7.25 7.25 0 000-14.5zm-1.338 4.877c-.314.22-.412.452-.412.623 0 .171.098.403.412.623.312.218.783.377 1.338.377.825 0 1.605.233 2.198.648.59.414 1.052 1.057 1.052 1.852 0 .795-.461 1.438-1.052 1.852-.41.286-.907.486-1.448.582v.316a.75.75 0 01-1.5 0v-.316a3.64 3.64 0 01-1.448-.582c-.59-.414-1.052-1.057-1.052-1.852a.75.75 0 011.5 0c0 .171.098.403.412.623.312.218.783.377 1.338.377s1.026-.159 1.338-.377c.314-.22.412-.452.412-.623 0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377-.825 0-1.605-.233-2.198-.648-.59-.414-1.052-1.057-1.052-1.852 0-.795.461-1.438 1.052-1.852a3.64 3.64 0 011.448-.582V7.5a.75.75 0 011.5 0v.316c.54.096 1.039.296 1.448.582.59.414 1.052 1.057 1.052 1.852a.75.75 0 01-1.5 0c0-.171-.098-.403-.412-.623-.312-.218-.783-.377-1.338-.377s-1.026.159-1.338.377z"})),d=n(341),m=n(108),b=n(45),h=n(18);n(294);const g={bank:p,bill:u,card:d.a,checkPayment:l};var v=e=>{let{icon:t="",text:n=""}=e;const o=!!t,s=Object(c.useCallback)(e=>o&&Object(b.a)(e)&&Object(h.b)(g,e),[o]),r=a()("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":o});return Object(c.createElement)("span",{className:r},s(t)?Object(c.createElement)(m.a,{icon:g[t]}):t,n)},y=n(284),j=n(2),O=n(25),E=n.n(O),f=n(140),w=n(281),k=n(32),C=n(278),S=n(30),P=n(36),x=n(211),_=n(69),R=n(50);const M=(e,t)=>{const n=[],s=(t,n)=>{const o=n+"_tax",s=Object(h.b)(e,n)&&Object(b.a)(e[n])?parseInt(e[n],10):0;return{key:n,label:t,value:s,valueWithTax:s+(Object(h.b)(e,o)&&Object(b.a)(e[o])?parseInt(e[o],10):0)}};return n.push(s(Object(o.__)("Subtotal:","woo-gutenberg-products-block"),"total_items")),n.push(s(Object(o.__)("Fees:","woo-gutenberg-products-block"),"total_fees")),n.push(s(Object(o.__)("Discount:","woo-gutenberg-products-block"),"total_discount")),n.push({key:"total_tax",label:Object(o.__)("Taxes:","woo-gutenberg-products-block"),value:parseInt(e.total_tax,10),valueWithTax:parseInt(e.total_tax,10)}),t&&n.push(s(Object(o.__)("Shipping:","woo-gutenberg-products-block"),"total_shipping")),n};var A=n(67);const I=()=>{const{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r,onCheckoutBeforeProcessing:a,onCheckoutValidationBeforeProcessing:i,onCheckoutAfterProcessingWithSuccess:l,onCheckoutAfterProcessingWithError:p,onSubmit:u,customerId:d}=Object(P.b)(),{currentStatus:m,activePaymentMethod:b,onPaymentProcessing:h,setExpressPaymentError:g,shouldSavePayment:O}=Object(x.b)(),{shippingErrorStatus:I,shippingErrorTypes:z,onShippingRateSuccess:T,onShippingRateFail:N,onShippingRateSelectSuccess:V,onShippingRateSelectFail:D}=Object(_.b)(),{shippingRates:B,isLoadingRates:L,selectedRates:F,isSelectingRate:W,selectShippingRate:H,needsShipping:G}=Object(A.a)(),{billingAddress:Y,shippingAddress:J,setShippingAddress:U}=Object(R.b)(),{cartItems:K,cartFees:X,cartTotals:q,extensions:Q}=Object(k.a)(),{appliedCoupons:Z}=Object(C.a)(),{noticeContexts:$,responseTypes:ee}=Object(S.d)(),te=Object(c.useRef)(M(q,G)),ne=Object(c.useRef)({label:Object(o.__)("Total","woo-gutenberg-products-block"),value:parseInt(q.total_price,10)});Object(c.useEffect)(()=>{te.current=M(q,G),ne.current={label:Object(o.__)("Total","woo-gutenberg-products-block"),value:parseInt(q.total_price,10)}},[q,G]);const oe=Object(c.useCallback)((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";E()("setExpressPaymentError should only be used by Express Payment Methods (using the provided onError handler).",{alternative:"",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/4228"}),g(e)}),[g]);return{activePaymentMethod:b,billing:{appliedCoupons:Z,billingAddress:Y,billingData:Y,cartTotal:ne.current,cartTotalItems:te.current,currency:Object(s.getCurrencyFromPriceResponse)(q),customerId:d,displayPricesIncludingTax:Object(j.getSetting)("displayCartPricesIncludingTax",!1)},cartData:{cartItems:K,cartFees:X,extensions:Q},checkoutStatus:{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r},components:{LoadingMask:f.a,PaymentMethodIcons:y.a,PaymentMethodLabel:v,ValidationInputError:w.a},emitResponse:{noticeContexts:$,responseTypes:ee},eventRegistration:{onCheckoutAft