Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

richlagetest

Package Overview
Dependencies
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

richlagetest - npm Package Compare versions

Comparing version 0.0.0-5b81c4dfa849458fc448e84873c99e378bc1e9c1 to 0.0.0-5bbc0dc28e6b07984c8d7ef5ca86870ae557b725

dist/loadable/viewer/cjs/video-viewer.cjs.js

2

dist/module.cjs.js

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var wixRichContentCommon=require("wix-rich-content-common"),_extends=require("@babel/runtime/helpers/extends"),_objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),wixRichContentPluginCommons=require("wix-rich-content-plugin-commons"),React=require("react"),wixRichContentEditorCommon=require("wix-rich-content-editor-common"),_assertThisInitialized=require("@babel/runtime/helpers/assertThisInitialized"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),lodash=require("lodash"),_createClass=require("@babel/runtime/helpers/createClass"),classNames=require("classnames"),Modal=require("react-modal");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _pluginSettingsByType,_extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),React__default=_interopDefaultLegacy(React),_assertThisInitialized__default=_interopDefaultLegacy(_assertThisInitialized),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),_createClass__default=_interopDefaultLegacy(_createClass),classNames__default=_interopDefaultLegacy(classNames),Modal__default=_interopDefaultLegacy(Modal),TEXT_COLOR_TYPE="wix-rich-content-text-color",TEXT_HIGHLIGHT_TYPE="wix-rich-content-text-highlight",normalizeStyle=function(style){try{return JSON.parse(style)}catch(e){return{FG:style}}},isTextDecoration=function(style,type){return!!normalizeStyle(style)[type]},getColorByType=function(style,type){return normalizeStyle(style)[type]||""},getColor=function(style){var parsed=normalizeStyle(style);return Object.values(parsed)[0]},textForegroundPredicate=function(styleSelectionPredicate){return function(style){return styleSelectionPredicate(getColorByType(style,"FG"))}},textBackgroundPredicate=function(styleSelectionPredicate){return function(style){return styleSelectionPredicate(getColorByType(style,"BG"))}},styleMapper=function(type){return type===TEXT_HIGHLIGHT_TYPE?function(color){return JSON.stringify({BG:color})}:function(color){return JSON.stringify({FG:color})}},DEFAULT_PALETTE=Object.freeze(["#ffffff","#303030","#3a54b4","#bfad80","#bf695c","#f7f7f7"]),DEFAULT_STYLE_SELECTION_PREDICATE=function(style){return wixRichContentCommon.isHexColor(style)},userColors=[],DEFAULTS={configTextColor:{editor:{onColorAdded:function(color){return userColors=[].concat(userColors,[color])},getUserColors:function(){return userColors}},viewer:{}},configTextHighlight:{editor:{onColorAdded:function(color){return userColors=[].concat(userColors,[color])},getUserColors:function(){return userColors}},viewer:{}}},schema={definitions:{},$schema:"http://json-schema.org/draft-07/schema#",$id:"color-scheme",type:"object",title:"color-scheme schema",required:["color","index"],properties:{color:{$id:"#/properties/color",type:"string",title:"hex color",default:"",examples:["#fff","#bada55"],pattern:"^#[0-9a-f]{3}(?:[0-9a-f]{3})?$"},index:{$id:"#/properties/index",type:"integer",title:"color index",default:0,examples:[0]}}},extractColor=function(colorScheme,style){return colorScheme&&colorScheme[style]?colorScheme[style].color:wixRichContentCommon.isHexColor(style)?style:void 0},TextColorPanel=function(_Component){function TextColorPanel(props){var _this,colorScheme;return(_this=_Component.call(this,props)||this).styleSelectionPredicate=props.predicate(props.settings.styleSelectionPredicate||DEFAULT_STYLE_SELECTION_PREDICATE),!props.settings.colorScheme||(colorScheme=props.settings.colorScheme,lodash.isObject(colorScheme)&&Object.values(colorScheme).every((function(value){return wixRichContentCommon.validate(value,schema)})))||console.error("Error: colorScheme is not valid"),_this.currentColors=wixRichContentEditorCommon.getSelectionStyles(props.editorState,_this.styleSelectionPredicate),_this.state={currentColor:_this.currentColors.length>0?extractColor(props.settings.colorScheme,getColor(_this.currentColors[0])):_this.props.defaultColor,currentSchemeColor:_this.currentColors[0]&&getColor(_this.currentColors[0]),userColors:props.settings.getUserColors()||[]},_this.setColor=_this.setColor.bind(_assertThisInitialized__default.default(_this)),_this.onColorAdded=_this.onColorAdded.bind(_assertThisInitialized__default.default(_this)),_this}_inheritsLoose__default.default(TextColorPanel,_Component);var _proto=TextColorPanel.prototype;return _proto.componentWillUnmount=function(){this.props.setKeepToolbarOpen(!1)},_proto.setColor=function(_temp){var colorName=(void 0===_temp?{}:_temp).color,_this$props=this.props,editorState=_this$props.editorState,settings=_this$props.settings,defaultColor=_this$props.defaultColor,onSelect=_this$props.onSelect,styleMapper=_this$props.styleMapper,predicate=_this$props.predicate,newColorHex=colorName&&extractColor(settings.colorScheme,colorName);editorState=getInlineColorState(colorName,editorState,settings,styleMapper,predicate),this.setState({currentColor:newColorHex||defaultColor,currentSchemeColor:colorName||this.currentColors[0]&&getColor(this.currentColors[0])}),this.props.closeModal(editorState),onSelect&&onSelect(colorName)},_proto.onColorAdded=function(_ref2){var color=_ref2.color;this.props.settings.onColorAdded(color),this.setState({userColors:this.props.settings.getUserColors()||[]})},_proto.render=function(){var _this$props2=this.props,theme=_this$props2.theme,settings=_this$props2.settings,t=_this$props2.t,setKeepToolbarOpen=_this$props2.setKeepToolbarOpen,isMobile=_this$props2.isMobile,defaultColor=_this$props2.defaultColor,colorPickerHeaderKey=_this$props2.colorPickerHeaderKey,colorScheme=settings.colorScheme,palette=function(colorScheme){return colorScheme?Object.values(colorScheme).sort((function(entry1,entry2){return entry1.index>entry2.index?1:-1})).map((function(entry){return entry.color})):DEFAULT_PALETTE}(colorScheme),schemeAttributes=function(colorScheme){return colorScheme?Object.keys(colorScheme).reduce((function(sorted,key){return!sorted.length||colorScheme[key].index>colorScheme[sorted[0]].index?sorted.push(key):sorted.unshift(key),sorted}),[]):null}(colorScheme),onCustomPickerToggle=settings.onCustomPickerToggle,onCustomColorPicked=settings.onCustomColorPicked,paletteColors=isMobile?palette.slice(0,5):palette.slice(0,6);return React__default.default.createElement(wixRichContentPluginCommons.ColorPicker,{schemeAttributes:schemeAttributes,schemeColor:this.state.currentSchemeColor,color:this.state.currentColor,defaultColor:defaultColor,palette:paletteColors,userColors:this.state.userColors.slice(0,17),onColorAdded:this.onColorAdded,onChange:this.setColor,onResetColor:this.setColor,onCustomPickerToggle:onCustomPickerToggle,onCustomColorPicked:onCustomColorPicked,theme:theme,t:t,setKeepToolbarOpen:setKeepToolbarOpen,isMobile:isMobile},(function(_ref3){var renderPalette=_ref3.renderPalette,renderUserColors=_ref3.renderUserColors,renderAddColorButton=_ref3.renderAddColorButton,renderResetColorButton=_ref3.renderResetColorButton,mergedStyles=_ref3.mergedStyles;return React__default.default.createElement(React__default.default.Fragment,null,isMobile&&React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:mergedStyles.colorPicker_header},t(colorPickerHeaderKey)),React__default.default.createElement("div",{className:mergedStyles.colorPicker_separator})),React__default.default.createElement("div",{className:mergedStyles.colorPicker_palette},React__default.default.createElement("div",{className:mergedStyles.colorPicker_buttons_container},renderPalette(),renderUserColors(),isMobile&&renderAddColorButton()),!isMobile&&React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("hr",{className:mergedStyles.colorPicker_separator}),React__default.default.createElement("div",{className:mergedStyles.colorPicker_bottom_container},renderResetColorButton(),renderAddColorButton()))))}))},TextColorPanel}(React.Component),getInlineColorState=function(color,editorState,settings,styleMapper,predicate){var styleSelectionPredicate=predicate(settings&&settings.styleSelectionPredicate||DEFAULT_STYLE_SELECTION_PREDICATE),selection=editorState.getSelection(),newEditorState=wixRichContentEditorCommon.getSelectionStyles(editorState,styleSelectionPredicate).reduce((function(nextEditorState,prevColor){var contentState=nextEditorState.getCurrentContent(),nextContentState=wixRichContentEditorCommon.Modifier.removeInlineStyle(contentState,selection,prevColor);return wixRichContentEditorCommon.EditorState.push(nextEditorState,nextContentState,"change-inline-style")}),editorState),contentState=newEditorState.getCurrentContent();return color&&(contentState=wixRichContentEditorCommon.Modifier.applyInlineStyle(contentState,selection,styleMapper(color))),wixRichContentEditorCommon.EditorState.push(newEditorState,contentState,"change-inline-style")},TextColorIcon=function(props){return props.newFormattingToolbar?React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"21",height:"21",viewBox:"0 0 21 21"},props),React__default.default.createElement("path",{width:"10",height:"10",viewBox:"0 0 10 10",fill:props.isDisabled?"graytext":"#000",id:"Icon",d:"M7.84 10l2-5h.32l2 5H7.84zm5.92 4h1.08l-4-10H9.16l-4 10h1.08l1.2-3h5.12l1.2 3z"}),React__default.default.createElement("path",{width:"12",height:"3",viewBox:"0 0 12 3",fill:props.isDisabled?"graytext":""+props.currentColor,id:"Fill",fillRule:"nonzero",d:"M4 19L16 19 16 16 4 16z"})):React__default.default.createElement("svg",Object.assign({width:19,height:19,viewBox:"0 0 19 19"},props),React__default.default.createElement("path",{fill:"currentColor",d:"M12.9406953 8.95385441C12.1642734 9.88748434 11.6208213 10.7926967 11.3103388 11.6694915L7.40037874 11.6694915 6.54305663 13.9353876C6.52834357 13.9742741 6.49110424 14 6.4495274 14L4.09790277 14C4.04267429 14 3.99790277 13.9552285 3.99790277 13.9 3.99790277 13.8868237 4.00050674 13.8737773 4.00556503 13.8616107L8.4700421 3.12322131C8.50105957 3.04861511 8.5739205 3 8.65471758 3L10.3160943 3C10.396723 3 10.4694666 3.04841524 10.5005916 3.12279406L12.9406953 8.95385441zM9.41798529 6.20056497L8.13269519 9.61864407 10.7182206 9.61864407 9.41798529 6.20056497zM12 13.4245258C12 14.8207269 13.145 16 14.5 16 15.855 16 17 14.8202416 17 13.4245258 17 12.103093 16.2894438 10.6820365 14.8683313 9.16135614L14.8683089 9.16137708C14.6797751 8.95963399 14.3633932 8.94892574 14.1616501 9.13745952 14.1536124 9.144971 14.1458247 9.15274572 14.1382999 9.16077099 12.7127666 10.6811133 12 12.1023649 12 13.4245258z"}))},TextHighlightIcon=function(props){return props.newFormattingToolbar?React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"},props),React__default.default.createElement("path",{width:"11",height:"10",viewBox:"0 0 11 10",fill:props.isDisabled?"graytext":"#000",id:"Icon",d:"M10.616 3.366L6.5 7.482 4.207 5.189l4.116-4.116c.098-.098.256-.098.354 0l1.94 1.939c.097.098.097.256 0 .354zM5.293 8.689h-1.94L3 8.336v-1.94l.5-.5 2.293 2.293-.5.5zm6.03-6.384L9.384.366c-.487-.488-1.282-.488-1.768 0l-5.47 5.47c-.093.093-.146.22-.146.353v2.147L.823 9.512c-.06.062-.087.15-.066.235.02.084.082.152.164.18l1.5.5c.026.008.052.012.08.012.064 0 .128-.025.176-.073l.676-.677H5.5c.133 0 .26-.052.353-.146l5.47-5.47c.487-.487.487-1.28 0-1.768z",transform:"translate(-210.000000, -80.000000) translate(206.000000, 77.000000) translate(4.000000, 3.310800)"}),React__default.default.createElement("path",{width:"12",height:"3",viewBox:"0 0 12 3",fill:props.isDisabled?"graytext":""+props.currentColor,id:"Fill",fillRule:"nonzero",d:"M0 15.689L12 15.689 12 12.689 0 12.689z"})):React__default.default.createElement("svg",Object.assign({width:"19px",height:"19px",viewBox:"0 0 19 19"},props),React__default.default.createElement("title",null,"Fill Color"),React__default.default.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},React__default.default.createElement("path",{d:"M13,15.4025547 C13,16.1865787 13.687,16.8487889 14.5,16.8487889 C15.313,16.8487889 16,16.1863062 16,15.4025547 C16,14.7033546 15.6214705,13.9544845 14.8644116,13.1559444 L14.8643729,13.1559811 C14.6744053,12.9556048 14.3579691,12.9471668 14.1575928,13.1371343 C14.1513476,13.1430551 14.1452562,13.1491362 14.1393249,13.1553715 C13.379775,13.9538457 13,14.7029067 13,15.4025547 Z",fill:"currentColor",fillRule:"nonzero"}),React__default.default.createElement("path",{d:"M3.5,6 C3.22385763,6 3,5.77614237 3,5.5 C3,5.22385763 3.22385763,5 3.5,5 L12.748729,5 C13.3010137,5 13.748729,5.44771525 13.748729,6 L13.748729,13 C13.748729,13.5522847 13.3010137,14 12.748729,14 L5.74872899,14 C5.19644424,14 4.74872899,13.5522847 4.74872899,13 L4.74872899,6 L3.5,6 Z M12.748729,6.00005457 L5.74872899,6.00005457 L5.74872899,13.0000546 L12.748729,6.00005457 Z",fill:"currentColor",fillRule:"nonzero",transform:"translate(8.374364, 9.500000) rotate(-315.000000) translate(-8.374364, -9.500000) "})))},pluginSettingsByType=((_pluginSettingsByType={})[TEXT_COLOR_TYPE]={defaultColor:"#000000",icon:TextColorIcon,predicate:textForegroundPredicate,tooltipKey:"TextColorButton_Tooltip",colorPickerHeaderKey:"Color_Picker_TextColorButton_Header"},_pluginSettingsByType[TEXT_HIGHLIGHT_TYPE]={defaultColor:"#ffffff",icon:TextHighlightIcon,predicate:textBackgroundPredicate,tooltipKey:"TextHighlightButton_Tooltip",colorPickerHeaderKey:"Color_Picker_TextHighlightButton_Header"},_pluginSettingsByType),getButtonProps=function(_ref){var config=_ref.config,type=_ref.type,getEditorState=config.getEditorState,setEditorState=config.setEditorState,t=config.t,theme=config.theme,isMobile=config.isMobile,helpers=config.helpers,uiSettings=config.uiSettings,settings=config[type],experiments=config.experiments,pluginSettings=pluginSettingsByType[type],styleMap=styleMapper(type),noop=function(){return!1},modalStylesFn=function(ref){if(null==ref||!ref.getBoundingClientRect)return{};var _ref$getBoundingClien=ref.getBoundingClientRect(),bottom=_ref$getBoundingClien.bottom,left=_ref$getBoundingClien.left;return isMobile?{content:{position:"absolute",left:"0px",right:"0px",bottom:"0",border:"none",background:"white",overflow:"auto",outline:"none",padding:"0px",width:"100%",zIndex:"6",top:"auto",transform:"translateY(0)",margin:0}}:{content:{display:"inline-table",transform:"translateY(0)",minHeight:"88px",position:"absolute",minWidth:"89px",maxWidth:"184",width:"182px",height:"86px",top:bottom,left:left-15,borderRadius:"2px",border:"1px solid #ededed",margin:"0",background:"#fff"},overlay:{background:"transparent"}}},TextColorModal=function(_ref2){var closeCustomModal=_ref2.closeCustomModal,onSelect=_ref2.onSelect;return React__default.default.createElement(TextColorPanel,{t:t,isMobile:isMobile,theme:theme,closeModal:function(args){var newEditorState,_helpers$closeModal,editorState,selection;newEditorState=args,editorState=getEditorState(),selection=editorState.getSelection(),setEditorState(wixRichContentEditorCommon.EditorState.forceSelection(newEditorState||editorState,selection)),null==helpers||null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal||_helpers$closeModal.call(helpers),closeCustomModal&&closeCustomModal()},editorState:getEditorState(),setEditorState:setEditorState,settings:settings,uiSettings:uiSettings,styleMapper:styleMap,predicate:pluginSettings.predicate,defaultColor:pluginSettings.defaultColor,setKeepToolbarOpen:noop,onSelect:onSelect,colorPickerHeaderKey:pluginSettings.colorPickerHeaderKey})},isDisabled=function(){return getEditorState().getSelection().isCollapsed()||wixRichContentEditorCommon.isAtomicBlockFocused(getEditorState())};return{onClose:function(){},onClick:function(_ref4){return function(_ref3){var ref=_ref3.ref,render=_ref3.render;if(render)render(TextColorModal);else{var _helpers$openModal,modalStyles=wixRichContentEditorCommon.getModalStyles({customStyles:modalStylesFn(ref),fullScreen:!1,isMobile:isMobile});null==helpers||null===(_helpers$openModal=helpers.openModal)||void 0===_helpers$openModal||_helpers$openModal.call(helpers,{modalStyles:modalStyles,helpers:helpers,isMobile:isMobile,modalElement:TextColorModal,theme:theme})}}({ref:_ref4.ref,render:_ref4.render})},isDisabled:isDisabled,arrow:!1,isActive:function(){var predicate=pluginSettings.predicate((null==settings?void 0:settings.styleSelectionPredicate)||DEFAULT_STYLE_SELECTION_PREDICATE);return wixRichContentEditorCommon.getSelectionStyles(config.getEditorState(),predicate).length>0},getIcon:function(){var _settings$toolbar,_settings$toolbar$ico;return(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.InsertPluginButtonIcon)||function(){var _experiments$newForma,editorState,predicate,defaultColor,styleSelectionPredicate,currentColors;return pluginSettings.icon({newFormattingToolbar:null==experiments||null===(_experiments$newForma=experiments.newFormattingToolbar)||void 0===_experiments$newForma?void 0:_experiments$newForma.enabled,currentColor:(editorState=getEditorState(),predicate=pluginSettings.predicate,defaultColor=pluginSettings.defaultColor,styleSelectionPredicate=predicate(settings.styleSelectionPredicate||DEFAULT_STYLE_SELECTION_PREDICATE),currentColors=wixRichContentEditorCommon.getSelectionStyles(editorState,styleSelectionPredicate),currentColors.length>0?extractColor(settings.colorScheme,getColor(currentColors[0])):defaultColor),isDisabled:isDisabled()})}},tooltip:config.t(pluginSettings.tooltipKey),getLabel:function(){return""},type:wixRichContentEditorCommon.BUTTON_TYPES.DROPDOWN,dataHook:type.replace(/\s+/g,"-").toLowerCase()+"-button",modal:TextColorModal,onSelect:function(color){var editorState=getEditorState(),selection=editorState.getSelection(),coloredEditorState=getInlineColorState(color,getEditorState(),settings,styleMap,pluginSettings.predicate);setEditorState(wixRichContentEditorCommon.EditorState.forceSelection(coloredEditorState||editorState,selection))}}},styles={textColorModal:"_2L0nY",textColorModal_mobile:"_2Otbl",textColorModalOverlay:"_1J3EL",textColorModalOverlay_mobile:"_2p47r",textColorPopup_button:"IiTdz",textColorPopup:"_6IxcZ"},BaseTextColor=function(_Component){function BaseTextColor(props){var _this;return(_this=_Component.call(this,props)||this).openPanel=function(){var _this$props=_this.props,isMobile=_this$props.isMobile,setKeepOpen=_this$props.setKeepOpen,config=_this$props.config,pluginParams=_this$props.pluginParams;isMobile||setKeepOpen&&setKeepOpen(!0);var settings=config[pluginParams.type],position={};if(settings.positionPicker)position=settings.positionPicker(_this.buttonRef,216);else{var _this$buttonRef$curre=_this.buttonRef.current.getBoundingClientRect(),bottom=_this$buttonRef$curre.bottom;position={left:_this$buttonRef$curre.left-108,top:bottom}}_this.setState({isPanelOpen:!0,panelLeft:position.left,panelTop:position.top})},_this.closePanel=function(editorState){_this.setState({isPanelOpen:!1}),_this.props.setKeepOpen(!1),_this.preserveSelectionState(editorState)},_this.state={showPanel:!1},_this.styles=wixRichContentCommon.mergeStyles({styles:styles,theme:props.theme}),_this.buttonRef=props.buttonRef,_this.styleMapper=styleMapper(props.pluginParams.type),_this}_inheritsLoose__default.default(BaseTextColor,_Component),BaseTextColor.getModalParent=function(){var _document,_document$querySelect;return null===(_document=document)||void 0===_document||null===(_document$querySelect=_document.querySelector(".DraftEditor-root"))||void 0===_document$querySelect?void 0:_document$querySelect.parentNode};var _proto=BaseTextColor.prototype;return _proto.preserveSelectionState=function(newEditorState){var _this$props2=this.props,setEditorState=_this$props2.setEditorState,editorState=(0,_this$props2.getEditorState)(),selection=editorState.getSelection();setEditorState(wixRichContentEditorCommon.EditorState.forceSelection(newEditorState||editorState,selection))},_proto.render=function(){var _classNames,_classNames2,_this2=this,_this$props3=this.props,theme=_this$props3.theme,helpers=_this$props3.helpers,isMobile=_this$props3.isMobile,t=_this$props3.t,tabIndex=_this$props3.tabIndex,setEditorState=_this$props3.setEditorState,getEditorState=_this$props3.getEditorState,setKeepOpen=_this$props3.setKeepOpen,config=_this$props3.config,uiSettings=_this$props3.uiSettings,pluginParams=_this$props3.pluginParams,toolbarName=_this$props3.toolbarName,settings=config[pluginParams.type],_this$state=this.state,isPanelOpen=_this$state.isPanelOpen,panelTop=_this$state.panelTop,panelLeft=_this$state.panelLeft,tooltip=t(pluginParams.toolTip),buttonStyles={button:theme.inlineToolbarButton,buttonWrapper:theme.inlineToolbarButton_wrapper,icon:theme.inlineToolbarButton_icon,active:theme.inlineToolbarButton_active},modalStyle={content:isMobile?{top:"unset",left:0,backgroundColor:"white"}:{top:panelTop,left:panelLeft,marginTop:15,borderRadius:2,width:184}},TEXT_COLOR=wixRichContentEditorCommon.FORMATTING_BUTTONS.TEXT_COLOR,TEXT_HIGHLIGHT=wixRichContentEditorCommon.FORMATTING_BUTTONS.TEXT_HIGHLIGHT,formattingButtonName=pluginParams.type===TEXT_COLOR_TYPE?TEXT_COLOR:TEXT_HIGHLIGHT;return isMobile||"StaticTextToolbar"!==toolbarName||!settings.inlinePopups?React__default.default.createElement(wixRichContentEditorCommon.InlineToolbarButton,{onClick:this.openPanel,isActive:this.isActive,helpers:helpers,theme:_extends__default.default({},theme,buttonStyles),isMobile:isMobile,tooltipText:tooltip,dataHook:pluginParams.dataHook,formattingButtonName:formattingButtonName,tabIndex:tabIndex,icon:pluginParams.icon,forwardRef:this.buttonRef,pluginType:pluginParams.type},React__default.default.createElement(Modal__default.default,{onRequestClose:function(){return _this2.closePanel()},isOpen:isPanelOpen,parentSelector:BaseTextColor.getModalParent,className:classNames__default.default((_classNames={},_classNames[this.styles.textColorModal]=!isMobile,_classNames[this.styles.textColorModal_mobile]=isMobile,_classNames)),overlayClassName:classNames__default.default((_classNames2={},_classNames2[this.styles.textColorModalOverlay]=!isMobile,_classNames2[this.styles.textColorModalOverlay_mobile]=isMobile,_classNames2)),style:modalStyle,ariaHideApp:!1},React__default.default.createElement(TextColorPanel,{t:t,isMobile:isMobile,theme:theme,closeModal:this.closePanel,editorState:getEditorState(),setEditorState:setEditorState,settings:settings,uiSettings:uiSettings,setKeepToolbarOpen:setKeepOpen,styleMapper:this.styleMapper,predicate:pluginParams.predicate,defaultColor:pluginParams.defaultColor,colorPickerHeaderKey:pluginParams.colorPickerHeaderKey}))):React__default.default.createElement("div",{className:styles.textColorPopup_button},React__default.default.createElement(wixRichContentEditorCommon.InlineToolbarButton,{onClick:this.openPanel,isActive:this.isActive,helpers:helpers,theme:_extends__default.default({},theme,buttonStyles),isMobile:isMobile,tooltipText:tooltip,dataHook:pluginParams.dataHook,formattingButtonName:formattingButtonName,tabIndex:tabIndex,icon:pluginParams.icon,forwardRef:this.buttonRef,pluginType:pluginParams.type},isPanelOpen&&React__default.default.createElement("div",{className:styles.textColorPopup},React__default.default.createElement(wixRichContentEditorCommon.ClickOutside,{onClickOutside:function(){return _this2.closePanel()}},React__default.default.createElement(TextColorPanel,{t:t,isMobile:isMobile,theme:theme,closeModal:this.closePanel,editorState:getEditorState(),setEditorState:setEditorState,settings:settings,uiSettings:uiSettings,setKeepToolbarOpen:setKeepOpen,styleMapper:this.styleMapper,predicate:pluginParams.predicate,defaultColor:pluginParams.defaultColor,colorPickerHeaderKey:pluginParams.colorPickerHeaderKey})))))},_createClass__default.default(BaseTextColor,[{key:"isActive",get:function(){var _this$props4=this.props,config=_this$props4.config,pluginParams=_this$props4.pluginParams,getEditorState=_this$props4.getEditorState,settings=config[pluginParams.type]||{},styleSelectionPredicate=pluginParams.predicate(settings.styleSelectionPredicate||DEFAULT_STYLE_SELECTION_PREDICATE);return wixRichContentEditorCommon.getSelectionStyles(getEditorState(),styleSelectionPredicate).length>0}}]),BaseTextColor}(React.Component);BaseTextColor.defaultProps={setKeepOpen:function(){}};var TextColorButton=function(_Component){function TextColorButton(props){var _this;return(_this=_Component.call(this,props)||this).buttonRef=React__default.default.createRef(),_this}return _inheritsLoose__default.default(TextColorButton,_Component),TextColorButton.prototype.render=function(){var _settings$toolbar,_settings$toolbar$ico,settings=this.props.config[TEXT_COLOR_TYPE],pluginParams={dataHook:"TextColorButton",toolTip:"TextColorButton_Tooltip",icon:(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.InsertPluginButtonIcon)||TextColorIcon,type:TEXT_COLOR_TYPE,predicate:textForegroundPredicate,defaultColor:"#000000",colorPickerHeaderKey:"Color_Picker_TextColorButton_Header"};return React__default.default.createElement(BaseTextColor,_extends__default.default({buttonRef:this.buttonRef,pluginParams:pluginParams},this.props))},TextColorButton}(React.Component);TextColorButton.defaultProps={setKeepOpen:function(){}};var TextHighlightButton=function(_Component){function TextHighlightButton(props){var _this;return(_this=_Component.call(this,props)||this).buttonRef=React__default.default.createRef(),_this}return _inheritsLoose__default.default(TextHighlightButton,_Component),TextHighlightButton.prototype.render=function(){var _settings$toolbar,_settings$toolbar$ico,settings=this.props.config[TEXT_HIGHLIGHT_TYPE],pluginParams={dataHook:"TextHighlightButton",toolTip:"TextHighlightButton_Tooltip",icon:(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.InsertPluginButtonIcon)||TextHighlightIcon,type:TEXT_HIGHLIGHT_TYPE,predicate:textBackgroundPredicate,defaultColor:"#ffffff",colorPickerHeaderKey:"Color_Picker_TextHighlightButton_Header"};return React__default.default.createElement(BaseTextColor,_extends__default.default({buttonRef:this.buttonRef,pluginParams:pluginParams},this.props))},TextHighlightButton}(React.Component);TextHighlightButton.defaultProps={setKeepOpen:function(){}};function _toPropertyKey$1(arg){var key=function(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"==typeof key?key:String(key)}var createTextColorPlugin=function(config){var type=TEXT_COLOR_TYPE,theme=config.theme,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,rest=_objectWithoutPropertiesLoose__default.default(config,["theme",type].map(_toPropertyKey$1)),toolbar=function(config){return{TextButtonMapper:function(){var _ref;return(_ref={})[wixRichContentEditorCommon.FORMATTING_BUTTONS.TEXT_COLOR]={component:TextColorButton,externalizedButtonProps:getButtonProps({config:config,type:TEXT_COLOR_TYPE})},_ref},name:"text-color"}}(config);return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({theme:theme,toolbar:toolbar,type:type,settings:settings,defaultPluginData:DEFAULTS.configTextColor.editor},rest))};function _toPropertyKey(arg){var key=function(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"==typeof key?key:String(key)}createTextColorPlugin.functionName=TEXT_COLOR_TYPE;var _ModalsMap,createTextHighlightPlugin=function(config){var type=TEXT_HIGHLIGHT_TYPE,theme=config.theme,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,rest=_objectWithoutPropertiesLoose__default.default(config,["theme",type].map(_toPropertyKey)),toolbar=function(config){return{TextButtonMapper:function(){var _ref2;return(_ref2={})[wixRichContentEditorCommon.FORMATTING_BUTTONS.TEXT_HIGHLIGHT]={component:TextHighlightButton,externalizedButtonProps:getButtonProps({config:config,type:TEXT_HIGHLIGHT_TYPE})},_ref2},name:"text-highlight"}}(config);return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({theme:theme,toolbar:toolbar,type:type,settings:settings,defaultPluginData:DEFAULTS.configTextHighlight.editor},rest))};createTextHighlightPlugin.functionName=TEXT_HIGHLIGHT_TYPE;var Modals={TEXT_COLOR_PICKER:"TEXT_COLOR_PICKER"},ModalsMap=((_ModalsMap={})[Modals.TEXT_COLOR_PICKER]=TextColorPanel,_ModalsMap),textColorInlineStyleMapper=wixRichContentCommon.getDynamicInlineStyleMapper(wixRichContentCommon.RICOS_TEXT_COLOR_TYPE),textHighlightInlineStyleMapper=wixRichContentCommon.getDynamicInlineStyleMapper(wixRichContentCommon.RICOS_TEXT_HIGHLIGHT_TYPE);exports.Modals=Modals,exports.ModalsMap=ModalsMap,exports.TEXT_COLOR_TYPE=TEXT_COLOR_TYPE,exports.TEXT_HIGHLIGHT_TYPE=TEXT_HIGHLIGHT_TYPE,exports.createTextColorPlugin=createTextColorPlugin,exports.createTextHighlightPlugin=createTextHighlightPlugin,exports.getColor=getColor,exports.isTextColor=function(style){return!isTextDecoration(style,"BG")},exports.isTextHighlight=function(style){return isTextDecoration(style,"BG")},exports.pluginTextColor=function(config){return{config:_extends__default.default({},DEFAULTS.configTextColor.editor,config),type:TEXT_COLOR_TYPE,createPlugin:createTextColorPlugin,ModalsMap:ModalsMap}},exports.pluginTextHighlight=function(config){return{config:_extends__default.default({},DEFAULTS.configTextHighlight.editor,config),type:TEXT_HIGHLIGHT_TYPE,createPlugin:createTextHighlightPlugin,ModalsMap:{}}},exports.textColorInlineStyleMapper=textColorInlineStyleMapper,exports.textHighlightInlineStyleMapper=textHighlightInlineStyleMapper;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),wixRichContentPluginCommons=require("wix-rich-content-plugin-commons"),wixRichContentEditorCommon=require("wix-rich-content-editor-common"),React=require("react"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),wixRichContentUiComponents=require("wix-rich-content-ui-components"),wixRichContentCommon=require("wix-rich-content-common"),ReactPlayer=require("react-player"),classNames=require("classnames"),ReactDOM=require("react-dom"),lodash=require("lodash"),_assertThisInitialized=require("@babel/runtime/helpers/assertThisInitialized"),pluginVideoSchema=require("wix-rich-content-common/dist/statics/schemas/plugin-video.schema.json"),toDraftData=require("ricos-content/libs/toDraftData"),ricosContent=require("ricos-content");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _ModalsMap,_extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),React__default=_interopDefaultLegacy(React),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),ReactPlayer__default=_interopDefaultLegacy(ReactPlayer),classNames__default=_interopDefaultLegacy(classNames),ReactDOM__default=_interopDefaultLegacy(ReactDOM),_assertThisInitialized__default=_interopDefaultLegacy(_assertThisInitialized),pluginVideoSchema__default=_interopDefaultLegacy(pluginVideoSchema),InsertPluginIcon$1=function(props){return React__default.default.createElement("svg",Object.assign({xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 19 19",width:"19",height:"19"},props),React__default.default.createElement("defs",null,React__default.default.createElement("path",{id:"video-icon-path",d:"M14 7l2.842-1.421A.8.8 0 0 1 18 6.294v6.412a.8.8 0 0 1-1.158.715L14 12v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h11a1 1 0 0 1 1 1v2zm0 3.9l2.708 1.354a.2.2 0 0 0 .29-.179V6.922a.2.2 0 0 0-.29-.178L14 8.098V10.9zM2 5v9h11V5H2z"})),React__default.default.createElement("g",{fillRule:"evenodd"},React__default.default.createElement("mask",{id:"video-icon-mask"},React__default.default.createElement("use",{xlinkHref:"#video-icon-path"})),React__default.default.createElement("use",{fillRule:"nonzero",xlinkHref:"#video-icon-path"})))},InsertPluginIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"19",height:"19",viewBox:"0 0 19 19"},props),React__default.default.createElement("path",{d:"M5.2,9 L5.8,9 C5.9104569,9 6,9.05969537 6,9.13333333 L6,14.8666667 C6,14.9403046 5.9104569,15 5.8,15 L5.2,15 C5.0895431,15 5,14.9403046 5,14.8666667 L5,9.13333333 C5,9.05969537 5.0895431,9 5.2,9 Z M3.2,8 L3.8,8 C3.9104569,8 4,8.06268014 4,8.14 L4,14.86 C4,14.9373198 3.9104569,15 3.8,15 L3.2,15 C3.0895431,15 3,14.9373198 3,14.86 L3,8.14 C3,8.06268014 3.0895431,8 3.2,8 Z M1.2,10 L1.8,10 C1.91045695,10 2,10.0447715 2,10.1 L2,13.9 C2,13.9552284 1.91045695,14 1.8,14 L1.2,14 C1.08954305,14 1,13.9552284 1,13.9 L1,10.1 C1,10.0447715 1.08954305,10 1.2,10 Z M18,11.6153846 C18,13.4846561 16.4846561,15 14.6153846,15 L7.84615385,15 C7.37883602,15 7,14.621164 7,14.1538462 L7,4.84615385 C8.1282051,4.28205128 9.39743587,4 10.8076923,4 C12.9089391,4 15.0384615,6.12783884 15.0384615,8.23076923 C16.7079981,8.4650878 18,9.8893546 18,11.6153846 Z M8,14 L14.5454545,14 C15.9010625,14 17,12.9010625 17,11.5454545 C17,10.3050264 16.0718944,9.25574738 14.8408286,9.08296796 L14.1363636,8.98409667 L14.1363636,8.27272727 C14.1363636,6.69177453 12.4441412,5 10.8636364,5 C9.81175629,5 8.85922746,5.17619715 8,5.52684396 L8,14 Z"}))},MediaReplaceIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlnsXlink:"http://www.w3.org/1999/xlink",width:19,height:19,viewBox:"0 0 19 19"},props),React__default.default.createElement("defs",null,React__default.default.createElement("path",{id:"replace-path",d:"M3 7.8V3.2c0-.11.09-.2.2-.2h.6c.11 0 .2.09.2.2v2.592A6.607 6.607 0 0 1 9.412 3C13.05 3 16 5.91 16 9.5c0 .168-.006.335-.02.5h-1.016a5.51 5.51 0 0 0 .022-.5c0-3.038-2.495-5.5-5.574-5.5a5.583 5.583 0 0 0-4.967 3H7.8c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H3.2a.2.2 0 0 1-.2-.2zm13 3.4v4.6a.2.2 0 0 1-.2.2h-.6a.2.2 0 0 1-.2-.2v-2.592A6.607 6.607 0 0 1 9.588 16C5.95 16 3 13.09 3 9.5c0-.168.006-.335.02-.5h1.016a5.496 5.496 0 0 0-.022.5c0 3.038 2.495 5.5 5.574 5.5a5.583 5.583 0 0 0 4.967-3H11.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2h4.6c.11 0 .2.09.2.2z"})),React__default.default.createElement("g",{fillRule:"evenodd"},React__default.default.createElement("mask",{id:"replace-mask"},React__default.default.createElement("use",{xlinkHref:"#replace-path"})),React__default.default.createElement("use",{fillRule:"nonzero",xlinkHref:"#replace-path"})))},YoutubeIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"19",height:"19",viewBox:"0 0 19 19"},props),React__default.default.createElement("path",{fillRule:"evenodd",d:"M9.783 3.126c1.117.006 5.217.049 6.359.357.731.196 1.307.776 1.503 1.512C18 6.33 18 9.114 18 9.114s0 2.784-.355 4.118c-.196.736-.772 1.316-1.503 1.513-1.215.327-5.784.355-6.537.357h-.21c-.753-.002-5.322-.03-6.537-.357-.731-.197-1.307-.777-1.503-1.513-.317-1.191-.35-3.538-.355-4.028v-.181c.004-.49.038-2.836.355-4.028.196-.736.772-1.316 1.503-1.512C4 3.175 8.1 3.132 9.218 3.126zM7.76 6.586v5.055l4.444-2.527L7.76 6.586z"}))},styles$3={video_modal_container_big:"_4hyfK",video_modal_container_small:"Wdxcn",video_modal_closeIcon:"_1P3Vk",video_modal_errorIcon:"_4U647",video_modal_header:"_2wuD-",video_modal_header_text:"_35sJQ",video_modal_textInput_customWidth:"_167aE",video_modal_textInput_fullWidth:"cn4jv",video_modal_add_a_Video:"_30xCH",video_modal_or_upload_video_from:"_3Q6uE",video_modal_upload_video:"_20AZa",video_modal_input_button_wrapper:"EmpUt",video_modal_add_button_wrapper:"P3PzB",video_modal_add_button_inline:"_2Z_Pe",video_modal_add_button_inMiddle:"_3TrUw",textInput_input:"_1cb7K",textInput_input_invalid:"_1P6p9",fileInput:"_1qYoT",fileInputLabel:"_30dNJ"},VIDEO_TYPE="wix-draft-plugin-video",videoButtonsTypes={video:"video",soundCloud:"soundCloud",youTube:"youTube"},mediaTypes=[videoButtonsTypes.soundCloud,videoButtonsTypes.youTube],VideoSelectionInputModal=function(_Component){function VideoSelectionInputModal(props){var _this;(_this=_Component.call(this,props)||this).onUrlChange=function(url){return _this.setState({url:url,showError:!1})},_this.onUrlVideoSelection=function(){var _helpers$onVideoSelec,_this$props=_this.props,componentData=_this$props.componentData,helpers=_this$props.helpers,_this$state$url=_this.state.url,src=(void 0===_this$state$url?"":_this$state$url).trim();if(wixRichContentCommon.isValidExactUrl(src)&&ReactPlayer__default.default.canPlay(src)){delete componentData.isCustomVideo;var data=_extends__default.default({},componentData,{tempData:!1,src:src});_this.onConfirm(data),null==helpers||null===(_helpers$onVideoSelec=helpers.onVideoSelected)||void 0===_helpers$onVideoSelec||_helpers$onVideoSelec.call(helpers,src,(function(metadata){return setTimeout((function(){return _this.updateComponentData(_extends__default.default({},data,{metadata:metadata}))}))}),0),_this.closeModal()}else _this.setState({showError:!0})},_this.onUrlInputDoubleClick=function(){_this.setState({url:"https://www.youtube.com/watch?v=vzKryaN44ss"})},_this.closeModal=function(){_this.setState({isOpen:!1}),_this.props.helpers.closeModal()},_this.handleKeyPress=function(e){e.charCode===wixRichContentEditorCommon.KEYS_CHARCODE.ENTER&&_this.onUrlVideoSelection()},_this.getOnUploadFinished=function(isCustomVideo){return function(_ref){var data=_ref.data,error=_ref.error;_this.setComponentData(_extends__default.default({},data,{error:error,isCustomVideo:isCustomVideo}))}},_this.addVideoComponent=function(_ref2,isCustomVideo){var data=_ref2.data,error=_ref2.error;void 0===isCustomVideo&&(isCustomVideo=!1),wixRichContentPluginCommons.handleUploadFinished(VIDEO_TYPE,_this.getComponentData,data,error,(function(_ref3){var data=_ref3.data,error=_ref3.error;return _this.onConfirm(_extends__default.default({},data,{error:error,isCustomVideo:isCustomVideo}))}))},_this.setComponentData=function(data){_this.props.pubsub.set("componentData",data,_this.blockKey)},_this.updateComponentData=function(data){_this.props.pubsub.update("componentData",data,_this.blockKey)},_this.onLocalLoad=function(_ref4){var src=_ref4.src,tempData=_ref4.tempData;_this.onConfirm(_extends__default.default({},_this.props.componentData,{src:src,isCustomVideo:!0,tempData:tempData}))},_this.getComponentData=function(){return _this.props.componentData},_this.handleNativeFileUpload=function(){wixRichContentPluginCommons.handleUploadStart(_this.props,_this.getComponentData,_this.inputFile.files[0],_this.onLocalLoad,_this.getOnUploadFinished(!0)),_this.closeModal()},_this.styles=wixRichContentCommon.mergeStyles({styles:styles$3,theme:props.theme});var _componentData=_this.props.componentData;_this.state={url:!_componentData.isCustomVideo&&_componentData.src||""},_this.id="VideoUploadModal_FileInput_"+Math.floor(9999*Math.random());var onConfirm=props.onConfirm,onReplace=props.onReplace;return _this.blockKey=_this.getFocusedBlockKey(),_this.onConfirm=function(obj){if(onConfirm){var newBlock=onConfirm(obj).newBlock;_this.blockKey=newBlock.key}else onReplace(obj,_this.blockKey)},_this}_inheritsLoose__default.default(VideoSelectionInputModal,_Component);var _proto=VideoSelectionInputModal.prototype;return _proto.getFocusedBlockKey=function(){return this.props.pubsub.get("focusedBlock")},_proto.componentDidMount=function(){this.input.focus(),this.input.setSelectionRange(0,this.input.value.length)},_proto.render=function(){var _this2=this,_this$state=this.state,url=_this$state.url,showError=_this$state.showError,_this$props2=this.props,t=_this$props2.t,handleFileSelection=_this$props2.handleFileSelection,handleFileUpload=_this$props2.handleFileUpload,enableCustomUploadOnMobile=_this$props2.enableCustomUploadOnMobile,isMobile=_this$props2.isMobile,languageDir=_this$props2.languageDir;_this$props2.componentData;var handleClick,theme=_this$props2.theme,styles=this.styles,hasCustomFileUpload=handleFileUpload||handleFileSelection;handleFileSelection&&(handleClick=function(evt){return evt.preventDefault(),handleFileSelection((function(_ref5){var data=_ref5.data,error=_ref5.error;_this2.addVideoComponent({data:data,error:error},!0),_this2.closeModal()}))});var uploadVideoSection=React__default.default.createElement("div",null,React__default.default.createElement("div",{className:styles.video_modal_or_upload_video_from},t("VideoUploadModal_CustomVideoHeader")),React__default.default.createElement("div",{className:styles.video_modal_upload_video},React__default.default.createElement("input",{id:this.id,type:"file",accept:"video/*",className:styles.fileInput,ref:function(node){return _this2.inputFile=node},onClick:handleClick,onChange:this.handleNativeFileUpload}),React__default.default.createElement("label",{htmlFor:this.id,className:styles.fileInputLabel,role:"button","data-hook":"videoUploadModalCustomVideo",tabIndex:0},"+ ",t("VideoUploadModal_CustomVideoClickText"))));return React__default.default.createElement("div",{dir:languageDir},React__default.default.createElement("div",{className:styles["video_modal_container_"+(hasCustomFileUpload?"big":"small")],"data-hook":"videoUploadModal"},React__default.default.createElement(wixRichContentUiComponents.CloseIcon,{className:styles.video_modal_closeIcon,onClick:function(){return _this2.closeModal()}}),React__default.default.createElement("h2",{className:styles.video_modal_add_a_Video},t("VideoUploadModal_Title")),React__default.default.createElement("div",{role:"heading","aria-level":3,"aria-labelledby":"video_modal_hdr",className:styles.video_modal_header},React__default.default.createElement("h3",{id:"video_modal_hdr",className:styles.video_modal_header_text},t("VideoUploadModal_Header"))),React__default.default.createElement("div",{className:styles.video_modal_input_button_wrapper},React__default.default.createElement("div",{className:styles["video_modal_textInput_"+(hasCustomFileUpload?"customWidth":"fullWidth")]},React__default.default.createElement(wixRichContentUiComponents.TextInput,{inputRef:function(ref){_this2.input=ref},type:"url",onKeyPress:this.handleKeyPress,onChange:this.onUrlChange,onDoubleClick:this.onUrlInputDoubleClick,value:url,error:showError?t("VideoUploadModal_Input_InvalidUrl"):null,placeholder:t("VideoUploadModal_Input_Placeholder"),theme:styles,"data-hook":"videoUploadModalInput"})),React__default.default.createElement("div",{className:styles.video_modal_add_button_wrapper},React__default.default.createElement(wixRichContentUiComponents.Button,{disabled:!this.state.url,theme:_extends__default.default({},styles,theme),dataHook:"videoUploadModalAddButton",onClick:this.onUrlVideoSelection,text:t("VideoUploadModal_AddButtonText"),size:isMobile?wixRichContentUiComponents.BUTTON_SIZE.medium:wixRichContentUiComponents.BUTTON_SIZE.small}))),(!isMobile||enableCustomUploadOnMobile)&&hasCustomFileUpload&&uploadVideoSection))},VideoSelectionInputModal}(React.Component),Styles={separator:"_3hKgB",videoSettingsTitle:"_31P16",videoSettings_toggleContainer:"_3RIrx",videoSettings_mobile:"_13GtL"},Modals={VIDEO_SELECTION_INPUT:"video-selection-input",VIDEO_SETTINGS:"video-settings"},ModalsMap=((_ModalsMap={})[Modals.VIDEO_SELECTION_INPUT]=VideoSelectionInputModal,_ModalsMap[Modals.VIDEO_SETTINGS]=function(_ref){var _componentData$config,_componentData$config2,_classNames,componentData=_ref.componentData,helpers=_ref.helpers,pubsub=_ref.pubsub,theme=_ref.theme,t=_ref.t,isMobile=_ref.isMobile,settings=_ref.settings,disableDownload=void 0!==componentData.disableDownload?componentData.disableDownload:!!settings.disableDownload,isSpoilered=null===(_componentData$config=componentData.config)||void 0===_componentData$config||null===(_componentData$config2=_componentData$config.spoiler)||void 0===_componentData$config2?void 0:_componentData$config2.enabled,_useState=React.useState(!disableDownload),isDownloadEnabled=_useState[0],setIsDownloadEnabled=_useState[1],_useState2=React.useState(isSpoilered),isSpoilerEnabled=_useState2[0],setIsSpoilerEnabled=_useState2[1],styles=wixRichContentCommon.mergeStyles({styles:Styles,theme:theme}),closeModal=function(){var _helpers$closeModal;return null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal?void 0:_helpers$closeModal.call(helpers)},getSpoilerConfig=function(enabled){return{config:_extends__default.default({},componentData.config,{spoiler:{enabled:enabled}})}},onDoneClick=function(){var newComponentData=_extends__default.default({},componentData,{disableDownload:!isDownloadEnabled},getSpoilerConfig(isSpoilerEnabled));pubsub.update("componentData",newComponentData),closeModal()},isCustomVideo=!!componentData.isCustomVideo,spoilerToggle={toggleKey:"isSpoilerEnabled",labelKey:"VideoSettings_Spoiler_Toggle",dataHook:"videoSpoilerToggle",tooltipText:"Spoiler_Toggle_Tooltip",checked:isSpoilerEnabled,onToggle:function(){var value=!isSpoilerEnabled;setIsSpoilerEnabled(value),pubsub.update("componentData",_extends__default.default({},componentData,getSpoilerConfig(value)))}},toggleData=isCustomVideo?[{toggleKey:"isDownloadEnabled",labelKey:"VideoPlugin_Settings_VideoCanBeDownloaded_Label",dataHook:"videoDownloadToggle",tooltipText:"VideoPlugin_Settings_VideoCanBeDownloaded_Tooltip",checked:isDownloadEnabled,onToggle:function(){return setIsDownloadEnabled(!isDownloadEnabled)}}]:[];return settings.spoiler&&toggleData.push(spoilerToggle),React__default.default.createElement("div",{"data-hook":"settings",className:classNames__default.default(styles.videoSettings,(_classNames={},_classNames[styles.videoSettings_mobile]=isMobile,_classNames))},isMobile?React__default.default.createElement(wixRichContentUiComponents.SettingsMobileHeader,{t:t,theme:theme,onCancel:closeModal,onSave:onDoneClick}):React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement("div",{className:styles.videoSettingsTitle},t("VideoPlugin_Settings_Header")),React__default.default.createElement("div",{className:styles.separator})),React__default.default.createElement(wixRichContentUiComponents.SettingsSection,{theme:theme,className:classNames__default.default(styles.videoSettings_toggleContainer)},toggleData.map((function(_ref2){var toggleKey=_ref2.toggleKey,labelKey=_ref2.labelKey,tooltipText=_ref2.tooltipText,dataHook=_ref2.dataHook,onToggle=_ref2.onToggle,checked=_ref2.checked;return React__default.default.createElement(wixRichContentUiComponents.LabeledToggle,{key:toggleKey,theme:theme,checked:checked,label:t(labelKey),onChange:onToggle,tooltipText:t(tooltipText),dataHook:dataHook})}))),!isMobile&&React__default.default.createElement(wixRichContentUiComponents.SettingsPanelFooter,{fixed:!0,theme:theme,cancel:closeModal,save:onDoneClick,t:t}))},_ModalsMap),MediaURLInputModal$1=function(_Component){function MediaURLInputModal(props){var _this;(_this=_Component.call(this,props)||this).onConfirm=function(){var url=_this.state.url;if(url&&ReactPlayer__default.default.canPlay(url)){var _helpers$closeModal,_this$props=_this.props,_componentData=_this$props.componentData,helpers=_this$props.helpers,pubsub=_this$props.pubsub,onConfirm=_this$props.onConfirm;onConfirm?onConfirm(_extends__default.default({},_componentData,{src:url})):pubsub.update("componentData",{src:url}),helpers&&helpers.onVideoSelected&&helpers.onVideoSelected(url,(function(data){return pubsub.update("componentData",{metadata:_extends__default.default({},data)})})),null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal||_helpers$closeModal.call(helpers)}else _this.setState({submittedInvalidUrl:!0})},_this.getRenderData=function(){var _this$props2=_this.props,t=_this$props2.t,isMobile=_this$props2.isMobile,type=_this$props2.componentData.type,isYouTube=type===videoButtonsTypes.youTube,isSoundCloud=type===videoButtonsTypes.soundCloud;return{title:isYouTube?"EmbedURL_Social_YouTube_Title":isSoundCloud&&(isMobile?"SoundCloudUploadModal_Header_Mobile":"SoundCloudUploadModal_Header"),placeholder:isYouTube?t("EmbedURL_Social_YouTube_Placeholder"):isSoundCloud&&t("SoundCloudUploadModal_Input_Placeholder"),dataHook:isYouTube?"socialEmbedUploadModal":isSoundCloud?"soundCloudUploadModal":""}};var componentData=_this.props.componentData;return _this.state={url:componentData.src||"",submittedInvalidUrl:!1},_this}return _inheritsLoose__default.default(MediaURLInputModal,_Component),MediaURLInputModal.prototype.render=function(){var _this2=this,_this$state=this.state,url=_this$state.url,submittedInvalidUrl=_this$state.submittedInvalidUrl,_this$props3=this.props,t=_this$props3.t,languageDir=_this$props3.languageDir,helpers=_this$props3.helpers,_this$getRenderData=this.getRenderData(),title=_this$getRenderData.title,placeholder=_this$getRenderData.placeholder,dataHook=_this$getRenderData.dataHook;return React__default.default.createElement(wixRichContentUiComponents.UrlInputModal,{onConfirm:this.onConfirm,input:url,t:t,languageDir:languageDir,title:t(""+title),submittedInvalidUrl:submittedInvalidUrl,dataHook:dataHook,onInputChange:function(url){return _this2.setState({url:url})},errorMessage:t("SoundCloudUploadModal_Input_InvalidUrl"),placeholder:placeholder,onCloseRequested:helpers.closeModal,buttonSize:wixRichContentUiComponents.BUTTON_SIZE.medium})},MediaURLInputModal}(React.Component),VideoUploadModal=function(_Component){function VideoUploadModal(props){var _this;(_this=_Component.call(this,props)||this).closeModal=function(){_this.setState({isOpen:!1}),_this.props.helpers.closeModal()},_this.getOnUploadFinished=function(isCustomVideo){return function(_ref){var data=_ref.data,error=_ref.error;_this.setComponentData(_extends__default.default({},data,{error:error,isCustomVideo:isCustomVideo}))}},_this.addVideoComponent=function(_ref2,isCustomVideo){var data=_ref2.data,error=_ref2.error;void 0===isCustomVideo&&(isCustomVideo=!1),wixRichContentPluginCommons.handleUploadFinished(VIDEO_TYPE,_this.getComponentData,data,error,(function(_ref3){var data=_ref3.data,error=_ref3.error;return _this.onConfirm(_extends__default.default({},data,{error:error,isCustomVideo:isCustomVideo}))}))},_this.setComponentData=function(data){_this.props.pubsub.set("componentData",data,_this.blockKey)},_this.onLocalLoad=function(_ref4){var src=_ref4.src,tempData=_ref4.tempData;_this.onConfirm(_extends__default.default({},_this.props.componentData,{src:src,isCustomVideo:!0,tempData:tempData}))},_this.setInputFile=function(ref){return _this.inputFile=ref},_this.getComponentData=function(){return _this.props.componentData},_this.handleNativeFileUpload=function(){wixRichContentPluginCommons.handleUploadStart(_this.props,_this.getComponentData,_this.inputFile.files[0],_this.onLocalLoad,_this.getOnUploadFinished(!0)),_this.closeModal()};var componentData=_this.props.componentData;_this.state={url:!componentData.isCustomVideo&&componentData.src||""},_this.id="VideoUploadModal_FileInput_"+Math.floor(9999*Math.random());var onConfirm=props.onConfirm,onReplace=props.onReplace;return _this.onConfirm=function(obj){if(onConfirm){var newBlock=onConfirm(obj).newBlock;_this.blockKey=newBlock.key}else onReplace(obj,_this.blockKey)},_this}return _inheritsLoose__default.default(VideoUploadModal,_Component),VideoUploadModal.prototype.render=function(){var handleClick,_this2=this,_this$props=this.props,t=_this$props.t,handleFileSelection=_this$props.handleFileSelection,handleFileUpload=_this$props.handleFileUpload,enableCustomUploadOnMobile=_this$props.enableCustomUploadOnMobile,isMobile=_this$props.isMobile,languageDir=_this$props.languageDir,showUploadSection=(!isMobile||enableCustomUploadOnMobile)&&(handleFileUpload||handleFileSelection);return handleFileSelection&&(handleClick=function(evt){return evt.preventDefault(),handleFileSelection((function(_ref5){var data=_ref5.data,error=_ref5.error;_this2.addVideoComponent({data:data,error:error},!0),_this2.closeModal()}))}),React__default.default.createElement(wixRichContentUiComponents.MediaUploadModal,{id:this.id,isMobile:isMobile,inputFileRef:this.setInputFile,handleClick:handleClick,handleNativeFileUpload:this.handleNativeFileUpload,languageDir:languageDir,title:t("VideoCustomUploadModal_Title"),labelText:t("VideoUploadModal_CustomVideoClickText"),dataHook:"videoUploadModalCustomVideo",showUploadSection:showUploadSection,accept:"video/*"})},VideoUploadModal}(React.Component),MediaURLInputModal=function(_ref){var t=_ref.t,languageDir=_ref.languageDir,helpers=_ref.helpers,isMobile=_ref.isMobile,url=_ref.url,submittedInvalidUrl=_ref.submittedInvalidUrl,setUrl=_ref.setUrl,_ref$withMobileHeader=_ref.withMobileHeader,withMobileHeader=void 0!==_ref$withMobileHeader&&_ref$withMobileHeader,onConfirm=_ref.onConfirm,dataHook=_ref.dataHook,title=_ref.title,subTitle=_ref.subTitle,saveLabel=_ref.saveLabel,onDblClick=_ref.onDblClick;return React__default.default.createElement(wixRichContentUiComponents.NewUrlInputModal,{onConfirm:onConfirm,helpers:helpers,input:url,t:t,languageDir:languageDir,title:title,subTitle:subTitle,submittedInvalidUrl:submittedInvalidUrl,dataHook:dataHook,saveLabel:saveLabel,onInputChange:function(url){return setUrl(url)},errorMessage:t("SoundCloudUploadModal_Input_InvalidUrl"),placeholder:t("EmbedURL_Placeholder"),onCloseRequested:helpers.closeModal,buttonSize:wixRichContentUiComponents.BUTTON_SIZE.medium,isMobile:isMobile,withMobileHeader:withMobileHeader,onDblClick:onDblClick})},styles$2={video_modal_container:"_3jdGM",video_modal_content:"GIPKX",video_modal_tab:"_3Dnt_",video_upload_tab:"_1wXO_",fileInput:"_1W3aw",video_modal_add_button_inline:"_33b75",fileInputLabel:"_6ZyY2"},VideoModal$1=function(props){var _props$componentData=props.componentData,isCustomVideo=_props$componentData.isCustomVideo,src=_props$componentData.src,type=_props$componentData.type,closeModal=props.helpers.closeModal,t=props.t,theme=props.theme,isMobile=props.isMobile,videoTabs={embed:t("VideoModal_Tabs_Embed"),upload:t("VideoModal_Tabs_Upload")},initialUrl=isCustomVideo?"":src||"",_useState=React.useState(isCustomVideo?videoTabs.upload:videoTabs.embed),activeTab=_useState[0],setActiveTab=_useState[1],_useState2=React.useState(initialUrl),url=_useState2[0],setUrl=_useState2[1],_useState3=React.useState(!1),submittedInvalidUrl=_useState3[0],setSubmittedInvalidUrl=_useState3[1],isSoundCloud=type===videoButtonsTypes.soundCloud,onUrlInputDoubleClick=function(){return setUrl("https://www.youtube.com/watch?v=vzKryaN44ss")},onConfirm=function(){if(url&&ReactPlayer__default.default.canPlay(url)){var componentData=props.componentData,helpers=props.helpers,pubsub=props.pubsub,_onConfirm=props.onConfirm;_onConfirm?_onConfirm(_extends__default.default({},componentData,{src:url,isCustomVideo:!1})):pubsub.update("componentData",{src:url,isCustomVideo:!1}),helpers&&helpers.onVideoSelected&&helpers.onVideoSelected(url,(function(data){return pubsub.update("componentData",{metadata:_extends__default.default({},data)})})),null==closeModal||closeModal()}else setSubmittedInvalidUrl(!0)},dataHook=isSoundCloud?"soundCloudUploadModal":"videoMediaUrlModal",title=isSoundCloud?t(isMobile?"SoundCloudUploadModal_Header_Mobile":"SoundCloudUploadModal_Header"):null,renderMediaUrlInputModal=function(){return React__default.default.createElement(MediaURLInputModal,Object.assign({},props,{onConfirm:onConfirm,url:url,setUrl:setUrl,submittedInvalidUrl:submittedInvalidUrl,withMobileHeader:isSoundCloud,dataHook:dataHook,title:isSoundCloud&&title,saveLabel:t(isSoundCloud?"Embed_Add_Button_Label":"VideoModal_Embed_ButtonText"),subTitle:!isSoundCloud&&t("VideoModal_Embed_Title"),onDblClick:onUrlInputDoubleClick}))};return isSoundCloud?renderMediaUrlInputModal():React__default.default.createElement("div",{className:styles$2.video_modal_container},React__default.default.createElement("div",{className:styles$2.video_modal_content},isMobile&&React__default.default.createElement(wixRichContentUiComponents.SettingsMobileHeader,{theme:theme,onSave:onConfirm,onCancel:function(){return closeModal()},t:t,title:t("VideoModal_MobileHeader")}),React__default.default.createElement(wixRichContentUiComponents.Tabs,{value:activeTab,onTabSelected:function(tab){return setActiveTab(tab)},className:styles$2.video_modal_tabs_header,theme:theme},React__default.default.createElement(wixRichContentUiComponents.Tab,{label:videoTabs.embed,value:videoTabs.embed,theme:theme},React__default.default.createElement("div",{className:styles$2.video_modal_tab},renderMediaUrlInputModal())),React__default.default.createElement(wixRichContentUiComponents.Tab,{label:videoTabs.upload,value:videoTabs.upload,theme:theme},React__default.default.createElement("div",{className:classNames__default.default(styles$2.video_modal_tab,styles$2.video_upload_tab)},React__default.default.createElement(VideoUploadModal,Object.assign({},props)))))))},VideoModal=function(props){var _experiments$newVideo,type=props.componentData.type,experiments=props.experiments,useNewModal=null==experiments||null===(_experiments$newVideo=experiments.newVideoModal)||void 0===_experiments$newVideo?void 0:_experiments$newVideo.enabled,oldVideoModal=mediaTypes.includes(type)?MediaURLInputModal$1:VideoSelectionInputModal,Component=useNewModal?VideoModal$1:oldVideoModal;return React__default.default.createElement(Component,props)},SelectionModalCustomStyle={content:{maxWidth:"580px",minHeight:"260px"}},ExtendedSelectionModalCustomStyle={content:{maxWidth:"580px",minHeight:"378px"}},modalContentStyles={width:363,padding:20,boxSizing:"border-box",border:"solid 1px rgba(51, 51, 51, 0.1)",boxShadow:"0 0 10px 0 rgba(0, 0, 0, 0.06)"},videoModalContentStyles=_extends__default.default({height:232},modalContentStyles),embedModalContentStyles=_extends__default.default({height:180},modalContentStyles),createInlineButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,_ref$experiments=_ref.experiments,experiments=void 0===_ref$experiments?{}:_ref$experiments,spoilerInInlineToolbar=experiments.spoilerInInlineToolbar,newVideoModal=experiments.newVideoModal,useNewModal=null==newVideoModal?void 0:newVideoModal.enabled,icon=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.replace)||MediaReplaceIcon,defaultCustomStyles=isMobile&&!settings.enableCustomUploadOnMobile||!settings.handleFileSelection&&!settings.handleFileUpload?SelectionModalCustomStyle:ExtendedSelectionModalCustomStyle,newModalCustomStyles=isMobile?wixRichContentUiComponents.MOBILE_FULL_SCREEN_CUSTOM_STYLE:_extends__default.default({},wixRichContentUiComponents.DesktopFlyOutModalStyles,{content:videoModalContentStyles}),customStyles=useNewModal?newModalCustomStyles:defaultCustomStyles,spoilerButton=settings.spoiler&&null!=spoilerInInlineToolbar&&spoilerInInlineToolbar.enabled?[{keyName:"spoiler",type:wixRichContentPluginCommons.BUTTONS.SPOILER,mobile:!0}]:[],settingsButton=null!=spoilerInInlineToolbar&&spoilerInInlineToolbar.enabled?[]:[{keyName:"settings",type:wixRichContentPluginCommons.BUTTONS.VIDEO_SETTINGS,fullHeight:!0,icon:wixRichContentPluginCommons.PluginSettingsIcon,modalName:Modals.VIDEO_SETTINGS,modalStyles:wixRichContentEditorCommon.getModalStyles({isMobile:isMobile}),t:t,mobile:!0,tooltipTextKey:"SettingsButton_Tooltip",settings:settings,triggerSettingsBi:!0,pluginId:VIDEO_TYPE}];return[{keyName:"sizeSmallCenter",type:wixRichContentPluginCommons.BUTTONS.SIZE_SMALL_CENTER,mobile:!1},{keyName:"sizeContent",type:wixRichContentPluginCommons.BUTTONS.SIZE_CONTENT,mobile:!1},{keyName:"sizeFullWidth",type:wixRichContentPluginCommons.BUTTONS.SIZE_FULL_WIDTH,mobile:!1},{keyName:"separator1",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!1},{keyName:"sizeSmallLeft",type:wixRichContentPluginCommons.BUTTONS.SIZE_SMALL_LEFT,mobile:!1},{keyName:"sizeSimallRight",type:wixRichContentPluginCommons.BUTTONS.SIZE_SMALL_RIGHT,mobile:!1},{keyName:"separator2",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!1}].concat(spoilerButton,[{keyName:"replace",type:wixRichContentPluginCommons.BUTTONS.EXTERNAL_MODAL,icon:icon,modalElement:wixRichContentEditorCommon.decorateComponentWithProps(VideoModal,_extends__default.default({},settings)),modalStylesFn:function(_ref2){var buttonRef=_ref2.buttonRef,modalStyles=wixRichContentEditorCommon.getModalStyles({customStyles:customStyles,fullScreen:!0,isMobile:isMobile}),_buttonRef$getBoundin=buttonRef.getBoundingClientRect(),top=_buttonRef$getBoundin.top,modalLeft=_buttonRef$getBoundin.left-15,modalTop=top>250?top-250:top+38;return _extends__default.default({},modalStyles,{content:_extends__default.default({},modalStyles.content,{top:modalTop,left:modalLeft,margin:0,position:"absolute"})})},modalStyles:isMobile?wixRichContentEditorCommon.getModalStyles({customStyles:wixRichContentUiComponents.MOBILE_FULL_SCREEN_CUSTOM_STYLE,fullScreen:!0,isMobile:isMobile}):void 0,mobile:!0,tooltipTextKey:"ReplaceVideoButton_Tooltip",t:t}],settingsButton,[{keyName:"delete",type:wixRichContentPluginCommons.BUTTONS.DELETE,mobile:!0}])},ReactPlayerWrapper=function(_Component){function ReactPlayerWrapper(props){var _this;return(_this=_Component.call(this,props)||this).isVimeoAndRequireJS=function(){return!wixRichContentCommon.isSSR()&&(url=_this.props.url,MATCH_URL=/vimeo\.com\/.+/,!/vimeo\.com\/external\/[0-9]+\..+/.test(url)&&MATCH_URL.test(url))&&!window.Vimeo&&window.requirejs;var url,MATCH_URL},_this.state={vimeoLoaded:!1,isPlaying:!1},_this}_inheritsLoose__default.default(ReactPlayerWrapper,_Component);var _proto=ReactPlayerWrapper.prototype;return _proto.componentDidMount=function(){var _this2=this;this.isVimeoAndRequireJS()&&window.require(["https://player.vimeo.com/api/player.js"],(function(player){window.Vimeo={Player:player},_this2.setState({vimeoLoaded:!0})}))},_proto.render=function(){var _this3=this;if(!this.state.vimeoLoaded&&this.isVimeoAndRequireJS())return null;var _this$props=this.props,isPlayable=_this$props.isPlayable,styles=_this$props.styles,disabled=_this$props.disabled;return React__default.default.createElement(ReactPlayer__default.default,_extends__default.default({playing:this.state.isPlaying&&!disabled,onPlay:function(){return _this3.setState({isPlaying:!0})},onPause:function(){return _this3.setState({isPlaying:!1})},style:styles},this.props,{light:!isPlayable}))},ReactPlayerWrapper}(React.Component);ReactPlayerWrapper.defaultProps={isPlayable:!0};var getVideoSrc=function(src,settings){if(void 0===settings&&(settings={}),"object"==typeof src){if(settings&&settings.getVideoUrl)return settings.getVideoUrl(src);console.error("must set getVideoUrl in plugin config when using custom video source!",src)}return src},styles$1={video_player:"NjOn2",videoOverlay:"_3xYKn",video_container:"oUYOK"},VideoViewer=function(_Component){function VideoViewer(props){var _this;(_this=_Component.call(this,props)||this).setUrl=function(newUrl){var _this$props$onReload,_this$props,url=_this.normalizeUrl(newUrl);url!==_this.state.url&&(_this.setState({url:url}),null===(_this$props$onReload=(_this$props=_this.props).onReload)||void 0===_this$props$onReload||_this$props$onReload.call(_this$props))},_this.normalizeUrl=function(url){return 0===url.toLowerCase().indexOf("vimeo")?"https://"+url:url},_this.findFormalVideoRatio=function(ratio){var target,baseRatios=[1,5/4,4/3,1.5,1.6,16/9,1.85,2,2.35,2.39,3],videoRatios=[].concat(baseRatios,baseRatios.map((function(x){return 1/x}))),closest=(target=ratio,videoRatios.reduce((function(prev,curr){return Math.abs(curr-target)<Math.abs(prev-target)?curr:prev})));return Math.abs(closest-ratio)>.01?ratio:closest},_this.getVideoRatio=function(wrapper){var element=wrapper.querySelector("iframe, video");return _this.findFormalVideoRatio(element.clientHeight/element.clientWidth)},_this.onReactPlayerReady=function(){var _this$props$onReady,_this$props2,wrapper=ReactDOM__default.default.findDOMNode(_assertThisInitialized__default.default(_this)).parentNode,ratio=_this.getVideoRatio(wrapper);(wrapper.style["padding-bottom"]=100*ratio+"%",_this.props.isLoaded)||((null===(_this$props$onReady=(_this$props2=_this.props).onReady)||void 0===_this$props$onReady?void 0:_this$props$onReady.call(_this$props2))||_this.setState({isLoaded:!0}))},_this.handleContextMenu=function(e){return _this.props.componentData.disableDownload&&e.preventDefault()},_this.disableDownloadProps=function(){var _this$props3=_this.props,componentData=_this$props3.componentData,settings=_this$props3.settings,disableProps={config:{file:{attributes:{controlsList:"nodownload"}}}},disable={};return void 0!==componentData.disableDownload?disable=componentData.disableDownload?disableProps:{}:void 0!==settings.disableDownload&&(disable=settings.disableDownload?disableProps:{}),disable},wixRichContentCommon.validate(props.componentData,pluginVideoSchema__default.default),_this.state={url:void 0,isLoaded:!1};var _url=getVideoSrc(props.componentData.src,props.settings);return"string"==typeof _url?_this.state={url:_this.normalizeUrl(_url)}:_url&&"function"==typeof _url.then&&_url.then((function(url){return _this.setState({url:_this.normalizeUrl(url)})})),_this}_inheritsLoose__default.default(VideoViewer,_Component);var _proto=VideoViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){var _this2=this;if(!lodash.isEqual(nextProps.componentData,this.props.componentData)&&(wixRichContentCommon.validate(nextProps.componentData,pluginVideoSchema__default.default),nextProps.componentData.src!==this.props.componentData.src)){var url=getVideoSrc(nextProps.componentData.src,nextProps.settings);"string"==typeof url?this.setUrl(url):url&&"function"==typeof url.then&&url.then((function(url){return _this2.setUrl(url)}))}},_proto.componentDidMount=function(){this.setState({key:"mounted"})},_proto.render=function(){var _this$props4=this.props,theme=_this$props4.theme,width=_this$props4.width,height=_this$props4.height,disabled=_this$props4.disabled,setComponentUrl=_this$props4.setComponentUrl;this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles$1,theme:theme});var _this$state=this.state,url=_this$state.url,key=_this$state.key;null==setComponentUrl||setComponentUrl(url);var props=_extends__default.default({url:url,onReady:this.onReactPlayerReady,disabled:disabled,width:width,height:height,key:key},this.disableDownloadProps()),isLoaded=this.props.isLoaded||this.state.isLoaded;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ReactPlayerWrapper,_extends__default.default({className:classNames__default.default(this.styles.video_player),onContextMenu:this.handleContextMenu,"data-loaded":isLoaded,controls:!1!==this.props.isLoaded},props)))},VideoViewer}(React.Component);VideoViewer.defaultProps={width:"100%",height:"100%"};var styles={video_player:"_38XzK",videoOverlay:"_2L5av",video_container:"Q31CM",video_overlay:"_37MeN",error:"_3zYcu"},DEFAULTS$1=Object.freeze({config:{size:"content",alignment:"center"}}),VideoComponent=function(_React$Component){function VideoComponent(props){var _this;(_this=_React$Component.call(this,props)||this).setPlayer=function(player){_this.player=player},_this.handleReady=function(){_this.state.isLoaded||_this.props.componentData.tempData||_this.setState({isLoaded:!0})},_this.renderOverlay=function(styles){return React__default.default.createElement("div",{className:classNames__default.default(styles.video_overlay)})},_this.renderLoader=function(){var isCustomVideo=lodash.get(_this.props,"componentData.isCustomVideo");return React__default.default.createElement("div",{className:_this.styles.videoOverlay},React__default.default.createElement(wixRichContentUiComponents.Loader,{type:"medium",isVerySlowFakeLoader:isCustomVideo}))},_this.onReload=function(){_this.setState({isLoaded:!1})},_this.renderPlayer=function(){var _this$props=_this.props,theme=_this$props.theme,componentData=_this$props.componentData,disabled=_this$props.disabled,settings=_this$props.settings,setComponentUrl=_this$props.setComponentUrl;return React__default.default.createElement(VideoViewer,{ref:_this.setPlayer,componentData:componentData,settings:settings,onReady:_this.handleReady,disabled:disabled,theme:theme,setComponentUrl:setComponentUrl,onReload:_this.onReload,isLoaded:_this.state.isLoaded})},_this.onKeyDown=function(e,handler){"Enter"!==e.key&&" "!==e.key||handler()};var isPlayable=!props.blockProps;return _this.state={isLoaded:!1,isPlayable:isPlayable},_this}_inheritsLoose__default.default(VideoComponent,_React$Component);var _proto=VideoComponent.prototype;return _proto.componentDidMount=function(){this.handlePlayerFocus()},_proto.componentDidUpdate=function(){this.handlePlayerFocus()},_proto.handlePlayerFocus=function(){var element=ReactDOM.findDOMNode(this).querySelector("iframe, video");element&&(element.tabIndex=-1)},_proto.render=function(){var _this2=this;this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles,theme:this.props.theme});var _this$props2=this.props,className=_this$props2.className,onClick=_this$props2.onClick,t=_this$props2.t,error=_this$props2.componentData.error,_this$state=this.state,isPlayable=_this$state.isPlayable,isLoaded=_this$state.isLoaded,containerClassNames=classNames__default.default(this.styles.video_container,className||"");return React__default.default.createElement("div",{"data-hook":"videoPlayer",onClick:onClick,className:containerClassNames,onKeyDown:function(e){return _this2.onKeyDown(e,onClick)},draggable:!0},!isPlayable&&this.renderOverlay(this.styles,this.props.t),this.renderPlayer(),!isLoaded&&!error&&this.renderLoader(),error&&React__default.default.createElement(wixRichContentUiComponents.MediaItemErrorMsg,{error:error,t:t}))},VideoComponent}(React__default.default.Component);VideoComponent.type={VIDEO_TYPE_LEGACY:"VIDEO-EMBED",VIDEO_TYPE:VIDEO_TYPE};var createInsertButtons=function(_ref){var _toolbar$icons,_buttonsMap,t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,disableDownload=_ref.disableDownload,_ref$experiments=_ref.experiments,experiments=void 0===_ref$experiments?{}:_ref$experiments,componentData=void 0!==disableDownload?_extends__default.default({},DEFAULTS$1,{disableDownload:disableDownload}):DEFAULTS$1,newVideoModal=experiments.newVideoModal,useNewModal=null==newVideoModal?void 0:newVideoModal.enabled,_ref2=settings||{},_ref2$exposeButtons=_ref2.exposeButtons,exposeButtons=void 0===_ref2$exposeButtons?[videoButtonsTypes.video]:_ref2$exposeButtons,toolbar=_ref2.toolbar,enableCustomUploadOnMobile=_ref2.enableCustomUploadOnMobile,handleFileSelection=_ref2.handleFileSelection,handleFileUpload=_ref2.handleFileUpload,icon=(null==toolbar||null===(_toolbar$icons=toolbar.icons)||void 0===_toolbar$icons?void 0:_toolbar$icons.InsertPluginButtonIcon)||InsertPluginIcon$1,videoModalCustomStyles=isMobile?wixRichContentUiComponents.MOBILE_FULL_SCREEN_CUSTOM_STYLE:_extends__default.default({},wixRichContentUiComponents.DesktopFlyOutModalStyles,{content:videoModalContentStyles}),embedModalCustomStyles=isMobile?wixRichContentUiComponents.MOBILE_FULL_SCREEN_CUSTOM_STYLE:_extends__default.default({},wixRichContentUiComponents.DesktopFlyOutModalStyles,{content:embedModalContentStyles}),customStyles=useNewModal?videoModalCustomStyles:isMobile&&!enableCustomUploadOnMobile||!handleFileSelection&&!handleFileUpload?SelectionModalCustomStyle:ExtendedSelectionModalCustomStyle,modalsStyle=wixRichContentEditorCommon.getModalStyles({customStyles:customStyles,fullScreen:!!useNewModal,isMobile:isMobile}),modalStyles=useNewModal?isMobile?modalsStyle:void 0:modalsStyle,baseButtonProps={type:wixRichContentEditorCommon.BUTTON_TYPES.MODAL,modalElement:wixRichContentEditorCommon.decorateComponentWithProps(VideoModal,settings)},buttonsMap=((_buttonsMap={})[videoButtonsTypes.video]={name:wixRichContentEditorCommon.INSERT_PLUGIN_BUTTONS.VIDEO,tooltip:t("VideoPlugin_InsertButton_Tooltip"),getIcon:function(){return icon},componentData:componentData},_buttonsMap[videoButtonsTypes.soundCloud]={name:wixRichContentEditorCommon.INSERT_PLUGIN_BUTTONS.SOUND_CLOUD,tooltip:t("SoundCloudPlugin_InsertButton_Tooltip"),getIcon:function(){return InsertPluginIcon},componentData:_extends__default.default({},DEFAULTS$1,{type:videoButtonsTypes.soundCloud})},_buttonsMap[videoButtonsTypes.youTube]={name:wixRichContentEditorCommon.INSERT_PLUGIN_BUTTONS.YOUTUBE,tooltip:t("EmbedURL_Social_YouTube_Title"),getIcon:function(){return YoutubeIcon},componentData:_extends__default.default({},DEFAULTS$1,{type:videoButtonsTypes.youTube}),section:"BlockToolbar_Section_Embed_Anywhere"},_buttonsMap),toolbars=useNewModal?[wixRichContentEditorCommon.TOOLBARS.MOBILE,wixRichContentEditorCommon.TOOLBARS.FOOTER,wixRichContentEditorCommon.TOOLBARS.SIDE]:[wixRichContentEditorCommon.TOOLBARS.INSERT_PLUGIN,wixRichContentEditorCommon.TOOLBARS.MOBILE,wixRichContentEditorCommon.TOOLBARS.FOOTER,wixRichContentEditorCommon.TOOLBARS.SIDE],videoButtons=exposeButtons.map((function(buttonType){return _extends__default.default({},buttonsMap[buttonType],{toolbars:toolbars,modalStyles:modalStyles,modalStylesFn:useNewModal?function(_ref3){var buttonRef=_ref3.buttonRef,toolbarName=_ref3.toolbarName,isSoundCloud=buttonType===videoButtonsTypes.soundCloud;return wixRichContentEditorCommon.getBottomToolbarModalStyles(buttonRef,{customStyles:isSoundCloud?embedModalCustomStyles:videoModalCustomStyles},toolbarName)}:void 0},baseButtonProps)}));if(useNewModal){var externalToolbarButtons=exposeButtons.map((function(buttonType){var styles=buttonType===videoButtonsTypes.soundCloud?wixRichContentUiComponents.DesktopFlyOutModalStyles:videoModalCustomStyles;return _extends__default.default({},buttonsMap[buttonType],{modalStyles:wixRichContentEditorCommon.getModalStyles({customStyles:_extends__default.default({},styles,wixRichContentUiComponents.DesktopOverlayModalStyles),fullScreen:!1,isMobile:isMobile}),toolbars:[wixRichContentEditorCommon.TOOLBARS.INSERT_PLUGIN]},baseButtonProps)}));videoButtons=[].concat(videoButtons,externalToolbarButtons)}return videoButtons},createToolbar=function(_ref){var t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,disableDownload=_ref.disableDownload,experiments=_ref.experiments;return{InlineButtons:createInlineButtons({t:t,settings:settings,isMobile:isMobile,experiments:experiments}),InsertButtons:createInsertButtons({t:t,settings:settings,isMobile:isMobile,disableDownload:disableDownload,experiments:experiments}),name:"video"}};function _toPropertyKey(arg){var key=function(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"==typeof key?key:String(key)}var createVideoPlugin=function(config){var _config$uiSettings,_config$uiSettings2,helpers=config.helpers,t=config.t,_config$VIDEO_TYPE=config[VIDEO_TYPE],settings=void 0===_config$VIDEO_TYPE?{}:_config$VIDEO_TYPE,isMobile=config.isMobile,spoilerWrapper=config.spoilerWrapper,commonPubsub=config.commonPubsub,experiments=config.experiments,rest=_objectWithoutPropertiesLoose__default.default(config,["helpers","t",VIDEO_TYPE,"isMobile","spoilerWrapper","commonPubsub","experiments"].map(_toPropertyKey)),disableDownload=null==config||null===(_config$uiSettings=config.uiSettings)||void 0===_config$uiSettings?void 0:_config$uiSettings.disableDownload,defaultPluginData=void 0!==disableDownload?_extends__default.default({},DEFAULTS$1,{disableDownload:disableDownload}):DEFAULTS$1,type=VIDEO_TYPE;return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({component:VideoComponent,type:type,legacyType:"VIDEO-EMBED",toolbar:createToolbar({t:t,settings:_extends__default.default({},settings,{commonPubsub:commonPubsub,type:type}),isMobile:isMobile,disableDownload:disableDownload,experiments:experiments}),helpers:helpers,settings:settings,t:t,isMobile:isMobile,disableRightClick:null==config||null===(_config$uiSettings2=config.uiSettings)||void 0===_config$uiSettings2?void 0:_config$uiSettings2.disableRightClick,defaultPluginData:defaultPluginData,spoilerWrapper:settings.spoiler&&spoilerWrapper,commonPubsub:commonPubsub},rest))};createVideoPlugin.functionName=VIDEO_TYPE;var DEFAULTS_config={toolbar:{hidden:[]}},createVideoData=function(pluginData,isRicosSchema){void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1);var videoData=isRicosSchema?toDraftData.convertNodeDataToDraft("VIDEO",pluginData):pluginData;return lodash.merge({},DEFAULTS$1,videoData)},Video=function(_ref){var context=_ref.context,componentData=_ref.componentData,theme=context.theme,t=context.t,_context$config=context.config,settings=(void 0===_context$config?{}:_context$config)[VIDEO_TYPE]||{};return React__default.default.createElement(VideoComponent,{componentData:componentData,theme:theme,t:t,settings:settings,blockProps:{setFocusToBlock:function(){return null}},setComponentUrl:function(){return null},onClick:function(){}})},videoDataDefaults={containerData:{alignment:"CENTER",width:{size:null,custom:null},spoiler:{enabled:null,description:null,buttonText:null},height:{custom:null},textWrap:null},video:{src:null,width:null,height:null},thumbnail:{src:null,width:null,height:null},disableDownload:null,title:null},name=ricosContent.TIPTAP_VIDEO_TYPE;exports.Modals=Modals,exports.ModalsMap=ModalsMap,exports.VIDEO_TYPE=VIDEO_TYPE,exports.VIDEO_TYPE_LEGACY="VIDEO-EMBED",exports.VideoViewer=VideoViewer,exports.createVideoPlugin=createVideoPlugin,exports.pluginVideo=function(config){var defaultOptions,pluginConfig=_extends__default.default({},DEFAULTS_config,config);return{config:pluginConfig,type:VIDEO_TYPE,createPlugin:createVideoPlugin,ModalsMap:ModalsMap,createPluginData:createVideoData,configFixer:function(){return pluginConfig.uploadHandler=pluginConfig.handleFileUpload||pluginConfig.handleFileSelection},tiptapExtensions:(defaultOptions=pluginConfig,[{type:"node",Component:Video,componentDataDefaults:_extends__default.default({},videoDataDefaults,{id:"",loading:{default:!1}}),createExtensionConfig:function(){return{name:name,defaultOptions:defaultOptions,addCommands:function(){return{}}}}}])}},exports.videoButtonsTypes=videoButtonsTypes;
//# sourceMappingURL=module.cjs.js.map

@@ -1,2 +0,2 @@

import{isHexColor,validate,mergeStyles,getDynamicInlineStyleMapper,RICOS_TEXT_COLOR_TYPE,RICOS_TEXT_HIGHLIGHT_TYPE}from"wix-rich-content-common";import _extends from"@babel/runtime/helpers/extends";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import{ColorPicker,createBasePlugin}from"wix-rich-content-plugin-commons";import React,{Component}from"react";import{getSelectionStyles,EditorState,Modifier,BUTTON_TYPES,getModalStyles,isAtomicBlockFocused,FORMATTING_BUTTONS,InlineToolbarButton,ClickOutside}from"wix-rich-content-editor-common";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import{isObject}from"lodash";import _createClass from"@babel/runtime/helpers/createClass";import classNames from"classnames";import Modal from"react-modal";var _pluginSettingsByType,TEXT_COLOR_TYPE="wix-rich-content-text-color",TEXT_HIGHLIGHT_TYPE="wix-rich-content-text-highlight",normalizeStyle=function(style){try{return JSON.parse(style)}catch(e){return{FG:style}}},isTextDecoration=function(style,type){return!!normalizeStyle(style)[type]},getColorByType=function(style,type){return normalizeStyle(style)[type]||""},getColor=function(style){var parsed=normalizeStyle(style);return Object.values(parsed)[0]},textForegroundPredicate=function(styleSelectionPredicate){return function(style){return styleSelectionPredicate(getColorByType(style,"FG"))}},textBackgroundPredicate=function(styleSelectionPredicate){return function(style){return styleSelectionPredicate(getColorByType(style,"BG"))}},isTextHighlight=function(style){return isTextDecoration(style,"BG")},isTextColor=function(style){return!isTextDecoration(style,"BG")},styleMapper=function(type){return type===TEXT_HIGHLIGHT_TYPE?function(color){return JSON.stringify({BG:color})}:function(color){return JSON.stringify({FG:color})}},DEFAULT_PALETTE=Object.freeze(["#ffffff","#303030","#3a54b4","#bfad80","#bf695c","#f7f7f7"]),DEFAULT_STYLE_SELECTION_PREDICATE=function(style){return isHexColor(style)},userColors=[],DEFAULTS={configTextColor:{editor:{onColorAdded:function(color){return userColors=[].concat(userColors,[color])},getUserColors:function(){return userColors}},viewer:{}},configTextHighlight:{editor:{onColorAdded:function(color){return userColors=[].concat(userColors,[color])},getUserColors:function(){return userColors}},viewer:{}}},schema={definitions:{},$schema:"http://json-schema.org/draft-07/schema#",$id:"color-scheme",type:"object",title:"color-scheme schema",required:["color","index"],properties:{color:{$id:"#/properties/color",type:"string",title:"hex color",default:"",examples:["#fff","#bada55"],pattern:"^#[0-9a-f]{3}(?:[0-9a-f]{3})?$"},index:{$id:"#/properties/index",type:"integer",title:"color index",default:0,examples:[0]}}},extractColor=function(colorScheme,style){return colorScheme&&colorScheme[style]?colorScheme[style].color:isHexColor(style)?style:void 0},TextColorPanel=function(_Component){function TextColorPanel(props){var _this,colorScheme;return(_this=_Component.call(this,props)||this).styleSelectionPredicate=props.predicate(props.settings.styleSelectionPredicate||DEFAULT_STYLE_SELECTION_PREDICATE),!props.settings.colorScheme||(colorScheme=props.settings.colorScheme,isObject(colorScheme)&&Object.values(colorScheme).every((function(value){return validate(value,schema)})))||console.error("Error: colorScheme is not valid"),_this.currentColors=getSelectionStyles(props.editorState,_this.styleSelectionPredicate),_this.state={currentColor:_this.currentColors.length>0?extractColor(props.settings.colorScheme,getColor(_this.currentColors[0])):_this.props.defaultColor,currentSchemeColor:_this.currentColors[0]&&getColor(_this.currentColors[0]),userColors:props.settings.getUserColors()||[]},_this.setColor=_this.setColor.bind(_assertThisInitialized(_this)),_this.onColorAdded=_this.onColorAdded.bind(_assertThisInitialized(_this)),_this}_inheritsLoose(TextColorPanel,_Component);var _proto=TextColorPanel.prototype;return _proto.componentWillUnmount=function(){this.props.setKeepToolbarOpen(!1)},_proto.setColor=function(_temp){var colorName=(void 0===_temp?{}:_temp).color,_this$props=this.props,editorState=_this$props.editorState,settings=_this$props.settings,defaultColor=_this$props.defaultColor,onSelect=_this$props.onSelect,styleMapper=_this$props.styleMapper,predicate=_this$props.predicate,newColorHex=colorName&&extractColor(settings.colorScheme,colorName);editorState=getInlineColorState(colorName,editorState,settings,styleMapper,predicate),this.setState({currentColor:newColorHex||defaultColor,currentSchemeColor:colorName||this.currentColors[0]&&getColor(this.currentColors[0])}),this.props.closeModal(editorState),onSelect&&onSelect(colorName)},_proto.onColorAdded=function(_ref2){var color=_ref2.color;this.props.settings.onColorAdded(color),this.setState({userColors:this.props.settings.getUserColors()||[]})},_proto.render=function(){var _this$props2=this.props,theme=_this$props2.theme,settings=_this$props2.settings,t=_this$props2.t,setKeepToolbarOpen=_this$props2.setKeepToolbarOpen,isMobile=_this$props2.isMobile,defaultColor=_this$props2.defaultColor,colorPickerHeaderKey=_this$props2.colorPickerHeaderKey,colorScheme=settings.colorScheme,palette=function(colorScheme){return colorScheme?Object.values(colorScheme).sort((function(entry1,entry2){return entry1.index>entry2.index?1:-1})).map((function(entry){return entry.color})):DEFAULT_PALETTE}(colorScheme),schemeAttributes=function(colorScheme){return colorScheme?Object.keys(colorScheme).reduce((function(sorted,key){return!sorted.length||colorScheme[key].index>colorScheme[sorted[0]].index?sorted.push(key):sorted.unshift(key),sorted}),[]):null}(colorScheme),onCustomPickerToggle=settings.onCustomPickerToggle,onCustomColorPicked=settings.onCustomColorPicked,paletteColors=isMobile?palette.slice(0,5):palette.slice(0,6);return React.createElement(ColorPicker,{schemeAttributes:schemeAttributes,schemeColor:this.state.currentSchemeColor,color:this.state.currentColor,defaultColor:defaultColor,palette:paletteColors,userColors:this.state.userColors.slice(0,17),onColorAdded:this.onColorAdded,onChange:this.setColor,onResetColor:this.setColor,onCustomPickerToggle:onCustomPickerToggle,onCustomColorPicked:onCustomColorPicked,theme:theme,t:t,setKeepToolbarOpen:setKeepToolbarOpen,isMobile:isMobile},(function(_ref3){var renderPalette=_ref3.renderPalette,renderUserColors=_ref3.renderUserColors,renderAddColorButton=_ref3.renderAddColorButton,renderResetColorButton=_ref3.renderResetColorButton,mergedStyles=_ref3.mergedStyles;return React.createElement(React.Fragment,null,isMobile&&React.createElement(React.Fragment,null,React.createElement("div",{className:mergedStyles.colorPicker_header},t(colorPickerHeaderKey)),React.createElement("div",{className:mergedStyles.colorPicker_separator})),React.createElement("div",{className:mergedStyles.colorPicker_palette},React.createElement("div",{className:mergedStyles.colorPicker_buttons_container},renderPalette(),renderUserColors(),isMobile&&renderAddColorButton()),!isMobile&&React.createElement(React.Fragment,null,React.createElement("hr",{className:mergedStyles.colorPicker_separator}),React.createElement("div",{className:mergedStyles.colorPicker_bottom_container},renderResetColorButton(),renderAddColorButton()))))}))},TextColorPanel}(Component),getInlineColorState=function(color,editorState,settings,styleMapper,predicate){var styleSelectionPredicate=predicate(settings&&settings.styleSelectionPredicate||DEFAULT_STYLE_SELECTION_PREDICATE),selection=editorState.getSelection(),newEditorState=getSelectionStyles(editorState,styleSelectionPredicate).reduce((function(nextEditorState,prevColor){var contentState=nextEditorState.getCurrentContent(),nextContentState=Modifier.removeInlineStyle(contentState,selection,prevColor);return EditorState.push(nextEditorState,nextContentState,"change-inline-style")}),editorState),contentState=newEditorState.getCurrentContent();return color&&(contentState=Modifier.applyInlineStyle(contentState,selection,styleMapper(color))),EditorState.push(newEditorState,contentState,"change-inline-style")},TextColorIcon=function(props){return props.newFormattingToolbar?React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"21",height:"21",viewBox:"0 0 21 21"},props),React.createElement("path",{width:"10",height:"10",viewBox:"0 0 10 10",fill:props.isDisabled?"graytext":"#000",id:"Icon",d:"M7.84 10l2-5h.32l2 5H7.84zm5.92 4h1.08l-4-10H9.16l-4 10h1.08l1.2-3h5.12l1.2 3z"}),React.createElement("path",{width:"12",height:"3",viewBox:"0 0 12 3",fill:props.isDisabled?"graytext":""+props.currentColor,id:"Fill",fillRule:"nonzero",d:"M4 19L16 19 16 16 4 16z"})):React.createElement("svg",Object.assign({width:19,height:19,viewBox:"0 0 19 19"},props),React.createElement("path",{fill:"currentColor",d:"M12.9406953 8.95385441C12.1642734 9.88748434 11.6208213 10.7926967 11.3103388 11.6694915L7.40037874 11.6694915 6.54305663 13.9353876C6.52834357 13.9742741 6.49110424 14 6.4495274 14L4.09790277 14C4.04267429 14 3.99790277 13.9552285 3.99790277 13.9 3.99790277 13.8868237 4.00050674 13.8737773 4.00556503 13.8616107L8.4700421 3.12322131C8.50105957 3.04861511 8.5739205 3 8.65471758 3L10.3160943 3C10.396723 3 10.4694666 3.04841524 10.5005916 3.12279406L12.9406953 8.95385441zM9.41798529 6.20056497L8.13269519 9.61864407 10.7182206 9.61864407 9.41798529 6.20056497zM12 13.4245258C12 14.8207269 13.145 16 14.5 16 15.855 16 17 14.8202416 17 13.4245258 17 12.103093 16.2894438 10.6820365 14.8683313 9.16135614L14.8683089 9.16137708C14.6797751 8.95963399 14.3633932 8.94892574 14.1616501 9.13745952 14.1536124 9.144971 14.1458247 9.15274572 14.1382999 9.16077099 12.7127666 10.6811133 12 12.1023649 12 13.4245258z"}))},TextHighlightIcon=function(props){return props.newFormattingToolbar?React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"},props),React.createElement("path",{width:"11",height:"10",viewBox:"0 0 11 10",fill:props.isDisabled?"graytext":"#000",id:"Icon",d:"M10.616 3.366L6.5 7.482 4.207 5.189l4.116-4.116c.098-.098.256-.098.354 0l1.94 1.939c.097.098.097.256 0 .354zM5.293 8.689h-1.94L3 8.336v-1.94l.5-.5 2.293 2.293-.5.5zm6.03-6.384L9.384.366c-.487-.488-1.282-.488-1.768 0l-5.47 5.47c-.093.093-.146.22-.146.353v2.147L.823 9.512c-.06.062-.087.15-.066.235.02.084.082.152.164.18l1.5.5c.026.008.052.012.08.012.064 0 .128-.025.176-.073l.676-.677H5.5c.133 0 .26-.052.353-.146l5.47-5.47c.487-.487.487-1.28 0-1.768z",transform:"translate(-210.000000, -80.000000) translate(206.000000, 77.000000) translate(4.000000, 3.310800)"}),React.createElement("path",{width:"12",height:"3",viewBox:"0 0 12 3",fill:props.isDisabled?"graytext":""+props.currentColor,id:"Fill",fillRule:"nonzero",d:"M0 15.689L12 15.689 12 12.689 0 12.689z"})):React.createElement("svg",Object.assign({width:"19px",height:"19px",viewBox:"0 0 19 19"},props),React.createElement("title",null,"Fill Color"),React.createElement("g",{stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},React.createElement("path",{d:"M13,15.4025547 C13,16.1865787 13.687,16.8487889 14.5,16.8487889 C15.313,16.8487889 16,16.1863062 16,15.4025547 C16,14.7033546 15.6214705,13.9544845 14.8644116,13.1559444 L14.8643729,13.1559811 C14.6744053,12.9556048 14.3579691,12.9471668 14.1575928,13.1371343 C14.1513476,13.1430551 14.1452562,13.1491362 14.1393249,13.1553715 C13.379775,13.9538457 13,14.7029067 13,15.4025547 Z",fill:"currentColor",fillRule:"nonzero"}),React.createElement("path",{d:"M3.5,6 C3.22385763,6 3,5.77614237 3,5.5 C3,5.22385763 3.22385763,5 3.5,5 L12.748729,5 C13.3010137,5 13.748729,5.44771525 13.748729,6 L13.748729,13 C13.748729,13.5522847 13.3010137,14 12.748729,14 L5.74872899,14 C5.19644424,14 4.74872899,13.5522847 4.74872899,13 L4.74872899,6 L3.5,6 Z M12.748729,6.00005457 L5.74872899,6.00005457 L5.74872899,13.0000546 L12.748729,6.00005457 Z",fill:"currentColor",fillRule:"nonzero",transform:"translate(8.374364, 9.500000) rotate(-315.000000) translate(-8.374364, -9.500000) "})))},pluginSettingsByType=((_pluginSettingsByType={})[TEXT_COLOR_TYPE]={defaultColor:"#000000",icon:TextColorIcon,predicate:textForegroundPredicate,tooltipKey:"TextColorButton_Tooltip",colorPickerHeaderKey:"Color_Picker_TextColorButton_Header"},_pluginSettingsByType[TEXT_HIGHLIGHT_TYPE]={defaultColor:"#ffffff",icon:TextHighlightIcon,predicate:textBackgroundPredicate,tooltipKey:"TextHighlightButton_Tooltip",colorPickerHeaderKey:"Color_Picker_TextHighlightButton_Header"},_pluginSettingsByType),getButtonProps=function(_ref){var config=_ref.config,type=_ref.type,getEditorState=config.getEditorState,setEditorState=config.setEditorState,t=config.t,theme=config.theme,isMobile=config.isMobile,helpers=config.helpers,uiSettings=config.uiSettings,settings=config[type],experiments=config.experiments,pluginSettings=pluginSettingsByType[type],styleMap=styleMapper(type),noop=function(){return!1},modalStylesFn=function(ref){if(null==ref||!ref.getBoundingClientRect)return{};var _ref$getBoundingClien=ref.getBoundingClientRect(),bottom=_ref$getBoundingClien.bottom,left=_ref$getBoundingClien.left;return isMobile?{content:{position:"absolute",left:"0px",right:"0px",bottom:"0",border:"none",background:"white",overflow:"auto",outline:"none",padding:"0px",width:"100%",zIndex:"6",top:"auto",transform:"translateY(0)",margin:0}}:{content:{display:"inline-table",transform:"translateY(0)",minHeight:"88px",position:"absolute",minWidth:"89px",maxWidth:"184",width:"182px",height:"86px",top:bottom,left:left-15,borderRadius:"2px",border:"1px solid #ededed",margin:"0",background:"#fff"},overlay:{background:"transparent"}}},TextColorModal=function(_ref2){var closeCustomModal=_ref2.closeCustomModal,onSelect=_ref2.onSelect;return React.createElement(TextColorPanel,{t:t,isMobile:isMobile,theme:theme,closeModal:function(args){var newEditorState,_helpers$closeModal,editorState,selection;newEditorState=args,editorState=getEditorState(),selection=editorState.getSelection(),setEditorState(EditorState.forceSelection(newEditorState||editorState,selection)),null==helpers||null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal||_helpers$closeModal.call(helpers),closeCustomModal&&closeCustomModal()},editorState:getEditorState(),setEditorState:setEditorState,settings:settings,uiSettings:uiSettings,styleMapper:styleMap,predicate:pluginSettings.predicate,defaultColor:pluginSettings.defaultColor,setKeepToolbarOpen:noop,onSelect:onSelect,colorPickerHeaderKey:pluginSettings.colorPickerHeaderKey})},isDisabled=function(){return getEditorState().getSelection().isCollapsed()||isAtomicBlockFocused(getEditorState())};return{onClose:function(){},onClick:function(_ref4){return function(_ref3){var ref=_ref3.ref,render=_ref3.render;if(render)render(TextColorModal);else{var _helpers$openModal,modalStyles=getModalStyles({customStyles:modalStylesFn(ref),fullScreen:!1,isMobile:isMobile});null==helpers||null===(_helpers$openModal=helpers.openModal)||void 0===_helpers$openModal||_helpers$openModal.call(helpers,{modalStyles:modalStyles,helpers:helpers,isMobile:isMobile,modalElement:TextColorModal,theme:theme})}}({ref:_ref4.ref,render:_ref4.render})},isDisabled:isDisabled,arrow:!1,isActive:function(){var predicate=pluginSettings.predicate((null==settings?void 0:settings.styleSelectionPredicate)||DEFAULT_STYLE_SELECTION_PREDICATE);return getSelectionStyles(config.getEditorState(),predicate).length>0},getIcon:function(){var _settings$toolbar,_settings$toolbar$ico;return(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.InsertPluginButtonIcon)||function(){var _experiments$newForma,editorState,predicate,defaultColor,styleSelectionPredicate,currentColors;return pluginSettings.icon({newFormattingToolbar:null==experiments||null===(_experiments$newForma=experiments.newFormattingToolbar)||void 0===_experiments$newForma?void 0:_experiments$newForma.enabled,currentColor:(editorState=getEditorState(),predicate=pluginSettings.predicate,defaultColor=pluginSettings.defaultColor,styleSelectionPredicate=predicate(settings.styleSelectionPredicate||DEFAULT_STYLE_SELECTION_PREDICATE),currentColors=getSelectionStyles(editorState,styleSelectionPredicate),currentColors.length>0?extractColor(settings.colorScheme,getColor(currentColors[0])):defaultColor),isDisabled:isDisabled()})}},tooltip:config.t(pluginSettings.tooltipKey),getLabel:function(){return""},type:BUTTON_TYPES.DROPDOWN,dataHook:type.replace(/\s+/g,"-").toLowerCase()+"-button",modal:TextColorModal,onSelect:function(color){var editorState=getEditorState(),selection=editorState.getSelection(),coloredEditorState=getInlineColorState(color,getEditorState(),settings,styleMap,pluginSettings.predicate);setEditorState(EditorState.forceSelection(coloredEditorState||editorState,selection))}}},styles={textColorModal:"_2L0nY",textColorModal_mobile:"_2Otbl",textColorModalOverlay:"_1J3EL",textColorModalOverlay_mobile:"_2p47r",textColorPopup_button:"IiTdz",textColorPopup:"_6IxcZ"},BaseTextColor=function(_Component){function BaseTextColor(props){var _this;return(_this=_Component.call(this,props)||this).openPanel=function(){var _this$props=_this.props,isMobile=_this$props.isMobile,setKeepOpen=_this$props.setKeepOpen,config=_this$props.config,pluginParams=_this$props.pluginParams;isMobile||setKeepOpen&&setKeepOpen(!0);var settings=config[pluginParams.type],position={};if(settings.positionPicker)position=settings.positionPicker(_this.buttonRef,216);else{var _this$buttonRef$curre=_this.buttonRef.current.getBoundingClientRect(),bottom=_this$buttonRef$curre.bottom;position={left:_this$buttonRef$curre.left-108,top:bottom}}_this.setState({isPanelOpen:!0,panelLeft:position.left,panelTop:position.top})},_this.closePanel=function(editorState){_this.setState({isPanelOpen:!1}),_this.props.setKeepOpen(!1),_this.preserveSelectionState(editorState)},_this.state={showPanel:!1},_this.styles=mergeStyles({styles:styles,theme:props.theme}),_this.buttonRef=props.buttonRef,_this.styleMapper=styleMapper(props.pluginParams.type),_this}_inheritsLoose(BaseTextColor,_Component),BaseTextColor.getModalParent=function(){var _document,_document$querySelect;return null===(_document=document)||void 0===_document||null===(_document$querySelect=_document.querySelector(".DraftEditor-root"))||void 0===_document$querySelect?void 0:_document$querySelect.parentNode};var _proto=BaseTextColor.prototype;return _proto.preserveSelectionState=function(newEditorState){var _this$props2=this.props,setEditorState=_this$props2.setEditorState,editorState=(0,_this$props2.getEditorState)(),selection=editorState.getSelection();setEditorState(EditorState.forceSelection(newEditorState||editorState,selection))},_proto.render=function(){var _classNames,_classNames2,_this2=this,_this$props3=this.props,theme=_this$props3.theme,helpers=_this$props3.helpers,isMobile=_this$props3.isMobile,t=_this$props3.t,tabIndex=_this$props3.tabIndex,setEditorState=_this$props3.setEditorState,getEditorState=_this$props3.getEditorState,setKeepOpen=_this$props3.setKeepOpen,config=_this$props3.config,uiSettings=_this$props3.uiSettings,pluginParams=_this$props3.pluginParams,toolbarName=_this$props3.toolbarName,settings=config[pluginParams.type],_this$state=this.state,isPanelOpen=_this$state.isPanelOpen,panelTop=_this$state.panelTop,panelLeft=_this$state.panelLeft,tooltip=t(pluginParams.toolTip),buttonStyles={button:theme.inlineToolbarButton,buttonWrapper:theme.inlineToolbarButton_wrapper,icon:theme.inlineToolbarButton_icon,active:theme.inlineToolbarButton_active},modalStyle={content:isMobile?{top:"unset",left:0,backgroundColor:"white"}:{top:panelTop,left:panelLeft,marginTop:15,borderRadius:2,width:184}},TEXT_COLOR=FORMATTING_BUTTONS.TEXT_COLOR,TEXT_HIGHLIGHT=FORMATTING_BUTTONS.TEXT_HIGHLIGHT,formattingButtonName=pluginParams.type===TEXT_COLOR_TYPE?TEXT_COLOR:TEXT_HIGHLIGHT;return isMobile||"StaticTextToolbar"!==toolbarName||!settings.inlinePopups?React.createElement(InlineToolbarButton,{onClick:this.openPanel,isActive:this.isActive,helpers:helpers,theme:_extends({},theme,buttonStyles),isMobile:isMobile,tooltipText:tooltip,dataHook:pluginParams.dataHook,formattingButtonName:formattingButtonName,tabIndex:tabIndex,icon:pluginParams.icon,forwardRef:this.buttonRef,pluginType:pluginParams.type},React.createElement(Modal,{onRequestClose:function(){return _this2.closePanel()},isOpen:isPanelOpen,parentSelector:BaseTextColor.getModalParent,className:classNames((_classNames={},_classNames[this.styles.textColorModal]=!isMobile,_classNames[this.styles.textColorModal_mobile]=isMobile,_classNames)),overlayClassName:classNames((_classNames2={},_classNames2[this.styles.textColorModalOverlay]=!isMobile,_classNames2[this.styles.textColorModalOverlay_mobile]=isMobile,_classNames2)),style:modalStyle,ariaHideApp:!1},React.createElement(TextColorPanel,{t:t,isMobile:isMobile,theme:theme,closeModal:this.closePanel,editorState:getEditorState(),setEditorState:setEditorState,settings:settings,uiSettings:uiSettings,setKeepToolbarOpen:setKeepOpen,styleMapper:this.styleMapper,predicate:pluginParams.predicate,defaultColor:pluginParams.defaultColor,colorPickerHeaderKey:pluginParams.colorPickerHeaderKey}))):React.createElement("div",{className:styles.textColorPopup_button},React.createElement(InlineToolbarButton,{onClick:this.openPanel,isActive:this.isActive,helpers:helpers,theme:_extends({},theme,buttonStyles),isMobile:isMobile,tooltipText:tooltip,dataHook:pluginParams.dataHook,formattingButtonName:formattingButtonName,tabIndex:tabIndex,icon:pluginParams.icon,forwardRef:this.buttonRef,pluginType:pluginParams.type},isPanelOpen&&React.createElement("div",{className:styles.textColorPopup},React.createElement(ClickOutside,{onClickOutside:function(){return _this2.closePanel()}},React.createElement(TextColorPanel,{t:t,isMobile:isMobile,theme:theme,closeModal:this.closePanel,editorState:getEditorState(),setEditorState:setEditorState,settings:settings,uiSettings:uiSettings,setKeepToolbarOpen:setKeepOpen,styleMapper:this.styleMapper,predicate:pluginParams.predicate,defaultColor:pluginParams.defaultColor,colorPickerHeaderKey:pluginParams.colorPickerHeaderKey})))))},_createClass(BaseTextColor,[{key:"isActive",get:function(){var _this$props4=this.props,config=_this$props4.config,pluginParams=_this$props4.pluginParams,getEditorState=_this$props4.getEditorState,settings=config[pluginParams.type]||{},styleSelectionPredicate=pluginParams.predicate(settings.styleSelectionPredicate||DEFAULT_STYLE_SELECTION_PREDICATE);return getSelectionStyles(getEditorState(),styleSelectionPredicate).length>0}}]),BaseTextColor}(Component);BaseTextColor.defaultProps={setKeepOpen:function(){}};var TextColorButton=function(_Component){function TextColorButton(props){var _this;return(_this=_Component.call(this,props)||this).buttonRef=React.createRef(),_this}return _inheritsLoose(TextColorButton,_Component),TextColorButton.prototype.render=function(){var _settings$toolbar,_settings$toolbar$ico,settings=this.props.config[TEXT_COLOR_TYPE],pluginParams={dataHook:"TextColorButton",toolTip:"TextColorButton_Tooltip",icon:(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.InsertPluginButtonIcon)||TextColorIcon,type:TEXT_COLOR_TYPE,predicate:textForegroundPredicate,defaultColor:"#000000",colorPickerHeaderKey:"Color_Picker_TextColorButton_Header"};return React.createElement(BaseTextColor,_extends({buttonRef:this.buttonRef,pluginParams:pluginParams},this.props))},TextColorButton}(Component);TextColorButton.defaultProps={setKeepOpen:function(){}};var TextHighlightButton=function(_Component){function TextHighlightButton(props){var _this;return(_this=_Component.call(this,props)||this).buttonRef=React.createRef(),_this}return _inheritsLoose(TextHighlightButton,_Component),TextHighlightButton.prototype.render=function(){var _settings$toolbar,_settings$toolbar$ico,settings=this.props.config[TEXT_HIGHLIGHT_TYPE],pluginParams={dataHook:"TextHighlightButton",toolTip:"TextHighlightButton_Tooltip",icon:(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.InsertPluginButtonIcon)||TextHighlightIcon,type:TEXT_HIGHLIGHT_TYPE,predicate:textBackgroundPredicate,defaultColor:"#ffffff",colorPickerHeaderKey:"Color_Picker_TextHighlightButton_Header"};return React.createElement(BaseTextColor,_extends({buttonRef:this.buttonRef,pluginParams:pluginParams},this.props))},TextHighlightButton}(Component);TextHighlightButton.defaultProps={setKeepOpen:function(){}};function _toPropertyKey$1(arg){var key=function(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"==typeof key?key:String(key)}var createTextColorPlugin=function(config){var type=TEXT_COLOR_TYPE,theme=config.theme,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,rest=_objectWithoutPropertiesLoose(config,["theme",type].map(_toPropertyKey$1)),toolbar=function(config){return{TextButtonMapper:function(){var _ref;return(_ref={})[FORMATTING_BUTTONS.TEXT_COLOR]={component:TextColorButton,externalizedButtonProps:getButtonProps({config:config,type:TEXT_COLOR_TYPE})},_ref},name:"text-color"}}(config);return createBasePlugin(_extends({theme:theme,toolbar:toolbar,type:type,settings:settings,defaultPluginData:DEFAULTS.configTextColor.editor},rest))};function _toPropertyKey(arg){var key=function(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"==typeof key?key:String(key)}createTextColorPlugin.functionName=TEXT_COLOR_TYPE;var _ModalsMap,createTextHighlightPlugin=function(config){var type=TEXT_HIGHLIGHT_TYPE,theme=config.theme,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,rest=_objectWithoutPropertiesLoose(config,["theme",type].map(_toPropertyKey)),toolbar=function(config){return{TextButtonMapper:function(){var _ref2;return(_ref2={})[FORMATTING_BUTTONS.TEXT_HIGHLIGHT]={component:TextHighlightButton,externalizedButtonProps:getButtonProps({config:config,type:TEXT_HIGHLIGHT_TYPE})},_ref2},name:"text-highlight"}}(config);return createBasePlugin(_extends({theme:theme,toolbar:toolbar,type:type,settings:settings,defaultPluginData:DEFAULTS.configTextHighlight.editor},rest))};createTextHighlightPlugin.functionName=TEXT_HIGHLIGHT_TYPE;var Modals={TEXT_COLOR_PICKER:"TEXT_COLOR_PICKER"},ModalsMap=((_ModalsMap={})[Modals.TEXT_COLOR_PICKER]=TextColorPanel,_ModalsMap),pluginTextColor=function(config){return{config:_extends({},DEFAULTS.configTextColor.editor,config),type:TEXT_COLOR_TYPE,createPlugin:createTextColorPlugin,ModalsMap:ModalsMap}},pluginTextHighlight=function(config){return{config:_extends({},DEFAULTS.configTextHighlight.editor,config),type:TEXT_HIGHLIGHT_TYPE,createPlugin:createTextHighlightPlugin,ModalsMap:{}}},textColorInlineStyleMapper=getDynamicInlineStyleMapper(RICOS_TEXT_COLOR_TYPE),textHighlightInlineStyleMapper=getDynamicInlineStyleMapper(RICOS_TEXT_HIGHLIGHT_TYPE);export{Modals,ModalsMap,TEXT_COLOR_TYPE,TEXT_HIGHLIGHT_TYPE,createTextColorPlugin,createTextHighlightPlugin,getColor,isTextColor,isTextHighlight,pluginTextColor,pluginTextHighlight,textColorInlineStyleMapper,textHighlightInlineStyleMapper};
import _extends from"@babel/runtime/helpers/extends";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import{handleUploadFinished,handleUploadStart,BUTTONS,PluginSettingsIcon,createBasePlugin}from"wix-rich-content-plugin-commons";import{KEYS_CHARCODE,decorateComponentWithProps,getModalStyles,BUTTON_TYPES,INSERT_PLUGIN_BUTTONS,TOOLBARS,getBottomToolbarModalStyles}from"wix-rich-content-editor-common";import React,{Component,useState}from"react";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import{CloseIcon,TextInput,Button,BUTTON_SIZE,SettingsMobileHeader,SettingsSection,LabeledToggle,SettingsPanelFooter,UrlInputModal,MediaUploadModal,NewUrlInputModal,Tabs,Tab,MOBILE_FULL_SCREEN_CUSTOM_STYLE,DesktopFlyOutModalStyles,Loader,MediaItemErrorMsg,DesktopOverlayModalStyles}from"wix-rich-content-ui-components";import{isValidExactUrl,mergeStyles,isSSR,validate}from"wix-rich-content-common";import ReactPlayer from"react-player";import classNames from"classnames";import ReactDOM,{findDOMNode}from"react-dom";import{isEqual,get,merge}from"lodash";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import pluginVideoSchema from"wix-rich-content-common/dist/statics/schemas/plugin-video.schema.json";import{convertNodeDataToDraft}from"ricos-content/libs/toDraftData";import{TIPTAP_VIDEO_TYPE}from"ricos-content";var _ModalsMap,InsertPluginIcon$1=function(props){return React.createElement("svg",Object.assign({xmlnsXlink:"http://www.w3.org/1999/xlink",viewBox:"0 0 19 19",width:"19",height:"19"},props),React.createElement("defs",null,React.createElement("path",{id:"video-icon-path",d:"M14 7l2.842-1.421A.8.8 0 0 1 18 6.294v6.412a.8.8 0 0 1-1.158.715L14 12v2a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h11a1 1 0 0 1 1 1v2zm0 3.9l2.708 1.354a.2.2 0 0 0 .29-.179V6.922a.2.2 0 0 0-.29-.178L14 8.098V10.9zM2 5v9h11V5H2z"})),React.createElement("g",{fillRule:"evenodd"},React.createElement("mask",{id:"video-icon-mask"},React.createElement("use",{xlinkHref:"#video-icon-path"})),React.createElement("use",{fillRule:"nonzero",xlinkHref:"#video-icon-path"})))},InsertPluginIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"19",height:"19",viewBox:"0 0 19 19"},props),React.createElement("path",{d:"M5.2,9 L5.8,9 C5.9104569,9 6,9.05969537 6,9.13333333 L6,14.8666667 C6,14.9403046 5.9104569,15 5.8,15 L5.2,15 C5.0895431,15 5,14.9403046 5,14.8666667 L5,9.13333333 C5,9.05969537 5.0895431,9 5.2,9 Z M3.2,8 L3.8,8 C3.9104569,8 4,8.06268014 4,8.14 L4,14.86 C4,14.9373198 3.9104569,15 3.8,15 L3.2,15 C3.0895431,15 3,14.9373198 3,14.86 L3,8.14 C3,8.06268014 3.0895431,8 3.2,8 Z M1.2,10 L1.8,10 C1.91045695,10 2,10.0447715 2,10.1 L2,13.9 C2,13.9552284 1.91045695,14 1.8,14 L1.2,14 C1.08954305,14 1,13.9552284 1,13.9 L1,10.1 C1,10.0447715 1.08954305,10 1.2,10 Z M18,11.6153846 C18,13.4846561 16.4846561,15 14.6153846,15 L7.84615385,15 C7.37883602,15 7,14.621164 7,14.1538462 L7,4.84615385 C8.1282051,4.28205128 9.39743587,4 10.8076923,4 C12.9089391,4 15.0384615,6.12783884 15.0384615,8.23076923 C16.7079981,8.4650878 18,9.8893546 18,11.6153846 Z M8,14 L14.5454545,14 C15.9010625,14 17,12.9010625 17,11.5454545 C17,10.3050264 16.0718944,9.25574738 14.8408286,9.08296796 L14.1363636,8.98409667 L14.1363636,8.27272727 C14.1363636,6.69177453 12.4441412,5 10.8636364,5 C9.81175629,5 8.85922746,5.17619715 8,5.52684396 L8,14 Z"}))},MediaReplaceIcon=function(props){return React.createElement("svg",Object.assign({xmlnsXlink:"http://www.w3.org/1999/xlink",width:19,height:19,viewBox:"0 0 19 19"},props),React.createElement("defs",null,React.createElement("path",{id:"replace-path",d:"M3 7.8V3.2c0-.11.09-.2.2-.2h.6c.11 0 .2.09.2.2v2.592A6.607 6.607 0 0 1 9.412 3C13.05 3 16 5.91 16 9.5c0 .168-.006.335-.02.5h-1.016a5.51 5.51 0 0 0 .022-.5c0-3.038-2.495-5.5-5.574-5.5a5.583 5.583 0 0 0-4.967 3H7.8c.11 0 .2.09.2.2v.6a.2.2 0 0 1-.2.2H3.2a.2.2 0 0 1-.2-.2zm13 3.4v4.6a.2.2 0 0 1-.2.2h-.6a.2.2 0 0 1-.2-.2v-2.592A6.607 6.607 0 0 1 9.588 16C5.95 16 3 13.09 3 9.5c0-.168.006-.335.02-.5h1.016a5.496 5.496 0 0 0-.022.5c0 3.038 2.495 5.5 5.574 5.5a5.583 5.583 0 0 0 4.967-3H11.2a.2.2 0 0 1-.2-.2v-.6c0-.11.09-.2.2-.2h4.6c.11 0 .2.09.2.2z"})),React.createElement("g",{fillRule:"evenodd"},React.createElement("mask",{id:"replace-mask"},React.createElement("use",{xlinkHref:"#replace-path"})),React.createElement("use",{fillRule:"nonzero",xlinkHref:"#replace-path"})))},YoutubeIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",width:"19",height:"19",viewBox:"0 0 19 19"},props),React.createElement("path",{fillRule:"evenodd",d:"M9.783 3.126c1.117.006 5.217.049 6.359.357.731.196 1.307.776 1.503 1.512C18 6.33 18 9.114 18 9.114s0 2.784-.355 4.118c-.196.736-.772 1.316-1.503 1.513-1.215.327-5.784.355-6.537.357h-.21c-.753-.002-5.322-.03-6.537-.357-.731-.197-1.307-.777-1.503-1.513-.317-1.191-.35-3.538-.355-4.028v-.181c.004-.49.038-2.836.355-4.028.196-.736.772-1.316 1.503-1.512C4 3.175 8.1 3.132 9.218 3.126zM7.76 6.586v5.055l4.444-2.527L7.76 6.586z"}))},styles$3={video_modal_container_big:"_4hyfK",video_modal_container_small:"Wdxcn",video_modal_closeIcon:"_1P3Vk",video_modal_errorIcon:"_4U647",video_modal_header:"_2wuD-",video_modal_header_text:"_35sJQ",video_modal_textInput_customWidth:"_167aE",video_modal_textInput_fullWidth:"cn4jv",video_modal_add_a_Video:"_30xCH",video_modal_or_upload_video_from:"_3Q6uE",video_modal_upload_video:"_20AZa",video_modal_input_button_wrapper:"EmpUt",video_modal_add_button_wrapper:"P3PzB",video_modal_add_button_inline:"_2Z_Pe",video_modal_add_button_inMiddle:"_3TrUw",textInput_input:"_1cb7K",textInput_input_invalid:"_1P6p9",fileInput:"_1qYoT",fileInputLabel:"_30dNJ"},VIDEO_TYPE="wix-draft-plugin-video",VIDEO_TYPE_LEGACY="VIDEO-EMBED",videoButtonsTypes={video:"video",soundCloud:"soundCloud",youTube:"youTube"},mediaTypes=[videoButtonsTypes.soundCloud,videoButtonsTypes.youTube],VideoSelectionInputModal=function(_Component){function VideoSelectionInputModal(props){var _this;(_this=_Component.call(this,props)||this).onUrlChange=function(url){return _this.setState({url:url,showError:!1})},_this.onUrlVideoSelection=function(){var _helpers$onVideoSelec,_this$props=_this.props,componentData=_this$props.componentData,helpers=_this$props.helpers,_this$state$url=_this.state.url,src=(void 0===_this$state$url?"":_this$state$url).trim();if(isValidExactUrl(src)&&ReactPlayer.canPlay(src)){delete componentData.isCustomVideo;var data=_extends({},componentData,{tempData:!1,src:src});_this.onConfirm(data),null==helpers||null===(_helpers$onVideoSelec=helpers.onVideoSelected)||void 0===_helpers$onVideoSelec||_helpers$onVideoSelec.call(helpers,src,(function(metadata){return setTimeout((function(){return _this.updateComponentData(_extends({},data,{metadata:metadata}))}))}),0),_this.closeModal()}else _this.setState({showError:!0})},_this.onUrlInputDoubleClick=function(){_this.setState({url:"https://www.youtube.com/watch?v=vzKryaN44ss"})},_this.closeModal=function(){_this.setState({isOpen:!1}),_this.props.helpers.closeModal()},_this.handleKeyPress=function(e){e.charCode===KEYS_CHARCODE.ENTER&&_this.onUrlVideoSelection()},_this.getOnUploadFinished=function(isCustomVideo){return function(_ref){var data=_ref.data,error=_ref.error;_this.setComponentData(_extends({},data,{error:error,isCustomVideo:isCustomVideo}))}},_this.addVideoComponent=function(_ref2,isCustomVideo){var data=_ref2.data,error=_ref2.error;void 0===isCustomVideo&&(isCustomVideo=!1),handleUploadFinished(VIDEO_TYPE,_this.getComponentData,data,error,(function(_ref3){var data=_ref3.data,error=_ref3.error;return _this.onConfirm(_extends({},data,{error:error,isCustomVideo:isCustomVideo}))}))},_this.setComponentData=function(data){_this.props.pubsub.set("componentData",data,_this.blockKey)},_this.updateComponentData=function(data){_this.props.pubsub.update("componentData",data,_this.blockKey)},_this.onLocalLoad=function(_ref4){var src=_ref4.src,tempData=_ref4.tempData;_this.onConfirm(_extends({},_this.props.componentData,{src:src,isCustomVideo:!0,tempData:tempData}))},_this.getComponentData=function(){return _this.props.componentData},_this.handleNativeFileUpload=function(){handleUploadStart(_this.props,_this.getComponentData,_this.inputFile.files[0],_this.onLocalLoad,_this.getOnUploadFinished(!0)),_this.closeModal()},_this.styles=mergeStyles({styles:styles$3,theme:props.theme});var _componentData=_this.props.componentData;_this.state={url:!_componentData.isCustomVideo&&_componentData.src||""},_this.id="VideoUploadModal_FileInput_"+Math.floor(9999*Math.random());var onConfirm=props.onConfirm,onReplace=props.onReplace;return _this.blockKey=_this.getFocusedBlockKey(),_this.onConfirm=function(obj){if(onConfirm){var newBlock=onConfirm(obj).newBlock;_this.blockKey=newBlock.key}else onReplace(obj,_this.blockKey)},_this}_inheritsLoose(VideoSelectionInputModal,_Component);var _proto=VideoSelectionInputModal.prototype;return _proto.getFocusedBlockKey=function(){return this.props.pubsub.get("focusedBlock")},_proto.componentDidMount=function(){this.input.focus(),this.input.setSelectionRange(0,this.input.value.length)},_proto.render=function(){var _this2=this,_this$state=this.state,url=_this$state.url,showError=_this$state.showError,_this$props2=this.props,t=_this$props2.t,handleFileSelection=_this$props2.handleFileSelection,handleFileUpload=_this$props2.handleFileUpload,enableCustomUploadOnMobile=_this$props2.enableCustomUploadOnMobile,isMobile=_this$props2.isMobile,languageDir=_this$props2.languageDir;_this$props2.componentData;var handleClick,theme=_this$props2.theme,styles=this.styles,hasCustomFileUpload=handleFileUpload||handleFileSelection;handleFileSelection&&(handleClick=function(evt){return evt.preventDefault(),handleFileSelection((function(_ref5){var data=_ref5.data,error=_ref5.error;_this2.addVideoComponent({data:data,error:error},!0),_this2.closeModal()}))});var uploadVideoSection=React.createElement("div",null,React.createElement("div",{className:styles.video_modal_or_upload_video_from},t("VideoUploadModal_CustomVideoHeader")),React.createElement("div",{className:styles.video_modal_upload_video},React.createElement("input",{id:this.id,type:"file",accept:"video/*",className:styles.fileInput,ref:function(node){return _this2.inputFile=node},onClick:handleClick,onChange:this.handleNativeFileUpload}),React.createElement("label",{htmlFor:this.id,className:styles.fileInputLabel,role:"button","data-hook":"videoUploadModalCustomVideo",tabIndex:0},"+ ",t("VideoUploadModal_CustomVideoClickText"))));return React.createElement("div",{dir:languageDir},React.createElement("div",{className:styles["video_modal_container_"+(hasCustomFileUpload?"big":"small")],"data-hook":"videoUploadModal"},React.createElement(CloseIcon,{className:styles.video_modal_closeIcon,onClick:function(){return _this2.closeModal()}}),React.createElement("h2",{className:styles.video_modal_add_a_Video},t("VideoUploadModal_Title")),React.createElement("div",{role:"heading","aria-level":3,"aria-labelledby":"video_modal_hdr",className:styles.video_modal_header},React.createElement("h3",{id:"video_modal_hdr",className:styles.video_modal_header_text},t("VideoUploadModal_Header"))),React.createElement("div",{className:styles.video_modal_input_button_wrapper},React.createElement("div",{className:styles["video_modal_textInput_"+(hasCustomFileUpload?"customWidth":"fullWidth")]},React.createElement(TextInput,{inputRef:function(ref){_this2.input=ref},type:"url",onKeyPress:this.handleKeyPress,onChange:this.onUrlChange,onDoubleClick:this.onUrlInputDoubleClick,value:url,error:showError?t("VideoUploadModal_Input_InvalidUrl"):null,placeholder:t("VideoUploadModal_Input_Placeholder"),theme:styles,"data-hook":"videoUploadModalInput"})),React.createElement("div",{className:styles.video_modal_add_button_wrapper},React.createElement(Button,{disabled:!this.state.url,theme:_extends({},styles,theme),dataHook:"videoUploadModalAddButton",onClick:this.onUrlVideoSelection,text:t("VideoUploadModal_AddButtonText"),size:isMobile?BUTTON_SIZE.medium:BUTTON_SIZE.small}))),(!isMobile||enableCustomUploadOnMobile)&&hasCustomFileUpload&&uploadVideoSection))},VideoSelectionInputModal}(Component),Styles={separator:"_3hKgB",videoSettingsTitle:"_31P16",videoSettings_toggleContainer:"_3RIrx",videoSettings_mobile:"_13GtL"},Modals={VIDEO_SELECTION_INPUT:"video-selection-input",VIDEO_SETTINGS:"video-settings"},ModalsMap=((_ModalsMap={})[Modals.VIDEO_SELECTION_INPUT]=VideoSelectionInputModal,_ModalsMap[Modals.VIDEO_SETTINGS]=function(_ref){var _componentData$config,_componentData$config2,_classNames,componentData=_ref.componentData,helpers=_ref.helpers,pubsub=_ref.pubsub,theme=_ref.theme,t=_ref.t,isMobile=_ref.isMobile,settings=_ref.settings,disableDownload=void 0!==componentData.disableDownload?componentData.disableDownload:!!settings.disableDownload,isSpoilered=null===(_componentData$config=componentData.config)||void 0===_componentData$config||null===(_componentData$config2=_componentData$config.spoiler)||void 0===_componentData$config2?void 0:_componentData$config2.enabled,_useState=useState(!disableDownload),isDownloadEnabled=_useState[0],setIsDownloadEnabled=_useState[1],_useState2=useState(isSpoilered),isSpoilerEnabled=_useState2[0],setIsSpoilerEnabled=_useState2[1],styles=mergeStyles({styles:Styles,theme:theme}),closeModal=function(){var _helpers$closeModal;return null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal?void 0:_helpers$closeModal.call(helpers)},getSpoilerConfig=function(enabled){return{config:_extends({},componentData.config,{spoiler:{enabled:enabled}})}},onDoneClick=function(){var newComponentData=_extends({},componentData,{disableDownload:!isDownloadEnabled},getSpoilerConfig(isSpoilerEnabled));pubsub.update("componentData",newComponentData),closeModal()},isCustomVideo=!!componentData.isCustomVideo,spoilerToggle={toggleKey:"isSpoilerEnabled",labelKey:"VideoSettings_Spoiler_Toggle",dataHook:"videoSpoilerToggle",tooltipText:"Spoiler_Toggle_Tooltip",checked:isSpoilerEnabled,onToggle:function(){var value=!isSpoilerEnabled;setIsSpoilerEnabled(value),pubsub.update("componentData",_extends({},componentData,getSpoilerConfig(value)))}},toggleData=isCustomVideo?[{toggleKey:"isDownloadEnabled",labelKey:"VideoPlugin_Settings_VideoCanBeDownloaded_Label",dataHook:"videoDownloadToggle",tooltipText:"VideoPlugin_Settings_VideoCanBeDownloaded_Tooltip",checked:isDownloadEnabled,onToggle:function(){return setIsDownloadEnabled(!isDownloadEnabled)}}]:[];return settings.spoiler&&toggleData.push(spoilerToggle),React.createElement("div",{"data-hook":"settings",className:classNames(styles.videoSettings,(_classNames={},_classNames[styles.videoSettings_mobile]=isMobile,_classNames))},isMobile?React.createElement(SettingsMobileHeader,{t:t,theme:theme,onCancel:closeModal,onSave:onDoneClick}):React.createElement(React.Fragment,null,React.createElement("div",{className:styles.videoSettingsTitle},t("VideoPlugin_Settings_Header")),React.createElement("div",{className:styles.separator})),React.createElement(SettingsSection,{theme:theme,className:classNames(styles.videoSettings_toggleContainer)},toggleData.map((function(_ref2){var toggleKey=_ref2.toggleKey,labelKey=_ref2.labelKey,tooltipText=_ref2.tooltipText,dataHook=_ref2.dataHook,onToggle=_ref2.onToggle,checked=_ref2.checked;return React.createElement(LabeledToggle,{key:toggleKey,theme:theme,checked:checked,label:t(labelKey),onChange:onToggle,tooltipText:t(tooltipText),dataHook:dataHook})}))),!isMobile&&React.createElement(SettingsPanelFooter,{fixed:!0,theme:theme,cancel:closeModal,save:onDoneClick,t:t}))},_ModalsMap),MediaURLInputModal$1=function(_Component){function MediaURLInputModal(props){var _this;(_this=_Component.call(this,props)||this).onConfirm=function(){var url=_this.state.url;if(url&&ReactPlayer.canPlay(url)){var _helpers$closeModal,_this$props=_this.props,_componentData=_this$props.componentData,helpers=_this$props.helpers,pubsub=_this$props.pubsub,onConfirm=_this$props.onConfirm;onConfirm?onConfirm(_extends({},_componentData,{src:url})):pubsub.update("componentData",{src:url}),helpers&&helpers.onVideoSelected&&helpers.onVideoSelected(url,(function(data){return pubsub.update("componentData",{metadata:_extends({},data)})})),null===(_helpers$closeModal=helpers.closeModal)||void 0===_helpers$closeModal||_helpers$closeModal.call(helpers)}else _this.setState({submittedInvalidUrl:!0})},_this.getRenderData=function(){var _this$props2=_this.props,t=_this$props2.t,isMobile=_this$props2.isMobile,type=_this$props2.componentData.type,isYouTube=type===videoButtonsTypes.youTube,isSoundCloud=type===videoButtonsTypes.soundCloud;return{title:isYouTube?"EmbedURL_Social_YouTube_Title":isSoundCloud&&(isMobile?"SoundCloudUploadModal_Header_Mobile":"SoundCloudUploadModal_Header"),placeholder:isYouTube?t("EmbedURL_Social_YouTube_Placeholder"):isSoundCloud&&t("SoundCloudUploadModal_Input_Placeholder"),dataHook:isYouTube?"socialEmbedUploadModal":isSoundCloud?"soundCloudUploadModal":""}};var componentData=_this.props.componentData;return _this.state={url:componentData.src||"",submittedInvalidUrl:!1},_this}return _inheritsLoose(MediaURLInputModal,_Component),MediaURLInputModal.prototype.render=function(){var _this2=this,_this$state=this.state,url=_this$state.url,submittedInvalidUrl=_this$state.submittedInvalidUrl,_this$props3=this.props,t=_this$props3.t,languageDir=_this$props3.languageDir,helpers=_this$props3.helpers,_this$getRenderData=this.getRenderData(),title=_this$getRenderData.title,placeholder=_this$getRenderData.placeholder,dataHook=_this$getRenderData.dataHook;return React.createElement(UrlInputModal,{onConfirm:this.onConfirm,input:url,t:t,languageDir:languageDir,title:t(""+title),submittedInvalidUrl:submittedInvalidUrl,dataHook:dataHook,onInputChange:function(url){return _this2.setState({url:url})},errorMessage:t("SoundCloudUploadModal_Input_InvalidUrl"),placeholder:placeholder,onCloseRequested:helpers.closeModal,buttonSize:BUTTON_SIZE.medium})},MediaURLInputModal}(Component),VideoUploadModal=function(_Component){function VideoUploadModal(props){var _this;(_this=_Component.call(this,props)||this).closeModal=function(){_this.setState({isOpen:!1}),_this.props.helpers.closeModal()},_this.getOnUploadFinished=function(isCustomVideo){return function(_ref){var data=_ref.data,error=_ref.error;_this.setComponentData(_extends({},data,{error:error,isCustomVideo:isCustomVideo}))}},_this.addVideoComponent=function(_ref2,isCustomVideo){var data=_ref2.data,error=_ref2.error;void 0===isCustomVideo&&(isCustomVideo=!1),handleUploadFinished(VIDEO_TYPE,_this.getComponentData,data,error,(function(_ref3){var data=_ref3.data,error=_ref3.error;return _this.onConfirm(_extends({},data,{error:error,isCustomVideo:isCustomVideo}))}))},_this.setComponentData=function(data){_this.props.pubsub.set("componentData",data,_this.blockKey)},_this.onLocalLoad=function(_ref4){var src=_ref4.src,tempData=_ref4.tempData;_this.onConfirm(_extends({},_this.props.componentData,{src:src,isCustomVideo:!0,tempData:tempData}))},_this.setInputFile=function(ref){return _this.inputFile=ref},_this.getComponentData=function(){return _this.props.componentData},_this.handleNativeFileUpload=function(){handleUploadStart(_this.props,_this.getComponentData,_this.inputFile.files[0],_this.onLocalLoad,_this.getOnUploadFinished(!0)),_this.closeModal()};var componentData=_this.props.componentData;_this.state={url:!componentData.isCustomVideo&&componentData.src||""},_this.id="VideoUploadModal_FileInput_"+Math.floor(9999*Math.random());var onConfirm=props.onConfirm,onReplace=props.onReplace;return _this.onConfirm=function(obj){if(onConfirm){var newBlock=onConfirm(obj).newBlock;_this.blockKey=newBlock.key}else onReplace(obj,_this.blockKey)},_this}return _inheritsLoose(VideoUploadModal,_Component),VideoUploadModal.prototype.render=function(){var handleClick,_this2=this,_this$props=this.props,t=_this$props.t,handleFileSelection=_this$props.handleFileSelection,handleFileUpload=_this$props.handleFileUpload,enableCustomUploadOnMobile=_this$props.enableCustomUploadOnMobile,isMobile=_this$props.isMobile,languageDir=_this$props.languageDir,showUploadSection=(!isMobile||enableCustomUploadOnMobile)&&(handleFileUpload||handleFileSelection);return handleFileSelection&&(handleClick=function(evt){return evt.preventDefault(),handleFileSelection((function(_ref5){var data=_ref5.data,error=_ref5.error;_this2.addVideoComponent({data:data,error:error},!0),_this2.closeModal()}))}),React.createElement(MediaUploadModal,{id:this.id,isMobile:isMobile,inputFileRef:this.setInputFile,handleClick:handleClick,handleNativeFileUpload:this.handleNativeFileUpload,languageDir:languageDir,title:t("VideoCustomUploadModal_Title"),labelText:t("VideoUploadModal_CustomVideoClickText"),dataHook:"videoUploadModalCustomVideo",showUploadSection:showUploadSection,accept:"video/*"})},VideoUploadModal}(Component),MediaURLInputModal=function(_ref){var t=_ref.t,languageDir=_ref.languageDir,helpers=_ref.helpers,isMobile=_ref.isMobile,url=_ref.url,submittedInvalidUrl=_ref.submittedInvalidUrl,setUrl=_ref.setUrl,_ref$withMobileHeader=_ref.withMobileHeader,withMobileHeader=void 0!==_ref$withMobileHeader&&_ref$withMobileHeader,onConfirm=_ref.onConfirm,dataHook=_ref.dataHook,title=_ref.title,subTitle=_ref.subTitle,saveLabel=_ref.saveLabel,onDblClick=_ref.onDblClick;return React.createElement(NewUrlInputModal,{onConfirm:onConfirm,helpers:helpers,input:url,t:t,languageDir:languageDir,title:title,subTitle:subTitle,submittedInvalidUrl:submittedInvalidUrl,dataHook:dataHook,saveLabel:saveLabel,onInputChange:function(url){return setUrl(url)},errorMessage:t("SoundCloudUploadModal_Input_InvalidUrl"),placeholder:t("EmbedURL_Placeholder"),onCloseRequested:helpers.closeModal,buttonSize:BUTTON_SIZE.medium,isMobile:isMobile,withMobileHeader:withMobileHeader,onDblClick:onDblClick})},styles$2={video_modal_container:"_3jdGM",video_modal_content:"GIPKX",video_modal_tab:"_3Dnt_",video_upload_tab:"_1wXO_",fileInput:"_1W3aw",video_modal_add_button_inline:"_33b75",fileInputLabel:"_6ZyY2"},VideoModal$1=function(props){var _props$componentData=props.componentData,isCustomVideo=_props$componentData.isCustomVideo,src=_props$componentData.src,type=_props$componentData.type,closeModal=props.helpers.closeModal,t=props.t,theme=props.theme,isMobile=props.isMobile,videoTabs={embed:t("VideoModal_Tabs_Embed"),upload:t("VideoModal_Tabs_Upload")},initialUrl=isCustomVideo?"":src||"",_useState=useState(isCustomVideo?videoTabs.upload:videoTabs.embed),activeTab=_useState[0],setActiveTab=_useState[1],_useState2=useState(initialUrl),url=_useState2[0],setUrl=_useState2[1],_useState3=useState(!1),submittedInvalidUrl=_useState3[0],setSubmittedInvalidUrl=_useState3[1],isSoundCloud=type===videoButtonsTypes.soundCloud,onUrlInputDoubleClick=function(){return setUrl("https://www.youtube.com/watch?v=vzKryaN44ss")},onConfirm=function(){if(url&&ReactPlayer.canPlay(url)){var componentData=props.componentData,helpers=props.helpers,pubsub=props.pubsub,_onConfirm=props.onConfirm;_onConfirm?_onConfirm(_extends({},componentData,{src:url,isCustomVideo:!1})):pubsub.update("componentData",{src:url,isCustomVideo:!1}),helpers&&helpers.onVideoSelected&&helpers.onVideoSelected(url,(function(data){return pubsub.update("componentData",{metadata:_extends({},data)})})),null==closeModal||closeModal()}else setSubmittedInvalidUrl(!0)},dataHook=isSoundCloud?"soundCloudUploadModal":"videoMediaUrlModal",title=isSoundCloud?t(isMobile?"SoundCloudUploadModal_Header_Mobile":"SoundCloudUploadModal_Header"):null,renderMediaUrlInputModal=function(){return React.createElement(MediaURLInputModal,Object.assign({},props,{onConfirm:onConfirm,url:url,setUrl:setUrl,submittedInvalidUrl:submittedInvalidUrl,withMobileHeader:isSoundCloud,dataHook:dataHook,title:isSoundCloud&&title,saveLabel:t(isSoundCloud?"Embed_Add_Button_Label":"VideoModal_Embed_ButtonText"),subTitle:!isSoundCloud&&t("VideoModal_Embed_Title"),onDblClick:onUrlInputDoubleClick}))};return isSoundCloud?renderMediaUrlInputModal():React.createElement("div",{className:styles$2.video_modal_container},React.createElement("div",{className:styles$2.video_modal_content},isMobile&&React.createElement(SettingsMobileHeader,{theme:theme,onSave:onConfirm,onCancel:function(){return closeModal()},t:t,title:t("VideoModal_MobileHeader")}),React.createElement(Tabs,{value:activeTab,onTabSelected:function(tab){return setActiveTab(tab)},className:styles$2.video_modal_tabs_header,theme:theme},React.createElement(Tab,{label:videoTabs.embed,value:videoTabs.embed,theme:theme},React.createElement("div",{className:styles$2.video_modal_tab},renderMediaUrlInputModal())),React.createElement(Tab,{label:videoTabs.upload,value:videoTabs.upload,theme:theme},React.createElement("div",{className:classNames(styles$2.video_modal_tab,styles$2.video_upload_tab)},React.createElement(VideoUploadModal,Object.assign({},props)))))))},VideoModal=function(props){var _experiments$newVideo,type=props.componentData.type,experiments=props.experiments,useNewModal=null==experiments||null===(_experiments$newVideo=experiments.newVideoModal)||void 0===_experiments$newVideo?void 0:_experiments$newVideo.enabled,oldVideoModal=mediaTypes.includes(type)?MediaURLInputModal$1:VideoSelectionInputModal,Component=useNewModal?VideoModal$1:oldVideoModal;return React.createElement(Component,props)},SelectionModalCustomStyle={content:{maxWidth:"580px",minHeight:"260px"}},ExtendedSelectionModalCustomStyle={content:{maxWidth:"580px",minHeight:"378px"}},modalContentStyles={width:363,padding:20,boxSizing:"border-box",border:"solid 1px rgba(51, 51, 51, 0.1)",boxShadow:"0 0 10px 0 rgba(0, 0, 0, 0.06)"},videoModalContentStyles=_extends({height:232},modalContentStyles),embedModalContentStyles=_extends({height:180},modalContentStyles),createInlineButtons=function(_ref){var _settings$toolbar,_settings$toolbar$ico,t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,_ref$experiments=_ref.experiments,experiments=void 0===_ref$experiments?{}:_ref$experiments,spoilerInInlineToolbar=experiments.spoilerInInlineToolbar,newVideoModal=experiments.newVideoModal,useNewModal=null==newVideoModal?void 0:newVideoModal.enabled,icon=(null==settings||null===(_settings$toolbar=settings.toolbar)||void 0===_settings$toolbar||null===(_settings$toolbar$ico=_settings$toolbar.icons)||void 0===_settings$toolbar$ico?void 0:_settings$toolbar$ico.replace)||MediaReplaceIcon,defaultCustomStyles=isMobile&&!settings.enableCustomUploadOnMobile||!settings.handleFileSelection&&!settings.handleFileUpload?SelectionModalCustomStyle:ExtendedSelectionModalCustomStyle,newModalCustomStyles=isMobile?MOBILE_FULL_SCREEN_CUSTOM_STYLE:_extends({},DesktopFlyOutModalStyles,{content:videoModalContentStyles}),customStyles=useNewModal?newModalCustomStyles:defaultCustomStyles,spoilerButton=settings.spoiler&&null!=spoilerInInlineToolbar&&spoilerInInlineToolbar.enabled?[{keyName:"spoiler",type:BUTTONS.SPOILER,mobile:!0}]:[],settingsButton=null!=spoilerInInlineToolbar&&spoilerInInlineToolbar.enabled?[]:[{keyName:"settings",type:BUTTONS.VIDEO_SETTINGS,fullHeight:!0,icon:PluginSettingsIcon,modalName:Modals.VIDEO_SETTINGS,modalStyles:getModalStyles({isMobile:isMobile}),t:t,mobile:!0,tooltipTextKey:"SettingsButton_Tooltip",settings:settings,triggerSettingsBi:!0,pluginId:VIDEO_TYPE}];return[{keyName:"sizeSmallCenter",type:BUTTONS.SIZE_SMALL_CENTER,mobile:!1},{keyName:"sizeContent",type:BUTTONS.SIZE_CONTENT,mobile:!1},{keyName:"sizeFullWidth",type:BUTTONS.SIZE_FULL_WIDTH,mobile:!1},{keyName:"separator1",type:BUTTONS.SEPARATOR,mobile:!1},{keyName:"sizeSmallLeft",type:BUTTONS.SIZE_SMALL_LEFT,mobile:!1},{keyName:"sizeSimallRight",type:BUTTONS.SIZE_SMALL_RIGHT,mobile:!1},{keyName:"separator2",type:BUTTONS.SEPARATOR,mobile:!1}].concat(spoilerButton,[{keyName:"replace",type:BUTTONS.EXTERNAL_MODAL,icon:icon,modalElement:decorateComponentWithProps(VideoModal,_extends({},settings)),modalStylesFn:function(_ref2){var buttonRef=_ref2.buttonRef,modalStyles=getModalStyles({customStyles:customStyles,fullScreen:!0,isMobile:isMobile}),_buttonRef$getBoundin=buttonRef.getBoundingClientRect(),top=_buttonRef$getBoundin.top,modalLeft=_buttonRef$getBoundin.left-15,modalTop=top>250?top-250:top+38;return _extends({},modalStyles,{content:_extends({},modalStyles.content,{top:modalTop,left:modalLeft,margin:0,position:"absolute"})})},modalStyles:isMobile?getModalStyles({customStyles:MOBILE_FULL_SCREEN_CUSTOM_STYLE,fullScreen:!0,isMobile:isMobile}):void 0,mobile:!0,tooltipTextKey:"ReplaceVideoButton_Tooltip",t:t}],settingsButton,[{keyName:"delete",type:BUTTONS.DELETE,mobile:!0}])},ReactPlayerWrapper=function(_Component){function ReactPlayerWrapper(props){var _this;return(_this=_Component.call(this,props)||this).isVimeoAndRequireJS=function(){return!isSSR()&&(url=_this.props.url,MATCH_URL=/vimeo\.com\/.+/,!/vimeo\.com\/external\/[0-9]+\..+/.test(url)&&MATCH_URL.test(url))&&!window.Vimeo&&window.requirejs;var url,MATCH_URL},_this.state={vimeoLoaded:!1,isPlaying:!1},_this}_inheritsLoose(ReactPlayerWrapper,_Component);var _proto=ReactPlayerWrapper.prototype;return _proto.componentDidMount=function(){var _this2=this;this.isVimeoAndRequireJS()&&window.require(["https://player.vimeo.com/api/player.js"],(function(player){window.Vimeo={Player:player},_this2.setState({vimeoLoaded:!0})}))},_proto.render=function(){var _this3=this;if(!this.state.vimeoLoaded&&this.isVimeoAndRequireJS())return null;var _this$props=this.props,isPlayable=_this$props.isPlayable,styles=_this$props.styles,disabled=_this$props.disabled;return React.createElement(ReactPlayer,_extends({playing:this.state.isPlaying&&!disabled,onPlay:function(){return _this3.setState({isPlaying:!0})},onPause:function(){return _this3.setState({isPlaying:!1})},style:styles},this.props,{light:!isPlayable}))},ReactPlayerWrapper}(Component);ReactPlayerWrapper.defaultProps={isPlayable:!0};var getVideoSrc=function(src,settings){if(void 0===settings&&(settings={}),"object"==typeof src){if(settings&&settings.getVideoUrl)return settings.getVideoUrl(src);console.error("must set getVideoUrl in plugin config when using custom video source!",src)}return src},styles$1={video_player:"NjOn2",videoOverlay:"_3xYKn",video_container:"oUYOK"},VideoViewer=function(_Component){function VideoViewer(props){var _this;(_this=_Component.call(this,props)||this).setUrl=function(newUrl){var _this$props$onReload,_this$props,url=_this.normalizeUrl(newUrl);url!==_this.state.url&&(_this.setState({url:url}),null===(_this$props$onReload=(_this$props=_this.props).onReload)||void 0===_this$props$onReload||_this$props$onReload.call(_this$props))},_this.normalizeUrl=function(url){return 0===url.toLowerCase().indexOf("vimeo")?"https://"+url:url},_this.findFormalVideoRatio=function(ratio){var target,baseRatios=[1,5/4,4/3,1.5,1.6,16/9,1.85,2,2.35,2.39,3],videoRatios=[].concat(baseRatios,baseRatios.map((function(x){return 1/x}))),closest=(target=ratio,videoRatios.reduce((function(prev,curr){return Math.abs(curr-target)<Math.abs(prev-target)?curr:prev})));return Math.abs(closest-ratio)>.01?ratio:closest},_this.getVideoRatio=function(wrapper){var element=wrapper.querySelector("iframe, video");return _this.findFormalVideoRatio(element.clientHeight/element.clientWidth)},_this.onReactPlayerReady=function(){var _this$props$onReady,_this$props2,wrapper=ReactDOM.findDOMNode(_assertThisInitialized(_this)).parentNode,ratio=_this.getVideoRatio(wrapper);(wrapper.style["padding-bottom"]=100*ratio+"%",_this.props.isLoaded)||((null===(_this$props$onReady=(_this$props2=_this.props).onReady)||void 0===_this$props$onReady?void 0:_this$props$onReady.call(_this$props2))||_this.setState({isLoaded:!0}))},_this.handleContextMenu=function(e){return _this.props.componentData.disableDownload&&e.preventDefault()},_this.disableDownloadProps=function(){var _this$props3=_this.props,componentData=_this$props3.componentData,settings=_this$props3.settings,disableProps={config:{file:{attributes:{controlsList:"nodownload"}}}},disable={};return void 0!==componentData.disableDownload?disable=componentData.disableDownload?disableProps:{}:void 0!==settings.disableDownload&&(disable=settings.disableDownload?disableProps:{}),disable},validate(props.componentData,pluginVideoSchema),_this.state={url:void 0,isLoaded:!1};var _url=getVideoSrc(props.componentData.src,props.settings);return"string"==typeof _url?_this.state={url:_this.normalizeUrl(_url)}:_url&&"function"==typeof _url.then&&_url.then((function(url){return _this.setState({url:_this.normalizeUrl(url)})})),_this}_inheritsLoose(VideoViewer,_Component);var _proto=VideoViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){var _this2=this;if(!isEqual(nextProps.componentData,this.props.componentData)&&(validate(nextProps.componentData,pluginVideoSchema),nextProps.componentData.src!==this.props.componentData.src)){var url=getVideoSrc(nextProps.componentData.src,nextProps.settings);"string"==typeof url?this.setUrl(url):url&&"function"==typeof url.then&&url.then((function(url){return _this2.setUrl(url)}))}},_proto.componentDidMount=function(){this.setState({key:"mounted"})},_proto.render=function(){var _this$props4=this.props,theme=_this$props4.theme,width=_this$props4.width,height=_this$props4.height,disabled=_this$props4.disabled,setComponentUrl=_this$props4.setComponentUrl;this.styles=this.styles||mergeStyles({styles:styles$1,theme:theme});var _this$state=this.state,url=_this$state.url,key=_this$state.key;null==setComponentUrl||setComponentUrl(url);var props=_extends({url:url,onReady:this.onReactPlayerReady,disabled:disabled,width:width,height:height,key:key},this.disableDownloadProps()),isLoaded=this.props.isLoaded||this.state.isLoaded;return React.createElement(React.Fragment,null,React.createElement(ReactPlayerWrapper,_extends({className:classNames(this.styles.video_player),onContextMenu:this.handleContextMenu,"data-loaded":isLoaded,controls:!1!==this.props.isLoaded},props)))},VideoViewer}(Component);VideoViewer.defaultProps={width:"100%",height:"100%"};var styles={video_player:"_38XzK",videoOverlay:"_2L5av",video_container:"Q31CM",video_overlay:"_37MeN",error:"_3zYcu"},DEFAULTS$1=Object.freeze({config:{size:"content",alignment:"center"}}),VideoComponent=function(_React$Component){function VideoComponent(props){var _this;(_this=_React$Component.call(this,props)||this).setPlayer=function(player){_this.player=player},_this.handleReady=function(){_this.state.isLoaded||_this.props.componentData.tempData||_this.setState({isLoaded:!0})},_this.renderOverlay=function(styles){return React.createElement("div",{className:classNames(styles.video_overlay)})},_this.renderLoader=function(){var isCustomVideo=get(_this.props,"componentData.isCustomVideo");return React.createElement("div",{className:_this.styles.videoOverlay},React.createElement(Loader,{type:"medium",isVerySlowFakeLoader:isCustomVideo}))},_this.onReload=function(){_this.setState({isLoaded:!1})},_this.renderPlayer=function(){var _this$props=_this.props,theme=_this$props.theme,componentData=_this$props.componentData,disabled=_this$props.disabled,settings=_this$props.settings,setComponentUrl=_this$props.setComponentUrl;return React.createElement(VideoViewer,{ref:_this.setPlayer,componentData:componentData,settings:settings,onReady:_this.handleReady,disabled:disabled,theme:theme,setComponentUrl:setComponentUrl,onReload:_this.onReload,isLoaded:_this.state.isLoaded})},_this.onKeyDown=function(e,handler){"Enter"!==e.key&&" "!==e.key||handler()};var isPlayable=!props.blockProps;return _this.state={isLoaded:!1,isPlayable:isPlayable},_this}_inheritsLoose(VideoComponent,_React$Component);var _proto=VideoComponent.prototype;return _proto.componentDidMount=function(){this.handlePlayerFocus()},_proto.componentDidUpdate=function(){this.handlePlayerFocus()},_proto.handlePlayerFocus=function(){var element=findDOMNode(this).querySelector("iframe, video");element&&(element.tabIndex=-1)},_proto.render=function(){var _this2=this;this.styles=this.styles||mergeStyles({styles:styles,theme:this.props.theme});var _this$props2=this.props,className=_this$props2.className,onClick=_this$props2.onClick,t=_this$props2.t,error=_this$props2.componentData.error,_this$state=this.state,isPlayable=_this$state.isPlayable,isLoaded=_this$state.isLoaded,containerClassNames=classNames(this.styles.video_container,className||"");return React.createElement("div",{"data-hook":"videoPlayer",onClick:onClick,className:containerClassNames,onKeyDown:function(e){return _this2.onKeyDown(e,onClick)},draggable:!0},!isPlayable&&this.renderOverlay(this.styles,this.props.t),this.renderPlayer(),!isLoaded&&!error&&this.renderLoader(),error&&React.createElement(MediaItemErrorMsg,{error:error,t:t}))},VideoComponent}(React.Component);VideoComponent.type={VIDEO_TYPE_LEGACY:"VIDEO-EMBED",VIDEO_TYPE:VIDEO_TYPE};var createInsertButtons=function(_ref){var _toolbar$icons,_buttonsMap,t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,disableDownload=_ref.disableDownload,_ref$experiments=_ref.experiments,experiments=void 0===_ref$experiments?{}:_ref$experiments,componentData=void 0!==disableDownload?_extends({},DEFAULTS$1,{disableDownload:disableDownload}):DEFAULTS$1,newVideoModal=experiments.newVideoModal,useNewModal=null==newVideoModal?void 0:newVideoModal.enabled,_ref2=settings||{},_ref2$exposeButtons=_ref2.exposeButtons,exposeButtons=void 0===_ref2$exposeButtons?[videoButtonsTypes.video]:_ref2$exposeButtons,toolbar=_ref2.toolbar,enableCustomUploadOnMobile=_ref2.enableCustomUploadOnMobile,handleFileSelection=_ref2.handleFileSelection,handleFileUpload=_ref2.handleFileUpload,icon=(null==toolbar||null===(_toolbar$icons=toolbar.icons)||void 0===_toolbar$icons?void 0:_toolbar$icons.InsertPluginButtonIcon)||InsertPluginIcon$1,videoModalCustomStyles=isMobile?MOBILE_FULL_SCREEN_CUSTOM_STYLE:_extends({},DesktopFlyOutModalStyles,{content:videoModalContentStyles}),embedModalCustomStyles=isMobile?MOBILE_FULL_SCREEN_CUSTOM_STYLE:_extends({},DesktopFlyOutModalStyles,{content:embedModalContentStyles}),modalsStyle=getModalStyles({customStyles:useNewModal?videoModalCustomStyles:isMobile&&!enableCustomUploadOnMobile||!handleFileSelection&&!handleFileUpload?SelectionModalCustomStyle:ExtendedSelectionModalCustomStyle,fullScreen:!!useNewModal,isMobile:isMobile}),modalStyles=useNewModal?isMobile?modalsStyle:void 0:modalsStyle,baseButtonProps={type:BUTTON_TYPES.MODAL,modalElement:decorateComponentWithProps(VideoModal,settings)},buttonsMap=((_buttonsMap={})[videoButtonsTypes.video]={name:INSERT_PLUGIN_BUTTONS.VIDEO,tooltip:t("VideoPlugin_InsertButton_Tooltip"),getIcon:function(){return icon},componentData:componentData},_buttonsMap[videoButtonsTypes.soundCloud]={name:INSERT_PLUGIN_BUTTONS.SOUND_CLOUD,tooltip:t("SoundCloudPlugin_InsertButton_Tooltip"),getIcon:function(){return InsertPluginIcon},componentData:_extends({},DEFAULTS$1,{type:videoButtonsTypes.soundCloud})},_buttonsMap[videoButtonsTypes.youTube]={name:INSERT_PLUGIN_BUTTONS.YOUTUBE,tooltip:t("EmbedURL_Social_YouTube_Title"),getIcon:function(){return YoutubeIcon},componentData:_extends({},DEFAULTS$1,{type:videoButtonsTypes.youTube}),section:"BlockToolbar_Section_Embed_Anywhere"},_buttonsMap),toolbars=useNewModal?[TOOLBARS.MOBILE,TOOLBARS.FOOTER,TOOLBARS.SIDE]:[TOOLBARS.INSERT_PLUGIN,TOOLBARS.MOBILE,TOOLBARS.FOOTER,TOOLBARS.SIDE],videoButtons=exposeButtons.map((function(buttonType){return _extends({},buttonsMap[buttonType],{toolbars:toolbars,modalStyles:modalStyles,modalStylesFn:useNewModal?function(_ref3){var buttonRef=_ref3.buttonRef,toolbarName=_ref3.toolbarName;return getBottomToolbarModalStyles(buttonRef,{customStyles:buttonType===videoButtonsTypes.soundCloud?embedModalCustomStyles:videoModalCustomStyles},toolbarName)}:void 0},baseButtonProps)}));if(useNewModal){var externalToolbarButtons=exposeButtons.map((function(buttonType){var styles=buttonType===videoButtonsTypes.soundCloud?DesktopFlyOutModalStyles:videoModalCustomStyles;return _extends({},buttonsMap[buttonType],{modalStyles:getModalStyles({customStyles:_extends({},styles,DesktopOverlayModalStyles),fullScreen:!1,isMobile:isMobile}),toolbars:[TOOLBARS.INSERT_PLUGIN]},baseButtonProps)}));videoButtons=[].concat(videoButtons,externalToolbarButtons)}return videoButtons},createToolbar=function(_ref){var t=_ref.t,settings=_ref.settings,isMobile=_ref.isMobile,disableDownload=_ref.disableDownload,experiments=_ref.experiments;return{InlineButtons:createInlineButtons({t:t,settings:settings,isMobile:isMobile,experiments:experiments}),InsertButtons:createInsertButtons({t:t,settings:settings,isMobile:isMobile,disableDownload:disableDownload,experiments:experiments}),name:"video"}};function _toPropertyKey(arg){var key=function(input,hint){if("object"!=typeof input||null===input)return input;var prim=input[Symbol.toPrimitive];if(void 0!==prim){var res=prim.call(input,hint||"default");if("object"!=typeof res)return res;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===hint?String:Number)(input)}(arg,"string");return"symbol"==typeof key?key:String(key)}var createVideoPlugin=function(config){var _config$uiSettings,_config$uiSettings2,helpers=config.helpers,t=config.t,_config$VIDEO_TYPE=config[VIDEO_TYPE],settings=void 0===_config$VIDEO_TYPE?{}:_config$VIDEO_TYPE,isMobile=config.isMobile,spoilerWrapper=config.spoilerWrapper,commonPubsub=config.commonPubsub,experiments=config.experiments,rest=_objectWithoutPropertiesLoose(config,["helpers","t",VIDEO_TYPE,"isMobile","spoilerWrapper","commonPubsub","experiments"].map(_toPropertyKey)),disableDownload=null==config||null===(_config$uiSettings=config.uiSettings)||void 0===_config$uiSettings?void 0:_config$uiSettings.disableDownload,defaultPluginData=void 0!==disableDownload?_extends({},DEFAULTS$1,{disableDownload:disableDownload}):DEFAULTS$1;return createBasePlugin(_extends({component:VideoComponent,type:VIDEO_TYPE,legacyType:"VIDEO-EMBED",toolbar:createToolbar({t:t,settings:_extends({},settings,{commonPubsub:commonPubsub,type:VIDEO_TYPE}),isMobile:isMobile,disableDownload:disableDownload,experiments:experiments}),helpers:helpers,settings:settings,t:t,isMobile:isMobile,disableRightClick:null==config||null===(_config$uiSettings2=config.uiSettings)||void 0===_config$uiSettings2?void 0:_config$uiSettings2.disableRightClick,defaultPluginData:defaultPluginData,spoilerWrapper:settings.spoiler&&spoilerWrapper,commonPubsub:commonPubsub},rest))};createVideoPlugin.functionName=VIDEO_TYPE;var DEFAULTS_config={toolbar:{hidden:[]}},createVideoData=function(pluginData,isRicosSchema){void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1);var videoData=isRicosSchema?convertNodeDataToDraft("VIDEO",pluginData):pluginData;return merge({},DEFAULTS$1,videoData)},Video=function(_ref){var context=_ref.context,componentData=_ref.componentData,theme=context.theme,t=context.t,_context$config=context.config,settings=(void 0===_context$config?{}:_context$config)[VIDEO_TYPE]||{};return React.createElement(VideoComponent,{componentData:componentData,theme:theme,t:t,settings:settings,blockProps:{setFocusToBlock:function(){return null}},setComponentUrl:function(){return null},onClick:function(){}})},videoDataDefaults={containerData:{alignment:"CENTER",width:{size:null,custom:null},spoiler:{enabled:null,description:null,buttonText:null},height:{custom:null},textWrap:null},video:{src:null,width:null,height:null},thumbnail:{src:null,width:null,height:null},disableDownload:null,title:null},name=TIPTAP_VIDEO_TYPE,pluginVideo=function(config){var defaultOptions,pluginConfig=_extends({},DEFAULTS_config,config);return{config:pluginConfig,type:VIDEO_TYPE,createPlugin:createVideoPlugin,ModalsMap:ModalsMap,createPluginData:createVideoData,configFixer:function(){return pluginConfig.uploadHandler=pluginConfig.handleFileUpload||pluginConfig.handleFileSelection},tiptapExtensions:(defaultOptions=pluginConfig,[{type:"node",Component:Video,componentDataDefaults:_extends({},videoDataDefaults,{id:"",loading:{default:!1}}),createExtensionConfig:function(){return{name:name,defaultOptions:defaultOptions,addCommands:function(){return{}}}}}])}};export{Modals,ModalsMap,VIDEO_TYPE,VIDEO_TYPE_LEGACY,VideoViewer,createVideoPlugin,pluginVideo,videoButtonsTypes};
//# sourceMappingURL=module.js.map

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("wix-rich-content-common");var _extends__default=_interopDefaultLegacy(_extends);Object.freeze(["#ffffff","#303030","#3a54b4","#bfad80","#bf695c","#f7f7f7"]);var userColors=[],DEFAULTS_configTextColor={editor:{onColorAdded:function(color){return userColors=[].concat(userColors,[color])},getUserColors:function(){return userColors}},viewer:{}},DEFAULTS_configTextHighlight={editor:{onColorAdded:function(color){return userColors=[].concat(userColors,[color])},getUserColors:function(){return userColors}},viewer:{}};exports.TEXT_COLOR_TYPE="wix-rich-content-text-color",exports.TEXT_HIGHLIGHT_TYPE="wix-rich-content-text-highlight",exports.pluginTextColor=function(config){return{config:_extends__default.default({},DEFAULTS_configTextColor.viewer,config),type:"wix-rich-content-text-color"}},exports.pluginTextHighlight=function(config){return{config:_extends__default.default({},DEFAULTS_configTextHighlight.viewer,config),type:"wix-rich-content-text-highlight"}};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _extends=require("@babel/runtime/helpers/extends"),_assertThisInitialized=require("@babel/runtime/helpers/assertThisInitialized"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react"),ReactDOM=require("react-dom"),ReactPlayer=require("react-player"),wixRichContentCommon=require("wix-rich-content-common"),classNames=require("classnames"),pluginVideoSchema=require("wix-rich-content-common/dist/statics/schemas/plugin-video.schema.json"),lodash=require("lodash");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var _extends__default=_interopDefaultLegacy(_extends),_assertThisInitialized__default=_interopDefaultLegacy(_assertThisInitialized),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),ReactDOM__default=_interopDefaultLegacy(ReactDOM),ReactPlayer__default=_interopDefaultLegacy(ReactPlayer),classNames__default=_interopDefaultLegacy(classNames),pluginVideoSchema__default=_interopDefaultLegacy(pluginVideoSchema),VIDEO_TYPE="wix-draft-plugin-video",DEFAULTS_configViewer={getVideoUrl:function(src){return"https://video.wixstatic.com/"+src.pathname}},ReactPlayerWrapper=function(_Component){function ReactPlayerWrapper(props){var _this;return(_this=_Component.call(this,props)||this).isVimeoAndRequireJS=function(){return!wixRichContentCommon.isSSR()&&(url=_this.props.url,MATCH_URL=/vimeo\.com\/.+/,!/vimeo\.com\/external\/[0-9]+\..+/.test(url)&&MATCH_URL.test(url))&&!window.Vimeo&&window.requirejs;var url,MATCH_URL},_this.state={vimeoLoaded:!1,isPlaying:!1},_this}_inheritsLoose__default.default(ReactPlayerWrapper,_Component);var _proto=ReactPlayerWrapper.prototype;return _proto.componentDidMount=function(){var _this2=this;this.isVimeoAndRequireJS()&&window.require(["https://player.vimeo.com/api/player.js"],(function(player){window.Vimeo={Player:player},_this2.setState({vimeoLoaded:!0})}))},_proto.render=function(){var _this3=this;if(!this.state.vimeoLoaded&&this.isVimeoAndRequireJS())return null;var _this$props=this.props,isPlayable=_this$props.isPlayable,styles=_this$props.styles,disabled=_this$props.disabled;return React__default.default.createElement(ReactPlayer__default.default,_extends__default.default({playing:this.state.isPlaying&&!disabled,onPlay:function(){return _this3.setState({isPlaying:!0})},onPause:function(){return _this3.setState({isPlaying:!1})},style:styles},this.props,{light:!isPlayable}))},ReactPlayerWrapper}(React.Component);ReactPlayerWrapper.defaultProps={isPlayable:!0};var getVideoSrc=function(src,settings){if(void 0===settings&&(settings={}),"object"==typeof src){if(settings&&settings.getVideoUrl)return settings.getVideoUrl(src);console.error("must set getVideoUrl in plugin config when using custom video source!",src)}return src},styles={video_player:"NjOn2",videoOverlay:"_3xYKn",video_container:"oUYOK"},VideoViewer=function(_Component){function VideoViewer(props){var _this;(_this=_Component.call(this,props)||this).setUrl=function(newUrl){var _this$props$onReload,_this$props,url=_this.normalizeUrl(newUrl);url!==_this.state.url&&(_this.setState({url:url}),null===(_this$props$onReload=(_this$props=_this.props).onReload)||void 0===_this$props$onReload||_this$props$onReload.call(_this$props))},_this.normalizeUrl=function(url){return 0===url.toLowerCase().indexOf("vimeo")?"https://"+url:url},_this.findFormalVideoRatio=function(ratio){var target,baseRatios=[1,5/4,4/3,1.5,1.6,16/9,1.85,2,2.35,2.39,3],videoRatios=[].concat(baseRatios,baseRatios.map((function(x){return 1/x}))),closest=(target=ratio,videoRatios.reduce((function(prev,curr){return Math.abs(curr-target)<Math.abs(prev-target)?curr:prev})));return Math.abs(closest-ratio)>.01?ratio:closest},_this.getVideoRatio=function(wrapper){var element=wrapper.querySelector("iframe, video");return _this.findFormalVideoRatio(element.clientHeight/element.clientWidth)},_this.onReactPlayerReady=function(){var _this$props$onReady,_this$props2,wrapper=ReactDOM__default.default.findDOMNode(_assertThisInitialized__default.default(_this)).parentNode,ratio=_this.getVideoRatio(wrapper);(wrapper.style["padding-bottom"]=100*ratio+"%",_this.props.isLoaded)||((null===(_this$props$onReady=(_this$props2=_this.props).onReady)||void 0===_this$props$onReady?void 0:_this$props$onReady.call(_this$props2))||_this.setState({isLoaded:!0}))},_this.handleContextMenu=function(e){return _this.props.componentData.disableDownload&&e.preventDefault()},_this.disableDownloadProps=function(){var _this$props3=_this.props,componentData=_this$props3.componentData,settings=_this$props3.settings,disableProps={config:{file:{attributes:{controlsList:"nodownload"}}}},disable={};return void 0!==componentData.disableDownload?disable=componentData.disableDownload?disableProps:{}:void 0!==settings.disableDownload&&(disable=settings.disableDownload?disableProps:{}),disable},wixRichContentCommon.validate(props.componentData,pluginVideoSchema__default.default),_this.state={url:void 0,isLoaded:!1};var _url=getVideoSrc(props.componentData.src,props.settings);return"string"==typeof _url?_this.state={url:_this.normalizeUrl(_url)}:_url&&"function"==typeof _url.then&&_url.then((function(url){return _this.setState({url:_this.normalizeUrl(url)})})),_this}_inheritsLoose__default.default(VideoViewer,_Component);var _proto=VideoViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){var _this2=this;if(!lodash.isEqual(nextProps.componentData,this.props.componentData)&&(wixRichContentCommon.validate(nextProps.componentData,pluginVideoSchema__default.default),nextProps.componentData.src!==this.props.componentData.src)){var url=getVideoSrc(nextProps.componentData.src,nextProps.settings);"string"==typeof url?this.setUrl(url):url&&"function"==typeof url.then&&url.then((function(url){return _this2.setUrl(url)}))}},_proto.componentDidMount=function(){this.setState({key:"mounted"})},_proto.render=function(){var _this$props4=this.props,theme=_this$props4.theme,width=_this$props4.width,height=_this$props4.height,disabled=_this$props4.disabled,setComponentUrl=_this$props4.setComponentUrl;this.styles=this.styles||wixRichContentCommon.mergeStyles({styles:styles,theme:theme});var _this$state=this.state,url=_this$state.url,key=_this$state.key;null==setComponentUrl||setComponentUrl(url);var props=_extends__default.default({url:url,onReady:this.onReactPlayerReady,disabled:disabled,width:width,height:height,key:key},this.disableDownloadProps()),isLoaded=this.props.isLoaded||this.state.isLoaded;return React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(ReactPlayerWrapper,_extends__default.default({className:classNames__default.default(this.styles.video_player),onContextMenu:this.handleContextMenu,"data-loaded":isLoaded,controls:!1!==this.props.isLoaded},props)))},VideoViewer}(React.Component);VideoViewer.defaultProps={width:"100%",height:"100%"};var containerClassName=function(theme){return wixRichContentCommon.mergeStyles({styles:styles,theme:theme}).video_container},typeMapper=function(){var _ref;return(_ref={})["VIDEO-EMBED"]={component:VideoViewer,classNameStrategies:{container:containerClassName}},_ref[VIDEO_TYPE]={component:VideoViewer,classNameStrategies:{container:containerClassName}},_ref};exports.VIDEO_TYPE=VIDEO_TYPE,exports.pluginVideo=function(config){return{config:_extends__default.default({},DEFAULTS_configViewer,config),type:VIDEO_TYPE,typeMapper:typeMapper}},exports.videoTypeMapper=typeMapper;
//# sourceMappingURL=module.viewer.cjs.js.map

@@ -1,2 +0,2 @@

import _extends from"@babel/runtime/helpers/extends";import"wix-rich-content-common";var TEXT_COLOR_TYPE="wix-rich-content-text-color",TEXT_HIGHLIGHT_TYPE="wix-rich-content-text-highlight";Object.freeze(["#ffffff","#303030","#3a54b4","#bfad80","#bf695c","#f7f7f7"]);var userColors=[],DEFAULTS_configTextColor={editor:{onColorAdded:function(color){return userColors=[].concat(userColors,[color])},getUserColors:function(){return userColors}},viewer:{}},DEFAULTS_configTextHighlight={editor:{onColorAdded:function(color){return userColors=[].concat(userColors,[color])},getUserColors:function(){return userColors}},viewer:{}},pluginTextColor=function(config){return{config:_extends({},DEFAULTS_configTextColor.viewer,config),type:"wix-rich-content-text-color"}},pluginTextHighlight=function(config){return{config:_extends({},DEFAULTS_configTextHighlight.viewer,config),type:"wix-rich-content-text-highlight"}};export{TEXT_COLOR_TYPE,TEXT_HIGHLIGHT_TYPE,pluginTextColor,pluginTextHighlight};
import _extends from"@babel/runtime/helpers/extends";import _assertThisInitialized from"@babel/runtime/helpers/assertThisInitialized";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{Component}from"react";import ReactDOM from"react-dom";import ReactPlayer from"react-player";import{isSSR,validate,mergeStyles}from"wix-rich-content-common";import classNames from"classnames";import pluginVideoSchema from"wix-rich-content-common/dist/statics/schemas/plugin-video.schema.json";import{isEqual}from"lodash";var VIDEO_TYPE="wix-draft-plugin-video",DEFAULTS_configViewer={getVideoUrl:function(src){return"https://video.wixstatic.com/"+src.pathname}},ReactPlayerWrapper=function(_Component){function ReactPlayerWrapper(props){var _this;return(_this=_Component.call(this,props)||this).isVimeoAndRequireJS=function(){return!isSSR()&&(url=_this.props.url,MATCH_URL=/vimeo\.com\/.+/,!/vimeo\.com\/external\/[0-9]+\..+/.test(url)&&MATCH_URL.test(url))&&!window.Vimeo&&window.requirejs;var url,MATCH_URL},_this.state={vimeoLoaded:!1,isPlaying:!1},_this}_inheritsLoose(ReactPlayerWrapper,_Component);var _proto=ReactPlayerWrapper.prototype;return _proto.componentDidMount=function(){var _this2=this;this.isVimeoAndRequireJS()&&window.require(["https://player.vimeo.com/api/player.js"],(function(player){window.Vimeo={Player:player},_this2.setState({vimeoLoaded:!0})}))},_proto.render=function(){var _this3=this;if(!this.state.vimeoLoaded&&this.isVimeoAndRequireJS())return null;var _this$props=this.props,isPlayable=_this$props.isPlayable,styles=_this$props.styles,disabled=_this$props.disabled;return React.createElement(ReactPlayer,_extends({playing:this.state.isPlaying&&!disabled,onPlay:function(){return _this3.setState({isPlaying:!0})},onPause:function(){return _this3.setState({isPlaying:!1})},style:styles},this.props,{light:!isPlayable}))},ReactPlayerWrapper}(Component);ReactPlayerWrapper.defaultProps={isPlayable:!0};var getVideoSrc=function(src,settings){if(void 0===settings&&(settings={}),"object"==typeof src){if(settings&&settings.getVideoUrl)return settings.getVideoUrl(src);console.error("must set getVideoUrl in plugin config when using custom video source!",src)}return src},styles={video_player:"NjOn2",videoOverlay:"_3xYKn",video_container:"oUYOK"},VideoViewer=function(_Component){function VideoViewer(props){var _this;(_this=_Component.call(this,props)||this).setUrl=function(newUrl){var _this$props$onReload,_this$props,url=_this.normalizeUrl(newUrl);url!==_this.state.url&&(_this.setState({url:url}),null===(_this$props$onReload=(_this$props=_this.props).onReload)||void 0===_this$props$onReload||_this$props$onReload.call(_this$props))},_this.normalizeUrl=function(url){return 0===url.toLowerCase().indexOf("vimeo")?"https://"+url:url},_this.findFormalVideoRatio=function(ratio){var target,baseRatios=[1,5/4,4/3,1.5,1.6,16/9,1.85,2,2.35,2.39,3],videoRatios=[].concat(baseRatios,baseRatios.map((function(x){return 1/x}))),closest=(target=ratio,videoRatios.reduce((function(prev,curr){return Math.abs(curr-target)<Math.abs(prev-target)?curr:prev})));return Math.abs(closest-ratio)>.01?ratio:closest},_this.getVideoRatio=function(wrapper){var element=wrapper.querySelector("iframe, video");return _this.findFormalVideoRatio(element.clientHeight/element.clientWidth)},_this.onReactPlayerReady=function(){var _this$props$onReady,_this$props2,wrapper=ReactDOM.findDOMNode(_assertThisInitialized(_this)).parentNode,ratio=_this.getVideoRatio(wrapper);(wrapper.style["padding-bottom"]=100*ratio+"%",_this.props.isLoaded)||((null===(_this$props$onReady=(_this$props2=_this.props).onReady)||void 0===_this$props$onReady?void 0:_this$props$onReady.call(_this$props2))||_this.setState({isLoaded:!0}))},_this.handleContextMenu=function(e){return _this.props.componentData.disableDownload&&e.preventDefault()},_this.disableDownloadProps=function(){var _this$props3=_this.props,componentData=_this$props3.componentData,settings=_this$props3.settings,disableProps={config:{file:{attributes:{controlsList:"nodownload"}}}},disable={};return void 0!==componentData.disableDownload?disable=componentData.disableDownload?disableProps:{}:void 0!==settings.disableDownload&&(disable=settings.disableDownload?disableProps:{}),disable},validate(props.componentData,pluginVideoSchema),_this.state={url:void 0,isLoaded:!1};var _url=getVideoSrc(props.componentData.src,props.settings);return"string"==typeof _url?_this.state={url:_this.normalizeUrl(_url)}:_url&&"function"==typeof _url.then&&_url.then((function(url){return _this.setState({url:_this.normalizeUrl(url)})})),_this}_inheritsLoose(VideoViewer,_Component);var _proto=VideoViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){var _this2=this;if(!isEqual(nextProps.componentData,this.props.componentData)&&(validate(nextProps.componentData,pluginVideoSchema),nextProps.componentData.src!==this.props.componentData.src)){var url=getVideoSrc(nextProps.componentData.src,nextProps.settings);"string"==typeof url?this.setUrl(url):url&&"function"==typeof url.then&&url.then((function(url){return _this2.setUrl(url)}))}},_proto.componentDidMount=function(){this.setState({key:"mounted"})},_proto.render=function(){var _this$props4=this.props,theme=_this$props4.theme,width=_this$props4.width,height=_this$props4.height,disabled=_this$props4.disabled,setComponentUrl=_this$props4.setComponentUrl;this.styles=this.styles||mergeStyles({styles:styles,theme:theme});var _this$state=this.state,url=_this$state.url,key=_this$state.key;null==setComponentUrl||setComponentUrl(url);var props=_extends({url:url,onReady:this.onReactPlayerReady,disabled:disabled,width:width,height:height,key:key},this.disableDownloadProps()),isLoaded=this.props.isLoaded||this.state.isLoaded;return React.createElement(React.Fragment,null,React.createElement(ReactPlayerWrapper,_extends({className:classNames(this.styles.video_player),onContextMenu:this.handleContextMenu,"data-loaded":isLoaded,controls:!1!==this.props.isLoaded},props)))},VideoViewer}(Component);VideoViewer.defaultProps={width:"100%",height:"100%"};var containerClassName=function(theme){return mergeStyles({styles:styles,theme:theme}).video_container},typeMapper=function(){var _ref;return(_ref={})["VIDEO-EMBED"]={component:VideoViewer,classNameStrategies:{container:containerClassName}},_ref[VIDEO_TYPE]={component:VideoViewer,classNameStrategies:{container:containerClassName}},_ref},pluginVideo=function(config){return{config:_extends({},DEFAULTS_configViewer,config),type:VIDEO_TYPE,typeMapper:typeMapper}};export{VIDEO_TYPE,pluginVideo,typeMapper as videoTypeMapper};
//# sourceMappingURL=module.viewer.js.map

@@ -1,41 +0,4 @@

export const DEFAULT_PALETTE: readonly string[];
export const DEFAULT_COLOR: "#000000";
export const DEFAULT_HIGHLIGHT_COLOR: "#ffffff";
export const PANEL_WIDTH: 216;
export const PANEL_HEIGHT: 116;
export function DEFAULT_STYLE_SELECTION_PREDICATE(style: any): boolean;
export function DEFAULT_FOREGROUND_STYLE_FN(style: any): {
color: any;
} | {
color?: undefined;
};
export function DEFAULT_FOREGROUND_STYLE_FN_DRAFT(styles: any): any;
export function DEFAULT_BACKGROUND_STYLE_FN(style: any): {
backgroundColor: any;
transition: string;
} | {
backgroundColor?: undefined;
transition?: undefined;
};
export function DEFAULT_BACKGROUND_STYLE_FN_DRAFT(styles: any): any;
export namespace DEFAULTS {
export namespace configTextColor {
export namespace editor {
export function onColorAdded(color: any): any[];
export function getUserColors(): any[];
}
export const viewer: {};
}
export namespace configTextHighlight {
export namespace editor_1 {
export function onColorAdded_1(color: any): any[];
export { onColorAdded_1 as onColorAdded };
export function getUserColors_1(): any[];
export { getUserColors_1 as getUserColors };
}
export { editor_1 as editor };
const viewer_1: {};
export { viewer_1 as viewer };
}
}
/// <reference types="react" />
export declare const videoModalContentStyles: React.CSSProperties;
export declare const embedModalContentStyles: React.CSSProperties;
//# sourceMappingURL=constants.d.ts.map

@@ -1,5 +0,4 @@

import { TextColorPluginEditorConfig, TextHighlightPluginEditorConfig } from './types';
import { VideoPluginEditorConfig } from './types';
import { EditorPluginCreator } from 'wix-rich-content-common';
export declare const pluginTextColor: EditorPluginCreator<TextColorPluginEditorConfig>;
export declare const pluginTextHighlight: EditorPluginCreator<TextHighlightPluginEditorConfig>;
export declare const pluginVideo: EditorPluginCreator<VideoPluginEditorConfig>;
//# sourceMappingURL=editor.d.ts.map

@@ -1,9 +0,6 @@

export { createTextColorPlugin } from './createTextColorPlugin';
export { createTextHighlightPlugin } from './createTextHighlightPlugin';
export { TEXT_COLOR_TYPE, TEXT_HIGHLIGHT_TYPE } from './types';
export { createVideoPlugin } from './createVideoPlugin';
export { default as VideoViewer } from './video-viewer';
export { VIDEO_TYPE_LEGACY, VIDEO_TYPE, videoButtonsTypes } from './types';
export { Modals, ModalsMap } from './modals';
export { getColor, isTextColor, isTextHighlight } from './text-decorations-utils';
export { pluginTextColor, pluginTextHighlight } from './editor';
export declare const textColorInlineStyleMapper: import("wix-rich-content-common").InlineStyleMapperFunction<Record<string, any>>;
export declare const textHighlightInlineStyleMapper: import("wix-rich-content-common").InlineStyleMapperFunction<Record<string, any>>;
export { pluginVideo } from './editor';
//# sourceMappingURL=index.d.ts.map

@@ -1,9 +0,11 @@

import TextColorPanel from './toolbar/TextColorPanel';
/// <reference types="react" />
import VideoSelectionInputModal from './toolbar/videoSelectionInputModal';
declare const Modals: {
TEXT_COLOR_PICKER: string;
VIDEO_SELECTION_INPUT: string;
VIDEO_SETTINGS: string;
};
declare const ModalsMap: {
[x: string]: typeof TextColorPanel;
[x: string]: typeof VideoSelectionInputModal | import("react").FC<import("./types").VideoSettingsProps>;
};
export { Modals, ModalsMap };
//# sourceMappingURL=modals.d.ts.map
import { CreatePluginToolbar } from 'wix-rich-content-common';
export declare const createTextColorToolbar: CreatePluginToolbar;
export declare const createTextHighlightToolbar: CreatePluginToolbar;
declare const createToolbar: CreatePluginToolbar;
export default createToolbar;
//# sourceMappingURL=createToolbar.d.ts.map

@@ -1,18 +0,29 @@

import { EditorPluginConfig, ViewerPluginConfig } from 'wix-rich-content-common';
export declare const TEXT_COLOR_TYPE = "wix-rich-content-text-color";
export declare const TEXT_HIGHLIGHT_TYPE = "wix-rich-content-text-highlight";
export interface TextColorPluginEditorConfig extends EditorPluginConfig {
inlinePopups?: boolean;
/// <reference types="i18next" />
import { EditorPluginConfig, ViewerPluginConfig, ComponentData, Helpers, Pubsub, TranslationFunction, RichContentTheme } from 'wix-rich-content-common';
export declare const VIDEO_TYPE = "wix-draft-plugin-video";
export declare const VIDEO_TYPE_LEGACY = "VIDEO-EMBED";
export declare const videoButtonsTypes: {
video: string;
soundCloud: string;
youTube: string;
};
export declare const mediaTypes: string[];
export interface VideoPluginEditorConfig extends EditorPluginConfig {
[key: string]: any;
}
export interface TextColorPluginViewerConfig extends ViewerPluginConfig {
export interface VideoPluginViewerConfig extends ViewerPluginConfig {
[key: string]: any;
}
export interface TextHighlightPluginEditorConfig extends EditorPluginConfig {
inlinePopups?: boolean;
[key: string]: any;
export declare type VideoData = ComponentData & {
disableDownload?: boolean;
};
export interface VideoSettingsProps {
componentData: VideoData;
helpers: Helpers;
pubsub: Pubsub;
theme: RichContentTheme;
t: TranslationFunction;
isMobile: boolean;
settings: VideoPluginEditorConfig;
}
export interface TextHighlightPluginViewerConfig extends ViewerPluginConfig {
[key: string]: any;
}
//# sourceMappingURL=types.d.ts.map

@@ -1,6 +0,6 @@

import { TEXT_COLOR_TYPE, TEXT_HIGHLIGHT_TYPE, TextColorPluginViewerConfig, TextHighlightPluginViewerConfig } from './types';
import { VIDEO_TYPE, VideoPluginViewerConfig } from './types';
import { typeMapper } from './typeMapper';
import { ViewerPluginCreator } from 'wix-rich-content-common';
export { TEXT_COLOR_TYPE, TEXT_HIGHLIGHT_TYPE };
export declare const pluginTextColor: ViewerPluginCreator<TextColorPluginViewerConfig>;
export declare const pluginTextHighlight: ViewerPluginCreator<TextHighlightPluginViewerConfig>;
export { VIDEO_TYPE, typeMapper as videoTypeMapper };
export declare const pluginVideo: ViewerPluginCreator<VideoPluginViewerConfig>;
//# sourceMappingURL=viewer.d.ts.map

@@ -1,1 +0,1 @@

{"name":"richlagetest","version":"0.0.0-5b81c4dfa849458fc448e84873c99e378bc1e9c1"}
{"name":"richlagetest","version":"0.0.0-5bbc0dc28e6b07984c8d7ef5ca86870ae557b725"}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc