@sitecore-feaas/clientside 0.1.51 → 0.1.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -113,3 +113,64 @@ import * as FEAAS from '@sitecore-feaas/clientside'
113
113
  // Load stylesheet (will automatically add it )
114
114
  <feaas-stylesheet='library_id'></feaas-stylesheet>
115
115
  ```
116
+
117
+ ### Entrypoints
118
+
119
+ There are three different entrypoints for clientside: UI, React and Headless
120
+ 1. The main entrypoint `@sitecore-feaas/clientside` targets the UI package which references frontend
121
+ from components monorepo. This includes both the core functionality and some ui components like
122
+ the pickers and the embedded editor
123
+ 2. The `@sitecore-feaas/clientside/react` entrypoint targets the React package which is similar to the main entrypoint
124
+ but also includes some components that use React as a dependency like external react components.
125
+ 3. The `@sitecore-feaas/clientside/headless` entrypoint targets the Headless package which includes just the
126
+ core functionality of clientside without any dependencies on frontend or react.
127
+ ---
128
+ **NOTE 1:** React library is not included in any clientside package, we assume that it is already installed in the container that uses the `@sitecore-feaas/clientside/react` entrypoint. We mark React library as external in scripts/build.js
129
+
130
+ **NOTE 2:** UI has its own tsconfig that includes references to both `/frontend` and `/clientside`. Clientside main tsconfig excludes `/ui` avoiding circular imports
131
+
132
+ ---
133
+
134
+ ### Bring your own code components
135
+
136
+ You can use Components clientside SDK to register and render your own code components to your FEAAS components.
137
+ Registration steps:
138
+ - Install and import the Components React SDK to your App
139
+ ```bash
140
+ npm install @sitecore-feaas/clientside
141
+ ```
142
+ ```typescript
143
+ import * as FEAAS from "@sitecore-feaas/clientside/react"
144
+ ```
145
+ - Register your component via
146
+ ```typescript
147
+ registerComponent(component, schema, name)
148
+ ```
149
+ `component` is the actual react component, `schema` (optional) is a JSON Schema representation
150
+ of your component properties. If not provided, the component will be registered as a prop-less component.
151
+ `name` (optional) is a name for your component as it will be shown to the user. If not provided, will be function name in title case.
152
+ An example of `schema` is provided below:
153
+ ```typescript
154
+ const exampleComponentSchema = {
155
+ title: 'My example component title',
156
+ description: 'Description of my example component',
157
+ type: 'object',
158
+ required: ['firstName'],
159
+ properties: {
160
+ firstName: {
161
+ type: 'string',
162
+ title: 'First name',
163
+ required: true
164
+ },
165
+ lastName: {
166
+ type: 'string',
167
+ title: 'Last name'
168
+ },
169
+ telephone: {
170
+ type: 'string',
171
+ title: 'Telephone',
172
+ minLength: 10
173
+ }
174
+ }
175
+ }
176
+ ```
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import ReactDOM from 'react-dom';
3
3
  import { FEAASBase } from '../components/FEAASBase.js';
4
4
  import { kebabCase, reverseKebabCase } from '../utils/string.js';
5
+ import { Component } from './react.js';
5
6
  const convertSchemaPropertiesToKebabCase = (schema) => {
6
7
  if (!schema)
7
8
  return;
@@ -15,13 +16,39 @@ const convertSchemaPropertiesToKebabCase = (schema) => {
15
16
  }
16
17
  return { ...schema, properties: kebabSchemaProperties, required: kebabRequiredProperties };
17
18
  };
19
+ // TODO: parse object, number, array, boolean etc props
20
+ export const parseProps = (propName, propValue, properties) => {
21
+ var _a;
22
+ switch ((_a = properties === null || properties === void 0 ? void 0 : properties[propName]) === null || _a === void 0 ? void 0 : _a.type) {
23
+ case 'string':
24
+ return propValue;
25
+ case 'object':
26
+ return JSON.parse(propValue);
27
+ case 'array':
28
+ return JSON.parse(propValue);
29
+ case 'number':
30
+ return +propValue;
31
+ case 'integer':
32
+ return +propValue;
33
+ case 'boolean':
34
+ return propValue === 'true';
35
+ default:
36
+ return propValue;
37
+ }
38
+ };
18
39
  export function FEAASExternalProps(element = this) {
40
+ var _a;
19
41
  const attributes = element.getAttributeNames();
42
+ const id = element.getAttribute('data-external-id');
43
+ const schema = (_a = FEAASExternal.registered[id]) === null || _a === void 0 ? void 0 : _a.schema;
20
44
  const props = attributes.reduce((prev, curr) => {
21
- if (!curr.startsWith('data-attribute') && !['class', 'id', 'contenteditable'].includes(curr))
22
- return { ...prev, [reverseKebabCase(curr)]: element.getAttribute(curr) };
23
- else
45
+ if (!curr.startsWith('data-attribute') && !['class', 'id', 'contenteditable'].includes(curr)) {
46
+ const value = element.getAttribute(curr);
47
+ return { ...prev, [reverseKebabCase(curr)]: parseProps(curr, value, schema === null || schema === void 0 ? void 0 : schema.properties) };
48
+ }
49
+ else {
24
50
  return prev;
51
+ }
25
52
  }, {});
26
53
  return props;
27
54
  }
@@ -47,30 +74,35 @@ export default class FEAASExternal extends FEAASBase {
47
74
  // if registerCallback has not already been triggered by another component, set it
48
75
  if (!FEAASExternal.registrationCallback && typeof window !== 'undefined') {
49
76
  FEAASExternal.registrationCallback = setTimeout(() => {
50
- var _a, _b;
77
+ var _a;
51
78
  // create components array from object
52
79
  const components = Object.keys(FEAASExternal.registered).map((name) => ({
53
80
  ...FEAASExternal.registered[name],
54
81
  name,
55
- schema: convertSchemaPropertiesToKebabCase(FEAASExternal.registered[name].schema),
56
- component: FEAASExternal.registered[name].component.toString()
82
+ schema: convertSchemaPropertiesToKebabCase(FEAASExternal.registered[name].schema)
83
+ //component: FEAASExternal.registered[name].component.toString()
57
84
  }));
58
85
  // send components from iframe to parent window
59
86
  (_a = window === null || window === void 0 ? void 0 : window.parent) === null || _a === void 0 ? void 0 : _a.postMessage(JSON.stringify({
60
87
  action: 'register-components',
61
88
  data: components
62
- }), (_b = window === null || window === void 0 ? void 0 : window.parent) === null || _b === void 0 ? void 0 : _b.origin);
89
+ }), '*');
63
90
  }, 500);
64
91
  }
65
92
  }
66
- static loadComponents() {
67
- const components = JSON.parse(sessionStorage.getItem('feaas-external-components'));
68
- components.forEach((c) => {
69
- const name = c.name;
70
- const schema = c.schema;
71
- const component = eval('(' + c.component + ')');
72
- FEAASExternal.registerComponent(component, schema, name);
73
- });
93
+ /*static loadComponents() {
94
+ const components = JSON.parse(sessionStorage.getItem('feaas-external-components'))
95
+ components.forEach((c: { name: string; schema: any; component: React.FC }) => {
96
+ const name = c.name
97
+ const schema = c.schema
98
+ const component = eval('(' + c.component + ')')
99
+ FEAASExternal.registerComponent(component, schema, name)
100
+ })
101
+ }*/
102
+ static Preview(props) {
103
+ var _a;
104
+ const src = (props === null || props === void 0 ? void 0 : props.src) || (typeof window !== 'undefined' ? (_a = window.location.search.match(/feaasSrc=([^&]+)/)) === null || _a === void 0 ? void 0 : _a[1] : null);
105
+ return src ? React.createElement(Component, { src: src, ...props }) : null;
74
106
  }
75
107
  }
76
108
  FEAASExternal.registered = {};
@@ -1 +1 @@
1
- {"version":3,"file":"FEAASExternal.js","sourceRoot":"","sources":["../../src/ui/FEAASExternal.tsx"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"FEAASExternal.js","sourceRoot":"","sources":["../../src/ui/FEAASExternal.tsx"],"names":[],"mappings":"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"}
package/build/ui/react.js CHANGED
@@ -5,7 +5,7 @@ import { renderHTMLContent } from '../dom/html.js';
5
5
  export { renderHTMLContent };
6
6
  export { External } from './FEAASExternal.js';
7
7
  export function FEAASEmbed({ data, ...props }) {
8
- if ('template' in props && typeof props.template == 'string') {
8
+ if ('template' in props && props.template) {
9
9
  var html = renderHTMLContent(props.template, data || {});
10
10
  }
11
11
  if ('src' in props) {
@@ -1 +1 @@
1
- {"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/ui/react.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAuB,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACtE,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,MAAM,UAAU,UAAU,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,EAA4B;IACrE,IAAI,UAAU,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,QAAQ,IAAI,QAAQ,EAAE;QAC5D,IAAI,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,CAAA;KACzD;IACD,IAAI,KAAK,IAAI,KAAK,EAAE;QAClB,KAAK,GAAG;YACN,GAAG,oBAAoB,CAAC,KAAK,CAAC,GAAG,CAAC;YAClC,GAAG,KAAK;SACT,CAAA;KACF;IACD,OAAO,CACL,4CACM,KAAK,EACT,QAAQ,EAAE,IAAI,EACd,IAAI,EAAE,OAAO,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EACzE,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,IAAI,EAAE,EAAE,GAC/C,CACH,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAA"}
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/ui/react.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAuB,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACtE,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,EAAE,iBAAiB,EAAE,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,MAAM,UAAU,UAAU,CAAC,EAAE,IAAI,EAAE,GAAG,KAAK,EAA4B;IACrE,IAAI,UAAU,IAAI,KAAK,IAAI,KAAK,CAAC,QAAQ,EAAE;QACzC,IAAI,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,CAAA;KACzD;IACD,IAAI,KAAK,IAAI,KAAK,EAAE;QAClB,KAAK,GAAG;YACN,GAAG,oBAAoB,CAAC,KAAK,CAAC,GAAG,CAAC;YAClC,GAAG,KAAK;SACT,CAAA;KACF;IACD,OAAO,CACL,4CACM,KAAK,EACT,QAAQ,EAAE,IAAI,EACd,IAAI,EAAE,OAAO,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EACzE,uBAAuB,EAAE,EAAE,MAAM,EAAE,IAAI,IAAI,EAAE,EAAE,GAC/C,CACH,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAA"}
@@ -1,7 +1,7 @@
1
- var me=Object.create;var lt=Object.defineProperty;var be=Object.getOwnPropertyDescriptor;var ge=Object.getOwnPropertyNames;var ye=Object.getPrototypeOf,Ee=Object.prototype.hasOwnProperty;var Ae=(t,e)=>{for(var r in e)lt(t,r,{get:e[r],enumerable:!0})},$t=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ge(e))!Ee.call(t,i)&&i!==r&&lt(t,i,{get:()=>e[i],enumerable:!(n=be(e,i))||n.enumerable});return t};var Et=(t,e,r)=>(r=t!=null?me(ye(t)):{},$t(e||!t||!t.__esModule?lt(r,"default",{value:t,enumerable:!0}):r,t)),we=t=>$t(lt({},"__esModule",{value:!0}),t);var Ye={};Ae(Ye,{Base:()=>b,Component:()=>Ge,ComponentProps:()=>re,DEFAULT_CDN_URL:()=>F,External:()=>_FEAASExternal,FEAASBase:()=>b,FEAASComponent:()=>tt,FEAASComponentsProps:()=>re,FEAASContext:()=>it,FEAASContextProps:()=>le,FEAASEditor:()=>rt,FEAASEditorProps:()=>se,FEAASEmbed:()=>pe,FEAASLoader:()=>et,FEAASLoaderProps:()=>ne,FEAASPicker:()=>nt,FEAASPickerProps:()=>ae,FEAASStylesheet:()=>vt,FEAASStylesheetProps:()=>ie,JSONPath:()=>m,Loader:()=>et,MyComponent:()=>ut,Stylesheet:()=>vt,autoloadScripts:()=>qt,cleanCollectionBit:()=>Wt,clearFetchCache:()=>je,createStylesheet:()=>te,fetchAndRevalidate:()=>kt,fetchAndRevalidateComponent:()=>W,fetchAndRevalidateStylesheet:()=>pt,fetchBypassingCache:()=>dt,fetchCache:()=>X,fetchComponent:()=>We,fetchToValidateCache:()=>Z,fetchWithCacheAwareness:()=>M,findStylesheet:()=>Qt,getComponentSource:()=>Ue,getComponentURL:()=>Pt,getFetchCache:()=>Xt,getFramePosition:()=>oe,getStylesheetSource:()=>He,getStylesheetURL:()=>Q,loadScript:()=>Y,loadStylesheet:()=>ft,loadStylesheetAllowStale:()=>Dt,normalizeCollectionScope:()=>St,observeDOMElement:()=>Vt,parseComponentSource:()=>L,parseStylesheetSource:()=>ht,queryScopes:()=>ct,renderComponent:()=>qe,renderComponentElement:()=>Ve,renderComponentPromise:()=>ee,renderDOMContent:()=>H,renderDOMElement:()=>_,renderHTMLContent:()=>Ft,renderStylesheet:()=>ze,renderStylesheetPromise:()=>Zt,serializeCH1RichText:()=>j,setDOMAttribute:()=>U});module.exports=we(Ye);function P(t,e=r=>{}){var r;let n=()=>{var i,o;let s=new Promise((l,d)=>{i=u=>{t==null||t(u),l(u)},o=d});var a=Object.assign(s,{resolve:i,reject:o,restart:n,first:r});return r=a,a.catch(e),a};return n()}var xe=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,b=class extends xe{getProps(e){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=P(e=>{this.payload=e}),this.whenRendered=P(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(e,r,n){this.set()}connectedCallback(){this.mount()}disconnectedCallback(){this.unmount()}mount(){try{let e=this.getParent();if(e&&!e.connected||this.connected)return;this.connected=!0,this.log("FEAAS: Mount",this.tagName,this),this.dispatchEvent(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var n;return(n=r.mount)===null||n===void 0?void 0:n.call(r)}),this.set()}catch(e){this.onError(e)}}log(...e){console.log(...e)}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEvent(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected=!1)}getParent(e=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!e||r.tagName.startsWith("FEAAS-"))return r}getElements(e=this.getRoot(),r=!0){return Array.from(e.querySelectorAll("*")).map(n=>[!r||n.tagName.startsWith("FEAAS-")?n:null,n.shadowRoot?this.getElements(n.shadowRoot,r):null]).flat().filter(Boolean)}handleEvent(e){let r=e.composedPath()[0];switch(e.type){case"feaasMount":r!=this&&this.nestedCallback(r);break;case"feaasUnmount":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(e){let r=this.descendants.indexOf(e);r!=-1&&(this.log("FEAAS: Unnest",this,e),this.descendants.splice(r,-1),this.refs[e.getComponentName()]=null,e.refs.parent==this&&(e.refs.parent=null),e.refs.top==this&&(e.refs.top=e.refs.parent))}nestedCallback(e){var r,n;if(this.descendants.indexOf(e)==-1&&(this.descendants.push(e),this.log("FEAAS: Nest",this,e),this.refs[e.getComponentName()]=e,e.refs.top=this,(r=e.refs).parent||(r.parent=this),e.render))for(var o=e.refs.parent;o;o=o.refs.parent)o.render&&((n=e.refs).parentReact||(n.parentReact=o),e.refs.topReact=o)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(e,r="uncaught",n=!1){let i=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:e});if(this.dispatchEvent(i),this.whenLoaded.reject(e),!i.defaultPrevented&&!n){this.whenRendered.reject(e);try{this.unmount()}catch(o){}return!0}return!1}shouldUpdateOnLoad(){return!0}async advance(){try{if(this.payload===void 0){if(!this.isReadyToLoad())return;this.payload=null,this.dispatchEvent(new Event("feaasLoad",{bubbles:!0,composed:!0}));let e=await this.load().catch(r=>{throw this.payload=void 0,r});if(this.whenLoaded.resolve(e),this.onLoad)return}else if(this.payload==null)return;this.flush(),this.whenRendered.resolve(this)}catch(e){this.onError(e)}}flush(){var e,r;let n=(r=(e=this.payload)===null||e===void 0?void 0:e.ReactDOM)===null||r===void 0?void 0:r.flushSync;n?n(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var e,r,n;if(this.payload==null||!this.render)return;let{React:i,ReactDOM:o,ReactDOMClient:s}=this.payload||{};if(!i)throw new Error(`${this.tagName}: React is not present in payload`);if(!o)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?s?(this.reactRoot||(this.reactRoot=s.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):o.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact?(e=this.forceUpdateReact)===null||e===void 0||e.call(this):(n=(r=this.refs.topReact).forceUpdateReact)===null||n===void 0||n.call(r)}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let n=this.descendants.filter(i=>i.refs.parentReact==this&&i.payload).map((i,o)=>this.getReactElement(i));return this.render({...this.props,children:n},this.payload)}getReactErrorBoundary(e=this,r=e.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:n,ReactDOM:i}=e.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends n.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,a){console.error(`FEAAS: ${e.tagName} Error:`,s,a),e.onError(s,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(e=this,r){let{React:n,ReactDOM:i}=e.payload||{},o=this.getReactErrorBoundary(),s=this.getReactWrapper(e);return n.createElement(o,{key:e.tagName+"-"+e.getUID(),slot:e.getAttribute("slot")},n.createElement(s,null))}getReactWrapper(e=this,r=e.tagName){if(e.reactWrapper)return e.reactWrapper;let{React:n,ReactDOM:i}=e.payload||{};return e.reactWrapper=o=>{if(e.render){let[s,a]=n.useReducer(l=>l+1,0);return e.forceUpdateReact=a,i.createPortal(n.createElement(n.Fragment,null,e.invokeReactRendering()),e.getReactRootElement())}else return e.update()},Object.assign(e.reactWrapper,{key:e.tagName+"-"+e.getUID(),displayName:r}),e.reactWrapper}getUID(){return this.uid||(this.uid=String(Math.random()))}getShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}getReactRootElement(){return this.useShadowRoot?this.getShadowRoot():this.getRoot()}set(e){try{this.scheduleRender(),this.overrides={...this.overrides,...e},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let n=this.props[r],i=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();n==null||n===this.defaultProps[r]?this.removeAttribute(i):(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&this.getAttribute(i)!=String(n)&&this.setAttribute(i,String(n))}}catch(n){this.whenRendered.reject(n),this.onError(n,"set")}return this}import(e){return import( /*@vite-ignore*/ /* webpackIgnore: true */ e)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(e=>{})})}formatURL(e,r){return typeof e=="string"&&e.match(/^\/[^\/]/)?r+e:e}getContextAttribute(e,r=this){for(var n=this;n=n.parentElement||(n.parentNode instanceof ShadowRoot?n.parentNode.host:null);)if(n.getAttribute(e)!=null)return n.getAttribute(e);return this.getAttribute(e)}static register(e,r){r==null&&(r=typeof window!="undefined"?window:null),r&&!r.customElements.get(e)&&r.customElements.define(e,this)}};var I=class extends b{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([e,r])=>({React:e,ReactDOM:r}))}render({},{React:e}){return e.createElement(e.Fragment,null)}},ut=class extends I{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:e},{React:r}){let[n,i]=r.useState(0);return r.useEffect(()=>{i(o=>o+1)},[e]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",e),r.createElement("p",null,"Triggered updates: ",n))}};ut.observedAttributes=["counter"];function R(t){return R=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},R(t)}function It(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Bt(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function jt(t,e,r){return e&&Bt(t.prototype,e),r&&Bt(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ce(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&&G(t,e)}function K(t){return K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},K(t)}function G(t,e){return G=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},G(t,e)}function Ut(){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 J(t,e,r){return Ut()?J=Reflect.construct.bind():J=function(i,o,s){var a=[null];a.push.apply(a,o);var l=Function.bind.apply(i,a),d=new l;return s&&G(d,s.prototype),d},J.apply(null,arguments)}function Se(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function At(t){var e=typeof Map=="function"?new Map:void 0;return At=function(n){if(n===null||!Se(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return J(n,arguments,K(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),G(i,n)},At(t)}function Re(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _e(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 Re(t)}function Fe(t){var e=Ut();return function(){var n=K(t),i;if(e){var o=K(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return _e(this,i)}}function ke(t){return Pe(t)||De(t)||Ht(t)||Oe()}function Pe(t){if(Array.isArray(t))return wt(t)}function De(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Ht(t,e){if(t){if(typeof t=="string")return wt(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 wt(t,e)}}function wt(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Oe(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ne(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Ht(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:i}}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 A=Object.prototype.hasOwnProperty;function N(t,e){return t=t.slice(),t.push(e),t}function xt(t,e){return e=e.slice(),e.unshift(t),e}var Te=function(t){Ce(r,t);var e=Fe(r);function r(n){var i;return It(this,r),i=e.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),i.avoidNew=!0,i.value=n,i.name="NewError",i}return jt(r)}(At(Error));function m(t,e,r,n,i){if(!(this instanceof m))try{return new m(t,e,r,n,i)}catch(l){if(!l.avoidNew)throw l;return l.value}typeof t=="string"&&(i=n,n=r,r=e,e=t,t=null);var o=t&&R(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=A.call(t,"wrap")?t.wrap:!0,this.sandbox=t.sandbox||{},this.preventEval=t.preventEval||!1,this.parent=t.parent||null,this.parentProperty=t.parentProperty||null,this.callback=t.callback||n||null,this.otherTypeCallback=t.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){var s={path:o?t.path:e};o?"json"in t&&(s.json=t.json):s.json=r;var a=this.evaluate(s);if(!a||R(a)!=="object")throw new Te(a);return a}}m.prototype.evaluate=function(t,e,r,n){var i=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=n||this.otherTypeCallback,e=e||this.json,t=t||this.path,t&&R(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(!A.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var d=t;e=d.json,a=A.call(t,"flatten")?t.flatten:a,this.currResultType=A.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=A.call(t,"sandbox")?t.sandbox:this.currSandbox,l=A.call(t,"wrap")?t.wrap:l,this.currPreventEval=A.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=A.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=A.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,o=A.call(t,"parent")?t.parent:o,s=A.call(t,"parentProperty")?t.parentProperty:s,t=t.path}if(o=o||null,s=s||null,Array.isArray(t)&&(t=m.toPathString(t)),!(!t&&t!==""||!e)){var u=m.toPathArray(t);u[0]==="$"&&u.length>1&&u.shift(),this._hasParentSelector=null;var f=this._trace(u,e,["$"],o,s,r).filter(function(h){return h&&!h.isParentSelector});return f.length?!l&&f.length===1&&!f[0].hasArrExpr?this._getPreferredOutput(f[0]):f.reduce(function(h,v){var w=i._getPreferredOutput(v);return a&&Array.isArray(w)?h=h.concat(w):h.push(w),h},[]):l?[]:void 0}};m.prototype._getPreferredOutput=function(t){var e=this.currResultType;switch(e){case"all":{var r=Array.isArray(t.path)?t.path:m.toPathArray(t.path);return t.pointer=m.toPointer(r),t.path=typeof t.path=="string"?t.path:m.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return m.toPathString(t[e]);case"pointer":return m.toPointer(t.path);default:throw new TypeError("Unknown result type")}};m.prototype._handleCallback=function(t,e,r){if(e){var n=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:m.toPathString(t.path),e(n,r,t)}};m.prototype._trace=function(t,e,r,n,i,o,s,a){var l=this,d;if(!t.length)return d={path:r,value:e,parent:n,parentProperty:i,hasArrExpr:s},this._handleCallback(d,o,"value"),d;var u=t[0],f=t.slice(1),h=[];function v(p){Array.isArray(p)?p.forEach(function(B){h.push(B)}):h.push(p)}if((typeof u!="string"||a)&&e&&A.call(e,u))v(this._trace(f,e[u],N(r,u),e,u,o,s));else if(u==="*")this._walk(e,function(p){v(l._trace(f,e[p],N(r,p),e,p,o,!0,!0))});else if(u==="..")v(this._trace(f,e,r,n,i,o,s)),this._walk(e,function(p){R(e[p])==="object"&&v(l._trace(t.slice(),e[p],N(r,p),e,p,o,!0))});else{if(u==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:f,isParentSelector:!0};if(u==="~")return d={path:N(r,u),value:i,parent:n,parentProperty:null},this._handleCallback(d,o,"property"),d;if(u==="$")v(this._trace(f,e,r,null,null,o,s));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(u))v(this._slice(u,f,e,r,n,i,o));else if(u.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var w=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(p){l._eval(w,e[p],p,r,n,i)&&v(l._trace(f,e[p],N(r,p),e,p,o,!0))})}else if(u[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");v(this._trace(xt(this._eval(u,e,r[r.length-1],r.slice(0,-1),n,i),f),e,r,n,i,o,s))}else if(u[0]==="@"){var g=!1,x=u.slice(1,-2);switch(x){case"scalar":(!e||!["object","function"].includes(R(e)))&&(g=!0);break;case"boolean":case"string":case"undefined":case"function":R(e)===x&&(g=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(g=!0);break;case"number":Number.isFinite(e)&&(g=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(g=!0);break;case"object":e&&R(e)===x&&(g=!0);break;case"array":Array.isArray(e)&&(g=!0);break;case"other":g=this.currOtherTypeCallback(e,r,n,i);break;case"null":e===null&&(g=!0);break;default:throw new TypeError("Unknown value type "+x)}if(g)return d={path:r,value:e,parent:n,parentProperty:i},this._handleCallback(d,o,"value"),d}else if(u[0]==="`"&&e&&A.call(e,u.slice(1))){var E=u.slice(1);v(this._trace(f,e[E],N(r,E),e,E,o,s,!0))}else if(u.includes(",")){var ot=u.split(","),D=Ne(ot),st;try{for(D.s();!(st=D.n()).done;){var Tt=st.value;v(this._trace(xt(Tt,f),e,r,n,i,o,!0))}}catch(p){D.e(p)}finally{D.f()}}else!a&&e&&A.call(e,u)&&v(this._trace(f,e[u],N(r,u),e,u,o,s,!0))}if(this._hasParentSelector)for(var k=0;k<h.length;k++){var $=h[k];if($&&$.isParentSelector){var O=this._trace($.expr,e,$.path,n,i,o,s);if(Array.isArray(O)){h[k]=O[0];for(var mt=O.length,at=1;at<mt;at++)k++,h.splice(k,0,O[at])}else h[k]=O}}return h};m.prototype._walk=function(t,e){if(Array.isArray(t))for(var r=t.length,n=0;n<r;n++)e(n);else t&&R(t)==="object"&&Object.keys(t).forEach(function(i){e(i)})};m.prototype._slice=function(t,e,r,n,i,o,s){if(Array.isArray(r)){var a=r.length,l=t.split(":"),d=l[2]&&Number.parseInt(l[2])||1,u=l[0]&&Number.parseInt(l[0])||0,f=l[1]&&Number.parseInt(l[1])||a;u=u<0?Math.max(0,u+a):Math.min(a,u),f=f<0?Math.max(0,f+a):Math.min(a,f);for(var h=[],v=u;v<f;v+=d){var w=this._trace(xt(v,e),r,n,i,o,s,!0);w.forEach(function(g){h.push(g)})}return h}};m.prototype._eval=function(t,e,r,n,i,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=i,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;var s=t.includes("@path");s&&(this.currSandbox._$_path=m.toPathString(n.concat([r])));var a="script:"+t;if(!m.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")),m.cache[a]=new this.vm.Script(l)}try{return m.cache[a].runInNewContext(this.currSandbox)}catch(d){throw new Error("jsonPath: "+d.message+": "+t)}};m.cache={};m.toPathString=function(t){for(var e=t,r=e.length,n="$",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[i])||(n+=/^[\*0-9]+$/.test(e[i])?"["+e[i]+"]":"['"+e[i]+"']");return n};m.toPointer=function(t){for(var e=t,r=e.length,n="",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[i])||(n+="/"+e[i].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return n};m.toPathArray=function(t){var e=m.cache;if(e[t])return e[t].concat();var r=[],n=t.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,";$&;").replace(/['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))['\]]/g,function(o,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,""),i=n.split(";").map(function(o){var s=o.match(/#([0-9]+)/);return!s||!s[1]?o:r[s[1]]});return e[t]=i,e[t].concat()};var Me=function(e,r,n){for(var i=e.length,o=0;o<i;o++){var s=e[o];n(s)&&r.push(e.splice(o--,1)[0])}},Le=function(){function t(e){It(this,t),this.code=e}return jt(t,[{key:"runInNewContext",value:function(r){var n=this.code,i=Object.keys(r),o=[];Me(i,o,function(u){return typeof r[u]=="function"});var s=i.map(function(u,f){return r[u]}),a=o.reduce(function(u,f){var h=r[f].toString();return/function/.test(h)||(h="function "+h),"var "+f+"="+h+";"+u},"");n=a+n,!/(["'])use strict\1/.test(n)&&!i.includes("arguments")&&(n="var arguments = undefined;"+n),n=n.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var l=n.lastIndexOf(";"),d=l>-1?n.slice(0,l+1)+" return "+n.slice(l+1):" return "+n;return J(Function,i.concat([d])).apply(void 0,ke(s))}}]),t}();m.prototype.vm={Script:Le};function Wt(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function St(t){return Wt(t)+".*"}function ct(t,e,r=!1,n=t){var i=e;let o=Object.keys(t).sort((a,l)=>l.length-a.length);for(let a of o)if(e.startsWith(a)){if(a==e){if(r)return t[a];continue}i=e.substring(a.length+1),n=t[a];break}var s=m({path:i,json:n});return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[i.replace(/^.*?\./,"_."),i.replace(/^.*?\./,""),i.replace(/^([^.]+).*?\.\$\./,"$1."),i.replace(/^.*?\.\$\./,"_."),i.replace(/^.*?\.\$\./,""),i.replace(/^[^.]+$/,"_")].filter((a,l,d)=>d.indexOf(a)===l).reduce((a,l)=>a.length>0?a:m({path:l,json:n}),[])),r&&Array.isArray(s)?s[0]:s}function Ct(t,e={},r){return r?`<${r}${Object.entries(e).map(([n,i])=>i!=null&&` ${n}="${i}"`).filter(Boolean).join("")}>${j(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):j(t)}function j(t){var e;if(Array.isArray(t))return t.map(j).join(`
4
- `).trim();if(typeof t=="string")return t;if(t==null)return"";switch(t.type){case"heading":let{level:r,...n}=t.attrs;return Ct(t.content,n,"h"+r);case"text":return(t.marks||[]).reduce((i,o)=>Ct(i,o.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[o.type]),(e=t.text)===null||e===void 0?void 0:e.replace(/\s+/," "));default:return Ct(t.content||t.text,t.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[t.type])}}var T=class{constructor(e,r=1,n){this.ownerDocument={createElement(i){return new T(i)}},this.nodeName=e,this.nodeType=r,this.textContent=n,this.attributes=[],this.childNodes=[]}setAttribute(e,r){let n=this.attributes.find(i=>i.name===e);n?n.value=r:this.attributes.push({name:e,value:r})}getAttribute(e){let r=this.attributes.find(n=>n.name===e);return r?r.value:void 0}insertBefore(e,r){if(e.parentNode=this,r===null)this.childNodes.push(e);else{let n=this.childNodes.indexOf(r);n!==-1&&this.childNodes.splice(n,0,e)}}removeAttribute(e){let r=this.attributes.findIndex(n=>n.name===e);r!==-1&&this.attributes.splice(r,1)}appendChild(e){e.parentNode=this,this.childNodes.push(e)}get tagName(){var e;return(e=this.nodeName)===null||e===void 0?void 0:e.toUpperCase()}get innerHTML(){return Rt(this.childNodes)}set innerHTML(e){this.childNodes=_t(String(e!=null?e:""))}get outerHTML(){return Rt([this])}closest(e){let r=this;for(;r;){if(zt(e,r))return r;r=r.parentNode}return null}querySelectorAll(e){let r=e.split(/\s*,\s*/),n=[],i=o=>{for(let s of r)if(zt(s,o)){n.push(o);break}for(let s of o.childNodes)i(s)};for(let o of this.childNodes)i(o);return n}querySelector(e){return this.querySelectorAll(e)[0]}findSibling(e,r){if(!this.parentNode)return null;let n=this.parentNode.childNodes,i=n.indexOf(this);if(i===-1)return null;for(let o=i+e;o>=0&&o<n.length;o+=e){let s=n[o];if(!r||s.nodeType===1)return s}return null}removeChild(e){let r=this.childNodes.indexOf(e);if(r!==-1)return this.childNodes.splice(r,1),e.parentNode=void 0,e}get previousSibling(){return this.findSibling(-1)}get nextSibling(){return this.findSibling(1)}get previousElementSibling(){return this.findSibling(-1,!0)}get nextElementSibling(){return this.findSibling(1,!0)}cloneNode(e=!1){let r=new T(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),e)for(let n of this.childNodes){let i=n.cloneNode(!0);r.appendChild(i)}return r}get parentElement(){var e;return((e=this.parentNode)===null||e===void 0?void 0:e.nodeType)==1?this.parentNode:null}};function zt(t,e){let r=t.match(/([.#]?[\w-]+|\[([\w-]+)(="([^"]*)")?\])/g);if(!r)return!1;for(let n of r)if(n.startsWith("#")){if(e.getAttribute("id")!==n.slice(1))return!1}else if(n.startsWith(".")){if(!(e.getAttribute("class")||"").split(" ").includes(n.slice(1)))return!1}else if(n.startsWith("[")){let i=n.match(/^\[([\w-]+)(="([^"]*)")?\]$/);if(i){let o=i[1],s=i[3],a=e.getAttribute(o);if(typeof s=="undefined"){if(a===void 0)return!1}else if(a!==s)return!1}else return!1}else if(e.nodeName!==n)return!1;return!0}function _t(t){var e;let r=[],n=[];for(;t;){let i=t.match(/^<([\w-]+)(\s[^>]*)?>/),o=t.match(/^<\/([\w-]+)>/);if(i){let s=i[1],l=((e=(i[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||e===void 0?void 0:e.map(u=>{let[f,h,,v]=u.match(/([\w-]+)(="([^"]*)")?/);return{name:h,value:Be(v||"")}}))||[],d=new T(s,1);if(d.attributes=l,n.length>0){let u=n[n.length-1];u.childNodes.push(d),d.parentNode=u}else r.push(d);n.push(d),t=t.slice(i[0].length)}else if(o)n.pop(),t=t.slice(o[0].length);else{let s=t.indexOf("<"),a=t.slice(0,s!==-1?s:void 0),l=new T("#text",3);if(l.textContent=a,n.length>0){let d=n[n.length-1];d.childNodes.push(l),l.parentNode=d}else r.push(l);t=t.slice(a.length)}}return r}function $e(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Be(t){return t.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'")}function Rt(t){return t.map(e=>{if(e.nodeType===3)return e.textContent||"";let{nodeName:r,attributes:n}=e,i=n.map(({name:s,value:a})=>` ${s}="${$e(String(a))}"`).join(""),o=Rt(e.childNodes);return["img","input","br"].includes(r)?`<${r}${i} />`:`<${r}${i}>${o}</${r}>`}).join("")}function Ft(t,e,r){var n;let i=((n=r==null?void 0:r.processTemplate)===null||n===void 0?void 0:n.call(r,null,t,e))||t,o=_t(i);return _(o[0],e,r).outerHTML}function Vt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&Y(i,o),n.addedNodes&&n.addedNodes.forEach(s=>{s.nodeType==1&&qt(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function qt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];Y(i,i.getAttribute("data-embed-src"))}if(e)return Vt(t)}function Y(t,e){for(var r=t;r;r=r.parentElement)if(!r.parentElement){let i=r.querySelectorAll("script");for(var n=0;n<i.length;n++)if(i[n].getAttribute("src")==e)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let o=r.ownerDocument.createElement("script");o.setAttribute("type","module"),o.setAttribute("src",e),r.appendChild(o);break}}function Kt(t){let e=t.getAttribute("data-path-scope");for(var r=0,n=t;n=n.previousElementSibling;)n.getAttribute("data-path-scope")==e&&r++;return r}function Ie(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var i=Kt(t);if(i!=0)return;let o=t.parentNode;if(o!=null){e==0?t.setAttribute("hidden","hidden"):t.getAttribute("hidden")!=null&&t.removeAttribute("hidden");for(var s=i+1,a=t,l=t;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==n&&(s++,a=l);for(var d=s;d<e;d++)o.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var d=Math.max(1,e);d<s;d++)a=a.previousElementSibling,o.removeChild(a.nextElementSibling)}}function U(t,e,r,n){var i;if(t){var o=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=j(r)),n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(t,e,r));var s=e.replace("data-path-","");if(e=="data-path-src")o=t.tagName=="IMG"?t:t.querySelector("img, video");else if(e=="data-path-href")o=t.querySelector("a")||t.closest("a");else if(e=="data-path-alt")o=t.querySelector("img, picture");else if(e=="data-path-hidden")r=r?null:!0;else if(e=="data-path"||e=="data-embed-html"||e=="html")s="innerHTML";else if(e=="data-embed-src")Y(t,r);else if(e=="data-path-attributes"){let f=((i=t.getAttribute("data-attributes-keys"))===null||i===void 0?void 0:i.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var a in r){var l=r[a];U(t,a,typeof l=="object"&&l?JSON.stringify(l):l,n)}for(var d=0;d<f.length;d++)(r==null||!(f[d]in r))&&U(t,f[d],null,n);U(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 Jt=["data-attributes-keys","data-path-attributes","data-path-scope"];function _(t,e,r,n){var i,o,s;let a=t;if(n||(e=((i=r==null?void 0:r.processData)===null||i===void 0?void 0:i.call(r,a,e))||e),a.nodeType==1){let u=a.getAttribute("data-path-scope");if(u){let h=Kt(a),v=ct(e,u,!1)||[];h==0&&Ie(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,[St(u)]:v[h]}}let f=Array.prototype.slice.call(a.attributes).sort((h,v)=>Jt.indexOf(h.name)-Jt.indexOf(v.name));for(var l=0;l<f.length;l++){let{name:h,value:v}=f[l];h.startsWith("data-path")&&h!="data-path-scope"&&U(a,h,ct(e,v,!0),r),h=="data-embed-src"&&U(a,h,a.getAttribute(h),r)}}for(var l=0,d;d=a.childNodes[l++];)Gt(d)&&_(d,e,r,!0);return n||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,e),a}function Gt(t){return t.nodeType==1}function H(t,e,r,n){var i;let o=((i=n==null?void 0:n.processTemplate)===null||i===void 0?void 0:i.call(n,t,e,r))||e;if(t.innerHTML=o,t.classList.add("-feaas"),(t.closest(".component.feaas")||t).className.includes("-theme--"))for(var a=0,l;l=t.childNodes[a++];)Gt(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return _(t,r,n)}var Yt=["initial","check","updated"],X={};function je(){X={}}async function kt(t,e,r,n,i=X){return M({url:t,options:e,validator:r,callback:n,cache:i}).then(Z).then(o=>o.response)}function Xt(t,e=!1){let r=String(t).replace("?head","");var n=X[r];return!n&&!e&&(n=X[r]={phase:null,initial:P(),check:P(),updated:P(),final:P()}),n}async function M({url:t,options:e,validator:r,callback:n,cache:i},o="initial"){let s=new Date;if(i!=null){var a=Xt(t);if(Yt.indexOf(a.phase)>=Yt.indexOf(o))var l=a[o];else a.phase=o}let d=await(l||fetch(t,e));if(!l&&a&&(d.ok?a[o].resolve(d):a[o].reject(new Error("Fetch failed"))),!d.ok)throw new Error("Fetch failed");if((r==null?void 0:r(d))===!1)throw new Error("Response is not valid");let u=new Date(d.headers.get("date"))<s||l&&o=="initial"&&(a.phase=="updated"||a.phase=="check");return await(n==null?void 0:n(d,o,u)),{url:t,options:e,isCached:u,response:d,validator:r,callback:n,cache:i}}async function Z(t){let{url:e,isCached:r,options:n,validator:i,response:o,cache:s}=t;if(r){let{response:a}=await M({url:e+"?head",options:{...n,method:"HEAD",cache:"no-cache"},validator:i,cache:s},"check");if(a.headers.get("last-modified")!=o.headers.get("last-modified"))return dt(t)}return t}async function dt(t){return M({...t,options:{...t.options,cache:"reload"}},"updated")}var F="https://feaas.blob.core.windows.net";function L(t){let e=t.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(e){var[,r,n,i,o,s]=e;return{cdn:r,library:n,component:i,version:o,revision:s}}}function Ue(t){if(!t||!t.library||!t.component)throw new Error("Component requires `library` and `component` properties");return`${t.cdn&&t.cdn!=F?`${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 He(t){return`${t.cdn&&t.cdn!=F?`${t.cdn}/styles/`:""}${t.library}/${!t.revision||t.revision=="published"?"":t.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function ht(t){let e=t.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(e){var[,r,n,i]=e;return{cdn:r,library:n,revision:i}}else{let o=L(t);if(o){var{cdn:r,library:n,revision:i}=o;return i!=null&&i.match(/\d/)&&(i=void 0),{cdn:r,library:n,revision:i}}}}function Pt(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...L(t.src)}),`${t.cdn||t.hostname||F}/components/${t.library}/${t.component}/${t.version}/${t.revision||"published"}.html`}function Q(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...ht(t.src)}),`${t.cdn||t.hostname||F}/styles/${t.library}/${t.revision||"published"}.css`}async function W(t,e,r=!1){let n=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,i=a=>a.clone().text().then(e),o=await Promise.all([t.instance&&M({options:{headers:{Accept:"text/html"},credentials:"omit"},url:Pt({...t,version:t.instance}),validator:n}).catch(a=>a),M({url:Pt(t),validator:n}).catch(a=>a)]),s=o.find(a=>a&&"isCached"in a&&a);if(!s||s instanceof Error)throw o.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return o[0]==s&&console.log("Using fork!",o),await i(s.response),r?s:Z({...s,callback:i}).catch(a=>{if(o[0]==s&&(dt({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),Z({...o[1],callback:i});throw a})}async function We(t){typeof t=="string"&&(t={src:t});var e;let{response:r}=await W(t,n=>{e=n},!0);return{...t,template:e,lastModified:r.headers.get("last-modified")}}async function pt(t,e){return typeof t=="string"&&(t={src:t}),kt(Q(t),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,n)=>r.clone().text().then(i=>e(i,n)))}function ze(t,e){return Zt(t,e||(e=document.createElement("style"))),e}function Zt(t,e){return e||(e=document.createElement("style")),pt(t,(r,n)=>{e.textContent=r}).then(()=>e)}function ft(t,e){var r=Qt(t);if(!r)var n=te(t);return pt(t,(i,o)=>{n&&(n.textContent=i),e==null||e(i,o)}).then(()=>r||n)}function Dt(t){return new Promise((e,r)=>{ft(t,e).catch(r)})}function Qt(t){return document.head.querySelector(`style[data-href="${Q(t)}"]`)}function te(t){let e=Q(t),r=document.createElement("style");return r.setAttribute("data-href",e),document.head.appendChild(r),r}function Ve(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return _(n,e),r}function qe(t,e){return ee(t,e||(e=document.createElement("div"))),e}async function ee(t,e){return e||(e=document.createElement("div")),e.childNodes.length?_(e,t.data,t):"template"in t?H(e,t.template,t.data,t):W(t,r=>H(e,r,t.data,t)).then(()=>e)}function re(t=this){var e,r,n,i,o,s,a,l;let d,u=t.getAttribute("src");if(u){let E=L(u);if(!E)throw new Error(`Could not parse FEAAS Component source: ${u}`);var{cdn:f,library:h,component:v,version:w,revision:g}=E}let x=t.getAttribute("data");if(x!=null&&x!="")try{d=typeof x=="string"?JSON.parse(x):{}}catch(E){}return{data:d||{},cdn:(r=(e=t.getContextAttribute("cdn"))!==null&&e!==void 0?e:f)!==null&&r!==void 0?r:F,library:(n=t.getAttribute("library"))!==null&&n!==void 0?n:h,component:(i=t.getAttribute("component"))!==null&&i!==void 0?i:v,version:(s=(o=t.getAttribute("version"))!==null&&o!==void 0?o:w)!==null&&s!==void 0?s:"responsive",revision:(l=(a=t.getAttribute("revision"))!==null&&a!==void 0?a:g)!==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 tt=class extends b{setData(e){this.set({data:e})}getProps(){return re(this)}attributeChangedCallback(e,r,n){r!==n&&((e=="library"||e=="component"||e=="revision"||e=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(e,r,n))}getEditor(){var e;return(e=document.querySelector("feaas-context"))===null||e===void 0?void 0:e.refs.editor}constructor(){super(),this.defaultProps={cdn:F,revision:"published",version:"responsive",withStylesheet:!0,editable:!1,suspended:!1},this.onLoad=e=>{this.payload=e,this.advance()},this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let e=this.getEditor();if(e!=null&&e.setTarget(this))return e.open(),!0}getOriginal(){let e=this.getAttribute("data-path-scope");if(e){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==e;)var n=r;return n}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(!this.getOriginal()){if(this.props.withStylesheet)var e=Dt({...this.props,revision:"published"}).then(()=>{e=null,this.payload&&this.onLoad(this.payload)});return Promise.all([e,W(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)_(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;H(this,this.payload,this.props.data)}}};tt.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];tt.register("feaas-component");function ne(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 et=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return ne(this)}attributeChangedCallback(e,r,n){if(r!==n)return e=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),n?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(e,r,n)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
1
+ var me=Object.create;var lt=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var Ee=Object.getPrototypeOf,Ae=Object.prototype.hasOwnProperty;var we=(e,t)=>{for(var r in t)lt(e,r,{get:t[r],enumerable:!0})},It=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ye(t))!Ae.call(e,i)&&i!==r&&lt(e,i,{get:()=>t[i],enumerable:!(n=ge(t,i))||n.enumerable});return e};var Et=(e,t,r)=>(r=e!=null?me(Ee(e)):{},It(t||!e||!e.__esModule?lt(r,"default",{value:e,enumerable:!0}):r,e)),Ce=e=>It(lt({},"__esModule",{value:!0}),e);var Xe={};we(Xe,{Base:()=>b,Component:()=>Mt,ComponentProps:()=>ie,DEFAULT_CDN_URL:()=>k,External:()=>m,FEAASBase:()=>b,FEAASComponent:()=>tt,FEAASComponentsProps:()=>ie,FEAASContext:()=>it,FEAASContextProps:()=>ce,FEAASEditor:()=>rt,FEAASEditorProps:()=>le,FEAASEmbed:()=>fe,FEAASLoader:()=>et,FEAASLoaderProps:()=>oe,FEAASPicker:()=>nt,FEAASPickerProps:()=>ue,FEAASStylesheet:()=>vt,FEAASStylesheetProps:()=>se,JSONPath:()=>v,Loader:()=>et,MyComponent:()=>ut,Stylesheet:()=>vt,autoloadScripts:()=>Kt,cleanCollectionBit:()=>Vt,clearFetchCache:()=>Ue,createStylesheet:()=>re,fetchAndRevalidate:()=>Ft,fetchAndRevalidateComponent:()=>W,fetchAndRevalidateStylesheet:()=>pt,fetchBypassingCache:()=>dt,fetchCache:()=>X,fetchComponent:()=>ze,fetchToValidateCache:()=>Z,fetchWithCacheAwareness:()=>M,findStylesheet:()=>ee,getComponentSource:()=>He,getComponentURL:()=>Pt,getFetchCache:()=>Qt,getFramePosition:()=>ae,getStylesheetSource:()=>We,getStylesheetURL:()=>Q,loadScript:()=>Y,loadStylesheet:()=>ft,loadStylesheetAllowStale:()=>Dt,normalizeCollectionScope:()=>St,observeDOMElement:()=>Jt,parseComponentSource:()=>L,parseStylesheetSource:()=>ht,queryScopes:()=>ct,renderComponent:()=>Je,renderComponentElement:()=>qe,renderComponentPromise:()=>ne,renderDOMContent:()=>H,renderDOMElement:()=>_,renderHTMLContent:()=>kt,renderStylesheet:()=>Ve,renderStylesheetPromise:()=>te,serializeCH1RichText:()=>j,setDOMAttribute:()=>U});module.exports=Ce(Xe);function P(e,t=r=>{}){var r;let n=()=>{var i,o;let s=new Promise((l,c)=>{i=u=>{e==null||e(u),l(u)},o=c});var a=Object.assign(s,{resolve:i,reject:o,restart:n,first:r});return r=a,a.catch(t),a};return n()}var xe=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,b=class extends xe{getProps(t){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=P(t=>{this.payload=t}),this.whenRendered=P(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(t,r,n){this.set()}connectedCallback(){this.mount()}disconnectedCallback(){this.unmount()}mount(){try{let t=this.getParent();if(t&&!t.connected||this.connected)return;this.connected=!0,this.log("FEAAS: Mount",this.tagName,this),this.dispatchEvent(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var n;return(n=r.mount)===null||n===void 0?void 0:n.call(r)}),this.set()}catch(t){this.onError(t)}}log(...t){console.log(...t)}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEvent(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected=!1)}getParent(t=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!t||r.tagName.startsWith("FEAAS-"))return r}getElements(t=this.getRoot(),r=!0){return Array.from(t.querySelectorAll("*")).map(n=>[!r||n.tagName.startsWith("FEAAS-")?n:null,n.shadowRoot?this.getElements(n.shadowRoot,r):null]).flat().filter(Boolean)}handleEvent(t){let r=t.composedPath()[0];switch(t.type){case"feaasMount":r!=this&&this.nestedCallback(r);break;case"feaasUnmount":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(t){let r=this.descendants.indexOf(t);r!=-1&&(this.log("FEAAS: Unnest",this,t),this.descendants.splice(r,-1),this.refs[t.getComponentName()]=null,t.refs.parent==this&&(t.refs.parent=null),t.refs.top==this&&(t.refs.top=t.refs.parent))}nestedCallback(t){var r,n;if(this.descendants.indexOf(t)==-1&&(this.descendants.push(t),this.log("FEAAS: Nest",this,t),this.refs[t.getComponentName()]=t,t.refs.top=this,(r=t.refs).parent||(r.parent=this),t.render))for(var o=t.refs.parent;o;o=o.refs.parent)o.render&&((n=t.refs).parentReact||(n.parentReact=o),t.refs.topReact=o)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(t,r="uncaught",n=!1){let i=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:t});if(this.dispatchEvent(i),this.whenLoaded.reject(t),!i.defaultPrevented&&!n){this.whenRendered.reject(t);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 t=await this.load().catch(r=>{throw this.payload=void 0,r});if(this.whenLoaded.resolve(t),this.onLoad)return}else if(this.payload==null)return;this.flush(),this.whenRendered.resolve(this)}catch(t){this.onError(t)}}flush(){var t,r;let n=(r=(t=this.payload)===null||t===void 0?void 0:t.ReactDOM)===null||r===void 0?void 0:r.flushSync;n?n(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var t,r,n;if(this.payload==null||!this.render)return;let{React:i,ReactDOM:o,ReactDOMClient:s}=this.payload||{};if(!i)throw new Error(`${this.tagName}: React is not present in payload`);if(!o)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?s?(this.reactRoot||(this.reactRoot=s.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):o.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact?(t=this.forceUpdateReact)===null||t===void 0||t.call(this):(n=(r=this.refs.topReact).forceUpdateReact)===null||n===void 0||n.call(r)}invokeReactRendering(){let{React:t,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let n=this.descendants.filter(i=>i.refs.parentReact==this&&i.payload).map((i,o)=>this.getReactElement(i));return this.render({...this.props,children:n},this.payload)}getReactErrorBoundary(t=this,r=t.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:n,ReactDOM:i}=t.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends n.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,a){console.error(`FEAAS: ${t.tagName} Error:`,s,a),t.onError(s,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(t=this,r){let{React:n,ReactDOM:i}=t.payload||{},o=this.getReactErrorBoundary(),s=this.getReactWrapper(t);return n.createElement(o,{key:t.tagName+"-"+t.getUID(),slot:t.getAttribute("slot")},n.createElement(s,null))}getReactWrapper(t=this,r=t.tagName){if(t.reactWrapper)return t.reactWrapper;let{React:n,ReactDOM:i}=t.payload||{};return t.reactWrapper=o=>{if(t.render){let[s,a]=n.useReducer(l=>l+1,0);return t.forceUpdateReact=a,i.createPortal(n.createElement(n.Fragment,null,t.invokeReactRendering()),t.getReactRootElement())}else return t.update()},Object.assign(t.reactWrapper,{key:t.tagName+"-"+t.getUID(),displayName:r}),t.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(t){try{this.scheduleRender(),this.overrides={...this.overrides,...t},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let n=this.props[r],i=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();n==null||n===this.defaultProps[r]?this.removeAttribute(i):(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&this.getAttribute(i)!=String(n)&&this.setAttribute(i,String(n))}}catch(n){this.whenRendered.reject(n),this.onError(n,"set")}return this}import(t){return import( /*@vite-ignore*/ /* webpackIgnore: true */ t)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(t=>{})})}formatURL(t,r){return typeof t=="string"&&t.match(/^\/[^\/]/)?r+t:t}getContextAttribute(t,r=this){for(var n=this;n=n.parentElement||(n.parentNode instanceof ShadowRoot?n.parentNode.host:null);)if(n.getAttribute(t)!=null)return n.getAttribute(t);return this.getAttribute(t)}static register(t,r){r==null&&(r=typeof window!="undefined"?window:null),r&&!r.customElements.get(t)&&r.customElements.define(t,this)}};var I=class extends b{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([t,r])=>({React:t,ReactDOM:r}))}render({},{React:t}){return t.createElement(t.Fragment,null)}},ut=class extends I{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:t},{React:r}){let[n,i]=r.useState(0);return r.useEffect(()=>{i(o=>o+1)},[t]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",t),r.createElement("p",null,"Triggered updates: ",n))}};ut.observedAttributes=["counter"];function R(e){return R=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(e)}function Ut(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function jt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Ht(e,t,r){return t&&jt(e.prototype,t),r&&jt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Se(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&G(e,t)}function K(e){return K=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},K(e)}function G(e,t){return G=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},G(e,t)}function Wt(){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 J(e,t,r){return Wt()?J=Reflect.construct.bind():J=function(i,o,s){var a=[null];a.push.apply(a,o);var l=Function.bind.apply(i,a),c=new l;return s&&G(c,s.prototype),c},J.apply(null,arguments)}function Re(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function At(e){var t=typeof Map=="function"?new Map:void 0;return At=function(n){if(n===null||!Re(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,i)}function i(){return J(n,arguments,K(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),G(i,n)},At(e)}function _e(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ke(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _e(e)}function Fe(e){var t=Wt();return function(){var n=K(e),i;if(t){var o=K(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return ke(this,i)}}function Pe(e){return De(e)||Oe(e)||zt(e)||Ne()}function De(e){if(Array.isArray(e))return wt(e)}function Oe(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function zt(e,t){if(e){if(typeof e=="string")return wt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return wt(e,t)}}function wt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ne(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Te(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=zt(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(l){throw l},f:i}}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(e)},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 A=Object.prototype.hasOwnProperty;function N(e,t){return e=e.slice(),e.push(t),e}function Ct(e,t){return t=t.slice(),t.unshift(e),t}var Me=function(e){Se(r,e);var t=Fe(r);function r(n){var i;return Ut(this,r),i=t.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),i.avoidNew=!0,i.value=n,i.name="NewError",i}return Ht(r)}(At(Error));function v(e,t,r,n,i){if(!(this instanceof v))try{return new v(e,t,r,n,i)}catch(l){if(!l.avoidNew)throw l;return l.value}typeof e=="string"&&(i=n,n=r,r=t,t=e,e=null);var o=e&&R(e)==="object";if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=A.call(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.preventEval=e.preventEval||!1,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||n||null,this.otherTypeCallback=e.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){var s={path:o?e.path:t};o?"json"in e&&(s.json=e.json):s.json=r;var a=this.evaluate(s);if(!a||R(a)!=="object")throw new Me(a);return a}}v.prototype.evaluate=function(e,t,r,n){var i=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=n||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&R(e)==="object"&&!Array.isArray(e)){if(!e.path&&e.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!A.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var c=e;t=c.json,a=A.call(e,"flatten")?e.flatten:a,this.currResultType=A.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=A.call(e,"sandbox")?e.sandbox:this.currSandbox,l=A.call(e,"wrap")?e.wrap:l,this.currPreventEval=A.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=A.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=A.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,o=A.call(e,"parent")?e.parent:o,s=A.call(e,"parentProperty")?e.parentProperty:s,e=e.path}if(o=o||null,s=s||null,Array.isArray(e)&&(e=v.toPathString(e)),!(!e&&e!==""||!t)){var u=v.toPathArray(e);u[0]==="$"&&u.length>1&&u.shift(),this._hasParentSelector=null;var p=this._trace(u,t,["$"],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,f){var w=i._getPreferredOutput(f);return a&&Array.isArray(w)?d=d.concat(w):d.push(w),d},[]):l?[]:void 0}};v.prototype._getPreferredOutput=function(e){var t=this.currResultType;switch(t){case"all":{var r=Array.isArray(e.path)?e.path:v.toPathArray(e.path);return e.pointer=v.toPointer(r),e.path=typeof e.path=="string"?e.path:v.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return v.toPathString(e[t]);case"pointer":return v.toPointer(e.path);default:throw new TypeError("Unknown result type")}};v.prototype._handleCallback=function(e,t,r){if(t){var n=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:v.toPathString(e.path),t(n,r,e)}};v.prototype._trace=function(e,t,r,n,i,o,s,a){var l=this,c;if(!e.length)return c={path:r,value:t,parent:n,parentProperty:i,hasArrExpr:s},this._handleCallback(c,o,"value"),c;var u=e[0],p=e.slice(1),d=[];function f(h){Array.isArray(h)?h.forEach(function(B){d.push(B)}):d.push(h)}if((typeof u!="string"||a)&&t&&A.call(t,u))f(this._trace(p,t[u],N(r,u),t,u,o,s));else if(u==="*")this._walk(t,function(h){f(l._trace(p,t[h],N(r,h),t,h,o,!0,!0))});else if(u==="..")f(this._trace(p,t,r,n,i,o,s)),this._walk(t,function(h){R(t[h])==="object"&&f(l._trace(e.slice(),t[h],N(r,h),t,h,o,!0))});else{if(u==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:p,isParentSelector:!0};if(u==="~")return c={path:N(r,u),value:i,parent:n,parentProperty:null},this._handleCallback(c,o,"property"),c;if(u==="$")f(this._trace(p,t,r,null,null,o,s));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(u))f(this._slice(u,p,t,r,n,i,o));else if(u.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var w=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(t,function(h){l._eval(w,t[h],h,r,n,i)&&f(l._trace(p,t[h],N(r,h),t,h,o,!0))})}else if(u[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");f(this._trace(Ct(this._eval(u,t,r[r.length-1],r.slice(0,-1),n,i),p),t,r,n,i,o,s))}else if(u[0]==="@"){var g=!1,C=u.slice(1,-2);switch(C){case"scalar":(!t||!["object","function"].includes(R(t)))&&(g=!0);break;case"boolean":case"string":case"undefined":case"function":R(t)===C&&(g=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(g=!0);break;case"number":Number.isFinite(t)&&(g=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(g=!0);break;case"object":t&&R(t)===C&&(g=!0);break;case"array":Array.isArray(t)&&(g=!0);break;case"other":g=this.currOtherTypeCallback(t,r,n,i);break;case"null":t===null&&(g=!0);break;default:throw new TypeError("Unknown value type "+C)}if(g)return c={path:r,value:t,parent:n,parentProperty:i},this._handleCallback(c,o,"value"),c}else if(u[0]==="`"&&t&&A.call(t,u.slice(1))){var E=u.slice(1);f(this._trace(p,t[E],N(r,E),t,E,o,s,!0))}else if(u.includes(",")){var ot=u.split(","),D=Te(ot),st;try{for(D.s();!(st=D.n()).done;){var Lt=st.value;f(this._trace(Ct(Lt,p),t,r,n,i,o,!0))}}catch(h){D.e(h)}finally{D.f()}}else!a&&t&&A.call(t,u)&&f(this._trace(p,t[u],N(r,u),t,u,o,s,!0))}if(this._hasParentSelector)for(var F=0;F<d.length;F++){var $=d[F];if($&&$.isParentSelector){var O=this._trace($.expr,t,$.path,n,i,o,s);if(Array.isArray(O)){d[F]=O[0];for(var bt=O.length,at=1;at<bt;at++)F++,d.splice(F,0,O[at])}else d[F]=O}}return d};v.prototype._walk=function(e,t){if(Array.isArray(e))for(var r=e.length,n=0;n<r;n++)t(n);else e&&R(e)==="object"&&Object.keys(e).forEach(function(i){t(i)})};v.prototype._slice=function(e,t,r,n,i,o,s){if(Array.isArray(r)){var a=r.length,l=e.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=[],f=u;f<p;f+=c){var w=this._trace(Ct(f,t),r,n,i,o,s,!0);w.forEach(function(g){d.push(g)})}return d}};v.prototype._eval=function(e,t,r,n,i,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=i,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;var s=e.includes("@path");s&&(this.currSandbox._$_path=v.toPathString(n.concat([r])));var a="script:"+e;if(!v.cache[a]){var l=e.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")),v.cache[a]=new this.vm.Script(l)}try{return v.cache[a].runInNewContext(this.currSandbox)}catch(c){throw new Error("jsonPath: "+c.message+": "+e)}};v.cache={};v.toPathString=function(e){for(var t=e,r=t.length,n="$",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[i])||(n+=/^[\*0-9]+$/.test(t[i])?"["+t[i]+"]":"['"+t[i]+"']");return n};v.toPointer=function(e){for(var t=e,r=t.length,n="",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[i])||(n+="/"+t[i].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return n};v.toPathArray=function(e){var t=v.cache;if(t[e])return t[e].concat();var r=[],n=e.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,""),i=n.split(";").map(function(o){var s=o.match(/#([0-9]+)/);return!s||!s[1]?o:r[s[1]]});return t[e]=i,t[e].concat()};var Le=function(t,r,n){for(var i=t.length,o=0;o<i;o++){var s=t[o];n(s)&&r.push(t.splice(o--,1)[0])}},$e=function(){function e(t){Ut(this,e),this.code=t}return Ht(e,[{key:"runInNewContext",value:function(r){var n=this.code,i=Object.keys(r),o=[];Le(i,o,function(u){return typeof r[u]=="function"});var s=i.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},"");n=a+n,!/(["'])use strict\1/.test(n)&&!i.includes("arguments")&&(n="var arguments = undefined;"+n),n=n.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var l=n.lastIndexOf(";"),c=l>-1?n.slice(0,l+1)+" return "+n.slice(l+1):" return "+n;return J(Function,i.concat([c])).apply(void 0,Pe(s))}}]),e}();v.prototype.vm={Script:$e};function Vt(e){return e.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function St(e){return Vt(e)+".*"}function ct(e,t,r=!1,n=e){var i=t;let o=Object.keys(e).sort((a,l)=>l.length-a.length);for(let a of o)if(t.startsWith(a)){if(a==t){if(r)return e[a];continue}i=t.substring(a.length+1),n=e[a];break}var s=v({path:i,json:n});return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[i.replace(/^.*?\./,"_."),i.replace(/^.*?\./,""),i.replace(/^([^.]+).*?\.\$\./,"$1."),i.replace(/^.*?\.\$\./,"_."),i.replace(/^.*?\.\$\./,""),i.replace(/^[^.]+$/,"_")].filter((a,l,c)=>c.indexOf(a)===l).reduce((a,l)=>a.length>0?a:v({path:l,json:n}),[])),r&&Array.isArray(s)?s[0]:s}function xt(e,t={},r){return r?`<${r}${Object.entries(t).map(([n,i])=>i!=null&&` ${n}="${i}"`).filter(Boolean).join("")}>${j(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):j(e)}function j(e){var t;if(Array.isArray(e))return e.map(j).join(`
4
+ `).trim();if(typeof e=="string")return e;if(e==null)return"";switch(e.type){case"heading":let{level:r,...n}=e.attrs;return xt(e.content,n,"h"+r);case"text":return(e.marks||[]).reduce((i,o)=>xt(i,o.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[o.type]),(t=e.text)===null||t===void 0?void 0:t.replace(/\s+/," "));default:return xt(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}var T=class{constructor(t,r=1,n){this.ownerDocument={createElement(i){return new T(i)}},this.nodeName=t,this.nodeType=r,this.textContent=n,this.attributes=[],this.childNodes=[]}setAttribute(t,r){let n=this.attributes.find(i=>i.name===t);n?n.value=r:this.attributes.push({name:t,value:r})}getAttribute(t){let r=this.attributes.find(n=>n.name===t);return r?r.value:void 0}insertBefore(t,r){if(t.parentNode=this,r===null)this.childNodes.push(t);else{let n=this.childNodes.indexOf(r);n!==-1&&this.childNodes.splice(n,0,t)}}removeAttribute(t){let r=this.attributes.findIndex(n=>n.name===t);r!==-1&&this.attributes.splice(r,1)}appendChild(t){t.parentNode=this,this.childNodes.push(t)}get tagName(){var t;return(t=this.nodeName)===null||t===void 0?void 0:t.toUpperCase()}get innerHTML(){return Rt(this.childNodes)}set innerHTML(t){this.childNodes=_t(String(t!=null?t:""))}get outerHTML(){return Rt([this])}closest(t){let r=this;for(;r;){if(qt(t,r))return r;r=r.parentNode}return null}querySelectorAll(t){let r=t.split(/\s*,\s*/),n=[],i=o=>{for(let s of r)if(qt(s,o)){n.push(o);break}for(let s of o.childNodes)i(s)};for(let o of this.childNodes)i(o);return n}querySelector(t){return this.querySelectorAll(t)[0]}findSibling(t,r){if(!this.parentNode)return null;let n=this.parentNode.childNodes,i=n.indexOf(this);if(i===-1)return null;for(let o=i+t;o>=0&&o<n.length;o+=t){let s=n[o];if(!r||s.nodeType===1)return s}return null}removeChild(t){let r=this.childNodes.indexOf(t);if(r!==-1)return this.childNodes.splice(r,1),t.parentNode=void 0,t}get previousSibling(){return this.findSibling(-1)}get nextSibling(){return this.findSibling(1)}get previousElementSibling(){return this.findSibling(-1,!0)}get nextElementSibling(){return this.findSibling(1,!0)}cloneNode(t=!1){let r=new T(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),t)for(let n of this.childNodes){let i=n.cloneNode(!0);r.appendChild(i)}return r}get parentElement(){var t;return((t=this.parentNode)===null||t===void 0?void 0:t.nodeType)==1?this.parentNode:null}};function qt(e,t){let r=e.match(/([.#]?[\w-]+|\[([\w-]+)(="([^"]*)")?\])/g);if(!r)return!1;for(let n of r)if(n.startsWith("#")){if(t.getAttribute("id")!==n.slice(1))return!1}else if(n.startsWith(".")){if(!(t.getAttribute("class")||"").split(" ").includes(n.slice(1)))return!1}else if(n.startsWith("[")){let i=n.match(/^\[([\w-]+)(="([^"]*)")?\]$/);if(i){let o=i[1],s=i[3],a=t.getAttribute(o);if(typeof s=="undefined"){if(a===void 0)return!1}else if(a!==s)return!1}else return!1}else if(t.nodeName!==n)return!1;return!0}function _t(e){var t;let r=[],n=[];for(;e;){let i=e.match(/^<([\w-]+)(\s[^>]*)?>/),o=e.match(/^<\/([\w-]+)>/);if(i){let s=i[1],l=((t=(i[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||t===void 0?void 0:t.map(u=>{let[p,d,,f]=u.match(/([\w-]+)(="([^"]*)")?/);return{name:d,value:Ie(f||"")}}))||[],c=new T(s,1);if(c.attributes=l,n.length>0){let u=n[n.length-1];u.childNodes.push(c),c.parentNode=u}else r.push(c);n.push(c),e=e.slice(i[0].length)}else if(o)n.pop(),e=e.slice(o[0].length);else{let s=e.indexOf("<"),a=e.slice(0,s!==-1?s:void 0),l=new T("#text",3);if(l.textContent=a,n.length>0){let c=n[n.length-1];c.childNodes.push(l),l.parentNode=c}else r.push(l);e=e.slice(a.length)}}return r}function Be(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Ie(e){return e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'")}function Rt(e){return e.map(t=>{if(t.nodeType===3)return t.textContent||"";let{nodeName:r,attributes:n}=t,i=n.map(({name:s,value:a})=>` ${s}="${Be(String(a))}"`).join(""),o=Rt(t.childNodes);return["img","input","br"].includes(r)?`<${r}${i} />`:`<${r}${i}>${o}</${r}>`}).join("")}function kt(e,t,r){var n;let i=((n=r==null?void 0:r.processTemplate)===null||n===void 0?void 0:n.call(r,null,e,t))||e,o=_t(i);return _(o[0],t,r).outerHTML}function Jt(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&Y(i,o),n.addedNodes&&n.addedNodes.forEach(s=>{s.nodeType==1&&Kt(s,!1)})})});return t.observe(e,{attributes:!0,subtree:!0,childList:!0}),t}function Kt(e,t=!0){let r=e.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];Y(i,i.getAttribute("data-embed-src"))}if(t)return Jt(e)}function Y(e,t){for(var r=e;r;r=r.parentElement)if(!r.parentElement){let i=r.querySelectorAll("script");for(var n=0;n<i.length;n++)if(i[n].getAttribute("src")==t)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let o=r.ownerDocument.createElement("script");o.setAttribute("type","module"),o.setAttribute("src",t),r.appendChild(o);break}}function Yt(e){let t=e.getAttribute("data-path-scope");for(var r=0,n=e;n=n.previousElementSibling;)n.getAttribute("data-path-scope")==t&&r++;return r}function je(e,t,r){let n=e.getAttribute("data-path-scope");if(n==null)return;var i=Yt(e);if(i!=0)return;let o=e.parentNode;if(o!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var s=i+1,a=e,l=e;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==n&&(s++,a=l);for(var c=s;c<t;c++)o.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var c=Math.max(1,t);c<s;c++)a=a.previousElementSibling,o.removeChild(a.nextElementSibling)}}function U(e,t,r,n){var i;if(e){var o=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=j(r)),n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(e,t,r));var s=t.replace("data-path-","");if(t=="data-path-src")o=e.tagName=="IMG"?e:e.querySelector("img, video");else if(t=="data-path-href")o=e.querySelector("a")||e.closest("a");else if(t=="data-path-alt")o=e.querySelector("img, picture");else if(t=="data-path-hidden")r=r?null:!0;else if(t=="data-path"||t=="data-embed-html"||t=="html")s="innerHTML";else if(t=="data-embed-src")Y(e,r);else if(t=="data-path-attributes"){let p=((i=e.getAttribute("data-attributes-keys"))===null||i===void 0?void 0:i.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var a in r){var l=r[a];U(e,a,typeof l=="object"&&l?JSON.stringify(l):l,n)}for(var c=0;c<p.length;c++)(r==null||!(p[c]in r))&&U(e,p[c],null,n);U(e,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var u=String(e.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 Gt=["data-attributes-keys","data-path-attributes","data-path-scope"];function _(e,t,r,n){var i,o,s;let a=e;if(n||(t=((i=r==null?void 0:r.processData)===null||i===void 0?void 0:i.call(r,a,t))||t),a.nodeType==1){let u=a.getAttribute("data-path-scope");if(u){let d=Yt(a),f=ct(t,u,!1)||[];d==0&&je(a,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,a,f))===!1?1:f.length,r),t={...t,[St(u)]:f[d]}}let p=Array.prototype.slice.call(a.attributes).sort((d,f)=>Gt.indexOf(d.name)-Gt.indexOf(f.name));for(var l=0;l<p.length;l++){let{name:d,value:f}=p[l];d.startsWith("data-path")&&d!="data-path-scope"&&U(a,d,ct(t,f,!0),r),d=="data-embed-src"&&U(a,d,a.getAttribute(d),r)}}for(var l=0,c;c=a.childNodes[l++];)Xt(c)&&_(c,t,r,!0);return n||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,t),a}function Xt(e){return e.nodeType==1}function H(e,t,r,n){var i;let o=((i=n==null?void 0:n.processTemplate)===null||i===void 0?void 0:i.call(n,e,t,r))||t;if(e.innerHTML=o,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(var a=0,l;l=e.childNodes[a++];)Xt(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return _(e,r,n)}var Zt=["initial","check","updated"],X={};function Ue(){X={}}async function Ft(e,t,r,n,i=X){return M({url:e,options:t,validator:r,callback:n,cache:i}).then(Z).then(o=>o.response)}function Qt(e,t=!1){let r=String(e).replace("?head","");var n=X[r];return!n&&!t&&(n=X[r]={phase:null,initial:P(),check:P(),updated:P(),final:P()}),n}async function M({url:e,options:t,validator:r,callback:n,cache:i},o="initial"){let s=new Date;if(i!=null){var a=Qt(e);if(Zt.indexOf(a.phase)>=Zt.indexOf(o))var l=a[o];else a.phase=o}let c=await(l||fetch(e,t));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(n==null?void 0:n(c,o,u)),{url:e,options:t,isCached:u,response:c,validator:r,callback:n,cache:i}}async function Z(e){let{url:t,isCached:r,options:n,validator:i,response:o,cache:s}=e;if(r){let{response:a}=await M({url:t+"?head",options:{...n,method:"HEAD",cache:"no-cache"},validator:i,cache:s},"check");if(a.headers.get("last-modified")!=o.headers.get("last-modified"))return dt(e)}return e}async function dt(e){return M({...e,options:{...e.options,cache:"reload"}},"updated")}var k="https://feaas.blob.core.windows.net";function L(e){let t=e.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(t){var[,r,n,i,o,s]=t;return{cdn:r,library:n,component:i,version:o,revision:s}}}function He(e){if(!e||!e.library||!e.component)throw new Error("Component requires `library` and `component` properties");return`${e.cdn&&e.cdn!=k?`${e.cdn}/components`:""}/${e.library}/${e.component}/${!e.version||e.version=="responsive"&&(!e.revision||e.revision=="published")?"":e.version}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/(^\/|\/$|\/\/)(?!.+\/components\/)/g,"")}function We(e){return`${e.cdn&&e.cdn!=k?`${e.cdn}/styles/`:""}${e.library}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function ht(e){let t=e.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(t){var[,r,n,i]=t;return{cdn:r,library:n,revision:i}}else{let o=L(e);if(o){var{cdn:r,library:n,revision:i}=o;return i!=null&&i.match(/\d/)&&(i=void 0),{cdn:r,library:n,revision:i}}}}function Pt(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...L(e.src)}),`${e.cdn||e.hostname||k}/components/${e.library}/${e.component}/${e.version}/${e.revision||"published"}.html`}function Q(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...ht(e.src)}),`${e.cdn||e.hostname||k}/styles/${e.library}/${e.revision||"published"}.css`}async function W(e,t,r=!1){let n=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,i=a=>a.clone().text().then(t),o=await Promise.all([e.instance&&M({options:{headers:{Accept:"text/html"},credentials:"omit"},url:Pt({...e,version:e.instance}),validator:n}).catch(a=>a),M({url:Pt(e),validator:n}).catch(a=>a)]),s=o.find(a=>a&&"isCached"in a&&a);if(!s||s instanceof Error)throw o.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return o[0]==s&&console.log("Using fork!",o),await i(s.response),r?s:Z({...s,callback:i}).catch(a=>{if(o[0]==s&&(dt({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),Z({...o[1],callback:i});throw a})}async function ze(e){typeof e=="string"&&(e={src:e});var t;let{response:r}=await W(e,n=>{t=n},!0);return{...e,template:t,lastModified:r.headers.get("last-modified")}}async function pt(e,t){return typeof e=="string"&&(e={src:e}),Ft(Q(e),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,n)=>r.clone().text().then(i=>t(i,n)))}function Ve(e,t){return te(e,t||(t=document.createElement("style"))),t}function te(e,t){return t||(t=document.createElement("style")),pt(e,(r,n)=>{t.textContent=r}).then(()=>t)}function ft(e,t){var r=ee(e);if(!r)var n=re(e);return pt(e,(i,o)=>{n&&(n.textContent=i),t==null||t(i,o)}).then(()=>r||n)}function Dt(e){return new Promise((t,r)=>{ft(e,t).catch(r)})}function ee(e){return document.head.querySelector(`style[data-href="${Q(e)}"]`)}function re(e){let t=Q(e),r=document.createElement("style");return r.setAttribute("data-href",t),document.head.appendChild(r),r}function qe(e,t){let r=document.createElement("div");r.innerHTML=e;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return _(n,t),r}function Je(e,t){return ne(e,t||(t=document.createElement("div"))),t}async function ne(e,t){return t||(t=document.createElement("div")),t.childNodes.length?_(t,e.data,e):"template"in e?H(t,e.template,e.data,e):W(e,r=>H(t,r,e.data,e)).then(()=>t)}function ie(e=this){var t,r,n,i,o,s,a,l;let c,u=e.getAttribute("src");if(u){let E=L(u);if(!E)throw new Error(`Could not parse FEAAS Component source: ${u}`);var{cdn:p,library:d,component:f,version:w,revision:g}=E}let C=e.getAttribute("data");if(C!=null&&C!="")try{c=typeof C=="string"?JSON.parse(C):{}}catch(E){}return{data:c||{},cdn:(r=(t=e.getContextAttribute("cdn"))!==null&&t!==void 0?t:p)!==null&&r!==void 0?r:k,library:(n=e.getAttribute("library"))!==null&&n!==void 0?n:d,component:(i=e.getAttribute("component"))!==null&&i!==void 0?i:f,version:(s=(o=e.getAttribute("version"))!==null&&o!==void 0?o:w)!==null&&s!==void 0?s:"responsive",revision:(l=(a=e.getAttribute("revision"))!==null&&a!==void 0?a:g)!==null&&l!==void 0?l:"published",hostname:e.getAttribute("hostname"),template:e.getAttribute("template"),instance:e.getAttribute("instance"),editable:e.getAttribute("editable")!=null,suspended:e.getAttribute("suspended")!=null,lastModified:e.getAttribute("last-modified"),withStylesheet:e.getAttribute("with-stylesheet")!="false"}}var tt=class extends b{setData(t){this.set({data:t})}getProps(){return ie(this)}attributeChangedCallback(t,r,n){r!==n&&((t=="library"||t=="component"||t=="revision"||t=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(t,r,n))}getEditor(){var t;return(t=document.querySelector("feaas-context"))===null||t===void 0?void 0:t.refs.editor}constructor(){super(),this.defaultProps={cdn:k,revision:"published",version:"responsive",withStylesheet:!0,editable:!1,suspended:!1},this.onLoad=t=>{this.payload=t,this.advance()},this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let t=this.getEditor();if(t!=null&&t.setTarget(this))return t.open(),!0}getOriginal(){let t=this.getAttribute("data-path-scope");if(t){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==t;)var n=r;return n}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(!this.getOriginal()){if(this.props.withStylesheet)var t=Dt({...this.props,revision:"published"}).then(()=>{t=null,this.payload&&this.onLoad(this.payload)});return Promise.all([t,W(this.props,r=>{this.payload=r,t||this.onLoad(r)})]).then(()=>this.payload)}}update(){if(Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)_(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;H(this,this.payload,this.props.data)}}};tt.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];tt.register("feaas-component");function oe(e=this){return{opacity:e!=null&&e.getAttribute("opacity")?parseFloat(e==null?void 0:e.getAttribute("opacity")):1,hidden:(e==null?void 0:e.getAttribute("hidden"))!=null}}var et=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return oe(this)}attributeChangedCallback(t,r,n){if(r!==n)return t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),n?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,n)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
5
5
  #loader {
6
6
  position: absolute;
7
7
  top: 0;
@@ -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)}};et.observedAttributes=["hidden","opacity"];et.register("feaas-loader");function ie(t=this){var e,r,n,i;let o=t.getAttribute("src");if(o)var{cdn:s,library:a,revision:l}=ht(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:(i=(n=t==null?void 0:t.getContextAttribute("cdn"))!==null&&n!==void 0?n:t==null?void 0:t.getContextAttribute("hostname"))!==null&&i!==void 0?i:F}}var vt=class extends b{constructor(){super(...arguments),this.onLoad=e=>{this.payload=e,this.advance()}}getProps(){return ie(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return ft(this.props,this.onLoad)}};vt.register("feaas-stylesheet");var Ot;typeof window!="undefined"&&(window.FEAASElement=I,(Ot=window.FEAASLoading)!==null&&Ot!==void 0||(window.FEAASLoading=Promise.resolve()));function oe(t){let e=[];if(t){let r=t.ownerDocument.defaultView,n,i;for(;r!==window.top;){n=r.parent;for(let o=0;o<n.frames.length;o++)if(n.frames[o]===r){for(let s of n.document.getElementsByTagName("iframe"))if(s.contentWindow===r){i=s.getBoundingClientRect();let a=s.contentWindow.getComputedStyle(s);e.push({left:i.left+parseInt(a.borderLeftWidth),top:i.top+parseInt(a.borderTopWidth)})}r=n;break}}}return e.reduce((r,n)=>({left:r.left+n.left,top:r.top+n.top}),{left:0,top:0})}function se(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 rt=class extends b{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=oe(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 n=this.getPlaceholder();this.setTarget(n.editable,e.data)&&(this.loader=n.loader,document.body.appendChild(n.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 se(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,n=this.iframe.getBoundingClientRect(),i=this.getPlaceholder(),o=document.body.getBoundingClientRect(),s=this.measurements[this.editedUID];s&&(Object.assign(i.clipper.style,{position:"absolute",top:n.top+this.iframe.clientTop-o.top+"px",left:n.left+this.iframe.clientLeft-o.left+"px",width:e+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(i.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(i.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,n){r!==n&&(e=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),n?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(e,r,n))}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:n,instance:i},{Editor:o,VersionStatusList:s,VersionStatusButton:a,Version:l,VersionMenu:d,EditorUIUndo:u,EditorUIMode:f,React:{useEffect:h,useMemo:v,useState:w,useContext:g},Chakra:{HStack:x,Box:E,Button:ot,MenuItem:D},Chrome:st,ReactDOM:Tt,useSDK:k,useSlots:$,useModelObserver:O,ConfirmationContext:mt,VersionContext:at}){if(!this.payload)return;let{React:p}=this.payload,{sdk:B}=k(),[y,Mt]=w(),{setConfirm:bt}=g(mt),z=i||n,fe=B.library;y&&(this.component=y),h(()=>{if(this.props.hidden)return;let S=fe.components.getItem(r).clone();return S.versions.search({ids:[n,i].filter(Boolean),componentIds:[r]}).then(gt=>{S.versions.setItems(gt);let C=S.findVersion(i,["staged","published"]),q=S.findVersion(n,["staged","published"]);if(C)C.deletedAt?(C.getDraft().changeAndNotify(q.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(q)){console.error("FEAAS Editor: Forking");let yt=q.fork(i).id;this.setAttribute("instance",yt)}else console.error("FEAAS Editor: Regular");Mt(S)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),Mt(null)},400)}},[n,this.props.hidden]);let Lt=O(y==null?void 0:y.versions,[]).filter(S=>S.id==z),V=Lt[0];V&&!this.props.hidden&&(this.version=V),h(()=>(this.unfork=()=>{bt({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let S=y.findVersion(n,["staged","published"]);y.findVersion(i).unstage().unpublish().changeAndNotify(S.toProperties()),y.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(y.findVersion(z).revert(),y.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{bt({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=()=>{bt({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:()=>{y.findVersion(z).commitData({view:this.editorContext.editor.getData({rootName:z}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",z),y.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[y]);let ve=v(()=>this.target,[y]);return v(()=>y&&$(e,({picker:S,children:gt})=>p.createElement(E,{ref:C=>{this.chrome=C?{positionable:C,wrapper:C.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},p.createElement(E,{className:"editor-wrapper",position:"absolute",left:0,top:0},p.createElement(o,{datasources:B.datasources,sdk:B,library:B.library,component:y,versions:Lt,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:gt,chrome:({editor:C})=>C&&p.createElement(st,null),children:({isArchivedDisplayed:C,editor:q,status:yt})=>p.createElement(E,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},p.createElement(E,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),p.createElement(E,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),p.createElement(E,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),p.createElement(E,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),V&&p.createElement(l,{version:V,node:ve,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:p.createElement(x,{justifyContent:"space-between"},p.createElement(u,{size:"sm",editor:yt=="ready"?q:null}),p.createElement(f,{size:"sm"})),middle:(Xe,Ze)=>[!1],right:p.createElement(p.Fragment,null,p.createElement(ot,{variant:"secondary",size:"sm",onClick:this.close},"Close"),p.createElement(ot,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),p.createElement(d,{isDisabled:!this.props.forked&&!this.props.changed},p.createElement(D,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),p.createElement(D,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[V,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};rt.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];rt.register("feaas-editor");function ae(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 nt=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return ae(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}render({placeholder:e,context:r,mode:n,children:i,variant:o},{Picker:s,React:a,ReactDOM:l}){return a.createElement(s,{placeholder:e,mode:n||void 0,onClose:this.props.onClose,onContextAttributeSet:this.props.onContextAttributeSet,context:r,variant:o},i)}};nt.observedAttributes=["library","mode","frontend","src","hidden","variant"];nt.register("feaas-picker");function le(t=this){var e,r,n,i;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:(n=t==null?void 0:t.getAttribute("backend"))!==null&&n!==void 0?n:"https://components.sitecoreclud.io/api",cdn:(i=t==null?void 0:t.getAttribute("cdn"))!==null&&i!==void 0?i:"https://feaas.blob.core.windows.net",auth:null,isolate:(t==null?void 0:t.getAttribute("isolate"))==null||(t==null?void 0:t.getAttribute("isolate"))=="true"}}var it=class extends b{constructor(){super(...arguments),this.defaultProps={isolate:!0},this.onStatusChange=e=>{e=="ready"&&this.dispatchEvent(new Event("feaasReady",{bubbles:!0,composed:!0}))}}getProps(){return le(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:n,Chakra:{Button:i,Tooltip:o},React:s}){let a={containerRef:{current:this.getRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.createElement(n,{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)}};it.observedAttributes=["library","component","version","revision","hostname","template"];it.register("feaas-context");var he=Et(require("react"),1);var ce=Et(require("react"),1),de=Et(require("react-dom"),1);function Nt(t){let e=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return t.replace(e,function(r){return"-"+r.toLowerCase()})}function ue(t){let e=/-[a-z\u00E0-\u00F6\u00F8-\u00FE]/g;return t.replace(e,function(r){return r.slice(1).toUpperCase()})}var Je=t=>{if(!t)return;let e,r;return t.properties&&(e=Object.keys(t.properties).reduce((n,i)=>(n[Nt(i)]=t.properties[i],n),{}),r=t.required.map(n=>Nt(n))),{...t,properties:e,required:r}};function Ke(t=this){return t.getAttributeNames().reduce((n,i)=>!i.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(i)?{...n,[ue(i)]:t.getAttribute(i)}:n,{})}var _FEAASExternal=class extends b{load(){return Promise.resolve({React:ce.default,ReactDOM:de.default})}render(t,{React:e}){var r;let{dataExternalId:n}=t,i=(r=_FEAASExternal.registered[n])===null||r===void 0?void 0:r.component;return i||console.warn("FEAASExternal: The component you requested is not registered"),e.createElement(e.Fragment,null,i&&e.createElement(i,{...t}))}getProps(){return Ke(this)}static registerComponent(t,e={},r){_FEAASExternal.registered[r||t.name]={component:t,schema:e}}static setRegistrationCallback(){!_FEAASExternal.registrationCallback&&typeof window!="undefined"&&(_FEAASExternal.registrationCallback=setTimeout(()=>{var t,e;let r=Object.keys(_FEAASExternal.registered).map(n=>({..._FEAASExternal.registered[n],name:n,schema:Je(_FEAASExternal.registered[n].schema),component:_FEAASExternal.registered[n].component.toString()}));(t=window==null?void 0:window.parent)===null||t===void 0||t.postMessage(JSON.stringify({action:"register-components",data:r}),(e=window==null?void 0:window.parent)===null||e===void 0?void 0:e.origin)},500))}static loadComponents(){let components=JSON.parse(sessionStorage.getItem("feaas-external-components"));components.forEach(c=>{let name=c.name,schema=c.schema,component=eval("("+c.component+")");_FEAASExternal.registerComponent(component,schema,name)})}};_FEAASExternal.registered={};_FEAASExternal.register("feaas-external");_FEAASExternal.setRegistrationCallback();function pe({data:t,...e}){if("template"in e&&typeof e.template=="string")var r=Ft(e.template,t||{});return"src"in e&&(e={...L(e.src),...e}),he.default.createElement("feaas-component",{...e,template:null,data:typeof t=="string"?t:t?JSON.stringify(t):null,dangerouslySetInnerHTML:{__html:r||""}})}var Ge=pe;
68
+ </div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};et.observedAttributes=["hidden","opacity"];et.register("feaas-loader");function se(e=this){var t,r,n,i;let o=e.getAttribute("src");if(o)var{cdn:s,library:a,revision:l}=ht(o);return{library:e==null?void 0:e.getContextAttribute("library"),revision:(r=(t=e==null?void 0:e.getAttribute("revision"))!==null&&t!==void 0?t:l)!==null&&r!==void 0?r:"published",cdn:(i=(n=e==null?void 0:e.getContextAttribute("cdn"))!==null&&n!==void 0?n:e==null?void 0:e.getContextAttribute("hostname"))!==null&&i!==void 0?i:k}}var vt=class extends b{constructor(){super(...arguments),this.onLoad=t=>{this.payload=t,this.advance()}}getProps(){return se(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return ft(this.props,this.onLoad)}};vt.register("feaas-stylesheet");var Ot;typeof window!="undefined"&&(window.FEAASElement=I,(Ot=window.FEAASLoading)!==null&&Ot!==void 0||(window.FEAASLoading=Promise.resolve()));function ae(e){let t=[];if(e){let r=e.ownerDocument.defaultView,n,i;for(;r!==window.top;){n=r.parent;for(let o=0;o<n.frames.length;o++)if(n.frames[o]===r){for(let s of n.document.getElementsByTagName("iframe"))if(s.contentWindow===r){i=s.getBoundingClientRect();let a=s.contentWindow.getComputedStyle(s);t.push({left:i.left+parseInt(a.borderLeftWidth),top:i.top+parseInt(a.borderTopWidth)})}r=n;break}}}return t.reduce((r,n)=>({left:r.left+n.left,top:r.top+n.top}),{left:0,top:0})}function le(e=this){var t;return{context:HTMLElement,frontend:e==null?void 0:e.getContextAttribute("frontend"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/editor.js",library:e==null?void 0:e.getAttribute("library"),component:e==null?void 0:e.getAttribute("component"),version:e==null?void 0:e.getAttribute("version"),instance:e==null?void 0:e.getAttribute("instance"),forked:e==null?void 0:e.getAttribute("forked"),revision:(e==null?void 0:e.getAttribute("revision"))||"saved",hidden:(e==null?void 0:e.getAttribute("hidden"))!=null,for:e==null?void 0:e.getAttribute("for"),state:(e==null?void 0:e.getAttribute("state"))||"idle",changed:(e==null?void 0:e.getAttribute("changed"))!=null}}var rt=class extends b{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=(t,r={component:t.getAttribute("component"),version:t.getAttribute("version"),revision:t.getAttribute("revision"),instance:t.getAttribute("instance")})=>{if(!this.closing&&(!this.target||t==null))return this.set(r),this.target=t,!0},this.onChromeMeasureElement=(t,r=t.getBoundingClientRect())=>t.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=t=>{t.memoized.focusable&&(this.framePoint=ae(t.memoized.focusable)),this.chrome&&(this.wrapperRect=this.chrome.positionable.getBoundingClientRect(),this.bodyRect=this.chrome.positionable.ownerDocument.body.parentElement.getBoundingClientRect())},this.onMeasure=()=>{},this.onPosition=({focusable:t,root:r})=>{!this.chrome||this.props.hidden||(t?(this.chrome.wrapper.style.width=t.width+16*2+"px",this.chrome.wrapper.style.height=t.height+16*1+64+"px",this.chrome.wrapper.style.left=t.left-16+"px",this.chrome.wrapper.style.top=t.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=t=>{var r;switch((r=t.data)===null||r===void 0?void 0:r.type){case"feaasEdit":let n=this.getPlaceholder();this.setTarget(n.editable,t.data)&&(this.loader=n.loader,document.body.appendChild(n.clipper),this.editedUID=t.data.id,this.setPlaceholder(),this.open());break;case"feaasMeasurements":this.measurements=t.data.measurements,this.props.hidden||this.setPlaceholder();break}},this.onContentChange=()=>{this.setAttribute("changed","changed"),requestAnimationFrame(()=>{this.setIframeComponentContent()})},this.onClose=()=>{var t;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"),!((t=this.target)===null||t===void 0)&&t.parentNode&&(this.target.outerHTML=this.target.outerHTML),this.setTarget(null,{component:null,version:null,instance:null,revision:null}),this.setEditorContext({isFocused:!1})},this.onVersionStateChange=(t,r)=>{this.versionContext=t,this.setVersionContext=r},this.onEditorStateChange=(t,r)=>{this.editorContext=t,this.setEditorContext=r,t.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 le(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(t){this.iframe=t}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 t=this.iframe.clientWidth,r=this.iframe.clientHeight,n=this.iframe.getBoundingClientRect(),i=this.getPlaceholder(),o=document.body.getBoundingClientRect(),s=this.measurements[this.editedUID];s&&(Object.assign(i.clipper.style,{position:"absolute",top:n.top+this.iframe.clientTop-o.top+"px",left:n.left+this.iframe.clientLeft-o.left+"px",width:t+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(i.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(i.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(t,r,n){r!==n&&(t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),n?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,n))}open(){clearTimeout(this.closing),this.removeAttribute("hidden"),this.removeAttribute("changed"),this.setLoadingState()}shouldFork(t){return t.forkOriginId==null&&this.props.instance!=null}cleanup(){var t;this.placeholder&&((t=this.placeholder.clipper)===null||t===void 0||t.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(t){console.log("Editor is not ready")}setEditorContext(t){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:t,component:r,version:n,instance:i},{Editor:o,VersionStatusList:s,VersionStatusButton:a,Version:l,VersionMenu:c,EditorUIUndo:u,EditorUIMode:p,React:{useEffect:d,useMemo:f,useState:w,useContext:g},Chakra:{HStack:C,Box:E,Button:ot,MenuItem:D},Chrome:st,ReactDOM:Lt,useSDK:F,useSlots:$,useModelObserver:O,ConfirmationContext:bt,VersionContext:at}){if(!this.payload)return;let{React:h}=this.payload,{sdk:B}=F(),[y,$t]=w(),{setConfirm:mt}=g(bt),z=i||n,ve=B.library;y&&(this.component=y),d(()=>{if(this.props.hidden)return;let S=ve.components.getItem(r).clone();return S.versions.search({ids:[n,i].filter(Boolean),componentIds:[r]}).then(gt=>{S.versions.setItems(gt);let x=S.findVersion(i,["staged","published"]),q=S.findVersion(n,["staged","published"]);if(x)x.deletedAt?(x.getDraft().changeAndNotify(q.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",x.id));else if(this.removeAttribute("forked"),this.shouldFork(q)){console.error("FEAAS Editor: Forking");let yt=q.fork(i).id;this.setAttribute("instance",yt)}else console.error("FEAAS Editor: Regular");$t(S)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),$t(null)},400)}},[n,this.props.hidden]);let Bt=O(y==null?void 0:y.versions,[]).filter(S=>S.id==z),V=Bt[0];V&&!this.props.hidden&&(this.version=V),d(()=>(this.unfork=()=>{mt({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let S=y.findVersion(n,["staged","published"]);y.findVersion(i).unstage().unpublish().changeAndNotify(S.toProperties()),y.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(y.findVersion(z).revert(),y.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{mt({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=()=>{mt({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:()=>{y.findVersion(z).commitData({view:this.editorContext.editor.getData({rootName:z}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",z),y.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[y]);let be=f(()=>this.target,[y]);return f(()=>y&&$(t,({picker:S,children:gt})=>h.createElement(E,{ref:x=>{this.chrome=x?{positionable:x,wrapper:x.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},h.createElement(E,{className:"editor-wrapper",position:"absolute",left:0,top:0},h.createElement(o,{datasources:B.datasources,sdk:B,library:B.library,component:y,versions:Bt,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:gt,chrome:({editor:x})=>x&&h.createElement(st,null),children:({isArchivedDisplayed:x,editor:q,status:yt})=>h.createElement(E,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},h.createElement(E,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(E,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(E,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),h.createElement(E,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),V&&h.createElement(l,{version:V,node:be,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:h.createElement(C,{justifyContent:"space-between"},h.createElement(u,{size:"sm",editor:yt=="ready"?q:null}),h.createElement(p,{size:"sm"})),middle:(Ze,Qe)=>[!1],right:h.createElement(h.Fragment,null,h.createElement(ot,{variant:"secondary",size:"sm",onClick:this.close},"Close"),h.createElement(ot,{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(D,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),h.createElement(D,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[V,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};rt.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];rt.register("feaas-editor");function ue(e=this){var t,r;return{part:(e==null?void 0:e.getAttribute("part"))||"picker",slot:(e==null?void 0:e.getAttribute("part"))||"picker",mode:e==null?void 0:e.getAttribute("mode"),placeholder:(e==null?void 0:e.getAttribute("placeholder"))||"No theme",frontend:(t=e==null?void 0:e.getContextAttribute("frontend"))!==null&&t!==void 0?t:"https://components.sitecorecloud.io",src:(r=e==null?void 0:e.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(e==null?void 0:e.getAttribute("hidden"))!=null,variant:e==null?void 0:e.getAttribute("variant"),context:void 0,onClose:void 0,onContextAttributeSet:void 0}}var nt=class extends b{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return ue(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}render({placeholder:t,context:r,mode:n,children:i,variant:o},{Picker:s,React:a,ReactDOM:l}){return a.createElement(s,{placeholder:t,mode:n||void 0,onClose:this.props.onClose,onContextAttributeSet:this.props.onContextAttributeSet,context:r,variant:o},i)}};nt.observedAttributes=["library","mode","frontend","src","hidden","variant"];nt.register("feaas-picker");function ce(e=this){var t,r,n,i;return{library:e==null?void 0:e.getAttribute("library"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/context.js",frontend:(r=e==null?void 0:e.getAttribute("frontend"))!==null&&r!==void 0?r:"https://components.sitecoreclud.io",backend:(n=e==null?void 0:e.getAttribute("backend"))!==null&&n!==void 0?n:"https://components.sitecoreclud.io/api",cdn:(i=e==null?void 0:e.getAttribute("cdn"))!==null&&i!==void 0?i:"https://feaas.blob.core.windows.net",auth:null,isolate:(e==null?void 0:e.getAttribute("isolate"))==null||(e==null?void 0:e.getAttribute("isolate"))=="true"}}var it=class extends b{constructor(){super(...arguments),this.defaultProps={isolate:!0},this.onStatusChange=t=>{t=="ready"&&this.dispatchEvent(new Event("feaasReady",{bubbles:!0,composed:!0}))}}getProps(){return ce(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(t){return t}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(t=>{this.getRoot().appendChild(t)}),super.connectedCallback()}render({children:t,library:r},{AppContext:n,Chakra:{Button:i,Tooltip:o},React:s}){let a={containerRef:{current:this.getRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.createElement(n,{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}}},t)}};it.observedAttributes=["library","component","version","revision","hostname","template"];it.register("feaas-context");var pe=Et(require("react"),1);var Tt=Et(require("react"),1),he=Et(require("react-dom"),1);function Nt(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return e.replace(t,function(r){return"-"+r.toLowerCase()})}function de(e){let t=/-[a-z\u00E0-\u00F6\u00F8-\u00FE]/g;return e.replace(t,function(r){return r.slice(1).toUpperCase()})}var Ke=e=>{if(!e)return;let t,r;return e.properties&&(t=Object.keys(e.properties).reduce((n,i)=>(n[Nt(i)]=e.properties[i],n),{}),r=e.required.map(n=>Nt(n))),{...e,properties:t,required:r}},Ge=(e,t,r)=>{var n;switch((n=r==null?void 0:r[e])===null||n===void 0?void 0:n.type){case"string":return t;case"object":return JSON.parse(t);case"array":return JSON.parse(t);case"number":return+t;case"integer":return+t;case"boolean":return t==="true";default:return t}};function Ye(e=this){var t;let r=e.getAttributeNames(),n=e.getAttribute("data-external-id"),i=(t=m.registered[n])===null||t===void 0?void 0:t.schema;return r.reduce((s,a)=>{if(!a.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(a)){let l=e.getAttribute(a);return{...s,[de(a)]:Ge(a,l,i==null?void 0:i.properties)}}else return s},{})}var m=class extends b{load(){return Promise.resolve({React:Tt.default,ReactDOM:he.default})}render(t,{React:r}){var n;let{dataExternalId:i}=t,o=(n=m.registered[i])===null||n===void 0?void 0:n.component;return o||console.warn("FEAASExternal: The component you requested is not registered"),r.createElement(r.Fragment,null,o&&r.createElement(o,{...t}))}getProps(){return Ye(this)}static registerComponent(t,r={},n){m.registered[n||t.name]={component:t,schema:r}}static setRegistrationCallback(){!m.registrationCallback&&typeof window!="undefined"&&(m.registrationCallback=setTimeout(()=>{var t;let r=Object.keys(m.registered).map(n=>({...m.registered[n],name:n,schema:Ke(m.registered[n].schema)}));(t=window==null?void 0:window.parent)===null||t===void 0||t.postMessage(JSON.stringify({action:"register-components",data:r}),"*")},500))}static Preview(t){var r;let n=(t==null?void 0:t.src)||(typeof window!="undefined"?(r=window.location.search.match(/feaasSrc=([^&]+)/))===null||r===void 0?void 0:r[1]:null);return n?Tt.default.createElement(Mt,{src:n,...t}):null}};m.registered={};m.register("feaas-external");m.setRegistrationCallback();function fe({data:e,...t}){if("template"in t&&t.template)var r=kt(t.template,e||{});return"src"in t&&(t={...L(t.src),...t}),pe.default.createElement("feaas-component",{...t,template:null,data:typeof e=="string"?e:e?JSON.stringify(e):null,dangerouslySetInnerHTML:{__html:r||""}})}var Mt=fe;
69
69
  //# sourceMappingURL=react.cjs.map