react-bricks 4.7.7-beta.0 → 4.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{_ as e,a as r,b as n,c as t,g as i,d as o,p as a,e as l,t as u,f as d,h as c}from"./react-bricks-DQcHsMAz.esm.js";import{g as s,a as m}from"./react-bricks-OncRrHCV.esm.js";import*as p from"react";import g,{useState as f,useEffect as h}from"react";import v from"classnames";import{P as y}from"./react-bricks-tEFCCN5P.esm.js";import{f as b}from"./react-bricks-Co69y3so.esm.js";import{D as k,v as E,a as P}from"./react-bricks-BpHMO2iJ.esm.js";var w={isAdmin:!1,bricks:{},themes:[]},N=function(){function u(){return this.configListeners=new Set,this.pageListeners=new Set,u.instance?console.warn("Constructor - instance already created"):(u.instance=this,w.pid=Math.floor(1e3*Math.random())),u.instance}return u.prototype.register=function(e,r){if(void 0===r&&(r=!1),!(!r&&w.config&&Object.keys(w.bricks).length>0)){w.config=e;var n=u.instance.mapConfig(e),t=n.bricks,i=n.themes;w.bricks=t,w.themes=i,this.notifyConfigListeners()}},u.prototype.setPage=function(e){w.currentPage=e,this.notifyPageListeners()},u.prototype.setBlock=function(e){w.currentBlock=e},u.prototype.setIsAdmin=function(e){w.isAdmin=e},u.prototype.setPathname=function(e){w.currentPathname=e},u.prototype.getConfig=function(){if(!w.config)throw new Error("React Bricks Config not registered [1]");return w.config},u.prototype.getBrick=function(e){if(!w.config)throw new Error("React Bricks Config not registered [2]");return w.bricks[e.type]?w.bricks[e.type]:null},u.prototype.getBricks=function(){if(!w.config)throw new Error("React Bricks Config not registered [3]");return w.bricks},u.prototype.getThemes=function(){if(!w.config)throw new Error("React Bricks Config not registered [4]");return w.themes},u.prototype.getPage=function(){return w.currentPage},u.prototype.getPageValues=function(){if(!w.currentPage)return null;var r=w.currentPage;return r.content,e(r,["content"])},u.prototype.getBlock=function(){return w.currentBlock||null},u.prototype.getBlockValue=function(e){return w.currentBlock&&w.currentBlock.props[e]?w.currentBlock.props[e]:null},u.prototype.getPageType=function(e){var r,n;return e&&(null===(r=w.config)||void 0===r?void 0:r.pageTypes)&&(null===(n=w.config)||void 0===n?void 0:n.pageTypes.find((function(r){return r.name===e.type})))},u.prototype.getPathname=function(){return w.currentPathname},u.prototype.isAdmin=function(){return w.isAdmin},u.prototype.isRegistered=function(){return!!w.config},u.prototype.mapConfig=function(e){var u,d=e.bricks;if(d&&0!==d.length||(console.warn("No bricks provided. Using default paragraph."),d=[]),e.pageTypes||console.warn("No Page type schema provided. Using default page."),!Array.isArray(d))throw console.error('"bricks" should be an array of Bricks or an array of Themes'),new Error('"bricks" should be an array of Bricks or an array of Themes');if(!Array.isArray(e.pageTypes))throw console.error('"pageTypes" should be an array'),new Error('"pageTypes" should be an array');r(d)?(u=n([],t(d),!1),d=i(u)):(u=o(d),d=n([],t(d),!1));var c=function(){return null};c.schema={name:"default-embed-brick",label:"Embed Page",category:"Embed",sideEditProps:[{name:"RB_PAGE_EMBED",label:"Embed page / entity",type:"RELATIONSHIP",relationshipOptions:{references:"",multiple:!1,embedValues:!1},helperText:"Choose a page, save to view it."}]},e.enableDefaultEmbedBrick&&(null==d||d.push(c),u=a(u,c));var s=null==d?void 0:d.reduce((function(e,r){var n;return l(l({},e),((n={})[r.schema.name]=r,n))}),{});return{bricks:s,themes:u}},u.prototype.__subscribeConfig=function(e){var r=this;return this.configListeners.add(e),function(){r.configListeners.delete(e)}},u.prototype.__subscribePage=function(e){var r=this;return this.pageListeners.add(e),function(){r.pageListeners.delete(e)}},u.prototype.notifyConfigListeners=function(){this.configListeners.forEach((function(e){return e()}))},u.prototype.notifyPageListeners=function(){this.pageListeners.forEach((function(e){return e()}))},u}(),B=new N;Object.freeze(B);var L,I=function(r){var n,t,i,o=r.href,a=r.children,u=r.target,d=r.className,c=r.activeClassName,s=r.simpleAnchor,m=void 0!==s&&s,g=r.tabIndex,f=e(r,["href","children","target","className","activeClassName","simpleAnchor","tabIndex"]);if(null===(n=I.prototype)||void 0===n?void 0:n.renderAdmin)return null===(t=I.prototype)||void 0===t?void 0:t.renderAdmin(l({href:o,children:a,target:u,className:d,activeClassName:c,simpleAnchor:m,tabIndex:g},f));B.isRegistered()&&(i=B.getConfig());var h={href:o},v=g?{tabIndex:g}:{};return/^\/(?!\/)/.test(o)?!(null==i?void 0:i.renderLocalLink)||m?p.createElement("a",l({},h,{target:u,className:d},v,f),a):i.renderLocalLink(l({href:o,target:u,children:a,className:d,activeClassName:c,tabIndex:g},f)):p.createElement("a",l({},h,{target:u,className:d},f),a)},x=function(e){var r,n=e.allowedExtensions,t=void 0===n?[]:n,i=e.propName,o=e.renderBlock,a=e.source;if(null===(r=x.prototype)||void 0===r?void 0:r.renderAdmin)return x.prototype.renderAdmin({propName:i,renderBlock:o,allowedExtensions:t});var u=a||null;return u?o(l(l({},u),{url:s(u.url,u.name)})):null},F=function(e){e.propName;var r=e.source,n=e.alt,t=e.maxWidth,i=e.aspectRatio,o=e.wrapper;e.noLazyLoad,e.containerClassName,e.containerStyle;var a=e.imageClassName,u=e.imageStyle,d=void 0===u?{}:u;e.noWrapper;var c=e.sizes,g=void 0===c?"100vw":c,f=e.loading,h=void 0===f?"lazy":f;e.renderWrapper,e.useNativeLazyLoading,e.useWebP;var y=e.placeholder;if(!r){if(y){var b=y({aspectRatio:i,maxWidth:t,isDarkColorMode:!1,isAdmin:!1});return b?o({children:p.createElement("img",{src:b,alt:n,className:a,style:d})}):null}return null}var k=(null==r?void 0:r.alt)||n,E=s(r.src,r.seoName);r.fallbackSrc&&s(r.fallbackSrc,r.seoName),s(r.placeholderSrc||"",r.seoName);var P=m(r.srcSet,r.seoName);r.fallbackSrc&&m(r.fallbackSrc,r.seoName);var w=r.highPriority?"eager":h,N={src:E,srcSet:P,sizes:g,alt:k,width:r.width+"",height:r.height+"",loading:w,decoding:"async",className:v("rb-lazy",a),style:d};return Boolean(p.use)?N.fetchPriority=r.highPriority?"high":"auto":N.fetchpriority=r.highPriority?"high":"auto",o({width:r.width,height:r.height,children:p.createElement(p.Fragment,null,p.createElement("img",l({},N)))})},T=function(e){var r,n;if(null===(r=T.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=T.prototype)||void 0===n?void 0:n.renderAdmin(e);var t=B.getPageValues(),i=function(e,r){return e.readonly?e.source:e.metaFieldName?null==r?void 0:r.meta[e.metaFieldName]:e.customFieldName&&(null==r?void 0:r.customValues)?null==r?void 0:r.customValues[e.customFieldName]:e.source}(e,t),o=function(e){var r=e.children;return p.createElement(p.Fragment,null,r)};return!e.containerClassName&&!e.containerStyle||e.noWrapper||(o=function(r){var n=r.children;return p.createElement("div",{className:e.containerClassName,style:e.containerStyle},n)}),e.renderWrapper&&(o=e.renderWrapper),p.createElement(F,l({},e,{source:i,wrapper:o,placeholder:e.placeholder}))},C=function(r){var n,t=r.block,i=r.index,o=r.itemsCount,a=r.page,u=e(r,["block","index","itemsCount","page"]);if(!B.getConfig())return console.warn("React Bricks Store is not initialized"),null;B.setBlock(t);var d=B.getBrick(t);if(a||(a=B.getPage()),!d)return"development"===(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.NODE_ENV)&&console.warn('Missing component for block type "'.concat(t.type,'"')),console.error('Missing component for block type "'.concat(t.type,'"')),null;var c=l(l({},t.props),u);return d.schema.mapExternalDataToProps&&"function"==typeof d.schema.mapExternalDataToProps&&(null==a?void 0:a.externalData)&&"object"==typeof a.externalData&&(c=l(l({},c),d.schema.mapExternalDataToProps(a.externalData,t.props))),g.createElement(d,l({},c,{index:i,itemsCount:o,__page:a,__block:t}))},A=function(e){var r,n,t=e.propName,i=e.itemProps,o=void 0===i?{}:i,a=e.renderWrapper,u=e.renderItemWrapper,d=e.items;if(null===(r=A.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=A.prototype)||void 0===n?void 0:n.renderAdmin({propName:t,itemProps:o,renderWrapper:a,renderItemWrapper:u});if(!d||0===d.length)return null;var c=B.getPage(),s=d.length,m=p.createElement(p.Fragment,null,d.map((function(e,r){var n=p.createElement(C,l({page:c,key:"".concat(e.id,"-").concat(r),block:e,index:r,itemsCount:s},o));return u?u(n,r,d.length):n})));return a?a(m):m},S=function(r,n,t){if(y.isText(r)){var i=H(r.text);return n.filter((function(e){return"Mark"===e.type})).reduce((function(e,n){return r[n.name]?n.renderLeaf({children:e}):e}),i)}var o=n.filter((function(e){return"List"===e.type})).find((function(e){return r.type===e.name}));if(o){var a=R(r,n);return o.renderElement({children:a.map((function(e,r){return p.createElement(p.Fragment,{key:r},o.renderItemElement({children:e}))})),element:{url:r.url,data:r.data}})}var u=R(r,n,t),d=n.filter((function(e){return"Block"===e.type})).find((function(e){return r.type===e.name}));if(d){r.children,r.type;var c=e(r,["children","type"]);return d.renderElement({children:u,element:l({},c)})}return t?t({children:u,element:{type:"",children:[]},attributes:{ref:null}}):u},R=function(e,r,n){var t;return null===(t=e.children)||void 0===t?void 0:t.map((function(e,t){return p.createElement(p.Fragment,{key:t},S(e,r,n))}))},H=function(e){var r=null==e?void 0:e.replace(/\n/g,"<|BR|>\n<|BR|>").split("<|BR|>");if(r)return 1===r.length?e:p.createElement(p.Fragment,null,r.map((function(e,r,n){return"\n"===e&&n.length===r+1||"\n"===e&&n.length===r+2&&""===n[n.length-1]?p.createElement(p.Fragment,{key:r},p.createElement("br",null)," "):"\n"===e?p.createElement("br",{key:r}):p.createElement(p.Fragment,{key:r},e)})))},z=function(e){var r,n,t,i=e.renderBlock,o=void 0===i?function(e){var r=e.children;return p.createElement("p",null,r)}:i,a=e.placeholder,l=void 0===a?"Type a text...":a,u=e.renderPlaceholder,d=e.propName,c=e.value,s=e.plugins,m=void 0===s?[]:s,g=e.multiline,f=void 0===g||g,h=e.softLineBreak,v=void 0===h||h,b=e.metaFieldName,k=e.customFieldName,E=e.customFieldPlainText,P=void 0===E||E,w=e.shouldRefreshStyles;if(null===(r=z.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=z.prototype)||void 0===n?void 0:n.renderAdmin({renderBlock:o,placeholder:l,renderPlaceholder:u,propName:d,plugins:m,multiline:f,softLineBreak:v,metaFieldName:b,customFieldName:k,customFieldPlainText:P,shouldRefreshStyles:w});var N,L=B.getBlock(),I=B.getPageValues(),x=c||(d&&(null===(t=null==L?void 0:L.props)||void 0===t?void 0:t[d])?null==L?void 0:L.props[d]:b?(null==I?void 0:I.meta[b])||"":k&&(null==I?void 0:I.customValues)&&(null==I?void 0:I.customValues[k])||"");return x?(N="string"==typeof x?y.deserialize(x):x||[],p.createElement(p.Fragment,null,N.map((function(e,r){return p.createElement(p.Fragment,{key:r},S(e,m,o))})))):null},_=function(e){var r,n;return(null===(r=_.prototype)||void 0===r?void 0:r.adminConstructor)?null===(n=_.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:"Mark",name:e.name,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderLeaf:e.render,toggle:function(e){}}},D=_({name:"bold",hotKey:"mod+b",render:function(e){return p.createElement("strong",null,e.children)}}),K=_({name:"code",hotKey:"mod+`",render:function(e){return p.createElement("code",{style:{margin:"0 1px",display:"inline-block",padding:"3px 6px",fontSize:"0.875rem",lineHeight:1.25,maxWidth:"100%",fontFamily:'Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',borderRadius:"3px",backgroundColor:"#F5F7F9"}},e.children)}}),M=function(e){var r,n;return(null===(r=M.prototype)||void 0===r?void 0:r.adminConstructor)?null===(n=M.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:e.itemName?"List":"Block",name:e.name,isInline:e.isInline,itemName:e.itemName,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderElement:e.render,renderItemElement:e.renderItem,toggle:function(e,r){}}},U=M({name:"h1",hotKey:"mod+shift+1",render:function(e){return p.createElement("h1",null,e.children)}}),V=M({name:"h2",hotKey:"mod+shift+2",render:function(e){return p.createElement("h2",null,e.children)}}),W=M({name:"h3",hotKey:"mod+shift+3",render:function(e){return p.createElement("h3",null,e.children)}}),O=M({name:"h4",hotKey:"mod+shift+4",render:function(e){return p.createElement("h4",null,e.children)}}),j=M({name:"h5",hotKey:"mod+shift+5",render:function(e){return p.createElement("h5",null,e.children)}}),q=M({name:"h6",hotKey:"mod+shift+6",render:function(e){return p.createElement("h6",null,e.children)}}),J=_({name:"highlight",hotKey:"mod+h",render:function(e){return p.createElement("mark",{style:{paddingLeft:4,paddingRight:4,borderRadius:2,backgroundColor:"#ff0",color:"#0f0f05"}},e.children)}}),Q=_({name:"italic",hotKey:"mod+i",render:function(e){return p.createElement("em",null,e.children)}}),G=function(e){var r,n;return(null===(r=G.prototype)||void 0===r?void 0:r.adminConstructor)?null===(n=G.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:e.itemName?"List":"Block",name:e.name,isInline:e.isInline,itemName:e.itemName,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderElement:e.render,renderItemElement:e.renderItem,toggle:function(e,r){}}},X=G({name:"link",label:"Link",isInline:!0,render:function(e){var r,n,t=e.element,i=e.children,o={};return(null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.isTargetBlank)&&(o.target="_blank",o.rel="noopener"),p.createElement(I,l({},o,{href:(null==t?void 0:t.url)||(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.url)}),i)},getDefaultProps:function(){return{url:"",isTargetBlank:!1}},pluginCustomFields:[]}),Y=M({name:"ol",label:"Number list",itemName:"li",render:function(e){return p.createElement("ol",{className:"list-decimal"},e.children)},renderItem:function(e){return p.createElement("li",null,e.children)}}),Z=M({name:"quote",render:function(e){return p.createElement("blockquote",null,e.children)}}),$=_({name:"sub",render:function(e){return p.createElement("sub",null,e.children)}}),ee=_({name:"sup",render:function(e){return p.createElement("sup",null,e.children)}}),re=M({name:"ul",label:"Bullet list",itemName:"li",render:function(e){return p.createElement("ul",{className:"list-disc"},e.children)},renderItem:function(e){return p.createElement("li",null,e.children)}}),ne=((L={})[u.RichTextFeatures.Bold]={newPlugin:D,renderLeaf:"renderBold"},L[u.RichTextFeatures.Italic]={newPlugin:Q,renderLeaf:"renderItalic"},L[u.RichTextFeatures.Highlight]={newPlugin:J,renderLeaf:"renderHighlight"},L[u.RichTextFeatures.Code]={newPlugin:K,renderLeaf:"renderCode"},L[u.RichTextFeatures.Subscript]={newPlugin:$,renderLeaf:"renderSub"},L[u.RichTextFeatures.Superscript]={newPlugin:ee,renderLeaf:"renderSup"},L[u.RichTextFeatures.Link]={newPlugin:X,renderLink:"renderLink"},L[u.RichTextFeatures.UnorderedList]={newPlugin:re,renderElement:"renderUL",renderItemElement:"renderLI"},L[u.RichTextFeatures.OrderedList]={newPlugin:Y,renderElement:"renderOL",renderItemElement:"renderLI"},L[u.RichTextFeatures.Heading1]={newPlugin:U,renderElement:"renderH1"},L[u.RichTextFeatures.Heading2]={newPlugin:V,renderElement:"renderH2"},L[u.RichTextFeatures.Heading3]={newPlugin:W,renderElement:"renderH3"},L[u.RichTextFeatures.Heading4]={newPlugin:O,renderElement:"renderH4"},L[u.RichTextFeatures.Heading5]={newPlugin:j,renderElement:"renderH5"},L[u.RichTextFeatures.Heading6]={newPlugin:q,renderElement:"renderH6"},L[u.RichTextFeatures.Quote]={newPlugin:Z,renderElement:"renderQuote"},L),te=function(e){var r,n;if(null===(r=te.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=te.prototype)||void 0===n?void 0:n.renderAdmin(e);var t=[];return e.allowedFeatures&&e.allowedFeatures.length>0&&(t=e.allowedFeatures.map((function(r){var n=ne[r],t=n.newPlugin,i=n.renderLeaf,o=n.renderElement,a=n.renderItemElement,u=n.renderLink,d={},c=e[i],s=e[o],m=e[a],p=e[u];return i&&c&&(d.renderLeaf=c),o&&s&&(d.renderElement=s),a&&m&&(d.renderItemElement=m),u&&p&&(d.renderElement=function(e){var r,n,t=e.attributes,i=e.children,o=e.element,a={};return(null===(r=null==o?void 0:o.data)||void 0===r?void 0:r.isTargetBlank)&&(a.target="_blank",a.rel="noopener"),p(l({attributes:t,children:i,element:o,href:o.url||(null===(n=o.data)||void 0===n?void 0:n.url)},a))}),l(l({},t),d)}))),g.createElement(z,{renderBlock:e.renderBlock,placeholder:e.placeholder,propName:e.propName,plugins:t,multiline:e.multiline,softLineBreak:e.softLineBreak,renderPlaceholder:e.renderPlaceholder,metaFieldName:e.metaFieldName,customFieldName:e.customFieldName,customFieldPlainText:e.customFieldPlainText,value:e.value})},ie=function(e){var r,n,t=e.renderBlock,i=void 0===t?function(e){var r=e.children;return p.createElement("p",null,r)}:t,o=e.placeholder,a=void 0===o?"Type a text...":o,l=e.renderPlaceholder,u=e.multiline,d=void 0!==u&&u,c=e.softLineBreak,s=void 0!==c&&c,m=e.propName,g=e.metaFieldName,f=e.customFieldName,h=e.value;if(null===(r=ie.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=ie.prototype)||void 0===n?void 0:n.renderAdmin({renderBlock:i,placeholder:a,renderPlaceholder:l,propName:m,multiline:d,softLineBreak:s,metaFieldName:g,customFieldName:f});var v,b=B.getPageValues(),k=h||(g?(null==b?void 0:b.meta[g])||"":f&&(null==b?void 0:b.customValues)&&(null==b?void 0:b.customValues[f])||"");return k?(v="string"==typeof k?y.deserialize(k):k||[],p.createElement(p.Fragment,null,v.map((function(e,r){return p.createElement(p.Fragment,{key:r},S(e,[],i))})))):null};function oe(e){return d(this,arguments,void 0,(function(e){var r,n,t=e.of,i=e.where,o=e.sort,a=e.page,l=e.pageSize,u=e.children;return c(this,(function(e){switch(e.label){case 0:return(r=B.getConfig())?[4,b({type:t,tag:null==i?void 0:i.tag,language:null==i?void 0:i.language,filterBy:null==i?void 0:i.filterBy,sort:o,page:a,pageSize:l,usePagination:!0,config:r})]:(console.warn("React Bricks Store is not initialized"),[2,null]);case 1:return n=e.sent(),[2,u(n)]}}))}))}function ae(e){var r,n,t=e.of,i=e.where,o=e.sort,a=e.page,l=e.pageSize,u=e.children;return(null===(r=oe.prototype)||void 0===r?void 0:r.renderAdmin)?null===(n=oe.prototype)||void 0===n?void 0:n.renderAdmin({of:t,where:i,sort:o,page:a,pageSize:l,children:u}):oe({of:t,where:i,sort:o,page:a,pageSize:l,children:u})}u.PageStatus.Draft;var le={logoHeight:80,welcomeText:"Welcome",sideImage:"https://images.unsplash.com/photo-1461418559055-6f020c5a91e7?ixlib=rb-1.2.1&auto=format&fit=crop&w=1601&q=80"};function ue(){var e,r;if(null===(e=ue.prototype)||void 0===e?void 0:e.useAdmin)return null===(r=ue.prototype)||void 0===r?void 0:r.useAdmin();var n=t(f((function(){var e=null;try{e=a()}catch(e){}return e})),2),i=n[0],o=n[1];function a(){var e=B.getConfig(),r=B.getBricks(),n=B.getThemes(),t=e.responsiveBreakpoints&&e.responsiveBreakpoints.length?e.responsiveBreakpoints:k,i=le;e.loginUI&&(i=e.loginUI,void 0===e.loginUI.sideImage&&(i.sideImage=le.sideImage),void 0===e.loginUI.welcomeText&&(i.welcomeText=le.welcomeText),void 0===e.loginUI.logoHeight&&(i.logoHeight=le.logoHeight));var o=e.rtlLanguages||["ar","az","dv","fa","ff","he","ks","ku","pa","ps","ug","ur","yi"],a=l(l({},e),{bricks:r||P,themes:n,version:E,browserSupport:{webP:!0,lazyLoading:!0},pageTypes:e.pageTypes||[],logo:e.logo||"",loginUI:i,contentClassName:e.contentClassName||"",defaultTheme:e.defaultTheme||"",loginPath:e.loginPath||"/admin",editorPath:e.editorPath||"/admin/editor",mediaLibraryPath:e.mediaLibraryPath||"/admin/media",playgroundPath:e.playgroundPath||"/admin/playground",appSettingsPath:e.appSettingsPath||"/admin/app-settings",previewPath:e.previewPath||"/preview",isDarkColorMode:e.isDarkColorMode||!1,useCssInJs:e.useCssInJs||!1,clickToEditSide:e.clickToEditSide||u.ClickToEditSide.BottomRight,responsiveBreakpoints:t,enableAutoSave:e.enableAutoSave||!0,disableSaveIfInvalidProps:e.disableSaveIfInvalidProps||!1,enablePreview:e.enablePreview||!0,blockIconsPosition:e.blockIconsPosition||u.BlockIconsPosition.OutsideBlock,enableUnsplash:e.enableUnsplash||!0,enablePreviewImage:e.enablePreviewImage||!0,enablePreviewIcon:e.enablePreviewIcon||!1,enableDefaultEmbedBrick:e.enableDefaultEmbedBrick||!0,allowAccentsInSlugs:e.allowAccentsInSlugs||!1,warningIfLowBattery:e.warningIfLowBattery||!1,isRtlLanguage:function(e){var r=e.language;return o.indexOf(r)>-1},rtlLanguages:o});return a}return h((function(){return B.__subscribeConfig((function(){o(a())}))}),[]),i}var de=function(){var e,r;return(null===(e=de.prototype)||void 0===e?void 0:e.useAdmin)?null===(r=de.prototype)||void 0===r?void 0:r.useAdmin():{isAdmin:!1,previewMode:!1,currentPage:{pageId:""},showRichTextModal:function(){}}},ce=function(){var e,r;if(null===(e=ce.prototype)||void 0===e?void 0:e.useAdmin)return null===(r=ce.prototype)||void 0===r?void 0:r.useAdmin();var n=t(f((function(){var e=null;try{e=B.getPageValues()}catch(e){}return e})),2),i=n[0],o=n[1];h((function(){return B.__subscribePage((function(){o(B.getPageValues())}))}),[]);return[i,function(){}]},se=function(e){var r,n;if(null===(r=se.prototype)||void 0===r?void 0:r.useAdmin){var i=t(null===(n=se.prototype)||void 0===n?void 0:n.useAdmin(e),3);return i[0],[i[1],i[2]]}return[function(e){},!0]};export{te as C,x as F,T as I,I as L,A as R,ie as T,ae as a,z as b,de as c,ce as d,se as e,B as r,ue as u};
2
- //# sourceMappingURL=react-bricks-CfFG357f.esm.js.map
1
+ import{_ as e,a as r,b as n,c as t,g as i,d as o,p as a,e as l,t as u,f as d,h as c}from"./react-bricks-DQcHsMAz.esm.js";import{g as s,a as m}from"./react-bricks-OncRrHCV.esm.js";import*as p from"react";import g,{useState as f,useEffect as h}from"react";import v from"classnames";import{P as y}from"./react-bricks-tEFCCN5P.esm.js";import{f as b}from"./react-bricks-Co69y3so.esm.js";import{D as k,v as E,a as P}from"./react-bricks-BTA_BNN9.esm.js";var w={isAdmin:!1,bricks:{},themes:[]},N=function(){function u(){return this.configListeners=new Set,this.pageListeners=new Set,u.instance?console.warn("Constructor - instance already created"):(u.instance=this,w.pid=Math.floor(1e3*Math.random())),u.instance}return u.prototype.register=function(e,r){if(void 0===r&&(r=!1),!(!r&&w.config&&Object.keys(w.bricks).length>0)){w.config=e;var n=u.instance.mapConfig(e),t=n.bricks,i=n.themes;w.bricks=t,w.themes=i,this.notifyConfigListeners()}},u.prototype.setPage=function(e){w.currentPage=e,this.notifyPageListeners()},u.prototype.setBlock=function(e){w.currentBlock=e},u.prototype.setIsAdmin=function(e){w.isAdmin=e},u.prototype.setPathname=function(e){w.currentPathname=e},u.prototype.getConfig=function(){if(!w.config)throw new Error("React Bricks Config not registered [1]");return w.config},u.prototype.getBrick=function(e){if(!w.config)throw new Error("React Bricks Config not registered [2]");return w.bricks[e.type]?w.bricks[e.type]:null},u.prototype.getBricks=function(){if(!w.config)throw new Error("React Bricks Config not registered [3]");return w.bricks},u.prototype.getThemes=function(){if(!w.config)throw new Error("React Bricks Config not registered [4]");return w.themes},u.prototype.getPage=function(){return w.currentPage},u.prototype.getPageValues=function(){if(!w.currentPage)return null;var r=w.currentPage;return r.content,e(r,["content"])},u.prototype.getBlock=function(){return w.currentBlock||null},u.prototype.getBlockValue=function(e){return w.currentBlock&&w.currentBlock.props[e]?w.currentBlock.props[e]:null},u.prototype.getPageType=function(e){var r,n;return e&&(null===(r=w.config)||void 0===r?void 0:r.pageTypes)&&(null===(n=w.config)||void 0===n?void 0:n.pageTypes.find((function(r){return r.name===e.type})))},u.prototype.getPathname=function(){return w.currentPathname},u.prototype.isAdmin=function(){return w.isAdmin},u.prototype.isRegistered=function(){return!!w.config},u.prototype.mapConfig=function(e){var u,d=e.bricks;if(d&&0!==d.length||(console.warn("No bricks provided. Using default paragraph."),d=[]),e.pageTypes||console.warn("No Page type schema provided. Using default page."),!Array.isArray(d))throw console.error('"bricks" should be an array of Bricks or an array of Themes'),new Error('"bricks" should be an array of Bricks or an array of Themes');if(!Array.isArray(e.pageTypes))throw console.error('"pageTypes" should be an array'),new Error('"pageTypes" should be an array');r(d)?(u=n([],t(d),!1),d=i(u)):(u=o(d),d=n([],t(d),!1));var c=function(){return null};c.schema={name:"default-embed-brick",label:"Embed Page",category:"Embed",sideEditProps:[{name:"RB_PAGE_EMBED",label:"Embed page / entity",type:"RELATIONSHIP",relationshipOptions:{references:"",multiple:!1,embedValues:!1},helperText:"Choose a page, save to view it."}]},e.enableDefaultEmbedBrick&&(null==d||d.push(c),u=a(u,c));var s=null==d?void 0:d.reduce((function(e,r){var n;return l(l({},e),((n={})[r.schema.name]=r,n))}),{});return{bricks:s,themes:u}},u.prototype.__subscribeConfig=function(e){var r=this;return this.configListeners.add(e),function(){r.configListeners.delete(e)}},u.prototype.__subscribePage=function(e){var r=this;return this.pageListeners.add(e),function(){r.pageListeners.delete(e)}},u.prototype.notifyConfigListeners=function(){this.configListeners.forEach((function(e){return e()}))},u.prototype.notifyPageListeners=function(){this.pageListeners.forEach((function(e){return e()}))},u}(),B=new N;Object.freeze(B);var L,I=function(r){var n,t,i,o=r.href,a=r.children,u=r.target,d=r.className,c=r.activeClassName,s=r.simpleAnchor,m=void 0!==s&&s,g=r.tabIndex,f=e(r,["href","children","target","className","activeClassName","simpleAnchor","tabIndex"]);if(null===(n=I.prototype)||void 0===n?void 0:n.renderAdmin)return null===(t=I.prototype)||void 0===t?void 0:t.renderAdmin(l({href:o,children:a,target:u,className:d,activeClassName:c,simpleAnchor:m,tabIndex:g},f));B.isRegistered()&&(i=B.getConfig());var h={href:o},v=g?{tabIndex:g}:{};return/^\/(?!\/)/.test(o)?!(null==i?void 0:i.renderLocalLink)||m?p.createElement("a",l({},h,{target:u,className:d},v,f),a):i.renderLocalLink(l({href:o,target:u,children:a,className:d,activeClassName:c,tabIndex:g},f)):p.createElement("a",l({},h,{target:u,className:d},f),a)},x=function(e){var r,n=e.allowedExtensions,t=void 0===n?[]:n,i=e.propName,o=e.renderBlock,a=e.source;if(null===(r=x.prototype)||void 0===r?void 0:r.renderAdmin)return x.prototype.renderAdmin({propName:i,renderBlock:o,allowedExtensions:t});var u=a||null;return u?o(l(l({},u),{url:s(u.url,u.name)})):null},F=function(e){e.propName;var r=e.source,n=e.alt,t=e.maxWidth,i=e.aspectRatio,o=e.wrapper;e.noLazyLoad,e.containerClassName,e.containerStyle;var a=e.imageClassName,u=e.imageStyle,d=void 0===u?{}:u;e.noWrapper;var c=e.sizes,g=void 0===c?"100vw":c,f=e.loading,h=void 0===f?"lazy":f;e.renderWrapper,e.useNativeLazyLoading,e.useWebP;var y=e.placeholder;if(!r){if(y){var b=y({aspectRatio:i,maxWidth:t,isDarkColorMode:!1,isAdmin:!1});return b?o({children:p.createElement("img",{src:b,alt:n,className:a,style:d})}):null}return null}var k=(null==r?void 0:r.alt)||n,E=s(r.src,r.seoName);r.fallbackSrc&&s(r.fallbackSrc,r.seoName),s(r.placeholderSrc||"",r.seoName);var P=m(r.srcSet,r.seoName);r.fallbackSrc&&m(r.fallbackSrc,r.seoName);var w=r.highPriority?"eager":h,N={src:E,srcSet:P,sizes:g,alt:k,width:r.width+"",height:r.height+"",loading:w,decoding:"async",className:v("rb-lazy",a),style:d};return Boolean(p.use)?N.fetchPriority=r.highPriority?"high":"auto":N.fetchpriority=r.highPriority?"high":"auto",o({width:r.width,height:r.height,children:p.createElement(p.Fragment,null,p.createElement("img",l({},N)))})},T=function(e){var r,n;if(null===(r=T.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=T.prototype)||void 0===n?void 0:n.renderAdmin(e);var t=B.getPageValues(),i=function(e,r){return e.readonly?e.source:e.metaFieldName?null==r?void 0:r.meta[e.metaFieldName]:e.customFieldName&&(null==r?void 0:r.customValues)?null==r?void 0:r.customValues[e.customFieldName]:e.source}(e,t),o=function(e){var r=e.children;return p.createElement(p.Fragment,null,r)};return!e.containerClassName&&!e.containerStyle||e.noWrapper||(o=function(r){var n=r.children;return p.createElement("div",{className:e.containerClassName,style:e.containerStyle},n)}),e.renderWrapper&&(o=e.renderWrapper),p.createElement(F,l({},e,{source:i,wrapper:o,placeholder:e.placeholder}))},C=function(r){var n,t=r.block,i=r.index,o=r.itemsCount,a=r.page,u=e(r,["block","index","itemsCount","page"]);if(!B.getConfig())return console.warn("React Bricks Store is not initialized"),null;B.setBlock(t);var d=B.getBrick(t);if(a||(a=B.getPage()),!d)return"development"===(null===(n=null===process||void 0===process?void 0:process.env)||void 0===n?void 0:n.NODE_ENV)&&console.warn('Missing component for block type "'.concat(t.type,'"')),console.error('Missing component for block type "'.concat(t.type,'"')),null;var c=l(l({},t.props),u);return d.schema.mapExternalDataToProps&&"function"==typeof d.schema.mapExternalDataToProps&&(null==a?void 0:a.externalData)&&"object"==typeof a.externalData&&(c=l(l({},c),d.schema.mapExternalDataToProps(a.externalData,t.props))),g.createElement(d,l({},c,{index:i,itemsCount:o,__page:a,__block:t}))},A=function(e){var r,n,t=e.propName,i=e.itemProps,o=void 0===i?{}:i,a=e.renderWrapper,u=e.renderItemWrapper,d=e.items;if(null===(r=A.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=A.prototype)||void 0===n?void 0:n.renderAdmin({propName:t,itemProps:o,renderWrapper:a,renderItemWrapper:u});if(!d||0===d.length)return null;var c=B.getPage(),s=d.length,m=p.createElement(p.Fragment,null,d.map((function(e,r){var n=p.createElement(C,l({page:c,key:"".concat(e.id,"-").concat(r),block:e,index:r,itemsCount:s},o));return u?u(n,r,d.length):n})));return a?a(m):m},S=function(r,n,t){if(y.isText(r)){var i=H(r.text);return n.filter((function(e){return"Mark"===e.type})).reduce((function(e,n){return r[n.name]?n.renderLeaf({children:e}):e}),i)}var o=n.filter((function(e){return"List"===e.type})).find((function(e){return r.type===e.name}));if(o){var a=R(r,n);return o.renderElement({children:a.map((function(e,r){return p.createElement(p.Fragment,{key:r},o.renderItemElement({children:e}))})),element:{url:r.url,data:r.data}})}var u=R(r,n,t),d=n.filter((function(e){return"Block"===e.type})).find((function(e){return r.type===e.name}));if(d){r.children,r.type;var c=e(r,["children","type"]);return d.renderElement({children:u,element:l({},c)})}return t?t({children:u,element:{type:"",children:[]},attributes:{ref:null}}):u},R=function(e,r,n){var t;return null===(t=e.children)||void 0===t?void 0:t.map((function(e,t){return p.createElement(p.Fragment,{key:t},S(e,r,n))}))},H=function(e){var r=null==e?void 0:e.replace(/\n/g,"<|BR|>\n<|BR|>").split("<|BR|>");if(r)return 1===r.length?e:p.createElement(p.Fragment,null,r.map((function(e,r,n){return"\n"===e&&n.length===r+1||"\n"===e&&n.length===r+2&&""===n[n.length-1]?p.createElement(p.Fragment,{key:r},p.createElement("br",null)," "):"\n"===e?p.createElement("br",{key:r}):p.createElement(p.Fragment,{key:r},e)})))},z=function(e){var r,n,t,i=e.renderBlock,o=void 0===i?function(e){var r=e.children;return p.createElement("p",null,r)}:i,a=e.placeholder,l=void 0===a?"Type a text...":a,u=e.renderPlaceholder,d=e.propName,c=e.value,s=e.plugins,m=void 0===s?[]:s,g=e.multiline,f=void 0===g||g,h=e.softLineBreak,v=void 0===h||h,b=e.metaFieldName,k=e.customFieldName,E=e.customFieldPlainText,P=void 0===E||E,w=e.shouldRefreshStyles;if(null===(r=z.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=z.prototype)||void 0===n?void 0:n.renderAdmin({renderBlock:o,placeholder:l,renderPlaceholder:u,propName:d,plugins:m,multiline:f,softLineBreak:v,metaFieldName:b,customFieldName:k,customFieldPlainText:P,shouldRefreshStyles:w});var N,L=B.getBlock(),I=B.getPageValues(),x=c||(d&&(null===(t=null==L?void 0:L.props)||void 0===t?void 0:t[d])?null==L?void 0:L.props[d]:b?(null==I?void 0:I.meta[b])||"":k&&(null==I?void 0:I.customValues)&&(null==I?void 0:I.customValues[k])||"");return x?(N="string"==typeof x?y.deserialize(x):x||[],p.createElement(p.Fragment,null,N.map((function(e,r){return p.createElement(p.Fragment,{key:r},S(e,m,o))})))):null},_=function(e){var r,n;return(null===(r=_.prototype)||void 0===r?void 0:r.adminConstructor)?null===(n=_.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:"Mark",name:e.name,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderLeaf:e.render,toggle:function(e){}}},D=_({name:"bold",hotKey:"mod+b",render:function(e){return p.createElement("strong",null,e.children)}}),K=_({name:"code",hotKey:"mod+`",render:function(e){return p.createElement("code",{style:{margin:"0 1px",display:"inline-block",padding:"3px 6px",fontSize:"0.875rem",lineHeight:1.25,maxWidth:"100%",fontFamily:'Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',borderRadius:"3px",backgroundColor:"#F5F7F9"}},e.children)}}),M=function(e){var r,n;return(null===(r=M.prototype)||void 0===r?void 0:r.adminConstructor)?null===(n=M.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:e.itemName?"List":"Block",name:e.name,isInline:e.isInline,itemName:e.itemName,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderElement:e.render,renderItemElement:e.renderItem,toggle:function(e,r){}}},U=M({name:"h1",hotKey:"mod+shift+1",render:function(e){return p.createElement("h1",null,e.children)}}),V=M({name:"h2",hotKey:"mod+shift+2",render:function(e){return p.createElement("h2",null,e.children)}}),W=M({name:"h3",hotKey:"mod+shift+3",render:function(e){return p.createElement("h3",null,e.children)}}),O=M({name:"h4",hotKey:"mod+shift+4",render:function(e){return p.createElement("h4",null,e.children)}}),j=M({name:"h5",hotKey:"mod+shift+5",render:function(e){return p.createElement("h5",null,e.children)}}),q=M({name:"h6",hotKey:"mod+shift+6",render:function(e){return p.createElement("h6",null,e.children)}}),J=_({name:"highlight",hotKey:"mod+h",render:function(e){return p.createElement("mark",{style:{paddingLeft:4,paddingRight:4,borderRadius:2,backgroundColor:"#ff0",color:"#0f0f05"}},e.children)}}),Q=_({name:"italic",hotKey:"mod+i",render:function(e){return p.createElement("em",null,e.children)}}),G=function(e){var r,n;return(null===(r=G.prototype)||void 0===r?void 0:r.adminConstructor)?null===(n=G.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:e.itemName?"List":"Block",name:e.name,isInline:e.isInline,itemName:e.itemName,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderElement:e.render,renderItemElement:e.renderItem,toggle:function(e,r){}}},X=G({name:"link",label:"Link",isInline:!0,render:function(e){var r,n,t=e.element,i=e.children,o={};return(null===(r=null==t?void 0:t.data)||void 0===r?void 0:r.isTargetBlank)&&(o.target="_blank",o.rel="noopener"),p.createElement(I,l({},o,{href:(null==t?void 0:t.url)||(null===(n=null==t?void 0:t.data)||void 0===n?void 0:n.url)}),i)},getDefaultProps:function(){return{url:"",isTargetBlank:!1}},pluginCustomFields:[]}),Y=M({name:"ol",label:"Number list",itemName:"li",render:function(e){return p.createElement("ol",{className:"list-decimal"},e.children)},renderItem:function(e){return p.createElement("li",null,e.children)}}),Z=M({name:"quote",render:function(e){return p.createElement("blockquote",null,e.children)}}),$=_({name:"sub",render:function(e){return p.createElement("sub",null,e.children)}}),ee=_({name:"sup",render:function(e){return p.createElement("sup",null,e.children)}}),re=M({name:"ul",label:"Bullet list",itemName:"li",render:function(e){return p.createElement("ul",{className:"list-disc"},e.children)},renderItem:function(e){return p.createElement("li",null,e.children)}}),ne=((L={})[u.RichTextFeatures.Bold]={newPlugin:D,renderLeaf:"renderBold"},L[u.RichTextFeatures.Italic]={newPlugin:Q,renderLeaf:"renderItalic"},L[u.RichTextFeatures.Highlight]={newPlugin:J,renderLeaf:"renderHighlight"},L[u.RichTextFeatures.Code]={newPlugin:K,renderLeaf:"renderCode"},L[u.RichTextFeatures.Subscript]={newPlugin:$,renderLeaf:"renderSub"},L[u.RichTextFeatures.Superscript]={newPlugin:ee,renderLeaf:"renderSup"},L[u.RichTextFeatures.Link]={newPlugin:X,renderLink:"renderLink"},L[u.RichTextFeatures.UnorderedList]={newPlugin:re,renderElement:"renderUL",renderItemElement:"renderLI"},L[u.RichTextFeatures.OrderedList]={newPlugin:Y,renderElement:"renderOL",renderItemElement:"renderLI"},L[u.RichTextFeatures.Heading1]={newPlugin:U,renderElement:"renderH1"},L[u.RichTextFeatures.Heading2]={newPlugin:V,renderElement:"renderH2"},L[u.RichTextFeatures.Heading3]={newPlugin:W,renderElement:"renderH3"},L[u.RichTextFeatures.Heading4]={newPlugin:O,renderElement:"renderH4"},L[u.RichTextFeatures.Heading5]={newPlugin:j,renderElement:"renderH5"},L[u.RichTextFeatures.Heading6]={newPlugin:q,renderElement:"renderH6"},L[u.RichTextFeatures.Quote]={newPlugin:Z,renderElement:"renderQuote"},L),te=function(e){var r,n;if(null===(r=te.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=te.prototype)||void 0===n?void 0:n.renderAdmin(e);var t=[];return e.allowedFeatures&&e.allowedFeatures.length>0&&(t=e.allowedFeatures.map((function(r){var n=ne[r],t=n.newPlugin,i=n.renderLeaf,o=n.renderElement,a=n.renderItemElement,u=n.renderLink,d={},c=e[i],s=e[o],m=e[a],p=e[u];return i&&c&&(d.renderLeaf=c),o&&s&&(d.renderElement=s),a&&m&&(d.renderItemElement=m),u&&p&&(d.renderElement=function(e){var r,n,t=e.attributes,i=e.children,o=e.element,a={};return(null===(r=null==o?void 0:o.data)||void 0===r?void 0:r.isTargetBlank)&&(a.target="_blank",a.rel="noopener"),p(l({attributes:t,children:i,element:o,href:o.url||(null===(n=o.data)||void 0===n?void 0:n.url)},a))}),l(l({},t),d)}))),g.createElement(z,{renderBlock:e.renderBlock,placeholder:e.placeholder,propName:e.propName,plugins:t,multiline:e.multiline,softLineBreak:e.softLineBreak,renderPlaceholder:e.renderPlaceholder,metaFieldName:e.metaFieldName,customFieldName:e.customFieldName,customFieldPlainText:e.customFieldPlainText,value:e.value})},ie=function(e){var r,n,t=e.renderBlock,i=void 0===t?function(e){var r=e.children;return p.createElement("p",null,r)}:t,o=e.placeholder,a=void 0===o?"Type a text...":o,l=e.renderPlaceholder,u=e.multiline,d=void 0!==u&&u,c=e.softLineBreak,s=void 0!==c&&c,m=e.propName,g=e.metaFieldName,f=e.customFieldName,h=e.value;if(null===(r=ie.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=ie.prototype)||void 0===n?void 0:n.renderAdmin({renderBlock:i,placeholder:a,renderPlaceholder:l,propName:m,multiline:d,softLineBreak:s,metaFieldName:g,customFieldName:f});var v,b=B.getPageValues(),k=h||(g?(null==b?void 0:b.meta[g])||"":f&&(null==b?void 0:b.customValues)&&(null==b?void 0:b.customValues[f])||"");return k?(v="string"==typeof k?y.deserialize(k):k||[],p.createElement(p.Fragment,null,v.map((function(e,r){return p.createElement(p.Fragment,{key:r},S(e,[],i))})))):null};function oe(e){return d(this,arguments,void 0,(function(e){var r,n,t=e.of,i=e.where,o=e.sort,a=e.page,l=e.pageSize,u=e.children;return c(this,(function(e){switch(e.label){case 0:return(r=B.getConfig())?[4,b({type:t,tag:null==i?void 0:i.tag,language:null==i?void 0:i.language,filterBy:null==i?void 0:i.filterBy,sort:o,page:a,pageSize:l,usePagination:!0,config:r})]:(console.warn("React Bricks Store is not initialized"),[2,null]);case 1:return n=e.sent(),[2,u(n)]}}))}))}function ae(e){var r,n,t=e.of,i=e.where,o=e.sort,a=e.page,l=e.pageSize,u=e.children;return(null===(r=oe.prototype)||void 0===r?void 0:r.renderAdmin)?null===(n=oe.prototype)||void 0===n?void 0:n.renderAdmin({of:t,where:i,sort:o,page:a,pageSize:l,children:u}):oe({of:t,where:i,sort:o,page:a,pageSize:l,children:u})}u.PageStatus.Draft;var le={logoHeight:80,welcomeText:"Welcome",sideImage:"https://images.unsplash.com/photo-1461418559055-6f020c5a91e7?ixlib=rb-1.2.1&auto=format&fit=crop&w=1601&q=80"};function ue(){var e,r;if(null===(e=ue.prototype)||void 0===e?void 0:e.useAdmin)return null===(r=ue.prototype)||void 0===r?void 0:r.useAdmin();var n=t(f((function(){var e=null;try{e=a()}catch(e){}return e})),2),i=n[0],o=n[1];function a(){var e=B.getConfig(),r=B.getBricks(),n=B.getThemes(),t=e.responsiveBreakpoints&&e.responsiveBreakpoints.length?e.responsiveBreakpoints:k,i=le;e.loginUI&&(i=e.loginUI,void 0===e.loginUI.sideImage&&(i.sideImage=le.sideImage),void 0===e.loginUI.welcomeText&&(i.welcomeText=le.welcomeText),void 0===e.loginUI.logoHeight&&(i.logoHeight=le.logoHeight));var o=e.rtlLanguages||["ar","az","dv","fa","ff","he","ks","ku","pa","ps","ug","ur","yi"],a=l(l({},e),{bricks:r||P,themes:n,version:E,browserSupport:{webP:!0,lazyLoading:!0},pageTypes:e.pageTypes||[],logo:e.logo||"",loginUI:i,contentClassName:e.contentClassName||"",defaultTheme:e.defaultTheme||"",loginPath:e.loginPath||"/admin",editorPath:e.editorPath||"/admin/editor",mediaLibraryPath:e.mediaLibraryPath||"/admin/media",playgroundPath:e.playgroundPath||"/admin/playground",appSettingsPath:e.appSettingsPath||"/admin/app-settings",previewPath:e.previewPath||"/preview",isDarkColorMode:e.isDarkColorMode||!1,useCssInJs:e.useCssInJs||!1,clickToEditSide:e.clickToEditSide||u.ClickToEditSide.BottomRight,responsiveBreakpoints:t,enableAutoSave:e.enableAutoSave||!0,disableSaveIfInvalidProps:e.disableSaveIfInvalidProps||!1,enablePreview:e.enablePreview||!0,blockIconsPosition:e.blockIconsPosition||u.BlockIconsPosition.OutsideBlock,enableUnsplash:e.enableUnsplash||!0,enablePreviewImage:e.enablePreviewImage||!0,enablePreviewIcon:e.enablePreviewIcon||!1,enableDefaultEmbedBrick:e.enableDefaultEmbedBrick||!0,allowAccentsInSlugs:e.allowAccentsInSlugs||!1,warningIfLowBattery:e.warningIfLowBattery||!1,isRtlLanguage:function(e){var r=e.language;return o.indexOf(r)>-1},rtlLanguages:o});return a}return h((function(){return B.__subscribeConfig((function(){o(a())}))}),[]),i}var de=function(){var e,r;return(null===(e=de.prototype)||void 0===e?void 0:e.useAdmin)?null===(r=de.prototype)||void 0===r?void 0:r.useAdmin():{isAdmin:!1,previewMode:!1,currentPage:{pageId:""},showRichTextModal:function(){}}},ce=function(){var e,r;if(null===(e=ce.prototype)||void 0===e?void 0:e.useAdmin)return null===(r=ce.prototype)||void 0===r?void 0:r.useAdmin();var n=t(f((function(){var e=null;try{e=B.getPageValues()}catch(e){}return e})),2),i=n[0],o=n[1];h((function(){return B.__subscribePage((function(){o(B.getPageValues())}))}),[]);return[i,function(){}]},se=function(e){var r,n;if(null===(r=se.prototype)||void 0===r?void 0:r.useAdmin){var i=t(null===(n=se.prototype)||void 0===n?void 0:n.useAdmin(e),3);return i[0],[i[1],i[2]]}return[function(e){},!0]};export{te as C,x as F,T as I,I as L,A as R,ie as T,ae as a,z as b,de as c,ce as d,se as e,B as r,ue as u};
2
+ //# sourceMappingURL=react-bricks-CBgU2I0X.esm.js.map
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("./react-bricks-CXY4gR9A.js"),t=require("react"),r=require("classnames");function a(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var p=a(t),c=[{type:e.types.DeviceType.Phone,width:375,label:"Phone (375px)"},{type:e.types.DeviceType.Tablet,width:768,label:"Tablet (768px)"},{type:e.types.DeviceType.Desktop,width:"100%",label:"Desktop (100%)"}],n=function(){return p.createElement("div",{className:r("max-w-xl mx-auto py-6")})};n.schema={name:"paragraph",label:"Paragraph",getDefaultProps:function(){return{text:"Lorem ipsum dolor sit amet"}}};var s={paragraph:n};exports.DEFAULT_BREAKPOINTS=c,exports.DEFAULT_BRICKS=s,exports.version="4.7.7";
2
- //# sourceMappingURL=react-bricks-DQECSKJL.js.map
1
+ "use strict";var e=require("./react-bricks-CXY4gR9A.js"),t=require("react"),r=require("classnames");function a(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var p=a(t),c=[{type:e.types.DeviceType.Phone,width:375,label:"Phone (375px)"},{type:e.types.DeviceType.Tablet,width:768,label:"Tablet (768px)"},{type:e.types.DeviceType.Desktop,width:"100%",label:"Desktop (100%)"}],n=function(){return p.createElement("div",{className:r("max-w-xl mx-auto py-6")})};n.schema={name:"paragraph",label:"Paragraph",getDefaultProps:function(){return{text:"Lorem ipsum dolor sit amet"}}};var s={paragraph:n};exports.DEFAULT_BREAKPOINTS=c,exports.DEFAULT_BRICKS=s,exports.version="4.7.7";
2
+ //# sourceMappingURL=react-bricks-D5I1csz5.js.map
@@ -1,2 +1,2 @@
1
- "use strict";var e=require("./react-bricks-CXY4gR9A.js"),r=require("./react-bricks-DRIKzHUS.js"),n=require("react"),t=require("classnames"),i=require("./react-bricks-CI8avgJu.js"),o=require("./react-bricks-G-FCJ1Kd.js"),a=require("./react-bricks-DQECSKJL.js");function l(e){var r=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}})),r.default=e,Object.freeze(r)}var s=l(n),u={isAdmin:!1,bricks:{},themes:[]},d=function(){function r(){return this.configListeners=new Set,this.pageListeners=new Set,r.instance?console.warn("Constructor - instance already created"):(r.instance=this,u.pid=Math.floor(1e3*Math.random())),r.instance}return r.prototype.register=function(e,n){if(void 0===n&&(n=!1),!(!n&&u.config&&Object.keys(u.bricks).length>0)){u.config=e;var t=r.instance.mapConfig(e),i=t.bricks,o=t.themes;u.bricks=i,u.themes=o,this.notifyConfigListeners()}},r.prototype.setPage=function(e){u.currentPage=e,this.notifyPageListeners()},r.prototype.setBlock=function(e){u.currentBlock=e},r.prototype.setIsAdmin=function(e){u.isAdmin=e},r.prototype.setPathname=function(e){u.currentPathname=e},r.prototype.getConfig=function(){if(!u.config)throw new Error("React Bricks Config not registered [1]");return u.config},r.prototype.getBrick=function(e){if(!u.config)throw new Error("React Bricks Config not registered [2]");return u.bricks[e.type]?u.bricks[e.type]:null},r.prototype.getBricks=function(){if(!u.config)throw new Error("React Bricks Config not registered [3]");return u.bricks},r.prototype.getThemes=function(){if(!u.config)throw new Error("React Bricks Config not registered [4]");return u.themes},r.prototype.getPage=function(){return u.currentPage},r.prototype.getPageValues=function(){if(!u.currentPage)return null;var r=u.currentPage;return r.content,e.__rest(r,["content"])},r.prototype.getBlock=function(){return u.currentBlock||null},r.prototype.getBlockValue=function(e){return u.currentBlock&&u.currentBlock.props[e]?u.currentBlock.props[e]:null},r.prototype.getPageType=function(e){var r,n;return e&&(null===(r=u.config)||void 0===r?void 0:r.pageTypes)&&(null===(n=u.config)||void 0===n?void 0:n.pageTypes.find((function(r){return r.name===e.type})))},r.prototype.getPathname=function(){return u.currentPathname},r.prototype.isAdmin=function(){return u.isAdmin},r.prototype.isRegistered=function(){return!!u.config},r.prototype.mapConfig=function(r){var n,t=r.bricks;if(t&&0!==t.length||(console.warn("No bricks provided. Using default paragraph."),t=[]),r.pageTypes||console.warn("No Page type schema provided. Using default page."),!Array.isArray(t))throw console.error('"bricks" should be an array of Bricks or an array of Themes'),new Error('"bricks" should be an array of Bricks or an array of Themes');if(!Array.isArray(r.pageTypes))throw console.error('"pageTypes" should be an array'),new Error('"pageTypes" should be an array');e.areThemes(t)?(n=e.__spreadArray([],e.__read(t),!1),t=e.getBricksFromThemes(n)):(n=e.getThemesFromBricks(t),t=e.__spreadArray([],e.__read(t),!1));var i=function(){return null};i.schema={name:"default-embed-brick",label:"Embed Page",category:"Embed",sideEditProps:[{name:"RB_PAGE_EMBED",label:"Embed page / entity",type:"RELATIONSHIP",relationshipOptions:{references:"",multiple:!1,embedValues:!1},helperText:"Choose a page, save to view it."}]},r.enableDefaultEmbedBrick&&(null==t||t.push(i),n=e.pushToThemes(n,i));var o=null==t?void 0:t.reduce((function(r,n){var t;return e.__assign(e.__assign({},r),((t={})[n.schema.name]=n,t))}),{});return{bricks:o,themes:n}},r.prototype.__subscribeConfig=function(e){var r=this;return this.configListeners.add(e),function(){r.configListeners.delete(e)}},r.prototype.__subscribePage=function(e){var r=this;return this.pageListeners.add(e),function(){r.pageListeners.delete(e)}},r.prototype.notifyConfigListeners=function(){this.configListeners.forEach((function(e){return e()}))},r.prototype.notifyPageListeners=function(){this.pageListeners.forEach((function(e){return e()}))},r}(),c=new d;Object.freeze(c);var m,p=function(r){var n,t,i,o=r.href,a=r.children,l=r.target,u=r.className,d=r.activeClassName,m=r.simpleAnchor,g=void 0!==m&&m,f=r.tabIndex,h=e.__rest(r,["href","children","target","className","activeClassName","simpleAnchor","tabIndex"]);if(null===(n=p.prototype)||void 0===n?void 0:n.renderAdmin)return null===(t=p.prototype)||void 0===t?void 0:t.renderAdmin(e.__assign({href:o,children:a,target:l,className:u,activeClassName:d,simpleAnchor:g,tabIndex:f},h));c.isRegistered()&&(i=c.getConfig());var v={href:o},y=f?{tabIndex:f}:{};return/^\/(?!\/)/.test(o)?!(null==i?void 0:i.renderLocalLink)||g?s.createElement("a",e.__assign({},v,{target:l,className:u},y,h),a):i.renderLocalLink(e.__assign({href:o,target:l,children:a,className:u,activeClassName:d,tabIndex:f},h)):s.createElement("a",e.__assign({},v,{target:l,className:u},h),a)},g=function(n){var t,i=n.allowedExtensions,o=void 0===i?[]:i,a=n.propName,l=n.renderBlock,s=n.source;if(null===(t=g.prototype)||void 0===t?void 0:t.renderAdmin)return g.prototype.renderAdmin({propName:a,renderBlock:l,allowedExtensions:o});var u=s||null;return u?l(e.__assign(e.__assign({},u),{url:r.getSeoImageUrl(u.url,u.name)})):null},f=function(n){n.propName;var i=n.source,o=n.alt,a=n.maxWidth,l=n.aspectRatio,u=n.wrapper;n.noLazyLoad,n.containerClassName,n.containerStyle;var d=n.imageClassName,c=n.imageStyle,m=void 0===c?{}:c;n.noWrapper;var p=n.sizes,g=void 0===p?"100vw":p,f=n.loading,h=void 0===f?"lazy":f;n.renderWrapper,n.useNativeLazyLoading,n.useWebP;var v=n.placeholder;if(!i){if(v){var y=v({aspectRatio:l,maxWidth:a,isDarkColorMode:!1,isAdmin:!1});return y?u({children:s.createElement("img",{src:y,alt:o,className:d,style:m})}):null}return null}var b=(null==i?void 0:i.alt)||o,k=r.getSeoImageUrl(i.src,i.seoName);i.fallbackSrc&&r.getSeoImageUrl(i.fallbackSrc,i.seoName),r.getSeoImageUrl(i.placeholderSrc||"",i.seoName);var E=r.getSeoSourceSet(i.srcSet,i.seoName);i.fallbackSrc&&r.getSeoSourceSet(i.fallbackSrc,i.seoName);var P=i.highPriority?"eager":h,_={src:k,srcSet:E,sizes:g,alt:b,width:i.width+"",height:i.height+"",loading:P,decoding:"async",className:t("rb-lazy",d),style:m};return Boolean(s.use)?_.fetchPriority=i.highPriority?"high":"auto":_.fetchpriority=i.highPriority?"high":"auto",u({width:i.width,height:i.height,children:s.createElement(s.Fragment,null,s.createElement("img",e.__assign({},_)))})},h=function(r){var n,t;if(null===(n=h.prototype)||void 0===n?void 0:n.renderAdmin)return null===(t=h.prototype)||void 0===t?void 0:t.renderAdmin(r);var i=c.getPageValues(),o=function(e,r){return e.readonly?e.source:e.metaFieldName?null==r?void 0:r.meta[e.metaFieldName]:e.customFieldName&&(null==r?void 0:r.customValues)?null==r?void 0:r.customValues[e.customFieldName]:e.source}(r,i),a=function(e){var r=e.children;return s.createElement(s.Fragment,null,r)};return!r.containerClassName&&!r.containerStyle||r.noWrapper||(a=function(e){var n=e.children;return s.createElement("div",{className:r.containerClassName,style:r.containerStyle},n)}),r.renderWrapper&&(a=r.renderWrapper),s.createElement(f,e.__assign({},r,{source:o,wrapper:a,placeholder:r.placeholder}))},v=function(r){var t,i=r.block,o=r.index,a=r.itemsCount,l=r.page,s=e.__rest(r,["block","index","itemsCount","page"]);if(!c.getConfig())return console.warn("React Bricks Store is not initialized"),null;c.setBlock(i);var u=c.getBrick(i);if(l||(l=c.getPage()),!u)return"development"===(null===(t=null===process||void 0===process?void 0:process.env)||void 0===t?void 0:t.NODE_ENV)&&console.warn('Missing component for block type "'.concat(i.type,'"')),console.error('Missing component for block type "'.concat(i.type,'"')),null;var d=e.__assign(e.__assign({},i.props),s);return u.schema.mapExternalDataToProps&&"function"==typeof u.schema.mapExternalDataToProps&&(null==l?void 0:l.externalData)&&"object"==typeof l.externalData&&(d=e.__assign(e.__assign({},d),u.schema.mapExternalDataToProps(l.externalData,i.props))),n.createElement(u,e.__assign({},d,{index:o,itemsCount:a,__page:l,__block:i}))},y=function(r){var n,t,i=r.propName,o=r.itemProps,a=void 0===o?{}:o,l=r.renderWrapper,u=r.renderItemWrapper,d=r.items;if(null===(n=y.prototype)||void 0===n?void 0:n.renderAdmin)return null===(t=y.prototype)||void 0===t?void 0:t.renderAdmin({propName:i,itemProps:a,renderWrapper:l,renderItemWrapper:u});if(!d||0===d.length)return null;var m=c.getPage(),p=d.length,g=s.createElement(s.Fragment,null,d.map((function(r,n){var t=s.createElement(v,e.__assign({page:m,key:"".concat(r.id,"-").concat(n),block:r,index:n,itemsCount:p},a));return u?u(t,n,d.length):t})));return l?l(g):g},b=function(r,n,t){if(i.Plain.isText(r)){var o=E(r.text);return n.filter((function(e){return"Mark"===e.type})).reduce((function(e,n){return r[n.name]?n.renderLeaf({children:e}):e}),o)}var a=n.filter((function(e){return"List"===e.type})).find((function(e){return r.type===e.name}));if(a){var l=k(r,n);return a.renderElement({children:l.map((function(e,r){return s.createElement(s.Fragment,{key:r},a.renderItemElement({children:e}))})),element:{url:r.url,data:r.data}})}var u=k(r,n,t),d=n.filter((function(e){return"Block"===e.type})).find((function(e){return r.type===e.name}));if(d){r.children,r.type;var c=e.__rest(r,["children","type"]);return d.renderElement({children:u,element:e.__assign({},c)})}return t?t({children:u,element:{type:"",children:[]},attributes:{ref:null}}):u},k=function(e,r,n){var t;return null===(t=e.children)||void 0===t?void 0:t.map((function(e,t){return s.createElement(s.Fragment,{key:t},b(e,r,n))}))},E=function(e){var r=null==e?void 0:e.replace(/\n/g,"<|BR|>\n<|BR|>").split("<|BR|>");if(r)return 1===r.length?e:s.createElement(s.Fragment,null,r.map((function(e,r,n){return"\n"===e&&n.length===r+1||"\n"===e&&n.length===r+2&&""===n[n.length-1]?s.createElement(s.Fragment,{key:r},s.createElement("br",null)," "):"\n"===e?s.createElement("br",{key:r}):s.createElement(s.Fragment,{key:r},e)})))},P=function(e){var r,n,t,o=e.renderBlock,a=void 0===o?function(e){var r=e.children;return s.createElement("p",null,r)}:o,l=e.placeholder,u=void 0===l?"Type a text...":l,d=e.renderPlaceholder,m=e.propName,p=e.value,g=e.plugins,f=void 0===g?[]:g,h=e.multiline,v=void 0===h||h,y=e.softLineBreak,k=void 0===y||y,E=e.metaFieldName,_=e.customFieldName,w=e.customFieldPlainText,x=void 0===w||w,B=e.shouldRefreshStyles;if(null===(r=P.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=P.prototype)||void 0===n?void 0:n.renderAdmin({renderBlock:a,placeholder:u,renderPlaceholder:d,propName:m,plugins:f,multiline:v,softLineBreak:k,metaFieldName:E,customFieldName:_,customFieldPlainText:x,shouldRefreshStyles:B});var N,I=c.getBlock(),L=c.getPageValues(),T=p||(m&&(null===(t=null==I?void 0:I.props)||void 0===t?void 0:t[m])?null==I?void 0:I.props[m]:E?(null==L?void 0:L.meta[E])||"":_&&(null==L?void 0:L.customValues)&&(null==L?void 0:L.customValues[_])||"");return T?(N="string"==typeof T?i.Plain.deserialize(T):T||[],s.createElement(s.Fragment,null,N.map((function(e,r){return s.createElement(s.Fragment,{key:r},b(e,f,a))})))):null},_=function(e){var r,n;return(null===(r=_.prototype)||void 0===r?void 0:r.adminConstructor)?null===(n=_.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:"Mark",name:e.name,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderLeaf:e.render,toggle:function(e){}}},w=_({name:"bold",hotKey:"mod+b",render:function(e){return s.createElement("strong",null,e.children)}}),x=_({name:"code",hotKey:"mod+`",render:function(e){return s.createElement("code",{style:{margin:"0 1px",display:"inline-block",padding:"3px 6px",fontSize:"0.875rem",lineHeight:1.25,maxWidth:"100%",fontFamily:'Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',borderRadius:"3px",backgroundColor:"#F5F7F9"}},e.children)}}),B=function(e){var r,n;return(null===(r=B.prototype)||void 0===r?void 0:r.adminConstructor)?null===(n=B.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:e.itemName?"List":"Block",name:e.name,isInline:e.isInline,itemName:e.itemName,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderElement:e.render,renderItemElement:e.renderItem,toggle:function(e,r){}}},N=B({name:"h1",hotKey:"mod+shift+1",render:function(e){return s.createElement("h1",null,e.children)}}),I=B({name:"h2",hotKey:"mod+shift+2",render:function(e){return s.createElement("h2",null,e.children)}}),L=B({name:"h3",hotKey:"mod+shift+3",render:function(e){return s.createElement("h3",null,e.children)}}),T=B({name:"h4",hotKey:"mod+shift+4",render:function(e){return s.createElement("h4",null,e.children)}}),F=B({name:"h5",hotKey:"mod+shift+5",render:function(e){return s.createElement("h5",null,e.children)}}),C=B({name:"h6",hotKey:"mod+shift+6",render:function(e){return s.createElement("h6",null,e.children)}}),S=_({name:"highlight",hotKey:"mod+h",render:function(e){return s.createElement("mark",{style:{paddingLeft:4,paddingRight:4,borderRadius:2,backgroundColor:"#ff0",color:"#0f0f05"}},e.children)}}),A=_({name:"italic",hotKey:"mod+i",render:function(e){return s.createElement("em",null,e.children)}}),R=function(e){var r,n;return(null===(r=R.prototype)||void 0===r?void 0:r.adminConstructor)?null===(n=R.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:e.itemName?"List":"Block",name:e.name,isInline:e.isInline,itemName:e.itemName,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderElement:e.render,renderItemElement:e.renderItem,toggle:function(e,r){}}},U=R({name:"link",label:"Link",isInline:!0,render:function(r){var n,t,i=r.element,o=r.children,a={};return(null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.isTargetBlank)&&(a.target="_blank",a.rel="noopener"),s.createElement(p,e.__assign({},a,{href:(null==i?void 0:i.url)||(null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.url)}),o)},getDefaultProps:function(){return{url:"",isTargetBlank:!1}},pluginCustomFields:[]}),z=B({name:"ol",label:"Number list",itemName:"li",render:function(e){return s.createElement("ol",{className:"list-decimal"},e.children)},renderItem:function(e){return s.createElement("li",null,e.children)}}),H=B({name:"quote",render:function(e){return s.createElement("blockquote",null,e.children)}}),D=_({name:"sub",render:function(e){return s.createElement("sub",null,e.children)}}),K=_({name:"sup",render:function(e){return s.createElement("sup",null,e.children)}}),V=B({name:"ul",label:"Bullet list",itemName:"li",render:function(e){return s.createElement("ul",{className:"list-disc"},e.children)},renderItem:function(e){return s.createElement("li",null,e.children)}}),O=((m={})[e.types.RichTextFeatures.Bold]={newPlugin:w,renderLeaf:"renderBold"},m[e.types.RichTextFeatures.Italic]={newPlugin:A,renderLeaf:"renderItalic"},m[e.types.RichTextFeatures.Highlight]={newPlugin:S,renderLeaf:"renderHighlight"},m[e.types.RichTextFeatures.Code]={newPlugin:x,renderLeaf:"renderCode"},m[e.types.RichTextFeatures.Subscript]={newPlugin:D,renderLeaf:"renderSub"},m[e.types.RichTextFeatures.Superscript]={newPlugin:K,renderLeaf:"renderSup"},m[e.types.RichTextFeatures.Link]={newPlugin:U,renderLink:"renderLink"},m[e.types.RichTextFeatures.UnorderedList]={newPlugin:V,renderElement:"renderUL",renderItemElement:"renderLI"},m[e.types.RichTextFeatures.OrderedList]={newPlugin:z,renderElement:"renderOL",renderItemElement:"renderLI"},m[e.types.RichTextFeatures.Heading1]={newPlugin:N,renderElement:"renderH1"},m[e.types.RichTextFeatures.Heading2]={newPlugin:I,renderElement:"renderH2"},m[e.types.RichTextFeatures.Heading3]={newPlugin:L,renderElement:"renderH3"},m[e.types.RichTextFeatures.Heading4]={newPlugin:T,renderElement:"renderH4"},m[e.types.RichTextFeatures.Heading5]={newPlugin:F,renderElement:"renderH5"},m[e.types.RichTextFeatures.Heading6]={newPlugin:C,renderElement:"renderH6"},m[e.types.RichTextFeatures.Quote]={newPlugin:H,renderElement:"renderQuote"},m),M=function(r){var t,i;if(null===(t=M.prototype)||void 0===t?void 0:t.renderAdmin)return null===(i=M.prototype)||void 0===i?void 0:i.renderAdmin(r);var o=[];return r.allowedFeatures&&r.allowedFeatures.length>0&&(o=r.allowedFeatures.map((function(n){var t=O[n],i=t.newPlugin,o=t.renderLeaf,a=t.renderElement,l=t.renderItemElement,s=t.renderLink,u={},d=r[o],c=r[a],m=r[l],p=r[s];return o&&d&&(u.renderLeaf=d),a&&c&&(u.renderElement=c),l&&m&&(u.renderItemElement=m),s&&p&&(u.renderElement=function(r){var n,t,i=r.attributes,o=r.children,a=r.element,l={};return(null===(n=null==a?void 0:a.data)||void 0===n?void 0:n.isTargetBlank)&&(l.target="_blank",l.rel="noopener"),p(e.__assign({attributes:i,children:o,element:a,href:a.url||(null===(t=a.data)||void 0===t?void 0:t.url)},l))}),e.__assign(e.__assign({},i),u)}))),n.createElement(P,{renderBlock:r.renderBlock,placeholder:r.placeholder,propName:r.propName,plugins:o,multiline:r.multiline,softLineBreak:r.softLineBreak,renderPlaceholder:r.renderPlaceholder,metaFieldName:r.metaFieldName,customFieldName:r.customFieldName,customFieldPlainText:r.customFieldPlainText,value:r.value})},W=function(e){var r,n,t=e.renderBlock,o=void 0===t?function(e){var r=e.children;return s.createElement("p",null,r)}:t,a=e.placeholder,l=void 0===a?"Type a text...":a,u=e.renderPlaceholder,d=e.multiline,m=void 0!==d&&d,p=e.softLineBreak,g=void 0!==p&&p,f=e.propName,h=e.metaFieldName,v=e.customFieldName,y=e.value;if(null===(r=W.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=W.prototype)||void 0===n?void 0:n.renderAdmin({renderBlock:o,placeholder:l,renderPlaceholder:u,propName:f,multiline:m,softLineBreak:g,metaFieldName:h,customFieldName:v});var k,E=c.getPageValues(),P=y||(h?(null==E?void 0:E.meta[h])||"":v&&(null==E?void 0:E.customValues)&&(null==E?void 0:E.customValues[v])||"");return P?(k="string"==typeof P?i.Plain.deserialize(P):P||[],s.createElement(s.Fragment,null,k.map((function(e,r){return s.createElement(s.Fragment,{key:r},b(e,[],o))})))):null};function j(r){return e.__awaiter(this,arguments,void 0,(function(r){var n,t,i=r.of,a=r.where,l=r.sort,s=r.page,u=r.pageSize,d=r.children;return e.__generator(this,(function(e){switch(e.label){case 0:return(n=c.getConfig())?[4,o.fetchPages({type:i,tag:null==a?void 0:a.tag,language:null==a?void 0:a.language,filterBy:null==a?void 0:a.filterBy,sort:l,page:s,pageSize:u,usePagination:!0,config:n})]:(console.warn("React Bricks Store is not initialized"),[2,null]);case 1:return t=e.sent(),[2,d(t)]}}))}))}e.types.PageStatus.Draft;var q={logoHeight:80,welcomeText:"Welcome",sideImage:"https://images.unsplash.com/photo-1461418559055-6f020c5a91e7?ixlib=rb-1.2.1&auto=format&fit=crop&w=1601&q=80"};var J=function(){var e,r;return(null===(e=J.prototype)||void 0===e?void 0:e.useAdmin)?null===(r=J.prototype)||void 0===r?void 0:r.useAdmin():{isAdmin:!1,previewMode:!1,currentPage:{pageId:""},showRichTextModal:function(){}}},Q=function(){var r,t;if(null===(r=Q.prototype)||void 0===r?void 0:r.useAdmin)return null===(t=Q.prototype)||void 0===t?void 0:t.useAdmin();var i=e.__read(n.useState((function(){var e=null;try{e=c.getPageValues()}catch(e){}return e})),2),o=i[0],a=i[1];n.useEffect((function(){return c.__subscribePage((function(){a(c.getPageValues())}))}),[]);return[o,function(){}]},G=function(r){var n,t;if(null===(n=G.prototype)||void 0===n?void 0:n.useAdmin){var i=e.__read(null===(t=G.prototype)||void 0===t?void 0:t.useAdmin(r),3);return i[0],[i[1],i[2]]}return[function(e){},!0]};exports.CompatibleRichText=M,exports.File=g,exports.Image=h,exports.Link=p,exports.ListAstro=function(e){var r,n,t=e.of,i=e.where,o=e.sort,a=e.page,l=e.pageSize,s=e.children;return(null===(r=j.prototype)||void 0===r?void 0:r.renderAdmin)?null===(n=j.prototype)||void 0===n?void 0:n.renderAdmin({of:t,where:i,sort:o,page:a,pageSize:l,children:s}):j({of:t,where:i,sort:o,page:a,pageSize:l,children:s})},exports.Repeater=y,exports.RichText=P,exports.Text=W,exports.reactBricksAstroStore=c,exports.useAdminContext=J,exports.usePageValues=Q,exports.useReactBricksContext=function r(){var t,i;if(null===(t=r.prototype)||void 0===t?void 0:t.useAdmin)return null===(i=r.prototype)||void 0===i?void 0:i.useAdmin();var o=e.__read(n.useState((function(){var e=null;try{e=u()}catch(e){}return e})),2),l=o[0],s=o[1];function u(){var r=c.getConfig(),n=c.getBricks(),t=c.getThemes(),i=r.responsiveBreakpoints&&r.responsiveBreakpoints.length?r.responsiveBreakpoints:a.DEFAULT_BREAKPOINTS,o=q;r.loginUI&&(o=r.loginUI,void 0===r.loginUI.sideImage&&(o.sideImage=q.sideImage),void 0===r.loginUI.welcomeText&&(o.welcomeText=q.welcomeText),void 0===r.loginUI.logoHeight&&(o.logoHeight=q.logoHeight));var l=r.rtlLanguages||["ar","az","dv","fa","ff","he","ks","ku","pa","ps","ug","ur","yi"],s=e.__assign(e.__assign({},r),{bricks:n||a.DEFAULT_BRICKS,themes:t,version:a.version,browserSupport:{webP:!0,lazyLoading:!0},pageTypes:r.pageTypes||[],logo:r.logo||"",loginUI:o,contentClassName:r.contentClassName||"",defaultTheme:r.defaultTheme||"",loginPath:r.loginPath||"/admin",editorPath:r.editorPath||"/admin/editor",mediaLibraryPath:r.mediaLibraryPath||"/admin/media",playgroundPath:r.playgroundPath||"/admin/playground",appSettingsPath:r.appSettingsPath||"/admin/app-settings",previewPath:r.previewPath||"/preview",isDarkColorMode:r.isDarkColorMode||!1,useCssInJs:r.useCssInJs||!1,clickToEditSide:r.clickToEditSide||e.types.ClickToEditSide.BottomRight,responsiveBreakpoints:i,enableAutoSave:r.enableAutoSave||!0,disableSaveIfInvalidProps:r.disableSaveIfInvalidProps||!1,enablePreview:r.enablePreview||!0,blockIconsPosition:r.blockIconsPosition||e.types.BlockIconsPosition.OutsideBlock,enableUnsplash:r.enableUnsplash||!0,enablePreviewImage:r.enablePreviewImage||!0,enablePreviewIcon:r.enablePreviewIcon||!1,enableDefaultEmbedBrick:r.enableDefaultEmbedBrick||!0,allowAccentsInSlugs:r.allowAccentsInSlugs||!1,warningIfLowBattery:r.warningIfLowBattery||!1,isRtlLanguage:function(e){var r=e.language;return l.indexOf(r)>-1},rtlLanguages:l});return s}return n.useEffect((function(){return c.__subscribeConfig((function(){s(u())}))}),[]),l},exports.useVisualEdit=G;
2
- //# sourceMappingURL=react-bricks-D6OhckuV.js.map
1
+ "use strict";var e=require("./react-bricks-CXY4gR9A.js"),r=require("./react-bricks-DRIKzHUS.js"),n=require("react"),t=require("classnames"),i=require("./react-bricks-CI8avgJu.js"),o=require("./react-bricks-G-FCJ1Kd.js"),a=require("./react-bricks-D5I1csz5.js");function l(e){var r=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var t=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,t.get?t:{enumerable:!0,get:function(){return e[n]}})}})),r.default=e,Object.freeze(r)}var s=l(n),u={isAdmin:!1,bricks:{},themes:[]},d=function(){function r(){return this.configListeners=new Set,this.pageListeners=new Set,r.instance?console.warn("Constructor - instance already created"):(r.instance=this,u.pid=Math.floor(1e3*Math.random())),r.instance}return r.prototype.register=function(e,n){if(void 0===n&&(n=!1),!(!n&&u.config&&Object.keys(u.bricks).length>0)){u.config=e;var t=r.instance.mapConfig(e),i=t.bricks,o=t.themes;u.bricks=i,u.themes=o,this.notifyConfigListeners()}},r.prototype.setPage=function(e){u.currentPage=e,this.notifyPageListeners()},r.prototype.setBlock=function(e){u.currentBlock=e},r.prototype.setIsAdmin=function(e){u.isAdmin=e},r.prototype.setPathname=function(e){u.currentPathname=e},r.prototype.getConfig=function(){if(!u.config)throw new Error("React Bricks Config not registered [1]");return u.config},r.prototype.getBrick=function(e){if(!u.config)throw new Error("React Bricks Config not registered [2]");return u.bricks[e.type]?u.bricks[e.type]:null},r.prototype.getBricks=function(){if(!u.config)throw new Error("React Bricks Config not registered [3]");return u.bricks},r.prototype.getThemes=function(){if(!u.config)throw new Error("React Bricks Config not registered [4]");return u.themes},r.prototype.getPage=function(){return u.currentPage},r.prototype.getPageValues=function(){if(!u.currentPage)return null;var r=u.currentPage;return r.content,e.__rest(r,["content"])},r.prototype.getBlock=function(){return u.currentBlock||null},r.prototype.getBlockValue=function(e){return u.currentBlock&&u.currentBlock.props[e]?u.currentBlock.props[e]:null},r.prototype.getPageType=function(e){var r,n;return e&&(null===(r=u.config)||void 0===r?void 0:r.pageTypes)&&(null===(n=u.config)||void 0===n?void 0:n.pageTypes.find((function(r){return r.name===e.type})))},r.prototype.getPathname=function(){return u.currentPathname},r.prototype.isAdmin=function(){return u.isAdmin},r.prototype.isRegistered=function(){return!!u.config},r.prototype.mapConfig=function(r){var n,t=r.bricks;if(t&&0!==t.length||(console.warn("No bricks provided. Using default paragraph."),t=[]),r.pageTypes||console.warn("No Page type schema provided. Using default page."),!Array.isArray(t))throw console.error('"bricks" should be an array of Bricks or an array of Themes'),new Error('"bricks" should be an array of Bricks or an array of Themes');if(!Array.isArray(r.pageTypes))throw console.error('"pageTypes" should be an array'),new Error('"pageTypes" should be an array');e.areThemes(t)?(n=e.__spreadArray([],e.__read(t),!1),t=e.getBricksFromThemes(n)):(n=e.getThemesFromBricks(t),t=e.__spreadArray([],e.__read(t),!1));var i=function(){return null};i.schema={name:"default-embed-brick",label:"Embed Page",category:"Embed",sideEditProps:[{name:"RB_PAGE_EMBED",label:"Embed page / entity",type:"RELATIONSHIP",relationshipOptions:{references:"",multiple:!1,embedValues:!1},helperText:"Choose a page, save to view it."}]},r.enableDefaultEmbedBrick&&(null==t||t.push(i),n=e.pushToThemes(n,i));var o=null==t?void 0:t.reduce((function(r,n){var t;return e.__assign(e.__assign({},r),((t={})[n.schema.name]=n,t))}),{});return{bricks:o,themes:n}},r.prototype.__subscribeConfig=function(e){var r=this;return this.configListeners.add(e),function(){r.configListeners.delete(e)}},r.prototype.__subscribePage=function(e){var r=this;return this.pageListeners.add(e),function(){r.pageListeners.delete(e)}},r.prototype.notifyConfigListeners=function(){this.configListeners.forEach((function(e){return e()}))},r.prototype.notifyPageListeners=function(){this.pageListeners.forEach((function(e){return e()}))},r}(),c=new d;Object.freeze(c);var m,p=function(r){var n,t,i,o=r.href,a=r.children,l=r.target,u=r.className,d=r.activeClassName,m=r.simpleAnchor,g=void 0!==m&&m,f=r.tabIndex,h=e.__rest(r,["href","children","target","className","activeClassName","simpleAnchor","tabIndex"]);if(null===(n=p.prototype)||void 0===n?void 0:n.renderAdmin)return null===(t=p.prototype)||void 0===t?void 0:t.renderAdmin(e.__assign({href:o,children:a,target:l,className:u,activeClassName:d,simpleAnchor:g,tabIndex:f},h));c.isRegistered()&&(i=c.getConfig());var v={href:o},y=f?{tabIndex:f}:{};return/^\/(?!\/)/.test(o)?!(null==i?void 0:i.renderLocalLink)||g?s.createElement("a",e.__assign({},v,{target:l,className:u},y,h),a):i.renderLocalLink(e.__assign({href:o,target:l,children:a,className:u,activeClassName:d,tabIndex:f},h)):s.createElement("a",e.__assign({},v,{target:l,className:u},h),a)},g=function(n){var t,i=n.allowedExtensions,o=void 0===i?[]:i,a=n.propName,l=n.renderBlock,s=n.source;if(null===(t=g.prototype)||void 0===t?void 0:t.renderAdmin)return g.prototype.renderAdmin({propName:a,renderBlock:l,allowedExtensions:o});var u=s||null;return u?l(e.__assign(e.__assign({},u),{url:r.getSeoImageUrl(u.url,u.name)})):null},f=function(n){n.propName;var i=n.source,o=n.alt,a=n.maxWidth,l=n.aspectRatio,u=n.wrapper;n.noLazyLoad,n.containerClassName,n.containerStyle;var d=n.imageClassName,c=n.imageStyle,m=void 0===c?{}:c;n.noWrapper;var p=n.sizes,g=void 0===p?"100vw":p,f=n.loading,h=void 0===f?"lazy":f;n.renderWrapper,n.useNativeLazyLoading,n.useWebP;var v=n.placeholder;if(!i){if(v){var y=v({aspectRatio:l,maxWidth:a,isDarkColorMode:!1,isAdmin:!1});return y?u({children:s.createElement("img",{src:y,alt:o,className:d,style:m})}):null}return null}var b=(null==i?void 0:i.alt)||o,k=r.getSeoImageUrl(i.src,i.seoName);i.fallbackSrc&&r.getSeoImageUrl(i.fallbackSrc,i.seoName),r.getSeoImageUrl(i.placeholderSrc||"",i.seoName);var E=r.getSeoSourceSet(i.srcSet,i.seoName);i.fallbackSrc&&r.getSeoSourceSet(i.fallbackSrc,i.seoName);var P=i.highPriority?"eager":h,_={src:k,srcSet:E,sizes:g,alt:b,width:i.width+"",height:i.height+"",loading:P,decoding:"async",className:t("rb-lazy",d),style:m};return Boolean(s.use)?_.fetchPriority=i.highPriority?"high":"auto":_.fetchpriority=i.highPriority?"high":"auto",u({width:i.width,height:i.height,children:s.createElement(s.Fragment,null,s.createElement("img",e.__assign({},_)))})},h=function(r){var n,t;if(null===(n=h.prototype)||void 0===n?void 0:n.renderAdmin)return null===(t=h.prototype)||void 0===t?void 0:t.renderAdmin(r);var i=c.getPageValues(),o=function(e,r){return e.readonly?e.source:e.metaFieldName?null==r?void 0:r.meta[e.metaFieldName]:e.customFieldName&&(null==r?void 0:r.customValues)?null==r?void 0:r.customValues[e.customFieldName]:e.source}(r,i),a=function(e){var r=e.children;return s.createElement(s.Fragment,null,r)};return!r.containerClassName&&!r.containerStyle||r.noWrapper||(a=function(e){var n=e.children;return s.createElement("div",{className:r.containerClassName,style:r.containerStyle},n)}),r.renderWrapper&&(a=r.renderWrapper),s.createElement(f,e.__assign({},r,{source:o,wrapper:a,placeholder:r.placeholder}))},v=function(r){var t,i=r.block,o=r.index,a=r.itemsCount,l=r.page,s=e.__rest(r,["block","index","itemsCount","page"]);if(!c.getConfig())return console.warn("React Bricks Store is not initialized"),null;c.setBlock(i);var u=c.getBrick(i);if(l||(l=c.getPage()),!u)return"development"===(null===(t=null===process||void 0===process?void 0:process.env)||void 0===t?void 0:t.NODE_ENV)&&console.warn('Missing component for block type "'.concat(i.type,'"')),console.error('Missing component for block type "'.concat(i.type,'"')),null;var d=e.__assign(e.__assign({},i.props),s);return u.schema.mapExternalDataToProps&&"function"==typeof u.schema.mapExternalDataToProps&&(null==l?void 0:l.externalData)&&"object"==typeof l.externalData&&(d=e.__assign(e.__assign({},d),u.schema.mapExternalDataToProps(l.externalData,i.props))),n.createElement(u,e.__assign({},d,{index:o,itemsCount:a,__page:l,__block:i}))},y=function(r){var n,t,i=r.propName,o=r.itemProps,a=void 0===o?{}:o,l=r.renderWrapper,u=r.renderItemWrapper,d=r.items;if(null===(n=y.prototype)||void 0===n?void 0:n.renderAdmin)return null===(t=y.prototype)||void 0===t?void 0:t.renderAdmin({propName:i,itemProps:a,renderWrapper:l,renderItemWrapper:u});if(!d||0===d.length)return null;var m=c.getPage(),p=d.length,g=s.createElement(s.Fragment,null,d.map((function(r,n){var t=s.createElement(v,e.__assign({page:m,key:"".concat(r.id,"-").concat(n),block:r,index:n,itemsCount:p},a));return u?u(t,n,d.length):t})));return l?l(g):g},b=function(r,n,t){if(i.Plain.isText(r)){var o=E(r.text);return n.filter((function(e){return"Mark"===e.type})).reduce((function(e,n){return r[n.name]?n.renderLeaf({children:e}):e}),o)}var a=n.filter((function(e){return"List"===e.type})).find((function(e){return r.type===e.name}));if(a){var l=k(r,n);return a.renderElement({children:l.map((function(e,r){return s.createElement(s.Fragment,{key:r},a.renderItemElement({children:e}))})),element:{url:r.url,data:r.data}})}var u=k(r,n,t),d=n.filter((function(e){return"Block"===e.type})).find((function(e){return r.type===e.name}));if(d){r.children,r.type;var c=e.__rest(r,["children","type"]);return d.renderElement({children:u,element:e.__assign({},c)})}return t?t({children:u,element:{type:"",children:[]},attributes:{ref:null}}):u},k=function(e,r,n){var t;return null===(t=e.children)||void 0===t?void 0:t.map((function(e,t){return s.createElement(s.Fragment,{key:t},b(e,r,n))}))},E=function(e){var r=null==e?void 0:e.replace(/\n/g,"<|BR|>\n<|BR|>").split("<|BR|>");if(r)return 1===r.length?e:s.createElement(s.Fragment,null,r.map((function(e,r,n){return"\n"===e&&n.length===r+1||"\n"===e&&n.length===r+2&&""===n[n.length-1]?s.createElement(s.Fragment,{key:r},s.createElement("br",null)," "):"\n"===e?s.createElement("br",{key:r}):s.createElement(s.Fragment,{key:r},e)})))},P=function(e){var r,n,t,o=e.renderBlock,a=void 0===o?function(e){var r=e.children;return s.createElement("p",null,r)}:o,l=e.placeholder,u=void 0===l?"Type a text...":l,d=e.renderPlaceholder,m=e.propName,p=e.value,g=e.plugins,f=void 0===g?[]:g,h=e.multiline,v=void 0===h||h,y=e.softLineBreak,k=void 0===y||y,E=e.metaFieldName,_=e.customFieldName,w=e.customFieldPlainText,x=void 0===w||w,B=e.shouldRefreshStyles;if(null===(r=P.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=P.prototype)||void 0===n?void 0:n.renderAdmin({renderBlock:a,placeholder:u,renderPlaceholder:d,propName:m,plugins:f,multiline:v,softLineBreak:k,metaFieldName:E,customFieldName:_,customFieldPlainText:x,shouldRefreshStyles:B});var N,I=c.getBlock(),L=c.getPageValues(),T=p||(m&&(null===(t=null==I?void 0:I.props)||void 0===t?void 0:t[m])?null==I?void 0:I.props[m]:E?(null==L?void 0:L.meta[E])||"":_&&(null==L?void 0:L.customValues)&&(null==L?void 0:L.customValues[_])||"");return T?(N="string"==typeof T?i.Plain.deserialize(T):T||[],s.createElement(s.Fragment,null,N.map((function(e,r){return s.createElement(s.Fragment,{key:r},b(e,f,a))})))):null},_=function(e){var r,n;return(null===(r=_.prototype)||void 0===r?void 0:r.adminConstructor)?null===(n=_.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:"Mark",name:e.name,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderLeaf:e.render,toggle:function(e){}}},w=_({name:"bold",hotKey:"mod+b",render:function(e){return s.createElement("strong",null,e.children)}}),x=_({name:"code",hotKey:"mod+`",render:function(e){return s.createElement("code",{style:{margin:"0 1px",display:"inline-block",padding:"3px 6px",fontSize:"0.875rem",lineHeight:1.25,maxWidth:"100%",fontFamily:'Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',borderRadius:"3px",backgroundColor:"#F5F7F9"}},e.children)}}),B=function(e){var r,n;return(null===(r=B.prototype)||void 0===r?void 0:r.adminConstructor)?null===(n=B.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:e.itemName?"List":"Block",name:e.name,isInline:e.isInline,itemName:e.itemName,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderElement:e.render,renderItemElement:e.renderItem,toggle:function(e,r){}}},N=B({name:"h1",hotKey:"mod+shift+1",render:function(e){return s.createElement("h1",null,e.children)}}),I=B({name:"h2",hotKey:"mod+shift+2",render:function(e){return s.createElement("h2",null,e.children)}}),L=B({name:"h3",hotKey:"mod+shift+3",render:function(e){return s.createElement("h3",null,e.children)}}),T=B({name:"h4",hotKey:"mod+shift+4",render:function(e){return s.createElement("h4",null,e.children)}}),F=B({name:"h5",hotKey:"mod+shift+5",render:function(e){return s.createElement("h5",null,e.children)}}),C=B({name:"h6",hotKey:"mod+shift+6",render:function(e){return s.createElement("h6",null,e.children)}}),S=_({name:"highlight",hotKey:"mod+h",render:function(e){return s.createElement("mark",{style:{paddingLeft:4,paddingRight:4,borderRadius:2,backgroundColor:"#ff0",color:"#0f0f05"}},e.children)}}),A=_({name:"italic",hotKey:"mod+i",render:function(e){return s.createElement("em",null,e.children)}}),R=function(e){var r,n;return(null===(r=R.prototype)||void 0===r?void 0:r.adminConstructor)?null===(n=R.prototype)||void 0===n?void 0:n.adminConstructor(e):{type:e.itemName?"List":"Block",name:e.name,isInline:e.isInline,itemName:e.itemName,label:e.label||e.name[0].toUpperCase()+e.name.slice(1),hotKey:e.hotKey,renderElement:e.render,renderItemElement:e.renderItem,toggle:function(e,r){}}},U=R({name:"link",label:"Link",isInline:!0,render:function(r){var n,t,i=r.element,o=r.children,a={};return(null===(n=null==i?void 0:i.data)||void 0===n?void 0:n.isTargetBlank)&&(a.target="_blank",a.rel="noopener"),s.createElement(p,e.__assign({},a,{href:(null==i?void 0:i.url)||(null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.url)}),o)},getDefaultProps:function(){return{url:"",isTargetBlank:!1}},pluginCustomFields:[]}),z=B({name:"ol",label:"Number list",itemName:"li",render:function(e){return s.createElement("ol",{className:"list-decimal"},e.children)},renderItem:function(e){return s.createElement("li",null,e.children)}}),H=B({name:"quote",render:function(e){return s.createElement("blockquote",null,e.children)}}),D=_({name:"sub",render:function(e){return s.createElement("sub",null,e.children)}}),K=_({name:"sup",render:function(e){return s.createElement("sup",null,e.children)}}),V=B({name:"ul",label:"Bullet list",itemName:"li",render:function(e){return s.createElement("ul",{className:"list-disc"},e.children)},renderItem:function(e){return s.createElement("li",null,e.children)}}),O=((m={})[e.types.RichTextFeatures.Bold]={newPlugin:w,renderLeaf:"renderBold"},m[e.types.RichTextFeatures.Italic]={newPlugin:A,renderLeaf:"renderItalic"},m[e.types.RichTextFeatures.Highlight]={newPlugin:S,renderLeaf:"renderHighlight"},m[e.types.RichTextFeatures.Code]={newPlugin:x,renderLeaf:"renderCode"},m[e.types.RichTextFeatures.Subscript]={newPlugin:D,renderLeaf:"renderSub"},m[e.types.RichTextFeatures.Superscript]={newPlugin:K,renderLeaf:"renderSup"},m[e.types.RichTextFeatures.Link]={newPlugin:U,renderLink:"renderLink"},m[e.types.RichTextFeatures.UnorderedList]={newPlugin:V,renderElement:"renderUL",renderItemElement:"renderLI"},m[e.types.RichTextFeatures.OrderedList]={newPlugin:z,renderElement:"renderOL",renderItemElement:"renderLI"},m[e.types.RichTextFeatures.Heading1]={newPlugin:N,renderElement:"renderH1"},m[e.types.RichTextFeatures.Heading2]={newPlugin:I,renderElement:"renderH2"},m[e.types.RichTextFeatures.Heading3]={newPlugin:L,renderElement:"renderH3"},m[e.types.RichTextFeatures.Heading4]={newPlugin:T,renderElement:"renderH4"},m[e.types.RichTextFeatures.Heading5]={newPlugin:F,renderElement:"renderH5"},m[e.types.RichTextFeatures.Heading6]={newPlugin:C,renderElement:"renderH6"},m[e.types.RichTextFeatures.Quote]={newPlugin:H,renderElement:"renderQuote"},m),M=function(r){var t,i;if(null===(t=M.prototype)||void 0===t?void 0:t.renderAdmin)return null===(i=M.prototype)||void 0===i?void 0:i.renderAdmin(r);var o=[];return r.allowedFeatures&&r.allowedFeatures.length>0&&(o=r.allowedFeatures.map((function(n){var t=O[n],i=t.newPlugin,o=t.renderLeaf,a=t.renderElement,l=t.renderItemElement,s=t.renderLink,u={},d=r[o],c=r[a],m=r[l],p=r[s];return o&&d&&(u.renderLeaf=d),a&&c&&(u.renderElement=c),l&&m&&(u.renderItemElement=m),s&&p&&(u.renderElement=function(r){var n,t,i=r.attributes,o=r.children,a=r.element,l={};return(null===(n=null==a?void 0:a.data)||void 0===n?void 0:n.isTargetBlank)&&(l.target="_blank",l.rel="noopener"),p(e.__assign({attributes:i,children:o,element:a,href:a.url||(null===(t=a.data)||void 0===t?void 0:t.url)},l))}),e.__assign(e.__assign({},i),u)}))),n.createElement(P,{renderBlock:r.renderBlock,placeholder:r.placeholder,propName:r.propName,plugins:o,multiline:r.multiline,softLineBreak:r.softLineBreak,renderPlaceholder:r.renderPlaceholder,metaFieldName:r.metaFieldName,customFieldName:r.customFieldName,customFieldPlainText:r.customFieldPlainText,value:r.value})},W=function(e){var r,n,t=e.renderBlock,o=void 0===t?function(e){var r=e.children;return s.createElement("p",null,r)}:t,a=e.placeholder,l=void 0===a?"Type a text...":a,u=e.renderPlaceholder,d=e.multiline,m=void 0!==d&&d,p=e.softLineBreak,g=void 0!==p&&p,f=e.propName,h=e.metaFieldName,v=e.customFieldName,y=e.value;if(null===(r=W.prototype)||void 0===r?void 0:r.renderAdmin)return null===(n=W.prototype)||void 0===n?void 0:n.renderAdmin({renderBlock:o,placeholder:l,renderPlaceholder:u,propName:f,multiline:m,softLineBreak:g,metaFieldName:h,customFieldName:v});var k,E=c.getPageValues(),P=y||(h?(null==E?void 0:E.meta[h])||"":v&&(null==E?void 0:E.customValues)&&(null==E?void 0:E.customValues[v])||"");return P?(k="string"==typeof P?i.Plain.deserialize(P):P||[],s.createElement(s.Fragment,null,k.map((function(e,r){return s.createElement(s.Fragment,{key:r},b(e,[],o))})))):null};function j(r){return e.__awaiter(this,arguments,void 0,(function(r){var n,t,i=r.of,a=r.where,l=r.sort,s=r.page,u=r.pageSize,d=r.children;return e.__generator(this,(function(e){switch(e.label){case 0:return(n=c.getConfig())?[4,o.fetchPages({type:i,tag:null==a?void 0:a.tag,language:null==a?void 0:a.language,filterBy:null==a?void 0:a.filterBy,sort:l,page:s,pageSize:u,usePagination:!0,config:n})]:(console.warn("React Bricks Store is not initialized"),[2,null]);case 1:return t=e.sent(),[2,d(t)]}}))}))}e.types.PageStatus.Draft;var q={logoHeight:80,welcomeText:"Welcome",sideImage:"https://images.unsplash.com/photo-1461418559055-6f020c5a91e7?ixlib=rb-1.2.1&auto=format&fit=crop&w=1601&q=80"};var J=function(){var e,r;return(null===(e=J.prototype)||void 0===e?void 0:e.useAdmin)?null===(r=J.prototype)||void 0===r?void 0:r.useAdmin():{isAdmin:!1,previewMode:!1,currentPage:{pageId:""},showRichTextModal:function(){}}},Q=function(){var r,t;if(null===(r=Q.prototype)||void 0===r?void 0:r.useAdmin)return null===(t=Q.prototype)||void 0===t?void 0:t.useAdmin();var i=e.__read(n.useState((function(){var e=null;try{e=c.getPageValues()}catch(e){}return e})),2),o=i[0],a=i[1];n.useEffect((function(){return c.__subscribePage((function(){a(c.getPageValues())}))}),[]);return[o,function(){}]},G=function(r){var n,t;if(null===(n=G.prototype)||void 0===n?void 0:n.useAdmin){var i=e.__read(null===(t=G.prototype)||void 0===t?void 0:t.useAdmin(r),3);return i[0],[i[1],i[2]]}return[function(e){},!0]};exports.CompatibleRichText=M,exports.File=g,exports.Image=h,exports.Link=p,exports.ListAstro=function(e){var r,n,t=e.of,i=e.where,o=e.sort,a=e.page,l=e.pageSize,s=e.children;return(null===(r=j.prototype)||void 0===r?void 0:r.renderAdmin)?null===(n=j.prototype)||void 0===n?void 0:n.renderAdmin({of:t,where:i,sort:o,page:a,pageSize:l,children:s}):j({of:t,where:i,sort:o,page:a,pageSize:l,children:s})},exports.Repeater=y,exports.RichText=P,exports.Text=W,exports.reactBricksAstroStore=c,exports.useAdminContext=J,exports.usePageValues=Q,exports.useReactBricksContext=function r(){var t,i;if(null===(t=r.prototype)||void 0===t?void 0:t.useAdmin)return null===(i=r.prototype)||void 0===i?void 0:i.useAdmin();var o=e.__read(n.useState((function(){var e=null;try{e=u()}catch(e){}return e})),2),l=o[0],s=o[1];function u(){var r=c.getConfig(),n=c.getBricks(),t=c.getThemes(),i=r.responsiveBreakpoints&&r.responsiveBreakpoints.length?r.responsiveBreakpoints:a.DEFAULT_BREAKPOINTS,o=q;r.loginUI&&(o=r.loginUI,void 0===r.loginUI.sideImage&&(o.sideImage=q.sideImage),void 0===r.loginUI.welcomeText&&(o.welcomeText=q.welcomeText),void 0===r.loginUI.logoHeight&&(o.logoHeight=q.logoHeight));var l=r.rtlLanguages||["ar","az","dv","fa","ff","he","ks","ku","pa","ps","ug","ur","yi"],s=e.__assign(e.__assign({},r),{bricks:n||a.DEFAULT_BRICKS,themes:t,version:a.version,browserSupport:{webP:!0,lazyLoading:!0},pageTypes:r.pageTypes||[],logo:r.logo||"",loginUI:o,contentClassName:r.contentClassName||"",defaultTheme:r.defaultTheme||"",loginPath:r.loginPath||"/admin",editorPath:r.editorPath||"/admin/editor",mediaLibraryPath:r.mediaLibraryPath||"/admin/media",playgroundPath:r.playgroundPath||"/admin/playground",appSettingsPath:r.appSettingsPath||"/admin/app-settings",previewPath:r.previewPath||"/preview",isDarkColorMode:r.isDarkColorMode||!1,useCssInJs:r.useCssInJs||!1,clickToEditSide:r.clickToEditSide||e.types.ClickToEditSide.BottomRight,responsiveBreakpoints:i,enableAutoSave:r.enableAutoSave||!0,disableSaveIfInvalidProps:r.disableSaveIfInvalidProps||!1,enablePreview:r.enablePreview||!0,blockIconsPosition:r.blockIconsPosition||e.types.BlockIconsPosition.OutsideBlock,enableUnsplash:r.enableUnsplash||!0,enablePreviewImage:r.enablePreviewImage||!0,enablePreviewIcon:r.enablePreviewIcon||!1,enableDefaultEmbedBrick:r.enableDefaultEmbedBrick||!0,allowAccentsInSlugs:r.allowAccentsInSlugs||!1,warningIfLowBattery:r.warningIfLowBattery||!1,isRtlLanguage:function(e){var r=e.language;return l.indexOf(r)>-1},rtlLanguages:l});return s}return n.useEffect((function(){return c.__subscribeConfig((function(){s(u())}))}),[]),l},exports.useVisualEdit=G;
2
+ //# sourceMappingURL=react-bricks-DIb6xkmL.js.map