View file File name : 803.js Content :"use strict";(globalThis.webpackChunknewfold_Onboarding=globalThis.webpackChunknewfold_Onboarding||[]).push([[803],{8053:(e,t,n)=>{n.d(t,{A:()=>i});var a=n(1609),o=n(5573);const i=(0,a.createElement)(o.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,a.createElement)(o.Path,{d:"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"}))},8803:(e,t,n)=>{n.r(t),n.d(t,{default:()=>f});var a=n(1609),o=n(6427),i=n(8468),r=n(8053),s=n(7143),l=n(7723),c=n(7675),d=n(8969),_=n(7839),b=n(6087),p=n(7517),m=n(7044),g=n(1056),u=n(2202),v=n(8744);const f=(0,i.memo)((()=>{const[e,t]=(0,i.useState)(),[n,f]=(0,i.useState)(),[h,w]=(0,i.useState)(),[E,y]=(0,i.useState)(),{currentData:N,isSidebarOpened:k,sideBarView:x}=(0,s.useSelect)((e=>({currentData:e(c.M).getCurrentOnboardingData(),isSidebarOpened:e(c.M).isSidebarOpened(),sideBarView:e(c.M).getSidebarView()}))),{setIsSidebarOpened:C,setCurrentOnboardingData:D}=(0,s.useDispatch)(c.M),O=(t,n)=>{if(!(t in e))return!1;N.sitegen.homepages.active=e[t],f(e[t]),D(N),(0,g.v)(new g.iC(u.Wi,t,{position:n+1,source:v.d0}))},T=(n,a)=>{if(!(n in e))return;const o=!e[n].isFavorite,i=(0,b.cloneDeep)(e);i[n].isFavorite=o,N.sitegen.homepages.data=i,N.sitegen.homepages.active.slug===n&&(N.sitegen.homepages.active=i[n]),t(i),D(N),(0,g.v)(new g.iC(u.Nz,n,{favorite:o,position:a+1,placement:"editor_sidebar",source:v.d0}))};return(0,i.useEffect)((()=>{d.V_===x&&k&&(async()=>{const e=await(0,p.w6)();w(e.body)})()}),[x,k]),(0,i.useEffect)((()=>{if(N?.sitegen?.homepages){const e=(0,b.cloneDeep)(N.sitegen.homepages);t(e.data),f(e.active)}}),[N]),(0,i.useEffect)((()=>{y({name:"all_versions",title:(0,a.createElement)("div",{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab"},(0,a.createElement)("p",null,(0,l.__)("All Versions","wp-module-onboarding"))),content:e&&n&&h&&Object.keys(e).map(((t,o)=>{const i=e[t],r=(0,b.cloneDeep)(h[0]);r.settings.color.palette=i.color.palette;let s="";return["header","content","footer"].forEach((e=>{e in i&&(s+=i[e])})),(0,a.createElement)("div",{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container",key:i.slug},(0,a.createElement)("div",{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container__previews",onClick:()=>O(i.slug,o),role:"button",tabIndex:0,onKeyDown:()=>O(i.slug,o)},(0,a.createElement)(m.pA,{styling:i.slug!==n.slug?"custom":"custom__highlighted",blockGrammer:s,viewportWidth:1300,previewSettings:r,skeletonLoadingTime:0})),(0,a.createElement)("div",{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container__context"},(0,a.createElement)("div",{className:`nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container__context__icon ${i.isFavorite&&"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container__context__icon__fill"}`,role:"button",tabIndex:0,onClick:()=>T(i.slug,o),onKeyDown:()=>T(i.slug,o)}),(0,a.createElement)("p",{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container__context__title"},i.title)))}))})}),[e,n,h]),(0,a.createElement)(o.Fill,{name:`${d.St}/${d.V_}`},(0,a.createElement)(o.PanelBody,{className:"nfd-onboarding-sidebar--sitegen-editor-patterns",initialOpen:!0},(0,a.createElement)(i.Suspense,{fallback:(0,a.createElement)(i.Fragment,null)},(0,a.createElement)(o.PanelHeader,null,(0,a.createElement)("div",{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header"},(0,a.createElement)(_.A,{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel",tabs:[{name:"all_versions",title:(0,a.createElement)("div",{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab"},(0,a.createElement)("p",null,(0,l.__)("All Versions","wp-module-onboarding"))),content:E&&e&&n&&h&&Object.keys(e).map(((t,o)=>{const i=e[t],r=(0,b.cloneDeep)(h[0]);r.settings.color.palette=i.color.palette;let s="";return["header","content","footer"].forEach((e=>{e in i&&(s+=i[e])})),(0,a.createElement)("div",{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container",key:i.slug,role:"button",tabIndex:0,onKeyDown:()=>O(i.slug,o),onClick:()=>O(i.slug,o)},(0,a.createElement)(m.pA,{styling:i.slug!==n.slug?"custom":"custom__highlighted",blockGrammer:s,viewportWidth:1300,previewSettings:r,skeletonLoadingTime:0}),(0,a.createElement)("div",{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container__context"},(0,a.createElement)("div",{className:`nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container__context__icon ${i.isFavorite&&"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container__context__icon__fill"}`,role:"button",tabIndex:0,onKeyDown:()=>T(i.slug,o),onClick:()=>T(i.slug,o)}),(0,a.createElement)("p",{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container__context__title"},i.title)))}))},{name:"favorites",title:(0,a.createElement)("div",{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__favorites-tab"},(0,a.createElement)("div",{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__favorites-tab__icon"}),(0,a.createElement)("p",{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__favorites-tab__text"},(0,l.__)("Favorites","wp-module-onboarding"))),content:E&&e&&n&&h&&Object.keys(e).map(((t,o)=>{const i=e[t];if(!i.isFavorite)return!1;const r=(0,b.cloneDeep)(h[0]);r.settings.color.palette=i.color.palette;let s="";return["header","content","footer"].forEach((e=>{e in i&&(s+=i[e])})),(0,a.createElement)("div",{key:i.slug,className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container",role:"button",tabIndex:0,onKeyDown:()=>O(i.slug,o),onClick:()=>O(i.slug,o)},(0,a.createElement)(m.pA,{styling:i.slug!==n.slug?"custom":"custom__highlighted",blockGrammer:s,viewportWidth:1300,previewSettings:r,skeletonLoadingTime:0}),(0,a.createElement)("p",{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__tab-panel__versions-tab__preview-container__context__title"},i.title))}))}],callback:e=>{(0,g.v)(new g.iC(u.cB,e.name,{source:v.d0})),y(e)},triggerEvent:"click"})),(0,a.createElement)(o.Button,{className:"nfd-onboarding-sidebar--sitegen-editor-patterns__header__icon",onClick:()=>{C(!1)},icon:r.A})),E&&e&&n&&E.content)))}))},7839:(e,t,n)=>{n.d(t,{A:()=>h});var a=n(1609),o=n(6087),i=n(8468),r=n(9491),s=n(8558),l=n(8107);const c=()=>{},d=["menuitem","menuitemradio","menuitemcheckbox"];class _ extends i.Component{constructor(){super(...arguments),this.onKeyDown=this.onKeyDown.bind(this),this.bindContainer=this.bindContainer.bind(this),this.getFocusableContext=this.getFocusableContext.bind(this),this.getFocusableIndex=this.getFocusableIndex.bind(this)}componentDidMount(){this.container.addEventListener("keydown",this.onKeyDown),this.container.addEventListener("focus",this.onFocus)}componentWillUnmount(){this.container.removeEventListener("keydown",this.onKeyDown),this.container.removeEventListener("focus",this.onFocus)}bindContainer(e){const{forwardedRef:t}=this.props;this.container=e,"function"==typeof t?t(e):t&&"current"in t&&(t.current=e)}getFocusableContext(e){const{onlyBrowserTabstops:t}=this.props,n=(t?l.focus.tabbable:l.focus.focusable).find(this.container),a=this.getFocusableIndex(n,e);return a>-1&&e?{index:a,target:e,focusables:n}:null}getFocusableIndex(e,t){const n=e.indexOf(t);if(-1!==n)return n}onKeyDown(e){this.props.onKeyDown&&this.props.onKeyDown(e);const{getFocusableContext:t}=this,{cycle:n=!0,eventToOffset:a,onNavigate:o=c,stopNavigationEvents:i}=this.props,r=a(e);if(void 0!==r&&i){e.stopImmediatePropagation();const t=e.target.getAttribute("role");d.includes(t)&&e.preventDefault()}if(!r)return;const s=t(e.target.ownerDocument.activeElement);if(!s)return;const{index:l,focusables:_}=s,b=n?function(e,t,n){const a=e+n;return a<0?t+a:a>=t?a-t:a}(l,_.length,r):l+r;b>=0&&b<_.length&&(_[b].focus(),o(b,_[b]))}render(){const{children:e,...t}=this.props;return(0,a.createElement)("div",{ref:this.bindContainer,...(0,o.omit)(t,["stopNavigationEvents","eventToOffset","onNavigate","onKeyDown","cycle","onlyBrowserTabstops","forwardedRef"])},e)}}const b=(e,t)=>(0,a.createElement)(_,{...e,forwardedRef:t});b.displayName="NavigableContainer";const p=(0,i.forwardRef)(b),m=(0,i.forwardRef)((function({role:e="menu",orientation:t="vertical",...n},i){return(0,a.createElement)(p,{ref:i,stopNavigationEvents:!0,onlyBrowserTabstops:!1,role:e,"aria-orientation":"presentation"===e?null:t,eventToOffset:e=>{const{keyCode:n}=e;let a=[s.DOWN],i=[s.UP];return"horizontal"===t&&(a=[s.RIGHT],i=[s.LEFT]),"both"===t&&(a=[s.RIGHT,s.DOWN],i=[s.LEFT,s.UP]),(0,o.includes)(a,n)?1:(0,o.includes)(i,n)?-1:(0,o.includes)([s.DOWN,s.UP,s.LEFT,s.RIGHT],n)?0:void 0},...n})}));(0,i.forwardRef)((function({eventToOffset:e,...t},n){return(0,a.createElement)(p,{ref:n,stopNavigationEvents:!0,onlyBrowserTabstops:!0,eventToOffset:t=>{const{keyCode:n,shiftKey:a}=t;return s.TAB===n?a?-1:1:e?e(t):void 0},...t})}));var g=n(6427);const u=()=>{},v=({tabId:e,onClick:t,children:n,selected:o,triggerEvent:i,handleEvent:r,tabName:s,...l})=>{const c=f(i,r,s);return(0,a.createElement)(g.Button,{role:"tab",tabIndex:o?null:-1,"aria-selected":o,id:e,...c,...l},n)},f=(e,t,n)=>{const a=(0,i.useCallback)((()=>t(n)),[t,n]);return"click"===e?{onClick:a}:{onMouseOver:a}};function h({className:e,children:t,tabs:n,initialTabName:s,orientation:l="horizontal",activeClass:c="is-active",notActiveClass:d="is-not-active",callback:_,onSelect:b=u,triggerEvent:p}){var g;const f=(0,r.useInstanceId)(h,"tab-panel"),[w,E]=(0,i.useState)(null),y=e=>{E(e),b(e);const t=(0,o.find)(n,{name:e});"function"==typeof _&&_(t)},N=(0,o.find)(n,{name:w}),k=`${f}-${null!==(g=N?.name)&&void 0!==g?g:"none"}`;return(0,i.useEffect)((()=>{(0,o.find)(n,{name:w})||E(s||(n.length>0?n[0].name:null))}),[n]),(0,a.createElement)("div",{className:e},(0,a.createElement)(m,{role:"tablist",orientation:l,onNavigate:(e,t)=>{t.click()},className:"components-tab-panel__tabs"},n.map((e=>(0,a.createElement)(v,{className:`components-tab-panel__tabs-item ${e.name===w&&c} ${e.name!==w&&d}`,tabId:`${f}-${e.name}`,"aria-controls":`${f}-${e.name}-view`,selected:e.name===w,key:e.name,triggerEvent:p,handleEvent:y,tabName:e.name},e.title)))),N&&(0,a.createElement)("div",{key:k,"aria-labelledby":k,role:"tabpanel",id:`${k}-view`,className:"components-tab-panel__tab-content"},t&&t(N)))}}}]);