mirror of
https://github.com/a2nt/silverstripe-webpack.git
synced 2024-10-22 17:05:31 +02:00
1 line
16 KiB
JavaScript
1 line
16 KiB
JavaScript
!function(e){var t={};function o(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,o),a.l=!0,a.exports}o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)o.d(n,a,function(t){return e[t]}.bind(null,a));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="app/client/dist",o(o.s="./app/client/src/js/types/Site.Controllers.MapElementController.js")}({"./app/client/src/js/_consts.js":function(e,t,o){"use strict";var n={ENVS:["xs","sm","md","lg","xl","xxl","xxxl"],MAP_DRIVER:o("./node_modules/.pnpm/@a2nt/ss-bootstrap-ui-webpack-boilerplate@2.6.3/node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/src/js/_components/drivers/_map.google.js").a};t.a=n},"./app/client/src/js/types/Site.Controllers.MapElementController.js":function(e,t,o){"use strict";o.r(t);var n=o("jquery"),a=o.n(n),r=o("./node_modules/.pnpm/@a2nt/ss-bootstrap-ui-webpack-boilerplate@2.6.3/node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/src/js/_events.js"),i=o.n(r);o("./node_modules/.pnpm/@a2nt/ss-bootstrap-ui-webpack-boilerplate@2.6.3/node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/src/js/_components/_ui.map.api.js");function s(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)}}var l=function(e){var t=window,o=(document,e("body")),n="LocationUI",a=function(){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t)}var a,r,l;return a=t,l=[{key:"init",value:function(){this.dispose(),console.log("Initializing: ".concat(n))}},{key:"initMap",value:function(){e(".mapAPI-map-container").find(".marker").on("".concat(i.a.MAPMARKERCLICK),(function(t){var n=e(t.currentTarget).data("id");o.find(".locations .location").removeClass("active"),o.find('.locations .location[data-id="'.concat(n,'"]')).addClass("active")})),o.find(".locations .location").on("click",(function(t){var n=e(t.currentTarget).data("id");o.find("#Marker".concat(n)).click()})),e(".mapAPI-map-container").on(i.a.MAPPOPUPCLOSE,(function(e){o.find(".locations .location").removeClass("active")}))}},{key:"dispose",value:function(){console.log("Destroying: ".concat(n))}}],(r=null)&&s(a.prototype,r),l&&s(a,l),t}();return e(t).on("".concat(i.a.AJAX," ").concat(i.a.LOADED),(function(){a.init()})),e(t).on(i.a.MAPLOADED,(function(){a.initMap()})),a}(a.a);t.default=l},"./node_modules/.pnpm/@a2nt/ss-bootstrap-ui-webpack-boilerplate@2.6.3/node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/src/js/_components/_ui.map.api.js":function(e,t,o){"use strict";(function(e){var t=o("jquery"),n=o.n(t),a=o("./node_modules/.pnpm/@a2nt/ss-bootstrap-ui-webpack-boilerplate@2.6.3/node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/src/js/_events.js"),r=o.n(a),i=(o("./node_modules/.pnpm/@a2nt/ss-bootstrap-ui-webpack-boilerplate@2.6.3/node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/src/scss/_components/_ui.map.scss"),o("./app/client/src/js/_consts.js"));function s(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(t){var o="jsMapAPI",n=o,a=t("body"),l=i.a.MAP_DRIVER,c=window,p=function(){function i(s){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i);var c=this,p=new l;c.$el=t(s);var u=c.$el,d=u.data();d.center=[d.lng?d.lng:a.data("default-lng"),d.lat?d.lat:a.data("default-lat")],d.style=d.style?e.parseJSON(d.style):null,d["font-family"]=a.css("font-family"),d.icon||(d.icon='<i class="fas fa-map-marker-alt"></i>'),console.log("".concat(o,": init ").concat(p.getName(),"...")),p.init(u,d),c.drv=p,u.on(r.a.MAPAPILOADED,(function(e){if(c.map=p.getMap(),d.geojson)console.log("".concat(o,": setting up geocode data")),p.addGeoJson(d);else if(d.address)console.log(d.address),console.log("".concat(o,": setting up address marker")),p.geocode(d.address,(function(e){console.log(e);var t=e[0].geometry.location.lat(),n=e[0].geometry.location.lng();console.log("".concat(o,": setting up single lat/lng marker lat: ").concat(t," lng: ").concat(n)),p.addMarker([n,t],d),c.map.setCenter({lat:t,lng:n})}));else if(d.lat&&d.lng){var t=d.lat,a=d.lng;console.log("".concat(o,": setting up single lat/lng marker lat: ").concat(t," lng: ").concat(a)),p.addMarker([a,t],d)}u.data(n,c),u.addClass("".concat(o,"-active")),u.trigger(r.a.MAPLOADED),console.log("".concat(o,": Map is loaded"))}))}var p,u,d;return p=i,d=[{key:"_jQueryInterface",value:function(){if("undefined"!==typeof c.localStorage)return this.each((function(){var e=t(this),o=e.data(n);o||(o=new i(this),e.data(n,o))}))}}],(u=[{key:"getMap",value:function(){return ui.map}},{key:"dispose",value:function(){var e=this;e.$el=null,t.removeData(e.$el[0],n),e.$el.removeClass("".concat(o,"-active"))}}])&&s(p.prototype,u),d&&s(p,d),i}();t.fn[o]=p._jQueryInterface,t.fn[o].Constructor=p,t.fn[o].noConflict=function(){return t.fn[o]=JQUERY_NO_CONFLICT,p._jQueryInterface},t(c).on("".concat(r.a.AJAX," ").concat(r.a.LOADED),(function(){t(".mapAPI-map-container").jsMapAPI()}))}(n.a)}).call(this,o("jquery"))},"./node_modules/.pnpm/@a2nt/ss-bootstrap-ui-webpack-boilerplate@2.6.3/node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/src/js/_components/drivers/_map.google.js":function(e,t,o){"use strict";var n=o("jquery"),a=o.n(n),r=o("./node_modules/.pnpm/@a2nt/ss-bootstrap-ui-webpack-boilerplate@2.6.3/node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/src/js/_events.js"),i=o.n(r),s=o("./node_modules/.pnpm/@a2nt/ss-bootstrap-ui-webpack-boilerplate@2.6.3/node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/src/js/_components/drivers/_map.google.marker.js");function l(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)}}var c,p=(c=a.a,function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}var t,o,n;return t=e,(o=[{key:"getName",value:function(){return"GoogleMapsDriver"}},{key:"init",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=this,n=window;o.$el=e,o.config=t,o.markers=[],n["init".concat(o.getName())]=function(){o.googleApiLoaded()},c("body").append('<script async defer src="https://maps.googleapis.com/maps/api/js?key='.concat(t.key,"&callback=init").concat(o.getName(),'"><\/script>'))}},{key:"googleApiLoaded",value:function(){var e=this,t=e.$el,o=e.config,n=t.find(".mapAPI-map"),a=o.mapZoom?o.mapZoom:10,r=o.center?{lat:o.center[1],lng:o.center[0]}:{lat:0,lng:0},l=o.style?o.style:null;console.log("".concat(e.getName(),": API is loaded")),e.MarkerUI=s.a.init(c),e.map=new google.maps.Map(n[0],{zoom:a,center:r,fullscreenControl:!0,styles:l}),e.default_zoom=a,n.addClass("mapboxgl-map"),e.popup=new e.MarkerUI({map:e.map,align:["center","top"],divClass:"mapboxgl-popup popup mapboxgl-popup-anchor-bottom d-none",html:'<div class="mapboxgl-popup-tip"></div><div class="mapboxgl-popup-content"><div class="mapboxgl-popup-close-button" type="button" aria-label="Close popup">\xd7</div><div class="html"></div></div>'}),e.geocoder=new google.maps.Geocoder,t.trigger(i.a.MAPAPILOADED)}},{key:"addMarker",value:function(e,t){var o=this,n={lat:e[1],lng:e[0]},a=new o.MarkerUI({position:n,map:o.map,align:["center","top"],html:'<div class="mapboxgl-marker"><div id="Marker'.concat(t.id,'" data-id="').concat(t.id,'" class="marker">').concat(t.icon,"</div></div>"),onClick:function(){var e=c("#Marker".concat(t.id));o.showPopup(n,t.content),e.trigger(i.a.MAPMARKERCLICK)}});return o.markers.push(a),a}},{key:"showPopup",value:function(e,t){var o=this,n=c(o.popup.getDiv());o.config.flyToMarker&&(o.map.setCenter(e),o.config.noZoom||o.map.setZoom(18)),n.css({opacity:"0"}),n.removeClass("d-none"),n.find(".mapboxgl-popup-content .html").html(t),n.find(".mapboxgl-popup-close-button").on("click",(function(e){e.preventDefault(),o.hidePopup()})),o.popup.setPosition(e,["center","top"]),n.css({"margin-top":"-1rem",opacity:"1"})}},{key:"hidePopup",value:function(){var e=this;c(e.popup.getDiv()).addClass("d-none"),e.config.noRestoreBounds&&!e.config.flyToBounds||e.restoreBounds(),e.$el.trigger(i.a.MAPPOPUPCLOSE)}},{key:"geocode",value:function(e,t){var o=this;o.geocoder.geocode({address:e},(function(e,n){if("OK"===n)return"function"===typeof t&&t(e),e;console.error("".concat(o.getName(),": Geocode was not successful for the following reason: ").concat(n))}))}},{key:"reverseGeocode",value:function(e,t){var o=this;o.geocoder.geocode({location:latlng},(function(e,n){if("OK"===n)return"function"===typeof t&&t(e),e;console.error("".concat(o.getName(),": Reverse Geocoding was not successful for the following reason: ").concat(n))}))}},{key:"addGeoJson",value:function(e){var t=this,o=(e.geojson.features[0].geometry.coordinates,new google.maps.LatLngBounds);e.geojson.features.forEach((function(n){var a=n.id,r=n.geometry.coordinates,i=n.properties.content;t.addMarker(r,{id:a,content:i,icon:n.icon,flyToMarker:e.flyToMarker}),o.extend({lat:r[1],lng:r[0]})})),t.markers.length>1?t.map.fitBounds(o,{padding:30}):t.markers[0]&&t.map.setCenter(t.markers[0].getPosition()),t.default_bounds=o,t.default_zoom=t.map.getZoom()}},{key:"getMap",value:function(){return this.map}},{key:"getPopup",value:function(){return this.popup}},{key:"restoreBounds",value:function(){var e=this;e.default_bounds&&e.markers.length>1?e.map.fitBounds(e.default_bounds,{padding:30}):(e.markers[0]&&e.map.setCenter(e.markers[0].getPosition()),e.restoreZoom())}},{key:"restoreZoom",value:function(){this.map.setZoom(this.default_zoom)}}])&&l(t.prototype,o),n&&l(t,n),e}());t.a=p},"./node_modules/.pnpm/@a2nt/ss-bootstrap-ui-webpack-boilerplate@2.6.3/node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/src/js/_components/drivers/_map.google.marker.js":function(e,t,o){"use strict";(function(e){function o(e){return(o="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(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 a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function r(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var o,n=l(e);if(t){var a=l(this).constructor;o=Reflect.construct(n,arguments,a)}else o=n.apply(this,arguments);return i(this,o)}}function i(e,t){return!t||"object"!==o(t)&&"function"!==typeof t?s(e):t}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}var c={init:function(){return function(t){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&a(e,t)}(p,google.maps.OverlayView);var o,i,l,c=r(p);function p(e){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p);var o=s(t=c.call(this));return o.setMap(e.map),o.position=e.position,o.html=e.html?e.html:'<div class="mapboxgl-marker"><i class="marker-icon fas fa-map-marker-alt"></i></div>',o.divClass=e.divClass,o.align=e.align,o.isDebugMode=e.debug,o.onClick=e.onClick,o.onMouseOver=e.onMouseOver,o.isBoolean=function(e){return"boolean"===typeof e},o.isNotUndefined=function(e){return"undefined"!==typeof e},o.hasContent=function(e){return e.length>0},o.isString=function(e){return"string"===typeof e},o.isFunction=function(e){return"function"===typeof e},t}return o=p,(i=[{key:"onAdd",value:function(){var e=this;e.div=document.createElement("div"),e.div.style.position="absolute",e.isNotUndefined(e.divClass)&&e.hasContent(e.divClass)&&(e.div.className=e.divClass),e.isNotUndefined(e.html)&&e.hasContent(e.html)&&e.isString(e.html)&&(e.div.innerHTML=e.html),e.isBoolean(e.isDebugMode)&&e.isDebugMode&&(e.div.className="debug-mode",e.div.innerHTML='<div style="height: 10px; width: 10px; background: red; border-radius: 100%;"></div><div style="position: absolute; top: 5px; padding: 5px; width: 130px; text-align: center; font-size: 18px; text-transform: uppercase; font-weight: bolder; background: red; color: white; font-family: Arial;">Debug mode</div>',e.div.setAttribute("style","position: absolute;border: 5px dashed red;height: 150px;width: 150px;display: flex;justify-content: center;align-items: center;")),e.getPanes().overlayMouseTarget.appendChild(e.div),google.maps.event.addDomListener(e.div,"click",(function(t){google.maps.event.trigger(e,"click"),e.isFunction(e.onClick)&&e.onClick(),t.stopPropagation()})),google.maps.event.addDomListener(e.div,"mouseover",(function(t){google.maps.event.trigger(e,"mouseover"),e.isFunction(e.onMouseOver)&&e.onMouseOver(),t.stopPropagation()}))}},{key:"draw",value:function(){var t=this,o=e(t.div).find(".mapboxgl-marker,.marker-pin,.mapboxgl-popup,.popup");o.length||(o=e(t.div));var n=t.getProjection().fromLatLngToDivPixel(new google.maps.LatLng(t.position)),a={y:void 0,x:void 0},r=o.outerWidth(),i=o.outerHeight();switch(Array.isArray(t.align)?t.align.join(" "):""){case"left top":a.y=i,a.x=r;break;case"left center":a.y=i/2,a.x=r;break;case"left bottom":a.y=0,a.x=r;break;case"center top":a.y=i,a.x=r/2;break;case"center center":a.y=i/2,a.x=r/2;break;case"center bottom":a.y=0,a.x=r/2;break;case"right top":a.y=i,a.x=0;break;case"right center":a.y=i/2,a.x=0;break;case"right bottom":a.y=0,a.x=0;break;default:a.y=i/2,a.x=r/2}t.div.style.top="".concat(n.y-a.y,"px"),t.div.style.left="".concat(n.x-a.x,"px")}},{key:"getPosition",value:function(){return this.position}},{key:"getDiv",value:function(){return this.div}},{key:"setPosition",value:function(e,t){var o=this;o.position=e,o.align=t,o.draw()}}])&&n(o.prototype,i),l&&n(o,l),p}()}};t.a=c}).call(this,o("jquery"))},"./node_modules/.pnpm/@a2nt/ss-bootstrap-ui-webpack-boilerplate@2.6.3/node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/src/js/_events.js":function(e,t){e.exports={AJAX:"ajax-load",AJAXMAIN:"ajax-main-load",MAININIT:"main-init",TABHIDDEN:"tab-hidden",TABFOCUSED:"tab-focused",OFFLINE:"offline",ONLINE:"online",BACKONLINE:"back-online",TOUCHENABLE:"touch-enabled",TOUCHDISABLED:"touch-disabled",LOADED:"load",SWIPELEFT:"swipeleft panleft",SWIPERIGHT:"swiperight panright",ALLERTAPPEARED:"alert-appeared",ALERTREMOVED:"alert-removed",LODEDANDREADY:"load-ready",LAZYIMAGEREADY:"image-lazy-bg-loaded",LAZYIMAGESREADY:"images-lazy-loaded",MAPLOADED:"map-loaded",MAPAPILOADED:"map-api-loaded",MAPMARKERCLICK:"map-marker-click",MAPPOPUPCLOSE:"map-popup-close",SCROLL:"scroll",RESIZE:"resize",CAROUSEL_READY:"bs.carousel.ready",SET_TARGET_UPDATE:"set-target-update",RESTORE_FIELD:"restore-field",FORM_INIT_BASICS:"form-basics",FORM_INIT_STEPPED:"form-init-stepped",FORM_INIT_VALIDATE:"form-init-validate",FORM_INIT_VALIDATE_FIELD:"form-init-validate-field",FORM_INIT_STORAGE:"form-init-storage",FORM_VALIDATION_FAILED:"form-validation-failed",FORM_STEPPED_NEW_STEP:"form-new-step",FORM_STEPPED_FIRST_STEP:"form-first-step",FORM_STEPPED_LAST_STEP:"form-last-step",FORM_FIELDS:"input,textarea,select"}},"./node_modules/.pnpm/@a2nt/ss-bootstrap-ui-webpack-boilerplate@2.6.3/node_modules/@a2nt/ss-bootstrap-ui-webpack-boilerplate/src/scss/_components/_ui.map.scss":function(e,t,o){},jquery:function(e,t){e.exports=jQuery}}); |