define("backgroundCommon",["lodash","coreUtils","santa-components","componentsCore","prop-types","skins","warmupUtils","image-client-api","color","pmrpc"],function(e,t,i,o,a,n,r,s,p,d){return function(e){var t={};function i(o){if(t[o])return t[o].exports;var a=t[o]={i:o,l:!1,exports:{}};return e[o].call(a.exports,a,a.exports,i),a.l=!0,a.exports}return i.m=e,i.c=t,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)i.d(o,a,function(t){return e[t]}.bind(null,a));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=398)}({0:function(t,i){t.exports=e},1:function(e,i){e.exports=t},171:function(e,t,i){var o,a;o=[i(0),i(4),i(3),i(9),i(21),i(2)],void 0===(a=function(e,t,i,o,a,n){"use strict";var r=n.components.imageCommon.imageElements;return{displayName:"bgImage",mixins:[i.mixins.skinBasedComp],propTypes:{cssFiltersSupported:n.santaTypesDefinitions.BrowserFlags.cssFiltersSupported.isRequired,compData:t.object.isRequired,shouldRenderSrc:t.bool,imageUrlPreMeasureParams:t.object,currentUrl:n.santaTypesDefinitions.currentUrl,getMediaFullStaticUrl:t.func.isRequired,filterEffect:t.object,style:t.object,mediaDimensions:t.object,imageData:t.object,fittingType:t.string,alignType:t.string,containerId:t.string,wixImageLayout:t.bool,"data-type":t.string},extendWithFilterData:function(t){var i=void 0,o=void 0,a=r.getValidFilterName(this.props.filterEffect);a&&(i=this.props.id+"_"+a,o=r.getFilterComponent(i,a,e.omit(this.props.filterEffect,"effectType")),this.props.cssFiltersSupported&&(t[""].addChildren=o,e.assign(t.style,r.getCssStyleForFilterUse(i))))},getImageTransform:function(){var t=this.props,i=t.imageData,n=t.getMediaFullStaticUrl,r=t.currentUrl,s=t.mediaDimensions,p=e.pick(this.props.imageUrlPreMeasureParams,["width","height","filters","fittingType","imageCss"]),d={imageData:i,containerWidth:e.defaultTo(p.width,s.width),containerHeight:e.defaultTo(p.height,s.height),displayMode:e.defaultTo(p.fittingType,a.fittingTypes.TILE),quality:{quality:85},filters:p.filters};return o.imageUtils.getImageComputedProperties(a,d,n,r,1,"bg")},getSkinProperties:function(){var t={position:"absolute",width:"100%",height:"100%"};if(e.isNumber(this.props.compData.opacity)&&(t.opacity=this.props.compData.opacity),this.props.shouldRenderSrc){var i=this.getImageTransform();t.backgroundImage="url("+i.uri+")",t.height=this.props.style.height,e.assign(t,i.css.container)}var o=e.pick(this.props.imageData,["width","height","uri","name"]),a=e.pick(this.props,["alignType","fittingType","containerId"]);a.imageData=o,a.imageData.displayMode=a.fittingType;var n={"":{tagName:this.props.wixImageLayout?"wix-bg-image":"div",style:t,"data-has-bg-scroll-effect":this.props.hasBgScrollEffect?"1":"","data-tiled-image-info":JSON.stringify(a)}};return this.extendWithFilterData(n),n}}}.apply(t,o))||(e.exports=a)},172:function(e,t,i){var o,a;o=[i(0),i(4),i(3),i(1),i(2),i(173)],void 0===(a=function(e,t,i,o,a,n){"use strict";var r=o.mediaConsts;function s(t){return e.includes(t,"video")}function p(e,t){var i=e.readyState<=2,o=t?r.playbackTypes.PLAYING:r.playbackTypes.READY;return i?r.playbackTypes.LOADING:o}function d(t){var i=t.wixVideoLayout?"wix-video":"div",o={isVideoDataExists:""};if(s(t.videoRenderParts)){var a=t.staticVideoUrl,n=t.format,r=t.parentId,p=t.fittingType,d=t.alignType,u=t.hasBgScrollEffect,l=t.compData,c=t.compProp,h=e.reject(l.qualities,{quality:"storyboard"}),f=h.map(function(e){return{quality:e.quality,size:e.width*e.height,url:e.url}}),m=e.last(h),y=c.autoplay||l.autoplay;o={fittingType:p,alignType:d,hasBgScrollEffect:u,animatePoster:c.animatePoster,staticVideoUrl:a,videoId:l.videoId,playerType:"html5",isVideoDataExists:"1",videoWidth:m.width,videoHeight:m.height,qualities:f,videoFormat:n,autoPlay:t.isPlayingAllowed&&y,isEditorMode:t.isEditorMode,isViewerMode:t.isViewerMode,containerId:r}}return{tagName:i,"data-video-info":JSON.stringify(o)}}return{displayName:"html5Video",mixins:[n,i.mixins.skinBasedComp,i.mixins.createChildComponentMixin],propTypes:e.defaults({compData:t.object.isRequired,compProp:t.object,parentId:t.string.isRequired,playFullscreen:t.bool,videoRenderParts:t.array,format:t.string,config:t.object,playbackUrl:t.string,notifyMediaState:t.func.isRequired,notifyVideoVisibility:t.func.isRequired,showMedia:t.bool.isRequired,shouldRenderSrc:t.bool,posterWidth:t.number,posterHeight:t.number,setMediaAPI:t.func.isRequired,registerMediaSource:t.func,keepVideoHidden:t.bool,hasBgScrollEffect:t.bool,isPlayingAllowed:t.bool,isEditorMode:t.bool,fittingType:t.string,alignType:t.string,wixVideoLayout:t.bool,isExperimentOpen:a.santaTypesDefinitions.isExperimentOpen.isRequired,isViewerMode:a.santaTypesDefinitions.isViewerMode.isRequired,staticVideoUrl:a.santaTypesDefinitions.ServiceTopology.staticVideoUrl,adaptiveVideoDomain:a.santaTypesDefinitions.ServiceTopology.adaptiveVideoDomain},a.utils.santaTypesUtils.getSantaTypesFromPropTypes(a.components.Image.propTypes)),getInitialState:function(){this.playWhenReady=!1,this.hls=null},componentDidMount:function(){var e=this.refs.video,t=this.isAutoplay();this.handleMute(),this.initTimeUpdateListener(),this.props.notifyMediaState({type:r.eventTypes.MOUNT,duration:e.duration||this.props.compData.duration,muted:e.muted,playbackState:p(e,t),previousPlaybackState:t?r.playbackTypes.PLAYING:""}),s(this.props.videoRenderParts)&&(this.initAdaptive(),this.setAdaptiveVideoSource(),this.setRate(this.props.compData.playbackSpeed||1)),this.props.setMediaAPI(this.mediaAPI),this.props.registerMediaSource&&this.props.registerMediaSource(e)},componentDidUpdate:function(){s(this.props.videoRenderParts)&&(this.initAdaptive(),this.setAdaptiveVideoSource(),this.setRate(this.props.compData.playbackSpeed||1),this.props.notifyMediaState({type:r.eventTypes.LOAD,looped:this.props.compProp.loop,duration:this.refs.video.duration||this.props.compData.duration}))},componentWillUnmount:function(){this.props.setMediaAPI(null),this.props.notifyVideoVisibility(!1),s(this.props.videoRenderParts)&&(this.refs.video.removeEventListener("timeupdate",this.handlePosterVisibilityOnce),this.removeVideoSecurely())},initTimeUpdateListener:function(){var t=this.refs.video;e.includes(this.props.compData.mediaFeatures,"alpha")&&t.addEventListener("timeupdate",this.handlePosterVisibilityOnce)},shouldInitiateAdaptive:function(){return"hls"===this.props.format&&"maybe"!==this.refs.video.canPlayType("application/vnd.apple.mpegURL")&&!e.get(this.hls,"media")},setAdaptiveVideoSource:function(){if(this.hls){var t=e.find(this.props.compData.adaptiveVideo,{format:"hls"}),i=o.urlUtils.joinURL(this.props.adaptiveVideoDomain,e.get(t,"url"));i!==this.hls.url&&this.hls.loadSource(i)}},initAdaptive:function(){if(this.shouldInitiateAdaptive()){var t=requirejs("hls-light");this.hls=new t(e.clone(this.props.config.hls)),this.hls.attachMedia(this.refs.video),this.hls.on(t.Events.ERROR,this.onHlsError)}},isAutoplay:function(){return(this.props.compProp.autoplay||this.props.compData.autoplay)&&this.props.isPlayingAllowed},handlePosterVisibilityOnce:function(){!this.refs.video.paused&&this.refs.video.currentTime>0&&(this.refs.video.removeEventListener("timeupdate",this.handlePosterVisibilityOnce),this.props.notifyMediaState({type:r.eventTypes.PLAYSTATE,playbackState:r.playbackTypes.SEEK_PLAYING}),this.refs.video.addEventListener("seeked",this.setPosterState),this.seek(0))},setPosterState:function(){this.refs.video.removeEventListener("seeked",this.setPosterState),this.props.notifyVideoVisibility(!0)},handleMute:function(){this.shouldMute()||(this.refs.video.muted=!1)},resetPosterState:function(){this.props.showMedia&&(this.props.notifyVideoVisibility(!1),this.refs.video.addEventListener("timeupdate",this.handlePosterVisibilityOnce))},removeVideoSecurely:function(){this.refs.video.pause(),this.hls&&(this.hls.detachMedia(),this.hls.destroy()),this.refs.video.src="",this.refs.video.load()},canVideoPlay:function(){return this.refs.video.readyState>=this.refs.video.HAVE_CURRENT_DATA},shouldMute:function(){return this.props.compProp.disableAudio||e.get(this.props,["compProp","mute"],e.get(this.props,["compData","mute"]))||!1===this.props.compData.hasAudio},play:function(){this.canVideoPlay()?this.refs.video.play():this.playWhenReady=!0},pause:function(){this.playWhenReady=!1,this.refs.video.pause()},stop:function(){this.pause(),this.seek(0),this.resetPosterState()},setVolume:function(e){this.refs.video.volume=Math.max(0,Math.min(1,e))},mute:function(){this.refs.video.muted=!0},unMute:function(){this.refs.video.muted=this.props.compProp.disableAudio},seek:function(e){this.refs.video.currentTime=Math.max(0,Math.min(e,this.refs.video.duration||this.props.compData.duration))},setRate:function(e){this.refs.video.playbackRate=Math.max(0,e)},onLoadStart:function(){this.props.notifyMediaState({type:r.eventTypes.LOAD,playbackState:r.playbackTypes.LOADING,volume:this.refs.video.volume,muted:this.refs.video.muted,looped:this.props.compProp.loop,currentTime:this.refs.video.currentTime,progress:0})},onDurationChange:function(){this.props.notifyMediaState({type:r.eventTypes.LOAD,duration:parseInt(100*this.refs.video.duration,10)/100})},onLoadedData:function(){this.isAutoplay()?this.props.notifyMediaState({type:r.eventTypes.LOAD,previousPlaybackState:r.playbackTypes.PLAYING}):this.props.notifyMediaState({type:r.eventTypes.LOAD,playbackState:r.playbackTypes.READY})},onCanPlay:function(){this.playWhenReady&&(this.play(),this.playWhenReady=!1)},onTimeUpdate:function(){this.props.notifyMediaState({type:r.eventTypes.TIME_UPDATE,currentTime:this.refs.video.currentTime})},onPlayEnded:function(){this.props.notifyMediaState({type:r.eventTypes.PLAYSTATE,playbackState:r.playbackTypes.PLAY_ENDED})},onPlay:function(){this.props.notifyMediaState({type:r.eventTypes.PLAYSTATE,playbackState:r.playbackTypes.PLAYING})},onPause:function(){this.props.notifyMediaState({type:r.eventTypes.PLAYSTATE,playbackState:r.playbackTypes.PAUSED})},onHlsError:function(e,t){t.fatal&&(this.refs.video.src="",this.props.notifyMediaState({type:r.eventTypes.ERROR,error:r.errorTypes.NO_HLS_VIDEO}))},onError:function(e){e.currentTarget.networkState===e.currentTarget.NETWORK_NO_SOURCE?this.props.notifyMediaState({type:r.eventTypes.ERROR,error:r.errorTypes.NO_VIDEO_FOUND}):this.props.notifyMediaState({type:r.eventTypes.ERROR,error:r.errorTypes.VIDEO_GENERAL_ERROR})},onProgress:function(){var e=this.refs.video.buffered;this.props.notifyMediaState({type:r.eventTypes.PROGRESS,progress:e&&e.length?e.end(e.length-1):0})},onSeekStart:function(){this.props.notifyMediaState({type:r.eventTypes.PLAYSTATE,playbackState:r.playbackTypes.SEEKING})},onSeekEnd:function(){this.props.notifyMediaState({type:r.eventTypes.PLAYSTATE,playbackState:r.playbackTypes.SEEKING_ENDED})},onVolumeChange:function(){this.props.notifyMediaState({type:r.eventTypes.VOLUME,volume:this.refs.video.volume,muted:this.refs.video.muted})},onVideoClick:function(e){e.stopPropagation()},getVideo:function(){var e=this.props.showMedia?1:.01;this.props.keepVideoHidden&&(e=0);var t={preload:this.props.compData.preload||"none",onEnded:this.onPlayEnded,onError:this.onError,onLoadStart:this.onLoadStart,onLoadedData:this.onLoadedData,onCanPlay:this.onCanPlay,onDurationChange:this.onDurationChange,onPause:this.onPause,onPlay:this.onPlay,onProgress:this.onProgress,onSeeked:this.onSeekEnd,onSeeking:this.onSeekStart,onTimeUpdate:this.onTimeUpdate,onClick:this.onVideoClick,onVolumeChange:this.onVolumeChange,playsInline:!this.props.playFullscreen,crossOrigin:"anonymous",style:{visibility:this.props.keepVideoHidden?"hidden":"",position:"absolute",top:0,opacity:e}};return(this.props.compProp.loop||this.props.compData.loop)&&(t.loop=!0),this.props.compData.alt&&(t["aria-label"]=this.props.compData.alt),this.shouldMute()&&(t.muted="muted"),t},getRenderParts:function(){var t=this,i={video:null,poster:null},o={containerWidth:this.props.posterWidth||0,containerHeight:this.props.posterHeight||0,shouldRenderSrc:this.props.shouldRenderSrc,imageUrlPreMeasureParams:this.props.imageUrlPreMeasureParams,filterEffect:this.props.filterEffect,containerId:this.props.parentId};return e.forEach(this.props.videoRenderParts,function(e){switch(e){case"video":i.video=t.getVideo();break;case"poster":i.poster=t.getPosterImageComp(t.props.compData.posterImageRef,t.props.showMedia,o)}}),i},getSkinProperties:function(){var t=this.getRenderParts();return{"":e.assign(d(this.props),{style:{position:"absolute",width:"100%",height:"100%",top:0}}),video:t.video,poster:t.poster}}}}.apply(t,o))||(e.exports=a)},173:function(e,t,i){var o,a;function n(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t1&&void 0!==arguments[1]?arguments[1]:[],o=this[t];o&&e.includes(this.externalAPI,t)&&o.apply(void 0,n(i))},getPosterImageComp:function(t,i,n){var r=this.props.hasBgScrollEffect,s={position:"absolute",top:0,width:"100%",height:"100%"};return i&&"fade"===this.props.compProp.animatePoster?this.animate(this.refs.poster,"BaseFade",1.6,0,{opacity:0,ease:"Quad.easeOut"}):s.opacity=i?0:1,this.createChildComponent(t,"core.components.Image",o.POSTER,e.assign({ref:o.POSTER,key:s.backgroundColor?"posterImagePng":"posterImage",id:this.props.id+o.POSTER,imageData:e.assign({},t,{quality:a,devicePixelRatio:1}),hasBgScrollEffect:r,displayMode:this.props.fittingType,alignType:this.props.alignType,autoLayout:!0,wixImageLayout:this.props.isExperimentOpen("bv_wixImagePhaseTwo"),style:s},n))}}}.apply(t,o))||(e.exports=a)},174:function(e,t,i){var o,a;o=[i(0),i(4),i(3),i(1),i(401)],void 0===(a=function(e,t,i,o,a){"use strict";var n=o.svgFilters,r=o.mediaConsts;function s(e,t){var i=!1;t=t||{};var o=e.brightnessContrast,n=e.duotone,r=e.hueSaturation;return"brightness"in t||"contrast"in t?(o||(o=a.effects.brightnessContrast(),e.splice(1,0,o),e.brightnessContrast=o,i=!0),t.brightness||0===t.brightness?(o.brightness=t.brightness,o.brightnessDisabled=!1):o.brightnessDisabled=!0,t.contrast||0===t.contrast?(o.contrast=t.contrast,o.contrastDisabled=!1):o.contrastDisabled=!0):o&&(o.brightnessDisabled=!0,o.contrastDisabled=!0),t.duotoneDark&&t.duotoneLight?(n||(n=a.effects.duotone(),e.splice(o?2:1,0,n),e.duotone=n,i=!0),n.dark=u(t.duotoneDark),n.light=u(t.duotoneLight),n.disabled=!1):n&&(n.disabled=!0),"hue"in t||"saturation"in t?(r||(r=a.effects.hueSaturation(),e.push(r),e.hueSaturation=r,i=!0),t.hue||0===t.hue?(r.hue=t.hue,r.hueDisabled=!1):r.hueDisabled=!0,t.saturation||0===t.saturation?(r.saturation=t.saturation,r.saturationDisabled=!1):r.saturationDisabled=!0):r&&(r.hueDisabled=!0,r.saturationDisabled=!0),i}function p(e){var t=function(e){var t=[a.effects.transparentVideo()];if("brightness"in e||"contrast"in e){var i=a.effects.brightnessContrast();t.push(i),t.brightnessContrast=i}if(e.duotoneDark&&e.duotoneLight){var o=a.effects.duotone();t.push(o),t.duotone=o}if("hue"in e||"saturation"in e){var n=a.effects.hueSaturation();t.push(n),t.hueSaturation=n}return t}(e);return s(t,e),t}function d(e){if(e){var t=function(e){return e&&e.effectType?n.getProperties(e.effectType).reduce(function(e,t){var i={};return t&&(t.duotone?(i.duotoneDark=t.duotone.dark,i.duotoneLight=t.duotone.light):i=t),Object.assign(e,i),e},{}):{}}(e);return Object.assign(t,e),t}return{}}function u(e){if("string"==typeof e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16)/255,parseInt(t[2],16)/255,parseInt(t[3],16)/255,1]:e}return e}function l(e,t){var i=e.props;return{type:"video",width:(t=t||i.getMediaSource())&&t.videoWidth||0,height:t&&t.videoHeight/2||0,media:t}}return a.Kampos.prototype.play=function(){var e=this;this.animationFrameId||(this.animationFrameId=window.requestAnimationFrame(function t(){e.animationFrameId=window.requestAnimationFrame(t);var i=e.media;i&&i.readyState>=i.HAVE_CURRENT_DATA&&(!i.paused&&!i.ended||e._needsRedraw)&&(e._needsRedraw=!1,e.draw())}))},{displayName:"webglMedia",mixins:[i.mixins.skinBasedComp],propTypes:{showMedia:t.bool,isEditorMode:t.bool,filterEffect:t.object,altText:t.string,notifyMediaState:t.func,getMediaSource:t.func,notifyWebGLVisibility:t.func,getIsVisible:t.func,addVisibilityStateListener:t.func,addWebGLContext:t.func,removeWebGLContext:t.func},getInitialState:function(){return this.kampos=null,this.isVisible=null,{}},getIsVisible:function(){return null===this.isVisible&&(this.isVisible=this.props.getIsVisible()),this.isVisible},componentDidMount:function(){var e=this;this.removeVisibilityStateListener=this.props.addVisibilityStateListener(function(t){!t.in||e.props.isEditorMode&&!t.forcePlay?e.kampos&&(e.isVisible=!1,e.stopVglInstance()):(e.isVisible=!0,e.initVglInstance())})},componentDidUpdate:function(){var e=this.getIsVisible(),t=this.kampos&&this.kampos.gl;e?t?this.updateVglInstance():this.initVglInstance():t&&this.stopVglInstance()},componentWillUnmount:function(){this.kampos&&(this.kampos.gl&&this.kampos.destroy(),this.kampos=null,this.hasContext&&(this.props.removeWebGLContext(),this.hasContext=!1)),this.removeVisibilityStateListener(),this.removeVisibilityStateListener=function(){}},componentDidLayout:function(){this.kampos&&this.kampos.media&&this.kampos.setSource(l(this,this.kampos.media))},initVglInstance:function(){var e=this;if(this.kampos&&this.kampos.gl)return this.props.notifyWebGLVisibility(!0),void this.kampos.play();if(a.Kampos.preventContextCreation)this.props.notifyWebGLVisibility(!1);else if(this.props.addWebGLContext()){if(this.hasContext=!0,this.kampos)this.kampos.lostContext?this.kampos.restoreContext():(s(this.kampos.config.effects,d(this.props.filterEffect)),this.kampos.init(),this.kampos.setSource(this.kampos._source||l(this,this.kampos.media)),delete this.kampos._source),this.kampos.play();else{var t=this.refs.canvas,i=p(d(this.props.filterEffect));try{this.kampos=new a.Kampos({target:t,effects:i,onContextLost:function(){var t=e.kampos._source&&e.kampos._source.media;e.props.showMedia&&t&&(t.ended||t.paused)&&(e.kampos._needsRedraw=!0),e.getIsVisible()&&e.initVglInstance()}}),this.kampos.setSource(l(this)),this.kampos.play()}catch(e){this.props.removeWebGLContext(),this.hasContext=!1,this.props.notifyMediaState({type:r.eventTypes.ERROR,error:r.errorTypes.WEBGL_ERROR})}}this.props.notifyWebGLVisibility(!0)}else this.props.notifyWebGLVisibility(!1)},updateVglInstance:function(){if(this.kampos){var e=this.props,t=e.getMediaSource();if(t){var i=l(this,t),o=!0;if(!this.kampos.lostContext&&this.kampos.gl){try{this.kampos.setSource(i),this.kampos.play(),this.props.showMedia||this.props.notifyWebGLVisibility(!0)}catch(e){o=!1,this.props.notifyMediaState({type:r.eventTypes.ERROR,error:r.errorTypes.WEBGL_ERROR})}if(o){var a=e.filterEffect;s(this.kampos.config.effects,d(a))&&this.kampos.init()}}}}},stopVglInstance:function(){this.kampos.stop(),this.hasContext&&!a.Kampos.preventContextCreation&&(this.props.removeWebGLContext(),this.hasContext=!1)},getSkinProperties:function(){return{"":{style:{position:"absolute",width:"100%",height:"100%",top:0,overflow:"hidden",opacity:this.props.showMedia?1:0}},canvas:{role:"presentation","aria-label":this.props.altText,style:{position:"absolute"}}}}}}.apply(t,o))||(e.exports=a)},2:function(e,t){e.exports=i},21:function(e,t){e.exports=s},3:function(e,t){e.exports=o},37:function(e,t){e.exports=p},398:function(e,t,i){var o,a;o=[i(399),i(171),i(400),i(402),i(172),i(174),i(403),i(5),i(405),i(3)],void 0===(a=function(e,t,i,o,a,n,r,s,p,d){"use strict";var u={mixins:{backgroundDetectionMixin:e},components:{bgImage:t,bgMedia:i,bgOverlay:o,html5Video:a,webglMedia:n,iframeVideo:r}};return d.compRegistrar.register("wysiwyg.viewer.components.background.bgMedia",u.components.bgMedia).register("wysiwyg.viewer.components.background.bgImage",u.components.bgImage).register("wysiwyg.viewer.components.background.html5Video",u.components.html5Video).register("wysiwyg.viewer.components.background.webglMedia",u.components.webglMedia).register("wysiwyg.viewer.components.background.iframeVideo",u.components.iframeVideo).register("wysiwyg.viewer.components.background.bgOverlay",u.components.bgOverlay),s.skinsMap.addBatch(p),u}.apply(t,o))||(e.exports=a)},399:function(e,t,i){var o,a;o=[i(2),i(0),i(1),i(37)],void 0===(a=function(e,t,i,o){"use strict";function a(e){return t.get(e.compDesign,"background")||t.get(e.compData,"background",{})}function n(){var e=a(this.props);return new o(i.colorParser.getColor(this.props.colorsMap,e.color,e.colorOpacity))}function r(e,t){var o=e&&e.uri,a=o!==this.lastBackgroundImageUrl,r=t&&t.hexString(),s=this.lastBackgroundBgColor&&this.lastBackgroundBgColor.hexString(),p=!o&&r!==s,d=t&&t.values.alpha!==this.lastAlpha;(a||p||d)&&function(e){var t=e&&e.uri;if(t){var o={id:t,width:e.width,height:e.height},a=i.imageClientApi,r=a.getData(a.fittingTypes.SCALE_TO_FILL,o,{width:1,height:1}).uri,s=this.props.getMediaFullStaticUrl(r);this.props.updateImageInfo(this.props.id,this.props.rootId,s)}else{var p=n.call(this);this.props.updateColorInfo(this.props.id,this.props.rootId,{brightness:p.values.hsv[2],alpha:p.values.alpha})}}.call(this,e),this.lastBackgroundImageUrl=o,this.lastBackgroundBgColor=t,this.lastAlpha=t.values.alpha}return{propTypes:{id:e.santaTypesDefinitions.Component.id,compDesign:e.santaTypesDefinitions.Component.compDesign,compData:e.santaTypesDefinitions.Component.compData,colorsMap:e.santaTypesDefinitions.Theme.colorsMap.isRequired,isMobileView:e.santaTypesDefinitions.isMobileView.isRequired,updateColorInfo:e.santaTypesDefinitions.VerticalAnchorsMenu.updateInformation.isRequired,updateImageInfo:e.santaTypesDefinitions.VerticalAnchorsMenu.updateImageInfo.isRequired,getMediaFullStaticUrl:e.santaTypesDefinitions.ServiceTopology.getMediaFullStaticUrl.isRequired},componentDidMount:function(){if(!this.props.isMobileView){var e=n.call(this),t=this.getMediaImageData();r.call(this,t,e)}},componentDidUpdate:function(){if(!this.props.isMobileView){var e=n.call(this),t=e&&e.hexString(),i=this.lastBackgroundBgColor&&this.lastBackgroundBgColor.hexString(),o=this.getMediaImageData(),a=t!==i,s=(o&&o.uri)!==this.lastBackgroundImageUrl,p=e&&e.values.alpha!==this.lastAlpha;(a||s||p)&&r.call(this,o,e)}},getMediaImageData:function(){var e=a(this.props).mediaRef;if(e)switch(e.type){case"Image":return e;case"WixVideo":return e.posterImageRef}return null}}}.apply(t,o))||(e.exports=a)},4:function(e,t){e.exports=a},400:function(e,t,i){var o,a;o=[i(0),i(4),i(3),i(2),i(21),i(171),i(172),i(174),i(1)],void 0===(a=function(e,t,i,o,a,n,r,s,p){"use strict";var d=p.mediaConsts,u=p.svgFilters,l=p.containerBackgroundUtils,c=p.colorParser,h=a.fittingTypes,f=d.balataConsts,m=f.POSTER,y=f.IMAGE,g=f.BG_IMAGE,v=f.VIDEO,b=f.WEBGL,T=f.IMAGE_BG_PARAMS,E=f.IMAGE_PARAMS,S=f.VIDEO_PARAMS,x=f.WEBGL_PARAMS,k=f.IFRAME_VIDEO_PARAMS,D={image:{componentType:E.comp,skinPartData:{skin:E.skin,styleId:E.style}},bg_image:{componentType:T.comp,skinPartData:{skin:T.skin,styleId:T.style}},poster:{componentType:E.comp,skinPartData:{skin:E.skin,styleId:E.style}},video:{componentType:S.comp,skinPartData:{skin:S.skin,styleId:S.style}},webgl:{componentType:x.comp,skinPartData:{skin:x.skin,styleId:x.style}},iframe:{componentType:k.comp,skinPartData:{skin:k.skin,styleId:k.style}}};function M(t,i,o){var a=i.filterEffect;return{ref:y,id:t.id+y,containerId:t.parentId,autoLayout:!0,wixImageLayout:t.wixImageLayout,key:"img_"+t.bgEffectName,style:{position:"absolute",top:0,width:"100%",height:"100%"},containerWidth:e.get(t.mediaDimensions,"width",0),containerHeight:e.get(t.mediaDimensions,"height",0),imageUrlPreMeasureParams:t.imageUrlPreMeasureParams,shouldRenderSrc:t.shouldRenderSrc,imageData:t.compData,filterEffect:a,displayMode:t.fittingType,hasBgScrollEffect:o,fittingType:t.fittingType,alignType:t.alignType,"data-type":E["data-type"]}}function P(t,i,o){var a=i.registerMediaSource,n=i.notifyVideoVisibility,r=i.showMedia,s=i.filterEffect,p={ref:v,id:t.id+v,parentId:t.parentId,style:e.pick(t.style,["width","height"]),key:"vid_"+t.compData.videoId,notifyMediaState:t.notifyMediaState,isPlayingAllowed:t.isPlayingAllowed,isEditorMode:t.isEditorMode,setMediaAPI:t.setMediaAPI,format:t.playbackFormat,config:t.playbackConfig,playbackUrl:t.playbackUrl,videoRenderParts:t.renderParts.media.video,compProp:t.compProp,keepVideoHidden:e.includes(t.compData.mediaFeatures,"alpha"),notifyVideoVisibility:n,posterWidth:e.get(t.mediaDimensions,"width",0),posterHeight:e.get(t.mediaDimensions,"height",0),imageUrlPreMeasureParams:t.imageUrlPreMeasureParams,shouldRenderSrc:t.shouldRenderSrc,filterEffect:s,hasBgScrollEffect:o,fittingType:t.fittingType,alignType:t.alignType,showMedia:r,wixVideoLayout:t.wixVideoLayout};return a&&(p.registerMediaSource=a),p}function w(t){var i=t.compData,o=t.enableVideo;return"Image"===i.type?function(e){var t=e.fittingType,i=e.cssFiltersSupported,o=e.filterEffect,a=o&&u.isFilterExists(o.effectType);return t===h.TILE&&(a&&i||!a)}(t)?g:y:"WixVideo"===i.type?o?e.includes(i.mediaFeatures,"alpha")&&t.renderParts.media.video.length?b:v:m:void 0}return{displayName:"bgMedia",mixins:[i.mixins.skinBasedComp,i.mixins.createChildComponentMixin],propTypes:e.defaults({id:t.string.isRequired,compData:t.object.isRequired,compProp:t.object,parentId:t.string.isRequired,rootId:t.string.isRequired,alignType:t.string,fittingType:t.string,mediaTransforms:t.object,filterEffect:t.object,bgEffectName:t.string,style:t.object.isRequired,playerStyle:t.object,isPlayingAllowed:t.bool,isEditorMode:t.bool,enableVideo:t.bool,renderParts:t.object,notifyMediaState:t.func,setMediaAPI:t.func,isExperimentOpen:o.santaTypesDefinitions.isExperimentOpen.isRequired,getIsVisible:t.func,addVisibilityStateListener:t.func,addWebGLContext:t.func,removeWebGLContext:t.func,wixImageLayout:t.bool,wixVideoLayout:t.bool,colorsMap:o.santaTypesDefinitions.Theme.colorsMap,cssFiltersSupported:o.santaTypesDefinitions.BrowserFlags.cssFiltersSupported.isRequired,getMediaFullStaticUrl:o.santaTypesDefinitions.ServiceTopology.getMediaFullStaticUrl.isRequired,renderFixedPositionBackgrounds:o.santaTypesDefinitions.RenderFlags.renderFixedPositionBackgrounds},o.utils.santaTypesUtils.getSantaTypesFromPropTypes(o.components.Image.propTypes),o.utils.santaTypesUtils.getSantaTypesByDefinition(n),o.utils.santaTypesUtils.getSantaTypesByDefinition(r),o.utils.santaTypesUtils.getSantaTypesByDefinition(s)),getInitialState:function(){return{mediaSource:null,showMedia:!1,showVideo:!1,showWebGL:!0}},getMediaComponentsDescriptors:function(){var t=[],i=this.props.compData,o=w(this.props),a=function(t,i){return e.isPlainObject(t)?e.mapValues(t,function(e){return c.isThemeColor(e)?c.getHexColor(i,e):e}):t}(this.props.filterEffect,this.props.colorsMap),n=l.isFullScreenByEffect(this.props.bgEffectName,!0);switch(o){case y:var r=M(this.props,{filterEffect:a},n),s=e.assign({},D.image,{extraProps:r,compData:i});t.push(s);break;case g:var p=function(t,i,o){var a=i.filterEffect;return{ref:y,id:t.id+y,containerId:t.parentId,filterEffect:a,style:e.pick(t.style,["width","height"]),mediaDimensions:t.mediaDimensions,imageUrlPreMeasureParams:t.imageUrlPreMeasureParams,shouldRenderSrc:t.shouldRenderSrc,imageData:t.compData,fittingType:t.fittingType,alignType:t.alignType,getMediaFullStaticUrl:t.getMediaFullStaticUrl,hasBgScrollEffect:o,wixImageLayout:t.wixImageLayout,"data-type":T["data-type"]}}(this.props,{filterEffect:a},n),d=e.assign({},D.bg_image,{extraProps:p,compData:i});t.push(d);break;case v:var u={showMedia:this.state.showMedia,notifyVideoVisibility:this.notifyVideoVisibility,filterEffect:a},h=P(this.props,u,n),f=e.assign({},D.video,{extraProps:h,compData:i});t.push(f);break;case b:var E={showMedia:this.state.showMedia,notifyWebGLVisibility:this.notifyWebGLVisibility,getMediaSource:this.getMediaSource,filterEffect:a,altText:i.alt||""},S=function(e,t){var i=t.getMediaSource,o=t.notifyWebGLVisibility,a=t.showMedia,n=t.filterEffect,r=t.altText;return{ref:b,id:e.id+b,key:"gl_"+e.compData.videoId,getMediaSource:i,showMedia:a,isEditorMode:e.isEditorMode,notifyMediaState:e.notifyMediaState,playerStyle:e.playerStyle,filterEffect:n,altText:r,notifyWebGLVisibility:o,getIsVisible:e.getIsVisible,addVisibilityStateListener:e.addVisibilityStateListener,addWebGLContext:e.addWebGLContext,removeWebGLContext:e.removeWebGLContext}}(this.props,E),x=e.assign({},D.webgl,{extraProps:S,compData:i});t.push(x);var k={showMedia:this.state.showMedia,notifyVideoVisibility:this.notifyVideoVisibility,registerMediaSource:this.registerMediaSource,filterEffect:a},R=P(this.props,k,n),V=e.assign({},D.video,{extraProps:R,compData:i});t.push(V);break;case m:var _=M(this.props,{filterEffect:a},n);_.imageData=i.posterImageRef;var I=e.assign({},D.poster,{extraProps:_,compData:i.posterImageRef});t.push(I)}return t},getMediaComponents:function(){var t=this,i=this.getMediaComponentsDescriptors();return e.map(i,function(e){var i=e.compData,o=e.componentType,a=e.skinPartData,n=e.extraProps;return t.createChildComponent(i,o,a,n)})},getMediaSource:function(){return this.state.mediaSource},registerMediaSource:function(e){e!==this.state.mediaSource&&this.setState({mediaSource:e})},notifyVideoVisibility:function(e){e!==this.state.showVideo&&this.setState({showVideo:e,showMedia:e&&this.state.showWebGL})},notifyWebGLVisibility:function(e){e!==this.state.showWebGL&&this.setState({showWebGL:e,showMedia:e&&this.state.showVideo})},getSkinProperties:function(){var t=this.getMediaComponents(),i=this.props.bgEffectName?"media_"+(this.props.isEditorMode?"no_playback":"playback")+"_"+(this.props.enableVideo?"video":"no_video"):"bgMedia",o=e.mapKeys(this.props.mediaTransforms,function(e,t){return"data-"+t}),a=l.isFullScreenByEffect(this.props.bgEffectName,this.props.renderFixedPositionBackgrounds);return{"":e.assign({tagName:this.props.wixImageLayout&&a?"wix-bg-media":"div",key:i,children:t,style:this.props.style,"data-has-bg-effect":a?"1":"","data-fitting":this.props.fittingType,"data-align":this.props.alignType,"data-container-id":this.props.parentId,"data-page-id":this.props.rootId,"data-media-comp-type":w(this.props)},o)}}}}.apply(t,o))||(e.exports=a)},401:function(e,t,i){var o,a,n,r=function(){function e(e,t){for(var i=0;i2&&void 0!==arguments[2]&&arguments[2],s=r?null:{texture:c(e).texture,buffer:null};s&&(e.bindTexture(e.TEXTURE_2D,s.texture),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,!0));var p=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e.reduce(function(e,t){var i,o,a=t.attributes,n=void 0===a?[]:a,r=t.uniforms,s=void 0===r?[]:r,p=t.textures,u=void 0===p?[]:p,l=t.varying,c=void 0===l?{}:l,h=function(i){return Object.keys(t[i]||{}).forEach(function(o){"constant"===o||"main"===o||"source"===o?e[i][o]+=t[i][o]+"\n":e[i][o]=Object.assign(e[i][o],t[i][o])})};return h("vertex"),h("fragment"),n.forEach(function(t){var i=e.attributes.some(function(e,i){if(e.name===t.name)return Object.assign(e,t),!0});i||e.attributes.push(t)}),(i=e.uniforms).push.apply(i,d(s)),(o=e.textures).push.apply(o,d(u)),Object.assign(e.vertex.varying,c),Object.assign(e.fragment.varying,c),e},function(e){var t=e?[]:[{name:"u_source",type:"i",data:[0]}],i=[{name:"a_position",data:new Float32Array([-1,-1,-1,1,1,-1,1,1]),size:2,type:"FLOAT"}];e||i.push({name:"a_texCoord",data:new Float32Array([0,0,0,1,1,0,1,1]),size:2,type:"FLOAT"});return{vertex:{uniform:{},attribute:{},varying:{},constant:"",main:""},fragment:{uniform:{},varying:{},constant:"",main:"",source:""},attributes:i,uniforms:t,textures:[]}}(t))}(n,r),h=u(p.vertex,r?t:i),f=u(p.fragment,r?o:a),m=function(e,t,i){var o=l(e,e.VERTEX_SHADER,t),a=l(e,e.FRAGMENT_SHADER,i);if(o.error)return o;if(a.error)return a;return function(e,t,i){var o=e.createProgram();if(e.attachShader(o,t),e.attachShader(o,i),e.linkProgram(o),e.getProgramParameter(o,e.LINK_STATUS))return{program:o,vertexShader:t,fragmentShader:i};var a={error:e.getProgramInfoLog(o),type:"program"};return e.deleteProgram(o),a}(e,o,a)}(e,h,f),y=m.program,g=m.vertexShader,v=m.fragmentShader,b=m.error,T=m.type;if(b)throw new Error(T+" error:: "+b+"\n"+f);var E=function(e,t,i){return(i||[]).map(function(i){var o=function(e,t,i,o){var a=e.getAttribLocation(t,i),n=e.createBuffer();return e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,o,e.STATIC_DRAW),{location:a,buffer:n}}(e,t,i.name,i.data),a=o.location,n=o.buffer;return{name:i.name,location:a,buffer:n,type:i.type,size:i.size}})}(e,y,p.attributes),S=function(e,t,i){return(i||[]).map(function(i){var o=e.getUniformLocation(t,i.name);return{location:o,size:i.size||i.data.length,type:i.type,data:i.data}})}(e,y,p.uniforms);return{program:y,vertexShader:g,fragmentShader:v,source:s,attributes:E,uniforms:S,textures:p.textures}}(n,r,p);return{gl:n,data:h,dimensions:s||{}}},draw:function(e,t,i,o){var a=i.program,n=i.source,r=i.attributes,s=i.uniforms,p=i.textures;t&&n&&n.texture&&(e.bindTexture(e.TEXTURE_2D,n.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t));e.useProgram(a),function(e,t){(t||[]).forEach(function(t){var i=t.location,o=t.buffer,a=t.size,n=t.type;e.enableVertexAttribArray(i),e.bindBuffer(e.ARRAY_BUFFER,o),e.vertexAttribPointer(i,a,e[n],!1,0,0)})}(e,r),function(e,t){(t||[]).forEach(function(t){var i=t.size,o=t.type,a=t.location,n=t.data;"i"===o&&(n=new Int32Array(n)),e["uniform"+i+o+"v"](a,n)})}(e,s);var d=e.TEXTURE0;n&&(e.activeTexture(d),e.bindTexture(e.TEXTURE_2D,n.texture),d=e.TEXTURE1);if(p)for(var u=0;u1&&void 0!==arguments[1]?arguments[1]:{},i=t.width,o=void 0===i?1:i,a=t.height,n=void 0===a?1:a,r=t.data,s=void 0===r?null:r,p=t.format,d=void 0===p?"RGBA":p,u=t.wrap,l=void 0===u?"stretch":u,c=e.createTexture();return e.bindTexture(e.TEXTURE_2D,c),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e[h(l.x||l)]),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e[h(l.y||l)]),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.NEAREST),s?e.texImage2D(e.TEXTURE_2D,0,e[d],e[d],e.UNSIGNED_BYTE,s):e.texImage2D(e.TEXTURE_2D,0,e[d],o,n,0,e[d],e.UNSIGNED_BYTE,null),{texture:c,width:o,height:n,format:d}}function h(e){return n[e]||n.stretch}return{effects:{brightnessContrast:function(){return{fragment:{uniform:{u_brEnabled:"bool",u_ctEnabled:"bool",u_contrast:"float",u_brightness:"float"},constant:"const vec3 half3 = vec3(0.5);",main:"\n if (u_brEnabled) {\n color *= u_brightness;\n }\n\n if (u_ctEnabled) {\n color = (color - half3) * u_contrast + half3;\n }\n\n color = clamp(color, 0.0, 1.0);"},get brightness(){return this.uniforms[2].data[0]},set brightness(e){this.uniforms[2].data[0]=parseFloat(Math.max(0,e))},get contrast(){return this.uniforms[3].data[0]},set contrast(e){this.uniforms[3].data[0]=parseFloat(Math.max(0,e))},get brightnessDisabled(){return!this.uniforms[0].data[0]},set brightnessDisabled(e){this.uniforms[0].data[0]=+!e},get contrastDisabled(){return!this.uniforms[1].data[0]},set contrastDisabled(e){this.uniforms[1].data[0]=+!e},uniforms:[{name:"u_brEnabled",type:"i",data:[1]},{name:"u_ctEnabled",type:"i",data:[1]},{name:"u_brightness",type:"f",data:[1]},{name:"u_contrast",type:"f",data:[1]}]}},hueSaturation:function(){return{vertex:{uniform:{u_hue:"float",u_saturation:"float"},constant:"\nconst mat3 lummat = mat3(\n lumcoeff,\n lumcoeff,\n lumcoeff\n);\nconst mat3 cosmat = mat3(\n vec3(0.787, -0.715, -0.072),\n vec3(-0.213, 0.285, -0.072),\n vec3(-0.213, -0.715, 0.928)\n);\nconst mat3 sinmat = mat3(\n vec3(-0.213, -0.715, 0.928),\n vec3(0.143, 0.140, -0.283),\n vec3(-0.787, 0.715, 0.072)\n);\nconst mat3 satmat = mat3(\n vec3(0.787, -0.715, -0.072),\n vec3(-0.213, 0.285, -0.072),\n vec3(-0.213, -0.715, 0.928)\n);",main:"\n float angle = (u_hue / 180.0) * 3.14159265358979323846264;\n v_hueRotation = lummat + cos(angle) * cosmat + sin(angle) * sinmat;\n v_saturation = lummat + satmat * u_saturation;"},fragment:{uniform:{u_hueEnabled:"bool",u_satEnabled:"bool",u_hue:"float",u_saturation:"float"},main:"\n if (u_hueEnabled) {\n color = vec3(\n dot(color, v_hueRotation[0]),\n dot(color, v_hueRotation[1]),\n dot(color, v_hueRotation[2])\n );\n }\n\n if (u_satEnabled) {\n color = vec3(\n dot(color, v_saturation[0]),\n dot(color, v_saturation[1]),\n dot(color, v_saturation[2])\n );\n }\n \n color = clamp(color, 0.0, 1.0);"},varying:{v_hueRotation:"mat3",v_saturation:"mat3"},get hue(){return this.uniforms[2].data[0]},set hue(e){this.uniforms[2].data[0]=parseFloat(e)},get saturation(){return this.uniforms[3].data[0]},set saturation(e){this.uniforms[3].data[0]=parseFloat(Math.max(0,e))},get hueDisabled(){return!this.uniforms[0].data[0]},set hueDisabled(e){this.uniforms[0].data[0]=+!e},get saturationDisabled(){return!this.uniforms[1].data[0]},set saturationDisabled(e){this.uniforms[1].data[0]=+!e},uniforms:[{name:"u_hueEnabled",type:"i",data:[1]},{name:"u_satEnabled",type:"i",data:[1]},{name:"u_hue",type:"f",data:[0]},{name:"u_saturation",type:"f",data:[1]}]}},duotone:function(){return{fragment:{uniform:{u_duotoneEnabled:"bool",u_light:"vec4",u_dark:"vec4"},main:"\n if (u_duotoneEnabled) {\n vec3 gray = vec3(dot(lumcoeff, color));\n color = mix(u_dark.rgb, u_light.rgb, gray);\n }"},get light(){return this.uniforms[1].data.slice(0)},set light(e){var t=this;e.forEach(function(e,i){Number.isNaN(e)||(t.uniforms[1].data[i]=e)})},get dark(){return this.uniforms[2].data.slice(0)},set dark(e){var t=this;e.forEach(function(e,i){Number.isNaN(e)||(t.uniforms[2].data[i]=e)})},get disabled(){return!this.uniforms[0].data[0]},set disabled(e){this.uniforms[0].data[0]=+!e},uniforms:[{name:"u_duotoneEnabled",type:"i",data:[1]},{name:"u_light",type:"f",data:[.9882352941,.7333333333,.05098039216,1]},{name:"u_dark",type:"f",data:[.7411764706,.0431372549,.568627451,1]}]}},transparentVideo:function(){return{vertex:{uniform:{u_texOffset:"vec2"},main:"v_texAlphaCoord = v_texCoord + u_texOffset;"},fragment:{uniform:{u_tvEnabled:"bool"},main:"\n if (u_tvEnabled) {\n alpha *= dot(lumcoeff, texture2D(u_source, v_texAlphaCoord).rgb);\n\n // transform alpha values from sRGB source to linearRGB - this cleans up the rim from the result\n float linear;\n if (alpha <= 0.04045) {\n linear = alpha / 12.92;\n }\n else {\n linear = pow((alpha + 0.055) / 1.055, 2.4);\n }\n \n alpha = linear;\n \n if (alpha < 0.04) {\n alpha = 0.0;\n }\n else if (alpha > 0.96) {\n alpha = 1.0;\n }\n }"},get disabled(){return!this.uniforms[0].data[0]},set disabled(e){this.uniforms[0].data[0]=+!e},varying:{v_texAlphaCoord:"vec2"},uniforms:[{name:"u_tvEnabled",type:"i",data:[1]},{name:"u_texOffset",type:"f",data:[0,-.5]}],attributes:[{name:"a_texCoord",data:new Float32Array([0,.5,0,1,1,.5,1,1]),size:2,type:"FLOAT"}]}}},Kampos:function(){function t(e){var i=this;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),!e||!e.target)throw new Error("A target canvas was not provided");if(t.preventContextCreation)throw new Error("Context creation is prevented");if(this._contextCreationError=function(){t.preventContextCreation=!0,e&&e.onContextCreationError&&e.onContextCreationError.call(this,e)},e.target.addEventListener("webglcontextcreationerror",this._contextCreationError,!1),!this.init(e))throw new Error("Could not create context");this._restoreContext=function(t){return t&&t.preventDefault(),i.config.target.removeEventListener("webglcontextrestored",i._restoreContext,!0),!!i.init()&&(i._source&&i.setSource(i._source),delete i._source,e&&e.onContextRestored&&e.onContextRestored.call(i,e),!0)},this._loseContext=function(t){t.preventDefault(),i.gl&&i.gl.isContextLost()&&(i.lostContext=!0,i.config.target.addEventListener("webglcontextrestored",i._restoreContext,!0),i.destroy(!0),e&&e.onContextLost&&e.onContextLost.call(i,e))},this.config.target.addEventListener("webglcontextlost",this._loseContext,!0)}return r(t,[{key:"init",value:function(i){var o=i=i||this.config,a=o.target,n=o.effects,r=o.ticker,s=o.noSource;if(t.preventContextCreation)return!1;this.lostContext=!1;var p=e.getWebGLContext(a);if(!p)return!1;if(p.isContextLost()){if(!this.restoreContext())return!1;if(!(p=e.getWebGLContext(this.config.target)))return!1}var d=e.init({gl:p,effects:n,dimensions:this.dimensions,noSource:s}).data;return this.gl=p,this.data=d,this.config=i,r&&(this.ticker=r,r.add(this)),!0}},{key:"setSource",value:function(t){if(t){if(this.lostContext)if(!this.restoreContext())return;var i=void 0,o=void 0,a=void 0;"[object Object]"===Object.prototype.toString.call(t)?(i=t.media,o=t.width,a=t.height):i=t,o&&a&&(this.dimensions={width:o,height:a}),e.resize(this.gl,this.dimensions),this._createTextures(),this.media=i}}},{key:"draw",value:function(){if(this.lostContext&&!this.restoreContext())return;var t=this.config.beforeDraw;t&&!1===t()||e.draw(this.gl,this.media,this.data,this.dimensions)}},{key:"play",value:function(e){var t=this;if(this.config.beforeDraw=e,this.ticker)this.animationFrameId&&this.stop(),this.playing||(this.playing=!0,this.ticker.add(this));else if(!this.animationFrameId){this.animationFrameId=window.requestAnimationFrame(function e(){t.animationFrameId=window.requestAnimationFrame(e),t.draw()})}}},{key:"stop",value:function(){this.animationFrameId&&(window.cancelAnimationFrame(this.animationFrameId),this.animationFrameId=null),this.playing&&(this.playing=!1,this.ticker.remove(this))}},{key:"destroy",value:function(t){if(this.stop(),this.gl&&this.data&&e.destroy(this.gl,this.data),t){var i=this.dimensions||{};this._source=this._source||{media:this.media,width:i.width,height:i.height}}else this.config.target.removeEventListener("webglcontextlost",this._loseContext,!0),this.config.target.removeEventListener("webglcontextcreationerror",this._contextCreationError,!1),this.config=null,this.dimensions=null;this.gl=null,this.data=null,this.media=null}},{key:"restoreContext",value:function(){if(t.preventContextCreation)return!1;var e=this.config.target,i=this.config.target.cloneNode(!0),o=e.parentNode;return o&&o.replaceChild(i,e),this.config.target=i,e.removeEventListener("webglcontextlost",this._loseContext,!0),e.removeEventListener("webglcontextrestored",this._restoreContext,!0),e.removeEventListener("webglcontextcreationerror",this._contextCreationError,!1),i.addEventListener("webglcontextlost",this._loseContext,!0),i.addEventListener("webglcontextcreationerror",this._contextCreationError,!1),!this.lostContext||this._restoreContext()}},{key:"_createTextures",value:function(){var t=this;this.data&&this.data.textures.forEach(function(i,o){var a=t.data.textures[o];a.texture=e.createTexture(t.gl,{width:t.dimensions.width,height:t.dimensions.height,format:i.format,data:i.data,wrap:i.wrap}).texture,a.format=i.format,a.update=i.update})}}]),t}()}},"object"===p(t)&&void 0!==e?e.exports=n():void 0===(a="function"==typeof(o=n)?o.call(t,i,t,e):o)||(e.exports=a)},402:function(e,t,i){var o,a;o=[i(2),i(4),i(0),i(1),i(21),i(3)],void 0===(a=function(e,t,i,o,a,n){"use strict";function r(e){var t=e.imageOverlay,i=e.getMediaFullStaticUrl,n=e.currentUrl;if(t){var r={imageData:e.imageOverlay,containerWidth:e.imageOverlay.width,containerHeight:e.imageOverlay.height,displayMode:a.fittingTypes.TILE};return"url("+o.imageUtils.getImageComputedProperties(a,r,i,n,1,a.htmlTag.BG).uri+")"}return""}function s(e){var t=e.blendMode,i=e.mixBlendModeSupported,o=e.blendModeOpacity;return t?!i()&&"overlay"===t?o/2:o:1}function p(e){return{width:"100%",height:"100%",position:"absolute",top:0,backgroundImage:r(e),opacity:s(e)}}function d(e){var t=e.bgEffectName,i=e.fixedBackgroundColorBalata,a=e.renderFixedPositionBackgrounds;return i&&o.containerBackgroundUtils.isFullScreenByEffect(t,a)}return{displayName:"bgOverlay",mixins:[n.mixins.skinBasedComp],propTypes:{style:t.object,colorOverlay:t.string,colorOverlayOpacity:t.number,imageOverlay:t.object,bgEffectName:t.string,blendMode:t.string,blendModeOpacity:t.number,mixBlendModeSupported:e.santaTypesDefinitions.BrowserFlags.mixBlendModeSupported.isRequired,isExperimentOpen:e.santaTypesDefinitions.isExperimentOpen,colorsMap:e.santaTypesDefinitions.Theme.colorsMap.isRequired,fixedBackgroundColorBalata:e.santaTypesDefinitions.BrowserFlags.fixedBackgroundColorBalata.isRequired,renderFixedPositionBackgrounds:e.santaTypesDefinitions.RenderFlags.renderFixedPositionBackgrounds,currentUrl:e.santaTypesDefinitions.currentUrl,getMediaFullStaticUrl:e.santaTypesDefinitions.ServiceTopology.getMediaFullStaticUrl},componentDidLayout:function(){},getSkinProperties:function(){var e,t,a,n,s,u,l={style:(e=this.props,t=e.colorOverlay?o.colorParser.getColor(e.colorsMap,e.colorOverlay,e.colorOverlayOpacity):"",a=e.blendMode||"",i.assign({position:e.isExperimentOpen("bv_wixImagePhaseTwo")&&d(e)?"fixed":"absolute",width:"100%",height:"100%",top:0},t&&{backgroundColor:t},a&&{mixBlendMode:a},e.style))};return this.props.isExperimentOpen("bv_wixImagePhaseTwo")||(l["data-background-image"]=r(this.props),l["data-position"]=d(this.props)?"fixed":"absolute"),n={"":l},s=o.mediaConsts.balataConsts.OVERLAY,u={style:p(this.props)},s in n?Object.defineProperty(n,s,{value:u,enumerable:!0,configurable:!0,writable:!0}):n[s]=u,n}}}.apply(t,o))||(e.exports=a)},403:function(e,t,i){var o,a;o=[i(404)],void 0===(a=function(e){"use strict";return e.getIframeVideoComponent({iframeUrl:"https://wix-private.github.io/video-fx-player/360.html",apiId:"wix-video-fx-player",displayName:"iframeVideo"})}.apply(t,o))||(e.exports=a)},404:function(e,t,i){var o,a;o=[i(0),i(4),i(3),i(1),i(45),i(2),i(173)],void 0===(a=function(e,t,i,o,a,n,r){"use strict";var s=o.mediaConsts;return{getIframeVideoComponent:function(p){var d=p.iframeUrl,u=p.apiId,l=p.displayName;return{displayName:void 0===l?"iframeVideo":l,mixins:[r,i.mixins.skinBasedComp,i.mixins.createChildComponentMixin],propTypes:e.defaults({compData:t.object.isRequired,compProp:t.object,isPlayingAllowed:t.bool,notifyMediaState:t.func.isRequired,setMediaAPI:t.func.isRequired,staticVideoUrl:n.santaTypesDefinitions.ServiceTopology.staticVideoUrl},n.utils.santaTypesUtils.getSantaTypesFromPropTypes(n.components.Image.propTypes)),getInitialState:function(){return this.player=null,this.eventHandlers=[],{loadVideo:!1,showVideo:!1}},componentDidMount:function(){this.props.setMediaAPI(this.mediaAPI),this.props.notifyMediaState({type:s.eventTypes.MOUNT,playbackState:s.playbackTypes.LOADING}),this.props.compProp.autoplay&&this.props.isPlayingAllowed&&this.play()},componentDidUpdate:function(){this.setRate(this.props.compData.playbackSpeed||1)},componentWillUnmount:function(){this.props.setMediaAPI(null),this.removeVideoSecurely()},getUrl:function(t,i){var a="https://video.wixstatic.com/";if(!i)return"";var n=e.find(t.qualities,{quality:i});return n.url?o.urlUtils.joinURL(a,n.url):o.urlUtils.joinURL(a,t.videoId,i,"mp4","file.mp4")},onVideoFrameReady:function(){var e=this,t=this.getUrl(this.props.compData,this.props.mediaQuality);a.api.request(u,{target:this.refs.video}).then(function(i){e.player=i,e.player.set(t,{loop:!1,mute:e.props.compProp.mute||!1===e.props.compData.hasAudio,autoplay:!0,rate:e.props.compData.playbackSpeed||1,preload:e.props.compData.preload||"none"},e.onVideoEvent),e.addVideoEventListener("timeupdate",e.handlePosterVisibilityOnce),e.addVideoEventListener("ended",e.onPlayEnded),e.addVideoEventListener("error",e.onError),e.addVideoEventListener("loadstart",e.onLoadStart),e.addVideoEventListener("durationchange",e.onDurationChange),e.addVideoEventListener("pause",e.onPause),e.addVideoEventListener("play",e.onPlay),e.addVideoEventListener("progress",e.onProgress),e.addVideoEventListener("ratechange",e.onRateChange),e.addVideoEventListener("seeked",e.onSeekEnd),e.addVideoEventListener("seeking",e.onSeekStart),e.addVideoEventListener("stalled",e.onStalled),e.addVideoEventListener("timeupdate",e.onTimeUpdate),e.addVideoEventListener("volumechange",e.onVolumeChange)}).catch(function(e){console.log("Video API not loaded.",e)})},addVideoEventListener:function(t,i){if(!e.find(this.eventHandlers,{eventType:t,handler:i}))return this.eventHandlers.push({eventType:t,handler:i}),!0},removeVideoEventListener:function(t,i){if(e.find(this.eventHandlers,{eventType:t,handler:i}))return this.eventHandlers=e.reject(this.eventHandlers,{eventType:t,handler:i}),!0},onVideoEvent:function(t){var i=e.filter(this.eventHandlers,{eventType:t.type});e.forEach(i,function(e){e.handler(t)})},handlePosterVisibilityOnce:function(e){e.currentTime>0&&(this.removeVideoEventListener("timeupdate",this.handlePosterVisibilityOnce),this.setState({showVideo:!0}))},resetPosterState:function(){this.state.showVideo&&(this.setState({showVideo:!1}),this.addVideoEventListener("timeupdate",this.handlePosterVisibilityOnce))},removeVideoSecurely:function(){this.player&&(this.eventHandlers=[],this.player.reset())},play:function(){this.player?this.player.play():this.setState({loadVideo:!0})},pause:function(){this.player&&this.player.pause()},stop:function(){this.player&&(this.pause(),this.seek(0),this.resetPosterState())},setVolume:function(e){this.player&&this.player.setVolume(e)},mute:function(){this.player&&this.player.setMute(!0)},unMute:function(){this.player&&this.player.setMute(!1)},seek:function(e){this.player&&this.player.seek(e)},setRate:function(e){this.player&&this.player.setRate(e)},onLoadStart:function(e){this.props.notifyMediaState({type:s.eventTypes.LOAD,playbackState:s.playbackTypes.READY,volume:e.volume,muted:e.muted,looped:this.props.compProp.loop,currentTime:e.currentTime,progress:0})},onDurationChange:function(e){this.props.notifyMediaState({type:s.eventTypes.LOAD,duration:e.duration})},onTimeUpdate:function(e){this.props.notifyMediaState({type:s.eventTypes.TIME_UPDATE,currentTime:e.currentTime})},onPlayEnded:function(){this.props.notifyMediaState({type:s.eventTypes.PLAYSTATE,playbackState:s.playbackTypes.PLAY_ENDED})},onPlay:function(){this.props.notifyMediaState({type:s.eventTypes.PLAYSTATE,playbackState:s.playbackTypes.PLAYING})},onPause:function(){this.props.notifyMediaState({type:s.eventTypes.PLAYSTATE,playbackState:s.playbackTypes.PAUSED})},onError:function(e){e.networkState===e.NETWORK_NO_SOURCE?this.props.notifyMediaState({type:s.eventTypes.ERROR,error:s.errorTypes.NO_VIDEO_FOUND}):this.props.notifyMediaState({type:s.eventTypes.ERROR,error:s.errorTypes.VIDEO_GENERAL_ERROR})},onStalled:function(e){e.readyState===e.HAVE_NOTHING&&this.props.notifyMediaState({type:s.eventTypes.ERROR,error:s.errorTypes.NO_VIDEO_FOUND})},onProgress:function(e){this.props.notifyMediaState({type:s.eventTypes.PROGRESS,progress:e.progress})},onSeekStart:function(){this.props.notifyMediaState({type:s.eventTypes.PLAYSTATE,playbackState:s.playbackTypes.SEEKING})},onSeekEnd:function(){this.props.notifyMediaState({type:s.eventTypes.PLAYSTATE,playbackState:s.playbackTypes.SEEKING_ENDED})},onVolumeChange:function(e){this.props.notifyMediaState({type:s.eventTypes.VOLUME,volume:e.volume,muted:e.muted})},onRateChange:function(e){this.props.notifyMediaState({type:s.eventTypes.RATE,playbackRate:e.playbackRate})},getVideo:function(){return n.utils.createReactElement("iframe",{ref:"video",id:this.props.id+"video",frameBorder:0,allowFullScreen:!0,"data-src":this.state.loadVideo?d:"about:blank",onLoad:this.onVideoFrameReady})},getSkinProperties:function(){var e={containerWidth:this.props.posterWidth||0,containerHeight:this.props.posterHeight||0,shouldRenderSrc:this.props.shouldRenderSrc},t=this.getPosterImageComp(this.props.compData.posterImageRef,this.state.showVideo,e);return{"":{"data-quality":this.props.mediaQuality,"data-player-type":"iframe",style:{width:"100%"}},video:this.getVideo(),poster:t}}}}}}.apply(t,o))||(e.exports=a)},405:function(e,t,i){var o,a,n;"undefined"!=typeof self&&self,a=[],void 0===(n="function"==typeof(o=function(){"use strict";var e={"skins.viewer.bgImage.bgImageSkin":{react:[],css:{}},"skins.viewer.bgMedia.bgMediaSkin":{react:[],css:{}},"skins.viewer.bgOverlay.bgOverlaySkin":{react:[["div","overlay",[],{}]]},"skins.viewer.bgVideo.html5VideoSkin":{react:[["video","video",[],{role:"presentation"}],["div","poster",[],{}]],exports:{poster:{skin:"skins.core.ImageNewSkinZoomable"}},css:{}},"skins.viewer.bgVideo.iframeVideoSkin":{react:[["div","video",[],{}],["div","poster",[],{}]],exports:{poster:{skin:"skins.core.ImageNewSkinZoomable"}},css:{}},"skins.viewer.bgVideo.webglMediaSkin":{react:[["canvas","canvas",[],{}]],css:{}}};return e})?o.apply(t,a):o)||(e.exports=n)},45:function(e,t){e.exports=d},5:function(e,t){e.exports=n},9:function(e,t){e.exports=r}})}); //# sourceMappingURL=backgroundCommon.min.js.map