@sitecore-feaas/clientside 0.1.39 → 0.1.41

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.
@@ -1,4 +1,4 @@
1
- var vt=Object.create;var U=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty;var wt=(t,e)=>{for(var r in e)U(t,r,{get:e[r],enumerable:!0})},tt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gt(e))!Et.call(t,i)&&i!==r&&U(t,i,{get:()=>e[i],enumerable:!(n=bt(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?vt(At(t)):{},tt(e||!t||!t.__esModule?U(r,"default",{value:t,enumerable:!0}):r,t)),_t=t=>tt(U({},"__esModule",{value:!0}),t);var Nt={};wt(Nt,{Base:()=>v,Component:()=>D,ComponentProps:()=>pt,DEFAULT_CDN_URL:()=>g,FEAASBase:()=>v,FEAASComponent:()=>D,FEAASComponentsProps:()=>pt,FEAASLoader:()=>F,FEAASLoaderProps:()=>yt,FEAASStylesheet:()=>J,FEAASStylesheetProps:()=>mt,JSONPath:()=>f,Loader:()=>F,MyComponent:()=>j,Stylesheet:()=>J,autoloadScripts:()=>it,cleanCollectionBit:()=>rt,clearFetchCache:()=>Pt,createStylesheet:()=>ht,fetchAndRevalidate:()=>V,fetchAndRevalidateComponent:()=>$,fetchAndRevalidateStylesheet:()=>W,fetchBypassingCache:()=>H,fetchCache:()=>T,fetchComponent:()=>Ot,fetchToValidateCache:()=>M,fetchWithCacheAwareness:()=>_,findStylesheet:()=>dt,getComponentSource:()=>kt,getComponentURL:()=>Z,getFetchCache:()=>ct,getStylesheetSource:()=>$t,getStylesheetURL:()=>N,loadScript:()=>O,loadStylesheet:()=>z,loadStylesheetAllowStale:()=>Q,normalizeCollectionScope:()=>Y,observeDOMElement:()=>nt,parseComponentSource:()=>L,parseStylesheetSource:()=>I,queryScopes:()=>B,renderComponent:()=>Lt,renderComponentElement:()=>Mt,renderComponentPromise:()=>ft,renderDOMContent:()=>k,renderDOMElement:()=>b,renderHTMLContent:()=>Rt,renderStylesheet:()=>Tt,renderStylesheetPromise:()=>ut,serializeCH1RichText:()=>R,setDOMAttribute:()=>P});module.exports=_t(Nt);function E(t,e=r=>{}){var r;let n=()=>{var i,o;let s=new Promise((l,c)=>{i=d=>{t==null||t(d),l(d)},o=c});var a=Object.assign(s,{resolve:i,reject:o,restart:n,first:r});return r=a,a.catch(e),a};return n()}var Ct=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,v=class extends Ct{getProps(e){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=E(e=>{this.payload=e}),this.whenRendered=E(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(e,r,n){this.set()}connectedCallback(){this.mount()}disconnectedCallback(){this.unmount()}mount(){try{let e=this.getParent();if(e&&!e.connected||this.connected)return;this.connected=!0,this.log("FEAAS: Mount",this.tagName,this),this.dispatchEvent(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var n;return(n=r.mount)===null||n===void 0?void 0:n.call(r)}),this.set()}catch(e){this.onError(e)}}log(...e){console.log(...e)}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEvent(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected=!1)}getParent(e=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!e||r.tagName.startsWith("FEAAS-"))return r}getElements(e=this.getRoot(),r=!0){return Array.from(e.querySelectorAll("*")).map(n=>[!r||n.tagName.startsWith("FEAAS-")?n:null,n.shadowRoot?this.getElements(n.shadowRoot,r):null]).flat().filter(Boolean)}handleEvent(e){let r=e.composedPath()[0];switch(e.type){case"feaasMount":r!=this&&this.nestedCallback(r);break;case"feaasUnmount":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(e){let r=this.descendants.indexOf(e);r!=-1&&(this.log("FEAAS: Unnest",this,e),this.descendants.splice(r,-1),this.refs[e.getComponentName()]=null,e.refs.parent==this&&(e.refs.parent=null),e.refs.top==this&&(e.refs.top=e.refs.parent))}nestedCallback(e){var r,n;if(this.descendants.indexOf(e)==-1&&(this.descendants.push(e),this.log("FEAAS: Nest",this,e),this.refs[e.getComponentName()]=e,e.refs.top=this,(r=e.refs).parent||(r.parent=this),e.render))for(var o=e.refs.parent;o;o=o.refs.parent)o.render&&((n=e.refs).parentReact||(n.parentReact=o),e.refs.topReact=o)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(e,r="uncaught",n=!1){let i=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:e});if(this.dispatchEvent(i),this.whenLoaded.reject(e),!i.defaultPrevented&&!n){this.whenRendered.reject(e);try{this.unmount()}catch(o){}return!0}return!1}shouldUpdateOnLoad(){return!0}async advance(){try{if(this.payload===void 0){if(!this.isReadyToLoad())return;this.payload=null,this.dispatchEvent(new Event("feaasLoad",{bubbles:!0,composed:!0}));let e=await this.load().catch(r=>{throw this.payload=void 0,r});if(this.whenLoaded.resolve(e),this.onLoad)return}else if(this.payload==null)return;this.flush(),this.whenRendered.resolve(this)}catch(e){this.onError(e)}}flush(){var e,r;let n=(r=(e=this.payload)===null||e===void 0?void 0:e.ReactDOM)===null||r===void 0?void 0:r.flushSync;n?n(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var e,r,n;if(this.payload==null||!this.render)return;let{React:i,ReactDOM:o,ReactDOMClient:s}=this.payload||{};if(!i)throw new Error(`${this.tagName}: React is not present in payload`);if(!o)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?s?(this.reactRoot||(this.reactRoot=s.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):o.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact?(e=this.forceUpdateReact)===null||e===void 0||e.call(this):(n=(r=this.refs.topReact).forceUpdateReact)===null||n===void 0||n.call(r)}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let n=this.descendants.filter(i=>i.refs.parentReact==this&&i.payload).map((i,o)=>this.getReactElement(i));return this.render({...this.props,children:n},this.payload)}getReactErrorBoundary(e=this,r=e.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:n,ReactDOM:i}=e.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends n.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,a){console.error(`FEAAS: ${e.tagName} Error:`,s,a),e.onError(s,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(e=this,r){let{React:n,ReactDOM:i}=e.payload||{},o=this.getReactErrorBoundary(),s=this.getReactWrapper(e);return n.createElement(o,{key:e.tagName+"-"+e.getUID(),slot:e.getAttribute("slot")},n.createElement(s,null))}getReactWrapper(e=this,r=e.tagName){if(e.reactWrapper)return e.reactWrapper;let{React:n,ReactDOM:i}=e.payload||{};return e.reactWrapper=o=>{if(e.render){let[s,a]=n.useReducer(l=>l+1,0);return e.forceUpdateReact=a,i.createPortal(n.createElement(n.Fragment,null,e.invokeReactRendering()),e.getReactRootElement())}else return e.update()},Object.assign(e.reactWrapper,{key:e.tagName+"-"+e.getUID(),displayName:r}),e.reactWrapper}getUID(){return this.uid||(this.uid=String(Math.random()))}getShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}getReactRootElement(){return this.useShadowRoot?this.getShadowRoot():this.getRoot()}set(e){try{this.scheduleRender(),this.overrides={...this.overrides,...e},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let n=this.props[r],i=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();n==null||n===this.defaultProps[r]?this.removeAttribute(i):(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&this.getAttribute(i)!=String(n)&&this.setAttribute(i,String(n))}}catch(n){this.whenRendered.reject(n),this.onError(n,"set")}return this}import(e){return import( /*@vite-ignore*/ /* webpackIgnore: true */ e)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(e=>{})})}formatURL(e,r){return typeof e=="string"&&e.match(/^\/[^\/]/)?r+e:e}getContextAttribute(e,r=this){for(var n=this;n=n.parentElement||(n.parentNode instanceof ShadowRoot?n.parentNode.host:null);)if(n.getAttribute(e)!=null)return n.getAttribute(e);return this.getAttribute(e)}static register(e,r){r==null&&(r=typeof window!="undefined"?window:null),r!=null&&r.customElements.get(e)||r.customElements.define(e,this)}};var x=class extends v{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([e,r])=>({React:e,ReactDOM:r}))}render({},{React:e}){return e.createElement(e.Fragment,null)}},j=class extends x{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:e},{React:r}){let[n,i]=r.useState(0);return r.useEffect(()=>{i(o=>o+1)},[e]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",e),r.createElement("p",null,"Triggered updates: ",n))}};j.observedAttributes=["counter"];var et=St(require("vm"),1),{hasOwnProperty:m}=Object.prototype;function S(t,e){return t=t.slice(),t.push(e),t}function q(t,e){return e=e.slice(),e.unshift(t),e}var K=class extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}};function f(t,e,r,n,i){if(!(this instanceof f))try{return new f(t,e,r,n,i)}catch(s){if(!s.avoidNew)throw s;return s.value}typeof t=="string"&&(i=n,n=r,r=e,e=t,t=null);let o=t&&typeof t=="object";if(t=t||{},this.json=t.json||r,this.path=t.path||e,this.resultType=t.resultType||"value",this.flatten=t.flatten||!1,this.wrap=m.call(t,"wrap")?t.wrap:!0,this.sandbox=t.sandbox||{},this.preventEval=t.preventEval||!1,this.parent=t.parent||null,this.parentProperty=t.parentProperty||null,this.callback=t.callback||n||null,this.otherTypeCallback=t.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){let s={path:o?t.path:e};o?"json"in t&&(s.json=t.json):s.json=r;let a=this.evaluate(s);if(!a||typeof a!="object")throw new K(a);return a}}f.prototype.evaluate=function(t,e,r,n){let i=this.parent,o=this.parentProperty,{flatten:s,wrap:a}=this;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,e=e||this.json,t=t||this.path,t&&typeof t=="object"&&!Array.isArray(t)){if(!t.path&&t.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!m.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=t),s=m.call(t,"flatten")?t.flatten:s,this.currResultType=m.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=m.call(t,"sandbox")?t.sandbox:this.currSandbox,a=m.call(t,"wrap")?t.wrap:a,this.currPreventEval=m.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=m.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=m.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,i=m.call(t,"parent")?t.parent:i,o=m.call(t,"parentProperty")?t.parentProperty:o,t=t.path}if(i=i||null,o=o||null,Array.isArray(t)&&(t=f.toPathString(t)),!t&&t!==""||!e)return;let l=f.toPathArray(t);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;let c=this._trace(l,e,["$"],i,o,r).filter(function(d){return d&&!d.isParentSelector});return c.length?!a&&c.length===1&&!c[0].hasArrExpr?this._getPreferredOutput(c[0]):c.reduce((d,p)=>{let h=this._getPreferredOutput(p);return s&&Array.isArray(h)?d=d.concat(h):d.push(h),d},[]):a?[]:void 0};f.prototype._getPreferredOutput=function(t){let e=this.currResultType;switch(e){case"all":{let r=Array.isArray(t.path)?t.path:f.toPathArray(t.path);return t.pointer=f.toPointer(r),t.path=typeof t.path=="string"?t.path:f.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return f.toPathString(t[e]);case"pointer":return f.toPointer(t.path);default:throw new TypeError("Unknown result type")}};f.prototype._handleCallback=function(t,e,r){if(e){let n=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:f.toPathString(t.path),e(n,r,t)}};f.prototype._trace=function(t,e,r,n,i,o,s,a){let l;if(!t.length)return l={path:r,value:e,parent:n,parentProperty:i,hasArrExpr:s},this._handleCallback(l,o,"value"),l;let c=t[0],d=t.slice(1),p=[];function h(u){Array.isArray(u)?u.forEach(y=>{p.push(y)}):p.push(u)}if((typeof c!="string"||a)&&e&&m.call(e,c))h(this._trace(d,e[c],S(r,c),e,c,o,s));else if(c==="*")this._walk(e,u=>{h(this._trace(d,e[u],S(r,u),e,u,o,!0,!0))});else if(c==="..")h(this._trace(d,e,r,n,i,o,s)),this._walk(e,u=>{typeof e[u]=="object"&&h(this._trace(t.slice(),e[u],S(r,u),e,u,o,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:d,isParentSelector:!0};if(c==="~")return l={path:S(r,c),value:i,parent:n,parentProperty:null},this._handleCallback(l,o,"property"),l;if(c==="$")h(this._trace(d,e,r,null,null,o,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(c))h(this._slice(c,d,e,r,n,i,o));else if(c.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let u=c.replace(/^\?\((.*?)\)$/u,"$1");this._walk(e,y=>{this._eval(u,e[y],y,r,n,i)&&h(this._trace(d,e[y],S(r,y),e,y,o,!0))})}else if(c[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");h(this._trace(q(this._eval(c,e,r[r.length-1],r.slice(0,-1),n,i),d),e,r,n,i,o,s))}else if(c[0]==="@"){let u=!1,y=c.slice(1,-2);switch(y){case"scalar":(!e||!["object","function"].includes(typeof e))&&(u=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===y&&(u=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(u=!0);break;case"number":Number.isFinite(e)&&(u=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(u=!0);break;case"object":e&&typeof e===y&&(u=!0);break;case"array":Array.isArray(e)&&(u=!0);break;case"other":u=this.currOtherTypeCallback(e,r,n,i);break;case"null":e===null&&(u=!0);break;default:throw new TypeError("Unknown value type "+y)}if(u)return l={path:r,value:e,parent:n,parentProperty:i},this._handleCallback(l,o,"value"),l}else if(c[0]==="`"&&e&&m.call(e,c.slice(1))){let u=c.slice(1);h(this._trace(d,e[u],S(r,u),e,u,o,s,!0))}else if(c.includes(",")){let u=c.split(",");for(let y of u)h(this._trace(q(y,d),e,r,n,i,o,!0))}else!a&&e&&m.call(e,c)&&h(this._trace(d,e[c],S(r,c),e,c,o,s,!0))}if(this._hasParentSelector)for(let u=0;u<p.length;u++){let y=p[u];if(y&&y.isParentSelector){let A=this._trace(y.expr,e,y.path,n,i,o,s);if(Array.isArray(A)){p[u]=A[0];let C=A.length;for(let w=1;w<C;w++)u++,p.splice(u,0,A[w])}else p[u]=A}}return p};f.prototype._walk=function(t,e){if(Array.isArray(t)){let r=t.length;for(let n=0;n<r;n++)e(n)}else t&&typeof t=="object"&&Object.keys(t).forEach(r=>{e(r)})};f.prototype._slice=function(t,e,r,n,i,o,s){if(!Array.isArray(r))return;let a=r.length,l=t.split(":"),c=l[2]&&Number.parseInt(l[2])||1,d=l[0]&&Number.parseInt(l[0])||0,p=l[1]&&Number.parseInt(l[1])||a;d=d<0?Math.max(0,d+a):Math.min(a,d),p=p<0?Math.max(0,p+a):Math.min(a,p);let h=[];for(let u=d;u<p;u+=c)this._trace(q(u,e),r,n,i,o,s,!0).forEach(A=>{h.push(A)});return h};f.prototype._eval=function(t,e,r,n,i,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=i,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;let s=t.includes("@path");s&&(this.currSandbox._$_path=f.toPathString(n.concat([r])));let a="script:"+t;if(!f.cache[a]){let l=t.replace(/@parentProperty/gu,"_$_parentProperty").replace(/@parent/gu,"_$_parent").replace(/@property/gu,"_$_property").replace(/@root/gu,"_$_root").replace(/@([.\s)[])/gu,"_$_v$1");s&&(l=l.replace(/@path/gu,"_$_path")),f.cache[a]=new this.vm.Script(l)}try{return f.cache[a].runInNewContext(this.currSandbox)}catch(l){throw new Error("jsonPath: "+l.message+": "+t)}};f.cache={};f.toPathString=function(t){let e=t,r=e.length,n="$";for(let i=1;i<r;i++)/^(~|\^|@.*?\(\))$/u.test(e[i])||(n+=/^[0-9*]+$/u.test(e[i])?"["+e[i]+"]":"['"+e[i]+"']");return n};f.toPointer=function(t){let e=t,r=e.length,n="";for(let i=1;i<r;i++)/^(~|\^|@.*?\(\))$/u.test(e[i])||(n+="/"+e[i].toString().replace(/~/gu,"~0").replace(/\//gu,"~1"));return n};f.toPathArray=function(t){let{cache:e}=f;if(e[t])return e[t].concat();let r=[],i=t.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replace(/[['](\??\(.*?\))[\]']/gu,function(o,s){return"[#"+(r.push(s)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(o,s){return"['"+s.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(o,s){return";"+s.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"").split(";").map(function(o){let s=o.match(/#(\d+)/u);return!s||!s[1]?o:r[s[1]]});return e[t]=i,e[t].concat()};f.prototype.vm=et.default;function rt(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function Y(t){return rt(t)+".*"}function B(t,e,r=!1,n=t){var i=e;let o=Object.keys(t).sort((a,l)=>l.length-a.length);for(let a of o)if(e.startsWith(a)){if(a==e){if(r)return t[a];continue}i=e.substring(a.length+1),n=t[a];break}var s=f({path:i,json:n});return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[i.replace(/^.*?\./,"_."),i.replace(/^.*?\./,""),i.replace(/^([^.]+).*?\.\$\./,"$1."),i.replace(/^.*?\.\$\./,"_."),i.replace(/^.*?\.\$\./,""),i.replace(/^[^.]+$/,"_")].filter((a,l,c)=>c.indexOf(a)===l).reduce((a,l)=>a.length>0?a:f({path:l,json:n}),[])),r&&Array.isArray(s)?s[0]:s}function G(t,e={},r){return r?`<${r}${Object.entries(e).map(([n,i])=>i!=null&&` ${n}="${i}"`).filter(Boolean).join("")}>${R(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):R(t)}function R(t){var e;if(Array.isArray(t))return t.map(R).join(`
1
+ var vt=Object.create;var U=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var At=Object.getPrototypeOf,Et=Object.prototype.hasOwnProperty;var wt=(t,e)=>{for(var r in e)U(t,r,{get:e[r],enumerable:!0})},tt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of gt(e))!Et.call(t,i)&&i!==r&&U(t,i,{get:()=>e[i],enumerable:!(n=bt(e,i))||n.enumerable});return t};var St=(t,e,r)=>(r=t!=null?vt(At(t)):{},tt(e||!t||!t.__esModule?U(r,"default",{value:t,enumerable:!0}):r,t)),_t=t=>tt(U({},"__esModule",{value:!0}),t);var Nt={};wt(Nt,{Base:()=>v,Component:()=>D,ComponentProps:()=>pt,DEFAULT_CDN_URL:()=>g,FEAASBase:()=>v,FEAASComponent:()=>D,FEAASComponentsProps:()=>pt,FEAASLoader:()=>F,FEAASLoaderProps:()=>yt,FEAASStylesheet:()=>J,FEAASStylesheetProps:()=>mt,JSONPath:()=>f,Loader:()=>F,MyComponent:()=>j,Stylesheet:()=>J,autoloadScripts:()=>it,cleanCollectionBit:()=>rt,clearFetchCache:()=>Pt,createStylesheet:()=>ht,fetchAndRevalidate:()=>V,fetchAndRevalidateComponent:()=>$,fetchAndRevalidateStylesheet:()=>W,fetchBypassingCache:()=>H,fetchCache:()=>T,fetchComponent:()=>Ot,fetchToValidateCache:()=>M,fetchWithCacheAwareness:()=>_,findStylesheet:()=>dt,getComponentSource:()=>kt,getComponentURL:()=>Z,getFetchCache:()=>ct,getStylesheetSource:()=>$t,getStylesheetURL:()=>N,loadScript:()=>O,loadStylesheet:()=>z,loadStylesheetAllowStale:()=>Q,normalizeCollectionScope:()=>Y,observeDOMElement:()=>nt,parseComponentSource:()=>L,parseStylesheetSource:()=>I,queryScopes:()=>B,renderComponent:()=>Lt,renderComponentElement:()=>Mt,renderComponentPromise:()=>ft,renderDOMContent:()=>k,renderDOMElement:()=>b,renderHTMLContent:()=>Rt,renderStylesheet:()=>Tt,renderStylesheetPromise:()=>ut,serializeCH1RichText:()=>R,setDOMAttribute:()=>P});module.exports=_t(Nt);function E(t,e=r=>{}){var r;let n=()=>{var i,o;let s=new Promise((l,c)=>{i=d=>{t==null||t(d),l(d)},o=c});var a=Object.assign(s,{resolve:i,reject:o,restart:n,first:r});return r=a,a.catch(e),a};return n()}var Ct=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,v=class extends Ct{getProps(e){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=E(e=>{this.payload=e}),this.whenRendered=E(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(e,r,n){this.set()}connectedCallback(){this.mount()}disconnectedCallback(){this.unmount()}mount(){try{let e=this.getParent();if(e&&!e.connected||this.connected)return;this.connected=!0,this.log("FEAAS: Mount",this.tagName,this),this.dispatchEvent(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var n;return(n=r.mount)===null||n===void 0?void 0:n.call(r)}),this.set()}catch(e){this.onError(e)}}log(...e){console.log(...e)}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEvent(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected=!1)}getParent(e=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!e||r.tagName.startsWith("FEAAS-"))return r}getElements(e=this.getRoot(),r=!0){return Array.from(e.querySelectorAll("*")).map(n=>[!r||n.tagName.startsWith("FEAAS-")?n:null,n.shadowRoot?this.getElements(n.shadowRoot,r):null]).flat().filter(Boolean)}handleEvent(e){let r=e.composedPath()[0];switch(e.type){case"feaasMount":r!=this&&this.nestedCallback(r);break;case"feaasUnmount":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(e){let r=this.descendants.indexOf(e);r!=-1&&(this.log("FEAAS: Unnest",this,e),this.descendants.splice(r,-1),this.refs[e.getComponentName()]=null,e.refs.parent==this&&(e.refs.parent=null),e.refs.top==this&&(e.refs.top=e.refs.parent))}nestedCallback(e){var r,n;if(this.descendants.indexOf(e)==-1&&(this.descendants.push(e),this.log("FEAAS: Nest",this,e),this.refs[e.getComponentName()]=e,e.refs.top=this,(r=e.refs).parent||(r.parent=this),e.render))for(var o=e.refs.parent;o;o=o.refs.parent)o.render&&((n=e.refs).parentReact||(n.parentReact=o),e.refs.topReact=o)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(e,r="uncaught",n=!1){let i=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:e});if(this.dispatchEvent(i),this.whenLoaded.reject(e),!i.defaultPrevented&&!n){this.whenRendered.reject(e);try{this.unmount()}catch(o){}return!0}return!1}shouldUpdateOnLoad(){return!0}async advance(){try{if(this.payload===void 0){if(!this.isReadyToLoad())return;this.payload=null,this.dispatchEvent(new Event("feaasLoad",{bubbles:!0,composed:!0}));let e=await this.load().catch(r=>{throw this.payload=void 0,r});if(this.whenLoaded.resolve(e),this.onLoad)return}else if(this.payload==null)return;this.flush(),this.whenRendered.resolve(this)}catch(e){this.onError(e)}}flush(){var e,r;let n=(r=(e=this.payload)===null||e===void 0?void 0:e.ReactDOM)===null||r===void 0?void 0:r.flushSync;n?n(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var e,r,n;if(this.payload==null||!this.render)return;let{React:i,ReactDOM:o,ReactDOMClient:s}=this.payload||{};if(!i)throw new Error(`${this.tagName}: React is not present in payload`);if(!o)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?s?(this.reactRoot||(this.reactRoot=s.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):o.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact?(e=this.forceUpdateReact)===null||e===void 0||e.call(this):(n=(r=this.refs.topReact).forceUpdateReact)===null||n===void 0||n.call(r)}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let n=this.descendants.filter(i=>i.refs.parentReact==this&&i.payload).map((i,o)=>this.getReactElement(i));return this.render({...this.props,children:n},this.payload)}getReactErrorBoundary(e=this,r=e.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:n,ReactDOM:i}=e.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends n.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,a){console.error(`FEAAS: ${e.tagName} Error:`,s,a),e.onError(s,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(e=this,r){let{React:n,ReactDOM:i}=e.payload||{},o=this.getReactErrorBoundary(),s=this.getReactWrapper(e);return n.createElement(o,{key:e.tagName+"-"+e.getUID(),slot:e.getAttribute("slot")},n.createElement(s,null))}getReactWrapper(e=this,r=e.tagName){if(e.reactWrapper)return e.reactWrapper;let{React:n,ReactDOM:i}=e.payload||{};return e.reactWrapper=o=>{if(e.render){let[s,a]=n.useReducer(l=>l+1,0);return e.forceUpdateReact=a,i.createPortal(n.createElement(n.Fragment,null,e.invokeReactRendering()),e.getReactRootElement())}else return e.update()},Object.assign(e.reactWrapper,{key:e.tagName+"-"+e.getUID(),displayName:r}),e.reactWrapper}getUID(){return this.uid||(this.uid=String(Math.random()))}getShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}getReactRootElement(){return this.useShadowRoot?this.getShadowRoot():this.getRoot()}set(e){try{this.scheduleRender(),this.overrides={...this.overrides,...e},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let n=this.props[r],i=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();n==null||n===this.defaultProps[r]?this.removeAttribute(i):(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&this.getAttribute(i)!=String(n)&&this.setAttribute(i,String(n))}}catch(n){this.whenRendered.reject(n),this.onError(n,"set")}return this}import(e){return import( /*@vite-ignore*/ /* webpackIgnore: true */ e)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(e=>{})})}formatURL(e,r){return typeof e=="string"&&e.match(/^\/[^\/]/)?r+e:e}getContextAttribute(e,r=this){for(var n=this;n=n.parentElement||(n.parentNode instanceof ShadowRoot?n.parentNode.host:null);)if(n.getAttribute(e)!=null)return n.getAttribute(e);return this.getAttribute(e)}static register(e,r){r==null&&(r=typeof window!="undefined"?window:null),r&&!r.customElements.get(e)&&r.customElements.define(e,this)}};var x=class extends v{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([e,r])=>({React:e,ReactDOM:r}))}render({},{React:e}){return e.createElement(e.Fragment,null)}},j=class extends x{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:e},{React:r}){let[n,i]=r.useState(0);return r.useEffect(()=>{i(o=>o+1)},[e]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",e),r.createElement("p",null,"Triggered updates: ",n))}};j.observedAttributes=["counter"];var et=St(require("vm"),1),{hasOwnProperty:m}=Object.prototype;function S(t,e){return t=t.slice(),t.push(e),t}function q(t,e){return e=e.slice(),e.unshift(t),e}var K=class extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}};function f(t,e,r,n,i){if(!(this instanceof f))try{return new f(t,e,r,n,i)}catch(s){if(!s.avoidNew)throw s;return s.value}typeof t=="string"&&(i=n,n=r,r=e,e=t,t=null);let o=t&&typeof t=="object";if(t=t||{},this.json=t.json||r,this.path=t.path||e,this.resultType=t.resultType||"value",this.flatten=t.flatten||!1,this.wrap=m.call(t,"wrap")?t.wrap:!0,this.sandbox=t.sandbox||{},this.preventEval=t.preventEval||!1,this.parent=t.parent||null,this.parentProperty=t.parentProperty||null,this.callback=t.callback||n||null,this.otherTypeCallback=t.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){let s={path:o?t.path:e};o?"json"in t&&(s.json=t.json):s.json=r;let a=this.evaluate(s);if(!a||typeof a!="object")throw new K(a);return a}}f.prototype.evaluate=function(t,e,r,n){let i=this.parent,o=this.parentProperty,{flatten:s,wrap:a}=this;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,e=e||this.json,t=t||this.path,t&&typeof t=="object"&&!Array.isArray(t)){if(!t.path&&t.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!m.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=t),s=m.call(t,"flatten")?t.flatten:s,this.currResultType=m.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=m.call(t,"sandbox")?t.sandbox:this.currSandbox,a=m.call(t,"wrap")?t.wrap:a,this.currPreventEval=m.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=m.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=m.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,i=m.call(t,"parent")?t.parent:i,o=m.call(t,"parentProperty")?t.parentProperty:o,t=t.path}if(i=i||null,o=o||null,Array.isArray(t)&&(t=f.toPathString(t)),!t&&t!==""||!e)return;let l=f.toPathArray(t);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;let c=this._trace(l,e,["$"],i,o,r).filter(function(d){return d&&!d.isParentSelector});return c.length?!a&&c.length===1&&!c[0].hasArrExpr?this._getPreferredOutput(c[0]):c.reduce((d,p)=>{let h=this._getPreferredOutput(p);return s&&Array.isArray(h)?d=d.concat(h):d.push(h),d},[]):a?[]:void 0};f.prototype._getPreferredOutput=function(t){let e=this.currResultType;switch(e){case"all":{let r=Array.isArray(t.path)?t.path:f.toPathArray(t.path);return t.pointer=f.toPointer(r),t.path=typeof t.path=="string"?t.path:f.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return f.toPathString(t[e]);case"pointer":return f.toPointer(t.path);default:throw new TypeError("Unknown result type")}};f.prototype._handleCallback=function(t,e,r){if(e){let n=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:f.toPathString(t.path),e(n,r,t)}};f.prototype._trace=function(t,e,r,n,i,o,s,a){let l;if(!t.length)return l={path:r,value:e,parent:n,parentProperty:i,hasArrExpr:s},this._handleCallback(l,o,"value"),l;let c=t[0],d=t.slice(1),p=[];function h(u){Array.isArray(u)?u.forEach(y=>{p.push(y)}):p.push(u)}if((typeof c!="string"||a)&&e&&m.call(e,c))h(this._trace(d,e[c],S(r,c),e,c,o,s));else if(c==="*")this._walk(e,u=>{h(this._trace(d,e[u],S(r,u),e,u,o,!0,!0))});else if(c==="..")h(this._trace(d,e,r,n,i,o,s)),this._walk(e,u=>{typeof e[u]=="object"&&h(this._trace(t.slice(),e[u],S(r,u),e,u,o,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:d,isParentSelector:!0};if(c==="~")return l={path:S(r,c),value:i,parent:n,parentProperty:null},this._handleCallback(l,o,"property"),l;if(c==="$")h(this._trace(d,e,r,null,null,o,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(c))h(this._slice(c,d,e,r,n,i,o));else if(c.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let u=c.replace(/^\?\((.*?)\)$/u,"$1");this._walk(e,y=>{this._eval(u,e[y],y,r,n,i)&&h(this._trace(d,e[y],S(r,y),e,y,o,!0))})}else if(c[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");h(this._trace(q(this._eval(c,e,r[r.length-1],r.slice(0,-1),n,i),d),e,r,n,i,o,s))}else if(c[0]==="@"){let u=!1,y=c.slice(1,-2);switch(y){case"scalar":(!e||!["object","function"].includes(typeof e))&&(u=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===y&&(u=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(u=!0);break;case"number":Number.isFinite(e)&&(u=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(u=!0);break;case"object":e&&typeof e===y&&(u=!0);break;case"array":Array.isArray(e)&&(u=!0);break;case"other":u=this.currOtherTypeCallback(e,r,n,i);break;case"null":e===null&&(u=!0);break;default:throw new TypeError("Unknown value type "+y)}if(u)return l={path:r,value:e,parent:n,parentProperty:i},this._handleCallback(l,o,"value"),l}else if(c[0]==="`"&&e&&m.call(e,c.slice(1))){let u=c.slice(1);h(this._trace(d,e[u],S(r,u),e,u,o,s,!0))}else if(c.includes(",")){let u=c.split(",");for(let y of u)h(this._trace(q(y,d),e,r,n,i,o,!0))}else!a&&e&&m.call(e,c)&&h(this._trace(d,e[c],S(r,c),e,c,o,s,!0))}if(this._hasParentSelector)for(let u=0;u<p.length;u++){let y=p[u];if(y&&y.isParentSelector){let A=this._trace(y.expr,e,y.path,n,i,o,s);if(Array.isArray(A)){p[u]=A[0];let C=A.length;for(let w=1;w<C;w++)u++,p.splice(u,0,A[w])}else p[u]=A}}return p};f.prototype._walk=function(t,e){if(Array.isArray(t)){let r=t.length;for(let n=0;n<r;n++)e(n)}else t&&typeof t=="object"&&Object.keys(t).forEach(r=>{e(r)})};f.prototype._slice=function(t,e,r,n,i,o,s){if(!Array.isArray(r))return;let a=r.length,l=t.split(":"),c=l[2]&&Number.parseInt(l[2])||1,d=l[0]&&Number.parseInt(l[0])||0,p=l[1]&&Number.parseInt(l[1])||a;d=d<0?Math.max(0,d+a):Math.min(a,d),p=p<0?Math.max(0,p+a):Math.min(a,p);let h=[];for(let u=d;u<p;u+=c)this._trace(q(u,e),r,n,i,o,s,!0).forEach(A=>{h.push(A)});return h};f.prototype._eval=function(t,e,r,n,i,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=i,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;let s=t.includes("@path");s&&(this.currSandbox._$_path=f.toPathString(n.concat([r])));let a="script:"+t;if(!f.cache[a]){let l=t.replace(/@parentProperty/gu,"_$_parentProperty").replace(/@parent/gu,"_$_parent").replace(/@property/gu,"_$_property").replace(/@root/gu,"_$_root").replace(/@([.\s)[])/gu,"_$_v$1");s&&(l=l.replace(/@path/gu,"_$_path")),f.cache[a]=new this.vm.Script(l)}try{return f.cache[a].runInNewContext(this.currSandbox)}catch(l){throw new Error("jsonPath: "+l.message+": "+t)}};f.cache={};f.toPathString=function(t){let e=t,r=e.length,n="$";for(let i=1;i<r;i++)/^(~|\^|@.*?\(\))$/u.test(e[i])||(n+=/^[0-9*]+$/u.test(e[i])?"["+e[i]+"]":"['"+e[i]+"']");return n};f.toPointer=function(t){let e=t,r=e.length,n="";for(let i=1;i<r;i++)/^(~|\^|@.*?\(\))$/u.test(e[i])||(n+="/"+e[i].toString().replace(/~/gu,"~0").replace(/\//gu,"~1"));return n};f.toPathArray=function(t){let{cache:e}=f;if(e[t])return e[t].concat();let r=[],i=t.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replace(/[['](\??\(.*?\))[\]']/gu,function(o,s){return"[#"+(r.push(s)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(o,s){return"['"+s.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(o,s){return";"+s.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"").split(";").map(function(o){let s=o.match(/#(\d+)/u);return!s||!s[1]?o:r[s[1]]});return e[t]=i,e[t].concat()};f.prototype.vm=et.default;function rt(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function Y(t){return rt(t)+".*"}function B(t,e,r=!1,n=t){var i=e;let o=Object.keys(t).sort((a,l)=>l.length-a.length);for(let a of o)if(e.startsWith(a)){if(a==e){if(r)return t[a];continue}i=e.substring(a.length+1),n=t[a];break}var s=f({path:i,json:n});return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[i.replace(/^.*?\./,"_."),i.replace(/^.*?\./,""),i.replace(/^([^.]+).*?\.\$\./,"$1."),i.replace(/^.*?\.\$\./,"_."),i.replace(/^.*?\.\$\./,""),i.replace(/^[^.]+$/,"_")].filter((a,l,c)=>c.indexOf(a)===l).reduce((a,l)=>a.length>0?a:f({path:l,json:n}),[])),r&&Array.isArray(s)?s[0]:s}function G(t,e={},r){return r?`<${r}${Object.entries(e).map(([n,i])=>i!=null&&` ${n}="${i}"`).filter(Boolean).join("")}>${R(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):R(t)}function R(t){var e;if(Array.isArray(t))return t.map(R).join(`
2
2
  `).trim();if(typeof t=="string")return t;if(t==null)return"";switch(t.type){case"heading":let{level:r,...n}=t.attrs;return G(t.content,n,"h"+r);case"text":return(t.marks||[]).reduce((i,o)=>G(i,o.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[o.type]),(e=t.text)===null||e===void 0?void 0:e.replace(/\s+/," "));default:return G(t.content||t.text,t.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[t.type])}}function nt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&O(i,o),n.addedNodes&&n.addedNodes.forEach(s=>{s.nodeType==1&&it(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function it(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];O(i,i.getAttribute("data-embed-src"))}if(e)return nt(t)}function O(t,e){for(var r=t;r;r=r.parentElement)if(!r.parentElement){let i=r.querySelectorAll("script");for(var n=0;n<i.length;n++)if(i[n].getAttribute("src")==e)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let o=r.ownerDocument.createElement("script");o.type="module",o.src=e,r.appendChild(o);break}}function st(t){let e=t.getAttribute("data-path-scope");for(var r=0,n=t;n=n.previousElementSibling;)n.getAttribute("data-path-scope")==e&&r++;return r}function xt(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var i=st(t);if(i!=0)return;let o=t.parentElement;if(o!=null){e==0?t.setAttribute("hidden","hidden"):t.getAttribute("hidden")!=null&&t.removeAttribute("hidden");for(var s=i+1,a=t,l=t;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==n&&(s++,a=l);for(var c=s;c<e;c++)o.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var c=Math.max(1,e);c<s;c++)a=a.previousElementSibling,o.removeChild(a.nextElementSibling)}}function P(t,e,r,n){var i;if(t){var o=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=R(r)),n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(t,e,r));var s=e.replace("data-path-","");if(e=="data-path-src")o=t.tagName=="IMG"?t:t.querySelector("img, video");else if(e=="data-path-href")o=t.querySelector("a")||t.closest("a");else if(e=="data-path-alt")o=t.querySelector("img, picture");else if(e=="data-path-hidden")r=r?null:!0;else if(e=="data-path"||e=="data-embed-html"||e=="html")s="innerHTML";else if(e=="data-embed-src")O(t,r);else if(e=="data-path-attributes"){let p=((i=t.getAttribute("data-attributes-keys"))===null||i===void 0?void 0:i.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var a in r){var l=r[a];P(t,a,typeof l=="object"&&l?JSON.stringify(l):l,n)}for(var c=0;c<p.length;c++)(r==null||!(p[c]in r))&&P(t,p[c],null,n);P(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var d=String(t.getAttribute("data-path-placeholder")||o[s]);r!=null?s=="innerHTML"?o.innerHTML!=r&&(o.innerHTML=r):o.getAttribute(s)!=r&&o.setAttribute(s,r):s=="innerHTML"?o.innerHTML=d:o.removeAttribute(s)}}}var ot=["data-attributes-keys","data-path-attributes","data-path-scope"];function b(t,e,r,n){var i,o,s;let a=t;if(n||(e=((i=r==null?void 0:r.processData)===null||i===void 0?void 0:i.call(r,a,e))||e),a.nodeType==1){let d=a.getAttribute("data-path-scope");if(d){let h=st(a),u=B(e,d,!1)||[];h==0&&xt(a,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,a,u))===!1?1:u.length,r),e={...e,[Y(d)]:u[h]}}let p=Array.prototype.slice.call(a.attributes).sort((h,u)=>ot.indexOf(h.name)-ot.indexOf(u.name));for(var l=0;l<p.length;l++){let{name:h,value:u}=p[l];h.startsWith("data-path")&&h!="data-path-scope"&&P(a,h,B(e,u,!0),r),h=="data-embed-src"&&P(a,h,a.getAttribute(h),r)}}for(var l=0,c;c=a.childNodes[l++];)at(c)&&b(c,e,r,!0);return n||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,e),a}function at(t){return t.nodeType==1}function k(t,e,r,n){var i;let o=((i=n==null?void 0:n.processTemplate)===null||i===void 0?void 0:i.call(n,t,e,r))||e;if(t.innerHTML=o,t.classList.add("-feaas"),(t.closest(".component.feaas")||t).className.includes("-theme--"))for(var a=0,l;l=t.childNodes[a++];)at(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return b(t,r,n)}function Rt(t,e,r,n=!1){var i;let o=((i=r==null?void 0:r.processTemplate)===null||i===void 0?void 0:i.call(r,null,t,e))||t;if(typeof document=="undefined"||n){let{parseHTML:s}=require("linkedom"),{document:a}=s(o);return b(a,e,r).toString()}else{let s=document.createElement("div");return s.innerHTML=o,b(s,e,r),s.innerHTML}}var lt=["initial","check","updated"],T={};function Pt(){T={}}async function V(t,e,r,n,i=T){return _({url:t,options:e,validator:r,callback:n,cache:i}).then(M).then(o=>o.response)}function ct(t,e=!1){let r=String(t).replace("?head","");var n=T[r];return!n&&!e&&(n=T[r]={phase:null,initial:E(),check:E(),updated:E(),final:E()}),n}async function _({url:t,options:e,validator:r,callback:n,cache:i},o="initial"){let s=new Date;if(i!=null){var a=ct(t);if(lt.indexOf(a.phase)>=lt.indexOf(o))var l=a[o];else a.phase=o}let c=await(l||fetch(t,e));if(!l&&a&&(c.ok?a[o].resolve(c):a[o].reject(new Error("Fetch failed"))),!c.ok)throw new Error("Fetch failed");if((r==null?void 0:r(c))===!1)throw new Error("Response is not valid");let d=new Date(c.headers.get("date"))<s||l&&o=="initial"&&(a.phase=="updated"||a.phase=="check");return await(n==null?void 0:n(c,o,d)),{url:t,options:e,isCached:d,response:c,validator:r,callback:n,cache:i}}async function M(t){let{url:e,isCached:r,options:n,validator:i,response:o,cache:s}=t;if(r){let{response:a}=await _({url:e+"?head",options:{...n,method:"HEAD",cache:"no-cache"},validator:i,cache:s},"check");if(a.headers.get("last-modified")!=o.headers.get("last-modified"))return H(t)}return t}async function H(t){return _({...t,options:{...t.options,cache:"reload"}},"updated")}var g="https://feaas.blob.core.windows.net";function L(t){let e=t.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(e){var[,r,n,i,o,s]=e;return{cdn:r,library:n,component:i,version:o,revision:s}}}function kt(t){if(!t||!t.library||!t.component)throw new Error("Component requires `library` and `component` properties");return`${t.cdn&&t.cdn!=g?`${t.cdn}/components`:""}/${t.library}/${t.component}/${!t.version||t.version=="responsive"&&(!t.revision||t.revision=="published")?"":t.version}/${!t.revision||t.revision=="published"?"":t.revision}`.replace(/(^\/|\/$|\/\/)(?!.+\/components\/)/g,"")}function $t(t){return`${t.cdn&&t.cdn!=g?`${t.cdn}/styles/`:""}${t.library}/${!t.revision||t.revision=="published"?"":t.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function I(t){let e=t.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(e){var[,r,n,i]=e;return{cdn:r,library:n,revision:i}}else{let o=L(t);if(o){var{cdn:r,library:n,revision:i}=o;return i!=null&&i.match(/\d/)&&(i=void 0),{cdn:r,library:n,revision:i}}}}function Z(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...L(t.src)}),`${t.cdn||t.hostname||g}/components/${t.library}/${t.component}/${t.version}/${t.revision||"published"}.html`}function N(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...I(t.src)}),`${t.cdn||t.hostname||g}/styles/${t.library}/${t.revision||"published"}.css`}async function $(t,e,r=!1){let n=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,i=a=>a.clone().text().then(e),o=await Promise.all([t.instance&&_({options:{headers:{Accept:"text/html"},credentials:"omit"},url:Z({...t,version:t.instance}),validator:n}).catch(a=>a),_({url:Z(t),validator:n}).catch(a=>a)]),s=o.find(a=>a&&"isCached"in a&&a);if(!s||s instanceof Error)throw o.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return o[0]==s&&console.log("Using fork!",o),await i(s.response),r?s:M({...s,callback:i}).catch(a=>{if(o[0]==s&&(H({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),M({...o[1],callback:i});throw a})}async function Ot(t){typeof t=="string"&&(t={src:t});var e;let{response:r}=await $(t,n=>{e=n},!0);return{...t,template:e,lastModified:r.headers.get("last-modified")}}async function W(t,e){return typeof t=="string"&&(t={src:t}),V(N(t),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,n)=>r.clone().text().then(i=>e(i,n)))}function Tt(t,e){return ut(t,e||(e=document.createElement("style"))),e}function ut(t,e){return e||(e=document.createElement("style")),W(t,(r,n)=>{e.textContent=r}).then(()=>e)}function z(t,e){var r=dt(t);if(!r)var n=ht(t);return W(t,(i,o)=>{n&&(n.textContent=i),e==null||e(i,o)}).then(()=>r||n)}function Q(t){return new Promise((e,r)=>{z(t,e).catch(r)})}function dt(t){return document.head.querySelector(`style[data-href="${N(t)}"]`)}function ht(t){let e=N(t),r=document.createElement("style");return r.setAttribute("data-href",e),document.head.appendChild(r),r}function Mt(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return b(n,e),r}function Lt(t,e){return ft(t,e||(e=document.createElement("div"))),e}async function ft(t,e){return e||(e=document.createElement("div")),e.childNodes.length?b(e,t.data,t):"template"in t?k(e,t.template,t.data,t):$(t,r=>k(e,r,t.data,t)).then(()=>e)}function pt(t=this){var e,r,n,i,o,s,a,l;let c,d=t.getAttribute("src");if(d){let w=L(d);if(!w)throw new Error(`Could not parse FEAAS Component source: ${d}`);var{cdn:p,library:h,component:u,version:y,revision:A}=w}let C=t.getAttribute("data");if(C!=null&&C!="")try{c=typeof C=="string"?JSON.parse(C):{}}catch(w){}return{data:c||{},cdn:(r=(e=t.getContextAttribute("cdn"))!==null&&e!==void 0?e:p)!==null&&r!==void 0?r:g,library:(n=t.getAttribute("library"))!==null&&n!==void 0?n:h,component:(i=t.getAttribute("component"))!==null&&i!==void 0?i:u,version:(s=(o=t.getAttribute("version"))!==null&&o!==void 0?o:y)!==null&&s!==void 0?s:"responsive",revision:(l=(a=t.getAttribute("revision"))!==null&&a!==void 0?a:A)!==null&&l!==void 0?l:"published",hostname:t.getAttribute("hostname"),template:t.getAttribute("template"),instance:t.getAttribute("instance"),editable:t.getAttribute("editable")!=null,suspended:t.getAttribute("suspended")!=null,lastModified:t.getAttribute("last-modified"),withStylesheet:t.getAttribute("with-stylesheet")!="false"}}var D=class extends v{setData(e){this.set({data:e})}getProps(){return pt(this)}attributeChangedCallback(e,r,n){r!==n&&((e=="library"||e=="component"||e=="revision"||e=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(e,r,n))}getEditor(){var e;return(e=document.querySelector("feaas-context"))===null||e===void 0?void 0:e.refs.editor}constructor(){super(),this.defaultProps={cdn:g,revision:"published",version:"responsive",withStylesheet:!0,editable:!1,suspended:!1},this.onLoad=e=>{this.payload=e,this.advance()},this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let e=this.getEditor();if(e!=null&&e.setTarget(this))return e.open(),!0}getOriginal(){let e=this.getAttribute("data-path-scope");if(e){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==e;)var n=r;return n}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(!this.getOriginal()){if(this.props.withStylesheet)var e=Q({...this.props,revision:"published"}).then(()=>{e=null,this.payload&&this.onLoad(this.payload)});return Promise.all([e,$(this.props,r=>{this.payload=r,e||this.onLoad(r)})]).then(()=>this.payload)}}update(){if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)b(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;k(this,this.payload,this.props.data)}}};D.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];D.register("feaas-component");function yt(t=this){return{opacity:t!=null&&t.getAttribute("opacity")?parseFloat(t==null?void 0:t.getAttribute("opacity")):1,hidden:(t==null?void 0:t.getAttribute("hidden"))!=null}}var F=class extends v{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return yt(this)}attributeChangedCallback(e,r,n){if(r!==n)return e=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),n?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(e,r,n)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
3
3
  #loader {
4
4
  position: absolute;