File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/price-filter.js.tar
httpdocs/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/price-filter.js 0000644 00000065305 15154514732 0034344 0 ustar 00 var/www/vhosts/uyarreklam.com.tr this.wc=this.wc||{},this.wc.blocks=this.wc.blocks||{},this.wc.blocks["price-filter"]=function(e){function t(t){for(var c,i,a=t[0],l=t[1],s=t[2],b=0,p=[];b<a.length;b++)i=a[b],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&p.push(r[i][0]),r[i]=0;for(c in l)Object.prototype.hasOwnProperty.call(l,c)&&(e[c]=l[c]);for(u&&u(t);p.length;)p.shift()();return o.push.apply(o,s||[]),n()}function n(){for(var e,t=0;t<o.length;t++){for(var n=o[t],c=!0,a=1;a<n.length;a++){var l=n[a];0!==r[l]&&(c=!1)}c&&(o.splice(t--,1),e=i(i.s=n[0]))}return e}var c={},r={21:0,1:0},o=[];function i(t){if(c[t])return c[t].exports;var n=c[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=e,i.c=c,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)i.d(n,c,function(t){return e[t]}.bind(null,c));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="";var a=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],l=a.push.bind(a);a.push=t,a=a.slice();for(var s=0;s<a.length;s++)t(a[s]);var u=l;return o.push([530,0]),n()}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},108:function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var c=n(0);function r(e,t){const n=Object(c.useRef)();return Object(c.useEffect)((()=>{n.current===e||t&&!t(e,n.current)||(n.current=e)}),[e,t]),n.current}},11:function(e,t){e.exports=window.wp.compose},119:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));const c=e=>"string"==typeof e},120:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var c=n(0);const r=Object(c.createContext)({}),o=()=>{const{wrapper:e}=Object(c.useContext)(r);return t=>{e&&e.current&&(e.current.hidden=!t)}}},126:function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var c=n(8),r=n(6),o=n(0),i=n(47);const a=e=>{const{namespace:t,resourceName:n,resourceValues:a=[],query:l={},shouldSelect:s=!0}=e;if(!t||!n)throw new Error("The options object must have valid values for the namespace and the resource properties.");const u=Object(o.useRef)({results:[],isLoading:!0}),b=Object(i.a)(l),p=Object(i.a)(a),d=(()=>{const[,e]=Object(o.useState)();return Object(o.useCallback)((t=>{e((()=>{throw t}))}),[])})(),m=Object(r.useSelect)((e=>{if(!s)return null;const r=e(c.COLLECTIONS_STORE_KEY),o=[t,n,b,p],i=r.getCollectionError(...o);if(i){if(!(i instanceof Error))throw new Error("TypeError: `error` object is not an instance of Error constructor");d(i)}return{results:r.getCollection(...o),isLoading:!r.hasFinishedResolution("getCollection",o)}}),[t,n,p,b,s]);return null!==m&&(u.current=m),u.current}},141:function(e,t,n){"use strict";n.d(t,"a",(function(){return s}));var c=n(0),r=n(1),o=n(7),i=n(6),a=n(2),l=n(4);const s=({clientId:e,setAttributes:t,filterType:n,attributes:s})=>{const{replaceBlock:u}=Object(i.useDispatch)("core/block-editor"),{heading:b,headingLevel:p}=s;if(Object(i.useSelect)((t=>{const{getBlockParentsByBlockName:n}=t("core/block-editor");return n(e,"woocommerce/filter-wrapper").length>0}),[e])||!n)return null;const d=[Object(c.createElement)(a.Button,{key:"convert",onClick:()=>{const c=[Object(o.createBlock)(`woocommerce/${n}`,{...s,heading:""})];b&&""!==b&&c.unshift(Object(o.createBlock)("core/heading",{content:b,level:null!=p?p:2})),u(e,Object(o.createBlock)("woocommerce/filter-wrapper",{heading:b,filterType:n},[...c])),t({heading:"",lock:{remove:!0}})},variant:"primary"},Object(r.__)("Upgrade block","woocommerce"))];return Object(c.createElement)(l.Warning,{actions:d},Object(r.__)("Filter block: We have improved this block to make styling easier. Upgrade it using the button below.","woocommerce"))}},142:function(e,t,n){"use strict";var c=n(0),r=n(4),o=n(11),i=n(1);n(194),t.a=Object(o.withInstanceId)((({className:e,headingLevel:t,onChange:n,heading:o,instanceId:a})=>{const l=`h${t}`;return Object(c.createElement)(l,{className:e},Object(c.createElement)("label",{className:"screen-reader-text",htmlFor:`block-title-${a}`},Object(i.__)("Block title","woocommerce")),Object(c.createElement)(r.PlainText,{id:`block-title-${a}`,className:"wc-block-editor-components-title",value:o,onChange:n,style:{backgroundColor:"transparent"}}))}))},143:function(e,t,n){"use strict";var c=n(0);n(195),t.a=({children:e})=>Object(c.createElement)("div",{className:"wc-block-filter-title-placeholder"},e)},145:function(e,t,n){"use strict";var c=n(0),r=n(1),o=n(5),i=n.n(o),a=n(30);n(198),t.a=({className:e,
/* translators: Reset button text for filters. */
label:t=Object(r.__)("Reset","woocommerce"),onClick:n,screenReaderLabel:o=Object(r.__)("Reset filter","woocommerce")})=>Object(c.createElement)("button",{className:i()("wc-block-components-filter-reset-button",e),onClick:n},Object(c.createElement)(a.a,{label:t,screenReaderLabel:o}))},146:function(e,t,n){"use strict";var c=n(0),r=n(1),o=n(5),i=n.n(o),a=n(30);n(199),t.a=({className:e,isLoading:t,disabled:n,
/* translators: Submit button text for filters. */
label:o=Object(r.__)("Apply","woocommerce"),onClick:l,screenReaderLabel:s=Object(r.__)("Apply filter","woocommerce")})=>Object(c.createElement)("button",{type:"submit",className:i()("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":t},e),disabled:n,onClick:l},Object(c.createElement)(a.a,{label:o,screenReaderLabel:s}))},15:function(e,t){e.exports=window.wp.url},159:function(e,t){},17:function(e,t,n){"use strict";n.d(t,"p",(function(){return o})),n.d(t,"n",(function(){return i})),n.d(t,"m",(function(){return a})),n.d(t,"o",(function(){return l})),n.d(t,"k",(function(){return s})),n.d(t,"e",(function(){return u})),n.d(t,"h",(function(){return b})),n.d(t,"l",(function(){return p})),n.d(t,"c",(function(){return d})),n.d(t,"d",(function(){return m})),n.d(t,"g",(function(){return f})),n.d(t,"a",(function(){return j})),n.d(t,"b",(function(){return w})),n.d(t,"i",(function(){return _})),n.d(t,"j",(function(){return h})),n.d(t,"f",(function(){return k}));var c,r=n(3);const o=Object(r.getSetting)("wcBlocksConfig",{buildPhase:1,pluginUrl:"",productCount:0,defaultAvatar:"",restApiRoutes:{},wordCountType:"words"}),i=o.pluginUrl+"images/",a=o.pluginUrl+"build/",l=o.buildPhase,s=null===(c=r.STORE_PAGES.shop)||void 0===c?void 0:c.permalink,u=r.STORE_PAGES.checkout.id,b=(r.STORE_PAGES.checkout.permalink,r.STORE_PAGES.privacy.permalink),p=(r.STORE_PAGES.privacy.title,r.STORE_PAGES.terms.permalink),d=(r.STORE_PAGES.terms.title,r.STORE_PAGES.cart.id),m=r.STORE_PAGES.cart.permalink,f=(r.STORE_PAGES.myaccount.permalink?r.STORE_PAGES.myaccount.permalink:Object(r.getSetting)("wpLoginUrl","/wp-login.php"),Object(r.getSetting)("localPickupEnabled",!1)),g=Object(r.getSetting)("countries",{}),O=Object(r.getSetting)("countryData",{}),j=Object.fromEntries(Object.keys(O).filter((e=>!0===O[e].allowBilling)).map((e=>[e,g[e]||""]))),w=Object.fromEntries(Object.keys(O).filter((e=>!0===O[e].allowBilling)).map((e=>[e,O[e].states||[]]))),_=Object.fromEntries(Object.keys(O).filter((e=>!0===O[e].allowShipping)).map((e=>[e,g[e]||""]))),h=Object.fromEntries(Object.keys(O).filter((e=>!0===O[e].allowShipping)).map((e=>[e,O[e].states||[]]))),k=Object.fromEntries(Object.keys(O).map((e=>[e,O[e].locale||[]])))},194:function(e,t){},195:function(e,t){},198:function(e,t){},199:function(e,t){},2:function(e,t){e.exports=window.wp.components},21:function(e,t,n){"use strict";n.d(t,"b",(function(){return r})),n.d(t,"c",(function(){return o})),n.d(t,"a",(function(){return i}));var c=n(42);const r=e=>!Object(c.a)(e)&&e instanceof Object&&e.constructor===Object;function o(e,t){return r(e)&&t in e}const i=e=>0===Object.keys(e).length},22:function(e,t){e.exports=window.wc.priceFormat},25:function(e,t){e.exports=window.wp.isShallowEqual},26:function(e,t){e.exports=window.React},265:function(e){e.exports=JSON.parse('{"name":"woocommerce/price-filter","version":"1.0.0","title":"Filter by Price Controls","description":"Enable customers to filter the product grid by choosing a price range.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"multiple":false,"color":{"text":true,"background":false},"inserter":false,"lock":false},"attributes":{"className":{"type":"string","default":""},"showInputFields":{"type":"boolean","default":true},"inlineInput":{"type":"boolean","default":false},"showFilterButton":{"type":"boolean","default":false},"headingLevel":{"type":"number","default":3}},"textdomain":"woocommerce","apiVersion":2,"$schema":"https://schemas.wp.org/trunk/block.json"}')},267:function(e,t,n){"use strict";n.d(t,"b",(function(){return a})),n.d(t,"a",(function(){return l})),n.d(t,"d",(function(){return s})),n.d(t,"c",(function(){return u})),n.d(t,"e",(function(){return b}));var c=n(15),r=n(3),o=n(82);const i=Object(r.getSettingWithCoercion)("isRenderingPhpTemplate",!1,o.a),a="query_type_",l="filter_";function s(e){return window?Object(c.getQueryArg)(window.location.href,e):null}function u(e){i?((e=e.replace(/(?:query-(?:\d+-)?page=(\d+))|(?:page\/(\d+))/g,"")).endsWith("?")&&(e=e.slice(0,-1)),window.location.href=e):window.history.replaceState({},"",e)}const b=e=>{const t=Object(c.getQueryArgs)(e);return Object(c.addQueryArgs)(e,t)}},3:function(e,t){e.exports=window.wc.wcSettings},30:function(e,t,n){"use strict";var c=n(0),r=n(5),o=n.n(r);t.a=({label:e,screenReaderLabel:t,wrapperElement:n,wrapperProps:r={}})=>{let i;const a=null!=e,l=null!=t;return!a&&l?(i=n||"span",r={...r,className:o()(r.className,"screen-reader-text")},Object(c.createElement)(i,{...r},t)):(i=n||c.Fragment,a&&l&&e!==t?Object(c.createElement)(i,{...r},Object(c.createElement)("span",{"aria-hidden":"true"},e),Object(c.createElement)("span",{className:"screen-reader-text"},t)):Object(c.createElement)(i,{...r},e))}},300:function(e,t,n){"use strict";n.d(t,"a",(function(){return b}));var c=n(0),r=n(41),o=n(21),i=n(110),a=n(47),l=n(61),s=n(126),u=n(50);const b=({queryAttribute:e,queryPrices:t,queryStock:n,queryRating:b,queryState:p,isEditor:d=!1})=>{let m=Object(u.a)();m=`${m}-collection-data`;const[f]=Object(l.a)(m),[g,O]=Object(l.b)("calculate_attribute_counts",[],m),[j,w]=Object(l.b)("calculate_price_range",null,m),[_,h]=Object(l.b)("calculate_stock_status_counts",null,m),[k,E]=Object(l.b)("calculate_rating_counts",null,m),y=Object(a.a)(e||{}),v=Object(a.a)(t),S=Object(a.a)(n),x=Object(a.a)(b);Object(c.useEffect)((()=>{"object"==typeof y&&Object.keys(y).length&&(g.find((e=>Object(o.c)(y,"taxonomy")&&e.taxonomy===y.taxonomy))||O([...g,y]))}),[y,g,O]),Object(c.useEffect)((()=>{j!==v&&void 0!==v&&w(v)}),[v,w,j]),Object(c.useEffect)((()=>{_!==S&&void 0!==S&&h(S)}),[S,h,_]),Object(c.useEffect)((()=>{k!==x&&void 0!==x&&E(x)}),[x,E,k]);const[C,N]=Object(c.useState)(d),[F]=Object(r.a)(C,200);C||N(!0);const T=Object(c.useMemo)((()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=Object(i.a)(e.calculate_attribute_counts.map((({taxonomy:e,queryType:t})=>({taxonomy:e,query_type:t})))).asc(["taxonomy","query_type"])),t})(f)),[f]);return Object(s.a)({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:F})}},4:function(e,t){e.exports=window.wp.blockEditor},40:function(e,t,n){"use strict";var c=n(0),r=n(151),o=n(5),i=n.n(o);n(159);const a=e=>({thousandSeparator:null==e?void 0:e.thousandSeparator,decimalSeparator:null==e?void 0:e.decimalSeparator,fixedDecimalScale:!0,prefix:null==e?void 0:e.prefix,suffix:null==e?void 0:e.suffix,isNumericString:!0});t.a=({className:e,value:t,currency:n,onValueChange:o,displayType:l="text",...s})=>{var u;const b="string"==typeof t?parseInt(t,10):t;if(!Number.isFinite(b))return null;const p=b/10**n.minorUnit;if(!Number.isFinite(p))return null;const d=i()("wc-block-formatted-money-amount","wc-block-components-formatted-money-amount",e),m=null!==(u=s.decimalScale)&&void 0!==u?u:null==n?void 0:n.minorUnit,f={...s,...a(n),decimalScale:m,value:void 0,currency:void 0,onValueChange:void 0},g=o?e=>{const t=+e.value*10**n.minorUnit;o(t)}:()=>{};return Object(c.createElement)(r.a,{className:d,displayType:l,...f,value:p,onValueChange:g})}},42:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));const c=e=>null===e},47:function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var c=n(0),r=n(25),o=n.n(r);function i(e){const t=Object(c.useRef)(e);return o()(e,t.current)||(t.current=e),t.current}},50:function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var c=n(0);const r=Object(c.createContext)("page"),o=()=>Object(c.useContext)(r);r.Provider},530:function(e,t,n){e.exports=n(582)},531:function(e,t){},532:function(e,t){},533:function(e,t){},582:function(e,t,n){"use strict";n.r(t);var c=n(0),r=n(7),o=n(5),i=n.n(o),a=n(68),l=n(633),s=n(4),u=n(1),b=n(3),p=n(17),d=n(142),m=n(219),f=n(2),g=n(108),O=n(61),j=n(300),w=n(40),_=n(21),h=n(41);n(533);const k=(e,t,n,c=1,r=!1)=>{let[o,i]=e;const a=e=>Number.isFinite(e);return a(o)||(o=t||0),a(i)||(i=n||c),a(t)&&t>o&&(o=t),a(n)&&n<=o&&(o=n-c),a(t)&&t>=i&&(i=t+c),a(n)&&n<i&&(i=n),!r&&o>=i&&(o=i-c),r&&i<=o&&(i=o+c),[o,i]};var E=n(146);const y=({maxConstraint:e,minorUnit:t})=>({floatValue:n})=>void 0!==n&&n<=e/10**t&&n>0,v=({minConstraint:e,currentMaxValue:t,minorUnit:n})=>({floatValue:c})=>void 0!==c&&c>=e/10**n&&c<t/10**n;var S=n(145),x=({minPrice:e,maxPrice:t,minConstraint:n,maxConstraint:r,onChange:o,step:a,currency:l,showInputFields:s=!0,showFilterButton:b=!1,inlineInput:p=!0,isLoading:d=!1,isUpdating:m=!1,isEditor:f=!1,onSubmit:g=(()=>{})})=>{const O=Object(c.useRef)(null),j=Object(c.useRef)(null),x=a||10**l.minorUnit,[C,N]=Object(c.useState)(e),[F,T]=Object(c.useState)(t),P=Object(c.useRef)(null),[R,U]=Object(c.useState)(0);Object(c.useEffect)((()=>{N(e)}),[e]),Object(c.useEffect)((()=>{T(t)}),[t]),Object(c.useLayoutEffect)((()=>{var e;p&&P.current&&U(null===(e=P.current)||void 0===e?void 0:e.offsetWidth)}),[p,U]);const A=Object(c.useMemo)((()=>isFinite(n)&&isFinite(r)),[n,r]),B=Object(c.useMemo)((()=>isFinite(e)&&isFinite(t)&&A?{"--low":(e-n)/(r-n)*100+"%","--high":(t-n)/(r-n)*100+"%"}:{"--low":"0%","--high":"100%"}),[e,t,n,r,A]),I=Object(c.useCallback)((e=>{if(d||!A||!O.current||!j.current)return;const t=e.target.getBoundingClientRect(),n=e.clientX-t.left,c=O.current.offsetWidth,o=+O.current.value,i=j.current.offsetWidth,a=+j.current.value,l=c*(o/r),s=i*(a/r);Math.abs(n-l)>Math.abs(n-s)?(O.current.style.zIndex="20",j.current.style.zIndex="21"):(O.current.style.zIndex="21",j.current.style.zIndex="20")}),[d,r,A]),L=Object(c.useCallback)((c=>{const i=c.target.classList.contains("wc-block-price-filter__range-input--min"),a=+c.target.value,l=i?[Math.round(a/x)*x,t]:[e,Math.round(a/x)*x],s=k(l,n,r,x,i);o(s)}),[o,e,t,n,r,x]),M=Object(c.useCallback)((e=>{if(e.relatedTarget&&e.relatedTarget.classList&&e.relatedTarget.classList.contains("wc-block-price-filter__amount"))return;const t=e.target.classList.contains("wc-block-price-filter__amount--min");if(C>=F){const e=k([0,F],null,null,x,t);return o([parseInt(e[0],10),parseInt(e[1],10)])}const n=k([C,F],null,null,x,t);o(n)}),[o,x,C,F]),q=Object(h.b)(g,600),V=i()("wc-block-price-filter","wc-block-components-price-slider",s&&"wc-block-price-filter--has-input-fields",s&&"wc-block-components-price-slider--has-input-fields",b&&"wc-block-price-filter--has-filter-button",b&&"wc-block-components-price-slider--has-filter-button",!A&&"is-disabled",(p||R<=300)&&"wc-block-components-price-slider--is-input-inline"),G=Object(_.b)(O.current)?O.current.ownerDocument.activeElement:void 0,Q=G&&G===O.current?x:1,W=G&&G===j.current?x:1,D=String(C/10**l.minorUnit),Y=String(F/10**l.minorUnit),$=p&&R>300,K=Object(c.createElement)("div",{className:i()("wc-block-price-filter__range-input-wrapper","wc-block-components-price-slider__range-input-wrapper",{"is-loading":d&&m}),onMouseMove:I,onFocus:I},A&&Object(c.createElement)("div",{"aria-hidden":s},Object(c.createElement)("div",{className:"wc-block-price-filter__range-input-progress wc-block-components-price-slider__range-input-progress",style:B}),Object(c.createElement)("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":Object(u.__)("Filter products by minimum price","woocommerce"),"aria-valuetext":D,value:Number.isFinite(e)?e:n,onChange:L,step:Q,min:n,max:r,ref:O,disabled:d&&!A,tabIndex:s?-1:0}),Object(c.createElement)("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":Object(u.__)("Filter products by maximum price","woocommerce"),"aria-valuetext":Y,value:Number.isFinite(t)?t:r,onChange:L,step:W,min:n,max:r,ref:j,disabled:d,tabIndex:s?-1:0}))),z=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}`,J={currency:l,decimalScale:0},X={...J,displayType:"input",allowNegative:!1,disabled:d||!A,onBlur:M};return Object(c.createElement)("div",{className:V,ref:P},(!$||!s)&&K,s&&Object(c.createElement)("div",{className:"wc-block-price-filter__controls wc-block-components-price-slider__controls"},m?Object(c.createElement)("div",{className:"input-loading"}):Object(c.createElement)(w.a,{...X,className:z("min"),"aria-label":Object(u.__)("Filter products by minimum price","woocommerce"),isAllowed:v({minConstraint:n,minorUnit:l.minorUnit,currentMaxValue:F}),onValueChange:e=>{e!==C&&N(e)},value:C}),$&&K,m?Object(c.createElement)("div",{className:"input-loading"}):Object(c.createElement)(w.a,{...X,className:z("max"),"aria-label":Object(u.__)("Filter products by maximum price","woocommerce"),isAllowed:y({maxConstraint:r,minorUnit:l.minorUnit}),onValueChange:e=>{e!==F&&T(e)},value:F})),!s&&!m&&Number.isFinite(e)&&Number.isFinite(t)&&Object(c.createElement)("div",{className:"wc-block-price-filter__range-text wc-block-components-price-slider__range-text"},Object(c.createElement)(w.a,{...J,value:e}),Object(c.createElement)(w.a,{...J,value:t})),Object(c.createElement)("div",{className:"wc-block-components-price-slider__actions"},(f||!m&&(e!==n||t!==r))&&Object(c.createElement)(S.a,{onClick:()=>{o([n,r]),q()},screenReaderLabel:Object(u.__)("Reset price filter","woocommerce")}),b&&Object(c.createElement)(E.a,{className:"wc-block-price-filter__button wc-block-components-price-slider__button",isLoading:m,disabled:d||!A,onClick:g,screenReaderLabel:Object(u.__)("Apply price filter","woocommerce")})))},C=n(143),N=n(22),F=n(15),T=n(267),P=n(82),R=n(119);const U="ROUND_UP",A="ROUND_DOWN",B=(e,t,n)=>{const c=10*10**t;let r=null;const o=parseFloat(e);isNaN(o)||(n===U?r=Math.ceil(o/c)*c:n===A&&(r=Math.floor(o/c)*c));const i=Object(g.a)(r,Number.isFinite);return Number.isFinite(r)?r:i};n(532);var I=n(120);function L(e,t){return Number(e)*10**t}var M=({attributes:e,isEditor:t=!1})=>{const n=Object(I.a)(),r=Object(b.getSettingWithCoercion)("hasFilterableProducts",!1,P.a),o=Object(b.getSettingWithCoercion)("isRenderingPhpTemplate",!1,P.a),[i,a]=Object(c.useState)(!1),l=Object(T.d)("min_price"),s=Object(T.d)("max_price"),[u]=Object(O.a)(),{results:p,isLoading:d}=Object(j.a)({queryPrices:!0,queryState:u,isEditor:t}),m=Object(N.getCurrencyFromPriceResponse)(Object(_.c)(p,"price_range")?p.price_range:void 0),[f,w]=Object(O.b)("min_price"),[k,E]=Object(O.b)("max_price"),[y,v]=Object(c.useState)(L(l,m.minorUnit)||null),[S,M]=Object(c.useState)(L(s,m.minorUnit)||null),{minConstraint:q,maxConstraint:V}=(({minPrice:e,maxPrice:t,minorUnit:n})=>({minConstraint:B(e||"",n,A),maxConstraint:B(t||"",n,U)}))({minPrice:Object(_.c)(p,"price_range")&&Object(_.c)(p.price_range,"min_price")&&Object(R.a)(p.price_range.min_price)?p.price_range.min_price:void 0,maxPrice:Object(_.c)(p,"price_range")&&Object(_.c)(p.price_range,"max_price")&&Object(R.a)(p.price_range.max_price)?p.price_range.max_price:void 0,minorUnit:m.minorUnit});Object(c.useEffect)((()=>{i||(w(L(l,m.minorUnit)),E(L(s,m.minorUnit)),a(!0))}),[m.minorUnit,i,s,l,E,w]);const[G,Q]=Object(c.useState)(d),W=Object(c.useCallback)(((e,t)=>{const n=t>=Number(V)?void 0:t,c=e<=Number(q)?void 0:e;if(window){const e=function(e,t){const n={};for(const[e,c]of Object.entries(t))c?n[e]=c.toString():delete n[e];const c=Object(F.removeQueryArgs)(e,...Object.keys(t));return Object(F.addQueryArgs)(c,n)}(window.location.href,{min_price:c/10**m.minorUnit,max_price:n/10**m.minorUnit});window.location.href!==e&&Object(T.c)(e)}w(c),E(n)}),[q,V,w,E,m.minorUnit]),D=Object(h.b)(W,500),Y=Object(c.useCallback)((t=>{Q(!0),t[0]!==y&&v(t[0]),t[1]!==S&&M(t[1]),o&&i&&!e.showFilterButton&&D(t[0],t[1])}),[y,S,v,M,o,i,D,e.showFilterButton]);Object(c.useEffect)((()=>{e.showFilterButton||o||D(y,S)}),[y,S,e.showFilterButton,D,o]);const $=Object(g.a)(f),K=Object(g.a)(k),z=Object(g.a)(q),J=Object(g.a)(V);if(Object(c.useEffect)((()=>{(!Number.isFinite(y)||f!==$&&f!==y||q!==z&&q!==y)&&v(Number.isFinite(f)?f:q),(!Number.isFinite(S)||k!==K&&k!==S||V!==J&&V!==S)&&M(Number.isFinite(k)?k:V)}),[y,S,f,k,q,V,z,J,$,K]),!r)return n(!1),null;if(!d&&(null===q||null===V||q===V))return n(!1),null;const X=`h${e.headingLevel}`;n(!0),!d&&G&&Q(!1);const H=Object(c.createElement)(X,{className:"wc-block-price-filter__title"},e.heading),Z=d&&G?Object(c.createElement)(C.a,null,H):H;return Object(c.createElement)(c.Fragment,null,!t&&e.heading&&Z,Object(c.createElement)("div",{className:"wc-block-price-slider"},Object(c.createElement)(x,{minConstraint:q,maxConstraint:V,minPrice:y,maxPrice:S,currency:m,showInputFields:e.showInputFields,inlineInput:e.inlineInput,showFilterButton:e.showFilterButton,onChange:Y,onSubmit:()=>W(y,S),isLoading:d,isUpdating:G,isEditor:t})))},q=(n(531),n(141)),V=n(265);const G={heading:{type:"string",default:Object(u.__)("Filter by price","woocommerce")}};var Q=[{attributes:{...V.attributes,...G},save:({attributes:e})=>{const{className:t,showInputFields:n,showFilterButton:r,heading:o,headingLevel:a}=e,l={"data-showinputfields":n,"data-showfilterbutton":r,"data-heading":o,"data-heading-level":a};return Object(c.createElement)("div",{...s.useBlockProps.save({className:i()("is-loading",t)}),...l},Object(c.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-categories__placeholder"}))}}];Object(r.registerBlockType)(V,{icon:{src:Object(c.createElement)(a.a,{icon:l.a,className:"wc-block-editor-components-block-icon"})},attributes:{...V.attributes,...G},edit:function({attributes:e,setAttributes:t,clientId:n}){const{heading:r,headingLevel:o,showInputFields:i,inlineInput:g,showFilterButton:O}=e,j=Object(s.useBlockProps)();return Object(c.createElement)("div",{...j},0===p.p.productCount?Object(c.createElement)(f.Placeholder,{className:"wc-block-price-slider",icon:Object(c.createElement)(a.a,{icon:l.a}),label:Object(u.__)("Filter by Price","woocommerce"),instructions:Object(u.__)("Display a slider to filter products in your store by price.","woocommerce")},Object(c.createElement)("p",null,Object(u.__)("To filter your products by price you first need to assign prices to your products.","woocommerce")),Object(c.createElement)(f.Button,{className:"wc-block-price-slider__add-product-button",isSecondary:!0,href:Object(b.getAdminLink)("post-new.php?post_type=product"),target:"_top"},Object(u.__)("Add new product","woocommerce")+" ",Object(c.createElement)(a.a,{icon:m.a})),Object(c.createElement)(f.Button,{className:"wc-block-price-slider__read_more_button",isTertiary:!0,href:"https://docs.woocommerce.com/document/managing-products/",target:"_blank"},Object(u.__)("Learn more","woocommerce"))):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(s.InspectorControls,{key:"inspector"},Object(c.createElement)(f.PanelBody,{title:Object(u.__)("Settings","woocommerce")},Object(c.createElement)(f.__experimentalToggleGroupControl,{label:Object(u.__)("Price Range Selector","woocommerce"),value:i?"editable":"text",onChange:e=>t({showInputFields:"editable"===e}),className:"wc-block-price-filter__price-range-toggle"},Object(c.createElement)(f.__experimentalToggleGroupControlOption,{value:"editable",label:Object(u.__)("Editable","woocommerce")}),Object(c.createElement)(f.__experimentalToggleGroupControlOption,{value:"text",label:Object(u.__)("Text","woocommerce")})),i&&Object(c.createElement)(f.ToggleControl,{label:Object(u.__)("Inline input fields","woocommerce"),checked:g,onChange:()=>t({inlineInput:!g}),help:Object(u.__)("Show input fields inline with the slider.","woocommerce")}),Object(c.createElement)(f.ToggleControl,{label:Object(u.__)("Show 'Apply filters' button","woocommerce"),help:Object(u.__)("Products will update when the button is clicked.","woocommerce"),checked:O,onChange:()=>t({showFilterButton:!O})}))),Object(c.createElement)(q.a,{attributes:e,clientId:n,setAttributes:t,filterType:"price-filter"}),r&&Object(c.createElement)(d.a,{className:"wc-block-price-filter__title",headingLevel:o,heading:r,onChange:e=>t({heading:e})}),Object(c.createElement)(f.Disabled,null,Object(c.createElement)(M,{attributes:e,isEditor:!0}))))},save({attributes:e}){const{className:t}=e;return Object(c.createElement)("div",{...s.useBlockProps.save({className:i()("is-loading",t)})},Object(c.createElement)("span",{"aria-hidden":!0,className:"wc-block-product-categories__placeholder"}))},deprecated:Q})},6:function(e,t){e.exports=window.wp.data},61:function(e,t,n){"use strict";n.d(t,"a",(function(){return b})),n.d(t,"b",(function(){return p})),n.d(t,"c",(function(){return d}));var c=n(8),r=n(6),o=n(0),i=n(25),a=n.n(i),l=n(47),s=n(108),u=n(50);const b=e=>{const t=Object(u.a)();e=e||t;const n=Object(r.useSelect)((t=>t(c.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0)),[e]),{setValueForQueryContext:i}=Object(r.useDispatch)(c.QUERY_STATE_STORE_KEY);return[n,Object(o.useCallback)((t=>{i(e,t)}),[e,i])]},p=(e,t,n)=>{const i=Object(u.a)();n=n||i;const a=Object(r.useSelect)((r=>r(c.QUERY_STATE_STORE_KEY).getValueForQueryKey(n,e,t)),[n,e]),{setQueryValue:l}=Object(r.useDispatch)(c.QUERY_STATE_STORE_KEY);return[a,Object(o.useCallback)((t=>{l(n,e,t)}),[n,e,l])]},d=(e,t)=>{const n=Object(u.a)();t=t||n;const[c,r]=b(t),i=Object(l.a)(c),p=Object(l.a)(e),d=Object(s.a)(p),m=Object(o.useRef)(!1);return Object(o.useEffect)((()=>{a()(d,p)||(r(Object.assign({},i,p)),m.current=!0)}),[i,p,d,r]),m.current?[c,r]:[e,r]}},7:function(e,t){e.exports=window.wp.blocks},8:function(e,t){e.exports=window.wc.wcBlocksData},82:function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));const c=e=>"boolean"==typeof e},9:function(e,t){e.exports=window.wp.primitives}});