/******/ (function() { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ({

/***/ "@wordpress/element":
/*!*********************************!*\
  !*** external ["wp","element"] ***!
  \*********************************/
/***/ (function(module) {

module.exports = window["wp"]["element"];

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	!function() {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = function(module) {
/******/ 			var getter = module && module.__esModule ?
/******/ 				function() { return module['default']; } :
/******/ 				function() { return module; };
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	!function() {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = function(exports, definition) {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	!function() {
/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	!function() {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = function(exports) {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	}();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
!function() {
/*!***************************!*\
  !*** ./src/banner-ads.js ***!
  \***************************/
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);

const {
  registerBlockType
} = wp.blocks;
const {
  InspectorControls,
  MediaUpload,
  MediaUploadCheck
} = wp.blockEditor;
const {
  PanelBody,
  Button,
  ResponsiveWrapper,
  SelectControl,
  TextControl,
  ToggleControl
} = wp.components;
const {
  Fragment
} = wp.element;
const {
  withSelect
} = wp.data;
const {
  __
} = wp.i18n;

const BlockEdit = props => {
  const {
    attributes,
    setAttributes
  } = props;

  const removeMedia1 = () => {
    setAttributes({
      mediaId1: 0,
      mediaUrl1: ''
    });
  };

  const onSelectMedia1 = media => {
    setAttributes({
      mediaId1: media.id,
      mediaUrl1: media.url
    });
  };

  const removeMedia2 = () => {
    setAttributes({
      mediaId2: 0,
      mediaUrl2: ''
    });
  };

  const onSelectMedia2 = media => {
    setAttributes({
      mediaId2: media.id,
      mediaUrl2: media.url
    });
  };

  const removeMedia3 = () => {
    setAttributes({
      mediaId3: 0,
      mediaUrl3: ''
    });
  };

  const onSelectMedia3 = media => {
    setAttributes({
      mediaId3: media.id,
      mediaUrl3: media.url
    });
  };

  const removeMedia4 = () => {
    setAttributes({
      mediaId4: 0,
      mediaUrl4: ''
    });
  };

  const onSelectMedia4 = media => {
    setAttributes({
      mediaId4: media.id,
      mediaUrl4: media.url
    });
  };

  return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(InspectorControls, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(PanelBody, {
    title: IRK_BLOCK_DATA.options,
    initialOpen: true
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "irk-panel-row"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(SelectControl, {
    label: IRK_BLOCK_DATA.columns,
    value: attributes.columns,
    options: [{
      label: "1",
      value: "1"
    }, {
      label: "1-3",
      value: "1-3"
    }, {
      label: "2-2",
      value: "2-2"
    }, {
      label: "3-1",
      value: "3-1"
    }, {
      label: "1-1-1-1",
      value: "1-1-1-1"
    }],
    onChange: value => setAttributes({
      columns: value
    })
  })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("hr", null), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("strong", null, IRK_BLOCK_DATA.item, " 1"), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "irk-panel-row"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(TextControl, {
    label: IRK_BLOCK_DATA.url,
    value: attributes.url1,
    onChange: value => setAttributes({
      url1: value
    })
  })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "irk-panel-row"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(ToggleControl, {
    label: IRK_BLOCK_DATA.openNewTab,
    checked: attributes.target1,
    onChange: value => setAttributes({
      target1: value
    })
  })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "irk-panel-row"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(TextControl, {
    label: IRK_BLOCK_DATA.xfn,
    value: attributes.xfn1,
    onChange: value => setAttributes({
      xfn1: value
    })
  })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "editor-post-featured-image"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", null, IRK_BLOCK_DATA.image), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUploadCheck, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUpload, {
    onSelect: onSelectMedia1,
    value: attributes.mediaId1,
    allowedTypes: ['image'],
    render: ({
      open
    }) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Button, {
      className: attributes.mediaId1 == 0 ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
      onClick: open
    }, attributes.mediaId1 == 0 && IRK_BLOCK_DATA.chooseImg, props.media1 != undefined && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(ResponsiveWrapper, {
      naturalWidth: props.media1.media_details.width,
      naturalHeight: props.media1.media_details.height
    }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
      src: props.media1.source_url
    })))
  })), attributes.mediaId1 != 0 && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUploadCheck, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUpload, {
    title: IRK_BLOCK_DATA.replaceImg,
    value: attributes.mediaId1,
    onSelect: onSelectMedia1,
    allowedTypes: ['image'],
    render: ({
      open
    }) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Button, {
      onClick: open,
      isDefault: true,
      isLarge: true
    }, IRK_BLOCK_DATA.replaceImg)
  })), attributes.mediaId1 != 0 && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUploadCheck, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Button, {
    onClick: removeMedia1,
    isLink: true,
    isDestructive: true
  }, IRK_BLOCK_DATA.removeImg))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("hr", null), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("strong", null, IRK_BLOCK_DATA.item, " 2"), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "irk-panel-row"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(TextControl, {
    label: IRK_BLOCK_DATA.url,
    value: attributes.url2,
    onChange: value => setAttributes({
      url2: value
    })
  })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "irk-panel-row"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(ToggleControl, {
    label: IRK_BLOCK_DATA.openNewTab,
    checked: attributes.target2,
    onChange: value => setAttributes({
      target2: value
    })
  })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "irk-panel-row"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(TextControl, {
    label: IRK_BLOCK_DATA.xfn,
    value: attributes.xfn2,
    onChange: value => setAttributes({
      xfn2: value
    })
  })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "editor-post-featured-image"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", null, IRK_BLOCK_DATA.image), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUploadCheck, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUpload, {
    onSelect: onSelectMedia2,
    value: attributes.mediaId2,
    allowedTypes: ['image'],
    render: ({
      open
    }) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Button, {
      className: attributes.mediaId2 == 0 ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
      onClick: open
    }, attributes.mediaId2 == 0 && IRK_BLOCK_DATA.chooseImg, props.media2 != undefined && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(ResponsiveWrapper, {
      naturalWidth: props.media2.media_details.width,
      naturalHeight: props.media2.media_details.height
    }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
      src: props.media2.source_url
    })))
  })), attributes.mediaId2 != 0 && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUploadCheck, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUpload, {
    title: IRK_BLOCK_DATA.replaceImg,
    value: attributes.mediaId2,
    onSelect: onSelectMedia2,
    allowedTypes: ['image'],
    render: ({
      open
    }) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Button, {
      onClick: open,
      isDefault: true,
      isLarge: true
    }, IRK_BLOCK_DATA.replaceImg)
  })), attributes.mediaId2 != 0 && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUploadCheck, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Button, {
    onClick: removeMedia2,
    isLink: true,
    isDestructive: true
  }, IRK_BLOCK_DATA.removeImg))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("hr", null), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("strong", null, IRK_BLOCK_DATA.item, " 3"), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "irk-panel-row"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(TextControl, {
    label: IRK_BLOCK_DATA.url,
    value: attributes.url3,
    onChange: value => setAttributes({
      url3: value
    })
  })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "irk-panel-row"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(ToggleControl, {
    label: IRK_BLOCK_DATA.openNewTab,
    checked: attributes.target3,
    onChange: value => setAttributes({
      target3: value
    })
  })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "irk-panel-row"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(TextControl, {
    label: IRK_BLOCK_DATA.xfn,
    value: attributes.xfn3,
    onChange: value => setAttributes({
      xfn3: value
    })
  })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "editor-post-featured-image"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", null, IRK_BLOCK_DATA.image), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUploadCheck, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUpload, {
    onSelect: onSelectMedia3,
    value: attributes.mediaId3,
    allowedTypes: ['image'],
    render: ({
      open
    }) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Button, {
      className: attributes.mediaId3 == 0 ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
      onClick: open
    }, attributes.mediaId3 == 0 && IRK_BLOCK_DATA.chooseImg, props.media3 != undefined && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(ResponsiveWrapper, {
      naturalWidth: props.media3.media_details.width,
      naturalHeight: props.media3.media_details.height
    }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
      src: props.media3.source_url
    })))
  })), attributes.mediaId3 != 0 && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUploadCheck, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUpload, {
    title: IRK_BLOCK_DATA.replaceImg,
    value: attributes.mediaId3,
    onSelect: onSelectMedia3,
    allowedTypes: ['image'],
    render: ({
      open
    }) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Button, {
      onClick: open,
      isDefault: true,
      isLarge: true
    }, IRK_BLOCK_DATA.replaceImg)
  })), attributes.mediaId3 != 0 && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUploadCheck, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Button, {
    onClick: removeMedia3,
    isLink: true,
    isDestructive: true
  }, IRK_BLOCK_DATA.removeImg))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("hr", null), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("strong", null, IRK_BLOCK_DATA.item, " 4"), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "irk-panel-row"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(TextControl, {
    label: IRK_BLOCK_DATA.url,
    value: attributes.url4,
    onChange: value => setAttributes({
      url4: value
    })
  })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "irk-panel-row"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(ToggleControl, {
    label: IRK_BLOCK_DATA.openNewTab,
    checked: attributes.target4,
    onChange: value => setAttributes({
      target4: value
    })
  })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "irk-panel-row"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(TextControl, {
    label: IRK_BLOCK_DATA.xfn,
    value: attributes.xfn4,
    onChange: value => setAttributes({
      xfn4: value
    })
  })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
    className: "editor-post-featured-image"
  }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("label", null, IRK_BLOCK_DATA.image), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUploadCheck, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUpload, {
    onSelect: onSelectMedia4,
    value: attributes.mediaId4,
    allowedTypes: ['image'],
    render: ({
      open
    }) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Button, {
      className: attributes.mediaId4 == 0 ? 'editor-post-featured-image__toggle' : 'editor-post-featured-image__preview',
      onClick: open
    }, attributes.mediaId4 == 0 && IRK_BLOCK_DATA.chooseImg, props.media4 != undefined && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(ResponsiveWrapper, {
      naturalWidth: props.media4.media_details.width,
      naturalHeight: props.media4.media_details.height
    }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("img", {
      src: props.media4.source_url
    })))
  })), attributes.mediaId4 != 0 && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUploadCheck, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUpload, {
    title: IRK_BLOCK_DATA.replaceImg,
    value: attributes.mediaId4,
    onSelect: onSelectMedia4,
    allowedTypes: ['image'],
    render: ({
      open
    }) => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Button, {
      onClick: open,
      isDefault: true,
      isLarge: true
    }, IRK_BLOCK_DATA.replaceImg)
  })), attributes.mediaId4 != 0 && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(MediaUploadCheck, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)(Button, {
    onClick: removeMedia4,
    isLink: true,
    isDestructive: true
  }, IRK_BLOCK_DATA.removeImg))))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("strong", null, IRK_BLOCK_DATA.bannerAds), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_0__.createElement)("p", null, IRK_BLOCK_DATA.bannerAdsDesc)));
};

registerBlockType('irankala/banner-ads', {
  title: IRK_BLOCK_DATA.bannerAds,
  description: IRK_BLOCK_DATA.bannerAdsDesc,
  icon: 'images-alt2',
  category: 'irankala',
  attributes: {
    columns: {
      type: 'string',
      default: "1"
    },
    url1: {
      type: 'string'
    },
    target1: {
      type: 'boolean'
    },
    xfn1: {
      type: 'string'
    },
    mediaId1: {
      type: 'number',
      default: 0
    },
    mediaUrl1: {
      type: 'string',
      default: ''
    },
    url2: {
      type: 'string'
    },
    target2: {
      type: 'boolean'
    },
    xfn2: {
      type: 'string'
    },
    mediaId2: {
      type: 'number',
      default: 0
    },
    mediaUrl2: {
      type: 'string',
      default: ''
    },
    url3: {
      type: 'string'
    },
    target3: {
      type: 'boolean'
    },
    xfn3: {
      type: 'string'
    },
    mediaId3: {
      type: 'number',
      default: 0
    },
    mediaUrl3: {
      type: 'string',
      default: ''
    },
    url4: {
      type: 'string'
    },
    target4: {
      type: 'boolean'
    },
    xfn4: {
      type: 'string'
    },
    mediaId4: {
      type: 'number',
      default: 0
    },
    mediaUrl4: {
      type: 'string',
      default: ''
    }
  },
  edit: withSelect((select, props) => {
    return {
      media1: props.attributes.mediaId1 ? select('core').getMedia(props.attributes.mediaId1) : undefined,
      media2: props.attributes.mediaId2 ? select('core').getMedia(props.attributes.mediaId2) : undefined,
      media3: props.attributes.mediaId3 ? select('core').getMedia(props.attributes.mediaId3) : undefined,
      media4: props.attributes.mediaId4 ? select('core').getMedia(props.attributes.mediaId4) : undefined
    };
  })(BlockEdit),
  save: props => {
    return null;
  }
});
}();
/******/ })()
;
//# sourceMappingURL=banner-ads.js.map