@plitzi/plitzi-sdk 0.35.1 → 0.35.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.
- package/CHANGELOG.md +32 -0
- package/dist/plitzi-sdk.js +58 -58
- package/dist/plitzi-sdk.js.gz +0 -0
- package/dist/withElement-Nj-YY2Rh.js +5 -0
- package/package.json +12 -12
- package/dist/withElement-aG4S-kGR.js +0 -5
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-CxhCXM28.js";import{Component as t,Fragment as r,Profiler as n,Suspense as i,createContext as a,createElement as s,isValidElement as o,lazy as l,use as u,useCallback as c,useContext as d,useEffect as h,useId as f,useLayoutEffect as p,useMemo as m,useRef as y,useState as g,useSyncExternalStore as b}from"react";import{jsx as w}from"react/jsx-runtime";var v=a(void 0);v.displayName="ElementContext";var x=e=>!1!==e&&"false"!==e,k=(e,t)=>{let r=new Set(t),n={};for(let i in e)!r.has(i)&&Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i]);return n},S=()=>{},M=class{items=[];notifying=0;dead=0;get length(){return this.items.length-this.dead}add(e){return this.items.push(e),()=>this.remove(e)}remove(e){let t=this.items.indexOf(e);if(-1===t)return;if(this.notifying>0)return this.items[t]=S,void this.dead++;let r=this.items.pop();t<this.items.length&&(this.items[t]=r)}begin(){this.notifying++}end(){0===--this.notifying&&this.dead>0&&this.compact()}forEach(e,t){this.begin();try{let r,{items:n}=this,i=n.length,a=0,s=!1;for(;a<i;)try{for(;a<i;a++)e(n[a])}catch(e){s||(s=!0,r=e),a++}if(s){if(!t)throw r;t(r)}}finally{this.end()}}clear(){if(this.notifying>0){let{items:e}=this;for(let t=0,r=e.length;t<r;t++)e[t]=S;return void(this.dead=e.length)}this.items.length=0,this.dead=0}compact(){let{items:e}=this,t=0;for(let r=0;r<e.length;r++)e[r]!==S&&(e[t++]=e[r]);e.length=t,this.dead=0}},A=(e,t)=>"function"==typeof e?!e(t):!1===e,P=e=>"object"==typeof e&&!!e&&!Array.isArray(e),T=(e,t)=>{if(!P(e)||!P(t))return t;let r={...e};for(let n of Object.keys(t))"__proto__"!==n&&(r[n]=n in e?T(e[n],t[n]):t[n]);return r},_=/* @__PURE__ */new Map,N=e=>{let t=_.get(e);return void 0===t&&(t=e.split("."),_.size>=512&&_.delete(_.keys().next().value),_.set(e,t)),t},D=/* @__PURE__ */new Map;function j(e,t){let r=Array.isArray(t);if("string"!=typeof t&&!r||r&&!t.length||"string"==typeof t&&!t)return e;if("string"==typeof t&&-1===t.indexOf("."))return"object"==typeof e&&e&&t in e?e[t]:void 0;if("string"==typeof t)return(e=>{let t=D.get(e);if(!t){if(t=(e=>{if(1===e.length){let t=e[0];return e=>"object"==typeof e&&e&&t in e?e[t]:void 0}return t=>{let r=t;for(let n=0;n<e.length;n++){if("object"!=typeof r||!r)return;r=r[e[n]]}return r}})(N(e)),D.size>=512){let e=D.keys().next().value;D.delete(e)}D.set(e,t)}return t})(t)(e);let n=e;for(let i of t){if("object"!=typeof n||!n||!(i in n))return;n=n[i]}return n}var C,O=Symbol("unchanged"),W=e=>/^\d+$/.test(e),E=e=>Array.isArray(e)?e.slice():{...e},$=(e,t,r,n,i)=>{let a=t[r],s="object"==typeof e&&e?e:{};if(r===t.length-1){let e=s[a],t=i?n(e):n;if(e===t)return O;let r=E(s);return r[a]=t,r}let o=$(s[a],t,r+1,n,i);if(o===O)return O;let l=E(s);return l[a]=o,l},F=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,z=e=>F.test(e)?`.${e}`:`[${JSON.stringify(e)}]`,I=e=>F.test(e)?e:JSON.stringify(e),Y=e=>{let t=e.length,r="";for(let a=0;a<t-1;a++){let t=0===a?"o":"_"+(a-1);r+=`var _${a}=${t}==null?void 0:${t}${z(e[a])};\n`}let n=t>1?"_"+(t-2):"o";r+=`var _p=${n}==null?void 0:${n}${z(e[t-1])};\n`,r+="var _v=f?v(_p):v;\nif(_p===_v)return null;\n";let i="_v";for(let a=t-1;a>=0;a--)i=`{...${0===a?"o":`(_${a-1}||{})`},${I(e[a])}:${i}}`;return r+=`return ${i};`,Function("o","v","f",r)},H=/* @__PURE__ */new Map,q=(e,t,r)=>{if("object"!=typeof e||!e)return O;let n=e,i=t[r];if(!Object.hasOwn(n,i))return O;if(r===t.length-1){let e=E(n);return Array.isArray(e)?e.splice(Number(i),1):delete e[i],e}let a=q(n[i],t,r+1);if(a===O)return O;let s=E(n);return s[i]=a,s},L=(e,t,r,n,i)=>{let a=((e,t)=>{if(!(()=>{if(typeof window>"u")return!1;if(void 0===C)try{Y(["x","y"])({x:{}},1,!1),C=!0}catch{C=!1}return C})())return;let r=H.get(e);if(r)return r;if(t.some(W))return;let n=Y(t);return H.size>=256&&H.delete(H.keys().next().value),H.set(e,n),n})(t,r);if(a){let t=a(e,n,i);return null===t?O:t}return $(e,r,0,n,i)},B=Symbol("@plitzi/nexus/cancel"),U=(()=>{try{return"production"}catch{}return"production"})(),V="production"===U,R=!V,X="test"===U;var Z=e=>"number"==typeof e||""===e||isNaN(Number(e))?e:Number(e),Q=e=>Array.isArray(e)?e.slice():{...e},G=(e,t,r,n)=>{let i=Z(t[r]),a=Q(e);return a[i]=r===t.length-1?n:G(e[i]??{},t,r+1,n),a},J=Symbol("no-error"),K=(e,t,r)=>{let n=0,i=J;for(;n<r;)try{for(;n<r;n++)e[n](t)}catch(e){i===J&&(i=e),n++}return i},ee="__proto__";var te=class{subscribers=null;children=null},re=class{direct=/* @__PURE__ */new Map;descendants=/* @__PURE__ */new Map;root=new te;size=0;add(e,t){let r=N(e),n=this.direct.get(e);if(!n){n=new M,this.direct.set(e,n);let t=this.root;for(let e of r){t.children||(t.children=/* @__PURE__ */new Map);let r=t.children.get(e);r||(r=new te,t.children.set(e,r)),t=r}t.subscribers=n,this.size++;let i="";for(let n=0;n<r.length-1;n++){i=i?`${i}.${r[n]}`:r[n];let t=this.descendants.get(i);t||(t=/* @__PURE__ */new Set,this.descendants.set(i,t)),t.add(e)}}return n.add(t),()=>this.remove(e,n,t,r)}remove(e,t,r,n){if(this.direct.get(e)!==t||(t.remove(r),t.length>0))return;this.direct.delete(e),this.size--;let i=this.root;for(let s of n){if(!i.children)return;let e=i.children.get(s);if(!e)return;i=e}i.subscribers===t&&(i.subscribers=null);let a="";for(let s=0;s<n.length-1;s++){a=a?`${a}.${n[s]}`:n[s];let t=this.descendants.get(a);t&&(t.delete(e),0===t.size&&this.descendants.delete(a))}}walkAncestors(e,t){let r=this.root;for(let n of e){if(!r.children)return;let e=r.children.get(n);if(!e)return;r=e,r.subscribers&&t(r.subscribers)}}getDescendants(e){return this.descendants.get(e)}forEachAffected(e,t,r){let n=e=>{e&&e.forEach(t,r)};if("string"!=typeof e)return void this.direct.forEach(n);let i=N(e);this.walkAncestors(i,n),this.descendants.get(e)?.forEach(e=>n(this.direct.get(e)))}clear(){this.direct.clear(),this.descendants.clear(),this.root.children=null,this.root.subscribers=null,this.size=0}},ne=0;function ie(e,t){let r,n,i,a={},s=new M,o=new M,l=new re,u=new M,c=()=>{0!==u.length&&u.forEach(e=>e())},d=[],h=[],f=[],p=t?.parent,m=++ne,y=(e,t,r)=>{if(0===h.length)throw e;let n={error:e,phase:t,path:r};for(let i=0,a=h.length;i<a;i++)h[i](n)},g=()=>a,b=()=>r??={...a},{getState:w,getPath:v,invalidate:x,resetCache:k,getMergeCount:S}=function(e,t,r,n){if(!r)return{getState:t,getPath:t=>j(e(),t),invalidate:()=>{},resetCache:()=>{},getMergeCount:()=>0};let i,a=r,s=n&&n.length>0?new Set(n):void 0,o=!0,l=!1,u=0,c=/* @__PURE__ */new Map,d=()=>((o||void 0===i)&&(i=(()=>{u++;let e=t(),r=T(a.getState(),e);if(s)for(let t of s)void 0!==e[t]&&(r[t]=e[t]);return r})(),o=!1),i);return{getState:d,getPath:t=>{if(l)c.clear(),l=!1;else if(c.has(t))return c.get(t);let r=(t=>{if(s){let r=t.indexOf("."),n=-1===r?t:t.slice(0,r);if(s.has(n)&&void 0!==e()[n])return j(e(),t)}let r=j(e(),t);if(void 0===r)return a.getPath(t);let n=a.getPath(t);return void 0!==n&&P(r)&&P(n)?j(d(),t):r})(t);return c.set(t,r),r},invalidate:()=>{o=!0,l=!0},resetCache:()=>{c.clear(),i=void 0,o=!0,l=!1},getMergeCount:()=>u}}(g,b,p,t?.exclusive),A=()=>{x(),c()},_=!1;p&&(k(),i=p.subscribeInvalidate?.(A));let{setState:D,batch:C}=function(e){let{getOwnState:t,getOwnSnapshot:r,setOwnState:n,mutateOwnKey:i,deleteOwnKey:a,parent:s,listeners:o,pathListeners:l,changeListeners:u,interceptors:c,readOnly:d,reportError:h,invalidateDescendants:f,onDelegateToParent:p}=e,m=e=>{if(0===d.length||!(e=>{for(let t=0,r=d.length;t<r;t++){let r=d[t];if(e===r||e.startsWith(`${r}.`)||r.startsWith(`${e}.`))return!0}return!1})(e))return!1;if(R)throw Error(`@plitzi/nexus: refused to write to read-only path "${e}"`);return!0},y=(e,t,r)=>{let n=t;for(let i=0,a=c.length;i<a;i++){let a;try{a=c[i]({path:e,value:n,prev:r})}catch(t){return h(t,"beforeChange",e),B}if(a===B)return B;void 0!==a&&(n=a)}return n},g=0,b=/* @__PURE__ */new Set,w=(e,t)=>{let{items:r}=e;if(g>0)for(let n=0,i=r.length;n<i;n++)b.add(r[n]);else if(0!==r.length){e.begin();try{let e=K(r,t,r.length);e!==J&&h(e,"notify",t)}finally{e.end()}}},v=(e,t,r)=>{let n={path:e,prev:t,next:r,prevValue:void 0===e?t:j(t,e),nextValue:void 0===e?r:j(r,e)},{items:i}=u;u.begin();try{let t=K(i,n,i.length);t!==J&&h(t,"onChange",e)}finally{u.end()}},x=(e,t,r,n)=>{let i=l.getDescendants(e);if(i)for(let a of i){let i=l.direct.get(a);if(!i)continue;let s=N(a).slice(n);j(t,s)!==j(r,s)&&w(i,e)}},k=(e,t,r,i,a)=>{let s=e?j(r,e):void 0,h=e?a?t(s):t:void 0;if(e&&c.length>0){let t=y(e,h,s);if(t===B)return;h=t}if(e&&s===h)return;let p=e?((e,t,r)=>{if("string"==typeof t){if(!t)return r;let n=N(t);if(1===n.length){let t=Q(e);return t[Z(n[0])]=r,t}return G(e,n,0,r)}return Array.isArray(t)&&t.length?G(e,t,0,r):r})(r,e,h):a?t(r):{...r,...t};if(!e&&c.length>0){let e=y(void 0,p,r);if(e===B)return;p=e}if(p!==r){if(d.length>0)for(let e=0,t=d.length;e<t;e++){let t=d[e];if(j(r,t)!==j(p,t)){if(R)throw Error(`@plitzi/nexus: refused to write to read-only path "${d[e]}"`);return}}n(p),u.length>0&&v(e,r,p),f(),i&&(w(o,e),l.size>0&&l.direct.forEach((t,n)=>{j(r,n)!==j(p,n)&&w(t,e)}))}};return{setState:(e,d,h={})=>{let{canPropagate:g=!0,unmount:b=!1,raw:S=!1}=h,M=t(),A=!S&&"function"==typeof d;if("string"==typeof e&&-1!==e.indexOf(ee)&&-1!==N(e).indexOf(ee))throw Error(`@plitzi/nexus: refused to write to unsafe path "${e}" (\`__proto__\` segment)`);if("string"==typeof e&&m(e))return;if(s&&"string"==typeof e&&!(-1===e.indexOf(".")?Object.hasOwn(M,e):((e,t)=>{let r=e;for(let n=0,i=t.length;n<i;n++){if("object"!=typeof r||!r||!Object.hasOwn(r,t[n]))return!1;r=r[t[n]]}return!0})(M,N(e))))return p?.(e),void s.setState(e,d,{canPropagate:g,unmount:b,raw:S});if("string"!=typeof e)return void k(e,d,M,g,A);if(-1===e.indexOf(".")){if(b){if(!Object.hasOwn(M,e))return;let t=M[e];if(c.length>0&&y(e,void 0,t)===B)return;let n=u.length>0?r():void 0;if(a(e),void 0!==n&&v(e,n,r()),g&&(w(o,e),l.size>0)){let r=l.direct.get(e);r&&w(r,e),x(e,t,void 0,1)}return void f()}let t=M[e],n=A?d(t):d,s=n;if(c.length>0){let r=y(e,n,t);if(r===B)return;s=r}if(t===s)return;let h=u.length>0?r():void 0;if(i(e,s),void 0!==h&&v(e,h,r()),g&&(w(o,e),l.size>0)){let r=l.direct.get(e);r&&w(r,e),x(e,t,s,1)}return void f()}let P,T=N(e);if(b){if(c.length>0&&y(e,void 0,j(M,e))===B)return;P=((e,t)=>q(e,t,0))(M,T)}else if(c.length>0){let t=j(M,e),r=A?d(t):d,n=y(e,r,t);if(n===B)return;P=L(M,e,T,n,!1)}else P=L(M,e,T,d,A);if(P===O)return;let _=P;n(_),u.length>0&&v(e,M,_),g&&(w(o,e),l.size>0&&(((e,t)=>{l.walkAncestors(t,t=>w(t,e))})(e,T),x(e,M,_,0))),f()},batch:e=>{g++;try{return e()}finally{if(g--,0===g&&b.size>0){let e=[...b];b.clear();let t=K(e,void 0,e.length);t!==J&&h(t,"notify",void 0)}}}}}({getOwnState:g,getOwnSnapshot:b,setOwnState:e=>{a=e,r=void 0,x()},mutateOwnKey:(e,t)=>{a[e]=t,x(),r=void 0},deleteOwnKey:e=>{delete a[e],x(),r=void 0},parent:p,listeners:s,pathListeners:l,changeListeners:o,interceptors:d,readOnly:t?.readOnly??[],reportError:y,invalidateDescendants:c,onDelegateToParent:R&&p?e=>p.scopeClaims?.claimDelegatedWrite(e,m):void 0}),W=()=>{n&&(n.unsubscribe(),n=void 0,k())},E=()=>{p&&(!_&&(s.length>0||l.size>0||o.length>0)?!n&&p&&(x(),k(),n=function(e,t,r,n,i,a,s){let o;return{unsubscribe:e.subscribe(e=>{s();let l=e;if(t.forEach(t=>t(e),e=>a(e,"notify",l)),r.size>0&&r.forEachAffected(e,t=>t(e),e=>a(e,"notify",l)),n.length>0){let e=i(),t=o??e,r={path:l,prev:t,next:e,prevValue:void 0===l?t:j(t,l),nextValue:void 0===l?e:j(e,l)};o=e,n.forEach(e=>e(r),e=>a(e,"onChange",l))}}),seedBaseline:()=>{o??=i()}}}(p,s,l,o,w,y,x),o.length>0&&n.seedBaseline()):W())},$=e=>(E(),()=>{e(),E()}),F=e=>$(s.add(e)),z=(e,t)=>$(l.add(e,t)),I=e=>{let t=$(o.add(e));return n?.seedBaseline(),t};a="function"==typeof e?e(D,w):e;let Y={id:t?.id,scopePath:t?.scopePath,getState:w,getOwnState:b,getPath:v,setState:D,get:e=>void 0===e?w():v(e),set:D,watch:(e,t)=>"function"==typeof e?F(e):z(e,t),withBase:e=>{let t=(t,r,n)=>D(void 0===t?e:`${e}.${t}`,r,n);return{getState:t=>{let r=v(e);return void 0===r&&void 0!==t?t:r},getPath:(t,r)=>{let n=v(`${e}.${t}`);return void 0===n&&void 0!==r?r:n},setState:t,subscribe:t=>z(e,t),subscribePath:(t,r)=>z(`${e}.${t}`,r),get:t=>v(void 0===t?e:`${e}.${t}`),set:t,watch:(t,r)=>"function"==typeof t?z(e,t):z(`${e}.${t}`,r)}},batch:C,subscribe:F,subscribePath:z,subscribeChange:I,destroy:()=>{_=!0,W(),s.clear(),l.clear(),o.clear(),u.clear(),i?.(),R&&p&&p.scopeClaims?.releaseScope(m)},reconnect:()=>{_=!1,p&&(i?.(),i=p.subscribeInvalidate?.(A)),E()},subscribeInvalidate:e=>u.add(e),hydrate:()=>{for(let e of f)e()}};if(t?.middlewares)for(let M of t.middlewares){let e=M(Y);e?.beforeChange&&d.push(e.beforeChange),e?.onChange&&I(e.onChange),e?.onError&&h.push(e.onError);let r=e?.hydrate;r&&(t.deferHydrate?f.push(()=>r(Y)):r(Y))}return R&&(Y.scopeClaims=(()=>{let e=/* @__PURE__ */new Map,t=/* @__PURE__ */new Map;return{claimDelegatedWrite(r,n){let i=e.get(r);if(void 0!==i){if(i===n)return;if(X)throw Error((e=>`@plitzi/nexus: scope collision — two sibling scopes under the same parent both delegate a write to "${e}", clobbering each other through the shared parent. Write to a path each scope owns, or move the shared value into the parent and update it there.`)(r));return}e.set(r,n);let a=t.get(n);a?a.add(r):t.set(n,/* @__PURE__ */new Set([r]))},releaseScope(r){let n=t.get(r);if(n){for(let t of n)e.delete(t);t.delete(r)}}}})()),X&&(Y.listeners=s,Y.pathListeners=l,Y.changeListeners=o,Y.interceptors=d,Y.errorHandlers=h,Y.invalidateListeners=u,Y.getMergeCount=S),Y}var ae=a(void 0);ae.displayName="StoreContext";var se=a(void 0);se.displayName="StoreRegistryContext";var oe=(e,t)=>{for(let r=e;r;r=r.parent)if(r.id===t)return r.store},le=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Object.is(e[r],t[r]))return!1;return!0};function ue(e,t,r){let n=d(ae),i=d(se);if(e)return e;if(void 0!==r){let e=oe(i,r);if(!e)throw Error(`${t}: no store registered with id "${r}" in any ancestor StoreProvider`);return e}if(!n)throw Error(`${t} must be used inside a StoreProvider`);return n}function ce(e,t,r){let n=t.current.length;return m(()=>Array.from({length:n},(r,n)=>(r,i)=>{let a=t.current[n],s="function"==typeof a?a(e.getState()):a;e.setState(s,r,i)}),[e,r])}var de=typeof window<"u"?p:h,he=(e,t)=>{if(Object.is(e,t))return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let i of r)if(!Object.is(e[i],t[i]))return!1;return!0};function fe(e,t,r={}){let n=r,i=ue(n.store,"useStoreSync",n.storeId);Array.isArray(e)?function(e,t,r,n){let{mode:i="sync",enabled:a=!0,syncStrategy:s="afterRender",raw:o=!1}=n,l=t.map((e,t)=>"function"==typeof e?`fn_${t}`:e).join("|"),u=y(!1),c=!u.current;u.current=!0;let d=y(void 0),h=a&&(c||"sync"===i&&r.some((e,t)=>!Object.is(d.current?.[t],e))),f=(n=!0)=>{d.current=r,e.batch(()=>{t.forEach((t,i)=>{let a="function"==typeof t?t(e.getState()):t;e.setState(a,r[i],{canPropagate:n,raw:o})})})};"render"===s?h&&f():(h&&c&&f(!1),de(()=>{h&&!c&&f()},[h,r,l]))}(i,e,t,r):function(e,t,r,n){let i=void 0===t,a="function"==typeof t,s=i?he:Object.is,{mode:o="sync",enabled:l=!0,equalityFn:u=s,syncStrategy:c="afterRender",raw:d=!1}=n,h=y(void 0),f=y(!1),p=!f.current;f.current=!0;let m=h.current,g=l&&(p||"sync"===o&&(void 0===m||!u(m,r))),b=(n=!0)=>{if(h.current=r,i)e.setState(void 0,e=>({...e,...r}),{canPropagate:n});else if(a){let i=t(e.getState());e.setState(i,r,{canPropagate:n,raw:d})}else e.setState(t,r,{canPropagate:n,raw:d})};"render"===c?g&&b():(g&&p&&b(!1),de(()=>{g&&!p&&b()},[g,r,t]))}(i,e,t,r)}var pe=[];var me=()=>({useStore:function(e,t){return function(e,t={}){let r=ue(t.store,"useStore",t.storeId),n=Array.isArray(e),i=function(e,t,r){let n=r.mode??"sync",i=r.enabled??!0,a=void 0===t,s=r.equalityFn??(a?he:Object.is),o=r.transformer,l=y(o);l.current=o;let u=m(()=>function(e,t){return()=>{if("string"==typeof t)return e.getPath(t);if("function"==typeof t){let r=e.getState();return j(r,t(r))}return e.getState()}}(e,t),[e,t]),d=y(u()),h=m(()=>r=>i&&"mount"!==n?"string"==typeof t?e.subscribePath(t,r):e.subscribe(r):()=>{},[i,n,t,e]),f=()=>{if(!i)return d.current;if("mount"===n)return u();let e=u();return s(d.current,e)?d.current:(d.current=e,e)},p=b(h,f,f);return[m(()=>l.current?l.current(p):p,[p]),c((r,n)=>{a?e.setState(void 0,r,n):"function"==typeof t?e.setState(t(e.getState()),r,n):e.setState(t,r,n)},[e,t])]}(r,n?void 0:e,n?{...t,enabled:!1,transformer:void 0}:t),a=function(e,t,r){let n=r.mode??"sync",i=r.enabled??!0,a=r.equalityFn??le,s=r.transformer,o=y(s);o.current=s;let l=y(t);l.current=t;let u=t.map((e,t)=>"function"==typeof e?`fn_${t}`:e).join("|"),d=y(null),h=m(()=>function(e,t,r,n={}){let{equalityFn:i=le}=n;return()=>{let n=t.current,a=n.some(e=>"function"==typeof e)?e.getState():void 0,s=n.map(t=>"function"==typeof t?j(a,t(a)):e.getPath(t)),o=r.current;return null!==o&&i(o,s)?o:(r.current=s,s)}}(e,l,d,{equalityFn:a}),[e,u,a]),f=function(e,t,r,n,i){return m(()=>r=>{if(!n||"mount"===i)return()=>{};let a=t.current;if(a.some(e=>"function"==typeof e))return e.subscribe(r);let s=a.map(t=>e.subscribePath(t,r));return()=>s.forEach(e=>e())},[e,r,n,i])}(e,l,u,i,n),p=function(e,t,r,n){let i=c(()=>{if(!r){let e=n.current??t();return n.current=e,e}return t()},[r,t,n]);return b(e,i,i)}(f,h,i,d);return[m(()=>o.current?o.current(p):p,[p]),...ce(e,l,u)]}(r,n?e:pe,n?t:{...t,enabled:!1,transformer:void 0});return n?a:i}(e,t)},useStoreSync:function(e,t,r){fe(e,t,r)},useStoreGetter:function(e,t){return function(e,t){let r="string"==typeof e?e:void 0,n=Array.isArray(e)?e:void 0,i="object"!=typeof e||Array.isArray(e)?t:e,a=ue(i?.store,"useStoreGetter",i?.storeId),s=n?.map(e=>"function"==typeof e?e.toString():e).join("|");return m(()=>{if(n)return n.map(e=>(t,r)=>{let n="function"==typeof e?e(a.getState()):j(a.getState(),e);if(void 0!==t){let e=j(n,t);return void 0===e&&void 0!==r?r:e}return void 0===n&&void 0!==r?r:n});if(void 0!==r){let e=a.withBase(r);return(t,r)=>void 0===t?void 0===r?e.getState():e.getState(r):void 0===r?e.getPath(t):e.getPath(t,r)}return(e,t)=>{let r=a.getState();if(void 0!==e){let n=j(r,e);return void 0===n&&void 0!==t?t:n}return r}},[a,r,s])}(e,t)},useStoreSetter:function(e,t){return function(e,t){let r="string"==typeof e?e:void 0,n="object"==typeof e?e:t,i=ue(n?.store,"useStoreSetter",n?.storeId);return m(()=>void 0===r?i.setState:i.withBase(r).setState,[i,r])}(e,t)}});function ye(e){return ue(void 0,"useStoreById",e)}var{useStore:ge,useStoreSync:be,useStoreGetter:we,useStoreSetter:ve}=me(),{useStore:xe,useStoreSync:ke,useStoreGetter:Se,useStoreSetter:Me}=me(),{useStore:Ae,useStoreSync:Pe,useStoreGetter:Te,useStoreSetter:_e}=me();function Ne(e){if("string"==typeof e||"number"==typeof e){let t=String(e);return""===t?null:/^[a-zA-Z0-9_-]+$/.test(t)||/^\d+$/.test(t)?t:null}return null}function De(e,t=!0){return e?"string"==typeof e?function(e,t){if(!e||e.startsWith(".")||e.endsWith(".")||/[^a-zA-Z0-9_.[\]-]/.test(e)||t&&(/\.\.|(\[\])/g.test(e)||(e.match(/\[/g)||[]).length!==(e.match(/\]/g)||[]).length||/\][^.[]/.test(e)))return[];let r,n=[],i=/([^.[\]]+)|\[(\d+)\]/g;for(;r=i.exec(e);)if(r[1]){if(!t&&""===r[1])continue;let e=Ne(r[1]);if(null!==e)n.push(e);else if(t)return[]}else if(r[2]){let e=Ne(r[2]);if(null!==e)n.push(e);else if(t)return[]}return n.length?n:[]}(e,t):Array.isArray(e)?function(e,t){if(!Array.isArray(e))return[];let r=[];for(let n of e){let e=Ne(n);if(null!==e)r.push(e);else if(t)return[]}return r}(e,t):[]:[]}function je(e,t,r){if(null==e||!t)return r;let n=De(t);if(!n.length)return r;let i=e;for(let a of n){if("object"!=typeof i||!i)return r;i=Array.isArray(i)?i[Number(a)]:i[a]}return void 0===i?r:i}function Ce(e,t,r){let n=De(t);if(!n.length)return e;let i=e;for(let s=0;s<n.length-1;s++){let t=n[s],r=n[s+1];if("object"!=typeof i||!i)return e;let a=i;(null==a[t]||"object"!=typeof a[t])&&(a[t]=/^\d+$/.test(r)?[]:{}),i=a[t]}let a=n[n.length-1];return"object"==typeof i&&i&&(i[a]=r),e}function Oe(e,t=/* @__PURE__ */new WeakMap){if("object"!=typeof e||!e)return e;if(t.has(e))return t.get(e);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){let r=/* @__PURE__ */new Map;return t.set(e,r),e.forEach((e,n)=>r.set(n,Oe(e,t))),r}if(e instanceof Set){let r=/* @__PURE__ */new Set;return t.set(e,r),e.forEach(e=>r.add(Oe(e,t))),r}if(ArrayBuffer.isView(e)){if(e instanceof DataView){let r=new DataView(Oe(e.buffer,t),e.byteOffset,e.byteLength);return t.set(e,r),r}let r=new(0,e.constructor)(e.buffer.slice(0),e.byteOffset,e.length);return t.set(e,r),r}if(e instanceof ArrayBuffer){let r=e.slice(0);return t.set(e,r),r}if(Array.isArray(e)){let r=[];return t.set(e,r),e.forEach((e,n)=>r[n]=Oe(e,t)),r}let r=Object.getPrototypeOf(e),n=Object.create(r);t.set(e,n);for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=Oe(e[i],t));return n}var We=e=>Object.assign(Object.create(Object.getPrototypeOf(e)),e);function Ee(e,t){let r=De(t),n=Array.isArray(e)?[...e]:We(e);if(!r.length)return n;let i=e,a=n;for(let s=0;s<r.length;s++){let e=r[s],t=i?.[e];if(!t||"object"!=typeof t){a[e]=t;break}let n=Array.isArray(t)?[...t]:We(t);a[e]=n,i=t,a=n}return n}function $e(e,t){if(null===e)return!1;let r=De(t),n=e;for(let i of r){if(null==n||!(i in n))return!1;n=n[i]}return!0}function Fe(e,t){let r=Array.isArray(t)?t:t?[t]:[];if(0===r.length)return{...e};let n=[],i=[];for(let s of r){let e=De(s);0!==e.length&&(1===e.length?n.push(e[0]):i.push(s))}let a=e;if(n.length){let e;for(let t of n)Object.prototype.hasOwnProperty.call(a,t)&&(e??=We(a),delete e[t]);e&&(a=e)}for(let s of i){let e=De(s);if(!$e(a,s))continue;let t=Ee(a,s),r=t;for(let n=0;n<e.length-1&&r&&"object"==typeof r;n++)r=r[e[n]];if(r&&"object"==typeof r){let t=e[e.length-1];Object.prototype.hasOwnProperty.call(r,t)&&delete r[t]}a=t}return a}Math.pow(10,8);var ze=6048e5,Ie=6e4,Ye=36e5,He=Symbol.for("constructDateFrom");function qe(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&He in e?e[He](t):e instanceof Date?new e.constructor(t):new Date(t)}function Le(e,t){return qe(t||e,e)}function Be(e,t,r){const n=Le(e,r?.in);return isNaN(t)?qe(r?.in||e,NaN):t?(n.setDate(n.getDate()+t),n):n}var Ue={};function Ve(){return Ue}function Re(e,t){const r=Ve(),n=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,i=Le(e,t?.in),a=i.getDay(),s=(a<n?7:0)+a-n;return i.setDate(i.getDate()-s),i.setHours(0,0,0,0),i}function Xe(e,t){return Re(e,{...t,weekStartsOn:1})}function Ze(e,t){const r=Le(e,t?.in),n=r.getFullYear(),i=qe(r,0);i.setFullYear(n+1,0,4),i.setHours(0,0,0,0);const a=Xe(i),s=qe(r,0);s.setFullYear(n,0,4),s.setHours(0,0,0,0);const o=Xe(s);return r.getTime()>=a.getTime()?n+1:r.getTime()>=o.getTime()?n:n-1}function Qe(e){const t=Le(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function Ge(e,...t){const r=qe.bind(null,e||t.find(e=>"object"==typeof e));return t.map(r)}function Je(e,t){const r=Le(e,t?.in);return r.setHours(0,0,0,0),r}function Ke(e,t){const r=+Le(e)-+Le(t);return r<0?-1:r>0?1:r}function et(e){return!(!((t=e)instanceof Date||"object"==typeof t&&"[object Date]"===Object.prototype.toString.call(t))&&"number"!=typeof e||isNaN(+Le(e)));var t}function tt(e,t){return+Le(e)-+Le(t)}function rt(e,t,r){const[n,i,a]=Ge(r?.in,e,e,t),s=Ke(i,a),o=Math.abs(function(e,t){const[r,n]=Ge(void 0,e,t);return 12*(r.getFullYear()-n.getFullYear())+(r.getMonth()-n.getMonth())}(i,a));if(o<1)return 0;1===i.getMonth()&&i.getDate()>27&&i.setDate(30),i.setMonth(i.getMonth()-s*o);let l=Ke(i,a)===-s;(function(e,t){const r=Le(e,t?.in);return+function(e,t){const r=Le(e,t?.in);return r.setHours(23,59,59,999),r}(r,t)===+function(e,t){const r=Le(e,t?.in),n=r.getMonth();return r.setFullYear(r.getFullYear(),n+1,0),r.setHours(23,59,59,999),r}(r,t)})(n)&&1===o&&1===Ke(n,a)&&(l=!1);const u=s*(o-+l);return 0===u?0:u}var nt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function it(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}var at={date:it({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:it({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:it({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},st={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function ot(e){return(t,r)=>{let n;if("formatting"===(r?.context?String(r.context):"standalone")&&e.formattingValues){const t=e.defaultFormattingWidth||e.defaultWidth,i=r?.width?String(r.width):t;n=e.formattingValues[i]||e.formattingValues[t]}else{const t=e.defaultWidth,i=r?.width?String(r.width):e.defaultWidth;n=e.values[i]||e.values[t]}return n[e.argumentCallback?e.argumentCallback(t):t]}}function lt(e){return(t,r={})=>{const n=r.width,i=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],a=t.match(i);if(!a)return null;const s=a[0],o=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(o)?function(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}(o,e=>e.test(s)):function(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}(o,e=>e.test(s));let u;return u=e.valueCallback?e.valueCallback(l):l,u=r.valueCallback?r.valueCallback(u):u,{value:u,rest:t.slice(s.length)}}}function ut(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const i=n[0],a=t.match(e.parsePattern);if(!a)return null;let s=e.valueCallback?e.valueCallback(a[0]):a[0];return s=r.valueCallback?r.valueCallback(s):s,{value:s,rest:t.slice(i.length)}}}var ct={code:"en-US",formatDistance:(e,t,r)=>{let n;const i=nt[e];return n="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n},formatLong:at,formatRelative:(e,t,r,n)=>st[e],localize:{ordinalNumber:(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},era:ot({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:ot({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:ot({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:ot({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:ot({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:ut({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:lt({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:lt({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:lt({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:lt({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:lt({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};function dt(e,t){const r=Le(e,t?.in),n=+Xe(r)-+function(e,t){const r=Ze(e,t),n=qe(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),Xe(n)}(r);return Math.round(n/ze)+1}function ht(e,t){const r=Le(e,t?.in),n=r.getFullYear(),i=Ve(),a=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,s=qe(t?.in||e,0);s.setFullYear(n+1,0,a),s.setHours(0,0,0,0);const o=Re(s,t),l=qe(t?.in||e,0);l.setFullYear(n,0,a),l.setHours(0,0,0,0);const u=Re(l,t);return+r>=+o?n+1:+r>=+u?n:n-1}function ft(e,t){const r=Le(e,t?.in),n=+Re(r,t)-+function(e,t){const r=Ve(),n=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,i=ht(e,t),a=qe(t?.in||e,0);return a.setFullYear(i,0,n),a.setHours(0,0,0,0),Re(a,t)}(r,t);return Math.round(n/ze)+1}function pt(e,t){return(e<0?"-":"")+Math.abs(e).toString().padStart(t,"0")}var mt={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return pt("yy"===t?n%100:n,t.length)},M(e,t){const r=e.getMonth();return"M"===t?String(r+1):pt(r+1,2)},d:(e,t)=>pt(e.getDate(),t.length),a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];default:return"am"===r?"a.m.":"p.m."}},h:(e,t)=>pt(e.getHours()%12||12,t.length),H:(e,t)=>pt(e.getHours(),t.length),m:(e,t)=>pt(e.getMinutes(),t.length),s:(e,t)=>pt(e.getSeconds(),t.length),S(e,t){const r=t.length,n=e.getMilliseconds();return pt(Math.trunc(n*Math.pow(10,r-3)),t.length)}},yt={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if("yo"===t){const t=e.getFullYear(),n=t>0?t:1-t;return r.ordinalNumber(n,{unit:"year"})}return mt.y(e,t)},Y:function(e,t,r,n){const i=ht(e,n),a=i>0?i:1-i;return"YY"===t?pt(a%100,2):"Yo"===t?r.ordinalNumber(a,{unit:"year"}):pt(a,t.length)},R:function(e,t){return pt(Ze(e),t.length)},u:function(e,t){return pt(e.getFullYear(),t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return pt(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return pt(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return mt.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return pt(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const i=ft(e,n);return"wo"===t?r.ordinalNumber(i,{unit:"week"}):pt(i,t.length)},I:function(e,t,r){const n=dt(e);return"Io"===t?r.ordinalNumber(n,{unit:"week"}):pt(n,t.length)},d:function(e,t,r){return"do"===t?r.ordinalNumber(e.getDate(),{unit:"date"}):mt.d(e,t)},D:function(e,t,r){const n=function(e,t){const r=Le(e,t?.in);return function(e,t){const[r,n]=Ge(void 0,e,t),i=Je(r),a=Je(n),s=+i-Qe(i),o=+a-Qe(a);return Math.round((s-o)/864e5)}(r,function(e){const t=Le(e,void 0);return t.setFullYear(t.getFullYear(),0,1),t.setHours(0,0,0,0),t}(r))+1}(e);return"Do"===t?r.ordinalNumber(n,{unit:"dayOfYear"}):pt(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const i=e.getDay(),a=(i-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(a);case"ee":return pt(a,2);case"eo":return r.ordinalNumber(a,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const i=e.getDay(),a=(i-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(a);case"cc":return pt(a,t.length);case"co":return r.ordinalNumber(a,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),i=0===n?7:n;switch(t){case"i":return String(i);case"ii":return pt(i,t.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let i;switch(i=12===n?"noon":0===n?"midnight":n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(i,{width:"narrow",context:"formatting"});default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let i;switch(i=n>=17?"evening":n>=12?"afternoon":n>=4?"morning":"night",t){case"B":case"BB":case"BBB":return r.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(i,{width:"narrow",context:"formatting"});default:return r.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,r){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),r.ordinalNumber(t,{unit:"hour"})}return mt.h(e,t)},H:function(e,t,r){return"Ho"===t?r.ordinalNumber(e.getHours(),{unit:"hour"}):mt.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return"Ko"===t?r.ordinalNumber(n,{unit:"hour"}):pt(n,t.length)},k:function(e,t,r){let n=e.getHours();return 0===n&&(n=24),"ko"===t?r.ordinalNumber(n,{unit:"hour"}):pt(n,t.length)},m:function(e,t,r){return"mo"===t?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):mt.m(e,t)},s:function(e,t,r){return"so"===t?r.ordinalNumber(e.getSeconds(),{unit:"second"}):mt.s(e,t)},S:function(e,t){return mt.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(0===n)return"Z";switch(t){case"X":return bt(n);case"XXXX":case"XX":return wt(n);default:return wt(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return bt(n);case"xxxx":case"xx":return wt(n);default:return wt(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+gt(n,":");default:return"GMT"+wt(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+gt(n,":");default:return"GMT"+wt(n,":")}},t:function(e,t,r){return pt(Math.trunc(+e/1e3),t.length)},T:function(e,t,r){return pt(+e,t.length)}};function gt(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),i=Math.trunc(n/60),a=n%60;return 0===a?r+String(i):r+String(i)+t+pt(a,2)}function bt(e,t){return e%60==0?(e>0?"-":"+")+pt(Math.abs(e)/60,2):wt(e,t)}function wt(e,t=""){const r=e>0?"-":"+",n=Math.abs(e);return r+pt(Math.trunc(n/60),2)+t+pt(n%60,2)}var vt=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},xt=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},kt={p:xt,P:(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],i=r[2];if(!i)return vt(e,t);let a;switch(n){case"P":a=t.dateTime({width:"short"});break;case"PP":a=t.dateTime({width:"medium"});break;case"PPP":a=t.dateTime({width:"long"});break;default:a=t.dateTime({width:"full"})}return a.replace("{{date}}",vt(n,t)).replace("{{time}}",xt(i,t))}},St=/^D+$/,Mt=/^Y+$/,At=["D","DD","YY","YYYY"];function Pt(e){return St.test(e)}function Tt(e){return Mt.test(e)}function _t(e,t,r){const n=function(e,t,r){const n="Y"===e[0]?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(e,t,r);if(At.includes(e))throw new RangeError(n)}var Nt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Dt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,jt=/^'([^]*?)'?$/,Ct=/''/g,Ot=/[a-zA-Z]/;function Wt(e,t,r){const n=Ve(),i=r?.locale??n.locale??ct,a=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,s=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,o=Le(e,r?.in);if(!et(o))throw new RangeError("Invalid time value");let l=t.match(Dt).map(e=>{const t=e[0];return"p"===t||"P"===t?(0,kt[t])(e,i.formatLong):e}).join("").match(Nt).map(e=>{if("''"===e)return{isToken:!1,value:"'"};const t=e[0];if("'"===t)return{isToken:!1,value:Et(e)};if(yt[t])return{isToken:!0,value:e};if(t.match(Ot))throw new RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});i.localize.preprocessor&&(l=i.localize.preprocessor(o,l));const u={firstWeekContainsDate:a,weekStartsOn:s,locale:i};return l.map(n=>{if(!n.isToken)return n.value;const a=n.value;return(!r?.useAdditionalWeekYearTokens&&Tt(a)||!r?.useAdditionalDayOfYearTokens&&Pt(a))&&_t(a,t,String(e)),(0,yt[a[0]])(o,a,i.localize,u)}).join("")}function Et(e){const t=e.match(jt);return t?t[1].replace(Ct,"'"):e}function $t(e,t){return function(e,t,r){const n=Ve(),i=r?.locale??n.locale??ct,a=Ke(e,t);if(isNaN(a))throw new RangeError("Invalid time value");const s=Object.assign({},r,{addSuffix:r?.addSuffix,comparison:a}),[o,l]=Ge(r?.in,...a>0?[t,e]:[e,t]),u=function(e,t,r){const n=tt(e,t)/1e3;return(i=r?.roundingMethod,e=>{const t=(i?Math[i]:Math.trunc)(e);return 0===t?0:t})(n);var i}(l,o),c=(Qe(l)-Qe(o))/1e3,d=Math.round((u-c)/60);let h;if(d<2)return r?.includeSeconds?u<5?i.formatDistance("lessThanXSeconds",5,s):u<10?i.formatDistance("lessThanXSeconds",10,s):u<20?i.formatDistance("lessThanXSeconds",20,s):u<40?i.formatDistance("halfAMinute",0,s):u<60?i.formatDistance("lessThanXMinutes",1,s):i.formatDistance("xMinutes",1,s):0===d?i.formatDistance("lessThanXMinutes",1,s):i.formatDistance("xMinutes",d,s);if(d<45)return i.formatDistance("xMinutes",d,s);if(d<90)return i.formatDistance("aboutXHours",1,s);if(d<1440){const e=Math.round(d/60);return i.formatDistance("aboutXHours",e,s)}if(d<2520)return i.formatDistance("xDays",1,s);if(d<43200){const e=Math.round(d/1440);return i.formatDistance("xDays",e,s)}if(d<86400)return h=Math.round(d/43200),i.formatDistance("aboutXMonths",h,s);if(h=rt(l,o),h<12){const e=Math.round(d/43200);return i.formatDistance("xMonths",e,s)}{const e=h%12,t=Math.trunc(h/12);return e<3?i.formatDistance("aboutXYears",t,s):e<9?i.formatDistance("overXYears",t,s):i.formatDistance("almostXYears",t+1,s)}}(e,function(e){return qe(e,Date.now())}(e),t)}var Ft=class{subPriority=0;validate(e,t){return!0}},zt=class extends Ft{constructor(e,t,r,n,i){super(),this.value=e,this.validateValue=t,this.setValue=r,this.priority=n,i&&(this.subPriority=i)}validate(e,t){return this.validateValue(e,this.value,t)}set(e,t,r){return this.setValue(e,t,this.value,r)}},It=class extends Ft{priority=10;subPriority=-1;constructor(e,t){super(),this.context=e||(e=>qe(t,e))}set(e,t){return t.timestampIsSet?e:qe(e,function(e,t){const r=function(e){return"function"==typeof e&&e.prototype?.constructor===e}(t)?new t(0):qe(t,0);return r.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),r.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),r}(e,this.context))}},Yt=class{run(e,t,r,n){const i=this.parse(e,t,r,n);return i?{setter:new zt(i.value,this.validate,this.set,this.priority,this.subPriority),rest:i.rest}:null}validate(e,t,r){return!0}},Ht=/^(1[0-2]|0?\d)/,qt=/^(3[0-1]|[0-2]?\d)/,Lt=/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,Bt=/^(5[0-3]|[0-4]?\d)/,Ut=/^(2[0-3]|[0-1]?\d)/,Vt=/^(2[0-4]|[0-1]?\d)/,Rt=/^(1[0-1]|0?\d)/,Xt=/^(1[0-2]|0?\d)/,Zt=/^[0-5]?\d/,Qt=/^[0-5]?\d/,Gt=/^\d/,Jt=/^\d{1,2}/,Kt=/^\d{1,3}/,er=/^\d{1,4}/,tr=/^-?\d+/,rr=/^-?\d/,nr=/^-?\d{1,2}/,ir=/^-?\d{1,3}/,ar=/^-?\d{1,4}/,sr=/^([+-])(\d{2})(\d{2})?|Z/,or=/^([+-])(\d{2})(\d{2})|Z/,lr=/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,ur=/^([+-])(\d{2}):(\d{2})|Z/,cr=/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/;function dr(e,t){return e?{value:t(e.value),rest:e.rest}:e}function hr(e,t){const r=t.match(e);return r?{value:parseInt(r[0],10),rest:t.slice(r[0].length)}:null}function fr(e,t){const r=t.match(e);if(!r)return null;if("Z"===r[0])return{value:0,rest:t.slice(1)};const n="+"===r[1]?1:-1,i=r[2]?parseInt(r[2],10):0,a=r[3]?parseInt(r[3],10):0,s=r[5]?parseInt(r[5],10):0;return{value:n*(i*Ye+a*Ie+1e3*s),rest:t.slice(r[0].length)}}function pr(e){return hr(tr,e)}function mr(e,t){switch(e){case 1:return hr(Gt,t);case 2:return hr(Jt,t);case 3:return hr(Kt,t);case 4:return hr(er,t);default:return hr(new RegExp("^\\d{1,"+e+"}"),t)}}function yr(e,t){switch(e){case 1:return hr(rr,t);case 2:return hr(nr,t);case 3:return hr(ir,t);case 4:return hr(ar,t);default:return hr(new RegExp("^-?\\d{1,"+e+"}"),t)}}function gr(e){switch(e){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;default:return 0}}function br(e,t){const r=t>0,n=r?t:1-t;let i;if(n<=50)i=e||100;else{const t=n+50;i=e+100*Math.trunc(t/100)-(e>=t%100?100:0)}return r?i:1-i}function wr(e){return e%400==0||e%4==0&&e%100!=0}var vr=[31,28,31,30,31,30,31,31,30,31,30,31],xr=[31,29,31,30,31,30,31,31,30,31,30,31];function kr(e,t,r){const n=Ve(),i=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,a=Le(e,r?.in),s=a.getDay(),o=7-i;return Be(a,t<0||t>6?t-(s+o)%7:((t%7+7)%7+o)%7-(s+o)%7,r)}var Sr={G:new class extends Yt{priority=140;parse(e,t,r){switch(t){case"G":case"GG":case"GGG":return r.era(e,{width:"abbreviated"})||r.era(e,{width:"narrow"});case"GGGGG":return r.era(e,{width:"narrow"});default:return r.era(e,{width:"wide"})||r.era(e,{width:"abbreviated"})||r.era(e,{width:"narrow"})}}set(e,t,r){return t.era=r,e.setFullYear(r,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["R","u","t","T"]},y:new class extends Yt{priority=130;incompatibleTokens=["Y","R","u","w","I","i","e","c","t","T"];parse(e,t,r){const n=e=>({year:e,isTwoDigitYear:"yy"===t});switch(t){case"y":return dr(mr(4,e),n);case"yo":return dr(r.ordinalNumber(e,{unit:"year"}),n);default:return dr(mr(t.length,e),n)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,r){const n=e.getFullYear();if(r.isTwoDigitYear){const t=br(r.year,n);return e.setFullYear(t,0,1),e.setHours(0,0,0,0),e}const i="era"in t&&1!==t.era?1-r.year:r.year;return e.setFullYear(i,0,1),e.setHours(0,0,0,0),e}},Y:new class extends Yt{priority=130;parse(e,t,r){const n=e=>({year:e,isTwoDigitYear:"YY"===t});switch(t){case"Y":return dr(mr(4,e),n);case"Yo":return dr(r.ordinalNumber(e,{unit:"year"}),n);default:return dr(mr(t.length,e),n)}}validate(e,t){return t.isTwoDigitYear||t.year>0}set(e,t,r,n){const i=ht(e,n);if(r.isTwoDigitYear){const t=br(r.year,i);return e.setFullYear(t,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),Re(e,n)}const a="era"in t&&1!==t.era?1-r.year:r.year;return e.setFullYear(a,0,n.firstWeekContainsDate),e.setHours(0,0,0,0),Re(e,n)}incompatibleTokens=["y","R","u","Q","q","M","L","I","d","D","i","t","T"]},R:new class extends Yt{priority=130;parse(e,t){return yr("R"===t?4:t.length,e)}set(e,t,r){const n=qe(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),Xe(n)}incompatibleTokens=["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"]},u:new class extends Yt{priority=130;parse(e,t){return yr("u"===t?4:t.length,e)}set(e,t,r){return e.setFullYear(r,0,1),e.setHours(0,0,0,0),e}incompatibleTokens=["G","y","Y","R","w","I","i","e","c","t","T"]},Q:new class extends Yt{priority=120;parse(e,t,r){switch(t){case"Q":case"QQ":return mr(t.length,e);case"Qo":return r.ordinalNumber(e,{unit:"quarter"});case"QQQ":return r.quarter(e,{width:"abbreviated",context:"formatting"})||r.quarter(e,{width:"narrow",context:"formatting"});case"QQQQQ":return r.quarter(e,{width:"narrow",context:"formatting"});default:return r.quarter(e,{width:"wide",context:"formatting"})||r.quarter(e,{width:"abbreviated",context:"formatting"})||r.quarter(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=1&&t<=4}set(e,t,r){return e.setMonth(3*(r-1),1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"]},q:new class extends Yt{priority=120;parse(e,t,r){switch(t){case"q":case"qq":return mr(t.length,e);case"qo":return r.ordinalNumber(e,{unit:"quarter"});case"qqq":return r.quarter(e,{width:"abbreviated",context:"standalone"})||r.quarter(e,{width:"narrow",context:"standalone"});case"qqqqq":return r.quarter(e,{width:"narrow",context:"standalone"});default:return r.quarter(e,{width:"wide",context:"standalone"})||r.quarter(e,{width:"abbreviated",context:"standalone"})||r.quarter(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=1&&t<=4}set(e,t,r){return e.setMonth(3*(r-1),1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"]},M:new class extends Yt{incompatibleTokens=["Y","R","q","Q","L","w","I","D","i","e","c","t","T"];priority=110;parse(e,t,r){const n=e=>e-1;switch(t){case"M":return dr(hr(Ht,e),n);case"MM":return dr(mr(2,e),n);case"Mo":return dr(r.ordinalNumber(e,{unit:"month"}),n);case"MMM":return r.month(e,{width:"abbreviated",context:"formatting"})||r.month(e,{width:"narrow",context:"formatting"});case"MMMMM":return r.month(e,{width:"narrow",context:"formatting"});default:return r.month(e,{width:"wide",context:"formatting"})||r.month(e,{width:"abbreviated",context:"formatting"})||r.month(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=11}set(e,t,r){return e.setMonth(r,1),e.setHours(0,0,0,0),e}},L:new class extends Yt{priority=110;parse(e,t,r){const n=e=>e-1;switch(t){case"L":return dr(hr(Ht,e),n);case"LL":return dr(mr(2,e),n);case"Lo":return dr(r.ordinalNumber(e,{unit:"month"}),n);case"LLL":return r.month(e,{width:"abbreviated",context:"standalone"})||r.month(e,{width:"narrow",context:"standalone"});case"LLLLL":return r.month(e,{width:"narrow",context:"standalone"});default:return r.month(e,{width:"wide",context:"standalone"})||r.month(e,{width:"abbreviated",context:"standalone"})||r.month(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=11}set(e,t,r){return e.setMonth(r,1),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","w","I","D","i","e","c","t","T"]},w:new class extends Yt{priority=100;parse(e,t,r){switch(t){case"w":return hr(Bt,e);case"wo":return r.ordinalNumber(e,{unit:"week"});default:return mr(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,r,n){return Re(function(e,t,r){const n=Le(e,r?.in),i=ft(n,r)-t;return n.setDate(n.getDate()-7*i),Le(n,r?.in)}(e,r,n),n)}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","i","t","T"]},I:new class extends Yt{priority=100;parse(e,t,r){switch(t){case"I":return hr(Bt,e);case"Io":return r.ordinalNumber(e,{unit:"week"});default:return mr(t.length,e)}}validate(e,t){return t>=1&&t<=53}set(e,t,r){return Xe(function(e,t,r){const n=Le(e,r?.in),i=dt(n,r)-t;return n.setDate(n.getDate()-7*i),n}(e,r))}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"]},d:new class extends Yt{priority=90;subPriority=1;parse(e,t,r){switch(t){case"d":return hr(qt,e);case"do":return r.ordinalNumber(e,{unit:"date"});default:return mr(t.length,e)}}validate(e,t){const r=wr(e.getFullYear()),n=e.getMonth();return r?t>=1&&t<=xr[n]:t>=1&&t<=vr[n]}set(e,t,r){return e.setDate(r),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","w","I","D","i","e","c","t","T"]},D:new class extends Yt{priority=90;subpriority=1;parse(e,t,r){switch(t){case"D":case"DD":return hr(Lt,e);case"Do":return r.ordinalNumber(e,{unit:"date"});default:return mr(t.length,e)}}validate(e,t){return wr(e.getFullYear())?t>=1&&t<=366:t>=1&&t<=365}set(e,t,r){return e.setMonth(0,r),e.setHours(0,0,0,0),e}incompatibleTokens=["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"]},E:new class extends Yt{priority=90;parse(e,t,r){switch(t){case"E":case"EE":case"EEE":return r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});case"EEEEE":return r.day(e,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});default:return r.day(e,{width:"wide",context:"formatting"})||r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,r,n){return(e=kr(e,r,n)).setHours(0,0,0,0),e}incompatibleTokens=["D","i","e","c","t","T"]},e:new class extends Yt{priority=90;parse(e,t,r,n){const i=e=>{const t=7*Math.floor((e-1)/7);return(e+n.weekStartsOn+6)%7+t};switch(t){case"e":case"ee":return dr(mr(t.length,e),i);case"eo":return dr(r.ordinalNumber(e,{unit:"day"}),i);case"eee":return r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});case"eeeee":return r.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"});default:return r.day(e,{width:"wide",context:"formatting"})||r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"})}}validate(e,t){return t>=0&&t<=6}set(e,t,r,n){return(e=kr(e,r,n)).setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"]},c:new class extends Yt{priority=90;parse(e,t,r,n){const i=e=>{const t=7*Math.floor((e-1)/7);return(e+n.weekStartsOn+6)%7+t};switch(t){case"c":case"cc":return dr(mr(t.length,e),i);case"co":return dr(r.ordinalNumber(e,{unit:"day"}),i);case"ccc":return r.day(e,{width:"abbreviated",context:"standalone"})||r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"});case"ccccc":return r.day(e,{width:"narrow",context:"standalone"});case"cccccc":return r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"});default:return r.day(e,{width:"wide",context:"standalone"})||r.day(e,{width:"abbreviated",context:"standalone"})||r.day(e,{width:"short",context:"standalone"})||r.day(e,{width:"narrow",context:"standalone"})}}validate(e,t){return t>=0&&t<=6}set(e,t,r,n){return(e=kr(e,r,n)).setHours(0,0,0,0),e}incompatibleTokens=["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"]},i:new class extends Yt{priority=90;parse(e,t,r){const n=e=>0===e?7:e;switch(t){case"i":case"ii":return mr(t.length,e);case"io":return r.ordinalNumber(e,{unit:"day"});case"iii":return dr(r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"}),n);case"iiiii":return dr(r.day(e,{width:"narrow",context:"formatting"}),n);case"iiiiii":return dr(r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"}),n);default:return dr(r.day(e,{width:"wide",context:"formatting"})||r.day(e,{width:"abbreviated",context:"formatting"})||r.day(e,{width:"short",context:"formatting"})||r.day(e,{width:"narrow",context:"formatting"}),n)}}validate(e,t){return t>=1&&t<=7}set(e,t,r){return(e=function(e,t,r){const n=Le(e,r?.in),i=t-function(e,t){const r=Le(e,t?.in).getDay();return 0===r?7:r}(n,r);return Be(n,i,r)}(e,r)).setHours(0,0,0,0),e}incompatibleTokens=["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"]},a:new class extends Yt{priority=80;parse(e,t,r){switch(t){case"a":case"aa":case"aaa":return r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"});case"aaaaa":return r.dayPeriod(e,{width:"narrow",context:"formatting"});default:return r.dayPeriod(e,{width:"wide",context:"formatting"})||r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,r){return e.setHours(gr(r),0,0,0),e}incompatibleTokens=["b","B","H","k","t","T"]},b:new class extends Yt{priority=80;parse(e,t,r){switch(t){case"b":case"bb":case"bbb":return r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"});case"bbbbb":return r.dayPeriod(e,{width:"narrow",context:"formatting"});default:return r.dayPeriod(e,{width:"wide",context:"formatting"})||r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,r){return e.setHours(gr(r),0,0,0),e}incompatibleTokens=["a","B","H","k","t","T"]},B:new class extends Yt{priority=80;parse(e,t,r){switch(t){case"B":case"BB":case"BBB":return r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"});case"BBBBB":return r.dayPeriod(e,{width:"narrow",context:"formatting"});default:return r.dayPeriod(e,{width:"wide",context:"formatting"})||r.dayPeriod(e,{width:"abbreviated",context:"formatting"})||r.dayPeriod(e,{width:"narrow",context:"formatting"})}}set(e,t,r){return e.setHours(gr(r),0,0,0),e}incompatibleTokens=["a","b","t","T"]},h:new class extends Yt{priority=70;parse(e,t,r){switch(t){case"h":return hr(Xt,e);case"ho":return r.ordinalNumber(e,{unit:"hour"});default:return mr(t.length,e)}}validate(e,t){return t>=1&&t<=12}set(e,t,r){const n=e.getHours()>=12;return n&&r<12?e.setHours(r+12,0,0,0):n||12!==r?e.setHours(r,0,0,0):e.setHours(0,0,0,0),e}incompatibleTokens=["H","K","k","t","T"]},H:new class extends Yt{priority=70;parse(e,t,r){switch(t){case"H":return hr(Ut,e);case"Ho":return r.ordinalNumber(e,{unit:"hour"});default:return mr(t.length,e)}}validate(e,t){return t>=0&&t<=23}set(e,t,r){return e.setHours(r,0,0,0),e}incompatibleTokens=["a","b","h","K","k","t","T"]},K:new class extends Yt{priority=70;parse(e,t,r){switch(t){case"K":return hr(Rt,e);case"Ko":return r.ordinalNumber(e,{unit:"hour"});default:return mr(t.length,e)}}validate(e,t){return t>=0&&t<=11}set(e,t,r){return e.getHours()>=12&&r<12?e.setHours(r+12,0,0,0):e.setHours(r,0,0,0),e}incompatibleTokens=["h","H","k","t","T"]},k:new class extends Yt{priority=70;parse(e,t,r){switch(t){case"k":return hr(Vt,e);case"ko":return r.ordinalNumber(e,{unit:"hour"});default:return mr(t.length,e)}}validate(e,t){return t>=1&&t<=24}set(e,t,r){const n=r<=24?r%24:r;return e.setHours(n,0,0,0),e}incompatibleTokens=["a","b","h","H","K","t","T"]},m:new class extends Yt{priority=60;parse(e,t,r){switch(t){case"m":return hr(Zt,e);case"mo":return r.ordinalNumber(e,{unit:"minute"});default:return mr(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,r){return e.setMinutes(r,0,0),e}incompatibleTokens=["t","T"]},s:new class extends Yt{priority=50;parse(e,t,r){switch(t){case"s":return hr(Qt,e);case"so":return r.ordinalNumber(e,{unit:"second"});default:return mr(t.length,e)}}validate(e,t){return t>=0&&t<=59}set(e,t,r){return e.setSeconds(r,0),e}incompatibleTokens=["t","T"]},S:new class extends Yt{priority=30;parse(e,t){return dr(mr(t.length,e),e=>Math.trunc(e*Math.pow(10,3-t.length)))}set(e,t,r){return e.setMilliseconds(r),e}incompatibleTokens=["t","T"]},X:new class extends Yt{priority=10;parse(e,t){switch(t){case"X":return fr(sr,e);case"XX":return fr(or,e);case"XXXX":return fr(lr,e);case"XXXXX":return fr(cr,e);default:return fr(ur,e)}}set(e,t,r){return t.timestampIsSet?e:qe(e,e.getTime()-Qe(e)-r)}incompatibleTokens=["t","T","x"]},x:new class extends Yt{priority=10;parse(e,t){switch(t){case"x":return fr(sr,e);case"xx":return fr(or,e);case"xxxx":return fr(lr,e);case"xxxxx":return fr(cr,e);default:return fr(ur,e)}}set(e,t,r){return t.timestampIsSet?e:qe(e,e.getTime()-Qe(e)-r)}incompatibleTokens=["t","T","X"]},t:new class extends Yt{priority=40;parse(e){return pr(e)}set(e,t,r){return[qe(e,1e3*r),{timestampIsSet:!0}]}incompatibleTokens="*"},T:new class extends Yt{priority=20;parse(e){return pr(e)}set(e,t,r){return[qe(e,r),{timestampIsSet:!0}]}incompatibleTokens="*"}},Mr=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Ar=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Pr=/^'([^]*?)'?$/,Tr=/''/g,_r=/\S/,Nr=/[a-zA-Z]/;function Dr(e){return e.match(Pr)[1].replace(Tr,"'")}function jr(e,t){const r=()=>qe(t?.in,NaN),n=t?.additionalDigits??2,i=function(e){const t={},r=e.split(Cr.dateTimeDelimiter);let n;if(r.length>2)return t;if(/:/.test(r[0])?n=r[0]:(t.date=r[0],n=r[1],Cr.timeZoneDelimiter.test(t.date)&&(t.date=e.split(Cr.timeZoneDelimiter)[0],n=e.substr(t.date.length,e.length))),n){const e=Cr.timezone.exec(n);e?(t.time=n.replace(e[1],""),t.timezone=e[1]):t.time=n}return t}(e);let a;if(i.date){const e=function(e,t){const r=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+t)+"})|(\\d{2}|[+-]\\d{"+(2+t)+"})$)"),n=e.match(r);if(!n)return{year:NaN,restDateString:""};const i=n[1]?parseInt(n[1]):null,a=n[2]?parseInt(n[2]):null;return{year:null===a?i:100*a,restDateString:e.slice((n[1]||n[2]).length)}}(i.date,n);a=function(e,t){if(null===t)/* @__PURE__ */return new Date(NaN);const r=e.match(Or);if(!r)/* @__PURE__ */return new Date(NaN);const n=!!r[4],i=$r(r[1]),a=$r(r[2])-1,s=$r(r[3]),o=$r(r[4]),l=$r(r[5])-1;if(n)return function(e,t,r){return t>=1&&t<=53&&r>=0&&r<=6}(0,o,l)?function(e,t,r){const n=/* @__PURE__ */new Date(0);n.setUTCFullYear(e,0,4);const i=7*(t-1)+r+1-(n.getUTCDay()||7);return n.setUTCDate(n.getUTCDate()+i),n}(t,o,l):/* @__PURE__ */new Date(NaN);{const e=/* @__PURE__ */new Date(0);return function(e,t,r){return t>=0&&t<=11&&r>=1&&r<=(zr[t]||(Ir(e)?29:28))}(t,a,s)&&function(e,t){return t>=1&&t<=(Ir(e)?366:365)}(t,i)?(e.setUTCFullYear(t,a,Math.max(i,s)),e):/* @__PURE__ */new Date(NaN)}}(e.restDateString,e.year)}if(!a||isNaN(+a))return r();const s=+a;let o,l=0;if(i.time&&(l=function(e){const t=e.match(Wr);if(!t)return NaN;const r=Fr(t[1]),n=Fr(t[2]),i=Fr(t[3]);return function(e,t,r){return 24===e?0===t&&0===r:r>=0&&r<60&&t>=0&&t<60&&e>=0&&e<25}(r,n,i)?r*Ye+n*Ie+1e3*i:NaN}(i.time),isNaN(l)))return r();if(!i.timezone){const e=new Date(s+l),r=Le(0,t?.in);return r.setFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),r.setHours(e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds(),e.getUTCMilliseconds()),r}return o=function(e){if("Z"===e)return 0;const t=e.match(Er);if(!t)return 0;const r="+"===t[1]?-1:1,n=parseInt(t[2]),i=t[3]&&parseInt(t[3])||0;return function(e,t){return t>=0&&t<=59}(0,i)?r*(n*Ye+i*Ie):NaN}(i.timezone),isNaN(o)?r():Le(s+l+o,t?.in)}var Cr={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Or=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Wr=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Er=/^([+-])(\d{2})(?::?(\d{2}))?$/;function $r(e){return e?parseInt(e):1}function Fr(e){return e&&parseFloat(e.replace(",","."))||0}var zr=[31,null,31,30,31,30,31,31,30,31,30,31];function Ir(e){return e%400==0||e%4==0&&e%100!=0}var Yr=e=>{let t;return t="number"==typeof e?e<1e12?/* @__PURE__ */new Date(1e3*e):new Date(e):"string"==typeof e?jr(e):e,Math.floor((r=t,+Le(r)/1e3)).toString();var r},Hr=e=>!("string"!=typeof e||!/^\d{4}-\d{2}-\d{2}$/.test(e))&&et(function(e,t,r,n){const i=()=>qe(n?.in||r,NaN),a=Object.assign({},Ve()),s=n?.locale??a.locale??ct,o=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??a.firstWeekContainsDate??a.locale?.options?.firstWeekContainsDate??1,l=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0;if(!t)return e?i():Le(r,n?.in);const u={firstWeekContainsDate:o,weekStartsOn:l,locale:s},c=[new It(n?.in,r)],d=t.match(Ar).map(e=>{const t=e[0];return t in kt?(0,kt[t])(e,s.formatLong):e}).join("").match(Mr),h=[];for(let y of d){!n?.useAdditionalWeekYearTokens&&Tt(y)&&_t(y,t,e),!n?.useAdditionalDayOfYearTokens&&Pt(y)&&_t(y,t,e);const r=y[0],a=Sr[r];if(a){const{incompatibleTokens:t}=a;if(Array.isArray(t)){const e=h.find(e=>t.includes(e.token)||e.token===r);if(e)throw new RangeError(`The format string mustn't contain \`${e.fullToken}\` and \`${y}\` at the same time`)}else if("*"===a.incompatibleTokens&&h.length>0)throw new RangeError(`The format string mustn't contain \`${y}\` and any other token at the same time`);h.push({token:r,fullToken:y});const n=a.run(e,y,s.match,u);if(!n)return i();c.push(n.setter),e=n.rest}else{if(r.match(Nr))throw new RangeError("Format string contains an unescaped latin alphabet character `"+r+"`");if("''"===y?y="'":"'"===r&&(y=Dr(y)),0!==e.indexOf(y))return i();e=e.slice(y.length)}}if(e.length>0&&_r.test(e))return i();const f=c.map(e=>e.priority).sort((e,t)=>t-e).filter((e,t,r)=>r.indexOf(e)===t).map(e=>c.filter(t=>t.priority===e).sort((e,t)=>t.subPriority-e.subPriority)).map(e=>e[0]);let p=Le(r,n?.in);if(isNaN(+p))return i();const m={};for(const y of f){if(!y.validate(p,u))return i();const e=y.set(p,m,u);Array.isArray(e)?(p=e[0],Object.assign(m,e[1])):p=e}return p}(e,"yyyy-MM-dd",/* @__PURE__ */new Date)),qr={},Lr=/* @__PURE__ */new Map,Br=a({});function Ur(e){return e&&(e.displayName||e.name)||"Component"}Br.displayName="ComponentContext";var Vr={};Object.freeze(Vr);var Rr=(e,t="",r=".",n=!1)=>e&&"object"==typeof e?Object.keys(e).reduce((i,a)=>{a=a.replaceAll(r,"").replaceAll(".","");let s=`${t}${t?r:""}${a}`;return"object"!=typeof e[a]||Array.isArray(e[a])&&n?[...i,s]:[...i,s,...Rr(e[a],s,r,n)]},[]):[],Xr=(e,t=!0,r=!0)=>{let n="",i="abcdefghijklmnopqrstuvwxyz";t&&(i=`ABCDEFGHIJKLMNOPQRSTUVWXYZ${i}`),r&&(i=`${i}0123456789`);let a=i.length;for(let s=0;s<e;s++)n+=i.charAt(Math.floor(Math.random()*a));return n};function Zr(e,t){if(!e)return 0;let r={};try{let t=e.split(".")[1],n=typeof window<"u"?window.atob(t):Buffer.from(t,"base64").toString();r=JSON.parse(n)}catch{return 0}return t?je(r,"data.spaceId",0):r}function Qr(e){!e&&typeof window<"u"&&(e=window.location.search);let t={};if(!e||0===e.length)return t;let r=e.replace("?","").split("&");for(let n=0;n<r.length;n++){let e=r[n].split("="),i=decodeURIComponent(e[0]),a=decodeURIComponent(e[1]);void 0===t[i]?t[i]=decodeURIComponent(a):"string"==typeof t[i]?t[i]=[t[i],decodeURIComponent(a)]:t[i].push(decodeURIComponent(a))}return t}var Gr=({url:e="",internalProps:t,autoRegister:r=!0,plitziJsxSkipHOC:n=!1,plitziJsxProps:a=Vr})=>{let{register:s}=u(Br),[o,c]=g(!1);h(()=>c(!0),[]);let d=m(()=>l(((e,t,r=!0,n=!1)=>async()=>{if(!Lr.get(e)){let t=(async e=>{try{let t=await fetch(e),r=new Blob([await t.text()],{type:"text/javascript"});return await(import(
|
|
2
|
-
/* @vite-ignore */
|
|
3
|
-
/* webpackIgnore: true */
|
|
4
|
-
URL.createObjectURL(r)))}catch(e){return}})(e).finally(()=>{Lr.delete(e)});Lr.set(e,{promise:t,timestamp:Date.now()})}let i=await(Lr.get(e)?.promise),[{default:a},{default:s},{nestedInject:o}]=await Promise.all([Promise.resolve().then(()=>Vs),import("./plitzi-sdk.js").then(e=>e.t),import("./plitzi-sdk.js").then(e=>e.n)]);if(!i)return{default:s};let{type:l,pluginSettings:u}=je(i,"default",{}),{version:c,initialItems:d,plugins:h}=i;if(!l)return{default:s};let f=i.default;return n||(f=a(i.default)),f.version=c,f.origin="remote",f.type=l,f.initialItems=d,f.pluginSettings=u,f.plugins=o(h,"remote"),r&&t(f),{default:f}})(e,s,r,n)),[e]);return o?/* @__PURE__ */w(i,n?{children:/* @__PURE__ */w(d,{internalProps:t,plitziJsxSkipHOC:n,...a})}:{children:/* @__PURE__ */w(d,{internalProps:t})}):null},Jr=({type:e,plugins:t})=>{let r=(e?t[e]:void 0)??((e,t)=>Object.values(e).find(e=>e.subPlugins.find(e=>e===t)))(t,e);if(!r)return;let n=je(r,"assets",[]).filter(e=>"script"===e.type);return{url:n.find(e=>e.isMain)?.params.src??je(n,"0.params.src","")}},Kr=({key:e,plitziElementLayout:t,type:r,internalProps:n,components:i,plugins:a})=>{let s={...n,plitziElementLayout:t},o=i.notFound?/* @__PURE__ */w(i.notFound,{internalProps:s},e):void 0;if(!r)return o;let l=i[r];if(l)/* @__PURE__ */return w(l,{internalProps:s,extraProps:l.extraProps},e);let u=Jr({type:r,plugins:a});return u?/* @__PURE__ */w(Gr,{url:u.url,internalProps:s},e):o},en=e=>{let t={};for(let r of e.split(";")){let e=r.indexOf(":");if(-1===e)continue;let n=r.slice(0,e).trim(),i=r.slice(e+1).trim();if(n&&i){let e=n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase());t[e]=i}}return t},tn=({id:e,children:t})=>{let[r]=g(()=>{if(typeof document>"u")return null;let t=document.querySelector(`[data-rsc-id="${e}"]`);if(!t)return null;let r={};for(let e=0;e<t.attributes.length;e++){let{name:n,value:i}=t.attributes[e];"class"!==n&&"style"!==n&&"data-rsc-id"!==n&&(r[n]=i)}let n=t.getAttribute("style");return{tag:t.tagName.toLowerCase(),className:t.className,style:n?en(n):void 0,attrs:r,html:t.innerHTML}});return r?s(r.tag,{"data-rsc-id":e,className:r.className||void 0,style:r.style,...r.attrs,dangerouslySetInnerHTML:{__html:r.html}}):t},rn=Symbol("twigArrowParams"),nn=(e,t)=>e===t?0:null==e?-1:null==t?1:"number"==typeof e&&"number"==typeof t?e-t:String(e).localeCompare(String(t)),an=e=>null==e?"":String(e),sn=e=>"object"==typeof e&&!!e&&"__PLITZI_RAW__"===e.__marker,on=e=>sn(e)?e.__raw:e,ln={raw:e=>(e=>({__raw:e,__marker:"__PLITZI_RAW__"}))(e),to_json:e=>"object"==typeof e&&e?JSON.stringify(e):an(e),json_encode:e=>"object"==typeof e&&e?JSON.stringify(e):an(e),object_as_json:e=>"object"==typeof e&&e?JSON.stringify(e):e,default:(e,t)=>(e=>null==e||""===e)(e)?t[0]:e,upper:e=>"string"==typeof e?e.toUpperCase():e,lower:e=>"string"==typeof e?e.toLowerCase():e,trim:e=>"string"==typeof e?e.trim():e,capitalize:e=>"string"==typeof e&&e.length>0?e[0].toUpperCase()+e.slice(1).toLowerCase():e,title:e=>"string"==typeof e?e.replace(/\b\w/g,e=>e.toUpperCase()):e,camelize:e=>"string"==typeof e?e.replace(/[-_]+(.)?/g,(e,t)=>t?t.toUpperCase():""):e,kebab:e=>"string"==typeof e?e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase():e,snake:e=>"string"==typeof e?e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[\s-]+/g,"_").toLowerCase():e,ltrim:e=>"string"==typeof e?e.trimStart():e,rtrim:e=>"string"==typeof e?e.trimEnd():e,pad:(e,t)=>{if("string"!=typeof e)return e;let r=Number(t[0])||0,n=t.length>1?an(t[1]):" ";if(""===n)return e;let i=r-e.length;if(i<=0)return e;let a=Math.ceil(i/n.length);return n.repeat(a).slice(0,i)+e},padRight:(e,t)=>{if("string"!=typeof e)return e;let r=Number(t[0])||0,n=t.length>1?an(t[1]):" ";if(""===n)return e;let i=r-e.length;if(i<=0)return e;let a=Math.ceil(i/n.length);return e+n.repeat(a).slice(0,i)},number:(e,t)=>{if("number"==typeof e){let r=Number(t[0])||0;return e.toFixed(r)}if("string"!=typeof e)return e;let r=e.match(/-?\d+(?:\.\d+)?/);return r?Number(r[0]):0},replace:(e,t)=>"string"!=typeof e||0===t.length?e:e.split(an(t[0])).join(an(t[1])),slice:(e,t)=>{if(0===t.length)return e;let r=Number(t[0])||0,n=t.length>1&&Number.isFinite(Number(t[1]))?r+Number(t[1]):void 0;return"string"==typeof e||Array.isArray(e)?e.slice(r,n):e},split:(e,t)=>"string"==typeof e&&t.length>0?e.split(an(t[0])):e,join:(e,t)=>Array.isArray(e)?e.join(0===t.length?"":an(t[0])):e,reverse:e=>"string"==typeof e?e.split("").reverse().join(""):Array.isArray(e)?[...e].reverse():e,length:e=>"string"==typeof e||Array.isArray(e)?e.length:"number"==typeof e?an(e).length:"object"==typeof e&&e?Object.keys(e).length:0,first:e=>"string"==typeof e?e.length>0?e[0]:"":Array.isArray(e)?e.length>0?e[0]:void 0:e,last:e=>"string"==typeof e?e.length>0?e[e.length-1]:"":Array.isArray(e)?e.length>0?e[e.length-1]:void 0:e,contains:(e,t)=>{if(0===t.length)return!1;let r=t[0];return"string"==typeof e?e.includes(an(r)):!!Array.isArray(e)&&e.includes(r)},startswith:(e,t)=>"string"==typeof e&&t.length>0&&e.startsWith(an(t[0])),endswith:(e,t)=>"string"==typeof e&&t.length>0&&e.endsWith(an(t[0])),number_format:(e,t)=>{if("number"!=typeof e)return e;let r=Number(t[0])||0,n=null==t[1]?".":an(t[1]),i=null==t[2]?"":an(t[2]),a=e.toFixed(r);if(""===i)return a.replace(".",n);let s=a.split(".");return s[0]=s[0].replace(/\B(?=(\d{3})+(?!\d))/g,i),s.join(n)},sort:(e,t)=>{if(!Array.isArray(e))return e;let r=[...e],n=t[0];if("function"==typeof n){let e=n;return(e[rn]??1)>=2?r.sort((t,r)=>Number(e(t,r))):r.sort((t,r)=>nn(e(t),e(r)))}return r.sort(nn)},batch:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let r=Number(t[0]);if(r<=0)return e;let n=[];for(let i=0;i<e.length;i+=r)n.push(e.slice(i,i+r));return n},map:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let r=t[0];return"function"==typeof r?e.map((e,t)=>r(e,t)):e},reduce:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let r=t[0];if("function"!=typeof r)return e;let n=t[1],i=+(void 0===n),a=void 0===n?e[0]:n;for(let s=i;s<e.length;s++)a=r(a,e[s],s);return a},merge:(e,t)=>{if(0===t.length)return e;let r=t[0];return Array.isArray(e)&&Array.isArray(r)?[...e,...r]:"object"==typeof e&&e&&"object"==typeof r&&r&&!Array.isArray(r)?{...e,...r}:e},keys:e=>"object"==typeof e&&e&&!Array.isArray(e)?Object.keys(e):e,values:e=>"object"==typeof e&&e&&!Array.isArray(e)?Object.values(e):e,filter:(e,t)=>{if(!Array.isArray(e))return e;if(0===t.length)return e.filter(Boolean);let r=t[0];if("function"==typeof r)return e.filter((e,t)=>r(e,t));let n=an(r);return e.filter(e=>{if("object"==typeof e&&e){let t=e[n];return null!=t&&!1!==t&&""!==t}return!!e})},column:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let r=an(t[0]);return e.map(e=>"object"==typeof e&&e?e[r]:void 0)},url_encode:e=>"string"==typeof e?encodeURIComponent(e):"object"==typeof e&&e&&!Array.isArray(e)?new URLSearchParams(Object.fromEntries(Object.entries(e).map(([e,t])=>[e,an(t)]))).toString():e,nl2br:e=>"string"==typeof e?e.replace(/\n/g,"<br>"):e,striptags:(e,t)=>{if("string"!=typeof e)return e;let r=t.length>0?an(t[0]).trim():"";if(r){let t=r.split(/(?:\s*>\s*<\s*|<\s*|>\s*)/).filter(Boolean).map(e=>e.replace(/[/>]/g,"").trim());if(t.length>0){let r=RegExp(`<(?!/?(?:${t.join("|")})\\b)[^>]+>`,"gi");return e.replace(r,"").replace(/\s+/g," ").trim()}}return e.replace(/<[^>]+>/g,"").replace(/\s+/g," ").trim()},abs:e=>"number"==typeof e?Math.abs(e):e,round:(e,t)=>{if("number"!=typeof e)return e;let r=Number(t[0])||0,n=null==t[1]?"common":an(t[1]),i=10**r;return"ceil"===n?Math.ceil(e*i)/i:"floor"===n?Math.floor(e*i)/i:Math.round(e*i)/i},format:(e,t)=>{if("string"!=typeof e)return e;let r=0;return e.replace(/%s|%d|%f|%%/g,e=>{if("%%"===e)return"%";let n=t[r];return r++,void 0===n?e:"%d"===e?String(Math.floor(Number(n))):"%f"===e?String(Number(n)):an(n)})},spaceless:e=>"string"==typeof e?e.replace(/>\s+</g,"><").trim():e,random:e=>Array.isArray(e)?e.length>0?e[Math.floor(Math.random()*e.length)]:void 0:"string"==typeof e?e.length>0?e[Math.floor(Math.random()*e.length)]:"":"number"==typeof e?Math.floor(Math.random()*e):e,date:(e,t)=>{if(0===t.length)return e;let r=an(t[0]),n=e instanceof Date?e:new Date(String(e));if(Number.isNaN(n.getTime()))return"";let i=e=>String(e).padStart(2,"0"),a={Y:String(n.getFullYear()),m:i(n.getMonth()+1),d:i(n.getDate()),H:i(n.getHours()),i:i(n.getMinutes()),s:i(n.getSeconds()),l:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][n.getDay()],F:["January","February","March","April","May","June","July","August","September","October","November","December"][n.getMonth()],M:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][n.getMonth()]},s="";for(let o of r)s+=Object.prototype.hasOwnProperty.call(a,o)?a[o]:o;return s},base64_encode:e=>"string"==typeof e?(e=>{let t=(new TextEncoder).encode(e),r="";for(let n=0;n<t.length;n++)r+=String.fromCharCode(t[n]);return btoa(r)})(e):e,base64_decode:e=>"string"==typeof e?(e=>{let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return(new TextDecoder).decode(r)})(e):e,md5:e=>"string"==typeof e?(e=>{let t=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],r=/* @__PURE__ */new Uint32Array(64);for(let p=0;p<64;p++)r[p]=Math.floor(4294967296*Math.abs(Math.sin(p+1)));let n=(new TextEncoder).encode(e),i=8*n.length,a=1+(n.length+8>>6)<<6,s=new Uint8Array(a);s.set(n),s[n.length]=128;let o=new DataView(s.buffer);o.setUint32(a-8,i>>>0,!0),o.setUint32(a-4,Math.floor(i/4294967296)>>>0,!0);let l=1732584193,u=4023233417,c=2562383102,d=271733878,h=(e,t)=>e<<t|e>>>32-t;for(let p=0;p<a;p+=64){let e=/* @__PURE__ */new Uint32Array(16);for(let t=0;t<16;t++)e[t]=o.getUint32(p+4*t,!0);let n=l,i=u,a=c,s=d;for(let o=0;o<64;o++){let l,u;o<16?(l=i&a|~i&s,u=o):o<32?(l=s&i|~s&a,u=(5*o+1)%16):o<48?(l=i^a^s,u=(3*o+5)%16):(l=a^(i|~s),u=7*o%16),l=l+n+r[o]+e[u]|0,n=s,s=a,a=i,i=i+h(l,t[o])|0}l=l+n|0,u=u+i|0,c=c+a|0,d=d+s|0}let f=e=>{let t="";for(let r=0;r<4;r++)t+=(e>>>8*r&255).toString(16).padStart(2,"0");return t};return f(l)+f(u)+f(c)+f(d)})(e):e,without:(e,t)=>{if("object"!=typeof e||!e||Array.isArray(e))return e;let r=t.map(an),n={};for(let[i,a]of Object.entries(e))r.includes(i)||(n[i]=a);return n},only:(e,t)=>{if("object"!=typeof e||!e||Array.isArray(e))return e;let r=t.map(an),n={};for(let[i,a]of Object.entries(e))r.includes(i)&&(n[i]=a);return n},find:(e,t)=>{if(!Array.isArray(e)||0===t.length)return;let r=t[0];if("function"==typeof r)return e.find((e,t)=>r(e,t));if(t.length<2)return;let n=an(r),i=t[1];return e.find(e=>"object"==typeof e&&e?e[n]===i:e===i)},pluck:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let r=an(t[0]);return e.map(e=>"object"==typeof e&&e?e[r]:void 0)},unique:e=>Array.isArray(e)?[...new Set(e)]:e,flatten:e=>Array.isArray(e)?e.flat():e,sum:e=>Array.isArray(e)?e.reduce((e,t)=>e+("number"==typeof t?t:0),0):e,chunk:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let r=Number(t[0]);if(r<=0)return e;let n=[];for(let i=0;i<e.length;i+=r)n.push(e.slice(i,i+r));return n},index_by:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let r=an(t[0]),n={};for(let i of e)"object"==typeof i&&i&&(n[String(i[r]??"")]=i);return n},group_by:(e,t)=>{if(!Array.isArray(e)||0===t.length)return e;let r=an(t[0]),n={};for(let i of e)if("object"==typeof i&&i){let e=String(i[r]??"");n[e]=n[e]??[],n[e].push(i)}return n}},un=e=>!(null==e||!1===e||""===e||0===e||Array.isArray(e)&&0===e.length),cn=(e,t)=>"string"==typeof t?t.includes(String(e)):Array.isArray(t)?t.includes(e):!("object"!=typeof t||!t)&&String(e)in t,dn=[],hn=class e{variables;keepEmptyTokens;breakFlag=!1;continueFlag=!1;hasSet=!1;constructor(e,t=!1){this.variables={...e},this.keepEmptyTokens=t}evalNodes(e){let t=e.length;if(0===t)return"";if(1===t)return this.evalNode(e[0]);let r="";for(let n=0;n<t&&(r+=this.evalNode(e[n]),!this.breakFlag&&!this.continueFlag);n++);return r}evalNode(e){switch(e.type){case"text":return e.value;case"variable":return this.evalVariable(e);case"if":return this.evalIf(e);case"for":return this.evalFor(e);case"set":return this.evalSet(e);case"apply":return this.evalApply(e);case"break":return this.breakFlag=!0,"";case"continue":return this.continueFlag=!0,""}}evalVariable(e){let t=this.evalExpression(e.expression);return!this.keepEmptyTokens||null!=t&&""!==t?sn(t)?String(on(t)):"function"==typeof t?"":null!=t&&"object"!=typeof t?String(t):e.raw?null==t?"":String(t):"object"==typeof t&&t?JSON.stringify(t):"":e.source}evalIf(e){if(un(this.evalExpression(e.condition)))return this.evalNodes(e.body);for(let t of e.elseifClauses)if(un(this.evalExpression(t.condition)))return this.evalNodes(t.body);return e.elseBody?this.evalNodes(e.elseBody):""}evalFor(e){let t=this.evalExpression(e.collection);if(void 0!==e.source&&void 0===t)return e.source;let r,n=null;if(null!==e.keyVar){let i=(e=>"object"==typeof e&&e&&!Array.isArray(e)?Object.entries(e):null)(t);if(!i||0===i.length)return e.elseBody?this.evalNodes(e.elseBody):"";let a=i.length;n=Array(a),r=Array(a);for(let e=0;e<a;e++)n[e]=i[e][0],r[e]=i[e][1]}else{let n=(e=>Array.isArray(e)?e:"object"==typeof e&&e?Object.values(e):null)(t);if(!n||0===n.length)return e.elseBody?this.evalNodes(e.elseBody):"";r=n}return this.runLoop(e,r,n)}runLoop(e,t,r){let{valueVar:n,keyVar:i,body:a}=e,s=t.length,o=this.variables.loop,l={index:0,index0:0,first:!1,last:!1,length:s,revindex:0};this.variables.loop=l;let u="";for(let c=0;c<s;c++){if(l.index=c+1,l.index0=c,l.first=0===c,l.last=c===s-1,l.revindex=s-c,null!==r&&null!==i&&(this.variables[i]=r[c]),this.variables[n]=t[c],u+=this.evalNodes(a),this.breakFlag){this.breakFlag=!1;break}this.continueFlag&&=!1}return void 0===o?delete this.variables.loop:this.variables.loop=o,u}evalSet(e){return this.hasSet=!0,this.variables[e.name]=Array.isArray(e.value)?this.evalNodes(e.value):this.evalExpression(e.value),""}evalApply(e){let t=this.applyFilters(this.evalNodes(e.body),e.filters);return sn(t)?String(on(t)):"object"==typeof t&&t?JSON.stringify(t):null==t?"":String(t)}applyFilters(e,t){let r=e;for(let n of t){let e=ln[n.name];void 0!==e&&(r=e(r,0===n.args.length?dn:this.evalArgs(n.args)))}return r}evalArgs(e){let t=e.length,r=Array(t);for(let n=0;n<t;n++)r[n]=this.evalExpression(e[n]);return r}evalExpression(e){switch(e.type){case"literal":return e.value;case"array":{let t=e.elements,r=Array(t.length);for(let e=0;e<t.length;e++)r[e]=this.evalExpression(t[e]);return r}case"object":{let t={};for(let r of e.entries){let e=this.evalExpression(r.key);t["string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):""]=this.evalExpression(r.value)}return t}case"range":return this.evalRange(e.start,e.end);case"path":return this.resolvePath(e.segments);case"index":return this.resolveIndex(e.object,e.index);case"function":return this.evalFunction(e.name,e.args);case"filter":return this.applyFilters(this.evalExpression(e.subject),e.filters);case"concat":{let t=e.parts,r=t.length,n="";for(let e=0;e<r;e++){let r=this.evalExpression(t[e]);n+=null==r?"":String(r)}return n}case"unary":return"-"===e.operator?-Number(this.evalExpression(e.operand)):!un(this.evalExpression(e.operand));case"binary":return this.evalBinary(e.operator,e.left,e.right);case"default":return this.evalExpression(e.value)??this.evalExpression(e.defaultExpr);case"ternary":return un(this.evalExpression(e.condition))?this.evalExpression(e.trueExpr):this.evalExpression(e.falseExpr);case"arrow":return this.createArrowFunction(e.params,e.body)}}createArrowFunction(t,r){let n={...this.variables},i=this.keepEmptyTokens,a=(...a)=>{let s=new e(n,i);for(let e=0;e<t.length;e++)s.variables[t[e]]=a[e];return s.evalExpression(r)};return a[rn]=t.length,a}resolvePath(e){let t=e.length;if(0===t)return;let r=this.variables[e[0]];for(let n=1;n<t;n++){if(null==r)return;r=r[e[n]]}return r}resolveIndex(e,t){let r=this.evalExpression(e);if(null==r)return;let n=this.evalExpression(t);return null!=n?r[String(n)]:void 0}evalRange(e,t){let r=Number(this.evalExpression(e)),n=Number(this.evalExpression(t)),i=r<=n,a=1+(i?n-r:r-n),s=Array(a);for(let o=0;o<a;o++)s[o]=i?r+o:r-o;return s}evalFunction(e,t){let r=this.evalArgs(t);switch(e){case"cycle":{let e=r[0],t=r[1];return Array.isArray(e)&&"number"==typeof t?e[t%e.length]:""}case"max":return this.minMax(r,Math.max);case"min":return this.minMax(r,Math.min);case"range":return this.rangeFunction(r);default:return""}}minMax(e,t){return 0===e.length?void 0:t(...1===e.length&&Array.isArray(e[0])?e[0]:e)}rangeFunction(e){if(0===e.length)return[];if(1===e.length){let t=Number(e[0]),r=Array(t+1);for(let e=0;e<=t;e++)r[e]=e;return r}let t=Number(e[0]),r=Number(e[1]),n=e.length>2?Number(e[2]):t<=r?1:-1;if(0===n)return[];let i=Math.floor((n>0?r-t:t-r)/Math.abs(n))+1;if(i<=0)return[];let a=Array(i);for(let s=0;s<i;s++)a[s]=t+s*n;return a}evalBinary(e,t,r){if("or"===e)return un(this.evalExpression(t))||un(this.evalExpression(r));if("and"===e)return un(this.evalExpression(t))&&un(this.evalExpression(r));let n=this.evalExpression(t),i=this.evalExpression(r),a="number"==typeof n&&"number"==typeof i;switch(e){case"+":return a?n+i:Number(n)+Number(i);case"-":return a?n-i:Number(n)-Number(i);case"*":return a?n*i:Number(n)*Number(i);case"/":return a?n/i:Number(n)/Number(i);case"%":return a?n%i:Number(n)%Number(i);case"==":return n===i||String(n)===String(i);case"!=":return n!==i&&String(n)!==String(i);case">":return a?n>i:Number(n)>Number(i);case"<":return a?n<i:Number(n)<Number(i);case">=":return a?n>=i:Number(n)>=Number(i);case"<=":return a?n<=i:Number(n)<=Number(i);case"in":return cn(n,i);case"not in":return!cn(n,i);case"is":return n===i;case"is not":return n!==i;default:return!1}}},fn=(e,t)=>e[t],pn=(e,t)=>{let r=t.indexOf(".");if(-1===r)return e[t];let n=e[t.slice(0,r)],i=r+1,a=t.length;for(;i<a;){if(null==n)return;let e=t.indexOf(".",i);if(-1===e)return n[t.slice(i)];n=n[t.slice(i,e)],i=e+1}return n},mn=e=>null==e?"":"object"==typeof e?JSON.stringify(e):String(e),yn=e=>{try{return JSON.parse(e)||e}catch{return e}},gn=41,bn=e=>e>=97&&e<=122||e>=65&&e<=90||95===e,wn=e=>bn(e)||e>=48&&e<=57,vn=e=>wn(e)||45===e,xn=e=>e>=48&&e<=57,kn=e=>32===e||9===e||10===e||13===e,Sn=e=>{let t=e.length;if(0===t||!bn(e.charCodeAt(0)))return!1;for(let r=1;r<t;r++)if(!wn(e.charCodeAt(r)))return!1;return!0},Mn=e=>{let t=e.length;if(0===t||!bn(e.charCodeAt(0)))return!1;let r=!1,n=!1;for(let i=1;i<t;i++){let t=e.charCodeAt(i);if(46!==t){if(r){if(n=xn(t),!n&&!bn(t))return!1;r=!1}else if(n?!xn(t):!wn(t))return!1}else{if(r)return!1;r=!0,n=!1}}return!r},An=e=>Sn(e),Pn=(e,t)=>t?`{{{${e}}}}`:`{{${e}}}`,Tn=e=>{switch(e.type){case"text":return e.value;case"variable":return Pn(e.content,e.raw);case"tag":return`{%${e.content}%}`}},_n=class{src;pos=0;constructor(e){this.src=e}eof(){return this.pos>=this.src.length}peek(){return this.pos<this.src.length?this.src.charCodeAt(this.pos):-1}at(e){let t=this.pos+e;return t<this.src.length?this.src.charCodeAt(t):-1}skipWs(){for(;this.pos<this.src.length&&kn(this.src.charCodeAt(this.pos));)this.pos++}scanName(){let e=this.pos;if(!this.eof()&&bn(this.src.charCodeAt(this.pos)))for(this.pos++;!this.eof()&&vn(this.src.charCodeAt(this.pos));)this.pos++;return this.src.slice(e,this.pos)}scanIndex(){let e=this.pos;for(;!this.eof()&&xn(this.src.charCodeAt(this.pos));)this.pos++;return this.src.slice(e,this.pos)}scanStringLiteral(){let e=this.src.charCodeAt(this.pos);this.pos++;let t="";for(;this.pos<this.src.length&&this.src.charCodeAt(this.pos)!==e;)if(92===this.src.charCodeAt(this.pos)&&this.pos+1<this.src.length){this.pos++;let r=this.src.charCodeAt(this.pos);t+=110===r?"\n":116===r?"\t":114===r?"\r":92===r?"\\":r===e?String.fromCharCode(r):String.fromCharCode(92)+String.fromCharCode(r),this.pos++}else t+=this.src[this.pos],this.pos++;return this.pos<this.src.length&&this.pos++,t}scanNumber(){let e=this.pos;for(45===this.src.charCodeAt(this.pos)&&this.pos++;this.pos<this.src.length&&xn(this.src.charCodeAt(this.pos));)this.pos++;if(46===this.src.charCodeAt(this.pos))for(this.pos++;this.pos<this.src.length&&xn(this.src.charCodeAt(this.pos));)this.pos++;return Number(this.src.slice(e,this.pos))}matchKeyword(e){let t=this.pos+e.length;if(t>this.src.length)return!1;for(let r=0;r<e.length;r++)if(this.src.charCodeAt(this.pos+r)!==e.charCodeAt(r))return!1;return!(t<this.src.length&&wn(this.src.charCodeAt(t))||(this.pos=t,this.skipWs(),0))}matchBinaryOp(){this.skipWs();let e=this.peek();if(61===this.at(1)){if(61===e)return this.pos+=2,"==";if(33===e)return this.pos+=2,"!=";if(62===e)return this.pos+=2,">=";if(60===e)return this.pos+=2,"<="}return 62===e?(this.pos++,">"):60===e?(this.pos++,"<"):null}},Nn=e=>new Dn(e).parseTernary(),Dn=class extends _n{parseTernary(){let e=this.parseOr();if(this.skipWs(),63===this.peek()){this.pos++,this.skipWs();let t=this.parseOr();if(this.skipWs(),58===this.peek())return this.pos++,this.skipWs(),{type:"ternary",condition:e,trueExpr:t,falseExpr:this.parseTernary()}}return e}parseOr(){let e=this.parseAnd();for(this.skipWs();this.matchKeyword("or");)e={type:"binary",operator:"or",left:e,right:this.parseAnd()},this.skipWs();return e}parseAnd(){let e=this.parseNot();for(this.skipWs();this.matchKeyword("and");)e={type:"binary",operator:"and",left:e,right:this.parseNot()},this.skipWs();return e}parseNot(){return this.skipWs(),this.matchKeyword("not")?{type:"unary",operator:"not",operand:this.parseComparison()}:this.parseComparison()}parseComparison(){let e=this.parseConcat();for(this.skipWs();!this.eof();){if(this.matchKeyword("is")){this.skipWs(),e={type:"binary",operator:this.matchKeyword("not")?"is not":"is",left:e,right:this.parseConcat()},this.skipWs();continue}if(this.matchKeyword("not")){if(this.skipWs(),this.matchKeyword("in")){e={type:"binary",operator:"not in",left:e,right:this.parseConcat()},this.skipWs();continue}let t=this.src.slice(this.pos-4);return this.pos=this.src.length,{type:"unary",operator:"not",operand:Nn(t)}}if(this.matchKeyword("in")){e={type:"binary",operator:"in",left:e,right:this.parseConcat()},this.skipWs();continue}let t=this.matchBinaryOp();if(!t)break;e={type:"binary",operator:t,left:e,right:this.parseConcat()},this.skipWs()}return e}parseConcat(){let e=this.parseAdditive();for(this.skipWs();126===this.peek();){this.pos++;let t=this.parseAdditive();e="concat"===e.type?{type:"concat",parts:[...e.parts,t]}:{type:"concat",parts:[e,t]},this.skipWs()}return e}parseAdditive(){let e=this.parseMultiplicative();this.skipWs();for(let t=this.peek();43===t||45===t;t=this.peek())this.pos++,e={type:"binary",operator:43===t?"+":"-",left:e,right:this.parseMultiplicative()},this.skipWs();return e}parseMultiplicative(){let e=this.parseDefault();this.skipWs();for(let t=this.peek();42===t||47===t||37===t;t=this.peek())this.pos++,e={type:"binary",operator:42===t?"*":47===t?"/":"%",left:e,right:this.parseDefault()},this.skipWs();return e}parseDefault(){if(this.skipWs(),45===this.peek()&&xn(this.at(1)))return this.maybeTrailingFilters({type:"literal",value:this.scanNumber()});if(45===this.peek())return this.pos++,{type:"unary",operator:"-",operand:this.parseDefault()};let e=this.parseAtom();for(this.skipWs();63===this.peek()&&63===this.at(1);)this.pos+=2,this.skipWs(),e={type:"default",value:e,defaultExpr:this.parseAtom()},this.skipWs();return e}parseAtom(){this.skipWs();let e=this.peek();if(40===e){this.pos++,this.skipWs();let e=this.pos,t=this.tryParseArrowParams();if(null!==t)return this.maybeTrailingFilters({type:"arrow",params:t,body:this.parseTernary()});this.pos=e;let r=this.parseTernary();return this.skipWs(),this.peek()===gn&&this.pos++,this.maybeTrailingFilters(r)}return 39===e||34===e?this.maybeTrailingFilters({type:"literal",value:this.scanStringLiteral()}):xn(e)?this.maybeTrailingFilters({type:"literal",value:this.scanNumber()}):91===e?(this.pos++,this.maybeTrailingFilters({type:"array",elements:this.parseArgList(93)})):123===e?(this.pos++,this.maybeTrailingFilters(this.parseObjectLiteral())):this.parsePathOrFunctionOrArrow()}tryParseArrowParams(){let e=this.pos,t=[];for(this.skipWs();this.peek()!==gn;){let r=this.scanName();if(!r)return this.pos=e,null;if(t.push(r),this.skipWs(),44!==this.peek())break;this.pos++,this.skipWs()}return this.skipWs(),this.peek()===gn&&(this.pos++,this.skipWs(),61===this.peek()&&62===this.at(1))?(this.pos+=2,t):(this.pos=e,null)}parsePathOrFunctionOrArrow(){let e=this.scanName();if(!e)return this.pos++,{type:"literal",value:""};if("true"===e||"false"===e)return this.maybeTrailingFilters({type:"literal",value:"true"===e});if(this.skipWs(),61===this.peek()&&62===this.at(1))return this.pos+=2,this.maybeTrailingFilters({type:"arrow",params:[e],body:this.parseTernary()});if(40===this.peek()){this.pos++;let t=this.parseArgList(gn);return this.maybeTrailingFilters(this.parseAccessChain({type:"function",name:e,args:t},null))}let t=[e];return this.maybeTrailingFilters(this.parseAccessChain({type:"path",segments:t},t))}parseAccessChain(e,t){let r=e,n=t;for(;;){let e=this.peek();if(46===e){let e=this.pos;this.pos++;let t=this.scanName()||this.scanIndex();if(!t){this.pos=e;break}n?n.push(t):r={type:"index",object:r,index:{type:"literal",value:t}};continue}if(91!==e)break;this.pos++;let t=this.parseTernary();this.skipWs(),93===this.peek()&&this.pos++,n&&"literal"===t.type&&"boolean"!=typeof t.value?n.push(String(t.value)):(n&&=(r={type:"path",segments:n},null),r={type:"index",object:r,index:t})}return n?{type:"path",segments:n}:r}maybeTrailingFilters(e){return this.skipWs(),124===this.peek()?{type:"filter",subject:e,filters:this.parseTrailingFilters()}:e}parseObjectLiteral(){let e=[];for(this.skipWs();!this.eof()&&125!==this.peek();){let t=this.parseObjectKey();this.skipWs(),58===this.peek()&&this.pos++,this.skipWs(),e.push({key:t,value:this.parseTernary()}),this.skipWs(),44===this.peek()&&(this.pos++,this.skipWs())}return 125===this.peek()&&this.pos++,{type:"object",entries:e}}parseObjectKey(){let e=this.peek();if(39===e||34===e)return{type:"literal",value:this.scanStringLiteral()};if(xn(e))return{type:"literal",value:this.scanNumber()};if(40===e){this.pos++,this.skipWs();let e=this.parseTernary();return this.skipWs(),this.peek()===gn&&this.pos++,e}return{type:"literal",value:this.scanName()}}parseArgList(e){let t=[];for(this.skipWs();!this.eof()&&this.peek()!==e;)t.push(this.parseTernary()),this.skipWs(),44===this.peek()&&(this.pos++,this.skipWs());return this.peek()===e&&this.pos++,t}parseTrailingFilters(){let e=[];for(;124===this.peek();)this.pos++,this.skipWs(),e.push(this.readFilter()),this.skipWs();return e}parseApplyChain(){this.skipWs();let e=[this.readFilter()];for(this.skipWs();124===this.peek();)this.pos++,this.skipWs(),e.push(this.readFilter()),this.skipWs();return e}readFilter(){let e=this.scanName();return this.skipWs(),40===this.peek()?(this.pos++,{name:e,args:this.parseArgList(gn)}):{name:e,args:[]}}},jn=e=>{let t=0;for(;t<e.length&&!kn(e.charCodeAt(t));)t++;return e.slice(0,t)},Cn=(e,t=!1)=>{let r=new Wn(e,t),n=r.parseBody();if(!r.error){let e=r.peek();if(e&&"tag"===e.type){let t=jn(e.content.trim());On.has(t)&&(r.error=`Orphan closing tag: {% ${t} %} without matching opening tag`)}}return{nodes:n,error:r.error}},On=/* @__PURE__ */new Set(["endif","endfor","endset","endapply","else","elseif"]),Wn=class{tokens;keepEmptyTokens;pos=0;error=null;constructor(e,t=!1){this.tokens=e,this.keepEmptyTokens=t}peek(){return this.tokens[this.pos]}advance(){let e=this.tokens[this.pos];return e&&this.pos++,e}isTag(e){let t=this.peek();if(!t||"tag"!==t.type)return!1;let r=t.content.trim();return r===e||r.startsWith(e+" ")||r.startsWith(e+"\t")}parseBody(){let e=[];for(;this.pos<this.tokens.length;){let t=this.peek();if(!t||"tag"===t.type&&On.has(jn(t.content.trim())))break;let r=this.parseNode();r&&e.push(r)}return e}parseNode(){let e=this.peek();return e?"text"===e.type?(this.advance(),{type:"text",value:e.value}):"variable"===e.type?this.parseVariable():this.parseTag():null}parseVariable(){let e=this.advance();if(!e||"variable"!==e.type)return{type:"variable",raw:!1,expression:{type:"literal",value:""},source:""};let t=e.content.trim(),r=this.keepEmptyTokens?Pn(e.content,e.raw):"";if(Sn(t))return{type:"variable",raw:e.raw,expression:{type:"path",segments:[t]},source:r};let n=Nn(t);return{type:"variable",raw:e.raw,expression:n,source:r}}parseTag(){let e=this.peek();if(!e||"tag"!==e.type)return null;let t=e.content.trim();switch(jn(t)){case"if":return this.parseIf();case"for":return this.parseFor();case"set":return this.parseSet();case"apply":return this.parseApply();case"break":return this.advance(),{type:"break"};case"continue":return this.advance(),{type:"continue"};default:return this.advance(),null}}parseIf(){this.advance();let e=this.tokens[this.pos-1];if("tag"!==e.type)return this.error="Malformed {% if %} tag",{type:"if",condition:{type:"literal",value:!1},body:[],elseifClauses:[],elseBody:null};let t=e.content.trim(),r=-1===t.indexOf(" ")?"":t.slice(t.indexOf(" ")+1).trim();if(!r)return this.error="Malformed {% if %} tag: missing condition",{type:"if",condition:{type:"literal",value:!1},body:[],elseifClauses:[],elseBody:null};let n=Nn(r),i=this.parseBody(),a=[],s=null,o=!1;for(;this.peek();){let e=this.peek();if(!e||"tag"!==e.type)break;let t=jn(e.content.trim());if("elseif"===t){this.advance();let t=e.content.trim(),r=t.slice(t.indexOf(" ")+1).trim(),n=Nn(r),i=this.parseBody();a.push({condition:n,body:i})}else{if("else"!==t){if("endif"===t){this.advance(),o=!0;break}break}this.advance(),s=this.parseBody()}}return o||(this.error="Malformed {% if %} block: missing {% endif %}"),{type:"if",condition:n,body:i,elseifClauses:a,elseBody:s}}parseFor(){let e=this.pos;this.advance();let t=this.tokens[this.pos-1];if("tag"!==t.type)return{type:"for",valueVar:"_item",keyVar:null,collection:{type:"literal",value:""},body:[],elseBody:null};let r=t.content.trim(),n=r.slice(r.indexOf(" ")+1).trim(),i=/\sin\s/.exec(n);if(!i)return this.error="Invalid {% for %} syntax: missing the `in` keyword",{type:"for",valueVar:"_item",keyVar:null,collection:{type:"literal",value:""},body:[],elseBody:null};let a=n.slice(0,i.index).trim(),s=n.slice(i.index+i[0].length).trim(),o=(e=>{let t=0;for(let r=0;r+1<e.length;r++){let n=e.charCodeAt(r);if(0!==t)n===t&&(t=0);else if(39===n||34===n)t=n;else if(46===n&&46===e.charCodeAt(r+1))return[e.slice(0,r).trim(),e.slice(r+2).trim()]}return null})(s),l=o?{type:"range",start:Nn(o[0]),end:Nn(o[1])}:Nn(s),u=a.indexOf(","),c=-1===u?null:a.slice(0,u).trim(),d=-1===u?a:a.slice(u+1).trim();if(!An(d))return this.error=`Invalid {% for %} variable name: "${d}"`,{type:"for",valueVar:"_item",keyVar:null,collection:{type:"literal",value:""},body:[],elseBody:null};if(null!==c&&!An(c))return this.error=`Invalid {% for %} key variable name: "${c}"`,{type:"for",valueVar:"_item",keyVar:null,collection:{type:"literal",value:""},body:[],elseBody:null};let h=this.parseBody(),f=null;if(this.peek()){let e=this.peek();e&&"tag"===e.type&&"else"===jn(e.content.trim())&&(this.advance(),f=this.parseBody())}let p=this.peek();return p&&"tag"===p.type&&"endfor"===jn(p.content.trim())?this.advance():this.error="Malformed {% for %} block: missing {% endfor %}",{type:"for",valueVar:d,keyVar:c,collection:l,body:h,elseBody:f,source:this.keepEmptyTokens?this.reconstructRange(e,this.pos):void 0}}reconstructRange(e,t){let r="";for(let n=e;n<t;n++)r+=Tn(this.tokens[n]);return r}parseSet(){this.advance();let e=this.tokens[this.pos-1];if("tag"!==e.type)return{type:"set",name:"_unknown",value:{type:"literal",value:""}};let t=e.content.trim(),r=t.slice(t.indexOf(" ")+1).trim(),n=r.indexOf("=");if(-1===n){let e=r.trim(),t=this.parseBody(),n=this.peek();return n&&"tag"===n.type&&this.advance(),{type:"set",name:e,value:t}}let i=r.slice(0,n).trim(),a=r.slice(n+1).trim();return{type:"set",name:i,value:Nn(a)}}parseApply(){this.advance();let e=this.tokens[this.pos-1];if("tag"!==e.type)return{type:"apply",filters:[],body:[]};let t=e.content.trim(),r=(e=>new Dn(e).parseApplyChain())(t.slice(t.indexOf(" ")+1).trim()),n=this.parseBody(),i=this.peek();return i&&"tag"===i.type&&this.advance(),{type:"apply",filters:r,body:n}}},En=/* @__PURE__ */new Map,$n={hits:0,misses:0},Fn=e=>{let t=En.get(e);if(t)return $n.hits++,t;$n.misses++;let r=(e=>{let t=(e=>{let t=[],r=0;for(;r<e.length;){let n,i,a=e.indexOf("{{",r),s=e.indexOf("{%",r);if(-1===a&&-1===s)break;if(-1===a?(n=s,i=!0):-1===s||a<s?(n=a,i=!1):(n=s,i=!0),n>r&&t.push({type:"text",value:e.slice(r,n)}),i||123!==e.charCodeAt(n+2))if(i){let i=e.indexOf("%}",n+2);if(-1===i)return{tokens:t,error:"Unclosed tag"};t.push({type:"tag",content:e.slice(n+2,i)}),r=i+2}else{let i=e.indexOf("}}",n+2);if(-1===i)return{tokens:t,error:"Unclosed double-brace token"};t.push({type:"variable",content:e.slice(n+2,i),raw:!1}),r=i+2}else{let i=e.indexOf("}}}",n+3);if(-1===i)return{tokens:t,error:"Unclosed triple-brace token"};t.push({type:"variable",content:e.slice(n+3,i),raw:!0}),r=i+3}}return r<e.length&&t.push({type:"text",value:e.slice(r)}),{tokens:t,error:null}})(e);if(t.error)return null;let r=t.tokens,{hasTags:n,allSimpleOrDotted:i}=(e=>{let t=!1,r=!0;for(let n=0;n<e.length;n++){let i=e[n];if("tag"===i.type){t=!0;break}if("variable"===i.type&&!Mn(i.content.trim())){r=!1;break}}return{hasTags:t,allSimpleOrDotted:r}})(r),a=null,s=null;if(n||!i){let e=Cn(r,!1);if(e.error)return null;a=e.nodes;let t=Cn(r,!0);t.error||(s=t.nodes)}else{let e=Cn(r,!0);e.error||(s=e.nodes)}return{tokens:r,hasTags:n,allSimpleOrDotted:i,nodes:a,nodesWithSource:s}})(e);return r?((()=>{if(En.size>=256){let e=En.keys().next().value;void 0!==e&&En.delete(e)}})(),En.set(e,r),r):null},zn=(e,t={},r=!1,n=!1)=>{if("string"!=typeof e)return e;try{if(-1===e.indexOf("{%")&&-1===e.indexOf("{{"))return e;let i="variables"in t?(e=>{let t={},r=e.variables;for(let n in r)t[n]=r[n];for(let n in e)t[n]=e[n];return t})(t):t,a=Fn(e);if(!a)return e;if(!r&&!a.hasTags&&a.allSimpleOrDotted){let e=((e,t)=>{let r="";for(let n of e.tokens)if("text"===n.type)r+=n.value;else if("variable"===n.type){let e=n.content.trim(),i=-1===n.content.indexOf(".")?fn(t,e):pn(t,e);r+=n.raw?null==i?"":String(i):mn(i)}return r})(a,i);return n?yn(e):e}let s=((e,t)=>t?e.nodesWithSource:e.nodes)(a,r);if(!s)return e;let{output:o,variables:l,hasSet:u}=((e,t,r=!1)=>{let n=new hn(t,r);return{output:n.evalNodes(e),variables:n.variables,hasSet:n.hasSet}})(s,i,r);return u&&Object.assign(t,l),r&&o===e?e:n?yn(o):o}catch{return e}},In="[a-zA-Z_][a-zA-Z0-9_]*(?:-[a-zA-Z0-9_]+)*",Yn=`(?:${In}|\\d+)`,Hn=`\\[\\s*(?:\\d+|'[^']*'|"[^"]*"|${In}(?:\\.${Yn})*)\\s*\\]`,qn=`${In}(?:${Hn})*(?:\\??\\.${Yn}(?:${Hn})*)*(?:\\s*\\?\\?\\s*[^|{}]+?)?(?:\\s*\\|\\s*[a-zA-Z_]+(?:\\([^)]*\\))?)*`,Ln=`(?:\\{\\{\\{\\s*${qn}\\s*\\}\\}\\}|\\{\\{\\s*${qn}\\s*\\}\\})`,Bn=new RegExp(Ln,"g"),Un=RegExp(`^${Ln}$`),Vn=(e,t=!1)=>{if("string"!=typeof e)return!1;let r=t?Un:Bn;return r.lastIndex=0,r.test(e.trim())},Rn={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},Xn={date:it({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},defaultWidth:"full"}),time:it({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:it({formats:{full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},Zn={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},Qn={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},Gn={code:"es",formatDistance:(e,t,r)=>{let n;const i=Rn[e];return n="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",t.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"en "+n:"hace "+n:n},formatLong:Xn,formatRelative:(e,t,r,n)=>1!==t.getHours()?Qn[e]:Zn[e],localize:{ordinalNumber:(e,t)=>Number(e)+"º",era:ot({values:{narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},defaultWidth:"wide"}),quarter:ot({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>Number(e)-1}),month:ot({values:{narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},defaultWidth:"wide"}),day:ot({values:{narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},defaultWidth:"wide"}),dayPeriod:ot({values:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:ut({matchPattern:/^(\d+)(º)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}}),era:lt({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},defaultParseWidth:"any"}),quarter:lt({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:lt({matchPatterns:{narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},defaultParseWidth:"any"}),day:lt({matchPatterns:{narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:lt({matchPatterns:{narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},defaultParseWidth:"any"})},options:{weekStartsOn:1,firstWeekContainsDate:1}},Jn={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"aproximadamente 1 hora",other:"aproximadamente {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"aproximadamente 1 semana",other:"aproximadamente {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"aproximadamente 1 mês",other:"aproximadamente {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"aproximadamente 1 ano",other:"aproximadamente {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},Kn={date:it({formats:{full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d 'de' MMM 'de' y",short:"dd/MM/y"},defaultWidth:"full"}),time:it({formats:{full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},defaultWidth:"full"}),dateTime:it({formats:{full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},ei={lastWeek:e=>{const t=e.getDay();return"'"+(0===t||6===t?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},ti={code:"pt",formatDistance:(e,t,r)=>{let n;const i=Jn[e];return n="string"==typeof i?i:1===t?i.one:i.other.replace("{{count}}",String(t)),r?.addSuffix?r.comparison&&r.comparison>0?"daqui a "+n:"há "+n:n},formatLong:Kn,formatRelative:(e,t,r,n)=>{const i=ei[e];return"function"==typeof i?i(t):i},localize:{ordinalNumber:(e,t)=>Number(e)+"º",era:ot({values:{narrow:["aC","dC"],abbreviated:["a.C.","d.C."],wide:["antes de Cristo","depois de Cristo"]},defaultWidth:"wide"}),quarter:ot({values:{narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:ot({values:{narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},defaultWidth:"wide"}),day:ot({values:{narrow:["d","s","t","q","q","s","s"],short:["dom","seg","ter","qua","qui","sex","sáb"],abbreviated:["dom","seg","ter","qua","qui","sex","sáb"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},defaultWidth:"wide"}),dayPeriod:ot({values:{narrow:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"},wide:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"}},defaultWidth:"wide",formattingValues:{narrow:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"},wide:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:ut({matchPattern:/^(\d+)(º|ª)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:lt({matchPatterns:{narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes da era comum|depois de cristo|era comum)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes da era comum)/i,/^(depois de cristo|era comum)/i]},defaultParseWidth:"any"}),quarter:lt({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º|ª)? trimestre/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:lt({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ab/i,/^mai/i,/^jun/i,/^jul/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:lt({matchPatterns:{narrow:/^[dstq]/i,short:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,wide:/^(domingo|segunda-?\s?feira|terça-?\s?feira|quarta-?\s?feira|quinta-?\s?feira|sexta-?\s?feira|s[áa]bado)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^d/i,/^s/i,/^t/i,/^q/i,/^q/i,/^s/i,/^s/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[áa]/i]},defaultParseWidth:"any"}),dayPeriod:lt({matchPatterns:{narrow:/^(a|p|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i,any:/^([ap]\.?\s?m\.?|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^meia/i,noon:/^meio/i,morning:/manh[ãa]/i,afternoon:/tarde/i,evening:/noite/i,night:/madrugada/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:4}};var ri={year:0,month:1,day:2,hour:3,minute:4,second:5},ni={},ii=new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:"America/New_York",year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(/* @__PURE__ */new Date("2014-06-25T04:00:00.123Z")),ai="06/25/2014, 00:00:00"===ii||"06/25/2014 00:00:00"===ii;function si(e,t,r,n,i,a,s){const o=/* @__PURE__ */new Date(0);return o.setUTCFullYear(e,t,r),o.setUTCHours(n,i,a,s),o}var oi=36e5,li={timezone:/([Z+-].*)$/,timezoneZ:/^(Z)$/,timezoneHH:/^([+-]\d{2})$/,timezoneHHMM:/^([+-])(\d{2}):?(\d{2})$/};function ui(e,t,r){if(!e)return 0;let n,i,a=li.timezoneZ.exec(e);if(a)return 0;if(a=li.timezoneHH.exec(e),a)return n=parseInt(a[1],10),di(n)?-n*oi:NaN;if(a=li.timezoneHHMM.exec(e),a){n=parseInt(a[2],10);const e=parseInt(a[3],10);return di(n,e)?(i=Math.abs(n)*oi+6e4*e,"+"===a[1]?-i:i):NaN}if(function(e){if(hi[e])return!0;try{return new Intl.DateTimeFormat(void 0,{timeZone:e}),hi[e]=!0,!0}catch(t){return!1}}(e)){t=new Date(t||Date.now());const n=ci(r?t:function(e){return si(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds())}(t),e);return-(r?n:function(e,t,r){let n=e.getTime()-t;const i=ci(new Date(n),r);if(t===i)return t;n-=i-t;const a=ci(new Date(n),r);return i===a?i:Math.max(i,a)}(t,n,e))}return NaN}function ci(e,t){const r=function(e,t){const r=function(e){return ni[e]||(ni[e]=ai?new Intl.DateTimeFormat("en-US",{hourCycle:"h23",timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}):new Intl.DateTimeFormat("en-US",{hour12:!1,timeZone:e,year:"numeric",month:"numeric",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})),ni[e]}(t);return"formatToParts"in r?function(e,t){try{const r=e.formatToParts(t),n=[];for(let e=0;e<r.length;e++){const t=ri[r[e].type];void 0!==t&&(n[t]=parseInt(r[e].value,10))}return n}catch(r){if(r instanceof RangeError)return[NaN];throw r}}(r,e):function(e,t){const r=e.format(t),n=/(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(r);return[parseInt(n[3],10),parseInt(n[1],10),parseInt(n[2],10),parseInt(n[4],10),parseInt(n[5],10),parseInt(n[6],10)]}(r,e)}(e,t),n=si(r[0],r[1]-1,r[2],r[3]%24,r[4],r[5],0).getTime();let i=e.getTime();const a=i%1e3;return i-=a>=0?a:1e3+a,n-i}function di(e,t){return-23<=e&&e<=23&&(null==t||0<=t&&t<=59)}var hi={};function fi(e){const t=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return t.setUTCFullYear(e.getFullYear()),+e-+t}var pi=36e5,mi={dateTimePattern:/^([0-9W+-]+)(T| )(.*)/,datePattern:/^([0-9W+-]+)(.*)/,plainTime:/:/,YY:/^(\d{2})$/,YYY:[/^([+-]\d{2})$/,/^([+-]\d{3})$/,/^([+-]\d{4})$/],YYYY:/^(\d{4})/,YYYYY:[/^([+-]\d{4})/,/^([+-]\d{5})/,/^([+-]\d{6})/],MM:/^-(\d{2})$/,DDD:/^-?(\d{3})$/,MMDD:/^-?(\d{2})-?(\d{2})$/,Www:/^-?W(\d{2})$/,WwwD:/^-?W(\d{2})-?(\d{1})$/,HH:/^(\d{2}([.,]\d*)?)$/,HHMM:/^(\d{2}):?(\d{2}([.,]\d*)?)$/,HHMMSS:/^(\d{2}):?(\d{2}):?(\d{2}([.,]\d*)?)$/,timeZone:/(Z|[+-]\d{2}(?::?\d{2})?| UTC| [a-zA-Z]+\/[a-zA-Z_]+(?:\/[a-zA-Z_]+)?)$/};function yi(e,t,r){t=t||0,r=r||0;const n=/* @__PURE__ */new Date(0);n.setUTCFullYear(e,0,4);const i=7*t+r+1-(n.getUTCDay()||7);return n.setUTCDate(n.getUTCDate()+i),n}var gi=[31,28,31,30,31,30,31,31,30,31,30,31],bi=[31,29,31,30,31,30,31,31,30,31,30,31];function wi(e){return e%400==0||e%4==0&&e%100!=0}function vi(e,t,r){if(t<0||t>11)return!1;if(null!=r){if(r<1)return!1;const n=wi(e);if(n&&r>bi[t])return!1;if(!n&&r>gi[t])return!1}return!0}function xi(e,t){return!(e<0||e>52||null!=t&&(t<0||t>6))}function ki(e,t,r){return!(e<0||e>=25||null!=t&&(t<0||t>=60)||null!=r&&(r<0||r>=60))}var Si={en:ct,es:Gn,pt:ti},Mi=e=>{let t;return t="number"==typeof e?e<1e12?/* @__PURE__ */new Date(1e3*e):new Date(e):"string"==typeof e?jr(e):e,t};function Ai(e,t="dd MMMM, yyyy",r="en"){return e?Wt(Mi(e),t,{locale:Si[r]}):""}function Pi(e,t="dd MMMM, yyyy",r="en"){return e?Wt(function(e){const t=ui("UTC",e=function(e,t={}){if(arguments.length<1)throw new TypeError("1 argument required, but only "+arguments.length+" present");if(null===e)/* @__PURE__ */return new Date(NaN);const r=null==t.additionalDigits?2:Number(t.additionalDigits);if(2!==r&&1!==r&&0!==r)throw new RangeError("additionalDigits must be 0, 1 or 2");if(e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e))return new Date(e.getTime());if("number"==typeof e||"[object Number]"===Object.prototype.toString.call(e))return new Date(e);if("[object String]"!==Object.prototype.toString.call(e))/* @__PURE__ */return new Date(NaN);const n=function(e){const t={};let r,n=mi.dateTimePattern.exec(e);if(n?(t.date=n[1],r=n[3]):(n=mi.datePattern.exec(e),n?(t.date=n[1],r=n[2]):(t.date=null,r=e)),r){const e=mi.timeZone.exec(r);e?(t.time=r.replace(e[1],""),t.timeZone=e[1].trim()):t.time=r}return t}(e),{year:i,restDateString:a}=function(e,t){if(e){const r=mi.YYY[t],n=mi.YYYYY[t];let i=mi.YYYY.exec(e)||n.exec(e);if(i){const t=i[1];return{year:parseInt(t,10),restDateString:e.slice(t.length)}}if(i=mi.YY.exec(e)||r.exec(e),i){const t=i[1];return{year:100*parseInt(t,10),restDateString:e.slice(t.length)}}}return{year:null}}(n.date,r),s=function(e,t){if(null===t)return null;let r,n,i;if(!e||!e.length)return r=/* @__PURE__ */new Date(0),r.setUTCFullYear(t),r;let a=mi.MM.exec(e);if(a)return r=/* @__PURE__ */new Date(0),n=parseInt(a[1],10)-1,vi(t,n)?(r.setUTCFullYear(t,n),r):/* @__PURE__ */new Date(NaN);if(a=mi.DDD.exec(e),a){r=/* @__PURE__ */new Date(0);const e=parseInt(a[1],10);return function(e,t){if(t<1)return!1;const r=wi(e);return!(r&&t>366||!r&&t>365)}(t,e)?(r.setUTCFullYear(t,0,e),r):/* @__PURE__ */new Date(NaN)}if(a=mi.MMDD.exec(e),a){r=/* @__PURE__ */new Date(0),n=parseInt(a[1],10)-1;const e=parseInt(a[2],10);return vi(t,n,e)?(r.setUTCFullYear(t,n,e),r):/* @__PURE__ */new Date(NaN)}if(a=mi.Www.exec(e),a)return i=parseInt(a[1],10)-1,xi(i)?yi(t,i):/* @__PURE__ */new Date(NaN);if(a=mi.WwwD.exec(e),a){i=parseInt(a[1],10)-1;const e=parseInt(a[2],10)-1;return xi(i,e)?yi(t,i,e):/* @__PURE__ */new Date(NaN)}return null}(a,i);if(null===s||isNaN(s.getTime()))/* @__PURE__ */return new Date(NaN);if(s){const e=s.getTime();let r,i=0;if(n.time&&(i=function(e){let t,r,n=mi.HH.exec(e);if(n)return t=parseFloat(n[1].replace(",",".")),ki(t)?t%24*pi:NaN;if(n=mi.HHMM.exec(e),n)return t=parseInt(n[1],10),r=parseFloat(n[2].replace(",",".")),ki(t,r)?t%24*pi+6e4*r:NaN;if(n=mi.HHMMSS.exec(e),n){t=parseInt(n[1],10),r=parseInt(n[2],10);const e=parseFloat(n[3].replace(",","."));return ki(t,r,e)?t%24*pi+6e4*r+1e3*e:NaN}return null}(n.time),null===i||isNaN(i)))/* @__PURE__ */return new Date(NaN);if(n.timeZone||t.timeZone){if(r=ui(n.timeZone||t.timeZone,new Date(e+i)),isNaN(r))/* @__PURE__ */return new Date(NaN)}else r=fi(new Date(e+i)),r=fi(new Date(e+i+r));return new Date(e+i+r)}/* @__PURE__ */return new Date(NaN)}(e,void 0),!0),r=new Date(e.getTime()-t),n=/* @__PURE__ */new Date(0);return n.setFullYear(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate()),n.setHours(r.getUTCHours(),r.getUTCMinutes(),r.getUTCSeconds(),r.getUTCMilliseconds()),n}(Mi(e)),t,{locale:Si[r]}):""}function Ti(e,t){let r=Mi(e);return tt(Mi(t),r)}var _i=e=>"number"==typeof e||"string"==typeof e&&!e.includes(",")&&!Number.isNaN(parseFloat(e)),Ni=e=>{if(!e||"object"!=typeof e)return;let{combinator:t,enabled:r}=e,{rules:n}=e;return Array.isArray(n)?(n=n.map(e=>{if((e=>"rules"in e)(e))return Ni(e);let{field:t,value:r,operator:n,enabled:i,isBinding:a}=e;return{field:t,value:r,operator:n,enabled:i,isBinding:a}}).filter(Boolean),{rules:n,combinator:t,enabled:r}):void 0},Di=(e,t="json")=>Ni(e),ji=(e,t)=>"boolean"==typeof e&&"string"==typeof t?e===(t="true"===(t=t.toLowerCase())||"1"===t):"string"==typeof e&&"boolean"==typeof t?(e="true"===(e=e.toLowerCase())||"1"===e)===t:("number"==typeof e&&(e=`${e}`),"number"==typeof t&&(t=`${t}`),e===t),Ci=(e,t)=>null!=e&&null!=t&&(Hr(e)&&Hr(t)?(e=Yr(e),t=Yr(t),parseFloat(t)>parseFloat(e)):_i(e)?(e=parseFloat(e),t=parseFloat(t),_i(t)&&t>e):t>e),Oi=(e,t)=>Ci(e,t)||ji(e,t),Wi=(e,t)=>null!=e&&null!=t&&(Hr(e)&&Hr(t)?(e=Yr(e),t=Yr(t),parseFloat(t)<parseFloat(e)):_i(e)?(e=parseFloat(e),t=parseFloat(t),_i(t)&&t<e):t<e),Ei=(e,t)=>Wi(e,t)||ji(e,t),$i=(e,t)=>"string"==typeof e&&"string"==typeof t&&t.toLowerCase().includes(e.toLowerCase()),Fi=(e,t)=>"string"==typeof t&&"string"==typeof e&&t.toLowerCase().startsWith(e.toLowerCase()),zi=(e,t)=>"string"==typeof t&&"string"==typeof e&&t.toLowerCase().endsWith(e.toLowerCase()),Ii=e=>{switch(typeof e){case"boolean":case"number":case"function":return!1;case"object":case"undefined":return null==e||0===Object.keys(e).length;default:return!e}},Yi=(e,t)=>("string"==typeof e&&e.includes(",")?e=e.split(",").map(e=>e.trim()):("string"==typeof e||"number"==typeof e)&&(e=[e]),!!Array.isArray(e)&&("string"==typeof t&&t.includes(",")&&(t=t.split(",").map(e=>e.trim())),Array.isArray(t)?t.some(t=>_i(t)?e.includes(`${t}`)||e.includes(parseFloat(t)):e.includes(t)):_i(t)?e.includes(`${t}`)||e.includes(parseFloat(t)):e.includes(t))),Hi=(e,t)=>{let r=[];return"string"==typeof e&&(r=e.split(",").map(e=>e.trim())),!(r.length<2)&&Oi(r[0],t)&&Ei(r[1],t)},qi=(e,t={},r=!1,n=!1)=>{if(!e)return n;let{combinator:i,rules:a,enabled:s}=e;if(!Array.isArray(a))return n;if(!1===s)return!0;let o=a.filter(e=>!1!==e.enabled).map(e=>"rules"in e?qi(e,t,r):((e,t)=>{let{field:r,operator:n,isBinding:i}=e,{value:a}=e,s=je(t,r);switch(i&&(a=je(t,e.value)),n){case"=":return ji(a,s);case"!=":return!ji(a,s);case"<":return Wi(a,s);case">":return Ci(a,s);case"<=":return Ei(a,s);case">=":return Oi(a,s);case"contains":return $i(a,s);case"doesNotContain":return!$i(a,s);case"beginsWith":return Fi(a,s);case"doesNotBeginWith":return!Fi(a,s);case"endsWith":return zi(a,s);case"doesNotEndWith":return!zi(a,s);case"empty":return Ii(s);case"notEmpty":return!Ii(s);case"in":return Yi(a,s);case"notIn":return!Yi(a,s);case"between":return Hi(a,s);case"notBetween":return!Hi(a,s);default:return!1}})(e,t));return r?o:"and"===i?!o.includes(!1):o.includes(!0)},Li=(e,t={},r=!1,n=!1)=>qi(Di(e),t,r,n),Bi=(e,t,r,n=!1)=>{let{rules:i,enabled:a}=e;if(!Array.isArray(i)||!1===a)return{};let s=i.filter(e=>!1!==e.enabled).flatMap(e=>"rules"in e?Bi(e,t,r,!0):e);return n?s:s.reduce((e,n)=>{let{field:i,isBinding:a,value:s}=n;return a&&Ce(e,s,je(t,s,r)),Ce(e,i,je(t,i,r)),e},{})},Ui=(e,t={},r=void 0)=>Bi(Di(e),t,r),Vi={action:"arrayMap",title:"Array Map",type:"utility",params:{keys:{defaultValue:'[{"from": "", "to": ""}]',type:"textarea"}},preview:{sourceParsed:""},callback:(e,t)=>{let{keys:r}=t;if(!Array.isArray(e))return e;try{"string"==typeof r&&(r=JSON.parse(r))}catch{return e}return e.map(e=>{let t={};return r.forEach(r=>{"object"==typeof r&&r.from&&r.to&&Ce(t,r.to,je(e,r.from,""))}),t})}},Ri={action:"dateConverter",title:"Date Converter",type:"utility",params:{format:{defaultValue:"dd/MM/yyyy",type:"text"},asAge:{defaultValue:!1,type:"checkbox"},isUnix:{defaultValue:!0,type:"checkbox"},isUtc:{defaultValue:!1,type:"checkbox"},locale:{defaultValue:"en",type:"select",options:[{label:"en",value:"en"},{label:"es",value:"es"},{label:"pt",value:"pt"}]}},preview:{format:"",asAge:"",isUnix:"",isUtc:"",locale:""},callback:(e,{format:t="dd/MM/yyyy",asAge:r=!1,isUnix:n=!0,isUtc:i=!1,locale:a="en"})=>{if("string"!=typeof e&&"number"!=typeof e)return e;try{let s=Mi(n?Number(e):e);return isNaN(s.getTime())?e:r?function(e,t="en",r){if(!e)return"";let n=Mi(e);return isNaN(n.getTime())?"":$t(n,{...r,locale:Si[t]})}(s,a,{addSuffix:!0}):i?Pi(s,t,a):Ai(s,t,a)}catch{return e}}},Xi=/* @__PURE__ */new Set(["false","0",""]),Zi={action:"not",title:"Not",type:"utility",params:{},preview:{content:""},callback:e=>!(e=>"string"==typeof e?!Xi.has(e.trim().toLowerCase()):Array.isArray(e)?e.length>0:!!e)(e)},Qi={action:"styleSelector",title:"Style Selector",type:"utility",params:{originalSelector:{label:"Original Selector",description:"This will append the original selector (require append option enabled)",defaultValue:!1,disabled:({append:e})=>!e,type:"checkbox"},append:{label:"Append Selector",defaultValue:!1,type:"checkbox"},selector:{label:"Selector",defaultValue:"",type:"select",options:(e,t,r)=>{let n=r?.stylePlatform;return n?Object.keys(n).map(e=>({label:e,options:Object.values(n[e]).filter(e=>"class"===e.type).map(e=>({label:e.name,value:e.name}))})):[]}}},preview:{append:"",originalSelector:"",selector:""},callback:(e,t,r,n={})=>{let{originalSelector:i,append:a,selector:s}=t,o=[];if(a&&!i&&n.sourceTo)o.push(n.sourceTo,s);else if(i&&a){let e=je(r,"definition.styleSelectors.base","");e?o.push(e,s):o.push(s)}return o.length?1===o.length?o[0]:o.join(" "):""}},Gi={action:"styleVariant",title:"Style Variant",type:"utility",params:{key:{label:"Selector Key",defaultValue:"",type:"select",options:(e,t)=>{let r=t?.definition?.styleSelectors;if(!t||!t.definition||!r)return[];let n=t.definition.type;return(e=>{let t=e.reduce((e,{groupLabel:t,option:r})=>(t in e||(e[t]=[]),e[t].push(r),e),{});return Object.entries(t).map(([e,t])=>({label:e,options:t}))})(Object.entries(r).flatMap(([e,t])=>(t?[n,...t.split(" ")]:[n]).map(t=>({groupLabel:e,option:{value:`${t}.${e}`,label:`${t} (${e})`}}))))}},variant:{label:"Variant",defaultValue:"",type:"select",options:(e,t,r)=>{let n=t?.definition?.styleSelectors,i=e.key||"";if(!(t&&t.definition&&n&&r?.stylePlatform&&i.includes(".")))return[];let a=t.definition.type,s=i.split(".").pop()||"",o=n[s];if(!o)return[];let l=[],u=[a,...o.split(" ").filter(Boolean)];return Object.entries(r.stylePlatform).forEach(([e,t])=>{u.forEach(r=>{let n=t[r];if(!n)return;let i=n.attributes[s];Object.keys(i.variants||{}).forEach(t=>{l.push({value:t,label:`${e}: ${t}`})})})}),l}},append:{label:"Append to Variant",description:"Merge with existing variant values instead of replacing",defaultValue:!1,type:"checkbox"}},preview:{key:"",variant:"",append:""},callback:(e,t,r,n={})=>{let{key:i,variant:a,append:s}=t;if(!i)return n.sourceTo??{};let o=i||"base",l=a||e;return"object"!=typeof l||Array.isArray(l)?Ce(s?{...n.sourceTo}:{},o,l):l}},Ji={action:"twigTemplate",title:"Twig Template",type:"utility",params:{template:{label:"Template",defaultValue:"Tokens {{source}} from the value selected to bind previously, {{sourceTo}} is your original value, other tokens via autocomplete",type:"codemirror-text"}},preview:{template:""},callback:(e,t,r,n={})=>{let{template:i}=t,a=e;try{let t=zn(i,{source:e,...n});("string"==typeof t||"object"==typeof t&&t)&&(a=t)}catch{a=e}return a}},Ki={twigTemplate:Ji,dateConverter:Ri,staticValue:{action:"staticValue",title:"Static Value",type:"utility",params:{valueType:{label:"Value Type",defaultValue:"text",type:"select",options:[{label:"Text",value:"text"},{label:"Long Text",value:"textarea"},{label:"Boolean",value:"select"}]},value:{defaultValue:"",type:({valueType:e})=>e,options:[{label:"True",value:"true"},{label:"False",value:"false"}]}},preview:{valueType:"",value:""},callback:(e,t)=>{let{valueType:r,value:n}=t;return"select"===r?"true"===n:n}},capitalize:{action:"capitalize",title:"Capitalize",type:"utility",params:{},preview:{content:""},callback:e=>"string"==typeof e?function(e){return null!=e&&"string"==typeof e&&e.trim()?e.charAt(0).toUpperCase()+e.slice(1).toLowerCase():""}(e):e},arrayMap:Vi,stringToArray:{action:"stringToArray",title:"Text to List",type:"utility",params:{separator:{label:"Separator",defaultValue:",",type:"text"}},preview:{valueType:"",value:""},callback:(e,t)=>{let{separator:r}=t;return"string"==typeof e?e.split(r).map(e=>e.trim()):e}},not:Zi,styleSelector:Qi,styleVariant:Gi},ea=(Object.values(Ki).map(({title:e,action:t})=>({label:e,value:t})),Symbol.for("immer-nothing")),ta=Symbol.for("immer-draftable"),ra=Symbol.for("immer-state");function na(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ia=Object,aa=ia.getPrototypeOf,sa="constructor",oa="prototype",la="configurable",ua="enumerable",ca="writable",da="value",ha=e=>!!e&&!!e[ra];function fa(e){return!!e&&(ya(e)||ka(e)||!!e[ta]||!!e[sa]?.[ta]||Sa(e)||Ma(e))}var pa=ia[oa][sa].toString(),ma=/* @__PURE__ */new WeakMap;function ya(e){if(!e||!Aa(e))return!1;const t=aa(e);if(null===t||t===ia[oa])return!0;const r=ia.hasOwnProperty.call(t,sa)&&t[sa];if(r===Object)return!0;if(!Pa(r))return!1;let n=ma.get(r);return void 0===n&&(n=Function.toString.call(r),ma.set(r,n)),n===pa}function ga(e,t,r=!0){0===ba(e)?(r?Reflect.ownKeys(e):ia.keys(e)).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function ba(e){const t=e[ra];return t?t.type_:ka(e)?1:Sa(e)?2:Ma(e)?3:0}var wa=(e,t,r=ba(e))=>2===r?e.has(t):ia[oa].hasOwnProperty.call(e,t),va=(e,t,r=ba(e))=>2===r?e.get(t):e[t],xa=(e,t,r,n=ba(e))=>{2===n?e.set(t,r):3===n?e.add(r):e[t]=r},ka=Array.isArray,Sa=e=>e instanceof Map,Ma=e=>e instanceof Set,Aa=e=>"object"==typeof e,Pa=e=>"function"==typeof e,Ta=e=>"boolean"==typeof e,_a=e=>e.copy_||e.base_,Na=e=>e.modified_?e.copy_:e.base_;function Da(e,t){if(Sa(e))return new Map(e);if(Ma(e))return new Set(e);if(ka(e))return Array[oa].slice.call(e);const r=ya(e);if(!0===t||"class_only"===t&&!r){const t=ia.getOwnPropertyDescriptors(e);delete t[ra];let r=Reflect.ownKeys(t);for(let n=0;n<r.length;n++){const i=r[n],a=t[i];!1===a[ca]&&(a[ca]=!0,a[la]=!0),(a.get||a.set)&&(t[i]={[la]:!0,[ca]:!0,[ua]:a[ua],[da]:e[i]})}return ia.create(aa(e),t)}{const t=aa(e);if(null!==t&&r)return{...e};const n=ia.create(t);return ia.assign(n,e)}}function ja(e,t=!1){return Oa(e)||ha(e)||!fa(e)||(ba(e)>1&&ia.defineProperties(e,{set:Ca,add:Ca,clear:Ca,delete:Ca}),ia.freeze(e),t&&ga(e,(e,t)=>{ja(t,!0)},!1)),e}var Ca={[da]:function(){na(2)}};function Oa(e){return null===e||!Aa(e)||ia.isFrozen(e)}var Wa="MapSet",Ea="Patches",$a="ArrayMethods",Fa={};function za(e){const t=Fa[e];return t||na(0),t}var Ia,Ya=e=>!!Fa[e],Ha=()=>Ia;function qa(e,t){t&&(e.patchPlugin_=za(Ea),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function La(e){Ba(e),e.drafts_.forEach(Va),e.drafts_=null}function Ba(e){e===Ia&&(Ia=e.parent_)}var Ua=e=>Ia={drafts_:[],parent_:Ia,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:/* @__PURE__ */new Set,processedForPatches_:/* @__PURE__ */new Set,mapSetPlugin_:Ya(Wa)?za(Wa):void 0,arrayMethodsPlugin_:Ya($a)?za($a):void 0};function Va(e){const t=e[ra];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function Ra(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(void 0!==e&&e!==r){r[ra].modified_&&(La(t),na(4)),fa(e)&&(e=Xa(t,e));const{patchPlugin_:n}=t;n&&n.generateReplacementPatches_(r[ra].base_,e,t)}else e=Xa(t,r);return function(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ja(t,r)}(t,e,!0),La(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ea?e:void 0}function Xa(e,t){if(Oa(t))return t;const r=t[ra];if(!r)return es(t,e.handledSet_,e);if(!Qa(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:t}=r;if(t)for(;t.length>0;)t.pop()(e);Ka(r,e)}return r.copy_}function Za(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var Qa=(e,t)=>e.scope_===t,Ga=[];function Ja(e,t,r,n){const i=_a(e),a=e.type_;if(void 0!==n&&va(i,n,a)===t)return void xa(i,n,r,a);if(!e.draftLocations_){const t=e.draftLocations_=/* @__PURE__ */new Map;ga(i,(e,r)=>{if(ha(r)){const n=t.get(r)||[];n.push(e),t.set(r,n)}})}const s=e.draftLocations_.get(t)??Ga;for(const o of s)xa(i,o,r,a)}function Ka(e,t){if(e.modified_&&!e.finalized_&&(3===e.type_||1===e.type_&&e.allIndicesReassigned_||(e.assigned_?.size??0)>0)){const{patchPlugin_:r}=t;if(r){const n=r.getPath(e);n&&r.generatePatches_(e,n,t)}Za(e)}}function es(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||ha(e)||t.has(e)||!fa(e)||Oa(e)||(t.add(e),ga(e,(n,i)=>{if(ha(i)){const t=i[ra];Qa(t,r)&&(xa(e,n,Na(t),e.type_),Za(t))}else fa(i)&&es(i,t,r)})),e}var ts={get(e,t){if(t===ra)return e;let r=e.scope_.arrayMethodsPlugin_;const n=1===e.type_&&"string"==typeof t;if(n&&r?.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const i=_a(e);if(!wa(i,t,e.type_))return function(e,t,r){const n=is(t,r);return n?da in n?n[da]:n.get?.call(e.draft_):void 0}(e,i,t);const a=i[t];if(e.finalized_||!fa(a))return a;if(n&&e.operationMethod&&r?.isMutatingArrayMethod(e.operationMethod)&&function(e){const t=+e;return Number.isInteger(t)&&String(t)===e}(t))return a;if(a===ns(e.base_,t)||function(e,t,r){return!(1!==e.type_||!e.allIndicesReassigned_||e.assigned_?.get(t)||!fa(r)||r[ra])&&e.baseRefs_.has(r)}(e,t,a)){ss(e);const r=1===e.type_?+t:t,n=os(e.scope_,a,e,r);return e.copy_[r]=n}return a},has:(e,t)=>t in _a(e),ownKeys:e=>Reflect.ownKeys(_a(e)),set(e,t,r){const n=is(_a(e),t);if(n?.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const n=ns(_a(e),t),i=n?.[ra];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(r,n)&&(void 0!==r||wa(e.base_,t,e.type_)))return!0;ss(e),as(e)}return e.copy_[t]===r&&(void 0!==r||wa(e.copy_,t,e.type_))||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),function(e,t,r){const{scope_:n}=e;if(ha(r)){const i=r[ra];Qa(i,n)&&i.callbacks_.push(function(){ss(e),Ja(e,r,Na(i),t)})}else fa(r)&&e.callbacks_.push(function(){const i=_a(e);3===e.type_?i.has(r)&&es(r,n.handledSet_,n):va(i,t,e.type_)===r&&n.drafts_.length>1&&!0===(e.assigned_.get(t)??!1)&&e.copy_&&es(va(e.copy_,t,e.type_),n.handledSet_,n)})}(e,t,r)),!0},deleteProperty:(e,t)=>(ss(e),void 0!==ns(e.base_,t)||t in e.base_?(e.assigned_.set(t,!1),as(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=_a(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n?{[ca]:!0,[la]:1!==e.type_||"length"!==t,[ua]:n[ua],[da]:r[t]}:n},defineProperty(){na(11)},getPrototypeOf:e=>aa(e.base_),setPrototypeOf(){na(12)}},rs={};for(let Xs in ts){let e=ts[Xs];rs[Xs]=function(){const t=arguments;return t[0]=t[0][0],e.apply(this,t)}}function ns(e,t){const r=e[ra];return(r?_a(r):e)[t]}function is(e,t){if(!(t in e))return;let r=aa(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=aa(r)}}function as(e){e.modified_||(e.modified_=!0,e.parent_&&as(e.parent_))}function ss(e){e.copy_||(e.assigned_=/* @__PURE__ */new Map,e.copy_=Da(e.base_,e.scope_.immer_.useStrictShallowCopy_))}function os(e,t,r,n){const[i,a]=Sa(t)?za(Wa).proxyMap_(t,r):Ma(t)?za(Wa).proxySet_(t,r):function(e,t){const r=ka(e),n={type_:r?1:0,scope_:t?t.scope_:Ha(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let i=n,a=ts;r&&(i=[n],a=rs);const{revoke:s,proxy:o}=Proxy.revocable(i,a);return n.draft_=o,n.revoke_=s,[o,n]}(t,r);return(r?.scope_??Ha()).drafts_.push(i),a.callbacks_=r?.callbacks_??[],a.key_=n,r&&void 0!==n?function(e,t,r){e.callbacks_.push(function(n){const i=t;if(!i||!Qa(i,n))return;n.mapSetPlugin_?.fixSetContents(i);const a=Na(i);Ja(e,i.draft_??i,a,r),Ka(i,n)})}(r,a,n):a.callbacks_.push(function(e){e.mapSetPlugin_?.fixSetContents(a);const{patchPlugin_:t}=e;a.modified_&&t&&t.generatePatches_(a,[],e)}),i}function ls(e){if(!fa(e)||Oa(e))return e;const t=e[ra];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Da(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=Da(e,!0);return ga(r,(e,t)=>{xa(r,e,ls(t))},n),t&&(t.finalized_=!1),r}rs.deleteProperty=function(e,t){return rs.set.call(this,e,t,void 0)},rs.set=function(e,t,r){return ts.set.call(this,e[0],t,r,e[0])},globalThis.Iterator;var us=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(e,t,r)=>{if(Pa(e)&&!Pa(t)){const r=t;t=e;const n=this;return function(e=r,...i){return n.produce(e,e=>t.call(this,e,...i))}}let n;if(Pa(t)||na(6),void 0===r||Pa(r)||na(7),fa(e)){const i=Ua(this),a=os(0,e,void 0);let s=!0;try{n=t(a),s=!1}finally{s?La(i):Ba(i)}return qa(i,r),Ra(n,i)}if(!e||!Aa(e)){if(n=t(e),void 0===n&&(n=e),n===ea&&(n=void 0),this.autoFreeze_&&ja(n,!0),r){const t=[],i=[];za(Ea).generateReplacementPatches_(e,n,{patches_:t,inversePatches_:i}),r(t,i)}return n}na(1)},this.produceWithPatches=(e,t)=>{if(Pa(e))return(t,...r)=>this.produceWithPatches(t,t=>e(t,...r));let r,n;return[this.produce(e,t,(e,t)=>{r=e,n=t}),r,n]},Ta(e?.autoFreeze)&&this.setAutoFreeze(e.autoFreeze),Ta(e?.useStrictShallowCopy)&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),Ta(e?.useStrictIteration)&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){var t;fa(e)||na(8),ha(e)&&(ha(t=e)||na(10),e=ls(t));const r=Ua(this),n=os(0,e,void 0);return n[ra].isManual_=!0,Ba(r),n}finishDraft(e,t){const r=e&&e[ra];r&&r.isManual_||na(9);const{scope_:n}=r;return qa(n,t),Ra(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=za(Ea).applyPatches_;return ha(e)?n(e,t):this.produce(e,e=>n(e,t))}},cs=us.produce,ds=a({});ds.displayName="PlitziServiceContext";var hs=()=>{let e=u(ds);if(void 0===e)throw Error("ServiceContext value is undefined. Make sure you use the PlitziServiceProvider before using the hook.");return e},fs=e=>{let{children:t,value:r}=e;/* @__PURE__ */
|
|
5
|
-
return w(ds,{value:r,children:t})},ps=typeof window>"u",ms=()=>()=>{},ys=()=>!0,gs=()=>!1,bs=({id:e,definition:t,plitziElementLayout:n,children:i,previewMode:a,visible:s=!0})=>{let[[l,c]]=ge(["schema.flat","rsc.enabled"],{mode:"mount"}),{components:d,componentDefinitions:h}=u(Br),{contexts:{PluginsContext:f}}=hs(),{plugins:p}=u(f),{items:g}=t,v=h.current[t.type],x=t.loadStrategy??v?.definition.loadStrategy??"eager",k=n||i||g?.length,S=y(!1);s&&(S.current=!0);let M=!a||"eager"===x||s||"lazy"===x&&S.current,A=n?`${n.type}:${n.rootId}:${n.containerId}`:"",P=b(ms,ys,gs);return m(()=>{if(!k||!M)return;let t=(g??[]).filter(e=>{let t=l[e];if(!t)return!1;if(!a||!c)return!0;let r=t.definition.runtime??"shared";return!(!P&&"client"===r)}).map(e=>{let{rootId:t,type:r,runtime:i}=je(l,`${e}.definition`,{}),s=je(n,"rootId",t),o=r in d.current||!!Jr({type:r,plugins:p}),u=Kr({key:!a&&n?`${e}_${A}`:e,plitziElementLayout:n,type:r,internalProps:{id:e,rootId:s},components:d.current,plugins:p});return!c||"server"!==i||ps||!a||P&&o?u:/* @__PURE__ */w(tn,{id:e,children:u},e)});return n?.containerId===e&&t.push(/* @__PURE__ */w(r,{children:n.bodyChildren},"#layout-body")),Array.isArray(i)?t.push(...i.filter(o)):o(i)&&t.push(/* @__PURE__ */w(r,{children:i},"#children")),g?1===t.length?t[0]:t:void 0},[k,M,g,n,i,l,a,c,P,A,d,p,e])},ws=/* @__PURE__ */new Map,vs=(e,t,r={},n={})=>{let i,{attributes:a,definition:s}=e,{rootId:o,plitziElementLayout:l}=t;if(t.attributes&&(a={...a,...t.attributes}),Object.keys(r).length>0){let t=((e,t,r={})=>{let{attributes:n,definition:i}=t,{bindings:a}=i;return!a||"object"==typeof a&&!Object.keys(a).length?{attributes:n,style:{},definition:i}:cs({attributes:n,style:r,definition:i},t=>{Object.keys(a).forEach(r=>{a[r]&&Array.isArray(a[r])&&a[r].length&&a[r].forEach(n=>{let{source:i,transformers:a,when:s,enabled:o=!0}=n,{to:l}=n;if(!l||s&&!Li(s,e,!1,!0)||!o)return;"style"===r&&(l=function(e){if(!e)return"";let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([0-9])([a-zA-Z])/g,"$1 $2").replace(/([a-zA-Z])([0-9])/g,"$1 $2").replace(/[_\s-]+/g," ").trim().split(/\s+/);return 0===t.length?"":t.map((e,t)=>0===t?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join("")}(l));let{fromValue:u,toValue:c}=((e,t,r,n,i)=>{let a="initialState"===n?`definition.${n}.${i}`:`${n}.${i}`;return{fromValue:t?je(e,t,je(r,a)):void 0,toValue:je(r,a,t?je(e,t):void 0)}})(e,i,t,r,l),d=u;a&&Array.isArray(a)&&a.length>0&&a.forEach(r=>{let{action:n,params:i,enabled:a=!0}=r;if(!a)return;let s=je(Ki,`${n}.callback`);"function"==typeof s&&(d=s(d,i,t,{...e,sourceTo:c}))}),("boolean"==typeof d||"number"==typeof d||d)&&Ce(t,"initialState"===r?`definition.${r}.${l}`:`${r}.${l}`,d)})})})})(r,{...e,attributes:a},i);({attributes:a,definition:s,style:i}=t)}let{queryParams:u={},routeParams:c={},variables:d={},origin:h=""}=r,f={...d,...c,...u,navigation:{routeParams:c,queryParams:u,origin:h}};if(Object.keys(f).length>0){let e={};for(let t of Object.keys(a)){let r=a[t];e[t]="string"==typeof r&&Vn(r)?zn(r,f,!0):r}a=e}return a={...a,...k(n,["visibility","styleSelectors"])},s={...s,styleSelectors:{...s.styleSelectors,...s.initialState?.styleSelectors,...n.styleSelectors??{}}},s.styleSelectors=(e=>{let t=e.initialState?.styleVariant;return Object.fromEntries(Object.entries(e.styleSelectors).map(([r,n])=>{let i="base"===r?`plitzi__${e.type}`:`plitzi__${e.type}-${r}`;if("string"!=typeof n)return[r,n];!(e=>{let t=ws.get(e);return t||(t=RegExp(`(^|\\s)${e}(?=\\s|$)`),ws.set(e,t)),t})(e.type).test(n)&&t?.[e.type]?.[r]&&(n=n?`${e.type} ${n}`:e.type);let a=n.replace(/\S+/g,n=>{let i=t?.[n]?.[r];if(!i)return n;let a=Array.isArray(i)?i:[i];return n===e.type&&"base"===r?a.map(e=>`${n}--${e}`).join(" "):n===e.type&&"base"!==r?a.map(e=>`${n}-${r}--${e}`).join(" "):`${n} ${a.map(e=>`${n}--${e}`).join(" ")}`});return a?[r,`${i} ${a}`]:[r,i]}))})(s),{...t,rootId:je(l,"rootId",o),attributes:{...a,...k(t,["id","rootId","attributes","definition","plitziElementLayout"])},definition:s,elementState:{...s.initialState,...n},style:i}},xs=class extends t{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e,t){}render(){let{children:e}=this.props,{hasError:t}=this.state;return t?/* @__PURE__ */w("div",{children:"Something broke! Please refresh and try again."}):e}},ks=a({});ks.displayName="EventBridgeContext";var Ss=e=>{if(void 0===e)return"undefined";if(null===e)return"null";let t=typeof e;if("function"===t)return"ƒ";if("string"===t){let t=e;return JSON.stringify(t.length>40?`${t.slice(0,40)}…`:t)}return"symbol"===t?e.toString():"number"===t||"boolean"===t||"bigint"===t?`${e}`:Array.isArray(e)?0===e.length?"[]":`[…${e.length}]`:"$$typeof"in e?"<ReactElement>":"{…}"},Ms=e=>{if("object"!=typeof e||!e)return Ss(e);if("$$typeof"in e)return"<ReactElement>";if(Array.isArray(e))return 0===e.length?"[]":`[${e.slice(0,4).map(Ss).join(", ")}${e.length>4?", …":""}]`;let t=e,r=Object.keys(t);return 0===r.length?"{}":`{ ${r.slice(0,4).map(e=>`${e}: ${Ss(t[e])}`).join(", ")}${r.length>4?", …":""} }`},As=(e,t)=>{if(Object.is(e,t))return!0;if(null===e||null===t||"object"!=typeof e||"object"!=typeof t||Array.isArray(e)!==Array.isArray(t))return!1;let r=Object.keys(e),n=Object.keys(t);return r.length===n.length&&r.every(r=>Object.is(e[r],t[r]))},Ps=ie({enabled:!1,hydrated:!1,commits:[],tree:{}},{id:"tracing"}),Ts=((e={})=>{let{max:t=100,enabled:r}=e,n=new M,i=[],a=0,s=()=>{n.forEach(e=>e())},o=e=>{a+=1;let r={seq:a,time:typeof performance<"u"?performance.now():Date.now(),path:e.path,prevValue:e.prevValue,nextValue:e.nextValue},n=i.length>=t?i.slice(i.length-t+1):i.slice();n.push(r),i=n,s()};return{middleware:e=>{if(!A(r,e.getState()))return{onChange:o}},record:o,getEntries:()=>i,entriesSince:e=>i.filter(t=>t.seq>e),lastSeq:()=>a,subscribe:e=>n.add(e),clear:()=>{i=[],s()}}})({max:30}),_s=[],Ns=/* @__PURE__ */new Map,Ds=/* @__PURE__ */new Map,js=/* @__PURE__ */new Map,Cs=/* @__PURE__ */new Map,Os=!0,Ws=0,Es=/* @__PURE__ */new Map,$s=!1,Fs=!1,zs=0,Is=!1,Ys=!1,Hs="function"==typeof requestAnimationFrame?e=>{requestAnimationFrame(e)}:e=>{setTimeout(e,16)},qs=()=>{Os&&(Os=!1,Ps.setState("tree",(()=>{let e={};for(let[t,r]of Cs)e[t]={parentId:Ds.get(t),baseDuration:r,elementId:js.get(t)??t};return e})())),Ps.setState("hydrated",Ys),Ps.setState("commits",_s)},Ls=()=>{if(Is=!1,Ns.size>0){let e=[...Ns.values()].sort((e,t)=>e.timestamp-t.timestamp);Ns.clear(),(_s=[..._s,...e]).length>200&&(_s=_s.slice(_s.length-200))}Fs&&qs()},Bs=()=>{let e=Ts.entriesSince(Ws);Ws=Ts.lastSeq();let t=/* @__PURE__ */new Map;for(let r of e){if(void 0===r.path)continue;let e=t.get(r.path);e?e.next=r.nextValue:t.set(r.path,{prev:r.prevValue,next:r.nextValue})}return[...t.entries()].map(([e,t])=>({path:e,preview:`${Ms(t.prev)} → ${Ms(t.next)}`}))},Us={onRender:(e,t,r,n,i,a)=>{$s||($s=!0,Ps.setState("enabled",!0)),Cs.has(e)||(Os=!0),Cs.set(e,n);let s=Es.get(e);Es.delete(e);let o={id:e,elementId:js.get(e)??e,parentId:Ds.get(e),phase:t,actualDuration:r,baseDuration:n,changedProps:s},l=Ns.get(a);l?(l.elements.push(o),l.elementCount+=1,l.duration=Math.max(l.duration,r)):(zs+=1,Ns.set(a,{commitId:zs,timestamp:a,duration:r,elementCount:1,elements:[o],causes:Bs()})),Is||(Is=!0,Hs(Ls))},linkParent:(e,t,r)=>{(!Ds.has(e)||Ds.get(e)!==t)&&(Os=!0),Ds.size>=2e4&&!Ds.has(e)&&(Ds.clear(),js.clear(),Cs.clear(),Os=!0),Ds.set(e,t),js.set(e,r)},recordProps:(e,t)=>{Es.set(e,t)},recordStoreChange:e=>{Ts.record(e)},setHydrated:()=>{Ys||(Ys=!0,Fs&&Ps.setState("hydrated",!0))},start:()=>{Fs=!0,Ls(),qs()},stop:()=>{Fs=!1},clear:()=>{_s=[],Ns.clear(),Ws=Ts.lastSeq(),Es.clear(),zs=0,Os=!0,qs()}},Vs=/* @__PURE__ */e({default:()=>Rs}),Rs=e=>{let t=e.displayName||e.name,r=t=>{let r=y(void 0),i=y(void 0),{id:a,rootId:s}=t.internalProps,o=u(v),l=o?.visible??!0,d=`${a}${f()}`,p=o?.traceId??d,g=m(()=>({id:a,rootId:s,visible:l,traceId:p,plitziJsxSkipHOC:!0}),[a,s,l,p]);if(t.plitziJsxSkipHOC)/* @__PURE__ */return w(v,{value:g,children:/* @__PURE__ */w(e,{...t})});let{settings:{previewMode:b,debugMode:S},root:{baseElementId:M}}=hs(),[A]=ge(`schema.flat.${a}`);if(!A)throw Error(`Element ${a} not found, Page ${M}`);let{internalProps:P,customProps:T,children:_}=(({element:e,children:t,internalProps:r,previewMode:n=!1,parentVisible:i=!0})=>{let{id:a}=r,{state:s,setElementState:o}=(({id:e,bindings:t,previewMode:r})=>{let{scopePath:n}=ye(),i=m(()=>((e,t)=>t?`runtime.elements.${e}.${t}`:`runtime.elements.${e}`)(e,n),[e,n]),[a]=ge(i),s=a??qr,o=ve(),l=m(()=>(t?.attributes&&Array.isArray(t.attributes)?t.attributes:[]).filter(e=>!1!==e.enabled).map(e=>je(e,"to","")),[t]),u=c(e=>!!r&&(o(i,t=>{if(!e)return{};let r="function"==typeof e?e(t??qr):e;return l.length&&(r=Fe(r,l)),r}),!0),[l,i,r,o]);return h(()=>{if(r&&n)return()=>o(i,void 0)},[r,n,i,o,e]),{state:s,setElementState:u}})({id:a,bindings:e.definition.bindings,previewMode:n}),[[l,u,d]]=ge(["navigation.routeParams","navigation.queryParams","navigation.origin"]),f=(({bindings:e,sources:t})=>{let r=m(()=>{let r=new Set(t??[]);for(let t of Object.values(e??{}))if(Array.isArray(t))for(let{source:e}of t)if(e){let t=e.indexOf(".");r.add(t>-1?e.substring(0,t):e)}return r.size>0&&!r.has("variables")&&r.add("variables"),[...r]},[e,t]),n=m(()=>r.map(e=>`runtime.sources.${e}`),[r]),[i]=ge(n);return m(()=>{let e={};return r.forEach((t,r)=>{e[t]=i[r]}),e},[r,i])})({bindings:e.definition.bindings,sources:["variables"]}),p=m(()=>({...vs(e,r,{...f,routeParams:l,queryParams:u,origin:d},s),setElementState:o}),[e,r,f,l,u,d,s,o]);return{internalProps:p,customProps:k(p,["id","rootId","plitziElementLayout","attributes","definition","style","elementState","setElementState"]),children:bs({id:a,definition:p.definition,plitziElementLayout:p.plitziElementLayout,children:t,previewMode:n,visible:i&&x(p.elementState.visibility)})}})({element:A,internalProps:t.internalProps,children:t.children,previewMode:b,parentVisible:l}),{attributes:N,definition:D,style:j,plitziElementLayout:C,elementState:O,setElementState:W}=P;((e,t={},r={},n=ks,i=!1)=>{let{eventBridge:a}=u(n);h(()=>{if(i||!a||!e)return;let n=Object.entries(t);for(let[t,i]of n)"function"==typeof i&&a.on(e,t,i,r);return()=>{for(let[t,r]of n)"function"==typeof r&&a.off(e,t,r)}},[e,t,a,r,i])})("element",m(()=>({[`${a}_setState`]:W}),[a,W]));let E=l&&x(O.visibility),$=m(()=>({id:a,rootId:s,visible:E,traceId:d,attributes:N,definition:D,plitziElementLayout:C,style:j,elementState:O,setElementState:W}),[N,D,O,a,C,s,j,W,E,d]),F=m(()=>{let n={...P.attributes,...t.extraProps,...T,...k(t,["plitziJsxSkipHOC","internalProps","className","children","extraProps"])};return _&&(n={...n,children:_}),/* @__PURE__ */w(xs,{children:/* @__PURE__ */w(e,{...n,ref:r})})},[P.attributes,t,T,_]),z=/* @__PURE__ */w(v,{value:$,children:F});if(S){Us.linkParent(d,o?.traceId,a);let e={attributes:N,definition:D,style:j,elementState:O,plitziElementLayout:C,children:_,...T,...t.extraProps,...k(t,["plitziJsxSkipHOC","internalProps","className","children","extraProps"])};return Us.recordProps(d,((e,t)=>{if(!e)return[];let r=[],n=/* @__PURE__ */new Set([...Object.keys(e),...Object.keys(t)]);for(let i of n){let n=e[i],a=t[i];if(!Object.is(n,a)&&(r.push({key:i,prev:Ms(n),next:Ms(a),ref:As(n,a)}),r.length>=12))break}return r})(i.current,e)),i.current=e,/* @__PURE__ */w(n,{id:d,onRender:Us.onRender,children:z})}return z};return r.displayName=`withElement(${t})`,r};export{v as $,Pe as A,fe as B,Ur as C,Oe as D,Fe as E,ge as F,ae as G,ue as H,ke as I,V as J,ie as K,Se as L,Me as M,ve as N,Ce as O,be as P,x as Q,ye as R,Rr as S,Hr as T,se as U,de as V,oe as W,P as X,j as Y,A as Z,Gr as _,fs as a,Vr as b,Ui as c,Ti as d,Ai as f,Jr as g,Kr as h,ks as i,xe as j,je as k,Li as l,zn as m,Us as n,hs as o,Vn as p,R as q,Ps as r,cs as s,Rs as t,_i as u,Zr as v,Br as w,Qr as x,Xr as y,me as z};
|