import{_ as I}from"./Caret.cc16468c.js";import{B as V}from"./Img.c1967fde.js";import{B as w,S as C}from"./index.f3c7a985.js";import{S as z}from"./Plus.5c071d29.js";import"./translations.d159963e.js";import{I as B,x as i,o as g,c as M,a as _,H as r,m as u,l as P,J as f,b as k,y as U,t as N,K as T}from"./runtime-dom.esm-bundler.c4caba60.js";import{_ as H}from"./_plugin-vue_export-helper.eefbdd86.js";import{_ as o}from"./default-i18n.20001971.js";const a="all-in-one-seo-pack";let n={};const p={emits:["update:modelValue"],components:{BaseButton:I,BaseImg:V,BaseInput:w,SvgCirclePlus:z,SvgTrash:C},props:{baseSize:{type:String,default:"medium"},imgPreviewMaxHeight:{type:String,default:"525px"},imgPreviewMaxWidth:{type:String,default:"525px"},description:String,modelValue:{type:String,default:""}},data(){return{strings:{description:o("Minimum size: 112px x 112px, The image must be in JPG, PNG, GIF, SVG, or WEBP format.",a),pasteYourImageUrl:o("Paste your image URL or select a new image",a),remove:o("Remove",a),uploadOrSelectImage:o("Upload or Select Image",a)}}},computed:{iconWidth(){return this.baseSize==="small"?"16":"20"}},methods:{setImgSrc(e){this.$emit("update:modelValue",e)},openUploadModal(){n=window.wp.media({title:o("Choose Image",a),button:{text:o("Choose Image",a)},multiple:!1}),n.on("select",()=>{const e=n.state().get("selection").first().toJSON();this.setImgSrc((e==null?void 0:e.url)||null)}),n.on("close",()=>{n.detach()}),this.$nextTick(()=>{n.open()})}}},S=()=>{B(e=>({"1308d964":e.imgPreviewMaxHeight,e4552c2e:e.imgPreviewMaxWidth}))},h=p.setup;p.setup=h?(e,t)=>(S(),h(e,t)):S;const L={class:"image-upload"},W=["innerHTML"];function G(e,t,s,A,c,l){const v=i("svg-trash"),d=i("base-button"),x=i("base-input"),y=i("svg-circle-plus"),b=i("base-img");return g(),M("div",{class:T(["aioseo-image-uploader",{"aioseo-image-uploader--has-image":!!s.modelValue}])},[_("div",L,[r(x,{size:s.baseSize,modelValue:s.modelValue,placeholder:c.strings.pasteYourImageUrl,onChange:t[1]||(t[1]=m=>l.setImgSrc(m))},{"append-icon":u(()=>[s.modelValue?(g(),P(d,{key:0,size:s.baseSize,class:"remove-image",type:"gray",onClick:t[0]||(t[0]=f(m=>l.setImgSrc(null),["prevent"]))},{default:u(()=>[r(v,{width:l.iconWidth},null,8,["width"])]),_:1},8,["size"])):k("",!0)]),_:1},8,["size","modelValue","placeholder"]),r(d,{size:s.baseSize,class:"insert-image",type:"black",onClick:t[2]||(t[2]=f(m=>l.openUploadModal(),["prevent"]))},{default:u(()=>[r(y,{width:"14"}),U(" "+N(c.strings.uploadOrSelectImage),1)]),_:1},8,["size"])]),_("div",{class:"aioseo-description",innerHTML:s.description||c.strings.description},null,8,W),r(b,{class:"image-preview",src:s.modelValue},null,8,["src"])],2)}const K=H(p,[["render",G],["__scopeId","data-v-e04c452c"]]);export{K as C};
