Liferay.Loader.define("dynamic-data-mapping-form-field-type@6.0.108/RichText/RichText.es",["module","exports","require","frontend-editor-ckeditor-web","liferay!frontend-js-react-web$react","../FieldBase/ReactFieldBase.es"],(function(e,t,n){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=n("frontend-editor-ckeditor-web"),a=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=i();if(t&&t.has(e))return t.get(e);var n={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if(Object.prototype.hasOwnProperty.call(e,a)){var o=r?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(n,a,o):n[a]=e[a]}n.default=e,t&&t.set(e,n);return n}(n("liferay!frontend-js-react-web$react")),o=n("../FieldBase/ReactFieldBase.es");function i(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return i=function(){return e},e}function l(){return(l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}const e=/alert\((.*?)\)/,d=/<%[\s\S]*?%>/g,f=/(<asp:[^]+>[\s|\S]*?<\/asp:[^]+>)|(<asp:[^]+\/>)/gi,s=/<[^>]+?(\s+\bon\w+=(?:'[^']*'|"[^"]*"|[^'"\s>]+))*\s*\/?>/gi,p=/innerHTML\s*=\s*.*?/,g=/(\s+\bon\w+=(?:'[^']*'|"[^"]*"|[^'"\s>]+))/gi,y=/<\?[\s\S]*?\?>/g;var c=t=>{let{editable:n,editingLanguageId:i,editorConfig:c,id:b,name:v,onBlur:O,onChange:m,onFocus:j,predefinedValue:w="",readOnly:h,value:L,visible:P}=t,B=u(t,["editable","editingLanguageId","editorConfig","id","name","onBlur","onChange","onFocus","predefinedValue","readOnly","value","visible"]);const F=(0,a.useRef)(),C=(0,a.useMemo)((()=>n?w:null!=L?L:w),[n,w,L]);function E(t){return t.replace(s,(e=>e.replace(g,""))).replace(e,"").replace(p,"").replace(y,"").replace(d,"").replace(f,"")}return(0,a.useEffect)((()=>{var e;const t=null===(e=F.current)||void 0===e?void 0:e.editor;t&&(t.config.contentsLangDirection=Liferay.Language.direction[i],t.config.contentsLanguage=i,t.setData(C))}),[i,w]),a.default.createElement(o.FieldBase,l({},B,{id:b,name:v,readOnly:h,style:h?{pointerEvents:"none"}:null,visible:P}),a.default.createElement(r.ClassicEditor,{contents:C,editorConfig:c,name:v,onBlur:O,onChange:e=>{if(C!==e){const t=E(e);m({target:{value:t}})}},onFocus:j,onSetData:({data:{dataValue:e},editor:{mode:t}})=>{if("source"===t){const t=E(e);m({target:{value:t}})}},readOnly:h,ref:F}),a.default.createElement("input",{name:v,type:"hidden",value:C}))};t.default=c}}));
//# sourceMappingURL=RichText.es.js.map