active-filters
2 years ago
add-to-cart-form
2 years ago
all-products
2 years ago
attribute-filter
2 years ago
base-components-mini-cart-contents-block
2 years ago
base-components-product-price~mini-cart-contents-block
2 years ago
breadcrumbs
2 years ago
cart-blocks
2 years ago
catalog-sorting
2 years ago
checkout
2 years ago
checkout-blocks
2 years ago
classic-shortcode
2 years ago
collection-active-filters
2 years ago
collection-attribute-filter
2 years ago
collection-filters
2 years ago
collection-price-filter
2 years ago
collection-rating-filter
2 years ago
collection-stock-filter
2 years ago
customer-account
2 years ago
featured-category
2 years ago
featured-product
2 years ago
filter-wrapper
2 years ago
handpicked-products
2 years ago
inner-blocks
2 years ago
mini-cart
2 years ago
mini-cart-contents-block
2 years ago
order-confirmation-additional-information
2 years ago
order-confirmation-billing-address
2 years ago
order-confirmation-billing-wrapper
2 years ago
order-confirmation-downloads
2 years ago
order-confirmation-downloads-wrapper
2 years ago
order-confirmation-shipping-address
2 years ago
order-confirmation-shipping-wrapper
2 years ago
order-confirmation-status
2 years ago
order-confirmation-summary
2 years ago
order-confirmation-totals
2 years ago
order-confirmation-totals-wrapper
2 years ago
page-content-wrapper
2 years ago
price-filter
2 years ago
product-average-rating
2 years ago
product-best-sellers
2 years ago
product-button
2 years ago
product-categories
2 years ago
product-category
2 years ago
product-collection
2 years ago
product-collection-no-results
2 years ago
product-details
2 years ago
product-gallery
2 years ago
product-gallery-large-image
2 years ago
product-gallery-large-image-next-previous
2 years ago
product-gallery-pager
2 years ago
product-gallery-thumbnails
2 years ago
product-image-gallery
2 years ago
product-meta
2 years ago
product-new
2 years ago
product-rating
2 years ago
product-rating-counter
2 years ago
product-rating-stars
2 years ago
product-results-count
2 years ago
product-reviews
2 years ago
product-tag
2 years ago
product-template
2 years ago
product-top-rated
2 years ago
products-by-attribute
2 years ago
rating-filter
2 years ago
related-products
2 years ago
single-product
2 years ago
stock-filter
2 years ago
store-notices
2 years ago
active-filters-frontend.asset.php
2 years ago
active-filters-frontend.js
2 years ago
active-filters-frontend.js.map
2 years ago
active-filters-rtl.css
2 years ago
active-filters-style.asset.php
2 years ago
active-filters-style.js.map
2 years ago
active-filters-wrapper-frontend.js
2 years ago
active-filters-wrapper-frontend.js.map
2 years ago
active-filters-wrapper-rtl.css
2 years ago
active-filters-wrapper-style.js.map
2 years ago
active-filters-wrapper.css
2 years ago
active-filters-wrapper.css.map
2 years ago
active-filters.asset.php
2 years ago
active-filters.css
2 years ago
active-filters.css.map
2 years ago
active-filters.js
2 years ago
active-filters.js.map
2 years ago
add-to-cart-form-rtl.css
2 years ago
add-to-cart-form-style.asset.php
2 years ago
add-to-cart-form-style.js.map
2 years ago
add-to-cart-form.css
2 years ago
add-to-cart-form.css.map
2 years ago
all-products-frontend.asset.php
2 years ago
all-products-frontend.js
2 years ago
all-products-frontend.js.map
2 years ago
all-products-rtl.css
2 years ago
all-products-style.asset.php
2 years ago
all-products-style.js.map
2 years ago
all-products.asset.php
2 years ago
all-products.css
2 years ago
all-products.css.map
2 years ago
all-products.js
2 years ago
all-products.js.map
2 years ago
all-reviews-rtl.css
2 years ago
all-reviews-style.asset.php
2 years ago
all-reviews-style.js.map
2 years ago
all-reviews.asset.php
2 years ago
all-reviews.css
2 years ago
all-reviews.css.map
2 years ago
all-reviews.js
2 years ago
all-reviews.js.map
2 years ago
assets_js_base_context_hooks_collections_use-collection_ts-assets_js_base_context_hooks_use-q-fdf7ba-style.js.map
2 years ago
assets_js_base_context_hooks_use-store-add-to-cart_ts-assets_js_base_context_hooks_use-store--e30f56-style.js.map
2 years ago
attribute-filter-frontend.asset.php
2 years ago
attribute-filter-frontend.js
2 years ago
attribute-filter-frontend.js.map
2 years ago
attribute-filter-rtl.css
2 years ago
attribute-filter-style.asset.php
2 years ago
attribute-filter-style.js.map
2 years ago
attribute-filter-wrapper-frontend.js
2 years ago
attribute-filter-wrapper-frontend.js.map
2 years ago
attribute-filter-wrapper-rtl.css
2 years ago
attribute-filter-wrapper-style.js.map
2 years ago
attribute-filter-wrapper.css
2 years ago
attribute-filter-wrapper.css.map
2 years ago
attribute-filter.asset.php
2 years ago
attribute-filter.css
2 years ago
attribute-filter.css.map
2 years ago
attribute-filter.js
2 years ago
attribute-filter.js.map
2 years ago
base-components-attribute-filter-wrapper-index.tsx-style.js.map
2 years ago
base-components-price-filter-wrapper-index.tsx-style.js.map
2 years ago
base-components-price-filter-wrapper-style.scss-rtl.css
2 years ago
base-components-price-filter-wrapper-style.scss.css
2 years ago
base-components-price-filter-wrapper-style.scss.css.map
2 years ago
base-components-rating-filter-wrapper-index.tsx-style.js.map
2 years ago
base-components-rating-filter-wrapper-style.scss-rtl.css
2 years ago
base-components-rating-filter-wrapper-style.scss.css
2 years ago
base-components-rating-filter-wrapper-style.scss.css.map
2 years ago
base-components-stock-filter-wrapper-index.tsx-style.js.map
2 years ago
base-components-stock-filter-wrapper~attribute-filter-wrapper~rating-filter-wrapper-style.scss-rtl.css
2 years ago
base-components-stock-filter-wrapper~attribute-filter-wrapper~rating-filter-wrapper-style.scss.css
2 years ago
base-components-stock-filter-wrapper~attribute-filter-wrapper~rating-filter-wrapper-style.scss.css.map
2 years ago
base-context-product-add-to-cart-index.js-style.js.map
2 years ago
blocks-checkout.asset.php
2 years ago
blocks-checkout.js
2 years ago
blocks-checkout.js.map
2 years ago
blocks-components.asset.php
2 years ago
blocks-components.js
2 years ago
blocks-components.js.map
2 years ago
breadcrumbs-rtl.css
2 years ago
breadcrumbs-style.asset.php
2 years ago
breadcrumbs-style.js.map
2 years ago
breadcrumbs.asset.php
2 years ago
breadcrumbs.css
2 years ago
breadcrumbs.css.map
2 years ago
breadcrumbs.js
2 years ago
breadcrumbs.js.map
2 years ago
cart-frontend.asset.php
2 years ago
cart-frontend.js
2 years ago
cart-frontend.js.map
2 years ago
cart-rtl.css
2 years ago
cart-style.asset.php
2 years ago
cart-style.js.map
2 years ago
cart.asset.php
2 years ago
cart.css
2 years ago
cart.css.map
2 years ago
cart.js
2 years ago
cart.js.map
2 years ago
catalog-sorting-rtl.css
2 years ago
catalog-sorting-style.asset.php
2 years ago
catalog-sorting-style.js.map
2 years ago
catalog-sorting.asset.php
2 years ago
catalog-sorting.css
2 years ago
catalog-sorting.css.map
2 years ago
catalog-sorting.js
2 years ago
catalog-sorting.js.map
2 years ago
checkout-frontend.asset.php
2 years ago
checkout-frontend.js
2 years ago
checkout-frontend.js.map
2 years ago
checkout-rtl.css
2 years ago
checkout-style.asset.php
2 years ago
checkout-style.js.map
2 years ago
checkout.asset.php
2 years ago
checkout.css
2 years ago
checkout.css.map
2 years ago
checkout.js
2 years ago
checkout.js.map
2 years ago
classic-shortcode-rtl.css
2 years ago
classic-shortcode-style.asset.php
2 years ago
classic-shortcode-style.js.map
2 years ago
classic-shortcode.asset.php
2 years ago
classic-shortcode.css
2 years ago
classic-shortcode.css.map
2 years ago
classic-shortcode.js
2 years ago
classic-shortcode.js.map
2 years ago
collection-active-filters-frontend.asset.php
2 years ago
collection-active-filters-frontend.js
2 years ago
collection-active-filters-frontend.js.map
2 years ago
collection-active-filters-rtl.css
2 years ago
collection-active-filters-style.asset.php
2 years ago
collection-active-filters-style.js.map
2 years ago
collection-active-filters.asset.php
2 years ago
collection-active-filters.css
2 years ago
collection-active-filters.css.map
2 years ago
collection-active-filters.js
2 years ago
collection-active-filters.js.map
2 years ago
collection-attribute-filter-frontend.asset.php
2 years ago
collection-attribute-filter-frontend.js
2 years ago
collection-attribute-filter-frontend.js.map
2 years ago
collection-attribute-filter-rtl.css
2 years ago
collection-attribute-filter-style.asset.php
2 years ago
collection-attribute-filter-style.js.map
2 years ago
collection-attribute-filter.asset.php
2 years ago
collection-attribute-filter.css
2 years ago
collection-attribute-filter.css.map
2 years ago
collection-attribute-filter.js
2 years ago
collection-attribute-filter.js.map
2 years ago
collection-filters-style.asset.php
2 years ago
collection-filters-style.js.map
2 years ago
collection-filters.asset.php
2 years ago
collection-filters.js
2 years ago
collection-filters.js.map
2 years ago
collection-price-filter-frontend.asset.php
2 years ago
collection-price-filter-frontend.js
2 years ago
collection-price-filter-frontend.js.map
2 years ago
collection-price-filter-rtl.css
2 years ago
collection-price-filter-style.asset.php
2 years ago
collection-price-filter-style.js.map
2 years ago
collection-price-filter.asset.php
2 years ago
collection-price-filter.css
2 years ago
collection-price-filter.css.map
2 years ago
collection-price-filter.js
2 years ago
collection-price-filter.js.map
2 years ago
collection-rating-filter-frontend.asset.php
2 years ago
collection-rating-filter-frontend.js
2 years ago
collection-rating-filter-frontend.js.map
2 years ago
collection-rating-filter-rtl.css
2 years ago
collection-rating-filter-style.asset.php
2 years ago
collection-rating-filter-style.js.map
2 years ago
collection-rating-filter.asset.php
2 years ago
collection-rating-filter.css
2 years ago
collection-rating-filter.css.map
2 years ago
collection-rating-filter.js
2 years ago
collection-rating-filter.js.map
2 years ago
collection-stock-filter-frontend.asset.php
2 years ago
collection-stock-filter-frontend.js
2 years ago
collection-stock-filter-frontend.js.map
2 years ago
collection-stock-filter-rtl.css
2 years ago
collection-stock-filter-style.asset.php
2 years ago
collection-stock-filter-style.js.map
2 years ago
collection-stock-filter.asset.php
2 years ago
collection-stock-filter.css
2 years ago
collection-stock-filter.css.map
2 years ago
collection-stock-filter.js
2 years ago
collection-stock-filter.js.map
2 years ago
customer-account-rtl.css
2 years ago
customer-account-style.asset.php
2 years ago
customer-account-style.js.map
2 years ago
customer-account.asset.php
2 years ago
customer-account.css
2 years ago
customer-account.css.map
2 years ago
customer-account.js
2 years ago
customer-account.js.map
2 years ago
featured-category-rtl.css
2 years ago
featured-category-style.asset.php
2 years ago
featured-category-style.js.map
2 years ago
featured-category.asset.php
2 years ago
featured-category.css
2 years ago
featured-category.css.map
2 years ago
featured-category.js
2 years ago
featured-category.js.map
2 years ago
featured-product-rtl.css
2 years ago
featured-product-style.asset.php
2 years ago
featured-product-style.js.map
2 years ago
featured-product.asset.php
2 years ago
featured-product.css
2 years ago
featured-product.css.map
2 years ago
featured-product.js
2 years ago
featured-product.js.map
2 years ago
filter-wrapper-frontend.asset.php
2 years ago
filter-wrapper-frontend.js
2 years ago
filter-wrapper-frontend.js.map
2 years ago
filter-wrapper-rtl.css
2 years ago
filter-wrapper-style.asset.php
2 years ago
filter-wrapper-style.js.map
2 years ago
filter-wrapper.asset.php
2 years ago
filter-wrapper.css
2 years ago
filter-wrapper.css.map
2 years ago
filter-wrapper.js
2 years ago
filter-wrapper.js.map
2 years ago
handpicked-products-style.asset.php
2 years ago
handpicked-products-style.js.map
2 years ago
handpicked-products.asset.php
2 years ago
handpicked-products.js
2 years ago
handpicked-products.js.map
2 years ago
legacy-template-rtl.css
2 years ago
legacy-template-style.asset.php
2 years ago
legacy-template-style.js.map
2 years ago
legacy-template.asset.php
2 years ago
legacy-template.css
2 years ago
legacy-template.css.map
2 years ago
legacy-template.js
2 years ago
legacy-template.js.map
2 years ago
mini-cart-component-frontend.asset.php
2 years ago
mini-cart-component-frontend.js
2 years ago
mini-cart-component-frontend.js.map
2 years ago
mini-cart-contents-rtl.css
2 years ago
mini-cart-contents-style.asset.php
2 years ago
mini-cart-contents-style.js.map
2 years ago
mini-cart-contents.asset.php
2 years ago
mini-cart-contents.css
2 years ago
mini-cart-contents.css.map
2 years ago
mini-cart-contents.js
2 years ago
mini-cart-contents.js.map
2 years ago
mini-cart-frontend.asset.php
2 years ago
mini-cart-frontend.js
2 years ago
mini-cart-frontend.js.map
2 years ago
mini-cart-rtl.css
2 years ago
mini-cart-style.asset.php
2 years ago
mini-cart-style.js.map
2 years ago
mini-cart.asset.php
2 years ago
mini-cart.css
2 years ago
mini-cart.css.map
2 years ago
mini-cart.js
2 years ago
mini-cart.js.map
2 years ago
order-confirmation-additional-information-rtl.css
2 years ago
order-confirmation-additional-information-style.asset.php
2 years ago
order-confirmation-additional-information-style.js.map
2 years ago
order-confirmation-additional-information.asset.php
2 years ago
order-confirmation-additional-information.css
2 years ago
order-confirmation-additional-information.css.map
2 years ago
order-confirmation-additional-information.js
2 years ago
order-confirmation-additional-information.js.map
2 years ago
order-confirmation-billing-address-rtl.css
2 years ago
order-confirmation-billing-address-style.asset.php
2 years ago
order-confirmation-billing-address-style.js.map
2 years ago
order-confirmation-billing-address.asset.php
2 years ago
order-confirmation-billing-address.css
2 years ago
order-confirmation-billing-address.css.map
2 years ago
order-confirmation-billing-address.js
2 years ago
order-confirmation-billing-address.js.map
2 years ago
order-confirmation-billing-wrapper-style.asset.php
2 years ago
order-confirmation-billing-wrapper-style.js.map
2 years ago
order-confirmation-billing-wrapper.asset.php
2 years ago
order-confirmation-billing-wrapper.js
2 years ago
order-confirmation-billing-wrapper.js.map
2 years ago
order-confirmation-downloads-rtl.css
2 years ago
order-confirmation-downloads-style.asset.php
2 years ago
order-confirmation-downloads-style.js.map
2 years ago
order-confirmation-downloads-wrapper-style.asset.php
2 years ago
order-confirmation-downloads-wrapper-style.js.map
2 years ago
order-confirmation-downloads-wrapper.asset.php
2 years ago
order-confirmation-downloads-wrapper.js
2 years ago
order-confirmation-downloads-wrapper.js.map
2 years ago
order-confirmation-downloads.asset.php
2 years ago
order-confirmation-downloads.css
2 years ago
order-confirmation-downloads.css.map
2 years ago
order-confirmation-downloads.js
2 years ago
order-confirmation-downloads.js.map
2 years ago
order-confirmation-shipping-address-rtl.css
2 years ago
order-confirmation-shipping-address-style.asset.php
2 years ago
order-confirmation-shipping-address-style.js.map
2 years ago
order-confirmation-shipping-address.asset.php
2 years ago
order-confirmation-shipping-address.css
2 years ago
order-confirmation-shipping-address.css.map
2 years ago
order-confirmation-shipping-address.js
2 years ago
order-confirmation-shipping-address.js.map
2 years ago
order-confirmation-shipping-wrapper-style.asset.php
2 years ago
order-confirmation-shipping-wrapper-style.js.map
2 years ago
order-confirmation-shipping-wrapper.asset.php
2 years ago
order-confirmation-shipping-wrapper.js
2 years ago
order-confirmation-shipping-wrapper.js.map
2 years ago
order-confirmation-status-rtl.css
2 years ago
order-confirmation-status-style.asset.php
2 years ago
order-confirmation-status-style.js.map
2 years ago
order-confirmation-status.asset.php
2 years ago
order-confirmation-status.css
2 years ago
order-confirmation-status.css.map
2 years ago
order-confirmation-status.js
2 years ago
order-confirmation-status.js.map
2 years ago
order-confirmation-summary-rtl.css
2 years ago
order-confirmation-summary-style.asset.php
2 years ago
order-confirmation-summary-style.js.map
2 years ago
order-confirmation-summary.asset.php
2 years ago
order-confirmation-summary.css
2 years ago
order-confirmation-summary.css.map
2 years ago
order-confirmation-summary.js
2 years ago
order-confirmation-summary.js.map
2 years ago
order-confirmation-totals-rtl.css
2 years ago
order-confirmation-totals-style.asset.php
2 years ago
order-confirmation-totals-style.js.map
2 years ago
order-confirmation-totals-wrapper-style.asset.php
2 years ago
order-confirmation-totals-wrapper-style.js.map
2 years ago
order-confirmation-totals-wrapper.asset.php
2 years ago
order-confirmation-totals-wrapper.js
2 years ago
order-confirmation-totals-wrapper.js.map
2 years ago
order-confirmation-totals.asset.php
2 years ago
order-confirmation-totals.css
2 years ago
order-confirmation-totals.css.map
2 years ago
order-confirmation-totals.js
2 years ago
order-confirmation-totals.js.map
2 years ago
packages-style-rtl.css
2 years ago
packages-style-style.asset.php
2 years ago
packages-style-style.js.map
2 years ago
packages-style.css
2 years ago
packages-style.css.map
2 years ago
page-content-wrapper-style.asset.php
2 years ago
page-content-wrapper-style.js.map
2 years ago
page-content-wrapper.asset.php
2 years ago
page-content-wrapper.js
2 years ago
page-content-wrapper.js.map
2 years ago
price-filter-frontend.asset.php
2 years ago
price-filter-frontend.js
2 years ago
price-filter-frontend.js.map
2 years ago
price-filter-rtl.css
2 years ago
price-filter-style.asset.php
2 years ago
price-filter-style.js.map
2 years ago
price-filter-wrapper-frontend.js
2 years ago
price-filter-wrapper-frontend.js.map
2 years ago
price-filter-wrapper-rtl.css
2 years ago
price-filter-wrapper-style.js.map
2 years ago
price-filter-wrapper.css
2 years ago
price-filter-wrapper.css.map
2 years ago
price-filter.asset.php
2 years ago
price-filter.css
2 years ago
price-filter.css.map
2 years ago
price-filter.js
2 years ago
price-filter.js.map
2 years ago
price-format.asset.php
2 years ago
price-format.js
2 years ago
price-format.js.map
2 years ago
product-add-to-cart-frontend.js
2 years ago
product-add-to-cart-frontend.js.map
2 years ago
product-add-to-cart-rtl.css
2 years ago
product-add-to-cart-style.js.map
2 years ago
product-add-to-cart.css
2 years ago
product-add-to-cart.css.map
2 years ago
product-add-to-cart.js
2 years ago
product-add-to-cart.js.map
2 years ago
product-average-rating-frontend.js
2 years ago
product-average-rating-frontend.js.map
2 years ago
product-average-rating-style.js.map
2 years ago
product-average-rating.js
2 years ago
product-average-rating.js.map
2 years ago
product-best-sellers-style.asset.php
2 years ago
product-best-sellers-style.js.map
2 years ago
product-best-sellers.asset.php
2 years ago
product-best-sellers.js
2 years ago
product-best-sellers.js.map
2 years ago
product-button-frontend.js
2 years ago
product-button-frontend.js.map
2 years ago
product-button-interactivity-frontend.asset.php
2 years ago
product-button-interactivity-frontend.js
2 years ago
product-button-interactivity-frontend.js.map
2 years ago
product-button-rtl.css
2 years ago
product-button-style.js.map
2 years ago
product-button.css
2 years ago
product-button.css.map
2 years ago
product-button.js
2 years ago
product-button.js.map
2 years ago
product-categories-rtl.css
2 years ago
product-categories-style.asset.php
2 years ago
product-categories-style.js.map
2 years ago
product-categories.asset.php
2 years ago
product-categories.css
2 years ago
product-categories.css.map
2 years ago
product-categories.js
2 years ago
product-categories.js.map
2 years ago
product-category-style.asset.php
2 years ago
product-category-style.js.map
2 years ago
product-category.asset.php
2 years ago
product-category.js
2 years ago
product-category.js.map
2 years ago
product-collection-no-results-style.asset.php
2 years ago
product-collection-no-results-style.js.map
2 years ago
product-collection-no-results.asset.php
2 years ago
product-collection-no-results.js
2 years ago
product-collection-no-results.js.map
2 years ago
product-collection-style.asset.php
2 years ago
product-collection-style.js.map
2 years ago
product-collection.asset.php
2 years ago
product-collection.js
2 years ago
product-collection.js.map
2 years ago
product-details-rtl.css
2 years ago
product-details-style.asset.php
2 years ago
product-details-style.js.map
2 years ago
product-details.css
2 years ago
product-details.css.map
2 years ago
product-gallery-frontend.asset.php
2 years ago
product-gallery-frontend.js
2 years ago
product-gallery-frontend.js.map
2 years ago
product-gallery-large-image-frontend.asset.php
2 years ago
product-gallery-large-image-frontend.js
2 years ago
product-gallery-large-image-frontend.js.map
2 years ago
product-gallery-large-image-next-previous-style.asset.php
2 years ago
product-gallery-large-image-next-previous-style.js.map
2 years ago
product-gallery-large-image-next-previous.asset.php
2 years ago
product-gallery-large-image-next-previous.js
2 years ago
product-gallery-large-image-next-previous.js.map
2 years ago
product-gallery-large-image-style.asset.php
2 years ago
product-gallery-large-image-style.js.map
2 years ago
product-gallery-large-image.asset.php
2 years ago
product-gallery-large-image.js
2 years ago
product-gallery-large-image.js.map
2 years ago
product-gallery-pager-style.asset.php
2 years ago
product-gallery-pager-style.js.map
2 years ago
product-gallery-pager.asset.php
2 years ago
product-gallery-pager.js
2 years ago
product-gallery-pager.js.map
2 years ago
product-gallery-rtl.css
2 years ago
product-gallery-style.asset.php
2 years ago
product-gallery-style.js.map
2 years ago
product-gallery-thumbnails-style.asset.php
2 years ago
product-gallery-thumbnails-style.js.map
2 years ago
product-gallery-thumbnails.asset.php
2 years ago
product-gallery-thumbnails.js
2 years ago
product-gallery-thumbnails.js.map
2 years ago
product-gallery.asset.php
2 years ago
product-gallery.css
2 years ago
product-gallery.css.map
2 years ago
product-gallery.js
2 years ago
product-gallery.js.map
2 years ago
product-image-frontend.js
2 years ago
product-image-frontend.js.map
2 years ago
product-image-gallery-rtl.css
2 years ago
product-image-gallery-style.asset.php
2 years ago
product-image-gallery-style.js.map
2 years ago
product-image-gallery.css
2 years ago
product-image-gallery.css.map
2 years ago
product-image-rtl.css
2 years ago
product-image-style.js.map
2 years ago
product-image.css
2 years ago
product-image.css.map
2 years ago
product-image.js
2 years ago
product-image.js.map
2 years ago
product-new-style.asset.php
2 years ago
product-new-style.js.map
2 years ago
product-new.asset.php
2 years ago
product-new.js
2 years ago
product-new.js.map
2 years ago
product-on-sale-style.asset.php
2 years ago
product-on-sale-style.js.map
2 years ago
product-on-sale.asset.php
2 years ago
product-on-sale.js
2 years ago
product-on-sale.js.map
2 years ago
product-price-frontend.js
2 years ago
product-price-frontend.js.map
2 years ago
product-price-rtl.css
2 years ago
product-price-style.js.map
2 years ago
product-price.css
2 years ago
product-price.css.map
2 years ago
product-price.js
2 years ago
product-price.js.map
2 years ago
product-query-rtl.css
2 years ago
product-query-style.asset.php
2 years ago
product-query-style.js.map
2 years ago
product-query.asset.php
2 years ago
product-query.css
2 years ago
product-query.css.map
2 years ago
product-query.js
2 years ago
product-query.js.map
2 years ago
product-rating-counter-frontend.js
2 years ago
product-rating-counter-frontend.js.map
2 years ago
product-rating-counter-style.js.map
2 years ago
product-rating-counter.js
2 years ago
product-rating-counter.js.map
2 years ago
product-rating-frontend.js
2 years ago
product-rating-frontend.js.map
2 years ago
product-rating-rtl.css
2 years ago
product-rating-stars-frontend.js
2 years ago
product-rating-stars-frontend.js.map
2 years ago
product-rating-stars-rtl.css
2 years ago
product-rating-stars-style.js.map
2 years ago
product-rating-stars.css
2 years ago
product-rating-stars.css.map
2 years ago
product-rating-stars.js
2 years ago
product-rating-stars.js.map
2 years ago
product-rating-style.js.map
2 years ago
product-rating.css
2 years ago
product-rating.css.map
2 years ago
product-rating.js
2 years ago
product-rating.js.map
2 years ago
product-results-count-rtl.css
2 years ago
product-results-count-style.asset.php
2 years ago
product-results-count-style.js.map
2 years ago
product-results-count.asset.php
2 years ago
product-results-count.css
2 years ago
product-results-count.css.map
2 years ago
product-results-count.js
2 years ago
product-results-count.js.map
2 years ago
product-reviews-rtl.css
2 years ago
product-reviews-style.asset.php
2 years ago
product-reviews-style.js.map
2 years ago
product-reviews.css
2 years ago
product-reviews.css.map
2 years ago
product-sale-badge-frontend.js
2 years ago
product-sale-badge-frontend.js.map
2 years ago
product-sale-badge-rtl.css
2 years ago
product-sale-badge-style.js.map
2 years ago
product-sale-badge.css
2 years ago
product-sale-badge.css.map
2 years ago
product-sale-badge.js
2 years ago
product-sale-badge.js.map
2 years ago
product-search-rtl.css
2 years ago
product-search-style.asset.php
2 years ago
product-search-style.js.map
2 years ago
product-search.asset.php
2 years ago
product-search.css
2 years ago
product-search.css.map
2 years ago
product-search.js
2 years ago
product-search.js.map
2 years ago
product-sku-frontend.js
2 years ago
product-sku-frontend.js.map
2 years ago
product-sku-rtl.css
2 years ago
product-sku-style.js.map
2 years ago
product-sku.css
2 years ago
product-sku.css.map
2 years ago
product-sku.js
2 years ago
product-sku.js.map
2 years ago
product-stock-indicator-frontend.js
2 years ago
product-stock-indicator-frontend.js.map
2 years ago
product-stock-indicator-rtl.css
2 years ago
product-stock-indicator-style.js.map
2 years ago
product-stock-indicator.css
2 years ago
product-stock-indicator.css.map
2 years ago
product-stock-indicator.js
2 years ago
product-stock-indicator.js.map
2 years ago
product-summary-frontend.js
2 years ago
product-summary-frontend.js.map
2 years ago
product-summary-rtl.css
2 years ago
product-summary-style.js.map
2 years ago
product-summary.css
2 years ago
product-summary.css.map
2 years ago
product-summary.js
2 years ago
product-summary.js.map
2 years ago
product-tag-style.asset.php
2 years ago
product-tag-style.js.map
2 years ago
product-tag.asset.php
2 years ago
product-tag.js
2 years ago
product-tag.js.map
2 years ago
product-template-rtl.css
2 years ago
product-template-style.asset.php
2 years ago
product-template-style.js.map
2 years ago
product-template.asset.php
2 years ago
product-template.css
2 years ago
product-template.css.map
2 years ago
product-template.js
2 years ago
product-template.js.map
2 years ago
product-title-frontend.js
2 years ago
product-title-frontend.js.map
2 years ago
product-title-rtl.css
2 years ago
product-title-style.js.map
2 years ago
product-title.css
2 years ago
product-title.css.map
2 years ago
product-title.js
2 years ago
product-title.js.map
2 years ago
product-top-rated-style.asset.php
2 years ago
product-top-rated-style.js.map
2 years ago
product-top-rated.asset.php
2 years ago
product-top-rated.js
2 years ago
product-top-rated.js.map
2 years ago
products-by-attribute-style.asset.php
2 years ago
products-by-attribute-style.js.map
2 years ago
products-by-attribute.asset.php
2 years ago
products-by-attribute.js
2 years ago
products-by-attribute.js.map
2 years ago
rating-filter-frontend.asset.php
2 years ago
rating-filter-frontend.js
2 years ago
rating-filter-frontend.js.map
2 years ago
rating-filter-rtl.css
2 years ago
rating-filter-style.asset.php
2 years ago
rating-filter-style.js.map
2 years ago
rating-filter-wrapper-frontend.js
2 years ago
rating-filter-wrapper-frontend.js.map
2 years ago
rating-filter-wrapper-rtl.css
2 years ago
rating-filter-wrapper-style.js.map
2 years ago
rating-filter-wrapper.css
2 years ago
rating-filter-wrapper.css.map
2 years ago
rating-filter.asset.php
2 years ago
rating-filter.css
2 years ago
rating-filter.css.map
2 years ago
rating-filter.js
2 years ago
rating-filter.js.map
2 years ago
reviews-by-category-rtl.css
2 years ago
reviews-by-category-style.asset.php
2 years ago
reviews-by-category-style.js.map
2 years ago
reviews-by-category.asset.php
2 years ago
reviews-by-category.css
2 years ago
reviews-by-category.css.map
2 years ago
reviews-by-category.js
2 years ago
reviews-by-category.js.map
2 years ago
reviews-by-product-rtl.css
2 years ago
reviews-by-product-style.asset.php
2 years ago
reviews-by-product-style.js.map
2 years ago
reviews-by-product.asset.php
2 years ago
reviews-by-product.css
2 years ago
reviews-by-product.css.map
2 years ago
reviews-by-product.js
2 years ago
reviews-by-product.js.map
2 years ago
reviews-frontend.asset.php
2 years ago
reviews-frontend.js
2 years ago
reviews-frontend.js.map
2 years ago
single-product-rtl.css
2 years ago
single-product-style.asset.php
2 years ago
single-product-style.js.map
2 years ago
single-product.asset.php
2 years ago
single-product.css
2 years ago
single-product.css.map
2 years ago
single-product.js
2 years ago
single-product.js.map
2 years ago
stock-filter-frontend.asset.php
2 years ago
stock-filter-frontend.js
2 years ago
stock-filter-frontend.js.map
2 years ago
stock-filter-rtl.css
2 years ago
stock-filter-style.asset.php
2 years ago
stock-filter-style.js.map
2 years ago
stock-filter-wrapper-frontend.js
2 years ago
stock-filter-wrapper-frontend.js.map
2 years ago
stock-filter-wrapper-rtl.css
2 years ago
stock-filter-wrapper-style.js.map
2 years ago
stock-filter-wrapper.css
2 years ago
stock-filter-wrapper.css.map
2 years ago
stock-filter.asset.php
2 years ago
stock-filter.css
2 years ago
stock-filter.css.map
2 years ago
stock-filter.js
2 years ago
stock-filter.js.map
2 years ago
store-notices-rtl.css
2 years ago
store-notices-style.asset.php
2 years ago
store-notices-style.js.map
2 years ago
store-notices.asset.php
2 years ago
store-notices.css
2 years ago
store-notices.css.map
2 years ago
store-notices.js
2 years ago
store-notices.js.map
2 years ago
vendors-node_modules_pnpm_dinero_js_1_9_1_node_modules_dinero_js_build_esm_dinero_js-style.js.map
2 years ago
vendors-node_modules_pnpm_param-case_3_0_4_node_modules_param-case_dist_es2015_index_js-style.js.map
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-019903-style.js.map
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-37238e-frontend.js
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-37238e-frontend.js.map
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-68c184-style.js.map
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-70a73f-frontend.js
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-70a73f-frontend.js.map
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-849324-frontend.js
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-849324-frontend.js.map
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-bab841-style.js.map
2 years ago
vendors-node_modules_pnpm_wordpress_components_14_2_0__types_react_17_0_71_react-dom_17_0_2_r-c6918e-style.js.map
2 years ago
wc-blocks-classic-template-revert-button-style-rtl.css
2 years ago
wc-blocks-classic-template-revert-button-style-style.asset.php
2 years ago
wc-blocks-classic-template-revert-button-style-style.js.map
2 years ago
wc-blocks-classic-template-revert-button-style.css
2 years ago
wc-blocks-classic-template-revert-button-style.css.map
2 years ago
wc-blocks-classic-template-revert-button.asset.php
2 years ago
wc-blocks-classic-template-revert-button.js
2 years ago
wc-blocks-classic-template-revert-button.js.map
2 years ago
wc-blocks-data.asset.php
2 years ago
wc-blocks-data.js
2 years ago
wc-blocks-data.js.map
2 years ago
wc-blocks-editor-style-rtl.css
2 years ago
wc-blocks-editor-style.css
2 years ago
wc-blocks-editor-style.css.map
2 years ago
wc-blocks-google-analytics.asset.php
2 years ago
wc-blocks-google-analytics.js
2 years ago
wc-blocks-google-analytics.js.map
2 years ago
wc-blocks-middleware.asset.php
2 years ago
wc-blocks-middleware.js
2 years ago
wc-blocks-middleware.js.map
2 years ago
wc-blocks-registry.asset.php
2 years ago
wc-blocks-registry.js
2 years ago
wc-blocks-registry.js.map
2 years ago
wc-blocks-rtl.css
2 years ago
wc-blocks-shared-context.asset.php
2 years ago
wc-blocks-shared-context.js
2 years ago
wc-blocks-shared-context.js.map
2 years ago
wc-blocks-shared-hocs.asset.php
2 years ago
wc-blocks-shared-hocs.js
2 years ago
wc-blocks-shared-hocs.js.map
2 years ago
wc-blocks-style.asset.php
2 years ago
wc-blocks-style.js.map
2 years ago
wc-blocks-vendors.asset.php
2 years ago
wc-blocks-vendors.js
2 years ago
wc-blocks-vendors.js.map
2 years ago
wc-blocks.asset.php
2 years ago
wc-blocks.css
2 years ago
wc-blocks.css.map
2 years ago
wc-blocks.js
2 years ago
wc-blocks.js.map
2 years ago
wc-interactivity-checkbox-list-rtl.css
2 years ago
wc-interactivity-checkbox-list-style.asset.php
2 years ago
wc-interactivity-checkbox-list-style.js.map
2 years ago
wc-interactivity-checkbox-list.asset.php
2 years ago
wc-interactivity-checkbox-list.css
2 years ago
wc-interactivity-checkbox-list.css.map
2 years ago
wc-interactivity-checkbox-list.js
2 years ago
wc-interactivity-checkbox-list.js.map
2 years ago
wc-interactivity-dropdown-rtl.css
2 years ago
wc-interactivity-dropdown-style.asset.php
2 years ago
wc-interactivity-dropdown-style.js.map
2 years ago
wc-interactivity-dropdown.asset.php
2 years ago
wc-interactivity-dropdown.css
2 years ago
wc-interactivity-dropdown.css.map
2 years ago
wc-interactivity-dropdown.js
2 years ago
wc-interactivity-dropdown.js.map
2 years ago
wc-interactivity.asset.php
2 years ago
wc-interactivity.js
2 years ago
wc-interactivity.js.map
2 years ago
wc-payment-method-bacs.asset.php
2 years ago
wc-payment-method-bacs.js
2 years ago
wc-payment-method-bacs.js.map
2 years ago
wc-payment-method-cheque.asset.php
2 years ago
wc-payment-method-cheque.js
2 years ago
wc-payment-method-cheque.js.map
2 years ago
wc-payment-method-cod.asset.php
2 years ago
wc-payment-method-cod.js
2 years ago
wc-payment-method-cod.js.map
2 years ago
wc-payment-method-paypal.asset.php
2 years ago
wc-payment-method-paypal.js
2 years ago
wc-payment-method-paypal.js.map
2 years ago
wc-settings.asset.php
2 years ago
wc-settings.js
2 years ago
wc-settings.js.map
2 years ago
wc-shipping-method-pickup-location.asset.php
2 years ago
wc-shipping-method-pickup-location.js
2 years ago
wc-shipping-method-pickup-location.js.map
2 years ago
wc-payment-method-cod.js
2021 lines
| 1 | /******/ (() => { // webpackBootstrap |
| 2 | /******/ var __webpack_modules__ = ({ |
| 3 | |
| 4 | /***/ "./assets/js/extensions/payment-methods/cod/constants.js": |
| 5 | /*!***************************************************************!*\ |
| 6 | !*** ./assets/js/extensions/payment-methods/cod/constants.js ***! |
| 7 | \***************************************************************/ |
| 8 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 9 | |
| 10 | "use strict"; |
| 11 | __webpack_require__.r(__webpack_exports__); |
| 12 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 13 | /* harmony export */ PAYMENT_METHOD_NAME: () => (/* binding */ PAYMENT_METHOD_NAME) |
| 14 | /* harmony export */ }); |
| 15 | const PAYMENT_METHOD_NAME = 'cod'; |
| 16 | |
| 17 | /***/ }), |
| 18 | |
| 19 | /***/ "./assets/js/utils/sanitize-html.ts": |
| 20 | /*!******************************************!*\ |
| 21 | !*** ./assets/js/utils/sanitize-html.ts ***! |
| 22 | \******************************************/ |
| 23 | /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { |
| 24 | |
| 25 | "use strict"; |
| 26 | __webpack_require__.r(__webpack_exports__); |
| 27 | /* harmony export */ __webpack_require__.d(__webpack_exports__, { |
| 28 | /* harmony export */ sanitizeHTML: () => (/* binding */ sanitizeHTML) |
| 29 | /* harmony export */ }); |
| 30 | /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dompurify */ "../../node_modules/.pnpm/dompurify@2.4.7/node_modules/dompurify/dist/purify.js"); |
| 31 | /* harmony import */ var dompurify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dompurify__WEBPACK_IMPORTED_MODULE_0__); |
| 32 | /** |
| 33 | * External dependencies |
| 34 | */ |
| 35 | |
| 36 | const ALLOWED_TAGS = ['a', 'b', 'em', 'i', 'strong', 'p', 'br']; |
| 37 | const ALLOWED_ATTR = ['target', 'href', 'rel', 'name', 'download']; |
| 38 | const sanitizeHTML = (html, config) => { |
| 39 | const tagsValue = (config === null || config === void 0 ? void 0 : config.tags) || ALLOWED_TAGS; |
| 40 | const attrValue = (config === null || config === void 0 ? void 0 : config.attr) || ALLOWED_ATTR; |
| 41 | return dompurify__WEBPACK_IMPORTED_MODULE_0___default().sanitize(html, { |
| 42 | ALLOWED_TAGS: tagsValue, |
| 43 | ALLOWED_ATTR: attrValue |
| 44 | }); |
| 45 | }; |
| 46 | |
| 47 | /***/ }), |
| 48 | |
| 49 | /***/ "../../node_modules/.pnpm/dompurify@2.4.7/node_modules/dompurify/dist/purify.js": |
| 50 | /*!**************************************************************************************!*\ |
| 51 | !*** ../../node_modules/.pnpm/dompurify@2.4.7/node_modules/dompurify/dist/purify.js ***! |
| 52 | \**************************************************************************************/ |
| 53 | /***/ (function(module) { |
| 54 | |
| 55 | /*! @license DOMPurify 2.4.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.7/LICENSE */ |
| 56 | |
| 57 | (function (global, factory) { |
| 58 | true ? module.exports = factory() : |
| 59 | 0; |
| 60 | })(this, (function () { 'use strict'; |
| 61 | |
| 62 | function _typeof(obj) { |
| 63 | "@babel/helpers - typeof"; |
| 64 | |
| 65 | return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { |
| 66 | return typeof obj; |
| 67 | } : function (obj) { |
| 68 | return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; |
| 69 | }, _typeof(obj); |
| 70 | } |
| 71 | |
| 72 | function _setPrototypeOf(o, p) { |
| 73 | _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { |
| 74 | o.__proto__ = p; |
| 75 | return o; |
| 76 | }; |
| 77 | |
| 78 | return _setPrototypeOf(o, p); |
| 79 | } |
| 80 | |
| 81 | function _isNativeReflectConstruct() { |
| 82 | if (typeof Reflect === "undefined" || !Reflect.construct) return false; |
| 83 | if (Reflect.construct.sham) return false; |
| 84 | if (typeof Proxy === "function") return true; |
| 85 | |
| 86 | try { |
| 87 | Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); |
| 88 | return true; |
| 89 | } catch (e) { |
| 90 | return false; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | function _construct(Parent, args, Class) { |
| 95 | if (_isNativeReflectConstruct()) { |
| 96 | _construct = Reflect.construct; |
| 97 | } else { |
| 98 | _construct = function _construct(Parent, args, Class) { |
| 99 | var a = [null]; |
| 100 | a.push.apply(a, args); |
| 101 | var Constructor = Function.bind.apply(Parent, a); |
| 102 | var instance = new Constructor(); |
| 103 | if (Class) _setPrototypeOf(instance, Class.prototype); |
| 104 | return instance; |
| 105 | }; |
| 106 | } |
| 107 | |
| 108 | return _construct.apply(null, arguments); |
| 109 | } |
| 110 | |
| 111 | function _toConsumableArray(arr) { |
| 112 | return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); |
| 113 | } |
| 114 | |
| 115 | function _arrayWithoutHoles(arr) { |
| 116 | if (Array.isArray(arr)) return _arrayLikeToArray(arr); |
| 117 | } |
| 118 | |
| 119 | function _iterableToArray(iter) { |
| 120 | if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); |
| 121 | } |
| 122 | |
| 123 | function _unsupportedIterableToArray(o, minLen) { |
| 124 | if (!o) return; |
| 125 | if (typeof o === "string") return _arrayLikeToArray(o, minLen); |
| 126 | var n = Object.prototype.toString.call(o).slice(8, -1); |
| 127 | if (n === "Object" && o.constructor) n = o.constructor.name; |
| 128 | if (n === "Map" || n === "Set") return Array.from(o); |
| 129 | if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); |
| 130 | } |
| 131 | |
| 132 | function _arrayLikeToArray(arr, len) { |
| 133 | if (len == null || len > arr.length) len = arr.length; |
| 134 | |
| 135 | for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; |
| 136 | |
| 137 | return arr2; |
| 138 | } |
| 139 | |
| 140 | function _nonIterableSpread() { |
| 141 | throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); |
| 142 | } |
| 143 | |
| 144 | var hasOwnProperty = Object.hasOwnProperty, |
| 145 | setPrototypeOf = Object.setPrototypeOf, |
| 146 | isFrozen = Object.isFrozen, |
| 147 | getPrototypeOf = Object.getPrototypeOf, |
| 148 | getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; |
| 149 | var freeze = Object.freeze, |
| 150 | seal = Object.seal, |
| 151 | create = Object.create; // eslint-disable-line import/no-mutable-exports |
| 152 | |
| 153 | var _ref = typeof Reflect !== 'undefined' && Reflect, |
| 154 | apply = _ref.apply, |
| 155 | construct = _ref.construct; |
| 156 | |
| 157 | if (!apply) { |
| 158 | apply = function apply(fun, thisValue, args) { |
| 159 | return fun.apply(thisValue, args); |
| 160 | }; |
| 161 | } |
| 162 | |
| 163 | if (!freeze) { |
| 164 | freeze = function freeze(x) { |
| 165 | return x; |
| 166 | }; |
| 167 | } |
| 168 | |
| 169 | if (!seal) { |
| 170 | seal = function seal(x) { |
| 171 | return x; |
| 172 | }; |
| 173 | } |
| 174 | |
| 175 | if (!construct) { |
| 176 | construct = function construct(Func, args) { |
| 177 | return _construct(Func, _toConsumableArray(args)); |
| 178 | }; |
| 179 | } |
| 180 | |
| 181 | var arrayForEach = unapply(Array.prototype.forEach); |
| 182 | var arrayPop = unapply(Array.prototype.pop); |
| 183 | var arrayPush = unapply(Array.prototype.push); |
| 184 | var stringToLowerCase = unapply(String.prototype.toLowerCase); |
| 185 | var stringToString = unapply(String.prototype.toString); |
| 186 | var stringMatch = unapply(String.prototype.match); |
| 187 | var stringReplace = unapply(String.prototype.replace); |
| 188 | var stringIndexOf = unapply(String.prototype.indexOf); |
| 189 | var stringTrim = unapply(String.prototype.trim); |
| 190 | var regExpTest = unapply(RegExp.prototype.test); |
| 191 | var typeErrorCreate = unconstruct(TypeError); |
| 192 | function unapply(func) { |
| 193 | return function (thisArg) { |
| 194 | for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { |
| 195 | args[_key - 1] = arguments[_key]; |
| 196 | } |
| 197 | |
| 198 | return apply(func, thisArg, args); |
| 199 | }; |
| 200 | } |
| 201 | function unconstruct(func) { |
| 202 | return function () { |
| 203 | for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { |
| 204 | args[_key2] = arguments[_key2]; |
| 205 | } |
| 206 | |
| 207 | return construct(func, args); |
| 208 | }; |
| 209 | } |
| 210 | /* Add properties to a lookup table */ |
| 211 | |
| 212 | function addToSet(set, array, transformCaseFunc) { |
| 213 | var _transformCaseFunc; |
| 214 | |
| 215 | transformCaseFunc = (_transformCaseFunc = transformCaseFunc) !== null && _transformCaseFunc !== void 0 ? _transformCaseFunc : stringToLowerCase; |
| 216 | |
| 217 | if (setPrototypeOf) { |
| 218 | // Make 'in' and truthy checks like Boolean(set.constructor) |
| 219 | // independent of any properties defined on Object.prototype. |
| 220 | // Prevent prototype setters from intercepting set as a this value. |
| 221 | setPrototypeOf(set, null); |
| 222 | } |
| 223 | |
| 224 | var l = array.length; |
| 225 | |
| 226 | while (l--) { |
| 227 | var element = array[l]; |
| 228 | |
| 229 | if (typeof element === 'string') { |
| 230 | var lcElement = transformCaseFunc(element); |
| 231 | |
| 232 | if (lcElement !== element) { |
| 233 | // Config presets (e.g. tags.js, attrs.js) are immutable. |
| 234 | if (!isFrozen(array)) { |
| 235 | array[l] = lcElement; |
| 236 | } |
| 237 | |
| 238 | element = lcElement; |
| 239 | } |
| 240 | } |
| 241 | |
| 242 | set[element] = true; |
| 243 | } |
| 244 | |
| 245 | return set; |
| 246 | } |
| 247 | /* Shallow clone an object */ |
| 248 | |
| 249 | function clone(object) { |
| 250 | var newObject = create(null); |
| 251 | var property; |
| 252 | |
| 253 | for (property in object) { |
| 254 | if (apply(hasOwnProperty, object, [property]) === true) { |
| 255 | newObject[property] = object[property]; |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | return newObject; |
| 260 | } |
| 261 | /* IE10 doesn't support __lookupGetter__ so lets' |
| 262 | * simulate it. It also automatically checks |
| 263 | * if the prop is function or getter and behaves |
| 264 | * accordingly. */ |
| 265 | |
| 266 | function lookupGetter(object, prop) { |
| 267 | while (object !== null) { |
| 268 | var desc = getOwnPropertyDescriptor(object, prop); |
| 269 | |
| 270 | if (desc) { |
| 271 | if (desc.get) { |
| 272 | return unapply(desc.get); |
| 273 | } |
| 274 | |
| 275 | if (typeof desc.value === 'function') { |
| 276 | return unapply(desc.value); |
| 277 | } |
| 278 | } |
| 279 | |
| 280 | object = getPrototypeOf(object); |
| 281 | } |
| 282 | |
| 283 | function fallbackValue(element) { |
| 284 | console.warn('fallback value for', element); |
| 285 | return null; |
| 286 | } |
| 287 | |
| 288 | return fallbackValue; |
| 289 | } |
| 290 | |
| 291 | var html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG |
| 292 | |
| 293 | var svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']); |
| 294 | var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default. |
| 295 | // We still need to know them so that we can do namespace |
| 296 | // checks properly in case one wants to add them to |
| 297 | // allow-list. |
| 298 | |
| 299 | var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']); |
| 300 | var mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']); // Similarly to SVG, we want to know all MathML elements, |
| 301 | // even those that we disallow by default. |
| 302 | |
| 303 | var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']); |
| 304 | var text = freeze(['#text']); |
| 305 | |
| 306 | var html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']); |
| 307 | var svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']); |
| 308 | var mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']); |
| 309 | var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']); |
| 310 | |
| 311 | var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode |
| 312 | |
| 313 | var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); |
| 314 | var TMPLIT_EXPR = seal(/\${[\w\W]*}/gm); |
| 315 | var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape |
| 316 | |
| 317 | var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape |
| 318 | |
| 319 | var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape |
| 320 | ); |
| 321 | var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); |
| 322 | var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex |
| 323 | ); |
| 324 | var DOCTYPE_NAME = seal(/^html$/i); |
| 325 | |
| 326 | var getGlobal = function getGlobal() { |
| 327 | return typeof window === 'undefined' ? null : window; |
| 328 | }; |
| 329 | /** |
| 330 | * Creates a no-op policy for internal use only. |
| 331 | * Don't export this function outside this module! |
| 332 | * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory. |
| 333 | * @param {Document} document The document object (to determine policy name suffix) |
| 334 | * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types |
| 335 | * are not supported). |
| 336 | */ |
| 337 | |
| 338 | |
| 339 | var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) { |
| 340 | if (_typeof(trustedTypes) !== 'object' || typeof trustedTypes.createPolicy !== 'function') { |
| 341 | return null; |
| 342 | } // Allow the callers to control the unique policy name |
| 343 | // by adding a data-tt-policy-suffix to the script element with the DOMPurify. |
| 344 | // Policy creation with duplicate names throws in Trusted Types. |
| 345 | |
| 346 | |
| 347 | var suffix = null; |
| 348 | var ATTR_NAME = 'data-tt-policy-suffix'; |
| 349 | |
| 350 | if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) { |
| 351 | suffix = document.currentScript.getAttribute(ATTR_NAME); |
| 352 | } |
| 353 | |
| 354 | var policyName = 'dompurify' + (suffix ? '#' + suffix : ''); |
| 355 | |
| 356 | try { |
| 357 | return trustedTypes.createPolicy(policyName, { |
| 358 | createHTML: function createHTML(html) { |
| 359 | return html; |
| 360 | }, |
| 361 | createScriptURL: function createScriptURL(scriptUrl) { |
| 362 | return scriptUrl; |
| 363 | } |
| 364 | }); |
| 365 | } catch (_) { |
| 366 | // Policy creation failed (most likely another DOMPurify script has |
| 367 | // already run). Skip creating the policy, as this will only cause errors |
| 368 | // if TT are enforced. |
| 369 | console.warn('TrustedTypes policy ' + policyName + ' could not be created.'); |
| 370 | return null; |
| 371 | } |
| 372 | }; |
| 373 | |
| 374 | function createDOMPurify() { |
| 375 | var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal(); |
| 376 | |
| 377 | var DOMPurify = function DOMPurify(root) { |
| 378 | return createDOMPurify(root); |
| 379 | }; |
| 380 | /** |
| 381 | * Version label, exposed for easier checks |
| 382 | * if DOMPurify is up to date or not |
| 383 | */ |
| 384 | |
| 385 | |
| 386 | DOMPurify.version = '2.4.7'; |
| 387 | /** |
| 388 | * Array of elements that DOMPurify removed during sanitation. |
| 389 | * Empty if nothing was removed. |
| 390 | */ |
| 391 | |
| 392 | DOMPurify.removed = []; |
| 393 | |
| 394 | if (!window || !window.document || window.document.nodeType !== 9) { |
| 395 | // Not running in a browser, provide a factory function |
| 396 | // so that you can pass your own Window |
| 397 | DOMPurify.isSupported = false; |
| 398 | return DOMPurify; |
| 399 | } |
| 400 | |
| 401 | var originalDocument = window.document; |
| 402 | var document = window.document; |
| 403 | var DocumentFragment = window.DocumentFragment, |
| 404 | HTMLTemplateElement = window.HTMLTemplateElement, |
| 405 | Node = window.Node, |
| 406 | Element = window.Element, |
| 407 | NodeFilter = window.NodeFilter, |
| 408 | _window$NamedNodeMap = window.NamedNodeMap, |
| 409 | NamedNodeMap = _window$NamedNodeMap === void 0 ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap, |
| 410 | HTMLFormElement = window.HTMLFormElement, |
| 411 | DOMParser = window.DOMParser, |
| 412 | trustedTypes = window.trustedTypes; |
| 413 | var ElementPrototype = Element.prototype; |
| 414 | var cloneNode = lookupGetter(ElementPrototype, 'cloneNode'); |
| 415 | var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling'); |
| 416 | var getChildNodes = lookupGetter(ElementPrototype, 'childNodes'); |
| 417 | var getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a |
| 418 | // new document created via createHTMLDocument. As per the spec |
| 419 | // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries) |
| 420 | // a new empty registry is used when creating a template contents owner |
| 421 | // document, so we use that as our parent document to ensure nothing |
| 422 | // is inherited. |
| 423 | |
| 424 | if (typeof HTMLTemplateElement === 'function') { |
| 425 | var template = document.createElement('template'); |
| 426 | |
| 427 | if (template.content && template.content.ownerDocument) { |
| 428 | document = template.content.ownerDocument; |
| 429 | } |
| 430 | } |
| 431 | |
| 432 | var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument); |
| 433 | |
| 434 | var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : ''; |
| 435 | var _document = document, |
| 436 | implementation = _document.implementation, |
| 437 | createNodeIterator = _document.createNodeIterator, |
| 438 | createDocumentFragment = _document.createDocumentFragment, |
| 439 | getElementsByTagName = _document.getElementsByTagName; |
| 440 | var importNode = originalDocument.importNode; |
| 441 | var documentMode = {}; |
| 442 | |
| 443 | try { |
| 444 | documentMode = clone(document).documentMode ? document.documentMode : {}; |
| 445 | } catch (_) {} |
| 446 | |
| 447 | var hooks = {}; |
| 448 | /** |
| 449 | * Expose whether this browser supports running the full DOMPurify. |
| 450 | */ |
| 451 | |
| 452 | DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined && documentMode !== 9; |
| 453 | var MUSTACHE_EXPR$1 = MUSTACHE_EXPR, |
| 454 | ERB_EXPR$1 = ERB_EXPR, |
| 455 | TMPLIT_EXPR$1 = TMPLIT_EXPR, |
| 456 | DATA_ATTR$1 = DATA_ATTR, |
| 457 | ARIA_ATTR$1 = ARIA_ATTR, |
| 458 | IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, |
| 459 | ATTR_WHITESPACE$1 = ATTR_WHITESPACE; |
| 460 | var IS_ALLOWED_URI$1 = IS_ALLOWED_URI; |
| 461 | /** |
| 462 | * We consider the elements and attributes below to be safe. Ideally |
| 463 | * don't add any new ones but feel free to remove unwanted ones. |
| 464 | */ |
| 465 | |
| 466 | /* allowed element names */ |
| 467 | |
| 468 | var ALLOWED_TAGS = null; |
| 469 | var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text))); |
| 470 | /* Allowed attribute names */ |
| 471 | |
| 472 | var ALLOWED_ATTR = null; |
| 473 | var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml))); |
| 474 | /* |
| 475 | * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements. |
| 476 | * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements) |
| 477 | * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list) |
| 478 | * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`. |
| 479 | */ |
| 480 | |
| 481 | var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, { |
| 482 | tagNameCheck: { |
| 483 | writable: true, |
| 484 | configurable: false, |
| 485 | enumerable: true, |
| 486 | value: null |
| 487 | }, |
| 488 | attributeNameCheck: { |
| 489 | writable: true, |
| 490 | configurable: false, |
| 491 | enumerable: true, |
| 492 | value: null |
| 493 | }, |
| 494 | allowCustomizedBuiltInElements: { |
| 495 | writable: true, |
| 496 | configurable: false, |
| 497 | enumerable: true, |
| 498 | value: false |
| 499 | } |
| 500 | })); |
| 501 | /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */ |
| 502 | |
| 503 | var FORBID_TAGS = null; |
| 504 | /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */ |
| 505 | |
| 506 | var FORBID_ATTR = null; |
| 507 | /* Decide if ARIA attributes are okay */ |
| 508 | |
| 509 | var ALLOW_ARIA_ATTR = true; |
| 510 | /* Decide if custom data attributes are okay */ |
| 511 | |
| 512 | var ALLOW_DATA_ATTR = true; |
| 513 | /* Decide if unknown protocols are okay */ |
| 514 | |
| 515 | var ALLOW_UNKNOWN_PROTOCOLS = false; |
| 516 | /* Decide if self-closing tags in attributes are allowed. |
| 517 | * Usually removed due to a mXSS issue in jQuery 3.0 */ |
| 518 | |
| 519 | var ALLOW_SELF_CLOSE_IN_ATTR = true; |
| 520 | /* Output should be safe for common template engines. |
| 521 | * This means, DOMPurify removes data attributes, mustaches and ERB |
| 522 | */ |
| 523 | |
| 524 | var SAFE_FOR_TEMPLATES = false; |
| 525 | /* Decide if document with <html>... should be returned */ |
| 526 | |
| 527 | var WHOLE_DOCUMENT = false; |
| 528 | /* Track whether config is already set on this instance of DOMPurify. */ |
| 529 | |
| 530 | var SET_CONFIG = false; |
| 531 | /* Decide if all elements (e.g. style, script) must be children of |
| 532 | * document.body. By default, browsers might move them to document.head */ |
| 533 | |
| 534 | var FORCE_BODY = false; |
| 535 | /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html |
| 536 | * string (or a TrustedHTML object if Trusted Types are supported). |
| 537 | * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead |
| 538 | */ |
| 539 | |
| 540 | var RETURN_DOM = false; |
| 541 | /* Decide if a DOM `DocumentFragment` should be returned, instead of a html |
| 542 | * string (or a TrustedHTML object if Trusted Types are supported) */ |
| 543 | |
| 544 | var RETURN_DOM_FRAGMENT = false; |
| 545 | /* Try to return a Trusted Type object instead of a string, return a string in |
| 546 | * case Trusted Types are not supported */ |
| 547 | |
| 548 | var RETURN_TRUSTED_TYPE = false; |
| 549 | /* Output should be free from DOM clobbering attacks? |
| 550 | * This sanitizes markups named with colliding, clobberable built-in DOM APIs. |
| 551 | */ |
| 552 | |
| 553 | var SANITIZE_DOM = true; |
| 554 | /* Achieve full DOM Clobbering protection by isolating the namespace of named |
| 555 | * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules. |
| 556 | * |
| 557 | * HTML/DOM spec rules that enable DOM Clobbering: |
| 558 | * - Named Access on Window (§7.3.3) |
| 559 | * - DOM Tree Accessors (§3.1.5) |
| 560 | * - Form Element Parent-Child Relations (§4.10.3) |
| 561 | * - Iframe srcdoc / Nested WindowProxies (§4.8.5) |
| 562 | * - HTMLCollection (§4.2.10.2) |
| 563 | * |
| 564 | * Namespace isolation is implemented by prefixing `id` and `name` attributes |
| 565 | * with a constant string, i.e., `user-content-` |
| 566 | */ |
| 567 | |
| 568 | var SANITIZE_NAMED_PROPS = false; |
| 569 | var SANITIZE_NAMED_PROPS_PREFIX = 'user-content-'; |
| 570 | /* Keep element content when removing element? */ |
| 571 | |
| 572 | var KEEP_CONTENT = true; |
| 573 | /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead |
| 574 | * of importing it into a new Document and returning a sanitized copy */ |
| 575 | |
| 576 | var IN_PLACE = false; |
| 577 | /* Allow usage of profiles like html, svg and mathMl */ |
| 578 | |
| 579 | var USE_PROFILES = {}; |
| 580 | /* Tags to ignore content of when KEEP_CONTENT is true */ |
| 581 | |
| 582 | var FORBID_CONTENTS = null; |
| 583 | var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']); |
| 584 | /* Tags that are safe for data: URIs */ |
| 585 | |
| 586 | var DATA_URI_TAGS = null; |
| 587 | var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']); |
| 588 | /* Attributes safe for values like "javascript:" */ |
| 589 | |
| 590 | var URI_SAFE_ATTRIBUTES = null; |
| 591 | var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']); |
| 592 | var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML'; |
| 593 | var SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; |
| 594 | var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; |
| 595 | /* Document namespace */ |
| 596 | |
| 597 | var NAMESPACE = HTML_NAMESPACE; |
| 598 | var IS_EMPTY_INPUT = false; |
| 599 | /* Allowed XHTML+XML namespaces */ |
| 600 | |
| 601 | var ALLOWED_NAMESPACES = null; |
| 602 | var DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString); |
| 603 | /* Parsing of strict XHTML documents */ |
| 604 | |
| 605 | var PARSER_MEDIA_TYPE; |
| 606 | var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html']; |
| 607 | var DEFAULT_PARSER_MEDIA_TYPE = 'text/html'; |
| 608 | var transformCaseFunc; |
| 609 | /* Keep a reference to config to pass to hooks */ |
| 610 | |
| 611 | var CONFIG = null; |
| 612 | /* Ideally, do not touch anything below this line */ |
| 613 | |
| 614 | /* ______________________________________________ */ |
| 615 | |
| 616 | var formElement = document.createElement('form'); |
| 617 | |
| 618 | var isRegexOrFunction = function isRegexOrFunction(testValue) { |
| 619 | return testValue instanceof RegExp || testValue instanceof Function; |
| 620 | }; |
| 621 | /** |
| 622 | * _parseConfig |
| 623 | * |
| 624 | * @param {Object} cfg optional config literal |
| 625 | */ |
| 626 | // eslint-disable-next-line complexity |
| 627 | |
| 628 | |
| 629 | var _parseConfig = function _parseConfig(cfg) { |
| 630 | if (CONFIG && CONFIG === cfg) { |
| 631 | return; |
| 632 | } |
| 633 | /* Shield configuration object from tampering */ |
| 634 | |
| 635 | |
| 636 | if (!cfg || _typeof(cfg) !== 'object') { |
| 637 | cfg = {}; |
| 638 | } |
| 639 | /* Shield configuration object from prototype pollution */ |
| 640 | |
| 641 | |
| 642 | cfg = clone(cfg); |
| 643 | PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes |
| 644 | SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is. |
| 645 | |
| 646 | transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase; |
| 647 | /* Set configuration parameters */ |
| 648 | |
| 649 | ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS; |
| 650 | ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR; |
| 651 | ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES; |
| 652 | URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent |
| 653 | cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent |
| 654 | transformCaseFunc // eslint-disable-line indent |
| 655 | ) // eslint-disable-line indent |
| 656 | : DEFAULT_URI_SAFE_ATTRIBUTES; |
| 657 | DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent |
| 658 | cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent |
| 659 | transformCaseFunc // eslint-disable-line indent |
| 660 | ) // eslint-disable-line indent |
| 661 | : DEFAULT_DATA_URI_TAGS; |
| 662 | FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS; |
| 663 | FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {}; |
| 664 | FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {}; |
| 665 | USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false; |
| 666 | ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true |
| 667 | |
| 668 | ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true |
| 669 | |
| 670 | ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false |
| 671 | |
| 672 | ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true |
| 673 | |
| 674 | SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false |
| 675 | |
| 676 | WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false |
| 677 | |
| 678 | RETURN_DOM = cfg.RETURN_DOM || false; // Default false |
| 679 | |
| 680 | RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false |
| 681 | |
| 682 | RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false |
| 683 | |
| 684 | FORCE_BODY = cfg.FORCE_BODY || false; // Default false |
| 685 | |
| 686 | SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true |
| 687 | |
| 688 | SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false |
| 689 | |
| 690 | KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true |
| 691 | |
| 692 | IN_PLACE = cfg.IN_PLACE || false; // Default false |
| 693 | |
| 694 | IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1; |
| 695 | NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; |
| 696 | CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {}; |
| 697 | |
| 698 | if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) { |
| 699 | CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; |
| 700 | } |
| 701 | |
| 702 | if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) { |
| 703 | CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; |
| 704 | } |
| 705 | |
| 706 | if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') { |
| 707 | CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; |
| 708 | } |
| 709 | |
| 710 | if (SAFE_FOR_TEMPLATES) { |
| 711 | ALLOW_DATA_ATTR = false; |
| 712 | } |
| 713 | |
| 714 | if (RETURN_DOM_FRAGMENT) { |
| 715 | RETURN_DOM = true; |
| 716 | } |
| 717 | /* Parse profile info */ |
| 718 | |
| 719 | |
| 720 | if (USE_PROFILES) { |
| 721 | ALLOWED_TAGS = addToSet({}, _toConsumableArray(text)); |
| 722 | ALLOWED_ATTR = []; |
| 723 | |
| 724 | if (USE_PROFILES.html === true) { |
| 725 | addToSet(ALLOWED_TAGS, html$1); |
| 726 | addToSet(ALLOWED_ATTR, html); |
| 727 | } |
| 728 | |
| 729 | if (USE_PROFILES.svg === true) { |
| 730 | addToSet(ALLOWED_TAGS, svg$1); |
| 731 | addToSet(ALLOWED_ATTR, svg); |
| 732 | addToSet(ALLOWED_ATTR, xml); |
| 733 | } |
| 734 | |
| 735 | if (USE_PROFILES.svgFilters === true) { |
| 736 | addToSet(ALLOWED_TAGS, svgFilters); |
| 737 | addToSet(ALLOWED_ATTR, svg); |
| 738 | addToSet(ALLOWED_ATTR, xml); |
| 739 | } |
| 740 | |
| 741 | if (USE_PROFILES.mathMl === true) { |
| 742 | addToSet(ALLOWED_TAGS, mathMl$1); |
| 743 | addToSet(ALLOWED_ATTR, mathMl); |
| 744 | addToSet(ALLOWED_ATTR, xml); |
| 745 | } |
| 746 | } |
| 747 | /* Merge configuration parameters */ |
| 748 | |
| 749 | |
| 750 | if (cfg.ADD_TAGS) { |
| 751 | if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { |
| 752 | ALLOWED_TAGS = clone(ALLOWED_TAGS); |
| 753 | } |
| 754 | |
| 755 | addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); |
| 756 | } |
| 757 | |
| 758 | if (cfg.ADD_ATTR) { |
| 759 | if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { |
| 760 | ALLOWED_ATTR = clone(ALLOWED_ATTR); |
| 761 | } |
| 762 | |
| 763 | addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); |
| 764 | } |
| 765 | |
| 766 | if (cfg.ADD_URI_SAFE_ATTR) { |
| 767 | addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); |
| 768 | } |
| 769 | |
| 770 | if (cfg.FORBID_CONTENTS) { |
| 771 | if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { |
| 772 | FORBID_CONTENTS = clone(FORBID_CONTENTS); |
| 773 | } |
| 774 | |
| 775 | addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc); |
| 776 | } |
| 777 | /* Add #text in case KEEP_CONTENT is set to true */ |
| 778 | |
| 779 | |
| 780 | if (KEEP_CONTENT) { |
| 781 | ALLOWED_TAGS['#text'] = true; |
| 782 | } |
| 783 | /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */ |
| 784 | |
| 785 | |
| 786 | if (WHOLE_DOCUMENT) { |
| 787 | addToSet(ALLOWED_TAGS, ['html', 'head', 'body']); |
| 788 | } |
| 789 | /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */ |
| 790 | |
| 791 | |
| 792 | if (ALLOWED_TAGS.table) { |
| 793 | addToSet(ALLOWED_TAGS, ['tbody']); |
| 794 | delete FORBID_TAGS.tbody; |
| 795 | } // Prevent further manipulation of configuration. |
| 796 | // Not available in IE8, Safari 5, etc. |
| 797 | |
| 798 | |
| 799 | if (freeze) { |
| 800 | freeze(cfg); |
| 801 | } |
| 802 | |
| 803 | CONFIG = cfg; |
| 804 | }; |
| 805 | |
| 806 | var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']); |
| 807 | var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML |
| 808 | // namespace. We need to specify them explicitly |
| 809 | // so that they don't get erroneously deleted from |
| 810 | // HTML namespace. |
| 811 | |
| 812 | var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']); |
| 813 | /* Keep track of all possible SVG and MathML tags |
| 814 | * so that we can perform the namespace checks |
| 815 | * correctly. */ |
| 816 | |
| 817 | var ALL_SVG_TAGS = addToSet({}, svg$1); |
| 818 | addToSet(ALL_SVG_TAGS, svgFilters); |
| 819 | addToSet(ALL_SVG_TAGS, svgDisallowed); |
| 820 | var ALL_MATHML_TAGS = addToSet({}, mathMl$1); |
| 821 | addToSet(ALL_MATHML_TAGS, mathMlDisallowed); |
| 822 | /** |
| 823 | * |
| 824 | * |
| 825 | * @param {Element} element a DOM element whose namespace is being checked |
| 826 | * @returns {boolean} Return false if the element has a |
| 827 | * namespace that a spec-compliant parser would never |
| 828 | * return. Return true otherwise. |
| 829 | */ |
| 830 | |
| 831 | var _checkValidNamespace = function _checkValidNamespace(element) { |
| 832 | var parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode |
| 833 | // can be null. We just simulate parent in this case. |
| 834 | |
| 835 | if (!parent || !parent.tagName) { |
| 836 | parent = { |
| 837 | namespaceURI: NAMESPACE, |
| 838 | tagName: 'template' |
| 839 | }; |
| 840 | } |
| 841 | |
| 842 | var tagName = stringToLowerCase(element.tagName); |
| 843 | var parentTagName = stringToLowerCase(parent.tagName); |
| 844 | |
| 845 | if (!ALLOWED_NAMESPACES[element.namespaceURI]) { |
| 846 | return false; |
| 847 | } |
| 848 | |
| 849 | if (element.namespaceURI === SVG_NAMESPACE) { |
| 850 | // The only way to switch from HTML namespace to SVG |
| 851 | // is via <svg>. If it happens via any other tag, then |
| 852 | // it should be killed. |
| 853 | if (parent.namespaceURI === HTML_NAMESPACE) { |
| 854 | return tagName === 'svg'; |
| 855 | } // The only way to switch from MathML to SVG is via` |
| 856 | // svg if parent is either <annotation-xml> or MathML |
| 857 | // text integration points. |
| 858 | |
| 859 | |
| 860 | if (parent.namespaceURI === MATHML_NAMESPACE) { |
| 861 | return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); |
| 862 | } // We only allow elements that are defined in SVG |
| 863 | // spec. All others are disallowed in SVG namespace. |
| 864 | |
| 865 | |
| 866 | return Boolean(ALL_SVG_TAGS[tagName]); |
| 867 | } |
| 868 | |
| 869 | if (element.namespaceURI === MATHML_NAMESPACE) { |
| 870 | // The only way to switch from HTML namespace to MathML |
| 871 | // is via <math>. If it happens via any other tag, then |
| 872 | // it should be killed. |
| 873 | if (parent.namespaceURI === HTML_NAMESPACE) { |
| 874 | return tagName === 'math'; |
| 875 | } // The only way to switch from SVG to MathML is via |
| 876 | // <math> and HTML integration points |
| 877 | |
| 878 | |
| 879 | if (parent.namespaceURI === SVG_NAMESPACE) { |
| 880 | return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName]; |
| 881 | } // We only allow elements that are defined in MathML |
| 882 | // spec. All others are disallowed in MathML namespace. |
| 883 | |
| 884 | |
| 885 | return Boolean(ALL_MATHML_TAGS[tagName]); |
| 886 | } |
| 887 | |
| 888 | if (element.namespaceURI === HTML_NAMESPACE) { |
| 889 | // The only way to switch from SVG to HTML is via |
| 890 | // HTML integration points, and from MathML to HTML |
| 891 | // is via MathML text integration points |
| 892 | if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { |
| 893 | return false; |
| 894 | } |
| 895 | |
| 896 | if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { |
| 897 | return false; |
| 898 | } // We disallow tags that are specific for MathML |
| 899 | // or SVG and should never appear in HTML namespace |
| 900 | |
| 901 | |
| 902 | return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); |
| 903 | } // For XHTML and XML documents that support custom namespaces |
| 904 | |
| 905 | |
| 906 | if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) { |
| 907 | return true; |
| 908 | } // The code should never reach this place (this means |
| 909 | // that the element somehow got namespace that is not |
| 910 | // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES). |
| 911 | // Return false just in case. |
| 912 | |
| 913 | |
| 914 | return false; |
| 915 | }; |
| 916 | /** |
| 917 | * _forceRemove |
| 918 | * |
| 919 | * @param {Node} node a DOM node |
| 920 | */ |
| 921 | |
| 922 | |
| 923 | var _forceRemove = function _forceRemove(node) { |
| 924 | arrayPush(DOMPurify.removed, { |
| 925 | element: node |
| 926 | }); |
| 927 | |
| 928 | try { |
| 929 | // eslint-disable-next-line unicorn/prefer-dom-node-remove |
| 930 | node.parentNode.removeChild(node); |
| 931 | } catch (_) { |
| 932 | try { |
| 933 | node.outerHTML = emptyHTML; |
| 934 | } catch (_) { |
| 935 | node.remove(); |
| 936 | } |
| 937 | } |
| 938 | }; |
| 939 | /** |
| 940 | * _removeAttribute |
| 941 | * |
| 942 | * @param {String} name an Attribute name |
| 943 | * @param {Node} node a DOM node |
| 944 | */ |
| 945 | |
| 946 | |
| 947 | var _removeAttribute = function _removeAttribute(name, node) { |
| 948 | try { |
| 949 | arrayPush(DOMPurify.removed, { |
| 950 | attribute: node.getAttributeNode(name), |
| 951 | from: node |
| 952 | }); |
| 953 | } catch (_) { |
| 954 | arrayPush(DOMPurify.removed, { |
| 955 | attribute: null, |
| 956 | from: node |
| 957 | }); |
| 958 | } |
| 959 | |
| 960 | node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes |
| 961 | |
| 962 | if (name === 'is' && !ALLOWED_ATTR[name]) { |
| 963 | if (RETURN_DOM || RETURN_DOM_FRAGMENT) { |
| 964 | try { |
| 965 | _forceRemove(node); |
| 966 | } catch (_) {} |
| 967 | } else { |
| 968 | try { |
| 969 | node.setAttribute(name, ''); |
| 970 | } catch (_) {} |
| 971 | } |
| 972 | } |
| 973 | }; |
| 974 | /** |
| 975 | * _initDocument |
| 976 | * |
| 977 | * @param {String} dirty a string of dirty markup |
| 978 | * @return {Document} a DOM, filled with the dirty markup |
| 979 | */ |
| 980 | |
| 981 | |
| 982 | var _initDocument = function _initDocument(dirty) { |
| 983 | /* Create a HTML document */ |
| 984 | var doc; |
| 985 | var leadingWhitespace; |
| 986 | |
| 987 | if (FORCE_BODY) { |
| 988 | dirty = '<remove></remove>' + dirty; |
| 989 | } else { |
| 990 | /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */ |
| 991 | var matches = stringMatch(dirty, /^[\r\n\t ]+/); |
| 992 | leadingWhitespace = matches && matches[0]; |
| 993 | } |
| 994 | |
| 995 | if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) { |
| 996 | // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict) |
| 997 | dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>'; |
| 998 | } |
| 999 | |
| 1000 | var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; |
| 1001 | /* |
| 1002 | * Use the DOMParser API by default, fallback later if needs be |
| 1003 | * DOMParser not work for svg when has multiple root element. |
| 1004 | */ |
| 1005 | |
| 1006 | if (NAMESPACE === HTML_NAMESPACE) { |
| 1007 | try { |
| 1008 | doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); |
| 1009 | } catch (_) {} |
| 1010 | } |
| 1011 | /* Use createHTMLDocument in case DOMParser is not available */ |
| 1012 | |
| 1013 | |
| 1014 | if (!doc || !doc.documentElement) { |
| 1015 | doc = implementation.createDocument(NAMESPACE, 'template', null); |
| 1016 | |
| 1017 | try { |
| 1018 | doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload; |
| 1019 | } catch (_) {// Syntax error if dirtyPayload is invalid xml |
| 1020 | } |
| 1021 | } |
| 1022 | |
| 1023 | var body = doc.body || doc.documentElement; |
| 1024 | |
| 1025 | if (dirty && leadingWhitespace) { |
| 1026 | body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null); |
| 1027 | } |
| 1028 | /* Work on whole document or just its body */ |
| 1029 | |
| 1030 | |
| 1031 | if (NAMESPACE === HTML_NAMESPACE) { |
| 1032 | return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0]; |
| 1033 | } |
| 1034 | |
| 1035 | return WHOLE_DOCUMENT ? doc.documentElement : body; |
| 1036 | }; |
| 1037 | /** |
| 1038 | * _createIterator |
| 1039 | * |
| 1040 | * @param {Document} root document/fragment to create iterator for |
| 1041 | * @return {Iterator} iterator instance |
| 1042 | */ |
| 1043 | |
| 1044 | |
| 1045 | var _createIterator = function _createIterator(root) { |
| 1046 | return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise |
| 1047 | NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false); |
| 1048 | }; |
| 1049 | /** |
| 1050 | * _isClobbered |
| 1051 | * |
| 1052 | * @param {Node} elm element to check for clobbering attacks |
| 1053 | * @return {Boolean} true if clobbered, false if safe |
| 1054 | */ |
| 1055 | |
| 1056 | |
| 1057 | var _isClobbered = function _isClobbered(elm) { |
| 1058 | return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function'); |
| 1059 | }; |
| 1060 | /** |
| 1061 | * _isNode |
| 1062 | * |
| 1063 | * @param {Node} obj object to check whether it's a DOM node |
| 1064 | * @return {Boolean} true is object is a DOM node |
| 1065 | */ |
| 1066 | |
| 1067 | |
| 1068 | var _isNode = function _isNode(object) { |
| 1069 | return _typeof(Node) === 'object' ? object instanceof Node : object && _typeof(object) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'; |
| 1070 | }; |
| 1071 | /** |
| 1072 | * _executeHook |
| 1073 | * Execute user configurable hooks |
| 1074 | * |
| 1075 | * @param {String} entryPoint Name of the hook's entry point |
| 1076 | * @param {Node} currentNode node to work on with the hook |
| 1077 | * @param {Object} data additional hook parameters |
| 1078 | */ |
| 1079 | |
| 1080 | |
| 1081 | var _executeHook = function _executeHook(entryPoint, currentNode, data) { |
| 1082 | if (!hooks[entryPoint]) { |
| 1083 | return; |
| 1084 | } |
| 1085 | |
| 1086 | arrayForEach(hooks[entryPoint], function (hook) { |
| 1087 | hook.call(DOMPurify, currentNode, data, CONFIG); |
| 1088 | }); |
| 1089 | }; |
| 1090 | /** |
| 1091 | * _sanitizeElements |
| 1092 | * |
| 1093 | * @protect nodeName |
| 1094 | * @protect textContent |
| 1095 | * @protect removeChild |
| 1096 | * |
| 1097 | * @param {Node} currentNode to check for permission to exist |
| 1098 | * @return {Boolean} true if node was killed, false if left alive |
| 1099 | */ |
| 1100 | |
| 1101 | |
| 1102 | var _sanitizeElements = function _sanitizeElements(currentNode) { |
| 1103 | var content; |
| 1104 | /* Execute a hook if present */ |
| 1105 | |
| 1106 | _executeHook('beforeSanitizeElements', currentNode, null); |
| 1107 | /* Check if element is clobbered or can clobber */ |
| 1108 | |
| 1109 | |
| 1110 | if (_isClobbered(currentNode)) { |
| 1111 | _forceRemove(currentNode); |
| 1112 | |
| 1113 | return true; |
| 1114 | } |
| 1115 | /* Check if tagname contains Unicode */ |
| 1116 | |
| 1117 | |
| 1118 | if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) { |
| 1119 | _forceRemove(currentNode); |
| 1120 | |
| 1121 | return true; |
| 1122 | } |
| 1123 | /* Now let's check the element's type and name */ |
| 1124 | |
| 1125 | |
| 1126 | var tagName = transformCaseFunc(currentNode.nodeName); |
| 1127 | /* Execute a hook if present */ |
| 1128 | |
| 1129 | _executeHook('uponSanitizeElement', currentNode, { |
| 1130 | tagName: tagName, |
| 1131 | allowedTags: ALLOWED_TAGS |
| 1132 | }); |
| 1133 | /* Detect mXSS attempts abusing namespace confusion */ |
| 1134 | |
| 1135 | |
| 1136 | if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { |
| 1137 | _forceRemove(currentNode); |
| 1138 | |
| 1139 | return true; |
| 1140 | } |
| 1141 | /* Mitigate a problem with templates inside select */ |
| 1142 | |
| 1143 | |
| 1144 | if (tagName === 'select' && regExpTest(/<template/i, currentNode.innerHTML)) { |
| 1145 | _forceRemove(currentNode); |
| 1146 | |
| 1147 | return true; |
| 1148 | } |
| 1149 | /* Remove element if anything forbids its presence */ |
| 1150 | |
| 1151 | |
| 1152 | if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) { |
| 1153 | /* Check if we have a custom element to handle */ |
| 1154 | if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) { |
| 1155 | if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false; |
| 1156 | if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false; |
| 1157 | } |
| 1158 | /* Keep content except for bad-listed elements */ |
| 1159 | |
| 1160 | |
| 1161 | if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) { |
| 1162 | var parentNode = getParentNode(currentNode) || currentNode.parentNode; |
| 1163 | var childNodes = getChildNodes(currentNode) || currentNode.childNodes; |
| 1164 | |
| 1165 | if (childNodes && parentNode) { |
| 1166 | var childCount = childNodes.length; |
| 1167 | |
| 1168 | for (var i = childCount - 1; i >= 0; --i) { |
| 1169 | parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode)); |
| 1170 | } |
| 1171 | } |
| 1172 | } |
| 1173 | |
| 1174 | _forceRemove(currentNode); |
| 1175 | |
| 1176 | return true; |
| 1177 | } |
| 1178 | /* Check whether element has a valid namespace */ |
| 1179 | |
| 1180 | |
| 1181 | if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) { |
| 1182 | _forceRemove(currentNode); |
| 1183 | |
| 1184 | return true; |
| 1185 | } |
| 1186 | /* Make sure that older browsers don't get fallback-tag mXSS */ |
| 1187 | |
| 1188 | |
| 1189 | if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) { |
| 1190 | _forceRemove(currentNode); |
| 1191 | |
| 1192 | return true; |
| 1193 | } |
| 1194 | /* Sanitize element content to be template-safe */ |
| 1195 | |
| 1196 | |
| 1197 | if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) { |
| 1198 | /* Get the element's text content */ |
| 1199 | content = currentNode.textContent; |
| 1200 | content = stringReplace(content, MUSTACHE_EXPR$1, ' '); |
| 1201 | content = stringReplace(content, ERB_EXPR$1, ' '); |
| 1202 | content = stringReplace(content, TMPLIT_EXPR$1, ' '); |
| 1203 | |
| 1204 | if (currentNode.textContent !== content) { |
| 1205 | arrayPush(DOMPurify.removed, { |
| 1206 | element: currentNode.cloneNode() |
| 1207 | }); |
| 1208 | currentNode.textContent = content; |
| 1209 | } |
| 1210 | } |
| 1211 | /* Execute a hook if present */ |
| 1212 | |
| 1213 | |
| 1214 | _executeHook('afterSanitizeElements', currentNode, null); |
| 1215 | |
| 1216 | return false; |
| 1217 | }; |
| 1218 | /** |
| 1219 | * _isValidAttribute |
| 1220 | * |
| 1221 | * @param {string} lcTag Lowercase tag name of containing element. |
| 1222 | * @param {string} lcName Lowercase attribute name. |
| 1223 | * @param {string} value Attribute value. |
| 1224 | * @return {Boolean} Returns true if `value` is valid, otherwise false. |
| 1225 | */ |
| 1226 | // eslint-disable-next-line complexity |
| 1227 | |
| 1228 | |
| 1229 | var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) { |
| 1230 | /* Make sure attribute cannot clobber */ |
| 1231 | if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) { |
| 1232 | return false; |
| 1233 | } |
| 1234 | /* Allow valid data-* attributes: At least one character after "-" |
| 1235 | (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes) |
| 1236 | XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804) |
| 1237 | We don't need to check the value; it's always URI safe. */ |
| 1238 | |
| 1239 | |
| 1240 | if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR$1, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) { |
| 1241 | if ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND |
| 1242 | // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck |
| 1243 | // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck |
| 1244 | _basicCustomElementTest(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND |
| 1245 | // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck |
| 1246 | lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else { |
| 1247 | return false; |
| 1248 | } |
| 1249 | /* Check value is safe. First, is attr inert? If so, is safe */ |
| 1250 | |
| 1251 | } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ''))) ; else if (value) { |
| 1252 | return false; |
| 1253 | } else ; |
| 1254 | |
| 1255 | return true; |
| 1256 | }; |
| 1257 | /** |
| 1258 | * _basicCustomElementCheck |
| 1259 | * checks if at least one dash is included in tagName, and it's not the first char |
| 1260 | * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name |
| 1261 | * @param {string} tagName name of the tag of the node to sanitize |
| 1262 | */ |
| 1263 | |
| 1264 | |
| 1265 | var _basicCustomElementTest = function _basicCustomElementTest(tagName) { |
| 1266 | return tagName.indexOf('-') > 0; |
| 1267 | }; |
| 1268 | /** |
| 1269 | * _sanitizeAttributes |
| 1270 | * |
| 1271 | * @protect attributes |
| 1272 | * @protect nodeName |
| 1273 | * @protect removeAttribute |
| 1274 | * @protect setAttribute |
| 1275 | * |
| 1276 | * @param {Node} currentNode to sanitize |
| 1277 | */ |
| 1278 | |
| 1279 | |
| 1280 | var _sanitizeAttributes = function _sanitizeAttributes(currentNode) { |
| 1281 | var attr; |
| 1282 | var value; |
| 1283 | var lcName; |
| 1284 | var l; |
| 1285 | /* Execute a hook if present */ |
| 1286 | |
| 1287 | _executeHook('beforeSanitizeAttributes', currentNode, null); |
| 1288 | |
| 1289 | var attributes = currentNode.attributes; |
| 1290 | /* Check if we have attributes; if not we might have a text node */ |
| 1291 | |
| 1292 | if (!attributes) { |
| 1293 | return; |
| 1294 | } |
| 1295 | |
| 1296 | var hookEvent = { |
| 1297 | attrName: '', |
| 1298 | attrValue: '', |
| 1299 | keepAttr: true, |
| 1300 | allowedAttributes: ALLOWED_ATTR |
| 1301 | }; |
| 1302 | l = attributes.length; |
| 1303 | /* Go backwards over all attributes; safely remove bad ones */ |
| 1304 | |
| 1305 | while (l--) { |
| 1306 | attr = attributes[l]; |
| 1307 | var _attr = attr, |
| 1308 | name = _attr.name, |
| 1309 | namespaceURI = _attr.namespaceURI; |
| 1310 | value = name === 'value' ? attr.value : stringTrim(attr.value); |
| 1311 | lcName = transformCaseFunc(name); |
| 1312 | /* Execute a hook if present */ |
| 1313 | |
| 1314 | hookEvent.attrName = lcName; |
| 1315 | hookEvent.attrValue = value; |
| 1316 | hookEvent.keepAttr = true; |
| 1317 | hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set |
| 1318 | |
| 1319 | _executeHook('uponSanitizeAttribute', currentNode, hookEvent); |
| 1320 | |
| 1321 | value = hookEvent.attrValue; |
| 1322 | /* Did the hooks approve of the attribute? */ |
| 1323 | |
| 1324 | if (hookEvent.forceKeepAttr) { |
| 1325 | continue; |
| 1326 | } |
| 1327 | /* Remove attribute */ |
| 1328 | |
| 1329 | |
| 1330 | _removeAttribute(name, currentNode); |
| 1331 | /* Did the hooks approve of the attribute? */ |
| 1332 | |
| 1333 | |
| 1334 | if (!hookEvent.keepAttr) { |
| 1335 | continue; |
| 1336 | } |
| 1337 | /* Work around a security issue in jQuery 3.0 */ |
| 1338 | |
| 1339 | |
| 1340 | if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) { |
| 1341 | _removeAttribute(name, currentNode); |
| 1342 | |
| 1343 | continue; |
| 1344 | } |
| 1345 | /* Sanitize attribute content to be template-safe */ |
| 1346 | |
| 1347 | |
| 1348 | if (SAFE_FOR_TEMPLATES) { |
| 1349 | value = stringReplace(value, MUSTACHE_EXPR$1, ' '); |
| 1350 | value = stringReplace(value, ERB_EXPR$1, ' '); |
| 1351 | value = stringReplace(value, TMPLIT_EXPR$1, ' '); |
| 1352 | } |
| 1353 | /* Is `value` valid for this attribute? */ |
| 1354 | |
| 1355 | |
| 1356 | var lcTag = transformCaseFunc(currentNode.nodeName); |
| 1357 | |
| 1358 | if (!_isValidAttribute(lcTag, lcName, value)) { |
| 1359 | continue; |
| 1360 | } |
| 1361 | /* Full DOM Clobbering protection via namespace isolation, |
| 1362 | * Prefix id and name attributes with `user-content-` |
| 1363 | */ |
| 1364 | |
| 1365 | |
| 1366 | if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) { |
| 1367 | // Remove the attribute with this value |
| 1368 | _removeAttribute(name, currentNode); // Prefix the value and later re-create the attribute with the sanitized value |
| 1369 | |
| 1370 | |
| 1371 | value = SANITIZE_NAMED_PROPS_PREFIX + value; |
| 1372 | } |
| 1373 | /* Handle attributes that require Trusted Types */ |
| 1374 | |
| 1375 | |
| 1376 | if (trustedTypesPolicy && _typeof(trustedTypes) === 'object' && typeof trustedTypes.getAttributeType === 'function') { |
| 1377 | if (namespaceURI) ; else { |
| 1378 | switch (trustedTypes.getAttributeType(lcTag, lcName)) { |
| 1379 | case 'TrustedHTML': |
| 1380 | { |
| 1381 | value = trustedTypesPolicy.createHTML(value); |
| 1382 | break; |
| 1383 | } |
| 1384 | |
| 1385 | case 'TrustedScriptURL': |
| 1386 | { |
| 1387 | value = trustedTypesPolicy.createScriptURL(value); |
| 1388 | break; |
| 1389 | } |
| 1390 | } |
| 1391 | } |
| 1392 | } |
| 1393 | /* Handle invalid data-* attribute set by try-catching it */ |
| 1394 | |
| 1395 | |
| 1396 | try { |
| 1397 | if (namespaceURI) { |
| 1398 | currentNode.setAttributeNS(namespaceURI, name, value); |
| 1399 | } else { |
| 1400 | /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */ |
| 1401 | currentNode.setAttribute(name, value); |
| 1402 | } |
| 1403 | |
| 1404 | arrayPop(DOMPurify.removed); |
| 1405 | } catch (_) {} |
| 1406 | } |
| 1407 | /* Execute a hook if present */ |
| 1408 | |
| 1409 | |
| 1410 | _executeHook('afterSanitizeAttributes', currentNode, null); |
| 1411 | }; |
| 1412 | /** |
| 1413 | * _sanitizeShadowDOM |
| 1414 | * |
| 1415 | * @param {DocumentFragment} fragment to iterate over recursively |
| 1416 | */ |
| 1417 | |
| 1418 | |
| 1419 | var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) { |
| 1420 | var shadowNode; |
| 1421 | |
| 1422 | var shadowIterator = _createIterator(fragment); |
| 1423 | /* Execute a hook if present */ |
| 1424 | |
| 1425 | |
| 1426 | _executeHook('beforeSanitizeShadowDOM', fragment, null); |
| 1427 | |
| 1428 | while (shadowNode = shadowIterator.nextNode()) { |
| 1429 | /* Execute a hook if present */ |
| 1430 | _executeHook('uponSanitizeShadowNode', shadowNode, null); |
| 1431 | /* Sanitize tags and elements */ |
| 1432 | |
| 1433 | |
| 1434 | if (_sanitizeElements(shadowNode)) { |
| 1435 | continue; |
| 1436 | } |
| 1437 | /* Deep shadow DOM detected */ |
| 1438 | |
| 1439 | |
| 1440 | if (shadowNode.content instanceof DocumentFragment) { |
| 1441 | _sanitizeShadowDOM(shadowNode.content); |
| 1442 | } |
| 1443 | /* Check attributes, sanitize if necessary */ |
| 1444 | |
| 1445 | |
| 1446 | _sanitizeAttributes(shadowNode); |
| 1447 | } |
| 1448 | /* Execute a hook if present */ |
| 1449 | |
| 1450 | |
| 1451 | _executeHook('afterSanitizeShadowDOM', fragment, null); |
| 1452 | }; |
| 1453 | /** |
| 1454 | * Sanitize |
| 1455 | * Public method providing core sanitation functionality |
| 1456 | * |
| 1457 | * @param {String|Node} dirty string or DOM node |
| 1458 | * @param {Object} configuration object |
| 1459 | */ |
| 1460 | // eslint-disable-next-line complexity |
| 1461 | |
| 1462 | |
| 1463 | DOMPurify.sanitize = function (dirty) { |
| 1464 | var cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
| 1465 | var body; |
| 1466 | var importedNode; |
| 1467 | var currentNode; |
| 1468 | var oldNode; |
| 1469 | var returnNode; |
| 1470 | /* Make sure we have a string to sanitize. |
| 1471 | DO NOT return early, as this will return the wrong type if |
| 1472 | the user has requested a DOM object rather than a string */ |
| 1473 | |
| 1474 | IS_EMPTY_INPUT = !dirty; |
| 1475 | |
| 1476 | if (IS_EMPTY_INPUT) { |
| 1477 | dirty = '<!-->'; |
| 1478 | } |
| 1479 | /* Stringify, in case dirty is an object */ |
| 1480 | |
| 1481 | |
| 1482 | if (typeof dirty !== 'string' && !_isNode(dirty)) { |
| 1483 | if (typeof dirty.toString === 'function') { |
| 1484 | dirty = dirty.toString(); |
| 1485 | |
| 1486 | if (typeof dirty !== 'string') { |
| 1487 | throw typeErrorCreate('dirty is not a string, aborting'); |
| 1488 | } |
| 1489 | } else { |
| 1490 | throw typeErrorCreate('toString is not a function'); |
| 1491 | } |
| 1492 | } |
| 1493 | /* Check we can run. Otherwise fall back or ignore */ |
| 1494 | |
| 1495 | |
| 1496 | if (!DOMPurify.isSupported) { |
| 1497 | if (_typeof(window.toStaticHTML) === 'object' || typeof window.toStaticHTML === 'function') { |
| 1498 | if (typeof dirty === 'string') { |
| 1499 | return window.toStaticHTML(dirty); |
| 1500 | } |
| 1501 | |
| 1502 | if (_isNode(dirty)) { |
| 1503 | return window.toStaticHTML(dirty.outerHTML); |
| 1504 | } |
| 1505 | } |
| 1506 | |
| 1507 | return dirty; |
| 1508 | } |
| 1509 | /* Assign config vars */ |
| 1510 | |
| 1511 | |
| 1512 | if (!SET_CONFIG) { |
| 1513 | _parseConfig(cfg); |
| 1514 | } |
| 1515 | /* Clean up removed elements */ |
| 1516 | |
| 1517 | |
| 1518 | DOMPurify.removed = []; |
| 1519 | /* Check if dirty is correctly typed for IN_PLACE */ |
| 1520 | |
| 1521 | if (typeof dirty === 'string') { |
| 1522 | IN_PLACE = false; |
| 1523 | } |
| 1524 | |
| 1525 | if (IN_PLACE) { |
| 1526 | /* Do some early pre-sanitization to avoid unsafe root nodes */ |
| 1527 | if (dirty.nodeName) { |
| 1528 | var tagName = transformCaseFunc(dirty.nodeName); |
| 1529 | |
| 1530 | if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) { |
| 1531 | throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place'); |
| 1532 | } |
| 1533 | } |
| 1534 | } else if (dirty instanceof Node) { |
| 1535 | /* If dirty is a DOM element, append to an empty document to avoid |
| 1536 | elements being stripped by the parser */ |
| 1537 | body = _initDocument('<!---->'); |
| 1538 | importedNode = body.ownerDocument.importNode(dirty, true); |
| 1539 | |
| 1540 | if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') { |
| 1541 | /* Node is already a body, use as is */ |
| 1542 | body = importedNode; |
| 1543 | } else if (importedNode.nodeName === 'HTML') { |
| 1544 | body = importedNode; |
| 1545 | } else { |
| 1546 | // eslint-disable-next-line unicorn/prefer-dom-node-append |
| 1547 | body.appendChild(importedNode); |
| 1548 | } |
| 1549 | } else { |
| 1550 | /* Exit directly if we have nothing to do */ |
| 1551 | if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes |
| 1552 | dirty.indexOf('<') === -1) { |
| 1553 | return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty; |
| 1554 | } |
| 1555 | /* Initialize the document to work on */ |
| 1556 | |
| 1557 | |
| 1558 | body = _initDocument(dirty); |
| 1559 | /* Check we have a DOM node from the data */ |
| 1560 | |
| 1561 | if (!body) { |
| 1562 | return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : ''; |
| 1563 | } |
| 1564 | } |
| 1565 | /* Remove first element node (ours) if FORCE_BODY is set */ |
| 1566 | |
| 1567 | |
| 1568 | if (body && FORCE_BODY) { |
| 1569 | _forceRemove(body.firstChild); |
| 1570 | } |
| 1571 | /* Get node iterator */ |
| 1572 | |
| 1573 | |
| 1574 | var nodeIterator = _createIterator(IN_PLACE ? dirty : body); |
| 1575 | /* Now start iterating over the created document */ |
| 1576 | |
| 1577 | |
| 1578 | while (currentNode = nodeIterator.nextNode()) { |
| 1579 | /* Fix IE's strange behavior with manipulated textNodes #89 */ |
| 1580 | if (currentNode.nodeType === 3 && currentNode === oldNode) { |
| 1581 | continue; |
| 1582 | } |
| 1583 | /* Sanitize tags and elements */ |
| 1584 | |
| 1585 | |
| 1586 | if (_sanitizeElements(currentNode)) { |
| 1587 | continue; |
| 1588 | } |
| 1589 | /* Shadow DOM detected, sanitize it */ |
| 1590 | |
| 1591 | |
| 1592 | if (currentNode.content instanceof DocumentFragment) { |
| 1593 | _sanitizeShadowDOM(currentNode.content); |
| 1594 | } |
| 1595 | /* Check attributes, sanitize if necessary */ |
| 1596 | |
| 1597 | |
| 1598 | _sanitizeAttributes(currentNode); |
| 1599 | |
| 1600 | oldNode = currentNode; |
| 1601 | } |
| 1602 | |
| 1603 | oldNode = null; |
| 1604 | /* If we sanitized `dirty` in-place, return it. */ |
| 1605 | |
| 1606 | if (IN_PLACE) { |
| 1607 | return dirty; |
| 1608 | } |
| 1609 | /* Return sanitized string or DOM */ |
| 1610 | |
| 1611 | |
| 1612 | if (RETURN_DOM) { |
| 1613 | if (RETURN_DOM_FRAGMENT) { |
| 1614 | returnNode = createDocumentFragment.call(body.ownerDocument); |
| 1615 | |
| 1616 | while (body.firstChild) { |
| 1617 | // eslint-disable-next-line unicorn/prefer-dom-node-append |
| 1618 | returnNode.appendChild(body.firstChild); |
| 1619 | } |
| 1620 | } else { |
| 1621 | returnNode = body; |
| 1622 | } |
| 1623 | |
| 1624 | if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmod) { |
| 1625 | /* |
| 1626 | AdoptNode() is not used because internal state is not reset |
| 1627 | (e.g. the past names map of a HTMLFormElement), this is safe |
| 1628 | in theory but we would rather not risk another attack vector. |
| 1629 | The state that is cloned by importNode() is explicitly defined |
| 1630 | by the specs. |
| 1631 | */ |
| 1632 | returnNode = importNode.call(originalDocument, returnNode, true); |
| 1633 | } |
| 1634 | |
| 1635 | return returnNode; |
| 1636 | } |
| 1637 | |
| 1638 | var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML; |
| 1639 | /* Serialize doctype if allowed */ |
| 1640 | |
| 1641 | if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) { |
| 1642 | serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML; |
| 1643 | } |
| 1644 | /* Sanitize final string template-safe */ |
| 1645 | |
| 1646 | |
| 1647 | if (SAFE_FOR_TEMPLATES) { |
| 1648 | serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR$1, ' '); |
| 1649 | serializedHTML = stringReplace(serializedHTML, ERB_EXPR$1, ' '); |
| 1650 | serializedHTML = stringReplace(serializedHTML, TMPLIT_EXPR$1, ' '); |
| 1651 | } |
| 1652 | |
| 1653 | return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML; |
| 1654 | }; |
| 1655 | /** |
| 1656 | * Public method to set the configuration once |
| 1657 | * setConfig |
| 1658 | * |
| 1659 | * @param {Object} cfg configuration object |
| 1660 | */ |
| 1661 | |
| 1662 | |
| 1663 | DOMPurify.setConfig = function (cfg) { |
| 1664 | _parseConfig(cfg); |
| 1665 | |
| 1666 | SET_CONFIG = true; |
| 1667 | }; |
| 1668 | /** |
| 1669 | * Public method to remove the configuration |
| 1670 | * clearConfig |
| 1671 | * |
| 1672 | */ |
| 1673 | |
| 1674 | |
| 1675 | DOMPurify.clearConfig = function () { |
| 1676 | CONFIG = null; |
| 1677 | SET_CONFIG = false; |
| 1678 | }; |
| 1679 | /** |
| 1680 | * Public method to check if an attribute value is valid. |
| 1681 | * Uses last set config, if any. Otherwise, uses config defaults. |
| 1682 | * isValidAttribute |
| 1683 | * |
| 1684 | * @param {string} tag Tag name of containing element. |
| 1685 | * @param {string} attr Attribute name. |
| 1686 | * @param {string} value Attribute value. |
| 1687 | * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false. |
| 1688 | */ |
| 1689 | |
| 1690 | |
| 1691 | DOMPurify.isValidAttribute = function (tag, attr, value) { |
| 1692 | /* Initialize shared config vars if necessary. */ |
| 1693 | if (!CONFIG) { |
| 1694 | _parseConfig({}); |
| 1695 | } |
| 1696 | |
| 1697 | var lcTag = transformCaseFunc(tag); |
| 1698 | var lcName = transformCaseFunc(attr); |
| 1699 | return _isValidAttribute(lcTag, lcName, value); |
| 1700 | }; |
| 1701 | /** |
| 1702 | * AddHook |
| 1703 | * Public method to add DOMPurify hooks |
| 1704 | * |
| 1705 | * @param {String} entryPoint entry point for the hook to add |
| 1706 | * @param {Function} hookFunction function to execute |
| 1707 | */ |
| 1708 | |
| 1709 | |
| 1710 | DOMPurify.addHook = function (entryPoint, hookFunction) { |
| 1711 | if (typeof hookFunction !== 'function') { |
| 1712 | return; |
| 1713 | } |
| 1714 | |
| 1715 | hooks[entryPoint] = hooks[entryPoint] || []; |
| 1716 | arrayPush(hooks[entryPoint], hookFunction); |
| 1717 | }; |
| 1718 | /** |
| 1719 | * RemoveHook |
| 1720 | * Public method to remove a DOMPurify hook at a given entryPoint |
| 1721 | * (pops it from the stack of hooks if more are present) |
| 1722 | * |
| 1723 | * @param {String} entryPoint entry point for the hook to remove |
| 1724 | * @return {Function} removed(popped) hook |
| 1725 | */ |
| 1726 | |
| 1727 | |
| 1728 | DOMPurify.removeHook = function (entryPoint) { |
| 1729 | if (hooks[entryPoint]) { |
| 1730 | return arrayPop(hooks[entryPoint]); |
| 1731 | } |
| 1732 | }; |
| 1733 | /** |
| 1734 | * RemoveHooks |
| 1735 | * Public method to remove all DOMPurify hooks at a given entryPoint |
| 1736 | * |
| 1737 | * @param {String} entryPoint entry point for the hooks to remove |
| 1738 | */ |
| 1739 | |
| 1740 | |
| 1741 | DOMPurify.removeHooks = function (entryPoint) { |
| 1742 | if (hooks[entryPoint]) { |
| 1743 | hooks[entryPoint] = []; |
| 1744 | } |
| 1745 | }; |
| 1746 | /** |
| 1747 | * RemoveAllHooks |
| 1748 | * Public method to remove all DOMPurify hooks |
| 1749 | * |
| 1750 | */ |
| 1751 | |
| 1752 | |
| 1753 | DOMPurify.removeAllHooks = function () { |
| 1754 | hooks = {}; |
| 1755 | }; |
| 1756 | |
| 1757 | return DOMPurify; |
| 1758 | } |
| 1759 | |
| 1760 | var purify = createDOMPurify(); |
| 1761 | |
| 1762 | return purify; |
| 1763 | |
| 1764 | })); |
| 1765 | //# sourceMappingURL=purify.js.map |
| 1766 | |
| 1767 | |
| 1768 | /***/ }), |
| 1769 | |
| 1770 | /***/ "react": |
| 1771 | /*!************************!*\ |
| 1772 | !*** external "React" ***! |
| 1773 | \************************/ |
| 1774 | /***/ ((module) => { |
| 1775 | |
| 1776 | "use strict"; |
| 1777 | module.exports = window["React"]; |
| 1778 | |
| 1779 | /***/ }), |
| 1780 | |
| 1781 | /***/ "@woocommerce/blocks-registry": |
| 1782 | /*!******************************************!*\ |
| 1783 | !*** external ["wc","wcBlocksRegistry"] ***! |
| 1784 | \******************************************/ |
| 1785 | /***/ ((module) => { |
| 1786 | |
| 1787 | "use strict"; |
| 1788 | module.exports = window["wc"]["wcBlocksRegistry"]; |
| 1789 | |
| 1790 | /***/ }), |
| 1791 | |
| 1792 | /***/ "@woocommerce/settings": |
| 1793 | /*!************************************!*\ |
| 1794 | !*** external ["wc","wcSettings"] ***! |
| 1795 | \************************************/ |
| 1796 | /***/ ((module) => { |
| 1797 | |
| 1798 | "use strict"; |
| 1799 | module.exports = window["wc"]["wcSettings"]; |
| 1800 | |
| 1801 | /***/ }), |
| 1802 | |
| 1803 | /***/ "@wordpress/element": |
| 1804 | /*!*********************************!*\ |
| 1805 | !*** external ["wp","element"] ***! |
| 1806 | \*********************************/ |
| 1807 | /***/ ((module) => { |
| 1808 | |
| 1809 | "use strict"; |
| 1810 | module.exports = window["wp"]["element"]; |
| 1811 | |
| 1812 | /***/ }), |
| 1813 | |
| 1814 | /***/ "@wordpress/html-entities": |
| 1815 | /*!**************************************!*\ |
| 1816 | !*** external ["wp","htmlEntities"] ***! |
| 1817 | \**************************************/ |
| 1818 | /***/ ((module) => { |
| 1819 | |
| 1820 | "use strict"; |
| 1821 | module.exports = window["wp"]["htmlEntities"]; |
| 1822 | |
| 1823 | /***/ }), |
| 1824 | |
| 1825 | /***/ "@wordpress/i18n": |
| 1826 | /*!******************************!*\ |
| 1827 | !*** external ["wp","i18n"] ***! |
| 1828 | \******************************/ |
| 1829 | /***/ ((module) => { |
| 1830 | |
| 1831 | "use strict"; |
| 1832 | module.exports = window["wp"]["i18n"]; |
| 1833 | |
| 1834 | /***/ }) |
| 1835 | |
| 1836 | /******/ }); |
| 1837 | /************************************************************************/ |
| 1838 | /******/ // The module cache |
| 1839 | /******/ var __webpack_module_cache__ = {}; |
| 1840 | /******/ |
| 1841 | /******/ // The require function |
| 1842 | /******/ function __webpack_require__(moduleId) { |
| 1843 | /******/ // Check if module is in cache |
| 1844 | /******/ var cachedModule = __webpack_module_cache__[moduleId]; |
| 1845 | /******/ if (cachedModule !== undefined) { |
| 1846 | /******/ return cachedModule.exports; |
| 1847 | /******/ } |
| 1848 | /******/ // Create a new module (and put it into the cache) |
| 1849 | /******/ var module = __webpack_module_cache__[moduleId] = { |
| 1850 | /******/ // no module.id needed |
| 1851 | /******/ // no module.loaded needed |
| 1852 | /******/ exports: {} |
| 1853 | /******/ }; |
| 1854 | /******/ |
| 1855 | /******/ // Execute the module function |
| 1856 | /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
| 1857 | /******/ |
| 1858 | /******/ // Return the exports of the module |
| 1859 | /******/ return module.exports; |
| 1860 | /******/ } |
| 1861 | /******/ |
| 1862 | /************************************************************************/ |
| 1863 | /******/ /* webpack/runtime/compat get default export */ |
| 1864 | /******/ (() => { |
| 1865 | /******/ // getDefaultExport function for compatibility with non-harmony modules |
| 1866 | /******/ __webpack_require__.n = (module) => { |
| 1867 | /******/ var getter = module && module.__esModule ? |
| 1868 | /******/ () => (module['default']) : |
| 1869 | /******/ () => (module); |
| 1870 | /******/ __webpack_require__.d(getter, { a: getter }); |
| 1871 | /******/ return getter; |
| 1872 | /******/ }; |
| 1873 | /******/ })(); |
| 1874 | /******/ |
| 1875 | /******/ /* webpack/runtime/define property getters */ |
| 1876 | /******/ (() => { |
| 1877 | /******/ // define getter functions for harmony exports |
| 1878 | /******/ __webpack_require__.d = (exports, definition) => { |
| 1879 | /******/ for(var key in definition) { |
| 1880 | /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 1881 | /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 1882 | /******/ } |
| 1883 | /******/ } |
| 1884 | /******/ }; |
| 1885 | /******/ })(); |
| 1886 | /******/ |
| 1887 | /******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 1888 | /******/ (() => { |
| 1889 | /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
| 1890 | /******/ })(); |
| 1891 | /******/ |
| 1892 | /******/ /* webpack/runtime/make namespace object */ |
| 1893 | /******/ (() => { |
| 1894 | /******/ // define __esModule on exports |
| 1895 | /******/ __webpack_require__.r = (exports) => { |
| 1896 | /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 1897 | /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 1898 | /******/ } |
| 1899 | /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 1900 | /******/ }; |
| 1901 | /******/ })(); |
| 1902 | /******/ |
| 1903 | /************************************************************************/ |
| 1904 | var __webpack_exports__ = {}; |
| 1905 | // This entry need to be wrapped in an IIFE because it need to be in strict mode. |
| 1906 | (() => { |
| 1907 | "use strict"; |
| 1908 | /*!***********************************************************!*\ |
| 1909 | !*** ./assets/js/extensions/payment-methods/cod/index.js ***! |
| 1910 | \***********************************************************/ |
| 1911 | __webpack_require__.r(__webpack_exports__); |
| 1912 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react"); |
| 1913 | /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); |
| 1914 | /* harmony import */ var _woocommerce_blocks_registry__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @woocommerce/blocks-registry */ "@woocommerce/blocks-registry"); |
| 1915 | /* harmony import */ var _woocommerce_blocks_registry__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_blocks_registry__WEBPACK_IMPORTED_MODULE_1__); |
| 1916 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n"); |
| 1917 | /* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__); |
| 1918 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @woocommerce/settings */ "@woocommerce/settings"); |
| 1919 | /* harmony import */ var _woocommerce_settings__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_woocommerce_settings__WEBPACK_IMPORTED_MODULE_3__); |
| 1920 | /* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/html-entities */ "@wordpress/html-entities"); |
| 1921 | /* harmony import */ var _wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__); |
| 1922 | /* harmony import */ var _woocommerce_utils__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @woocommerce/utils */ "./assets/js/utils/sanitize-html.ts"); |
| 1923 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element"); |
| 1924 | /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__); |
| 1925 | /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./constants */ "./assets/js/extensions/payment-methods/cod/constants.js"); |
| 1926 | var _settings$supports; |
| 1927 | |
| 1928 | /** |
| 1929 | * External dependencies |
| 1930 | */ |
| 1931 | |
| 1932 | |
| 1933 | |
| 1934 | |
| 1935 | |
| 1936 | |
| 1937 | |
| 1938 | /** |
| 1939 | * Internal dependencies |
| 1940 | */ |
| 1941 | |
| 1942 | const settings = (0,_woocommerce_settings__WEBPACK_IMPORTED_MODULE_3__.getPaymentMethodData)('cod', {}); |
| 1943 | const defaultLabel = (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)('Cash on delivery', 'woocommerce'); |
| 1944 | const label = (0,_wordpress_html_entities__WEBPACK_IMPORTED_MODULE_4__.decodeEntities)((settings === null || settings === void 0 ? void 0 : settings.title) || '') || defaultLabel; |
| 1945 | |
| 1946 | /** |
| 1947 | * Content component |
| 1948 | */ |
| 1949 | const Content = () => { |
| 1950 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_wordpress_element__WEBPACK_IMPORTED_MODULE_5__.RawHTML, null, (0,_woocommerce_utils__WEBPACK_IMPORTED_MODULE_6__.sanitizeHTML)(settings.description || '')); |
| 1951 | }; |
| 1952 | |
| 1953 | /** |
| 1954 | * Label component |
| 1955 | * |
| 1956 | * @param {*} props Props from payment API. |
| 1957 | */ |
| 1958 | const Label = props => { |
| 1959 | const { |
| 1960 | PaymentMethodLabel |
| 1961 | } = props.components; |
| 1962 | return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(PaymentMethodLabel, { |
| 1963 | text: label |
| 1964 | }); |
| 1965 | }; |
| 1966 | |
| 1967 | /** |
| 1968 | * Determine whether COD is available for this cart/order. |
| 1969 | * |
| 1970 | * @param {Object} props Incoming props for the component. |
| 1971 | * @param {boolean} props.cartNeedsShipping True if the cart contains any physical/shippable products. |
| 1972 | * @param {boolean} props.selectedShippingMethods |
| 1973 | * |
| 1974 | * @return {boolean} True if COD payment method should be displayed as a payment option. |
| 1975 | */ |
| 1976 | const canMakePayment = ({ |
| 1977 | cartNeedsShipping, |
| 1978 | selectedShippingMethods |
| 1979 | }) => { |
| 1980 | if (!settings.enableForVirtual && !cartNeedsShipping) { |
| 1981 | // Store doesn't allow COD for virtual orders AND |
| 1982 | // order doesn't contain any shippable products. |
| 1983 | return false; |
| 1984 | } |
| 1985 | if (!settings.enableForShippingMethods.length) { |
| 1986 | // Store does not limit COD to specific shipping methods. |
| 1987 | return true; |
| 1988 | } |
| 1989 | |
| 1990 | // Look for a supported shipping method in the user's selected |
| 1991 | // shipping methods. If one is found, then COD is allowed. |
| 1992 | const selectedMethods = Object.values(selectedShippingMethods); |
| 1993 | // supported shipping methods might be global (eg. "Any flat rate"), hence |
| 1994 | // this is doing a `String.prototype.includes` match vs a `Array.prototype.includes` match. |
| 1995 | return settings.enableForShippingMethods.some(shippingMethodId => { |
| 1996 | return selectedMethods.some(selectedMethod => { |
| 1997 | return selectedMethod.includes(shippingMethodId); |
| 1998 | }); |
| 1999 | }); |
| 2000 | }; |
| 2001 | |
| 2002 | /** |
| 2003 | * Cash on Delivery (COD) payment method config object. |
| 2004 | */ |
| 2005 | const cashOnDeliveryPaymentMethod = { |
| 2006 | name: _constants__WEBPACK_IMPORTED_MODULE_7__.PAYMENT_METHOD_NAME, |
| 2007 | label: (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(Label, null), |
| 2008 | content: (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(Content, null), |
| 2009 | edit: (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(Content, null), |
| 2010 | canMakePayment, |
| 2011 | ariaLabel: label, |
| 2012 | supports: { |
| 2013 | features: (_settings$supports = settings === null || settings === void 0 ? void 0 : settings.supports) !== null && _settings$supports !== void 0 ? _settings$supports : [] |
| 2014 | } |
| 2015 | }; |
| 2016 | (0,_woocommerce_blocks_registry__WEBPACK_IMPORTED_MODULE_1__.registerPaymentMethod)(cashOnDeliveryPaymentMethod); |
| 2017 | })(); |
| 2018 | |
| 2019 | /******/ })() |
| 2020 | ; |
| 2021 | //# sourceMappingURL=wc-payment-method-cod.js.map |