Mini Shell

Direktori : /home/brasafestival/www/old/wp-content/plugins/jetpack/_inc/blocks/map/
Upload File :
Current File : /home/brasafestival/www/old/wp-content/plugins/jetpack/_inc/blocks/map/view.js

!function(){var t={90055:function(t,e,o){"use strict";function i(t,e){return{default:{details:"mapbox://styles/automattic/cjolkhmez0qdd2ro82dwog1in",no_details:"mapbox://styles/automattic/cjolkci3905d82soef4zlmkdo"},black_and_white:{details:"mapbox://styles/automattic/cjolkixvv0ty42spgt2k4j434",no_details:"mapbox://styles/automattic/cjolkgc540tvj2spgzzoq37k4"},satellite:{details:"mapbox://styles/mapbox/satellite-streets-v10",no_details:"mapbox://styles/mapbox/satellite-v9"},terrain:{details:"mapbox://styles/automattic/cjolkf8p405fh2soet2rdt96b",no_details:"mapbox://styles/automattic/cjolke6fz12ys2rpbpvgl12ha"}}[t][e?"details":"no_details"]}o.d(e,{h:function(){return i}})},84634:function(t,e,o){"use strict";o.d(e,{YB:function(){return n},b2:function(){return i},k:function(){return r},sy:function(){return s},xt:function(){return l},zb:function(){return a}});const i=t=>t.hasOwnProperty("lat")&&t.hasOwnProperty("lng")?t:{lat:t.latitude||0,lng:t.longitude||0};function n(t,e){const o=new t.LngLatBounds;return e.forEach((t=>{o.extend([t.coordinates.longitude,t.coordinates.latitude])})),o}function r(t,e){t.fitBounds(e,{padding:{top:80,bottom:80,left:40,right:40}})}function s(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e)t.style.height=e+"px";else{const e=t.offsetWidth,o=window.location.search.indexOf("map-block-counter")>-1?window.innerHeight:.8*window.innerHeight,i=Math.min(e*(3/4),o);t.style.height=i+"px"}}function a(t,e){t.innerHTML=`\n\t\t<?xml version="1.0" encoding="UTF-8"?>\n\t\t<svg version="1.1" viewBox="0 0 32 38" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">\n\t\t\t<g fill-rule="evenodd">\n\t\t\t\t<path id="d" d="m16 38s16-11.308 16-22-7.1634-16-16-16-16 5.3076-16 16 16 22 16 22z" fill="${e}"/>\n\t\t\t</g>\n\t\t</svg>\n\t`}function l(t){return new t.Popup({closeButton:!0,closeOnClick:!1,offset:{left:[0,0],top:[0,5],right:[0,0],bottom:[0,-40]}})}},85007:function(t,e,o){"use strict";function i(t){const e=t.ownerDocument;return{currentDoc:e,currentWindow:e.defaultView||e.parentWindow}}function n(t,e,o){const n=`${window.Jetpack_Block_Assets_Base_Url.url}editor-assets`,{currentDoc:r}=i(o),s=r.getElementsByTagName("head")[0];t.forEach((t=>{const[o,i]=t.file.split("/").pop().split(".");if("css"===i){if(r.getElementById(t.id))return;const e=r.createElement("link");e.id=t.id,e.rel="stylesheet",e.href=`${n}/${o}-${t.version}.${i}`,s.appendChild(e)}if("js"===i){const a=e[t.id]?e[t.id]:null;if(r.getElementById(t.id))return a();const l=r.createElement("script");l.id=t.id,l.type="text/javascript",l.src=`${n}/${o}-${t.version}.${i}`,l.onload=a,s.appendChild(l)}}))}function r(t,e){return new Promise((o=>{const i=()=>{t[e]?o(t[e]):t.requestAnimationFrame(i)};i()}))}o.d(e,{Dz:function(){return r},Pp:function(){return n},bL:function(){return i}})},24393:function(t,e,o){"use strict";function i(t,e){let o;return function(){for(var i=arguments.length,n=new Array(i),r=0;r<i;r++)n[r]=arguments[r];clearTimeout(o),o=setTimeout((()=>t.apply(this,n)),e)}}o.d(e,{D:function(){return i}})},80425:function(t,e,o){"object"==typeof window&&window.Jetpack_Block_Assets_Base_Url&&window.Jetpack_Block_Assets_Base_Url.url&&(o.p=window.Jetpack_Block_Assets_Base_Url.url)},47701:function(t){"use strict";t.exports=window.wp.domReady},90017:function(t,e,o){var i=o(96930);t.exports=function(t,e,o){return(e=i(e))in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t},t.exports.__esModule=!0,t.exports.default=t.exports},45061:function(t,e,o){var i=o(73522).default;t.exports=function(t,e){if("object"!==i(t)||null===t)return t;var o=t[Symbol.toPrimitive];if(void 0!==o){var n=o.call(t,e||"default");if("object"!==i(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)},t.exports.__esModule=!0,t.exports.default=t.exports},96930:function(t,e,o){var i=o(73522).default,n=o(45061);t.exports=function(t){var e=n(t,"string");return"symbol"===i(e)?e:String(e)},t.exports.__esModule=!0,t.exports.default=t.exports},73522:function(t){function e(o){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(o)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},45388:function(t){"use strict";t.exports=JSON.parse('[{"id":"mapbox-gl-js","file":"node_modules/mapbox-gl/dist/mapbox-gl.js","version":"1.13.0"},{"id":"mapbox-gl-css","file":"node_modules/mapbox-gl/dist/mapbox-gl.css","version":"1.13.0"}]')}},e={};function o(i){var n=e[i];if(void 0!==n)return n.exports;var r=e[i]={exports:{}};return t[i](r,r.exports,o),r.exports}o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,{a:e}),e},o.d=function(t,e){for(var i in e)o.o(e,i)&&!o.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},function(){var t;o.g.importScripts&&(t=o.g.location+"");var e=o.g.document;if(!t&&e&&(e.currentScript&&(t=e.currentScript.src),!t)){var i=e.getElementsByTagName("script");i.length&&(t=i[i.length-1].src)}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),o.p=t+"../"}(),function(){"use strict";o(80425)}(),function(){"use strict";var t=o(90017),e=o.n(t),i=o(47701),n=o.n(i),r=o(85007),s=o(24393),a=o(45388),l=o(90055),c=o(84634);class u{constructor(t){let o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:()=>{};e()(this,"sizeMap",(()=>{(0,c.sy)(this.container,this.mapHeight),this.map.resize(),this.setBoundsByMarkers()})),e()(this,"closeInfoWindow",(()=>{this.activeMarker=null,this.infoWindow.remove()})),this.root=t;const{currentDoc:i,currentWindow:n}=(0,r.bL)(this.root);this.document=i,this.window=n,this.onError=o,this.mapStyle=this.root.getAttribute("data-map-style")||"default",this.mapDetails="true"===this.root.getAttribute("data-map-details"),this.apiKey=this.root.getAttribute("data-api-key")||null,this.scrollToZoom="true"===this.root.getAttribute("data-scroll-to-zoom"),this.showFullscreenButton="true"===this.root.getAttribute("data-show-fullscreen-button"),this.points=JSON.parse(this.root.getAttribute("data-points")||"[]"),this.mapCenter=JSON.parse(this.root.getAttribute("data-map-center")||"{}"),this.mapHeight=this.root.getAttribute("data-map-height")||null,this.markerColor=this.root.getAttribute("data-marker-color")||"red";const s=this.root.getAttribute("data-zoom");this.zoom=s&&s.length?parseInt(this.root.getAttribute("data-zoom"),10):13,this.activeMarker=null;const a=this.root.querySelector("ul");if(a&&(a.style.display="none"),!this.apiKey||!this.apiKey.length)throw new Error("API key missing")}initDOM(){this.root.innerHTML='<div class="wp-block-jetpack-map__gm-container"></div>',this.container=this.root.querySelector(".wp-block-jetpack-map__gm-container")}loadMapLibraries(){return new Promise((t=>{const e={"mapbox-gl-js":()=>{(0,r.Dz)(this.window,"mapboxgl").then((e=>{this.mapboxgl=e,e.accessToken=this.apiKey,t(e)}))}};(0,r.Pp)(a,e,this.root)}))}initMap(){try{this.map=new this.mapboxgl.Map({container:this.container,style:(0,l.h)(this.mapStyle,this.mapDetails),center:(0,c.b2)(this.mapCenter),zoom:this.zoom,pitchWithRotate:!1,attributionControl:!1,dragRotate:!1})}catch(t){return void this.onError("mapbox_error",t.message)}this.scrollToZoom||this.map.scrollZoom.disable(),this.showFullscreenButton&&this.map.addControl(new this.mapboxgl.FullscreenControl),this.map.on("error",(t=>{this.onError("mapbox_error",t.error.message)})),this.zoomControl=new this.mapboxgl.NavigationControl({showCompass:!1,showZoom:!0})}initInfoWindow(){this.infoWindowContent=this.document.createElement("div"),this.infoWindow=(0,c.xt)(this.mapboxgl),this.infoWindow.setDOMContent(this.infoWindowContent)}setBoundsByMarkers(){if(!this.map)return;if(this.map.dragPan.enable(),!this.points.length)return;if(this.activeMarker)return;const t=(0,c.YB)(this.mapboxgl,this.points);this.points.length>1?(0,c.k)(this.map,t):(this.map.setCenter(t.getCenter()),this.map.addControl(this.zoomControl))}initMapSize(){this.setBoundsByMarkers(),this.debouncedSizeMap=(0,s.D)(this.sizeMap,250),this.debouncedSizeMap()}initHandlers(){this.map.getCanvas().addEventListener("click",this.closeInfoWindow),window.addEventListener("resize",this.debouncedSizeMap)}showInfoWindow(t,e){const o=[e.coordinates.longitude,e.coordinates.latitude];this.activeMarker=t,this.infoWindowContent.innerHTML="<h3></h3><p></p>",this.infoWindowContent.querySelector("h3").textContent=e.title,this.infoWindowContent.querySelector("p").textContent=e.caption,this.infoWindow.setLngLat(o).addTo(this.map)}initMarkers(){this.points.forEach((t=>{const e=[t.coordinates.longitude,t.coordinates.latitude],o=this.document.createElement("div");o.className="wp-block-jetpack-map-marker";const i=new this.mapboxgl.Marker(o).setLngLat(e).setOffset([0,-19]).addTo(this.map);i.getElement().addEventListener("click",(()=>this.showInfoWindow(i,t))),(0,c.zb)(o,this.markerColor)}))}async init(){this.initDOM(),await this.loadMapLibraries(),this.initMap(),this.initInfoWindow(),this.initMapSize(),this.initHandlers(),this.initMarkers()}}n()((function(){Array.from(document.querySelectorAll(".wp-block-jetpack-map")).forEach((async t=>{try{new u(t).init()}catch{}}))}))}()}();

Zerion Mini Shell 1.0