(window.webpackJsonpvtex_search_result_3_136_1=window.webpackJsonpvtex_search_result_3_136_1||[]).push([["GalleryLayoutSwitcher"],{0:function(e,t){e.exports=React},159:function(e,t,r){"use strict";r.r(t),function(e){var t=r(9);r.p=Object(t.getPublicPath)("vtex.search-result@3.136.1");var a=Object(t.register)((function(){return r(160)}),e,"vtex.search-result@3.136.1","vtex.search-result@3.x","GalleryLayoutSwitcher");a.renderHotReload,a.setupHMR}.call(this,r(16)(e))},160:function(e,t,r){"use strict";r.r(t);var a=r(0),n=r.n(a),o=r(5),l=r.n(o),s=r(6),c=r.n(s),u=r(7),i=r.n(u),h=i.a.useSearchPageState,y=i.a.useSearchPageStateDispatch,w=["galleryLayoutSwitcher"];t.default=function(e){var t=e.children,r=c()(w),o=h(),s=o.selectedGalleryLayout,u=o.focusedGalleryLayout,i=o.galleryLayouts,_=y(),f=l()(r.galleryLayoutSwitcher,"flex flex-row bn"),p=Object(a.useCallback)((function(e){if(i&&("ArrowLeft"===e.key||"ArrowUp"===e.key||"ArrowRight"===e.key||"ArrowDown"===e.key)){var t=i.findIndex((function(e){return e.name===(null!=u?u:s)}));-1===t&&console.error("No layout defined with name ".concat(u,". Check if there are unnecessary layout options with this name."));var r=0;"ArrowLeft"===e.key?r=Math.max(0,t-1):"ArrowRight"===e.key?r=Math.min(t+1,i.length-1):"ArrowUp"===e.key?(r=(t-1)%i.length)<0&&(r=i.length-1):"ArrowDown"===e.key&&(r=(t+1)%i.length),"ArrowDown"!==e.key&&"ArrowUp"!==e.key||e.preventDefault(),_({type:"SET_FOCUS_GALLERY_LAYOUT",args:{focusedGalleryLayout:i[r].name}})}}),[i,_,u,s]);return n.a.createElement("div",{className:f,role:"radiogroup","aria-label":"Search result layout",onKeyDown:p},t)}},5:function(e,t){e.exports=Classnames},6:function(e,t){e.exports=__RENDER_8_COMPONENTS__["vtex.css-handles@0.x/useCssHandles"]},7:function(e,t){e.exports=__RENDER_8_COMPONENTS__["vtex.search-page-context@0.x/SearchPageContext"]}},[[159,"common"]]]);