@builder.io/sdk-react-nextjs 0.12.1 → 0.12.3

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.
Files changed (48) hide show
  1. package/lib/browser/USE_CLIENT_BUNDLE-64b6ec10.cjs +21 -0
  2. package/lib/browser/USE_CLIENT_BUNDLE-e89d3175.js +713 -0
  3. package/lib/{edge/USE_SERVER_BUNDLE-231b55dd.js → browser/USE_SERVER_BUNDLE-d6bec4ec.js} +1 -1
  4. package/lib/{edge/USE_SERVER_BUNDLE-24df6623.cjs → browser/USE_SERVER_BUNDLE-f34c0814.cjs} +1 -1
  5. package/lib/browser/bundle-50ff23eb.cjs +172 -0
  6. package/lib/browser/{bundle-7e2a44d9.js → bundle-f3e8cd29.js} +576 -573
  7. package/lib/browser/index.cjs +1 -1
  8. package/lib/browser/index.mjs +17 -17
  9. package/lib/edge/USE_CLIENT_BUNDLE-2aed408a.cjs +21 -0
  10. package/lib/edge/USE_CLIENT_BUNDLE-a3258a60.js +713 -0
  11. package/lib/{node/USE_SERVER_BUNDLE-33c309df.js → edge/USE_SERVER_BUNDLE-4e9af8f5.js} +1 -1
  12. package/lib/{node/USE_SERVER_BUNDLE-93366161.cjs → edge/USE_SERVER_BUNDLE-e79e6b55.cjs} +1 -1
  13. package/lib/edge/{bundle-44392f6d.js → bundle-cb191300.js} +811 -808
  14. package/lib/edge/{bundle-6d55a6a7.cjs → bundle-d4f509a3.cjs} +37 -33
  15. package/lib/edge/index.cjs +1 -1
  16. package/lib/edge/index.mjs +17 -17
  17. package/lib/node/USE_CLIENT_BUNDLE-98a4fbf4.js +713 -0
  18. package/lib/node/USE_CLIENT_BUNDLE-990b655a.cjs +21 -0
  19. package/lib/{browser/USE_SERVER_BUNDLE-153f7d4b.js → node/USE_SERVER_BUNDLE-b231d861.js} +1 -1
  20. package/lib/{browser/USE_SERVER_BUNDLE-a0bf6d8f.cjs → node/USE_SERVER_BUNDLE-c86a1fb8.cjs} +1 -1
  21. package/lib/node/{bundle-217b5738.js → bundle-11daeaca.js} +166 -163
  22. package/lib/node/{bundle-b9af39ec.cjs → bundle-b2d68b60.cjs} +11 -7
  23. package/lib/node/index.cjs +1 -1
  24. package/lib/node/index.mjs +17 -17
  25. package/package.json +1 -1
  26. package/types/cjs/components/block/block.helpers.d.ts +0 -1
  27. package/types/cjs/components/block/components/block-wrapper.d.ts +2 -6
  28. package/types/cjs/components/content-variants/content-variants.types.d.ts +4 -0
  29. package/types/cjs/components/dynamic-renderer/dynamic-renderer.d.ts +8 -0
  30. package/types/cjs/components/dynamic-renderer/dynamic-renderer.helpers.d.ts +1 -0
  31. package/types/cjs/constants/sdk-version.d.ts +1 -1
  32. package/types/cjs/functions/is-from-trusted-host.d.ts +3 -0
  33. package/types/cjs/scripts/init-editing.d.ts +1 -0
  34. package/types/esm/components/block/block.helpers.d.ts +0 -1
  35. package/types/esm/components/block/components/block-wrapper.d.ts +2 -6
  36. package/types/esm/components/content-variants/content-variants.types.d.ts +4 -0
  37. package/types/esm/components/dynamic-renderer/dynamic-renderer.d.ts +8 -0
  38. package/types/esm/components/dynamic-renderer/dynamic-renderer.helpers.d.ts +1 -0
  39. package/types/esm/constants/sdk-version.d.ts +1 -1
  40. package/types/esm/functions/is-from-trusted-host.d.ts +3 -0
  41. package/types/esm/scripts/init-editing.d.ts +1 -0
  42. package/lib/browser/USE_CLIENT_BUNDLE-5457b97e.cjs +0 -23
  43. package/lib/browser/USE_CLIENT_BUNDLE-ac9ba054.js +0 -732
  44. package/lib/browser/bundle-6435b7fb.cjs +0 -168
  45. package/lib/edge/USE_CLIENT_BUNDLE-3049fd56.js +0 -732
  46. package/lib/edge/USE_CLIENT_BUNDLE-8922846d.cjs +0 -23
  47. package/lib/node/USE_CLIENT_BUNDLE-09122ff1.cjs +0 -23
  48. package/lib/node/USE_CLIENT_BUNDLE-f4804af3.js +0 -732
@@ -1,168 +0,0 @@
1
- "use strict";const Oe=require("lru-cache"),s=require("react/jsx-runtime"),Ne=require("react"),S=require("./USE_CLIENT_BUNDLE-5457b97e.cjs");require("next/navigation");function _e(e){var t;return{...(t=e.component)==null?void 0:t.options,...e.options,builderBlock:e}}const B="[Builder.io]: ",k={log:(...e)=>console.log(B,...e),error:(...e)=>console.error(B,...e),warn:(...e)=>console.warn(B,...e),debug:(...e)=>console.debug(B,...e)};function x(){return typeof window<"u"&&typeof document<"u"}const I="rsc";function Le(){return x()&&window.self!==window.top}function F(){return Le()&&window.location.search.indexOf("builder.frameEditing=")!==-1}const Ue=()=>{if(x()){const e=new URL(location.href);return e.pathname===""&&(e.pathname="/"),e}else return console.warn("Cannot get location for tracking in non-browser environment"),null},Me=()=>typeof navigator=="object"&&navigator.userAgent||"",de=()=>{const e=Me(),t={Android(){return e.match(/Android/i)},BlackBerry(){return e.match(/BlackBerry/i)},iOS(){return e.match(/iPhone|iPod/i)},Opera(){return e.match(/Opera Mini/i)},Windows(){return e.match(/IEMobile/i)||e.match(/WPDesktop/i)},any(){return t.Android()||t.BlackBerry()||t.iOS()||t.Opera()||t.Windows()||I==="reactNative"}},n=e.match(/Tablet|iPad/i),o=Ue();return{urlPath:o==null?void 0:o.pathname,host:(o==null?void 0:o.host)||(o==null?void 0:o.hostname),device:n?"tablet":t.any()?"mobile":"desktop"}},De=({builder:e,context:t,event:n,state:o})=>Object.entries({state:o,Builder:e,builder:e,context:t,event:n}),Ke=()=>({isEditing:F(),isBrowser:x(),isServer:!x(),getUserAttributes:()=>de()}),He=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,Y=({code:e,builder:t,context:n,event:o,localState:i,rootSetState:r,rootState:a})=>{const c=De({builder:t,context:n,event:o,state:ze(a,i,r)});return new Function(...c.map(([l])=>l),e)(...c.map(([,l])=>l))};function ze(e,t,n){if(e===t)throw new Error("rootState === localState");return new Proxy(e,{get:(o,i)=>t&&i in t?t[i]:e[i],set:(o,i,r)=>{if(t&&i in t)throw new Error("Writing to local state is not allowed as it is read-only.");return e[i]=r,n==null||n(e),!0}})}const qe=e=>(x(),Y(e));function O({code:e,context:t,localState:n,rootState:o,rootSetState:i,event:r,isExpression:a=!0}){if(e===""){k.warn("Skipping evaluation of empty code block.");return}const c={code:He(e,{isExpression:a}),builder:Ke(),context:t,event:r,rootSetState:i,rootState:o,localState:n};try{return qe(c)}catch(l){k.error("Failed code evaluation: "+l.message,{code:e});return}}const R=e=>JSON.parse(JSON.stringify(e)),Ge=(e,t,n)=>{if(Object(e)!==e)return e;const o=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return o.slice(0,-1).reduce((i,r,a)=>Object(i[r])===i[r]?i[r]:i[r]=Math.abs(Number(o[a+1]))>>0===+o[a+1]?[]:{},e)[o[o.length-1]]=n,e};const Je=({block:e,context:t,localState:n,rootState:o,rootSetState:i})=>{if(!e.bindings)return e;const r=R(e),a={...r,properties:{...r.properties},actions:{...r.actions}};for(const c in e.bindings){const l=e.bindings[c],u=O({code:l,localState:n,rootState:o,rootSetState:i,context:t});Ge(a,c,u)}return a};function W({block:e,context:t,shouldEvaluateBindings:n,localState:o,rootState:i,rootSetState:r}){const a=e;return n?Je({block:a,localState:o,rootState:i,rootSetState:r,context:t}):a}const Ye=["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],U=e=>typeof e=="string"&&Ye.includes(e.toLowerCase()),Qe=({block:e,context:t,registeredComponents:n})=>{var r;const o=(r=W({block:e,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context,shouldEvaluateBindings:!1}).component)==null?void 0:r.name;if(!o)return null;const i=n[o];if(i)return i;console.warn(`
2
- Could not find a registered component named "${o}".
3
- If you registered it, is the file that registered it imported by the file that needs to render it?`)},Xe=({block:e,context:t})=>{const{repeat:n,...o}=e;if(!(n!=null&&n.collection))return;const i=O({code:n.collection,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context});if(!Array.isArray(i))return;const r=n.collection.split(".").pop(),a=n.itemName||(r?r+"Item":"item");return i.map((l,u)=>({context:{...t,localState:{...t.localState,$index:u,$item:l,[a]:l,[`$${a}Index`]:u}},block:o}))},ue={small:{min:320,default:321,max:640},medium:{min:641,default:642,max:991},large:{min:990,default:991,max:1200}},Q=(e,t=ue)=>`@media (max-width: ${t[e].max}px)`,me=({small:e,medium:t})=>{const n=R(ue);if(!e||!t)return n;const o=Math.floor(e/2);n.small={max:e,min:o,default:o+1};const i=n.small.max+1;n.medium={max:t,min:i,default:i+1};const r=n.medium.max+1;return n.large={max:2e3,min:r,default:r+1},n},Ze=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),w=e=>e!=null,fe=e=>Object.entries(e).map(([n,o])=>{if(typeof o=="string")return`${Ze(n)}: ${o};`}).filter(w),et=e=>fe(e).join(`
4
- `),M=({mediaQuery:e,className:t,styles:n})=>{const o=`.${t} {
5
- ${et(n)}
6
- }`;return e?`${e} {
7
- ${o}
8
- }`:o};function N(e){return s.jsx("style",{dangerouslySetInnerHTML:{__html:e.styles},id:e.id})}function tt(e){const t=function(){const i=W({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0});return w(i.hide)?!i.hide:w(i.show)?i.show:!0},n=function(){var d;const i=W({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0}),r=i.responsiveStyles,a=e.context.content,c=me(((d=a==null?void 0:a.meta)==null?void 0:d.breakpoints)||{}),l=r==null?void 0:r.large,u=r==null?void 0:r.medium,m=r==null?void 0:r.small,p=i.id;if(!p)return"";const f=l?M({className:p,styles:l}):"",h=u?M({className:p,styles:u,mediaQuery:Q("medium",c)}):"",g=m?M({className:p,styles:m,mediaQuery:Q("small",c)}):"";return[f,h,g].join(" ")};return s.jsx(s.Fragment,{children:n()&&t()?s.jsx(s.Fragment,{children:s.jsx(N,{styles:n()})}):null})}function nt(e){return e.charAt(0).toUpperCase()+e.slice(1)}const ot=e=>`on${nt(e)}`,it=(e,t)=>n=>O({code:e,context:t.context,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,event:n,isExpression:!1});function rt(e){const t={},n=e.block.actions??{};for(const o in n){if(!n.hasOwnProperty(o))continue;const i=n[o];let r=ot(o);if(e.stripPrefix)switch(I){case"vue":r=r.replace("v-on:","");break;case"svelte":r=r.replace("on:","");break}t[r]=it(i,e)}return t}function at({properties:e}){return e.className=e.class,delete e.class,e}const st=e=>({href:e.href});function he({block:e,context:t}){var o;const n={...st(e),...e.properties,"builder-id":e.id,style:e.style?ct(e.style):void 0,class:[e.id,"builder-block",e.class,(o=e.properties)==null?void 0:o.class].filter(Boolean).join(" ")};return at({properties:n,context:t,block:e})}function ct(e){switch(I){case"svelte":case"vue":case"solid":return fe(e).join(" ");case"qwik":case"reactNative":case"react":case"rsc":return e}}const lt=({componentOptions:e,builderBlock:t,context:n,componentRef:o,includeBlockProps:i,isInteractive:r,contextValue:a})=>{const c={...e,...i?{attributes:he({block:t,context:a})}:{}};return r?{Wrapper:o,block:t,context:n,wrapperProps:e,includeBlockProps:i}:c};function X(e){var n;const t=e.isInteractive?S.InteractiveElement:e.componentRef;return s.jsx(s.Fragment,{children:e.componentRef?s.jsx(s.Fragment,{children:s.jsx(t,{...lt({componentOptions:e.componentOptions,builderBlock:e.builderBlock,context:e.context,componentRef:e.componentRef,includeBlockProps:e.includeBlockProps,isInteractive:e.isInteractive,contextValue:e.context}),children:(n=e.blockChildren)==null?void 0:n.map(o=>s.jsx(_,{block:o,context:e.context,registeredComponents:e.registeredComponents},o.id))})}):null})}function dt(e){const t=e.repeatContext;return s.jsx(_,{block:e.block,context:t,registeredComponents:e.registeredComponents})}function _(e){var u,m,p;const t=function(){return Qe({block:e.block,context:e.context,registeredComponents:e.registeredComponents})},n=function(){return Xe({block:e.block,context:e.context})},o=function(){var h;return(h=e.block.repeat)!=null&&h.collection?e.block:W({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0})},i=function(){return e.block.tagName||"div"},r=function(){var d,b;if((d=e.block.repeat)!=null&&d.collection)return!!((b=n())!=null&&b.length);const h="hide"in o()?o().hide:!1;return("show"in o()?o().show:!0)&&!h},a=function(){var g;return!((g=t())!=null&&g.component)&&!n()?o().children??[]:[]},c=function(){var h,g,d,b,v;return{blockChildren:o().children??[],componentRef:(h=t())==null?void 0:h.component,componentOptions:{..._e(o()),builderContext:e.context,...((g=t())==null?void 0:g.name)==="Symbol"||((d=t())==null?void 0:d.name)==="Columns"?{builderComponents:e.registeredComponents}:{}},context:l,registeredComponents:e.registeredComponents,builderBlock:o(),includeBlockProps:((b=t())==null?void 0:b.noWrap)===!0,isInteractive:!((v=t())!=null&&v.isRSC)}},l=e.context;return s.jsx(s.Fragment,{children:r()?s.jsxs(s.Fragment,{children:[s.jsx(tt,{block:e.block,context:e.context}),(u=t())!=null&&u.noWrap?s.jsx(s.Fragment,{children:s.jsx(X,{componentRef:c().componentRef,componentOptions:c().componentOptions,blockChildren:c().blockChildren,context:c().context,registeredComponents:c().registeredComponents,builderBlock:c().builderBlock,includeBlockProps:c().includeBlockProps,isInteractive:c().isInteractive})}):s.jsxs(s.Fragment,{children:[U(i())?s.jsx(s.Fragment,{children:s.jsx(S.BlockWrapper,{Wrapper:i(),block:o(),context:e.context,hasChildren:!1})}):null,!U(i())&&n()?s.jsx(s.Fragment,{children:(m=n())==null?void 0:m.map((f,h)=>s.jsx(dt,{repeatContext:f.context,block:f.block,registeredComponents:e.registeredComponents},h))}):null,!U(i())&&!n()?s.jsx(s.Fragment,{children:s.jsxs(S.BlockWrapper,{Wrapper:i(),block:o(),context:e.context,hasChildren:!0,children:[s.jsx(X,{componentRef:c().componentRef,componentOptions:c().componentOptions,blockChildren:c().blockChildren,context:c().context,registeredComponents:c().registeredComponents,builderBlock:c().builderBlock,includeBlockProps:c().includeBlockProps,isInteractive:c().isInteractive}),(p=a())==null?void 0:p.map(f=>s.jsx(_,{block:f,context:l,registeredComponents:e.registeredComponents},f.id))]})}):null]})]}):null})}function P(e){var t,n,o;return s.jsx(S.BlocksWrapper,{blocks:e.blocks,parent:e.parent,path:e.path,styleProp:e.styleProp,BlocksWrapper:(t=e.context)==null?void 0:t.BlocksWrapper,BlocksWrapperProps:(n=e.context)==null?void 0:n.BlocksWrapperProps,children:e.blocks?s.jsx(s.Fragment,{children:(o=e.blocks)==null?void 0:o.map(i=>s.jsx(_,{block:i,context:e.context,registeredComponents:e.registeredComponents},i.id))}):null})}function ge(e){var h;const t=typeof e.space=="number"?e.space||0:20,n=e.columns||[],o=e.stackColumnsAt||"tablet",i=function(d){var b;return((b=n[d])==null?void 0:b.width)||100/n.length},r=function(d){const b=t*(n.length-1)/n.length;return`calc(${i(d)}% - ${b}px)`},a=function({stackedStyle:d,desktopStyle:b}){return o==="tablet"?d:b},c=function({stackedStyle:d,desktopStyle:b}){return o==="never"?b:d},l=e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column",u=function(){return{"--flex-dir":l,"--flex-dir-tablet":a({stackedStyle:l,desktopStyle:"row"})}},m=function(d){const b=d===0?0:t,v=r(d),y=`${b}px`,A="100%",E=0;return{width:v,["marginLeft"]:y,"--column-width-mobile":c({stackedStyle:A,desktopStyle:v}),"--column-margin-left-mobile":c({stackedStyle:E,desktopStyle:y}),"--column-width-tablet":a({stackedStyle:A,desktopStyle:v}),"--column-margin-left-tablet":a({stackedStyle:E,desktopStyle:y})}},p=function(d){var v,y;return me(((y=(v=e.builderContext.content)==null?void 0:v.meta)==null?void 0:y.breakpoints)||{})[d].max},f=function(){return`
9
- @media (max-width: ${p("medium")}px) {
10
- .${e.builderBlock.id}-breakpoints {
11
- flex-direction: var(--flex-dir-tablet);
12
- align-items: stretch;
13
- }
14
-
15
- .${e.builderBlock.id}-breakpoints > .builder-column {
16
- width: var(--column-width-tablet) !important;
17
- margin-left: var(--column-margin-left-tablet) !important;
18
- }
19
- }
20
-
21
- @media (max-width: ${p("small")}px) {
22
- .${e.builderBlock.id}-breakpoints {
23
- flex-direction: var(--flex-dir);
24
- align-items: stretch;
25
- }
26
-
27
- .${e.builderBlock.id}-breakpoints > .builder-column {
28
- width: var(--column-width-mobile) !important;
29
- margin-left: var(--column-margin-left-mobile) !important;
30
- }
31
- },
32
- `};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:`builder-columns ${e.builderBlock.id}-breakpoints div-39daef82`,style:u(),children:[s.jsx(s.Fragment,{children:s.jsx(N,{styles:f()})}),(h=e.columns)==null?void 0:h.map((g,d)=>Ne.createElement("div",{className:"builder-column div-39daef82-2",style:m(d),key:d},s.jsx(P,{path:`component.options.columns.${d}.blocks`,parent:e.builderBlock.id,styleProp:{flexGrow:"1"},context:e.builderContext,registeredComponents:e.builderComponents,blocks:g.blocks})))]}),s.jsx("style",{children:`.div-39daef82 {
33
- display: flex;
34
- line-height: normal;
35
- }.div-39daef82-2 {
36
- display: flex;
37
- flex-direction: column;
38
- align-items: stretch;
39
- }`})]})}function Z(e){return e.replace(/http(s)?:/,"")}function ut(e="",t,n){const o=new RegExp("([?&])"+t+"=.*?(&|$)","i"),i=e.indexOf("?")!==-1?"&":"?";return e.match(o)?e.replace(o,"$1"+t+"="+encodeURIComponent(n)+"$2"):e+i+t+"="+encodeURIComponent(n)}function mt(e,t){if(!e||!(e!=null&&e.match(/cdn\.shopify\.com/))||!t)return e;if(t==="master")return Z(e);const n=e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);if(n){const o=e.split(n[0]),i=n[3],r=t.match("x")?t:`${t}x`;return Z(`${o[0]}_${r}${i}`)}return null}function ft(e){if(!e)return e;const t=[100,200,400,800,1200,1600,2e3];if(e.match(/builder\.io/)){let n=e;const o=Number(e.split("?width=")[1]);return isNaN(o)||(n=`${n} ${o}w`),t.filter(i=>i!==o).map(i=>`${ut(e,"width",i)} ${i}w`).concat([n]).join(", ")}return e.match(/cdn\.shopify\.com/)?t.map(n=>[mt(e,`${n}x${n}`),n]).filter(([n])=>!!n).map(([n,o])=>`${n} ${o}w`).concat([e]).join(", "):e}const ht=e=>{if(e==="localhost"||e==="127.0.0.1")return e;const t=e.split(".");return t.length>2?t.slice(1).join("."):e},pe=({name:e,canTrack:t})=>{var n;try{return t?(n=document.cookie.split("; ").find(o=>o.startsWith(`${e}=`)))==null?void 0:n.split("=")[1]:void 0}catch(o){k.warn("[COOKIE] GET error: ",(o==null?void 0:o.message)||o);return}},be=async e=>pe(e),gt=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(w).join("; "),pt=[["secure",""],["SameSite","None"]],bt=({name:e,value:t,expires:n})=>{const i=(x()?location.protocol==="https:":!0)?pt:[[]],r=n?[["expires",n.toUTCString()]]:[[]],a=[[e,t],...r,["path","/"],["domain",ht(window.location.hostname)],...i];return gt(a)},ye=async({name:e,value:t,expires:n,canTrack:o})=>{try{if(!o)return;const i=bt({name:e,value:t,expires:n});document.cookie=i}catch(i){k.warn("[COOKIE] SET error: ",(i==null?void 0:i.message)||i)}},yt="builder.tests",H=e=>`${yt}.${e}`,xt=({contentId:e})=>be({name:H(e),canTrack:!0}),St=({contentId:e})=>pe({name:H(e),canTrack:!0}),vt=({contentId:e,value:t})=>ye({name:H(e),value:t,canTrack:!0}),xe=e=>w(e.id)&&w(e.variations)&&Object.keys(e.variations).length>0,kt=({id:e,variations:t})=>{var i;let n=0;const o=Math.random();for(const r in t){const a=(i=t[r])==null?void 0:i.testRatio;if(n+=a,o<n)return r}return e},Se=e=>{const t=kt(e);return vt({contentId:e.id,value:t}).catch(n=>{k.error("could not store A/B test variation: ",n)}),t},ve=({item:e,testGroupId:t})=>{const n=e.variations[t];return t===e.id||!n?{testVariationId:e.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===e.id?"Default":"")}},Ct=({item:e,canTrack:t})=>{if(!t)return e;if(!e)return;if(!xe(e))return e;const n=St({contentId:e.id})||Se({variations:e.variations,id:e.id}),o=ve({item:e,testGroupId:n});return{...e,...o}},wt=async({item:e,canTrack:t})=>{if(!t||!xe(e))return e;const o=await xt({contentId:e.id})||Se({variations:e.variations,id:e.id}),i=ve({item:e,testGroupId:o});return{...e,...i}},$=e=>w(e)?e:!0,It={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},Et={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(o=>{o.delete("width")})}const n=e.get("columns");Array.isArray(n)&&n.find(i=>i.get("width"))&&(n.find(r=>!r.get("width"))||n.reduce((c,l)=>c+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}]},Tt={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}]},Rt={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(o=>o.json()).then(o=>{e.get("url")===t&&(o.html?e.set("content",o.html):e.set("content","Invalid url, please try another"))}).catch(o=>{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}]},Pt=["text/javascript","application/javascript","application/ecmascript"],At=e=>Pt.includes(e.type),Bt={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},Vt={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(a,c=6e4){return new Promise((l,u)=>{const m=document.createElement("img");let p=!1;m.onload=()=>{p=!0,l(m)},m.addEventListener("error",f=>{console.warn("Image load failed",f.error),u(f.error)}),m.src=a,setTimeout(()=>{p||u(new Error("Image load timed out"))},c)})}function o(a){return Math.round(a*1e3)/1e3}const i=e.get("image"),r=e.get("aspectRatio");if(fetch(i).then(a=>a.blob()).then(a=>{a.type.includes("svg")&&e.set("noWebp",!0)}),i&&(!r||r===.7041))return n(i).then(a=>{const c=e.get("aspectRatio");e.get("image")===i&&(!c||c===.7041)&&a.width&&a.height&&(e.set("aspectRatio",o(a.height/a.width)),e.set("height",a.height),e.set("width",a.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}]},jt={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},Wt={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>"}}}]},$t={name:"Slot",isRSC:!0,description:"Allow child blocks to be inserted into this content when used as a Symbol",docsLink:"https://www.builder.io/c/docs/symbols-with-blocks",image:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",inputs:[{name:"name",type:"string",required:!0,defaultValue:"children"}]};function Ft(e){var t,n,o;return s.jsx("div",{style:{pointerEvents:"auto"},...!((t=e.builderContext.context)!=null&&t.symbolId)&&{"builder-slot":e.name},children:s.jsx(P,{parent:(n=e.builderContext.context)==null?void 0:n.symbolId,path:`symbol.data.${e.name}`,context:e.builderContext,blocks:(o=e.builderContext.rootState)==null?void 0:o[e.name]})})}const Ot={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"}]},Nt={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 ke(e){var t;return s.jsx("div",{className:"builder-text",dangerouslySetInnerHTML:{__html:((t=e.text)==null?void 0:t.toString())||""},style:{outline:"none"}})}const _t={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}]},ee=()=>[{component:S.Button,...It},{component:ge,...Et},{component:S.CustomCode,...Tt},{component:S.Embed,...Rt},{component:S.FragmentComponent,...Bt},{component:S.Image,...Vt},{component:S.ImgComponent,...jt},{component:S.SectionComponent,...Wt},{component:Fe,...Ot},{component:ke,...Nt},{component:S.Video,..._t},{component:Ft,...$t}],te=[],Lt=e=>({type:"builder.registerComponent",data:D(e)}),Ut=e=>{const t=e.toString().trim();return`return (${!t.startsWith("function")&&!t.startsWith("(")?"function ":""}${t}).apply(this, arguments)`},Mt=e=>typeof e=="function"?Ut(e):R(e),D=({inputs:e,...t})=>({...R(t),inputs:e==null?void 0:e.map(n=>Object.entries(n).reduce((o,[i,r])=>({...o,[i]:Mt(r)}),{}))}),Dt=`function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
40
- function getAndSetVariantId() {
41
- function setCookie(name, value, days) {
42
- let expires = '';
43
- if (days) {
44
- const date = new Date();
45
- date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
46
- expires = '; expires=' + date.toUTCString();
47
- }
48
- document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';
49
- }
50
- function getCookie(name) {
51
- const nameEQ = name + '=';
52
- const ca = document.cookie.split(';');
53
- for (let i = 0; i < ca.length; i++) {
54
- let c = ca[i];
55
- while (c.charAt(0) === ' ') c = c.substring(1, c.length);
56
- if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
57
- }
58
- return null;
59
- }
60
- const cookieName = \`builder.tests.\${contentId}\`;
61
- const variantInCookie = getCookie(cookieName);
62
- const availableIDs = variants.map(vr => vr.id).concat(contentId);
63
- if (variantInCookie && availableIDs.includes(variantInCookie)) {
64
- return variantInCookie;
65
- }
66
- let n = 0;
67
- const random = Math.random();
68
- for (let i = 0; i < variants.length; i++) {
69
- const variant = variants[i];
70
- const testRatio = variant.testRatio;
71
- n += testRatio;
72
- if (random < n) {
73
- setCookie(cookieName, variant.id);
74
- return variant.id;
75
- }
76
- }
77
- setCookie(cookieName, contentId);
78
- return contentId;
79
- }
80
- const winningVariantId = getAndSetVariantId();
81
- const styleEl = document.currentScript?.previousElementSibling;
82
- if (isHydrationTarget) {
83
- styleEl.remove();
84
- const thisScriptEl = document.currentScript;
85
- thisScriptEl?.remove();
86
- } else {
87
- const newStyleStr = variants.concat({
88
- id: contentId
89
- }).filter(variant => variant.id !== winningVariantId).map(value => {
90
- return \`.variant-\${value.id} { display: none; }
91
- \`;
92
- }).join('');
93
- styleEl.innerHTML = newStyleStr;
94
- }
95
- }`,Kt=`function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {
96
- if (!navigator.cookieEnabled) {
97
- return;
98
- }
99
- function getCookie(name) {
100
- const nameEQ = name + '=';
101
- const ca = document.cookie.split(';');
102
- for (let i = 0; i < ca.length; i++) {
103
- let c = ca[i];
104
- while (c.charAt(0) === ' ') c = c.substring(1, c.length);
105
- if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
106
- }
107
- return null;
108
- }
109
- const cookieName = \`builder.tests.\${defaultContentId}\`;
110
- const winningVariant = getCookie(cookieName);
111
- const parentDiv = document.currentScript?.parentElement;
112
- const isDefaultContent = variantContentId === defaultContentId;
113
- const isWinningVariant = winningVariant === variantContentId;
114
- if (isWinningVariant && !isDefaultContent) {
115
- parentDiv?.removeAttribute('hidden');
116
- parentDiv?.removeAttribute('aria-hidden');
117
- } else if (!isWinningVariant && isDefaultContent) {
118
- parentDiv?.setAttribute('hidden', 'true');
119
- parentDiv?.setAttribute('aria-hidden', 'true');
120
- }
121
- if (isHydrationTarget) {
122
- if (!isWinningVariant) {
123
- parentDiv?.remove();
124
- }
125
- const thisScriptEl = document.currentScript;
126
- thisScriptEl?.remove();
127
- }
128
- return;
129
- }`,Ce="builderIoAbTest",we="builderIoRenderContent",V=e=>Object.values((e==null?void 0:e.variations)||{}).map(t=>({...t,testVariationId:t.id,id:e==null?void 0:e.id})),Ht=({canTrack:e,content:t})=>!(!(V(t).length>0)||!e||x()),zt=e=>e==="react"||e==="reactNative",Ie=zt(I),qt=()=>`
130
- window.${Ce} = ${Dt}
131
- window.${we} = ${Kt}
132
- `,Gt=(e,t)=>`
133
- window.${Ce}(
134
- "${t}",${JSON.stringify(e)}, ${Ie}
135
- )`,Jt=({contentId:e,variationId:t})=>`window.${we}(
136
- "${t}", "${e}", ${Ie}
137
- )`;function K(e){return s.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id||""})}const Yt=e=>{const t=e.get("preview"),n=e.get("overrides."+t);return n||k.warn("No previewed ID found in search params."),n};function Ee(){globalThis._BUILDER_PREVIEW_LRU_CACHE||(globalThis._BUILDER_PREVIEW_LRU_CACHE=new Oe.LRUCache({max:500,ttl:1e3*60*5}))}function Qt(e){Ee();const t=Yt(e);return typeof t=="string"?globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t):void 0}function Xt(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:globalThis}function Zt(){const e=Xt().fetch;if(typeof e>"u")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
138
- For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return e}const Te=Zt();function j(e,t=null,n="."){return Object.keys(e).reduce((o,i)=>{const r=e[i],a=[t,i].filter(Boolean).join(n);return[typeof r=="object",r!==null,!(Array.isArray(r)&&r.length===0)].every(Boolean)?{...o,...j(r,a,n)}:{...o,[a]:r}},{})}const en="v3",ne="builder.",tn="options.",nn=e=>{const t={};return e.forEach((n,o)=>{t[o]=n}),t},z=e=>{if(!e)return{};const t=Re(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(ne)){const i=o.replace(ne,"").replace(tn,"");n[i]=t[o]}}),n},on=()=>{if(!x())return{};const e=new URLSearchParams(window.location.search);return z(e)},Re=e=>e instanceof URLSearchParams?nn(e):e,oe=e=>typeof e=="number"&&!isNaN(e)&&e>=0,q=e=>{let{noTraverse:t=!1}=e;const{limit:n=30,userAttributes:o,query:i,model:r,apiKey:a,includeRefs:c=!0,enrich:l,locale:u,apiVersion:m=en,fields:p,omit:f,offset:h,cacheSeconds:g,staleCacheSeconds:d,sort:b,includeUnpublished:v}=e;if(!a)throw new Error("Missing API key");if(!["v2","v3"].includes(m))throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${m}'`);(e.limit===void 0||e.limit>1)&&!("noTraverse"in e)&&(t=!0);const y=new URL(`https://cdn.builder.io/api/${m}/content/${r}?apiKey=${a}&limit=${n}&noTraverse=${t}&includeRefs=${c}${u?`&locale=${u}`:""}${l?`&enrich=${l}`:""}`);if(y.searchParams.set("omit",f||"meta.componentsUsed"),p&&y.searchParams.set("fields",p),Number.isFinite(h)&&h>-1&&y.searchParams.set("offset",String(Math.floor(h))),typeof v=="boolean"&&y.searchParams.set("includeUnpublished",String(v)),g&&oe(g)&&y.searchParams.set("cacheSeconds",String(g)),d&&oe(d)&&y.searchParams.set("staleCacheSeconds",String(d)),b){const C=j({sort:b});for(const T in C)y.searchParams.set(T,JSON.stringify(C[T]))}const A={...on(),...Re(e.options||{})},E=j(A);for(const C in E)y.searchParams.set(C,String(E[C]));if(o&&y.searchParams.set("userAttributes",JSON.stringify(o)),i){const C=j({query:i});for(const T in C)y.searchParams.set(T,JSON.stringify(C[T]))}return y},rn=e=>"results"in e;async function L(e){const t=await G({...e,limit:1});return t&&t[0]||null}const an=L,sn=async e=>{const t=q(e);return await(await Te(t.href)).json()},Pe=async(e,t,n=q(e))=>{const o=$(e.canTrack);if(n.search.includes("preview=")){const r=[];for(const a of t.results){const c=Qt(n.searchParams);r.push(c||a)}t.results=r}if(!o||!(x()||I==="reactNative"))return t.results;try{const r=[];for(const a of t.results)r.push(await wt({item:a,canTrack:o}));t.results=r}catch(r){k.error("Could not process A/B tests. ",r)}return t.results};async function G(e){try{const t=q(e),n=await sn(e);return rn(n)?Pe(e,n):(k.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return k.error("Error fetching data. ",t),null}}const cn=G;function ln(){return!x()||F()?!1:location.search.indexOf("builder.preview=")!==-1}function dn(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}function Ae(){return dn().replace(/-/g,"")}const Be="builderSessionId",un=async({canTrack:e})=>{if(!e)return;const t=await be({name:Be,canTrack:e});if(w(t))return t;{const n=mn();return fn({id:n,canTrack:e}),n}},mn=()=>Ae(),fn=({id:e,canTrack:t})=>ye({name:Be,value:e,canTrack:t}),Ve=()=>x()&&typeof localStorage<"u"?localStorage:void 0,hn=({key:e,canTrack:t})=>{var n;try{return t?(n=Ve())==null?void 0:n.getItem(e):void 0}catch(o){console.debug("[LocalStorage] GET error: ",o);return}},gn=({key:e,canTrack:t,value:n})=>{var o;try{t&&((o=Ve())==null||o.setItem(e,n))}catch(i){console.debug("[LocalStorage] SET error: ",i)}},je="builderVisitorId",pn=({canTrack:e})=>{if(!e)return;const t=hn({key:je,canTrack:e});if(w(t))return t;{const n=bn();return yn({id:n,canTrack:e}),n}},bn=()=>Ae(),yn=({id:e,canTrack:t})=>gn({key:je,value:e,canTrack:t}),xn=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await un({canTrack:e}),n=pn({canTrack:e});return{sessionId:t,visitorId:n}},Sn=async({type:e,canTrack:t,apiKey:n,metadata:o,...i})=>({type:e,data:{...i,metadata:{url:location.href,...o},...await xn({canTrack:t}),userAttributes:de(),ownerId:n}});async function We(e){if(!e.apiKey){k.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!F()&&(x()||I==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await Sn(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const vn=e=>We({...e,canTrack:!0});function ie(e){return Math.round(e*1e3)/1e3}const kn=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let o=n?e:e.parentElement;do{if(!o)return null;if(t(o))return o}while(o=o.parentElement);return null},Cn=e=>kn(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),re=({event:e,target:t})=>{const n=t.getBoundingClientRect(),o=e.clientX-n.left,i=e.clientY-n.top,r=ie(o/n.width),a=ie(i/n.height);return{x:r,y:a}},wn=e=>{const t=e.target,n=t&&Cn(t),o=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:o||void 0,metadata:{targetOffset:t?re({event:e,target:t}):void 0,builderTargetOffset:n?re({event:e,target:n}):void 0,builderElementIndex:n&&o?[].slice.call(document.getElementsByClassName(o)).indexOf(n):void 0}}},In="0.12.1",ae={};function $e(e,t){let n=ae[e];if(n||(n=ae[e]=[]),n.push(t),x()){const o={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(o,"*"),parent!==window&&window.postMessage(o,"*")}catch(i){console.debug("Could not postmessage",i)}}}const En=()=>{$e("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 se=!1;const Tn=(e={})=>{var t,n;se||(se=!0,x()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:I,version:In,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",({data:o})=>{var i,r;if(o!=null&&o.type)switch(o.type){case"builder.evaluate":{const a=o.data.text,c=o.data.arguments||[],l=o.data.id,u=new Function(a);let m,p=null;try{m=u.apply(null,c)}catch(f){p=f}p?(i=window.parent)==null||i.postMessage({type:"builder.evaluateError",data:{id:l,error:p.message}},"*"):m&&typeof m.then=="function"?m.then(f=>{var h;(h=window.parent)==null||h.postMessage({type:"builder.evaluateResult",data:{id:l,result:f}},"*")}).catch(console.error):(r=window.parent)==null||r.postMessage({type:"builder.evaluateResult",data:{result:m,id:l}},"*");break}}})))},Rn=e=>{var r;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],o=e.fileUrl??((r=e==null?void 0:e.files)==null?void 0:r.regular);let i="";if(o&&t&&n&&(i+=`
139
- @font-face {
140
- font-family: "${t}";
141
- src: local("${n}"), url('${o}') format('woff2');
142
- font-display: fallback;
143
- font-weight: 400;
144
- }
145
- `.trim()),e.files)for(const a in e.files){if(!(String(Number(a))===a))continue;const l=e.files[a];l&&l!==o&&(i+=`
146
- @font-face {
147
- font-family: "${t}";
148
- src: url('${l}') format('woff2');
149
- font-display: fallback;
150
- font-weight: ${a};
151
- }
152
- `.trim())}return i},Pn=({customFonts:e})=>{var t;return((t=e==null?void 0:e.map(n=>Rn(n)))==null?void 0:t.join(" "))||""},An=({cssCode:e,contentId:t})=>e?t?(e==null?void 0:e.replace(/&/g,`div[builder-content-id="${t}"]`))||"":e:"";function Bn(e){const t=`
153
- ${An({cssCode:e.cssCode,contentId:e.contentId})}
154
- ${Pn({customFonts:e.customFonts})}
155
-
156
- .builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
157
- margin: 0;
158
- }
159
- .builder-text > p, .builder-text > .builder-paragraph {
160
- color: inherit;
161
- line-height: inherit;
162
- letter-spacing: inherit;
163
- font-weight: inherit;
164
- font-size: inherit;
165
- text-align: inherit;
166
- font-family: inherit;
167
- }
168
- `.trim();return s.jsx(N,{styles:t})}const Vn=({content:e,data:t,locale:n})=>{var r,a,c;const o={},i=((r=e==null?void 0:e.data)==null?void 0:r.state)||{};return(c=(a=e==null?void 0:e.data)==null?void 0:a.inputs)==null||c.forEach(l=>{l.name&&l.defaultValue!==void 0&&(o[l.name]=l.defaultValue)}),{...o,...i,...t,...n?{locale:n}:{}}},jn=({content:e,data:t})=>e?{...e,data:{...e==null?void 0:e.data,...t},meta:e==null?void 0:e.meta}:void 0;function ce(e){var i,r,a,c,l,u,m,p,f;const t=Jt({variationId:(i=e.content)==null?void 0:i.testVariationId,contentId:(r=e.content)==null?void 0:r.id}),n=[...ee(),...te,...e.customComponents||[]].reduce((h,{component:g,...d})=>({...h,[d.name]:{component:g,...D(d)}}),{}),o={content:jn({content:e.content,data:e.data}),localState:void 0,rootState:Vn({content:e.content,data:e.data,locale:e.locale}),rootSetState:void 0,context:e.context||{},apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...ee(),...te,...e.customComponents||[]].reduce((h,{component:g,...d})=>({...h,[d.name]:D(d)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{}};return s.jsxs(S.EnableEditor,{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:o,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,children:[e.isSsrAbTest?s.jsx(s.Fragment,{children:s.jsx(K,{scriptStr:t})}):null,s.jsx(s.Fragment,{children:s.jsx(Bn,{contentId:(a=o.content)==null?void 0:a.id,cssCode:(l=(c=o.content)==null?void 0:c.data)==null?void 0:l.cssCode,customFonts:(m=(u=o.content)==null?void 0:u.data)==null?void 0:m.customFonts})}),s.jsx(P,{blocks:(f=(p=o.content)==null?void 0:p.data)==null?void 0:f.blocks,context:o,registeredComponents:n})]})}function J(e){var r,a;const t=Ht({canTrack:$(e.canTrack),content:e.content}),n=function(){var l;return Gt(V(e.content).map(u=>({id:u.testVariationId,testRatio:u.testRatio})),((l=e.content)==null?void 0:l.id)||"")},o=function(){return V(e.content).map(l=>`.variant-${l.testVariationId} { display: none; } `).join("")},i=function(){var l;return t?{...e.content,testVariationId:(l=e.content)==null?void 0:l.id}:Ct({item:e.content,canTrack:$(e.canTrack)})};return s.jsxs(s.Fragment,{children:[!e.__isNestedRender&&I!=="reactNative"?s.jsx(s.Fragment,{children:s.jsx(K,{scriptStr:qt()})}):null,t?s.jsxs(s.Fragment,{children:[s.jsx(N,{id:`variants-styles-${(r=e.content)==null?void 0:r.id}`,styles:o()}),s.jsx(K,{scriptStr:n()}),(a=V(e.content))==null?void 0:a.map(c=>s.jsx(ce,{content:c,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},c.testVariationId))]}):null,s.jsx(ce,{content:i(),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 Wn=async({builderContextValue:e,symbol:t})=>{if(t!=null&&t.model&&(e!=null&&e.apiKey))return L({model:t.model,apiKey:e.apiKey,apiVersion:e.apiVersion,...(t==null?void 0:t.entry)&&{query:{id:t.entry}}}).catch(n=>{k.error("Could not fetch symbol content: ",n)})};async function Fe(e){var o,i,r,a,c;const t=function(){var u,m;return[e.attributes.className,"builder-symbol",(u=e.symbol)!=null&&u.inline?"builder-inline-symbol":void 0,(m=e.symbol)!=null&&m.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")},n=((o=e.symbol)==null?void 0:o.content)||await Wn({symbol:e.symbol,builderContextValue:e.builderContext});return s.jsx("div",{...e.attributes,className:t(),children:s.jsx(J,{__isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:{...e.builderContext.context,symbolId:(i=e.builderBlock)==null?void 0:i.id},customComponents:Object.values(e.builderComponents),data:{...(r=e.symbol)==null?void 0:r.data,...e.builderContext.localState,...(a=n==null?void 0:n.data)==null?void 0:a.state},model:(c=e.symbol)==null?void 0:c.model,content:n})})}const $n=P,Fn=J,le={};function On(e){if(x()){Object.assign(le,e);const t={type:"builder.settingsChange",data:le};parent.postMessage(t,"*")}}const Nn=async e=>{var o,i,r;const t=e.path||((o=e.url)==null?void 0:o.pathname)||((i=e.userAttributes)==null?void 0:i.urlPath),n={...e,apiKey:e.apiKey,model:e.model||"page",userAttributes:{...e.userAttributes,...t?{urlPath:t}:{}},options:z(e.searchParams||((r=e.url)==null?void 0:r.searchParams)||e.options)};return{apiKey:n.apiKey,model:n.model,content:await L(n)}};exports.Blocks=P;exports.Columns=ge;exports.ContentVariants=J;exports.RenderBlocks=$n;exports.RenderContent=Fn;exports.Symbol=Fe;exports.Text=ke;exports._processContentResult=Pe;exports._track=We;exports.createRegisterComponentMessage=Lt;exports.evaluate=O;exports.fastClone=R;exports.fetch=Te;exports.fetchBuilderProps=Nn;exports.fetchEntries=G;exports.fetchOneEntry=L;exports.getAllContent=cn;exports.getBlockActions=rt;exports.getBlockProperties=he;exports.getBuilderSearchParams=z;exports.getContent=an;exports.getDefaultCanTrack=$;exports.getInteractionPropertiesForEvent=wn;exports.getSrcSet=ft;exports.init=Ee;exports.isBrowser=x;exports.isEditing=F;exports.isJsScript=At;exports.isPreviewing=ln;exports.logger=k;exports.register=$e;exports.registerInsertMenu=En;exports.setEditorSettings=On;exports.setupBrowserForEditing=Tn;exports.track=vn;