PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | js/dist/ai-generator.js +66 -66 28.3 → trunk View file →
@@ -1,12 +1,12 @@
1 -(()=>{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=window.wp.apiFetch;var p=s.n(d);const u="hasConsent",h=`${u}/storeConsent`,m=(0,n.createSlice)({name:u,initialState:{hasConsent:!1,endpoint:""},reducers:{giveAiGeneratorConsent:(e,{payload:t})=>{e.hasConsent=t},setAiGeneratorConsentEndpoint:(e,{payload:t})=>{e.endpoint=t}}}),g=m.getInitialState,y={selectHasAiGeneratorConsent:e=>(0,o.get)(e,[u,"hasConsent"],m.getInitialState().hasConsent),selectAiGeneratorConsentEndpoint:e=>(0,o.get)(e,[u,"endpoint"],m.getInitialState().endpoint)},x={...m.actions,storeAiGeneratorConsent:function*(e,t){try{yield{type:h,payload:{consent:e,endpoint:t}}}catch(e){return!1}return yield{type:`${u}/giveAiGeneratorConsent`,payload:e},!0}},w={[h]:async({payload:e})=>await p()({path:e.endpoint,method:"POST",data:{consent:e.consent},parse:!1})},f=m.reducer,v=window.wp.url,b="linkParams",S=(0,n.createSlice)({name:b,initialState:{},reducers:{setLinkParams:(e,{payload:t})=>t}}),j=(S.getInitialState,{selectLinkParam:(e,t,s={})=>(0,o.get)(e,`${b}.${t}`,s),selectLinkParams:e=>(0,o.get)(e,b,{})});j.selectLink=(0,n.createSelector)([j.selectLinkParams,(e,t)=>t,(e,t,s={})=>s],(e,t,s)=>(0,v.addQueryArgs)(t,{...e,...s})),S.actions,S.reducer;const C=(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)}}),k=(C.getInitialState,C.actions,C.reducer,"request"),_="success",E="error",R="idle",I="loading",L="success",T="error",A="showPlay",M="askPermission",P="isPlaying",N=(0,n.createSlice)({name:"optInNotification",initialState:{seen:{}},reducers:{hideOptInNotification(e,t){const s=t.payload;e.seen[s]=!0}}}),O=(N.getInitialState,N.actions,N.reducer,"pluginUrl"),$=(0,n.createSlice)({name:O,initialState:"",reducers:{setPluginUrl:(e,{payload:t})=>t}}),F=($.getInitialState,{selectPluginUrl:e=>(0,o.get)(e,O,"")});F.selectImageLink=(0,n.createSelector)([F.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("/")),$.actions,$.reducer;const q="wistiaEmbedPermission",U=(0,n.createSlice)({name:q,initialState:{value:!1,status:R,error:{}},reducers:{setWistiaEmbedPermissionValue:(e,{payload:t})=>{e.value=Boolean(t)}},extraReducers:e=>{e.addCase(`${q}/${k}`,e=>{e.status=I}),e.addCase(`${q}/${_}`,(e,{payload:t})=>{e.status=L,e.value=Boolean(t&&t.value)}),e.addCase(`${q}/${E}`,(e,{payload:t})=>{e.status=T,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 W;U.getInitialState,U.actions,U.reducer;const B=(0,n.createSlice)({name:"documentTitle",initialState:(0,o.defaultTo)(null===(W=document)||void 0===W?void 0:W.title,""),reducers:{setDocumentTitle:(e,{payload:t})=>t}}),G=(B.getInitialState,B.actions,B.reducer,window.yoast.propTypes);var D=s.n(G);const H="yoast-seo/ai-generator",z="yoast-seo/editor",Y="google",V="social",K="twitter",Z="title",X="description",J="post",Q="term",ee={post:"title",term:"term_title"},te=(0,o.mapValues)(ee,e=>`%%${e}%%`),se={idle:"idle",loading:"loading",success:"success",error:"error"},re="success",ie="error",oe="abort",ne=window.wp.i18n,ae=window.wp.element,le=(e,t)=>{try{return(0,ae.createInterpolateElement)(e,t)}catch(t){return console.error("Error in translation for:",e,t),e}};var ce=s(6702),de=s.n(ce);const pe=window.ReactJSXRuntime;D().string.isRequired;var ue=s(2514),he=s.n(ue),me=s(818),ge=s.n(me);D().string.isRequired,D().string.isRequired,D().shape({src:D().string.isRequired,width:D().string,height:D().string}).isRequired,D().shape({value:D().bool.isRequired,status:D().string.isRequired,set:D().func.isRequired}).isRequired,D().string,D().string,D().string;const ye=({handleRefreshClick:e,supportLink:t})=>(0,pe.jsxs)("div",{className:"yst-flex yst-gap-2",children:[(0,pe.jsx)(i.Button,{onClick:e,children:(0,ne.__)("Refresh this page","wordpress-seo")}),(0,pe.jsx)(i.Button,{variant:"secondary",as:"a",href:t,target:"_blank",rel:"noopener",children:(0,ne.__)("Contact support","wordpress-seo")})]});ye.propTypes={handleRefreshClick:D().func.isRequired,supportLink:D().string.isRequired};const xe=({handleRefreshClick:e,supportLink:t})=>(0,pe.jsxs)("div",{className:"yst-grid yst-grid-cols-1 yst-gap-y-2",children:[(0,pe.jsx)(i.Button,{className:"yst-order-last",onClick:e,children:(0,ne.__)("Refresh this page","wordpress-seo")}),(0,pe.jsx)(i.Button,{variant:"secondary",as:"a",href:t,target:"_blank",rel:"noopener",children:(0,ne.__)("Contact support","wordpress-seo")})]});xe.propTypes={handleRefreshClick:D().func.isRequired,supportLink:D().string.isRequired};const we=({error:e,children:t=null})=>(0,pe.jsxs)("div",{role:"alert",className:"yst-max-w-screen-sm yst-p-8 yst-space-y-4",children:[(0,pe.jsx)(i.Title,{children:(0,ne.__)("Something went wrong. An unexpected error occurred.","wordpress-seo")}),(0,pe.jsx)("p",{children:(0,ne.__)("We're very sorry, but it seems like the following error has interrupted our application:","wordpress-seo")}),(0,pe.jsx)(i.Alert,{variant:"error",children:(null==e?void 0:e.message)||(0,ne.__)("Undefined error message.","wordpress-seo")}),(0,pe.jsx)("p",{children:(0,ne.__)("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]});we.propTypes={error:D().object.isRequired,children:D().node},we.VerticalButtons=xe,we.HorizontalButtons=ye;D().string,D().node.isRequired,D().node.isRequired,D().node,D().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 fe=s(1609),ve=s.n(fe);const be=window.ReactDOM;var Se,je,Ce;(je=Se||(Se={})).Pop="POP",je.Push="PUSH",je.Replace="REPLACE",function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"}(Ce||(Ce={})),new Set(["lazy","caseSensitive","path","id","index","children"]),Error;const ke=["post","put","patch","delete"],_e=(new Set(ke),["get",...ke]);new Set(_e),new Set([301,302,303,307,308]),new Set([307,308]),Symbol("deferred"),fe.Component,fe.startTransition,new Promise(()=>{}),fe.Component,new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);try{window.__reactRouterVersion="6"}catch(e){}var Ee,Re,Ie,Le;new Map,fe.startTransition,be.flushSync,fe.useId,"undefined"!=typeof window&&void 0!==window.document&&window.document.createElement,(Le=Ee||(Ee={})).UseScrollRestoration="useScrollRestoration",Le.UseSubmit="useSubmit",Le.UseSubmitFetcher="useSubmitFetcher",Le.UseFetcher="useFetcher",Le.useViewTransitionState="useViewTransitionState",(Ie=Re||(Re={})).UseFetcher="useFetcher",Ie.UseFetchers="useFetchers",Ie.UseScrollRestoration="useScrollRestoration",D().string.isRequired,D().string;const Te=({href:e,children:t=null,...s})=>(0,pe.jsxs)(i.Link,{target:"_blank",rel:"noopener noreferrer",...s,href:e,children:[t,(0,pe.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
2 -(0,ne.__)("(Opens in a new browser tab)","wordpress-seo")})]});Te.propTypes={href:D().string.isRequired,children:D().node};s(8738);(0,ne.__)("Create optimized SEO titles & meta descriptions in seconds","wordpress-seo"),(0,ne.__)("Apply AI suggestions to improve content in 1 click","wordpress-seo"),(0,ne.__)("Manage redirects with ease and without extra plugins","wordpress-seo"),(0,ne.__)("Optimize pages for multiple keywords with guidance","wordpress-seo"),(0,ne.__)("Add product details to help your listings stand out","wordpress-seo"),(0,ne.__)("Make sure search engines show the right version of your product page","wordpress-seo"),(0,ne.__)("Create optimized SEO titles & meta descriptions with AI","wordpress-seo"),(0,ne.__)("Receive clear SEO and readability guidance to optimize your products","wordpress-seo"),(0,ne.__)("Generate SEO optimized metadata in seconds with AI","wordpress-seo"),(0,ne.__)("Make your articles visible, be seen in Google News","wordpress-seo"),(0,ne.__)("Built to get found by search, AI, and real users","wordpress-seo"),(0,ne.__)("Easy Local SEO. Show up in Google Maps results","wordpress-seo"),(0,ne.__)("Internal links and redirect management, easy","wordpress-seo"),(0,ne.__)("Access to friendly help when you need it, day or night","wordpress-seo");var Ae=s(2485),Me=s.n(Ae);D().string.isRequired,D().object.isRequired,D().func.isRequired,D().bool.isRequired,s(3473),D().string.isRequired,D().object,D().func.isRequired,D().bool.isRequired,D().string.isRequired,D().object.isRequired,D().string.isRequired,D().func.isRequired,D().bool.isRequired;var Pe=s(5074),Ne=s.n(Pe);D().bool.isRequired,D().func,D().func,D().string.isRequired,D().string.isRequired,D().string.isRequired,D().string.isRequired;const Oe=window.yoast.reactHelmet,$e=({videoId:e,thumbnail:t,wistiaEmbedPermission:s,className:r=""})=>{const[o,n]=(0,ae.useState)(s.value?P:A),a=(0,ae.useCallback)(()=>n(P),[n]),l=(0,ae.useCallback)(()=>{s.value?a():n(M)},[s.value,a,n]),c=(0,ae.useCallback)(()=>n(A),[n]),d=(0,ae.useCallback)(()=>{s.set(!0),a()},[s.set,a]);return(0,pe.jsxs)(pe.Fragment,{children:[s.value&&(0,pe.jsx)(Oe.Helmet,{children:(0,pe.jsx)("script",{src:"https://fast.wistia.com/assets/external/E-v1.js",async:!0})}),(0,pe.jsxs)("div",{className:Me()("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===A&&(0,pe.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,pe.jsx)("img",{className:"yst-w-full yst-h-auto yst-object-contain",alt:"",loading:"lazy",decoding:"async",...t})}),o===M&&(0,pe.jsxs)("div",{className:"yst-absolute yst-inset-0 yst-flex yst-flex-col yst-items-center yst-justify-center yst-bg-white",children:[(0,pe.jsxs)("p",{className:"yst-max-w-xs yst-mx-auto yst-text-center",children:[s.status===I&&(0,pe.jsx)(i.Spinner,{}),s.status!==I&&(0,ne.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. */
3 -(0,ne.__)("To see this video, you need to allow %1$s to load embedded videos from %2$s.","wordpress-seo"),"Yoast SEO","Wistia")]}),(0,pe.jsxs)("div",{className:"yst-flex yst-mt-6 yst-gap-x-4",children:[(0,pe.jsx)(i.Button,{type:"button",variant:"secondary",onClick:c,disabled:s.status===I,children:(0,ne.__)("Deny","wordpress-seo")}),(0,pe.jsx)(i.Button,{type:"button",variant:"primary",onClick:d,disabled:s.status===I,children:(0,ne.__)("Allow","wordpress-seo")})]})]}),s.value&&o===P&&(0,pe.jsxs)("div",{className:"yst-absolute yst-w-full yst-h-full yst-top-0 yst-right-0",children:[null===e&&(0,pe.jsx)(i.Spinner,{className:"yst-h-full yst-mx-auto"}),null!==e&&(0,pe.jsx)("div",{className:`wistia_embed wistia_async_${e} videoFoam=true`})]})]})]})};$e.propTypes={videoId:D().string.isRequired,thumbnail:D().shape({src:D().string.isRequired,width:D().string,height:D().string}).isRequired,wistiaEmbedPermission:D().shape({value:D().bool.isRequired,status:D().string.isRequired,set:D().func.isRequired}).isRequired,hasPadding:D().bool},s(5687),D().bool.isRequired,D().func.isRequired,D().func,D().string;const Fe=({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),[p,u]=(0,ae.useState)(!1),h=(0,ae.useMemo)(()=>({src:o,width:"432",height:"244"}),[o]),m=le((0,ne.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. */
4 -(0,ne.__)("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,pe.jsx)(Te,{href:r}),a2:(0,pe.jsx)(Te,{href:s})}),[g,y]=(0,i.useToggleState)(!1),x=(0,ae.useCallback)(async()=>{y();const t=await e();u(!1===t),y()},[e]);return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)("div",{className:"yst-px-10 yst-pt-10 yst-introduction-gradient yst-text-center",children:(0,pe.jsx)("div",{className:"yst-relative yst-w-full",children:(0,pe.jsx)("img",{className:"yst-w-full yst-h-auto yst-rounded-md yst-drop-shadow-md",alt:"",loading:"lazy",decoding:"async",...h})})}),(0,pe.jsxs)("div",{className:"yst-px-10 yst-pb-4 yst-flex yst-flex-col yst-items-center",children:[(0,pe.jsxs)("div",{className:"yst-mt-4 yst-mx-1.5 yst-text-center",children:[(0,pe.jsx)("h3",{className:"yst-text-slate-900 yst-text-lg yst-font-medium",children:(0,ne.sprintf)(/* translators: %s expands to Yoast AI. */ /* translators: %s expands to Yoast AI. */
5 -(0,ne.__)("Grant consent for %s","wordpress-seo"),"Yoast AI")}),(0,pe.jsx)("div",{className:"yst-mt-2 yst-text-slate-600 yst-text-sm",children:le((0,ne.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. */
6 -(0,ne.__)("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,pe.jsx)(Te,{href:t,className:"yst-inline-flex yst-items-center yst-gap-1 yst-no-underline yst-font-medium",variant:"primary"}),ArrowNarrowRightIcon:(0,pe.jsx)(ge(),{className:"yst-w-4 yst-h-4 rtl:yst-rotate-180"}),br:(0,pe.jsx)("br",{})})})]}),(0,pe.jsx)("div",{className:"yst-flex yst-w-full yst-mt-6",children:(0,pe.jsx)("hr",{className:"yst-w-full yst-text-gray-200"})}),(0,pe.jsxs)("div",{className:"yst-flex yst-items-start yst-mt-4",children:[(0,pe.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,pe.jsx)("label",{htmlFor:"yst-ai-consent-checkbox",className:"yst-label yst-checkbox__label yst-text-xs yst-font-normal yst-text-slate-500",children:m})]}),p&&(0,pe.jsx)(He,{className:"yst-mt-3",linkStoreName:n}),(0,pe.jsx)("div",{className:"yst-w-full yst-flex yst-mt-4",children:(0,pe.jsxs)(i.Button,{as:"button",className:"yst-grow",size:"large",disabled:!c||p,onClick:x,children:[g&&!p&&(0,pe.jsx)(i.Spinner,{className:"yst-me-2"}),(0,ne.__)("Grant consent","wordpress-seo")]})}),(0,pe.jsx)(i.Button,{as:"button",className:"yst-mt-4",variant:"tertiary",onClick:a,children:(0,ne.__)("Close","wordpress-seo")})]})]})};Fe.propTypes={onGiveConsent:D().func.isRequired,learnMoreLink:D().string.isRequired,privacyPolicyLink:D().string.isRequired,termsOfServiceLink:D().string.isRequired,imageLink:D().string.isRequired,linkStoreName:D().string.isRequired};const qe={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"},Ue=({storeName:e,onConsentGranted:s,linkStoreName:r,links:i={}})=>{const o=(0,ae.useMemo)(()=>({...qe,...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:p}=(0,t.useDispatch)(e),u=(0,ae.useCallback)(async()=>{const e=await p(!0,d);return!1!==e&&s(),e},[p,s,d]);return(0,pe.jsx)(Fe,{termsOfServiceLink:n,privacyPolicyLink:a,learnMoreLink:l,imageLink:c,onGiveConsent:u,linkStoreName:r})};Ue.propTypes={storeName:D().string.isRequired,onConsentGranted:D().func.isRequired,linkStoreName:D().string.isRequired,links:D().shape({termsOfService:D().string,privacyPolicy:D().string,learnMore:D().string})};const We=({children:e})=>(0,pe.jsx)("p",{className:"yst-mt-2",children:e});We.propTypes={children:D().node.isRequired};const Be=()=>(0,t.useSelect)(e=>{const t=e(z);return{commonErrorsLink:t.selectLink("https://yoa.st/ai-common-errors"),supportLink:t.selectAdminLink("?page=wpseo_page_support")}},[]),Ge=(0,ne.__)("Something went wrong","wordpress-seo"),De=({linkStoreName:e=z})=>{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,pe.jsx)(We,{children:le((0,ne.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. */
7 -(0,ne.__)("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,pe.jsx)(Te,{variant:"error",href:s}),a2:(0,pe.jsx)(Te,{variant:"error",href:r})})})};De.propTypes={linkStoreName:D().string};const He=({linkStoreName:e=z,className:t=""})=>(0,pe.jsxs)(i.Alert,{variant:"error",className:t,children:[(0,pe.jsx)("span",{className:"yst-block yst-font-medium",children:Ge}),(0,pe.jsx)(De,{linkStoreName:e})]});He.propTypes={linkStoreName:D().string,className:D().string};const ze=(0,ne.__)("Not enough content","wordpress-seo"),Ye=()=>{const{commonErrorsLink:e,supportLink:t}=Be();return(0,pe.jsx)(We,{children:le((0,ne.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. */
8 -(0,ne.__)("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,pe.jsx)(Te,{variant:"error",href:e}),a2:(0,pe.jsx)(Te,{variant:"error",href:t})})})},Ve=()=>(0,pe.jsxs)(i.Alert,{variant:"error",children:[(0,pe.jsx)("span",{className:"yst-block yst-font-medium",children:ze}),(0,pe.jsx)(Ye,{})]}),Ke=(0,ne.__)("SEO analysis required","wordpress-seo"),Ze=()=>{const e=(0,t.useSelect)(e=>e(z).selectAdminLink("?page=wpseo_page_settings#/site-features#card-wpseo-keyword_analysis_active"),[]);return(0,pe.jsx)(We,{children:le((0,ne.sprintf)(
1 +(()=>{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. */
2 +(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. */
3 +(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. */
4 +(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. */
5 +(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. */
6 +(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. */
7 +(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. */
8 +(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)(
9 9 /**
10 10 * translators:
11 11 * %1$s expands to Yoast SEO.
12 12 * %2$s and %3$s expand to an opening and closing anchor tag, respectively, that links to the settings page.
@@ -17,10 +17,10 @@
17 17 * %1$s expands to Yoast SEO.
18 18 * %2$s and %3$s expand to an opening and closing anchor tag, respectively, that links to the settings page.
19 19 * %4$s expands to Yoast AI.
20 20 */
21 -(0,ne.__)("%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,pe.jsx)(Te,{variant:"error",href:e})})})},Xe=(0,ne.__)("You've reached the Yoast AI rate limit","wordpress-seo"),Je=()=>{const e=(0,t.useSelect)(e=>e(z).selectLink("https://yoa.st/ai-generator-rate-limit-help"),[]);return(0,pe.jsx)(We,{children:le((0,ne.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. */
22 -(0,ne.__)("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,pe.jsx)(Te,{variant:"error",href:e})})})},Qe=()=>(0,pe.jsxs)(i.Alert,{variant:"error",children:[(0,pe.jsx)("span",{className:"yst-block yst-font-medium",children:Xe}),(0,pe.jsx)(Je,{})]}),et=(0,ne.__)("Subscription required","wordpress-seo"),tt=({invalidSubscriptions:e=[]})=>{const{newYoastWooLink:s,activateYoastWooLink:r,newPremiumLink:i,activatePremiumLink:o}=(0,t.useSelect)(e=>{const t=e(z);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,pe.jsx)(We,{children:le((0,ne.sprintf)(
21 +(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. */
22 +(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)(
23 23 /**
24 24 * translators:
25 25 * %1$s expands to Yoast SEO Premium or Yoast WooCommerce SEO.
26 26 * %2$s expands to MyYoast.
@@ -33,9 +33,9 @@
33 33 * %2$s expands to MyYoast.
34 34 * %3$s and %4$s expand to an opening and closing anchor tag, respectively, to activate your subscription.
35 35 * %5$s and %6$s expand to an opening and closing anchor tag, respectively, to get a new subscription.
36 36 **/
37 -(0,ne.__)("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,pe.jsx)(Te,{variant:"error",href:a}),New:(0,pe.jsx)(Te,{variant:"error",href:l})})}):(0,pe.jsx)(We,{children:le((0,ne.sprintf)(
37 +(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)(
38 38 /**
39 39 * translators:
40 40 * %1$s expands to MyYoast.
41 41 * %2$s and %3$s expand to an opening and closing anchor tag, respectively, to activate your subscription.
@@ -44,29 +44,29 @@
44 44 * translators:
45 45 * %1$s expands to MyYoast.
46 46 * %2$s and %3$s expand to an opening and closing anchor tag, respectively, to activate your subscription.
47 47 **/
48 -(0,ne.__)("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,pe.jsx)(Te,{variant:"error",href:o})})})};tt.propTypes={invalidSubscriptions:D().arrayOf(D().string)};const st=({invalidSubscriptions:e=[]})=>{const s=(0,t.useSelect)(e=>e(H).selectBustSubscriptionCacheEndpoint(),[]),{onClose:r}=(0,i.useModalContext)(),o=(0,ae.useCallback)(async()=>{try{await p()({path:s,method:"POST",parse:!1})}catch(e){console.error(e)}window.location.reload()},[]);return(0,pe.jsxs)(ae.Fragment,{children:[(0,pe.jsxs)(i.Alert,{variant:"error",children:[(0,pe.jsx)("span",{className:"yst-block yst-font-medium",children:et}),(0,pe.jsx)(tt,{invalidSubscriptions:e})]}),(0,pe.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,pe.jsx)(i.Button,{variant:"secondary",onClick:r,children:(0,ne.__)("Close","wordpress-seo")}),(0,pe.jsx)(i.Button,{variant:"primary",onClick:o,children:(0,ne.__)("Refresh page","wordpress-seo")})]})]})};st.propTypes={invalidSubscriptions:D().arrayOf(D().string)};const rt=(0,ne.__)("Connection timeout","wordpress-seo"),it=()=>{const{commonErrorsLink:e,supportLink:t}=Be();return(0,pe.jsx)(We,{children:le((0,ne.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. */
49 -(0,ne.__)("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,pe.jsx)(Te,{variant:"error",href:e}),a2:(0,pe.jsx)(Te,{variant:"error",href:t})})})},ot=()=>(0,pe.jsxs)(i.Alert,{variant:"error",children:[(0,pe.jsx)("span",{className:"yst-block yst-font-medium",children:rt}),(0,pe.jsx)(it,{})]}),nt=(0,ne.__)("Usage policy violation","wordpress-seo"),at=()=>{const e=(0,t.useSelect)(e=>e(z).selectAdminLink("?page=wpseo_page_support"),[]);return(0,pe.jsx)(We,{children:le((0,ne.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. */
50 -(0,ne.__)("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,pe.jsx)(Te,{variant:"error",href:"https://openai.com/policies/usage-policies"}),a2:(0,pe.jsx)(Te,{variant:"error",href:e})})})},lt=()=>(0,pe.jsxs)(i.Alert,{variant:"error",children:[(0,pe.jsx)("span",{className:"yst-block yst-font-medium",children:nt}),(0,pe.jsx)(at,{})]}),ct=(0,ne.__)("Something went wrong","wordpress-seo"),dt=({errorMessage:e=""})=>{const s=(0,t.useSelect)(e=>e(z).selectAdminLink("?page=wpseo_page_support"),[]);return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(We,{children:(0,ne.sprintf)(/* translators: %s is the error response of the request. */ /* translators: %s is the error response of the request. */
51 -(0,ne.__)("The request came back with the following error: '%s'.","wordpress-seo"),e)}),(0,pe.jsx)(We,{children:le((0,ne.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. */
52 -(0,ne.__)("Please try again later. If the issue persists, please %1$scontact our support team%2$s.","wordpress-seo"),"<a>","</a>"),{a:(0,pe.jsx)(Te,{variant:"error",href:s})})})]})};dt.propTypes={errorMessage:D().string};const pt=({errorMessage:e=""})=>(0,pe.jsxs)(i.Alert,{variant:"error",children:[(0,pe.jsx)("span",{className:"yst-block yst-font-medium",children:ct}),(0,pe.jsx)(dt,{errorMessage:e})]});pt.propTypes={errorMessage:D().string};const ut=(0,ne.__)("Something went wrong","wordpress-seo"),ht=()=>{const e=(0,t.useSelect)(e=>e(z).selectAdminLink("plugins.php"),[]);return(0,pe.jsx)(We,{children:le((0,ne.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. */
53 -(0,ne.__)("The version of %1$s is outdated. Please upgrade %1$s %2$shere%3$s!","wordpress-seo"),"Yoast SEO Premium","<a>","</a>"),{a:(0,pe.jsx)(Te,{variant:"error",href:e})})})},mt=()=>(0,pe.jsxs)(i.Alert,{variant:"error",children:[(0,pe.jsx)("span",{className:"yst-block yst-font-medium",children:ut}),(0,pe.jsx)(ht,{})]}),gt=({children:e})=>(0,pe.jsx)("div",{className:"yst-mt-1 yst-text-sm yst-text-slate-500",children:e});gt.propTypes={children:D().node.isRequired};const yt=({children:e})=>(0,pe.jsx)("div",{className:"yst-mt-6 yst-flex yst-flex-row yst-justify-end yst-gap-3",children:e});yt.propTypes={children:D().node.isRequired};const xt=({onClose:e})=>(0,pe.jsx)(i.Button,{variant:"secondary",onClick:e,children:(0,ne.__)("Close","wordpress-seo")});xt.propTypes={onClose:D().func.isRequired};const wt=({showActions:e=!1,onRetry:t,onClose:s})=>(0,pe.jsxs)(yt,{children:[(0,pe.jsx)(xt,{onClose:s}),e&&(0,pe.jsx)(i.Button,{variant:"primary",onClick:t,children:(0,ne.__)("Try again","wordpress-seo")})]});wt.propTypes={showActions:D().bool,onRetry:D().func.isRequired,onClose:D().func.isRequired};const ft=({isOpen:e,title:t,onClose:s=o.noop,children:r})=>{const n=(0,i.useSvgAria)();return(0,pe.jsx)(i.Modal,{isOpen:e,onClose:s,children:(0,pe.jsx)(i.Modal.Panel,{className:"yst-max-w-lg",closeButtonScreenReaderText:(0,ne.__)("Dismiss","wordpress-seo"),children:(0,pe.jsxs)("div",{className:"yst-flex yst-items-start yst-gap-4",children:[(0,pe.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,pe.jsx)(Ne(),{className:"yst-h-6 yst-w-6 yst-text-red-600",...n})}),(0,pe.jsxs)("div",{className:"yst-text-start yst-flex-1 yst-min-w-0",children:[(0,pe.jsx)(i.Modal.Title,{className:"yst-text-lg yst-leading-6 yst-font-medium yst-text-slate-900",children:t}),r]})]})})})};ft.propTypes={isOpen:D().bool.isRequired,title:D().string.isRequired,onClose:D().func,children:D().node.isRequired};const vt=({isOpen:e=!0,showActions:t=!1,onRetry:s=o.noop,onClose:r=o.noop})=>(0,pe.jsxs)(ft,{isOpen:e,title:Ge,onClose:r,children:[(0,pe.jsx)(gt,{children:(0,pe.jsx)(De,{})}),(0,pe.jsx)(wt,{showActions:t,onRetry:s,onClose:r})]});vt.propTypes={isOpen:D().bool,showActions:D().bool,onRetry:D().func,onClose:D().func};const bt=({isOpen:e=!0,showActions:t=!1,onRetry:s=o.noop,onClose:r=o.noop})=>(0,pe.jsxs)(ft,{isOpen:e,title:rt,onClose:r,children:[(0,pe.jsx)(gt,{children:(0,pe.jsx)(it,{})}),(0,pe.jsx)(wt,{showActions:t,onRetry:s,onClose:r})]});bt.propTypes={isOpen:D().bool,showActions:D().bool,onRetry:D().func,onClose:D().func};const St=({errorMessage:e="",isOpen:t=!0,showActions:s=!1,onRetry:r=o.noop,onClose:i=o.noop})=>(0,pe.jsxs)(ft,{isOpen:t,title:ct,onClose:i,children:[(0,pe.jsx)(gt,{children:(0,pe.jsx)(dt,{errorMessage:e})}),(0,pe.jsx)(wt,{showActions:s,onRetry:r,onClose:i})]});St.propTypes={errorMessage:D().string,isOpen:D().bool,showActions:D().bool,onRetry:D().func,onClose:D().func};const jt=({isOpen:e=!0,onClose:t=o.noop})=>(0,pe.jsxs)(ft,{isOpen:e,title:ze,onClose:t,children:[(0,pe.jsx)(gt,{children:(0,pe.jsx)(Ye,{})}),(0,pe.jsx)(yt,{children:(0,pe.jsx)(xt,{onClose:t})})]});jt.propTypes={isOpen:D().bool,onClose:D().func};const Ct=({isOpen:e=!0,onClose:t=o.noop})=>(0,pe.jsxs)(ft,{isOpen:e,title:nt,onClose:t,children:[(0,pe.jsx)(gt,{children:(0,pe.jsx)(at,{})}),(0,pe.jsx)(yt,{children:(0,pe.jsx)(xt,{onClose:t})})]});Ct.propTypes={isOpen:D().bool,onClose:D().func};const kt=({isOpen:e=!0,onClose:t=o.noop})=>(0,pe.jsxs)(ft,{isOpen:e,title:Xe,onClose:t,children:[(0,pe.jsx)(gt,{children:(0,pe.jsx)(Je,{})}),(0,pe.jsx)(yt,{children:(0,pe.jsx)(xt,{onClose:t})})]});kt.propTypes={isOpen:D().bool,onClose:D().func};const _t=({isOpen:e=!0,onClose:t=o.noop})=>(0,pe.jsxs)(ft,{isOpen:e,title:ut,onClose:t,children:[(0,pe.jsx)(gt,{children:(0,pe.jsx)(ht,{})}),(0,pe.jsx)(yt,{children:(0,pe.jsx)(xt,{onClose:t})})]});_t.propTypes={isOpen:D().bool,onClose:D().func};const Et=({invalidSubscriptions:e=[],isOpen:s=!0,onClose:r=o.noop})=>{const n=(0,t.useSelect)(e=>e(H).selectBustSubscriptionCacheEndpoint(),[]),a=(0,ae.useCallback)(async()=>{try{await p()({path:n,method:"POST",parse:!1})}catch(e){console.error(e)}window.location.reload()},[n]);return(0,pe.jsxs)(ft,{isOpen:s,title:et,onClose:r,children:[(0,pe.jsx)(gt,{children:(0,pe.jsx)(tt,{invalidSubscriptions:e})}),(0,pe.jsxs)(yt,{children:[(0,pe.jsx)(xt,{onClose:r}),(0,pe.jsx)(i.Button,{variant:"primary",onClick:a,children:(0,ne.__)("Refresh page","wordpress-seo")})]})]})};Et.propTypes={invalidSubscriptions:D().arrayOf(D().string),isOpen:D().bool,onClose:D().func};const Rt=({isOpen:e=!0,onClose:t=o.noop})=>{const s=(0,ae.useCallback)(()=>window.location.reload(),[]);return(0,pe.jsxs)(ft,{isOpen:e,title:Ke,onClose:t,children:[(0,pe.jsx)(gt,{children:(0,pe.jsx)(Ze,{})}),(0,pe.jsxs)(yt,{children:[(0,pe.jsx)(xt,{onClose:t}),(0,pe.jsx)(i.Button,{variant:"primary",onClick:s,children:(0,ne.__)("Refresh page","wordpress-seo")})]})]})};Rt.propTypes={isOpen:D().bool,onClose:D().func};const It=(0,ne.__)("Yoast AI cannot reach your site","wordpress-seo"),Lt=()=>{const{commonErrorsLink:e,supportLink:t}=Be();return(0,pe.jsx)(We,{children:le((0,ne.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. */
54 -(0,ne.__)("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,pe.jsx)(Te,{variant:"error",href:e}),a2:(0,pe.jsx)(Te,{variant:"error",href:t})})})},Tt=({learnMoreUrl:e=""})=>(0,pe.jsx)(We,{children:le((0,ne.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. */
55 -(0,ne.__)("%1$sLearn more about connecting with MyYoast.%2$s","wordpress-seo"),"<a>","</a>"),{a:(0,pe.jsx)(Te,{variant:"error",href:e})})});Tt.propTypes={learnMoreUrl:D().string};const At=()=>{const e=(0,i.useSvgAria)(),{commonErrorsLink:s,supportLink:r}=(0,t.useSelect)(e=>{const t=e(z);return{commonErrorsLink:t.selectLink("https://yoa.st/ai-common-errors"),supportLink:t.selectAdminLink("?page=wpseo_page_support")}},[]);return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(gt,{children:(0,pe.jsx)(We,{children:(0,ne.__)("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,pe.jsxs)(yt,{children:[(0,pe.jsxs)(i.Button,{as:"a",href:r,target:"_blank",rel:"noopener noreferrer",variant:"secondary",children:[(0,ne.__)("Still need help?","wordpress-seo"),(0,pe.jsx)(de(),{className:"yst--me-1 yst-ms-1 yst-h-4 yst-w-4 yst-text-slate-400 rtl:yst-rotate-[270deg]",...e}),(0,pe.jsx)("span",{className:"yst-sr-only",children:(0,ne.__)("(Opens in a new browser tab)","wordpress-seo")})]}),(0,pe.jsxs)(i.Button,{as:"a",href:s,target:"_blank",rel:"noopener noreferrer",variant:"primary",children:[(0,ne.__)("Learn more","wordpress-seo"),(0,pe.jsx)(ge(),{className:"yst--me-1 yst-ms-1 yst-h-4 yst-w-4 rtl:yst-rotate-180",...e})]})]})]})},Mt=({isAvailable:e,canConnect:t,connectUrl:s,learnMoreUrl:r},o,n)=>e&&t&&s?(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsxs)(gt,{children:[(0,pe.jsx)(We,{children:(0,ne.__)("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,pe.jsx)(Tt,{learnMoreUrl:r})]}),(0,pe.jsxs)(yt,{children:[(0,pe.jsx)(xt,{onClose:o}),(0,pe.jsxs)(i.Button,{as:"a",href:s,target:"_blank",rel:"noopener noreferrer",variant:"primary",children:[(0,ne.__)("Connect to MyYoast","wordpress-seo"),(0,pe.jsx)(de(),{className:"yst--me-1 yst-ms-1 yst-h-4 yst-w-4 rtl:yst-rotate-[270deg]",...n}),(0,pe.jsx)("span",{className:"yst-sr-only",children:(0,ne.__)("(Opens in a new browser tab)","wordpress-seo")})]})]})]}):e&&!t?(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsxs)(gt,{children:[(0,pe.jsx)(We,{children:(0,ne.__)("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,pe.jsx)(Tt,{learnMoreUrl:r})]}),(0,pe.jsx)(yt,{children:(0,pe.jsx)(xt,{onClose:o})})]}):(0,pe.jsx)(At,{}),Pt=({isOpen:e=!0,onClose:s=o.noop})=>{const r=(0,i.useSvgAria)(),n=(0,t.useSelect)(e=>e(H).selectMyyoastConnection(),[]);return(0,pe.jsx)(ft,{isOpen:e,title:It,onClose:s,children:Mt(n,s,r)})};Pt.propTypes={isOpen:D().bool,onClose:D().func};const Nt=({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,pe.jsx)(Rt,{isOpen:s,onClose:l});if(402===e||429===e&&"USAGE_LIMIT_REACHED"===t)return(0,pe.jsx)(Et,{isOpen:s,invalidSubscriptions:r,onClose:l});switch(e){case 400:switch(t){case"AI_CONTENT_FILTER":return(0,pe.jsx)(Ct,{isOpen:s,onClose:l});case"NOT_ENOUGH_CONTENT":return(0,pe.jsx)(jt,{isOpen:s,onClose:l});case"SITE_UNREACHABLE":return(0,pe.jsx)(Pt,{isOpen:s,onClose:l});case"WP_HTTP_REQUEST_ERROR":return(0,pe.jsx)(St,{isOpen:s,errorMessage:a,showActions:i,onRetry:n,onClose:l});default:return(0,pe.jsx)(vt,{isOpen:s,showActions:i,onRetry:n,onClose:l})}case 408:return(0,pe.jsx)(bt,{isOpen:s,showActions:i,onRetry:n,onClose:l});case 429:return(0,pe.jsx)(kt,{isOpen:s,onClose:l});case 410:return(0,pe.jsx)(_t,{isOpen:s,onClose:l});default:return(0,pe.jsx)(vt,{isOpen:s,showActions:i,onRetry:n,onClose:l})}};Nt.propTypes={errorCode:D().number.isRequired,errorIdentifier:D().string,isOpen:D().bool,invalidSubscriptions:D().arrayOf(D().string),showActions:D().bool,onRetry:D().func,errorMessage:D().string,onClose:D().func};var Ot=s(2863),$t=s.n(Ot);const Ft=window.yoast.aiFrontend,qt=window.yoast.analysis,Ut=(window.wp.sanitize,window.yoast.helpers),{stripHTMLTags:Wt}=Ut.strings,Bt=["_formal","_informal","_ao90"],Gt=e=>{for(const t of Bt)if(e.endsWith(t))return e.slice(0,-t.length);return e};let Dt,Ht=!1;const zt="\\–\\-\\(\\)_\\[\\]’‘“”〝〞〟‟„\"'.?!:;,¿¡«»‹›—×+&۔؟،؛。。!‼?⁇⁉⁈‥…・ー、〃〄〆〇〈〉《》「」『』【】〒〓〔〕〖〗〘〙〚〛〜〝〞〟〠〶〼〽{}|~⦅⦆「」、[]・¥$%@&'()*/:;<>\\\<>";zt.split(""),new RegExp("^["+zt+"]+"),new RegExp("["+zt+"]+$");const Yt=new RegExp("["+zt+"#$%&*+/=@^`{|}~ -¿–-⁊ -₠-⃀]","g"),Vt=e=>0===e.replace(Yt,"").trim().length,Kt=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},Zt=()=>{const e=(0,t.useSelect)(e=>e(z).getReplaceVars(),[]),s=(0,ae.useMemo)(()=>e.map(Kt),[e]);return(0,ae.useCallback)((e,{key:t="value",overrides:r={},applyPluggable:i=!0,editType:n=Z,contentType:a=J}={})=>{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===Q&&(e=e.replace(" Archives","")),i?((e,t=Z)=>{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:Wt(t(e.title)),description:Wt(t(e.description)),filteredSEOTitle:e.filteredSEOTitle?Wt(t(e.filteredSEOTitle)):""}}(e);const s=t._applyModifications.bind(t);return{url:e.url,title:Wt(s("data_page_title",e.title)),description:Wt(s("data_meta_desc",e.description)),filteredSEOTitle:e.filteredSEOTitle?Wt(s("data_page_title",e.filteredSEOTitle)):""}}({title:"",description:"",[t]:qt.languageProcessing.stripSpaces(e)});return(0,o.get)(s,t,e)})(e,n):e},[s])},Xt={editType:Z,previewType:Y,postType:"post",contentType:J},Jt=(0,ae.createContext)(Xt),Qt=Jt.Provider,es=()=>(0,ae.useContext)(Jt),ts=window.yoast.externals.contexts,ss=()=>(0,ae.useContext)(ts.LocationContext),rs=e=>{const t=(0,ae.useRef)(null);return(0,ae.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])},is=(0,n.createSlice)({name:"suggestions",initialState:{status:se.loading,error:{code:200,message:""},entities:[],selected:""},reducers:{setLoading:e=>{e.status=se.loading},setSuccess:(e,{payload:t})=>{e.status=se.success,e.selected=t[0],e.entities.push(...t)},setError:(e,{payload:t})=>{e.status=se.error,e.error=t},setSelected:(e,{payload:t})=>{e.selected=t}}}),os=e=>{switch(e){case V:return"Facebook";case K:return"Twitter";default:return"Google"}},ns=window.yoast.searchMetadataPreviews,as="usageCount",ls="fetchUsageCount",cs=`${ls}/${_}`,ds=`${ls}/${E}`,ps={errorCode:null,errorIdentifier:null,errorMessage:null},us=(0,n.createSlice)({name:as,initialState:{status:R,count:0,limit:10,endpoint:"",error:ps},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(`${ls}/${k}`,e=>{e.status=I,e.error=ps}),e.addCase(cs,(e,{payload:t})=>{e.status=L,e.count=t.count,e.limit=t.limit,e.error=ps}),e.addCase(`${ls}/${E}`,(e,{payload:t})=>{e.status=T,e.error={errorCode:502,...t}})}}),hs=us.getInitialState,ms={selectUsageCountStatus:e=>(0,o.get)(e,[as,"status"],us.getInitialState()),selectUsageCount:e=>(0,o.get)(e,[as,"count"],us.getInitialState().count),selectUsageCountLimit:e=>(0,o.get)(e,[as,"limit"],us.getInitialState().limit),selectUsageCountEndpoint:e=>(0,o.get)(e,[as,"endpoint"],us.getInitialState().endpoint),selectUsageCountError:e=>(0,o.get)(e,[as,"error"],us.getInitialState().error)};ms.selectUsageCountRemaining=(0,n.createSelector)([ms.selectUsageCount,ms.selectUsageCountLimit],(e,t)=>Math.max(t-e,0)),ms.isUsageCountLimitReached=(0,n.createSelector)([ms.selectUsageCount,ms.selectUsageCountLimit,ms.selectUsageCountError],(e,t,s)=>429===s.errorCode||e>=t);const gs={...us.actions,fetchUsageCount:function*({endpoint:e,isWooProductEntity:t}){yield{type:`${ls}/${k}`};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:ls,payload:{endpoint:e,isWooProductEntity:t}});return{type:`${ls}/${_}`,payload:s}}catch(e){return{type:`${ls}/${E}`,payload:e}}}},ys={[ls]:async({payload:e})=>p()({method:"POST",path:e.endpoint,data:{is_woo_product_entity:e.isWooProductEntity}})},xs=us.reducer,ws=({onStartGenerating:e})=>(0,pe.jsx)(Ue,{storeName:H,linkStoreName:z,onConsentGranted:e});ws.propTypes={onStartGenerating:D().func.isRequired};var fs=s(7219),vs=s.n(fs);const bs=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,ae.useCallback)(()=>{o(),i("yoast-seo/seo-sidebar"),e&&n("yoast-search-appearance-modal")},[o,i,n])},Ss=/(?<start><\/badge>|^(?!<badge>))(?<wrap>[\s\S]+?)(?<end><badge>|$)/g,js=({total:e,current:t,onNavigate:s,disabled:r=!1,...o})=>(0,pe.jsxs)("div",{className:"yst-flex yst-justify-between yst-gap-x-2 yst-items-start",children:[(0,pe.jsx)("p",{className:"yst-text-slate-500 yst-text-xxs yst-mt-1",children:(0,ne.__)("Text generated by AI may be offensive or inaccurate.","wordpress-seo")}),e>1&&(0,pe.jsx)(i.Pagination,{className:"yst-shrink-0",current:t,total:e,onNavigate:s,disabled:r,variant:"text"
56 -/* translators: Hidden accessibility text. */,screenReaderTextPrevious:(0,ne.__)("Previous","wordpress-seo")
57 -/* translators: Hidden accessibility text. */,screenReaderTextNext:(0,ne.__)("Next","wordpress-seo"),...o})]}),Cs=({height:e,onFatalError:s})=>{const[r,n]=(0,ae.useState)(""),{onClose:a}=(0,i.useModalContext)(),{editType:l,previewType:c,contentType:d}=es(),u=(()=>{const{editType:e,previewType:t}=es();let s="SEO";switch(t){case V:s="social";break;case K:s="X"}switch(e){case Z:return(0,ne.sprintf)(/* translators: %s is the type of title. */ /* translators: %s is the type of title. */
58 -(0,ne.__)("Generated %s titles","wordpress-seo"),s);case X:return t===Y&&(s="meta"),(0,ne.sprintf)(/* translators: %s is the type of description. */ /* translators: %s is the type of description. */
59 -(0,ne.__)("Generated %s descriptions","wordpress-seo"),s)}})(),h=(()=>{const{editType:e,previewType:t}=es();let s="SEO";switch(t){case V:s="social";break;case K:s="X"}switch(e){case Z:return(0,ne.sprintf)(/* translators: %s is the type of title. */ /* translators: %s is the type of title. */
60 -(0,ne.__)("Apply %s title","wordpress-seo"),s);case X:return t===Y&&(s="meta"),(0,ne.sprintf)(/* translators: %s is the type of description. */ /* translators: %s is the type of description. */
61 -(0,ne.__)("Apply %s description","wordpress-seo"),s)}})(),m=ss(),{suggestions:g,fetchSuggestions:y,setSelectedSuggestion:x}=(()=>{const[e,s]=(0,ae.useReducer)(is.reducer,is.getInitialState()),{editType:r,previewType:i,postType:n,contentType:a}=es(),l=(0,t.useSelect)(e=>e(H).selectPromptContent(),[]),c=(0,t.useSelect)(e=>e(H).selectGetSuggestionsEndpoint(),[]),{contentLocale:d,focusKeyphrase:u,isWooCommerceActive:h,isGutenberg:m,isElementor:g}=(0,t.useSelect)(e=>({contentLocale:e(z).getContentLocale(),focusKeyphrase:e(z).getFocusKeyphrase(),isWooCommerceActive:e(z).getIsWooCommerceActive(),isGutenberg:e(z).getIsBlockEditor(),isElementor:e(z).getIsElementorEditor()}),[]);let y,x=qt.languageProcessing.helpers.processExactMatchRequest(u).keyphrase;x.length>191&&(x=x.slice(0,191)),y=g?"elementor":m?"gutenberg":"classic";const w=((e,t,s,r)=>{const i=e===X?"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!==Q||(o="taxonomy-"),`${o}${i}`})(r,h,n,a);return{suggestions:e,fetchSuggestions:(0,ae.useCallback)(async(e=!0)=>{s(is.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{Dt&&Dt.abort(),Dt=new AbortController,Ht=!1,s=setTimeout(()=>{Ht=!0,Dt.abort()},r);const i=await p()({path:e,method:"POST",data:t,parse:!1,signal:Dt.signal}),o=await i.json();return{status:re,payload:o}}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return Ht?{status:ie,payload:{message:"timeout",code:408}}:{status:oe};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:ie,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:os(i),language:Gt(d).replace("_","-"),editor:y}});switch(t){case oe:break;case ie:s(is.actions.setError(r));break;case re:s(is.actions.setSuccess(r))}return t},[s]),setSelectedSuggestion:(0,ae.useCallback)(e=>s(is.actions.setSelected(e)),[s])}})(),w=(()=>{const{previewType:e}=es();switch(e){case V:return Ns;case K:return Dr;default:return Ls}})(),{addAppliedSuggestion:f,addUsageCount:v}=(0,t.useDispatch)(H),{isUsageCountLimitReached:b,isWooProductEntity:S,hasValidPremiumSubscription:j,hasValidWooSubscription:C}=(0,t.useSelect)(e=>{const t=e(H),s=e(z);return{isUsageCountLimitReached:t.isUsageCountLimitReached(),isPremium:s.getIsPremium(),isWooProductEntity:s.getIsWooProductEntity(),isWooSeoActive:s.getIsWooSeoActive(),hasValidPremiumSubscription:t.selectPremiumSubscription(),hasValidWooSubscription:t.selectWooCommerceSubscription()}},[]),k=(0,ae.useMemo)(()=>g.status===se.loading||!(C||!b||!S)||!(j||!b),[j,b,g.status,S,C]),_=(0,i.usePrevious)(e),E=g.status===se.success?e:_,{bottom:R}={bottom:`calc( (${E+"px"} - 100vh) / 2 + 32px )`},[I,L]=(0,ae.useState)(!1),T=(0,ae.useCallback)(e=>{L(e.target.offsetHeight!==e.target.scrollHeight)},[L]),A=rs(T),M=(()=>{const{editType:e,previewType:s,contentType:r}=es(),i=(()=>{const{previewType:e}=es();return(0,ae.useMemo)(()=>{switch(e){case Y:return()=>(0,t.select)(z).getSnippetEditorData().title;case V:return(0,t.select)(z).getFacebookTitleOrFallback;case K:return(0,t.select)(z).getTwitterTitleOrFallback;default:return(0,o.constant)("")}},[e])})(),n=(0,t.useSelect)(t=>t(H).selectAppliedSuggestionFor({editType:e,previewType:s}),[e,s]);return(0,ae.useMemo)(()=>{let t=i();return e===X?t:(n&&(t=t.replace(n,te[r])),((e,t)=>e.includes(te[t])?e:te[t])(t,r))},[e,i])})(),P=(()=>{const e=(()=>{const{previewType:e}=es();return(0,ae.useMemo)(()=>{switch(e){case Y:return()=>(0,t.select)(z).getSnippetEditorData().description;case V:return(0,t.select)(z).getFacebookDescriptionOrFallback;case K:return(0,t.select)(z).getTwitterDescriptionOrFallback;default:return(0,o.constant)("")}},[e])})();return(0,ae.useMemo)(e,[e])})(),N=Zt(),O=(0,ae.useMemo)(()=>l===Z?{[ee[d]]:g.selected}:{},[l,d,g.selected]),$=(0,ae.useMemo)(()=>N(M,{overrides:O,contentType:d}),[N,M,l,d,g.selected]),F=(0,ae.useMemo)(()=>N(M,{overrides:{...O,sep:"",sitename:""},contentType:d}),[N,M,l,d,g.selected]),q=(0,ae.useMemo)(()=>l===X?g.selected:N(P,{editType:X}),[N,P,l,g.selected]),U=(0,ae.useCallback)(e=>N(M,{overrides:{[ee[d]]:e},key:"badge",applyPluggable:!1,contentType:d}),[N,M,d]),{currentPage:W,setCurrentPage:B,isOnLastPage:G,totalPages:D,getItemsOnCurrentPage:J}=(({totalItems:e=0,perPage:t=5})=>{const[s,r]=(0,ae.useState)(1),i=(0,ae.useMemo)(()=>Math.ceil(e/t),[e,t]),n=(0,ae.useMemo)(()=>s*t,[s,t]),a=(0,ae.useMemo)(()=>n-t,[n,t]),l=(0,ae.useMemo)(()=>1===s,[s]),c=(0,ae.useMemo)(()=>s===i,[s,i]),d=(0,ae.useCallback)(()=>{s>1&&r(s-1)},[s,r]),p=(0,ae.useCallback)(()=>{s<i&&r(s+1)},[s,r,i]),u=(0,ae.useCallback)(e=>(0,o.slice)(e,a,n),[a,n]);return{currentPage:s,setCurrentPage:r,totalPages:i,isOnFirstPage:l,isOnLastPage:c,previousPage:d,nextPage:p,firstOnPage:a,lastOnPage:n,getItemsOnCurrentPage:u}})({totalItems:g.status===se.loading||g.status===se.error?g.entities.length+5:g.entities.length,perPage:5}),ce=(0,ae.useMemo)(()=>(0,o.map)(J(g.entities),e=>{let t=e;return l===Z&&(t=U(e),t=t.replace(Ss,(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=le(t,{badge:(0,pe.jsx)(i.Badge,{className:"yst-me-2 last:yst-me-0",variant:"plain",children:" "}),span:(0,pe.jsx)("span",{className:"yst-flex yst-items-center yst-me-2 last:yst-me-0"})})),{value:e,label:t}}),[g.entities,J,l,U]),de=(0,ae.useMemo)(()=>g.status!==se.error||g.status===se.error&&!G,[g.status,G]),ue=(0,ae.useMemo)(()=>g.status===se.loading&&G,[g.status,G]),he=(0,ae.useMemo)(()=>g.status===se.error&&G,[g.status,G]),me=(0,ae.useCallback)(()=>{k||(B(g.status===se.error?D:D+1),y().then(e=>{e===re&&v()}))},[y,g.status,D,B,x,b]),ge=(()=>{const{editType:e}=es();switch(e){case Z:return(()=>{const{previewType:e}=es(),{updateData:s,setFacebookPreviewTitle:r,setTwitterPreviewTitle:i}=(0,t.useDispatch)(z);return(0,ae.useMemo)(()=>{switch(e){case Y:return e=>s({title:e});case V:return r;case K:return i;default:return o.noop}},[e,s,r,i])})();case X:return(()=>{const{previewType:e}=es(),{updateData:s,setFacebookPreviewDescription:r,setTwitterPreviewDescription:i}=(0,t.useDispatch)(z);return(0,ae.useMemo)(()=>{switch(e){case Y:return e=>s({description:e});case V:return r;case K:return i;default:return o.noop}},[e,s,r,i])})();default:return o.noop}})(),ye=bs(!0),xe=(0,ae.useCallback)(()=>{const e=l===Z?M.replace(new RegExp(te[d]+"( Archives)?"),g.selected):g.selected;ge(e),f({editType:l,previewType:c,suggestion:g.selected}),a(),"pre-publish"===m&&ye()},[ge,l,c,g.selected,M,a,f,ye,m]);((e,t=[])=>{const s=(0,ae.useRef)(!1);(0,ae.useEffect)(()=>{s.current||(s.current=!0,e().finally(()=>{s.current=!1}))},[e,t])})(()=>""===r?y().then(e=>{n(e),e===re&&v()}):Promise.resolve(),[r,v,y]);const we=r===ie||g.status===se.error&&402===g.error.code;return(0,ae.useEffect)(()=>{var e,t,r,i,o,n,a,l;we&&s({errorCode:null!==(e=null===(t=g.error)||void 0===t?void 0:t.code)&&void 0!==e?e:0,errorIdentifier:null!==(r=null===(i=g.error)||void 0===i?void 0:i.errorIdentifier)&&void 0!==r?r:"",invalidSubscriptions:null!==(o=null===(n=g.error)||void 0===n?void 0:n.missingLicenses)&&void 0!==o?o:[],errorMessage:null!==(a=null===(l=g.error)||void 0===l?void 0:l.message)&&void 0!==a?a:""})},[we,g.error,s]),we?null:(0,pe.jsxs)(ae.Fragment,{children:[(0,pe.jsxs)(i.Modal.Container.Content,{ref:A,className:"yst-flex yst-flex-col yst-py-6 yst-space-y-2",children:[(0,pe.jsx)(w,{title:$,description:q,status:g.status,titleForLength:F,showPreviewSkeleton:""===r,showLengthProgress:!ue}),de&&(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsxs)("div",{className:"yst-flex yst-space-y-4",children:[(0,pe.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default yst-mt-auto",children:u}),(0,pe.jsx)(i.Button,{variant:"ai-secondary",size:"small",onClick:g.status===se.loading?o.noop:me,isLoading:g.status===se.loading,disabled:k,children:(0,ne.__)("Generate 5 more","wordpress-seo")})]}),ue?(0,pe.jsx)(Wr,{idSuffix:m,suggestionClassNames:l===Z?[["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,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(qr,{idSuffix:m,suggestions:ce,selected:g.selected,onChange:x}),(0,pe.jsx)(js,{current:W,total:D,onNavigate:B,disabled:g.status===se.loading||he})]})]}),he&&(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)("div",{className:"yst-mt-8"}),(0,pe.jsx)(Or,{errorCode:g.error.code,errorIdentifier:g.error.errorIdentifier,invalidSubscriptions:g.error.missingLicenses,errorMessage:g.error.message}),(0,pe.jsx)(js,{current:W,total:D,onNavigate:B,disabled:g.status===se.loading})]})]}),(0,pe.jsxs)(i.Modal.Container.Footer,{children:[I&&(0,pe.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,pe.jsx)("hr",{className:"yst-mb-6 yst--mx-6"}),(0,pe.jsxs)("div",{className:"sm:yst-flex sm:yst-justify-end sm:yst-space-x-2 sm:rtl:yst-space-x-reverse",children:[(0,pe.jsx)("div",{className:"yst-hidden sm:yst-inline",children:(0,pe.jsx)(i.Button,{variant:"secondary",onClick:a,children:(0,ne.__)("Close","wordpress-seo")})}),(0,pe.jsx)("div",{className:"yst-block sm:yst-inline",children:(0,pe.jsxs)(i.Button,{className:"yst-w-full sm:yst-w-auto",variant:"primary",onClick:xe,disabled:""===g.selected||g.status===se.loading||he,children:[(0,pe.jsx)(vs(),{className:"yst--ms-1 yst-me-1 yst-h-4 yst-w-4 yst-text-white"}),h]})}),(0,pe.jsx)("div",{className:"yst-mt-3 sm:yst-hidden",children:(0,pe.jsx)(i.Button,{variant:"secondary",onClick:a,className:"yst-w-full sm:yst-w-auto",children:(0,ne.__)("Close","wordpress-seo")})})]})]}),(0,pe.jsxs)(i.Notifications,{className:"yst-mx-[calc(50%-50vw)] yst-transition-all",style:{bottom:R},position:"bottom-left",children:[g.status!==se.loading&&(0,pe.jsx)(Xr,{className:"yst-mx-[calc(50%-50vw)] yst-transition-all"}),(g.status===se.success||g.status===se.loading)&&(0,pe.jsx)(Gr,{})]})]})};Cs.propTypes={height:D().number.isRequired,onFatalError:D().func.isRequired};const ks=({onActivateFreeSparks:e})=>{const{premiumUpsellLink:s,wooUpsellLink:r,isWooCommerceActive:o,isProductPost:n,learnMoreLink:a,imageLink:l,wistiaEmbedPermissionValue:c,wistiaEmbedPermissionStatus:d,isUsageCountLimitReached:p,activateFreeSparksEndpoint:u}=(0,t.useSelect)(e=>{const t=e(H),s=e(z);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:h,initialFocus:m}=(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(z),s=e(H);return{isWooProductEntity:t.getIsWooProductEntity(),isProductPost:t.getIsProduct(),hasValidWooSubscription:s.selectWooCommerceSubscription()}},[]);return(0,ae.useMemo)(()=>{const t={upsellLink:e.premium,upsellLabel:(0,ne.sprintf)(/* translators: %1$s expands to Yoast SEO Premium. */ /* translators: %1$s expands to Yoast SEO Premium. */
62 -(0,ne.__)("Unlock with %1$s","wordpress-seo"),"Yoast SEO Premium"),newToText:"Yoast SEO Premium",ctbId:"f6a84663-465f-4cb5-8ba5-f7a6d72224b2",title:(0,ne.__)("Use AI to generate your titles & descriptions!","wordpress-seo")};return s&&(r&&(t.title=(0,ne.__)("Generate product titles & descriptions with AI!","wordpress-seo")),i||(t.newToText="Yoast WooCommerce SEO",t.upsellLabel=(0,ne.sprintf)(/* translators: %1$s expands to Yoast WooCommerce SEO. */ /* translators: %1$s expands to Yoast WooCommerce SEO. */
63 -(0,ne.__)("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,ae.useMemo)(()=>o&&n,[o,n]),b=(0,ae.useMemo)(()=>({src:l,width:"432",height:"244"}),[l]),{setWistiaEmbedPermission:S}=(0,t.useDispatch)(z),{activateFreeSparks:j}=(0,t.useDispatch)(H),C=(0,ae.useMemo)(()=>({value:c,status:d,set:S}),[c,d,S]),k=(0,ae.useCallback)(()=>{j({endpoint:u}),e()},[j,u,h,e]),_={a:(0,pe.jsx)(Te,{href:a,className:"yst-inline-flex yst-items-center yst-gap-1 yst-no-underline yst-font-medium",variant:"primary"}),ArrowNarrowRightIcon:(0,pe.jsx)(ge(),{className:"yst-w-4 yst-h-4 rtl:yst-rotate-180"})};return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsxs)("div",{className:"yst-px-10 yst-pt-10 yst-introduction-gradient yst-text-center",children:[(0,pe.jsxs)("div",{className:"yst-relative yst-w-full",children:[(0,pe.jsx)($e,{videoId:"vmrahpfjxp",thumbnail:b,wistiaEmbedPermission:C}),(0,pe.jsx)(i.Badge,{className:"yst-absolute yst--top-2 yst-end-4",variant:"info",children:"Beta"})]}),(0,pe.jsx)("div",{className:"yst-mt-6 yst-text-xs yst-font-medium yst-flex yst-flex-col yst-items-center",children:(0,pe.jsxs)("span",{className:"yst-introduction-modal-uppercase yst-flex yst-gap-2 yst-items-center",children:[(0,pe.jsx)("span",{className:"yst-logo-icon"}),f]})})]}),(0,pe.jsxs)("div",{className:"yst-px-10 yst-pb-4 yst-flex yst-flex-col yst-items-center",children:[(0,pe.jsxs)("div",{className:"yst-mt-4 yst-mx-1.5 yst-text-center",children:[(0,pe.jsx)("h3",{className:"yst-text-slate-900 yst-text-lg yst-font-medium",children:g}),(0,pe.jsx)("div",{className:"yst-mt-2 yst-text-slate-600 yst-text-sm",children:le(v?(0,ne.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. */
64 -(0,ne.__)("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,ne.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. */
65 -(0,ne.__)("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>"),_)})]}),p&&(0,pe.jsx)(i.Alert,{className:"yst-my-4",children:(0,ne.sprintf)(/* translators: %s is for Yoast SEO Premium. */ /* translators: %s is for Yoast SEO Premium. */
66 -(0,ne.__)("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,pe.jsxs)("div",{className:Me()("yst-w-full yst-flex yst-flex-col",p?"yst-mt-0":"yst-mt-6"),children:[(0,pe.jsxs)(i.Button,{as:"a",className:"yst-grow",size:"extra-large",variant:"upsell",href:x,target:"_blank",ref:m,"data-action":"load-nfd-ctb","data-ctb-id":w,children:[(0,pe.jsx)(he(),{className:"yst--ms-1 yst-me-2 yst-h-5 yst-w-5"}),y,(0,pe.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
67 -(0,ne.__)("(Opens in a new browser tab)","wordpress-seo")})]}),!p&&(0,pe.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,ne.__)("Try for free","wordpress-seo")})]}),(0,pe.jsx)(i.Button,{as:"a",className:"yst-mt-4",variant:"tertiary",onClick:h,children:(0,ne.__)("Close","wordpress-seo")})]})]})},_s=({isOpen:e,onClose:t,closeButtonScreenReaderText:s,panelRef:r,title:o,aiModalHelperLink:n,children:a})=>{const l=(0,i.useSvgAria)();return(0,pe.jsx)(i.Modal,{className:"yst-ai-modal",isOpen:e,onClose:t,children:(0,pe.jsx)(i.Modal.Panel,{ref:r,className:"yst-max-w-3xl yst-relative",closeButtonScreenReaderText:s,children:(0,pe.jsxs)(i.Modal.Container,{children:[(0,pe.jsxs)(i.Modal.Container.Header,{children:[(0,pe.jsxs)("div",{className:"yst-flex yst-items-center",children:[(0,pe.jsx)("span",{className:"yst-logo-icon yst-h-5 yst-w-5"}),(0,pe.jsx)(i.Modal.Title,{className:"yst-ms-3 yst-me-1.5",as:"h1",size:"2",children:o}),(0,pe.jsx)(i.Link,{id:"ai-modal-learn-more",href:n,variant:"primary",className:"yst-no-underline yst-me-2",target:"_blank",rel:"noopener"
68 -/* translators: Hidden accessibility text. */,"aria-label":(0,ne.__)("Learn more about AI (Opens in a new browser tab)","wordpress-seo"),children:(0,pe.jsx)($t(),{...l,className:"yst-w-4 yst-h-4 yst-text-slate-500 yst-shrink-0"})}),(0,pe.jsx)(i.Badge,{variant:"info",children:(0,ne.__)("Beta","wordpress-seo")})]}),(0,pe.jsx)("hr",{className:"yst-mt-6 yst--mx-6"})]}),a]})})})},Es=({isOpen:e,onClose:t,closeButtonScreenReaderText:s,children:r})=>(0,pe.jsx)(i.Modal,{className:"yst-introduction-modal",isOpen:e,onClose:t,children:(0,pe.jsx)(i.Modal.Panel,{className:"yst-max-w-lg yst-p-0 yst-rounded-3xl",closeButtonScreenReaderText:s,children:r})}),Rs={inactive:"inactive",askConsent:"askConsent",upsell:"upsell",generate:"generate"},Is=({onUseAi:e})=>{const[s,r]=(0,ae.useState)(Rs.inactive),{editType:o,previewType:n}=es(),a=ss(),l=(()=>{const{editType:e,previewType:t}=es();switch(t){case V:return e===X?(0,ne.__)("AI social description generator","wordpress-seo"):(0,ne.__)("AI social title generator","wordpress-seo");case K:return e===X?(0,ne.__)("AI X description generator","wordpress-seo"):(0,ne.__)("AI X title generator","wordpress-seo");default:return e===X?(0,ne.__)("AI description generator","wordpress-seo"):(0,ne.__)("AI title generator","wordpress-seo")}})(),{hasConsent:c,promptContentInitialized:d,currentSubscriptions:p,usageCountStatus:u,usageCount:h,usageCountLimit:m,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(H),s=e(z);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(H).selectIsFreeSparksActive()}},[]),{fetchUsageCount:k}=(0,t.useDispatch)(H),{closeEditorModal:_}=(0,t.useDispatch)(z),E=(0,ne.__)("Close modal","wordpress-seo"),[R,L]=(0,ae.useState)(!1),[A,M]=(0,ae.useState)(0),P=(0,ae.useCallback)(e=>M(e.borderBoxSize[0].blockSize),[M]),N=rs(P),[O,$]=(0,ae.useState)(null),F=(0,ae.useCallback)(({currentSubscriptions:e,isSeoAnalysisActive:s})=>{const r=(e=>{const s=(0,t.select)(z),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)(H);if(r.selectUsageCountStatus()!==T)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:""}},[]),q=(0,ae.useCallback)(()=>{r(Rs.inactive)},[]),U=(0,ae.useCallback)(()=>$(null),[]),W=(0,ae.useCallback)(()=>{$(null),r(Rs.generate)},[]),B=(0,ae.useCallback)(()=>{$(F({currentSubscriptions:p,isSeoAnalysisActive:v})),r(Rs.inactive)},[F,p,v]),G=(0,ae.useCallback)(e=>{$(e),r(Rs.inactive)},[]),D={onClose:q,closeButtonScreenReaderText:E},Y=(0,ae.useCallback)(()=>!Vt(w),[w]),Z=bs(!1),J=(0,ae.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]),Q=(0,ae.useCallback)(()=>S?x&&y:y,[y,x,S]),ee=(0,ae.useCallback)(async()=>{if(e(),!v)return void B();if(!Y())return r(Rs.inactive),void J();const t=Q();if(!t&&f&&C&&S)return void B();if(!t&&f&&!S)return void B();if(!c&&(j||t))return void r(Rs.askConsent);L(!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;L(!1),o?B():403!==(null==i?void 0:i.errorCode)||!j&&!t?s!==ds||429===(null==i?void 0:i.errorCode)||403===(null==i?void 0:i.errorCode)?s===ds&&429===(null==i?void 0:i.errorCode)&&t?B():!t&&!j||!t&&n?r(Rs.upsell):(t&&c&&r(Rs.generate),!t&&j&&!n&&c&&r(Rs.generate)):B():r(Rs.askConsent)},[e,f,j,c,v,Y,J,B,g,k,C,S,R]),te=(0,ae.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=Q();!s||i?e!==ds?r(Rs.generate):B():r(Rs.upsell)},[r,B,g,k,Q,S]),se=(0,ae.useCallback)(()=>{r(c?Rs.generate:Rs.askConsent)},[r,c]),re=(0,ae.useMemo)(()=>"google"===n?"title"===o?(0,ne.__)("Generate SEO title","wordpress-seo"):(0,ne.__)("Generate meta description","wordpress-seo"):"social"===n||"twitter"===n?"title"===o?(0,ne.__)("Generate social title","wordpress-seo"):(0,ne.__)("Generate social description","wordpress-seo"):void 0,[n,o]);return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(i.Button,{type:"button",variant:"ai-secondary",size:"small",id:`yst-replacevar__use-ai-button__${o}__${a}`,onClick:ee,disabled:u===I||!d,isLoading:R&&u===I,children:re}),(0,pe.jsxs)(Es,{...D,isOpen:[Rs.askConsent,Rs.upsell].includes(s),children:[s===Rs.askConsent&&(0,pe.jsx)(ws,{onStartGenerating:te}),s===Rs.upsell&&(0,pe.jsx)(ks,{onActivateFreeSparks:se})]}),(0,pe.jsx)(_s,{...D,isOpen:s===Rs.generate,aiModalHelperLink:b,panelRef:N,title:l,children:s===Rs.generate&&(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(Ft.UsageCounter,{limit:m,requests:h,isSkeleton:!1,className:"yst-absolute yst-top-[-11px] yst-end-12 sm:yst-end-16",mentionBetaInTooltip:f,mentionResetInTooltip:f}),(0,pe.jsx)(Cs,{height:A,onFatalError:G})]})}),O&&(0,pe.jsx)(Nt,{isOpen:!0,errorCode:O.errorCode,errorIdentifier:O.errorIdentifier,invalidSubscriptions:O.invalidSubscriptions,errorMessage:O.errorMessage,showActions:!0,onRetry:W,onClose:U})]})};Is.propTypes={onUseAi:D().func.isRequired};const Ls=({title:e,description:s,status:r,titleForLength:o,showPreviewSkeleton:n,showLengthProgress:a})=>{const l=(0,t.useSelect)(e=>e(z).getSnippetEditorMode(),[]),[c,d]=(0,ae.useState)(l),{editType:p}=es(),u=ss(),h=(({editType:e,title:s,description:r})=>{const i=(0,t.useSelect)(e=>e(z).getDateFromSettings(),[]),o=(0,t.useSelect)(e=>e(z).getContentLocale(),[]),n=(0,t.useSelect)(e=>e(z).isCornerstoneContent(),[]),a=(0,t.useSelect)(e=>e(z).getIsTerm(),[]);return(0,ae.useMemo)(()=>e===X?(0,ns.getDescriptionProgress)(r,i,n,a,o):(0,ns.getTitleProgress)(s),[e,s,r,i,n,a,o])})({editType:p,title:o,description:s});return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)(ns.ModeSwitcher,{onChange:d,active:c,id:`yst-ai-google-preview-mode-switcher-${u}`,disabled:r===se.loading}),n?(0,pe.jsx)(Ms,{}):(0,pe.jsx)(As,{mode:c,title:e,description:s}),(0,pe.jsxs)("div",{className:"yst-pt-4",children:[(0,pe.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:p===Z?(0,ne.__)("SEO title width","wordpress-seo"):(0,ne.__)("Meta description length","wordpress-seo")}),(0,pe.jsx)(Ps,{className:"yst-mt-2",progress:a?h.actual:0,min:0,max:h.max,score:h.score})]})]})};Ls.propTypes={title:D().string.isRequired,description:D().string.isRequired,status:D().oneOf(Object.keys(se)).isRequired,titleForLength:D().string.isRequired,showPreviewSkeleton:D().bool.isRequired,showLengthProgress:D().bool.isRequired};const Ts=/mobi/i,As=({mode:e,title:s,description:r})=>{var i,n;const a=(0,t.useSelect)(e=>e(z).getBaseUrlFromSettings(),[]),l=(0,t.useSelect)(e=>e(z).getSnippetEditorData().slug||"",[]),c=(0,t.useSelect)(e=>e(z).getDateFromSettings(),[]),d=(0,t.useSelect)(e=>e(z).getFocusKeyphrase(),[]),p=(0,t.useSelect)(e=>e(z).getSnippetEditorPreviewImageUrl(),[]),u=(0,t.useSelect)(e=>e(z).getSiteIconUrlFromSettings(),[]),h=(0,t.useSelect)(e=>e(z).getShoppingData(),[]),m=(0,t.useSelect)(e=>e(z).getSnippetEditorWordsToHighlight(),[]),g=(0,t.useSelect)(e=>e(z).getSiteName(),[]),y=(0,t.useSelect)(e=>e(z).getContentLocale(),[]),x=(0,ae.useMemo)(()=>a+l,[a,l]),w=(0,ae.useMemo)(()=>{var e,t;return Ts.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,pe.jsx)("div",{className:`yst-ai-generator-preview-section ${e}${w?" yst-user-agent__mobile":""}`,children:(0,pe.jsx)(ns.SnippetPreview,{title:s,description:r,mode:e,url:x,keyword:d,date:c,faviconSrc:u,mobileImageSrc:p,wordsToHighlight:m,siteName:g,locale:y,shoppingData:h,onMouseUp:o.noop})})};As.propTypes={mode:D().oneOf(Object.keys({mobile:"mobile",desktop:"desktop"})).isRequired,title:D().string.isRequired,description:D().string.isRequired};const Ms=()=>(0,pe.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,pe.jsxs)("div",{className:"yst-flex yst-gap-x-3",children:[(0,pe.jsx)(i.SkeletonLoader,{className:"yst-flex-shrink-0 yst-h-7 yst-w-7 yst-rounded-full"}),(0,pe.jsxs)("div",{className:"yst-flex yst-flex-col yst-w-full yst-gap-y-1",children:[(0,pe.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,pe.jsx)(i.SkeletonLoader,{className:"yst-h-2.5 yst-w-10/12"})]})]}),(0,pe.jsx)(i.SkeletonLoader,{className:"yst-h-4 yst-w-full yst-mt-6 yst-mb-4"}),(0,pe.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-full"}),(0,pe.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-10/12 yst-mt-2.5"})]}),Ps=({className:e="",progress:t,max:s,score:r})=>{const o=(0,ae.useMemo)(()=>(e=>e>=7?"yst-score-good":e>=5?"yst-score-ok":"yst-score-bad")(r),[r]);return(0,pe.jsx)(i.ProgressBar,{className:Me()("yst-length-progress-bar",o,e),progress:t,min:0,max:s})};Ps.propTypes={className:D().string,progress:D().number.isRequired,max:D().number.isRequired,score:D().number.isRequired};const Ns=({title:e,description:t,showPreviewSkeleton:s})=>(0,pe.jsxs)("div",{children:[(0,pe.jsx)("div",{className:"yst-flex yst-mb-6",children:(0,pe.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:(0,ne.__)("Social preview","wordpress-seo")})}),s?(0,pe.jsx)(Mr,{}):(0,pe.jsx)(Ar,{title:e,description:t})]});Ns.propTypes={title:D().string.isRequired,description:D().string.isRequired,showPreviewSkeleton:D().bool.isRequired};const Os=window.yoast.styledComponents;var $s=s.n(Os);const Fs=$s().p`
48 +(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. */
49 +(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. */
50 +(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. */
51 +(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. */
52 +(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. */
53 +(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. */
54 +(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. */
55 +(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"
56 +/* translators: Hidden accessibility text. */,screenReaderTextPrevious:(0,xe.__)("Previous","wordpress-seo")
57 +/* 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. */
58 +(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. */
59 +(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. */
60 +(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. */
61 +(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. */
62 +(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. */
63 +(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. */
64 +(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. */
65 +(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. */
66 +(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. */
67 +(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"
68 +/* 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`
69 69 color: #606770;
70 70 flex-shrink: 0;
71 71 font-size: 12px;
72 72 line-height: 16px;
@@ -76,9 +76,9 @@
76 76 text-transform: uppercase;
77 77 white-space: nowrap;
78 78 margin: 0;
79 79 position: ${e=>"landscape"===e.mode?"relative":"static"};
80 -`,qs=e=>{const{siteUrl:t}=e;return(0,pe.jsxs)(fe.Fragment,{children:[(0,pe.jsx)("span",{className:"screen-reader-text",children:t}),(0,pe.jsx)(Fs,{"aria-hidden":"true",children:(0,pe.jsx)("span",{children:t})})]})};qs.propTypes={siteUrl:D().string.isRequired};const Us=qs,Ws=window.yoast.socialMetadataForms,Bs=window.yoast.styleGuide,Gs=$s().img`
80 +`,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`
81 81 && {
82 82 max-width: ${e=>e.width}px;
83 83 height: ${e=>e.height}px;
84 84 position: absolute;
@@ -86,9 +86,9 @@
86 86 left: 50%;
87 87 transform: translate(-50%, -50%);
88 88 max-width: none;
89 89 }
90 -`,Ds=$s().img`
90 +`,rr=Zs().img`
91 91 && {
92 92 height: 100%;
93 93 position: absolute;
94 94 width: 100%;
@@ -93,20 +93,20 @@
93 93 position: absolute;
94 94 width: 100%;
95 95 object-fit: cover;
96 96 }
97 -`,Hs=$s().div`
97 +`,ir=Zs().div`
98 98 padding-bottom: ${e=>e.aspectRatio}%;
99 -`,zs=({imageProps:e,width:t,height:s,imageMode:r="landscape"})=>"landscape"===r?(0,pe.jsx)(Hs,{aspectRatio:e.aspectRatio,children:(0,pe.jsx)(Ds,{src:e.src,alt:e.alt})}):(0,pe.jsx)(Gs,{src:e.src,alt:e.alt,width:t,height:s,imageProperties:e});function Ys(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 Vs(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 Ks(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,Ws.determineFacebookImageMode)(r));const o=function(e){return"Twitter"===e?Ws.TWITTER_IMAGE_SIZES:Ws.FACEBOOK_IMAGE_SIZES}(t),n=function(e,t,s){return"square"===s&&t.width===t.height?{width:e.squareWidth,height:e.squareHeight}:Vs(t,Ys(e,t,s))}(o,r,i);return{mode:i,height:n.height,width:n.width}}async function Zs(e,t,s=!1){try{return{imageProperties:await Ks(e,t,s),status:"loaded"}}catch(e){return{imageProperties:null,status:"errored"}}}zs.propTypes={imageProps:D().shape({src:D().string.isRequired,alt:D().string.isRequired,aspectRatio:D().number.isRequired}).isRequired,width:D().number.isRequired,height:D().number.isRequired,imageMode:D().string};const Xs=$s().div`
99 +`,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`
100 100 position: relative;
101 101 ${e=>"landscape"===e.mode?`max-width: ${e.dimensions.width}`:`min-width: ${e.dimensions.width}; height: ${e.dimensions.height}`};
102 102 overflow: hidden;
103 - background-color: ${Bs.colors.$color_white};
104 -`,Js=$s().div`
103 + background-color: ${tr.colors.$color_white};
104 +`,ur=Zs().div`
105 105 box-sizing: border-box;
106 - max-width: ${Ws.FACEBOOK_IMAGE_SIZES.landscapeWidth}px;
107 - height: ${Ws.FACEBOOK_IMAGE_SIZES.landscapeHeight}px;
108 - background-color: ${Bs.colors.$color_grey};
106 + max-width: ${er.FACEBOOK_IMAGE_SIZES.landscapeWidth}px;
107 + height: ${er.FACEBOOK_IMAGE_SIZES.landscapeHeight}px;
108 + background-color: ${tr.colors.$color_grey};
109 109 border-style: dashed;
110 110 border-width: 1px;
111 111 // We're not using standard colors to increase contrast for accessibility.
112 112 color: #006DAC;
@@ -117,9 +117,9 @@
117 117 align-items: center;
118 118 text-decoration: underline;
119 119 font-size: 14px;
120 120 cursor: pointer;
121 -`;class Qs extends fe.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 Zs(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:Ws.FACEBOOK_IMAGE_SIZES.squareHeight+"px",width:Ws.FACEBOOK_IMAGE_SIZES.squareWidth+"px"};case"portrait":return{height:Ws.FACEBOOK_IMAGE_SIZES.portraitHeight+"px",width:Ws.FACEBOOK_IMAGE_SIZES.portraitWidth+"px"};case"landscape":return{height:Ws.FACEBOOK_IMAGE_SIZES.landscapeHeight+"px",width:Ws.FACEBOOK_IMAGE_SIZES.landscapeWidth+"px"}}}render(){const{imageProperties:e,status:t}=this.state;if("loading"===t||""===this.props.src||"errored"===t)return(0,pe.jsx)(Js,{onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,ne.__)("Select image","wordpress-seo")});const s=this.retrieveContainerDimensions(e.mode);return(0,pe.jsx)(Xs,{mode:e.mode,dimensions:s,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,onClick:this.props.onImageClick,children:(0,pe.jsx)(zs,{imageProps:{src:this.props.src,alt:this.props.alt,aspectRatio:Ws.FACEBOOK_IMAGE_SIZES.aspectRatio},width:e.width,height:e.height,imageMode:e.mode})})}}Qs.propTypes={src:D().string,alt:D().string,onImageLoaded:D().func,onImageClick:D().func,onMouseEnter:D().func,onMouseLeave:D().func},Qs.defaultProps={src:"",alt:"",onImageLoaded:o.noop,onImageClick:o.noop,onMouseEnter:o.noop,onMouseLeave:o.noop};const er=Qs,tr=$s().span`
121 +`;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`
122 122 line-height: ${20}px;
123 123 min-height : ${20}px;
124 124 color: #1d2129;
125 125 font-weight: 600;
@@ -133,9 +133,9 @@
133 133 display: -webkit-box;
134 134 -webkit-line-clamp: ${e=>e.lineCount};
135 135 -webkit-box-orient: vertical;
136 136 overflow: hidden;
137 -`,sr=$s().p`
137 +`,gr=Zs().p`
138 138 line-height: ${16}px;
139 139 min-height : ${16}px;
140 140 color: #606770;
141 141 font-size: 14px;
@@ -150,15 +150,15 @@
150 150
151 151 @media all and ( max-width: ${e=>e.maxWidth} ) {
152 152 display: none;
153 153 }
154 -`,rr=e=>{switch(e){case"landscape":return"527px";case"square":case"portrait":return"369px";default:return"476px"}},ir=$s().div`
154 +`,yr=e=>{switch(e){case"landscape":return"527px";case"square":case"portrait":return"369px";default:return"476px"}},xr=Zs().div`
155 155 box-sizing: border-box;
156 156 display: flex;
157 157 flex-direction: ${e=>"landscape"===e.mode?"column":"row"};
158 158 background-color: #f2f3f5;
159 159 max-width: 527px;
160 -`,or=$s().div`
160 +`,wr=Zs().div`
161 161 box-sizing: border-box;
162 162 background-color: #f2f3f5;
163 163 margin: 0;
164 164 padding: 10px 12px;
@@ -172,9 +172,9 @@
172 172 flex-grow: 1;
173 173 justify-content: ${e=>"landscape"===e.mode?"flex-start":"center"};
174 174 font-size: 12px;
175 175 overflow: hidden;
176 -`;class nr extends fe.Component{constructor(e){super(e),this.state={imageMode:null,maxLineCount:0,descriptionLineCount:0},this.facebookTitleRef=ve().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,pe.jsxs)(ir,{id:"facebookPreview",mode:e,children:[(0,pe.jsx)(er,{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,pe.jsxs)(or,{mode:e,children:[(0,pe.jsx)(Us,{siteUrl:this.props.siteUrl,mode:e}),(0,pe.jsx)(tr,{ref:this.facebookTitleRef,onMouseEnter:this.onTitleEnter,onMouseLeave:this.onLeave,onClick:this.onSelectTitle,lineCount:t,children:this.props.title}),s>0&&(0,pe.jsx)(sr,{maxWidth:rr(e),onMouseEnter:this.onDescriptionEnter,onMouseLeave:this.onLeave,onClick:this.onSelectDescription,lineCount:s,children:this.props.description})]})]})}}nr.propTypes={siteUrl:D().string.isRequired,title:D().string.isRequired,description:D().string,imageUrl:D().string,imageFallbackUrl:D().string,alt:D().string,onSelect:D().func,onImageClick:D().func,onMouseHover:D().func},nr.defaultProps={description:"",alt:"",imageUrl:"",imageFallbackUrl:"",onSelect:()=>{},onImageClick:()=>{},onMouseHover:()=>{}};const ar=nr,lr=$s().div`
176 +`;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`
177 177 text-transform: lowercase;
178 178 color: rgb(83, 100, 113);
179 179 white-space: nowrap;
180 180 overflow: hidden;
@@ -183,16 +183,16 @@
183 183 fill: currentcolor;
184 184 display: flex;
185 185 flex-direction: row;
186 186 align-items: flex-end;
187 -`,cr=e=>(0,pe.jsx)(lr,{children:(0,pe.jsx)("span",{children:e.siteUrl})});cr.propTypes={siteUrl:D().string.isRequired};const dr=cr,pr=(e,t=!0)=>e?`\n\t\t\tmax-width: ${Ws.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: ${Ws.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`,ur=$s().div`
187 +`,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`
188 188 position: relative;
189 189 box-sizing: content-box;
190 190 overflow: hidden;
191 191 background-color: #e1e8ed;
192 192 flex-shrink: 0;
193 - ${e=>pr(e.isLarge)}
194 -`,hr=$s().div`
193 + ${e=>Cr(e.isLarge)}
194 +`,_r=Zs().div`
195 195 display: flex;
196 196 justify-content: center;
197 197 align-items: center;
198 198 box-sizing: border-box;
@@ -200,11 +200,11 @@
200 200 margin: 0;
201 201 padding: 1em;
202 202 text-align: center;
203 203 font-size: 1rem;
204 - ${e=>pr(e.isLarge,!1)}
205 -`,mr=$s()(hr)`
206 - ${e=>e.isLarge&&`height: ${Ws.TWITTER_IMAGE_SIZES.landscapeHeight}px;`}
204 + ${e=>Cr(e.isLarge,!1)}
205 +`,Er=Zs()(_r)`
206 + ${e=>e.isLarge&&`height: ${er.TWITTER_IMAGE_SIZES.landscapeHeight}px;`}
207 207 border-top-left-radius: 14px;
208 208 ${e=>e.isLarge?"border-top-right-radius":"border-bottom-left-radius"}: 14px;
209 209 border-style: dashed;
210 210 border-width: 1px;
@@ -214,9 +214,9 @@
214 214 background-color: #f1f1f1;
215 215 text-decoration: underline;
216 216 font-size: 14px;
217 217 cursor: pointer;
218 -`;class gr extends ve().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 Zs(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,pe.jsx)(mr,{isLarge:this.props.isLarge,onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,ne.__)("Select image","wordpress-seo")}):(0,pe.jsx)(ur,{isLarge:this.props.isLarge,onClick:this.props.onImageClick,onMouseEnter:this.props.onMouseEnter,onMouseLeave:this.props.onMouseLeave,children:(0,pe.jsx)(zs,{imageProps:{src:this.props.src,alt:this.props.alt,aspectRatio:Ws.TWITTER_IMAGE_SIZES.aspectRatio},width:t.width,height:t.height,imageMode:t.mode})})}}gr.propTypes={isLarge:D().bool.isRequired,src:D().string,alt:D().string,onImageClick:D().func,onMouseEnter:D().func,onMouseLeave:D().func},gr.defaultProps={src:"",alt:"",onMouseEnter:o.noop,onImageClick:o.noop,onMouseLeave:o.noop};const yr=$s().div`
218 +`;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`
219 219 display: flex;
220 220 flex-direction: column;
221 221 padding: 12px;
222 222 justify-content: center;
@@ -229,9 +229,9 @@
229 229 line-height:20px;
230 230 min-height:20px;
231 231 font-size:15px;
232 232 }
233 -`,xr=e=>(0,pe.jsx)(yr,{children:e.children});xr.propTypes={children:D().array.isRequired};const wr=xr,fr=$s().p`
233 +`,Lr=e=>(0,Se.jsx)(Ir,{children:e.children});Lr.propTypes={children:te().array.isRequired};const Tr=Lr,Ar=Zs().p`
234 234 white-space: nowrap;
235 235 overflow: hidden;
236 236 text-overflow: ellipsis;
237 237 margin: 0;
@@ -236,9 +236,9 @@
236 236 text-overflow: ellipsis;
237 237 margin: 0;
238 238 color: rgb(15, 20, 25);
239 239 cursor: pointer;
240 -`,vr=$s().p`
240 +`,Mr=Zs().p`
241 241 max-height: 55px;
242 242 overflow: hidden;
243 243 text-overflow: ellipsis;
244 244 margin: 0;
@@ -247,12 +247,12 @@
247 247 cursor: pointer;
248 248 -webkit-line-clamp: 2;
249 249 -webkit-box-orient: vertical;
250 250
251 - @media all and ( max-width: ${Ws.TWITTER_IMAGE_SIZES.landscapeWidth}px ) {
251 + @media all and ( max-width: ${er.TWITTER_IMAGE_SIZES.landscapeWidth}px ) {
252 252 display: none;
253 253 }
254 -`,br=$s().div`
254 +`,Pr=Zs().div`
255 255 font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", sans-serif;
256 256 font-size: 15px;
257 257 font-weight: 400;
258 258 line-height: 20px;
@@ -268,17 +268,17 @@
268 268 &:hover {
269 269 background: #f5f8fa;
270 270 border: 1px solid rgba(136,153,166,.5);
271 271 }
272 -`,Sr=$s()(br)`
272 +`,Nr=Zs()(Pr)`
273 273 flex-direction: column;
274 274 max-height: 370px;
275 -`,jr=$s()(br)`
275 +`,Or=Zs()(Pr)`
276 276 flex-direction: row;
277 277 height: 125px;
278 -`;class Cr extends fe.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?Sr:jr;return(0,pe.jsxs)(a,{id:"twitterPreview",children:[(0,pe.jsx)(gr,{src:t||s,alt:r,isLarge:e,onImageClick:this.props.onImageClick,onMouseEnter:this.onImageEnter,onMouseLeave:this.onLeave}),(0,pe.jsxs)(wr,{children:[(0,pe.jsx)(dr,{siteUrl:n}),(0,pe.jsx)(fr,{onMouseEnter:this.onTitleEnter,onMouseLeave:this.onLeave,onClick:this.onSelectTitle,children:i}),(0,pe.jsx)(vr,{onMouseEnter:this.onDescriptionEnter,onMouseLeave:this.onLeave,onClick:this.onSelectDescription,children:o})]})]})}}Cr.propTypes={siteUrl:D().string.isRequired,title:D().string.isRequired,description:D().string,isLarge:D().bool,imageUrl:D().string,imageFallbackUrl:D().string,alt:D().string,onSelect:D().func,onImageClick:D().func,onMouseHover:D().func},Cr.defaultProps={description:"",alt:"",imageUrl:"",imageFallbackUrl:"",onSelect:()=>{},onImageClick:()=>{},onMouseHover:()=>{},isLarge:!0};const kr=Cr,_r=window.yoast.componentsNew,Er=window.yoast.replacementVariableEditor;class Rr extends fe.Component{constructor(e){super(e),this.state={activeField:"",hoveredField:""},this.SocialPreview="Social"===e.socialMediumName?ar:kr,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:p,alt:u,title:h,titleInputPlaceholder:m,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:h||g,description:a||c});return(0,pe.jsxs)(ve().Fragment,{children:[S&&(0,pe.jsx)(_r.SimulatedLabel,{children:S}),(0,pe.jsx)(this.SocialPreview,{onMouseHover:this.setHoveredField,onSelect:this.setActiveField,onImageClick:s,siteUrl:n,title:k.title,description:k.description,imageUrl:d,imageFallbackUrl:p,alt:u,isLarge:b,activeMetaTabId:C}),(0,pe.jsx)(Ws.SocialMetadataPreviewForm,{onDescriptionChange:e,socialMediumName:i,title:h,titleInputPlaceholder:m,onRemoveImageClick:r,imageSelected:!!d,imageUrl:d,imageFallbackUrl:p,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})]})}}Rr.propTypes={title:D().string.isRequired,onTitleChange:D().func.isRequired,description:D().string.isRequired,onDescriptionChange:D().func.isRequired,imageUrl:D().string.isRequired,imageFallbackUrl:D().string.isRequired,onSelectImageClick:D().func.isRequired,onRemoveImageClick:D().func.isRequired,socialMediumName:D().string.isRequired,alt:D().string,isPremium:D().bool,imageWarnings:D().array,isLarge:D().bool,siteUrl:D().string,descriptionInputPlaceholder:D().string,titleInputPlaceholder:D().string,descriptionPreviewFallback:D().string,titlePreviewFallback:D().string,replacementVariables:Er.replacementVariablesShape,recommendedReplacementVariables:Er.recommendedReplacementVariablesShape,applyReplacementVariables:D().func,onReplacementVariableSearchChange:D().func,socialPreviewLabel:D().string,idSuffix:D().string,activeMetaTabId:D().string},Rr.defaultProps={imageWarnings:[],recommendedReplacementVariables:[],replacementVariables:[],isPremium:!1,isLarge:!0,siteUrl:"",descriptionInputPlaceholder:"",titleInputPlaceholder:"",descriptionPreviewFallback:"",titlePreviewFallback:"",alt:"",applyReplacementVariables:e=>e,onReplacementVariableSearchChange:null,socialPreviewLabel:"",idSuffix:"",activeMetaTabId:""};const Ir={},Lr=(e,t,{log:s=console.warn}={})=>{Ir[e]||(Ir[e]=!0,s(t))},Tr=(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};Tr({squareWidth:125,squareHeight:125,landscapeWidth:506,landscapeHeight:265,aspectRatio:50.2},(e,t)=>Lr(`@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.`)),Tr({squareWidth:158,squareHeight:158,landscapeWidth:527,landscapeHeight:273,portraitWidth:158,portraitHeight:237,aspectRatio:52.2,largeThreshold:{width:446,height:233}},(e,t)=>Lr(`@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 Ar=({title:e,description:s})=>{const r=(0,t.useSelect)(e=>e(z).getSiteUrl(),[]),i=(0,t.useSelect)(e=>e(z).getFacebookImageUrl(),[]),n=(0,t.useSelect)(e=>e(z).getEditorDataImageFallback(),[]),a=(0,t.useSelect)(e=>e(z).getFacebookAltText(),[]);return(0,pe.jsx)("div",{className:"yst-ai-generator-preview-section",children:(0,pe.jsx)(ar,{title:e,description:s,siteUrl:r,imageUrl:i,imageFallbackUrl:n,alt:a,onSelect:o.noop,onImageClick:o.noop,onMouseHover:o.noop})})};Ar.propTypes={title:D().string.isRequired,description:D().string.isRequired};const Mr=()=>(0,pe.jsxs)("div",{className:"yst-flex yst-flex-col yst-w-[527px] yst-border yst-mx-auto",children:[(0,pe.jsx)(i.SkeletonLoader,{className:"yst-h-[273px] yst-w-full yst-rounded-none yst-border yst-border-dashed"}),(0,pe.jsxs)("div",{className:"yst-w-full yst-p-4 yst-space-y-1",children:[(0,pe.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,pe.jsx)(i.SkeletonLoader,{className:"yst-h-5 yst-w-10/12"}),(0,pe.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-full"})]})]}),Pr=()=>(0,pe.jsxs)(i.Alert,{variant:"error",children:[(0,pe.jsx)("span",{className:"yst-block yst-font-medium",children:It}),(0,pe.jsx)(Lt,{})]}),Nr=({children:e,onRetry:t})=>{const{onClose:s}=(0,i.useModalContext)();return(0,pe.jsxs)(ae.Fragment,{children:[e,(0,pe.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,pe.jsx)(i.Button,{variant:"secondary",onClick:s,children:(0,ne.__)("Close","wordpress-seo")}),(0,pe.jsx)(i.Button,{variant:"primary",onClick:t,children:(0,ne.__)("Try again","wordpress-seo")})]})]})};Nr.propTypes={children:D().node.isRequired,onRetry:D().func.isRequired};const Or=({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,pe.jsx)(lt,{});case"NOT_ENOUGH_CONTENT":return(0,pe.jsx)(Ve,{});case"SITE_UNREACHABLE":return(0,pe.jsx)(Pr,{});case"WP_HTTP_REQUEST_ERROR":return r?(0,pe.jsx)(Nr,{onRetry:i,children:(0,pe.jsx)(pt,{errorMessage:n})}):(0,pe.jsx)(pt,{errorMessage:n});default:return r?(0,pe.jsx)(Nr,{onRetry:i,children:(0,pe.jsx)(He,{})}):(0,pe.jsx)(He,{})}case 402:return(0,pe.jsx)(st,{invalidSubscriptions:s});case 408:return r?(0,pe.jsx)(Nr,{onRetry:i,children:(0,pe.jsx)(ot,{})}):(0,pe.jsx)(ot,{});case 429:return"USAGE_LIMIT_REACHED"===t?(0,pe.jsx)(st,{invalidSubscriptions:s}):(0,pe.jsx)(Qe,{});case 410:return(0,pe.jsx)(mt,{});default:return r?(0,pe.jsx)(Nr,{onRetry:i,children:(0,pe.jsx)(He,{})}):(0,pe.jsx)(He,{})}};Or.propTypes={errorCode:D().number.isRequired,errorIdentifier:D().string.isRequired,invalidSubscriptions:D().array,showActions:D().bool,onRetry:D().func,errorMessage:D().string};const $r=D().shape({value:D().string.isRequired,label:D().node.isRequired}),Fr=({id:e,name:t,suggestion:s,isChecked:r,onChange:i})=>{const o=(0,ae.useCallback)(()=>i(s.value),[s,i]);return(0,pe.jsxs)("label",{htmlFor:e,className:Me()("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,pe.jsx)("input",{type:"radio",id:e,name:t,className:"yst-radio__input",value:s.value,checked:r,onChange:o}),(0,pe.jsx)("div",{className:Me()("yst-label yst-radio__label yst-flex yst-flex-wrap yst-items-center",!r&&"yst-text-slate-600"),children:s.label})]})};Fr.propTypes={id:D().string.isRequired,name:D().string.isRequired,suggestion:$r.isRequired,isChecked:D().bool.isRequired,onChange:D().func.isRequired};const qr=({idSuffix:e,suggestions:t,selected:s,onChange:r})=>(0,pe.jsx)("div",{children:(0,pe.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,pe.jsx)(Fr,{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}`))})});qr.propTypes={idSuffix:D().string.isRequired,suggestions:D().arrayOf($r).isRequired,selected:D().string.isRequired,onChange:D().func.isRequired};const Ur=[["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"]],Wr=({suggestionClassNames:e=Ur})=>(0,pe.jsx)("div",{className:"yst-flex yst-flex-col yst--space-y-[1px]",children:e.map((e,t)=>(0,pe.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,pe.jsx)("input",{type:"radio",disabled:!0,className:"yst-my-0.5"}),(0,pe.jsx)("div",{className:"yst-flex yst-flex-col yst-w-full",children:e.map((e,s)=>(0,pe.jsx)(i.SkeletonLoader,{className:e},`yst-ai-suggestion-radio-skeleton-${t}__${s}`))})]},`yst-ai-suggestion-radio-skeleton__${t}`))});Wr.propTypes={suggestionClassNames:D().arrayOf(D().arrayOf(D().string))};const Br="ai_generator_tip_notification",Gr=()=>{const e=(0,t.useSelect)(e=>e(z).isAlertDismissed(Br),[]),s=(0,t.useSelect)(e=>e(z).getEditorDataContent(),[]),r=(0,t.useSelect)(e=>e(z).getIsWooProductEntity(),[]),[o,,,n]=(0,i.useToggleState)(!1),{editType:a,contentType:l}=es(),{dismissAlert:c}=(0,t.useDispatch)(z),d=(0,ae.useCallback)(()=>{c(Br)},[c]),p=(0,ae.useMemo)(()=>a===X?(0,ne.__)("%1$sTip%2$s: Improve the accuracy of your generated AI descriptions by writing more content in your page.","wordpress-seo"):(0,ne.__)("%1$sTip%2$s: Improve the accuracy of your generated AI titles by writing more content in your page.","wordpress-seo")
279 -/* translators: %1$s and %2$s expand to opening and closing of a span in order to emphasise the word. */,[a]),u=(0,ae.useMemo)(()=>((e,t)=>e||t===Q?150:300)(r,l),[l,r]);return e||o||s.length>u?null:(0,pe.jsxs)(i.Notifications.Notification,{id:"ai-generator-content-tip",variant:"info",dismissScreenReaderLabel:(0,ne.__)("Dismiss","wordpress-seo"),children:[le((0,ne.sprintf)(p,"<span>","</span>"),{span:(0,pe.jsx)("span",{className:"yst-font-medium yst-text-slate-800"})}),(0,pe.jsxs)("div",{className:"yst-flex yst-mt-3 yst--ms-3 yst-gap-1",children:[(0,pe.jsx)(i.Button,{type:"button",variant:"tertiary",onClick:d,children:(0,ne.__)("Don’t show again","wordpress-seo")}),(0,pe.jsx)(i.Button,{type:"button",variant:"tertiary",className:"yst-text-slate-800",onClick:n,children:(0,ne.__)("Dismiss","wordpress-seo")})]})]})},Dr=({title:e,description:t,showPreviewSkeleton:s})=>(0,pe.jsxs)("div",{children:[(0,pe.jsx)("div",{className:"yst-flex yst-mb-6",children:(0,pe.jsx)(i.Label,{as:"span",className:"yst-flex-grow yst-cursor-default",children:(0,ne.__)("X preview","wordpress-seo")})}),s?(0,pe.jsx)(zr,{}):(0,pe.jsx)(Hr,{title:e,description:t})]});Dr.propTypes={title:D().string.isRequired,description:D().string.isRequired,showPreviewSkeleton:D().bool.isRequired};const Hr=({title:e,description:s})=>{const r=(0,t.useSelect)(e=>e(z).getSiteUrl(),[]),i=(0,t.useSelect)(e=>e(z).getTwitterImageUrl(),[]),n=(0,t.useSelect)(e=>e(z).getFacebookImageUrl(),[]),a=(0,t.useSelect)(e=>e(z).getEditorDataImageFallback(),[]),l=(0,t.useSelect)(e=>e(z).getTwitterImageType(),[]),c=(0,t.useSelect)(e=>e(z).getTwitterAltText(),[]);return(0,pe.jsx)("div",{className:"yst-ai-generator-preview-section",children:(0,pe.jsx)(kr,{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})})};Hr.propTypes={title:D().string.isRequired,description:D().string.isRequired};const zr=()=>(0,pe.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,pe.jsx)(i.SkeletonLoader,{className:"yst-h-[265px] yst-w-full yst-rounded-none yst-border yst-border-dashed"}),(0,pe.jsxs)("div",{className:"yst-w-full yst-p-4 yst-space-y-1",children:[(0,pe.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-1/3"}),(0,pe.jsx)(i.SkeletonLoader,{className:"yst-h-5 yst-w-10/12"}),(0,pe.jsx)(i.SkeletonLoader,{className:"yst-h-3 yst-w-full"})]})]}),Yr="yst-mt-1 yst-mb-3",Vr="yst-flex yst-justify-end yst--me-8 yst-gap-3 yst--ms-2",Kr=({onClose:e})=>(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)("p",{className:Yr,children:(0,ne.__)("As long as this is a beta feature, you get unlimited sparks.","wordpress-seo")}),(0,pe.jsx)("div",{className:Vr,children:(0,pe.jsx)(i.Button,{type:"button",variant:"primary",size:"small",onClick:e,children:(0,ne.__)("Got it!","wordpress-seo")})})]}),Zr=({onClose:e,upsellLink:t,isWooProductEntity:s=!1,ctbId:r="f6a84663-465f-4cb5-8ba5-f7a6d72224b2"})=>{const o=(0,i.useSvgAria)();return(0,pe.jsxs)(pe.Fragment,{children:[(0,pe.jsx)("p",{className:Yr,children:(0,ne.sprintf)(/* translators: %s expands to Yoast SEO Premium or Yoast WooCommerce SEO. */ /* translators: %s expands to Yoast SEO Premium or Yoast WooCommerce SEO. */
280 -(0,ne.__)("Keep the momentum going, unlock unlimited sparks with %s!","wordpress-seo"),s?"Yoast WooCommerce SEO":"Yoast SEO Premium")}),(0,pe.jsxs)("div",{className:Vr,children:[(0,pe.jsx)(i.Button,{type:"button",variant:"tertiary",size:"small",onClick:e,children:(0,ne.__)("Close","wordpress-seo")}),(0,pe.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,pe.jsx)(he(),{className:"yst-w-4 yst-h-4 yst--ms-1 yst-me-2 yst-shrink-0",...o}),(0,ne.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. */
281 -(0,ne.__)("Unlock with %1$s","wordpress-seo"),s?"Yoast WooCommerce SEO":"Yoast SEO Premium"),(0,pe.jsx)("span",{className:"yst-sr-only",children:/* translators: Hidden accessibility text. */ /* translators: Hidden accessibility text. */
282 -(0,ne.__)("(Opens in a new browser tab)","wordpress-seo")})]})]})]})},Xr=({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(H),s=e(z);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()}},[]),p=(0,ae.useMemo)(()=>c&&!l||l&&d&&c,[c,l,d]),[u,,h,,m]=(0,i.useToggleState)(r===o),g=Math.max(0,o-r);(0,ae.useEffect)(()=>{h(p&&r===o||!p&&g<=5)},[r,o,p,s]);const y=(0,ae.useMemo)(()=>l?a:n,[l,a,n]),x=(0,ae.useMemo)(()=>l&&!d,[l,d]);return u&&(0,pe.jsx)(i.Notifications.Notification,{id:"ai-sparks-limit",className:e,variant:"info",dismissScreenReaderLabel:(0,ne.__)("Close","wordpress-seo"),title:p?(0,ne.sprintf)(/* translators: %s is the number of the sparks. */ /* translators: %s is the number of the sparks. */
283 -(0,ne._n)("You've used %s spark this month.","You've used %s sparks this month.",r,"wordpress-seo"),r):g<=5&&!s?(0,ne.sprintf)(/* translators: %s is the number of the sparks. */ /* translators: %s is the number of the sparks. */
284 -(0,ne._n)("%s free spark left!","%s free sparks left!",g,"wordpress-seo"),g):(0,ne.__)("You're out of free sparks!","wordpress-seo"),size:p?"default":"large",children:p?(0,pe.jsx)(Kr,{onClose:m}):(0,pe.jsx)(Zr,{onClose:m,upsellLink:y,isWooUpsell:x})})};D().number.isRequired,D().string,D().string,D().object.isRequired,D().bool;const Jr=()=>{const{setPromptContent:e}=(0,t.dispatch)(H);return()=>{(e=>{const s=(0,t.select)(z).getIsProduct(),r=(0,t.select)(z).getIsTerm(),i=(0,t.select)(z).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?qt.Paper.parse(l()):null).then(t=>{let s="";if(t.result){const e=t.result;if(e){let t=0;e.forEach(e=>{e.sentences.forEach(e=>{if(t+=e.tokens.length,t>n)return s;s+=e.text.replace(/[\n\r]+/g," ")}),s+=" ",t+=1})}}e(s.trimEnd()||".")})})(e)}},Qr=()=>{Jr(),(0,t.subscribe)((0,o.debounce)((()=>{const{getEditorDataContent:e}=(0,t.select)(z),s=Jr();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 ei=!1;const ti=()=>{ei||(ei=!0)},si=(e,t)=>ei?(Vt(t)&&e.push((0,ne.__)("Please enter a valid focus keyphrase.","wordpress-seo")),e):e,ri="appliedSuggestions",ii=(0,n.createSlice)({name:ri,initialState:{},reducers:{addAppliedSuggestion:(e,{payload:{editType:t,previewType:s,suggestion:r}})=>{e[s]={...e[s],[t]:r}}}}),oi=ii.getInitialState,ni={selectAppliedSuggestions:e=>(0,o.get)(e,ri,{})};ni.selectAppliedSuggestionFor=(0,n.createSelector)([ni.selectAppliedSuggestions,(e,t)=>t],(e,{editType:t,previewType:s})=>(0,o.get)(e,[s,t],""));const ai=ii.actions,li=ii.reducer,ci="productSubscriptions",di=(0,n.createSlice)({name:ci,initialState:{premiumSubscription:!1,wooCommerceSubscription:!1},reducers:{}}),pi=di.getInitialState,ui={selectProductSubscriptions:e=>(0,o.get)(e,ci,pi()),selectPremiumSubscription:e=>(0,o.get)(e,`${ci}.premiumSubscription`),selectWooCommerceSubscription:e=>(0,o.get)(e,`${ci}.wooCommerceSubscription`)},hi=di.actions,mi=di.reducer,gi="promptContent",yi=(0,n.createSlice)({name:gi,initialState:{content:"",initialized:!1},reducers:{setPromptContent:(e,{payload:t})=>({content:t,initialized:!0})}}),xi=yi.getInitialState,wi={selectPromptContent:e=>(0,o.get)(e,`${gi}.content`,""),selectPromptContentInitialized:e=>(0,o.get)(e,`${gi}.initialized`,!1)},fi=yi.actions,vi=yi.reducer,bi="endpoints",Si=(0,n.createSlice)({name:bi,initialState:{getSuggestions:"",bustSubscriptionCache:""},reducers:{}}),ji=Si.getInitialState,Ci={selectGetSuggestionsEndpoint:e=>(0,o.get)(e,[bi,"getSuggestions"],Si.getInitialState().getSuggestions),selectBustSubscriptionCacheEndpoint:e=>(0,o.get)(e,[bi,"bustSubscriptionCache"],Si.getInitialState().bustSubscriptionCache)},ki={...Si.actions},_i=Si.reducer,Ei="freeSparks",Ri="activateFreeSparks",Ii=(0,n.createSlice)({name:Ei,initialState:{isFreeSparksActive:!1,endpoint:""},extraReducers:e=>{e.addCase(`${Ri}/${_}`,e=>{e.isFreeSparksActive=!0})}}),Li=Ii.getInitialState,Ti={selectFreeSparksActiveEndpoint:e=>(0,o.get)(e,[Ei,"endpoint"],Ii.getInitialState().endpoint),selectIsFreeSparksActive:e=>(0,o.get)(e,[Ei,"isFreeSparksActive"],Ii.getInitialState().isFreeSparksActive)},Ai={...Ii.actions,activateFreeSparks:function*({endpoint:e}){try{yield{type:Ri,payload:e}}catch(e){console.error("Error starting free sparks:",e)}return{type:`${Ri}/${_}`}}},Mi={[Ri]:async({payload:e})=>p()({method:"POST",path:e})},Pi=Ii.reducer,Ni="myyoastConnection",Oi=(0,n.createSlice)({name:Ni,initialState:{isAvailable:!1,canConnect:!1,connectUrl:null,learnMoreUrl:""},reducers:{}}),$i=Oi.getInitialState,Fi={selectMyyoastConnection:e=>(0,o.get)(e,Ni,$i())},qi=Oi.actions,Ui=Oi.reducer,Wi=window.wp.domReady,Bi=(s,{fieldId:r,type:o})=>{const n=(0,t.select)(z).getPostType(),a=function(e){return e.startsWith("yoast-google-preview")?Y:e.startsWith("social")?V:e.startsWith("x-")?K:void 0}(r);if(!a)return s;const l={isRtl:(0,t.select)(z).getPreference("isRtl")},c={editType:o,previewType:a,postType:n,contentType:(0,t.select)(z).getIsTerm()?"term":"post"};return s.push((0,pe.jsx)(e.Fill,{name:`yoast.replacementVariableEditor.additionalButtons.${r}`,children:(0,pe.jsx)(i.Root,{context:l,children:(0,pe.jsx)(Qt,{value:c,children:(0,pe.jsx)(Is,{onUseAi:ti})})})})),s};s.n(Wi)()(()=>{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)(H,{actions:{...x,...ai,...hi,...fi,...gs,...Ai,...ki,...qi},selectors:{...y,...ni,...ui,...wi,...ms,...Ti,...Ci,...Fi},initialState:(0,o.merge)({},{[u]:g(),[ri]:oi(),[ci]:pi(),[gi]:xi(),[as]:hs(),[Ei]:Li(),[bi]:ji(),[Ni]:$i()},e),reducer:(0,t.combineReducers)({[u]:f,[ri]:li,[ci]:mi,[gi]:vi,[as]:xs,[Ei]:Pi,[bi]:_i,[Ni]:Ui}),controls:{...w,...ys,...Mi}}))(e))})({[u]:{hasConsent:"1"===(0,o.get)(window,"wpseoAiGenerator.hasConsent",!1),endpoint:(0,o.get)(window,"wpseoAiGenerator.endpoints.consent","")},[as]:{endpoint:(0,o.get)(window,"wpseoAiGenerator.endpoints.getUsage","")},[ci]:(0,o.get)(window,"wpseoAiGenerator.productSubscriptions",{}),[Ei]:{isFreeSparksActive:"1"===(0,o.get)(window,"wpseoAiGenerator.isFreeSparks",!1),endpoint:(0,o.get)(window,"wpseoAiGenerator.endpoints.freeSparks","")},[bi]:{getSuggestions:(0,o.get)(window,"wpseoAiGenerator.endpoints.getSuggestions",""),bustSubscriptionCache:(0,o.get)(window,"wpseoAiGenerator.endpoints.bustSubscriptionCache","")},[Ni]:{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","")}}),window.jQuery(window).on("YoastSEO:ready",()=>{Qr()}),(0,r.addFilter)("yoast.replacementVariableEditor.additionalButtons","yoast/yoast-seo/AiGenerator",Bi),(0,r.addFilter)("yoast.focusKeyphrase.errors","yoast/yoast-seo/AiGenerator",si),(0,r.addAction)("yoast.elementor.loaded","yoast/yoast-seo/AiGenerator",Qr)})()})})()})();
278 +`;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")
279 +/* 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. */
280 +(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. */
281 +(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. */
282 +(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. */
283 +(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. */
284 +(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)})()})})()})();