Socket
Socket
Sign inDemoInstall

richlagetest

Package Overview
Dependencies
0
Maintainers
1
Versions
150
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.0-09b87b046fae0e0cd11e7abfb50826eaaf8e7800 to 0.0.0-0c51a1140f567e2d087a75e68f679500b8a1d7fc

dist/loadable/viewer/cjs/LinkViewer.cjs.js

4

dist/module.cjs.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var ricosContent=require("ricos-content"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),React=require("react"),reactIntersectionObserver=require("react-intersection-observer"),classNames=require("classnames"),_extends=require("@babel/runtime/helpers/extends"),lodash=require("lodash"),_objectWithoutPropertiesLoose=require("@babel/runtime/helpers/objectWithoutPropertiesLoose"),_asyncToGenerator=require("@babel/runtime/helpers/asyncToGenerator"),_regeneratorRuntime=require("@babel/runtime/regenerator"),reactI18next=require("react-i18next"),i18next=require("i18next");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach((function(k){if("default"!==k){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:!0,get:function(){return e[k]}})}})),n.default=e,Object.freeze(n)}var _inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),_extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),_asyncToGenerator__default=_interopDefaultLegacy(_asyncToGenerator),_regeneratorRuntime__default=_interopDefaultLegacy(_regeneratorRuntime),__assign$r=function(){return(__assign$r=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)};var _DRAFT_TO_RICOS_DOC_T,ButtonType,ModifierKey,ToolbarType,DisplayMode,DecorationMode,baseLink={target:"SELF"},Link_fromJSON=function(object){var message=__assign$r({},baseLink);return void 0!==object.url&&null!==object.url?message.url=String(object.url):message.url=void 0,void 0!==object.anchor&&null!==object.anchor?message.anchor=String(object.anchor):message.anchor=void 0,void 0!==object.target&&null!==object.target?message.target=function(object){switch(object){case 0:case"SELF":return"SELF";case 1:case"BLANK":return"BLANK";case 2:case"PARENT":return"PARENT";case 3:case"TOP":return"TOP";case-1:case"UNRECOGNIZED":default:return"UNRECOGNIZED"}}(object.target):message.target="SELF",void 0!==object.rel&&null!==object.rel?message.rel=Link_Rel.fromJSON(object.rel):message.rel=void 0,void 0!==object.customData&&null!==object.customData?message.customData=String(object.customData):message.customData=void 0,message},Link_toJSON=function(message){var obj={};return void 0!==message.url&&(obj.url=message.url),void 0!==message.anchor&&(obj.anchor=message.anchor),void 0!==message.target&&(obj.target=function(object){switch(object){case"SELF":return"SELF";case"BLANK":return"BLANK";case"PARENT":return"PARENT";case"TOP":return"TOP";default:return"UNKNOWN"}}(message.target)),void 0!==message.rel&&(obj.rel=message.rel?Link_Rel.toJSON(message.rel):void 0),void 0!==message.customData&&(obj.customData=message.customData),obj},baseLink_Rel={},Link_Rel={fromJSON:function(object){var message=__assign$r({},baseLink_Rel);return void 0!==object.nofollow&&null!==object.nofollow?message.nofollow=Boolean(object.nofollow):message.nofollow=void 0,void 0!==object.sponsored&&null!==object.sponsored?message.sponsored=Boolean(object.sponsored):message.sponsored=void 0,void 0!==object.ugc&&null!==object.ugc?message.ugc=Boolean(object.ugc):message.ugc=void 0,message},toJSON:function(message){var obj={};return void 0!==message.nofollow&&(obj.nofollow=message.nofollow),void 0!==message.sponsored&&(obj.sponsored=message.sponsored),void 0!==message.ugc&&(obj.ugc=message.ugc),obj}},__assign$n=function(){return(__assign$n=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},baseLinkData={},LinkData={fromJSON:function(object){var message=__assign$n({},baseLinkData);return void 0!==object.link&&null!==object.link?message.link=Link_fromJSON(object.link):message.link=void 0,message},toJSON:function(message){var obj={};return void 0!==message.link&&(obj.link=message.link?Link_toJSON(message.link):void 0),obj}},DRAFT_TO_RICOS_DOC_TYPE=((_DRAFT_TO_RICOS_DOC_T={})[ricosContent.HEADER_BLOCK.ONE]="headerOne",_DRAFT_TO_RICOS_DOC_T[ricosContent.HEADER_BLOCK.TWO]="headerTwo",_DRAFT_TO_RICOS_DOC_T[ricosContent.HEADER_BLOCK.THREE]="headerThree",_DRAFT_TO_RICOS_DOC_T[ricosContent.HEADER_BLOCK.FOUR]="headerFour",_DRAFT_TO_RICOS_DOC_T[ricosContent.HEADER_BLOCK.FIVE]="headerFive",_DRAFT_TO_RICOS_DOC_T[ricosContent.HEADER_BLOCK.SIX]="headerSix",_DRAFT_TO_RICOS_DOC_T[ricosContent.HEADER_BLOCK.PARAGRAPH]="paragraph",_DRAFT_TO_RICOS_DOC_T);exports.ButtonType=void 0,(ButtonType=exports.ButtonType||(exports.ButtonType={})).CUSTOM="custom",ButtonType.FILES="file",ButtonType.TOGGLE="toggle",ButtonType.PANEL="panel",ButtonType.INLINE_PANEL="inline-panel",ButtonType.EXTERNAL_MODAL="external-modal",ButtonType.DROPDOWN="dropdown",ButtonType.SEPARATOR="separator",ButtonType.SIZE_ORIGINAL="size-original",ButtonType.SIZE_CONTENT_CENTER="size-content-center",ButtonType.SIZE_SMALL_CENTER="size-small-center",ButtonType.SIZE_SMALL_LEFT="size-small-left",ButtonType.SIZE_SMALL_RIGHT="size-small-right",ButtonType.ALIGN_LEFT="align-left",ButtonType.ALIGN_RIGHT="align-right",ButtonType.ALIGN_CENTER="align-center",ButtonType.SIZE_CONTENT="size-content",ButtonType.SIZE_FULL_WIDTH="size-full-width",ButtonType.SIZE_SMALL="size-small",ButtonType.SIZE_MEDIUM="size-medium",ButtonType.SIZE_LARGE="size-large",ButtonType.TEXT_ALIGN_LEFT="alignment-left",ButtonType.TEXT_ALIGN_CENTER="alignment-center",ButtonType.TEXT_ALIGN_RIGHT="alignment-right",ButtonType.WIDTH="width",ButtonType.HEIGHT="height",ButtonType.LINK="link",ButtonType.SPOILER="spoiler",ButtonType.DELETE="delete",ButtonType.LINK_PREVIEW="link-preview",ButtonType.VIDEO_SETTINGS="video-settings",exports.ModifierKey=void 0,(ModifierKey=exports.ModifierKey||(exports.ModifierKey={})).COMMAND="command",ModifierKey.CTRL="ctrl",ModifierKey.OPTION="option",ModifierKey.SHIFT="shift",ModifierKey.ALT="alt",exports.ToolbarType=void 0,(ToolbarType=exports.ToolbarType||(exports.ToolbarType={})).SIDE="SIDE",ToolbarType.MOBILE="MOBILE",ToolbarType.FOOTER="FOOTER",ToolbarType.STATIC="STATIC",ToolbarType.INLINE="INLINE",ToolbarType.PLUGIN="PLUGIN",ToolbarType.FORMATTING="FORMATTING",ToolbarType.INSERT_PLUGIN="INSERT_PLUGIN",ToolbarType.TEXT="ALL-TEXT-TOOLBARS",ToolbarType.SHORTCUT="SHORTCUT",ToolbarType.LINK="LINK",exports.DisplayMode=void 0,(DisplayMode=exports.DisplayMode||(exports.DisplayMode={})).NORMAL="NORMAL",DisplayMode.FLOATING="FLOATING",exports.DecorationMode=void 0,(DecorationMode=exports.DecorationMode||(exports.DecorationMode={})).PREPEND="PREPEND",DecorationMode.WRAP="WRAP",DecorationMode.APPEND="APPEND";var noOutlineStyle_noOutline="_1-vl0",AccessibilityListener=function(_Component){function AccessibilityListener(){var _this;return(_this=_Component.apply(this,arguments)||this).handleTabKeyUp=function(e){9===e.which&&document.body.classList.contains(noOutlineStyle_noOutline)&&document.body.classList.remove(noOutlineStyle_noOutline)},_this.handleClick=function(){document.body.classList.contains(noOutlineStyle_noOutline)||document.body.classList.add(noOutlineStyle_noOutline)},_this.render=function(){return null},_this}_inheritsLoose__default.default(AccessibilityListener,_Component);var _proto=AccessibilityListener.prototype;return _proto.componentDidMount=function(){document.body.classList.add(noOutlineStyle_noOutline),this.props.isMobile||(document.addEventListener("keyup",this.handleTabKeyUp),document.addEventListener("click",this.handleClick))},_proto.componentWillUnmount=function(){this.props.isMobile||(document.removeEventListener("keyup",this.handleTabKeyUp),document.removeEventListener("click",this.handleClick))},AccessibilityListener}(React.Component),cssClassMerger=function(defaultStyleClassName,themeClassName){return defaultStyleClassName+" "+themeClassName},mergeStyles=function(_ref){var styles=_ref.styles,theme=_ref.theme;if(!theme)return console.warn("mergeStyles invoked without theme!"),styles;var themeStyles=lodash.pickBy(theme),themeStylesToMerge=lodash.pickBy(themeStyles,(function(_,key){return lodash.has(styles,key)}));return lodash.mergeWith(_extends__default.default({},styles),themeStylesToMerge,cssClassMerger)},isSSR=function(){return"undefined"==typeof window},styles={placeholder:"_2bUeE"},ViewportRenderer=function(_Component){function ViewportRenderer(){return _Component.apply(this,arguments)||this}return _inheritsLoose__default.default(ViewportRenderer,_Component),ViewportRenderer.prototype.render=function(){var _this=this,_this$props=this.props,children=_this$props.children,placeholderStyle=_this$props.placeholderStyle,placeholderClass=_this$props.placeholderClass,containerStyle=_this$props.containerStyle,containerClass=_this$props.containerClass,theme=this.props.theme;return this.styles=this.styles||mergeStyles({styles:styles,theme:theme}),isSSR()||void 0===window.IntersectionObserver?children:React__default.default.createElement(reactIntersectionObserver.InView,{triggerOnce:!0},(function(_ref){var inView=_ref.inView,ref=_ref.ref;return inView?React__default.default.createElement("div",{ref:ref,style:containerStyle,className:containerClass},children):React__default.default.createElement("div",{ref:ref,className:classNames__default.default(_this.styles.placeholder,placeholderClass),style:placeholderStyle})}))},ViewportRenderer}(React.Component);function i18n(_ref){var _resources,locale=_ref.locale,localeResource=_ref.localeResource;return i18next.createInstance().init({lng:locale,keySeparator:"$",interpolation:{escapeValue:!1},react:{wait:!0},resources:(_resources={},_resources[locale]={translation:localeResource},_resources)})}function getDisplayName(Component){return Component.displayName||Component.name||"Component"}function createHocName(hocComponentName,WrappedComponent){return hocComponentName+"("+getDisplayName(WrappedComponent)+")"}ViewportRenderer.defaultProps={placeholderStyle:{},containerStyle:{},alwaysRenderChildren:!1,placeholderClass:"",containerClass:""};var memoizedNow,_excluded=["forwardedRef"],safeJsonParse=function(jsonString){try{return JSON.parse(jsonString)}catch(e){return}};function t(t){return"object"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return(!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return!1}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}function compute(e,i){var o=window,l=i.scrollMode,d=i.block,u=i.inline,h=i.boundary,a=i.skipOverflowHiddenElements,c="function"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,s=[],p=e;t(p)&&c(p);){if((p=p.parentElement)===f){s.push(p);break}null!=p&&p===document.body&&n(p)&&!n(document.documentElement)||null!=p&&n(p,a)&&s.push(p)}for(var m=o.visualViewport?o.visualViewport.width:innerWidth,g=o.visualViewport?o.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,v=window.scrollY||pageYOffset,W=e.getBoundingClientRect(),b=W.height,H=W.width,y=W.top,E=W.right,M=W.bottom,V=W.left,x="start"===d||"nearest"===d?y:"end"===d?M:y+b/2,I="center"===u?V+H/2:"end"===u?E:V,C=[],T=0;T<s.length;T++){var k=s[T],B=k.getBoundingClientRect(),D=B.height,O=B.width,R=B.top,X=B.right,Y=B.bottom,L=B.left;if("if-needed"===l&&y>=0&&V>=0&&M<=g&&E<=m&&y>=R&&M<=Y&&V>=L&&E<=X)return C;var S=getComputedStyle(k),j=parseInt(S.borderLeftWidth,10),q=parseInt(S.borderTopWidth,10),z=parseInt(S.borderRightWidth,10),A=parseInt(S.borderBottomWidth,10),F=0,G=0,J="offsetWidth"in k?k.offsetWidth-k.clientWidth-j-z:0,K="offsetHeight"in k?k.offsetHeight-k.clientHeight-q-A:0;if(f===k)F="start"===d?x:"end"===d?x-g:"nearest"===d?r(v,v+g,g,q,A,v+x,v+x+b,b):x-g/2,G="start"===u?I:"center"===u?I-m/2:"end"===u?I-m:r(w,w+m,m,j,z,w+I,w+I+H,H),F=Math.max(0,F+v),G=Math.max(0,G+w);else{F="start"===d?x-R-q:"end"===d?x-Y+A+K:"nearest"===d?r(R,Y,D,q,A+K,x,x+b,b):x-(R+D/2)+K/2,G="start"===u?I-L-j:"center"===u?I-(L+O/2)+J/2:"end"===u?I-X+z+J:r(L,X,O,j,z+J,I,I+H,H);var N=k.scrollLeft,P=k.scrollTop;x+=P-(F=Math.max(0,Math.min(P+F,k.scrollHeight-D+K))),I+=N-(G=Math.max(0,Math.min(N+G,k.scrollWidth-O+J)))}C.push({el:k,top:F,left:G})}return C}function isOptionsObject(options){return options===Object(options)&&0!==Object.keys(options).length}function scrollIntoView$1(target,options){var targetIsDetached=!target.ownerDocument.documentElement.contains(target);if(isOptionsObject(options)&&"function"==typeof options.behavior)return options.behavior(targetIsDetached?[]:compute(target,options));if(!targetIsDetached){var computeOptions=function(options){return!1===options?{block:"end",inline:"nearest"}:isOptionsObject(options)?options:{block:"start",inline:"nearest"}}(options);return function(actions,behavior){void 0===behavior&&(behavior="auto");var canSmoothScroll="scrollBehavior"in document.body.style;actions.forEach((function(_ref){var el=_ref.el,top=_ref.top,left=_ref.left;el.scroll&&canSmoothScroll?el.scroll({top:top,left:left,behavior:behavior}):(el.scrollTop=top,el.scrollLeft=left)}))}(compute(target,computeOptions),computeOptions.behavior)}}var now=function(){return memoizedNow||(memoizedNow="performance"in window?performance.now.bind(performance):Date.now),memoizedNow()};function step(context){var time=now(),elapsed=Math.min((time-context.startTime)/context.duration,1),value=context.ease(elapsed),currentX=context.startX+(context.x-context.startX)*value,currentY=context.startY+(context.y-context.startY)*value;context.method(currentX,currentY),currentX!==context.x||currentY!==context.y?requestAnimationFrame((function(){return step(context)})):context.cb()}function smoothScroll(el,x,y,duration,ease,cb){var scrollable,startX,startY;void 0===duration&&(duration=600),void 0===ease&&(ease=function(t){return 1+--t*t*t*t*t}),scrollable=el,startX=el.scrollLeft,startY=el.scrollTop,step({scrollable:scrollable,method:function(x,y){el.scrollLeft=Math.ceil(x),el.scrollTop=Math.ceil(y)},startTime:now(),startX:startX,startY:startY,x:x,y:y,duration:duration,ease:ease,cb:cb})}var scrollIntoView=function(target,options){var overrides=options||{};return function(options){return options&&!options.behavior||"smooth"===options.behavior}(overrides)?scrollIntoView$1(target,{block:overrides.block,inline:overrides.inline,scrollMode:overrides.scrollMode,boundary:overrides.boundary,behavior:function(actions){return Promise.all(actions.reduce((function(results,_ref){var el=_ref.el,left=_ref.left,top=_ref.top,startLeft=el.scrollLeft,startTop=el.scrollTop;return startLeft===left&&startTop===top?results:[].concat(results,[new Promise((function(resolve){return smoothScroll(el,left,top,overrides.duration,overrides.ease,(function(){return resolve({el:el,left:[startLeft,left],top:[startTop,top]})}))}))])}),[]))}}):Promise.resolve(scrollIntoView$1(target,options))},anchorScrollUsingSmoothScrollIntoViewIfNeeded=function(element,fixedElementsOffset){var _element$style=element.style,paddingTop=_element$style.paddingTop,marginTop=_element$style.marginTop;element.style.marginTop="-"+fixedElementsOffset+"px",element.style.paddingTop=fixedElementsOffset+"px",scrollIntoView(element,{block:"start",inline:"start"}),element.style.marginTop=marginTop,element.style.paddingTop=paddingTop},anchorScrollUsingScrollIntoView=function(element,fixedElementsOffset){var _element$style2=element.style,paddingTop=_element$style2.paddingTop,marginTop=_element$style2.marginTop;element.style.marginTop="-"+fixedElementsOffset+"px",element.style.paddingTop=fixedElementsOffset+"px",element.scrollIntoView({behavior:"smooth"}),element.style.marginTop=marginTop,element.style.paddingTop=paddingTop},getLinkRangesInBlock=function(block,contentState){var ranges=[];return block.entityRanges.forEach((function(entityRange){var _contentState$entityM,entityType=null===(_contentState$entityM=contentState.entityMap[entityRange.key])||void 0===_contentState$entityM?void 0:_contentState$entityM.type;if("LINK"===entityType||"wix-draft-plugin-external-link"===entityType){var start=entityRange.offset,end=start+entityRange.length;ranges.push([start,end])}})),ranges},contentStateSchema={definitions:{inlineStyleDef:{definitions:{},$schema:"http://json-schema.org/draft-07/schema#",$id:"https://wix-rich-content/inline-style.json",type:"object",title:"inline style",required:["offset","length","style"],properties:{offset:{$id:"#/properties/offset",type:"integer",title:"offset",default:0,min:0,examples:[0]},length:{$id:"#/properties/length",type:"integer",title:"length",default:0,min:0,examples:[4]},style:{$id:"#/properties/style",type:"string",title:"style",default:"",examples:["color4"],pattern:"^(.*)$"}}},entityRangeDef:{definitions:{},$schema:"http://json-schema.org/draft-07/schema#",$id:"https://wix-rich-content/entity-range.json",type:"object",title:"inline style",required:["offset","length","key"],properties:{offset:{$id:"#/properties/offset",type:"integer",title:"offset",default:0,min:0,examples:[0]},length:{$id:"#/properties/length",type:"integer",title:"length",default:0,min:0,examples:[4]},key:{$id:"#/properties/style",type:"integer",title:"key",default:"",examples:[0]}}},entityDef:{definitions:{},$schema:"http://json-schema.org/draft-07/schema#",$id:"https://wix-rich-content/entity-range.json",type:"object",title:"entity",required:["type","data"],properties:{type:{$id:"#/properties/type",enum:["IMAGE","VIDEO-EMBED","LINK","mention","wix-draft-plugin-image","wix-draft-plugin-link-button","wix-draft-plugin-action-button","wix-draft-plugin-video","wix-draft-plugin-gallery","wix-draft-plugin-link","wix-draft-plugin-html","wix-draft-plugin-sound-cloud","wix-draft-plugin-hashtag","wix-draft-plugin-divider","wix-draft-plugin-emoji","wix-draft-plugin-giphy","wix-draft-plugin-map","wix-draft-plugin-file-upload","wix-draft-plugin-vertical-embed","wix-draft-plugin-poll","wix-draft-plugin-link-preview","ANCHOR","wix-rich-content-plugin-table"],title:"entity type",examples:["wix-draft-plugin-image"]},mutability:{$id:"#/properties/mutability",type:"string",enum:["MUTABLE","IMMUTABLE","SEGMENTED"],title:"entity mutability",examples:["IMMUTABLE"]},data:{$id:"#/properties/data",type:"object",title:"entity data"}},anyOf:[{}]}},$schema:"http://json-schema.org/draft-07/schema#",$id:"https://wix-rich-content/content-state-schema.json",type:"object",title:"content state",required:["blocks","entityMap","VERSION"],properties:{blocks:{$id:"#/properties/blocks",type:"array",title:"blocks",items:{$id:"#/properties/blocks/items",type:"object",title:"block",required:["key","text","type","inlineStyleRanges","entityRanges","data"],properties:{key:{$id:"#/properties/blocks/items/properties/key",type:"string",title:"block key",default:"",examples:["45qkg"],pattern:"^(.*)$"},text:{$id:"#/properties/blocks/items/properties/text",type:"string",title:"text",default:"",examples:["test"]},type:{$id:"#/properties/blocks/items/properties/type",type:"string",title:"block type",default:"",examples:["unstyled"],enum:["unstyled","header-one","header-two","header-three","header-four","header-five","header-six","unordered-list-item","ordered-list-item","blockquote","atomic","code-block","figure"]},depth:{$id:"#/properties/blocks/items/properties/depth",type:"integer",title:"depth",maximum:10,default:0,examples:[0]},inlineStyleRanges:{$id:"#/properties/blocks/items/properties/inlineStyleRanges",type:"array",title:"inline style ranges",items:{$ref:"#/definitions/inlineStyleDef"}},entityRanges:{$id:"#/properties/blocks/items/properties/entityRanges",type:"array",title:"entity ranges",default:null,items:{$ref:"#/definitions/entityRangeDef"}},data:{$id:"#/properties/blocks/items/properties/data",type:"object",title:"data",default:null}}}},entityMap:{$id:"#/properties/entityMap",type:"object",title:"entity map",patternProperties:{"[0-9]+":{$ref:"#/definitions/entityDef"}}}}},LTR="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",isRtlRegex=new RegExp("^[^"+LTR+"]*[֑-߿יִ-﷽ﹰ-ﻼ]"),isLtrRegex=new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*["+LTR+"]"),emojiRegex=/\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]/g,GlobalContext=React__default.default.createContext({isMobile:!1,experiments:{}}),isHexColor=function(str){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(str)},rtlLangs=["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"],isRtl=function(locale){return!!locale&&rtlLangs.includes(locale.split("-|_")[0].toLowerCase())},getBlocksFromContentState=function(contentState){var entityMap,rceInRcePlugins,innerRCEBlocks=(entityMap=contentState.entityMap,rceInRcePlugins=["wix-rich-content-plugin-table","wix-rich-content-plugin-collapsible-list"],Object.values(entityMap).some((function(entity){return rceInRcePlugins.includes(entity.type)}))?getInnerRCEBlocks(contentState.entityMap):[]);return[].concat(contentState.blocks,innerRCEBlocks)};function getInnerRCEBlocks(object){var result=[];if(object instanceof Array)Array.prototype.forEach.call(object,(function(arrayElement){var innerBlocks=getInnerRCEBlocks(arrayElement);innerBlocks&&(result=[].concat(result,innerBlocks))}));else for(var _i=0,_Object$entries=Object.entries(object);_i<_Object$entries.length;_i++){var _Object$entries$_i=_Object$entries[_i],key=_Object$entries$_i[0],value=_Object$entries$_i[1];if("blocks"===key)return value;if(value instanceof Object||value instanceof Array){var innerBlocks=getInnerRCEBlocks(value);innerBlocks&&(result=[].concat(result,innerBlocks))}}return result}var _INLINE_STYLE_TYPES,_RICOS_TO_DRAFT_TYPE,_dynamicStyleParsers,_defaultStyleFnMapper,_defaultStyleSelectio;function isInEditor(contentBlock){return contentBlock.toJS}function isInLink(i,block,contentState){var entityKey=function(i,block){var _block$entityRanges$f;return isInEditor(block)?block.getEntityAt(i):null===(_block$entityRanges$f=block.entityRanges.find((function(_ref){var offset=_ref.offset,length=_ref.length;return i>offset&&i<offset+length})))||void 0===_block$entityRanges$f?void 0:_block$entityRanges$f.key}(i,block);return function(type){return"LINK"===type||"ricos-plugin-custom-link"===type}(function(block,contentState,entityKey){var _contentState$entityM;return isInEditor(block)?null!==entityKey&&contentState.getEntity(entityKey).getType():null===(_contentState$entityM=contentState.entityMap[entityKey])||void 0===_contentState$entityM?void 0:_contentState$entityM.type}(block,contentState,entityKey))}var INLINE_STYLE_TYPES=((_INLINE_STYLE_TYPES={})[ricosContent.RICOS_TEXT_COLOR_TYPE]="FG",_INLINE_STYLE_TYPES[ricosContent.RICOS_TEXT_HIGHLIGHT_TYPE]="BG",_INLINE_STYLE_TYPES[ricosContent.RICOS_FONT_SIZE_TYPE]="font-size",_INLINE_STYLE_TYPES),RICOS_TO_DRAFT_TYPE=((_RICOS_TO_DRAFT_TYPE={})[ricosContent.RICOS_TEXT_COLOR_TYPE]=ricosContent.TEXT_COLOR_TYPE,_RICOS_TO_DRAFT_TYPE[ricosContent.RICOS_TEXT_HIGHLIGHT_TYPE]=ricosContent.TEXT_HIGHLIGHT_TYPE,_RICOS_TO_DRAFT_TYPE),parseStyleByType=function(style,type){var property=INLINE_STYLE_TYPES[type],cssRule=safeJsonParse(style);return null==cssRule?void 0:cssRule[property]},dynamicStyleParsers=((_dynamicStyleParsers={})[ricosContent.RICOS_TEXT_COLOR_TYPE]=function(style,styleSelectionPredicate){var color=parseStyleByType(style,ricosContent.RICOS_TEXT_COLOR_TYPE);if(styleSelectionPredicate){var parsedStyle=color||style;return styleSelectionPredicate(parsedStyle)&&parsedStyle}return color||isHexColor(style)&&style},_dynamicStyleParsers[ricosContent.RICOS_TEXT_HIGHLIGHT_TYPE]=function(style,styleSelectionPredicate){var color=parseStyleByType(style,ricosContent.RICOS_TEXT_HIGHLIGHT_TYPE);return styleSelectionPredicate?styleSelectionPredicate(color)&&color:color},_dynamicStyleParsers[ricosContent.RICOS_FONT_SIZE_TYPE]=function(style){return parseStyleByType(style,ricosContent.RICOS_FONT_SIZE_TYPE)},_dynamicStyleParsers),defaultStyleFnMapper=((_defaultStyleFnMapper={})[ricosContent.RICOS_TEXT_COLOR_TYPE]=function(style){var parsedStyle=dynamicStyleParsers[ricosContent.RICOS_TEXT_COLOR_TYPE](style,isHexColor);return parsedStyle?{color:parsedStyle}:void 0},_defaultStyleFnMapper[ricosContent.RICOS_TEXT_HIGHLIGHT_TYPE]=function(style){var parsedStyle=dynamicStyleParsers[ricosContent.RICOS_TEXT_HIGHLIGHT_TYPE](style,isHexColor);return parsedStyle?{backgroundColor:parsedStyle}:void 0},_defaultStyleFnMapper[ricosContent.RICOS_FONT_SIZE_TYPE]=function(style){var parsedStyle=dynamicStyleParsers[ricosContent.RICOS_FONT_SIZE_TYPE](style);return parsedStyle?{fontSize:parsedStyle}:void 0},_defaultStyleFnMapper[ricosContent.RICOS_BOLD_TYPE]=function(style){return"NOT_BOLD"===style?{fontWeight:"normal"}:void 0},_defaultStyleFnMapper[ricosContent.RICOS_ITALIC_TYPE]=function(style){return"NOT_ITALIC"===style?{fontStyle:"normal"}:void 0},_defaultStyleFnMapper),defaultStyleSelectionPredicates=((_defaultStyleSelectio={})[ricosContent.RICOS_TEXT_COLOR_TYPE]=isHexColor,_defaultStyleSelectio[ricosContent.RICOS_TEXT_HIGHLIGHT_TYPE]=isHexColor,_defaultStyleSelectio);Object.defineProperty(exports,"Trans",{enumerable:!0,get:function(){return reactI18next.Trans}}),Object.defineProperty(exports,"translate",{enumerable:!0,get:function(){return reactI18next.translate}}),exports.ADD_PLUGIN_LINK_BI="addPluginLink",exports.ANCHOR_CATEGORY="section",exports.ANCHOR_VIEWER_DATA_HOOK="anchorViewer",exports.AccessibilityListener=AccessibilityListener,exports.CUSTOM_LINK="custom-link",exports.DRAFT_TO_RICOS_DOC_TYPE=DRAFT_TO_RICOS_DOC_TYPE,exports.DROPDOWN_OPTIONS_TO_DOC_STYLE_TYPE={P:"paragraph",H1:"headerOne",H2:"headerTwo",H3:"headerThree",H4:"headerFour",H5:"headerFive",H6:"headerSix"},exports.GlobalContext=GlobalContext,exports.INLINE_STYLE_TYPES=INLINE_STYLE_TYPES,exports.LINK_VIEWER_DATA_HOOK="linkViewer",exports.LinkData=LinkData,exports.Link_Rel=Link_Rel,exports.RicosTranslate=function(_ref3){var children=_ref3.children,locale=_ref3.locale,localeResource=_ref3.localeResource,i18nInstance=React.useRef(i18n({locale:locale,localeResource:localeResource})),_React$useState=React__default.default.useState(0),forceCounter=_React$useState[0],forceUpdate=_React$useState[1];return React.useEffect((function(){i18nInstance.current.addResourceBundle(locale,"translation",localeResource),i18nInstance.current.changeLanguage(locale,(function(err){err||forceUpdate(forceCounter+1)}))}),[locale,localeResource]),React__default.default.createElement(reactI18next.I18nextProvider,{i18n:i18nInstance.current},React__default.default.createElement(reactI18next.I18n,{i18n:i18nInstance.current,wait:!0,initialLanguage:locale},(function(t){return children(t)})))},exports.ViewportRenderer=ViewportRenderer,exports.WEB_ADDRESS_CATEGORY="web_address",exports.addAnchorTagToUrl=function(anchorString){var url=new URL(window.location.href);url.hash=anchorString,history.pushState({},"",url.href)},exports.alignmentClassName=function(componentData,theme,styles){var alignment=(componentData.config||{}).alignment;if(!alignment)return"";var key="align"+lodash.upperFirst(alignment);return classNames__default.default(styles[key],theme[key])},exports.anchorScroll=function(element,experiments){var _document$querySelect,_document$querySelect2,_document$querySelect3,_document$querySelect4,_experiments$anchorSc,fixedElementsOffset=((null===(_document$querySelect=document.querySelector('[id="SITE_HEADER"]'))||void 0===_document$querySelect?void 0:_document$querySelect.clientHeight)||0)+((null===(_document$querySelect2=document.querySelector('[id="WIX_ADS"]'))||void 0===_document$querySelect2?void 0:_document$querySelect2.clientHeight)||0)+((null===(_document$querySelect3=document.querySelector('[data-hook="mobileToolbar"]'))||void 0===_document$querySelect3?void 0:_document$querySelect3.clientHeight)||(null===(_document$querySelect4=document.querySelector('[data-hook="ricos-editor-toolbars"]'))||void 0===_document$querySelect4?void 0:_document$querySelect4.clientHeight)||0);null!=experiments&&null!==(_experiments$anchorSc=experiments.anchorScrollWithSmoothScrollIntoViewIfNeeded)&&void 0!==_experiments$anchorSc&&_experiments$anchorSc.enabled?anchorScrollUsingSmoothScrollIntoViewIfNeeded(element,fixedElementsOffset):anchorScrollUsingScrollIntoView(element,fixedElementsOffset)},exports.convertRelObjectToString=function(relObject){if(relObject){var relString="";return relObject.nofollow&&(relString+="nofollow "),relObject.sponsored&&(relString+="sponsored "),relObject.ugc&&(relString+="ugc"),relString.trim()}},exports.convertRelStringToObject=function(rel){var relObject={};return rel?(rel.includes("nofollow")&&(relObject.nofollow=!0),rel.includes("sponsored")&&(relObject.sponsored=!0),rel.includes("ugc")&&(relObject.ugc=!0),relObject):relObject},exports.convertTargetBooleanToString=function(targetBlank){return targetBlank?"_blank":"_top"},exports.convertTargetStringToBoolean=function(target){return"_blank"===target},exports.createHocName=createHocName,exports.createJustificationFixDecorator=function(){var isTextJustified=function(contentBlock){return"justify"===function(contentBlock){var _contentBlock$data;return isInEditor(contentBlock)?contentBlock.getData().get("textAlignment"):null==contentBlock||null===(_contentBlock$data=contentBlock.data)||void 0===_contentBlock$data?void 0:_contentBlock$data.textAlignment}(contentBlock)};return{strategy:function(contentBlock,callback,contentState){if(!isSSR()&&(isSSR()||!window.chrome)&&isTextJustified(contentBlock))for(var match,regex=/\s[^\s]/g,str=contentBlock.getText();null!==(match=regex.exec(str));)isInLink(match.index,contentBlock,contentState)||callback(match.index,match.index+1)},component:function(props){return React__default.default.createElement("span",{style:{whiteSpace:"normal"}},props.children)}}},exports.defaultStyleFnMapper=defaultStyleFnMapper,exports.depthClassName=function(depth){return"public-DraftStyleDefault-block-depth"+depth},exports.draftDecorationsToCss={BOLD:{"font-weight":"bold"},ITALIC:{"font-style":"italic"},NOT_BOLD:{"font-weight":"normal"},NOT_ITALIC:{"font-style":"normal"}},exports.dynamicStyleParsers=dynamicStyleParsers,exports.generateKey=function(){return Math.random().toString(36).substr(2,9)},exports.getBlocksFromContentState=getBlocksFromContentState,exports.getContentStateSchema=function(pluginDataSchemas){void 0===pluginDataSchemas&&(pluginDataSchemas={});var schema=contentStateSchema;return schema.definitions.entityDef.anyOf=Object.keys(pluginDataSchemas).map((function(pluginType){return{properties:{type:{const:pluginType},data:pluginDataSchemas[pluginType]}}})),schema},exports.getDirectionFromAlignmentAndTextDirection=function(textAlignment,textDirection){return"right"===textAlignment?"rtl":"left"===textAlignment?"ltr":textDirection&&"rtl"===textDirection?textDirection:"ltr"},exports.getDisplayName=getDisplayName,exports.getDynamicInlineStyleMapper=function(type){return function(config,raw){var settings=config[RICOS_TO_DRAFT_TYPE[type]||""]||{},styleParser=dynamicStyleParsers[type],styleSelectionPredicate=settings.styleSelectionPredicate?function(style){return!!styleParser(style,settings.styleSelectionPredicate)}:function(style){return!!styleParser(style,defaultStyleSelectionPredicates[type])},customStyleFn=settings.customStyleFn?function(style){return settings.customStyleFn(styleParser(style,settings.styleSelectionPredicate))}:defaultStyleFnMapper[type],mapper=getBlocksFromContentState(raw).reduce((function(map,block){return block.inlineStyleRanges&&block.inlineStyleRanges.filter((function(range){return styleSelectionPredicate(range.style)})).forEach((function(range){map[range.style]=function(children,_ref){var key=_ref.key;return React__default.default.createElement("span",{key:key,style:customStyleFn(range.style)},children)}})),map}),{});return function(){return mapper}}},exports.getLangDir=function(locale){return isRtl(locale)?"rtl":"ltr"},exports.getLinkRangesInBlock=getLinkRangesInBlock,exports.getRelValue=function(rel){return("noopener noreferrer "+(rel||"")).trim()},exports.getTextDirection=function(text){var result="neutral";if(!text)return result;var plainText=text.replace(emojiRegex,"");return isRtlRegex.test(plainText)?result="rtl":isLtrRegex.test(plainText)&&(result="ltr"),result},exports.hasLinksInBlock=function(block,contentState){return getLinkRangesInBlock(block,contentState).length>0},exports.isHexColor=isHexColor,exports.isNewTab=function(target){return"_blank"===target},exports.isRtl=isRtl,exports.isSSR=isSSR,exports.mergeStyles=mergeStyles,exports.parseStyleByType=parseStyleByType,exports.safeJsonParse=safeJsonParse,exports.simplePubsub=function(initialState){var state=initialState||{},listeners={},subscribe=function(key,callback){if("function"!=typeof callback)throw"Callback for key "+key+" is not a function";return listeners[key]=listeners[key]||[],listeners[key].push(callback),function(){listeners[key]=listeners[key].filter((function(listener){return listener!==callback}))}},update=function(key,newData,blockKey){var data=get(key),newItem=lodash.merge({},data,newData);blockKey?_setSingle(key,newItem,blockKey):set(key,newItem)},_setSingle=function(key,item,blockKey){var _extends2;state=_extends__default.default({},state,((_extends2={})[key]=item,_extends2)),listeners[key]&&listeners[key].forEach((function(listener){return listener(state[key],blockKey)}))},_setBatch=function(updates){state=_extends__default.default({},state,updates),Object.keys(updates).forEach((function(key){listeners[key]&&listeners[key].forEach((function(listener){return listener(state[key])}))}))},set=function(){1===arguments.length?_setBatch(arguments.length<=0?void 0:arguments[0]):_setSingle.apply(void 0,arguments)},setBlockHandler=function(key,blockKey,item){_setSingle(blockHandlerKey(key,blockKey),item)},get=function(key){return state[key]},getBlockHandler=function(key,blockKey){return void 0===blockKey&&(blockKey=state.focusedBlock),state[blockHandlerKey(key,blockKey)]},blockHandlerKey=function(key,blockKey){return blockKey+"_"+key};return{subscribe:subscribe,unsubscribe:function(key,callback){listeners[key]=listeners[key].filter((function(listener){return listener!==callback}))},update:update,set:set,setBlockHandler:setBlockHandler,get:get,getBlockHandler:getBlockHandler,store:{get:get,getBlockHandler:getBlockHandler,update:update,set:set,setBlockHandler:setBlockHandler},getBlockData:function(_ref3){var key=_ref3.key,_ref3$blockKey=_ref3.blockKey,blockKey=void 0===_ref3$blockKey?state.focusedBlock:_ref3$blockKey;return state[blockHandlerKey(key,blockKey)]},setBlockData:function(_ref2){var key=_ref2.key,_ref2$blockKey=_ref2.blockKey,blockKey=void 0===_ref2$blockKey?state.focusedBlock:_ref2$blockKey,item=_ref2.item;_setSingle(blockHandlerKey(key,blockKey),item)},subscribeOnBlock:function(_ref){var key=_ref.key,_ref$blockKey=_ref.blockKey,blockKey=void 0===_ref$blockKey?state.focusedBlock:_ref$blockKey,callback=_ref.callback;return subscribe(blockHandlerKey(key,blockKey),callback)}}},exports.sizeClassName=function(componentData,theme,styles){var size=(componentData.config||{}).size;if(!size)return"";var key="size"+lodash.upperFirst(lodash.camelCase(size));return classNames__default.default(styles[key],theme[key])},exports.textWrapClassName=function(componentData,theme,styles){var textWrap=(componentData.config||{}).textWrap;if(!textWrap)return"";var key="textWrap"+lodash.upperFirst(lodash.camelCase(textWrap));return classNames__default.default(styles[key],theme[key])},exports.uuid=function(){var d=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(c){var r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:3&r|8).toString(16)}))},exports.validate=function(data,schema){return!0},exports.withI18n=function(Component,defaultLocaleResource,_temp){var _ref$forceRemount=(void 0===_temp?{}:_temp).forceRemount,forceRemount=void 0===_ref$forceRemount||_ref$forceRemount,Translated=reactI18next.translate(void 0,{withRef:!0})(Component),I18nWrapper=function(_PureComponent){function I18nWrapper(props){var _this;_this=_PureComponent.call(this,props)||this;var locale=props.locale,localeResource=props.localeResource;return _this.i18n=i18n({locale:locale,localeResource:localeResource}),_this.state={key:I18nWrapper.displayName+"-"+locale},_this}_inheritsLoose__default.default(I18nWrapper,_PureComponent);var _proto=I18nWrapper.prototype;return _proto.componentDidMount=function(){var _componentDidMount=_asyncToGenerator__default.default(_regeneratorRuntime__default.default.mark((function _callee(){var _yield$this$getResour,locale,localeResource;return _regeneratorRuntime__default.default.wrap((function(_context){for(;;)switch(_context.prev=_context.next){case 0:if("en"===this.props.locale){_context.next=7;break}return _context.next=3,this.getResourceByLocale(this.props.locale);case 3:_yield$this$getResour=_context.sent,locale=_yield$this$getResour.locale,localeResource=_yield$this$getResour.localeResource,this.changeLocale({locale:locale,localeResource:localeResource});case 7:case"end":return _context.stop()}}),_callee,this)})));return function(){return _componentDidMount.apply(this,arguments)}}(),_proto.componentWillReceiveProps=function(nextProps){this.props.locale!==nextProps.locale&&this.changeLocale(nextProps)},_proto.getResourceByLocale=function(){var _getResourceByLocale=_asyncToGenerator__default.default(_regeneratorRuntime__default.default.mark((function _callee2(locale){var localeResource;return _regeneratorRuntime__default.default.wrap((function(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:return _context2.prev=0,_context2.next=3,function(t){return Promise.resolve().then((function(){return _interopNamespace(require(t))}))}(
/* webpackChunkName: "messages_[request]" */
"wix-rich-content-common/dist/statics/locale/messages_"+locale+".json").then((function(res){return res.default}));case 3:return localeResource=_context2.sent,_context2.abrupt("return",{locale:locale,localeResource:localeResource});case 7:throw _context2.prev=7,_context2.t0=_context2.catch(0),new Error("error while loading locale "+locale+":\n"+_context2.t0);case 10:case"end":return _context2.stop()}}),_callee2,null,[[0,7]])})));return function(_x){return _getResourceByLocale.apply(this,arguments)}}(),_proto.changeLocale=function(_ref2){var _this2=this,locale=_ref2.locale,localeResource=_ref2.localeResource;this.i18n.addResourceBundle(locale,"translation",localeResource),this.i18n.changeLanguage(locale,(function(err){err||(forceRemount?_this2.setState({key:I18nWrapper.displayName+"-"+_this2.i18n.language}):_this2.forceUpdate())}))},_proto.render=function(){var _this$props=this.props,forwardedRef=_this$props.forwardedRef,rest=_objectWithoutPropertiesLoose__default.default(_this$props,_excluded);return React__default.default.createElement(reactI18next.I18nextProvider,{i18n:this.i18n},React__default.default.createElement(Translated,Object.assign({key:this.state.key},rest,{ref:forwardedRef})))},I18nWrapper}(React.PureComponent);return I18nWrapper.defaultProps={locale:"en",localeResource:defaultLocaleResource},I18nWrapper.displayName=createHocName("I18nWrapper",Component),React__default.default.forwardRef((function(props,ref){return React__default.default.createElement(I18nWrapper,Object.assign({},props,{forwardedRef:ref}))}))},Object.keys(ricosContent).forEach((function(k){"default"===k||exports.hasOwnProperty(k)||Object.defineProperty(exports,k,{enumerable:!0,get:function(){return ricosContent[k]}})}));
"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"),_asyncToGenerator=require("@babel/runtime/helpers/asyncToGenerator"),_regeneratorRuntime=require("@babel/runtime/regenerator"),lodash=require("lodash"),wixRichContentCommon=require("wix-rich-content-common"),React=require("react"),_inheritsLoose=require("@babel/runtime/helpers/inheritsLoose"),classNames=require("classnames"),pluginLinkSchema=require("wix-rich-content-common/dist/statics/schemas/plugin-link.schema.json"),_createClass=require("@babel/runtime/helpers/createClass"),toDraftData=require("ricos-content/libs/toDraftData");function _interopDefaultLegacy(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("uuid");var _ref7,_ref6,_ref3,_ref,_extends__default=_interopDefaultLegacy(_extends),_objectWithoutPropertiesLoose__default=_interopDefaultLegacy(_objectWithoutPropertiesLoose),_asyncToGenerator__default=_interopDefaultLegacy(_asyncToGenerator),_regeneratorRuntime__default=_interopDefaultLegacy(_regeneratorRuntime),React__default=_interopDefaultLegacy(React),_inheritsLoose__default=_interopDefaultLegacy(_inheritsLoose),classNames__default=_interopDefaultLegacy(classNames),pluginLinkSchema__default=_interopDefaultLegacy(pluginLinkSchema),_createClass__default=_interopDefaultLegacy(_createClass),DEFAULTS$1={config:{alignment:"center",size:"content",link:{target:"_blank",rel:""}}},LINK_PREVIEW_TYPE="wix-draft-plugin-link-preview",addLinkPreview=(_ref=_asyncToGenerator__default.default(_regeneratorRuntime__default.default.mark((function _callee(editorState,config,blockKey,linkData){var _ref2,_ref2$enableEmbed,enableEmbed,_ref2$enableLinkPrevi,enableLinkPreview,fetchData,linkPreview,title,html,fixedUrl,linkPreviewData;return _regeneratorRuntime__default.default.wrap((function(_context){for(;;)switch(_context.prev=_context.next){case 0:return _ref2=config[LINK_PREVIEW_TYPE]||{},_ref2$enableEmbed=_ref2.enableEmbed,enableEmbed=void 0===_ref2$enableEmbed||_ref2$enableEmbed,_ref2$enableLinkPrevi=_ref2.enableLinkPreview,enableLinkPreview=void 0===_ref2$enableLinkPrevi||_ref2$enableLinkPrevi,fetchData=_ref2.fetchData,_context.next=3,fetchLinkPreview(fetchData,linkData.url);case 3:if(_context.t0=_context.sent,_context.t0){_context.next=6;break}_context.t0={};case 6:if(linkPreview=_context.t0,title=linkPreview.title,html=linkPreview.html,fixedUrl=linkPreview.fixedUrl,!shouldAddEmbed(html,enableEmbed,fixedUrl)&&!shouldAddLinkPreview(title,enableLinkPreview)){_context.next=13;break}return _context.next=11,createLinkPreviewData(linkData,linkPreview,config[LINK_PREVIEW_TYPE]);case 11:linkPreviewData=_context.sent,addLinkPreviewBlock(editorState,config,blockKey,linkPreviewData);case 13:case"end":return _context.stop()}}),_callee)}))),function(_x,_x2,_x3,_x4){return _ref.apply(this,arguments)}),fetchLinkPreview=(_ref3=_asyncToGenerator__default.default(_regeneratorRuntime__default.default.mark((function _callee2(fetchData,url){var fixedUrl,_ref4,thumbnail_url,title,description,html;return _regeneratorRuntime__default.default.wrap((function(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:return fixedUrl=url.split("↵").join(""),_context2.next=3,null==fetchData?void 0:fetchData(fixedUrl);case 3:if(_context2.t0=_context2.sent,_context2.t0){_context2.next=6;break}_context2.t0={};case 6:return _ref4=_context2.t0,thumbnail_url=_ref4.thumbnail_url,title=_ref4.title,description=_ref4.description,html=_ref4.html,_context2.abrupt("return",{thumbnailUrl:thumbnail_url,title:title,description:description,html:html,fixedUrl:fixedUrl});case 12:case"end":return _context2.stop()}}),_callee2)}))),function(_x5,_x6){return _ref3.apply(this,arguments)}),createLinkPreviewData=(_ref6=_asyncToGenerator__default.default(_regeneratorRuntime__default.default.mark((function _callee3(linkData,_ref5,linkPreviewConfig){var thumbnailUrl,title,description,html,fixedUrl,currentConfig,data;return _regeneratorRuntime__default.default.wrap((function(_context3){for(;;)switch(_context3.prev=_context3.next){case 0:if(thumbnailUrl=_ref5.thumbnailUrl,title=_ref5.title,description=_ref5.description,html=_ref5.html,fixedUrl=_ref5.fixedUrl,currentConfig=_extends__default.default({},DEFAULTS$1,linkPreviewConfig).config,data={config:_extends__default.default({},currentConfig,{link:_extends__default.default({},currentConfig.link,lodash.pickBy(linkData),{url:fixedUrl}),width:html&&350}),thumbnail_url:thumbnailUrl,title:title,description:description,html:html},_context3.t0=thumbnailUrl,!_context3.t0){_context3.next=8;break}return _context3.next=7,isValidImgSrc(thumbnailUrl);case 7:_context3.t0=_context3.sent;case 8:if(!_context3.t0){_context3.next=10;break}data.thumbnail_url=thumbnailUrl;case 10:return _context3.abrupt("return",data);case 11:case"end":return _context3.stop()}}),_callee3)}))),function(_x7,_x8,_x9){return _ref6.apply(this,arguments)}),addLinkPreviewBlock=(_ref7=_asyncToGenerator__default.default(_regeneratorRuntime__default.default.mark((function _callee4(editorState,config,blockKey,linkPreviewData){var setEditorState,withoutLinkBlock,_createBlock,newEditorState;return _regeneratorRuntime__default.default.wrap((function(_context4){for(;;)switch(_context4.prev=_context4.next){case 0:setEditorState=config.setEditorState,withoutLinkBlock=wixRichContentEditorCommon.deleteBlockText(editorState,blockKey),_createBlock=wixRichContentEditorCommon.createBlock(withoutLinkBlock,linkPreviewData,LINK_PREVIEW_TYPE),newEditorState=_createBlock.newEditorState,setEditorState(newEditorState);case 4:case"end":return _context4.stop()}}),_callee4)}))),function(_x10,_x11,_x12,_x13){return _ref7.apply(this,arguments)}),isValidImgSrc=function(url){return new Promise((function(resolve){var image=document.createElement("img");image.src=url,image.onload=function(){resolve(!0)},image.onerror=function(){resolve(!1)}}))},shouldAddLinkPreview=function(title,enableLinkPreview){return enableLinkPreview&&title},shouldAddEmbed=function(html,enableEmbed,url){return Array.isArray(enableEmbed)?enableEmbed.filter((function(whiteListType){return url.toLowerCase().includes(whiteListType.toLowerCase())})).length>0:html&&enableEmbed},styles={fontElementMap:"_35ss-",link:"_3Bkfb",linkInEditor:"_35evZ",linkInViewer:"_1lsz7",toolbarUrlContainer:"_10766",toolbarUrl:"_t6Zq",toolbarUrlAnchor:"_3WEE2"},LinkViewer=function(_Component){function LinkViewer(props){var _this;(_this=_Component.call(this,props)||this).handleClick=function(event){var _this$props=_this.props,componentData=_this$props.componentData,isInEditor=_this$props.isInEditor,config=_this$props.config,helpers=_this$props.helpers,customAnchorScroll=_this$props.customAnchorScroll,settings=null==config?void 0:config.LINK;if(settings){var _helpers$onViewerActi,onClick=settings.onClick,anchor=componentData.anchor,url=componentData.url;if(null==helpers||null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,"LINK","Click",componentData),null==onClick||onClick(event,(null==componentData?void 0:componentData.customData)||_this.getHref(url,anchor)),anchor&&(event.stopPropagation(),!isInEditor))if(event.preventDefault(),customAnchorScroll)customAnchorScroll(event,anchor);else{var anchorString="viewer-"+anchor,element=document.getElementById(anchorString);wixRichContentCommon.addAnchorTagToUrl(anchorString),wixRichContentCommon.anchorScroll(element,_this.context.experiments)}}},_this.resolveUrl=function(url){return wixRichContentCommon.isValidTelUrl(url)?url:wixRichContentCommon.normalizeUrl(url)},_this.getHref=function(url,anchor){return url?_this.resolveUrl(url):"#viewer-"+anchor},wixRichContentCommon.validate(props.componentData,pluginLinkSchema__default.default);var theme=_this.props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles,theme:theme}),_this}_inheritsLoose__default.default(LinkViewer,_Component);var _proto=LinkViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){lodash.isEqual(nextProps.componentData,this.props.componentData)||wixRichContentCommon.validate(nextProps.componentData,pluginLinkSchema__default.default)},_proto.render=function(){var _classNames,_this$props2=this.props,componentData=_this$props2.componentData,anchorTarget=_this$props2.anchorTarget,children=_this$props2.children,isInEditor=_this$props2.isInEditor,url=componentData.url,anchor=componentData.anchor,_componentData$target=componentData.target,target=void 0===_componentData$target?anchorTarget:_componentData$target,rel=componentData.rel,anchorProps={href:this.getHref(url,anchor),target:anchor?"_self":target,rel:wixRichContentCommon.getRelValue(rel),className:classNames__default.default(this.styles.link,(_classNames={},_classNames[this.styles.linkInEditor]=isInEditor,_classNames[this.styles.linkInViewer]=!isInEditor,_classNames)),onClick:this.handleClick},dataHook=anchor?wixRichContentCommon.ANCHOR_VIEWER_DATA_HOOK:wixRichContentCommon.LINK_VIEWER_DATA_HOOK;return React__default.default.createElement("a",_extends__default.default({"data-hook":dataHook},anchorProps),children)},LinkViewer}(React.Component);LinkViewer.contextType=wixRichContentCommon.GlobalContext;var linkEntityStrategy=function(contentBlock,callback,contentState){contentBlock.findEntityRanges((function(character){var entityKey=character.getEntity();if(null!==entityKey){var entityType=contentState.getEntity(entityKey).getType();return"LINK"===entityType||"ricos-plugin-custom-link"===entityType}return!1}),callback)},TextLinkButton=function(_Component){function TextLinkButton(){for(var _this,_len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return(_this=_Component.call.apply(_Component,[this].concat(args))||this).showLinkPanel=function(){var _this$props=_this.props,getEditorState=_this$props.getEditorState,setEditorState=_this$props.setEditorState,getEntityData=_this$props.getEntityData,insertCustomLink=_this$props.insertCustomLink,settings=_this$props.config.LINK,onLinkAdd=null==settings?void 0:settings.onLinkAdd;if(onLinkAdd){var _getEntityData;onLinkAdd(null===(_getEntityData=getEntityData(getEditorState()))||void 0===_getEntityData?void 0:_getEntityData.customData,(function(data){return setEditorState(insertCustomLink(getEditorState(),data))}))}else _this.openLinkPanel()},_this.openLinkPanel=function(){var _this$props2=_this.props,getEditorState=_this$props2.getEditorState,setEditorState=_this$props2.setEditorState,theme=_this$props2.theme,isMobile=_this$props2.isMobile,linkModal=_this$props2.linkModal,helpers=_this$props2.helpers,keyName=_this$props2.keyName,anchorTarget=_this$props2.anchorTarget,relValue=_this$props2.relValue,t=_this$props2.t,uiSettings=_this$props2.uiSettings,insertLinkFn=_this$props2.insertLinkFn,closeInlinePluginToolbar=_this$props2.closeInlinePluginToolbar,config=_this$props2.config,innerModal=_this$props2.innerModal,toolbarOffsetTop=_this$props2.toolbarOffsetTop,toolbarOffsetLeft=_this$props2.toolbarOffsetLeft,settings=config.LINK,linkTypes=null==settings?void 0:settings.linkTypes,OriginalLinkPanel=!linkTypes||lodash.isEmpty(linkTypes)||!Object.values(linkTypes).find((function(addon){return!!addon})),_ref$externalPopups=(uiSettings.linkPanel||{}).externalPopups,externalPopups=void 0!==_ref$externalPopups&&_ref$externalPopups,customStyles=isMobile||OriginalLinkPanel?{content:{position:"fixed"}}:{content:{width:512,maxWidth:512,height:390,border:"1px solid rgb(237, 237, 237)",borderRadius:"6px",boxShadow:"rgba(0, 0, 0, 0.07) 0px 4px 8px 0px",padding:20}},modalStyles=wixRichContentEditorCommon.getModalStyles({fullScreen:isMobile,isMobile:isMobile,customStyles:customStyles}),commonPanelProps={helpers:helpers,modalName:wixRichContentEditorCommon.EditorModals.TEXT_LINK_MODAL,anchorTarget:anchorTarget,relValue:relValue,theme:theme,t:t,uiSettings:uiSettings,getEditorState:getEditorState,setEditorState:setEditorState,insertLinkFn:insertLinkFn,closeInlinePluginToolbar:closeInlinePluginToolbar,linkTypes:linkTypes};if(externalPopups||isMobile||linkModal)if(helpers&&helpers.openModal){var modalProps=_extends__default.default({modalStyles:modalStyles,hidePopup:helpers.closeModal,isMobile:isMobile},commonPanelProps);helpers.openModal(modalProps)}else console.error("Open external helper function is not defined for toolbar button with keyName "+keyName);else{var _modalProps=_extends__default.default({hidePopup:innerModal.closeInnerModal,top:toolbarOffsetTop,left:toolbarOffsetLeft,modalStyles:OriginalLinkPanel?null:{maxWidth:"none",padding:20}},commonPanelProps);innerModal.openInnerModal(_modalProps)}},_this}return _inheritsLoose__default.default(TextLinkButton,_Component),TextLinkButton.prototype.render=function(){var _config$LINK,_config$LINK$toolbar,_config$LINK$toolbar$,_this$props3=this.props,theme=_this$props3.theme,helpers=_this$props3.helpers,isMobile=_this$props3.isMobile,tabIndex=_this$props3.tabIndex,config=_this$props3.config,isActive=_this$props3.isActive,icon=_this$props3.icon,tooltipText=_this$props3.tooltipText,disabled=_this$props3.disabled,buttonStyles={button:theme.inlineToolbarButton,buttonWrapper:theme.inlineToolbarButton_wrapper,icon:theme.inlineToolbarButton_icon,active:theme.inlineToolbarButton_active},insertLinkIcon=(null==config||null===(_config$LINK=config.LINK)||void 0===_config$LINK||null===(_config$LINK$toolbar=_config$LINK.toolbar)||void 0===_config$LINK$toolbar||null===(_config$LINK$toolbar$=_config$LINK$toolbar.icons)||void 0===_config$LINK$toolbar$?void 0:_config$LINK$toolbar$.InsertPluginButtonIcon)||icon;return React__default.default.createElement(wixRichContentEditorCommon.LinkButton,{onClick:this.showLinkPanel,isActive:isActive,helpers:helpers,theme:_extends__default.default({},theme,buttonStyles),isMobile:isMobile,tooltipText:tooltipText,tabIndex:tabIndex,pluginType:"LINK",icon:insertLinkIcon,disabled:disabled})},_createClass__default.default(TextLinkButton,[{key:"isActive",get:function(){return wixRichContentEditorCommon.hasLinksInSelection(this.props.getEditorState())}}]),TextLinkButton}(React.Component),RemoveLinkIcon=function(props){return React__default.default.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",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:"remove-link",d:"M7.8 6c.11 0 .2.09.2.2v.807H4.5c-1.38 0-2.5 1.12-2.5 2.5 0 1.326 1.032 2.41 2.336 2.495l.164.005H8v.793c0 .11-.09.2-.2.2H4.5C2.567 13 1 11.433 1 9.5S2.567 6 4.5 6h3.3zm5.7 0C15.433 6 17 7.567 17 9.5S15.433 13 13.5 13h-3.3c-.11 0-.2-.09-.2-.2v-.807h3.5c1.38 0 2.5-1.12 2.5-2.5 0-1.381-1.12-2.5-2.5-2.5H10V6.2c0-.11.09-.2.2-.2h3.3zm-1.7 3c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H6.2c-.11 0-.2-.09-.2-.2v-.6c0-.11.09-.2.2-.2h5.6z"})),React__default.default.createElement("g",{fill:"none",fillRule:"evenodd"},React__default.default.createElement("use",{fill:"currentColor",transform:"rotate(-45 9 9.5)",xlinkHref:"#remove-link"}),React__default.default.createElement("path",{stroke:"currentColor",strokeLinecap:"square",d:"M3.5 3.5l11 12"})))},RemoveLinkButton=function(_Component){function RemoveLinkButton(){for(var _this,_len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return(_this=_Component.call.apply(_Component,[this].concat(args))||this).deleteLink=function(){var _this$props=_this.props,getEditorState=_this$props.getEditorState,setEditorState=_this$props.setEditorState,closeInlinePluginToolbar=_this$props.closeInlinePluginToolbar;setEditorState(wixRichContentEditorCommon.removeLinksInSelection(getEditorState(),setEditorState)),closeInlinePluginToolbar()},_this}return _inheritsLoose__default.default(RemoveLinkButton,_Component),RemoveLinkButton.prototype.render=function(){var _this$props2=this.props,theme=_this$props2.theme,helpers=_this$props2.helpers,isMobile=_this$props2.isMobile,t=_this$props2.t,tabIndex=_this$props2.tabIndex,linkButtonTooltip=t("LinkPanelContainer_RemoveButton"),buttonStyles={button:theme.inlineToolbarButton,buttonWrapper:theme.inlineToolbarButton_wrapper,icon:theme.inlineToolbarButton_icon,active:theme.inlineToolbarButton_active};return React__default.default.createElement(wixRichContentEditorCommon.InlineToolbarButton,{onClick:this.deleteLink,helpers:helpers,theme:_extends__default.default({},theme,buttonStyles),isMobile:isMobile,tooltipText:linkButtonTooltip,tabIndex:tabIndex,icon:RemoveLinkIcon,dataHook:"RemoveLinkButton",pluginType:"LINK"})},RemoveLinkButton}(React.Component),UrlLinkButton=function(_Component){function UrlLinkButton(props){var _this;(_this=_Component.call(this,props)||this).handleClick=function(event){var _this$props=_this.props,getEditorState=_this$props.getEditorState,customAnchorScroll=_this$props.customAnchorScroll,_ref$anchor=(wixRichContentEditorCommon.getLinkDataInSelection(getEditorState())||{}).anchor,anchor=void 0===_ref$anchor?"":_ref$anchor;customAnchorScroll?customAnchorScroll(event,anchor):wixRichContentEditorCommon.scrollToBlock(anchor,_this.context.experiments)},_this.preventDefault=function(event){return event.preventDefault()};var theme=_this.props.theme;return _this.styles=wixRichContentCommon.mergeStyles({styles:styles,theme:theme}),_this}return _inheritsLoose__default.default(UrlLinkButton,_Component),UrlLinkButton.prototype.render=function(){var _classNames,styles=this.styles,_this$props2=this.props,getEditorState=_this$props2.getEditorState,t=_this$props2.t,_ref2=wixRichContentEditorCommon.getLinkDataInSelection(getEditorState())||{},_ref2$url=_ref2.url,url=void 0===_ref2$url?"":_ref2$url,anchor=_ref2.anchor,target=_ref2.target,rel=_ref2.rel,href=url?wixRichContentCommon.normalizeUrl(url):void 0,anchorProps={href:href,target:target,rel:wixRichContentCommon.getRelValue(rel),className:classNames__default.default(styles.toolbarUrl,(_classNames={},_classNames[styles.toolbarUrlAnchor]=anchor,_classNames)),onMouseDown:this.preventDefault,onClick:anchor&&this.handleClick};return React__default.default.createElement("div",{className:styles.toolbarUrlContainer},React__default.default.createElement("a",anchorProps,href||t("LinkTo_Toolbar_GoTo")))},UrlLinkButton}(React.Component);UrlLinkButton.contextType=wixRichContentCommon.GlobalContext;var createInlineButtons=function(config){return[{keyName:"url",component:function(props){return React__default.default.createElement(UrlLinkButton,Object.assign({},config,props))},mobile:!0,type:wixRichContentPluginCommons.BUTTONS.CUSTOM},{keyName:"separator1",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!0},{keyName:"edit",component:function(props){return React__default.default.createElement("div",{"data-hook":"EditLinkButton",style:{margin:"0 2px 0 -7px"}},React__default.default.createElement(TextLinkButton,Object.assign({insertLinkFn:wixRichContentEditorCommon.updateLinkAtCurrentSelection,getEntityData:wixRichContentEditorCommon.getEntityData,insertCustomLink:wixRichContentEditorCommon.insertCustomLink,icon:wixRichContentPluginCommons.EditIcon,tooltipText:config.t("LinkTo_Edit_Tooltip")},config,props)))},mobile:!0,type:wixRichContentPluginCommons.BUTTONS.CUSTOM},{keyName:"separator2",type:wixRichContentPluginCommons.BUTTONS.SEPARATOR,mobile:!0},{keyName:"remove",component:function(props){return React__default.default.createElement("div",{style:{margin:"0 -6px 0 -6px"}},React__default.default.createElement(RemoveLinkButton,Object.assign({},config,props)))},mobile:!0,type:wixRichContentPluginCommons.BUTTONS.CUSTOM}]},openLinkModal=function(_ref){var helpers=_ref.helpers,isMobile=_ref.isMobile,anchorTarget=_ref.anchorTarget,relValue=_ref.relValue,t=_ref.t,theme=_ref.theme,getEditorState=_ref.getEditorState,setEditorState=_ref.setEditorState,uiSettings=_ref.uiSettings,closeInlinePluginToolbar=_ref.closeInlinePluginToolbar,settings=_ref.settings,modalStyles=wixRichContentEditorCommon.getModalStyles({fullScreen:isMobile,isMobile:isMobile,customStyles:isMobile?{content:{position:"fixed"}}:{content:{maxWidth:"max-content",padding:20}}});if(helpers&&helpers.openModal){var modalProps={helpers:helpers,modalStyles:modalStyles,isMobile:isMobile,getEditorState:getEditorState,setEditorState:setEditorState,t:t,theme:theme,anchorTarget:anchorTarget,relValue:relValue,modalName:wixRichContentEditorCommon.EditorModals.TEXT_LINK_MODAL,hidePopup:helpers.closeModal,uiSettings:uiSettings,insertLinkFn:wixRichContentEditorCommon.insertLinkAtCurrentSelection,closeInlinePluginToolbar:closeInlinePluginToolbar,linkTypes:null==settings?void 0:settings.linkTypes};helpers.openModal(modalProps)}else console.error("Link plugin: failed to display Link modal dialog since helpers.openModal is not defined")},DEFAULTS={config:{linkTypes:{anchor:!0}}};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 createLinkPlugin=function(config){var type="LINK",theme=config.theme,anchorTarget=config.anchorTarget,relValue=config.relValue,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,commonPubsub=config.commonPubsub,rest=_objectWithoutPropertiesLoose__default.default(config,["theme","anchorTarget","relValue",type,"commonPubsub"].map(_toPropertyKey)),target=anchorTarget,rel=relValue;settings.minLinkifyLength=settings.minLinkifyLength||6;var linkifyData,prevContentState,toolbar=function(config){var _config$LINK_TYPE2,_config$LINK_TYPE2$to,isDisabled=function(){return wixRichContentEditorCommon.isAtomicBlockInSelection(config.getEditorState())},getTooltip=function(){return config.t(isDisabled()?"TextLinkButton_DisableButtonForPlugins_Tooltip":"TextLinkButton_Tooltip")};return _extends__default.default({TextButtonMapper:function(){var _ref2;return(_ref2={})[wixRichContentEditorCommon.FORMATTING_BUTTONS.LINK]={component:function(props){return React__default.default.createElement(TextLinkButton,Object.assign({insertLinkFn:wixRichContentEditorCommon.insertLinkAtCurrentSelection,getEntityData:wixRichContentEditorCommon.getEntityData,insertCustomLink:wixRichContentEditorCommon.insertCustomLink,isActive:wixRichContentEditorCommon.hasLinksInSelection(config.getEditorState()),closeInlinePluginToolbar:config.closeInlinePluginToolbar,tooltipText:getTooltip(),innerModal:config.innerModal,disabled:isDisabled()},props))},keyBindings:[{keyCommand:{command:wixRichContentEditorCommon.COMMANDS.LINK,modifiers:[wixRichContentEditorCommon.MODIFIERS.COMMAND],key:"k"},commandHandler:function(editorState){if(config.onKeyboardShortcutClick({buttonName:wixRichContentEditorCommon.COMMANDS.LINK,pluginId:"LINK"}),wixRichContentEditorCommon.hasLinksInSelection(editorState))return config.closeInlinePluginToolbar(),wixRichContentEditorCommon.removeLinksInSelection(editorState);isDisabled()||openLinkModal(config)}}],externalizedButtonProps:{onClick:function(e){e.preventDefault(),openLinkModal(config)},isActive:function(){return wixRichContentEditorCommon.hasLinksInSelection(config.getEditorState())},isDisabled:isDisabled,getIcon:function(){var _config$LINK_TYPE,_config$LINK_TYPE$too,_config$LINK_TYPE$too2;return(null===(_config$LINK_TYPE=config.LINK)||void 0===_config$LINK_TYPE||null===(_config$LINK_TYPE$too=_config$LINK_TYPE.toolbar)||void 0===_config$LINK_TYPE$too||null===(_config$LINK_TYPE$too2=_config$LINK_TYPE$too.icons)||void 0===_config$LINK_TYPE$too2?void 0:_config$LINK_TYPE$too2.InsertPluginButtonIcon)||function(){var _config$experiments,_config$experiments$n;return wixRichContentEditorCommon.LinkIcon({newFormattingToolbar:null==config||null===(_config$experiments=config.experiments)||void 0===_config$experiments||null===(_config$experiments$n=_config$experiments.newFormattingToolbar)||void 0===_config$experiments$n?void 0:_config$experiments$n.enabled})}},tooltip:getTooltip(),getLabel:function(){return""},type:wixRichContentEditorCommon.BUTTON_TYPES.BUTTON}},_ref2}},!1===(null===(_config$LINK_TYPE2=config.LINK)||void 0===_config$LINK_TYPE2||null===(_config$LINK_TYPE2$to=_config$LINK_TYPE2.toolbar)||void 0===_config$LINK_TYPE2$to?void 0:_config$LINK_TYPE2$to.inlineToolbar)?{}:{InlinePluginToolbarButtons:createInlineButtons(config)},{name:"link"})}(_extends__default.default({},config,{settings:settings,closeInlinePluginToolbar:closeInlinePluginToolbar})),decorators=[{strategy:linkEntityStrategy,component:function(props){var componentData=null==props?void 0:props.contentState.getEntity(null==props?void 0:props.entityKey).getData();return React__default.default.createElement(LinkViewer,Object.assign({componentData:componentData,anchorTarget:anchorTarget,relValue:relValue,theme:theme},props))}}],shouldConvertToLinkPreview=function(linkifyData){var _linkifyData$block;return linkifyData&&"unstyled"===(null===(_linkifyData$block=linkifyData.block)||void 0===_linkifyData$block?void 0:_linkifyData$block.getType())&&config[LINK_PREVIEW_TYPE]},getBlockLinkUrl=function(linkifyData){var string=linkifyData.string;if(linkifyData.block.getText()===string)return string};function closeInlinePluginToolbar(){commonPubsub.set("cursorOnInlinePlugin",null)}var getLinkifyData=function(editorState){var strData=findLastStringWithNoSpacesAndSoftLines(editorState);return shouldLinkify(strData)?strData:void 0},shouldLinkify=function(consecutiveString){return consecutiveString.string.length>=settings.minLinkifyLength&&wixRichContentCommon.isValidUrl(consecutiveString.string)&&!(rangeContainsEntity(consecutiveString)&&blockContainsPlainText(consecutiveString))&&!(null!=settings&&settings.disableAutoLink)},findLastStringWithNoSpacesAndSoftLines=function(editorState){var selection=editorState.getSelection(),blockKey=selection.getAnchorKey(),block=editorState.getCurrentContent().getBlockForKey(blockKey),text=block.getText(),endIndex=selection.getEndOffset(),spaceIndex=text.lastIndexOf(" ",endIndex)+1,softLineIndex=text.lastIndexOf("\n",endIndex)+1,index=Math.max(spaceIndex,softLineIndex);return{string:text.slice(index,endIndex),block:block,blockKey:blockKey,index:index,endIndex:endIndex}},rangeContainsEntity=function(_ref){for(var block=_ref.block,index=_ref.index,endIndex=_ref.endIndex,i=index;i<endIndex;i++)if(null!==block.getEntityAt(i))return!0;return!1},blockContainsPlainText=function(_ref2){var block=_ref2.block,string=_ref2.string;return block.getText().length>string.length},addLinkAt=function(_ref3,editorState){var string=_ref3.string,index=_ref3.index,endIndex=_ref3.endIndex,blockKey=_ref3.blockKey;return wixRichContentEditorCommon.insertLinkInPosition(editorState,blockKey,index,endIndex,{url:string,rel:rel,target:target})};return wixRichContentPluginCommons.createBasePlugin(_extends__default.default({theme:theme,toolbar:toolbar,type:type,anchorTarget:anchorTarget,relValue:relValue,settings:settings,commonPubsub:commonPubsub,defaultPluginData:DEFAULTS},rest),{decorators:decorators,handleBeforeInput:function(chars,editorState,eventTimeStamp,pluginFunctions){return/\s/.test(chars)&&(linkifyData=getLinkifyData(editorState)),"not-handled"},handleReturn:function(event,editorState,pluginFunctions){if(linkifyData=getLinkifyData(editorState),shouldConvertToLinkPreview(linkifyData)){var _linkifyData,url=getBlockLinkUrl(linkifyData),blockKey=null===(_linkifyData=linkifyData)||void 0===_linkifyData?void 0:_linkifyData.block.getKey();if(url&&blockKey){var linkData=wixRichContentEditorCommon.createLinkEntityData({url:url,target:target,rel:rel});addLinkPreview(editorState,config,blockKey,linkData)}}return"not-handled"},onChange:function(editorState){var selection=editorState.getSelection();wixRichContentEditorCommon.hasLinksInSelection(editorState)&&selection.isCollapsed()&&selection.getHasFocus()?setTimeout((function(){var commonPubsubData,boundingRect=wixRichContentEditorCommon.getVisibleSelectionRect(window);commonPubsubData={type:type,boundingRect:boundingRect},commonPubsub.set("cursorOnInlinePlugin",commonPubsubData)})):closeInlinePluginToolbar();var newEditorState=editorState;return!function(editorState){var contentState=editorState.getCurrentContent(),contentChanged=contentState!==prevContentState;return prevContentState=contentState,contentChanged&&"insert-fragment"===editorState.getLastChangeType()}(editorState)?linkifyData&&(newEditorState=addLinkAt(linkifyData,editorState)):newEditorState=wixRichContentEditorCommon.fixPastedLinks(editorState,{anchorTarget:anchorTarget,relValue:relValue}),linkifyData=void 0,newEditorState}})};createLinkPlugin.functionName="LINK";var createLinkData=function(pluginData,isRicosSchema){return void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1),isRicosSchema?toDraftData.convertDecorationDataToDraft("LINK",pluginData):pluginData},linkDataDefaults_linkData={link:{target:"SELF",url:"",anchor:"",rel:{nofollow:null,sponsored:null,ugc:null},customData:null}},urlRegex=/(?:https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)/gi,urlRegexExact=new RegExp("^"+urlRegex.source+"$","gi"),urlRegexExactWithSpace=new RegExp("^"+urlRegex.source+"[\\s\\n]$","gi"),linkifyLastWord=function(_ref){var _text$match,editor=_ref.editor,_editor$state$selecti=editor.state.selection.$from,nodeBefore=_editor$state$selecti.nodeBefore,pos=_editor$state$selecti.pos,_ref2=nodeBefore||{},text=_ref2.text,nodeBeforeSize=_ref2.nodeSize,url=null==text||null===(_text$match=text.match(urlRegex))||void 0===_text$match?void 0:_text$match[0],urlIndex=text?text.search(urlRegex):-1;if(nodeBeforeSize&&url&&-1!==urlIndex){var from=pos-nodeBeforeSize+urlIndex;editor.chain().focus().setTextSelection({from:from,to:pos}).setLink({link:{url:url}}).setTextSelection(pos).run()}return!1},createTiptapExtensions=function(defaultOptions){return[{type:"mark",createExtensionConfig:function(_ref3){var markPasteRule=_ref3.markPasteRule,markInputRule=_ref3.markInputRule,Plugin=_ref3.Plugin,PluginKey=_ref3.PluginKey;return{name:"link",priority:1e3,inclusive:!1,defaultOptions:_extends__default.default({openOnClick:!0,linkOnPaste:!0,HTMLAttributes:{link:{}}},defaultOptions),addAttributes:function(){return linkDataDefaults_linkData},parseHTML:function(){return[{tag:"a[href]"}]},renderHTML:function(_ref4){var HTMLAttributes=_ref4.HTMLAttributes,link=styles.link,linkInViewer=styles.linkInViewer,classes=classNames__default.default(link,linkInViewer),_parseLink=function(_ref5){var url=_ref5.url,rel=_ref5.rel,target=_ref5.target,anchor=_ref5.anchor,customData=_ref5.customData;return{anchor:anchor,url:url,rel:rel&&Object.entries(rel).flatMap((function(_ref6){var key=_ref6[0];return _ref6[1]?key:[]})).join(" "),target:target&&"_"+target.toLowerCase(),customData:customData}}(HTMLAttributes.link);return["a",{href:_parseLink.url,rel:_parseLink.rel,target:_parseLink.target,class:classes},0]},addCommands:function(){return{setLink:function(attributes){return function(_ref5){return _ref5.commands.setMark("link",attributes)}},toggleLink:function(attributes){return function(_ref6){return _ref6.commands.toggleMark("link",attributes)}},unsetLink:function(){return function(_ref7){return _ref7.commands.unsetMark("link")}}}},addPasteRules:function(){return[markPasteRule(urlRegex,this.type,(function(match){return{link:{url:match[0]}}}))]},addInputRules:function(){return[markInputRule(urlRegexExactWithSpace,this.type,(function(match){return{link:{url:match[0].trim()}}}))]},addProseMirrorPlugins:function(){var _this=this,plugins=[];return this.options.openOnClick&&plugins.push(new Plugin({key:new PluginKey("handleClickLink"),props:{handleClick:function(view,pos,event){var _event$target,attrs=_this.editor.getAttributes("link");return!(!(null===(_event$target=event.target)||void 0===_event$target?void 0:_event$target.closest("a"))||!attrs.href)&&(window.open(attrs.href,attrs.target),!0)}}})),this.options.linkOnPaste&&plugins.push(new Plugin({key:new PluginKey("handlePasteLink"),props:{handlePaste:function(view,event,slice){if(view.state.selection.empty)return!1;var textContent="";return slice.content.forEach((function(node){textContent+=node.textContent})),!(!textContent||!textContent.match(urlRegexExact))&&(_this.editor.commands.setMark(_this.type,{link:{url:textContent}}),!0)}}})),plugins}}}},{type:"extension",createExtensionConfig:function(){return{name:"linkEnter",addKeyboardShortcuts:function(){return{Enter:linkifyLastWord,Space:linkifyLastWord}}}}}]};exports.EXTERNAL_LINK_TYPE="wix-draft-plugin-external-link",exports.LINK_TYPE="LINK",exports.LinkViewer=LinkViewer,exports.createLinkPlugin=createLinkPlugin,exports.pluginLink=function(config){var pluginConfig=_extends__default.default({},DEFAULTS.config,config);return{config:pluginConfig,type:"LINK",createPlugin:createLinkPlugin,ModalsMap:{},createPluginData:createLinkData,tiptapExtensions:createTiptapExtensions(pluginConfig)}};
//# sourceMappingURL=module.cjs.js.map

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

import{HEADER_BLOCK,RICOS_TEXT_COLOR_TYPE,RICOS_TEXT_HIGHLIGHT_TYPE,RICOS_FONT_SIZE_TYPE,TEXT_COLOR_TYPE,TEXT_HIGHLIGHT_TYPE,RICOS_BOLD_TYPE,RICOS_ITALIC_TYPE}from"ricos-content";export*from"ricos-content";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import React,{Component,PureComponent,useRef,useEffect}from"react";import{InView}from"react-intersection-observer";import classNames from"classnames";import _extends from"@babel/runtime/helpers/extends";import{pickBy,has,mergeWith,upperFirst,camelCase,merge}from"lodash";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";import _regeneratorRuntime from"@babel/runtime/regenerator";import{translate,I18nextProvider,I18n}from"react-i18next";export{Trans,translate}from"react-i18next";import{createInstance}from"i18next";var __assign$r=function(){return(__assign$r=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)};var _DRAFT_TO_RICOS_DOC_T,ButtonType,ModifierKey,ToolbarType,DisplayMode,DecorationMode,baseLink={target:"SELF"},Link_fromJSON=function(object){var message=__assign$r({},baseLink);return void 0!==object.url&&null!==object.url?message.url=String(object.url):message.url=void 0,void 0!==object.anchor&&null!==object.anchor?message.anchor=String(object.anchor):message.anchor=void 0,void 0!==object.target&&null!==object.target?message.target=function(object){switch(object){case 0:case"SELF":return"SELF";case 1:case"BLANK":return"BLANK";case 2:case"PARENT":return"PARENT";case 3:case"TOP":return"TOP";case-1:case"UNRECOGNIZED":default:return"UNRECOGNIZED"}}(object.target):message.target="SELF",void 0!==object.rel&&null!==object.rel?message.rel=Link_Rel.fromJSON(object.rel):message.rel=void 0,void 0!==object.customData&&null!==object.customData?message.customData=String(object.customData):message.customData=void 0,message},Link_toJSON=function(message){var obj={};return void 0!==message.url&&(obj.url=message.url),void 0!==message.anchor&&(obj.anchor=message.anchor),void 0!==message.target&&(obj.target=function(object){switch(object){case"SELF":return"SELF";case"BLANK":return"BLANK";case"PARENT":return"PARENT";case"TOP":return"TOP";default:return"UNKNOWN"}}(message.target)),void 0!==message.rel&&(obj.rel=message.rel?Link_Rel.toJSON(message.rel):void 0),void 0!==message.customData&&(obj.customData=message.customData),obj},baseLink_Rel={},Link_Rel={fromJSON:function(object){var message=__assign$r({},baseLink_Rel);return void 0!==object.nofollow&&null!==object.nofollow?message.nofollow=Boolean(object.nofollow):message.nofollow=void 0,void 0!==object.sponsored&&null!==object.sponsored?message.sponsored=Boolean(object.sponsored):message.sponsored=void 0,void 0!==object.ugc&&null!==object.ugc?message.ugc=Boolean(object.ugc):message.ugc=void 0,message},toJSON:function(message){var obj={};return void 0!==message.nofollow&&(obj.nofollow=message.nofollow),void 0!==message.sponsored&&(obj.sponsored=message.sponsored),void 0!==message.ugc&&(obj.ugc=message.ugc),obj}},__assign$n=function(){return(__assign$n=Object.assign||function(t){for(var s,i=1,n=arguments.length;i<n;i++)for(var p in s=arguments[i])Object.prototype.hasOwnProperty.call(s,p)&&(t[p]=s[p]);return t}).apply(this,arguments)},baseLinkData={},LinkData={fromJSON:function(object){var message=__assign$n({},baseLinkData);return void 0!==object.link&&null!==object.link?message.link=Link_fromJSON(object.link):message.link=void 0,message},toJSON:function(message){var obj={};return void 0!==message.link&&(obj.link=message.link?Link_toJSON(message.link):void 0),obj}},DROPDOWN_OPTIONS_TO_DOC_STYLE_TYPE={P:"paragraph",H1:"headerOne",H2:"headerTwo",H3:"headerThree",H4:"headerFour",H5:"headerFive",H6:"headerSix"},DRAFT_TO_RICOS_DOC_TYPE=((_DRAFT_TO_RICOS_DOC_T={})[HEADER_BLOCK.ONE]="headerOne",_DRAFT_TO_RICOS_DOC_T[HEADER_BLOCK.TWO]="headerTwo",_DRAFT_TO_RICOS_DOC_T[HEADER_BLOCK.THREE]="headerThree",_DRAFT_TO_RICOS_DOC_T[HEADER_BLOCK.FOUR]="headerFour",_DRAFT_TO_RICOS_DOC_T[HEADER_BLOCK.FIVE]="headerFive",_DRAFT_TO_RICOS_DOC_T[HEADER_BLOCK.SIX]="headerSix",_DRAFT_TO_RICOS_DOC_T[HEADER_BLOCK.PARAGRAPH]="paragraph",_DRAFT_TO_RICOS_DOC_T);!function(ButtonType){ButtonType.CUSTOM="custom",ButtonType.FILES="file",ButtonType.TOGGLE="toggle",ButtonType.PANEL="panel",ButtonType.INLINE_PANEL="inline-panel",ButtonType.EXTERNAL_MODAL="external-modal",ButtonType.DROPDOWN="dropdown",ButtonType.SEPARATOR="separator",ButtonType.SIZE_ORIGINAL="size-original",ButtonType.SIZE_CONTENT_CENTER="size-content-center",ButtonType.SIZE_SMALL_CENTER="size-small-center",ButtonType.SIZE_SMALL_LEFT="size-small-left",ButtonType.SIZE_SMALL_RIGHT="size-small-right",ButtonType.ALIGN_LEFT="align-left",ButtonType.ALIGN_RIGHT="align-right",ButtonType.ALIGN_CENTER="align-center",ButtonType.SIZE_CONTENT="size-content",ButtonType.SIZE_FULL_WIDTH="size-full-width",ButtonType.SIZE_SMALL="size-small",ButtonType.SIZE_MEDIUM="size-medium",ButtonType.SIZE_LARGE="size-large",ButtonType.TEXT_ALIGN_LEFT="alignment-left",ButtonType.TEXT_ALIGN_CENTER="alignment-center",ButtonType.TEXT_ALIGN_RIGHT="alignment-right",ButtonType.WIDTH="width",ButtonType.HEIGHT="height",ButtonType.LINK="link",ButtonType.SPOILER="spoiler",ButtonType.DELETE="delete",ButtonType.LINK_PREVIEW="link-preview",ButtonType.VIDEO_SETTINGS="video-settings"}(ButtonType||(ButtonType={})),function(ModifierKey){ModifierKey.COMMAND="command",ModifierKey.CTRL="ctrl",ModifierKey.OPTION="option",ModifierKey.SHIFT="shift",ModifierKey.ALT="alt"}(ModifierKey||(ModifierKey={})),function(ToolbarType){ToolbarType.SIDE="SIDE",ToolbarType.MOBILE="MOBILE",ToolbarType.FOOTER="FOOTER",ToolbarType.STATIC="STATIC",ToolbarType.INLINE="INLINE",ToolbarType.PLUGIN="PLUGIN",ToolbarType.FORMATTING="FORMATTING",ToolbarType.INSERT_PLUGIN="INSERT_PLUGIN",ToolbarType.TEXT="ALL-TEXT-TOOLBARS",ToolbarType.SHORTCUT="SHORTCUT",ToolbarType.LINK="LINK"}(ToolbarType||(ToolbarType={})),function(DisplayMode){DisplayMode.NORMAL="NORMAL",DisplayMode.FLOATING="FLOATING"}(DisplayMode||(DisplayMode={})),function(DecorationMode){DecorationMode.PREPEND="PREPEND",DecorationMode.WRAP="WRAP",DecorationMode.APPEND="APPEND"}(DecorationMode||(DecorationMode={}));var CUSTOM_LINK="custom-link",noOutlineStyle_noOutline="_1-vl0",AccessibilityListener=function(_Component){function AccessibilityListener(){var _this;return(_this=_Component.apply(this,arguments)||this).handleTabKeyUp=function(e){9===e.which&&document.body.classList.contains(noOutlineStyle_noOutline)&&document.body.classList.remove(noOutlineStyle_noOutline)},_this.handleClick=function(){document.body.classList.contains(noOutlineStyle_noOutline)||document.body.classList.add(noOutlineStyle_noOutline)},_this.render=function(){return null},_this}_inheritsLoose(AccessibilityListener,_Component);var _proto=AccessibilityListener.prototype;return _proto.componentDidMount=function(){document.body.classList.add(noOutlineStyle_noOutline),this.props.isMobile||(document.addEventListener("keyup",this.handleTabKeyUp),document.addEventListener("click",this.handleClick))},_proto.componentWillUnmount=function(){this.props.isMobile||(document.removeEventListener("keyup",this.handleTabKeyUp),document.removeEventListener("click",this.handleClick))},AccessibilityListener}(Component),cssClassMerger=function(defaultStyleClassName,themeClassName){return defaultStyleClassName+" "+themeClassName},mergeStyles=function(_ref){var styles=_ref.styles,theme=_ref.theme;if(!theme)return console.warn("mergeStyles invoked without theme!"),styles;var themeStyles=pickBy(theme),themeStylesToMerge=pickBy(themeStyles,(function(_,key){return has(styles,key)}));return mergeWith(_extends({},styles),themeStylesToMerge,cssClassMerger)},isSSR=function(){return"undefined"==typeof window},styles={placeholder:"_2bUeE"},ViewportRenderer=function(_Component){function ViewportRenderer(){return _Component.apply(this,arguments)||this}return _inheritsLoose(ViewportRenderer,_Component),ViewportRenderer.prototype.render=function(){var _this=this,_this$props=this.props,children=_this$props.children,placeholderStyle=_this$props.placeholderStyle,placeholderClass=_this$props.placeholderClass,containerStyle=_this$props.containerStyle,containerClass=_this$props.containerClass,theme=this.props.theme;return this.styles=this.styles||mergeStyles({styles:styles,theme:theme}),isSSR()||void 0===window.IntersectionObserver?children:React.createElement(InView,{triggerOnce:!0},(function(_ref){var inView=_ref.inView,ref=_ref.ref;return inView?React.createElement("div",{ref:ref,style:containerStyle,className:containerClass},children):React.createElement("div",{ref:ref,className:classNames(_this.styles.placeholder,placeholderClass),style:placeholderStyle})}))},ViewportRenderer}(Component);function i18n(_ref){var _resources,locale=_ref.locale,localeResource=_ref.localeResource;return createInstance().init({lng:locale,keySeparator:"$",interpolation:{escapeValue:!1},react:{wait:!0},resources:(_resources={},_resources[locale]={translation:localeResource},_resources)})}function getDisplayName(Component){return Component.displayName||Component.name||"Component"}function createHocName(hocComponentName,WrappedComponent){return hocComponentName+"("+getDisplayName(WrappedComponent)+")"}ViewportRenderer.defaultProps={placeholderStyle:{},containerStyle:{},alwaysRenderChildren:!1,placeholderClass:"",containerClass:""};var memoizedNow,_excluded=["forwardedRef"],withI18n=function(Component,defaultLocaleResource,_temp){var _ref$forceRemount=(void 0===_temp?{}:_temp).forceRemount,forceRemount=void 0===_ref$forceRemount||_ref$forceRemount,Translated=translate(void 0,{withRef:!0})(Component),I18nWrapper=function(_PureComponent){function I18nWrapper(props){var _this;_this=_PureComponent.call(this,props)||this;var locale=props.locale,localeResource=props.localeResource;return _this.i18n=i18n({locale:locale,localeResource:localeResource}),_this.state={key:I18nWrapper.displayName+"-"+locale},_this}_inheritsLoose(I18nWrapper,_PureComponent);var _proto=I18nWrapper.prototype;return _proto.componentDidMount=function(){var _componentDidMount=_asyncToGenerator(_regeneratorRuntime.mark((function _callee(){var _yield$this$getResour,locale,localeResource;return _regeneratorRuntime.wrap((function(_context){for(;;)switch(_context.prev=_context.next){case 0:if("en"===this.props.locale){_context.next=7;break}return _context.next=3,this.getResourceByLocale(this.props.locale);case 3:_yield$this$getResour=_context.sent,locale=_yield$this$getResour.locale,localeResource=_yield$this$getResour.localeResource,this.changeLocale({locale:locale,localeResource:localeResource});case 7:case"end":return _context.stop()}}),_callee,this)})));return function(){return _componentDidMount.apply(this,arguments)}}(),_proto.componentWillReceiveProps=function(nextProps){this.props.locale!==nextProps.locale&&this.changeLocale(nextProps)},_proto.getResourceByLocale=function(){var _getResourceByLocale=_asyncToGenerator(_regeneratorRuntime.mark((function _callee2(locale){var localeResource;return _regeneratorRuntime.wrap((function(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:return _context2.prev=0,_context2.next=3,import(
/* webpackChunkName: "messages_[request]" */
"wix-rich-content-common/dist/statics/locale/messages_"+locale+".json").then((function(res){return res.default}));case 3:return localeResource=_context2.sent,_context2.abrupt("return",{locale:locale,localeResource:localeResource});case 7:throw _context2.prev=7,_context2.t0=_context2.catch(0),new Error("error while loading locale "+locale+":\n"+_context2.t0);case 10:case"end":return _context2.stop()}}),_callee2,null,[[0,7]])})));return function(_x){return _getResourceByLocale.apply(this,arguments)}}(),_proto.changeLocale=function(_ref2){var _this2=this,locale=_ref2.locale,localeResource=_ref2.localeResource;this.i18n.addResourceBundle(locale,"translation",localeResource),this.i18n.changeLanguage(locale,(function(err){err||(forceRemount?_this2.setState({key:I18nWrapper.displayName+"-"+_this2.i18n.language}):_this2.forceUpdate())}))},_proto.render=function(){var _this$props=this.props,forwardedRef=_this$props.forwardedRef,rest=_objectWithoutPropertiesLoose(_this$props,_excluded);return React.createElement(I18nextProvider,{i18n:this.i18n},React.createElement(Translated,Object.assign({key:this.state.key},rest,{ref:forwardedRef})))},I18nWrapper}(PureComponent);return I18nWrapper.defaultProps={locale:"en",localeResource:defaultLocaleResource},I18nWrapper.displayName=createHocName("I18nWrapper",Component),React.forwardRef((function(props,ref){return React.createElement(I18nWrapper,Object.assign({},props,{forwardedRef:ref}))}))},RicosTranslate=function(_ref3){var children=_ref3.children,locale=_ref3.locale,localeResource=_ref3.localeResource,i18nInstance=useRef(i18n({locale:locale,localeResource:localeResource})),_React$useState=React.useState(0),forceCounter=_React$useState[0],forceUpdate=_React$useState[1];return useEffect((function(){i18nInstance.current.addResourceBundle(locale,"translation",localeResource),i18nInstance.current.changeLanguage(locale,(function(err){err||forceUpdate(forceCounter+1)}))}),[locale,localeResource]),React.createElement(I18nextProvider,{i18n:i18nInstance.current},React.createElement(I18n,{i18n:i18nInstance.current,wait:!0,initialLanguage:locale},(function(t){return children(t)})))},alignmentClassName=function(componentData,theme,styles){var alignment=(componentData.config||{}).alignment;if(!alignment)return"";var key="align"+upperFirst(alignment);return classNames(styles[key],theme[key])},sizeClassName=function(componentData,theme,styles){var size=(componentData.config||{}).size;if(!size)return"";var key="size"+upperFirst(camelCase(size));return classNames(styles[key],theme[key])},textWrapClassName=function(componentData,theme,styles){var textWrap=(componentData.config||{}).textWrap;if(!textWrap)return"";var key="textWrap"+upperFirst(camelCase(textWrap));return classNames(styles[key],theme[key])},depthClassName=function(depth){return"public-DraftStyleDefault-block-depth"+depth},convertRelObjectToString=function(relObject){if(relObject){var relString="";return relObject.nofollow&&(relString+="nofollow "),relObject.sponsored&&(relString+="sponsored "),relObject.ugc&&(relString+="ugc"),relString.trim()}},convertRelStringToObject=function(rel){var relObject={};return rel?(rel.includes("nofollow")&&(relObject.nofollow=!0),rel.includes("sponsored")&&(relObject.sponsored=!0),rel.includes("ugc")&&(relObject.ugc=!0),relObject):relObject},convertTargetStringToBoolean=function(target){return"_blank"===target},convertTargetBooleanToString=function(targetBlank){return targetBlank?"_blank":"_top"},getRelValue=function(rel){return("noopener noreferrer "+(rel||"")).trim()},safeJsonParse=function(jsonString){try{return JSON.parse(jsonString)}catch(e){return}};function t(t){return"object"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return(!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return!1}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}function compute(e,i){var o=window,l=i.scrollMode,d=i.block,u=i.inline,h=i.boundary,a=i.skipOverflowHiddenElements,c="function"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,s=[],p=e;t(p)&&c(p);){if((p=p.parentElement)===f){s.push(p);break}null!=p&&p===document.body&&n(p)&&!n(document.documentElement)||null!=p&&n(p,a)&&s.push(p)}for(var m=o.visualViewport?o.visualViewport.width:innerWidth,g=o.visualViewport?o.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,v=window.scrollY||pageYOffset,W=e.getBoundingClientRect(),b=W.height,H=W.width,y=W.top,E=W.right,M=W.bottom,V=W.left,x="start"===d||"nearest"===d?y:"end"===d?M:y+b/2,I="center"===u?V+H/2:"end"===u?E:V,C=[],T=0;T<s.length;T++){var k=s[T],B=k.getBoundingClientRect(),D=B.height,O=B.width,R=B.top,X=B.right,Y=B.bottom,L=B.left;if("if-needed"===l&&y>=0&&V>=0&&M<=g&&E<=m&&y>=R&&M<=Y&&V>=L&&E<=X)return C;var S=getComputedStyle(k),j=parseInt(S.borderLeftWidth,10),q=parseInt(S.borderTopWidth,10),z=parseInt(S.borderRightWidth,10),A=parseInt(S.borderBottomWidth,10),F=0,G=0,J="offsetWidth"in k?k.offsetWidth-k.clientWidth-j-z:0,K="offsetHeight"in k?k.offsetHeight-k.clientHeight-q-A:0;if(f===k)F="start"===d?x:"end"===d?x-g:"nearest"===d?r(v,v+g,g,q,A,v+x,v+x+b,b):x-g/2,G="start"===u?I:"center"===u?I-m/2:"end"===u?I-m:r(w,w+m,m,j,z,w+I,w+I+H,H),F=Math.max(0,F+v),G=Math.max(0,G+w);else{F="start"===d?x-R-q:"end"===d?x-Y+A+K:"nearest"===d?r(R,Y,D,q,A+K,x,x+b,b):x-(R+D/2)+K/2,G="start"===u?I-L-j:"center"===u?I-(L+O/2)+J/2:"end"===u?I-X+z+J:r(L,X,O,j,z+J,I,I+H,H);var N=k.scrollLeft,P=k.scrollTop;x+=P-(F=Math.max(0,Math.min(P+F,k.scrollHeight-D+K))),I+=N-(G=Math.max(0,Math.min(N+G,k.scrollWidth-O+J)))}C.push({el:k,top:F,left:G})}return C}function isOptionsObject(options){return options===Object(options)&&0!==Object.keys(options).length}function scrollIntoView$1(target,options){var targetIsDetached=!target.ownerDocument.documentElement.contains(target);if(isOptionsObject(options)&&"function"==typeof options.behavior)return options.behavior(targetIsDetached?[]:compute(target,options));if(!targetIsDetached){var computeOptions=function(options){return!1===options?{block:"end",inline:"nearest"}:isOptionsObject(options)?options:{block:"start",inline:"nearest"}}(options);return function(actions,behavior){void 0===behavior&&(behavior="auto");var canSmoothScroll="scrollBehavior"in document.body.style;actions.forEach((function(_ref){var el=_ref.el,top=_ref.top,left=_ref.left;el.scroll&&canSmoothScroll?el.scroll({top:top,left:left,behavior:behavior}):(el.scrollTop=top,el.scrollLeft=left)}))}(compute(target,computeOptions),computeOptions.behavior)}}var now=function(){return memoizedNow||(memoizedNow="performance"in window?performance.now.bind(performance):Date.now),memoizedNow()};function step(context){var time=now(),elapsed=Math.min((time-context.startTime)/context.duration,1),value=context.ease(elapsed),currentX=context.startX+(context.x-context.startX)*value,currentY=context.startY+(context.y-context.startY)*value;context.method(currentX,currentY),currentX!==context.x||currentY!==context.y?requestAnimationFrame((function(){return step(context)})):context.cb()}function smoothScroll(el,x,y,duration,ease,cb){var scrollable,startX,startY;void 0===duration&&(duration=600),void 0===ease&&(ease=function(t){return 1+--t*t*t*t*t}),scrollable=el,startX=el.scrollLeft,startY=el.scrollTop,step({scrollable:scrollable,method:function(x,y){el.scrollLeft=Math.ceil(x),el.scrollTop=Math.ceil(y)},startTime:now(),startX:startX,startY:startY,x:x,y:y,duration:duration,ease:ease,cb:cb})}var scrollIntoView=function(target,options){var overrides=options||{};return function(options){return options&&!options.behavior||"smooth"===options.behavior}(overrides)?scrollIntoView$1(target,{block:overrides.block,inline:overrides.inline,scrollMode:overrides.scrollMode,boundary:overrides.boundary,behavior:function(actions){return Promise.all(actions.reduce((function(results,_ref){var el=_ref.el,left=_ref.left,top=_ref.top,startLeft=el.scrollLeft,startTop=el.scrollTop;return startLeft===left&&startTop===top?results:[].concat(results,[new Promise((function(resolve){return smoothScroll(el,left,top,overrides.duration,overrides.ease,(function(){return resolve({el:el,left:[startLeft,left],top:[startTop,top]})}))}))])}),[]))}}):Promise.resolve(scrollIntoView$1(target,options))},anchorScroll=function(element,experiments){var _document$querySelect,_document$querySelect2,_document$querySelect3,_document$querySelect4,_experiments$anchorSc,fixedElementsOffset=((null===(_document$querySelect=document.querySelector('[id="SITE_HEADER"]'))||void 0===_document$querySelect?void 0:_document$querySelect.clientHeight)||0)+((null===(_document$querySelect2=document.querySelector('[id="WIX_ADS"]'))||void 0===_document$querySelect2?void 0:_document$querySelect2.clientHeight)||0)+((null===(_document$querySelect3=document.querySelector('[data-hook="mobileToolbar"]'))||void 0===_document$querySelect3?void 0:_document$querySelect3.clientHeight)||(null===(_document$querySelect4=document.querySelector('[data-hook="ricos-editor-toolbars"]'))||void 0===_document$querySelect4?void 0:_document$querySelect4.clientHeight)||0);null!=experiments&&null!==(_experiments$anchorSc=experiments.anchorScrollWithSmoothScrollIntoViewIfNeeded)&&void 0!==_experiments$anchorSc&&_experiments$anchorSc.enabled?anchorScrollUsingSmoothScrollIntoViewIfNeeded(element,fixedElementsOffset):anchorScrollUsingScrollIntoView(element,fixedElementsOffset)},anchorScrollUsingSmoothScrollIntoViewIfNeeded=function(element,fixedElementsOffset){var _element$style=element.style,paddingTop=_element$style.paddingTop,marginTop=_element$style.marginTop;element.style.marginTop="-"+fixedElementsOffset+"px",element.style.paddingTop=fixedElementsOffset+"px",scrollIntoView(element,{block:"start",inline:"start"}),element.style.marginTop=marginTop,element.style.paddingTop=paddingTop},anchorScrollUsingScrollIntoView=function(element,fixedElementsOffset){var _element$style2=element.style,paddingTop=_element$style2.paddingTop,marginTop=_element$style2.marginTop;element.style.marginTop="-"+fixedElementsOffset+"px",element.style.paddingTop=fixedElementsOffset+"px",element.scrollIntoView({behavior:"smooth"}),element.style.marginTop=marginTop,element.style.paddingTop=paddingTop},addAnchorTagToUrl=function(anchorString){var url=new URL(window.location.href);url.hash=anchorString,history.pushState({},"",url.href)},isNewTab=function(target){return"_blank"===target},hasLinksInBlock=function(block,contentState){return getLinkRangesInBlock(block,contentState).length>0},getLinkRangesInBlock=function(block,contentState){var ranges=[];return block.entityRanges.forEach((function(entityRange){var _contentState$entityM,entityType=null===(_contentState$entityM=contentState.entityMap[entityRange.key])||void 0===_contentState$entityM?void 0:_contentState$entityM.type;if("LINK"===entityType||"wix-draft-plugin-external-link"===entityType){var start=entityRange.offset,end=start+entityRange.length;ranges.push([start,end])}})),ranges},contentStateSchema={definitions:{inlineStyleDef:{definitions:{},$schema:"http://json-schema.org/draft-07/schema#",$id:"https://wix-rich-content/inline-style.json",type:"object",title:"inline style",required:["offset","length","style"],properties:{offset:{$id:"#/properties/offset",type:"integer",title:"offset",default:0,min:0,examples:[0]},length:{$id:"#/properties/length",type:"integer",title:"length",default:0,min:0,examples:[4]},style:{$id:"#/properties/style",type:"string",title:"style",default:"",examples:["color4"],pattern:"^(.*)$"}}},entityRangeDef:{definitions:{},$schema:"http://json-schema.org/draft-07/schema#",$id:"https://wix-rich-content/entity-range.json",type:"object",title:"inline style",required:["offset","length","key"],properties:{offset:{$id:"#/properties/offset",type:"integer",title:"offset",default:0,min:0,examples:[0]},length:{$id:"#/properties/length",type:"integer",title:"length",default:0,min:0,examples:[4]},key:{$id:"#/properties/style",type:"integer",title:"key",default:"",examples:[0]}}},entityDef:{definitions:{},$schema:"http://json-schema.org/draft-07/schema#",$id:"https://wix-rich-content/entity-range.json",type:"object",title:"entity",required:["type","data"],properties:{type:{$id:"#/properties/type",enum:["IMAGE","VIDEO-EMBED","LINK","mention","wix-draft-plugin-image","wix-draft-plugin-link-button","wix-draft-plugin-action-button","wix-draft-plugin-video","wix-draft-plugin-gallery","wix-draft-plugin-link","wix-draft-plugin-html","wix-draft-plugin-sound-cloud","wix-draft-plugin-hashtag","wix-draft-plugin-divider","wix-draft-plugin-emoji","wix-draft-plugin-giphy","wix-draft-plugin-map","wix-draft-plugin-file-upload","wix-draft-plugin-vertical-embed","wix-draft-plugin-poll","wix-draft-plugin-link-preview","ANCHOR","wix-rich-content-plugin-table"],title:"entity type",examples:["wix-draft-plugin-image"]},mutability:{$id:"#/properties/mutability",type:"string",enum:["MUTABLE","IMMUTABLE","SEGMENTED"],title:"entity mutability",examples:["IMMUTABLE"]},data:{$id:"#/properties/data",type:"object",title:"entity data"}},anyOf:[{}]}},$schema:"http://json-schema.org/draft-07/schema#",$id:"https://wix-rich-content/content-state-schema.json",type:"object",title:"content state",required:["blocks","entityMap","VERSION"],properties:{blocks:{$id:"#/properties/blocks",type:"array",title:"blocks",items:{$id:"#/properties/blocks/items",type:"object",title:"block",required:["key","text","type","inlineStyleRanges","entityRanges","data"],properties:{key:{$id:"#/properties/blocks/items/properties/key",type:"string",title:"block key",default:"",examples:["45qkg"],pattern:"^(.*)$"},text:{$id:"#/properties/blocks/items/properties/text",type:"string",title:"text",default:"",examples:["test"]},type:{$id:"#/properties/blocks/items/properties/type",type:"string",title:"block type",default:"",examples:["unstyled"],enum:["unstyled","header-one","header-two","header-three","header-four","header-five","header-six","unordered-list-item","ordered-list-item","blockquote","atomic","code-block","figure"]},depth:{$id:"#/properties/blocks/items/properties/depth",type:"integer",title:"depth",maximum:10,default:0,examples:[0]},inlineStyleRanges:{$id:"#/properties/blocks/items/properties/inlineStyleRanges",type:"array",title:"inline style ranges",items:{$ref:"#/definitions/inlineStyleDef"}},entityRanges:{$id:"#/properties/blocks/items/properties/entityRanges",type:"array",title:"entity ranges",default:null,items:{$ref:"#/definitions/entityRangeDef"}},data:{$id:"#/properties/blocks/items/properties/data",type:"object",title:"data",default:null}}}},entityMap:{$id:"#/properties/entityMap",type:"object",title:"entity map",patternProperties:{"[0-9]+":{$ref:"#/definitions/entityDef"}}}}},validate=function(data,schema){return!0},getContentStateSchema=function(pluginDataSchemas){void 0===pluginDataSchemas&&(pluginDataSchemas={});var schema=contentStateSchema;return schema.definitions.entityDef.anyOf=Object.keys(pluginDataSchemas).map((function(pluginType){return{properties:{type:{const:pluginType},data:pluginDataSchemas[pluginType]}}})),schema},LTR="A-Za-zÀ-ÖØ-öø-ʸ̀-֐ࠀ-῿‎Ⰰ-﬜︀-﹯﻽-￿",isRtlRegex=new RegExp("^[^"+LTR+"]*[֑-߿יִ-﷽ﹰ-ﻼ]"),isLtrRegex=new RegExp("^[^֑-߿יִ-﷽ﹰ-ﻼ]*["+LTR+"]"),emojiRegex=/\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]/g,getTextDirection=function(text){var result="neutral";if(!text)return result;var plainText=text.replace(emojiRegex,"");return isRtlRegex.test(plainText)?result="rtl":isLtrRegex.test(plainText)&&(result="ltr"),result},getDirectionFromAlignmentAndTextDirection=function(textAlignment,textDirection){return"right"===textAlignment?"rtl":"left"===textAlignment?"ltr":textDirection&&"rtl"===textDirection?textDirection:"ltr"},GlobalContext=React.createContext({isMobile:!1,experiments:{}}),isHexColor=function(str){return/^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(str)},rtlLangs=["ae","ar","arc","bcc","bqi","ckb","dv","fa","glk","he","ku","mzn","nqo","pnb","ps","sd","ug","ur","yi"],isRtl=function(locale){return!!locale&&rtlLangs.includes(locale.split("-|_")[0].toLowerCase())},getLangDir=function(locale){return isRtl(locale)?"rtl":"ltr"},simplePubsub=function(initialState){var state=initialState||{},listeners={},subscribe=function(key,callback){if("function"!=typeof callback)throw"Callback for key "+key+" is not a function";return listeners[key]=listeners[key]||[],listeners[key].push(callback),function(){listeners[key]=listeners[key].filter((function(listener){return listener!==callback}))}},update=function(key,newData,blockKey){var data=get(key),newItem=merge({},data,newData);blockKey?_setSingle(key,newItem,blockKey):set(key,newItem)},_setSingle=function(key,item,blockKey){var _extends2;state=_extends({},state,((_extends2={})[key]=item,_extends2)),listeners[key]&&listeners[key].forEach((function(listener){return listener(state[key],blockKey)}))},_setBatch=function(updates){state=_extends({},state,updates),Object.keys(updates).forEach((function(key){listeners[key]&&listeners[key].forEach((function(listener){return listener(state[key])}))}))},set=function(){1===arguments.length?_setBatch(arguments.length<=0?void 0:arguments[0]):_setSingle.apply(void 0,arguments)},setBlockHandler=function(key,blockKey,item){_setSingle(blockHandlerKey(key,blockKey),item)},get=function(key){return state[key]},getBlockHandler=function(key,blockKey){return void 0===blockKey&&(blockKey=state.focusedBlock),state[blockHandlerKey(key,blockKey)]},blockHandlerKey=function(key,blockKey){return blockKey+"_"+key};return{subscribe:subscribe,unsubscribe:function(key,callback){listeners[key]=listeners[key].filter((function(listener){return listener!==callback}))},update:update,set:set,setBlockHandler:setBlockHandler,get:get,getBlockHandler:getBlockHandler,store:{get:get,getBlockHandler:getBlockHandler,update:update,set:set,setBlockHandler:setBlockHandler},getBlockData:function(_ref3){var key=_ref3.key,_ref3$blockKey=_ref3.blockKey,blockKey=void 0===_ref3$blockKey?state.focusedBlock:_ref3$blockKey;return state[blockHandlerKey(key,blockKey)]},setBlockData:function(_ref2){var key=_ref2.key,_ref2$blockKey=_ref2.blockKey,blockKey=void 0===_ref2$blockKey?state.focusedBlock:_ref2$blockKey,item=_ref2.item;_setSingle(blockHandlerKey(key,blockKey),item)},subscribeOnBlock:function(_ref){var key=_ref.key,_ref$blockKey=_ref.blockKey,blockKey=void 0===_ref$blockKey?state.focusedBlock:_ref$blockKey,callback=_ref.callback;return subscribe(blockHandlerKey(key,blockKey),callback)}}},generateKey=function(){return Math.random().toString(36).substr(2,9)},getBlocksFromContentState=function(contentState){var entityMap,rceInRcePlugins,innerRCEBlocks=(entityMap=contentState.entityMap,rceInRcePlugins=["wix-rich-content-plugin-table","wix-rich-content-plugin-collapsible-list"],Object.values(entityMap).some((function(entity){return rceInRcePlugins.includes(entity.type)}))?getInnerRCEBlocks(contentState.entityMap):[]);return[].concat(contentState.blocks,innerRCEBlocks)};function getInnerRCEBlocks(object){var result=[];if(object instanceof Array)Array.prototype.forEach.call(object,(function(arrayElement){var innerBlocks=getInnerRCEBlocks(arrayElement);innerBlocks&&(result=[].concat(result,innerBlocks))}));else for(var _i=0,_Object$entries=Object.entries(object);_i<_Object$entries.length;_i++){var _Object$entries$_i=_Object$entries[_i],key=_Object$entries$_i[0],value=_Object$entries$_i[1];if("blocks"===key)return value;if(value instanceof Object||value instanceof Array){var innerBlocks=getInnerRCEBlocks(value);innerBlocks&&(result=[].concat(result,innerBlocks))}}return result}var _INLINE_STYLE_TYPES,_RICOS_TO_DRAFT_TYPE,_dynamicStyleParsers,_defaultStyleFnMapper,_defaultStyleSelectio,ADD_PLUGIN_LINK_BI="addPluginLink",WEB_ADDRESS_CATEGORY="web_address",ANCHOR_CATEGORY="section",LINK_VIEWER_DATA_HOOK="linkViewer",ANCHOR_VIEWER_DATA_HOOK="anchorViewer";function isInEditor(contentBlock){return contentBlock.toJS}function isInLink(i,block,contentState){var entityKey=function(i,block){var _block$entityRanges$f;return isInEditor(block)?block.getEntityAt(i):null===(_block$entityRanges$f=block.entityRanges.find((function(_ref){var offset=_ref.offset,length=_ref.length;return i>offset&&i<offset+length})))||void 0===_block$entityRanges$f?void 0:_block$entityRanges$f.key}(i,block);return function(type){return"LINK"===type||"ricos-plugin-custom-link"===type}(function(block,contentState,entityKey){var _contentState$entityM;return isInEditor(block)?null!==entityKey&&contentState.getEntity(entityKey).getType():null===(_contentState$entityM=contentState.entityMap[entityKey])||void 0===_contentState$entityM?void 0:_contentState$entityM.type}(block,contentState,entityKey))}function createJustificationFixDecorator(){var isTextJustified=function(contentBlock){return"justify"===function(contentBlock){var _contentBlock$data;return isInEditor(contentBlock)?contentBlock.getData().get("textAlignment"):null==contentBlock||null===(_contentBlock$data=contentBlock.data)||void 0===_contentBlock$data?void 0:_contentBlock$data.textAlignment}(contentBlock)};return{strategy:function(contentBlock,callback,contentState){if(!isSSR()&&(isSSR()||!window.chrome)&&isTextJustified(contentBlock))for(var match,regex=/\s[^\s]/g,str=contentBlock.getText();null!==(match=regex.exec(str));)isInLink(match.index,contentBlock,contentState)||callback(match.index,match.index+1)},component:function(props){return React.createElement("span",{style:{whiteSpace:"normal"}},props.children)}}}var INLINE_STYLE_TYPES=((_INLINE_STYLE_TYPES={})[RICOS_TEXT_COLOR_TYPE]="FG",_INLINE_STYLE_TYPES[RICOS_TEXT_HIGHLIGHT_TYPE]="BG",_INLINE_STYLE_TYPES[RICOS_FONT_SIZE_TYPE]="font-size",_INLINE_STYLE_TYPES),RICOS_TO_DRAFT_TYPE=((_RICOS_TO_DRAFT_TYPE={})[RICOS_TEXT_COLOR_TYPE]=TEXT_COLOR_TYPE,_RICOS_TO_DRAFT_TYPE[RICOS_TEXT_HIGHLIGHT_TYPE]=TEXT_HIGHLIGHT_TYPE,_RICOS_TO_DRAFT_TYPE),parseStyleByType=function(style,type){var property=INLINE_STYLE_TYPES[type],cssRule=safeJsonParse(style);return null==cssRule?void 0:cssRule[property]},dynamicStyleParsers=((_dynamicStyleParsers={})[RICOS_TEXT_COLOR_TYPE]=function(style,styleSelectionPredicate){var color=parseStyleByType(style,RICOS_TEXT_COLOR_TYPE);if(styleSelectionPredicate){var parsedStyle=color||style;return styleSelectionPredicate(parsedStyle)&&parsedStyle}return color||isHexColor(style)&&style},_dynamicStyleParsers[RICOS_TEXT_HIGHLIGHT_TYPE]=function(style,styleSelectionPredicate){var color=parseStyleByType(style,RICOS_TEXT_HIGHLIGHT_TYPE);return styleSelectionPredicate?styleSelectionPredicate(color)&&color:color},_dynamicStyleParsers[RICOS_FONT_SIZE_TYPE]=function(style){return parseStyleByType(style,RICOS_FONT_SIZE_TYPE)},_dynamicStyleParsers),draftDecorationsToCss={BOLD:{"font-weight":"bold"},ITALIC:{"font-style":"italic"},NOT_BOLD:{"font-weight":"normal"},NOT_ITALIC:{"font-style":"normal"}},defaultStyleFnMapper=((_defaultStyleFnMapper={})[RICOS_TEXT_COLOR_TYPE]=function(style){var parsedStyle=dynamicStyleParsers[RICOS_TEXT_COLOR_TYPE](style,isHexColor);return parsedStyle?{color:parsedStyle}:void 0},_defaultStyleFnMapper[RICOS_TEXT_HIGHLIGHT_TYPE]=function(style){var parsedStyle=dynamicStyleParsers[RICOS_TEXT_HIGHLIGHT_TYPE](style,isHexColor);return parsedStyle?{backgroundColor:parsedStyle}:void 0},_defaultStyleFnMapper[RICOS_FONT_SIZE_TYPE]=function(style){var parsedStyle=dynamicStyleParsers[RICOS_FONT_SIZE_TYPE](style);return parsedStyle?{fontSize:parsedStyle}:void 0},_defaultStyleFnMapper[RICOS_BOLD_TYPE]=function(style){return"NOT_BOLD"===style?{fontWeight:"normal"}:void 0},_defaultStyleFnMapper[RICOS_ITALIC_TYPE]=function(style){return"NOT_ITALIC"===style?{fontStyle:"normal"}:void 0},_defaultStyleFnMapper),defaultStyleSelectionPredicates=((_defaultStyleSelectio={})[RICOS_TEXT_COLOR_TYPE]=isHexColor,_defaultStyleSelectio[RICOS_TEXT_HIGHLIGHT_TYPE]=isHexColor,_defaultStyleSelectio),getDynamicInlineStyleMapper=function(type){return function(config,raw){var settings=config[RICOS_TO_DRAFT_TYPE[type]||""]||{},styleParser=dynamicStyleParsers[type],styleSelectionPredicate=settings.styleSelectionPredicate?function(style){return!!styleParser(style,settings.styleSelectionPredicate)}:function(style){return!!styleParser(style,defaultStyleSelectionPredicates[type])},customStyleFn=settings.customStyleFn?function(style){return settings.customStyleFn(styleParser(style,settings.styleSelectionPredicate))}:defaultStyleFnMapper[type],mapper=getBlocksFromContentState(raw).reduce((function(map,block){return block.inlineStyleRanges&&block.inlineStyleRanges.filter((function(range){return styleSelectionPredicate(range.style)})).forEach((function(range){map[range.style]=function(children,_ref){var key=_ref.key;return React.createElement("span",{key:key,style:customStyleFn(range.style)},children)}})),map}),{});return function(){return mapper}}},uuid=function(){var d=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(c){var r=(d+16*Math.random())%16|0;return d=Math.floor(d/16),("x"===c?r:3&r|8).toString(16)}))};export{ADD_PLUGIN_LINK_BI,ANCHOR_CATEGORY,ANCHOR_VIEWER_DATA_HOOK,AccessibilityListener,ButtonType,CUSTOM_LINK,DRAFT_TO_RICOS_DOC_TYPE,DROPDOWN_OPTIONS_TO_DOC_STYLE_TYPE,DecorationMode,DisplayMode,GlobalContext,INLINE_STYLE_TYPES,LINK_VIEWER_DATA_HOOK,LinkData,Link_Rel,ModifierKey,RicosTranslate,ToolbarType,ViewportRenderer,WEB_ADDRESS_CATEGORY,addAnchorTagToUrl,alignmentClassName,anchorScroll,convertRelObjectToString,convertRelStringToObject,convertTargetBooleanToString,convertTargetStringToBoolean,createHocName,createJustificationFixDecorator,defaultStyleFnMapper,depthClassName,draftDecorationsToCss,dynamicStyleParsers,generateKey,getBlocksFromContentState,getContentStateSchema,getDirectionFromAlignmentAndTextDirection,getDisplayName,getDynamicInlineStyleMapper,getLangDir,getLinkRangesInBlock,getRelValue,getTextDirection,hasLinksInBlock,isHexColor,isNewTab,isRtl,isSSR,mergeStyles,parseStyleByType,safeJsonParse,simplePubsub,sizeClassName,textWrapClassName,uuid,validate,withI18n};
import _extends from"@babel/runtime/helpers/extends";import _objectWithoutPropertiesLoose from"@babel/runtime/helpers/objectWithoutPropertiesLoose";import{BUTTONS,EditIcon,createBasePlugin}from"wix-rich-content-plugin-commons";import{deleteBlockText,createBlock,getModalStyles,EditorModals,LinkButton,hasLinksInSelection,removeLinksInSelection,InlineToolbarButton,getLinkDataInSelection,scrollToBlock,updateLinkAtCurrentSelection,getEntityData,insertCustomLink,FORMATTING_BUTTONS,insertLinkAtCurrentSelection,COMMANDS,MODIFIERS,LinkIcon,BUTTON_TYPES,isAtomicBlockInSelection,createLinkEntityData,getVisibleSelectionRect,fixPastedLinks,insertLinkInPosition}from"wix-rich-content-editor-common";import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";import _regeneratorRuntime from"@babel/runtime/regenerator";import{pickBy,isEqual,isEmpty}from"lodash";import{addAnchorTagToUrl,anchorScroll,isValidTelUrl,normalizeUrl,validate,mergeStyles,getRelValue,GlobalContext,ANCHOR_VIEWER_DATA_HOOK,LINK_VIEWER_DATA_HOOK,isValidUrl}from"wix-rich-content-common";import React,{Component}from"react";import _inheritsLoose from"@babel/runtime/helpers/inheritsLoose";import classNames from"classnames";import pluginLinkSchema from"wix-rich-content-common/dist/statics/schemas/plugin-link.schema.json";import _createClass from"@babel/runtime/helpers/createClass";import{convertDecorationDataToDraft}from"ricos-content/libs/toDraftData";import"uuid";var _ref7,_ref6,_ref3,_ref,DEFAULTS$1={config:{alignment:"center",size:"content",link:{target:"_blank",rel:""}}},LINK_PREVIEW_TYPE="wix-draft-plugin-link-preview",addLinkPreview=(_ref=_asyncToGenerator(_regeneratorRuntime.mark((function _callee(editorState,config,blockKey,linkData){var _ref2,_ref2$enableEmbed,enableEmbed,_ref2$enableLinkPrevi,enableLinkPreview,fetchData,linkPreview,title,html,fixedUrl,linkPreviewData;return _regeneratorRuntime.wrap((function(_context){for(;;)switch(_context.prev=_context.next){case 0:return _ref2=config[LINK_PREVIEW_TYPE]||{},_ref2$enableEmbed=_ref2.enableEmbed,enableEmbed=void 0===_ref2$enableEmbed||_ref2$enableEmbed,_ref2$enableLinkPrevi=_ref2.enableLinkPreview,enableLinkPreview=void 0===_ref2$enableLinkPrevi||_ref2$enableLinkPrevi,fetchData=_ref2.fetchData,_context.next=3,fetchLinkPreview(fetchData,linkData.url);case 3:if(_context.t0=_context.sent,_context.t0){_context.next=6;break}_context.t0={};case 6:if(linkPreview=_context.t0,title=linkPreview.title,html=linkPreview.html,fixedUrl=linkPreview.fixedUrl,!shouldAddEmbed(html,enableEmbed,fixedUrl)&&!shouldAddLinkPreview(title,enableLinkPreview)){_context.next=13;break}return _context.next=11,createLinkPreviewData(linkData,linkPreview,config[LINK_PREVIEW_TYPE]);case 11:linkPreviewData=_context.sent,addLinkPreviewBlock(editorState,config,blockKey,linkPreviewData);case 13:case"end":return _context.stop()}}),_callee)}))),function(_x,_x2,_x3,_x4){return _ref.apply(this,arguments)}),fetchLinkPreview=(_ref3=_asyncToGenerator(_regeneratorRuntime.mark((function _callee2(fetchData,url){var fixedUrl,_ref4,thumbnail_url,title,description,html;return _regeneratorRuntime.wrap((function(_context2){for(;;)switch(_context2.prev=_context2.next){case 0:return fixedUrl=url.split("↵").join(""),_context2.next=3,null==fetchData?void 0:fetchData(fixedUrl);case 3:if(_context2.t0=_context2.sent,_context2.t0){_context2.next=6;break}_context2.t0={};case 6:return _ref4=_context2.t0,thumbnail_url=_ref4.thumbnail_url,title=_ref4.title,description=_ref4.description,html=_ref4.html,_context2.abrupt("return",{thumbnailUrl:thumbnail_url,title:title,description:description,html:html,fixedUrl:fixedUrl});case 12:case"end":return _context2.stop()}}),_callee2)}))),function(_x5,_x6){return _ref3.apply(this,arguments)}),createLinkPreviewData=(_ref6=_asyncToGenerator(_regeneratorRuntime.mark((function _callee3(linkData,_ref5,linkPreviewConfig){var thumbnailUrl,title,description,html,fixedUrl,currentConfig,data;return _regeneratorRuntime.wrap((function(_context3){for(;;)switch(_context3.prev=_context3.next){case 0:if(thumbnailUrl=_ref5.thumbnailUrl,title=_ref5.title,description=_ref5.description,html=_ref5.html,fixedUrl=_ref5.fixedUrl,currentConfig=_extends({},DEFAULTS$1,linkPreviewConfig).config,data={config:_extends({},currentConfig,{link:_extends({},currentConfig.link,pickBy(linkData),{url:fixedUrl}),width:html&&350}),thumbnail_url:thumbnailUrl,title:title,description:description,html:html},_context3.t0=thumbnailUrl,!_context3.t0){_context3.next=8;break}return _context3.next=7,isValidImgSrc(thumbnailUrl);case 7:_context3.t0=_context3.sent;case 8:if(!_context3.t0){_context3.next=10;break}data.thumbnail_url=thumbnailUrl;case 10:return _context3.abrupt("return",data);case 11:case"end":return _context3.stop()}}),_callee3)}))),function(_x7,_x8,_x9){return _ref6.apply(this,arguments)}),addLinkPreviewBlock=(_ref7=_asyncToGenerator(_regeneratorRuntime.mark((function _callee4(editorState,config,blockKey,linkPreviewData){var setEditorState,withoutLinkBlock,_createBlock,newEditorState;return _regeneratorRuntime.wrap((function(_context4){for(;;)switch(_context4.prev=_context4.next){case 0:setEditorState=config.setEditorState,withoutLinkBlock=deleteBlockText(editorState,blockKey),_createBlock=createBlock(withoutLinkBlock,linkPreviewData,LINK_PREVIEW_TYPE),newEditorState=_createBlock.newEditorState,setEditorState(newEditorState);case 4:case"end":return _context4.stop()}}),_callee4)}))),function(_x10,_x11,_x12,_x13){return _ref7.apply(this,arguments)}),isValidImgSrc=function(url){return new Promise((function(resolve){var image=document.createElement("img");image.src=url,image.onload=function(){resolve(!0)},image.onerror=function(){resolve(!1)}}))},shouldAddLinkPreview=function(title,enableLinkPreview){return enableLinkPreview&&title},shouldAddEmbed=function(html,enableEmbed,url){return Array.isArray(enableEmbed)?enableEmbed.filter((function(whiteListType){return url.toLowerCase().includes(whiteListType.toLowerCase())})).length>0:html&&enableEmbed},EXTERNAL_LINK_TYPE="wix-draft-plugin-external-link",LINK_TYPE="LINK",styles={fontElementMap:"_35ss-",link:"_3Bkfb",linkInEditor:"_35evZ",linkInViewer:"_1lsz7",toolbarUrlContainer:"_10766",toolbarUrl:"_t6Zq",toolbarUrlAnchor:"_3WEE2"},LinkViewer=function(_Component){function LinkViewer(props){var _this;(_this=_Component.call(this,props)||this).handleClick=function(event){var _this$props=_this.props,componentData=_this$props.componentData,isInEditor=_this$props.isInEditor,config=_this$props.config,helpers=_this$props.helpers,customAnchorScroll=_this$props.customAnchorScroll,settings=null==config?void 0:config.LINK;if(settings){var _helpers$onViewerActi,onClick=settings.onClick,anchor=componentData.anchor,url=componentData.url;if(null==helpers||null===(_helpers$onViewerActi=helpers.onViewerAction)||void 0===_helpers$onViewerActi||_helpers$onViewerActi.call(helpers,"LINK","Click",componentData),null==onClick||onClick(event,(null==componentData?void 0:componentData.customData)||_this.getHref(url,anchor)),anchor&&(event.stopPropagation(),!isInEditor))if(event.preventDefault(),customAnchorScroll)customAnchorScroll(event,anchor);else{var anchorString="viewer-"+anchor,element=document.getElementById(anchorString);addAnchorTagToUrl(anchorString),anchorScroll(element,_this.context.experiments)}}},_this.resolveUrl=function(url){return isValidTelUrl(url)?url:normalizeUrl(url)},_this.getHref=function(url,anchor){return url?_this.resolveUrl(url):"#viewer-"+anchor},validate(props.componentData,pluginLinkSchema);var theme=_this.props.theme;return _this.styles=mergeStyles({styles:styles,theme:theme}),_this}_inheritsLoose(LinkViewer,_Component);var _proto=LinkViewer.prototype;return _proto.componentWillReceiveProps=function(nextProps){isEqual(nextProps.componentData,this.props.componentData)||validate(nextProps.componentData,pluginLinkSchema)},_proto.render=function(){var _classNames,_this$props2=this.props,componentData=_this$props2.componentData,anchorTarget=_this$props2.anchorTarget,children=_this$props2.children,isInEditor=_this$props2.isInEditor,url=componentData.url,anchor=componentData.anchor,_componentData$target=componentData.target,target=void 0===_componentData$target?anchorTarget:_componentData$target,rel=componentData.rel,anchorProps={href:this.getHref(url,anchor),target:anchor?"_self":target,rel:getRelValue(rel),className:classNames(this.styles.link,(_classNames={},_classNames[this.styles.linkInEditor]=isInEditor,_classNames[this.styles.linkInViewer]=!isInEditor,_classNames)),onClick:this.handleClick},dataHook=anchor?ANCHOR_VIEWER_DATA_HOOK:LINK_VIEWER_DATA_HOOK;return React.createElement("a",_extends({"data-hook":dataHook},anchorProps),children)},LinkViewer}(Component);LinkViewer.contextType=GlobalContext;var linkEntityStrategy=function(contentBlock,callback,contentState){contentBlock.findEntityRanges((function(character){var entityKey=character.getEntity();if(null!==entityKey){var entityType=contentState.getEntity(entityKey).getType();return"LINK"===entityType||"ricos-plugin-custom-link"===entityType}return!1}),callback)},TextLinkButton=function(_Component){function TextLinkButton(){for(var _this,_len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return(_this=_Component.call.apply(_Component,[this].concat(args))||this).showLinkPanel=function(){var _this$props=_this.props,getEditorState=_this$props.getEditorState,setEditorState=_this$props.setEditorState,getEntityData=_this$props.getEntityData,insertCustomLink=_this$props.insertCustomLink,settings=_this$props.config.LINK,onLinkAdd=null==settings?void 0:settings.onLinkAdd;if(onLinkAdd){var _getEntityData;onLinkAdd(null===(_getEntityData=getEntityData(getEditorState()))||void 0===_getEntityData?void 0:_getEntityData.customData,(function(data){return setEditorState(insertCustomLink(getEditorState(),data))}))}else _this.openLinkPanel()},_this.openLinkPanel=function(){var _this$props2=_this.props,getEditorState=_this$props2.getEditorState,setEditorState=_this$props2.setEditorState,theme=_this$props2.theme,isMobile=_this$props2.isMobile,linkModal=_this$props2.linkModal,helpers=_this$props2.helpers,keyName=_this$props2.keyName,anchorTarget=_this$props2.anchorTarget,relValue=_this$props2.relValue,t=_this$props2.t,uiSettings=_this$props2.uiSettings,insertLinkFn=_this$props2.insertLinkFn,closeInlinePluginToolbar=_this$props2.closeInlinePluginToolbar,config=_this$props2.config,innerModal=_this$props2.innerModal,toolbarOffsetTop=_this$props2.toolbarOffsetTop,toolbarOffsetLeft=_this$props2.toolbarOffsetLeft,settings=config.LINK,linkTypes=null==settings?void 0:settings.linkTypes,OriginalLinkPanel=!linkTypes||isEmpty(linkTypes)||!Object.values(linkTypes).find((function(addon){return!!addon})),_ref$externalPopups=(uiSettings.linkPanel||{}).externalPopups,externalPopups=void 0!==_ref$externalPopups&&_ref$externalPopups,modalStyles=getModalStyles({fullScreen:isMobile,isMobile:isMobile,customStyles:isMobile||OriginalLinkPanel?{content:{position:"fixed"}}:{content:{width:512,maxWidth:512,height:390,border:"1px solid rgb(237, 237, 237)",borderRadius:"6px",boxShadow:"rgba(0, 0, 0, 0.07) 0px 4px 8px 0px",padding:20}}}),commonPanelProps={helpers:helpers,modalName:EditorModals.TEXT_LINK_MODAL,anchorTarget:anchorTarget,relValue:relValue,theme:theme,t:t,uiSettings:uiSettings,getEditorState:getEditorState,setEditorState:setEditorState,insertLinkFn:insertLinkFn,closeInlinePluginToolbar:closeInlinePluginToolbar,linkTypes:linkTypes};if(externalPopups||isMobile||linkModal)if(helpers&&helpers.openModal){var modalProps=_extends({modalStyles:modalStyles,hidePopup:helpers.closeModal,isMobile:isMobile},commonPanelProps);helpers.openModal(modalProps)}else console.error("Open external helper function is not defined for toolbar button with keyName "+keyName);else{var _modalProps=_extends({hidePopup:innerModal.closeInnerModal,top:toolbarOffsetTop,left:toolbarOffsetLeft,modalStyles:OriginalLinkPanel?null:{maxWidth:"none",padding:20}},commonPanelProps);innerModal.openInnerModal(_modalProps)}},_this}return _inheritsLoose(TextLinkButton,_Component),TextLinkButton.prototype.render=function(){var _config$LINK,_config$LINK$toolbar,_config$LINK$toolbar$,_this$props3=this.props,theme=_this$props3.theme,helpers=_this$props3.helpers,isMobile=_this$props3.isMobile,tabIndex=_this$props3.tabIndex,config=_this$props3.config,isActive=_this$props3.isActive,icon=_this$props3.icon,tooltipText=_this$props3.tooltipText,disabled=_this$props3.disabled,buttonStyles={button:theme.inlineToolbarButton,buttonWrapper:theme.inlineToolbarButton_wrapper,icon:theme.inlineToolbarButton_icon,active:theme.inlineToolbarButton_active},insertLinkIcon=(null==config||null===(_config$LINK=config.LINK)||void 0===_config$LINK||null===(_config$LINK$toolbar=_config$LINK.toolbar)||void 0===_config$LINK$toolbar||null===(_config$LINK$toolbar$=_config$LINK$toolbar.icons)||void 0===_config$LINK$toolbar$?void 0:_config$LINK$toolbar$.InsertPluginButtonIcon)||icon;return React.createElement(LinkButton,{onClick:this.showLinkPanel,isActive:isActive,helpers:helpers,theme:_extends({},theme,buttonStyles),isMobile:isMobile,tooltipText:tooltipText,tabIndex:tabIndex,pluginType:"LINK",icon:insertLinkIcon,disabled:disabled})},_createClass(TextLinkButton,[{key:"isActive",get:function(){return hasLinksInSelection(this.props.getEditorState())}}]),TextLinkButton}(Component),RemoveLinkIcon=function(props){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",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:"remove-link",d:"M7.8 6c.11 0 .2.09.2.2v.807H4.5c-1.38 0-2.5 1.12-2.5 2.5 0 1.326 1.032 2.41 2.336 2.495l.164.005H8v.793c0 .11-.09.2-.2.2H4.5C2.567 13 1 11.433 1 9.5S2.567 6 4.5 6h3.3zm5.7 0C15.433 6 17 7.567 17 9.5S15.433 13 13.5 13h-3.3c-.11 0-.2-.09-.2-.2v-.807h3.5c1.38 0 2.5-1.12 2.5-2.5 0-1.381-1.12-2.5-2.5-2.5H10V6.2c0-.11.09-.2.2-.2h3.3zm-1.7 3c.11 0 .2.09.2.2v.6c0 .11-.09.2-.2.2H6.2c-.11 0-.2-.09-.2-.2v-.6c0-.11.09-.2.2-.2h5.6z"})),React.createElement("g",{fill:"none",fillRule:"evenodd"},React.createElement("use",{fill:"currentColor",transform:"rotate(-45 9 9.5)",xlinkHref:"#remove-link"}),React.createElement("path",{stroke:"currentColor",strokeLinecap:"square",d:"M3.5 3.5l11 12"})))},RemoveLinkButton=function(_Component){function RemoveLinkButton(){for(var _this,_len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++)args[_key]=arguments[_key];return(_this=_Component.call.apply(_Component,[this].concat(args))||this).deleteLink=function(){var _this$props=_this.props,getEditorState=_this$props.getEditorState,setEditorState=_this$props.setEditorState,closeInlinePluginToolbar=_this$props.closeInlinePluginToolbar;setEditorState(removeLinksInSelection(getEditorState(),setEditorState)),closeInlinePluginToolbar()},_this}return _inheritsLoose(RemoveLinkButton,_Component),RemoveLinkButton.prototype.render=function(){var _this$props2=this.props,theme=_this$props2.theme,helpers=_this$props2.helpers,isMobile=_this$props2.isMobile,t=_this$props2.t,tabIndex=_this$props2.tabIndex,linkButtonTooltip=t("LinkPanelContainer_RemoveButton"),buttonStyles={button:theme.inlineToolbarButton,buttonWrapper:theme.inlineToolbarButton_wrapper,icon:theme.inlineToolbarButton_icon,active:theme.inlineToolbarButton_active};return React.createElement(InlineToolbarButton,{onClick:this.deleteLink,helpers:helpers,theme:_extends({},theme,buttonStyles),isMobile:isMobile,tooltipText:linkButtonTooltip,tabIndex:tabIndex,icon:RemoveLinkIcon,dataHook:"RemoveLinkButton",pluginType:"LINK"})},RemoveLinkButton}(Component),UrlLinkButton=function(_Component){function UrlLinkButton(props){var _this;(_this=_Component.call(this,props)||this).handleClick=function(event){var _this$props=_this.props,getEditorState=_this$props.getEditorState,customAnchorScroll=_this$props.customAnchorScroll,_ref$anchor=(getLinkDataInSelection(getEditorState())||{}).anchor,anchor=void 0===_ref$anchor?"":_ref$anchor;customAnchorScroll?customAnchorScroll(event,anchor):scrollToBlock(anchor,_this.context.experiments)},_this.preventDefault=function(event){return event.preventDefault()};var theme=_this.props.theme;return _this.styles=mergeStyles({styles:styles,theme:theme}),_this}return _inheritsLoose(UrlLinkButton,_Component),UrlLinkButton.prototype.render=function(){var _classNames,styles=this.styles,_this$props2=this.props,getEditorState=_this$props2.getEditorState,t=_this$props2.t,_ref2=getLinkDataInSelection(getEditorState())||{},_ref2$url=_ref2.url,url=void 0===_ref2$url?"":_ref2$url,anchor=_ref2.anchor,target=_ref2.target,rel=_ref2.rel,href=url?normalizeUrl(url):void 0,anchorProps={href:href,target:target,rel:getRelValue(rel),className:classNames(styles.toolbarUrl,(_classNames={},_classNames[styles.toolbarUrlAnchor]=anchor,_classNames)),onMouseDown:this.preventDefault,onClick:anchor&&this.handleClick};return React.createElement("div",{className:styles.toolbarUrlContainer},React.createElement("a",anchorProps,href||t("LinkTo_Toolbar_GoTo")))},UrlLinkButton}(Component);UrlLinkButton.contextType=GlobalContext;var createInlineButtons=function(config){return[{keyName:"url",component:function(props){return React.createElement(UrlLinkButton,Object.assign({},config,props))},mobile:!0,type:BUTTONS.CUSTOM},{keyName:"separator1",type:BUTTONS.SEPARATOR,mobile:!0},{keyName:"edit",component:function(props){return React.createElement("div",{"data-hook":"EditLinkButton",style:{margin:"0 2px 0 -7px"}},React.createElement(TextLinkButton,Object.assign({insertLinkFn:updateLinkAtCurrentSelection,getEntityData:getEntityData,insertCustomLink:insertCustomLink,icon:EditIcon,tooltipText:config.t("LinkTo_Edit_Tooltip")},config,props)))},mobile:!0,type:BUTTONS.CUSTOM},{keyName:"separator2",type:BUTTONS.SEPARATOR,mobile:!0},{keyName:"remove",component:function(props){return React.createElement("div",{style:{margin:"0 -6px 0 -6px"}},React.createElement(RemoveLinkButton,Object.assign({},config,props)))},mobile:!0,type:BUTTONS.CUSTOM}]},openLinkModal=function(_ref){var helpers=_ref.helpers,isMobile=_ref.isMobile,anchorTarget=_ref.anchorTarget,relValue=_ref.relValue,t=_ref.t,theme=_ref.theme,getEditorState=_ref.getEditorState,setEditorState=_ref.setEditorState,uiSettings=_ref.uiSettings,closeInlinePluginToolbar=_ref.closeInlinePluginToolbar,settings=_ref.settings,modalStyles=getModalStyles({fullScreen:isMobile,isMobile:isMobile,customStyles:isMobile?{content:{position:"fixed"}}:{content:{maxWidth:"max-content",padding:20}}});if(helpers&&helpers.openModal){var modalProps={helpers:helpers,modalStyles:modalStyles,isMobile:isMobile,getEditorState:getEditorState,setEditorState:setEditorState,t:t,theme:theme,anchorTarget:anchorTarget,relValue:relValue,modalName:EditorModals.TEXT_LINK_MODAL,hidePopup:helpers.closeModal,uiSettings:uiSettings,insertLinkFn:insertLinkAtCurrentSelection,closeInlinePluginToolbar:closeInlinePluginToolbar,linkTypes:null==settings?void 0:settings.linkTypes};helpers.openModal(modalProps)}else console.error("Link plugin: failed to display Link modal dialog since helpers.openModal is not defined")},DEFAULTS={config:{linkTypes:{anchor:!0}}};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 createLinkPlugin=function(config){var type="LINK",theme=config.theme,anchorTarget=config.anchorTarget,relValue=config.relValue,_config$type=config[type],settings=void 0===_config$type?{}:_config$type,commonPubsub=config.commonPubsub,rest=_objectWithoutPropertiesLoose(config,["theme","anchorTarget","relValue",type,"commonPubsub"].map(_toPropertyKey)),target=anchorTarget,rel=relValue;settings.minLinkifyLength=settings.minLinkifyLength||6;var linkifyData,prevContentState,toolbar=function(config){var _config$LINK_TYPE2,_config$LINK_TYPE2$to,isDisabled=function(){return isAtomicBlockInSelection(config.getEditorState())},getTooltip=function(){return config.t(isDisabled()?"TextLinkButton_DisableButtonForPlugins_Tooltip":"TextLinkButton_Tooltip")};return _extends({TextButtonMapper:function(){var _ref2;return(_ref2={})[FORMATTING_BUTTONS.LINK]={component:function(props){return React.createElement(TextLinkButton,Object.assign({insertLinkFn:insertLinkAtCurrentSelection,getEntityData:getEntityData,insertCustomLink:insertCustomLink,isActive:hasLinksInSelection(config.getEditorState()),closeInlinePluginToolbar:config.closeInlinePluginToolbar,tooltipText:getTooltip(),innerModal:config.innerModal,disabled:isDisabled()},props))},keyBindings:[{keyCommand:{command:COMMANDS.LINK,modifiers:[MODIFIERS.COMMAND],key:"k"},commandHandler:function(editorState){if(config.onKeyboardShortcutClick({buttonName:COMMANDS.LINK,pluginId:"LINK"}),hasLinksInSelection(editorState))return config.closeInlinePluginToolbar(),removeLinksInSelection(editorState);isDisabled()||openLinkModal(config)}}],externalizedButtonProps:{onClick:function(e){e.preventDefault(),openLinkModal(config)},isActive:function(){return hasLinksInSelection(config.getEditorState())},isDisabled:isDisabled,getIcon:function(){var _config$LINK_TYPE,_config$LINK_TYPE$too,_config$LINK_TYPE$too2;return(null===(_config$LINK_TYPE=config.LINK)||void 0===_config$LINK_TYPE||null===(_config$LINK_TYPE$too=_config$LINK_TYPE.toolbar)||void 0===_config$LINK_TYPE$too||null===(_config$LINK_TYPE$too2=_config$LINK_TYPE$too.icons)||void 0===_config$LINK_TYPE$too2?void 0:_config$LINK_TYPE$too2.InsertPluginButtonIcon)||function(){var _config$experiments,_config$experiments$n;return LinkIcon({newFormattingToolbar:null==config||null===(_config$experiments=config.experiments)||void 0===_config$experiments||null===(_config$experiments$n=_config$experiments.newFormattingToolbar)||void 0===_config$experiments$n?void 0:_config$experiments$n.enabled})}},tooltip:getTooltip(),getLabel:function(){return""},type:BUTTON_TYPES.BUTTON}},_ref2}},!1===(null===(_config$LINK_TYPE2=config.LINK)||void 0===_config$LINK_TYPE2||null===(_config$LINK_TYPE2$to=_config$LINK_TYPE2.toolbar)||void 0===_config$LINK_TYPE2$to?void 0:_config$LINK_TYPE2$to.inlineToolbar)?{}:{InlinePluginToolbarButtons:createInlineButtons(config)},{name:"link"})}(_extends({},config,{settings:settings,closeInlinePluginToolbar:closeInlinePluginToolbar})),decorators=[{strategy:linkEntityStrategy,component:function(props){var componentData=null==props?void 0:props.contentState.getEntity(null==props?void 0:props.entityKey).getData();return React.createElement(LinkViewer,Object.assign({componentData:componentData,anchorTarget:anchorTarget,relValue:relValue,theme:theme},props))}}],shouldConvertToLinkPreview=function(linkifyData){var _linkifyData$block;return linkifyData&&"unstyled"===(null===(_linkifyData$block=linkifyData.block)||void 0===_linkifyData$block?void 0:_linkifyData$block.getType())&&config[LINK_PREVIEW_TYPE]},getBlockLinkUrl=function(linkifyData){var string=linkifyData.string;if(linkifyData.block.getText()===string)return string};function closeInlinePluginToolbar(){commonPubsub.set("cursorOnInlinePlugin",null)}var getLinkifyData=function(editorState){var strData=findLastStringWithNoSpacesAndSoftLines(editorState);return shouldLinkify(strData)?strData:void 0},shouldLinkify=function(consecutiveString){return consecutiveString.string.length>=settings.minLinkifyLength&&isValidUrl(consecutiveString.string)&&!(rangeContainsEntity(consecutiveString)&&blockContainsPlainText(consecutiveString))&&!(null!=settings&&settings.disableAutoLink)},findLastStringWithNoSpacesAndSoftLines=function(editorState){var selection=editorState.getSelection(),blockKey=selection.getAnchorKey(),block=editorState.getCurrentContent().getBlockForKey(blockKey),text=block.getText(),endIndex=selection.getEndOffset(),spaceIndex=text.lastIndexOf(" ",endIndex)+1,softLineIndex=text.lastIndexOf("\n",endIndex)+1,index=Math.max(spaceIndex,softLineIndex);return{string:text.slice(index,endIndex),block:block,blockKey:blockKey,index:index,endIndex:endIndex}},rangeContainsEntity=function(_ref){for(var block=_ref.block,index=_ref.index,endIndex=_ref.endIndex,i=index;i<endIndex;i++)if(null!==block.getEntityAt(i))return!0;return!1},blockContainsPlainText=function(_ref2){var block=_ref2.block,string=_ref2.string;return block.getText().length>string.length},addLinkAt=function(_ref3,editorState){var string=_ref3.string,index=_ref3.index,endIndex=_ref3.endIndex,blockKey=_ref3.blockKey;return insertLinkInPosition(editorState,blockKey,index,endIndex,{url:string,rel:rel,target:target})};return createBasePlugin(_extends({theme:theme,toolbar:toolbar,type:type,anchorTarget:anchorTarget,relValue:relValue,settings:settings,commonPubsub:commonPubsub,defaultPluginData:DEFAULTS},rest),{decorators:decorators,handleBeforeInput:function(chars,editorState,eventTimeStamp,pluginFunctions){return/\s/.test(chars)&&(linkifyData=getLinkifyData(editorState)),"not-handled"},handleReturn:function(event,editorState,pluginFunctions){if(linkifyData=getLinkifyData(editorState),shouldConvertToLinkPreview(linkifyData)){var _linkifyData,url=getBlockLinkUrl(linkifyData),blockKey=null===(_linkifyData=linkifyData)||void 0===_linkifyData?void 0:_linkifyData.block.getKey();if(url&&blockKey){var linkData=createLinkEntityData({url:url,target:target,rel:rel});addLinkPreview(editorState,config,blockKey,linkData)}}return"not-handled"},onChange:function(editorState){var selection=editorState.getSelection();hasLinksInSelection(editorState)&&selection.isCollapsed()&&selection.getHasFocus()?setTimeout((function(){var commonPubsubData,boundingRect=getVisibleSelectionRect(window);commonPubsubData={type:type,boundingRect:boundingRect},commonPubsub.set("cursorOnInlinePlugin",commonPubsubData)})):closeInlinePluginToolbar();var newEditorState=editorState;return!function(editorState){var contentState=editorState.getCurrentContent(),contentChanged=contentState!==prevContentState;return prevContentState=contentState,contentChanged&&"insert-fragment"===editorState.getLastChangeType()}(editorState)?linkifyData&&(newEditorState=addLinkAt(linkifyData,editorState)):newEditorState=fixPastedLinks(editorState,{anchorTarget:anchorTarget,relValue:relValue}),linkifyData=void 0,newEditorState}})};createLinkPlugin.functionName="LINK";var createLinkData=function(pluginData,isRicosSchema){return void 0===pluginData&&(pluginData={}),void 0===isRicosSchema&&(isRicosSchema=!1),isRicosSchema?convertDecorationDataToDraft("LINK",pluginData):pluginData},linkDataDefaults_linkData={link:{target:"SELF",url:"",anchor:"",rel:{nofollow:null,sponsored:null,ugc:null},customData:null}},urlRegex=/(?:https?:\/\/)?(?:www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z]{2,}\b(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)(?:[-a-zA-Z0-9@:%._+~#=?!&/]*)/gi,urlRegexExact=new RegExp("^"+urlRegex.source+"$","gi"),urlRegexExactWithSpace=new RegExp("^"+urlRegex.source+"[\\s\\n]$","gi"),linkifyLastWord=function(_ref){var _text$match,editor=_ref.editor,_editor$state$selecti=editor.state.selection.$from,nodeBefore=_editor$state$selecti.nodeBefore,pos=_editor$state$selecti.pos,_ref2=nodeBefore||{},text=_ref2.text,nodeBeforeSize=_ref2.nodeSize,url=null==text||null===(_text$match=text.match(urlRegex))||void 0===_text$match?void 0:_text$match[0],urlIndex=text?text.search(urlRegex):-1;if(nodeBeforeSize&&url&&-1!==urlIndex){var from=pos-nodeBeforeSize+urlIndex;editor.chain().focus().setTextSelection({from:from,to:pos}).setLink({link:{url:url}}).setTextSelection(pos).run()}return!1},createTiptapExtensions=function(defaultOptions){return[{type:"mark",createExtensionConfig:function(_ref3){var markPasteRule=_ref3.markPasteRule,markInputRule=_ref3.markInputRule,Plugin=_ref3.Plugin,PluginKey=_ref3.PluginKey;return{name:"link",priority:1e3,inclusive:!1,defaultOptions:_extends({openOnClick:!0,linkOnPaste:!0,HTMLAttributes:{link:{}}},defaultOptions),addAttributes:function(){return linkDataDefaults_linkData},parseHTML:function(){return[{tag:"a[href]"}]},renderHTML:function(_ref4){var HTMLAttributes=_ref4.HTMLAttributes,classes=classNames(styles.link,styles.linkInViewer),_parseLink=function(_ref5){var url=_ref5.url,rel=_ref5.rel,target=_ref5.target,anchor=_ref5.anchor,customData=_ref5.customData;return{anchor:anchor,url:url,rel:rel&&Object.entries(rel).flatMap((function(_ref6){var key=_ref6[0];return _ref6[1]?key:[]})).join(" "),target:target&&"_"+target.toLowerCase(),customData:customData}}(HTMLAttributes.link);return["a",{href:_parseLink.url,rel:_parseLink.rel,target:_parseLink.target,class:classes},0]},addCommands:function(){return{setLink:function(attributes){return function(_ref5){return _ref5.commands.setMark("link",attributes)}},toggleLink:function(attributes){return function(_ref6){return _ref6.commands.toggleMark("link",attributes)}},unsetLink:function(){return function(_ref7){return _ref7.commands.unsetMark("link")}}}},addPasteRules:function(){return[markPasteRule(urlRegex,this.type,(function(match){return{link:{url:match[0]}}}))]},addInputRules:function(){return[markInputRule(urlRegexExactWithSpace,this.type,(function(match){return{link:{url:match[0].trim()}}}))]},addProseMirrorPlugins:function(){var _this=this,plugins=[];return this.options.openOnClick&&plugins.push(new Plugin({key:new PluginKey("handleClickLink"),props:{handleClick:function(view,pos,event){var _event$target,attrs=_this.editor.getAttributes("link");return!(!(null===(_event$target=event.target)||void 0===_event$target?void 0:_event$target.closest("a"))||!attrs.href)&&(window.open(attrs.href,attrs.target),!0)}}})),this.options.linkOnPaste&&plugins.push(new Plugin({key:new PluginKey("handlePasteLink"),props:{handlePaste:function(view,event,slice){if(view.state.selection.empty)return!1;var textContent="";return slice.content.forEach((function(node){textContent+=node.textContent})),!(!textContent||!textContent.match(urlRegexExact))&&(_this.editor.commands.setMark(_this.type,{link:{url:textContent}}),!0)}}})),plugins}}}},{type:"extension",createExtensionConfig:function(){return{name:"linkEnter",addKeyboardShortcuts:function(){return{Enter:linkifyLastWord,Space:linkifyLastWord}}}}}]},pluginLink=function(config){var pluginConfig=_extends({},DEFAULTS.config,config);return{config:pluginConfig,type:"LINK",createPlugin:createLinkPlugin,ModalsMap:{},createPluginData:createLinkData,tiptapExtensions:createTiptapExtensions(pluginConfig)}};export{EXTERNAL_LINK_TYPE,LINK_TYPE,LinkViewer,createLinkPlugin,pluginLink};
//# sourceMappingURL=module.js.map

@@ -1,27 +0,5 @@

export * from './types';
export { default as AccessibilityListener } from './Components/AccessibilityListener';
export { default as ViewportRenderer } from './Components/ViewportRenderer';
export { default as withI18n, translate, Trans, RicosTranslate } from './Utils/withI18n';
export { default as createHocName } from './Utils/createHocName';
export { sizeClassName, alignmentClassName, textWrapClassName, depthClassName, } from './Utils/classNameStrategies';
export { mergeStyles } from './Utils/mergeStyles';
export { convertRelObjectToString, convertRelStringToObject, convertTargetStringToBoolean, convertTargetBooleanToString, getRelValue, } from './Utils/linkConverters';
export { safeJsonParse } from './Utils/jsonUtils';
export { anchorScroll, addAnchorTagToUrl, isNewTab } from './Utils/anchor';
export * from 'ricos-content';
export { default as getDisplayName } from './Utils/getDisplayName';
export { hasLinksInBlock, getLinkRangesInBlock } from './Utils/draftUtils';
export { validate, getContentStateSchema } from './Utils/data-schema-validator';
export { isSSR } from './Utils/ssrUtils';
export { getTextDirection, getDirectionFromAlignmentAndTextDirection } from './Utils/textDirection';
export { GlobalContext } from './Utils/contexts';
export { isHexColor } from './Utils/colorUtils';
export { isRtl, getLangDir } from './Utils/rtlUtils';
export { simplePubsub, Pubsub, Store } from './Utils/simplePubsub';
export { generateKey } from './Utils/generateKey';
export { getBlocksFromContentState } from './Utils/innerRCEBlocksUtils';
export * from './consts';
export { default as createJustificationFixDecorator } from './draftDecorators/createJustificationFixDecorator';
export { parseStyleByType, CustomInlineStyleType, INLINE_STYLE_TYPES, defaultStyleFnMapper, dynamicStyleParsers, getDynamicInlineStyleMapper, draftDecorationsToCss, } from './Utils/viewerUtils';
export { default as uuid } from './Utils/uuid';
export { createLinkPlugin } from './createLinkPlugin';
export { EXTERNAL_LINK_TYPE, LINK_TYPE } from './types';
export { default as LinkViewer } from './LinkViewer';
export { pluginLink } from './editor';
//# sourceMappingURL=index.d.ts.map

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

{"name":"richlagetest","version":"0.0.0-09b87b046fae0e0cd11e7abfb50826eaaf8e7800"}
{"name":"richlagetest","version":"0.0.0-0c51a1140f567e2d087a75e68f679500b8a1d7fc"}

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc