Version Description
- 2022-07-18 =
Enhancements
- Update WooCommerce block template descriptions. (6667)
- Add filter URL support to filter blocks when filtering for All Products block. (6642)
- Add: Allow choosing between single and multiple sections. (6620)
- Cart endpoint for Store API (/wc/store/cart) now features cross-sell items based on cart contents. (6635)
Bug Fixes
- Prevent Featured Product block from breaking when product is out of stock + hidden from catalog. (6640)
- Contrast improvement for checkout error messages when displayed over a theme's dark mode. (6292)
Download this release
Release Info
Developer | automattic |
Plugin | WooCommerce Gutenberg Products Block |
Version | 8.1.0 |
Comparing to | |
See all releases |
Code changes from version 8.0.0 to 8.1.0
- assets/js/base/components/text-input/style.scss +15 -0
- assets/js/base/context/providers/validation/components/validation-input-error/style.scss +4 -0
- assets/js/blocks/active-filters/active-attribute-filters.tsx +21 -21
- assets/js/blocks/active-filters/block.tsx +20 -20
- assets/js/blocks/active-filters/utils.tsx +15 -2
- assets/js/blocks/attribute-filter/block.json +4 -0
- assets/js/blocks/attribute-filter/block.tsx +45 -57
- assets/js/blocks/attribute-filter/edit.tsx +51 -18
- assets/js/blocks/attribute-filter/frontend.ts +2 -2
- assets/js/blocks/attribute-filter/index.tsx +5 -0
- assets/js/blocks/attribute-filter/types.ts +3 -2
- assets/js/blocks/attribute-filter/utils.ts +4 -5
- assets/js/blocks/price-filter/block.tsx +19 -33
- assets/js/blocks/stock-filter/block.tsx +28 -35
- assets/js/hocs/with-product-variations.js +1 -1
- assets/js/utils/filters.ts +21 -0
- build/active-filters-frontend.asset.php +1 -1
- build/active-filters-frontend.js +4 -4
- build/active-filters.asset.php +1 -1
- build/active-filters.js +4 -4
- build/all-products-frontend.asset.php +1 -1
- build/all-products-frontend.js +4 -4
- build/all-products.asset.php +1 -1
- build/all-products.js +10 -10
- build/all-reviews.asset.php +1 -1
- build/all-reviews.js +3 -3
- build/attribute-filter-frontend.asset.php +1 -1
- build/attribute-filter-frontend.js +9 -9
- build/attribute-filter.asset.php +1 -1
- build/attribute-filter.js +10 -10
- build/attribute-filter/block.json +4 -0
- build/cart-blocks/cart-express-payment-frontend.js +2 -2
- build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js +3 -3
- build/cart-blocks/cart-line-items-frontend.js +1 -1
- build/cart-blocks/cart-order-summary-frontend.js +1 -1
- build/cart-blocks/order-summary-coupon-form-frontend.js +2 -2
- build/cart-blocks/order-summary-discount-frontend.js +1 -1
- build/cart-blocks/order-summary-heading-frontend.js +1 -1
- build/cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping-frontend.js +1 -1
- build/cart-blocks/order-summary-shipping-frontend.js +1 -1
- build/cart-blocks/order-summary-taxes-frontend.js +1 -1
- build/cart-blocks/proceed-to-checkout-frontend.js +1 -1
- build/cart-frontend.asset.php +1 -1
- build/cart-frontend.js +2 -3
assets/js/base/components/text-input/style.scss
CHANGED
@@ -105,10 +105,25 @@
|
|
105 |
&:focus {
|
106 |
box-shadow: 0 0 0 1px $alert-red;
|
107 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
}
|
109 |
|
110 |
&.has-error label {
|
111 |
color: $alert-red;
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
|
114 |
&:only-child {
|
105 |
&:focus {
|
106 |
box-shadow: 0 0 0 1px $alert-red;
|
107 |
}
|
108 |
+
|
109 |
+
.has-dark-controls &,
|
110 |
+
.has-dark-controls &:hover,
|
111 |
+
.has-dark-controls &:focus,
|
112 |
+
.has-dark-controls &:active {
|
113 |
+
border-color: color.adjust($alert-red, $lightness: 30%);
|
114 |
+
}
|
115 |
+
|
116 |
+
.has-dark-controls &:focus {
|
117 |
+
box-shadow: 0 0 0 1px color.adjust($alert-red, $lightness: 30%);
|
118 |
+
}
|
119 |
}
|
120 |
|
121 |
&.has-error label {
|
122 |
color: $alert-red;
|
123 |
+
|
124 |
+
.has-dark-controls & {
|
125 |
+
color: color.adjust($alert-red, $lightness: 30%);
|
126 |
+
}
|
127 |
}
|
128 |
|
129 |
&:only-child {
|
assets/js/base/context/providers/validation/components/validation-input-error/style.scss
CHANGED
@@ -10,6 +10,10 @@
|
|
10 |
}
|
11 |
}
|
12 |
|
|
|
|
|
|
|
|
|
13 |
.wc-block-components-select + .wc-block-components-validation-error {
|
14 |
margin-bottom: $gap-large;
|
15 |
}
|
10 |
}
|
11 |
}
|
12 |
|
13 |
+
.has-dark-mode-palette .wc-block-components-validation-error {
|
14 |
+
color: color.adjust($alert-red, $lightness: 30%);
|
15 |
+
}
|
16 |
+
|
17 |
.wc-block-components-select + .wc-block-components-validation-error {
|
18 |
margin-bottom: $gap-large;
|
19 |
}
|
assets/js/blocks/active-filters/active-attribute-filters.tsx
CHANGED
@@ -101,33 +101,33 @@ const ActiveAttributeFilters = ( {
|
|
101 |
name: decodeEntities( termObject.name || slug ),
|
102 |
prefix,
|
103 |
removeCallback: () => {
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
`pa_${ attributeObject.name }`
|
109 |
-
);
|
110 |
-
|
111 |
-
// If only one attribute was selected, we remove both filter and query type from the URL.
|
112 |
-
if ( currentAttribute?.slug.length === 1 ) {
|
113 |
-
return removeArgsFromFilterUrl(
|
114 |
-
`query_type_${ attributeObject.name }`,
|
115 |
-
`filter_${ attributeObject.name }`
|
116 |
-
);
|
117 |
-
}
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
// Remove only the slug from the URL.
|
120 |
-
|
121 |
[ `filter_${ attributeObject.name }` ]:
|
122 |
slug,
|
123 |
} );
|
124 |
}
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
|
|
|
|
|
|
131 |
},
|
132 |
showLabel: false,
|
133 |
displayStyle,
|
101 |
name: decodeEntities( termObject.name || slug ),
|
102 |
prefix,
|
103 |
removeCallback: () => {
|
104 |
+
const currentAttribute = productAttributes.find(
|
105 |
+
( { attribute } ) =>
|
106 |
+
attribute === `pa_${ attributeObject.name }`
|
107 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
|
109 |
+
// If only one attribute was selected, we remove both filter and query type from the URL.
|
110 |
+
if ( currentAttribute?.slug.length === 1 ) {
|
111 |
+
removeArgsFromFilterUrl(
|
112 |
+
`query_type_${ attributeObject.name }`,
|
113 |
+
`filter_${ attributeObject.name }`
|
114 |
+
);
|
115 |
+
} else {
|
116 |
// Remove only the slug from the URL.
|
117 |
+
removeArgsFromFilterUrl( {
|
118 |
[ `filter_${ attributeObject.name }` ]:
|
119 |
slug,
|
120 |
} );
|
121 |
}
|
122 |
+
|
123 |
+
if ( ! filteringForPhpTemplate ) {
|
124 |
+
removeAttributeFilterBySlug(
|
125 |
+
productAttributes,
|
126 |
+
setProductAttributes,
|
127 |
+
attributeObject,
|
128 |
+
slug
|
129 |
+
);
|
130 |
+
}
|
131 |
},
|
132 |
showLabel: false,
|
133 |
displayStyle,
|
assets/js/blocks/active-filters/block.tsx
CHANGED
@@ -76,17 +76,17 @@ const ActiveFiltersBlock = ( {
|
|
76 |
type: __( 'Stock Status', 'woo-gutenberg-products-block' ),
|
77 |
name: STOCK_STATUS_OPTIONS[ slug ],
|
78 |
removeCallback: () => {
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
}
|
84 |
-
const newStatuses = productStockStatus.filter(
|
85 |
-
( status ) => {
|
86 |
-
return status !== slug;
|
87 |
-
}
|
88 |
-
);
|
89 |
-
setProductStockStatus( newStatuses );
|
90 |
},
|
91 |
displayStyle: blockAttributes.displayStyle,
|
92 |
} );
|
@@ -107,11 +107,11 @@ const ActiveFiltersBlock = ( {
|
|
107 |
type: __( 'Price', 'woo-gutenberg-products-block' ),
|
108 |
name: formatPriceRange( minPrice, maxPrice ),
|
109 |
removeCallback: () => {
|
110 |
-
|
111 |
-
|
|
|
|
|
112 |
}
|
113 |
-
setMinPrice( undefined );
|
114 |
-
setMaxPrice( undefined );
|
115 |
},
|
116 |
displayStyle: blockAttributes.displayStyle,
|
117 |
} );
|
@@ -289,13 +289,13 @@ const ActiveFiltersBlock = ( {
|
|
289 |
<button
|
290 |
className="wc-block-active-filters__clear-all"
|
291 |
onClick={ () => {
|
292 |
-
|
293 |
-
|
|
|
|
|
|
|
|
|
294 |
}
|
295 |
-
setMinPrice( undefined );
|
296 |
-
setMaxPrice( undefined );
|
297 |
-
setProductAttributes( [] );
|
298 |
-
setProductStockStatus( [] );
|
299 |
} }
|
300 |
>
|
301 |
<Label
|
76 |
type: __( 'Stock Status', 'woo-gutenberg-products-block' ),
|
77 |
name: STOCK_STATUS_OPTIONS[ slug ],
|
78 |
removeCallback: () => {
|
79 |
+
removeArgsFromFilterUrl( {
|
80 |
+
filter_stock_status: slug,
|
81 |
+
} );
|
82 |
+
if ( ! filteringForPhpTemplate ) {
|
83 |
+
const newStatuses = productStockStatus.filter(
|
84 |
+
( status ) => {
|
85 |
+
return status !== slug;
|
86 |
+
}
|
87 |
+
);
|
88 |
+
setProductStockStatus( newStatuses );
|
89 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
},
|
91 |
displayStyle: blockAttributes.displayStyle,
|
92 |
} );
|
107 |
type: __( 'Price', 'woo-gutenberg-products-block' ),
|
108 |
name: formatPriceRange( minPrice, maxPrice ),
|
109 |
removeCallback: () => {
|
110 |
+
removeArgsFromFilterUrl( 'max_price', 'min_price' );
|
111 |
+
if ( ! filteringForPhpTemplate ) {
|
112 |
+
setMinPrice( undefined );
|
113 |
+
setMaxPrice( undefined );
|
114 |
}
|
|
|
|
|
115 |
},
|
116 |
displayStyle: blockAttributes.displayStyle,
|
117 |
} );
|
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
|
assets/js/blocks/active-filters/utils.tsx
CHANGED
@@ -6,6 +6,7 @@ import { formatPrice } from '@woocommerce/price-format';
|
|
6 |
import { RemovableChip } from '@woocommerce/base-components/chip';
|
7 |
import Label from '@woocommerce/base-components/label';
|
8 |
import { getQueryArgs, addQueryArgs, removeQueryArgs } from '@wordpress/url';
|
|
|
9 |
|
10 |
/**
|
11 |
* Format a min/max price range to display.
|
@@ -158,6 +159,10 @@ export const renderRemovableListItem = ( {
|
|
158 |
export const removeArgsFromFilterUrl = (
|
159 |
...args: ( string | Record< string, string > )[]
|
160 |
) => {
|
|
|
|
|
|
|
|
|
161 |
const url = window.location.href;
|
162 |
const currentQuery = getQueryArgs( url );
|
163 |
const cleanUrl = removeQueryArgs( url, ...Object.keys( currentQuery ) );
|
@@ -181,13 +186,19 @@ export const removeArgsFromFilterUrl = (
|
|
181 |
Object.entries( currentQuery ).filter( ( [ , value ] ) => value )
|
182 |
);
|
183 |
|
184 |
-
|
|
|
|
|
185 |
};
|
186 |
|
187 |
/**
|
188 |
* Clean the filter URL.
|
189 |
*/
|
190 |
export const cleanFilterUrl = () => {
|
|
|
|
|
|
|
|
|
191 |
const url = window.location.href;
|
192 |
const args = getQueryArgs( url );
|
193 |
const cleanUrl = removeQueryArgs( url, ...Object.keys( args ) );
|
@@ -209,5 +220,7 @@ export const cleanFilterUrl = () => {
|
|
209 |
.map( ( key ) => [ key, args[ key ] ] )
|
210 |
);
|
211 |
|
212 |
-
|
|
|
|
|
213 |
};
|
6 |
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.
|
159 |
export const removeArgsFromFilterUrl = (
|
160 |
...args: ( string | Record< string, string > )[]
|
161 |
) => {
|
162 |
+
if ( ! window ) {
|
163 |
+
return;
|
164 |
+
}
|
165 |
+
|
166 |
const url = window.location.href;
|
167 |
const currentQuery = getQueryArgs( url );
|
168 |
const cleanUrl = removeQueryArgs( url, ...Object.keys( currentQuery ) );
|
186 |
Object.entries( currentQuery ).filter( ( [ , value ] ) => value )
|
187 |
);
|
188 |
|
189 |
+
const newUrl = addQueryArgs( cleanUrl, filteredQuery );
|
190 |
+
|
191 |
+
changeUrl( newUrl );
|
192 |
};
|
193 |
|
194 |
/**
|
195 |
* Clean the filter URL.
|
196 |
*/
|
197 |
export const cleanFilterUrl = () => {
|
198 |
+
if ( ! window ) {
|
199 |
+
return;
|
200 |
+
}
|
201 |
+
|
202 |
const url = window.location.href;
|
203 |
const args = getQueryArgs( url );
|
204 |
const cleanUrl = removeQueryArgs( url, ...Object.keys( args ) );
|
220 |
.map( ( key ) => [ key, args[ key ] ] )
|
221 |
);
|
222 |
|
223 |
+
const newUrl = addQueryArgs( cleanUrl, remainingArgs );
|
224 |
+
|
225 |
+
changeUrl( newUrl );
|
226 |
};
|
assets/js/blocks/attribute-filter/block.json
CHANGED
@@ -46,6 +46,10 @@
|
|
46 |
"type": "boolean",
|
47 |
"default": false
|
48 |
},
|
|
|
|
|
|
|
|
|
49 |
"isPreview": {
|
50 |
"type": "boolean",
|
51 |
"default": false
|
46 |
"type": "boolean",
|
47 |
"default": false
|
48 |
},
|
49 |
+
"selectType": {
|
50 |
+
"type": "string",
|
51 |
+
"default": "multiple"
|
52 |
+
},
|
53 |
"isPreview": {
|
54 |
"type": "boolean",
|
55 |
"default": false
|
assets/js/blocks/attribute-filter/block.tsx
CHANGED
@@ -29,6 +29,7 @@ import {
|
|
29 |
objectHasProp,
|
30 |
} from '@woocommerce/types';
|
31 |
import {
|
|
|
32 |
PREFIX_QUERY_ARG_FILTER_TYPE,
|
33 |
PREFIX_QUERY_ARG_QUERY_TYPE,
|
34 |
} from '@woocommerce/utils';
|
@@ -91,7 +92,7 @@ const AttributeFilterBlock = ( {
|
|
91 |
isString
|
92 |
);
|
93 |
|
94 |
-
const [
|
95 |
useState( false );
|
96 |
|
97 |
const attributeObject =
|
@@ -99,10 +100,13 @@ const AttributeFilterBlock = ( {
|
|
99 |
? previewAttributeObject
|
100 |
: getAttributeFromID( blockAttributes.attributeId );
|
101 |
|
102 |
-
const
|
103 |
-
getActiveFilters(
|
|
|
104 |
);
|
105 |
|
|
|
|
|
106 |
const [ displayedOptions, setDisplayedOptions ] = useState<
|
107 |
DisplayOption[]
|
108 |
>(
|
@@ -250,7 +254,7 @@ const AttributeFilterBlock = ( {
|
|
250 |
* @param {Object} query The object containing the active filter query.
|
251 |
* @param {boolean} allFiltersRemoved If there are active filters or not.
|
252 |
*/
|
253 |
-
const
|
254 |
( query, allFiltersRemoved = false ) => {
|
255 |
if ( allFiltersRemoved ) {
|
256 |
if ( ! attributeObject?.taxonomy ) {
|
@@ -278,14 +282,14 @@ const AttributeFilterBlock = ( {
|
|
278 |
);
|
279 |
|
280 |
const newUrl = formatParams( url, query );
|
281 |
-
|
282 |
} else {
|
283 |
const newUrl = formatParams( pageUrl, query );
|
284 |
const currentQueryArgs = getQueryArgs( window.location.href );
|
285 |
const newUrlQueryArgs = getQueryArgs( newUrl );
|
286 |
|
287 |
if ( ! isQueryArgsEqual( currentQueryArgs, newUrlQueryArgs ) ) {
|
288 |
-
|
289 |
}
|
290 |
}
|
291 |
},
|
@@ -301,20 +305,17 @@ const AttributeFilterBlock = ( {
|
|
301 |
blockAttributes.queryType === 'or' ? 'in' : 'and'
|
302 |
);
|
303 |
|
304 |
-
|
305 |
-
if ( filteringForPhpTemplate ) {
|
306 |
-
redirectPageForPhpTemplate( query, checkedFilters.length === 0 );
|
307 |
-
}
|
308 |
};
|
309 |
|
310 |
const updateCheckedFilters = useCallback(
|
311 |
-
( checkedFilters: string[] ) => {
|
312 |
if ( isEditor ) {
|
313 |
return;
|
314 |
}
|
315 |
|
316 |
setChecked( checkedFilters );
|
317 |
-
if ( ! blockAttributes.showFilterButton ) {
|
318 |
updateAttributeFilter(
|
319 |
productAttributesQuery,
|
320 |
setProductAttributesQuery,
|
@@ -366,9 +367,7 @@ const AttributeFilterBlock = ( {
|
|
366 |
updateCheckedFilters,
|
367 |
] );
|
368 |
|
369 |
-
const multiple =
|
370 |
-
blockAttributes.displayStyle !== 'dropdown' ||
|
371 |
-
blockAttributes.queryType === 'or';
|
372 |
|
373 |
/**
|
374 |
* When a checkbox in the list changes, update state.
|
@@ -464,34 +463,26 @@ const AttributeFilterBlock = ( {
|
|
464 |
);
|
465 |
|
466 |
/**
|
467 |
-
*
|
468 |
-
*
|
469 |
-
* When we render the PHP block template (e.g. Classic Block) we need to set the default checked values,
|
470 |
-
* and also update the URL when the filters are clicked/updated.
|
471 |
*/
|
472 |
useEffect( () => {
|
473 |
-
if (
|
474 |
-
|
475 |
-
|
476 |
-
currentCheckedFilters: checked,
|
477 |
-
hasSetPhpFilterDefaults,
|
478 |
-
} )
|
479 |
-
) {
|
480 |
-
if ( ! blockAttributes.showFilterButton ) {
|
481 |
-
setChecked( [] );
|
482 |
-
redirectPageForPhpTemplate( productAttributesQuery, true );
|
483 |
-
}
|
484 |
-
}
|
485 |
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
|
|
|
|
|
|
|
|
|
|
490 |
}
|
491 |
}, [
|
492 |
-
|
493 |
-
|
494 |
-
filteringForPhpTemplate,
|
495 |
productAttributesQuery,
|
496 |
attributeObject,
|
497 |
checked,
|
@@ -499,32 +490,29 @@ const AttributeFilterBlock = ( {
|
|
499 |
] );
|
500 |
|
501 |
/**
|
502 |
-
*
|
503 |
-
*
|
504 |
-
* When we set the default parameter values which we get from the URL in the above useEffect(),
|
505 |
-
* we need to run updateCheckedFilters which will set these values in state for the Active Filters block.
|
506 |
*/
|
507 |
useEffect( () => {
|
508 |
-
if (
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
}
|
521 |
}
|
522 |
}, [
|
523 |
attributeObject,
|
524 |
-
|
525 |
-
hasSetPhpFilterDefaults,
|
526 |
attributeTermsLoading,
|
527 |
updateCheckedFilters,
|
|
|
|
|
528 |
] );
|
529 |
|
530 |
if ( ! hasFilterableProducts ) {
|
29 |
objectHasProp,
|
30 |
} from '@woocommerce/types';
|
31 |
import {
|
32 |
+
changeUrl,
|
33 |
PREFIX_QUERY_ARG_FILTER_TYPE,
|
34 |
PREFIX_QUERY_ARG_QUERY_TYPE,
|
35 |
} from '@woocommerce/utils';
|
92 |
isString
|
93 |
);
|
94 |
|
95 |
+
const [ hasSetFilterDefaultsFromUrl, setHasSetFilterDefaultsFromUrl ] =
|
96 |
useState( false );
|
97 |
|
98 |
const attributeObject =
|
100 |
? previewAttributeObject
|
101 |
: getAttributeFromID( blockAttributes.attributeId );
|
102 |
|
103 |
+
const initialFilters = useMemo(
|
104 |
+
() => getActiveFilters( attributeObject ),
|
105 |
+
[ attributeObject ]
|
106 |
);
|
107 |
|
108 |
+
const [ checked, setChecked ] = useState( initialFilters );
|
109 |
+
|
110 |
const [ displayedOptions, setDisplayedOptions ] = useState<
|
111 |
DisplayOption[]
|
112 |
>(
|
254 |
* @param {Object} query The object containing the active filter query.
|
255 |
* @param {boolean} allFiltersRemoved If there are active filters or not.
|
256 |
*/
|
257 |
+
const updateFilterUrl = useCallback(
|
258 |
( query, allFiltersRemoved = false ) => {
|
259 |
if ( allFiltersRemoved ) {
|
260 |
if ( ! attributeObject?.taxonomy ) {
|
282 |
);
|
283 |
|
284 |
const newUrl = formatParams( url, query );
|
285 |
+
changeUrl( newUrl );
|
286 |
} else {
|
287 |
const newUrl = formatParams( pageUrl, query );
|
288 |
const currentQueryArgs = getQueryArgs( window.location.href );
|
289 |
const newUrlQueryArgs = getQueryArgs( newUrl );
|
290 |
|
291 |
if ( ! isQueryArgsEqual( currentQueryArgs, newUrlQueryArgs ) ) {
|
292 |
+
changeUrl( newUrl );
|
293 |
}
|
294 |
}
|
295 |
},
|
305 |
blockAttributes.queryType === 'or' ? 'in' : 'and'
|
306 |
);
|
307 |
|
308 |
+
updateFilterUrl( query, checkedFilters.length === 0 );
|
|
|
|
|
|
|
309 |
};
|
310 |
|
311 |
const updateCheckedFilters = useCallback(
|
312 |
+
( checkedFilters: string[], force = false ) => {
|
313 |
if ( isEditor ) {
|
314 |
return;
|
315 |
}
|
316 |
|
317 |
setChecked( checkedFilters );
|
318 |
+
if ( force || ! blockAttributes.showFilterButton ) {
|
319 |
updateAttributeFilter(
|
320 |
productAttributesQuery,
|
321 |
setProductAttributesQuery,
|
367 |
updateCheckedFilters,
|
368 |
] );
|
369 |
|
370 |
+
const multiple = blockAttributes.selectType !== 'single';
|
|
|
|
|
371 |
|
372 |
/**
|
373 |
* When a checkbox in the list changes, update state.
|
463 |
);
|
464 |
|
465 |
/**
|
466 |
+
* Update the filter URL on state change.
|
|
|
|
|
|
|
467 |
*/
|
468 |
useEffect( () => {
|
469 |
+
if ( ! attributeObject || blockAttributes.showFilterButton ) {
|
470 |
+
return;
|
471 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
472 |
|
473 |
+
if (
|
474 |
+
areAllFiltersRemoved( {
|
475 |
+
currentCheckedFilters: checked,
|
476 |
+
hasSetFilterDefaultsFromUrl,
|
477 |
+
} )
|
478 |
+
) {
|
479 |
+
updateFilterUrl( productAttributesQuery, true );
|
480 |
+
} else {
|
481 |
+
updateFilterUrl( productAttributesQuery, false );
|
482 |
}
|
483 |
}, [
|
484 |
+
hasSetFilterDefaultsFromUrl,
|
485 |
+
updateFilterUrl,
|
|
|
486 |
productAttributesQuery,
|
487 |
attributeObject,
|
488 |
checked,
|
490 |
] );
|
491 |
|
492 |
/**
|
493 |
+
* Try get the current attribute filter from the URl.
|
|
|
|
|
|
|
494 |
*/
|
495 |
useEffect( () => {
|
496 |
+
if ( hasSetFilterDefaultsFromUrl || attributeTermsLoading ) {
|
497 |
+
return;
|
498 |
+
}
|
499 |
+
|
500 |
+
if ( initialFilters.length > 0 ) {
|
501 |
+
setHasSetFilterDefaultsFromUrl( true );
|
502 |
+
updateCheckedFilters( initialFilters, true );
|
503 |
+
return;
|
504 |
+
}
|
505 |
+
|
506 |
+
if ( ! filteringForPhpTemplate ) {
|
507 |
+
setHasSetFilterDefaultsFromUrl( true );
|
|
|
508 |
}
|
509 |
}, [
|
510 |
attributeObject,
|
511 |
+
hasSetFilterDefaultsFromUrl,
|
|
|
512 |
attributeTermsLoading,
|
513 |
updateCheckedFilters,
|
514 |
+
initialFilters,
|
515 |
+
filteringForPhpTemplate,
|
516 |
] );
|
517 |
|
518 |
if ( ! hasFilterableProducts ) {
|
assets/js/blocks/attribute-filter/edit.tsx
CHANGED
@@ -51,6 +51,7 @@ const Edit = ( { attributes, setAttributes, debouncedSpeak }: EditProps ) => {
|
|
51 |
queryType,
|
52 |
showCounts,
|
53 |
showFilterButton,
|
|
|
54 |
} = attributes;
|
55 |
|
56 |
const [ isEditing, setIsEditing ] = useState(
|
@@ -214,39 +215,71 @@ const Edit = ( { attributes, setAttributes, debouncedSpeak }: EditProps ) => {
|
|
214 |
>
|
215 |
<ToggleGroupControl
|
216 |
label={ __(
|
217 |
-
'
|
218 |
'woo-gutenberg-products-block'
|
219 |
) }
|
220 |
-
|
221 |
-
queryType === 'and'
|
222 |
-
? __(
|
223 |
-
'Products that have all of the selected attributes will be shown.',
|
224 |
-
'woo-gutenberg-products-block'
|
225 |
-
)
|
226 |
-
: __(
|
227 |
-
'Products that have any of the selected attributes will be shown.',
|
228 |
-
'woo-gutenberg-products-block'
|
229 |
-
)
|
230 |
-
}
|
231 |
-
value={ queryType }
|
232 |
onChange={ ( value: string ) =>
|
233 |
setAttributes( {
|
234 |
-
|
235 |
} )
|
236 |
}
|
237 |
>
|
238 |
<ToggleGroupControlOption
|
239 |
-
value="
|
240 |
label={ __(
|
241 |
-
'
|
242 |
'woo-gutenberg-products-block'
|
243 |
) }
|
244 |
/>
|
245 |
<ToggleGroupControlOption
|
246 |
-
value="
|
247 |
-
label={ __(
|
|
|
|
|
|
|
248 |
/>
|
249 |
</ToggleGroupControl>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
<ToggleGroupControl
|
251 |
label={ __(
|
252 |
'Display Style',
|
51 |
queryType,
|
52 |
showCounts,
|
53 |
showFilterButton,
|
54 |
+
selectType,
|
55 |
} = attributes;
|
56 |
|
57 |
const [ isEditing, setIsEditing ] = useState(
|
215 |
>
|
216 |
<ToggleGroupControl
|
217 |
label={ __(
|
218 |
+
'Allow selecting multiple options?',
|
219 |
'woo-gutenberg-products-block'
|
220 |
) }
|
221 |
+
value={ selectType || 'multiple' }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
222 |
onChange={ ( value: string ) =>
|
223 |
setAttributes( {
|
224 |
+
selectType: value,
|
225 |
} )
|
226 |
}
|
227 |
>
|
228 |
<ToggleGroupControlOption
|
229 |
+
value="multiple"
|
230 |
label={ __(
|
231 |
+
'Multiple',
|
232 |
'woo-gutenberg-products-block'
|
233 |
) }
|
234 |
/>
|
235 |
<ToggleGroupControlOption
|
236 |
+
value="single"
|
237 |
+
label={ __(
|
238 |
+
'Single',
|
239 |
+
'woo-gutenberg-products-block'
|
240 |
+
) }
|
241 |
/>
|
242 |
</ToggleGroupControl>
|
243 |
+
{ selectType === 'multiple' && (
|
244 |
+
<ToggleGroupControl
|
245 |
+
label={ __(
|
246 |
+
'Query Type',
|
247 |
+
'woo-gutenberg-products-block'
|
248 |
+
) }
|
249 |
+
help={
|
250 |
+
queryType === 'and'
|
251 |
+
? __(
|
252 |
+
'Products that have all of the selected attributes will be shown.',
|
253 |
+
'woo-gutenberg-products-block'
|
254 |
+
)
|
255 |
+
: __(
|
256 |
+
'Products that have any of the selected attributes will be shown.',
|
257 |
+
'woo-gutenberg-products-block'
|
258 |
+
)
|
259 |
+
}
|
260 |
+
value={ queryType }
|
261 |
+
onChange={ ( value: string ) =>
|
262 |
+
setAttributes( {
|
263 |
+
queryType: value,
|
264 |
+
} )
|
265 |
+
}
|
266 |
+
>
|
267 |
+
<ToggleGroupControlOption
|
268 |
+
value="and"
|
269 |
+
label={ __(
|
270 |
+
'And',
|
271 |
+
'woo-gutenberg-products-block'
|
272 |
+
) }
|
273 |
+
/>
|
274 |
+
<ToggleGroupControlOption
|
275 |
+
value="or"
|
276 |
+
label={ __(
|
277 |
+
'Or',
|
278 |
+
'woo-gutenberg-products-block'
|
279 |
+
) }
|
280 |
+
/>
|
281 |
+
</ToggleGroupControl>
|
282 |
+
) }
|
283 |
<ToggleGroupControl
|
284 |
label={ __(
|
285 |
'Display Style',
|
assets/js/blocks/attribute-filter/frontend.ts
CHANGED
@@ -26,8 +26,8 @@ const getProps = ( el: HTMLElement ) => {
|
|
26 |
el.dataset.displayStyle ||
|
27 |
metadata.attributes.displayStyle.default,
|
28 |
showFilterButton: el.dataset.showFilterButton === 'true',
|
29 |
-
|
30 |
-
|
31 |
},
|
32 |
};
|
33 |
};
|
26 |
el.dataset.displayStyle ||
|
27 |
metadata.attributes.displayStyle.default,
|
28 |
showFilterButton: el.dataset.showFilterButton === 'true',
|
29 |
+
selectType:
|
30 |
+
el.dataset.selectType || metadata.attributes.selectType.default,
|
31 |
},
|
32 |
};
|
33 |
};
|
assets/js/blocks/attribute-filter/index.tsx
CHANGED
@@ -66,6 +66,7 @@ registerBlockType( metadata, {
|
|
66 |
headingLevel: 3,
|
67 |
displayStyle: instance?.raw?.display_type || 'list',
|
68 |
showFilterButton: false,
|
|
|
69 |
isPreview: false,
|
70 |
} ),
|
71 |
},
|
@@ -83,6 +84,7 @@ registerBlockType( metadata, {
|
|
83 |
headingLevel,
|
84 |
displayStyle,
|
85 |
showFilterButton,
|
|
|
86 |
} = attributes;
|
87 |
const data: Record< string, unknown > = {
|
88 |
'data-attribute-id': attributeId,
|
@@ -97,6 +99,9 @@ registerBlockType( metadata, {
|
|
97 |
if ( showFilterButton ) {
|
98 |
data[ 'data-show-filter-button' ] = showFilterButton;
|
99 |
}
|
|
|
|
|
|
|
100 |
return (
|
101 |
<div
|
102 |
{ ...useBlockProps.save( {
|
66 |
headingLevel: 3,
|
67 |
displayStyle: instance?.raw?.display_type || 'list',
|
68 |
showFilterButton: false,
|
69 |
+
selectType: instance?.raw?.select_type || 'multiple',
|
70 |
isPreview: false,
|
71 |
} ),
|
72 |
},
|
84 |
headingLevel,
|
85 |
displayStyle,
|
86 |
showFilterButton,
|
87 |
+
selectType,
|
88 |
} = attributes;
|
89 |
const data: Record< string, unknown > = {
|
90 |
'data-attribute-id': attributeId,
|
99 |
if ( showFilterButton ) {
|
100 |
data[ 'data-show-filter-button' ] = showFilterButton;
|
101 |
}
|
102 |
+
if ( selectType === 'single' ) {
|
103 |
+
data[ 'data-select-type' ] = selectType;
|
104 |
+
}
|
105 |
return (
|
106 |
<div
|
107 |
{ ...useBlockProps.save( {
|
assets/js/blocks/attribute-filter/types.ts
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
import type { BlockEditProps } from '@wordpress/blocks';
|
5 |
|
6 |
export interface BlockAttributes {
|
7 |
-
className
|
8 |
attributeId: number;
|
9 |
showCounts: boolean;
|
10 |
queryType: string;
|
@@ -12,7 +12,8 @@ export interface BlockAttributes {
|
|
12 |
headingLevel: number;
|
13 |
displayStyle: string;
|
14 |
showFilterButton: boolean;
|
15 |
-
|
|
|
16 |
}
|
17 |
|
18 |
export interface EditProps extends BlockEditProps< BlockAttributes > {
|
4 |
import type { BlockEditProps } from '@wordpress/blocks';
|
5 |
|
6 |
export interface BlockAttributes {
|
7 |
+
className?: string;
|
8 |
attributeId: number;
|
9 |
showCounts: boolean;
|
10 |
queryType: string;
|
12 |
headingLevel: number;
|
13 |
displayStyle: string;
|
14 |
showFilterButton: boolean;
|
15 |
+
selectType: string;
|
16 |
+
isPreview?: boolean;
|
17 |
}
|
18 |
|
19 |
export interface EditProps extends BlockEditProps< BlockAttributes > {
|
assets/js/blocks/attribute-filter/utils.ts
CHANGED
@@ -44,17 +44,16 @@ export const formatParams = ( url: string, params: Array< Param > = [] ) => {
|
|
44 |
|
45 |
export const areAllFiltersRemoved = ( {
|
46 |
currentCheckedFilters,
|
47 |
-
|
48 |
}: {
|
49 |
currentCheckedFilters: Array< string >;
|
50 |
-
|
51 |
-
} ) =>
|
52 |
|
53 |
export const getActiveFilters = (
|
54 |
-
isFilteringForPhpTemplateEnabled: boolean,
|
55 |
attributeObject: AttributeObject | undefined
|
56 |
) => {
|
57 |
-
if (
|
58 |
const defaultAttributeParam = getUrlParameter(
|
59 |
`filter_${ attributeObject.name }`
|
60 |
);
|
44 |
|
45 |
export const areAllFiltersRemoved = ( {
|
46 |
currentCheckedFilters,
|
47 |
+
hasSetFilterDefaultsFromUrl,
|
48 |
}: {
|
49 |
currentCheckedFilters: Array< string >;
|
50 |
+
hasSetFilterDefaultsFromUrl: boolean;
|
51 |
+
} ) => hasSetFilterDefaultsFromUrl && currentCheckedFilters.length === 0;
|
52 |
|
53 |
export const getActiveFilters = (
|
|
|
54 |
attributeObject: AttributeObject | undefined
|
55 |
) => {
|
56 |
+
if ( attributeObject ) {
|
57 |
const defaultAttributeParam = getUrlParameter(
|
58 |
`filter_${ attributeObject.name }`
|
59 |
);
|
assets/js/blocks/price-filter/block.tsx
CHANGED
@@ -14,6 +14,7 @@ import PropTypes from 'prop-types';
|
|
14 |
import { getCurrencyFromPriceResponse } from '@woocommerce/price-format';
|
15 |
import { getSettingWithCoercion } from '@woocommerce/settings';
|
16 |
import { addQueryArgs, removeQueryArgs } from '@wordpress/url';
|
|
|
17 |
import {
|
18 |
CurrencyResponse,
|
19 |
isBoolean,
|
@@ -25,7 +26,6 @@ import {
|
|
25 |
* Internal dependencies
|
26 |
*/
|
27 |
import usePriceConstraints from './use-price-constraints';
|
28 |
-
import { getUrlParameter } from '../../utils/filters';
|
29 |
import './style.scss';
|
30 |
import { Attributes } from './types';
|
31 |
|
@@ -96,11 +96,7 @@ const PriceFilterBlock = ( {
|
|
96 |
isBoolean
|
97 |
);
|
98 |
|
99 |
-
|
100 |
-
* Important: Only used on the PHP rendered Block pages to track
|
101 |
-
* the price filter defaults coming from the URL
|
102 |
-
*/
|
103 |
-
const [ hasSetPhpFilterDefaults, setHasSetPhpFilterDefaults ] =
|
104 |
useState( false );
|
105 |
|
106 |
const minPriceParam = getUrlParameter( 'min_price' );
|
@@ -117,14 +113,10 @@ const PriceFilterBlock = ( {
|
|
117 |
: undefined
|
118 |
);
|
119 |
|
120 |
-
const [ minPriceQuery, setMinPriceQuery ] =
|
121 |
-
'min_price'
|
122 |
-
|
123 |
-
|
124 |
-
const [ maxPriceQuery, setMaxPriceQuery ] = useQueryStateByKey(
|
125 |
-
'max_price',
|
126 |
-
formatPrice( maxPriceParam, currency.minorUnit ) || null
|
127 |
-
);
|
128 |
|
129 |
const [ minPrice, setMinPrice ] = useState(
|
130 |
formatPrice( minPriceParam, currency.minorUnit ) || null
|
@@ -150,14 +142,10 @@ const PriceFilterBlock = ( {
|
|
150 |
} );
|
151 |
|
152 |
/**
|
153 |
-
*
|
154 |
-
*
|
155 |
-
* When we render the PHP block template (e.g. Classic Block) we need
|
156 |
-
* to set the default min_price and max_price values from the URL
|
157 |
-
* for the filter to work alongside the Active Filters block.
|
158 |
*/
|
159 |
useEffect( () => {
|
160 |
-
if ( !
|
161 |
setMinPriceQuery(
|
162 |
formatPrice( minPriceParam, currency.minorUnit )
|
163 |
);
|
@@ -165,12 +153,11 @@ const PriceFilterBlock = ( {
|
|
165 |
formatPrice( maxPriceParam, currency.minorUnit )
|
166 |
);
|
167 |
|
168 |
-
|
169 |
}
|
170 |
}, [
|
171 |
currency.minorUnit,
|
172 |
-
|
173 |
-
hasSetPhpFilterDefaults,
|
174 |
maxPriceParam,
|
175 |
minPriceParam,
|
176 |
setMaxPriceQuery,
|
@@ -189,27 +176,26 @@ const PriceFilterBlock = ( {
|
|
189 |
? undefined
|
190 |
: newMinPrice;
|
191 |
|
192 |
-
|
193 |
-
if ( filteringForPhpTemplate && window ) {
|
194 |
const newUrl = formatParams( window.location.href, {
|
195 |
min_price: finalMinPrice / 10 ** currency.minorUnit,
|
196 |
max_price: finalMaxPrice / 10 ** currency.minorUnit,
|
197 |
} );
|
198 |
-
|
|
|
199 |
if ( window.location.href !== newUrl ) {
|
200 |
-
|
201 |
}
|
202 |
-
} else {
|
203 |
-
setMinPriceQuery( finalMinPrice );
|
204 |
-
setMaxPriceQuery( finalMaxPrice );
|
205 |
}
|
|
|
|
|
|
|
206 |
},
|
207 |
[
|
208 |
minConstraint,
|
209 |
maxConstraint,
|
210 |
setMinPriceQuery,
|
211 |
setMaxPriceQuery,
|
212 |
-
filteringForPhpTemplate,
|
213 |
currency.minorUnit,
|
214 |
]
|
215 |
);
|
@@ -229,7 +215,7 @@ const PriceFilterBlock = ( {
|
|
229 |
|
230 |
if (
|
231 |
filteringForPhpTemplate &&
|
232 |
-
|
233 |
! attributes.showFilterButton
|
234 |
) {
|
235 |
debouncedUpdateQuery( prices[ 0 ], prices[ 1 ] );
|
@@ -241,7 +227,7 @@ const PriceFilterBlock = ( {
|
|
241 |
setMinPrice,
|
242 |
setMaxPrice,
|
243 |
filteringForPhpTemplate,
|
244 |
-
|
245 |
debouncedUpdateQuery,
|
246 |
attributes.showFilterButton,
|
247 |
]
|
14 |
import { getCurrencyFromPriceResponse } from '@woocommerce/price-format';
|
15 |
import { getSettingWithCoercion } from '@woocommerce/settings';
|
16 |
import { addQueryArgs, removeQueryArgs } from '@wordpress/url';
|
17 |
+
import { changeUrl, getUrlParameter } from '@woocommerce/utils';
|
18 |
import {
|
19 |
CurrencyResponse,
|
20 |
isBoolean,
|
26 |
* Internal dependencies
|
27 |
*/
|
28 |
import usePriceConstraints from './use-price-constraints';
|
|
|
29 |
import './style.scss';
|
30 |
import { Attributes } from './types';
|
31 |
|
96 |
isBoolean
|
97 |
);
|
98 |
|
99 |
+
const [ hasSetFilterDefaultsFromUrl, setHasSetFilterDefaultsFromUrl ] =
|
|
|
|
|
|
|
|
|
100 |
useState( false );
|
101 |
|
102 |
const minPriceParam = getUrlParameter( 'min_price' );
|
113 |
: undefined
|
114 |
);
|
115 |
|
116 |
+
const [ minPriceQuery, setMinPriceQuery ] =
|
117 |
+
useQueryStateByKey( 'min_price' );
|
118 |
+
const [ maxPriceQuery, setMaxPriceQuery ] =
|
119 |
+
useQueryStateByKey( 'max_price' );
|
|
|
|
|
|
|
|
|
120 |
|
121 |
const [ minPrice, setMinPrice ] = useState(
|
122 |
formatPrice( minPriceParam, currency.minorUnit ) || null
|
142 |
} );
|
143 |
|
144 |
/**
|
145 |
+
* Try get the min and/or max price from the URL.
|
|
|
|
|
|
|
|
|
146 |
*/
|
147 |
useEffect( () => {
|
148 |
+
if ( ! hasSetFilterDefaultsFromUrl ) {
|
149 |
setMinPriceQuery(
|
150 |
formatPrice( minPriceParam, currency.minorUnit )
|
151 |
);
|
153 |
formatPrice( maxPriceParam, currency.minorUnit )
|
154 |
);
|
155 |
|
156 |
+
setHasSetFilterDefaultsFromUrl( true );
|
157 |
}
|
158 |
}, [
|
159 |
currency.minorUnit,
|
160 |
+
hasSetFilterDefaultsFromUrl,
|
|
|
161 |
maxPriceParam,
|
162 |
minPriceParam,
|
163 |
setMaxPriceQuery,
|
176 |
? undefined
|
177 |
: newMinPrice;
|
178 |
|
179 |
+
if ( window ) {
|
|
|
180 |
const newUrl = formatParams( window.location.href, {
|
181 |
min_price: finalMinPrice / 10 ** currency.minorUnit,
|
182 |
max_price: finalMaxPrice / 10 ** currency.minorUnit,
|
183 |
} );
|
184 |
+
|
185 |
+
// If the params have changed, lets update the filter URL.
|
186 |
if ( window.location.href !== newUrl ) {
|
187 |
+
changeUrl( newUrl );
|
188 |
}
|
|
|
|
|
|
|
189 |
}
|
190 |
+
|
191 |
+
setMinPriceQuery( finalMinPrice );
|
192 |
+
setMaxPriceQuery( finalMaxPrice );
|
193 |
},
|
194 |
[
|
195 |
minConstraint,
|
196 |
maxConstraint,
|
197 |
setMinPriceQuery,
|
198 |
setMaxPriceQuery,
|
|
|
199 |
currency.minorUnit,
|
200 |
]
|
201 |
);
|
215 |
|
216 |
if (
|
217 |
filteringForPhpTemplate &&
|
218 |
+
hasSetFilterDefaultsFromUrl &&
|
219 |
! attributes.showFilterButton
|
220 |
) {
|
221 |
debouncedUpdateQuery( prices[ 0 ], prices[ 1 ] );
|
227 |
setMinPrice,
|
228 |
setMaxPrice,
|
229 |
filteringForPhpTemplate,
|
230 |
+
hasSetFilterDefaultsFromUrl,
|
231 |
debouncedUpdateQuery,
|
232 |
attributes.showFilterButton,
|
233 |
]
|
assets/js/blocks/stock-filter/block.tsx
CHANGED
@@ -24,7 +24,7 @@ import isShallowEqual from '@wordpress/is-shallow-equal';
|
|
24 |
import { decodeEntities } from '@wordpress/html-entities';
|
25 |
import { isBoolean, objectHasProp } from '@woocommerce/types';
|
26 |
import { addQueryArgs, removeQueryArgs } from '@wordpress/url';
|
27 |
-
import { PREFIX_QUERY_ARG_FILTER_TYPE } from '@woocommerce/utils';
|
28 |
|
29 |
/**
|
30 |
* Internal dependencies
|
@@ -56,7 +56,7 @@ const StockStatusFilterBlock = ( {
|
|
56 |
isBoolean
|
57 |
);
|
58 |
|
59 |
-
const [
|
60 |
useState( false );
|
61 |
|
62 |
const { outofstock, ...otherStockStatusOptions } = getSetting(
|
@@ -70,9 +70,12 @@ const StockStatusFilterBlock = ( {
|
|
70 |
: { outofstock, ...otherStockStatusOptions }
|
71 |
);
|
72 |
|
73 |
-
const
|
74 |
-
getActiveFilters( STOCK_STATUS_OPTIONS.current, QUERY_PARAM_KEY )
|
|
|
75 |
);
|
|
|
|
|
76 |
const [ displayedOptions, setDisplayedOptions ] = useState(
|
77 |
blockAttributes.isPreview ? previewOptions : []
|
78 |
);
|
@@ -86,7 +89,7 @@ const StockStatusFilterBlock = ( {
|
|
86 |
|
87 |
const [ queryState ] = useQueryStateByContext();
|
88 |
const [ productStockStatusQuery, setProductStockStatusQuery ] =
|
89 |
-
useQueryStateByKey( 'stock_status',
|
90 |
|
91 |
const { results: filteredCounts, isLoading: filteredCountsLoading } =
|
92 |
useCollectionData( {
|
@@ -179,7 +182,10 @@ const StockStatusFilterBlock = ( {
|
|
179 |
*
|
180 |
* @param {Array} checkedOptions Array of checked stock options.
|
181 |
*/
|
182 |
-
const
|
|
|
|
|
|
|
183 |
if ( checkedOptions.length === 0 ) {
|
184 |
const url = removeQueryArgs(
|
185 |
window.location.href,
|
@@ -187,8 +193,9 @@ const StockStatusFilterBlock = ( {
|
|
187 |
);
|
188 |
|
189 |
if ( url !== window.location.href ) {
|
190 |
-
|
191 |
}
|
|
|
192 |
return;
|
193 |
}
|
194 |
|
@@ -196,9 +203,11 @@ const StockStatusFilterBlock = ( {
|
|
196 |
[ QUERY_PARAM_KEY ]: checkedOptions.join( ',' ),
|
197 |
} );
|
198 |
|
199 |
-
if ( newUrl
|
200 |
-
|
201 |
}
|
|
|
|
|
202 |
};
|
203 |
|
204 |
const onSubmit = useCallback(
|
@@ -206,13 +215,11 @@ const StockStatusFilterBlock = ( {
|
|
206 |
if ( isEditor ) {
|
207 |
return;
|
208 |
}
|
209 |
-
if ( isChecked ) {
|
210 |
setProductStockStatusQuery( checked );
|
211 |
}
|
212 |
-
|
213 |
-
|
214 |
-
redirectPageForPhpTemplate( checked );
|
215 |
-
}
|
216 |
},
|
217 |
[
|
218 |
isEditor,
|
@@ -246,32 +253,18 @@ const StockStatusFilterBlock = ( {
|
|
246 |
}, [ checked, currentCheckedQuery, previousCheckedQuery ] );
|
247 |
|
248 |
/**
|
249 |
-
*
|
250 |
*/
|
251 |
useEffect( () => {
|
252 |
-
if (
|
253 |
-
|
254 |
-
|
255 |
-
}, [ filteringForPhpTemplate, checked ] );
|
256 |
-
|
257 |
-
/**
|
258 |
-
* Important: For PHP rendered block templates only.
|
259 |
-
*/
|
260 |
-
useEffect( () => {
|
261 |
-
if ( ! hasSetPhpFilterDefaults && filteringForPhpTemplate ) {
|
262 |
-
setProductStockStatusQuery(
|
263 |
-
getActiveFilters(
|
264 |
-
STOCK_STATUS_OPTIONS.current,
|
265 |
-
QUERY_PARAM_KEY
|
266 |
-
)
|
267 |
-
);
|
268 |
-
setHasSetPhpFilterDefaults( true );
|
269 |
}
|
270 |
}, [
|
271 |
-
filteringForPhpTemplate,
|
272 |
setProductStockStatusQuery,
|
273 |
-
|
274 |
-
|
|
|
275 |
] );
|
276 |
|
277 |
/**
|
24 |
import { decodeEntities } from '@wordpress/html-entities';
|
25 |
import { isBoolean, objectHasProp } from '@woocommerce/types';
|
26 |
import { addQueryArgs, removeQueryArgs } from '@wordpress/url';
|
27 |
+
import { changeUrl, PREFIX_QUERY_ARG_FILTER_TYPE } from '@woocommerce/utils';
|
28 |
|
29 |
/**
|
30 |
* Internal dependencies
|
56 |
isBoolean
|
57 |
);
|
58 |
|
59 |
+
const [ hasSetFilterDefaultsFromUrl, setHasSetFilterDefaultsFromUrl ] =
|
60 |
useState( false );
|
61 |
|
62 |
const { outofstock, ...otherStockStatusOptions } = getSetting(
|
70 |
: { outofstock, ...otherStockStatusOptions }
|
71 |
);
|
72 |
|
73 |
+
const initialFilters = useMemo(
|
74 |
+
() => getActiveFilters( STOCK_STATUS_OPTIONS.current, QUERY_PARAM_KEY ),
|
75 |
+
[]
|
76 |
);
|
77 |
+
|
78 |
+
const [ checked, setChecked ] = useState( initialFilters );
|
79 |
const [ displayedOptions, setDisplayedOptions ] = useState(
|
80 |
blockAttributes.isPreview ? previewOptions : []
|
81 |
);
|
89 |
|
90 |
const [ queryState ] = useQueryStateByContext();
|
91 |
const [ productStockStatusQuery, setProductStockStatusQuery ] =
|
92 |
+
useQueryStateByKey( 'stock_status', initialFilters );
|
93 |
|
94 |
const { results: filteredCounts, isLoading: filteredCountsLoading } =
|
95 |
useCollectionData( {
|
182 |
*
|
183 |
* @param {Array} checkedOptions Array of checked stock options.
|
184 |
*/
|
185 |
+
const updateFilterUrl = ( checkedOptions: string[] ) => {
|
186 |
+
if ( ! window ) {
|
187 |
+
return;
|
188 |
+
}
|
189 |
if ( checkedOptions.length === 0 ) {
|
190 |
const url = removeQueryArgs(
|
191 |
window.location.href,
|
193 |
);
|
194 |
|
195 |
if ( url !== window.location.href ) {
|
196 |
+
changeUrl( url );
|
197 |
}
|
198 |
+
|
199 |
return;
|
200 |
}
|
201 |
|
203 |
[ QUERY_PARAM_KEY ]: checkedOptions.join( ',' ),
|
204 |
} );
|
205 |
|
206 |
+
if ( newUrl === window.location.href ) {
|
207 |
+
return;
|
208 |
}
|
209 |
+
|
210 |
+
changeUrl( newUrl );
|
211 |
};
|
212 |
|
213 |
const onSubmit = useCallback(
|
215 |
if ( isEditor ) {
|
216 |
return;
|
217 |
}
|
218 |
+
if ( isChecked && ! filteringForPhpTemplate ) {
|
219 |
setProductStockStatusQuery( checked );
|
220 |
}
|
221 |
+
|
222 |
+
updateFilterUrl( checked );
|
|
|
|
|
223 |
},
|
224 |
[
|
225 |
isEditor,
|
253 |
}, [ checked, currentCheckedQuery, previousCheckedQuery ] );
|
254 |
|
255 |
/**
|
256 |
+
* Try get the stock filter from the URL.
|
257 |
*/
|
258 |
useEffect( () => {
|
259 |
+
if ( ! hasSetFilterDefaultsFromUrl ) {
|
260 |
+
setProductStockStatusQuery( initialFilters );
|
261 |
+
setHasSetFilterDefaultsFromUrl( true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
}
|
263 |
}, [
|
|
|
264 |
setProductStockStatusQuery,
|
265 |
+
hasSetFilterDefaultsFromUrl,
|
266 |
+
setHasSetFilterDefaultsFromUrl,
|
267 |
+
initialFilters,
|
268 |
] );
|
269 |
|
270 |
/**
|
assets/js/hocs/with-product-variations.js
CHANGED
@@ -124,7 +124,7 @@ const withProductVariations = createHigherOrderComponent(
|
|
124 |
p.variations &&
|
125 |
p.variations.find( ( { id } ) => id === variationId )
|
126 |
);
|
127 |
-
return parentProduct[ 0 ]
|
128 |
}
|
129 |
|
130 |
getExpandedProduct() {
|
124 |
p.variations &&
|
125 |
p.variations.find( ( { id } ) => id === variationId )
|
126 |
);
|
127 |
+
return parentProduct[ 0 ]?.id;
|
128 |
}
|
129 |
|
130 |
getExpandedProduct() {
|
assets/js/utils/filters.ts
CHANGED
@@ -2,6 +2,14 @@
|
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { getQueryArg } from '@wordpress/url';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
/**
|
7 |
* Returns specified parameter from URL
|
@@ -18,3 +26,16 @@ export function getUrlParameter( name: string ) {
|
|
18 |
}
|
19 |
return getQueryArg( window.location.href, name );
|
20 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
* External dependencies
|
3 |
*/
|
4 |
import { getQueryArg } from '@wordpress/url';
|
5 |
+
import { getSettingWithCoercion } from '@woocommerce/settings';
|
6 |
+
import { isBoolean } from '@woocommerce/types';
|
7 |
+
|
8 |
+
const filteringForPhpTemplate = getSettingWithCoercion(
|
9 |
+
'is_rendering_php_template',
|
10 |
+
false,
|
11 |
+
isBoolean
|
12 |
+
);
|
13 |
|
14 |
/**
|
15 |
* Returns specified parameter from URL
|
26 |
}
|
27 |
return getQueryArg( window.location.href, name );
|
28 |
}
|
29 |
+
|
30 |
+
/**
|
31 |
+
* Change the URL and reload the page if filtering for PHP templates.
|
32 |
+
*
|
33 |
+
* @param {string} newUrl New URL to be set.
|
34 |
+
*/
|
35 |
+
export function changeUrl( newUrl: string ) {
|
36 |
+
if ( filteringForPhpTemplate ) {
|
37 |
+
window.location.href = newUrl;
|
38 |
+
} else {
|
39 |
+
window.history.replaceState( {}, '', newUrl );
|
40 |
+
}
|
41 |
+
}
|
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' => '
|
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' => 'd9823c31fefdba9f900c7fb9925b703c');
|
build/active-filters-frontend.js
CHANGED
@@ -1,8 +1,8 @@
|
|
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=227)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},
|
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:s,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||s()}},
|
6 |
/* translators: %1$s min price, %2$s max price */
|
7 |
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)(
|
8 |
/* translators: %s min price */
|
@@ -10,6 +10,6 @@ Object(c.__)("From %s","woo-gutenberg-products-block"),Object(g.formatPrice)(e))
|
|
10 |
/* translators: %s max price */
|
11 |
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)(
|
12 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
13 |
-
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"},l,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}))))},w=function(){const e=window.location.href,t=Object(
|
14 |
/* translators: %s is referring to the average rating value */
|
15 |
-
Object(c.__)("Rated %s out of 5","woo-gutenberg-products-block"),e),removeCallback:()=>{if(n)return w({rating_filter:e});const t=
|
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=227)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},101:function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return c}));var n=r(4);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}},105: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})}},110: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},121:function(e,t){},124: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(15),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.isShallowEqual},135: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.primitives},15:function(e,t){e.exports=window.wp.url},16:function(e,t,r){"use strict";var n=r(19),o=r.n(n),c=r(0),s=r(3),a=r(1),i=r(46),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(34);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},18:function(e,t){e.exports=window.wp.htmlEntities},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";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}},200:function(e,t,r){"use strict";var n=r(0),o=r(14);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:"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=c},204:function(e,t,r){"use strict";var n=r(12),o=r.n(n),c=r(0),s=r(5),a=r.n(s),i=r(1),l=r(105),u=r(200);r(121);var b=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: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?
|
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:s,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||s()}},j=p?O:{},y=p?{"aria-hidden":!0}:O;return Object(c.createElement)(b,o()({},m,j,{className:a()(r,"is-removable"),element:p?"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:u.a,size:16})))}},220:function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return a}));var n=r(20);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)},227:function(e,t,r){e.exports=r(246)},228:function(e,t){},246:function(e,t,r){"use strict";r.r(t);var n=r(51),o=r(0),c=r(1),s=r(39),a=r(2),i=r(5),l=r.n(i),u=r(26),b=r(78),p=r(20),d=r(220),f=r(124),m=(r(228),r(110)),g=r(41),O=r(204),j=r(15);const y=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(c.sprintf)(
|
6 |
/* translators: %1$s min price, %2$s max price */
|
7 |
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)(
|
8 |
/* translators: %s min price */
|
10 |
/* translators: %s max price */
|
11 |
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)(
|
12 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
13 |
+
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"},l,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}))))},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(63),v=r(18),E=r(101),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(135);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)(
|
14 |
/* translators: %s is referring to the average rating value */
|
15 |
+
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})})},26:function(e,t,r){"use strict";var n=r(0),o=r(5),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))}},27: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.React},32:function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0),o=r(13),c=r.n(o);function s(e){const t=Object(n.useRef)(e);return c()(e,t.current)||(t.current=e),t.current}},34: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(8),c=r(0),s=r(13),a=r.n(s),i=r(32),l=r(60),u=r(27);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){e.exports=window.lodash},41:function(e,t){e.exports=window.wc.priceFormat},46: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,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)}()},51: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(16);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},60:function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(3);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}},63:function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=r(6),o=r(8),c=r(0),s=r(32),a=r(74);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}},74: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},8:function(e,t){e.exports=window.wp.data}});
|
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' => '
|
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' => '67ca94f882c55c7e8383b1dc64ce7e52');
|
build/active-filters.js
CHANGED
@@ -1,10 +1,10 @@
|
|
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={6: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([431,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},102: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)(
|
2 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
3 |
-
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},11:function(e,t){e.exports=window.wp.primitives},111:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(8);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}},122:function(e,t,r){"use strict";var n=r(0),c=r(5),o=r(10),l=r(1);r(
|
4 |
/* translators: Remove chip. */
|
5 |
Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
|
6 |
/* translators: %s text of the chip to remove. */
|
7 |
-
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})))}},244:function(e,t,r){"use strict";r.d(t,"a",(function(){return
|
8 |
/* translators: %1$s min price, %2$s max price */
|
9 |
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)(
|
10 |
/* translators: %s min price */
|
@@ -12,6 +12,6 @@ Object(l.__)("From %s","woo-gutenberg-products-block"),Object(E.formatPrice)(e))
|
|
12 |
/* translators: %s max price */
|
13 |
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)(
|
14 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
15 |
-
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"},a,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=function(){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}))
|
16 |
/* translators: %s is referring to the average rating value */
|
17 |
-
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:()=>{
|
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={6: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([431,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},102: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)(
|
2 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
3 |
+
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},11:function(e,t){e.exports=window.wp.primitives},111:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(8);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}},122:function(e,t,r){"use strict";var n=r(0),c=r(5),o=r(10),l=r(1);r(156),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(18),c=r(9),o=r(0),l=r(50),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}},13:function(e,t){e.exports=window.wp.blocks},14:function(e,t){e.exports=window.wp.htmlEntities},156:function(e,t){},157:function(e,t){},16:function(e,t){e.exports=window.wp.url},162:function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"boolean"==typeof e},170: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}},18:function(e,t){e.exports=window.wc.wcBlocksData},2:function(e,t){e.exports=window.wc.wcSettings},201: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)}},212: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(115),u=r(551);r(157);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?
|
4 |
/* translators: Remove chip. */
|
5 |
Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
|
6 |
/* translators: %s text of the chip to remove. */
|
7 |
+
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})))}},244: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(16),c=r(2),o=r(162);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)}},25:function(e,t){e.exports=window.wp.isShallowEqual},27:function(e,t){e.exports=window.wc.priceFormat},273: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},30: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))}},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}},423: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)},431:function(e,t,r){e.exports=r(491)},432:function(e,t){},491: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(13),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(115),b=r(4),p=r.n(b),d=r(5),m=r(102),f=r(122),g=r(3),O=r(76),j=r(2),h=r(30),v=r(162),w=r(35),y=r(423),_=r(244),k=(r(432),r(201)),E=r(27),x=r(212),S=r(16);const C=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)?Object(l.sprintf)(
|
8 |
/* translators: %1$s min price, %2$s max price */
|
9 |
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)(
|
10 |
/* translators: %s min price */
|
12 |
/* translators: %s max price */
|
13 |
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)(
|
14 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
15 |
+
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"},a,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=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(170),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)(
|
16 |
/* translators: %s is referring to the average rating value */
|
17 |
+
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")}))))},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.__)("Block 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})},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(273);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"}))}})},5:function(e,t){e.exports=window.wp.blockEditor},50:function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(0),c=r(25),o=r.n(c);function l(e){const t=Object(n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},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},76: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(18),c=r(9),o=r(0),l=r(25),i=r.n(l),s=r(50),a=r(111),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.React},9:function(e,t){e.exports=window.wp.data}});
|
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' => '
|
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' => '474915677cdcc10eabc3861e4c60bcef');
|
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:"1d36f73838f02eb72b0e",1:"cc9016fd3805a088b2e8",58:"1183ebd06ff9ce0807a3",59:"428819e3910f82cf88df",60:"d661fd1a2414c5df92e5",61:"a93336ad5a4f78393e16",62:"5ee407aec5f3e4e87824",63:"55e38930640252d3af8e",64:"731a7688ea9757432368",65:"4801f2c3254f98af0306",66:"260b8a85642edfab8536",67:"7e5ba67a415e2a6e4b78",68:"7a3a7a8ff8f6bda909e2",69:"162305606f780906a834",74:"4f97a2cdac956338218b"}[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=211)}([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.React},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.wc.wcBlocksData},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.data},,,function(e,t){e.exports=window.wp.compose},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.isShallowEqual},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(3),s=r(1),a=r(46),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(34);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){e.exports=window.wp.a11y},function(e,t,r){"use strict";(function(e){var n=r(0);r(36);const o=Object(n.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,r(54))},function(e,t){e.exports=window.wp.deprecated},,function(e,t,r){"use strict";var n=r(0),o=r(5),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,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(8);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(13),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(4),o=r(0),c=r(6),i=r(8),s=r(18),a=r(117),l=r(29),u=r(69);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){},,function(e,t){e.exports=window.wp.warning},function(e,t,r){"use strict";var n=r(7),o=r(0),c=r(14),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";var n=r(5),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,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(8),c=r(0),i=r(13),s=r.n(i),a=r(32),l=r(60),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){e.exports=window.wp.hooks},function(e,t,r){"use strict";var n=r(7),o=r(0),c=r(5),i=r.n(c),s=r(4),a=r(23),l=r.n(a),u=r(11),d=r(44),p=r(70),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(22);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(13),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(37),U=r(38);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.dom},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(71),i=r(52);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(16);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,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},,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(42),o=r(0),c=r(33);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(3);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(8),c=r(0),i=r(32),s=r(74);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(14);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){e.exports=window.wp.blockEditor},,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(106);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(4),c=r(5),i=r.n(c),s=r(1),a=r(21),l=r(70),u=r(43);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(5),c=r.n(o),i=r(25),s=r(11);r(123),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.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(47),o=(r(15),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(5),s=r.n(i),a=r(77),l=r(8),u=(r(80),r(59));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(17),o=r(0),c=r(46);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,404)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>r.e(61).then(r.bind(null,448)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>r.e(69).then(r.bind(null,449)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>r.e(63).then(r.bind(null,405)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>r.e(59).then(r.bind(null,406)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>r.e(67).then(r.bind(null,407)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>r.e(64).then(r.bind(null,317)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>r.e(65).then(r.bind(null,408)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>r.e(60).then(r.bind(null,409)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>r.e(68).then(r.bind(null,410)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>r.e(66).then(r.bind(null,411)))}),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,431)))});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(59),c=r(51),i=r(3),s=r(1),a=r(4),l=r(5),u=r.n(l),d=r(25);r(214);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(60),m=r(39),f=r(63),g=r(6),h=r(8),E=r(32);var O=r(58),w=r(75),j=r(45),v=r(21),y=r(
|
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:D+"__products"},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(
|
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:"1d36f73838f02eb72b0e",1:"90165bb62acb98a96150",58:"4bd032cdf8f5657b278c",59:"3ade01cc89344deaa207",60:"8ea20f1324ed15d07ee9",61:"5aef459e4edf0bf12ea6",62:"2247bdd464e35476ea74",63:"6c1a7cc06af6805d06c2",64:"01e5e17617f8ba2862c5",65:"4feb23e804c8c1ddec9a",66:"89d22d66bc1c89cc4319",67:"f9e4858129cafc8ed6e4",68:"372ccd7eea135b86c681",69:"325df81703436d820ed2",74:"4f97a2cdac956338218b"}[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=211)}([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.React},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.wc.wcBlocksData},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.data},,,function(e,t){e.exports=window.wp.compose},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.isShallowEqual},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(3),s=r(1),a=r(46),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(34);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){e.exports=window.wp.a11y},function(e,t,r){"use strict";(function(e){var n=r(0);r(36);const o=Object(n.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,r(54))},,function(e,t){e.exports=window.wp.deprecated},,function(e,t,r){"use strict";var n=r(0),o=r(5),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,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(8);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(13),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(4),o=r(0),c=r(6),i=r(8),s=r(18),a=r(118),l=r(29),u=r(69);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){},,function(e,t){e.exports=window.wp.warning},function(e,t,r){"use strict";var n=r(7),o=r(0),c=r(14),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";var n=r(5),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,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(8),c=r(0),i=r(13),s=r.n(i),a=r(32),l=r(60),u=r(27);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){e.exports=window.wp.hooks},function(e,t,r){"use strict";var n=r(7),o=r(0),c=r(5),i=r.n(c),s=r(4),a=r(24),l=r.n(a),u=r(11),d=r(44),p=r(70),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(22);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(13),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(37),U=r(38);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.dom},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(71),i=r(52);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(16);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,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},,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(42),o=r(0),c=r(33);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(3);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(8),c=r(0),i=r(32),s=r(74);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(14);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){e.exports=window.wp.blockEditor},,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(107);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(4),c=r(5),i=r.n(c),s=r(1),a=r(21),l=r(70),u=r(43);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(5),c=r.n(o),i=r(26),s=r(11);r(122),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.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(47),o=(r(15),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(5),s=r.n(i),a=r(77),l=r(8),u=(r(81),r(59));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(17),o=r(0),c=r(46);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,404)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>r.e(61).then(r.bind(null,448)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>r.e(69).then(r.bind(null,449)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>r.e(63).then(r.bind(null,405)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-button",component:Object(o.lazy)(()=>r.e(59).then(r.bind(null,406)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>r.e(67).then(r.bind(null,407)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>r.e(64).then(r.bind(null,317)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>r.e(65).then(r.bind(null,408)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>r.e(60).then(r.bind(null,409)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>r.e(68).then(r.bind(null,410)))}),Object(n.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>r.e(66).then(r.bind(null,411)))}),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,431)))});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(59),c=r(51),i=r(3),s=r(1),a=r(4),l=r(5),u=r.n(l),d=r(26);r(214);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(60),m=r(39),f=r(63),g=r(6),h=r(8),E=r(32);var O=r(58),w=r(75),j=r(45),v=r(21),y=r(105),_=r(14),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(109);r(213);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(11),T=r(12),L=r.n(T),B=r(133);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(212);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:D+"__products"},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(123);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' => '
|
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' => 'f996135484b8bc426356a6534ead31c2');
|
build/all-products.js
CHANGED
@@ -1,23 +1,23 @@
|
|
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={7:0,1:0,2:0,3:0,4:0,5:0,21:0,24:0,28:0,29:0,31:0,32:0,33:0,35: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-add-to-cart--product-button--product-image--product-title",4:"product-add-to-cart--product-button",5:"product-sale-badge",19:"product-add-to-cart",21:"product-button",24:"product-category-list",25:"product-image",28:"product-price",29:"product-rating",31:"product-sku",32:"product-stock-indicator",33:"product-summary",35:"product-tag-list",36:"product-title"}[e]||e)+".js?ver="+{1:"
|
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,c)=>0===c?e:Object(r.createElement)(r.Fragment,{key:c},Object(r.createElement)("strong",null,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,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){e.exports=window.wp.isShallowEqual},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(16),o=c(15),n=c.n(o),a=c(7),s=c(2),l=c(22);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){e.exports=window.wc.wcBlocksSharedContext},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,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(21);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(34);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(129);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(18),a=c(9),s=c(14),l=c(235),i=c(59),u=c(234);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,c){"use strict";c.d(t,"c",(function(){return i})),c.d(t,"d",(function(){return u})),c.d(t,"b",(function(){return d})),c.d(t,"a",(function(){return b}));var r=c(5),o=c(65),n=c(110),a=c(34),s=c(95);const l=e=>Object(n.a)(e)?JSON.parse(e)||{}:Object(a.a)(e)?e:{},i=e=>{if(!Object(o.b)()||!Object(s.a)())return{style:{}};const t=Object(a.a)(e)?e:{},c=l(t.style);return Object(r.__experimentalGetSpacingClassesAndStyles)({...t,style:c})},u=e=>{const t=Object(a.a)(e)?e:{},c=l(t.style),r=Object(a.a)(c.typography)?c.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:r.fontSize,lineHeight:r.lineHeight,fontWeight:r.fontWeight,textTransform:r.textTransform,fontFamily:t.fontFamily}}},d=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},c=l(t.style);return Object(r.__experimentalUseColorProps)({...t,style:c})},b=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},c=l(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:c})}},,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(25),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.wp.hooks},,,,,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";c.d(t,"c",(function(){return n})),c.d(t,"d",(function(){return a})),c.d(t,"a",(function(){return s})),c.d(t,"b",(function(){return l}));var r=c(13),o=c(22);const n=(e,t)=>{if(o.n>2)return Object(r.registerBlockType)(e,t)},a=(e,t)=>{if(o.n>1)return Object(r.registerBlockType)(e,t)},s=()=>o.n>2,l=()=>o.n>1},,,,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(147),s=c(4),l=c.n(s),i=c(94);c(150),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(18),o=c(9),n=c(0),a=c(25),s=c.n(a),l=c(50),i=c(111),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(53),o=c(0),n=c(40);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(35),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(157),a=c(110);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(
|
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(
|
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,"a",(function(){return k}));var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(3),l=c(115),i=c(529),u=c(4),d=c.n(u),b=c(10),p=c(21),m=c(
|
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){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(25),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(115),a=c(233),s=c(2),l=c(5),i=c(29);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 r}));const r=e=>"string"==typeof e},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(8);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(148),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(90),n=c(61);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]:"…";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]:"…";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(30),s=c(10);c(154),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(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(18),o=c(9),n=c(0),a=c(50),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 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(179),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){},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(22),s=c(26),l=c(114),i=c(28);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,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(29),i=c(58),u=(c(359),c(44));t.default=Object(i.withProductDataContext)(e=>{const{className:t,align:c}=e,{parentClassName:n}=Object(l.useInnerBlockLayoutContext)(),{product:i}=Object(l.useProductDataContext)(),d=Object(u.a)(e),b=Object(u.b)(e),p=Object(u.d)(e),m=Object(u.c)(e);if(!i.id||!i.on_sale)return null;const g="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,g,{[n+"__product-onsale"]:n},b.className,d.className),style:{...b.style,...d.style,...p.style,...m.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";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,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0),o=c(104);c(175);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(277),i=c(9),u=(c(184),c(142));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(93),o=(c(16),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(98);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(36);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){},function(e,t,c){"use strict";var r=c(65);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(29),s=c(65),l=c(58),i=c(117),u=c(81),d=(c(358),c(44));const b=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:p}=e,{parentClassName:m}=Object(a.useInnerBlockLayoutContext)(),{product:g}=Object(a.useProductDataContext)(),{dispatchStoreEvent:O}=Object(u.a)(),j=Object(d.b)(e),h=Object(d.c)(e),_=Object(d.d)(e);return g.id?Object(r.createElement)(b,{headingLevel:c,className:n()(t,j.className,"wc-block-components-product-title",{[m+"__product-title"]:m,["wc-block-components-product-title--align-"+p]:p&&Object(s.b)()}),style:Object(s.b)()?{...h.style,..._.style,...j.style}:{}},Object(r.createElement)(i.a,{disabled:!o,name:g.name,permalink:g.permalink,target:l,onClick:()=>{O("product-view-link",{product:g})}})):Object(r.createElement)(b,{headingLevel:c,className:n()(t,j.className,"wc-block-components-product-title",{[m+"__product-title"]:m,["wc-block-components-product-title--align-"+p]:p&&Object(s.b)()}),style:Object(s.b)()?{...h.style,..._.style,...j.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(29),d=c(58),b=c(81),p=c(216),m=(c(360),c(44));const g=()=>Object(n.createElement)("img",{src:i.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500}),O=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)(g,null))};t.a=Object(d.withProductDataContext)(e=>{const{className:t,imageSizing:c="full-size",showProductLink:r=!0,showSaleBadge:o,saleBadgeAlign:s="right"}=e,{parentClassName:i}=Object(u.useInnerBlockLayoutContext)(),{product:d}=Object(u.useProductDataContext)(),[j,h]=Object(n.useState)(!1),{dispatchStoreEvent:_}=Object(b.a)(),E=Object(m.d)(e),w=Object(m.a)(e),f=Object(m.c)(e);if(!d.id)return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},w.className),style:{...E.style,...w.style,...f.style}},Object(n.createElement)(g,null));const k=!!d.images.length,y=k?d.images[0]:null,v=r?"a":n.Fragment,S=Object(a.sprintf)(
|
17 |
/* translators: %s is referring to the product name */
|
18 |
-
Object(a.__)("Link to %s","woo-gutenberg-products-block"),d.name),C={href:d.permalink,...!k&&{"aria-label":S},onClick:()=>{_("product-view-link",{product:d})}};return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},w.className),style:{...E.style,...w.style,...f.style}},Object(n.createElement)(v,r&&C,!!o&&Object(n.createElement)(p.default,{align:s,product:d}),Object(n.createElement)(O,{fallbackAlt:d.name,image:y,onLoad:()=>h(!0),loaded:j,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(50),l=c(521),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(98),Q=c(236);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(237),W=c(104),$=c(
|
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(114),_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(368),c(563)),ke=c(8),ye=c(219);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(
|
21 |
/* translators: %f is referring to the average rating value */
|
22 |
Object(o.__)("Rated %f out of 5","woo-gutenberg-products-block"),n),m=(e=>{const t=parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0})(c),g={__html:Object(o.sprintf)(
|
23 |
/* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
|
@@ -25,7 +25,7 @@ Object(o._n)("Rated %1$s out of 5 based on %2$s customer rating","Rated %1$s out
|
|
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(d.decodeEntities)((null==j?void 0:j.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(p.getSetting)("productsSettings");e&&(window.location.href=b.d)}:(P.href=O,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,...m.style},disabled:k},P),x)},h=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(g.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(m.useInnerBlockLayoutContext)(),{product:r}=Object(m.useProductDataContext)(),o=Object(O.b)(e),a=Object(O.a)(e),l=Object(O.d)(e),i=Object(O.c)(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)(j,{product:r,colorStyles:o,borderStyles:a,typographyStyles:l,spacingStyles:i}):Object(n.createElement)(h,{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(119),s=c(22),l=c(29),i=c(58),u=(c(363),c(44));t.default=Object(i.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(l.useInnerBlockLayoutContext)(),{product:o}=Object(l.useProductDataContext)(),i=Object(u.b)(e),d=Object(u.d)(e);if(!o)return Object(r.createElement)("div",{className:n()(t,"wc-block-components-product-summary",{[c+"__product-summary"]:c})});const b=o.short_description?o.short_description:o.description;return b?Object(r.createElement)(a.a,{className:n()(t,i.className,"wc-block-components-product-summary",{[c+"__product-summary"]:c}),source:b,maxLength:150,countType:s.o.wordCountType||"words",style:{...i.style,...d.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(29),l=c(58);c(364),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(29),l=c(7),i=c(58),u=(c(365),c(44));t.default=Object(i.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),i=Object(u.b)(e),d=Object(u.d)(e);return Object(l.isEmpty)(n.categories)?null:Object(r.createElement)("div",{className:a()(t,"wc-block-components-product-category-list",i.className,{[c+"__product-category-list"]:c}),style:{...i.style,...d.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(29),l=c(7),i=c(58),u=(c(366),c(44));t.default=Object(i.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),i=Object(u.b)(e),d=Object(u.d)(e);return Object(l.isEmpty)(n.tags)?null:Object(r.createElement)("div",{className:a()(t,i.className,"wc-block-components-product-tag-list",{[c+"__product-tag-list"]:c}),style:{...i.style,...d.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(29),l=c(58),i=(c(367),c(44));t.default=Object(l.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),l=Object(i.b)(e),u=Object(i.d)(e);if(!n.id||!n.is_purchasable)return null;const d=!!n.is_in_stock,b=n.low_stock_remaining,p=n.is_on_backorder;return Object(r.createElement)("div",{className:a()(t,l.className,"wc-block-components-product-stock-indicator",{[c+"__stock-indicator"]:c,"wc-block-components-product-stock-indicator--in-stock":d,"wc-block-components-product-stock-indicator--out-of-stock":!d,"wc-block-components-product-stock-indicator--low-stock":!!b,"wc-block-components-product-stock-indicator--available-on-backorder":!!p}),style:{...l.style,...u.style}},b?(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))(b):((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"))(d,p))})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,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 n}));var r=c(1),o=c(22);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(485)},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(18),a=c(14),s=c(40);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){},,,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,"blockSettings",(function(){return Kt}));var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(5),l=c(13),i=c(115),u=c(540),d=c(65),b=c(4),p=c.n(b),m={category:"woocommerce-product-elements",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],icon:{src:Object(n.createElement)(i.a,{icon:u.a,className:"wc-block-editor-components-block-icon"})},supports:{html:!1},parent:Object(d.a)()?void 0:["@woocommerce/all-products","@woocommerce/single-product"],save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",{className:p()("is-loading",t.className)})},deprecated:[{attributes:{},save:()=>null}]},g=c(280),O=c(3),j=c(10),h=c(102),_=c(281),E=c(97),w=c(138),f=c(29);c(405);var k=e=>t=>c=>{const r=Object(f.useProductDataContext)(),{attributes:o,setAttributes:l}=c,{productId:i}=o,[u,d]=Object(n.useState)(!i);return r.hasContext?Object(n.createElement)(t,c):Object(n.createElement)(n.Fragment,null,u?Object(n.createElement)(O.Placeholder,{icon:e.icon||"",label:e.label||"",className:"wc-atomic-blocks-product"},!!e.description&&Object(n.createElement)("div",null,e.description),Object(n.createElement)("div",{className:"wc-atomic-blocks-product__selection"},Object(n.createElement)(E.a,{selected:i||0,showVariations:!0,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];l({productId:e[0]?e[0].id:0})}}),Object(n.createElement)(O.Button,{isSecondary:!0,disabled:!i,onClick:()=>{d(!1)}},Object(a.__)("Done","woo-gutenberg-products-block")))):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(O.ToolbarGroup,null,Object(n.createElement)(w.a,{onClick:()=>d(!0)},Object(a.__)("Switch product…","woo-gutenberg-products-block")))),Object(n.createElement)(t,c)))},y=c(541);const v=Object(a.__)("Product Title","woo-gutenberg-products-block"),S=Object(n.createElement)(i.a,{icon:y.a,className:"wc-block-editor-components-block-icon"}),C=Object(a.__)("Display the title of a product.","woo-gutenberg-products-block");c(406);const x=e=>{let{attributes:t,setAttributes:c}=e;const r=Object(s.useBlockProps)(),{headingLevel:o,showProductLink:l,align:i,linkTarget:u}=t;return Object(n.createElement)("div",r,Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(h.a,{isCollapsed:!0,minLevel:1,maxLevel:7,selectedLevel:o,onChange:e=>c({headingLevel:e})}),Object(d.b)()&&Object(n.createElement)(s.AlignmentToolbar,{value:i,onChange:e=>{c({align:e})}})),Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Link settings","woo-gutenberg-products-block")},Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Make title a link","woo-gutenberg-products-block"),checked:l,onChange:()=>c({showProductLink:!l})}),l&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Open in new tab","woo-gutenberg-products-block"),onChange:e=>c({linkTarget:e?"_blank":"_self"}),checked:"_blank"===u})))),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(_.a,t)))};var N=Object(d.b)()?Object(j.compose)([k({icon:S,label:v,description:Object(a.__)("Choose a product to display its title.","woo-gutenberg-products-block")})])(x):x;const P=e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))};var T=c(95);const R={...m,apiVersion:2,title:v,description:C,icon:{src:S},attributes:g.a,edit:N,save:P,supports:{...m.supports,...Object(d.b)()&&{typography:{fontSize:!0,lineHeight:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0},color:{text:!0,background:!0,link:!1,gradients:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-title"}}};Object(l.registerBlockType)("woocommerce/product-title",R);var I=c(294),A=c(542);const B=Object(a.__)("Product Price","woo-gutenberg-products-block"),L=Object(n.createElement)(i.a,{icon:A.a,className:"wc-block-editor-components-block-icon"}),D=Object(a.__)("Display the price of a product.","woo-gutenberg-products-block");var V=k({icon:L,label:B,description:Object(a.__)("Choose a product to display its price.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const r=Object(s.useBlockProps)();return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.BlockControls,null,Object(d.b)()&&Object(n.createElement)(s.AlignmentToolbar,{value:t.textAlign,onChange:e=>{c({textAlign:e})}})),Object(n.createElement)("div",r,Object(n.createElement)(I.default,t)))});let F={productId:{type:"number",default:0}};Object(d.b)()&&(F={...F,textAlign:{type:"string"}});var M=F;const z={...m,apiVersion:2,title:B,description:D,icon:{src:L},attributes:M,edit:V,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))},supports:{...m.supports,...Object(d.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(l.registerBlockType)("woocommerce/product-price",z);var H=c(282);const q={...Object(d.b)()&&{__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-image"}};var G=c(2),Q=c(283),Y=c(543);const U=Object(a.__)("Product Image","woo-gutenberg-products-block"),W=Object(n.createElement)(i.a,{icon:Y.a,className:"wc-block-editor-components-block-icon"}),$=Object(a.__)("Display the main product image","woo-gutenberg-products-block");var K=k({icon:W,label:U,description:Object(a.__)("Choose a product to display its image.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{showProductLink:r,imageSizing:o,showSaleBadge:l,saleBadgeAlign:i}=t,u=Object(s.useBlockProps)();return Object(n.createElement)("div",u,Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block")},Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(a.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:r,onChange:()=>c({showProductLink:!r})}),Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Show On-Sale Badge","woo-gutenberg-products-block"),help:Object(a.__)('Overlay a "sale" badge if the product is on-sale.',"woo-gutenberg-products-block"),checked:l,onChange:()=>c({showSaleBadge:!l})}),l&&Object(n.createElement)(O.__experimentalToggleGroupControl,{label:Object(a.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:i,onChange:e=>c({saleBadgeAlign:e})},Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"left",label:Object(a.__)("Left","woo-gutenberg-products-block")}),Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"center",label:Object(a.__)("Center","woo-gutenberg-products-block")}),Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"right",label:Object(a.__)("Right","woo-gutenberg-products-block")})),Object(n.createElement)(O.__experimentalToggleGroupControl,{label:Object(a.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(n.createInterpolateElement)(Object(a.__)("Product image cropping can be modified in the <a>Customizer</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(G.getAdminLink)("customize.php")+"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images",target:"_blank",rel:"noopener noreferrer"})}),value:o,onChange:e=>c({imageSizing:e})},Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"full-size",label:Object(a.__)("Full Size","woo-gutenberg-products-block")}),Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"cropped",label:Object(a.__)("Cropped","woo-gutenberg-products-block")})))),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Q.a,t)))});const J={apiVersion:2,title:U,description:$,icon:{src:W},attributes:H.a,edit:K,supports:q,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-image",{...m,...J});var X=c(295),Z=c(536);const ee=Object(a.__)("Product Rating","woo-gutenberg-products-block"),te=Object(n.createElement)(i.a,{icon:Z.a,className:"wc-block-editor-components-block-icon"}),ce=Object(a.__)("Display the average rating of a product.","woo-gutenberg-products-block");var re=k({icon:te,label:ee,description:Object(a.__)("Choose a product to display its rating.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)({className:"wp-block-woocommerce-product-rating"});return Object(n.createElement)("div",c,Object(n.createElement)(X.default,t))});const oe={apiVersion:2,title:ee,description:ce,icon:{src:te},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-rating"}},edit:re,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-rating",{...m,...oe});var ne=c(296),ae=c(544);const se=Object(a.__)("Add to Cart Button","woo-gutenberg-products-block"),le=Object(n.createElement)(i.a,{icon:ae.a,className:"wc-block-editor-components-block-icon"}),ie=Object(a.__)("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 ue=k({icon:le,label:se,description:Object(a.__)("Choose a product to display its add to cart button.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(O.Disabled,null,Object(n.createElement)(ne.default,t)))});const de={apiVersion:2,title:se,description:ie,icon:{src:le},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},...Object(T.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:ue,save:P};Object(l.registerBlockType)("woocommerce/product-button",{...m,...de});var be=c(297),pe=c(545);const me=Object(a.__)("Product Summary","woo-gutenberg-products-block"),ge=Object(n.createElement)(i.a,{icon:pe.a,className:"wc-block-editor-components-block-icon"}),Oe=Object(a.__)("Display a short description about a product.","woo-gutenberg-products-block");c(408);var je=k({icon:ge,label:me,description:Object(a.__)("Choose a product to display its short description.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(be.default,t))});const he={apiVersion:2,title:me,description:Oe,icon:{src:ge},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-summary"}},edit:je,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-summary",{...m,...he});var _e=c(216),Ee=c(534);const we=Object(a.__)("On-Sale Badge","woo-gutenberg-products-block"),fe=Object(n.createElement)(i.a,{icon:Ee.a,className:"wc-block-editor-components-block-icon"}),ke=Object(a.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block");var ye=k({icon:fe,label:we,description:Object(a.__)("Choose a product to display its sale-badge.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(_e.default,t))});const ve={title:we,description:ke,icon:{src:fe},apiVersion:2,supports:{html:!1,...Object(d.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(T.a)()&&{spacing:{padding:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-sale-badge"}},attributes:{productId:{type:"number",default:0}},edit:ye,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-sale-badge",{...m,...ve});var Se=c(105),Ce=c(298),xe=c(11),Ne=Object(n.createElement)(xe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M2 6h2v12H2V6m3 0h1v12H5V6m2 0h3v12H7V6m4 0h1v12h-1V6m3 0h2v12h-2V6m3 0h3v12h-3V6m4 0h1v12h-1V6z"}));const Pe=Object(a.__)("Product SKU","woo-gutenberg-products-block"),Te=Object(n.createElement)(i.a,{icon:Ne,className:"wc-block-editor-components-block-icon"}),Re={title:Pe,description:Object(a.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:Te},attributes:{productId:{type:"number",default:0}},edit:k({icon:Te,label:Pe,description:Object(a.__)("Choose a product to display its SKU.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(Se.a,null),Object(n.createElement)(Ce.default,t))})};Object(d.c)("woocommerce/product-sku",{...m,...Re});var Ie=c(299),Ae=c(546);const Be=Object(a.__)("Product Category List","woo-gutenberg-products-block"),Le=Object(n.createElement)(i.a,{icon:Ae.a,className:"wc-block-editor-components-block-icon"}),De=Object(a.__)("Display a list of categories belonging to a product.","woo-gutenberg-products-block");var Ve=k({icon:Le,label:Be,description:Object(a.__)("Choose a product to display its categories.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(Se.a,null),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Ie.default,t)))});const Fe={...m,apiVersion:2,title:Be,description:De,icon:{src:Le},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.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(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))},edit:Ve};Object(d.c)("woocommerce/product-category-list",Fe);var Me=c(300),ze=c(539);const He=Object(a.__)("Product Tag List","woo-gutenberg-products-block"),qe=Object(n.createElement)(i.a,{icon:ze.a,className:"wc-block-editor-components-block-icon"}),Ge=Object(a.__)("Display a list of tags belonging to a product.","woo-gutenberg-products-block");var Qe=k({icon:qe,label:He,description:Object(a.__)("Choose a product to display its tags.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(Se.a,null),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Me.default,t)))});const Ye={apiVersion:2,title:He,description:Ge,icon:{src:qe},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.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(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(d.c)("woocommerce/product-tag-list",{...m,...Ye});var Ue=c(301),We=c(547);const $e=Object(a.__)("Product Stock Indicator","woo-gutenberg-products-block"),Ke=Object(n.createElement)(i.a,{icon:We.a,className:"wc-block-editor-components-block-icon"}),Je=Object(a.__)("Display product stock status.","woo-gutenberg-products-block");var Xe=k({icon:Ke,label:$e,description:Object(a.__)("Choose a product to display its stock.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(Se.a,null),Object(n.createElement)(Ue.default,t))});const Ze={apiVersion:2,title:$e,description:Je,icon:{src:Ke},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-stock-indicator"}},edit:Xe,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(d.c)("woocommerce/product-stock-indicator",{...m,...Ze});var et=c(521),tt=(c(279),c(285)),ct=c(218);const rt=Object(a.__)("Add to Cart","woo-gutenberg-products-block"),ot=Object(n.createElement)(i.a,{icon:ct.a,className:"wc-block-editor-components-block-icon"}),nt={title:rt,description:Object(a.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:ot},edit:k({icon:ot,label:rt,description:Object(a.__)("Choose a product to display its add to cart form.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{product:r}=Object(f.useProductDataContext)(),{className:o,showFormElements:l}=t;return Object(n.createElement)("div",{className:p()(o,"wc-block-components-product-add-to-cart")},Object(n.createElement)(Se.a,{productId:r.id}),Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Layout","woo-gutenberg-products-block")},Object(et.b)(r)?Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Display form elements","woo-gutenberg-products-block"),help:Object(a.__)("Depending on product type, allow customers to select a quantity, variations etc.","woo-gutenberg-products-block"),checked:l,onChange:()=>c({showFormElements:!l})}):Object(n.createElement)(O.Notice,{className:"wc-block-components-product-add-to-cart-notice",isDismissible:!1,status:"info"},Object(a.__)("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(n.createElement)(O.Disabled,null,Object(n.createElement)(tt.a,t)))}),attributes:c(284).a};Object(d.c)("woocommerce/product-add-to-cart",{...m,...nt});var at=c(24),st=c.n(at),lt=c(9),it=c(64),ut=c(513),dt=c(394),bt=c(22);const pt=(e,t)=>{const{className:c,contentVisibility:r}=t;return p()(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})};var mt=c(233);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(8),ht=c(7),_t=c(30);c(414);var Et=e=>{let{currentPage:t,displayFirstAndLastPages:c=!0,displayNextAndPreviousArrows:r=!0,pagesToDisplay:o=3,onPageChange:s,totalPages:l}=e,{minIndex:i,maxIndex:u}=((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}})(o,t,l);const d=c&&Boolean(1!==i),b=c&&Boolean(u!==l),m=c&&Boolean(i&&i>3),g=c&&Boolean(u&&u<l-2);d&&3===i&&(i-=1),b&&u===l-2&&(u+=1);const O=[];if(i&&u)for(let e=i;e<=u;e++)O.push(e);return Object(n.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(n.createElement)(_t.a,{screenReaderLabel:Object(a.__)("Navigate to another page","woo-gutenberg-products-block")}),r&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>s(t-1),title:Object(a.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(n.createElement)(_t.a,{label:"←",screenReaderLabel:Object(a.__)("Previous page","woo-gutenberg-products-block")})),d&&Object(n.createElement)("button",{className:p()("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:()=>s(1),disabled:1===t},Object(n.createElement)(_t.a,{label:"1",screenReaderLabel:Object(a.sprintf)(
|
29 |
/* translators: %d is the page number (1, 2, 3...). */
|
30 |
Object(a.__)("Page %d","woo-gutenberg-products-block"),1)})),m&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(a.__)("…","woo-gutenberg-products-block")),O.map(e=>Object(n.createElement)("button",{key:e,className:p()("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:()=>s(e),disabled:t===e},Object(n.createElement)(_t.a,{label:e.toString(),screenReaderLabel:Object(a.sprintf)(
|
31 |
/* translators: %d is the page number (1, 2, 3...). */
|
@@ -33,4 +33,4 @@ Object(a.__)("Page %d","woo-gutenberg-products-block"),e)}))),g&&Object(n.create
|
|
33 |
/* translators: %d is the page number (1, 2, 3...). */
|
34 |
Object(a.__)("Page %d","woo-gutenberg-products-block"),l)})),r&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>s(t+1),title:Object(a.__)("Next page","woo-gutenberg-products-block"),disabled:t>=l},Object(n.createElement)(_t.a,{label:"→",screenReaderLabel:Object(a.__)("Next page","woo-gutenberg-products-block")})))},wt=c(111),ft=c(76),kt=c(125),yt=c(18),vt=c(50);var St=c(81);c(415);const Ct=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};var xt=c(46),Nt=c(174),Pt=()=>{const{parentClassName:e}=Object(f.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:e+"__no-products"},Object(n.createElement)(i.a,{className:e+"__no-products-image",icon:Nt.a,size:100}),Object(n.createElement)("strong",{className:e+"__no-products-title"},Object(a.__)("No products","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:e+"__no-products-description"},Object(a.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},Tt=c(538),Rt=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:c}=Object(f.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:c+"__no-products"},Object(n.createElement)(i.a,{className:c+"__no-products-image",icon:Tt.a,size:100}),Object(n.createElement)("strong",{className:c+"__no-products-title"},Object(a.__)("No products found","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:c+"__no-products-description"},Object(a.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(n.createElement)("button",{onClick:t},Object(a.__)("Reset Search","woo-gutenberg-products-block")))},It=c(121);c(413);var At=e=>{let{onChange:t,value:c}=e;return Object(n.createElement)(It.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",onChange:t,options:[{key:"menu_order",label:Object(a.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(a.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(a.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(a.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(a.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(a.__)("Price: high to low","woo-gutenberg-products-block")}],screenReaderLabel:Object(a.__)("Order products by","woo-gutenberg-products-block"),value:c})};const Bt=(e,t,c,r)=>{if(!c)return;const a=Object(ut.a)(e);return c.map((c,s)=>{let[l,i={}]=c,u=[];i.children&&i.children.length>0&&(u=Bt(e,t,i.children,r));const d=a[l];if(!d)return null;const b=t.id||0,p=["layout",l,s,r,b];return Object(n.createElement)(n.Suspense,{key:p.join("_"),fallback:Object(n.createElement)("div",{className:"wc-block-placeholder"})},Object(n.createElement)(d,o()({},i,{children:u,product:t})))})};var Lt=Object(j.withInstanceId)(e=>{let{product:t={},attributes:c,instanceId:r}=e;const{layoutConfig:o}=c,{parentClassName:a,parentName:s}=Object(f.useInnerBlockLayoutContext)(),l=0===Object.keys(t).length,i=p()(a+"__product","wc-block-layout",{"is-loading":l});return Object(n.createElement)("li",{className:i,"aria-hidden":l},Bt(s,t,o,r))});c(412);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,Mt=(Ft=e=>{let{attributes:t,currentPage:c,onPageChange:r,onSortChange:o,sortValue:s,scrollToTop:l}=e;const[i,u]=Object(ft.b)("attributes",[]),[d,b]=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:s,currentPage:c})),{products:_,totalProducts:E,productsLoading:w}=(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(lt.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(f.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:E},Vt);Object(n.useEffect)(()=>{S("product-list-render",{products:_,listName:y})},[_,y,S]),Object(n.useEffect)(()=>{Object(ht.isEqual)(v,null==C?void 0:C.totalQuery)||(r(1),null!=C&&C.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(xt.speak)(Object(a.__)("No products found","woo-gutenberg-products-block")):Object(xt.speak)(Object(a.sprintf)(
|
35 |
/* translators: %s is an integer higher than 0 (1, 2, 3...) */
|
36 |
-
Object(a._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(E))},[null==C?void 0:C.totalQuery,E,r,v]);const{contentVisibility:x}=t,N=t.columns*t.rows,P=!Number.isFinite(E)&&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(E/N),T=_.length?_:Array.from({length:N}),R=0!==_.length||w,I=i.length>0||d.length>0||Number.isFinite(m)||Number.isFinite(O);return Object(n.createElement)("div",{className:(()=>{const{columns:e,rows:c,alignButtons:r,align:o}=t,n=void 0!==o?"align"+o:"";return p()(k,n,"has-"+e+"-columns",{"has-multiple-rows":c>1,"has-aligned-buttons":r})})()},(null==x?void 0:x.orderBy)&&R&&Object(n.createElement)(At,{onChange:o,value:s}),!R&&I&&Object(n.createElement)(Rt,{resetCallback:()=>{u([]),b([]),g(null),j(null)}}),!R&&!I&&Object(n.createElement)(Pt,null),R&&Object(n.createElement)("ul",{className:k+"__products"},T.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=arguments.length>1?arguments[1]:void 0;return Object(n.createElement)(Lt,{key:e.id||c,attributes:t,product:e})}))),P>1&&Object(n.createElement)(Et,{currentPage:c,onPageChange:e=>{l({focusableSelector:"a, button"}),r(e)},totalPages:P}))},e=>{const t=Object(n.useRef)(null);return Object(n.createElement)(n.Fragment,null,Object(n.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:t,"aria-hidden":!0}),Object(n.createElement)(Ft,o()({},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)}})))}),zt=e=>{let{attributes:t}=e;const[c,r]=Object(n.useState)(1),[o,a]=Object(n.useState)(t.orderby);return Object(n.useEffect)(()=>{a(t.orderby)},[t.orderby]),Object(n.createElement)(Mt,{attributes:t,currentPage:c,onPageChange:e=>{r(e)},onSortChange:e=>{var t;const c=null==e||null===(t=e.target)||void 0===t?void 0:t.value;a(c),r(1)},sortValue:o})},Ht=c(137),qt=c(142),Gt=c(228);class Qt extends jt.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?Ht.a:Object(n.createElement)(f.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)(qt.a,null,Object(n.createElement)(Gt.a,{context:"wc/all-products"})),Object(n.createElement)(zt,{attributes:e,urlParameterSuffix:t}))}}var Yt=Qt;c(411);class Ut extends n.Component{constructor(){super(...arguments),st()(this,"state",{isEditing:!1,innerBlocks:[]}),st()(this,"blockMap",Object(ut.a)("woocommerce/all-products")),st()(this,"componentDidMount",()=>{const{block:e}=this.props;this.setState({innerBlocks:e.innerBlocks})}),st()(this,"getTitle",()=>Object(a.__)("All Products","woo-gutenberg-products-block")),st()(this,"getIcon",()=>Object(n.createElement)(i.a,{icon:u.a})),st()(this,"togglePreview",()=>{const{debouncedSpeak:e}=this.props;this.setState({isEditing:!this.state.isEditing}),this.state.isEditing||e(Object(a.__)("Showing All Products block preview.","woo-gutenberg-products-block"))}),st()(this,"getInspectorControls",()=>{const{attributes:e,setAttributes:t}=this.props,{columns:c,rows:r,alignButtons:o}=e;return Object(n.createElement)(s.InspectorControls,{key:"inspector"},Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(n.createElement)(it.a,{columns:c,rows:r,alignButtons:o,setAttributes:t,minColumns:Object(G.getSetting)("min_columns",1),maxColumns:Object(G.getSetting)("max_columns",6),minRows:Object(G.getSetting)("min_rows",1),maxRows:Object(G.getSetting)("max_rows",6)})),Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Content Settings","woo-gutenberg-products-block")},((e,t)=>{const{contentVisibility:c}=e;return Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:c.orderBy,onChange:()=>t({contentVisibility:{...c,orderBy:!c.orderBy}})})})(e,t),((e,t)=>Object(n.createElement)(O.SelectControl,{label:Object(a.__)("Order Products By","woo-gutenberg-products-block"),value:e.orderby,options:[{label:Object(a.__)("Default sorting (menu order)","woo-gutenberg-products-block"),value:"menu_order"},{label:Object(a.__)("Popularity","woo-gutenberg-products-block"),value:"popularity"},{label:Object(a.__)("Average rating","woo-gutenberg-products-block"),value:"rating"},{label:Object(a.__)("Latest","woo-gutenberg-products-block"),value:"date"},{label:Object(a.__)("Price: low to high","woo-gutenberg-products-block"),value:"price"},{label:Object(a.__)("Price: high to low","woo-gutenberg-products-block"),value:"price-desc"}],onChange:e=>t({orderby:e})}))(e,t)))}),st()(this,"getBlockControls",()=>{const{isEditing:e}=this.state;return Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(O.ToolbarGroup,{controls:[{icon:"edit",title:Object(a.__)("Edit inner product layout","woo-gutenberg-products-block"),onClick:()=>this.togglePreview(),isActive:e}]}))}),st()(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(n.createElement)(O.Placeholder,{icon:this.getIcon(),label:this.getTitle()},Object(a.__)("Display all products from your store as a grid.","woo-gutenberg-products-block"),Object(n.createElement)("div",{className:"wc-block-all-products-grid-item-template"},Object(n.createElement)(O.Tip,null,Object(a.__)("Edit the blocks inside the preview below to change the content displayed for each product within the product grid.","woo-gutenberg-products-block")),Object(n.createElement)(f.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)("div",{className:"wc-block-grid wc-block-layout has-1-columns"},Object(n.createElement)("ul",{className:"wc-block-grid__products"},Object(n.createElement)("li",{className:"wc-block-grid__product"},Object(n.createElement)(f.ProductDataContextProvider,{product:dt.a[0]},Object(n.createElement)(s.InnerBlocks,e)))))),Object(n.createElement)("div",{className:"wc-block-all-products__actions"},Object(n.createElement)(O.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(a.__)("Done","woo-gutenberg-products-block")),Object(n.createElement)(O.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(a.__)("Cancel","woo-gutenberg-products-block")),Object(n.createElement)(O.Button,{className:"wc-block-all-products__reset-button",icon:Object(n.createElement)(i.a,{icon:u.a}),label:Object(a.__)("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(l.createBlock)(t,r)),!0}),t(e.clientId,c,!1),this.setState({innerBlocks:e.innerBlocks})}},Object(a.__)("Reset Layout","woo-gutenberg-products-block")))))}),st()(this,"renderViewMode",()=>{const{attributes:e}=this.props,{layoutConfig:t}=e,c=t&&0!==t.length,r=this.getTitle(),o=this.getIcon();return c?Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Yt,{attributes:e})):((e,t)=>Object(n.createElement)(O.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(a.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")))(r,o)}),st()(this,"render",()=>{const{attributes:e}=this.props,{isEditing:t}=this.state,c=this.getTitle(),r=this.getIcon();return 0===bt.o.productCount?((e,t)=>Object(n.createElement)(O.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(n.createElement)("p",null,Object(a.__)("You haven't published any products to list here yet.","woo-gutenberg-products-block")),Object(n.createElement)(O.Button,{className:"wc-block-products__add-product-button",isSecondary:!0,href:G.ADMIN_URL+"post-new.php?post_type=product"},Object(a.__)("Add new product","woo-gutenberg-products-block")+" ",Object(n.createElement)(i.a,{icon:mt.a})),Object(n.createElement)(O.Button,{className:"wc-block-products__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-products/"},Object(a.__)("Learn more","woo-gutenberg-products-block"))))(c,r):Object(n.createElement)("div",{className:pt("wc-block-all-products",e)},this.getBlockControls(),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())})}}var Wt=Object(j.compose)(O.withSpokenMessages,Object(lt.withSelect)((e,t)=>{let{clientId:c}=t;const{getBlock:r}=e("core/block-editor");return{block:r(c)}}),Object(lt.withDispatch)(e=>{const{replaceInnerBlocks:t}=e("core/block-editor");return{replaceInnerBlocks:t}}))(Ut);const $t={columns:Object(G.getSetting)("default_columns",3),rows:Object(G.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:gt,isPreview:!1},Kt={title:Object(a.__)("All Products","woo-gutenberg-products-block"),icon:{src:Object(n.createElement)(i.a,{icon:u.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("Display products from your store in a grid layout.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1,multiple:!1},example:{attributes:{isPreview:!0}},attributes:{columns:{type:"number"},rows:{type:"number"},alignButtons:{type:"boolean"},contentVisibility:{type:"object"},orderby:{type:"string"},layoutConfig:{type:"array"},isPreview:{type:"boolean",default:!1}},defaults:$t,edit:e=>Object(n.createElement)(Wt,e),save(e){let{attributes:t}=e;const c={};Object.keys(t).sort().forEach(e=>{c[e]=t[e]});const r={"data-attributes":JSON.stringify(c)};return Object(n.createElement)("div",o()({className:pt("wc-block-all-products",t)},r),Object(n.createElement)(s.InnerBlocks.Content,null))}};Object(l.registerBlockType)("woocommerce/all-products",{...Kt,deprecated:[{attributes:Object.assign({},Kt.attributes,{rows:{type:"number",default:1}}),save(e){let{attributes:t}=e;const c={"data-attributes":JSON.stringify(t)};return Object(n.createElement)("div",o()({className:pt("wc-block-all-products",t)},c),Object(n.createElement)(s.InnerBlocks.Content,null))}}]})},,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(41),o=c(0),n=c(22);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(28)]).then(c.bind(null,294)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(5),c.e(25)]).then(c.bind(null,566)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(36)]).then(c.bind(null,567)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(29)]).then(c.bind(null,295)))}),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(21)]).then(c.bind(null,296)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(33)]).then(c.bind(null,297)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(5)]).then(c.bind(null,216)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>c.e(31).then(c.bind(null,298)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(24)]).then(c.bind(null,299)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(35)]).then(c.bind(null,300)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(32)]).then(c.bind(null,301)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(3),c.e(4),c.e(19)]).then(c.bind(null,568)))});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={7:0,1:0,2:0,3:0,4:0,5:0,21:0,24:0,28:0,29:0,31:0,32:0,33:0,35: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-add-to-cart--product-button--product-image--product-title",4:"product-add-to-cart--product-button",5:"product-sale-badge",19:"product-add-to-cart",21:"product-button",24:"product-category-list",25:"product-image",28:"product-price",29:"product-rating",31:"product-sku",32:"product-stock-indicator",33:"product-summary",35:"product-tag-list",36:"product-title"}[e]||e)+".js?ver="+{1:"0c675b8f42c10e9d9f2c",2:"1f320cd8c58862d75ff3",3:"c6f2d8b9b1ab85c4ec75",4:"d934b963b87d1d5608e0",5:"2fa88b4d38149e2e0288",19:"cb8bdb61550b3248d673",21:"80fe111d06c4dbe41397",24:"14c6c404d6668423a961",25:"ac4986eb79f31a533125",28:"11e133c9385ce26db732",29:"405a77c64842086ac0ff",31:"2093c8f7226d44560e87",32:"05cbf4f3fb0b87627b6e",33:"b5dc50bb47e21a476985",35:"61c3ceb10ea8a60c7f15",36:"ad531de5effc03ac16b7"}[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([404,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.React},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.wp.blocks},function(e,t){e.exports=window.wp.htmlEntities},function(e,t){e.exports=window.wp.apiFetch},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,c)=>0===c?e:Object(r.createElement)(r.Fragment,{key:c},Object(r.createElement)("strong",null,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,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){e.exports=window.wp.isShallowEqual},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(16),o=c(15),n=c.n(o),a=c(7),s=c(2),l=c(22);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){e.exports=window.wc.wcBlocksSharedContext},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,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(21);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(129);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(18),a=c(9),s=c(14),l=c(235),i=c(59),u=c(234);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,c){"use strict";c.d(t,"c",(function(){return i})),c.d(t,"d",(function(){return u})),c.d(t,"b",(function(){return d})),c.d(t,"a",(function(){return b}));var r=c(5),o=c(65),n=c(110),a=c(35),s=c(95);const l=e=>Object(n.a)(e)?JSON.parse(e)||{}:Object(a.a)(e)?e:{},i=e=>{if(!Object(o.b)()||!Object(s.a)())return{style:{}};const t=Object(a.a)(e)?e:{},c=l(t.style);return Object(r.__experimentalGetSpacingClassesAndStyles)({...t,style:c})},u=e=>{const t=Object(a.a)(e)?e:{},c=l(t.style),r=Object(a.a)(c.typography)?c.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:r.fontSize,lineHeight:r.lineHeight,fontWeight:r.fontWeight,textTransform:r.textTransform,fontFamily:t.fontFamily}}},d=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},c=l(t.style);return Object(r.__experimentalUseColorProps)({...t,style:c})},b=e=>{if(!Object(o.b)())return{className:"",style:{}};const t=Object(a.a)(e)?e:{},c=l(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:c})}},,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(25),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.wp.hooks},,,,,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";c.d(t,"c",(function(){return n})),c.d(t,"d",(function(){return a})),c.d(t,"a",(function(){return s})),c.d(t,"b",(function(){return l}));var r=c(13),o=c(22);const n=(e,t)=>{if(o.n>2)return Object(r.registerBlockType)(e,t)},a=(e,t)=>{if(o.n>1)return Object(r.registerBlockType)(e,t)},s=()=>o.n>2,l=()=>o.n>1},,,,function(e,t,c){"use strict";var r=c(6),o=c.n(r),n=c(0),a=c(148),s=c(4),l=c.n(s),i=c(94);c(151),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(18),o=c(9),n=c(0),a=c(25),s=c.n(a),l=c(50),i=c(111),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(53),o=c(0),n=c(40);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(158),a=c(110);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(152),t.a=()=>Object(r.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},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";var r=c(0),o=c(1),n=c(38),a=c(4),s=c.n(a),l=c(27);c(150);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(100),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(178),p=c(24),m=c.n(p),g=c(25),O=c.n(g),j=c(26),h=c(28),_=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(85);c(131);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,"a",(function(){return k}));var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(3),l=c(115),i=c(529),u=c(4),d=c.n(u),b=c(10),p=c(21),m=c(36),g=c(528),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){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(25),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(115),a=c(233),s=c(2),l=c(5),i=c(29);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 r}));const r=e=>"string"==typeof e},function(e,t,c){"use strict";c.d(t,"a",(function(){return o}));var r=c(8);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(149),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(90),n=c(61);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]:"…";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]:"…";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(30),s=c(10);c(155),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(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(18),o=c(9),n=c(0),a=c(50),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 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(179),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){},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(22),s=c(26),l=c(114),i=c(28);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,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(29),i=c(58),u=(c(359),c(44));t.default=Object(i.withProductDataContext)(e=>{const{className:t,align:c}=e,{parentClassName:n}=Object(l.useInnerBlockLayoutContext)(),{product:i}=Object(l.useProductDataContext)(),d=Object(u.a)(e),b=Object(u.b)(e),p=Object(u.d)(e),m=Object(u.c)(e);if(!i.id||!i.on_sale)return null;const g="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,g,{[n+"__product-onsale"]:n},b.className,d.className),style:{...b.style,...d.style,...p.style,...m.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";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,c){"use strict";c.d(t,"a",(function(){return n}));var r=c(0),o=c(104);c(175);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(277),i=c(9),u=(c(184),c(143));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(93),o=(c(16),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(98);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){},function(e,t,c){"use strict";var r=c(65);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(29),s=c(65),l=c(58),i=c(117),u=c(81),d=(c(358),c(44));const b=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:p}=e,{parentClassName:m}=Object(a.useInnerBlockLayoutContext)(),{product:g}=Object(a.useProductDataContext)(),{dispatchStoreEvent:O}=Object(u.a)(),j=Object(d.b)(e),h=Object(d.c)(e),_=Object(d.d)(e);return g.id?Object(r.createElement)(b,{headingLevel:c,className:n()(t,j.className,"wc-block-components-product-title",{[m+"__product-title"]:m,["wc-block-components-product-title--align-"+p]:p&&Object(s.b)()}),style:Object(s.b)()?{...h.style,..._.style,...j.style}:{}},Object(r.createElement)(i.a,{disabled:!o,name:g.name,permalink:g.permalink,target:l,onClick:()=>{O("product-view-link",{product:g})}})):Object(r.createElement)(b,{headingLevel:c,className:n()(t,j.className,"wc-block-components-product-title",{[m+"__product-title"]:m,["wc-block-components-product-title--align-"+p]:p&&Object(s.b)()}),style:Object(s.b)()?{...h.style,..._.style,...j.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(29),d=c(58),b=c(81),p=c(216),m=(c(360),c(44));const g=()=>Object(n.createElement)("img",{src:i.PLACEHOLDER_IMG_SRC,alt:"",width:500,height:500}),O=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)(g,null))};t.a=Object(d.withProductDataContext)(e=>{const{className:t,imageSizing:c="full-size",showProductLink:r=!0,showSaleBadge:o,saleBadgeAlign:s="right"}=e,{parentClassName:i}=Object(u.useInnerBlockLayoutContext)(),{product:d}=Object(u.useProductDataContext)(),[j,h]=Object(n.useState)(!1),{dispatchStoreEvent:_}=Object(b.a)(),E=Object(m.d)(e),w=Object(m.a)(e),f=Object(m.c)(e);if(!d.id)return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},w.className),style:{...E.style,...w.style,...f.style}},Object(n.createElement)(g,null));const k=!!d.images.length,y=k?d.images[0]:null,v=r?"a":n.Fragment,S=Object(a.sprintf)(
|
17 |
/* translators: %s is referring to the product name */
|
18 |
+
Object(a.__)("Link to %s","woo-gutenberg-products-block"),d.name),C={href:d.permalink,...!k&&{"aria-label":S},onClick:()=>{_("product-view-link",{product:d})}};return Object(n.createElement)("div",{className:l()(t,"wc-block-components-product-image",{[i+"__product-image"]:i},w.className),style:{...E.style,...w.style,...f.style}},Object(n.createElement)(v,r&&C,!!o&&Object(n.createElement)(p.default,{align:s,product:d}),Object(n.createElement)(O,{fallbackAlt:d.name,image:y,onLoad:()=>h(!0),loaded:j,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(50),l=c(521),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(98),Q=c(236);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(237),W=c(104),$=c(37),K=c(118);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(15),te=c.n(ee),ce=c(14),re=c(234),oe=c(40),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(29),le=c(7),ie=c(58),ue=(c(279),c(69)),de=c(115),be=c(548),pe=c(81),me=c(407);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(114),_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(368),c(563)),ke=c(8),ye=c(219);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(550),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(96),s=c(27),l=c(29),i=c(58),u=c(44);t.default=Object(i.withProductDataContext)(e=>{var t,c;const{className:o,textAlign:i}=e,{parentClassName:d}=Object(l.useInnerBlockLayoutContext)(),{product:b}=Object(l.useProductDataContext)(),p=Object(u.b)(e),m=Object(u.d)(e),g=n()("wc-block-components-product-price",o,p.className,{[d+"__product-price"]:d}),O={...m.style,...p.style};if(!b.id)return Object(r.createElement)(a.a,{align:i,className:g});const j=b.prices,h=Object(s.getCurrencyFromPriceResponse)(j),_=j.price!==j.regular_price,E=n()({[d+"__product-price__value"]:d,[d+"__product-price__value--on-sale"]:_});return Object(r.createElement)(a.a,{align:i,className:g,priceStyle:O,regularPriceStyle:O,priceClassName:E,currency:h,price:j.price,minPrice:null==j||null===(t=j.price_range)||void 0===t?void 0:t.min_amount,maxPrice:null==j||null===(c=j.price_range)||void 0===c?void 0:c.max_amount,regularPrice:j.regular_price,regularPriceClassName:n()({[d+"__product-price__regular"]:d})})})},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(29),l=c(58),i=(c(361),c(44));t.default=Object(l.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),l=Object(i.b)(e),u=Object(i.d)(e),d=Object(i.c)(e);if(!n)return null;const b={width:n/5*100+"%"},p=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),m=(e=>{const t=parseInt(e.review_count,10);return Number.isFinite(t)&&t>0?t:0})(c),g={__html:Object(o.sprintf)(
|
23 |
/* translators: %1$s is referring to the average rating value, %2$s is referring to the number of ratings */
|
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(d.decodeEntities)((null==j?void 0:j.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(p.getSetting)("productsSettings");e&&(window.location.href=b.d)}:(P.href=O,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,...m.style},disabled:k},P),x)},h=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(g.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(m.useInnerBlockLayoutContext)(),{product:r}=Object(m.useProductDataContext)(),o=Object(O.b)(e),a=Object(O.a)(e),l=Object(O.d)(e),i=Object(O.c)(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)(j,{product:r,colorStyles:o,borderStyles:a,typographyStyles:l,spacingStyles:i}):Object(n.createElement)(h,{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(119),s=c(22),l=c(29),i=c(58),u=(c(363),c(44));t.default=Object(i.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(l.useInnerBlockLayoutContext)(),{product:o}=Object(l.useProductDataContext)(),i=Object(u.b)(e),d=Object(u.d)(e);if(!o)return Object(r.createElement)("div",{className:n()(t,"wc-block-components-product-summary",{[c+"__product-summary"]:c})});const b=o.short_description?o.short_description:o.description;return b?Object(r.createElement)(a.a,{className:n()(t,i.className,"wc-block-components-product-summary",{[c+"__product-summary"]:c}),source:b,maxLength:150,countType:s.o.wordCountType||"words",style:{...i.style,...d.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(29),l=c(58);c(364),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(29),l=c(7),i=c(58),u=(c(365),c(44));t.default=Object(i.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),i=Object(u.b)(e),d=Object(u.d)(e);return Object(l.isEmpty)(n.categories)?null:Object(r.createElement)("div",{className:a()(t,"wc-block-components-product-category-list",i.className,{[c+"__product-category-list"]:c}),style:{...i.style,...d.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(29),l=c(7),i=c(58),u=(c(366),c(44));t.default=Object(i.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),i=Object(u.b)(e),d=Object(u.d)(e);return Object(l.isEmpty)(n.tags)?null:Object(r.createElement)("div",{className:a()(t,i.className,"wc-block-components-product-tag-list",{[c+"__product-tag-list"]:c}),style:{...i.style,...d.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(29),l=c(58),i=(c(367),c(44));t.default=Object(l.withProductDataContext)(e=>{const{className:t}=e,{parentClassName:c}=Object(s.useInnerBlockLayoutContext)(),{product:n}=Object(s.useProductDataContext)(),l=Object(i.b)(e),u=Object(i.d)(e);if(!n.id||!n.is_purchasable)return null;const d=!!n.is_in_stock,b=n.low_stock_remaining,p=n.is_on_backorder;return Object(r.createElement)("div",{className:a()(t,l.className,"wc-block-components-product-stock-indicator",{[c+"__stock-indicator"]:c,"wc-block-components-product-stock-indicator--in-stock":d,"wc-block-components-product-stock-indicator--out-of-stock":!d,"wc-block-components-product-stock-indicator--low-stock":!!b,"wc-block-components-product-stock-indicator--available-on-backorder":!!p}),style:{...l.style,...u.style}},b?(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))(b):((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"))(d,p))})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,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 n}));var r=c(1),o=c(22);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(485)},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(18),a=c(14),s=c(40);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){},,,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,"blockSettings",(function(){return Kt}));var r=c(6),o=c.n(r),n=c(0),a=c(1),s=c(5),l=c(13),i=c(115),u=c(540),d=c(65),b=c(4),p=c.n(b),m={category:"woocommerce-product-elements",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],icon:{src:Object(n.createElement)(i.a,{icon:u.a,className:"wc-block-editor-components-block-icon"})},supports:{html:!1},parent:Object(d.a)()?void 0:["@woocommerce/all-products","@woocommerce/single-product"],save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",{className:p()("is-loading",t.className)})},deprecated:[{attributes:{},save:()=>null}]},g=c(280),O=c(3),j=c(10),h=c(102),_=c(281),E=c(97),w=c(139),f=c(29);c(405);var k=e=>t=>c=>{const r=Object(f.useProductDataContext)(),{attributes:o,setAttributes:l}=c,{productId:i}=o,[u,d]=Object(n.useState)(!i);return r.hasContext?Object(n.createElement)(t,c):Object(n.createElement)(n.Fragment,null,u?Object(n.createElement)(O.Placeholder,{icon:e.icon||"",label:e.label||"",className:"wc-atomic-blocks-product"},!!e.description&&Object(n.createElement)("div",null,e.description),Object(n.createElement)("div",{className:"wc-atomic-blocks-product__selection"},Object(n.createElement)(E.a,{selected:i||0,showVariations:!0,onChange:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];l({productId:e[0]?e[0].id:0})}}),Object(n.createElement)(O.Button,{isSecondary:!0,disabled:!i,onClick:()=>{d(!1)}},Object(a.__)("Done","woo-gutenberg-products-block")))):Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(O.ToolbarGroup,null,Object(n.createElement)(w.a,{onClick:()=>d(!0)},Object(a.__)("Switch product…","woo-gutenberg-products-block")))),Object(n.createElement)(t,c)))},y=c(541);const v=Object(a.__)("Product Title","woo-gutenberg-products-block"),S=Object(n.createElement)(i.a,{icon:y.a,className:"wc-block-editor-components-block-icon"}),C=Object(a.__)("Display the title of a product.","woo-gutenberg-products-block");c(406);const x=e=>{let{attributes:t,setAttributes:c}=e;const r=Object(s.useBlockProps)(),{headingLevel:o,showProductLink:l,align:i,linkTarget:u}=t;return Object(n.createElement)("div",r,Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(h.a,{isCollapsed:!0,minLevel:1,maxLevel:7,selectedLevel:o,onChange:e=>c({headingLevel:e})}),Object(d.b)()&&Object(n.createElement)(s.AlignmentToolbar,{value:i,onChange:e=>{c({align:e})}})),Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Link settings","woo-gutenberg-products-block")},Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Make title a link","woo-gutenberg-products-block"),checked:l,onChange:()=>c({showProductLink:!l})}),l&&Object(n.createElement)(n.Fragment,null,Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Open in new tab","woo-gutenberg-products-block"),onChange:e=>c({linkTarget:e?"_blank":"_self"}),checked:"_blank"===u})))),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(_.a,t)))};var N=Object(d.b)()?Object(j.compose)([k({icon:S,label:v,description:Object(a.__)("Choose a product to display its title.","woo-gutenberg-products-block")})])(x):x;const P=e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))};var T=c(95);const R={...m,apiVersion:2,title:v,description:C,icon:{src:S},attributes:g.a,edit:N,save:P,supports:{...m.supports,...Object(d.b)()&&{typography:{fontSize:!0,lineHeight:!0,__experimentalFontWeight:!0,__experimentalTextTransform:!0,__experimentalFontFamily:!0},color:{text:!0,background:!0,link:!1,gradients:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-title"}}};Object(l.registerBlockType)("woocommerce/product-title",R);var I=c(294),A=c(542);const B=Object(a.__)("Product Price","woo-gutenberg-products-block"),L=Object(n.createElement)(i.a,{icon:A.a,className:"wc-block-editor-components-block-icon"}),D=Object(a.__)("Display the price of a product.","woo-gutenberg-products-block");var V=k({icon:L,label:B,description:Object(a.__)("Choose a product to display its price.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const r=Object(s.useBlockProps)();return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(s.BlockControls,null,Object(d.b)()&&Object(n.createElement)(s.AlignmentToolbar,{value:t.textAlign,onChange:e=>{c({textAlign:e})}})),Object(n.createElement)("div",r,Object(n.createElement)(I.default,t)))});let F={productId:{type:"number",default:0}};Object(d.b)()&&(F={...F,textAlign:{type:"string"}});var M=F;const z={...m,apiVersion:2,title:B,description:D,icon:{src:L},attributes:M,edit:V,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))},supports:{...m.supports,...Object(d.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(l.registerBlockType)("woocommerce/product-price",z);var H=c(282);const q={...Object(d.b)()&&{__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-image"}};var G=c(2),Q=c(283),Y=c(543);const U=Object(a.__)("Product Image","woo-gutenberg-products-block"),W=Object(n.createElement)(i.a,{icon:Y.a,className:"wc-block-editor-components-block-icon"}),$=Object(a.__)("Display the main product image","woo-gutenberg-products-block");var K=k({icon:W,label:U,description:Object(a.__)("Choose a product to display its image.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{showProductLink:r,imageSizing:o,showSaleBadge:l,saleBadgeAlign:i}=t,u=Object(s.useBlockProps)();return Object(n.createElement)("div",u,Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Content","woo-gutenberg-products-block")},Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Link to Product Page","woo-gutenberg-products-block"),help:Object(a.__)("Links the image to the single product listing.","woo-gutenberg-products-block"),checked:r,onChange:()=>c({showProductLink:!r})}),Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Show On-Sale Badge","woo-gutenberg-products-block"),help:Object(a.__)('Overlay a "sale" badge if the product is on-sale.',"woo-gutenberg-products-block"),checked:l,onChange:()=>c({showSaleBadge:!l})}),l&&Object(n.createElement)(O.__experimentalToggleGroupControl,{label:Object(a.__)("Sale Badge Alignment","woo-gutenberg-products-block"),value:i,onChange:e=>c({saleBadgeAlign:e})},Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"left",label:Object(a.__)("Left","woo-gutenberg-products-block")}),Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"center",label:Object(a.__)("Center","woo-gutenberg-products-block")}),Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"right",label:Object(a.__)("Right","woo-gutenberg-products-block")})),Object(n.createElement)(O.__experimentalToggleGroupControl,{label:Object(a.__)("Image Sizing","woo-gutenberg-products-block"),help:Object(n.createInterpolateElement)(Object(a.__)("Product image cropping can be modified in the <a>Customizer</a>.","woo-gutenberg-products-block"),{a:Object(n.createElement)("a",{href:Object(G.getAdminLink)("customize.php")+"?autofocus[panel]=woocommerce&autofocus[section]=woocommerce_product_images",target:"_blank",rel:"noopener noreferrer"})}),value:o,onChange:e=>c({imageSizing:e})},Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"full-size",label:Object(a.__)("Full Size","woo-gutenberg-products-block")}),Object(n.createElement)(O.__experimentalToggleGroupControlOption,{value:"cropped",label:Object(a.__)("Cropped","woo-gutenberg-products-block")})))),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Q.a,t)))});const J={apiVersion:2,title:U,description:$,icon:{src:W},attributes:H.a,edit:K,supports:q,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-image",{...m,...J});var X=c(295),Z=c(536);const ee=Object(a.__)("Product Rating","woo-gutenberg-products-block"),te=Object(n.createElement)(i.a,{icon:Z.a,className:"wc-block-editor-components-block-icon"}),ce=Object(a.__)("Display the average rating of a product.","woo-gutenberg-products-block");var re=k({icon:te,label:ee,description:Object(a.__)("Choose a product to display its rating.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)({className:"wp-block-woocommerce-product-rating"});return Object(n.createElement)("div",c,Object(n.createElement)(X.default,t))});const oe={apiVersion:2,title:ee,description:ce,icon:{src:te},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1,__experimentalSkipSerialization:!0},typography:{fontSize:!0,__experimentalSkipSerialization:!0},...Object(T.a)()&&{spacing:{margin:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-rating"}},edit:re,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-rating",{...m,...oe});var ne=c(296),ae=c(544);const se=Object(a.__)("Add to Cart Button","woo-gutenberg-products-block"),le=Object(n.createElement)(i.a,{icon:ae.a,className:"wc-block-editor-components-block-icon"}),ie=Object(a.__)("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 ue=k({icon:le,label:se,description:Object(a.__)("Choose a product to display its add to cart button.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(O.Disabled,null,Object(n.createElement)(ne.default,t)))});const de={apiVersion:2,title:se,description:ie,icon:{src:le},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!0,link:!1,__experimentalSkipSerialization:!0},__experimentalBorder:{radius:!0,__experimentalSkipSerialization:!0},...Object(T.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:ue,save:P};Object(l.registerBlockType)("woocommerce/product-button",{...m,...de});var be=c(297),pe=c(545);const me=Object(a.__)("Product Summary","woo-gutenberg-products-block"),ge=Object(n.createElement)(i.a,{icon:pe.a,className:"wc-block-editor-components-block-icon"}),Oe=Object(a.__)("Display a short description about a product.","woo-gutenberg-products-block");c(408);var je=k({icon:ge,label:me,description:Object(a.__)("Choose a product to display its short description.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(be.default,t))});const he={apiVersion:2,title:me,description:Oe,icon:{src:ge},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-summary"}},edit:je,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-summary",{...m,...he});var _e=c(216),Ee=c(534);const we=Object(a.__)("On-Sale Badge","woo-gutenberg-products-block"),fe=Object(n.createElement)(i.a,{icon:Ee.a,className:"wc-block-editor-components-block-icon"}),ke=Object(a.__)("Displays an on-sale badge if the product is on-sale.","woo-gutenberg-products-block");var ye=k({icon:fe,label:we,description:Object(a.__)("Choose a product to display its sale-badge.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(_e.default,t))});const ve={title:we,description:ke,icon:{src:fe},apiVersion:2,supports:{html:!1,...Object(d.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(T.a)()&&{spacing:{padding:!0,__experimentalSkipSerialization:!0}},__experimentalSelector:".wc-block-components-product-sale-badge"}},attributes:{productId:{type:"number",default:0}},edit:ye,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(l.registerBlockType)("woocommerce/product-sale-badge",{...m,...ve});var Se=c(105),Ce=c(298),xe=c(11),Ne=Object(n.createElement)(xe.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(n.createElement)("path",{d:"M2 6h2v12H2V6m3 0h1v12H5V6m2 0h3v12H7V6m4 0h1v12h-1V6m3 0h2v12h-2V6m3 0h3v12h-3V6m4 0h1v12h-1V6z"}));const Pe=Object(a.__)("Product SKU","woo-gutenberg-products-block"),Te=Object(n.createElement)(i.a,{icon:Ne,className:"wc-block-editor-components-block-icon"}),Re={title:Pe,description:Object(a.__)("Display the SKU of a product.","woo-gutenberg-products-block"),icon:{src:Te},attributes:{productId:{type:"number",default:0}},edit:k({icon:Te,label:Pe,description:Object(a.__)("Choose a product to display its SKU.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(Se.a,null),Object(n.createElement)(Ce.default,t))})};Object(d.c)("woocommerce/product-sku",{...m,...Re});var Ie=c(299),Ae=c(546);const Be=Object(a.__)("Product Category List","woo-gutenberg-products-block"),Le=Object(n.createElement)(i.a,{icon:Ae.a,className:"wc-block-editor-components-block-icon"}),De=Object(a.__)("Display a list of categories belonging to a product.","woo-gutenberg-products-block");var Ve=k({icon:Le,label:Be,description:Object(a.__)("Choose a product to display its categories.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(Se.a,null),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Ie.default,t)))});const Fe={...m,apiVersion:2,title:Be,description:De,icon:{src:Le},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.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(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))},edit:Ve};Object(d.c)("woocommerce/product-category-list",Fe);var Me=c(300),ze=c(539);const He=Object(a.__)("Product Tag List","woo-gutenberg-products-block"),qe=Object(n.createElement)(i.a,{icon:ze.a,className:"wc-block-editor-components-block-icon"}),Ge=Object(a.__)("Display a list of tags belonging to a product.","woo-gutenberg-products-block");var Qe=k({icon:qe,label:He,description:Object(a.__)("Choose a product to display its tags.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(Se.a,null),Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Me.default,t)))});const Ye={apiVersion:2,title:He,description:Ge,icon:{src:qe},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.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(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(d.c)("woocommerce/product-tag-list",{...m,...Ye});var Ue=c(301),We=c(547);const $e=Object(a.__)("Product Stock Indicator","woo-gutenberg-products-block"),Ke=Object(n.createElement)(i.a,{icon:We.a,className:"wc-block-editor-components-block-icon"}),Je=Object(a.__)("Display product stock status.","woo-gutenberg-products-block");var Xe=k({icon:Ke,label:$e,description:Object(a.__)("Choose a product to display its stock.","woo-gutenberg-products-block")})(e=>{let{attributes:t}=e;const c=Object(s.useBlockProps)();return Object(n.createElement)("div",c,Object(n.createElement)(Se.a,null),Object(n.createElement)(Ue.default,t))});const Ze={apiVersion:2,title:$e,description:Je,icon:{src:Ke},attributes:{productId:{type:"number",default:0}},supports:{...Object(d.b)()&&{color:{text:!0,background:!1,link:!1},typography:{fontSize:!0},__experimentalSelector:".wc-block-components-product-stock-indicator"}},edit:Xe,save:e=>{let{attributes:t}=e;return Object(n.createElement)("div",s.useBlockProps.save({className:p()("is-loading",t.className)}))}};Object(d.c)("woocommerce/product-stock-indicator",{...m,...Ze});var et=c(521),tt=(c(279),c(285)),ct=c(218);const rt=Object(a.__)("Add to Cart","woo-gutenberg-products-block"),ot=Object(n.createElement)(i.a,{icon:ct.a,className:"wc-block-editor-components-block-icon"}),nt={title:rt,description:Object(a.__)("Displays an add to cart button. Optionally displays other add to cart form elements.","woo-gutenberg-products-block"),icon:{src:ot},edit:k({icon:ot,label:rt,description:Object(a.__)("Choose a product to display its add to cart form.","woo-gutenberg-products-block")})(e=>{let{attributes:t,setAttributes:c}=e;const{product:r}=Object(f.useProductDataContext)(),{className:o,showFormElements:l}=t;return Object(n.createElement)("div",{className:p()(o,"wc-block-components-product-add-to-cart")},Object(n.createElement)(Se.a,{productId:r.id}),Object(n.createElement)(s.InspectorControls,null,Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Layout","woo-gutenberg-products-block")},Object(et.b)(r)?Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Display form elements","woo-gutenberg-products-block"),help:Object(a.__)("Depending on product type, allow customers to select a quantity, variations etc.","woo-gutenberg-products-block"),checked:l,onChange:()=>c({showFormElements:!l})}):Object(n.createElement)(O.Notice,{className:"wc-block-components-product-add-to-cart-notice",isDismissible:!1,status:"info"},Object(a.__)("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(n.createElement)(O.Disabled,null,Object(n.createElement)(tt.a,t)))}),attributes:c(284).a};Object(d.c)("woocommerce/product-add-to-cart",{...m,...nt});var at=c(24),st=c.n(at),lt=c(9),it=c(64),ut=c(513),dt=c(394),bt=c(22);const pt=(e,t)=>{const{className:c,contentVisibility:r}=t;return p()(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})};var mt=c(233);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(8),ht=c(7),_t=c(30);c(414);var Et=e=>{let{currentPage:t,displayFirstAndLastPages:c=!0,displayNextAndPreviousArrows:r=!0,pagesToDisplay:o=3,onPageChange:s,totalPages:l}=e,{minIndex:i,maxIndex:u}=((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}})(o,t,l);const d=c&&Boolean(1!==i),b=c&&Boolean(u!==l),m=c&&Boolean(i&&i>3),g=c&&Boolean(u&&u<l-2);d&&3===i&&(i-=1),b&&u===l-2&&(u+=1);const O=[];if(i&&u)for(let e=i;e<=u;e++)O.push(e);return Object(n.createElement)("div",{className:"wc-block-pagination wc-block-components-pagination"},Object(n.createElement)(_t.a,{screenReaderLabel:Object(a.__)("Navigate to another page","woo-gutenberg-products-block")}),r&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>s(t-1),title:Object(a.__)("Previous page","woo-gutenberg-products-block"),disabled:t<=1},Object(n.createElement)(_t.a,{label:"←",screenReaderLabel:Object(a.__)("Previous page","woo-gutenberg-products-block")})),d&&Object(n.createElement)("button",{className:p()("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:()=>s(1),disabled:1===t},Object(n.createElement)(_t.a,{label:"1",screenReaderLabel:Object(a.sprintf)(
|
29 |
/* translators: %d is the page number (1, 2, 3...). */
|
30 |
Object(a.__)("Page %d","woo-gutenberg-products-block"),1)})),m&&Object(n.createElement)("span",{className:"wc-block-pagination-ellipsis wc-block-components-pagination__ellipsis","aria-hidden":"true"},Object(a.__)("…","woo-gutenberg-products-block")),O.map(e=>Object(n.createElement)("button",{key:e,className:p()("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:()=>s(e),disabled:t===e},Object(n.createElement)(_t.a,{label:e.toString(),screenReaderLabel:Object(a.sprintf)(
|
31 |
/* translators: %d is the page number (1, 2, 3...). */
|
33 |
/* translators: %d is the page number (1, 2, 3...). */
|
34 |
Object(a.__)("Page %d","woo-gutenberg-products-block"),l)})),r&&Object(n.createElement)("button",{className:"wc-block-pagination-page wc-block-components-pagination__page wc-block-components-pagination-page--arrow",onClick:()=>s(t+1),title:Object(a.__)("Next page","woo-gutenberg-products-block"),disabled:t>=l},Object(n.createElement)(_t.a,{label:"→",screenReaderLabel:Object(a.__)("Next page","woo-gutenberg-products-block")})))},wt=c(111),ft=c(76),kt=c(125),yt=c(18),vt=c(50);var St=c(81);c(415);const Ct=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};var xt=c(46),Nt=c(174),Pt=()=>{const{parentClassName:e}=Object(f.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:e+"__no-products"},Object(n.createElement)(i.a,{className:e+"__no-products-image",icon:Nt.a,size:100}),Object(n.createElement)("strong",{className:e+"__no-products-title"},Object(a.__)("No products","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:e+"__no-products-description"},Object(a.__)("There are currently no products available to display.","woo-gutenberg-products-block")))},Tt=c(538),Rt=e=>{let{resetCallback:t=(()=>{})}=e;const{parentClassName:c}=Object(f.useInnerBlockLayoutContext)();return Object(n.createElement)("div",{className:c+"__no-products"},Object(n.createElement)(i.a,{className:c+"__no-products-image",icon:Tt.a,size:100}),Object(n.createElement)("strong",{className:c+"__no-products-title"},Object(a.__)("No products found","woo-gutenberg-products-block")),Object(n.createElement)("p",{className:c+"__no-products-description"},Object(a.__)("We were unable to find any results based on your search.","woo-gutenberg-products-block")),Object(n.createElement)("button",{onClick:t},Object(a.__)("Reset Search","woo-gutenberg-products-block")))},It=c(121);c(413);var At=e=>{let{onChange:t,value:c}=e;return Object(n.createElement)(It.a,{className:"wc-block-product-sort-select wc-block-components-product-sort-select",onChange:t,options:[{key:"menu_order",label:Object(a.__)("Default sorting","woo-gutenberg-products-block")},{key:"popularity",label:Object(a.__)("Popularity","woo-gutenberg-products-block")},{key:"rating",label:Object(a.__)("Average rating","woo-gutenberg-products-block")},{key:"date",label:Object(a.__)("Latest","woo-gutenberg-products-block")},{key:"price",label:Object(a.__)("Price: low to high","woo-gutenberg-products-block")},{key:"price-desc",label:Object(a.__)("Price: high to low","woo-gutenberg-products-block")}],screenReaderLabel:Object(a.__)("Order products by","woo-gutenberg-products-block"),value:c})};const Bt=(e,t,c,r)=>{if(!c)return;const a=Object(ut.a)(e);return c.map((c,s)=>{let[l,i={}]=c,u=[];i.children&&i.children.length>0&&(u=Bt(e,t,i.children,r));const d=a[l];if(!d)return null;const b=t.id||0,p=["layout",l,s,r,b];return Object(n.createElement)(n.Suspense,{key:p.join("_"),fallback:Object(n.createElement)("div",{className:"wc-block-placeholder"})},Object(n.createElement)(d,o()({},i,{children:u,product:t})))})};var Lt=Object(j.withInstanceId)(e=>{let{product:t={},attributes:c,instanceId:r}=e;const{layoutConfig:o}=c,{parentClassName:a,parentName:s}=Object(f.useInnerBlockLayoutContext)(),l=0===Object.keys(t).length,i=p()(a+"__product","wc-block-layout",{"is-loading":l});return Object(n.createElement)("li",{className:i,"aria-hidden":l},Bt(s,t,o,r))});c(412);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,Mt=(Ft=e=>{let{attributes:t,currentPage:c,onPageChange:r,onSortChange:o,sortValue:s,scrollToTop:l}=e;const[i,u]=Object(ft.b)("attributes",[]),[d,b]=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:s,currentPage:c})),{products:_,totalProducts:E,productsLoading:w}=(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(lt.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(f.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:E},Vt);Object(n.useEffect)(()=>{S("product-list-render",{products:_,listName:y})},[_,y,S]),Object(n.useEffect)(()=>{Object(ht.isEqual)(v,null==C?void 0:C.totalQuery)||(r(1),null!=C&&C.totalQuery&&(e=>{Number.isFinite(e)&&(0===e?Object(xt.speak)(Object(a.__)("No products found","woo-gutenberg-products-block")):Object(xt.speak)(Object(a.sprintf)(
|
35 |
/* translators: %s is an integer higher than 0 (1, 2, 3...) */
|
36 |
+
Object(a._n)("%d product found","%d products found",e,"woo-gutenberg-products-block"),e)))})(E))},[null==C?void 0:C.totalQuery,E,r,v]);const{contentVisibility:x}=t,N=t.columns*t.rows,P=!Number.isFinite(E)&&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(E/N),T=_.length?_:Array.from({length:N}),R=0!==_.length||w,I=i.length>0||d.length>0||Number.isFinite(m)||Number.isFinite(O);return Object(n.createElement)("div",{className:(()=>{const{columns:e,rows:c,alignButtons:r,align:o}=t,n=void 0!==o?"align"+o:"";return p()(k,n,"has-"+e+"-columns",{"has-multiple-rows":c>1,"has-aligned-buttons":r})})()},(null==x?void 0:x.orderBy)&&R&&Object(n.createElement)(At,{onChange:o,value:s}),!R&&I&&Object(n.createElement)(Rt,{resetCallback:()=>{u([]),b([]),g(null),j(null)}}),!R&&!I&&Object(n.createElement)(Pt,null),R&&Object(n.createElement)("ul",{className:k+"__products"},T.map((function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=arguments.length>1?arguments[1]:void 0;return Object(n.createElement)(Lt,{key:e.id||c,attributes:t,product:e})}))),P>1&&Object(n.createElement)(Et,{currentPage:c,onPageChange:e=>{l({focusableSelector:"a, button"}),r(e)},totalPages:P}))},e=>{const t=Object(n.useRef)(null);return Object(n.createElement)(n.Fragment,null,Object(n.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:t,"aria-hidden":!0}),Object(n.createElement)(Ft,o()({},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)}})))}),zt=e=>{let{attributes:t}=e;const[c,r]=Object(n.useState)(1),[o,a]=Object(n.useState)(t.orderby);return Object(n.useEffect)(()=>{a(t.orderby)},[t.orderby]),Object(n.createElement)(Mt,{attributes:t,currentPage:c,onPageChange:e=>{r(e)},onSortChange:e=>{var t;const c=null==e||null===(t=e.target)||void 0===t?void 0:t.value;a(c),r(1)},sortValue:o})},Ht=c(138),qt=c(143),Gt=c(228);class Qt extends jt.Component{render(){const{attributes:e,urlParameterSuffix:t}=this.props;return e.isPreview?Ht.a:Object(n.createElement)(f.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)(qt.a,null,Object(n.createElement)(Gt.a,{context:"wc/all-products"})),Object(n.createElement)(zt,{attributes:e,urlParameterSuffix:t}))}}var Yt=Qt;c(411);class Ut extends n.Component{constructor(){super(...arguments),st()(this,"state",{isEditing:!1,innerBlocks:[]}),st()(this,"blockMap",Object(ut.a)("woocommerce/all-products")),st()(this,"componentDidMount",()=>{const{block:e}=this.props;this.setState({innerBlocks:e.innerBlocks})}),st()(this,"getTitle",()=>Object(a.__)("All Products","woo-gutenberg-products-block")),st()(this,"getIcon",()=>Object(n.createElement)(i.a,{icon:u.a})),st()(this,"togglePreview",()=>{const{debouncedSpeak:e}=this.props;this.setState({isEditing:!this.state.isEditing}),this.state.isEditing||e(Object(a.__)("Showing All Products block preview.","woo-gutenberg-products-block"))}),st()(this,"getInspectorControls",()=>{const{attributes:e,setAttributes:t}=this.props,{columns:c,rows:r,alignButtons:o}=e;return Object(n.createElement)(s.InspectorControls,{key:"inspector"},Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Layout Settings","woo-gutenberg-products-block"),initialOpen:!0},Object(n.createElement)(it.a,{columns:c,rows:r,alignButtons:o,setAttributes:t,minColumns:Object(G.getSetting)("min_columns",1),maxColumns:Object(G.getSetting)("max_columns",6),minRows:Object(G.getSetting)("min_rows",1),maxRows:Object(G.getSetting)("max_rows",6)})),Object(n.createElement)(O.PanelBody,{title:Object(a.__)("Content Settings","woo-gutenberg-products-block")},((e,t)=>{const{contentVisibility:c}=e;return Object(n.createElement)(O.ToggleControl,{label:Object(a.__)("Show Sorting Dropdown","woo-gutenberg-products-block"),checked:c.orderBy,onChange:()=>t({contentVisibility:{...c,orderBy:!c.orderBy}})})})(e,t),((e,t)=>Object(n.createElement)(O.SelectControl,{label:Object(a.__)("Order Products By","woo-gutenberg-products-block"),value:e.orderby,options:[{label:Object(a.__)("Default sorting (menu order)","woo-gutenberg-products-block"),value:"menu_order"},{label:Object(a.__)("Popularity","woo-gutenberg-products-block"),value:"popularity"},{label:Object(a.__)("Average rating","woo-gutenberg-products-block"),value:"rating"},{label:Object(a.__)("Latest","woo-gutenberg-products-block"),value:"date"},{label:Object(a.__)("Price: low to high","woo-gutenberg-products-block"),value:"price"},{label:Object(a.__)("Price: high to low","woo-gutenberg-products-block"),value:"price-desc"}],onChange:e=>t({orderby:e})}))(e,t)))}),st()(this,"getBlockControls",()=>{const{isEditing:e}=this.state;return Object(n.createElement)(s.BlockControls,null,Object(n.createElement)(O.ToolbarGroup,{controls:[{icon:"edit",title:Object(a.__)("Edit inner product layout","woo-gutenberg-products-block"),onClick:()=>this.togglePreview(),isActive:e}]}))}),st()(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(n.createElement)(O.Placeholder,{icon:this.getIcon(),label:this.getTitle()},Object(a.__)("Display all products from your store as a grid.","woo-gutenberg-products-block"),Object(n.createElement)("div",{className:"wc-block-all-products-grid-item-template"},Object(n.createElement)(O.Tip,null,Object(a.__)("Edit the blocks inside the preview below to change the content displayed for each product within the product grid.","woo-gutenberg-products-block")),Object(n.createElement)(f.InnerBlockLayoutContextProvider,{parentName:"woocommerce/all-products",parentClassName:"wc-block-grid"},Object(n.createElement)("div",{className:"wc-block-grid wc-block-layout has-1-columns"},Object(n.createElement)("ul",{className:"wc-block-grid__products"},Object(n.createElement)("li",{className:"wc-block-grid__product"},Object(n.createElement)(f.ProductDataContextProvider,{product:dt.a[0]},Object(n.createElement)(s.InnerBlocks,e)))))),Object(n.createElement)("div",{className:"wc-block-all-products__actions"},Object(n.createElement)(O.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(a.__)("Done","woo-gutenberg-products-block")),Object(n.createElement)(O.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(a.__)("Cancel","woo-gutenberg-products-block")),Object(n.createElement)(O.Button,{className:"wc-block-all-products__reset-button",icon:Object(n.createElement)(i.a,{icon:u.a}),label:Object(a.__)("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(l.createBlock)(t,r)),!0}),t(e.clientId,c,!1),this.setState({innerBlocks:e.innerBlocks})}},Object(a.__)("Reset Layout","woo-gutenberg-products-block")))))}),st()(this,"renderViewMode",()=>{const{attributes:e}=this.props,{layoutConfig:t}=e,c=t&&0!==t.length,r=this.getTitle(),o=this.getIcon();return c?Object(n.createElement)(O.Disabled,null,Object(n.createElement)(Yt,{attributes:e})):((e,t)=>Object(n.createElement)(O.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(a.__)("The content for this block is hidden due to block settings.","woo-gutenberg-products-block")))(r,o)}),st()(this,"render",()=>{const{attributes:e}=this.props,{isEditing:t}=this.state,c=this.getTitle(),r=this.getIcon();return 0===bt.o.productCount?((e,t)=>Object(n.createElement)(O.Placeholder,{className:"wc-block-products",icon:t,label:e},Object(n.createElement)("p",null,Object(a.__)("You haven't published any products to list here yet.","woo-gutenberg-products-block")),Object(n.createElement)(O.Button,{className:"wc-block-products__add-product-button",isSecondary:!0,href:G.ADMIN_URL+"post-new.php?post_type=product"},Object(a.__)("Add new product","woo-gutenberg-products-block")+" ",Object(n.createElement)(i.a,{icon:mt.a})),Object(n.createElement)(O.Button,{className:"wc-block-products__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-products/"},Object(a.__)("Learn more","woo-gutenberg-products-block"))))(c,r):Object(n.createElement)("div",{className:pt("wc-block-all-products",e)},this.getBlockControls(),this.getInspectorControls(),t?this.renderEditMode():this.renderViewMode())})}}var Wt=Object(j.compose)(O.withSpokenMessages,Object(lt.withSelect)((e,t)=>{let{clientId:c}=t;const{getBlock:r}=e("core/block-editor");return{block:r(c)}}),Object(lt.withDispatch)(e=>{const{replaceInnerBlocks:t}=e("core/block-editor");return{replaceInnerBlocks:t}}))(Ut);const $t={columns:Object(G.getSetting)("default_columns",3),rows:Object(G.getSetting)("default_rows",3),alignButtons:!1,contentVisibility:{orderBy:!0},orderby:"date",layoutConfig:gt,isPreview:!1},Kt={title:Object(a.__)("All Products","woo-gutenberg-products-block"),icon:{src:Object(n.createElement)(i.a,{icon:u.a,className:"wc-block-editor-components-block-icon"})},category:"woocommerce",keywords:[Object(a.__)("WooCommerce","woo-gutenberg-products-block")],description:Object(a.__)("Display products from your store in a grid layout.","woo-gutenberg-products-block"),supports:{align:["wide","full"],html:!1,multiple:!1},example:{attributes:{isPreview:!0}},attributes:{columns:{type:"number"},rows:{type:"number"},alignButtons:{type:"boolean"},contentVisibility:{type:"object"},orderby:{type:"string"},layoutConfig:{type:"array"},isPreview:{type:"boolean",default:!1}},defaults:$t,edit:e=>Object(n.createElement)(Wt,e),save(e){let{attributes:t}=e;const c={};Object.keys(t).sort().forEach(e=>{c[e]=t[e]});const r={"data-attributes":JSON.stringify(c)};return Object(n.createElement)("div",o()({className:pt("wc-block-all-products",t)},r),Object(n.createElement)(s.InnerBlocks.Content,null))}};Object(l.registerBlockType)("woocommerce/all-products",{...Kt,deprecated:[{attributes:Object.assign({},Kt.attributes,{rows:{type:"number",default:1}}),save(e){let{attributes:t}=e;const c={"data-attributes":JSON.stringify(t)};return Object(n.createElement)("div",o()({className:pt("wc-block-all-products",t)},c),Object(n.createElement)(s.InnerBlocks.Content,null))}}]})},,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,c){"use strict";c.d(t,"a",(function(){return a}));var r=c(41),o=c(0),n=c(22);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(28)]).then(c.bind(null,294)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-image",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(5),c.e(25)]).then(c.bind(null,566)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-title",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(3),c.e(36)]).then(c.bind(null,567)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-rating",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(29)]).then(c.bind(null,295)))}),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(21)]).then(c.bind(null,296)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-summary",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(33)]).then(c.bind(null,297)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sale-badge",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(5)]).then(c.bind(null,216)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-sku",component:Object(o.lazy)(()=>c.e(31).then(c.bind(null,298)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-category-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(24)]).then(c.bind(null,299)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-tag-list",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(35)]).then(c.bind(null,300)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-stock-indicator",component:Object(o.lazy)(()=>Promise.all([c.e(1),c.e(2),c.e(32)]).then(c.bind(null,301)))}),Object(r.registerBlockComponent)({blockName:"woocommerce/product-add-to-cart",component:Object(o.lazy)(()=>Promise.all([c.e(0),c.e(1),c.e(3),c.e(4),c.e(19)]).then(c.bind(null,568)))});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' => '
|
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' => '70c915a744bc5fed81e4062f7c51ec2c');
|
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={8: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([395,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},107: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},116:function(e,t){},121:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n),a=r(30),i=r(10);r(
|
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.blocks},
|
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(181);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(25),L=r.n(N),x=r(56),A=r(28);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}))}},15:function(e,t){e.exports=window.wp.apiFetch},153:function(e,t){},154:function(e,t){},180:function(e,t){},181:function(e,t){},182:function(e,t){},183:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},22: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",{})},25:function(e,t){e.exports=window.wp.isShallowEqual},28: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")}},3:function(e,t){e.exports=window.wp.components},30: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))}},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},395:function(e,t,r){e.exports=r(503)},5:function(e,t){e.exports=window.wp.blockEditor},503:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(13),a=r(115),i=r(537),s=(r(153),r(5)),l=r(3),d=r(144),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(107),w=r(139),p=r(140),m=r(123);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})},56: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(15),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},74:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(115),a=r(174),i=r(4),s=r.n(i),l=r(3),d=r(32);r(116),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.React}});
|
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={8: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([395,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},107: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},116:function(e,t){},121:function(e,t,r){"use strict";var o=r(0),n=r(4),c=r.n(n),a=r(30),i=r(10);r(155),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))))})},123:function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var o=r(1),n=r(22);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.blocks},14:function(e,t){e.exports=window.wp.htmlEntities},140: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}}},141:function(e,t,r){"use strict";var o=r(6),n=r.n(o),c=r(0),a=r(5),i=(r(154),r(56));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)))}},145:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(7),a=r(3),i=r(5),s=r(8),l=r(2),d=r(74),u=r(30);r(183);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(121);r(180);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(167),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:"…",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(182);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(181);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(25),L=r.n(N),x=r(56),A=r(28);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}))}},15:function(e,t){e.exports=window.wp.apiFetch},154:function(e,t){},155:function(e,t){},180:function(e,t){},181:function(e,t){},182:function(e,t){},183:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},22: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",{})},25:function(e,t){e.exports=window.wp.isShallowEqual},28: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")}},3:function(e,t){e.exports=window.wp.components},30: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))}},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},395:function(e,t,r){e.exports=r(503)},5:function(e,t){e.exports=window.wp.blockEditor},503:function(e,t,r){"use strict";r.r(t);var o=r(0),n=r(1),c=r(13),a=r(115),i=r(537),s=(r(154),r(5)),l=r(3),d=r(145),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(107),w=r(140),p=r(141),m=r(123);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})},56: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(15),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},74:function(e,t,r){"use strict";var o=r(0),n=r(1),c=r(115),a=r(174),i=r(4),s=r.n(i),l=r(3),d=r(32);r(116),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.React}});
|
build/attribute-filter-frontend.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', '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-polyfill', 'wp-primitives', 'wp-url', 'wp-warning'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', '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-polyfill', 'wp-primitives', 'wp-url', 'wp-warning'), 'version' => '016a78d32a5144cc2d044f5fd3156296');
|
build/attribute-filter-frontend.js
CHANGED
@@ -1,29 +1,29 @@
|
|
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=218)}([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.React},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 i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var c=o.apply(null,r);c&&e.push(c)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var s in r)n.call(r,s)&&r[s]&&e.push(s);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.wc.wcBlocksData},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.wp.data},function(e,t,n){e.exports=n(223)()},,function(e,t){e.exports=window.wp.compose},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.isShallowEqual},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),i=n(0),c=n(3),s=n(1),a=n(46),u=e=>{let{imageUrl:t=a.l+"/block-error.svg",header:n=Object(s.__)("Oops!","woo-gutenberg-products-block"),text:r=Object(s.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:c=Object(s.__)("Error:","woo-gutenberg-products-block"),button:u,showErrorBlock:l=!0}=e;return l?Object(i.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(i.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(i.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},n&&Object(i.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},n),r&&Object(i.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},r),o&&Object(i.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},c?c+" ":"",o),u&&Object(i.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},u))):null};n(34);class l extends c.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(i.createElement)(i.Fragment,null,Object(i.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:c,renderError:s,button:a}=this.props,{errorMessage:l,hasError:d}=this.state;return d?"function"==typeof s?s({errorMessage:l}):Object(i.createElement)(u,{showErrorBlock:r,errorMessage:n?l:null,header:e,imageUrl:t,text:o,errorMessagePrefix:c,button:a}):this.props.children}}t.a=l},,function(e,t){e.exports=window.wp.htmlEntities},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";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=window.wp.a11y},function(e,t,n){"use strict";(function(e){var r=n(0);n(36);const o=Object(r.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,n(54))},function(e,t){e.exports=window.wp.deprecated},,function(e,t,n){"use strict";var r=n(0),o=n(5),i=n.n(o);t.a=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:c,wrapperProps:s={}}=e;const a=null!=n,u=null!=o;return!a&&u?(t=c||"span",s={...s,className:i()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,o)):(t=c||r.Fragment,a&&u&&n!==o?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,s,n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0);const o=Object(r.createContext)("page"),i=()=>Object(r.useContext)(o);o.Provider},,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0),o=n(13),i=n.n(o);function c(e){const t=Object(r.useRef)(e);return i()(e,t.current)||(t.current=e),t.current}},,function(e,t){},,function(e,t){e.exports=window.wp.warning},function(e,t,n){"use strict";var r=n(7),o=n(0),i=n(14),c=function({icon:e,className:t,...n}){const i=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(r.a)({className:i},n))};t.a=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return Object(o.createElement)(c,Object(r.a)({icon:e},n));if(Object(o.isValidElement)(e)&&c===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===i.SVG)){const r={width:t,height:t,...e.props,...n};return Object(o.createElement)(i.SVG,r)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...n}):e}},function(e,t,n){"use strict";var r=n(5),o=n.n(r),i=n(0);t.a=Object(i.forwardRef)((function({as:e="div",className:t,...n},r){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(i.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...n,ref:r})}))},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(8),i=n(0),c=n(13),s=n.n(c),a=n(32),u=n(60),l=n(26);const d=e=>{const t=Object(l.a)();e=e||t;const n=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:c}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(i.useCallback)(t=>{c(e,t)},[e,c])]},p=(e,t,n)=>{const c=Object(l.a)();n=n||c;const s=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[s,Object(i.useCallback)(t=>{a(n,e,t)},[n,e,a])]},f=(e,t)=>{const n=Object(l.a)();t=t||n;const[r,o]=d(t),c=Object(a.a)(r),p=Object(a.a)(e),f=Object(u.a)(p),b=Object(i.useRef)(!1);return Object(i.useEffect)(()=>{s()(f,p)||(o(Object.assign({},c,p)),b.current=!0)},[c,p,f,o]),b.current?[r,o]:[e,o]}},,,,function(e,t,n){"use strict";var r=n(7),o=n(0),i=n(5),c=n.n(i),s=n(4),a=n(23),u=n.n(a),l=n(11),d=n(44),p=n(70),f=n(1);function b(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 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 y=n(22);function O(e){const t=Object(o.useContext)(y.a),n=t.slots[e]||{},r=t.fills[e],i=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:i,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 w=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function j({name:e,children:t,registerFill:n,unregisterFill:r}){const i=(e=>{const{getSlot:t,subscribe:n}=Object(o.useContext)(w),[r,i]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(i(t(e)),n(()=>{i(t(e))})),[e]),r})(e),c=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(n(e,c.current),()=>r(e,c.current)),[]),Object(o.useLayoutEffect)(()=>{c.current.children=t,i&&i.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==c.current.name&&(r(c.current.name,c.current),c.current.name=e,n(e,c.current))},[e]),i&&i.node?(Object(s.isFunction)(t)&&(t=t(i.props.fillProps)),Object(o.createPortal)(t,i.node)):null}var E=e=>Object(o.createElement)(w.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(o.createElement)(j,Object(r.a)({},e,{registerFill:t,unregisterFill:n})));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: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,i=Object(s.map)(r(t,this),e=>{const t=Object(s.isFunction)(e.children)?e.children(n):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(s.isString)(e))return e;const n=e.key||t;return Object(o.cloneElement)(e,{key:n})})}).filter(Object(s.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(s.isFunction)(e)?e(i):i)}}var S=e=>Object(o.createElement)(w.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:i})=>Object(o.createElement)(_,Object(r.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:i})));function x(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function k({name:e,children:t}){const n=O(e),r=Object(o.useRef)({rerender:x()});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 I=Object(o.forwardRef)((function({name:e,fillProps:t={},as:n="div",...i},c){const s=Object(o.useContext)(y.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)(n,Object(r.a)({ref:Object(l.useMergeRefs)([c,a])},i))}));function C(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(E,e),Object(o.createElement)(k,e))}n(13),o.Component;const P=Object(o.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(o.createElement)(I,Object(r.a)({},t,{ref:n})):Object(o.createElement)(S,t));function R(e){return"appear"===e?"top":"left"}function T(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:i}=(c=t).ownerDocument.defaultView.getComputedStyle(c);var c;const s=n?parseInt(n,10):0,a=r?parseInt(r,10):0,u=o?parseInt(o,10):0,l=i?parseInt(i,10):0;return{x:e.left+u,y:e.top+s,width:e.width-u-l,height:e.height-s-a,left:e.left+u,right:e.right-l,top:e.top+s,bottom:e.bottom-a}}function A(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function M(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function L(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const D=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:n,className:i,noArrow:s=!0,isAlternate:a,position:m="bottom right",range:h,focusOnMount:g="firstElement",anchorRef:y,shouldAnchorIncludePadding:w,anchorRect:j,getAnchorRect:E,expandOnMobile:_,animate:S=!0,onClickOutside:x,onFocusOutside:k,__unstableStickyBoundaryElement:I,__unstableSlotName:P="Popover",__unstableObserveElement:D,__unstableBoundaryParent:N,__unstableForcePosition:H,__unstableForceXAlignment:F,...B},V)=>{const W=Object(o.useRef)(null),U=Object(o.useRef)(null),K=Object(o.useRef)(),q=Object(l.useViewportMatch)("medium","<"),[$,G]=Object(o.useState)(),Q=O(P),Y=_&&q,[X,J]=Object(l.useResizeObserver)();s=Y||s,Object(o.useLayoutEffect)(()=>{if(Y)return L(K.current,"is-without-arrow",s),L(K.current,"is-alternate",a),A(K.current,"data-x-axis"),A(K.current,"data-y-axis"),M(K.current,"top"),M(K.current,"left"),M(U.current,"maxHeight"),void M(U.current,"maxWidth");const e=()=>{if(!K.current||!U.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 b(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 b(Object(d.getRectangleFromRange)(r),r.endContainer.ownerDocument,i);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=b(r.getBoundingClientRect(),r.ownerDocument,i);return o?e:T(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),c=t.getBoundingClientRect(),s=b(new window.DOMRect(n.left,n.top,n.width,c.bottom-n.top),e.ownerDocument,i);return o?s:T(s,r)}if(!e.current)return;const{parentNode:c}=e.current,s=c.getBoundingClientRect();return o?s:T(s,c)}(W,j,E,y,w,K.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=K.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;N&&(r=null===(i=K.current.closest(".popover-slot"))||void 0===i?void 0:i.parentNode);const c=J.height?J:U.current.getBoundingClientRect(),{popoverTop:u,popoverLeft:l,xAxis:p,yAxis:h,contentHeight:g,contentWidth:v}=function(e,t,n="top",r,o,i,c,s,a){const[u,l="center",d]=n.split(" "),p=function(e,t,n,r,o,i,c,s){const{height:a}=t;if(o){const t=o.getBoundingClientRect().top+a-c;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let u=e.top+e.height/2;"bottom"===r?u=e.bottom:"top"===r&&(u=e.top);const l={popoverTop:u,contentHeight:(u-a/2>0?a/2:u)+(u+a/2>window.innerHeight?window.innerHeight-u: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&&!s)if("middle"===n&&l.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?l.popoverTop:"top"===b?d.popoverTop:p.popoverTop,{yAxis:b,popoverTop:f,contentHeight:m}}(e,t,u,d,r,0,i,s);return{...function(e,t,n,r,o,i,c,s,a){const{width:u}=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 l=Math.round(e.left+e.width/2),d={popoverLeft:l,contentWidth:(l-u/2>0?u/2:l)+(l+u/2>window.innerWidth?window.innerWidth-l:u/2)};let p=e.left;"right"===r?p=e.right:"middle"===i||a||(p=l);let b=e.right;"left"===r?b=e.left:"middle"===i||a||(b=l);const m={popoverLeft:p,contentWidth:p-u>0?u:p},h={popoverLeft:b,contentWidth:b+u>window.innerWidth?window.innerWidth-b:u};let g,v=n,y=null;if(!o&&!s)if("center"===n&&d.contentWidth===u)v="center";else if("left"===n&&m.contentWidth===u)v="left";else if("right"===n&&h.contentWidth===u)v="right";else{v=m.contentWidth>h.contentWidth?"left":"right";const e="left"===v?m.contentWidth:h.contentWidth;u>window.innerWidth&&(y=window.innerWidth),e!==u&&(v="center",d.popoverLeft=window.innerWidth/2)}if(g="center"===v?d.popoverLeft:"left"===v?m.popoverLeft:h.popoverLeft,c){const e=c.getBoundingClientRect();g=Math.min(g,e.right-u),Object(f.isRTL)()||(g=Math.max(g,0))}return{xAxis:v,popoverLeft:g,contentWidth:y}}(e,t,l,d,r,p.yAxis,c,s,a),...p}}(e,c,m,I,K.current,o,r,H,F);"number"==typeof u&&"number"==typeof l&&(M(K.current,"top",u+"px"),M(K.current,"left",l+"px")),L(K.current,"is-without-arrow",s||"center"===p&&"middle"===h),L(K.current,"is-alternate",a),A(K.current,"data-x-axis",p),A(K.current,"data-y-axis",h),M(U.current,"maxHeight","number"==typeof g?g+"px":""),M(U.current,"maxWidth","number"==typeof v?v+"px":""),G(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[h]||"middle"))};e();const{ownerDocument:t}=K.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 c=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(y);let u;return c&&c!==t&&(c.defaultView.addEventListener("resize",e),c.defaultView.addEventListener("scroll",e,!0)),D&&(u=new n.MutationObserver(e),u.observe(D,{attributes:!0})),()=>{n.clearInterval(r),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",i),n.cancelAnimationFrame(o),c&&c!==t&&(c.defaultView.removeEventListener("resize",e),c.defaultView.removeEventListener("scroll",e,!0)),u&&u.disconnect()}},[Y,j,E,y,w,m,J,I,D,N]);const Z=(e,n)=>{if("focus-outside"===e&&k)k(n);else if("focus-outside"===e&&x){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),u()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),x(e)}else t&&t()},[ee,te]=Object(l.__experimentalUseDialog)({focusOnMount:g,__unstableOnClose:Z,onClose:Z}),ne=Object(l.useMergeRefs)([K,ee,V]),re=Boolean(S&&$)&&function(e){if("loading"===e.type)return c()("components-animate__loading");const{type:t,origin:n=R(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return c()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?c()("components-animate__slide-in","is-from-"+n):void 0}({type:"appear",origin:$});let oe=Object(o.createElement)("div",Object(r.a)({className:c()("components-popover",i,re,{"is-expanded":Y,"is-without-arrow":s,"is-alternate":a})},B,{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)(z,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:U,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},X,n)));return Q.ref&&(oe=Object(o.createElement)(C,{name:P},oe)),y||j?oe:Object(o.createElement)("span",{ref:W},oe)});D.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(P,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var N=D,H=function({shortcut:e,className:t}){if(!e)return null;let n,r;return Object(s.isString)(e)&&(n=e),Object(s.isObject)(e)&&(n=e.display,r=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":r},n)};const F=Object(o.createElement)("div",{className:"event-catcher"}),B=({eventHandlers:e,child:t,childrenWithPopover:n})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(F,e),Object(o.cloneElement)(t,{children:n}),","),e),V=({child:e,eventHandlers:t,childrenWithPopover:n})=>Object(o.cloneElement)(e,{...t,children:n}),W=(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 U=function({children:e,position:t,text:n,shortcut:r}){const[i,c]=Object(o.useState)(!1),[a,u]=Object(o.useState)(!1),d=Object(l.useDebounce)(u,700),p=t=>{W(e,"onMouseDown",t),document.addEventListener("mouseup",m),c(!0)},f=t=>{W(e,"onMouseUp",t),document.removeEventListener("mouseup",m),c(!1)},b=e=>"mouseUp"===e?f:"mouseDown"===e?p:void 0,m=b("mouseUp"),h=(t,n)=>r=>{if(W(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&i)return;d.cancel();const o=Object(s.includes)(["focus","mouseenter"],r.type);o!==a&&(n?d(o):u(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")},y=o.Children.only(e),{children:O,disabled:w}=y.props;return(w?B:V)({child:y,eventHandlers:v,childrenWithPopover:(({grandchildren:e,isOver:t,position:n,text:r,shortcut:i})=>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)(H,{className:"components-tooltip__shortcut",shortcut:i}))))({grandchildren:O,isOver:a,position:t,text:n,shortcut:r})})},K=n(37),q=n(38);const $=["onMouseDown","onClick"];var z=t.a=Object(o.forwardRef)((function(e,t){const{href:n,target:i,isSmall:a,isPressed:l,isBusy:d,isDestructive:p,className:f,disabled:b,icon:m,iconPosition:h="left",iconSize:g,showTooltip:v,tooltipPosition:y,shortcut:O,label:w,children:j,text:E,variant:_,__experimentalIsFocusable:S,describedBy:x,...k}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:i,...c}){let s=i;var a,l,d,p,f;return t&&(null!==(a=s)&&void 0!==a||(s="primary")),r&&(null!==(l=s)&&void 0!==l||(s="tertiary")),n&&(null!==(d=s)&&void 0!==d||(s="secondary")),e&&(u()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=s)&&void 0!==p||(s="secondary")),o&&(null!==(f=s)&&void 0!==f||(s="link")),{...c,variant:s}}(e),I=c()("components-button",f,{"is-secondary":"secondary"===_,"is-primary":"primary"===_,"is-small":a,"is-tertiary":"tertiary"===_,"is-pressed":l,"is-busy":d,"is-link":"link"===_,"is-destructive":p,"has-text":!!m&&!!j,"has-icon":!!m}),C=b&&!S,P=void 0===n||C?"button":"a",R="a"===P?{href:n,target:i}:{type:"button",disabled:C,"aria-pressed":l};if(b&&S){R["aria-disabled"]=!0;for(const e of $)k[e]=e=>{e.stopPropagation(),e.preventDefault()}}const T=!C&&(v&&w||O||!!w&&(!j||Object(s.isArray)(j)&&!j.length)&&!1!==v),A=x?Object(s.uniqueId)():null,M=k["aria-describedby"]||A,L=Object(o.createElement)(P,Object(r.a)({},R,k,{className:I,"aria-label":k["aria-label"]||w,"aria-describedby":M,ref:t}),m&&"left"===h&&Object(o.createElement)(K.a,{icon:m,size:g}),E&&Object(o.createElement)(o.Fragment,null,E),m&&"right"===h&&Object(o.createElement)(K.a,{icon:m,size:g}),j);return T?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(U,{text:x||w,shortcut:O,position:y},L),x&&Object(o.createElement)(q.a,null,Object(o.createElement)("span",{id:A},x))):Object(o.createElement)(o.Fragment,null,L,x&&Object(o.createElement)(q.a,null,Object(o.createElement)("span",{id:A},x)))}))},function(e,t){e.exports=window.wp.dom},,function(e,t,n){"use strict";n.d(t,"n",(function(){return i})),n.d(t,"l",(function(){return c})),n.d(t,"k",(function(){return s})),n.d(t,"m",(function(){return a})),n.d(t,"i",(function(){return u})),n.d(t,"d",(function(){return l})),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 i=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),c=i.pluginUrl+"images/",s=i.pluginUrl+"build/",a=i.buildPhase,u=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,l=(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(3);function o(e,t,n){var o=this,i=Object(r.useRef)(null),c=Object(r.useRef)(0),s=Object(r.useRef)(null),a=Object(r.useRef)([]),u=Object(r.useRef)(),l=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=u.current;return a.current=u.current=null,c.current=e,l.current=d.current.apply(n,t)},n=function(e,t){f&&cancelAnimationFrame(s.current),s.current=f?requestAnimationFrame(e):setTimeout(e,t)},r=function(e){if(!p.current)return!1;var n=e-i.current,r=e-c.current;return!i.current||n>=t||n<0||h&&r>=g},v=function(t){return s.current=null,m&&a.current?e(t):(a.current=u.current=null,l.current)},y=function(){var e=Date.now();if(r(e))return v(e);if(p.current){var o=e-i.current,s=e-c.current,a=t-o,u=h?Math.min(a,g-s):a;n(y,u)}},O=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,u.current=o,i.current=m,g){if(!s.current&&p.current)return c.current=i.current,n(y,t),b?e(i.current):l.current;if(h)return n(y,t),e(i.current)}return s.current||n(y,t),l.current};return O.cancel=function(){s.current&&(f?cancelAnimationFrame(s.current):clearTimeout(s.current)),c.current=0,a.current=i.current=u.current=s.current=null},O.isPending=function(){return!!s.current},O.flush=function(){return s.current?v(Date.now()):l.current},O}),[b,h,t,g,m,f])}},function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(12),o=n.n(r),i=n(0),c=n(16);const s=[".wp-block-woocommerce-cart"],a=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:s=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const a=r(e,n),u=s(e,n),l={...e.dataset,...a.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:s={},errorBoundaryProps:a={}}=e;Object(i.render)(Object(i.createElement)(c.a,a,Object(i.createElement)(i.Suspense,{fallback:Object(i.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(i.createElement)(t,o()({},s,{attributes:r})))),n,()=>{n.classList&&n.classList.remove("is-loading")})})({Block:t,container:e,props:a,attributes:l,errorBoundaryProps:u})})},u=e=>{const t=document.body.querySelectorAll(s.join(",")),{Block:n,getProps:r,getErrorBoundaryProps:o,selector:i}=e;(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrappers:i}=e;const c=document.body.querySelectorAll(o);i&&i.length>0&&Array.prototype.filter.call(c,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,i)),a({Block:t,containers:c,getProps:n,getErrorBoundaryProps:r})})({Block:n,getProps:r,getErrorBoundaryProps:o,selector:i,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:i}=e;const c=i.querySelectorAll(o);a({Block:t,containers:c,getProps:n,getErrorBoundaryProps:r})})({...e,wrapper:t})})})}},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";var r=n(0),o=n(1),i=n(25);n(125),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,n&&Number.isFinite(n)&&Object(r.createElement)(i.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 i(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}function s(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:c}catch(e){r=c}}();var a,u=[],l=!1,d=-1;function p(){l&&a&&(l=!1,a.length?u=a.concat(u):d=-1,u.length&&f())}function f(){if(!l){var e=s(p);l=!0;for(var t=u.length;t;){for(a=u,u=[];++d<t;)a&&a[d].run();d=-1,t=u.length}a=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===c||!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];u.push(new b(e,t)),1!==u.length||l||s(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(3);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(8),i=n(0),c=n(32),s=n(74);const a=e=>{const{namespace:t,resourceName:n,resourceValues:a=[],query:u={},shouldSelect:l=!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(i.useRef)({results:[],isLoading:!0}),p=Object(c.a)(u),f=Object(c.a)(a),b=Object(s.a)(),m=Object(o.useSelect)(e=>{if(!l)return null;const o=e(r.COLLECTIONS_STORE_KEY),i=[t,n,p,f],c=o.getCollectionError(...i);if(c){if(!(c instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");b(c)}return{results:o.getCollection(...i),isLoading:!o.hasFinishedResolution("getCollection",i)}},[t,n,f,p,l]);return null!==m&&(d.current=m),d.current}},,,,,,,function(e,t,n){"use strict";var r=n(0),o=n(14);const i=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=i},,function(e,t){e.exports=window.wp.blockEditor},,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),i=n(5),c=n.n(i),s=n(
|
4 |
/* translators: Submit button text for filters. */
|
5 |
-
i=Object(o.__)("Go","woo-gutenberg-products-block"),onClick:a,screenReaderLabel:u=Object(o.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:c()("wc-block-filter-submit-button","wc-block-components-filter-submit-button",t),disabled:n,onClick:a},Object(r.createElement)(s.a,{label:i,screenReaderLabel:u}))}},function(e,t,n){"use strict";var r=n(0),o=n(4),i=n(5),c=n.n(i),s=n(1),a=n(21),u=n(70),l=n(43);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:i=n,onRemove:p=o.noop,isDismissible:f=!0,actions:b=[],politeness:m=d(t),__unstableHTML:
|
6 |
/* translators: %s is referring the remaining count of options */
|
7 |
Object(o._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(o.sprintf)(
|
8 |
/* translators: %s number of options to reveal. */
|
9 |
-
Object(o._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[i,l,d]),m=Object(r.useMemo)(()=>d&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{p(!1)},"aria-expanded":!0,"aria-label":Object(o.__)("Show less options","woo-gutenberg-products-block")},Object(o.__)("Show less","woo-gutenberg-products-block"))),[d]),
|
10 |
/* translators: Remove chip. */
|
11 |
Object(a.__)("Remove","woo-gutenberg-products-block"):Object(a.sprintf)(
|
12 |
/* translators: %s text of the chip to remove. */
|
13 |
-
Object(a.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const g={"aria-label":t,disabled:r,onClick:c,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||c()}},v=p?g:{},y=p?{"aria-hidden":!0}:g;return Object(i.createElement)(d,o()({},m,v,{className:s()(n,"is-removable"),element:p?"button":m.element,screenReaderText:b,text:f}),Object(i.createElement)(h,o()({className:"wc-block-components-chip__remove"},y),Object(i.createElement)(u.a,{className:"wc-block-components-chip__remove-icon",icon:l.a,size:16})))}},,,,,,,,,,,,,,function(e,t,n){e.exports=n(239)},function(e,t){},function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return s}));var r=n(20);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,i=e=>Array.isArray(e)&&e.every(o),c=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),s=e=>Array.isArray(e)&&e.every(c)},function(e,t){},function(e,t,n){"use strict";var r=60103,o=60106,i=60107,c=60108,s=60114,a=60109,u=60110,l=60112,d=60113,p=60120,f=60115,b=60116,m=60121,h=60122,g=60117,v=60129,y=60131;if("function"==typeof Symbol&&Symbol.for){var O=Symbol.for;r=O("react.element"),o=O("react.portal"),i=O("react.fragment"),c=O("react.strict_mode"),s=O("react.profiler"),a=O("react.provider"),u=O("react.context"),l=O("react.forward_ref"),d=O("react.suspense"),p=O("react.suspense_list"),f=O("react.memo"),b=O("react.lazy"),m=O("react.block"),h=O("react.server.block"),g=O("react.fundamental"),v=O("react.debug_trace_mode"),y=O("react.legacy_hidden")}function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case i:case s:case c:case d:case p:return e;default:switch(e=e&&e.$$typeof){case u:case l:case b:case f:case a:return e;default:return t}}case o:return t}}}var j=a,E=r,_=l,S=i,x=b,k=f,I=o,C=s,P=c,R=d;t.ContextConsumer=u,t.ContextProvider=j,t.Element=E,t.ForwardRef=_,t.Fragment=S,t.Lazy=x,t.Memo=k,t.Portal=I,t.Profiler=C,t.StrictMode=P,t.Suspense=R,t.isAsyncMode=function(){return!1},t.isConcurrentMode=function(){return!1},t.isContextConsumer=function(e){return w(e)===u},t.isContextProvider=function(e){return w(e)===a},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===l},t.isFragment=function(e){return w(e)===i},t.isLazy=function(e){return w(e)===b},t.isMemo=function(e){return w(e)===f},t.isPortal=function(e){return w(e)===o},t.isProfiler=function(e){return w(e)===s},t.isStrictMode=function(e){return w(e)===c},t.isSuspense=function(e){return w(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===s||e===v||e===c||e===d||e===p||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===f||e.$$typeof===a||e.$$typeof===u||e.$$typeof===l||e.$$typeof===g||e.$$typeof===m||e[0]===h)},t.typeOf=w},function(e,t,n){"use strict";var r=n(224);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,c){if(c!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(51),o=n(0),i=n(1),c=n(21),s=n(32),a=n(60),u=n(39),l=n(63),d=n(144),p=n(110),f=n(5),b=n.n(f);function m(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var h=n(7);function g(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=n(9),O=n.n(y),w=n(3);function j(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function E(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function _(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return E(n.overflowY,t)||E(n.overflowX,t)||function(e){var t=function(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function S(e,t,n,r,o,i,c,s){return i<e&&c>t||i>e&&c<t?0:i<=e&&s<=n||c>=t&&s>=n?i-e-r:c>t&&s<n||i<e&&s>n?c-t+o:0}n(134);var x=function(){return(x=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.create,Object.create;var k=0;function I(e){return"function"==typeof e?e:C}function C(){}function P(e,t){e&&function(e,t){var n=window,r=t.scrollMode,o=t.block,i=t.inline,c=t.boundary,s=t.skipOverflowHiddenElements,a="function"==typeof c?c:function(e){return e!==c};if(!j(e))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,l=[],d=e;j(d)&&a(d);){if((d=d.parentElement)===u){l.push(d);break}null!=d&&d===document.body&&_(d)&&!_(document.documentElement)||null!=d&&_(d,s)&&l.push(d)}for(var p=n.visualViewport?n.visualViewport.width:innerWidth,f=n.visualViewport?n.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,m=window.scrollY||pageYOffset,h=e.getBoundingClientRect(),g=h.height,v=h.width,y=h.top,O=h.right,w=h.bottom,E=h.left,x="start"===o||"nearest"===o?y:"end"===o?w:y+g/2,k="center"===i?E+v/2:"end"===i?O:E,I=[],C=0;C<l.length;C++){var P=l[C],R=P.getBoundingClientRect(),T=R.height,A=R.width,M=R.top,L=R.right,D=R.bottom,N=R.left;if("if-needed"===r&&y>=0&&E>=0&&w<=f&&O<=p&&y>=M&&w<=D&&E>=N&&O<=L)return I;var H=getComputedStyle(P),F=parseInt(H.borderLeftWidth,10),B=parseInt(H.borderTopWidth,10),V=parseInt(H.borderRightWidth,10),W=parseInt(H.borderBottomWidth,10),U=0,K=0,q="offsetWidth"in P?P.offsetWidth-P.clientWidth-F-V:0,$="offsetHeight"in P?P.offsetHeight-P.clientHeight-B-W:0;if(u===P)U="start"===o?x:"end"===o?x-f:"nearest"===o?S(m,m+f,f,B,W,m+x,m+x+g,g):x-f/2,K="start"===i?k:"center"===i?k-p/2:"end"===i?k-p:S(b,b+p,p,F,V,b+k,b+k+v,v),U=Math.max(0,U+m),K=Math.max(0,K+b);else{U="start"===o?x-M-B:"end"===o?x-D+W+$:"nearest"===o?S(M,D,T,B,W+$,x,x+g,g):x-(M+T/2)+$/2,K="start"===i?k-N-F:"center"===i?k-(N+A/2)+q/2:"end"===i?k-L+V+q:S(N,L,A,F,V+q,k,k+v,v);var z=P.scrollLeft,G=P.scrollTop;x+=G-(U=Math.max(0,Math.min(G+U,P.scrollHeight-T+$))),k+=z-(K=Math.max(0,Math.min(z+K,P.scrollWidth-A+q)))}I.push({el:P,top:U,left:K})}return I}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"}).forEach((function(e){var t=e.el,n=e.top,r=e.left;t.scrollTop=n,t.scrollLeft=r}))}function R(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function T(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,i=new Array(o),c=0;c<o;c++)i[c]=arguments[c];r(),n=setTimeout((function(){n=null,e.apply(void 0,i)}),t)}return o.cancel=r,o}function A(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return t.some((function(t){return t&&t.apply(void 0,[e].concat(r)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function M(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}function L(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function D(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var N=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function H(e){void 0===e&&(e={});var t={};return N.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function F(e,t){return void 0!==e[t]}function B(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function V(e,t,n,r,o){if(void 0===o&&(o=!0),0===n)return-1;var i=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:i+1);var c=t+e;c<0?c=o?i:0:c>i&&(c=o?0:i);var s=W(e,c,n,r,o);return-1===s?t>=n?-1:t:s}function W(e,t,n,r,o){var i=r(t);if(!i||!i.hasAttribute("disabled"))return t;if(e>0){for(var c=t+1;c<n;c++)if(!r(c).hasAttribute("disabled"))return c}else for(var s=t-1;s>=0;s--)if(!r(s).hasAttribute("disabled"))return s;return o?e>0?W(1,0,n,r,!1):W(-1,n-1,n,r,!1):-1}function U(e,t,n,r){return void 0===r&&(r=!0),t.some((function(t){return t&&(R(t,e,n)||r&&R(t,n.document.activeElement,n))}))}var K=T((function(e){$(e).textContent=""}),500);function q(e,t){var n=$(t);e&&(n.textContent=e,K(t))}function $(e){void 0===e&&(e=document);var t=e.getElementById("a11y-status-message");return t||((t=e.createElement("div")).setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var z=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16}),G=["refKey","ref"],Q=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Y=["onKeyDown","onBlur","onChange","onInput","onChangeText"],X=["refKey","ref"],J=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Z=function(){var e=function(e){var t,n;function r(t){var n;(n=e.call(this,t)||this).id=n.props.id||"downshift-"+String(k++),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var r=setTimeout((function(){n.timeoutIds=n.timeoutIds.filter((function(e){return e!==r})),e()}),t);n.timeoutIds.push(r)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=H(t),n.internalSetState(Object(h.a)({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,r){t=H(t),n.internalSetState(Object(h.a)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),r)},n.selectItemAtIndex=function(e,t,r){var o=n.items[e];null!=o&&n.selectItem(o,t,r)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var r,o,i={},c="function"==typeof e;return!c&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,Object(h.a)({},n.getStateAndHelpers(),e)),n.setState((function(t){t=n.getState(t);var s=c?e(t):e;s=n.props.stateReducer(t,s),r=s.hasOwnProperty("selectedItem");var a={},u={};return r&&s.selectedItem!==t.selectedItem&&(o=s.selectedItem),s.type=s.type||0,Object.keys(s).forEach((function(e){t[e]!==s[e]&&(i[e]=s[e]),"type"!==e&&(u[e]=s[e],F(n.props,e)||(a[e]=s[e]))})),c&&s.hasOwnProperty("inputValue")&&n.props.onInputValueChange(s.inputValue,Object(h.a)({},n.getStateAndHelpers(),s)),a}),(function(){I(t)(),Object.keys(i).length>1&&n.props.onStateChange(i,n.getStateAndHelpers()),r&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==o&&n.props.onChange(o,n.getStateAndHelpers()),n.props.onUserAction(i,n.getStateAndHelpers())}))},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,c=void 0===i?"ref":i,s=o.ref,a=m(o,G),u=(void 0===t?{}:t).suppressRefError,l=void 0!==u&&u;n.getRootProps.called=!0,n.getRootProps.refKey=c,n.getRootProps.suppressRefError=l;var d=n.getState().isOpen;return Object(h.a)(((r={})[c]=M(s,n.rootRef),r.role="combobox",r["aria-expanded"]=d,r["aria-haspopup"]="listbox",r["aria-owns"]=d?n.menuId:null,r["aria-labelledby"]=n.labelId,r),a)},n.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:4})}else this.internalSetState({isOpen:!0,type:4},(function(){var e=t.getItemCount();if(e>0){var n=V(1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:4})}}))},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:3})}else this.internalSetState({isOpen:!0,type:3},(function(){var e=t.getItemCount();if(e>0){var n=V(-1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:3})}}))},Enter:function(e){if(229!==e.which){var t=this.getState(),n=t.isOpen,r=t.highlightedIndex;if(n&&null!=r){e.preventDefault();var o=this.items[r],i=this.getItemNodeFromIndex(r);if(null==o||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}}},Escape:function(e){e.preventDefault(),this.reset(Object(h.a)({type:5},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},n.buttonKeyDownHandlers=Object(h.a)({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),n.inputKeyDownHandlers=Object(h.a)({},n.keyDownHandlers,{Home:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var r=this.getItemCount();if(!(r<=0)&&n){var o=W(1,0,r,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:7})}}},End:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var r=this.getItemCount();if(!(r<=0)&&n){var o=W(-1,r-1,r,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:8})}}}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,r=t.onClick;t.onPress;var o=t.onKeyDown,i=t.onKeyUp,c=t.onBlur,s=m(t,Q),a=n.getState().isOpen,u={onClick:A(r,n.buttonHandleClick),onKeyDown:A(o,n.buttonHandleKeyDown),onKeyUp:A(i,n.buttonHandleKeyUp),onBlur:A(c,n.buttonHandleBlur)},l=s.disabled?{}:u;return Object(h.a)({type:"button",role:"button","aria-label":a?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},l,s)},n.buttonHandleKeyUp=function(e){e.preventDefault()},n.buttonHandleKeyDown=function(e){var t=B(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(g(n),e)},n.buttonHandleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout((function(){return n.toggleMenu({type:13})}))},n.buttonHandleBlur=function(e){var t=e.target;n.internalSetTimeout((function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:14})}))},n.getLabelProps=function(e){return Object(h.a)({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,r=t.onKeyDown,o=t.onBlur,i=t.onChange,c=t.onInput;t.onChangeText;var s,a=m(t,Y),u={},l=n.getState(),d=l.inputValue,p=l.isOpen,f=l.highlightedIndex;return a.disabled||((s={}).onChange=A(i,c,n.inputHandleChange),s.onKeyDown=A(r,n.inputHandleKeyDown),s.onBlur=A(o,n.inputHandleBlur),u=s),Object(h.a)({"aria-autocomplete":"list","aria-activedescendant":p&&"number"==typeof f&&f>=0?n.getItemId(f):null,"aria-controls":p?n.menuId:null,"aria-labelledby":n.labelId,autoComplete:"off",value:d,id:n.inputId},u,a)},n.inputHandleKeyDown=function(e){var t=B(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(g(n),e)},n.inputHandleChange=function(e){n.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleBlur=function(){n.internalSetTimeout((function(){var e=n.props.environment.document&&!!n.props.environment.document.activeElement&&!!n.props.environment.document.activeElement.dataset&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:10})}))},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,c=void 0===i?"ref":i,s=o.ref,a=m(o,X),u=(void 0===t?{}:t).suppressRefError,l=void 0!==u&&u;return n.getMenuProps.called=!0,n.getMenuProps.refKey=c,n.getMenuProps.suppressRefError=l,Object(h.a)(((r={})[c]=M(s,n.menuRef),r.role="listbox",r["aria-labelledby"]=a&&a["aria-label"]?null:n.labelId,r.id=n.menuId,r),a)},n.getItemProps=function(e){var t,r=void 0===e?{}:e,o=r.onMouseMove,i=r.onMouseDown,c=r.onClick;r.onPress;var s=r.index,a=r.item,u=void 0===a?void 0:a,l=m(r,J);void 0===s?(n.items.push(u),s=n.items.indexOf(u)):n.items[s]=u;var d=c,p=((t={onMouseMove:A(o,(function(){s!==n.getState().highlightedIndex&&(n.setHighlightedIndex(s,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:A(i,(function(e){e.preventDefault()}))}).onClick=A(d,(function(){n.selectItemAtIndex(s,{type:9})})),t),f=l.disabled?{onMouseDown:p.onMouseDown}:p;return Object(h.a)({id:n.getItemId(s),role:"option","aria-selected":n.getState().highlightedIndex===s},f,l)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=H(e),n.internalSetState((function(t){var r=t.selectedItem;return Object(h.a)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(r)},e)}),t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=H(e),n.internalSetState((function(t){var r=t.isOpen;return Object(h.a)({isOpen:!r},r&&{highlightedIndex:n.props.defaultHighlightedIndex},e)}),(function(){var r=n.getState(),o=r.isOpen,i=r.highlightedIndex;o&&n.getItemCount()>0&&"number"==typeof i&&n.setHighlightedIndex(i,e),I(t)()}))},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=T((function(){var e=n.getState(),t=n.items[e.highlightedIndex],r=n.getItemCount(),o=n.props.getA11yStatusMessage(Object(h.a)({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:r,highlightedItem:t},e));n.previousResultCount=r,q(o,n.props.environment.document)}),200);var r=n.props,o=r.defaultHighlightedIndex,i=r.initialHighlightedIndex,c=void 0===i?o:i,s=r.defaultIsOpen,a=r.initialIsOpen,u=void 0===a?s:a,l=r.initialInputValue,d=void 0===l?"":l,p=r.initialSelectedItem,f=void 0===p?null:p,b=n.getState({highlightedIndex:c,isOpen:u,inputValue:d,selectedItem:f});return null!=b.selectedItem&&void 0===n.props.initialInputValue&&(b.inputValue=n.props.itemToString(b.selectedItem)),n.state=b,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,v(t,n);var o=r.prototype;return o.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},o.getState=function(e){return void 0===e&&(e=this.state),t=e,n=this.props,Object.keys(t).reduce((function(e,r){return e[r]=F(n,r)?n[r]:t[r],e}),{});var t,n},o.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},o.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},o.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},o.moveHighlightedIndex=function(e,t){var n=this,r=this.getItemCount(),o=this.getState().highlightedIndex;if(r>0){var i=V(e,o,r,(function(e){return n.getItemNodeFromIndex(e)}));this.setHighlightedIndex(i,t)}},o.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,r=e.selectedItem,o=e.isOpen,i=this.props.itemToString,c=this.id,s=this.getRootProps,a=this.getToggleButtonProps,u=this.getLabelProps,l=this.getMenuProps,d=this.getInputProps,p=this.getItemProps,f=this.openMenu,b=this.closeMenu,m=this.toggleMenu,h=this.selectItem,g=this.selectItemAtIndex,v=this.selectHighlightedItem,y=this.setHighlightedIndex,O=this.clearSelection,w=this.clearItems;return{getRootProps:s,getToggleButtonProps:a,getLabelProps:u,getMenuProps:l,getInputProps:d,getItemProps:p,reset:this.reset,openMenu:f,closeMenu:b,toggleMenu:m,selectItem:h,selectItemAtIndex:g,selectHighlightedItem:v,setHighlightedIndex:y,clearSelection:O,clearItems:w,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:i,id:c,highlightedIndex:t,inputValue:n,isOpen:o,selectedItem:r}},o.componentDidMount=function(){var e=this,t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,!U(t.target,[e._rootNode,e._menuNode],e.props.environment)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},r=function(){e.isTouchMove=!1},o=function(){e.isTouchMove=!0},i=function(t){var n=U(t.target,[e._rootNode,e._menuNode],e.props.environment,!1);e.isTouchMove||n||!e.getState().isOpen||e.reset({type:16},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},c=this.props.environment;c.addEventListener("mousedown",t),c.addEventListener("mouseup",n),c.addEventListener("touchstart",r),c.addEventListener("touchmove",o),c.addEventListener("touchend",i),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),c.removeEventListener("mousedown",t),c.removeEventListener("mouseup",n),c.removeEventListener("touchstart",r),c.removeEventListener("touchmove",o),c.removeEventListener("touchend",i)}},o.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,r=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==r},o.componentDidUpdate=function(e,t){F(this.props,"selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},o.componentWillUnmount=function(){this.cleanup()},o.render=function(){var e=D(this.props.children,C);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=D(e(this.getStateAndHelpers()));return t?this.getRootProps.called||this.props.suppressRefError?t:function(e){return"string"==typeof e.type}(t)?Object(w.cloneElement)(t,this.getRootProps(function(e){return e.props}(t))):void 0:null},r}(w.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:L,itemToString:function(e){return null==e?"":String(e)},onStateChange:C,onInputValueChange:C,onUserAction:C,onChange:C,onSelect:C,onOuterClick:C,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:P},e.stateChangeTypes=z,e}();T((function(e,t){q(e(),t)}),200),"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?w.useLayoutEffect:w.useEffect;var ee={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+" has been selected.":""},scrollIntoView:P,circularNavigation:!1,environment:"undefined"==typeof window?{}:window};O.a.array.isRequired,O.a.func,O.a.func,O.a.func,O.a.bool,O.a.number,O.a.number,O.a.number,O.a.bool,O.a.bool,O.a.bool,O.a.any,O.a.any,O.a.any,O.a.string,O.a.string,O.a.string,O.a.func,O.a.string,O.a.func,O.a.func,O.a.func,O.a.func,O.a.func,O.a.shape({addEventListener:O.a.func,removeEventListener:O.a.func,document:O.a.shape({getElementById:O.a.func,activeElement:O.a.any,body:O.a.any})}),x(x({},ee),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.":"":"No results are available.":""}}),O.a.array.isRequired,O.a.func,O.a.func,O.a.func,O.a.bool,O.a.number,O.a.number,O.a.number,O.a.bool,O.a.bool,O.a.bool,O.a.any,O.a.any,O.a.any,O.a.string,O.a.string,O.a.string,O.a.string,O.a.string,O.a.string,O.a.func,O.a.string,O.a.string,O.a.func,O.a.func,O.a.func,O.a.func,O.a.func,O.a.func,O.a.shape({addEventListener:O.a.func,removeEventListener:O.a.func,document:O.a.shape({getElementById:O.a.func,activeElement:O.a.any,body:O.a.any})}),Object(h.a)({},ee,{getA11yStatusMessage:L,circularNavigation:!0}),O.a.array,O.a.array,O.a.array,O.a.func,O.a.func,O.a.func,O.a.number,O.a.number,O.a.number,O.a.func,O.a.func,O.a.string,O.a.string,O.a.shape({addEventListener:O.a.func,removeEventListener:O.a.func,document:O.a.shape({getElementById:O.a.func,activeElement:O.a.any,body:O.a.any})});var te=e=>{let{checked:t,getInputProps:n,inputRef:r,isDisabled:i,onFocus:c,onRemoveItem:s,placeholder:a,tabIndex:u,value:l}=e;return Object(o.createElement)("input",n({ref:r,className:"wc-block-dropdown-selector__input wc-block-components-dropdown-selector__input",disabled:i,onFocus:c,onKeyDown(e){"Backspace"===e.key&&!l&&t.length>0&&s(t[t.length-1])},placeholder:a,tabIndex:u}))},ne=e=>{let{children:t,onClick:n}=e;return Object(o.createElement)("div",{className:"wc-block-dropdown-selector__input-wrapper wc-block-components-dropdown-selector__input-wrapper",onClick:n},t)},re=e=>{let{checked:t,getItemProps:n,getMenuProps:r,highlightedIndex:c,options:s}=e;return Object(o.createElement)("ul",r({className:"wc-block-dropdown-selector__list wc-block-components-dropdown-selector__list"}),s.map((e,r)=>{const s=t.includes(e.value);return Object(o.createElement)("li",n({key:e.value,className:b()("wc-block-dropdown-selector__list-item","wc-block-components-dropdown-selector__list-item",{"is-selected":s,"is-highlighted":c===r}),index:r,item:e.value,"aria-label":s?Object(i.sprintf)(
|
14 |
/* translators: %s is referring to the filter option being removed. */
|
15 |
Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),e.name):null}),e.label)}))},oe=n(204),ie=e=>{let{onRemoveItem:t,option:n}=e;return Object(o.createElement)(oe.a,{className:"wc-block-dropdown-selector__selected-chip wc-block-components-dropdown-selector__selected-chip",removeOnAnyClick:!0,onRemove:()=>{t(n.value)},ariaLabel:Object(i.sprintf)(
|
16 |
/* translators: %s is referring to the filter option being removed. */
|
17 |
-
Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),n.name),text:n.label,radius:"large"})},ce=n(
|
18 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
19 |
Object(i.__)("Replace current %s filter","woo-gutenberg-products-block"),r.name)},r.label),Object(o.createElement)("button",{className:"wc-block-dropdown-selector__selected-value__remove wc-block-components-dropdown-selector__selected-value__remove",onClick:()=>{n(r.value)},onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||n(r.value)},"aria-label":Object(i.sprintf)(
|
20 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
21 |
-
Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),r.name)},Object(o.createElement)(ce.a,{icon:se.a,size:16})))};n(221);var ue=e=>{let{attributeLabel:t="",className:n,style:r={},checked:c=[],inputLabel:s="",isDisabled:a=!1,isLoading:u=!1,multiple:l=!1,onChange:d=(()=>{}),options:p=[],isCaseSensitive:f=!1}=e;const m=Object(o.useRef)(null),
|
22 |
/* translators: %s attribute name. */
|
23 |
-
Object(i.__)("Any %s","woo-gutenberg-products-block"),t),tabIndex:!l&&c.length>0?"-1":"0",value:O})),w&&!a&&Object(o.createElement)(re,{checked:c,getItemProps:u,getMenuProps:v,highlightedIndex:y,options:p.filter(e=>{let t=e.name,n=null==O?void 0:O.trim();var r;return f||(t=t.toLowerCase(),n=null===(r=n)||void 0===r?void 0:r.toLowerCase()),!n||t.includes(n)})}))})},le=n(53),de=n(76),pe=n(13),fe=n.n(pe),be=n(18),me=n(77),
|
24 |
/* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
|
25 |
Object(i.__)("%1$s filter replaced with %2$s.","woo-gutenberg-products-block"),o,s)):o?Object(c.speak)(Object(i.sprintf)(
|
26 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
27 |
Object(i.__)("%s filter added.","woo-gutenberg-products-block"),o)):s&&Object(c.speak)(Object(i.sprintf)(
|
28 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
29 |
-
Object(i.__)("%s filter removed.","woo-gutenberg-products-block"),s))},r=
|
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=218)}([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.React},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 i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)){if(r.length){var c=o.apply(null,r);c&&e.push(c)}}else if("object"===i)if(r.toString===Object.prototype.toString)for(var s in r)n.call(r,s)&&r[s]&&e.push(s);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.wc.wcBlocksData},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.wp.data},function(e,t,n){e.exports=n(223)()},,function(e,t){e.exports=window.wp.compose},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.isShallowEqual},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),i=n(0),c=n(3),s=n(1),a=n(46),u=e=>{let{imageUrl:t=a.l+"/block-error.svg",header:n=Object(s.__)("Oops!","woo-gutenberg-products-block"),text:r=Object(s.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:c=Object(s.__)("Error:","woo-gutenberg-products-block"),button:u,showErrorBlock:l=!0}=e;return l?Object(i.createElement)("div",{className:"wc-block-error wc-block-components-error"},t&&Object(i.createElement)("img",{className:"wc-block-error__image wc-block-components-error__image",src:t,alt:""}),Object(i.createElement)("div",{className:"wc-block-error__content wc-block-components-error__content"},n&&Object(i.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},n),r&&Object(i.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},r),o&&Object(i.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},c?c+" ":"",o),u&&Object(i.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},u))):null};n(34);class l extends c.Component{constructor(){super(...arguments),o()(this,"state",{errorMessage:"",hasError:!1})}static getDerivedStateFromError(e){return void 0!==e.statusText&&void 0!==e.status?{errorMessage:Object(i.createElement)(i.Fragment,null,Object(i.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:c,renderError:s,button:a}=this.props,{errorMessage:l,hasError:d}=this.state;return d?"function"==typeof s?s({errorMessage:l}):Object(i.createElement)(u,{showErrorBlock:r,errorMessage:n?l:null,header:e,imageUrl:t,text:o,errorMessagePrefix:c,button:a}):this.props.children}}t.a=l},,function(e,t){e.exports=window.wp.htmlEntities},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";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=window.wp.a11y},function(e,t,n){"use strict";(function(e){var r=n(0);n(36);const o=Object(r.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,n(54))},,function(e,t){e.exports=window.wp.deprecated},,function(e,t,n){"use strict";var r=n(0),o=n(5),i=n.n(o);t.a=e=>{let t,{label:n,screenReaderLabel:o,wrapperElement:c,wrapperProps:s={}}=e;const a=null!=n,u=null!=o;return!a&&u?(t=c||"span",s={...s,className:i()(s.className,"screen-reader-text")},Object(r.createElement)(t,s,o)):(t=c||r.Fragment,a&&u&&n!==o?Object(r.createElement)(t,s,Object(r.createElement)("span",{"aria-hidden":"true"},n),Object(r.createElement)("span",{className:"screen-reader-text"},o)):Object(r.createElement)(t,s,n))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(0);const o=Object(r.createContext)("page"),i=()=>Object(r.useContext)(o);o.Provider},,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(0),o=n(13),i=n.n(o);function c(e){const t=Object(r.useRef)(e);return i()(e,t.current)||(t.current=e),t.current}},,function(e,t){},,function(e,t){e.exports=window.wp.warning},function(e,t,n){"use strict";var r=n(7),o=n(0),i=n(14),c=function({icon:e,className:t,...n}){const i=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(r.a)({className:i},n))};t.a=function({icon:e=null,size:t=24,...n}){if("string"==typeof e)return Object(o.createElement)(c,Object(r.a)({icon:e},n));if(Object(o.isValidElement)(e)&&c===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===i.SVG)){const r={width:t,height:t,...e.props,...n};return Object(o.createElement)(i.SVG,r)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...n}):e}},function(e,t,n){"use strict";var r=n(5),o=n.n(r),i=n(0);t.a=Object(i.forwardRef)((function({as:e="div",className:t,...n},r){return function({as:e="div",...t}){return"function"==typeof t.children?t.children(t):Object(i.createElement)(e,t)}({as:e,className:o()("components-visually-hidden",t),...n,ref:r})}))},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(8),i=n(0),c=n(13),s=n.n(c),a=n(32),u=n(60),l=n(27);const d=e=>{const t=Object(l.a)();e=e||t;const n=Object(o.useSelect)(t=>t(r.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:c}=Object(o.useDispatch)(r.QUERY_STATE_STORE_KEY);return[n,Object(i.useCallback)(t=>{c(e,t)},[e,c])]},p=(e,t,n)=>{const c=Object(l.a)();n=n||c;const s=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[s,Object(i.useCallback)(t=>{a(n,e,t)},[n,e,a])]},f=(e,t)=>{const n=Object(l.a)();t=t||n;const[r,o]=d(t),c=Object(a.a)(r),p=Object(a.a)(e),f=Object(u.a)(p),b=Object(i.useRef)(!1);return Object(i.useEffect)(()=>{s()(f,p)||(o(Object.assign({},c,p)),b.current=!0)},[c,p,f,o]),b.current?[r,o]:[e,o]}},,,,function(e,t,n){"use strict";var r=n(7),o=n(0),i=n(5),c=n.n(i),s=n(4),a=n(24),u=n.n(a),l=n(11),d=n(44),p=n(70),f=n(1);function b(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 m=0;function g(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 h=0;function v(){return Object(o.useEffect)(()=>(0===h&&g(!0),++h,()=>{1===h&&g(!1),--h}),[]),null}var y=n(22);function O(e){const t=Object(o.useContext)(y.a),n=t.slots[e]||{},r=t.fills[e],i=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:i,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 w=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function j({name:e,children:t,registerFill:n,unregisterFill:r}){const i=(e=>{const{getSlot:t,subscribe:n}=Object(o.useContext)(w),[r,i]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(i(t(e)),n(()=>{i(t(e))})),[e]),r})(e),c=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(n(e,c.current),()=>r(e,c.current)),[]),Object(o.useLayoutEffect)(()=>{c.current.children=t,i&&i.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==c.current.name&&(r(c.current.name,c.current),c.current.name=e,n(e,c.current))},[e]),i&&i.node?(Object(s.isFunction)(t)&&(t=t(i.props.fillProps)),Object(o.createPortal)(t,i.node)):null}var E=e=>Object(o.createElement)(w.Consumer,null,({registerFill:t,unregisterFill:n})=>Object(o.createElement)(j,Object(r.a)({},e,{registerFill:t,unregisterFill:n})));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: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,i=Object(s.map)(r(t,this),e=>{const t=Object(s.isFunction)(e.children)?e.children(n):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(s.isString)(e))return e;const n=e.key||t;return Object(o.cloneElement)(e,{key:n})})}).filter(Object(s.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(s.isFunction)(e)?e(i):i)}}var S=e=>Object(o.createElement)(w.Consumer,null,({registerSlot:t,unregisterSlot:n,getFills:i})=>Object(o.createElement)(_,Object(r.a)({},e,{registerSlot:t,unregisterSlot:n,getFills:i})));function x(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function k({name:e,children:t}){const n=O(e),r=Object(o.useRef)({rerender:x()});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 I=Object(o.forwardRef)((function({name:e,fillProps:t={},as:n="div",...i},c){const s=Object(o.useContext)(y.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)(n,Object(r.a)({ref:Object(l.useMergeRefs)([c,a])},i))}));function C(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(E,e),Object(o.createElement)(k,e))}n(13),o.Component;const R=Object(o.forwardRef)(({bubblesVirtually:e,...t},n)=>e?Object(o.createElement)(I,Object(r.a)({},t,{ref:n})):Object(o.createElement)(S,t));function P(e){return"appear"===e?"top":"left"}function T(e,t){const{paddingTop:n,paddingBottom:r,paddingLeft:o,paddingRight:i}=(c=t).ownerDocument.defaultView.getComputedStyle(c);var c;const s=n?parseInt(n,10):0,a=r?parseInt(r,10):0,u=o?parseInt(o,10):0,l=i?parseInt(i,10):0;return{x:e.left+u,y:e.top+s,width:e.width-u-l,height:e.height-s-a,left:e.left+u,right:e.right-l,top:e.top+s,bottom:e.bottom-a}}function A(e,t,n){n?e.getAttribute(t)!==n&&e.setAttribute(t,n):e.hasAttribute(t)&&e.removeAttribute(t)}function M(e,t,n=""){e.style[t]!==n&&(e.style[t]=n)}function L(e,t,n){n?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const D=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:n,className:i,noArrow:s=!0,isAlternate:a,position:m="bottom right",range:g,focusOnMount:h="firstElement",anchorRef:y,shouldAnchorIncludePadding:w,anchorRect:j,getAnchorRect:E,expandOnMobile:_,animate:S=!0,onClickOutside:x,onFocusOutside:k,__unstableStickyBoundaryElement:I,__unstableSlotName:R="Popover",__unstableObserveElement:D,__unstableBoundaryParent:N,__unstableForcePosition:H,__unstableForceXAlignment:F,...B},V)=>{const W=Object(o.useRef)(null),U=Object(o.useRef)(null),K=Object(o.useRef)(),q=Object(l.useViewportMatch)("medium","<"),[$,G]=Object(o.useState)(),Q=O(R),Y=_&&q,[X,J]=Object(l.useResizeObserver)();s=Y||s,Object(o.useLayoutEffect)(()=>{if(Y)return L(K.current,"is-without-arrow",s),L(K.current,"is-alternate",a),A(K.current,"data-x-axis"),A(K.current,"data-y-axis"),M(K.current,"top"),M(K.current,"left"),M(U.current,"maxHeight"),void M(U.current,"maxWidth");const e=()=>{if(!K.current||!U.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 b(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 b(Object(d.getRectangleFromRange)(r),r.endContainer.ownerDocument,i);if("function"==typeof(null==r?void 0:r.getBoundingClientRect)){const e=b(r.getBoundingClientRect(),r.ownerDocument,i);return o?e:T(e,r)}const{top:e,bottom:t}=r,n=e.getBoundingClientRect(),c=t.getBoundingClientRect(),s=b(new window.DOMRect(n.left,n.top,n.width,c.bottom-n.top),e.ownerDocument,i);return o?s:T(s,r)}if(!e.current)return;const{parentNode:c}=e.current,s=c.getBoundingClientRect();return o?s:T(s,c)}(W,j,E,y,w,K.current);if(!e)return;const{offsetParent:t,ownerDocument:n}=K.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;N&&(r=null===(i=K.current.closest(".popover-slot"))||void 0===i?void 0:i.parentNode);const c=J.height?J:U.current.getBoundingClientRect(),{popoverTop:u,popoverLeft:l,xAxis:p,yAxis:g,contentHeight:h,contentWidth:v}=function(e,t,n="top",r,o,i,c,s,a){const[u,l="center",d]=n.split(" "),p=function(e,t,n,r,o,i,c,s){const{height:a}=t;if(o){const t=o.getBoundingClientRect().top+a-c;if(e.top<=t)return{yAxis:n,popoverTop:Math.min(e.bottom,t)}}let u=e.top+e.height/2;"bottom"===r?u=e.bottom:"top"===r&&(u=e.top);const l={popoverTop:u,contentHeight:(u-a/2>0?a/2:u)+(u+a/2>window.innerHeight?window.innerHeight-u: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&&!s)if("middle"===n&&l.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?l.popoverTop:"top"===b?d.popoverTop:p.popoverTop,{yAxis:b,popoverTop:f,contentHeight:m}}(e,t,u,d,r,0,i,s);return{...function(e,t,n,r,o,i,c,s,a){const{width:u}=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 l=Math.round(e.left+e.width/2),d={popoverLeft:l,contentWidth:(l-u/2>0?u/2:l)+(l+u/2>window.innerWidth?window.innerWidth-l:u/2)};let p=e.left;"right"===r?p=e.right:"middle"===i||a||(p=l);let b=e.right;"left"===r?b=e.left:"middle"===i||a||(b=l);const m={popoverLeft:p,contentWidth:p-u>0?u:p},g={popoverLeft:b,contentWidth:b+u>window.innerWidth?window.innerWidth-b:u};let h,v=n,y=null;if(!o&&!s)if("center"===n&&d.contentWidth===u)v="center";else if("left"===n&&m.contentWidth===u)v="left";else if("right"===n&&g.contentWidth===u)v="right";else{v=m.contentWidth>g.contentWidth?"left":"right";const e="left"===v?m.contentWidth:g.contentWidth;u>window.innerWidth&&(y=window.innerWidth),e!==u&&(v="center",d.popoverLeft=window.innerWidth/2)}if(h="center"===v?d.popoverLeft:"left"===v?m.popoverLeft:g.popoverLeft,c){const e=c.getBoundingClientRect();h=Math.min(h,e.right-u),Object(f.isRTL)()||(h=Math.max(h,0))}return{xAxis:v,popoverLeft:h,contentWidth:y}}(e,t,l,d,r,p.yAxis,c,s,a),...p}}(e,c,m,I,K.current,o,r,H,F);"number"==typeof u&&"number"==typeof l&&(M(K.current,"top",u+"px"),M(K.current,"left",l+"px")),L(K.current,"is-without-arrow",s||"center"===p&&"middle"===g),L(K.current,"is-alternate",a),A(K.current,"data-x-axis",p),A(K.current,"data-y-axis",g),M(U.current,"maxHeight","number"==typeof h?h+"px":""),M(U.current,"maxWidth","number"==typeof v?v+"px":""),G(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[g]||"middle"))};e();const{ownerDocument:t}=K.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 c=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(y);let u;return c&&c!==t&&(c.defaultView.addEventListener("resize",e),c.defaultView.addEventListener("scroll",e,!0)),D&&(u=new n.MutationObserver(e),u.observe(D,{attributes:!0})),()=>{n.clearInterval(r),n.removeEventListener("resize",e),n.removeEventListener("scroll",e,!0),n.removeEventListener("click",i),n.cancelAnimationFrame(o),c&&c!==t&&(c.defaultView.removeEventListener("resize",e),c.defaultView.removeEventListener("scroll",e,!0)),u&&u.disconnect()}},[Y,j,E,y,w,m,J,I,D,N]);const Z=(e,n)=>{if("focus-outside"===e&&k)k(n);else if("focus-outside"===e&&x){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>n.relatedTarget}),u()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),x(e)}else t&&t()},[ee,te]=Object(l.__experimentalUseDialog)({focusOnMount:h,__unstableOnClose:Z,onClose:Z}),ne=Object(l.useMergeRefs)([K,ee,V]),re=Boolean(S&&$)&&function(e){if("loading"===e.type)return c()("components-animate__loading");const{type:t,origin:n=P(t)}=e;if("appear"===t){const[e,t="center"]=n.split(" ");return c()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?c()("components-animate__slide-in","is-from-"+n):void 0}({type:"appear",origin:$});let oe=Object(o.createElement)("div",Object(r.a)({className:c()("components-popover",i,re,{"is-expanded":Y,"is-without-arrow":s,"is-alternate":a})},B,{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)(z,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:U,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},X,n)));return Q.ref&&(oe=Object(o.createElement)(C,{name:R},oe)),y||j?oe:Object(o.createElement)("span",{ref:W},oe)});D.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(R,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var N=D,H=function({shortcut:e,className:t}){if(!e)return null;let n,r;return Object(s.isString)(e)&&(n=e),Object(s.isObject)(e)&&(n=e.display,r=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":r},n)};const F=Object(o.createElement)("div",{className:"event-catcher"}),B=({eventHandlers:e,child:t,childrenWithPopover:n})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(F,e),Object(o.cloneElement)(t,{children:n}),","),e),V=({child:e,eventHandlers:t,childrenWithPopover:n})=>Object(o.cloneElement)(e,{...t,children:n}),W=(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 U=function({children:e,position:t,text:n,shortcut:r}){const[i,c]=Object(o.useState)(!1),[a,u]=Object(o.useState)(!1),d=Object(l.useDebounce)(u,700),p=t=>{W(e,"onMouseDown",t),document.addEventListener("mouseup",m),c(!0)},f=t=>{W(e,"onMouseUp",t),document.removeEventListener("mouseup",m),c(!1)},b=e=>"mouseUp"===e?f:"mouseDown"===e?p:void 0,m=b("mouseUp"),g=(t,n)=>r=>{if(W(e,t,r),r.currentTarget.disabled)return;if("focus"===r.type&&i)return;d.cancel();const o=Object(s.includes)(["focus","mouseenter"],r.type);o!==a&&(n?d(o):u(o))},h=()=>{d.cancel(),document.removeEventListener("mouseup",m)};if(Object(o.useEffect)(()=>h,[]),1!==o.Children.count(e))return e;const v={onMouseEnter:g("onMouseEnter",!0),onMouseLeave:g("onMouseLeave"),onClick:g("onClick"),onFocus:g("onFocus"),onBlur:g("onBlur"),onMouseDown:b("mouseDown")},y=o.Children.only(e),{children:O,disabled:w}=y.props;return(w?B:V)({child:y,eventHandlers:v,childrenWithPopover:(({grandchildren:e,isOver:t,position:n,text:r,shortcut:i})=>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)(H,{className:"components-tooltip__shortcut",shortcut:i}))))({grandchildren:O,isOver:a,position:t,text:n,shortcut:r})})},K=n(37),q=n(38);const $=["onMouseDown","onClick"];var z=t.a=Object(o.forwardRef)((function(e,t){const{href:n,target:i,isSmall:a,isPressed:l,isBusy:d,isDestructive:p,className:f,disabled:b,icon:m,iconPosition:g="left",iconSize:h,showTooltip:v,tooltipPosition:y,shortcut:O,label:w,children:j,text:E,variant:_,__experimentalIsFocusable:S,describedBy:x,...k}=function({isDefault:e,isPrimary:t,isSecondary:n,isTertiary:r,isLink:o,variant:i,...c}){let s=i;var a,l,d,p,f;return t&&(null!==(a=s)&&void 0!==a||(s="primary")),r&&(null!==(l=s)&&void 0!==l||(s="tertiary")),n&&(null!==(d=s)&&void 0!==d||(s="secondary")),e&&(u()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=s)&&void 0!==p||(s="secondary")),o&&(null!==(f=s)&&void 0!==f||(s="link")),{...c,variant:s}}(e),I=c()("components-button",f,{"is-secondary":"secondary"===_,"is-primary":"primary"===_,"is-small":a,"is-tertiary":"tertiary"===_,"is-pressed":l,"is-busy":d,"is-link":"link"===_,"is-destructive":p,"has-text":!!m&&!!j,"has-icon":!!m}),C=b&&!S,R=void 0===n||C?"button":"a",P="a"===R?{href:n,target:i}:{type:"button",disabled:C,"aria-pressed":l};if(b&&S){P["aria-disabled"]=!0;for(const e of $)k[e]=e=>{e.stopPropagation(),e.preventDefault()}}const T=!C&&(v&&w||O||!!w&&(!j||Object(s.isArray)(j)&&!j.length)&&!1!==v),A=x?Object(s.uniqueId)():null,M=k["aria-describedby"]||A,L=Object(o.createElement)(R,Object(r.a)({},P,k,{className:I,"aria-label":k["aria-label"]||w,"aria-describedby":M,ref:t}),m&&"left"===g&&Object(o.createElement)(K.a,{icon:m,size:h}),E&&Object(o.createElement)(o.Fragment,null,E),m&&"right"===g&&Object(o.createElement)(K.a,{icon:m,size:h}),j);return T?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(U,{text:x||w,shortcut:O,position:y},L),x&&Object(o.createElement)(q.a,null,Object(o.createElement)("span",{id:A},x))):Object(o.createElement)(o.Fragment,null,L,x&&Object(o.createElement)(q.a,null,Object(o.createElement)("span",{id:A},x)))}))},function(e,t){e.exports=window.wp.dom},,function(e,t,n){"use strict";n.d(t,"n",(function(){return i})),n.d(t,"l",(function(){return c})),n.d(t,"k",(function(){return s})),n.d(t,"m",(function(){return a})),n.d(t,"i",(function(){return u})),n.d(t,"d",(function(){return l})),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 g})),n.d(t,"h",(function(){return h})),n.d(t,"b",(function(){return v}));var r,o=n(2);const i=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),c=i.pluginUrl+"images/",s=i.pluginUrl+"build/",a=i.buildPhase,u=null===(r=o.STORE_PAGES.shop)||void 0===r?void 0:r.permalink,l=(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",{}),g=Object(o.getSetting)("allowedCountries",{}),h=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(3);function o(e,t,n){var o=this,i=Object(r.useRef)(null),c=Object(r.useRef)(0),s=Object(r.useRef)(null),a=Object(r.useRef)([]),u=Object(r.useRef)(),l=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,g="maxWait"in n,h=g?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=u.current;return a.current=u.current=null,c.current=e,l.current=d.current.apply(n,t)},n=function(e,t){f&&cancelAnimationFrame(s.current),s.current=f?requestAnimationFrame(e):setTimeout(e,t)},r=function(e){if(!p.current)return!1;var n=e-i.current,r=e-c.current;return!i.current||n>=t||n<0||g&&r>=h},v=function(t){return s.current=null,m&&a.current?e(t):(a.current=u.current=null,l.current)},y=function(){var e=Date.now();if(r(e))return v(e);if(p.current){var o=e-i.current,s=e-c.current,a=t-o,u=g?Math.min(a,h-s):a;n(y,u)}},O=function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];var m=Date.now(),h=r(m);if(a.current=d,u.current=o,i.current=m,h){if(!s.current&&p.current)return c.current=i.current,n(y,t),b?e(i.current):l.current;if(g)return n(y,t),e(i.current)}return s.current||n(y,t),l.current};return O.cancel=function(){s.current&&(f?cancelAnimationFrame(s.current):clearTimeout(s.current)),c.current=0,a.current=i.current=u.current=s.current=null},O.isPending=function(){return!!s.current},O.flush=function(){return s.current?v(Date.now()):l.current},O}),[b,g,t,h,m,f])}},function(e,t,n){"use strict";n.d(t,"a",(function(){return u}));var r=n(12),o=n.n(r),i=n(0),c=n(16);const s=[".wp-block-woocommerce-cart"],a=e=>{let{Block:t,containers:n,getProps:r=(()=>({})),getErrorBoundaryProps:s=(()=>({}))}=e;0!==n.length&&Array.prototype.forEach.call(n,(e,n)=>{const a=r(e,n),u=s(e,n),l={...e.dataset,...a.attributes||{}};(e=>{let{Block:t,container:n,attributes:r={},props:s={},errorBoundaryProps:a={}}=e;Object(i.render)(Object(i.createElement)(c.a,a,Object(i.createElement)(i.Suspense,{fallback:Object(i.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(i.createElement)(t,o()({},s,{attributes:r})))),n,()=>{n.classList&&n.classList.remove("is-loading")})})({Block:t,container:e,props:a,attributes:l,errorBoundaryProps:u})})},u=e=>{const t=document.body.querySelectorAll(s.join(",")),{Block:n,getProps:r,getErrorBoundaryProps:o,selector:i}=e;(e=>{let{Block:t,getProps:n,getErrorBoundaryProps:r,selector:o,wrappers:i}=e;const c=document.body.querySelectorAll(o);i&&i.length>0&&Array.prototype.filter.call(c,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,i)),a({Block:t,containers:c,getProps:n,getErrorBoundaryProps:r})})({Block:n,getProps:r,getErrorBoundaryProps:o,selector:i,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:i}=e;const c=i.querySelectorAll(o);a({Block:t,containers:c,getProps:n,getErrorBoundaryProps:r})})({...e,wrapper:t})})})}},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";var r=n(0),o=n(1),i=n(26);n(125),t.a=e=>{let{name:t,count:n}=e;return Object(r.createElement)(r.Fragment,null,t,n&&Number.isFinite(n)&&Object(r.createElement)(i.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 i(){throw new Error("setTimeout has not been defined")}function c(){throw new Error("clearTimeout has not been defined")}function s(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:c}catch(e){r=c}}();var a,u=[],l=!1,d=-1;function p(){l&&a&&(l=!1,a.length?u=a.concat(u):d=-1,u.length&&f())}function f(){if(!l){var e=s(p);l=!0;for(var t=u.length;t;){for(a=u,u=[];++d<t;)a&&a[d].run();d=-1,t=u.length}a=null,l=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===c||!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];u.push(new b(e,t)),1!==u.length||l||s(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(3);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(8),i=n(0),c=n(32),s=n(74);const a=e=>{const{namespace:t,resourceName:n,resourceValues:a=[],query:u={},shouldSelect:l=!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(i.useRef)({results:[],isLoading:!0}),p=Object(c.a)(u),f=Object(c.a)(a),b=Object(s.a)(),m=Object(o.useSelect)(e=>{if(!l)return null;const o=e(r.COLLECTIONS_STORE_KEY),i=[t,n,p,f],c=o.getCollectionError(...i);if(c){if(!(c instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");b(c)}return{results:o.getCollection(...i),isLoading:!o.hasFinishedResolution("getCollection",i)}},[t,n,f,p,l]);return null!==m&&(d.current=m),d.current}},,,,,,,function(e,t,n){"use strict";var r=n(0),o=n(14);const i=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=i},,function(e,t){e.exports=window.wp.blockEditor},,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),i=n(5),c=n.n(i),s=n(26);n(108),t.a=e=>{let{className:t,disabled:n,label:
|
4 |
/* translators: Submit button text for filters. */
|
5 |
+
i=Object(o.__)("Go","woo-gutenberg-products-block"),onClick:a,screenReaderLabel:u=Object(o.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(r.createElement)("button",{type:"submit",className:c()("wc-block-filter-submit-button","wc-block-components-filter-submit-button",t),disabled:n,onClick:a},Object(r.createElement)(s.a,{label:i,screenReaderLabel:u}))}},function(e,t,n){"use strict";var r=n(0),o=n(4),i=n(5),c=n.n(i),s=n(1),a=n(21),u=n(70),l=n(43);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:i=n,onRemove:p=o.noop,isDismissible:f=!0,actions:b=[],politeness:m=d(t),__unstableHTML:g,onDismiss:h=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])}(i,m);const v=c()(e,"components-notice","is-"+t,{"is-dismissible":f});return g&&(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:i=!1,onClick:s,url:a},u)=>{let d=o;return"primary"===o||i||(d=a?"link":"secondary"),void 0===d&&n&&(d="primary"),Object(r.createElement)(l.a,{key:u,href:a,variant:d,onClick:a?void 0:s,className:c()("components-notice__action",e)},t)}))),f&&Object(r.createElement)(l.a,{className:"components-notice__dismiss",icon:u.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,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 s}));var r=n(3),o=n(50);function i(e,t){return e===t}function c(e){return"function"==typeof e?function(){return e}:e}function s(e,t,n){var s=n&&n.equalityFn||i,a=function(e){var t=Object(r.useState)(c(e)),n=t[0],o=t[1];return[n,Object(r.useCallback)((function(e){return o(c(e))}),[])]}(e),u=a[0],l=a[1],d=Object(o.a)(Object(r.useCallback)((function(e){return l(e)}),[l]),t,n),p=Object(r.useRef)(e);return s(p.current,e)||(d(e),p.current=e),[u,d]}},function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return i}));var r=n(4);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 i=e.filter(e=>e.attribute===n.taxonomy),c=i.length?i[0]:null;if(!(c&&c.slug&&Array.isArray(c.slug)&&c.slug.includes(o)))return;const s=c.slug.filter(e=>e!==o),a=e.filter(e=>e.attribute!==n.taxonomy);s.length>0&&(c.slug=s.sort(),a.push(c)),t(Object(r.sortBy)(a,"attribute"))},i=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]:[],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"in";if(!n||!n.taxonomy)return[];const c=e.filter(e=>e.attribute!==n.taxonomy);return 0===o.length?t(c):(c.push({attribute:n.taxonomy,operator:i,slug:o.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(r.sortBy)(c,"attribute"))),c}},,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,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return c}));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},[]),i=e=>{if(e)return o.find(t=>t.id===e)},c=e=>{if(e)return o.find(t=>t.taxonomy===e)}},function(e,t,n){"use strict";var r=n(0),o=n(1),i=n(5),c=n.n(i);n(126),t.a=e=>{let{className:t,onChange:n,options:i=[],checked:s=[],isLoading:a=!1,isDisabled:u=!1,limit:l=10}=e;const[d,p]=Object(r.useState)(!1),f=Object(r.useMemo)(()=>[...Array(5)].map((e,t)=>Object(r.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),b=Object(r.useMemo)(()=>{const e=i.length-l;return!d&&Object(r.createElement)("li",{key:"show-more",className:"show-more"},Object(r.createElement)("button",{onClick:()=>{p(!0)},"aria-expanded":!1,"aria-label":Object(o.sprintf)(
|
6 |
/* translators: %s is referring the remaining count of options */
|
7 |
Object(o._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(o.sprintf)(
|
8 |
/* translators: %s number of options to reveal. */
|
9 |
+
Object(o._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e)))},[i,l,d]),m=Object(r.useMemo)(()=>d&&Object(r.createElement)("li",{key:"show-less",className:"show-less"},Object(r.createElement)("button",{onClick:()=>{p(!1)},"aria-expanded":!0,"aria-label":Object(o.__)("Show less options","woo-gutenberg-products-block")},Object(o.__)("Show less","woo-gutenberg-products-block"))),[d]),g=Object(r.useMemo)(()=>{const e=i.length>l+5;return Object(r.createElement)(r.Fragment,null,i.map((t,o)=>Object(r.createElement)(r.Fragment,{key:t.value},Object(r.createElement)("li",e&&!d&&o>=l&&{hidden:!0},Object(r.createElement)("input",{type:"checkbox",id:t.value,value:t.value,onChange:e=>{n(e.target.value)},checked:s.includes(t.value),disabled:u}),Object(r.createElement)("label",{htmlFor:t.value},t.label)),e&&o===l-1&&b)),e&&m)},[i,n,s,d,l,m,b,u]),h=c()("wc-block-checkbox-list","wc-block-components-checkbox-list",{"is-loading":a},t);return Object(r.createElement)("ul",{className:h},a?f:g)}},,,function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter Products by Attribute","description":"Allow customers to filter the grid by product attribute, such as color. Works in combination with the All Products block.","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,n){"use strict";n.d(t,"a",(function(){return o})),n(103);var r=n(46);const o=()=>r.m>1},,,,,,function(e,t){},,,function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return a})),n.d(t,"d",(function(){return u})),n.d(t,"c",(function(){return l}));var r=n(15),o=n(2),i=n(78);const c=Object(o.getSettingWithCoercion)("is_rendering_php_template",!1,i.a),s="query_type_",a="filter_";function u(e){return window?Object(r.getQueryArg)(window.location.href,e):null}function l(e){c?window.location.href=e:window.history.replaceState({},"",e)}},function(e,t){},function(e,t){},,,,,,,,function(e,t,n){"use strict";e.exports=n(222)},,,function(e,t,n){"use strict";n.d(t,"c",(function(){return a})),n.d(t,"d",(function(){return u})),n.d(t,"b",(function(){return l})),n.d(t,"a",(function(){return d}));var r=n(72),o=n(115),i=n(52),c=n(20);const s=e=>Object(i.a)(e)?JSON.parse(e)||{}:Object(c.a)(e)?e:{},a=e=>{if(!Object(o.a)()||"function"!=typeof r.__experimentalGetSpacingClassesAndStyles)return{style:{}};const t=Object(c.a)(e)?e:{},n=s(t.style);return Object(r.__experimentalGetSpacingClassesAndStyles)({...t,style:n})},u=e=>{const t=Object(c.a)(e)?e:{},n=s(t.style),r=Object(c.a)(n.typography)?n.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:r.fontSize,lineHeight:r.lineHeight,fontWeight:r.fontWeight,textTransform:r.textTransform,fontFamily:t.fontFamily}}},l=e=>{if(!Object(o.a)())return{className:"",style:{}};const t=Object(c.a)(e)?e:{},n=s(t.style);return Object(r.__experimentalUseColorProps)({...t,style:n})},d=e=>{if(!Object(o.a)())return{className:"",style:{}};const t=Object(c.a)(e)?e:{},n=s(t.style);return Object(r.__experimentalUseBorderProps)({...t,style:n})}},,,,,,,function(e,t,n){"use strict";n.d(t,"a",(function(){return d}));var r=n(0),o=n(100),i=n(4),c=n(32),s=n(20),a=n(39),u=n(63),l=n(27);const d=e=>{let{queryAttribute:t,queryPrices:n,queryStock:d,queryState:p}=e,f=Object(l.a)();f+="-collection-data";const[b]=Object(a.a)(f),[m,g]=Object(a.b)("calculate_attribute_counts",[],f),[h,v]=Object(a.b)("calculate_price_range",null,f),[y,O]=Object(a.b)("calculate_stock_status_counts",null,f),w=Object(c.a)(t||{}),j=Object(c.a)(n),E=Object(c.a)(d);Object(r.useEffect)(()=>{"object"==typeof w&&Object.keys(w).length&&(m.find(e=>Object(s.b)(w,"taxonomy")&&e.taxonomy===w.taxonomy)||g([...m,w]))},[w,m,g]),Object(r.useEffect)(()=>{h!==j&&void 0!==j&&v(j)},[j,v,h]),Object(r.useEffect)(()=>{y!==E&&void 0!==E&&O(E)},[E,O,y]);const[_,S]=Object(r.useState)(!1),[x]=Object(o.a)(_,200);_||S(!0);const k=Object(r.useMemo)(()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(i.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(u.a)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...p,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...k},shouldSelect:x})}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";var r=n(0),o=n(14);const i=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=i},,,,function(e,t,n){"use strict";var r=n(12),o=n.n(r),i=n(0),c=n(5),s=n.n(c),a=n(1),u=n(105),l=n(200);n(121);var d=e=>{let{text:t,screenReaderText:n="",element:r="li",className:c="",radius:a="small",children:u=null,...l}=e;const d=r,p=s()(c,"wc-block-components-chip","wc-block-components-chip--radius-"+a),f=Boolean(n&&n!==t);return Object(i.createElement)(d,o()({className:p},l),Object(i.createElement)("span",{"aria-hidden":f,className:"wc-block-components-chip__text"},t),f&&Object(i.createElement)("span",{className:"screen-reader-text"},n),u)};t.a=e=>{let{ariaLabel:t="",className:n="",disabled:r=!1,onRemove:c=(()=>{}),removeOnAnyClick:p=!1,text:f,screenReaderText:b="",...m}=e;const g=p?"span":"button";if(!t){const e=b&&"string"==typeof b?b:f;t="string"!=typeof e?
|
10 |
/* translators: Remove chip. */
|
11 |
Object(a.__)("Remove","woo-gutenberg-products-block"):Object(a.sprintf)(
|
12 |
/* translators: %s text of the chip to remove. */
|
13 |
+
Object(a.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const h={"aria-label":t,disabled:r,onClick:c,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||c()}},v=p?h:{},y=p?{"aria-hidden":!0}:h;return Object(i.createElement)(d,o()({},m,v,{className:s()(n,"is-removable"),element:p?"button":m.element,screenReaderText:b,text:f}),Object(i.createElement)(g,o()({className:"wc-block-components-chip__remove"},y),Object(i.createElement)(u.a,{className:"wc-block-components-chip__remove-icon",icon:l.a,size:16})))}},,,,,,,,,,,,,,function(e,t,n){e.exports=n(239)},function(e,t){},function(e,t,n){"use strict";n.d(t,"b",(function(){return i})),n.d(t,"a",(function(){return s}));var r=n(20);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,i=e=>Array.isArray(e)&&e.every(o),c=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),s=e=>Array.isArray(e)&&e.every(c)},function(e,t){},function(e,t,n){"use strict";var r=60103,o=60106,i=60107,c=60108,s=60114,a=60109,u=60110,l=60112,d=60113,p=60120,f=60115,b=60116,m=60121,g=60122,h=60117,v=60129,y=60131;if("function"==typeof Symbol&&Symbol.for){var O=Symbol.for;r=O("react.element"),o=O("react.portal"),i=O("react.fragment"),c=O("react.strict_mode"),s=O("react.profiler"),a=O("react.provider"),u=O("react.context"),l=O("react.forward_ref"),d=O("react.suspense"),p=O("react.suspense_list"),f=O("react.memo"),b=O("react.lazy"),m=O("react.block"),g=O("react.server.block"),h=O("react.fundamental"),v=O("react.debug_trace_mode"),y=O("react.legacy_hidden")}function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case i:case s:case c:case d:case p:return e;default:switch(e=e&&e.$$typeof){case u:case l:case b:case f:case a:return e;default:return t}}case o:return t}}}var j=a,E=r,_=l,S=i,x=b,k=f,I=o,C=s,R=c,P=d;t.ContextConsumer=u,t.ContextProvider=j,t.Element=E,t.ForwardRef=_,t.Fragment=S,t.Lazy=x,t.Memo=k,t.Portal=I,t.Profiler=C,t.StrictMode=R,t.Suspense=P,t.isAsyncMode=function(){return!1},t.isConcurrentMode=function(){return!1},t.isContextConsumer=function(e){return w(e)===u},t.isContextProvider=function(e){return w(e)===a},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},t.isForwardRef=function(e){return w(e)===l},t.isFragment=function(e){return w(e)===i},t.isLazy=function(e){return w(e)===b},t.isMemo=function(e){return w(e)===f},t.isPortal=function(e){return w(e)===o},t.isProfiler=function(e){return w(e)===s},t.isStrictMode=function(e){return w(e)===c},t.isSuspense=function(e){return w(e)===d},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===s||e===v||e===c||e===d||e===p||e===y||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===f||e.$$typeof===a||e.$$typeof===u||e.$$typeof===l||e.$$typeof===h||e.$$typeof===m||e[0]===g)},t.typeOf=w},function(e,t,n){"use strict";var r=n(224);function o(){}function i(){}i.resetWarningCache=o,e.exports=function(){function e(e,t,n,o,i,c){if(c!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},,,,,,,,,,,,,,,function(e,t,n){"use strict";n.r(t);var r=n(51),o=n(0),i=n(1),c=n(21),s=n(32),a=n(60),u=n(39),l=n(63),d=n(144),p=n(111),f=n(5),b=n.n(f);function m(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}var g=n(7);function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var y=n(9),O=n.n(y),w=n(3);function j(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function E(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function _(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return E(n.overflowY,t)||E(n.overflowX,t)||function(e){var t=function(e){if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}}(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)}(e)}return!1}function S(e,t,n,r,o,i,c,s){return i<e&&c>t||i>e&&c<t?0:i<=e&&s<=n||c>=t&&s>=n?i-e-r:c>t&&s<n||i<e&&s>n?c-t+o:0}n(134);var x=function(){return(x=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};Object.create,Object.create;var k=0;function I(e){return"function"==typeof e?e:C}function C(){}function R(e,t){e&&function(e,t){var n=window,r=t.scrollMode,o=t.block,i=t.inline,c=t.boundary,s=t.skipOverflowHiddenElements,a="function"==typeof c?c:function(e){return e!==c};if(!j(e))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,l=[],d=e;j(d)&&a(d);){if((d=d.parentElement)===u){l.push(d);break}null!=d&&d===document.body&&_(d)&&!_(document.documentElement)||null!=d&&_(d,s)&&l.push(d)}for(var p=n.visualViewport?n.visualViewport.width:innerWidth,f=n.visualViewport?n.visualViewport.height:innerHeight,b=window.scrollX||pageXOffset,m=window.scrollY||pageYOffset,g=e.getBoundingClientRect(),h=g.height,v=g.width,y=g.top,O=g.right,w=g.bottom,E=g.left,x="start"===o||"nearest"===o?y:"end"===o?w:y+h/2,k="center"===i?E+v/2:"end"===i?O:E,I=[],C=0;C<l.length;C++){var R=l[C],P=R.getBoundingClientRect(),T=P.height,A=P.width,M=P.top,L=P.right,D=P.bottom,N=P.left;if("if-needed"===r&&y>=0&&E>=0&&w<=f&&O<=p&&y>=M&&w<=D&&E>=N&&O<=L)return I;var H=getComputedStyle(R),F=parseInt(H.borderLeftWidth,10),B=parseInt(H.borderTopWidth,10),V=parseInt(H.borderRightWidth,10),W=parseInt(H.borderBottomWidth,10),U=0,K=0,q="offsetWidth"in R?R.offsetWidth-R.clientWidth-F-V:0,$="offsetHeight"in R?R.offsetHeight-R.clientHeight-B-W:0;if(u===R)U="start"===o?x:"end"===o?x-f:"nearest"===o?S(m,m+f,f,B,W,m+x,m+x+h,h):x-f/2,K="start"===i?k:"center"===i?k-p/2:"end"===i?k-p:S(b,b+p,p,F,V,b+k,b+k+v,v),U=Math.max(0,U+m),K=Math.max(0,K+b);else{U="start"===o?x-M-B:"end"===o?x-D+W+$:"nearest"===o?S(M,D,T,B,W+$,x,x+h,h):x-(M+T/2)+$/2,K="start"===i?k-N-F:"center"===i?k-(N+A/2)+q/2:"end"===i?k-L+V+q:S(N,L,A,F,V+q,k,k+v,v);var z=R.scrollLeft,G=R.scrollTop;x+=G-(U=Math.max(0,Math.min(G+U,R.scrollHeight-T+$))),k+=z-(K=Math.max(0,Math.min(z+K,R.scrollWidth-A+q)))}I.push({el:R,top:U,left:K})}return I}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"}).forEach((function(e){var t=e.el,n=e.top,r=e.left;t.scrollTop=n,t.scrollLeft=r}))}function P(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function T(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,i=new Array(o),c=0;c<o;c++)i[c]=arguments[c];r(),n=setTimeout((function(){n=null,e.apply(void 0,i)}),t)}return o.cancel=r,o}function A(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return t.some((function(t){return t&&t.apply(void 0,[e].concat(r)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function M(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}function L(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function D(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var N=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function H(e){void 0===e&&(e={});var t={};return N.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function F(e,t){return void 0!==e[t]}function B(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function V(e,t,n,r,o){if(void 0===o&&(o=!0),0===n)return-1;var i=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:i+1);var c=t+e;c<0?c=o?i:0:c>i&&(c=o?0:i);var s=W(e,c,n,r,o);return-1===s?t>=n?-1:t:s}function W(e,t,n,r,o){var i=r(t);if(!i||!i.hasAttribute("disabled"))return t;if(e>0){for(var c=t+1;c<n;c++)if(!r(c).hasAttribute("disabled"))return c}else for(var s=t-1;s>=0;s--)if(!r(s).hasAttribute("disabled"))return s;return o?e>0?W(1,0,n,r,!1):W(-1,n-1,n,r,!1):-1}function U(e,t,n,r){return void 0===r&&(r=!0),t.some((function(t){return t&&(P(t,e,n)||r&&P(t,n.document.activeElement,n))}))}var K=T((function(e){$(e).textContent=""}),500);function q(e,t){var n=$(t);e&&(n.textContent=e,K(t))}function $(e){void 0===e&&(e=document);var t=e.getElementById("a11y-status-message");return t||((t=e.createElement("div")).setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var z=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16}),G=["refKey","ref"],Q=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Y=["onKeyDown","onBlur","onChange","onInput","onChangeText"],X=["refKey","ref"],J=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Z=function(){var e=function(e){var t,n;function r(t){var n;(n=e.call(this,t)||this).id=n.props.id||"downshift-"+String(k++),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var r=setTimeout((function(){n.timeoutIds=n.timeoutIds.filter((function(e){return e!==r})),e()}),t);n.timeoutIds.push(r)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=H(t),n.internalSetState(Object(g.a)({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,r){t=H(t),n.internalSetState(Object(g.a)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),r)},n.selectItemAtIndex=function(e,t,r){var o=n.items[e];null!=o&&n.selectItem(o,t,r)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var r,o,i={},c="function"==typeof e;return!c&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,Object(g.a)({},n.getStateAndHelpers(),e)),n.setState((function(t){t=n.getState(t);var s=c?e(t):e;s=n.props.stateReducer(t,s),r=s.hasOwnProperty("selectedItem");var a={},u={};return r&&s.selectedItem!==t.selectedItem&&(o=s.selectedItem),s.type=s.type||0,Object.keys(s).forEach((function(e){t[e]!==s[e]&&(i[e]=s[e]),"type"!==e&&(u[e]=s[e],F(n.props,e)||(a[e]=s[e]))})),c&&s.hasOwnProperty("inputValue")&&n.props.onInputValueChange(s.inputValue,Object(g.a)({},n.getStateAndHelpers(),s)),a}),(function(){I(t)(),Object.keys(i).length>1&&n.props.onStateChange(i,n.getStateAndHelpers()),r&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==o&&n.props.onChange(o,n.getStateAndHelpers()),n.props.onUserAction(i,n.getStateAndHelpers())}))},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,c=void 0===i?"ref":i,s=o.ref,a=m(o,G),u=(void 0===t?{}:t).suppressRefError,l=void 0!==u&&u;n.getRootProps.called=!0,n.getRootProps.refKey=c,n.getRootProps.suppressRefError=l;var d=n.getState().isOpen;return Object(g.a)(((r={})[c]=M(s,n.rootRef),r.role="combobox",r["aria-expanded"]=d,r["aria-haspopup"]="listbox",r["aria-owns"]=d?n.menuId:null,r["aria-labelledby"]=n.labelId,r),a)},n.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:4})}else this.internalSetState({isOpen:!0,type:4},(function(){var e=t.getItemCount();if(e>0){var n=V(1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:4})}}))},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:3})}else this.internalSetState({isOpen:!0,type:3},(function(){var e=t.getItemCount();if(e>0){var n=V(-1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:3})}}))},Enter:function(e){if(229!==e.which){var t=this.getState(),n=t.isOpen,r=t.highlightedIndex;if(n&&null!=r){e.preventDefault();var o=this.items[r],i=this.getItemNodeFromIndex(r);if(null==o||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}}},Escape:function(e){e.preventDefault(),this.reset(Object(g.a)({type:5},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},n.buttonKeyDownHandlers=Object(g.a)({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),n.inputKeyDownHandlers=Object(g.a)({},n.keyDownHandlers,{Home:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var r=this.getItemCount();if(!(r<=0)&&n){var o=W(1,0,r,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:7})}}},End:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var r=this.getItemCount();if(!(r<=0)&&n){var o=W(-1,r-1,r,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:8})}}}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,r=t.onClick;t.onPress;var o=t.onKeyDown,i=t.onKeyUp,c=t.onBlur,s=m(t,Q),a=n.getState().isOpen,u={onClick:A(r,n.buttonHandleClick),onKeyDown:A(o,n.buttonHandleKeyDown),onKeyUp:A(i,n.buttonHandleKeyUp),onBlur:A(c,n.buttonHandleBlur)},l=s.disabled?{}:u;return Object(g.a)({type:"button",role:"button","aria-label":a?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},l,s)},n.buttonHandleKeyUp=function(e){e.preventDefault()},n.buttonHandleKeyDown=function(e){var t=B(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(h(n),e)},n.buttonHandleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout((function(){return n.toggleMenu({type:13})}))},n.buttonHandleBlur=function(e){var t=e.target;n.internalSetTimeout((function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:14})}))},n.getLabelProps=function(e){return Object(g.a)({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,r=t.onKeyDown,o=t.onBlur,i=t.onChange,c=t.onInput;t.onChangeText;var s,a=m(t,Y),u={},l=n.getState(),d=l.inputValue,p=l.isOpen,f=l.highlightedIndex;return a.disabled||((s={}).onChange=A(i,c,n.inputHandleChange),s.onKeyDown=A(r,n.inputHandleKeyDown),s.onBlur=A(o,n.inputHandleBlur),u=s),Object(g.a)({"aria-autocomplete":"list","aria-activedescendant":p&&"number"==typeof f&&f>=0?n.getItemId(f):null,"aria-controls":p?n.menuId:null,"aria-labelledby":n.labelId,autoComplete:"off",value:d,id:n.inputId},u,a)},n.inputHandleKeyDown=function(e){var t=B(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(h(n),e)},n.inputHandleChange=function(e){n.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleBlur=function(){n.internalSetTimeout((function(){var e=n.props.environment.document&&!!n.props.environment.document.activeElement&&!!n.props.environment.document.activeElement.dataset&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:10})}))},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var r,o=void 0===e?{}:e,i=o.refKey,c=void 0===i?"ref":i,s=o.ref,a=m(o,X),u=(void 0===t?{}:t).suppressRefError,l=void 0!==u&&u;return n.getMenuProps.called=!0,n.getMenuProps.refKey=c,n.getMenuProps.suppressRefError=l,Object(g.a)(((r={})[c]=M(s,n.menuRef),r.role="listbox",r["aria-labelledby"]=a&&a["aria-label"]?null:n.labelId,r.id=n.menuId,r),a)},n.getItemProps=function(e){var t,r=void 0===e?{}:e,o=r.onMouseMove,i=r.onMouseDown,c=r.onClick;r.onPress;var s=r.index,a=r.item,u=void 0===a?void 0:a,l=m(r,J);void 0===s?(n.items.push(u),s=n.items.indexOf(u)):n.items[s]=u;var d=c,p=((t={onMouseMove:A(o,(function(){s!==n.getState().highlightedIndex&&(n.setHighlightedIndex(s,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:A(i,(function(e){e.preventDefault()}))}).onClick=A(d,(function(){n.selectItemAtIndex(s,{type:9})})),t),f=l.disabled?{onMouseDown:p.onMouseDown}:p;return Object(g.a)({id:n.getItemId(s),role:"option","aria-selected":n.getState().highlightedIndex===s},f,l)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=H(e),n.internalSetState((function(t){var r=t.selectedItem;return Object(g.a)({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(r)},e)}),t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=H(e),n.internalSetState((function(t){var r=t.isOpen;return Object(g.a)({isOpen:!r},r&&{highlightedIndex:n.props.defaultHighlightedIndex},e)}),(function(){var r=n.getState(),o=r.isOpen,i=r.highlightedIndex;o&&n.getItemCount()>0&&"number"==typeof i&&n.setHighlightedIndex(i,e),I(t)()}))},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=T((function(){var e=n.getState(),t=n.items[e.highlightedIndex],r=n.getItemCount(),o=n.props.getA11yStatusMessage(Object(g.a)({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:r,highlightedItem:t},e));n.previousResultCount=r,q(o,n.props.environment.document)}),200);var r=n.props,o=r.defaultHighlightedIndex,i=r.initialHighlightedIndex,c=void 0===i?o:i,s=r.defaultIsOpen,a=r.initialIsOpen,u=void 0===a?s:a,l=r.initialInputValue,d=void 0===l?"":l,p=r.initialSelectedItem,f=void 0===p?null:p,b=n.getState({highlightedIndex:c,isOpen:u,inputValue:d,selectedItem:f});return null!=b.selectedItem&&void 0===n.props.initialInputValue&&(b.inputValue=n.props.itemToString(b.selectedItem)),n.state=b,n}n=e,(t=r).prototype=Object.create(n.prototype),t.prototype.constructor=t,v(t,n);var o=r.prototype;return o.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},o.getState=function(e){return void 0===e&&(e=this.state),t=e,n=this.props,Object.keys(t).reduce((function(e,r){return e[r]=F(n,r)?n[r]:t[r],e}),{});var t,n},o.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},o.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},o.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},o.moveHighlightedIndex=function(e,t){var n=this,r=this.getItemCount(),o=this.getState().highlightedIndex;if(r>0){var i=V(e,o,r,(function(e){return n.getItemNodeFromIndex(e)}));this.setHighlightedIndex(i,t)}},o.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,r=e.selectedItem,o=e.isOpen,i=this.props.itemToString,c=this.id,s=this.getRootProps,a=this.getToggleButtonProps,u=this.getLabelProps,l=this.getMenuProps,d=this.getInputProps,p=this.getItemProps,f=this.openMenu,b=this.closeMenu,m=this.toggleMenu,g=this.selectItem,h=this.selectItemAtIndex,v=this.selectHighlightedItem,y=this.setHighlightedIndex,O=this.clearSelection,w=this.clearItems;return{getRootProps:s,getToggleButtonProps:a,getLabelProps:u,getMenuProps:l,getInputProps:d,getItemProps:p,reset:this.reset,openMenu:f,closeMenu:b,toggleMenu:m,selectItem:g,selectItemAtIndex:h,selectHighlightedItem:v,setHighlightedIndex:y,clearSelection:O,clearItems:w,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:i,id:c,highlightedIndex:t,inputValue:n,isOpen:o,selectedItem:r}},o.componentDidMount=function(){var e=this,t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,!U(t.target,[e._rootNode,e._menuNode],e.props.environment)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},r=function(){e.isTouchMove=!1},o=function(){e.isTouchMove=!0},i=function(t){var n=U(t.target,[e._rootNode,e._menuNode],e.props.environment,!1);e.isTouchMove||n||!e.getState().isOpen||e.reset({type:16},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},c=this.props.environment;c.addEventListener("mousedown",t),c.addEventListener("mouseup",n),c.addEventListener("touchstart",r),c.addEventListener("touchmove",o),c.addEventListener("touchend",i),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),c.removeEventListener("mousedown",t),c.removeEventListener("mouseup",n),c.removeEventListener("touchstart",r),c.removeEventListener("touchmove",o),c.removeEventListener("touchend",i)}},o.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,r=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==r},o.componentDidUpdate=function(e,t){F(this.props,"selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},o.componentWillUnmount=function(){this.cleanup()},o.render=function(){var e=D(this.props.children,C);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var t=D(e(this.getStateAndHelpers()));return t?this.getRootProps.called||this.props.suppressRefError?t:function(e){return"string"==typeof e.type}(t)?Object(w.cloneElement)(t,this.getRootProps(function(e){return e.props}(t))):void 0:null},r}(w.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:L,itemToString:function(e){return null==e?"":String(e)},onStateChange:C,onInputValueChange:C,onUserAction:C,onChange:C,onSelect:C,onOuterClick:C,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:R},e.stateChangeTypes=z,e}();T((function(e,t){q(e(),t)}),200),"undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?w.useLayoutEffect:w.useEffect;var ee={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+" has been selected.":""},scrollIntoView:R,circularNavigation:!1,environment:"undefined"==typeof window?{}:window};O.a.array.isRequired,O.a.func,O.a.func,O.a.func,O.a.bool,O.a.number,O.a.number,O.a.number,O.a.bool,O.a.bool,O.a.bool,O.a.any,O.a.any,O.a.any,O.a.string,O.a.string,O.a.string,O.a.func,O.a.string,O.a.func,O.a.func,O.a.func,O.a.func,O.a.func,O.a.shape({addEventListener:O.a.func,removeEventListener:O.a.func,document:O.a.shape({getElementById:O.a.func,activeElement:O.a.any,body:O.a.any})}),x(x({},ee),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.":"":"No results are available.":""}}),O.a.array.isRequired,O.a.func,O.a.func,O.a.func,O.a.bool,O.a.number,O.a.number,O.a.number,O.a.bool,O.a.bool,O.a.bool,O.a.any,O.a.any,O.a.any,O.a.string,O.a.string,O.a.string,O.a.string,O.a.string,O.a.string,O.a.func,O.a.string,O.a.string,O.a.func,O.a.func,O.a.func,O.a.func,O.a.func,O.a.func,O.a.shape({addEventListener:O.a.func,removeEventListener:O.a.func,document:O.a.shape({getElementById:O.a.func,activeElement:O.a.any,body:O.a.any})}),Object(g.a)({},ee,{getA11yStatusMessage:L,circularNavigation:!0}),O.a.array,O.a.array,O.a.array,O.a.func,O.a.func,O.a.func,O.a.number,O.a.number,O.a.number,O.a.func,O.a.func,O.a.string,O.a.string,O.a.shape({addEventListener:O.a.func,removeEventListener:O.a.func,document:O.a.shape({getElementById:O.a.func,activeElement:O.a.any,body:O.a.any})});var te=e=>{let{checked:t,getInputProps:n,inputRef:r,isDisabled:i,onFocus:c,onRemoveItem:s,placeholder:a,tabIndex:u,value:l}=e;return Object(o.createElement)("input",n({ref:r,className:"wc-block-dropdown-selector__input wc-block-components-dropdown-selector__input",disabled:i,onFocus:c,onKeyDown(e){"Backspace"===e.key&&!l&&t.length>0&&s(t[t.length-1])},placeholder:a,tabIndex:u}))},ne=e=>{let{children:t,onClick:n}=e;return Object(o.createElement)("div",{className:"wc-block-dropdown-selector__input-wrapper wc-block-components-dropdown-selector__input-wrapper",onClick:n},t)},re=e=>{let{checked:t,getItemProps:n,getMenuProps:r,highlightedIndex:c,options:s}=e;return Object(o.createElement)("ul",r({className:"wc-block-dropdown-selector__list wc-block-components-dropdown-selector__list"}),s.map((e,r)=>{const s=t.includes(e.value);return Object(o.createElement)("li",n({key:e.value,className:b()("wc-block-dropdown-selector__list-item","wc-block-components-dropdown-selector__list-item",{"is-selected":s,"is-highlighted":c===r}),index:r,item:e.value,"aria-label":s?Object(i.sprintf)(
|
14 |
/* translators: %s is referring to the filter option being removed. */
|
15 |
Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),e.name):null}),e.label)}))},oe=n(204),ie=e=>{let{onRemoveItem:t,option:n}=e;return Object(o.createElement)(oe.a,{className:"wc-block-dropdown-selector__selected-chip wc-block-components-dropdown-selector__selected-chip",removeOnAnyClick:!0,onRemove:()=>{t(n.value)},ariaLabel:Object(i.sprintf)(
|
16 |
/* translators: %s is referring to the filter option being removed. */
|
17 |
+
Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),n.name),text:n.label,radius:"large"})},ce=n(105),se=n(200),ae=e=>{let{onClick:t,onRemoveItem:n,option:r}=e;const c=Object(o.useRef)(null);return Object(o.useEffect)(()=>{c.current.focus()},[c]),Object(o.createElement)("div",{className:"wc-block-dropdown-selector__selected-value wc-block-components-dropdown-selector__selected-value"},Object(o.createElement)("button",{ref:c,className:"wc-block-dropdown-selector__selected-value__label wc-block-components-dropdown-selector__selected-value__label",onClick:e=>{e.stopPropagation(),t(r.value)},"aria-label":Object(i.sprintf)(
|
18 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
19 |
Object(i.__)("Replace current %s filter","woo-gutenberg-products-block"),r.name)},r.label),Object(o.createElement)("button",{className:"wc-block-dropdown-selector__selected-value__remove wc-block-components-dropdown-selector__selected-value__remove",onClick:()=>{n(r.value)},onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||n(r.value)},"aria-label":Object(i.sprintf)(
|
20 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
21 |
+
Object(i.__)("Remove %s filter","woo-gutenberg-products-block"),r.name)},Object(o.createElement)(ce.a,{icon:se.a,size:16})))};n(221);var ue=e=>{let{attributeLabel:t="",className:n,style:r={},checked:c=[],inputLabel:s="",isDisabled:a=!1,isLoading:u=!1,multiple:l=!1,onChange:d=(()=>{}),options:p=[],isCaseSensitive:f=!1}=e;const m=Object(o.useRef)(null),g=b()(n,"wc-block-dropdown-selector","wc-block-components-dropdown-selector",{"is-disabled":a,"is-loading":u}),h=Object(o.useCallback)((e,t)=>{switch(t.type){case Z.stateChangeTypes.keyDownEnter:case Z.stateChangeTypes.clickItem:return{...t,highlightedIndex:e.highlightedIndex,isOpen:l,inputValue:""};case Z.stateChangeTypes.blurInput:case Z.stateChangeTypes.mouseUp:return{...t,inputValue:e.inputValue};default:return t}},[l]);return Object(o.createElement)(Z,{onChange:d,selectedItem:null,stateReducer:h},e=>{let{getInputProps:n,getItemProps:u,getLabelProps:h,getMenuProps:v,highlightedIndex:y,inputValue:O,isOpen:w,openMenu:j}=e;return Object(o.createElement)("div",{className:b()(g,{"is-multiple":l,"is-single":!l,"has-checked":c.length>0,"is-open":w}),style:r},Object(o.createElement)("label",h({className:"screen-reader-text"}),s),Object(o.createElement)(ne,{isOpen:w,onClick:()=>m.current.focus()},c.map(e=>{const t=p.find(t=>t.value===e);if(!t)return null;const n=e=>{d(e),m.current.focus()};return l?Object(o.createElement)(ie,{key:e,onRemoveItem:n,option:t}):Object(o.createElement)(ae,{key:e,onClick:()=>m.current.focus(),onRemoveItem:n,option:t})}),Object(o.createElement)(te,{checked:c,getInputProps:n,inputRef:m,isDisabled:a,onFocus:j,onRemoveItem:e=>{d(e),m.current.focus()},placeholder:c.length>0&&l?null:Object(i.sprintf)(
|
22 |
/* translators: %s attribute name. */
|
23 |
+
Object(i.__)("Any %s","woo-gutenberg-products-block"),t),tabIndex:!l&&c.length>0?"-1":"0",value:O})),w&&!a&&Object(o.createElement)(re,{checked:c,getItemProps:u,getMenuProps:v,highlightedIndex:y,options:p.filter(e=>{let t=e.name,n=null==O?void 0:O.trim();var r;return f||(t=t.toLowerCase(),n=null===(r=n)||void 0===r?void 0:r.toLowerCase()),!n||t.includes(n)})}))})},le=n(53),de=n(76),pe=n(13),fe=n.n(pe),be=n(18),me=n(77),ge=n(2),he=n(15),ve=n(78),ye=n(52),Oe=n(20),we=n(220),je=n(124),Ee=n(110),_e=n(101);const Se=[{value:"preview-1",name:"Blue",label:Object(o.createElement)(le.a,{name:"Blue",count:3})},{value:"preview-2",name:"Green",label:Object(o.createElement)(le.a,{name:"Green",count:3})},{value:"preview-3",name:"Red",label:Object(o.createElement)(le.a,{name:"Red",count:2})}],xe={id:0,name:"preview",taxonomy:"preview",label:"Preview"};var ke=n(137);n(219);const Ie=e=>e.replace("pa_",""),Ce=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,i=Ie(t),c=r.join(","),s=`${je.b}${i}`,a="in"===o?"or":"and";n[`${je.a}${i}`]=c,n[s]=a});const r=Object(he.removeQueryArgs)(e,...Object.keys(n));return Object(he.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)};const Pe={heading:{type:"string",default:Object(i.__)("Filter by attribute","woo-gutenberg-products-block")}};var Te=n(114);Object(r.a)({selector:".wp-block-woocommerce-attribute-filter",Block:e=>{let{attributes:t,isEditor:n=!1}=e;const r=Object(ge.getSettingWithCoercion)("has_filterable_products",!1,ve.a),f=Object(ge.getSettingWithCoercion)("is_rendering_php_template",!1,ve.a),m=Object(ge.getSettingWithCoercion)("page_url",window.location.href,ye.a),[g,h]=Object(o.useState)(!1),v=t.isPreview&&!t.attributeId?xe:Object(Ee.a)(t.attributeId),y=Object(o.useMemo)(()=>(e=>{if(e){const t=Object(je.d)("filter_"+e.name);return"string"==typeof t?t.split(","):[]}return[]})(v),[v]),[O,w]=Object(o.useState)(y),[j,E]=Object(o.useState)(t.isPreview&&!t.attributeId?Se:[]),_=Object(ke.a)(t),[S]=Object(u.a)(),[x,k]=Object(u.b)("attributes",[]),{results:I,isLoading:C}=Object(l.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==v?void 0:v.id)||0],shouldSelect:t.attributeId>0}),R="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:P,isLoading:T}=Object(d.a)({queryAttribute:{taxonomy:(null==v?void 0:v.taxonomy)||"",queryType:t.queryType},queryState:{...S,attributes:R?S.attributes:null}}),A=Object(o.useCallback)(e=>Object(Oe.b)(P,"attribute_counts")&&Array.isArray(P.attribute_counts)?P.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[P]);Object(o.useEffect)(()=>{if(C||T)return;if(!Array.isArray(I))return;const e=I.map(e=>{const n=A(e.id);if(!(n||O.includes(e.slug)||(r=e.slug,null!=S&&S.attributes&&S.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==v?void 0:v.taxonomy)&&n.includes(r)}))))return null;var r;const i=n?n.count:0;return{value:e.slug,name:Object(be.decodeEntities)(e.name),label:Object(o.createElement)(le.a,{name:Object(be.decodeEntities)(e.name),count:t.showCounts?i:null})}}).filter(e=>!!e);E(e)},[null==v?void 0:v.taxonomy,I,C,t.showCounts,T,A,O,S.attributes]);const M=Object(o.useCallback)(e=>Array.isArray(I)?I.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[I]),L=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(null==v||!v.taxonomy)return;const t=Object.keys(Object(he.getQueryArgs)(window.location.href)),n=Ie(v.taxonomy),r=t.reduce((e,t)=>t.includes(je.b+n)||t.includes(je.a+n)?Object(he.removeQueryArgs)(e,t):e,window.location.href),o=Ce(r,e);Object(je.c)(o)}else{const t=Ce(m,e),n=Object(he.getQueryArgs)(window.location.href),r=Object(he.getQueryArgs)(t);Re(n,r)||Object(je.c)(t)}}),[m,null==v?void 0:v.taxonomy]),D=Object(o.useCallback)((function(e){let r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||(w(e),!r&&t.showFilterButton||Object(_e.b)(x,k,v,M(e),"or"===t.queryType?"in":"and"))}),[n,w,x,k,v,M,t.queryType,t.showFilterButton]),N=Object(o.useMemo)(()=>Object(we.a)(x)?x.filter(e=>{let{attribute:t}=e;return t===(null==v?void 0:v.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[x,null==v?void 0:v.taxonomy]),H=Object(s.a)(N),F=Object(a.a)(H);Object(o.useEffect)(()=>{!F||fe()(F,H)||fe()(O,H)||D(H)},[O,H,F,D]);const B="single"!==t.selectType,V=Object(o.useCallback)(e=>{const t=e=>{const t=j.find(t=>t.value===e);if(t)return t.name},n=e=>{let{filterAdded:n,filterRemoved:r}=e;const o=n?t(n):null,s=r?t(r):null;o&&s?Object(c.speak)(Object(i.sprintf)(
|
24 |
/* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
|
25 |
Object(i.__)("%1$s filter replaced with %2$s.","woo-gutenberg-products-block"),o,s)):o?Object(c.speak)(Object(i.sprintf)(
|
26 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
27 |
Object(i.__)("%s filter added.","woo-gutenberg-products-block"),o)):s&&Object(c.speak)(Object(i.sprintf)(
|
28 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
29 |
+
Object(i.__)("%s filter removed.","woo-gutenberg-products-block"),s))},r=O.includes(e);let o;B?(o=O.filter(t=>t!==e),r?n({filterRemoved:e}):(o.push(e),o.sort(),n({filterAdded:e}))):(o=r?[]:[e],n({filterAdded:r?null:e,filterRemoved:1===O.length?O[0]:null})),D(o)},[O,j,B,D]);if(Object(o.useEffect)(()=>{v&&!t.showFilterButton&&((e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length})({currentCheckedFilters:O,hasSetFilterDefaultsFromUrl:g})?L(x,!0):L(x,!1))},[g,L,x,v,O,t.showFilterButton]),Object(o.useEffect)(()=>{if(!g&&!C)return y.length>0?(h(!0),void D(y,!0)):void(f||h(!0))},[v,g,C,D,y,f]),!r)return null;if(!v)return n?Object(o.createElement)(me.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(i.__)("Please select an attribute to use this filter!","woo-gutenberg-products-block"))):null;if(0===j.length&&!C)return n?Object(o.createElement)(me.a,{status:"warning",isDismissible:!1},Object(o.createElement)("p",null,Object(i.__)("The selected attribute does not have any term assigned to products.","woo-gutenberg-products-block"))):null;const W="h"+t.headingLevel,U=!t.isPreview&&C,K=!t.isPreview&&T;return Object(o.createElement)(o.Fragment,null,!n&&t.heading&&j.length>0&&Object(o.createElement)(W,{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)(ue,{attributeLabel:v.label,checked:O,className:b()("wc-block-attribute-filter-dropdown",_.className),style:{..._.style,borderStyle:"none"},inputLabel:t.heading,isLoading:U,multiple:B,onChange:V,options:j}):Object(o.createElement)(p.a,{className:"wc-block-attribute-filter-list",options:j,checked:O,onChange:V,isLoading:U,isDisabled:K}),t.showFilterButton&&Object(o.createElement)(de.a,{className:"wc-block-attribute-filter__button",disabled:U||K,onClick:()=>(e=>{const n=Object(_e.b)(x,k,v,M(e),"or"===t.queryType?"in":"and");L(n,0===e.length)})(O)})))},getProps:e=>({isEditor:!1,attributes:{attributeId:parseInt(e.dataset.attributeId||"0",10),showCounts:"true"===e.dataset.showCounts,queryType:e.dataset.queryType||Te.attributes.queryType.default,heading:e.dataset.heading||Pe.heading.default,headingLevel:e.dataset.headingLevel?parseInt(e.dataset.headingLevel,10):Te.attributes.headingLevel.default,displayStyle:e.dataset.displayStyle||Te.attributes.displayStyle.default,showFilterButton:"true"===e.dataset.showFilterButton,selectType:e.dataset.selectType||Te.attributes.selectType.default}})})}]);
|
build/attribute-filter.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', '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-polyfill', 'wp-primitives', 'wp-url', 'wp-warning'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', '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-polyfill', 'wp-primitives', 'wp-url', 'wp-warning'), 'version' => '434495b9a519133fa804cb9f2b39750c');
|
build/attribute-filter.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
-
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["attribute-filter"]=function(e){function t(t){for(var c,l,a=t[0],s=t[1],i=t[2],b=0,d=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(r,l)&&r[l]&&d.push(r[l][0]),r[l]=0;for(c in s)Object.prototype.hasOwnProperty.call(s,c)&&(e[c]=s[c]);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],c=!0,a=1;a<n.length;a++){var s=n[a];0!==r[s]&&(c=!1)}c&&(o.splice(t--,1),e=l(l.s=n[0]))}return e}var c={},r={9:0,1:0,2:0},o=[];function l(t){if(c[t])return c[t].exports;var n=c[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=c,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 c in e)l.d(n,c,function(t){return e[t]}.bind(null,c));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([420,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 v}));var c=n(6),r=n.n(c),o=n(0),l=n(1),a=n(3),s=n(115),i=n(529),u=n(4),b=n.n(u),d=n(10),p=n(21),m=n(
|
2 |
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)(m.b,e),w=e=>{const{list:t,selected:n,renderItem:c,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,c({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(o.createElement)(w,r()({},e,{list:t.children,depth:l+1})))})):null},_=e=>{let{isLoading:t,isSingle:n,selected:c,messages:r,onChange:s,onRemove:i}=e;if(t||n||!c)return null;const u=c.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,r.selected(u)),u>0?Object(o.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":r.clear},Object(l.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(o.createElement)("ul",null,c.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:c,instanceId:r,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:p}=a,m=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:m,onSelect:c,instanceId:r,isSingle:p,search:n}))},v=e=>{const{className:t="",isCompact:n,isHierarchical:c,isLoading:l,isSingle:s,list:i,messages:u=p.a,onChange:m,onSearch:g,selected:O,debouncedSpeak:j}=e,[f,h]=Object(o.useState)(""),w=Object(d.useInstanceId)(v),k=Object(o.useMemo)(()=>({...p.a,...u}),[u]),E=Object(o.useMemo)(()=>Object(p.c)(i,f,c),[i,f,c]);Object(o.useEffect)(()=>{j&&j(k.updated)},[j,k]),Object(o.useEffect)(()=>{"function"==typeof g&&g(f)},[f,g]);const S=Object(o.useCallback)(e=>()=>{s&&m([]);const t=O.findIndex(t=>{let{id:n}=t;return n===e});m([...O.slice(0,t),...O.slice(t+1)])},[s,O,m]),C=Object(o.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:n}=t;return n===e.id})?m(s?[e]:[...O,e]):S(e.id)()},[s,S,m,O]);return Object(o.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":n})},Object(o.createElement)(_,r()({},e,{onRemove:S,messages:k})),Object(o.createElement)("div",{className:"woocommerce-search-list__search"},Object(o.createElement)(a.TextControl,{label:k.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,r()({},e,{search:f,filteredList:E,messages:k,onSelect:C,instanceId:w})))};Object(a.withSpokenMessages)(v)},102:function(e,t,n){"use strict";var c=n(0),r=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(c.createElement)(a.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(c.createElement)(a.Path,{d:n[t]})):null}class i extends c.Component{createLevelControl(e,t,n){const r=e===t;return{icon:Object(c.createElement)(s,{level:e}),title:Object(o.sprintf)(
|
3 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
4 |
Object(o.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:r,onClick:()=>n(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:n,selectedLevel:o,onChange:a}=this.props;return Object(c.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(c.createElement)(s,{level:o}),controls:Object(r.range)(t,n).map(e=>this.createLevelControl(e,o,a))})}}t.a=i},103:function(e,t){e.exports=window.wp.warning},108:function(e,t,n){"use strict";var c=n(0),r=n(1),o=n(30);n(245),t.a=e=>{let{name:t,count:n}=e;return Object(c.createElement)(c.Fragment,null,t,n&&Number.isFinite(n)&&Object(c.createElement)(o.a,{label:n.toString(),screenReaderLabel:Object(r.sprintf)(
|
5 |
/* translators: %s number of products. */
|
6 |
-
Object(r._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},11:function(e,t){e.exports=window.wp.primitives},110:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));const c=e=>"string"==typeof e},111:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var c=n(8);function r(e,t){const n=Object(c.useRef)();return Object(c.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},122:function(e,t,n){"use strict";var c=n(0),r=n(5),o=n(10),l=n(1);n(
|
7 |
/* translators: Submit button text for filters. */
|
8 |
-
o=Object(r.__)("Go","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:i=Object(r.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(c.createElement)("button",{type:"submit",className:l()("wc-block-filter-submit-button","wc-block-components-filter-submit-button",t),disabled:n,onClick:s},Object(c.createElement)(a.a,{label:o,screenReaderLabel:i}))}},
|
9 |
/* translators: %s is referring the remaining count of options */
|
10 |
Object(r._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(r.sprintf)(
|
11 |
/* translators: %s number of options to reveal. */
|
@@ -13,28 +13,28 @@ Object(r._n)("Show %s more","Show %s more",e,"woo-gutenberg-products-block"),e))
|
|
13 |
/* Translators: %s search term */
|
14 |
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)(
|
15 |
/* translators: Number of items selected from list. */
|
16 |
-
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(r.groupBy)(e,"parent"),c=Object(r.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(c[e.parent]);return[...t,e.name]},a=e=>e.map(e=>{const t=n[e.id];return o.push(""+e.id),{...e,breadcrumbs:l(c[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 c=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),r=e.map(e=>!!c.test(e.name)&&e).filter(Boolean);return n?a(r,e):r},i=(e,t)=>{if(!t)return e;const n=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"ig");return e.split(n).map((e,n)=>0===n?e:Object(c.createElement)(c.Fragment,{key:n},Object(c.createElement)("strong",null,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()},212:function(e,t,n){"use strict";var c=n(6),r=n.n(c),o=n(0),l=n(4),a=n.n(l),s=n(1),i=n(115),u=n(551);n(
|
17 |
/* translators: Remove chip. */
|
18 |
Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
|
19 |
/* translators: %s text of the chip to remove. */
|
20 |
-
Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const j={"aria-label":t,disabled:c,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},f=d?j:{},h=d?{"aria-hidden":!0}:j;return Object(o.createElement)(b,r()({},g,f,{className:a()(n,"is-removable"),element:d?"button":g.element,screenReaderText:m,text:p}),Object(o.createElement)(O,r()({className:"wc-block-components-chip__remove"},h),Object(o.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},22: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 p})),n.d(t,"c",(function(){return m})),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 c,r=n(2);const o=Object(r.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),l=o.pluginUrl+"images/",a=o.pluginUrl+"build/",s=o.buildPhase,i=null===(c=r.STORE_PAGES.shop)||void 0===c?void 0:c.permalink,u=r.STORE_PAGES.checkout.id,b=r.STORE_PAGES.checkout.permalink,d=r.STORE_PAGES.privacy.permalink,p=(r.STORE_PAGES.privacy.title,r.STORE_PAGES.terms.permalink),m=(r.STORE_PAGES.terms.title,r.STORE_PAGES.cart.id),g=r.STORE_PAGES.cart.permalink,O=(r.STORE_PAGES.myaccount.permalink?r.STORE_PAGES.myaccount.permalink:Object(r.getSetting)("wpLoginUrl","/wp-login.php"),Object(r.getSetting)("shippingCountries",{})),j=Object(r.getSetting)("allowedCountries",{}),f=Object(r.getSetting)("shippingStates",{}),h=Object(r.getSetting)("allowedStates",{})},231:function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter Products by Attribute","description":"Allow customers to filter the grid by product attribute, such as color. Works in combination with the All Products block.","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},"isPreview":{"type":"boolean","default":false}},"textdomain":"woo-gutenberg-products-block","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},244:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));const c=e
|
21 |
/* translators: %s is referring to the filter option being removed. */
|
22 |
-
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),e.name):null}),e.label)}))},
|
23 |
/* translators: %s is referring to the filter option being removed. */
|
24 |
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),n.name),text:n.label,radius:"large"})},I=n(551),L=e=>{let{onClick:t,onRemoveItem:n,option:c}=e;const r=Object(o.useRef)(null);return Object(o.useEffect)(()=>{r.current.focus()},[r]),Object(o.createElement)("div",{className:"wc-block-dropdown-selector__selected-value wc-block-components-dropdown-selector__selected-value"},Object(o.createElement)("button",{ref:r,className:"wc-block-dropdown-selector__selected-value__label wc-block-components-dropdown-selector__selected-value__label",onClick:e=>{e.stopPropagation(),t(c.value)},"aria-label":Object(l.sprintf)(
|
25 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
26 |
Object(l.__)("Replace current %s filter","woo-gutenberg-products-block"),c.name)},c.label),Object(o.createElement)("button",{className:"wc-block-dropdown-selector__selected-value__remove wc-block-components-dropdown-selector__selected-value__remove",onClick:()=>{n(c.value)},onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||n(c.value)},"aria-label":Object(l.sprintf)(
|
27 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
28 |
-
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),c.name)},Object(o.createElement)(u.a,{icon:I.a,size:16})))};n(424);var B=e=>{let{attributeLabel:t="",className:n,style:c={},checked:r=[],inputLabel:a="",isDisabled:s=!1,isLoading:i=!1,multiple:u=!1,onChange:b=(()=>{}),options:d=[],isCaseSensitive:m=!1}=e;const g=Object(o.useRef)(null),O=p()(n,"wc-block-dropdown-selector","wc-block-components-dropdown-selector",{"is-disabled":s,"is-loading":i}),j=Object(o.useCallback)((e,t)=>{switch(t.type){case x.a.stateChangeTypes.keyDownEnter:case x.a.stateChangeTypes.clickItem:return{...t,highlightedIndex:e.highlightedIndex,isOpen:u,inputValue:""};case x.a.stateChangeTypes.blurInput:case x.a.stateChangeTypes.mouseUp:return{...t,inputValue:e.inputValue};default:return t}},[u]);return Object(o.createElement)(x.a,{onChange:b,selectedItem:null,stateReducer:j},e=>{let{getInputProps:n,getItemProps:i,getLabelProps:j,getMenuProps:f,highlightedIndex:h,inputValue:w,isOpen:_,openMenu:y}=e;return Object(o.createElement)("div",{className:p()(O,{"is-multiple":u,"is-single":!u,"has-checked":r.length>0,"is-open":_}),style:c},Object(o.createElement)("label",j({className:"screen-reader-text"}),a),Object(o.createElement)(
|
29 |
/* translators: %s attribute name. */
|
30 |
-
Object(l.__)("Any %s","woo-gutenberg-products-block"),t),tabIndex:!u&&r.length>0?"-1":"0",value:w})),_&&!s&&Object(o.createElement)(
|
31 |
/* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
|
32 |
Object(l.__)("%1$s filter replaced with %2$s.","woo-gutenberg-products-block"),r,o)):r?Object(_.speak)(Object(l.sprintf)(
|
33 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
34 |
Object(l.__)("%s filter added.","woo-gutenberg-products-block"),r)):o&&Object(_.speak)(Object(l.sprintf)(
|
35 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
36 |
-
Object(l.__)("%s filter removed.","woo-gutenberg-products-block"),o))},c=
|
37 |
/* translators: %s attribute name. */
|
38 |
Object(l.__)("Filter by %s","woo-gutenberg-products-block"),o)})},P=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)(
|
39 |
/* translators: %d is the number of attributes selected. */
|
40 |
-
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")},c=Object(O.sortBy)(
|
1 |
+
this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["attribute-filter"]=function(e){function t(t){for(var c,l,a=t[0],s=t[1],i=t[2],b=0,d=[];b<a.length;b++)l=a[b],Object.prototype.hasOwnProperty.call(r,l)&&r[l]&&d.push(r[l][0]),r[l]=0;for(c in s)Object.prototype.hasOwnProperty.call(s,c)&&(e[c]=s[c]);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],c=!0,a=1;a<n.length;a++){var s=n[a];0!==r[s]&&(c=!1)}c&&(o.splice(t--,1),e=l(l.s=n[0]))}return e}var c={},r={9:0,1:0,2:0},o=[];function l(t){if(c[t])return c[t].exports;var n=c[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=c,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 c in e)l.d(n,c,function(t){return e[t]}.bind(null,c));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([420,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 v}));var c=n(6),r=n.n(c),o=n(0),l=n(1),a=n(3),s=n(115),i=n(529),u=n(4),b=n.n(u),d=n(10),p=n(21),m=n(36),g=n(528),O=n(14);const j=e=>{let{id:t,label:n,popoverContents:c,remove:r,screenReaderLabel:i,className:u=""}=e;const[p,m]=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":!!r}),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},c?Object(o.createElement)(a.Button,{className:"woocommerce-tag__text",id:w,onClick:()=>m(!0)},_):Object(o.createElement)("span",{className:"woocommerce-tag__text",id:w},_),c&&p&&Object(o.createElement)(a.Popover,{onClose:()=>m(!1)},c),r&&Object(o.createElement)(a.Button,{className:"woocommerce-tag__remove",onClick:r(t),label:Object(l.sprintf)(// Translators: %s label.
|
2 |
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)(m.b,e),w=e=>{const{list:t,selected:n,renderItem:c,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,c({item:t,isSelected:b,onSelect:a,isSingle:i,search:u,depth:l,controlId:s})),Object(o.createElement)(w,r()({},e,{list:t.children,depth:l+1})))})):null},_=e=>{let{isLoading:t,isSingle:n,selected:c,messages:r,onChange:s,onRemove:i}=e;if(t||n||!c)return null;const u=c.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,r.selected(u)),u>0?Object(o.createElement)(a.Button,{isLink:!0,isDestructive:!0,onClick:()=>s([]),"aria-label":r.clear},Object(l.__)("Clear all","woo-gutenberg-products-block")):null),u>0?Object(o.createElement)("ul",null,c.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:c,instanceId:r,...a}=e;const{messages:u,renderItem:b,selected:d,isSingle:p}=a,m=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:m,onSelect:c,instanceId:r,isSingle:p,search:n}))},v=e=>{const{className:t="",isCompact:n,isHierarchical:c,isLoading:l,isSingle:s,list:i,messages:u=p.a,onChange:m,onSearch:g,selected:O,debouncedSpeak:j}=e,[f,h]=Object(o.useState)(""),w=Object(d.useInstanceId)(v),k=Object(o.useMemo)(()=>({...p.a,...u}),[u]),E=Object(o.useMemo)(()=>Object(p.c)(i,f,c),[i,f,c]);Object(o.useEffect)(()=>{j&&j(k.updated)},[j,k]),Object(o.useEffect)(()=>{"function"==typeof g&&g(f)},[f,g]);const S=Object(o.useCallback)(e=>()=>{s&&m([]);const t=O.findIndex(t=>{let{id:n}=t;return n===e});m([...O.slice(0,t),...O.slice(t+1)])},[s,O,m]),C=Object(o.useCallback)(e=>()=>{-1===O.findIndex(t=>{let{id:n}=t;return n===e.id})?m(s?[e]:[...O,e]):S(e.id)()},[s,S,m,O]);return Object(o.createElement)("div",{className:b()("woocommerce-search-list",t,{"is-compact":n})},Object(o.createElement)(_,r()({},e,{onRemove:S,messages:k})),Object(o.createElement)("div",{className:"woocommerce-search-list__search"},Object(o.createElement)(a.TextControl,{label:k.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,r()({},e,{search:f,filteredList:E,messages:k,onSelect:C,instanceId:w})))};Object(a.withSpokenMessages)(v)},102:function(e,t,n){"use strict";var c=n(0),r=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(c.createElement)(a.SVG,{width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},Object(c.createElement)(a.Path,{d:n[t]})):null}class i extends c.Component{createLevelControl(e,t,n){const r=e===t;return{icon:Object(c.createElement)(s,{level:e}),title:Object(o.sprintf)(
|
3 |
/* translators: %s: heading level e.g: "2", "3", "4" */
|
4 |
Object(o.__)("Heading %d","woo-gutenberg-products-block"),e),isActive:r,onClick:()=>n(e)}}render(){const{isCollapsed:e=!0,minLevel:t,maxLevel:n,selectedLevel:o,onChange:a}=this.props;return Object(c.createElement)(l.ToolbarGroup,{isCollapsed:e,icon:Object(c.createElement)(s,{level:o}),controls:Object(r.range)(t,n).map(e=>this.createLevelControl(e,o,a))})}}t.a=i},103:function(e,t){e.exports=window.wp.warning},108:function(e,t,n){"use strict";var c=n(0),r=n(1),o=n(30);n(245),t.a=e=>{let{name:t,count:n}=e;return Object(c.createElement)(c.Fragment,null,t,n&&Number.isFinite(n)&&Object(c.createElement)(o.a,{label:n.toString(),screenReaderLabel:Object(r.sprintf)(
|
5 |
/* translators: %s number of products. */
|
6 |
+
Object(r._n)("%s product","%s products",n,"woo-gutenberg-products-block"),n),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}}))}},11:function(e,t){e.exports=window.wp.primitives},110:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));const c=e=>"string"==typeof e},111:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var c=n(8);function r(e,t){const n=Object(c.useRef)();return Object(c.useEffect)(()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)},[e,t]),n.current}},122:function(e,t,n){"use strict";var c=n(0),r=n(5),o=n(10),l=n(1);n(156),t.a=Object(o.withInstanceId)(e=>{let{className:t,headingLevel:n,onChange:o,heading:a,instanceId:s}=e;const i="h"+n;return Object(c.createElement)(i,{className:t},Object(c.createElement)("label",{className:"screen-reader-text",htmlFor:"block-title-"+s},Object(l.__)("Block title","woo-gutenberg-products-block")),Object(c.createElement)(r.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 r}));var c=n(0);const r=()=>{const[,e]=Object(c.useState)();return Object(c.useCallback)(t=>{e(()=>{throw t})},[])}},125:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var c=n(18),r=n(9),o=n(0),l=n(50),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),p=Object(l.a)(s),m=Object(a.a)(),g=Object(r.useSelect)(e=>{if(!u)return null;const r=e(c.COLLECTIONS_STORE_KEY),o=[t,n,d,p],l=r.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:r.getCollection(...o),isLoading:!r.hasFinishedResolution("getCollection",o)}},[t,n,p,d,u]);return null!==g&&(b.current=g),b.current}},13:function(e,t){e.exports=window.wp.blocks},14:function(e,t){e.exports=window.wp.htmlEntities},144:function(e,t,n){"use strict";var c=n(0),r=n(1),o=n(4),l=n.n(o),a=n(30);n(185),t.a=e=>{let{className:t,disabled:n,label:
|
7 |
/* translators: Submit button text for filters. */
|
8 |
+
o=Object(r.__)("Go","woo-gutenberg-products-block"),onClick:s,screenReaderLabel:i=Object(r.__)("Apply filter","woo-gutenberg-products-block")}=e;return Object(c.createElement)("button",{type:"submit",className:l()("wc-block-filter-submit-button","wc-block-components-filter-submit-button",t),disabled:n,onClick:s},Object(c.createElement)(a.a,{label:o,screenReaderLabel:i}))}},156:function(e,t){},157:function(e,t){},16:function(e,t){e.exports=window.wp.url},162:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));const c=e=>"boolean"==typeof e},170:function(e,t,n){"use strict";n.d(t,"a",(function(){return r})),n.d(t,"b",(function(){return o}));var c=n(7);const r=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,r=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(r)))return;const a=l.slug.filter(e=>e!==r),s=e.filter(e=>e.attribute!==n.taxonomy);a.length>0&&(l.slug=a.sort(),s.push(l)),t(Object(c.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,r=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===r.length?t(l):(l.push({attribute:n.taxonomy,operator:o,slug:r.map(e=>{let{slug:t}=e;return t}).sort()}),t(Object(c.sortBy)(l,"attribute"))),l}},18:function(e,t){e.exports=window.wc.wcBlocksData},185:function(e,t){},2:function(e,t){e.exports=window.wc.wcSettings},201:function(e,t,n){"use strict";n.d(t,"a",(function(){return o})),n.d(t,"b",(function(){return l}));var c=n(2);const r=Object(c.getSetting)("attributes",[]).reduce((e,t)=>{const n=(c=t)&&c.attribute_name?{id:parseInt(c.attribute_id,10),name:c.attribute_name,taxonomy:"pa_"+c.attribute_name,label:c.attribute_label}:null;var c;return n&&n.id&&e.push(n),e},[]),o=e=>{if(e)return r.find(t=>t.id===e)},l=e=>{if(e)return r.find(t=>t.taxonomy===e)}},202:function(e,t,n){"use strict";var c=n(0),r=n(1),o=n(4),l=n.n(o);n(246),t.a=e=>{let{className:t,onChange:n,options:o=[],checked:a=[],isLoading:s=!1,isDisabled:i=!1,limit:u=10}=e;const[b,d]=Object(c.useState)(!1),p=Object(c.useMemo)(()=>[...Array(5)].map((e,t)=>Object(c.createElement)("li",{key:t,style:{width:Math.floor(75*Math.random())+25+"%"}})),[]),m=Object(c.useMemo)(()=>{const e=o.length-u;return!b&&Object(c.createElement)("li",{key:"show-more",className:"show-more"},Object(c.createElement)("button",{onClick:()=>{d(!0)},"aria-expanded":!1,"aria-label":Object(r.sprintf)(
|
9 |
/* translators: %s is referring the remaining count of options */
|
10 |
Object(r._n)("Show %s more option","Show %s more options",e,"woo-gutenberg-products-block"),e)},Object(r.sprintf)(
|
11 |
/* translators: %s number of options to reveal. */
|
13 |
/* Translators: %s search term */
|
14 |
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)(
|
15 |
/* translators: Number of items selected from list. */
|
16 |
+
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(r.groupBy)(e,"parent"),c=Object(r.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(c[e.parent]);return[...t,e.name]},a=e=>e.map(e=>{const t=n[e.id];return o.push(""+e.id),{...e,breadcrumbs:l(c[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 c=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),r=e.map(e=>!!c.test(e.name)&&e).filter(Boolean);return n?a(r,e):r},i=(e,t)=>{if(!t)return e;const n=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"ig");return e.split(n).map((e,n)=>0===n?e:Object(c.createElement)(c.Fragment,{key:n},Object(c.createElement)("strong",null,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()},212:function(e,t,n){"use strict";var c=n(6),r=n.n(c),o=n(0),l=n(4),a=n.n(l),s=n(1),i=n(115),u=n(551);n(157);var b=e=>{let{text:t,screenReaderText:n="",element:c="li",className:l="",radius:s="small",children:i=null,...u}=e;const b=c,d=a()(l,"wc-block-components-chip","wc-block-components-chip--radius-"+s),p=Boolean(n&&n!==t);return Object(o.createElement)(b,r()({className:d},u),Object(o.createElement)("span",{"aria-hidden":p,className:"wc-block-components-chip__text"},t),p&&Object(o.createElement)("span",{className:"screen-reader-text"},n),i)};t.a=e=>{let{ariaLabel:t="",className:n="",disabled:c=!1,onRemove:l=(()=>{}),removeOnAnyClick:d=!1,text:p,screenReaderText:m="",...g}=e;const O=d?"span":"button";if(!t){const e=m&&"string"==typeof m?m:p;t="string"!=typeof e?
|
17 |
/* translators: Remove chip. */
|
18 |
Object(s.__)("Remove","woo-gutenberg-products-block"):Object(s.sprintf)(
|
19 |
/* translators: %s text of the chip to remove. */
|
20 |
+
Object(s.__)('Remove "%s"',"woo-gutenberg-products-block"),e)}const j={"aria-label":t,disabled:c,onClick:l,onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||l()}},f=d?j:{},h=d?{"aria-hidden":!0}:j;return Object(o.createElement)(b,r()({},g,f,{className:a()(n,"is-removable"),element:d?"button":g.element,screenReaderText:m,text:p}),Object(o.createElement)(O,r()({className:"wc-block-components-chip__remove"},h),Object(o.createElement)(i.a,{className:"wc-block-components-chip__remove-icon",icon:u.a,size:16})))}},22: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 p})),n.d(t,"c",(function(){return m})),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 c,r=n(2);const o=Object(r.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),l=o.pluginUrl+"images/",a=o.pluginUrl+"build/",s=o.buildPhase,i=null===(c=r.STORE_PAGES.shop)||void 0===c?void 0:c.permalink,u=r.STORE_PAGES.checkout.id,b=r.STORE_PAGES.checkout.permalink,d=r.STORE_PAGES.privacy.permalink,p=(r.STORE_PAGES.privacy.title,r.STORE_PAGES.terms.permalink),m=(r.STORE_PAGES.terms.title,r.STORE_PAGES.cart.id),g=r.STORE_PAGES.cart.permalink,O=(r.STORE_PAGES.myaccount.permalink?r.STORE_PAGES.myaccount.permalink:Object(r.getSetting)("wpLoginUrl","/wp-login.php"),Object(r.getSetting)("shippingCountries",{})),j=Object(r.getSetting)("allowedCountries",{}),f=Object(r.getSetting)("shippingStates",{}),h=Object(r.getSetting)("allowedStates",{})},231:function(e){e.exports=JSON.parse('{"name":"woocommerce/attribute-filter","version":"1.0.0","title":"Filter Products by Attribute","description":"Allow customers to filter the grid by product attribute, such as color. Works in combination with the All Products block.","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"}')},244: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 c=n(16),r=n(2),o=n(162);const l=Object(r.getSettingWithCoercion)("is_rendering_php_template",!1,o.a),a="query_type_",s="filter_";function i(e){return window?Object(c.getQueryArg)(window.location.href,e):null}function u(e){l?window.location.href=e:window.history.replaceState({},"",e)}},245:function(e,t){},246:function(e,t){},25:function(e,t){e.exports=window.wp.isShallowEqual},3:function(e,t){e.exports=window.wp.components},30:function(e,t,n){"use strict";var c=n(0),r=n(4),o=n.n(r);t.a=e=>{let t,{label:n,screenReaderLabel:r,wrapperElement:l,wrapperProps:a={}}=e;const s=null!=n,i=null!=r;return!s&&i?(t=l||"span",a={...a,className:o()(a.className,"screen-reader-text")},Object(c.createElement)(t,a,r)):(t=l||c.Fragment,s&&i&&n!==r?Object(c.createElement)(t,a,Object(c.createElement)("span",{"aria-hidden":"true"},n),Object(c.createElement)("span",{className:"screen-reader-text"},r)):Object(c.createElement)(t,a,n))}},302:function(e,t,n){"use strict";n.d(t,"a",(function(){return b}));var c=n(0),r=n(278),o=n(7),l=n(50),a=n(35),s=n(76),i=n(125),u=n(52);const b=e=>{let{queryAttribute:t,queryPrices:n,queryStock:b,queryState:d}=e,p=Object(u.a)();p+="-collection-data";const[m]=Object(s.a)(p),[g,O]=Object(s.b)("calculate_attribute_counts",[],p),[j,f]=Object(s.b)("calculate_price_range",null,p),[h,w]=Object(s.b)("calculate_stock_status_counts",null,p),_=Object(l.a)(t||{}),y=Object(l.a)(n),v=Object(l.a)(b);Object(c.useEffect)(()=>{"object"==typeof _&&Object.keys(_).length&&(g.find(e=>Object(a.b)(_,"taxonomy")&&e.taxonomy===_.taxonomy)||O([...g,_]))},[_,g,O]),Object(c.useEffect)(()=>{j!==y&&void 0!==y&&f(y)},[y,f,j]),Object(c.useEffect)(()=>{h!==v&&void 0!==v&&w(v)},[v,w,h]);const[k,E]=Object(c.useState)(!1),[S]=Object(r.a)(k,200);k||E(!0);const C=Object(c.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})(m),[m]);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 c})),n.d(t,"b",(function(){return r}));const c=e=>!(e=>null===e)(e)&&e instanceof Object&&e.constructor===Object;function r(e,t){return c(e)&&t in e}},36:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var c=n(6),r=n.n(c),o=n(0),l=n(21);const a=e=>{let{countLabel:t,className:n,depth:c=0,controlId:a="",item:s,isSelected:i,isSingle:u,onSelect:b,search:d="",...p}=e;const m=null!=t&&void 0!==s.count&&null!==s.count,g=[n,"woocommerce-search-list__item"];g.push("depth-"+c),u&&g.push("is-radio-button"),m&&g.push("has-count");const O=s.breadcrumbs&&s.breadcrumbs.length,j=p.name||"search-list-item-"+a,f=`${j}-${s.id}`;return Object(o.createElement)("label",{htmlFor:f,className:g.join(" ")},u?Object(o.createElement)("input",r()({type:"radio",id:f,name:j,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},p)):Object(o.createElement)("input",r()({type:"checkbox",id:f,name:j,value:s.value,onChange:b(s),checked:i,className:"woocommerce-search-list__item-input"},p)),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))),!!m&&Object(o.createElement)("span",{className:"woocommerce-search-list__item-count"},t||s.count))};t.b=a},420:function(e,t,n){e.exports=n(488)},421:function(e,t){},422:function(e,t){},423:function(e,t,n){"use strict";n.d(t,"b",(function(){return o})),n.d(t,"a",(function(){return a}));var c=n(35);const r=e=>Object(c.b)(e,"count")&&Object(c.b)(e,"description")&&Object(c.b)(e,"id")&&Object(c.b)(e,"name")&&Object(c.b)(e,"parent")&&Object(c.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(r),l=e=>Object(c.b)(e,"attribute")&&Object(c.b)(e,"operator")&&Object(c.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)},424:function(e,t){},44:function(e,t,n){"use strict";n.d(t,"c",(function(){return i})),n.d(t,"d",(function(){return u})),n.d(t,"b",(function(){return b})),n.d(t,"a",(function(){return d}));var c=n(5),r=n(65),o=n(110),l=n(35),a=n(95);const s=e=>Object(o.a)(e)?JSON.parse(e)||{}:Object(l.a)(e)?e:{},i=e=>{if(!Object(r.b)()||!Object(a.a)())return{style:{}};const t=Object(l.a)(e)?e:{},n=s(t.style);return Object(c.__experimentalGetSpacingClassesAndStyles)({...t,style:n})},u=e=>{const t=Object(l.a)(e)?e:{},n=s(t.style),c=Object(l.a)(n.typography)?n.typography:{};return{style:{fontSize:t.fontSize?`var(--wp--preset--font-size--${t.fontSize})`:c.fontSize,lineHeight:c.lineHeight,fontWeight:c.fontWeight,textTransform:c.textTransform,fontFamily:t.fontFamily}}},b=e=>{if(!Object(r.b)())return{className:"",style:{}};const t=Object(l.a)(e)?e:{},n=s(t.style);return Object(c.__experimentalUseColorProps)({...t,style:n})},d=e=>{if(!Object(r.b)())return{className:"",style:{}};const t=Object(l.a)(e)?e:{},n=s(t.style);return Object(c.__experimentalUseBorderProps)({...t,style:n})}},46:function(e,t){e.exports=window.wp.a11y},488:function(e,t,n){"use strict";n.r(t);var c=n(6),r=n.n(c),o=n(0),l=n(1),a=n(13),s=n(5),i=n(65),u=n(115),b=n(535),d=n(4),p=n.n(d),m=n(233),g=n(100),O=n(7),j=n(2),f=n(102),h=n(122),w=n(3),_=n(46),y=n(50),v=n(111),k=n(76),E=n(125),S=n(302),C=n(202),x=n(173),N=e=>{let{checked:t,getInputProps:n,inputRef:c,isDisabled:r,onFocus:l,onRemoveItem:a,placeholder:s,tabIndex:i,value:u}=e;return Object(o.createElement)("input",n({ref:c,className:"wc-block-dropdown-selector__input wc-block-components-dropdown-selector__input",disabled:r,onFocus:l,onKeyDown(e){"Backspace"===e.key&&!u&&t.length>0&&a(t[t.length-1])},placeholder:s,tabIndex:i}))},T=e=>{let{children:t,onClick:n}=e;return Object(o.createElement)("div",{className:"wc-block-dropdown-selector__input-wrapper wc-block-components-dropdown-selector__input-wrapper",onClick:n},t)},P=e=>{let{checked:t,getItemProps:n,getMenuProps:c,highlightedIndex:r,options:a}=e;return Object(o.createElement)("ul",c({className:"wc-block-dropdown-selector__list wc-block-components-dropdown-selector__list"}),a.map((e,c)=>{const a=t.includes(e.value);return Object(o.createElement)("li",n({key:e.value,className:p()("wc-block-dropdown-selector__list-item","wc-block-components-dropdown-selector__list-item",{"is-selected":a,"is-highlighted":r===c}),index:c,item:e.value,"aria-label":a?Object(l.sprintf)(
|
21 |
/* translators: %s is referring to the filter option being removed. */
|
22 |
+
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),e.name):null}),e.label)}))},A=n(212),R=e=>{let{onRemoveItem:t,option:n}=e;return Object(o.createElement)(A.a,{className:"wc-block-dropdown-selector__selected-chip wc-block-components-dropdown-selector__selected-chip",removeOnAnyClick:!0,onRemove:()=>{t(n.value)},ariaLabel:Object(l.sprintf)(
|
23 |
/* translators: %s is referring to the filter option being removed. */
|
24 |
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),n.name),text:n.label,radius:"large"})},I=n(551),L=e=>{let{onClick:t,onRemoveItem:n,option:c}=e;const r=Object(o.useRef)(null);return Object(o.useEffect)(()=>{r.current.focus()},[r]),Object(o.createElement)("div",{className:"wc-block-dropdown-selector__selected-value wc-block-components-dropdown-selector__selected-value"},Object(o.createElement)("button",{ref:r,className:"wc-block-dropdown-selector__selected-value__label wc-block-components-dropdown-selector__selected-value__label",onClick:e=>{e.stopPropagation(),t(c.value)},"aria-label":Object(l.sprintf)(
|
25 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
26 |
Object(l.__)("Replace current %s filter","woo-gutenberg-products-block"),c.name)},c.label),Object(o.createElement)("button",{className:"wc-block-dropdown-selector__selected-value__remove wc-block-components-dropdown-selector__selected-value__remove",onClick:()=>{n(c.value)},onKeyDown:e=>{"Backspace"!==e.key&&"Delete"!==e.key||n(c.value)},"aria-label":Object(l.sprintf)(
|
27 |
/* translators: %s attribute value used in the filter. For example: yellow, green, small, large. */
|
28 |
+
Object(l.__)("Remove %s filter","woo-gutenberg-products-block"),c.name)},Object(o.createElement)(u.a,{icon:I.a,size:16})))};n(424);var B=e=>{let{attributeLabel:t="",className:n,style:c={},checked:r=[],inputLabel:a="",isDisabled:s=!1,isLoading:i=!1,multiple:u=!1,onChange:b=(()=>{}),options:d=[],isCaseSensitive:m=!1}=e;const g=Object(o.useRef)(null),O=p()(n,"wc-block-dropdown-selector","wc-block-components-dropdown-selector",{"is-disabled":s,"is-loading":i}),j=Object(o.useCallback)((e,t)=>{switch(t.type){case x.a.stateChangeTypes.keyDownEnter:case x.a.stateChangeTypes.clickItem:return{...t,highlightedIndex:e.highlightedIndex,isOpen:u,inputValue:""};case x.a.stateChangeTypes.blurInput:case x.a.stateChangeTypes.mouseUp:return{...t,inputValue:e.inputValue};default:return t}},[u]);return Object(o.createElement)(x.a,{onChange:b,selectedItem:null,stateReducer:j},e=>{let{getInputProps:n,getItemProps:i,getLabelProps:j,getMenuProps:f,highlightedIndex:h,inputValue:w,isOpen:_,openMenu:y}=e;return Object(o.createElement)("div",{className:p()(O,{"is-multiple":u,"is-single":!u,"has-checked":r.length>0,"is-open":_}),style:c},Object(o.createElement)("label",j({className:"screen-reader-text"}),a),Object(o.createElement)(T,{isOpen:_,onClick:()=>g.current.focus()},r.map(e=>{const t=d.find(t=>t.value===e);if(!t)return null;const n=e=>{b(e),g.current.focus()};return u?Object(o.createElement)(R,{key:e,onRemoveItem:n,option:t}):Object(o.createElement)(L,{key:e,onClick:()=>g.current.focus(),onRemoveItem:n,option:t})}),Object(o.createElement)(N,{checked:r,getInputProps:n,inputRef:g,isDisabled:s,onFocus:y,onRemoveItem:e=>{b(e),g.current.focus()},placeholder:r.length>0&&u?null:Object(l.sprintf)(
|
29 |
/* translators: %s attribute name. */
|
30 |
+
Object(l.__)("Any %s","woo-gutenberg-products-block"),t),tabIndex:!u&&r.length>0?"-1":"0",value:w})),_&&!s&&Object(o.createElement)(P,{checked:r,getItemProps:i,getMenuProps:f,highlightedIndex:h,options:d.filter(e=>{let t=e.name,n=null==w?void 0:w.trim();var c;return m||(t=t.toLowerCase(),n=null===(c=n)||void 0===c?void 0:c.toLowerCase()),!n||t.includes(n)})}))})},F=n(108),M=n(144),G=n(25),V=n.n(G),q=n(14),H=n(277),D=n(16),z=n(162),Q=n(110),$=n(35),U=n(423),W=n(244),Y=n(201),K=n(170);const J=[{value:"preview-1",name:"Blue",label:Object(o.createElement)(F.a,{name:"Blue",count:3})},{value:"preview-2",name:"Green",label:Object(o.createElement)(F.a,{name:"Green",count:3})},{value:"preview-3",name:"Red",label:Object(o.createElement)(F.a,{name:"Red",count:2})}],X={id:0,name:"preview",taxonomy:"preview",label:"Preview"};var Z=n(44);n(422);const ee=e=>e.replace("pa_",""),te=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];const n={};t.forEach(e=>{const{attribute:t,slug:c,operator:r}=e,o=ee(t),l=c.join(","),a=`${W.b}${o}`,s="in"===r?"or":"and";n[`${W.a}${o}`]=l,n[a]=s});const c=Object(D.removeQueryArgs)(e,...Object.keys(n));return Object(D.addQueryArgs)(c,n)},ne=(e,t)=>{const n=Object.entries(t).reduce((e,t)=>{let[n,c]=t;return n.includes("query_type")?e:{...e,[n]:c}},{});return Object.entries(n).reduce((t,n)=>{let[c,r]=n;return e[c]===r&&t},!0)};var ce=e=>{let{attributes:t,isEditor:n=!1}=e;const c=Object(j.getSettingWithCoercion)("has_filterable_products",!1,z.a),r=Object(j.getSettingWithCoercion)("is_rendering_php_template",!1,z.a),a=Object(j.getSettingWithCoercion)("page_url",window.location.href,Q.a),[s,i]=Object(o.useState)(!1),u=t.isPreview&&!t.attributeId?X:Object(Y.a)(t.attributeId),b=Object(o.useMemo)(()=>(e=>{if(e){const t=Object(W.d)("filter_"+e.name);return"string"==typeof t?t.split(","):[]}return[]})(u),[u]),[d,m]=Object(o.useState)(b),[g,O]=Object(o.useState)(t.isPreview&&!t.attributeId?J:[]),f=Object(Z.a)(t),[h]=Object(k.a)(),[w,x]=Object(k.b)("attributes",[]),{results:N,isLoading:T}=Object(E.a)({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[(null==u?void 0:u.id)||0],shouldSelect:t.attributeId>0}),P="dropdown"!==t.displayStyle&&"and"===t.queryType,{results:A,isLoading:R}=Object(S.a)({queryAttribute:{taxonomy:(null==u?void 0:u.taxonomy)||"",queryType:t.queryType},queryState:{...h,attributes:P?h.attributes:null}}),I=Object(o.useCallback)(e=>Object($.b)(A,"attribute_counts")&&Array.isArray(A.attribute_counts)?A.attribute_counts.find(t=>{let{term:n}=t;return n===e}):null,[A]);Object(o.useEffect)(()=>{if(T||R)return;if(!Array.isArray(N))return;const e=N.map(e=>{const n=I(e.id);if(!(n||d.includes(e.slug)||(c=e.slug,null!=h&&h.attributes&&h.attributes.some(e=>{let{attribute:t,slug:n=[]}=e;return t===(null==u?void 0:u.taxonomy)&&n.includes(c)}))))return null;var c;const r=n?n.count:0;return{value:e.slug,name:Object(q.decodeEntities)(e.name),label:Object(o.createElement)(F.a,{name:Object(q.decodeEntities)(e.name),count:t.showCounts?r:null})}}).filter(e=>!!e);O(e)},[null==u?void 0:u.taxonomy,N,T,t.showCounts,R,I,d,h.attributes]);const L=Object(o.useCallback)(e=>Array.isArray(N)?N.reduce((t,n)=>(e.includes(n.slug)&&t.push(n),t),[]):[],[N]),G=Object(o.useCallback)((function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t){if(null==u||!u.taxonomy)return;const t=Object.keys(Object(D.getQueryArgs)(window.location.href)),n=ee(u.taxonomy),c=t.reduce((e,t)=>t.includes(W.b+n)||t.includes(W.a+n)?Object(D.removeQueryArgs)(e,t):e,window.location.href),r=te(c,e);Object(W.c)(r)}else{const t=te(a,e),n=Object(D.getQueryArgs)(window.location.href),c=Object(D.getQueryArgs)(t);ne(n,c)||Object(W.c)(t)}}),[a,null==u?void 0:u.taxonomy]),ce=Object(o.useCallback)((function(e){let c=arguments.length>1&&void 0!==arguments[1]&&arguments[1];n||(m(e),!c&&t.showFilterButton||Object(K.b)(w,x,u,L(e),"or"===t.queryType?"in":"and"))}),[n,m,w,x,u,L,t.queryType,t.showFilterButton]),re=Object(o.useMemo)(()=>Object(U.a)(w)?w.filter(e=>{let{attribute:t}=e;return t===(null==u?void 0:u.taxonomy)}).flatMap(e=>{let{slug:t}=e;return t}):[],[w,null==u?void 0:u.taxonomy]),oe=Object(y.a)(re),le=Object(v.a)(oe);Object(o.useEffect)(()=>{!le||V()(le,oe)||V()(d,oe)||ce(oe)},[d,oe,le,ce]);const ae="single"!==t.selectType,se=Object(o.useCallback)(e=>{const t=e=>{const t=g.find(t=>t.value===e);if(t)return t.name},n=e=>{let{filterAdded:n,filterRemoved:c}=e;const r=n?t(n):null,o=c?t(c):null;r&&o?Object(_.speak)(Object(l.sprintf)(
|
31 |
/* translators: %1$s and %2$s are attribute terms (for example: 'red', 'blue', 'large'...). */
|
32 |
Object(l.__)("%1$s filter replaced with %2$s.","woo-gutenberg-products-block"),r,o)):r?Object(_.speak)(Object(l.sprintf)(
|
33 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
34 |
Object(l.__)("%s filter added.","woo-gutenberg-products-block"),r)):o&&Object(_.speak)(Object(l.sprintf)(
|
35 |
/* translators: %s attribute term (for example: 'red', 'blue', 'large'...) */
|
36 |
+
Object(l.__)("%s filter removed.","woo-gutenberg-products-block"),o))},c=d.includes(e);let r;ae?(r=d.filter(t=>t!==e),c?n({filterRemoved:e}):(r.push(e),r.sort(),n({filterAdded:e}))):(r=c?[]:[e],n({filterAdded:c?null:e,filterRemoved:1===d.length?d[0]:null})),ce(r)},[d,g,ae,ce]);if(Object(o.useEffect)(()=>{u&&!t.showFilterButton&&((e=>{let{currentCheckedFilters:t,hasSetFilterDefaultsFromUrl:n}=e;return n&&0===t.length})({currentCheckedFilters:d,hasSetFilterDefaultsFromUrl:s})?G(w,!0):G(w,!1))},[s,G,w,u,d,t.showFilterButton]),Object(o.useEffect)(()=>{if(!s&&!T)return b.length>0?(i(!0),void ce(b,!0)):void(r||i(!0))},[u,s,T,ce,b,r]),!c)return null;if(!u)return n?Object(o.createElement)(H.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===g.length&&!T)return n?Object(o.createElement)(H.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 ie="h"+t.headingLevel,ue=!t.isPreview&&T,be=!t.isPreview&&R;return Object(o.createElement)(o.Fragment,null,!n&&t.heading&&g.length>0&&Object(o.createElement)(ie,{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)(B,{attributeLabel:u.label,checked:d,className:p()("wc-block-attribute-filter-dropdown",f.className),style:{...f.style,borderStyle:"none"},inputLabel:t.heading,isLoading:ue,multiple:ae,onChange:se,options:g}):Object(o.createElement)(C.a,{className:"wc-block-attribute-filter-list",options:g,checked:d,onChange:se,isLoading:ue,isDisabled:be}),t.showFilterButton&&Object(o.createElement)(M.a,{className:"wc-block-attribute-filter__button",disabled:ue||be,onClick:()=>(e=>{const n=Object(K.b)(w,x,u,L(e),"or"===t.queryType?"in":"and");G(n,0===e.length)})(d)})))};n(421);const re=Object(j.getSetting)("attributes",[]);var oe=Object(w.withSpokenMessages)(e=>{let{attributes:t,setAttributes:n,debouncedSpeak:c}=e;const{attributeId:r,className:a,displayStyle:i,heading:d,headingLevel:_,isPreview:y,queryType:v,showCounts:k,showFilterButton:E,selectType:S}=t,[C,x]=Object(o.useState)(!r&&!y),N=Object(s.useBlockProps)(),T=e=>{if(!e||!e.length)return;const t=e[0].id,c=re.find(e=>e.attribute_id===t.toString());if(!c||r===t)return;const o=c.attribute_label;n({attributeId:t,heading:Object(l.sprintf)(
|
37 |
/* translators: %s attribute name. */
|
38 |
Object(l.__)("Filter by %s","woo-gutenberg-products-block"),o)})},P=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)(
|
39 |
/* translators: %d is the number of attributes selected. */
|
40 |
+
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")},c=Object(O.sortBy)(re.map(e=>({id:parseInt(e.attribute_id,10),name:e.attribute_label})),"name");return Object(o.createElement)(g.a,{className:"woocommerce-product-attributes",list:c,selected:c.filter(e=>{let{id:t}=e;return t===r}),onChange:T,messages:n,isSingle:!0,isCompact:t})};return 0===Object.keys(re).length?Object(o.createElement)(w.Placeholder,{className:"wc-block-attribute-filter",icon:Object(o.createElement)(u.a,{icon:b.a}),label:Object(l.__)("Filter Products 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:m.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.__)("Content","woo-gutenberg-products-block")},Object(o.createElement)(w.ToggleControl,{label:Object(l.__)("Product count","woo-gutenberg-products-block"),help:k?Object(l.__)("Product count is visible.","woo-gutenberg-products-block"):Object(l.__)("Product count is hidden.","woo-gutenberg-products-block"),checked:k,onChange:()=>n({showCounts:!k})}),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.PanelBody,{title:Object(l.__)("Block Settings","woo-gutenberg-products-block")},Object(o.createElement)(w.__experimentalToggleGroupControl,{label:Object(l.__)("Allow selecting multiple options?","woo-gutenberg-products-block"),value:S||"multiple",onChange:e=>n({selectType:e})},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.__)("Query Type","woo-gutenberg-products-block"),help:"and"===v?Object(l.__)("Products that have all of the selected attributes will be shown.","woo-gutenberg-products-block"):Object(l.__)("Products that have any of the selected attributes will be shown.","woo-gutenberg-products-block"),value:v,onChange:e=>n({queryType:e})},Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"and",label:Object(l.__)("And","woo-gutenberg-products-block")}),Object(o.createElement)(w.__experimentalToggleGroupControlOption,{value:"or",label:Object(l.__)("Or","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})},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.__)("Filter button","woo-gutenberg-products-block"),help:E?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:E,onChange:e=>n({showFilterButton:e})})),Object(o.createElement)(w.PanelBody,{title:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),initialOpen:!1},P({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 Products 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"},P({isCompact:!1}),Object(o.createElement)(w.Button,{isPrimary:!0,onClick:()=>{x(!1),c(Object(l.__)("Showing Filter Products by Attribute block preview.","woo-gutenberg-products-block"))}},Object(l.__)("Done","woo-gutenberg-products-block")))):Object(o.createElement)("div",{className:p()(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)(ce,{attributes:t,isEditor:!0}))))});const le={heading:{type:"string",default:Object(l.__)("Filter by attribute","woo-gutenberg-products-block")}};var ae=n(231);Object(a.registerBlockType)(ae,{title:Object(l.__)("Filter Products by Attribute","woo-gutenberg-products-block"),description:Object(l.__)("Allow customers to filter the grid by product attribute, such as color. Works in combination with the All Products block.","woo-gutenberg-products-block"),icon:{src:Object(o.createElement)(u.a,{icon:b.a,className:"wc-block-editor-components-block-icon"})},supports:{...ae.supports,...Object(i.b)()&&{__experimentalBorder:{radius:!0,color:!0,width:!1}}},attributes:{...ae.attributes,...le},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,c,r;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===(c=o.raw)||void 0===c?void 0:c.display_type)||"list",showFilterButton:!1,selectType:(null==o||null===(r=o.raw)||void 0===r?void 0:r.select_type)||"multiple",isPreview:!1})}}]},edit:oe,save(e){let{attributes:t}=e;const{className:n,showCounts:c,queryType:l,attributeId:a,heading:i,headingLevel:u,displayStyle:b,showFilterButton:d,selectType:m}=t,g={"data-attribute-id":a,"data-show-counts":c,"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"===m&&(g["data-select-type"]=m),Object(o.createElement)("div",r()({},s.useBlockProps.save({className:p()("is-loading",n)}),g),Object(o.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-attribute-filter__placeholder"}))}})},5:function(e,t){e.exports=window.wp.blockEditor},50:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var c=n(0),r=n(25),o=n.n(r);function l(e){const t=Object(c.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},51:function(e,t){e.exports=window.wp.deprecated},52:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var c=n(0);const r=Object(c.createContext)("page"),o=()=>Object(c.useContext)(r);r.Provider},65:function(e,t,n){"use strict";n.d(t,"c",(function(){return o})),n.d(t,"d",(function(){return l})),n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return s}));var c=n(13),r=n(22);const o=(e,t)=>{if(r.n>2)return Object(c.registerBlockType)(e,t)},l=(e,t)=>{if(r.n>1)return Object(c.registerBlockType)(e,t)},a=()=>r.n>2,s=()=>r.n>1},7:function(e,t){e.exports=window.lodash},71:function(e,t){e.exports=window.wp.dom},76: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 p}));var c=n(18),r=n(9),o=n(0),l=n(25),a=n.n(l),s=n(50),i=n(111),u=n(52);const b=e=>{const t=Object(u.a)();e=e||t;const n=Object(r.useSelect)(t=>t(c.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0),[e]),{setValueForQueryContext:l}=Object(r.useDispatch)(c.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(r.useSelect)(r=>r(c.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t),[n,e]),{setQueryValue:s}=Object(r.useDispatch)(c.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)(t=>{s(n,e,t)},[n,e,s])]},p=(e,t)=>{const n=Object(u.a)();t=t||n;const[c,r]=b(t),l=Object(s.a)(c),d=Object(s.a)(e),p=Object(i.a)(d),m=Object(o.useRef)(!1);return Object(o.useEffect)(()=>{a()(p,d)||(r(Object.assign({},l,d)),m.current=!0)},[l,d,p,r]),m.current?[c,r]:[e,r]}},8:function(e,t){e.exports=window.React},9:function(e,t){e.exports=window.wp.data},95:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var c=n(5);const r=()=>"function"==typeof c.__experimentalGetSpacingClassesAndStyles}});
|
build/attribute-filter/block.json
CHANGED
@@ -46,6 +46,10 @@
|
|
46 |
"type": "boolean",
|
47 |
"default": false
|
48 |
},
|
|
|
|
|
|
|
|
|
49 |
"isPreview": {
|
50 |
"type": "boolean",
|
51 |
"default": false
|
46 |
"type": "boolean",
|
47 |
"default": false
|
48 |
},
|
49 |
+
"selectType": {
|
50 |
+
"type": "string",
|
51 |
+
"default": "multiple"
|
52 |
+
},
|
53 |
"isPreview": {
|
54 |
"type": "boolean",
|
55 |
"default": false
|
build/cart-blocks/cart-express-payment-frontend.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[13],{
|
2 |
/* translators: %s coupon code. */
|
3 |
Object(s.__)('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}}),h("")})},removeCoupon:t=>{b(t).then(n=>{!0===n&&p("info",Object(s.sprintf)(
|
4 |
/* translators: %s coupon code. */
|
5 |
-
Object(s.__)('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}),h("")})},isApplyingCoupon:i,isRemovingCoupon:d}},[l,p]);return{appliedCoupons:t,isLoading:n,...d}}},271:function(e,t){},273:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var s=n(0),c=n(198);n(261);const o=e=>{let{errorMessage:t="",propertyName:n="",elementId:o=""}=e;const{getValidationError:r,getValidationErrorId:a}=Object(c.b)();if(!t||"string"!=typeof t){const e=r(n)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(s.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(s.createElement)("p",{id:a(o)},t))}},274:function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return a}));var s=n(32),c=n(205);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{paymentMethods:t,expressPaymentMethods:n,paymentMethodsInitialized:o,expressPaymentMethodsInitialized:r}=Object(c.b)(),a=Object(s.a)(t),i=Object(s.a)(n);return{paymentMethods:e?i:a,isInitialized:e?r:o}},r=()=>o(!1),a=()=>o(!0)},277:function(e,t,n){"use strict";var s=n(12),c=n.n(s),o=n(0),r=n(5),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:s=""}=e;return n?Object(o.createElement)("img",{className:i(t),src:n,alt:s}):null},p=n(46);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(52);n(271),t.a=e=>{let{icons:t=[],align:n="center",className:s}=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},s);return Object(o.createElement)("div",{className:i},r.map(e=>{const t={...e,...(n=e.id,u.find(e=>e.id===n)||{})};var n;return Object(o.createElement)(l,c()({key:"payment-method-icon-"+e.id},t))}))}},287:function(e,t){},288:function(e,t,n){"use strict";var s=n(19),c=n.n(s),o=n(0),r=n(1),a=n(3),i=n(2),l=n(124),p=n(31);class u extends a.Component{constructor(){super(...arguments),c()(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 s=[{id:"0",content:e,isDismissible:!1,status:"error"}];return Object(o.createElement)(l.a,{additionalNotices:s,context:p.c.PAYMENTS})}return this.props.children}}u.defaultProps={isEditor:!1},t.a=u},307:function(e,t){},308:function(e,t,n){"use strict";var s=n(0),c=n(1),o=n(340),r=n(274),a=n(29),i=n(205),l=n(23),p=n.n(l),u=n(288);t.a=()=>{const{isEditor:e}=Object(a.a)(),{setActivePaymentMethod:t,setExpressPaymentError:n,activePaymentMethod:l,paymentMethodData:d,setPaymentStatus:m}=Object(i.b)(),b=Object(o.a)(),{paymentMethods:h}=Object(r.a)(),g=Object(s.useRef)(l),v=Object(s.useRef)(d),y=Object(s.useCallback)(e=>()=>{g.current=l,v.current=d,m().started(),t(e)},[l,d,t,m]),j=Object(s.useCallback)(()=>{m().pristine(),t(g.current,v.current)},[t,m]),O=Object(s.useCallback)(e=>{m().error(e),n(e),t(g.current,v.current)},[t,m,n]),E=Object(s.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,c]=t;const o=e?c.edit:c.content;return Object(s.isValidElement)(o)?Object(s.createElement)("li",{key:n,id:"express-payment-method-"+n},Object(s.cloneElement)(o,{...b,onClick:y(n),onClose:j,onError:O,setExpressPaymentError:E})):null}):Object(s.createElement)("li",{key:"noneRegistered"},Object(c.__)("No registered Payment Methods","woo-gutenberg-products-block"));return Object(s.createElement)(u.a,{isEditor:e},Object(s.createElement)("ul",{className:"wc-block-components-express-payment__event-buttons"},w))}},335:function(e,t,n){"use strict";var s=n(0),c=n(14);const o=Object(s.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(s.createElement)(c.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=o},340:function(e,t,n){"use strict";n.d(t,"a",(function(){return z}));var s=n(1),c=n(41),o=n(0),r=n(5),a=n.n(r),i=n(14),l=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("g",{fill:"none",fillRule:"evenodd"},Object(o.createElement)("path",{d:"M0 0h24v24H0z"}),Object(o.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(o.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(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.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(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.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(335),m=n(104),b=n(52),h=n(20);n(287);const g={bank:p,bill:u,card:d.a,checkPayment:l};var v=e=>{let{icon:t="",text:n=""}=e;const s=!!t,c=Object(o.useCallback)(e=>s&&Object(b.a)(e)&&Object(h.b)(g,e),[s]),r=a()("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":s});return Object(o.createElement)("span",{className:r},c(t)?Object(o.createElement)(m.a,{icon:g[t]}):t,n)},y=n(277),j=n(2),O=n(23),E=n.n(O),f=n(138),w=n(273),k=n(33),S=n(270),P=n(31),x=n(35),_=n(205),C=n(67),R=n(49);const M=(e,t)=>{const n=[],c=(t,n)=>{const s=n+"_tax",c=Object(h.b)(e,n)&&Object(b.a)(e[n])?parseInt(e[n],10):0;return{key:n,label:t,value:c,valueWithTax:c+(Object(h.b)(e,s)&&Object(b.a)(e[s])?parseInt(e[s],10):0)}};return n.push(c(Object(s.__)("Subtotal:","woo-gutenberg-products-block"),"total_items")),n.push(c(Object(s.__)("Fees:","woo-gutenberg-products-block"),"total_fees")),n.push(c(Object(s.__)("Discount:","woo-gutenberg-products-block"),"total_discount")),n.push({key:"total_tax",label:Object(s.__)("Taxes:","woo-gutenberg-products-block"),value:parseInt(e.total_tax,10),valueWithTax:parseInt(e.total_tax,10)}),t&&n.push(c(Object(s.__)("Shipping:","woo-gutenberg-products-block"),"total_shipping")),n};var I=n(64);const z=()=>{const{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r,onCheckoutBeforeProcessing:a,onCheckoutValidationBeforeProcessing:i,onCheckoutAfterProcessingWithSuccess:l,onCheckoutAfterProcessingWithError:p,onSubmit:u,customerId:d}=Object(x.b)(),{currentStatus:m,activePaymentMethod:b,onPaymentProcessing:h,setExpressPaymentError:g,shouldSavePayment:O}=Object(_.b)(),{shippingErrorStatus:z,shippingErrorTypes:T,onShippingRateSuccess:A,onShippingRateFail:N,onShippingRateSelectSuccess:V,onShippingRateSelectFail:D}=Object(C.b)(),{shippingRates:B,isLoadingRates:L,selectedRates:F,isSelectingRate:H,selectShippingRate:W,needsShipping:G}=Object(I.a)(),{billingAddress:Y,shippingAddress:J,setShippingAddress:U}=Object(R.b)(),{cartItems:K,cartFees:X,cartTotals:q,extensions:Q}=Object(k.a)(),{appliedCoupons:Z}=Object(S.a)(),{noticeContexts:$,responseTypes:ee}=Object(P.d)(),te=Object(o.useRef)(M(q,G)),ne=Object(o.useRef)({label:Object(s.__)("Total","woo-gutenberg-products-block"),value:parseInt(q.total_price,10)});Object(o.useEffect)(()=>{te.current=M(q,G),ne.current={label:Object(s.__)("Total","woo-gutenberg-products-block"),value:parseInt(q.total_price,10)}},[q,G]);const se=Object(o.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(c.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:A},onSubmit:u,paymentStatus:m,setExpressPaymentError:se,shippingData:{isSelectingRate:H,needsShipping:G,selectedRates:F,setSelectedRates:W,setShippingAddress:U,shippingAddress:J,shippingRates:B,shippingRatesLoading:L},shippingStatus:{shippingErrorStatus:z,shippingErrorTypes:T},shouldSavePayment:O}}},440:function(e,t,n){"use strict";n.r(t);var s=n(0),c=n(33),o=n(5),r=n.n(o),a=n(1),i=n(274),l=n(31),p=n(35),u=n(205),d=n(124),m=n(138),b=n(308);n(307);var h=()=>{const{paymentMethods:e,isInitialized:t}=Object(i.a)(),{noticeContexts:n}=Object(l.d)(),{isCalculating:c,isProcessing:o,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=o||r||h||g&&!v;return Object(s.createElement)(s.Fragment,null,Object(s.createElement)(m.a,{isLoading:c||j||y.isDoingExpressPayment},Object(s.createElement)("div",{className:"wc-block-components-express-payment wc-block-components-express-payment--cart"},Object(s.createElement)("div",{className:"wc-block-components-express-payment__content"},Object(s.createElement)(d.a,{context:n.EXPRESS_PAYMENTS}),Object(s.createElement)(b.a,null)))),Object(s.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(c.a)();return n?Object(s.createElement)("div",{className:r()("wc-block-cart__payment-options",t)},Object(s.createElement)(h,null)):null}}}]);
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[13],{105:function(e,t,n){"use strict";var s=n(0);t.a=function(e){let{icon:t,size:n=24,...c}=e;return Object(s.cloneElement)(t,{width:n,height:n,...c})}},261:function(e,t){},270:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var s=n(1),c=n(8),o=n(6),r=n(18),a=n(33),i=n(198);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(c.useDispatch)("core/notices"),{createNotice:p}=Object(c.useDispatch)("core/notices"),{setValidationErrors:u}=Object(i.b)(),d=Object(c.useSelect)((t,n)=>{let{dispatch:c}=n;const a=t(o.CART_STORE_KEY),i=a.isApplyingCoupon(),d=a.isRemovingCoupon(),{applyCoupon:m,removeCoupon:b,receiveApplyingCoupon:h}=c(o.CART_STORE_KEY);return{applyCoupon:t=>{m(t).then(n=>{!0===n&&p("info",Object(s.sprintf)(
|
2 |
/* translators: %s coupon code. */
|
3 |
Object(s.__)('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}}),h("")})},removeCoupon:t=>{b(t).then(n=>{!0===n&&p("info",Object(s.sprintf)(
|
4 |
/* translators: %s coupon code. */
|
5 |
+
Object(s.__)('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}),h("")})},isApplyingCoupon:i,isRemovingCoupon:d}},[l,p]);return{appliedCoupons:t,isLoading:n,...d}}},271:function(e,t){},273:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var s=n(0),c=n(198);n(261);const o=e=>{let{errorMessage:t="",propertyName:n="",elementId:o=""}=e;const{getValidationError:r,getValidationErrorId:a}=Object(c.b)();if(!t||"string"!=typeof t){const e=r(n)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(s.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(s.createElement)("p",{id:a(o)},t))}},274:function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return a}));var s=n(32),c=n(205);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const{paymentMethods:t,expressPaymentMethods:n,paymentMethodsInitialized:o,expressPaymentMethodsInitialized:r}=Object(c.b)(),a=Object(s.a)(t),i=Object(s.a)(n);return{paymentMethods:e?i:a,isInitialized:e?r:o}},r=()=>o(!1),a=()=>o(!0)},277:function(e,t,n){"use strict";var s=n(12),c=n.n(s),o=n(0),r=n(5),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:s=""}=e;return n?Object(o.createElement)("img",{className:i(t),src:n,alt:s}):null},p=n(46);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(52);n(271),t.a=e=>{let{icons:t=[],align:n="center",className:s}=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},s);return Object(o.createElement)("div",{className:i},r.map(e=>{const t={...e,...(n=e.id,u.find(e=>e.id===n)||{})};var n;return Object(o.createElement)(l,c()({key:"payment-method-icon-"+e.id},t))}))}},287:function(e,t){},288:function(e,t,n){"use strict";var s=n(19),c=n.n(s),o=n(0),r=n(1),a=n(3),i=n(2),l=n(123),p=n(31);class u extends a.Component{constructor(){super(...arguments),c()(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 s=[{id:"0",content:e,isDismissible:!1,status:"error"}];return Object(o.createElement)(l.a,{additionalNotices:s,context:p.c.PAYMENTS})}return this.props.children}}u.defaultProps={isEditor:!1},t.a=u},307:function(e,t){},308:function(e,t,n){"use strict";var s=n(0),c=n(1),o=n(340),r=n(274),a=n(29),i=n(205),l=n(24),p=n.n(l),u=n(288);t.a=()=>{const{isEditor:e}=Object(a.a)(),{setActivePaymentMethod:t,setExpressPaymentError:n,activePaymentMethod:l,paymentMethodData:d,setPaymentStatus:m}=Object(i.b)(),b=Object(o.a)(),{paymentMethods:h}=Object(r.a)(),g=Object(s.useRef)(l),v=Object(s.useRef)(d),y=Object(s.useCallback)(e=>()=>{g.current=l,v.current=d,m().started(),t(e)},[l,d,t,m]),j=Object(s.useCallback)(()=>{m().pristine(),t(g.current,v.current)},[t,m]),O=Object(s.useCallback)(e=>{m().error(e),n(e),t(g.current,v.current)},[t,m,n]),E=Object(s.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,c]=t;const o=e?c.edit:c.content;return Object(s.isValidElement)(o)?Object(s.createElement)("li",{key:n,id:"express-payment-method-"+n},Object(s.cloneElement)(o,{...b,onClick:y(n),onClose:j,onError:O,setExpressPaymentError:E})):null}):Object(s.createElement)("li",{key:"noneRegistered"},Object(c.__)("No registered Payment Methods","woo-gutenberg-products-block"));return Object(s.createElement)(u.a,{isEditor:e},Object(s.createElement)("ul",{className:"wc-block-components-express-payment__event-buttons"},w))}},335:function(e,t,n){"use strict";var s=n(0),c=n(14);const o=Object(s.createElement)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(s.createElement)(c.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=o},340:function(e,t,n){"use strict";n.d(t,"a",(function(){return z}));var s=n(1),c=n(41),o=n(0),r=n(5),a=n.n(r),i=n(14),l=Object(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.createElement)("g",{fill:"none",fillRule:"evenodd"},Object(o.createElement)("path",{d:"M0 0h24v24H0z"}),Object(o.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(o.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(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.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(o.createElement)(i.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(o.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(335),m=n(105),b=n(52),h=n(20);n(287);const g={bank:p,bill:u,card:d.a,checkPayment:l};var v=e=>{let{icon:t="",text:n=""}=e;const s=!!t,c=Object(o.useCallback)(e=>s&&Object(b.a)(e)&&Object(h.b)(g,e),[s]),r=a()("wc-block-components-payment-method-label",{"wc-block-components-payment-method-label--with-icon":s});return Object(o.createElement)("span",{className:r},c(t)?Object(o.createElement)(m.a,{icon:g[t]}):t,n)},y=n(277),j=n(2),O=n(24),E=n.n(O),f=n(138),w=n(273),k=n(33),S=n(270),P=n(31),x=n(35),_=n(205),C=n(67),R=n(49);const M=(e,t)=>{const n=[],c=(t,n)=>{const s=n+"_tax",c=Object(h.b)(e,n)&&Object(b.a)(e[n])?parseInt(e[n],10):0;return{key:n,label:t,value:c,valueWithTax:c+(Object(h.b)(e,s)&&Object(b.a)(e[s])?parseInt(e[s],10):0)}};return n.push(c(Object(s.__)("Subtotal:","woo-gutenberg-products-block"),"total_items")),n.push(c(Object(s.__)("Fees:","woo-gutenberg-products-block"),"total_fees")),n.push(c(Object(s.__)("Discount:","woo-gutenberg-products-block"),"total_discount")),n.push({key:"total_tax",label:Object(s.__)("Taxes:","woo-gutenberg-products-block"),value:parseInt(e.total_tax,10),valueWithTax:parseInt(e.total_tax,10)}),t&&n.push(c(Object(s.__)("Shipping:","woo-gutenberg-products-block"),"total_shipping")),n};var I=n(64);const z=()=>{const{isCalculating:e,isComplete:t,isIdle:n,isProcessing:r,onCheckoutBeforeProcessing:a,onCheckoutValidationBeforeProcessing:i,onCheckoutAfterProcessingWithSuccess:l,onCheckoutAfterProcessingWithError:p,onSubmit:u,customerId:d}=Object(x.b)(),{currentStatus:m,activePaymentMethod:b,onPaymentProcessing:h,setExpressPaymentError:g,shouldSavePayment:O}=Object(_.b)(),{shippingErrorStatus:z,shippingErrorTypes:T,onShippingRateSuccess:A,onShippingRateFail:N,onShippingRateSelectSuccess:V,onShippingRateSelectFail:D}=Object(C.b)(),{shippingRates:B,isLoadingRates:L,selectedRates:F,isSelectingRate:H,selectShippingRate:W,needsShipping:G}=Object(I.a)(),{billingAddress:Y,shippingAddress:J,setShippingAddress:U}=Object(R.b)(),{cartItems:K,cartFees:X,cartTotals:q,extensions:Q}=Object(k.a)(),{appliedCoupons:Z}=Object(S.a)(),{noticeContexts:$,responseTypes:ee}=Object(P.d)(),te=Object(o.useRef)(M(q,G)),ne=Object(o.useRef)({label:Object(s.__)("Total","woo-gutenberg-products-block"),value:parseInt(q.total_price,10)});Object(o.useEffect)(()=>{te.current=M(q,G),ne.current={label:Object(s.__)("Total","woo-gutenberg-products-block"),value:parseInt(q.total_price,10)}},[q,G]);const se=Object(o.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(c.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:A},onSubmit:u,paymentStatus:m,setExpressPaymentError:se,shippingData:{isSelectingRate:H,needsShipping:G,selectedRates:F,setSelectedRates:W,setShippingAddress:U,shippingAddress:J,shippingRates:B,shippingRatesLoading:L},shippingStatus:{shippingErrorStatus:z,shippingErrorTypes:T},shouldSavePayment:O}}},440:function(e,t,n){"use strict";n.r(t);var s=n(0),c=n(33),o=n(5),r=n.n(o),a=n(1),i=n(274),l=n(31),p=n(35),u=n(205),d=n(123),m=n(138),b=n(308);n(307);var h=()=>{const{paymentMethods:e,isInitialized:t}=Object(i.a)(),{noticeContexts:n}=Object(l.d)(),{isCalculating:c,isProcessing:o,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=o||r||h||g&&!v;return Object(s.createElement)(s.Fragment,null,Object(s.createElement)(m.a,{isLoading:c||j||y.isDoingExpressPayment},Object(s.createElement)("div",{className:"wc-block-components-express-payment wc-block-components-express-payment--cart"},Object(s.createElement)("div",{className:"wc-block-components-express-payment__content"},Object(s.createElement)(d.a,{context:n.EXPRESS_PAYMENTS}),Object(s.createElement)(b.a,null)))),Object(s.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(c.a)();return n?Object(s.createElement)("div",{className:r()("wc-block-cart__payment-options",t)},Object(s.createElement)(h,null)):null}}}]);
|
build/cart-blocks/cart-line-items--mini-cart-contents-block/products-table-frontend.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[4],{
|
2 |
/* translators: %1$s min price, %2$s max price */
|
3 |
-
Object(r.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(i.formatPrice)(l),Object(i.formatPrice)(c))),Object(a.createElement)("span",{"aria-hidden":!0},Object(a.createElement)(n.a,{className:o()("wc-block-components-product-price__value",s),currency:t,value:l,style:u})," — ",Object(a.createElement)(n.a,{className:o()("wc-block-components-product-price__value",s),currency:t,value:c,style:u})))},u=e=>{let{currency:t,regularPriceClassName:c,regularPriceStyle:l,regularPrice:i,priceClassName:s,priceStyle:u,price:m}=e;return Object(a.createElement)(a.Fragment,null,Object(a.createElement)("span",{className:"screen-reader-text"},Object(r.__)("Previous price:","woo-gutenberg-products-block")),Object(a.createElement)(n.a,{currency:t,renderText:e=>Object(a.createElement)("del",{className:o()("wc-block-components-product-price__regular",c),style:l},e),value:i}),Object(a.createElement)("span",{className:"screen-reader-text"},Object(r.__)("Discounted price:","woo-gutenberg-products-block")),Object(a.createElement)(n.a,{currency:t,renderText:e=>Object(a.createElement)("ins",{className:o()("wc-block-components-product-price__value","is-discounted",s),style:u},e),value:m}))};t.a=e=>{let{align:t,className:c,currency:r,format:l="<price/>",maxPrice:i,minPrice:m,price:b,priceClassName:p,priceStyle:d,regularPrice:O,regularPriceClassName:j,regularPriceStyle:_}=e;const y=o()(c,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+t]:t});l.includes("<price/>")||(l="<price/>",console.error("Price formats need to include the `<price/>` tag."));const g=O&&b!==O;let f=Object(a.createElement)("span",{className:o()("wc-block-components-product-price__value",p)});return g?f=Object(a.createElement)(u,{currency:r,price:b,priceClassName:p,priceStyle:d,regularPrice:O,regularPriceClassName:j,regularPriceStyle:_}):void 0!==m&&void 0!==i?f=Object(a.createElement)(s,{currency:r,maxPrice:i,minPrice:m,priceClassName:p,priceStyle:d}):b&&(f=Object(a.createElement)(n.a,{className:o()("wc-block-components-product-price__value",p),currency:r,value:b,style:d})),Object(a.createElement)("span",{className:y},Object(a.createInterpolateElement)(l,{price:f}))}},283:function(e,t){},284:function(e,t,c){"use strict";var a=c(12),r=c.n(a),n=c(0),l=c(18),o=c(5),i=c.n(o);c(285),t.a=e=>{let{className:t="",disabled:c=!1,name:a,permalink:o="",target:s,rel:u,style:m,onClick:b,...p}=e;const d=i()("wc-block-components-product-name",t);if(c){const e=p;return Object(n.createElement)("span",r()({className:d},e,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(a)}}))}return Object(n.createElement)("a",r()({className:d,href:o,target:s},p,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(a)},style:m}))}},285:function(e,t){},291:function(e,t,c){"use strict";var a=c(0),r=c(
|
4 |
/* translators: %d stock amount (number of items in stock for product) */
|
5 |
Object(r.__)("%d left in stock","woo-gutenberg-products-block"),t)):null}},341:function(e,t,c){"use strict";var a=c(0),r=c(5),n=c.n(r),l=c(1),o=c(21),i=c(142),s=c(50);c(371);var u=e=>{let{className:t,quantity:c=1,minimum:r=1,maximum:u,onChange:m=(()=>{}),step:b=1,itemName:p="",disabled:d}=e;const O=n()("wc-block-components-quantity-selector",t),j=void 0!==u,_=c-b>=r,y=!j||c+b<=u,g=Object(a.useCallback)(e=>{let t=e;j&&(t=Math.min(t,Math.floor(u/b)*b)),t=Math.max(t,Math.ceil(r/b)*b),t=Math.floor(t/b)*b,t!==e&&m(t)},[j,u,r,m,b]),f=Object(s.a)(g,300);Object(a.useLayoutEffect)(()=>{g(c)},[c,g]);const k=Object(a.useCallback)(e=>{const t=void 0!==typeof e.key?"ArrowDown"===e.key:e.keyCode===i.DOWN,a=void 0!==typeof e.key?"ArrowUp"===e.key:e.keyCode===i.UP;t&&_&&(e.preventDefault(),m(c-b)),a&&y&&(e.preventDefault(),m(c+b))},[c,m,y,_,b]);return Object(a.createElement)("div",{className:O},Object(a.createElement)("input",{className:"wc-block-components-quantity-selector__input",disabled:d,type:"number",step:b,min:r,max:u,value:c,onKeyDown:k,onChange:e=>{let t=parseInt(e.target.value,10);t=isNaN(t)?c:t,t!==c&&(m(t),f(t))},"aria-label":Object(l.sprintf)(
|
6 |
/* translators: %s refers to the item name in the cart. */
|
@@ -8,7 +8,7 @@ Object(l.__)("Quantity of %s in your cart.","woo-gutenberg-products-block"),p)})
|
|
8 |
/* translators: %s refers to the item name in the cart. */
|
9 |
Object(l.__)("Quantity reduced to %s.","woo-gutenberg-products-block"),e)),g(e)}},"-"),Object(a.createElement)("button",{"aria-label":Object(l.__)("Increase quantity","woo-gutenberg-products-block"),disabled:d||!y,className:"wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--plus",onClick:()=>{const e=c+b;m(e),Object(o.speak)(Object(l.sprintf)(
|
10 |
/* translators: %s refers to the item name in the cart. */
|
11 |
-
Object(l.__)("Quantity increased to %s.","woo-gutenberg-products-block"),e)),g(e)}},"+"))},m=c(282),b=c(284),p=c(8),d=c(6),O=c(
|
12 |
/* translators: %s will be replaced by the discount amount */
|
13 |
Object(l.__)("Save %s","woo-gutenberg-products-block"),r);return Object(a.createElement)(x.a,{className:"wc-block-components-sale-badge"},Object(a.createInterpolateElement)(n,{price:Object(a.createElement)(C.a,{currency:t,value:c})}))},I=c(344),S=c(41),q=c(10),D=c(331),A=c(2);const R=(e,t)=>e.convertPrecision(t.minorUnit).getAmount(),T=e=>Object(q.mustContain)(e,"<price/>");var F=Object(a.forwardRef)((e,t)=>{let{lineItem:c,onRemove:r=(()=>{}),tabIndex:i=null}=e;const{name:s="",catalog_visibility:C="visible",short_description:x="",description:F="",low_stock_remaining:M=null,show_backorder_badge:L=!1,quantity_limits:U={minimum:1,maximum:99,multiple_of:1,editable:!0},sold_individually:Q=!1,permalink:V="",images:$=[],variation:H=[],item_data:B=[],prices:K={currency_code:"USD",currency_minor_unit:2,currency_symbol:"$",currency_prefix:"$",currency_suffix:"",currency_decimal_separator:".",currency_thousand_separator:",",price:"0",regular_price:"0",sale_price:"0",price_range:null,raw_prices:{precision:6,price:"0",regular_price:"0",sale_price:"0"}},totals:W={currency_code:"USD",currency_minor_unit:2,currency_symbol:"$",currency_prefix:"$",currency_suffix:"",currency_decimal_separator:".",currency_thousand_separator:",",line_subtotal:"0",line_subtotal_tax:"0"},extensions:J}=c,{quantity:Y,setItemQuantity:z,removeItem:G,isPendingDelete:X}=(e=>{const t={key:"",quantity:1};(e=>Object(y.a)(e)&&Object(y.b)(e,"key")&&Object(y.b)(e,"quantity")&&Object(g.a)(e.key)&&Object(f.a)(e.quantity))(e)&&(t.key=e.key,t.quantity=e.quantity);const{key:c="",quantity:r=1}=t,{cartErrors:n}=Object(k.a)(),{dispatchActions:l}=Object(E.b)(),[o,i]=Object(a.useState)(r),[s]=Object(O.a)(o,400),u=Object(j.a)(s),{removeItemFromCart:m,changeCartItemQuantity:b}=Object(p.useDispatch)(d.CART_STORE_KEY);Object(a.useEffect)(()=>i(r),[r]);const w=Object(p.useSelect)(e=>{if(!c)return{quantity:!1,delete:!1};const t=e(d.CART_STORE_KEY);return{quantity:t.isItemPendingQuantity(c),delete:t.isItemPendingDelete(c)}},[c]),v=Object(a.useCallback)(()=>c?m(c).then(()=>(Object(_.d)(),!0)):Promise.resolve(!1),[c,m]);return Object(a.useEffect)(()=>{c&&Object(f.a)(u)&&Number.isFinite(u)&&u!==s&&b(c,s)},[c,b,s,u]),Object(a.useEffect)(()=>(w.delete?l.incrementCalculating():l.decrementCalculating(),()=>{w.delete&&l.decrementCalculating()}),[l,w.delete]),Object(a.useEffect)(()=>(w.quantity||s!==o?l.incrementCalculating():l.decrementCalculating(),()=>{(w.quantity||s!==o)&&l.decrementCalculating()}),[l,w.quantity,s,o]),{isPendingDelete:w.delete,quantity:o,setItemQuantity:i,removeItem:v,cartItemQuantityErrors:n}})(c),{dispatchStoreEvent:Z}=Object(w.a)(),{receiveCart:ee,...te}=Object(k.a)(),ce=Object(a.useMemo)(()=>({context:"cart",cartItem:c,cart:te}),[c,te]),ae=Object(S.getCurrencyFromPriceResponse)(K),re=Object(q.__experimentalApplyCheckoutFilter)({filterName:"itemName",defaultValue:s,extensions:J,arg:ce}),ne=Object(D.a)({amount:parseInt(K.raw_prices.regular_price,10),precision:K.raw_prices.precision}),le=Object(D.a)({amount:parseInt(K.raw_prices.price,10),precision:K.raw_prices.precision}),oe=ne.subtract(le),ie=oe.multiply(Y),se=Object(S.getCurrencyFromPriceResponse)(W);let ue=parseInt(W.line_subtotal,10);Object(A.getSetting)("displayCartPricesIncludingTax",!1)&&(ue+=parseInt(W.line_subtotal_tax,10));const me=Object(D.a)({amount:ue,precision:se.minorUnit}),be=$.length?$[0]:{},pe="hidden"===C||"search"===C,de=Object(q.__experimentalApplyCheckoutFilter)({filterName:"cartItemClass",defaultValue:"",extensions:J,arg:ce}),Oe=Object(q.__experimentalApplyCheckoutFilter)({filterName:"cartItemPrice",defaultValue:"<price/>",extensions:J,arg:ce,validation:T}),je=Object(q.__experimentalApplyCheckoutFilter)({filterName:"subtotalPriceFormat",defaultValue:"<price/>",extensions:J,arg:ce,validation:T}),_e=Object(q.__experimentalApplyCheckoutFilter)({filterName:"saleBadgePriceFormat",defaultValue:"<price/>",extensions:J,arg:ce,validation:T});return Object(a.createElement)("tr",{className:n()("wc-block-cart-items__row",de,{"is-disabled":X}),ref:t,tabIndex:i},Object(a.createElement)("td",{className:"wc-block-cart-item__image","aria-hidden":!Object(y.b)(be,"alt")||!be.alt},pe?Object(a.createElement)(v.a,{image:be,fallbackAlt:re}):Object(a.createElement)("a",{href:V,tabIndex:-1},Object(a.createElement)(v.a,{image:be,fallbackAlt:re}))),Object(a.createElement)("td",{className:"wc-block-cart-item__product"},Object(a.createElement)("div",{className:"wc-block-cart-item__wrap"},Object(a.createElement)(b.a,{disabled:X||pe,name:re,permalink:V}),L?Object(a.createElement)(N.a,null):!!M&&Object(a.createElement)(h.a,{lowStockRemaining:M}),Object(a.createElement)("div",{className:"wc-block-cart-item__prices"},Object(a.createElement)(m.a,{currency:ae,regularPrice:R(ne,ae),price:R(le,ae),format:je})),Object(a.createElement)(P,{currency:ae,saleAmount:R(oe,ae),format:_e}),Object(a.createElement)(I.a,{shortDescription:x,fullDescription:F,itemData:B,variation:H}),Object(a.createElement)("div",{className:"wc-block-cart-item__quantity"},!Q&&!!U.editable&&Object(a.createElement)(u,{disabled:X,quantity:Y,minimum:U.minimum,maximum:U.maximum,step:U.multiple_of,onChange:e=>{z(e),Z("cart-set-item-quantity",{product:c,quantity:e})},itemName:re}),Object(a.createElement)("button",{className:"wc-block-cart-item__remove-link",onClick:()=>{r(),G(),Z("cart-remove-item",{product:c,quantity:Y}),Object(o.speak)(Object(l.sprintf)(
|
14 |
/* translators: %s refers to the item name in the cart. */
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[4],{102:function(e,t,c){"use strict";var a=c(12),r=c.n(a),n=c(0),l=c(139),o=c(5),i=c.n(o);c(196);const s=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:a,onValueChange:o,displayType:u="text",...m}=e;const b="string"==typeof c?parseInt(c,10):c;if(!Number.isFinite(b))return null;const p=b/10**a.minorUnit;if(!Number.isFinite(p))return null;const d=i()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),O={...m,...s(a),value:void 0,currency:void 0,onValueChange:void 0},j=o?e=>{const t=+e.value*10**a.minorUnit;o(t)}:()=>{};return Object(n.createElement)(l.a,r()({className:d,displayType:u},O,{value:p,onValueChange:j}))}},196:function(e,t){},280:function(e,t,c){"use strict";var a=c(0),r=c(5),n=c.n(r);c(304),t.a=e=>{let{children:t,className:c}=e;return Object(a.createElement)("div",{className:n()("wc-block-components-product-badge",c)},t)}},282:function(e,t,c){"use strict";var a=c(0),r=c(1),n=c(102),l=c(5),o=c.n(l),i=c(41);c(283);const s=e=>{let{currency:t,maxPrice:c,minPrice:l,priceClassName:s,priceStyle:u={}}=e;return Object(a.createElement)(a.Fragment,null,Object(a.createElement)("span",{className:"screen-reader-text"},Object(r.sprintf)(
|
2 |
/* translators: %1$s min price, %2$s max price */
|
3 |
+
Object(r.__)("Price between %1$s and %2$s","woo-gutenberg-products-block"),Object(i.formatPrice)(l),Object(i.formatPrice)(c))),Object(a.createElement)("span",{"aria-hidden":!0},Object(a.createElement)(n.a,{className:o()("wc-block-components-product-price__value",s),currency:t,value:l,style:u})," — ",Object(a.createElement)(n.a,{className:o()("wc-block-components-product-price__value",s),currency:t,value:c,style:u})))},u=e=>{let{currency:t,regularPriceClassName:c,regularPriceStyle:l,regularPrice:i,priceClassName:s,priceStyle:u,price:m}=e;return Object(a.createElement)(a.Fragment,null,Object(a.createElement)("span",{className:"screen-reader-text"},Object(r.__)("Previous price:","woo-gutenberg-products-block")),Object(a.createElement)(n.a,{currency:t,renderText:e=>Object(a.createElement)("del",{className:o()("wc-block-components-product-price__regular",c),style:l},e),value:i}),Object(a.createElement)("span",{className:"screen-reader-text"},Object(r.__)("Discounted price:","woo-gutenberg-products-block")),Object(a.createElement)(n.a,{currency:t,renderText:e=>Object(a.createElement)("ins",{className:o()("wc-block-components-product-price__value","is-discounted",s),style:u},e),value:m}))};t.a=e=>{let{align:t,className:c,currency:r,format:l="<price/>",maxPrice:i,minPrice:m,price:b,priceClassName:p,priceStyle:d,regularPrice:O,regularPriceClassName:j,regularPriceStyle:_}=e;const y=o()(c,"price","wc-block-components-product-price",{["wc-block-components-product-price--align-"+t]:t});l.includes("<price/>")||(l="<price/>",console.error("Price formats need to include the `<price/>` tag."));const g=O&&b!==O;let f=Object(a.createElement)("span",{className:o()("wc-block-components-product-price__value",p)});return g?f=Object(a.createElement)(u,{currency:r,price:b,priceClassName:p,priceStyle:d,regularPrice:O,regularPriceClassName:j,regularPriceStyle:_}):void 0!==m&&void 0!==i?f=Object(a.createElement)(s,{currency:r,maxPrice:i,minPrice:m,priceClassName:p,priceStyle:d}):b&&(f=Object(a.createElement)(n.a,{className:o()("wc-block-components-product-price__value",p),currency:r,value:b,style:d})),Object(a.createElement)("span",{className:y},Object(a.createInterpolateElement)(l,{price:f}))}},283:function(e,t){},284:function(e,t,c){"use strict";var a=c(12),r=c.n(a),n=c(0),l=c(18),o=c(5),i=c.n(o);c(285),t.a=e=>{let{className:t="",disabled:c=!1,name:a,permalink:o="",target:s,rel:u,style:m,onClick:b,...p}=e;const d=i()("wc-block-components-product-name",t);if(c){const e=p;return Object(n.createElement)("span",r()({className:d},e,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(a)}}))}return Object(n.createElement)("a",r()({className:d,href:o,target:s},p,{dangerouslySetInnerHTML:{__html:Object(l.decodeEntities)(a)},style:m}))}},285:function(e,t){},291:function(e,t,c){"use strict";var a=c(0),r=c(116),n=c(117);const l=e=>{const t=e.indexOf("</p>");return-1===t?e:e.substr(0,t+4)},o=e=>e.replace(/<\/?[a-z][^>]*?>/gi,""),i=(e,t)=>e.replace(/[\s|\.\,]+$/i,"")+t,s=function(e,t){let c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"…";const a=o(e),r=a.split(" ").splice(0,t).join(" ");return Object(n.autop)(i(r,c))},u=function(e,t){let c=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"…";const r=o(e),l=r.slice(0,t);if(c)return Object(n.autop)(i(l,a));const s=l.match(/([\s]+)/g),u=s?s.length:0,m=r.slice(0,t+u);return Object(n.autop)(i(m,a))};t.a=e=>{let{source:t,maxLength:c=15,countType:o="words",className:i="",style:m={}}=e;const b=Object(a.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 a=Object(n.autop)(e),o=Object(r.count)(a,c);if(o<=t)return a;const i=l(a),m=Object(r.count)(i,c);return m<=t?i:"words"===c?s(i,t):u(i,t,"characters_including_spaces"===c)}(t,c,o),[t,c,o]);return Object(a.createElement)(a.RawHTML,{style:m,className:i},b)}},303:function(e,t){},304:function(e,t){},305:function(e,t){},306:function(e,t){},332:function(e,t,c){"use strict";var a=c(12),r=c.n(a),n=c(0),l=c(18),o=c(2);c(303),t.a=e=>{let{image:t={},fallbackAlt:c=""}=e;const a=t.thumbnail?{src:t.thumbnail,alt:Object(l.decodeEntities)(t.alt)||c||"Product Image"}:{src:o.PLACEHOLDER_IMG_SRC,alt:""};return Object(n.createElement)("img",r()({className:"wc-block-components-product-image"},a,{alt:a.alt}))}},333:function(e,t,c){"use strict";var a=c(0),r=c(1),n=c(280);t.a=()=>Object(a.createElement)(n.a,{className:"wc-block-components-product-backorder-badge"},Object(r.__)("Available on backorder","woo-gutenberg-products-block"))},334:function(e,t,c){"use strict";var a=c(0),r=c(1),n=c(280);t.a=e=>{let{lowStockRemaining:t}=e;return t?Object(a.createElement)(n.a,{className:"wc-block-components-product-low-stock-badge"},Object(r.sprintf)(
|
4 |
/* translators: %d stock amount (number of items in stock for product) */
|
5 |
Object(r.__)("%d left in stock","woo-gutenberg-products-block"),t)):null}},341:function(e,t,c){"use strict";var a=c(0),r=c(5),n=c.n(r),l=c(1),o=c(21),i=c(142),s=c(50);c(371);var u=e=>{let{className:t,quantity:c=1,minimum:r=1,maximum:u,onChange:m=(()=>{}),step:b=1,itemName:p="",disabled:d}=e;const O=n()("wc-block-components-quantity-selector",t),j=void 0!==u,_=c-b>=r,y=!j||c+b<=u,g=Object(a.useCallback)(e=>{let t=e;j&&(t=Math.min(t,Math.floor(u/b)*b)),t=Math.max(t,Math.ceil(r/b)*b),t=Math.floor(t/b)*b,t!==e&&m(t)},[j,u,r,m,b]),f=Object(s.a)(g,300);Object(a.useLayoutEffect)(()=>{g(c)},[c,g]);const k=Object(a.useCallback)(e=>{const t=void 0!==typeof e.key?"ArrowDown"===e.key:e.keyCode===i.DOWN,a=void 0!==typeof e.key?"ArrowUp"===e.key:e.keyCode===i.UP;t&&_&&(e.preventDefault(),m(c-b)),a&&y&&(e.preventDefault(),m(c+b))},[c,m,y,_,b]);return Object(a.createElement)("div",{className:O},Object(a.createElement)("input",{className:"wc-block-components-quantity-selector__input",disabled:d,type:"number",step:b,min:r,max:u,value:c,onKeyDown:k,onChange:e=>{let t=parseInt(e.target.value,10);t=isNaN(t)?c:t,t!==c&&(m(t),f(t))},"aria-label":Object(l.sprintf)(
|
6 |
/* translators: %s refers to the item name in the cart. */
|
8 |
/* translators: %s refers to the item name in the cart. */
|
9 |
Object(l.__)("Quantity reduced to %s.","woo-gutenberg-products-block"),e)),g(e)}},"-"),Object(a.createElement)("button",{"aria-label":Object(l.__)("Increase quantity","woo-gutenberg-products-block"),disabled:d||!y,className:"wc-block-components-quantity-selector__button wc-block-components-quantity-selector__button--plus",onClick:()=>{const e=c+b;m(e),Object(o.speak)(Object(l.sprintf)(
|
10 |
/* translators: %s refers to the item name in the cart. */
|
11 |
+
Object(l.__)("Quantity increased to %s.","woo-gutenberg-products-block"),e)),g(e)}},"+"))},m=c(282),b=c(284),p=c(8),d=c(6),O=c(100),j=c(60),_=c(69),y=c(20),g=c(52),f=c(71),k=c(33),E=c(35);var w=c(58),v=c(332),N=c(333),h=c(334),C=c(102),x=c(280),P=e=>{let{currency:t,saleAmount:c,format:r="<price/>"}=e;if(!c||c<=0)return null;r.includes("<price/>")||(r="<price/>",console.error("Price formats need to include the `<price/>` tag."));const n=Object(l.sprintf)(
|
12 |
/* translators: %s will be replaced by the discount amount */
|
13 |
Object(l.__)("Save %s","woo-gutenberg-products-block"),r);return Object(a.createElement)(x.a,{className:"wc-block-components-sale-badge"},Object(a.createInterpolateElement)(n,{price:Object(a.createElement)(C.a,{currency:t,value:c})}))},I=c(344),S=c(41),q=c(10),D=c(331),A=c(2);const R=(e,t)=>e.convertPrecision(t.minorUnit).getAmount(),T=e=>Object(q.mustContain)(e,"<price/>");var F=Object(a.forwardRef)((e,t)=>{let{lineItem:c,onRemove:r=(()=>{}),tabIndex:i=null}=e;const{name:s="",catalog_visibility:C="visible",short_description:x="",description:F="",low_stock_remaining:M=null,show_backorder_badge:L=!1,quantity_limits:U={minimum:1,maximum:99,multiple_of:1,editable:!0},sold_individually:Q=!1,permalink:V="",images:$=[],variation:H=[],item_data:B=[],prices:K={currency_code:"USD",currency_minor_unit:2,currency_symbol:"$",currency_prefix:"$",currency_suffix:"",currency_decimal_separator:".",currency_thousand_separator:",",price:"0",regular_price:"0",sale_price:"0",price_range:null,raw_prices:{precision:6,price:"0",regular_price:"0",sale_price:"0"}},totals:W={currency_code:"USD",currency_minor_unit:2,currency_symbol:"$",currency_prefix:"$",currency_suffix:"",currency_decimal_separator:".",currency_thousand_separator:",",line_subtotal:"0",line_subtotal_tax:"0"},extensions:J}=c,{quantity:Y,setItemQuantity:z,removeItem:G,isPendingDelete:X}=(e=>{const t={key:"",quantity:1};(e=>Object(y.a)(e)&&Object(y.b)(e,"key")&&Object(y.b)(e,"quantity")&&Object(g.a)(e.key)&&Object(f.a)(e.quantity))(e)&&(t.key=e.key,t.quantity=e.quantity);const{key:c="",quantity:r=1}=t,{cartErrors:n}=Object(k.a)(),{dispatchActions:l}=Object(E.b)(),[o,i]=Object(a.useState)(r),[s]=Object(O.a)(o,400),u=Object(j.a)(s),{removeItemFromCart:m,changeCartItemQuantity:b}=Object(p.useDispatch)(d.CART_STORE_KEY);Object(a.useEffect)(()=>i(r),[r]);const w=Object(p.useSelect)(e=>{if(!c)return{quantity:!1,delete:!1};const t=e(d.CART_STORE_KEY);return{quantity:t.isItemPendingQuantity(c),delete:t.isItemPendingDelete(c)}},[c]),v=Object(a.useCallback)(()=>c?m(c).then(()=>(Object(_.d)(),!0)):Promise.resolve(!1),[c,m]);return Object(a.useEffect)(()=>{c&&Object(f.a)(u)&&Number.isFinite(u)&&u!==s&&b(c,s)},[c,b,s,u]),Object(a.useEffect)(()=>(w.delete?l.incrementCalculating():l.decrementCalculating(),()=>{w.delete&&l.decrementCalculating()}),[l,w.delete]),Object(a.useEffect)(()=>(w.quantity||s!==o?l.incrementCalculating():l.decrementCalculating(),()=>{(w.quantity||s!==o)&&l.decrementCalculating()}),[l,w.quantity,s,o]),{isPendingDelete:w.delete,quantity:o,setItemQuantity:i,removeItem:v,cartItemQuantityErrors:n}})(c),{dispatchStoreEvent:Z}=Object(w.a)(),{receiveCart:ee,...te}=Object(k.a)(),ce=Object(a.useMemo)(()=>({context:"cart",cartItem:c,cart:te}),[c,te]),ae=Object(S.getCurrencyFromPriceResponse)(K),re=Object(q.__experimentalApplyCheckoutFilter)({filterName:"itemName",defaultValue:s,extensions:J,arg:ce}),ne=Object(D.a)({amount:parseInt(K.raw_prices.regular_price,10),precision:K.raw_prices.precision}),le=Object(D.a)({amount:parseInt(K.raw_prices.price,10),precision:K.raw_prices.precision}),oe=ne.subtract(le),ie=oe.multiply(Y),se=Object(S.getCurrencyFromPriceResponse)(W);let ue=parseInt(W.line_subtotal,10);Object(A.getSetting)("displayCartPricesIncludingTax",!1)&&(ue+=parseInt(W.line_subtotal_tax,10));const me=Object(D.a)({amount:ue,precision:se.minorUnit}),be=$.length?$[0]:{},pe="hidden"===C||"search"===C,de=Object(q.__experimentalApplyCheckoutFilter)({filterName:"cartItemClass",defaultValue:"",extensions:J,arg:ce}),Oe=Object(q.__experimentalApplyCheckoutFilter)({filterName:"cartItemPrice",defaultValue:"<price/>",extensions:J,arg:ce,validation:T}),je=Object(q.__experimentalApplyCheckoutFilter)({filterName:"subtotalPriceFormat",defaultValue:"<price/>",extensions:J,arg:ce,validation:T}),_e=Object(q.__experimentalApplyCheckoutFilter)({filterName:"saleBadgePriceFormat",defaultValue:"<price/>",extensions:J,arg:ce,validation:T});return Object(a.createElement)("tr",{className:n()("wc-block-cart-items__row",de,{"is-disabled":X}),ref:t,tabIndex:i},Object(a.createElement)("td",{className:"wc-block-cart-item__image","aria-hidden":!Object(y.b)(be,"alt")||!be.alt},pe?Object(a.createElement)(v.a,{image:be,fallbackAlt:re}):Object(a.createElement)("a",{href:V,tabIndex:-1},Object(a.createElement)(v.a,{image:be,fallbackAlt:re}))),Object(a.createElement)("td",{className:"wc-block-cart-item__product"},Object(a.createElement)("div",{className:"wc-block-cart-item__wrap"},Object(a.createElement)(b.a,{disabled:X||pe,name:re,permalink:V}),L?Object(a.createElement)(N.a,null):!!M&&Object(a.createElement)(h.a,{lowStockRemaining:M}),Object(a.createElement)("div",{className:"wc-block-cart-item__prices"},Object(a.createElement)(m.a,{currency:ae,regularPrice:R(ne,ae),price:R(le,ae),format:je})),Object(a.createElement)(P,{currency:ae,saleAmount:R(oe,ae),format:_e}),Object(a.createElement)(I.a,{shortDescription:x,fullDescription:F,itemData:B,variation:H}),Object(a.createElement)("div",{className:"wc-block-cart-item__quantity"},!Q&&!!U.editable&&Object(a.createElement)(u,{disabled:X,quantity:Y,minimum:U.minimum,maximum:U.maximum,step:U.multiple_of,onChange:e=>{z(e),Z("cart-set-item-quantity",{product:c,quantity:e})},itemName:re}),Object(a.createElement)("button",{className:"wc-block-cart-item__remove-link",onClick:()=>{r(),G(),Z("cart-remove-item",{product:c,quantity:Y}),Object(o.speak)(Object(l.sprintf)(
|
14 |
/* translators: %s refers to the item name in the cart. */
|
build/cart-blocks/cart-line-items-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[15],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[15],{100:function(t,n,e){"use strict";e.d(n,"a",(function(){return s}));var c=e(3),r=e(50);function u(t,n){return t===n}function a(t){return"function"==typeof t?function(){return t}:t}function s(t,n,e){var s=e&&e.equalityFn||u,o=function(t){var n=Object(c.useState)(a(t)),e=n[0],r=n[1];return[e,Object(c.useCallback)((function(t){return r(a(t))}),[])]}(t),i=o[0],f=o[1],l=Object(r.a)(Object(c.useCallback)((function(t){return f(t)}),[f]),n,e),b=Object(c.useRef)(t);return s(b.current,t)||(l(t),b.current=t),[i,l]}},451:function(t,n,e){"use strict";e.r(n);var c=e(0),r=e(33),u=e(341);n.default=t=>{let{className:n}=t;const{cartItems:e,cartIsLoading:a}=Object(r.a)();return Object(c.createElement)(u.a,{className:n,lineItems:e,isLoading:a})}}}]);
|
build/cart-blocks/cart-order-summary-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[16],{
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[16],{102:function(e,t,a){"use strict";var c=a(12),n=a.n(c),r=a(0),o=a(139),l=a(5),s=a.n(l);a(196);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:a,currency:c,onValueChange:l,displayType:u="text",...m}=e;const p="string"==typeof a?parseInt(a,10):a;if(!Number.isFinite(p))return null;const b=p/10**c.minorUnit;if(!Number.isFinite(b))return null;const d=s()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),f={...m,...i(c),value:void 0,currency:void 0,onValueChange:void 0},x=l?e=>{const t=+e.value*10**c.minorUnit;l(t)}:()=>{};return Object(r.createElement)(o.a,n()({className:d,displayType:u},f,{value:b,onValueChange:x}))}},196:function(e,t){},309:function(e,t){},378:function(e,t,a){"use strict";var c=a(0),n=a(1),r=a(5),o=a.n(r),l=a(102),s=a(10),i=a(33),u=a(2);a(309),t.a=e=>{let{currency:t,values:a,className:r}=e;const m=Object(u.getSetting)("taxesEnabled",!0)&&Object(u.getSetting)("displayCartPricesIncludingTax",!1),{total_price:p,total_tax:b}=a,{receiveCart:d,...f}=Object(i.a)(),x=Object(s.__experimentalApplyCheckoutFilter)({filterName:"totalLabel",defaultValue:Object(n.__)("Total","woo-gutenberg-products-block"),extensions:f.extensions,arg:{cart:f}}),O=parseInt(b,10);return Object(c.createElement)(s.TotalsItem,{className:o()("wc-block-components-totals-footer-item",r),currency:t,label:x,value:parseInt(p,10),description:m&&0!==O&&Object(c.createElement)("p",{className:"wc-block-components-totals-footer-item-tax"},Object(c.createInterpolateElement)(Object(n.__)("Including <TaxAmount/> in taxes","woo-gutenberg-products-block"),{TaxAmount:Object(c.createElement)(l.a,{className:"wc-block-components-totals-footer-item-tax-value",currency:t,value:O})}))})}},454:function(e,t,a){"use strict";a.r(t);var c=a(0),n=a(378),r=a(41),o=a(33),l=a(10);const s=()=>{const{extensions:e,receiveCart:t,...a}=Object(o.a)(),n={extensions:e,cart:a,context:"woocommerce/cart"};return Object(c.createElement)(l.ExperimentalOrderMeta.Slot,n)};t.default=e=>{let{children:t,className:a=""}=e;const{cartTotals:l}=Object(o.a)(),i=Object(r.getCurrencyFromPriceResponse)(l);return Object(c.createElement)("div",{className:a},t,Object(c.createElement)("div",{className:"wc-block-components-totals-wrapper"},Object(c.createElement)(n.a,{currency:i,values:l})),Object(c.createElement)(s,null))}}}]);
|
build/cart-blocks/order-summary-coupon-form-frontend.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[20],{
|
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=>{p({coupon:{message:Object(r.decodeEntities)(e.message),hidden:!1}}),O("")})},removeCoupon:t=>{m(t).then(n=>{!0===n&&u("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=>{i(t.message,{id:"coupon-form",context:e}),O("")})},isApplyingCoupon:l,isRemovingCoupon:b}},[i,u]);return{appliedCoupons:t,isLoading:n,...b}}},273:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var o=n(0),c=n(198);n(261);const a=e=>{let{errorMessage:t="",propertyName:n="",elementId:a=""}=e;const{getValidationError:r,getValidationErrorId:s}=Object(c.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:s(a)},t))}},297:function(e,t,n){"use strict";var o=n(12),c=n.n(o),a=n(0),r=n(1),s=n(3),l=n(5),i=n.n(l),u=n(198),p=n(273),b=n(11),d=n(52),m=n(
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[20],{26:function(e,t,n){"use strict";var o=n(0),c=n(5),a=n.n(c);t.a=e=>{let t,{label:n,screenReaderLabel:c,wrapperElement:r,wrapperProps:s={}}=e;const l=null!=n,i=null!=c;return!l&&i?(t=r||"span",s={...s,className:a()(s.className,"screen-reader-text")},Object(o.createElement)(t,s,c)):(t=r||o.Fragment,l&&i&&n!==c?Object(o.createElement)(t,s,Object(o.createElement)("span",{"aria-hidden":"true"},n),Object(o.createElement)("span",{className:"screen-reader-text"},c)):Object(o.createElement)(t,s,n))}},261:function(e,t){},262:function(e,t){},263:function(e,t,n){"use strict";var o=n(12),c=n.n(o),a=n(0),r=n(43),s=n(5),l=n.n(s),i=n(136);n(264),t.a=e=>{let{className:t,showSpinner:n=!1,children:o,variant:s="contained",...u}=e;const p=l()("wc-block-components-button",t,s,{"wc-block-components-button--loading":n});return Object(a.createElement)(r.a,c()({className:p},u),n&&Object(a.createElement)(i.a,null),Object(a.createElement)("span",{className:"wc-block-components-button__text"},o))}},264:function(e,t){},270:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var o=n(1),c=n(8),a=n(6),r=n(18),s=n(33),l=n(198);const i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";const{cartCoupons:t,cartIsLoading:n}=Object(s.a)(),{createErrorNotice:i}=Object(c.useDispatch)("core/notices"),{createNotice:u}=Object(c.useDispatch)("core/notices"),{setValidationErrors:p}=Object(l.b)(),b=Object(c.useSelect)((t,n)=>{let{dispatch:c}=n;const s=t(a.CART_STORE_KEY),l=s.isApplyingCoupon(),b=s.isRemovingCoupon(),{applyCoupon:d,removeCoupon:m,receiveApplyingCoupon:O}=c(a.CART_STORE_KEY);return{applyCoupon:t=>{d(t).then(n=>{!0===n&&u("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=>{p({coupon:{message:Object(r.decodeEntities)(e.message),hidden:!1}}),O("")})},removeCoupon:t=>{m(t).then(n=>{!0===n&&u("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=>{i(t.message,{id:"coupon-form",context:e}),O("")})},isApplyingCoupon:l,isRemovingCoupon:b}},[i,u]);return{appliedCoupons:t,isLoading:n,...b}}},273:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var o=n(0),c=n(198);n(261);const a=e=>{let{errorMessage:t="",propertyName:n="",elementId:a=""}=e;const{getValidationError:r,getValidationErrorId:s}=Object(c.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:s(a)},t))}},297:function(e,t,n){"use strict";var o=n(12),c=n.n(o),a=n(0),r=n(1),s=n(3),l=n(5),i=n.n(l),u=n(198),p=n(273),b=n(11),d=n(52),m=n(26);n(262);var O=Object(s.forwardRef)((e,t)=>{let{className:n,id:o,type:r="text",ariaLabel:s,ariaDescribedBy:l,label:u,screenReaderLabel:p,disabled:b,help:d,autoCapitalize:O="off",autoComplete:j="off",value:g="",onChange:f,required:E=!1,onBlur:v=(()=>{}),feedback:h,...w}=e;const[_,k]=Object(a.useState)(!1);return Object(a.createElement)("div",{className:i()("wc-block-components-text-input",n,{"is-active":_||g})},Object(a.createElement)("input",c()({type:r,id:o,value:g,ref:t,autoCapitalize:O,autoComplete:j,onChange:e=>{f(e.target.value)},onFocus:()=>k(!0),onBlur:e=>{v(e.target.value),k(!1)},"aria-label":s||u,disabled:b,"aria-describedby":d&&!l?o+"__help":l,required:E},w)),Object(a.createElement)(m.a,{label:u,screenReaderLabel:p||u,wrapperElement:"label",wrapperProps:{htmlFor:o},htmlFor:o}),!!d&&Object(a.createElement)("p",{id:o+"__help",className:"wc-block-components-text-input__help"},d),h)});t.a=Object(b.withInstanceId)(e=>{let{className:t,instanceId:n,id:o,ariaDescribedBy:l,errorId:b,focusOnMount:m=!1,onChange:j,showError:g=!0,errorMessage:f="",value:E="",...v}=e;const[h,w]=Object(s.useState)(!0),_=Object(s.useRef)(null),{getValidationError:k,hideValidationError:C,setValidationErrors:y,clearValidationError:N,getValidationErrorId:I}=Object(u.b)(),R=void 0!==o?o:"textinput-"+n,S=void 0!==b?b:R,L=Object(s.useCallback)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=_.current||null;if(!t)return;t.value=t.value.trim();const n=t.checkValidity();n?N(S):y({[S]:{message:t.validationMessage||Object(r.__)("Invalid value.","woo-gutenberg-products-block"),hidden:e}})}),[N,S,y]);Object(s.useEffect)(()=>{var e;h&&m&&(null===(e=_.current)||void 0===e||e.focus()),w(!1)},[m,h,w]),Object(s.useEffect)(()=>{var e,t;(null===(e=_.current)||void 0===e||null===(t=e.ownerDocument)||void 0===t?void 0:t.activeElement)!==_.current&&L(!0)},[E,L]),Object(s.useEffect)(()=>()=>{N(S)},[N,S]);const V=k(S)||{};Object(d.a)(f)&&""!==f&&(V.message=f);const x=V.message&&!V.hidden,B=g&&x&&I(S)?I(S):l;return Object(a.createElement)(O,c()({className:i()(t,{"has-error":x}),"aria-invalid":!0===x,id:R,onBlur:()=>{L(!1)},feedback:g&&Object(a.createElement)(p.a,{errorMessage:f,propertyName:S}),ref:_,onChange:e=>{C(S),j(e)},ariaDescribedBy:B,value:E},v))})},311:function(e,t){},380:function(e,t,n){"use strict";var o=n(0),c=n(1),a=n(263),r=n(297),s=n(26),l=n(138),i=n(11),u=n(198),p=n(273),b=n(10);n(311),t.a=Object(i.withInstanceId)(e=>{let{instanceId:t,isLoading:n=!1,initialOpen:i=!1,onSubmit:d=(()=>{})}=e;const[m,O]=Object(o.useState)(""),j=Object(o.useRef)(!1),{getValidationError:g,getValidationErrorId:f}=Object(u.b)(),E=g("coupon");Object(o.useEffect)(()=>{j.current!==n&&(n||!m||E||O(""),j.current=n)},[n,m,E]);const v="wc-block-components-totals-coupon__input-"+t;return Object(o.createElement)(b.Panel,{className:"wc-block-components-totals-coupon",hasBorder:!1,initialOpen:i,title:Object(o.createElement)(s.a,{label:Object(c.__)("Coupon code","woo-gutenberg-products-block"),screenReaderLabel:Object(c.__)("Apply a coupon code","woo-gutenberg-products-block"),htmlFor:v})},Object(o.createElement)(l.a,{screenReaderLabel:Object(c.__)("Applying coupon…","woo-gutenberg-products-block"),isLoading:n,showSpinner:!1},Object(o.createElement)("div",{className:"wc-block-components-totals-coupon__content"},Object(o.createElement)("form",{className:"wc-block-components-totals-coupon__form"},Object(o.createElement)(r.a,{id:v,errorId:"coupon",className:"wc-block-components-totals-coupon__input",label:Object(c.__)("Enter code","woo-gutenberg-products-block"),value:m,ariaDescribedBy:f(v),onChange:e=>{O(e)},focusOnMount:!0,showError:!1}),Object(o.createElement)(a.a,{className:"wc-block-components-totals-coupon__button",disabled:n||!m,showSpinner:n,onClick:e=>{e.preventDefault(),d(m)},type:"submit"},Object(c.__)("Apply","woo-gutenberg-products-block"))),Object(o.createElement)(p.a,{propertyName:"coupon",elementId:v}))))})},458:function(e,t,n){"use strict";n.r(t);var o=n(0),c=n(380),a=n(270),r=n(2),s=n(10);t.default=e=>{let{className:t}=e;const n=Object(r.getSetting)("couponsEnabled",!0),{applyCoupon:l,isApplyingCoupon:i}=Object(a.a)("wc/cart");return n?Object(o.createElement)(s.TotalsWrapper,{className:t},Object(o.createElement)(c.a,{onSubmit:l,isLoading:i})):null}}}]);
|
build/cart-blocks/order-summary-discount-frontend.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[21],{
|
2 |
/* translators: Remove chip. */
|
3 |
Object(l.__)("Remove","woo-gutenberg-products-block"):Object(l.sprintf)(
|
4 |
/* translators: %s text of the chip to remove. */
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[21],{105:function(e,t,o){"use strict";var c=o(0);t.a=function(e){let{icon:t,size:o=24,...n}=e;return Object(c.cloneElement)(t,{width:o,height:o,...n})}},121:function(e,t){},200:function(e,t,o){"use strict";var c=o(0),n=o(14);const s=Object(c.createElement)(n.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(c.createElement)(n.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},204:function(e,t,o){"use strict";var c=o(12),n=o.n(c),s=o(0),a=o(5),r=o.n(a),l=o(1),i=o(105),u=o(200);o(121);var p=e=>{let{text:t,screenReaderText:o="",element:c="li",className:a="",radius:l="small",children:i=null,...u}=e;const p=c,b=r()(a,"wc-block-components-chip","wc-block-components-chip--radius-"+l),m=Boolean(o&&o!==t);return Object(s.createElement)(p,n()({className:b},u),Object(s.createElement)("span",{"aria-hidden":m,className:"wc-block-components-chip__text"},t),m&&Object(s.createElement)("span",{className:"screen-reader-text"},o),i)};t.a=e=>{let{ariaLabel:t="",className:o="",disabled:c=!1,onRemove:a=(()=>{}),removeOnAnyClick:b=!1,text:m,screenReaderText:d="",...g}=e;const O=b?"span":"button";if(!t){const e=d&&"string"==typeof d?d:m;t="string"!=typeof e?
|
2 |
/* translators: Remove chip. */
|
3 |
Object(l.__)("Remove","woo-gutenberg-products-block"):Object(l.sprintf)(
|
4 |
/* translators: %s text of the chip to remove. */
|
build/cart-blocks/order-summary-heading-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[23],{265:function(e,t,c){"use strict";var n=c(12),o=c.n(n),a=c(0),l=c(5),s=c.n(l);c(266),t.a=e=>{let{children:t,className:c,headingLevel:n,...l}=e;const r=s()("wc-block-components-title",c),i="h"+n;return Object(a.createElement)(i,o()({className:r},l),t)}},266:function(e,t){},441:function(e,t,c){"use strict";c.r(t);var n=c(
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[23],{265:function(e,t,c){"use strict";var n=c(12),o=c.n(n),a=c(0),l=c(5),s=c.n(l);c(266),t.a=e=>{let{children:t,className:c,headingLevel:n,...l}=e;const r=s()("wc-block-components-title",c),i="h"+n;return Object(a.createElement)(i,o()({className:r},l),t)}},266:function(e,t){},441:function(e,t,c){"use strict";c.r(t);var n=c(119),o=c(0),a=c(265),l=c(5),s=c.n(l),r=c(1),i={content:{type:"string",default:Object(r.__)("Cart totals","woo-gutenberg-products-block")},lock:{type:"object",default:{remove:!1,move:!1}}};t.default=Object(n.withFilteredAttributes)(i)(e=>{let{className:t,content:c=""}=e;return Object(o.createElement)(a.a,{headingLevel:"2",className:s()(t,"wc-block-cart__totals-title")},c)})}}]);
|
build/cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping-frontend.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[5],{
|
2 |
/* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */
|
3 |
Object(c._n)("%1$s (%2$d unit)","%1$s (%2$d units)",n,"woo-gutenberg-products-block"),t,n)}))}))),j=Object(a.createElement)(_,{className:n,noResultsMessage:o,rates:l.shipping_rates,onSelectRate:e=>O(e,t),selectedRate:l.shipping_rates.find(e=>e.selected),renderOption:s});return i?Object(a.createElement)(r.Panel,{className:"wc-block-components-shipping-rates-control__package",initialOpen:!p,title:h},j):Object(a.createElement)("div",{className:d()("wc-block-components-shipping-rates-control__package",n)},h,j)};const y=e=>{let{packages:t,collapse:n,showItems:c,collapsible:o,noResultsMessage:s,renderOption:r}=e;return t.length?Object(a.createElement)(a.Fragment,null,t.map(e=>{let{package_id:t,...l}=e;return Object(a.createElement)(v,{key:t,packageId:t,packageData:l,collapsible:o,collapse:n,showItems:c,noResultsMessage:s,renderOption:r})})):null};t.a=e=>{let{shippingRates:t,isLoadingRates:n,className:u,collapsible:d=!1,noResultsMessage:b,renderOption:m,context:g}=e;Object(a.useEffect)(()=>{if(n)return;const e=Object(l.a)(t),a=Object(l.b)(t);1===e?Object(o.speak)(Object(c.sprintf)(
|
4 |
/* translators: %d number of shipping options found. */
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[5],{102:function(e,t,n){"use strict";var a=n(12),c=n.n(a),o=n(0),s=n(139),r=n(5),l=n.n(r);n(196);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:n,currency:a,onValueChange:r,displayType:p="text",...u}=e;const d="string"==typeof n?parseInt(n,10):n;if(!Number.isFinite(d))return null;const b=d/10**a.minorUnit;if(!Number.isFinite(b))return null;const m=l()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",t),g={...u,...i(a),value:void 0,currency:void 0,onValueChange:void 0},O=r?e=>{const t=+e.value*10**a.minorUnit;r(t)}:()=>{};return Object(o.createElement)(s.a,c()({className:m,displayType:p},g,{value:b,onValueChange:O}))}},196:function(e,t){},26:function(e,t,n){"use strict";var a=n(0),c=n(5),o=n.n(c);t.a=e=>{let t,{label:n,screenReaderLabel:c,wrapperElement:s,wrapperProps:r={}}=e;const l=null!=n,i=null!=c;return!l&&i?(t=s||"span",r={...r,className:o()(r.className,"screen-reader-text")},Object(a.createElement)(t,r,c)):(t=s||a.Fragment,l&&i&&n!==c?Object(a.createElement)(t,r,Object(a.createElement)("span",{"aria-hidden":"true"},n),Object(a.createElement)("span",{className:"screen-reader-text"},c)):Object(a.createElement)(t,r,n))}},261:function(e,t){},262:function(e,t){},263:function(e,t,n){"use strict";var a=n(12),c=n.n(a),o=n(0),s=n(43),r=n(5),l=n.n(r),i=n(136);n(264),t.a=e=>{let{className:t,showSpinner:n=!1,children:a,variant:r="contained",...p}=e;const u=l()("wc-block-components-button",t,r,{"wc-block-components-button--loading":n});return Object(o.createElement)(s.a,c()({className:u},p),n&&Object(o.createElement)(i.a,null),Object(o.createElement)("span",{className:"wc-block-components-button__text"},a))}},264:function(e,t){},267:function(e,t,n){"use strict";var a=n(0),c=n(5),o=n.n(c),s=n(268);t.a=e=>{let{checked:t,name:n,onChange:c,option:r}=e;const{value:l,label:i,description:p,secondaryLabel:u,secondaryDescription:d}=r;return Object(a.createElement)("label",{className:o()("wc-block-components-radio-control__option",{"wc-block-components-radio-control__option-checked":t}),htmlFor:`${n}-${l}`},Object(a.createElement)("input",{id:`${n}-${l}`,className:"wc-block-components-radio-control__input",type:"radio",name:n,value:l,onChange:e=>c(e.target.value),checked:t,"aria-describedby":o()({[`${n}-${l}__label`]:i,[`${n}-${l}__secondary-label`]:u,[`${n}-${l}__description`]:p,[`${n}-${l}__secondary-description`]:d})}),Object(a.createElement)(s.a,{id:`${n}-${l}`,label:i,secondaryLabel:u,description:p,secondaryDescription:d}))}},268:function(e,t,n){"use strict";var a=n(0);t.a=e=>{let{label:t,secondaryLabel:n,description:c,secondaryDescription:o,id:s}=e;return Object(a.createElement)("div",{className:"wc-block-components-radio-control__option-layout"},Object(a.createElement)("div",{className:"wc-block-components-radio-control__label-group"},t&&Object(a.createElement)("span",{id:s&&s+"__label",className:"wc-block-components-radio-control__label"},t),n&&Object(a.createElement)("span",{id:s&&s+"__secondary-label",className:"wc-block-components-radio-control__secondary-label"},n)),Object(a.createElement)("div",{className:"wc-block-components-radio-control__description-group"},c&&Object(a.createElement)("span",{id:s&&s+"__description",className:"wc-block-components-radio-control__description"},c),o&&Object(a.createElement)("span",{id:s&&s+"__secondary-description",className:"wc-block-components-radio-control__secondary-description"},o)))}},273:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var a=n(0),c=n(198);n(261);const o=e=>{let{errorMessage:t="",propertyName:n="",elementId:o=""}=e;const{getValidationError:s,getValidationErrorId:r}=Object(c.b)();if(!t||"string"!=typeof t){const e=s(n)||{};if(!e.message||e.hidden)return null;t=e.message}return Object(a.createElement)("div",{className:"wc-block-components-validation-error",role:"alert"},Object(a.createElement)("p",{id:r(o)},t))}},289:function(e,t,n){"use strict";var a=n(0),c=n(5),o=n.n(c),s=n(11),r=n(267);n(290);const l=e=>{let{className:t="",id:n,selected:c,onChange:i,options:p=[]}=e;const u=Object(s.useInstanceId)(l),d=n||u;return p.length?Object(a.createElement)("div",{className:o()("wc-block-components-radio-control",t)},p.map(e=>Object(a.createElement)(r.a,{key:`${d}-${e.value}`,name:"radio-control-"+d,checked:e.value===c,option:e,onChange:t=>{i(t),"function"==typeof e.onChange&&e.onChange(t)}}))):null};t.a=l},290:function(e,t){},297:function(e,t,n){"use strict";var a=n(12),c=n.n(a),o=n(0),s=n(1),r=n(3),l=n(5),i=n.n(l),p=n(198),u=n(273),d=n(11),b=n(52),m=n(26);n(262);var g=Object(r.forwardRef)((e,t)=>{let{className:n,id:a,type:s="text",ariaLabel:r,ariaDescribedBy:l,label:p,screenReaderLabel:u,disabled:d,help:b,autoCapitalize:g="off",autoComplete:O="off",value:h="",onChange:j,required:f=!1,onBlur:E=(()=>{}),feedback:k,..._}=e;const[v,y]=Object(o.useState)(!1);return Object(o.createElement)("div",{className:i()("wc-block-components-text-input",n,{"is-active":v||h})},Object(o.createElement)("input",c()({type:s,id:a,value:h,ref:t,autoCapitalize:g,autoComplete:O,onChange:e=>{j(e.target.value)},onFocus:()=>y(!0),onBlur:e=>{E(e.target.value),y(!1)},"aria-label":r||p,disabled:d,"aria-describedby":b&&!l?a+"__help":l,required:f},_)),Object(o.createElement)(m.a,{label:p,screenReaderLabel:u||p,wrapperElement:"label",wrapperProps:{htmlFor:a},htmlFor:a}),!!b&&Object(o.createElement)("p",{id:a+"__help",className:"wc-block-components-text-input__help"},b),k)});t.a=Object(d.withInstanceId)(e=>{let{className:t,instanceId:n,id:a,ariaDescribedBy:l,errorId:d,focusOnMount:m=!1,onChange:O,showError:h=!0,errorMessage:j="",value:f="",...E}=e;const[k,_]=Object(r.useState)(!0),v=Object(r.useRef)(null),{getValidationError:y,hideValidationError:w,setValidationErrors:C,clearValidationError:N,getValidationErrorId:S}=Object(p.b)(),I=void 0!==a?a:"textinput-"+n,R=void 0!==d?d:I,x=Object(r.useCallback)((function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=v.current||null;if(!t)return;t.value=t.value.trim();const n=t.checkValidity();n?N(R):C({[R]:{message:t.validationMessage||Object(s.__)("Invalid value.","woo-gutenberg-products-block"),hidden:e}})}),[N,R,C]);Object(r.useEffect)(()=>{var e;k&&m&&(null===(e=v.current)||void 0===e||e.focus()),_(!1)},[m,k,_]),Object(r.useEffect)(()=>{var e,t;(null===(e=v.current)||void 0===e||null===(t=e.ownerDocument)||void 0===t?void 0:t.activeElement)!==v.current&&x(!0)},[f,x]),Object(r.useEffect)(()=>()=>{N(R)},[N,R]);const L=y(R)||{};Object(b.a)(j)&&""!==j&&(L.message=j);const M=L.message&&!L.hidden,$=h&&M&&S(R)?S(R):l;return Object(o.createElement)(g,c()({className:i()(t,{"has-error":M}),"aria-invalid":!0===M,id:I,onBlur:()=>{x(!1)},feedback:h&&Object(o.createElement)(u.a,{errorMessage:j,propertyName:R}),ref:v,onChange:e=>{w(R),O(e)},ariaDescribedBy:$,value:f},E))})},312:function(e,t){},313:function(e,t){},314:function(e,t){},315:function(e,t){},336:function(e,t){},343:function(e,t,n){"use strict";var a=n(0),c=n(1),o=n(21),s=n(138),r=n(10),l=n(385),i=n(33),p=n(29),u=n(5),d=n.n(u),b=n(18),m=n(26),g=n(68),O=n(289),h=n(268),j=n(41),f=n(102),E=n(2);const k=e=>{const t=Object(E.getSetting)("displayCartPricesIncludingTax",!1)?parseInt(e.price,10)+parseInt(e.taxes,10):parseInt(e.price,10);return{label:Object(b.decodeEntities)(e.name),value:e.rate_id,description:Object(a.createElement)(a.Fragment,null,Number.isFinite(t)&&Object(a.createElement)(f.a,{currency:Object(j.getCurrencyFromPriceResponse)(e),value:t}),Number.isFinite(t)&&e.delivery_time?" — ":null,Object(b.decodeEntities)(e.delivery_time))}};var _=e=>{let{className:t="",noResultsMessage:n,onSelectRate:c,rates:o,renderOption:s=k,selectedRate:r}=e;const l=(null==r?void 0:r.rate_id)||"",[i,p]=Object(a.useState)(l);if(Object(a.useEffect)(()=>{l&&p(l)},[l]),0===o.length)return n;if(o.length>1)return Object(a.createElement)(O.a,{className:t,onChange:e=>{p(e),c(e)},selected:i,options:o.map(s)});const{label:u,secondaryLabel:d,description:b,secondaryDescription:m}=s(o[0]);return Object(a.createElement)(h.a,{label:u,secondaryLabel:d,description:b,secondaryDescription:m})};n(315);var v=e=>{let{packageId:t,className:n="",noResultsMessage:o,renderOption:s,packageData:l,collapsible:i=!1,collapse:p=!1,showItems:u=!1}=e;const{selectShippingRate:O}=Object(g.a)(),h=Object(a.createElement)(a.Fragment,null,(u||i)&&Object(a.createElement)("div",{className:"wc-block-components-shipping-rates-control__package-title"},l.name),u&&Object(a.createElement)("ul",{className:"wc-block-components-shipping-rates-control__package-items"},Object.values(l.items).map(e=>{const t=Object(b.decodeEntities)(e.name),n=e.quantity;return Object(a.createElement)("li",{key:e.key,className:"wc-block-components-shipping-rates-control__package-item"},Object(a.createElement)(m.a,{label:n>1?`${t} × ${n}`:""+t,screenReaderLabel:Object(c.sprintf)(
|
2 |
/* translators: %1$s name of the product (ie: Sunglasses), %2$d number of units in the current cart package */
|
3 |
Object(c._n)("%1$s (%2$d unit)","%1$s (%2$d units)",n,"woo-gutenberg-products-block"),t,n)}))}))),j=Object(a.createElement)(_,{className:n,noResultsMessage:o,rates:l.shipping_rates,onSelectRate:e=>O(e,t),selectedRate:l.shipping_rates.find(e=>e.selected),renderOption:s});return i?Object(a.createElement)(r.Panel,{className:"wc-block-components-shipping-rates-control__package",initialOpen:!p,title:h},j):Object(a.createElement)("div",{className:d()("wc-block-components-shipping-rates-control__package",n)},h,j)};const y=e=>{let{packages:t,collapse:n,showItems:c,collapsible:o,noResultsMessage:s,renderOption:r}=e;return t.length?Object(a.createElement)(a.Fragment,null,t.map(e=>{let{package_id:t,...l}=e;return Object(a.createElement)(v,{key:t,packageId:t,packageData:l,collapsible:o,collapse:n,showItems:c,noResultsMessage:s,renderOption:r})})):null};t.a=e=>{let{shippingRates:t,isLoadingRates:n,className:u,collapsible:d=!1,noResultsMessage:b,renderOption:m,context:g}=e;Object(a.useEffect)(()=>{if(n)return;const e=Object(l.a)(t),a=Object(l.b)(t);1===e?Object(o.speak)(Object(c.sprintf)(
|
4 |
/* translators: %d number of shipping options found. */
|
build/cart-blocks/order-summary-shipping-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[24],{442:function(e,t,a){"use strict";a.r(t);var c=a(
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[24],{442:function(e,t,a){"use strict";a.r(t);var c=a(119),l=a(0),r=a(435),o=a(41),n=a(33),s=a(10),i=a(2),p={isShippingCalculatorEnabled:{type:"boolean",default:Object(i.getSetting)("isShippingCalculatorEnabled",!0)},lock:{type:"object",default:{move:!1,remove:!0}}};t.default=Object(c.withFilteredAttributes)(p)(e=>{let{className:t,isShippingCalculatorEnabled:a}=e;const{cartTotals:c,cartNeedsShipping:i}=Object(n.a)();if(!i)return null;const p=Object(o.getCurrencyFromPriceResponse)(c);return Object(l.createElement)(s.TotalsWrapper,{className:t},Object(l.createElement)(r.a,{showCalculator:a,showRateSelector:!0,values:c,currency:p}))})}}]);
|
build/cart-blocks/order-summary-taxes-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[26],{443:function(e,t,a){"use strict";a.r(t);var c=a(
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[26],{443:function(e,t,a){"use strict";a.r(t);var c=a(119),r=a(0),s=a(10),l=a(41),n=a(33),o=a(2),i={showRateAfterTaxName:{type:"boolean",default:Object(o.getSetting)("displayCartPricesIncludingTax",!1)},lock:{type:"object",default:{remove:!0,move:!1}}};t.default=Object(c.withFilteredAttributes)(i)(e=>{let{className:t,showRateAfterTaxName:a}=e;const{cartTotals:c}=Object(n.a)();if(Object(o.getSetting)("displayCartPricesIncludingTax",!1)||parseInt(c.total_tax,10)<=0)return null;const i=Object(l.getCurrencyFromPriceResponse)(c);return Object(r.createElement)(s.TotalsWrapper,{className:t},Object(r.createElement)(s.TotalsTaxes,{showRateAfterTaxName:a,currency:i,values:c}))})}}]);
|
build/cart-blocks/proceed-to-checkout-frontend.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[27],{263:function(e,t,c){"use strict";var n=c(12),o=c.n(n),s=c(0),r=c(43),a=c(5),i=c.n(a),u=c(136);c(264),t.a=e=>{let{className:t,showSpinner:c=!1,children:n,variant:a="contained",...b}=e;const l=i()("wc-block-components-button",t,a,{"wc-block-components-button--loading":c});return Object(s.createElement)(r.a,o()({className:l},b),c&&Object(s.createElement)(u.a,null),Object(s.createElement)("span",{className:"wc-block-components-button__text"},n))}},264:function(e,t){},374:function(e,t,c){"use strict";(function(e){var n=c(0),o=c(1),s=c(5),r=c.n(s),a=c(263),i=c(46),u=c(35),b=c(421),l=c(2);c(376),t.a=t=>{let{checkoutPageId:c,className:s}=t;const d=Object(l.getSetting)("page-"+c,!1),{isCalculating:m}=Object(u.b)(),[f,w]=Object(b.a)(),[p,v]=Object(n.useState)(!1);Object(n.useEffect)(()=>{if("function"!=typeof e.addEventListener||"function"!=typeof e.removeEventListener)return;const t=()=>{v(!1)};return e.addEventListener("pageshow",t),()=>{e.removeEventListener("pageshow",t)}},[]);const j=Object(n.createElement)(a.a,{className:"wc-block-cart__submit-button",href:d||i.d,disabled:m,onClick:()=>v(!0),showSpinner:p},Object(o.__)("Proceed to Checkout","woo-gutenberg-products-block"));return Object(n.createElement)("div",{className:r()("wc-block-cart__submit",s)},f,Object(n.createElement)("div",{className:"wc-block-cart__submit-container"},j),"below"===w&&Object(n.createElement)("div",{className:"wc-block-cart__submit-container wc-block-cart__submit-container--sticky"},j))}}).call(this,c(375))},375:function(e,t){var c;c=function(){return this}();try{c=c||new Function("return this")()}catch(e){"object"==typeof window&&(c=window)}e.exports=c},376:function(e,t){},421:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var n=c(0);const o={bottom:0,left:0,opacity:0,pointerEvents:"none",position:"absolute",right:0,top:0,zIndex:-1},s=()=>{const[e,t]=Object(n.useState)(""),c=Object(n.useRef)(null),s=Object(n.useRef)(new IntersectionObserver(e=>{e[0].isIntersecting?t("visible"):t(e[0].boundingClientRect.top>0?"below":"above")},{threshold:1}));return Object(n.useLayoutEffect)(()=>{const e=c.current,t=s.current;return e&&t.observe(e),()=>{t.unobserve(e)}},[]),[Object(n.createElement)("div",{"aria-hidden":!0,ref:c,style:o}),e]}},452:function(e,t,c){"use strict";c.r(t);var n=c(
|
1 |
+
(window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[]).push([[27],{263:function(e,t,c){"use strict";var n=c(12),o=c.n(n),s=c(0),r=c(43),a=c(5),i=c.n(a),u=c(136);c(264),t.a=e=>{let{className:t,showSpinner:c=!1,children:n,variant:a="contained",...b}=e;const l=i()("wc-block-components-button",t,a,{"wc-block-components-button--loading":c});return Object(s.createElement)(r.a,o()({className:l},b),c&&Object(s.createElement)(u.a,null),Object(s.createElement)("span",{className:"wc-block-components-button__text"},n))}},264:function(e,t){},374:function(e,t,c){"use strict";(function(e){var n=c(0),o=c(1),s=c(5),r=c.n(s),a=c(263),i=c(46),u=c(35),b=c(421),l=c(2);c(376),t.a=t=>{let{checkoutPageId:c,className:s}=t;const d=Object(l.getSetting)("page-"+c,!1),{isCalculating:m}=Object(u.b)(),[f,w]=Object(b.a)(),[p,v]=Object(n.useState)(!1);Object(n.useEffect)(()=>{if("function"!=typeof e.addEventListener||"function"!=typeof e.removeEventListener)return;const t=()=>{v(!1)};return e.addEventListener("pageshow",t),()=>{e.removeEventListener("pageshow",t)}},[]);const j=Object(n.createElement)(a.a,{className:"wc-block-cart__submit-button",href:d||i.d,disabled:m,onClick:()=>v(!0),showSpinner:p},Object(o.__)("Proceed to Checkout","woo-gutenberg-products-block"));return Object(n.createElement)("div",{className:r()("wc-block-cart__submit",s)},f,Object(n.createElement)("div",{className:"wc-block-cart__submit-container"},j),"below"===w&&Object(n.createElement)("div",{className:"wc-block-cart__submit-container wc-block-cart__submit-container--sticky"},j))}}).call(this,c(375))},375:function(e,t){var c;c=function(){return this}();try{c=c||new Function("return this")()}catch(e){"object"==typeof window&&(c=window)}e.exports=c},376:function(e,t){},421:function(e,t,c){"use strict";c.d(t,"a",(function(){return s}));var n=c(0);const o={bottom:0,left:0,opacity:0,pointerEvents:"none",position:"absolute",right:0,top:0,zIndex:-1},s=()=>{const[e,t]=Object(n.useState)(""),c=Object(n.useRef)(null),s=Object(n.useRef)(new IntersectionObserver(e=>{e[0].isIntersecting?t("visible"):t(e[0].boundingClientRect.top>0?"below":"above")},{threshold:1}));return Object(n.useLayoutEffect)(()=>{const e=c.current,t=s.current;return e&&t.observe(e),()=>{t.unobserve(e)}},[]),[Object(n.createElement)("div",{"aria-hidden":!0,ref:c,style:o}),e]}},452:function(e,t,c){"use strict";c.r(t);var n=c(119),o=c(374);t.default=Object(n.withFilteredAttributes)({checkoutPageId:{type:"number",default:0},lock:{type:"object",default:{move:!0,remove:!0}}})(o.a)}}]);
|
build/cart-frontend.asset.php
CHANGED
@@ -1 +1 @@
|
|
1 |
-
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => '
|
1 |
+
<?php return array('dependencies' => array('lodash', 'react', 'wc-blocks-checkout', 'wc-blocks-data-store', 'wc-blocks-registry', 'wc-blocks-shared-hocs', 'wc-price-format', 'wc-settings', 'wp-a11y', 'wp-api-fetch', 'wp-autop', 'wp-compose', 'wp-data', 'wp-deprecated', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-is-shallow-equal', 'wp-keycodes', 'wp-plugins', 'wp-polyfill', 'wp-primitives', 'wp-url', 'wp-warning', 'wp-wordcount'), 'version' => '2d8dcb348f3b9aa5c2315e5ca4b43a5c');
|
build/cart-frontend.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
!function(e){function t(t){for(var r,o,s=t[0],a=t[1],i=0,l=[];i<s.length;i++)o=s[i],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&l.push(n[o][0]),n[o]=0;for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r]);for(c&&c(t);l.length;)l.shift()()}var r={},n={11:0,7: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 s=new Promise((function(t,o){r=n[e]=[t,o]}));t.push(r[2]=s);var a,i=document.createElement("script");i.charset="utf-8",i.timeout=120,o.nc&&i.setAttribute("nonce",o.nc),i.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",2:"vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--5b8feb0b",3:"vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542",4:"cart-blocks/cart-line-items--mini-cart-contents-block/products-table",5:"cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping",12:"cart-blocks/cart-accepted-payment-methods",13:"cart-blocks/cart-express-payment",14:"cart-blocks/cart-items",15:"cart-blocks/cart-line-items",16:"cart-blocks/cart-order-summary",17:"cart-blocks/cart-totals",18:"cart-blocks/empty-cart",19:"cart-blocks/filled-cart",20:"cart-blocks/order-summary-coupon-form",21:"cart-blocks/order-summary-discount",22:"cart-blocks/order-summary-fee",23:"cart-blocks/order-summary-heading",24:"cart-blocks/order-summary-shipping",25:"cart-blocks/order-summary-subtotal",26:"cart-blocks/order-summary-taxes",27:"cart-blocks/proceed-to-checkout"}[e]||e)+"-frontend.js?ver="+{0:"1d36f73838f02eb72b0e",1:"cc9016fd3805a088b2e8",2:"2448287d629e9e796e22",3:"80c939d54508b87a9652",4:"95ac706a0a831d9ea7dc",5:"f8bfba42e82e44056456",12:"e901062024d7d4414626",13:"06cc6dd4d09761436a8f",14:"9c2d532cbcd7116e63f7",15:"cc3e5cde5a1a08a8b18b",16:"b2a96ff987849a487201",17:"9b708988d58530ba1664",18:"854b725b2b73c93534b8",19:"e82c38c6edc87e11a0d8",20:"ec110f01f7d73b195692",21:"be118c45e14281292fa3",22:"8b7b8ceb031ca02b9151",23:"c847d86267822f3924b2",24:"84a244ea52b15342b7fc",25:"c686b68469526b776553",26:"2a6298107180c8ef89be",27:"cf1ad6dec2eca25de61e"}[e]}(e);var c=new Error;a=function(t){i.onerror=i.onload=null,clearTimeout(l);var r=n[e];if(0!==r){if(r){var o=t&&("load"===t.type?"missing":t.type),s=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+o+": "+s+")",c.name="ChunkLoadError",c.type=o,c.request=s,r[1](c)}n[e]=void 0}};var l=setTimeout((function(){a({type:"timeout",target:i})}),12e4);i.onerror=i.onload=a,document.head.appendChild(i)}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 s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=s.push.bind(s);s.push=t,s=s.slice();for(var i=0;i<s.length;i++)t(s[i]);var c=a;o(o.s=229)}([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.React},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 s=typeof n;if("string"===s||"number"===s)e.push(n);else if(Array.isArray(n)){if(n.length){var a=o.apply(null,n);a&&e.push(a)}}else if("object"===s)if(n.toString===Object.prototype.toString)for(var i in n)r.call(n,i)&&n[i]&&e.push(i);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.wc.wcBlocksData},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.data},,function(e,t){e.exports=window.wc.blocksCheckout},function(e,t){e.exports=window.wp.compose},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.isShallowEqual},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),s=r(0),a=r(3),i=r(1),c=r(46),l=e=>{let{imageUrl:t=c.l+"/block-error.svg",header:r=Object(i.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(i.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:a=Object(i.__)("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"},r&&Object(s.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(s.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),o&&Object(s.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},a?a+" ":"",o),l&&Object(s.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};r(34);class u extends a.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:r=!0,showErrorBlock:n=!0,text:o,errorMessagePrefix:a,renderError:i,button:c}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof i?i({errorMessage:u}):Object(s.createElement)(l,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:a,button:c}):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";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}},function(e,t){e.exports=window.wp.a11y},function(e,t,r){"use strict";(function(e){var n=r(0);r(36);const o=Object(n.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,r(54))},function(e,t){e.exports=window.wp.deprecated},,,,,function(e,t){e.exports=window.wp.apiFetch},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0);r(8);const o=Object(n.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),s=()=>Object(n.useContext)(o)},,function(e,t,r){"use strict";r.d(t,"c",(function(){return s})),r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return l})),r.d(t,"d",(function(){return d}));var n=r(20);let o,s;!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"}(s||(s={}));const a=(e,t)=>Object(n.a)(e)&&"type"in e&&e.type===t,i=e=>a(e,o.SUCCESS),c=e=>a(e,o.ERROR),l=e=>a(e,o.FAIL),u=e=>!Object(n.a)(e)||void 0===e.retry||!0===e.retry,d=()=>({responseTypes:o,noticeContexts:s,shouldRetry:u,isSuccessResponse:i,isErrorResponse:c,isFailResponse:l})},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),o=r(13),s=r.n(o);function a(e){const t=Object(n.useRef)(e);return s()(e,t.current)||(t.current=e),t.current}},function(e,t,r){"use strict";r.d(t,"a",(function(){return y}));var n=r(4),o=r(0),s=r(6),a=r(8),i=r(18),c=r(117),l=r(29),u=r(69);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(a.dispatch)(s.CART_STORE_KEY).invalidateResolutionForStore()},p=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},f=()=>{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:""},h={...m,email:""},b={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:s.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},g=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,r]=e;return[t,Object(i.decodeEntities)(r)]})),E={cartCoupons:s.EMPTY_CART_COUPONS,cartItems:s.EMPTY_CART_ITEMS,cartFees:s.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:s.EMPTY_CART_ITEM_ERRORS,cartTotals:b,cartIsLoading:!0,cartErrors:s.EMPTY_CART_ERRORS,billingAddress:h,shippingAddress:m,shippingRates:s.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:s.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:s.EMPTY_EXTENSIONS},y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:r}=Object(l.a)(),i=null==r?void 0:r.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();f();const p=Object(a.useSelect)((e,r)=>{let{dispatch:n}=r;if(!u)return E;if(t)return{cartCoupons:i.coupons,cartItems:i.items,cartFees:i.fees,cartItemsCount:i.items_count,cartItemsWeight:i.items_weight,cartNeedsPayment:i.needs_payment,cartNeedsShipping:i.needs_shipping,cartItemErrors:s.EMPTY_CART_ITEM_ERRORS,cartTotals:i.totals,cartIsLoading:!1,cartErrors:s.EMPTY_CART_ERRORS,billingData:h,billingAddress:h,shippingAddress:m,extensions:s.EMPTY_EXTENSIONS,shippingRates:i.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:i.has_calculated_shipping,paymentRequirements:i.paymentRequirements,receiveCart:"function"==typeof(null==i?void 0:i.receiveCart)?i.receiveCart:()=>{}};const o=e(s.CART_STORE_KEY),a=o.getCartData(),l=o.getCartErrors(),d=o.getCartTotals(),p=!o.hasFinishedResolution("getCartData"),f=o.isCustomerDataUpdating(),{receiveCart:b}=n(s.CART_STORE_KEY),y=g(a.billingAddress),v=a.needsShipping?g(a.shippingAddress):y,O=a.fees.length>0?a.fees.map(e=>g(e)):s.EMPTY_CART_FEES;return{cartCoupons:a.coupons.length>0?a.coupons.map(e=>({...e,label:e.code})):s.EMPTY_CART_COUPONS,cartItems:a.items,cartFees:O,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:d,cartIsLoading:p,cartErrors:l,billingData:Object(c.a)(y),billingAddress:Object(c.a)(y),shippingAddress:Object(c.a)(v),extensions:a.extensions,shippingRates:a.shippingRates,isLoadingRates:f,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:b}},[u]);return d.current&&Object(n.isEqual)(d.current,p)||(d.current=p),d.current}},function(e,t){},function(e,t,r){"use strict";r.d(t,"b",(function(){return P})),r.d(t,"a",(function(){return x}));var n=r(0),o=r(1),s=r(60),a=r(23),i=r.n(a),c=r(52),l=r(20),u=r(8);let d;!function(e){e.SET_IDLE="set_idle",e.SET_PRISTINE="set_pristine",e.SET_REDIRECT_URL="set_redirect_url",e.SET_COMPLETE="set_checkout_complete",e.SET_BEFORE_PROCESSING="set_before_processing",e.SET_AFTER_PROCESSING="set_after_processing",e.SET_PROCESSING_RESPONSE="set_processing_response",e.SET_PROCESSING="set_checkout_is_processing",e.SET_HAS_ERROR="set_checkout_has_error",e.SET_NO_ERROR="set_checkout_no_error",e.SET_CUSTOMER_ID="set_checkout_customer_id",e.SET_ORDER_ID="set_checkout_order_id",e.SET_ORDER_NOTES="set_checkout_order_notes",e.INCREMENT_CALCULATING="increment_calculating",e.DECREMENT_CALCULATING="decrement_calculating",e.SET_SHIPPING_ADDRESS_AS_BILLING_ADDRESS="set_shipping_address_as_billing_address",e.SET_SHOULD_CREATE_ACCOUNT="set_should_create_account",e.SET_EXTENSION_DATA="set_extension_data"}(d||(d={}));const p=()=>({type:d.SET_IDLE}),f=e=>({type:d.SET_REDIRECT_URL,redirectUrl:e}),m=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:d.SET_COMPLETE,data:e}},h=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return{type:e?d.SET_HAS_ERROR:d.SET_NO_ERROR}};var b=r(2),g=r(117);let E;!function(e){e.PRISTINE="pristine",e.IDLE="idle",e.PROCESSING="processing",e.COMPLETE="complete",e.BEFORE_PROCESSING="before_processing",e.AFTER_PROCESSING="after_processing"}(E||(E={}));const y={order_id:0,customer_id:0,billing_address:{},shipping_address:{},...Object(b.getSetting)("checkoutData",{})||{}},v={redirectUrl:"",status:E.PRISTINE,hasError:!1,calculatingCount:0,orderId:y.order_id,orderNotes:"",customerId:y.customer_id,useShippingAsBilling:Object(g.b)(y.billing_address,y.shipping_address),shouldCreateAccount:!1,processingResponse:null,extensionData:{}},O=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v,{redirectUrl:t,type:r,customerId:n,orderId:o,orderNotes:s,extensionData:a,useShippingAsBilling:i,shouldCreateAccount:c,data:l}=arguments.length>1?arguments[1]:void 0,u=e;switch(r){case d.SET_PRISTINE:u=v;break;case d.SET_IDLE:u=e.status!==E.IDLE?{...e,status:E.IDLE}:e;break;case d.SET_REDIRECT_URL:u=void 0!==t&&t!==e.redirectUrl?{...e,redirectUrl:t}:e;break;case d.SET_PROCESSING_RESPONSE:u={...e,processingResponse:l};break;case d.SET_COMPLETE:u=e.status!==E.COMPLETE?{...e,status:E.COMPLETE,redirectUrl:"string"==typeof(null==l?void 0:l.redirectUrl)?l.redirectUrl:e.redirectUrl}:e;break;case d.SET_PROCESSING:u=e.status!==E.PROCESSING?{...e,status:E.PROCESSING,hasError:!1}:e,u=!1===u.hasError?u:{...u,hasError:!1};break;case d.SET_BEFORE_PROCESSING:u=e.status!==E.BEFORE_PROCESSING?{...e,status:E.BEFORE_PROCESSING,hasError:!1}:e;break;case d.SET_AFTER_PROCESSING:u=e.status!==E.AFTER_PROCESSING?{...e,status:E.AFTER_PROCESSING}:e;break;case d.SET_HAS_ERROR:u=e.hasError?e:{...e,hasError:!0},u=e.status===E.PROCESSING||e.status===E.BEFORE_PROCESSING?{...u,status:E.IDLE}:u;break;case d.SET_NO_ERROR:u=e.hasError?{...e,hasError:!1}:e;break;case d.INCREMENT_CALCULATING:u={...e,calculatingCount:e.calculatingCount+1};break;case d.DECREMENT_CALCULATING:u={...e,calculatingCount:Math.max(0,e.calculatingCount-1)};break;case d.SET_CUSTOMER_ID:u=void 0!==n?{...e,customerId:n}:e;break;case d.SET_ORDER_ID:u=void 0!==o?{...e,orderId:o}:e;break;case d.SET_SHIPPING_ADDRESS_AS_BILLING_ADDRESS:void 0!==i&&i!==e.useShippingAsBilling&&(u={...e,useShippingAsBilling:i});break;case d.SET_SHOULD_CREATE_ACCOUNT:void 0!==c&&c!==e.shouldCreateAccount&&(u={...e,shouldCreateAccount:c});break;case d.SET_ORDER_NOTES:void 0!==s&&e.orderNotes!==s&&(u={...e,orderNotes:s});break;case d.SET_EXTENSION_DATA:void 0!==a&&e.extensionData!==a&&(u={...e,extensionData:a})}return u!==e&&r!==d.SET_PRISTINE&&u.status===E.PRISTINE&&(u.status=E.IDLE),u};var _=r(18),S=r(93),k=r(201);var w=r(203),j=r(198),R=r(58),C=r(31),T=r(79);const A=Object(n.createContext)({dispatchActions:{resetCheckout:()=>{},setRedirectUrl:e=>{},setHasError:e=>{},setAfterProcessing:e=>{},incrementCalculating:()=>{},decrementCalculating:()=>{},setCustomerId:e=>{},setOrderId:e=>{},setOrderNotes:e=>{},setExtensionData:e=>{}},onSubmit:()=>{},isComplete:!1,isIdle:!1,isCalculating:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,redirectUrl:"",orderId:0,orderNotes:"",customerId:0,onCheckoutAfterProcessingWithSuccess:()=>()=>{},onCheckoutAfterProcessingWithError:()=>()=>{},onCheckoutBeforeProcessing:()=>()=>{},onCheckoutValidationBeforeProcessing:()=>()=>{},hasOrder:!1,isCart:!1,useShippingAsBilling:!1,setUseShippingAsBilling:e=>{},shouldCreateAccount:!1,setShouldCreateAccount:e=>{},extensionData:{}}),P=()=>Object(n.useContext)(A),x=e=>{let{children:t,redirectUrl:r,isCart:a=!1}=e;v.redirectUrl=r;const[b,g]=Object(n.useReducer)(O,v),{setValidationErrors:y}=Object(j.b)(),{createErrorNotice:P}=Object(u.useDispatch)("core/notices"),{dispatchCheckoutEvent:x}=Object(R.a)(),M=b.calculatingCount>0,{isSuccessResponse:N,isErrorResponse:I,isFailResponse:D,shouldRetry:L}=Object(C.d)(),{checkoutNotices:F,paymentNotices:V,expressPaymentNotices:B}=(()=>{const{noticeContexts:e}=Object(C.d)();return{checkoutNotices:Object(u.useSelect)(e=>e("core/notices").getNotices("wc/checkout"),[]),expressPaymentNotices:Object(u.useSelect)(t=>t("core/notices").getNotices(e.EXPRESS_PAYMENTS),[e.EXPRESS_PAYMENTS]),paymentNotices:Object(u.useSelect)(t=>t("core/notices").getNotices(e.PAYMENTS),[e.PAYMENTS])}})(),[U,H]=Object(n.useReducer)(S.b,{}),G=Object(n.useRef)(U),{onCheckoutAfterProcessingWithSuccess:Y,onCheckoutAfterProcessingWithError:z,onCheckoutValidationBeforeProcessing:q}=(e=>Object(n.useMemo)(()=>({onCheckoutAfterProcessingWithSuccess:Object(k.a)("checkout_after_processing_with_success",e),onCheckoutAfterProcessingWithError:Object(k.a)("checkout_after_processing_with_error",e),onCheckoutValidationBeforeProcessing:Object(k.a)("checkout_validation_before_processing",e)}),[e]))(H);Object(n.useEffect)(()=>{G.current=U},[U]);const W=Object(n.useMemo)(()=>function(){return i()("onCheckoutBeforeProcessing",{alternative:"onCheckoutValidationBeforeProcessing",plugin:"WooCommerce Blocks"}),q(...arguments)},[q]),X=Object(n.useMemo)(()=>({resetCheckout:()=>{g({type:d.SET_PRISTINE})},setRedirectUrl:e=>{g(f(e))},setHasError:e=>{g(h(e))},incrementCalculating:()=>{g({type:d.INCREMENT_CALCULATING})},decrementCalculating:()=>{g({type:d.DECREMENT_CALCULATING})},setCustomerId:e=>{var t;g((t=e,{type:d.SET_CUSTOMER_ID,customerId:t}))},setOrderId:e=>{g((e=>({type:d.SET_ORDER_ID,orderId:e}))(e))},setOrderNotes:e=>{g((e=>({type:d.SET_ORDER_NOTES,orderNotes:e}))(e))},setExtensionData:e=>{g((e=>({type:d.SET_EXTENSION_DATA,extensionData:e}))(e))},setAfterProcessing:e=>{const t=(e=>{const t={message:"",paymentStatus:"",redirectUrl:"",paymentDetails:{}};return"payment_result"in e&&(t.paymentStatus=e.payment_result.payment_status,t.redirectUrl=e.payment_result.redirect_url,e.payment_result.hasOwnProperty("payment_details")&&Array.isArray(e.payment_result.payment_details)&&e.payment_result.payment_details.forEach(e=>{let{key:r,value:n}=e;t.paymentDetails[r]=Object(_.decodeEntities)(n)})),"message"in e&&(t.message=Object(_.decodeEntities)(e.message)),!t.message&&"data"in e&&"status"in e.data&&e.data.status>299&&(t.message=Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")),t})(e);var r;g(f((null==t?void 0:t.redirectUrl)||"")),g((r=t,{type:d.SET_PROCESSING_RESPONSE,data:r})),g({type:d.SET_AFTER_PROCESSING})}}),[]);Object(n.useEffect)(()=>{b.status===E.BEFORE_PROCESSING&&(Object(T.b)("error"),Object(w.a)(G.current,"checkout_validation_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:r}=e;P(t,{context:"wc/checkout"}),y(r)}),g(p()),g(h())):g({type:d.SET_PROCESSING})}))},[b.status,y,P,g]);const K=Object(s.a)(b.status),$=Object(s.a)(b.hasError);Object(n.useEffect)(()=>{if((b.status!==K||b.hasError!==$)&&b.status===E.AFTER_PROCESSING){const e={redirectUrl:b.redirectUrl,orderId:b.orderId,customerId:b.customerId,orderNotes:b.orderNotes,processingResponse:b.processingResponse};b.hasError?Object(w.b)(G.current,"checkout_after_processing_with_error",e).then(t=>{const r=(e=>{let t=null;return e.forEach(e=>{if((I(e)||D(e))&&e.message&&Object(c.a)(e.message)){const r=e.messageContext&&Object(c.a)(e.messageContent)?{context:e.messageContext}:void 0;t=e,P(e.message,r)}}),t})(t);if(null!==r)L(r)?g(p()):g(m(r));else{if(!(F.some(e=>"error"===e.status)||B.some(e=>"error"===e.status)||V.some(e=>"error"===e.status))){var n;const t=(null===(n=e.processingResponse)||void 0===n?void 0:n.message)||Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");P(t,{id:"checkout",context:"wc/checkout"})}g(p())}}):Object(w.b)(G.current,"checkout_after_processing_with_success",e).then(e=>{let t=null,r=null;if(e.forEach(e=>{N(e)&&(t=e),(I(e)||D(e))&&(r=e)}),t&&!r)g(m(t));else if(Object(l.a)(r)){if(r.message&&Object(c.a)(r.message)){const e=r.messageContext&&Object(c.a)(r.messageContext)?{context:r.messageContext}:void 0;P(r.message,e)}L(r)?g(h(!0)):g(m(r))}else g(m())})}},[b.status,b.hasError,b.redirectUrl,b.orderId,b.customerId,b.orderNotes,b.processingResponse,K,$,X,P,I,D,N,L,F,B,V]);const J={onSubmit:Object(n.useCallback)(()=>{x("submit"),g({type:d.SET_BEFORE_PROCESSING})},[x]),isComplete:b.status===E.COMPLETE,isIdle:b.status===E.IDLE,isCalculating:M,isProcessing:b.status===E.PROCESSING,isBeforeProcessing:b.status===E.BEFORE_PROCESSING,isAfterProcessing:b.status===E.AFTER_PROCESSING,hasError:b.hasError,redirectUrl:b.redirectUrl,onCheckoutBeforeProcessing:W,onCheckoutValidationBeforeProcessing:q,onCheckoutAfterProcessingWithSuccess:Y,onCheckoutAfterProcessingWithError:z,dispatchActions:X,isCart:a,orderId:b.orderId,hasOrder:!!b.orderId,customerId:b.customerId,orderNotes:b.orderNotes,useShippingAsBilling:b.useShippingAsBilling,setUseShippingAsBilling:e=>{return g((t=e,{type:d.SET_SHIPPING_ADDRESS_AS_BILLING_ADDRESS,useShippingAsBilling:t}));var t},shouldCreateAccount:b.shouldCreateAccount,setShouldCreateAccount:e=>{return g((t=e,{type:d.SET_SHOULD_CREATE_ACCOUNT,shouldCreateAccount:t}));var t},extensionData:b.extensionData};return Object(n.createElement)(A.Provider,{value:J},t)}},function(e,t){e.exports=window.wp.warning},function(e,t,r){"use strict";var n=r(7),o=r(0),s=r(14),a=function({icon:e,className:t,...r}){const s=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(n.a)({className:s},r))};t.a=function({icon:e=null,size:t=24,...r}){if("string"==typeof e)return Object(o.createElement)(a,Object(n.a)({icon:e},r));if(Object(o.isValidElement)(e)&&a===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===s.SVG)){const n={width:t,height:t,...e.props,...r};return Object(o.createElement)(s.SVG,n)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...r}):e}},function(e,t,r){"use strict";var n=r(5),o=r.n(n),s=r(0);t.a=Object(s.forwardRef)((function({as:e="div",className:t,...r},n){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),...r,ref:n})}))},,,function(e,t){e.exports=window.wc.priceFormat},function(e,t){e.exports=window.wp.hooks},function(e,t,r){"use strict";var n=r(7),o=r(0),s=r(5),a=r.n(s),i=r(4),c=r(23),l=r.n(c),u=r(11),d=r(44),p=r(70),f=r(1);function m(e,t,r){const{defaultView:n}=t,{frameElement:o}=n;if(!o||t===r.ownerDocument)return e;const s=o.getBoundingClientRect();return new n.DOMRect(e.left+s.left,e.top+s.top,e.width,e.height)}let h=0;function b(e){const t=document.scrollingElement||document.body;e&&(h=t.scrollTop);const r=e?"add":"remove";t.classList[r]("lockscroll"),document.documentElement.classList[r]("lockscroll"),e||(t.scrollTop=h)}let g=0;function E(){return Object(o.useEffect)(()=>(0===g&&b(!0),++g,()=>{1===g&&b(!1),--g}),[]),null}var y=r(22);function v(e){const t=Object(o.useContext)(y.a),r=t.slots[e]||{},n=t.fills[e],s=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:s,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 O=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function _({name:e,children:t,registerFill:r,unregisterFill:n}){const s=(e=>{const{getSlot:t,subscribe:r}=Object(o.useContext)(O),[n,s]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(s(t(e)),r(()=>{s(t(e))})),[e]),n})(e),a=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(r(e,a.current),()=>n(e,a.current)),[]),Object(o.useLayoutEffect)(()=>{a.current.children=t,s&&s.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==a.current.name&&(n(a.current.name,a.current),a.current.name=e,r(e,a.current))},[e]),s&&s.node?(Object(i.isFunction)(t)&&(t=t(s.props.fillProps)),Object(o.createPortal)(t,s.node)):null}var S=e=>Object(o.createElement)(O.Consumer,null,({registerFill:t,unregisterFill:r})=>Object(o.createElement)(_,Object(n.a)({},e,{registerFill:t,unregisterFill:r})));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: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,s=Object(i.map)(n(t,this),e=>{const t=Object(i.isFunction)(e.children)?e.children(r):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(i.isString)(e))return e;const r=e.key||t;return Object(o.cloneElement)(e,{key:r})})}).filter(Object(i.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(i.isFunction)(e)?e(s):s)}}var w=e=>Object(o.createElement)(O.Consumer,null,({registerSlot:t,unregisterSlot:r,getFills:s})=>Object(o.createElement)(k,Object(n.a)({},e,{registerSlot:t,unregisterSlot:r,getFills:s})));function j(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function R({name:e,children:t}){const r=v(e),n=Object(o.useRef)({rerender:j()});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",...s},a){const i=Object(o.useContext)(y.a),c=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(i.registerSlot(e,c,t),()=>{i.unregisterSlot(e,c)}),[i.registerSlot,i.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{i.updateSlot(e,t)}),Object(o.createElement)(r,Object(n.a)({ref:Object(u.useMergeRefs)([a,c])},s))}));function T(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(S,e),Object(o.createElement)(R,e))}r(13),o.Component;const A=Object(o.forwardRef)(({bubblesVirtually:e,...t},r)=>e?Object(o.createElement)(C,Object(n.a)({},t,{ref:r})):Object(o.createElement)(w,t));function P(e){return"appear"===e?"top":"left"}function x(e,t){const{paddingTop:r,paddingBottom:n,paddingLeft:o,paddingRight:s}=(a=t).ownerDocument.defaultView.getComputedStyle(a);var a;const i=r?parseInt(r,10):0,c=n?parseInt(n,10):0,l=o?parseInt(o,10):0,u=s?parseInt(s,10):0;return{x:e.left+l,y:e.top+i,width:e.width-l-u,height:e.height-i-c,left:e.left+l,right:e.right-u,top:e.top+i,bottom:e.bottom-c}}function M(e,t,r){r?e.getAttribute(t)!==r&&e.setAttribute(t,r):e.hasAttribute(t)&&e.removeAttribute(t)}function N(e,t,r=""){e.style[t]!==r&&(e.style[t]=r)}function I(e,t,r){r?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const D=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:r,className:s,noArrow:i=!0,isAlternate:c,position:h="bottom right",range:b,focusOnMount:g="firstElement",anchorRef:y,shouldAnchorIncludePadding:O,anchorRect:_,getAnchorRect:S,expandOnMobile:k,animate:w=!0,onClickOutside:j,onFocusOutside:R,__unstableStickyBoundaryElement:C,__unstableSlotName:A="Popover",__unstableObserveElement:D,__unstableBoundaryParent:L,__unstableForcePosition:F,__unstableForceXAlignment:V,...B},U)=>{const H=Object(o.useRef)(null),G=Object(o.useRef)(null),Y=Object(o.useRef)(),z=Object(u.useViewportMatch)("medium","<"),[q,X]=Object(o.useState)(),K=v(A),$=k&&z,[J,Q]=Object(u.useResizeObserver)();i=$||i,Object(o.useLayoutEffect)(()=>{if($)return I(Y.current,"is-without-arrow",i),I(Y.current,"is-alternate",c),M(Y.current,"data-x-axis"),M(Y.current,"data-y-axis"),N(Y.current,"top"),N(Y.current,"left"),N(G.current,"maxHeight"),void N(G.current,"maxWidth");const e=()=>{if(!Y.current||!G.current)return;let e=function(e,t,r,n=!1,o,s){if(t)return t;if(r){if(!e.current)return;const t=r(e.current);return m(t,t.ownerDocument||e.current.ownerDocument,s)}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,s);if("function"==typeof(null==n?void 0:n.getBoundingClientRect)){const e=m(n.getBoundingClientRect(),n.ownerDocument,s);return o?e:x(e,n)}const{top:e,bottom:t}=n,r=e.getBoundingClientRect(),a=t.getBoundingClientRect(),i=m(new window.DOMRect(r.left,r.top,r.width,a.bottom-r.top),e.ownerDocument,s);return o?i:x(i,n)}if(!e.current)return;const{parentNode:a}=e.current,i=a.getBoundingClientRect();return o?i:x(i,a)}(H,_,S,y,O,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 s;L&&(n=null===(s=Y.current.closest(".popover-slot"))||void 0===s?void 0:s.parentNode);const a=Q.height?Q:G.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:p,yAxis:b,contentHeight:g,contentWidth:E}=function(e,t,r="top",n,o,s,a,i,c){const[l,u="center",d]=r.split(" "),p=function(e,t,r,n,o,s,a,i){const{height:c}=t;if(o){const t=o.getBoundingClientRect().top+c-a;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-c/2>0?c/2:l)+(l+c/2>window.innerHeight?window.innerHeight-l:c/2)},d={popoverTop:e.top,contentHeight:e.top-10-c>0?c:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+c>window.innerHeight?window.innerHeight-10-e.bottom:c};let f,m=r,h=null;if(!o&&!i)if("middle"===r&&u.contentHeight===c)m="middle";else if("top"===r&&d.contentHeight===c)m="top";else if("bottom"===r&&p.contentHeight===c)m="bottom";else{m=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===m?d.contentHeight:p.contentHeight;h=e!==c?e:null}return f="middle"===m?u.popoverTop:"top"===m?d.popoverTop:p.popoverTop,{yAxis:m,popoverTop:f,contentHeight:h}}(e,t,l,d,n,0,s,i);return{...function(e,t,r,n,o,s,a,i,c){const{width:l}=t;"left"===r&&Object(f.isRTL)()?r="right":"right"===r&&Object(f.isRTL)()&&(r="left"),"left"===n&&Object(f.isRTL)()?n="right":"right"===n&&Object(f.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"===s||c||(p=u);let m=e.right;"left"===n?m=e.left:"middle"===s||c||(m=u);const h={popoverLeft:p,contentWidth:p-l>0?l:p},b={popoverLeft:m,contentWidth:m+l>window.innerWidth?window.innerWidth-m:l};let g,E=r,y=null;if(!o&&!i)if("center"===r&&d.contentWidth===l)E="center";else if("left"===r&&h.contentWidth===l)E="left";else if("right"===r&&b.contentWidth===l)E="right";else{E=h.contentWidth>b.contentWidth?"left":"right";const e="left"===E?h.contentWidth:b.contentWidth;l>window.innerWidth&&(y=window.innerWidth),e!==l&&(E="center",d.popoverLeft=window.innerWidth/2)}if(g="center"===E?d.popoverLeft:"left"===E?h.popoverLeft:b.popoverLeft,a){const e=a.getBoundingClientRect();g=Math.min(g,e.right-l),Object(f.isRTL)()||(g=Math.max(g,0))}return{xAxis:E,popoverLeft:g,contentWidth:y}}(e,t,u,d,n,p.yAxis,a,i,c),...p}}(e,a,h,C,Y.current,o,n,F,V);"number"==typeof l&&"number"==typeof u&&(N(Y.current,"top",l+"px"),N(Y.current,"left",u+"px")),I(Y.current,"is-without-arrow",i||"center"===p&&"middle"===b),I(Y.current,"is-alternate",c),M(Y.current,"data-x-axis",p),M(Y.current,"data-y-axis",b),N(G.current,"maxHeight","number"==typeof g?g+"px":""),N(G.current,"maxWidth","number"==typeof E?E+"px":""),X(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[b]||"middle"))};e();const{ownerDocument:t}=Y.current,{defaultView:r}=t,n=r.setInterval(e,500);let o;const s=()=>{r.cancelAnimationFrame(o),o=r.requestAnimationFrame(e)};r.addEventListener("click",s),r.addEventListener("resize",e),r.addEventListener("scroll",e,!0);const a=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(y);let l;return a&&a!==t&&(a.defaultView.addEventListener("resize",e),a.defaultView.addEventListener("scroll",e,!0)),D&&(l=new r.MutationObserver(e),l.observe(D,{attributes:!0})),()=>{r.clearInterval(n),r.removeEventListener("resize",e),r.removeEventListener("scroll",e,!0),r.removeEventListener("click",s),r.cancelAnimationFrame(o),a&&a!==t&&(a.defaultView.removeEventListener("resize",e),a.defaultView.removeEventListener("scroll",e,!0)),l&&l.disconnect()}},[$,_,S,y,O,h,Q,C,D,L]);const Z=(e,r)=>{if("focus-outside"===e&&R)R(r);else if("focus-outside"===e&&j){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>r.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),j(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:g,__unstableOnClose:Z,onClose:Z}),re=Object(u.useMergeRefs)([Y,ee,U]),ne=Boolean(w&&q)&&function(e){if("loading"===e.type)return a()("components-animate__loading");const{type:t,origin:r=P(t)}=e;if("appear"===t){const[e,t="center"]=r.split(" ");return a()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?a()("components-animate__slide-in","is-from-"+r):void 0}({type:"appear",origin:q});let oe=Object(o.createElement)("div",Object(n.a)({className:a()("components-popover",s,ne,{"is-expanded":$,"is-without-arrow":i,"is-alternate":c})},B,{ref:re},te,{tabIndex:"-1"}),$&&Object(o.createElement)(E,null),$&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(W,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:G,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},J,r)));return K.ref&&(oe=Object(o.createElement)(T,{name:A},oe)),y||_?oe:Object(o.createElement)("span",{ref:H},oe)});D.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(A,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var L=D,F=function({shortcut:e,className:t}){if(!e)return null;let r,n;return Object(i.isString)(e)&&(r=e),Object(i.isObject)(e)&&(r=e.display,n=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":n},r)};const V=Object(o.createElement)("div",{className:"event-catcher"}),B=({eventHandlers:e,child:t,childrenWithPopover:r})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(V,e),Object(o.cloneElement)(t,{children:r}),","),e),U=({child:e,eventHandlers:t,childrenWithPopover:r})=>Object(o.cloneElement)(e,{...t,children:r}),H=(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 G=function({children:e,position:t,text:r,shortcut:n}){const[s,a]=Object(o.useState)(!1),[c,l]=Object(o.useState)(!1),d=Object(u.useDebounce)(l,700),p=t=>{H(e,"onMouseDown",t),document.addEventListener("mouseup",h),a(!0)},f=t=>{H(e,"onMouseUp",t),document.removeEventListener("mouseup",h),a(!1)},m=e=>"mouseUp"===e?f:"mouseDown"===e?p:void 0,h=m("mouseUp"),b=(t,r)=>n=>{if(H(e,t,n),n.currentTarget.disabled)return;if("focus"===n.type&&s)return;d.cancel();const o=Object(i.includes)(["focus","mouseenter"],n.type);o!==c&&(r?d(o):l(o))},g=()=>{d.cancel(),document.removeEventListener("mouseup",h)};if(Object(o.useEffect)(()=>g,[]),1!==o.Children.count(e))return e;const E={onMouseEnter:b("onMouseEnter",!0),onMouseLeave:b("onMouseLeave"),onClick:b("onClick"),onFocus:b("onFocus"),onBlur:b("onBlur"),onMouseDown:m("mouseDown")},y=o.Children.only(e),{children:v,disabled:O}=y.props;return(O?B:U)({child:y,eventHandlers:E,childrenWithPopover:(({grandchildren:e,isOver:t,position:r,text:n,shortcut:s})=>Object(o.concatChildren)(e,t&&Object(o.createElement)(L,{focusOnMount:!1,position:r,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},n,Object(o.createElement)(F,{className:"components-tooltip__shortcut",shortcut:s}))))({grandchildren:v,isOver:c,position:t,text:r,shortcut:n})})},Y=r(37),z=r(38);const q=["onMouseDown","onClick"];var W=t.a=Object(o.forwardRef)((function(e,t){const{href:r,target:s,isSmall:c,isPressed:u,isBusy:d,isDestructive:p,className:f,disabled:m,icon:h,iconPosition:b="left",iconSize:g,showTooltip:E,tooltipPosition:y,shortcut:v,label:O,children:_,text:S,variant:k,__experimentalIsFocusable:w,describedBy:j,...R}=function({isDefault:e,isPrimary:t,isSecondary:r,isTertiary:n,isLink:o,variant:s,...a}){let i=s;var c,u,d,p,f;return t&&(null!==(c=i)&&void 0!==c||(i="primary")),n&&(null!==(u=i)&&void 0!==u||(i="tertiary")),r&&(null!==(d=i)&&void 0!==d||(i="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=i)&&void 0!==p||(i="secondary")),o&&(null!==(f=i)&&void 0!==f||(i="link")),{...a,variant:i}}(e),C=a()("components-button",f,{"is-secondary":"secondary"===k,"is-primary":"primary"===k,"is-small":c,"is-tertiary":"tertiary"===k,"is-pressed":u,"is-busy":d,"is-link":"link"===k,"is-destructive":p,"has-text":!!h&&!!_,"has-icon":!!h}),T=m&&!w,A=void 0===r||T?"button":"a",P="a"===A?{href:r,target:s}:{type:"button",disabled:T,"aria-pressed":u};if(m&&w){P["aria-disabled"]=!0;for(const e of q)R[e]=e=>{e.stopPropagation(),e.preventDefault()}}const x=!T&&(E&&O||v||!!O&&(!_||Object(i.isArray)(_)&&!_.length)&&!1!==E),M=j?Object(i.uniqueId)():null,N=R["aria-describedby"]||M,I=Object(o.createElement)(A,Object(n.a)({},P,R,{className:C,"aria-label":R["aria-label"]||O,"aria-describedby":N,ref:t}),h&&"left"===b&&Object(o.createElement)(Y.a,{icon:h,size:g}),S&&Object(o.createElement)(o.Fragment,null,S),h&&"right"===b&&Object(o.createElement)(Y.a,{icon:h,size:g}),_);return x?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(G,{text:j||O,shortcut:v,position:y},I),j&&Object(o.createElement)(z.a,null,Object(o.createElement)("span",{id:M},j))):Object(o.createElement)(o.Fragment,null,I,j&&Object(o.createElement)(z.a,null,Object(o.createElement)("span",{id:M},j)))}))},function(e,t){e.exports=window.wp.dom},,function(e,t,r){"use strict";r.d(t,"n",(function(){return s})),r.d(t,"l",(function(){return a})),r.d(t,"k",(function(){return i})),r.d(t,"m",(function(){return c})),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 f})),r.d(t,"e",(function(){return m})),r.d(t,"g",(function(){return h})),r.d(t,"a",(function(){return b})),r.d(t,"h",(function(){return g})),r.d(t,"b",(function(){return E}));var n,o=r(2);const s=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=s.pluginUrl+"images/",i=s.pluginUrl+"build/",c=s.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),f=(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"),h=Object(o.getSetting)("shippingCountries",{}),b=Object(o.getSetting)("allowedCountries",{}),g=Object(o.getSetting)("shippingStates",{}),E=Object(o.getSetting)("allowedStates",{})},function(e,t,r){"use strict";var n=r(2),o=r(1),s=r(71),a=r(52);const i=Object(n.getSetting)("countryLocale",{}),c=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(s.a)(e.priority)&&(t.index=e.priority),Object(a.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},l=Object.entries(i).map(e=>{let[t,r]=e;return[t,Object.entries(r).map(e=>{let[t,r]=e;return[t,c(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,"b",(function(){return a})),r.d(t,"a",(function(){return i}));var n=r(0),o=r(66);const s=Object(n.createContext)({isInitialized:!1,billingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",email:"",phone:""},shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},setBillingAddress:()=>{},setShippingAddress:()=>{}}),a=()=>Object(n.useContext)(s),i=e=>{let{children:t}=e;const r=Object(o.a)();return Object(n.createElement)(s.Provider,{value:r},t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(3);function o(e,t,r){var o=this,s=Object(n.useRef)(null),a=Object(n.useRef)(0),i=Object(n.useRef)(null),c=Object(n.useRef)([]),l=Object(n.useRef)(),u=Object(n.useRef)(),d=Object(n.useRef)(e),p=Object(n.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 m=!!(r=r||{}).leading,h=!("trailing"in r)||!!r.trailing,b="maxWait"in r,g=b?Math.max(+r.maxWait||0,t):null;return Object(n.useEffect)((function(){return p.current=!0,function(){p.current=!1}}),[]),Object(n.useMemo)((function(){var e=function(e){var t=c.current,r=l.current;return c.current=l.current=null,a.current=e,u.current=d.current.apply(r,t)},r=function(e,t){f&&cancelAnimationFrame(i.current),i.current=f?requestAnimationFrame(e):setTimeout(e,t)},n=function(e){if(!p.current)return!1;var r=e-s.current,n=e-a.current;return!s.current||r>=t||r<0||b&&n>=g},E=function(t){return i.current=null,h&&c.current?e(t):(c.current=l.current=null,u.current)},y=function(){var e=Date.now();if(n(e))return E(e);if(p.current){var o=e-s.current,i=e-a.current,c=t-o,l=b?Math.min(c,g-i):c;r(y,l)}},v=function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];var h=Date.now(),g=n(h);if(c.current=d,l.current=o,s.current=h,g){if(!i.current&&p.current)return a.current=s.current,r(y,t),m?e(s.current):u.current;if(b)return r(y,t),e(s.current)}return i.current||r(y,t),u.current};return v.cancel=function(){i.current&&(f?cancelAnimationFrame(i.current):clearTimeout(i.current)),a.current=0,c.current=s.current=l.current=i.current=null},v.isPending=function(){return!!i.current},v.flush=function(){return i.current?E(Date.now()):u.current},v}),[m,b,t,g,h,f])}},function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(12),o=r.n(n),s=r(0),a=r(16);const i=[".wp-block-woocommerce-cart"],c=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:i=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const c=n(e,r),l=i(e,r),u={...e.dataset,...c.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:i={},errorBoundaryProps:c={}}=e;Object(s.render)(Object(s.createElement)(a.a,c,Object(s.createElement)(s.Suspense,{fallback:Object(s.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(s.createElement)(t,o()({},i,{attributes:n})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:c,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(i.join(",")),{Block:r,getProps:n,getErrorBoundaryProps:o,selector:s}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrappers:s}=e;const a=document.body.querySelectorAll(o);s&&s.length>0&&Array.prototype.filter.call(a,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,s)),c({Block:t,containers:a,getProps:r,getErrorBoundaryProps:n})})({Block:r,getProps:n,getErrorBoundaryProps:o,selector:s,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:s}=e;const a=s.querySelectorAll(o);c({Block:t,containers:a,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},,function(e,t){var r,n,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function i(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!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:s}catch(e){r=s}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var c,l=[],u=!1,d=-1;function p(){u&&c&&(u=!1,c.length?l=c.concat(l):d=-1,l.length&&f())}function f(){if(!u){var e=i(p);u=!0;for(var t=l.length;t;){for(c=l,l=[];++d<t;)c&&c[d].run();d=-1,t=l.length}c=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!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 h(){}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||i(f)},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=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}},function(e,t,r){var n=r(82),o=r(56),s=o.setStyleProp,a=n.html,i=n.svg,c=n.isCustomAttribute,l=Object.prototype.hasOwnProperty;e.exports=function(e){var t,r,n,u;e=e||{};var d={};for(t in e)n=e[t],c(t)?d[t]=n:(r=t.toLowerCase(),l.call(a,r)?d[(u=a[r]).propertyName]=!!(u.hasBooleanValue||u.hasOverloadedBooleanValue&&!n)||n:l.call(i,t)?d[(u=i[t]).propertyName]=n:o.PRESERVE_CUSTOM_ATTRIBUTES&&(d[t]=n));return s(e.style,d),d}},function(e,t,r){var n=r(3),o=r(86).default,s={reactCompat:!0},a=n.version.split(".")[0]>=16;e.exports={PRESERVE_CUSTOM_ATTRIBUTES:a,invertObject:function(e,t){if(!e||"object"!=typeof e)throw new TypeError("First argument must be an object");var r,n,o="function"==typeof t,s={},a={};for(r in e)n=e[r],o&&(s=t(r,n))&&2===s.length?a[s[0]]=s[1]:"string"==typeof n&&(a[n]=r);return a},isCustomComponent:function(e,t){if(-1===e.indexOf("-"))return t&&"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}},setStyleProp:function(e,t){null!=e&&(t.style=o(e,s))}}},function(e,t,r){for(var n,o=r(92).CASE_SENSITIVE_TAG_NAMES,s={},a=0,i=o.length;a<i;a++)n=o[a],s[n.toLowerCase()]=n;function c(e){for(var t,r={},n=0,o=e.length;n<o;n++)r[(t=e[n]).name]=t.value;return r}function l(e){return function(e){return s[e]}(e=e.toLowerCase())||e}e.exports={formatAttributes:c,formatDOM:function e(t,r,n){r=r||null;for(var o,s,a,i=[],u=0,d=t.length;u<d;u++){switch(o=t[u],a={next:null,prev:i[u-1]||null,parent:r},(s=i[u-1])&&(s.next=a),"#"!==o.nodeName[0]&&(a.name=l(o.nodeName),a.attribs={},o.attributes&&o.attributes.length&&(a.attribs=c(o.attributes))),o.nodeType){case 1:"script"===a.name||"style"===a.name?a.type=a.name:a.type="tag",a.children=e(o.childNodes,a);break;case 3:a.type="text",a.data=o.nodeValue;break;case 8:a.type="comment",a.data=o.nodeValue}i.push(a)}return n&&(i.unshift({name:n.substring(0,n.indexOf(" ")).toLowerCase(),data:n,type:"directive",next:i[0]?i[0]:null,prev:null,parent:r}),i[1]&&(i[1].prev=i[0])),i},isIE:function(e){return e?document.documentMode===e:/(MSIE |Trident\/|Edge\/)/.test(navigator.userAgent)}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(42),o=r(0),s=r(33);const a=()=>{const e=Object(s.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 s})),r.d(t,"a",(function(){return a}));var n=r(0);const o=Object(n.createContext)({setIsSuppressed:e=>{},isSuppressed:!1}),s=()=>Object(n.useContext)(o),a=e=>{let{children:t}=e;const[r,s]=Object(n.useState)(!1),a={setIsSuppressed:s,isSuppressed:r};return Object(n.createElement)(o.Provider,{value:a},t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(3);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){var n=r(81),o=r(55),s=r(90),a={decodeEntities:!0,lowerCaseAttributeNames:!1};function i(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");return""===e?[]:n(s(e,(t=t||{}).htmlparser2||a),t)}i.domToReact=n,i.htmlToDOM=s,i.attributesToProps=o,e.exports=i,e.exports.default=i},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(6),o=r(8),s=r(0),a=r(13),i=r.n(a),c=r(20),l=r(68);const u=()=>{const{shippingRates:e,needsShipping:t,hasCalculatedShipping:r,isLoadingRates:a}=Object(o.useSelect)(e=>{const t=e(n.CART_STORE_KEY);return{shippingRates:t.getShippingRates(),needsShipping:t.getNeedsShipping(),hasCalculatedShipping:t.getHasCalculatedShipping(),isLoadingRates:t.isCustomerDataUpdating()}}),{isSelectingRate:u,selectShippingRate:d}=Object(l.a)(),p=Object(s.useRef)({});return Object(s.useEffect)(()=>{const t=(e=>Object.fromEntries(e.map(e=>{var t;let{package_id:r,shipping_rates:n}=e;return[r,null===(t=n.find(e=>e.selected))||void 0===t?void 0:t.rate_id]})))(e);Object(c.a)(t)&&!i()(p.current,t)&&(p.current=t)},[e]),{isSelectingRate:u,selectedRates:p.current,selectShippingRate:d,shippingRates:e,needsShipping:t,hasCalculatedShipping:r,isLoadingRates:a}}},,function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(8),o=r(6);const s=()=>{const{customerData:e,isInitialized:t}=Object(n.useSelect)(e=>{const t=e(o.CART_STORE_KEY);return{customerData:t.getCustomerData(),isInitialized:t.hasFinishedResolution("getCartData")}}),{setShippingAddress:r,setBillingAddress:s}=Object(n.useDispatch)(o.CART_STORE_KEY);return{isInitialized:t,billingAddress:e.billingAddress,shippingAddress:e.shippingAddress,setBillingAddress:s,setShippingAddress:r}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return v})),r.d(t,"a",(function(){return O}));var n=r(0);const o={NONE:"none",INVALID_ADDRESS:"invalid_address",UNKNOWN:"unknown_error"},s={INVALID_COUNTRY:"woocommerce_rest_cart_shipping_rates_invalid_country",MISSING_COUNTRY:"woocommerce_rest_cart_shipping_rates_missing_country",INVALID_STATE:"woocommerce_rest_cart_shipping_rates_invalid_state"},a={shippingErrorStatus:{isPristine:!0,isValid:!1,hasInvalidAddress:!1,hasError:!1},dispatchErrorStatus:()=>null,shippingErrorTypes:o,shippingRates:[],isLoadingRates:!1,selectedRates:[],setSelectedRates:()=>null,shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},setShippingAddress:()=>null,onShippingRateSuccess:()=>null,onShippingRateFail:()=>null,onShippingRateSelectSuccess:()=>null,onShippingRateSelectFail:()=>null,needsShipping:!1},i=(e,t)=>{let{type:r}=t;return Object.values(o).includes(r)?r:e};var c=r(93),l=r(201);const u=e=>({onSuccess:Object(l.a)("shipping_rates_success",e),onFail:Object(l.a)("shipping_rates_fail",e),onSelectSuccess:Object(l.a)("shipping_rate_select_success",e),onSelectFail:Object(l.a)("shipping_rate_select_fail",e)});var d=r(203),p=r(35),f=r(33),m=r(68),h=r(64);const{NONE:b,INVALID_ADDRESS:g,UNKNOWN:E}=o,y=Object(n.createContext)(a),v=()=>Object(n.useContext)(y),O=e=>{let{children:t}=e;const{dispatchActions:r}=Object(p.b)(),{shippingRates:a,isLoadingRates:l,cartErrors:v}=Object(f.a)(),{isSelectingRate:O}=Object(m.a)(),{selectedRates:_}=Object(h.a)(),[S,k]=Object(n.useReducer)(i,b),[w,j]=Object(n.useReducer)(c.b,{}),R=Object(n.useRef)(w),C=Object(n.useMemo)(()=>({onShippingRateSuccess:u(j).onSuccess,onShippingRateFail:u(j).onFail,onShippingRateSelectSuccess:u(j).onSelectSuccess,onShippingRateSelectFail:u(j).onSelectFail}),[j]);Object(n.useEffect)(()=>{R.current=w},[w]),Object(n.useEffect)(()=>{l?r.incrementCalculating():r.decrementCalculating()},[l,r]),Object(n.useEffect)(()=>{O?r.incrementCalculating():r.decrementCalculating()},[O,r]),Object(n.useEffect)(()=>{v.length>0&&v.some(e=>!(!e.code||!Object.values(s).includes(e.code)))?k({type:g}):k({type:b})},[v]);const T=Object(n.useMemo)(()=>({isPristine:S===b,isValid:S===b,hasInvalidAddress:S===g,hasError:S===E||S===g}),[S]);Object(n.useEffect)(()=>{l||0!==a.length&&!T.hasError||Object(d.a)(R.current,"shipping_rates_fail",{hasInvalidAddress:T.hasInvalidAddress,hasError:T.hasError})},[a,l,T.hasError,T.hasInvalidAddress]),Object(n.useEffect)(()=>{!l&&a.length>0&&!T.hasError&&Object(d.a)(R.current,"shipping_rates_success",a)},[a,l,T.hasError]),Object(n.useEffect)(()=>{O||(T.hasError?Object(d.a)(R.current,"shipping_rate_select_fail",{hasError:T.hasError,hasInvalidAddress:T.hasInvalidAddress}):Object(d.a)(R.current,"shipping_rate_select_success",_.current))},[_,O,T.hasError,T.hasInvalidAddress]);const A={shippingErrorStatus:T,dispatchErrorStatus:k,shippingErrorTypes:o,...C};return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(y.Provider,{value:A},t))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(8),o=r(0),s=r(6),a=r(74),i=r(58);const c=()=>{const e=Object(a.a)(),{dispatchCheckoutEvent:t}=Object(i.a)(),{selectShippingRate:r}=Object(n.useDispatch)(s.CART_STORE_KEY);return{selectShippingRate:Object(o.useCallback)((n,o)=>{r(n,o).then(()=>{t("set-selected-shipping-rate",{shippingRateId:n})}).catch(t=>{e(t)})},[r,t,e]),isSelectingRate:Object(n.useSelect)(e=>e(s.CART_STORE_KEY).isShippingRateBeingSelected(),[])}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"d",(function(){return a})),r.d(t,"c",(function(){return i})),r.d(t,"b",(function(){return c}));const n=window.CustomEvent||null,o=(e,t)=>{let{bubbles:r=!1,cancelable:o=!1,element:s,detail:a={}}=t;if(!n)return;s||(s=document.body);const i=new n(e,{bubbles:r,cancelable:o,detail:a});s.dispatchEvent(i)};let s;const a=()=>{s&&clearTimeout(s),s=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},i=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},c=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 s=()=>{o(t,{bubbles:r,cancelable:n})};return jQuery(document).on(e,s),()=>jQuery(document).off(e,s)}},function(e,t,r){"use strict";var n=r(0),o=r(14);const s=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=s},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),s=r(0);r(106);const a=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};t.a=e=>t=>{const r=Object(s.useRef)(null);return Object(s.createElement)(s.Fragment,null,Object(s.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:r,"aria-hidden":!0}),Object(s.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];a(e),null==e||e.focus()}else a(e)})(e,r):a(e))})(r.current,e)}})))}},,function(e,t,r){"use strict";var n=r(0),o=r(4),s=r(5),a=r.n(s),i=r(1),c=r(21),l=r(70),u=r(43);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:s=r,onRemove:p=o.noop,isDismissible:f=!0,actions:m=[],politeness:h=d(t),__unstableHTML:b,onDismiss:g=o.noop}){!function(e,t){const r="string"==typeof e?e:Object(n.renderToString)(e);Object(n.useEffect)(()=>{r&&Object(c.speak)(r,t)},[r,t])}(s,h);const E=a()(e,"components-notice","is-"+t,{"is-dismissible":f});return b&&(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:s=!1,onClick:i,url:c},l)=>{let d=o;return"primary"===o||s||(d=c?"link":"secondary"),void 0===d&&r&&(d="primary"),Object(n.createElement)(u.a,{key:l,href:c,variant:d,onClick:c?void 0:i,className:a()("components-notice__action",e)},t)}))),f&&Object(n.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(i.__)("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,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return s}));var n=r(8);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;const r=Object(n.select)("core/notices").getNotices(e);return r.some(e=>e.type===t)},s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const r=Object(n.select)("core/notices").getNotices(),{removeNotice:o}=Object(n.dispatch)("core/notices"),s=r.filter(t=>t.status===e);s.forEach(e=>o(e.id,t))}},function(e,t){},function(e,t,r){var n=r(3),o=r(55),s=r(56),a=s.setStyleProp;function i(e){return s.PRESERVE_CUSTOM_ATTRIBUTES&&"tag"===e.type&&s.isCustomComponent(e.name,e.attribs)}e.exports=function e(t,r){for(var s,c,l,u,d=(r=r||{}).library||n,p=d.cloneElement,f=d.createElement,m=d.isValidElement,h=[],b="function"==typeof r.replace,g=r.trim,E=0,y=t.length;E<y;E++)if(s=t[E],b&&m(c=r.replace(s)))y>1&&(c=p(c,{key:c.key||E})),h.push(c);else if("text"!==s.type){switch(l=s.attribs,i(s)?a(l.style,l):l&&(l=o(l)),u=null,s.type){case"script":case"style":s.children[0]&&(l.dangerouslySetInnerHTML={__html:s.children[0].data});break;case"tag":"textarea"===s.name&&s.children[0]?l.defaultValue=s.children[0].data:s.children&&s.children.length&&(u=e(s.children,r));break;default:continue}y>1&&(l.key=E),h.push(f(s.name,l,u))}else g?s.data.trim()&&h.push(s.data):h.push(s.data);return 1===h.length?h[0]:h}},function(e,t,r){var n=r(83),o=r(84),s=r(85),a=s.MUST_USE_PROPERTY,i=s.HAS_BOOLEAN_VALUE,c=s.HAS_NUMERIC_VALUE,l=s.HAS_POSITIVE_NUMERIC_VALUE,u=s.HAS_OVERLOADED_BOOLEAN_VALUE;function d(e,t){return(e&t)===t}function p(e,t,r){var n,o,s,p=e.Properties,f=e.DOMAttributeNames;for(o in p)n=f[o]||(r?o:o.toLowerCase()),s=p[o],t[n]={attributeName:n,propertyName:o,mustUseProperty:d(s,a),hasBooleanValue:d(s,i),hasNumericValue:d(s,c),hasPositiveNumericValue:d(s,l),hasOverloadedBooleanValue:d(s,u)}}var f={};p(n,f);var m={};p(o,m,!0);var h={};p(n,h),p(o,h,!0),e.exports={html:f,svg:m,properties:h,isCustomAttribute:RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"))}},function(e,t){e.exports={Properties:{autoFocus:4,accept:0,acceptCharset:0,accessKey:0,action:0,allowFullScreen:4,allowTransparency:0,alt:0,as:0,async:4,autoComplete:0,autoPlay:4,capture:4,cellPadding:0,cellSpacing:0,charSet:0,challenge:0,checked:5,cite:0,classID:0,className:0,cols:24,colSpan:0,content:0,contentEditable:0,contextMenu:0,controls:4,controlsList:0,coords:0,crossOrigin:0,data:0,dateTime:0,default:4,defer:4,dir:0,disabled:4,download:32,draggable:0,encType:0,form:0,formAction:0,formEncType:0,formMethod:0,formNoValidate:4,formTarget:0,frameBorder:0,headers:0,height:0,hidden:4,high:0,href:0,hrefLang:0,htmlFor:0,httpEquiv:0,icon:0,id:0,inputMode:0,integrity:0,is:0,keyParams:0,keyType:0,kind:0,label:0,lang:0,list:0,loop:4,low:0,manifest:0,marginHeight:0,marginWidth:0,max:0,maxLength:0,media:0,mediaGroup:0,method:0,min:0,minLength:0,multiple:5,muted:5,name:0,nonce:0,noValidate:4,open:4,optimum:0,pattern:0,placeholder:0,playsInline:4,poster:0,preload:0,profile:0,radioGroup:0,readOnly:4,referrerPolicy:0,rel:0,required:4,reversed:4,role:0,rows:24,rowSpan:8,sandbox:0,scope:0,scoped:4,scrolling:0,seamless:4,selected:5,shape:0,size:24,sizes:0,span:24,spellCheck:0,src:0,srcDoc:0,srcLang:0,srcSet:0,start:8,step:0,style:0,summary:0,tabIndex:0,target:0,title:0,type:0,useMap:0,value:0,width:0,wmode:0,wrap:0,about:0,datatype:0,inlist:0,prefix:0,property:0,resource:0,typeof:0,vocab:0,autoCapitalize:0,autoCorrect:0,autoSave:0,color:0,itemProp:0,itemScope:4,itemType:0,itemID:0,itemRef:0,results:0,security:0,unselectable:0},DOMAttributeNames:{acceptCharset:"accept-charset",className:"class",htmlFor:"for",httpEquiv:"http-equiv"}}},function(e,t){e.exports={Properties:{accentHeight:0,accumulate:0,additive:0,alignmentBaseline:0,allowReorder:0,alphabetic:0,amplitude:0,arabicForm:0,ascent:0,attributeName:0,attributeType:0,autoReverse:0,azimuth:0,baseFrequency:0,baseProfile:0,baselineShift:0,bbox:0,begin:0,bias:0,by:0,calcMode:0,capHeight:0,clip:0,clipPath:0,clipRule:0,clipPathUnits:0,colorInterpolation:0,colorInterpolationFilters:0,colorProfile:0,colorRendering:0,contentScriptType:0,contentStyleType:0,cursor:0,cx:0,cy:0,d:0,decelerate:0,descent:0,diffuseConstant:0,direction:0,display:0,divisor:0,dominantBaseline:0,dur:0,dx:0,dy:0,edgeMode:0,elevation:0,enableBackground:0,end:0,exponent:0,externalResourcesRequired:0,fill:0,fillOpacity:0,fillRule:0,filter:0,filterRes:0,filterUnits:0,floodColor:0,floodOpacity:0,focusable:0,fontFamily:0,fontSize:0,fontSizeAdjust:0,fontStretch:0,fontStyle:0,fontVariant:0,fontWeight:0,format:0,from:0,fx:0,fy:0,g1:0,g2:0,glyphName:0,glyphOrientationHorizontal:0,glyphOrientationVertical:0,glyphRef:0,gradientTransform:0,gradientUnits:0,hanging:0,horizAdvX:0,horizOriginX:0,ideographic:0,imageRendering:0,in:0,in2:0,intercept:0,k:0,k1:0,k2:0,k3:0,k4:0,kernelMatrix:0,kernelUnitLength:0,kerning:0,keyPoints:0,keySplines:0,keyTimes:0,lengthAdjust:0,letterSpacing:0,lightingColor:0,limitingConeAngle:0,local:0,markerEnd:0,markerMid:0,markerStart:0,markerHeight:0,markerUnits:0,markerWidth:0,mask:0,maskContentUnits:0,maskUnits:0,mathematical:0,mode:0,numOctaves:0,offset:0,opacity:0,operator:0,order:0,orient:0,orientation:0,origin:0,overflow:0,overlinePosition:0,overlineThickness:0,paintOrder:0,panose1:0,pathLength:0,patternContentUnits:0,patternTransform:0,patternUnits:0,pointerEvents:0,points:0,pointsAtX:0,pointsAtY:0,pointsAtZ:0,preserveAlpha:0,preserveAspectRatio:0,primitiveUnits:0,r:0,radius:0,refX:0,refY:0,renderingIntent:0,repeatCount:0,repeatDur:0,requiredExtensions:0,requiredFeatures:0,restart:0,result:0,rotate:0,rx:0,ry:0,scale:0,seed:0,shapeRendering:0,slope:0,spacing:0,specularConstant:0,specularExponent:0,speed:0,spreadMethod:0,startOffset:0,stdDeviation:0,stemh:0,stemv:0,stitchTiles:0,stopColor:0,stopOpacity:0,strikethroughPosition:0,strikethroughThickness:0,string:0,stroke:0,strokeDasharray:0,strokeDashoffset:0,strokeLinecap:0,strokeLinejoin:0,strokeMiterlimit:0,strokeOpacity:0,strokeWidth:0,surfaceScale:0,systemLanguage:0,tableValues:0,targetX:0,targetY:0,textAnchor:0,textDecoration:0,textRendering:0,textLength:0,to:0,transform:0,u1:0,u2:0,underlinePosition:0,underlineThickness:0,unicode:0,unicodeBidi:0,unicodeRange:0,unitsPerEm:0,vAlphabetic:0,vHanging:0,vIdeographic:0,vMathematical:0,values:0,vectorEffect:0,version:0,vertAdvY:0,vertOriginX:0,vertOriginY:0,viewBox:0,viewTarget:0,visibility:0,widths:0,wordSpacing:0,writingMode:0,x:0,xHeight:0,x1:0,x2:0,xChannelSelector:0,xlinkActuate:0,xlinkArcrole:0,xlinkHref:0,xlinkRole:0,xlinkShow:0,xlinkTitle:0,xlinkType:0,xmlBase:0,xmlns:0,xmlnsXlink:0,xmlLang:0,xmlSpace:0,y:0,y1:0,y2:0,yChannelSelector:0,z:0,zoomAndPan:0},DOMAttributeNames:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDasharray:"stroke-dasharray",strokeDashoffset:"stroke-dashoffset",strokeLinecap:"stroke-linecap",strokeLinejoin:"stroke-linejoin",strokeMiterlimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",xlinkActuate:"xlink:actuate",xlinkArcrole:"xlink:arcrole",xlinkHref:"xlink:href",xlinkRole:"xlink:role",xlinkShow:"xlink:show",xlinkTitle:"xlink:title",xlinkType:"xlink:type",xmlBase:"xml:base",xmlnsXlink:"xmlns:xlink",xmlLang:"xml:lang",xmlSpace:"xml:space"}}},function(e,t){e.exports={MUST_USE_PROPERTY:1,HAS_BOOLEAN_VALUE:4,HAS_NUMERIC_VALUE:8,HAS_POSITIVE_NUMERIC_VALUE:24,HAS_OVERLOADED_BOOLEAN_VALUE:32}},function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};t.__esModule=!0;var o=n(r(87)),s=r(89);t.default=function(e,t){var r={};return e&&"string"==typeof e?(o.default(e,(function(e,n){e&&n&&(r[s.camelCase(e,t)]=n)})),r):r}},function(e,t,r){var n=r(88);e.exports=function(e,t){var r,o=null;if(!e||"string"!=typeof e)return o;for(var s,a,i=n(e),c="function"==typeof t,l=0,u=i.length;l<u;l++)s=(r=i[l]).property,a=r.value,c?t(s,a,r):a&&(o||(o={}),o[s]=a);return o}},function(e,t){var r=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,n=/\n/g,o=/^\s*/,s=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,a=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,c=/^[;\s]*/,l=/^\s+|\s+$/g;function u(e){return e?e.replace(l,""):""}e.exports=function(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var l=1,d=1;function p(e){var t=e.match(n);t&&(l+=t.length);var r=e.lastIndexOf("\n");d=~r?e.length-r:d+e.length}function f(){var e={line:l,column:d};return function(t){return t.position=new m(e),E(),t}}function m(e){this.start=e,this.end={line:l,column:d},this.source=t.source}m.prototype.content=e;var h=[];function b(r){var n=new Error(t.source+":"+l+":"+d+": "+r);if(n.reason=r,n.filename=t.source,n.line=l,n.column=d,n.source=e,!t.silent)throw n;h.push(n)}function g(t){var r=t.exec(e);if(r){var n=r[0];return p(n),e=e.slice(n.length),r}}function E(){g(o)}function y(e){var t;for(e=e||[];t=v();)!1!==t&&e.push(t);return e}function v(){var t=f();if("/"==e.charAt(0)&&"*"==e.charAt(1)){for(var r=2;""!=e.charAt(r)&&("*"!=e.charAt(r)||"/"!=e.charAt(r+1));)++r;if(r+=2,""===e.charAt(r-1))return b("End of comment missing");var n=e.slice(2,r-2);return d+=2,p(n),e=e.slice(r),d+=2,t({type:"comment",comment:n})}}function O(){var e=f(),t=g(s);if(t){if(v(),!g(a))return b("property missing ':'");var n=g(i),o=e({type:"declaration",property:u(t[0].replace(r,"")),value:n?u(n[0].replace(r,"")):""});return g(c),o}}return E(),function(){var e,t=[];for(y(t);e=O();)!1!==e&&(t.push(e),y(t));return t}()}},function(e,t,r){"use strict";t.__esModule=!0,t.camelCase=void 0;var n=/^--[a-zA-Z0-9-]+$/,o=/-([a-z])/g,s=/^[^-]+$/,a=/^-(webkit|moz|ms|o|khtml)-/,i=function(e,t){return t.toUpperCase()},c=function(e,t){return t+"-"};t.camelCase=function(e,t){return void 0===t&&(t={}),function(e){return!e||s.test(e)||n.test(e)}(e)?e:(e=e.toLowerCase(),t.reactCompat||(e=e.replace(a,c)),e.replace(o,i))}},function(e,t,r){var n=r(91),o=r(57),s=o.formatDOM,a=o.isIE(9),i=/<(![a-zA-Z\s]+)>/;e.exports=function(e){if("string"!=typeof e)throw new TypeError("First argument must be a string");if(!e)return[];var t,r=e.match(i);return r&&r[1]&&(t=r[1],a&&(e=e.replace(r[0],""))),s(n(e),null,t)}},function(e,t,r){var n=r(57),o=/<([a-zA-Z]+[0-9]?)/,s=/<head.*>/i,a=/<body.*>/i,i=/<(area|base|br|col|embed|hr|img|input|keygen|link|menuitem|meta|param|source|track|wbr)(.*?)\/?>/gi,c=n.isIE(9),l=c||n.isIE(),u=function(){throw new Error("This browser does not support `document.implementation.createHTMLDocument`")},d=function(){throw new Error("This browser does not support `DOMParser.prototype.parseFromString`")};if("function"==typeof window.DOMParser){var p=new window.DOMParser,f=c?"text/xml":"text/html";u=d=function(e,t){return t&&(e="<"+t+">"+e+"</"+t+">"),c&&(e=e.replace(i,"<$1$2$3/>")),p.parseFromString(e,f)}}if(document.implementation){var m=document.implementation.createHTMLDocument(l?"html-dom-parser":void 0);u=function(e,t){if(t)return m.documentElement.getElementsByTagName(t)[0].innerHTML=e,m;try{return m.documentElement.innerHTML=e,m}catch(t){if(d)return d(e)}}}var h,b=document.createElement("template");b.content&&(h=function(e){return b.innerHTML=e,b.content.childNodes}),e.exports=function(e){var t,r,n,i,c=e.match(o);switch(c&&c[1]&&(t=c[1].toLowerCase()),t){case"html":return r=d(e),s.test(e)||(n=r.getElementsByTagName("head")[0])&&n.parentNode.removeChild(n),a.test(e)||(n=r.getElementsByTagName("body")[0])&&n.parentNode.removeChild(n),r.getElementsByTagName("html");case"head":case"body":return i=u(e).getElementsByTagName(t),a.test(e)&&s.test(e)?i[0].parentNode.childNodes:i;default:return h?h(e):u(e,"body").getElementsByTagName("body")[0].childNodes}}},function(e,t){e.exports={CASE_SENSITIVE_TAG_NAMES:["animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussainBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","linearGradient","radialGradient","textPath"]}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return i}));var n=r(4);let o;!function(e){e.ADD_EVENT_CALLBACK="add_event_callback",e.REMOVE_EVENT_CALLBACK="remove_event_callback"}(o||(o={}));const s={addEventCallback:function(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;return{id:Object(n.uniqueId)(),type:o.ADD_EVENT_CALLBACK,eventType:e,callback:t,priority:r}},removeEventCallback:(e,t)=>({id:t,type:o.REMOVE_EVENT_CALLBACK,eventType:e})},a={},i=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,{type:t,eventType:r,id:n,callback:s,priority:i}=arguments.length>1?arguments[1]:void 0;const c=e.hasOwnProperty(r)?new Map(e[r]):new Map;switch(t){case o.ADD_EVENT_CALLBACK:return c.set(n,{priority:i,callback:s}),{...e,[r]:c};case o.REMOVE_EVENT_CALLBACK:return c.delete(n),{...e,[r]:c}}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return a}));var n=r(1),o=r(18);const s=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(n.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")}},function(e,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(t,"__esModule",{value:!0});var o=n(r(12)),s=n(r(128)),a=r(3),i=n(a),c=n(r(129)),l=n(r(131)),u={arr:Array.isArray,obj:function(e){return"[object Object]"===Object.prototype.toString.call(e)},fun:function(e){return"function"==typeof e},str:function(e){return"string"==typeof e},num:function(e){return"number"==typeof e},und:function(e){return void 0===e},nul:function(e){return null===e},set:function(e){return e instanceof Set},map:function(e){return e instanceof Map},equ:function(e,t){if(typeof e!=typeof t)return!1;if(u.str(e)||u.num(e))return e===t;if(u.obj(e)&&u.obj(t)&&Object.keys(e).length+Object.keys(t).length===0)return!0;var r;for(r in e)if(!(r in t))return!1;for(r in t)if(e[r]!==t[r])return!1;return!u.und(r)||e===t}};function d(){var e=a.useState(!1)[1];return a.useCallback((function(){return e((function(e){return!e}))}),[])}function p(e,t){return u.und(e)||u.nul(e)?t:e}function f(e){return u.und(e)?[]:u.arr(e)?e:[e]}function m(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return u.fun(e)?e.apply(void 0,r):e}function h(e){var t=function(e){return e.to,e.from,e.config,e.onStart,e.onRest,e.onFrame,e.children,e.reset,e.reverse,e.force,e.immediate,e.delay,e.attach,e.destroyed,e.interpolateTo,e.ref,e.lazy,s(e,["to","from","config","onStart","onRest","onFrame","children","reset","reverse","force","immediate","delay","attach","destroyed","interpolateTo","ref","lazy"])}(e);if(u.und(t))return o({to:t},e);var r=Object.keys(e).reduce((function(r,n){var s;return u.und(t[n])?o({},r,((s={})[n]=e[n],s)):r}),{});return o({to:t},r)}var b,g,E=function(){function e(){this.payload=void 0,this.children=[]}var t=e.prototype;return t.getAnimatedValue=function(){return this.getValue()},t.getPayload=function(){return this.payload||this},t.attach=function(){},t.detach=function(){},t.getChildren=function(){return this.children},t.addChild=function(e){0===this.children.length&&this.attach(),this.children.push(e)},t.removeChild=function(e){var t=this.children.indexOf(e);this.children.splice(t,1),0===this.children.length&&this.detach()},e}(),y=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).payload=[],t.attach=function(){return t.payload.forEach((function(e){return e instanceof E&&e.addChild(l(t))}))},t.detach=function(){return t.payload.forEach((function(e){return e instanceof E&&e.removeChild(l(t))}))},t}return c(t,e),t}(E),v=function(e){function t(){for(var t,r=arguments.length,n=new Array(r),o=0;o<r;o++)n[o]=arguments[o];return(t=e.call.apply(e,[this].concat(n))||this).payload={},t.attach=function(){return Object.values(t.payload).forEach((function(e){return e instanceof E&&e.addChild(l(t))}))},t.detach=function(){return Object.values(t.payload).forEach((function(e){return e instanceof E&&e.removeChild(l(t))}))},t}c(t,e);var r=t.prototype;return r.getValue=function(e){void 0===e&&(e=!1);var t={};for(var r in this.payload){var n=this.payload[r];(!e||n instanceof E)&&(t[r]=n instanceof E?n[e?"getAnimatedValue":"getValue"]():n)}return t},r.getAnimatedValue=function(){return this.getValue(!0)},t}(E);function O(e,t){b={fn:e,transform:t}}function _(e){g=e}var S,k=function(e){return"undefined"!=typeof window?window.requestAnimationFrame(e):-1},w=function(e){"undefined"!=typeof window&&window.cancelAnimationFrame(e)};function j(e){S=e}var R,C=function(){return Date.now()};function T(e){R=e}var A,P,x=function(e){return e.current};function M(e){A=e}var N=Object.freeze({get applyAnimatedValues(){return b},injectApplyAnimatedValues:O,get colorNames(){return g},injectColorNames:_,get requestFrame(){return k},get cancelFrame(){return w},injectFrame:function(e,t){k=e,w=t},get interpolation(){return S},injectStringInterpolator:j,get now(){return C},injectNow:function(e){C=e},get defaultElement(){return R},injectDefaultElement:T,get animatedApi(){return x},injectAnimatedApi:function(e){x=e},get createAnimatedStyle(){return A},injectCreateAnimatedStyle:M,get manualFrameloop(){return P},injectManualFrameloop:function(e){P=e}}),I=function(e){function t(t,r){var n;return(n=e.call(this)||this).update=void 0,n.payload=t.style?o({},t,{style:A(t.style)}):t,n.update=r,n.attach(),n}return c(t,e),t}(v),D=!1,L=new Set,F=function e(){if(!D)return!1;var t=C(),r=L,n=Array.isArray(r),o=0;for(r=n?r:r[Symbol.iterator]();;){var s;if(n){if(o>=r.length)break;s=r[o++]}else{if((o=r.next()).done)break;s=o.value}for(var a=s,i=!1,c=0;c<a.configs.length;c++){for(var l=a.configs[c],u=void 0,d=void 0,p=0;p<l.animatedValues.length;p++){var f=l.animatedValues[p];if(!f.done){var m=l.fromValues[p],h=l.toValues[p],b=f.lastPosition,g=h instanceof E,y=Array.isArray(l.initialVelocity)?l.initialVelocity[p]:l.initialVelocity;if(g&&(h=h.getValue()),l.immediate)f.setValue(h),f.done=!0;else if("string"!=typeof m&&"string"!=typeof h){if(void 0!==l.duration)b=m+l.easing((t-f.startTime)/l.duration)*(h-m),u=t>=f.startTime+l.duration;else if(l.decay)b=m+y/(1-.998)*(1-Math.exp(-(1-.998)*(t-f.startTime))),(u=Math.abs(f.lastPosition-b)<.1)&&(h=b);else{d=void 0!==f.lastTime?f.lastTime:t,y=void 0!==f.lastVelocity?f.lastVelocity:l.initialVelocity,t>d+64&&(d=t);for(var v=Math.floor(t-d),O=0;O<v;++O)b+=1*(y+=(-l.tension*(b-h)+-l.friction*y)/l.mass*1/1e3)/1e3;var _=!(!l.clamp||0===l.tension)&&(m<h?b>h:b<h),S=Math.abs(y)<=l.precision,w=0===l.tension||Math.abs(h-b)<=l.precision;u=_||S&&w,f.lastVelocity=y,f.lastTime=t}g&&!l.toValues[p].done&&(u=!1),u?(f.value!==h&&(b=h),f.done=!0):i=!0,f.setValue(b),f.lastPosition=b}else f.setValue(h),f.done=!0}}a.props.onFrame&&(a.values[l.name]=l.interpolation.getValue())}a.props.onFrame&&a.props.onFrame(a.values),i||(L.delete(a),a.stop(!0))}return L.size?P?P():k(e):D=!1,D};function V(e,t,r){if("function"==typeof e)return e;if(Array.isArray(e))return V({range:e,output:t,extrapolate:r});if(S&&"string"==typeof e.output[0])return S(e);var n=e,o=n.output,s=n.range||[0,1],a=n.extrapolateLeft||n.extrapolate||"extend",i=n.extrapolateRight||n.extrapolate||"extend",c=n.easing||function(e){return e};return function(e){var t=function(e,t){for(var r=1;r<t.length-1&&!(t[r]>=e);++r);return r-1}(e,s);return function(e,t,r,n,o,s,a,i,c){var l=c?c(e):e;if(l<t){if("identity"===a)return l;"clamp"===a&&(l=t)}if(l>r){if("identity"===i)return l;"clamp"===i&&(l=r)}return n===o?n:t===r?e<=t?n:o:(t===-1/0?l=-l:r===1/0?l-=t:l=(l-t)/(r-t),l=s(l),n===-1/0?l=-l:o===1/0?l+=n:l=l*(o-n)+n,l)}(e,s[t],s[t+1],o[t],o[t+1],c,a,i,n.map)}}var B=function(e){function t(r,n,o,s){var a;return(a=e.call(this)||this).calc=void 0,a.payload=r instanceof y&&!(r instanceof t)?r.getPayload():Array.isArray(r)?r:[r],a.calc=V(n,o,s),a}c(t,e);var r=t.prototype;return r.getValue=function(){return this.calc.apply(this,this.payload.map((function(e){return e.getValue()})))},r.updateConfig=function(e,t,r){this.calc=V(e,t,r)},r.interpolate=function(e,r,n){return new t(this,e,r,n)},t}(y),U=function(e){function t(t){var r;return(r=e.call(this)||this).animatedStyles=new Set,r.value=void 0,r.startPosition=void 0,r.lastPosition=void 0,r.lastVelocity=void 0,r.startTime=void 0,r.lastTime=void 0,r.done=!1,r.setValue=function(e,t){void 0===t&&(t=!0),r.value=e,t&&r.flush()},r.value=t,r.startPosition=t,r.lastPosition=t,r}c(t,e);var r=t.prototype;return r.flush=function(){0===this.animatedStyles.size&&function e(t,r){"update"in t?r.add(t):t.getChildren().forEach((function(t){return e(t,r)}))}(this,this.animatedStyles),this.animatedStyles.forEach((function(e){return e.update()}))},r.clearStyles=function(){this.animatedStyles.clear()},r.getValue=function(){return this.value},r.interpolate=function(e,t,r){return new B(this,e,t,r)},t}(E),H=function(e){function t(t){var r;return(r=e.call(this)||this).payload=t.map((function(e){return new U(e)})),r}c(t,e);var r=t.prototype;return r.setValue=function(e,t){var r=this;void 0===t&&(t=!0),Array.isArray(e)?e.length===this.payload.length&&e.forEach((function(e,n){return r.payload[n].setValue(e,t)})):this.payload.forEach((function(r){return r.setValue(e,t)}))},r.getValue=function(){return this.payload.map((function(e){return e.getValue()}))},r.interpolate=function(e,t){return new B(this,e,t)},t}(y),G=0,Y=function(){function e(){var e=this;this.id=void 0,this.idle=!0,this.hasChanged=!1,this.guid=0,this.local=0,this.props={},this.merged={},this.animations={},this.interpolations={},this.values={},this.configs=[],this.listeners=[],this.queue=[],this.localQueue=void 0,this.getValues=function(){return e.interpolations},this.id=G++}var t=e.prototype;return t.update=function(e){if(!e)return this;var t=h(e),r=t.delay,n=void 0===r?0:r,a=t.to,i=s(t,["delay","to"]);if(u.arr(a)||u.fun(a))this.queue.push(o({},i,{delay:n,to:a}));else if(a){var c={};Object.entries(a).forEach((function(e){var t,r=e[0],s=e[1],a=o({to:(t={},t[r]=s,t),delay:m(n,r)},i),l=c[a.delay]&&c[a.delay].to;c[a.delay]=o({},c[a.delay],a,{to:o({},l,a.to)})})),this.queue=Object.values(c)}return this.queue=this.queue.sort((function(e,t){return e.delay-t.delay})),this.diff(i),this},t.start=function(e){var t=this;if(this.queue.length){this.idle=!1,this.localQueue&&this.localQueue.forEach((function(e){var r=e.from,n=void 0===r?{}:r,s=e.to,a=void 0===s?{}:s;u.obj(n)&&(t.merged=o({},n,t.merged)),u.obj(a)&&(t.merged=o({},t.merged,a))}));var r=this.local=++this.guid,n=this.localQueue=this.queue;this.queue=[],n.forEach((function(o,a){var i=o.delay,c=s(o,["delay"]),l=function(o){a===n.length-1&&r===t.guid&&o&&(t.idle=!0,t.props.onRest&&t.props.onRest(t.merged)),e&&e()},d=u.arr(c.to)||u.fun(c.to);i?setTimeout((function(){r===t.guid&&(d?t.runAsync(c,l):t.diff(c).start(l))}),i):d?t.runAsync(c,l):t.diff(c).start(l)}))}else u.fun(e)&&this.listeners.push(e),this.props.onStart&&this.props.onStart(),this,L.has(this)||L.add(this),D||(D=!0,k(P||F));return this},t.stop=function(e){return this.listeners.forEach((function(t){return t(e)})),this.listeners=[],this},t.pause=function(e){return this.stop(!0),e&&(this,L.has(this)&&L.delete(this)),this},t.runAsync=function(e,t){var r=this,n=(e.delay,s(e,["delay"])),a=this.local,i=Promise.resolve(void 0);if(u.arr(n.to))for(var c=function(e){var t=e,s=o({},n,h(n.to[t]));u.arr(s.config)&&(s.config=s.config[t]),i=i.then((function(){if(a===r.guid)return new Promise((function(e){return r.diff(s).start(e)}))}))},l=0;l<n.to.length;l++)c(l);else if(u.fun(n.to)){var d,p=0;i=i.then((function(){return n.to((function(e){var t=o({},n,h(e));if(u.arr(t.config)&&(t.config=t.config[p]),p++,a===r.guid)return d=new Promise((function(e){return r.diff(t).start(e)}))}),(function(e){return void 0===e&&(e=!0),r.stop(e)})).then((function(){return d}))}))}i.then(t)},t.diff=function(e){var t=this;this.props=o({},this.props,e);var r=this.props,n=r.from,s=void 0===n?{}:n,a=r.to,i=void 0===a?{}:a,c=r.config,l=void 0===c?{}:c,d=r.reverse,h=r.attach,b=r.reset,E=r.immediate;if(d){var y=[i,s];s=y[0],i=y[1]}this.merged=o({},s,this.merged,i),this.hasChanged=!1;var v=h&&h(this);if(this.animations=Object.entries(this.merged).reduce((function(e,r){var n=r[0],a=r[1],i=e[n]||{},c=u.num(a),d=u.str(a)&&!a.startsWith("#")&&!/\d/.test(a)&&!g[a],h=u.arr(a),y=!c&&!h&&!d,O=u.und(s[n])?a:s[n],_=c||h||d?a:1,k=m(l,n);v&&(_=v.animations[n].parent);var w,j=i.parent,R=i.interpolation,T=f(v?_.getPayload():_),A=a;y&&(A=S({range:[0,1],output:[a,a]})(1));var P,x=R&&R.getValue(),M=!u.und(j)&&i.animatedValues.some((function(e){return!e.done})),N=!u.equ(A,x),I=!u.equ(A,i.previous),D=!u.equ(k,i.config);if(b||I&&N||D){var L;if(c||d)j=R=i.parent||new U(O);else if(h)j=R=i.parent||new H(O);else if(y){var F=i.interpolation&&i.interpolation.calc(i.parent.value);F=void 0===F||b?O:F,i.parent?(j=i.parent).setValue(0,!1):j=new U(0);var V={output:[F,a]};i.interpolation?(R=i.interpolation,i.interpolation.updateConfig(V)):R=j.interpolate(V)}return T=f(v?_.getPayload():_),w=f(j.getPayload()),b&&!y&&j.setValue(O,!1),t.hasChanged=!0,w.forEach((function(e){e.startPosition=e.value,e.lastPosition=e.value,e.lastVelocity=M?e.lastVelocity:void 0,e.lastTime=M?e.lastTime:void 0,e.startTime=C(),e.done=!1,e.animatedStyles.clear()})),m(E,n)&&j.setValue(y?_:a,!1),o({},e,((L={})[n]=o({},i,{name:n,parent:j,interpolation:R,animatedValues:w,toValues:T,previous:A,config:k,fromValues:f(j.getValue()),immediate:m(E,n),initialVelocity:p(k.velocity,0),clamp:p(k.clamp,!1),precision:p(k.precision,.01),tension:p(k.tension,170),friction:p(k.friction,26),mass:p(k.mass,1),duration:k.duration,easing:p(k.easing,(function(e){return e})),decay:k.decay}),L))}return N?e:(y&&(j.setValue(1,!1),R.updateConfig({output:[A,A]})),j.done=!0,t.hasChanged=!0,o({},e,((P={})[n]=o({},e[n],{previous:A}),P)))}),this.animations),this.hasChanged)for(var O in this.configs=Object.values(this.animations),this.values={},this.interpolations={},this.animations)this.interpolations[O]=this.animations[O].interpolation,this.values[O]=this.animations[O].interpolation.getValue();return this},t.destroy=function(){this.stop(),this.props={},this.merged={},this.animations={},this.interpolations={},this.values={},this.configs=[],this.local=0},e}(),z=function(e,t){var r=a.useRef(!1),n=a.useRef(),o=u.fun(t),s=a.useMemo((function(){var r;return n.current&&(n.current.map((function(e){return e.destroy()})),n.current=void 0),[new Array(e).fill().map((function(e,n){var s=new Y,a=o?m(t,n,s):t[n];return 0===n&&(r=a.ref),s.update(a),r||s.start(),s})),r]}),[e]),i=s[0],c=s[1];n.current=i,a.useImperativeHandle(c,(function(){return{start:function(){return Promise.all(n.current.map((function(e){return new Promise((function(t){return e.start(t)}))})))},stop:function(e){return n.current.forEach((function(t){return t.stop(e)}))},get controllers(){return n.current}}}));var l=a.useMemo((function(){return function(e){return n.current.map((function(t,r){t.update(o?m(e,r,t):e[r]),c||t.start()}))}}),[e]);a.useEffect((function(){r.current?o||l(t):c||n.current.forEach((function(e){return e.start()}))})),a.useEffect((function(){return r.current=!0,function(){return n.current.forEach((function(e){return e.destroy()}))}}),[]);var d=n.current.map((function(e){return e.getValues()}));return o?[d,l,function(e){return n.current.forEach((function(t){return t.pause(e)}))}]:d},q=0,W=function(e,t){return("function"==typeof t?e.map(t):f(t)).map(String)},X=function(e){var t=e.items,r=e.keys,n=void 0===r?function(e){return e}:r,a=s(e,["items","keys"]);return t=f(void 0!==t?t:null),o({items:t,keys:W(t,n)},a)};function K(e,t){var r=function(){if(o){if(s>=n.length)return"break";a=n[s++]}else{if((s=n.next()).done)return"break";a=s.value}var r=a.key,i=function(e){return e.key!==r};(u.und(t)||t===r)&&(e.current.instances.delete(r),e.current.transitions=e.current.transitions.filter(i),e.current.deleted=e.current.deleted.filter(i))},n=e.current.deleted,o=Array.isArray(n),s=0;for(n=o?n:n[Symbol.iterator]();;){var a;if("break"===r())break}e.current.forceUpdate()}var $=function(e){function t(t){var r;return void 0===t&&(t={}),r=e.call(this)||this,!t.transform||t.transform instanceof E||(t=b.transform(t)),r.payload=t,r}return c(t,e),t}(v),J={transparent:0,aliceblue:4042850303,antiquewhite:4209760255,aqua:16777215,aquamarine:2147472639,azure:4043309055,beige:4126530815,bisque:4293182719,black:255,blanchedalmond:4293643775,blue:65535,blueviolet:2318131967,brown:2771004159,burlywood:3736635391,burntsienna:3934150143,cadetblue:1604231423,chartreuse:2147418367,chocolate:3530104575,coral:4286533887,cornflowerblue:1687547391,cornsilk:4294499583,crimson:3692313855,cyan:16777215,darkblue:35839,darkcyan:9145343,darkgoldenrod:3095792639,darkgray:2846468607,darkgreen:6553855,darkgrey:2846468607,darkkhaki:3182914559,darkmagenta:2332068863,darkolivegreen:1433087999,darkorange:4287365375,darkorchid:2570243327,darkred:2332033279,darksalmon:3918953215,darkseagreen:2411499519,darkslateblue:1211993087,darkslategray:793726975,darkslategrey:793726975,darkturquoise:13554175,darkviolet:2483082239,deeppink:4279538687,deepskyblue:12582911,dimgray:1768516095,dimgrey:1768516095,dodgerblue:512819199,firebrick:2988581631,floralwhite:4294635775,forestgreen:579543807,fuchsia:4278255615,gainsboro:3705462015,ghostwhite:4177068031,gold:4292280575,goldenrod:3668254975,gray:2155905279,green:8388863,greenyellow:2919182335,grey:2155905279,honeydew:4043305215,hotpink:4285117695,indianred:3445382399,indigo:1258324735,ivory:4294963455,khaki:4041641215,lavender:3873897215,lavenderblush:4293981695,lawngreen:2096890111,lemonchiffon:4294626815,lightblue:2916673279,lightcoral:4034953471,lightcyan:3774873599,lightgoldenrodyellow:4210742015,lightgray:3553874943,lightgreen:2431553791,lightgrey:3553874943,lightpink:4290167295,lightsalmon:4288707327,lightseagreen:548580095,lightskyblue:2278488831,lightslategray:2005441023,lightslategrey:2005441023,lightsteelblue:2965692159,lightyellow:4294959359,lime:16711935,limegreen:852308735,linen:4210091775,magenta:4278255615,maroon:2147483903,mediumaquamarine:1724754687,mediumblue:52735,mediumorchid:3126187007,mediumpurple:2473647103,mediumseagreen:1018393087,mediumslateblue:2070474495,mediumspringgreen:16423679,mediumturquoise:1221709055,mediumvioletred:3340076543,midnightblue:421097727,mintcream:4127193855,mistyrose:4293190143,moccasin:4293178879,navajowhite:4292783615,navy:33023,oldlace:4260751103,olive:2155872511,olivedrab:1804477439,orange:4289003775,orangered:4282712319,orchid:3664828159,palegoldenrod:4008225535,palegreen:2566625535,paleturquoise:2951671551,palevioletred:3681588223,papayawhip:4293907967,peachpuff:4292524543,peru:3448061951,pink:4290825215,plum:3718307327,powderblue:2967529215,purple:2147516671,rebeccapurple:1714657791,red:4278190335,rosybrown:3163525119,royalblue:1097458175,saddlebrown:2336560127,salmon:4202722047,sandybrown:4104413439,seagreen:780883967,seashell:4294307583,sienna:2689740287,silver:3233857791,skyblue:2278484991,slateblue:1784335871,slategray:1887473919,slategrey:1887473919,snow:4294638335,springgreen:16744447,steelblue:1182971135,tan:3535047935,teal:8421631,thistle:3636451583,tomato:4284696575,turquoise:1088475391,violet:4001558271,wheat:4125012991,white:4294967295,whitesmoke:4126537215,yellow:4294902015,yellowgreen:2597139199},Q="[-+]?\\d*\\.?\\d+";function Z(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return"\\(\\s*("+t.join(")\\s*,\\s*(")+")\\s*\\)"}var ee=new RegExp("rgb"+Z(Q,Q,Q)),te=new RegExp("rgba"+Z(Q,Q,Q,Q)),re=new RegExp("hsl"+Z(Q,"[-+]?\\d*\\.?\\d+%","[-+]?\\d*\\.?\\d+%")),ne=new RegExp("hsla"+Z(Q,"[-+]?\\d*\\.?\\d+%","[-+]?\\d*\\.?\\d+%",Q)),oe=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,se=/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,ae=/^#([0-9a-fA-F]{6})$/,ie=/^#([0-9a-fA-F]{8})$/;function ce(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+6*(t-e)*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function le(e,t,r){var n=r<.5?r*(1+t):r+t-r*t,o=2*r-n,s=ce(o,n,e+1/3),a=ce(o,n,e),i=ce(o,n,e-1/3);return Math.round(255*s)<<24|Math.round(255*a)<<16|Math.round(255*i)<<8}function ue(e){var t=parseInt(e,10);return t<0?0:t>255?255:t}function de(e){return(parseFloat(e)%360+360)%360/360}function pe(e){var t=parseFloat(e);return t<0?0:t>1?255:Math.round(255*t)}function fe(e){var t=parseFloat(e);return t<0?0:t>100?1:t/100}function me(e){var t,r,n="number"==typeof(t=e)?t>>>0===t&&t>=0&&t<=4294967295?t:null:(r=ae.exec(t))?parseInt(r[1]+"ff",16)>>>0:J.hasOwnProperty(t)?J[t]:(r=ee.exec(t))?(ue(r[1])<<24|ue(r[2])<<16|ue(r[3])<<8|255)>>>0:(r=te.exec(t))?(ue(r[1])<<24|ue(r[2])<<16|ue(r[3])<<8|pe(r[4]))>>>0:(r=oe.exec(t))?parseInt(r[1]+r[1]+r[2]+r[2]+r[3]+r[3]+"ff",16)>>>0:(r=ie.exec(t))?parseInt(r[1],16)>>>0:(r=se.exec(t))?parseInt(r[1]+r[1]+r[2]+r[2]+r[3]+r[3]+r[4]+r[4],16)>>>0:(r=re.exec(t))?(255|le(de(r[1]),fe(r[2]),fe(r[3])))>>>0:(r=ne.exec(t))?(le(de(r[1]),fe(r[2]),fe(r[3]))|pe(r[4]))>>>0:null;return null===n?e:"rgba("+((4278190080&(n=n||0))>>>24)+", "+((16711680&n)>>>16)+", "+((65280&n)>>>8)+", "+(255&n)/255+")"}var he=/[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,be=/(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi,ge=new RegExp("("+Object.keys(J).join("|")+")","g"),Ee={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ye=["Webkit","Ms","Moz","O"];function ve(e,t,r){return null==t||"boolean"==typeof t||""===t?"":r||"number"!=typeof t||0===t||Ee.hasOwnProperty(e)&&Ee[e]?(""+t).trim():t+"px"}Ee=Object.keys(Ee).reduce((function(e,t){return ye.forEach((function(r){return e[function(e,t){return e+t.charAt(0).toUpperCase()+t.substring(1)}(r,t)]=e[t]})),e}),Ee);var Oe={};M((function(e){return new $(e)})),T("div"),j((function(e){var t=e.output.map((function(e){return e.replace(be,me)})).map((function(e){return e.replace(ge,me)})),r=t[0].match(he).map((function(){return[]}));t.forEach((function(e){e.match(he).forEach((function(e,t){return r[t].push(+e)}))}));var n=t[0].match(he).map((function(t,n){return V(o({},e,{output:r[n]}))}));return function(e){var r=0;return t[0].replace(he,(function(){return n[r++](e)})).replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi,(function(e,t,r,n,o){return"rgba("+Math.round(t)+", "+Math.round(r)+", "+Math.round(n)+", "+o+")"}))}})),_(J),O((function(e,t){if(!e.nodeType||void 0===e.setAttribute)return!1;var r=t.style,n=t.children,o=t.scrollTop,a=t.scrollLeft,i=s(t,["style","children","scrollTop","scrollLeft"]),c="filter"===e.nodeName||e.parentNode&&"filter"===e.parentNode.nodeName;for(var l in void 0!==o&&(e.scrollTop=o),void 0!==a&&(e.scrollLeft=a),void 0!==n&&(e.textContent=n),r)if(r.hasOwnProperty(l)){var u=0===l.indexOf("--"),d=ve(l,r[l],u);"float"===l&&(l="cssFloat"),u?e.style.setProperty(l,d):e.style[l]=d}for(var p in i){var f=c?p:Oe[p]||(Oe[p]=p.replace(/([A-Z])/g,(function(e){return"-"+e.toLowerCase()})));void 0!==e.getAttribute(f)&&e.setAttribute(f,i[p])}}),(function(e){return e}));var _e,Se,ke=(_e=function(e){return a.forwardRef((function(t,r){var n=d(),c=a.useRef(!0),l=a.useRef(null),p=a.useRef(null),f=a.useCallback((function(e){var t=l.current;l.current=new I(e,(function(){var e=!1;p.current&&(e=b.fn(p.current,l.current.getAnimatedValue())),p.current&&!1!==e||n()})),t&&t.detach()}),[]);a.useEffect((function(){return function(){c.current=!1,l.current&&l.current.detach()}}),[]),a.useImperativeHandle(r,(function(){return x(p,c,n)})),f(t);var m,h=l.current.getValue(),g=(h.scrollTop,h.scrollLeft,s(h,["scrollTop","scrollLeft"])),E=(m=e,!u.fun(m)||m.prototype instanceof i.Component?function(e){return p.current=function(e,t){return t&&(u.fun(t)?t(e):u.obj(t)&&(t.current=e)),e}(e,r)}:void 0);return i.createElement(e,o({},g,{ref:E}))}))},void 0===(Se=!1)&&(Se=!0),function(e){return(u.arr(e)?e:Object.keys(e)).reduce((function(e,t){var r=Se?t[0].toLowerCase()+t.substring(1):t;return e[r]=_e(r),e}),_e)}),we=ke(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]);t.apply=ke,t.config={default:{tension:170,friction:26},gentle:{tension:120,friction:14},wobbly:{tension:180,friction:12},stiff:{tension:210,friction:20},slow:{tension:280,friction:60},molasses:{tension:280,friction:120}},t.update=F,t.animated=we,t.a=we,t.interpolate=function(e,t,r){return e&&new B(e,t,r)},t.Globals=N,t.useSpring=function(e){var t=u.fun(e),r=z(1,t?e:[e]),n=r[0],o=r[1],s=r[2];return t?[n[0],o,s]:n},t.useTrail=function(e,t){var r=a.useRef(!1),n=u.fun(t),s=m(t),i=a.useRef(),c=z(e,(function(e,t){return 0===e&&(i.current=[]),i.current.push(t),o({},s,{config:m(s.config,e),attach:e>0&&function(){return i.current[e-1]}})})),l=c[0],d=c[1],p=c[2],f=a.useMemo((function(){return function(e){return d((function(t,r){e.reverse;var n=e.reverse?t+1:t-1,a=i.current[n];return o({},e,{config:m(e.config||s.config,t),attach:a&&function(){return a}})}))}}),[e,s.reverse]);return a.useEffect((function(){r.current&&!n&&f(t)})),a.useEffect((function(){r.current=!0}),[]),n?[l,f,p]:l},t.useTransition=function(e,t,r){var n=o({items:e,keys:t||function(e){return e}},r),i=X(n),c=i.lazy,l=void 0!==c&&c,u=(i.unique,i.reset),p=void 0!==u&&u,f=(i.enter,i.leave,i.update,i.onDestroyed),h=(i.keys,i.items,i.onFrame),b=i.onRest,g=i.onStart,E=i.ref,y=s(i,["lazy","unique","reset","enter","leave","update","onDestroyed","keys","items","onFrame","onRest","onStart","ref"]),v=d(),O=a.useRef(!1),_=a.useRef({mounted:!1,first:!0,deleted:[],current:{},transitions:[],prevProps:{},paused:!!n.ref,instances:!O.current&&new Map,forceUpdate:v});return a.useImperativeHandle(n.ref,(function(){return{start:function(){return Promise.all(Array.from(_.current.instances).map((function(e){var t=e[1];return new Promise((function(e){return t.start(e)}))})))},stop:function(e){return Array.from(_.current.instances).forEach((function(t){return t[1].stop(e)}))},get controllers(){return Array.from(_.current.instances).map((function(e){return e[1]}))}}})),_.current=function(e,t){for(var r=e.first,n=e.prevProps,a=s(e,["first","prevProps"]),i=X(t),c=i.items,l=i.keys,u=i.initial,d=i.from,p=i.enter,f=i.leave,h=i.update,b=i.trail,g=void 0===b?0:b,E=i.unique,y=i.config,v=i.order,O=void 0===v?["enter","leave","update"]:v,_=X(n),S=_.keys,k=_.items,w=o({},a.current),j=[].concat(a.deleted),R=Object.keys(w),C=new Set(R),T=new Set(l),A=l.filter((function(e){return!C.has(e)})),P=a.transitions.filter((function(e){return!e.destroyed&&!T.has(e.originalKey)})).map((function(e){return e.originalKey})),x=l.filter((function(e){return C.has(e)})),M=-g;O.length;)switch(O.shift()){case"enter":A.forEach((function(e,t){E&&j.find((function(t){return t.originalKey===e}))&&(j=j.filter((function(t){return t.originalKey!==e})));var n=l.indexOf(e),o=c[n],s=r&&void 0!==u?"initial":"enter";w[e]={slot:s,originalKey:e,key:E?String(e):q++,item:o,trail:M+=g,config:m(y,o,s),from:m(r&&void 0!==u?u||{}:d,o),to:m(p,o)}}));break;case"leave":P.forEach((function(e){var t=S.indexOf(e),r=k[t];j.unshift(o({},w[e],{slot:"leave",destroyed:!0,left:S[Math.max(0,t-1)],right:S[Math.min(S.length,t+1)],trail:M+=g,config:m(y,r,"leave"),to:m(f,r)})),delete w[e]}));break;case"update":x.forEach((function(e){var t=l.indexOf(e),r=c[t];w[e]=o({},w[e],{item:r,slot:"update",trail:M+=g,config:m(y,r,"update"),to:m(h,r)})}))}var N=l.map((function(e){return w[e]}));return j.forEach((function(e){var t,r=e.left,n=(e.right,s(e,["left","right"]));-1!==(t=N.findIndex((function(e){return e.originalKey===r})))&&(t+=1),t=Math.max(0,t),N=[].concat(N.slice(0,t),[n],N.slice(t))})),o({},a,{changed:A.length||P.length||x.length,first:r&&0===A.length,transitions:N,current:w,deleted:j,prevProps:t})}(_.current,n),_.current.changed&&_.current.transitions.forEach((function(e){var t=e.slot,r=e.from,n=e.to,s=e.config,a=e.trail,i=e.key,c=e.item;_.current.instances.has(i)||_.current.instances.set(i,new Y);var u=_.current.instances.get(i),d=o({},y,{to:n,from:r,config:s,ref:E,onRest:function(r){_.current.mounted&&(e.destroyed&&(E||l||K(_,i),f&&f(c)),!Array.from(_.current.instances).some((function(e){return!e[1].idle}))&&(E||l)&&_.current.deleted.length>0&&K(_),b&&b(c,t,r))},onStart:g&&function(){return g(c,t)},onFrame:h&&function(e){return h(c,t,e)},delay:a,reset:p&&"enter"===t});u.update(d),_.current.paused||u.start()})),a.useEffect((function(){return _.current.mounted=O.current=!0,function(){_.current.mounted=O.current=!1,Array.from(_.current.instances).map((function(e){return e[1].destroy()})),_.current.instances.clear()}}),[]),_.current.transitions.map((function(e){var t=e.item,r=e.slot,n=e.key;return{item:t,key:n,state:r,props:_.current.instances.get(n).getValues()}}))},t.useChain=function(e,t,r){void 0===r&&(r=1e3);var n=a.useRef();a.useEffect((function(){u.equ(e,n.current)?e.forEach((function(e){var t=e.current;return t&&t.start()})):t?e.forEach((function(e,n){var s=e.current;if(s){var a=s.controllers;if(a.length){var i=r*t[n];a.forEach((function(e){e.queue=e.queue.map((function(e){return o({},e,{delay:e.delay+i})})),e.start()}))}}})):e.reduce((function(e,t,r){var n=t.current;return e.then((function(){return n.start()}))}),Promise.resolve()),n.current=e}))},t.useSprings=z},,,,,,,,,,,function(e,t){},,,,,function(e,t,r){"use strict";(function(e){var n=r(0),o=r(4),s=r(5),a=r.n(s),i=r(21),c=r(1),l=(r(36),r(43));t.a=Object(n.forwardRef)((function({className:t,children:r,spokenMessage:s=r,politeness:u="polite",actions:d=[],onRemove:p=o.noop,icon:f=null,explicitDismiss:m=!1,onDismiss:h=o.noop},b){function g(e){e&&e.preventDefault&&e.preventDefault(),h(),p()}h=h||o.noop,function(e,t){const r="string"==typeof e?e:Object(n.renderToString)(e);Object(n.useEffect)(()=>{r&&Object(i.speak)(r,t)},[r,t])}(s,u),Object(n.useEffect)(()=>{const e=setTimeout(()=>{m||(h(),p())},1e4);return()=>clearTimeout(e)},[h,p]);const E=a()(t,"components-snackbar",{"components-snackbar-explicit-dismiss":!!m});d&&d.length>1&&(void 0!==e&&e.env,d=[d[0]]);const y=a()("components-snackbar__content",{"components-snackbar__content-with-icon":!!f});return Object(n.createElement)("div",{ref:b,className:E,onClick:m?o.noop:g,tabIndex:"0",role:m?"":"button",onKeyPress:m?o.noop:g,"aria-label":m?"":Object(c.__)("Dismiss this notice")},Object(n.createElement)("div",{className:y},f&&Object(n.createElement)("div",{className:"components-snackbar__icon"},f),r,d.map(({label:e,onClick:t,url:r},o)=>Object(n.createElement)(l.a,{key:o,href:r,variant:"tertiary",onClick:e=>function(e,t){e.stopPropagation(),p(),t&&t(e)}(e,t),className:"components-snackbar__action"},e)),m&&Object(n.createElement)("span",{role:"button","aria-label":"Dismiss this notice",tabIndex:"0",className:"components-snackbar__dismiss-button",onClick:g,onKeyPress:g},"✕")))}))}).call(this,r(54))},function(e,t){e.exports=window.wp.plugins},,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 s})),r.d(t,"a",(function(){return a}));var n=r(47),o=(r(15),r(2));const s=(e,t)=>Object.keys(o.defaultAddressFields).every(r=>e[r]===t[r]),a=e=>{const t=Object.keys(o.defaultAddressFields),r=Object(n.a)(t,{},e.country),s=Object.assign({},e);return r.forEach(t=>{let{key:r="",hidden:n=!1}=t;n&&((e,t)=>e in t)(r,e)&&(s[r]="")}),s}},,,function(e,t){e.exports=window.wc.wcBlocksSharedHocs},,,,function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(12),o=r.n(n),s=r(0),a=r(5),i=r.n(a),c=r(77),l=r(8),u=(r(80),r(59));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:a}=Object(u.b)(),{notices:p}=Object(l.useSelect)(e=>({notices:e("core/notices").getNotices(r)})),{removeNotice:f}=Object(l.useDispatch)("core/notices"),m=p.filter(e=>"snackbar"!==e.type).concat(n);if(!m.length)return null;const h=i()(t,"wc-block-components-notices");return a?null:Object(s.createElement)("div",{className:h},m.map(e=>Object(s.createElement)(c.a,o()({key:"store-notice-"+e.id},e,{className:i()("wc-block-components-notices__notice",d(e)),onRemove:()=>{e.isDismissible&&f(e.id,r)}}),e.content)))}},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return p}));var n=r(0),o=r(51),s=r(2),a=r(61),i=r.n(a),c=r(10),l=r(16);const u=(e,t)=>e&&t[e]?t[e]:null,d=e=>{let{block:t,blockMap:r,blockWrapper:o,children:a,depth:p=1}=e;return a&&0!==a.length?Array.from(a).map((e,a)=>{const{blockName:f="",...m}={key:`${t}_${p}_${a}`,...e instanceof HTMLElement?e.dataset:{},className:e instanceof Element?null==e?void 0:e.className:""},h=u(f,r);if(!h){const s=i()(e instanceof Element&&(null==e?void 0:e.outerHTML)||(null==e?void 0:e.textContent)||"");if("string"==typeof s&&s)return s;if(!Object(n.isValidElement)(s))return null;const a=e.childNodes.length?d({block:t,blockMap:r,children:e.childNodes,depth:p+1,blockWrapper:o}):void 0;return a?Object(n.cloneElement)(s,m,a):Object(n.cloneElement)(s,m)}const b=o||n.Fragment;return Object(n.createElement)(n.Suspense,{key:`${t}_${p}_${a}_suspense`,fallback:Object(n.createElement)("div",{className:"wc-block-placeholder"})},Object(n.createElement)(l.a,{text:"Unexpected error in: "+f,showErrorBlock:s.CURRENT_USER_IS_ADMIN},Object(n.createElement)(b,null,Object(n.createElement)(h,m,d({block:t,blockMap:r,children:e.childNodes,depth:p+1,blockWrapper:o}),((e,t,r,o)=>{if(!Object(c.hasInnerBlocks)(e))return null;const a=r?Array.from(r).map(e=>e instanceof HTMLElement&&(null==e?void 0:e.dataset.blockName)||null).filter(Boolean):[],i=Object(c.getRegisteredBlocks)(e).filter(e=>{let{blockName:t,force:r}=e;return!0===r&&!a.includes(t)}),d=o||n.Fragment;return Object(n.createElement)(n.Fragment,null,i.map((e,r)=>{let{blockName:o,component:a}=e;const i=a||u(o,t);return i?Object(n.createElement)(l.a,{key:o+"_blockerror",text:"Unexpected error in: "+o,showErrorBlock:s.CURRENT_USER_IS_ADMIN},Object(n.createElement)(d,null,Object(n.createElement)(i,{key:`${o}_forced_${r}`}))):null}))})(f,r,e.childNodes,o)))))}):null},p=e=>{let{Block:t,selector:r,blockName:n,getProps:s=(()=>({})),blockMap:a,blockWrapper:i}=e;Object(o.a)({Block:t,selector:r,getProps:(e,t)=>{const r=d({block:n,blockMap:a,children:e.children||[],blockWrapper:i});return{...s(e,t),children:r}}})}},function(e,t){e.exports=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)r=s[n],t.indexOf(r)>=0||(o[r]=e[r]);return o},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){var n=r(130);e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){function r(t,n){return e.exports=r=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,r(t,n)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},function(e,t,r){"use strict";r.d(t,"a",(function(){return S}));var n=r(0),o=r(112),s=r(2),a=r(16),i=r(205),c=r(67),l=r(49),u=r(35),d=r(1),p=r(28),f=r.n(p),m=r(117),h=r(94),b=r(8);const g=(e,t,r)=>{const n=Object.keys(e).map(t=>({key:t,value:e[t]}),[]),o=`wc-${r}-new-payment-method`;return n.push({key:o,value:t}),n},E=(e,t)=>{f.a.setNonce&&"function"==typeof f.a.setNonce&&f.a.setNonce(e),null!=e&&e.get("User-ID")&&t.setCustomerId(parseInt(e.get("User-ID")||"0",10))};var y=r(198),v=r(33),O=r(59),_=()=>{const{hasError:e,onCheckoutValidationBeforeProcessing:t,dispatchActions:r,redirectUrl:o,isProcessing:s,isBeforeProcessing:a,isComplete:p,orderNotes:_,shouldCreateAccount:S,extensionData:k}=Object(u.b)(),{hasValidationErrors:w}=Object(y.b)(),{shippingErrorStatus:j}=Object(c.b)(),{billingAddress:R,shippingAddress:C}=Object(l.b)(),{cartNeedsPayment:T,cartNeedsShipping:A,receiveCart:P}=Object(v.a)(),{activePaymentMethod:x,isExpressPaymentMethodActive:M,currentStatus:N,paymentMethodData:I,expressPaymentMethods:D,paymentMethods:L,shouldSavePayment:F}=Object(i.b)(),{setIsSuppressed:V}=Object(O.b)(),{createErrorNotice:B,removeNotice:U}=Object(b.useDispatch)("core/notices"),H=Object(n.useRef)(R),G=Object(n.useRef)(C),Y=Object(n.useRef)(o),[z,q]=Object(n.useState)(!1),W=Object(n.useMemo)(()=>{var e;const t={...D,...L};return null==t||null===(e=t[x])||void 0===e?void 0:e.paymentMethodId},[x,D,L]),X=w&&!M||N.hasError||j.hasError,K=!e&&!X&&(N.isSuccessful||!T)&&s;Object(n.useEffect)(()=>{V(M)},[M,V]),Object(n.useEffect)(()=>{X===e||!s&&!a||M||r.setHasError(X)},[X,e,s,a,M,r]),Object(n.useEffect)(()=>{H.current=R,G.current=C,Y.current=o},[R,C,o]);const $=Object(n.useCallback)(()=>!w&&(N.hasError?{errorMessage:Object(d.__)("There was a problem with your payment option.","woo-gutenberg-products-block")}:!j.hasError||{errorMessage:Object(d.__)("There was a problem with your shipping option.","woo-gutenberg-products-block")}),[w,N.hasError,j.hasError]);Object(n.useEffect)(()=>{let e;return M||(e=t($,0)),()=>{M||e()}},[t,$,M]),Object(n.useEffect)(()=>{Y.current&&(window.location.href=Y.current)},[p]);const J=Object(n.useCallback)(async()=>{if(z)return;q(!0),U("checkout");const e=T?{payment_method:W,payment_data:g(I,F,x)}:{},t={billing_address:Object(m.a)(H.current),customer_note:_,create_account:S,...e,extensions:{...k}};A&&(t.shipping_address=Object(m.a)(G.current)),f()({path:"/wc/store/v1/checkout",method:"POST",data:t,cache:"no-store",parse:!1}).then(e=>{if(E(e.headers,r),!e.ok)throw new Error(e);return e.json()}).then(e=>{r.setAfterProcessing(e),q(!1)}).catch(e=>{try{null!=e&&e.headers&&E(e.headers,r),e.json().then(e=>{var t,n,o;null!==(t=e.data)&&void 0!==t&&t.cart&&P(e.data.cart),B(Object(h.b)(e),{id:"checkout",context:"wc/checkout"}),null==e||null===(n=e.additional_errors)||void 0===n||null===(o=n.forEach)||void 0===o||o.call(n,e=>{B(e.message,{id:e.error_code,context:"wc/checkout"})}),r.setAfterProcessing(e)})}catch{var t;B(Object(d.sprintf)(// Translators: %s Error text.
|
4 |
-
Object(d.__)("%s Please try placing your order again.","woo-gutenberg-products-block"),null!==(t=null==e?void 0:e.message)&&void 0!==t?t:Object(d.__)("Something went wrong.","woo-gutenberg-products-block")),{id:"checkout",context:"wc/checkout"})}r.setHasError(!0),q(!1)})},[z,U,T,W,I,F,x,_,S,k,A,r,B,P]);return Object(n.useEffect)(()=>{K&&!z&&J()},[J,K,z]),null};const S=e=>{let{children:t,isCart:r=!1,redirectUrl:d}=e;return Object(n.createElement)(u.a,{redirectUrl:d,isCart:r},Object(n.createElement)(l.a,null,Object(n.createElement)(c.a,null,Object(n.createElement)(i.a,null,t,Object(n.createElement)(a.a,{renderError:s.CURRENT_USER_IS_ADMIN?null:()=>null},Object(n.createElement)(o.PluginArea,{scope:"woocommerce-checkout"})),Object(n.createElement)(_,null)))))}},,,,function(e,t,r){"use strict";var n=r(0);r(195),t.a=()=>Object(n.createElement)("span",{className:"wc-block-components-spinner","aria-hidden":"true"})},,function(e,t,r){"use strict";var n=r(0),o=r(1),s=r(5),a=r.n(s),i=(r(197),r(136));t.a=e=>{let{children:t,className:r,screenReaderLabel:s,showSpinner:c=!1,isLoading:l=!0}=e;return Object(n.createElement)("div",{className:a()(r,{"wc-block-components-loading-mask":l})},l&&c&&Object(n.createElement)(i.a,null),Object(n.createElement)("div",{className:a()({"wc-block-components-loading-mask__children":l}),"aria-hidden":l},t),l&&Object(n.createElement)("span",{className:"screen-reader-text"},s||Object(o.__)("Loading…","woo-gutenberg-products-block")))}},,,,function(e,t){e.exports=window.wp.keycodes},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=(e,t)=>{const r=[];return Object.keys(e).forEach(n=>{if(void 0!==t[n])switch(e[n].type){case"boolean":r[n]="false"!==t[n]&&!1!==t[n];break;case"number":r[n]=parseInt(t[n],10);break;case"array":case"object":r[n]=JSON.parse(t[n]);break;default:r[n]=t[n]}else r[n]=e[n].default}),r}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return s}));var n=r(0);const o=Object(n.createContext)({hasDarkControls:!1}),s=()=>Object(n.useContext)(o)},,,,,function(e){e.exports=JSON.parse('{"name":"woocommerce/filled-cart-block","version":"1.0.0","title":"Filled Cart","description":"Contains blocks that are displayed when the cart contains products.","category":"woocommerce","supports":{"align":["wide"],"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/empty-cart-block","version":"1.0.0","title":"Empty Cart","description":"Contains blocks that are displayed when the cart is empty.","category":"woocommerce","supports":{"align":["wide"],"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-items-block","version":"1.0.0","title":"Cart Items block","description":"Column containing cart items.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/filled-cart-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-express-payment-block","version":"1.0.0","title":"Express Checkout","description":"Provide an express payment option for your customers.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-totals-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-line-items-block","version":"1.0.0","title":"Cart Line Items","description":"Block containing current line items in Cart.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-items-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-totals-block","version":"1.0.0","title":"Cart Totals","description":"Column containing the cart totals.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"checkbox":{"type":"boolean","default":false},"text":{"type":"string","required":false},"lock":{"type":"object","default":{"remove":true}}},"parent":["woocommerce/filled-cart-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/proceed-to-checkout-block","version":"1.0.0","title":"Proceed to checkout","description":"Allow customers proceed to Checkout.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-totals-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-accepted-payment-methods-block","version":"1.0.0","title":"Accepted Payment Methods","description":"Display accepted payment methods.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":true},"parent":["woocommerce/cart-totals-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-block","version":"1.0.0","title":"Order Summary","description":"Show customers a summary of their order.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"inserter":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":true}}},"parent":["woocommerce/cart-totals-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-subtotal-block","version":"1.0.0","title":"Subtotal","description":"Shows the cart subtotal row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-fee-block","version":"1.0.0","title":"Fees","description":"Shows the cart fee row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-discount-block","version":"1.0.0","title":"Discount","description":"Shows the cart discount row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-shipping-block","version":"1.0.0","title":"Shipping","description":"Shows the cart shipping row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-coupon-form-block","version":"1.0.0","title":"Coupon Form","description":"Shows the apply coupon form.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":false,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-taxes-block","version":"1.0.0","title":"Taxes","description":"Shows the cart taxes row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"lock":{"type":"object","default":{"remove":true,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},function(e){e.exports=JSON.parse('{"name":"woocommerce/cart-order-summary-heading-block","version":"1.0.0","title":"Heading","description":"Shows the heading row.","category":"woocommerce","supports":{"align":false,"html":false,"multiple":false,"reusable":false},"attributes":{"className":{"type":"string","default":""},"content":{"type":"string","default":"Cart totals"},"lock":{"type":"object","default":{"remove":false,"move":false}}},"parent":["woocommerce/cart-order-summary-block"],"textdomain":"woo-gutenberg-products-block","apiVersion":2}')},,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t){},,function(e,t){},function(e,t,r){"use strict";r.d(t,"b",(function(){return c})),r.d(t,"a",(function(){return l}));var n=r(0),o=r(4),s=r(13),a=r.n(s);const i=Object(n.createContext)({getValidationError:()=>"",setValidationErrors:e=>{},clearValidationError:e=>{},clearAllValidationErrors:()=>{},hideValidationError:()=>{},showValidationError:()=>{},showAllValidationErrors:()=>{},hasValidationErrors:!1,getValidationErrorId:e=>e}),c=()=>Object(n.useContext)(i),l=e=>{let{children:t}=e;const[r,s]=Object(n.useState)({}),c=Object(n.useCallback)(e=>r[e],[r]),l=Object(n.useCallback)(e=>{const t=r[e];return!t||t.hidden?"":"validate-error-"+e},[r]),u=Object(n.useCallback)(e=>{s(t=>{if(!t[e])return t;const{[e]:r,...n}=t;return n})},[]),d=Object(n.useCallback)(()=>{s({})},[]),p=Object(n.useCallback)(e=>{e&&s(t=>(e=Object(o.pickBy)(e,(e,r)=>!("string"!=typeof e.message||t.hasOwnProperty(r)&&a()(t[r],e))),0===Object.values(e).length?t:{...t,...e}))},[]),f=Object(n.useCallback)((e,t)=>{s(r=>{if(!r.hasOwnProperty(e))return r;const n={...r[e],...t};return a()(r[e],n)?r:{...r,[e]:n}})},[]),m={getValidationError:c,setValidationErrors:p,clearValidationError:u,clearAllValidationErrors:d,hideValidationError:Object(n.useCallback)(e=>{f(e,{hidden:!0})},[f]),showValidationError:Object(n.useCallback)(e=>{f(e,{hidden:!1})},[f]),showAllValidationErrors:Object(n.useCallback)(()=>{s(e=>{const t={};return Object.keys(e).forEach(r=>{e[r].hidden&&(t[r]={...e[r],hidden:!1})}),0===Object.values(t).length?e:{...e,...t}})},[]),hasValidationErrors:Object.keys(r).length>0,getValidationErrorId:l};return Object(n.createElement)(i.Provider,{value:m},t)}},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(93);const o=(e,t)=>function(r){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;const s=n.a.addEventCallback(e,r,o);return t(s),()=>{t(n.a.removeEventCallback(e,s.id))}}},,function(e,t,r){"use strict";r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return a}));const n=(e,t)=>e[t]?Array.from(e[t].values()).sort((e,t)=>e.priority-t.priority):[];var o=r(31);const s=async(e,t,r)=>{const o=n(e,t),s=[];for(const e of o)try{const t=await Promise.resolve(e.callback(r));"object"==typeof t&&s.push(t)}catch(e){console.error(e)}return!s.length||s},a=async(e,t,r)=>{const s=[],a=n(e,t);for(const e of a)try{const t=await Promise.resolve(e.callback(r));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 s.push(t),s;s.push(t)}catch(e){return console.error(e),s.push({type:"error"}),s}return s}},,function(e,t,r){"use strict";r.d(t,"b",(function(){return V})),r.d(t,"a",(function(){return B}));var n=r(0),o=r(20),s=r(8);let a,i;!function(e){e.PRISTINE="pristine",e.STARTED="started",e.PROCESSING="processing",e.ERROR="has_error",e.FAILED="failed",e.SUCCESS="success",e.COMPLETE="complete"}(a||(a={})),function(e){e.SET_REGISTERED_PAYMENT_METHODS="set_registered_payment_methods",e.SET_REGISTERED_EXPRESS_PAYMENT_METHODS="set_registered_express_payment_methods",e.SET_SHOULD_SAVE_PAYMENT_METHOD="set_should_save_payment_method",e.SET_ACTIVE_PAYMENT_METHOD="set_active_payment_method"}(i||(i={}));const c={currentStatus:a.PRISTINE,shouldSavePaymentMethod:!1,activePaymentMethod:"",paymentMethodData:{payment_method:""},errorMessage:"",paymentMethods:{},expressPaymentMethods:{}},l={setPaymentStatus:()=>({pristine:()=>{},started:()=>{},processing:()=>{},completed:()=>{},error:e=>{},failed:(e,t)=>{},success:(e,t)=>{}}),currentStatus:{isPristine:!0,isStarted:!1,isProcessing:!1,isFinished:!1,hasError:!1,hasFailed:!1,isSuccessful:!1,isDoingExpressPayment:!1},paymentStatuses:a,paymentMethodData:{},errorMessage:"",activePaymentMethod:"",activeSavedToken:"",setActivePaymentMethod:()=>{},customerPaymentMethods:{},paymentMethods:{},expressPaymentMethods:{},paymentMethodsInitialized:!1,expressPaymentMethodsInitialized:!1,onPaymentProcessing:()=>()=>()=>{},setExpressPaymentError:()=>{},isExpressPaymentMethodActive:!1,setShouldSavePayment:()=>{},shouldSavePayment:!1};var u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c,{type:t,paymentMethodData:r,shouldSavePaymentMethod:n=!1,errorMessage:o="",paymentMethods:s={},paymentMethod:l=""}=arguments.length>1?arguments[1]:void 0;switch(t){case a.PRISTINE:return{...c,...e,errorMessage:"",currentStatus:a.PRISTINE};case a.STARTED:return{...e,currentStatus:a.STARTED};case a.ERROR:return e.currentStatus!==a.ERROR?{...e,currentStatus:a.ERROR,errorMessage:o||e.errorMessage}:e;case a.FAILED:return e.currentStatus!==a.FAILED?{...e,currentStatus:a.FAILED,paymentMethodData:r||e.paymentMethodData,errorMessage:o||e.errorMessage}:e;case a.SUCCESS:return e.currentStatus!==a.SUCCESS?{...e,currentStatus:a.SUCCESS,paymentMethodData:r||e.paymentMethodData}:e;case a.PROCESSING:return e.currentStatus!==a.PROCESSING?{...e,currentStatus:a.PROCESSING,errorMessage:""}:e;case a.COMPLETE:return e.currentStatus!==a.COMPLETE?{...e,currentStatus:a.COMPLETE}:e;case i.SET_REGISTERED_PAYMENT_METHODS:return{...e,paymentMethods:s};case i.SET_REGISTERED_EXPRESS_PAYMENT_METHODS:return{...e,expressPaymentMethods:s};case i.SET_SHOULD_SAVE_PAYMENT_METHOD:return{...e,shouldSavePaymentMethod:n};case i.SET_ACTIVE_PAYMENT_METHOD:return{...e,activePaymentMethod:l,paymentMethodData:r||e.paymentMethodData}}},d=r(1),p=r(17),f=r(32),m=r(2),h=r(50),b=r(23),g=r.n(b),E=r(29),y=r(49),v=r(33),O=r(31),_=r(64);const S=(e,t,r,o)=>{const[a,i]=Object(n.useState)(!1),{isEditor:c}=Object(E.a)(),{selectedRates:l}=Object(_.a)(),{billingAddress:u,shippingAddress:p}=Object(y.b)(),b=Object(f.a)(l),O=Object(f.a)(r),S=Object(v.a)(),{cartTotals:k,cartIsLoading:w,cartNeedsShipping:j,paymentRequirements:R}=S,C=Object(n.useRef)({cart:S,cartTotals:k,cartNeedsShipping:j,billingData:u,billingAddress:u,shippingAddress:p,selectedShippingMethods:b,paymentRequirements:R}),{createErrorNotice:T}=Object(s.useDispatch)("core/notices");Object(n.useEffect)(()=>{C.current={cart:S,cartTotals:k,cartNeedsShipping:j,get billingData(){return g()("billingData",{alternative:"billingAddress",plugin:"woocommerce-gutenberg-products-block",link:"https://github.com/woocommerce/woocommerce-blocks/pull/6369"}),this.billingAddress},billingAddress:u,shippingAddress:p,selectedShippingMethods:b,paymentRequirements:R}},[S,k,j,u,p,b,R]);const A=Object(n.useCallback)(async()=>{let r={};const n=e=>{r={...r,[e.name]:e}};for(let e=0;e<O.length;e++){const r=O[e],s=t[r];if(s)try{const e=!!c||await Promise.resolve(s.canMakePayment(C.current));if(e){if("object"==typeof e&&null!==e&&e.error)throw new Error(e.error.message);n(s)}}catch(e){if(m.CURRENT_USER_IS_ADMIN||c){const t=Object(d.sprintf)(
|
1 |
+
!function(e){function t(t){for(var r,o,s=t[0],a=t[1],i=0,l=[];i<s.length;i++)o=s[i],Object.prototype.hasOwnProperty.call(n,o)&&n[o]&&l.push(n[o][0]),n[o]=0;for(r in a)Object.prototype.hasOwnProperty.call(a,r)&&(e[r]=a[r]);for(c&&c(t);l.length;)l.shift()()}var r={},n={11:0,7: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 s=new Promise((function(t,o){r=n[e]=[t,o]}));t.push(r[2]=s);var a,i=document.createElement("script");i.charset="utf-8",i.timeout=120,o.nc&&i.setAttribute("nonce",o.nc),i.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",2:"vendors--cart-blocks/order-summary-shipping--checkout-blocks/billing-address--checkout-blocks/order--5b8feb0b",3:"vendors--cart-blocks/cart-line-items--checkout-blocks/order-summary-cart-items--mini-cart-contents---233ab542",4:"cart-blocks/cart-line-items--mini-cart-contents-block/products-table",5:"cart-blocks/order-summary-shipping--checkout-blocks/order-summary-shipping",12:"cart-blocks/cart-accepted-payment-methods",13:"cart-blocks/cart-express-payment",14:"cart-blocks/cart-items",15:"cart-blocks/cart-line-items",16:"cart-blocks/cart-order-summary",17:"cart-blocks/cart-totals",18:"cart-blocks/empty-cart",19:"cart-blocks/filled-cart",20:"cart-blocks/order-summary-coupon-form",21:"cart-blocks/order-summary-discount",22:"cart-blocks/order-summary-fee",23:"cart-blocks/order-summary-heading",24:"cart-blocks/order-summary-shipping",25:"cart-blocks/order-summary-subtotal",26:"cart-blocks/order-summary-taxes",27:"cart-blocks/proceed-to-checkout"}[e]||e)+"-frontend.js?ver="+{0:"1d36f73838f02eb72b0e",1:"90165bb62acb98a96150",2:"2448287d629e9e796e22",3:"80c939d54508b87a9652",4:"8e5ceec3442afbbcd088",5:"337947d2aca93194c075",12:"f90cb446fc78257b8f20",13:"ccdd653378fabae2e10a",14:"9c2d532cbcd7116e63f7",15:"e63fb6c8c3aff93eed75",16:"7e6e190fcbb02bd66799",17:"9b708988d58530ba1664",18:"9f219713921a4a4e4903",19:"69484b9278409465dab4",20:"5ce4555bbe0c746ca289",21:"fec6248cbc2216267c44",22:"8b7b8ceb031ca02b9151",23:"cecf4593154bfcc014e9",24:"30f0669c5a4c948461d1",25:"c686b68469526b776553",26:"5e265068a9f5ecbc2385",27:"ffcfc6342a4a4fb82c0d"}[e]}(e);var c=new Error;a=function(t){i.onerror=i.onload=null,clearTimeout(l);var r=n[e];if(0!==r){if(r){var o=t&&("load"===t.type?"missing":t.type),s=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+o+": "+s+")",c.name="ChunkLoadError",c.type=o,c.request=s,r[1](c)}n[e]=void 0}};var l=setTimeout((function(){a({type:"timeout",target:i})}),12e4);i.onerror=i.onload=a,document.head.appendChild(i)}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 s=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=s.push.bind(s);s.push=t,s=s.slice();for(var i=0;i<s.length;i++)t(s[i]);var c=a;o(o.s=229)}([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.React},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 s=typeof n;if("string"===s||"number"===s)e.push(n);else if(Array.isArray(n)){if(n.length){var a=o.apply(null,n);a&&e.push(a)}}else if("object"===s)if(n.toString===Object.prototype.toString)for(var i in n)r.call(n,i)&&n[i]&&e.push(i);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.wc.wcBlocksData},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.data},,function(e,t){e.exports=window.wc.blocksCheckout},function(e,t){e.exports=window.wp.compose},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.isShallowEqual},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),s=r(0),a=r(3),i=r(1),c=r(46),l=e=>{let{imageUrl:t=c.l+"/block-error.svg",header:r=Object(i.__)("Oops!","woo-gutenberg-products-block"),text:n=Object(i.__)("There was an error loading the content.","woo-gutenberg-products-block"),errorMessage:o,errorMessagePrefix:a=Object(i.__)("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"},r&&Object(s.createElement)("p",{className:"wc-block-error__header wc-block-components-error__header"},r),n&&Object(s.createElement)("p",{className:"wc-block-error__text wc-block-components-error__text"},n),o&&Object(s.createElement)("p",{className:"wc-block-error__message wc-block-components-error__message"},a?a+" ":"",o),l&&Object(s.createElement)("p",{className:"wc-block-error__button wc-block-components-error__button"},l))):null};r(34);class u extends a.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:r=!0,showErrorBlock:n=!0,text:o,errorMessagePrefix:a,renderError:i,button:c}=this.props,{errorMessage:u,hasError:d}=this.state;return d?"function"==typeof i?i({errorMessage:u}):Object(s.createElement)(l,{showErrorBlock:n,errorMessage:r?u:null,header:e,imageUrl:t,text:o,errorMessagePrefix:a,button:c}):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";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}},function(e,t){e.exports=window.wp.a11y},function(e,t,r){"use strict";(function(e){var n=r(0);r(36);const o=Object(n.createContext)({slots:{},fills:{},registerSlot:()=>{void 0!==e&&e.env},updateSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{}});t.a=o}).call(this,r(54))},,function(e,t){e.exports=window.wp.deprecated},,,,function(e,t){e.exports=window.wp.apiFetch},function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(0);r(8);const o=Object(n.createContext)({isEditor:!1,currentPostId:0,currentView:"",previewData:{},getPreviewData:()=>{}}),s=()=>Object(n.useContext)(o)},,function(e,t,r){"use strict";r.d(t,"c",(function(){return s})),r.d(t,"a",(function(){return c})),r.d(t,"b",(function(){return l})),r.d(t,"d",(function(){return d}));var n=r(20);let o,s;!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"}(s||(s={}));const a=(e,t)=>Object(n.a)(e)&&"type"in e&&e.type===t,i=e=>a(e,o.SUCCESS),c=e=>a(e,o.ERROR),l=e=>a(e,o.FAIL),u=e=>!Object(n.a)(e)||void 0===e.retry||!0===e.retry,d=()=>({responseTypes:o,noticeContexts:s,shouldRetry:u,isSuccessResponse:i,isErrorResponse:c,isFailResponse:l})},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(0),o=r(13),s=r.n(o);function a(e){const t=Object(n.useRef)(e);return s()(e,t.current)||(t.current=e),t.current}},function(e,t,r){"use strict";r.d(t,"a",(function(){return y}));var n=r(4),o=r(0),s=r(6),a=r(8),i=r(18),c=r(118),l=r(29),u=r(69);const d=e=>{const t=e.detail;t&&t.preserveCartData||Object(a.dispatch)(s.CART_STORE_KEY).invalidateResolutionForStore()},p=()=>{1===window.wcBlocksStoreCartListeners.count&&window.wcBlocksStoreCartListeners.remove(),window.wcBlocksStoreCartListeners.count--},f=()=>{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:""},h={...m,email:""},b={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:s.EMPTY_TAX_LINES,currency_code:"",currency_symbol:"",currency_minor_unit:2,currency_decimal_separator:"",currency_thousand_separator:"",currency_prefix:"",currency_suffix:""},g=e=>Object.fromEntries(Object.entries(e).map(e=>{let[t,r]=e;return[t,Object(i.decodeEntities)(r)]})),E={cartCoupons:s.EMPTY_CART_COUPONS,cartItems:s.EMPTY_CART_ITEMS,cartFees:s.EMPTY_CART_FEES,cartItemsCount:0,cartItemsWeight:0,cartNeedsPayment:!0,cartNeedsShipping:!0,cartItemErrors:s.EMPTY_CART_ITEM_ERRORS,cartTotals:b,cartIsLoading:!0,cartErrors:s.EMPTY_CART_ERRORS,billingAddress:h,shippingAddress:m,shippingRates:s.EMPTY_SHIPPING_RATES,isLoadingRates:!1,cartHasCalculatedShipping:!1,paymentRequirements:s.EMPTY_PAYMENT_REQUIREMENTS,receiveCart:()=>{},extensions:s.EMPTY_EXTENSIONS},y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{shouldSelect:!0};const{isEditor:t,previewData:r}=Object(l.a)(),i=null==r?void 0:r.previewCart,{shouldSelect:u}=e,d=Object(o.useRef)();f();const p=Object(a.useSelect)((e,r)=>{let{dispatch:n}=r;if(!u)return E;if(t)return{cartCoupons:i.coupons,cartItems:i.items,cartFees:i.fees,cartItemsCount:i.items_count,cartItemsWeight:i.items_weight,cartNeedsPayment:i.needs_payment,cartNeedsShipping:i.needs_shipping,cartItemErrors:s.EMPTY_CART_ITEM_ERRORS,cartTotals:i.totals,cartIsLoading:!1,cartErrors:s.EMPTY_CART_ERRORS,billingData:h,billingAddress:h,shippingAddress:m,extensions:s.EMPTY_EXTENSIONS,shippingRates:i.shipping_rates,isLoadingRates:!1,cartHasCalculatedShipping:i.has_calculated_shipping,paymentRequirements:i.paymentRequirements,receiveCart:"function"==typeof(null==i?void 0:i.receiveCart)?i.receiveCart:()=>{}};const o=e(s.CART_STORE_KEY),a=o.getCartData(),l=o.getCartErrors(),d=o.getCartTotals(),p=!o.hasFinishedResolution("getCartData"),f=o.isCustomerDataUpdating(),{receiveCart:b}=n(s.CART_STORE_KEY),y=g(a.billingAddress),v=a.needsShipping?g(a.shippingAddress):y,O=a.fees.length>0?a.fees.map(e=>g(e)):s.EMPTY_CART_FEES;return{cartCoupons:a.coupons.length>0?a.coupons.map(e=>({...e,label:e.code})):s.EMPTY_CART_COUPONS,cartItems:a.items,cartFees:O,cartItemsCount:a.itemsCount,cartItemsWeight:a.itemsWeight,cartNeedsPayment:a.needsPayment,cartNeedsShipping:a.needsShipping,cartItemErrors:a.errors,cartTotals:d,cartIsLoading:p,cartErrors:l,billingData:Object(c.a)(y),billingAddress:Object(c.a)(y),shippingAddress:Object(c.a)(v),extensions:a.extensions,shippingRates:a.shippingRates,isLoadingRates:f,cartHasCalculatedShipping:a.hasCalculatedShipping,paymentRequirements:a.paymentRequirements,receiveCart:b}},[u]);return d.current&&Object(n.isEqual)(d.current,p)||(d.current=p),d.current}},function(e,t){},function(e,t,r){"use strict";r.d(t,"b",(function(){return P})),r.d(t,"a",(function(){return x}));var n=r(0),o=r(1),s=r(60),a=r(24),i=r.n(a),c=r(52),l=r(20),u=r(8);let d;!function(e){e.SET_IDLE="set_idle",e.SET_PRISTINE="set_pristine",e.SET_REDIRECT_URL="set_redirect_url",e.SET_COMPLETE="set_checkout_complete",e.SET_BEFORE_PROCESSING="set_before_processing",e.SET_AFTER_PROCESSING="set_after_processing",e.SET_PROCESSING_RESPONSE="set_processing_response",e.SET_PROCESSING="set_checkout_is_processing",e.SET_HAS_ERROR="set_checkout_has_error",e.SET_NO_ERROR="set_checkout_no_error",e.SET_CUSTOMER_ID="set_checkout_customer_id",e.SET_ORDER_ID="set_checkout_order_id",e.SET_ORDER_NOTES="set_checkout_order_notes",e.INCREMENT_CALCULATING="increment_calculating",e.DECREMENT_CALCULATING="decrement_calculating",e.SET_SHIPPING_ADDRESS_AS_BILLING_ADDRESS="set_shipping_address_as_billing_address",e.SET_SHOULD_CREATE_ACCOUNT="set_should_create_account",e.SET_EXTENSION_DATA="set_extension_data"}(d||(d={}));const p=()=>({type:d.SET_IDLE}),f=e=>({type:d.SET_REDIRECT_URL,redirectUrl:e}),m=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:d.SET_COMPLETE,data:e}},h=function(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return{type:e?d.SET_HAS_ERROR:d.SET_NO_ERROR}};var b=r(2),g=r(118);let E;!function(e){e.PRISTINE="pristine",e.IDLE="idle",e.PROCESSING="processing",e.COMPLETE="complete",e.BEFORE_PROCESSING="before_processing",e.AFTER_PROCESSING="after_processing"}(E||(E={}));const y={order_id:0,customer_id:0,billing_address:{},shipping_address:{},...Object(b.getSetting)("checkoutData",{})||{}},v={redirectUrl:"",status:E.PRISTINE,hasError:!1,calculatingCount:0,orderId:y.order_id,orderNotes:"",customerId:y.customer_id,useShippingAsBilling:Object(g.b)(y.billing_address,y.shipping_address),shouldCreateAccount:!1,processingResponse:null,extensionData:{}},O=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v,{redirectUrl:t,type:r,customerId:n,orderId:o,orderNotes:s,extensionData:a,useShippingAsBilling:i,shouldCreateAccount:c,data:l}=arguments.length>1?arguments[1]:void 0,u=e;switch(r){case d.SET_PRISTINE:u=v;break;case d.SET_IDLE:u=e.status!==E.IDLE?{...e,status:E.IDLE}:e;break;case d.SET_REDIRECT_URL:u=void 0!==t&&t!==e.redirectUrl?{...e,redirectUrl:t}:e;break;case d.SET_PROCESSING_RESPONSE:u={...e,processingResponse:l};break;case d.SET_COMPLETE:u=e.status!==E.COMPLETE?{...e,status:E.COMPLETE,redirectUrl:"string"==typeof(null==l?void 0:l.redirectUrl)?l.redirectUrl:e.redirectUrl}:e;break;case d.SET_PROCESSING:u=e.status!==E.PROCESSING?{...e,status:E.PROCESSING,hasError:!1}:e,u=!1===u.hasError?u:{...u,hasError:!1};break;case d.SET_BEFORE_PROCESSING:u=e.status!==E.BEFORE_PROCESSING?{...e,status:E.BEFORE_PROCESSING,hasError:!1}:e;break;case d.SET_AFTER_PROCESSING:u=e.status!==E.AFTER_PROCESSING?{...e,status:E.AFTER_PROCESSING}:e;break;case d.SET_HAS_ERROR:u=e.hasError?e:{...e,hasError:!0},u=e.status===E.PROCESSING||e.status===E.BEFORE_PROCESSING?{...u,status:E.IDLE}:u;break;case d.SET_NO_ERROR:u=e.hasError?{...e,hasError:!1}:e;break;case d.INCREMENT_CALCULATING:u={...e,calculatingCount:e.calculatingCount+1};break;case d.DECREMENT_CALCULATING:u={...e,calculatingCount:Math.max(0,e.calculatingCount-1)};break;case d.SET_CUSTOMER_ID:u=void 0!==n?{...e,customerId:n}:e;break;case d.SET_ORDER_ID:u=void 0!==o?{...e,orderId:o}:e;break;case d.SET_SHIPPING_ADDRESS_AS_BILLING_ADDRESS:void 0!==i&&i!==e.useShippingAsBilling&&(u={...e,useShippingAsBilling:i});break;case d.SET_SHOULD_CREATE_ACCOUNT:void 0!==c&&c!==e.shouldCreateAccount&&(u={...e,shouldCreateAccount:c});break;case d.SET_ORDER_NOTES:void 0!==s&&e.orderNotes!==s&&(u={...e,orderNotes:s});break;case d.SET_EXTENSION_DATA:void 0!==a&&e.extensionData!==a&&(u={...e,extensionData:a})}return u!==e&&r!==d.SET_PRISTINE&&u.status===E.PRISTINE&&(u.status=E.IDLE),u};var _=r(18),S=r(94),k=r(201);var w=r(203),j=r(198),R=r(58),C=r(31),T=r(80);const A=Object(n.createContext)({dispatchActions:{resetCheckout:()=>{},setRedirectUrl:e=>{},setHasError:e=>{},setAfterProcessing:e=>{},incrementCalculating:()=>{},decrementCalculating:()=>{},setCustomerId:e=>{},setOrderId:e=>{},setOrderNotes:e=>{},setExtensionData:e=>{}},onSubmit:()=>{},isComplete:!1,isIdle:!1,isCalculating:!1,isProcessing:!1,isBeforeProcessing:!1,isAfterProcessing:!1,hasError:!1,redirectUrl:"",orderId:0,orderNotes:"",customerId:0,onCheckoutAfterProcessingWithSuccess:()=>()=>{},onCheckoutAfterProcessingWithError:()=>()=>{},onCheckoutBeforeProcessing:()=>()=>{},onCheckoutValidationBeforeProcessing:()=>()=>{},hasOrder:!1,isCart:!1,useShippingAsBilling:!1,setUseShippingAsBilling:e=>{},shouldCreateAccount:!1,setShouldCreateAccount:e=>{},extensionData:{}}),P=()=>Object(n.useContext)(A),x=e=>{let{children:t,redirectUrl:r,isCart:a=!1}=e;v.redirectUrl=r;const[b,g]=Object(n.useReducer)(O,v),{setValidationErrors:y}=Object(j.b)(),{createErrorNotice:P}=Object(u.useDispatch)("core/notices"),{dispatchCheckoutEvent:x}=Object(R.a)(),M=b.calculatingCount>0,{isSuccessResponse:N,isErrorResponse:I,isFailResponse:D,shouldRetry:L}=Object(C.d)(),{checkoutNotices:F,paymentNotices:V,expressPaymentNotices:B}=(()=>{const{noticeContexts:e}=Object(C.d)();return{checkoutNotices:Object(u.useSelect)(e=>e("core/notices").getNotices("wc/checkout"),[]),expressPaymentNotices:Object(u.useSelect)(t=>t("core/notices").getNotices(e.EXPRESS_PAYMENTS),[e.EXPRESS_PAYMENTS]),paymentNotices:Object(u.useSelect)(t=>t("core/notices").getNotices(e.PAYMENTS),[e.PAYMENTS])}})(),[U,H]=Object(n.useReducer)(S.b,{}),G=Object(n.useRef)(U),{onCheckoutAfterProcessingWithSuccess:Y,onCheckoutAfterProcessingWithError:z,onCheckoutValidationBeforeProcessing:q}=(e=>Object(n.useMemo)(()=>({onCheckoutAfterProcessingWithSuccess:Object(k.a)("checkout_after_processing_with_success",e),onCheckoutAfterProcessingWithError:Object(k.a)("checkout_after_processing_with_error",e),onCheckoutValidationBeforeProcessing:Object(k.a)("checkout_validation_before_processing",e)}),[e]))(H);Object(n.useEffect)(()=>{G.current=U},[U]);const W=Object(n.useMemo)(()=>function(){return i()("onCheckoutBeforeProcessing",{alternative:"onCheckoutValidationBeforeProcessing",plugin:"WooCommerce Blocks"}),q(...arguments)},[q]),X=Object(n.useMemo)(()=>({resetCheckout:()=>{g({type:d.SET_PRISTINE})},setRedirectUrl:e=>{g(f(e))},setHasError:e=>{g(h(e))},incrementCalculating:()=>{g({type:d.INCREMENT_CALCULATING})},decrementCalculating:()=>{g({type:d.DECREMENT_CALCULATING})},setCustomerId:e=>{var t;g((t=e,{type:d.SET_CUSTOMER_ID,customerId:t}))},setOrderId:e=>{g((e=>({type:d.SET_ORDER_ID,orderId:e}))(e))},setOrderNotes:e=>{g((e=>({type:d.SET_ORDER_NOTES,orderNotes:e}))(e))},setExtensionData:e=>{g((e=>({type:d.SET_EXTENSION_DATA,extensionData:e}))(e))},setAfterProcessing:e=>{const t=(e=>{const t={message:"",paymentStatus:"",redirectUrl:"",paymentDetails:{}};return"payment_result"in e&&(t.paymentStatus=e.payment_result.payment_status,t.redirectUrl=e.payment_result.redirect_url,e.payment_result.hasOwnProperty("payment_details")&&Array.isArray(e.payment_result.payment_details)&&e.payment_result.payment_details.forEach(e=>{let{key:r,value:n}=e;t.paymentDetails[r]=Object(_.decodeEntities)(n)})),"message"in e&&(t.message=Object(_.decodeEntities)(e.message)),!t.message&&"data"in e&&"status"in e.data&&e.data.status>299&&(t.message=Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block")),t})(e);var r;g(f((null==t?void 0:t.redirectUrl)||"")),g((r=t,{type:d.SET_PROCESSING_RESPONSE,data:r})),g({type:d.SET_AFTER_PROCESSING})}}),[]);Object(n.useEffect)(()=>{b.status===E.BEFORE_PROCESSING&&(Object(T.b)("error"),Object(w.a)(G.current,"checkout_validation_before_processing",{}).then(e=>{!0!==e?(Array.isArray(e)&&e.forEach(e=>{let{errorMessage:t,validationErrors:r}=e;P(t,{context:"wc/checkout"}),y(r)}),g(p()),g(h())):g({type:d.SET_PROCESSING})}))},[b.status,y,P,g]);const K=Object(s.a)(b.status),$=Object(s.a)(b.hasError);Object(n.useEffect)(()=>{if((b.status!==K||b.hasError!==$)&&b.status===E.AFTER_PROCESSING){const e={redirectUrl:b.redirectUrl,orderId:b.orderId,customerId:b.customerId,orderNotes:b.orderNotes,processingResponse:b.processingResponse};b.hasError?Object(w.b)(G.current,"checkout_after_processing_with_error",e).then(t=>{const r=(e=>{let t=null;return e.forEach(e=>{if((I(e)||D(e))&&e.message&&Object(c.a)(e.message)){const r=e.messageContext&&Object(c.a)(e.messageContent)?{context:e.messageContext}:void 0;t=e,P(e.message,r)}}),t})(t);if(null!==r)L(r)?g(p()):g(m(r));else{if(!(F.some(e=>"error"===e.status)||B.some(e=>"error"===e.status)||V.some(e=>"error"===e.status))){var n;const t=(null===(n=e.processingResponse)||void 0===n?void 0:n.message)||Object(o.__)("Something went wrong. Please contact us to get assistance.","woo-gutenberg-products-block");P(t,{id:"checkout",context:"wc/checkout"})}g(p())}}):Object(w.b)(G.current,"checkout_after_processing_with_success",e).then(e=>{let t=null,r=null;if(e.forEach(e=>{N(e)&&(t=e),(I(e)||D(e))&&(r=e)}),t&&!r)g(m(t));else if(Object(l.a)(r)){if(r.message&&Object(c.a)(r.message)){const e=r.messageContext&&Object(c.a)(r.messageContext)?{context:r.messageContext}:void 0;P(r.message,e)}L(r)?g(h(!0)):g(m(r))}else g(m())})}},[b.status,b.hasError,b.redirectUrl,b.orderId,b.customerId,b.orderNotes,b.processingResponse,K,$,X,P,I,D,N,L,F,B,V]);const J={onSubmit:Object(n.useCallback)(()=>{x("submit"),g({type:d.SET_BEFORE_PROCESSING})},[x]),isComplete:b.status===E.COMPLETE,isIdle:b.status===E.IDLE,isCalculating:M,isProcessing:b.status===E.PROCESSING,isBeforeProcessing:b.status===E.BEFORE_PROCESSING,isAfterProcessing:b.status===E.AFTER_PROCESSING,hasError:b.hasError,redirectUrl:b.redirectUrl,onCheckoutBeforeProcessing:W,onCheckoutValidationBeforeProcessing:q,onCheckoutAfterProcessingWithSuccess:Y,onCheckoutAfterProcessingWithError:z,dispatchActions:X,isCart:a,orderId:b.orderId,hasOrder:!!b.orderId,customerId:b.customerId,orderNotes:b.orderNotes,useShippingAsBilling:b.useShippingAsBilling,setUseShippingAsBilling:e=>{return g((t=e,{type:d.SET_SHIPPING_ADDRESS_AS_BILLING_ADDRESS,useShippingAsBilling:t}));var t},shouldCreateAccount:b.shouldCreateAccount,setShouldCreateAccount:e=>{return g((t=e,{type:d.SET_SHOULD_CREATE_ACCOUNT,shouldCreateAccount:t}));var t},extensionData:b.extensionData};return Object(n.createElement)(A.Provider,{value:J},t)}},function(e,t){e.exports=window.wp.warning},function(e,t,r){"use strict";var n=r(7),o=r(0),s=r(14),a=function({icon:e,className:t,...r}){const s=["dashicon","dashicons","dashicons-"+e,t].filter(Boolean).join(" ");return Object(o.createElement)("span",Object(n.a)({className:s},r))};t.a=function({icon:e=null,size:t=24,...r}){if("string"==typeof e)return Object(o.createElement)(a,Object(n.a)({icon:e},r));if(Object(o.isValidElement)(e)&&a===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===s.SVG)){const n={width:t,height:t,...e.props,...r};return Object(o.createElement)(s.SVG,n)}return Object(o.isValidElement)(e)?Object(o.cloneElement)(e,{size:t,...r}):e}},function(e,t,r){"use strict";var n=r(5),o=r.n(n),s=r(0);t.a=Object(s.forwardRef)((function({as:e="div",className:t,...r},n){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),...r,ref:n})}))},,,function(e,t){e.exports=window.wc.priceFormat},function(e,t){e.exports=window.wp.hooks},function(e,t,r){"use strict";var n=r(7),o=r(0),s=r(5),a=r.n(s),i=r(4),c=r(24),l=r.n(c),u=r(11),d=r(44),p=r(70),f=r(1);function m(e,t,r){const{defaultView:n}=t,{frameElement:o}=n;if(!o||t===r.ownerDocument)return e;const s=o.getBoundingClientRect();return new n.DOMRect(e.left+s.left,e.top+s.top,e.width,e.height)}let h=0;function b(e){const t=document.scrollingElement||document.body;e&&(h=t.scrollTop);const r=e?"add":"remove";t.classList[r]("lockscroll"),document.documentElement.classList[r]("lockscroll"),e||(t.scrollTop=h)}let g=0;function E(){return Object(o.useEffect)(()=>(0===g&&b(!0),++g,()=>{1===g&&b(!1),--g}),[]),null}var y=r(22);function v(e){const t=Object(o.useContext)(y.a),r=t.slots[e]||{},n=t.fills[e],s=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:s,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 O=Object(o.createContext)({registerSlot:()=>{},unregisterSlot:()=>{},registerFill:()=>{},unregisterFill:()=>{},getSlot:()=>{},getFills:()=>{},subscribe:()=>{}});function _({name:e,children:t,registerFill:r,unregisterFill:n}){const s=(e=>{const{getSlot:t,subscribe:r}=Object(o.useContext)(O),[n,s]=Object(o.useState)(t(e));return Object(o.useEffect)(()=>(s(t(e)),r(()=>{s(t(e))})),[e]),n})(e),a=Object(o.useRef)({name:e,children:t});return Object(o.useLayoutEffect)(()=>(r(e,a.current),()=>n(e,a.current)),[]),Object(o.useLayoutEffect)(()=>{a.current.children=t,s&&s.forceUpdate()},[t]),Object(o.useLayoutEffect)(()=>{e!==a.current.name&&(n(a.current.name,a.current),a.current.name=e,r(e,a.current))},[e]),s&&s.node?(Object(i.isFunction)(t)&&(t=t(s.props.fillProps)),Object(o.createPortal)(t,s.node)):null}var S=e=>Object(o.createElement)(O.Consumer,null,({registerFill:t,unregisterFill:r})=>Object(o.createElement)(_,Object(n.a)({},e,{registerFill:t,unregisterFill:r})));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: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,s=Object(i.map)(n(t,this),e=>{const t=Object(i.isFunction)(e.children)?e.children(r):e.children;return o.Children.map(t,(e,t)=>{if(!e||Object(i.isString)(e))return e;const r=e.key||t;return Object(o.cloneElement)(e,{key:r})})}).filter(Object(i.negate)(o.isEmptyElement));return Object(o.createElement)(o.Fragment,null,Object(i.isFunction)(e)?e(s):s)}}var w=e=>Object(o.createElement)(O.Consumer,null,({registerSlot:t,unregisterSlot:r,getFills:s})=>Object(o.createElement)(k,Object(n.a)({},e,{registerSlot:t,unregisterSlot:r,getFills:s})));function j(){const[,e]=Object(o.useState)({}),t=Object(o.useRef)(!0);return Object(o.useEffect)(()=>()=>{t.current=!1},[]),()=>{t.current&&e({})}}function R({name:e,children:t}){const r=v(e),n=Object(o.useRef)({rerender:j()});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",...s},a){const i=Object(o.useContext)(y.a),c=Object(o.useRef)();return Object(o.useLayoutEffect)(()=>(i.registerSlot(e,c,t),()=>{i.unregisterSlot(e,c)}),[i.registerSlot,i.unregisterSlot,e]),Object(o.useLayoutEffect)(()=>{i.updateSlot(e,t)}),Object(o.createElement)(r,Object(n.a)({ref:Object(u.useMergeRefs)([a,c])},s))}));function T(e){return Object(o.createElement)(o.Fragment,null,Object(o.createElement)(S,e),Object(o.createElement)(R,e))}r(13),o.Component;const A=Object(o.forwardRef)(({bubblesVirtually:e,...t},r)=>e?Object(o.createElement)(C,Object(n.a)({},t,{ref:r})):Object(o.createElement)(w,t));function P(e){return"appear"===e?"top":"left"}function x(e,t){const{paddingTop:r,paddingBottom:n,paddingLeft:o,paddingRight:s}=(a=t).ownerDocument.defaultView.getComputedStyle(a);var a;const i=r?parseInt(r,10):0,c=n?parseInt(n,10):0,l=o?parseInt(o,10):0,u=s?parseInt(s,10):0;return{x:e.left+l,y:e.top+i,width:e.width-l-u,height:e.height-i-c,left:e.left+l,right:e.right-u,top:e.top+i,bottom:e.bottom-c}}function M(e,t,r){r?e.getAttribute(t)!==r&&e.setAttribute(t,r):e.hasAttribute(t)&&e.removeAttribute(t)}function N(e,t,r=""){e.style[t]!==r&&(e.style[t]=r)}function I(e,t,r){r?e.classList.contains(t)||e.classList.add(t):e.classList.contains(t)&&e.classList.remove(t)}const D=Object(o.forwardRef)(({headerTitle:e,onClose:t,children:r,className:s,noArrow:i=!0,isAlternate:c,position:h="bottom right",range:b,focusOnMount:g="firstElement",anchorRef:y,shouldAnchorIncludePadding:O,anchorRect:_,getAnchorRect:S,expandOnMobile:k,animate:w=!0,onClickOutside:j,onFocusOutside:R,__unstableStickyBoundaryElement:C,__unstableSlotName:A="Popover",__unstableObserveElement:D,__unstableBoundaryParent:L,__unstableForcePosition:F,__unstableForceXAlignment:V,...B},U)=>{const H=Object(o.useRef)(null),G=Object(o.useRef)(null),Y=Object(o.useRef)(),z=Object(u.useViewportMatch)("medium","<"),[q,X]=Object(o.useState)(),K=v(A),$=k&&z,[J,Q]=Object(u.useResizeObserver)();i=$||i,Object(o.useLayoutEffect)(()=>{if($)return I(Y.current,"is-without-arrow",i),I(Y.current,"is-alternate",c),M(Y.current,"data-x-axis"),M(Y.current,"data-y-axis"),N(Y.current,"top"),N(Y.current,"left"),N(G.current,"maxHeight"),void N(G.current,"maxWidth");const e=()=>{if(!Y.current||!G.current)return;let e=function(e,t,r,n=!1,o,s){if(t)return t;if(r){if(!e.current)return;const t=r(e.current);return m(t,t.ownerDocument||e.current.ownerDocument,s)}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,s);if("function"==typeof(null==n?void 0:n.getBoundingClientRect)){const e=m(n.getBoundingClientRect(),n.ownerDocument,s);return o?e:x(e,n)}const{top:e,bottom:t}=n,r=e.getBoundingClientRect(),a=t.getBoundingClientRect(),i=m(new window.DOMRect(r.left,r.top,r.width,a.bottom-r.top),e.ownerDocument,s);return o?i:x(i,n)}if(!e.current)return;const{parentNode:a}=e.current,i=a.getBoundingClientRect();return o?i:x(i,a)}(H,_,S,y,O,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 s;L&&(n=null===(s=Y.current.closest(".popover-slot"))||void 0===s?void 0:s.parentNode);const a=Q.height?Q:G.current.getBoundingClientRect(),{popoverTop:l,popoverLeft:u,xAxis:p,yAxis:b,contentHeight:g,contentWidth:E}=function(e,t,r="top",n,o,s,a,i,c){const[l,u="center",d]=r.split(" "),p=function(e,t,r,n,o,s,a,i){const{height:c}=t;if(o){const t=o.getBoundingClientRect().top+c-a;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-c/2>0?c/2:l)+(l+c/2>window.innerHeight?window.innerHeight-l:c/2)},d={popoverTop:e.top,contentHeight:e.top-10-c>0?c:e.top-10},p={popoverTop:e.bottom,contentHeight:e.bottom+10+c>window.innerHeight?window.innerHeight-10-e.bottom:c};let f,m=r,h=null;if(!o&&!i)if("middle"===r&&u.contentHeight===c)m="middle";else if("top"===r&&d.contentHeight===c)m="top";else if("bottom"===r&&p.contentHeight===c)m="bottom";else{m=d.contentHeight>p.contentHeight?"top":"bottom";const e="top"===m?d.contentHeight:p.contentHeight;h=e!==c?e:null}return f="middle"===m?u.popoverTop:"top"===m?d.popoverTop:p.popoverTop,{yAxis:m,popoverTop:f,contentHeight:h}}(e,t,l,d,n,0,s,i);return{...function(e,t,r,n,o,s,a,i,c){const{width:l}=t;"left"===r&&Object(f.isRTL)()?r="right":"right"===r&&Object(f.isRTL)()&&(r="left"),"left"===n&&Object(f.isRTL)()?n="right":"right"===n&&Object(f.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"===s||c||(p=u);let m=e.right;"left"===n?m=e.left:"middle"===s||c||(m=u);const h={popoverLeft:p,contentWidth:p-l>0?l:p},b={popoverLeft:m,contentWidth:m+l>window.innerWidth?window.innerWidth-m:l};let g,E=r,y=null;if(!o&&!i)if("center"===r&&d.contentWidth===l)E="center";else if("left"===r&&h.contentWidth===l)E="left";else if("right"===r&&b.contentWidth===l)E="right";else{E=h.contentWidth>b.contentWidth?"left":"right";const e="left"===E?h.contentWidth:b.contentWidth;l>window.innerWidth&&(y=window.innerWidth),e!==l&&(E="center",d.popoverLeft=window.innerWidth/2)}if(g="center"===E?d.popoverLeft:"left"===E?h.popoverLeft:b.popoverLeft,a){const e=a.getBoundingClientRect();g=Math.min(g,e.right-l),Object(f.isRTL)()||(g=Math.max(g,0))}return{xAxis:E,popoverLeft:g,contentWidth:y}}(e,t,u,d,n,p.yAxis,a,i,c),...p}}(e,a,h,C,Y.current,o,n,F,V);"number"==typeof l&&"number"==typeof u&&(N(Y.current,"top",l+"px"),N(Y.current,"left",u+"px")),I(Y.current,"is-without-arrow",i||"center"===p&&"middle"===b),I(Y.current,"is-alternate",c),M(Y.current,"data-x-axis",p),M(Y.current,"data-y-axis",b),N(G.current,"maxHeight","number"==typeof g?g+"px":""),N(G.current,"maxWidth","number"==typeof E?E+"px":""),X(({left:"right",right:"left"}[p]||"center")+" "+({top:"bottom",bottom:"top"}[b]||"middle"))};e();const{ownerDocument:t}=Y.current,{defaultView:r}=t,n=r.setInterval(e,500);let o;const s=()=>{r.cancelAnimationFrame(o),o=r.requestAnimationFrame(e)};r.addEventListener("click",s),r.addEventListener("resize",e),r.addEventListener("scroll",e,!0);const a=function(e){if(e)return e.endContainer?e.endContainer.ownerDocument:e.top?e.top.ownerDocument:e.ownerDocument}(y);let l;return a&&a!==t&&(a.defaultView.addEventListener("resize",e),a.defaultView.addEventListener("scroll",e,!0)),D&&(l=new r.MutationObserver(e),l.observe(D,{attributes:!0})),()=>{r.clearInterval(n),r.removeEventListener("resize",e),r.removeEventListener("scroll",e,!0),r.removeEventListener("click",s),r.cancelAnimationFrame(o),a&&a!==t&&(a.defaultView.removeEventListener("resize",e),a.defaultView.removeEventListener("scroll",e,!0)),l&&l.disconnect()}},[$,_,S,y,O,h,Q,C,D,L]);const Z=(e,r)=>{if("focus-outside"===e&&R)R(r);else if("focus-outside"===e&&j){const e=new window.MouseEvent("click");Object.defineProperty(e,"target",{get:()=>r.relatedTarget}),l()("Popover onClickOutside prop",{since:"5.3",alternative:"onFocusOutside"}),j(e)}else t&&t()},[ee,te]=Object(u.__experimentalUseDialog)({focusOnMount:g,__unstableOnClose:Z,onClose:Z}),re=Object(u.useMergeRefs)([Y,ee,U]),ne=Boolean(w&&q)&&function(e){if("loading"===e.type)return a()("components-animate__loading");const{type:t,origin:r=P(t)}=e;if("appear"===t){const[e,t="center"]=r.split(" ");return a()("components-animate__appear",{["is-from-"+t]:"center"!==t,["is-from-"+e]:"middle"!==e})}return"slide-in"===t?a()("components-animate__slide-in","is-from-"+r):void 0}({type:"appear",origin:q});let oe=Object(o.createElement)("div",Object(n.a)({className:a()("components-popover",s,ne,{"is-expanded":$,"is-without-arrow":i,"is-alternate":c})},B,{ref:re},te,{tabIndex:"-1"}),$&&Object(o.createElement)(E,null),$&&Object(o.createElement)("div",{className:"components-popover__header"},Object(o.createElement)("span",{className:"components-popover__header-title"},e),Object(o.createElement)(W,{className:"components-popover__close",icon:p.a,onClick:t})),Object(o.createElement)("div",{ref:G,className:"components-popover__content"},Object(o.createElement)("div",{style:{position:"relative"}},J,r)));return K.ref&&(oe=Object(o.createElement)(T,{name:A},oe)),y||_?oe:Object(o.createElement)("span",{ref:H},oe)});D.Slot=Object(o.forwardRef)((function({name:e="Popover"},t){return Object(o.createElement)(A,{bubblesVirtually:!0,name:e,className:"popover-slot",ref:t})}));var L=D,F=function({shortcut:e,className:t}){if(!e)return null;let r,n;return Object(i.isString)(e)&&(r=e),Object(i.isObject)(e)&&(r=e.display,n=e.ariaLabel),Object(o.createElement)("span",{className:t,"aria-label":n},r)};const V=Object(o.createElement)("div",{className:"event-catcher"}),B=({eventHandlers:e,child:t,childrenWithPopover:r})=>Object(o.cloneElement)(Object(o.createElement)("span",{className:"disabled-element-wrapper"},Object(o.cloneElement)(V,e),Object(o.cloneElement)(t,{children:r}),","),e),U=({child:e,eventHandlers:t,childrenWithPopover:r})=>Object(o.cloneElement)(e,{...t,children:r}),H=(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 G=function({children:e,position:t,text:r,shortcut:n}){const[s,a]=Object(o.useState)(!1),[c,l]=Object(o.useState)(!1),d=Object(u.useDebounce)(l,700),p=t=>{H(e,"onMouseDown",t),document.addEventListener("mouseup",h),a(!0)},f=t=>{H(e,"onMouseUp",t),document.removeEventListener("mouseup",h),a(!1)},m=e=>"mouseUp"===e?f:"mouseDown"===e?p:void 0,h=m("mouseUp"),b=(t,r)=>n=>{if(H(e,t,n),n.currentTarget.disabled)return;if("focus"===n.type&&s)return;d.cancel();const o=Object(i.includes)(["focus","mouseenter"],n.type);o!==c&&(r?d(o):l(o))},g=()=>{d.cancel(),document.removeEventListener("mouseup",h)};if(Object(o.useEffect)(()=>g,[]),1!==o.Children.count(e))return e;const E={onMouseEnter:b("onMouseEnter",!0),onMouseLeave:b("onMouseLeave"),onClick:b("onClick"),onFocus:b("onFocus"),onBlur:b("onBlur"),onMouseDown:m("mouseDown")},y=o.Children.only(e),{children:v,disabled:O}=y.props;return(O?B:U)({child:y,eventHandlers:E,childrenWithPopover:(({grandchildren:e,isOver:t,position:r,text:n,shortcut:s})=>Object(o.concatChildren)(e,t&&Object(o.createElement)(L,{focusOnMount:!1,position:r,className:"components-tooltip","aria-hidden":"true",animate:!1,noArrow:!0},n,Object(o.createElement)(F,{className:"components-tooltip__shortcut",shortcut:s}))))({grandchildren:v,isOver:c,position:t,text:r,shortcut:n})})},Y=r(37),z=r(38);const q=["onMouseDown","onClick"];var W=t.a=Object(o.forwardRef)((function(e,t){const{href:r,target:s,isSmall:c,isPressed:u,isBusy:d,isDestructive:p,className:f,disabled:m,icon:h,iconPosition:b="left",iconSize:g,showTooltip:E,tooltipPosition:y,shortcut:v,label:O,children:_,text:S,variant:k,__experimentalIsFocusable:w,describedBy:j,...R}=function({isDefault:e,isPrimary:t,isSecondary:r,isTertiary:n,isLink:o,variant:s,...a}){let i=s;var c,u,d,p,f;return t&&(null!==(c=i)&&void 0!==c||(i="primary")),n&&(null!==(u=i)&&void 0!==u||(i="tertiary")),r&&(null!==(d=i)&&void 0!==d||(i="secondary")),e&&(l()("Button isDefault prop",{since:"5.4",alternative:'variant="secondary"'}),null!==(p=i)&&void 0!==p||(i="secondary")),o&&(null!==(f=i)&&void 0!==f||(i="link")),{...a,variant:i}}(e),C=a()("components-button",f,{"is-secondary":"secondary"===k,"is-primary":"primary"===k,"is-small":c,"is-tertiary":"tertiary"===k,"is-pressed":u,"is-busy":d,"is-link":"link"===k,"is-destructive":p,"has-text":!!h&&!!_,"has-icon":!!h}),T=m&&!w,A=void 0===r||T?"button":"a",P="a"===A?{href:r,target:s}:{type:"button",disabled:T,"aria-pressed":u};if(m&&w){P["aria-disabled"]=!0;for(const e of q)R[e]=e=>{e.stopPropagation(),e.preventDefault()}}const x=!T&&(E&&O||v||!!O&&(!_||Object(i.isArray)(_)&&!_.length)&&!1!==E),M=j?Object(i.uniqueId)():null,N=R["aria-describedby"]||M,I=Object(o.createElement)(A,Object(n.a)({},P,R,{className:C,"aria-label":R["aria-label"]||O,"aria-describedby":N,ref:t}),h&&"left"===b&&Object(o.createElement)(Y.a,{icon:h,size:g}),S&&Object(o.createElement)(o.Fragment,null,S),h&&"right"===b&&Object(o.createElement)(Y.a,{icon:h,size:g}),_);return x?Object(o.createElement)(o.Fragment,null,Object(o.createElement)(G,{text:j||O,shortcut:v,position:y},I),j&&Object(o.createElement)(z.a,null,Object(o.createElement)("span",{id:M},j))):Object(o.createElement)(o.Fragment,null,I,j&&Object(o.createElement)(z.a,null,Object(o.createElement)("span",{id:M},j)))}))},function(e,t){e.exports=window.wp.dom},,function(e,t,r){"use strict";r.d(t,"n",(function(){return s})),r.d(t,"l",(function(){return a})),r.d(t,"k",(function(){return i})),r.d(t,"m",(function(){return c})),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 f})),r.d(t,"e",(function(){return m})),r.d(t,"g",(function(){return h})),r.d(t,"a",(function(){return b})),r.d(t,"h",(function(){return g})),r.d(t,"b",(function(){return E}));var n,o=r(2);const s=Object(o.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),a=s.pluginUrl+"images/",i=s.pluginUrl+"build/",c=s.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),f=(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"),h=Object(o.getSetting)("shippingCountries",{}),b=Object(o.getSetting)("allowedCountries",{}),g=Object(o.getSetting)("shippingStates",{}),E=Object(o.getSetting)("allowedStates",{})},function(e,t,r){"use strict";var n=r(2),o=r(1),s=r(71),a=r(52);const i=Object(n.getSetting)("countryLocale",{}),c=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(s.a)(e.priority)&&(t.index=e.priority),Object(a.a)(e.priority)&&(t.index=parseInt(e.priority,10))),e.hidden&&(t.required=!1),t},l=Object.entries(i).map(e=>{let[t,r]=e;return[t,Object.entries(r).map(e=>{let[t,r]=e;return[t,c(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,"b",(function(){return a})),r.d(t,"a",(function(){return i}));var n=r(0),o=r(66);const s=Object(n.createContext)({isInitialized:!1,billingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",email:"",phone:""},shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:"",phone:""},setBillingAddress:()=>{},setShippingAddress:()=>{}}),a=()=>Object(n.useContext)(s),i=e=>{let{children:t}=e;const r=Object(o.a)();return Object(n.createElement)(s.Provider,{value:r},t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(3);function o(e,t,r){var o=this,s=Object(n.useRef)(null),a=Object(n.useRef)(0),i=Object(n.useRef)(null),c=Object(n.useRef)([]),l=Object(n.useRef)(),u=Object(n.useRef)(),d=Object(n.useRef)(e),p=Object(n.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 m=!!(r=r||{}).leading,h=!("trailing"in r)||!!r.trailing,b="maxWait"in r,g=b?Math.max(+r.maxWait||0,t):null;return Object(n.useEffect)((function(){return p.current=!0,function(){p.current=!1}}),[]),Object(n.useMemo)((function(){var e=function(e){var t=c.current,r=l.current;return c.current=l.current=null,a.current=e,u.current=d.current.apply(r,t)},r=function(e,t){f&&cancelAnimationFrame(i.current),i.current=f?requestAnimationFrame(e):setTimeout(e,t)},n=function(e){if(!p.current)return!1;var r=e-s.current,n=e-a.current;return!s.current||r>=t||r<0||b&&n>=g},E=function(t){return i.current=null,h&&c.current?e(t):(c.current=l.current=null,u.current)},y=function(){var e=Date.now();if(n(e))return E(e);if(p.current){var o=e-s.current,i=e-a.current,c=t-o,l=b?Math.min(c,g-i):c;r(y,l)}},v=function(){for(var d=[],f=0;f<arguments.length;f++)d[f]=arguments[f];var h=Date.now(),g=n(h);if(c.current=d,l.current=o,s.current=h,g){if(!i.current&&p.current)return a.current=s.current,r(y,t),m?e(s.current):u.current;if(b)return r(y,t),e(s.current)}return i.current||r(y,t),u.current};return v.cancel=function(){i.current&&(f?cancelAnimationFrame(i.current):clearTimeout(i.current)),a.current=0,c.current=s.current=l.current=i.current=null},v.isPending=function(){return!!i.current},v.flush=function(){return i.current?E(Date.now()):u.current},v}),[m,b,t,g,h,f])}},function(e,t,r){"use strict";r.d(t,"a",(function(){return l}));var n=r(12),o=r.n(n),s=r(0),a=r(16);const i=[".wp-block-woocommerce-cart"],c=e=>{let{Block:t,containers:r,getProps:n=(()=>({})),getErrorBoundaryProps:i=(()=>({}))}=e;0!==r.length&&Array.prototype.forEach.call(r,(e,r)=>{const c=n(e,r),l=i(e,r),u={...e.dataset,...c.attributes||{}};(e=>{let{Block:t,container:r,attributes:n={},props:i={},errorBoundaryProps:c={}}=e;Object(s.render)(Object(s.createElement)(a.a,c,Object(s.createElement)(s.Suspense,{fallback:Object(s.createElement)("div",{className:"wc-block-placeholder"})},t&&Object(s.createElement)(t,o()({},i,{attributes:n})))),r,()=>{r.classList&&r.classList.remove("is-loading")})})({Block:t,container:e,props:c,attributes:u,errorBoundaryProps:l})})},l=e=>{const t=document.body.querySelectorAll(i.join(",")),{Block:r,getProps:n,getErrorBoundaryProps:o,selector:s}=e;(e=>{let{Block:t,getProps:r,getErrorBoundaryProps:n,selector:o,wrappers:s}=e;const a=document.body.querySelectorAll(o);s&&s.length>0&&Array.prototype.filter.call(a,e=>!((e,t)=>Array.prototype.some.call(t,t=>t.contains(e)&&!t.isSameNode(e)))(e,s)),c({Block:t,containers:a,getProps:r,getErrorBoundaryProps:n})})({Block:r,getProps:n,getErrorBoundaryProps:o,selector:s,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:s}=e;const a=s.querySelectorAll(o);c({Block:t,containers:a,getProps:r,getErrorBoundaryProps:n})})({...e,wrapper:t})})})}},function(e,t,r){"use strict";r.d(t,"a",(function(){return n}));const n=e=>"string"==typeof e},,function(e,t){var r,n,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function i(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!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:s}catch(e){r=s}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var c,l=[],u=!1,d=-1;function p(){u&&c&&(u=!1,c.length?l=c.concat(l):d=-1,l.length&&f())}function f(){if(!u){var e=i(p);u=!0;for(var t=l.length;t;){for(c=l,l=[];++d<t;)c&&c[d].run();d=-1,t=l.length}c=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!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 h(){}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||i(f)},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=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}},function(e,t,r){var n=r(83),o=r(56),s=o.setStyleProp,a=n.html,i=n.svg,c=n.isCustomAttribute,l=Object.prototype.hasOwnProperty;e.exports=function(e){var t,r,n,u;e=e||{};var d={};for(t in e)n=e[t],c(t)?d[t]=n:(r=t.toLowerCase(),l.call(a,r)?d[(u=a[r]).propertyName]=!!(u.hasBooleanValue||u.hasOverloadedBooleanValue&&!n)||n:l.call(i,t)?d[(u=i[t]).propertyName]=n:o.PRESERVE_CUSTOM_ATTRIBUTES&&(d[t]=n));return s(e.style,d),d}},function(e,t,r){var n=r(3),o=r(87).default,s={reactCompat:!0},a=n.version.split(".")[0]>=16;e.exports={PRESERVE_CUSTOM_ATTRIBUTES:a,invertObject:function(e,t){if(!e||"object"!=typeof e)throw new TypeError("First argument must be an object");var r,n,o="function"==typeof t,s={},a={};for(r in e)n=e[r],o&&(s=t(r,n))&&2===s.length?a[s[0]]=s[1]:"string"==typeof n&&(a[n]=r);return a},isCustomComponent:function(e,t){if(-1===e.indexOf("-"))return t&&"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}},setStyleProp:function(e,t){null!=e&&(t.style=o(e,s))}}},function(e,t,r){for(var n,o=r(93).CASE_SENSITIVE_TAG_NAMES,s={},a=0,i=o.length;a<i;a++)n=o[a],s[n.toLowerCase()]=n;function c(e){for(var t,r={},n=0,o=e.length;n<o;n++)r[(t=e[n]).name]=t.value;return r}function l(e){return function(e){return s[e]}(e=e.toLowerCase())||e}e.exports={formatAttributes:c,formatDOM:function e(t,r,n){r=r||null;for(var o,s,a,i=[],u=0,d=t.length;u<d;u++){switch(o=t[u],a={next:null,prev:i[u-1]||null,parent:r},(s=i[u-1])&&(s.next=a),"#"!==o.nodeName[0]&&(a.name=l(o.nodeName),a.attribs={},o.attributes&&o.attributes.length&&(a.attribs=c(o.attributes))),o.nodeType){case 1:"script"===a.name||"style"===a.name?a.type=a.name:a.type="tag",a.children=e(o.childNodes,a);break;case 3:a.type="text",a.data=o.nodeValue;break;case 8:a.type="comment",a.data=o.nodeValue}i.push(a)}return n&&(i.unshift({name:n.substring(0,n.indexOf(" ")).toLowerCase(),data:n,type:"directive",next:i[0]?i[0]:null,prev:null,parent:r}),i[1]&&(i[1].prev=i[0])),i},isIE:function(e){return e?document.documentMode===e:/(MSIE |Trident\/|Edge\/)/.test(navigator.userAgent)}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return a}));var n=r(42),o=r(0),s=r(33);const a=()=>{const e=Object(s.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 s})),r.d(t,"a",(function(){return a}));var n=r(0);const o=Object(n.createContext)({setIsSuppressed:e=>{},isSuppressed:!1}),s=()=>Object(n.useContext)(o),a=e=>{let{children:t}=e;const[r,s]=Object(n.useState)(!1),a={setIsSuppressed:s,isSuppressed:r};return Object(n.createElement)(o.Provider,{value:a},t)}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o}));var n=r(3);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){var n=r(82),o=r(55),s=r(91),a={decodeEntities:!0,lowerCaseAttributeNames:!1};function i(e,t){if("string"!=typeof e)throw new TypeError("First argument must be a string");return""===e?[]:n(s(e,(t=t||{}).htmlparser2||a),t)}i.domToReact=n,i.htmlToDOM=s,i.attributesToProps=o,e.exports=i,e.exports.default=i},,,function(e,t,r){"use strict";r.d(t,"a",(function(){return u}));var n=r(6),o=r(8),s=r(0),a=r(13),i=r.n(a),c=r(20),l=r(68);const u=()=>{const{shippingRates:e,needsShipping:t,hasCalculatedShipping:r,isLoadingRates:a}=Object(o.useSelect)(e=>{const t=e(n.CART_STORE_KEY);return{shippingRates:t.getShippingRates(),needsShipping:t.getNeedsShipping(),hasCalculatedShipping:t.getHasCalculatedShipping(),isLoadingRates:t.isCustomerDataUpdating()}}),{isSelectingRate:u,selectShippingRate:d}=Object(l.a)(),p=Object(s.useRef)({});return Object(s.useEffect)(()=>{const t=(e=>Object.fromEntries(e.map(e=>{var t;let{package_id:r,shipping_rates:n}=e;return[r,null===(t=n.find(e=>e.selected))||void 0===t?void 0:t.rate_id]})))(e);Object(c.a)(t)&&!i()(p.current,t)&&(p.current=t)},[e]),{isSelectingRate:u,selectedRates:p.current,selectShippingRate:d,shippingRates:e,needsShipping:t,hasCalculatedShipping:r,isLoadingRates:a}}},,function(e,t,r){"use strict";r.d(t,"a",(function(){return s}));var n=r(8),o=r(6);const s=()=>{const{customerData:e,isInitialized:t}=Object(n.useSelect)(e=>{const t=e(o.CART_STORE_KEY);return{customerData:t.getCustomerData(),isInitialized:t.hasFinishedResolution("getCartData")}}),{setShippingAddress:r,setBillingAddress:s}=Object(n.useDispatch)(o.CART_STORE_KEY);return{isInitialized:t,billingAddress:e.billingAddress,shippingAddress:e.shippingAddress,setBillingAddress:s,setShippingAddress:r}}},function(e,t,r){"use strict";r.d(t,"b",(function(){return v})),r.d(t,"a",(function(){return O}));var n=r(0);const o={NONE:"none",INVALID_ADDRESS:"invalid_address",UNKNOWN:"unknown_error"},s={INVALID_COUNTRY:"woocommerce_rest_cart_shipping_rates_invalid_country",MISSING_COUNTRY:"woocommerce_rest_cart_shipping_rates_missing_country",INVALID_STATE:"woocommerce_rest_cart_shipping_rates_invalid_state"},a={shippingErrorStatus:{isPristine:!0,isValid:!1,hasInvalidAddress:!1,hasError:!1},dispatchErrorStatus:()=>null,shippingErrorTypes:o,shippingRates:[],isLoadingRates:!1,selectedRates:[],setSelectedRates:()=>null,shippingAddress:{first_name:"",last_name:"",company:"",address_1:"",address_2:"",city:"",state:"",postcode:"",country:""},setShippingAddress:()=>null,onShippingRateSuccess:()=>null,onShippingRateFail:()=>null,onShippingRateSelectSuccess:()=>null,onShippingRateSelectFail:()=>null,needsShipping:!1},i=(e,t)=>{let{type:r}=t;return Object.values(o).includes(r)?r:e};var c=r(94),l=r(201);const u=e=>({onSuccess:Object(l.a)("shipping_rates_success",e),onFail:Object(l.a)("shipping_rates_fail",e),onSelectSuccess:Object(l.a)("shipping_rate_select_success",e),onSelectFail:Object(l.a)("shipping_rate_select_fail",e)});var d=r(203),p=r(35),f=r(33),m=r(68),h=r(64);const{NONE:b,INVALID_ADDRESS:g,UNKNOWN:E}=o,y=Object(n.createContext)(a),v=()=>Object(n.useContext)(y),O=e=>{let{children:t}=e;const{dispatchActions:r}=Object(p.b)(),{shippingRates:a,isLoadingRates:l,cartErrors:v}=Object(f.a)(),{isSelectingRate:O}=Object(m.a)(),{selectedRates:_}=Object(h.a)(),[S,k]=Object(n.useReducer)(i,b),[w,j]=Object(n.useReducer)(c.b,{}),R=Object(n.useRef)(w),C=Object(n.useMemo)(()=>({onShippingRateSuccess:u(j).onSuccess,onShippingRateFail:u(j).onFail,onShippingRateSelectSuccess:u(j).onSelectSuccess,onShippingRateSelectFail:u(j).onSelectFail}),[j]);Object(n.useEffect)(()=>{R.current=w},[w]),Object(n.useEffect)(()=>{l?r.incrementCalculating():r.decrementCalculating()},[l,r]),Object(n.useEffect)(()=>{O?r.incrementCalculating():r.decrementCalculating()},[O,r]),Object(n.useEffect)(()=>{v.length>0&&v.some(e=>!(!e.code||!Object.values(s).includes(e.code)))?k({type:g}):k({type:b})},[v]);const T=Object(n.useMemo)(()=>({isPristine:S===b,isValid:S===b,hasInvalidAddress:S===g,hasError:S===E||S===g}),[S]);Object(n.useEffect)(()=>{l||0!==a.length&&!T.hasError||Object(d.a)(R.current,"shipping_rates_fail",{hasInvalidAddress:T.hasInvalidAddress,hasError:T.hasError})},[a,l,T.hasError,T.hasInvalidAddress]),Object(n.useEffect)(()=>{!l&&a.length>0&&!T.hasError&&Object(d.a)(R.current,"shipping_rates_success",a)},[a,l,T.hasError]),Object(n.useEffect)(()=>{O||(T.hasError?Object(d.a)(R.current,"shipping_rate_select_fail",{hasError:T.hasError,hasInvalidAddress:T.hasInvalidAddress}):Object(d.a)(R.current,"shipping_rate_select_success",_.current))},[_,O,T.hasError,T.hasInvalidAddress]);const A={shippingErrorStatus:T,dispatchErrorStatus:k,shippingErrorTypes:o,...C};return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(y.Provider,{value:A},t))}},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(8),o=r(0),s=r(6),a=r(74),i=r(58);const c=()=>{const e=Object(a.a)(),{dispatchCheckoutEvent:t}=Object(i.a)(),{selectShippingRate:r}=Object(n.useDispatch)(s.CART_STORE_KEY);return{selectShippingRate:Object(o.useCallback)((n,o)=>{r(n,o).then(()=>{t("set-selected-shipping-rate",{shippingRateId:n})}).catch(t=>{e(t)})},[r,t,e]),isSelectingRate:Object(n.useSelect)(e=>e(s.CART_STORE_KEY).isShippingRateBeingSelected(),[])}}},function(e,t,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"d",(function(){return a})),r.d(t,"c",(function(){return i})),r.d(t,"b",(function(){return c}));const n=window.CustomEvent||null,o=(e,t)=>{let{bubbles:r=!1,cancelable:o=!1,element:s,detail:a={}}=t;if(!n)return;s||(s=document.body);const i=new n(e,{bubbles:r,cancelable:o,detail:a});s.dispatchEvent(i)};let s;const a=()=>{s&&clearTimeout(s),s=setTimeout(()=>{o("wc_fragment_refresh",{bubbles:!0,cancelable:!0})},50)},i=e=>{let{preserveCartData:t=!1}=e;o("wc-blocks_added_to_cart",{bubbles:!0,cancelable:!0,detail:{preserveCartData:t}})},c=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 s=()=>{o(t,{bubbles:r,cancelable:n})};return jQuery(document).on(e,s),()=>jQuery(document).off(e,s)}},function(e,t,r){"use strict";var n=r(0),o=r(14);const s=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=s},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),s=r(0);r(107);const a=e=>{if(!e)return;const t=e.getBoundingClientRect().bottom;t>=0&&t<=window.innerHeight||e.scrollIntoView()};t.a=e=>t=>{const r=Object(s.useRef)(null);return Object(s.createElement)(s.Fragment,null,Object(s.createElement)("div",{className:"with-scroll-to-top__scroll-point",ref:r,"aria-hidden":!0}),Object(s.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];a(e),null==e||e.focus()}else a(e)})(e,r):a(e))})(r.current,e)}})))}},,function(e,t,r){"use strict";var n=r(0),o=r(4),s=r(5),a=r.n(s),i=r(1),c=r(21),l=r(70),u=r(43);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:s=r,onRemove:p=o.noop,isDismissible:f=!0,actions:m=[],politeness:h=d(t),__unstableHTML:b,onDismiss:g=o.noop}){!function(e,t){const r="string"==typeof e?e:Object(n.renderToString)(e);Object(n.useEffect)(()=>{r&&Object(c.speak)(r,t)},[r,t])}(s,h);const E=a()(e,"components-notice","is-"+t,{"is-dismissible":f});return b&&(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:s=!1,onClick:i,url:c},l)=>{let d=o;return"primary"===o||s||(d=c?"link":"secondary"),void 0===d&&r&&(d="primary"),Object(n.createElement)(u.a,{key:l,href:c,variant:d,onClick:c?void 0:i,className:a()("components-notice__action",e)},t)}))),f&&Object(n.createElement)(u.a,{className:"components-notice__dismiss",icon:l.a,label:Object(i.__)("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,r){"use strict";r.d(t,"a",(function(){return o})),r.d(t,"b",(function(){return s}));var n=r(8);const o=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;const r=Object(n.select)("core/notices").getNotices(e);return r.some(e=>e.type===t)},s=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";const r=Object(n.select)("core/notices").getNotices(),{removeNotice:o}=Object(n.dispatch)("core/notices"),s=r.filter(t=>t.status===e);s.forEach(e=>o(e.id,t))}},function(e,t){},function(e,t,r){var n=r(3),o=r(55),s=r(56),a=s.setStyleProp;function i(e){return s.PRESERVE_CUSTOM_ATTRIBUTES&&"tag"===e.type&&s.isCustomComponent(e.name,e.attribs)}e.exports=function e(t,r){for(var s,c,l,u,d=(r=r||{}).library||n,p=d.cloneElement,f=d.createElement,m=d.isValidElement,h=[],b="function"==typeof r.replace,g=r.trim,E=0,y=t.length;E<y;E++)if(s=t[E],b&&m(c=r.replace(s)))y>1&&(c=p(c,{key:c.key||E})),h.push(c);else if("text"!==s.type){switch(l=s.attribs,i(s)?a(l.style,l):l&&(l=o(l)),u=null,s.type){case"script":case"style":s.children[0]&&(l.dangerouslySetInnerHTML={__html:s.children[0].data});break;case"tag":"textarea"===s.name&&s.children[0]?l.defaultValue=s.children[0].data:s.children&&s.children.length&&(u=e(s.children,r));break;default:continue}y>1&&(l.key=E),h.push(f(s.name,l,u))}else g?s.data.trim()&&h.push(s.data):h.push(s.data);return 1===h.length?h[0]:h}},function(e,t,r){var n=r(84),o=r(85),s=r(86),a=s.MUST_USE_PROPERTY,i=s.HAS_BOOLEAN_VALUE,c=s.HAS_NUMERIC_VALUE,l=s.HAS_POSITIVE_NUMERIC_VALUE,u=s.HAS_OVERLOADED_BOOLEAN_VALUE;function d(e,t){return(e&t)===t}function p(e,t,r){var n,o,s,p=e.Properties,f=e.DOMAttributeNames;for(o in p)n=f[o]||(r?o:o.toLowerCase()),s=p[o],t[n]={attributeName:n,propertyName:o,mustUseProperty:d(s,a),hasBooleanValue:d(s,i),hasNumericValue:d(s,c),hasPositiveNumericValue:d(s,l),hasOverloadedBooleanValue:d(s,u)}}var f={};p(n,f);var m={};p(o,m,!0);var h={};p(n,h),p(o,h,!0),e.exports={html:f,svg:m,properties:h,isCustomAttribute:RegExp.prototype.test.bind(new RegExp("^(data|aria)-[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"))}},function(e,t){e.exports={Properties:{autoFocus:4,accept:0,acceptCharset:0,accessKey:0,action:0,allowFullScreen:4,allowTransparency:0,alt:0,as:0,async:4,autoComplete:0,autoPlay:4,capture:4,cellPadding:0,cellSpacing:0,charSet:0,challenge:0,checked:5,cite:0,classID:0,className:0,cols:24,colSpan:0,content:0,contentEditable:0,contextMenu:0,controls:4,controlsList:0,coords:0,crossOrigin:0,data:0,dateTime:0,default:4,defer:4,dir:0,disabled:4,download:32,draggable:0,encType:0,form:0,formAction:0,formEncType:0,formMethod:0,formNoValidate:4,formTarget:0,frameBorder:0,headers:0,height:0,hidden:4,high:0,href:0,hrefLang:0,htmlFor:0,httpEquiv:0,icon:0,id:0,inputMode:0,integrity:0,is:0,keyParams:0,keyType:0,kind:0,label:0,lang:0,list:0,loop:4,low:0,manifest:0,marginHeight:0,marginWidth:0,max:0,maxLength:0,media:0,mediaGroup:0,method:0,min:0,minLength:0,multiple:5,muted:5,name:0,nonce:0,noValidate:4,open:4,optimum:0,
|
|