!function(e){var t={};function n(a){if(t[a])return t[a].exports;var l=t[a]={i:a,l:!1,exports:{}};return e[a].call(l.exports,l,l.exports,n),l.l=!0,l.exports}n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:a})},n.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){},function(e,t,n){var a;
/*!
  Copyright (c) 2016 Jed Watson.
  Licensed under the MIT License (MIT), see
  http://jedwatson.github.io/classnames
*/
/*!
  Copyright (c) 2016 Jed Watson.
  Licensed under the MIT License (MIT), see
  http://jedwatson.github.io/classnames
*/
!function(){"use strict";var n={}.hasOwnProperty;function l(){for(var e=[],t=0;t<arguments.length;t++){var a=arguments[t];if(a){var o=typeof a;if("string"===o||"number"===o)e.push(a);else if(Array.isArray(a))e.push(l.apply(null,a));else if("object"===o)for(var i in a)n.call(a,i)&&a[i]&&e.push(i)}}return e.join(" ")}void 0!==e&&e.exports?e.exports=l:void 0===(a=function(){return l}.apply(t,[]))||(e.exports=a)}()},function(e,t,n){"use strict";n.r(t);n(0);var a={pantheon:wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20px",height:"20px",viewBox:"0 0 330.26 320"},wp.element.createElement("defs",null,wp.element.createElement("rect",{className:"a",width:"330.26",height:"320"}),wp.element.createElement("polygon",{className:"b",points:"118.24 19.41 144.08 80 111.19 80 122.07 106.67 188.72 106.67 118.24 19.41"}),wp.element.createElement("polygon",{className:"b",points:"205.87 240 194.87 213.33 179.62 213.33 157.83 162.05 144.16 162.05 165.93 213.33 127.18 213.33 198.83 300.6 172.99 240 205.87 240"}),wp.element.createElement("path",{d:"M214.75,133.1c0.81,0,2.69-1,2.69-10.27s-1.88-10.26-2.69-10.26H168.84l8.71,20.53h37.2Z",transform:"translate(0 .25)"}),wp.element.createElement("path",{d:"M188,157.71h30.84c0.82,0,2.69-1,2.69-10.27s-1.88-10.26-2.69-10.26H179.29Z",transform:"translate(0 .25)"}),wp.element.createElement("path",{d:"M214.75,186.42H173.27L182,206.94h32.77c0.81,0,2.69-1,2.69-10.26S215.55,186.42,214.75,186.42Z",transform:"translate(0 .25)"}),wp.element.createElement("path",{d:"M218.84,161.8h-56l8.71,20.53h47.31c0.82,0,2.69-1,2.69-10.26S219.66,161.8,218.84,161.8Z",transform:"translate(0 .25)"}),wp.element.createElement("path",{d:"M214.75,186.42H173.27L182,206.94h32.77c0.81,0,2.69-1,2.69-10.26S215.55,186.42,214.75,186.42Z",transform:"translate(0 .25)"}),wp.element.createElement("path",{d:"M218.84,161.8h-56l8.71,20.53h47.31c0.82,0,2.69-1,2.69-10.26S219.66,161.8,218.84,161.8Z",transform:"translate(0 .25)"}),wp.element.createElement("path",{d:"M156.09,157.71l-10.45-24.62h5l10.45,24.62h22.19L164.1,112.57H116.26c-3.69,0-5.71,0-7.37,5.34-2,6.38-2.22,18.41-2.22,41.84s0.23,35.46,2.22,41.84c1.66,5.34,3.68,5.34,7.37,5.34h42l-20.8-49.24h18.66Z",transform:"translate(0 .25)"}),wp.element.createElement("path",{d:"M223.87,200.92a8.19,8.19,0,0,1,.68-3.32,8.68,8.68,0,0,1,4.54-4.54,8.46,8.46,0,0,1,6.63,0,8.68,8.68,0,0,1,4.54,4.54,8.46,8.46,0,0,1,0,6.63,8.68,8.68,0,0,1-4.54,4.54,8.46,8.46,0,0,1-6.63,0,8.68,8.68,0,0,1-4.54-4.54A8.19,8.19,0,0,1,223.87,200.92Zm1.51,0a6.86,6.86,0,0,0,.55,2.73,7,7,0,0,0,3.74,3.74,7,7,0,0,0,5.46,0,7,7,0,0,0,3.74-3.74,7,7,0,0,0,0-5.46,7,7,0,0,0-3.74-3.74,7,7,0,0,0-5.46,0,7,7,0,0,0-3.74,3.74A6.86,6.86,0,0,0,225.39,200.92Zm3.74-4.93h3.76a3.8,3.8,0,0,1,2.6.76,2.79,2.79,0,0,1,.84,2.18,2.58,2.58,0,0,1-.66,1.93,2.75,2.75,0,0,1-1.66.76l2.52,4.13h-1.88l-2.43-4h-1.31v4h-1.79V196Zm1.79,4.25h1.31q0.41,0,.83,0a2.48,2.48,0,0,0,.75-0.17,1.26,1.26,0,0,0,.54-0.41,1.49,1.49,0,0,0,0-1.51,1.26,1.26,0,0,0-.54-0.41,2.27,2.27,0,0,0-.75-0.16l-0.83,0h-1.31v2.73Z",transform:"translate(0 .25)"}))),googleMap:wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 48 48",width:"20",height:"20"},wp.element.createElement("g",{id:"surface1"},wp.element.createElement("path",{d:"M 42 39 L 42 9 C 42 7.34375 40.65625 6 39 6 L 9 6 C 7.34375 6 6 7.34375 6 9 L 6 39 C 6 40.65625 7.34375 42 9 42 L 39 42 C 40.65625 42 42 40.65625 42 39 Z",fill:"#1c9957"}),wp.element.createElement("path",{d:"M 9 42 L 39 42 C 40.65625 42 24 26 24 26 C 24 26 7.34375 42 9 42 Z",fill:"#3e7bf1"}),wp.element.createElement("path",{d:"M 42 39 L 42 9 C 42 7.34375 26 24 26 24 C 26 24 42 40.65625 42 39 Z",fill:"#cbccc9"}),wp.element.createElement("path",{d:"M 39 42 C 40.65625 42 42 40.65625 42 39 L 42 38.753906 L 26.246094 23 L 23 26.246094 L 38.753906 42 Z",fill:"#efefef"}),wp.element.createElement("path",{d:"M 42 9 C 42 7.34375 40.65625 6 39 6 L 38.753906 6 L 6 38.753906 L 6 39 C 6 40.65625 7.34375 42 9 42 L 9.246094 42 L 42 9.246094 Z",fill:"#ffd73d"}),wp.element.createElement("path",{d:"M 36 2 C 30.476563 2 26 6.476563 26 12 C 26 18.8125 33.664063 21.296875 35.332031 31.851563 C 35.441406 32.53125 35.449219 33 36 33 C 36.550781 33 36.558594 32.53125 36.667969 31.851563 C 38.335938 21.296875 46 18.8125 46 12 C 46 6.476563 41.523438 2 36 2 Z",fill:"#d73f35"}),wp.element.createElement("path",{d:"M 39.5 12 C 39.5 13.933594 37.933594 15.5 36 15.5 C 34.066406 15.5 32.5 13.933594 32.5 12 C 32.5 10.066406 34.066406 8.5 36 8.5 C 37.933594 8.5 39.5 10.066406 39.5 12 Z",fill:"#752622"}),wp.element.createElement("path",{d:"M 14.492188 12.53125 L 14.492188 14.632813 L 17.488281 14.632813 C 17.09375 15.90625 16.03125 16.816406 14.492188 16.816406 C 12.660156 16.816406 11.175781 15.332031 11.175781 13.5 C 11.175781 11.664063 12.660156 10.179688 14.492188 10.179688 C 15.316406 10.179688 16.070313 10.484375 16.648438 10.980469 L 18.195313 9.433594 C 17.21875 8.542969 15.921875 8 14.492188 8 C 11.453125 8 8.992188 10.464844 8.992188 13.5 C 8.992188 16.535156 11.453125 19 14.492188 19 C 19.304688 19 20.128906 14.683594 19.675781 12.539063 Z",fill:"#fff"})))};function l(e,t){var n=e.interactive;if(""===t||void 0===t)return null;var a=function(e,t){var n=e.location,a=e.mapType,l=e.zoom,o=e.interactive,i=e.maxHeight,r=e.maxWidth;return""===t||void 0===t?null:o?"https://www.google.com/maps/embed/v1/place?key="+t+"&q="+encodeURI(n)+"&zoom="+l+"&maptype="+a:"https://maps.googleapis.com/maps/api/staticmap?center="+encodeURI(n)+"&zoom="+l+"&size="+r+"x"+i+"&maptype="+a+"&key="+t}(e,t);return n?wp.element.createElement("iframe",{width:"100%",height:"100%",frameBorder:"0",style:{border:0},src:a,allowFullScreen:!0}):wp.element.createElement("img",{src:a})}var o=n(1),i=n.n(o),r=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}();var s=wp.i18n.__,p=wp.editor.InspectorControls,c=wp.components,m=c.Button,u=c.TextControl,h=c.ToggleControl,d=c.RangeControl,g=c.SelectControl,f=wp.element,y=f.Component,v=f.Fragment,w=void 0;wp.api.loadPromise.then(function(){w=new wp.api.models.Settings});var b=function(e){function t(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var e=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.saveApiKey=e.saveApiKey.bind(e),e.state={apiKey:PantheonGoogleMapsData.APIKey,isSavedKey:""!==PantheonGoogleMapsData.APIKey,isLoading:PantheonGoogleMapsData.userCanManageOptions,APIKeyConstantDefined:!!PantheonGoogleMapsData.APIKeyConstantDefined,userCanManageOptions:!!PantheonGoogleMapsData.userCanManageOptions,isSaving:!1,keySaved:!1},w.on("change:pantheon_google_map_block_api_key",function(t){var n=t.get("pantheon_google_map_block_api_key");e.setState({apiKey:w.get("pantheon_google_map_block_api_key"),isSavedKey:""!==n})}),e.state.userCanManageOptions?w.fetch().then(function(t){e.setState({apiKey:t.pantheon_google_map_block_api_key}),e.state.apiKey&&""!==e.state.apiKey&&e.setState({isSavedKey:!0}),e.setState({isLoading:!1})}):(e.setState({apiKey:PantheonGoogleMapsData.APIKey}),e.state.apiKey&&""!==e.state.apiKey&&e.setState({isSavedKey:!0}),e.setState({isLoading:!1})),e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,y),r(t,[{key:"saveApiKey",value:function(){var e=this;this.setState({isSaving:!0}),new wp.api.models.Settings({pantheon_google_map_block_api_key:this.state.apiKey}).save().then(function(t){e.setState({isSavedKey:!0,isLoading:!1,isSaving:!1,keySaved:!0}),w.fetch()})}},{key:"render",value:function(){var e=this,t=this.props,n=t.attributes,a=t.className,o=t.isSelected,r=t.setAttributes,c=n.location,f=n.mapType,y=n.zoom,w=n.interactive,b=n.maxWidth,C=n.maxHeight,E=n.aspectRatio,_=i()(a,"ratio"+E,{interactive:w,"has-api-key":this.state.apiKey}),k=[{value:"roadmap",label:s("roadmap")},{value:"satellite",label:s("satellite")}],M=[{value:"2_1",label:s("2:1")},{value:"16_9",label:s("16:9")},{value:"4_3",label:s("4:3")},{value:"1_1",label:s("1:1")},{value:"1_2",label:s("1:2")}];if(this.state.isLoading)return wp.element.createElement("div",{className:a+" notice notice-warning",style:{padding:"0 1em"}},wp.element.createElement("p",{style:{textAlign:"center"}},s("Loading map...")));var A="";A=this.state.APIKeyConstantDefined?s("The Google Maps API key is defined with the GOOGLE_MAPS_API_KEY constant. To change the API key, update the constant value."):this.state.isSavedKey?this.state.userCanManageOptions?"":s("Only administrators can change the Google Maps API key."):this.state.userCanManageOptions?s("A valid Google Maps API key is required to use the map block, please enter one below."):s("A valid Google Maps API key is required to use the map block, please ask an administrator to enter one.");var S=wp.element.createElement("div",{className:"api-key-input-container"},this.state.APIKeyConstantDefined?wp.element.createElement("p",{style:{textAlign:"center"}},A):wp.element.createElement(v,null,wp.element.createElement("p",{style:{textAlign:"center"}},A,wp.element.createElement("br",null),this.state.isSavedKey&&this.state.userCanManageOptions?s("Note: changing the API key effects all Google Map Embed blocks."):null),wp.element.createElement(u,{key:"api-input",value:this.state.apiKey,onChange:function(t){return e.setState({apiKey:t})},style:{textAlign:"center",border:"solid 1px rgba(100,100,100,0.25)"},readOnly:this.state.APIKeyConstantDefined||!this.state.userCanManageOptions,placeholder:s("API Key")}),wp.element.createElement("p",{style:{textAlign:"center",paddingBottom:"1em"}},wp.element.createElement("a",{href:"https://console.developers.google.com/flows/enableapi?apiid=maps_backend,static_maps_backend,maps_embed_backend&keyType=CLIENT_SIDE&reusekey=true"},s("An API key can be obtained here.")),wp.element.createElement("br",null),wp.element.createElement("br",null),wp.element.createElement(m,{isPrimary:!0,onClick:this.saveApiKey,isBusy:this.state.isSaving,disabled:this.state.APIKeyConstantDefined||!this.state.userCanManageOptions||""===this.state.apiKey},s("Save API key")))));return this.state.isSavedKey?[!!o&&wp.element.createElement(p,null,w?wp.element.createElement(g,{label:s("Aspect Ratio"),select:E,options:M,onChange:function(e){return r({aspectRatio:e})},value:E}):null,wp.element.createElement(d,{label:s("Zoom Level"),value:y,onChange:function(e){return r({zoom:e})},min:5,max:20}),wp.element.createElement(g,{label:s("Map Type"),select:f,options:k,onChange:function(e){return r({mapType:e})},value:f}),wp.element.createElement(h,{label:s("Toggle interactive map (on) or static image (off)"),checked:!!w,onChange:function(){return r({interactive:!w})}}),w?null:wp.element.createElement("div",null,wp.element.createElement(u,{label:s("Maximum width (in pixels)"),onChange:function(e){return r({maxWidth:Number.parseInt(e,10)})},value:b,type:"number",min:0,step:1}),wp.element.createElement(u,{label:s("Maximum height (in pixels)"),onChange:function(e){return r({maxHeight:Number.parseInt(e,10)})},value:C,type:"number",min:0,step:1})),S),wp.element.createElement(u,{key:"location-input",style:{textAlign:"center",border:"solid 1px rgba(100,100,100,0.25)"},onChange:function(e){return r({location:e})},value:c,placeholder:s("Enter a location..."),label:""!==c&&c.length?null:s("Location")}),""!==c&&c.length?""===this.state.apiKey&&!1===this.state.keySaved?S:wp.element.createElement("div",{className:_},wp.element.createElement("div",{className:"map"},l(n,this.state.apiKey))):wp.element.createElement("div",{className:a+" error",style:{padding:"0 1em"}},wp.element.createElement("p",{style:{textAlign:"center"}},s("A location is required. Please enter one in the field above.")))]:wp.element.createElement("div",{className:a+" error",style:{padding:"0 1em"}},S)}}]),t}(),C=wp.i18n.__;(0,wp.blocks.registerBlockType)("pantheon/google-map",{title:C("Google Map"),description:C("This block creates either an interactive Google map or a static map image. Simply enter text for a location in the map block. Advanced settings can be adjusted below."),icon:a.googleMap,category:"embed",supports:{html:!1},edit:b,save:function(){return null}})}]);