!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,s=a.TextControl,c=a.Toolbar,d=a.withNotices,m=a.Notice,p=wp.element.Fragment,u=wp.i18n.__,g=wp.blocks.registerBlockType,w=wp.editor,h=w.BlockControls,b=w.InspectorControls,v=w.BlockAlignmentToolbar,f=w.MediaPlaceholder,E=w.MediaUpload,y=w.MediaUploadCheck,k=(w.AlignmentToolbar,w.RichText,["video"]),V={title:{type:"array",source:"children",selector:"p"},url:{type:"string"},align:{type:"string"},widthBeforeWideFullAlignments:{type:"number",default:600},width:{type:"number",default:600},height:{type:"number",default:300},contentAlign:{type:"string",default:"center"},id:{type:"number"}};g("cgb/block-algori-360-video",{title:u("360\xb0 Video"),description:u("Embed a 360\xb0 video file with a simple play/pause button."),icon:"format-video",category:"common",keywords:[u("algori panorama video - three sixty degree video"),u("spherical video - full-sphere video"),u("equirectangular video - VR (Virtual Reality) videography")],attributes:V,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,g=(t.title,t.align),w=t.widthBeforeWideFullAlignments,V=t.width,N=t.height,P=(t.contentAlign,t.id),x=function(e){return l({width:parseInt(e,10),widthBeforeWideFullAlignments:parseInt(e,10)})},B=function(e){return l({height:parseInt(e,10)})},O=function(){var e=document.getElementById("algori-360-video");e.paused?e.play():e.pause()},A=function(e){if(!e||!e.url)return void l({url:void 0,id:void 0});l({url:e.url,id:e.id})},I=function(e){e!==d&&l({url:e,id:void 0})},C=function(e){var t=-1!==["wide","full"].indexOf(e)?{width:void 0}:{width:w};l(Object.assign({},t,{align:e}))},T=wp.element.createElement(p,null,wp.element.createElement(h,null,wp.element.createElement(v,{value:g,onChange:C}),wp.element.createElement(c,null,wp.element.createElement(y,null,wp.element.createElement(E,{onSelect:A,allowedTypes:k,value:P,render:function(e){var t=e.open;return wp.element.createElement(i,{className:"components-toolbar__control",label:u("Edit video"),icon:"edit",onClick:t})}})))),!!d&&wp.element.createElement(b,null,wp.element.createElement(r,{title:u("360\xb0 Video Settings")},wp.element.createElement("div",null,wp.element.createElement("p",null,u("Video Dimensions")),wp.element.createElement("div",null,-1!==["wide","full"].indexOf(g)?wp.element.createElement(m,{status:"informational",isDismissible:"false"},u("The")," \xa0",wp.element.createElement("strong",null,u("Width"))," \xa0",u("setting has been disabled because you have chosen either")," \xa0",wp.element.createElement("strong",null,u("Full"))," \xa0",u("or")," \xa0",wp.element.createElement("strong",null,u("Wide"))," \xa0",u("width alignment from the block toolbar.")):wp.element.createElement(s,{type:"number",label:u("Width"),value:void 0!==V?V:"",placeholder:600,min:1,onChange:x}),wp.element.createElement(s,{type:"number",label:u("Height"),value:void 0!==N?N:"",placeholder:300,min:1,onChange:B}))))));return d?wp.element.createElement(p,null,T,wp.element.createElement("figure",{style:-1!==["wide","full"].indexOf(g)?{height:N}:{width:V,height:N},className:"wp-block-cgb-block-algori-360-video align"+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:O},wp.element.createElement("span",{class:"dashicons-before dashicons-controls-play"},u("Play")),"\xa0|\xa0",wp.element.createElement("span",{class:"dashicons-before dashicons-controls-pause"},u("Pause")))))):wp.element.createElement(p,null,T,wp.element.createElement(f,{icon:"format-video",className:n,labels:{title:u("360 Video"),instructions:u("Drag a 360\xb0 video, upload a new one, insert from URL or select a file from your library.")},onSelect:A,onSelectURL:I,accept:"video/*",allowedTypes:k,notices:a,onError:o.createErrorNotice}))}),save:function(e){var t=e.attributes,l=(e.className,t.url),n=(t.title,t.align),o=t.width,a=t.height;t.contentAlign,t.id;return wp.element.createElement("figure",{style:-1!==["wide","full"].indexOf(n)?{height:a}:{width:o,height:a},className:"align"+n},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"},u("Play")),"\xa0|\xa0",wp.element.createElement("span",{class:"dashicons-before dashicons-controls-pause"},u("Pause")))))},deprecated:[{attributes:Object.assign({},V),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"},u("Play")),"\xa0|\xa0",wp.element.createElement("span",{class:"dashicons-before dashicons-controls-pause"},u("Pause")))))}},{attributes:Object.assign({},V),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"},u("Play")),"\xa0|\xa0",wp.element.createElement("span",{class:"dashicons-before dashicons-controls-pause"},u("Pause")))))}}]})},function(e,t){},function(e,t){}]);