관리-도구
편집 파일: product-top-rated.js
this.kkart=this.kkart||{},this.kkart.blocks=this.kkart.blocks||{},this.kkart.blocks["product-top-rated"]=function(t){function e(e){for(var n,i,u=e[0],a=e[1],s=e[2],b=0,p=[];b<u.length;b++)i=u[b],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in a)Object.prototype.hasOwnProperty.call(a,n)&&(t[n]=a[n]);for(l&&l(e);p.length;)p.shift()();return c.push.apply(c,s||[]),r()}function r(){for(var t,e=0;e<c.length;e++){for(var r=c[e],n=!0,u=1;u<r.length;u++){var a=r[u];0!==o[a]&&(n=!1)}n&&(c.splice(e--,1),t=i(i.s=r[0]))}return t}var n={},o={33:0},c=[];function i(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.m=t,i.c=n,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="";var u=window.webpackWcBlocksJsonp=window.webpackWcBlocksJsonp||[],a=u.push.bind(u);u.push=e,u=u.slice();for(var s=0;s<u.length;s++)e(u[s]);var l=a;return c.push([819,0]),r()}({0:function(t,e){!function(){t.exports=this.wp.element}()},1:function(t,e){!function(){t.exports=this.wp.i18n}()},108:function(t,e){},109:function(t,e){},110:function(t,e){},111:function(t,e){},112:function(t,e){},113:function(t,e){},114:function(t,e){},115:function(t,e){},116:function(t,e){},117:function(t,e){},118:function(t,e){},119:function(t,e){},120:function(t,e){},121:function(t,e){},13:function(t,e){!function(){t.exports=this.wp.apiFetch}()},132:function(t,e){},14:function(t,e){!function(){t.exports=this.wp.blockEditor}()},15:function(t,e){!function(){t.exports=this.regeneratorRuntime}()},17:function(t,e){!function(){t.exports=this.wp.blocks}()},176:function(t,e,r){"use strict";r.d(e,"a",(function(){return c}));var n=r(0),o=r(5),c=Object(n.createElement)("img",{src:o.U+"img/grid.svg",alt:"Grid Preview",width:"230",height:"250",style:{width:"100%"}})},18:function(t,e){!function(){t.exports=this.wp.url}()},26:function(t,e){!function(){t.exports=this.wp.compose}()},3:function(t,e){!function(){t.exports=this.kkart.wcSettings}()},33:function(t,e){!function(){t.exports=this.wp.htmlEntities}()},35:function(t,e){!function(){t.exports=this.moment}()},4:function(t,e){!function(){t.exports=this.wp.components}()},40:function(t,e,r){"use strict";r.d(e,"h",(function(){return p})),r.d(e,"e",(function(){return d})),r.d(e,"b",(function(){return g})),r.d(e,"i",(function(){return f})),r.d(e,"f",(function(){return O})),r.d(e,"c",(function(){return h})),r.d(e,"d",(function(){return m})),r.d(e,"g",(function(){return j})),r.d(e,"a",(function(){return w}));var n=r(8),o=r.n(n),c=r(18),i=r(13),u=r.n(i),a=r(6),s=r(5);function l(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function b(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?l(Object(r),!0).forEach((function(e){o()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):l(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var p=function(t){var e=t.selected,r=void 0===e?[]:e,n=t.search,o=void 0===n?"":n,i=t.queryArgs,l=function(t){var e=t.selected,r=void 0===e?[]:e,n=t.search,o=void 0===n?"":n,i=t.queryArgs,u=void 0===i?[]:i,a={per_page:s.v?100:0,catalog_visibility:"any",search:o,orderby:"title",order:"asc"},l=[Object(c.addQueryArgs)("/kkart/store/products",b(b({},a),u))];return s.v&&r.length&&l.push(Object(c.addQueryArgs)("/kkart/store/products",{catalog_visibility:"any",include:r})),l}({selected:r,search:o,queryArgs:void 0===i?[]:i});return Promise.all(l.map((function(t){return u()({path:t})}))).then((function(t){return Object(a.uniqBy)(Object(a.flatten)(t),"id").map((function(t){return b(b({},t),{},{parent:0})}))})).catch((function(t){throw t}))},d=function(t){return u()({path:"/kkart/store/products/".concat(t)})},g=function(){return u()({path:"kkart/store/products/attributes"})},f=function(t){return u()({path:"kkart/store/products/attributes/".concat(t,"/terms")})},O=function(t){var e=t.selected,r=function(t){var e=t.selected,r=void 0===e?[]:e,n=t.search,o=[Object(c.addQueryArgs)("kkart/store/products/tags",{per_page:s.y?100:0,orderby:s.y?"count":"name",order:s.y?"desc":"asc",search:n})];return s.y&&r.length&&o.push(Object(c.addQueryArgs)("kkart/store/products/tags",{include:r})),o}({selected:void 0===e?[]:e,search:t.search});return Promise.all(r.map((function(t){return u()({path:t})}))).then((function(t){return Object(a.uniqBy)(Object(a.flatten)(t),"id")}))},h=function(t){return u()({path:Object(c.addQueryArgs)("kkart/store/products/categories",b({per_page:0},t))})},m=function(t){return u()({path:"kkart/store/products/categories/".concat(t)})},j=function(t){return u()({path:Object(c.addQueryArgs)("kkart/store/products",{per_page:0,type:"variation",parent:t})})},w=function(t,e){if(!t.title.raw)return t.slug;var r=1===e.filter((function(e){return e.title.raw===t.title.raw})).length;return t.title.raw+(r?"":" - ".concat(t.slug))}},44:function(t,e,r){"use strict";r.d(e,"a",(function(){return u}));var n=r(15),o=r.n(n),c=r(37),i=r.n(c),u=function(){var t=i()(o.a.mark((function t(e){var r;return o.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("function"!=typeof e.json){t.next=11;break}return t.prev=1,t.next=4,e.json();case 4:return r=t.sent,t.abrupt("return",{message:r.message,type:r.type||"api"});case 8:return t.prev=8,t.t0=t.catch(1),t.abrupt("return",{message:t.t0.message,type:"general"});case 11:return t.abrupt("return",{message:e.message,type:e.type||"general"});case 12:case"end":return t.stop()}}),t,null,[[1,8]])})));return function(e){return t.apply(this,arguments)}}()},47:function(t,e){!function(){t.exports=this.wp.escapeHtml}()},49:function(t,e,r){"use strict";var n=r(0),o=r(1),c=(r(2),r(47));e.a=function(t){var e,r,i,u=t.error;return Object(n.createElement)("div",{className:"kkart-block-error-message"},(r=(e=u).message,i=e.type,r?"general"===i?Object(n.createElement)("span",null,Object(o.__)("The following error was returned",'kkart'),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):"api"===i?Object(n.createElement)("span",null,Object(o.__)("The following error was returned from the API",'kkart'),Object(n.createElement)("br",null),Object(n.createElement)("code",null,Object(c.escapeHTML)(r))):r:Object(o.__)("An unknown error occurred which prevented the block from being updated.",'kkart')))}},5:function(t,e,r){"use strict";r.d(e,"l",(function(){return o})),r.d(e,"K",(function(){return c})),r.d(e,"Q",(function(){return i})),r.d(e,"A",(function(){return u})),r.d(e,"C",(function(){return a})),r.d(e,"m",(function(){return s})),r.d(e,"B",(function(){return l})),r.d(e,"E",(function(){return b})),r.d(e,"o",(function(){return p})),r.d(e,"D",(function(){return d})),r.d(e,"n",(function(){return g})),r.d(e,"G",(function(){return f})),r.d(e,"v",(function(){return O})),r.d(e,"y",(function(){return h})),r.d(e,"s",(function(){return m})),r.d(e,"t",(function(){return j})),r.d(e,"u",(function(){return w})),r.d(e,"k",(function(){return y})),r.d(e,"M",(function(){return v})),r.d(e,"R",(function(){return _})),r.d(e,"q",(function(){return k})),r.d(e,"r",(function(){return S})),r.d(e,"p",(function(){return P})),r.d(e,"J",(function(){return E})),r.d(e,"c",(function(){return C})),r.d(e,"w",(function(){return x})),r.d(e,"x",(function(){return A})),r.d(e,"U",(function(){return B})),r.d(e,"V",(function(){return R})),r.d(e,"L",(function(){return T})),r.d(e,"a",(function(){return M})),r.d(e,"O",(function(){return I})),r.d(e,"b",(function(){return L})),r.d(e,"N",(function(){return N})),r.d(e,"F",(function(){return H})),r.d(e,"i",(function(){return z})),r.d(e,"P",(function(){return U})),r.d(e,"h",(function(){return F})),r.d(e,"j",(function(){return Q})),r.d(e,"I",(function(){return q})),r.d(e,"H",(function(){return G})),r.d(e,"T",(function(){return W})),r.d(e,"S",(function(){return J})),r.d(e,"d",(function(){return Y})),r.d(e,"e",(function(){return K})),r.d(e,"f",(function(){return X})),r.d(e,"g",(function(){return Z})),r.d(e,"z",(function(){return tt})),r.d(e,"Y",(function(){return rt})),r.d(e,"Z",(function(){return nt})),r.d(e,"W",(function(){return ot})),r.d(e,"X",(function(){return ct}));var n=r(3),o=Object(n.getSetting)("currentUserIsAdmin",!1),c=Object(n.getSetting)("reviewRatingsEnabled",!0),i=Object(n.getSetting)("showAvatars",!0),u=Object(n.getSetting)("max_columns",6),a=Object(n.getSetting)("min_columns",1),s=Object(n.getSetting)("default_columns",3),l=Object(n.getSetting)("max_rows",6),b=Object(n.getSetting)("min_rows",1),p=Object(n.getSetting)("default_rows",3),d=Object(n.getSetting)("min_height",500),g=Object(n.getSetting)("default_height",500),f=Object(n.getSetting)("placeholderImgSrc",""),O=(Object(n.getSetting)("thumbnail_size",300),Object(n.getSetting)("isLargeCatalog")),h=Object(n.getSetting)("limitTags"),m=Object(n.getSetting)("hasProducts",!0),j=Object(n.getSetting)("hasTags",!0),w=Object(n.getSetting)("homeUrl",""),y=Object(n.getSetting)("couponsEnabled",!0),v=Object(n.getSetting)("shippingEnabled",!0),_=Object(n.getSetting)("taxesEnabled",!0),k=Object(n.getSetting)("displayItemizedTaxes",!1),S=Object(n.getSetting)("hasDarkEditorStyleSupport",!1),P=(Object(n.getSetting)("displayShopPricesIncludingTax",!1),Object(n.getSetting)("displayCartPricesIncludingTax",!1)),E=Object(n.getSetting)("productCount",0),C=Object(n.getSetting)("attributes",[]),x=Object(n.getSetting)("isShippingCalculatorEnabled",!0),A=Object(n.getSetting)("isShippingCostHidden",!1),D=Object(n.getSetting)("kkartBlocksPhase",1),B=Object(n.getSetting)("wcBlocksAssetUrl",""),R=Object(n.getSetting)("wcBlocksBuildUrl",""),T=Object(n.getSetting)("shippingCountries",{}),M=Object(n.getSetting)("allowedCountries",{}),I=Object(n.getSetting)("shippingStates",{}),L=Object(n.getSetting)("allowedStates",{}),N=Object(n.getSetting)("shippingMethodsExist",!1),H=Object(n.getSetting)("paymentGatewaySortOrder",[]),z=Object(n.getSetting)("checkoutShowLoginReminder",!0),V={id:0,title:"",permalink:""},$=Object(n.getSetting)("storePages",{shop:V,cart:V,checkout:V,privacy:V,terms:V}),U=$.shop.permalink,F=$.checkout.id,Q=$.checkout.permalink,q=$.privacy.permalink,G=$.privacy.title,W=$.terms.permalink,J=$.terms.title,Y=$.cart.id,K=$.cart.permalink,X=Object(n.getSetting)("checkoutAllowsGuest",!1),Z=Object(n.getSetting)("checkoutAllowsSignup",!1),tt=Object(n.getSetting)("loginUrl","/wp-login.php"),et=r(17),rt=function(t,e){if(D>2)return Object(et.registerBlockType)(t,e)},nt=function(t,e){if(D>1)return Object(et.registerBlockType)(t,e)},ot=function(){return D>2},ct=function(){return D>1}},54:function(t,e){!function(){t.exports=this.wp.keycodes}()},6:function(t,e){!function(){t.exports=this.lodash}()},61:function(t,e,r){"use strict";var n=r(8),o=r.n(n),c=r(27),i=r.n(c),u=r(9);r(2);function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}e.a=function(t){var e=t.srcElement,r=t.size,n=void 0===r?24:r,c=i()(t,["srcElement","size"]);return Object(u.isValidElement)(e)&&Object(u.cloneElement)(e,function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach((function(e){o()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({width:n,height:n},c))}},70:function(t,e){!function(){t.exports=this.wp.editor}()},75:function(t,e){!function(){t.exports=this.wp.hooks}()},76:function(t,e,r){"use strict";r.d(e,"b",(function(){return o}));var n=r(5),o=["kkart/product-best-sellers","kkart/product-category","kkart/product-new","kkart/product-on-sale","kkart/product-top-rated"];e.a={columns:{type:"number",default:n.m},rows:{type:"number",default:n.o},alignButtons:{type:"boolean",default:!1},categories:{type:"array",default:[]},catOperator:{type:"string",default:"any"},contentVisibility:{type:"object",default:{title:!0,price:!0,rating:!0,button:!0}},isPreview:{type:"boolean",default:!1}}},77:function(t,e){!function(){t.exports=this.ReactDOM}()},78:function(t,e){!function(){t.exports=this.wp.dom}()},80:function(t,e,r){"use strict";var n=r(8),o=r.n(n),c=r(0),i=r(1),u=(r(2),r(4));function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function s(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?a(Object(r),!0).forEach((function(e){o()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}e.a=function(t){var e=t.onChange,r=t.settings,n=r.button,o=r.price,a=r.rating,l=r.title;return Object(c.createElement)(c.Fragment,null,Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Product title",'kkart'),help:l?Object(i.__)("Product title is visible.",'kkart'):Object(i.__)("Product title is hidden.",'kkart'),checked:l,onChange:function(){return e(s(s({},r),{},{title:!l}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Product price",'kkart'),help:o?Object(i.__)("Product price is visible.",'kkart'):Object(i.__)("Product price is hidden.",'kkart'),checked:o,onChange:function(){return e(s(s({},r),{},{price:!o}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Product rating",'kkart'),help:a?Object(i.__)("Product rating is visible.",'kkart'):Object(i.__)("Product rating is hidden.",'kkart'),checked:a,onChange:function(){return e(s(s({},r),{},{rating:!a}))}}),Object(c.createElement)(u.ToggleControl,{label:Object(i.__)("Add to Cart button",'kkart'),help:n?Object(i.__)("Add to Cart button is visible.",'kkart'):Object(i.__)("Add to Cart button is hidden.",'kkart'),checked:n,onChange:function(){return e(s(s({},r),{},{button:!n}))}}))}},81:function(t,e,r){"use strict";var n=r(0),o=r(1),c=r(6),i=(r(2),r(4)),u=r(5);e.a=function(t){var e=t.columns,r=t.rows,a=t.setAttributes,s=t.alignButtons;return Object(n.createElement)(n.Fragment,null,Object(n.createElement)(i.RangeControl,{label:Object(o.__)("Columns",'kkart'),value:e,onChange:function(t){var e=Object(c.clamp)(t,u.C,u.A);a({columns:Object(c.isNaN)(e)?"":e})},min:u.C,max:u.A}),Object(n.createElement)(i.RangeControl,{label:Object(o.__)("Rows",'kkart'),value:r,onChange:function(t){var e=Object(c.clamp)(t,u.E,u.B);a({rows:Object(c.isNaN)(e)?"":e})},min:u.E,max:u.B}),Object(n.createElement)(i.ToggleControl,{label:Object(o.__)("Align Last Block",'kkart'),help:s?Object(o.__)("The last inner block will be aligned vertically.",'kkart'):Object(o.__)("The last inner block will follow other content.",'kkart'),checked:s,onChange:function(){return a({alignButtons:!s})}}))}},819:function(t,e,r){t.exports=r(921)},83:function(t,e){!function(){t.exports=this.wp.viewport}()},84:function(t,e,r){"use strict";var n=r(10),o=r.n(n),c=r(0),i=r(1),u=r(6),a=(r(2),r(50)),s=r(4),l=r(15),b=r.n(l),p=r(37),d=r.n(p),g=r(22),f=r.n(g),O=r(25),h=r.n(O),m=r(19),j=r.n(m),w=r(23),y=r.n(w),v=r(24),_=r.n(v),k=r(12),S=r.n(k),P=r(26),E=r(40),C=r(44);function x(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=S()(t);if(e){var o=S()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return _()(this,r)}}var A=Object(P.createHigherOrderComponent)((function(t){return function(e){y()(n,e);var r=x(n);function n(){var t;return f()(this,n),(t=r.apply(this,arguments)).state={error:null,loading:!1,categories:null},t.loadCategories=t.loadCategories.bind(j()(t)),t}return h()(n,[{key:"componentDidMount",value:function(){this.loadCategories()}},{key:"loadCategories",value:function(){var t=this;this.setState({loading:!0}),Object(E.c)().then((function(e){t.setState({categories:e,loading:!1,error:null})})).catch(function(){var e=d()(b.a.mark((function e(r){var n;return b.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(C.a)(r);case 2:n=e.sent,t.setState({categories:null,loading:!1,error:n});case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())}},{key:"render",value:function(){var e=this.state,r=e.error,n=e.loading,i=e.categories;return Object(c.createElement)(t,o()({},this.props,{error:r,isLoading:n,categories:i}))}}]),n}(c.Component)}),"withCategories"),D=r(49),B=(r(132),function(t){var e=t.categories,r=t.error,n=t.isLoading,l=t.onChange,b=t.onOperatorChange,p=t.operator,d=t.selected,g=t.isSingle,f=t.showReviewCount,O={clear:Object(i.__)("Clear all product categories",'kkart'),list:Object(i.__)("Product Categories",'kkart'),noItems:Object(i.__)("Your store doesn't have any product categories.",'kkart'),search:Object(i.__)("Search for product categories",'kkart'),selected:function(t){return Object(i.sprintf)(Object(i._n)("%d category selected","%d categories selected",t,'kkart'),t)},updated:Object(i.__)("Category search results updated.",'kkart')};return r?Object(c.createElement)(D.a,{error:r}):Object(c.createElement)(c.Fragment,null,Object(c.createElement)(a.a,{className:"kkart-product-categories",list:e,isLoading:n,selected:d.map((function(t){return Object(u.find)(e,{id:t})})).filter(Boolean),onChange:l,renderItem:function(t){var e=t.item,r=t.search,n=t.depth,u=void 0===n?0:n,s=["kkart-product-categories__item"];r.length&&s.push("is-searching"),0===u&&0!==e.parent&&s.push("is-skip-level");var l=e.breadcrumbs.length?"".concat(e.breadcrumbs.join(", "),", ").concat(e.name):e.name,b=f?Object(i.sprintf)(Object(i._n)("%1$s, has %2$d review","%1$s, has %2$d reviews",e.review_count,'kkart'),l,e.review_count):Object(i.sprintf)(Object(i._n)("%1$s, has %2$d product","%1$s, has %2$d products",e.count,'kkart'),l,e.count),p=f?Object(i.sprintf)(Object(i._n)("%d Review","%d Reviews",e.review_count,'kkart'),e.review_count):Object(i.sprintf)(Object(i._n)("%d Product","%d Products",e.count,'kkart'),e.count);return Object(c.createElement)(a.b,o()({className:s.join(" ")},t,{showCount:!0,countLabel:p,"aria-label":b}))},messages:O,isHierarchical:!0,isSingle:g}),!!b&&Object(c.createElement)("div",{className:d.length<2?"screen-reader-text":""},Object(c.createElement)(s.SelectControl,{className:"kkart-product-categories__operator",label:Object(i.__)("Display products matching",'kkart'),help:Object(i.__)("Pick at least two categories to use this setting.",'kkart'),value:p,onChange:b,options:[{label:Object(i.__)("Any selected categories",'kkart'),value:"any"},{label:Object(i.__)("All selected categories",'kkart'),value:"all"}]})))});B.defaultProps={operator:"any",isSingle:!1};e.a=A(B)},9:function(t,e){!function(){t.exports=this.React}()},90:function(t,e,r){"use strict";r.d(e,"a",(function(){return b}));var n=r(0),o=r(7),c=r.n(o),i=r(11),u=r.n(i),a=r(5);function s(t,e){var r;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return l(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return l(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var c,i=!0,u=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return i=t.done,t},e:function(t){u=!0,c=t},f:function(){try{i||null==r.return||r.return()}finally{if(u)throw c}}}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var b=function(t){return function(e){var r=e.attributes,o=r.align,i=r.contentVisibility,l=c()(o?"align".concat(o):"",{"is-hidden-title":!i.title,"is-hidden-price":!i.price,"is-hidden-rating":!i.rating,"is-hidden-button":!i.button});return Object(n.createElement)(n.RawHTML,{className:l},function(t,e){var r=t.attributes,n=r.attributes,o=r.attrOperator,c=r.categories,i=r.catOperator,l=r.orderby,b=r.products,p=r.columns||a.m,d=r.rows||a.o,g=new Map;switch(g.set("limit",d*p),g.set("columns",p),c&&c.length&&(g.set("category",c.join(",")),i&&"all"===i&&g.set("cat_operator","AND")),n&&n.length&&(g.set("terms",n.map((function(t){return t.id})).join(",")),g.set("attribute",n[0].attr_slug),o&&"all"===o&&g.set("terms_operator","AND")),l&&("price_desc"===l?(g.set("orderby","price"),g.set("order","DESC")):"price_asc"===l?(g.set("orderby","price"),g.set("order","ASC")):"date"===l?(g.set("orderby","date"),g.set("order","DESC")):g.set("orderby",l)),e){case"kkart/product-best-sellers":g.set("best_selling","1");break;case"kkart/product-top-rated":g.set("orderby","rating");break;case"kkart/product-on-sale":g.set("on_sale","1");break;case"kkart/product-new":g.set("orderby","date"),g.set("order","DESC");break;case"kkart/handpicked-products":if(!b.length)return"";g.set("ids",b.join(",")),g.set("limit",b.length);break;case"kkart/product-category":if(!c||!c.length)return"";break;case"kkart/products-by-attribute":if(!n||!n.length)return""}var f,O="[products",h=s(g);try{for(h.s();!(f=h.n()).done;){var m=u()(f.value,2);O+=" "+m[0]+'="'+m[1]+'"'}}catch(t){h.e(t)}finally{h.f()}return O+="]"}(e,t))}}},921:function(t,e,r){"use strict";r.r(e);var n=r(8),o=r.n(n),c=r(0),i=r(1),u=r(17),a=r(61),s=r(57),l=Object(c.createElement)(s.a,{xmlns:"http://www.w3.org/2000/SVG",viewBox:"0 0 24 24"},Object(c.createElement)("path",{opacity:".87",fill:"none",d:"M0 0h24v24H0V0z"}),Object(c.createElement)("path",{d:"M21 8h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-2c0-1.1-.9-2-2-2zm0 4l-3 7H9V9l4.34-4.34L12.23 10H21v2zM1 9h4v12H1z"})),b=r(6),p=r(22),d=r.n(p),g=r(25),f=r.n(g),O=r(23),h=r.n(O),m=r(24),j=r.n(m),w=r(12),y=r.n(w),v=r(4),_=r(14),k=r(70),S=(r(2),r(80)),P=r(81),E=r(84),C=r(176);function x(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=y()(t);if(e){var o=y()(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return j()(this,r)}}var A=function(t){h()(r,t);var e=x(r);function r(){return d()(this,r),e.apply(this,arguments)}return f()(r,[{key:"getInspectorControls",value:function(){var t=this.props,e=t.attributes,r=t.setAttributes,n=e.categories,o=e.catOperator,u=e.columns,a=e.contentVisibility,s=e.rows,l=e.alignButtons;return Object(c.createElement)(_.InspectorControls,{key:"inspector"},Object(c.createElement)(v.PanelBody,{title:Object(i.__)("Layout",'kkart'),initialOpen:!0},Object(c.createElement)(P.a,{columns:u,rows:s,alignButtons:l,setAttributes:r})),Object(c.createElement)(v.PanelBody,{title:Object(i.__)("Content",'kkart'),initialOpen:!0},Object(c.createElement)(S.a,{settings:a,onChange:function(t){return r({contentVisibility:t})}})),Object(c.createElement)(v.PanelBody,{title:Object(i.__)("Filter by Product Category",'kkart'),initialOpen:!1},Object(c.createElement)(E.a,{selected:n,onChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=t.map((function(t){return t.id}));r({categories:e})},operator:o,onOperatorChange:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"any";return r({catOperator:t})}})))}},{key:"render",value:function(){var t=this.props,e=t.name,r=t.attributes;return r.isPreview?C.a:Object(c.createElement)(c.Fragment,null,this.getInspectorControls(),Object(c.createElement)(v.Disabled,null,Object(c.createElement)(k.ServerSideRender,{block:e,attributes:r})))}}]),r}(c.Component),D=r(90),B=r(76);function R(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}var T="kkart/product-top-rated";Object(u.registerBlockType)(T,{title:Object(i.__)("Top Rated Products",'kkart'),icon:{src:Object(c.createElement)(a.a,{srcElement:l}),foreground:"#96588a"},category:"kkart",keywords:[Object(i.__)("Kkart",'kkart')],description:Object(i.__)("Display a grid of your top rated products.",'kkart'),supports:{align:["wide","full"],html:!1},example:{attributes:{isPreview:!0}},attributes:function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?R(Object(r),!0).forEach((function(e){o()(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):R(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},B.a),transforms:{from:[{type:"block",blocks:Object(b.without)(B.b,T),transform:function(t){return Object(u.createBlock)("kkart/product-top-rated",t)}}]},deprecated:[{attributes:B.a,save:Object(D.a)(T)}],edit:function(t){return Object(c.createElement)(A,t)},save:function(){return null}})},94:function(t,e){!function(){t.exports=this.wp.date}()}});