(function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("ol/Map"),require("ol/View"),require("ol/layer/Base")):typeof define=="function"&&define.amd?define(["exports","vue","ol/Map","ol/View","ol/layer/Base"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r["vue-ol-comp"]={},r.Vue,r.Map,r.View))})(this,function(r,e,C,_){"use strict";function x(t){return e.getCurrentScope()?(e.onScopeDispose(t),!0):!1}function g(){const t=new Set,c=a=>{t.delete(a)};return{on:a=>{t.add(a);const s=()=>c(a);return x(s),{off:s}},off:c,trigger:(...a)=>Promise.all(Array.from(t).map(s=>s(...a)))}}typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const n=e.shallowRef(new C({view:new _({center:[0,0],zoom:1})})),m=e.ref([]),y=e.ref(),M=e.ref(),v=e.ref(),l=e.ref(),h=e.ref([]),k=e.ref([]),p=e.ref(!1),f=e.ref(!1),O=e.computed(()=>l.value?Math.round(l.value):void 0),{on:z,trigger:P}=g(),{on:R,trigger:T}=g();n.value.getLayers().on("change:length",t=>{m.value=t.target.getArray()}),n.value.on("click",P),n.value.on("singleclick",T),n.value.on("pointermove",t=>{h.value=t.coordinate,k.value=t.pixel}),n.value.on("loadstart",()=>{p.value=!0}),n.value.on("loadend",()=>{p.value=!1}),n.value.on("movestart",()=>{f.value=!0}),n.value.on("moveend",()=>{f.value=!1});const o=n.value.getView(),u=()=>{y.value=o==null?void 0:o.getCenter(),v.value=o==null?void 0:o.getResolution(),l.value=o==null?void 0:o.getZoom(),M.value=o==null?void 0:o.calculateExtent()};o.on(["change","change:center","change:resolution"],()=>{u()}),n.value.on("change:size",()=>{u()}),u();function S(){return{onMapClick:z,onMapSingleClick:R,map:e.computed(()=>n.value),layers:e.computed(()=>m.value),center:e.readonly(y),extent:e.readonly(M),mapLoading:e.readonly(p),mapMoving:e.readonly(f),zoom:e.readonly(l),zoomRounded:O,pointerCoordinate:e.readonly(h),pointerPixel:e.readonly(k)}}const V=e.defineComponent({__name:"OlMap",setup(t){const{map:c}=S(),d=e.ref();return e.onMounted(()=>{var i;(i=c.value)==null||i.setTarget(d.value)}),(i,a)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"olMapRef",ref:d},null,512))}});r.OlMap=V,r.useOl=S,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});