"use strict";const o=require("vue");function s(n,u){const t=o.inject("map"),i=o.inject("isLoaded");let e=null;o.watch(()=>[i?.value,typeof u!="function"?u.value:!0],([a,l])=>{if(!(!a||!t?.value||e)){if(typeof u!="function"){if(!l)return;e={onAdd(){return u.value},onRemove(){}}}else e=u();t.value.addControl(e,n.position)}},{immediate:!0}),o.onBeforeUnmount(()=>{t?.value&&e&&t.value.removeControl(e)})}exports.useMapControl=s;
