"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),r=require("@material-ui/core"),t=require("@material-ui/icons/Language"),a=require("classnames"),s=require("./Constants.js"),n=require("./Elements/ImageElement/ImageElement.js"),l=require("./Elements/VideoElement/VideoElement.js"),i=require("./style.css.js"),c=require("react/jsx-runtime");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=o(e),u=o(t),m=o(a);function h(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,a)}return t}function j(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?h(Object(t),!0).forEach((function(r){d.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):h(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var b=r.withStyles({tooltip:{height:24,maxWidth:168}})(r.Tooltip),p=r.withStyles({root:{color:"#bdbdbd",fontSize:14,marginRight:8}})(u.default);exports.Element=function(e){var r=e.attributes,t=e.children,a=e.element;switch(a.type){case"block-quote":return c.jsx("blockquote",j(j({},r),{},{children:t}));case"bulleted-list":return c.jsx("ul",j(j({},r),{},{className:i.bulletedList,children:t}));case"numbered-list":var o,d,u=i.numberedList;return 1===(null===(o=a.children)||void 0===o?void 0:o.length)&&null!==(d=a.children)&&void 0!==d&&d[0].textPrimary&&(u=m.default(i.listItem,i.listItemPrimary)),c.jsx("ol",j(j({},r),{},{className:u,start:null==a?void 0:a.startPosition,children:t}));case"list-item":var h,x,f=i.listItem;return 1===(null===(h=a.children)||void 0===h?void 0:h.length)&&null!==(x=a.children)&&void 0!==x&&x[0].textPrimary&&(f=m.default(i.listItem,i.listItemPrimary)),c.jsx("li",j(j({},r),{},{className:f,children:t}));case"image":return c.jsx(n,j({},e));case s.TEXT_FORMATS.headerOne:return c.jsx("div",{className:i.headerOne,children:t});case s.TEXT_FORMATS.headerTwo:return c.jsx("div",{className:i.headerTwo,children:t});case s.TEXT_FORMATS.headerThree:return c.jsx("div",{className:i.headerThree,children:t});case s.TEXT_FORMATS.body:return c.jsx("div",{className:i.body,children:t});case s.TEXT_FORMATS.caption:return c.jsx("div",{className:i.caption,children:t});case s.TEXT_FORMATS.code:return c.jsx("pre",{className:m.default("language-js",i.codeBlock),children:t});case"video":return c.jsx(l,j({},e));case"link":return c.jsx(b,{placement:"bottom-start",title:c.jsxs("span",{className:i.richTextEditorPopoverLinkElement,children:[c.jsx(p,{}),c.jsx("a",{href:a.url,children:a.url})]}),children:c.jsx("a",j(j({},r),{},{href:a.url,className:i.richTextEditorLinkElement,children:t}))});default:return c.jsx("div",{className:i.body,children:t})}},exports.Leaf=function(e){var r=e.attributes,t=e.leaf,a=e.children;return t.bold&&(a=c.jsx("strong",{children:a})),t.italic&&(a=c.jsx("em",{children:a})),t.underline&&(a=c.jsx("u",{children:a})),t.contrastText&&(a=c.jsx("span",{className:i.contrastText,children:a})),t.textPrimary&&(a=c.jsx("span",{className:i.textPrimary,children:a})),t.bodyLeaf&&(a=c.jsx("span",{className:i.body,children:a})),t.captionLeaf&&(a=c.jsx("span",{className:i.caption,children:a})),t.codeLeaf&&(a=c.jsx("span",{className:i.code,children:a})),t.headerOneLeaf&&(a=c.jsx("span",{className:i.headerOne,children:a})),t.headerTwoLeaf&&(a=c.jsx("span",{className:i.headerTwo,children:a})),t.headerThreeLeaf&&(a=c.jsx("span",{className:i.headerThree,children:a})),c.jsx("span",j(j({},r),{},{className:m.default("token",d.default({"attr-name":t["attr-name"],"class-name":t["class-name"],boolean:t.boolean,char:t.char,comment:t.comment||t.visiblePragma,constant:t.constant,constants:t.constants,function:t.function,keyword:t.keyword,number:t.number,operator:t.operator,punctuation:t.punctuation,regex:t.regex,selector:t.selector,string:t.string,symbol:t.symbol,tag:t.tag,url:t.url,variable:t.variable},i.invisible,t.invisiblePragma)),children:a}))};
