!function(e){function t(n){if(l[n])return l[n].exports;var o=l[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var l={};t.m=e,t.c=l,t.d=function(e,l,n){t.o(e,l)||Object.defineProperty(e,l,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var l=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(l,"a",l),l},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,l){"use strict";Object.defineProperty(t,"__esModule",{value:!0});l(1)},function(e,t,l){"use strict";var n=l(2),o=(l.n(n),l(3)),a=(l.n(o),wp.components),i=a.IconButton,r=a.PanelBody,c=a.TextControl,s=a.Toolbar,d=a.withNotices,p=wp.element.Fragment,m=wp.i18n.__,u=wp.blocks.registerBlockType,g=wp.editor,w=g.BlockControls,v=g.InspectorControls,b=(g.BlockAlignmentToolbar,g.MediaPlaceholder),h=g.MediaUpload,y=(g.AlignmentToolbar,g.RichText,{title:{type:"array",source:"children",selector:"p"},url:{type:"string"},align:{type:"string"},width:{type:"number",default:600},height:{type:"number",default:300},contentAlign:{type:"string",default:"center"},id:{type:"number"}});u("cgb/block-algori-360-video",{title:m("360\xb0 Video"),description:m("Embed a 360\xb0 video file with a simple play/pause button."),icon:"format-video",category:"common",keywords:[m("algori panorama video - three sixty degree video"),m("spherical video - full-sphere video"),m("equirectangular video - VR (Virtual Reality) videography")],attributes:y,edit:d(function(e){var t=e.attributes,l=e.setAttributes,n=(e.isSelected,e.className),o=e.noticeOperations,a=e.noticeUI,d=t.url,u=(t.title,t.align,t.width),g=t.height,y=(t.contentAlign,t.id),E=function(e){return l({width:parseInt(e,10)})},f=function(e){return l({height:parseInt(e,10)})},k=function(){var e=document.getElementById("algori-360-video");e.paused?e.play():e.pause()},V=function(e){if(!e||!e.url)return void l({url:void 0,id:void 0});l({url:e.url,id:e.id})},P=function(e){e!==d&&l({url:e,id:void 0})},N=wp.element.createElement(p,null,wp.element.createElement(w,null,wp.element.createElement(s,null,wp.element.createElement(h,{onSelect:V,allowedTypes:["video"],value:y,render:function(e){var t=e.open;return wp.element.createElement(i,{className:"components-toolbar__control",label:m("Edit video"),icon:"edit",onClick:t})}}))),!!d&&wp.element.createElement(v,null,wp.element.createElement(r,{title:m("360\xb0 Video Settings")},wp.element.createElement("div",null,wp.element.createElement("p",null,m("Video Dimensions")),wp.element.createElement("div",null,wp.element.createElement(c,{type:"number",label:m("Width"),value:void 0!==u?u:"",placeholder:600,min:1,onChange:E}),wp.element.createElement(c,{type:"number",label:m("Height"),value:void 0!==g?g:"",placeholder:300,min:1,onChange:f}))))));return d?wp.element.createElement(p,null,N,wp.element.createElement("figure",{style:{width:u,height:g}},wp.element.createElement("a-scene",{embedded:!0},wp.element.createElement("a-assets",null,wp.element.createElement("video",{id:"algori-360-video",src:d,crossorigin:"anonymous",autoplay:"false",loop:"true"})),wp.element.createElement("a-videosphere",{src:"#algori-360-video"})),wp.element.createElement("div",{class:"wp-block-cgb-block-algori-360-video-controls"},wp.element.createElement("button",{id:"algori-360-video-play-pause-btn",onClick:k},wp.element.createElement("span",{class:"dashicons-before dashicons-controls-play"},m("Play")),"\xa0|\xa0",wp.element.createElement("span",{class:"dashicons-before dashicons-controls-pause"},m("Pause")))))):wp.element.createElement(p,null,N,wp.element.createElement(b,{icon:"format-video",className:n,labels:{title:m("360 Video"),instructions:m("Drag a 360\xb0 video, upload a new one, insert from URL or select a file from your library.")},onSelect:V,onSelectURL:P,accept:"video/*",allowedTypes:["video"],notices:a,onError:o.createErrorNotice}))}),save:function(e){var t=e.attributes,l=(e.className,t.url),n=(t.title,t.align,t.width),o=t.height;t.contentAlign,t.id;return wp.element.createElement("figure",{style:{width:n,height:o}},wp.element.createElement("a-scene",{embedded:""},wp.element.createElement("a-assets",null,wp.element.createElement("video",{id:"algori-360-video",src:l,crossorigin:"anonymous",autoplay:"false",loop:"true"})),wp.element.createElement("a-videosphere",{src:"#algori-360-video"})),wp.element.createElement("div",{className:"wp-block-cgb-block-algori-360-video-controls"},wp.element.createElement("button",{id:"algori-360-video-play-pause-btn",onclick:"const algori360Video = document.getElementById('algori-360-video'); (algori360Video.paused) ? algori360Video.play() : algori360Video.pause();"},wp.element.createElement("span",{class:"dashicons-before dashicons-controls-play"},m("Play")),"\xa0|\xa0",wp.element.createElement("span",{class:"dashicons-before dashicons-controls-pause"},m("Pause")))))},deprecated:[{attributes:Object.assign({},y),save:function(e){var t=e.attributes,l=(e.className,t.url),n=(t.title,t.align,t.width),o=t.height;t.contentAlign,t.id;return wp.element.createElement("div",null,wp.element.createElement("a-scene",{className:"wp-block-cgb-block-algori-360-video-embedded-scene",style:{width:n,height:o},embedded:""},wp.element.createElement("a-assets",null,wp.element.createElement("video",{id:"algori-360-video",src:l,crossorigin:"anonymous",autoplay:"false",loop:"true"})),wp.element.createElement("a-videosphere",{src:"#algori-360-video"})),wp.element.createElement("div",{className:"wp-block-cgb-block-algori-360-video-controls",style:{width:n}},wp.element.createElement("button",{id:"algori-360-video-play-pause-btn",onclick:"const algori360Video = document.getElementById('algori-360-video'); (algori360Video.paused) ? algori360Video.play() : algori360Video.pause();"},wp.element.createElement("span",{class:"dashicons-before dashicons-controls-play"},m("Play")),"\xa0|\xa0",wp.element.createElement("span",{class:"dashicons-before dashicons-controls-pause"},m("Pause")))))}}]})},function(e,t){},function(e,t){}]);