"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),M=require("../constant.js"),w=require("../context.js"),d=require("../utils/get.js");function i(t){try{return JSON.stringify(t)}catch{return Math.random()}}function g(t,n,V){const{internalInstance:S,model:h}=w.useInjectForm(),o=V?.initialValue||n?.initialValue||void 0,l=e.ref(o);let u=i(o);const s=e.computed(()=>(n&&"value"in n?n:void 0)?.value?.getInternalInstance(M.INTERNAL_FORM_INSTANCE_MARK)||S);return e.watchEffect(a=>{if(!s.value)return;const r=s.value.registerWatch(c=>{const f=d.getModelValue(c,e.unref(t)),v=i(f);v!==u&&(l.value=f,u=v)});a(r)}),e.watch(()=>e.unref(t),a=>{const r=d.getModelValue(e.unref(h),a),c=i(r);c!==u&&(l.value=r,u=c)}),l}exports.default=g;exports.useWatch=g;
