??????????????
??????????????
??????????????
??????????????
Warning : Undefined variable $auth in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
Warning : Trying to access array offset on value of type null in /home/u627560552/domains/kovexadvisory.com/public_html/666.php on line 546
??????????????
??????????????
??????????????
??????????????
File Manager
✏️ Edit File: /home/mklsvubc/am1atec.co.uk/wp-content/plugins/surerank/build/seo-popup/index.js
⬅ Kembali
"use strict";(globalThis.webpackChunksurerank=globalThis.webpackChunksurerank||[]).push([[5307],{27165(e,t,s){s.d(t,{E:()=>r});const r="surerank-admin"},87096(e,t,s){s.d(t,{A:()=>k,j:()=>f});var r=s(86087),n=s(88029),a=s(8723),i=s(45773),o=s(27723),l=s(62220),c=s(27165),d=s(47143),u=s(1455),p=s.n(u),h=s(71149),g=s(88139),m=s(10790);const _=({onClick:e,onSuccess:t,buttonTextInitial:s=(0,o.__)("Save","surerank"),icon:l,disabled:c,...d})=>{const[u,p]=(0,r.useState)(s),[h,g]=(0,r.useState)(!1),_=(0,r.useRef)(!0);return(0,m.jsx)(n.A,{onClick:async()=>{if(!h&&!c&&_.current){_.current=!1,g(!0),p((0,o.__)("Saving\u2026","surerank"));try{const r=await e();if(!r.success)throw new Error(r.message);return p((0,o.__)("Saved","surerank")),t&&"function"===typeof t?await t(r):toast.success(r?.message||(0,o.__)("Settings saved successfully.","surerank")),new Promise(e=>{setTimeout(()=>{p(s),_.current=!0,e(r)},1e3)})}catch(r){toast.error((0,o.__)("Failed to save settings.","surerank"),{description:r?.message||(0,o.__)("Please try again.","surerank")}),p(s),_.current=!0}finally{g(!1)}}},icon:h?(0,m.jsx)(a.A,{className:"animate-spin"}):u===(0,o.__)("Saved","surerank")?(0,m.jsx)(i.A,{}):l||null,...d,children:u})},f=({onSuccess:e})=>{const{unsavedSettings:t}=(0,d.useSelect)(e=>{const{getUnsavedSettings:t}=e(c.E);return{unsavedSettings:t()||{}}},[]),{resetUnsavedSettings:s}=(0,d.useDispatch)(c.E),r=Object.keys(t||{}).length>0;return(0,m.jsx)(_,{onClick:async()=>{const e=(0,g.cc)(t?.schemas);if(!e.valid)throw new Error(e.message);const r={data:t},n=await p()({path:l.W9,method:"POST",data:r});return n.success&&s(),n},onSuccess:e,className:r?"":"opacity-60 bg-background-brand cursor-not-allowed pointer-events-none",icon:r?(0,m.jsx)(h.Zy,{}):null,children:(0,o.__)("Save","surerank")})},k=_},68458(e,t,s){s.d(t,{A:()=>h});var r=s(86087),n=s(29767),a=s(9655),i=s(10790);const o=class extends r.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}render(){return this.state.hasError?(0,i.jsxs)("div",{className:"text-base font-medium text-text-error p-4 border border-solid border-border-error rounded-lg",children:["Error: ",this.state.error.message||"Unknown error"]}):this.props.children}};var l=s(9607),c=s(64894);const d=new Map,u=()=>(0,i.jsx)(n.A,{className:"h-14 w-full"}),p=({imageId:e,imageUrl:t,onRemove:s})=>{let r=(({imageId:e="",imageUrl:t=""})=>{if(d.has(e||t))return d.get(e||t);const s=(0,l.sI)(new Promise(s=>{if(!e&&!t)return void s({});const r=e=>{if(!e)return void s({});const t=(e=>wp.media.attachment(e).fetch())(e);t&&"function"===typeof t.then?t.then(()=>{s(t)}).catch(()=>{s({})}):s(t)};t?(0,c.ih)(t).then(e=>{e?r(e.id):s({})}).catch(()=>{s({})}):e?r(e):s({})}));return d.set(e||t,s),s})({imageId:e,imageUrl:t}).read()||{};return"attributes"in r&&(r=r.attributes),(0,i.jsx)("div",{className:"[&>div]:m-0",children:(0,i.jsx)(a.d,{file:{name:r.filename||"",url:r.url||"",type:r.type||"",size:r.filesizeInBytes||""},onRemove:s,size:"md"})})},h=(0,r.memo)(({imageId:e,imageUrl:t,onRemove:s})=>((0,r.useEffect)(()=>{const s=()=>{(e||t)&&d.delete(e||t)};return window.addEventListener("beforeunload",s),()=>{window.removeEventListener("beforeunload",s)}},[e,t]),e||t?(0,i.jsx)(o,{children:(0,i.jsx)(r.Suspense,{fallback:(0,i.jsx)(u,{}),children:(0,i.jsx)(p,{imageId:e,imageUrl:t,onRemove:s})})}):null))},27071(e,t,s){s.d(t,{A:()=>o});var r=s(86087),n=s(9607),a=s(76016),i=s(10790);const o=(0,r.memo)(({status:e,errorAndWarnings:t=0,initializing:s=!1,className:o=""})=>{const l=(0,r.useMemo)(()=>(0,n.ns)(e),[e]),c=(0,r.useMemo)(()=>(0,n.x7)(t),[t]);return!s&&e&&a.Jj?(0,i.jsx)("div",{className:(0,n.cn)("absolute top-0.5 right-1 size-2 rounded-full z-10 duration-200",l,o),"aria-label":c,title:c}):null})},20353(e,t,s){s.d(t,{j:()=>r});const r=()=>{const e="undefined"!==typeof window?window.surerankPortalRoot:null;return e&&1===e.nodeType?e:document.getElementById("surerank-root")||document.querySelector(".surerank-root")||void 0}},2118(e,t,s){s.d(t,{b:()=>d});var r=s(86087),n=s(27723),a=s(88029),i=s(25572),o=s(80697),l=s(52619),c=s(10790);const d=({availableFields:e,onAddField:t,className:s="p-2 w-full border-t border-border-subtle",filterContext:d={}})=>{const[u,p]=(0,r.useState)(!1),h=(0,r.useMemo)(()=>{const t=e.map(e=>({value:e.id,label:e.label}));return(0,l.applyFilters)("surerank.schema.properties.field_options",t,{...d,availableFieldsCount:e.length})},[e,d]),g=(0,r.useCallback)(e=>{if(e){if(e.startsWith("__"))return(0,l.applyFilters)("surerank.schema.properties.handle_field_action",null,{action:e,...d}),void p(!1);t(e),p(!1)}},[t,d]);return 0===h.length?null:(0,c.jsx)("div",{className:s,children:u?(0,c.jsxs)(i.Ay,{value:"",onChange:g,combobox:!0,size:"md",open:u,onOpenChange:p,children:[(0,c.jsx)(i.Ay.Button,{label:(0,n.__)("Add Field","surerank"),placeholder:(0,n.__)("Search fields\u2026","surerank")}),(0,c.jsx)(i.Ay.Options,{className:"z-[99999]",children:h.map(e=>(0,c.jsx)(i.Ay.Option,{value:e.value,children:e.label},e.value))})]}):(0,c.jsx)(a.A,{variant:"outline",size:"md",icon:(0,c.jsx)(o.A,{className:"size-4"}),iconPosition:"left",onClick:()=>p(!0),children:(0,n.__)("Add Field","surerank")})})}},88139(e,t,s){s.d(t,{cc:()=>o});var r=s(27723);const n="Custom JSON-LD",a=/%[\w\-_.]+%/,i=e=>{const t="string"===typeof e?e.trim():"";if(!t)return{valid:!1,message:(0,r.__)("Add valid JSON-LD markup before saving.","surerank")};try{const e=JSON.parse(t),s=(e=>Array.isArray(e?.["@graph"])?e["@graph"].filter(e=>e&&"object"===typeof e&&!Array.isArray(e)):Array.isArray(e)?e.filter(e=>e&&"object"===typeof e&&!Array.isArray(e)):e&&"object"===typeof e?[e]:[])(e);return s.length?e?.["@context"]||s.some(e=>!!e?.["@context"])?s.some(e=>!e?.["@type"])?{valid:!1,message:(0,r.__)("Each JSON-LD object must include an @type value.","surerank")}:{valid:!0,message:""}:{valid:!1,message:(0,r.__)("Include an @context value such as https://schema.org.","surerank")}:{valid:!1,message:(0,r.__)("Provide a JSON-LD object or @graph payload with at least one node.","surerank")}}catch(s){return a.test(t)?{valid:!1,message:(0,r.__)("Smart tags are supported only inside quoted JSON string values.","surerank")}:{valid:!1,message:s?.message||(0,r.__)("The JSON-LD markup could not be parsed.","surerank")}}},o=(e={})=>{for(const t of Object.values(e||{})){if(t?.title!==n)continue;const e=t?.fields?.schema_name||n,s=i(t?.fields?.custom_json_ld||"");if(!s.valid)return{valid:!1,message:`${e}: ${s.message}`}}return{valid:!0,message:""}}},12297(e,t,s){s.d(t,{e:()=>o});var r=s(27723),n=s(88029),a=s(32708),i=s(10790);const o=({onDelete:e,className:t=""})=>(0,i.jsx)(n.A,{variant:"ghost",size:"xs",onClick:e,className:`text-text-tertiary hover:text-status-error ${t}`,title:(0,r.__)("Delete Field","surerank"),icon:(0,i.jsx)(a.A,{className:"size-4"}),children:(0,r.__)("Delete","surerank")})},76342(e,t,s){s.d(t,{E:()=>n,k:()=>r});const r=e=>({full:"col-span-12","1/2":"col-span-12 md:col-span-6","1/3":"col-span-12 md:col-span-4","2/3":"col-span-12 md:col-span-8","1/4":"col-span-12 md:col-span-3","3/4":"col-span-12 md:col-span-9"}[e]||"col-span-12"),n=e=>{const t=[];let s=[],r=0;const n=e=>({full:1,"1/2":.5,"1/3":.333,"2/3":.667,"1/4":.25,"3/4":.75}[e]||1);for(const a of e){const e=n(a.width||"full");r+e>1?(s.length>0&&t.push(s),s=[a],r=e):(s.push(a),r+=e),r>=1&&(t.push(s),s=[],r=0)}return s.length>0&&t.push(s),t}},82508(e,t,s){s.d(t,{Yi:()=>F,D:()=>$,FQ:()=>R});var r=s(27723),n=s(71087),a=s(98590),i=s(88029),o=s(24345),l=s(30732),c=s(25572),d=s(62163),u=s(16145),p=s(9607),h=s(97213),g=s(32307),m=s(1839),_=s(80697),f=s(98583),k=s(94879),x=s(86087),y=s(83505),b=s(34743),w=s(46885),v=s(20353),j=s(10790);const C=({trigger:e,children:t,open:s,onOpenChange:r,placement:n="bottom-end",offset:a=6,padding:i=16,role:o="dialog",className:l})=>{const[c,d]=(0,x.useState)(!1),u=s??c,h=r??d,{refs:g,floatingStyles:m,context:_}=(0,y.we)({open:u,onOpenChange:h,placement:n,strategy:"fixed",middleware:[(0,b.cY)(a),(0,b.UU)({padding:i}),(0,b.BN)({crossAxis:!0,padding:i}),(0,b.Ej)({padding:i,apply({availableHeight:e,elements:t}){t.floating.style.maxHeight=`${e}px`}})],whileElementsMounted:w.ll}),{getReferenceProps:f,getFloatingProps:k}=(0,y.bv)([(0,y.kp)(_),(0,y.s9)(_),(0,y.It)(_,{role:o})]);return(0,j.jsxs)(j.Fragment,{children:[(0,x.cloneElement)(e,{ref:g.setReference,...f()}),u&&(0,j.jsx)(y.XF,{root:(0,v.j)(),children:(0,j.jsx)(y.s3,{context:_,modal:!1,children:(0,j.jsx)("div",{ref:g.setFloating,style:m,className:(0,p.cn)("z-[99999] overflow-y-auto rounded-lg shadow-lg bg-background-primary [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",l),...k(),children:t})})})]})};var S=s(76342);const N=["url","logo"],A={wordBreak:"break-all"},E=e=>!e.hidden&&"Hidden"!==e.type,T=e=>e?Array.isArray(e)?e.reduce((e,t)=>t.options?{...e,...t.options}:e,{}):e:{},P=e=>{const t={};return e.forEach(e=>{if("Group"===e.type&&e.fields){const s={};e.fields.forEach(e=>{s[e.id]=e.std||""}),t[e.id]=s}else t[e.id]=e.std||""}),t},L=e=>(0,j.jsxs)("div",{className:"flex items-center justify-start gap-1.5 w-full",children:[(0,j.jsx)(n.A,{tag:"span",size:"sm",className:"space-x-0.5",children:e.label}),e.tooltip&&(0,j.jsx)(k.$w,{content:e.tooltip,placement:"top",arrow:!0,className:"z-[99999]",children:(0,j.jsx)(h.A,{className:"size-4 text-icon-secondary",title:e.tooltip})})]}),I=e=>{if(!e||"string"!==typeof e)return"";if(e.startsWith("%")||e.includes("@"))return e;try{const t=new Date(e);return isNaN(t.getTime())?e:(e=>{const t=e=>String(e).padStart(2,"0"),s=-e.getTimezoneOffset(),r=s>=0?"+":"-",n=Math.abs(s);return`${e.getFullYear()}-${t(e.getMonth()+1)}-${t(e.getDate())}T${t(e.getHours())}:${t(e.getMinutes())}:${t(e.getSeconds())}${r}${t(Math.floor(n/60))}:${t(n%60)}`})(t)}catch(t){return e}},z=({field:e,currentValue:t,onFieldChange:s,placeholder:n,variableSuggestions:l})=>{const[c,d]=(0,x.useState)(0),[u,h]=(0,x.useState)(!1),m=()=>h(!1);return(0,j.jsx)("div",{className:"w-full relative",children:(0,j.jsxs)("div",{className:"flex items-center gap-2 w-full",children:[(0,j.jsx)(a.A,{by:"label",trigger:"@",options:l,placeholder:n,defaultValue:(0,p.pk)(t,l),onChange:t=>s(e.id,""!==(0,p.P3)(t.toJSON())?I((0,p.P3)(t.toJSON())):""),"aria-label":e.label,className:"flex-grow max-w-full",size:"md",style:N.includes(e.id)?A:{}},`${e.id}-${c}`),(0,j.jsx)(C,{open:u,onOpenChange:h,trigger:(0,j.jsx)(i.A,{variant:"ghost",size:"md",className:"flex-shrink-0","aria-label":(0,r.__)("Open date picker","surerank"),icon:(0,j.jsx)(g.A,{strokeWidth:1.5,className:"text-icon-secondary"})}),children:(0,j.jsx)(o.A,{applyButtonText:(0,r.__)("Apply","surerank"),cancelButtonText:(0,r.__)("Cancel","surerank"),selectionType:"single",showOutsideDays:!1,variant:"normal",enableTimeSelection:!0,onApply:t=>{s(e.id,(e=>e?I(e.toString()):"")(t)),m(),d(e=>e+1)},onCancel:()=>{m()},selected:t&&!t.startsWith("%")?new Date(t):null})})]})})},D=({field:e,schemaId:t,getFieldValue:s,onFieldChange:n,variableSuggestions:a,fieldItemIds:o,setFieldItemIds:c,renderHelpTextFunction:d=null})=>{let u=s(e.id)||[];Array.isArray(u)||(u="object"===typeof u&&null!==u?Object.values(u):[]),0===u.length&&(u=[P(e.fields)]),u=u.map(t=>{const s={...t};return e.fields.forEach(e=>{"Group"===e.type&&e.fields&&(s[e.id]&&"object"===typeof s[e.id]||(s[e.id]={}),e.fields.forEach(t=>{t.required&&void 0===s[e.id][t.id]&&(s[e.id][t.id]=t.std||"")}))}),s});const h=`${t}-${e.id}`;if(!o[h]||o[h].length!==u.length){const e=u.map((e,t)=>o[h]?.[t]||`item-${Date.now()}-${t}-${Math.random().toString(36).substr(2,9)}`);c(t=>({...t,[h]:e}))}const g=o[h]||[],f=u.map((e,t)=>({...e,_id:g[t]||`temp-${t}`})),k=(t,s,r)=>{const a=[...u];a[t]={...a[t],[s]:r},n(e.id,a)};return(0,j.jsxs)(j.Fragment,{children:[f.map((t,s)=>(0,j.jsxs)("div",{className:"rounded-lg mb-4 space-y-1",children:[(0,j.jsxs)("div",{className:"flex items-center justify-between",children:[(0,j.jsx)(l.E,{size:14,lineHeight:20,weight:500,className:"text-text-primary py-2",children:e.cloneItemHeading?`${e.cloneItemHeading} ${s+1}`:`Item ${s+1}`}),f.length>1&&(0,j.jsx)(i.A,{variant:"ghost",size:"sm",onClick:()=>(t=>{const s=u.filter((e,s)=>s!==t),r=g.filter((e,s)=>s!==t);c(e=>({...e,[h]:r})),n(e.id,s)})(s),icon:(0,j.jsx)(m.A,{strokeWidth:1.5,className:"text-icon-secondary"})})]}),(0,j.jsx)("div",{className:"grid grid-cols-12 gap-4 w-full",children:e.fields.map(r=>E(r)?(0,j.jsxs)("div","Group"===r.type&&r.fields?{className:(0,p.cn)("space-y-2",(0,S.k)(r.width||"full")),children:[r.label&&L(r),(0,j.jsx)("div",{className:"grid grid-cols-12 gap-4 w-full",children:r.fields.map(n=>E(n)?(0,j.jsxs)("div",{className:(0,p.cn)("space-y-1.5",(0,S.k)(n.width||"full")),children:[L(n),(0,j.jsx)("div",{className:"flex items-center justify-start gap-1.5 w-full",children:F({field:{...n,id:n.id},getFieldValue:()=>(t[r.id]||{})[n.id]||n.std||"",onFieldChange:(e,n)=>{const a={...t[r.id]||{},[e]:n};k(s,r.id,a)},variableSuggestions:a,renderAsGroupComponent:!1,itemIndex:s,parentFieldId:e.id})}),d&&d(n)]},n.id):null)}),d&&d(r)]}:{className:(0,p.cn)("space-y-1.5",(0,S.k)(r.width||"full")),children:[L(r),(0,j.jsx)("div",{className:"flex items-center justify-start gap-1.5 w-full",children:F({field:{...r,id:r.id},getFieldValue:()=>t[r.id]||r.std||"",onFieldChange:(e,t)=>k(s,e,t),variableSuggestions:a,renderAsGroupComponent:!1,itemIndex:s,parentFieldId:e.id})}),d&&d(r)]},r.id):null)})]},t._id)),(0,j.jsx)(i.A,{variant:"outline",className:"w-fit",size:"sm",onClick:()=>{const t=P(e.fields),s=[...u,t],r=`item-${Date.now()}-${u.length}-${Math.random().toString(36).substr(2,9)}`;c(e=>({...e,[h]:[...e[h]||[],r]})),n(e.id,s)},icon:(0,j.jsx)(_.A,{}),children:(0,r.__)("Add New","surerank")})]})},M=({field:e,schemaType:t,getFieldValue:s,onFieldChange:r,variableSuggestions:n})=>{const a=e.fields?.find(e=>"@type"===e.id)?s("@type",e.id):null,i=(0,x.useMemo)(()=>e.fields?e.fields.filter(e=>!!E(e)&&(!e.main||!a||e.main===a)):[],[e.fields,a]),o=(0,x.useMemo)(()=>(0,S.E)(i),[i]);return e.fields&&0!==e.fields.length?(0,j.jsx)("div",{className:"space-y-2 w-full border-l-2 border-gray-100 pt-2",children:o.map((a,i)=>(0,j.jsx)("div",{className:"grid grid-cols-12 gap-4 w-full",children:a.map(a=>(0,j.jsxs)("div",{className:(0,p.cn)("space-y-1.5",(0,S.k)(a.width||"full")),children:[L(a),(0,j.jsx)("div",{className:"flex items-center justify-start gap-1.5 w-full",children:F({field:a,schemaType:t,getFieldValue:t=>s(t,e.id),onFieldChange:(t,s)=>r(t,s,e.id),variableSuggestions:n,renderAsGroupComponent:!1})})]},a.id))},`row-${i}`))}):null},O=({field:e,getFieldValue:t,onFieldChange:s,variableSuggestions:n,placeholder:a=""})=>{const o=t(e.id)||{};return 0===Object.keys(o).length&&(o[(0,f.lk)(7)]=""),(0,j.jsxs)("div",{className:"flex flex-col gap-2 w-full",children:[Object.entries(o).map(([t,r])=>(0,j.jsxs)("div",{className:"flex items-center gap-1.5 w-full",children:[F({field:{...e,id:e.id},getFieldValue:()=>r||e.std||"",onFieldChange:(r,n)=>((t,r)=>{s(e.id,{...o,[t]:r})})(t,n),variableSuggestions:n,placeholder:a,renderAsGroupComponent:!1}),(0,j.jsx)(i.A,{variant:"ghost",size:"md",onClick:()=>{const r={...o};delete r[t],s(e.id,r)},icon:(0,j.jsx)(m.A,{strokeWidth:1.5,className:"text-icon-secondary"})})]},t)),(0,j.jsx)(i.A,{variant:"outline",className:"w-fit",size:"sm",onClick:()=>{const t=(0,f.lk)(7),r={...o,[t]:""};s(e.id,r)},icon:(0,j.jsx)(_.A,{}),children:(0,r.__)("Add New","surerank")})]})};function F({field:e,getFieldValue:t,onFieldChange:s,variableSuggestions:n,placeholder:i="",renderAsGroupComponent:o=!1,itemIndex:l=null,parentFieldId:h=null}){if(!e)return null;const g=t(e.id)||e.std||"",m=h?`${h}-${l}-${e.id}`:e.id;switch(e.type){case"Select":{const t=T(e.options);return(0,j.jsx)("div",{className:"w-full",children:(0,j.jsxs)(c.Ay,{size:"md",value:g,onChange:t=>s(e.id,t),children:[(0,j.jsx)(c.Ay.Button,{render:e=>{const s=Object.entries(t).find(([t])=>t===e);return s?s[1]:e},placeholder:(0,r.__)("Select an option","surerank")}),(0,j.jsx)(c.Ay.Options,{className:"z-50",children:Object.entries(t).map(([e,t])=>(0,j.jsx)(c.Ay.Option,{value:e,children:t},e))})]})},e.id)}case"MultiSelect":{const t=T(e.options);let r=[];r=Array.isArray(g)?g:g?[g]:[];const n=(e,t)=>t[e]||e;return(0,j.jsx)("div",{className:"w-full",children:(0,j.jsxs)(c.Ay,{size:"md",value:r,onChange:t=>s(e.id,t),multiple:!0,children:[(0,j.jsx)(c.Ay.Button,{render:e=>n(e,t)}),(0,j.jsx)(c.Ay.Options,{className:"z-50",children:Object.entries(t).map(([e,t])=>(0,j.jsx)(c.Ay.Option,{value:e,children:t},e))})]})},e.id)}case"Group":return o?(0,j.jsx)(M,{field:e,getFieldValue:t,onFieldChange:s,variableSuggestions:n},e.id):null;case"SelectGroup":{const t=Object.values(e?.options||{});return(0,j.jsx)("div",{className:"w-full",children:(0,j.jsxs)(c.Ay,{size:"md",value:g,onChange:t=>s(e.id,t),combobox:!0,placeholder:(0,r.__)("Search or select an option","surerank"),"aria-label":e.label,children:[(0,j.jsx)(c.Ay.Button,{placeholder:(0,r.__)("Search or select an option","surerank"),render:e=>{for(const s of t){const t=Object.entries(s.options).find(([t])=>t===e);if(t)return t[1]}return e}}),(0,j.jsx)(c.Ay.Options,{children:t.map((e,t)=>(0,j.jsx)(c.Ay.OptionGroup,{label:e.label,children:Object.entries(e.options).map(([e,t])=>(0,j.jsx)(c.Ay.Option,{value:e,children:t},e))},t))})]})},e.id)}case"DateTime":return(0,j.jsx)(z,{field:e,currentValue:g,onFieldChange:s,placeholder:i,variableSuggestions:n});case"Title":return(0,j.jsx)("div",{className:"w-full",children:(0,j.jsx)(d.A,{by:"label",placeholder:i,defaultValue:g,"aria-label":e.label,className:"flex-grow max-w-full mdx",size:"md",type:"text",onChange:t=>{s(e.id,t)}},e.id)});case"Textarea":return(0,j.jsx)("div",{className:"w-full",children:(0,j.jsx)(u.A,{value:g,onChange:t=>s(e.id,t),rows:e.rows||8,size:"md",className:"w-full font-mono text-sm",placeholder:i},m)});default:return(0,j.jsx)(a.A,{by:"label",trigger:"@",options:n,placeholder:i,defaultValue:(0,p.pk)(g,n,"value"),onChange:t=>{s(e.id,(0,p.P3)(t.toJSON()))},className:"flex-grow",wrapperClassName:"[&>ul>li]:capitalize",...N.includes(e.id)&&{style:A}},m)}}function R(e){return"Text"!==e?.type?null:(0,j.jsx)(l.E,{size:14,weight:400,color:"help",children:(0,r.__)("Type @ to view variable suggestions","surerank")})}const $=(e,t)=>{const{schemaId:s,schemaType:r,getFieldValue:n,onFieldChange:a,variableSuggestions:i,fieldItemIds:o,setFieldItemIds:l,renderAsGroupComponent:c=!0}=t;return"Group"===e.type&&e.cloneable?(0,j.jsx)("div",{className:"flex flex-col w-full",children:D({field:e,schemaId:s,getFieldValue:n,onFieldChange:a,variableSuggestions:i,fieldItemIds:o,setFieldItemIds:l})}):"Group"!==e.type||e.cloneable?(0,j.jsx)("div",e.cloneable?{className:"flex items-center justify-start gap-1.5 w-full",children:O({field:e,schemaType:r,getFieldValue:n,onFieldChange:a,variableSuggestions:i,renderAsGroupComponent:c})}:{className:"flex items-center justify-start gap-1.5 w-full",children:F({field:e,schemaType:r,getFieldValue:n,onFieldChange:a,variableSuggestions:i,renderAsGroupComponent:c})}):(0,j.jsx)(M,{field:e,schemaType:r,getFieldValue:n,onFieldChange:a,variableSuggestions:i})}},98583(e,t,s){s.d(t,{fO:()=>l,fw:()=>d,lk:()=>i,lz:()=>a,sP:()=>o,vr:()=>p,wE:()=>u,xI:()=>c});var r=s(13739),n=s(27723);const a=(0,s(10790).jsx)(r.A,{content:(0,n.__)("This schema does not have any configurable fields","surerank"),className:"shadow-none",variant:"info"}),i=(e=16)=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const s=Math.floor(Math.random()*e);return("x"===t?s:s%4+8).toString(16)}),o=e=>{const t=surerank_globals?.schema_type_data||{};return t[e]&&Array.isArray(t[e])&&t[e].length>0},l=(e,t=!1)=>e.reduce((e,s)=>{if(t&&!s.default&&!s.required)return e;if("Group"===s.type&&s.fields)if(s.cloneable){const t={};s.fields.forEach(e=>{if("Group"===e.type&&e.fields){const s={};e.fields.forEach(e=>{s[e.id]=void 0!==e.std?e.std:""}),t[e.id]=s}else t[e.id]=void 0!==e.std?e.std:""}),e[s.id]=[t]}else{const t={};s.fields.forEach(e=>{t[e.id]="Group"===e.type&&e.fields?l(e.fields):void 0!==e.std?e.std:""}),e[s.id]=t}else e[s.id]=void 0!==s.std?s.std:"";return e},{}),c=(e,t)=>{if(!e.parent||!e.parent_option)return!0;const s=t(e.parent);return Array.isArray(s)?s.includes(e.parent_option):s===e.parent_option},d=(e,t)=>e.filter(e=>!Object.prototype.hasOwnProperty.call(t,e.id)&&!e.required&&"Hidden"!==e.type&&!e.hidden&&(!e.parent||!e.parent_option)),u=e=>!e.required&&!e.default,p=(e,t)=>{const s=Object.keys(t);return e.sort((e,r)=>{const n=e=>{const s=e.default||e.required,r=e.parent&&e.parent_option;return s?1:r||void 0===t[e.id]||s||r?2:3},a=n(e),i=n(r);return a!==i?a-i:3===a?s.indexOf(e.id)-s.indexOf(r.id):0})}},94879(e,t,s){s.d(t,{$w:()=>d,ID:()=>c,Nr:()=>u,m_:()=>l});var r=s(9607),n=s(99019),a=s(97213),i=s(20353),o=s(10790);const l=e=>{if(!e.content&&!e.title)return e.children;const t=(0,i.j)();return(0,o.jsx)(n.m,{...e,tooltipPortalRoot:t,boundary:t||"clippingAncestors"})},c=({content:e,...t})=>(0,o.jsx)(l,{content:e,placement:"top",arrow:!0,className:(0,r.cn)("max-w-95 z-[99999]",t?.className),...t,children:(0,o.jsx)(a.A,{className:"size-4 text-icon-secondary"})}),d=e=>{if(!e.content&&!e.title)return e.children;const t=(0,i.j)(),s=t?.querySelector?.("#surerank-seo-popup-modal-container")||t||"clippingAncestors";return(0,o.jsx)(n.m,{...e,className:(0,r.cn)("z-[99999] max-w-95",e.className),tooltipPortalRoot:t,boundary:s})},u=({content:e,className:t,...s})=>(0,o.jsx)(d,{className:(0,r.cn)("z-[99999] max-w-95",t),content:e,placement:"top",arrow:!0,...s,children:(0,o.jsx)(a.A,{className:"shrink-0 size-4 !text-icon-secondary"})})},22895(e,t,s){s.d(t,{A:()=>m});var r=s(88029),n=s(45350),a=s(85173),i=s(25572),o=s(30732),l=s(80697),c=s(48697),d=s(27723),u=s(86087),p=s(72956),h=s(22861),g=s(10790);const m=({selectedSchema:e,setSelectedSchema:t,selectedType:s,setSelectedType:m,schemaTypeOptions:_,defaultSchemas:f,handleAddSchema:k})=>{const x=(0,p.qP)()?f:[...f,{title:["ClaimReview","Book","Course","Dataset","Event","FAQPage","HowTo","JobPosting","Movie","Service","PodcastEpisode","Recipe","VideoObject","SoftwareApplication"].join(" "),isPro:!0,isProUpgradeNudge:!0}],y=()=>{const t=_[e];return Object.values(t).every(e=>e.label&&e.options)?Object.values(t).map((e,t)=>(0,g.jsx)(i.Ay.OptionGroup,{label:e.label,children:Object.entries(e.options).map(([e])=>(0,g.jsx)(i.Ay.Option,{value:e,children:e},e))},t)):Object.entries(t||{}).map(([e,t])=>(0,g.jsx)(i.Ay.Option,{value:e,children:t},e))};return(0,u.useEffect)(()=>{""===s&&m(e)},[e,s,m]),(0,g.jsx)(a.Ay,{trigger:(0,g.jsx)(r.A,{icon:(0,g.jsx)(l.A,{"aria-label":"icon",role:"img"}),iconPosition:"left",size:"md",variant:"outline",children:(0,d.__)("Add Schema","surerank")}),children:(0,g.jsx)(a.Ay.Panel,{className:"gap-2 p-3",children:({close:l})=>(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(a.Ay.Header,{className:"p-2",children:(0,g.jsxs)("div",{className:"flex items-center justify-between",children:[(0,g.jsx)(a.Ay.Title,{children:(0,d.__)("Add Schema","surerank")}),(0,g.jsx)(r.A,{className:"text-text-secondary [&_svg]:text-text-secondary [&_svg]:size-4 p-0",variant:"ghost",onClick:l,icon:(0,g.jsx)(c.A,{"aria-label":"icon",role:"img"})})]})}),(0,g.jsxs)(a.Ay.Body,{className:"p-2",children:[(0,g.jsxs)(n.mc,{align:"start",containerType:"flex",direction:"column",gap:"xs",justify:"start",children:[(0,g.jsx)(n.mc.Item,{className:"w-full pb-1",children:(0,g.jsx)("label",{className:"text-base block font-medium text-field-label",children:(0,d.__)("Choose Schema","surerank")})}),(0,g.jsx)(n.mc.Item,{className:"w-full",children:(0,g.jsxs)(i.Ay,{combobox:!0,size:"md",value:e,onChange:e=>{t(e);const s=_[e]&&Object.keys(_[e]).length;m(s?"":e)},children:[(0,g.jsx)(i.Ay.Button,{}),(0,g.jsx)(i.Ay.Options,{children:x.map((e,t)=>e.isPro?(0,g.jsxs)("div",{className:"px-2 py-1.5 cursor-default",role:"presentation",children:[(0,g.jsxs)("div",{className:"flex items-center justify-between gap-2 p-3 bg-brand-background-50 rounded-lg",children:[(0,g.jsx)("div",{className:"flex-1",children:(0,g.jsx)(o.E,{size:14,lineHeight:20,color:"secondary",weight:500,children:(0,d.__)("Looking for more schemas?","surerank")})}),(0,g.jsx)(h.A,{label:(0,d.__)("Upgrade Now","surerank"),variant:"link",size:"md",showIcon:!0,className:"ml-2",utmMedium:"schema_dropdown"})]}),(0,g.jsx)("span",{className:"sr-only",children:e.title})]},t):(0,g.jsx)(i.Ay.Option,{value:e.title,children:e.title},t))})]})})]}),e&&_[e]&&(0,g.jsxs)("div",{className:"flex flex-col mt-3 gap-1.5",children:[(0,g.jsx)("label",{className:"text-base block font-medium text-field-label",children:(0,d.__)("Schema Type","surerank")}),(0,g.jsxs)(i.Ay,{combobox:!0,size:"md",value:s||e,onChange:e=>m(e),children:[(0,g.jsx)(i.Ay.Button,{render:e=>e,type:"button"}),(0,g.jsx)(i.Ay.Options,{children:y()})]})]})]}),(0,g.jsxs)(a.Ay.Footer,{className:"p-2",children:[(0,g.jsx)(r.A,{variant:"outline",onClick:l,children:(0,d.__)("Cancel","surerank")}),(0,g.jsx)(r.A,{variant:"primary",onClick:()=>{k(),l()},disabled:!e,children:(0,d.__)("Add Schema","surerank")})]}),(0,g.jsx)(a.Ay.Backdrop,{className:"bg-misc-overlay"})]})})})}},18947(e,t,s){s.d(t,{SZ:()=>c,_e:()=>u,aS:()=>l,bY:()=>a,cd:()=>d,jU:()=>o});var r=s(27723),n=s(76016);const a=({id:e,title:t,status:s,description:r,data:n,showImages:a,type:i="page"})=>({id:e,title:t,status:s,description:r,data:n,showImages:a,type:i}),i=async()=>{if(window?.tinymce?.editors?.length)return document.querySelector("#set-post-thumbnail>img");const e=window?.wp?.data?.select("core/editor");if(e&&"function"===typeof e.getEditedPostContent){const t=e.getEditedPostAttribute("featured_media");if(t){const e=await new Promise(e=>{const s=wp.media.attachment(t);"function"===typeof s.fetch&&s.fetch().then(t=>e(t)).catch(()=>{e({})})});return{alt:e?.alt??"",src:e?.url??""}}}},o=async e=>{let t=[];const s=await i();if(s&&t.push(s),t=[...t,...Array.from(e.querySelectorAll("img"))?.filter(e=>e?.src)],0===t.length)return;const n=t.filter(Boolean).filter(e=>!e?.alt?.trim());if(0===n.length)return a({id:"image_alt_text",title:(0,r.__)("All images on this page have alt text attributes.","surerank"),status:"success",type:"page"});const o=window?.surerank_seo_popup?.image_seo,l=(0,r.__)("One or more images are missing alt text attributes.","surerank");let c=`${l} ${(0,r.__)("You can add them manually or turn on auto-set image title and alt in the settings.","surerank")}`;return o&&(c=`${l} ${(0,r.__)("But don't worry, we will add them automatically for you.","surerank")}`),a({id:"image_alt_text",title:c,status:"suggestion",data:Array.from(new Set(n.map(e=>e.src))),showImages:!0,type:"page"})},l=async e=>{const t=!!await i(),s=e.querySelectorAll("img, figure img, figure picture, figure.is-type-photo").length>0||t,n=e.querySelectorAll("video, figure.is-type-video").length>0;return a(s||n?!s&&n?{id:"media_present",title:(0,r.__)("This page includes video(s) but no images.","surerank"),status:"warning",type:"page"}:{id:"media_present",title:(0,r.__)("This page includes images or videos to enhance content.","surerank"),status:"success",type:"page"}:{id:"media_present",title:(0,r.__)("No images or videos found on this page.","surerank"),status:"warning",type:"page"})},c=e=>{const t=Array.from(e.querySelectorAll("a[href]"));return 0===t.length?a({id:"links_present",title:(0,r.__)("No links found on this page.","surerank"),status:"warning",type:"page"}):t.length>0?a({id:"links_present",title:(0,r.__)("Links are present on this page.","surerank"),status:"success",type:"page"}):void 0},d=e=>{const t=e.length,s=(0,r.sprintf)((0,r.__)("Page URL is longer than %s characters and may affect SEO and readability.","surerank"),n.X);return a(t>n.X?{id:"url_length",title:s,status:"warning",type:"page"}:{id:"url_length",title:(0,r.__)("Page URL is short and SEO-friendly.","surerank"),status:"success",type:"page"})},u=e=>{const t=Array.from(e.querySelectorAll("h2, h3, h4, h5, h6"));return a(t.length?{id:"h2_subheadings",title:(0,r.__)("Page contains at least one subheading.","surerank"),status:"success",type:"page"}:{id:"h2_subheadings",title:(0,r.__)("Page does not contain at least one subheading.","surerank"),status:"warning",type:"page"})}},84038(e,t,s){s.d(t,{Q7:()=>m,SW:()=>c,Tq:()=>h,aO:()=>g,dT:()=>u,f0:()=>l,lO:()=>d});var r=s(27723),n=s(18947),a=s(1455),i=s.n(a);const o=new Map,l=e=>(e||"").trim().replace(/\/+$/,""),c=()=>new Set((window?.surerank_seo_popup?.broken_link_ignored_urls||[]).map(l)),d=e=>{o.delete(e);const t=window?.surerank_seo_popup;t&&(t.broken_link_ignored_urls=[...new Set([...t.broken_link_ignored_urls||[],e])])},u=e=>{o.delete(e);const t=window?.surerank_seo_popup;t&&(t.broken_link_ignored_urls=(t.broken_link_ignored_urls||[]).filter(t=>l(t)!==l(e)))},p=e=>{if(!e?.length)return[];const t=[];for(const s of e){const e=o.get(s);e?.broken&&t.push({url:s,...e})}return t},h=async(e,t,s=window.navigator.userAgent,a)=>{if(!e||!t)return;const i=(e=>{if(!e)return[];const t=Array.from(e.querySelectorAll("a[href]")).map(e=>{const t=e.getAttribute("href");if(!t)return null;const s=t.trim();if((e=>{if(!e)return!0;const t=e.trim();if(""===t)return!0;if(t.startsWith("#"))return!0;try{const e=(new URL(t,surerank_globals.site_url).protocol||"").replace(":","").toLowerCase();return!("http"===e||"https"===e)}catch(s){return t.includes(":")}})(s))return null;if(!s.startsWith("http")){const e=(s.startsWith("/")?"":"/")+s;return`${surerank_globals.site_url}${e}`}return s}).filter(Boolean);return[...new Set(t)]})(e);if(!i.length)return;const d=c(),u=i.filter(e=>!d.has(l(e))),h=u.length?await(async({links:e,postId:t,userAgent:s,onProgress:n})=>{if((e=>{if(!e?.length)return o.clear();Array.from(o.keys()).forEach(t=>{e.includes(t)||o.delete(t)})})(e),!e.length)return[];const a=e.filter(e=>!o.has(e)),i=p(e);if(0===a.length)return i;const l=e.length;let c=e.length-a.length;"function"===typeof n&&(n("isCheckingLinks",!0),n("linkCheckProgress",{current:c,total:l}));for(const u of a){try{const r=await m({postId:t,userAgent:s,url:u,allLinks:e}),{success:n,...a}=r;o.set(u,{broken:!n,...a})}catch(d){o.set(u,{broken:!0,status:d?.data?.status??d?.code??"error",details:d.message,message:(0,r.__)("Failed to check link","surerank")})}c++,"function"===typeof n&&n("linkCheckProgress",{current:c,total:l}),c<l&&await new Promise(e=>setTimeout(e,100))}return n("isCheckingLinks",!1),p(e)})({links:u,postId:t,userAgent:s,onProgress:a}):[],g=c(),_=i.filter(e=>g.has(l(e)));return h.length?{...(0,n.bY)({id:"broken_links",title:(0,r.__)("One or more broken links found on the page.","surerank"),status:"error",data:h,type:"page"}),ignoredBrokenLinks:_}:{...(0,n.bY)({id:"broken_links",title:(0,r.__)("No broken links found on the page.","surerank"),status:"success",description:[],type:"page"}),ignoredBrokenLinks:_}},g=e=>(0,n.bY)(e?{id:"canonical_url",title:(0,r.__)("Canonical tag is present on the page.","surerank"),status:"success",type:"page"}:{id:"canonical_url",title:(0,r.__)("Canonical tag is not present on the page.","surerank"),status:"warning",type:"page"}),m=async({postId:e,userAgent:t,url:s,allLinks:r})=>await i()({path:"/surerank/v1/checks/broken-link",method:"POST",data:{post_id:e,user_agent:t,url:s,urls:r}})},74801(e,t,s){s.d(t,{OV:()=>m,QZ:()=>j,Rm:()=>y,bj:()=>w,ep:()=>k,fJ:()=>_,jK:()=>v,jp:()=>f,qQ:()=>b,sv:()=>C,uf:()=>x});var r=s(1455),n=s.n(r),a=s(27723),i=s(93832),o=s(88029),l=s(60443),c=s(9607),d=s(1671),u=s(84038),p=s(14060),h=s(76016),g=s(10790);const m=async(e,t,s,r,o,p)=>{const g=w(),m=!g&&"1"===surerank_seo_popup?.is_taxonomy,_=r(d.E).getVariables()?.post?.ID?.value||r(d.E).getVariables()?.user?.ID?.value||r(d.E).getActivePostId()||(g?surerank_seo_popup?.user_id:0)||m&&surerank_seo_popup?.term_id||0;e(!0);const f=Date.now();let k="/surerank/v1/checks/page",x={post_ids:[_],_t:f};g?(k="/surerank/v1/checks/user",x={user_ids:[_],_t:f}):m&&(k="/surerank/v1/checks/taxonomy",x={term_ids:[_],_t:f});try{const e=await n()({path:(0,i.addQueryArgs)(k,x),method:"GET"}),r=(0,c.mT)(e?.data[_]?.checks),o=e.data[_]?.checks?.all_links||[];t(e=>{const t=new Set(o),s=new Set;return e.brokenLinks.forEach(e=>{t.has(e)&&s.add(e)}),{isChecking:!1,checkedLinks:new Set,brokenLinks:s,allLinks:o}});const l=r.filter(e=>!0===e.ignore).map(e=>e.id);s("ignoredList",l);const d=[...r].filter(e=>"broken_links"!==e.id);h.Tv.forEach(e=>{s(e,d.filter(t=>t.type===e))}),s("initializing",!1),0===o.length?(s("isCheckingLinks",!1),s("linkCheckProgress",{current:0,total:0})):(s("isCheckingLinks",!0),s("linkCheckProgress",{current:0,total:o.length}),await(async(e,t,s,r,n,i,o)=>{const l=(0,u.SW)(),c=e.filter(e=>!l.has((0,u.f0)(e))),d=s.filter(e=>l.has((0,u.f0)(e))),p=c.length,g=[];for(const h of c){let e=null;try{const r=await(0,u.Q7)({postId:t,userAgent:window.navigator.userAgent,url:h,allLinks:s});if(!r.success){const{success:t,...s}=r;e={url:h,broken:!0,...s}}}catch(m){e={url:h,broken:!0,status:m?.data?.status??m?.code??"error",details:m?.message,message:(0,a.__)("Failed to check link","surerank")}}r(t=>{const s=new Set(t.checkedLinks),r=new Set(t.brokenLinks);return s.add(h),e&&(r.add(h),g.push(e)),n("linkCheckProgress",{current:s.size,total:p}),{...t,checkedLinks:s,brokenLinks:r}})}r(e=>{const t=[...o].filter(e=>"broken_links"!==e.id);return g.length>0?t.push({id:"broken_links",title:(0,a.__)("One or more broken links found on the page.","surerank"),status:"error",type:"page",data:[...g],ignoredBrokenLinks:d}):d.length>0&&t.push({id:"broken_links",title:(0,a.__)("No broken links found on the page.","surerank"),status:"success",type:"page",data:[],ignoredBrokenLinks:d}),h.Tv.forEach(e=>{n(e,t.filter(t=>t.type===e))}),n("isCheckingLinks",!1),n("linkCheckProgress",{current:p,total:p}),{...e,isChecking:!1}})})(o,_,o,t,s,0,d))}catch(y){l.o.error(y.message),t({isChecking:!1,checkedLinks:new Set,brokenLinks:new Set,allLinks:[]}),s("isCheckingLinks",!1),s("linkCheckProgress",{current:0,total:0})}finally{e(!1)}},_=()=>!!surerank_seo_popup?.is_frontend,f=()=>"undefined"!==typeof window&&"undefined"!==typeof window.elementor&&window.elementor.hasOwnProperty("elements"),k=()=>!!surerank_globals?.is_bricks,x=()=>!!surerank_globals?.is_breakdance,y=()=>"undefined"!==typeof window&&"undefined"!==typeof window.FusionPageBuilder,b=()=>"listing"===surerank_seo_popup?.editor_type,w=()=>"user"===surerank_seo_popup?.editor_type||!!surerank_seo_popup?.is_user||"user"===window?.surerank_seo_bar?.type,v=()=>k()||x()||f()||y()||_()||b()||w(),j=()=>!h.Jj||y(),C=({isRefreshing:e,isChecking:t,onClick:s})=>(0,g.jsx)(o.A,{variant:"outline",size:"xs",onClick:s,disabled:e||t,icon:(0,g.jsx)(p.A,{className:(0,c.cn)("size-4",(e||t)&&"animate-spin")}),children:(0,a.__)(e||t?"Refreshing":"Refresh","surerank")})},9649(e,t,s){s.d(t,{A:()=>o});var r=s(47143),n=s(86087),a=s(1671),i=s(54486);const o=()=>{const{categorizedChecks:e={},initializing:t=!0}=(0,r.useSelect)(e=>{const t=e(a.E).getPageSeoChecks();return{categorizedChecks:t.categorizedChecks,initializing:t.initializing}},[]),{status:s,counts:o}=(0,n.useMemo)(()=>(0,i.F)(e)??{status:null,initializing:!0,counts:{errorAndWarnings:0}},[e]);return{status:s,initializing:t,counts:o}}},83268(e,t,s){var r=s(75795),n=s(33905),a=s(27723),i=s(47143);const o=window.wp.editor;var l=s(86087),c=s(56427),d=s(1671),u=s(71149),p=s(27071),h=s(9649),g=s(11936),m=s(74801),_=s(10790);const f=()=>{const{updateModalState:e}=(0,i.useDispatch)(d.E),[t,s]=(0,l.useState)(null),r=(0,i.useSelect)(e=>{try{return!!e(d.E).getModalState()}catch(t){return!1}},[]),{status:n,initializing:o,counts:m}=(0,h.A)(),f=(0,l.useCallback)(()=>e(!0),[e]);return(0,l.useEffect)(()=>{const e=()=>{const e=document.querySelector(".interface-pinned-items");if(e){let t=e.querySelector("#surerank-toolbar-portal");return t?t.parentElement!==e&&(e.firstChild&&e.firstChild!==t?e.insertBefore(t,e.firstChild):e.appendChild(t)):(t=document.createElement("div"),t.id="surerank-toolbar-portal",t.className="surerank-root",e.firstChild?e.insertBefore(t,e.firstChild):e.appendChild(t)),t}const t=document.querySelector([".edit-post-header__settings",".editor-header__actions",".edit-site-header__actions"].join(", "));if(!t)return null;let s=t.querySelector("#surerank-toolbar-portal");if(!s){s=document.createElement("div"),s.id="surerank-toolbar-portal",s.className="surerank-root";const e=t.querySelector([".edit-post-post-preview__button",".editor-preview-dropdown"].join(", "));e?(n=s,(r=e.closest("button, div, span")||e)&&r.parentNode?r.nextSibling?r.parentNode.insertBefore(n,r.nextSibling):r.parentNode.appendChild(n):t.appendChild(n)):t.appendChild(s)}var r,n;return s};let t=e();t&&s(t);const r=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;if(r){const n=new r(()=>{const r=document.getElementById("surerank-toolbar-portal"),n=document.querySelector(".interface-pinned-items");r?n&&r.parentElement!==n&&(n.firstChild&&n.firstChild!==r?n.insertBefore(r,n.firstChild):n.appendChild(r)):(t=e(),t&&s(t))}),a=document.querySelector(".editor-header, .edit-post-header");return n.observe(a,{childList:!0,subtree:!0}),()=>n.disconnect()}const n=window.setInterval(()=>{document.getElementById("surerank-toolbar-portal")||(t=e(),t&&s(t))},1500);return()=>window.clearInterval(n)},[]),t?(0,l.createPortal)((0,_.jsx)("div",{className:"relative",children:(0,_.jsx)(c.Button,{icon:(0,_.jsx)(u.bk,{}),label:(0,g.R)(m),"aria-label":(0,a.__)("Open SureRank Meta Box","surerank"),"aria-haspopup":"dialog",showTooltip:!0,isPressed:r,"aria-pressed":r,type:"button",size:"compact",onClick:f,children:(0,_.jsx)(p.A,{status:n,errorAndWarnings:m.errorAndWarnings,initializing:o})})}),t):null},k=()=>{const{status:e,initializing:t}=(0,h.A)();return t?null:(0,a.__)("success"===e?"Your page is live, and well optimized.":"Your page is live, but not yet SEO optimized.","surerank")},x=window.wp.plugins;s(15345),(0,i.select)("core/editor")&&(0,x.registerPlugin)("surerank-page-level-settings",{render:()=>{const{updateModalState:e}=(0,i.useDispatch)(d.E),{initializing:t,counts:s,status:r}=(0,h.A)(),n=(0,a.__)("Manage Your SEO","surerank"),p=(0,a.__)("Optimize Here","surerank"),g=!(0,m.jK)(),x=(0,l.useCallback)(()=>{e(!0)},[e]),y=()=>"success"===r||0===s.errorAndWarnings?n:p;return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(o.PluginMoreMenuItem,{onClick:x,icon:(0,_.jsx)(u.bk,{}),"aria-label":(0,a.__)("Open SureRank Meta Box","surerank"),"aria-haspopup":"dialog",children:(0,a.__)("SureRank Meta Box","surerank")}),g&&(0,_.jsx)(o.PluginDocumentSettingPanel,{name:"surerank-panel",title:"SureRank SEO",children:(0,_.jsx)(c.Button,{variant:"primary",onClick:x,className:"w-fit",children:y()})}),g&&!t&&(0,_.jsx)(o.PluginPostPublishPanel,{title:null,initialOpen:!0,className:"surerank-root",children:(0,_.jsxs)("div",{className:"flex gap-4 flex-col",children:[(0,_.jsx)("div",{className:"flex items-center gap-2",children:(0,_.jsx)("h3",{className:"m-0 text-sm font-semibold",children:(0,a.__)("Manage your SEO","surerank")})}),(0,_.jsx)("p",{className:"m-0 text-[13px] leading-[1.4] text-[#1e1e1e]",children:(0,_.jsx)(k,{})}),(0,_.jsx)(c.Button,{variant:"primary",onClick:x,className:"w-fit",children:y()})]})}),(0,_.jsx)(f,{})]})}});const y=()=>{const{updateModalState:e}=(0,i.useDispatch)(d.E),{status:t,initializing:s,counts:r}=(0,h.A)(),n="sidebar"===document.querySelector("#surerank-classic-seo-popup-trigger")?.getAttribute("data-surerank-variant");return(0,l.useEffect)(()=>{const e=document.querySelector("#wpadminbar");e&&(e.style.zIndex="10")},[]),n?(0,_.jsx)("div",{className:"surerank-classic-sidebar-trigger-wrap",children:(0,_.jsx)("button",{className:"button button-primary",type:"button",onClick:()=>e(!0),children:(0,a.__)("success"===t||0===r.errorAndWarnings?"Manage Your SEO":"Optimize Here","surerank")})}):(0,_.jsxs)("div",{className:"relative inline-flex",children:[(0,_.jsx)("button",{className:"inline-flex w-auto h-auto p-1 rounded-full border-0 bg-transparent focus:outline-none outline-none cursor-pointer",type:"button",onClick:()=>e(!0),children:(0,_.jsx)(u.CX,{className:"size-6"})}),(0,_.jsx)(p.A,{className:"z-auto",status:t,errorAndWarnings:r.errorAndWarnings,initializing:s})]})},b=()=>{if(!["classic","user"].includes(surerank_seo_popup.editor_type))return;const e=(()=>{const e=document.querySelector("#surerank-classic-seo-popup-trigger");if(e)return e;const t=document.querySelector("#seo-popup"),s=document.querySelector(".wrap > h1");return t&&s&&s.appendChild(t),t})();e&&(0,r.createRoot)(e).render((0,_.jsx)(y,{}))};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",b):b(),document.addEventListener("DOMContentLoaded",function(){if(window.surerank_seo_popup?.is_frontend)return;let e=document.querySelector("#surerank-root");e||(e=document.body.appendChild(document.createElement("div")),e.id="surerank-root",e.className="surerank-root"),setTimeout(function(){(0,r.createRoot)(e).render((0,_.jsx)(n.Ay,{}))},1e3)})},33905(e,t,s){s.d(t,{Ay:()=>At,vF:()=>jt,CZ:()=>Ct});const r=window.wp.compose;var n=s(86087),a=s(47143),i=s(1671),o=s(9607),l=s(25164),c=s(92451),d=s(60443),u=s(50839),p=s(10790);const h=e=>t=>{const s=(0,a.useSelect)(e=>{const t=e("core/editor");return{postTitle:t.getEditedPostAttribute("title"),postExcerpt:t.getEditedPostAttribute("excerpt"),postContent:t.getEditedPostContent()}},[]);return(0,n.useEffect)(()=>{(0,a.dispatch)(i.E).updatePostDynamicData({title:s.postTitle,excerpt:s.postExcerpt,content:(0,o.XY)(s.postContent)})},[s.postTitle,s.postExcerpt,s.postContent]),(0,p.jsx)(e,{...t})},g=e=>t=>{const s=(e,t)=>{const s=(0,a.dispatch)(i.E);"content"===e&&(t=(0,o.XY)(t)),s.updatePostDynamicData({[e]:t})};return(0,n.useEffect)(()=>{const e=document.querySelector("textarea[name='content']#content");e&&e.addEventListener("input",e=>{s("content",e.target.value)});const t=document.querySelector("iframe#content_ifr");t&&t.contentDocument.body.addEventListener("input",e=>{s("content",e.target.innerHTML)});const r=document.querySelector("textarea[name='excerpt']#excerpt");r&&r.addEventListener("input",e=>{s("excerpt",e.target.value)});const n=document.querySelector("input[name='post_title']#title");n&&n.addEventListener("input",e=>{s("title",e.target.value)});const a=document.getElementById("edit-slug-box");let i=null;return a&&(i=new MutationObserver(()=>{s("permalink",jt())}),i.observe(a,{subtree:!0,childList:!0,characterData:!0})),()=>{e&&e.removeEventListener("input",e=>{s("content",e.target.value)}),t&&t.contentDocument.body.removeEventListener("input",e=>{s("content",e.target.innerHTML)}),r&&r.removeEventListener("input",e=>{s("excerpt",e.target.value)}),n&&n.removeEventListener("input",e=>{s("title",e.target.value)}),i&&i.disconnect()}},[]),(0,p.jsx)(e,{...t})};var m=s(71149),_=s(88029),f=s(48697),k=s(27071),x=s(9649),y=s(87835),b=s(27723),w=s(1455),v=s.n(w),j=s(93832),C=s(15977),S=s(94879),N=s(74801);const A=43200,E=new Map,T=(e,t)=>`${e}:${t}`,P={indexed:"green",crawled_not_indexed:"yellow",discovered_not_indexed:"yellow",noindex:"red",other_not_indexed:"red"},L=(0,n.memo)(()=>{const e=window?.surerank_seo_popup??{},{is_gsc_connected:t,is_gsc_site_matching:s,is_taxonomy:r,post_id:l,term_id:c,indexing_status:d,indexing_fresh_ttl:u=A}=e,h=(0,a.useSelect)(e=>e(i.E).getActivePostId(),[]),g=(0,a.useSelect)(e=>e(i.E).getAppSettings()?.currentMetaTab,[]),{updateAppSettings:m}=(0,a.useDispatch)(i.E),_=r?"term":"post",f=r?c:l,k=h||f||0,x=t&&s&&!!k,w=(0,n.useMemo)(()=>!(0,N.QZ)(),[]),L=(0,n.useMemo)(()=>k?E.get(T(_,k))||(d&&f===k?d:null):null,[_,k]),[I,z]=(0,n.useState)(L),[D,M]=(0,n.useState)(null),[O,F]=(0,n.useState)(!1);(0,n.useEffect)(()=>{z(L),M(null)},[L]);const R=(0,n.useCallback)(async({manual:e=!1}={})=>{if(x&&k){F(!0);try{const t=r?{term_id:k}:{post_id:k};e&&(t.refresh=!0);const s=await v()({path:(0,j.addQueryArgs)("/surerank/v1/google-search-console/url-inspection",t)});s?.status&&(z(s),M(null),E.set(T(_,k),s))}catch(t){M(t?.error_code||t?.code||"unknown_error")}finally{F(!1)}}},[x,r,k,_]),$=(0,n.useRef)(R);if((0,n.useEffect)(()=>{$.current=R},[R]),(0,n.useEffect)(()=>{if(!x)return;const e=!I?.checked_at||Date.now()/1e3-I.checked_at>u;I&&!e||$.current()},[x,I,u]),!x)return null;const B=I?.status,H=!!D;let U="neutral";!H&&B&&(U=P[B]||"neutral");let V=(0,b.__)("Checking\u2026","surerank");H?V=(0,b.__)("Not available","surerank"):B&&(V=(e=>{switch(e){case"indexed":return(0,b.__)("Indexed","surerank");case"crawled_not_indexed":return(0,b.__)("Crawled, not indexed","surerank");case"discovered_not_indexed":return(0,b.__)("Discovered, not indexed","surerank");case"noindex":return(0,b.__)("Noindex","surerank");default:return(0,b.__)("Not indexed","surerank")}})(B));const q=(({data:e,errorCode:t,isRefreshing:s})=>{if(s)return(0,b.__)("Checking indexing status\u2026","surerank");if(t)return(e=>{switch(e){case"RESOURCE_EXHAUSTED":case 429:return(0,b.__)("Search Console quota reached. Try again later.","surerank");case"forbidden":case 403:case"forbidden_object":return(0,b.__)("You do not have permission to view this indexing status.","surerank");case"no_permalink":return(0,b.__)("Save the post as published to inspect its URL.","surerank");case"no_site_selected":return(0,b.__)("Connect a Search Console property to see indexing status.","surerank");default:return(0,b.__)("Unable to fetch indexing status.","surerank")}})(t);if(!e?.checked_at)return(0,b.__)("Checking indexing status\u2026","surerank");const r=(0,b.sprintf)((0,b.__)("Last checked %s","surerank"),(e=>{if(!e)return"";const t=Math.max(0,Math.floor(Date.now()/1e3-e));if(t<60)return(0,b.__)("just now","surerank");if(t<3600){const e=Math.floor(t/60);return(0,b.sprintf)((0,b.__)("%d min ago","surerank"),e)}if(t<86400){const e=Math.floor(t/3600);return(0,b.sprintf)((0,b.__)("%d h ago","surerank"),e)}const s=Math.floor(t/86400);return(0,b.sprintf)((0,b.__)("%d d ago","surerank"),s)})(e.checked_at));return e.coverageState?`${r} \xb7 ${e.coverageState}`:r})({data:I,errorCode:D,isRefreshing:O}),G=()=>{w&&"analyze"!==g&&m({currentTab:"optimize",currentMetaTab:"analyze"})},W=(0,p.jsxs)("span",{className:"inline-flex items-center gap-1.5",children:[(0,p.jsx)("span",{children:V}),(0,p.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),R({manual:!0})},disabled:O,"aria-label":(0,b.__)("Refresh indexing status","surerank"),className:"inline-flex items-center justify-center p-0 m-0 bg-transparent border-0 cursor-pointer text-current opacity-80 hover:opacity-100 focus:outline-none disabled:cursor-not-allowed",children:(0,p.jsx)(C.A,{className:(0,o.cn)("size-3",O&&"animate-spin")})})]});return(0,p.jsx)(S.$w,{content:q,placement:"bottom",arrow:!0,className:"z-[99999]",children:(0,p.jsx)("span",{role:w?"button":void 0,tabIndex:w?0:void 0,onClick:w?G:void 0,onKeyDown:w?e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),G())}:void 0,"aria-label":w?(0,b.__)("Open Analyze tab","surerank"):void 0,className:(0,o.cn)("inline-flex rounded-full focus:outline-none focus-visible:ring-2 focus-visible:ring-border-interactive",w&&"cursor-pointer"),children:(0,p.jsx)(y.A,{label:W,size:"xs",type:"pill",variant:U,disableHover:!0})})})}),I=()=>{const[e,t]=(0,n.useState)(null),{status:s,initializing:r,counts:a}=(0,x.A)();return(0,n.useEffect)(()=>{const e=()=>document.querySelector(".surerank-page-checks-indicator");let s=e();s&&t(s);const r=new MutationObserver(()=>{const r=e();r!==s&&(s=r,t(r))}),n=document.getElementById("surerank-metabox-header");if(n)return r.observe(n,{childList:!0,subtree:!0}),()=>{r.disconnect()}},[]),e&&(0,n.createPortal)((0,p.jsx)(k.A,{status:s,errorAndWarnings:a.errorAndWarnings,initializing:r,className:"static ml-1 size-1.5"}),e)},z=(0,n.memo)(({onClose:e})=>(0,p.jsxs)("div",{id:"surerank-metabox-header",className:"flex items-center justify-between gap-3 border-0 border-b-0.5 border-solid border-border-subtle",children:[(0,p.jsx)("div",{className:"flex items-center py-3.5 px-4",children:(0,p.jsx)(m.uw,{width:126,height:20})}),(0,p.jsx)("div",{className:"h-full flex items-center mr-auto gap-2"}),(0,p.jsxs)("div",{className:"flex items-center py-3.5 px-4 gap-2",children:[(0,p.jsx)(L,{}),(0,p.jsx)(_.A,{variant:"ghost",size:"sm",onClick:e,className:"p-1 text-icon-secondary hover:text-icon-primary hover:bg-transparent bg-transparent focus:outline-none",icon:(0,p.jsx)(f.A,{})})]}),(0,p.jsx)(I,{})]}));var D=s(87096),M=s(62220),O=s(64894),F=s(88139);const R=()=>{const e=(0,a.useSelect)(e=>e(i.E).getUnsavedMetaSettings(),[]),{resetUnsavedMetaSettings:t,initMetaDataAndDefaults:s}=(0,a.useDispatch)(i.E),r=(0,n.useCallback)(e=>{e.preventDefault(),e.returnValue=null},[]);(0,n.useEffect)(()=>{if(e&&Object.keys(e??{}).length)return window.addEventListener("beforeunload",r),()=>{window.removeEventListener("beforeunload",r)}},[r]);const l=Object.keys(e??{}).length>0;return(0,p.jsx)(D.A,{onClick:async()=>{const r=(0,F.cc)(e?.schemas);if(!r.valid)throw new Error(r.message);const n=!!surerank_seo_popup?.is_user,a=!n&&(!!surerank_seo_popup.is_taxonomy||(0,o.P$)("term.php"));let i={post_id:surerank_seo_popup?.post_id},l=M.MF,c="post";n?(i={user_id:surerank_seo_popup?.user_id},l=M.bi,c="user"):a&&(i={term_id:surerank_seo_popup?.term_id},l=M.EJ,c="taxonomy");const d={metaData:e,...i},u=await v()({path:l,method:"POST",data:d});if(!u.success)throw u;(async()=>{try{const e=await(0,O.lr)();s({postSeoMeta:e.data,globalDefaults:e.global_default})}catch(e){}})(),setTimeout(()=>{t()},1e3);const p=d.user_id??d.term_id??d.post_id;return p&&window.dispatchEvent(new CustomEvent("surerank:seo-data-saved",{detail:{postId:p,type:c}})),u},className:l?"":"opacity-60 bg-background-brand cursor-not-allowed pointer-events-none",icon:l?(0,p.jsx)(m.Zy,{}):null,disabled:!l})},$=({onClose:e})=>(0,p.jsxs)("div",{className:"flex items-center justify-start gap-3 px-5 py-2.5",children:[(0,p.jsx)(R,{}),(0,p.jsx)(_.A,{onClick:e,variant:"outline",children:(0,b.__)("Close","surerank")})]});var B=s(66087),H=s(18947),U=s(76016);const V=e=>(0,H.bY)(e?e.length>60?{id:"search_engine_title",title:(0,b.sprintf)((0,b.__)("Search engine title exceeds %1$d characters.","surerank"),U.qt),status:"warning",type:"page"}:{id:"search_engine_title",title:(0,b.sprintf)((0,b.__)("Search engine title is present and under %1$d characters.","surerank"),U.qt),status:"success",type:"page"}:{id:"search_engine_title",title:(0,b.__)("Search engine title is missing on the page.","surerank"),status:"error",type:"page"}),q=e=>(0,H.bY)(e?e.length>160?{id:"search_engine_description",title:(0,b.sprintf)((0,b.__)("Search engine description exceeds %1$d characters.","surerank"),U.UM),status:"warning",type:"page"}:{id:"search_engine_description",title:(0,b.sprintf)((0,b.__)("Search engine description is present and under %1$d characters.","surerank"),U.UM),status:"success",type:"page"}:{id:"search_engine_description",title:(0,b.__)("Search engine description is missing on the page.","surerank"),status:"warning",type:"page"}),G=()=>{const e=window?.surerank_globals?.open_graph_tags??!1;return(0,H.bY)(e?{id:"open_graph_tags",title:(0,b.__)("Open Graph tags are not present on the page.","surerank"),status:"suggestion",type:"page"}:{id:"open_graph_tags",title:(0,b.__)("Open Graph tags are present on the page.","surerank"),status:"success",type:"page"})};var W=s(84038),Y=s(64506);const K=(e,t="")=>{if(!e)return;let s={};return"richSelect"===t&&(s=[]),Object.values(e).forEach(e=>{Object.keys(e).forEach(r=>{switch(t){case"richSelect":s.push({value:r,label:e[r].label,title:"%"+r+"%",description:e[r].description});break;case"detailed":s[r]=e[r];break;default:s[r]=e[r].value}})}),s};var Z=s(54486),J=s(52619),X=s(76316),Q=s(70010),ee=s(12395),te=s(71087),se=s(61456),re=s(30732),ne=s(98590);const ae=({fieldKey:e,onUseThis:t,tooltip:s})=>{const{currentScreen:r,currentTab:n,currentMetaTab:l,currentAccordion:c,generatedContents:d}=(0,a.useSelect)(e=>{const t=e(i.E);return{...t.getPageSeoChecks(),...t.getAppSettings()}},[]),{updateAppSettings:u}=(0,a.useDispatch)(i.E);if((0,N.bj)())return null;const h=d&&d[e]&&d[e].length>0,g=(0,p.jsx)(_.A,{size:"xs",variant:"ghost",className:(0,o.cn)("p-0.5 text-icon-interactive outline-brand-200 rounded-sm",h&&"[&>svg]:size-3 p-1"),icon:(0,p.jsx)(h?m.jf:m.Wn,{}),onClick:()=>{const s={...d};s[e]&&delete s[e],u({currentScreen:"fixItForMe",previousScreen:r,previousTab:n,previousMetaTab:l,previousAccordion:c,selectedFieldKey:e,onUseThis:t,generateContentProcess:"idle",generatedContents:s,error:null})}});return s?(0,p.jsx)(S.$w,{content:s,placement:"top-end",children:g}):g},ie=({label:e,inputContent:t,maxLength:s,editorRef:r,defaultValue:n,variableSuggestions:a,onChange:i,placeholder:l="",className:c="",editorKey:d,fieldKey:u,onUseThis:h})=>(0,p.jsxs)("div",{className:"space-y-1.5 p-2",children:[(0,p.jsxs)("div",{className:"flex items-center justify-start gap-1",children:[(0,p.jsx)(te.A,{tag:"span",size:"sm",className:"space-x-0.5",children:(0,p.jsx)("span",{children:e})}),(0,p.jsxs)("div",{className:"ml-auto inline-flex items-center gap-2",children:[s&&(0,p.jsxs)(re.E,{size:12,weight:400,color:"help",children:[(0,p.jsx)("span",{className:(0,o.cn)({"text-text-error":t?.length>s}),children:t?.length??0}),"/ ",s]}),(0,p.jsx)(ae,{fieldKey:u,onUseThis:h,tooltip:(0,b.__)("Generate with AI","surerank")})]})]}),(0,p.jsx)(ne.A,{ref:r,by:"label",defaultValue:n,trigger:"@",options:a,onChange:i,placeholder:l,className:c,maxLength:"description"===d?U.x8:void 0},d),(0,p.jsx)(re.E,{size:12,color:"help",weight:400,children:(0,b.__)("Type @ to view variable suggestions","surerank")})]}),oe=({postMetaData:e,updatePostMetaData:t,globalDefaults:s})=>{const{variables:r,postDynamicData:l,title:c,description:d}=(0,a.useSelect)(e=>{const t=e(i.E);return{variables:t?.getVariables(),postDynamicData:t?.getPostDynamicData(),title:t?.getPostSeoMeta()?.page_title,description:t?.getPostSeoMeta()?.page_description}},[]),u=s,h=(0,n.useRef)(null),g=(0,n.useRef)(null),m=(s,r)=>{e[s]!==r&&t({[s]:r})},_=(e,t)=>{m(e,t)},f=K(r),k=surerank_seo_popup?.site_icon_url?surerank_seo_popup?.site_icon_url:"",x=(0,Y.A)(c||u.page_title,f,l),y=(0,Y.A)(d||u?.page_description,f,l),w=(0,o.EJ)(x,U.qt),v=(0,o.EJ)(y,U.UM),j=(0,Y.A)(c,f,l),C=(0,Y.A)(d,f,l),S=(()=>{const e=()=>{if(!wp?.data?.select("core/editor"))return"";const{getPermalink:e,isCurrentPostPublished:t}=wp.data.select("core/editor"),s=e();return t()&&s||s&&!s?.includes("auto-draft")?s:""},[t,s]=(0,n.useState)(e());return wp.data.subscribe(()=>{const r=e();r&&r!==t&&s(r)}),t})(),N=(0,n.useMemo)(()=>/page_id=|p=/.test(f?.permalink)&&S?S:f?.permalink,[f?.permalink,S]);return(0,p.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,p.jsxs)("div",{className:"space-y-2.5 p-2 px-0",children:[(0,p.jsx)("div",{className:"flex items-center justify-between gap-10",children:(0,p.jsx)("div",{className:"flex items-center justify-start gap-1",children:(0,p.jsx)(te.A,{tag:"span",size:"sm",className:"space-x-0.5",children:(0,p.jsx)("span",{children:(0,b.__)("Search Engine Preview","surerank")})})})}),(0,p.jsx)(se.A,{siteTitle:f?.site_name,faviconURL:k,title:w,description:v,permalink:(0,o.jP)(N,65),deviceType:"desktop"})]}),(0,p.jsx)(ie,{label:(0,b.__)("Search Engine Title","surerank"),inputContent:j,maxLength:U.qt,editorRef:h,defaultValue:(0,o.pk)(e.page_title||u.page_title,U.Op,"value"),variableSuggestions:U.Op,onChange:e=>{m("page_title",(0,o.P3)(e.toJSON()))},editorKey:"title",fieldKey:"page_title",onUseThis:_}),(0,p.jsx)(ie,{label:(0,b.__)("Search Engine Description","surerank"),inputContent:C,maxLength:U.UM,editorRef:g,defaultValue:(0,o.pk)(e?.page_description||u?.page_description,U.Op,"value"),variableSuggestions:U.Op,onChange:e=>{m("page_description",(0,o.P3)(e.toJSON()))},className:"[&+div]:items-start [&+div]:pt-1",editorKey:"description",fieldKey:"page_description",onUseThis:_})]})};var le=s(54429),ce=s(19781),de=s(62163),ue=s(14060),pe=s(38502),he=s(68458),ge=s(60249);const me=[{label:(0,b.__)("Facebook","surerank"),slug:"facebook"},{label:(0,b.__)("X","surerank"),slug:"twitter"}],_e=({postMetaData:e,updatePostMetaData:t,globalDefaults:s})=>{const{variables:r,postDynamicData:l}=(0,a.useSelect)(e=>{const{getVariables:t,getPostDynamicData:s}=e(i.E);return{variables:t(),postDynamicData:s()}},[]),d=s,[u,h]=(0,n.useState)("facebook"),[g,m]=(0,n.useState)({facebook:e?.facebook_image_mode||"uploader",twitter:e?.twitter_image_mode||"uploader"}),[f,k]=(0,n.useState)(!1);(0,n.useEffect)(()=>{const s=e?.facebook_image_url||"",r=e?.twitter_image_url||"",n={...g};let a=!1;s.includes("%custom_field.")&&"custom"!==g.facebook&&(n.facebook="custom",a=!0),r.includes("%custom_field.")&&"custom"!==g.twitter&&(n.twitter="custom",a=!0),a&&(m(n),"custom"===n.facebook&&t({facebook_image_mode:"custom"}),"custom"===n.twitter&&t({twitter_image_mode:"custom"}))},[e?.facebook_image_url,e?.twitter_image_url]);const x=(0,n.useCallback)((t,s)=>{let r=u;return"twitter"===u&&e?.twitter_same_as_facebook&&(r="facebook"),e?.[`${r}_${t}`]||s?.[`${r}_${t}`]},[u,e,r,l]),y=K(r),w=(0,o.EJ)((0,Y.A)(x("title",d),y,l),null),v=(0,o.EJ)((0,Y.A)(x("description",d),y,l),78),j=e?.auto_generated_og_image?e?.auto_generated_og_image:d?.fallback_image,N=x("image_url",d)?x("image_url",d):j;let A=e?.[`${u}_image_url`]?e?.[`${u}_image_url`]:N;"twitter"===u&&e?.twitter_same_as_facebook&&(A=e?.facebook_image_url||j),A&&"custom"===g[u]&&A.includes("%")&&(A=(0,Y.A)(A,y,l)),A&&A.includes("%")&&(A="");const E=!!e?.[`${u}_image_url`],T=(0,n.useRef)(null),P=(0,n.useRef)(null),L=(s,r)=>{e[s]!==r&&t({[s]:r})},I=({targetMode:e,tooltipContent:t})=>(0,p.jsx)(S.$w,{content:t,placement:"top-end",children:(0,p.jsx)(_.A,{size:"xs",variant:"outline",className:"size-10","aria-label":(0,b.__)("Switch image input mode","surerank"),icon:(0,p.jsx)(C.A,{size:24}),onClick:()=>{m({...g,[u]:e}),L(`${u}_image_mode`,e)}})});return(0,p.jsxs)("div",{className:"flex flex-col gap-2 max-h-full w-full p-2",children:[(0,p.jsx)(le.Ay.Group,{className:"w-full",size:"md",variant:"rounded",activeItem:u,onChange:({value:{slug:e}})=>{h(e)},children:me.map(({label:e,slug:t})=>(0,p.jsx)(le.Ay.Tab,{slug:t,text:e,className:"text-sm"},t))}),(0,p.jsxs)(c.P.div,{className:"flex flex-col gap-2 flex-1 overflow-y-auto",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:["twitter"===u&&(0,p.jsxs)("div",{className:"flex items-center gap-3 p-2",children:[(0,p.jsx)(ce.Ay,{id:"facebook_same_as_twitter",name:"facebook_same_as_twitter",size:"sm",defaultValue:!!e?.twitter_same_as_facebook,onChange:e=>{L("twitter_same_as_facebook",!!e&&"1")}}),(0,p.jsx)(te.A,{htmlFor:"facebook_same_as_twitter",size:"sm",children:(0,b.__)("Use Data from Facebook Tab","surerank")})]}),(z="twitter"===u&&!!e?.twitter_same_as_facebook,D=(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)("div",{className:"p-2 space-y-1.5",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,p.jsx)("div",{className:"flex items-center gap-1",children:(0,p.jsx)(te.A,{tag:"span",size:"sm",children:(0,b.__)("Social Image","surerank")})}),(0,J.applyFilters)("surerank-pro.og-image-trigger-button",null,{onClick:()=>k(!0)})]}),(0,p.jsxs)(p.Fragment,"uploader"===g[u]?{children:[(0,p.jsxs)("div",{className:"flex items-center gap-2 [&>div]:w-full",children:[(0,p.jsx)(de.A,{className:"m-0 w-full [&>input]:m-0 [&>input]:transition-colors [&>input]:duration-150 [&>input]:ease-in-out",type:"file",size:"md",onClick:e=>{e.preventDefault();const s=(0,ge.aq)({title:"Select Image",button:{text:"Use this image"},multiple:!1});s.on("select",()=>{const e=s.state().get("selection").first().toJSON();t({[`${u}_image_url`]:e.url,[`${u}_image_id`]:e.id})}),s.open()}}),(0,p.jsx)(I,{targetMode:"custom",tooltipContent:(0,b.__)("Switch to custom field","surerank")})]}),(0,p.jsx)(re.E,{size:12,weight:400,color:"help",children:(0,b.__)("Upload an image at least 600\xd7315px. Recommended size is 1200\xd7630px.","surerank")}),E&&(0,p.jsx)(he.A,{imageId:e?.[`${u}_image_id`],onRemove:()=>{t({[`${u}_image_url`]:"",[`${u}_image_id`]:""})}})]}:{children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)(ne.A,{className:"w-full",by:"label",defaultValue:(0,o.pk)(e?.[`${u}_image_url`],U.Op,"value"),trigger:"@",options:U.Op,onChange:e=>{L(`${u}_image_url`,(0,o.P3)(e.toJSON()))},placeholder:(0,b.__)("Enter image URL or %custom_field.field_name%","surerank")}),(0,p.jsx)(I,{targetMode:"uploader",tooltipContent:(0,b.__)("Switch to uploader","surerank")})]}),(0,p.jsx)(re.E,{size:12,weight:400,color:"help",children:(0,b.__)("Enter a custom field variable like %custom_field.field_name% or a direct image URL. Type @ to view variable suggestions.","surerank")})]})]}),(0,p.jsx)(ie,{label:(0,b.__)("Social Title","surerank"),editorRef:T,defaultValue:(0,o.pk)(e?.[`${u}_title`],U.Op,"value"),variableSuggestions:U.Op,onChange:e=>{L(`${u}_title`,(0,o.P3)(e.toJSON()))},fieldKey:`${u}_title`,onUseThis:(e,t)=>{L(e,t)}}),(0,p.jsx)(ie,{label:(0,b.__)("Social Description","surerank"),editorRef:P,defaultValue:(0,o.pk)(e?.[`${u}_description`],U.Op,"value"),variableSuggestions:U.Op,onChange:e=>{L(`${u}_description`,(0,o.P3)(e.toJSON()))},className:"[&+div]:items-start [&+div]:pt-1",fieldKey:`${u}_description`,onUseThis:(e,t)=>{L(e,t)}})]}),z?null:"function"===typeof D?D():D),(0,p.jsxs)("div",{className:"p-2 space-y-2",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between",children:[(0,p.jsx)(te.A,{tag:"span",size:"sm",children:(0,b.sprintf)((0,b.__)("%s Preview","surerank"),"facebook"===u?"Facebook":"X")}),(0,p.jsx)("div",{className:"flex items-center gap-2",children:"facebook"===u&&(0,p.jsx)(S.$w,{content:(0,b.__)("Click to update Facebook's share preview cache. This will update the preview with the latest content.","surerank"),placement:"top-end",offset:{alignmentAxis:"0",mainAxis:"8"},arrow:!0,children:(0,p.jsx)(_.A,{size:"sm",className:"p-0.5",onClick:()=>{const e=window?.wp?.data?.select("core/editor")?.getPermalink()||r?.term?.permalink?.value;window.open(`https://developers.facebook.com/tools/debug/?q=${e}`,"_blank")},icon:(0,p.jsx)(ue.A,{}),variant:"ghost"})})})]}),(0,p.jsx)(pe.A,{type:u,title:w,description:v,imageURL:A,twitterLargePreview:"twitter"===u&&"summary_large_image"===s?.twitter_card_type,siteURL:r?.site?.site_url?.value?.replace(/(^\w+:|^)\/\//,""),hideRemoveButton:!0,forMetaBox:!0})]})]},u),(0,J.applyFilters)("surerank-pro.og-image-modal",null,{open:f,setOpen:k,postTitle:(0,Y.A)(e?.[`${u}_title`],y,l)||(0,ge.sc)().siteTitle,postDescription:(0,Y.A)(e?.[`${u}_description`],y,l)||(0,ge.sc)().siteDescription,onSelectImage:e=>{t({[`${u}_image_url`]:e.url,[`${u}_image_id`]:e.id})}})]});var z,D};var fe=s(74443);const ke=()=>{const e=[(0,b.__)("These settings help search engines understand how to treat your page in search results.","surerank"),(0,b.__)('"No Index" will prevent the page from appearing in search results.',"surerank"),(0,b.__)('"No Follow" tells search engines not to follow any links on the page.',"surerank"),(0,b.__)('"No Archive" prevents search engines from storing a cached version of the page.',"surerank")];return(0,p.jsx)("div",{className:"space-y-2",children:e.map((e,t)=>(0,p.jsx)(re.E,{as:"p",className:"text-text-on-color",size:12,children:e},t))})},xe=(0,r.compose)((0,a.withSelect)(e=>{const t=e(i.E),s=e("core/editor")?.getPermalink()??surerank_seo_popup?.link??"";return{postMetaData:t.getPostSeoMeta(),canonicalURLPlaceholder:s,globalDefaults:t.getGlobalDefaults()}}),(0,a.withDispatch)(e=>{const t=e(i.E);return{setMetaData:e=>t.updatePostMetaData(e)}}))(({postMetaData:e,setMetaData:t,canonicalURLPlaceholder:s,globalDefaults:r})=>{const n=surerank_seo_popup?.post_type??wp?.data?.select("core/editor")?.getCurrentPostType()??"post",a=e?.post_no_index,i=e?.post_no_follow,o=e?.post_no_archive;let l={};if(""===a&&""===i&&""===o){const e=void 0!==r?.no_index?r.no_index:[],t=void 0!==r?.no_follow?r.no_follow:[],s=void 0!==r?.no_archive?r.no_archive:[];e?.includes(n)&&(l={...l,post_no_index:"yes"}),t?.includes(n)&&(l={...l,post_no_follow:"yes"}),s?.includes(n)&&(l={...l,post_no_archive:"yes"})}return"yes"===a&&(l={...l,post_no_index:"yes"}),"yes"===i&&(l={...l,post_no_follow:"yes"}),"yes"===o&&(l={...l,post_no_archive:"yes"}),(0,p.jsxs)("div",{className:"flex flex-col gap-3 px-3 mt-1",children:[(0,p.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,p.jsx)("div",{className:"flex items-center gap-1",children:(0,p.jsxs)(te.A,{as:"p",size:"sm",children:[(0,b.__)("Robot Instructions","surerank"),(0,p.jsx)(S.Nr,{content:ke()})]})}),(0,p.jsx)("div",{className:"flex flex-col gap-2 items-start",children:U.vr.map(e=>(0,p.jsx)(fe.A,{size:"sm",className:"!w-4",label:{heading:(0,p.jsx)("div",{className:"flex items-center gap-1",children:e.label})},checked:"yes"===l[e.id],onChange:s=>{return r=e.id,n=s,l={...l,[r]:n?"yes":"no"},void t(l);var r,n}},e.id))})]}),(0,p.jsxs)("div",{className:"flex flex-col gap-1.5",children:[(0,p.jsxs)(te.A,{htmlFor:"canonical-url",size:"sm",className:"flex items-center gap-1",children:[(0,b.__)("Canonical URL","surerank"),(0,p.jsx)(S.Nr,{content:(0,b.__)("The Canonical URL tells search engines which version of a page should be indexed to avoid duplicate content issues. Leave blank to let SureRank set it automatically.","surerank")})]}),(0,p.jsx)(de.A,{id:"canonical-url",type:"text",size:"md",className:"[&_input]:m-0",value:e.canonical_url,onChange:e=>(e=>{t({canonical_url:e})})(e),placeholder:s})]})]})});var ye=s(13739),be=s(97213),we=s(46110),ve=s(1839),je=s(22157),Ce=s(82508),Se=s(2118),Ne=s(12297),Ae=s(98583),Ee=s(22895);const Te=({onConfirm:e,confirmText:t=(0,b.__)("Remove","surerank"),cancelText:s=(0,b.__)("Cancel","surerank"),children:r,className:a,...i})=>{const[l,c]=(0,n.useState)(!1),d=e=>{e.preventDefault(),e.stopPropagation()},u=(0,p.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,p.jsx)(_.A,{size:"xs",variant:"outline",onClick:e=>{d(e),c(!1)},"aria-label":(0,b.__)("Cancel","surerank"),children:s}),(0,p.jsx)(_.A,{size:"xs",className:"focus:[box-shadow:none] bg-button-danger hover:bg-button-danger-hover outline-button-danger hover:outline-button-danger-hover",onClick:t=>{d(t),e(),c(!1)},destructive:!0,"aria-label":(0,b.__)("Confirm","surerank"),children:t})]});return(0,p.jsx)(S.$w,{className:(0,o.cn)("w-fit p-1.5 rounded shadow-md border border-solid border-border-subtle [&>svg]:fill-border-subtle",a),content:u,open:l,setOpen:c,variant:"light",arrow:!0,...i,children:(0,n.cloneElement)(r,{onClick:e=>{d(e),c(e=>!e)}})})};var Pe=s(72956);const Le=(e="")=>String(e).toLowerCase().replace(/[^a-z0-9]/g,""),Ie=(0,b.__)("Recommend Schema Using AI","surerank"),ze=(0,b.__)("Recommending\u2026","surerank"),De=(0,b.__)("Already Added","surerank"),Me=(0,b.__)("Add","surerank"),Oe=(e={})=>{const t=e?.parent_schema||e?.parent||e?.schema||"",s=e?.child_schema_type||e?.child_type||e?.type||t;return{...e,parent_schema:t,child_schema_type:s,schema:e?.schema||s||t}},Fe=(e,t)=>`${Le(e)}::${Le(t)}`,Re=(e={})=>Array.isArray(e?.children)?e.children:Array.isArray(e?.items)?e.items:[],$e=({postMetaData:e,globalDefaults:t,updatePostMetaData:s})=>{const[r,l]=(0,n.useState)(!1),[c,d]=(0,n.useState)(""),[u,h]=(0,n.useState)(""),[g,m]=(0,n.useState)(null),[f,k]=(0,n.useState)({}),[x,w]=(0,n.useState)(!1),[v,j]=(0,n.useState)([]),[N,A]=(0,n.useState)(""),[E,T]=(0,n.useState)(!1),[P,L]=(0,n.useState)({}),I=surerank_globals?.wp_schema_pro_active||!1,z=surerank_globals?.default_schemas||{},D=Object.entries(z).map(([e,t])=>({id:e,...t})),M=t.schemas||{},F=e?.schemas||{},R=Object.keys(F).length>0?F:M||{},$=(0,n.useMemo)(()=>Object.entries(R).filter(([,e])=>(0,Ae.sP)(e?.title)),[R]),B=surerank_globals?.schema_type_data||{},H=surerank_globals?.schema_type_options||{},U=(0,n.useMemo)(()=>Object.entries(surerank_globals?.schema_variables||{}).map(([e,t])=>({value:e,label:t})),[]),V=(0,n.useMemo)(()=>{const e=new Map,t=new Set(D.map(e=>Le(e?.title||"")));return Object.entries(H||{}).forEach(([s])=>{const r=Le(s),n=((e,t)=>{const s=t?.[e]||{};if(s?.options)return s.options;if(Array.isArray(s))return s.reduce((e,t)=>(t?.value&&(e[t.value]=t?.label||t.value),e),{});const r={};return Object.values(s).forEach(e=>{e?.options&&Object.assign(r,e.options)}),Object.keys(r).length>0?r:s})(s,H);Object.entries(n||{}).forEach(([n,a])=>{const i=n||a||s,o=Fe(s,i);e.has(o)||e.set(o,{schema:i,title:a||i,parent_schema:s,child_schema_type:i,type:i,tier:t.has(r)?"free":"pro",can_add:t.has(r),is_pro:!t.has(r)})})}),Array.from(e.values())},[D,H]),q=(0,n.useMemo)(()=>{const e=Object.entries(R||{}).map(([e,t])=>{const s=t?.title||"",r=t?.fields?.["@type"]||t?.type||s||"";return{id:e,parent_schema:s,child_schema_type:r,child:{title:r,"@type":r}}}).filter(e=>Le(e.parent_schema)&&Le(e.child_schema_type)),t=new Set(e.map(e=>Le(e.parent_schema)));return{activeSchemas:e,activeParentSet:t,activeSchemaTitles:Array.from(new Set(e.map(e=>e.parent_schema))),activeSchemaTypes:Array.from(new Set(e.map(e=>e.child_schema_type)))}},[R]),G=e=>{const t={};return Object.entries(e).forEach(([e,s])=>{const{show_on:r,not_show_on:n,...a}=s,i={...a,parent:!0};t[e]=i}),t};(0,n.useEffect)(()=>{const e={};if(Object.entries(R).forEach(([t,s])=>{const r=s.fields||{},n={...(0,Ae.fO)(B[s.title]||[],!0),...r};0===Object.keys(r).length&&(n["@type"]=s?.type||"",e[t]={...s,fields:n})}),Object.keys(e).length>0){const t=G({...R,...e});JSON.stringify(t)!==JSON.stringify(R)&&s({schemas:t})}},[R,B,s]);const W=()=>{const e=(0,a.select)(i.E).getAppSettings();(0,a.dispatch)(i.E).updateAppSettings({currentScreen:"schemaAuth",previousScreen:e?.currentScreen||"settings",previousTab:e?.currentTab,previousMetaTab:e?.currentMetaTab,previousAccordion:e?.currentAccordion})},Y=async()=>{const e=Ct(),t=wp?.data?.select("core/editor")?.getCurrentPostType?.()||surerank_seo_popup?.post_type||"post",s=K((0,a.select)(i.E).getVariables()),r=e?.title||s?.title||"",n=e?.postContent||s?.content||"";if(!r&&!n)return A((0,b.__)("Please add post title or content first to get schema recommendations.","surerank")),void j([]);const o=(0,a.select)(i.E).getPageSeoChecks()?.authenticated;if(o){w(!0),T(!0),A(""),j([]),L({});try{const e=await(0,O.fu)({post_type:t,post_title:r,post_content:n,available_schemas:V,active_schemas:q.activeSchemas,active_schema_titles:q.activeSchemaTitles,active_schema_types:q.activeSchemaTypes});if(!e?.success){if("no_auth_token"===e?.code)return void W();throw new Error(e?.message||(0,b.__)("Unable to recommend schema right now. Please try again.","surerank"))}const s=((e,t)=>{if(Array.isArray(t))return t.map(e=>({parent_schema:e?.parent_schema||"",children:Re(e).map(Oe)})).filter(e=>e.parent_schema);if(t&&"object"===typeof t&&!Array.isArray(t))return Object.entries(t).map(([e,t])=>({parent_schema:e,children:(Array.isArray(t)?t:Re(t)).map(Oe)}));const s=new Map;return(Array.isArray(e)?e:[]).map(Oe).forEach(e=>{const t=e?.parent_schema||"";t&&(s.has(t)||s.set(t,[]),s.get(t).push(e))}),Array.from(s.entries()).map(([e,t])=>({parent_schema:e,children:t}))})(e?.recommendations,e?.grouped_recommendations).map(e=>{const t=(e?.children||[]).filter(e=>{const t=Oe(e);return!q.activeParentSet.has(Le(t?.parent_schema))});return{...e,children:t}}).filter(e=>(e?.children||[]).length>0);j(s),0===s.length&&A((0,b.__)("No relevant schema recommendations found for this content.","surerank"))}catch(l){const e=l?.code||l?.data?.code||l?.responseJSON?.code||"";if("no_auth_token"===e)return void W();let t=l?.message||(0,b.__)("Unable to recommend schema right now. Please try again.","surerank");"request_timeout"===e&&(t=(0,b.__)("Schema recommendation timed out. Please try again in a moment.","surerank")),"limit_exceeded"===e&&(t=(0,b.__)("You have reached your monthly schema recommendation limit.","surerank")),"require_pro"===e&&(t=(0,b.__)("Schema recommendations are unavailable for your current plan.","surerank")),A(t)}finally{w(!1)}}else W()},Z=(0,a.useSelect)(e=>e(i.E).getAppSettings()?.triggerSchemaRecommend,[]);(0,n.useEffect)(()=>{Z&&((0,a.dispatch)(i.E).updateAppSettings({triggerSchemaRecommend:!1}),Y())},[Z]);const X=(e,t)=>R[e]?.fields?.[t]||"",Q=(e,t,r)=>{if(((e,t,r)=>{const n={...R,[e]:{...R[e],fields:{...R[e].fields,[t]:r}}},a=G(n);s({schemas:a})})(e,t,r),"@type"===t){const t={...R};t[e].type=t[e]?.title||"",t[e].fields["@type"]=r,s({schemas:t})}},se=(e,t)=>"Group"!==e.type||e.cloneable?(0,Ce.D)(e,{schemaId:t,schemaType:R[t].type,getFieldValue:e=>X(t,e),onFieldChange:(e,s)=>Q(t,e,s),variableSuggestions:U,fieldItemIds:f,setFieldItemIds:k,renderAsGroupComponent:!0}):(0,p.jsx)("div",{className:"flex flex-col w-full space-y-3 border border-border-subtle rounded-lg p-3",children:e.fields.map(s=>((e,t,s)=>{if("Hidden"===t.type)return null;const r=X(s,e.id)||{};return(0,p.jsxs)("div",{className:"flex flex-col items-start justify-start gap-1.5 w-full",children:[(0,p.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,p.jsx)(te.A,{tag:"span",size:"sm",children:t.label}),t.tooltip&&(0,p.jsx)(S.$w,{content:t.tooltip,placement:"top",arrow:!0,className:"z-[99999]",children:(0,p.jsx)(be.A,{className:"size-4 text-icon-secondary",title:t.tooltip})})]}),(0,p.jsx)("div",{className:"flex items-center gap-1.5 w-full",children:(0,Ce.Yi)({field:t,schemaType:R[s].type,getFieldValue:e=>r[e]||t.std||"",onFieldChange:(t,r)=>{const n={...X(s,e.id)||{},[t]:r};Q(s,e.id,n)},variableSuggestions:U,renderAsGroupComponent:!1})})]},t.id)})(e,s,t))}),ne=e=>{const t=R[e]?.title;if(!(0,Ae.sP)(t))return Ae.lz;const r=B[t]||[],n=R[e]?.fields||{};if(0===r.length||r.every(e=>"Hidden"===e.type||"schema_name"===e.id))return Ae.lz;const a=r.filter(t=>"Hidden"!==t.type&&"SchemaDocs"!==t.type&&(!!Object.prototype.hasOwnProperty.call(n,t.id)||!!t.required||!(!t.parent||!t.parent_option)&&(0,Ae.xI)(t,t=>X(e,t)))),i=(0,Ae.vr)(a,n),o=(0,Ae.fw)(r,n);return(0,p.jsxs)(p.Fragment,{children:[i.map(t=>{if(t.parent&&t.parent_option&&!(0,Ae.xI)(t,t=>X(e,t)))return null;const r=(0,Ae.wE)(t);return(0,p.jsxs)("div",{className:"flex flex-col items-start justify-start gap-1.5 w-full p-1",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between gap-1.5 w-full",children:[(0,p.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,p.jsx)(te.A,{tag:"span",size:"sm",children:t.label}),t.tooltip&&(0,p.jsx)(S.$w,{content:t.tooltip,placement:"top",arrow:!0,className:"z-[99999]",children:(0,p.jsx)(be.A,{className:"size-4 text-icon-secondary",title:t.tooltip})})]}),r&&(0,p.jsx)(Ne.e,{onDelete:()=>((e,t)=>{const r={...R[e].fields};delete r[t];const n={...R,[e]:{...R[e],fields:r}},a=G(n);s({schemas:a})})(e,t.id)})]}),se(t,e)]},t.id)}),(0,J.applyFilters)("surerank.schema.properties.extensions",null,{schemaId:e,schemaType:R[e]?.type||t,schema:t,metaSettings:{schemas:R},currentSchema:R[e]||{},setMetaSetting:(e,t)=>{"schemas"===e&&s({schemas:t})},variableSuggestions:U,getFieldValue:t=>X(e,t),onFieldChange:(t,s)=>Q(e,t,s)}),(0,p.jsx)(Se.b,{availableFields:o,onAddField:t=>((e,t)=>{const r=R[e]?.title,n=(B[r]||[]).find(e=>e.id===t);if(!n)return;let a=void 0!==n.std?n.std:"";"Group"===n.type&&n.fields&&(a=(0,Ae.fO)([n])[n.id]);const i={...R,[e]:{...R[e],fields:{...R[e].fields,[t]:a}}},o=G(i);s({schemas:o})})(e,t),className:"p-2 w-full border-t border-border-subtle mt-2",filterContext:{schemaId:e,schemaType:R[e]?.type||t,schema:t,metaSettings:{schemas:R},currentSchema:R[e]||{},setMetaSetting:(e,t)=>{"schemas"===e&&s({schemas:t})}}})]})};if(I)return(0,p.jsx)(je.A,{});const ae=v.filter(e=>!P[e?.parent_schema]);return(0,p.jsxs)("div",{className:"pt-2 gap-2",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-4.5 -mt-0.5",children:[(0,p.jsx)(re.E,{size:14,weight:500,color:"label",children:(0,b.__)("Schemas in Use","surerank")}),(0,p.jsx)(_.A,{variant:"outline",size:"sm",icon:(0,p.jsx)(we.A,{className:"size-3.5"}),onClick:Y,disabled:x,children:x?ze:Ie})]}),N&&(0,p.jsx)(ye.A,{className:"w-full shadow-none mb-3",content:N,variant:"info"}),v.length>0&&(0,p.jsxs)("div",{className:"mb-3 space-y-4",children:[(0,p.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,p.jsx)(re.E,{size:14,weight:500,color:"secondary",children:(0,b.__)("Recommended for this page","surerank")}),(0,p.jsx)(_.A,{size:"xs",variant:"link",icon:(0,p.jsx)(C.A,{className:"size-3.5"}),onClick:Y,children:(0,b.__)("Refresh suggestions","surerank")})]}),ae.map(e=>{const t=(e?.children||[]).map(Oe).filter(e=>!q.activeParentSet.has(Le(e?.parent_schema)));if(0===t.length)return null;const r=()=>{L(t=>({...t,[e?.parent_schema]:!0})),(0,O.MN)("group_dismissed").catch(()=>{})};return t.map(t=>{const n=Fe(t?.parent_schema,t?.child_schema_type),a=q.activeParentSet.has(Le(t?.parent_schema)),i=t?.is_pro||"pro"===t?.tier,o="companion_rule"===t?.source;return(0,p.jsxs)("div",{className:"rounded-xl border border-border-subtle bg-background-primary shadow-sm overflow-hidden",children:[(0,p.jsxs)("div",{className:"px-4 py-3.5",children:[(0,p.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,p.jsx)(re.E,{size:14,weight:600,color:"label",children:t?.child_schema_type||t?.schema||e?.parent_schema||""}),o&&(0,p.jsx)(y.A,{label:(0,b.__)("Companion","surerank"),size:"xs",variant:"neutral"}),i&&(0,p.jsx)(y.A,{label:(0,b.__)("Pro","surerank"),size:"xs",variant:"yellow"})]}),t?.reason&&(0,p.jsx)(re.E,{size:13,color:"help",className:"block mt-1",children:t.reason})]}),(0,p.jsxs)("div",{className:"flex items-center justify-end gap-3 px-4 py-2 bg-background-secondary border-t border-border-subtle",children:[(0,p.jsx)(_.A,{size:"sm",variant:"ghost",onClick:r,children:(0,b.__)("Dismiss","surerank")}),(0,p.jsx)(_.A,!1===t?.can_add?{size:"sm",variant:"outline",className:"shrink-0",onClick:()=>(e=>{(0,O.MN)("upgrade_clicked").catch(()=>{});const t=e?.upgrade_url;t?window.open(t,"_blank","noopener,noreferrer"):(0,Pe.n$)("schema_recommendation_pro")})(t),children:(0,b.__)("Upgrade to Add","surerank")}:{size:"sm",variant:"primary",className:"shrink-0",disabled:a,onClick:()=>(e=>{const t=e?.parent_schema||"",r=e?.child_schema_type||e?.schema||t;if(!Le(t)||!Le(r))return;if(q.activeParentSet.has(Le(t)))return;const n=Fe(t,r),a=Object.entries(R).find(([,e])=>Le(e?.title)===Le(t)),i={...R};let o="";if(a){const[e,t]=a;Le(t?.fields?.["@type"]||"")||(o=e,i[e]={...t,fields:{...t?.fields||{},"@type":r}})}if(!o){o=(0,Ae.lk)();const e=(0,Ae.fO)(B[t]||[],!0);i[o]={title:t,type:t,show_on:{rules:[],specific:[],specificText:[]},fields:{...e,"@type":r}}}const l=G(i);s({schemas:l}),m(o),(0,O.MN)("recommendation_added").catch(()=>{}),j(e=>e.map(e=>({...e,children:(e?.children||[]).filter(e=>{const t=Oe(e);return Fe(t?.parent_schema,t?.child_schema_type)!==n})})).filter(e=>(e?.children||[]).length>0))})(t),children:a?De:Me})]})]},n)})})]}),x&&(0,p.jsxs)("div",{className:"mb-3 p-3 rounded border border-border-subtle bg-background-secondary space-y-2",children:[(0,p.jsx)("div",{className:"h-4 w-40 rounded bg-background-primary animate-pulse"}),(0,p.jsx)("div",{className:"h-14 w-full rounded bg-background-primary animate-pulse"}),(0,p.jsx)("div",{className:"h-14 w-full rounded bg-background-primary animate-pulse"})]}),E&&!x&&0===ae.length&&!N&&(0,p.jsx)(ye.A,{className:"w-full shadow-none mb-3",content:(0,b.__)("No missing high-relevance schema found. Try adding more content context and refresh suggestions.","surerank"),variant:"info"}),(0,p.jsx)("div",{className:(0,o.cn)("w-full bg-background-secondary flex flex-col items-center justify-center rounded p-1"),children:$.length>0?(0,p.jsx)(ee.Ay,{type:"simple",iconType:"arrow",className:"w-full space-y-1",autoClose:!1,children:$.map(([e,t])=>(0,p.jsxs)(ee.Ay.Item,{value:e,className:"bg-background-primary rounded-md border border-border-subtle",defaultExpanded:e===g,children:[(0,p.jsxs)(ee.Ay.Trigger,{iconType:"arrow",className:"hover:bg-background-primary rounded-md flex justify-between items-center [&>div]:w-full p-2 gap-2 [&>svg]:size-4 cursor-pointer",children:[(0,p.jsx)("span",{className:"text-base font-normal text-text-primary leading-6 ml-1",children:t.title}),(0,p.jsx)(Te,{onConfirm:()=>(e=>{const t={...R};delete t[e];const r=G(t);s({schemas:r})})(e),placement:"bottom",offset:{mainAxis:8,crossAxis:-28},children:(0,p.jsx)("div",{className:"inline-flex ml-auto",role:"button",tabIndex:0,children:(0,p.jsx)(ve.A,{className:"size-3.5 text-icon-secondary cursor-pointer"})})})]}),(0,p.jsx)(ee.Ay.Content,{children:(0,p.jsx)("div",{className:"mt-3 space-y-4",children:ne(e)})})]},e))}):(0,p.jsx)(ye.A,{className:"w-full shadow-none",content:(0,b.__)("No schemas configured.","surerank"),variant:"info"})}),(0,p.jsx)("div",{className:"w-full mt-6 rounded",children:(0,p.jsx)(Ee.A,{selectedSchema:c,setSelectedSchema:d,selectedType:u,setSelectedType:h,schemaTypeOptions:H,defaultSchemas:D,handleAddSchema:()=>{const e=(0,Ae.lk)(),t={title:c,type:u,show_on:{rules:[],specific:[],specificText:[]},fields:{}},r={...R,[e]:t},n=G(r);s({schemas:n}),m(e),l(!1),d(""),h("")},isModalOpen:r,closeModal:()=>l(!1)})})]})},Be=({postMetaData:e,updatePostMetaData:t,globalDefaults:s})=>{const{currentAccordion:r}=(0,a.useSelect)(e=>e(i.E).getAppSettings()),{updateAppSettings:o}=(0,a.useDispatch)(i.E),l=r||"general";(0,n.useEffect)(()=>{r||o({currentAccordion:"general"})},[]);const c=e=>{o({currentAccordion:e})};return(0,p.jsxs)(ee.Ay,{autoClose:!0,defaultValue:l,type:"boxed",className:"flex flex-col",children:[(0,p.jsxs)(ee.Ay.Item,{value:"general",className:"bg-background-primary border rounded-md overflow-hidden",children:[(0,p.jsx)(ee.Ay.Trigger,{className:"text-base [&>svg]:size-4 px-4 py-4 hover:bg-background-secondary transition-colors",onClick:()=>c("general"),"aria-label":(0,b.__)("Toggle general SEO settings","surerank"),children:(0,b.__)("General","surerank")}),(0,p.jsx)(ee.Ay.Content,{children:(0,p.jsx)(oe,{postMetaData:e,updatePostMetaData:t,globalDefaults:s})})]}),(0,p.jsxs)(ee.Ay.Item,{value:"social",className:"bg-background-primary border rounded-md overflow-hidden",children:[(0,p.jsx)(ee.Ay.Trigger,{className:"text-base [&>svg]:size-4 px-4 py-4 hover:bg-background-secondary transition-colors",onClick:()=>c("social"),"aria-label":(0,b.__)("Toggle social media settings","surerank"),children:(0,b.__)("Social","surerank")}),(0,p.jsx)(ee.Ay.Content,{children:(0,p.jsx)(_e,{postMetaData:e,updatePostMetaData:t,globalDefaults:s})})]}),(0,p.jsxs)(ee.Ay.Item,{value:"advanced",className:"bg-background-primary border rounded-md overflow-hidden",children:[(0,p.jsx)(ee.Ay.Trigger,{className:"text-base [&>svg]:size-4 px-4 py-4 hover:bg-background-secondary transition-colors",onClick:()=>c("advanced"),"aria-label":(0,b.__)("Toggle advanced SEO settings","surerank"),children:(0,b.__)("Advanced","surerank")}),(0,p.jsx)(ee.Ay.Content,{children:(0,p.jsx)(xe,{postMetaData:e,updatePostMetaData:t,globalDefaults:s})})]}),U.Rw&&(0,p.jsxs)(ee.Ay.Item,{value:"schema",className:"bg-background-primary border rounded-md overflow-hidden",children:[(0,p.jsx)(ee.Ay.Trigger,{className:"text-base [&>svg]:size-4 px-4 py-4 hover:bg-background-secondary transition-colors",onClick:()=>c("schema"),"aria-label":(0,b.__)("Toggle schema markup settings","surerank"),children:(0,b.__)("Schema","surerank")}),(0,p.jsx)(ee.Ay.Content,{children:(0,p.jsx)($e,{postMetaData:e,updatePostMetaData:t,globalDefaults:s})})]})]})},He=({isRefreshing:e,isChecking:t,onClick:s,targetSelector:r=".refresh-button-container"})=>{const[a,i]=(0,n.useState)(null);return(0,n.useEffect)(()=>{const e=()=>{const e=document.querySelector(r);e&&i(e)};e();const t=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,s=t?new t(e):null;return s&&s.observe(document.body,{childList:!0,subtree:!0}),()=>s.disconnect()},[r]),a?(0,n.createPortal)((0,p.jsx)(N.sv,{isRefreshing:e,isChecking:t,onClick:s}),a):null};var Ue=s(3535),Ve=s(48029),qe=s(68402);const Ge=(0,n.memo)(({pageSeoChecks:e={},onIgnore:t,onRestore:s,onFix:r,onIgnoreBrokenLink:a,onRestoreBrokenLink:o,type:l="page"})=>{const{badChecks:d=[],fairChecks:u=[],passedChecks:h=[],ignoredChecks:g=[],suggestionChecks:m=[],isCheckingLinks:_=!1,linkCheckProgress:f={current:0,total:0}}=e,k=(0,qe.ZD)(i.E),x=(0,n.useMemo)(()=>d.length>0||u.length>0||m.length>0,[d.length,u.length,m.length]),y=e=>()=>{e&&"function"===typeof t&&t(e)},w=e=>()=>{e&&((0,qe.M6)(e)&&"function"===typeof r?r(e):(0,qe.J9)(e))},v=e=>"broken_links"!==e?.id||"function"!==typeof a||"function"!==typeof o?{}:{onIgnoreUrl:a,onRestoreUrl:o,ignoredBrokenLinks:e?.ignoredBrokenLinks||[]},j=e=>{if(k||(0,N.bj)())return{show:!1};const t=(0,qe.M6)(e);return{show:!0,locked:t?qe.IG.includes(e):!qe.X2,...!t&&{buttonLabel:(0,b.__)("Help Me Fix","surerank")}}};return(0,p.jsxs)(c.P.div,{className:"space-y-3 p-1",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},children:[x&&(0,p.jsxs)("div",{className:"space-y-3",children:["page"===l&&_&&(0,p.jsxs)("div",{className:"flex items-center gap-2 p-2 bg-white rounded-lg shadow-sm border-0.5 border-solid border-border-subtle",children:[(0,p.jsx)(Ue.a,{size:"sm"}),(0,p.jsx)(re.E,{size:14,weight:500,color:"tertiary",children:(0,b.sprintf)((0,b.__)("%1$d out of %2$d checks are done.","surerank"),f.current,f.total)})]}),d.map(e=>(0,p.jsx)(Ve.Tr,{variant:"red",label:(0,b.__)("Critical","surerank"),title:e.title,data:e?.data,showImages:e?.showImages,onIgnore:y(e.id),showIgnoreButton:!0,onFix:w(e.id),fixItButtonProps:j(e.id),...v(e)},e.id)),u.map(e=>(0,p.jsx)(Ve.Tr,{variant:"yellow",label:(0,b.__)("Warning","surerank"),title:e.title,data:e?.data,showImages:e?.showImages,onIgnore:y(e.id),onFix:w(e.id),showIgnoreButton:!0,fixItButtonProps:j(e.id)},e.id)),m.map(e=>(0,p.jsx)(Ve.Tr,{variant:"blue",label:(0,b.__)("Suggestion","surerank"),title:e.title,data:e?.data,showImages:e?.showImages,onIgnore:y(e.id),showIgnoreButton:!0,onFix:w(e.id),fixItButtonProps:j(e.id)},e.id))]}),g.length>0&&(0,p.jsx)("div",{className:"space-y-3",children:g.map(e=>(0,p.jsx)(Ve.Tr,{variant:"neutral",label:(0,b.__)("Ignored","surerank"),title:e.title,showRestoreButton:!0,onRestore:()=>s(e.id)},e.id))}),h.length>0&&(0,p.jsx)("div",{className:"space-y-3",children:h.map(e=>(0,p.jsx)(Ve.Tr,{variant:"green",label:(0,b.__)("Passed","surerank"),title:e.title,onIgnore:()=>t(e.id),...v(e)},e.id))})]})});var We=s(66924),Ye=s(29767);const Ke=()=>(0,p.jsxs)("div",{className:"relative flex flex-col gap-3 p-3 bg-background-primary rounded-lg shadow-sm border-0.5 border-solid border-border-subtle",children:[(0,p.jsxs)("div",{className:"w-full flex items-start gap-2",children:[(0,p.jsx)(Ye.A,{variant:"rectangular",className:"h-6 w-16 rounded-full"}),(0,p.jsx)("div",{className:"flex-1",children:(0,p.jsx)(Ye.A,{variant:"rectangular",className:"h-5 w-48"})}),(0,p.jsx)(Ye.A,{variant:"rectangular",className:"h-6 w-20 rounded"})]}),(0,p.jsxs)("div",{className:"ml-3 space-y-1",children:[(0,p.jsx)(Ye.A,{variant:"rectangular",className:"h-4 w-full"}),(0,p.jsx)(Ye.A,{variant:"rectangular",className:"h-4 w-3/4"})]})]}),Ze=()=>(0,p.jsxs)("div",{className:"p-2 overflow-y-auto",role:"status","aria-live":"polite","aria-busy":"true",children:[(0,p.jsx)("span",{className:"sr-only",children:(0,b.__)("Loading page SEO checks\u2026","surerank")}),(0,p.jsx)("div",{className:"space-y-3",children:Array.from({length:4}).map((e,t)=>(0,p.jsx)(Ke,{},`check-skeleton-${t}`))})]}),Je=(e,t)=>{if(!e||!t)return!1;const s=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`\\b${s}\\b`,"i").test(e)},Xe=e=>e?e.normalize("NFD").replace(/[\u0300-\u036f\u1AB0-\u1AFF\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/g,"").toLowerCase():"",Qe=(e,t)=>{if(!e||!t)return!1;const s=Xe(e),r=Xe(t),n=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${n}\\b`,"iu").test(s))return!0;const a=r.trim().split(/\s+/).filter(Boolean);if(a.length>1){const e=a.join("").replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`\\b${e}\\b`,"iu").test(s))return!0;const t="\\b"+a.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("\\s+(?:\\S+\\s+){0,1}")+"\\b";if(new RegExp(t,"iu").test(s))return!0}return!1},et=()=>{const{setPageSeoCheck:e}=(0,a.useDispatch)(i.E),{metaData:t,variables:s,postDynamicData:r,globalDefaults:o,settingsLoaded:l,pageSeoChecks:c,focusKeyword:d,ignoredList:u,initializing:p}=(0,a.useSuspenseSelect)(e=>{const t=e(i.E);return{metaData:t?.getPostSeoMeta(),variables:t?.getVariables(),postDynamicData:t?.getPostDynamicData(),globalDefaults:t?.getGlobalDefaults(),settingsLoaded:t?.getMetaboxState(),pageSeoChecks:t?.getPageSeoChecks()||{},focusKeyword:t?.getPostSeoMeta()?.focus_keyword,ignoredList:t.getCurrentPostIgnoredList(),initializing:t.getPageSeoChecks().initializing}},[]),h=(0,n.useRef)({postContent:"",permalink:""}),g=(0,n.useRef)(t),m=(0,n.useRef)(d),_=(0,n.useRef)(u),f=(0,n.useCallback)((t,n,a)=>{if(!a)return void e("keyword",[]);const i=K(s),l=(0,Y.A)(n.page_title||o.page_title||"",i,r),c=(0,Y.A)(n.page_description||o.page_description||"",i,r),d=t?.permalink||s?.post?.permalink?.value||s?.term?.permalink?.value||window.location.href||"",u=t?.postContent||r?.content||"",p=[];p.push(((e,t)=>t?e?Je(e,t)||Qe(e,t)?(0,H.bY)({id:"keyword_in_title",title:(0,b.sprintf)((0,b.__)('Focus keyword "%s" found in SEO title.',"surerank"),t),status:"success",type:"keyword"}):(0,H.bY)({id:"keyword_in_title",title:(0,b.sprintf)((0,b.__)('Focus keyword "%s" not found in SEO title.',"surerank"),t),status:"warning",type:"keyword"}):(0,H.bY)({id:"keyword_in_title",title:(0,b.__)("No SEO title found to analyze.","surerank"),status:"warning",type:"keyword"}):(0,H.bY)({id:"keyword_in_title",title:(0,b.__)("No focus keyword set to analyze title.","surerank"),status:"suggestion",type:"keyword"}))(l,a)),p.push(((e,t)=>t?e?Je(e,t)||Qe(e,t)?(0,H.bY)({id:"keyword_in_description",title:(0,b.sprintf)((0,b.__)('Focus keyword "%s" found in meta description.',"surerank"),t),status:"success",type:"keyword"}):(0,H.bY)({id:"keyword_in_description",title:(0,b.sprintf)((0,b.__)('Focus keyword "%s" not found in meta description.',"surerank"),t),status:"warning",type:"keyword"}):(0,H.bY)({id:"keyword_in_description",title:(0,b.__)("No meta description found to analyze.","surerank"),status:"warning",type:"keyword"}):(0,H.bY)({id:"keyword_in_description",title:(0,b.__)("No focus keyword set to analyze meta description.","surerank"),status:"suggestion",type:"keyword"}))(c,a)),p.push(((e,t)=>{if(!t)return(0,H.bY)({id:"keyword_in_url",title:(0,b.__)("No focus keyword set to analyze URL.","surerank"),status:"suggestion",type:"keyword"});if(!e)return(0,H.bY)({id:"keyword_in_url",title:(0,b.__)("No URL found to analyze.","surerank"),status:"warning",type:"keyword"});const s=t.toLowerCase().replace(/\s+/g,"-");return e.toLowerCase().includes(s)||Je(e,t)||Qe(e,t)||Qe(e.replace(/-/g," "),t)?(0,H.bY)({id:"keyword_in_url",title:(0,b.sprintf)((0,b.__)('Focus keyword "%s" found in URL.',"surerank"),t),status:"success",type:"keyword"}):(0,H.bY)({id:"keyword_in_url",title:(0,b.sprintf)((0,b.__)('Focus keyword "%s" not found in URL.',"surerank"),t),status:"warning",type:"keyword"})})(d,a)),p.push(((e,t)=>{if(!t)return(0,H.bY)({id:"keyword_in_content",title:(0,b.__)("No focus keyword set to analyze content.","surerank"),status:"suggestion",type:"keyword"});if(!e)return(0,H.bY)({id:"keyword_in_content",title:(0,b.__)("No content found to analyze.","surerank"),status:"warning",type:"keyword"});const s=e.replace(/<[^>]*>/g," ").replace(/\s+/g," ").trim();return Je(s,t)||Qe(s,t)?(0,H.bY)({id:"keyword_in_content",title:(0,b.sprintf)((0,b.__)('Focus keyword "%s" found in content.',"surerank"),t),status:"success",type:"keyword"}):(0,H.bY)({id:"keyword_in_content",title:(0,b.sprintf)((0,b.__)('Focus keyword "%s" not found in content.',"surerank"),t),status:"warning",type:"keyword"})})(u,a));const h=p.filter(Boolean);e("keyword",h)},[s,r,o,e]);(0,n.useLayoutEffect)(()=>{if(!l||(0,N.bj)())return;const e=Ct();(!(0,B.isEqual)(g.current,t)||!(0,B.isEqual)(h.current,e)||m.current!==d||!(0,B.isEqual)(_.current,u))&&(f(e,t,d),h.current=e,g.current=t,m.current=d,_.current=u)},[l,d,t,s,o,r,u,p]),(0,n.useLayoutEffect)(()=>{if(!l||(0,N.bj)())return;const e=(0,B.debounce)(()=>{const e=Ct();(0,B.isEqual)(h.current,e)&&(0,B.isEqual)(g.current,t)&&m.current===d&&(0,B.isEqual)(_.current,u)||(h.current=e,g.current=t,m.current=d,_.current=u,f(e,t,d))},300),s=(0,a.subscribe)(e);return()=>{s(),e.cancel()}},[l,t,d,s,o,r,u,f,p]);const k=c?.keywordChecks??{badChecks:[],fairChecks:[],passedChecks:[],suggestionChecks:[],ignoredChecks:[]},x=k?.badChecks?.length>0||k?.fairChecks?.length>0||k?.suggestionChecks?.length>0;return{...k,hasBadOrFairChecks:x}},tt=({type:e="page"})=>{const{pageSeoChecks:t,focusKeyword:s,currentScreen:r,currentTab:l}=(0,a.useSuspenseSelect)(e=>{const t=e(i.E),s=t.getAppSettings();return{pageSeoChecks:t?.getPageSeoChecks()||{},focusKeyword:t?.getPostSeoMeta?.()?.focus_keyword,ignoredList:t.getCurrentPostIgnoredList(),currentScreen:s?.currentScreen,currentTab:s?.currentTab}},[]),{ignorePageSeoCheck:c,restorePageSeoCheck:d,updateAppSettings:u,updatePostSeoMeta:h,ignoreBrokenLinkUrl:g,restoreBrokenLinkUrl:m}=(0,a.useDispatch)(i.E);et();const _=(0,n.useMemo)(()=>{const s=t?.categorizedChecks||{badChecks:[],fairChecks:[],passedChecks:[],suggestionChecks:[],ignoredChecks:[]};return t[(0,o.sz)(e)?.categorizedType]??{...s}},[e,t?.checks]),f=({selectedCheckId:e,content:t})=>{if("url_length"===e&&t){const e=(0,J.applyFilters)("surerank-pro.page-seo-checks-fix-url-length",null);if("function"!==typeof e)return;return void e(t)}const s=qe.BB[e];s&&h({[s]:t})};return"keyword"!==e||s?(0,p.jsx)(Ge,{type:e,pageSeoChecks:{...t,..._},onIgnore:e=>{c(e)},onRestore:e=>{d(e)},onFix:e=>{u({selectedCheckId:e,onSuccess:f,generateContentProcess:We.N.IDLE,error:null,fixProcess:We.N.IDLE,currentScreen:"fixItForMe",previousScreen:r,previousTab:l})},onIgnoreBrokenLink:async e=>{const t=await g(e);return t?.success&&(0,W.lO)(e),t},onRestoreBrokenLink:async e=>{const t=await m(e);return t?.success&&(0,W.dT)(e),t}}):null},st=({type:e="page"})=>!1===U.Jj?null:(0,p.jsx)(n.Suspense,{fallback:(0,p.jsx)(Ze,{}),children:(0,p.jsx)(tt,{type:e})}),rt=({type:e="page"})=>{const t=(0,a.useSelect)(e=>e(i.E).getPageSeoChecks(),[]),{ignorePageSeoCheck:s,restorePageSeoCheck:r,updateAppSettings:l,updatePostSeoMeta:c,ignoreBrokenLinkUrl:d,restoreBrokenLinkUrl:u}=(0,a.useDispatch)(i.E),{focusKeyword:h,currentScreen:g,currentTab:m}=(0,a.useSelect)(e=>{const t=e(i.E),s=t.getAppSettings();return{focusKeyword:t?.getPostSeoMeta?.()?.focus_keyword,currentScreen:s?.currentScreen,currentTab:s?.currentTab}},[]),_=(0,n.useMemo)(()=>{const s=t?.categorizedChecks||{badChecks:[],fairChecks:[],passedChecks:[],suggestionChecks:[],ignoredChecks:[]},r=(0,o.sz)(e)?.categorizedType;return t[r]??{...s}},[e,t?.checks]),f=({selectedCheckId:e,content:t})=>{const s=qe.BB[e];s&&c({[s]:t})};return"keyword"!==e||h?(0,p.jsx)("div",{className:"p-1 space-y-2 flex-1 flex flex-col",children:(0,p.jsx)("div",{className:"flex-1",children:(0,p.jsx)(n.Suspense,{fallback:(0,p.jsx)(Ze,{}),children:(0,p.jsx)(Ge,{type:e,pageSeoChecks:{...t,..._,isCheckingLinks:t.isCheckingLinks},onIgnore:e=>{s(e)},onRestore:e=>{r(e)},onFix:e=>{l({selectedCheckId:e,onSuccess:f,generateContentProcess:We.N.IDLE,error:null,fixProcess:We.N.IDLE,currentScreen:"fixItForMe",previousScreen:g,previousTab:m})},onIgnoreBrokenLink:async e=>{const t=await d(e);return t?.success&&(0,W.lO)(e),t},onRestoreBrokenLink:async e=>{const t=await u(e);return t?.success&&(0,W.dT)(e),t}})})})}):null};var nt=s(98979);const at=({value:e,onChange:t,suffix:s=null,placeholder:r=(0,b.__)("Enter your focus keyword","surerank"),isLoading:n=!1,...a})=>n?(0,p.jsx)(Ye.A,{className:"w-full h-10"}):(0,p.jsx)(de.A,{className:"[&_input]:transition-[color,outline] [&_input]:duration-200",size:"md",placeholder:r,suffix:s??(0,p.jsx)(nt.A,{className:"size-5 text-icon-primary",strokeWidth:1.5}),value:e,onChange:t,...a}),it=()=>{const{updatePostMetaData:e}=(0,a.useDispatch)(i.E),{focusKeyword:t,initialized:s}=(0,a.useSelect)(e=>{const t=e(i.E);return{focusKeyword:t?.getPostSeoMeta?.()?.focus_keyword,initialized:t.getMetaboxState()}});return(0,p.jsxs)("div",{className:"w-full flex flex-col gap-2 [&>div]:w-full",children:[(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)(re.E,{as:"label",size:14,weight:500,lineHeight:20,htmlFor:"focus-keyword-input",children:(0,b.__)("Focus Keyword","surerank")}),(0,p.jsx)(S.ID,{content:(0,b.__)("The primary keyword or phrase you want this content to rank for in search engines. Keyword checks will be based on this.","surerank"),placement:"top-start",arrow:!1})]}),(0,p.jsx)(at,{id:"focus-keyword-input",value:t||"",onChange:t=>{e({focus_keyword:t})},isLoading:!s})]})},ot=({message:e})=>(0,p.jsx)("div",{className:"[&_p.mr-10]:mr-0 m-1",children:(0,p.jsx)(ye.A,{variant:"info",content:(0,p.jsxs)("span",{className:"flex items-start gap-2",children:[(0,p.jsx)("p",{className:"m-0",children:e}),(0,p.jsx)("span",{className:"-mr-3 refresh-button-container shrink-0"})]}),className:"shadow-none"})}),lt=({type:e})=>{if((0,N.QZ)())return null;const t=(0,N.jK)();return(0,p.jsx)(t?rt:st,{type:e})},ct=()=>{const e=(0,N.jK)(),t=(0,N.fJ)()&&"1"===surerank_seo_popup?.is_taxonomy,s=(0,a.useSelect)(e=>e(i.E).getPageSeoChecks(),[]),r=(0,n.useMemo)(()=>{const e=s?.categorizedPageChecks||{};return"success"!==(0,Z.F)(e)?.status},[s?.categorizedPageChecks]),o=s?.isRefreshing||!1,l=s?.brokenLinkState||{isChecking:!1,checkedLinks:[],brokenLinks:[],allLinks:[]},c={...l,checkedLinks:new Set(l.checkedLinks),brokenLinks:new Set(l.brokenLinks)},d=(0,a.useSelect)(e=>e(i.E).getModalState(),[]),u=(0,a.useSelect)(e=>e(i.E).getRefreshCalled(),[]),{setPageSeoCheck:h,setRefreshCalled:g}=(0,a.useDispatch)(i.E),m=(0,n.useCallback)(e=>{h("isRefreshing",e)},[h]),_=(0,n.useCallback)(e=>{let t=e;if("function"===typeof e){const s=e({...l,checkedLinks:new Set(l.checkedLinks),brokenLinks:new Set(l.brokenLinks)});t={...s,checkedLinks:Array.from(s.checkedLinks||[]),brokenLinks:Array.from(s.brokenLinks||[])}}else e&&"object"===typeof e&&(t={...e,checkedLinks:e.checkedLinks instanceof Set?Array.from(e.checkedLinks):e.checkedLinks||[],brokenLinks:e.brokenLinks instanceof Set?Array.from(e.brokenLinks):e.brokenLinks||[]});h("brokenLinkState",t)},[h,l]),f=(0,n.useCallback)(async()=>{g(!0),await(0,N.OV)(m,_,h,a.select,s,c)},[m,_,h,s,c,g]);(0,n.useEffect)(()=>{e&&d&&!u&&((0,N.OV)(m,_,h,a.select,s,c),g(!0))},[e,d,u,h,s,c,g]);const k=(0,J.applyFilters)("surerank.seo_popup.default_accordion",r?"page-checks":"keyword-checks",{hasAnyPageCheckIssues:r});return(0,N.QZ)()?(0,p.jsx)("div",{children:(0,p.jsx)(re.E,{color:"help",size:14,className:"text-center py-5 border-0.5 border-solid border-border-secondary rounded-md",children:(0,b.__)("SEO analysis is not available for this page.","surerank")})}):(0,p.jsxs)("div",{className:"space-y-2",children:[((0,N.jp)()||(0,N.ep)()||(0,N.uf)())&&(0,p.jsx)(ot,{message:(0,b.__)("Please save changes in the editor before refreshing the checks.","surerank")}),((0,N.fJ)()&&!t||(0,N.qQ)())&&(0,p.jsx)(ot,{message:(0,b.__)("Checks are based on the published page. Refresh to get the latest results.","surerank")}),(0,N.bj)()&&!(0,N.qQ)()&&(0,p.jsx)(ot,{message:(0,b.__)("Checks are based on the published user. Refresh to get the latest results.","surerank")}),e&&!t&&(0,p.jsx)(He,{isRefreshing:o,isChecking:s.isCheckingLinks,onClick:f}),(0,p.jsxs)(ee.Ay,{autoClose:!0,defaultValue:k,type:"boxed",children:[(0,p.jsxs)(ee.Ay.Item,{value:"page-checks",className:"bg-background-primary overflow-hidden",children:[(0,p.jsx)(ee.Ay.Trigger,{className:"text-base [&>svg]:size-5 pr-2 pl-3 py-3",children:(0,b.__)("Page Checks","surerank")}),(0,p.jsx)(ee.Ay.Content,{children:(0,p.jsx)("div",{className:"pt-3",children:(0,p.jsx)(lt,{type:"page"})})})]}),(0,p.jsxs)(ee.Ay.Item,{value:"keyword-checks",className:"bg-background-primary overflow-hidden",children:[(0,p.jsx)(ee.Ay.Trigger,{className:"text-base [&>svg]:size-5 pr-2 pl-3 py-3",children:(0,b.__)("Keyword Checks","surerank")}),(0,p.jsx)(ee.Ay.Content,{children:(0,p.jsxs)("div",{className:"pt-3",children:[U.Jj&&!(0,N.Rm)()&&(0,p.jsx)("div",{className:"flex items-center gap-2 mb-3",children:(0,p.jsx)(it,{})}),(0,p.jsx)(lt,{type:"keyword"})]})})]}),(0,J.applyFilters)("surerank.analyze.pro_accordions",null)]})]})},dt=({tab:e="general"})=>{if("advanced"===e){const e=3;return(0,p.jsxs)("div",{className:"w-full p-4 space-y-5",children:[(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsxs)("div",{className:"w-full flex items-center gap-2",children:[(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-32 h-4"}),(0,p.jsx)(Ye.A,{variant:"circular",className:"size-5"})]}),(0,p.jsx)("div",{className:"space-y-4",children:Array.from({length:e}).map((e,t)=>(0,p.jsxs)("div",{className:"flex items-start gap-2",children:[(0,p.jsx)(Ye.A,{variant:"rectangular",className:"size-5"}),(0,p.jsxs)("div",{className:"space-y-2",children:[(0,p.jsx)(Ye.A,{variant:"rectangular",className:(0,o.cn)("w-44 h-5",t%2===0&&"w-52")}),(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-full h-4"})]})]},t))})]}),(0,p.jsxs)("div",{className:"w-full p-1 space-y-1.5",children:[(0,p.jsxs)("div",{className:"w-full flex items-center gap-2",children:[(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-32 h-4"}),(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-5 h-4"})]}),(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-full h-12"}),(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-full h-3"})]})]})}const t="social"===e?2:1;return(0,p.jsxs)("div",{className:"w-full space-y-2 p-2",children:["social"===e&&(0,p.jsx)("div",{className:"w-full p-1",children:(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-full h-14"})}),(0,p.jsxs)("div",{className:"w-full p-1 space-y-2",children:[(0,p.jsxs)("div",{className:"w-full flex items-center justify-between",children:[(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-32 h-4"}),(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-10 h-5"})]}),(0,p.jsx)(Ye.A,{variant:"rectangular",className:(0,o.cn)("w-full h-40",{"h-48":"social"===e})})]}),Array.from({length:t}).map((e,t)=>(0,p.jsxs)("div",{className:"w-full p-1 space-y-1.5",children:[(0,p.jsxs)("div",{className:"w-full flex items-center gap-2",children:[(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-32 h-4"}),(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-5 h-4"})]}),(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-full h-12"}),(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-full h-3"})]},t)),(0,p.jsxs)("div",{className:"w-full p-1 space-y-1.5",children:[(0,p.jsxs)("div",{className:"w-full flex items-center gap-2",children:[(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-32 h-4"}),(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-5 h-4"})]}),(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-full h-32"}),(0,p.jsx)(Ye.A,{variant:"rectangular",className:"w-full h-3"})]})]})};let ut=e=>e;"block"===surerank_seo_popup?.editor_type?ut=h:"classic"===surerank_seo_popup?.editor_type&&(ut=g);const pt=(0,r.compose)((0,a.withSelect)(e=>{const t=e(i.E);return{postMetaData:t.getPostSeoMeta(),initialized:t.getMetaboxState(),globalDefaults:t.getGlobalDefaults()}}),(0,a.withDispatch)(e=>{const t=e(i.E);return{updatePostMetaData:e=>t.updatePostMetaData(e)}}),ut)((0,n.memo)(e=>{const{postMetaData:t,updatePostMetaData:s,initialized:r,globalDefaults:l}=e,{status:d,initializing:u}=(0,x.A)(),h=(0,n.useMemo)(()=>{if(u||!d||!U.Jj)return null;const e=(0,o.ns)(d);return(0,p.jsx)("div",{className:(0,o.cn)("rounded-full ml-1 w-[7px] h-[7px]",e)})},[d,u]),g=[{label:(0,b.__)("Optimize","surerank"),slug:"optimize"},...(0,N.QZ)()?[]:[{label:(0,b.__)("Analyze","surerank"),slug:"analyze",icon:h}]],m=(0,J.applyFilters)("surerank.meta-settings.tabs",g,{statusIndicatorIcon:h}),{updateAppSettings:_}=(0,a.useDispatch)(i.E),{currentMetaTab:f}=(0,a.useSelect)(e=>e(i.E).getAppSettings()),[k,y]=(0,n.useState)(f||"optimize");(0,n.useEffect)(()=>{f&&f!==k&&y(f)},[f]);let w=null;switch(k){case"optimize":w=(0,p.jsx)(Be,{postMetaData:t,updatePostMetaData:s,globalDefaults:l});break;case"analyze":w=(0,p.jsx)(ct,{});break;default:w=null}return w=(0,J.applyFilters)("surerank.meta-settings.tab-content",w,{activeTab:k,postMetaData:t,updatePostMetaData:s,globalDefaults:l}),r||(w=(0,p.jsx)(dt,{tab:k})),(0,p.jsxs)(n.Fragment,{children:[(0,p.jsx)("div",{children:(0,p.jsx)(le.Ay.Group,{className:"w-full",iconPosition:"right",size:"md",variant:"rounded",activeItem:k,onChange:({event:e,value:{slug:t}})=>{e.preventDefault(),e.stopPropagation(),y(t),_({currentMetaTab:t})},children:m.map(({label:e,slug:t,icon:s})=>(0,p.jsx)(le.Ay.Tab,{slug:t,text:e,icon:s??null,className:"text-sm"},e))})}),(0,p.jsx)(c.P.div,{className:"flex flex-col -mt-1 flex-1 overflow-y-auto",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},children:w},k)]})})),ht=(0,J.applyFilters)("surerank-pro.seo-popup-tabs",{optimize:{title:(0,b.__)("Optimize","surerank"),component:()=>(0,p.jsx)(pt,{}),label:(0,b.__)("Optimize","surerank"),icon:(0,p.jsx)(X.A,{}),slug:"optimize"},...(0,N.QZ)()?{}:{analyze:{title:(0,b.__)("Analyze","surerank"),component:ct,label:(0,b.__)("Analyze","surerank"),slug:"analyze",icon:(0,p.jsx)(Q.A,{}),className:"relative surerank-page-checks-indicator"}}});var gt=s(1965),mt=s(90232);const _t=({title:e=(0,b.__)("Here are a few suggestions","surerank"),onBack:t,onClose:s,className:r})=>(0,p.jsx)("div",{className:(0,o.cn)("flex flex-col self-stretch gap-2 px-4 pt-3.5 pb-2",r),children:(0,p.jsxs)("div",{className:"flex justify-between items-center self-stretch gap-8",children:[(0,p.jsx)(re.E,{size:16,lineHeight:20,color:"primary",weight:600,children:e}),(0,p.jsxs)("div",{className:"flex items-center gap-2",children:[(0,p.jsx)(_.A,{variant:"outline",size:"xs",onClick:t,className:"px-1 py-1 border border-gray-300 shadow-sm bg-white",icon:(0,p.jsx)(mt.A,{className:"text-text-primary"}),iconPosition:"left",children:(0,p.jsx)("span",{children:(0,b.__)("Back","surerank")})}),"function"===typeof s&&(0,p.jsx)(_.A,{variant:"ghost",size:"xs",onClick:s,className:"p-1 text-icon-secondary hover:text-icon-primary hover:bg-transparent bg-transparent focus:outline-none",icon:(0,p.jsx)(f.A,{})})]})]})});var ft=s(26438),kt=s(19640),xt=s(66970);const yt=e=>{const{updateAppSettings:t}=(0,a.useDispatch)(i.E),{status:s=We.N.IDLE,allGeneratedContents:r={},selectedCheckId:o,selectedFieldKey:l,checkType:c,genError:u,postId:h,onSuccess:g,onError:m,onProgress:_,onUseThis:f,previousScreen:k,currentFieldType:x}=(0,a.useSelect)(e=>{const t=e(i.E).getPageSeoChecks(),s=e(i.E).getAppSettings();return{status:s?.generateContentProcess,allGeneratedContents:s?.generatedContents,selectedCheckId:s?.selectedCheckId||t?.selectedItem,selectedFieldKey:s?.selectedFieldKey,genError:s?.error,postId:t?.postId,checkType:t?.checkType,previousScreen:s?.previousScreen,onSuccess:s?.onSuccess,onError:s?.onError,onProgress:s?.onProgress,onUseThis:s?.onUseThis,currentFieldType:s?.currentFieldType}},[]),y=l||o,w=r[y]||[],{handleFixContent:j,isFixing:C}=((e={})=>{const{onSuccess:t,onError:s,onProgress:r}=e,{updateAppSettings:n}=(0,a.useDispatch)(i.E),{postId:o,checkType:l,selectedCheckId:c,status:u,currentScreen:p,previousScreen:h}=(0,a.useSelect)(e=>{const t=e(i.E).getPageSeoChecks(),s=e(i.E).getAppSettings();return{postId:t?.postId,checkType:t?.checkType,selectedCheckId:s?.selectedCheckId,status:s?.fixProcess,currentScreen:s?.currentScreen,previousScreen:s?.previousScreen}},[]);return{handleFixContent:async e=>{try{if(u===We.N.IN_PROGRESS)return;if(""===e?.trim())throw new Error((0,b.__)("Selected content is empty.","surerank"));const s=o||window?.surerank_seo_popup?.post_id||window?.surerank_seo_popup?.term_id;if(!s)throw new Error((0,b.__)("Post or term ID not found.","surerank"));n({fixProcess:We.N.IN_PROGRESS}),r&&"function"===typeof r&&r({selectedCheckId:c,content:e,postId:s,checkType:l});const a="taxonomy"===l||"1"===window?.surerank_seo_popup?.is_taxonomy,i=await v()({path:"/surerank/v1/page-seo-checks/fix",method:"POST",data:{type:"content-generation",input_key:c,input_value:e,id:parseInt(s),is_taxonomy:a}});if(!i?.success)throw new Error(i?.message||(0,b.__)("Failed to apply content.","surerank"));return t&&"function"===typeof t&&t({response:i,selectedCheckId:c,content:e,postId:s,checkType:l}),"block"!==surerank_seo_popup.editor_type&&d.o.success(i?.message||(0,b.__)("Fixed successfully","surerank"),{description:(0,b.__)("Fix applied successfully. Some fixes may require a page reload to see changes.","surerank")}),n({currentScreen:h,previousScreen:p,fixProcess:We.N.IDLE,selectedCheckId:null,error:null}),i}catch(a){n({fixProcess:We.N.ERROR});const t=a?.message||(0,b.__)("An unexpected error occurred while applying content.","surerank");return s&&"function"===typeof s&&s({error:a,selectedCheckId:c,content:e,postId:o||window?.surerank_seo_popup?.post_id||window?.surerank_seo_popup?.term_id,checkType:l}),d.o.error(t),{error:a?.message||(0,b.__)("Unknown error","surerank")}}},isFixing:u===We.N.IN_PROGRESS}})({onSuccess:g,onError:m,onProgress:_}),S=async()=>{if(s!==We.N.IN_PROGRESS)try{t({generateContentProcess:We.N.START});const e=o||l,s=qe.EF[e]?qe.EF[e]:"";if(t({currentFieldType:s}),!s)throw{message:(0,b.__)("No content type selected. Please select an item to generate content for.","surerank"),code:"no_content_type"};t({generateContentProcess:We.N.IN_PROGRESS});const n=h||window?.surerank_seo_popup?.post_id||window?.surerank_seo_popup?.term_id,a="taxonomy"===c||"1"===window?.surerank_seo_popup?.is_taxonomy,i=await(0,O.lX)(s,n,a);if(!i?.success)throw i;const d=i.content.map((e,t)=>({id:Date.now()+t,text:e}));t({generateContentProcess:We.N.COMPLETED,generatedContents:{...r,[y]:d}})}catch(e){t({generateContentProcess:We.N.FAILED,error:{message:e?.message??(0,b.__)("An unexpected error occurred while generating content.","surerank"),code:e?.code||"unknown_error"}})}},N=()=>{S()},A=async e=>{if(f&&l)return f(l,e),void t({currentScreen:k,previousScreen:"",selectedCheckId:null,selectedFieldKey:null,onUseThis:null,generateContentProcess:We.N.IDLE,error:null});await j(e)};return(0,n.useEffect)(()=>{s!==We.N.IDLE||!o&&!l||w.length||S()},[]),s===We.N.FAILED?"require_pro"===u?.code?(0,p.jsx)(ft.A,{}):"limit_exceeded"===u?.code?(0,p.jsx)(ft.A,{title:(0,b.__)("Daily Limit Reached","surerank"),description:(0,b.__)("You've used all your AI credits for today. Your credits will refresh automatically tomorrow, so you can continue creating content.","surerank"),showButton:!1}):(0,p.jsx)(xt.A,{error:u,onRetry:N,title:(0,b.__)("Generation Failed","surerank"),supportText:(0,b.__)("Click here to contact support.","surerank"),retryText:(0,b.__)("Retry","surerank")}):(0,p.jsx)(kt.A,s===We.N.COMPLETED?{...e,contents:w,onRegenerate:N,onUseThis:A,fixing:C,fieldType:x}:{...e,contents:w,onRegenerate:N,onUseThis:A,generating:s===We.N.IN_PROGRESS||s===We.N.START,error:s===We.N.FAILED?u:null,fixing:C,fieldType:x})};var bt=s(98315);const wt=(0,J.applyFilters)("surerank-pro.seo-popup-screens",{settings:{title:(0,b.__)("Settings","surerank"),component:()=>{const{currentTab:e}=(0,a.useSelect)(e=>e(i.E).getAppSettings(),[]),t=(0,n.useMemo)(()=>{const t=ht[e??"optimize"];return(0,N.jK)()&&t?.pageBuilderComponent||t?.component},[e]);return(0,p.jsx)(t,{})}},fixItForMe:{title:(0,b.__)("Fix It For Me","surerank"),component:()=>{const{authenticated:e,previousScreen:t,currentScreen:s,previousTab:r,previousMetaTab:n,previousAccordion:o}=(0,a.useSelect)(e=>{const t=e(i.E).getPageSeoChecks(),s=e(i.E).getAppSettings();return{authenticated:t?.authenticated,previousScreen:s?.previousScreen,currentScreen:s?.currentScreen,previousTab:s?.previousTab,previousMetaTab:s?.previousMetaTab,previousAccordion:s?.previousAccordion}},[]),{updateAppSettings:l,setPageSeoCheck:c}=(0,a.useDispatch)(i.E),{openAuthPopup:u}=(0,bt.A)(()=>c("authenticated",!0));let h,g=(0,p.jsx)(yt,{});if(!e){const e=()=>window.open(U.HH,"_blank","noopener"),t=async()=>{try{const e=await(0,O.xI)();if(!e?.success)throw new Error(e?.message||(0,b.__)("Authentication failed","surerank"));if(e?.auth_url)return void u(e.auth_url);c("authenticated",!0)}catch(e){d.o.error(e?.message||(0,b.__)("An error occurred during authentication","surerank"))}};h=(0,b.__)("Connect SureRank AI","surerank"),g=(0,p.jsx)(gt.A,{onClickLearnMore:e,onClickGetStarted:t})}return(0,p.jsxs)("div",{className:"p-2 space-y-6",children:[(0,p.jsx)(_t,{className:"p-0",title:h,onBack:()=>{l({currentScreen:t,previousScreen:s,currentTab:r||"optimize",currentMetaTab:n||"optimize",currentAccordion:o||"general",selectedCheckId:null,selectedFieldKey:null,onUseThis:null,generateContentProcess:We.N.IDLE,error:null})}}),g]})}},schemaAuth:{title:(0,b.__)("Connect SureRank AI","surerank"),component:()=>{const{previousScreen:e,currentScreen:t,previousTab:s,previousMetaTab:r,previousAccordion:n}=(0,a.useSelect)(e=>{const t=e(i.E).getAppSettings();return{previousScreen:t?.previousScreen,currentScreen:t?.currentScreen,previousTab:t?.previousTab,previousMetaTab:t?.previousMetaTab,previousAccordion:t?.previousAccordion}},[]),{updateAppSettings:o,setPageSeoCheck:l}=(0,a.useDispatch)(i.E),c=(a=!1)=>{o({currentScreen:e||"settings",previousScreen:t,currentTab:s||"optimize",currentMetaTab:r||"optimize",currentAccordion:n||"general",triggerSchemaRecommend:a})},{openAuthPopup:u}=(0,bt.A)(()=>{l("authenticated",!0),c(!0)});return(0,p.jsxs)("div",{className:"p-2 space-y-6",children:[(0,p.jsx)(_t,{className:"p-0",title:(0,b.__)("Connect SureRank AI","surerank"),onBack:()=>c(!1)}),(0,p.jsx)(gt.A,{onClickLearnMore:()=>window.open(U.HH,"_blank","noopener"),onClickGetStarted:async()=>{try{const e=await(0,O.xI)();if(!e?.success)throw new Error(e?.message||(0,b.__)("Authentication failed","surerank"));if(e?.auth_url)return void u(e.auth_url);l("authenticated",!0),c(!0)}catch(e){d.o.error(e?.message||(0,b.__)("An error occurred during authentication","surerank"))}}})]})}}});window&&!window?.toast&&(window.toast=d.o);const vt={open:{x:0},closed:{x:"100%"}},jt=()=>{const e=document.getElementById("editable-post-name-full"),t=e?.textContent?.trim();if(t)return`${window.location.origin}/${t}/`;const s=document.querySelector("#sample-permalink a");return s?.href||surerank_seo_popup?.link||""},Ct=()=>{const e=(0,a.select)(i.E);if((0,N.qQ)()||(0,N.bj)())return{postContent:"",permalink:surerank_seo_popup?.link||"",title:"",description:e?.getPostSeoMeta()?.page_description||""};const t=(0,a.select)("core/editor");if("block"===surerank_seo_popup?.editor_type)return{postContent:t.getEditedPostContent()||"",permalink:t.getPermalink()||surerank_seo_popup?.link,title:t.getEditedPostAttribute("title")||"",description:e.getPostSeoMeta()?.page_description||""};if("undefined"!==typeof window.tinymce&&window.tinymce.get("content")){const t=document.getElementById("title");return{postContent:window.tinymce.get("content").getContent()||"",permalink:jt(),title:t&&t.value||"",description:e.getPostSeoMeta()?.page_description||""}}const s=document.getElementById("content"),r=document.getElementById("title");return{postContent:s&&s.value||"",permalink:jt(),title:r&&r.value||"",description:e.getPostSeoMeta()?.page_description||""}},St=()=>(et(),(()=>{const{setPageSeoCheck:e}=(0,a.useDispatch)(i.E),{metaData:t,variables:s,postDynamicData:r,globalDefaults:o,pageSeoChecks:l,settingsLoaded:c}=(0,a.useSuspenseSelect)(e=>{const t=e(i.E);return t?.getCurrentPostIgnoredList(),{metaData:t?.getPostSeoMeta()||{},variables:t?.getVariables()||{},postDynamicData:t?.getPostDynamicData()||{},globalDefaults:t?.getGlobalDefaults()||{},pageSeoChecks:t?.getPageSeoChecks()||{},settingsLoaded:t?.getMetaboxState()}},[]),{categorizedChecks:d={},initializing:u}=l,[,p]=(0,n.useTransition)(),h=(0,n.useRef)({postContent:"",permalink:""}),g=(0,n.useRef)(t),m=(0,N.jK)(),_=(0,n.useMemo)(()=>K(s),[s]),f=(0,n.useMemo)(()=>(0,Y.A)(t.page_title||o.page_title||"",_,r),[t.page_title,o.page_title,_,r]),k=(0,n.useMemo)(()=>(0,Y.A)(t.page_description||o.page_description||"",_,r),[t.page_description,o.page_description,_,r]),x=(0,n.useMemo)(()=>(0,Y.A)(t.canonical_url||o.canonical_url||"",_,r),[t.canonical_url,o.canonical_url,_,r]),y=(0,n.useCallback)(async(t,r,n,a,i)=>{if("1"===surerank_seo_popup?.is_taxonomy)return e("page",[(0,H.cd)(t.permalink),V(n),q(a),(0,W.aO)(i)]);const o=(l=t.postContent,(new DOMParser).parseFromString(l,"text/html"));var l;const c=await Promise.all([await(0,H.jU)(o),await(0,H.aS)(o),(0,H.SZ)(o),(0,H.cd)(t.permalink),V(n),q(a),G(),(0,H._e)(o),(0,W.aO)(i)]);e("page",c),p(async()=>{const t=await(0,W.Tq)(o,s?.post?.ID?.value||0,void 0,e),r=[...c];t&&r.push(t),e("page",r)})},[]);(0,n.useLayoutEffect)(()=>{!m&&c&&u&&U.Jj&&(async()=>{const s=Ct();await y(s,t,f,k,x),h.current=s,u&&e("initializing",!1)})()},[m,u,t,f,k,x,c]),(0,n.useLayoutEffect)(()=>{if(m||!c||u||!U.Jj)return;const e=(0,B.debounce)(async()=>{const e=Ct();(0,B.isEqual)(h.current,e)&&(0,B.isEqual)(g.current,t)||(h.current=e,g.current=t,await y(e,t,f,k,x))},300),s=(0,a.subscribe)(e);return()=>{s(),e.cancel()}},[m,t,f,k,y,x,u,c]);(0,n.useMemo)(()=>(0,Z.F)(d),[d])})(),null);let Nt=e=>e;"block"===surerank_seo_popup?.editor_type?Nt=h:"classic"===surerank_seo_popup?.editor_type&&(Nt=g);const At=(0,r.compose)((0,a.withSelect)(e=>{const t=e(i.E);return{initialized:t.getMetaboxState(),appSettings:t.getAppSettings()}}),(0,a.withDispatch)(e=>{const t=e(i.E);return{setMetaDataAndDefaults:e=>t.initMetaDataAndDefaults(e),setInitialized:e=>t.updateMetaboxState(e),updateModalState:e=>t.updateModalState(e),updateAppSettings:e=>t.updateAppSettings(e)}}),Nt,n.memo)(e=>{const{setMetaDataAndDefaults:t,initialized:s,setInitialized:r,updateModalState:h,appSettings:g,updateAppSettings:m}=e,_=(0,a.useSelect)(e=>e(i.E).getModalState(),[]),f=(0,a.useSelect)(e=>e(i.E).getActivePostId(),[]),k=(0,n.useRef)(!1),x=(0,n.useRef)(f),y=(0,n.useCallback)(async()=>{if(!s)try{const e=await(0,O.lr)();d.o.success(e.message),t({postSeoMeta:e.data,globalDefaults:e.global_default})}catch(e){d.o.error(e.message)}finally{r(!0)}},[s]);(0,n.useEffect)(()=>{f&&x.current!==f&&(k.current=!1,x.current=f),s||(k.current=!1),(0,N.qQ)()&&!f||k.current||s||(y(),k.current=!0)},[y,f,s]),(0,n.useEffect)(()=>{if(!s)return;const e=(0,J.applyFilters)("surerank.seo_popup.handle_auto_open",null);"function"===typeof e&&e({updateModalState:h,updateAppSettings:m})},[s,h,m]),(0,n.useEffect)(()=>{if(!s||"undefined"===typeof window)return;const e=new URLSearchParams(window.location.search);if("true"!==e.get("surerank_open"))return;h(!0),e.delete("surerank_open");const t=e.toString();window.history.replaceState({},"",`${window.location.pathname}${t?`?${t}`:""}${window.location.hash}`)},[s,h]);const b=(0,n.useCallback)(()=>{h(!1)},[h]),w=(0,n.useMemo)(()=>{if(g?.currentScreen)return wt[g?.currentScreen].component},[g?.currentScreen]),v=(0,n.useMemo)(()=>{const e=wt[g?.currentScreen];return e?.header?e.header:z},[g?.currentScreen]);return(0,p.jsxs)(n.Fragment,{children:[(0,p.jsx)(n.Suspense,{fallback:null,children:(0,p.jsx)(St,{})}),(0,p.jsx)(u.Ay,{className:"z-[100000]"}),(0,p.jsx)(l.N,{children:_&&(0,p.jsxs)(c.P.div,{tabIndex:"0",id:"surerank-seo-popup-modal-container",className:"fixed inset-y-0 right-0 lg:w-slide-over-container md:w-slide-over-container w-full z-[99999] bg-background-primary shadow-2xl p-0 flex flex-col",initial:"closed",animate:"open",exit:"closed",variants:vt,transition:{duration:.3},children:[(0,p.jsx)(v,{onClose:b}),(0,p.jsx)("div",{className:(0,o.cn)("flex-1 flex flex-col gap-6 overflow-y-auto px-4 pt-4 pb-0","optimize"!==g?.currentTab&&"pb-4"),children:(0,p.jsx)(w,{})}),"settings"===g.currentScreen&&(0,p.jsx)($,{onClose:b})]})})]})})},54486(e,t,s){s.d(t,{F:()=>r});const r=(e={})=>{const t=e.badChecks||[],s=e.fairChecks||[],r=e.suggestionChecks||[];let n="success";return t.length>0?n="error":s.length>0?n="warning":r.length>0&&(n="suggestion"),{status:n,counts:{errorAndWarnings:t.length+s.length,success:(e.passedChecks||[]).length,error:t.length,warning:s.length,suggestion:r.length}}}},11936(e,t,s){s.d(t,{R:()=>n});var r=s(27723);const n=e=>{if(!e||"object"!==typeof e)return(0,r.__)("SureRank Meta Box","surerank");const t="number"===typeof e.error?e.error:0,s="number"===typeof e.warning?e.warning:0;return t>0?(0,r.sprintf)((0,r._n)("%s Issue Detected","%s Issues Detected",t,"surerank"),t):s>0?(0,r.sprintf)((0,r._n)("%s Warning Detected","%s Warnings Detected",s,"surerank"),s):(0,r.__)("SureRank Meta Box","surerank")}},64894(e,t,s){s.d(t,{Af:()=>p,Lx:()=>g,MN:()=>x,YO:()=>y,f1:()=>u,fu:()=>k,ih:()=>d,lX:()=>m,lr:()=>c,rU:()=>b,xI:()=>h});var r=s(1455),n=s.n(r),a=s(93832),i=s(62220),o=s(9607);const l="/surerank/v1",c=async()=>{const e={},t=!!surerank_seo_popup?.is_user,s=!t&&((0,o.P$)("term.php")||!!surerank_seo_popup.is_taxonomy);t?e.user_id=surerank_seo_popup?.user_id:s?e.term_id=surerank_seo_popup?.term_id:e.post_id=surerank_seo_popup?.post_id,t||(e.post_type=surerank_seo_popup?.post_type,e.is_taxonomy=surerank_seo_popup?.is_taxonomy);let r=i.MF;t?r=i.bi:s&&(r=i.EJ);try{const t=await n()({path:(0,a.addQueryArgs)(r,e),method:"GET"});if(!t.success)throw new Error(t.message);return t}catch(l){throw new Error(l.message)}},d=async e=>{if(!e)return null;const t=new URL(e).pathname.split("/").pop().split("?")[0],s=t.replace(/-\d+x\d+\.(jpg|jpeg|png|gif|webp)$/i,"").replace(/-scaled\.(jpg|jpeg|png|gif|webp)$/i,"").replace(/\.(webp)$/i,"").replace(/(-optimized|-compressed)/i,""),r=[{search:t},{search:s},{search:t.replace(/\.[^/.]+$/,"")},{search:s.replace(/\.[^/.]+$/,"")}];for(const o of r)try{const e=await n()({path:(0,a.addQueryArgs)("/wp/v2/media",{search:o.search,media_type:"image",slug:o.search,per_page:20}),method:"GET"});if(e&&e.length>0)return e.find(e=>{const r=e.source_url||e.url,n=r.split("/").pop().split("?")[0];return n===t||r.includes(s)||n.includes(s)})||e[0]}catch(i){continue}try{const e=s.split("-")[0],t=await n()({path:(0,a.addQueryArgs)("/wp/v2/media",{search:e,media_type:"image",per_page:50}),method:"GET"});if(t&&t.length>0)return t[0]}catch(i){}return null},u=async(e="")=>{try{return await n()({path:"/surerank/v1/posts-list?post_type=page&per_page=200"+(e?`&search=${encodeURIComponent(e)}`:""),method:"GET"})}catch(t){return[]}},p=()=>n()({path:`${l}/migration/migrated-data`,method:"GET"}),h=()=>n()({path:`${l}/ai/auth`}),g=e=>n()({path:`${l}/ai/auth`,method:"POST",data:{accessKey:e}}),m=(e,t,s)=>{const r={type:e};return t&&(r.post_id=t),s&&(r.is_taxonomy=s),n()({path:`${l}/generate-content`,method:"POST",data:r})},_=e=>new Promise(t=>setTimeout(t,e)),f=async(e,t)=>{const s=new AbortController;let r=null;try{return r=setTimeout(()=>{s.abort()},t),await n()({...e,signal:s.signal})}catch(a){if("AbortError"===a?.name){const e=new Error("request_timeout");throw e.code="request_timeout",e}throw a}finally{r&&clearTimeout(r)}},k=async e=>{let t,s=0;for(;s<2;)try{return await f({path:`${l}/schemas/generator`,method:"POST",data:e},25e3)}catch(r){if(t=r,s++,s>=2)break;await _(500)}throw t},x=e=>n()({path:`${l}/schemas/recommendation-event`,method:"POST",data:{event_key:e}}),y=e=>n()({path:`${l}/email-reports/settings`,method:"POST",data:e}),b=e=>n()({path:`${l}/email-reports/send-test`,method:"POST",data:{recipientEmail:e}})},72956(e,t,s){s.d(t,{Z3:()=>r,n$:()=>n,qP:()=>o});const r=(e="")=>{const t=window?.surerank_globals?.pricing_link;if(!t)return"";try{const s=new URL(t);return s.searchParams.set("utm_source","surerank_plugin"),s.searchParams.set("utm_medium","wordpress_plugin"),s.searchParams.set("utm_campaign","core_plugin"),e&&s.searchParams.set("utm_content",e),s.toString()}catch(s){return t}},n=e=>{const t=r(e);window.open(t,"_blank","noopener,noreferrer")},a={"surerank-starter":1,"surerank-pro":2,"surerank-business":3},i=e=>e?e.startsWith("surerank-")?e:`surerank-${e}`:"",o=(e=null)=>{if(!e)return window?.surerank_globals?.is_pro_active;const t=window?.surerank_globals?.active_plan||null;if(!t)return!1;const s=i(e),r=i(t);return(a[r]||0)>=(a[s]||0)}},64506(e,t,s){s.d(t,{A:()=>r});const r=(e,t,s={})=>{if(!e||!t)return e;const r=(e=>{const t=e.match(/%([^%\s]+)%/g);return t?t.map(e=>e.replace(/%/g,"")):[]})(e),n=[];return r.forEach(e=>{n[e]||(n[e]=["title","excerpt","content"].includes(e)&&s?.[e]?s[e]:t[e]||"")}),e.replace(/%([^%\s]+)%/g,(e,t)=>n[t]||"")}},46565(e,t,s){s.d(t,{p:()=>n});var r=s(99418);const n=e=>r.A.sanitize(e,{ADD_ATTR:["target"]})},9607(e,t,s){s.d(t,{Ac:()=>I,EJ:()=>h,MI:()=>B,OY:()=>S,P$:()=>w,P3:()=>x,PA:()=>v,RL:()=>V,VX:()=>D,XY:()=>p,ZV:()=>N,_t:()=>F,b7:()=>H,bF:()=>m,cn:()=>k,d_:()=>W,e$:()=>f,jP:()=>b,jT:()=>P,mT:()=>M,mv:()=>L,ns:()=>R,pk:()=>y,rj:()=>g,rt:()=>Y,sI:()=>T,sL:()=>A,sz:()=>q,tI:()=>G,tX:()=>E,we:()=>U,x7:()=>$,xZ:()=>O,xx:()=>j});var r=s(27723),n=s(65313),a=s(6463),i=s(80696),o=s(81301),l=s(34164),c=s(75795),d=s(50856),u=s(76016);const p=e=>{const t=e.match(/<p>(.*?)<\/p>/g);return t?.length?t[0].replace(/(<([^>]+)>)/gi,""):e.replace(/(<([^>]+)>)/gi,"").replace(/\s+/g," ")},h=(e,t,s="...")=>!e?.length||!t||t<0||e.length<=t?e:e.slice(0,t)+s,g=e=>e&&"string"===typeof e?e.trim().split(/\s+/).filter(Boolean).length:0,m=(e,t,s=100)=>{if("string"!==typeof e||!e.trim())return;if(!_(t))return;const r=document.querySelector(e);r&&setTimeout(()=>{(0,c.createRoot)(r).render(t)},s)},_=e=>e&&e?.$$typeof===Symbol.for("react.element"),f=()=>({surerank_general:"general_settings",surerank_social:"social_settings",surerank_advanced:"advanced_settings"}[new URLSearchParams(window.location.search).get("page")]||"general_settings"),k=(...e)=>(0,d.QP)((0,l.A)(...e)),x=(e,t="value")=>{const s=e?.root?.children[0]?.children;if(!s||!s?.length)return"";let r="";return s.forEach(e=>{switch(e.type){case"text":r+=e.text;break;case"mention":r+=e.data[t];break;case"linebreak":r+="\n"}}),r},y=(e,t=[],s="value",r={type:"mention",version:1,data:{},size:"md",by:"label"})=>{const n={root:{children:[{children:[],direction:null,format:"",indent:0,type:"paragraph",version:1,textFormat:0,textStyle:""}],direction:null,format:"",indent:0,type:"root",version:1}};return("string"===typeof e?e:"").trim().split(/(\s+|%[\w\-_.]+%)/).filter(Boolean).forEach(e=>{if("\n"===e)n.root.children[0].children.push({type:"linebreak",version:1});else if(e?.startsWith("%")&&e?.endsWith("%")){const a=t?.find(t=>t[s]===e.trim());n.root.children[0].children.push(a?{...r,data:{...a}}:{detail:0,format:0,mode:"normal",style:"",text:e,type:"text",version:1})}else n.root.children[0].children.push({detail:0,format:0,mode:"normal",style:"",text:e,type:"text",version:1})}),JSON.stringify(n)};function b(e,t=65){if(!e)return"";const s=e.split("/");let r=`${s.slice(0,3).join("/")} \u203a ${s.slice(3).filter(Boolean).join(" \u203a ")}`;return r.length>t&&(r=r.substring(0,t-3)+"..."),r}const w=e=>{const t=window.location.pathname;return Array.isArray(e)?e.some(e=>t.includes(e)):t.includes(e)},v=(e,t={})=>{if(!e)return;const{delay:s=1e3,retryDelay:r=200,maxRetries:n=5}=t,a=(t=0)=>{const i=document.getElementById(e);i?setTimeout(()=>{i.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})},s):t<n&&setTimeout(()=>{a(t+1)},r)};window.requestAnimationFrame(()=>{a()})},j=(e,t)=>{try{return new URL(window.location.href).searchParams.get(e)===t}catch(s){return!1}},C=(e,t="yyyy-MM-dd")=>{try{if(!e||isNaN(new Date(e).getTime()))throw new Error((0,r.__)("Invalid Date","surerank"));return(0,n.GP)(new Date(e),t)}catch(s){return(0,r.__)("No Date","surerank")}},S=(e,t=!0)=>{if(isNaN(e))return{from:"",to:""};const s=t?(0,i.R)():(0,o.K)();let r=new Date(s);return r.setDate(s.getDate()-e),r=(0,a.o)(r),{from:r,to:s}},N=(e,t={})=>{const{decimals:s=1,forceDecimals:r=!1}=t;if("number"!==typeof e||isNaN(e))return"0";const n=e<0,a=Math.abs(e);if(a<1e3)return n?`-${a}`:a.toString();const i=[{value:1e3,suffix:"k"},{value:1e6,suffix:"m"},{value:1e9,suffix:"b"},{value:1e12,suffix:"t"},{value:1e15,suffix:"p"},{value:1e18,suffix:"e"},{value:1e21,suffix:"z"},{value:1e24,suffix:"y"},{value:1e27,suffix:"r"},{value:1e30,suffix:"q"}],o=i.find(({value:e})=>a<1e3*e)||i[i.length-1],l=(a/o.value).toFixed(s);return`${n?"-":""}${r?l:l.replace(/\.?0+$/,"")}${o.suffix}`},A=e=>{const t=new Date(e);return new Date(t.getTime()-6e4*t.getTimezoneOffset()).toISOString()},E=(e,t,s,n="MMM dd, yyyy")=>{if(!e)return"";const a=new Date(e),i=t?new Date(t):null,o=s?new Date(s):null;return isNaN(a.getTime())?(0,r.__)("Invalid Date","surerank"):i&&o?i.getMonth()===o.getMonth()&&i.getFullYear()===o.getFullYear()?C(a,"dd"):i.getFullYear()===o.getFullYear()?C(a,"MMM dd"):C(a,n):C(a,n)},T=e=>{let t,s="pending";const r=e.then(e=>{s="success",t=e},e=>{s="error",t=e});return{read(){if("pending"===s)throw r;if("error"===s)throw t;if("success"===s)return t}}},P=e=>e&&"string"===typeof e?(new DOMParser).parseFromString(e,"text/html").documentElement.textContent??e:e,L=e=>{try{return/^(https?:\/\/)?((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|localhost|\d{1,3}(\.\d{1,3}){3})(:\d+)?(\/[-a-z\d%_.~+]*)*(\?[;&a-z\d%_.~+=-]*)?(\#[-a-z\d_]*)?(\s.*)?$/i.test(e)}catch(t){return!1}},I=e=>{if(!Array.isArray(e))return[];const t=[];return e.forEach(e=>{e&&"object"===typeof e&&Array.isArray(e.list)?t.push(...e.list):e&&"object"===typeof e&&e.url&&t.push(e)}),t.filter(e=>e&&"object"===typeof e&&e.url)},z=e=>(e||"").trim().replace(/\/+$/,""),D=(e,t=[])=>{const s=e.findIndex(e=>"broken_links"===e?.id);if(-1===s)return e;const n=new Set((window?.surerank_seo_popup?.broken_link_ignored_urls||[]).map(z)),a=(t||[]).filter(e=>n.has(z(e))),i=I(e[s].data).filter(e=>!n.has(z(e.url)));return i.length||a.length?(e[s]={...e[s],data:i,ignoredBrokenLinks:a,status:i.length?"error":"success",title:(0,r.__)(i.length?"One or more broken links found on the page.":"No broken links found on the page.","surerank")},e):e},M=e=>e?Object.entries(e).map(([e,t])=>{const s=e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase());return{...t,id:e,title:t?.message||s,data:t?.description,showImages:"image_alt_text"===e}}):[],O=(e,t=[])=>e.filter(Boolean).reduce((e,s)=>(t.includes(s.id)?(s.ignore=!0,e.ignoredChecks.push(s)):(s.ignore=!1,"error"===s.status?e.badChecks.push(s):"warning"===s.status?e.fairChecks.push(s):"suggestion"===s.status?e.suggestionChecks.push(s):"success"===s.status&&e.passedChecks.push(s)),e),{badChecks:[],fairChecks:[],suggestionChecks:[],passedChecks:[],ignoredChecks:[]}),F=(e,t)=>"error"===e?(0,r.sprintf)("%1$s %2$s",t,(0,r._n)("Issue","Issues",t,"surerank")):"warning"===e?(0,r.sprintf)("%1$s %2$s",t,(0,r._n)("Warning","Warnings",t,"surerank")):(0,r.__)("SEO is Optimized","surerank"),R=e=>{switch(e){case"error":return"bg-support-error";case"warning":return"bg-support-warning";case"suggestion":return"bg-support-info";case"success":return"bg-support-success";default:return"bg-background-secondary"}},$=e=>e>0?(0,r.sprintf)((0,r._n)("%d issue needs attention.","%d issues need attention.",e,"surerank"),e):(0,r.__)("All SEO checks passed.","surerank"),B=(e,t="")=>{try{const s=new URL(e,window.location.origin).searchParams;return t?s.get(t)||"":Object.fromEntries(s.entries())}catch(s){return t?"":{}}},H=(e,t)=>{try{const s=new URL(e,window.location.origin),r=s.searchParams;return Array.isArray(t)?t.forEach(e=>r.delete(e)):r.delete(t),s.toString()}catch(s){return e}},U=(e,t)=>(e&&"object"===typeof e&&Object.keys(e).forEach(s=>{e[s]&&"object"===typeof e[s]&&(e[s].category=t)}),e),V=(e,t,s)=>{const r=[];return u.Tv.forEach(n=>{if(n===t)r.push(...s);else{const t=q(n).type;r.push(...e.pageSeoChecks?.[t]||[])}}),r},q=e=>({type:`${e}Checks`,categorizedType:`categorized${e.charAt(0).toUpperCase()+e.slice(1)}Checks`}),G=e=>{let t=e??"";return t.includes("sc-domain:")&&(t=t.replace(/sc-domain:/,"")),t.includes("https://")||t.includes("http://")||(t=`https://${t}`),t},W=e=>{let t="";switch(e.percentageType){case"danger":t="text-support-error [&>*]:text-support-error";break;case"success":t="text-support-success [&>*]:text-support-success";break;default:t=""}let s="";return null===e.value&&null===e.previous&&(s="text-text-tertiary [&>*]:text-text-tertiary"),{differenceClassName:t,fallbackClassName:s}},Y=e=>({renderValue:null===e.value&&null===e.previous?"N/A":N(e.value),renderDifference:null===e.value&&null===e.previous?"N/A":N(Math.abs(e?.value-e?.previous))})},10960(e,t,s){s.d(t,{A:()=>c});var r=s(30732),n=s(418),a=s(45773),i=s(97213),o=s(9607),l=s(10790);const c=({title:e="",message:t="",showIcon:s=!1,className:c="",color:d="success",footer:u=null,renderIcon:p=null,action:h=null,...g})=>{const m={success:"text-support-success",error:"text-support-error",warning:"text-support-warning",info:"text-support-info"}[d]||"text-support-success",_={success:a.A,error:n.A,warning:n.A,info:i.A}[d]||a.A;return(0,l.jsxs)("div",{className:(0,o.cn)("flex flex-row self-stretch gap-2 p-3 border border-solid rounded-lg",{success:"border-alert-border-green",error:"border-alert-border-danger",warning:"border-alert-border-warning",info:"border-alert-border-info"}[d]||"border-alert-border-green",{success:"bg-alert-background-green",error:"bg-alert-background-danger",warning:"bg-alert-background-warning",info:"bg-alert-background-info"}[d]||"bg-alert-background-green",c),role:"alert",...g,children:[!!p&&p,s&&!p&&(0,l.jsx)(_,{className:(0,o.cn)(m,"shrink-0"),size:20}),(0,l.jsxs)("div",{className:"flex flex-col gap-3 pl-1 pr-5 py-0 flex-1",children:[(0,l.jsxs)("div",{className:"flex flex-col justify-center self-stretch gap-0.5",children:[e&&(0,l.jsx)(r.E,{size:14,weight:600,color:"primary",className:"leading-[1.43]",children:e}),t&&(0,l.jsx)(r.E,{size:14,weight:400,color:"primary",className:"self-stretch",children:t})]}),u]}),h]})}},48029(e,t,s){s.d(t,{Kl:()=>j,Tr:()=>v});var r=s(87835),n=s(88029),a=s(71087),i=s(60443),o=s(9607),l=s(46565),c=s(37042),d=s(27723),u=s(37946),p=s(79804),h=s(418),g=s(97213),m=s(94879),_=s(86087),f=s(64894),k=s(10790);const x=new Map,y=e=>{const t="size-4";switch(e){case"blue":return(0,k.jsx)(g.A,{className:(0,o.cn)(t,"text-badge-color-sky")});case"red":return(0,k.jsx)(u.A,{className:(0,o.cn)(t,"text-badge-color-red")});case"yellow":return(0,k.jsx)(h.A,{className:(0,o.cn)(t,"text-badge-color-yellow")});case"green":return(0,k.jsx)(p.A,{className:(0,o.cn)(t,"text-badge-color-green")});default:return null}},b=e=>{if(!e||"object"!==typeof e)return null;const{status:t,details:s}=e;let r="";s&&(r+=s),404===t?r+=" "+(0,d.__)("(The page or resource was not found)","surerank"):"http_request_failed"===t?r+=" "+(0,d.__)("(Unable to connect to the URL)","surerank"):403===t?r+=" "+(0,d.__)("(Access to this resource is forbidden)","surerank"):500===t?r+=" "+(0,d.__)("(Server error occurred)","surerank"):"number"===typeof t&&t>=400&&(r+=` ${(0,d.__)("(HTTP error","surerank")} ${t})`);const n=(0,l.p)(r);return(0,k.jsxs)("div",{className:"space-y-1",children:[(0,k.jsx)("p",{className:"m-0 text-inherit",children:(0,k.jsx)("b",{children:(0,d.__)("Why is this link broken?","surerank")})}),(0,k.jsx)("p",{className:"m-0 text-inherit",dangerouslySetInnerHTML:{__html:n}}),t&&(0,k.jsxs)("p",{className:"text-xs m-0 text-inherit",children:[(0,k.jsx)("b",{children:(0,d.__)("Status:","surerank")})," ",t]})]})},w=(e,t={})=>{const s={tag:"a",variant:"link",className:"font-medium focus:outline-none focus:[box-shadow:none] [&>span]:px-0 break-all",target:"_blank",rel:"noopener noreferrer"};return(0,o.mv)(e)?(0,k.jsx)("li",{className:"m-0 text-sm",children:(0,k.jsx)(n.A,{...s,href:e,children:e})}):"object"===typeof e&&e?.url?(0,k.jsxs)("li",{className:"my-1 first:mt-0 last:mb-0 py-1.5 px-2 flex items-center gap-2 text-sm border border-solid border-border-subtle rounded-md bg-background-secondary",children:[(0,k.jsx)(n.A,{...s,className:(0,o.cn)(s.className,"flex-1 min-w-0 justify-start overflow-hidden break-normal [&>span]:min-w-0 [&>span]:truncate"),href:e.url,title:e.url,children:e.url}),(0,k.jsxs)("span",{className:"flex items-center gap-1.5 shrink-0",children:[!!t?.onIgnoreUrl&&(0,k.jsx)(n.A,{variant:"link",size:"xs",onClick:()=>t.onIgnoreUrl(e.url),"aria-label":(0,d.__)("Ignore this link","surerank"),className:"hover:text-text-secondary min-w-fit shrink-0 text-text-secondary leading-4 no-underline hover:underline",children:(0,d.__)("Ignore","surerank")}),(0,k.jsx)(m.Nr,{content:b(e),interactive:!0,placement:"top-start",offset:{alignmentAxis:-10,mainAxis:8}})]})]}):(0,k.jsx)("li",{className:"m-0 text-sm font-medium text-text-secondary list-none",children:e})},v=({variant:e,label:t,title:s,data:l,showImages:u,onIgnore:p,showRestoreButton:h=!1,onRestore:f,showIgnoreButton:x=!1,onFix:b,fixItButtonProps:v={},onIgnoreUrl:S,onRestoreUrl:N,ignoredBrokenLinks:A=[]})=>{const{data:E,listStyleClassName:T}=C(l),P=async e=>{try{const t=await S(e);if(!1===t?.success)return void i.o.error((0,d.__)("Failed to ignore link","surerank"));i.o.success((0,d.__)("Link ignored successfully","surerank"))}catch(t){i.o.error((0,d.__)("Failed to ignore link","surerank"))}};return(0,k.jsx)(k.Fragment,{children:(0,k.jsxs)("div",{className:"relative flex flex-col gap-4 p-3 bg-background-primary rounded-lg shadow-sm border-0.5 border-solid border-border-subtle",children:[(0,k.jsxs)("div",{className:"w-full flex items-start gap-2",children:[h?(0,k.jsx)(r.A,{label:t,size:"sm",type:"pill",variant:e,disableHover:!0,className:(0,o.cn)(h?"text-badge-color-disabled":"")}):(0,k.jsx)(k.Fragment,{children:(0,k.jsxs)("div",{children:[(0,k.jsx)("p",{className:"sr-only",children:t}),(0,k.jsx)("span",{className:"p-1 flex [&>svg]:size-4",children:y(e)})]})}),(0,k.jsxs)("div",{className:"flex items-center flex-col flex-initial gap-1.5 mt-px",children:[(0,k.jsxs)(a.A,{size:"xs",className:"space-x-1 text-sm text-text-secondary inline",children:[s,(0,k.jsx)(m.$w,{content:(0,d.__)("Click here to discover more details about this check.","surerank"),arrow:!0,children:(0,k.jsx)("a",{href:surerank_globals?.help_link,className:"shrink-0 align-sub ml-2 focus:outline-none focus:ring-0",target:"_blank",rel:"noopener noreferrer",children:(0,k.jsx)(g.A,{className:"size-4 text-icon-secondary hidden"})})})]}),v?.show&&(0,k.jsx)(c.A,{variant:"link",size:"xs",className:"[&>span]:p-0 mr-auto min-w-fit shrink-0 underline",tooltipProps:{className:"z-999999"},hidden:!1,onClick:b,...(({show:e,...t})=>t)(v)})]}),x&&(0,k.jsx)(n.A,{variant:"link",onClick:async()=>{try{await p(),i.o.success((0,d.__)("Check ignored successfully","surerank"))}catch(e){i.o.error((0,d.__)("Failed to ignore check","surerank"))}},"aria-label":(0,d.__)("Ignore this check","surerank"),size:"xs",className:"underline hover:text-text-secondary ml-auto min-w-fit shrink-0 mt-1 text-text-secondary leading-4",children:(0,d.__)("Ignore","surerank")}),h&&(0,k.jsx)(n.A,{variant:"link",type:"button",onClick:async()=>{try{await f(),i.o.success((0,d.__)("Check restored successfully","surerank"))}catch(e){i.o.error((0,d.__)("Failed to restore check","surerank"))}},"aria-label":(0,d.__)("Restore this check","surerank"),size:"xs",className:"underline hover:text-text-secondary ml-auto min-w-fit shrink-0 mt-1 text-text-secondary leading-4",children:(0,d.__)("Restore","surerank")})]}),!u&&E&&E.length>0&&(0,k.jsx)("ul",{className:(0,o.cn)("list-disc list-inside ml-3 mr-0 mt-0 mb-0.5 p-0",T),children:E.map((e,t)=>(0,k.jsx)(_.Fragment,{children:w(e,S?{onIgnoreUrl:P}:void 0)},`${e}-${t}`))}),u&&(0,k.jsx)(j,{images:E}),!!N&&A.length>0&&(0,k.jsxs)("div",{className:"flex flex-col gap-1 pt-3 border-0 border-t-0.5 border-solid border-border-subtle",children:[(0,k.jsx)("p",{className:"m-0 text-xs font-medium text-text-tertiary uppercase tracking-wide",children:(0,d.sprintf)((0,d.__)("Ignored links (%d)","surerank"),A.length)}),(0,k.jsx)("ul",{className:"list-none m-0 p-0",children:A.map(e=>(0,k.jsxs)("li",{className:"m-0 py-1 px-2 flex items-center gap-2 text-sm rounded-md hover:bg-background-secondary",children:[(0,k.jsx)(n.A,{tag:"a",variant:"link",className:"flex-1 min-w-0 justify-start overflow-hidden font-normal text-text-tertiary no-underline hover:no-underline focus:outline-none focus:[box-shadow:none] [&>span]:px-0 [&>span]:min-w-0 [&>span]:truncate",target:"_blank",rel:"noopener noreferrer",href:e,title:e,children:e}),(0,k.jsx)(n.A,{variant:"link",size:"xs",onClick:()=>(async e=>{try{const t=await N(e);if(!1===t?.success)return void i.o.error((0,d.__)("Failed to restore link","surerank"));i.o.success((0,d.__)("Link restored successfully","surerank"))}catch(t){i.o.error((0,d.__)("Failed to restore link","surerank"))}})(e),"aria-label":(0,d.__)("Restore this link","surerank"),className:"hover:text-text-secondary min-w-fit shrink-0 text-text-secondary leading-4 no-underline hover:underline",children:(0,d.__)("Restore","surerank")})]},e))})]})]})})},j=({images:e})=>{if(!e||!e.length)return null;const t=surerank_globals?.wp_media_upload_url??"/wp-admin/upload.php";return(0,k.jsx)("div",{className:"grid grid-cols-3 gap-2 mb-0.5",children:e.map((e,s)=>(0,o.mv)(e)?(0,k.jsxs)(n.A,{variant:"link",className:"inline-flex focus:outline-none focus:[box-shadow:none] p-0 relative",onClick:s=>(async(e,s)=>{if(e?.preventDefault(),x.has(s))window.open(`${t}?item=${x.get(s)}`,"_blank","noopener noreferrer");else try{const e=await(0,f.ih)(s);if(!e)throw new Error("No image found");const r=e?.id;x.set(s,r),window.open(`${t}?item=${r}`,"_blank","noopener noreferrer")}catch(r){window.open(t,"_blank","noopener noreferrer")}})(s,e),children:[(0,k.jsx)("div",{className:"absolute inset-0 bg-black bg-opacity-20 pointer-events-none"}),(0,k.jsx)("div",{className:"relative w-full h-36 rounded overflow-hidden",children:(0,k.jsx)("img",{src:e,alt:e,className:"w-full h-36 object-cover rounded"})})]},`${e}-${s}`):null)})},C=e=>{if(!Array.isArray(e)||!e.length)return{data:[]};const t=[];let s="";return e.forEach(e=>{"string"===typeof e?t.push(e):e&&"object"===typeof e&&Array.isArray(e.list)?(t.push(...e.list),e.list?.some(e=>e?.url&&e?.status)&&(s="list-none mx-0")):e&&"object"===typeof e&&!Array.isArray(e?.list)&&"object"===typeof e?.list?t.push(...Object.values(e.list)):(t.push(e),s="list-none mx-0")}),{data:t,listStyleClassName:s}}},66970(e,t,s){s.d(t,{A:()=>o});var r=s(27723),n=s(10960),a=s(88029),i=s(10790);const o=({error:e,onRetry:t,title:s,fallbackMessage:o,supportText:l,retryText:c})=>{const d=["content_generation_error","internal_server_error"].includes(e?.code),u=window?.surerank_globals?.support_link,p=(0,r.__)("Generation Failed","surerank"),h=(0,r.__)("Oops! Something went wrong while generating content. You can try again, or edit it manually to make sure it's correct.","surerank"),g=(0,r.__)("Click here to contact support.","surerank"),m=(0,r.__)("Retry","surerank");return(0,i.jsx)(n.A,{color:"error",title:s||p,message:e?.message||o||h,footer:(0,i.jsxs)("div",{className:"flex flex-col gap-1",children:[d&&u&&(0,i.jsx)(a.A,{tag:"a",size:"md",href:u,target:"_blank",variant:"link",className:"w-fit [&>span]:p-0 no-underline hover:no-underline ring-0 -mt-2 mb-2",children:l||g}),(0,i.jsx)(a.A,{onClick:t,tag:"button",variant:"link",className:"w-fit [&>span]:p-0",children:c||m})]})})}},37042(e,t,s){s.d(t,{A:()=>d});var r=s(94879),n=s(88029),a=s(30732),i=s(27723),o=s(9607),l=s(72956),c=s(10790);const d=({size:e="xs",tooltipProps:t,title:s=(0,i.__)("Fix SEO Issues with AI","surerank"),description:d=(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("span",{children:(0,i.__)("Upgrade to SureRank Pro and let AI help you fix critical SEO issues and warnings, so your website stays fully optimized and ready to perform better in search results.","surerank")}),(0,c.jsx)("br",{})]}),linkLabel:u=(0,i.__)("Upgrade Now","surerank"),iconPosition:p="left",icon:h,buttonLabel:g=(0,i.__)("Fix It for Me","surerank"),className:m,hidden:_=!0,locked:f=!0,onClick:k,runBeforeOnClick:x,runAfterOnClick:y,...b})=>{const w=(0,c.jsx)(n.A,{className:(0,o.cn)("w-fit",_&&"hidden",m),size:e,icon:h,iconPosition:p,...b,onClick:()=>{"function"!==typeof k||f||k()},children:g});return f?(0,c.jsx)(r.$w,{arrow:!0,interactive:!0,placement:"top-end",...t,content:(0,c.jsxs)("div",{className:"space-y-1",children:[(0,c.jsx)(a.E,{size:12,weight:600,color:"inverse",children:s}),(0,c.jsx)(a.E,{size:12,weight:400,color:"inverse",className:"leading-relaxed",children:d}),(0,c.jsx)("div",{className:"mt-1.5",children:(0,c.jsx)(n.A,{size:"xs",variant:"link",className:"[&>span]:px-0 no-underline hover:no-underline focus:[box-shadow:none] text-link-visited-inverse hover:text-link-visited-inverse-hover",onClick:()=>(0,l.n$)("fix_it_button"),children:u})})]}),children:w}):w}},1965(e,t,s){s.d(t,{A:()=>h});var r=s(88029),n=s(45350),a=s(3535),i=s(30732),o=s(27723),l=s(52619),c=s(80827),d=s(71149),u=s(86087),p=s(10790);const h=({onClickGetStarted:e,onClickLearnMore:t,heading:s,subheading:h})=>{const[g,m]=(0,u.useState)(!1),_=[{id:1,text:(0,o.__)("Meta Titles & Descriptions","surerank")},{id:2,text:(0,o.__)("Social Titles & Descriptions","surerank")},{id:3,text:(0,o.__)("Site level SEO Checks","surerank")},{id:4,text:(0,o.__)("Schema Markup","surerank")}],f=(0,l.applyFilters)("surerank.ai_auth_button_config",{buttonText:(0,o.__)("Let's Get Started","surerank"),onClick:null});return(0,p.jsx)("div",{className:"flex flex-col items-center self-stretch gap-3 px-5 py-8",children:(0,p.jsxs)(n.mc,{className:"flex flex-col justify-center items-center gap-8 mx-auto max-w-[24.75rem]",children:[(0,p.jsx)(d.V_,{width:28,height:31}),(0,p.jsxs)("div",{className:"flex flex-col items-center self-stretch gap-3",children:[(0,p.jsx)(i.E,{size:18,weight:600,color:"primary",className:"text-center",children:s||(0,o.__)("Let SureRank AI optimize your SEO","surerank")}),(0,p.jsx)(i.E,{size:14,weight:400,color:"secondary",className:"text-center self-stretch",children:h||(0,o.__)("Our AI-powered assistant helps you fix SEO issues smartly and quickly. No need to dig through settings or guess what's wrong - we'll do the heavy lifting for you.","surerank")})]}),(0,p.jsx)("div",{className:"grid grid-cols-2 self-stretch gap-6 py-2",children:_.map(e=>(0,p.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,p.jsx)(c.A,{width:16,height:16,className:"text-icon-interactive"}),(0,p.jsx)(i.E,{size:14,weight:500,color:"primary",className:"text-center",children:e.text})]},e.id))}),(0,p.jsxs)("div",{className:"flex flex-col w-full gap-2 p-2",children:[(0,p.jsx)(r.A,{variant:"primary",onClick:async()=>{f.onClick?f.onClick():g||"function"!==typeof e||(m(!0),await e(),m(!1))},className:`[&>span]:flex [&>span]:items-center [&>span]:justify-center [&>span]:gap-2 ${f.className||""}`,icon:g&&(0,p.jsx)(a.a,{size:"sm",variant:"secondary"}),disabled:f.disabled||g,children:f.buttonText}),f.notice&&(0,p.jsx)(i.E,{size:13,weight:400,color:"secondary",className:"text-center",children:f.notice}),(0,p.jsx)(r.A,{variant:"ghost",className:"w-fit mx-auto hover:bg-transparent focus:[box-shadow:none] text-text-tertiary hover:text-text-secondary font-normal",onClick:()=>{"function"===typeof t&&t()},children:(0,o.__)("Learn more","surerank")})]})]})})}},19640(e,t,s){s.d(t,{A:()=>S});var r=s(30732),n=s(88029),a=s(3535),i=s(29767),o=s(27723),l=s(15977),c=s(86087),d=s(45350),u=s(9607),p=s(10790);const h=({message:e="",title:t="",icon:s=null,className:n})=>t&&s&&e?(0,p.jsx)("div",{className:(0,u.cn)("p-2 rounded-lg bg-background-secondary",n),children:(0,p.jsxs)("div",{className:"flex flex-col items-center text-center gap-2 p-4 bg-background-primary shadow-sm rounded-md",children:[s,(0,p.jsxs)("div",{className:"space-y-1",children:[t&&(0,p.jsx)(r.E,{as:"h5",size:18,weight:600,color:"primary",children:t}),(0,p.jsx)(r.E,{size:14,weight:400,color:"secondary",children:e||(0,o.__)("No data available","surerank")})]})]})}):(0,p.jsx)(d.mc,{align:"center",justify:"center",className:(0,u.cn)("p-8 bg-background-primary border border-solid border-border-subtle rounded-lg",n),children:(0,p.jsx)(r.E,{size:14,weight:400,color:"secondary",children:e||(0,o.__)("No data available","surerank")})});var g=s(76016);const m=(0,o.__)("Save","surerank"),_=(0,o.__)("Edit","surerank"),f=(0,o.__)("Use This","surerank"),k=(0,o.__)("Fixing\u2026","surerank"),x=(0,o.__)("Generate","surerank"),y=(0,o.__)("Retry","surerank"),b=(0,o.__)("Generating\u2026","surerank"),w=(0,o.__)("Regenerate","surerank"),v={home_page_title:(0,o.__)("Here are generated home page titles. Review and apply the one you like.","surerank"),home_page_description:(0,o.__)("Here are generated home page descriptions. Review and apply the one you like.","surerank"),home_page_social_title:(0,o.__)("Here are generated social titles for your home page. Review and apply the one you like.","surerank"),home_page_social_description:(0,o.__)("Here are generated social descriptions for your home page. Review and apply the one you like.","surerank"),page_title:(0,o.__)("Here are generated page titles. Review and apply the one you like.","surerank"),page_description:(0,o.__)("Here are generated page descriptions. Review and apply the one you like.","surerank"),social_title:(0,o.__)("Here are generated social titles. Review and apply the one you like.","surerank"),social_description:(0,o.__)("Here are generated social descriptions. Review and apply the one you like.","surerank"),site_tag_line:(0,o.__)("Here are generated site taglines. Review and apply the one you like.","surerank")},j=(0,o.__)("Here are the fixes generated by SureRank AI based on your request. Review and apply the ones you'd like to use.","surerank"),C=({item:e,onUseThis:t,globalFixing:s,fieldType:i})=>{const l=(0,g.oI)(i),[d,h]=(0,c.useState)(!1),[x,y]=(0,c.useState)(e.text),[b,w]=(0,c.useState)(!1),v=(0,c.useRef)(null);(0,c.useEffect)(()=>{if(v?.current){const e=v.current;e.style.height="auto";const t=Math.min(e.scrollHeight,120);e.style.height=t+"px"}},[x]);const j=x.length,C=b?m:_,S="site_tag_line"!==i,N=d?k:f;return(0,p.jsxs)("div",{className:"flex flex-col self-stretch gap-1.5 p-2 bg-white rounded-md shadow-sm",children:[(0,p.jsx)("div",{className:"flex flex-row items-start gap-2",children:(0,p.jsx)("textarea",{ref:v,value:x,onChange:e=>{y(e.target.value)},rows:1,readOnly:!b,className:(0,u.cn)("flex-1 bg-transparent border-none outline-none resize-none","text-sm font-medium text-text-secondary","py-[2px] px-[4px] rounded","overflow-y-auto","transition-[height] duration-150","min-h-[20px] leading-[1.4]",b?"cursor-text":"cursor-default"),disabled:d||s,onInput:e=>{e.target.style.height="0px",e.target.style.height=Math.min(e.target.scrollHeight,120)+"px"}})}),(0,p.jsxs)("div",{className:(0,u.cn)("flex flex-row items-center self-stretch gap-2 p-1",S?"justify-between":"justify-end"),children:[S&&(0,p.jsx)(r.E,{size:12,weight:400,color:"tertiary",className:"whitespace-nowrap",children:(0,o.sprintf)((0,o.__)("%1$d/%2$d","surerank"),j,l)}),(0,p.jsxs)("div",{className:"flex flex-row items-center gap-2",children:[(0,p.jsx)(n.A,{variant:"link",size:"xs",tag:"button",onClick:()=>{b?(w(!1),v?.current&&(v.current.blur(),v.current.scrollTop=0)):(w(!0),setTimeout(()=>{if(v?.current){v.current.focus();const e=v.current.value.length;v.current.setSelectionRange(e,e)}},0))},disabled:d||s,children:C}),(0,p.jsx)(n.A,{variant:"link",size:"xs",tag:"button",onClick:()=>(async e=>{if(!d&&!s){h(!0);try{"function"===typeof t&&await t(e)}catch(r){}finally{h(!1)}}})(x),disabled:d||s,icon:d&&(0,p.jsx)(a.a,{size:"sm"}),children:N})]})]})]})},S=({onUseThis:e,onRegenerate:t,contents:s=[],generating:a=!1,fixing:c=!1,error:d=null,fieldType:g=null,headerText:m=null})=>{const _=m||v[g]||j,f=s&&s?.length>0,k=null!==d,S=()=>f?w:a?b:!f&&k?y:x;let N;return N=a?Array.from({length:5}).map((e,t)=>(0,p.jsxs)("div",{className:"flex flex-row self-stretch gap-1 p-2 bg-white rounded-md shadow-sm",children:[(0,p.jsx)("div",{className:"flex flex-row items-center gap-1 p-1 flex-1",children:(0,p.jsx)("div",{className:"flex flex-row justify-stretch items-stretch gap-2 flex-1",children:(0,p.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,p.jsx)(i.A,{variant:"rectangular",className:"w-full h-4"}),(0,p.jsx)(i.A,{variant:"rectangular",className:"w-3/4 h-4"})]})})}),(0,p.jsx)("div",{className:"flex flex-row items-center gap-2",children:(0,p.jsx)(i.A,{variant:"rectangular",className:"w-16 h-8 rounded"})})]},t)):f?s.map(t=>(0,p.jsx)(C,{item:t,onUseThis:e,globalFixing:c,fieldType:g},t.id)):(0,p.jsx)("div",{className:"flex flex-col self-stretch gap-2",children:(0,p.jsx)(h,{message:f?(0,o.__)('No content generated yet. Click "Generate" to create AI-powered content suggestions.',"surerank"):(0,o.sprintf)((0,o.__)("No content generated. Click %s to retry creating AI-powered content suggestions.","surerank"),`"${S()}"`),className:"m-2 text-center"})}),(0,p.jsxs)("div",{className:"flex flex-col self-stretch gap-3",children:[(0,p.jsx)(r.E,{size:14,weight:400,color:"primary",className:"self-stretch",children:_}),(0,p.jsxs)("div",{className:"flex flex-col items-end self-stretch gap-2 p-2 bg-background-secondary rounded-lg",children:[N,(0,p.jsx)("div",{className:"flex flex-row items-center gap-2 p-1",children:(0,p.jsx)(n.A,{variant:"ghost",size:"xs",onClick:()=>{a||"function"===typeof t&&t()},disabled:a,icon:(0,p.jsx)(l.A,{className:(0,u.cn)("w-4 h-4",a&&"animate-spin")}),iconPosition:"left",className:"px-1",children:S()})})]})]})}},26438(e,t,s){s.d(t,{A:()=>d});var r=s(27723),n=s(88029),a=s(30732),i=s(71149),o=s(72956),l=s(9607),c=s(10790);const d=({onClickUpgrade:e,title:t=(0,r.__)("Free Plan Limit Reached","surerank"),description:s=(0,r.__)("You've used all available AI requests in your Free Plan. Upgrade to SureRank Pro to keep using AI features.","surerank"),buttonText:d=(0,r.__)("Upgrade Now","surerank"),showButton:u=!0,className:p=""})=>(0,c.jsx)("div",{className:(0,l.cn)("bg-background-secondary rounded-lg p-2",p),children:(0,c.jsxs)("div",{className:"bg-background-primary rounded-md p-4 flex flex-col items-center gap-3",children:[(0,c.jsx)(i.BZ,{className:"text-text-primary"}),(0,c.jsxs)("div",{className:"text-center",children:[(0,c.jsx)(a.E,{as:"h3",size:16,weight:600,color:"primary",children:t}),(0,c.jsx)(a.E,{color:"secondary",className:"mt-1",children:s})]}),u&&(0,c.jsx)(n.A,{variant:"primary",size:"md",onClick:()=>{"function"===typeof e?e():(0,o.n$)("ai_credits_exhausted")},children:d})]})})},71149(e,t,s){s.d(t,{B0:()=>l,BZ:()=>d,CX:()=>i,V_:()=>a,Wn:()=>u,Zy:()=>c,bk:()=>o,jf:()=>p,uw:()=>n});var r=s(10790);const n=e=>(0,r.jsxs)("svg",{width:"538",height:"84",viewBox:"0 0 538 84",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,r.jsx)("path",{d:"M74.7021 31.1187C74.7021 13.9953 60.8924 0.118378 43.8521 0.118378H0.670166V83.7997H7.9266C20.5234 83.7997 30.9189 74.347 32.4782 62.1087H32.4986L32.5496 49.1228H31.459C22.735 49.1228 15.6417 42.1383 15.3971 33.4332H15.3869V29.2957H19.5145C25.2829 29.2957 30.3889 32.1633 33.5076 36.5465C36.4835 25.9468 46.1859 18.1737 57.6821 18.1737V22.3112V27.8722C57.6821 39.5575 48.9275 49.0409 37.3192 49.1126V62.1087C38.8276 74.3777 49.2434 83.8816 61.8708 83.8816H74.7225V59.0056H57.3356C67.6291 53.9772 74.7225 43.3774 74.7225 31.1084L74.7021 31.1187Z",fill:"#4338CA"}),(0,r.jsx)("path",{d:"M219.188 21.9015V12.4591H210.261V71.5512H219.188V29.7259C220.513 27.2987 222.786 25.1275 226.017 23.2124C229.248 21.2563 232.234 20.2834 234.996 20.2834C235.892 20.2834 237.034 20.3654 238.44 20.519V11.0765C234.71 11.0765 231.194 12.0699 227.882 14.067C224.58 16.0231 221.685 18.6243 219.188 21.8913V21.9015Z",fill:"#1B1933"}),(0,r.jsx)("path",{d:"M284.874 15.2037C280.634 12.3772 275.681 10.9639 270.004 10.9639C264.327 10.9639 259.721 12.3567 255.369 15.1423C251.017 17.887 247.613 21.6353 245.167 26.377C242.752 31.0777 241.549 36.2598 241.549 41.913C241.549 51.1096 244.311 58.6062 249.835 64.3823C255.359 70.1583 262.432 73.0464 271.064 73.0464C280.237 73.0464 287.88 69.974 293.985 63.8497L289.725 57.8791C287.391 60.3063 284.65 62.1804 281.5 63.4913C278.392 64.8022 275.141 65.4678 271.757 65.4678C265.764 65.4678 260.903 63.5118 257.173 59.6098C253.484 55.7079 251.455 50.8433 251.109 45.0365H297.715V42.7015C297.715 36.7309 296.625 31.3645 294.454 26.633C292.314 21.8503 289.124 18.0508 284.884 15.2242L284.874 15.2037ZM250.976 38.1544C251.089 35.8399 251.578 33.5766 252.434 31.344C253.29 29.0704 254.452 26.9812 255.93 25.0661C257.448 23.11 259.415 21.5431 261.82 20.3449C264.226 19.1466 266.916 18.5526 269.872 18.5526C273.021 18.5526 275.844 19.1671 278.331 20.4063C280.817 21.6045 282.805 23.1714 284.283 25.1275C285.76 27.0836 286.871 29.1728 287.605 31.4054C288.38 33.638 288.798 35.8911 288.828 38.1544H250.976Z",fill:"#1B1933"}),(0,r.jsx)("path",{d:"M132.336 41.913C130.277 40.6738 127.963 39.6394 125.395 38.8098C122.868 37.9701 120.32 37.2737 117.751 36.7206C115.224 36.1266 112.91 35.5019 110.811 34.867C108.752 34.191 107.06 33.2693 105.735 32.1223C104.41 30.9241 103.748 29.4698 103.748 27.7595C103.748 25.0866 104.91 22.8847 107.244 21.1232C109.578 19.331 112.666 18.4297 116.518 18.4297C120.371 18.4297 123.499 19.1262 126.496 20.519C129.523 21.8708 131.938 23.663 133.732 25.8956L137.87 19.5665C132.427 13.8314 125.313 10.9639 116.518 10.9639C109.863 10.9639 104.635 12.5922 100.823 15.8592C97.0114 19.0852 95.1055 23.1305 95.1055 27.9848C95.1055 30.9343 95.768 33.4844 97.0929 35.6351C98.4178 37.7448 100.13 39.3834 102.229 40.5304C104.329 41.6876 106.642 42.6606 109.17 43.4594C111.738 44.2582 114.286 44.9546 116.814 45.5486C119.341 46.1426 121.655 46.8083 123.754 47.5149C125.854 48.2318 127.566 49.2457 128.891 50.5668C130.216 51.8777 130.878 53.4958 130.878 55.4109C130.878 58.4423 129.655 60.89 127.199 62.7641C124.794 64.6383 121.43 65.5703 117.109 65.5703C113.338 65.5703 109.741 64.7509 106.316 63.1226C102.892 61.4942 100.15 59.4767 98.0917 57.0905L93.5972 63.7268C99.4268 69.9433 107.183 73.0464 116.865 73.0464C124.019 73.0464 129.563 71.377 133.487 68.0282C137.452 64.6383 139.439 60.3575 139.439 55.1856C139.439 52.0825 138.777 49.3891 137.452 47.1155C136.127 44.8419 134.415 43.1112 132.315 41.913H132.336Z",fill:"#1B1933"}),(0,r.jsx)("path",{d:"M188.155 55.8923C186.402 58.4014 183.976 60.5111 180.868 62.2214C177.76 63.9317 174.529 64.7919 171.186 64.7919C166.946 64.7919 163.716 63.7985 161.504 61.8015C159.292 59.7737 158.182 56.2815 158.182 51.3452V12.4591H149.254V54.1615C149.254 66.748 155.379 73.0464 167.629 73.0464C171.675 73.0464 175.507 72.1144 179.125 70.2403C182.743 68.3661 185.76 66.0414 188.165 63.2455V71.5512H197.144V12.4591H188.165V55.8923H188.155Z",fill:"#1B1933"}),(0,r.jsx)("path",{d:"M340.917 48.6312C344.332 46.9209 347.002 44.5552 348.948 41.534C350.946 38.4617 351.955 34.9694 351.955 31.0675C351.955 27.1656 351.017 23.6426 349.132 20.6931C347.246 17.6821 344.627 15.3164 341.274 13.5959C337.921 11.8856 334.069 11.0253 329.717 11.0253H306.775V73.1078H318.863V51.1096H328.127L340.744 73.1078H354.421L340.122 48.9897C340.387 48.877 340.652 48.7644 340.917 48.6312ZM338.094 35.6863C337.269 37.0484 336.127 38.1135 334.649 38.8815C333.233 39.6496 331.623 40.0388 329.798 40.0388H318.852V22.1269H329.177C332.183 22.1269 334.619 22.9564 336.504 24.6052C338.451 26.2643 339.419 28.415 339.419 31.0777C339.419 32.788 338.981 34.3344 338.094 35.6863Z",fill:"#1B1933"}),(0,r.jsx)("path",{d:"M394.607 11.0356H382.52L358.162 73.1181H370.962L376.17 59.4562H401.772L406.98 73.1181H419.78L395.422 11.0356H394.627H394.607ZM380.247 48.7234L388.961 25.8547L397.675 48.7234H380.247Z",fill:"#1B1933"}),(0,r.jsx)("path",{d:"M467.701 52.7175L437.524 11.0356H424.906V73.1078H436.994V30.6271L467.701 73.1078H479.707V11.0356H467.701V52.7175Z",fill:"#1B1933"}),(0,r.jsx)("path",{d:"M510.302 39.0352L536.362 11.0356H520.738L497.878 35.6146V11.0356H485.964V73.1078H497.878V52.3898L502.434 47.4944L522.409 73.1078H537.33L510.302 39.0352Z",fill:"#1B1933"})]}),a=({enableFill:e=!0,...t})=>(0,r.jsxs)("svg",{width:"128",height:"128",viewBox:"0 0 128 128",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t,children:[e&&(0,r.jsx)("rect",{width:"128",height:"128",fill:"white"}),(0,r.jsx)("path",{d:"M73.4731 0C99.6321 6.3594e-05 120.838 21.2062 120.838 47.3652C120.838 66.1146 109.944 82.3181 94.1401 89.9941H120.838V128H101.114C81.7276 128 65.7331 113.485 63.4018 94.7305H63.4008L63.4125 74.8838C81.2408 74.7673 94.685 60.2785 94.685 42.4229V33.9307H94.6879V27.6074C77.0272 27.6075 62.1389 39.4779 57.5649 55.6748C52.7868 48.9672 44.9453 44.5928 36.0825 44.5928H29.7495V50.915H29.7719C30.1453 64.2164 41.0453 74.8848 54.437 74.8848H56.1166L56.0356 94.7305H56.0073C53.6177 113.422 37.6508 127.868 18.31 127.868H7.16156V0H73.4731Z",fill:"#4338CA"})]}),i=e=>(0,r.jsx)("svg",{width:"128",height:"128",viewBox:"0 0 128 128",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,r.jsx)("path",{d:"M73.4731 0C99.6321 6.3594e-05 120.838 21.2062 120.838 47.3652C120.838 66.1146 109.944 82.3181 94.1401 89.9941H120.838V128H101.114C81.7276 128 65.7331 113.485 63.4018 94.7305H63.4008L63.4125 74.8838C81.2408 74.7673 94.685 60.2785 94.685 42.4229V33.9307H94.6879V27.6074C77.0272 27.6075 62.1389 39.4779 57.5649 55.6748C52.7868 48.9672 44.9453 44.5928 36.0825 44.5928H29.7495V50.915H29.7719C30.1453 64.2164 41.0453 74.8848 54.437 74.8848H56.1166L56.0356 94.7305H56.0073C53.6177 113.422 37.6508 127.868 18.31 127.868H7.16156V0H73.4731Z",fill:"currentColor"})}),o=e=>(0,r.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,r.jsx)("path",{d:"M13.5537 1.5C17.8453 1.5 21.3251 4.97895 21.3252 9.27051C21.3252 12.347 19.5368 15.0056 16.9434 16.2646H21.3252V22.5H18.0889C14.9086 22.5 12.2861 20.1186 11.9033 17.042H11.9014L11.9033 13.7852C14.8283 13.7661 17.0342 11.3894 17.0342 8.45996V6.0293C14.137 6.02947 11.6948 7.97682 10.9443 10.6338C10.1605 9.53345 8.87383 8.8165 7.41992 8.81641H6.38086V9.85352H6.38379C6.44515 12.0356 8.23375 13.786 10.4307 13.7861H10.7061L10.6934 17.042H10.6865C10.2943 20.1082 7.67678 22.4785 4.50391 22.4785H2.6748V1.5H13.5537Z",fill:"currentColor"})}),l=e=>(0,r.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,r.jsx)("path",{d:"M12.2149 1.26929H14.4639L9.55054 6.88495L15.3307 14.5266H10.8049L7.26009 9.89198L3.20403 14.5266H0.953684L6.20902 8.52002L0.664062 1.26929H5.3048L8.50899 5.50551L12.2149 1.26929ZM11.4256 13.1805H12.6718L4.62766 2.54471H3.29037L11.4256 13.1805Z",fill:"#111827"})}),c=e=>(0,r.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,r.jsx)("path",{d:"M13.1667 10C13.1667 11.7489 11.7489 13.1667 10 13.1667C8.25113 13.1667 6.83337 11.7489 6.83337 10C6.83337 8.25113 8.25113 6.83337 10 6.83337C11.7489 6.83337 13.1667 8.25113 13.1667 10Z",fill:"#FFFFFF"})}),d=e=>(0,r.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,r.jsx)("path",{d:"M9.93548 15.5002C9.8462 15.1542 9.66581 14.8384 9.41309 14.5856C9.16037 14.3329 8.84455 14.1525 8.49848 14.0632L2.36348 12.4812C2.25881 12.4515 2.16668 12.3885 2.10109 12.3017C2.03549 12.2149 2 12.1091 2 12.0002C2 11.8914 2.03549 11.7856 2.10109 11.6988C2.16668 11.612 2.25881 11.549 2.36348 11.5192L8.49848 9.93625C8.84442 9.84706 9.16017 9.66682 9.41288 9.41429C9.66559 9.16175 9.84604 8.84614 9.93548 8.50025L11.5175 2.36525C11.5469 2.26017 11.6099 2.16759 11.6968 2.10164C11.7837 2.0357 11.8899 2 11.999 2C12.1081 2 12.2142 2.0357 12.3012 2.10164C12.3881 2.16759 12.4511 2.26017 12.4805 2.36525L14.0615 8.50025C14.1508 8.84632 14.3311 9.16215 14.5839 9.41487C14.8366 9.66759 15.1524 9.84797 15.4985 9.93725L21.6335 11.5182C21.739 11.5473 21.832 11.6103 21.8983 11.6973C21.9646 11.7844 22.0005 11.8908 22.0005 12.0002C22.0005 12.1097 21.9646 12.2161 21.8983 12.3032C21.832 12.3902 21.739 12.4531 21.6335 12.4822L15.4985 14.0632C15.1524 14.1525 14.8366 14.3329 14.5839 14.5856C14.3311 14.8384 14.1508 15.1542 14.0615 15.5002L12.4795 21.6353C12.4501 21.7403 12.3871 21.8329 12.3002 21.8989C12.2132 21.9648 12.1071 22.0005 11.998 22.0005C11.8889 22.0005 11.7827 21.9648 11.6958 21.8989C11.6089 21.8329 11.5459 21.7403 11.5165 21.6353L9.93548 15.5002Z",stroke:"#111827",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M20 3V7",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M22 5H18",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M4 17V19",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"}),(0,r.jsx)("path",{d:"M5 18H3",stroke:"currentColor",strokeWidth:"1.25",strokeLinecap:"round",strokeLinejoin:"round"})]}),u=e=>(0,r.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,r.jsx)("path",{d:"M6.64847 3.71638L7.04997 4.83138C7.49597 6.06888 8.47047 7.04338 9.70797 7.48938L10.823 7.89087C10.9235 7.92737 10.9235 8.06988 10.823 8.10588L9.70797 8.50737C8.47047 8.95337 7.49597 9.92787 7.04997 11.1654L6.64847 12.2804C6.61197 12.3809 6.46947 12.3809 6.43347 12.2804L6.03197 11.1654C5.58597 9.92787 4.61147 8.95337 3.37397 8.50737L2.25897 8.10588C2.15847 8.06938 2.15847 7.92687 2.25897 7.89087L3.37397 7.48938C4.61147 7.04338 5.58597 6.06888 6.03197 4.83138L6.43347 3.71638C6.46947 3.61537 6.61197 3.61537 6.64847 3.71638Z",fill:"currentColor"}),(0,r.jsx)("path",{d:"M11.6675 1.03863L11.871 1.60313C12.097 2.22963 12.5905 2.72312 13.217 2.94912L13.7815 3.15262C13.8325 3.17112 13.8325 3.24312 13.7815 3.26162L13.217 3.46512C12.5905 3.69112 12.097 4.18462 11.871 4.81112L11.6675 5.37563C11.649 5.42663 11.577 5.42663 11.5585 5.37563L11.355 4.81112C11.129 4.18462 10.6355 3.69112 10.009 3.46512L9.4445 3.26162C9.3935 3.24312 9.3935 3.17112 9.4445 3.15262L10.009 2.94912C10.6355 2.72312 11.129 2.22963 11.355 1.60313L11.5585 1.03863C11.577 0.987125 11.6495 0.987125 11.6675 1.03863Z",fill:"currentColor"}),(0,r.jsx)("path",{d:"M11.6675 10.6242L11.871 11.1887C12.097 11.8152 12.5905 12.3087 13.217 12.5347L13.7815 12.7382C13.8325 12.7567 13.8325 12.8287 13.7815 12.8472L13.217 13.0507C12.5905 13.2767 12.097 13.7702 11.871 14.3967L11.6675 14.9612C11.649 15.0122 11.577 15.0122 11.5585 14.9612L11.355 14.3967C11.129 13.7702 10.6355 13.2767 10.009 13.0507L9.4445 12.8472C9.3935 12.8287 9.3935 12.7567 9.4445 12.7382L10.009 12.5347C10.6355 12.3087 11.129 11.8152 11.355 11.1887L11.5585 10.6242C11.577 10.5732 11.6495 10.5732 11.6675 10.6242Z",fill:"currentColor"})]}),p=e=>(0,r.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:(0,r.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M0.91255 5.99999C0.91255 3.44174 2.9291 0.902258 6.06843 0.902258C8.60378 0.902258 9.85689 2.75767 10.3909 3.74438H8.80609C8.55414 3.74438 8.34982 3.94635 8.34982 4.1955C8.34982 4.44465 8.55414 4.64663 8.80609 4.64663H11.5437C11.7957 4.64663 12 4.44465 12 4.1955V1.48874C12 1.23959 11.7957 1.03761 11.5437 1.03761C11.2918 1.03761 11.0875 1.23959 11.0875 1.48874V3.12469C10.4446 2.00416 8.95748 0 6.06843 0C2.36092 0 0 3.00937 0 5.99999C0 8.99062 2.36092 12 6.06843 12C7.84228 12 9.31912 11.306 10.3707 10.2482C10.9337 9.68175 11.3734 9.01264 11.6731 8.29237C11.769 8.06199 11.6579 7.79834 11.4249 7.70352C11.1918 7.60869 10.9252 7.71861 10.8293 7.94901C10.5731 8.56467 10.1978 9.13489 9.71982 9.6157C8.83301 10.5079 7.58788 11.0977 6.06843 11.0977C2.9291 11.0977 0.91255 8.55826 0.91255 5.99999Z",fill:"currentColor"})})},22861(e,t,s){s.d(t,{A:()=>c});var r=s(88029),n=s(27723),a=s(33167),i=s(9607),o=s(72956),l=s(10790);const c=({label:e=(0,n.__)("Upgrade Now","surerank"),variant:t="primary",size:s="md",icon:c,iconPosition:d="right",showIcon:u,onClick:p,className:h="",showUnderline:g=!1,utmMedium:m,..._})=>{let f;f=void 0!==c?c:(void 0!==u?u:"link"===t)?(0,l.jsx)(a.A,{className:"w-5 h-5"}):void 0;const{showUnderLine:k,...x}=_;return(0,l.jsx)(r.A,{size:s,variant:t,onClick:()=>{p&&"function"===typeof p?p():(0,o.n$)(m)},className:(0,i.cn)("no-underline ring-0",{"underline ring-0":g},h),icon:f,iconPosition:d,...x,children:e})}},61456(e,t,s){s.d(t,{A:()=>o});var r=s(3213),n=s(9607),a=s(71149),i=s(10790);const o=({deviceType:e="desktop",faviconURL:t="",title:s="",description:o="",permalink:l="",siteTitle:c=""})=>{const d=(0,n.jT)(s),u=(0,n.jT)(o);return(0,i.jsx)("div",{className:"p-2 rounded-lg bg-background-secondary",children:(0,i.jsxs)("div",{className:"rounded-md border border-solid border-border-subtle bg-background-primary p-4 space-y-1.5 shadow-sm",children:[(0,i.jsxs)("div",{className:"grid grid-cols-[1.75rem_1fr] items-center gap-3",children:[t?(0,i.jsx)("div",{className:"relative w-7 h-7",children:(0,i.jsx)("img",{className:"w-full h-full object-cover m-0",src:t,alt:"favicon"})}):(0,i.jsx)(a.V_,{className:"size-7"}),(0,i.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,i.jsx)("span",{className:"text-text-primary font-semibold",children:c}),(0,i.jsxs)("div",{className:"flex items-center justify-start gap-2",children:[(0,i.jsx)("span",{className:"text-text-secondary line-clamp-1 break-all",children:l}),(0,i.jsx)(r.A,{className:"size-3.5 text-icon-secondary"})]})]})]}),(0,i.jsxs)("div",{className:"space-y-1",children:[(0,i.jsx)("p",{className:"text-xl leading-8 font-normal text-text-seo-title m-0 p-0 line-clamp-1 break-all",children:d}),(0,i.jsx)("p",{className:(0,n.cn)("text-sm leading-5 font-medium text-text-secondary m-0 break-words","mobile"===e&&"text-2xl leading-9.5 line-clamp-2"),children:u})]})]})})}},38502(e,t,s){s.d(t,{A:()=>k});var r=s(27723),n=s(59612),a=s(66803),i=s(56523),o=s(30732),l=s(9607),c=s(48697),d=s(88029),u=s(99019),p=s(10790);const h=({variant:e="outline",size:t="xs",strokeWidth:s=2,icon:r=(0,p.jsx)(c.A,{strokeWidth:s,className:"h-4 w-4"}),onClick:n,className:a="absolute top-2 right-2 flex items-center p-1 h-8 w-8 rounded leading-[0]",disabled:i=!1,tooltip_label:o})=>{const l=(0,p.jsx)(d.A,{variant:e,size:t,className:a,onClick:n,disabled:i,children:r});return o?(0,p.jsx)(u.m,{placement:"top",offset:10,variant:"dark",title:o,tooltipPortalId:"surerank-root",children:l}):l};var g=s(86087);const m=e=>{const t=new Date,s=t.toLocaleString("default",{month:"long"}),r=t.getDate();return"twitter"===e?`${s?.slice(0,3)} ${r}`:`${s} ${r}`},_=({className:e,...t})=>(0,p.jsx)("div",{className:(0,l.cn)("w-full h-full bg-background-secondary flex items-center justify-center",e),...t,children:(0,p.jsx)(n.A,{className:"size-6 m-auto"})}),f=({displayName:e="Name",username:t="@username",timeLabel:s="28m",postText:n="Sample Post Title",title:c=(0,r.__)("Modern WordPress SEO Plugin Without the Bloat - SureRank","surerank"),description:d="",imageURL:u="",siteURL:m="surerank.com",onClickRemove:f,hideRemoveButton:k=!0,forMetaBox:x=!1,cardType:y="summary_large_image"})=>{const b=(0,l.jT)(c),w=(0,l.jT)(d),v={id:"x-preview-large",className:"[#x-preview-large&_*]:font-twitter"},j=(0,p.jsx)(i.A,{className:"flex-shrink-0",size:x?"sm":"md",variant:"primary",src:"https://www.gravatar.com/avatar/?d=mp",children:"User"}),C=(0,p.jsxs)("div",{className:"inline-flex items-center gap-1",children:[(0,p.jsx)(o.E,{as:"p",className:"m-0 p-0",size:16,weight:500,color:"secondary",children:e}),(0,p.jsx)(a.A,{className:"size-5 text-white fill-[#1d9bf0]","aria-label":(0,r.__)("Verified account","surerank")}),(0,p.jsxs)(o.E,{as:"p",className:"m-0 p-0",size:16,weight:400,color:"secondary",children:[t," \xb7 ",s]})]});if("summary_large_image"===y){const e=(0,r.sprintf)((0,r.__)("Check out my page: %s","surerank"),(0,g.renderToString)((0,p.jsx)(o.E,{className:"inline text-[#1d9bf0] m-0 hover:underline",as:"p",children:m.startsWith("http")?m:`https://${m}`})));return(0,p.jsx)("div",{...v,children:(0,p.jsxs)("div",{className:"p-3 flex items-start gap-3",children:[j,(0,p.jsxs)("div",{className:"flex-1",children:[C,(0,p.jsx)(o.E,n?{as:"p",className:"mt-0.5 mb-0 p-0 line-clamp-2",size:14,color:"secondary",children:n}:{as:"p",color:"secondary",size:14,className:"mt-0.5 mb-0 p-0 line-clamp-2",dangerouslySetInnerHTML:{__html:e}}),(0,p.jsxs)("div",{className:"relative mt-3 rounded-2xl border border-solid border-border-subtle overflow-hidden",children:[u?(0,p.jsxs)("div",{className:(0,l.cn)("relative w-full h-[16.8125rem]",x&&"h-52"),children:[(0,p.jsx)("img",{src:u,alt:"Shared link preview",className:"w-full h-full object-cover"}),!k&&(0,p.jsx)(h,{onClick:f})]}):(0,p.jsx)("div",{className:"h-[16.8125rem]",children:(0,p.jsx)(_,{})}),(0,p.jsx)("div",{className:"inline-block w-fit px-2 rounded absolute bottom-3 left-3 right-3 text-xs text-white bg-black/[0.77]",children:(0,p.jsx)(o.E,{as:"p",className:"m-0 p-0 line-clamp-1 text-inherit",children:b})})]}),(0,p.jsxs)(o.E,{as:"p",color:"secondary",size:14,weight:400,className:"mt-2 mb-1 p-0",children:[(0,r.__)("From","surerank")," ",(0,p.jsx)("span",{className:"hover:underline",children:m})]})]})]})})}return(0,p.jsx)("div",{id:v.id,className:(0,l.cn)("p-3",v.className),children:(0,p.jsxs)("div",{className:"flex gap-3 justify-start items-start",children:[j,(0,p.jsxs)("div",{className:"space-y-4",children:[C,(0,p.jsxs)("div",{className:"grid overflow-hidden min-h-[7.75rem] grid-cols-[7.5rem_1fr] rounded-2xl border border-solid border-border-subtle",children:[u?(0,p.jsxs)("div",{className:"relative w-full h-full inline-flex",children:[(0,p.jsx)("img",{className:"w-full h-full object-cover m-0 max-h-[7.625rem] border-y-0 border-l-0 border-r border-solid border-border-subtle",src:u,alt:"thumbnail"}),!k&&(0,p.jsx)(h,{onClick:f})]}):(0,p.jsx)(_,{className:"border-y-0 border-l-0 border-r border-solid border-border-subtle"}),(0,p.jsxs)("div",{className:"inline-grid items-center justify-start gap-0.5 px-3 py-5",children:[(0,p.jsx)("p",{className:"m-0 p-0 font-normal text-text-secondary leading-4 text-xs",children:m}),(0,p.jsx)("div",{className:"w-full overflow-hidden",children:(0,p.jsx)("p",{className:"m-0 p-0 text-[0.9375rem] font-semibold text-text-primary whitespace-nowrap leading-5",children:b})}),(0,p.jsx)("p",{className:"m-0 p-0 font-normal text-text-secondary line-clamp-3 leading-5 text-sm",children:w||""})]})]})]})]})})},k=({displayName:e="Name",username:t="@username",type:s="facebook",title:n=(0,r.__)("Sample Post - Testing Site","surerank"),description:a="",imageURL:i="",siteURL:o="surerank.com",twitterLargePreview:c=!1,onClickRemove:d,hideRemoveButton:u=!0,forMetaBox:g=!1})=>{let k=null;const x=(0,l.jT)(a),y=(0,l.jT)(n),b=x||"";switch(s){case"twitter":k=(0,p.jsx)(f,{displayName:e,username:t,timeLabel:m("twitter"),title:y,description:x,imageURL:i,siteURL:o,onClickRemove:d,hideRemoveButton:u,forMetaBox:g,cardType:c?"summary_large_image":"summary"});break;case"facebook":k=(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("div",{className:"w-full h-[16.8125rem] overflow-clip",children:i?(0,p.jsxs)("div",{className:"relative w-full h-full",children:[(0,p.jsx)("img",{src:i,alt:"Social Post",className:"w-full h-full object-cover"}),!u&&(0,p.jsx)(h,{onClick:d})]}):(0,p.jsx)(_,{})}),(0,p.jsxs)("div",{className:"p-3 w-full",children:[(0,p.jsx)("p",{className:"m-0 p-0 text-xs leading-4 font-normal text-text-secondary",children:o}),(0,p.jsx)("p",{className:"mt-1.5 mb-1 p-0 text-base leading-6 font-semibold text-text-primary line-clamp-2",children:y}),(0,p.jsx)("p",{className:"m-0 p-0 text-sm leading-5 font-normal line-clamp-2",children:b})]})]});break;default:k=null}return(0,p.jsx)("div",{className:"p-2 rounded-lg bg-background-secondary",children:(0,p.jsx)("div",{className:"flex flex-col rounded-md border border-solid border-border-subtle shadow-sm overflow-hidden bg-background-primary",children:k})})}},22157(e,t,s){s.d(t,{A:()=>i});var r=s(27723),n=s(10960),a=s(10790);const i=({className:e="",...t})=>(0,a.jsx)(n.A,{color:"info",title:(0,r.__)("SureRank Schema Disabled","surerank"),message:(0,r.__)("We detected that WP Schema Pro is active on your website. To avoid schema conflicts, SureRank Schema functionality has been automatically disabled. Please continue using WP Schema Pro for your schema markup needs.","surerank"),className:e,...t})},62220(e,t,s){s.d(t,{CS:()=>u,DN:()=>p,EJ:()=>l,Li:()=>o,MF:()=>c,W9:()=>r,bi:()=>d,qh:()=>i,uX:()=>a,wX:()=>n});const r="/surerank/v1/admin/global-settings",n="/surerank/v1/admin/site-settings",a="/surerank/v1/admin/editor",i="/surerank/v1/onboarding",o="/surerank/v1/admin/post-content",l="/surerank/v1/term/settings",c="/surerank/v1/post/settings",d="/surerank/v1/user/settings",u="/surerank/v1/admin/posts",p="/surerank/v1/robots-txt"},68402(e,t,s){s.d(t,{EF:()=>c,X2:()=>g,BB:()=>d,IG:()=>l,iM:()=>i,J9:()=>p,M6:()=>h,ZD:()=>m});var r=s(52619);const n={page_title:"content_generation",page_description:"content_generation",title:"content_generation",meta_description:"content_generation",url_length:"content_generation",site_tag_line:"content_generation",other_seo_plugins:"other_seo_plugins",indexing:"indexing",sitemaps:"sitemaps",index_status:"index_status"};var a=s(47143);const i={page_title:"page_title",page_description:"page_description",title:"home_page_title",meta_description:"home_page_description",site_tag_line:"site_tag_line",url_length:"page_url_slug"},o=(0,r.applyFilters)("surerank-pro.page-seo-checks-content-generation-mapping",{search_engine_title:"page_title",search_engine_description:"page_description",url_length:"page_url_slug"}),l=(0,r.applyFilters)("surerank-pro.pro-page-seo-checks-content-generation",["url_length","search_engine_title","search_engine_description"]),c=Object.freeze({...i,...o,facebook_title:"social_title",facebook_description:"social_description",twitter_title:"social_title",twitter_description:"social_description"}),d={search_engine_title:"page_title",search_engine_description:"page_description"},u=Object.freeze(Array.from(new Set([...Object.keys(i),...Object.keys(o)]))),p=e=>{const t=(0,r.applyFilters)("surerank-pro.help-me-fix-redirect",null);"function"===typeof t&&t(e)},h=e=>u.includes(e??"")||Object.keys(n).includes(e??""),g=(0,r.applyFilters)("surerank-pro.help-me-fix-active",!1),m=e=>{const t=(0,a.select)(e).getPageSeoChecks();return t?.hideFixHelpButtons||!1}},76016(e,t,s){s.d(t,{$K:()=>i,HH:()=>f,Jj:()=>p,KT:()=>h,Op:()=>n,Rw:()=>g,Tv:()=>_,UM:()=>l,X:()=>d,dc:()=>m,de:()=>o,oI:()=>k,qt:()=>c,vr:()=>a,x8:()=>u});var r=s(27723);s(10790);const n=window?.surerank_globals?.input_variable_suggestions??null,a=[{id:"post_no_index",value:"no",label:(0,r.__)("No index","surerank"),description:(0,r.__)("Prevents search engines from listing your page in search results.","surerank")},{id:"post_no_follow",value:"no",label:(0,r.__)("No follow","surerank"),description:(0,r.__)("Tells search engines not to follow any links on your page.","surerank")},{id:"post_no_archive",value:"no",label:(0,r.__)("No archive","surerank"),description:(0,r.__)("Blocks search engines from storing a cached version of your page.","surerank")}],i=()=>(0,r.__)("This content will be set as the meta description tag and may appear in search results. Keep it short and clearly explain what the page is about.","surerank"),o=window?.surerank_globals?.wp_dashboard_url??"",l=window?.surerank_globals?.description_length??160,c=window?.surerank_globals?.title_length??60,d=window?.surerank_globals?.url_length??90,u=500,p=window?.surerank_globals?.enable_page_level_seo??!1,h=window?.surerank_globals?.enable_google_console??!1,g=window?.surerank_globals?.enable_schemas??!1,m=window?.surerank_globals?.enable_migration??!1,_=["page","keyword"],f="https://surerank.com/surerank-ai/?utm_source=surerank_plugin&utm_medium=wordpress_plugin&utm_campaign=core_plugin&utm_content=surerank_ai_learn_more",k=e=>e?e.includes("title")?c:e.includes("url")||e.includes("slug")?d:(e.includes("description"),l):l},66924(e,t,s){s.d(t,{N:()=>r});const r={IDLE:"idle",START:"start",IN_PROGRESS:"inProgress",COMPLETED:"completed",FAILED:"failed"}},98315(e,t,s){s.d(t,{A:()=>o});var r=s(27723),n=s(86087),a=s(64894),i=s(60443);const o=(e,t=null,s={})=>{const{pollingInterval:o=2e3,maxPollingTime:l=3e5}=s,c=(0,n.useRef)(null),d=(0,n.useRef)(null),u=(0,n.useRef)(null),p=(0,n.useRef)(!1),h=(0,n.useRef)(null);(0,n.useEffect)(()=>()=>{c.current&&clearInterval(c.current),h.current&&clearInterval(h.current)},[]);const g=async()=>{try{if(Date.now()-u.current>l)return _(),i.o.error((0,r.__)("Authentication timeout. Please try again.","surerank")),void(t&&t());const s=await(0,a.xI)();if(!s?.success)return;s?.auth_url||(_(),d.current&&!d.current.closed&&d.current.close(),e&&e(),i.o.success((0,r.__)("Authentication successful!","surerank")))}catch(s){i.o.error((0,r.__)("An error occurred during authentication","surerank"),{description:s?.message||"",autoDismiss:!1})}},m=(e=null)=>{_(),p.current=!1,e&&(d.current=e),u.current=Date.now(),c.current=setInterval(g,o),d.current&&(h.current=setInterval(()=>{d.current?.closed&&(p.current=!0,_(),i.o.error((0,r.__)("Authentication cancelled. Please try again.","surerank")),t&&t())},1e3))},_=()=>{c.current&&(clearInterval(c.current),c.current=null),h.current&&(clearInterval(h.current),h.current=null),u.current=null,p.current=!1};return{startPolling:m,stopPolling:_,openAuthPopup:e=>{const t=window.open(e,"surerank_auth","fullscreen=yes,scrollbars=yes,resizable=yes");return!t||t.closed?(i.o.error((0,r.__)("Popup blocked. Redirecting to authentication\u2026","surerank")),window.location.href=e,null):(m(t),t)},isPolling:null!==c.current}}},60249(e,t,s){s.d(t,{aq:()=>r,sc:()=>n});const r=e=>{const t=wp.media({...e,library:{type:"image",...e.library||{}}});return e.button&&e.button.text&&((e,t)=>{const s=()=>{const s=[".media-button-select",".media-button-insert",".button-primary"];for(const r of s){const s=e.$(r);if(s.length&&s.is(":visible")){s.text(t);break}}};e.on("ready",s),e.on("selection:toggle",s),e.on("content:render",s)})(t,e.button.text),t},n=()=>({siteTitle:surerank_globals.site_details?.site_title||window?.surerank_admin_common?.website_details?.website_name||"",siteDescription:surerank_globals.site_details?.site_tagline||window?.surerank_admin_common?.website_details?.business_description||""})},1671(e,t,s){s.d(t,{E:()=>r});const r="surerank"},15345(e,t,s){s.d(t,{M:()=>Ce});var r={};s.r(r),s.d(r,{fetchFromAPI:()=>H,ignoreBrokenLinkUrl:()=>W,ignorePageSeoCheck:()=>V,ignoreSeoBarCheck:()=>Q,initMetaDataAndDefaults:()=>z,resetForNewPost:()=>te,resetUnsavedMetaSettings:()=>R,restoreBrokenLinkUrl:()=>Y,restoreIgnoreCheck:()=>U,restorePageSeoCheck:()=>q,restoreSeoBarCheck:()=>ee,setBatchPageSeoChecks:()=>Z,setCurrentPostIgnoredList:()=>B,setPageSeoCheck:()=>O,setPageSeoChecks:()=>M,setPageSeoChecksByIdAndType:()=>K,setRefreshCalled:()=>$,setUnsavedMetaSettings:()=>F,updateAppSettings:()=>D,updateGlobalDefaults:()=>I,updateInitialState:()=>L,updateMetaboxState:()=>A,updateModalState:()=>E,updatePostDynamicData:()=>T,updatePostMetaData:()=>P,updatePostSeoMeta:()=>N});var n={};s.r(n),s.d(n,{getActivePostId:()=>ge,getAppSettings:()=>ce,getCurrentPostIgnoredList:()=>pe,getGlobalDefaults:()=>le,getMetaboxState:()=>ne,getModalState:()=>ie,getPageSeoChecks:()=>he,getPostDynamicData:()=>oe,getPostSeoMeta:()=>se,getRefreshCalled:()=>ue,getSeoBarChecks:()=>me,getState:()=>ae,getUnsavedMetaSettings:()=>de,getVariables:()=>re});var a={};s.r(a),s.d(a,{fetchSeoBarChecks:()=>we,getCurrentPostIgnoredList:()=>ye,getSeoBarChecks:()=>be});var i=s(47143),o=s(52619);const l="UPDATE_GLOBAL_DEFAULTS",c="UPDATE_APP_SETTINGS",d="SET_PAGE_SEO_CHECKS",u="SET_PAGE_SEO_CHECK",p="SET_UNSAVED_META_SETTINGS",h="RESET_UNSAVED_META_SETTINGS",g="SET_REFRESH_CALLED",m="SET_CURRENT_POST_IGNORED_LIST",_="SET_PAGE_SEO_CHECKS_BY_ID_AND_TYPE",f="SET_BATCH_PAGE_SEO_CHECKS",k="RESET_FOR_NEW_POST",x={modalEnabled:!1,metaboxInitialized:!1,postSeoMeta:{page_title:"",page_description:"",post_no_index:"",post_no_follow:"",post_no_archive:"",facebook_image_url:"",facebook_title:"",facebook_description:"",facebook_image_id:"",twitter_image_url:"",twitter_title:"",twitter_description:"",twitter_image_id:"",twitter_same_as_facebook:!0,focus_keyword:"",canonical_url:""},unsavedPostSeoMeta:{},postDynamicData:{title:"",excerpt:"",content:""},research:{},globalDefaults:{},appSettings:{currentTab:"optimize",previousTab:"",currentScreen:"settings",previousScreen:"",generateContentProcess:"idle",generatedContents:{},selectedCheckId:null,selectedFieldKey:null,error:null,fixProcess:"idle",onUseThis:null},pageSeoChecks:{authenticated:window?.surerank_globals?.ai_authenticated||!1,initializing:!0,isCheckingLinks:!1,linkCheckProgress:{current:0,total:0},refreshCalled:!1,postId:null,checkType:null,isRefreshing:!1,pageChecks:[],keywordChecks:[],brokenLinkState:{isChecking:!1,checkedLinks:[],brokenLinks:[],allLinks:[]},hideFixHelpButtons:!1}};var y=s(66087),b=s(93832),w=s(27723),v=s(1671),j=s(62220),C=s(9607),S=s(76016);function N(e){return{type:"UPDATE_POST_SEO_META",value:e}}function A(e){return{type:"UPDATE_METABOX_STATE",value:e}}function E(e){return{type:"UPDATE_MODAL_STATE",value:e}}function T(e){return{type:"UPDATE_DYNAMIC_DATA",value:e}}function*P(e){return yield F(e),{type:"UPDATE_META_DATA",value:e}}function L(e){return{type:"UPDATE_INITIAL_STATE",value:e}}const I=e=>({type:l,payload:e});function*z({postSeoMeta:e,globalDefaults:t}){let s=e;return s&&!Object.keys(s).length?(s=(0,i.select)(v.E).getPostSeoMeta(),s=(0,y.pick)(t,Object.keys(s)),yield P(s)):yield N(s),I(t)}function D(e){return{type:c,value:e}}const M=e=>({type:d,payload:e}),O=(e,t)=>{let s={[e]:t};if("checks"===e){const e=(0,i.select)(v.E).getState();s={checks:t,categorizedChecks:(0,C.xZ)(t,e.pageSeoChecks?.ignoredList||[])}}else if(S.Tv.includes(e)){const r=(0,i.select)(v.E).getState(),n=r.pageSeoChecks?.ignoredList||[],a=(0,C.RL)(r,e,t)?.filter(Boolean)||[],o=(0,C.xZ)(a,n),l=(0,C.xZ)(t,n),c=(0,C.sz)(e);s={[c.type]:t,checks:a,categorizedChecks:o,[c.categorizedType]:l}}return{type:u,payload:s}},F=e=>({type:p,payload:e}),R=()=>({type:h}),$=e=>({type:g,value:e}),B=e=>({type:m,payload:e});function H(e){return{type:"FETCH_FROM_API",payload:e}}function*U(e,t){const s=(0,i.select)(v.E).getState(),r=s.pageSeoChecks?.postId||s.variables?.post?.ID?.value||s.variables?.term?.ID?.value||s.variables?.user?.ID?.value;let n="post";window?.surerank_seo_popup?.is_user?n="user":"1"===window?.surerank_seo_popup?.is_taxonomy&&(n="taxonomy");try{const s=yield H({path:"surerank/v1/checks/ignore-page-check",method:"ignore"===t?"POST":"DELETE",data:{post_id:r,id:e,check_type:n}});yield B(s?.checks);const a=(0,i.select)(v.E).getPageSeoChecks(),o=a.checks.find(t=>t.id===e)?.type,l=(0,C.sz)(o)?.type||"checks";yield O(o,a[l]);const c=(0,i.select)(v.E).getPageSeoChecks()?.checks||[];r&&c.length>0&&(yield K(r,n,c))}catch(a){}}function*V(e){yield U(e,"ignore")}function*q(e){yield U(e,"restore")}function*G(e,t){const s=(0,i.select)(v.E).getState(),r="1"===window?.surerank_seo_popup?.is_taxonomy?0:s.pageSeoChecks?.postId||s.variables?.post?.ID?.value||0,n=()=>(0,C.Ac)((0,i.select)(v.E).getPageSeoChecks()?.pageChecks?.find(e=>"broken_links"===e?.id)?.data).map(e=>e?.url).filter(Boolean);try{yield H({path:"surerank/v1/checks/broken-link-ignore",method:"ignore"===t?"POST":"DELETE",data:"ignore"===t?{url:e,post_id:r,urls:n()}:{url:e}});let s=null;"restore"===t&&r&&(s=yield H({path:"surerank/v1/checks/broken-link",method:"POST",data:{url:e,post_id:r,urls:[...new Set([...n(),e])],user_agent:window.navigator.userAgent}}));const a=((0,i.select)(v.E).getPageSeoChecks()?.pageChecks||[]).map(r=>{if("broken_links"!==r?.id)return r;const n=r?.ignoredBrokenLinks||[],a=(0,C.Ac)(r?.data);if("ignore"===t){const t=a.filter(t=>t?.url!==e);return{...r,data:t,ignoredBrokenLinks:[...new Set([...n,e])],...0===t.length&&{status:"success",title:(0,w.__)("No broken links found on the page.","surerank")}}}const i=a,o=s&&!0!==s?.success&&!i.some(t=>t?.url===e)?[...i,{url:e,status:s?.status??"error",details:s?.details??""}]:i;return{...r,data:o,ignoredBrokenLinks:n.filter(t=>t!==e),...o.length>0&&{status:"error",title:(0,w.__)("One or more broken links found on the page.","surerank")}}});return yield O("page",a),{success:!0}}catch(a){return{success:!1}}}function*W(e){return yield*G(e,"ignore")}function*Y(e){return yield*G(e,"restore")}const K=(e,t,s,r=null)=>{const{categorizedChecks:n,sequence:a}=J(s);return{type:_,payload:{postId:e,postType:t,checks:n,sequence:a,error:r}}},Z=(e,t="post")=>{const s={};return Object.entries(e).forEach(([e,r])=>{const n=r.checks||{},a=Object.entries(n).map(([e,t])=>({...t,id:e,title:t?.message||e.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),data:t?.description,showImages:"image_alt_text"===e}));(0,C.VX)(a,n.all_links);const{categorizedChecks:i,sequence:o}=J(a);s[e]={postType:t,checks:i,sequence:o,error:null}}),{type:f,payload:s}},J=e=>{const t=[];return{categorizedChecks:e.reduce((e,s)=>(t.push(s.id),s?.ignore?e.ignoredChecks.push(s):(s.ignore=!1,"error"===s.status?e.badChecks.push(s):"warning"===s.status?e.fairChecks.push(s):"suggestion"===s.status?e.suggestionChecks.push(s):"success"===s.status&&e.passedChecks.push(s)),e),{badChecks:[],fairChecks:[],suggestionChecks:[],passedChecks:[],ignoredChecks:[]}),sequence:t}};function*X(e,t,s,r,n){try{const a=yield H({path:"surerank/v1/checks/ignore-page-check",method:r,data:{post_id:t,id:e,check_type:s}});if("success"!==a?.status)throw new Error(a?.message);const{checks:o,sequence:l}=(0,i.select)(v.E).getSeoBarChecks(t,s),c=Object.values(o).flat().map(t=>(t.id===e&&(t.ignore=n),t)).sort((e,t)=>l.indexOf(e.id)-l.indexOf(t.id));yield K(t,s,c)}catch(a){}}function*Q(e,t,s){yield X(e,t,s,"POST",!0)}function*ee(e,t,s){yield X(e,t,s,"DELETE",!1)}function*te(e,t,s){yield{type:k,payload:{postId:e}};const r=(0,i.select)(v.E).getPageSeoChecks()?.[e];r?.checks&&(yield((e,t)=>{const{checks:s,sequence:r}=t,n=["badChecks","fairChecks","suggestionChecks","passedChecks","ignoredChecks"].flatMap(e=>s[e]||[]).sort((e,t)=>r.indexOf(e.id)-r.indexOf(t.id)),a=n.filter(e=>"page"===e.type),i=n.filter(e=>"keyword"===e.type),o=n.filter(e=>e.ignore).map(e=>e.id),l=(0,C.xZ)(n,o),c=(0,C.xZ)(a,o),d=(0,C.xZ)(i,o);return M({postId:e,checks:n,pageChecks:a,keywordChecks:i,categorizedChecks:l,categorizedPageChecks:c,categorizedKeywordChecks:d,ignoredList:o,initializing:!1,refreshCalled:!0,isRefreshing:!1})})(e,r));let n={post_id:e};"user"===t?n={user_id:e}:s&&(n={term_id:e});try{const e=yield H({path:(0,b.addQueryArgs)(j.uX,n),method:"GET"});if(e?.success){let t={variables:e.variables};e.other&&(t={...t,...e.other}),yield L(t)}}catch(a){}}function se(e){return e.postSeoMeta}function re(e){return e.variables}function ne(e){return e.metaboxInitialized}function ae(e){return e}function ie(e){return e.modalEnabled}function oe(e){const t=e.postDynamicData;return e?.variables?.post?.title?.value&&!t?.title&&(t.title=e.variables.post.title.value),e?.variables?.post?.content?.value&&!t?.content&&(t.content=(0,C.XY)(e.variables.post.content.value)),e?.variables?.post?.excerpt?.value&&!t?.excerpt&&(t.excerpt=e.variables.post.excerpt.value),t}const le=e=>e.globalDefaults,ce=e=>e.appSettings,de=e=>e.unsavedPostSeoMeta,ue=e=>e.pageSeoChecks.refreshCalled,pe=e=>e.pageSeoChecks?.ignoredList||[],he=e=>e.pageSeoChecks,ge=e=>e.activePostId,me=(e,t,s)=>t&&s?{checks:e.pageSeoChecks[t]?.checks||{},sequence:e.pageSeoChecks[t]?.sequence||[],error:e.pageSeoChecks[t]?.error||null}:{};var _e=s(1455),fe=s.n(_e);const ke={FETCH_FROM_API:e=>fe()(e.payload)};var xe=s(60443);function*ye(){const e=yield(0,i.select)(v.E).getState(),t=e.pageSeoChecks?.postId||e.variables?.post?.ID?.value||e.variables?.term?.ID?.value||e.variables?.user?.ID?.value||window?.surerank_seo_popup?.post_id||window?.surerank_seo_popup?.term_id||window?.surerank_seo_popup?.user_id||window?.surerank_globals?.post_id||window?.surerank_globals?.term_id;let s="post";window?.surerank_seo_popup?.is_user?s="user":"1"===window?.surerank_seo_popup?.is_taxonomy&&(s="taxonomy");const r=e.pageSeoChecks?.checkType||s;if(!t||!r)return[];try{const e=yield H({path:(0,b.addQueryArgs)("surerank/v1/checks/ignore-page-check",{post_id:t,check_type:r}),method:"GET"});yield B(e?.checks||[])}catch(n){yield B([])}}function*be(e,t,s=null){if(!e||!t)return{};const r=Array.isArray(e)?e:[e],n=(0,i.select)(v.E).getState();let a=r;if(s||(a=r.filter(e=>{const t=n.pageSeoChecks?.[e]?.checks;return!t})),0!==a.length)try{yield we(a,t,s)}catch(o){const s=o?.message||(0,w.__)("Error loading SEO checks","surerank");Array.isArray(e)||(yield K(e,t,[],s))}}function*we(e,t,s=!1){if(!e||!e.length)return;let r="/surerank/v1/checks/page",n="post_ids";"taxonomy"===t?(r="/surerank/v1/checks/taxonomy",n="term_ids"):"user"===t&&(r="/surerank/v1/checks/user",n="user_ids");const a=s?`&_t=${s}`:"";try{const s=yield H({path:(0,b.addQueryArgs)(r,{[n]:e})+a,method:"GET"});if("success"!==s?.status||!s?.data)throw s;yield Z(s.data,t)}catch(i){(0,xe.o)({message:i?.message||(0,w.__)("Error loading SEO checks","surerank"),type:"error"})}}const ve=(0,o.applyFilters)("surerank-pro.seo-metabox-actions",r)??r,je=(0,o.applyFilters)("surerank-pro.seo-metabox-selectors",n)??n,Ce=(0,i.createReduxStore)(v.E,{reducer:function(e=x,t){switch(t.type){case"UPDATE_MODAL_STATE":return{...e,modalEnabled:t.value,appSettings:{...e.appSettings,currentScreen:x.appSettings.currentScreen,previousScreen:e.appSettings.currentScreen}};case"UPDATE_INITIAL_STATE":return{...e,...t.value};case"UPDATE_METABOX_STATE":return{...e,metaboxInitialized:t.value};case"UPDATE_POST_SEO_META":case"UPDATE_META_DATA":if("object"!==typeof t.value)throw new Error("Value should be an object");return{...e,postSeoMeta:{...e.postSeoMeta,...t.value}};case"UPDATE_DYNAMIC_DATA":return{...e,postDynamicData:{...e.postDynamicData,...t.value}};case l:return{...e,globalDefaults:t.payload};case c:return{...e,appSettings:{...e.appSettings,...t.value}};case d:case u:return{...e,pageSeoChecks:{...e.pageSeoChecks,...t.payload}};case p:return{...e,unsavedPostSeoMeta:{...e.unsavedPostSeoMeta,...t.payload}};case h:return{...e,unsavedPostSeoMeta:{}};case g:return{...e,pageSeoChecks:{...e.pageSeoChecks,refreshCalled:t.value}};case m:return{...e,pageSeoChecks:{...e.pageSeoChecks,ignoredList:t.payload}};case _:return{...e,pageSeoChecks:{...e.pageSeoChecks,[t.payload.postId]:{checks:{...e.pageSeoChecks[t.payload.postId]?.checks,...t.payload.checks},sequence:t.payload.sequence,error:t.payload.error}}};case f:return{...e,pageSeoChecks:{...e.pageSeoChecks,...t.payload}};case k:{const s=Object.fromEntries(Object.entries(e.pageSeoChecks).filter(([e])=>/^\d+$/.test(e)));return{...e,activePostId:t.payload.postId,metaboxInitialized:!1,unsavedPostSeoMeta:{},postSeoMeta:{...x.postSeoMeta},postDynamicData:{...x.postDynamicData},appSettings:{...x.appSettings},globalDefaults:{},variables:void 0,pageSeoChecks:{...x.pageSeoChecks,...s}}}default:return(0,o.applyFilters)("surerank-pro.seo-metabox-store",e,t)||e}},actions:ve,selectors:je,controls:ke,resolvers:a});(0,i.register)(Ce),(()=>{const e={};window?.surerank_globals?.post_id&&(e.post_id=window?.surerank_globals.post_id),window?.surerank_globals?.term_id&&(e.term_id=window?.surerank_globals.term_id),window?.surerank_seo_popup?.post_id&&(e.post_id=window?.surerank_seo_popup.post_id),window?.surerank_seo_popup?.term_id&&(e.term_id=window?.surerank_seo_popup.term_id),window?.surerank_seo_popup?.user_id&&(e.user_id=window?.surerank_seo_popup.user_id),(e?.post_id||e?.term_id||e?.user_id)&&fe()({path:(0,b.addQueryArgs)(j.uX,e)}).then(e=>{if(e?.success){let t={variables:e.variables};e.other&&(t={...t,...e.other}),(0,i.dispatch)(Ce).updateInitialState(t)}})})()},51609(e){e.exports=window.React},75795(e){e.exports=window.ReactDOM},10790(e){e.exports=window.ReactJSXRuntime},66087(e){e.exports=window.lodash},1455(e){e.exports=window.wp.apiFetch},56427(e){e.exports=window.wp.components},47143(e){e.exports=window.wp.data},86087(e){e.exports=window.wp.element},52619(e){e.exports=window.wp.hooks},27723(e){e.exports=window.wp.i18n},93832(e){e.exports=window.wp.url}},e=>{e.O(0,[9603,4631,5769,4795,8818,3897,5250,1392,6115,1085,6152,359,9545,641,6018,2691,8426,4400,6770,938,8427,8562,7938,9171,2373,2738,91,6289,1544,8789,8412,4973,5043,8732,5599,1811,4160,7683,5408,7040,703,4634,6061,9792,4787,8433,1817,1624,6784,5789],()=>e(e.s=83268)),e.O()}]);
Nama
Tipe
Ukuran
Diubah
Aksi
🐘 index.asset.php
php
308 B
2026-06-21 06:40
📜 index.js
js
191.5 KB
2026-06-21 06:40
🎨 style-rtl.css
css
182.6 KB
2026-06-21 06:40
🎨 style.css
css
182.6 KB
2026-06-21 06:40