"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../utils/defer.js"),t=require("../../utils/common.js"),a=require("./mixins.js"),s=require("../../utils/amap-helpers.js"),i=require("./events.js"),n=require("./props.js"),o=require("./component.js"),r=a.default(o.default).extend({inject:["$amapContainer"],amapMeta:{slot:!1,initComponent:t.panic,add(e,t){const a=e;t.setMap(a.map)},remove(e,t){t.setMap(null)}},props:{extraOptions:{type:Object,required:!1,default:void 0}},beforeCreate(){this.$amapReady=e.default(),this.$amapContext={}},created(){Object.assign(this.$amapContext,{AMap:null,ready:this.$amapReady.promise,container:this.$amapContainer,component:null,destroyed:!1})},async mounted(){const{context:e}=this,t=this.$options.amapMeta,{container:a}=e;await a.ready,e.AMap=a.AMap,t.prepare&&await t.prepare();const o=s.getInitialOptionsFromProps(this);if(e.destroyed)return;const r=await t.initComponent.call(this,window.AMap,o);r.$vm=this,e.component=r,t.add.call(this,a,r),n.bindProps(this),i.bindEvents(this),this.$amapReady.resolve(r),this.$emit("amap-ready",this)},beforeDestroy(){const{context:e}=this,{container:t,component:a}=e;if(a){i.unbindEvents(this),this.$options.amapMeta.remove.call(this,t,a)}e.destroyed=!0},render(e){return this.$options.amapMeta.slot&&this.$slots.default?e("div",{class:"amap-vue-placeholder",style:"visibility: hidden; pointer-events: none;"},this.$slots.default):null}});exports.default=r;
