1(globalThis.webpackChunkwebpackWcBlocksFrontendJsonp=globalThis.webpackChunkwebpackWcBlocksFrontendJsonp||[]).push([[515],{9734:(e,t,r)=>{"use strict";r.d(t,{A:()=>i}),r(9300);var n=r(790);const i=({children:e})=>(0,n.jsx)("div",{className:"wc-block-filter-title-placeholder",children:e})},9045:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(7723),i=r(4921),o=r(4656),c=(r(7165),r(790));const s=({className:e, 2/* translators: Reset button text for filters. */ 3label:t=(0,n.__)("Reset","woocommerce"),onClick:r,screenReaderLabel:s=(0,n.__)("Reset filter","woocommerce")})=>(0,c.jsx)("button",{className:(0,i.A)("wc-block-components-filter-reset-button",e),onClick:r,children:(0,c.jsx)(o.Label,{label:t,screenReaderLabel:s})})},8324:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var n=r(7723),i=r(4921),o=r(4656),c=(r(874),r(790));const s=({className:e,isLoading:t,disabled:r, 4/* translators: Submit button text for filters. */ 5label:s=(0,n.__)("Apply","woocommerce"),onClick:a,screenReaderLabel:l=(0,n.__)("Apply filter","woocommerce")})=>(0,c.jsx)("button",{type:"submit",className:(0,i.A)("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":t},e),disabled:r,onClick:a,children:(0,c.jsx)(o.Label,{label:s,screenReaderLabel:l})})},5926:(e,t,r)=>{"use strict";r.d(t,{A:()=>m});var n=r(6087),i=r(4347),o=r(3993),c=r(9456),s=r(3846),a=r(7913),l=r(1073),u=r(2655);const m=({queryAttribute:e,queryTaxonomy:t,queryPrices:r,queryStock:m,queryRating:d,queryState:p,isEditor:b=!1})=>{let _=(0,u._)();_=`${_}-collection-data`;const[f]=(0,a.dJ)(_),[g,h]=(0,a.xd)("calculate_attribute_counts",[],_),[y,w]=(0,a.xd)("calculate_taxonomy_counts",[],_),[x,k]=(0,a.xd)("calculate_price_range",null,_),[v,N]=(0,a.xd)("calculate_stock_status_counts",null,_),[S,F]=(0,a.xd)("calculate_rating_counts",null,_),C=(0,s.c)(e||{}),j=(0,s.c)(t),E=(0,s.c)(r),A=(0,s.c)(m),R=(0,s.c)(d);(0,n.useEffect)((()=>{"object"==typeof C&&Object.keys(C).length&&(g.find((e=>(0,o.objectHasProp)(C,"taxonomy")&&e.taxonomy===C.taxonomy))||h([...g,C]))}),[C,g,h]),(0,n.useEffect)((()=>{j&&!y.includes(j)&&w([...y,j])}),[j,y,w]),(0,n.useEffect)((()=>{x!==E&&void 0!==E&&k(E)}),[E,k,x]),(0,n.useEffect)((()=>{v!==A&&void 0!==A&&N(A)}),[A,N,v]),(0,n.useEffect)((()=>{S!==R&&void 0!==R&&F(R)}),[R,F,S]);const[P,U]=(0,n.useState)(b),[L]=(0,i.d7)(P,200);P||U(!0);const T=(0,n.useMemo)((()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=(0,c.di)(e.calculate_attribute_counts.map((({taxonomy:e,queryType:t})=>({taxonomy:e,query_type:t})))).asc(["taxonomy","query_type"])),Array.isArray(e.calculate_taxonomy_counts)&&(t.calculate_taxonomy_counts=e.calculate_taxonomy_counts),t})(f)),[f]),{results:I,isLoading:O}=(0,l.G)({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...p,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...T},shouldSelect:L});return{data:I,isLoading:O}}},1073:(e,t,r)=>{"use strict";r.d(t,{G:()=>l});var n=r(7594),i=r(7143),o=r(6087),c=r(3846),s=r(2260),a=r(3993);const l=e=>{const{namespace:t,resourceName:r,resourceValues:l=[],query:u={},shouldSelect:m=!0}=e;if(!t||!r)throw new Error("The options object must have valid values for the namespace and the resource properties.");const d=(0,o.useRef)({results:[],isLoading:!0}),p=(0,c.c)(u),b=(0,c.c)(l),_=(0,s.a)(),f=(0,i.useSelect)((e=>{if(!m)return null;const i=e(n.COLLECTIONS_STORE_KEY),o=[t,r,p,b],c=i.getCollectionError(...o);if(c){if(!(0,a.isError)(c))throw new Error("TypeError: `error` object is not an instance of Error constructor");_(c)}return{results:i.getCollection(...o),isLoading:!i.hasFinishedResolution("getCollection",o)}}),[t,r,b,p,m,_]);return null!==f&&(d.current=f),d.current}},7913:(e,t,r)=>{"use strict";r.d(t,{dJ:()=>s,xd:()=>a});var n=r(7594),i=r(7143),o=r(6087),c=(r(923),r(2655));const s=e=>{const t=(0,c._)();e=e||t;const r=(0,i.useSelect)((t=>t(n.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0)),[e]),{setValueForQueryContext:s}=(0,i.useDispatch)(n.QUERY_STATE_STORE_KEY);return[r,(0,o.useCallback)((t=>{s(e,t)}),[e,s])]},a=(e,t,r)=>{const s=(0,c._)();r=r||s;const a=(0,i.useSelect)((i=>
5i(n.QUERY_STATE_STORE_KEY).getValueForQueryKey(r,e,t)),[r,e]),{setQueryValue:l}=(0,i.useDispatch)(n.QUERY_STATE_STORE_KEY);return[a,(0,o.useCallback)((t=>{l(r,e,t)}),[r,e,l])]}},2655:(e,t,r)=>{"use strict";r.d(t,{_:()=>o});var n=r(6087);const i=(0,n.createContext)("page"),o=()=>(0,n.useContext)(i);i.Provider},8346:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});var n=r(6087);function i(e,t){const r=(0,n.useRef)();return(0,n.useEffect)((()=>{r.current===e||t&&!t(e,r.current)||(r.current=e)}),[e,t]),r.current}},3846:(e,t,r)=>{"use strict";r.d(t,{c:()=>c});var n=r(6087),i=r(923),o=r.n(i);function c(e){const t=(0,n.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},1927:(e,t,r)=>{"use strict";r.d(t,{p:()=>l});var n=r(4921),i=r(3993),o=r(7356),c=r(9786);function s(e={}){const t={};return(0,c.getCSSRules)(e,{selector:""}).forEach((e=>{t[e.key]=e.value})),t}function a(e,t){return e&&t?`has-${(0,o.c)(t)}-${e}`:""}const l=e=>{const t=(e=>{const t=(0,i.isObject)(e)?e:{style:{}};let r=t.style;return(0,i.isString)(r)&&(r=JSON.parse(r)||{}),(0,i.isObject)(r)||(r={}),{...t,style:r}})(e),r=function(e){const{backgroundColor:t,textColor:r,gradient:o,style:c}=e,l=a("background-color",t),u=a("color",r),m=function(e){if(e)return`has-${e}-gradient-background`}(o),d=m||c?.color?.gradient;return{className:(0,n.A)(u,m,{[l]:!d&&!!l,"has-text-color":r||c?.color?.text,"has-background":t||c?.color?.background||o||c?.color?.gradient,"has-link-color":(0,i.isObject)(c?.elements?.link)?c?.elements?.link?.color:void 0}),style:s({color:c?.color||{}})}}(t),o=function(e){const t=e.style?.border||{};return{className:function(e){const{borderColor:t,style:r}=e,i=t?a("border-color",t):"";return(0,n.A)({"has-border-color":!!t||!!r?.border?.color,[i]:!!i})}(e),style:s({border:t})}}(t),c=function(e){return{className:void 0,style:s({spacing:e.style?.spacing||{}})}}(t),l=(e=>{const t=(0,i.isObject)(e.style.typography)?e.style.typography:{},r=(0,i.isString)(t.fontFamily)?t.fontFamily:"";return{className:e.fontFamily?`has-${e.fontFamily}-font-family`:r,style:{fontSize:e.fontSize?`var(--wp--preset--font-size--${e.fontSize})`:t.fontSize,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,lineHeight:t.lineHeight,textDecoration:t.textDecoration,textTransform:t.textTransform}}})(t);return{className:(0,n.A)(l.className,r.className,o.className,c.className),style:{...l.style,...r.style,...o.style,...c.style}}}},2260:(e,t,r)=>{"use strict";r.d(t,{a:()=>i});var n=r(6087);const i=()=>{const[,e]=(0,n.useState)();return(0,n.useCallback)((t=>{e((()=>{throw t}))}),[])}},6248:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>P});var n=r(4921),i=r(1927),o=r(3993),c=r(8346),s=r(7913),a=r(5926),l=r(6087),u=r(7723),m=r(4656),d=r(4347);r(6599);const p=(e,t,r,n=1,i=!1)=>{let[o,c]=e;const s=e=>Number.isFinite(e);return s(o)||(o=t||0),s(c)||(c=r||n),s(t)&&t>o&&(o=t),s(r)&&r<=o&&(o=r-n),s(t)&&t>=c&&(c=t+n),s(r)&&r<c&&(c=r),!i&&o>=c&&(o=c-n),i&&c<=o&&(c=o+n),[o,c]};var b=r(8324);const _=({maxConstraint:e,minorUnit:t})=>({floatValue:r})=>void 0!==r&&r<=e/10**t&&r>0,f=({minConstraint:e,currentMaxValue:t,minorUnit:r})=>({floatValue:n})=>void 0!==n&&n>=e/10**r&&n<t/10**r;var g=r(9045),h=r(790);const y=({minPrice:e,maxPrice:t,minConstraint:r,maxConstraint:i,onChange:c,step:s,currency:a,showInputFields:y=!0,showFilterButton:w=!1,inlineInput:x=!0,isLoading:k=!1,isUpdating:v=!1,isEditor:N=!1,onSubmit:S=()=>{}})=>{const F=(0,l.useRef)(null),C=(0,l.useRef)(null),j=s||10**a.minorUnit,[E,A]=(0,l.useState)(e),[R,P]=(0,l.useState)(t),U=(0,l.useRef)(null),[L,T]=(0,l.useState)(0);(0,l.useEffect)((()=>{A(e)}),[e]),(0,l.useEffect)((()=>{P(t)}),[t]),(0,l.useLayoutEffect)((()=>{x&&U.current&&T(U.current?.offsetWidth)}),[x,T]);const I=(0,l.useMemo)((()=>isFinite(r)&&isFinite(i)),[r,i]),O=(0,l.useMemo)((()=>isFinite(e)&&isFinite(t)&&I?{"--low":(e-r)/(i-r)*100+"%","--high":(t-r)/(i-r)*100+"%"}:{"--low":"0%","--high":"100%"}),[e,t,r,i,I]),M=(0,l.useCallback)((e=>{if(k||!I||!F.current||!C.current)return;const t=e.target.getBoundingClientRect(),r=e.clientX-t.left,n=F.current.offsetWidth,o=+F.current.value,c=C.current.offsetWidth,s=+C.current.value,a=n*(o/i),l=c*(s/i);Math.abs(r-a)>Math.abs(r-l)?(F.current.style.zIndex="20",C.current.style.zIndex="21"):(F.current.style.zIndex="21",C.current.style.zIndex="20")}),[k,i,I]),Q=(0,l.useCallback)((n=>{const o=n.target.classList.contains("wc-block-price-filter__range-input--min"),s=+n.target.value,a=o?[Math.round(s/j)*j,t]:[e,Math.round(s/j)*j],l=p(a,r,i,j,o);c(l)}),[c,e,t,r,i,j]),q=(0,d.YQ)(((e,t,r)=>{if(e>
5=t){const e=p([0,t],null,null,j,r);return c([parseInt(e[0],10),parseInt(e[1],10)])}const n=p([e,t],null,null,j,r);c(n)}),1e3),B=(0,d.YQ)(S,600),V=(0,n.A)("wc-block-price-filter","wc-block-components-price-slider",y&&"wc-block-price-filter--has-input-fields",y&&"wc-block-components-price-slider--has-input-fields",w&&"wc-block-price-filter--has-filter-button",w&&"wc-block-components-price-slider--has-filter-button",!I&&"is-disabled",(x||L<=300)&&"wc-block-components-price-slider--is-input-inline"),Y=(0,o.isObject)(F.current)?F.current.ownerDocument.activeElement:void 0,W=Y&&Y===F.current?j:1,H=Y&&Y===C.current?j:1,$=String(E/10**a.minorUnit),z=String(R/10**a.minorUnit),D=x&&L>300,K=(0,h.jsx)("div",{className:(0,n.A)("wc-block-price-filter__range-input-wrapper","wc-block-components-price-slider__range-input-wrapper",{"is-loading":k&&v}),onMouseMove:M,onFocus:M,children:I&&(0,h.jsxs)("div",{"aria-hidden":y,children:[(0,h.jsx)("div",{className:"wc-block-price-filter__range-input-progress wc-block-components-price-slider__range-input-progress",style:O}),(0,h.jsx)("input",{type:"range",className:"wc-block-price-filter__range-input wc-block-price-filter__range-input--min wc-block-components-price-slider__range-input wc-block-components-price-slider__range-input--min","aria-label":(0,u.__)("Filter products by minimum price","woocommerce"),"aria-valuetext":$,value:Number.isFinite(e)?e:r,onChange:Q,step:W,min:r,max:i,ref:F,disabled:k&&!I,tabIndex:y?-1:0}),(0,h.jsx)("input",{type:"range",className:"wc-block-price-filter__range-input wc-block-price-filter__range-input--max wc-block-components-price-slider__range-input wc-block-components-price-slider__range-input--max","aria-label":(0,u.__)("Filter products by maximum price","woocommerce"),"aria-valuetext":z,value:Number.isFinite(t)?t:i,onChange:Q,step:H,min:r,max:i,ref:C,disabled:k,tabIndex:y?-1:0})]})}),J=e=>`wc-block-price-filter__amount wc-block-price-filter__amount--${e} wc-block-form-text-input wc-block-components-price-slider__amount wc-block-components-price-slider__amount--${e}`,Z={currency:a,decimalScale:0},G={...Z,displayType:"input",allowNegative:!1,disabled:k||!I,onClick:e=>{const t=e.currentTarget;t&&t.select()}};return(0,h.jsxs)("div",{className:V,ref:U,children:[(!D||!y)&&K,y&&(0,h.jsxs)("div",{className:"wc-block-price-filter__controls wc-block-components-price-slider__controls",children:[v?(0,h.jsx)("div",{className:"input-loading"}):(0,h.jsxs)("div",{className:"wc-block-price-filter__control wc-block-components-price-slider__control",children:[(0,h.jsx)("label",{className:"wc-block-components-price-slider__label",htmlFor:"minPriceInput",children:(0,u.__)("Min. Price","woocommerce")}),(0,h.jsx)(m.FormattedMonetaryAmount,{...G,id:"minPriceInput",className:J("min"),"aria-label":(0,u.__)("Filter products by minimum price","woocommerce"),isAllowed:f({minConstraint:r,minorUnit:a.minorUnit,currentMaxValue:R}),onValueChange:e=>{e!==E&&(A(e),q(e,R,!0))},value:E})]}),D&&K,v?(0,h.jsx)("div",{className:"input-loading"}):(0,h.jsxs)("div",{className:"wc-block-price-filter__control wc-block-components-price-slider__control",children:[(0,h.jsx)("label",{className:"wc-block-components-price-slider__label",htmlFor:"maxPriceInput",children:(0,u.__)("Max. Price","woocommerce")}),(0,h.jsx)(m.FormattedMonetaryAmount,{...G,id:"maxPriceInput",className:J("max"),"aria-label":(0,u.__)("Filter products by maximum price","woocommerce"),isAllowed:_({maxConstraint:i,minorUnit:a.minorUnit}),onValueChange:e=>{e!==R&&(P(e),q(E,e,!1))},value:R})]})]}),!y&&!v&&Number.isFinite(e)&&Number.isFinite(t)&&(0,h.jsxs)("div",{className:"wc-block-price-filter__range-text wc-block-components-price-slider__range-text",children:[(0,h.jsx)(m.FormattedMonetaryAmount,{...Z,value:e}),(0,h.jsx)(m.FormattedMonetaryAmount,{...Z,value:t})]}),(0,h.jsxs)("div",{className:"wc-block-components-price-slider__actions",children:[(N||!v&&(e!==r||t!==i))&&(0,h.jsx)(g.A,{onClick:()=>{c([r,i]),B()},screenReaderLabel:(0,u.__)("Reset price filter","woocommerce")}),w&&(0,h.jsx)(b.A,{className:"wc-block-price-filter__button wc-block-components-price-slider__button",isLoading:v,disabled:k||!I,onClick:S,screenReaderLabel:(0,u.__)("Apply price filter","woocommerce")})]})]})};var w=r(9734),x=r(910),k=r(5703),v=r(3832),N=r(4227);const S="ROUND_UP",F="ROUND_DOWN",C=(e,t,r)=>{const n=1*10**t;let i=null;const o=parseFloat(e);isNaN(o)||(r===S?i=Math.ceil(o/n)*n:r===F&&(i=Math.floor(o/n)*n));const s=(0,c.Z)(i,Number.isFinite);return Number.isFinite(i)?i:s};r(1465);var j=r(1053);function E(e,t){return Number(e)*10**t}const A=({attributes:e,isEditor:t=!1})=>{const r=(0,j.LY)(),n=(0,k.getSettingWithCoercion)("hasFilterableProducts",!1,o.isBoolean),i=(0,k.getSettingWithCoercion)("isRenderingPhpTemplate",!1,o.isBoolean),[u,m]=(0,l.useState)(!1),p=(0,N.Vf)("min_price"),b=(0,N.Vf)("max_price"),[_]=(0,s.dJ)(),f=(0,k.getSettingWithCoercion)("queryState",{},o.isObject),{data:g,isLoading:A}=(0,a.A)({queryPrices:!0,queryState:{...f,..._},isEditor:t}),R=(0,x.getCurrencyFromPriceResponse)((0,o.objectHasProp)(g,"price_range")?g.price_range:void 0),[P,U]=(0,s.xd)("min_price"),[L,T]=(0,s.xd)("max_price"),[I,O]=(0,l.useState)(E(p,R.minorUnit)||null),[M,Q]=(0,l.useState)(E(b,R.minorUnit)||null),{minConstraint:q,maxConstraint:B}=(({minPrice:e,maxPrice:t,minorUnit:r})=>({minConstraint:C(e||"",r,F),maxConstraint:C(t||"",r,S)}))({minPrice:(0,o.objectHasProp)(g,"price_range")&&(0,o.objectHasProp)(g.price_range,"min_price")&&(0,o.isString)(g.price_range.min_price)?g.price_range.min_price:void 0,maxPrice:(0,o.objectHasProp)(g,"price_range")&&(0,o.objectHasProp)(g.price_range,"max_price")&&(0,o.isString)(g.price_range.max_price)?g.price_range.max_price:void 0,minorUnit:R.minorUnit});(0,l.useEffect)((()=>{u||(U(E(p,R.minorUnit)),T(E(b,R.minorUnit)),m(!0))}),[R.minorUnit,u,b,p,T,U]);const[V,Y]=(0,l.useState)(A),W=(0,l.useCallback)(((e,t)=>{const r=t>=Number(B)?void 0:t,n=e<=Number(q)?void 0:e;if(window){const e=function(e,t){const r={};for(const[e,n]of Object.entries(t))n?r[e]=n.toString():delete r[e];const n=(0,v.removeQueryArgs)(e,...Object.keys(t));return(0,v.addQueryArgs)(n,r)}(window.location.href,{min_price:n/10**R.minorUnit,max_price:r/10**R.minorUnit});window.location.href!==e&&(0,N.CH)(e)}U(n),T(r)}),[q,B,U,T,R.minorUnit]),H=(0,d.YQ)(W,500),$=(0,l.useCallback)((t=>{Y(!0),t[0]!==I&&O(t[0]),t[1]!==M&&Q(t[1]),i&&u&&!e.showFilterButton&&H(t[0],t[1])}),[I,M,O,Q,i,u,H,e.showFilterButton]);(0,l.useEffect)((()=>{e.showFilterButton||i||H(I,M)}),[I,M,e.showFilterButton,H,i]);const z=(0,c.Z)(P),D=(0,c.Z)(L),K=(0,c.Z)(q),J=(0,c.Z)(B);if((0,l.useEffect)((()=>{(!Number.isFinite(I)||P!==z&&P!==I||q!==K&&q!==I)&&O(Number.isFinite(P)?P:q),(!Number.isFinite(M)||L!==D&&L!==M||B!==J&&B!==M)&&Q(Number.isFinite(L)?L:B)}),[I,M,P,L,q,B,K,J,z,D]),!n)return r(!1),null;if(!A&&(null===q||null===B||q===B))return r(!1),null;const Z=`h${e.headingLevel}`;r(!0),!A&&V&&Y(!1);const G=(0,h.jsx)(Z,{className:"wc-block-price-filter__title",children:e.heading}),X=A&&V?(0,h.jsx)(w.A,{children:G}):G;return(0,h.jsxs)(h.Fragment,{children:[!t&&e.heading&&X,(0,h.jsx)("div",{className:"wc-block-price-slider",children:(0,h.jsx)(y,{minConstraint:q,maxConstraint:B,minPrice:I,maxPrice:M,currency:R,showInputFields:e.showInputFields,inlineInput:e.inlineInput,showFilterButton:e.showFilterButton,onChange:$,onSubmit:()=>W(I,M),isLoading:A,isUpdating:V,isEditor:t})})]})},R=JSON.parse('{"uK":{"F8":{"A":3}}}'),P=e=>{const t=(0,i.p)(e),r=(c=e,{heading:(0,o.isString)(c?.heading)?c.heading:"",headingLevel:(0,o.isString)(c?.headingLevel)&&parseInt(c.headingLevel,10)||R.uK.F8.A,showFilterButton:"true"===c?.showFilterButton,showInputFields:"false"!==c?.showInputFields,inlineInput:"true"===c?.inlineInput});var c;return(0,h.jsx)("div",{className:(0,n.A)((0,o.isString)(e.className)?e.className:"",t.className),style:t.style,children:(0,h.jsx)(A,{isEditor:!1,attributes:r})})}},4227:(e,t,r)=>{"use strict";r.d(t,{CH:()=>u,Q:()=>m,Vf:()=>l,nD:()=>a,xB:()=>s});var n=r(3832),i=r(5703),o=r(3993);const c=(0,i.getSettingWithCoercion)("isRenderingPhpTemplate",!1,o.isBoolean),s="query_type_",a="filter_";function l(e){return window?(0,n.getQueryArg)(window.location.href,e):null}function u(e){if(c){const t=new URL(e);t.pathname=t.pathname.replace(/\/page\/[0-9]+/i,""),t.searchParams.delete("paged"),t.searchParams.forEac
5h(((e,r)=>{r.match(/^query(?:-[0-9]+)?-page$/)&&t.searchParams.delete(r)})),window.location.href=t.href}else window.history.replaceState({},"",e)}const m=e=>{const t=(0,n.getQueryArgs)(e);return(0,n.addQueryArgs)(e,t)}},9300:()=>{},7165:()=>{},874:()=>{},6599:()=>{},1465:()=>{}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.