@builder.io/sdk-react 0.11.2 → 0.11.4
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.
- package/lib/browser/index.cjs +25 -25
- package/lib/browser/index.mjs +540 -546
- package/lib/edge/index.cjs +31 -31
- package/lib/edge/index.mjs +1288 -1294
- package/lib/node/index.cjs +16 -16
- package/lib/node/index.mjs +342 -348
- package/package.json +61 -4
- package/types/blocks/button/button.d.ts +1 -9
- package/types/blocks/button/button.types.d.ts +6 -0
- package/types/blocks/columns/columns.d.ts +2 -14
- package/types/blocks/columns/columns.types.d.ts +15 -0
- package/types/blocks/fragment/fragment.d.ts +1 -5
- package/types/blocks/fragment/fragment.types.d.ts +5 -0
- package/types/blocks/image/image.d.ts +1 -19
- package/types/blocks/image/image.types.d.ts +19 -0
- package/types/blocks/section/section.d.ts +1 -9
- package/types/blocks/section/section.types.d.ts +6 -0
- package/types/blocks/symbol/symbol.d.ts +2 -23
- package/types/blocks/symbol/symbol.types.d.ts +18 -0
- package/types/blocks/text/text.d.ts +1 -3
- package/types/blocks/text/text.types.d.ts +3 -0
- package/types/blocks/video/video.d.ts +1 -21
- package/types/blocks/video/video.types.d.ts +21 -0
- package/types/components/blocks/blocks.d.ts +1 -6
- package/types/components/blocks/blocks.types.d.ts +6 -0
- package/types/components/content/components/enable-editor.d.ts +1 -1
- package/types/components/content/content.helpers.d.ts +1 -1
- package/types/components/content-variants/content-variants.types.d.ts +30 -1
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/get-content/index.d.ts +1 -1
- package/types/functions/get-content/types.d.ts +2 -2
- package/types/server-index.d.ts +10 -1
package/lib/browser/index.cjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),m=require("react"),d=require("./server-entry-df9eba5d.cjs");function de(e){return a.jsxs(a.Fragment,{children:[e.link?a.jsx(a.Fragment,{children:a.jsx("a",{...e.attributes,href:e.link,target:e.openLinkInNewTab?"_blank":void 0,role:"button",children:e.text})}):a.jsx(a.Fragment,{children:a.jsx("button",{...e.attributes,style:e.attributes.style,className:e.attributes.className+" button-
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),m=require("react"),d=require("./server-entry-df9eba5d.cjs");function de(e){return a.jsxs(a.Fragment,{children:[e.link?a.jsx(a.Fragment,{children:a.jsx("a",{...e.attributes,href:e.link,target:e.openLinkInNewTab?"_blank":void 0,role:"button",children:e.text})}):a.jsx(a.Fragment,{children:a.jsx("button",{...e.attributes,style:e.attributes.style,className:e.attributes.className+" button-fdf49de0",children:e.text})}),a.jsx("style",{children:`.button-fdf49de0 {
|
|
2
2
|
all: unset;
|
|
3
|
-
}`})]})}const q=m.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{}}),ue=m.createContext({registeredComponents:{}});function Ee(e){var t;return{...(t=e.component)==null?void 0:t.options,...e.options,builderBlock:e}}const Te=({builder:e,context:t,event:n,state:i})=>Object.entries({state:i,Builder:e,builder:e,context:t,event:n}),Re=()=>({isEditing:d.isEditing(),isBrowser:d.isBrowser(),isServer:!d.isBrowser(),getUserAttributes:()=>d.getUserAttributes()}),je=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,ee=({code:e,builder:t,context:n,event:i,localState:o,rootSetState:r,rootState:c})=>{const
|
|
3
|
+
}`})]})}const q=m.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{}}),ue=m.createContext({registeredComponents:{}});function Ee(e){var t;return{...(t=e.component)==null?void 0:t.options,...e.options,builderBlock:e}}const Te=({builder:e,context:t,event:n,state:i})=>Object.entries({state:i,Builder:e,builder:e,context:t,event:n}),Re=()=>({isEditing:d.isEditing(),isBrowser:d.isBrowser(),isServer:!d.isBrowser(),getUserAttributes:()=>d.getUserAttributes()}),je=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,ee=({code:e,builder:t,context:n,event:i,localState:o,rootSetState:r,rootState:c})=>{const s=Te({builder:t,context:n,event:i,state:Pe(c,o,r)});return new Function(...s.map(([l])=>l),e)(...s.map(([,l])=>l))};function Pe(e,t,n){if(e===t)throw new Error("rootState === localState");return new Proxy(e,{get:(i,o)=>t&&o in t?t[o]:e[o],set:(i,o,r)=>{if(t&&o in t)throw new Error("Writing to local state is not allowed as it is read-only.");return e[o]=r,n==null||n(e),!0}})}const Be=e=>(d.isBrowser(),ee(e));function W({code:e,context:t,localState:n,rootState:i,rootSetState:o,event:r,isExpression:c=!0}){if(e===""){d.logger.warn("Skipping evaluation of empty code block.");return}const s={code:je(e,{isExpression:c}),builder:Re(),context:t,event:r,rootSetState:o,rootState:i,localState:n};try{return Be(s)}catch(l){d.logger.error("Failed code evaluation: "+l.message,{code:e});return}}const Fe=(e,t,n)=>{if(Object(e)!==e)return e;const i=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return i.slice(0,-1).reduce((o,r,c)=>Object(o[r])===o[r]?o[r]:o[r]=Math.abs(Number(i[c+1]))>>0===+i[c+1]?[]:{},e)[i[i.length-1]]=n,e};const We=({block:e,context:t,localState:n,rootState:i,rootSetState:o})=>{if(!e.bindings)return e;const r=d.fastClone(e),c={...r,properties:{...r.properties},actions:{...r.actions}};for(const s in e.bindings){const l=e.bindings[s],u=W({code:l,localState:n,rootState:i,rootSetState:o,context:t});Fe(c,s,u)}return c};function $({block:e,context:t,shouldEvaluateBindings:n,localState:i,rootState:o,rootSetState:r}){const c=e;return n?We({block:c,localState:i,rootState:o,rootSetState:r,context:t}):c}const Ae=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],O=e=>typeof e=="string"&&Ae.includes(e.toLowerCase()),Ve=({block:e,context:t,registeredComponents:n})=>{var r;const i=(r=$({block:e,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context,shouldEvaluateBindings:!1}).component)==null?void 0:r.name;if(!i)return null;const o=n[i];if(o)return o;console.warn(`
|
|
4
4
|
Could not find a registered component named "${i}".
|
|
5
|
-
If you registered it, is the file that registered it imported by the file that needs to render it?`)},$e=({block:e,context:t})=>{const{repeat:n,...i}=e;if(!(n!=null&&n.collection))return;const o=W({code:n.collection,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context});if(!Array.isArray(o))return;const r=n.collection.split(".").pop(),c=n.itemName||(r?r+"Item":"item");return o.map((
|
|
5
|
+
If you registered it, is the file that registered it imported by the file that needs to render it?`)},$e=({block:e,context:t})=>{const{repeat:n,...i}=e;if(!(n!=null&&n.collection))return;const o=W({code:n.collection,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context});if(!Array.isArray(o))return;const r=n.collection.split(".").pop(),c=n.itemName||(r?r+"Item":"item");return o.map((l,u)=>({context:{...t,localState:{...t.localState,$index:u,$item:l,[c]:l,[`$${c}Index`]:u}},block:i}))},me={small:{min:320,default:321,max:640},medium:{min:641,default:642,max:991},large:{min:990,default:991,max:1200}},te=(e,t=me)=>`@media (max-width: ${t[e].max}px)`,fe=({small:e,medium:t})=>{const n=d.fastClone(me);if(!e||!t)return n;const i=Math.floor(e/2);n.small={max:e,min:i,default:i+1};const o=n.small.max+1;n.medium={max:t,min:o,default:o+1};const r=n.medium.max+1;return n.large={max:2e3,min:r,default:r+1},n},Ne=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),ge=e=>Object.entries(e).map(([n,i])=>{if(typeof i=="string")return`${Ne(n)}: ${i};`}).filter(d.checkIsDefined),_e=e=>ge(e).join(`
|
|
6
6
|
`),U=({mediaQuery:e,className:t,styles:n})=>{const i=`.${t} {
|
|
7
7
|
${_e(n)}
|
|
8
8
|
}`;return e?`${e} {
|
|
9
9
|
${i}
|
|
10
|
-
}`:i};function _(e){return a.jsx("style",{dangerouslySetInnerHTML:{__html:e.styles},id:e.id})}function
|
|
10
|
+
}`:i};function _(e){return a.jsx("style",{dangerouslySetInnerHTML:{__html:e.styles},id:e.id})}function Me(e){function t(){const i=$({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0});return d.checkIsDefined(i.hide)?!i.hide:d.checkIsDefined(i.show)?i.show:!0}function n(){var C;const i=$({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0}),o=i.responsiveStyles,r=e.context.content,c=fe(((C=r==null?void 0:r.meta)==null?void 0:C.breakpoints)||{}),s=o==null?void 0:o.large,l=o==null?void 0:o.medium,u=o==null?void 0:o.small,f=i.id;if(!f)return"";const x=s?U({className:f,styles:s}):"",v=l?U({className:f,styles:l,mediaQuery:te("medium",c)}):"",y=u?U({className:f,styles:u,mediaQuery:te("small",c)}):"";return[x,v,y].join(" ")}return a.jsx(a.Fragment,{children:n()&&t()?a.jsx(a.Fragment,{children:a.jsx(_,{styles:n()})}):null})}function Le(e){return e.charAt(0).toUpperCase()+e.slice(1)}const De=e=>`on${Le(e)}`,Oe=(e,t)=>n=>W({code:e,context:t.context,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,event:n,isExpression:!1});function H(e){var i;const t={},n=(i=e.block.actions)!=null?i:{};for(const o in n){if(!n.hasOwnProperty(o))continue;const r=n[o];let c=De(o);if(e.stripPrefix)switch(d.TARGET){case"vue":c=c.replace("v-on:","");break;case"svelte":c=c.replace("on:","");break}t[c]=Oe(r,e)}return t}function Ue({properties:e}){return e.className=e.class,delete e.class,e}const Ke=e=>({href:e.href});function N({block:e,context:t}){var i;const n={...Ke(e),...e.properties,"builder-id":e.id,style:e.style?He(e.style):void 0,class:[e.id,"builder-block",e.class,(i=e.properties)==null?void 0:i.class].filter(Boolean).join(" ")};return Ue({properties:n,context:t,block:e})}function He(e){switch(d.TARGET){case"svelte":case"vue":case"solid":return ge(e).join(" ");case"qwik":case"reactNative":case"react":case"rsc":return e}}function ne(e){return a.jsxs(a.Fragment,{children:[" ",e.hasChildren?a.jsx(a.Fragment,{children:a.jsxs(e.Wrapper,{...N({block:e.block,context:e.context}),...H({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0}),children:[" ",e.children," "]})}):a.jsx(a.Fragment,{children:a.jsx(e.Wrapper,{...N({block:e.block,context:e.context}),...H({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0})})})," "]})}function ze(e){return a.jsx(e.Wrapper,{...e.wrapperProps,attributes:e.includeBlockProps?{...N({block:e.block,context:e.context}),...H({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})}:{},children:e.children})}const qe=({componentOptions:e,builderBlock:t,context:n,componentRef:i,includeBlockProps:o,isInteractive:r,contextValue:c})=>{const s={...e,...o?{attributes:N({block:t,context:c})}:{}};return r?{Wrapper:i,block:t,context:n,wrapperProps:e,includeBlockProps:o}:s};function ie(e){var i;const[t,n]=m.useState(()=>e.isInteractive?ze:e.componentRef);return a.jsx(a.Fragment,{children:e.componentRef?a.jsx(a.Fragment,{children:a.jsx(t,{...qe({componentOptions:e.componentOptions,builderBlock:e.builderBlock,context:e.context,componentRef:e.componentRef,includeBlockProps:e.includeBlockProps,isInteractive:e.isInteractive,contextValue:e.context}),children:(i=e.blockChildren)==null?void 0:i.map(o=>a.jsx(M,{block:o,context:e.context,registeredComponents:e.registeredComponents},o.id))})}):null})}function Ge(e){const[t,n]=m.useState(()=>e.repeatContext);return a.jsx(q.Provider,{value:t,children:a.jsx(M,{block:e.block,context:t,registeredComponents:e.registeredComponents})})}function M(e){var f,x,v;function t(){return Ve({block:e.block,context:e.context,registeredComponents:e.registeredComponents})}function n(){return $e({block:e.block,context:e.context})}function i(){var y;return(y=e.block.repeat)!=null&&y.collection?e.block:$({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0})}function o(){return e.block.tagName||"div"}function r(){var k,T;if((k=e.block.repeat)!=null&&k.collection)return!!((T=n==null?void 0:n())!=null&&T.length);const y="hide"in i()?i().hide:!1;return("show"in i()?i().show:!0)&&!y}function c(){var C,k;return!((C=t==null?void 0:t())!=null&&C.component)&&!n()?(k=i().children)!=null?k:[]:[]}function s(){var y,C,k,T,R,w;return{blockChildren:(y=i().children)!=null?y:[],componentRef:(C=t==null?void 0:t())==null?void 0:C.component,componentOptions:{...Ee(i()),builderContext:e.context,...((k=t==null?void 0:t())==null?void 0:k.name)==="Symbol"||((T=t==null?void 0:t())==null?void 0:T.name)==="Columns"?{builderComponents:e.registeredComponents}:{}},context:l,registeredComponents:e.registeredComponents,builderBlock:i(),includeBlockProps:((R=t==null?void 0:t())==null?void 0:R.noWrap)===!0,isInteractive:!((w=t==null?void 0:t())!=null&&w.isRSC)}}const[l,u]=m.useState(()=>e.context);return a.jsx(a.Fragment,{children:r()?a.jsxs(a.Fragment,{children:[a.jsx(Me,{block:e.block,context:e.context}),(f=t==null?void 0:t())!=null&&f.noWrap?a.jsx(a.Fragment,{children:a.jsx(ie,{componentRef:s().componentRef,componentOptions:s().componentOptions,blockChildren:s().blockChildren,context:s().context,registeredComponents:s().registeredComponents,builderBlock:s().builderBlock,includeBlockProps:s().includeBlockProps,isInteractive:s().isInteractive})}):a.jsxs(a.Fragment,{children:[O(o())?a.jsx(a.Fragment,{children:a.jsx(ne,{Wrapper:o(),block:i(),context:e.context,hasChildren:!1})}):null,!O(o())&&n()?a.jsx(a.Fragment,{children:(x=n())==null?void 0:x.map((y,C)=>a.jsx(Ge,{repeatContext:y.context,block:y.block,registeredComponents:e.registeredComponents},C))}):null,!O(o())&&!n()?a.jsx(a.Fragment,{children:a.jsxs(ne,{Wrapper:o(),block:i(),context:e.context,hasChildren:!0,children:[a.jsx(ie,{componentRef:s().componentRef,componentOptions:s().componentOptions,blockChildren:s().blockChildren,context:s().context,registeredComponents:s().registeredComponents,builderBlock:s().builderBlock,includeBlockProps:s().includeBlockProps,isInteractive:s().isInteractive}),(v=c())==null?void 0:v.map(y=>a.jsx(M,{block:y,context:l,registeredComponents:e.registeredComponents},y.id))]})}):null]})]}):null})}function Ye(e){function t(){var o;return"builder-blocks"+((o=e.blocks)!=null&&o.length?"":" no-blocks")}function n(){var o,r;d.isEditing()&&!((o=e.blocks)!=null&&o.length)&&((r=window.parent)==null||r.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function i(){var o,r;d.isEditing()&&!((o=e.blocks)!=null&&o.length)&&((r=window.parent)==null||r.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return a.jsxs(a.Fragment,{children:[a.jsx(e.BlocksWrapper,{className:t()+" props-blocks-wrapper-4f2c12d8","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:o=>n(),onMouseEnter:o=>i(),onKeyPress:o=>n(),...e.BlocksWrapperProps,children:e.children}),a.jsx("style",{children:`.props-blocks-wrapper-4f2c12d8 {
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
align-items: stretch;
|
|
14
|
-
}`})]})}function L(e){var i,o,r
|
|
14
|
+
}`})]})}function L(e){var i,o,r;const t=m.useContext(q),n=m.useContext(ue);return a.jsx(Ye,{blocks:e.blocks,parent:e.parent,path:e.path,styleProp:e.styleProp,BlocksWrapper:(i=e.context)==null?void 0:i.BlocksWrapper,BlocksWrapperProps:(o=e.context)==null?void 0:o.BlocksWrapperProps,children:e.blocks?a.jsx(a.Fragment,{children:(r=e.blocks)==null?void 0:r.map(c=>a.jsx(M,{block:c,context:e.context||t,registeredComponents:e.registeredComponents||n.registeredComponents},c.id))}):null})}function he(e){var R;const[t,n]=m.useState(()=>typeof e.space=="number"?e.space||0:20),[i,o]=m.useState(()=>e.columns||[]),[r,c]=m.useState(()=>e.stackColumnsAt||"tablet");function s(w){var I;return((I=i[w])==null?void 0:I.width)||100/i.length}function l(w){const I=t*(i.length-1)/i.length;return`calc(${s(w)}% - ${I}px)`}function u({stackedStyle:w,desktopStyle:I}){return r==="tablet"?w:I}function f({stackedStyle:w,desktopStyle:I}){return r==="never"?I:w}const[x,v]=m.useState(()=>e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column");function y(){return{"--flex-dir":x,"--flex-dir-tablet":u({stackedStyle:x,desktopStyle:"row"})}}function C(w){const I=w===0?0:t,j=l(w),P=`${I}px`,B="100%",F=0;return{width:j,["marginLeft"]:P,"--column-width-mobile":f({stackedStyle:B,desktopStyle:j}),"--column-margin-left-mobile":f({stackedStyle:F,desktopStyle:P}),"--column-width-tablet":u({stackedStyle:B,desktopStyle:j}),"--column-margin-left-tablet":u({stackedStyle:F,desktopStyle:P})}}function k(w){var j,P;return fe(((P=(j=e.builderContext.content)==null?void 0:j.meta)==null?void 0:P.breakpoints)||{})[w].max}function T(){return`
|
|
15
15
|
@media (max-width: ${k("medium")}px) {
|
|
16
16
|
.${e.builderBlock.id}-breakpoints {
|
|
17
17
|
flex-direction: var(--flex-dir-tablet);
|
|
@@ -35,21 +35,21 @@
|
|
|
35
35
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
`}return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`builder-columns ${e.builderBlock.id}-breakpoints div-
|
|
38
|
+
`}return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`builder-columns ${e.builderBlock.id}-breakpoints div-3c01d6ec`,style:y(),children:[a.jsx(a.Fragment,{children:a.jsx(_,{styles:T()})}),(R=e.columns)==null?void 0:R.map((w,I)=>m.createElement("div",{className:"builder-column div-3c01d6ec-2",style:C(I),key:I},a.jsx(L,{path:`component.options.columns.${I}.blocks`,parent:e.builderBlock.id,styleProp:{flexGrow:"1"},context:e.builderContext,registeredComponents:e.builderComponents,blocks:w.blocks})))]}),a.jsx("style",{children:`.div-3c01d6ec {
|
|
39
39
|
display: flex;
|
|
40
40
|
line-height: normal;
|
|
41
|
-
}.div-
|
|
41
|
+
}.div-3c01d6ec-2 {
|
|
42
42
|
display: flex;
|
|
43
43
|
flex-direction: column;
|
|
44
44
|
align-items: stretch;
|
|
45
|
-
}`})]})}function be(e){return a.jsx("span",{children:e.children})}function ae(e){return e.replace(/http(s)?:/,"")}function
|
|
45
|
+
}`})]})}function be(e){return a.jsx("span",{children:e.children})}function ae(e){return e.replace(/http(s)?:/,"")}function Qe(e="",t,n){const i=new RegExp("([?&])"+t+"=.*?(&|$)","i"),o=e.indexOf("?")!==-1?"&":"?";return e.match(i)?e.replace(i,"$1"+t+"="+encodeURIComponent(n)+"$2"):e+o+t+"="+encodeURIComponent(n)}function Je(e,t){if(!e||!(e!=null&&e.match(/cdn\.shopify\.com/))||!t)return e;if(t==="master")return ae(e);const n=e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);if(n){const i=e.split(n[0]),o=n[3],r=t.match("x")?t:`${t}x`;return ae(`${i[0]}_${r}${o}`)}return null}function K(e){if(!e)return e;const t=[100,200,400,800,1200,1600,2e3];if(e.match(/builder\.io/)){let n=e;const i=Number(e.split("?width=")[1]);return isNaN(i)||(n=`${n} ${i}w`),t.filter(o=>o!==i).map(o=>`${Qe(e,"width",o)} ${o}w`).concat([n]).join(", ")}return e.match(/cdn\.shopify\.com/)?t.map(n=>[Je(e,`${n}x${n}`),n]).filter(([n])=>!!n).map(([n,i])=>`${n} ${i}w`).concat([e]).join(", "):e}function xe(e){var o,r,c,s;function t(){var f;const u=e.image||e.src;if(!u||!(u.match(/builder\.io/)||u.match(/cdn\.shopify\.com/)))return e.srcset;if(e.srcset&&((f=e.image)!=null&&f.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),K(u)}else if(e.image&&!e.srcset)return K(u);return K(u)}function n(){var l;return(l=t==null?void 0:t())!=null&&l.match(/builder\.io/)&&!e.noWebp?t().replace(/\?/g,"?format=webp&"):""}function i(){const l={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?l:void 0}return a.jsxs(a.Fragment,{children:[a.jsxs(a.Fragment,{children:[a.jsxs("picture",{children:[n()?a.jsx(a.Fragment,{children:a.jsx("source",{type:"image/webp",srcSet:n()})}):null,a.jsx("img",{loading:"lazy",alt:e.altText,role:e.altText?"presentation":void 0,style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...i()},className:"builder-image"+(e.className?" "+e.className:"")+" img-40c70c9b",src:e.image,srcSet:t(),sizes:e.sizes})]}),e.aspectRatio&&!((r=(o=e.builderBlock)==null?void 0:o.children)!=null&&r.length&&e.fitContent)?a.jsx(a.Fragment,{children:a.jsx("div",{className:"builder-image-sizer div-40c70c9b",style:{paddingTop:e.aspectRatio*100+"%"}})}):null,(s=(c=e.builderBlock)==null?void 0:c.children)!=null&&s.length&&e.fitContent?a.jsx(a.Fragment,{children:e.children}):null,!e.fitContent&&e.children?a.jsx(a.Fragment,{children:a.jsx("div",{className:"div-40c70c9b-2",children:e.children})}):null]}),a.jsx("style",{children:`.img-40c70c9b {
|
|
46
46
|
opacity: 1;
|
|
47
47
|
transition: opacity 0.2s ease-in-out;
|
|
48
|
-
}.div-
|
|
48
|
+
}.div-40c70c9b {
|
|
49
49
|
width: 100%;
|
|
50
50
|
pointer-events: none;
|
|
51
51
|
font-size: 0;
|
|
52
|
-
}.div-
|
|
52
|
+
}.div-40c70c9b-2 {
|
|
53
53
|
display: flex;
|
|
54
54
|
flex-direction: column;
|
|
55
55
|
align-items: stretch;
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
left: 0;
|
|
59
59
|
width: 100%;
|
|
60
60
|
height: 100%;
|
|
61
|
-
}`})]})}function Se(e){return a.jsx("section",{...e.attributes,style:{width:"100%",alignSelf:"stretch",flexGrow:1,boxSizing:"border-box",maxWidth:e.maxWidth||1200,display:"flex",flexDirection:"column",alignItems:"stretch",marginLeft:"auto",marginRight:"auto"},children:e.children})}const Je={name:"Core:Button",image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",defaultStyles:{appearance:"none",paddingTop:"15px",paddingBottom:"15px",paddingLeft:"25px",paddingRight:"25px",backgroundColor:"#000000",color:"white",borderRadius:"4px",textAlign:"center",cursor:"pointer"},inputs:[{name:"text",type:"text",defaultValue:"Click me!",bubble:!0},{name:"link",type:"url",bubble:!0},{name:"openLinkInNewTab",type:"boolean",defaultValue:!1,friendlyName:"Open link in new tab"}],static:!0,noWrap:!0},Xe={name:"Columns",isRSC:!0,inputs:[{name:"columns",type:"array",broadcast:!0,subFields:[{name:"blocks",type:"array",hideFromUI:!0,defaultValue:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]},{name:"width",type:"number",hideFromUI:!0,helperText:"Width %, e.g. set to 50 to fill half of the space"},{name:"link",type:"url",helperText:"Optionally set a url that clicking this column will link to"}],defaultValue:[{blocks:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]},{blocks:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]}],onChange:e=>{function t(){n.forEach(i=>{i.delete("width")})}const n=e.get("columns");Array.isArray(n)&&n.find(o=>o.get("width"))&&(n.find(r=>!r.get("width"))||n.reduce((l,s)=>l+s.get("width"),0)!==100)&&t()}},{name:"space",type:"number",defaultValue:20,helperText:"Size of gap between columns",advanced:!0},{name:"stackColumnsAt",type:"string",defaultValue:"tablet",helperText:"Convert horizontal columns to vertical at what device size",enum:["tablet","mobile","never"],advanced:!0},{name:"reverseColumnsWhenStacked",type:"boolean",defaultValue:!1,helperText:"When stacking columns for mobile devices, reverse the ordering",advanced:!0}]},Ze={name:"Custom Code",static:!0,requiredPermissions:["editCode"],inputs:[{name:"code",type:"html",required:!0,defaultValue:"<p>Hello there, I am custom HTML code!</p>",code:!0},{name:"replaceNodes",type:"boolean",helperText:"Preserve server rendered dom nodes",advanced:!0},{name:"scriptsClientOnly",type:"boolean",defaultValue:!1,helperText:"Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",advanced:!0}]};function et(e){const t=m.useRef(null),[n,i]=m.useState(()=>[]),[o,r]=m.useState(()=>[]);return m.useEffect(()=>{var l;if(!((l=t.current)!=null&&l.getElementsByTagName)||typeof window=="undefined")return;const c=t.current.getElementsByTagName("script");for(let s=0;s<c.length;s++){const u=c[s];if(u.src){if(n.includes(u.src))continue;n.push(u.src);const f=document.createElement("script");f.async=!0,f.src=u.src,document.head.appendChild(f)}else if(!u.type||["text/javascript","application/javascript","application/ecmascript"].includes(u.type)){if(o.includes(u.innerText))continue;try{o.push(u.innerText),new Function(u.innerText)()}catch(f){console.warn("`CustomCode`: Error running script:",f)}}}},[]),a.jsx("div",{ref:t,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}const tt={name:"Embed",static:!0,inputs:[{name:"url",type:"url",required:!0,defaultValue:"",helperText:"e.g. enter a youtube url, google map, etc",onChange:e=>{const t=e.get("url");if(t)return e.set("content","Loading..."),fetch(`https://iframe.ly/api/iframely?url=${t}&api_key=ae0e60e78201a3f2b0de4b`).then(i=>i.json()).then(i=>{e.get("url")===t&&(i.html?e.set("content",i.html):e.set("content","Invalid url, please try another"))}).catch(i=>{e.set("content","There was an error embedding this URL, please try again or another URL")});e.delete("content")}},{name:"content",type:"html",defaultValue:'<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',hideFromUI:!0}]},nt=["text/javascript","application/javascript","application/ecmascript"],it=e=>nt.includes(e.type);function at(e){const t=m.useRef(null),[n,i]=m.useState(()=>[]),[o,r]=m.useState(()=>[]),[c,l]=m.useState(()=>!1);function s(){if(!t.current||!t.current.getElementsByTagName)return;const u=t.current.getElementsByTagName("script");for(let f=0;f<u.length;f++){const b=u[f];if(b.src&&!n.includes(b.src)){n.push(b.src);const v=document.createElement("script");v.async=!0,v.src=b.src,document.head.appendChild(v)}else if(it(b)&&!o.includes(b.innerText))try{o.push(b.innerText),new Function(b.innerText)()}catch(v){console.warn("`Embed`: Error running script:",v)}}}return m.useEffect(()=>{t.current&&!c&&(l(!0),s())},[t.current,c]),a.jsx("div",{className:"builder-embed",ref:t,dangerouslySetInnerHTML:{__html:e.content}})}const ot={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},rt={name:"Image",static:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",defaultStyles:{position:"relative",minHeight:"20px",minWidth:"20px",overflow:"hidden"},canHaveChildren:!0,inputs:[{name:"image",type:"file",bubble:!0,allowedFileTypes:["jpeg","jpg","png","svg"],required:!0,defaultValue:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",onChange:e=>{e.delete("srcset"),e.delete("noWebp");function n(c,l=6e4){return new Promise((s,u)=>{const f=document.createElement("img");let b=!1;f.onload=()=>{b=!0,s(f)},f.addEventListener("error",v=>{console.warn("Image load failed",v.error),u(v.error)}),f.src=c,setTimeout(()=>{b||u(new Error("Image load timed out"))},l)})}function i(c){return Math.round(c*1e3)/1e3}const o=e.get("image"),r=e.get("aspectRatio");if(fetch(o).then(c=>c.blob()).then(c=>{c.type.includes("svg")&&e.set("noWebp",!0)}),o&&(!r||r===.7041))return n(o).then(c=>{const l=e.get("aspectRatio");e.get("image")===o&&(!l||l===.7041)&&c.width&&c.height&&(e.set("aspectRatio",i(c.height/c.width)),e.set("height",c.height),e.set("width",c.width))})}},{name:"backgroundSize",type:"text",defaultValue:"cover",enum:[{label:"contain",value:"contain",helperText:"The image should never get cropped"},{label:"cover",value:"cover",helperText:"The image should fill it's box, cropping when needed"}]},{name:"backgroundPosition",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"altText",type:"string",helperText:"Text to display when the user has images off"},{name:"height",type:"number",hideFromUI:!0},{name:"width",type:"number",hideFromUI:!0},{name:"sizes",type:"string",hideFromUI:!0},{name:"srcset",type:"string",hideFromUI:!0},{name:"lazy",type:"boolean",defaultValue:!0,hideFromUI:!0},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the image's aspect ratio",defaultValue:!0},{name:"aspectRatio",type:"number",helperText:"This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",advanced:!0,defaultValue:.7041}]},ct={name:"Raw:Img",hideFromInsertMenu:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",inputs:[{name:"image",bubble:!0,type:"file",allowedFileTypes:["jpeg","jpg","png","svg","gif","webp"],required:!0}],noWrap:!0,static:!0};function lt(e){return a.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},d.isEditing()&&e.imgSrc||"default-key")}const st={name:"Core:Section",static:!0,image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",inputs:[{name:"maxWidth",type:"number",defaultValue:1200},{name:"lazyLoad",type:"boolean",defaultValue:!1,advanced:!0,description:"Only render this section when in view"}],defaultStyles:{paddingLeft:"20px",paddingRight:"20px",paddingTop:"50px",paddingBottom:"50px",marginTop:"0px",width:"100vw",marginLeft:"calc(50% - 50vw)"},canHaveChildren:!0,defaultChildren:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{textAlign:"center"}},component:{name:"Text",options:{text:"<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"}}}]},dt={name:"Symbol",noWrap:!0,static:!0,isRSC:!0,inputs:[{name:"symbol",type:"uiSymbol"},{name:"dataOnly",helperText:"Make this a data symbol that doesn't display any UI",type:"boolean",defaultValue:!1,advanced:!0,hideFromUI:!0},{name:"inheritState",helperText:"Inherit the parent component state and data",type:"boolean",defaultValue:!1,advanced:!0},{name:"renderToLiquid",helperText:"Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",type:"boolean",defaultValue:!1,advanced:!0,hideFromUI:!0},{name:"useChildren",hideFromUI:!0,type:"boolean"}]},ut={name:"Text",static:!0,isRSC:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",inputs:[{name:"text",type:"html",required:!0,autoFocus:!0,bubble:!0,defaultValue:"Enter some text..."}],defaultStyles:{lineHeight:"normal",height:"auto",textAlign:"center"}};function ye(e){var t;return a.jsx("div",{className:"builder-text",dangerouslySetInnerHTML:{__html:((t=e.text)==null?void 0:t.toString())||""},style:{outline:"none"}})}const mt={name:"Video",canHaveChildren:!0,defaultStyles:{minHeight:"20px",minWidth:"20px"},image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",inputs:[{name:"video",type:"file",allowedFileTypes:["mp4"],bubble:!0,defaultValue:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",required:!0},{name:"posterImage",type:"file",allowedFileTypes:["jpeg","png"],helperText:"Image to show before the video plays"},{name:"autoPlay",type:"boolean",defaultValue:!0},{name:"controls",type:"boolean",defaultValue:!1},{name:"muted",type:"boolean",defaultValue:!0},{name:"loop",type:"boolean",defaultValue:!0},{name:"playsInline",type:"boolean",defaultValue:!0},{name:"fit",type:"text",defaultValue:"cover",enum:["contain","cover","fill","auto"]},{name:"preload",type:"text",defaultValue:"metadata",enum:["auto","metadata","none"]},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the aspect ratio",defaultValue:!0,advanced:!0},{name:"position",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"height",type:"number",advanced:!0},{name:"width",type:"number",advanced:!0},{name:"aspectRatio",type:"number",advanced:!0,defaultValue:.7004048582995948},{name:"lazyLoad",type:"boolean",helperText:'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',defaultValue:!0,advanced:!0}]};function pe(e){var i,o,r,c,l,s,u;function t(){return{...e.autoPlay===!0?{autoPlay:!0}:{},...e.muted===!0?{muted:!0}:{},...e.controls===!0?{controls:!0}:{},...e.loop===!0?{loop:!0}:{},...e.playsInline===!0?{playsInline:!0}:{}}}function n(){return{...t()}}return a.jsxs("div",{style:{position:"relative"},children:[a.jsx("video",{className:"builder-video",...n(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(i=e.attributes)==null?void 0:i.style,objectFit:e.fit,objectPosition:e.position,zIndex:2,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},src:e.video||"no-src",poster:e.posterImage,children:e.lazyLoad?null:a.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((r=(o=e.builderBlock)==null?void 0:o.children)!=null&&r.length))?a.jsx(a.Fragment,{children:a.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}})}):null,(l=(c=e.builderBlock)==null?void 0:c.children)!=null&&l.length&&e.fitContent?a.jsx(a.Fragment,{children:a.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children})}):null,(u=(s=e.builderBlock)==null?void 0:s.children)!=null&&u.length&&!e.fitContent?a.jsx(a.Fragment,{children:a.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children})}):null]})}const oe=()=>[{component:de,...Je},{component:he,...Xe},{component:et,...Ze},{component:at,...tt},{component:be,...ot},{component:xe,...rt},{component:lt,...ct},{component:Se,...st},{component:we,...dt},{component:ye,...ut},{component:pe,...mt}],ft=`function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
61
|
+
}`})]})}function Se(e){return a.jsx("section",{...e.attributes,style:{width:"100%",alignSelf:"stretch",flexGrow:1,boxSizing:"border-box",maxWidth:e.maxWidth||1200,display:"flex",flexDirection:"column",alignItems:"stretch",marginLeft:"auto",marginRight:"auto"},children:e.children})}const Xe={name:"Core:Button",image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",defaultStyles:{appearance:"none",paddingTop:"15px",paddingBottom:"15px",paddingLeft:"25px",paddingRight:"25px",backgroundColor:"#000000",color:"white",borderRadius:"4px",textAlign:"center",cursor:"pointer"},inputs:[{name:"text",type:"text",defaultValue:"Click me!",bubble:!0},{name:"link",type:"url",bubble:!0},{name:"openLinkInNewTab",type:"boolean",defaultValue:!1,friendlyName:"Open link in new tab"}],static:!0,noWrap:!0},Ze={name:"Columns",isRSC:!0,inputs:[{name:"columns",type:"array",broadcast:!0,subFields:[{name:"blocks",type:"array",hideFromUI:!0,defaultValue:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]},{name:"width",type:"number",hideFromUI:!0,helperText:"Width %, e.g. set to 50 to fill half of the space"},{name:"link",type:"url",helperText:"Optionally set a url that clicking this column will link to"}],defaultValue:[{blocks:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]},{blocks:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]}],onChange:e=>{function t(){n.forEach(i=>{i.delete("width")})}const n=e.get("columns");Array.isArray(n)&&n.find(o=>o.get("width"))&&(n.find(r=>!r.get("width"))||n.reduce((s,l)=>s+l.get("width"),0)!==100)&&t()}},{name:"space",type:"number",defaultValue:20,helperText:"Size of gap between columns",advanced:!0},{name:"stackColumnsAt",type:"string",defaultValue:"tablet",helperText:"Convert horizontal columns to vertical at what device size",enum:["tablet","mobile","never"],advanced:!0},{name:"reverseColumnsWhenStacked",type:"boolean",defaultValue:!1,helperText:"When stacking columns for mobile devices, reverse the ordering",advanced:!0}]},et={name:"Custom Code",static:!0,requiredPermissions:["editCode"],inputs:[{name:"code",type:"html",required:!0,defaultValue:"<p>Hello there, I am custom HTML code!</p>",code:!0},{name:"replaceNodes",type:"boolean",helperText:"Preserve server rendered dom nodes",advanced:!0},{name:"scriptsClientOnly",type:"boolean",defaultValue:!1,helperText:"Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",advanced:!0}]};function tt(e){const t=m.useRef(null),[n,i]=m.useState(()=>[]),[o,r]=m.useState(()=>[]);return m.useEffect(()=>{var s;if(!((s=t.current)!=null&&s.getElementsByTagName)||typeof window=="undefined")return;const c=t.current.getElementsByTagName("script");for(let l=0;l<c.length;l++){const u=c[l];if(u.src){if(n.includes(u.src))continue;n.push(u.src);const f=document.createElement("script");f.async=!0,f.src=u.src,document.head.appendChild(f)}else if(!u.type||["text/javascript","application/javascript","application/ecmascript"].includes(u.type)){if(o.includes(u.innerText))continue;try{o.push(u.innerText),new Function(u.innerText)()}catch(f){console.warn("`CustomCode`: Error running script:",f)}}}},[]),a.jsx("div",{ref:t,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}const nt={name:"Embed",static:!0,inputs:[{name:"url",type:"url",required:!0,defaultValue:"",helperText:"e.g. enter a youtube url, google map, etc",onChange:e=>{const t=e.get("url");if(t)return e.set("content","Loading..."),fetch(`https://iframe.ly/api/iframely?url=${t}&api_key=ae0e60e78201a3f2b0de4b`).then(i=>i.json()).then(i=>{e.get("url")===t&&(i.html?e.set("content",i.html):e.set("content","Invalid url, please try another"))}).catch(i=>{e.set("content","There was an error embedding this URL, please try again or another URL")});e.delete("content")}},{name:"content",type:"html",defaultValue:'<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',hideFromUI:!0}]},it=["text/javascript","application/javascript","application/ecmascript"],at=e=>it.includes(e.type);function ot(e){const t=m.useRef(null),[n,i]=m.useState(()=>[]),[o,r]=m.useState(()=>[]),[c,s]=m.useState(()=>!1);function l(){if(!t.current||!t.current.getElementsByTagName)return;const u=t.current.getElementsByTagName("script");for(let f=0;f<u.length;f++){const x=u[f];if(x.src&&!n.includes(x.src)){n.push(x.src);const v=document.createElement("script");v.async=!0,v.src=x.src,document.head.appendChild(v)}else if(at(x)&&!o.includes(x.innerText))try{o.push(x.innerText),new Function(x.innerText)()}catch(v){console.warn("`Embed`: Error running script:",v)}}}return m.useEffect(()=>{t.current&&!c&&(s(!0),l())},[t.current,c]),a.jsx("div",{className:"builder-embed",ref:t,dangerouslySetInnerHTML:{__html:e.content}})}const rt={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},ct={name:"Image",static:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",defaultStyles:{position:"relative",minHeight:"20px",minWidth:"20px",overflow:"hidden"},canHaveChildren:!0,inputs:[{name:"image",type:"file",bubble:!0,allowedFileTypes:["jpeg","jpg","png","svg"],required:!0,defaultValue:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",onChange:e=>{e.delete("srcset"),e.delete("noWebp");function n(c,s=6e4){return new Promise((l,u)=>{const f=document.createElement("img");let x=!1;f.onload=()=>{x=!0,l(f)},f.addEventListener("error",v=>{console.warn("Image load failed",v.error),u(v.error)}),f.src=c,setTimeout(()=>{x||u(new Error("Image load timed out"))},s)})}function i(c){return Math.round(c*1e3)/1e3}const o=e.get("image"),r=e.get("aspectRatio");if(fetch(o).then(c=>c.blob()).then(c=>{c.type.includes("svg")&&e.set("noWebp",!0)}),o&&(!r||r===.7041))return n(o).then(c=>{const s=e.get("aspectRatio");e.get("image")===o&&(!s||s===.7041)&&c.width&&c.height&&(e.set("aspectRatio",i(c.height/c.width)),e.set("height",c.height),e.set("width",c.width))})}},{name:"backgroundSize",type:"text",defaultValue:"cover",enum:[{label:"contain",value:"contain",helperText:"The image should never get cropped"},{label:"cover",value:"cover",helperText:"The image should fill it's box, cropping when needed"}]},{name:"backgroundPosition",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"altText",type:"string",helperText:"Text to display when the user has images off"},{name:"height",type:"number",hideFromUI:!0},{name:"width",type:"number",hideFromUI:!0},{name:"sizes",type:"string",hideFromUI:!0},{name:"srcset",type:"string",hideFromUI:!0},{name:"lazy",type:"boolean",defaultValue:!0,hideFromUI:!0},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the image's aspect ratio",defaultValue:!0},{name:"aspectRatio",type:"number",helperText:"This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",advanced:!0,defaultValue:.7041}]},lt={name:"Raw:Img",hideFromInsertMenu:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",inputs:[{name:"image",bubble:!0,type:"file",allowedFileTypes:["jpeg","jpg","png","svg","gif","webp"],required:!0}],noWrap:!0,static:!0};function st(e){return a.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},d.isEditing()&&e.imgSrc||"default-key")}const dt={name:"Core:Section",static:!0,image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",inputs:[{name:"maxWidth",type:"number",defaultValue:1200},{name:"lazyLoad",type:"boolean",defaultValue:!1,advanced:!0,description:"Only render this section when in view"}],defaultStyles:{paddingLeft:"20px",paddingRight:"20px",paddingTop:"50px",paddingBottom:"50px",marginTop:"0px",width:"100vw",marginLeft:"calc(50% - 50vw)"},canHaveChildren:!0,defaultChildren:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{textAlign:"center"}},component:{name:"Text",options:{text:"<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"}}}]},ut={name:"Symbol",noWrap:!0,static:!0,isRSC:!0,inputs:[{name:"symbol",type:"uiSymbol"},{name:"dataOnly",helperText:"Make this a data symbol that doesn't display any UI",type:"boolean",defaultValue:!1,advanced:!0,hideFromUI:!0},{name:"inheritState",helperText:"Inherit the parent component state and data",type:"boolean",defaultValue:!1,advanced:!0},{name:"renderToLiquid",helperText:"Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",type:"boolean",defaultValue:!1,advanced:!0,hideFromUI:!0},{name:"useChildren",hideFromUI:!0,type:"boolean"}]},mt={name:"Text",static:!0,isRSC:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",inputs:[{name:"text",type:"html",required:!0,autoFocus:!0,bubble:!0,defaultValue:"Enter some text..."}],defaultStyles:{lineHeight:"normal",height:"auto",textAlign:"center"}};function ye(e){var t;return a.jsx("div",{className:"builder-text",dangerouslySetInnerHTML:{__html:((t=e.text)==null?void 0:t.toString())||""},style:{outline:"none"}})}const ft={name:"Video",canHaveChildren:!0,defaultStyles:{minHeight:"20px",minWidth:"20px"},image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",inputs:[{name:"video",type:"file",allowedFileTypes:["mp4"],bubble:!0,defaultValue:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",required:!0},{name:"posterImage",type:"file",allowedFileTypes:["jpeg","png"],helperText:"Image to show before the video plays"},{name:"autoPlay",type:"boolean",defaultValue:!0},{name:"controls",type:"boolean",defaultValue:!1},{name:"muted",type:"boolean",defaultValue:!0},{name:"loop",type:"boolean",defaultValue:!0},{name:"playsInline",type:"boolean",defaultValue:!0},{name:"fit",type:"text",defaultValue:"cover",enum:["contain","cover","fill","auto"]},{name:"preload",type:"text",defaultValue:"metadata",enum:["auto","metadata","none"]},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the aspect ratio",defaultValue:!0,advanced:!0},{name:"position",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"height",type:"number",advanced:!0},{name:"width",type:"number",advanced:!0},{name:"aspectRatio",type:"number",advanced:!0,defaultValue:.7004048582995948},{name:"lazyLoad",type:"boolean",helperText:'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',defaultValue:!0,advanced:!0}]};function ve(e){var i,o,r,c,s,l,u;function t(){return{...e.autoPlay===!0?{autoPlay:!0}:{},...e.muted===!0?{muted:!0}:{},...e.controls===!0?{controls:!0}:{},...e.loop===!0?{loop:!0}:{},...e.playsInline===!0?{playsInline:!0}:{}}}function n(){return{...t()}}return a.jsxs("div",{style:{position:"relative"},children:[a.jsx("video",{className:"builder-video",...n(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(i=e.attributes)==null?void 0:i.style,objectFit:e.fit,objectPosition:e.position,zIndex:2,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},src:e.video||"no-src",poster:e.posterImage,children:e.lazyLoad?null:a.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((r=(o=e.builderBlock)==null?void 0:o.children)!=null&&r.length))?a.jsx(a.Fragment,{children:a.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}})}):null,(s=(c=e.builderBlock)==null?void 0:c.children)!=null&&s.length&&e.fitContent?a.jsx(a.Fragment,{children:a.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children})}):null,(u=(l=e.builderBlock)==null?void 0:l.children)!=null&&u.length&&!e.fitContent?a.jsx(a.Fragment,{children:a.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children})}):null]})}const oe=()=>[{component:de,...Xe},{component:he,...Ze},{component:tt,...et},{component:ot,...nt},{component:be,...rt},{component:xe,...ct},{component:st,...lt},{component:Se,...dt},{component:we,...ut},{component:ye,...mt},{component:ve,...ft}],gt=`function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
62
62
|
function getAndSetVariantId() {
|
|
63
63
|
function setCookie(name, value, days) {
|
|
64
64
|
let expires = '';
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
}).join('');
|
|
115
115
|
styleEl.innerHTML = newStyleStr;
|
|
116
116
|
}
|
|
117
|
-
}`,
|
|
117
|
+
}`,ht=`function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {
|
|
118
118
|
if (!navigator.cookieEnabled) {
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
@@ -148,31 +148,31 @@
|
|
|
148
148
|
thisScriptEl?.remove();
|
|
149
149
|
}
|
|
150
150
|
return;
|
|
151
|
-
}`,
|
|
152
|
-
window.${
|
|
153
|
-
window.${ke} = ${
|
|
154
|
-
`,
|
|
155
|
-
window.${
|
|
151
|
+
}`,pe="builderIoAbTest",ke="builderIoRenderContent",V=e=>Object.values((e==null?void 0:e.variations)||{}).map(t=>({...t,testVariationId:t.id,id:e==null?void 0:e.id})),bt=({canTrack:e,content:t})=>!(!(V(t).length>0)||!e||d.isBrowser()),xt=e=>e==="react"||e==="reactNative",Ce=xt(d.TARGET),St=()=>`
|
|
152
|
+
window.${pe} = ${gt}
|
|
153
|
+
window.${ke} = ${ht}
|
|
154
|
+
`,yt=(e,t)=>`
|
|
155
|
+
window.${pe}(
|
|
156
156
|
"${t}",${JSON.stringify(e)}, ${Ce}
|
|
157
|
-
)`,
|
|
157
|
+
)`,vt=({contentId:e,variationId:t})=>`window.${ke}(
|
|
158
158
|
"${t}", "${e}", ${Ce}
|
|
159
|
-
)`;function z(e){return a.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id||""})}function re(e){return Math.round(e*1e3)/1e3}const pt=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let i=n?e:e.parentElement;do{if(!i)return null;if(t(i))return i}while(i=i.parentElement);return null},
|
|
159
|
+
)`;function z(e){return a.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id||""})}function re(e){return Math.round(e*1e3)/1e3}const pt=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let i=n?e:e.parentElement;do{if(!i)return null;if(t(i))return i}while(i=i.parentElement);return null},kt=e=>pt(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),ce=({event:e,target:t})=>{const n=t.getBoundingClientRect(),i=e.clientX-n.left,o=e.clientY-n.top,r=re(i/n.width),c=re(o/n.height);return{x:r,y:c}},Ct=e=>{const t=e.target,n=t&&kt(t),i=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:i||void 0,metadata:{targetOffset:t?ce({event:e,target:t}):void 0,builderTargetOffset:n?ce({event:e,target:n}):void 0,builderElementIndex:n&&i?[].slice.call(document.getElementsByClassName(i)).indexOf(n):void 0}}},wt="0.11.4",It=()=>{d.register("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let le=!1;const Et=(e={})=>{var t,n;le||(le=!0,d.isBrowser()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:d.TARGET,version:wt,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",({data:i})=>{var o,r;if(i!=null&&i.type)switch(i.type){case"builder.evaluate":{const c=i.data.text,s=i.data.arguments||[],l=i.data.id,u=new Function(c);let f,x=null;try{f=u.apply(null,s)}catch(v){x=v}x?(o=window.parent)==null||o.postMessage({type:"builder.evaluateError",data:{id:l,error:x.message}},"*"):f&&typeof f.then=="function"?f.then(v=>{var y;(y=window.parent)==null||y.postMessage({type:"builder.evaluateResult",data:{id:l,result:v}},"*")}).catch(console.error):(r=window.parent)==null||r.postMessage({type:"builder.evaluateResult",data:{result:f,id:l}},"*");break}}})))};function Tt(e){var F,D,Y,Q,J,X,Z;const t=m.useRef(null),[n,i]=m.useState(()=>0);m.useState(()=>!0);function o(g){var b,S;const h={...e.builderContextSignal.rootState,...g};e.builderContextSignal.rootSetState?(S=(b=e.builderContextSignal).rootSetState)==null||S.call(b,h):e.setBuilderContextSignal(p=>({...p,rootState:h}))}function r(g){var b,S,p,E,A;const h={...e.builderContextSignal.content,...g,data:{...(b=e.builderContextSignal.content)==null?void 0:b.data,...g==null?void 0:g.data},meta:{...(S=e.builderContextSignal.content)==null?void 0:S.meta,...g==null?void 0:g.meta,breakpoints:((p=g==null?void 0:g.meta)==null?void 0:p.breakpoints)||((A=(E=e.builderContextSignal.content)==null?void 0:E.meta)==null?void 0:A.breakpoints)}};e.setBuilderContextSignal(Ie=>({...Ie,content:h}))}m.useState(()=>0);const[c,s]=m.useState(()=>!1),[l,u]=m.useState(()=>e.contentWrapper||"div");function f(g){var b;const{data:h}=g;if(h)switch(h.type){case"builder.configureSdk":{const S=h.data,{breakpoints:p,contentId:E}=S;if(!E||E!==((b=e.builderContextSignal.content)==null?void 0:b.id))return;p&&r({meta:{breakpoints:p}}),i(n+1);break}case"builder.contentUpdate":{const S=h.data,p=S.key||S.alias||S.entry||S.modelName,E=S.data;p===e.model&&(r(E),i(n+1));break}}}function x(){var h,b;const g=(b=(h=e.builderContextSignal.content)==null?void 0:h.data)==null?void 0:b.jsCode;g&&W({code:g,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})}const[v,y]=m.useState(()=>({})),[C,k]=m.useState(()=>!1);function T(g){var h,b;if(e.builderContextSignal.content){const S=(h=e.builderContextSignal.content)==null?void 0:h.testVariationId,p=(b=e.builderContextSignal.content)==null?void 0:b.id;d._track({type:"click",canTrack:d.getDefaultCanTrack(e.canTrack),contentId:p,apiKey:e.apiKey,variationId:S!==p?S:void 0,...Ct(g),unique:!C})}C||k(!0)}function R(g){return g.replace(/{{([^}]+)}}/g,(h,b)=>W({code:b,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))}function w({url:g,key:h}){d.fetch(g).then(b=>b.json()).then(b=>{var p,E;const S={...e.builderContextSignal.rootState,[h]:b};(E=(p=e.builderContextSignal).rootSetState)==null||E.call(p,S),v[h]=!0}).catch(b=>{console.error("error fetching dynamic data",g,b)})}function I(){var h,b,S;const g=(S=(b=(h=e.builderContextSignal.content)==null?void 0:h.data)==null?void 0:b.httpRequests)!=null?S:{};Object.entries(g).forEach(([p,E])=>{if(E&&(!v[p]||d.isEditing())){const A=R(E);w({url:A,key:p})}})}function j(){d.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:d.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function P(g){i(n+1),window.addEventListener("message",f),It(),Et({...e.locale?{locale:e.locale}:{},...e.includeRefs?{includeRefs:e.includeRefs}:{},...e.enrich?{enrich:e.enrich}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(h=>{var S;const b=d.createRegisterComponentMessage(h);(S=window.parent)==null||S.postMessage(b,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",j)}function B(g){const h=new URL(location.href).searchParams,b=h.get("builder.preview"),S=h.get(`builder.preview.${b}`),p=h.get("apiKey")||h.get("builder.space");b===e.model&&p===e.apiKey&&(!e.content||S===e.content.id)&&d.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(E=>{E&&r(E)})}return m.useEffect(()=>{var g;return(g=t.current)==null||g.addEventListener("initeditingbldr",P),()=>{var h;return(h=t.current)==null?void 0:h.removeEventListener("initeditingbldr",P)}},[]),m.useEffect(()=>{var g;return(g=t.current)==null||g.addEventListener("initpreviewingbldr",B),()=>{var h;return(h=t.current)==null?void 0:h.removeEventListener("initpreviewingbldr",B)}},[]),m.useEffect(()=>{var g,h;if(d.isBrowser()){if(d.isEditing()&&t.current&&t.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&d.getDefaultCanTrack(e.canTrack)){const S=(g=e.builderContextSignal.content)==null?void 0:g.testVariationId,p=(h=e.builderContextSignal.content)==null?void 0:h.id,E=e.apiKey;d._track({type:"impression",canTrack:!0,contentId:p,apiKey:E,variationId:S!==p?S:void 0})}d.isPreviewing()&&t.current&&t.current.dispatchEvent(new CustomEvent("initpreviewingbldr"))}},[]),m.useEffect(()=>{e.apiKey||d.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),x(),I(),j()},[]),m.useEffect(()=>{e.content&&r(e.content)},[e.content]),m.useEffect(()=>{},[c]),m.useEffect(()=>{x()},[(D=(F=e.builderContextSignal.content)==null?void 0:F.data)==null?void 0:D.jsCode,e.builderContextSignal.rootState]),m.useEffect(()=>{I()},[(Q=(Y=e.builderContextSignal.content)==null?void 0:Y.data)==null?void 0:Q.httpRequests]),m.useEffect(()=>{j()},[e.builderContextSignal.rootState]),m.useEffect(()=>{e.data&&o(e.data)},[e.data]),m.useEffect(()=>{e.locale&&o({locale:e.locale})},[e.locale]),m.useEffect(()=>()=>{d.isBrowser()&&(window.removeEventListener("message",f),window.removeEventListener("builder:component:stateChangeListenerActivated",j))},[]),a.jsx(q.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?a.jsx(a.Fragment,{children:m.createElement(l,{key:n,ref:t,onClick:g=>T(g),"builder-content-id":(J=e.builderContextSignal.content)==null?void 0:J.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},...e.contentWrapperProps,className:`variant-${((X=e.content)==null?void 0:X.testVariationId)||((Z=e.content)==null?void 0:Z.id)}`},e.children)}):null})}const Rt=e=>{var r,c;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],i=(c=e.fileUrl)!=null?c:(r=e==null?void 0:e.files)==null?void 0:r.regular;let o="";if(i&&t&&n&&(o+=`
|
|
160
160
|
@font-face {
|
|
161
161
|
font-family: "${t}";
|
|
162
162
|
src: local("${n}"), url('${i}') format('woff2');
|
|
163
163
|
font-display: fallback;
|
|
164
164
|
font-weight: 400;
|
|
165
165
|
}
|
|
166
|
-
`.trim()),e.files)for(const
|
|
166
|
+
`.trim()),e.files)for(const s in e.files){if(!(String(Number(s))===s))continue;const u=e.files[s];u&&u!==i&&(o+=`
|
|
167
167
|
@font-face {
|
|
168
168
|
font-family: "${t}";
|
|
169
169
|
src: url('${u}') format('woff2');
|
|
170
170
|
font-display: fallback;
|
|
171
|
-
font-weight: ${
|
|
171
|
+
font-weight: ${s};
|
|
172
172
|
}
|
|
173
|
-
`.trim())}return o},
|
|
174
|
-
${
|
|
175
|
-
${
|
|
173
|
+
`.trim())}return o},jt=({customFonts:e})=>{var t;return((t=e==null?void 0:e.map(n=>Rt(n)))==null?void 0:t.join(" "))||""},Pt=({cssCode:e,contentId:t})=>e?t?(e==null?void 0:e.replace(/&/g,`div[builder-content-id="${t}"]`))||"":e:"";function Bt(e){const[t,n]=m.useState(()=>`
|
|
174
|
+
${Pt({cssCode:e.cssCode,contentId:e.contentId})}
|
|
175
|
+
${jt({customFonts:e.customFonts})}
|
|
176
176
|
|
|
177
177
|
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
178
178
|
margin: 0;
|
|
@@ -186,4 +186,4 @@ ${Rt({customFonts:e.customFonts})}
|
|
|
186
186
|
text-align: inherit;
|
|
187
187
|
font-family: inherit;
|
|
188
188
|
}
|
|
189
|
-
`.trim());return a.jsx(_,{styles:t})}const
|
|
189
|
+
`.trim());return a.jsx(_,{styles:t})}const Ft=({content:e,data:t,locale:n})=>{var r,c,s;const i={},o=((r=e==null?void 0:e.data)==null?void 0:r.state)||{};return(s=(c=e==null?void 0:e.data)==null?void 0:c.inputs)==null||s.forEach(l=>{l.name&&l.defaultValue!==void 0&&(i[l.name]=l.defaultValue)}),{...i,...o,...t,...n?{locale:n}:{}}},Wt=({content:e,data:t})=>e?{...e,data:{...e==null?void 0:e.data,...t},meta:e==null?void 0:e.meta}:void 0;function se(e){var l,u,f,x,v,y,C;const[t,n]=m.useState(()=>{var k,T;return vt({variationId:(k=e.content)==null?void 0:k.testVariationId,contentId:(T=e.content)==null?void 0:T.id})});function i(k){s(T=>({...T,rootState:k}))}const[o,r]=m.useState(()=>[...oe(),...d.components,...e.customComponents||[]].reduce((k,{component:T,...R})=>({...k,[R.name]:{component:T,...d.serializeComponentInfo(R)}}),{})),[c,s]=m.useState(()=>({content:Wt({content:e.content,data:e.data}),localState:void 0,rootState:Ft({content:e.content,data:e.data,locale:e.locale}),rootSetState:i,context:e.context||{},apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...oe(),...d.components,...e.customComponents||[]].reduce((k,{component:T,...R})=>({...k,[R.name]:d.serializeComponentInfo(R)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{}}));return a.jsx(ue.Provider,{value:{registeredComponents:o},children:a.jsxs(Tt,{content:e.content,data:e.data,model:e.model,context:e.context,apiKey:e.apiKey,canTrack:e.canTrack,locale:e.locale,includeRefs:e.includeRefs,enrich:e.enrich,showContent:e.showContent,builderContextSignal:c,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,setBuilderContextSignal:s,children:[e.isSsrAbTest?a.jsx(a.Fragment,{children:a.jsx(z,{scriptStr:t})}):null,a.jsx(a.Fragment,{children:a.jsx(Bt,{contentId:(l=c.content)==null?void 0:l.id,cssCode:(f=(u=c.content)==null?void 0:u.data)==null?void 0:f.cssCode,customFonts:(v=(x=c.content)==null?void 0:x.data)==null?void 0:v.customFonts})}),a.jsx(L,{blocks:(C=(y=c.content)==null?void 0:y.data)==null?void 0:C.blocks,context:c,registeredComponents:o})]})})}function G(e){var c,s;const[t,n]=m.useState(()=>bt({canTrack:d.getDefaultCanTrack(e.canTrack),content:e.content}));function i(){var l;return yt(V(e.content).map(u=>({id:u.testVariationId,testRatio:u.testRatio})),((l=e.content)==null?void 0:l.id)||"")}function o(){return V(e.content).map(l=>`.variant-${l.testVariationId} { display: none; } `).join("")}function r(){var l;return t?{...e.content,testVariationId:(l=e.content)==null?void 0:l.id}:d.handleABTestingSync({item:e.content,canTrack:d.getDefaultCanTrack(e.canTrack)})}return m.useEffect(()=>{},[]),a.jsxs(a.Fragment,{children:[!e.__isNestedRender&&d.TARGET!=="reactNative"?a.jsx(a.Fragment,{children:a.jsx(z,{scriptStr:St()})}):null,t?a.jsxs(a.Fragment,{children:[a.jsx(_,{id:`variants-styles-${(c=e.content)==null?void 0:c.id}`,styles:o()}),a.jsx(z,{scriptStr:i()}),(s=V(e.content))==null?void 0:s.map(l=>a.jsx(se,{content:l,showContent:!1,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,canTrack:e.canTrack,locale:e.locale,includeRefs:e.includeRefs,enrich:e.enrich,isSsrAbTest:t,blocksWrapper:e.blocksWrapper,blocksWrapperProps:e.blocksWrapperProps,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps},l.testVariationId))]}):null,a.jsx(se,{content:r(),showContent:!0,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,canTrack:e.canTrack,locale:e.locale,includeRefs:e.includeRefs,enrich:e.enrich,isSsrAbTest:t,blocksWrapper:e.blocksWrapper,blocksWrapperProps:e.blocksWrapperProps,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps})]})}const At=async({builderContextValue:e,symbol:t})=>{if(t!=null&&t.model&&(e!=null&&e.apiKey))return d.fetchOneEntry({model:t.model,apiKey:e.apiKey,apiVersion:e.apiVersion,...(t==null?void 0:t.entry)&&{query:{id:t.entry}}}).catch(n=>{d.logger.error("Could not fetch symbol content: ",n)})};function we(e){var r,c,s;function t(){var l,u;return[e.attributes.className,"builder-symbol",(l=e.symbol)!=null&&l.inline?"builder-inline-symbol":void 0,(u=e.symbol)!=null&&u.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")}const[n,i]=m.useState(()=>{var l;return(l=e.symbol)==null?void 0:l.content});function o(){n||At({symbol:e.symbol,builderContextValue:e.builderContext}).then(l=>{l&&i(l)})}return m.useEffect(()=>{},[]),m.useEffect(()=>{o()},[e.symbol]),a.jsx("div",{...e.attributes,className:t(),children:a.jsx(G,{__isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:e.builderContext.context,customComponents:Object.values(e.builderComponents),data:{...(r=e.symbol)==null?void 0:r.data,...e.builderContext.localState,...(c=n==null?void 0:n.data)==null?void 0:c.state},model:(s=e.symbol)==null?void 0:s.model,content:n})})}const Vt=L,$t=G;exports._processContentResult=d._processContentResult;exports.createRegisterComponentMessage=d.createRegisterComponentMessage;exports.fetchBuilderProps=d.fetchBuilderProps;exports.fetchEntries=d.fetchEntries;exports.fetchOneEntry=d.fetchOneEntry;exports.getAllContent=d.getAllContent;exports.getBuilderSearchParams=d.getBuilderSearchParams;exports.getContent=d.getContent;exports.isEditing=d.isEditing;exports.isPreviewing=d.isPreviewing;exports.register=d.register;exports.setEditorSettings=d.setEditorSettings;exports.track=d.track;exports.Blocks=L;exports.Button=de;exports.Columns=he;exports.Content=G;exports.Fragment=be;exports.Image=xe;exports.RenderBlocks=Vt;exports.RenderContent=$t;exports.Section=Se;exports.Symbol=we;exports.Text=ye;exports.Video=ve;
|