@sitecore-feaas/clientside 0.1.31 → 0.1.32

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
- var yt=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var ne=Object.prototype.hasOwnProperty;var oe=(t,e)=>{for(var r in e)yt(t,r,{get:e[r],enumerable:!0})},se=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ie(e))!ne.call(t,n)&&n!==r&&yt(t,n,{get:()=>e[n],enumerable:!(i=re(e,n))||i.enumerable});return t};var ae=t=>se(yt({},"__esModule",{value:!0}),t);var De={};oe(De,{Base:()=>y,Component:()=>Q,DEFAULT_CDN_URL:()=>_,FEAASBase:()=>y,FEAASComponent:()=>Q,FEAASComponentsProps:()=>Jt,FEAASContext:()=>rt,FEAASContextProps:()=>Xt,FEAASEditor:()=>tt,FEAASEditorProps:()=>Zt,FEAASLoader:()=>X,FEAASLoaderProps:()=>Kt,FEAASPicker:()=>et,FEAASPickerProps:()=>Qt,FEAASStylesheet:()=>dt,FEAASStylesheetProps:()=>Gt,JSONPath:()=>f,Loader:()=>X,MyComponent:()=>st,Stylesheet:()=>dt,autoloadScripts:()=>$t,cleanCollectionBit:()=>Lt,clearFetchCache:()=>xe,createStylesheet:()=>Vt,fetchAndRevalidate:()=>wt,fetchAndRevalidateComponent:()=>U,fetchAndRevalidateStylesheet:()=>ut,fetchBypassingCache:()=>lt,fetchCache:()=>K,fetchComponent:()=>_e,fetchToValidateCache:()=>G,fetchWithCacheAwareness:()=>M,findStylesheet:()=>zt,getComponentSource:()=>Se,getComponentURL:()=>Ct,getFetchCache:()=>Wt,getFramePosition:()=>Yt,getStylesheetSource:()=>Re,getStylesheetURL:()=>Z,loadScript:()=>J,loadStylesheet:()=>ct,loadStylesheetAllowStale:()=>St,normalizeCollectionScope:()=>Et,observeDOMElement:()=>Nt,parseComponentSource:()=>Y,parseStylesheetSource:()=>xt,queryScopes:()=>at,renderComponent:()=>Pe,renderComponentElement:()=>ke,renderComponentPromise:()=>qt,renderDOMContent:()=>I,renderDOMElement:()=>R,renderHTMLContent:()=>Ce,renderStylesheet:()=>Fe,renderStylesheetPromise:()=>Ht,serializeCH1RichText:()=>$,setDOMAttribute:()=>B});module.exports=ae(De);function k(t,e=r=>{}){var r;let i=()=>{var n,o;let s=new Promise((l,c)=>{n=u=>{t==null||t(u),l(u)},o=c});var a=Object.assign(s,{resolve:n,reject:o,restart:i,first:r});return r=a,a.catch(e),a};return i()}var le=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,y=class extends le{getProps(e){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=k(e=>{this.payload=e}),this.whenRendered=k(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(e,r,i){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 i;return(i=r.mount)===null||i===void 0?void 0:i.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(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.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,i;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&&((i=e.refs).parentReact||(i.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",i=!1){let n=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:e});if(this.dispatchEvent(n),this.whenLoaded.reject(e),!n.defaultPrevented&&!i){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 i=(r=(e=this.payload)===null||e===void 0?void 0:e.ReactDOM)===null||r===void 0?void 0:r.flushSync;i?i(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var e,r,i;if(this.payload==null||!this.render)return;let{React:n,ReactDOM:o,ReactDOMClient:s}=this.payload||{};if(!n)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):(i=(r=this.refs.topReact).forceUpdateReact)===null||i===void 0||i.call(r)}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let i=this.descendants.filter(n=>n.refs.parentReact==this&&n.payload).map((n,o)=>this.getReactElement(n));return this.render({...this.props,children:i},this.payload)}getReactErrorBoundary(e=this,r=e.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:i,ReactDOM:n}=e.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends i.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:i,ReactDOM:n}=e.payload||{},o=this.getReactErrorBoundary(),s=this.getReactWrapper(e);return i.createElement(o,{key:e.tagName+"-"+e.getUID(),slot:e.getAttribute("slot")},i.createElement(s,null))}getReactWrapper(e=this,r=e.tagName){if(e.reactWrapper)return e.reactWrapper;let{React:i,ReactDOM:n}=e.payload||{};return e.reactWrapper=o=>{if(e.render){let[s,a]=i.useReducer(l=>l+1,0);return e.forceUpdateReact=a,n.createPortal(i.createElement(i.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 i=this.props[r],n=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();i==null||i===this.defaultProps[r]?this.removeAttribute(n):(typeof i=="string"||typeof i=="number"||typeof i=="boolean")&&this.getAttribute(n)!=String(i)&&this.setAttribute(n,String(i))}}catch(i){this.whenRendered.reject(i),this.onError(i,"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 i=this;i=i.parentElement||(i.parentNode instanceof ShadowRoot?i.parentNode.host:null);)if(i.getAttribute(e)!=null)return i.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 N=class extends y{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)}},st=class extends N{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:e},{React:r}){let[i,n]=r.useState(0);return r.useEffect(()=>{n(o=>o+1)},[e]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",e),r.createElement("p",null,"Triggered updates: ",i))}};st.observedAttributes=["counter"];function S(t){return S=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},S(t)}function Dt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Pt(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Ot(t,e,r){return e&&Pt(t.prototype,e),r&&Pt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ue(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&&q(t,e)}function V(t){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},V(t)}function q(t,e){return q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,n){return i.__proto__=n,i},q(t,e)}function Mt(){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 z(t,e,r){return Mt()?z=Reflect.construct.bind():z=function(n,o,s){var a=[null];a.push.apply(a,o);var l=Function.bind.apply(n,a),c=new l;return s&&q(c,s.prototype),c},z.apply(null,arguments)}function ce(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function bt(t){var e=typeof Map=="function"?new Map:void 0;return bt=function(i){if(i===null||!ce(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(i))return e.get(i);e.set(i,n)}function n(){return z(i,arguments,V(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),q(n,i)},bt(t)}function de(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function he(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 de(t)}function pe(t){var e=Mt();return function(){var i=V(t),n;if(e){var o=V(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return he(this,n)}}function fe(t){return ve(t)||ye(t)||Tt(t)||be()}function ve(t){if(Array.isArray(t))return mt(t)}function ye(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Tt(t,e){if(t){if(typeof t=="string")return mt(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 mt(t,e)}}function mt(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function be(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
1
+ var bt=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var ne=Object.prototype.hasOwnProperty;var oe=(t,e)=>{for(var r in e)bt(t,r,{get:e[r],enumerable:!0})},se=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ie(e))!ne.call(t,n)&&n!==r&&bt(t,n,{get:()=>e[n],enumerable:!(i=re(e,n))||i.enumerable});return t};var ae=t=>se(bt({},"__esModule",{value:!0}),t);var De={};oe(De,{Base:()=>y,Component:()=>Z,DEFAULT_CDN_URL:()=>_,FEAASBase:()=>y,FEAASComponent:()=>Z,FEAASComponentsProps:()=>Jt,FEAASContext:()=>et,FEAASContextProps:()=>Xt,FEAASEditor:()=>X,FEAASEditorProps:()=>Zt,FEAASLoader:()=>Q,FEAASLoaderProps:()=>Kt,FEAASPicker:()=>tt,FEAASPickerProps:()=>Qt,FEAASStylesheet:()=>ht,FEAASStylesheetProps:()=>Gt,JSONPath:()=>f,Loader:()=>Q,MyComponent:()=>ot,Stylesheet:()=>ht,autoloadScripts:()=>$t,cleanCollectionBit:()=>Lt,clearFetchCache:()=>xe,createStylesheet:()=>Vt,fetchAndRevalidate:()=>Ct,fetchAndRevalidateComponent:()=>U,fetchAndRevalidateStylesheet:()=>ct,fetchBypassingCache:()=>at,fetchCache:()=>K,fetchComponent:()=>_e,fetchToValidateCache:()=>G,fetchWithCacheAwareness:()=>M,findStylesheet:()=>zt,getComponentSource:()=>Se,getComponentURL:()=>xt,getFetchCache:()=>Wt,getFramePosition:()=>Yt,getStylesheetSource:()=>Re,getStylesheetURL:()=>Y,loadScript:()=>J,loadStylesheet:()=>dt,loadStylesheetAllowStale:()=>St,normalizeCollectionScope:()=>wt,observeDOMElement:()=>Nt,parseComponentSource:()=>lt,parseStylesheetSource:()=>ut,queryScopes:()=>st,renderComponent:()=>Pe,renderComponentElement:()=>ke,renderComponentPromise:()=>qt,renderDOMContent:()=>I,renderDOMElement:()=>R,renderHTMLContent:()=>Ce,renderStylesheet:()=>Fe,renderStylesheetPromise:()=>Ht,serializeCH1RichText:()=>$,setDOMAttribute:()=>B});module.exports=ae(De);function k(t,e=r=>{}){var r;let i=()=>{var n,o;let s=new Promise((l,c)=>{n=u=>{t==null||t(u),l(u)},o=c});var a=Object.assign(s,{resolve:n,reject:o,restart:i,first:r});return r=a,a.catch(e),a};return i()}var le=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,y=class extends le{getProps(e){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=k(e=>{this.payload=e}),this.whenRendered=k(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(e,r,i){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 i;return(i=r.mount)===null||i===void 0?void 0:i.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(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.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,i;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&&((i=e.refs).parentReact||(i.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",i=!1){let n=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:e});if(this.dispatchEvent(n),this.whenLoaded.reject(e),!n.defaultPrevented&&!i){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 i=(r=(e=this.payload)===null||e===void 0?void 0:e.ReactDOM)===null||r===void 0?void 0:r.flushSync;i?i(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var e,r,i;if(this.payload==null||!this.render)return;let{React:n,ReactDOM:o,ReactDOMClient:s}=this.payload||{};if(!n)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):(i=(r=this.refs.topReact).forceUpdateReact)===null||i===void 0||i.call(r)}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let i=this.descendants.filter(n=>n.refs.parentReact==this&&n.payload).map((n,o)=>this.getReactElement(n));return this.render({...this.props,children:i},this.payload)}getReactErrorBoundary(e=this,r=e.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:i,ReactDOM:n}=e.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends i.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:i,ReactDOM:n}=e.payload||{},o=this.getReactErrorBoundary(),s=this.getReactWrapper(e);return i.createElement(o,{key:e.tagName+"-"+e.getUID(),slot:e.getAttribute("slot")},i.createElement(s,null))}getReactWrapper(e=this,r=e.tagName){if(e.reactWrapper)return e.reactWrapper;let{React:i,ReactDOM:n}=e.payload||{};return e.reactWrapper=o=>{if(e.render){let[s,a]=i.useReducer(l=>l+1,0);return e.forceUpdateReact=a,n.createPortal(i.createElement(i.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 i=this.props[r],n=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();i==null||i===this.defaultProps[r]?this.removeAttribute(n):(typeof i=="string"||typeof i=="number"||typeof i=="boolean")&&this.getAttribute(n)!=String(i)&&this.setAttribute(n,String(i))}}catch(i){this.whenRendered.reject(i),this.onError(i,"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 i=this;i=i.parentElement||(i.parentNode instanceof ShadowRoot?i.parentNode.host:null);)if(i.getAttribute(e)!=null)return i.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 N=class extends y{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)}},ot=class extends N{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:e},{React:r}){let[i,n]=r.useState(0);return r.useEffect(()=>{n(o=>o+1)},[e]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",e),r.createElement("p",null,"Triggered updates: ",i))}};ot.observedAttributes=["counter"];function S(t){return S=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},S(t)}function Dt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Pt(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Ot(t,e,r){return e&&Pt(t.prototype,e),r&&Pt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function ue(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&&q(t,e)}function V(t){return V=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},V(t)}function q(t,e){return q=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,n){return i.__proto__=n,i},q(t,e)}function Mt(){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 z(t,e,r){return Mt()?z=Reflect.construct.bind():z=function(n,o,s){var a=[null];a.push.apply(a,o);var l=Function.bind.apply(n,a),c=new l;return s&&q(c,s.prototype),c},z.apply(null,arguments)}function ce(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function mt(t){var e=typeof Map=="function"?new Map:void 0;return mt=function(i){if(i===null||!ce(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(i))return e.get(i);e.set(i,n)}function n(){return z(i,arguments,V(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),q(n,i)},mt(t)}function de(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function he(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 de(t)}function pe(t){var e=Mt();return function(){var i=V(t),n;if(e){var o=V(this).constructor;n=Reflect.construct(i,arguments,o)}else n=i.apply(this,arguments);return he(this,n)}}function fe(t){return ve(t)||ye(t)||Tt(t)||be()}function ve(t){if(Array.isArray(t))return gt(t)}function ye(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Tt(t,e){if(t){if(typeof t=="string")return gt(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 gt(t,e)}}function gt(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function be(){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 me(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Tt(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var i=0,n=function(){};return{s:n,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(l){throw l},f:n}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return o=l.done,l},e:function(l){s=!0,a=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}var g=Object.prototype.hasOwnProperty;function O(t,e){return t=t.slice(),t.push(e),t}function gt(t,e){return e=e.slice(),e.unshift(t),e}var ge=function(t){ue(r,t);var e=pe(r);function r(i){var n;return Dt(this,r),n=e.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),n.avoidNew=!0,n.value=i,n.name="NewError",n}return Ot(r)}(bt(Error));function f(t,e,r,i,n){if(!(this instanceof f))try{return new f(t,e,r,i,n)}catch(l){if(!l.avoidNew)throw l;return l.value}typeof t=="string"&&(n=i,i=r,r=e,e=t,t=null);var o=t&&S(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=g.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||i||null,this.otherTypeCallback=t.otherTypeCallback||n||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){var s={path:o?t.path:e};o?"json"in t&&(s.json=t.json):s.json=r;var a=this.evaluate(s);if(!a||S(a)!=="object")throw new ge(a);return a}}f.prototype.evaluate=function(t,e,r,i){var n=this,o=this.parent,s=this.parentProperty,a=this.flatten,l=this.wrap;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=i||this.otherTypeCallback,e=e||this.json,t=t||this.path,t&&S(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(!g.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var c=t;e=c.json,a=g.call(t,"flatten")?t.flatten:a,this.currResultType=g.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=g.call(t,"sandbox")?t.sandbox:this.currSandbox,l=g.call(t,"wrap")?t.wrap:l,this.currPreventEval=g.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=g.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=g.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,o=g.call(t,"parent")?t.parent:o,s=g.call(t,"parentProperty")?t.parentProperty:s,t=t.path}if(o=o||null,s=s||null,Array.isArray(t)&&(t=f.toPathString(t)),!(!t&&t!==""||!e)){var u=f.toPathArray(t);u[0]==="$"&&u.length>1&&u.shift(),this._hasParentSelector=null;var p=this._trace(u,e,["$"],o,s,r).filter(function(d){return d&&!d.isParentSelector});return p.length?!l&&p.length===1&&!p[0].hasArrExpr?this._getPreferredOutput(p[0]):p.reduce(function(d,v){var E=n._getPreferredOutput(v);return a&&Array.isArray(E)?d=d.concat(E):d.push(E),d},[]):l?[]: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 i=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:f.toPathString(t.path),e(i,r,t)}};f.prototype._trace=function(t,e,r,i,n,o,s,a){var l=this,c;if(!t.length)return c={path:r,value:e,parent:i,parentProperty:n,hasArrExpr:s},this._handleCallback(c,o,"value"),c;var u=t[0],p=t.slice(1),d=[];function v(h){Array.isArray(h)?h.forEach(function(L){d.push(L)}):d.push(h)}if((typeof u!="string"||a)&&e&&g.call(e,u))v(this._trace(p,e[u],O(r,u),e,u,o,s));else if(u==="*")this._walk(e,function(h){v(l._trace(p,e[h],O(r,h),e,h,o,!0,!0))});else if(u==="..")v(this._trace(p,e,r,i,n,o,s)),this._walk(e,function(h){S(e[h])==="object"&&v(l._trace(t.slice(),e[h],O(r,h),e,h,o,!0))});else{if(u==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:p,isParentSelector:!0};if(u==="~")return c={path:O(r,u),value:n,parent:i,parentProperty:null},this._handleCallback(c,o,"property"),c;if(u==="$")v(this._trace(p,e,r,null,null,o,s));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(u))v(this._slice(u,p,e,r,i,n,o));else if(u.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var E=u.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(h){l._eval(E,e[h],h,r,i,n)&&v(l._trace(p,e[h],O(r,h),e,h,o,!0))})}else if(u[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");v(this._trace(gt(this._eval(u,e,r[r.length-1],r.slice(0,-1),i,n),p),e,r,i,n,o,s))}else if(u[0]==="@"){var b=!1,w=u.slice(1,-2);switch(w){case"scalar":(!e||!["object","function"].includes(S(e)))&&(b=!0);break;case"boolean":case"string":case"undefined":case"function":S(e)===w&&(b=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(b=!0);break;case"number":Number.isFinite(e)&&(b=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(b=!0);break;case"object":e&&S(e)===w&&(b=!0);break;case"array":Array.isArray(e)&&(b=!0);break;case"other":b=this.currOtherTypeCallback(e,r,i,n);break;case"null":e===null&&(b=!0);break;default:throw new TypeError("Unknown value type "+w)}if(b)return c={path:r,value:e,parent:i,parentProperty:n},this._handleCallback(c,o,"value"),c}else if(u[0]==="`"&&e&&g.call(e,u.slice(1))){var A=u.slice(1);v(this._trace(p,e[A],O(r,A),e,A,o,s,!0))}else if(u.includes(",")){var it=u.split(","),P=me(it),nt;try{for(P.s();!(nt=P.n()).done;){var _t=nt.value;v(this._trace(gt(_t,p),e,r,i,n,o,!0))}}catch(h){P.e(h)}finally{P.f()}}else!a&&e&&g.call(e,u)&&v(this._trace(p,e[u],O(r,u),e,u,o,s,!0))}if(this._hasParentSelector)for(var F=0;F<d.length;F++){var T=d[F];if(T&&T.isParentSelector){var D=this._trace(T.expr,e,T.path,i,n,o,s);if(Array.isArray(D)){d[F]=D[0];for(var ht=D.length,ot=1;ot<ht;ot++)F++,d.splice(F,0,D[ot])}else d[F]=D}}return d};f.prototype._walk=function(t,e){if(Array.isArray(t))for(var r=t.length,i=0;i<r;i++)e(i);else t&&S(t)==="object"&&Object.keys(t).forEach(function(n){e(n)})};f.prototype._slice=function(t,e,r,i,n,o,s){if(Array.isArray(r)){var a=r.length,l=t.split(":"),c=l[2]&&Number.parseInt(l[2])||1,u=l[0]&&Number.parseInt(l[0])||0,p=l[1]&&Number.parseInt(l[1])||a;u=u<0?Math.max(0,u+a):Math.min(a,u),p=p<0?Math.max(0,p+a):Math.min(a,p);for(var d=[],v=u;v<p;v+=c){var E=this._trace(gt(v,e),r,i,n,o,s,!0);E.forEach(function(b){d.push(b)})}return d}};f.prototype._eval=function(t,e,r,i,n,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=n,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;var s=t.includes("@path");s&&(this.currSandbox._$_path=f.toPathString(i.concat([r])));var a="script:"+t;if(!f.cache[a]){var l=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");s&&(l=l.replace(/@path/g,"_$_path")),f.cache[a]=new this.vm.Script(l)}try{return f.cache[a].runInNewContext(this.currSandbox)}catch(c){throw new Error("jsonPath: "+c.message+": "+t)}};f.cache={};f.toPathString=function(t){for(var e=t,r=e.length,i="$",n=1;n<r;n++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[n])||(i+=/^[\*0-9]+$/.test(e[n])?"["+e[n]+"]":"['"+e[n]+"']");return i};f.toPointer=function(t){for(var e=t,r=e.length,i="",n=1;n<r;n++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[n])||(i+="/"+e[n].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return i};f.toPathArray=function(t){var e=f.cache;if(e[t])return e[t].concat();var r=[],i=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,s){return"[#"+(r.push(s)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(o,s){return"['"+s.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(o,s){return";"+s.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),n=i.split(";").map(function(o){var s=o.match(/#([0-9]+)/);return!s||!s[1]?o:r[s[1]]});return e[t]=n,e[t].concat()};var Ae=function(e,r,i){for(var n=e.length,o=0;o<n;o++){var s=e[o];i(s)&&r.push(e.splice(o--,1)[0])}},Ee=function(){function t(e){Dt(this,t),this.code=e}return Ot(t,[{key:"runInNewContext",value:function(r){var i=this.code,n=Object.keys(r),o=[];Ae(n,o,function(u){return typeof r[u]=="function"});var s=n.map(function(u,p){return r[u]}),a=o.reduce(function(u,p){var d=r[p].toString();return/function/.test(d)||(d="function "+d),"var "+p+"="+d+";"+u},"");i=a+i,!/(["'])use strict\1/.test(i)&&!n.includes("arguments")&&(i="var arguments = undefined;"+i),i=i.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var l=i.lastIndexOf(";"),c=l>-1?i.slice(0,l+1)+" return "+i.slice(l+1):" return "+i;return z(Function,n.concat([c])).apply(void 0,fe(s))}}]),t}();f.prototype.vm={Script:Ee};function Lt(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function Et(t){return Lt(t)+".*"}function at(t,e,r=!1,i=t){var n=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}n=e.substring(a.length+1),i=t[a];break}var s=f({path:n,json:i});return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[n.replace(/^.*?\./,"_."),n.replace(/^.*?\./,""),n.replace(/^([^.]+).*?\.\$\./,"$1."),n.replace(/^.*?\.\$\./,"_."),n.replace(/^.*?\.\$\./,""),n.replace(/^[^.]+$/,"_")].filter((a,l,c)=>c.indexOf(a)===l).reduce((a,l)=>a.length>0?a:f({path:l,json:i}),[])),r&&Array.isArray(s)?s[0]:s}function At(t,e={},r){return r?`<${r}${Object.entries(e).map(([i,n])=>n!=null&&` ${i}="${n}"`).filter(Boolean).join("")}>${$(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):$(t)}function $(t){var e;if(Array.isArray(t))return t.map($).join(`
4
- `).trim();if(typeof t=="string")return t;if(t==null)return"";switch(t.type){case"heading":let{level:r,...i}=t.attrs;return At(t.content,i,"h"+r);case"text":return(t.marks||[]).reduce((n,o)=>At(n,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 At(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(i=>{let n=i.target,o=n.getAttribute("data-embed-src");o&&J(n,o),i.addedNodes&&i.addedNodes.forEach(s=>{s.nodeType==1&&$t(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function $t(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let n=r[i];J(n,n.getAttribute("data-embed-src"))}if(e)return Nt(t)}function J(t,e){for(var r=t;r;r=r.parentElement)if(!r.parentElement){let n=r.querySelectorAll("script");for(var i=0;i<n.length;i++)if(n[i].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 It(t){let e=t.getAttribute("data-path-scope");for(var r=0,i=t;i=i.previousElementSibling;)i.getAttribute("data-path-scope")==e&&r++;return r}function we(t,e,r){let i=t.getAttribute("data-path-scope");if(i==null)return;var n=It(t);if(n!=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=n+1,a=t,l=t;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==i&&(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 B(t,e,r,i){var n;if(t){var o=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=$(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.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")J(t,r);else if(e=="data-path-attributes"){let p=((n=t.getAttribute("data-attributes-keys"))===null||n===void 0?void 0:n.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var a in r){var l=r[a];B(t,a,typeof l=="object"&&l?JSON.stringify(l):l,i)}for(var c=0;c<p.length;c++)(r==null||!(p[c]in r))&&B(t,p[c],null,i);B(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var u=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=u:o.removeAttribute(s)}}}var Bt=["data-attributes-keys","data-path-attributes","data-path-scope"];function R(t,e,r,i){var n,o,s;let a=t;if(i||(e=((n=r==null?void 0:r.processData)===null||n===void 0?void 0:n.call(r,a,e))||e),a.nodeType==1){let u=a.getAttribute("data-path-scope");if(u){let d=It(a),v=at(e,u,!1)||[];d==0&&we(a,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,a,v))===!1?1:v.length,r),e={...e,[Et(u)]:v[d]}}let p=Array.prototype.slice.call(a.attributes).sort((d,v)=>Bt.indexOf(d.name)-Bt.indexOf(v.name));for(var l=0;l<p.length;l++){let{name:d,value:v}=p[l];d.startsWith("data-path")&&d!="data-path-scope"&&B(a,d,at(e,v,!0),r),d=="data-embed-src"&&B(a,d,a.getAttribute(d),r)}}for(var l=0,c;c=a.childNodes[l++];)Ut(c)&&R(c,e,r,!0);return i||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,e),a}function Ut(t){return t.nodeType==1}function I(t,e,r,i){var n;let o=((n=i==null?void 0:i.processTemplate)===null||n===void 0?void 0:n.call(i,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++];)Ut(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return R(t,r,i)}function Ce(t,e,r,i=!1){var n;let o=((n=r==null?void 0:r.processTemplate)===null||n===void 0?void 0:n.call(r,null,t,e))||t;if(typeof document=="undefined"||i){let{parseHTML:s}=require("linkedom"),{document:a}=s(o);return R(a,e,r).toString()}else{let s=document.createElement("div");return s.innerHTML=o,R(s,e,r),s.innerHTML}}var jt=["initial","check","updated"],K={};function xe(){K={}}async function wt(t,e,r,i,n=K){return M({url:t,options:e,validator:r,callback:i,cache:n}).then(G).then(o=>o.response)}function Wt(t,e=!1){let r=String(t).replace("?head","");var i=K[r];return!i&&!e&&(i=K[r]={phase:null,initial:k(),check:k(),updated:k(),final:k()}),i}async function M({url:t,options:e,validator:r,callback:i,cache:n},o="initial"){let s=new Date;if(n!=null){var a=Wt(t);if(jt.indexOf(a.phase)>=jt.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 u=new Date(c.headers.get("date"))<s||l&&o=="initial"&&(a.phase=="updated"||a.phase=="check");return await(i==null?void 0:i(c,o)),{url:t,options:e,isCached:u,response:c,validator:r,callback:i,cache:n}}async function G(t){let{url:e,isCached:r,options:i,validator:n,response:o,cache:s}=t;if(r){let{response:a}=await M({url:e+"?head",options:{...i,method:"HEAD",cache:"no-cache"},validator:n,cache:s},"check");if(a.headers.get("last-modified")!=o.headers.get("last-modified"))return lt(t)}return t}async function lt(t){return M({...t,options:{...t.options,cache:"reload"}},"updated")}var _="https://feaascomponentsapidev.blob.core.windows.net";function Y(t){let e=t.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/([^\/]+?)(?:\.html?)?)?)?$/);if(e){var[,r,i,n,o,s]=e;return{cdn:r,library:i,component:n,version:o,revision:s}}}function Se(t){if(!t||!t.library||!t.component)throw new Error("Component requires `library` and `component` properties");return`${t.cdn&&t.cdn!=_?`${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 Re(t){return`${t.cdn&&t.cdn!=_?`${t.cdn}/styles`:""}/${t.library}/${t.revision=="published"?"":t.revision}`.replace(/^\/|\/$|(?<!:)\/\//g,"")}function xt(t){let e=t.match(/^(?:(.*?)\/styles)?\/([^\/]+)\/([^\/]+)(?:.css?)?$/);if(e){var[,r,i,n]=e;return{cdn:r,library:i,revision:n}}}function Ct(t){return"src"in t&&(t={...Y(t.src)}),`${t.cdn||t.hostname||_}/components/${t.library}/${t.component}/${t.version}/${t.revision||"published"}.html`}function Z(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...Y(t.src)}),`${t.cdn||t.hostname||_}/styles/${t.library}/${t.revision||"published"}.css`}async function U(t,e,r=!1){let i=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,n=a=>a.clone().text().then(e),o=await Promise.all([t.instance&&M({options:{headers:{Accept:"text/html"}},url:Ct({...t,version:t.instance}),validator:i}).catch(a=>a),M({url:Ct(t),validator:i}).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 n(s.response),r?s:G({...s,callback:n}).catch(a=>{if(o[0]==s&&(lt({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return n(o[1].response),G({...o[1],callback:n});throw a})}async function _e(t){typeof t=="string"&&(t={src:t});var e;let{response:r}=await U(t,i=>{e=i},!0);return{...t,template:e,lastModified:r.headers.get("last-modified")}}async function ut(t,e){return typeof t=="string"&&(t={src:t}),wt(Z(t),{headers:{Accept:"text/css"}},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,i)=>r.clone().text().then(n=>e(n,i)))}function Fe(t,e){return Ht(t,e||(e=document.createElement("style"))),e}function Ht(t,e){return e||(e=document.createElement("style")),ut(t,(r,i)=>{e.textContent=r}).then(()=>e)}function ct(t,e){var r=zt(t);if(!r)var i=Vt(t);return ut(t,(n,o)=>{i&&(i.textContent=n),e==null||e(n,o)}).then(()=>r||i)}function St(t){return new Promise((e,r)=>{ct(t,e).catch(r)})}function zt(t){return document.head.querySelector(`style[data-href="${Z(t)}"]`)}function Vt(t){let e=Z(t),r=document.createElement("style");return r.setAttribute("data-href",e),document.head.appendChild(r),r}function ke(t,e){let r=document.createElement("div");r.innerHTML=t;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return R(i,e),r}function Pe(t,e){return qt(t,e||(e=document.createElement("div"))),e}async function qt(t,e){return e||(e=document.createElement("div")),e.childNodes.length?R(e,t.data,t):"template"in t?I(e,t.template,t.data,t):U(t,r=>I(e,r,t.data,t)).then(()=>e)}function Jt(t=this){var e,r,i,n,o,s,a,l;let c,u=t.getAttribute("src");if(u)var{cdn:p,library:d,component:v,version:E,revision:b}=Y(u);let w=t.getAttribute("data");if(w!=null&&w!="")try{c=typeof w=="string"?JSON.parse(w):{}}catch(A){}return{data:c||{},cdn:(r=(e=t.getContextAttribute("cdn"))!==null&&e!==void 0?e:p)!==null&&r!==void 0?r:_,library:(i=t.getAttribute("library"))!==null&&i!==void 0?i:d,component:(n=t.getAttribute("component"))!==null&&n!==void 0?n:v,version:(s=(o=t.getAttribute("version"))!==null&&o!==void 0?o:E)!==null&&s!==void 0?s:"responsive",revision:(l=(a=t.getAttribute("revision"))!==null&&a!==void 0?a:b)!==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 Q=class extends y{setData(e){this.set({data:e})}getProps(){return Jt(this)}attributeChangedCallback(e,r,i){r!==i&&((e=="library"||e=="component"||e=="revision"||e=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(e,r,i))}getEditor(){var e;return(e=document.querySelector("feaas-context"))===null||e===void 0?void 0:e.refs.editor}constructor(){super(),this.defaultProps={cdn:_,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 i=r;return i}}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=St({...this.props,revision:"published"}).then(()=>{e=null,this.payload&&this.onLoad(this.payload)});return Promise.all([e,U(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)R(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;I(this,this.payload,this.props.data)}}};Q.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];Q.register("feaas-component");function Kt(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 X=class extends y{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Kt(this)}attributeChangedCallback(e,r,i){if(r!==i)return e=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(e,r,i)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return o=l.done,l},e:function(l){s=!0,a=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}var g=Object.prototype.hasOwnProperty;function O(t,e){return t=t.slice(),t.push(e),t}function At(t,e){return e=e.slice(),e.unshift(t),e}var ge=function(t){ue(r,t);var e=pe(r);function r(i){var n;return Dt(this,r),n=e.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),n.avoidNew=!0,n.value=i,n.name="NewError",n}return Ot(r)}(mt(Error));function f(t,e,r,i,n){if(!(this instanceof f))try{return new f(t,e,r,i,n)}catch(l){if(!l.avoidNew)throw l;return l.value}typeof t=="string"&&(n=i,i=r,r=e,e=t,t=null);var o=t&&S(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=g.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||i||null,this.otherTypeCallback=t.otherTypeCallback||n||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){var s={path:o?t.path:e};o?"json"in t&&(s.json=t.json):s.json=r;var a=this.evaluate(s);if(!a||S(a)!=="object")throw new ge(a);return a}}f.prototype.evaluate=function(t,e,r,i){var n=this,o=this.parent,s=this.parentProperty,a=this.flatten,l=this.wrap;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=i||this.otherTypeCallback,e=e||this.json,t=t||this.path,t&&S(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(!g.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var c=t;e=c.json,a=g.call(t,"flatten")?t.flatten:a,this.currResultType=g.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=g.call(t,"sandbox")?t.sandbox:this.currSandbox,l=g.call(t,"wrap")?t.wrap:l,this.currPreventEval=g.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=g.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=g.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,o=g.call(t,"parent")?t.parent:o,s=g.call(t,"parentProperty")?t.parentProperty:s,t=t.path}if(o=o||null,s=s||null,Array.isArray(t)&&(t=f.toPathString(t)),!(!t&&t!==""||!e)){var u=f.toPathArray(t);u[0]==="$"&&u.length>1&&u.shift(),this._hasParentSelector=null;var p=this._trace(u,e,["$"],o,s,r).filter(function(d){return d&&!d.isParentSelector});return p.length?!l&&p.length===1&&!p[0].hasArrExpr?this._getPreferredOutput(p[0]):p.reduce(function(d,v){var E=n._getPreferredOutput(v);return a&&Array.isArray(E)?d=d.concat(E):d.push(E),d},[]):l?[]: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 i=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:f.toPathString(t.path),e(i,r,t)}};f.prototype._trace=function(t,e,r,i,n,o,s,a){var l=this,c;if(!t.length)return c={path:r,value:e,parent:i,parentProperty:n,hasArrExpr:s},this._handleCallback(c,o,"value"),c;var u=t[0],p=t.slice(1),d=[];function v(h){Array.isArray(h)?h.forEach(function(L){d.push(L)}):d.push(h)}if((typeof u!="string"||a)&&e&&g.call(e,u))v(this._trace(p,e[u],O(r,u),e,u,o,s));else if(u==="*")this._walk(e,function(h){v(l._trace(p,e[h],O(r,h),e,h,o,!0,!0))});else if(u==="..")v(this._trace(p,e,r,i,n,o,s)),this._walk(e,function(h){S(e[h])==="object"&&v(l._trace(t.slice(),e[h],O(r,h),e,h,o,!0))});else{if(u==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:p,isParentSelector:!0};if(u==="~")return c={path:O(r,u),value:n,parent:i,parentProperty:null},this._handleCallback(c,o,"property"),c;if(u==="$")v(this._trace(p,e,r,null,null,o,s));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(u))v(this._slice(u,p,e,r,i,n,o));else if(u.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var E=u.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(h){l._eval(E,e[h],h,r,i,n)&&v(l._trace(p,e[h],O(r,h),e,h,o,!0))})}else if(u[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");v(this._trace(At(this._eval(u,e,r[r.length-1],r.slice(0,-1),i,n),p),e,r,i,n,o,s))}else if(u[0]==="@"){var b=!1,w=u.slice(1,-2);switch(w){case"scalar":(!e||!["object","function"].includes(S(e)))&&(b=!0);break;case"boolean":case"string":case"undefined":case"function":S(e)===w&&(b=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(b=!0);break;case"number":Number.isFinite(e)&&(b=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(b=!0);break;case"object":e&&S(e)===w&&(b=!0);break;case"array":Array.isArray(e)&&(b=!0);break;case"other":b=this.currOtherTypeCallback(e,r,i,n);break;case"null":e===null&&(b=!0);break;default:throw new TypeError("Unknown value type "+w)}if(b)return c={path:r,value:e,parent:i,parentProperty:n},this._handleCallback(c,o,"value"),c}else if(u[0]==="`"&&e&&g.call(e,u.slice(1))){var A=u.slice(1);v(this._trace(p,e[A],O(r,A),e,A,o,s,!0))}else if(u.includes(",")){var rt=u.split(","),P=me(rt),it;try{for(P.s();!(it=P.n()).done;){var _t=it.value;v(this._trace(At(_t,p),e,r,i,n,o,!0))}}catch(h){P.e(h)}finally{P.f()}}else!a&&e&&g.call(e,u)&&v(this._trace(p,e[u],O(r,u),e,u,o,s,!0))}if(this._hasParentSelector)for(var F=0;F<d.length;F++){var T=d[F];if(T&&T.isParentSelector){var D=this._trace(T.expr,e,T.path,i,n,o,s);if(Array.isArray(D)){d[F]=D[0];for(var pt=D.length,nt=1;nt<pt;nt++)F++,d.splice(F,0,D[nt])}else d[F]=D}}return d};f.prototype._walk=function(t,e){if(Array.isArray(t))for(var r=t.length,i=0;i<r;i++)e(i);else t&&S(t)==="object"&&Object.keys(t).forEach(function(n){e(n)})};f.prototype._slice=function(t,e,r,i,n,o,s){if(Array.isArray(r)){var a=r.length,l=t.split(":"),c=l[2]&&Number.parseInt(l[2])||1,u=l[0]&&Number.parseInt(l[0])||0,p=l[1]&&Number.parseInt(l[1])||a;u=u<0?Math.max(0,u+a):Math.min(a,u),p=p<0?Math.max(0,p+a):Math.min(a,p);for(var d=[],v=u;v<p;v+=c){var E=this._trace(At(v,e),r,i,n,o,s,!0);E.forEach(function(b){d.push(b)})}return d}};f.prototype._eval=function(t,e,r,i,n,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=n,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;var s=t.includes("@path");s&&(this.currSandbox._$_path=f.toPathString(i.concat([r])));var a="script:"+t;if(!f.cache[a]){var l=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");s&&(l=l.replace(/@path/g,"_$_path")),f.cache[a]=new this.vm.Script(l)}try{return f.cache[a].runInNewContext(this.currSandbox)}catch(c){throw new Error("jsonPath: "+c.message+": "+t)}};f.cache={};f.toPathString=function(t){for(var e=t,r=e.length,i="$",n=1;n<r;n++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[n])||(i+=/^[\*0-9]+$/.test(e[n])?"["+e[n]+"]":"['"+e[n]+"']");return i};f.toPointer=function(t){for(var e=t,r=e.length,i="",n=1;n<r;n++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[n])||(i+="/"+e[n].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return i};f.toPathArray=function(t){var e=f.cache;if(e[t])return e[t].concat();var r=[],i=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,s){return"[#"+(r.push(s)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(o,s){return"['"+s.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(o,s){return";"+s.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),n=i.split(";").map(function(o){var s=o.match(/#([0-9]+)/);return!s||!s[1]?o:r[s[1]]});return e[t]=n,e[t].concat()};var Ae=function(e,r,i){for(var n=e.length,o=0;o<n;o++){var s=e[o];i(s)&&r.push(e.splice(o--,1)[0])}},Ee=function(){function t(e){Dt(this,t),this.code=e}return Ot(t,[{key:"runInNewContext",value:function(r){var i=this.code,n=Object.keys(r),o=[];Ae(n,o,function(u){return typeof r[u]=="function"});var s=n.map(function(u,p){return r[u]}),a=o.reduce(function(u,p){var d=r[p].toString();return/function/.test(d)||(d="function "+d),"var "+p+"="+d+";"+u},"");i=a+i,!/(["'])use strict\1/.test(i)&&!n.includes("arguments")&&(i="var arguments = undefined;"+i),i=i.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var l=i.lastIndexOf(";"),c=l>-1?i.slice(0,l+1)+" return "+i.slice(l+1):" return "+i;return z(Function,n.concat([c])).apply(void 0,fe(s))}}]),t}();f.prototype.vm={Script:Ee};function Lt(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function wt(t){return Lt(t)+".*"}function st(t,e,r=!1,i=t){var n=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}n=e.substring(a.length+1),i=t[a];break}var s=f({path:n,json:i});return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[n.replace(/^.*?\./,"_."),n.replace(/^.*?\./,""),n.replace(/^([^.]+).*?\.\$\./,"$1."),n.replace(/^.*?\.\$\./,"_."),n.replace(/^.*?\.\$\./,""),n.replace(/^[^.]+$/,"_")].filter((a,l,c)=>c.indexOf(a)===l).reduce((a,l)=>a.length>0?a:f({path:l,json:i}),[])),r&&Array.isArray(s)?s[0]:s}function Et(t,e={},r){return r?`<${r}${Object.entries(e).map(([i,n])=>n!=null&&` ${i}="${n}"`).filter(Boolean).join("")}>${$(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):$(t)}function $(t){var e;if(Array.isArray(t))return t.map($).join(`
4
+ `).trim();if(typeof t=="string")return t;if(t==null)return"";switch(t.type){case"heading":let{level:r,...i}=t.attrs;return Et(t.content,i,"h"+r);case"text":return(t.marks||[]).reduce((n,o)=>Et(n,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 Et(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(i=>{let n=i.target,o=n.getAttribute("data-embed-src");o&&J(n,o),i.addedNodes&&i.addedNodes.forEach(s=>{s.nodeType==1&&$t(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function $t(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let n=r[i];J(n,n.getAttribute("data-embed-src"))}if(e)return Nt(t)}function J(t,e){for(var r=t;r;r=r.parentElement)if(!r.parentElement){let n=r.querySelectorAll("script");for(var i=0;i<n.length;i++)if(n[i].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 It(t){let e=t.getAttribute("data-path-scope");for(var r=0,i=t;i=i.previousElementSibling;)i.getAttribute("data-path-scope")==e&&r++;return r}function we(t,e,r){let i=t.getAttribute("data-path-scope");if(i==null)return;var n=It(t);if(n!=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=n+1,a=t,l=t;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==i&&(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 B(t,e,r,i){var n;if(t){var o=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=$(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.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")J(t,r);else if(e=="data-path-attributes"){let p=((n=t.getAttribute("data-attributes-keys"))===null||n===void 0?void 0:n.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var a in r){var l=r[a];B(t,a,typeof l=="object"&&l?JSON.stringify(l):l,i)}for(var c=0;c<p.length;c++)(r==null||!(p[c]in r))&&B(t,p[c],null,i);B(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var u=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=u:o.removeAttribute(s)}}}var Bt=["data-attributes-keys","data-path-attributes","data-path-scope"];function R(t,e,r,i){var n,o,s;let a=t;if(i||(e=((n=r==null?void 0:r.processData)===null||n===void 0?void 0:n.call(r,a,e))||e),a.nodeType==1){let u=a.getAttribute("data-path-scope");if(u){let d=It(a),v=st(e,u,!1)||[];d==0&&we(a,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,a,v))===!1?1:v.length,r),e={...e,[wt(u)]:v[d]}}let p=Array.prototype.slice.call(a.attributes).sort((d,v)=>Bt.indexOf(d.name)-Bt.indexOf(v.name));for(var l=0;l<p.length;l++){let{name:d,value:v}=p[l];d.startsWith("data-path")&&d!="data-path-scope"&&B(a,d,st(e,v,!0),r),d=="data-embed-src"&&B(a,d,a.getAttribute(d),r)}}for(var l=0,c;c=a.childNodes[l++];)Ut(c)&&R(c,e,r,!0);return i||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,e),a}function Ut(t){return t.nodeType==1}function I(t,e,r,i){var n;let o=((n=i==null?void 0:i.processTemplate)===null||n===void 0?void 0:n.call(i,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++];)Ut(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return R(t,r,i)}function Ce(t,e,r,i=!1){var n;let o=((n=r==null?void 0:r.processTemplate)===null||n===void 0?void 0:n.call(r,null,t,e))||t;if(typeof document=="undefined"||i){let{parseHTML:s}=require("linkedom"),{document:a}=s(o);return R(a,e,r).toString()}else{let s=document.createElement("div");return s.innerHTML=o,R(s,e,r),s.innerHTML}}var jt=["initial","check","updated"],K={};function xe(){K={}}async function Ct(t,e,r,i,n=K){return M({url:t,options:e,validator:r,callback:i,cache:n}).then(G).then(o=>o.response)}function Wt(t,e=!1){let r=String(t).replace("?head","");var i=K[r];return!i&&!e&&(i=K[r]={phase:null,initial:k(),check:k(),updated:k(),final:k()}),i}async function M({url:t,options:e,validator:r,callback:i,cache:n},o="initial"){let s=new Date;if(n!=null){var a=Wt(t);if(jt.indexOf(a.phase)>=jt.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 u=new Date(c.headers.get("date"))<s||l&&o=="initial"&&(a.phase=="updated"||a.phase=="check");return await(i==null?void 0:i(c,o)),{url:t,options:e,isCached:u,response:c,validator:r,callback:i,cache:n}}async function G(t){let{url:e,isCached:r,options:i,validator:n,response:o,cache:s}=t;if(r){let{response:a}=await M({url:e+"?head",options:{...i,method:"HEAD",cache:"no-cache"},validator:n,cache:s},"check");if(a.headers.get("last-modified")!=o.headers.get("last-modified"))return at(t)}return t}async function at(t){return M({...t,options:{...t.options,cache:"reload"}},"updated")}var _="https://feaascomponentsapidev.blob.core.windows.net";function lt(t){let e=t.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/([^\/]+?)(?:\.html?)?)?)?$/);if(e){var[,r,i,n,o,s]=e;return{cdn:r,library:i,component:n,version:o,revision:s}}}function Se(t){if(!t||!t.library||!t.component)throw new Error("Component requires `library` and `component` properties");return`${t.cdn&&t.cdn!=_?`${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 Re(t){return`${t.cdn&&t.cdn!=_?`${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,i,n]=e;return{cdn:r,library:i,revision:n}}}function xt(t){return"src"in t&&(t={...lt(t.src)}),`${t.cdn||t.hostname||_}/components/${t.library}/${t.component}/${t.version}/${t.revision||"published"}.html`}function Y(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...ut(t.src)}),`${t.cdn||t.hostname||_}/styles/${t.library}/${t.revision||"published"}.css`}async function U(t,e,r=!1){let i=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,n=a=>a.clone().text().then(e),o=await Promise.all([t.instance&&M({options:{headers:{Accept:"text/html"}},url:xt({...t,version:t.instance}),validator:i}).catch(a=>a),M({url:xt(t),validator:i}).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 n(s.response),r?s:G({...s,callback:n}).catch(a=>{if(o[0]==s&&(at({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return n(o[1].response),G({...o[1],callback:n});throw a})}async function _e(t){typeof t=="string"&&(t={src:t});var e;let{response:r}=await U(t,i=>{e=i},!0);return{...t,template:e,lastModified:r.headers.get("last-modified")}}async function ct(t,e){return typeof t=="string"&&(t={src:t}),Ct(Y(t),{headers:{Accept:"text/css"}},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,i)=>r.clone().text().then(n=>e(n,i)))}function Fe(t,e){return Ht(t,e||(e=document.createElement("style"))),e}function Ht(t,e){return e||(e=document.createElement("style")),ct(t,(r,i)=>{e.textContent=r}).then(()=>e)}function dt(t,e){var r=zt(t);if(!r)var i=Vt(t);return ct(t,(n,o)=>{i&&(i.textContent=n),e==null||e(n,o)}).then(()=>r||i)}function St(t){return new Promise((e,r)=>{dt(t,e).catch(r)})}function zt(t){return document.head.querySelector(`style[data-href="${Y(t)}"]`)}function Vt(t){let e=Y(t),r=document.createElement("style");return r.setAttribute("data-href",e),document.head.appendChild(r),r}function ke(t,e){let r=document.createElement("div");r.innerHTML=t;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return R(i,e),r}function Pe(t,e){return qt(t,e||(e=document.createElement("div"))),e}async function qt(t,e){return e||(e=document.createElement("div")),e.childNodes.length?R(e,t.data,t):"template"in t?I(e,t.template,t.data,t):U(t,r=>I(e,r,t.data,t)).then(()=>e)}function Jt(t=this){var e,r,i,n,o,s,a,l;let c,u=t.getAttribute("src");if(u)var{cdn:p,library:d,component:v,version:E,revision:b}=lt(u);let w=t.getAttribute("data");if(w!=null&&w!="")try{c=typeof w=="string"?JSON.parse(w):{}}catch(A){}return{data:c||{},cdn:(r=(e=t.getContextAttribute("cdn"))!==null&&e!==void 0?e:p)!==null&&r!==void 0?r:_,library:(i=t.getAttribute("library"))!==null&&i!==void 0?i:d,component:(n=t.getAttribute("component"))!==null&&n!==void 0?n:v,version:(s=(o=t.getAttribute("version"))!==null&&o!==void 0?o:E)!==null&&s!==void 0?s:"responsive",revision:(l=(a=t.getAttribute("revision"))!==null&&a!==void 0?a:b)!==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 Z=class extends y{setData(e){this.set({data:e})}getProps(){return Jt(this)}attributeChangedCallback(e,r,i){r!==i&&((e=="library"||e=="component"||e=="revision"||e=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(e,r,i))}getEditor(){var e;return(e=document.querySelector("feaas-context"))===null||e===void 0?void 0:e.refs.editor}constructor(){super(),this.defaultProps={cdn:_,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 i=r;return i}}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=St({...this.props,revision:"published"}).then(()=>{e=null,this.payload&&this.onLoad(this.payload)});return Promise.all([e,U(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)R(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;I(this,this.payload,this.props.data)}}};Z.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];Z.register("feaas-component");function Kt(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 Q=class extends y{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Kt(this)}attributeChangedCallback(e,r,i){if(r!==i)return e=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(e,r,i)}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;
@@ -65,5 +65,5 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
65
65
  style="animation: 1.5s linear 0s infinite normal none running loader-circular-track"
66
66
  ></circle>
67
67
  </svg>
68
- </div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};X.observedAttributes=["hidden","opacity"];X.register("feaas-loader");function Gt(t=this){var e,r,i,n;let o=t.getAttribute("src");if(o)var{cdn:s,library:a,revision:l}=xt(o);return{library:t==null?void 0:t.getContextAttribute("library"),revision:(r=(e=t==null?void 0:t.getAttribute("revision"))!==null&&e!==void 0?e:l)!==null&&r!==void 0?r:"published",cdn:(n=(i=t==null?void 0:t.getContextAttribute("cdn"))!==null&&i!==void 0?i:t==null?void 0:t.getContextAttribute("hostname"))!==null&&n!==void 0?n:_}}var dt=class extends y{constructor(){super(...arguments),this.onLoad=e=>{this.payload=e,this.advance()}}getProps(){return Gt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return ct(this.props,this.onLoad)}};dt.register("feaas-stylesheet");var Rt;typeof window!="undefined"&&(window.FEAASElement=N,(Rt=window.FEAASLoading)!==null&&Rt!==void 0||(window.FEAASLoading=Promise.resolve()));function Yt(t){let e=[];if(t){let r=t.ownerDocument.defaultView,i,n;for(;r!==window.top;){i=r.parent;for(let o=0;o<i.frames.length;o++)if(i.frames[o]===r){for(let s of i.document.getElementsByTagName("iframe"))if(s.contentWindow===r){n=s.getBoundingClientRect();let a=s.contentWindow.getComputedStyle(s);e.push({left:n.left+parseInt(a.borderLeftWidth),top:n.top+parseInt(a.borderTopWidth)})}r=i;break}}}return e.reduce((r,i)=>({left:r.left+i.left,top:r.top+i.top}),{left:0,top:0})}function Zt(t=this){var e;return{context:HTMLElement,frontend:t==null?void 0:t.getContextAttribute("frontend"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/editor.js",library:t==null?void 0:t.getAttribute("library"),component:t==null?void 0:t.getAttribute("component"),version:t==null?void 0:t.getAttribute("version"),instance:t==null?void 0:t.getAttribute("instance"),forked:t==null?void 0:t.getAttribute("forked"),revision:(t==null?void 0:t.getAttribute("revision"))||"saved",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,for:t==null?void 0:t.getAttribute("for"),state:(t==null?void 0:t.getAttribute("state"))||"idle",changed:(t==null?void 0:t.getAttribute("changed"))!=null}}var tt=class extends y{constructor(){super(...arguments),this.framePoint={top:0,left:0},this.wrapperRect={top:0,left:0,width:0,height:0},this.bodyRect={top:0,left:0,width:0,height:0},this.defaultProps={hidden:!1},this.setTarget=(e,r={component:e.getAttribute("component"),version:e.getAttribute("version"),revision:e.getAttribute("revision"),instance:e.getAttribute("instance")})=>{if(!this.closing&&(!this.target||e==null))return this.set(r),this.target=e,!0},this.onChromeMeasureElement=(e,r=e.getBoundingClientRect())=>e.ownerDocument==document?{left:r.left-this.bodyRect.left,top:r.top-this.bodyRect.top,width:r.width,height:r.height}:{left:r.left+this.framePoint.left-this.bodyRect.left,top:r.top+this.framePoint.top-this.bodyRect.top,width:r.width,height:r.height},this.onBeforeMeasure=e=>{e.memoized.focusable&&(this.framePoint=Yt(e.memoized.focusable)),this.chrome&&(this.wrapperRect=this.chrome.positionable.getBoundingClientRect(),this.bodyRect=this.chrome.positionable.ownerDocument.body.parentElement.getBoundingClientRect())},this.onMeasure=()=>{},this.onPosition=({focusable:e,root:r})=>{!this.chrome||this.props.hidden||(e?(this.chrome.wrapper.style.width=e.width+16*2+"px",this.chrome.wrapper.style.height=e.height+16*1+64+"px",this.chrome.wrapper.style.left=e.left-16+"px",this.chrome.wrapper.style.top=e.top-64+"px",this.chrome.wrapper.style.opacity="1",this.chrome.absolute=this.querySelector(".ui.overlays"),this.chrome.absolute&&(this.chrome.absolute.style.left=r.left+"px",this.chrome.absolute.style.top=r.top+"px")):(this.chrome.wrapper.style.opacity="0",this.chrome.wrapper.style.left="-1000px",this.chrome.wrapper.style.top="-1000px"))},this.onWindowMessage=e=>{var r;switch((r=e.data)===null||r===void 0?void 0:r.type){case"feaasEdit":let i=this.getPlaceholder();this.setTarget(i.editable,e.data)&&(this.loader=i.loader,document.body.appendChild(i.clipper),this.editedUID=e.data.id,this.setPlaceholder(),this.open());break;case"feaasMeasurements":this.measurements=e.data.measurements,this.props.hidden||this.setPlaceholder();break}},this.onContentChange=()=>{this.setAttribute("changed","changed"),requestAnimationFrame(()=>{this.setIframeComponentContent()})},this.onClose=()=>{var e;this.setAttribute("hidden","hidden"),this.placeholder&&(this.placeholder.positionable.style.opacity="0",this.placeholder.positionable.style.pointerEvents="none"),this.chrome&&(this.chrome.wrapper.style.opacity="0"),!((e=this.target)===null||e===void 0)&&e.parentNode&&(this.target.outerHTML=this.target.outerHTML),this.setTarget(null,{component:null,version:null,instance:null,revision:null}),this.setEditorContext({isFocused:!1})},this.onVersionStateChange=(e,r)=>{this.versionContext=e,this.setVersionContext=r},this.onEditorStateChange=(e,r)=>{this.editorContext=e,this.setEditorContext=r,e.editor&&this.props.state=="loading"&&!this.props.hidden&&(this.setAttribute("state","ready"),this.ownerDocument.fonts.ready.then(()=>setTimeout(()=>{this.setReadyState(),this.setIframeComponentContent()},100)))}}getProps(){return Zt(this)}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}showLoader(){this.loader||(this.loader=document.createElement("feaas-loader"),this.loader.setAttribute("opacity","0.6"),this.loader.style.zIndex="1000",this.target.appendChild(this.loader),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative"))}hideLoader(){this.loader&&(this.loader.setAttribute("hidden","hidden"),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative",this.target.style.position=""))}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.onWindowMessage)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.onWindowMessage)}setIframe(e){this.iframe=e}setIframeComponentContent(){this.placeholder&&this.iframe&&this.placeholder.editable.innerHTML&&this.iframe.contentWindow.postMessage({type:"feaasUpdate",id:this.editedUID,content:this.placeholder.editable.innerHTML})}setPlaceholder(){if(!this.iframe)return;let e=this.iframe.clientWidth,r=this.iframe.clientHeight,i=this.iframe.getBoundingClientRect(),n=this.getPlaceholder(),o=document.body.getBoundingClientRect(),s=this.measurements[this.editedUID];s&&(Object.assign(n.clipper.style,{position:"absolute",top:i.top+this.iframe.clientTop-o.top+"px",left:i.left+this.iframe.clientLeft-o.left+"px",width:e+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(n.positionable.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(n.loader.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",height:s.height+"px",filter:"opacity(0.6)",zIndex:3,pointerEvents:"none"}),document.dispatchEvent(new Event("feaasRefresh",{bubbles:!0})))}getPlaceholder(){return this.placeholder?this.placeholder:(this.placeholder={clipper:document.createElement("div"),positionable:document.createElement("div"),editable:Object.assign(document.createElement("div"),{className:"-feaas"}),loader:document.createElement("feaas-loader")},this.placeholder.clipper.appendChild(this.placeholder.positionable),this.placeholder.positionable.appendChild(this.placeholder.editable),this.placeholder.clipper.appendChild(this.placeholder.loader),this.placeholder)}attributeChangedCallback(e,r,i){r!==i&&(e=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(e,r,i))}open(){clearTimeout(this.closing),this.removeAttribute("hidden"),this.removeAttribute("changed"),this.setLoadingState()}shouldFork(e){return e.forkOriginId==null&&this.props.instance!=null}cleanup(){var e;this.placeholder&&((e=this.placeholder.clipper)===null||e===void 0||e.remove(),this.placeholder=null)}close(){console.log("Editor is not ready")}unfork(){console.log("Editor is not ready")}discard(){console.log("Editor is not ready")}save(){console.log("Editor is not ready")}setVersionContext(e){console.log("Editor is not ready")}setEditorContext(e){console.log("Editor is not ready")}setLoadingState(){this.showLoader(),this.setAttribute("state","loading")}setReadyState(){this.hideLoader(),this.setEditorContext({activeVersionId:this.component.versions[0].id}),this.setAttribute("state","ready")}render({children:e,component:r,version:i,instance:n},{Editor:o,VersionStatusList:s,VersionStatusButton:a,Version:l,VersionMenu:c,EditorUIUndo:u,EditorUIMode:p,React:{useEffect:d,useMemo:v,useState:E,useContext:b},Chakra:{HStack:w,Box:A,Button:it,MenuItem:P},Chrome:nt,ReactDOM:_t,useSDK:F,useSlots:T,useModelObserver:D,ConfirmationContext:ht,VersionContext:ot}){if(!this.payload)return;let{React:h}=this.payload,{sdk:L}=F(),[m,Ft]=E(),{setConfirm:pt}=b(ht),j=n||i,te=L.library;m&&(this.component=m),d(()=>{if(this.props.hidden)return;let x=te.components.getItem(r).clone();return x.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(ft=>{x.versions.setItems(ft);let C=x.findVersion(n,["staged","published"]),H=x.findVersion(i,["staged","published"]);if(C)C.deletedAt?(C.getDraft().changeAndNotify(H.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",C.id));else if(this.removeAttribute("forked"),this.shouldFork(H)){console.error("FEAAS Editor: Forking");let vt=H.fork(n).id;this.setAttribute("instance",vt)}else console.error("FEAAS Editor: Regular");Ft(x)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),Ft(null)},400)}},[i,this.props.hidden]);let kt=D(m==null?void 0:m.versions,[]).filter(x=>x.id==j),W=kt[0];W&&!this.props.hidden&&(this.version=W),d(()=>(this.unfork=()=>{pt({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let x=m.findVersion(i,["staged","published"]);m.findVersion(n).unstage().unpublish().changeAndNotify(x.toProperties()),m.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(m.findVersion(j).revert(),m.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{pt({title:"Component has unsaved changes",button:"Discard",body:"Are you sure to close editor and discard changes?",bypass:!this.props.changed,action:()=>{this.discard(),requestAnimationFrame(this.onClose)}})},this.save=()=>{pt({bypass:!!this.props.forked,title:"Customizing component",button:"Save",body:"Changes to the component will only be visible on that page. Changes to component done in Component Builder will not be reflected here. It will be possible to revert the customization.",action:()=>{m.findVersion(j).commitData({view:this.editorContext.editor.getData({rootName:j}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",j),m.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[m]);let ee=v(()=>this.target,[m]);return v(()=>m&&T(e,({picker:x,children:ft})=>h.createElement(A,{ref:C=>{this.chrome=C?{positionable:C,wrapper:C.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},h.createElement(A,{className:"editor-wrapper",position:"absolute",left:0,top:0},h.createElement(o,{datasources:L.datasources,sdk:L,library:L.library,component:m,versions:kt,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:ft,chrome:({editor:C})=>C&&h.createElement(nt,null),children:({isArchivedDisplayed:C,editor:H,status:vt})=>h.createElement(A,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},h.createElement(A,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(A,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(A,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(A,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),W&&h.createElement(l,{version:W,node:ee,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:h.createElement(w,{justifyContent:"space-between"},h.createElement(u,{size:"sm",editor:vt=="ready"?H:null}),h.createElement(p,{size:"sm"})),middle:(Oe,Me)=>[!1],right:h.createElement(h.Fragment,null,h.createElement(it,{variant:"secondary",size:"sm",onClick:this.close},"Close"),h.createElement(it,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),h.createElement(c,{isDisabled:!this.props.forked&&!this.props.changed},h.createElement(P,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),h.createElement(P,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[W,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};tt.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];tt.register("feaas-editor");function Qt(t=this){var e,r;return{part:(t==null?void 0:t.getAttribute("part"))||"picker",slot:(t==null?void 0:t.getAttribute("part"))||"picker",mode:t==null?void 0:t.getAttribute("mode"),placeholder:(t==null?void 0:t.getAttribute("placeholder"))||"No theme",frontend:(e=t==null?void 0:t.getContextAttribute("frontend"))!==null&&e!==void 0?e:"https://components.sitecorecloud.io",src:(r=t==null?void 0:t.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,variant:t==null?void 0:t.getAttribute("variant"),context:void 0,onClose:void 0,onContextAttributeSet:void 0}}var et=class extends y{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Qt(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}render({placeholder:e,context:r,mode:i,children:n,variant:o},{Picker:s,React:a,ReactDOM:l}){return a.createElement(s,{placeholder:e,mode:i||void 0,onClose:this.props.onClose,onContextAttributeSet:this.props.onContextAttributeSet,context:r,variant:o},n)}};et.observedAttributes=["library","mode","frontend","src","hidden","variant"];et.register("feaas-picker");function Xt(t=this){var e,r,i,n;return{library:t==null?void 0:t.getAttribute("library"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/context.js",frontend:(r=t==null?void 0:t.getAttribute("frontend"))!==null&&r!==void 0?r:"https://components.sitecoreclud.io",backend:(i=t==null?void 0:t.getAttribute("backend"))!==null&&i!==void 0?i:"https://components-api.sitecoreclud.io",cdn:(n=t==null?void 0:t.getAttribute("cdn"))!==null&&n!==void 0?n:"https://feaascompontsapiprod.blob.core.windows.net",auth:null,isolate:(t==null?void 0:t.getAttribute("isolate"))==null||(t==null?void 0:t.getAttribute("isolate"))=="true"}}var rt=class extends y{constructor(){super(...arguments),this.defaultProps={isolate:!0},this.onStatusChange=e=>{e=="ready"&&this.dispatchEvent(new Event("feaasReady",{bubbles:!0,composed:!0}))}}getProps(){return Xt(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}isReadyToLoad(){return console.log("Is ready?",this.props,super.isReadyToLoad()&&this.props.library!=null),super.isReadyToLoad()&&this.props.library!=null}getTheme(e){return e}getRoot(){return this.getAttribute("isolate")==="false"?this:this.shadowRoot||this.attachShadow({mode:"open"})}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}connectedCallback(){Array.from(this.children).forEach(e=>{this.getRoot().appendChild(e)}),super.connectedCallback()}render({children:e,library:r},{AppContext:i,Chakra:{Button:n,Tooltip:o},React:s}){let a={containerRef:{current:this.getRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.createElement(i,{backend:this.props.backend,libraryId:this.props.library,container:this.getRoot(),auth:this.props.auth,getTheme:this.getTheme,onStatusChange:this.onStatusChange,modalProps:{portalProps:a},chakraProps:{cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},e)}};rt.observedAttributes=["library","component","version","revision","hostname","template"];rt.register("feaas-context");
68
+ </div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};Q.observedAttributes=["hidden","opacity"];Q.register("feaas-loader");function Gt(t=this){var e,r,i,n;let o=t.getAttribute("src");if(o)var{cdn:s,library:a,revision:l}=ut(o);return{library:t==null?void 0:t.getContextAttribute("library"),revision:(r=(e=t==null?void 0:t.getAttribute("revision"))!==null&&e!==void 0?e:l)!==null&&r!==void 0?r:"published",cdn:(n=(i=t==null?void 0:t.getContextAttribute("cdn"))!==null&&i!==void 0?i:t==null?void 0:t.getContextAttribute("hostname"))!==null&&n!==void 0?n:_}}var ht=class extends y{constructor(){super(...arguments),this.onLoad=e=>{this.payload=e,this.advance()}}getProps(){return Gt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return dt(this.props,this.onLoad)}};ht.register("feaas-stylesheet");var Rt;typeof window!="undefined"&&(window.FEAASElement=N,(Rt=window.FEAASLoading)!==null&&Rt!==void 0||(window.FEAASLoading=Promise.resolve()));function Yt(t){let e=[];if(t){let r=t.ownerDocument.defaultView,i,n;for(;r!==window.top;){i=r.parent;for(let o=0;o<i.frames.length;o++)if(i.frames[o]===r){for(let s of i.document.getElementsByTagName("iframe"))if(s.contentWindow===r){n=s.getBoundingClientRect();let a=s.contentWindow.getComputedStyle(s);e.push({left:n.left+parseInt(a.borderLeftWidth),top:n.top+parseInt(a.borderTopWidth)})}r=i;break}}}return e.reduce((r,i)=>({left:r.left+i.left,top:r.top+i.top}),{left:0,top:0})}function Zt(t=this){var e;return{context:HTMLElement,frontend:t==null?void 0:t.getContextAttribute("frontend"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/editor.js",library:t==null?void 0:t.getAttribute("library"),component:t==null?void 0:t.getAttribute("component"),version:t==null?void 0:t.getAttribute("version"),instance:t==null?void 0:t.getAttribute("instance"),forked:t==null?void 0:t.getAttribute("forked"),revision:(t==null?void 0:t.getAttribute("revision"))||"saved",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,for:t==null?void 0:t.getAttribute("for"),state:(t==null?void 0:t.getAttribute("state"))||"idle",changed:(t==null?void 0:t.getAttribute("changed"))!=null}}var X=class extends y{constructor(){super(...arguments),this.framePoint={top:0,left:0},this.wrapperRect={top:0,left:0,width:0,height:0},this.bodyRect={top:0,left:0,width:0,height:0},this.defaultProps={hidden:!1},this.setTarget=(e,r={component:e.getAttribute("component"),version:e.getAttribute("version"),revision:e.getAttribute("revision"),instance:e.getAttribute("instance")})=>{if(!this.closing&&(!this.target||e==null))return this.set(r),this.target=e,!0},this.onChromeMeasureElement=(e,r=e.getBoundingClientRect())=>e.ownerDocument==document?{left:r.left-this.bodyRect.left,top:r.top-this.bodyRect.top,width:r.width,height:r.height}:{left:r.left+this.framePoint.left-this.bodyRect.left,top:r.top+this.framePoint.top-this.bodyRect.top,width:r.width,height:r.height},this.onBeforeMeasure=e=>{e.memoized.focusable&&(this.framePoint=Yt(e.memoized.focusable)),this.chrome&&(this.wrapperRect=this.chrome.positionable.getBoundingClientRect(),this.bodyRect=this.chrome.positionable.ownerDocument.body.parentElement.getBoundingClientRect())},this.onMeasure=()=>{},this.onPosition=({focusable:e,root:r})=>{!this.chrome||this.props.hidden||(e?(this.chrome.wrapper.style.width=e.width+16*2+"px",this.chrome.wrapper.style.height=e.height+16*1+64+"px",this.chrome.wrapper.style.left=e.left-16+"px",this.chrome.wrapper.style.top=e.top-64+"px",this.chrome.wrapper.style.opacity="1",this.chrome.absolute=this.querySelector(".ui.overlays"),this.chrome.absolute&&(this.chrome.absolute.style.left=r.left+"px",this.chrome.absolute.style.top=r.top+"px")):(this.chrome.wrapper.style.opacity="0",this.chrome.wrapper.style.left="-1000px",this.chrome.wrapper.style.top="-1000px"))},this.onWindowMessage=e=>{var r;switch((r=e.data)===null||r===void 0?void 0:r.type){case"feaasEdit":let i=this.getPlaceholder();this.setTarget(i.editable,e.data)&&(this.loader=i.loader,document.body.appendChild(i.clipper),this.editedUID=e.data.id,this.setPlaceholder(),this.open());break;case"feaasMeasurements":this.measurements=e.data.measurements,this.props.hidden||this.setPlaceholder();break}},this.onContentChange=()=>{this.setAttribute("changed","changed"),requestAnimationFrame(()=>{this.setIframeComponentContent()})},this.onClose=()=>{var e;this.setAttribute("hidden","hidden"),this.placeholder&&(this.placeholder.positionable.style.opacity="0",this.placeholder.positionable.style.pointerEvents="none"),this.chrome&&(this.chrome.wrapper.style.opacity="0"),!((e=this.target)===null||e===void 0)&&e.parentNode&&(this.target.outerHTML=this.target.outerHTML),this.setTarget(null,{component:null,version:null,instance:null,revision:null}),this.setEditorContext({isFocused:!1})},this.onVersionStateChange=(e,r)=>{this.versionContext=e,this.setVersionContext=r},this.onEditorStateChange=(e,r)=>{this.editorContext=e,this.setEditorContext=r,e.editor&&this.props.state=="loading"&&!this.props.hidden&&(this.setAttribute("state","ready"),this.ownerDocument.fonts.ready.then(()=>setTimeout(()=>{this.setReadyState(),this.setIframeComponentContent()},100)))}}getProps(){return Zt(this)}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}showLoader(){this.loader||(this.loader=document.createElement("feaas-loader"),this.loader.setAttribute("opacity","0.6"),this.loader.style.zIndex="1000",this.target.appendChild(this.loader),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative"))}hideLoader(){this.loader&&(this.loader.setAttribute("hidden","hidden"),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative",this.target.style.position=""))}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.onWindowMessage)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.onWindowMessage)}setIframe(e){this.iframe=e}setIframeComponentContent(){this.placeholder&&this.iframe&&this.placeholder.editable.innerHTML&&this.iframe.contentWindow.postMessage({type:"feaasUpdate",id:this.editedUID,content:this.placeholder.editable.innerHTML})}setPlaceholder(){if(!this.iframe)return;let e=this.iframe.clientWidth,r=this.iframe.clientHeight,i=this.iframe.getBoundingClientRect(),n=this.getPlaceholder(),o=document.body.getBoundingClientRect(),s=this.measurements[this.editedUID];s&&(Object.assign(n.clipper.style,{position:"absolute",top:i.top+this.iframe.clientTop-o.top+"px",left:i.left+this.iframe.clientLeft-o.left+"px",width:e+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(n.positionable.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(n.loader.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",height:s.height+"px",filter:"opacity(0.6)",zIndex:3,pointerEvents:"none"}),document.dispatchEvent(new Event("feaasRefresh",{bubbles:!0})))}getPlaceholder(){return this.placeholder?this.placeholder:(this.placeholder={clipper:document.createElement("div"),positionable:document.createElement("div"),editable:Object.assign(document.createElement("div"),{className:"-feaas"}),loader:document.createElement("feaas-loader")},this.placeholder.clipper.appendChild(this.placeholder.positionable),this.placeholder.positionable.appendChild(this.placeholder.editable),this.placeholder.clipper.appendChild(this.placeholder.loader),this.placeholder)}attributeChangedCallback(e,r,i){r!==i&&(e=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(e,r,i))}open(){clearTimeout(this.closing),this.removeAttribute("hidden"),this.removeAttribute("changed"),this.setLoadingState()}shouldFork(e){return e.forkOriginId==null&&this.props.instance!=null}cleanup(){var e;this.placeholder&&((e=this.placeholder.clipper)===null||e===void 0||e.remove(),this.placeholder=null)}close(){console.log("Editor is not ready")}unfork(){console.log("Editor is not ready")}discard(){console.log("Editor is not ready")}save(){console.log("Editor is not ready")}setVersionContext(e){console.log("Editor is not ready")}setEditorContext(e){console.log("Editor is not ready")}setLoadingState(){this.showLoader(),this.setAttribute("state","loading")}setReadyState(){this.hideLoader(),this.setEditorContext({activeVersionId:this.component.versions[0].id}),this.setAttribute("state","ready")}render({children:e,component:r,version:i,instance:n},{Editor:o,VersionStatusList:s,VersionStatusButton:a,Version:l,VersionMenu:c,EditorUIUndo:u,EditorUIMode:p,React:{useEffect:d,useMemo:v,useState:E,useContext:b},Chakra:{HStack:w,Box:A,Button:rt,MenuItem:P},Chrome:it,ReactDOM:_t,useSDK:F,useSlots:T,useModelObserver:D,ConfirmationContext:pt,VersionContext:nt}){if(!this.payload)return;let{React:h}=this.payload,{sdk:L}=F(),[m,Ft]=E(),{setConfirm:ft}=b(pt),j=n||i,te=L.library;m&&(this.component=m),d(()=>{if(this.props.hidden)return;let x=te.components.getItem(r).clone();return x.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(vt=>{x.versions.setItems(vt);let C=x.findVersion(n,["staged","published"]),H=x.findVersion(i,["staged","published"]);if(C)C.deletedAt?(C.getDraft().changeAndNotify(H.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",C.id));else if(this.removeAttribute("forked"),this.shouldFork(H)){console.error("FEAAS Editor: Forking");let yt=H.fork(n).id;this.setAttribute("instance",yt)}else console.error("FEAAS Editor: Regular");Ft(x)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),Ft(null)},400)}},[i,this.props.hidden]);let kt=D(m==null?void 0:m.versions,[]).filter(x=>x.id==j),W=kt[0];W&&!this.props.hidden&&(this.version=W),d(()=>(this.unfork=()=>{ft({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let x=m.findVersion(i,["staged","published"]);m.findVersion(n).unstage().unpublish().changeAndNotify(x.toProperties()),m.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(m.findVersion(j).revert(),m.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{ft({title:"Component has unsaved changes",button:"Discard",body:"Are you sure to close editor and discard changes?",bypass:!this.props.changed,action:()=>{this.discard(),requestAnimationFrame(this.onClose)}})},this.save=()=>{ft({bypass:!!this.props.forked,title:"Customizing component",button:"Save",body:"Changes to the component will only be visible on that page. Changes to component done in Component Builder will not be reflected here. It will be possible to revert the customization.",action:()=>{m.findVersion(j).commitData({view:this.editorContext.editor.getData({rootName:j}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",j),m.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[m]);let ee=v(()=>this.target,[m]);return v(()=>m&&T(e,({picker:x,children:vt})=>h.createElement(A,{ref:C=>{this.chrome=C?{positionable:C,wrapper:C.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},h.createElement(A,{className:"editor-wrapper",position:"absolute",left:0,top:0},h.createElement(o,{datasources:L.datasources,sdk:L,library:L.library,component:m,versions:kt,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:vt,chrome:({editor:C})=>C&&h.createElement(it,null),children:({isArchivedDisplayed:C,editor:H,status:yt})=>h.createElement(A,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},h.createElement(A,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(A,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(A,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(A,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),W&&h.createElement(l,{version:W,node:ee,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:h.createElement(w,{justifyContent:"space-between"},h.createElement(u,{size:"sm",editor:yt=="ready"?H:null}),h.createElement(p,{size:"sm"})),middle:(Oe,Me)=>[!1],right:h.createElement(h.Fragment,null,h.createElement(rt,{variant:"secondary",size:"sm",onClick:this.close},"Close"),h.createElement(rt,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),h.createElement(c,{isDisabled:!this.props.forked&&!this.props.changed},h.createElement(P,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),h.createElement(P,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[W,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};X.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];X.register("feaas-editor");function Qt(t=this){var e,r;return{part:(t==null?void 0:t.getAttribute("part"))||"picker",slot:(t==null?void 0:t.getAttribute("part"))||"picker",mode:t==null?void 0:t.getAttribute("mode"),placeholder:(t==null?void 0:t.getAttribute("placeholder"))||"No theme",frontend:(e=t==null?void 0:t.getContextAttribute("frontend"))!==null&&e!==void 0?e:"https://components.sitecorecloud.io",src:(r=t==null?void 0:t.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,variant:t==null?void 0:t.getAttribute("variant"),context:void 0,onClose:void 0,onContextAttributeSet:void 0}}var tt=class extends y{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Qt(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}render({placeholder:e,context:r,mode:i,children:n,variant:o},{Picker:s,React:a,ReactDOM:l}){return a.createElement(s,{placeholder:e,mode:i||void 0,onClose:this.props.onClose,onContextAttributeSet:this.props.onContextAttributeSet,context:r,variant:o},n)}};tt.observedAttributes=["library","mode","frontend","src","hidden","variant"];tt.register("feaas-picker");function Xt(t=this){var e,r,i,n;return{library:t==null?void 0:t.getAttribute("library"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/context.js",frontend:(r=t==null?void 0:t.getAttribute("frontend"))!==null&&r!==void 0?r:"https://components.sitecoreclud.io",backend:(i=t==null?void 0:t.getAttribute("backend"))!==null&&i!==void 0?i:"https://components-api.sitecoreclud.io",cdn:(n=t==null?void 0:t.getAttribute("cdn"))!==null&&n!==void 0?n:"https://feaascompontsapiprod.blob.core.windows.net",auth:null,isolate:(t==null?void 0:t.getAttribute("isolate"))==null||(t==null?void 0:t.getAttribute("isolate"))=="true"}}var et=class extends y{constructor(){super(...arguments),this.defaultProps={isolate:!0},this.onStatusChange=e=>{e=="ready"&&this.dispatchEvent(new Event("feaasReady",{bubbles:!0,composed:!0}))}}getProps(){return Xt(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}isReadyToLoad(){return console.log("Is ready?",this.props,super.isReadyToLoad()&&this.props.library!=null),super.isReadyToLoad()&&this.props.library!=null}getTheme(e){return e}getRoot(){return this.getAttribute("isolate")==="false"?this:this.shadowRoot||this.attachShadow({mode:"open"})}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}connectedCallback(){Array.from(this.children).forEach(e=>{this.getRoot().appendChild(e)}),super.connectedCallback()}render({children:e,library:r},{AppContext:i,Chakra:{Button:n,Tooltip:o},React:s}){let a={containerRef:{current:this.getRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.createElement(i,{backend:this.props.backend,libraryId:this.props.library,container:this.getRoot(),auth:this.props.auth,getTheme:this.getTheme,onStatusChange:this.onStatusChange,modalProps:{portalProps:a},chakraProps:{cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},e)}};et.observedAttributes=["library","component","version","revision","hostname","template"];et.register("feaas-context");
69
69
  //# sourceMappingURL=index.js.map