|
45
|
|
-(0,Wt.__)("An error has occurred: %1$s","wordpress-seo"),t)})}function Dc({children:e}){const{activeStepIndex:t,stepIndex:s}=Pc(),r=t===s,[n,o]=(0,a.useState)(r?"auto":0),[i,l]=(0,a.useState)(!r);return(0,a.useEffect)(()=>{r?(o("auto"),setTimeout(()=>l(!1),kc)):(l(!0),o(0))},[r]),(0,Qt.jsx)(a.Fragment,{children:(0,Qt.jsx)(ac.A,{id:`content-${s}`,delay:0===n?Cc:jc,height:n,easing:"ease-in-out",duration:Ec,children:(0,Qt.jsx)("div",{className:Is()("yst-transition-opacity yst-relative yst-ms-12 yst-mt-4 yst-pb-1 yst-max-w-xl",Rc,i?"yst-opacity-0 yst-pointer-events-none":"yst-opacity-100"),children:e})})})}function Fc({children:e,setActiveStepIndex:t,activeStepIndex:s,isStepperFinished:r=!1}){return(0,Qt.jsx)("ol",{children:e.map((n,o)=>(0,Qt.jsx)("li",{className:(o===e.length-1?"":"yst-pb-8")+" yst-mb-0 yst-relative yst-max-w-none",children:(0,Qt.jsx)(Nc.Provider,{value:{stepIndex:o,activeStepIndex:s,setActiveStepIndex:t,lastStepIndex:e.length-1,isStepperFinished:r},children:n})},`${n.props.name}-${o}`))})}Lc.propTypes={beforeGo:Jt().func,children:Jt().node,destination:Jt().oneOfType([Jt().number,Jt().oneOf(["first","last"])])},Ic.propTypes={children:Jt().node},Ac.propTypes={children:Jt().node.isRequired},Mc.propTypes={id:Jt().string.isRequired,message:Jt().string.isRequired,className:Jt().string},Dc.propTypes={children:Jt().node.isRequired},Fc.propTypes={setActiveStepIndex:Jt().func.isRequired,activeStepIndex:Jt().number.isRequired,isStepperFinished:Jt().bool,children:Jt().node.isRequired},Ac.Content=Dc,Ac.Error=Mc,Ac.Header=_c,Ac.GoButton=Lc,Ac.EditButton=Ic;const zc="optimizeSeoData",Uc="siteRepresentation",Bc="socialProfiles",qc="personalPreferences",$c={[zc]:"data optimization",[Uc]:"site representation",[Bc]:"social profiles",[qc]:"personal preferences"};function Hc({stepId:e,additionalClasses:t="",beforeGo:s=null,children:r=null,...n}){return(0,Qt.jsx)(Ac.GoButton,{id:`button-${e}-continue`,variant:"primary",className:t,destination:1,beforeGo:s,"data-hiive-event-name":`clicked_continue | ${$c[e]}`,...n,children:r})}function Wc({stepId:e,additionalClasses:t="",isVisible:s=!0,beforeGo:r=null,children:n=null,...o}){const a=`yst-transition-opacity ${uc.slideDuration} yst-ease-out ${s?"yst-opacity-100":`${uc.delayBeforeOpening} yst-opacity-0 yst-pointer-events-none yst-hidden`}`;return(0,Qt.jsx)(Ac.GoButton,{id:`button-${e}-edit`,variant:"secondary",size:"small",className:Is()(a,t),destination:0,beforeGo:r,"data-hiive-event-name":`clicked_edit | ${$c[e]}`,...o,children:n})}function Vc({stepId:e,additionalClasses:t="",beforeGo:s=null,children:r=null,...n}){return(0,Qt.jsx)(Ac.GoButton,{id:`button-${e}-back`,variant:"secondary",className:t,destination:-1,beforeGo:s,"data-hiive-event-name":`clicked_go_back | ${$c[e]}`,...n,children:r})}function Gc({stepId:e,beforeContinue:t=null,continueLabel:s=(0,Wt.__)("Continue","wordpress-seo"),beforeBack:r=null,backLabel:n=(0,Wt.__)("Go back","wordpress-seo")}){return(0,Qt.jsxs)("div",{className:"yst-mt-12",children:[(0,Qt.jsx)(Hc,{stepId:e,beforeGo:t,children:s}),(0,Qt.jsx)(Vc,{stepId:e,additionalClasses:"yst-ms-3",beforeGo:r,children:n})]})}function Kc({stepId:e,stepperFinishedOnce:t,saveFunction:s,setEditState:r}){const n=(0,a.useCallback)(async()=>{const e=await s();return r(!e),e},[s]);return t?(0,Qt.jsx)(Ac.GoButton,{id:`button-${e}-go`,variant:"primary",className:"yst-mt-12",destination:"last",beforeGo:n,"data-hiive-event-name":`clicked_save_changes | ${$c[e]}`,children:(0,Wt.__)("Save changes","wordpress-seo")}):(0,Qt.jsx)(Gc,{stepId:e,beforeContinue:s,continueLabel:(0,Wt.__)("Save and continue","wordpress-seo")})}Hc.propTypes={stepId:Jt().string.isRequired,additionalClasses:Jt().string,beforeGo:Jt().func,children:Jt().node},Wc.propTypes={stepId:Jt().string.isRequired,additionalClasses:Jt().string,isVisible:Jt().bool,beforeGo:Jt().func,children:Jt().node},Vc.propTypes={stepId:Jt().string.isRequired,additionalClasses:Jt().string,beforeGo:Jt().func,children:Jt().node},Gc.propTypes={stepId:Jt().string.isRequired,beforeContinue:Jt().func,continueLabel:Jt().string,beforeBack:Jt().func,backLabel:Jt().string},Kc.propTypes={stepId:Jt().string.isRequired,stepperFinishedOnce:Jt().bool.isRequired,saveFunction:Jt().func.isRequired,setEditState:Jt().func.isRequired};class Yc extends Error{constructor(e,t,s,r,n,o={}){var a,i;super(e),this.name="RequestError",this.url=t,this.method=s,this.statusCode=r,this.stackTrace=n,this.objectId=null!==(a=o.objectId)&&void 0!==a?a:null,this.objectType=null!==(i=o.objectType)&&void 0!==i?i:null}}class Jc extends Error{constructor(e,t){super(e),this.name="ParseError",this.parseString=t}}const Qc="idle",Zc="in_progress",Xc="errored",ed="completed";class td extends a.Component{constructor(e){super(e),this.settings=yoastIndexingData,this.state={state:Qc,processed:0,error:null,amount:parseInt(this.settings.amount,10),firstTime:"1"===this.settings.firstTime},this.startIndexing=this.startIndexing.bind(this),this.stopIndexing=this.stopIndexing.bind(this)}getAlreadyIndexedStateName(){return"completed"}async doIndexingRequest(e,t){const s=await fetch(e,{method:"POST",headers:{"X-WP-Nonce":t}}),r=await s.text();let n;try{n=JSON.parse(r)}catch(e){throw new Jc("Error parsing the response to JSON.",r)}if(!s.ok){const t=n.data||{};throw new Yc(n.message,e,"POST",s.status,t.stackTrace,{objectId:t.object_id,objectType:t.object_type})}return n}async doPreIndexingAction(e){"function"==typeof this.props.preIndexingActions[e]&&await this.props.preIndexingActions[e](this.settings)}async doPostIndexingAction(e,t){"function"==typeof this.props.indexingActions[e]&&await this.props.indexingActions[e](t.objects,this.settings)}async doIndexing(e){let t=this.settings.restApi.root+this.settings.restApi.indexing_endpoints[e];for(;this.isState(Zc)&&!1!==t;)try{await this.doPreIndexingAction(e);const s=await this.doIndexingRequest(t,this.settings.restApi.nonce);await this.doPostIndexingAction(e,s),(0,a.flushSync)(()=>{this.setState(e=>({processed:e.processed+s.objects.length,firstTime:!1}))}),t=s.next_url}catch(e){(0,a.flushSync)(()=>{this.setState({state:Xc,error:e,firstTime:!1})})}}async index(){for(const e of Object.keys(this.settings.restApi.indexing_endpoints))await this.doIndexing(e);this.isState(Xc)||this.isState(Qc)||this.completeIndexing()}async startIndexing(){this.setState({processed:0,state:Zc},this.index)}completeIndexing(){this.setState({state:ed})}stopIndexing(){this.setState(e=>({state:Qc,processed:0,amount:e.amount-e.processed}))}componentDidMount(){var e,t;if(!this.settings.disabled&&(this.props.indexingStateCallback(0===this.state.amount?this.getAlreadyIndexedStateName():this.state.state),"true"===new URLSearchParams(window.location.search).get("start-indexation"))){const s=function(e){const t=new URL(e);return t.searchParams.delete("start-indexation"),t.href}(window.location.href);e=document.title,t=s,window.history.pushState(null,e,t),this.startIndexing()}}componentDidUpdate(e,t){this.state.state!==t.state&&this.props.indexingStateCallback(this.state.state)}isState(e){return this.state.state===e}}const sd={indexingActions:Jt().object,preIndexingActions:Jt().object,indexingStateCallback:Jt().func},rd={indexingActions:{},preIndexingActions:{},indexingStateCallback:()=>{}};td.propTypes=sd,td.defaultProps=rd;const nd=td,od=window.yoast.helpers,{stripTagsFromHtmlString:ad}=od.strings,id=["a","p"];function ld({title:e,value:t=""}){return t?(0,Qt.jsxs)("p",{children:[(0,Qt.jsx)("strong",{children:e}),(0,Qt.jsx)("br",{}),t]}):null}function cd({title:e,value:t=""}){return t?(0,Qt.jsxs)("details",{children:[(0,Qt.jsx)("summary",{children:e}),(0,Qt.jsx)("pre",{style:{overflowX:"scroll",maxWidth:"500px",border:"1px solid",padding:"16px"},children:t})]}):null}function dd({message:e,error:t}){let s="";return t.objectType&&(s=t.objectId?`${t.objectType} #${t.objectId}`:t.objectType),(0,Qt.jsxs)(Qt.Fragment,{children:[(0,Qt.jsx)("div",{dangerouslySetInnerHTML:{__html:ad(e,id)}}),(0,Qt.jsxs)("details",{children:[(0,Qt.jsx)("summary",{children:(0,Wt.__)("Error details","wordpress-seo")}),(0,Qt.jsxs)("div",{style:{marginTop:"8px"},children:[(0,Qt.jsx)(ld,{title:(0,Wt.__)("Failing object","wordpress-seo"),value:s}),(0,Qt.jsx)(ld,{title:(0,Wt.__)("Request URL","wordpress-seo"),value:t.url}),(0,Qt.jsx)(ld,{title:(0,Wt.__)("Request method","wordpress-seo"),value:t.method}),(0,Qt.jsx)(ld,{title:(0,Wt.__)("Status code","wordpress-seo"),value:t.statusCode}),(0,Qt.jsx)(ld,{title:(0,Wt.__)("Error message","wordpress-seo"),value:t.message}),(0,Qt.jsx)(cd,{title:(0,Wt.__)("Response","wordpress-seo"),value:t.parseString}),(0,Qt.jsx)(cd,{title:(0,Wt.__)("Error stack trace","wordpress-seo"),value:t.stackTrace})]})]})]})}function ud({message:e,error:t,className:s=""}){return(0,Qt.jsx)(ic,{type:"error",className:s,children:(0,Qt.jsx)(dd,{message:e,error:t})})}ld.propTypes={title:Jt().string.isRequired,value:Jt().any},cd.propTypes={title:Jt().string.isRequired,value:Jt().string},dd.propTypes={message:Jt().string.isRequired,error:Jt().oneOfType([Jt().instanceOf(Error),Jt().instanceOf(Yc)]).isRequired},ud.propTypes={message:Jt().string.isRequired,error:Jt().oneOfType([Jt().instanceOf(Error),Jt().instanceOf(Yc)]).isRequired,className:Jt().string};class pd extends nd{getAlreadyIndexedStateName(){return"already_done"}renderFirstIndexationNotice(){return(0,Qt.jsx)(ic,{type:"info",className:"yst-mt-6",children:(0,Wt.__)("This feature includes and replaces the Text Link Counter and Internal Linking Analysis","wordpress-seo")})}renderStartButton(){return(0,Qt.jsx)(l.Button,{variant:"secondary",onClick:this.startIndexing,id:"indexation-data-optimization","data-hiive-event-name":"clicked_start_data_optimization",children:(0,Wt.__)("Start SEO data optimization","wordpress-seo")})}renderStopButton(){return(0,Qt.jsx)(l.Button,{variant:"secondary",onClick:this.stopIndexing,children:(0,Wt.__)("Stop SEO data optimization","wordpress-seo")})}renderDisabledTool(){return(0,Qt.jsxs)(a.Fragment,{children:[(0,Qt.jsx)("p",{children:(0,Qt.jsx)(l.Button,{variant:"secondary",disabled:!0,id:"indexation-data-optimization",children:(0,Wt.__)("Start SEO data optimization","wordpress-seo")})}),(0,Qt.jsx)(ic,{type:"info",className:"yst-mt-6",children:(0,Wt.__)("SEO data optimization is disabled for non-production environments.","wordpress-seo")})]})}renderProgressBar(){let e=0;return this.isState(ed)&&(e=100),this.isState(Zc)&&(e=this.state.processed/parseInt(this.state.amount,10)*100),(0,Qt.jsx)("div",{className:"yst-w-full yst-bg-slate-200 yst-rounded-full yst-h-2.5 yst-mb-4",children:(0,Qt.jsx)("div",{className:"yst-transition-[width] yst-ease-linear yst-bg-primary-500 yst-h-2.5 yst-rounded-full",style:{width:`${e}%`}})})}renderCaption(){return(0,Qt.jsx)(ac.A,{id:"optimization-in-progress-text",height:this.isState(Zc)?"auto":0,easing:"linear",duration:300,children:(0,Qt.jsx)("p",{className:"yst-text-sm yst-italic yst-mb-4 yst-mt-4",children:(0,Wt.__)("SEO data optimization is running… You can safely move on to the next steps of this configuration.","wordpress-seo")})})}renderErrorAlert(){return(0,Qt.jsx)(ud,{message:yoastIndexingData.errorMessage,error:this.state.error,className:"yst-mb-4"})}render(){return this.settings.disabled?this.renderDisabledTool():(0,Qt.jsxs)("div",{className:"yst-relative",children:[this.props.children,(0,Qt.jsxs)(ui,{unmount:!1,show:this.isState(Xc)||this.isState(Zc)||this.isState(Qc)&&this.state.amount>0,leave:"yst-transition-opacity yst-duration-1000",leaveFrom:"yst-opacity-100",leaveTo:"yst-opacity-0",children:[this.renderProgressBar(),this.isState(Xc)&&this.renderErrorAlert(),this.isState(Zc)?this.renderStopButton():this.renderStartButton(),this.renderCaption(),this.isState(Qc)&&this.state.firstTime&&this.renderFirstIndexationNotice()]})]})}}pd.propTypes={...sd,children:Jt().node},pd.defaultProps={...rd,children:null};const md=pd;function hd({indexingStateCallback:e,indexingState:t,isStepperFinished:s=!1}){return(0,Qt.jsx)(md,{preIndexingActions:window.yoast.indexing.preIndexingActions,indexingActions:window.yoast.indexing.indexingActions,indexingStateCallback:e,children:(0,Qt.jsx)(ui,{unmount:!1,show:["completed","already_done"].includes(t),enter:"yst-transition-opacity yst-duration-1000",enterFrom:"yst-opacity-0",enterTo:"yst-opacity-100",children:(0,Qt.jsx)(ic,{type:"success",children:"already_done"!==t||s?(0,Wt.__)("We've successfully analyzed your site & optimized your SEO data!","wordpress-seo"):(0,Wt.__)("We've already successfully analyzed your site. You can move on to the next step.","wordpress-seo")})})})}function fd({indexingState:e,setIndexingState:t,showRunIndexationAlert:s=!1,isStepperFinished:r=!1}){return(0,Qt.jsxs)("div",{className:"yst-@container",children:[(0,Qt.jsxs)("div",{className:"yst-mb-4",children:[(0,Qt.jsx)("p",{className:"yst-text-sm yst-whitespace-pre-line",children:(0,Wt.__)("Let's start by running the SEO data optimization. That means we'll scan your site and create a database with optimized SEO data. It won't change any content or settings on your site and you don't need to do anything, just hit start!","wordpress-seo")}),(0,Qt.jsx)("p",{className:"yst-text-sm yst-whitespace-pre-line yst-mt-4",children:Vt((0,Wt.sprintf)(/* translators: %1$s expands to opening 'span' HTML tag, %2$s expands to closing 'span' HTML tag. */ /* translators: %1$s expands to opening 'span' HTML tag, %2$s expands to closing 'span' HTML tag. */ |
|
45
|
+(0,Wt.__)("An error has occurred: %1$s","wordpress-seo"),t)})}function Dc({children:e}){const{activeStepIndex:t,stepIndex:s}=Pc(),r=t===s,[n,o]=(0,a.useState)(r?"auto":0),[i,l]=(0,a.useState)(!r);return(0,a.useEffect)(()=>{r?(o("auto"),setTimeout(()=>l(!1),kc)):(l(!0),o(0))},[r]),(0,Qt.jsx)(a.Fragment,{children:(0,Qt.jsx)(ac.A,{id:`content-${s}`,delay:0===n?Cc:jc,height:n,easing:"ease-in-out",duration:Ec,children:(0,Qt.jsx)("div",{className:Is()("yst-transition-opacity yst-relative yst-ms-12 yst-mt-4 yst-pb-1 yst-max-w-xl",Rc,i?"yst-opacity-0 yst-pointer-events-none":"yst-opacity-100"),children:e})})})}function Fc({children:e,setActiveStepIndex:t,activeStepIndex:s,isStepperFinished:r=!1}){return(0,Qt.jsx)("ol",{children:e.map((n,o)=>(0,Qt.jsx)("li",{className:(o===e.length-1?"":"yst-pb-8")+" yst-mb-0 yst-relative yst-max-w-none",children:(0,Qt.jsx)(Nc.Provider,{value:{stepIndex:o,activeStepIndex:s,setActiveStepIndex:t,lastStepIndex:e.length-1,isStepperFinished:r},children:n})},`${n.props.name}-${o}`))})}Lc.propTypes={beforeGo:Jt().func,children:Jt().node,destination:Jt().oneOfType([Jt().number,Jt().oneOf(["first","last"])])},Ic.propTypes={children:Jt().node},Ac.propTypes={children:Jt().node.isRequired},Mc.propTypes={id:Jt().string.isRequired,message:Jt().string.isRequired,className:Jt().string},Dc.propTypes={children:Jt().node.isRequired},Fc.propTypes={setActiveStepIndex:Jt().func.isRequired,activeStepIndex:Jt().number.isRequired,isStepperFinished:Jt().bool,children:Jt().node.isRequired},Ac.Content=Dc,Ac.Error=Mc,Ac.Header=_c,Ac.GoButton=Lc,Ac.EditButton=Ic;const zc="optimizeSeoData",Uc="siteRepresentation",Bc="socialProfiles",qc="personalPreferences",$c={[zc]:"data optimization",[Uc]:"site representation",[Bc]:"social profiles",[qc]:"personal preferences"};function Hc({stepId:e,additionalClasses:t="",beforeGo:s=null,children:r=null,...n}){return(0,Qt.jsx)(Ac.GoButton,{id:`button-${e}-continue`,variant:"primary",className:t,destination:1,beforeGo:s,"data-hiive-event-name":`clicked_continue | ${$c[e]}`,...n,children:r})}function Wc({stepId:e,additionalClasses:t="",isVisible:s=!0,beforeGo:r=null,children:n=null,...o}){const a=`yst-transition-opacity ${uc.slideDuration} yst-ease-out ${s?"yst-opacity-100":`${uc.delayBeforeOpening} yst-opacity-0 yst-pointer-events-none yst-hidden`}`;return(0,Qt.jsx)(Ac.GoButton,{id:`button-${e}-edit`,variant:"secondary",size:"small",className:Is()(a,t),destination:0,beforeGo:r,"data-hiive-event-name":`clicked_edit | ${$c[e]}`,...o,children:n})}function Vc({stepId:e,additionalClasses:t="",beforeGo:s=null,children:r=null,...n}){return(0,Qt.jsx)(Ac.GoButton,{id:`button-${e}-back`,variant:"secondary",className:t,destination:-1,beforeGo:s,"data-hiive-event-name":`clicked_go_back | ${$c[e]}`,...n,children:r})}function Gc({stepId:e,beforeContinue:t=null,continueLabel:s=(0,Wt.__)("Continue","wordpress-seo"),beforeBack:r=null,backLabel:n=(0,Wt.__)("Go back","wordpress-seo")}){return(0,Qt.jsxs)("div",{className:"yst-mt-12",children:[(0,Qt.jsx)(Hc,{stepId:e,beforeGo:t,children:s}),(0,Qt.jsx)(Vc,{stepId:e,additionalClasses:"yst-ms-3",beforeGo:r,children:n})]})}function Kc({stepId:e,stepperFinishedOnce:t,saveFunction:s,setEditState:r}){const n=(0,a.useCallback)(async()=>{const e=await s();return r(!e),e},[s]);return t?(0,Qt.jsx)(Ac.GoButton,{id:`button-${e}-go`,variant:"primary",className:"yst-mt-12",destination:"last",beforeGo:n,"data-hiive-event-name":`clicked_save_changes | ${$c[e]}`,children:(0,Wt.__)("Save changes","wordpress-seo")}):(0,Qt.jsx)(Gc,{stepId:e,beforeContinue:s,continueLabel:(0,Wt.__)("Save and continue","wordpress-seo")})}Hc.propTypes={stepId:Jt().string.isRequired,additionalClasses:Jt().string,beforeGo:Jt().func,children:Jt().node},Wc.propTypes={stepId:Jt().string.isRequired,additionalClasses:Jt().string,isVisible:Jt().bool,beforeGo:Jt().func,children:Jt().node},Vc.propTypes={stepId:Jt().string.isRequired,additionalClasses:Jt().string,beforeGo:Jt().func,children:Jt().node},Gc.propTypes={stepId:Jt().string.isRequired,beforeContinue:Jt().func,continueLabel:Jt().string,beforeBack:Jt().func,backLabel:Jt().string},Kc.propTypes={stepId:Jt().string.isRequired,stepperFinishedOnce:Jt().bool.isRequired,saveFunction:Jt().func.isRequired,setEditState:Jt().func.isRequired};class Yc extends Error{constructor(e,t,s,r,n,o={}){var a,i;super(e),this.name="RequestError",this.url=t,this.method=s,this.statusCode=r,this.stackTrace=n,this.objectId=null!==(a=o.objectId)&&void 0!==a?a:null,this.objectType=null!==(i=o.objectType)&&void 0!==i?i:null}}class Jc extends Error{constructor(e,t){super(e),this.name="ParseError",this.parseString=t}}const Qc="idle",Zc="in_progress",Xc="errored",ed="completed";class td extends a.Component{constructor(e){super(e),this.settings=yoastIndexingData,this.state={state:Qc,processed:0,error:null,amount:parseInt(this.settings.amount,10),firstTime:"1"===this.settings.firstTime},this.startIndexing=this.startIndexing.bind(this),this.stopIndexing=this.stopIndexing.bind(this)}getAlreadyIndexedStateName(){return"completed"}async doIndexingRequest(e,t){const s=await fetch(e,{method:"POST",headers:{"X-WP-Nonce":t}}),r=await s.text();let n;try{n=JSON.parse(r)}catch(e){throw new Jc("Error parsing the response to JSON.",r)}if(!s.ok){const t=n.data||{};throw new Yc(n.message,e,"POST",s.status,t.stackTrace,{objectId:t.object_id,objectType:t.object_type})}return n}async doPreIndexingAction(e){"function"==typeof this.props.preIndexingActions[e]&&await this.props.preIndexingActions[e](this.settings)}async doPostIndexingAction(e,t){"function"==typeof this.props.indexingActions[e]&&await this.props.indexingActions[e](t.objects,this.settings)}detectIndexingLoop(e,t,s,r){if(s.next_url!==t||0===s.objects.length)return null;const n=JSON.stringify(s.objects.map(e=>[e.id,e.object_type,e.object_sub_type,e.object_id]));if(n===r)throw new Error(`Optimization of the '${e}' data is not making progress: the same batch was returned twice. Stopped to prevent an endless loop. This can happen when a plugin conflict or a failing script prevents the returned objects from being processed.`);return n}async doIndexing(e){let t=this.settings.restApi.root+this.settings.restApi.indexing_endpoints[e],s=null;for(;this.isState(Zc)&&!1!==t;)try{await this.doPreIndexingAction(e);const r=await this.doIndexingRequest(t,this.settings.restApi.nonce);await this.doPostIndexingAction(e,r),s=this.detectIndexingLoop(e,t,r,s),(0,a.flushSync)(()=>{this.setState(e=>({processed:e.processed+r.objects.length,firstTime:!1}))}),t=r.next_url}catch(e){(0,a.flushSync)(()=>{this.setState({state:Xc,error:e,firstTime:!1})})}}async index(){for(const e of Object.keys(this.settings.restApi.indexing_endpoints))await this.doIndexing(e);this.isState(Xc)||this.isState(Qc)||this.completeIndexing()}async startIndexing(){this.setState({processed:0,state:Zc},this.index)}completeIndexing(){this.setState({state:ed})}stopIndexing(){this.setState(e=>({state:Qc,processed:0,amount:e.amount-e.processed}))}componentDidMount(){var e,t;if(!this.settings.disabled&&(this.props.indexingStateCallback(0===this.state.amount?this.getAlreadyIndexedStateName():this.state.state),"true"===new URLSearchParams(window.location.search).get("start-indexation"))){const s=function(e){const t=new URL(e);return t.searchParams.delete("start-indexation"),t.href}(window.location.href);e=document.title,t=s,window.history.pushState(null,e,t),this.startIndexing()}}componentDidUpdate(e,t){this.state.state!==t.state&&this.props.indexingStateCallback(this.state.state)}isState(e){return this.state.state===e}}const sd={indexingActions:Jt().object,preIndexingActions:Jt().object,indexingStateCallback:Jt().func},rd={indexingActions:{},preIndexingActions:{},indexingStateCallback:()=>{}};td.propTypes=sd,td.defaultProps=rd;const nd=td,od=window.yoast.helpers,{stripTagsFromHtmlString:ad}=od.strings,id=["a","p"];function ld({title:e,value:t=""}){return t?(0,Qt.jsxs)("p",{children:[(0,Qt.jsx)("strong",{children:e}),(0,Qt.jsx)("br",{}),t]}):null}function cd({title:e,value:t=""}){return t?(0,Qt.jsxs)("details",{children:[(0,Qt.jsx)("summary",{children:e}),(0,Qt.jsx)("pre",{style:{overflowX:"scroll",maxWidth:"500px",border:"1px solid",padding:"16px"},children:t})]}):null}function dd({message:e,error:t}){let s="";return t.objectType&&(s=t.objectId?`${t.objectType} #${t.objectId}`:t.objectType),(0,Qt.jsxs)(Qt.Fragment,{children:[(0,Qt.jsx)("div",{dangerouslySetInnerHTML:{__html:ad(e,id)}}),(0,Qt.jsxs)("details",{children:[(0,Qt.jsx)("summary",{children:(0,Wt.__)("Error details","wordpress-seo")}),(0,Qt.jsxs)("div",{style:{marginTop:"8px"},children:[(0,Qt.jsx)(ld,{title:(0,Wt.__)("Failing object","wordpress-seo"),value:s}),(0,Qt.jsx)(ld,{title:(0,Wt.__)("Request URL","wordpress-seo"),value:t.url}),(0,Qt.jsx)(ld,{title:(0,Wt.__)("Request method","wordpress-seo"),value:t.method}),(0,Qt.jsx)(ld,{title:(0,Wt.__)("Status code","wordpress-seo"),value:t.statusCode}),(0,Qt.jsx)(ld,{title:(0,Wt.__)("Error message","wordpress-seo"),value:t.message}),(0,Qt.jsx)(cd,{title:(0,Wt.__)("Response","wordpress-seo"),value:t.parseString}),(0,Qt.jsx)(cd,{title:(0,Wt.__)("Error stack trace","wordpress-seo"),value:t.stackTrace})]})]})]})}function ud({message:e,error:t,className:s=""}){return(0,Qt.jsx)(ic,{type:"error",className:s,children:(0,Qt.jsx)(dd,{message:e,error:t})})}ld.propTypes={title:Jt().string.isRequired,value:Jt().any},cd.propTypes={title:Jt().string.isRequired,value:Jt().string},dd.propTypes={message:Jt().string.isRequired,error:Jt().oneOfType([Jt().instanceOf(Error),Jt().instanceOf(Yc)]).isRequired},ud.propTypes={message:Jt().string.isRequired,error:Jt().oneOfType([Jt().instanceOf(Error),Jt().instanceOf(Yc)]).isRequired,className:Jt().string};class pd extends nd{getAlreadyIndexedStateName(){return"already_done"}renderFirstIndexationNotice(){return(0,Qt.jsx)(ic,{type:"info",className:"yst-mt-6",children:(0,Wt.__)("This feature includes and replaces the Text Link Counter and Internal Linking Analysis","wordpress-seo")})}renderStartButton(){return(0,Qt.jsx)(l.Button,{variant:"secondary",onClick:this.startIndexing,id:"indexation-data-optimization","data-hiive-event-name":"clicked_start_data_optimization",children:(0,Wt.__)("Start SEO data optimization","wordpress-seo")})}renderStopButton(){return(0,Qt.jsx)(l.Button,{variant:"secondary",onClick:this.stopIndexing,children:(0,Wt.__)("Stop SEO data optimization","wordpress-seo")})}renderDisabledTool(){return(0,Qt.jsxs)(a.Fragment,{children:[(0,Qt.jsx)("p",{children:(0,Qt.jsx)(l.Button,{variant:"secondary",disabled:!0,id:"indexation-data-optimization",children:(0,Wt.__)("Start SEO data optimization","wordpress-seo")})}),(0,Qt.jsx)(ic,{type:"info",className:"yst-mt-6",children:(0,Wt.__)("SEO data optimization is disabled for non-production environments.","wordpress-seo")})]})}renderProgressBar(){let e=0;return this.isState(ed)&&(e=100),this.isState(Zc)&&(e=this.state.processed/parseInt(this.state.amount,10)*100),(0,Qt.jsx)("div",{className:"yst-w-full yst-bg-slate-200 yst-rounded-full yst-h-2.5 yst-mb-4",children:(0,Qt.jsx)("div",{className:"yst-transition-[width] yst-ease-linear yst-bg-primary-500 yst-h-2.5 yst-rounded-full",style:{width:`${e}%`}})})}renderCaption(){return(0,Qt.jsx)(ac.A,{id:"optimization-in-progress-text",height:this.isState(Zc)?"auto":0,easing:"linear",duration:300,children:(0,Qt.jsx)("p",{className:"yst-text-sm yst-italic yst-mb-4 yst-mt-4",children:(0,Wt.__)("SEO data optimization is running… You can safely move on to the next steps of this configuration.","wordpress-seo")})})}renderErrorAlert(){return(0,Qt.jsx)(ud,{message:yoastIndexingData.errorMessage,error:this.state.error,className:"yst-mb-4"})}render(){return this.settings.disabled?this.renderDisabledTool():(0,Qt.jsxs)("div",{className:"yst-relative",children:[this.props.children,(0,Qt.jsxs)(ui,{unmount:!1,show:this.isState(Xc)||this.isState(Zc)||this.isState(Qc)&&this.state.amount>0,leave:"yst-transition-opacity yst-duration-1000",leaveFrom:"yst-opacity-100",leaveTo:"yst-opacity-0",children:[this.renderProgressBar(),this.isState(Xc)&&this.renderErrorAlert(),this.isState(Zc)?this.renderStopButton():this.renderStartButton(),this.renderCaption(),this.isState(Qc)&&this.state.firstTime&&this.renderFirstIndexationNotice()]})]})}}pd.propTypes={...sd,children:Jt().node},pd.defaultProps={...rd,children:null};const md=pd;function hd({indexingStateCallback:e,indexingState:t,isStepperFinished:s=!1}){return(0,Qt.jsx)(md,{preIndexingActions:window.yoast.indexing.preIndexingActions,indexingActions:window.yoast.indexing.indexingActions,indexingStateCallback:e,children:(0,Qt.jsx)(ui,{unmount:!1,show:["completed","already_done"].includes(t),enter:"yst-transition-opacity yst-duration-1000",enterFrom:"yst-opacity-0",enterTo:"yst-opacity-100",children:(0,Qt.jsx)(ic,{type:"success",children:"already_done"!==t||s?(0,Wt.__)("We've successfully analyzed your site & optimized your SEO data!","wordpress-seo"):(0,Wt.__)("We've already successfully analyzed your site. You can move on to the next step.","wordpress-seo")})})})}function fd({indexingState:e,setIndexingState:t,showRunIndexationAlert:s=!1,isStepperFinished:r=!1}){return(0,Qt.jsxs)("div",{className:"yst-@container",children:[(0,Qt.jsxs)("div",{className:"yst-mb-4",children:[(0,Qt.jsx)("p",{className:"yst-text-sm yst-whitespace-pre-line",children:(0,Wt.__)("Let's start by running the SEO data optimization. That means we'll scan your site and create a database with optimized SEO data. It won't change any content or settings on your site and you don't need to do anything, just hit start!","wordpress-seo")}),(0,Qt.jsx)("p",{className:"yst-text-sm yst-whitespace-pre-line yst-mt-4",children:Vt((0,Wt.sprintf)(/* translators: %1$s expands to opening 'span' HTML tag, %2$s expands to closing 'span' HTML tag. */ /* translators: %1$s expands to opening 'span' HTML tag, %2$s expands to closing 'span' HTML tag. */ |
|
46
|
46
|
(0,Wt.__)("%1$sNote%2$s: If you have a lot of content, this optimization could take a moment. But trust us, it's worth it!","wordpress-seo"),"<span>","</span>"),{span:(0,Qt.jsx)("span",{className:"yst-text-slate-800 yst-font-medium"})})})]}),(0,Qt.jsx)("div",{id:"yoast-configuration-indexing-container",className:"indexation-container",children:(0,Qt.jsx)(hd,{indexingStateCallback:t,indexingState:e,isStepperFinished:r})}),(0,Qt.jsx)(lc,{id:"indexation-alert",isVisible:"idle"===e&&s,expandDuration:400,type:"info",children:(0,Wt.__)("Be aware that you should run the SEO data optimization for this configuration to take maximum effect.","wordpress-seo")})]})}function yd(e,t){let[s,r]=(0,d.useState)(e),n=Ba(e);return za(()=>r(n.current),[n,r,...t]),s}hd.propTypes={indexingStateCallback:Jt().func.isRequired,indexingState:Jt().string.isRequired,isStepperFinished:Jt().bool},fd.propTypes={indexingState:Jt().string.isRequired,setIndexingState:Jt().func.isRequired,showRunIndexationAlert:Jt().bool,isStepperFinished:Jt().bool};var gd=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(gd||{});function vd(e,t){let s=t.resolveItems();if(s.length<=0)return null;let r=t.resolveActiveIndex(),n=null!=r?r:-1,o=(()=>{switch(e.focus){case 0:return s.findIndex(e=>!t.resolveDisabled(e));case 1:{let e=s.slice().reverse().findIndex((e,s,r)=>!(-1!==n&&r.length-s-1>=n||t.resolveDisabled(e)));return-1===e?e:s.length-1-e}case 2:return s.findIndex((e,s)=>!(s<=n||t.resolveDisabled(e)));case 3:{let e=s.slice().reverse().findIndex(e=>!t.resolveDisabled(e));return-1===e?e:s.length-1-e}case 4:return s.findIndex(s=>t.resolveId(s)===e.id);case 5:return null;default:!function(e){throw new Error("Unexpected object: "+e)}(e)}})();return-1===o?r:o}let bd=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var xd,wd=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e))(wd||{}),Sd=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Sd||{}),_d=((xd=_d||{})[xd.Previous=-1]="Previous",xd[xd.Next=1]="Next",xd),Ed=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Ed||{});function jd(e,t=0){var s;return e!==(null==(s=$i(e))?void 0:s.body)&&wa(t,{0:()=>e.matches(bd),1(){let t=e;for(;null!==t;){if(t.matches(bd))return!0;t=t.parentElement}return!1}})}function kd(e,t=e=>e){return e.slice().sort((e,s)=>{let r=t(e),n=t(s);if(null===r||null===n)return 0;let o=r.compareDocumentPosition(n);return o&Node.DOCUMENT_POSITION_FOLLOWING?-1:o&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Cd(e,t,s){let r=Ba(t);(0,d.useEffect)(()=>{function t(e){r.current(e)}return document.addEventListener(e,t,s),()=>document.removeEventListener(e,t,s)},[e,s])}function Rd(e,t,s=!0){let r=(0,d.useRef)(!1);function n(s,n){if(!r.current||s.defaultPrevented)return;let o=function e(t){return"function"==typeof t?e(t()):Array.isArray(t)||t instanceof Set?t:[t]}(e),a=n(s);if(null!==a&&a.getRootNode().contains(a)){for(let e of o){if(null===e)continue;let t=e instanceof HTMLElement?e:e.current;if(null!=t&&t.contains(a)||s.composed&&s.composedPath().includes(t))return}return!jd(a,Ed.Loose)&&-1!==a.tabIndex&&s.preventDefault(),t(s,a)}}(0,d.useEffect)(()=>{requestAnimationFrame(()=>{r.current=s})},[s]);let o=(0,d.useRef)(null);Cd("mousedown",e=>{var t,s;r.current&&(o.current=(null==(s=null==(t=e.composedPath)?void 0:t.call(e))?void 0:s[0])||e.target)},!0),Cd("click",e=>{!o.current||(n(e,()=>o.current),o.current=null)},!0),Cd("blur",e=>n(e,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}["textarea","input"].join(",");var Td=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Td||{});let Od=Ta(function(e,t){let{features:s=1,...r}=e;return ka({ourProps:{ref:t,"aria-hidden":!(2&~s)||void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...!(4&~s)&&!!(2&~s)&&{display:"none"}}},theirProps:r,slot:{},defaultTag:"div",name:"Hidden"})});function Nd(e={},t=null,s=[]){for(let[r,n]of Object.entries(e))Ld(s,Pd(t,r),n);return s}function Pd(e,t){return e?e+"["+t+"]":t}function Ld(e,t,s){if(Array.isArray(s))for(let[r,n]of s.entries())Ld(e,Pd(t,r.toString()),n);else s instanceof Date?e.push([t,s.toISOString()]):"boolean"==typeof s?e.push([t,s?"1":"0"]):"string"==typeof s?e.push([t,s]):"number"==typeof s?e.push([t,`${s}`]):null==s?e.push([t,""]):Nd(s,t,e)}function Id(e,t,s){let[r,n]=(0,d.useState)(s),o=void 0!==e,a=(0,d.useRef)(o),i=(0,d.useRef)(!1),l=(0,d.useRef)(!1);return!o||a.current||i.current?!o&&a.current&&!l.current&&(l.current=!0,a.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")):(i.current=!0,a.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")),[o?e:r,$a(e=>(o||n(e),null==t?void 0:t(e)))]}function Ad(e){return[e.screenX,e.screenY]}function Md(){let e=(0,d.useRef)([-1,-1]);return{wasMoved(t){let s=Ad(t);return(e.current[0]!==s[0]||e.current[1]!==s[1])&&(e.current=s,!0)},update(t){e.current=Ad(t)}}}var Dd=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Dd||{}),Fd=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Fd||{}),zd=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(zd||{}),Ud=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOption=5]="RegisterOption",e[e.UnregisterOption=6]="UnregisterOption",e[e.RegisterLabel=7]="RegisterLabel",e))(Ud||{});function Bd(e,t=e=>e){let s=null!==e.activeOptionIndex?e.options[e.activeOptionIndex]:null,r=kd(t(e.options.slice()),e=>e.dataRef.current.domRef.current),n=s?r.indexOf(s):null;return-1===n&&(n=null),{options:r,activeOptionIndex:n}}let qd={1:e=>e.dataRef.current.disabled||1===e.listboxState?e:{...e,activeOptionIndex:null,listboxState:1},0(e){if(e.dataRef.current.disabled||0===e.listboxState)return e;let t=e.activeOptionIndex,{isSelected:s}=e.dataRef.current,r=e.options.findIndex(e=>s(e.dataRef.current.value));return-1!==r&&(t=r),{...e,listboxState:0,activeOptionIndex:t}},2(e,t){var s;if(e.dataRef.current.disabled||1===e.listboxState)return e;let r=Bd(e),n=vd(t,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeOptionIndex:n,activationTrigger:null!=(s=t.trigger)?s:1}},3:(e,t)=>{if(e.dataRef.current.disabled||1===e.listboxState)return e;let s=""!==e.searchQuery?0:1,r=e.searchQuery+t.value.toLowerCase(),n=(null!==e.activeOptionIndex?e.options.slice(e.activeOptionIndex+s).concat(e.options.slice(0,e.activeOptionIndex+s)):e.options).find(e=>{var t;return!e.dataRef.current.disabled&&(null==(t=e.dataRef.current.textValue)?void 0:t.startsWith(r))}),o=n?e.options.indexOf(n):-1;return-1===o||o===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:o,activationTrigger:1}},4:e=>e.dataRef.current.disabled||1===e.listboxState||""===e.searchQuery?e:{...e,searchQuery:""},5:(e,t)=>{let s={id:t.id,dataRef:t.dataRef},r=Bd(e,e=>[...e,s]);return null===e.activeOptionIndex&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(r.activeOptionIndex=r.options.indexOf(s)),{...e,...r}},6:(e,t)=>{let s=Bd(e,e=>{let s=e.findIndex(e=>e.id===t.id);return-1!==s&&e.splice(s,1),e});return{...e,...s,activationTrigger:1}},7:(e,t)=>({...e,labelId:t.id})},$d=(0,d.createContext)(null);function Hd(e){let t=(0,d.useContext)($d);if(null===t){let t=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Hd),t}return t}$d.displayName="ListboxActionsContext";let Wd=(0,d.createContext)(null);function Vd(e){let t=(0,d.useContext)(Wd);if(null===t){let t=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Vd),t}return t}function Gd(e,t){return wa(t.type,qd,e,t)}Wd.displayName="ListboxDataContext";let Kd=d.Fragment,Yd=Ta(function(e,t){let{value:s,defaultValue:r,name:n,onChange:o,by:a=(e,t)=>e===t,disabled:i=!1,horizontal:l=!1,multiple:c=!1,...u}=e;const p=l?"horizontal":"vertical";let m=Va(t),[h=(c?[]:void 0),f]=Id(s,o,r),[y,g]=(0,d.useReducer)(Gd,{dataRef:(0,d.createRef)(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),v=(0,d.useRef)({static:!1,hold:!1}),b=(0,d.useRef)(null),x=(0,d.useRef)(null),w=(0,d.useRef)(null),S=$a("string"==typeof a?(e,t)=>{let s=a;return(null==e?void 0:e[s])===(null==t?void 0:t[s])}:a),_=(0,d.useCallback)(e=>wa(E.mode,{1:()=>h.some(t=>S(t,e)),0:()=>S(h,e)}),[h]),E=(0,d.useMemo)(()=>({...y,value:h,disabled:i,mode:c?1:0,orientation:p,compare:S,isSelected:_,optionsPropsRef:v,labelRef:b,buttonRef:x,optionsRef:w}),[h,i,c,y]);za(()=>{y.dataRef.current=E},[E]),Rd([E.buttonRef,E.optionsRef],(e,t)=>{var s;g({type:1}),jd(t,Ed.Loose)||(e.preventDefault(),null==(s=E.buttonRef.current)||s.focus())},0===E.listboxState);let j=(0,d.useMemo)(()=>({open:0===E.listboxState,disabled:i,value:h}),[E,i,h]),k=$a(e=>{let t=E.options.find(t=>t.id===e);!t||L(t.dataRef.current.value)}),C=$a(()=>{if(null!==E.activeOptionIndex){let{dataRef:e,id:t}=E.options[E.activeOptionIndex];L(e.current.value),g({type:2,focus:gd.Specific,id:t})}}),R=$a(()=>g({type:0})),T=$a(()=>g({type:1})),O=$a((e,t,s)=>e===gd.Specific?g({type:2,focus:gd.Specific,id:t,trigger:s}):g({type:2,focus:e,trigger:s})),N=$a((e,t)=>(g({type:5,id:e,dataRef:t}),()=>g({type:6,id:e}))),P=$a(e=>(g({type:7,id:e}),()=>g({type:7,id:null}))),L=$a(e=>wa(E.mode,{0:()=>null==f?void 0:f(e),1(){let t=E.value.slice(),s=t.findIndex(t=>S(t,e));return-1===s?t.push(e):t.splice(s,1),null==f?void 0:f(t)}})),I=$a(e=>g({type:3,value:e})),A=$a(()=>g({type:4})),M=(0,d.useMemo)(()=>({onChange:L,registerOption:N,registerLabel:P,goToOption:O,closeListbox:T,openListbox:R,selectActiveOption:C,selectOption:k,search:I,clearSearch:A}),[]),D={ref:m},F=(0,d.useRef)(null),z=Ja();return(0,d.useEffect)(()=>{!F.current||void 0!==r&&z.addEventListener(F.current,"reset",()=>{L(r)})},[F,L]),d.createElement($d.Provider,{value:M},d.createElement(Wd.Provider,{value:E},d.createElement(Aa,{value:wa(E.listboxState,{0:La.Open,1:La.Closed})},null!=n&&null!=h&&Nd({[n]:h}).map(([e,t],s)=>d.createElement(Od,{features:Td.Hidden,ref:0===s?e=>{var t;F.current=null!=(t=null==e?void 0:e.closest("form"))?t:null}:void 0,...Oa({key:e,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:e,value:t})})),ka({ourProps:D,theirProps:u,slot:j,defaultTag:Kd,name:"Listbox"}))))}),Jd=Ta(function(e,t){var s;let r=Fi(),{id:n=`headlessui-listbox-button-${r}`,...o}=e,a=Vd("Listbox.Button"),i=Hd("Listbox.Button"),l=Va(a.buttonRef,t),c=Ja(),u=$a(e=>{switch(e.key){case zi.Space:case zi.Enter:case zi.ArrowDown:e.preventDefault(),i.openListbox(),c.nextFrame(()=>{a.value||i.goToOption(gd.First)});break;case zi.ArrowUp:e.preventDefault(),i.openListbox(),c.nextFrame(()=>{a.value||i.goToOption(gd.Last)})}}),p=$a(e=>{e.key===zi.Space&&e.preventDefault()}),m=$a(e=>{if(Ui(e.currentTarget))return e.preventDefault();0===a.listboxState?(i.closeListbox(),c.nextFrame(()=>{var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})})):(e.preventDefault(),i.openListbox())}),h=yd(()=>{if(a.labelId)return[a.labelId,n].join(" ")},[a.labelId,n]),f=(0,d.useMemo)(()=>({open:0===a.listboxState,disabled:a.disabled,value:a.value}),[a]);return ka({ourProps:{ref:l,id:n,type:qi(e,a.buttonRef),"aria-haspopup":"listbox","aria-controls":null==(s=a.optionsRef.current)?void 0:s.id,"aria-expanded":a.disabled?void 0:0===a.listboxState,"aria-labelledby":h,disabled:a.disabled,onKeyDown:u,onKeyUp:p,onClick:m},theirProps:o,slot:f,defaultTag:"button",name:"Listbox.Button"})}),Qd=Ta(function(e,t){let s=Fi(),{id:r=`headlessui-listbox-label-${s}`,...n}=e,o=Vd("Listbox.Label"),a=Hd("Listbox.Label"),i=Va(o.labelRef,t);za(()=>a.registerLabel(r),[r]);let l=$a(()=>{var e;return null==(e=o.buttonRef.current)?void 0:e.focus({preventScroll:!0})}),c=(0,d.useMemo)(()=>({open:0===o.listboxState,disabled:o.disabled}),[o]);return ka({ourProps:{ref:i,id:r,onClick:l},theirProps:n,slot:c,defaultTag:"label",name:"Listbox.Label"})}),Zd=Ea.RenderStrategy|Ea.Static,Xd=Ta(function(e,t){var s;let r=Fi(),{id:n=`headlessui-listbox-options-${r}`,...o}=e,a=Vd("Listbox.Options"),i=Hd("Listbox.Options"),l=Va(a.optionsRef,t),c=Ja(),u=Ja(),p=Ia(),m=null!==p?p===La.Open:0===a.listboxState;(0,d.useEffect)(()=>{var e;let t=a.optionsRef.current;!t||0===a.listboxState&&t!==(null==(e=$i(t))?void 0:e.activeElement)&&t.focus({preventScroll:!0})},[a.listboxState,a.optionsRef]);let h=$a(e=>{switch(u.dispose(),e.key){case zi.Space:if(""!==a.searchQuery)return e.preventDefault(),e.stopPropagation(),i.search(e.key);case zi.Enter:if(e.preventDefault(),e.stopPropagation(),null!==a.activeOptionIndex){let{dataRef:e}=a.options[a.activeOptionIndex];i.onChange(e.current.value)}0===a.mode&&(i.closeListbox(),Ga().nextFrame(()=>{var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})}));break;case wa(a.orientation,{vertical:zi.ArrowDown,horizontal:zi.ArrowRight}):return e.preventDefault(),e.stopPropagation(),i.goToOption(gd.Next);case wa(a.orientation,{vertical:zi.ArrowUp,horizontal:zi.ArrowLeft}):return e.preventDefault(),e.stopPropagation(),i.goToOption(gd.Previous);case zi.Home:case zi.PageUp:return e.preventDefault(),e.stopPropagation(),i.goToOption(gd.First);case zi.End:case zi.PageDown:return e.preventDefault(),e.stopPropagation(),i.goToOption(gd.Last);case zi.Escape:return e.preventDefault(),e.stopPropagation(),i.closeListbox(),c.nextFrame(()=>{var e;return null==(e=a.buttonRef.current)?void 0:e.focus({preventScroll:!0})});case zi.Tab:e.preventDefault(),e.stopPropagation();break;default:1===e.key.length&&(i.search(e.key),u.setTimeout(()=>i.clearSearch(),350))}}),f=yd(()=>{var e,t,s;return null!=(s=null==(e=a.labelRef.current)?void 0:e.id)?s:null==(t=a.buttonRef.current)?void 0:t.id},[a.labelRef.current,a.buttonRef.current]),y=(0,d.useMemo)(()=>({open:0===a.listboxState}),[a]);return ka({ourProps:{"aria-activedescendant":null===a.activeOptionIndex||null==(s=a.options[a.activeOptionIndex])?void 0:s.id,"aria-multiselectable":1===a.mode||void 0,"aria-labelledby":f,"aria-orientation":a.orientation,id:n,onKeyDown:h,role:"listbox",tabIndex:0,ref:l},theirProps:o,slot:y,defaultTag:"ul",features:Zd,visible:m,name:"Listbox.Options"})}),eu=Ta(function(e,t){let s=Fi(),{id:r=`headlessui-listbox-option-${s}`,disabled:n=!1,value:o,...a}=e,i=Vd("Listbox.Option"),l=Hd("Listbox.Option"),c=null!==i.activeOptionIndex&&i.options[i.activeOptionIndex].id===r,u=i.isSelected(o),p=(0,d.useRef)(null),m=Ba({disabled:n,value:o,domRef:p,get textValue(){var e,t;return null==(t=null==(e=p.current)?void 0:e.textContent)?void 0:t.toLowerCase()}}),h=Va(t,p);za(()=>{if(0!==i.listboxState||!c||0===i.activationTrigger)return;let e=Ga();return e.requestAnimationFrame(()=>{var e,t;null==(t=null==(e=p.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})}),e.dispose},[p,c,i.listboxState,i.activationTrigger,i.activeOptionIndex]),za(()=>l.registerOption(r,m),[m,r]);let f=$a(e=>{if(n)return e.preventDefault();l.onChange(o),0===i.mode&&(l.closeListbox(),Ga().nextFrame(()=>{var e;return null==(e=i.buttonRef.current)?void 0:e.focus({preventScroll:!0})}))}),y=$a(()=>{if(n)return l.goToOption(gd.Nothing);l.goToOption(gd.Specific,r)}),g=Md(),v=$a(e=>g.update(e)),b=$a(e=>{!g.wasMoved(e)||n||c||l.goToOption(gd.Specific,r,0)}),x=$a(e=>{!g.wasMoved(e)||n||!c||l.goToOption(gd.Nothing)}),w=(0,d.useMemo)(()=>({active:c,selected:u,disabled:n}),[c,u,n]);return ka({ourProps:{id:r,ref:h,role:"option",tabIndex:!0===n?void 0:-1,"aria-disabled":!0===n||void 0,"aria-selected":u,disabled:void 0,onClick:f,onFocus:y,onPointerEnter:v,onMouseEnter:v,onPointerMove:b,onMouseMove:b,onPointerLeave:x,onMouseLeave:x},theirProps:a,slot:w,defaultTag:"li",name:"Listbox.Option"})}),tu=Object.assign(Yd,{Button:Jd,Label:Qd,Options:Xd,Option:eu});var su=s(2499),ru=s.n(su);function nu({id:e,value:t,choices:s,label:r="",onChange:n,error:o={message:"",isVisible:!1},disabled:i=!1}){const l=(0,a.useMemo)(()=>{const e=s.find(e=>t===e.value);return e?e.label:(0,Wt.__)("Select an option","wordpress-seo")},[s,t]);return(0,Qt.jsx)(tu,{id:e,as:"div",value:t,onChange:n,disabled:i,children:({open:n})=>(0,Qt.jsxs)(Qt.Fragment,{children:[r&&(0,Qt.jsx)(tu.Label,{className:"yst-block yst-max-w-sm yst-mb-2 yst-text-sm yst-font-medium yst-text-slate-800",children:r}),(0,Qt.jsxs)("div",{className:"yst-max-w-sm",children:[(0,Qt.jsxs)("div",{className:"yst-relative",children:[(0,Qt.jsxs)(tu.Button,{"data-id":`button-${e} `,className:Is()("yst-relative yst-h-[40px] yst-w-full yst-leading-6 yst-py-2 yst-ps-3 yst-pe-10 yst-text-start yst-bg-white yst-border yst-border-slate-300 yst-rounded-md yst-shadow-sm yst-cursor-default focus:yst-outline-none focus:yst-ring-1 focus:yst-ring-primary-500 focus:yst-border-primary-500 sm:yst-text-sm",{"yst-border-red-300":o.isVisible,"yst-opacity-50":i},"emptyChoice"===t?"yst-text-slate-400":"yst-text-slate-700"),...Dl(e,o),children:[(0,Qt.jsx)("span",{className:"yst-block yst-truncate",children:l}),(0,Qt.jsx)("span",{className:"yst-absolute yst-inset-y-0 yst-end-0 yst-flex yst-items-center yst-pe-2 yst-pointer-events-none",children:(0,Qt.jsx)(ru(),{className:"yst-w-5 yst-h-5 yst-text-slate-400","aria-hidden":"true"})}),o.isVisible&&(0,Qt.jsx)("div",{className:"yst-flex yst-items-center yst-absolute yst-inset-y-0 yst-end-0 yst-me-8",children:(0,Qt.jsx)(Vl(),{className:"yst-pointer-events-none yst-h-5 yst-w-5 yst-text-red-500"})})]}),(0,Qt.jsx)(ui,{show:n,as:a.Fragment,leave:"yst-transition yst-ease-in yst-duration-100",leaveFrom:"yst-opacity-100",leaveTo:"yst-opacity-0",children:(0,Qt.jsx)(tu.Options,{static:!0,className:"yst-absolute yst-z-10 yst-w-full yst-mt-1 yst-overflow-auto yst-bg-white yst-rounded-md yst-shadow-lg yst-max-h-60 yst-ring-1 yst-ring-black yst-ring-opacity-5 focus:yst-outline-none sm:yst-text-sm",children:s.map(e=>(0,Qt.jsx)(tu.Option,{as:a.Fragment,value:e.value,children:({selected:t,active:s})=>(0,Qt.jsxs)("li",{className:Fl({selected:t,active:s}),children:[(0,Qt.jsx)("span",{className:Is()(t?"yst-font-semibold":"yst-font-normal","yst-block yst-truncate"),children:e.label}),t?(0,Qt.jsx)("span",{className:Is()("yst-text-white yst-absolute yst-inset-y-0 yst-end-0 yst-flex yst-items-center yst-pe-4"),children:(0,Qt.jsx)(mc(),{className:"yst-w-5 yst-h-5","aria-hidden":"true"})}):null]})},e.id))})})]}),o.isVisible&&(0,Qt.jsx)(Kl,{id:Ml(e),className:"yst-mt-2 yst-text-sm yst-text-red-600",texts:o.message})]})]})})}nu.propTypes={value:Yt.PropTypes.oneOfType([Yt.PropTypes.string,Yt.PropTypes.number]).isRequired,choices:Yt.PropTypes.arrayOf(Yt.PropTypes.shape({id:Yt.PropTypes.oneOfType([Yt.PropTypes.number,Yt.PropTypes.string]).isRequired,value:Yt.PropTypes.string.isRequired,label:Yt.PropTypes.string.isRequired})).isRequired,label:Yt.PropTypes.string,onChange:Yt.PropTypes.func.isRequired,id:Yt.PropTypes.string.isRequired,error:Yt.PropTypes.shape({message:Yt.PropTypes.string,isVisible:Yt.PropTypes.bool}),disabled:Yt.PropTypes.bool},window.yoast.socialMetadataForms;function ou(e){(function(e){const t=window.wp.media();return t.on("select",()=>{const s=t.state().get("selection").first();var r;e({type:(r=s.attributes).subtype,width:r.width,height:r.height,url:r.url,id:r.id,sizes:r.sizes,alt:r.alt||r.title||r.name})}),t})(e).open()}var au=s(4925),iu=s.n(au);const lu=({className:e=""})=>(0,Qt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",className:Is()("yst-animate-spin",e),children:[(0,Qt.jsx)("circle",{className:"yst-opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,Qt.jsx)("path",{className:"yst-opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]});lu.propTypes={className:Jt().string};const cu=lu;function du({id:e,imageAltText:t="",url:s="",fallbackUrl:r="",label:n="",onSelectImageClick:o=c.noop,onRemoveImageClick:i=c.noop,className:d="",error:u={message:"",isVisible:!1},status:p="idle"}){const m=Is()("yst-relative yst-w-full yst-h-48 yst-mt-2 yst-flex yst-justify-center yst-items-center yst-rounded-md yst-mb-4 focus:yst-outline-none focus:yst-ring-2 focus:yst-ring-offset-2 focus:yst-ring-primary-500",u.isVisible?"yst-border-red-300":"yst-border-slate-300","yst-border-2 yst-border-dashed"),h=(0,a.useCallback)(()=>"loading"===p?(0,Qt.jsxs)("div",{className:"yst-text-center",children:[(0,Qt.jsx)(cu,{size:"10",color:"gray-400",className:"yst-inline-block"}),(0,Qt.jsx)("p",{className:"yst-mt-3",children:(0,Wt.__)("Uploading image…","wordpress-seo")})]}):s?(0,Qt.jsx)("img",{src:s,alt:t,className:"yst-w-full yst-h-full yst-object-contain"}):r?(0,Qt.jsx)("img",{src:r,alt:t,className:"yst-w-full yst-h-full yst-object-contain"}):(0,Qt.jsx)(iu(),{id:`${e}-no-image-svg`,className:"yst-w-14 yst-h-14 yst-text-slate-500"}),[p,e,s,t]);return(0,Qt.jsxs)("div",{className:Is()("yst-max-w-sm",d),...Dl(e,u),children:[(0,Qt.jsx)("label",{htmlFor:e,className:"yst-block yst-mb-2 yst-font-medium yst-text-slate-800",children:n}),(0,Qt.jsx)("button",{id:e,className:m,onClick:o,type:"button","data-hiive-event-name":"clicked_select_image",children:h()}),(0,Qt.jsxs)("div",{children:[(0,Qt.jsx)(l.Button,{id:s?e+"__replace-image":e+"__select-image",variant:"secondary",className:"yst-me-2",onClick:o,"data-hiive-event-name":s?"clicked_replace_image":"clicked_select_image",children:s?(0,Wt.__)("Replace image","wordpress-seo"):(0,Wt.__)("Select image","wordpress-seo")}),s&&(0,Qt.jsx)(l.Link,{id:`${e}__remove-image`,as:"button",type:"button",variant:"error",onClick:i,className:"yst-px-3 yst-py-2 yst-rounded-md","data-hiive-event-name":"clicked_remove_image",children:(0,Wt.__)("Remove image","wordpress-seo")})]}),"error"===p&&(0,Qt.jsx)("p",{className:"yst-mt-2 yst-text-sm yst-text-red-600",children:u}),u.isVisible&&(0,Qt.jsx)(Kl,{id:Ml(e),className:"yst-mt-2 yst-text-sm yst-text-red-600",texts:u.message})]})}function uu({dispatch:e,imageUrl:t="",fallbackImageUrl:s="",organizationName:r="",fallbackOrganizationName:n="",errorFields:o=[]}){const i=(0,a.useCallback)(()=>{ou(t=>{e({type:"SET_COMPANY_LOGO",payload:{...t}})})},[ou]),l=(0,a.useCallback)(()=>{e({type:"REMOVE_COMPANY_LOGO"})},[e]),c=(0,a.useCallback)(t=>{e({type:"CHANGE_COMPANY_NAME",payload:t.target.value})},[e]);return(0,Qt.jsxs)(a.Fragment,{children:[(0,Qt.jsx)(Jl,{className:"yst-mt-6",id:"organization-name-input",name:"organization-name",label:(0,Wt.__)("Organization name","wordpress-seo"),value:""===r?n:r,onChange:c,feedback:{isVisible:o.includes("company_name"),message:[(0,Wt.__)("We could not save the organization name. Please check the value.","wordpress-seo")],type:"error"}}),(0,Qt.jsx)(du,{className:"yst-mt-6",id:"organization-logo-input",url:t,fallbackUrl:s,onSelectImageClick:i,onRemoveImageClick:l,imageAltText:"",hasPreview:!0,label:(0,Wt.__)("Organization logo","wordpress-seo")})]})}function pu(e,t){let s=(0,d.useRef)([]),r=$a(e);(0,d.useEffect)(()=>{let e=[...s.current];for(let[n,o]of t.entries())if(s.current[n]!==o){let n=r(t,e);return s.current=t,n}},[r,...t])}du.propTypes={label:Jt().string,id:Jt().string.isRequired,url:Jt().string,fallbackUrl:Jt().string,imageAltText:Jt().string,onRemoveImageClick:Jt().func,onSelectImageClick:Jt().func,className:Jt().string,error:Jt().shape({message:Jt().string,isVisible:Jt().bool}),status:Jt().string},uu.propTypes={dispatch:Jt().func.isRequired,imageUrl:Jt().string,fallbackImageUrl:Jt().string,organizationName:Jt().string,fallbackOrganizationName:Jt().string,errorFields:Jt().array};var mu=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(mu||{}),hu=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(hu||{}),fu=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(fu||{}),yu=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.RegisterOption=3]="RegisterOption",e[e.UnregisterOption=4]="UnregisterOption",e[e.RegisterLabel=5]="RegisterLabel",e))(yu||{});function gu(e,t=e=>e){let s=null!==e.activeOptionIndex?e.options[e.activeOptionIndex]:null,r=kd(t(e.options.slice()),e=>e.dataRef.current.domRef.current),n=s?r.indexOf(s):null;return-1===n&&(n=null),{options:r,activeOptionIndex:n}}let vu={1:e=>e.dataRef.current.disabled||1===e.comboboxState?e:{...e,activeOptionIndex:null,comboboxState:1},0(e){if(e.dataRef.current.disabled||0===e.comboboxState)return e;let t=e.activeOptionIndex,{isSelected:s}=e.dataRef.current,r=e.options.findIndex(e=>s(e.dataRef.current.value));return-1!==r&&(t=r),{...e,comboboxState:0,activeOptionIndex:t}},2(e,t){var s;if(e.dataRef.current.disabled||e.dataRef.current.optionsRef.current&&!e.dataRef.current.optionsPropsRef.current.static&&1===e.comboboxState)return e;let r=gu(e);if(null===r.activeOptionIndex){let e=r.options.findIndex(e=>!e.dataRef.current.disabled);-1!==e&&(r.activeOptionIndex=e)}let n=vd(t,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:e=>e.id,resolveDisabled:e=>e.dataRef.current.disabled});return{...e,...r,activeOptionIndex:n,activationTrigger:null!=(s=t.trigger)?s:1}},3:(e,t)=>{let s={id:t.id,dataRef:t.dataRef},r=gu(e,e=>[...e,s]);null===e.activeOptionIndex&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(r.activeOptionIndex=r.options.indexOf(s));let n={...e,...r,activationTrigger:1};return e.dataRef.current.__demoMode&&void 0===e.dataRef.current.value&&(n.activeOptionIndex=0),n},4:(e,t)=>{let s=gu(e,e=>{let s=e.findIndex(e=>e.id===t.id);return-1!==s&&e.splice(s,1),e});return{...e,...s,activationTrigger:1}},5:(e,t)=>({...e,labelId:t.id})},bu=(0,d.createContext)(null);function xu(e){let t=(0,d.useContext)(bu);if(null===t){let t=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,xu),t}return t}bu.displayName="ComboboxActionsContext";let wu=(0,d.createContext)(null);function Su(e){let t=(0,d.useContext)(wu);if(null===t){let t=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Su),t}return t}function _u(e,t){return wa(t.type,vu,e,t)}wu.displayName="ComboboxDataContext";let Eu=d.Fragment,ju=Ta(function(e,t){let{value:s,defaultValue:r,onChange:n,name:o,by:a=(e,t)=>e===t,disabled:i=!1,__demoMode:l=!1,nullable:c=!1,multiple:u=!1,...p}=e,[m=(u?[]:void 0),h]=Id(s,n,r),[f,y]=(0,d.useReducer)(_u,{dataRef:(0,d.createRef)(),comboboxState:l?0:1,options:[],activeOptionIndex:null,activationTrigger:1,labelId:null}),g=(0,d.useRef)(!1),v=(0,d.useRef)({static:!1,hold:!1}),b=(0,d.useRef)(null),x=(0,d.useRef)(null),w=(0,d.useRef)(null),S=(0,d.useRef)(null),_=$a("string"==typeof a?(e,t)=>{let s=a;return(null==e?void 0:e[s])===(null==t?void 0:t[s])}:a),E=(0,d.useCallback)(e=>wa(j.mode,{1:()=>m.some(t=>_(t,e)),0:()=>_(m,e)}),[m]),j=(0,d.useMemo)(()=>({...f,optionsPropsRef:v,labelRef:b,inputRef:x,buttonRef:w,optionsRef:S,value:m,defaultValue:r,disabled:i,mode:u?1:0,get activeOptionIndex(){if(g.current&&null===f.activeOptionIndex&&f.options.length>0){let e=f.options.findIndex(e=>!e.dataRef.current.disabled);if(-1!==e)return e}return f.activeOptionIndex},compare:_,isSelected:E,nullable:c,__demoMode:l}),[m,r,i,u,c,l,f]);za(()=>{f.dataRef.current=j},[j]),Rd([j.buttonRef,j.inputRef,j.optionsRef],()=>A.closeCombobox(),0===j.comboboxState);let k=(0,d.useMemo)(()=>({open:0===j.comboboxState,disabled:i,activeIndex:j.activeOptionIndex,activeOption:null===j.activeOptionIndex?null:j.options[j.activeOptionIndex].dataRef.current.value,value:m}),[j,i,m]),C=$a(e=>{let t=j.options.find(t=>t.id===e);!t||I(t.dataRef.current.value)}),R=$a(()=>{if(null!==j.activeOptionIndex){let{dataRef:e,id:t}=j.options[j.activeOptionIndex];I(e.current.value),A.goToOption(gd.Specific,t)}}),T=$a(()=>{y({type:0}),g.current=!0}),O=$a(()=>{y({type:1}),g.current=!1}),N=$a((e,t,s)=>(g.current=!1,e===gd.Specific?y({type:2,focus:gd.Specific,id:t,trigger:s}):y({type:2,focus:e,trigger:s}))),P=$a((e,t)=>(y({type:3,id:e,dataRef:t}),()=>y({type:4,id:e}))),L=$a(e=>(y({type:5,id:e}),()=>y({type:5,id:null}))),I=$a(e=>wa(j.mode,{0:()=>null==h?void 0:h(e),1(){let t=j.value.slice(),s=t.findIndex(t=>_(t,e));return-1===s?t.push(e):t.splice(s,1),null==h?void 0:h(t)}})),A=(0,d.useMemo)(()=>({onChange:I,registerOption:P,registerLabel:L,goToOption:N,closeCombobox:O,openCombobox:T,selectActiveOption:R,selectOption:C}),[]),M=null===t?{}:{ref:t},D=(0,d.useRef)(null),F=Ja();return(0,d.useEffect)(()=>{!D.current||void 0!==r&&F.addEventListener(D.current,"reset",()=>{I(r)})},[D,I]),d.createElement(bu.Provider,{value:A},d.createElement(wu.Provider,{value:j},d.createElement(Aa,{value:wa(j.comboboxState,{0:La.Open,1:La.Closed})},null!=o&&null!=m&&Nd({[o]:m}).map(([e,t],s)=>d.createElement(Od,{features:Td.Hidden,ref:0===s?e=>{var t;D.current=null!=(t=null==e?void 0:e.closest("form"))?t:null}:void 0,...Oa({key:e,as:"input",type:"hidden",hidden:!0,readOnly:!0,name:e,value:t})})),ka({ourProps:M,theirProps:p,slot:k,defaultTag:Eu,name:"Combobox"}))))}),ku=Ta(function(e,t){var s,r,n,o;let a=Fi(),{id:i=`headlessui-combobox-input-${a}`,onChange:l,displayValue:c,type:u="text",...p}=e,m=Su("Combobox.Input"),h=xu("Combobox.Input"),f=Va(m.inputRef,t),y=(0,d.useRef)(!1),g=Ja(),v=function(){var e;return"function"==typeof c&&void 0!==m.value?null!=(e=c(m.value))?e:"":"string"==typeof m.value?m.value:""}();pu(([e,t],[s,r])=>{y.current||!m.inputRef.current||(0===r&&1===t||e!==s)&&(m.inputRef.current.value=e)},[v,m.comboboxState]),pu(([e],[t])=>{if(0===e&&1===t){let e=m.inputRef.current;if(!e)return;let t=e.value,{selectionStart:s,selectionEnd:r,selectionDirection:n}=e;e.value="",e.value=t,null!==n?e.setSelectionRange(s,r,n):e.setSelectionRange(s,r)}},[m.comboboxState]);let b=(0,d.useRef)(!1),x=$a(()=>{b.current=!0}),w=$a(()=>{setTimeout(()=>{b.current=!1})}),S=$a(e=>{switch(y.current=!0,e.key){case zi.Backspace:case zi.Delete:if(0!==m.mode||!m.nullable)return;let t=e.currentTarget;g.requestAnimationFrame(()=>{""===t.value&&(h.onChange(null),m.optionsRef.current&&(m.optionsRef.current.scrollTop=0),h.goToOption(gd.Nothing))});break;case zi.Enter:if(y.current=!1,0!==m.comboboxState||b.current)return;if(e.preventDefault(),e.stopPropagation(),null===m.activeOptionIndex)return void h.closeCombobox();h.selectActiveOption(),0===m.mode&&h.closeCombobox();break;case zi.ArrowDown:return y.current=!1,e.preventDefault(),e.stopPropagation(),wa(m.comboboxState,{0:()=>{h.goToOption(gd.Next)},1:()=>{h.openCombobox()}});case zi.ArrowUp:return y.current=!1,e.preventDefault(),e.stopPropagation(),wa(m.comboboxState,{0:()=>{h.goToOption(gd.Previous)},1:()=>{h.openCombobox(),g.nextFrame(()=>{m.value||h.goToOption(gd.Last)})}});case zi.Home:if(e.shiftKey)break;return y.current=!1,e.preventDefault(),e.stopPropagation(),h.goToOption(gd.First);case zi.PageUp:return y.current=!1,e.preventDefault(),e.stopPropagation(),h.goToOption(gd.First);case zi.End:if(e.shiftKey)break;return y.current=!1,e.preventDefault(),e.stopPropagation(),h.goToOption(gd.Last);case zi.PageDown:return y.current=!1,e.preventDefault(),e.stopPropagation(),h.goToOption(gd.Last);case zi.Escape:return y.current=!1,0!==m.comboboxState?void 0:(e.preventDefault(),m.optionsRef.current&&!m.optionsPropsRef.current.static&&e.stopPropagation(),h.closeCombobox());case zi.Tab:if(y.current=!1,0!==m.comboboxState)return;0===m.mode&&h.selectActiveOption(),h.closeCombobox()}}),_=$a(e=>{h.openCombobox(),null==l||l(e)}),E=$a(()=>{y.current=!1}),j=yd(()=>{if(m.labelId)return[m.labelId].join(" ")},[m.labelId]),k=(0,d.useMemo)(()=>({open:0===m.comboboxState,disabled:m.disabled}),[m]);return ka({ourProps:{ref:f,id:i,role:"combobox",type:u,"aria-controls":null==(s=m.optionsRef.current)?void 0:s.id,"aria-expanded":m.disabled?void 0:0===m.comboboxState,"aria-activedescendant":null===m.activeOptionIndex||null==(r=m.options[m.activeOptionIndex])?void 0:r.id,"aria-multiselectable":1===m.mode||void 0,"aria-labelledby":j,"aria-autocomplete":"list",defaultValue:null!=(o=null!=(n=e.defaultValue)?n:void 0!==m.defaultValue?null==c?void 0:c(m.defaultValue):null)?o:m.defaultValue,disabled:m.disabled,onCompositionStart:x,onCompositionEnd:w,onKeyDown:S,onChange:_,onBlur:E},theirProps:p,slot:k,defaultTag:"input",name:"Combobox.Input"})}),Cu=Ta(function(e,t){var s;let r=Su("Combobox.Button"),n=xu("Combobox.Button"),o=Va(r.buttonRef,t),a=Fi(),{id:i=`headlessui-combobox-button-${a}`,...l}=e,c=Ja(),u=$a(e=>{switch(e.key){case zi.ArrowDown:return e.preventDefault(),e.stopPropagation(),1===r.comboboxState&&n.openCombobox(),c.nextFrame(()=>{var e;return null==(e=r.inputRef.current)?void 0:e.focus({preventScroll:!0})});case zi.ArrowUp:return e.preventDefault(),e.stopPropagation(),1===r.comboboxState&&(n.openCombobox(),c.nextFrame(()=>{r.value||n.goToOption(gd.Last)})),c.nextFrame(()=>{var e;return null==(e=r.inputRef.current)?void 0:e.focus({preventScroll:!0})});case zi.Escape:return 0!==r.comboboxState?void 0:(e.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&e.stopPropagation(),n.closeCombobox(),c.nextFrame(()=>{var e;return null==(e=r.inputRef.current)?void 0:e.focus({preventScroll:!0})}));default:return}}),p=$a(e=>{if(Ui(e.currentTarget))return e.preventDefault();0===r.comboboxState?n.closeCombobox():(e.preventDefault(),n.openCombobox()),c.nextFrame(()=>{var e;return null==(e=r.inputRef.current)?void 0:e.focus({preventScroll:!0})})}),m=yd(()=>{if(r.labelId)return[r.labelId,i].join(" ")},[r.labelId,i]),h=(0,d.useMemo)(()=>({open:0===r.comboboxState,disabled:r.disabled,value:r.value}),[r]);return ka({ourProps:{ref:o,id:i,type:qi(e,r.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":null==(s=r.optionsRef.current)?void 0:s.id,"aria-expanded":r.disabled?void 0:0===r.comboboxState,"aria-labelledby":m,disabled:r.disabled,onClick:p,onKeyDown:u},theirProps:l,slot:h,defaultTag:"button",name:"Combobox.Button"})}),Ru=Ta(function(e,t){let s=Fi(),{id:r=`headlessui-combobox-label-${s}`,...n}=e,o=Su("Combobox.Label"),a=xu("Combobox.Label"),i=Va(o.labelRef,t);za(()=>a.registerLabel(r),[r]);let l=$a(()=>{var e;return null==(e=o.inputRef.current)?void 0:e.focus({preventScroll:!0})}),c=(0,d.useMemo)(()=>({open:0===o.comboboxState,disabled:o.disabled}),[o]);return ka({ourProps:{ref:i,id:r,onClick:l},theirProps:n,slot:c,defaultTag:"label",name:"Combobox.Label"})}),Tu=Ea.RenderStrategy|Ea.Static,Ou=Ta(function(e,t){let s=Fi(),{id:r=`headlessui-combobox-options-${s}`,hold:n=!1,...o}=e,a=Su("Combobox.Options"),i=Va(a.optionsRef,t),l=Ia(),c=null!==l?l===La.Open:0===a.comboboxState;za(()=>{var t;a.optionsPropsRef.current.static=null!=(t=e.static)&&t},[a.optionsPropsRef,e.static]),za(()=>{a.optionsPropsRef.current.hold=n},[a.optionsPropsRef,n]),function({container:e,accept:t,walk:s,enabled:r=!0}){let n=(0,d.useRef)(t),o=(0,d.useRef)(s);(0,d.useEffect)(()=>{n.current=t,o.current=s},[t,s]),za(()=>{if(!e||!r)return;let t=$i(e);if(!t)return;let s=n.current,a=o.current,i=Object.assign(e=>s(e),{acceptNode:s}),l=t.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,i,!1);for(;l.nextNode();)a(l.currentNode)},[e,r,n,o])}({container:a.optionsRef.current,enabled:0===a.comboboxState,accept:e=>"option"===e.getAttribute("role")?NodeFilter.FILTER_REJECT:e.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT,walk(e){e.setAttribute("role","none")}});let u=yd(()=>{var e,t;return null!=(t=a.labelId)?t:null==(e=a.buttonRef.current)?void 0:e.id},[a.labelId,a.buttonRef.current]);return ka({ourProps:{"aria-labelledby":u,role:"listbox",id:r,ref:i},theirProps:o,slot:(0,d.useMemo)(()=>({open:0===a.comboboxState}),[a]),defaultTag:"ul",features:Tu,visible:c,name:"Combobox.Options"})}),Nu=Ta(function(e,t){var s,r;let n=Fi(),{id:o=`headlessui-combobox-option-${n}`,disabled:a=!1,value:i,...l}=e,c=Su("Combobox.Option"),u=xu("Combobox.Option"),p=null!==c.activeOptionIndex&&c.options[c.activeOptionIndex].id===o,m=c.isSelected(i),h=(0,d.useRef)(null),f=Ba({disabled:a,value:i,domRef:h,textValue:null==(r=null==(s=h.current)?void 0:s.textContent)?void 0:r.toLowerCase()}),y=Va(t,h),g=$a(()=>u.selectOption(o));za(()=>u.registerOption(o,f),[f,o]);let v=(0,d.useRef)(!c.__demoMode);za(()=>{if(!c.__demoMode)return;let e=Ga();return e.requestAnimationFrame(()=>{v.current=!0}),e.dispose},[]),za(()=>{if(0!==c.comboboxState||!p||!v.current||0===c.activationTrigger)return;let e=Ga();return e.requestAnimationFrame(()=>{var e,t;null==(t=null==(e=h.current)?void 0:e.scrollIntoView)||t.call(e,{block:"nearest"})}),e.dispose},[h,p,c.comboboxState,c.activationTrigger,c.activeOptionIndex]);let b=$a(e=>{if(a)return e.preventDefault();g(),0===c.mode&&u.closeCombobox()}),x=$a(()=>{if(a)return u.goToOption(gd.Nothing);u.goToOption(gd.Specific,o)}),w=Md(),S=$a(e=>w.update(e)),_=$a(e=>{!w.wasMoved(e)||a||p||u.goToOption(gd.Specific,o,0)}),E=$a(e=>{!w.wasMoved(e)||a||!p||c.optionsPropsRef.current.hold||u.goToOption(gd.Nothing)}),j=(0,d.useMemo)(()=>({active:p,selected:m,disabled:a}),[p,m,a]);return ka({ourProps:{id:o,ref:y,role:"option",tabIndex:!0===a?void 0:-1,"aria-disabled":!0===a||void 0,"aria-selected":m,disabled:void 0,onClick:b,onFocus:x,onPointerEnter:S,onMouseEnter:S,onPointerMove:_,onMouseMove:_,onPointerLeave:E,onMouseLeave:E},theirProps:l,slot:j,defaultTag:"li",name:"Combobox.Option"})}),Pu=Object.assign(ju,{Input:ku,Button:Cu,Label:Ru,Options:Ou,Option:Nu});function Lu(e){return e&&e.label?e.label:null}function Iu({id:e,value:t=null,label:s="",onChange:r,onQueryChange:n=null,options:o,placeholder:i=(0,Wt.__)("Select an option","wordpress-seo"),isLoading:l=!1}){const[c,d]=(0,a.useState)(o),[u,p]=(0,a.useState)(""),m=(0,a.useCallback)(e=>{p(e.target.value)},[p]),h=(0,a.useCallback)(()=>{p("")},[p]);(0,a.useEffect)(()=>{d(o)},[o]),(0,a.useEffect)(()=>{n?n(u):d(o.filter(e=>e.label.toLowerCase().includes(u.toLowerCase())))},[u,n]);const f=(0,a.useCallback)((e,t)=>({selected:s,active:r})=>Fl({selected:s||e===t,active:r}),[Fl]),y=(0,a.useCallback)(e=>t=>{e&&t.stopPropagation()},[]);return(0,Qt.jsx)(Pu,{id:e,as:"div",value:t,onChange:r,onBlur:h,children:({open:r})=>(0,Qt.jsxs)(a.Fragment,{children:[s&&(0,Qt.jsx)(Pu.Label,{className:"yst-block yst-mb-2 yst-max-w-sm yst-text-sm yst-font-medium yst-text-slate-800",children:s}),(0,Qt.jsxs)("div",{className:"yst-h-[40px] yst-max-w-sm yst-relative",children:[(0,Qt.jsxs)(Pu.Button,{"data-id":`button-${e}`,role:"button",className:"yst-w-full yst-h-full yst-rounded-md yst-border yst-border-slate-300 yst-flex yst-items-center yst-rounded-r-md yst-ps-3 yst-pe-2 focus-within:yst-border-primary-500 focus-within:yst-outline-none focus-within:yst-ring-1 focus-within:yst-ring-primary-500",as:"div",children:[(0,Qt.jsx)(Pu.Input,{"data-id":`input-${e}`,className:"yst-w-full yst-text-slate-700 yst-rounded-md yst-border-0 yst-outline-none yst-bg-white yst-py-1 yst-ps-0 yst-pe-10 yst-shadow-none sm:yst-text-sm",onChange:m,displayValue:Lu,placeholder:i,onClick:y(r)}),(0,Qt.jsx)(ru(),{className:"yst-h-5 yst-w-5 yst-text-slate-400 yst-inset-y-0 yst-end-0","aria-hidden":"true"})]}),c.length>0&&(0,Qt.jsxs)(Pu.Options,{className:"yst-absolute yst-z-10 yst-mt-1 yst-max-h-60 yst-w-full yst-overflow-auto yst-rounded-md yst-bg-white yst-text-base yst-shadow-lg yst-ring-1 yst-ring-black yst-ring-opacity-5 focus:yst-outline-none sm:yst-text-sm",children:[l&&(0,Qt.jsxs)("div",{className:"yst-flex yst-bg-white yst-sticky yst-z-20 yst-text-sm yst-italic yst-top-0 yst-py-2 yst-ps-3 yst-pe-9 yst-my-0",children:[(0,Qt.jsx)(cu,{className:"yst-text-primary-500 yst-h-4 yst-w-4 yst-me-2 yst-self-center"}),(0,Wt.__)("Loading…","wordpress-seo")]}),c.map(e=>(0,Qt.jsx)(Pu.Option,{value:e,className:f(e.value,t.value),children:({selected:s})=>(0,Qt.jsxs)(Qt.Fragment,{children:[(0,Qt.jsx)("span",{className:Is()("yst-block yst-truncate",(s||t.value===e.value)&&"yst-font-semibold"),children:e.label}),(s||t.value===e.value)&&(0,Qt.jsx)("span",{className:"yst-absolute yst-inset-y-0 yst-end-0 yst-flex yst-items-center yst-pe-4 yst-text-white",children:(0,Qt.jsx)(mc(),{className:"yst-h-5 yst-w-5","aria-hidden":"true"})})]})},`yst-option-${e.value}`))]})]})]})})}Iu.propTypes={onChange:Jt().func.isRequired,options:Jt().array.isRequired,id:Jt().string.isRequired,value:Jt().shape({value:Jt().number,label:Jt().string}),label:Jt().string,onQueryChange:Jt().func,placeholder:Jt().string,isLoading:Jt().bool};const Au={"X-WP-NONCE":wpApiSettings.nonce},Mu=wpApiSettings.root;function Du({initialValue:e={id:0,name:""},onChangeCallback:t=c.noop,placeholder:s=(0,Wt.__)("Select a user","wordpress-seo")}){const[r,n]=(0,a.useState)([]),[o,i]=(0,a.useState)({value:e.id,label:e.name}),[l,d]=(0,a.useState)(!1),u=(0,a.useRef)(!0);(0,a.useEffect)(()=>()=>{u.current=!1},[]);const p=(0,a.useCallback)(e=>{i(e),t(e)}),m=(0,a.useCallback)((0,c.debounce)(async e=>{d(!0);const t=await function(e=""){const t=`${Mu}wp/v2/users?per_page=20${e?`&search=${encodeURIComponent(e)}`:""}`;return(0,od.sendRequest)(t,{method:"GET",headers:Au})}(e);u.current&&(d(!1),n(t.map(e=>({value:e.id,label:e.name}))))},500),[]);return(0,Qt.jsx)(Iu,{id:"yoast-configuration-user-select",value:o,label:(0,Wt.__)("Name","wordpress-seo"),onChange:p,onQueryChange:m,options:r,placeholder:s,isLoading:l})}function Fu({dispatch:e,imageUrl:t="",fallbackImageUrl:s="",person:r={id:0,name:""},canEditUser:n}){const o=(0,a.useCallback)(()=>{ou(t=>{e({type:"SET_PERSON_LOGO",payload:{...t}})})},[ou]),i=(0,a.useCallback)(()=>{e({type:"REMOVE_PERSON_LOGO"})},[e]),l=(0,a.useCallback)(t=>{e({type:"SET_PERSON",payload:t}),Dn()({path:`yoast/v1/configuration/check_capability?user_id=${t.value}`}).then(t=>{e({type:"SET_CAN_EDIT_USER",payload:t.success})}).catch(e=>{console.error(e.message)})},[e]),c=(0,Wt.__)("You have selected the user %1$s as the person this site represents. This user profile information will now be used in search results. %2$sUpdate this profile to make sure the information is correct%3$s.","wordpress-seo"),d=(0,Wt.__)("You have selected the user %1$s as the person this site represents. This user profile information will now be used in search results. You're not allowed to update this user profile, so please ask this user or an admin to make sure the information is correct.","wordpress-seo"),u=(0,a.useMemo)(()=>Vt((0,Wt.sprintf)(n?c:d,`<b>${r.name}</b>`,"<a>","</a>"),{b:(0,Qt.jsx)("b",{}),a:(0,Qt.jsx)("a",{id:"yoast-configuration-user-selector-user-link",href:window.wpseoScriptData.userEditUrl.replace("{user_id}",r.id),target:"_blank",rel:"noopener noreferrer"})}),[r.id,r.name,n]);return(0,Qt.jsxs)(a.Fragment,{children:[(0,Qt.jsx)(Du,{initialValue:r,onChangeCallback:l,name:"person_id",placeholder:(0,Wt.__)("Select a user","wordpress-seo")}),(0,Qt.jsx)(lc,{id:"user-representation-alert",isVisible:0!==r.id,type:"info",className:"yst-mt-5",children:u}),(0,Qt.jsx)(du,{className:"yst-mt-6",id:"person-logo-input",url:t,fallbackUrl:s,onSelectImageClick:o,onRemoveImageClick:i,imageAltText:"",hasPreview:!0,label:(0,Wt.__)("Personal logo or avatar","wordpress-seo")})]})}function zu({onOrganizationOrPersonChange:e,dispatch:t,state:s,siteRepresentationEmpty:r}){const[n,o]=(0,a.useState)("emptyChoice"===s.companyOrPerson?"yst-opacity-0":"yst-opacity-100"),i=(0,a.useCallback)(()=>{o("yst-opacity-100")},[o]),l=(0,a.useCallback)(e=>{t({type:"CHANGE_WEBSITE_NAME",payload:e.target.value})},[t]),c=Vt((0,Wt.sprintf)( |