/
home
/
techb158
/
public_html
/
wp-content
/
plugins
/
wordpress-seo
/
js
/
dist
/
/home/techb158/public_html/wp-content/plugins/wordpress-seo/js/dist
mkdir
upload
Name
Size
Mode
Actions
externals/
-
0755
rm
languages/
-
0755
rm
academy.js
18703
0644
edit
dl
rm
addon-installation.js
4159
0644
edit
dl
rm
admin-global.js
6216
0644
edit
dl
rm
admin-modules.js
29826
0644
edit
dl
rm
ai-consent.js
24905
0644
edit
dl
rm
ai-content-planner.js
221499
0644
edit
dl
rm
ai-generator.js
117063
0644
edit
dl
rm
analysis-worker.js
617
0644
edit
dl
rm
api-client.js
579
0644
edit
dl
rm
block-editor.js
398256
0644
edit
dl
rm
bulk-editor-page.js
167719
0644
edit
dl
rm
classic-editor.js
150614
0644
edit
dl
rm
crawl-settings.js
571
0644
edit
dl
rm
dashboard-widget.js
2033
0644
edit
dl
rm
dynamic-blocks.js
1039
0644
edit
dl
rm
edit-page.js
545
0644
edit
dl
rm
editor-modules.js
156972
0644
edit
dl
rm
elementor-v4.js
5803
0644
edit
dl
rm
elementor.js
218215
0644
edit
dl
rm
externals-components.js
170805
0644
edit
dl
rm
externals-contexts.js
823
0644
edit
dl
rm
externals-redux.js
59922
0644
edit
dl
rm
faq-block.js
53655
0644
edit
dl
rm
filter-explanation.js
200
0644
edit
dl
rm
frontend-inspector-resources.js
3883
0644
edit
dl
rm
general-page.js
329351
0644
edit
dl
rm
help-scout-beacon.js
4942
0644
edit
dl
rm
how-to-block.js
64329
0644
edit
dl
rm
import.js
6024
0644
edit
dl
rm
indexation.js
7840
0644
edit
dl
rm
installation-success.js
6955
0644
edit
dl
rm
integrations-page.js
194708
0644
edit
dl
rm
introductions.js
32784
0644
edit
dl
rm
network-admin.js
2309
0644
edit
dl
rm
new-settings.js
509591
0644
edit
dl
rm
plans.js
42929
0644
edit
dl
rm
post-edit.js
109428
0644
edit
dl
rm
quick-edit-handler.js
949
0644
edit
dl
rm
redirect-old-features-tab.js
237
0644
edit
dl
rm
redirects.js
78337
0644
edit
dl
rm
reindex-links.js
2778
0644
edit
dl
rm
settings.js
10365
0644
edit
dl
rm
support.js
39934
0644
edit
dl
rm
term-edit.js
65362
0644
edit
dl
rm
used-keywords-assessment.js
782
0644
edit
dl
rm
wincher-dashboard-widget.js
20664
0644
edit
dl
rm
workouts.js
39124
0644
edit
dl
rm
Edit:
/home/techb158/public_html/wp-content/plugins/wordpress-seo/js/dist/ai-generator.js
(117063B)
(()=>{var e={818(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{fillRule:"evenodd",d:"M12.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-2.293-2.293a1 1 0 010-1.414z",clipRule:"evenodd"}))});e.exports=i},1609(e){"use strict";e.exports=window.React},2485(e,t){var s;!function(){"use strict";var r={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var s=arguments[t];if(s){var o=typeof s;if("string"===o||"number"===o)e.push(s);else if(Array.isArray(s)){if(s.length){var n=i.apply(null,s);n&&e.push(n)}}else if("object"===o){if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]")){e.push(s.toString());continue}for(var a in s)r.call(s,a)&&s[a]&&e.push(a)}}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(s=function(){return i}.apply(t,[]))||(e.exports=s)}()},2514(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8 11V7a4 4 0 118 0m-4 8v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2z"}))});e.exports=i},2863(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3a1 1 0 00-.867.5 1 1 0 11-1.731-1A3 3 0 0113 8a3.001 3.001 0 01-2 2.83V11a1 1 0 11-2 0v-1a1 1 0 011-1 1 1 0 100-2zm0 8a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"}))});e.exports=i},3473(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 8l4 4m0 0l-4 4m4-4H3"}))});e.exports=i},5074(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"}))});e.exports=i},5687(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{fillRule:"evenodd",d:"M10.293 5.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L12.586 11H5a1 1 0 110-2h7.586l-2.293-2.293a1 1 0 010-1.414z",clipRule:"evenodd"}))});e.exports=i},6702(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"}))});e.exports=i},7219(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"}))});e.exports=i},8738(e,t,s){const r=s(1609),i=r.forwardRef(function(e,t){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",ref:t},e),r.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"}))});e.exports=i}},t={};function s(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={exports:{}};return e[r](o,o.exports,s),o.exports}s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.components,t=window.wp.data,r=window.wp.hooks,i=window.yoast.uiLibrary,o=window.lodash,n=window.yoast.reduxJsToolkit,a="adminUrl",l=(0,n.createSlice)({name:a,initialState:"",reducers:{setAdminUrl:(e,{payload:t})=>t}}),c=(l.getInitialState,{selectAdminUrl:e=>(0,o.get)(e,a,"")});c.selectAdminLink=(0,n.createSelector)([c.selectAdminUrl,(e,t)=>t],(e,t="")=>{try{return new URL(t,e).href}catch(t){return e}}),l.actions,l.reducer;const d="replacementVariables",u=(0,n.createSlice)({name:d,initialState:(p={},{recommended:(0,o.get)(p,"recommended",{}),shared:(0,o.get)(p,"shared",[]),specific:(0,o.get)(p,"specific",{}),variables:(0,o.get)(p,"variables",[])}),reducers:{}});var p;const m=(0,n.createSelector)([e=>(0,o.get)(e,[d,"shared"],[]),e=>(0,o.get)(e,[d,"specific"],{}),(e,t)=>t,(e,t,s)=>s],(e,t,s,r)=>[...e,...(0,o.get)(t,s,(0,o.get)(t,r,[]))]),h=((0,n.createSelector)([e=>(0,o.get)(e,[d,"variables"],[]),m],(e,t)=>(0,o.filter)(e,({name:e})=>(0,o.includes)(t,e))),(0,n.createSelector)([e=>(0,o.get)(e,[d,"recommended"],{}),(e,t)=>t,(e,t,s)=>s],(e,t,s)=>(0,o.get)(e,t,(0,o.get)(e,s,[]))),u.actions,u.reducer,window.wp.apiFetch);var g=s.n(h);const y="hasConsent",x=`${y}/storeConsent`,w=(0,n.createSlice)({name:y,initialState:{hasConsent:!1,endpoint:""},reducers:{giveAiGeneratorConsent:(e,{payload:t})=>{e.hasConsent=t},setAiGeneratorConsentEndpoint:(e,{payload:t})=>{e.endpoint=t}}}),f=w.getInitialState,v={selectHasAiGeneratorConsent:e=>(0,o.get)(e,[y,"hasConsent"],w.getInitialState().hasConsent),selectAiGeneratorConsentEndpoint:e=>(0,o.get)(e,[y,"endpoint"],w.getInitialState().endpoint)},b={...w.actions,storeAiGeneratorConsent:function*(e,t){try{yield{type:x,payload:{consent:e,endpoint:t}}}catch(e){return!1}return yield{type:`${y}/giveAiGeneratorConsent`,payload:e},!0}},S={[x]:async({payload:e})=>await g()({path:e.endpoint,method:"POST",data:{consent:e.consent},parse:!1})},j=w.reducer,C=window.wp.url,k="linkParams",_=(0,n.createSlice)({name:k,initialState:{},reducers:{setLinkParams:(e,{payload:t})=>t}}),E=(_.getInitialState,{selectLinkParam:(e,t,s={})=>(0,o.get)(e,`${k}.${t}`,s),selectLinkParams:e=>(0,o.get)(e,k,{})});E.selectLink=(0,n.createSelector)([E.selectLinkParams,(e,t)=>t,(e,t,s={})=>s],(e,t,s)=>(0,C.addQueryArgs)(t,{...e,...s})),_.actions,_.reducer;const R="myyoastConnection",I=(0,n.createSlice)({name:R,initialState:{isAvailable:!1,canConnect:!1,connectUrl:null,learnMoreUrl:""},reducers:{}}),L=I.getInitialState,T=e=>({isAvailable:Boolean(e)&&(0,o.get)(e,"isProvisioned",!1),canConnect:(0,o.get)(e,"canConnect",!1),connectUrl:(0,o.get)(e,"connectUrl",null),learnMoreUrl:(0,o.get)(e,"learnMoreUrl","")}),A={selectMyyoastConnection:e=>(0,o.get)(e,R,L())},M=I.actions,P=I.reducer,N=(0,n.createSlice)({name:"notifications",initialState:{},reducers:{addNotification:{reducer:(e,{payload:t})=>{e[t.id]={id:t.id,variant:t.variant,size:t.size,title:t.title,description:t.description}},prepare:({id:e,variant:t="info",size:s="default",title:r,description:i})=>({payload:{id:e||(0,n.nanoid)(),variant:t,size:s,title:r||"",description:i}})},removeNotification:(e,{payload:t})=>(0,o.omit)(e,t)}}),O=(N.getInitialState,N.actions,N.reducer,"request"),$="success",F="error",U="idle",q="loading",W="success",B="error",G="showPlay",D="askPermission",H="isPlaying",z=(0,n.createSlice)({name:"optInNotification",initialState:{seen:{}},reducers:{hideOptInNotification(e,t){const s=t.payload;e.seen[s]=!0}}}),Y=(z.getInitialState,z.actions,z.reducer,"pluginUrl"),V=(0,n.createSlice)({name:Y,initialState:"",reducers:{setPluginUrl:(e,{payload:t})=>t}}),K=(V.getInitialState,{selectPluginUrl:e=>(0,o.get)(e,Y,"")});K.selectImageLink=(0,n.createSelector)([K.selectPluginUrl,(e,t,s="images")=>s,(e,t)=>t],(e,t,s)=>[(0,o.trimEnd)(e,"/"),(0,o.trim)(t,"/"),(0,o.trimStart)(s,"/")].join("/")),V.actions,V.reducer;const Z="wistiaEmbedPermission",X=(0,n.createSlice)({name:Z,initialState:{value:!1,status:U,error:{}},reducers:{setWistiaEmbedPermissionValue:(e,{payload:t})=>{e.value=Boolean(t)}},extraReducers:e=>{e.addCase(`${Z}/${O}`,e=>{e.status=q}),e.addCase(`${Z}/${$}`,(e,{payload:t})=>{e.status=W,e.value=Boolean(t&&t.value)}),e.addCase(`${Z}/${F}`,(e,{payload:t})=>{e.status=B,e.value=Boolean(t&&t.value),e.error={code:(0,o.get)(t,"error.code",500),message:(0,o.get)(t,"error.message","Unknown")}})}});var J;X.getInitialState,X.actions,X.reducer;const Q=(0,n.createSlice)({name:"documentTitle",initialState:(0,o.defaultTo)(null===(J=document)||void 0===J?void 0:J.title,""),reducers:{setDocumentTitle:(e,{payload:t})=>t}}),ee=(Q.getInitialState,Q.actions,Q.reducer,window.yoast.propTypes);var te=s.n(ee);const se="yoast-seo/ai-generator",re="yoast-seo/editor",ie="google",oe="social",ne="twitter",ae="title",le="description",ce="post",de="term",ue={post:"title",term:"term_title"},pe=(0,o.mapValues)(ue,e=>`%%${e}%%`),me={idle:"idle",loading:"loading",success:"success",error:"error"},he="success",ge="error",ye="abort",xe=window.wp.i18n,we=window.wp.element,fe=(e,t)=>{try{return(0,we.createInterpolateElement)(e,t)}catch(t){return console.error("Error in translation for:",e,t),e}};var ve=s(6702),be=s.n(ve);const Se=window.ReactJSXRuntime;te().string.isRequired;var je=s(2514),Ce=s.n(je),ke=s(818),_e=s.n(ke);te().string.isRequired,te().string.isRequired,te().shape({src:te().string.isRequired,width:te().string,height:te().string}).isRequired,te().shape({value:te().bool.isRequired,status:te().string.isRequired,set:te().func.isRequired}).isRequired,te().string,te().string,te().string;const Ee=({handleRefreshClick:e,supportLink:t})=>(0,Se.jsxs)("div",{className:"yst-flex yst-gap-2",children:[(0,Se.jsx)(i.Button,{onClick:e,children:(0,xe.__)("Refresh this page","wordpress-seo")}),(0,Se.jsx)(i.Button,{variant:"secondary",as:"a",href:t,target:"_blank",rel:"noopener",children:(0,xe.__)("Contact support","wordpress-seo")})]});Ee.propTypes={handleRefreshClick:te().func.isRequired,supportLink:te().string.isRequired};const Re=({handleRefreshClick:e,supportLink:t})=>(0,Se.jsxs)("div",{className:"yst-grid yst-grid-cols-1 yst-gap-y-2",children:[(0,Se.jsx)(i.Button,{className:"yst-order-last",onClick:e,children:(0,xe.__)("Refresh this page","wordpress-seo")}),(0,Se.jsx)(i.Button,{variant:"secondary",as:"a",href:t,target:"_blank",rel:"noopener",children:(0,xe.__)("Contact support","wordpress-seo")})]});Re.propTypes={handleRefreshClick:te().func.isRequired,supportLink:te().string.isRequired};const Ie=({error:e,children:t=null})=>(0,Se.jsxs)("div",{role:"alert",className:"yst-max-w-screen-sm yst-p-8 yst-space-y-4",children:[(0,Se.jsx)(i.Title,{children:(0,xe.__)("Something went wrong. An unexpected error occurred.","wordpress-seo")}),(0,Se.jsx)("p",{children:(0,xe.__)("We're very sorry, but it seems like the following error has interrupted our application:","wordpress-seo")}),(0,Se.jsx)(i.Alert,{variant:"error",children:(null==e?void 0:e.message)||(0,xe.__)("Undefined error message.","wordpress-seo")}),(0,Se.jsx)("p",{children:(0,xe.__)("Unfortunately, this means that any unsaved changes in this section will be lost. You can try and refresh this page to resolve the problem. If this error still occurs, please get in touch with our support team, and we'll get you all the help you need!","wordpress-seo")}),t]});Ie.propTypes={error:te().object.isRequired,children:te().node},Ie.VerticalButtons=Re,Ie.HorizontalButtons=Ee;te().string,te().node.isRequired,te().node.isRequired,te().node,te().oneOf(Object.keys({lg:{grid:"yst-grid lg:yst-grid-cols-3 lg:yst-gap-12",col1:"yst-col-span-1",col2:"lg:yst-mt-0 lg:yst-col-span-2"},xl:{grid:"yst-grid xl:yst-grid-cols-3 xl:yst-gap-12",col1:"yst-col-span-1",col2:"xl:yst-mt-0 xl:yst-col-span-2"},"2xl":{grid:"yst-grid 2xl:yst-grid-cols-3 2xl:yst-gap-12",col1:"yst-col-span-1",col2:"2xl:yst-mt-0 2xl:yst-col-span-2"}}));var Le=s(1609),Te=s.n(Le);const Ae=window.ReactDOM;var Me,Pe,Ne;(Pe=Me||(Me={})).Pop="POP",Pe.Push="PUSH",Pe.Replace="REPLACE",function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(Ne||(Ne={})),new Set(["lazy","caseSensitive","path","id","index","children"]),Error;const Oe=["post","put","patch","delete"],$e=(new Set(Oe),["get",...Oe]);new Set($e),new Set([301,302,303,307,308]),new Set([307,308]),Symbol("deferred"),Le.Component,Le.startTransition,new Promise(()=>{}),Le.Component,new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);try{window.__reactRouterVersion="6"}catch(e){}var Fe,Ue,qe,We;new Map,Le.startTransition,Ae.flushSync,Le.useId,"undefined"!=typeof window&&void 0!==window.document&&window.document.createElement,(We=Fe||(Fe={})).UseScrollRestoration="useScrollRestoration",We.UseSubmit="useSubmit",We.UseSubmitFetcher="useSubmitFetcher",We.UseFetcher="useFetcher",We.useViewTransitionState="useViewTransitionState",(qe=Ue||(Ue={})).UseFetcher="useFetcher",qe.UseFetchers="useFetchers",qe.UseScrollRestoration="useScrollRestoration",te().string.isRequired,te().string;const Be=({href:e,children:t=null,...s})=>(0,Se.jsxs)(i.Link,{target:"_blank",rel:"noopener noreferrer",...s,href:e,children:[t,(0,Se.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */ (0,xe.__)("(Opens in a new browser tab)","wordpress-seo")})]});Be.propTypes={href:te().string.isRequired,children:te().node};s(8738);(0,xe.__)("Create optimized SEO titles & meta descriptions in seconds","wordpress-seo"),(0,xe.__)("Apply AI suggestions to improve content in 1 click","wordpress-seo"),(0,xe.__)("Manage redirects with ease and without extra plugins","wordpress-seo"),(0,xe.__)("Optimize pages for multiple keywords with guidance","wordpress-seo"),(0,xe.__)("Add product details to help your listings stand out","wordpress-seo"),(0,xe.__)("Make sure search engines show the right version of your product page","wordpress-seo"),(0,xe.__)("Create optimized SEO titles & meta descriptions with AI","wordpress-seo"),(0,xe.__)("Receive clear SEO and readability guidance to optimize your products","wordpress-seo"),(0,xe.__)("Generate SEO optimized metadata in seconds with AI","wordpress-seo"),(0,xe.__)("Make your articles visible, be seen in Google News","wordpress-seo"),(0,xe.__)("Built to get found by search, AI, and real users","wordpress-seo"),(0,xe.__)("Easy Local SEO. Show up in Google Maps results","wordpress-seo"),(0,xe.__)("Internal links and redirect management, easy","wordpress-seo"),(0,xe.__)("Access to friendly help when you need it, day or night","wordpress-seo");var Ge=s(2485),De=s.n(Ge);te().string.isRequired,te().object.isRequired,te().func.isRequired,te().bool.isRequired,s(3473),te().string.isRequired,te().object,te().func.isRequired,te().bool.isRequired,te().string.isRequired,te().object.isRequired,te().string.isRequired,te().func.isRequired,te().bool.isRequired;var He=s(5074),ze=s.n(He);te().bool.isRequired,te().func,te().func,te().string.isRequired,te().string.isRequired,te().string.isRequired,te().string.isRequired;const Ye=window.yoast.reactHelmet,Ve=({videoId:e,thumbnail:t,wistiaEmbedPermission:s,className:r=""})=>{const[o,n]=(0,we.useState)(s.value?H:G),a=(0,we.useCallback)(()=>n(H),[n]),l=(0,we.useCallback)(()=>{s.value?a():n(D)},[s.value,a,n]),c=(0,we.useCallback)(()=>n(G),[n]),d=(0,we.useCallback)(()=>{s.set(!0),a()},[s.set,a]);return(0,Se.jsxs)(Se.Fragment,{children:[s.value&&(0,Se.jsx)(Ye.Helmet,{children:(0,Se.jsx)("script",{src:"https://fast.wistia.com/assets/external/E-v1.js",async:!0})}),(0,Se.jsxs)("div",{className:De()("yst-relative yst-w-full yst-h-0 yst-pt-[47.25%] yst-overflow-hidden yst-rounded-md yst-drop-shadow-md yst-bg-white",r),children:[o===G&&(0,Se.jsx)("button",{type:"button",className:"yst-absolute yst-inset-0 yst-button yst-p-0 yst-border-none yst-bg-white yst-transition-opacity yst-duration-1000 yst-opacity-100",onClick:l,children:(0,Se.jsx)("img",{className:"yst-w-full yst-h-auto yst-object-contain",alt:"",loading:"lazy",decoding:"async",...t})}),o===D&&(0,Se.jsxs)("div",{className:"yst-absolute yst-inset-0 yst-flex yst-flex-col yst-items-center yst-justify-center yst-bg-white",children:[(0,Se.jsxs)("p",{className:"yst-max-w-xs yst-mx-auto yst-text-center",children:[s.status===q&&(0,Se.jsx)(i.Spinner,{}),s.status!==q&&(0,xe.sprintf)(/* translators: %1$s expands to Yoast SEO. %2$s expands to Wistia. */ /* translators: %1$s expands to Yoast SEO. %2$s expands to Wistia. */ (0,xe.__)("To see this video, you need to allow %1$s to load embedded videos from %2$s.","wordpress-seo"),"Yoast SEO","Wistia")]}),(0,Se.jsxs)("div",{className:"yst-flex yst-mt-6 yst-gap-x-4",children:[(0,Se.jsx)(i.Button,{type:"button",variant:"secondary",onClick:c,disabled:s.status===q,children:(0,xe.__)("Deny","wordpress-seo")}),(0,Se.jsx)(i.Button,{type:"button",variant:"primary",onClick:d,disabled:s.status===q,children:(0,xe.__)("Allow","wordpress-seo")})]})]}),s.value&&o===H&&(0,Se.jsxs)("div",{className:"yst-absolute yst-w-full yst-h-full yst-top-0 yst-right-0",children:[null===e&&(0,Se.jsx)(i.Spinner,{className:"yst-h-full yst-mx-auto"}),null!==e&&(0,Se.jsx)("div",{className:`wistia_embed wistia_async_${e} videoFoam=true`})]})]})]})};Ve.propTypes={videoId:te().string.isRequired,thumbnail:te().shape({src:te().string.isRequired,width:te().string,height:te().string}).isRequired,wistiaEmbedPermission:te().shape({value:te().bool.isRequired,status:te().string.isRequired,set:te().func.isRequired}).isRequired,hasPadding:te().bool},s(5687),te().bool.isRequired,te().func.isRequired,te().func,te().string;const Ke=({onGiveConsent:e,learnMoreLink:t,privacyPolicyLink:s,termsOfServiceLink:r,imageLink:o,linkStoreName:n})=>{const{onClose:a,initialFocus:l}=(0,i.useModalContext)(),[c,d]=(0,i.useToggleState)(!1),[u,p]=(0,we.useState)(!1),m=(0,we.useMemo)(()=>({src:o,width:"432",height:"244"}),[o]),h=fe((0,xe.sprintf)(/* translators: %1$s and %2$s are a set of anchor tags and %3$s and %4$s are a set of anchor tags. */ /* translators: %1$s and %2$s are a set of anchor tags and %3$s and %4$s are a set of anchor tags. */ (0,xe.__)("I approve the %1$sTerms of Service%2$s & %3$sPrivacy Policy%4$s of the Yoast AI service. This includes consenting to the collection and use of data to improve user experience.","wordpress-seo"),"<a1>","</a1>","<a2>","</a2>"),{a1:(0,Se.jsx)(Be,{href:r}),a2:(0,Se.jsx)(Be,{href:s})}),[g,y]=(0,i.useToggleState)(!1),x=(0,we.useCallback)(async()=>{y();const t=await e();p(!1===t),y()},[e]);return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)("div",{className:"yst-px-10 yst-pt-10 yst-introduction-gradient yst-text-center",children:(0,Se.jsx)("div",{className:"yst-relative yst-w-full",children:(0,Se.jsx)("img",{className:"yst-w-full yst-h-auto yst-rounded-md yst-drop-shadow-md",alt:"",loading:"lazy",decoding:"async",...m})})}),(0,Se.jsxs)("div",{className:"yst-px-10 yst-pb-4 yst-flex yst-flex-col yst-items-center",children:[(0,Se.jsxs)("div",{className:"yst-mt-4 yst-mx-1.5 yst-text-center",children:[(0,Se.jsx)("h3",{className:"yst-text-slate-900 yst-text-lg yst-font-medium",children:(0,xe.sprintf)(/* translators: %s expands to Yoast AI. */ /* translators: %s expands to Yoast AI. */ (0,xe.__)("Grant consent for %s","wordpress-seo"),"Yoast AI")}),(0,Se.jsx)("div",{className:"yst-mt-2 yst-text-slate-600 yst-text-sm",children:fe((0,xe.sprintf)(/* translators: %1$s is a break tag; %2$s and %3$s are anchor tag; %4$s is the arrow icon. */ /* translators: %1$s is a break tag; %2$s and %3$s are anchor tag; %4$s is the arrow icon. */ (0,xe.__)("Enable AI-powered SEO! Use all Yoast AI features to boost your efficiency. Just give us the green light. %1$s%2$sLearn more%3$s%4$s","wordpress-seo"),"<br/>","<a>","<ArrowNarrowRightIcon />","</a>"),{a:(0,Se.jsx)(Be,{href:t,className:"yst-inline-flex yst-items-center yst-gap-1 yst-no-underline yst-font-medium",variant:"primary"}),ArrowNarrowRightIcon:(0,Se.jsx)(_e(),{className:"yst-w-4 yst-h-4 rtl:yst-rotate-180"}),br:(0,Se.jsx)("br",{})})})]}),(0,Se.jsx)("div",{className:"yst-flex yst-w-full yst-mt-6",children:(0,Se.jsx)("hr",{className:"yst-w-full yst-text-gray-200"})}),(0,Se.jsxs)("div",{className:"yst-flex yst-items-start yst-mt-4",children:[(0,Se.jsx)("input",{type:"checkbox",id:"yst-ai-consent-checkbox",name:"yst-ai-consent-checkbox",checked:c,value:c?"true":"false",onChange:d,className:"yst-checkbox__input",ref:l}),(0,Se.jsx)("label",{htmlFor:"yst-ai-consent-checkbox",className:"yst-label yst-checkbox__label yst-text-xs yst-font-normal yst-text-slate-500",children:h})]}),u&&(0,Se.jsx)(st,{className:"yst-mt-3",linkStoreName:n}),(0,Se.jsx)("div",{className:"yst-w-full yst-flex yst-mt-4",children:(0,Se.jsxs)(i.Button,{as:"button",className:"yst-grow",size:"large",disabled:!c||u,onClick:x,children:[g&&!u&&(0,Se.jsx)(i.Spinner,{className:"yst-me-2"}),(0,xe.__)("Grant consent","wordpress-seo")]})}),(0,Se.jsx)(i.Button,{as:"button",className:"yst-mt-4",variant:"tertiary",onClick:a,children:(0,xe.__)("Close","wordpress-seo")})]})]})};Ke.propTypes={onGiveConsent:te().func.isRequired,learnMoreLink:te().string.isRequired,privacyPolicyLink:te().string.isRequired,termsOfServiceLink:te().string.isRequired,imageLink:te().string.isRequired,linkStoreName:te().string.isRequired};const Ze={termsOfService:"https://yoa.st/ai-generator-terms-of-service",privacyPolicy:"https://yoa.st/ai-generator-privacy-policy",learnMore:"https://yoa.st/ai-generator-learn-more"},Xe=({storeName:e,onConsentGranted:s,linkStoreName:r,links:i={}})=>{const o=(0,we.useMemo)(()=>({...Ze,...i}),[i]),{termsOfServiceLink:n,privacyPolicyLink:a,learnMoreLink:l,imageLink:c,endpoint:d}=(0,t.useSelect)(t=>{const s=t(r),i=t(e);return{termsOfServiceLink:s.selectLink(o.termsOfService),privacyPolicyLink:s.selectLink(o.privacyPolicy),learnMoreLink:s.selectLink(o.learnMore),imageLink:s.selectImageLink("ai-consent.jpg"),endpoint:i.selectAiGeneratorConsentEndpoint()}},[r,e,o]),{storeAiGeneratorConsent:u}=(0,t.useDispatch)(e),p=(0,we.useCallback)(async()=>{const e=await u(!0,d);return!1!==e&&s(),e},[u,s,d]);return(0,Se.jsx)(Ke,{termsOfServiceLink:n,privacyPolicyLink:a,learnMoreLink:l,imageLink:c,onGiveConsent:p,linkStoreName:r})};Xe.propTypes={storeName:te().string.isRequired,onConsentGranted:te().func.isRequired,linkStoreName:te().string.isRequired,links:te().shape({termsOfService:te().string,privacyPolicy:te().string,learnMore:te().string})};const Je=({children:e})=>(0,Se.jsx)("p",{className:"yst-mt-2",children:e});Je.propTypes={children:te().node.isRequired};const Qe=()=>(0,t.useSelect)(e=>{const t=e(re);return{commonErrorsLink:t.selectLink("https://yoa.st/ai-common-errors"),supportLink:t.selectAdminLink("?page=wpseo_page_support")}},[]),et=(0,xe.__)("Something went wrong","wordpress-seo"),tt=({linkStoreName:e=re})=>{const s=(0,t.useSelect)(t=>t(e).selectLink("https://yoa.st/ai-common-errors"),[e]),r=(0,t.useSelect)(t=>t(e).selectAdminLink("?page=wpseo_page_support"),[e]);return(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)(/* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */ /* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */ (0,xe.__)("Please try again later. If this issue persists, you can learn more about possible reasons for this error on our page about %1$scommon AI feature problems and errors%2$s. In case you need further help, please %3$scontact our support team%4$s.","wordpress-seo"),"<a1>","</a1>","<a2>","</a2>"),{a1:(0,Se.jsx)(Be,{variant:"error",href:s}),a2:(0,Se.jsx)(Be,{variant:"error",href:r})})})};tt.propTypes={linkStoreName:te().string};const st=({linkStoreName:e=re,className:t=""})=>(0,Se.jsxs)(i.Alert,{variant:"error",className:t,children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:et}),(0,Se.jsx)(tt,{linkStoreName:e})]});st.propTypes={linkStoreName:te().string,className:te().string};const rt=(0,xe.__)("Not enough content","wordpress-seo"),it=()=>{const{commonErrorsLink:e,supportLink:t}=Qe();return(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)(/* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */ /* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */ (0,xe.__)("Please add more content to ensure a valuable AI suggestion. Learn more on our page about %1$scommon AI feature problems and errors%2$s. In case you need further help, please %3$scontact our support team%4$s.","wordpress-seo"),"<a1>","</a1>","<a2>","</a2>"),{a1:(0,Se.jsx)(Be,{variant:"error",href:e}),a2:(0,Se.jsx)(Be,{variant:"error",href:t})})})},ot=()=>(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:rt}),(0,Se.jsx)(it,{})]}),nt=(0,xe.__)("SEO analysis required","wordpress-seo"),at=()=>{const e=(0,t.useSelect)(e=>e(re).selectAdminLink("?page=wpseo_page_settings#/site-features#card-wpseo-keyword_analysis_active"),[]);return(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)( /** * translators: * %1$s expands to Yoast SEO. * %2$s and %3$s expand to an opening and closing anchor tag, respectively, that links to the settings page. * %4$s expands to Yoast AI. */ /** * translators: * %1$s expands to Yoast SEO. * %2$s and %3$s expand to an opening and closing anchor tag, respectively, that links to the settings page. * %4$s expands to Yoast AI. */ (0,xe.__)("%4$s requires the SEO analysis to be enabled. To enable it, please navigate to %2$sSite features%3$s in %1$s, turn on the SEO analysis, and click 'Save changes'. If it's disabled in your WordPress user profile, access your profile and enable it there. Please contact your administrator if you don't have access to these settings.","wordpress-seo"),"Yoast SEO","<a>","</a>","Yoast AI"),{a:(0,Se.jsx)(Be,{variant:"error",href:e})})})},lt=(0,xe.__)("You've reached the Yoast AI rate limit","wordpress-seo"),ct=()=>{const e=(0,t.useSelect)(e=>e(re).selectLink("https://yoa.st/ai-generator-rate-limit-help"),[]);return(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)(/* translators: %1$s expands to an opening tag. %2$s expands to a closing tag. */ /* translators: %1$s expands to an opening tag. %2$s expands to a closing tag. */ (0,xe.__)("You might have reached your Yoast AI rate limit for a specific time frame or your sparks limit for this month. If you have reached your rate limit, please reduce the frequency of your requests to continue using Yoast AI features. Our %1$shelp article%2$s provides guidance on effectively planning and pacing your requests for an optimized workflow.","wordpress-seo"),"<a>","</a>"),{a:(0,Se.jsx)(Be,{variant:"error",href:e})})})},dt=()=>(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:lt}),(0,Se.jsx)(ct,{})]}),ut=(0,xe.__)("Subscription required","wordpress-seo"),pt=({invalidSubscriptions:e=[]})=>{const{newYoastWooLink:s,activateYoastWooLink:r,newPremiumLink:i,activatePremiumLink:o}=(0,t.useSelect)(e=>{const t=e(re);return{newYoastWooLink:t.selectLink("https://yoa.st/ai-generator-new-yoast-woocommerce"),activateYoastWooLink:t.selectLink("https://yoa.st/ai-generator-activate-yoast-woocommerce"),newPremiumLink:t.selectLink("https://yoa.st/ai-generator-new-premium"),activatePremiumLink:t.selectLink("https://yoa.st/ai-generator-activate-premium")}},[]);let n,a,l;return e.includes("Yoast WooCommerce SEO")?(n="Yoast WooCommerce SEO",a=r,l=s):e.includes("Yoast SEO Premium")&&(n="Yoast SEO Premium",a=o,l=i),n?(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)( /** * translators: * %1$s expands to Yoast SEO Premium or Yoast WooCommerce SEO. * %2$s expands to MyYoast. * %3$s and %4$s expand to an opening and closing anchor tag, respectively, to activate your subscription. * %5$s and %6$s expand to an opening and closing anchor tag, respectively, to get a new subscription. **/ /** * translators: * %1$s expands to Yoast SEO Premium or Yoast WooCommerce SEO. * %2$s expands to MyYoast. * %3$s and %4$s expand to an opening and closing anchor tag, respectively, to activate your subscription. * %5$s and %6$s expand to an opening and closing anchor tag, respectively, to get a new subscription. **/ (0,xe.__)("To access this feature, you need an active %1$s subscription. Please %3$sactivate your subscription in %2$s%4$s or %5$sget a new %1$s subscription%6$s. Afterward, refresh this page. It may take up to 30 seconds for the feature to function correctly.","wordpress-seo"),n,"MyYoast","<Activate>","</Activate>","<New>","</New>"),{Activate:(0,Se.jsx)(Be,{variant:"error",href:a}),New:(0,Se.jsx)(Be,{variant:"error",href:l})})}):(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)( /** * translators: * %1$s expands to MyYoast. * %2$s and %3$s expand to an opening and closing anchor tag, respectively, to activate your subscription. **/ /** * translators: * %1$s expands to MyYoast. * %2$s and %3$s expand to an opening and closing anchor tag, respectively, to activate your subscription. **/ (0,xe.__)("To access this feature, you need an active subscription. Please %2$sactivate your subscription in %1$s%3$s. Afterward, refresh this page. It may take up to 30 seconds for the feature to function correctly.","wordpress-seo"),"MyYoast","<Activate>","</Activate>"),{Activate:(0,Se.jsx)(Be,{variant:"error",href:o})})})};pt.propTypes={invalidSubscriptions:te().arrayOf(te().string)};const mt=({invalidSubscriptions:e=[]})=>{const s=(0,t.useSelect)(e=>e(se).selectBustSubscriptionCacheEndpoint(),[]),{onClose:r}=(0,i.useModalContext)(),o=(0,we.useCallback)(async()=>{try{await g()({path:s,method:"POST",parse:!1})}catch(e){console.error(e)}window.location.reload()},[]);return(0,Se.jsxs)(we.Fragment,{children:[(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:ut}),(0,Se.jsx)(pt,{invalidSubscriptions:e})]}),(0,Se.jsxs)("div",{className:"yst-mt-6 yst-mb-1 yst-flex yst-space-x-3 rtl:yst-space-x-reverse yst-place-content-end",children:[(0,Se.jsx)(i.Button,{variant:"secondary",onClick:r,children:(0,xe.__)("Close","wordpress-seo")}),(0,Se.jsx)(i.Button,{variant:"primary",onClick:o,children:(0,xe.__)("Refresh page","wordpress-seo")})]})]})};mt.propTypes={invalidSubscriptions:te().arrayOf(te().string)};const ht=(0,xe.__)("Connection timeout","wordpress-seo"),gt=()=>{const{commonErrorsLink:e,supportLink:t}=Qe();return(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)(/* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */ /* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */ (0,xe.__)("It seems that a connection timeout has occurred. Please check your internet connection and try again later. Learn more on our page about %1$scommon AI feature problems and errors%2$s. In case you need further help, please %3$scontact our support team%4$s.","wordpress-seo"),"<a1>","</a1>","<a2>","</a2>"),{a1:(0,Se.jsx)(Be,{variant:"error",href:e}),a2:(0,Se.jsx)(Be,{variant:"error",href:t})})})},yt=()=>(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:ht}),(0,Se.jsx)(gt,{})]}),xt=(0,xe.__)("Usage policy violation","wordpress-seo"),wt=()=>{const e=(0,t.useSelect)(e=>e(re).selectAdminLink("?page=wpseo_page_support"),[]);return(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)(/* translators: %1$s, %2$s, %3$s, %4$s are anchor tags. %5$s expands to OpenAI. */ /* translators: %1$s, %2$s, %3$s, %4$s are anchor tags. %5$s expands to OpenAI. */ (0,xe.__)("Due to %5$s's strict ethical guidelines and %1$susage policies%2$s, we cannot generate suggestions for the content on this page. If you intend to use AI, kindly avoid the use of explicit, violent, copyrighted, or sexually explicit content. In case you need further help, please %3$scontact our support team%4$s.","wordpress-seo"),"<a1>","</a1>","<a2>","</a2>","OpenAI"),{a1:(0,Se.jsx)(Be,{variant:"error",href:"https://openai.com/policies/usage-policies"}),a2:(0,Se.jsx)(Be,{variant:"error",href:e})})})},ft=()=>(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:xt}),(0,Se.jsx)(wt,{})]}),vt=(0,xe.__)("Something went wrong","wordpress-seo"),bt=({errorMessage:e=""})=>{const s=(0,t.useSelect)(e=>e(re).selectAdminLink("?page=wpseo_page_support"),[]);return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(Je,{children:(0,xe.sprintf)(/* translators: %s is the error response of the request. */ /* translators: %s is the error response of the request. */ (0,xe.__)("The request came back with the following error: '%s'.","wordpress-seo"),e)}),(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)(/* translators: %1$s expands to an opening tag. %2$s expands to a closing tag. */ /* translators: %1$s expands to an opening tag. %2$s expands to a closing tag. */ (0,xe.__)("Please try again later. If the issue persists, please %1$scontact our support team%2$s.","wordpress-seo"),"<a>","</a>"),{a:(0,Se.jsx)(Be,{variant:"error",href:s})})})]})};bt.propTypes={errorMessage:te().string};const St=({errorMessage:e=""})=>(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:vt}),(0,Se.jsx)(bt,{errorMessage:e})]});St.propTypes={errorMessage:te().string};const jt=(0,xe.__)("Something went wrong","wordpress-seo"),Ct=()=>{const e=(0,t.useSelect)(e=>e(re).selectAdminLink("plugins.php"),[]);return(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)(/* translators: %1$s expands to Yoast SEO Premium. %2$s expands to an opening link tag. %3$s expands to a closing link tag. */ /* translators: %1$s expands to Yoast SEO Premium. %2$s expands to an opening link tag. %3$s expands to a closing link tag. */ (0,xe.__)("The version of %1$s is outdated. Please upgrade %1$s %2$shere%3$s!","wordpress-seo"),"Yoast SEO Premium","<a>","</a>"),{a:(0,Se.jsx)(Be,{variant:"error",href:e})})})},kt=()=>(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:jt}),(0,Se.jsx)(Ct,{})]}),_t=({children:e})=>(0,Se.jsx)(i.Modal.Description,{as:"div",className:"yst-mt-2 yst-text-sm yst-text-slate-500",children:e}),Et=({children:e})=>(0,Se.jsx)("div",{className:"yst-mt-6 yst-flex yst-flex-row yst-justify-end yst-gap-3",children:e}),Rt=({onClose:e,...t})=>(0,Se.jsx)(i.Button,{variant:"secondary",onClick:e,...t,children:(0,xe.__)("Close","wordpress-seo")}),It=({isOpen:e,title:t,onClose:s=o.noop,children:r})=>{const n=(0,i.useSvgAria)();return(0,Se.jsx)(i.Modal,{isOpen:e,onClose:s,children:(0,Se.jsx)(i.Modal.Panel,{className:"yst-max-w-lg",closeButtonScreenReaderText:(0,xe.__)("Dismiss","wordpress-seo"),children:(0,Se.jsxs)("div",{className:"yst-flex yst-items-start yst-gap-4",children:[(0,Se.jsx)("div",{className:"yst-flex-shrink-0 yst-flex yst-items-center yst-justify-center yst-h-10 yst-w-10 yst-rounded-full yst-bg-red-100",children:(0,Se.jsx)(ze(),{className:"yst-h-6 yst-w-6 yst-text-red-600",...n})}),(0,Se.jsxs)("div",{className:"yst-text-start yst-flex-1 yst-min-w-0",children:[(0,Se.jsx)(i.Modal.Title,{className:"yst-text-lg yst-leading-6 yst-font-medium yst-text-slate-900",children:t}),r]})]})})})},Lt=({showActions:e=!1,onRetry:t,onClose:s})=>(0,Se.jsxs)(Et,{children:[(0,Se.jsx)(Rt,{onClose:s}),e&&(0,Se.jsx)(i.Button,{variant:"primary",onClick:t,children:(0,xe.__)("Try again","wordpress-seo")})]});Lt.propTypes={showActions:te().bool,onRetry:te().func.isRequired,onClose:te().func.isRequired};const Tt=({isOpen:e=!0,showActions:t=!1,onRetry:s=o.noop,onClose:r=o.noop})=>(0,Se.jsxs)(It,{isOpen:e,title:et,onClose:r,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(tt,{})}),(0,Se.jsx)(Lt,{showActions:t,onRetry:s,onClose:r})]});Tt.propTypes={isOpen:te().bool,showActions:te().bool,onRetry:te().func,onClose:te().func};const At=({isOpen:e=!0,showActions:t=!1,onRetry:s=o.noop,onClose:r=o.noop})=>(0,Se.jsxs)(It,{isOpen:e,title:ht,onClose:r,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(gt,{})}),(0,Se.jsx)(Lt,{showActions:t,onRetry:s,onClose:r})]});At.propTypes={isOpen:te().bool,showActions:te().bool,onRetry:te().func,onClose:te().func};const Mt=({errorMessage:e="",isOpen:t=!0,showActions:s=!1,onRetry:r=o.noop,onClose:i=o.noop})=>(0,Se.jsxs)(It,{isOpen:t,title:vt,onClose:i,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(bt,{errorMessage:e})}),(0,Se.jsx)(Lt,{showActions:s,onRetry:r,onClose:i})]});Mt.propTypes={errorMessage:te().string,isOpen:te().bool,showActions:te().bool,onRetry:te().func,onClose:te().func};const Pt=({isOpen:e=!0,onClose:t=o.noop})=>(0,Se.jsxs)(It,{isOpen:e,title:rt,onClose:t,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(it,{})}),(0,Se.jsx)(Et,{children:(0,Se.jsx)(Rt,{onClose:t})})]});Pt.propTypes={isOpen:te().bool,onClose:te().func};const Nt=({isOpen:e=!0,onClose:t=o.noop})=>(0,Se.jsxs)(It,{isOpen:e,title:xt,onClose:t,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(wt,{})}),(0,Se.jsx)(Et,{children:(0,Se.jsx)(Rt,{onClose:t})})]});Nt.propTypes={isOpen:te().bool,onClose:te().func};const Ot=({isOpen:e=!0,onClose:t=o.noop})=>(0,Se.jsxs)(It,{isOpen:e,title:lt,onClose:t,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(ct,{})}),(0,Se.jsx)(Et,{children:(0,Se.jsx)(Rt,{onClose:t})})]});Ot.propTypes={isOpen:te().bool,onClose:te().func};const $t=({isOpen:e=!0,onClose:t=o.noop})=>(0,Se.jsxs)(It,{isOpen:e,title:jt,onClose:t,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(Ct,{})}),(0,Se.jsx)(Et,{children:(0,Se.jsx)(Rt,{onClose:t})})]});$t.propTypes={isOpen:te().bool,onClose:te().func};const Ft=({invalidSubscriptions:e=[],isOpen:s=!0,onClose:r=o.noop})=>{const n=(0,t.useSelect)(e=>e(se).selectBustSubscriptionCacheEndpoint(),[]),a=(0,we.useCallback)(async()=>{try{await g()({path:n,method:"POST",parse:!1})}catch(e){console.error(e)}window.location.reload()},[n]);return(0,Se.jsxs)(It,{isOpen:s,title:ut,onClose:r,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(pt,{invalidSubscriptions:e})}),(0,Se.jsxs)(Et,{children:[(0,Se.jsx)(Rt,{onClose:r}),(0,Se.jsx)(i.Button,{variant:"primary",onClick:a,children:(0,xe.__)("Refresh page","wordpress-seo")})]})]})};Ft.propTypes={invalidSubscriptions:te().arrayOf(te().string),isOpen:te().bool,onClose:te().func};const Ut=({isOpen:e=!0,onClose:t=o.noop})=>{const s=(0,we.useCallback)(()=>window.location.reload(),[]);return(0,Se.jsxs)(It,{isOpen:e,title:nt,onClose:t,children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(at,{})}),(0,Se.jsxs)(Et,{children:[(0,Se.jsx)(Rt,{onClose:t}),(0,Se.jsx)(i.Button,{variant:"primary",onClick:s,children:(0,xe.__)("Refresh page","wordpress-seo")})]})]})};Ut.propTypes={isOpen:te().bool,onClose:te().func};const qt=(0,xe.__)("Yoast AI cannot reach your site","wordpress-seo"),Wt=()=>{const{commonErrorsLink:e,supportLink:t}=Qe();return(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)(/* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */ /* translators: %1$s and %3$s expand to an opening tag. %2$s and %4$s expand to a closing tag. */ (0,xe.__)("To use this feature, your site must be publicly accessible. This applies to both test sites and instances where your REST API is password-protected. Please ensure your site is accessible to the public and try again. Learn more on our page about %1$scommon AI feature problems and errors%2$s. In case you need further help, please %3$scontact our support team%4$s.","wordpress-seo"),"<a1>","</a1>","<a2>","</a2>"),{a1:(0,Se.jsx)(Be,{variant:"error",href:e}),a2:(0,Se.jsx)(Be,{variant:"error",href:t})})})},Bt=({learnMoreUrl:e=""})=>(0,Se.jsx)(Je,{children:fe((0,xe.sprintf)(/* translators: %1$s expands to an opening tag. %2$s expands to a closing tag. */ /* translators: %1$s expands to an opening tag. %2$s expands to a closing tag. */ (0,xe.__)("%1$sLearn more about connecting with MyYoast.%2$s","wordpress-seo"),"<a>","</a>"),{a:(0,Se.jsx)(Be,{variant:"error",href:e})})});Bt.propTypes={learnMoreUrl:te().string};const Gt=()=>{const e=(0,i.useSvgAria)(),{commonErrorsLink:s,supportLink:r}=(0,t.useSelect)(e=>{const t=e(re);return{commonErrorsLink:t.selectLink("https://yoa.st/ai-common-errors"),supportLink:t.selectAdminLink("?page=wpseo_page_support")}},[]);return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(_t,{children:(0,Se.jsx)(Je,{children:(0,xe.__)("This feature requires a publicly accessible site. Check that your site (including any password-protected REST APIs or test environments) is visible to the public, then try again.","wordpress-seo")})}),(0,Se.jsxs)(Et,{children:[(0,Se.jsxs)(i.Button,{as:"a",href:r,target:"_blank",rel:"noopener noreferrer",variant:"secondary",children:[(0,xe.__)("Still need help?","wordpress-seo"),(0,Se.jsx)(be(),{className:"yst--me-1 yst-ms-1 yst-h-4 yst-w-4 yst-text-slate-400 rtl:yst-rotate-[270deg]",...e}),(0,Se.jsx)("span",{className:"yst-sr-only",children:(0,xe.__)("(Opens in a new browser tab)","wordpress-seo")})]}),(0,Se.jsxs)(i.Button,{as:"a",href:s,target:"_blank",rel:"noopener noreferrer",variant:"primary",children:[(0,xe.__)("Learn more","wordpress-seo"),(0,Se.jsx)(_e(),{className:"yst--me-1 yst-ms-1 yst-h-4 yst-w-4 rtl:yst-rotate-180",...e})]})]})]})},Dt=({isAvailable:e,canConnect:t,connectUrl:s,learnMoreUrl:r},o,n)=>e&&t&&s?(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsxs)(_t,{children:[(0,Se.jsx)(Je,{children:(0,xe.__)("This feature requires a publicly accessible site. Connect to MyYoast to use Yoast AI even when your site is offline, behind a firewall, or with the REST API disabled.","wordpress-seo")}),(0,Se.jsx)(Bt,{learnMoreUrl:r})]}),(0,Se.jsxs)(Et,{children:[(0,Se.jsx)(Rt,{onClose:o}),(0,Se.jsxs)(i.Button,{as:"a",href:s,target:"_blank",rel:"noopener noreferrer",variant:"primary",children:[(0,xe.__)("Connect to MyYoast","wordpress-seo"),(0,Se.jsx)(be(),{className:"yst--me-1 yst-ms-1 yst-h-4 yst-w-4 rtl:yst-rotate-[270deg]",...n}),(0,Se.jsx)("span",{className:"yst-sr-only",children:(0,xe.__)("(Opens in a new browser tab)","wordpress-seo")})]})]})]}):e&&!t?(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsxs)(_t,{children:[(0,Se.jsx)(Je,{children:(0,xe.__)("Your site isn't publicly accessible. Ask your site administrator to connect to MyYoast. They can find it on the Integrations page in Yoast SEO. This allows Yoast AI to work even when your site is offline, behind a firewall, or with the REST API disabled.","wordpress-seo")}),(0,Se.jsx)(Bt,{learnMoreUrl:r})]}),(0,Se.jsx)(Et,{children:(0,Se.jsx)(Rt,{onClose:o})})]}):(0,Se.jsx)(Gt,{}),Ht=({isOpen:e=!0,onClose:s=o.noop})=>{const r=(0,i.useSvgAria)(),n=(0,t.useSelect)(e=>e(se).selectMyyoastConnection(),[]);return(0,Se.jsx)(It,{isOpen:e,title:qt,onClose:s,children:Dt(n,s,r)})};Ht.propTypes={isOpen:te().bool,onClose:te().func};const zt=({errorCode:e,errorIdentifier:t="",isOpen:s=!0,invalidSubscriptions:r=[],showActions:i=!1,onRetry:n=o.noop,errorMessage:a="",onClose:l=o.noop})=>{if("SEO_ANALYSIS_INACTIVE"===t)return(0,Se.jsx)(Ut,{isOpen:s,onClose:l});if(402===e||429===e&&"USAGE_LIMIT_REACHED"===t)return(0,Se.jsx)(Ft,{isOpen:s,invalidSubscriptions:r,onClose:l});switch(e){case 400:switch(t){case"AI_CONTENT_FILTER":return(0,Se.jsx)(Nt,{isOpen:s,onClose:l});case"NOT_ENOUGH_CONTENT":return(0,Se.jsx)(Pt,{isOpen:s,onClose:l});case"SITE_UNREACHABLE":return(0,Se.jsx)(Ht,{isOpen:s,onClose:l});case"WP_HTTP_REQUEST_ERROR":return(0,Se.jsx)(Mt,{isOpen:s,errorMessage:a,showActions:i,onRetry:n,onClose:l});default:return(0,Se.jsx)(Tt,{isOpen:s,showActions:i,onRetry:n,onClose:l})}case 408:return(0,Se.jsx)(At,{isOpen:s,showActions:i,onRetry:n,onClose:l});case 429:return(0,Se.jsx)(Ot,{isOpen:s,onClose:l});case 410:return(0,Se.jsx)($t,{isOpen:s,onClose:l});default:return(0,Se.jsx)(Tt,{isOpen:s,showActions:i,onRetry:n,onClose:l})}};zt.propTypes={errorCode:te().number.isRequired,errorIdentifier:te().string,isOpen:te().bool,invalidSubscriptions:te().arrayOf(te().string),showActions:te().bool,onRetry:te().func,errorMessage:te().string,onClose:te().func};var Yt=s(2863),Vt=s.n(Yt);const Kt=window.yoast.aiFrontend,Zt=window.yoast.analysis,Xt=(window.wp.sanitize,window.yoast.helpers),{stripHTMLTags:Jt}=Xt.strings,Qt=["_formal","_informal","_ao90"],es=e=>{for(const t of Qt)if(e.endsWith(t))return e.slice(0,-t.length);return e};let ts,ss=!1;const rs="\\–\\-\\(\\)_\\[\\]’‘“”〝〞〟‟„\"'.?!:;,¿¡«»‹›—×+&۔؟،؛。。!‼?⁇⁉⁈‥…・ー、〃〄〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〶〼〽{}|~⦅⦆「」、[]・¥$%@&'()*/:;<>\\\<>";rs.split(""),new RegExp("^["+rs+"]+"),new RegExp("["+rs+"]+$");const is=new RegExp("["+rs+"#$%&*+/=@^`{|}~ -¿–-⁊ -₠-⃀]","g"),os=e=>0===e.replace(is,"").trim().length,ns=e=>e.replace(/[\n\r]+/g," "),as=(e,t,s)=>{let r="",i=t;for(const t of e){if(i+=t.tokens.length,i>s)return{text:r,tokenCount:i,exceeded:!0};r+=ns(t.text)}return{text:r,tokenCount:i,exceeded:!1}},ls=e=>{const t={...e};return""!==e.value||["title","excerpt","excerpt_only"].includes(e.name)||(t.value="%%"+e.name+"%%"),t.badge=`<badge>${e.label}</badge>`,t},cs=()=>{const e=(0,t.useSelect)(e=>e(re).getReplaceVars(),[]),s=(0,we.useMemo)(()=>e.map(ls),[e]);return(0,we.useCallback)((e,{key:t="value",overrides:r={},applyPluggable:i=!0,editType:n=ae,contentType:a=ce}={})=>{for(const i of s)e=e.replace(new RegExp("%%"+(0,o.escapeRegExp)(i.name)+"%%","g"),(0,o.get)(r,i.name,i[t]));return a===de&&(e=e.replace(" Archives","")),i?((e,t=ae)=>{const s=function(e){const t=(0,o.get)(window,["YoastSEO","app","pluggable"],!1);if(!t||!(0,o.get)(window,["YoastSEO","app","pluggable","loaded"],!1))return function(e){const t=(0,o.get)(window,["YoastSEO","wp","replaceVarsPlugin","replaceVariables"],o.identity);return{url:e.url,title:Jt(t(e.title)),description:Jt(t(e.description)),filteredSEOTitle:e.filteredSEOTitle?Jt(t(e.filteredSEOTitle)):""}}(e);const s=t._applyModifications.bind(t);return{url:e.url,title:Jt(s("data_page_title",e.title)),description:Jt(s("data_meta_desc",e.description)),filteredSEOTitle:e.filteredSEOTitle?Jt(s("data_page_title",e.filteredSEOTitle)):""}}({title:"",description:"",[t]:Zt.languageProcessing.stripSpaces(e)});return(0,o.get)(s,t,e)})(e,n):e},[s])},ds={editType:ae,previewType:ie,postType:"post",contentType:ce},us=(0,we.createContext)(ds),ps=us.Provider,ms=()=>(0,we.useContext)(us),hs=window.yoast.externals.contexts,gs=()=>(0,we.useContext)(hs.LocationContext),ys=e=>{const t=(0,we.useRef)(null);return(0,we.useCallback)(s=>{(0,o.attempt)(()=>t.current&&t.current.disconnect()),null!==s&&(t.current=new ResizeObserver(t=>{(0,o.forEach)(t,t=>e(t))}),t.current.observe(s))},[e])},xs=(0,n.createSlice)({name:"suggestions",initialState:{status:me.loading,error:{code:200,message:""},entities:[],selected:""},reducers:{setLoading:e=>{e.status=me.loading},setSuccess:(e,{payload:t})=>{e.status=me.success,e.selected=t[0],e.entities.push(...t)},setError:(e,{payload:t})=>{e.status=me.error,e.error=t},setSelected:(e,{payload:t})=>{e.selected=t}}}),ws=e=>{switch(e){case oe:return"Facebook";case ne:return"Twitter";default:return"Google"}},fs=window.yoast.searchMetadataPreviews,vs="usageCount",bs="fetchUsageCount",Ss=`${bs}/${$}`,js=`${bs}/${F}`,Cs={errorCode:null,errorIdentifier:null,errorMessage:null},ks=(0,n.createSlice)({name:vs,initialState:{status:U,count:0,limit:10,endpoint:"",error:Cs},reducers:{addUsageCount:(e,{payload:t=1})=>{e.count+=t},setUsageCount:(e,{payload:t})=>{e.count=t},setUsageCountEndpoint:(e,{payload:t})=>{e.endpoint=t},setUsageCountLimit:(e,{payload:t})=>{e.limit=t}},extraReducers:e=>{e.addCase(`${bs}/${O}`,e=>{e.status=q,e.error=Cs}),e.addCase(Ss,(e,{payload:t})=>{e.status=W,e.count=t.count,e.limit=t.limit,e.error=Cs}),e.addCase(`${bs}/${F}`,(e,{payload:t})=>{e.status=B,e.error={errorCode:502,...t}})}}),_s=ks.getInitialState,Es={selectUsageCountStatus:e=>(0,o.get)(e,[vs,"status"],ks.getInitialState()),selectUsageCount:e=>(0,o.get)(e,[vs,"count"],ks.getInitialState().count),selectUsageCountLimit:e=>(0,o.get)(e,[vs,"limit"],ks.getInitialState().limit),selectUsageCountEndpoint:e=>(0,o.get)(e,[vs,"endpoint"],ks.getInitialState().endpoint),selectUsageCountError:e=>(0,o.get)(e,[vs,"error"],ks.getInitialState().error)};Es.selectUsageCountRemaining=(0,n.createSelector)([Es.selectUsageCount,Es.selectUsageCountLimit],(e,t)=>Math.max(t-e,0)),Es.isUsageCountLimitReached=(0,n.createSelector)([Es.selectUsageCount,Es.selectUsageCountLimit,Es.selectUsageCountError],(e,t,s)=>429===s.errorCode||e>=t);const Rs={...ks.actions,fetchUsageCount:function*({endpoint:e,isWooProductEntity:t}){yield{type:`${bs}/${O}`};try{const s=(e=>{const t=(0,o.get)(e,"totalUsed.license",null),s=(0,o.get)(e,"totalUsed.limit",null);if(!(0,o.isNumber)(t)||t<0)throw new Error("Invalid usage count: must be a number of zero or higher.");if(!(0,o.isNumber)(s)||s<-1||0===s)throw new Error("Invalid usage count limit: must be a number of -1 or higher than 1");return{count:t,limit:s}})(yield{type:bs,payload:{endpoint:e,isWooProductEntity:t}});return{type:`${bs}/${$}`,payload:s}}catch(e){return{type:`${bs}/${F}`,payload:e}}}},Is={[bs]:async({payload:e})=>g()({method:"POST",path:e.endpoint,data:{is_woo_product_entity:e.isWooProductEntity}})},Ls=ks.reducer,Ts=({onStartGenerating:e})=>(0,Se.jsx)(Xe,{storeName:se,linkStoreName:re,onConsentGranted:e});Ts.propTypes={onStartGenerating:te().func.isRequired};var As=s(7219),Ms=s.n(As);const Ps=e=>{var s,r;const i=null===(s=(0,t.useDispatch)("core/edit-post"))||void 0===s?void 0:s.openGeneralSidebar,o=null===(r=(0,t.useDispatch)("core/editor"))||void 0===r?void 0:r.closePublishSidebar,{openEditorModal:n}=(0,t.useDispatch)("yoast-seo/editor");return(0,we.useCallback)(()=>{o(),i("yoast-seo/seo-sidebar"),e&&n("yoast-search-appearance-modal")},[o,i,n])},Ns=/(?<start><\/badge>|^(?!<badge>))(?<wrap>[\s\S]+?)(?<end><badge>|$)/g,Os=({total:e,current:t,onNavigate:s,disabled:r=!1,...o})=>(0,Se.jsxs)("div",{className:"yst-flex yst-justify-between yst-gap-x-2 yst-items-start",children:[(0,Se.jsx)("p",{className:"yst-text-slate-500 yst-text-xxs yst-mt-1",children:(0,xe.__)("Text generated by AI may be offensive or inaccurate.","wordpress-seo")}),e>1&&(0,Se.jsx)(i.Pagination,{className:"yst-shrink-0",current:t,total:e,onNavigate:s,disabled:r,variant:"text" /* translators: Hidden accessibility text. */,screenReaderTextPrevious:(0,xe.__)("Previous","wordpress-seo") /* translators: Hidden accessibility text. */,screenReaderTextNext:(0,xe.__)("Next","wordpress-seo"),...o})]}),$s=({height:e,onFatalError:s})=>{const[r,n]=(0,we.useState)(""),{onClose:a}=(0,i.useModalContext)(),{editType:l,previewType:c,contentType:d}=ms(),u=(()=>{const{editType:e,previewType:t}=ms();let s="SEO";switch(t){case oe:s="social";break;case ne:s="X"}switch(e){case ae:return(0,xe.sprintf)(/* translators: %s is the type of title. */ /* translators: %s is the type of title. */ (0,xe.__)("Generated %s titles","wordpress-seo"),s);case le:return t===ie&&(s="meta"),(0,xe.sprintf)(/* translators: %s is the type of description. */ /* translators: %s is the type of description. */ (0,xe.__)("Generated %s descriptions","wordpress-seo"),s)}})(),p=(()=>{const{editType:e,previewType:t}=ms();let s="SEO";switch(t){case oe:s="social";break;case ne:s="X"}switch(e){case ae:return(0,xe.sprintf)(/* translators: %s is the type of title. */ /* translators: %s is the type of title. */ (0,xe.__)("Apply %s title","wordpress-seo"),s);case le:return t===ie&&(s="meta"),(0,xe.sprintf)(/* translators: %s is the type of description. */ /* translators: %s is the type of description. */ (0,xe.__)("Apply %s description","wordpress-seo"),s)}})(),m=gs(),{suggestions:h,fetchSuggestions:y,setSelectedSuggestion:x}=(()=>{const[e,s]=(0,we.useReducer)(xs.reducer,xs.getInitialState()),{editType:r,previewType:i,postType:n,contentType:a}=ms(),l=(0,t.useSelect)(e=>e(se).selectPromptContent(),[]),c=(0,t.useSelect)(e=>e(se).selectGetSuggestionsEndpoint(),[]),{contentLocale:d,focusKeyphrase:u,isWooCommerceActive:p,isGutenberg:m,isElementor:h}=(0,t.useSelect)(e=>({contentLocale:e(re).getContentLocale(),focusKeyphrase:e(re).getFocusKeyphrase(),isWooCommerceActive:e(re).getIsWooCommerceActive(),isGutenberg:e(re).getIsBlockEditor(),isElementor:e(re).getIsElementorEditor()}),[]);let y,x=Zt.languageProcessing.helpers.processExactMatchRequest(u).keyphrase;x.length>191&&(x=x.slice(0,191)),y=h?"elementor":m?"gutenberg":"classic";const w=((e,t,s,r)=>{const i=e===le?"meta-description":"seo-title";let o=((e,t)=>{if(e)switch(t){case"product":return"product-";case"product_cat":case"product_tag":return"product-taxonomy-"}return""})(t,s);return o&&t||r!==de||(o="taxonomy-"),`${o}${i}`})(r,p,n,a),f=(0,we.useCallback)(async(e=!0)=>{s(xs.actions.setLoading());const{status:t,payload:r}=await(async({endpoint:e,data:t})=>{let s;const r=1e3*(0,o.get)(window,"wpseoAiGenerator.requestTimeout",30);try{ts&&ts.abort(),ts=new AbortController,ss=!1,s=setTimeout(()=>{ss=!0,ts.abort()},r);const i=await g()({path:e,method:"POST",data:t,parse:!1,signal:ts.signal}),o=await i.json();return{status:he,payload:o}}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return ss?{status:ge,payload:{message:"timeout",code:408}}:{status:ye};const{message:t,missingLicenses:s,errorIdentifier:r}=await(async e=>{try{const t=e.body.getReader(),{value:s}=await t.read(),r=new TextDecoder("utf-8").decode(s);return console.error(r),JSON.parse(r)}catch(e){return{message:"Unknown"}}})(e);return{status:ge,payload:{message:t,code:e.status||500,missingLicenses:s,errorIdentifier:r}}}finally{clearTimeout(s)}})({endpoint:c,canAbort:e,data:{type:w,prompt_content:l,focus_keyphrase:x,platform:ws(i),language:es(d).replace("_","-"),editor:y}});switch(t){case ye:break;case ge:s(xs.actions.setError(r));break;case he:s(xs.actions.setSuccess(r))}return t},[s]);return{suggestions:e,fetchSuggestions:f,setSelectedSuggestion:(0,we.useCallback)(e=>s(xs.actions.setSelected(e)),[s])}})(),w=(()=>{const{previewType:e}=ms();switch(e){case oe:return Vs;case ne:return ri;default:return Gs}})(),{addAppliedSuggestion:f,addUsageCount:v}=(0,t.useDispatch)(se),{isUsageCountLimitReached:b,isWooProductEntity:S,hasValidPremiumSubscription:j,hasValidWooSubscription:C}=(0,t.useSelect)(e=>{const t=e(se),s=e(re);return{isUsageCountLimitReached:t.isUsageCountLimitReached(),isPremium:s.getIsPremium(),isWooProductEntity:s.getIsWooProductEntity(),isWooSeoActive:s.getIsWooSeoActive(),hasValidPremiumSubscription:t.selectPremiumSubscription(),hasValidWooSubscription:t.selectWooCommerceSubscription()}},[]),k=(0,we.useMemo)(()=>h.status===me.loading||!(C||!b||!S)||!(j||!b),[j,b,h.status,S,C]),_=(0,i.usePrevious)(e),E=h.status===me.success?e:_,{bottom:R}={bottom:`calc( (${E+"px"} - 100vh) / 2 + 32px )`},[I,L]=(0,we.useState)(!1),T=(0,we.useCallback)(e=>{L(e.target.offsetHeight!==e.target.scrollHeight)},[L]),A=ys(T),M=(()=>{const{editType:e,previewType:s,contentType:r}=ms(),i=(()=>{const{previewType:e}=ms();return(0,we.useMemo)(()=>{switch(e){case ie:return()=>(0,t.select)(re).getSnippetEditorData().title;case oe:return(0,t.select)(re).getFacebookTitleOrFallback;case ne:return(0,t.select)(re).getTwitterTitleOrFallback;default:return(0,o.constant)("")}},[e])})(),n=(0,t.useSelect)(t=>t(se).selectAppliedSuggestionFor({editType:e,previewType:s}),[e,s]);return(0,we.useMemo)(()=>{let t=i();return e===le?t:(n&&(t=t.replace(n,pe[r])),((e,t)=>e.includes(pe[t])?e:pe[t])(t,r))},[e,i])})(),P=(()=>{const e=(()=>{const{previewType:e}=ms();return(0,we.useMemo)(()=>{switch(e){case ie:return()=>(0,t.select)(re).getSnippetEditorData().description;case oe:return(0,t.select)(re).getFacebookDescriptionOrFallback;case ne:return(0,t.select)(re).getTwitterDescriptionOrFallback;default:return(0,o.constant)("")}},[e])})();return(0,we.useMemo)(e,[e])})(),N=cs(),O=(0,we.useMemo)(()=>l===ae?{[ue[d]]:h.selected}:{},[l,d,h.selected]),$=(0,we.useMemo)(()=>N(M,{overrides:O,contentType:d}),[N,M,l,d,h.selected]),F=(0,we.useMemo)(()=>N(M,{overrides:{...O,sep:"",sitename:""},contentType:d}),[N,M,l,d,h.selected]),U=(0,we.useMemo)(()=>l===le?h.selected:N(P,{editType:le}),[N,P,l,h.selected]),q=(0,we.useCallback)(e=>N(M,{overrides:{[ue[d]]:e},key:"badge",applyPluggable:!1,contentType:d}),[N,M,d]),{currentPage:W,setCurrentPage:B,isOnLastPage:G,totalPages:D,getItemsOnCurrentPage:H}=(({totalItems:e=0,perPage:t=5})=>{const[s,r]=(0,we.useState)(1),i=(0,we.useMemo)(()=>Math.ceil(e/t),[e,t]),n=(0,we.useMemo)(()=>s*t,[s,t]),a=(0,we.useMemo)(()=>n-t,[n,t]),l=(0,we.useMemo)(()=>1===s,[s]),c=(0,we.useMemo)(()=>s===i,[s,i]),d=(0,we.useCallback)(()=>{s>1&&r(s-1)},[s,r]),u=(0,we.useCallback)(()=>{s<i&&r(s+1)},[s,r,i]),p=(0,we.useCallback)(e=>(0,o.slice)(e,a,n),[a,n]);return{currentPage:s,setCurrentPage:r,totalPages:i,isOnFirstPage:l,isOnLastPage:c,previousPage:d,nextPage:u,firstOnPage:a,lastOnPage:n,getItemsOnCurrentPage:p}})({totalItems:h.status===me.loading||h.status===me.error?h.entities.length+5:h.entities.length,perPage:5}),z=(0,we.useMemo)(()=>(0,o.map)(H(h.entities),e=>{let t=e;return l===ae&&(t=q(e),t=t.replace(Ns,(e,t,s,r,i,o,{start:n,wrap:a,end:l})=>{const c=a.trim();return 0===c.length?`${n}${a}${l}`:`${n}<span>${c}</span>${l}`}),t=fe(t,{badge:(0,Se.jsx)(i.Badge,{className:"yst-me-2 last:yst-me-0",variant:"plain",children:" "}),span:(0,Se.jsx)("span",{className:"yst-flex yst-items-center yst-me-2 last:yst-me-0"})})),{value:e,label:t}}),[h.entities,H,l,q]),Y=(0,we.useMemo)(()=>h.status!==me.error||h.status===me.error&&!G,[h.status,G]),V=(0,we.useMemo)(()=>h.status===me.loading&&G,[h.status,G]),K=(0,we.useMemo)(()=>h.status===me.error&&G,[h.status,G]),Z=(0,we.useCallback)(()=>{k||(B(h.status===me.error?D:D+1),y().then(e=>{e===he&&v()}))},[y,h.status,D,B,x,b]),X=(()=>{const{editType:e}=ms();switch(e){case ae:return(()=>{const{previewType:e}=ms(),{updateData:s,setFacebookPreviewTitle:r,setTwitterPreviewTitle:i}=(0,t.useDispatch)(re);return(0,we.useMemo)(()=>{switch(e){case ie:return e=>s({title:e});case oe:return r;case ne:return i;default:return o.noop}},[e,s,r,i])})();case le:return(()=>{const{previewType:e}=ms(),{updateData:s,setFacebookPreviewDescription:r,setTwitterPreviewDescription:i}=(0,t.useDispatch)(re);return(0,we.useMemo)(()=>{switch(e){case ie:return e=>s({description:e});case oe:return r;case ne:return i;default:return o.noop}},[e,s,r,i])})();default:return o.noop}})(),J=Ps(!0),Q=(0,we.useCallback)(()=>{const e=l===ae?M.replace(new RegExp(pe[d]+"( Archives)?"),h.selected):h.selected;X(e),f({editType:l,previewType:c,suggestion:h.selected}),a(),"pre-publish"===m&&J()},[X,l,c,h.selected,M,a,f,J,m]);((e,t=[])=>{const s=(0,we.useRef)(!1);(0,we.useEffect)(()=>{s.current||(s.current=!0,e().finally(()=>{s.current=!1}))},[e,t])})(()=>""===r?y().then(e=>{n(e),e===he&&v()}):Promise.resolve(),[r,v,y]);const ee=r===ge||h.status===me.error&&402===h.error.code;return(0,we.useEffect)(()=>{var e,t,r,i,o,n,a,l;ee&&s({errorCode:null!==(e=null===(t=h.error)||void 0===t?void 0:t.code)&&void 0!==e?e:0,errorIdentifier:null!==(r=null===(i=h.error)||void 0===i?void 0:i.errorIdentifier)&&void 0!==r?r:"",invalidSubscriptions:null!==(o=null===(n=h.error)||void 0===n?void 0:n.missingLicenses)&&void 0!==o?o:[],errorMessage:null!==(a=null===(l=h.error)||void 0===l?void 0:l.message)&&void 0!==a?a:""})},[ee,h.error,s]),ee?null:(0,Se.jsxs)(we.Fragment,{children:[(0,Se.jsxs)(i.Modal.Container.Content,{ref:A,className:"yst-flex yst-flex-col yst-py-6 yst-space-y-2",children:[(0,Se.jsx)(w,{title:$,description:U,status:h.status,titleForLength:F,showPreviewSkeleton:""===r,showLengthProgress:!V}),Y&&(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsxs)("div",{className:"yst-flex yst-space-y-4",children:[(0,Se.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default yst-mt-auto",children:u}),(0,Se.jsx)(i.Button,{variant:"ai-secondary",size:"small",onClick:h.status===me.loading?o.noop:Z,isLoading:h.status===me.loading,disabled:k,children:(0,xe.__)("Generate 5 more","wordpress-seo")})]}),V?(0,Se.jsx)(ei,{idSuffix:m,suggestionClassNames:l===ae?[["yst-h-3 yst-w-9/12"],["yst-h-3 yst-w-7/12"],["yst-h-3 yst-w-10/12"],["yst-h-3 yst-w-11/12"],["yst-h-3 yst-w-8/12"]]:void 0}):(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(Jr,{idSuffix:m,suggestions:z,selected:h.selected,onChange:x}),(0,Se.jsx)(Os,{current:W,total:D,onNavigate:B,disabled:h.status===me.loading||K})]})]}),K&&(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)("div",{className:"yst-mt-8"}),(0,Se.jsx)(Kr,{errorCode:h.error.code,errorIdentifier:h.error.errorIdentifier,invalidSubscriptions:h.error.missingLicenses,errorMessage:h.error.message}),(0,Se.jsx)(Os,{current:W,total:D,onNavigate:B,disabled:h.status===me.loading})]})]}),(0,Se.jsxs)(i.Modal.Container.Footer,{children:[I&&(0,Se.jsx)("div",{className:"yst-absolute yst-inset-x-0 yst--mt-10 yst-me-[calc(2.5rem-1px)] yst-h-10 yst-pointer-events-none yst-bg-gradient-to-t yst-from-slate-50"}),(0,Se.jsx)("hr",{className:"yst-mb-6 yst--mx-6"}),(0,Se.jsxs)("div",{className:"sm:yst-flex sm:yst-justify-end sm:yst-space-x-2 sm:rtl:yst-space-x-reverse",children:[(0,Se.jsx)("div",{className:"yst-hidden sm:yst-inline",children:(0,Se.jsx)(i.Button,{variant:"secondary",onClick:a,children:(0,xe.__)("Close","wordpress-seo")})}),(0,Se.jsx)("div",{className:"yst-block sm:yst-inline",children:(0,Se.jsxs)(i.Button,{className:"yst-w-full sm:yst-w-auto",variant:"primary",onClick:Q,disabled:""===h.selected||h.status===me.loading||K,children:[(0,Se.jsx)(Ms(),{className:"yst--ms-1 yst-me-1 yst-h-4 yst-w-4 yst-text-white"}),p]})}),(0,Se.jsx)("div",{className:"yst-mt-3 sm:yst-hidden",children:(0,Se.jsx)(i.Button,{variant:"secondary",onClick:a,className:"yst-w-full sm:yst-w-auto",children:(0,xe.__)("Close","wordpress-seo")})})]})]}),(0,Se.jsxs)(i.Notifications,{className:"yst-mx-[calc(50%-50vw)] yst-transition-all",style:{bottom:R},position:"bottom-left",children:[h.status!==me.loading&&(0,Se.jsx)(di,{className:"yst-mx-[calc(50%-50vw)] yst-transition-all"}),(h.status===me.success||h.status===me.loading)&&(0,Se.jsx)(si,{})]})]})};$s.propTypes={height:te().number.isRequired,onFatalError:te().func.isRequired};const Fs=({onActivateFreeSparks:e})=>{const{premiumUpsellLink:s,wooUpsellLink:r,isWooCommerceActive:o,isProductPost:n,learnMoreLink:a,imageLink:l,wistiaEmbedPermissionValue:c,wistiaEmbedPermissionStatus:d,isUsageCountLimitReached:u,activateFreeSparksEndpoint:p}=(0,t.useSelect)(e=>{const t=e(se),s=e(re);return{premiumUpsellLink:s.selectLink("https://yoa.st/ai-generator-upsell"),wooUpsellLink:s.selectLink("https://yoa.st/ai-generator-upsell-woo-seo"),isWooCommerceActive:s.getIsWooCommerceActive(),isProductPost:s.getIsProduct(),learnMoreLink:s.selectLink("https://yoa.st/ai-generator-learn-more"),imageLink:s.selectImageLink("ai-generator-preview.jpg"),wistiaEmbedPermissionValue:s.selectWistiaEmbedPermissionValue(),wistiaEmbedPermissionStatus:s.selectWistiaEmbedPermissionStatus(),isUsageCountLimitReached:t.isUsageCountLimitReached(),activateFreeSparksEndpoint:t.selectFreeSparksActiveEndpoint()}},[]),{onClose:m,initialFocus:h}=(0,i.useModalContext)(),{title:g,upsellLabel:y,upsellLink:x,ctbId:w,newToText:f}=(e=>{const{isWooProductEntity:s,isProductPost:r,hasValidWooSubscription:i}=(0,t.useSelect)(e=>{const t=e(re),s=e(se);return{isWooProductEntity:t.getIsWooProductEntity(),isProductPost:t.getIsProduct(),hasValidWooSubscription:s.selectWooCommerceSubscription()}},[]);return(0,we.useMemo)(()=>{const t={upsellLink:e.premium,upsellLabel:(0,xe.sprintf)(/* translators: %1$s expands to Yoast SEO Premium. */ /* translators: %1$s expands to Yoast SEO Premium. */ (0,xe.__)("Unlock with %1$s","wordpress-seo"),"Yoast SEO Premium"),newToText:"Yoast SEO Premium",ctbId:"f6a84663-465f-4cb5-8ba5-f7a6d72224b2",title:(0,xe.__)("Use AI to generate your titles & descriptions!","wordpress-seo")};return s&&(r&&(t.title=(0,xe.__)("Generate product titles & descriptions with AI!","wordpress-seo")),i||(t.newToText="Yoast WooCommerce SEO",t.upsellLabel=(0,xe.sprintf)(/* translators: %1$s expands to Yoast WooCommerce SEO. */ /* translators: %1$s expands to Yoast WooCommerce SEO. */ (0,xe.__)("Unlock with %1$s","wordpress-seo"),"Yoast WooCommerce SEO"),t.upsellLink=e.woo,t.ctbId="5b32250e-e6f0-44ae-ad74-3cefc8e427f9")),t},[s,r,e.premium,e.woo])})({premium:s,woo:r}),v=(0,we.useMemo)(()=>o&&n,[o,n]),b=(0,we.useMemo)(()=>({src:l,width:"432",height:"244"}),[l]),{setWistiaEmbedPermission:S}=(0,t.useDispatch)(re),{activateFreeSparks:j}=(0,t.useDispatch)(se),C=(0,we.useMemo)(()=>({value:c,status:d,set:S}),[c,d,S]),k=(0,we.useCallback)(()=>{j({endpoint:p}),e()},[j,p,m,e]),_={a:(0,Se.jsx)(Be,{href:a,className:"yst-inline-flex yst-items-center yst-gap-1 yst-no-underline yst-font-medium",variant:"primary"}),ArrowNarrowRightIcon:(0,Se.jsx)(_e(),{className:"yst-w-4 yst-h-4 rtl:yst-rotate-180"})};return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsxs)("div",{className:"yst-px-10 yst-pt-10 yst-introduction-gradient yst-text-center",children:[(0,Se.jsxs)("div",{className:"yst-relative yst-w-full",children:[(0,Se.jsx)(Ve,{videoId:"vmrahpfjxp",thumbnail:b,wistiaEmbedPermission:C}),(0,Se.jsx)(i.Badge,{className:"yst-absolute yst--top-2 yst-end-4",variant:"info",children:"Beta"})]}),(0,Se.jsx)("div",{className:"yst-mt-6 yst-text-xs yst-font-medium yst-flex yst-flex-col yst-items-center",children:(0,Se.jsxs)("span",{className:"yst-introduction-modal-uppercase yst-flex yst-gap-2 yst-items-center",children:[(0,Se.jsx)("span",{className:"yst-logo-icon"}),f]})})]}),(0,Se.jsxs)("div",{className:"yst-px-10 yst-pb-4 yst-flex yst-flex-col yst-items-center",children:[(0,Se.jsxs)("div",{className:"yst-mt-4 yst-mx-1.5 yst-text-center",children:[(0,Se.jsx)("h3",{className:"yst-text-slate-900 yst-text-lg yst-font-medium",children:g}),(0,Se.jsx)("div",{className:"yst-mt-2 yst-text-slate-600 yst-text-sm",children:fe(v?(0,xe.sprintf)(/* translators: %1$s and %2$s are anchor tags; %3$s is the arrow icon. */ /* translators: %1$s and %2$s are anchor tags; %3$s is the arrow icon. */ (0,xe.__)("Let AI do some of the thinking for you and help you save time. Get high-quality suggestions for product titles and meta descriptions to make your content rank high and look good on social media. %1$sLearn more%2$s%3$s","wordpress-seo"),"<a>","<ArrowNarrowRightIcon />","</a>"):(0,xe.sprintf)(/* translators: %1$s and %2$s are anchor tags; %3$s is the arrow icon. */ /* translators: %1$s and %2$s are anchor tags; %3$s is the arrow icon. */ (0,xe.__)("Let AI do some of the thinking for you and help you save time. Get high-quality suggestions for titles and meta descriptions to make your content rank high and look good on social media. %1$sLearn more%2$s%3$s","wordpress-seo"),"<a>","<ArrowNarrowRightIcon />","</a>"),_)})]}),u&&(0,Se.jsx)(i.Alert,{className:"yst-my-4",children:(0,xe.sprintf)(/* translators: %s is for Yoast SEO Premium. */ /* translators: %s is for Yoast SEO Premium. */ (0,xe.__)("Oh no! Its seems like you're out of free Sparks. Keep the momentum going, unlock unlimited sparks with %s!","wordpress-seo"),"Yoast SEO Premium")}),(0,Se.jsxs)("div",{className:De()("yst-w-full yst-flex yst-flex-col",u?"yst-mt-0":"yst-mt-6"),children:[(0,Se.jsxs)(i.Button,{as:"a",className:"yst-grow",size:"extra-large",variant:"upsell",href:x,target:"_blank",ref:h,"data-action":"load-nfd-ctb","data-ctb-id":w,children:[(0,Se.jsx)(Ce(),{className:"yst--ms-1 yst-me-2 yst-h-5 yst-w-5"}),y,(0,Se.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */ (0,xe.__)("(Opens in a new browser tab)","wordpress-seo")})]}),!u&&(0,Se.jsx)(i.Button,{variant:"ai-secondary",onClick:k,className:"yst-mt-2 yst-w-full yst-text-base yst-text-slate-800 yst-font-medium yst-h-11",children:(0,xe.__)("Try for free","wordpress-seo")})]}),(0,Se.jsx)(i.Button,{as:"a",className:"yst-mt-4",variant:"tertiary",onClick:m,children:(0,xe.__)("Close","wordpress-seo")})]})]})},Us=({isOpen:e,onClose:t,closeButtonScreenReaderText:s,panelRef:r,title:o,aiModalHelperLink:n,children:a})=>{const l=(0,i.useSvgAria)();return(0,Se.jsx)(i.Modal,{className:"yst-ai-modal",isOpen:e,onClose:t,children:(0,Se.jsx)(i.Modal.Panel,{ref:r,className:"yst-max-w-3xl yst-relative",closeButtonScreenReaderText:s,children:(0,Se.jsxs)(i.Modal.Container,{children:[(0,Se.jsxs)(i.Modal.Container.Header,{children:[(0,Se.jsxs)("div",{className:"yst-flex yst-items-center",children:[(0,Se.jsx)("span",{className:"yst-logo-icon yst-h-5 yst-w-5"}),(0,Se.jsx)(i.Modal.Title,{className:"yst-ms-3 yst-me-1.5",as:"h1",size:"2",children:o}),(0,Se.jsx)(i.Link,{id:"ai-modal-learn-more",href:n,variant:"primary",className:"yst-no-underline yst-me-2",target:"_blank",rel:"noopener" /* translators: Hidden accessibility text. */,"aria-label":(0,xe.__)("Learn more about AI (Opens in a new browser tab)","wordpress-seo"),children:(0,Se.jsx)(Vt(),{...l,className:"yst-w-4 yst-h-4 yst-text-slate-500 yst-shrink-0"})}),(0,Se.jsx)(i.Badge,{variant:"info",children:(0,xe.__)("Beta","wordpress-seo")})]}),(0,Se.jsx)("hr",{className:"yst-mt-6 yst--mx-6"})]}),a]})})})},qs=({isOpen:e,onClose:t,closeButtonScreenReaderText:s,children:r})=>(0,Se.jsx)(i.Modal,{className:"yst-introduction-modal",isOpen:e,onClose:t,children:(0,Se.jsx)(i.Modal.Panel,{className:"yst-max-w-lg yst-p-0 yst-rounded-3xl",closeButtonScreenReaderText:s,children:r})}),Ws={inactive:"inactive",askConsent:"askConsent",upsell:"upsell",generate:"generate"},Bs=({onUseAi:e})=>{const[s,r]=(0,we.useState)(Ws.inactive),{editType:o,previewType:n}=ms(),a=gs(),l=(()=>{const{editType:e,previewType:t}=ms();switch(t){case oe:return e===le?(0,xe.__)("AI social description generator","wordpress-seo"):(0,xe.__)("AI social title generator","wordpress-seo");case ne:return e===le?(0,xe.__)("AI X description generator","wordpress-seo"):(0,xe.__)("AI X title generator","wordpress-seo");default:return e===le?(0,xe.__)("AI description generator","wordpress-seo"):(0,xe.__)("AI title generator","wordpress-seo")}})(),{hasConsent:c,promptContentInitialized:d,currentSubscriptions:u,usageCountStatus:p,usageCount:m,usageCountLimit:h,usageCountEndpoint:g,hasValidPremiumSubscription:y,hasValidWooSubscription:x,focusKeyphrase:w,isPremium:f,isSeoAnalysisActive:v,aiModalHelperLink:b,isWooProductEntity:S,isFreeSparksActive:j,isWooSeoActive:C}=(0,t.useSelect)(e=>{const t=e(se),s=e(re);return{hasConsent:t.selectHasAiGeneratorConsent(),promptContentInitialized:t.selectPromptContentInitialized(),currentSubscriptions:t.selectProductSubscriptions(),usageCountStatus:t.selectUsageCountStatus(),usageCount:t.selectUsageCount(),usageCountLimit:t.selectUsageCountLimit(),usageCountEndpoint:t.selectUsageCountEndpoint(),hasValidPremiumSubscription:t.selectPremiumSubscription(),hasValidWooSubscription:t.selectWooCommerceSubscription(),focusKeyphrase:s.getFocusKeyphrase(),isPremium:s.getIsPremium(),isWooSeoActive:s.getIsWooSeoActive(),isSeoAnalysisActive:s.getPreference("isKeywordAnalysisActive",!0),aiModalHelperLink:s.selectLink("https://yoa.st/ai-generator-help-button-modal"),isWooProductEntity:s.getIsWooProductEntity(),isFreeSparksActive:e(se).selectIsFreeSparksActive()}},[]),{fetchUsageCount:k}=(0,t.useDispatch)(se),{closeEditorModal:_}=(0,t.useDispatch)(re),E=(0,xe.__)("Close modal","wordpress-seo"),[R,I]=(0,we.useState)(!1),[L,T]=(0,we.useState)(0),A=(0,we.useCallback)(e=>T(e.borderBoxSize[0].blockSize),[T]),M=ys(A),[P,N]=(0,we.useState)(null),O=(0,we.useCallback)(({currentSubscriptions:e,isSeoAnalysisActive:s})=>{const r=(e=>{const s=(0,t.select)(re),r=[];return((e,t)=>(e.getIsPremium()||e.getIsWooProductEntity())&&!t.premiumSubscription)(s,e)&&r.push("Yoast SEO Premium"),((e,t)=>e.getIsWooProductEntity()&&e.getIsWooSeoActive()&&!t.wooCommerceSubscription)(s,e)&&r.push("Yoast WooCommerce SEO"),r})(e);return r.length>0?{errorCode:402,errorIdentifier:"",invalidSubscriptions:r,errorMessage:""}:s?(()=>{var e,s;const r=(0,t.select)(se);if(r.selectUsageCountStatus()!==B)return null;const i=r.selectUsageCountError();return{errorCode:i.errorCode,errorIdentifier:null!==(e=i.errorIdentifier)&&void 0!==e?e:"",invalidSubscriptions:[],errorMessage:null!==(s=i.errorMessage)&&void 0!==s?s:""}})():{errorCode:0,errorIdentifier:"SEO_ANALYSIS_INACTIVE",invalidSubscriptions:[],errorMessage:""}},[]),$=(0,we.useCallback)(()=>{r(Ws.inactive)},[]),F=(0,we.useCallback)(()=>N(null),[]),U=(0,we.useCallback)(()=>{N(null),r(Ws.generate)},[]),W=(0,we.useCallback)(()=>{N(O({currentSubscriptions:u,isSeoAnalysisActive:v})),r(Ws.inactive)},[O,u,v]),G=(0,we.useCallback)(e=>{N(e),r(Ws.inactive)},[]),D={onClose:$,closeButtonScreenReaderText:E},H=(0,we.useCallback)(()=>!os(w),[w]),z=Ps(!1),Y=(0,we.useCallback)(()=>{_(),"pre-publish"===a&&z(),setTimeout(()=>(e=>{const t=`focus-keyword-input-${["modal","pre-publish"].includes(e)?"sidebar":e}`;if("metabox"===e){const e=document.getElementById("wpseo-meta-tab-content");e&&e.click()}const s=document.getElementById(t);s&&s.focus()})(a),0)},[_,a,z]),V=(0,we.useCallback)(()=>S?x&&y:y,[y,x,S]),K=(0,we.useCallback)(async()=>{if(e(),!v)return void W();if(!H())return r(Ws.inactive),void Y();const t=V();if(!t&&f&&C&&S)return void W();if(!t&&f&&!S)return void W();if(!c&&(j||t))return void r(Ws.askConsent);I(!0);const{type:s,payload:i}=await k({endpoint:g,isWooProductEntity:S}),o=429===(null==i?void 0:i.errorCode)&&!(null!=i&&i.errorIdentifier)&&0===(null==i?void 0:i.missingLicenses.length),n=429===(null==i?void 0:i.errorCode)&&"USAGE_LIMIT_REACHED"===(null==i?void 0:i.errorIdentifier)||i.count>=i.limit;I(!1),o?W():403!==(null==i?void 0:i.errorCode)||!j&&!t?s!==js||429===(null==i?void 0:i.errorCode)||403===(null==i?void 0:i.errorCode)?s===js&&429===(null==i?void 0:i.errorCode)&&t?W():!t&&!j||!t&&n?r(Ws.upsell):(t&&c&&r(Ws.generate),!t&&j&&!n&&c&&r(Ws.generate)):W():r(Ws.askConsent)},[e,f,j,c,v,H,Y,W,g,k,C,S,R]),Z=(0,we.useCallback)(async()=>{const{type:e,payload:t}=await k({endpoint:g,isWooProductEntity:S}),s=429===(null==t?void 0:t.errorCode)||t.count>=t.limit,i=V();!s||i?e!==js?r(Ws.generate):W():r(Ws.upsell)},[r,W,g,k,V,S]),X=(0,we.useCallback)(()=>{r(c?Ws.generate:Ws.askConsent)},[r,c]),J=(0,we.useMemo)(()=>"google"===n?"title"===o?(0,xe.__)("Generate SEO title","wordpress-seo"):(0,xe.__)("Generate meta description","wordpress-seo"):"social"===n||"twitter"===n?"title"===o?(0,xe.__)("Generate social title","wordpress-seo"):(0,xe.__)("Generate social description","wordpress-seo"):void 0,[n,o]);return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(i.Button,{type:"button",variant:"ai-secondary",size:"small",id:`yst-replacevar__use-ai-button__${o}__${a}`,onClick:K,disabled:p===q||!d,isLoading:R&&p===q,children:J}),(0,Se.jsxs)(qs,{...D,isOpen:[Ws.askConsent,Ws.upsell].includes(s),children:[s===Ws.askConsent&&(0,Se.jsx)(Ts,{onStartGenerating:Z}),s===Ws.upsell&&(0,Se.jsx)(Fs,{onActivateFreeSparks:X})]}),(0,Se.jsx)(Us,{...D,isOpen:s===Ws.generate,aiModalHelperLink:b,panelRef:M,title:l,children:s===Ws.generate&&(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(Kt.UsageCounter,{limit:h,requests:m,isSkeleton:!1,className:"yst-absolute yst-top-[-11px] yst-end-12 sm:yst-end-16",mentionBetaInTooltip:f,mentionResetInTooltip:f}),(0,Se.jsx)($s,{height:L,onFatalError:G})]})}),P&&(0,Se.jsx)(zt,{isOpen:!0,errorCode:P.errorCode,errorIdentifier:P.errorIdentifier,invalidSubscriptions:P.invalidSubscriptions,errorMessage:P.errorMessage,showActions:!0,onRetry:U,onClose:F})]})};Bs.propTypes={onUseAi:te().func.isRequired};const Gs=({title:e,description:s,status:r,titleForLength:o,showPreviewSkeleton:n,showLengthProgress:a})=>{const l=(0,t.useSelect)(e=>e(re).getSnippetEditorMode(),[]),[c,d]=(0,we.useState)(l),{editType:u}=ms(),p=gs(),m=(({editType:e,title:s,description:r})=>{const i=(0,t.useSelect)(e=>e(re).getDateFromSettings(),[]),o=(0,t.useSelect)(e=>e(re).getContentLocale(),[]),n=(0,t.useSelect)(e=>e(re).isCornerstoneContent(),[]),a=(0,t.useSelect)(e=>e(re).getIsTerm(),[]);return(0,we.useMemo)(()=>e===le?(0,fs.getDescriptionProgress)(r,i,n,a,o):(0,fs.getTitleProgress)(s),[e,s,r,i,n,a,o])})({editType:u,title:o,description:s});return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)(fs.ModeSwitcher,{onChange:d,active:c,id:`yst-ai-google-preview-mode-switcher-${p}`,disabled:r===me.loading}),n?(0,Se.jsx)(zs,{}):(0,Se.jsx)(Hs,{mode:c,title:e,description:s}),(0,Se.jsxs)("div",{className:"yst-pt-4",children:[(0,Se.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:u===ae?(0,xe.__)("SEO title width","wordpress-seo"):(0,xe.__)("Meta description length","wordpress-seo")}),(0,Se.jsx)(Ys,{className:"yst-mt-2",progress:a?m.actual:0,min:0,max:m.max,score:m.score})]})]})};Gs.propTypes={title:te().string.isRequired,description:te().string.isRequired,status:te().oneOf(Object.keys(me)).isRequired,titleForLength:te().string.isRequired,showPreviewSkeleton:te().bool.isRequired,showLengthProgress:te().bool.isRequired};const Ds=/mobi/i,Hs=({mode:e,title:s,description:r})=>{var i,n;const a=(0,t.useSelect)(e=>e(re).getBaseUrlFromSettings(),[]),l=(0,t.useSelect)(e=>e(re).getSnippetEditorData().slug||"",[]),c=(0,t.useSelect)(e=>e(re).getDateFromSettings(),[]),d=(0,t.useSelect)(e=>e(re).getFocusKeyphrase(),[]),u=(0,t.useSelect)(e=>e(re).getSnippetEditorPreviewImageUrl(),[]),p=(0,t.useSelect)(e=>e(re).getSiteIconUrlFromSettings(),[]),m=(0,t.useSelect)(e=>e(re).getShoppingData(),[]),h=(0,t.useSelect)(e=>e(re).getSnippetEditorWordsToHighlight(),[]),g=(0,t.useSelect)(e=>e(re).getSiteName(),[]),y=(0,t.useSelect)(e=>e(re).getContentLocale(),[]),x=(0,we.useMemo)(()=>a+l,[a,l]),w=(0,we.useMemo)(()=>{var e,t;return Ds.test(null===(e=window)||void 0===e||null===(t=e.navigator)||void 0===t?void 0:t.userAgent)},[null===(i=window)||void 0===i||null===(n=i.navigator)||void 0===n?void 0:n.userAgent]);return(0,Se.jsx)("div",{className:`yst-ai-generator-preview-section ${e}${w?" yst-user-agent__mobile":""}`,children:(0,Se.jsx)(fs.SnippetPreview,{title:s,description:r,mode:e,url:x,keyword:d,date:c,faviconSrc:p,mobileImageSrc:u,wordsToHighlight:h,siteName:g,locale:y,shoppingData:m,onMouseUp:o.noop})})};Hs.propTypes={mode:te().oneOf(Object.keys({mobile:"mobile",desktop:"desktop"})).isRequired,title:te().string.isRequired,description:te().string.isRequired};const zs=()=>(0,Se.jsxs)("div",{className:"yst-max-w-[400px] yst-py-4 yst-px-3 yst-border yst-rounded-lg yst-w-full yst-mx-auto",children:[(0,Se.jsxs)("div",{className:"yst-flex yst-gap-x-3",children:[(0,Se.jsx)(i.SkeletonLoader,{className:"yst-flex-shrink-0 yst-h-7 yst-w-7 yst-rounded-full"}),(0,Se.jsxs)("div",{className:"yst-flex yst-flex-col yst-w-full yst-gap-y-1",children:[(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-2.5 yst-w-10/12"})]})]}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-4 yst-w-full yst-mt-6 yst-mb-4"}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-full"}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-10/12 yst-mt-2.5"})]}),Ys=({className:e="",progress:t,max:s,score:r})=>{const o=(0,we.useMemo)(()=>(e=>e>=7?"yst-score-good":e>=5?"yst-score-ok":"yst-score-bad")(r),[r]);return(0,Se.jsx)(i.ProgressBar,{className:De()("yst-length-progress-bar",o,e),progress:t,min:0,max:s})};Ys.propTypes={className:te().string,progress:te().number.isRequired,max:te().number.isRequired,score:te().number.isRequired};const Vs=({title:e,description:t,showPreviewSkeleton:s})=>(0,Se.jsxs)("div",{children:[(0,Se.jsx)("div",{className:"yst-flex yst-mb-6",children:(0,Se.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:(0,xe.__)("Social preview","wordpress-seo")})}),s?(0,Se.jsx)(zr,{}):(0,Se.jsx)(Hr,{title:e,description:t})]});Vs.propTypes={title:te().string.isRequired,description:te().string.isRequired,showPreviewSkeleton:te().bool.isRequired};const Ks=window.yoast.styledComponents;var Zs=s.n(Ks);const Xs=Zs().p` color: #606770; flex-shrink: 0; font-size: 12px; line-height: 16px; overflow: hidden; padding: 0; text-overflow: ellipsis; text-transform: uppercase; white-space: nowrap; margin: 0; position: ${e=>"landscape"===e.mode?"relative":"static"}; `,Js=e=>{const{siteUrl:t}=e;return(0,Se.jsxs)(Le.Fragment,{children:[(0,Se.jsx)("span",{className:"screen-reader-text",children:t}),(0,Se.jsx)(Xs,{"aria-hidden":"true",children:(0,Se.jsx)("span",{children:t})})]})};Js.propTypes={siteUrl:te().string.isRequired};const Qs=Js,er=window.yoast.socialMetadataForms,tr=window.yoast.styleGuide,sr=Zs().img` && { max-width: ${e=>e.width}px; height: ${e=>e.height}px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); max-width: none; } `,rr=Zs().img` && { height: 100%; position: absolute; width: 100%; object-fit: cover; } `,ir=Zs().div` padding-bottom: ${e=>e.aspectRatio}%; `,or=({imageProps:e,width:t,height:s,imageMode:r="landscape"})=>"landscape"===r?(0,Se.jsx)(ir,{aspectRatio:e.aspectRatio,children:(0,Se.jsx)(rr,{src:e.src,alt:e.alt})}):(0,Se.jsx)(sr,{src:e.src,alt:e.alt,width:t,height:s,imageProperties:e});function nr(e,t,s){return"landscape"===s?{widthRatio:t.width/e.landscapeWidth,heightRatio:t.height/e.landscapeHeight}:"portrait"===s?{widthRatio:t.width/e.portraitWidth,heightRatio:t.height/e.portraitHeight}:{widthRatio:t.width/e.squareWidth,heightRatio:t.height/e.squareHeight}}function ar(e,t){return t.widthRatio<=t.heightRatio?{width:Math.round(e.width/t.widthRatio),height:Math.round(e.height/t.widthRatio)}:{width:Math.round(e.width/t.heightRatio),height:Math.round(e.height/t.heightRatio)}}async function lr(e,t,s=!1){const r=await function(e){return new Promise((t,s)=>{const r=new Image;r.onload=()=>{t({width:r.width,height:r.height})},r.onerror=s,r.src=e})}(e);let i=s?"landscape":"square";"Facebook"===t&&(i=(0,er.determineFacebookImageMode)(r));const o=function(e){return"Twitter"===e?er.TWITTER_IMAGE_SIZES:er.FACEBOOK_IMAGE_SIZES}(t),n=function(e,t,s){return"square"===s&&t.width===t.height?{width:e.squareWidth,height:e.squareHeight}:ar(t,nr(e,t,s))}(o,r,i);return{mode:i,height:n.height,width:n.width}}async function cr(e,t,s=!1){try{return{imageProperties:await lr(e,t,s),status:"loaded"}}catch(e){return{imageProperties:null,status:"errored"}}}or.propTypes={imageProps:te().shape({src:te().string.isRequired,alt:te().string.isRequired,aspectRatio:te().number.isRequired}).isRequired,width:te().number.isRequired,height:te().number.isRequired,imageMode:te().string};const dr=Zs().div` position: relative; ${e=>"landscape"===e.mode?`max-width: ${e.dimensions.width}`:`min-width: ${e.dimensions.width}; height: ${e.dimensions.height}`}; overflow: hidden; background-color: ${tr.colors.$color_white}; `,ur=Zs().div` box-sizing: border-box; max-width: ${er.FACEBOOK_IMAGE_SIZES.landscapeWidth}px; height: ${er.FACEBOOK_IMAGE_SIZES.landscapeHeight}px; background-color: ${tr.colors.$color_grey}; border-style: dashed; border-width: 1px; // We're not using standard colors to increase contrast for accessibility. color: #006DAC; // We're not using standard colors to increase contrast for accessibility. background-color: #f1f1f1; display: flex; justify-content: center; align-items: center; text-decoration: underline; font-size: 14px; cursor: pointer; `;class pr extends Le.Component{constructor(e){super(e),this.state={imageProperties:null,status:"loading"},this.socialMedium="Facebook",this.handleFacebookImage=this.handleFacebookImage.bind(this),this.setState=this.setState.bind(this)}async handleFacebookImage(){try{const e=await cr(this.props.src,this.socialMedium);this.setState(e),this.props.onImageLoaded(e.imageProperties.mode||"landscape")}catch(e){this.setState(e),this.props.onImageLoaded("landscape")}}componentDidUpdate(e){e.src!==this.props.src&&this.handleFacebookImage()}componentDidMount(){this.handleFacebookImage()}retrieveContainerDimensions(e){switch(e){case"square":return{height:er.FACEBOOK_IMAGE_SIZES.squareHeight+"px",width:er.FACEBOOK_IMAGE_SIZES.squareWidth+"px"};case"portrait":return{height:er.FACEBOOK_IMAGE_SIZES.portraitHeight+"px",width:er.FACEBOOK_IMAGE_SIZES.portraitWidth+"px"};case"landscape":return{height:er.FACEBOOK_IMAGE_SIZES.landscapeHeight+"px",width:er.FACEBOOK_IMAGE_SIZES.landscapeWidth+"px"}}}render(){const{imageProperties:e,status:t}=this.state;if("loading"===t||""===this.props.src||"errored"===t)return(0,Se.jsx)(ur,{onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,xe.__)("Select image","wordpress-seo")});const s=this.retrieveContainerDimensions(e.mode);return(0,Se.jsx)(dr,{mode:e.mode,dimensions:s,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,onClick:this.props.onImageClick,children:(0,Se.jsx)(or,{imageProps:{src:this.props.src,alt:this.props.alt,aspectRatio:er.FACEBOOK_IMAGE_SIZES.aspectRatio},width:e.width,height:e.height,imageMode:e.mode})})}}pr.propTypes={src:te().string,alt:te().string,onImageLoaded:te().func,onImageClick:te().func,onMouseEnter:te().func,onMouseLeave:te().func},pr.defaultProps={src:"",alt:"",onImageLoaded:o.noop,onImageClick:o.noop,onMouseEnter:o.noop,onMouseLeave:o.noop};const mr=pr,hr=Zs().span` line-height: ${20}px; min-height : ${20}px; color: #1d2129; font-weight: 600; overflow: hidden; font-size: 16px; margin: 3px 0 0; letter-spacing: normal; white-space: normal; flex-shrink: 0; cursor: pointer; display: -webkit-box; -webkit-line-clamp: ${e=>e.lineCount}; -webkit-box-orient: vertical; overflow: hidden; `,gr=Zs().p` line-height: ${16}px; min-height : ${16}px; color: #606770; font-size: 14px; padding: 0; text-overflow: ellipsis; margin: 3px 0 0 0; display: -webkit-box; cursor: pointer; -webkit-line-clamp: ${e=>e.lineCount}; -webkit-box-orient: vertical; overflow: hidden; @media all and ( max-width: ${e=>e.maxWidth} ) { display: none; } `,yr=e=>{switch(e){case"landscape":return"527px";case"square":case"portrait":return"369px";default:return"476px"}},xr=Zs().div` box-sizing: border-box; display: flex; flex-direction: ${e=>"landscape"===e.mode?"column":"row"}; background-color: #f2f3f5; max-width: 527px; `,wr=Zs().div` box-sizing: border-box; background-color: #f2f3f5; margin: 0; padding: 10px 12px; position: relative; border-bottom: ${e=>"landscape"===e.mode?"":"1px solid #dddfe2"}; border-top: ${e=>"landscape"===e.mode?"":"1px solid #dddfe2"}; border-right: ${e=>"landscape"===e.mode?"":"1px solid #dddfe2"}; border: ${e=>"landscape"===e.mode?"1px solid #dddfe2":""}; display: flex; flex-direction: column; flex-grow: 1; justify-content: ${e=>"landscape"===e.mode?"flex-start":"center"}; font-size: 12px; overflow: hidden; `;class fr extends Le.Component{constructor(e){super(e),this.state={imageMode:null,maxLineCount:0,descriptionLineCount:0},this.facebookTitleRef=Te().createRef(),this.onImageLoaded=this.onImageLoaded.bind(this),this.onImageEnter=this.props.onMouseHover.bind(this,"image"),this.onTitleEnter=this.props.onMouseHover.bind(this,"title"),this.onDescriptionEnter=this.props.onMouseHover.bind(this,"description"),this.onLeave=this.props.onMouseHover.bind(this,""),this.onSelectTitle=this.props.onSelect.bind(this,"title"),this.onSelectDescription=this.props.onSelect.bind(this,"description")}onImageLoaded(e){this.setState({imageMode:e})}getTitleLineCount(){return this.facebookTitleRef.current.offsetHeight/20}maybeSetMaxLineCount(){const{imageMode:e,maxLineCount:t}=this.state,s="landscape"===e?2:5;s!==t&&this.setState({maxLineCount:s})}maybeSetDescriptionLineCount(){const{descriptionLineCount:e,maxLineCount:t,imageMode:s}=this.state,r=this.getTitleLineCount();let i=t-r;"portrait"===s&&(i=5===r?0:4),i!==e&&this.setState({descriptionLineCount:i})}componentDidUpdate(){this.maybeSetMaxLineCount(),this.maybeSetDescriptionLineCount()}render(){const{imageMode:e,maxLineCount:t,descriptionLineCount:s}=this.state;return(0,Se.jsxs)(xr,{id:"facebookPreview",mode:e,children:[(0,Se.jsx)(mr,{src:this.props.imageUrl||this.props.imageFallbackUrl,alt:this.props.alt,onImageLoaded:this.onImageLoaded,onImageClick:this.props.onImageClick,onMouseEnter:this.onImageEnter,onMouseLeave:this.onLeave}),(0,Se.jsxs)(wr,{mode:e,children:[(0,Se.jsx)(Qs,{siteUrl:this.props.siteUrl,mode:e}),(0,Se.jsx)(hr,{ref:this.facebookTitleRef,onMouseEnter:this.onTitleEnter,onMouseLeave:this.onLeave,onClick:this.onSelectTitle,lineCount:t,children:this.props.title}),s>0&&(0,Se.jsx)(gr,{maxWidth:yr(e),onMouseEnter:this.onDescriptionEnter,onMouseLeave:this.onLeave,onClick:this.onSelectDescription,lineCount:s,children:this.props.description})]})]})}}fr.propTypes={siteUrl:te().string.isRequired,title:te().string.isRequired,description:te().string,imageUrl:te().string,imageFallbackUrl:te().string,alt:te().string,onSelect:te().func,onImageClick:te().func,onMouseHover:te().func},fr.defaultProps={description:"",alt:"",imageUrl:"",imageFallbackUrl:"",onSelect:()=>{},onImageClick:()=>{},onMouseHover:()=>{}};const vr=fr,br=Zs().div` text-transform: lowercase; color: rgb(83, 100, 113); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; fill: currentcolor; display: flex; flex-direction: row; align-items: flex-end; `,Sr=e=>(0,Se.jsx)(br,{children:(0,Se.jsx)("span",{children:e.siteUrl})});Sr.propTypes={siteUrl:te().string.isRequired};const jr=Sr,Cr=(e,t=!0)=>e?`\n\t\t\tmax-width: ${er.TWITTER_IMAGE_SIZES.landscapeWidth}px;\n\t\t\t${t?"border-bottom: 1px solid #E1E8ED;":""}\n\t\t\tborder-radius: 14px 14px 0 0;\n\t\t\t`:`\n\t\twidth: ${er.TWITTER_IMAGE_SIZES.squareWidth}px;\n\t\t${t?"border-right: 1px solid #E1E8ED;":""}\n\t\tborder-radius: 14px 0 0 14px;\n\t\t`,kr=Zs().div` position: relative; box-sizing: content-box; overflow: hidden; background-color: #e1e8ed; flex-shrink: 0; ${e=>Cr(e.isLarge)} `,_r=Zs().div` display: flex; justify-content: center; align-items: center; box-sizing: border-box; max-width: 100%; margin: 0; padding: 1em; text-align: center; font-size: 1rem; ${e=>Cr(e.isLarge,!1)} `,Er=Zs()(_r)` ${e=>e.isLarge&&`height: ${er.TWITTER_IMAGE_SIZES.landscapeHeight}px;`} border-top-left-radius: 14px; ${e=>e.isLarge?"border-top-right-radius":"border-bottom-left-radius"}: 14px; border-style: dashed; border-width: 1px; // We're not using standard colors to increase contrast for accessibility. color: #006DAC; // We're not using standard colors to increase contrast for accessibility. background-color: #f1f1f1; text-decoration: underline; font-size: 14px; cursor: pointer; `;class Rr extends Te().Component{constructor(e){super(e),this.state={status:"loading"},this.socialMedium="Twitter",this.handleTwitterImage=this.handleTwitterImage.bind(this),this.setState=this.setState.bind(this)}async handleTwitterImage(){if(null===this.props.src)return;const e=await cr(this.props.src,this.socialMedium,this.props.isLarge);this.setState(e)}componentDidUpdate(e){e.src!==this.props.src&&this.handleTwitterImage()}componentDidMount(){this.handleTwitterImage()}render(){const{status:e,imageProperties:t}=this.state;return"loading"===e||""===this.props.src||"errored"===e?(0,Se.jsx)(Er,{isLarge:this.props.isLarge,onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,xe.__)("Select image","wordpress-seo")}):(0,Se.jsx)(kr,{isLarge:this.props.isLarge,onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,Se.jsx)(or,{imageProps:{src:this.props.src,alt:this.props.alt,aspectRatio:er.TWITTER_IMAGE_SIZES.aspectRatio},width:t.width,height:t.height,imageMode:t.mode})})}}Rr.propTypes={isLarge:te().bool.isRequired,src:te().string,alt:te().string,onImageClick:te().func,onMouseEnter:te().func,onMouseLeave:te().func},Rr.defaultProps={src:"",alt:"",onMouseEnter:o.noop,onImageClick:o.noop,onMouseLeave:o.noop};const Ir=Zs().div` display: flex; flex-direction: column; padding: 12px; justify-content: center; margin: 0; box-sizing: border-box; flex: auto; min-width: 0px; gap:2px; > * { line-height:20px; min-height:20px; font-size:15px; } `,Lr=e=>(0,Se.jsx)(Ir,{children:e.children});Lr.propTypes={children:te().array.isRequired};const Tr=Lr,Ar=Zs().p` white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; color: rgb(15, 20, 25); cursor: pointer; `,Mr=Zs().p` max-height: 55px; overflow: hidden; text-overflow: ellipsis; margin: 0; color: rgb(83, 100, 113); display: -webkit-box; cursor: pointer; -webkit-line-clamp: 2; -webkit-box-orient: vertical; @media all and ( max-width: ${er.TWITTER_IMAGE_SIZES.landscapeWidth}px ) { display: none; } `,Pr=Zs().div` font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif; font-size: 15px; font-weight: 400; line-height: 20px; max-width: 507px; border: 1px solid #E1E8ED; box-sizing: border-box; border-radius: 14px; color: #292F33; background: #FFFFFF; text-overflow: ellipsis; display: flex; &:hover { background: #f5f8fa; border: 1px solid rgba(136,153,166,.5); } `,Nr=Zs()(Pr)` flex-direction: column; max-height: 370px; `,Or=Zs()(Pr)` flex-direction: row; height: 125px; `;class $r extends Le.Component{constructor(e){super(e),this.onImageEnter=this.props.onMouseHover.bind(this,"image"),this.onTitleEnter=this.props.onMouseHover.bind(this,"title"),this.onDescriptionEnter=this.props.onMouseHover.bind(this,"description"),this.onLeave=this.props.onMouseHover.bind(this,""),this.onSelectTitle=this.props.onSelect.bind(this,"title"),this.onSelectDescription=this.props.onSelect.bind(this,"description")}render(){const{isLarge:e,imageUrl:t,imageFallbackUrl:s,alt:r,title:i,description:o,siteUrl:n}=this.props,a=e?Nr:Or;return(0,Se.jsxs)(a,{id:"twitterPreview",children:[(0,Se.jsx)(Rr,{src:t||s,alt:r,isLarge:e,onImageClick:this.props.onImageClick,onMouseEnter:this.onImageEnter,onMouseLeave:this.onLeave}),(0,Se.jsxs)(Tr,{children:[(0,Se.jsx)(jr,{siteUrl:n}),(0,Se.jsx)(Ar,{onMouseEnter:this.onTitleEnter,onMouseLeave:this.onLeave,onClick:this.onSelectTitle,children:i}),(0,Se.jsx)(Mr,{onMouseEnter:this.onDescriptionEnter,onMouseLeave:this.onLeave,onClick:this.onSelectDescription,children:o})]})]})}}$r.propTypes={siteUrl:te().string.isRequired,title:te().string.isRequired,description:te().string,isLarge:te().bool,imageUrl:te().string,imageFallbackUrl:te().string,alt:te().string,onSelect:te().func,onImageClick:te().func,onMouseHover:te().func},$r.defaultProps={description:"",alt:"",imageUrl:"",imageFallbackUrl:"",onSelect:()=>{},onImageClick:()=>{},onMouseHover:()=>{},isLarge:!0};const Fr=$r,Ur=window.yoast.componentsNew,qr=window.yoast.replacementVariableEditor;class Wr extends Le.Component{constructor(e){super(e),this.state={activeField:"",hoveredField:""},this.SocialPreview="Social"===e.socialMediumName?vr:Fr,this.setHoveredField=this.setHoveredField.bind(this),this.setActiveField=this.setActiveField.bind(this),this.setEditorRef=this.setEditorRef.bind(this),this.setEditorFocus=this.setEditorFocus.bind(this)}setHoveredField(e){e!==this.state.hoveredField&&this.setState({hoveredField:e})}setActiveField(e){e!==this.state.activeField&&this.setState({activeField:e},()=>this.setEditorFocus(e))}setEditorFocus(e){switch(e){case"title":this.titleEditorRef.focus();break;case"description":this.descriptionEditorRef.focus()}}setEditorRef(e,t){switch(e){case"title":this.titleEditorRef=t;break;case"description":this.descriptionEditorRef=t}}render(){const{onDescriptionChange:e,onTitleChange:t,onSelectImageClick:s,onRemoveImageClick:r,socialMediumName:i,imageWarnings:o,siteUrl:n,description:a,descriptionInputPlaceholder:l,descriptionPreviewFallback:c,imageUrl:d,imageFallbackUrl:u,alt:p,title:m,titleInputPlaceholder:h,titlePreviewFallback:g,replacementVariables:y,recommendedReplacementVariables:x,applyReplacementVariables:w,onReplacementVariableSearchChange:f,isPremium:v,isLarge:b,socialPreviewLabel:S,idSuffix:j,activeMetaTabId:C}=this.props,k=w({title:m||g,description:a||c});return(0,Se.jsxs)(Te().Fragment,{children:[S&&(0,Se.jsx)(Ur.SimulatedLabel,{children:S}),(0,Se.jsx)(this.SocialPreview,{onMouseHover:this.setHoveredField,onSelect:this.setActiveField,onImageClick:s,siteUrl:n,title:k.title,description:k.description,imageUrl:d,imageFallbackUrl:u,alt:p,isLarge:b,activeMetaTabId:C}),(0,Se.jsx)(er.SocialMetadataPreviewForm,{onDescriptionChange:e,socialMediumName:i,title:m,titleInputPlaceholder:h,onRemoveImageClick:r,imageSelected:!!d,imageUrl:d,imageFallbackUrl:u,onTitleChange:t,onSelectImageClick:s,description:a,descriptionInputPlaceholder:l,imageWarnings:o,replacementVariables:y,recommendedReplacementVariables:x,onReplacementVariableSearchChange:f,onMouseHover:this.setHoveredField,hoveredField:this.state.hoveredField,onSelect:this.setActiveField,activeField:this.state.activeField,isPremium:v,setEditorRef:this.setEditorRef,idSuffix:j})]})}}Wr.propTypes={title:te().string.isRequired,onTitleChange:te().func.isRequired,description:te().string.isRequired,onDescriptionChange:te().func.isRequired,imageUrl:te().string.isRequired,imageFallbackUrl:te().string.isRequired,onSelectImageClick:te().func.isRequired,onRemoveImageClick:te().func.isRequired,socialMediumName:te().string.isRequired,alt:te().string,isPremium:te().bool,imageWarnings:te().array,isLarge:te().bool,siteUrl:te().string,descriptionInputPlaceholder:te().string,titleInputPlaceholder:te().string,descriptionPreviewFallback:te().string,titlePreviewFallback:te().string,replacementVariables:qr.replacementVariablesShape,recommendedReplacementVariables:qr.recommendedReplacementVariablesShape,applyReplacementVariables:te().func,onReplacementVariableSearchChange:te().func,socialPreviewLabel:te().string,idSuffix:te().string,activeMetaTabId:te().string},Wr.defaultProps={imageWarnings:[],recommendedReplacementVariables:[],replacementVariables:[],isPremium:!1,isLarge:!0,siteUrl:"",descriptionInputPlaceholder:"",titleInputPlaceholder:"",descriptionPreviewFallback:"",titlePreviewFallback:"",alt:"",applyReplacementVariables:e=>e,onReplacementVariableSearchChange:null,socialPreviewLabel:"",idSuffix:"",activeMetaTabId:""};const Br={},Gr=(e,t,{log:s=console.warn}={})=>{Br[e]||(Br[e]=!0,s(t))},Dr=(e,t=o.noop)=>{const s={};for(const r in e)Object.hasOwn(e,r)&&Object.defineProperty(s,r,{set:s=>{e[r]=s,t("set",r,s)},get:()=>(t("get",r),e[r])});return s};Dr({squareWidth:125,squareHeight:125,landscapeWidth:506,landscapeHeight:265,aspectRatio:50.2},(e,t)=>Gr(`@yoast/social-metadata-previews/TWITTER_IMAGE_SIZES/${e}/${t}`,`[@yoast/social-metadata-previews] "TWITTER_IMAGE_SIZES.${t}" is deprecated and will be removed in the future, please use this from @yoast/social-metadata-forms instead.`)),Dr({squareWidth:158,squareHeight:158,landscapeWidth:527,landscapeHeight:273,portraitWidth:158,portraitHeight:237,aspectRatio:52.2,largeThreshold:{width:446,height:233}},(e,t)=>Gr(`@yoast/social-metadata-previews/FACEBOOK_IMAGE_SIZES/${e}/${t}`,`[@yoast/social-metadata-previews] "FACEBOOK_IMAGE_SIZES.${t}" is deprecated and will be removed in the future, please use this from @yoast/social-metadata-forms instead.`));const Hr=({title:e,description:s})=>{const r=(0,t.useSelect)(e=>e(re).getSiteUrl(),[]),i=(0,t.useSelect)(e=>e(re).getFacebookImageUrl(),[]),n=(0,t.useSelect)(e=>e(re).getEditorDataImageFallback(),[]),a=(0,t.useSelect)(e=>e(re).getFacebookAltText(),[]);return(0,Se.jsx)("div",{className:"yst-ai-generator-preview-section",children:(0,Se.jsx)(vr,{title:e,description:s,siteUrl:r,imageUrl:i,imageFallbackUrl:n,alt:a,onSelect:o.noop,onImageClick:o.noop,onMouseHover:o.noop})})};Hr.propTypes={title:te().string.isRequired,description:te().string.isRequired};const zr=()=>(0,Se.jsxs)("div",{className:"yst-flex yst-flex-col yst-w-[527px] yst-border yst-mx-auto",children:[(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-[273px] yst-w-full yst-rounded-none yst-border yst-border-dashed"}),(0,Se.jsxs)("div",{className:"yst-w-full yst-p-4 yst-space-y-1",children:[(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-5 yst-w-10/12"}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-full"})]})]}),Yr=()=>(0,Se.jsxs)(i.Alert,{variant:"error",children:[(0,Se.jsx)("span",{className:"yst-block yst-font-medium",children:qt}),(0,Se.jsx)(Wt,{})]}),Vr=({children:e,onRetry:t})=>{const{onClose:s}=(0,i.useModalContext)();return(0,Se.jsxs)(we.Fragment,{children:[e,(0,Se.jsxs)("div",{className:"yst-mt-6 yst-mb-1 yst-flex yst-space-x-3 rtl:yst-space-x-reverse yst-place-content-end",children:[(0,Se.jsx)(i.Button,{variant:"secondary",onClick:s,children:(0,xe.__)("Close","wordpress-seo")}),(0,Se.jsx)(i.Button,{variant:"primary",onClick:t,children:(0,xe.__)("Try again","wordpress-seo")})]})]})};Vr.propTypes={children:te().node.isRequired,onRetry:te().func.isRequired};const Kr=({errorCode:e,errorIdentifier:t,invalidSubscriptions:s=[],showActions:r=!1,onRetry:i=o.noop,errorMessage:n=""})=>{switch(e){case 400:switch(t){case"AI_CONTENT_FILTER":return(0,Se.jsx)(ft,{});case"NOT_ENOUGH_CONTENT":return(0,Se.jsx)(ot,{});case"SITE_UNREACHABLE":return(0,Se.jsx)(Yr,{});case"WP_HTTP_REQUEST_ERROR":return r?(0,Se.jsx)(Vr,{onRetry:i,children:(0,Se.jsx)(St,{errorMessage:n})}):(0,Se.jsx)(St,{errorMessage:n});default:return r?(0,Se.jsx)(Vr,{onRetry:i,children:(0,Se.jsx)(st,{})}):(0,Se.jsx)(st,{})}case 402:return(0,Se.jsx)(mt,{invalidSubscriptions:s});case 408:return r?(0,Se.jsx)(Vr,{onRetry:i,children:(0,Se.jsx)(yt,{})}):(0,Se.jsx)(yt,{});case 429:return"USAGE_LIMIT_REACHED"===t?(0,Se.jsx)(mt,{invalidSubscriptions:s}):(0,Se.jsx)(dt,{});case 410:return(0,Se.jsx)(kt,{});default:return r?(0,Se.jsx)(Vr,{onRetry:i,children:(0,Se.jsx)(st,{})}):(0,Se.jsx)(st,{})}};Kr.propTypes={errorCode:te().number.isRequired,errorIdentifier:te().string.isRequired,invalidSubscriptions:te().array,showActions:te().bool,onRetry:te().func,errorMessage:te().string};const Zr=te().shape({value:te().string.isRequired,label:te().node.isRequired}),Xr=({id:e,name:t,suggestion:s,isChecked:r,onChange:i})=>{const o=(0,we.useCallback)(()=>i(s.value),[s,i]);return(0,Se.jsxs)("label",{htmlFor:e,className:De()("yst-flex yst-p-4 yst-items-center yst-border first:yst-rounded-t-md last:yst-rounded-b-md",r&&"yst-z-10 yst-border-primary-500"),children:[(0,Se.jsx)("input",{type:"radio",id:e,name:t,className:"yst-radio__input",value:s.value,checked:r,onChange:o}),(0,Se.jsx)("div",{className:De()("yst-label yst-radio__label yst-flex yst-flex-wrap yst-items-center",!r&&"yst-text-slate-600"),children:s.label})]})};Xr.propTypes={id:te().string.isRequired,name:te().string.isRequired,suggestion:Zr.isRequired,isChecked:te().bool.isRequired,onChange:te().func.isRequired};const Jr=({idSuffix:e,suggestions:t,selected:s,onChange:r})=>(0,Se.jsx)("div",{children:(0,Se.jsx)(i.RadioGroup,{className:"yst-suggestions-radio-group yst-flex yst-flex-col",id:`yst-ai-suggestions-radio-group__${e}`,children:t.map((t,i)=>(0,Se.jsx)(Xr,{id:`yst-ai-suggestions-radio-${e}__${i}`,name:`ai-suggestion__${e}`,isChecked:t.value===s,onChange:r,suggestion:t},`yst-ai-suggestions-radio-${e}__${i}`))})});Jr.propTypes={idSuffix:te().string.isRequired,suggestions:te().arrayOf(Zr).isRequired,selected:te().string.isRequired,onChange:te().func.isRequired};const Qr=[["yst-h-3 yst-w-full","yst-mt-2.5 yst-h-3 yst-w-9/12"],["yst-h-3 yst-w-full","yst-mt-2.5 yst-h-3 yst-w-7/12"],["yst-h-3 yst-w-full","yst-mt-2.5 yst-h-3 yst-w-10/12"],["yst-h-3 yst-w-full","yst-mt-2.5 yst-h-3 yst-w-11/12"],["yst-h-3 yst-w-full","yst-mt-2.5 yst-h-3 yst-w-8/12"]],ei=({suggestionClassNames:e=Qr})=>(0,Se.jsx)("div",{className:"yst-flex yst-flex-col yst--space-y-[1px]",children:e.map((e,t)=>(0,Se.jsxs)("div",{className:"yst-flex yst-p-4 yst-gap-x-3 yst-items-center yst-border first:yst-rounded-t-md last:yst-rounded-b-md",children:[(0,Se.jsx)("input",{type:"radio",disabled:!0,className:"yst-my-0.5"}),(0,Se.jsx)("div",{className:"yst-flex yst-flex-col yst-w-full",children:e.map((e,s)=>(0,Se.jsx)(i.SkeletonLoader,{className:e},`yst-ai-suggestion-radio-skeleton-${t}__${s}`))})]},`yst-ai-suggestion-radio-skeleton__${t}`))});ei.propTypes={suggestionClassNames:te().arrayOf(te().arrayOf(te().string))};const ti="ai_generator_tip_notification",si=()=>{const e=(0,t.useSelect)(e=>e(re).isAlertDismissed(ti),[]),s=(0,t.useSelect)(e=>e(re).getEditorDataContent(),[]),r=(0,t.useSelect)(e=>e(re).getIsWooProductEntity(),[]),[o,,,n]=(0,i.useToggleState)(!1),{editType:a,contentType:l}=ms(),{dismissAlert:c}=(0,t.useDispatch)(re),d=(0,we.useCallback)(()=>{c(ti)},[c]),u=(0,we.useMemo)(()=>a===le?(0,xe.__)("%1$sTip%2$s: Improve the accuracy of your generated AI descriptions by writing more content in your page.","wordpress-seo"):(0,xe.__)("%1$sTip%2$s: Improve the accuracy of your generated AI titles by writing more content in your page.","wordpress-seo") /* translators: %1$s and %2$s expand to opening and closing of a span in order to emphasise the word. */,[a]),p=(0,we.useMemo)(()=>((e,t)=>e||t===de?150:300)(r,l),[l,r]),m=(0,we.useMemo)(()=>(e=>Zt.languageProcessing.sanitizeString(e||"").length)(s),[s]);return e||o||m>p?null:(0,Se.jsxs)(i.Notifications.Notification,{id:"ai-generator-content-tip",variant:"info",dismissScreenReaderLabel:(0,xe.__)("Dismiss","wordpress-seo"),children:[fe((0,xe.sprintf)(u,"<span>","</span>"),{span:(0,Se.jsx)("span",{className:"yst-font-medium yst-text-slate-800"})}),(0,Se.jsxs)("div",{className:"yst-flex yst-mt-3 yst--ms-3 yst-gap-1",children:[(0,Se.jsx)(i.Button,{type:"button",variant:"tertiary",onClick:d,children:(0,xe.__)("Don’t show again","wordpress-seo")}),(0,Se.jsx)(i.Button,{type:"button",variant:"tertiary",className:"yst-text-slate-800",onClick:n,children:(0,xe.__)("Dismiss","wordpress-seo")})]})]})},ri=({title:e,description:t,showPreviewSkeleton:s})=>(0,Se.jsxs)("div",{children:[(0,Se.jsx)("div",{className:"yst-flex yst-mb-6",children:(0,Se.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:(0,xe.__)("X preview","wordpress-seo")})}),s?(0,Se.jsx)(oi,{}):(0,Se.jsx)(ii,{title:e,description:t})]});ri.propTypes={title:te().string.isRequired,description:te().string.isRequired,showPreviewSkeleton:te().bool.isRequired};const ii=({title:e,description:s})=>{const r=(0,t.useSelect)(e=>e(re).getSiteUrl(),[]),i=(0,t.useSelect)(e=>e(re).getTwitterImageUrl(),[]),n=(0,t.useSelect)(e=>e(re).getFacebookImageUrl(),[]),a=(0,t.useSelect)(e=>e(re).getEditorDataImageFallback(),[]),l=(0,t.useSelect)(e=>e(re).getTwitterImageType(),[]),c=(0,t.useSelect)(e=>e(re).getTwitterAltText(),[]);return(0,Se.jsx)("div",{className:"yst-ai-generator-preview-section",children:(0,Se.jsx)(Fr,{title:e,description:s,siteUrl:r,imageUrl:i,imageFallbackUrl:n||a,isLarge:"summary"!==l,alt:c,onSelect:o.noop,onImageClick:o.noop,onMouseHover:o.noop})})};ii.propTypes={title:te().string.isRequired,description:te().string.isRequired};const oi=()=>(0,Se.jsxs)("div",{className:"yst-flex yst-flex-col yst-max-h-[370px] yst-w-[507px] yst-border yst-rounded-t-[14px] yst-overflow-hidden yst-mx-auto",children:[(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-[265px] yst-w-full yst-rounded-none yst-border yst-border-dashed"}),(0,Se.jsxs)("div",{className:"yst-w-full yst-p-4 yst-space-y-1",children:[(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-5 yst-w-10/12"}),(0,Se.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-full"})]})]}),ni="yst-mt-1 yst-mb-3",ai="yst-flex yst-justify-end yst--me-8 yst-gap-3 yst--ms-2",li=({onClose:e})=>(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)("p",{className:ni,children:(0,xe.__)("As long as this is a beta feature, you get unlimited sparks.","wordpress-seo")}),(0,Se.jsx)("div",{className:ai,children:(0,Se.jsx)(i.Button,{type:"button",variant:"primary",size:"small",onClick:e,children:(0,xe.__)("Got it!","wordpress-seo")})})]}),ci=({onClose:e,upsellLink:t,isWooProductEntity:s=!1,ctbId:r="f6a84663-465f-4cb5-8ba5-f7a6d72224b2"})=>{const o=(0,i.useSvgAria)();return(0,Se.jsxs)(Se.Fragment,{children:[(0,Se.jsx)("p",{className:ni,children:(0,xe.sprintf)(/* translators: %s expands to Yoast SEO Premium or Yoast WooCommerce SEO. */ /* translators: %s expands to Yoast SEO Premium or Yoast WooCommerce SEO. */ (0,xe.__)("Keep the momentum going, unlock unlimited sparks with %s!","wordpress-seo"),s?"Yoast WooCommerce SEO":"Yoast SEO Premium")}),(0,Se.jsxs)("div",{className:ai,children:[(0,Se.jsx)(i.Button,{type:"button",variant:"tertiary",size:"small",onClick:e,children:(0,xe.__)("Close","wordpress-seo")}),(0,Se.jsxs)(i.Button,{as:"a",size:"small",variant:"upsell",href:t,target:"_blank",rel:"noopener noreferrer","data-action":"load-nfd-ctb","data-ctb-id":r,children:[(0,Se.jsx)(Ce(),{className:"yst-w-4 yst-h-4 yst--ms-1 yst-me-2 yst-shrink-0",...o}),(0,xe.sprintf)(/* translators: %1$s expands to Yoast SEO Premium or Yoast WooCommerce SEO. */ /* translators: %1$s expands to Yoast SEO Premium or Yoast WooCommerce SEO. */ (0,xe.__)("Unlock with %1$s","wordpress-seo"),s?"Yoast WooCommerce SEO":"Yoast SEO Premium"),(0,Se.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */ (0,xe.__)("(Opens in a new browser tab)","wordpress-seo")})]})]})]})},di=({className:e=""})=>{const{isUsageCountLimitReached:s,usageCount:r,usageCountLimit:o,premiumUpsellLink:n,wooUpsellLink:a,isWooProductEntity:l,hasValidPremiumSubscription:c,hasValidWooSubscription:d}=(0,t.useSelect)(e=>{const t=e(se),s=e(re);return{isUsageCountLimitReached:t.isUsageCountLimitReached(),usageCount:t.selectUsageCount(),usageCountLimit:t.selectUsageCountLimit(),premiumUpsellLink:s.selectLink("https://yoa.st/ai-toast-out-of-free-sparks"),wooUpsellLink:s.selectLink("https://yoa.st/ai-toast-out-of-free-sparks-woo"),isWooProductEntity:s.getIsWooProductEntity(),hasValidPremiumSubscription:t.selectPremiumSubscription(),hasValidWooSubscription:t.selectWooCommerceSubscription()}},[]),u=(0,we.useMemo)(()=>c&&!l||l&&d&&c,[c,l,d]),[p,,m,,h]=(0,i.useToggleState)(r===o),g=Math.max(0,o-r);(0,we.useEffect)(()=>{m(u&&r===o||!u&&g<=5)},[r,o,u,s]);const y=(0,we.useMemo)(()=>l?a:n,[l,a,n]),x=(0,we.useMemo)(()=>l&&!d,[l,d]);return p&&(0,Se.jsx)(i.Notifications.Notification,{id:"ai-sparks-limit",className:e,variant:"info",dismissScreenReaderLabel:(0,xe.__)("Close","wordpress-seo"),title:u?(0,xe.sprintf)(/* translators: %s is the number of the sparks. */ /* translators: %s is the number of the sparks. */ (0,xe._n)("You've used %s spark this month.","You've used %s sparks this month.",r,"wordpress-seo"),r):g<=5&&!s?(0,xe.sprintf)(/* translators: %s is the number of the sparks. */ /* translators: %s is the number of the sparks. */ (0,xe._n)("%s free spark left!","%s free sparks left!",g,"wordpress-seo"),g):(0,xe.__)("You're out of free sparks!","wordpress-seo"),size:u?"default":"large",children:u?(0,Se.jsx)(li,{onClose:h}):(0,Se.jsx)(ci,{onClose:h,upsellLink:y,isWooUpsell:x})})};te().number.isRequired,te().string,te().string,te().object.isRequired,te().bool;const ui=()=>{const{setPromptContent:e}=(0,t.dispatch)(se);return()=>{(e=>{const s=(0,t.select)(re).getIsProduct(),r=(0,t.select)(re).getIsTerm(),i=(0,t.select)(re).getIsWooCommerceActive(),n=s&&i||r?150:300,a=(0,o.get)(window,"YoastSEO.analysis.worker.runResearch",o.noop),l=(0,o.get)(window,"YoastSEO.analysis.collectData",!1);a("getParagraphs",l?Zt.Paper.parse(l()):null).then(t=>{e(((e,t)=>{let s="",r=0;for(const o of Array.isArray(e)?e:[]){var i;const e=as(null!==(i=o.sentences)&&void 0!==i?i:[],r,t);if(s+=e.text,r=e.tokenCount,e.exceeded)break;s+=" ",r+=1}return s.trimEnd()||"."})((0,o.get)(t,"result",[]),n))})})(e)}},pi=()=>{ui(),(0,t.subscribe)((0,o.debounce)((()=>{const{getEditorDataContent:e}=(0,t.select)(re),s=ui();return setTimeout(s,1500),((e,t)=>{let s=e();return()=>{const r=e();(0,o.isEqual)(r,s)||(s=r,t((0,o.clone)(r)))}})(e,s)})(),1500,{maxWait:3e3}))};let mi=!1;const hi=()=>{mi||(mi=!0)},gi=(e,t)=>mi?(os(t)&&e.push((0,xe.__)("Please enter a valid focus keyphrase.","wordpress-seo")),e):e,yi="appliedSuggestions",xi=(0,n.createSlice)({name:yi,initialState:{},reducers:{addAppliedSuggestion:(e,{payload:{editType:t,previewType:s,suggestion:r}})=>{e[s]={...e[s],[t]:r}}}}),wi=xi.getInitialState,fi={selectAppliedSuggestions:e=>(0,o.get)(e,yi,{})};fi.selectAppliedSuggestionFor=(0,n.createSelector)([fi.selectAppliedSuggestions,(e,t)=>t],(e,{editType:t,previewType:s})=>(0,o.get)(e,[s,t],""));const vi=xi.actions,bi=xi.reducer,Si="productSubscriptions",ji=(0,n.createSlice)({name:Si,initialState:{premiumSubscription:!1,wooCommerceSubscription:!1},reducers:{}}),Ci=ji.getInitialState,ki={selectProductSubscriptions:e=>(0,o.get)(e,Si,Ci()),selectPremiumSubscription:e=>(0,o.get)(e,`${Si}.premiumSubscription`),selectWooCommerceSubscription:e=>(0,o.get)(e,`${Si}.wooCommerceSubscription`)},_i=ji.actions,Ei=ji.reducer,Ri="promptContent",Ii=(0,n.createSlice)({name:Ri,initialState:{content:"",initialized:!1},reducers:{setPromptContent:(e,{payload:t})=>({content:t,initialized:!0})}}),Li=Ii.getInitialState,Ti={selectPromptContent:e=>(0,o.get)(e,`${Ri}.content`,""),selectPromptContentInitialized:e=>(0,o.get)(e,`${Ri}.initialized`,!1)},Ai=Ii.actions,Mi=Ii.reducer,Pi="endpoints",Ni=(0,n.createSlice)({name:Pi,initialState:{getSuggestions:"",bustSubscriptionCache:""},reducers:{}}),Oi=Ni.getInitialState,$i={selectGetSuggestionsEndpoint:e=>(0,o.get)(e,[Pi,"getSuggestions"],Ni.getInitialState().getSuggestions),selectBustSubscriptionCacheEndpoint:e=>(0,o.get)(e,[Pi,"bustSubscriptionCache"],Ni.getInitialState().bustSubscriptionCache)},Fi={...Ni.actions},Ui=Ni.reducer,qi="freeSparks",Wi="activateFreeSparks",Bi=(0,n.createSlice)({name:qi,initialState:{isFreeSparksActive:!1,endpoint:""},extraReducers:e=>{e.addCase(`${Wi}/${$}`,e=>{e.isFreeSparksActive=!0})}}),Gi=Bi.getInitialState,Di={selectFreeSparksActiveEndpoint:e=>(0,o.get)(e,[qi,"endpoint"],Bi.getInitialState().endpoint),selectIsFreeSparksActive:e=>(0,o.get)(e,[qi,"isFreeSparksActive"],Bi.getInitialState().isFreeSparksActive)},Hi={...Bi.actions,activateFreeSparks:function*({endpoint:e}){try{yield{type:Wi,payload:e}}catch(e){console.error("Error starting free sparks:",e)}return{type:`${Wi}/${$}`}}},zi={[Wi]:async({payload:e})=>g()({method:"POST",path:e})},Yi=Bi.reducer,Vi=window.wp.domReady,Ki=(s,{fieldId:r,type:o})=>{const n=(0,t.select)(re).getPostType(),a=function(e){return e.startsWith("yoast-google-preview")?ie:e.startsWith("social")?oe:e.startsWith("x-")?ne:void 0}(r);if(!a)return s;const l={isRtl:(0,t.select)(re).getPreference("isRtl")},c={editType:o,previewType:a,postType:n,contentType:(0,t.select)(re).getIsTerm()?"term":"post"};return s.push((0,Se.jsx)(e.Fill,{name:`yoast.replacementVariableEditor.additionalButtons.${r}`,children:(0,Se.jsx)(i.Root,{context:l,children:(0,Se.jsx)(ps,{value:c,children:(0,Se.jsx)(Bs,{onUseAi:hi})})})})),s};s.n(Vi)()(()=>{var e;null!==(e=window.wpseoScriptData)&&void 0!==e&&e.postType&&(()=>{const e=(0,o.get)(window,"wpseoAiGenerator.myyoastConnection",null);((e={})=>{(0,t.register)((e=>(0,t.createReduxStore)(se,{actions:{...b,...vi,..._i,...Ai,...Rs,...Hi,...Fi,...M},selectors:{...v,...fi,...ki,...Ti,...Es,...Di,...$i,...A},initialState:(0,o.merge)({},{[y]:f(),[yi]:wi(),[Si]:Ci(),[Ri]:Li(),[vs]:_s(),[qi]:Gi(),[Pi]:Oi(),[R]:L()},e),reducer:(0,t.combineReducers)({[y]:j,[yi]:bi,[Si]:Ei,[Ri]:Mi,[vs]:Ls,[qi]:Yi,[Pi]:Ui,[R]:P}),controls:{...S,...Is,...zi}}))(e))})({[y]:{hasConsent:"1"===(0,o.get)(window,"wpseoAiGenerator.hasConsent",!1),endpoint:(0,o.get)(window,"wpseoAiGenerator.endpoints.consent","")},[vs]:{endpoint:(0,o.get)(window,"wpseoAiGenerator.endpoints.getUsage","")},[Si]:(0,o.get)(window,"wpseoAiGenerator.productSubscriptions",{}),[qi]:{isFreeSparksActive:"1"===(0,o.get)(window,"wpseoAiGenerator.isFreeSparks",!1),endpoint:(0,o.get)(window,"wpseoAiGenerator.endpoints.freeSparks","")},[Pi]:{getSuggestions:(0,o.get)(window,"wpseoAiGenerator.endpoints.getSuggestions",""),bustSubscriptionCache:(0,o.get)(window,"wpseoAiGenerator.endpoints.bustSubscriptionCache","")},[R]:T(e)}),window.jQuery(window).on("YoastSEO:ready",()=>{pi()}),(0,r.addFilter)("yoast.replacementVariableEditor.additionalButtons","yoast/yoast-seo/AiGenerator",Ki),(0,r.addFilter)("yoast.focusKeyphrase.errors","yoast/yoast-seo/AiGenerator",gi),(0,r.addAction)("yoast.elementor.loaded","yoast/yoast-seo/AiGenerator",pi)})()})})()})();
Save
cmd:
run