(()=>{"use strict";var e,a={222:()=>{function e(){return e=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e},e.apply(this,arguments)}const a=window.wp.element,{__}=wp.i18n,{Component:r}=wp.element,{InspectorControls:t}=wp.editor,{PanelBody:i,TextControl:n,ToggleControl:l}=wp.components;class o extends r{render(){const{attributes:e,setAttributes:r}=this.props;return(0,a.createElement)(t,{key:"inspector"},(0,a.createElement)(i,{title:__("Settings","dynamic-iframe-for-wp")},(0,a.createElement)(n,{label:__("Iframe URL","dynamic-iframe-for-wp"),value:e.iframeSrc,onChange:e=>{e.includes("youtube.com/watch")&&(e=`https://www.youtube.com/embed/${new URL(e).searchParams.get("v")}`),r({iframeSrc:e})}}),(0,a.createElement)(l,{label:__("Allow fullscreen","dynamic-iframe-for-wp"),checked:e.allowFullscreen,onChange:e=>{r({allowFullscreen:e})}}),(0,a.createElement)(l,{label:__("Add lazyload attribute","dynamic-iframe-for-wp"),checked:e.useLazyload,onChange:e=>{r({useLazyload:e})}})),(0,a.createElement)(i,{title:__("Style options","dynamic-iframe-for-wp")},(0,a.createElement)(n,{label:__("Width","dynamic-iframe-for-wp"),value:e.iframeWidth,onChange:e=>{r({iframeWidth:e})}}),(0,a.createElement)(n,{label:__("Height","dynamic-iframe-for-wp"),value:e.iframeHeight,onChange:e=>{r({iframeHeight:e})}}),(0,a.createElement)(l,{label:__("Use !important","dynamic-iframe-for-wp"),checked:e.useImportant,onChange:e=>{r({useImportant:e})}})))}}const{__:m}=wp.i18n,{Fragment:c}=wp.element,{Placeholder:s}=wp.components,{registerBlockType:f}=wp.blocks;f("adeleyeayodeji/dynamic-iframe-for-wp",{title:m("Dynamic Iframe","dynamic-iframe-for-wp"),description:m("Easily insert dynamic iframes into the block editor.","dynamic-iframe-for-wp"),keywords:[m("iframe"),m("external"),m("embed"),m("video"),m("youtube"),m("vimeo"),m("google maps"),m("google"),m("maps"),m("map"),m("google map"),m("google maps embed"),m("google map embed"),m("google maps iframe"),m("google map iframe"),m("dynamic iframe"),m("dynamic iframe for gutenberg"),m("dynamic iframe block"),m("dynamic iframe block for gutenberg"),m("dynamic iframe for gutenberg block editor"),m("dynamic iframe block for gutenberg block editor"),m("dynamic iframe for gutenberg block"),m("dynamic iframe block for gutenberg block")],category:"embed",icon:"admin-site-alt",supports:{anchor:!0,className:!1,customClassName:!0,align:["full"]},attributes:{iframeSrc:{type:"string"},iframeWidth:{type:"string"},iframeHeight:{type:"string"},allowFullscreen:{type:"boolean"},useLazyload:{type:"boolean"},useImportant:{type:"boolean"}},edit:function(r){const{attributes:t}=r;let i=[t.className];"full"==t.align&&i.push("alignfull");const n={width:t.iframeWidth||"100%",maxWidth:t.iframeWidth||"100%",height:t.iframeHeight||"320px"};let l={};t.allowFullscreen&&(l.allowFullscreen=!0);const f=t.iframeSrc?(0,a.createElement)("iframe",e({id:t.anchor,className:i.join(" "),src:t.iframeSrc,style:n,frameBorder:"0"},l)):(0,a.createElement)(s,{icon:"admin-site-alt",label:m("Please fill the Iframe URL","dynamic-iframe-for-wp")});return(0,a.createElement)(c,null,(0,a.createElement)(o,r),f)},save:function(r){const{attributes:t}=r;let i=[t.className];"full"==t.align&&i.push("alignfull");const n={width:t.iframeWidth||"100%",maxWidth:t.iframeWidth||"100%",height:t.iframeHeight||"320px"};if(t.useImportant)for(let e in n)n[e]+=" !important";let l={};return t.allowFullscreen&&(l.allowFullscreen=!0),(0,a.createElement)(c,null,(0,a.createElement)("iframe",e({style:n,id:t.anchor,src:t.iframeSrc,class:i.join(" "),loading:!!t.useLazyload&&"lazy",frameBorder:"0"},l)))}})}},r={};function t(e){var i=r[e];if(void 0!==i)return i.exports;var n=r[e]={exports:{}};return a[e](n,n.exports,t),n.exports}t.m=a,e=[],t.O=(a,r,i,n)=>{if(!r){var l=1/0;for(s=0;s<e.length;s++){for(var[r,i,n]=e[s],o=!0,m=0;m<r.length;m++)(!1&n||l>=n)&&Object.keys(t.O).every((e=>t.O[e](r[m])))?r.splice(m--,1):(o=!1,n<l&&(l=n));if(o){e.splice(s--,1);var c=i();void 0!==c&&(a=c)}}return a}n=n||0;for(var s=e.length;s>0&&e[s-1][2]>n;s--)e[s]=e[s-1];e[s]=[r,i,n]},t.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),(()=>{var e={826:0,431:0};t.O.j=a=>0===e[a];var a=(a,r)=>{var i,n,[l,o,m]=r,c=0;if(l.some((a=>0!==e[a]))){for(i in o)t.o(o,i)&&(t.m[i]=o[i]);if(m)var s=m(t)}for(a&&a(r);c<l.length;c++)n=l[c],t.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return t.O(s)},r=globalThis.webpackChunkdynamic_iframe_for_wp=globalThis.webpackChunkdynamic_iframe_for_wp||[];r.forEach(a.bind(null,0)),r.push=a.bind(null,r.push.bind(r))})();var i=t.O(void 0,[431],(()=>t(222)));i=t.O(i)})();
|