!function(e){function t(l){if(n[l])return n[l].exports;var o=n[l]={i:l,l:!1,exports:{}};return e[l].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,l){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:l})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(1)},function(e,t,n){"use strict";var l=n(2),o=(n.n(l),n(3)),i=(n.n(o),wp.components),a=i.IconButton,r=i.PanelBody,c=i.TextControl,s=i.Toolbar,d=(i.withNotices,wp.element.Fragment),m=wp.i18n.__,p=wp.blocks.registerBlockType,u=wp.editor,g=u.BlockControls,w=u.InspectorControls,v=u.BlockAlignmentToolbar,b=u.MediaPlaceholder,h=u.MediaUpload,y=u.AlignmentToolbar,f=(u.RichText,{title:{type:"array",source:"children",selector:"p"},url:{type:"string"},align:{type:"string"},width:{type:"number"},height:{type:"number"},contentAlign:{type:"string",default:"center"},id:{type:"number"}});p("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("panorama video - three sixty degree video"),m("spherical video - full-sphere video"),m("equirectangular video - VR (Virtual Reality) videography")],attributes:f,getEditWrapperProps:function(e){var t=e.align,n=e.width;if("left"===t||"center"===t||"right"===t||"wide"===t||"full"===t)return{"data-align":t,"data-resized":!!n}},edit:function(e){var t=e.attributes,n=e.setAttributes,l=(e.isSelected,e.className),o=(e.noticeOperations,e.noticeUI),i=t.url,p=(t.title,t.align),u=t.width,f=t.height,E=t.contentAlign,_=t.id,k=function(e){return n({width:parseInt(e,10)})},N=function(e){return n({height:parseInt(e,10)})},P=function(e){return n({align:e})},V=function(){var e=document.getElementById("algori-360-video");e.paused?e.play():e.pause()},C=function(e){if(!e||!e.url)return void n({url:void 0,id:void 0});n({url:e.url,id:e.id})},x=wp.element.createElement(d,null,wp.element.createElement(g,null,wp.element.createElement(v,{value:p,onChange:P}),wp.element.createElement(y,{value:E,onChange:function(e){n({contentAlign:e})}}),wp.element.createElement(s,null,wp.element.createElement(h,{onSelect:C,type:"video",value:_,render:function(e){var t=e.open;return wp.element.createElement(a,{className:"components-toolbar__control",label:m("Edit video"),icon:"edit",onClick:t})}}))),!!i&&wp.element.createElement(w,null,wp.element.createElement(r,{title:m("360\xb0 Video Settings")},wp.element.createElement("div",{className:"core-blocks-image__dimensions"},wp.element.createElement("p",{className:"core-blocks-image__dimensions__row"},m("Video Dimensions")),wp.element.createElement("div",{className:"core-blocks-image__dimensions__row"},wp.element.createElement(c,{type:"number",className:"core-blocks-image__dimensions__width",label:m("Width"),value:void 0!==u?u:"",placeholder:600,min:1,onChange:k}),wp.element.createElement(c,{type:"number",className:"core-blocks-image__dimensions__height",label:m("Height"),value:void 0!==f?f:"",placeholder:300,min:1,onChange:N}))))));return i?wp.element.createElement(d,null,x,wp.element.createElement("div",null,wp.element.createElement("a-scene",{class:"wp-block-cgb-block-algori-360-video-embedded-scene",style:{width:u,height:f},embedded:!0},wp.element.createElement("a-assets",null,wp.element.createElement("video",{id:"algori-360-video",src:i,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",style:{width:u}},wp.element.createElement("button",{id:"algori-360-video-play-pause-btn",onClick:V},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(d,null,x,wp.element.createElement(b,{icon:"format-video",className:l,labels:{title:m("360 Video"),name:m("a 360\xb0 video")},onSelect:C,accept:"video/*",type:"video",notices:o}))},save:function(e){var t=e.attributes,n=(e.className,t.url),l=(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:l,height:o},embedded:""},wp.element.createElement("a-assets",null,wp.element.createElement("video",{id:"algori-360-video",src:n,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:l}},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){}]);