@rulecms/widget-svelte 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -0
- package/dist/index.cjs +18 -0
- package/dist/index.d.ts +1323 -0
- package/dist/index.js +4337 -0
- package/package.json +70 -0
package/README.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# @rulecms/widget-svelte
|
|
2
|
+
|
|
3
|
+
Svelte widget component for [RuleCMS](https://rulecms.com) — the Svelte counterpart of [`@rulecms/widget-react`](https://www.npmjs.com/package/@rulecms/widget-react).
|
|
4
|
+
|
|
5
|
+
Fetches a widget by **token + key** and renders the `itemList` layout tree through registered component libraries (default: [`@rulecms/source-components-svelte`](https://github.com/rulecms/source-components-svelte)).
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @rulecms/widget-svelte @rulecms/source-components-svelte
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Peer dependency: `svelte` >= 5.0.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```svelte
|
|
18
|
+
<script>
|
|
19
|
+
import { RuleCMSWidget, RuleCMSWidgetProvider } from '@rulecms/widget-svelte';
|
|
20
|
+
import * as sourceComponents from '@rulecms/source-components-svelte';
|
|
21
|
+
|
|
22
|
+
const token = 'your-token';
|
|
23
|
+
const publishedKey = 'your-widget-key';
|
|
24
|
+
const libraries = { default: sourceComponents };
|
|
25
|
+
const componentProps = {
|
|
26
|
+
'b721c4e2-…': { onClick: (event) => console.log('cta', event) },
|
|
27
|
+
};
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<RuleCMSWidgetProvider {token} {libraries}>
|
|
31
|
+
<RuleCMSWidget {publishedKey} {componentProps} />
|
|
32
|
+
</RuleCMSWidgetProvider>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
- Staging/Production: plain token + `environmentId---widget-…` published key → widget-cache
|
|
36
|
+
- Development: `dev.…` token + draft `widget-…` key → rulecms.com live drafts
|
|
37
|
+
|
|
38
|
+
Same routing rules as `@rulecms/widget-react`.
|
|
39
|
+
|
|
40
|
+
## Server-side rendering
|
|
41
|
+
|
|
42
|
+
Fetch widget data on the server (or at build time), then render with pre-fetched data so images and content appear in the initial HTML.
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { fetchRuleCMSWidget } from '@rulecms/widget-svelte';
|
|
46
|
+
|
|
47
|
+
const data = await fetchRuleCMSWidget({
|
|
48
|
+
publishedKey: process.env.RULECMS_PUBLISHED_KEY,
|
|
49
|
+
token: process.env.RULECMS_TOKEN,
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```svelte
|
|
54
|
+
<RuleCMSWidget
|
|
55
|
+
mode="pre-fetched"
|
|
56
|
+
{publishedKey}
|
|
57
|
+
initialData={data}
|
|
58
|
+
{libraries}
|
|
59
|
+
/>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
No token is needed on the client in `pre-fetched` mode — the widget does not refetch in the browser. Pre-fetched mode uses CSS breakpoint variants so server HTML matches all viewport widths.
|
|
63
|
+
|
|
64
|
+
## Host `componentProps`
|
|
65
|
+
|
|
66
|
+
Pass extra props — a click handler, a callback — to one component instance by its column id. A key may be a bare id (every copy of a repeated collection) or a `/`-path of enclosing collection columns ending at the target (one embedding). Longest match wins.
|
|
67
|
+
|
|
68
|
+
`r-button` reads `onClick` from the bag. The renderer never inspects the contents. In development, a key that addresses no column in the widget is printed once so typos are visible while building.
|
|
69
|
+
|
|
70
|
+
## Develop locally
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
cd widget-svelte
|
|
74
|
+
npm install
|
|
75
|
+
npm test
|
|
76
|
+
npm run lint
|
|
77
|
+
npm run typecheck
|
|
78
|
+
npm run build
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Publishing
|
|
82
|
+
|
|
83
|
+
Follow `__docs__/RUNBOOK_version-bump-and-release.md`.
|
|
84
|
+
|
|
85
|
+
### Increment version
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm run version:patch
|
|
89
|
+
npm run version:minor
|
|
90
|
+
npm run version:major
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Publish to npm
|
|
94
|
+
|
|
95
|
+
Push the version tag. GitHub Actions publishes via trusted publishing
|
|
96
|
+
(`.github/workflows/publish.yml`). Do not run `npm run release` or
|
|
97
|
+
`npm publish` locally except for the first-ever version of a new package
|
|
98
|
+
(npm cannot attach a trusted publisher until the package exists).
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
git push && git push --tags
|
|
102
|
+
npm view @rulecms/widget-svelte version
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
Proprietary — RuleCMS, LLC
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";var ns=Object.defineProperty;var _r=e=>{throw TypeError(e)};var rs=(e,t,n)=>t in e?ns(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var pe=(e,t,n)=>rs(e,typeof t!="symbol"?t+"":t,n),Pn=(e,t,n)=>t.has(e)||_r("Cannot "+n);var v=(e,t,n)=>(Pn(e,t,"read from private field"),n?n.call(e):t.get(e)),O=(e,t,n)=>t.has(e)?_r("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Z=(e,t,n,r)=>(Pn(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),j=(e,t,n)=>(Pn(e,t,"access private method"),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Fn=require("svelte"),os="5";var Wr;typeof window<"u"&&((Wr=window.__svelte??(window.__svelte={})).v??(Wr.v=new Set)).add(os);const is=1,ss=2,Vr=4,ls=8,as=16,us=1,cs=2,K=Symbol("uninitialized"),jr="http://www.w3.org/1999/xhtml",fs="http://www.w3.org/2000/svg",Br=!1;var Ur=Array.isArray,ds=Array.prototype.indexOf,nn=Array.prototype.includes,zn=Array.from,Tt=Object.getOwnPropertyDescriptor,ps=Object.getOwnPropertyDescriptors,hs=Object.prototype,gs=Array.prototype,Kr=Object.getPrototypeOf;function wt(e){return typeof e=="function"}const vs=()=>{};function ms(e){for(var t=0;t<e.length;t++)e[t]()}function Hr(){var e,t,n=new Promise((r,o)=>{e=r,t=o});return{promise:n,resolve:e,reject:t}}const Y=2,kt=4,qn=8,Yr=1<<24,ye=16,fe=32,je=64,ys=128,ae=512,H=1024,B=2048,we=4096,X=8192,ue=16384,mt=32768,wr=1<<25,Be=65536,rn=1<<17,_s=1<<18,mn=1<<19,ws=1<<20,Se=1<<25,Ze=65536,on=1<<21,at=1<<22,Fe=1<<23,Zt=Symbol("$state"),bs=Symbol("legacy props"),Cs=Symbol(""),kn=Symbol("attributes"),br=Symbol("class"),Cr=Symbol("style"),qt=Symbol("text"),Bt=new class extends Error{constructor(){super(...arguments);pe(this,"name","StaleReactionError");pe(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function As(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function Ss(e,t,n){throw new Error("https://svelte.dev/e/each_key_duplicate")}function Es(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Is(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Ts(e){throw new Error("https://svelte.dev/e/effect_orphan")}function Ds(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Ps(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function ks(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function xs(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function Rs(){console.warn("https://svelte.dev/e/derived_inert")}function Gr(e){return e===this.v}function Ls(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function zr(e){return!Ls(e,this.v)}let Ms=!1,ce=null;function sn(e){ce=e}function Re(e,t=!1,n){ce={p:ce,i:!1,c:null,e:null,s:e,x:null,r:k,l:null}}function Le(e){var t=ce,n=t.e;if(n!==null){t.e=null;for(var r of n)co(r)}return t.i=!0,ce=t.p,{}}function qr(){return!0}let it=[];function Ns(){var e=it;it=[],ms(e)}function Vn(e){if(it.length===0){var t=it;queueMicrotask(()=>{t===it&&Ns()})}it.push(e)}function Os(e){var t=k;if(t===null)return E.f|=Fe,e;if((t.f&mt)===0&&(t.f&kt)===0)throw e;ln(e,t)}function ln(e,t){if(!(t!==null&&(t.f&ue)!==0)){for(;t!==null;){if((t.f&ys)!==0){if((t.f&mt)===0)throw e;try{t.b.error(e);return}catch(n){e=n}}t=t.parent}throw e}}const Ws=-7169;function F(e,t){e.f=e.f&Ws|t}function Xn(e){(e.f&ae)!==0||e.deps===null?F(e,H):F(e,we)}function Xr(e){if(e!==null)for(const t of e)(t.f&Y)===0||(t.f&Ze)===0||(t.f^=Ze,Xr(t.deps))}function Fs(e,t,n){(e.f&B)!==0?t.add(e):(e.f&we)!==0&&n.add(e),Xr(e.deps),F(e,H)}function yn(e){var t=E,n=k;Ke(null),gt(null);try{return e()}finally{Ke(t),gt(n)}}function Vs(e,t,n,r){const o=Zn;var i=e.filter(d=>!d.settled),s=t.map(o);if(n.length===0&&i.length===0){r(s);return}var l=k,a=js(),c=i.length===1?i[0].promise:i.length>1?Promise.all(i.map(d=>d.promise)):null;function f(d){if((l.f&ue)===0){a();try{r([...s,...d])}catch(m){ln(m,l)}an()}}var h=Zr();if(n.length===0){c.then(()=>f([])).finally(h);return}function u(){Promise.all(n.map(d=>Bs(d))).then(f).catch(d=>ln(d,l)).finally(h)}c?c.then(()=>{a(),u(),an()}):u()}function js(){var e=k,t=E,n=ce,r=T;return function(i=!0){gt(e),Ke(t),sn(n),i&&(e.f&ue)===0&&(r==null||r.activate(),r==null||r.apply())}}function an(e=!0){gt(null),Ke(null),sn(null),e&&(T==null||T.deactivate())}function Zr(){var e=k,t=e.b,n=T,r=!!(t!=null&&t.is_rendered());return t==null||t.update_pending_count(1,n),n.increment(r,e),()=>{t==null||t.update_pending_count(-1,n),n.decrement(r,e)}}function Zn(e){var t=Y|B;return k!==null&&(k.f|=mn),{ctx:ce,deps:null,effects:null,equals:Gr,f:t,fn:e,reactions:null,rv:0,v:K,wv:0,parent:k,ac:null}}const Ct=Symbol("obsolete");function Bs(e,t,n){let r=k;r===null&&As();var o=void 0,i=Rt(K),s=!E,l=new Set;return nl(()=>{var d,m;var a=k,c=Hr();o=c.promise;try{Promise.resolve(e()).then(c.resolve,y=>{y!==Bt&&c.reject(y)}).finally(an)}catch(y){c.reject(y),an()}var f=T;if(s){if((a.f&mt)!==0)var h=Zr();if((d=r.b)!=null&&d.is_rendered())(m=f.async_deriveds.get(a))==null||m.reject(Ct);else for(const y of l.values())y.reject(Ct);l.add(c),f.async_deriveds.set(a,c)}const u=(y,g=void 0)=>{h==null||h(),l.delete(c),g!==Ct&&(f.activate(),g?(i.f|=Fe,Lt(i,g)):((i.f&Fe)!==0&&(i.f^=Fe),Lt(i,y)),f.deactivate())};c.promise.then(u,y=>u(null,y||"unknown"))}),uo(()=>{for(const a of l)a.reject(Ct)}),new Promise(a=>{function c(f){function h(){f===o?a(i):c(o)}f.then(h,h)}c(o)})}function A(e){const t=Zn(e);return mo(t),t}function Us(e){const t=Zn(e);return t.equals=zr,t}function Ks(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n<t.length;n+=1)ke(t[n])}}function Jn(e){var t,n=k,r=e.parent;if(!Ue&&r!==null&&e.v!==K&&(r.f&(ue|X))!==0)return Rs(),e.v;gt(r);try{e.f&=~Ze,Ks(e),t=bo(e)}finally{gt(n)}return t}function Jr(e){var t=Jn(e);if(!e.equals(t)&&(e.wv=_o(),(!(T!=null&&T.is_fork)||e.deps===null)&&(T!==null?(T.capture(e,t,!0),Dt==null||Dt.capture(e,t,!0)):e.v=t,e.deps===null))){F(e,H);return}Ue||(z!==null?(ao()||T!=null&&T.is_fork)&&z.set(e,t):Xn(e))}function Hs(e){var t;if(e.effects!==null)for(const n of e.effects)(n.teardown||n.ac)&&((t=n.teardown)==null||t.call(n),n.ac!==null&&yn(()=>{n.ac.abort(Bt),n.ac=null}),n.fn!==null&&(n.teardown=vs),Nt(n,0),tr(n))}function Qr(e){if(e.effects!==null)for(const t of e.effects)t.teardown&&t.fn!==null&&vt(t)}let xn=null,rt=null,T=null,Dt=null,z=null,jn=null,Rn=!1,st=null,Jt=null;var Ar=0;let Ys=1;var ut,Oe,Ye,ct,ft,dt,De,pt,J,Ft,Pe,ge,Ce,ht,Ge,x,Bn,At,Un,$r,eo,ot,Gs,St;const gn=class gn{constructor(){O(this,x);pe(this,"id",Ys++);O(this,ut,!1);pe(this,"linked",!0);O(this,Oe,null);O(this,Ye,null);pe(this,"async_deriveds",new Map);pe(this,"current",new Map);pe(this,"previous",new Map);O(this,ct,new Set);O(this,ft,new Set);O(this,dt,0);O(this,De,new Map);O(this,pt,null);O(this,J,[]);O(this,Ft,[]);O(this,Pe,new Set);O(this,ge,new Set);O(this,Ce,new Map);O(this,ht,new Set);pe(this,"is_fork",!1);O(this,Ge,!1);rt===null?xn=rt=this:(Z(rt,Ye,this),Z(this,Oe,rt)),rt=this}skip_effect(t){v(this,Ce).has(t)||v(this,Ce).set(t,{d:[],m:[]}),v(this,ht).delete(t)}unskip_effect(t,n=r=>this.schedule(r)){var r=v(this,Ce).get(t);if(r){v(this,Ce).delete(t);for(var o of r.d)F(o,B),n(o);for(o of r.m)F(o,we),n(o)}v(this,ht).add(t)}capture(t,n,r=!1){t.v!==K&&!this.previous.has(t)&&this.previous.set(t,t.v),(t.f&Fe)===0&&(this.current.set(t,[n,r]),z==null||z.set(t,n)),this.is_fork||(t.v=n)}activate(){T=this}deactivate(){T=null,z=null}flush(){try{Rn=!0,T=this,j(this,x,At).call(this)}finally{Ar=0,jn=null,st=null,Jt=null,Rn=!1,T=null,z=null,qe.clear()}}discard(){var t;for(const n of v(this,ft))n(this);v(this,ft).clear();for(const n of this.async_deriveds.values())n.reject(Ct);j(this,x,St).call(this),(t=v(this,pt))==null||t.resolve()}register_created_effect(t){v(this,Ft).push(t)}increment(t,n){if(Z(this,dt,v(this,dt)+1),t){let r=v(this,De).get(n)??0;v(this,De).set(n,r+1)}}decrement(t,n){if(Z(this,dt,v(this,dt)-1),t){let r=v(this,De).get(n)??0;r===1?v(this,De).delete(n):v(this,De).set(n,r-1)}v(this,Ge)||(Z(this,Ge,!0),Vn(()=>{Z(this,Ge,!1),this.linked&&this.flush()}))}transfer_effects(t,n){for(const r of t)v(this,Pe).add(r);for(const r of n)v(this,ge).add(r);t.clear(),n.clear()}oncommit(t){v(this,ct).add(t)}ondiscard(t){v(this,ft).add(t)}settled(){return(v(this,pt)??Z(this,pt,Hr())).promise}static ensure(){if(T===null){const t=T=new gn;Rn||Vn(()=>{v(t,ut)||t.flush()})}return T}apply(){{z=null;return}}schedule(t){var o;if(jn=t,(o=t.b)!=null&&o.is_pending&&(t.f&(kt|qn|Yr))!==0&&(t.f&mt)===0){t.b.defer_effect(t);return}for(var n=t;n.parent!==null;){n=n.parent;var r=n.f;if(st!==null&&n===k&&(E===null||(E.f&Y)===0))return;if((r&(je|fe))!==0){if((r&H)===0)return;n.f^=H}}v(this,J).push(n)}};ut=new WeakMap,Oe=new WeakMap,Ye=new WeakMap,ct=new WeakMap,ft=new WeakMap,dt=new WeakMap,De=new WeakMap,pt=new WeakMap,J=new WeakMap,Ft=new WeakMap,Pe=new WeakMap,ge=new WeakMap,Ce=new WeakMap,ht=new WeakMap,Ge=new WeakMap,x=new WeakSet,Bn=function(){if(this.is_fork)return!0;for(const r of v(this,De).keys()){for(var t=r,n=!1;t.parent!==null;){if(v(this,Ce).has(t)){n=!0;break}t=t.parent}if(!n)return!0}return!1},At=function(){var a,c,f,h;Z(this,ut,!0),Ar++>1e3&&(j(this,x,St).call(this),zs());for(const u of v(this,Pe))v(this,ge).delete(u),F(u,B),this.schedule(u);for(const u of v(this,ge))F(u,we),this.schedule(u);const t=v(this,J);Z(this,J,[]),this.apply();var n=st=[],r=[],o=Jt=[];for(const u of t)try{j(this,x,Un).call(this,u,n,r)}catch(d){throw ro(u),j(this,x,Bn).call(this)||this.discard(),d}if(T=null,o.length>0){var i=gn.ensure();for(const u of o)i.schedule(u)}if(st=null,Jt=null,j(this,x,Bn).call(this)){j(this,x,ot).call(this,r),j(this,x,ot).call(this,n);for(const[u,d]of v(this,Ce))no(u,d);o.length>0&&j(a=T,x,At).call(a);return}const s=j(this,x,$r).call(this);if(s){j(this,x,ot).call(this,r),j(this,x,ot).call(this,n),j(c=s,x,eo).call(c,this);return}v(this,Pe).clear(),v(this,ge).clear();for(const u of v(this,ct))u(this);v(this,ct).clear(),Dt=this,Sr(r),Sr(n),Dt=null,(f=v(this,pt))==null||f.resolve();var l=T;if(v(this,dt)===0&&(v(this,J).length===0||l!==null)&&j(this,x,St).call(this),v(this,J).length>0)if(l!==null){const u=l;v(u,J).push(...v(this,J).filter(d=>!v(u,J).includes(d)))}else l=this;l!==null&&j(h=l,x,At).call(h)},Un=function(t,n,r){t.f^=H;for(var o=t.first;o!==null;){var i=o.f,s=(i&(fe|je))!==0,l=s&&(i&H)!==0,a=l||(i&X)!==0||v(this,Ce).has(o);if(!a&&o.fn!==null){s?o.f^=H:(i&kt)!==0?n.push(o):Ht(o)&&((i&ye)!==0&&v(this,ge).add(o),vt(o));var c=o.first;if(c!==null){o=c;continue}}for(;o!==null;){var f=o.next;if(f!==null){o=f;break}o=o.parent}}},$r=function(){for(var t=v(this,Oe);t!==null;){if(!t.is_fork){for(const[n,[,r]]of this.current)if(t.current.has(n)&&!r)return t}t=v(t,Oe)}return null},eo=function(t){var r;for(const[o,i]of t.current)!this.previous.has(o)&&t.previous.has(o)&&this.previous.set(o,t.previous.get(o)),this.current.set(o,i);for(const[o,i]of t.async_deriveds){const s=this.async_deriveds.get(o);s&&i.promise.then(s.resolve).catch(s.reject)}t.async_deriveds.clear(),this.transfer_effects(v(t,Pe),v(t,ge));const n=o=>{var i=o.reactions;if(i!==null&&!((o.f&Y)!==0&&(o.f&(B|we))===0))for(const a of i){var s=a.f;if((s&Y)!==0)n(a);else{var l=a;s&(at|ye)&&!this.async_deriveds.has(l)&&(v(this,ge).delete(l),F(l,B),this.schedule(l))}}};for(const o of this.current.keys())n(o);this.oncommit(()=>t.discard()),j(r=t,x,St).call(r),T=this,j(this,x,At).call(this)},ot=function(t){for(var n=0;n<t.length;n+=1)Fs(t[n],v(this,Pe),v(this,ge))},Gs=function(){var h;for(let u=xn;u!==null;u=v(u,Ye)){var t=u.id<this.id,n=[];for(const[d,[m,y]]of this.current){if(u.current.has(d)){var r=u.current.get(d)[0];if(t&&m!==r)u.current.set(d,[m,y]);else continue}n.push(d)}if(t)for(const[d,m]of this.async_deriveds){const y=u.async_deriveds.get(d);y&&m.promise.then(y.resolve).catch(y.reject)}var o=[...u.current.keys()].filter(d=>!u.current.get(d)[1]);if(!(!v(u,ut)||o.length===0)){var i=o.filter(d=>!this.current.has(d));if(i.length===0)t&&u.discard();else if(n.length>0){if(t)for(const d of v(this,ht))u.unskip_effect(d,m=>{var y;(m.f&(ye|at))!==0?u.schedule(m):j(y=u,x,ot).call(y,[m])});u.activate();var s=new Set,l=new Map;for(var a of n)to(a,i,s,l);l=new Map;var c=[...u.current].filter(([d,m])=>{const y=this.current.get(d);return y?y[0]!==m[0]||y[1]!==m[1]:!0}).map(([d])=>d);if(c.length>0)for(const d of v(this,Ft))(d.f&(ue|X|rn))===0&&Qn(d,c,l)&&((d.f&(at|ye))!==0?(F(d,B),u.schedule(d)):v(u,Pe).add(d));if(v(u,J).length>0&&!v(u,Ge)){u.apply();for(var f of v(u,J))j(h=u,x,Un).call(h,f,[],[]);Z(u,J,[])}u.deactivate()}}}},St=function(){if(this.linked){var t=v(this,Oe),n=v(this,Ye);t===null?xn=n:Z(t,Ye,n),n===null?rt=t:Z(n,Oe,t),this.linked=!1}};let xt=gn;function zs(){try{Ds()}catch(e){ln(e,jn)}}let he=null;function Sr(e){var t=e.length;if(t!==0){for(var n=0;n<t;){var r=e[n++];if((r.f&(ue|X))===0&&Ht(r)&&(he=new Set,vt(r),r.deps===null&&r.first===null&&r.nodes===null&&r.teardown===null&&r.ac===null&&po(r),(he==null?void 0:he.size)>0)){qe.clear();for(const o of he){if((o.f&(ue|X))!==0)continue;const i=[o];let s=o.parent;for(;s!==null;)he.has(s)&&(he.delete(s),i.push(s)),s=s.parent;for(let l=i.length-1;l>=0;l--){const a=i[l];(a.f&(ue|X))===0&&vt(a)}}he.clear()}}he=null}}function to(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(const o of e.reactions){const i=o.f;(i&Y)!==0?to(o,t,n,r):(i&(at|ye))!==0&&(i&B)===0&&Qn(o,t,r)&&(F(o,B),$n(o))}}function Qn(e,t,n){const r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(const o of e.deps){if(nn.call(t,o))return!0;if((o.f&Y)!==0&&Qn(o,t,n))return n.set(o,!0),!0}return n.set(e,!1),!1}function $n(e){T.schedule(e)}function no(e,t){if(!((e.f&fe)!==0&&(e.f&H)!==0)){(e.f&B)!==0?t.d.push(e):(e.f&we)!==0&&t.m.push(e),F(e,H);for(var n=e.first;n!==null;)no(n,t),n=n.next}}function ro(e){F(e,H);for(var t=e.first;t!==null;)ro(t),t=t.next}let un=new Set;const qe=new Map;let oo=!1;function Rt(e,t){var n={f:0,v:e,reactions:null,equals:Gr,rv:0,wv:0};return n}function ne(e,t){const n=Rt(e);return mo(n),n}function qs(e,t=!1,n=!0){const r=Rt(e);return t||(r.equals=zr),r}function N(e,t,n=!1){E!==null&&(!We||(E.f&rn)!==0)&&qr()&&(E.f&(Y|ye|at|rn))!==0&&(Ee===null||!Ee.has(e))&&xs();let r=n?lt(t):t;return Lt(e,r,Jt)}function Lt(e,t,n=null){if(!e.equals(t)){qe.set(e,Ue?t:e.v);var r=xt.ensure();if(r.capture(e,t),(e.f&Y)!==0){const o=e;(e.f&B)!==0&&Jn(o),z===null&&Xn(o)}e.wv=_o(),io(e,B,n),k!==null&&(k.f&H)!==0&&(k.f&(fe|je))===0&&(oe===null?il([e]):oe.push(e)),!r.is_fork&&un.size>0&&!oo&&Xs()}return t}function Xs(){oo=!1;for(const e of un){(e.f&H)!==0&&F(e,we);let t;try{t=Ht(e)}catch{t=!0}t&&vt(e)}un.clear()}function Ln(e){N(e,e.v+1)}function io(e,t,n){var r=e.reactions;if(r!==null)for(var o=r.length,i=0;i<o;i++){var s=r[i],l=s.f,a=(l&B)===0;if(a&&F(s,t),(l&rn)!==0)un.add(s);else if((l&Y)!==0){var c=s;z==null||z.delete(c),(l&Ze)===0&&(l&ae&&(k===null||(k.f&on)===0)&&(s.f|=Ze),io(c,we,n))}else if(a){var f=s;(l&ye)!==0&&he!==null&&he.add(f),n!==null?n.push(f):$n(f)}}}function lt(e){if(typeof e!="object"||e===null||Zt in e)return e;const t=Kr(e);if(t!==hs&&t!==gs)return e;var n=new Map,r=Ur(e),o=ne(0),i=Xe,s=l=>{if(Xe===i)return l();var a=E,c=Xe;Ke(null),Ir(i);var f=l();return Ke(a),Ir(c),f};return r&&n.set("length",ne(e.length)),new Proxy(e,{defineProperty(l,a,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&Ps();var f=n.get(a);return f===void 0?s(()=>{var h=ne(c.value);return n.set(a,h),h}):N(f,c.value,!0),!0},deleteProperty(l,a){var c=n.get(a);if(c===void 0){if(a in l){const f=s(()=>ne(K));n.set(a,f),Ln(o)}}else N(c,K),Ln(o);return!0},get(l,a,c){var d;if(a===Zt)return e;var f=n.get(a),h=a in l;if(f===void 0&&(!h||(d=Tt(l,a))!=null&&d.writable)&&(f=s(()=>{var m=lt(h?l[a]:K),y=ne(m);return y}),n.set(a,f)),f!==void 0){var u=p(f);return u===K?void 0:u}return Reflect.get(l,a,c)},getOwnPropertyDescriptor(l,a){var c=Reflect.getOwnPropertyDescriptor(l,a);if(c&&"value"in c){var f=n.get(a);f&&(c.value=p(f))}else if(c===void 0){var h=n.get(a),u=h==null?void 0:h.v;if(h!==void 0&&u!==K)return{enumerable:!0,configurable:!0,value:u,writable:!0}}return c},has(l,a){var u;if(a===Zt)return!0;var c=n.get(a),f=c!==void 0&&c.v!==K||Reflect.has(l,a);if(c!==void 0||k!==null&&(!f||(u=Tt(l,a))!=null&&u.writable)){c===void 0&&(c=s(()=>{var d=f?lt(l[a]):K,m=ne(d);return m}),n.set(a,c));var h=p(c);if(h===K)return!1}return f},set(l,a,c,f){var I;var h=n.get(a),u=a in l;if(r&&a==="length")for(var d=c;d<h.v;d+=1){var m=n.get(d+"");m!==void 0?N(m,K):d in l&&(m=s(()=>ne(K)),n.set(d+"",m))}if(h===void 0)(!u||(I=Tt(l,a))!=null&&I.writable)&&(h=s(()=>ne(void 0)),N(h,lt(c)),n.set(a,h));else{u=h.v!==K;var y=s(()=>lt(c));N(h,y)}var g=Reflect.getOwnPropertyDescriptor(l,a);if(g!=null&&g.set&&g.set.call(f,c),!u){if(r&&typeof a=="string"){var _=n.get("length"),R=Number(a);Number.isInteger(R)&&R>=_.v&&N(_,R+1)}Ln(o)}return!0},ownKeys(l){p(o);var a=Reflect.ownKeys(l).filter(h=>{var u=n.get(h);return u===void 0||u.v!==K});for(var[c,f]of n)f.v!==K&&!(c in l)&&a.push(c);return a},setPrototypeOf(){ks()}})}var Zs,Js,Qs;function Ve(e=""){return document.createTextNode(e)}function cn(e){return Js.call(e)}function Ut(e){return Qs.call(e)}function me(e,t){return cn(e)}function re(e,t=!1){{var n=cn(e);return n instanceof Comment&&n.data===""?Ut(n):n}}function fn(e,t=1,n=!1){let r=e;for(;t--;)r=Ut(r);return r}function $s(e){e.textContent=""}function so(){return!1}function lo(e,t,n){return t==null||t===jr?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function el(e){k===null&&(E===null&&Ts(),Is()),Ue&&Es()}function tl(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function yt(e,t){var n=k;n!==null&&(n.f&X)!==0&&(e|=X);var r={ctx:ce,deps:null,nodes:null,f:e|B|ae,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};T==null||T.register_created_effect(r);var o=r;if((e&kt)!==0)st!==null?st.push(r):xt.ensure().schedule(r);else if(t!==null){try{vt(r)}catch(s){throw ke(r),s}o.deps===null&&o.teardown===null&&o.nodes===null&&o.first===o.last&&(o.f&mn)===0&&(o=o.first,(e&ye)!==0&&(e&Be)!==0&&o!==null&&(o.f|=Be))}if(o!==null&&(o.parent=n,n!==null&&tl(o,n),E!==null&&(E.f&Y)!==0&&(e&je)===0)){var i=E;(i.effects??(i.effects=[])).push(o)}return r}function ao(){return E!==null&&!We}function uo(e){const t=yt(qn,null);return F(t,H),t.teardown=e,t}function er(e){el();var t=k.f,n=!E&&(t&fe)!==0&&ce!==null&&!ce.i;if(n){var r=ce;(r.e??(r.e=[])).push(e)}else return co(e)}function co(e){return yt(kt|ws,e)}function nl(e){return yt(at|mn,e)}function _e(e,t=[],n=[],r=[]){Vs(r,t,n,o=>{yt(qn,()=>{e(...o.map(p))})})}function Kt(e,t=0){var n=yt(ye|t,e);return n}function Mt(e){return yt(fe|mn,e)}function fo(e){var t=e.teardown;if(t!==null){const n=Ue,r=E;Er(!0),Ke(null);try{t.call(null)}finally{Er(n),Ke(r)}}}function tr(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){const o=n.ac;o!==null&&yn(()=>{o.abort(Bt)});var r=n.next;(n.f&je)!==0?n.parent=null:ke(n,t),n=r}}function rl(e){for(var t=e.first;t!==null;){var n=t.next;(t.f&fe)===0&&ke(t),t=n}}function ke(e,t=!0){var n=!1;(t||(e.f&_s)!==0)&&e.nodes!==null&&e.nodes.end!==null&&(ol(e.nodes.start,e.nodes.end),n=!0),e.f|=wr,tr(e,t&&!n),Nt(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(const i of r)i.stop();fo(e),e.f^=wr,e.f|=ue;var o=e.parent;o!==null&&o.first!==null&&po(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function ol(e,t){for(;e!==null;){var n=e===t?null:Ut(e);e.remove(),e=n}}function po(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function nr(e,t,n=!0){var r=[];ho(e,r,!0);var o=()=>{n&&ke(e),t&&t()},i=r.length;if(i>0){var s=()=>--i||o();for(var l of r)l.out(s)}else o()}function ho(e,t,n){if((e.f&X)===0){e.f^=X;var r=e.nodes&&e.nodes.t;if(r!==null)for(const l of r)(l.is_global||n)&&t.push(l);for(var o=e.first;o!==null;){var i=o.next;if((o.f&je)===0){var s=(o.f&Be)!==0||(o.f&fe)!==0&&(e.f&ye)!==0;ho(o,t,s?n:!1)}o=i}}}function dn(e){go(e,!0)}function go(e,t){if((e.f&X)!==0){e.f^=X,(e.f&H)===0&&(F(e,B),xt.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,o=(n.f&Be)!==0||(n.f&fe)!==0;go(n,o?t:!1),n=r}var i=e.nodes&&e.nodes.t;if(i!==null)for(const s of i)(s.is_global||t)&&s.in()}}function vo(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var o=n===r?null:Ut(n);t.append(n),n=o}}let Qt=!1,Ue=!1;function Er(e){Ue=e}let E=null,We=!1;function Ke(e){E=e}let k=null;function gt(e){k=e}let Ee=null;function mo(e){E!==null&&(Ee??(Ee=new Set)).add(e)}let Q=null,$=0,oe=null;function il(e){oe=e}let yo=1,He=0,Xe=He;function Ir(e){Xe=e}function _o(){return++yo}function Ht(e){var t=e.f;if((t&B)!==0)return!0;if(t&Y&&(e.f&=~Ze),(t&we)!==0){for(var n=e.deps,r=n.length,o=0;o<r;o++){var i=n[o];if(Ht(i)&&Jr(i),i.wv>e.wv)return!0}(t&ae)!==0&&z===null&&F(e,H)}return!1}function wo(e,t,n=!0){var r=e.reactions;if(r!==null&&!(Ee!==null&&Ee.has(e)))for(var o=0;o<r.length;o++){var i=r[o];(i.f&Y)!==0?wo(i,t,!1):t===i&&(n?F(i,B):(i.f&H)!==0&&F(i,we),$n(i))}}function bo(e){var y;var t=Q,n=$,r=oe,o=E,i=Ee,s=ce,l=We,a=Xe,c=e.f;Q=null,$=0,oe=null,E=(c&(fe|je))===0?e:null,Ee=null,sn(e.ctx),We=!1,Xe=++He,e.ac!==null&&(yn(()=>{e.ac.abort(Bt)}),e.ac=null);try{e.f|=on;var f=e.fn,h=f();e.f|=mt;var u=e.deps,d=T==null?void 0:T.is_fork;if(Q!==null){var m;if(d||Nt(e,$),u!==null&&$>0)for(u.length=$+Q.length,m=0;m<Q.length;m++)u[$+m]=Q[m];else e.deps=u=Q;if(ao()&&(e.f&ae)!==0)for(m=$;m<u.length;m++)((y=u[m]).reactions??(y.reactions=[])).push(e)}else!d&&u!==null&&$<u.length&&(Nt(e,$),u.length=$);if(qr()&&oe!==null&&!We&&u!==null&&(e.f&(Y|we|B))===0)for(m=0;m<oe.length;m++)wo(oe[m],e);if(o!==null&&o!==e){if(He++,o.deps!==null)for(let g=0;g<n;g+=1)o.deps[g].rv=He;if(t!==null)for(const g of t)g.rv=He;oe!==null&&(r===null?r=oe:r.push(...oe))}return(e.f&Fe)!==0&&(e.f^=Fe),h}catch(g){return Os(g)}finally{e.f^=on,Q=t,$=n,oe=r,E=o,Ee=i,sn(s),We=l,Xe=a}}function sl(e,t){let n=t.reactions;if(n!==null){var r=ds.call(n,e);if(r!==-1){var o=n.length-1;o===0?n=t.reactions=null:(n[r]=n[o],n.pop())}}if(n===null&&(t.f&Y)!==0&&(Q===null||!nn.call(Q,t))){var i=t;(i.f&ae)!==0&&(i.f^=ae,i.f&=~Ze),i.v!==K&&Xn(i),i.ac!==null&&yn(()=>{i.ac.abort(Bt),i.ac=null,F(i,B)}),Hs(i),Nt(i,0)}}function Nt(e,t){var n=e.deps;if(n!==null)for(var r=t;r<n.length;r++)sl(e,n[r])}function vt(e){var t=e.f;if((t&ue)===0){F(e,H);var n=k,r=Qt;k=e,Qt=(t&(fe|je))===0;try{(t&(ye|Yr))!==0?rl(e):tr(e),fo(e);var o=bo(e);e.teardown=typeof o=="function"?o:null,e.wv=yo;var i;Br&&Ms&&(e.f&B)!==0&&e.deps}finally{Qt=r,k=n}}}function p(e){var t=e.f,n=(t&Y)!==0;if(E!==null&&!We){var r=k!==null&&(k.f&ue)!==0;if(!r&&(Ee===null||!Ee.has(e))){var o=E.deps;if((E.f&on)!==0)e.rv<He&&(e.rv=He,Q===null&&o!==null&&o[$]===e?$++:Q===null?Q=[e]:Q.push(e));else{E.deps??(E.deps=[]),nn.call(E.deps,e)||E.deps.push(e);var i=e.reactions;i===null?e.reactions=[E]:nn.call(i,E)||i.push(E)}}}if(Ue&&qe.has(e))return qe.get(e);if(n){var s=e;if(Ue){var l=s.v;return((s.f&H)===0&&s.reactions!==null||Ao(s))&&(l=Jn(s)),qe.set(s,l),l}var a=(s.f&ae)===0&&!We&&E!==null&&(Qt||(E.f&ae)!==0),c=(s.f&mt)===0;Ht(s)&&(a&&(s.f|=ae),Jr(s)),a&&!c&&(Qr(s),Co(s))}if(z!=null&&z.has(e))return z.get(e);if((e.f&Fe)!==0)throw e.v;return e.v}function Co(e){if(e.f|=ae,e.deps!==null)for(const t of e.deps)(t.reactions??(t.reactions=[])).push(e),(t.f&Y)!==0&&(t.f&ae)===0&&(Qr(t),Co(t))}function Ao(e){if(e.v===K)return!0;if(e.deps===null)return!1;for(const t of e.deps)if(qe.has(t)||(t.f&Y)!==0&&Ao(t))return!0;return!1}var Fr;const Mn=((Fr=globalThis==null?void 0:globalThis.window)==null?void 0:Fr.trustedTypes)&&globalThis.window.trustedTypes.createPolicy("svelte-trusted-html",{createHTML:e=>e});function ll(e){return(Mn==null?void 0:Mn.createHTML(e))??e}function al(e){var t=lo("template");return t.innerHTML=ll(e.replaceAll("<!>","<!---->")),t.content}function Ot(e,t){var n=k;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function Me(e,t){var n=(t&us)!==0,r=(t&cs)!==0,o,i=!e.startsWith("<!>");return()=>{o===void 0&&(o=al(i?e:"<!>"+e),n||(o=cn(o)));var s=r||Zs?document.importNode(o,!0):o.cloneNode(!0);if(n){var l=cn(s),a=s.lastChild;Ot(l,a)}else Ot(s,s);return s}}function So(e=""){{var t=Ve(e+"");return Ot(t,t),t}}function se(){var e=document.createDocumentFragment(),t=document.createComment(""),n=Ve();return e.append(t,n),Ot(t,n),e}function W(e,t){e!==null&&e.before(t)}function rr(e,t){var n=t==null?"":typeof t=="object"?`${t}`:t;n!==(e[qt]??(e[qt]=e.nodeValue))&&(e[qt]=n,e.nodeValue=`${n}`)}var ve,Ae,ee,ze,Vt,jt,vn;class _n{constructor(t,n=!0){pe(this,"anchor");O(this,ve,new Map);O(this,Ae,new Map);O(this,ee,new Map);O(this,ze,new Set);O(this,Vt,!0);O(this,jt,t=>{if(v(this,ve).has(t)){var n=v(this,ve).get(t),r=v(this,Ae).get(n);if(r)dn(r),v(this,ze).delete(n);else{var o=v(this,ee).get(n);o&&(dn(o.effect),v(this,Ae).set(n,o.effect),v(this,ee).delete(n),o.fragment.lastChild.remove(),this.anchor.before(o.fragment),r=o.effect)}for(const[i,s]of v(this,ve)){if(v(this,ve).delete(i),i===t)break;const l=v(this,ee).get(s);l&&(ke(l.effect),v(this,ee).delete(s))}for(const[i,s]of v(this,Ae)){if(i===n||v(this,ze).has(i))continue;const l=()=>{if(Array.from(v(this,ve).values()).includes(i)){var c=document.createDocumentFragment();vo(s,c),c.append(Ve()),v(this,ee).set(i,{effect:s,fragment:c})}else ke(s);v(this,ze).delete(i),v(this,Ae).delete(i)};v(this,Vt)||!r?(v(this,ze).add(i),nr(s,l,!1)):l()}}});O(this,vn,t=>{v(this,ve).delete(t);const n=Array.from(v(this,ve).values());for(const[r,o]of v(this,ee))n.includes(r)||(ke(o.effect),v(this,ee).delete(r))});this.anchor=t,Z(this,Vt,n)}ensure(t,n){var r=T,o=so();if(n&&!v(this,Ae).has(t)&&!v(this,ee).has(t))if(o){var i=document.createDocumentFragment(),s=Ve();i.append(s),v(this,ee).set(t,{effect:Mt(()=>n(s)),fragment:i})}else v(this,Ae).set(t,Mt(()=>n(this.anchor)));if(v(this,ve).set(r,t),o){for(const[l,a]of v(this,Ae))l===t?r.unskip_effect(a):r.skip_effect(a);for(const[l,a]of v(this,ee))l===t?r.unskip_effect(a.effect):r.skip_effect(a.effect);r.oncommit(v(this,jt)),r.ondiscard(v(this,vn))}else v(this,jt).call(this,r)}}ve=new WeakMap,Ae=new WeakMap,ee=new WeakMap,ze=new WeakMap,Vt=new WeakMap,jt=new WeakMap,vn=new WeakMap;function or(e,t,...n){var r=new _n(e);Kt(()=>{const o=t()??null;r.ensure(o,o&&(i=>o(i,...n)))},Be)}function xe(e,t,n=!1){var r=new _n(e),o=n?Be:0;function i(s,l){r.ensure(s,l)}Kt(()=>{var s=!1;t((l,a=0)=>{s=!0,i(a,l)}),s||i(-1,null)},o)}function ul(e,t,n){for(var r=[],o=t.length,i,s=t.length,l=0;l<o;l++){let h=t[l];nr(h,()=>{if(i){if(i.pending.delete(h),i.done.add(h),i.pending.size===0){var u=e.outrogroups;Kn(e,zn(i.done)),u.delete(i),u.size===0&&(e.outrogroups=null)}}else s-=1},!1)}if(s===0){var a=r.length===0&&n!==null&&e.pending.size===0;if(a){var c=n,f=c.parentNode;$s(f),f.append(c),e.items.clear()}Kn(e,t,!a)}else i={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(i)}function Kn(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(const s of e.pending.values())for(const l of s)r.add(e.items.get(l).e)}for(var o=0;o<t.length;o++){var i=t[o];if(r!=null&&r.has(i)){i.f|=Se;const s=document.createDocumentFragment();vo(i,s)}else ke(t[o],n)}}var Tr;function Hn(e,t,n,r,o,i=null){var s=e,l=new Map,a=(t&Vr)!==0;if(a){var c=e;s=c.appendChild(Ve())}var f=null,h=Us(()=>{var I=n();return Ur(I)?I:I==null?[]:zn(I)}),u,d=new Map,m=!0;function y(I){(R.effect.f&ue)===0&&(R.pending.delete(I),R.fallback=f,cl(R,u,s,t,r),f!==null&&(u.length===0?(f.f&Se)===0?dn(f):(f.f^=Se,Et(f,null,s)):nr(f,()=>{f=null})))}function g(I){R.pending.delete(I)}var _=Kt(()=>{u=p(h);for(var I=u.length,V=new Set,P=T,D=so(),S=0;S<I;S+=1){var w=u[S],C=r(w,S),b=m?null:l.get(C);b?(b.v&&Lt(b.v,w),b.i&&Lt(b.i,S),D&&P.unskip_effect(b.e)):(b=fl(l,m?s:Tr??(Tr=Ve()),w,C,S,o,t,n),m||(b.e.f|=Se),l.set(C,b)),V.add(C)}if(I===0&&i&&!f&&(m?f=Mt(()=>i(s)):(f=Mt(()=>i(Tr??(Tr=Ve()))),f.f|=Se)),I>V.size&&Ss(),!m)if(d.set(P,V),D){for(const[L,G]of l)V.has(L)||P.skip_effect(G.e);P.oncommit(y),P.ondiscard(g)}else y(P);p(h)}),R={effect:_,items:l,pending:d,outrogroups:null,fallback:f};m=!1}function bt(e){for(;e!==null&&(e.f&fe)===0;)e=e.next;return e}function cl(e,t,n,r,o){var b,L,G,M,q,tt,Gt,Te,nt;var i=(r&ls)!==0,s=t.length,l=e.items,a=bt(e.effect.first),c,f=null,h,u=[],d=[],m,y,g,_;if(i)for(_=0;_<s;_+=1)m=t[_],y=o(m,_),g=l.get(y).e,(g.f&Se)===0&&((L=(b=g.nodes)==null?void 0:b.a)==null||L.measure(),(h??(h=new Set)).add(g));for(_=0;_<s;_+=1){if(m=t[_],y=o(m,_),g=l.get(y).e,e.outrogroups!==null)for(const de of e.outrogroups)de.pending.delete(g),de.done.delete(g);if((g.f&X)!==0&&(dn(g),i&&((M=(G=g.nodes)==null?void 0:G.a)==null||M.unfix(),(h??(h=new Set)).delete(g))),(g.f&Se)!==0)if(g.f^=Se,g===a)Et(g,null,n);else{var R=f?f.next:a;g===e.effect.last&&(e.effect.last=g.prev),g.prev&&(g.prev.next=g.next),g.next&&(g.next.prev=g.prev),Ne(e,f,g),Ne(e,g,R),Et(g,R,n),f=g,u=[],d=[],a=bt(f.next);continue}if(g!==a){if(c!==void 0&&c.has(g)){if(u.length<d.length){var I=d[0],V;f=I.prev;var P=u[0],D=u[u.length-1];for(V=0;V<u.length;V+=1)Et(u[V],I,n);for(V=0;V<d.length;V+=1)c.delete(d[V]);Ne(e,P.prev,D.next),Ne(e,f,P),Ne(e,D,I),a=I,f=D,_-=1,u=[],d=[]}else c.delete(g),Et(g,a,n),Ne(e,g.prev,g.next),Ne(e,g,f===null?e.effect.first:f.next),Ne(e,f,g),f=g;continue}for(u=[],d=[];a!==null&&a!==g;)(c??(c=new Set)).add(a),d.push(a),a=bt(a.next);if(a===null)continue}(g.f&Se)===0&&u.push(g),f=g,a=bt(g.next)}if(e.outrogroups!==null){for(const de of e.outrogroups)de.pending.size===0&&(Kn(e,zn(de.done)),(q=e.outrogroups)==null||q.delete(de));e.outrogroups.size===0&&(e.outrogroups=null)}if(a!==null||c!==void 0){var S=[];if(c!==void 0)for(g of c)(g.f&X)===0&&S.push(g);for(;a!==null;)(a.f&X)===0&&a!==e.fallback&&S.push(a),a=bt(a.next);var w=S.length;if(w>0){var C=(r&Vr)!==0&&s===0?n:null;if(i){for(_=0;_<w;_+=1)(Gt=(tt=S[_].nodes)==null?void 0:tt.a)==null||Gt.measure();for(_=0;_<w;_+=1)(nt=(Te=S[_].nodes)==null?void 0:Te.a)==null||nt.fix()}ul(e,S,C)}}i&&Vn(()=>{var de,zt;if(h!==void 0)for(g of h)(zt=(de=g.nodes)==null?void 0:de.a)==null||zt.apply()})}function fl(e,t,n,r,o,i,s,l){var a=(s&is)!==0?(s&as)===0?qs(n,!1,!1):Rt(n):null,c=(s&ss)!==0?Rt(o):null;return{v:a,i:c,e:Mt(()=>(i(t,a??n,c??o,l),()=>{e.delete(r)}))}}function Et(e,t,n){if(e.nodes)for(var r=e.nodes.start,o=e.nodes.end,i=t&&(t.f&Se)===0?t.nodes.start:n;r!==null;){var s=Ut(r);if(i.before(r),r===o)return;r=s}}function Ne(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function Nn(e,t,n){var r=new _n(e);Kt(()=>{var o=t()??null;r.ensure(o,o&&(i=>n(i,o)))},Be)}function Eo(e,t,n,r,o,i){var s=null,l=e,a=new _n(l,!1);Kt(()=>{const c=t()||null;var f=c==="svg"?fs:void 0;if(c===null){a.ensure(null,null);return}return a.ensure(c,h=>{if(c){if(s=lo(c,f),Ot(s,s),r){var u=null,d=s.appendChild(Ve());r(s,d),u==null||u.remove()}k.nodes.end=s,h.before(s)}}),()=>{}},Be),uo(()=>{})}function Io(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Io(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function dl(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Io(e))&&(r&&(r+=" "),r+=t);return r}function pn(e){return typeof e=="object"?dl(e):e??""}function pl(e,t,n){var r=e==null?"":""+e;return r===""?null:r}function hl(e,t){return e==null?null:String(e)}function Wt(e,t,n,r,o,i){var s=e[br];if(s!==n||s===void 0){var l=pl(n);l==null?e.removeAttribute("class"):e.className=l,e[br]=n}return i}function ie(e,t,n,r){var o=e[Cr];if(o!==t){var i=hl(t);i==null?e.removeAttribute("style"):e.style.cssText=i,e[Cr]=t}return r}const gl=Symbol("is custom element"),vl=Symbol("is html");function ir(e,t,n,r){var o=ml(e);o[t]!==(o[t]=n)&&(t==="loading"&&(e[Cs]=n),n==null?e.removeAttribute(t):typeof n!="string"&&yl(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function ml(e){return e[kn]??(e[kn]={[gl]:e.nodeName.includes("-"),[vl]:e.namespaceURI===jr})}var Dr=new Map;function yl(e){var t=e.getAttribute("is")||e.nodeName,n=Dr.get(t);if(n)return n;Dr.set(t,n=[]);for(var r,o=e,i=Element.prototype;i!==o;){r=ps(o);for(var s in r)r[s].set&&s!=="innerHTML"&&s!=="textContent"&&s!=="innerText"&&n.push(s);o=Kr(o)}return n}const _l={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(wt(r)&&(r=r()),typeof r=="object"&&r!==null&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let o=e.props[r];wt(o)&&(o=o());const i=Tt(o,t);if(i&&i.set)return i.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(wt(r)&&(r=r()),typeof r=="object"&&r!==null&&t in r){const o=Tt(r,t);return o&&!o.configurable&&(o.configurable=!0),o}}},has(e,t){if(t===Zt||t===bs)return!1;for(let n of e.props)if(wt(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){const t=[];for(let n of e.props)if(wt(n)&&(n=n()),!!n){for(const r in n)t.includes(r)||t.push(r);for(const r of Object.getOwnPropertySymbols(n))t.includes(r)||t.push(r)}return t}};function On(...e){return new Proxy({props:e},_l)}function le(e,t,n,r){var o=r,i=!0,s=()=>(i&&(i=!1,o=r),o),l;l=e[t],l===void 0&&r!==void 0&&(l=s());var a;return a=()=>{var c=e[t];return c===void 0?s():(i=!0,c)},a}const _t="default";function sr(e,t){return!(e!=null&&e.length)||e===_t?t:`${e}/${t}`}const wl=`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 Pr(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 bl(e){if(Pr(e))return e;const t=e;return Pr(t==null?void 0:t.default)?t.default:null}function Wn(e){return e.usesDefaultLibrary?[_t,...e.libraryIds]:[...e.libraryIds]}function kr({registrations:e,referenced:t}){if(t.usesDefaultLibrary&&!(e!=null&&e[_t]))throw new Error(wl)}function To(e){const t={};for(const[n,r]of e){const o=n===_t;for(const[i,s]of Object.entries(r.components))t[o?i:`${n}/${i}`]=s}return{components:t}}function Yt(){const e=new Map,t=new Map,n=new Map,r=new Map;let o=0;function i(c,f){var h;e.get(c)!==f&&((h=f.manifest)!=null&&h.id&&f.manifest.id!==c&&console.warn(`RuleCMS widget: component library registered as "${c}" declares manifest id "${f.manifest.id}". The registered id wins for resolution.`),e.set(c,f),o+=1)}function s(c){const f=Wn(c),h=[...f].sort().join("|"),u=r.get(h);if(u&&u.loadedVersion===o)return u.plugin;const d=new Map;for(const y of f){const g=e.get(y);g&&d.set(y,g)}const m=To(d);return r.set(h,{loadedVersion:o,plugin:m}),m}function l(c){kr(c);const{registrations:f,referenced:h}=c;for(const u of Wn(h)){if(e.has(u)||n.has(u))continue;const d=f==null?void 0:f[u];if(!d){console.error(`RuleCMS widget: no component library registered for libraryId "${u}"; its components will not render.`),n.set(u,new Error(`No registration for libraryId "${u}"`));continue}if(typeof d=="function")return null;i(u,d)}return s(h)}async function a(c){kr(c);const{registrations:f,referenced:h}=c,u=Wn(h);return await Promise.all(u.map(async d=>{if(e.has(d)||n.has(d))return;const m=f==null?void 0:f[d];if(!m){console.error(`RuleCMS widget: no component library registered for libraryId "${d}"; its components will not render.`),n.set(d,new Error(`No registration for libraryId "${d}"`));return}if(typeof m!="function"){i(d,m);return}let y=t.get(d);y||(y=m().then(g=>{const _=bl(g);if(!_)throw new Error(`Registration for libraryId "${d}" did not resolve to a ComponentLibraryModule (expected { manifest, components }).`);i(d,_)}).catch(g=>{n.set(d,g),console.error(`RuleCMS widget: failed to load component library "${d}":`,g)}).finally(()=>{t.delete(d)}),t.set(d,y)),await y})),s(h)}return{resolveSync:l,resolve:a}}const Cl={Preview:"Preview",Compose:"Compose",RenderedPage:"RenderedPage"},wn={DroppableBox:"droppable-box"},Yn={FlexStart:"flex-start",FlexEnd:"flex-end",Center:"center",SpaceBetween:"space-between",SpaceAround:"space-around",SpaceEvenly:"space-evenly"},Al={FlexStart:"flex-start",FlexEnd:"flex-end",Center:"center",SpaceBetween:"space-between",SpaceAround:"space-around",SpaceEvenly:"space-evenly",Stretch:"stretch"},$t="cssAttrArray",Sl={Phone:"phone",Tablet:"tablet",Desktop:"desktop"},lr={ComposerComponent:"ComposerWidget",Collection:"Collection",MoveComponentHandle:"MoveWidgetHandle"},ar=`${lr.Collection}_`,Do="dev.",Po="https://rulecms.com",ko="https://widget-cache.rulecms.com",xo="/api/v1/c/widget/get",Ro="/api/v1/c/dev/widget/get";function Je(e){return typeof e=="string"&&e.startsWith(Do)}function Lo(e,t){return t?t.replace(/\/$/,""):Je(e)?Po:ko}function ur({publishedKey:e,token:t,endpoint:n}){const r=Je(t),o=r?Ro:xo,i=r?new URLSearchParams({widgetKey:e,token:t}):new URLSearchParams({publishedKey:e,token:t});return`${Lo(t,n)}${o}?${i.toString()}`}const El=({id:e,prefix:t})=>`${t}_${e}`,Mo=e=>{if(!(e!=null&&e.length)||!e.includes("_")){console.error(`Invalid drag item id: ${e}. Type does not exist.`);return}return No(e)},cr=e=>e.includes("_"),No=e=>{const t=e.indexOf("_"),n=e.substring(0,t),r=e.substring(t+1);return{prefix:n,id:r}},fr=e=>{if(!cr(e))return;const n=Mo(e);return(n==null?void 0:n.prefix)===lr.Collection||console.error("getCollectionIdForCollectionType - Invalid component type: ${componentType}. Invalid prefix type."),n==null?void 0:n.id},Il=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 n=t[0];if(!t[1].includes("@"))return{name:n,instanceId:t[1]};const o=t[1].split("@");return{name:n,instanceId:o[0],parentId:o[1]}},Tl=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]}},Oo=e=>{var o,i,s,l;if(!e)return{error:"getWidgetKeyForCollection: Missing collection"};if(!((o=e.name)!=null&&o.length))return{error:"getWidgetKeyForCollection: Missing collection name"};const t=(i=e.name)==null?void 0:i.trim().toLowerCase();if(!((s=e.id)!=null&&s.length))return{error:"getWidgetKeyForCollection: Missing collection id"};const r=((l=e.parentId)==null?void 0:l.length)?`${e.id}@${e.parentId}`:`${e.id}`;return{data:`${t}$${r}`}},Wo=e=>{var o,i,s,l;if(!e)return{error:"getWidgetKeyForPublishedCollection: Missing collection"};if(!((o=e.name)!=null&&o.length))return{error:"getWidgetKeyForPublishedCollection: Missing collection name"};const t=(i=e.name)==null?void 0:i.trim().toLowerCase();if(!((s=e.publishedKey)!=null&&s.length))return{error:"getWidgetKeyForPublishedCollection: Missing collection publishedKey"};const r=((l=e.parentId)==null?void 0:l.length)?`${e.publishedKey}@${e.parentId}`:`${e.publishedKey}`;return{data:`${t}$${r}`}},Dl=e=>{const t=Oo(e);return`${ar}${t.data}`},Pl=e=>{const t=Wo(e);return`${ar}${t.data}`},Fo="---",Vo="___";function jo(e,t){return`${e}${Fo}${t}`}function kl(e,t,n){return`${jo(e,t)}${Vo}${n}`}function xl(e){const t=e.split(".");if(t.length!==3)throw new Error(`Invalid version format: ${e}. Expected format: x.y.z`);const n=t[0],r=t[1],o=parseInt(t[2],10);if(isNaN(o))throw new Error(`Invalid patch version: ${t[2]}. Expected a number.`);return`${n}.${r}.${o+1}`}function bn({displayItemList:e,widgetCollections:t}){const n=new Set;let r=!1;const o=i=>{var s,l,a;if((s=i==null?void 0:i.rows)!=null&&s.length){for(const c of i.rows)if((l=c==null?void 0:c.columns)!=null&&l.length)for(const f of c.columns)f.collection&&o(f.collection.collectionRows),!(!f.type||f.type===wn.DroppableBox)&&(cr(f.type)||(!((a=f.libraryId)!=null&&a.length)||f.libraryId===_t?r=!0:n.add(f.libraryId)))}};o(e);for(const i of Object.values(t??{}))o(i==null?void 0:i.collectionRows);return{libraryIds:Array.from(n),usesDefaultLibrary:r}}const dr=Symbol("rulecms-widget-context");function Rl(){return{token:"",endpoint:void 0,libraries:void 0,libraryRegistry:Yt()}}function Ll(e,t){Re(t,!0);const n=lt(Rl());er(()=>{n.token=t.token,n.endpoint=t.endpoint,n.libraries=t.libraries}),Fn.setContext(dr,n);var r=se(),o=re(r);or(o,()=>t.children),W(e,r),Le()}const Bo="1200px",pr="500px",hr="820px",Ml=Bo,Uo="rulecms",Nl=1920,Ol={f:"auto",q:"auto",c:"limit"},Wl=/^[A-Za-z0-9][A-Za-z0-9._\-/]*$/,Fl=300,Vl=/^[A-Za-z0-9][A-Za-z0-9_-]*$/,jl=100,Bl=/^https:\/\/[^\s"'()\\<>]+$/,Ul=2e3,Kl=/^[A-Za-z0-9_,.:\-/]*$/,Hl=300,Ko=e=>typeof e=="string"&&e.length<=Fl&&Wl.test(e),Ho=e=>typeof e=="string"&&e.length<=jl&&Vl.test(e),Yo=e=>typeof e=="string"&&e.length<=Ul&&Bl.test(e),Go=e=>typeof e=="string"&&e.length<=Hl&&Kl.test(e),Yl=e=>Object.entries(e).map(([t,n])=>`${t}_${n}`).join(","),Gl=e=>{const t={};for(const n of e.split(",")){const r=n.trim(),o=r.indexOf("_");o<=0||(t[r.slice(0,o)]=r.slice(o+1))}return t},zo=({publicId:e,cloudName:t=Uo,transformations:n,width:r=Nl})=>{const o=typeof n=="string"?Gl(n):n,i={...Ol,...o,w:r};return encodeURI(`https://res.cloudinary.com/${t}/image/upload/${Yl(i)}/${e}`)},qo=/^--[A-Za-z0-9_-]+$/,Xo=200,gr=e=>{if(typeof e!="string")return!1;const t=e.trim();return t.length<=Xo&&qo.test(t)},be=e=>`var(${e.trim()})`,U=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e.cssVariable;if(t!=null)return gr(t)?t.trim():void 0},Ie=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e.cssVariable;return t==null?!1:!gr(t)},zl=(e,t)=>{const n=U(e);return n?{[t]:be(n)}:void 0},Zo=e=>{if(typeof e!="object"||e===null||Array.isArray(e)||Ie(e))return!1;if(U(e))return!0;const t=e;return t.source==="none"?!0:t.source==="url"?Yo(t.url):t.source==="cloudinary"?!Ko(t.publicId)||t.cloudName!==void 0&&t.cloudName!==null&&!Ho(t.cloudName)?!1:t.transformations===void 0||t.transformations===null||Go(t.transformations):!1},Jo=["px","%","em","rem","vh","vw"],Cn=["inherit","unset"],Qo=["allSides","top","right","bottom","left"],Qe=(e,t={})=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const n=e;return Ie(e)?!1:U(e)?!0:n.unit==="auto"?t.allowAuto!==!1:n.unit==="keyword"?t.allowKeywords!==!1&&Cn.includes(n.keyword):Jo.includes(n.unit)?typeof n.value!="number"||!Number.isFinite(n.value)?!1:t.allowNegative!==!1||n.value>=0:!1},$o=(e,t={})=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const n=e;for(const r of Qo){const o=n[r];if(o!=null&&!Qe(o,t))return!1}return!0},ql=[...Cn,"transparent","currentColor"],Xl=/^(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/,An=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return Ie(e)?!1:U(e)?!0:t.unit==="keyword"?ql.includes(t.keyword):t.unit==="color"?typeof t.value=="string"&&Xl.test(t.value.trim()):!1},Sn=e=>{const t=U(e);return t?be(t):"unit"in e?e.unit==="keyword"?e.keyword:e.value.trim():""},ei=(e,t)=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!Ie(e)&&!!U(e):typeof e!="string"||!e.length?!1:t.includes(e)?!0:Cn.includes(e),ti=['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"],ni=["normal","bold","100","200","300","400","500","600","700","800","900"],ri=["normal","italic","oblique"],oi=["left","center","right","justify","start","end"],ii=["none","underline","line-through","overline"],si=["none","uppercase","lowercase","capitalize"],en=["visible","hidden","scroll","auto","clip"],li=["flex-start","flex-end","center","space-between","space-around","space-evenly"],ai=["flex-start","flex-end","center","baseline","stretch"],ui=["wrap","nowrap"],ci=["flex-start","flex-end","center","space-between","space-around","space-evenly","stretch"],fi=["row","row-reverse","column","column-reverse"],di=["cover","contain","auto"],pi=["center center","center top","center bottom","left center","left top","left bottom","right center","right top","right bottom"],hi=["no-repeat","repeat","repeat-x","repeat-y","space","round"],gi=["justifyContent","alignItems","flexWrap","alignContent","flexDirection"],vi=["none","solid","dashed","dotted","double","groove","ridge","inset","outset"],mi=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!Ie(e)&&!!U(e):vi.includes(e),yi=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return Ie(e)?!1:U(e)?!0:!(t.width!==void 0&&t.width!==null&&!Qe(t.width,{allowAuto:!1,allowNegative:!1})||t.style!==void 0&&t.style!==null&&!mi(t.style)||t.color!==void 0&&t.color!==null&&!An(t.color))},Zl={allowAuto:!1,allowKeywords:!1,allowNegative:!0},Jl={allowAuto:!1,allowKeywords:!1,allowNegative:!1},_i=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;if(Ie(e))return!1;if(U(e))return!0;for(const n of["offsetX","offsetY","spread"]){const r=t[n];if(r!=null&&!Qe(r,Zl))return!1}return!(t.blur!==void 0&&t.blur!==null&&!Qe(t.blur,Jl)||t.color!==void 0&&t.color!==null&&!An(t.color)||t.inset!==void 0&&t.inset!==null&&typeof t.inset!="boolean")},wi=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,bi=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return Ie(e)?!1:U(e)?!0:t.unit==="number"?typeof t.value=="number"&&Number.isFinite(t.value)&&t.value>0:Qe(e,{allowAuto:!1,allowNegative:!1})},Ci=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!Ie(e)&&!!U(e):typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1,Ai=e=>{if(!Zo(e))return{};const t=U(e);if(t)return{backgroundImage:be(t)};const n=e;return n.source==="none"?{backgroundImage:"none"}:n.source==="url"?{backgroundImage:`url("${n.url}")`}:{backgroundImage:`url("${zo({publicId:n.publicId,cloudName:n.cloudName,transformations:n.transformations})}")`}},$e=e=>{const t=U(e);return t?be(t):"unit"in e?e.unit==="auto"?"auto":e.unit==="keyword"?e.keyword:`${e.value}${e.unit}`:""},Si=e=>{if(!yi(e))return{};const t=U(e);if(t)return{border:be(t)};const n={};if(e.width&&(n.borderWidth=$e(e.width)),e.style){const r=U(e.style);n.borderStyle=r?be(r):e.style}return e.color&&(n.borderColor=Sn(e.color)),n},Xt=e=>e?$e(e):"0px",Ei=e=>{if(!_i(e)||!wi(e))return{};const t=U(e);if(t)return{boxShadow:be(t)};const n=[Xt(e.offsetX),Xt(e.offsetY),Xt(e.blur),Xt(e.spread)];return e.color&&n.push(Sn(e.color)),e.inset&&n.unshift("inset"),{boxShadow:n.join(" ")}},Ql=e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`,Ii=(e,t)=>{if(!$o(e))return{};if(e.allSides)return{[t]:$e(e.allSides)};const n={};for(const r of["top","right","bottom","left"]){const o=e[r];o&&(n[`${t}${Ql(r)}`]=$e(o))}return n},Ti=(e,t)=>An(e)?{[t]:Sn(e)}:{},Di=(e,t,n)=>{if(!ei(e,n))return{};const r=U(e);return r?{[t]:be(r)}:{[t]:e}},Pi=(e,t,n={})=>Qe(e,n)?{[t]:$e(e)}:{},ki=e=>{if(!bi(e))return{};const t=U(e);return t?{lineHeight:be(t)}:"unit"in e&&e.unit==="number"?{lineHeight:e.value}:{lineHeight:$e(e)}},xi=e=>{if(!Ci(e))return{};const t=U(e);return t?{opacity:be(t)}:{opacity:e}},En={"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:li},"align-items-3-resolutions":{kind:"enum",cssProperty:"alignItems",allowedValues:ai},"flex-wrap-3-resolutions":{kind:"enum",cssProperty:"flexWrap",allowedValues:ui},"align-content-3-resolutions":{kind:"enum",cssProperty:"alignContent",allowedValues:ci},"flex-direction-3-resolutions":{kind:"enum",cssProperty:"flexDirection",allowedValues:fi},"overflow-3-resolutions":{kind:"enum",cssProperty:"overflow",allowedValues:en},"overflow-x-3-resolutions":{kind:"enum",cssProperty:"overflowX",allowedValues:en},"overflow-y-3-resolutions":{kind:"enum",cssProperty:"overflowY",allowedValues:en},"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:di},"background-position-3-resolutions":{kind:"enum",cssProperty:"backgroundPosition",allowedValues:pi},"background-repeat-3-resolutions":{kind:"enum",cssProperty:"backgroundRepeat",allowedValues:hi},"opacity-3-resolutions":{kind:"opacity"},"font-family-3-resolutions":{kind:"enum",cssProperty:"fontFamily",allowedValues:ti},"font-size-3-resolutions":{kind:"length",cssProperty:"fontSize",capabilities:{allowAuto:!1,allowNegative:!1}},"font-weight-3-resolutions":{kind:"enum",cssProperty:"fontWeight",allowedValues:ni},"font-style-3-resolutions":{kind:"enum",cssProperty:"fontStyle",allowedValues:ri},"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:oi},"text-decoration-3-resolutions":{kind:"enum",cssProperty:"textDecoration",allowedValues:ii},"text-transform-3-resolutions":{kind:"enum",cssProperty:"textTransform",allowedValues:si}},Ri=(e,t)=>{const n=En[e];if(!n)return{};switch(n.kind){case"boxSpacing":return Ii(t,n.cssProperty);case"length":return Pi(t,n.cssProperty,n.capabilities);case"border":return Si(t);case"boxShadow":return Ei(t);case"color":return Ti(t,n.cssProperty);case"opacity":return xi(t);case"enum":return Di(t,n.cssProperty,n.allowedValues);case"lineHeight":return ki(t);case"backgroundImage":return Ai(t);default:return{}}},$l=Object.fromEntries(Object.entries(En).filter(([,e])=>e.kind==="boxSpacing").map(([e,t])=>[e,t.cssProperty])),ea=e=>e!=null&&e!=="",Li=e=>e?!gi.some(n=>ea(e[n]))||e.display==="flex"?e:{...e,display:"flex"}:{},Mi=({dbEntryType:e,libraryId:t,sourceComponentsPlugin:n})=>{if(!(e!=null&&e.length))return;const r=n.components[sr(t,e)];if(!r||!("defaultAttributeValues"in r))return;const i=r.defaultAttributeValues;if(i!=null&&i.length)return i.reduce((s,l)=>({...s,[l.name]:l.defaultValues}),{})},et=({deviceDisplayType:e,componentAttributes:t})=>{if(!t)return;const n={},r={};for(const[o,i]of Object.entries(t)){if(!o.includes("3-resolutions")||!i)continue;const s=i.all,l=s??i[e.toLowerCase()];r[o]=l,En[o]&&Object.assign(n,Ri(o,l))}return Object.keys(n).length||Object.keys(r).length?{styles:Object.keys(n).length?n:void 0,componentAttributesSpecificToDeviceType:Object.keys(r).length?r:void 0}:void 0},Ni=({defaultAttributes:e,userModifiedAttributes:t})=>e?t?{...e,...t}:e:t;function Pt(e){return e.componentAttributes??e.widgetAttributes}function Gn({col:e,deviceDisplayType:t,isComposeMode:n,sourceComponentsPlugin:r}){const o=Pt(e),i=Mi({dbEntryType:e.type,libraryId:e.libraryId,sourceComponentsPlugin:r})||[],s=Ni({defaultAttributes:i,userModifiedAttributes:o}),{styles:l,componentAttributesSpecificToDeviceType:a}=et({deviceDisplayType:t,componentAttributes:s})||{styles:void 0,componentAttributesSpecificToDeviceType:void 0};let c={};const f={};if(l)for(const[u,d]of Object.entries(l))n&&f[u]||(c={...c,[u]:d});let h=Pt(e);for(const u in a)if(u.includes("3-resolutions")){h={...Pt(e)||{},...a||{}};break}return{componentAttributesBasedOnDevice:h,componentStyles:Li(c)}}const Oi=e=>{const t=(e==null?void 0:e.rows)||[];for(const n of t)if(((n==null?void 0:n.columns)||[]).length>0)return!0;return(e==null?void 0:e.containerAttributes)&&Object.keys(e.containerAttributes).length>0},Wi="var(--sl-spacing-x-small)";function Fi(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 Vi({row:e,deviceDisplayType:t}){var r;const n=et({deviceDisplayType:t,componentAttributes:e.rowAttributes});return((r=n==null?void 0:n.componentAttributesSpecificToDeviceType)==null?void 0:r["hide-component-3-resolutions"])==="true"}function ji({row:e,deviceDisplayType:t,isComposeMode:n}){var d;const r=((d=et({deviceDisplayType:t,componentAttributes:e.rowAttributes}))==null?void 0:d.styles)||{},o=r.justifyContent??e.horizontalAlignment??Yn.Center,i=r.alignItems??e.verticalAlignment??Yn.Center,s=r.flexDirection??"row",l=r.gap??e.gap??Wi,a=n?"nowrap":r.flexWrap??e.flexWrap??"nowrap",c=r.alignContent??e.alignContent??void 0,f=new Set(["justifyContent","alignItems","flexDirection","gap","flexWrap","alignContent","display"]),h={};for(const[m,y]of Object.entries(r))f.has(m)||(h[m]=y);const u={display:"flex",flexDirection:s,gap:l,flexWrap:a,justifyContent:o,alignItems:i,...h};return c!==void 0&&(u.alignContent=c),u}const In="css-classes-3-resolutions",ta=500,na=/[\x00-\x1f\x7f]/g,Tn=e=>{if(typeof e!="string")return;const t=new Set,n=[];for(const o of e.split(/\s+/)){const i=o.replace(na,"");i&&(t.has(i)||(t.add(i),n.push(i)))}if(!n.length)return;let r="";for(const o of n){const i=r?`${r} ${o}`:o;if(i.length>ta)break;r=i}return r.length?r:void 0},vr="hide-component-3-resolutions",Bi=["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",vr],ra=new Set(Bi);function Ui({containerAttributes:e,deviceDisplayType:t}){var r;const n=et({deviceDisplayType:t,componentAttributes:e});return((r=n==null?void 0:n.componentAttributesSpecificToDeviceType)==null?void 0:r[vr])==="true"}function Ki({containerAttributes:e,deviceDisplayType:t,isComposeMode:n}){var i;if(!e)return{styles:{}};const r=n?Object.fromEntries(Object.entries(e).filter(([s])=>!ra.has(s))):e,o=et({deviceDisplayType:t,componentAttributes:r});return{styles:(o==null?void 0:o.styles)??{},cssClasses:Tn((i=o==null?void 0:o.componentAttributesSpecificToDeviceType)==null?void 0:i[In])}}function Hi(e){return Object.keys(e.styles).length>0||!!e.cssClasses}function te(e){if(!e)return;const t=[];for(const[n,r]of Object.entries(e)){if(r==null||r==="")continue;const o=n.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`);t.push(`${o}: ${r}`)}return t.length>0?t.join("; "):void 0}const Dn="/";function Yi({componentProps:e,ancestorColumnIds:t,columnId:n}){if(!e||!n)return;const r=[...t??[],n];for(let o=0;o<r.length;o+=1){const i=r.slice(o).join(Dn),s=e[i];if(s)return s}}function Gi({displayItemList:e,widgetCollections:t}){const n=[],r=(o,i)=>{var s;if((s=o==null?void 0:o.rows)!=null&&s.length)for(const l of o.rows)for(const a of l.columns){if(!a.id||a.type===wn.DroppableBox)continue;const c=fr(a.type);if(c!=null&&c.length){const f=a.collection??(t==null?void 0:t[c]);f&&!i.includes(a.id)&&r(f.collectionRows,[...i,a.id]);continue}n.push([...i,a.id].join(Dn))}};return r(e,[]),n}function oa(e,t){const n=`${Dn}${e}`;return t.some(r=>r===e||r.endsWith(n))}function zi({componentProps:e,displayItemList:t,widgetCollections:n}){const r=e?Object.keys(e):[];if(!r.length)return[];const o=Gi({displayItemList:t,widgetCollections:n});return r.filter(i=>!oa(i,o))}function qi({componentProps:e,displayItemList:t,widgetCollections:n,publishedKey:r}){if(process.env.NODE_ENV==="production")return;const o=zi({componentProps:e,displayItemList:t,widgetCollections:n});o.length&&console.warn(`RuleCMSWidget "${r}": componentProps ${o.map(i=>`"${i}"`).join(", ")} ${o.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 ia(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function sa(e){if(e.all!==void 0&&e.all!==null)return!1;const t=e.phone,n=e.tablet,r=e.desktop;return t!==n||t!==r||n!==r}function xr(e){var t;if(!((t=e==null?void 0:e.rows)!=null&&t.length))return!1;for(const n of e.rows){if(Rr(n.rowAttributes))return!0;for(const r of n.columns)if(Rr(Pt(r)))return!0}return!1}function Rr(e){if(!e)return!1;for(const[t,n]of Object.entries(e))if(!(!t.includes("3-resolutions")||!ia(n))){if(t==="hide-component-3-resolutions"){const r=n,o=i=>i==="true"||i===!0;if(o(r.phone)!==o(r.tablet)||o(r.phone)!==o(r.desktop))return!0;continue}if(sa(n))return!0}return!1}function Xi(e,t){if(xr(e))return!0;for(const n of Object.values(t))if(xr(n.collectionRows))return!0;return!1}const Zi=parseInt(pr,10),Ji=parseInt(hr,10),la=Zi+1,aa=Ji+1;function ua(e){const t=`.${e}-phone`,n=`.${e}-tablet`,r=`.${e}-desktop`;return`
|
|
2
|
+
${t}, ${n}, ${r} { display: none; }
|
|
3
|
+
@media (max-width: ${Zi}px) { ${t} { display: block; } }
|
|
4
|
+
@media (min-width: ${la}px) and (max-width: ${Ji}px) { ${n} { display: block; } }
|
|
5
|
+
@media (min-width: ${aa}px) { ${r} { display: block; } }
|
|
6
|
+
`.trim()}function tn(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 ca=0;var fa=Me("<div><!> <!></div>");function da(e,t){Re(t,!0);let n=le(t,"isComposeMode",3,!1),r=le(t,"showDropContainers",3,!1),o=le(t,"isWithinCollection",3,!1),i=le(t,"deviceDisplayType",3,"Desktop");const s=`rulecms-vc-${++ca}`;function l(P,D,S){const w=P&&!S?3:1;return!!(D!=null&&D.length)&&D.length>w}const a=A(()=>{var P;return(((P=t.displayItemList.containerAttributes)==null?void 0:P[$t])||[]).join(`;
|
|
7
|
+
`)}),c=A(()=>p(a)?`.${s} {
|
|
8
|
+
${p(a)}
|
|
9
|
+
}`:""),f=A(()=>!n()&&Ui({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:i()})),h=A(()=>Ki({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:i(),isComposeMode:n()})),u=A(()=>{var S;const P=((S=t.displayItemList.containerAttributes)==null?void 0:S[$t])||[],D=Hi(p(h));return n()&&!o()||r()||P.length>0||D||l(n(),t.displayItemList.rows,o())}),d=A(()=>[p(a)?s:void 0,p(h).cssClasses].filter(Boolean).join(" ")),m=A(()=>{var D;return{...(((D=t.displayItemList.containerAttributes)==null?void 0:D[$t])||[]).some(S=>S.toLowerCase().startsWith("height:"))?{}:{height:o()?"auto":"100%"},display:"flex",flexDirection:"column",...p(h).styles}}),y=A(()=>p(u)?p(d):""),g=A(()=>p(f)?{display:"none"}:p(u)?p(m):{display:"contents"});var _=fa(),R=me(_);{var I=P=>{var D=se(),S=re(D);Eo(S,()=>"style",!1,(w,C)=>{var b=So();_e(()=>rr(b,p(c))),W(C,b)}),W(P,D)};xe(R,P=>{p(a)&&P(I)})}var V=fn(R,2);or(V,()=>t.children),_e(P=>{ir(_,"hidden",p(f)||void 0),Wt(_,1,pn(p(y)||void 0)),ie(_,P)},[()=>te(p(g))]),W(e,_),Le()}var pa=Me("<div><!></div>");function ha(e,t){Re(t,!0);let n=le(t,"isComposeMode",3,!1),r=le(t,"showDropContainers",3,!1),o=le(t,"isWithinCollection",3,!1),i=le(t,"deviceDisplayType",3,"Desktop");function s(y,g,_){var I;const R=y&&!_?3:1;return!!((I=g==null?void 0:g.columns)!=null&&I.length)&&g.columns.length>R}const l=A(()=>!n()&&Vi({row:t.row,deviceDisplayType:i()})),a=A(()=>r()||Fi(t.row)||s(n(),t.row,o())),c=A(()=>ji({row:t.row,deviceDisplayType:i(),isComposeMode:n()})),f=A(()=>{var g;const y=et({deviceDisplayType:i(),componentAttributes:t.row.rowAttributes});return Tn((g=y==null?void 0:y.componentAttributesSpecificToDeviceType)==null?void 0:g[In])??""}),h=A(()=>p(a)?p(f):""),u=A(()=>p(l)?{display:"none"}:p(a)?p(c):{display:"contents"});var d=pa(),m=me(d);or(m,()=>t.children),_e(y=>{ir(d,"hidden",p(l)||void 0),Wt(d,1,pn(p(h)||void 0)),ie(d,y)},[()=>te(p(u))]),W(e,d),Le()}const Qi=["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"],ga=e=>e!=null&&e!=="",va=e=>e?Qi.reduce((t,n)=>{const r=e[n];return ga(r)&&(t[n]=r),t},{}):{},ma=e=>{if(!e)return;const t={...e};for(const n of Qi)delete t[n];return Object.keys(t).length?t:void 0},ya=e=>Object.keys(e).length>0,_a=(e,t)=>{const n=(e==null?void 0:e.noContainer)??!1,r=e==null?void 0:e.resolveNoContainer;if(typeof r!="function")return n;try{const o=r(t);if(typeof o=="boolean")return o;console.error(`resolveNoContainer: component "${e==null?void 0:e.id}" returned ${typeof o} instead of a boolean; falling back to noContainer=${n}`)}catch(o){console.error(`resolveNoContainer: component "${e==null?void 0:e.id}" threw; falling back to noContainer=${n}`,o)}return n},wa=(e,t)=>{const n=e==null?void 0:e.resolveRendersOwnElement;if(typeof n!="function")return!1;try{const r=n(t);if(typeof r=="boolean")return r;console.error(`resolveRendersOwnElement: component "${e==null?void 0:e.id}" returned ${typeof r} instead of a boolean; falling back to false`)}catch(r){console.error(`resolveRendersOwnElement: component "${e==null?void 0:e.id}" threw; falling back to false`,r)}return!1};var Lr=Me("<div><!></div>");function $i(e,t){Re(t,!0);const n=A(()=>t.components[sr(t.libraryId,t.componentType)]),r=A(()=>{var _;const g=(_=p(n))==null?void 0:_.card;return g||(console.error(`DisplayComponent: Component with type ${t.componentType}${t.libraryId?` (library "${t.libraryId}")`:""} not found in components`),null)}),o=A(()=>({componentAttributes:t.componentAttributes,styleProps:t.styleProps})),i=A(()=>p(n)?_a(p(n),p(o)):!1),s=A(()=>va(t.styleProps)),l=A(()=>p(i)?ma(t.styleProps):t.styleProps),a=A(()=>{var g;return Tn((g=t.componentAttributes)==null?void 0:g[In])}),c=A(()=>p(i)&&ya(p(s))),f=A(()=>!p(i)||(p(n)?wa(p(n),p(o)):!1)),h=A(()=>!p(c)&&p(f)?p(a):void 0),u=A(()=>({componentAttributes:t.componentAttributes,styleProps:p(l),className:p(h),widgetInstanceProps:t.widgetInstanceProps}));var d=se(),m=re(d);{var y=g=>{const _=A(()=>p(r));var R=se(),I=re(R);{var V=S=>{var w=Lr(),C=me(w);Nn(C,()=>p(_),(b,L)=>{L(b,On(()=>p(u)))}),_e(b=>{Wt(w,1,pn(p(a)||void 0)),ie(w,b)},[()=>te(p(s))]),W(S,w)},P=S=>{var w=Lr(),C=me(w);Nn(C,()=>p(_),(b,L)=>{L(b,On(()=>p(u)))}),_e(()=>Wt(w,1,pn(p(a)))),W(S,w)},D=S=>{var w=se(),C=re(w);Nn(C,()=>p(_),(b,L)=>{L(b,On(()=>p(u)))}),W(S,w)};xe(I,S=>{p(c)?S(V):!p(f)&&p(a)?S(P,1):S(D,-1)})}W(g,R)};xe(m,g=>{p(r)&&g(y)})}W(e,d),Le()}function mr(e,t){Re(t,!0);let n=le(t,"isComposeMode",3,!1),r=le(t,"isWithinCollection",3,!1),o=le(t,"showDropContainers",3,!1);const i=A(()=>tn(t.plugins).components);function s(h){if(n()&&h.type===wn.DroppableBox)return!1;const{componentAttributesBasedOnDevice:u}=Gn({col:h,deviceDisplayType:t.deviceDisplayType,isComposeMode:n(),sourceComponentsPlugin:tn(t.plugins)}),d=!!u&&u["hide-component-3-resolutions"]==="true";return!(!n()&&d)}function l(h){const{componentAttributesBasedOnDevice:u,componentStyles:d}=Gn({col:h,deviceDisplayType:t.deviceDisplayType,isComposeMode:n(),sourceComponentsPlugin:tn(t.plugins)});return{componentAttributes:u,styleProps:d}}function a(h){const u=fr(h.type);if(!(u!=null&&u.length))return null;const d=h.collection??t.widgetCollections[u];if(!d)throw new Error(`DisplayCollection - Collection with ID ${u} not found in widgetCollections. Available collections: ${Object.keys(t.widgetCollections).join(", ")}`);return!d.collectionRows||!Oi(d.collectionRows)?null:d.collectionRows}function c(h){return[...t.ancestorColumnIds??[],h]}function f(h){return Yi({componentProps:t.componentProps,ancestorColumnIds:t.ancestorColumnIds,columnId:h})}da(e,{get displayItemList(){return t.displayItemList},get isComposeMode(){return n()},get showDropContainers(){return o()},get isWithinCollection(){return r()},get deviceDisplayType(){return t.deviceDisplayType},children:(h,u)=>{var d=se(),m=re(d);Hn(m,17,()=>t.displayItemList.rows,y=>y.id,(y,g)=>{ha(y,{get row(){return p(g)},get isComposeMode(){return n()},get showDropContainers(){return o()},get isWithinCollection(){return r()},get deviceDisplayType(){return t.deviceDisplayType},children:(_,R)=>{var I=se(),V=re(I);Hn(V,17,()=>p(g).columns,P=>P.id,(P,D)=>{var S=se(),w=re(S);{var C=L=>{const G=A(()=>a(p(D)));var M=se(),q=re(M);{var tt=Te=>{{let nt=A(()=>c(p(D).id));mr(Te,{get displayItemList(){return p(G)},get isComposeMode(){return n()},isWithinCollection:!0,get widgetCollections(){return t.widgetCollections},get showDropContainers(){return o()},get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get plugins(){return t.plugins},get deviceDisplayType(){return t.deviceDisplayType},get componentProps(){return t.componentProps},get ancestorColumnIds(){return p(nt)}})}},Gt=Te=>{{let nt=A(()=>l(p(D)).componentAttributes),de=A(()=>l(p(D)).styleProps),zt=A(()=>f(p(D).id));$i(Te,{get componentType(){return p(D).type},get libraryId(){return p(D).libraryId},get componentAttributes(){return p(nt)},get components(){return p(i)},get styleProps(){return p(de)},get widgetInstanceProps(){return p(zt)}})}};xe(q,Te=>{p(G)?Te(tt):Te(Gt,-1)})}W(L,M)},b=A(()=>s(p(D)));xe(w,L=>{p(b)&&L(C)})}W(P,S)}),W(_,I)},$$slots:{default:!0}})}),W(h,d)},$$slots:{default:!0}}),Le()}function hn(e,t){Re(t,!0);var n=se(),r=re(n);{var o=i=>{mr(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 ancestorColumnIds(){return t.ancestorColumnIds}})};xe(r,i=>{var s,l;(l=(s=t.displayItemList)==null?void 0:s.rows)!=null&&l.length&&i(o)})}W(e,n),Le()}let ba=0;var Ca=Me("<div><!></div>"),Aa=Me("<!> <!>",1);function es(e,t){Re(t,!0);const n=["Phone","Tablet","Desktop"],r=`rulecms-bp-${++ba}`,o=A(()=>t.scopeIdInput??r),i=A(()=>Xi(t.displayItemList,t.widgetCollections)),s=A(()=>ua(p(o)));var l=se(),a=re(l);{var c=h=>{hn(h,{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}})},f=h=>{var u=Aa(),d=re(u);Eo(d,()=>"style",!1,(y,g)=>{var _=So();_e(()=>rr(_,p(s))),W(g,_)});var m=fn(d,2);Hn(m,16,()=>n,y=>y,(y,g)=>{var _=Ca(),R=me(_);hn(R,{get displayItemList(){return t.displayItemList},isComposeMode:!1,isWithinCollection:!1,get widgetCollections(){return t.widgetCollections},showDropContainers:!1,reduxDeviceDisplayType:"desktop",get deviceDisplayType(){return g},get plugins(){return t.plugins},get componentProps(){return t.componentProps}}),_e(I=>Wt(_,1,I),[()=>`${p(o)}-${g.toLowerCase()}`]),W(y,_)}),W(h,u)};xe(a,h=>{p(i)?h(f,-1):h(c)})}W(e,l),Le()}function Sa(e,t,n){if(e)return"Phone";if(t)return"Tablet";const r=(n==null?void 0:n.toLowerCase())||"desktop";return r==="phone"?"Phone":r==="tablet"?"Tablet":"Desktop"}const Ea=`(max-width: ${pr})`,Ia=`(max-width: ${hr})`;function ts(e,t){Re(t,!0);let n=ne("Desktop"),r,o;function i(){N(n,Sa((r==null?void 0:r.matches)??!1,(o==null?void 0:o.matches)??!1,t.reduxDeviceDisplayType),!0)}er(()=>(typeof matchMedia=="function"&&(r=matchMedia(Ea),o=matchMedia(Ia),r.addEventListener("change",i),o.addEventListener("change",i)),i(),()=>{r==null||r.removeEventListener("change",i),o==null||o.removeEventListener("change",i)})),hn(e,{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 p(n)},get plugins(){return t.plugins},get componentProps(){return t.componentProps}}),Le()}function Ta(e){const t={};return Object.entries(e).forEach(([n,r])=>{const o={...r};if(o.itemList)try{o.collectionRows=typeof o.itemList=="string"?JSON.parse(o.itemList):o.itemList}catch(s){console.error(`Failed to parse itemList for collection ${n}:`,s),o.collectionRows={rows:[]}}let i=`${o.name}$${n}`;o.parentId&&(i=`${i}@${o.parentId}`),t[i]=o}),t}function Da(e){return typeof e.itemList=="string"?JSON.parse(e.itemList):e.itemList}function yr(e){return{displayItemList:Da(e.widget),widgetCollections:Ta(e.childCollections),...e.libraries?{libraries:e.libraries}:{}}}function Pa(e){const t=e.registry??Yt(),n=bn({displayItemList:e.displayItemList,widgetCollections:e.widgetCollections});return t.resolveSync({registrations:e.libraries,referenced:n})}function ka(e){const t=e.registry??Yt(),n=bn({displayItemList:e.displayItemList,widgetCollections:e.widgetCollections});return t.resolve({registrations:e.libraries,referenced:n})}const xa={display:"flex",justifyContent:"center",alignItems:"center",padding:"3rem",color:"#e2e8f0"},Ra={display:"flex",alignItems:"center",gap:"1rem"},La={width:"40px",height:"40px",border:"4px solid #4a5568",borderTopColor:"#63b3ed",borderRadius:"50%",animation:"spin 1s linear infinite"},Mr={padding:"1.5rem",backgroundColor:"#742a2a",border:"1px solid #9b2c2c",borderRadius:"8px",color:"#fed7d7"},Nr={fontSize:"16px",fontWeight:"600",marginBottom:"0.5rem",color:"#feb2b2"},Or={fontSize:"14px",color:"#fed7d7"},Ma=`
|
|
10
|
+
@keyframes spin {
|
|
11
|
+
from {
|
|
12
|
+
transform: rotate(0deg);
|
|
13
|
+
}
|
|
14
|
+
to {
|
|
15
|
+
transform: rotate(360deg);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`,Na="data-rulecms-published-key";var Oa=Me("<div><div><div></div></div></div>"),Wa=Me("<div><div>Error Loading Widget</div> <div> </div></div>"),Fa=Me("<div><div>No Widget Data</div> <div>No widget data available</div></div>"),Va=Me('<span style="display: contents"><!></span>');function ja(e,t){Re(t,!0);let n=le(t,"mode",3,"client-fetch");const r=Fn.getContext(dr);let o=ne(!1),i=ne(null),s=ne(null),l=ne(null);const a=A(()=>n()==="pre-fetched"),c=A(()=>({sourceComponents:p(l)??void 0}));let f=null,h=null,u=!1;function d(){if(!p(s)){N(l,null);return}const w=t.libraries??(r==null?void 0:r.libraries),C=r==null?void 0:r.libraryRegistry,b=Pa({displayItemList:p(s).displayItemList,widgetCollections:p(s).widgetCollections,libraries:w,registry:C});if(b){N(l,b,!0);return}ka({displayItemList:p(s).displayItemList,widgetCollections:p(s).widgetCollections,libraries:w,registry:C}).then(L=>{N(l,L,!0)})}function m(){p(s)&&qi({componentProps:t.componentProps,displayItemList:p(s).displayItemList,widgetCollections:p(s).widgetCollections,publishedKey:t.publishedKey})}function y(){if(u||typeof document>"u")return;const w="rulecms-widget-spinner-styles";if(!document.getElementById(w)){const C=document.createElement("style");C.id=w,C.textContent=Ma,document.head.appendChild(C)}u=!0}function g(){const w=t.token??(r==null?void 0:r.token),C=t.endpoint??(r==null?void 0:r.endpoint);if(!t.publishedKey||!w){N(i,t.publishedKey?"Token is required. Provide it either directly as a prop (`token`) or via RuleCMSWidgetProvider.":Je(w)?"Widget key is required":"Published key is required",!0),N(s,null);return}const b=`${t.publishedKey}|${w}`;if(h===b&&p(s)){d();return}f==null||f.abort(),f=new AbortController;const L=f.signal;h=b,N(o,!0),N(i,null);const G=ur({publishedKey:t.publishedKey,token:w,endpoint:C});fetch(G,{method:"GET",headers:{"Content-Type":"application/json"},...Je(w)?{cache:"no-store"}:{},signal:L}).then(async M=>{if(M.ok){const q=await M.json();q.success?(N(s,yr(q.data),!0),N(i,null),d(),m()):(N(i,"Failed to fetch widget data"),N(s,null))}else{const q=await M.json().catch(()=>({error:"Unknown error"}));N(i,q.error||`Request failed with status ${M.status}`,!0),N(s,null)}}).catch(M=>{M instanceof DOMException&&M.name==="AbortError"||(console.error("Error fetching widget:",M),N(i,"Failed to fetch widget"),N(s,null))}).finally(()=>{N(o,!1)})}function _(){if(n()==="pre-fetched"){N(s,t.initialData??null,!0),N(o,!1),N(i,null),d(),m();return}y(),g()}er(()=>(t.publishedKey,t.token,t.endpoint,n(),t.initialData,t.libraries,t.componentProps,Fn.untrack(()=>_()),()=>{f==null||f.abort()}));var R=Va(),I=me(R);{var V=w=>{var C=Oa(),b=me(C),L=me(b);_e((G,M,q)=>{ie(C,G),ie(b,M),ie(L,q)},[()=>te(xa),()=>te(Ra),()=>te(La)]),W(w,C)},P=w=>{var C=Wa(),b=me(C),L=fn(b,2),G=me(L);_e((M,q,tt)=>{ie(C,M),ie(b,q),ie(L,tt),rr(G,p(i))},[()=>te(Mr),()=>te(Nr),()=>te(Or)]),W(w,C)},D=w=>{var C=Fa(),b=me(C),L=fn(b,2);_e((G,M,q)=>{ie(C,G),ie(b,M),ie(L,q)},[()=>te(Mr),()=>te(Nr),()=>te(Or)]),W(w,C)},S=w=>{var C=se(),b=re(C);{var L=M=>{es(M,{get displayItemList(){return p(s).displayItemList},get widgetCollections(){return p(s).widgetCollections},get plugins(){return p(c)},get componentProps(){return t.componentProps}})},G=M=>{ts(M,{get displayItemList(){return p(s).displayItemList},isComposeMode:!1,isWithinCollection:!1,get widgetCollections(){return p(s).widgetCollections},showDropContainers:!1,reduxDeviceDisplayType:"desktop",get plugins(){return p(c)},get componentProps(){return t.componentProps}})};xe(b,M=>{p(a)?M(L):M(G,-1)})}W(w,C)};xe(I,w=>{n()!=="pre-fetched"&&p(o)?w(V):n()!=="pre-fetched"&&p(i)?w(P,1):n()!=="pre-fetched"&&!p(s)?w(D,2):p(l)&&p(s)&&w(S,3)})}_e(()=>ir(R,"data-rulecms-published-key",t.publishedKey)),W(e,R),Le()}class It extends Error{constructor(n,r){super(n);pe(this,"status");this.name="FetchRuleCMSWidgetError",this.status=r}}async function Ba(e){const{publishedKey:t,token:n,endpoint:r,fetchOptions:o}=e;if(!t)throw new It(Je(n)?"Widget key is required":"Published key is required");if(!n)throw new It("Token is required");const i=ur({publishedKey:t,token:n,endpoint:r}),s=await fetch(i,{method:"GET",headers:{"Content-Type":"application/json"},...Je(n)?{cache:"no-store"}:{},...o});if(!s.ok){const a=await s.json().catch(()=>({error:"Unknown error"}));throw new It(a.error||`Request failed with status ${s.status}`,s.status)}const l=await s.json();if(!l.success)throw new It("Failed to fetch widget data");return yr(l.data)}async function Ua(e){const{data:t,libraries:n}=e,r=bn({displayItemList:t.displayItemList,widgetCollections:t.widgetCollections});return Yt().resolve({registrations:n,referenced:r})}exports.AlignContentTypes=Al;exports.BreakpointVariantRender=es;exports.COLLECTION_TYPE_PREFIX=ar;exports.COMPONENT_PROPS_PATH_SEPARATOR=Dn;exports.CSS_CLASSES_ATTRIBUTE_NAME=In;exports.CSS_VARIABLE_NAME_MAX_LENGTH=Xo;exports.CSS_VARIABLE_NAME_PATTERN=qo;exports.DEFAULT_CLOUDINARY_CLOUD_NAME=Uo;exports.DEFAULT_LIBRARY_ID=_t;exports.DEFAULT_ROW_GAP=Wi;exports.DEV_CLIENT_TOKEN_PREFIX=Do;exports.DEV_WIDGET_API_PATH=Ro;exports.DeviceDisplayTypes=Sl;exports.DisplayComponent=$i;exports.DisplayItemTypes=wn;exports.DragItemIdPrefixTypes=lr;exports.EMBEDDED_KEY_SEPARATOR=Vo;exports.FLEX_LAYOUT_STYLE_KEYS_THAT_DERIVE_DISPLAY=gi;exports.FetchRuleCMSWidgetError=It;exports.HIDE_WIDGET_ATTRIBUTE_NAME=vr;exports.JustifyContentTypes=Yn;exports.PUBLISHED_KEY_SEPARATOR=Fo;exports.PUBLISHED_WIDGET_API_PATH=xo;exports.PageViewTypes=Cl;exports.RULECMS_API_ORIGIN=Po;exports.RULECMS_PUBLISHED_KEY_ATTRIBUTE=Na;exports.RULECMS_WIDGET_CONTEXT_KEY=dr;exports.RenderComponents=ts;exports.RenderComponentsForDevice=hn;exports.RenderComponentsInner=mr;exports.RuleCMSWidget=ja;exports.RuleCMSWidgetProvider=Ll;exports.WIDGET_ATTRIBUTES_IGNORED_IN_COMPOSE_MODE=Bi;exports.WIDGET_CACHE_API_ORIGIN=ko;exports.alignContentAllowlist=ci;exports.alignItemsAllowlist=ai;exports.backgroundPositionAllowlist=pi;exports.backgroundRepeatAllowlist=hi;exports.backgroundSizeAllowlist=di;exports.borderStyleKeywords=vi;exports.boxSpacingSideKeys=Qo;exports.boxSpacingStyleAttributeEntries=$l;exports.buildCloudinaryBackgroundUrl=zo;exports.buildWidgetFetchUrl=ur;exports.collectComponentInstancePaths=Gi;exports.collectReferencedLibraryIds=bn;exports.composeSourceComponentsPlugin=To;exports.createComponentLibraryRegistry=Yt;exports.cssAttrArrayKey=$t;exports.defaultPageWidth=Bo;exports.deriveDisplayFlexIfNeeded=Li;exports.desktopModeWidth=Ml;exports.fetchRuleCMSWidget=Ba;exports.findUnmatchedComponentPropsKeys=zi;exports.flexDirectionAllowlist=fi;exports.flexWrapAllowlist=ui;exports.fontFamilyAllowlist=ti;exports.fontStyleAllowlist=ri;exports.fontWeightAllowlist=ni;exports.formatBackgroundImageStyles=Ai;exports.formatBorderStyles=Si;exports.formatBoxShadowStyles=Ei;exports.formatBoxSpacingStyles=Ii;exports.formatCssColorStyles=Ti;exports.formatCssColorValue=Sn;exports.formatCssEnumStyles=Di;exports.formatCssLengthStyles=Pi;exports.formatCssVariable=be;exports.formatCssVariableStyles=zl;exports.formatLineHeightStyles=ki;exports.formatObjectStyleAttribute=Ri;exports.formatOpacityStyles=xi;exports.formatSpacingSideValue=$e;exports.generatePublishedKey=jo;exports.generatePublishedKeyForEmbedded=kl;exports.getCollectionIdForCollectionType=fr;exports.getColumnAttributes=Pt;exports.getComponentAttributesAndStyles=Gn;exports.getComponentsPluginFromPlugins=tn;exports.getCssVariableFromLeaf=U;exports.getDefaultDimensionAttributes=Mi;exports.getDeviceTypeBasedAttributes=et;exports.getDragItemId=El;exports.getDragItemPrefixAndId=Mo;exports.getIdAndPrefix=No;exports.getMergedAttributes=Ni;exports.getNameAndInstanceIdFromWidgetKey=Il;exports.getNameFromWidgetKey=Tl;exports.getWidgetKeyForCollection=Oo;exports.getWidgetKeyForCollectionWithPrefix=Dl;exports.getWidgetKeyForPublishedCollection=Wo;exports.getWidgetKeyForPublishedCollectionWithPrefix=Pl;exports.hasBoxShadowLeaf=wi;exports.hasDeviceDivergentValues=Xi;exports.hasInvalidCssVariable=Ie;exports.hasItems=Oi;exports.incrementVersion=xl;exports.isBackgroundImageValue=Zo;exports.isBorderStyleValue=mi;exports.isBorderValue=yi;exports.isBoxShadowValue=_i;exports.isBoxSpacingValue=$o;exports.isCloudinaryCloudName=Ho;exports.isCloudinaryPublicId=Ko;exports.isCloudinaryTransformationString=Go;exports.isCssColorValue=An;exports.isCssEnumValue=ei;exports.isCssVariableName=gr;exports.isDevClientToken=Je;exports.isLineHeightValue=bi;exports.isOpacityValue=Ci;exports.isRowHiddenForDevice=Vi;exports.isSafeImageUrl=Yo;exports.isSpacingSideValue=Qe;exports.isWidgetHiddenForDevice=Ui;exports.justifyContentAllowlist=li;exports.normalizeCssClasses=Tn;exports.objectStyleAttributeRegistry=En;exports.overflowAllowlist=en;exports.phoneModeWidth=pr;exports.prepareRuleCMSWidgetData=yr;exports.resolveKey=sr;exports.resolveRowStyles=ji;exports.resolveWidgetApiOrigin=Lo;exports.resolveWidgetContainerStyles=Ki;exports.resolveWidgetInstanceProps=Yi;exports.resolveWidgetLibraries=Ua;exports.rowBasedPropertiesAreAssigned=Fi;exports.spacingKeywords=Cn;exports.spacingLengthUnits=Jo;exports.tabletModeWidth=hr;exports.textAlignAllowlist=oi;exports.textDecorationAllowlist=ii;exports.textTransformAllowlist=si;exports.toStyleAttr=te;exports.typeHasPrefix=cr;exports.warnUnmatchedComponentProps=qi;exports.widgetBasedPropertiesAreAssigned=Hi;
|