@rulecms/widget-svelte 0.8.1 → 0.8.2

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 (3) hide show
  1. package/dist/index.cjs +33 -33
  2. package/dist/index.js +930 -924
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1,65 +1,65 @@
1
- "use strict";var Ir=Object.defineProperty;var Pr=(e,t,r)=>t in e?Ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var it=(e,t,r)=>Pr(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("svelte/internal/disclose-version");const Dr=require("svelte/internal/client"),Re=require("svelte");function xr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const n=xr(Dr),ee="default";function Be(e,t){return!(e!=null&&e.length)||e===ee?t:`${e}/${t}`}const Lr=`RuleCMS widget: this widget config uses components from the default component library, but no "default" library is registered. The default library is registered by the consumer app: add the RuleCMS default source components package as a direct dependency and register it, e.g. libraries: { default: sourceComponentsModule } (statically imported for SSR) or libraries: { default: () => import('<default source components package>') }. See the @rulecms/widget-svelte README.`;function lt(e){if(!e||typeof e!="object")return!1;const t=e;return!!t.manifest&&typeof t.manifest=="object"&&!!t.components&&typeof t.components=="object"&&!Array.isArray(t.components)}function kr(e){if(lt(e))return e;const t=e;return lt(t==null?void 0:t.default)?t.default:null}function Le(e){return e.usesDefaultLibrary?[ee,...e.libraryIds]:[...e.libraryIds]}function at({registrations:e,referenced:t}){if(t.usesDefaultLibrary&&!(e!=null&&e[ee]))throw new Error(Lr)}function Rr(e){const t=[],r=new Set;for(const o of e.values()){if(typeof o.stylesheet!="string")continue;const s=o.stylesheet.trim();!s||r.has(s)||(r.add(s),t.push(s))}return t.length>0?t:void 0}function ht(e){const t={};for(const[o,s]of e){const i=o===ee;for(const[l,a]of Object.entries(s.components))t[i?l:`${o}/${l}`]=a}const r=Rr(e);return r?{components:t,stylesheets:r}:{components:t}}function ie(){const e=new Map,t=new Map,r=new Map,o=new Map;let s=0;function i(u,c){var f;e.get(u)!==c&&((f=c.manifest)!=null&&f.id&&c.manifest.id!==u&&console.warn(`RuleCMS widget: component library registered as "${u}" declares manifest id "${c.manifest.id}". The registered id wins for resolution.`),e.set(u,c),s+=1)}function l(u){const c=Le(u),f=[...c].sort().join("|"),p=o.get(f);if(p&&p.loadedVersion===s)return p.plugin;const g=new Map;for(const A of c){const b=e.get(A);b&&g.set(A,b)}const E=ht(g);return o.set(f,{loadedVersion:s,plugin:E}),E}function a(u){at(u);const{registrations:c,referenced:f}=u;for(const p of Le(f)){if(e.has(p)||r.has(p))continue;const g=c==null?void 0:c[p];if(!g){console.error(`RuleCMS widget: no component library registered for libraryId "${p}"; its components will not render.`),r.set(p,new Error(`No registration for libraryId "${p}"`));continue}if(typeof g=="function")return null;i(p,g)}return l(f)}async function d(u){at(u);const{registrations:c,referenced:f}=u,p=Le(f);return await Promise.all(p.map(async g=>{if(e.has(g)||r.has(g))return;const E=c==null?void 0:c[g];if(!E){console.error(`RuleCMS widget: no component library registered for libraryId "${g}"; its components will not render.`),r.set(g,new Error(`No registration for libraryId "${g}"`));return}if(typeof E!="function"){i(g,E);return}let A=t.get(g);A||(A=E().then(b=>{const _=kr(b);if(!_)throw new Error(`Registration for libraryId "${g}" did not resolve to a ComponentLibraryModule (expected { manifest, components }).`);i(g,_)}).catch(b=>{r.set(g,b),console.error(`RuleCMS widget: failed to load component library "${g}":`,b)}).finally(()=>{t.delete(g)}),t.set(g,A)),await A})),l(f)}return{resolveSync:a,resolve:d}}const Oe={Preview:"Preview",Compose:"Compose",RenderedPage:"RenderedPage"},be={DroppableBox:"droppable-box"},We={FlexStart:"flex-start",FlexEnd:"flex-end",Center:"center",SpaceBetween:"space-between",SpaceAround:"space-around",SpaceEvenly:"space-evenly"},Or={FlexStart:"flex-start",FlexEnd:"flex-end",Center:"center",SpaceBetween:"space-between",SpaceAround:"space-around",SpaceEvenly:"space-evenly",Stretch:"stretch"},ge="cssAttrArray",Wr={Phone:"phone",Tablet:"tablet",Desktop:"desktop"},Ue={ComposerComponent:"ComposerWidget",Collection:"Collection",MoveComponentHandle:"MoveWidgetHandle"},He=`${Ue.Collection}_`,bt="dev.",_t="https://rulecms.com",Ct="https://widget-cache.rulecms.com",vt="/api/v1/c/widget/get",At="/api/v1/c/dev/widget/get",Et="/api/v1/c/widget/resolve",wt="/api/v1/c/dev/widget/resolve";function G(e){return typeof e=="string"&&e.startsWith(bt)}function ze(e,t){return t?t.replace(/\/$/,""):G(e)?_t:Ct}function Ge({publishedKey:e,token:t,endpoint:r}){const o=G(t),s=o?At:vt,i=o?new URLSearchParams({widgetKey:e,token:t}):new URLSearchParams({publishedKey:e,token:t});return`${ze(t,r)}${s}?${i.toString()}`}function Ye({token:e,endpoint:t}){const r=G(e)?wt:Et;return`${ze(e,t)}${r}`}const Nr=({id:e,prefix:t})=>`${t}_${e}`,St=e=>{if(!(e!=null&&e.length)||!e.includes("_")){console.error(`Invalid drag item id: ${e}. Type does not exist.`);return}return Tt(e)},Xe=e=>e.includes("_"),Tt=e=>{const t=e.indexOf("_"),r=e.substring(0,t),o=e.substring(t+1);return{prefix:r,id:o}},Je=e=>{if(!Xe(e))return;const r=St(e);return(r==null?void 0:r.prefix)===Ue.Collection||console.error("getCollectionIdForCollectionType - Invalid component type: ${componentType}. Invalid prefix type."),r==null?void 0:r.id},Mr=e=>{if(!(e!=null&&e.length)){console.error("getNameAndInstanceIdFromWidgetKey: Missing widget key");return}const t=e.split("$");if(t.length<2){console.error("getNameAndInstanceIdFromWidgetKey: Invalid widget key format");return}const r=t[0];if(!t[1].includes("@"))return{name:r,instanceId:t[1]};const s=t[1].split("@");return{name:r,instanceId:s[0],parentId:s[1]}},jr=e=>{if(!(e!=null&&e.length))return{errorMessage:"getNameFromWidgetKey: Missing widget key"};const t=e.split("$");return t.length<2?{errorMessage:"getNameFromWidgetKey: Invalid widget key format"}:{name:t[0]}},It=e=>{var s,i,l,a;if(!e)return{error:"getWidgetKeyForCollection: Missing collection"};if(!((s=e.name)!=null&&s.length))return{error:"getWidgetKeyForCollection: Missing collection name"};const t=(i=e.name)==null?void 0:i.trim().toLowerCase();if(!((l=e.id)!=null&&l.length))return{error:"getWidgetKeyForCollection: Missing collection id"};const o=((a=e.parentId)==null?void 0:a.length)?`${e.id}@${e.parentId}`:`${e.id}`;return{data:`${t}$${o}`}},Pt=e=>{var s,i,l,a;if(!e)return{error:"getWidgetKeyForPublishedCollection: Missing collection"};if(!((s=e.name)!=null&&s.length))return{error:"getWidgetKeyForPublishedCollection: Missing collection name"};const t=(i=e.name)==null?void 0:i.trim().toLowerCase();if(!((l=e.publishedKey)!=null&&l.length))return{error:"getWidgetKeyForPublishedCollection: Missing collection publishedKey"};const o=((a=e.parentId)==null?void 0:a.length)?`${e.publishedKey}@${e.parentId}`:`${e.publishedKey}`;return{data:`${t}$${o}`}},Vr=e=>{const t=It(e);return`${He}${t.data}`},Fr=e=>{const t=Pt(e);return`${He}${t.data}`},pe="---",Dt="___";function xt(e,t){return`${e}${pe}${t}`}function Kr(e,t,r){return`${xt(e,t)}${Dt}${r}`}function Br(e){const t=e.split(".");if(t.length!==3)throw new Error(`Invalid version format: ${e}. Expected format: x.y.z`);const r=t[0],o=t[1],s=parseInt(t[2],10);if(isNaN(s))throw new Error(`Invalid patch version: ${t[2]}. Expected a number.`);return`${r}.${o}.${s+1}`}function _e({displayItemList:e,widgetCollections:t}){const r=new Set;let o=!1;const s=i=>{var l,a,d;if((l=i==null?void 0:i.rows)!=null&&l.length){for(const u of i.rows)if((a=u==null?void 0:u.columns)!=null&&a.length)for(const c of u.columns)c.collection&&s(c.collection.collectionRows),!(!c.type||c.type===be.DroppableBox)&&(Xe(c.type)||(!((d=c.libraryId)!=null&&d.length)||c.libraryId===ee?o=!0:r.add(c.libraryId)))}};s(e);for(const i of Object.values(t??{}))s(i==null?void 0:i.collectionRows);return{libraryIds:Array.from(r),usesDefaultLibrary:o}}const qe=Symbol("rulecms-widget-context");function Ur(){return{token:"",endpoint:void 0,libraries:void 0,libraryRegistry:ie()}}function Hr(e,t){n.push(t,!0);const r=n.proxy(Ur());function o(){r.token=t.token,r.endpoint=t.endpoint,r.libraries=t.libraries}o(),n.user_effect(o),Re.setContext(qe,r);var s=n.comment(),i=n.first_child(s);n.snippet(i,()=>t.children),n.append(e,s),n.pop()}const Lt="1200px",Ze="500px",Qe="820px",zr=Lt,kt="rulecms",Gr=1920,Yr={f:"auto",q:"auto",c:"limit"},Xr=/^[A-Za-z0-9][A-Za-z0-9._\-/]*$/,Jr=300,qr=/^[A-Za-z0-9][A-Za-z0-9_-]*$/,Zr=100,Qr=/^https:\/\/[^\s"'()\\<>]+$/,$r=2e3,eo=/^[A-Za-z0-9_,.:\-/]*$/,to=300,Rt=e=>typeof e=="string"&&e.length<=Jr&&Xr.test(e),Ot=e=>typeof e=="string"&&e.length<=Zr&&qr.test(e),Wt=e=>typeof e=="string"&&e.length<=$r&&Qr.test(e),Nt=e=>typeof e=="string"&&e.length<=to&&eo.test(e),no=e=>Object.entries(e).map(([t,r])=>`${t}_${r}`).join(","),ro=e=>{const t={};for(const r of e.split(",")){const o=r.trim(),s=o.indexOf("_");s<=0||(t[o.slice(0,s)]=o.slice(s+1))}return t},Mt=({publicId:e,cloudName:t=kt,transformations:r,width:o=Gr})=>{const s=typeof r=="string"?ro(r):r,i={...Yr,...s,w:o};return encodeURI(`https://res.cloudinary.com/${t}/image/upload/${no(i)}/${e}`)},jt=/^--[A-Za-z0-9_-]+$/,Vt=200,Q=e=>{if(typeof e!="string")return!1;const t=e.trim();return t.length<=Vt&&jt.test(t)},F=e=>`var(${e.trim()})`,L=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e.cssVariable;if(t!=null)return Q(t)?t.trim():void 0},U=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e.cssVariable;return t==null?!1:!Q(t)},oo=(e,t)=>{const r=L(e);return r?{[t]:F(r)}:void 0},Ft=e=>{if(typeof e!="object"||e===null||Array.isArray(e)||U(e))return!1;if(L(e))return!0;const t=e;return t.source==="none"?!0:t.source==="url"?Wt(t.url):t.source==="cloudinary"?!Rt(t.publicId)||t.cloudName!==void 0&&t.cloudName!==null&&!Ot(t.cloudName)?!1:t.transformations===void 0||t.transformations===null||Nt(t.transformations):!1},Kt=["px","%","em","rem","vh","vw"],Ce=["inherit","unset"],Bt=["allSides","top","right","bottom","left"],q=(e,t={})=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const r=e;return U(e)?!1:L(e)?!0:r.unit==="auto"?t.allowAuto!==!1:r.unit==="keyword"?t.allowKeywords!==!1&&Ce.includes(r.keyword):Kt.includes(r.unit)?typeof r.value!="number"||!Number.isFinite(r.value)?!1:t.allowNegative!==!1||r.value>=0:!1},Ut=(e,t={})=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const r=e;for(const o of Bt){const s=r[o];if(s!=null&&!q(s,t))return!1}return!0},so=[...Ce,"transparent","currentColor"],io=/^(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/,ve=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return U(e)?!1:L(e)?!0:t.unit==="keyword"?so.includes(t.keyword):t.unit==="color"?typeof t.value=="string"&&io.test(t.value.trim()):!1},Ae=e=>{const t=L(e);return t?F(t):"unit"in e?e.unit==="keyword"?e.keyword:e.value.trim():""},Ht=(e,t)=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!U(e)&&!!L(e):typeof e!="string"||!e.length?!1:t.includes(e)?!0:Ce.includes(e),zt=['system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif','Georgia, "Times New Roman", Times, serif',"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace","Arial, Helvetica, sans-serif",'"Helvetica Neue", Helvetica, Arial, sans-serif',"Verdana, Geneva, sans-serif"],Gt=["normal","bold","100","200","300","400","500","600","700","800","900"],Yt=["normal","italic","oblique"],Xt=["left","center","right","justify","start","end"],Jt=["none","underline","line-through","overline"],qt=["none","uppercase","lowercase","capitalize"],de=["visible","hidden","scroll","auto","clip"],Zt=["auto","none"],Qt=["flex-start","flex-end","center","space-between","space-around","space-evenly"],$t=["flex-start","flex-end","center","baseline","stretch"],en=["wrap","nowrap"],tn=["flex-start","flex-end","center","space-between","space-around","space-evenly","stretch"],nn=["row","row-reverse","column","column-reverse"],rn=["cover","contain","auto"],on=["center center","center top","center bottom","left center","left top","left bottom","right center","right top","right bottom"],sn=["no-repeat","repeat","repeat-x","repeat-y","space","round"],ln=["justifyContent","alignItems","flexWrap","alignContent","flexDirection"],an=["none","solid","dashed","dotted","double","groove","ridge","inset","outset"],cn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!U(e)&&!!L(e):an.includes(e),un=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return U(e)?!1:L(e)?!0:!(t.width!==void 0&&t.width!==null&&!q(t.width,{allowAuto:!1,allowNegative:!1})||t.style!==void 0&&t.style!==null&&!cn(t.style)||t.color!==void 0&&t.color!==null&&!ve(t.color))},lo={allowAuto:!1,allowKeywords:!1,allowNegative:!0},ao={allowAuto:!1,allowKeywords:!1,allowNegative:!1},dn=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;if(U(e))return!1;if(L(e))return!0;for(const r of["offsetX","offsetY","spread"]){const o=t[r];if(o!=null&&!q(o,lo))return!1}return!(t.blur!==void 0&&t.blur!==null&&!q(t.blur,ao)||t.color!==void 0&&t.color!==null&&!ve(t.color)||t.inset!==void 0&&t.inset!==null&&typeof t.inset!="boolean")},fn=e=>e?e.cssVariable!==void 0&&e.cssVariable!==null||e.offsetX!==void 0||e.offsetY!==void 0||e.blur!==void 0||e.spread!==void 0||e.color!==void 0:!1,gn=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return U(e)?!1:L(e)?!0:t.unit==="number"?typeof t.value=="number"&&Number.isFinite(t.value)&&t.value>0:q(e,{allowAuto:!1,allowNegative:!1})},pn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!U(e)&&!!L(e):typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1,mn=e=>{if(!Ft(e))return{};const t=L(e);if(t)return{backgroundImage:F(t)};const r=e;return r.source==="none"?{backgroundImage:"none"}:r.source==="url"?{backgroundImage:`url("${r.url}")`}:{backgroundImage:`url("${Mt({publicId:r.publicId,cloudName:r.cloudName,transformations:r.transformations})}")`}},Z=e=>{const t=L(e);return t?F(t):"unit"in e?e.unit==="auto"?"auto":e.unit==="keyword"?e.keyword:`${e.value}${e.unit}`:""},yn=e=>{if(!un(e))return{};const t=L(e);if(t)return{border:F(t)};const r={};if(e.width&&(r.borderWidth=Z(e.width)),e.style){const o=L(e.style);r.borderStyle=o?F(o):e.style}return e.color&&(r.borderColor=Ae(e.color)),r},ce=e=>e?Z(e):"0px",hn=e=>{if(!dn(e)||!fn(e))return{};const t=L(e);if(t)return{boxShadow:F(t)};const r=[ce(e.offsetX),ce(e.offsetY),ce(e.blur),ce(e.spread)];return e.color&&r.push(Ae(e.color)),e.inset&&r.unshift("inset"),{boxShadow:r.join(" ")}},co=e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`,bn=(e,t)=>{if(!Ut(e))return{};if(e.allSides)return{[t]:Z(e.allSides)};const r={};for(const o of["top","right","bottom","left"]){const s=e[o];s&&(r[`${t}${co(o)}`]=Z(s))}return r},_n=(e,t)=>ve(e)?{[t]:Ae(e)}:{},Cn=(e,t,r)=>{if(!Ht(e,r))return{};const o=L(e);return o?{[t]:F(o)}:{[t]:e}},vn=(e,t,r={})=>q(e,r)?{[t]:Z(e)}:{},An=e=>{if(!gn(e))return{};const t=L(e);return t?{lineHeight:F(t)}:"unit"in e&&e.unit==="number"?{lineHeight:e.value}:{lineHeight:Z(e)}},En=e=>{if(!pn(e))return{};const t=L(e);return t?{opacity:F(t)}:{opacity:e}},Ee={"margin-3-resolutions":{kind:"boxSpacing",cssProperty:"margin"},"padding-3-resolutions":{kind:"boxSpacing",cssProperty:"padding"},"border-3-resolutions":{kind:"border"},"box-shadow-3-resolutions":{kind:"boxShadow"},"border-radius-3-resolutions":{kind:"length",cssProperty:"borderRadius",capabilities:{allowAuto:!1,allowNegative:!1}},"width-3-resolutions":{kind:"length",cssProperty:"width",capabilities:{allowAuto:!0,allowNegative:!1}},"height-3-resolutions":{kind:"length",cssProperty:"height",capabilities:{allowAuto:!0,allowNegative:!1}},"min-width-3-resolutions":{kind:"length",cssProperty:"minWidth",capabilities:{allowAuto:!1,allowNegative:!1}},"max-width-3-resolutions":{kind:"length",cssProperty:"maxWidth",capabilities:{allowAuto:!1,allowNegative:!1}},"min-height-3-resolutions":{kind:"length",cssProperty:"minHeight",capabilities:{allowAuto:!1,allowNegative:!1}},"max-height-3-resolutions":{kind:"length",cssProperty:"maxHeight",capabilities:{allowAuto:!1,allowNegative:!1}},"gap-3-resolutions":{kind:"length",cssProperty:"gap",capabilities:{allowAuto:!1,allowNegative:!1}},"justify-content-3-resolutions":{kind:"enum",cssProperty:"justifyContent",allowedValues:Qt},"align-items-3-resolutions":{kind:"enum",cssProperty:"alignItems",allowedValues:$t},"flex-wrap-3-resolutions":{kind:"enum",cssProperty:"flexWrap",allowedValues:en},"align-content-3-resolutions":{kind:"enum",cssProperty:"alignContent",allowedValues:tn},"flex-direction-3-resolutions":{kind:"enum",cssProperty:"flexDirection",allowedValues:nn},"overflow-3-resolutions":{kind:"enum",cssProperty:"overflow",allowedValues:de},"overflow-x-3-resolutions":{kind:"enum",cssProperty:"overflowX",allowedValues:de},"overflow-y-3-resolutions":{kind:"enum",cssProperty:"overflowY",allowedValues:de},"pointer-events-3-resolutions":{kind:"enum",cssProperty:"pointerEvents",allowedValues:Zt},"background-color-3-resolutions":{kind:"color",cssProperty:"backgroundColor"},"color-3-resolutions":{kind:"color",cssProperty:"color"},"background-image-3-resolutions":{kind:"backgroundImage"},"background-size-3-resolutions":{kind:"enum",cssProperty:"backgroundSize",allowedValues:rn},"background-position-3-resolutions":{kind:"enum",cssProperty:"backgroundPosition",allowedValues:on},"background-repeat-3-resolutions":{kind:"enum",cssProperty:"backgroundRepeat",allowedValues:sn},"opacity-3-resolutions":{kind:"opacity"},"font-family-3-resolutions":{kind:"enum",cssProperty:"fontFamily",allowedValues:zt},"font-size-3-resolutions":{kind:"length",cssProperty:"fontSize",capabilities:{allowAuto:!1,allowNegative:!1}},"font-weight-3-resolutions":{kind:"enum",cssProperty:"fontWeight",allowedValues:Gt},"font-style-3-resolutions":{kind:"enum",cssProperty:"fontStyle",allowedValues:Yt},"line-height-3-resolutions":{kind:"lineHeight"},"letter-spacing-3-resolutions":{kind:"length",cssProperty:"letterSpacing",capabilities:{allowAuto:!1,allowNegative:!0}},"text-align-3-resolutions":{kind:"enum",cssProperty:"textAlign",allowedValues:Xt},"text-decoration-3-resolutions":{kind:"enum",cssProperty:"textDecoration",allowedValues:Jt},"text-transform-3-resolutions":{kind:"enum",cssProperty:"textTransform",allowedValues:qt}},wn=(e,t)=>{const r=Ee[e];if(!r)return{};switch(r.kind){case"boxSpacing":return bn(t,r.cssProperty);case"length":return vn(t,r.cssProperty,r.capabilities);case"border":return yn(t);case"boxShadow":return hn(t);case"color":return _n(t,r.cssProperty);case"opacity":return En(t);case"enum":return Cn(t,r.cssProperty,r.allowedValues);case"lineHeight":return An(t);case"backgroundImage":return mn(t);default:return{}}},uo=Object.fromEntries(Object.entries(Ee).filter(([,e])=>e.kind==="boxSpacing").map(([e,t])=>[e,t.cssProperty])),fo=e=>e!=null&&e!=="",Sn=e=>e?!ln.some(r=>fo(e[r]))||e.display==="flex"?e:{...e,display:"flex"}:{},Tn=({dbEntryType:e,libraryId:t,sourceComponentsPlugin:r})=>{if(!(e!=null&&e.length))return;const o=r.components[Be(t,e)];if(!o||!("defaultAttributeValues"in o))return;const i=o.defaultAttributeValues;if(i!=null&&i.length)return i.reduce((l,a)=>({...l,[a.name]:a.defaultValues}),{})},Y=({deviceDisplayType:e,componentAttributes:t})=>{if(!t)return;const r={},o={};for(const[s,i]of Object.entries(t)){if(!s.includes("3-resolutions")||!i)continue;const l=i.all,a=l??i[e.toLowerCase()];o[s]=a,Ee[s]&&Object.assign(r,wn(s,a))}return Object.keys(r).length||Object.keys(o).length?{styles:Object.keys(r).length?r:void 0,componentAttributesSpecificToDeviceType:Object.keys(o).length?o:void 0}:void 0},In=({defaultAttributes:e,userModifiedAttributes:t})=>e?t?{...e,...t}:e:t;function se(e){return e.componentAttributes??e.widgetAttributes}function Ne({col:e,deviceDisplayType:t,isComposeMode:r,sourceComponentsPlugin:o}){const s=se(e),i=Tn({dbEntryType:e.type,libraryId:e.libraryId,sourceComponentsPlugin:o})||[],l=In({defaultAttributes:i,userModifiedAttributes:s}),{styles:a,componentAttributesSpecificToDeviceType:d}=Y({deviceDisplayType:t,componentAttributes:l})||{styles:void 0,componentAttributesSpecificToDeviceType:void 0};let u={};const c={};if(a)for(const[g,E]of Object.entries(a))r&&c[g]||(u={...u,[g]:E});let f=se(e);for(const g in d)if(g.includes("3-resolutions")){f={...se(e)||{},...d||{}};break}const p=Sn(u);if(r&&p.pointerEvents!==void 0){const g={...p};return delete g.pointerEvents,{componentAttributesBasedOnDevice:f,componentStyles:g}}return{componentAttributesBasedOnDevice:f,componentStyles:p}}const Pn=e=>{const t=(e==null?void 0:e.rows)||[];for(const r of t)if(((r==null?void 0:r.columns)||[]).length>0)return!0;return(e==null?void 0:e.containerAttributes)&&Object.keys(e.containerAttributes).length>0},Dn="var(--sl-spacing-x-small)";function xn(e){return e!=null&&e.horizontalAlignment||e!=null&&e.verticalAlignment||e!=null&&e.flexWrap||e!=null&&e.gap||e!=null&&e.alignContent?!0:!!(e!=null&&e.rowAttributes&&Object.keys(e.rowAttributes).length>0)}function Ln({row:e,deviceDisplayType:t}){var o;const r=Y({deviceDisplayType:t,componentAttributes:e.rowAttributes});return((o=r==null?void 0:r.componentAttributesSpecificToDeviceType)==null?void 0:o["hide-component-3-resolutions"])==="true"}function kn({row:e,deviceDisplayType:t,isComposeMode:r}){var g;const o=((g=Y({deviceDisplayType:t,componentAttributes:e.rowAttributes}))==null?void 0:g.styles)||{},s=o.justifyContent??e.horizontalAlignment??We.Center,i=o.alignItems??e.verticalAlignment??We.Center,l=o.flexDirection??"row",a=o.gap??e.gap??Dn,d=r?"nowrap":o.flexWrap??e.flexWrap??"nowrap",u=o.alignContent??e.alignContent??void 0,c=new Set(["justifyContent","alignItems","flexDirection","gap","flexWrap","alignContent","display"]),f={};for(const[E,A]of Object.entries(o))c.has(E)||(f[E]=A);const p={display:"flex",flexDirection:l,gap:a,flexWrap:d,justifyContent:s,alignItems:i,...f};return u!==void 0&&(p.alignContent=u),p}const we="css-classes-3-resolutions",go=500,po=/[\x00-\x1f\x7f]/g,Se=e=>{if(typeof e!="string")return;const t=new Set,r=[];for(const s of e.split(/\s+/)){const i=s.replace(po,"");i&&(t.has(i)||(t.add(i),r.push(i)))}if(!r.length)return;let o="";for(const s of r){const i=o?`${o} ${s}`:s;if(i.length>go)break;o=i}return o.length?o:void 0},$e="hide-component-3-resolutions",Rn="pointer-events-3-resolutions",On=["width-3-resolutions","min-width-3-resolutions","max-width-3-resolutions","height-3-resolutions","min-height-3-resolutions","max-height-3-resolutions","margin-3-resolutions","padding-3-resolutions","border-3-resolutions","border-radius-3-resolutions","box-shadow-3-resolutions","overflow-3-resolutions","overflow-x-3-resolutions","overflow-y-3-resolutions",$e,Rn],mo=new Set(On);function Te({containerAttributes:e,deviceDisplayType:t}){var o;const r=Y({deviceDisplayType:t,componentAttributes:e});return((o=r==null?void 0:r.componentAttributesSpecificToDeviceType)==null?void 0:o[$e])==="true"}function et({containerAttributes:e,deviceDisplayType:t,isComposeMode:r}){var i;if(!e)return{styles:{}};const o=r?Object.fromEntries(Object.entries(e).filter(([l])=>!mo.has(l))):e,s=Y({deviceDisplayType:t,componentAttributes:o});return{styles:(s==null?void 0:s.styles)??{},cssClasses:Se((i=s==null?void 0:s.componentAttributesSpecificToDeviceType)==null?void 0:i[we])}}function Wn(e){return Object.keys(e.styles).length>0||!!e.cssClasses}function tt({containerAttributes:e,widgetContainerStyles:t}){return((e==null?void 0:e[ge])||[]).some(o=>o.toLowerCase().startsWith("height:"))||t.styles.height!==void 0}const Nn="z-index-3-resolutions",nt=0;function Mn(e){var t,r;return!!((r=(t=e==null?void 0:e.overlayLayers)==null?void 0:t.layers)!=null&&r.length)}function Me({containerAttributes:e,deviceDisplayType:t}){var s;const r=Y({deviceDisplayType:t,componentAttributes:e}),o=(s=r==null?void 0:r.componentAttributesSpecificToDeviceType)==null?void 0:s[Nn];if(typeof o=="number"&&Number.isFinite(o))return o;if(typeof o=="string"&&o.trim().length){const i=Number(o);if(Number.isFinite(i))return i}return nt}function jn(e,t){return e+t+1}function Vn({containerAttributes:e,deviceDisplayType:t}){var s;const r=Y({deviceDisplayType:t,componentAttributes:e}),o=(s=r==null?void 0:r.styles)==null?void 0:s.pointerEvents;return typeof o=="string"?o:void 0}function Fn({layer:e,deviceDisplayType:t}){var r;return(r=e==null?void 0:e.rows)!=null&&r.length?Te({containerAttributes:e.containerAttributes,deviceDisplayType:t}):!0}function Kn({isWithinCollection:e,baseDeclaresOwnHeight:t,baseZIndex:r}){return{position:"relative",isolation:"isolate",display:"flex",flexDirection:"column",...t?{}:{height:e?"auto":"100%"},...r===nt?{}:{zIndex:r}}}function Bn({zIndex:e,pointerEvents:t}){return{position:"absolute",top:0,left:0,width:"100%",height:"100%",boxSizing:"border-box",zIndex:e,...t?{pointerEvents:t}:{}}}function O(e){if(!e)return;const t=[];for(const[r,o]of Object.entries(e)){if(o==null||o==="")continue;const s=r.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`);t.push(`${s}: ${o}`)}return t.length>0?t.join("; "):void 0}const le="/";function Un({componentProps:e,ancestorColumnIds:t,columnId:r}){if(!e||!r)return;const o=[...t??[],r];for(let s=0;s<o.length;s+=1){const i=o.slice(s).join(le),l=e[i];if(l)return l}}const je="placeholderValues";function Hn({widgetInstanceProps:e,placeholderValues:t}){return t===void 0||e!=null&&Object.prototype.hasOwnProperty.call(e,je)?e:{...e,[je]:t}}function zn({displayItemList:e,widgetCollections:t}){const r=[],o=(s,i)=>{var l;if((l=s==null?void 0:s.rows)!=null&&l.length)for(const a of s.rows)for(const d of a.columns){if(!d.id||d.type===be.DroppableBox)continue;const u=Je(d.type);if(u!=null&&u.length){const c=d.collection??(t==null?void 0:t[u]);c&&!i.includes(d.id)&&o(c.collectionRows,[...i,d.id]);continue}r.push([...i,d.id].join(le))}};return o(e,[]),r}function yo(e,t){const r=`${le}${e}`;return t.some(o=>o===e||o.endsWith(r))}function Gn({componentProps:e,displayItemList:t,widgetCollections:r}){const o=e?Object.keys(e):[];if(!o.length)return[];const s=zn({displayItemList:t,widgetCollections:r});return o.filter(i=>!yo(i,s))}function Yn({componentProps:e,displayItemList:t,widgetCollections:r,publishedKey:o}){if(process.env.NODE_ENV==="production")return;const s=Gn({componentProps:e,displayItemList:t,widgetCollections:r});s.length&&console.warn(`RuleCMSWidget "${o}": componentProps ${s.map(i=>`"${i}"`).join(", ")} ${s.length===1?"matches":"match"} no component in this widget, so those props were not passed to anything. Keys are column ids from the widget config — the composer's Modify drawer shows the id of the selected component.`)}function ho(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function bo(e){if(e.all!==void 0&&e.all!==null)return!1;const t=e.phone,r=e.tablet,o=e.desktop;return t!==r||t!==o||r!==o}function Ve(e){var t,r;if(!((t=e==null?void 0:e.rows)!=null&&t.length))return!1;if(ke(e.containerAttributes))return!0;for(const o of e.rows){if(ke(o.rowAttributes))return!0;for(const s of o.columns)if(ke(se(s)))return!0}for(const o of((r=e.overlayLayers)==null?void 0:r.layers)??[])if(Ve(o))return!0;return!1}function ke(e){if(!e)return!1;for(const[t,r]of Object.entries(e))if(!(!t.includes("3-resolutions")||!ho(r))){if(t==="hide-component-3-resolutions"){const o=r,s=i=>i==="true"||i===!0;if(s(o.phone)!==s(o.tablet)||s(o.phone)!==s(o.desktop))return!0;continue}if(bo(r))return!0}return!1}function Xn(e,t){if(Ve(e))return!0;for(const r of Object.values(t))if(Ve(r.collectionRows))return!0;return!1}const Jn=parseInt(Ze,10),qn=parseInt(Qe,10),_o=Jn+1,Co=qn+1;function vo(e){const t=`.${e}-phone`,r=`.${e}-tablet`,o=`.${e}-desktop`;return`
1
+ "use strict";var Dr=Object.defineProperty;var xr=(e,t,r)=>t in e?Dr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var at=(e,t,r)=>xr(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("svelte/internal/disclose-version");const Lr=require("svelte/internal/client"),We=require("svelte");function kr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const n=kr(Lr),ee="default";function He(e,t){return!(e!=null&&e.length)||e===ee?t:`${e}/${t}`}const Rr=`RuleCMS widget: this widget config uses components from the default component library, but no "default" library is registered. The default library is registered by the consumer app: add the RuleCMS default source components package as a direct dependency and register it, e.g. libraries: { default: sourceComponentsModule } (statically imported for SSR) or libraries: { default: () => import('<default source components package>') }. See the @rulecms/widget-svelte README.`;function ct(e){if(!e||typeof e!="object")return!1;const t=e;return!!t.manifest&&typeof t.manifest=="object"&&!!t.components&&typeof t.components=="object"&&!Array.isArray(t.components)}function Or(e){if(ct(e))return e;const t=e;return ct(t==null?void 0:t.default)?t.default:null}function Re(e){return e.usesDefaultLibrary?[ee,...e.libraryIds]:[...e.libraryIds]}function dt({registrations:e,referenced:t}){if(t.usesDefaultLibrary&&!(e!=null&&e[ee]))throw new Error(Rr)}function Wr(e){const t=[],r=new Set;for(const o of e.values()){if(typeof o.stylesheet!="string")continue;const s=o.stylesheet.trim();!s||r.has(s)||(r.add(s),t.push(s))}return t.length>0?t:void 0}function _t(e){const t={};for(const[o,s]of e){const i=o===ee;for(const[l,a]of Object.entries(s.components))t[i?l:`${o}/${l}`]=a}const r=Wr(e);return r?{components:t,stylesheets:r}:{components:t}}function se(){const e=new Map,t=new Map,r=new Map,o=new Map;let s=0;function i(d,c){var f;e.get(d)!==c&&((f=c.manifest)!=null&&f.id&&c.manifest.id!==d&&console.warn(`RuleCMS widget: component library registered as "${d}" declares manifest id "${c.manifest.id}". The registered id wins for resolution.`),e.set(d,c),s+=1)}function l(d){const c=Re(d),f=[...c].sort().join("|"),p=o.get(f);if(p&&p.loadedVersion===s)return p.plugin;const g=new Map;for(const A of c){const b=e.get(A);b&&g.set(A,b)}const E=_t(g);return o.set(f,{loadedVersion:s,plugin:E}),E}function a(d){dt(d);const{registrations:c,referenced:f}=d;for(const p of Re(f)){if(e.has(p)||r.has(p))continue;const g=c==null?void 0:c[p];if(!g){console.error(`RuleCMS widget: no component library registered for libraryId "${p}"; its components will not render.`),r.set(p,new Error(`No registration for libraryId "${p}"`));continue}if(typeof g=="function")return null;i(p,g)}return l(f)}async function u(d){dt(d);const{registrations:c,referenced:f}=d,p=Re(f);return await Promise.all(p.map(async g=>{if(e.has(g)||r.has(g))return;const E=c==null?void 0:c[g];if(!E){console.error(`RuleCMS widget: no component library registered for libraryId "${g}"; its components will not render.`),r.set(g,new Error(`No registration for libraryId "${g}"`));return}if(typeof E!="function"){i(g,E);return}let A=t.get(g);A||(A=E().then(b=>{const _=Or(b);if(!_)throw new Error(`Registration for libraryId "${g}" did not resolve to a ComponentLibraryModule (expected { manifest, components }).`);i(g,_)}).catch(b=>{r.set(g,b),console.error(`RuleCMS widget: failed to load component library "${g}":`,b)}).finally(()=>{t.delete(g)}),t.set(g,A)),await A})),l(f)}return{resolveSync:a,resolve:u}}const Ne={Preview:"Preview",Compose:"Compose",RenderedPage:"RenderedPage"},_e={DroppableBox:"droppable-box"},Me={FlexStart:"flex-start",FlexEnd:"flex-end",Center:"center",SpaceBetween:"space-between",SpaceAround:"space-around",SpaceEvenly:"space-evenly"},Nr={FlexStart:"flex-start",FlexEnd:"flex-end",Center:"center",SpaceBetween:"space-between",SpaceAround:"space-around",SpaceEvenly:"space-evenly",Stretch:"stretch"},pe="cssAttrArray",Mr={Phone:"phone",Tablet:"tablet",Desktop:"desktop"},ze={ComposerComponent:"ComposerWidget",Collection:"Collection",MoveComponentHandle:"MoveWidgetHandle"},Ge=`${ze.Collection}_`,Ct="dev.",vt="https://rulecms.com",At="https://widget-cache.rulecms.com",Et="/api/v1/c/widget/get",wt="/api/v1/c/dev/widget/get",St="/api/v1/c/widget/resolve",Tt="/api/v1/c/dev/widget/resolve";function z(e){return typeof e=="string"&&e.startsWith(Ct)}function Ye(e,t){return t?t.replace(/\/$/,""):z(e)?vt:At}function Xe({publishedKey:e,token:t,endpoint:r}){const o=z(t),s=o?wt:Et,i=o?new URLSearchParams({widgetKey:e,token:t}):new URLSearchParams({publishedKey:e,token:t});return`${Ye(t,r)}${s}?${i.toString()}`}function Je({token:e,endpoint:t}){const r=z(e)?Tt:St;return`${Ye(e,t)}${r}`}const jr=({id:e,prefix:t})=>`${t}_${e}`,It=e=>{if(!(e!=null&&e.length)||!e.includes("_")){console.error(`Invalid drag item id: ${e}. Type does not exist.`);return}return Pt(e)},qe=e=>e.includes("_"),Pt=e=>{const t=e.indexOf("_"),r=e.substring(0,t),o=e.substring(t+1);return{prefix:r,id:o}},Ze=e=>{if(!qe(e))return;const r=It(e);return(r==null?void 0:r.prefix)===ze.Collection||console.error("getCollectionIdForCollectionType - Invalid component type: ${componentType}. Invalid prefix type."),r==null?void 0:r.id},Vr=e=>{if(!(e!=null&&e.length)){console.error("getNameAndInstanceIdFromWidgetKey: Missing widget key");return}const t=e.split("$");if(t.length<2){console.error("getNameAndInstanceIdFromWidgetKey: Invalid widget key format");return}const r=t[0];if(!t[1].includes("@"))return{name:r,instanceId:t[1]};const s=t[1].split("@");return{name:r,instanceId:s[0],parentId:s[1]}},Fr=e=>{if(!(e!=null&&e.length))return{errorMessage:"getNameFromWidgetKey: Missing widget key"};const t=e.split("$");return t.length<2?{errorMessage:"getNameFromWidgetKey: Invalid widget key format"}:{name:t[0]}},Dt=e=>{var s,i,l,a;if(!e)return{error:"getWidgetKeyForCollection: Missing collection"};if(!((s=e.name)!=null&&s.length))return{error:"getWidgetKeyForCollection: Missing collection name"};const t=(i=e.name)==null?void 0:i.trim().toLowerCase();if(!((l=e.id)!=null&&l.length))return{error:"getWidgetKeyForCollection: Missing collection id"};const o=((a=e.parentId)==null?void 0:a.length)?`${e.id}@${e.parentId}`:`${e.id}`;return{data:`${t}$${o}`}},xt=e=>{var s,i,l,a;if(!e)return{error:"getWidgetKeyForPublishedCollection: Missing collection"};if(!((s=e.name)!=null&&s.length))return{error:"getWidgetKeyForPublishedCollection: Missing collection name"};const t=(i=e.name)==null?void 0:i.trim().toLowerCase();if(!((l=e.publishedKey)!=null&&l.length))return{error:"getWidgetKeyForPublishedCollection: Missing collection publishedKey"};const o=((a=e.parentId)==null?void 0:a.length)?`${e.publishedKey}@${e.parentId}`:`${e.publishedKey}`;return{data:`${t}$${o}`}},Kr=e=>{const t=Dt(e);return`${Ge}${t.data}`},Br=e=>{const t=xt(e);return`${Ge}${t.data}`},me="---",Lt="___";function kt(e,t){return`${e}${me}${t}`}function Ur(e,t,r){return`${kt(e,t)}${Lt}${r}`}function Hr(e){const t=e.split(".");if(t.length!==3)throw new Error(`Invalid version format: ${e}. Expected format: x.y.z`);const r=t[0],o=t[1],s=parseInt(t[2],10);if(isNaN(s))throw new Error(`Invalid patch version: ${t[2]}. Expected a number.`);return`${r}.${o}.${s+1}`}function Ce({displayItemList:e,widgetCollections:t}){const r=new Set;let o=!1;const s=i=>{var l,a,u;if((l=i==null?void 0:i.rows)!=null&&l.length){for(const d of i.rows)if((a=d==null?void 0:d.columns)!=null&&a.length)for(const c of d.columns)c.collection&&s(c.collection.collectionRows),!(!c.type||c.type===_e.DroppableBox)&&(qe(c.type)||(!((u=c.libraryId)!=null&&u.length)||c.libraryId===ee?o=!0:r.add(c.libraryId)))}};s(e);for(const i of Object.values(t??{}))s(i==null?void 0:i.collectionRows);return{libraryIds:Array.from(r),usesDefaultLibrary:o}}const Qe=Symbol("rulecms-widget-context");function zr(){return{token:"",endpoint:void 0,libraries:void 0,libraryRegistry:se()}}function Gr(e,t){n.push(t,!0);const r=n.proxy(zr());function o(){r.token=t.token,r.endpoint=t.endpoint,r.libraries=t.libraries}o(),n.user_effect(o),We.setContext(Qe,r);var s=n.comment(),i=n.first_child(s);n.snippet(i,()=>t.children),n.append(e,s),n.pop()}const Rt="1200px",$e="500px",et="820px",Yr=Rt,Ot="rulecms",Xr=1920,Jr={f:"auto",q:"auto",c:"limit"},qr=/^[A-Za-z0-9][A-Za-z0-9._\-/]*$/,Zr=300,Qr=/^[A-Za-z0-9][A-Za-z0-9_-]*$/,$r=100,eo=/^https:\/\/[^\s"'()\\<>]+$/,to=2e3,no=/^[A-Za-z0-9_,.:\-/]*$/,ro=300,Wt=e=>typeof e=="string"&&e.length<=Zr&&qr.test(e),Nt=e=>typeof e=="string"&&e.length<=$r&&Qr.test(e),Mt=e=>typeof e=="string"&&e.length<=to&&eo.test(e),jt=e=>typeof e=="string"&&e.length<=ro&&no.test(e),oo=e=>Object.entries(e).map(([t,r])=>`${t}_${r}`).join(","),so=e=>{const t={};for(const r of e.split(",")){const o=r.trim(),s=o.indexOf("_");s<=0||(t[o.slice(0,s)]=o.slice(s+1))}return t},Vt=({publicId:e,cloudName:t=Ot,transformations:r,width:o=Xr})=>{const s=typeof r=="string"?so(r):r,i={...Jr,...s,w:o};return encodeURI(`https://res.cloudinary.com/${t}/image/upload/${oo(i)}/${e}`)},Ft=/^--[A-Za-z0-9_-]+$/,Kt=200,Z=e=>{if(typeof e!="string")return!1;const t=e.trim();return t.length<=Kt&&Ft.test(t)},K=e=>`var(${e.trim()})`,L=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e.cssVariable;if(t!=null)return Z(t)?t.trim():void 0},U=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e.cssVariable;return t==null?!1:!Z(t)},io=(e,t)=>{const r=L(e);return r?{[t]:K(r)}:void 0},Bt=e=>{if(typeof e!="object"||e===null||Array.isArray(e)||U(e))return!1;if(L(e))return!0;const t=e;return t.source==="none"?!0:t.source==="url"?Mt(t.url):t.source==="cloudinary"?!Wt(t.publicId)||t.cloudName!==void 0&&t.cloudName!==null&&!Nt(t.cloudName)?!1:t.transformations===void 0||t.transformations===null||jt(t.transformations):!1},Ut=["px","%","em","rem","vh","vw"],ve=["inherit","unset"],Ht=["allSides","top","right","bottom","left"],J=(e,t={})=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const r=e;return U(e)?!1:L(e)?!0:r.unit==="auto"?t.allowAuto!==!1:r.unit==="keyword"?t.allowKeywords!==!1&&ve.includes(r.keyword):Ut.includes(r.unit)?typeof r.value!="number"||!Number.isFinite(r.value)?!1:t.allowNegative!==!1||r.value>=0:!1},zt=(e,t={})=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const r=e;for(const o of Ht){const s=r[o];if(s!=null&&!J(s,t))return!1}return!0},lo=[...ve,"transparent","currentColor"],ao=/^(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/,Ae=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return U(e)?!1:L(e)?!0:t.unit==="keyword"?lo.includes(t.keyword):t.unit==="color"?typeof t.value=="string"&&ao.test(t.value.trim()):!1},Ee=e=>{const t=L(e);return t?K(t):"unit"in e?e.unit==="keyword"?e.keyword:e.value.trim():""},Gt=(e,t)=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!U(e)&&!!L(e):typeof e!="string"||!e.length?!1:t.includes(e)?!0:ve.includes(e),Yt=['system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif','Georgia, "Times New Roman", Times, serif',"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace","Arial, Helvetica, sans-serif",'"Helvetica Neue", Helvetica, Arial, sans-serif',"Verdana, Geneva, sans-serif"],Xt=["normal","bold","100","200","300","400","500","600","700","800","900"],Jt=["normal","italic","oblique"],qt=["left","center","right","justify","start","end"],Zt=["none","underline","line-through","overline"],Qt=["none","uppercase","lowercase","capitalize"],fe=["visible","hidden","scroll","auto","clip"],$t=["auto","none"],en=["flex-start","flex-end","center","space-between","space-around","space-evenly"],tn=["flex-start","flex-end","center","baseline","stretch"],nn=["wrap","nowrap"],rn=["flex-start","flex-end","center","space-between","space-around","space-evenly","stretch"],on=["row","row-reverse","column","column-reverse"],sn=["cover","contain","auto"],ln=["center center","center top","center bottom","left center","left top","left bottom","right center","right top","right bottom"],an=["no-repeat","repeat","repeat-x","repeat-y","space","round"],cn=["justifyContent","alignItems","flexWrap","alignContent","flexDirection"],dn=["none","solid","dashed","dotted","double","groove","ridge","inset","outset"],un=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!U(e)&&!!L(e):dn.includes(e),fn=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return U(e)?!1:L(e)?!0:!(t.width!==void 0&&t.width!==null&&!J(t.width,{allowAuto:!1,allowNegative:!1})||t.style!==void 0&&t.style!==null&&!un(t.style)||t.color!==void 0&&t.color!==null&&!Ae(t.color))},co={allowAuto:!1,allowKeywords:!1,allowNegative:!0},uo={allowAuto:!1,allowKeywords:!1,allowNegative:!1},gn=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;if(U(e))return!1;if(L(e))return!0;for(const r of["offsetX","offsetY","spread"]){const o=t[r];if(o!=null&&!J(o,co))return!1}return!(t.blur!==void 0&&t.blur!==null&&!J(t.blur,uo)||t.color!==void 0&&t.color!==null&&!Ae(t.color)||t.inset!==void 0&&t.inset!==null&&typeof t.inset!="boolean")},pn=e=>e?e.cssVariable!==void 0&&e.cssVariable!==null||e.offsetX!==void 0||e.offsetY!==void 0||e.blur!==void 0||e.spread!==void 0||e.color!==void 0:!1,mn=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return U(e)?!1:L(e)?!0:t.unit==="number"?typeof t.value=="number"&&Number.isFinite(t.value)&&t.value>0:J(e,{allowAuto:!1,allowNegative:!1})},yn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!U(e)&&!!L(e):typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1,hn=e=>{if(!Bt(e))return{};const t=L(e);if(t)return{backgroundImage:K(t)};const r=e;return r.source==="none"?{backgroundImage:"none"}:r.source==="url"?{backgroundImage:`url("${r.url}")`}:{backgroundImage:`url("${Vt({publicId:r.publicId,cloudName:r.cloudName,transformations:r.transformations})}")`}},q=e=>{const t=L(e);return t?K(t):"unit"in e?e.unit==="auto"?"auto":e.unit==="keyword"?e.keyword:`${e.value}${e.unit}`:""},bn=e=>{if(!fn(e))return{};const t=L(e);if(t)return{border:K(t)};const r={};if(e.width&&(r.borderWidth=q(e.width)),e.style){const o=L(e.style);r.borderStyle=o?K(o):e.style}return e.color&&(r.borderColor=Ee(e.color)),r},de=e=>e?q(e):"0px",_n=e=>{if(!gn(e)||!pn(e))return{};const t=L(e);if(t)return{boxShadow:K(t)};const r=[de(e.offsetX),de(e.offsetY),de(e.blur),de(e.spread)];return e.color&&r.push(Ee(e.color)),e.inset&&r.unshift("inset"),{boxShadow:r.join(" ")}},fo=e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`,Cn=(e,t)=>{if(!zt(e))return{};if(e.allSides)return{[t]:q(e.allSides)};const r={};for(const o of["top","right","bottom","left"]){const s=e[o];s&&(r[`${t}${fo(o)}`]=q(s))}return r},vn=(e,t)=>Ae(e)?{[t]:Ee(e)}:{},An=(e,t,r)=>{if(!Gt(e,r))return{};const o=L(e);return o?{[t]:K(o)}:{[t]:e}},En=(e,t,r={})=>J(e,r)?{[t]:q(e)}:{},wn=e=>{if(!mn(e))return{};const t=L(e);return t?{lineHeight:K(t)}:"unit"in e&&e.unit==="number"?{lineHeight:e.value}:{lineHeight:q(e)}},Sn=e=>{if(!yn(e))return{};const t=L(e);return t?{opacity:K(t)}:{opacity:e}},we={"margin-3-resolutions":{kind:"boxSpacing",cssProperty:"margin"},"padding-3-resolutions":{kind:"boxSpacing",cssProperty:"padding"},"border-3-resolutions":{kind:"border"},"box-shadow-3-resolutions":{kind:"boxShadow"},"border-radius-3-resolutions":{kind:"length",cssProperty:"borderRadius",capabilities:{allowAuto:!1,allowNegative:!1}},"width-3-resolutions":{kind:"length",cssProperty:"width",capabilities:{allowAuto:!0,allowNegative:!1}},"height-3-resolutions":{kind:"length",cssProperty:"height",capabilities:{allowAuto:!0,allowNegative:!1}},"min-width-3-resolutions":{kind:"length",cssProperty:"minWidth",capabilities:{allowAuto:!1,allowNegative:!1}},"max-width-3-resolutions":{kind:"length",cssProperty:"maxWidth",capabilities:{allowAuto:!1,allowNegative:!1}},"min-height-3-resolutions":{kind:"length",cssProperty:"minHeight",capabilities:{allowAuto:!1,allowNegative:!1}},"max-height-3-resolutions":{kind:"length",cssProperty:"maxHeight",capabilities:{allowAuto:!1,allowNegative:!1}},"gap-3-resolutions":{kind:"length",cssProperty:"gap",capabilities:{allowAuto:!1,allowNegative:!1}},"justify-content-3-resolutions":{kind:"enum",cssProperty:"justifyContent",allowedValues:en},"align-items-3-resolutions":{kind:"enum",cssProperty:"alignItems",allowedValues:tn},"flex-wrap-3-resolutions":{kind:"enum",cssProperty:"flexWrap",allowedValues:nn},"align-content-3-resolutions":{kind:"enum",cssProperty:"alignContent",allowedValues:rn},"flex-direction-3-resolutions":{kind:"enum",cssProperty:"flexDirection",allowedValues:on},"overflow-3-resolutions":{kind:"enum",cssProperty:"overflow",allowedValues:fe},"overflow-x-3-resolutions":{kind:"enum",cssProperty:"overflowX",allowedValues:fe},"overflow-y-3-resolutions":{kind:"enum",cssProperty:"overflowY",allowedValues:fe},"pointer-events-3-resolutions":{kind:"enum",cssProperty:"pointerEvents",allowedValues:$t},"background-color-3-resolutions":{kind:"color",cssProperty:"backgroundColor"},"color-3-resolutions":{kind:"color",cssProperty:"color"},"background-image-3-resolutions":{kind:"backgroundImage"},"background-size-3-resolutions":{kind:"enum",cssProperty:"backgroundSize",allowedValues:sn},"background-position-3-resolutions":{kind:"enum",cssProperty:"backgroundPosition",allowedValues:ln},"background-repeat-3-resolutions":{kind:"enum",cssProperty:"backgroundRepeat",allowedValues:an},"opacity-3-resolutions":{kind:"opacity"},"font-family-3-resolutions":{kind:"enum",cssProperty:"fontFamily",allowedValues:Yt},"font-size-3-resolutions":{kind:"length",cssProperty:"fontSize",capabilities:{allowAuto:!1,allowNegative:!1}},"font-weight-3-resolutions":{kind:"enum",cssProperty:"fontWeight",allowedValues:Xt},"font-style-3-resolutions":{kind:"enum",cssProperty:"fontStyle",allowedValues:Jt},"line-height-3-resolutions":{kind:"lineHeight"},"letter-spacing-3-resolutions":{kind:"length",cssProperty:"letterSpacing",capabilities:{allowAuto:!1,allowNegative:!0}},"text-align-3-resolutions":{kind:"enum",cssProperty:"textAlign",allowedValues:qt},"text-decoration-3-resolutions":{kind:"enum",cssProperty:"textDecoration",allowedValues:Zt},"text-transform-3-resolutions":{kind:"enum",cssProperty:"textTransform",allowedValues:Qt}},Tn=(e,t)=>{const r=we[e];if(!r)return{};switch(r.kind){case"boxSpacing":return Cn(t,r.cssProperty);case"length":return En(t,r.cssProperty,r.capabilities);case"border":return bn(t);case"boxShadow":return _n(t);case"color":return vn(t,r.cssProperty);case"opacity":return Sn(t);case"enum":return An(t,r.cssProperty,r.allowedValues);case"lineHeight":return wn(t);case"backgroundImage":return hn(t);default:return{}}},go=Object.fromEntries(Object.entries(we).filter(([,e])=>e.kind==="boxSpacing").map(([e,t])=>[e,t.cssProperty])),po=e=>e!=null&&e!=="",In=e=>e?!cn.some(r=>po(e[r]))||e.display==="flex"?e:{...e,display:"flex"}:{},Pn=({dbEntryType:e,libraryId:t,sourceComponentsPlugin:r})=>{if(!(e!=null&&e.length))return;const o=r.components[He(t,e)];if(!o||!("defaultAttributeValues"in o))return;const i=o.defaultAttributeValues;if(i!=null&&i.length)return i.reduce((l,a)=>({...l,[a.name]:a.defaultValues}),{})},G=({deviceDisplayType:e,componentAttributes:t})=>{if(!t)return;const r={},o={};for(const[s,i]of Object.entries(t)){if(!s.includes("3-resolutions")||!i)continue;const l=i.all,a=l??i[e.toLowerCase()];o[s]=a,we[s]&&Object.assign(r,Tn(s,a))}return Object.keys(r).length||Object.keys(o).length?{styles:Object.keys(r).length?r:void 0,componentAttributesSpecificToDeviceType:Object.keys(o).length?o:void 0}:void 0},Dn=({defaultAttributes:e,userModifiedAttributes:t})=>e?t?{...e,...t}:e:t;function oe(e){return e.componentAttributes??e.widgetAttributes}function je({col:e,deviceDisplayType:t,isComposeMode:r,sourceComponentsPlugin:o}){const s=oe(e),i=Pn({dbEntryType:e.type,libraryId:e.libraryId,sourceComponentsPlugin:o})||[],l=Dn({defaultAttributes:i,userModifiedAttributes:s}),{styles:a,componentAttributesSpecificToDeviceType:u}=G({deviceDisplayType:t,componentAttributes:l})||{styles:void 0,componentAttributesSpecificToDeviceType:void 0};let d={};const c={};if(a)for(const[g,E]of Object.entries(a))r&&c[g]||(d={...d,[g]:E});let f=oe(e);for(const g in u)if(g.includes("3-resolutions")){f={...oe(e)||{},...u||{}};break}const p=In(d);if(r&&p.pointerEvents!==void 0){const g={...p};return delete g.pointerEvents,{componentAttributesBasedOnDevice:f,componentStyles:g}}return{componentAttributesBasedOnDevice:f,componentStyles:p}}const xn=e=>{const t=(e==null?void 0:e.rows)||[];for(const r of t)if(((r==null?void 0:r.columns)||[]).length>0)return!0;return(e==null?void 0:e.containerAttributes)&&Object.keys(e.containerAttributes).length>0},Ln="var(--sl-spacing-x-small)";function kn(e){return e!=null&&e.horizontalAlignment||e!=null&&e.verticalAlignment||e!=null&&e.flexWrap||e!=null&&e.gap||e!=null&&e.alignContent?!0:!!(e!=null&&e.rowAttributes&&Object.keys(e.rowAttributes).length>0)}function Rn({row:e,deviceDisplayType:t}){var o;const r=G({deviceDisplayType:t,componentAttributes:e.rowAttributes});return((o=r==null?void 0:r.componentAttributesSpecificToDeviceType)==null?void 0:o["hide-component-3-resolutions"])==="true"}function On({row:e,deviceDisplayType:t,isComposeMode:r}){var g;const o=((g=G({deviceDisplayType:t,componentAttributes:e.rowAttributes}))==null?void 0:g.styles)||{},s=o.justifyContent??e.horizontalAlignment??Me.Center,i=o.alignItems??e.verticalAlignment??Me.Center,l=o.flexDirection??"row",a=o.gap??e.gap??Ln,u=r?"nowrap":o.flexWrap??e.flexWrap??"nowrap",d=o.alignContent??e.alignContent??void 0,c=new Set(["justifyContent","alignItems","flexDirection","gap","flexWrap","alignContent","display"]),f={};for(const[E,A]of Object.entries(o))c.has(E)||(f[E]=A);const p={display:"flex",flexDirection:l,gap:a,flexWrap:u,justifyContent:s,alignItems:i,...f};return d!==void 0&&(p.alignContent=d),p}const Se="css-classes-3-resolutions",mo=500,yo=/[\x00-\x1f\x7f]/g,Te=e=>{if(typeof e!="string")return;const t=new Set,r=[];for(const s of e.split(/\s+/)){const i=s.replace(yo,"");i&&(t.has(i)||(t.add(i),r.push(i)))}if(!r.length)return;let o="";for(const s of r){const i=o?`${o} ${s}`:s;if(i.length>mo)break;o=i}return o.length?o:void 0},tt="hide-component-3-resolutions",Wn="pointer-events-3-resolutions",Nn=["width-3-resolutions","min-width-3-resolutions","max-width-3-resolutions","height-3-resolutions","min-height-3-resolutions","max-height-3-resolutions","margin-3-resolutions","padding-3-resolutions","border-3-resolutions","border-radius-3-resolutions","box-shadow-3-resolutions","overflow-3-resolutions","overflow-x-3-resolutions","overflow-y-3-resolutions",tt,Wn],ho=new Set(Nn);function Ie({containerAttributes:e,deviceDisplayType:t}){var o;const r=G({deviceDisplayType:t,componentAttributes:e});return((o=r==null?void 0:r.componentAttributesSpecificToDeviceType)==null?void 0:o[tt])==="true"}function nt({containerAttributes:e,deviceDisplayType:t,isComposeMode:r}){var i;if(!e)return{styles:{}};const o=r?Object.fromEntries(Object.entries(e).filter(([l])=>!ho.has(l))):e,s=G({deviceDisplayType:t,componentAttributes:o});return{styles:(s==null?void 0:s.styles)??{},cssClasses:Te((i=s==null?void 0:s.componentAttributesSpecificToDeviceType)==null?void 0:i[Se])}}function Mn(e){return Object.keys(e.styles).length>0||!!e.cssClasses}function rt({containerAttributes:e,widgetContainerStyles:t}){return((e==null?void 0:e[pe])||[]).some(o=>o.toLowerCase().startsWith("height:"))||t.styles.height!==void 0}const jn="z-index-3-resolutions",ot=0;function Vn(e){var t,r;return!!((r=(t=e==null?void 0:e.overlayLayers)==null?void 0:t.layers)!=null&&r.length)}function Ve({containerAttributes:e,deviceDisplayType:t}){var s;const r=G({deviceDisplayType:t,componentAttributes:e}),o=(s=r==null?void 0:r.componentAttributesSpecificToDeviceType)==null?void 0:s[jn];if(typeof o=="number"&&Number.isFinite(o))return o;if(typeof o=="string"&&o.trim().length){const i=Number(o);if(Number.isFinite(i))return i}return ot}function Fn(e,t){return e+t+1}function Kn({containerAttributes:e,deviceDisplayType:t}){var s;const r=G({deviceDisplayType:t,componentAttributes:e}),o=(s=r==null?void 0:r.styles)==null?void 0:s.pointerEvents;return typeof o=="string"?o:void 0}function Bn({layer:e,deviceDisplayType:t}){var r;return(r=e==null?void 0:e.rows)!=null&&r.length?Ie({containerAttributes:e.containerAttributes,deviceDisplayType:t}):!0}function Un({isWithinCollection:e,baseDeclaresOwnHeight:t,baseZIndex:r}){return{position:"relative",isolation:"isolate",display:"flex",flexDirection:"column",...t?{}:{height:e?"auto":"100%"},...r===ot?{}:{zIndex:r}}}function Hn({zIndex:e,pointerEvents:t}){return{position:"absolute",top:0,left:0,width:"100%",height:"100%",boxSizing:"border-box",zIndex:e,...t?{pointerEvents:t}:{}}}function W(e){if(!e)return;const t=[];for(const[r,o]of Object.entries(e)){if(o==null||o==="")continue;const s=r.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`);t.push(`${s}: ${o}`)}return t.length>0?t.join("; "):void 0}const ie="/";function zn({componentProps:e,ancestorColumnIds:t,columnId:r}){if(!e||!r)return;const o=[...t??[],r];for(let s=0;s<o.length;s+=1){const i=o.slice(s).join(ie),l=e[i];if(l)return l}}const Fe="placeholderValues";function Gn({widgetInstanceProps:e,placeholderValues:t}){return t===void 0||e!=null&&Object.prototype.hasOwnProperty.call(e,Fe)?e:{...e,[Fe]:t}}function Yn({displayItemList:e,widgetCollections:t}){const r=[],o=(s,i)=>{var l;if((l=s==null?void 0:s.rows)!=null&&l.length)for(const a of s.rows)for(const u of a.columns){if(!u.id||u.type===_e.DroppableBox)continue;const d=Ze(u.type);if(d!=null&&d.length){const c=u.collection??(t==null?void 0:t[d]);c&&!i.includes(u.id)&&o(c.collectionRows,[...i,u.id]);continue}r.push([...i,u.id].join(ie))}};return o(e,[]),r}function bo(e,t){const r=`${ie}${e}`;return t.some(o=>o===e||o.endsWith(r))}function Xn({componentProps:e,displayItemList:t,widgetCollections:r}){const o=e?Object.keys(e):[];if(!o.length)return[];const s=Yn({displayItemList:t,widgetCollections:r});return o.filter(i=>!bo(i,s))}function Jn({componentProps:e,displayItemList:t,widgetCollections:r,publishedKey:o}){if(process.env.NODE_ENV==="production")return;const s=Xn({componentProps:e,displayItemList:t,widgetCollections:r});s.length&&console.warn(`RuleCMSWidget "${o}": componentProps ${s.map(i=>`"${i}"`).join(", ")} ${s.length===1?"matches":"match"} no component in this widget, so those props were not passed to anything. Keys are column ids from the widget config — the composer's Modify drawer shows the id of the selected component.`)}function _o(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Co(e){if(e.all!==void 0&&e.all!==null)return!1;const t=e.phone,r=e.tablet,o=e.desktop;return t!==r||t!==o||r!==o}function Ke(e){var t,r;if(!((t=e==null?void 0:e.rows)!=null&&t.length))return!1;if(Oe(e.containerAttributes))return!0;for(const o of e.rows){if(Oe(o.rowAttributes))return!0;for(const s of o.columns)if(Oe(oe(s)))return!0}for(const o of((r=e.overlayLayers)==null?void 0:r.layers)??[])if(Ke(o))return!0;return!1}function Oe(e){if(!e)return!1;for(const[t,r]of Object.entries(e))if(!(!t.includes("3-resolutions")||!_o(r))){if(t==="hide-component-3-resolutions"){const o=r,s=i=>i==="true"||i===!0;if(s(o.phone)!==s(o.tablet)||s(o.phone)!==s(o.desktop))return!0;continue}if(Co(r))return!0}return!1}function qn(e,t){if(Ke(e))return!0;for(const r of Object.values(t))if(Ke(r.collectionRows))return!0;return!1}const Zn=parseInt($e,10),Qn=parseInt(et,10),vo=Zn+1,Ao=Qn+1;function Eo(e){const t=`.${e}-phone`,r=`.${e}-tablet`,o=`.${e}-desktop`;return`
2
2
  ${t}, ${r}, ${o} { display: none; }
3
- @media (max-width: ${Jn}px) { ${t} { display: block; } }
4
- @media (min-width: ${_o}px) and (max-width: ${qn}px) { ${r} { display: block; } }
5
- @media (min-width: ${Co}px) { ${o} { display: block; } }
6
- `.trim()}function fe(e){if(!e)throw new Error("Source components plugin is required, but no plugins were provided");const t=e.sourceComponents;if(!t)throw new Error("Source components plugin is required, but was not found in plugins object");if(!t.components)throw new Error("Source components plugin is missing required property: components");if(typeof t.components!="object"||t.components===null||Array.isArray(t.components))throw new Error("Source components plugin components must be an object (Record<string, LibraryComponentEntry>)");return t}let Ao=0;var Eo=n.from_html("<div><!> <!></div>");function wo(e,t){n.push(t,!0);let r=n.prop(t,"isComposeMode",3,!1),o=n.prop(t,"showDropContainers",3,!1),s=n.prop(t,"isWithinCollection",3,!1),i=n.prop(t,"deviceDisplayType",3,"Desktop");const l=`rulecms-vc-${++Ao}`;function a(h,C,v){const w=h&&!v?3:1;return!!(C!=null&&C.length)&&C.length>w}const d=n.derived(()=>{var h;return(((h=t.displayItemList.containerAttributes)==null?void 0:h[ge])||[]).join(`;
7
- `)}),u=n.derived(()=>n.get(d)?`.${l} {
8
- ${n.get(d)}
9
- }`:""),c=n.derived(()=>!r()&&Te({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:i()})),f=n.derived(()=>et({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:i(),isComposeMode:r()})),p=n.derived(()=>{var v;const h=((v=t.displayItemList.containerAttributes)==null?void 0:v[ge])||[],C=Wn(n.get(f));return r()&&!s()||o()||h.length>0||C||a(r(),t.displayItemList.rows,s())}),g=n.derived(()=>[n.get(d)?l:void 0,n.get(f).cssClasses].filter(Boolean).join(" ")),E=n.derived(()=>({...tt({containerAttributes:t.displayItemList.containerAttributes,widgetContainerStyles:n.get(f)})?{}:{height:s()?"auto":"100%"},display:"flex",flexDirection:"column",...n.get(f).styles})),A=n.derived(()=>n.get(p)?n.get(g):""),b=n.derived(()=>n.get(c)?{display:"none"}:n.get(p)?n.get(E):{display:"contents"});var _=Eo(),T=n.child(_);{var W=h=>{var C=n.comment(),v=n.first_child(C);n.element(v,()=>"style",!1,(w,D)=>{var x=n.text();n.template_effect(()=>n.set_text(x,n.get(u))),n.append(D,x)}),n.append(h,C)};n.if(T,h=>{n.get(d)&&h(W)})}var H=n.sibling(T,2);n.snippet(H,()=>t.children),n.reset(_),n.template_effect(h=>{n.set_attribute(_,"hidden",n.get(c)||void 0),n.set_class(_,1,n.clsx(n.get(A)||void 0)),n.set_style(_,h)},[()=>O(n.get(b))]),n.append(e,_),n.pop()}var So=n.from_html("<div><!></div>");function To(e,t){n.push(t,!0);let r=n.prop(t,"isComposeMode",3,!1),o=n.prop(t,"showDropContainers",3,!1),s=n.prop(t,"isWithinCollection",3,!1),i=n.prop(t,"deviceDisplayType",3,"Desktop");function l(A,b,_){var W;const T=A&&!_?3:1;return!!((W=b==null?void 0:b.columns)!=null&&W.length)&&b.columns.length>T}const a=n.derived(()=>!r()&&Ln({row:t.row,deviceDisplayType:i()})),d=n.derived(()=>o()||xn(t.row)||l(r(),t.row,s())),u=n.derived(()=>kn({row:t.row,deviceDisplayType:i(),isComposeMode:r()})),c=n.derived(()=>{var b;const A=Y({deviceDisplayType:i(),componentAttributes:t.row.rowAttributes});return Se((b=A==null?void 0:A.componentAttributesSpecificToDeviceType)==null?void 0:b[we])??""}),f=n.derived(()=>n.get(d)?n.get(c):""),p=n.derived(()=>n.get(a)?{display:"none"}:n.get(d)?n.get(u):{display:"contents"});var g=So(),E=n.child(g);n.snippet(E,()=>t.children),n.reset(g),n.template_effect(A=>{n.set_attribute(g,"hidden",n.get(a)||void 0),n.set_class(g,1,n.clsx(n.get(f)||void 0)),n.set_style(g,A)},[()=>O(n.get(p))]),n.append(e,g),n.pop()}const Zn=["minWidth","maxWidth","minHeight","maxHeight","margin","marginTop","marginRight","marginBottom","marginLeft","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","borderWidth","borderStyle","borderColor","border","borderRadius","boxShadow","width","height","gap","display","justifyContent","alignItems","flexWrap","alignContent","flexDirection","overflow","overflowX","overflowY","backgroundColor","backgroundImage","backgroundSize","backgroundPosition","backgroundRepeat","opacity","fontFamily","fontSize","fontWeight","fontStyle","color","lineHeight","letterSpacing","textAlign","textDecoration","textTransform"],Io=e=>e!=null&&e!=="",Po=e=>e?Zn.reduce((t,r)=>{const o=e[r];return Io(o)&&(t[r]=o),t},{}):{},Do=e=>{if(!e)return;const t={...e};for(const r of Zn)delete t[r];return Object.keys(t).length?t:void 0},xo=e=>Object.keys(e).length>0,Lo=(e,t)=>{const r=(e==null?void 0:e.noContainer)??!1,o=e==null?void 0:e.resolveNoContainer;if(typeof o!="function")return r;try{const s=o(t);if(typeof s=="boolean")return s;console.error(`resolveNoContainer: component "${e==null?void 0:e.id}" returned ${typeof s} instead of a boolean; falling back to noContainer=${r}`)}catch(s){console.error(`resolveNoContainer: component "${e==null?void 0:e.id}" threw; falling back to noContainer=${r}`,s)}return r},ko=(e,t)=>{const r=e==null?void 0:e.resolveRendersOwnElement;if(typeof r!="function")return!1;try{const o=r(t);if(typeof o=="boolean")return o;console.error(`resolveRendersOwnElement: component "${e==null?void 0:e.id}" returned ${typeof o} instead of a boolean; falling back to false`)}catch(o){console.error(`resolveRendersOwnElement: component "${e==null?void 0:e.id}" threw; falling back to false`,o)}return!1};var ct=n.from_html("<div><!></div>");function Qn(e,t){n.push(t,!0);const r=n.derived(()=>t.components[Be(t.libraryId,t.componentType)]),o=n.derived(()=>{var _;const b=(_=n.get(r))==null?void 0:_.card;return b||(console.error(`DisplayComponent: Component with type ${t.componentType}${t.libraryId?` (library "${t.libraryId}")`:""} not found in components`),null)}),s=n.derived(()=>({componentAttributes:t.componentAttributes,styleProps:t.styleProps})),i=n.derived(()=>n.get(r)?Lo(n.get(r),n.get(s)):!1),l=n.derived(()=>Po(t.styleProps)),a=n.derived(()=>n.get(i)?Do(t.styleProps):t.styleProps),d=n.derived(()=>{var b;return Se((b=t.componentAttributes)==null?void 0:b[we])}),u=n.derived(()=>n.get(i)&&xo(n.get(l))),c=n.derived(()=>!n.get(i)||(n.get(r)?ko(n.get(r),n.get(s)):!1)),f=n.derived(()=>!n.get(u)&&n.get(c)?n.get(d):void 0),p=n.derived(()=>({componentAttributes:t.componentAttributes,styleProps:n.get(a),className:n.get(f),widgetInstanceProps:t.widgetInstanceProps,pageViewType:t.pageViewType,columnPath:t.columnPath,mounts:t.mounts}));var g=n.comment(),E=n.first_child(g);{var A=b=>{const _=n.derived(()=>n.get(o));var T=n.comment(),W=n.first_child(T);{var H=v=>{var w=ct(),D=n.child(w);n.component(D,()=>n.get(_),(x,k)=>{k(x,n.spread_props(()=>n.get(p)))}),n.reset(w),n.template_effect(x=>{n.set_class(w,1,n.clsx(n.get(d)||void 0)),n.set_style(w,x)},[()=>O(n.get(l))]),n.append(v,w)},h=v=>{var w=ct(),D=n.child(w);n.component(D,()=>n.get(_),(x,k)=>{k(x,n.spread_props(()=>n.get(p)))}),n.reset(w),n.template_effect(()=>n.set_class(w,1,n.clsx(n.get(d)))),n.append(v,w)},C=v=>{var w=n.comment(),D=n.first_child(w);n.component(D,()=>n.get(_),(x,k)=>{k(x,n.spread_props(()=>n.get(p)))}),n.append(v,w)};n.if(W,v=>{n.get(u)?v(H):!n.get(c)&&n.get(d)?v(h,1):v(C,-1)})}n.append(b,T)};n.if(E,b=>{n.get(o)&&b(A)})}n.append(e,g),n.pop()}var Ro=n.from_html("<div><!></div>"),Oo=n.from_html("<div><!> <!></div>");function me(e,t){n.push(t,!0);const r=h=>{wo(h,{get displayItemList(){return t.displayItemList},get isComposeMode(){return o()},get showDropContainers(){return i()},get isWithinCollection(){return s()},get deviceDisplayType(){return t.deviceDisplayType},children:(C,v)=>{var w=n.comment(),D=n.first_child(w);n.each(D,17,()=>t.displayItemList.rows,x=>x.id,(x,k)=>{To(x,{get row(){return n.get(k)},get isComposeMode(){return o()},get showDropContainers(){return i()},get isWithinCollection(){return s()},get deviceDisplayType(){return t.deviceDisplayType},children:($,te)=>{var ne=n.comment(),De=n.first_child(ne);n.each(De,17,()=>n.get(k).columns,re=>re.id,(re,V)=>{var ae=n.comment(),xe=n.first_child(ae);{var y=S=>{const P=n.derived(()=>p(n.get(V)));var N=n.comment(),R=n.first_child(N);{var K=z=>{{let J=n.derived(()=>g(n.get(V).id));me(z,{get displayItemList(){return n.get(P)},get isComposeMode(){return o()},isWithinCollection:!0,get widgetCollections(){return t.widgetCollections},get showDropContainers(){return i()},get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get plugins(){return t.plugins},get deviceDisplayType(){return t.deviceDisplayType},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues},get ancestorColumnIds(){return n.get(J)}})}},oe=z=>{{let J=n.derived(()=>f(n.get(V)).componentAttributes),ot=n.derived(()=>f(n.get(V)).styleProps),st=n.derived(()=>b(n.get(V).id)),I=n.derived(E),M=n.derived(()=>A(n.get(V).id));Qn(z,{get componentType(){return n.get(V).type},get libraryId(){return n.get(V).libraryId},get componentAttributes(){return n.get(J)},get components(){return n.get(l)},get styleProps(){return n.get(ot)},get widgetInstanceProps(){return n.get(st)},get pageViewType(){return n.get(I)},get columnPath(){return n.get(M)},get mounts(){return t.mounts}})}};n.if(R,z=>{n.get(P)?z(K):z(oe,-1)})}n.append(S,N)},m=n.derived(()=>c(n.get(V)));n.if(xe,S=>{n.get(m)&&S(y)})}n.append(re,ae)}),n.append($,ne)},$$slots:{default:!0}})}),n.append(C,w)},$$slots:{default:!0}})};let o=n.prop(t,"isComposeMode",3,!1),s=n.prop(t,"isWithinCollection",3,!1),i=n.prop(t,"showDropContainers",3,!1);const l=n.derived(()=>fe(t.plugins).components),a=n.derived(()=>!o()&&Mn(t.displayItemList)&&!Te({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType})),d=n.derived(()=>{const h=Me({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType});return Kn({isWithinCollection:s(),baseDeclaresOwnHeight:tt({containerAttributes:t.displayItemList.containerAttributes,widgetContainerStyles:et({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType,isComposeMode:o()})}),baseZIndex:h})}),u=n.derived(()=>{var v;const h=((v=t.displayItemList.overlayLayers)==null?void 0:v.layers)??[],C=Me({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType});return h.flatMap((w,D)=>Fn({layer:w,deviceDisplayType:t.deviceDisplayType})?[]:[{index:D,layer:w,boxStyles:Bn({zIndex:jn(C,D),pointerEvents:Vn({containerAttributes:w.containerAttributes,deviceDisplayType:t.deviceDisplayType})})}])});function c(h){if(o()&&h.type===be.DroppableBox)return!1;const{componentAttributesBasedOnDevice:C}=Ne({col:h,deviceDisplayType:t.deviceDisplayType,isComposeMode:o(),sourceComponentsPlugin:fe(t.plugins)}),v=!!C&&C["hide-component-3-resolutions"]==="true";return!(!o()&&v)}function f(h){const{componentAttributesBasedOnDevice:C,componentStyles:v}=Ne({col:h,deviceDisplayType:t.deviceDisplayType,isComposeMode:o(),sourceComponentsPlugin:fe(t.plugins)});return{componentAttributes:C,styleProps:v}}function p(h){const C=Je(h.type);if(!(C!=null&&C.length))return null;const v=h.collection??t.widgetCollections[C];if(!v)throw new Error(`DisplayCollection - Collection with ID ${C} not found in widgetCollections. Available collections: ${Object.keys(t.widgetCollections).join(", ")}`);return!v.collectionRows||!Pn(v.collectionRows)?null:v.collectionRows}function g(h){return[...t.ancestorColumnIds??[],h]}function E(){return o()?Oe.Compose:Oe.RenderedPage}function A(h){if(!(o()||!h))return[...t.ancestorColumnIds??[],h].join(le)}function b(h){return Hn({widgetInstanceProps:Un({componentProps:t.componentProps,ancestorColumnIds:t.ancestorColumnIds,columnId:h}),placeholderValues:o()?void 0:t.placeholderValues})}var _=n.comment(),T=n.first_child(_);{var W=h=>{var C=Oo(),v=n.child(C);r(v);var w=n.sibling(v,2);n.each(w,17,()=>n.get(u),D=>D.index,(D,x)=>{var k=Ro(),$=n.child(k);me($,{get displayItemList(){return n.get(x).layer},get isComposeMode(){return o()},isWithinCollection:!1,get widgetCollections(){return t.widgetCollections},showDropContainers:!1,get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get plugins(){return t.plugins},get deviceDisplayType(){return t.deviceDisplayType},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues},get ancestorColumnIds(){return t.ancestorColumnIds}}),n.reset(k),n.template_effect(te=>{n.set_attribute(k,"data-rulecms-overlay-layer",n.get(x).index),n.set_style(k,te)},[()=>O(n.get(x).boxStyles)]),n.append(D,k)}),n.reset(C),n.template_effect(D=>n.set_style(C,D),[()=>O(n.get(d))]),n.append(h,C)},H=h=>{r(h)};n.if(T,h=>{n.get(a)?h(W):h(H,-1)})}n.append(e,_),n.pop()}function ye(e,t){n.push(t,!0);var r=n.comment(),o=n.first_child(r);{var s=i=>{me(i,{get displayItemList(){return t.displayItemList},get isComposeMode(){return t.isComposeMode},get isWithinCollection(){return t.isWithinCollection},get widgetCollections(){return t.widgetCollections},get showDropContainers(){return t.showDropContainers},get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get plugins(){return t.plugins},get deviceDisplayType(){return t.deviceDisplayType},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues},get ancestorColumnIds(){return t.ancestorColumnIds}})};n.if(o,i=>{var l,a;(a=(l=t.displayItemList)==null?void 0:l.rows)!=null&&a.length&&i(s)})}n.append(e,r),n.pop()}function $n(e,t){var r=n.comment(),o=n.first_child(r);n.each(o,17,()=>t.stylesheets??[],n.index,(s,i)=>{var l=n.comment(),a=n.first_child(l);n.element(a,()=>"style",!1,(d,u)=>{n.attribute_effect(d,()=>({"data-rulecms-library-stylesheet":""}));var c=n.text();n.template_effect(()=>n.set_text(c,n.get(i))),n.append(u,c)}),n.append(s,l)}),n.append(e,r)}let Wo=0;var No=n.from_html("<div><!></div>"),ut=n.from_html("<!> <!>",1);function er(e,t){n.push(t,!0);const r=["Phone","Tablet","Desktop"],o=`rulecms-bp-${++Wo}`,s=n.derived(()=>t.scopeIdInput??o),i=n.derived(()=>Xn(t.displayItemList,t.widgetCollections)),l=n.derived(()=>vo(n.get(s)));var a=ut(),d=n.first_child(a);{let p=n.derived(()=>{var g;return(g=t.plugins.sourceComponents)==null?void 0:g.stylesheets});$n(d,{get stylesheets(){return n.get(p)}})}var u=n.sibling(d,2);{var c=p=>{ye(p,{get displayItemList(){return t.displayItemList},isComposeMode:!1,isWithinCollection:!1,get widgetCollections(){return t.widgetCollections},showDropContainers:!1,reduxDeviceDisplayType:"desktop",deviceDisplayType:"Desktop",get plugins(){return t.plugins},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}})},f=p=>{var g=ut(),E=n.first_child(g);n.element(E,()=>"style",!1,(b,_)=>{var T=n.text();n.template_effect(()=>n.set_text(T,n.get(l))),n.append(_,T)});var A=n.sibling(E,2);n.each(A,16,()=>r,b=>b,(b,_)=>{var T=No(),W=n.child(T);ye(W,{get displayItemList(){return t.displayItemList},isComposeMode:!1,isWithinCollection:!1,get widgetCollections(){return t.widgetCollections},showDropContainers:!1,reduxDeviceDisplayType:"desktop",get deviceDisplayType(){return _},get plugins(){return t.plugins},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}}),n.reset(T),n.template_effect(H=>n.set_class(T,1,H),[()=>`${n.get(s)}-${_.toLowerCase()}`]),n.append(b,T)}),n.append(p,g)};n.if(u,p=>{n.get(i)?p(f,-1):p(c)})}n.append(e,a),n.pop()}function Mo(e,t,r){if(e)return"Phone";if(t)return"Tablet";const o=(r==null?void 0:r.toLowerCase())||"desktop";return o==="phone"?"Phone":o==="tablet"?"Tablet":"Desktop"}const jo=`(max-width: ${Ze})`,Vo=`(max-width: ${Qe})`;var Fo=n.from_html("<!> <!>",1);function tr(e,t){n.push(t,!0);let r=n.state("Desktop"),o,s;function i(){n.set(r,Mo((o==null?void 0:o.matches)??!1,(s==null?void 0:s.matches)??!1,t.reduxDeviceDisplayType),!0)}n.user_effect(()=>(typeof matchMedia=="function"&&(o=matchMedia(jo),s=matchMedia(Vo),o.addEventListener("change",i),s.addEventListener("change",i)),i(),()=>{o==null||o.removeEventListener("change",i),s==null||s.removeEventListener("change",i)}));var l=Fo(),a=n.first_child(l);{var d=c=>{{let f=n.derived(()=>{var p;return(p=t.plugins.sourceComponents)==null?void 0:p.stylesheets});$n(c,{get stylesheets(){return n.get(f)}})}};n.if(a,c=>{t.isWithinCollection||c(d)})}var u=n.sibling(a,2);ye(u,{get displayItemList(){return t.displayItemList},get isComposeMode(){return t.isComposeMode},get isWithinCollection(){return t.isWithinCollection},get widgetCollections(){return t.widgetCollections},get showDropContainers(){return t.showDropContainers},get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get deviceDisplayType(){return n.get(r)},get plugins(){return t.plugins},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}}),n.append(e,l),n.pop()}function nr(e){return e!==!1}const Ko=["utilities","components"],Bo=new Set(Ko),rr=e=>typeof e=="string"&&Bo.has(e),Uo=e=>e.split(`
3
+ @media (max-width: ${Zn}px) { ${t} { display: block; } }
4
+ @media (min-width: ${vo}px) and (max-width: ${Qn}px) { ${r} { display: block; } }
5
+ @media (min-width: ${Ao}px) { ${o} { display: block; } }
6
+ `.trim()}function ge(e){if(!e)throw new Error("Source components plugin is required, but no plugins were provided");const t=e.sourceComponents;if(!t)throw new Error("Source components plugin is required, but was not found in plugins object");if(!t.components)throw new Error("Source components plugin is missing required property: components");if(typeof t.components!="object"||t.components===null||Array.isArray(t.components))throw new Error("Source components plugin components must be an object (Record<string, LibraryComponentEntry>)");return t}let wo=0;var So=n.from_html("<div><!> <!></div>");function To(e,t){n.push(t,!0);let r=n.prop(t,"isComposeMode",3,!1),o=n.prop(t,"showDropContainers",3,!1),s=n.prop(t,"isWithinCollection",3,!1),i=n.prop(t,"deviceDisplayType",3,"Desktop");const l=`rulecms-vc-${++wo}`;function a(h,v,C){const w=h&&!C?3:1;return!!(v!=null&&v.length)&&v.length>w}const u=n.derived(()=>{var h;return(((h=t.displayItemList.containerAttributes)==null?void 0:h[pe])||[]).join(`;
7
+ `)}),d=n.derived(()=>n.get(u)?`.${l} {
8
+ ${n.get(u)}
9
+ }`:""),c=n.derived(()=>!r()&&Ie({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:i()})),f=n.derived(()=>nt({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:i(),isComposeMode:r()})),p=n.derived(()=>{var C;const h=((C=t.displayItemList.containerAttributes)==null?void 0:C[pe])||[],v=Mn(n.get(f));return r()&&!s()||o()||h.length>0||v||a(r(),t.displayItemList.rows,s())}),g=n.derived(()=>[n.get(u)?l:void 0,n.get(f).cssClasses].filter(Boolean).join(" ")),E=n.derived(()=>({...rt({containerAttributes:t.displayItemList.containerAttributes,widgetContainerStyles:n.get(f)})?{}:{height:s()?"auto":"100%"},display:"flex",flexDirection:"column",...n.get(f).styles})),A=n.derived(()=>n.get(p)?n.get(g):""),b=n.derived(()=>n.get(c)?{display:"none"}:n.get(p)?n.get(E):{display:"contents"});var _=So(),T=n.child(_);{var N=h=>{var v=n.comment(),C=n.first_child(v);n.element(C,()=>"style",!1,(w,I)=>{var P=n.text();n.template_effect(()=>n.set_text(P,n.get(d))),n.append(I,P)}),n.append(h,v)};n.if(T,h=>{n.get(u)&&h(N)})}var H=n.sibling(T,2);n.snippet(H,()=>t.children),n.reset(_),n.template_effect(h=>{n.set_attribute(_,"hidden",n.get(c)||void 0),n.set_class(_,1,n.clsx(n.get(A)||void 0)),n.set_style(_,h)},[()=>W(n.get(b))]),n.append(e,_),n.pop()}var Io=n.from_html("<div><!></div>");function Po(e,t){n.push(t,!0);let r=n.prop(t,"isComposeMode",3,!1),o=n.prop(t,"showDropContainers",3,!1),s=n.prop(t,"isWithinCollection",3,!1),i=n.prop(t,"deviceDisplayType",3,"Desktop");function l(A,b,_){var N;const T=A&&!_?3:1;return!!((N=b==null?void 0:b.columns)!=null&&N.length)&&b.columns.length>T}const a=n.derived(()=>!r()&&Rn({row:t.row,deviceDisplayType:i()})),u=n.derived(()=>o()||kn(t.row)||l(r(),t.row,s())),d=n.derived(()=>On({row:t.row,deviceDisplayType:i(),isComposeMode:r()})),c=n.derived(()=>{var b;const A=G({deviceDisplayType:i(),componentAttributes:t.row.rowAttributes});return Te((b=A==null?void 0:A.componentAttributesSpecificToDeviceType)==null?void 0:b[Se])??""}),f=n.derived(()=>n.get(u)?n.get(c):""),p=n.derived(()=>n.get(a)?{display:"none"}:n.get(u)?n.get(d):{display:"contents"});var g=Io(),E=n.child(g);n.snippet(E,()=>t.children),n.reset(g),n.template_effect(A=>{n.set_attribute(g,"hidden",n.get(a)||void 0),n.set_class(g,1,n.clsx(n.get(f)||void 0)),n.set_style(g,A)},[()=>W(n.get(p))]),n.append(e,g),n.pop()}const $n=["minWidth","maxWidth","minHeight","maxHeight","margin","marginTop","marginRight","marginBottom","marginLeft","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","borderWidth","borderStyle","borderColor","border","borderRadius","boxShadow","width","height","gap","display","justifyContent","alignItems","flexWrap","alignContent","flexDirection","overflow","overflowX","overflowY","backgroundColor","backgroundImage","backgroundSize","backgroundPosition","backgroundRepeat","opacity","fontFamily","fontSize","fontWeight","fontStyle","color","lineHeight","letterSpacing","textAlign","textDecoration","textTransform"],Do=e=>e!=null&&e!=="",xo=e=>e?$n.reduce((t,r)=>{const o=e[r];return Do(o)&&(t[r]=o),t},{}):{},Lo=e=>{if(!e)return;const t={...e};for(const r of $n)delete t[r];return Object.keys(t).length?t:void 0},ko=e=>Object.keys(e).length>0,Ro=(e,t)=>{const r=(e==null?void 0:e.noContainer)??!1,o=e==null?void 0:e.resolveNoContainer;if(typeof o!="function")return r;try{const s=o(t);if(typeof s=="boolean")return s;console.error(`resolveNoContainer: component "${e==null?void 0:e.id}" returned ${typeof s} instead of a boolean; falling back to noContainer=${r}`)}catch(s){console.error(`resolveNoContainer: component "${e==null?void 0:e.id}" threw; falling back to noContainer=${r}`,s)}return r},Oo=(e,t)=>{const r=e==null?void 0:e.resolveRendersOwnElement;if(typeof r!="function")return!1;try{const o=r(t);if(typeof o=="boolean")return o;console.error(`resolveRendersOwnElement: component "${e==null?void 0:e.id}" returned ${typeof o} instead of a boolean; falling back to false`)}catch(o){console.error(`resolveRendersOwnElement: component "${e==null?void 0:e.id}" threw; falling back to false`,o)}return!1};var ut=n.from_html("<div><!></div>");function er(e,t){n.push(t,!0);const r=n.derived(()=>t.components[He(t.libraryId,t.componentType)]),o=n.derived(()=>{var _;const b=(_=n.get(r))==null?void 0:_.card;return b||(console.error(`DisplayComponent: Component with type ${t.componentType}${t.libraryId?` (library "${t.libraryId}")`:""} not found in components`),null)}),s=n.derived(()=>({componentAttributes:t.componentAttributes,styleProps:t.styleProps})),i=n.derived(()=>n.get(r)?Ro(n.get(r),n.get(s)):!1),l=n.derived(()=>xo(t.styleProps)),a=n.derived(()=>n.get(i)?Lo(t.styleProps):t.styleProps),u=n.derived(()=>{var b;return Te((b=t.componentAttributes)==null?void 0:b[Se])}),d=n.derived(()=>n.get(i)&&ko(n.get(l))),c=n.derived(()=>!n.get(i)||(n.get(r)?Oo(n.get(r),n.get(s)):!1)),f=n.derived(()=>!n.get(d)&&n.get(c)?n.get(u):void 0),p=n.derived(()=>({componentAttributes:t.componentAttributes,styleProps:n.get(a),className:n.get(f),widgetInstanceProps:t.widgetInstanceProps,pageViewType:t.pageViewType,columnPath:t.columnPath,mounts:t.mounts}));var g=n.comment(),E=n.first_child(g);{var A=b=>{const _=n.derived(()=>n.get(o));var T=n.comment(),N=n.first_child(T);{var H=C=>{var w=ut(),I=n.child(w);n.component(I,()=>n.get(_),(P,k)=>{k(P,n.spread_props(()=>n.get(p)))}),n.reset(w),n.template_effect(P=>{n.set_class(w,1,n.clsx(n.get(u)||void 0)),n.set_style(w,P)},[()=>W(n.get(l))]),n.append(C,w)},h=C=>{var w=ut(),I=n.child(w);n.component(I,()=>n.get(_),(P,k)=>{k(P,n.spread_props(()=>n.get(p)))}),n.reset(w),n.template_effect(()=>n.set_class(w,1,n.clsx(n.get(u)))),n.append(C,w)},v=C=>{var w=n.comment(),I=n.first_child(w);n.component(I,()=>n.get(_),(P,k)=>{k(P,n.spread_props(()=>n.get(p)))}),n.append(C,w)};n.if(N,C=>{n.get(d)?C(H):!n.get(c)&&n.get(u)?C(h,1):C(v,-1)})}n.append(b,T)};n.if(E,b=>{n.get(o)&&b(A)})}n.append(e,g),n.pop()}var Wo=n.from_html("<div><!></div>"),No=n.from_html("<div><!> <!></div>");function ye(e,t){n.push(t,!0);const r=h=>{To(h,{get displayItemList(){return t.displayItemList},get isComposeMode(){return o()},get showDropContainers(){return i()},get isWithinCollection(){return s()},get deviceDisplayType(){return t.deviceDisplayType},children:(v,C)=>{var w=n.comment(),I=n.first_child(w);n.each(I,17,()=>t.displayItemList.rows,P=>P.id,(P,k)=>{Po(P,{get row(){return n.get(k)},get isComposeMode(){return o()},get showDropContainers(){return i()},get isWithinCollection(){return s()},get deviceDisplayType(){return t.deviceDisplayType},children:(Q,te)=>{var ne=n.comment(),le=n.first_child(ne);n.each(le,17,()=>n.get(k).columns,$=>$.id,($,V)=>{var ae=n.comment(),xe=n.first_child(ae);{var Le=y=>{const m=n.derived(()=>p(n.get(V)));var S=n.comment(),D=n.first_child(S);{var M=O=>{{let X=n.derived(()=>g(n.get(V).id));ye(O,{get displayItemList(){return n.get(m)},get isComposeMode(){return o()},isWithinCollection:!0,get widgetCollections(){return t.widgetCollections},get showDropContainers(){return i()},get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get plugins(){return t.plugins},get deviceDisplayType(){return t.deviceDisplayType},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues},get ancestorColumnIds(){return n.get(X)}})}},R=O=>{{let X=n.derived(()=>f(n.get(V)).componentAttributes),ce=n.derived(()=>f(n.get(V)).styleProps),re=n.derived(()=>b(n.get(V).id)),it=n.derived(E),lt=n.derived(()=>A(n.get(V).id));er(O,{get componentType(){return n.get(V).type},get libraryId(){return n.get(V).libraryId},get componentAttributes(){return n.get(X)},get components(){return n.get(l)},get styleProps(){return n.get(ce)},get widgetInstanceProps(){return n.get(re)},get pageViewType(){return n.get(it)},get columnPath(){return n.get(lt)},get mounts(){return t.mounts}})}};n.if(D,O=>{n.get(m)?O(M):O(R,-1)})}n.append(y,S)},ke=n.derived(()=>c(n.get(V)));n.if(xe,y=>{n.get(ke)&&y(Le)})}n.append($,ae)}),n.append(Q,ne)},$$slots:{default:!0}})}),n.append(v,w)},$$slots:{default:!0}})};let o=n.prop(t,"isComposeMode",3,!1),s=n.prop(t,"isWithinCollection",3,!1),i=n.prop(t,"showDropContainers",3,!1);const l=n.derived(()=>ge(t.plugins).components),a=n.derived(()=>!o()&&Vn(t.displayItemList)&&!Ie({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType})),u=n.derived(()=>{const h=Ve({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType});return Un({isWithinCollection:s(),baseDeclaresOwnHeight:rt({containerAttributes:t.displayItemList.containerAttributes,widgetContainerStyles:nt({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType,isComposeMode:o()})}),baseZIndex:h})}),d=n.derived(()=>{var C;const h=((C=t.displayItemList.overlayLayers)==null?void 0:C.layers)??[],v=Ve({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType});return h.flatMap((w,I)=>Bn({layer:w,deviceDisplayType:t.deviceDisplayType})?[]:[{index:I,layer:w,boxStyles:Hn({zIndex:Fn(v,I),pointerEvents:Kn({containerAttributes:w.containerAttributes,deviceDisplayType:t.deviceDisplayType})})}])});function c(h){if(o()&&h.type===_e.DroppableBox)return!1;const{componentAttributesBasedOnDevice:v}=je({col:h,deviceDisplayType:t.deviceDisplayType,isComposeMode:o(),sourceComponentsPlugin:ge(t.plugins)}),C=!!v&&v["hide-component-3-resolutions"]==="true";return!(!o()&&C)}function f(h){const{componentAttributesBasedOnDevice:v,componentStyles:C}=je({col:h,deviceDisplayType:t.deviceDisplayType,isComposeMode:o(),sourceComponentsPlugin:ge(t.plugins)});return{componentAttributes:v,styleProps:C}}function p(h){const v=Ze(h.type);if(!(v!=null&&v.length))return null;const C=h.collection??t.widgetCollections[v];if(!C)throw new Error(`DisplayCollection - Collection with ID ${v} not found in widgetCollections. Available collections: ${Object.keys(t.widgetCollections).join(", ")}`);return!C.collectionRows||!xn(C.collectionRows)?null:C.collectionRows}function g(h){return[...t.ancestorColumnIds??[],h]}function E(){return o()?Ne.Compose:Ne.RenderedPage}function A(h){if(!(o()||!h))return[...t.ancestorColumnIds??[],h].join(ie)}function b(h){return Gn({widgetInstanceProps:zn({componentProps:t.componentProps,ancestorColumnIds:t.ancestorColumnIds,columnId:h}),placeholderValues:o()?void 0:t.placeholderValues})}var _=n.comment(),T=n.first_child(_);{var N=h=>{var v=No(),C=n.child(v);r(C);var w=n.sibling(C,2);n.each(w,17,()=>n.get(d),I=>I.index,(I,P)=>{var k=Wo(),Q=n.child(k);ye(Q,{get displayItemList(){return n.get(P).layer},get isComposeMode(){return o()},isWithinCollection:!1,get widgetCollections(){return t.widgetCollections},showDropContainers:!1,get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get plugins(){return t.plugins},get deviceDisplayType(){return t.deviceDisplayType},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues},get ancestorColumnIds(){return t.ancestorColumnIds}}),n.reset(k),n.template_effect(te=>{n.set_attribute(k,"data-rulecms-overlay-layer",n.get(P).index),n.set_style(k,te)},[()=>W(n.get(P).boxStyles)]),n.append(I,k)}),n.reset(v),n.template_effect(I=>n.set_style(v,I),[()=>W(n.get(u))]),n.append(h,v)},H=h=>{r(h)};n.if(T,h=>{n.get(a)?h(N):h(H,-1)})}n.append(e,_),n.pop()}function he(e,t){n.push(t,!0);var r=n.comment(),o=n.first_child(r);{var s=i=>{ye(i,{get displayItemList(){return t.displayItemList},get isComposeMode(){return t.isComposeMode},get isWithinCollection(){return t.isWithinCollection},get widgetCollections(){return t.widgetCollections},get showDropContainers(){return t.showDropContainers},get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get plugins(){return t.plugins},get deviceDisplayType(){return t.deviceDisplayType},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues},get ancestorColumnIds(){return t.ancestorColumnIds}})};n.if(o,i=>{var l,a;(a=(l=t.displayItemList)==null?void 0:l.rows)!=null&&a.length&&i(s)})}n.append(e,r),n.pop()}function tr(e,t){var r=n.comment(),o=n.first_child(r);n.each(o,17,()=>t.stylesheets??[],n.index,(s,i)=>{var l=n.comment(),a=n.first_child(l);n.element(a,()=>"style",!1,(u,d)=>{n.attribute_effect(u,()=>({"data-rulecms-library-stylesheet":""}));var c=n.text();n.template_effect(()=>n.set_text(c,n.get(i))),n.append(d,c)}),n.append(s,l)}),n.append(e,r)}let Mo=0;var jo=n.from_html("<div><!></div>"),ft=n.from_html("<!> <!>",1);function nr(e,t){n.push(t,!0);const r=["Phone","Tablet","Desktop"],o=`rulecms-bp-${++Mo}`,s=n.derived(()=>t.scopeIdInput??o),i=n.derived(()=>qn(t.displayItemList,t.widgetCollections)),l=n.derived(()=>Eo(n.get(s)));var a=ft(),u=n.first_child(a);{let p=n.derived(()=>{var g;return(g=t.plugins.sourceComponents)==null?void 0:g.stylesheets});tr(u,{get stylesheets(){return n.get(p)}})}var d=n.sibling(u,2);{var c=p=>{he(p,{get displayItemList(){return t.displayItemList},isComposeMode:!1,isWithinCollection:!1,get widgetCollections(){return t.widgetCollections},showDropContainers:!1,reduxDeviceDisplayType:"desktop",deviceDisplayType:"Desktop",get plugins(){return t.plugins},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}})},f=p=>{var g=ft(),E=n.first_child(g);n.element(E,()=>"style",!1,(b,_)=>{var T=n.text();n.template_effect(()=>n.set_text(T,n.get(l))),n.append(_,T)});var A=n.sibling(E,2);n.each(A,16,()=>r,b=>b,(b,_)=>{var T=jo(),N=n.child(T);he(N,{get displayItemList(){return t.displayItemList},isComposeMode:!1,isWithinCollection:!1,get widgetCollections(){return t.widgetCollections},showDropContainers:!1,reduxDeviceDisplayType:"desktop",get deviceDisplayType(){return _},get plugins(){return t.plugins},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}}),n.reset(T),n.template_effect(H=>n.set_class(T,1,H),[()=>`${n.get(s)}-${_.toLowerCase()}`]),n.append(b,T)}),n.append(p,g)};n.if(d,p=>{n.get(i)?p(f,-1):p(c)})}n.append(e,a),n.pop()}function Vo(e,t,r){if(e)return"Phone";if(t)return"Tablet";const o=(r==null?void 0:r.toLowerCase())||"desktop";return o==="phone"?"Phone":o==="tablet"?"Tablet":"Desktop"}const Fo=`(max-width: ${$e})`,Ko=`(max-width: ${et})`;var Bo=n.from_html("<!> <!>",1);function rr(e,t){n.push(t,!0);let r=n.state("Desktop"),o,s;function i(){n.set(r,Vo((o==null?void 0:o.matches)??!1,(s==null?void 0:s.matches)??!1,t.reduxDeviceDisplayType),!0)}n.user_effect(()=>(typeof matchMedia=="function"&&(o=matchMedia(Fo),s=matchMedia(Ko),o.addEventListener("change",i),s.addEventListener("change",i)),i(),()=>{o==null||o.removeEventListener("change",i),s==null||s.removeEventListener("change",i)}));var l=Bo(),a=n.first_child(l);{var u=c=>{{let f=n.derived(()=>{var p;return(p=t.plugins.sourceComponents)==null?void 0:p.stylesheets});tr(c,{get stylesheets(){return n.get(f)}})}};n.if(a,c=>{t.isWithinCollection||c(u)})}var d=n.sibling(a,2);he(d,{get displayItemList(){return t.displayItemList},get isComposeMode(){return t.isComposeMode},get isWithinCollection(){return t.isWithinCollection},get widgetCollections(){return t.widgetCollections},get showDropContainers(){return t.showDropContainers},get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get deviceDisplayType(){return n.get(r)},get plugins(){return t.plugins},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}}),n.append(e,l),n.pop()}function or(e){return e!==!1}const Uo=["utilities","components"],Ho=new Set(Uo),sr=e=>typeof e=="string"&&Ho.has(e),zo=e=>e.split(`
10
10
  `).map(t=>t.length>0?` ${t}`:t).join(`
11
- `),Ho=(e,t)=>e?rr(t)?`@layer ${t} {
12
- ${Uo(e)}
13
- }`:e:null,zo=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),Go=e=>e.replace(/[^A-Za-z0-9_-]/g,t=>`\\${t}`),Yo=["</","<script","@import","javascript:","vbscript:","expression("],Xo=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,Jo=/[\s{};"]/,qo=/^[A-Za-z0-9_:%./[\]%-]+$/,Zo=e=>{let t=0;for(const r of e)if(r==="{")t+=1;else if(r==="}"&&(t-=1,t<0))return!1;return t===0},Qo=e=>{const t=e.startsWith(".")?e.slice(1):e;return!t||t.length>200||t.startsWith(".")||Jo.test(t)?!1:qo.test(t)},$o=e=>{const t=e.trim();if(!t||t.length>4e3||Xo.test(t)||!Zo(t))return!1;const r=t.toLowerCase();return!Yo.some(o=>r.includes(o))},es=e=>{if(!e)return{};const t={};for(const[r,o]of Object.entries(e)){const s=r.startsWith(".")?r.slice(1):r.trim();if(!Qo(s)||typeof o!="string")continue;const i=o.trim();$o(i)&&(t[s]=i)}return t},ts=e=>e.split(`
11
+ `),Go=(e,t)=>e?sr(t)?`@layer ${t} {
12
+ ${zo(e)}
13
+ }`:e:null,Yo=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),Xo=e=>e.replace(/[^A-Za-z0-9_-]/g,t=>`\\${t}`),Jo=["</","<script","@import","javascript:","vbscript:","expression("],qo=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,Zo=/[\s{};"]/,Qo=/^[A-Za-z0-9_:%./[\]%-]+$/,$o=e=>{let t=0;for(const r of e)if(r==="{")t+=1;else if(r==="}"&&(t-=1,t<0))return!1;return t===0},es=e=>{const t=e.startsWith(".")?e.slice(1):e;return!t||t.length>200||t.startsWith(".")||Zo.test(t)?!1:Qo.test(t)},ts=e=>{const t=e.trim();if(!t||t.length>4e3||qo.test(t)||!$o(t))return!1;const r=t.toLowerCase();return!Jo.some(o=>r.includes(o))},ns=e=>{if(!e)return{};const t={};for(const[r,o]of Object.entries(e)){const s=r.startsWith(".")?r.slice(1):r.trim();if(!es(s)||typeof o!="string")continue;const i=o.trim();ts(i)&&(t[s]=i)}return t},rs=e=>e.split(`
14
14
  `).map(t=>` ${t}`).join(`
15
- `),ns=(e,t,r,o)=>{if(!nr(r))return null;const s=es(t),i=Object.keys(s);if(i.length===0||!e)return null;const l=`[data-rulecms-published-key="${zo(e)}"]`,a=i.sort((d,u)=>d.localeCompare(u)).map(d=>`${l} .${Go(d)} {
16
- ${ts(s[d])}
15
+ `),os=(e,t,r,o)=>{if(!or(r))return null;const s=ns(t),i=Object.keys(s);if(i.length===0||!e)return null;const l=`[data-rulecms-published-key="${Yo(e)}"]`,a=i.sort((u,d)=>u.localeCompare(d)).map(u=>`${l} .${Xo(u)} {
16
+ ${rs(s[u])}
17
17
  }`).join(`
18
- `);return Ho(a,o)};function rs(e,t){n.push(t,!0);const r=n.derived(()=>ns(t.publishedKey,t.classes,void 0,t.classLayer));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),d=n.first_child(a);n.element(d,()=>"style",!1,(u,c)=>{n.attribute_effect(u,()=>({"data-rulecms-project-class-definitions":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function rt(e){return e!==!1}const or=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),os=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-sans-serif","ui-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]),ss=/^[a-zA-Z_\u00A0-\uFFFF-][a-zA-Z0-9_\u00A0-\uFFFF-]*$/,is=/url\(|@|[{};\\<>]|javascript:/i,ls=/url\(|@|[{};\\<>]|javascript:|expression\(/i,as=/^--[A-Za-z_][\w-]*$/,cs=/^[A-Za-z0-9 ]+$/,us=new Set([100,200,300,400,500,600,700,800,900]),ds=4,fs=8,gs=255,Fe=e=>os.has(e.toLowerCase())||ss.test(e)?e:`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,dt=e=>typeof e=="string"&&e.trim()!==""&&e.trim().length<=80&&!e.includes(",")&&!is.test(e),ps=e=>typeof e=="string"&&as.test(e.trim())&&e.trim().length<=80,ms=e=>typeof e=="string"&&e.trim()!==""&&e.trim().length<=400&&!ls.test(e),ys=e=>typeof e!="number"||!Number.isInteger(e)||e<0||e>gs?null:e,hs=(e,t,r)=>{if(!Array.isArray(e))return[];const o=[];for(const s of e){if(!s||typeof s!="object"||o.length>=ds)continue;const i=s;if(!ps(i.name))continue;const l=i.name.trim();if(t.has(l))continue;const a=[],d=new Set;for(const c of i.overrideColors??[]){if(a.length>=fs)break;const f=ys(c==null?void 0:c.index);f===null||d.has(f)||!ms(c==null?void 0:c.color)||(d.add(f),a.push({index:f,color:c.color.trim()}))}a.sort((c,f)=>c.index-f.index);const u=i.applyToWidget===!0&&!r.current;u&&(r.current=!0),t.add(l),o.push({name:l,...a.length>0?{overrideColors:a}:{},...u?{applyToWidget:!0}:{}})}return o},Ie=e=>{var l;if(!Array.isArray(e))return[];const t=[],r=new Set,o=new Set,s={current:!1};let i=!1;for(const a of e){if(!a||!dt(a.family))continue;const d=a.family.trim(),u=d.toLowerCase();if(r.has(u)||t.length>=12)continue;const c=(a.fallbacks??[]).filter(dt).slice(0,8),f=typeof a.cssVariable=="string"&&Q(a.cssVariable.trim())?a.cssVariable.trim():void 0;let p={kind:"stack-only"};if(((l=a.source)==null?void 0:l.kind)==="google"){if(!cs.test(d))continue;const b=(Array.isArray(a.source.weights)?a.source.weights:[]).filter(_=>typeof _=="number"&&us.has(_)).filter((_,T,W)=>W.indexOf(_)===T).sort((_,T)=>_-T);if(b.length===0)continue;p={kind:"google",weights:b}}r.add(u);const g=a.applyToWidget===!0&&!i;g&&(i=!0);const E=hs(a.palettes,o,s);t.push({family:d,...f?{cssVariable:f}:{},fallbacks:c,applyToWidget:g,source:p,...E.length>0?{palettes:E}:{}})}return t},bs=e=>{const t=Ie(e).filter(r=>r.source.kind==="google").map(r=>{const o=r.source.kind==="google"?r.source.weights.join(";"):"400";return`family=${r.family.replace(/ /g,"+")}:wght@${o}`});return t.length===0?null:`https://fonts.googleapis.com/css2?${t.join("&")}&display=swap`},_s=e=>[Fe(e.family),...(e.fallbacks??[]).map(Fe)].join(", "),Cs=e=>{const t=[];for(const r of e)for(const o of r.palettes??[]){const s=[` font-family: ${Fe(r.family)};`];if(o.overrideColors&&o.overrideColors.length>0){const i=o.overrideColors.map(l=>`${l.index} ${l.color}`).join(", ");s.push(` override-colors: ${i};`)}t.push(`@font-palette-values ${o.name} {
18
+ `);return Go(a,o)};function ss(e,t){n.push(t,!0);const r=n.derived(()=>os(t.publishedKey,t.classes,void 0,t.classLayer));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),u=n.first_child(a);n.element(u,()=>"style",!1,(d,c)=>{n.attribute_effect(d,()=>({"data-rulecms-project-class-definitions":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function st(e){return e!==!1}const ir=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),is=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-sans-serif","ui-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]),ls=/^[a-zA-Z_\u00A0-\uFFFF-][a-zA-Z0-9_\u00A0-\uFFFF-]*$/,as=/url\(|@|[{};\\<>]|javascript:/i,cs=/url\(|@|[{};\\<>]|javascript:|expression\(/i,ds=/^--[A-Za-z_][\w-]*$/,us=/^[A-Za-z0-9 ]+$/,fs=new Set([100,200,300,400,500,600,700,800,900]),gs=4,ps=8,ms=255,Be=e=>is.has(e.toLowerCase())||ls.test(e)?e:`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,gt=e=>typeof e=="string"&&e.trim()!==""&&e.trim().length<=80&&!e.includes(",")&&!as.test(e),ys=e=>typeof e=="string"&&ds.test(e.trim())&&e.trim().length<=80,hs=e=>typeof e=="string"&&e.trim()!==""&&e.trim().length<=400&&!cs.test(e),bs=e=>typeof e!="number"||!Number.isInteger(e)||e<0||e>ms?null:e,_s=(e,t,r)=>{if(!Array.isArray(e))return[];const o=[];for(const s of e){if(!s||typeof s!="object"||o.length>=gs)continue;const i=s;if(!ys(i.name))continue;const l=i.name.trim();if(t.has(l))continue;const a=[],u=new Set;for(const c of i.overrideColors??[]){if(a.length>=ps)break;const f=bs(c==null?void 0:c.index);f===null||u.has(f)||!hs(c==null?void 0:c.color)||(u.add(f),a.push({index:f,color:c.color.trim()}))}a.sort((c,f)=>c.index-f.index);const d=i.applyToWidget===!0&&!r.current;d&&(r.current=!0),t.add(l),o.push({name:l,...a.length>0?{overrideColors:a}:{},...d?{applyToWidget:!0}:{}})}return o},Pe=e=>{var l;if(!Array.isArray(e))return[];const t=[],r=new Set,o=new Set,s={current:!1};let i=!1;for(const a of e){if(!a||!gt(a.family))continue;const u=a.family.trim(),d=u.toLowerCase();if(r.has(d)||t.length>=12)continue;const c=(a.fallbacks??[]).filter(gt).slice(0,8),f=typeof a.cssVariable=="string"&&Z(a.cssVariable.trim())?a.cssVariable.trim():void 0;let p={kind:"stack-only"};if(((l=a.source)==null?void 0:l.kind)==="google"){if(!us.test(u))continue;const b=(Array.isArray(a.source.weights)?a.source.weights:[]).filter(_=>typeof _=="number"&&fs.has(_)).filter((_,T,N)=>N.indexOf(_)===T).sort((_,T)=>_-T);if(b.length===0)continue;p={kind:"google",weights:b}}r.add(d);const g=a.applyToWidget===!0&&!i;g&&(i=!0);const E=_s(a.palettes,o,s);t.push({family:u,...f?{cssVariable:f}:{},fallbacks:c,applyToWidget:g,source:p,...E.length>0?{palettes:E}:{}})}return t},Cs=e=>{const t=Pe(e).filter(r=>r.source.kind==="google").map(r=>{const o=r.source.kind==="google"?r.source.weights.join(";"):"400";return`family=${r.family.replace(/ /g,"+")}:wght@${o}`});return t.length===0?null:`https://fonts.googleapis.com/css2?${t.join("&")}&display=swap`},vs=e=>[Be(e.family),...(e.fallbacks??[]).map(Be)].join(", "),As=e=>{const t=[];for(const r of e)for(const o of r.palettes??[]){const s=[` font-family: ${Be(r.family)};`];if(o.overrideColors&&o.overrideColors.length>0){const i=o.overrideColors.map(l=>`${l.index} ${l.color}`).join(", ");s.push(` override-colors: ${i};`)}t.push(`@font-palette-values ${o.name} {
19
19
  ${s.join(`
20
20
  `)}
21
21
  }`)}return t.length>0?t.join(`
22
22
 
23
- `):null},vs=e=>{for(const t of e)for(const r of t.palettes??[])if(r.applyToWidget)return r.name},As=(e,t,r)=>{if(!rt(r)||!e)return null;const o=Ie(t),s=[];for(const u of o){const c=_s(u);u.cssVariable&&s.push(` ${u.cssVariable}: ${c};`),u.applyToWidget&&s.push(` font-family: ${u.cssVariable?`var(${u.cssVariable})`:c};`)}const i=vs(o);i&&s.push(` font-palette: ${i};`);const l=Cs(o),a=`[data-rulecms-published-key="${or(e)}"] > *`,d=s.length>0?`${a} {
23
+ `):null},Es=e=>{for(const t of e)for(const r of t.palettes??[])if(r.applyToWidget)return r.name},ws=(e,t,r)=>{if(!st(r)||!e)return null;const o=Pe(t),s=[];for(const d of o){const c=vs(d);d.cssVariable&&s.push(` ${d.cssVariable}: ${c};`),d.applyToWidget&&s.push(` font-family: ${d.cssVariable?`var(${d.cssVariable})`:c};`)}const i=Es(o);i&&s.push(` font-palette: ${i};`);const l=As(o),a=`[data-rulecms-published-key="${ir(e)}"] > *`,u=s.length>0?`${a} {
24
24
  ${s.join(`
25
25
  `)}
26
- }`:null;return!l&&!d?null:l?d?`${l}
26
+ }`:null;return!l&&!u?null:l?u?`${l}
27
27
 
28
- ${d}`:l:d};var Es=n.from_html('<link rel="stylesheet" data-rulecms-project-fonts=""/>'),ws=n.from_html("<!> <!>",1);function Ss(e,t){n.push(t,!0);const r=n.derived(()=>Ie(t.fonts)),o=n.derived(()=>rt(t.includeFontFaces)?bs(n.get(r)):null),s=n.derived(()=>As(t.publishedKey,n.get(r),t.includeFontFaces));var i=ws(),l=n.first_child(i);{var a=c=>{var f=Es();n.template_effect(()=>n.set_attribute(f,"href",n.get(o))),n.append(c,f)};n.if(l,c=>{n.get(o)&&c(a)})}var d=n.sibling(l,2);{var u=c=>{var f=n.comment(),p=n.first_child(f);n.element(p,()=>"style",!1,(g,E)=>{n.attribute_effect(g,()=>({"data-rulecms-project-fonts":""}));var A=n.text();n.template_effect(()=>n.set_text(A,n.get(s))),n.append(E,A)}),n.append(c,f)};n.if(d,c=>{n.get(s)&&c(u)})}n.append(e,i),n.pop()}function sr(e){return e!==!1}const Ts=80,Is=4e3,Ps=32,ir=["url(","@import","@font-face","@media","@keyframes","</","<script","javascript:","expression(","behavior:"],Ds=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,xs=/^[A-Za-z_][\w-]*$/,Ls=e=>{let t=0;for(const r of e)if(r==="{")t+=1;else if(r==="}"&&(t-=1,t<0))return!1;return t===0},ks=e=>{if(!e||e.length>Ts||e.includes("@")||e.includes(".")||/\s/.test(e))return!1;const t=e.toLowerCase();return ir.some(r=>t.includes(r))?!1:xs.test(e)},Rs=e=>{const t=e.trim();if(t==="")return!1;const r=t.toLowerCase();if(r==="from"||r==="to")return!0;const o=t.match(/^(\d{1,3}(?:\.\d+)?)%$/);if(!o)return!1;const s=Number(o[1]);return s>=0&&s<=100},Os=e=>{let t=0;const r=e.length;let o=0;const s=()=>{for(;t<r&&/\s/.test(e[t]);)t+=1};for(s();t<r;){const i=e.indexOf("{",t);if(i===-1||!e.slice(t,i).trim().split(",").every(u=>Rs(u)))return!1;t=i+1;const a=e.indexOf("}",t);if(a===-1)return!1;const d=e.slice(t,a);if(d.includes("{")||d.includes("}")||d.includes("@"))return!1;t=a+1,o+=1,s()}return o>0},Ws=e=>{const t=e.trim();if(!t||t.length>Is||Ds.test(t)||!Ls(t))return!1;const r=t.toLowerCase();return ir.some(o=>r.includes(o))||t.includes("@")?!1:Os(t)},lr=e=>{if(!e)return{};const t={};for(const[r,o]of Object.entries(e)){const s=r.trim();if(!ks(s)||t[s]!==void 0||typeof o!="string")continue;const i=o.trim();if(Ws(i)&&(t[s]=i,Object.keys(t).length===Ps))break}return Object.fromEntries(Object.entries(t).sort(([r],[o])=>r.localeCompare(o)))},Ns=e=>e.split(`
28
+ ${u}`:l:u};var Ss=n.from_html('<link rel="stylesheet" data-rulecms-project-fonts=""/>'),Ts=n.from_html("<!> <!>",1);function Is(e,t){n.push(t,!0);const r=n.derived(()=>Pe(t.fonts)),o=n.derived(()=>st(t.includeFontFaces)?Cs(n.get(r)):null),s=n.derived(()=>ws(t.publishedKey,n.get(r),t.includeFontFaces));var i=Ts(),l=n.first_child(i);{var a=c=>{var f=Ss();n.template_effect(()=>n.set_attribute(f,"href",n.get(o))),n.append(c,f)};n.if(l,c=>{n.get(o)&&c(a)})}var u=n.sibling(l,2);{var d=c=>{var f=n.comment(),p=n.first_child(f);n.element(p,()=>"style",!1,(g,E)=>{n.attribute_effect(g,()=>({"data-rulecms-project-fonts":""}));var A=n.text();n.template_effect(()=>n.set_text(A,n.get(s))),n.append(E,A)}),n.append(c,f)};n.if(u,c=>{n.get(s)&&c(d)})}n.append(e,i),n.pop()}function lr(e){return e!==!1}const Ps=80,Ds=4e3,xs=32,ar=["url(","@import","@font-face","@media","@keyframes","</","<script","javascript:","expression(","behavior:"],Ls=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,ks=/^[A-Za-z_][\w-]*$/,Rs=e=>{let t=0;for(const r of e)if(r==="{")t+=1;else if(r==="}"&&(t-=1,t<0))return!1;return t===0},Os=e=>{if(!e||e.length>Ps||e.includes("@")||e.includes(".")||/\s/.test(e))return!1;const t=e.toLowerCase();return ar.some(r=>t.includes(r))?!1:ks.test(e)},Ws=e=>{const t=e.trim();if(t==="")return!1;const r=t.toLowerCase();if(r==="from"||r==="to")return!0;const o=t.match(/^(\d{1,3}(?:\.\d+)?)%$/);if(!o)return!1;const s=Number(o[1]);return s>=0&&s<=100},Ns=e=>{let t=0;const r=e.length;let o=0;const s=()=>{for(;t<r&&/\s/.test(e[t]);)t+=1};for(s();t<r;){const i=e.indexOf("{",t);if(i===-1||!e.slice(t,i).trim().split(",").every(d=>Ws(d)))return!1;t=i+1;const a=e.indexOf("}",t);if(a===-1)return!1;const u=e.slice(t,a);if(u.includes("{")||u.includes("}")||u.includes("@"))return!1;t=a+1,o+=1,s()}return o>0},Ms=e=>{const t=e.trim();if(!t||t.length>Ds||Ls.test(t)||!Rs(t))return!1;const r=t.toLowerCase();return ar.some(o=>r.includes(o))||t.includes("@")?!1:Ns(t)},cr=e=>{if(!e)return{};const t={};for(const[r,o]of Object.entries(e)){const s=r.trim();if(!Os(s)||t[s]!==void 0||typeof o!="string")continue;const i=o.trim();if(Ms(i)&&(t[s]=i,Object.keys(t).length===xs))break}return Object.fromEntries(Object.entries(t).sort(([r],[o])=>r.localeCompare(o)))},js=e=>e.split(`
29
29
  `).map(t=>` ${t}`).join(`
30
- `),Ms=(e,t,r)=>{if(!sr(r))return null;const o=lr(t),s=Object.keys(o);return s.length===0?null:s.map(i=>`@keyframes ${i} {
31
- ${Ns(o[i])}
30
+ `),Vs=(e,t,r)=>{if(!lr(r))return null;const o=cr(t),s=Object.keys(o);return s.length===0?null:s.map(i=>`@keyframes ${i} {
31
+ ${js(o[i])}
32
32
  }`).join(`
33
33
 
34
- `)};function js(e,t){n.push(t,!0);const r=n.derived(()=>Ms(t.publishedKey,t.keyframes));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),d=n.first_child(a);n.element(d,()=>"style",!1,(u,c)=>{n.attribute_effect(u,()=>({"data-rulecms-project-keyframes":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}const ar=e=>e!==!1,Vs=80,Fs=2e3,Ks=16,cr=["url(","@","</","<script","javascript:","expression("],Bs=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,Us=/^--[A-Za-z_][\w-]*$/,Hs=e=>{for(const t of e)if(t==="{"||t==="}")return!1;return!0},zs=e=>{if(!e||e.length>Vs||e.includes("@")||e.includes(".")||/\s/.test(e))return!1;const t=e.toLowerCase();return cr.some(r=>t.includes(r))?!1:Us.test(e)},Gs=e=>{const t=e.trim();if(!t||t.length>Fs||Bs.test(t)||!Hs(t))return!1;const r=t.toLowerCase();return!cr.some(o=>r.includes(o))},ur=e=>{if(!e)return{};const t={};for(const[r,o]of Object.entries(e)){const s=r.trim();if(!zs(s)||t[s]!==void 0||typeof o!="string")continue;const i=o.trim();if(Gs(i)&&(t[s]=i,Object.keys(t).length===Ks))break}return Object.fromEntries(Object.entries(t).sort(([r],[o])=>r.localeCompare(o)))},Ys=e=>e.split(`
34
+ `)};function Fs(e,t){n.push(t,!0);const r=n.derived(()=>Vs(t.publishedKey,t.keyframes));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),u=n.first_child(a);n.element(u,()=>"style",!1,(d,c)=>{n.attribute_effect(d,()=>({"data-rulecms-project-keyframes":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}const dr=e=>e!==!1,Ks=80,Bs=2e3,Us=16,ur=["url(","@","</","<script","javascript:","expression("],Hs=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,zs=/^--[A-Za-z_][\w-]*$/,Gs=e=>{for(const t of e)if(t==="{"||t==="}")return!1;return!0},Ys=e=>{if(!e||e.length>Ks||e.includes("@")||e.includes(".")||/\s/.test(e))return!1;const t=e.toLowerCase();return ur.some(r=>t.includes(r))?!1:zs.test(e)},Xs=e=>{const t=e.trim();if(!t||t.length>Bs||Hs.test(t)||!Gs(t))return!1;const r=t.toLowerCase();return!ur.some(o=>r.includes(o))},fr=e=>{if(!e)return{};const t={};for(const[r,o]of Object.entries(e)){const s=r.trim();if(!Ys(s)||t[s]!==void 0||typeof o!="string")continue;const i=o.trim();if(Xs(i)&&(t[s]=i,Object.keys(t).length===Us))break}return Object.fromEntries(Object.entries(t).sort(([r],[o])=>r.localeCompare(o)))},Js=e=>e.split(`
35
35
  `).map(t=>` ${t}`).join(`
36
- `),Xs=(e,t,r)=>{if(!ar(r))return null;const o=ur(t),s=Object.keys(o);return s.length===0?null:s.map(i=>`@position-try ${i} {
37
- ${Ys(o[i])}
36
+ `),qs=(e,t,r)=>{if(!dr(r))return null;const o=fr(t),s=Object.keys(o);return s.length===0?null:s.map(i=>`@position-try ${i} {
37
+ ${Js(o[i])}
38
38
  }`).join(`
39
39
 
40
- `)};function Js(e,t){n.push(t,!0);const r=n.derived(()=>Xs(t.publishedKey,t.positionTry));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),d=n.first_child(a);n.element(d,()=>"style",!1,(u,c)=>{n.attribute_effect(u,()=>({"data-rulecms-project-position-try":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function dr(e){return e!==!1}const qs=["*","<number>","<integer>","<length>","<percentage>","<length-percentage>","<color>","<angle>","<time>","<transform-function>","<transform-list>"],Zs=new Set(qs),Qs=/[{};]/,$s=40,ei=200,ti=e=>typeof e=="string"&&Zs.has(e),ni=(e,t)=>t!=="*"&&e===""?!1:t==="*"&&e===""?!0:!(e.length>ei||Qs.test(e)||e.includes("url(")||e.includes("@")),fr=e=>{if(!Array.isArray(e))return[];const t=[],r=new Set;for(const o of e){if(!o||typeof o.name!="string"||!Q(o.name.trim()))continue;const s=o.name.trim();if(r.has(s)||t.length>=$s||!ti(o.syntax)||typeof o.inherits!="boolean")continue;const i=typeof o.initialValue=="string"?o.initialValue.trim():"";ni(i,o.syntax)&&(r.add(s),t.push({name:s,syntax:o.syntax,inherits:o.inherits,initialValue:i}))}return t},ri=e=>{const t=[`@property ${e.name} {`,` syntax: "${e.syntax}";`,` inherits: ${e.inherits?"true":"false"};`];return e.initialValue!==""&&t.push(` initial-value: ${e.initialValue};`),t.push("}"),t.join(`
41
- `)},oi=(e,t,r)=>{if(!dr(r))return null;const o=fr(t);return o.length===0?null:o.map(ri).join(`
40
+ `)};function Zs(e,t){n.push(t,!0);const r=n.derived(()=>qs(t.publishedKey,t.positionTry));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),u=n.first_child(a);n.element(u,()=>"style",!1,(d,c)=>{n.attribute_effect(d,()=>({"data-rulecms-project-position-try":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function gr(e){return e!==!1}const Qs=["*","<number>","<integer>","<length>","<percentage>","<length-percentage>","<color>","<angle>","<time>","<transform-function>","<transform-list>"],$s=new Set(Qs),ei=/[{};]/,ti=40,ni=200,ri=e=>typeof e=="string"&&$s.has(e),oi=(e,t)=>t!=="*"&&e===""?!1:t==="*"&&e===""?!0:!(e.length>ni||ei.test(e)||e.includes("url(")||e.includes("@")),pr=e=>{if(!Array.isArray(e))return[];const t=[],r=new Set;for(const o of e){if(!o||typeof o.name!="string"||!Z(o.name.trim()))continue;const s=o.name.trim();if(r.has(s)||t.length>=ti||!ri(o.syntax)||typeof o.inherits!="boolean")continue;const i=typeof o.initialValue=="string"?o.initialValue.trim():"";oi(i,o.syntax)&&(r.add(s),t.push({name:s,syntax:o.syntax,inherits:o.inherits,initialValue:i}))}return t},si=e=>{const t=[`@property ${e.name} {`,` syntax: "${e.syntax}";`,` inherits: ${e.inherits?"true":"false"};`];return e.initialValue!==""&&t.push(` initial-value: ${e.initialValue};`),t.push("}"),t.join(`
41
+ `)},ii=(e,t,r)=>{if(!gr(r))return null;const o=pr(t);return o.length===0?null:o.map(si).join(`
42
42
 
43
- `)};function si(e,t){n.push(t,!0);const r=n.derived(()=>oi(t.publishedKey,t.cssProperties));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),d=n.first_child(a);n.element(d,()=>"style",!1,(u,c)=>{n.attribute_effect(u,()=>({"data-rulecms-project-css-properties":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function gr(e){return e!==!1}const pr=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),ii=/[{};]/,li=e=>{if(!e)return{};const t={};for(const[r,o]of Object.entries(e)){if(!Q(r)||typeof o!="string")continue;const s=o.trim();s===""||ii.test(s)||(t[r.trim()]=s)}return t},ai=(e,t,r)=>{if(!gr(r))return null;const o=li(t),s=Object.keys(o);if(s.length===0||!e)return null;const i=`[data-rulecms-published-key="${pr(e)}"] > *`,l=s.sort((a,d)=>a.localeCompare(d)).map(a=>` ${a}: ${o[a]};`).join(`
43
+ `)};function li(e,t){n.push(t,!0);const r=n.derived(()=>ii(t.publishedKey,t.cssProperties));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),u=n.first_child(a);n.element(u,()=>"style",!1,(d,c)=>{n.attribute_effect(d,()=>({"data-rulecms-project-css-properties":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function mr(e){return e!==!1}const yr=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),ai=/[{};]/,ci=e=>{if(!e)return{};const t={};for(const[r,o]of Object.entries(e)){if(!Z(r)||typeof o!="string")continue;const s=o.trim();s===""||ai.test(s)||(t[r.trim()]=s)}return t},di=(e,t,r)=>{if(!mr(r))return null;const o=ci(t),s=Object.keys(o);if(s.length===0||!e)return null;const i=`[data-rulecms-published-key="${yr(e)}"] > *`,l=s.sort((a,u)=>a.localeCompare(u)).map(a=>` ${a}: ${o[a]};`).join(`
44
44
  `);return`${i} {
45
45
  ${l}
46
- }`};function mr(e){return e!==!1}const ci=5,ui=200,di=[{kind:"prefers-color-scheme",value:"dark"},{kind:"prefers-color-scheme",value:"light"},{kind:"html-class",value:"dark"},{kind:"data-theme",value:"dark"},{kind:"data-theme",value:"light"}],fi=/[{};]/,gi=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return di.some(r=>r.kind===t.kind&&r.value===t.value)},pi=e=>{if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[r,o]of Object.entries(e)){if(!Q(r)||typeof o!="string")continue;const s=o.trim();s===""||fi.test(s)||s.includes("url(")||s.includes("@")||(t[r.trim()]=s)}return Object.fromEntries(Object.entries(t).sort(([r],[o])=>r.localeCompare(o)))},yr=e=>{if(!Array.isArray(e))return[];const t=[],r=new Set;let o=0;for(const s of e){if(!s||!gi(s.condition))continue;const i=`${s.condition.kind}:${s.condition.value}`;if(r.has(i))continue;const l=pi(s.variables),a=o+Object.keys(l).length;if(!(Object.keys(l).length===0||a>ui)&&(r.add(i),o=a,t.push({condition:s.condition,variables:l}),t.length===ci))break}return t},mi=(e,t)=>{const r=Object.entries(e).map(([o,s])=>` ${o}: ${s};`);return`${t} {
46
+ }`};function hr(e){return e!==!1}const ui=5,fi=200,gi=[{kind:"prefers-color-scheme",value:"dark"},{kind:"prefers-color-scheme",value:"light"},{kind:"html-class",value:"dark"},{kind:"data-theme",value:"dark"},{kind:"data-theme",value:"light"}],pi=/[{};]/,mi=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return gi.some(r=>r.kind===t.kind&&r.value===t.value)},yi=e=>{if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[r,o]of Object.entries(e)){if(!Z(r)||typeof o!="string")continue;const s=o.trim();s===""||pi.test(s)||s.includes("url(")||s.includes("@")||(t[r.trim()]=s)}return Object.fromEntries(Object.entries(t).sort(([r],[o])=>r.localeCompare(o)))},br=e=>{if(!Array.isArray(e))return[];const t=[],r=new Set;let o=0;for(const s of e){if(!s||!mi(s.condition))continue;const i=`${s.condition.kind}:${s.condition.value}`;if(r.has(i))continue;const l=yi(s.variables),a=o+Object.keys(l).length;if(!(Object.keys(l).length===0||a>fi)&&(r.add(i),o=a,t.push({condition:s.condition,variables:l}),t.length===ui))break}return t},hi=(e,t)=>{const r=Object.entries(e).map(([o,s])=>` ${o}: ${s};`);return`${t} {
47
47
  ${r.join(`
48
48
  `)}
49
- }`},yi=e=>e.split(`
49
+ }`},bi=e=>e.split(`
50
50
  `).map(t=>` ${t}`).join(`
51
- `),hi=(e,t)=>{const r=mi(e.variables,t),{kind:o,value:s}=e.condition;return o==="prefers-color-scheme"?`@media (prefers-color-scheme: ${s}) {
52
- ${yi(r)}
53
- }`:o==="html-class"?`html.${s} ${r}`:`[data-theme="${s}"] ${r}`},bi=(e,t,r)=>{if(!mr(r)||!e)return null;const o=yr(t);if(o.length===0)return null;const s=`[data-rulecms-published-key="${pr(e)}"] > *`;return o.map(i=>hi(i,s)).join(`
51
+ `),_i=(e,t)=>{const r=hi(e.variables,t),{kind:o,value:s}=e.condition;return o==="prefers-color-scheme"?`@media (prefers-color-scheme: ${s}) {
52
+ ${bi(r)}
53
+ }`:o==="html-class"?`html.${s} ${r}`:`[data-theme="${s}"] ${r}`},Ci=(e,t,r)=>{if(!hr(r)||!e)return null;const o=br(t);if(o.length===0)return null;const s=`[data-rulecms-published-key="${yr(e)}"] > *`;return o.map(i=>_i(i,s)).join(`
54
54
 
55
- `)};function _i(e,t){n.push(t,!0);const r=n.derived(()=>bi(t.publishedKey,t.themes));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),d=n.first_child(a);n.element(d,()=>"style",!1,(u,c)=>{n.attribute_effect(u,()=>({"data-rulecms-project-themes":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function Ci(e,t){n.push(t,!0);const r=n.derived(()=>ai(t.publishedKey,t.variables));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),d=n.first_child(a);n.element(d,()=>"style",!1,(u,c)=>{n.attribute_effect(u,()=>({"data-rulecms-project-css-variables":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function hr(e){return e!==!1}const vi=["light","dark","light dark"],Ai=["auto","thin","none"],Ei=new Set(vi),wi=new Set(Ai),Si=/[{};]|url\(|@/i,Ti=e=>typeof e=="string"&&e.trim()!==""&&e.trim().length<=400&&!Si.test(e),ue=e=>Ti(e)?e.trim():void 0,br=e=>{if(!e||typeof e!="object"||Array.isArray(e))return null;const t=ue(e.selectionBackground),r=ue(e.selectionColor),o=ue(e.caretColor),s=ue(e.scrollbarColor),i={...typeof e.colorScheme=="string"&&Ei.has(e.colorScheme)?{colorScheme:e.colorScheme}:{},...t?{selectionBackground:t}:{},...r?{selectionColor:r}:{},...o?{caretColor:o}:{},...s?{scrollbarColor:s}:{},...typeof e.scrollbarWidth=="string"&&wi.has(e.scrollbarWidth)?{scrollbarWidth:e.scrollbarWidth}:{}};return Object.keys(i).length>0?i:null},Ii=(e,t,r)=>{if(!hr(r)||!e)return null;const o=br(t);if(!o)return null;const s=`[data-rulecms-published-key="${or(e)}"]`,i=[];o.colorScheme&&i.push(` color-scheme: ${o.colorScheme};`),o.caretColor&&i.push(` caret-color: ${o.caretColor};`),o.scrollbarWidth&&i.push(` scrollbar-width: ${o.scrollbarWidth};`),o.scrollbarColor&&i.push(` scrollbar-color: ${o.scrollbarColor};`);const l=[];o.selectionBackground&&l.push(` background: ${o.selectionBackground};`),o.selectionColor&&l.push(` color: ${o.selectionColor};`);const a=[];return i.length>0&&a.push(`${s} > * {
55
+ `)};function vi(e,t){n.push(t,!0);const r=n.derived(()=>Ci(t.publishedKey,t.themes));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),u=n.first_child(a);n.element(u,()=>"style",!1,(d,c)=>{n.attribute_effect(d,()=>({"data-rulecms-project-themes":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function Ai(e,t){n.push(t,!0);const r=n.derived(()=>di(t.publishedKey,t.variables));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),u=n.first_child(a);n.element(u,()=>"style",!1,(d,c)=>{n.attribute_effect(d,()=>({"data-rulecms-project-css-variables":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function _r(e){return e!==!1}const Ei=["light","dark","light dark"],wi=["auto","thin","none"],Si=new Set(Ei),Ti=new Set(wi),Ii=/[{};]|url\(|@/i,Pi=e=>typeof e=="string"&&e.trim()!==""&&e.trim().length<=400&&!Ii.test(e),ue=e=>Pi(e)?e.trim():void 0,Cr=e=>{if(!e||typeof e!="object"||Array.isArray(e))return null;const t=ue(e.selectionBackground),r=ue(e.selectionColor),o=ue(e.caretColor),s=ue(e.scrollbarColor),i={...typeof e.colorScheme=="string"&&Si.has(e.colorScheme)?{colorScheme:e.colorScheme}:{},...t?{selectionBackground:t}:{},...r?{selectionColor:r}:{},...o?{caretColor:o}:{},...s?{scrollbarColor:s}:{},...typeof e.scrollbarWidth=="string"&&Ti.has(e.scrollbarWidth)?{scrollbarWidth:e.scrollbarWidth}:{}};return Object.keys(i).length>0?i:null},Di=(e,t,r)=>{if(!_r(r)||!e)return null;const o=Cr(t);if(!o)return null;const s=`[data-rulecms-published-key="${ir(e)}"]`,i=[];o.colorScheme&&i.push(` color-scheme: ${o.colorScheme};`),o.caretColor&&i.push(` caret-color: ${o.caretColor};`),o.scrollbarWidth&&i.push(` scrollbar-width: ${o.scrollbarWidth};`),o.scrollbarColor&&i.push(` scrollbar-color: ${o.scrollbarColor};`);const l=[];o.selectionBackground&&l.push(` background: ${o.selectionBackground};`),o.selectionColor&&l.push(` color: ${o.selectionColor};`);const a=[];return i.length>0&&a.push(`${s} > * {
56
56
  ${i.join(`
57
57
  `)}
58
58
  }`),l.length>0&&a.push(`${s} > * ::selection {
59
59
  ${l.join(`
60
60
  `)}
61
61
  }`),a.length>0?a.join(`
62
- `):null};function Pi(e,t){n.push(t,!0);const r=n.derived(()=>Ii(t.publishedKey,t.widgetChrome));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),d=n.first_child(a);n.element(d,()=>"style",!1,(u,c)=>{n.attribute_effect(u,()=>({"data-rulecms-project-widget-chrome":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function Di(e){return e!==!1}function xi(e){const t={};return Object.entries(e).forEach(([r,o])=>{const s={...o};if(s.itemList)try{s.collectionRows=typeof s.itemList=="string"?JSON.parse(s.itemList):s.itemList}catch(l){console.error(`Failed to parse itemList for collection ${r}:`,l),s.collectionRows={rows:[]}}let i=`${s.name}$${r}`;s.parentId&&(i=`${i}@${s.parentId}`),t[i]=s}),t}function Li(e){return typeof e.itemList=="string"?JSON.parse(e.itemList):e.itemList}function Pe(e){const t=Ie(e.fontFaces),r=lr(e.keyframes),o=yr(e.themes),s=fr(e.cssProperties),i=br(e.widgetChrome),l=ur(e.positionTry),a=Di(e.includeClassLayer)&&rr(e.classLayer)?e.classLayer:void 0;return{displayItemList:Li(e.widget),widgetCollections:xi(e.childCollections),...e.libraries?{libraries:e.libraries}:{},...gr(e.includeCssVariables)&&e.cssVariables&&Object.keys(e.cssVariables).length>0?{cssVariables:e.cssVariables}:{},...nr(e.includeClassDefinitions)&&e.classDefinitions&&Object.keys(e.classDefinitions).length>0?{classDefinitions:e.classDefinitions}:{},...rt(e.includeFontFaces)&&t.length>0?{fontFaces:t}:{},...sr(e.includeKeyframes)&&Object.keys(r).length>0?{keyframes:r}:{},...mr(e.includeThemes)&&o.length>0?{themes:o}:{},...dr(e.includeCssProperties)&&s.length>0?{cssProperties:s}:{},...hr(e.includeWidgetChrome)&&i?{widgetChrome:i}:{},...a?{classLayer:a}:{},...ar(e.includePositionTry)&&Object.keys(l).length>0?{positionTry:l}:{}}}function ki(e){const t=e.registry??ie(),r=_e({displayItemList:e.displayItemList,widgetCollections:e.widgetCollections});return t.resolveSync({registrations:e.libraries,referenced:r})}function Ri(e){const t=e.registry??ie(),r=_e({displayItemList:e.displayItemList,widgetCollections:e.widgetCollections});return t.resolve({registrations:e.libraries,referenced:r})}function Oi(e){const t=e.lastIndexOf(pe);return t===-1?e:e.slice(t+pe.length)}const Wi="text/plain";function Ni({token:e,rulesetPublishedKey:t,params:r}){return G(e)?{token:e,rulesetKey:Oi(t),...r?{params:r}:{}}:{token:e,rulesetPublishedKey:t,...r?{params:r}:{},mode:"payload"}}function _r({contentType:e=Wi,...t}){return{method:"POST",headers:{"Content-Type":e},body:JSON.stringify(Ni(t))}}const Ke="rulecms_anon_id";function ft(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Cr(){if(!(typeof window>"u"))try{const e=window.localStorage.getItem(Ke);if(e)return e;const t=ft();return window.localStorage.setItem(Ke,t),t}catch{return ft()}}function vr(e){return e>=500}function Mi(e){if(!(e!=null&&e.success)||!e.data)return null;const{selection:t,...r}=e.data;return{raw:r,selection:t}}function ji(e,t){if(!(e!=null&&e.resolution)||!e.widget)return null;const{resolution:r,...o}=e,s={rulesetPublishedKey:t,outcome:r.outcome,ruleId:r.ruleId??null,variantId:r.variantId??null,widgetKey:r.widgetKey,widgetPublishedKey:r.widgetPublishedKey};return{raw:o,selection:s}}function Ar({token:e,rulesetPublishedKey:t,body:r}){return G(e)?ji(r,t):Mi(r)}function Er(e){return JSON.stringify(e,(t,r)=>{if(r===null||typeof r!="object"||Array.isArray(r))return r;const o={};for(const s of Object.keys(r).sort())o[s]=r[s];return o})}const Vi={display:"flex",justifyContent:"center",alignItems:"center",padding:"3rem",color:"#e2e8f0"},Fi={display:"flex",alignItems:"center",gap:"1rem"},Ki={width:"40px",height:"40px",border:"4px solid #4a5568",borderTopColor:"#63b3ed",borderRadius:"50%",animation:"spin 1s linear infinite"},gt={padding:"1.5rem",backgroundColor:"#742a2a",border:"1px solid #9b2c2c",borderRadius:"8px",color:"#fed7d7"},pt={fontSize:"16px",fontWeight:"600",marginBottom:"0.5rem",color:"#feb2b2"},mt={fontSize:"14px",color:"#fed7d7"},Bi=`
62
+ `):null};function xi(e,t){n.push(t,!0);const r=n.derived(()=>Di(t.publishedKey,t.widgetChrome));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),u=n.first_child(a);n.element(u,()=>"style",!1,(d,c)=>{n.attribute_effect(d,()=>({"data-rulecms-project-widget-chrome":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function Li(e){return e!==!1}function ki(e){const t={};return Object.entries(e).forEach(([r,o])=>{const s={...o};if(s.itemList)try{s.collectionRows=typeof s.itemList=="string"?JSON.parse(s.itemList):s.itemList}catch(l){console.error(`Failed to parse itemList for collection ${r}:`,l),s.collectionRows={rows:[]}}let i=`${s.name}$${r}`;s.parentId&&(i=`${i}@${s.parentId}`),t[i]=s}),t}function Ri(e){return typeof e.itemList=="string"?JSON.parse(e.itemList):e.itemList}function De(e){const t=Pe(e.fontFaces),r=cr(e.keyframes),o=br(e.themes),s=pr(e.cssProperties),i=Cr(e.widgetChrome),l=fr(e.positionTry),a=Li(e.includeClassLayer)&&sr(e.classLayer)?e.classLayer:void 0;return{displayItemList:Ri(e.widget),widgetCollections:ki(e.childCollections),...e.libraries?{libraries:e.libraries}:{},...mr(e.includeCssVariables)&&e.cssVariables&&Object.keys(e.cssVariables).length>0?{cssVariables:e.cssVariables}:{},...or(e.includeClassDefinitions)&&e.classDefinitions&&Object.keys(e.classDefinitions).length>0?{classDefinitions:e.classDefinitions}:{},...st(e.includeFontFaces)&&t.length>0?{fontFaces:t}:{},...lr(e.includeKeyframes)&&Object.keys(r).length>0?{keyframes:r}:{},...hr(e.includeThemes)&&o.length>0?{themes:o}:{},...gr(e.includeCssProperties)&&s.length>0?{cssProperties:s}:{},..._r(e.includeWidgetChrome)&&i?{widgetChrome:i}:{},...a?{classLayer:a}:{},...dr(e.includePositionTry)&&Object.keys(l).length>0?{positionTry:l}:{}}}function Oi(e){const t=e.registry??se(),r=Ce({displayItemList:e.displayItemList,widgetCollections:e.widgetCollections});return t.resolveSync({registrations:e.libraries,referenced:r})}function Wi(e){const t=e.registry??se(),r=Ce({displayItemList:e.displayItemList,widgetCollections:e.widgetCollections});return t.resolve({registrations:e.libraries,referenced:r})}function Ni(e){const t=e.lastIndexOf(me);return t===-1?e:e.slice(t+me.length)}const Mi="text/plain";function ji({token:e,rulesetPublishedKey:t,params:r}){return z(e)?{token:e,rulesetKey:Ni(t),...r?{params:r}:{}}:{token:e,rulesetPublishedKey:t,...r?{params:r}:{},mode:"payload"}}function vr({contentType:e=Mi,...t}){return{method:"POST",headers:{"Content-Type":e},body:JSON.stringify(ji(t))}}const Ue="rulecms_anon_id";function pt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Ar(){if(!(typeof window>"u"))try{const e=window.localStorage.getItem(Ue);if(e)return e;const t=pt();return window.localStorage.setItem(Ue,t),t}catch{return pt()}}function Er(e){return e>=500}function Vi(e){if(!(e!=null&&e.success)||!e.data)return null;const{selection:t,...r}=e.data;return{raw:r,selection:t}}function Fi(e,t){if(!(e!=null&&e.resolution)||!e.widget)return null;const{resolution:r,...o}=e,s={rulesetPublishedKey:t,outcome:r.outcome,ruleId:r.ruleId??null,variantId:r.variantId??null,widgetKey:r.widgetKey,widgetPublishedKey:r.widgetPublishedKey};return{raw:o,selection:s}}function wr({token:e,rulesetPublishedKey:t,body:r}){return z(e)?Fi(r,t):Vi(r)}function Sr(e){return JSON.stringify(e,(t,r)=>{if(r===null||typeof r!="object"||Array.isArray(r))return r;const o={};for(const s of Object.keys(r).sort())o[s]=r[s];return o})}const Ki={display:"flex",justifyContent:"center",alignItems:"center",padding:"3rem",color:"#e2e8f0"},Bi={display:"flex",alignItems:"center",gap:"1rem"},Ui={width:"40px",height:"40px",border:"4px solid #4a5568",borderTopColor:"#63b3ed",borderRadius:"50%",animation:"spin 1s linear infinite"},mt={padding:"1.5rem",backgroundColor:"#742a2a",border:"1px solid #9b2c2c",borderRadius:"8px",color:"#fed7d7"},yt={fontSize:"16px",fontWeight:"600",marginBottom:"0.5rem",color:"#feb2b2"},ht={fontSize:"14px",color:"#fed7d7"},Hi=`
63
63
  @keyframes spin {
64
64
  from {
65
65
  transform: rotate(0deg);
@@ -68,4 +68,4 @@ ${l.join(`
68
68
  transform: rotate(360deg);
69
69
  }
70
70
  }
71
- `,Ui="data-rulecms-published-key";var Hi=n.from_html("<div><div><div></div></div></div>"),zi=n.from_html("<div><div>Error Loading Widget</div> <div> </div></div>"),Gi=n.from_html("<div><div>No Widget Data</div> <div>No widget data available</div></div>"),Yi=n.from_html('<span style="display: contents"><!> <!> <!> <!> <!> <!> <!> <!> <!></span>');function Xi(e,t){n.push(t,!0);let r=n.prop(t,"mode",3,"client-fetch");const o=Re.getContext(qe);let s=n.state(!0),i=n.state(null),l=n.state(null),a=n.state(null),d=n.state("");const u=n.derived(()=>r()==="pre-fetched"),c=n.derived(()=>({sourceComponents:n.get(a)??void 0})),f=n.derived(()=>t.publishedKey||n.get(d));let p=null,g=null,E=!1,A=0;class b extends Error{constructor(m){super(m),this.name="FetchWidgetMessage"}}function _(){if(!n.get(l)){n.set(a,null);return}const y=t.libraries??(o==null?void 0:o.libraries),m=o==null?void 0:o.libraryRegistry,S=ki({displayItemList:n.get(l).displayItemList,widgetCollections:n.get(l).widgetCollections,libraries:y,registry:m});if(S){n.set(a,S,!0);return}Ri({displayItemList:n.get(l).displayItemList,widgetCollections:n.get(l).widgetCollections,libraries:y,registry:m}).then(P=>{n.set(a,P,!0)})}function T(){n.get(l)&&Yn({componentProps:t.componentProps,displayItemList:n.get(l).displayItemList,widgetCollections:n.get(l).widgetCollections,publishedKey:n.get(f)})}function W(){if(E||typeof document>"u")return;const y="rulecms-widget-spinner-styles";if(!document.getElementById(y)){const m=document.createElement("style");m.id=y,m.textContent=Bi,document.head.appendChild(m)}E=!0}function H(){const y=t.token??(o==null?void 0:o.token),m=t.endpoint??(o==null?void 0:o.endpoint),S=G(y),P=t.rulesetPublishedKey;if(!t.publishedKey&&!P||!y){!t.publishedKey&&!P?n.set(i,P!==void 0?S?"Ruleset key is required":"Ruleset published key is required":S?"Widget key is required":"Published key is required",!0):n.set(i,"Token is required. Provide it either directly as a prop (`token`) or via RuleCMSWidgetProvider."),n.set(l,null),n.set(s,!1);return}const N=Er(t.params),R=JSON.stringify({publishedKey:t.publishedKey,rulesetPublishedKey:P,token:y,endpoint:m,paramsKey:N,anonymousId:t.anonymousId,fallbackPublishedKey:t.fallbackPublishedKey,contentType:t.contentType});if(g===R&&n.get(l)){n.set(s,!1),_();return}p==null||p.abort(),p=new AbortController;const K=p.signal;g=R,n.set(s,!0),n.set(i,null);const oe=++A,z=async I=>(await I.json().catch(()=>({error:"Unknown error"}))).error||`Request failed with status ${I.status}`,J=async I=>{const M=Ge({publishedKey:I,token:y,endpoint:m}),B=await fetch(M,{method:"GET",...S?{cache:"no-store"}:{},signal:K});if(!B.ok)throw new b(await z(B));const j=await B.json();if(!j.success)throw new b("Failed to fetch widget data");return j.data};(P?(async()=>{const I=N?JSON.parse(N):{};if(t.anonymousId!==!1){if(typeof t.anonymousId=="string")I.anonId=I.anonId??t.anonymousId;else if(I.anonId==null){const j=Cr();j&&(I.anonId=j)}}let M;try{M=await fetch(Ye({token:y,endpoint:m}),{..._r({token:y,rulesetPublishedKey:P,params:I,contentType:t.contentType}),signal:K})}catch(j){if(j instanceof DOMException&&j.name==="AbortError")throw j;if(t.fallbackPublishedKey)return{raw:await J(t.fallbackPublishedKey),selection:null};throw j}if(!M.ok){if(t.fallbackPublishedKey&&vr(M.status))return{raw:await J(t.fallbackPublishedKey),selection:null};throw new b(await z(M))}const B=Ar({token:y,rulesetPublishedKey:P,body:await M.json()});if(!B)throw new b("Failed to fetch widget data");return{raw:B.raw,selection:B.selection}})():J(t.publishedKey).then(I=>({raw:I,selection:null}))).then(({raw:I,selection:M})=>{var B,j;n.set(l,Pe(I),!0),n.set(d,((B=I.widget)==null?void 0:B.publishedKey)??"",!0),n.set(i,null),_(),T(),M&&((j=t.onSelection)==null||j.call(t,M))}).catch(I=>{I instanceof DOMException&&I.name==="AbortError"||(console.error("Error fetching widget:",I),n.set(i,I instanceof b?I.message:"Failed to fetch widget",!0),n.set(l,null))}).finally(()=>{A===oe&&n.set(s,!1)})}function h(){if(r()==="pre-fetched"){n.set(l,t.initialData??null,!0),n.set(s,!1),n.set(i,null),_(),T();return}W(),H()}n.user_effect(()=>(t.publishedKey,t.rulesetPublishedKey,t.params,t.anonymousId,t.fallbackPublishedKey,t.contentType,t.token,t.endpoint,r(),t.initialData,t.libraries,t.componentProps,Re.untrack(()=>h()),()=>{p==null||p.abort()}));var C=Yi(),v=n.child(C);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.fontFaces});Ss(v,{get publishedKey(){return n.get(f)},get fonts(){return n.get(y)}})}var w=n.sibling(v,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.keyframes});js(w,{get publishedKey(){return n.get(f)},get keyframes(){return n.get(y)}})}var D=n.sibling(w,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.themes});_i(D,{get publishedKey(){return n.get(f)},get themes(){return n.get(y)}})}var x=n.sibling(D,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.cssProperties});si(x,{get publishedKey(){return n.get(f)},get cssProperties(){return n.get(y)}})}var k=n.sibling(x,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.widgetChrome});Pi(k,{get publishedKey(){return n.get(f)},get widgetChrome(){return n.get(y)}})}var $=n.sibling(k,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.positionTry});Js($,{get publishedKey(){return n.get(f)},get positionTry(){return n.get(y)}})}var te=n.sibling($,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.cssVariables});Ci(te,{get publishedKey(){return n.get(f)},get variables(){return n.get(y)}})}var ne=n.sibling(te,2);{let y=n.derived(()=>{var S;return(S=n.get(l))==null?void 0:S.classDefinitions}),m=n.derived(()=>{var S;return(S=n.get(l))==null?void 0:S.classLayer});rs(ne,{get publishedKey(){return n.get(f)},get classes(){return n.get(y)},get classLayer(){return n.get(m)}})}var De=n.sibling(ne,2);{var re=y=>{var m=Hi(),S=n.child(m),P=n.child(S);n.reset(S),n.reset(m),n.template_effect((N,R,K)=>{n.set_style(m,N),n.set_style(S,R),n.set_style(P,K)},[()=>O(Vi),()=>O(Fi),()=>O(Ki)]),n.append(y,m)},V=y=>{var m=zi(),S=n.child(m),P=n.sibling(S,2),N=n.child(P,!0);n.reset(P),n.reset(m),n.template_effect((R,K,oe)=>{n.set_style(m,R),n.set_style(S,K),n.set_style(P,oe),n.set_text(N,n.get(i))},[()=>O(gt),()=>O(pt),()=>O(mt)]),n.append(y,m)},ae=y=>{var m=Gi(),S=n.child(m),P=n.sibling(S,2);n.reset(m),n.template_effect((N,R,K)=>{n.set_style(m,N),n.set_style(S,R),n.set_style(P,K)},[()=>O(gt),()=>O(pt),()=>O(mt)]),n.append(y,m)},xe=y=>{var m=n.comment(),S=n.first_child(m);{var P=R=>{er(R,{get displayItemList(){return n.get(l).displayItemList},get widgetCollections(){return n.get(l).widgetCollections},get plugins(){return n.get(c)},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}})},N=R=>{tr(R,{get displayItemList(){return n.get(l).displayItemList},isComposeMode:!1,isWithinCollection:!1,get widgetCollections(){return n.get(l).widgetCollections},showDropContainers:!1,reduxDeviceDisplayType:"desktop",get plugins(){return n.get(c)},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}})};n.if(S,R=>{n.get(u)?R(P):R(N,-1)})}n.append(y,m)};n.if(De,y=>{r()!=="pre-fetched"&&n.get(s)?y(re):r()!=="pre-fetched"&&n.get(i)?y(V,1):r()!=="pre-fetched"&&!n.get(l)?y(ae,2):n.get(a)&&n.get(l)&&y(xe,3)})}n.reset(C),n.template_effect(()=>n.set_attribute(C,"data-rulecms-published-key",n.get(f))),n.append(e,C),n.pop()}const wr=6e4;class X extends Error{constructor(r,o){super(r);it(this,"status");this.name="FetchRuleCMSWidgetError",this.status=o}}const he=new Map;function Ji(){he.clear()}function yt(e){const t=e==null?void 0:e.cache;return t==="no-store"||t==="reload"||t==="no-cache"}function qi(e,t){const r=he.get(e);if(r){if(r.expiresAt<=t){he.delete(e);return}return r.data}}async function Sr(e){return(await e.json().catch(()=>({error:"Unknown error"}))).error||`Request failed with status ${e.status}`}async function Tr({publishedKey:e,token:t,endpoint:r,fetchOptions:o}){const s=Ge({publishedKey:e,token:t,endpoint:r}),i=G(t),l=Date.now();if(!i&&!yt(o)){const c=qi(s,l);if(c)return c}const a=await fetch(s,{method:"GET",...i?{cache:"no-store"}:{},...o});if(!a.ok)throw new X(await Sr(a),a.status);const d=await a.json();if(!d.success)throw new X("Failed to fetch widget data");const u=Pe(d.data);return!i&&!yt(o)&&he.set(s,{expiresAt:l+wr,data:u}),u}async function Zi(e){const{rulesetPublishedKey:t,params:r,fallbackPublishedKey:o,contentType:s,token:i,endpoint:l,fetchOptions:a}=e,d=()=>Tr({publishedKey:o,token:i,endpoint:l,fetchOptions:a});let u;try{u=await fetch(Ye({token:i,endpoint:l}),{..._r({token:i,rulesetPublishedKey:t,params:r,contentType:s}),...a})}catch(f){if(o)return d();throw f}if(!u.ok){if(o&&vr(u.status))return d();throw new X(await Sr(u),u.status)}const c=Ar({token:i,rulesetPublishedKey:t,body:await u.json()});if(!c)throw new X("Failed to fetch widget data");return{...Pe(c.raw),selection:c.selection}}async function Qi(e){const{publishedKey:t,rulesetPublishedKey:r,token:o}=e;if(!t&&!r){const s=G(o);throw r!==void 0?new X(s?"Ruleset key is required":"Ruleset published key is required"):new X(s?"Widget key is required":"Published key is required")}if(!o)throw new X("Token is required");return e.rulesetPublishedKey?Zi(e):Tr(e)}async function $i(e){const{data:t,libraries:r}=e,o=_e({displayItemList:t.displayItemList,widgetCollections:t.widgetCollections});return ie().resolve({registrations:r,referenced:o})}exports.AlignContentTypes=Or;exports.BreakpointVariantRender=er;exports.COLLECTION_TYPE_PREFIX=He;exports.COMPONENT_PROPS_PATH_SEPARATOR=le;exports.CSS_CLASSES_ATTRIBUTE_NAME=we;exports.CSS_VARIABLE_NAME_MAX_LENGTH=Vt;exports.CSS_VARIABLE_NAME_PATTERN=jt;exports.DEFAULT_BASE_Z_INDEX=nt;exports.DEFAULT_CLOUDINARY_CLOUD_NAME=kt;exports.DEFAULT_LIBRARY_ID=ee;exports.DEFAULT_PUBLISHED_WIDGET_CACHE_MS=wr;exports.DEFAULT_ROW_GAP=Dn;exports.DEV_CLIENT_TOKEN_PREFIX=bt;exports.DEV_WIDGET_API_PATH=At;exports.DEV_WIDGET_RESOLVE_API_PATH=wt;exports.DeviceDisplayTypes=Wr;exports.DisplayComponent=Qn;exports.DisplayItemTypes=be;exports.DragItemIdPrefixTypes=Ue;exports.EMBEDDED_KEY_SEPARATOR=Dt;exports.FLEX_LAYOUT_STYLE_KEYS_THAT_DERIVE_DISPLAY=ln;exports.FetchRuleCMSWidgetError=X;exports.HIDE_WIDGET_ATTRIBUTE_NAME=$e;exports.JustifyContentTypes=We;exports.POINTER_EVENTS_ATTRIBUTE_NAME=Rn;exports.PUBLISHED_KEY_SEPARATOR=pe;exports.PUBLISHED_WIDGET_API_PATH=vt;exports.PUBLISHED_WIDGET_RESOLVE_API_PATH=Et;exports.PageViewTypes=Oe;exports.RULECMS_ANONYMOUS_ID_STORAGE_KEY=Ke;exports.RULECMS_API_ORIGIN=_t;exports.RULECMS_PUBLISHED_KEY_ATTRIBUTE=Ui;exports.RULECMS_WIDGET_CONTEXT_KEY=qe;exports.RenderComponents=tr;exports.RenderComponentsForDevice=ye;exports.RenderComponentsInner=me;exports.RuleCMSWidget=Xi;exports.RuleCMSWidgetProvider=Hr;exports.WIDGET_ATTRIBUTES_IGNORED_IN_COMPOSE_MODE=On;exports.WIDGET_CACHE_API_ORIGIN=Ct;exports.WIDGET_PLACEHOLDER_VALUES_KEY=je;exports.Z_INDEX_WIDGET_ATTRIBUTE_NAME=Nn;exports.alignContentAllowlist=tn;exports.alignItemsAllowlist=$t;exports.backgroundPositionAllowlist=on;exports.backgroundRepeatAllowlist=sn;exports.backgroundSizeAllowlist=rn;exports.borderStyleKeywords=an;exports.boxSpacingSideKeys=Bt;exports.boxSpacingStyleAttributeEntries=uo;exports.buildCloudinaryBackgroundUrl=Mt;exports.buildOverlayLayerBoxStyles=Bn;exports.buildOverlayStackStyles=Kn;exports.buildWidgetFetchUrl=Ge;exports.buildWidgetResolveUrl=Ye;exports.clearPublishedWidgetFetchCache=Ji;exports.collectComponentInstancePaths=zn;exports.collectReferencedLibraryIds=_e;exports.composeSourceComponentsPlugin=ht;exports.createComponentLibraryRegistry=ie;exports.cssAttrArrayKey=ge;exports.defaultPageWidth=Lt;exports.deriveDisplayFlexIfNeeded=Sn;exports.desktopModeWidth=zr;exports.fetchRuleCMSWidget=Qi;exports.findUnmatchedComponentPropsKeys=Gn;exports.flexDirectionAllowlist=nn;exports.flexWrapAllowlist=en;exports.fontFamilyAllowlist=zt;exports.fontStyleAllowlist=Yt;exports.fontWeightAllowlist=Gt;exports.formatBackgroundImageStyles=mn;exports.formatBorderStyles=yn;exports.formatBoxShadowStyles=hn;exports.formatBoxSpacingStyles=bn;exports.formatCssColorStyles=_n;exports.formatCssColorValue=Ae;exports.formatCssEnumStyles=Cn;exports.formatCssLengthStyles=vn;exports.formatCssVariable=F;exports.formatCssVariableStyles=oo;exports.formatLineHeightStyles=An;exports.formatObjectStyleAttribute=wn;exports.formatOpacityStyles=En;exports.formatSpacingSideValue=Z;exports.generatePublishedKey=xt;exports.generatePublishedKeyForEmbedded=Kr;exports.getCollectionIdForCollectionType=Je;exports.getColumnAttributes=se;exports.getComponentAttributesAndStyles=Ne;exports.getComponentsPluginFromPlugins=fe;exports.getCssVariableFromLeaf=L;exports.getDefaultDimensionAttributes=Tn;exports.getDeviceTypeBasedAttributes=Y;exports.getDragItemId=Nr;exports.getDragItemPrefixAndId=St;exports.getIdAndPrefix=Tt;exports.getMergedAttributes=In;exports.getNameAndInstanceIdFromWidgetKey=Mr;exports.getNameFromWidgetKey=jr;exports.getOrCreateAnonymousId=Cr;exports.getOverlayLayerZIndex=jn;exports.getWidgetKeyForCollection=It;exports.getWidgetKeyForCollectionWithPrefix=Vr;exports.getWidgetKeyForPublishedCollection=Pt;exports.getWidgetKeyForPublishedCollectionWithPrefix=Fr;exports.hasBoxShadowLeaf=fn;exports.hasDeviceDivergentValues=Xn;exports.hasInvalidCssVariable=U;exports.hasItems=Pn;exports.hasOverlayLayers=Mn;exports.incrementVersion=Br;exports.isBackgroundImageValue=Ft;exports.isBorderStyleValue=cn;exports.isBorderValue=un;exports.isBoxShadowValue=dn;exports.isBoxSpacingValue=Ut;exports.isCloudinaryCloudName=Ot;exports.isCloudinaryPublicId=Rt;exports.isCloudinaryTransformationString=Nt;exports.isCssColorValue=ve;exports.isCssEnumValue=Ht;exports.isCssVariableName=Q;exports.isDevClientToken=G;exports.isLineHeightValue=gn;exports.isOpacityValue=pn;exports.isOverlayLayerEmptyForDevice=Fn;exports.isRowHiddenForDevice=Ln;exports.isSafeImageUrl=Wt;exports.isSpacingSideValue=q;exports.isWidgetHiddenForDevice=Te;exports.justifyContentAllowlist=Qt;exports.normalizeCssClasses=Se;exports.objectStyleAttributeRegistry=Ee;exports.overflowAllowlist=de;exports.phoneModeWidth=Ze;exports.pointerEventsAllowlist=Zt;exports.prepareRuleCMSWidgetData=Pe;exports.resolveBaseZIndex=Me;exports.resolveKey=Be;exports.resolveOverlayLayerPointerEvents=Vn;exports.resolveRowStyles=kn;exports.resolveWidgetApiOrigin=ze;exports.resolveWidgetContainerStyles=et;exports.resolveWidgetInstanceProps=Un;exports.resolveWidgetLibraries=$i;exports.rowBasedPropertiesAreAssigned=xn;exports.spacingKeywords=Ce;exports.spacingLengthUnits=Kt;exports.stableJsonStringify=Er;exports.tabletModeWidth=Qe;exports.textAlignAllowlist=Xt;exports.textDecorationAllowlist=Jt;exports.textTransformAllowlist=qt;exports.toStyleAttr=O;exports.typeHasPrefix=Xe;exports.warnUnmatchedComponentProps=Yn;exports.widgetBasedPropertiesAreAssigned=Wn;exports.widgetDeclaresOwnHeight=tt;exports.withWidgetPlaceholderValues=Hn;
71
+ `,zi="data-rulecms-published-key";var Gi=n.from_html("<div><div><div></div></div></div>"),Yi=n.from_html("<div><div>Error Loading Widget</div> <div> </div></div>"),Xi=n.from_html("<div><div>No Widget Data</div> <div>No widget data available</div></div>"),Ji=n.from_html('<span style="display: contents"><!> <!> <!> <!> <!> <!> <!> <!> <!></span>');function qi(e,t){n.push(t,!0);let r=n.prop(t,"mode",3,"client-fetch");const o=We.getContext(Qe);let s=n.state(!0),i=n.state(null),l=n.state(null),a=n.state(null),u=n.state("");const d=n.derived(()=>r()==="pre-fetched"),c=n.derived(()=>({sourceComponents:n.get(a)??void 0})),f=n.derived(()=>t.publishedKey||n.get(u));let p=null,g=null,E=!1,A=0;class b extends Error{constructor(m){super(m),this.name="FetchWidgetMessage"}}function _(){if(!n.get(l)){n.set(a,null);return}const y=t.libraries??(o==null?void 0:o.libraries),m=o==null?void 0:o.libraryRegistry,S=Oi({displayItemList:n.get(l).displayItemList,widgetCollections:n.get(l).widgetCollections,libraries:y,registry:m});if(S){n.set(a,S,!0);return}Wi({displayItemList:n.get(l).displayItemList,widgetCollections:n.get(l).widgetCollections,libraries:y,registry:m}).then(D=>{n.set(a,D,!0)})}function T(){n.get(l)&&Jn({componentProps:t.componentProps,displayItemList:n.get(l).displayItemList,widgetCollections:n.get(l).widgetCollections,publishedKey:n.get(f)})}function N(){if(E||typeof document>"u")return;const y="rulecms-widget-spinner-styles";if(!document.getElementById(y)){const m=document.createElement("style");m.id=y,m.textContent=Hi,document.head.appendChild(m)}E=!0}function H(){const y=t.token??(o==null?void 0:o.token),m=t.endpoint??(o==null?void 0:o.endpoint),S=z(y),D=t.rulesetPublishedKey;if(!t.publishedKey&&!D||!y){!t.publishedKey&&!D?n.set(i,D!==void 0?S?"Ruleset key is required":"Ruleset published key is required":S?"Widget key is required":"Published key is required",!0):n.set(i,"Token is required. Provide it either directly as a prop (`token`) or via RuleCMSWidgetProvider."),n.set(l,null),n.set(s,!1);return}const M=Sr(t.params),R=JSON.stringify({publishedKey:t.publishedKey,rulesetPublishedKey:D,token:y,endpoint:m,paramsKey:M,anonymousId:t.anonymousId,fallbackPublishedKey:t.fallbackPublishedKey,contentType:t.contentType});if(g===R&&n.get(l)){n.set(s,!1),_();return}p==null||p.abort(),p=new AbortController;const O=p.signal;g=R,n.set(s,!0),n.set(i,null);const X=++A,ce=async x=>(await x.json().catch(()=>({error:"Unknown error"}))).error||`Request failed with status ${x.status}`,re=async x=>{const F=Xe({publishedKey:x,token:y,endpoint:m}),B=await fetch(F,{method:"GET",...S?{cache:"no-store"}:{},signal:O});if(!B.ok)throw new b(await ce(B));const j=await B.json();if(!j.success)throw new b("Failed to fetch widget data");return j.data};(D?(async()=>{const x=M?JSON.parse(M):{};if(t.anonymousId!==!1){if(typeof t.anonymousId=="string")x.anonId=x.anonId??t.anonymousId;else if(x.anonId==null){const j=Ar();j&&(x.anonId=j)}}let F;try{F=await fetch(Je({token:y,endpoint:m}),{...vr({token:y,rulesetPublishedKey:D,params:x,contentType:t.contentType}),signal:O})}catch(j){if(j instanceof DOMException&&j.name==="AbortError")throw j;if(t.fallbackPublishedKey)return{raw:await re(t.fallbackPublishedKey),selection:null};throw j}if(!F.ok){if(t.fallbackPublishedKey&&Er(F.status))return{raw:await re(t.fallbackPublishedKey),selection:null};throw new b(await ce(F))}const B=wr({token:y,rulesetPublishedKey:D,body:await F.json()});if(!B)throw new b("Failed to fetch widget data");return{raw:B.raw,selection:B.selection}})():re(t.publishedKey).then(x=>({raw:x,selection:null}))).then(({raw:x,selection:F})=>{var B,j;n.set(l,De(x),!0),n.set(u,((B=x.widget)==null?void 0:B.publishedKey)??"",!0),n.set(i,null),_(),T(),F&&((j=t.onSelection)==null||j.call(t,F))}).catch(x=>{x instanceof DOMException&&x.name==="AbortError"||(console.error("Error fetching widget:",x),n.set(i,x instanceof b?x.message:"Failed to fetch widget",!0),n.set(l,null))}).finally(()=>{A===X&&n.set(s,!1)})}function h(){n.set(l,t.initialData??null,!0),n.set(s,!1),n.set(i,null),_(),T()}function v(){if(r()==="pre-fetched"){h();return}N(),H()}function C(){r()==="pre-fetched"&&h()}C(),n.user_effect(()=>(t.publishedKey,t.rulesetPublishedKey,t.params,t.anonymousId,t.fallbackPublishedKey,t.contentType,t.token,t.endpoint,r(),t.initialData,t.libraries,t.componentProps,We.untrack(()=>v()),()=>{p==null||p.abort()}));var w=Ji(),I=n.child(w);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.fontFaces});Is(I,{get publishedKey(){return n.get(f)},get fonts(){return n.get(y)}})}var P=n.sibling(I,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.keyframes});Fs(P,{get publishedKey(){return n.get(f)},get keyframes(){return n.get(y)}})}var k=n.sibling(P,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.themes});vi(k,{get publishedKey(){return n.get(f)},get themes(){return n.get(y)}})}var Q=n.sibling(k,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.cssProperties});li(Q,{get publishedKey(){return n.get(f)},get cssProperties(){return n.get(y)}})}var te=n.sibling(Q,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.widgetChrome});xi(te,{get publishedKey(){return n.get(f)},get widgetChrome(){return n.get(y)}})}var ne=n.sibling(te,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.positionTry});Zs(ne,{get publishedKey(){return n.get(f)},get positionTry(){return n.get(y)}})}var le=n.sibling(ne,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.cssVariables});Ai(le,{get publishedKey(){return n.get(f)},get variables(){return n.get(y)}})}var $=n.sibling(le,2);{let y=n.derived(()=>{var S;return(S=n.get(l))==null?void 0:S.classDefinitions}),m=n.derived(()=>{var S;return(S=n.get(l))==null?void 0:S.classLayer});ss($,{get publishedKey(){return n.get(f)},get classes(){return n.get(y)},get classLayer(){return n.get(m)}})}var V=n.sibling($,2);{var ae=y=>{var m=Gi(),S=n.child(m),D=n.child(S);n.reset(S),n.reset(m),n.template_effect((M,R,O)=>{n.set_style(m,M),n.set_style(S,R),n.set_style(D,O)},[()=>W(Ki),()=>W(Bi),()=>W(Ui)]),n.append(y,m)},xe=y=>{var m=Yi(),S=n.child(m),D=n.sibling(S,2),M=n.child(D,!0);n.reset(D),n.reset(m),n.template_effect((R,O,X)=>{n.set_style(m,R),n.set_style(S,O),n.set_style(D,X),n.set_text(M,n.get(i))},[()=>W(mt),()=>W(yt),()=>W(ht)]),n.append(y,m)},Le=y=>{var m=Xi(),S=n.child(m),D=n.sibling(S,2);n.reset(m),n.template_effect((M,R,O)=>{n.set_style(m,M),n.set_style(S,R),n.set_style(D,O)},[()=>W(mt),()=>W(yt),()=>W(ht)]),n.append(y,m)},ke=y=>{var m=n.comment(),S=n.first_child(m);{var D=R=>{nr(R,{get displayItemList(){return n.get(l).displayItemList},get widgetCollections(){return n.get(l).widgetCollections},get plugins(){return n.get(c)},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}})},M=R=>{rr(R,{get displayItemList(){return n.get(l).displayItemList},isComposeMode:!1,isWithinCollection:!1,get widgetCollections(){return n.get(l).widgetCollections},showDropContainers:!1,reduxDeviceDisplayType:"desktop",get plugins(){return n.get(c)},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}})};n.if(S,R=>{n.get(d)?R(D):R(M,-1)})}n.append(y,m)};n.if(V,y=>{r()!=="pre-fetched"&&n.get(s)?y(ae):r()!=="pre-fetched"&&n.get(i)?y(xe,1):r()!=="pre-fetched"&&!n.get(l)?y(Le,2):n.get(a)&&n.get(l)&&y(ke,3)})}n.reset(w),n.template_effect(()=>n.set_attribute(w,"data-rulecms-published-key",n.get(f))),n.append(e,w),n.pop()}const Tr=6e4;class Y extends Error{constructor(r,o){super(r);at(this,"status");this.name="FetchRuleCMSWidgetError",this.status=o}}const be=new Map;function Zi(){be.clear()}function bt(e){const t=e==null?void 0:e.cache;return t==="no-store"||t==="reload"||t==="no-cache"}function Qi(e,t){const r=be.get(e);if(r){if(r.expiresAt<=t){be.delete(e);return}return r.data}}async function Ir(e){return(await e.json().catch(()=>({error:"Unknown error"}))).error||`Request failed with status ${e.status}`}async function Pr({publishedKey:e,token:t,endpoint:r,fetchOptions:o}){const s=Xe({publishedKey:e,token:t,endpoint:r}),i=z(t),l=Date.now();if(!i&&!bt(o)){const c=Qi(s,l);if(c)return c}const a=await fetch(s,{method:"GET",...i?{cache:"no-store"}:{},...o});if(!a.ok)throw new Y(await Ir(a),a.status);const u=await a.json();if(!u.success)throw new Y("Failed to fetch widget data");const d=De(u.data);return!i&&!bt(o)&&be.set(s,{expiresAt:l+Tr,data:d}),d}async function $i(e){const{rulesetPublishedKey:t,params:r,fallbackPublishedKey:o,contentType:s,token:i,endpoint:l,fetchOptions:a}=e,u=()=>Pr({publishedKey:o,token:i,endpoint:l,fetchOptions:a});let d;try{d=await fetch(Je({token:i,endpoint:l}),{...vr({token:i,rulesetPublishedKey:t,params:r,contentType:s}),...a})}catch(f){if(o)return u();throw f}if(!d.ok){if(o&&Er(d.status))return u();throw new Y(await Ir(d),d.status)}const c=wr({token:i,rulesetPublishedKey:t,body:await d.json()});if(!c)throw new Y("Failed to fetch widget data");return{...De(c.raw),selection:c.selection}}async function el(e){const{publishedKey:t,rulesetPublishedKey:r,token:o}=e;if(!t&&!r){const s=z(o);throw r!==void 0?new Y(s?"Ruleset key is required":"Ruleset published key is required"):new Y(s?"Widget key is required":"Published key is required")}if(!o)throw new Y("Token is required");return e.rulesetPublishedKey?$i(e):Pr(e)}async function tl(e){const{data:t,libraries:r}=e,o=Ce({displayItemList:t.displayItemList,widgetCollections:t.widgetCollections});return se().resolve({registrations:r,referenced:o})}exports.AlignContentTypes=Nr;exports.BreakpointVariantRender=nr;exports.COLLECTION_TYPE_PREFIX=Ge;exports.COMPONENT_PROPS_PATH_SEPARATOR=ie;exports.CSS_CLASSES_ATTRIBUTE_NAME=Se;exports.CSS_VARIABLE_NAME_MAX_LENGTH=Kt;exports.CSS_VARIABLE_NAME_PATTERN=Ft;exports.DEFAULT_BASE_Z_INDEX=ot;exports.DEFAULT_CLOUDINARY_CLOUD_NAME=Ot;exports.DEFAULT_LIBRARY_ID=ee;exports.DEFAULT_PUBLISHED_WIDGET_CACHE_MS=Tr;exports.DEFAULT_ROW_GAP=Ln;exports.DEV_CLIENT_TOKEN_PREFIX=Ct;exports.DEV_WIDGET_API_PATH=wt;exports.DEV_WIDGET_RESOLVE_API_PATH=Tt;exports.DeviceDisplayTypes=Mr;exports.DisplayComponent=er;exports.DisplayItemTypes=_e;exports.DragItemIdPrefixTypes=ze;exports.EMBEDDED_KEY_SEPARATOR=Lt;exports.FLEX_LAYOUT_STYLE_KEYS_THAT_DERIVE_DISPLAY=cn;exports.FetchRuleCMSWidgetError=Y;exports.HIDE_WIDGET_ATTRIBUTE_NAME=tt;exports.JustifyContentTypes=Me;exports.POINTER_EVENTS_ATTRIBUTE_NAME=Wn;exports.PUBLISHED_KEY_SEPARATOR=me;exports.PUBLISHED_WIDGET_API_PATH=Et;exports.PUBLISHED_WIDGET_RESOLVE_API_PATH=St;exports.PageViewTypes=Ne;exports.RULECMS_ANONYMOUS_ID_STORAGE_KEY=Ue;exports.RULECMS_API_ORIGIN=vt;exports.RULECMS_PUBLISHED_KEY_ATTRIBUTE=zi;exports.RULECMS_WIDGET_CONTEXT_KEY=Qe;exports.RenderComponents=rr;exports.RenderComponentsForDevice=he;exports.RenderComponentsInner=ye;exports.RuleCMSWidget=qi;exports.RuleCMSWidgetProvider=Gr;exports.WIDGET_ATTRIBUTES_IGNORED_IN_COMPOSE_MODE=Nn;exports.WIDGET_CACHE_API_ORIGIN=At;exports.WIDGET_PLACEHOLDER_VALUES_KEY=Fe;exports.Z_INDEX_WIDGET_ATTRIBUTE_NAME=jn;exports.alignContentAllowlist=rn;exports.alignItemsAllowlist=tn;exports.backgroundPositionAllowlist=ln;exports.backgroundRepeatAllowlist=an;exports.backgroundSizeAllowlist=sn;exports.borderStyleKeywords=dn;exports.boxSpacingSideKeys=Ht;exports.boxSpacingStyleAttributeEntries=go;exports.buildCloudinaryBackgroundUrl=Vt;exports.buildOverlayLayerBoxStyles=Hn;exports.buildOverlayStackStyles=Un;exports.buildWidgetFetchUrl=Xe;exports.buildWidgetResolveUrl=Je;exports.clearPublishedWidgetFetchCache=Zi;exports.collectComponentInstancePaths=Yn;exports.collectReferencedLibraryIds=Ce;exports.composeSourceComponentsPlugin=_t;exports.createComponentLibraryRegistry=se;exports.cssAttrArrayKey=pe;exports.defaultPageWidth=Rt;exports.deriveDisplayFlexIfNeeded=In;exports.desktopModeWidth=Yr;exports.fetchRuleCMSWidget=el;exports.findUnmatchedComponentPropsKeys=Xn;exports.flexDirectionAllowlist=on;exports.flexWrapAllowlist=nn;exports.fontFamilyAllowlist=Yt;exports.fontStyleAllowlist=Jt;exports.fontWeightAllowlist=Xt;exports.formatBackgroundImageStyles=hn;exports.formatBorderStyles=bn;exports.formatBoxShadowStyles=_n;exports.formatBoxSpacingStyles=Cn;exports.formatCssColorStyles=vn;exports.formatCssColorValue=Ee;exports.formatCssEnumStyles=An;exports.formatCssLengthStyles=En;exports.formatCssVariable=K;exports.formatCssVariableStyles=io;exports.formatLineHeightStyles=wn;exports.formatObjectStyleAttribute=Tn;exports.formatOpacityStyles=Sn;exports.formatSpacingSideValue=q;exports.generatePublishedKey=kt;exports.generatePublishedKeyForEmbedded=Ur;exports.getCollectionIdForCollectionType=Ze;exports.getColumnAttributes=oe;exports.getComponentAttributesAndStyles=je;exports.getComponentsPluginFromPlugins=ge;exports.getCssVariableFromLeaf=L;exports.getDefaultDimensionAttributes=Pn;exports.getDeviceTypeBasedAttributes=G;exports.getDragItemId=jr;exports.getDragItemPrefixAndId=It;exports.getIdAndPrefix=Pt;exports.getMergedAttributes=Dn;exports.getNameAndInstanceIdFromWidgetKey=Vr;exports.getNameFromWidgetKey=Fr;exports.getOrCreateAnonymousId=Ar;exports.getOverlayLayerZIndex=Fn;exports.getWidgetKeyForCollection=Dt;exports.getWidgetKeyForCollectionWithPrefix=Kr;exports.getWidgetKeyForPublishedCollection=xt;exports.getWidgetKeyForPublishedCollectionWithPrefix=Br;exports.hasBoxShadowLeaf=pn;exports.hasDeviceDivergentValues=qn;exports.hasInvalidCssVariable=U;exports.hasItems=xn;exports.hasOverlayLayers=Vn;exports.incrementVersion=Hr;exports.isBackgroundImageValue=Bt;exports.isBorderStyleValue=un;exports.isBorderValue=fn;exports.isBoxShadowValue=gn;exports.isBoxSpacingValue=zt;exports.isCloudinaryCloudName=Nt;exports.isCloudinaryPublicId=Wt;exports.isCloudinaryTransformationString=jt;exports.isCssColorValue=Ae;exports.isCssEnumValue=Gt;exports.isCssVariableName=Z;exports.isDevClientToken=z;exports.isLineHeightValue=mn;exports.isOpacityValue=yn;exports.isOverlayLayerEmptyForDevice=Bn;exports.isRowHiddenForDevice=Rn;exports.isSafeImageUrl=Mt;exports.isSpacingSideValue=J;exports.isWidgetHiddenForDevice=Ie;exports.justifyContentAllowlist=en;exports.normalizeCssClasses=Te;exports.objectStyleAttributeRegistry=we;exports.overflowAllowlist=fe;exports.phoneModeWidth=$e;exports.pointerEventsAllowlist=$t;exports.prepareRuleCMSWidgetData=De;exports.resolveBaseZIndex=Ve;exports.resolveKey=He;exports.resolveOverlayLayerPointerEvents=Kn;exports.resolveRowStyles=On;exports.resolveWidgetApiOrigin=Ye;exports.resolveWidgetContainerStyles=nt;exports.resolveWidgetInstanceProps=zn;exports.resolveWidgetLibraries=tl;exports.rowBasedPropertiesAreAssigned=kn;exports.spacingKeywords=ve;exports.spacingLengthUnits=Ut;exports.stableJsonStringify=Sr;exports.tabletModeWidth=et;exports.textAlignAllowlist=qt;exports.textDecorationAllowlist=Zt;exports.textTransformAllowlist=Qt;exports.toStyleAttr=W;exports.typeHasPrefix=qe;exports.warnUnmatchedComponentProps=Jn;exports.widgetBasedPropertiesAreAssigned=Mn;exports.widgetDeclaresOwnHeight=rt;exports.withWidgetPlaceholderValues=Gn;