import{q as C,a3 as A,M as j,Y as S,O as $,I as H,N as R,H as V,a0 as U}from"./swiper-vue.f20a3fc7.js";import{_ as D}from"./client-only.97ec4e49.js";import{_ as Z}from"./entry.a1775dd4.js";function T(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),o.push.apply(o,n)}return o}function w(e){for(var t=1;t<arguments.length;t++){var o=arguments[t]!=null?arguments[t]:{};t%2?T(Object(o),!0).forEach(function(n){G(e,n,o[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):T(Object(o)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(o,n))})}return e}function L(e){return(L=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(e)}function W(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function G(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function q(e){return function(t){if(Array.isArray(t))return I(t)}(e)||function(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}(e)||function(t,o){if(t){if(typeof t=="string")return I(t,o);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return I(t,o)}}(e)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function I(e,t){(t==null||t>e.length)&&(t=e.length);for(var o=0,n=new Array(t);o<t;o++)n[o]=e[o];return n}function B(e,t){var o=t.options,n=t.callbacks,r=t.map,a=t.useObjectManager,c=t.objectManagerClusterize,p=t.useHtmlInLayout?`
    <div v-html="properties.balloonContentHeader"></div>
    <div v-html="properties.balloonContentBody"></div>
    <div v-html="properties.balloonContentFooter"></div>
  `:`
    <div>{{ properties.balloonContentHeader }}</div>
    <div>{{ properties.balloonContentBody }}</div>
    <div>{{ properties.balloonContentFooter }}</div>
  `,l={},s=[];if(e.forEach(function(u){u.clusterName?l[u.clusterName]=l[u.clusterName]?[].concat(q(l[u.clusterName]),[u]):[u]:s.push(u)}),Object.keys(l).forEach(function(u){var i=o[u]||{},m=n[u]||{},h=i.layout||p;i.clusterBalloonItemContentLayout=ymaps.templateLayoutFactory.createClass(h);var v=i.clusterBalloonLayout||i.clusterLayout;delete i.clusterBalloonLayout;var M=v?ymaps.templateLayoutFactory.createClass(v):i.clusterBalloonContentLayout||"cluster#balloonTwoColumns";i.clusterBalloonContentLayout=M;var k=i.clusterIconContentLayout;if(i.clusterIconContentLayout=k&&ymaps.templateLayoutFactory.createClass(k),a){var f=new ymaps.ObjectManager(Object.assign({clusterize:c},i));Object.keys(m).forEach(function(y){f.clusters.events.add(y,m[y])}),f.add(l[u]),r.geoObjects.add(f)}else{var O=new ymaps.Clusterer(i);Object.keys(m).forEach(function(y){O.events.add(y,m[y])}),i.createCluster&&(O.createCluster=i.createCluster),O.add(l[u]),r.geoObjects.add(O)}}),s.length){var d=a?new ymaps.ObjectManager({clusterize:!1}):new ymaps.GeoObjectCollection;s.forEach(function(u){return d.add(u)}),r.geoObjects.add(d)}}function x(e){return e.charAt(0).toUpperCase()+e.slice(1)}function K(e){return(e.icon.color||"blue")+(e.icon.glyph?x(e.icon.glyph):e.icon.content?"Stretchy":"")}function N(e){return e.map(function(t){return Array.isArray(t)?N(t):+t})}function Y(e,t){var o=[];return function n(r,a){if(r===a)return!0;if(r instanceof Date&&a instanceof Date)return+r==+a;if(L(r)!=="object"||L(a)!=="object")return!1;if(function(l,s){for(var d=o.length;d--;)if(!(o[d][0]!==l&&o[d][0]!==s||o[d][1]!==s&&o[d][1]!==l))return!0;return!1}(r,a))return!0;o.push([r,a]);var c=Object.keys(r),p=c.length;if(Object.keys(a).length!==p)return!1;for(;p--;)if(!n(r[c[p]],a[c[p]]))return!1;return!0}(e,t)}var b=new(function(){function e(){(function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")})(this,e),this.events={},this.ymapReady=!1,this.scriptIsNotAttached=!0}var t,o;return t=e,(o=[{key:"$on",value:function(n,r){var a=this;return this.events[n]||(this.events[n]=[]),this.events[n].push(r),function(){a.events[n]=a.events[n].filter(function(c){return r!==c})}}},{key:"$emit",value:function(n,r){var a=this.events[n];a&&a.forEach(function(c){return c(r)})}}])&&W(t.prototype,o),Object.defineProperty(t,"prototype",{writable:!1}),e}()),J=["fullscreenControl","geolocationControl","routeEditor","rulerControl","searchControl","trafficControl","typeSelector","zoomControl","routeButtonControl","routePanelControl"];function E(e){return e.filter(function(t){return![].concat(J,["default"]).includes(t)}).length===0}function P(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return new Promise(function(t,o){if(window.ymaps)return t();if(document.getElementById("vue-yandex-maps"))b.$on("scriptIsLoaded",t);else{var n=document.createElement("SCRIPT"),r=e.apiKey,a=r===void 0?"":r,c=e.lang,p=c===void 0?"ru_RU":c,l=e.version,s=l===void 0?"2.1":l,d=e.coordorder,u=d===void 0?"latlong":d,i=e.debug,m=i!==void 0&&i,h=e.enterprise,v=h!==void 0&&h,M=m?"debug":"release",k="lang=".concat(p).concat(a&&"&apikey=".concat(a),"&mode=").concat(M,"&coordorder=").concat(u),f="https://".concat(v?"enterprise.":"","api-maps.yandex.ru/").concat(s,"/?").concat(k);n.setAttribute("src",f),n.setAttribute("async",""),n.setAttribute("defer",""),n.setAttribute("id","vue-yandex-maps"),document.head.appendChild(n),b.scriptIsNotAttached=!1,n.onload=function(){ymaps.ready(function(){b.ymapReady=!0,b.$emit("scriptIsLoaded"),t()})},n.onerror=o}})}var Q,F=1,_=b,X=["actionend","balloonclose","balloonopen","click","contextmenu","dblclick","destroy","hintclose","hintopen","optionschange","sizechange","typechange"],g={pluginOptions:{},provide:function(){var e,t,o,n,r,a,c=this,p=[],l=[];return this.balloonComponent!=null&&(n=this.balloonComponent,r=null,a="vue-balloon-".concat(F),F+=1,o=function(s,d){var u=ymaps.templateLayoutFactory.createClass('<div id="'.concat(a,'"><div>'),{build:function(){u.superclass.build.call(this),(r=new Q({parent:s.$root,data:function(){return{props:s.$props,listeners:s.$listeners}},propsData:{marker:d,component:n}})).$mount("#".concat(a))},clear:function(){r.$destroy(),r=null,u.superclass.clear.call(this)}});return u}),{useObjectManager:this.useObjectManager,addMarker:this.addMarker,deleteMarker:function(s){c.myMap.geoObjects&&(p.push(s),e&&clearTimeout(e),e=setTimeout(function(){c.deleteMarkers(p),p=[]},0))},compareValues:function(s){var d=s.newVal,u=s.oldVal,i=s.marker;Y(d,u)||(l.push(i),t&&clearTimeout(t),t=setTimeout(function(){c.setMarkers(l),l=[]},0))},makeComponentBalloonTemplate:o}},data:function(){return{ymapId:"yandexMap".concat(Math.round(1e5*Math.random())),style:this.ymapClass?"":"width: 100%; height: 100%;",isReady:!1,debounce:null}},props:{coords:{type:Array,required:!0},zoom:{validator:function(e){return!Number.isNaN(e)},default:18},bounds:Array,clusterOptions:{type:Object,default:function(){return{}}},clusterCallbacks:{type:Object,default:function(){return{}}},behaviors:{type:Array,default:function(){return["default"]}},controls:{type:Array,default:function(){return["default"]},validator:function(e){return E(e)}},detailedControls:{type:Object,validator:function(e){return E(Object.keys(e))}},scrollZoom:{type:Boolean,default:!0},mapType:{type:String,default:"map",validator:function(e){return["map","satellite","hybrid"].includes(e)}},placemarks:{type:Array,default:function(){return[]}},useObjectManager:{type:Boolean,default:!1},objectManagerClusterize:{type:Boolean,default:!0},ymapClass:String,initWithoutMarkers:{type:Boolean,default:!0},debug:{type:Boolean,default:!1},settings:{type:Object,default:function(){return{}}},options:{type:Object,default:function(){return{}}},mapEvents:{type:Array,default:function(){return[]}},showAllMarkers:Boolean,disablePan:Boolean,balloonComponent:{type:[Object,Function],default:function(){return null}},useHtmlInLayout:Boolean},computed:{coordinates:function(){return this.coords.map(function(e){return+e})}},methods:{init:function(){var e,t,o=this;this.myMap={},this.markers=[],window.ymaps&&ymaps.GeoObjectCollection&&(this.initWithoutMarkers||(e=(t=this.$slots).default)!==null&&e!==void 0&&e.call(t)||this.placemarks.length)&&document.getElementById(this.ymapId)&&(this.$emit("map-initialization-started"),this.myMap=new ymaps.Map(this.ymapId,{center:this.coordinates,zoom:+this.zoom,bounds:this.bounds,behaviors:this.behaviors,controls:this.controls,type:"yandex#".concat(this.mapType)},this.options),(this.mapEvents.length?this.mapEvents:X).forEach(function(n){return o.myMap.events.add(n,function(r){return o.$emit(n,r)})}),this.myMap.events.add("boundschange",function(n){var r=n.originalEvent,a=r.newZoom,c=r.newCenter,p=r.newBounds;o.$emit("boundschange",n),o.$emit("update:zoom",a),o.$emit("update:coords",c),o.$emit("update:bounds",p)}),this.detailedControls&&Object.keys(this.detailedControls).forEach(function(n){o.myMap.controls.remove(n),o.myMap.controls.add(n,o.detailedControls[n])}),this.scrollZoom===!1&&this.myMap.behaviors.disable("scrollZoom"),this.isReady=!0,this.$emit("map-was-initialized",this.myMap))},addMarker:function(e){var t=this;this.markers.push(e),this.debounce&&clearTimeout(this.debounce),this.debounce=setTimeout(function(){t.setMarkers(t.markers)},0)},setMarkers:function(e){var t=this,o={options:this.clusterOptions,callbacks:this.clusterCallbacks,map:this.myMap,useObjectManager:this.useObjectManager,objectManagerClusterize:this.objectManagerClusterize,useHtmlInLayout:this.useHtmlInLayout};if(this.markers!==e){var n=e.map(function(r){return t.useObjectManager?r.id:r.properties.get("markerId")});this.deleteMarkers(n),B(e,o),this.$emit("markers-was-change",n)}else B(e,o);this.markers=[],this.showAllMarkers&&this.myMap.setBounds(this.myMap.geoObjects.getBounds())},deleteMarkers:function(e){var t=this,o=[];this.myMap.geoObjects.each(function(n){return o.push(n)}),o.forEach(function(n){var r=[];if(t.useObjectManager)n.remove(e);else{var a,c=function(l){var s=l.properties.get("markerId");e.includes(s)&&r.push(l)};if(n.each)n.each(c),a=n.getLength();else if(n.getGeoObjects){var p=n.getGeoObjects();p.forEach(c),a=p.length}a===0||a===r.length?t.myMap.geoObjects.remove(n):r.length&&r.forEach(function(l){return n.remove(l)})}}),this.$emit("markers-was-delete",e)}},watch:{coordinates:function(e){this.myMap&&(this.disablePan?this.myMap.setCenter&&this.myMap.setCenter(e):this.myMap.panTo&&this.myMap.getZoom()&&this.myMap.panTo(e,{checkZoomRange:!0}))},zoom:function(){this.myMap.setZoom(this.zoom)},bounds:function(e){this.myMap.setBounds&&this.myMap.setBounds(e)}},render:function(){var e,t;return C("section",{class:"ymap-container",ref:"mapContainer"},[C("div",{id:this.ymapId,class:this.ymapClass,style:this.style}),this.isReady&&C("div",[(e=(t=this.$slots).default)===null||e===void 0?void 0:e.call(t)])])},mounted:function(){var e=this;if(this.$attrs["map-link"]||this.$attrs.mapLink)throw new Error("Vue-yandex-maps: Attribute mapLink is not supported. Use settings.");if(this.placemarks&&this.placemarks.length)throw new Error("Vue-yandex-maps: Attribute placemarks is not supported. Use marker component.");this.mapObserver=new MutationObserver(function(){e.myMap.container&&e.myMap.container.fitToViewport()});var t=this.$refs.mapContainer;if(this.mapObserver.observe(t,{attributes:!0,childList:!0,characterData:!0,subtree:!1}),_.scriptIsNotAttached){var o=this.debug;P(w(w(w({},this.$options.pluginOptions),this.settings),{},{debug:o}))}_.ymapReady?ymaps.ready(this.init):_.$on("scriptIsLoaded",this.init)},beforeUnmount:function(){var e;(e=this.myMap)!==null&&e!==void 0&&e.geoObjects&&this.myMap.geoObjects.removeAll()}},tt=["placemark","polyline","rectangle","polygon","circle"],et=["balloonclose","balloonopen","click","contextmenu","dblclick","drag","dragend","dragstart","hintclose","hintopen","mouseenter","mouseleave"],z={inject:["useObjectManager","addMarker","deleteMarker","compareValues","makeComponentBalloonTemplate"],props:{coords:Array,hintContent:String,icon:Object,balloon:Object,markerType:{type:String,validator:function(e){return tt.includes(e.toLowerCase())},default:"placemark"},markerFill:Object,markerStroke:Object,clusterName:[String,Number],circleRadius:{validator:function(e){return!Number.isNaN(e)},default:1e3},balloonTemplate:String,markerId:{type:[String,Number],required:!0},properties:Object,options:Object,balloonComponentProps:{type:Object,default:function(){return{}}},markerEvents:{type:Array,default:function(){return[]}}},data:function(){return{unwatchArr:[]}},render:function(){return this.$slots.balloon&&C("div",{style:"display: none;"},[this.$slots.balloon()])},mounted:function(){var e=this;Object.keys(this.$props).forEach(function(t){t!=="balloonComponentProps"&&e.unwatchArr.push(e.$watch(t,function(o,n){return e.compareValues({newVal:o,oldVal:n,marker:e.defineMarker()})}))}),this.addMarker(this.defineMarker())},methods:{defineMarker:function(){var e=this,t={markerId:this.markerId,markerType:this.markerType||"placemark",coords:N(this.coords),hintContent:this.hintContent,markerFill:this.markerFill,circleRadius:+this.circleRadius,clusterName:this.clusterName,markerStroke:this.markerStroke,balloon:this.balloon,properties:this.properties,options:this.options,balloonOptions:{}},o=null;this.balloonTemplate&&(o=ymaps.templateLayoutFactory.createClass(this.balloonTemplate)),this.$slots.balloon&&(o=ymaps.templateLayoutFactory.createClass(this.$slots.balloon()[0].elm.outerHTML)),this.makeComponentBalloonTemplate&&(o=this.makeComponentBalloonTemplate(this,t)),o!=null&&(t.balloonOptions.balloonContentLayout=o),this.icon&&["default#image","default#imageWithContent"].includes(this.icon.layout)?(t.iconContent=this.icon.content,t.iconLayout=this.icon.layout,t.iconImageHref=this.icon.imageHref,t.iconImageSize=this.icon.imageSize,t.iconImageOffset=this.icon.imageOffset,t.iconContentOffset=this.icon.contentOffset,this.icon.contentLayout&&typeof this.icon.contentLayout=="string"&&(t.iconContentLayout=ymaps.templateLayoutFactory.createClass(this.icon.contentLayout))):t.icon=this.icon;var n=function(i,m){var h=x(i);if(!m)return h;switch(h){case"Placemark":return"Point";case"Polyline":return"LineString";default:return h}}(t.markerType,this.useObjectManager),r={hintContent:t.hintContent,iconContent:t.icon?t.icon.content:t.iconContent,markerId:t.markerId},a=t.balloon?{balloonContentHeader:t.balloon.header,balloonContentBody:t.balloon.body,balloonContentFooter:t.balloon.footer}:{},c=Object.assign(r,a,t.properties),p=t.iconLayout?{iconLayout:t.iconLayout,iconImageHref:t.iconImageHref,iconImageSize:t.iconImageSize,iconImageOffset:t.iconImageOffset,iconContentOffset:t.iconContentOffset,iconContentLayout:t.iconContentLayout}:{preset:t.icon&&"islands#".concat(K(t),"Icon")},l=t.markerStroke?{strokeColor:t.markerStroke.color||"0066ffff",strokeOpacity:parseFloat(t.markerStroke.opacity)>=0?parseFloat(t.markerStroke.opacity):1,strokeStyle:t.markerStroke.style,strokeWidth:parseFloat(t.markerStroke.width)>=0?parseFloat(t.markerStroke.width):1}:{},s=t.markerFill?{fill:t.markerFill.enabled||!0,fillColor:t.markerFill.color||"0066ff99",fillOpacity:parseFloat(t.markerFill.opacity)>=0?parseFloat(t.markerFill.opacity):1,fillImageHref:t.markerFill.imageHref||""}:{},d=Object.assign(p,l,s,t.balloonOptions,t.options);n==="Circle"&&(t.coords=[t.coords,t.circleRadius]);var u=function(i,m){var h=m?{type:"Feature",id:i.properties.markerId,geometry:{type:i.markerType,coordinates:i.coords},properties:i.properties,options:i.options}:new ymaps[i.markerType](i.coords,i.properties,i.options);return h.clusterName=i.clusterName,h}({properties:c,options:d,markerType:n,coords:t.coords,clusterName:t.clusterName},this.useObjectManager,this.$emit);return this.useObjectManager||(this.markerEvents.length?this.markerEvents:et).forEach(function(i){return u.events.add(i,function(m){return e.$emit(i,m)})}),u}},beforeUnmount:function(){this.unwatchArr.forEach(function(e){return e()}),this.deleteMarker(this.markerId)}};g.install=function e(t){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};e.installed||(e.installed=!0,g.pluginOptions=o,t.component("yandex-map",g),t.component("ymap-marker",z))},typeof window<"u"&&window.Vue&&window.Vue.use(g);var nt=P,ot=g,rt=z;function at(e,t,o,n,r,a){const c=A("ymap-marker"),p=A("yandex-map"),l=D;return j(),S(l,null,{default:$(()=>[H(p,{class:"map",ref:"map",zoom:12,coords:a.coords,scroll:!1,scrollZoom:!1,showAllMarkers:o.items.length!==1,suppressMapOpenBlock:!0,controls:a.controls,settings:a.settings,"cluster-options":r.clusterOptions},{default:$(()=>[(j(!0),R(V,null,U(o.items,s=>(j(),S(c,{key:s.id,markerId:s.id,"marker-id":s.id,onClick:d=>a.selectMarker(s.id),"marker-type":s.type||"Placemark",coords:s.coords,icon:a.getIconByType(s),"cluster-name":"cluster",properties:{name:s.name,id:s.id}},null,8,["markerId","marker-id","onClick","marker-type","coords","icon","properties"]))),128))]),_:1},8,["coords","showAllMarkers","controls","settings","cluster-options"])]),_:1})}const it={components:{yandexMap:ot,ymapMarker:rt},data(){return{pointsToAdd:[],map:null,clusterOptions:{cluster:{clusterDisableClickZoom:!0,clusterOpenBalloonOnClick:!0,clusterBalloonLayout:["<ul class=map-cluster-list>","{% for geoObject in properties.geoObjects %}",`<li onclick="document.dispatchEvent(new CustomEvent('mapSelectMarker',{detail:{id: {{geoObject.properties.id}}}}))">{{ geoObject.properties.name  }}</li>`,"{% endfor %}","</ul>"].join("")}}}},props:{items:{type:Array,default:()=>[]},selectedId:{type:Number}},beforeMount(){this.items.length===1&&!this.$device.isMobile&&this.$emit("select",this.items[0].id),document.addEventListener("mapSelectMarker",this.selectMarker)},beforeUnmount(){document.removeEventListener("mapSelectMarker",this.selectMarker)},computed:{controls(){return this.$device.isMobile?[]:["zoomControl"]},coords(){return this.items.length>0?this.items[0].coords:[55.753288433844,37.628927841187]},settings(){return{lang:"ru_RU",coordorder:"latlong",version:"2.1",apiKey:this.$config.public.yandexApiKey}}},expose:["addRoute"],methods:{async addRoute(e){if(await nt({...this.settings,debug:!0}),!ymaps.ready)this.pointsToAdd.push(e);else try{ymaps.route(e,{mapStateAutoApply:!0}).then(t=>{t.getPaths().options.set({strokeColor:"#FA4022",strokeStyle:"dash"}),this.$refs.map.myMap.geoObjects.add(t);var o=t.getWayPoints();o.options.set("visible",!1)})}catch(t){console.log(t)}},selectMarker(e){typeof e=="object"&&(e=e.detail.id),this.$emit("select",e)},getIconByType(e){let t="/upload/icons/pin.svg";return this.selectedId&&(e==null?void 0:e.id)!==this.selectedId&&(t="/upload/icons/pinActive.svg"),{layout:"default#imageWithContent",imageHref:t,imageSize:[50,61],imageOffset:[-22,-55],...(e==null?void 0:e.number)&&{content:e.number,contentLayout:`
          <div class="marker-content">
            $[properties.iconContent]
          </div>
          `}}}},watch:{map:{handler(){if(this.map&&this.pointsToAdd.length)for(const e of this.pointsToAdd)this.addRoute(e)},immediate:!0},items:function(){setTimeout(()=>{this.$forceUpdate()},1e3)}}},ut=Z(it,[["render",at],["__scopeId","data-v-b9426d7c"]]);export{ut as _};
