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