@sitecore-feaas/clientside 0.1.30 → 0.1.31

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,7 +1,7 @@
1
1
  var tt=Object.defineProperty;var Lt=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var Bt=Object.prototype.hasOwnProperty;var jt=(t,e)=>{for(var r in e)tt(t,r,{get:e[r],enumerable:!0})},Ut=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Nt(e))!Bt.call(t,i)&&i!==r&&tt(t,i,{get:()=>e[i],enumerable:!(n=Lt(e,i))||n.enumerable});return t};var It=t=>Ut(tt({},"__esModule",{value:!0}),t);var he={};jt(he,{Base:()=>b,Component:()=>H,DEFAULT_CDN_URL:()=>w,FEAASBase:()=>b,FEAASComponent:()=>H,FEAASComponentsProps:()=>Dt,FEAASLoader:()=>W,FEAASLoaderProps:()=>Ot,FEAASStylesheet:()=>Q,FEAASStylesheetProps:()=>Pt,JSONPath:()=>f,Loader:()=>W,MyComponent:()=>K,Stylesheet:()=>Q,autoloadScripts:()=>gt,cleanCollectionBit:()=>mt,clearFetchCache:()=>ie,createStylesheet:()=>Rt,fetchAndRevalidate:()=>at,fetchAndRevalidateComponent:()=>k,fetchAndRevalidateStylesheet:()=>V,fetchBypassingCache:()=>Y,fetchCache:()=>B,fetchComponent:()=>se,fetchToValidateCache:()=>j,fetchWithCacheAwareness:()=>R,findStylesheet:()=>xt,getComponentSource:()=>oe,getComponentURL:()=>st,getFetchCache:()=>_t,getStylesheetSource:()=>ae,getStylesheetURL:()=>I,loadScript:()=>N,loadStylesheet:()=>Z,loadStylesheetAllowStale:()=>ct,normalizeCollectionScope:()=>ot,observeDOMElement:()=>bt,parseComponentSource:()=>U,parseStylesheetSource:()=>ut,queryScopes:()=>G,renderComponent:()=>le,renderComponentElement:()=>ce,renderComponentPromise:()=>Ct,renderDOMContent:()=>P,renderDOMElement:()=>A,renderHTMLContent:()=>ne,renderStylesheet:()=>ue,renderStylesheetPromise:()=>Ft,serializeCH1RichText:()=>D,setDOMAttribute:()=>O});module.exports=It(he);function _(t,e=r=>{}){var r;let n=()=>{var i,o;let a=new Promise((u,l)=>{i=c=>{t==null||t(c),u(c)},o=l});var s=Object.assign(a,{resolve:i,reject:o,restart:n,first:r});return r=s,s.catch(e),s};return n()}var Ht=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,b=class extends Ht{getProps(e){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=_(e=>{this.payload=e}),this.whenRendered=_(()=>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:a}=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?a?(this.reactRoot||(this.reactRoot=a.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(a){return{error:a}}componentDidCatch(a,s){console.error(`FEAAS: ${e.tagName} Error:`,a,s),e.onError(a,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(e=this,r){let{React:n,ReactDOM:i}=e.payload||{},o=this.getReactErrorBoundary(),a=this.getReactWrapper(e);return n.createElement(o,{key:e.tagName+"-"+e.getUID(),slot:e.getAttribute("slot")},n.createElement(a,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[a,s]=n.useReducer(u=>u+1,0);return e.forceUpdateReact=s,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 C=class extends b{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)}},K=class extends C{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))}};K.observedAttributes=["counter"];function g(t){return g=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(t)}function ft(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function pt(t,e,r){return e&&dt(t.prototype,e),r&&dt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Wt(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&L(t,e)}function M(t){return M=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},M(t)}function L(t,e){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},L(t,e)}function yt(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function T(t,e,r){return yt()?T=Reflect.construct.bind():T=function(i,o,a){var s=[null];s.push.apply(s,o);var u=Function.bind.apply(i,s),l=new u;return a&&L(l,a.prototype),l},T.apply(null,arguments)}function zt(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function et(t){var e=typeof Map=="function"?new Map:void 0;return et=function(n){if(n===null||!zt(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return T(n,arguments,M(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),L(i,n)},et(t)}function Jt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function qt(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Jt(t)}function Kt(t){var e=yt();return function(){var n=M(t),i;if(e){var o=M(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return qt(this,i)}}function Gt(t){return Yt(t)||Vt(t)||vt(t)||Zt()}function Yt(t){if(Array.isArray(t))return rt(t)}function Vt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function vt(t,e){if(t){if(typeof t=="string")return rt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rt(t,e)}}function rt(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Zt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Qt(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=vt(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
3
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(a)throw s}}}}var m=Object.prototype.hasOwnProperty;function x(t,e){return t=t.slice(),t.push(e),t}function nt(t,e){return e=e.slice(),e.unshift(t),e}var Xt=function(t){Wt(r,t);var e=Kt(r);function r(n){var i;return ft(this,r),i=e.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),i.avoidNew=!0,i.value=n,i.name="NewError",i}return pt(r)}(et(Error));function f(t,e,r,n,i){if(!(this instanceof f))try{return new f(t,e,r,n,i)}catch(u){if(!u.avoidNew)throw u;return u.value}typeof t=="string"&&(i=n,n=r,r=e,e=t,t=null);var o=t&&g(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){var a={path:o?t.path:e};o?"json"in t&&(a.json=t.json):a.json=r;var s=this.evaluate(a);if(!s||g(s)!=="object")throw new Xt(s);return s}}f.prototype.evaluate=function(t,e,r,n){var i=this,o=this.parent,a=this.parentProperty,s=this.flatten,u=this.wrap;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&&g(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().');var l=t;e=l.json,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,u=m.call(t,"wrap")?t.wrap:u,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,o=m.call(t,"parent")?t.parent:o,a=m.call(t,"parentProperty")?t.parentProperty:a,t=t.path}if(o=o||null,a=a||null,Array.isArray(t)&&(t=f.toPathString(t)),!(!t&&t!==""||!e)){var c=f.toPathArray(t);c[0]==="$"&&c.length>1&&c.shift(),this._hasParentSelector=null;var d=this._trace(c,e,["$"],o,a,r).filter(function(h){return h&&!h.isParentSelector});return d.length?!u&&d.length===1&&!d[0].hasArrExpr?this._getPreferredOutput(d[0]):d.reduce(function(h,p){var E=i._getPreferredOutput(p);return s&&Array.isArray(E)?h=h.concat(E):h.push(E),h},[]):u?[]:void 0}};f.prototype._getPreferredOutput=function(t){var e=this.currResultType;switch(e){case"all":{var 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){var 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,a,s){var u=this,l;if(!t.length)return l={path:r,value:e,parent:n,parentProperty:i,hasArrExpr:a},this._handleCallback(l,o,"value"),l;var c=t[0],d=t.slice(1),h=[];function p(y){Array.isArray(y)?y.forEach(function(Mt){h.push(Mt)}):h.push(y)}if((typeof c!="string"||s)&&e&&m.call(e,c))p(this._trace(d,e[c],x(r,c),e,c,o,a));else if(c==="*")this._walk(e,function(y){p(u._trace(d,e[y],x(r,y),e,y,o,!0,!0))});else if(c==="..")p(this._trace(d,e,r,n,i,o,a)),this._walk(e,function(y){g(e[y])==="object"&&p(u._trace(t.slice(),e[y],x(r,y),e,y,o,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:d,isParentSelector:!0};if(c==="~")return l={path:x(r,c),value:i,parent:n,parentProperty:null},this._handleCallback(l,o,"property"),l;if(c==="$")p(this._trace(d,e,r,null,null,o,a));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(c))p(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.");var E=c.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1");this._walk(e,function(y){u._eval(E,e[y],y,r,n,i)&&p(u._trace(d,e[y],x(r,y),e,y,o,!0))})}else if(c[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");p(this._trace(nt(this._eval(c,e,r[r.length-1],r.slice(0,-1),n,i),d),e,r,n,i,o,a))}else if(c[0]==="@"){var v=!1,S=c.slice(1,-2);switch(S){case"scalar":(!e||!["object","function"].includes(g(e)))&&(v=!0);break;case"boolean":case"string":case"undefined":case"function":g(e)===S&&(v=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(v=!0);break;case"number":Number.isFinite(e)&&(v=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(v=!0);break;case"object":e&&g(e)===S&&(v=!0);break;case"array":Array.isArray(e)&&(v=!0);break;case"other":v=this.currOtherTypeCallback(e,r,n,i);break;case"null":e===null&&(v=!0);break;default:throw new TypeError("Unknown value type "+S)}if(v)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))){var z=c.slice(1);p(this._trace(d,e[z],x(r,z),e,z,o,a,!0))}else if(c.includes(",")){var kt=c.split(","),J=Qt(kt),ht;try{for(J.s();!(ht=J.n()).done;){var $t=ht.value;p(this._trace(nt($t,d),e,r,n,i,o,!0))}}catch(y){J.e(y)}finally{J.f()}}else!s&&e&&m.call(e,c)&&p(this._trace(d,e[c],x(r,c),e,c,o,a,!0))}if(this._hasParentSelector)for(var F=0;F<h.length;F++){var q=h[F];if(q&&q.isParentSelector){var $=this._trace(q.expr,e,q.path,n,i,o,a);if(Array.isArray($)){h[F]=$[0];for(var Tt=$.length,X=1;X<Tt;X++)F++,h.splice(F,0,$[X])}else h[F]=$}}return h};f.prototype._walk=function(t,e){if(Array.isArray(t))for(var r=t.length,n=0;n<r;n++)e(n);else t&&g(t)==="object"&&Object.keys(t).forEach(function(i){e(i)})};f.prototype._slice=function(t,e,r,n,i,o,a){if(Array.isArray(r)){var s=r.length,u=t.split(":"),l=u[2]&&Number.parseInt(u[2])||1,c=u[0]&&Number.parseInt(u[0])||0,d=u[1]&&Number.parseInt(u[1])||s;c=c<0?Math.max(0,c+s):Math.min(s,c),d=d<0?Math.max(0,d+s):Math.min(s,d);for(var h=[],p=c;p<d;p+=l){var E=this._trace(nt(p,e),r,n,i,o,a,!0);E.forEach(function(v){h.push(v)})}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;var a=t.includes("@path");a&&(this.currSandbox._$_path=f.toPathString(n.concat([r])));var s="script:"+t;if(!f.cache[s]){var u=t.replace(/@parentProperty/g,"_$_parentProperty").replace(/@parent/g,"_$_parent").replace(/@property/g,"_$_property").replace(/@root/g,"_$_root").replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1");a&&(u=u.replace(/@path/g,"_$_path")),f.cache[s]=new this.vm.Script(u)}try{return f.cache[s].runInNewContext(this.currSandbox)}catch(l){throw new Error("jsonPath: "+l.message+": "+t)}};f.cache={};f.toPathString=function(t){for(var e=t,r=e.length,n="$",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[i])||(n+=/^[\*0-9]+$/.test(e[i])?"["+e[i]+"]":"['"+e[i]+"']");return n};f.toPointer=function(t){for(var e=t,r=e.length,n="",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[i])||(n+="/"+e[i].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return n};f.toPathArray=function(t){var e=f.cache;if(e[t])return e[t].concat();var r=[],n=t.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,";$&;").replace(/['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))['\]]/g,function(o,a){return"[#"+(r.push(a)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(o,a){return"['"+a.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(o,a){return";"+a.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),i=n.split(";").map(function(o){var a=o.match(/#([0-9]+)/);return!a||!a[1]?o:r[a[1]]});return e[t]=i,e[t].concat()};var te=function(e,r,n){for(var i=e.length,o=0;o<i;o++){var a=e[o];n(a)&&r.push(e.splice(o--,1)[0])}},ee=function(){function t(e){ft(this,t),this.code=e}return pt(t,[{key:"runInNewContext",value:function(r){var n=this.code,i=Object.keys(r),o=[];te(i,o,function(c){return typeof r[c]=="function"});var a=i.map(function(c,d){return r[c]}),s=o.reduce(function(c,d){var h=r[d].toString();return/function/.test(h)||(h="function "+h),"var "+d+"="+h+";"+c},"");n=s+n,!/(["'])use strict\1/.test(n)&&!i.includes("arguments")&&(n="var arguments = undefined;"+n),n=n.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var u=n.lastIndexOf(";"),l=u>-1?n.slice(0,u+1)+" return "+n.slice(u+1):" return "+n;return T(Function,i.concat([l])).apply(void 0,Gt(a))}}]),t}();f.prototype.vm={Script:ee};function mt(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function ot(t){return mt(t)+".*"}function G(t,e,r=!1,n=t){var i=e;let o=Object.keys(t).sort((s,u)=>u.length-s.length);for(let s of o)if(e.startsWith(s)){if(s==e){if(r)return t[s];continue}i=e.substring(s.length+1),n=t[s];break}var a=f({path:i,json:n});return Array.isArray(a)&&(a==null?void 0:a.length)==0&&(a=[i.replace(/^.*?\./,"_."),i.replace(/^.*?\./,""),i.replace(/^([^.]+).*?\.\$\./,"$1."),i.replace(/^.*?\.\$\./,"_."),i.replace(/^.*?\.\$\./,""),i.replace(/^[^.]+$/,"_")].filter((s,u,l)=>l.indexOf(s)===u).reduce((s,u)=>s.length>0?s:f({path:u,json:n}),[])),r&&Array.isArray(a)?a[0]:a}function it(t,e={},r){return r?`<${r}${Object.entries(e).map(([n,i])=>i!=null&&` ${n}="${i}"`).filter(Boolean).join("")}>${D(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):D(t)}function D(t){var e;if(Array.isArray(t))return t.map(D).join(`
4
- `).trim();if(typeof t=="string")return t;if(t==null)return"";switch(t.type){case"heading":let{level:r,...n}=t.attrs;return it(t.content,n,"h"+r);case"text":return(t.marks||[]).reduce((i,o)=>it(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 it(t.content||t.text,t.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[t.type])}}function bt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&N(i,o),n.addedNodes&&n.addedNodes.forEach(a=>{a.nodeType==1&&gt(a,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function gt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];N(i,i.getAttribute("data-embed-src"))}if(e)return bt(t)}function N(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 wt(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 re(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var i=wt(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 a=i+1,s=t,u=t;u=u.nextElementSibling;)u.getAttribute("data-path-scope")==n&&(a++,s=u);for(var l=a;l<e;l++)o.insertBefore(s.cloneNode(!0),s.nextElementSibling);for(var l=Math.max(1,e);l<a;l++)s=s.previousElementSibling,o.removeChild(s.nextElementSibling)}}function O(t,e,r,n){var i;if(t){var o=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=D(r)),n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(t,e,r));var a=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")a="innerHTML";else if(e=="data-embed-src")N(t,r);else if(e=="data-path-attributes"){let d=((i=t.getAttribute("data-attributes-keys"))===null||i===void 0?void 0:i.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var s in r){var u=r[s];O(t,s,typeof u=="object"&&u?JSON.stringify(u):u,n)}for(var l=0;l<d.length;l++)(r==null||!(d[l]in r))&&O(t,d[l],null,n);O(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var c=String(t.getAttribute("data-path-placeholder")||o[a]);r!=null?a=="innerHTML"?o.innerHTML!=r&&(o.innerHTML=r):o.getAttribute(a)!=r&&o.setAttribute(a,r):a=="innerHTML"?o.innerHTML=c:o.removeAttribute(a)}}}var At=["data-attributes-keys","data-path-attributes","data-path-scope"];function A(t,e,r,n){var i,o,a;let s=t;if(n||(e=((i=r==null?void 0:r.processData)===null||i===void 0?void 0:i.call(r,s,e))||e),s.nodeType==1){let c=s.getAttribute("data-path-scope");if(c){let h=wt(s),p=G(e,c,!1)||[];h==0&&re(s,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,s,p))===!1?1:p.length,r),e={...e,[ot(c)]:p[h]}}let d=Array.prototype.slice.call(s.attributes).sort((h,p)=>At.indexOf(h.name)-At.indexOf(p.name));for(var u=0;u<d.length;u++){let{name:h,value:p}=d[u];h.startsWith("data-path")&&h!="data-path-scope"&&O(s,h,G(e,p,!0),r),h=="data-embed-src"&&O(s,h,s.getAttribute(h),r)}}for(var u=0,l;l=s.childNodes[u++];)Et(l)&&A(l,e,r,!0);return n||(a=r==null?void 0:r.onRender)===null||a===void 0||a.call(r,s,e),s}function Et(t){return t.nodeType==1}function P(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 s=0,u;u=t.childNodes[s++];)Et(u)&&(u.className=u.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return A(t,r,n)}function ne(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:a}=require("linkedom"),{document:s}=a(o);return A(s,e,r).toString()}else{let a=document.createElement("div");return a.innerHTML=o,A(a,e,r),a.innerHTML}}var St=["initial","check","updated"],B={};function ie(){B={}}async function at(t,e,r,n,i=B){return R({url:t,options:e,validator:r,callback:n,cache:i}).then(j).then(o=>o.response)}function _t(t,e=!1){let r=String(t).replace("?head","");var n=B[r];return!n&&!e&&(n=B[r]={phase:null,initial:_(),check:_(),updated:_(),final:_()}),n}async function R({url:t,options:e,validator:r,callback:n,cache:i},o="initial"){let a=new Date;if(i!=null){var s=_t(t);if(St.indexOf(s.phase)>=St.indexOf(o))var u=s[o];else s.phase=o}let l=await(u||fetch(t,e));if(!u&&s&&(l.ok?s[o].resolve(l):s[o].reject(new Error("Fetch failed"))),!l.ok)throw new Error("Fetch failed");if((r==null?void 0:r(l))===!1)throw new Error("Response is not valid");let c=new Date(l.headers.get("date"))<a||u&&o=="initial"&&(s.phase=="updated"||s.phase=="check");return await(n==null?void 0:n(l,o)),{url:t,options:e,isCached:c,response:l,validator:r,callback:n,cache:i}}async function j(t){let{url:e,isCached:r,options:n,validator:i,response:o,cache:a}=t;if(r){let{response:s}=await R({url:e+"?head",options:{...n,method:"HEAD",cache:"no-cache"},validator:i,cache:a},"check");if(s.headers.get("last-modified")!=o.headers.get("last-modified"))return Y(t)}return t}async function Y(t){return R({...t,options:{...t.options,cache:"reload"}},"updated")}var w="https://feaascomponentsapidev.blob.core.windows.net";function U(t){let e=t.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/([^\/]+?)(?:\.html?)?)?)?$/);if(e){var[,r,n,i,o,a]=e;return{cdn:r,library:n,component:i,version:o,revision:a}}}function oe(t){if(!t||!t.library||!t.component)throw new Error("Component requires `library` and `component` properties");return`${t.cdn&&t.cdn!=w?`${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 ae(t){return`${t.cdn&&t.cdn!=w?`${t.cdn}/styles`:""}/${t.library}/${t.revision=="published"?"":t.revision}`.replace(/^\/|\/$|(?<!:)\/\//g,"")}function ut(t){let e=t.match(/^(?:(.*?)\/styles)?\/([^\/]+)\/([^\/]+)(?:.css?)?$/);if(e){var[,r,n,i]=e;return{cdn:r,library:n,revision:i}}}function st(t){return"src"in t&&(t={...U(t.src)}),`${t.cdn||t.hostname||w}/components/${t.library}/${t.component}/${t.version}/${t.revision||"published"}.html`}function I(t){return"src"in t&&(t={...U(t.src)}),`${t.cdn||t.hostname||w}/styles/${t.library}/${t.revision||"published"}.css`}async function k(t,e,r=!1){let n=s=>s.headers.get("x-ms-meta-versionDeletedAt")==null,i=s=>s.clone().text().then(e),o=await Promise.all([t.instance&&R({options:{headers:{Accept:"text/html"}},url:st({...t,version:t.instance}),validator:n}).catch(s=>s),R({url:st(t),validator:n}).catch(s=>s)]),a=o.find(s=>s&&"isCached"in s&&s);if(!a||a instanceof Error)throw o.find(u=>u&&u instanceof Error)||new Error("Can not fetch component");return o[0]==a&&console.log("Using fork!",o),await i(a.response),r?a:j({...a,callback:i}).catch(s=>{if(o[0]==a&&(Y({...a,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),j({...o[1],callback:i});throw s})}async function se(t){typeof t=="string"&&(t={src:t});var e;let{response:r}=await k(t,n=>{e=n},!0);return{...t,template:e,lastModified:r.headers.get("last-modified")}}async function V(t,e){return typeof t=="string"&&(t={src:t}),at(I(t),{headers:{Accept:"text/css"}},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,n)=>r.clone().text().then(i=>e(i,n)))}function ue(t,e){return Ft(t,e||(e=document.createElement("style"))),e}function Ft(t,e){return e||(e=document.createElement("style")),V(t,(r,n)=>{e.textContent=r}).then(()=>e)}function Z(t,e){var r=xt(t);if(!r)var n=Rt(t);return V({...t},(i,o)=>{n&&(n.textContent=i),e==null||e(i,o)}).then(()=>r||n)}function ct(t){return new Promise((e,r)=>{Z(t,e).catch(r)})}function xt(t){return document.head.querySelector(`style[data-href="${I(t)}"]`)}function Rt(t){let e=I(t),r=document.createElement("style");return r.setAttribute("data-href",e),document.head.appendChild(r),r}function ce(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return A(n,e),r}function le(t,e){return Ct(t,e||(e=document.createElement("div"))),e}async function Ct(t,e){return e||(e=document.createElement("div")),e.childNodes.length?A(e,t.data,t):"template"in t?P(e,t.template,t.data,t):k(t,r=>P(e,r,t.data,t)).then(()=>e)}function Dt(t=this){var e,r,n,i,o,a,s,u;let l,c=t.getAttribute("src");if(c)var{cdn:d,library:h,component:p,version:E,revision:v}=U(c);let S=t.getAttribute("data");if(S!=null&&S!="")try{l=typeof S=="string"?JSON.parse(S):{}}catch(z){}return{data:l||{},cdn:(r=(e=t.getContextAttribute("cdn"))!==null&&e!==void 0?e:d)!==null&&r!==void 0?r:w,library:(n=t.getAttribute("library"))!==null&&n!==void 0?n:h,component:(i=t.getAttribute("component"))!==null&&i!==void 0?i:p,version:(a=(o=t.getAttribute("version"))!==null&&o!==void 0?o:E)!==null&&a!==void 0?a:"responsive",revision:(u=(s=t.getAttribute("revision"))!==null&&s!==void 0?s:v)!==null&&u!==void 0?u:"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 H=class extends b{setData(e){this.set({data:e})}getProps(){return Dt(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:w,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=ct({...this.props,revision:"published"}).then(()=>{e=null,this.payload&&this.onLoad(this.payload)});return Promise.all([e,k(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)A(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;P(this,this.payload,this.props.data)}}};H.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];H.register("feaas-component");function Ot(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 W=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Ot(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=`
4
+ `).trim();if(typeof t=="string")return t;if(t==null)return"";switch(t.type){case"heading":let{level:r,...n}=t.attrs;return it(t.content,n,"h"+r);case"text":return(t.marks||[]).reduce((i,o)=>it(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 it(t.content||t.text,t.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[t.type])}}function bt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&N(i,o),n.addedNodes&&n.addedNodes.forEach(a=>{a.nodeType==1&&gt(a,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function gt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];N(i,i.getAttribute("data-embed-src"))}if(e)return bt(t)}function N(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 wt(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 re(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var i=wt(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 a=i+1,s=t,u=t;u=u.nextElementSibling;)u.getAttribute("data-path-scope")==n&&(a++,s=u);for(var l=a;l<e;l++)o.insertBefore(s.cloneNode(!0),s.nextElementSibling);for(var l=Math.max(1,e);l<a;l++)s=s.previousElementSibling,o.removeChild(s.nextElementSibling)}}function O(t,e,r,n){var i;if(t){var o=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=D(r)),n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(t,e,r));var a=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")a="innerHTML";else if(e=="data-embed-src")N(t,r);else if(e=="data-path-attributes"){let d=((i=t.getAttribute("data-attributes-keys"))===null||i===void 0?void 0:i.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var s in r){var u=r[s];O(t,s,typeof u=="object"&&u?JSON.stringify(u):u,n)}for(var l=0;l<d.length;l++)(r==null||!(d[l]in r))&&O(t,d[l],null,n);O(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var c=String(t.getAttribute("data-path-placeholder")||o[a]);r!=null?a=="innerHTML"?o.innerHTML!=r&&(o.innerHTML=r):o.getAttribute(a)!=r&&o.setAttribute(a,r):a=="innerHTML"?o.innerHTML=c:o.removeAttribute(a)}}}var At=["data-attributes-keys","data-path-attributes","data-path-scope"];function A(t,e,r,n){var i,o,a;let s=t;if(n||(e=((i=r==null?void 0:r.processData)===null||i===void 0?void 0:i.call(r,s,e))||e),s.nodeType==1){let c=s.getAttribute("data-path-scope");if(c){let h=wt(s),p=G(e,c,!1)||[];h==0&&re(s,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,s,p))===!1?1:p.length,r),e={...e,[ot(c)]:p[h]}}let d=Array.prototype.slice.call(s.attributes).sort((h,p)=>At.indexOf(h.name)-At.indexOf(p.name));for(var u=0;u<d.length;u++){let{name:h,value:p}=d[u];h.startsWith("data-path")&&h!="data-path-scope"&&O(s,h,G(e,p,!0),r),h=="data-embed-src"&&O(s,h,s.getAttribute(h),r)}}for(var u=0,l;l=s.childNodes[u++];)Et(l)&&A(l,e,r,!0);return n||(a=r==null?void 0:r.onRender)===null||a===void 0||a.call(r,s,e),s}function Et(t){return t.nodeType==1}function P(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 s=0,u;u=t.childNodes[s++];)Et(u)&&(u.className=u.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return A(t,r,n)}function ne(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:a}=require("linkedom"),{document:s}=a(o);return A(s,e,r).toString()}else{let a=document.createElement("div");return a.innerHTML=o,A(a,e,r),a.innerHTML}}var St=["initial","check","updated"],B={};function ie(){B={}}async function at(t,e,r,n,i=B){return R({url:t,options:e,validator:r,callback:n,cache:i}).then(j).then(o=>o.response)}function _t(t,e=!1){let r=String(t).replace("?head","");var n=B[r];return!n&&!e&&(n=B[r]={phase:null,initial:_(),check:_(),updated:_(),final:_()}),n}async function R({url:t,options:e,validator:r,callback:n,cache:i},o="initial"){let a=new Date;if(i!=null){var s=_t(t);if(St.indexOf(s.phase)>=St.indexOf(o))var u=s[o];else s.phase=o}let l=await(u||fetch(t,e));if(!u&&s&&(l.ok?s[o].resolve(l):s[o].reject(new Error("Fetch failed"))),!l.ok)throw new Error("Fetch failed");if((r==null?void 0:r(l))===!1)throw new Error("Response is not valid");let c=new Date(l.headers.get("date"))<a||u&&o=="initial"&&(s.phase=="updated"||s.phase=="check");return await(n==null?void 0:n(l,o)),{url:t,options:e,isCached:c,response:l,validator:r,callback:n,cache:i}}async function j(t){let{url:e,isCached:r,options:n,validator:i,response:o,cache:a}=t;if(r){let{response:s}=await R({url:e+"?head",options:{...n,method:"HEAD",cache:"no-cache"},validator:i,cache:a},"check");if(s.headers.get("last-modified")!=o.headers.get("last-modified"))return Y(t)}return t}async function Y(t){return R({...t,options:{...t.options,cache:"reload"}},"updated")}var w="https://feaascomponentsapidev.blob.core.windows.net";function U(t){let e=t.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/([^\/]+?)(?:\.html?)?)?)?$/);if(e){var[,r,n,i,o,a]=e;return{cdn:r,library:n,component:i,version:o,revision:a}}}function oe(t){if(!t||!t.library||!t.component)throw new Error("Component requires `library` and `component` properties");return`${t.cdn&&t.cdn!=w?`${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 ae(t){return`${t.cdn&&t.cdn!=w?`${t.cdn}/styles`:""}/${t.library}/${t.revision=="published"?"":t.revision}`.replace(/^\/|\/$|(?<!:)\/\//g,"")}function ut(t){let e=t.match(/^(?:(.*?)\/styles)?\/([^\/]+)\/([^\/]+)(?:.css?)?$/);if(e){var[,r,n,i]=e;return{cdn:r,library:n,revision:i}}}function st(t){return"src"in t&&(t={...U(t.src)}),`${t.cdn||t.hostname||w}/components/${t.library}/${t.component}/${t.version}/${t.revision||"published"}.html`}function I(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...U(t.src)}),`${t.cdn||t.hostname||w}/styles/${t.library}/${t.revision||"published"}.css`}async function k(t,e,r=!1){let n=s=>s.headers.get("x-ms-meta-versionDeletedAt")==null,i=s=>s.clone().text().then(e),o=await Promise.all([t.instance&&R({options:{headers:{Accept:"text/html"}},url:st({...t,version:t.instance}),validator:n}).catch(s=>s),R({url:st(t),validator:n}).catch(s=>s)]),a=o.find(s=>s&&"isCached"in s&&s);if(!a||a instanceof Error)throw o.find(u=>u&&u instanceof Error)||new Error("Can not fetch component");return o[0]==a&&console.log("Using fork!",o),await i(a.response),r?a:j({...a,callback:i}).catch(s=>{if(o[0]==a&&(Y({...a,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),j({...o[1],callback:i});throw s})}async function se(t){typeof t=="string"&&(t={src:t});var e;let{response:r}=await k(t,n=>{e=n},!0);return{...t,template:e,lastModified:r.headers.get("last-modified")}}async function V(t,e){return typeof t=="string"&&(t={src:t}),at(I(t),{headers:{Accept:"text/css"}},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,n)=>r.clone().text().then(i=>e(i,n)))}function ue(t,e){return Ft(t,e||(e=document.createElement("style"))),e}function Ft(t,e){return e||(e=document.createElement("style")),V(t,(r,n)=>{e.textContent=r}).then(()=>e)}function Z(t,e){var r=xt(t);if(!r)var n=Rt(t);return V(t,(i,o)=>{n&&(n.textContent=i),e==null||e(i,o)}).then(()=>r||n)}function ct(t){return new Promise((e,r)=>{Z(t,e).catch(r)})}function xt(t){return document.head.querySelector(`style[data-href="${I(t)}"]`)}function Rt(t){let e=I(t),r=document.createElement("style");return r.setAttribute("data-href",e),document.head.appendChild(r),r}function ce(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return A(n,e),r}function le(t,e){return Ct(t,e||(e=document.createElement("div"))),e}async function Ct(t,e){return e||(e=document.createElement("div")),e.childNodes.length?A(e,t.data,t):"template"in t?P(e,t.template,t.data,t):k(t,r=>P(e,r,t.data,t)).then(()=>e)}function Dt(t=this){var e,r,n,i,o,a,s,u;let l,c=t.getAttribute("src");if(c)var{cdn:d,library:h,component:p,version:E,revision:v}=U(c);let S=t.getAttribute("data");if(S!=null&&S!="")try{l=typeof S=="string"?JSON.parse(S):{}}catch(z){}return{data:l||{},cdn:(r=(e=t.getContextAttribute("cdn"))!==null&&e!==void 0?e:d)!==null&&r!==void 0?r:w,library:(n=t.getAttribute("library"))!==null&&n!==void 0?n:h,component:(i=t.getAttribute("component"))!==null&&i!==void 0?i:p,version:(a=(o=t.getAttribute("version"))!==null&&o!==void 0?o:E)!==null&&a!==void 0?a:"responsive",revision:(u=(s=t.getAttribute("revision"))!==null&&s!==void 0?s:v)!==null&&u!==void 0?u:"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 H=class extends b{setData(e){this.set({data:e})}getProps(){return Dt(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:w,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=ct({...this.props,revision:"published"}).then(()=>{e=null,this.payload&&this.onLoad(this.payload)});return Promise.all([e,k(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)A(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;P(this,this.payload,this.props.data)}}};H.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];H.register("feaas-component");function Ot(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 W=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Ot(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=`
5
5
  #loader {
6
6
  position: absolute;
7
7
  top: 0;