"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),l=require("lodash"),a=require("../../utils/json2css.js"),b=["type","placeholder"],I=n.defineComponent({name:"zv-interaction-input"}),g=n.defineComponent({...I,props:{basicOption:{},sources:{},useEvents:{},uuid:{}},emits:["on-blur","on-focus","on-input","on-change"],setup(d,{emit:f}){const o=d,i=f,w=()=>{const e=n.ref(""),u=n.ref(),c=s=>{if(a.autoInstallFont(s.fontFamily),a.autoInstallFont(s.focus.fontFamily),u.value)return{...a.jsonToCssStyle(s),...a.jsonToCssStyle(s.focus,"focus"),...a.jsonToCssStyle(s.placeholder,"placeholder")}},v=()=>{window.SHJDatasourceV2({tId:o.uuid,sources:o.sources,callback:({data:s})=>{try{window.SHJParseEvent(o.useEvents,"dataListener",s),e.value=s[0].data[0].value}catch{window.SHJParseEvent(o.useEvents,"dataListener",null)}}})};return n.onMounted(()=>v()),{init:v,rendererDomStyle:c,inputRef:u,inputValue:e}},{init:p,rendererDomStyle:h,inputRef:t,inputValue:r}=w(),m=e=>{t.value&&(i("on-blur",e,t.value.value),window.SHJParseEvent(o.useEvents,"on-blur",{data:t.value.value,event:e}))},y=e=>{t.value&&(i("on-focus",e,t.value.value),window.SHJParseEvent(o.useEvents,"on-focus",{data:t.value.value,event:e}))},E=e=>{t.value&&(i("on-input",e,t.value.value),window.SHJParseEvent(o.useEvents,"on-input",{data:t.value.value,event:e}))},S=e=>{t.value&&(i("on-change",e,t.value.value),window.SHJParseEvent(o.useEvents,"on-change",{data:t.value.value,event:e}))};return n.watch(()=>l.cloneDeep(o.basicOption),(e,u)=>{l.isEqual(e,u)||p()},{deep:!0}),n.watch(()=>l.cloneDeep(o.sources),(e,u)=>{l.isEqual(e,u)||p()},{deep:!0}),(e,u)=>n.withDirectives((n.openBlock(),n.createElementBlock("input",{"onUpdate:modelValue":u[0]||(u[0]=c=>n.isRef(r)?r.value=c:null),ref_key:"inputRef",ref:t,type:e.basicOption.css.type||"text",class:"zerov-widget-input",placeholder:e.basicOption.placeholderValue,style:n.normalizeStyle(n.unref(h)(e.basicOption.css)),onBlur:n.withModifiers(m,["stop"]),onFocus:n.withModifiers(y,["stop"]),onInput:n.withModifiers(E,["stop"]),onChange:n.withModifiers(S,["stop"])},null,44,b)),[[n.vModelDynamic,n.unref(r)]])}});exports.default=g;
