Sid Gifari File Manager
🏠 Root
/
home2
/
meumer25
/
meupet.app
/
wp-content
/
plugins
/
all-in-one-seo-pack
/
dist
/
Lite
/
assets
/
js
/
Editing: Image.18de3397.js
import{K as y,L as A,n as k,u as v,M as $,N as C,O as B,P as T,Q as U,R as L,S as N,U as M,V as R,W as V,X as W,Y,a as w,e as S,k as q,Z as D,_ as K}from"./index.317ad629.js";import"./translations.e71e2202.js";import{Y as I,W as P}from"./runtime-core.esm-bundler.ce5add0b.js";import{_ as c}from"./default-i18n.65d58dd6.js";const Q=()=>{var a;let e=0;return(y()||A())&&(e=parseInt((a=document.getElementById("post_author_override"))==null?void 0:a.value)),k()&&(e=window.wp.data.select("core/editor").getEditedPostAttribute("author")),e||(e=v().currentPost.postAuthor),e},X=()=>{var a;const e=[{isEditor:$,getData:C},{isEditor:B,getData:T},{isEditor:U,getData:L},{isEditor:N,getData:M},{isEditor:R,getData:V},{isEditor:W,getData:Y}];for(const o of e)if(o.isEditor())return((a=o.getData())==null?void 0:a.featuredImage)??"";return""},Z=()=>{const e=document.querySelector("#set-post-thumbnail img");return e?e.getAttribute("src"):""},F=async(e=!1)=>{var t;const a=window.wp.data.select("core/editor"),o=e&&a?a==null?void 0:a.getEditedPostAttribute("featured_media"):(t=a==null?void 0:a.getCurrentPost())==null?void 0:t.featured_media;return typeof o>"u"?new Promise(r=>setTimeout(()=>r(F(e)),1e3)):o},O=async()=>{if(y()||A())return Z();if(k()){const e=await F(!0).then(o=>o);return isNaN(e)||e===0?"":v().getMediaData({mediaId:e}).then(o=>o.source_url)}return X()},d="all-in-one-seo-pack",x=()=>{let e=null;const a=/<img.*?src=['"](.*?)['"].*?>/i.exec(K());return a&&a[1]&&(e=a[1]),e},j=async(e,a,o)=>{let t=D(e[`${o}image_custom_fields`]);return t||await O().then(r=>{t=r}),t||await v().getFirstAttachedImage({postId:e.id}).then(p=>{t=p}),t||(t=x()),t||(t=S().options.social[a].homePage.image),t},z=async()=>{let e="";const a=Q();return await v().getUserImage({userId:a}).then(t=>{e=t}),e},st=()=>{const e=I(["featured","content","author"]),a=I(["auto"]),o=I(["featured","attach","content","author","auto"]),t=I(""),r=I(!1),p=P(()=>[{label:c("Default Image (Set Below)",d),value:"default"},{label:c("Featured Image",d),value:"featured"},{label:c("Attached Image",d),value:"attach"},{label:c("First Image in Content",d),value:"content"},{label:c("Image from Custom Field",d),value:"custom"},{label:c("Post Author Image",d),value:"author"},{label:c("First Available Image",d),value:"auto"}]),_=P(()=>{var l,u,m;const n=v(),s=p.value.map(i=>(i.value==="default"&&(i.label=c("Default Image Source (Set in Social Networks)",d)),i)).concat({label:c("Custom Image",d),value:"custom_image"});if(((l=n.currentPost)==null?void 0:l.context)==="term")return s.filter(i=>!o.value.includes(i.value));if(((u=n.currentPost)==null?void 0:u.context)==="post"&&((m=n.currentPost)==null?void 0:m.postType)==="attachment")return s.filter(i=>!e.value.includes(i.value));const g=w(),E=S();return g.aioseo.integration?((g.aioseo.integration==="seedprod"||g.aioseo.integration==="wpbakery"&&window.vc_mode==="admin_frontend_editor")&&a.value.push("featured"),g.aioseo.integration==="siteorigin"&&!E.options.searchAppearance.advanced.runShortcodes&&a.value.push("content"),s.filter(i=>!a.value.includes(i.value))):s});return{getImageSourceOption:n=>p.value.find(s=>s.value===n),getImageSourceOptionFiltered:n=>_.value.find(s=>s.value===n),getTermImageSourceOptions:()=>p.value.filter(n=>!o.value.includes(n.value)),imageSourceOptions:p,imageSourceOptionsFiltered:_,imageUrl:t,loading:r,setImageUrl:async(n="")=>{var b;const s=S(),g=v(),E=q(),l=g.currentPost,u=n||((b=E.metaBoxTabs)==null?void 0:b.social)||"facebook",m=u==="facebook"||u==="twitter"&&l.twitter_use_og?"og_":"twitter_";let i=l[`${m}image_type`]||"default";switch(i==="default"&&(i=s.options.social[u].general.defaultImageSourcePosts),t.value="",i){case"featured":r.value=!0,await O().then(f=>{t.value=f,r.value=!1});break;case"attach":r.value=!0,await g.getFirstAttachedImage({postId:l.id}).then(f=>{t.value=f,r.value=!1});break;case"content":t.value=x();break;case"author":r.value=!0,await z().then(f=>{t.value=f,r.value=!1});break;case"auto":r.value=!0,await j(l,u,m).then(f=>{t.value=f,r.value=!1});break;case"custom":t.value=D(l[`${m}image_custom_fields`]);break;case"custom_image":t.value=l[`${m}image_custom_url`];break;case"default":default:t.value=s.options.social[u].general.defaultImagePosts;break}!t.value&&s.options.social[u].general.defaultImagePosts&&(t.value=s.options.social[u].general.defaultImagePosts);const h=w();!t.value&&h.aioseo.urls.siteLogo&&(t.value=h.aioseo.urls.siteLogo),window.aioseoBus.$emit("updateSocialImagePreview",{social:u,image:t.value})}}};export{st as u};
Save
Cancel