@sitecore-feaas/clientside 0.3.3 → 0.3.5
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/build/components/FEAASElement.js +9 -1
- package/build/components/FEAASElement.js.map +1 -1
- package/build/dom/rendering.js +10 -1
- package/build/dom/rendering.js.map +1 -1
- package/build/utils/data.js +4 -3
- package/build/utils/data.js.map +1 -1
- package/dist/browser/headless.cjs +7 -7
- package/dist/browser/headless.cjs.map +3 -3
- package/dist/browser/headless.esm.js +7 -7
- package/dist/browser/headless.esm.js.map +1 -1
- package/dist/browser/index.cjs +5 -5
- package/dist/browser/index.cjs.map +3 -3
- package/dist/browser/index.esm.js +5 -5
- package/dist/browser/index.esm.js.map +1 -1
- package/dist/browser/react.cjs +5 -5
- package/dist/browser/react.cjs.map +3 -3
- package/dist/browser/react.esm.js +6 -6
- package/dist/browser/react.esm.js.map +1 -1
- package/dist/node/headless.cjs +5 -5
- package/dist/node/headless.cjs.map +3 -3
- package/dist/node/headless.esm.js +5 -5
- package/dist/node/headless.esm.js.map +3 -3
- package/dist/node/index.cjs +4 -4
- package/dist/node/index.cjs.map +3 -3
- package/dist/node/index.esm.js +5 -5
- package/dist/node/index.esm.js.map +3 -3
- package/dist/node/react.cjs +4 -4
- package/dist/node/react.cjs.map +3 -3
- package/dist/node/react.esm.js +5 -5
- package/dist/node/react.esm.js.map +3 -3
- package/headless.cjs +5 -5
- package/headless.cjs.map +3 -3
- package/headless.js +5 -5
- package/headless.js.map +3 -3
- package/package.json +1 -1
- package/react.cjs +5 -5
- package/react.cjs.map +3 -3
- package/react.js +5 -5
- package/react.js.map +3 -3
- package/src/components/FEAASElement.tsx +13 -1
- package/src/dom/rendering.ts +11 -1
- package/src/utils/data.ts +3 -3
- package/test/dom.test.ts +45 -0
- package/types/components/FEAASElement.d.ts.map +1 -1
- package/types/dom/rendering.d.ts.map +1 -1
- package/types/tsbuildinfo +1 -1
- package/types/ui/tsbuildinfo +1 -1
- package/types/utils/data.d.ts +1 -1
- package/types/utils/data.d.ts.map +1 -1
package/dist/node/react.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var Le=Object.defineProperty;var G=(e,t)=>{for(var r in t)Le(e,r,{get:t[r],enumerable:!0})};var jt={};G(jt,{Component:()=>it,ComponentProps:()=>he,Context:()=>W,ControlledPromise:()=>S,DEFAULT_CDN_URL:()=>_,DOM:()=>ft,DataPath:()=>pt,DataScope:()=>ct,DataSettings:()=>E,Element:()=>y,FEAASComponent:()=>it,FEAASComponentsProps:()=>he,FEAASContext:()=>W,FEAASContextProps:()=>Ee,FEAASEditor:()=>ot,FEAASEditorProps:()=>we,FEAASElement:()=>y,FEAASLoader:()=>nt,FEAASLoaderProps:()=>pe,FEAASPicker:()=>st,FEAASPickerProps:()=>Ce,FEAASStylesheet:()=>wt,FEAASStylesheetProps:()=>fe,InvalidResponse:()=>mt,JSONPath:()=>p,Loader:()=>nt,MyComponent:()=>lt,Picker:()=>st,Stylesheet:()=>wt,Thumbnail:()=>Ct,adjustNumbers:()=>Zt,autoloadScripts:()=>Kt,cleanCollectionBit:()=>Z,clearFetchCache:()=>We,createStylesheet:()=>de,fetchAndRevalidate:()=>tt,fetchAndRevalidateComponent:()=>z,fetchAndRevalidateStylesheet:()=>bt,fetchBypassingCache:()=>gt,fetchCache:()=>Q,fetchComponent:()=>Ot,fetchData:()=>$t,fetchToValidateCache:()=>et,fetchWithCacheAwareness:()=>F,findStylesheet:()=>le,getComponentSource:()=>He,getComponentURL:()=>rt,getFetchCache:()=>se,getFramePosition:()=>Ae,getHumanizedLabel:()=>Qt,getLastPathBit:()=>te,getQualifier:()=>Yt,getStylesheetSource:()=>Be,getStylesheetURL:()=>I,loadScript:()=>Y,loadStylesheet:()=>yt,loadStylesheetAllowStale:()=>Mt,normalizeCollectionScope:()=>ht,observeDOMElement:()=>qt,parseComponentSource:()=>j,parseLimit:()=>Gt,parseRange:()=>Xt,parseStylesheetSource:()=>vt,queryObject:()=>dt,queryScopes:()=>X,renderComponent:()=>Lt,renderComponentElement:()=>Ve,renderComponentPromise:()=>ce,renderDOMContent:()=>U,renderDOMElement:()=>R,renderHTMLContent:()=>ne,renderStylesheet:()=>ze,renderStylesheetPromise:()=>ae,serializeCH1RichText:()=>L,setDOMAttribute:()=>$});function S(e,t=r=>{}){var r;let i=()=>{var n,s;let o=new Promise((l,d)=>{n=u=>{e==null||e(u),l(u)},s=d});var a=Object.assign(o,{resolve:n,reject:s,restart:i,first:r});return r=a,a.catch(t),a};return i()}var De=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,y=class extends De{getProps(t){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=S(t=>{this.payload=t}),this.whenRendered=S(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(t,r,i){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.dispatchEventIndirectly(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var i;return(i=r.mount)===null||i===void 0?void 0:i.call(r)}),this.set()}catch(t){this.onError(t)}}dispatchEventIndirectly(t){this.dispatchEvent(t);let r=this.getParent();r&&!r.contains(this)&&(Object.defineProperty(t,"target",{value:this,writable:!1}),Object.defineProperty(t,"composedPath",{value:()=>[this],writable:!1}),r.handleEvent(t))}isJSONAttribute(t){return!1}log(...t){typeof process!="undefined"&&process.env.TESTING||console.log(...t)}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEventIndirectly(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;if(this.tagName!="FEAAS-CONTEXT")return document.querySelector("feaas-context")}getElements(t=this.getRoot(),r=!0){return Array.from(t.querySelectorAll("*")).map(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.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,i;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 s=t.refs.parent;s;s=s.refs.parent)s.render&&((i=t.refs).parentReact||(i.parentReact=s),t.refs.topReact=s)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(t,r="uncaught",i=!1){let n=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:t});if(this.dispatchEventIndirectly(n),this.whenLoaded.reject(t),!n.defaultPrevented&&!i){this.whenRendered.reject(t);try{this.unmount()}catch(s){}return!0}return!1}shouldUpdateOnLoad(){return!0}async advance(){try{if(this.payload===void 0){if(!this.isReadyToLoad())return;this.payload=null,this.dispatchEventIndirectly(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;if(!this.connected)return;let i=(r=(t=this.payload)===null||t===void 0?void 0:t.ReactDOM)===null||r===void 0?void 0:r.flushSync;i?i(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var t,r,i;if(this.payload==null||!this.render)return;let{React:n,ReactDOM:s,ReactDOMClient:o}=this.payload||{};if(!n)throw new Error(`${this.tagName}: React is not present in payload`);if(!s)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?o?(this.reactRoot||(this.reactRoot=o.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):s.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact?(t=this.forceUpdateReact)===null||t===void 0||t.call(this):(i=(r=this.refs.topReact).forceUpdateReact)===null||i===void 0||i.call(r)}invokeReactRendering(){let{React:t,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let i=this.descendants.filter(n=>n.refs.parentReact==this&&n.payload).map((n,s)=>this.getReactElement(n));return this.render({...this.props,children:i},this.payload)}getReactErrorBoundary(t=this,r=t.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:i,ReactDOM:n}=t.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends i.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(o){return{error:o}}componentDidCatch(o,a){console.error(`FEAAS: ${t.tagName} Error:`,o,a),t.onError(o,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(t=this,r){let{React:i,ReactDOM:n}=t.payload||{},s=this.getReactErrorBoundary(),o=this.getReactWrapper(t);return i.createElement(s,{key:t.tagName+"-"+t.getUID(),slot:t.getAttribute("slot")},i.createElement(o,null))}getReactWrapper(t=this,r=t.tagName){if(t.reactWrapper)return t.reactWrapper;let{React:i,ReactDOM:n}=t.payload||{};return t.reactWrapper=s=>{if(t.render){let[o,a]=i.useReducer(l=>l+1,0);return t.forceUpdateReact=a,n.createPortal(i.createElement(i.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.isJSONAttribute(r),s=this.props[r],o=n?JSON.stringify(s):String(s),a=this.defaultProps[r],l=n?JSON.stringify(a):String(a),d=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),u=this.getAttribute(d);try{var i=n?JSON.stringify(JSON.parse(u)):u}catch(m){var i=null}s==null||o===l?this.removeAttribute(d):(typeof s=="string"||typeof s=="number"||typeof s=="boolean"||n)&&i!=o&&this.setAttribute(d,o)}}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 i=this;i=i.parentElement||(i.parentNode instanceof ShadowRoot?i.parentNode.host:null);)if(i.getAttribute(t)!=null)return i.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 B=class extends y{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([t,r])=>({React:t,ReactDOM:r}))}render({},{React:t}){return t.createElement(t.Fragment,null)}},lt=class extends B{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:t},{React:r}){let[i,n]=r.useState(0);return r.useEffect(()=>{n(s=>s+1)},[t]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",t),r.createElement("p",null,"Triggered updates: ",i))}};lt.observedAttributes=["counter"];var ft={};G(ft,{renderDOMContent:()=>U,renderDOMElement:()=>R,renderHTMLContent:()=>ne,setDOMAttribute:()=>$});var ct={};G(ct,{JSONPath:()=>p,queryObject:()=>dt,queryScopes:()=>X,serializeCH1RichText:()=>L});import $e from"vm";var{hasOwnProperty:x}=Object.prototype;function M(e,t){return e=e.slice(),e.push(t),e}function kt(e,t){return t=t.slice(),t.unshift(e),t}var Tt=class extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}};function p(e,t,r,i,n){if(!(this instanceof p))try{return new p(e,t,r,i,n)}catch(o){if(!o.avoidNew)throw o;return o.value}typeof e=="string"&&(n=i,i=r,r=t,t=e,e=null);let s=e&&typeof 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=x.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||i||null,this.otherTypeCallback=e.otherTypeCallback||n||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){let o={path:s?e.path:t};s?"json"in e&&(o.json=e.json):o.json=r;let a=this.evaluate(o);if(!a||typeof a!="object")throw new Tt(a);return a}}p.prototype.evaluate=function(e,t,r,i){let n=this.parent,s=this.parentProperty,{flatten:o,wrap:a}=this;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=i||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&typeof 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(!x.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),o=x.call(e,"flatten")?e.flatten:o,this.currResultType=x.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=x.call(e,"sandbox")?e.sandbox:this.currSandbox,a=x.call(e,"wrap")?e.wrap:a,this.currPreventEval=x.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=x.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=x.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,n=x.call(e,"parent")?e.parent:n,s=x.call(e,"parentProperty")?e.parentProperty:s,e=e.path}if(n=n||null,s=s||null,Array.isArray(e)&&(e=p.toPathString(e)),!e&&e!==""||!t)return;let l=p.toPathArray(e);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;let d=this._trace(l,t,["$"],n,s,r).filter(function(u){return u&&!u.isParentSelector});return d.length?!a&&d.length===1&&!d[0].hasArrExpr?this._getPreferredOutput(d[0]):d.reduce((u,m)=>{let h=this._getPreferredOutput(m);return o&&Array.isArray(h)?u=u.concat(h):u.push(h),u},[]):a?[]:void 0};p.prototype._getPreferredOutput=function(e){let t=this.currResultType;switch(t){case"all":{let r=Array.isArray(e.path)?e.path:p.toPathArray(e.path);return e.pointer=p.toPointer(r),e.path=typeof e.path=="string"?e.path:p.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return p.toPathString(e[t]);case"pointer":return p.toPointer(e.path);default:throw new TypeError("Unknown result type")}};p.prototype._handleCallback=function(e,t,r){if(t){let i=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:p.toPathString(e.path),t(i,r,e)}};p.prototype._trace=function(e,t,r,i,n,s,o,a){let l;if(!e.length)return l={path:r,value:t,parent:i,parentProperty:n,hasArrExpr:o},this._handleCallback(l,s,"value"),l;let d=e[0],u=e.slice(1),m=[];function h(c){Array.isArray(c)?c.forEach(f=>{m.push(f)}):m.push(c)}if((typeof d!="string"||a)&&t&&x.call(t,d))h(this._trace(u,t[d],M(r,d),t,d,s,o));else if(d==="*")this._walk(t,c=>{h(this._trace(u,t[c],M(r,c),t,c,s,!0,!0))});else if(d==="..")h(this._trace(u,t,r,i,n,s,o)),this._walk(t,c=>{typeof t[c]=="object"&&h(this._trace(e.slice(),t[c],M(r,c),t,c,s,!0))});else{if(d==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:u,isParentSelector:!0};if(d==="~")return l={path:M(r,d),value:n,parent:i,parentProperty:null},this._handleCallback(l,s,"property"),l;if(d==="$")h(this._trace(u,t,r,null,null,s,o));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(d))h(this._slice(d,u,t,r,i,n,s));else if(d.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let c=d.replace(/^\?\((.*?)\)$/u,"$1");this._walk(t,f=>{this._eval(c,t[f],f,r,i,n)&&h(this._trace(u,t[f],M(r,f),t,f,s,!0))})}else if(d[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");h(this._trace(kt(this._eval(d,t,r[r.length-1],r.slice(0,-1),i,n),u),t,r,i,n,s,o))}else if(d[0]==="@"){let c=!1,f=d.slice(1,-2);switch(f){case"scalar":(!t||!["object","function"].includes(typeof t))&&(c=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===f&&(c=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(c=!0);break;case"number":Number.isFinite(t)&&(c=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(c=!0);break;case"object":t&&typeof t===f&&(c=!0);break;case"array":Array.isArray(t)&&(c=!0);break;case"other":c=this.currOtherTypeCallback(t,r,i,n);break;case"null":t===null&&(c=!0);break;default:throw new TypeError("Unknown value type "+f)}if(c)return l={path:r,value:t,parent:i,parentProperty:n},this._handleCallback(l,s,"value"),l}else if(d[0]==="`"&&t&&x.call(t,d.slice(1))){let c=d.slice(1);h(this._trace(u,t[c],M(r,c),t,c,s,o,!0))}else if(d.includes(",")){let c=d.split(",");for(let f of c)h(this._trace(kt(f,u),t,r,i,n,s,!0))}else!a&&t&&x.call(t,d)&&h(this._trace(u,t[d],M(r,d),t,d,s,o,!0))}if(this._hasParentSelector)for(let c=0;c<m.length;c++){let f=m[c];if(f&&f.isParentSelector){let w=this._trace(f.expr,t,f.path,i,n,s,o);if(Array.isArray(w)){m[c]=w[0];let C=w.length;for(let b=1;b<C;b++)c++,m.splice(c,0,w[b])}else m[c]=w}}return m};p.prototype._walk=function(e,t){if(Array.isArray(e)){let r=e.length;for(let i=0;i<r;i++)t(i)}else e&&typeof e=="object"&&Object.keys(e).forEach(r=>{t(r)})};p.prototype._slice=function(e,t,r,i,n,s,o){if(!Array.isArray(r))return;let a=r.length,l=e.split(":"),d=l[2]&&Number.parseInt(l[2])||1,u=l[0]&&Number.parseInt(l[0])||0,m=l[1]&&Number.parseInt(l[1])||a;u=u<0?Math.max(0,u+a):Math.min(a,u),m=m<0?Math.max(0,m+a):Math.min(a,m);let h=[];for(let c=u;c<m;c+=d)this._trace(kt(c,t),r,i,n,s,o,!0).forEach(w=>{h.push(w)});return h};p.prototype._eval=function(e,t,r,i,n,s){this.currSandbox._$_parentProperty=s,this.currSandbox._$_parent=n,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;let o=e.includes("@path");o&&(this.currSandbox._$_path=p.toPathString(i.concat([r])));let a="script:"+e;if(!p.cache[a]){let l=e.replace(/@parentProperty/gu,"_$_parentProperty").replace(/@parent/gu,"_$_parent").replace(/@property/gu,"_$_property").replace(/@root/gu,"_$_root").replace(/@([.\s)[])/gu,"_$_v$1");o&&(l=l.replace(/@path/gu,"_$_path")),p.cache[a]=new this.vm.Script(l)}try{return p.cache[a].runInNewContext(this.currSandbox)}catch(l){throw new Error("jsonPath: "+l.message+": "+e)}};p.cache={};p.toPathString=function(e){let t=e,r=t.length,i="$";for(let n=1;n<r;n++)/^(~|\^|@.*?\(\))$/u.test(t[n])||(i+=/^[0-9*]+$/u.test(t[n])?"["+t[n]+"]":"['"+t[n]+"']");return i};p.toPointer=function(e){let t=e,r=t.length,i="";for(let n=1;n<r;n++)/^(~|\^|@.*?\(\))$/u.test(t[n])||(i+="/"+t[n].toString().replace(/~/gu,"~0").replace(/\//gu,"~1"));return i};p.toPathArray=function(e){let{cache:t}=p;if(t[e])return t[e].concat();let r=[],n=e.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replace(/[['](\??\(.*?\))[\]']/gu,function(s,o){return"[#"+(r.push(o)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(s,o){return"['"+o.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(s,o){return";"+o.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"").split(";").map(function(s){let o=s.match(/#(\d+)/u);return!o||!o[1]?s:r[o[1]]});return t[e]=n,t[e].concat()};p.prototype.vm=$e;function dt(e,t){return p({path:t,json:e})}function X(e,t,r=!1,i=e){var n=t;let s=Object.keys(e).sort((a,l)=>l.length-a.length);for(let a of s)if(t.startsWith(a)){if(a==t){if(r)return e[a];continue}n=t.substring(a.length+1),i=e[a];break}var o=p({path:n,json:i});return Array.isArray(o)&&(o==null?void 0:o.length)==0&&(o=[n.replace(/^.*?\./,"_."),n.replace(/^.*?\./,""),n.replace(/^([^.]+).*?\.\$\./,"$1."),n.replace(/^.*?\.\$\./,"_."),n.replace(/^.*?\.\$\./,""),n.replace(/^[^.]+$/,"_")].filter((a,l,d)=>d.indexOf(a)===l).reduce((a,l)=>a.length>0?a:p({path:l,json:i}),[])),r&&Array.isArray(o)?o[0]:o}function Nt(e,t={},r){return r?`<${r}${Object.entries(t).map(([i,n])=>n!=null&&` ${i}="${n}"`).filter(Boolean).join("")}>${L(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):L(e)}function L(e){var t;if(Array.isArray(e))return e.map(L).join(`
|
|
2
|
-
`).trim();if(typeof e=="string")return e;if(e==null)return"";switch(e.type){case"heading":let{level:r,...i}=e.attrs;return Nt(e.content,i,"h"+r);case"text":return(e.marks||[]).reduce((n,s)=>Nt(n,s.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[s.type]),(t=e.text)===null||t===void 0?void 0:t.replace(/\s+/," "));default:return Nt(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}var D=class{constructor(t,r=1,i){this.ownerDocument={createElement(n){return new D(n)}},this.nodeName=t,this.nodeType=r,this.textContent=i,this.attributes=[],this.childNodes=[]}setAttribute(t,r){let i=this.attributes.find(n=>n.name===t);i?i.value=r:this.attributes.push({name:t,value:r})}getAttribute(t){let r=this.attributes.find(i=>i.name===t);return r?r.value:void 0}insertBefore(t,r){if(t.parentNode=this,r===null)this.childNodes.push(t);else{let i=this.childNodes.indexOf(r);i!==-1&&this.childNodes.splice(i,0,t)}}removeAttribute(t){let r=this.attributes.findIndex(i=>i.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 localName(){var t;return(t=this.nodeName)===null||t===void 0?void 0:t.toLowerCase()}get innerHTML(){return _t(this.childNodes)}set innerHTML(t){this.childNodes=ut(String(t!=null?t:""))}get outerHTML(){return _t([this])}get children(){return this.childNodes.filter(t=>t.nodeType==1)}closest(t){let r=this;for(;r;){if(Jt(t,r))return r;r=r.parentNode}return null}querySelectorAll(t){let r=t.split(/\s*,\s*/),i=[],n=s=>{for(let o of r)if(Jt(o,s)){i.push(s);break}for(let o of s.childNodes)n(o)};for(let s of this.childNodes)n(s);return i}querySelector(t){return this.querySelectorAll(t)[0]}findSibling(t,r){if(!this.parentNode)return null;let i=this.parentNode.childNodes,n=i.indexOf(this);if(n===-1)return null;for(let s=n+t;s>=0&&s<i.length;s+=t){let o=i[s];if(!r||o.nodeType===1)return o}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 D(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),t)for(let i of this.childNodes){let n=i.cloneNode(!0);r.appendChild(n)}return r}get parentElement(){var t;return((t=this.parentNode)===null||t===void 0?void 0:t.nodeType)==1?this.parentNode:null}};function Jt(e,t){let r=e.match(/([.#]?[\w-]+|\[([\w-]+)(="([^"]*)")?\])/g);if(!r)return!1;for(let i of r)if(i.startsWith("#")){if(t.getAttribute("id")!==i.slice(1))return!1}else if(i.startsWith(".")){if(!(t.getAttribute("class")||"").split(" ").includes(i.slice(1)))return!1}else if(i.startsWith("[")){let n=i.match(/^\[([\w-]+)(="([^"]*)")?\]$/);if(n){let s=n[1],o=n[3],a=t.getAttribute(s);if(typeof o=="undefined"){if(a===void 0)return!1}else if(a!==o)return!1}else return!1}else if(t.nodeName!==i)return!1;return!0}function ut(e){var t;let r=[],i=[];for(;e;){let n=e.match(/^<([\w-]+)(\s[^>]*)?>/),s=e.match(/^<\/([\w-]+)>/);if(n){let o=n[1],l=((t=(n[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||t===void 0?void 0:t.map(u=>{let[m,h,,c]=u.match(/([\w-]+)(="([^"]*)")?/);return{name:h,value:Fe(c||"")}}))||[],d=new D(o,1);if(d.attributes=l,i.length>0){let u=i[i.length-1];u.childNodes.push(d),d.parentNode=u}else r.push(d);i.push(d),e=e.slice(n[0].length)}else if(s)i.pop(),e=e.slice(s[0].length);else{let o=e.indexOf("<"),a=e.slice(0,o!==-1?o:void 0),l=new D("#text",3);if(l.textContent=a,i.length>0){let d=i[i.length-1];d.childNodes.push(l),l.parentNode=d}else r.push(l);e=e.slice(a.length)}}return r}function Ue(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Fe(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}function _t(e){return e.map(t=>{if(t.nodeType===3)return t.textContent||"";let{nodeName:r,attributes:i}=t,n=i.map(({name:o,value:a})=>` ${o}="${Ue(String(a))}"`).join(""),s=_t(t.childNodes);return["img","input","br"].includes(r)?`<${r}${n} />`:`<${r}${n}>${s}</${r}>`}).join("")}function je(e,t,r){return Pt(e,t,r)[0].outerHTML}function Pt(e,t,r){var i;let n=((i=r==null?void 0:r.processTemplate)===null||i===void 0?void 0:i.call(r,null,e,t))||e;return ut(n).map(o=>R(o,t,r))}function qt(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let n=i.target,s=n.getAttribute("data-embed-src");s&&Y(n,s),i.addedNodes&&i.addedNodes.forEach(o=>{o.nodeType==1&&Kt(o,!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 i=0;i<r.length;i++){let n=r[i];Y(n,n.getAttribute("data-embed-src"))}if(t)return qt(e)}function Y(e,t){for(var r=e;r;r=r.parentElement)if(!r.parentElement){let n=r.querySelectorAll("script");for(var i=0;i<n.length;i++)if(n[i].getAttribute("src")==t)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let s=r.ownerDocument.createElement("script");s.setAttribute("type","module"),s.setAttribute("src",t),r.appendChild(s);break}}var pt={};G(pt,{adjustNumbers:()=>Zt,cleanCollectionBit:()=>Z,getHumanizedLabel:()=>Qt,getLastPathBit:()=>te,getQualifier:()=>Yt,normalizeCollectionScope:()=>ht,parseLimit:()=>Gt,parseRange:()=>Xt});var Gt=e=>{var t;let r=parseInt((t=e==null?void 0:e.match(/\[0:(\d+)\]/))===null||t===void 0?void 0:t[1],10);return!isNaN(r)&&r>0?String(r):null},Xt=e=>{var t;let r=(t=e==null?void 0:e.match(/\[([^\]]+)\]/))===null||t===void 0?void 0:t[1].split(/\s*,\s*/g).filter(Boolean).map(i=>{if(i.match(/^-?\d+$/))return i;let n=i.match(/^(\d+):(\d+)$/);return n&&parseInt(n[1],10)<parseInt(n[2],10)?n[1]+"-"+n[2]:null});return r!=null&&r.every(Boolean)?r.join(","):null},Yt=e=>{var t;return(t=e==null?void 0:e.match(/(\.\*|\[[^\]]*\])$/))===null||t===void 0?void 0:t[0]};function Z(e){return e.replace(/(\.?\[[^\]\[]*\]|\.\*)$/g,"")}function ht(e){return Z(e)+".*"}function Zt(e,t){return e==null?void 0:e.replace(/(.|^)(\d+)/g,(r,i,n)=>i+(i==":"?n:String(parseInt(n)+t)))}function Qt(e,t=2){var r=Z(e).split(/]\.|\.\*\./g).pop().split(/\./g).slice(-3);return r=r.filter(i=>isNaN(parseInt(i))),r.map(i=>i.charAt(0).toUpperCase()+i.slice(1)).slice(-t).join(" ")}function te(e){return Z(e).split(".").pop()}function re(e){let t=e.getAttribute("data-path-scope");for(var r=0,i=e;i=i.previousElementSibling;)i.getAttribute("data-path-scope")==t&&r++;return r}function Ie(e,t,r){let i=e.getAttribute("data-path-scope");if(i==null)return;var n=re(e);if(n!=0)return;let s=e.parentNode;if(s!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var o=n+1,a=e,l=e;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==i&&(o++,a=l);for(var d=o;d<t;d++)s.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var d=Math.max(1,t);d<o;d++)a=a.previousElementSibling,s.removeChild(a.nextElementSibling)}}function $(e,t,r,i){var n,s;if(e){var o=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=L(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(e,t,r));var a=t.replace("data-path-","");if(t=="data-path-src"){let c=Array.from(e.children).find(f=>f.localName=="picture")||e;o=e.localName=="img"?e:c.querySelector("img, video")}else if(t=="data-path-href")o=e.querySelector("a")||e.closest("a");else if(t=="data-path-alt")o=(Array.from(e.children).find(f=>f.localName=="picture")||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")a="innerHTML";else if(t=="data-embed-src")Y(e,r);else if(t=="data-path-attributes"){let c=((n=e.getAttribute("data-attributes-keys"))===null||n===void 0?void 0:n.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var l in r){var d=r[l];$(e,l,typeof d=="object"&&d?JSON.stringify(d):d,i)}for(var u=0;u<c.length;u++)(r==null||!(c[u]in r))&&$(e,c[u],null,i);$(e,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var m=String((s=e.getAttribute("data-path-placeholder")||o[a])!==null&&s!==void 0?s:o.getAttribute(a));if(r!=null)if(a=="innerHTML"){var h=String(r);o.innerHTML!=h&&(o.innerHTML=h)}else o.getAttribute(a)!=r&&o.setAttribute(a,r);else a=="innerHTML"?o.innerHTML=m:o.removeAttribute(a)}}}var ee=["data-attributes-keys","data-path-attributes","data-path-scope"];function R(e,t,r,i){var n,s,o;let a=e;if(i||(t=((n=r==null?void 0:r.processData)===null||n===void 0?void 0:n.call(r,a,t))||t),a.nodeType==1){let u=a.getAttribute("data-path-scope");if(u){let h=re(a),c=X(t,u,!1)||[];h==0&&Ie(a,((s=r==null?void 0:r.shouldRepeat)===null||s===void 0?void 0:s.call(r,a,c))===!1?1:c.length,r),t={...t,[ht(u)]:c[h]}}let m=Array.prototype.slice.call(a.attributes).sort((h,c)=>ee.indexOf(h.name)-ee.indexOf(c.name));for(var l=0;l<m.length;l++){let{name:h,value:c}=m[l];h.startsWith("data-path")&&h!="data-path-scope"&&$(a,h,X(t,c,!0),r),h=="data-embed-src"&&$(a,h,a.getAttribute(h),r)}}for(var l=0,d;d=a.childNodes[l++];)ie(d)&&R(d,t,r,!0);return i||(o=r==null?void 0:r.onRender)===null||o===void 0||o.call(r,a,t),a}function ie(e){return e.nodeType==1}function U(e,t,r,i){var n;let s=((n=i==null?void 0:i.processTemplate)===null||n===void 0?void 0:n.call(i,e,t,r))||t;if(e.innerHTML=s,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(var a=0,l;l=e.childNodes[a++];)ie(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return R(e,r,i)}function ne(e,t,r,i=!1){var n;let s=((n=r==null?void 0:r.processTemplate)===null||n===void 0?void 0:n.call(r,null,e,t))||e;if(typeof document=="undefined"||i){let o=ut(s);return R(o[0],t,r).outerHTML}else{let o=document.createElement("div");return o.innerHTML=s,R(o,t,r),o.innerHTML}}var oe=["initial","check","updated"],Q={};function We(){Q={}}async function tt(e,t,r,i,n=Q){return F({url:e,options:t,validator:r,callback:i,cache:n}).then(et).then(s=>s.response)}function se(e,t=!1){let r=String(e).replace("?head","");var i=Q[r];return!i&&!t&&(i=Q[r]={phase:null,initial:S(),check:S(),updated:S(),final:S()}),i}var mt=class extends Error{};async function F({url:e,options:t,validator:r,callback:i,cache:n},s="initial"){let o=new Date;if(n!=null){var a=se(e);if(oe.indexOf(a.phase)>=oe.indexOf(s))var l=a[s];else a.phase=s}let d=await(l||fetch(e,t));if(!l&&a&&(d.ok?a[s].resolve(d):a[s].reject(new Error("Fetch failed"))),!d.ok)throw new Error("Fetch failed");let u=new Date(d.headers.get("date"))<o||l&&s=="initial"&&(a.phase=="updated"||a.phase=="check");if((r==null?void 0:r(d,u))===!1)throw new mt("Response is not valid");return await(i==null?void 0:i(d,s,u)),{url:e,options:t,isCached:u,response:d,validator:r,callback:i,cache:n}}async function et(e){let{url:t,isCached:r,options:i,validator:n,response:s,cache:o}=e;if(r){let{response:a}=await F({url:t+"?head",options:{...i,method:"HEAD",cache:"no-cache"},validator:n,cache:o},"check");if(a.headers.get("last-modified")!=s.headers.get("last-modified"))return gt(e)}return e}async function gt(e){return F({...e,options:{...e.options,cache:"reload"}},"updated")}var _="https://feaas.blob.core.windows.net";function j(e){let t=e.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(t){var[,r,i,n,s,o]=t;return{cdn:r,library:i,component:n,version:s,revision:o}}}function He(e){if(!e||!e.library||!e.component)throw new Error("Component requires `library` and `component` properties");return`${e.cdn&&e.cdn!=_?`${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 Be(e){return`${e.cdn&&e.cdn!=_?`${e.cdn}/styles/`:""}${e.library}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function vt(e){let t=e.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(t){var[,r,i,n]=t;return{cdn:r,library:i,revision:n}}else{let s=j(e);if(s){var{cdn:r,library:i,revision:n}=s;return n!=null&&n.match(/\d/)&&(n=void 0),{cdn:r,library:i,revision:n}}}}function rt(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...j(e.src)}),`${e.cdn||e.hostname||_}/components/${e.library}/${e.component}/${e.version}/${e.revision||"published"}.html`}function I(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...vt(e.src)}),`${e.cdn||e.hostname||_}/styles/${e.library}/${e.revision||"published"}.css`}async function z(e,t,r=!1){let i=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,n=a=>a.clone().text().then(t),s=await Promise.all([e.instance&&F({options:{headers:{Accept:"text/html"},credentials:"omit"},url:rt({...e,version:e.instance}),validator:i}).catch(a=>a),F({url:rt(e),validator:i}).catch(a=>a)]),o=s.find(a=>a&&"isCached"in a&&a);if(!o||o instanceof Error)throw s.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return s[0]==o&&console.log("Using fork!",s),await n(o.response),r?o:et({...o,callback:n}).catch(a=>{if(s[0]==o&&(gt({...o,callback:null,validator:null}),console.log("Fork was deleted"),!(s[1]instanceof Error)))return n(s[1].response),et({...s[1],callback:n});throw a})}async function Ot(e){typeof e=="string"&&(e={src:e});var t;let{response:r}=await z(e,i=>{t=i},!0);return{...e,template:t,lastModified:r.headers.get("last-modified")}}async function bt(e,t){return typeof e=="string"&&(e={src:e}),tt(I(e),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,i)=>r.clone().text().then(n=>t(n,i)))}function ze(e,t){return ae(e,t||(t=document.createElement("style"))),t}function ae(e,t){return t||(t=document.createElement("style")),bt(e,(r,i)=>{t.textContent=r}).then(()=>t)}function yt(e,t){var r=le(e);if(!r)var i=de(e);return bt(e,(n,s)=>{i&&(i.textContent=n),t==null||t(n,s)}).then(()=>r||i)}function Mt(e){return new Promise((t,r)=>{yt(e,t).catch(r)})}function le(e){return document.head.querySelector(`style[data-href="${I(e)}"]`)}function de(e){let t=I(e),r=document.createElement("style");return r.setAttribute("data-href",t),document.head.appendChild(r),r}function Ve(e,t){let r=document.createElement("div");r.innerHTML=e;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return R(i,t),r}function Lt(e,t){return ce(e,t||(t=document.createElement("div"))),t}async function ce(e,t){return t||(t=document.createElement("div")),t.childNodes.length?R(t,e.data,e):"template"in e?U(t,e.template,e.data,e):z(e,r=>U(t,r,e.data,e)).then(()=>t)}function Je(e){let{params:t,method:r,headers:i,body:n,url:s}=E(e);var o={url:s},a={...i};return i["Content-Type"]==="application/json"&&delete a["Content-Type"],i.Accept==="application/json"&&delete a.Accept,Object.keys(a).length>0&&(o.headers=a),r!=="GET"&&(o.method=r),r==="GET"||r==="HEAD"||Object.keys(n).length===0||(o.body=n),Object.keys(t).length>0&&(o={...o,params:t}),o}var At=e=>{if(typeof e.url!="string")return!1;for(var t in e)if(!(t=="body"||t=="params"||t=="headers"||t=="url"||t==="method"||t=="jsonpath"&&typeof e[t]=="string"))return!1;return!0};function ue(e){let{url:t,headers:r,params:i,method:n,body:s}=E(e),o,a=r["Content-Type"];n!="GET"&&n!="HEAD"&&(a==="application/json"&&(o=JSON.stringify(s)),a==="multipart/form-data"&&(o=Object.keys(s).reduce((d,u)=>(d.append(u,s[u]),d),new FormData)),a==="application/x-www-form-urlencoded"&&(o=new URLSearchParams(s)));let l=Object.keys(i).length?`?${new URLSearchParams(i)}`:"";return[`${t}${l}`,{headers:r,body:o,method:n}]}function E(e){let t={};for(let r in(e==null?void 0:e.headers)||{})if(e.headers.hasOwnProperty(r)){let i=r.replace(/^[a-z]|\-[a-z]/g,n=>n.toUpperCase());t[i]=e.headers[r]}return t.Accept||(t.Accept="application/json"),{params:(e==null?void 0:e.params)||{},headers:t,jsonpath:String((e==null?void 0:e.jsonpath)||"$"),method:((e==null?void 0:e.method)||"GET").toUpperCase(),body:(e==null?void 0:e.body)||{},url:String((e==null?void 0:e.url)||"")}}var Dt=async e=>{try{let[t,r]=ue(e),n=await(await E.fetchImplementation(t,{...r,method:r.method.toLowerCase()})).json();return e.jsonpath&&e.jsonpath!="$"?dt(n,e.jsonpath):n}catch(t){return{}}};async function $t(e){if(!e)return e;if(At(e))return Dt(e);let t=Object.keys(e),r=await Promise.all(t.map(i=>At(e[i])?Dt(e[i]):null).filter(Boolean));return t.reduce((i,n)=>({...i,[n]:At(e[n])?r.shift():e[n]}),{})}E.clean=Je;E.toFetchArguments=ue;E.fetchOne=Dt;E.fetch=$t;E.isDataSettings=At;E.fetchImplementation=(...e)=>fetch(...e);function he(e){var t,r,i,n,s,o,a,l;let d,u=e.getAttribute("src");if(u){let b=j(u);if(!b)throw new Error(`Could not parse FEAAS Component source: ${u}`);var{cdn:m,library:h,component:c,version:f,revision:w}=b}let C=e.getAttribute("data");if(C!=null&&C!="")try{d=typeof C=="string"?JSON.parse(C):{}}catch(b){console.error(b)}return{data:d||{},cdn:(r=(t=e.getContextAttribute("cdn"))!==null&&t!==void 0?t:m)!==null&&r!==void 0?r:_,library:(i=e.getAttribute("library"))!==null&&i!==void 0?i:h,component:(n=e.getAttribute("component"))!==null&&n!==void 0?n:c,version:(o=(s=e.getAttribute("version"))!==null&&s!==void 0?s:f)!==null&&o!==void 0?o:"responsive",revision:(l=(a=e.getAttribute("revision"))!==null&&a!==void 0?a:w)!==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 it=class extends y{setData(t){this.set({data:t})}getProps(){return he(this)}isJSONAttribute(t){return t=="data"}attributeChangedCallback(t,r,i){r!==i&&((t=="library"||t=="component"||t=="revision"||t=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(t,r,i),t==="data"&&this.fetchData())}async fetchData(){this.readyData=void 0,this.whenDataReady=this.whenDataReady.restart();let t=await E.fetch(this.props.data),r=this.alreadyRendered;await this.whenDataReady.resolve(t),r&&this.advance()}getEditor(){var t;return(t=document.querySelector("feaas-context"))===null||t===void 0?void 0:t.refs.editor}constructor(){super(),this.readyData={},this.whenDataReady=S(t=>this.readyData=t,t=>this.onError(t)),this.defaultProps={cdn:_,revision:"published",version:"responsive",withStylesheet:!0,editable:!1,suspended:!1,data:{}},this.onLoad=t=>{this.payload=t,this.advance()},this.getAttribute("data")||this.whenDataReady.resolve({}),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 i=r;return i}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(this.getOriginal())return;let t=()=>{this.payload&&(r||this.readyData&&this.onLoad(this.payload))};if(this.props.withStylesheet)var r=Mt({...this.props,revision:"published"}).then(()=>{r=null,t()});return Promise.all([r,this.whenDataReady.then(()=>t()),z(this.props,i=>{this.payload=i,t()})]).then(()=>this.payload)}flush(){this.readyData&&super.flush()}update(){if(this.alreadyRendered=!0,Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)R(this,this.readyData);else{if(this.needsRefresh=!0,this.getOriginal())return;U(this,this.payload,this.readyData)}}};it.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];it.register("feaas-component");function pe(e){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 nt=class extends y{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return pe(this)}attributeChangedCallback(t,r,i){if(r!==i)return t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,i)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
|
|
1
|
+
var Le=Object.defineProperty;var X=(e,t)=>{for(var r in t)Le(e,r,{get:t[r],enumerable:!0})};var jt={};X(jt,{Component:()=>nt,ComponentProps:()=>he,Context:()=>W,ControlledPromise:()=>S,DEFAULT_CDN_URL:()=>_,DOM:()=>ft,DataPath:()=>pt,DataScope:()=>ct,DataSettings:()=>E,Element:()=>A,FEAASComponent:()=>nt,FEAASComponentsProps:()=>he,FEAASContext:()=>W,FEAASContextProps:()=>Ee,FEAASEditor:()=>st,FEAASEditorProps:()=>we,FEAASElement:()=>A,FEAASLoader:()=>ot,FEAASLoaderProps:()=>pe,FEAASPicker:()=>at,FEAASPickerProps:()=>Ce,FEAASStylesheet:()=>wt,FEAASStylesheetProps:()=>fe,InvalidResponse:()=>mt,JSONPath:()=>m,Loader:()=>ot,MyComponent:()=>dt,Picker:()=>at,Stylesheet:()=>wt,Thumbnail:()=>Ct,adjustNumbers:()=>Zt,autoloadScripts:()=>Kt,cleanCollectionBit:()=>Q,clearFetchCache:()=>We,createStylesheet:()=>de,fetchAndRevalidate:()=>et,fetchAndRevalidateComponent:()=>V,fetchAndRevalidateStylesheet:()=>bt,fetchBypassingCache:()=>gt,fetchCache:()=>tt,fetchComponent:()=>Ot,fetchData:()=>$t,fetchToValidateCache:()=>rt,fetchWithCacheAwareness:()=>F,findStylesheet:()=>le,getComponentSource:()=>He,getComponentURL:()=>it,getFetchCache:()=>se,getFramePosition:()=>Ae,getHumanizedLabel:()=>Qt,getLastPathBit:()=>te,getQualifier:()=>Yt,getStylesheetSource:()=>Be,getStylesheetURL:()=>I,loadScript:()=>Z,loadStylesheet:()=>yt,loadStylesheetAllowStale:()=>Mt,normalizeCollectionScope:()=>ht,observeDOMElement:()=>qt,parseComponentSource:()=>j,parseLimit:()=>Gt,parseRange:()=>Xt,parseStylesheetSource:()=>vt,queryObject:()=>z,queryScopes:()=>Y,renderComponent:()=>Lt,renderComponentElement:()=>Ve,renderComponentPromise:()=>ce,renderDOMContent:()=>U,renderDOMElement:()=>R,renderHTMLContent:()=>ne,renderStylesheet:()=>ze,renderStylesheetPromise:()=>ae,serializeCH1RichText:()=>L,setDOMAttribute:()=>$});function S(e,t=r=>{}){var r;let i=()=>{var n,s;let o=new Promise((l,d)=>{n=u=>{e==null||e(u),l(u)},s=d});var a=Object.assign(o,{resolve:n,reject:s,restart:i,first:r});return r=a,a.catch(t),a};return i()}var De=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,A=class extends De{getProps(t){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=S(t=>{this.payload=t}),this.whenRendered=S(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(t,r,i){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.dispatchEventIndirectly(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var i;return(i=r.mount)===null||i===void 0?void 0:i.call(r)}),this.set()}catch(t){this.onError(t)}}dispatchEventIndirectly(t){this.dispatchEvent(t);let r=this.getParent();r&&!r.contains(this)&&(Object.defineProperty(t,"target",{value:this,writable:!1}),Object.defineProperty(t,"composedPath",{value:()=>[this],writable:!1}),r.handleEvent(t))}isJSONAttribute(t){return!1}log(...t){if(typeof process!="undefined"&&process.env.TESTING)return;let r=t[0];console.log(r+" "+t.slice(1).map(i=>i&&typeof i=="object"?"%O":"%s").join(" "),...t.slice(1))}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEventIndirectly(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;if(this.tagName!="FEAAS-CONTEXT")return document.querySelector("feaas-context")}getElements(t=this.getRoot(),r=!0){return Array.from(t.querySelectorAll("*")).map(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.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,i;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 s=t.refs.parent;s;s=s.refs.parent)s.render&&((i=t.refs).parentReact||(i.parentReact=s),t.refs.topReact=s)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(t,r="uncaught",i=!1){let n=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:t});if(this.dispatchEventIndirectly(n),this.whenLoaded.reject(t),!n.defaultPrevented&&!i){this.whenRendered.reject(t);try{this.unmount()}catch(s){}return!0}return!1}shouldUpdateOnLoad(){return!0}async advance(){try{if(this.payload===void 0){if(!this.isReadyToLoad())return;this.payload=null,this.dispatchEventIndirectly(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;if(!this.connected)return;let i=(r=(t=this.payload)===null||t===void 0?void 0:t.ReactDOM)===null||r===void 0?void 0:r.flushSync;i?i(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var t,r,i;if(this.payload==null||!this.render)return;let{React:n,ReactDOM:s,ReactDOMClient:o}=this.payload||{};if(!n)throw new Error(`${this.tagName}: React is not present in payload`);if(!s)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?o?(this.reactRoot||(this.reactRoot=o.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):s.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact?(t=this.forceUpdateReact)===null||t===void 0||t.call(this):(i=(r=this.refs.topReact).forceUpdateReact)===null||i===void 0||i.call(r)}invokeReactRendering(){let{React:t,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let i=this.descendants.filter(n=>n.refs.parentReact==this&&n.payload).map((n,s)=>this.getReactElement(n));return this.render({...this.props,children:i},this.payload)}getReactErrorBoundary(t=this,r=t.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:i,ReactDOM:n}=t.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends i.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(o){return{error:o}}componentDidCatch(o,a){console.error(`FEAAS: ${t.tagName} Error:`,o,a),t.onError(o,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(t=this,r){let{React:i,ReactDOM:n}=t.payload||{},s=this.getReactErrorBoundary(),o=this.getReactWrapper(t);return i.createElement(s,{key:t.tagName+"-"+t.getUID(),slot:t.getAttribute("slot")},i.createElement(o,null))}getReactWrapper(t=this,r=t.tagName){if(t.reactWrapper)return t.reactWrapper;let{React:i,ReactDOM:n}=t.payload||{};return t.reactWrapper=s=>{if(t.render){let[o,a]=i.useReducer(l=>l+1,0);return t.forceUpdateReact=a,n.createPortal(i.createElement(i.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.isJSONAttribute(r),s=this.props[r],o=n?JSON.stringify(s):String(s),a=this.defaultProps[r],l=n?JSON.stringify(a):String(a),d=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),u=this.getAttribute(d);try{var i=n?JSON.stringify(JSON.parse(u)):u}catch(f){var i=null}s==null||o===l?this.removeAttribute(d):(typeof s=="string"||typeof s=="number"||typeof s=="boolean"||n)&&i!=o&&this.setAttribute(d,o)}}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 i=this;i=i.parentElement||(i.parentNode instanceof ShadowRoot?i.parentNode.host:null);)if(i.getAttribute(t)!=null)return i.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 B=class extends A{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)}},dt=class extends B{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:t},{React:r}){let[i,n]=r.useState(0);return r.useEffect(()=>{n(s=>s+1)},[t]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",t),r.createElement("p",null,"Triggered updates: ",i))}};dt.observedAttributes=["counter"];var ft={};X(ft,{renderDOMContent:()=>U,renderDOMElement:()=>R,renderHTMLContent:()=>ne,setDOMAttribute:()=>$});var ct={};X(ct,{JSONPath:()=>m,queryObject:()=>z,queryScopes:()=>Y,serializeCH1RichText:()=>L});import $e from"vm";var{hasOwnProperty:x}=Object.prototype;function M(e,t){return e=e.slice(),e.push(t),e}function kt(e,t){return t=t.slice(),t.unshift(e),t}var Nt=class extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}};function m(e,t,r,i,n){if(!(this instanceof m))try{return new m(e,t,r,i,n)}catch(o){if(!o.avoidNew)throw o;return o.value}typeof e=="string"&&(n=i,i=r,r=t,t=e,e=null);let s=e&&typeof 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=x.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||i||null,this.otherTypeCallback=e.otherTypeCallback||n||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){let o={path:s?e.path:t};s?"json"in e&&(o.json=e.json):o.json=r;let a=this.evaluate(o);if(!a||typeof a!="object")throw new Nt(a);return a}}m.prototype.evaluate=function(e,t,r,i){let n=this.parent,s=this.parentProperty,{flatten:o,wrap:a}=this;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=i||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&typeof 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(!x.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),o=x.call(e,"flatten")?e.flatten:o,this.currResultType=x.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=x.call(e,"sandbox")?e.sandbox:this.currSandbox,a=x.call(e,"wrap")?e.wrap:a,this.currPreventEval=x.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=x.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=x.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,n=x.call(e,"parent")?e.parent:n,s=x.call(e,"parentProperty")?e.parentProperty:s,e=e.path}if(n=n||null,s=s||null,Array.isArray(e)&&(e=m.toPathString(e)),!e&&e!==""||!t)return;let l=m.toPathArray(e);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;let d=this._trace(l,t,["$"],n,s,r).filter(function(u){return u&&!u.isParentSelector});return d.length?!a&&d.length===1&&!d[0].hasArrExpr?this._getPreferredOutput(d[0]):d.reduce((u,f)=>{let h=this._getPreferredOutput(f);return o&&Array.isArray(h)?u=u.concat(h):u.push(h),u},[]):a?[]:void 0};m.prototype._getPreferredOutput=function(e){let t=this.currResultType;switch(t){case"all":{let r=Array.isArray(e.path)?e.path:m.toPathArray(e.path);return e.pointer=m.toPointer(r),e.path=typeof e.path=="string"?e.path:m.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return m.toPathString(e[t]);case"pointer":return m.toPointer(e.path);default:throw new TypeError("Unknown result type")}};m.prototype._handleCallback=function(e,t,r){if(t){let i=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:m.toPathString(e.path),t(i,r,e)}};m.prototype._trace=function(e,t,r,i,n,s,o,a){let l;if(!e.length)return l={path:r,value:t,parent:i,parentProperty:n,hasArrExpr:o},this._handleCallback(l,s,"value"),l;let d=e[0],u=e.slice(1),f=[];function h(c){Array.isArray(c)?c.forEach(p=>{f.push(p)}):f.push(c)}if((typeof d!="string"||a)&&t&&x.call(t,d))h(this._trace(u,t[d],M(r,d),t,d,s,o));else if(d==="*")this._walk(t,c=>{h(this._trace(u,t[c],M(r,c),t,c,s,!0,!0))});else if(d==="..")h(this._trace(u,t,r,i,n,s,o)),this._walk(t,c=>{typeof t[c]=="object"&&h(this._trace(e.slice(),t[c],M(r,c),t,c,s,!0))});else{if(d==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:u,isParentSelector:!0};if(d==="~")return l={path:M(r,d),value:n,parent:i,parentProperty:null},this._handleCallback(l,s,"property"),l;if(d==="$")h(this._trace(u,t,r,null,null,s,o));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(d))h(this._slice(d,u,t,r,i,n,s));else if(d.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let c=d.replace(/^\?\((.*?)\)$/u,"$1");this._walk(t,p=>{this._eval(c,t[p],p,r,i,n)&&h(this._trace(u,t[p],M(r,p),t,p,s,!0))})}else if(d[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");h(this._trace(kt(this._eval(d,t,r[r.length-1],r.slice(0,-1),i,n),u),t,r,i,n,s,o))}else if(d[0]==="@"){let c=!1,p=d.slice(1,-2);switch(p){case"scalar":(!t||!["object","function"].includes(typeof t))&&(c=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===p&&(c=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(c=!0);break;case"number":Number.isFinite(t)&&(c=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(c=!0);break;case"object":t&&typeof t===p&&(c=!0);break;case"array":Array.isArray(t)&&(c=!0);break;case"other":c=this.currOtherTypeCallback(t,r,i,n);break;case"null":t===null&&(c=!0);break;default:throw new TypeError("Unknown value type "+p)}if(c)return l={path:r,value:t,parent:i,parentProperty:n},this._handleCallback(l,s,"value"),l}else if(d[0]==="`"&&t&&x.call(t,d.slice(1))){let c=d.slice(1);h(this._trace(u,t[c],M(r,c),t,c,s,o,!0))}else if(d.includes(",")){let c=d.split(",");for(let p of c)h(this._trace(kt(p,u),t,r,i,n,s,!0))}else!a&&t&&x.call(t,d)&&h(this._trace(u,t[d],M(r,d),t,d,s,o,!0))}if(this._hasParentSelector)for(let c=0;c<f.length;c++){let p=f[c];if(p&&p.isParentSelector){let b=this._trace(p.expr,t,p.path,i,n,s,o);if(Array.isArray(b)){f[c]=b[0];let C=b.length;for(let y=1;y<C;y++)c++,f.splice(c,0,b[y])}else f[c]=b}}return f};m.prototype._walk=function(e,t){if(Array.isArray(e)){let r=e.length;for(let i=0;i<r;i++)t(i)}else e&&typeof e=="object"&&Object.keys(e).forEach(r=>{t(r)})};m.prototype._slice=function(e,t,r,i,n,s,o){if(!Array.isArray(r))return;let a=r.length,l=e.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);let h=[];for(let c=u;c<f;c+=d)this._trace(kt(c,t),r,i,n,s,o,!0).forEach(b=>{h.push(b)});return h};m.prototype._eval=function(e,t,r,i,n,s){this.currSandbox._$_parentProperty=s,this.currSandbox._$_parent=n,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;let o=e.includes("@path");o&&(this.currSandbox._$_path=m.toPathString(i.concat([r])));let a="script:"+e;if(!m.cache[a]){let l=e.replace(/@parentProperty/gu,"_$_parentProperty").replace(/@parent/gu,"_$_parent").replace(/@property/gu,"_$_property").replace(/@root/gu,"_$_root").replace(/@([.\s)[])/gu,"_$_v$1");o&&(l=l.replace(/@path/gu,"_$_path")),m.cache[a]=new this.vm.Script(l)}try{return m.cache[a].runInNewContext(this.currSandbox)}catch(l){throw new Error("jsonPath: "+l.message+": "+e)}};m.cache={};m.toPathString=function(e){let t=e,r=t.length,i="$";for(let n=1;n<r;n++)/^(~|\^|@.*?\(\))$/u.test(t[n])||(i+=/^[0-9*]+$/u.test(t[n])?"["+t[n]+"]":"['"+t[n]+"']");return i};m.toPointer=function(e){let t=e,r=t.length,i="";for(let n=1;n<r;n++)/^(~|\^|@.*?\(\))$/u.test(t[n])||(i+="/"+t[n].toString().replace(/~/gu,"~0").replace(/\//gu,"~1"));return i};m.toPathArray=function(e){let{cache:t}=m;if(t[e])return t[e].concat();let r=[],n=e.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replace(/[['](\??\(.*?\))[\]']/gu,function(s,o){return"[#"+(r.push(o)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(s,o){return"['"+o.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(s,o){return";"+o.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"").split(";").map(function(s){let o=s.match(/#(\d+)/u);return!o||!o[1]?s:r[o[1]]});return t[e]=n,t[e].concat()};m.prototype.vm=$e;function z(e,t){var r;return((r=m({path:t,json:e}))===null||r===void 0?void 0:r.flat(1/0))||[]}function Y(e,t,r=!1,i=e){var n=t;let s=Object.keys(e).sort((a,l)=>l.length-a.length);for(let a of s)if(t.startsWith(a)){if(a==t){if(r)return e[a];continue}n=t.substring(a.length+1),i=e[a];break}var o=z(i,n);return Array.isArray(o)&&(o==null?void 0:o.length)==0&&(o=[n.replace(/^.*?\./,"_."),n.replace(/^.*?\./,""),n.replace(/^([^.]+).*?\.\$\./,"$1."),n.replace(/^.*?\.\$\./,"_."),n.replace(/^.*?\.\$\./,""),n.replace(/^[^.]+$/,"_")].filter((a,l,d)=>d.indexOf(a)===l).reduce((a,l)=>a.length>0?a:z(i,l),[])),r&&Array.isArray(o)?o[0]:o}function Tt(e,t={},r){return r?`<${r}${Object.entries(t).map(([i,n])=>n!=null&&` ${i}="${n}"`).filter(Boolean).join("")}>${L(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):L(e)}function L(e){var t;if(Array.isArray(e))return e.map(L).join(`
|
|
2
|
+
`).trim();if(typeof e=="string")return e;if(e==null)return"";switch(e.type){case"heading":let{level:r,...i}=e.attrs;return Tt(e.content,i,"h"+r);case"text":return(e.marks||[]).reduce((n,s)=>Tt(n,s.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[s.type]),(t=e.text)===null||t===void 0?void 0:t.replace(/\s+/," "));default:return Tt(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}var D=class{constructor(t,r=1,i){this.ownerDocument={createElement(n){return new D(n)}},this.nodeName=t,this.nodeType=r,this.textContent=i,this.attributes=[],this.childNodes=[]}setAttribute(t,r){let i=this.attributes.find(n=>n.name===t);i?i.value=r:this.attributes.push({name:t,value:r})}getAttribute(t){let r=this.attributes.find(i=>i.name===t);return r?r.value:void 0}insertBefore(t,r){if(t.parentNode=this,r===null)this.childNodes.push(t);else{let i=this.childNodes.indexOf(r);i!==-1&&this.childNodes.splice(i,0,t)}}removeAttribute(t){let r=this.attributes.findIndex(i=>i.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 localName(){var t;return(t=this.nodeName)===null||t===void 0?void 0:t.toLowerCase()}get innerHTML(){return _t(this.childNodes)}set innerHTML(t){this.childNodes=ut(String(t!=null?t:""))}get outerHTML(){return _t([this])}get children(){return this.childNodes.filter(t=>t.nodeType==1)}closest(t){let r=this;for(;r;){if(Jt(t,r))return r;r=r.parentNode}return null}querySelectorAll(t){let r=t.split(/\s*,\s*/),i=[],n=s=>{for(let o of r)if(Jt(o,s)){i.push(s);break}for(let o of s.childNodes)n(o)};for(let s of this.childNodes)n(s);return i}querySelector(t){return this.querySelectorAll(t)[0]}findSibling(t,r){if(!this.parentNode)return null;let i=this.parentNode.childNodes,n=i.indexOf(this);if(n===-1)return null;for(let s=n+t;s>=0&&s<i.length;s+=t){let o=i[s];if(!r||o.nodeType===1)return o}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 D(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),t)for(let i of this.childNodes){let n=i.cloneNode(!0);r.appendChild(n)}return r}get parentElement(){var t;return((t=this.parentNode)===null||t===void 0?void 0:t.nodeType)==1?this.parentNode:null}};function Jt(e,t){let r=e.match(/([.#]?[\w-]+|\[([\w-]+)(="([^"]*)")?\])/g);if(!r)return!1;for(let i of r)if(i.startsWith("#")){if(t.getAttribute("id")!==i.slice(1))return!1}else if(i.startsWith(".")){if(!(t.getAttribute("class")||"").split(" ").includes(i.slice(1)))return!1}else if(i.startsWith("[")){let n=i.match(/^\[([\w-]+)(="([^"]*)")?\]$/);if(n){let s=n[1],o=n[3],a=t.getAttribute(s);if(typeof o=="undefined"){if(a===void 0)return!1}else if(a!==o)return!1}else return!1}else if(t.nodeName!==i)return!1;return!0}function ut(e){var t;let r=[],i=[];for(;e;){let n=e.match(/^<([\w-]+)(\s[^>]*)?>/),s=e.match(/^<\/([\w-]+)>/);if(n){let o=n[1],l=((t=(n[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||t===void 0?void 0:t.map(u=>{let[f,h,,c]=u.match(/([\w-]+)(="([^"]*)")?/);return{name:h,value:Fe(c||"")}}))||[],d=new D(o,1);if(d.attributes=l,i.length>0){let u=i[i.length-1];u.childNodes.push(d),d.parentNode=u}else r.push(d);i.push(d),e=e.slice(n[0].length)}else if(s)i.pop(),e=e.slice(s[0].length);else{let o=e.indexOf("<"),a=e.slice(0,o!==-1?o:void 0),l=new D("#text",3);if(l.textContent=a,i.length>0){let d=i[i.length-1];d.childNodes.push(l),l.parentNode=d}else r.push(l);e=e.slice(a.length)}}return r}function Ue(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Fe(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}function _t(e){return e.map(t=>{if(t.nodeType===3)return t.textContent||"";let{nodeName:r,attributes:i}=t,n=i.map(({name:o,value:a})=>` ${o}="${Ue(String(a))}"`).join(""),s=_t(t.childNodes);return["img","input","br"].includes(r)?`<${r}${n} />`:`<${r}${n}>${s}</${r}>`}).join("")}function je(e,t,r){return Pt(e,t,r)[0].outerHTML}function Pt(e,t,r){var i;let n=((i=r==null?void 0:r.processTemplate)===null||i===void 0?void 0:i.call(r,null,e,t))||e;return ut(n).map(o=>R(o,t,r))}function qt(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let n=i.target,s=n.getAttribute("data-embed-src");s&&Z(n,s),i.addedNodes&&i.addedNodes.forEach(o=>{o.nodeType==1&&Kt(o,!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 i=0;i<r.length;i++){let n=r[i];Z(n,n.getAttribute("data-embed-src"))}if(t)return qt(e)}function Z(e,t){for(var r=e;r;r=r.parentElement)if(!r.parentElement){let n=r.querySelectorAll("script");for(var i=0;i<n.length;i++)if(n[i].getAttribute("src")==t)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let s=r.ownerDocument.createElement("script");s.setAttribute("type","module"),s.setAttribute("src",t),r.appendChild(s);break}}var pt={};X(pt,{adjustNumbers:()=>Zt,cleanCollectionBit:()=>Q,getHumanizedLabel:()=>Qt,getLastPathBit:()=>te,getQualifier:()=>Yt,normalizeCollectionScope:()=>ht,parseLimit:()=>Gt,parseRange:()=>Xt});var Gt=e=>{var t;let r=parseInt((t=e==null?void 0:e.match(/\[0:(\d+)\]/))===null||t===void 0?void 0:t[1],10);return!isNaN(r)&&r>0?String(r):null},Xt=e=>{var t;let r=(t=e==null?void 0:e.match(/\[([^\]]+)\]/))===null||t===void 0?void 0:t[1].split(/\s*,\s*/g).filter(Boolean).map(i=>{if(i.match(/^-?\d+$/))return i;let n=i.match(/^(\d+):(\d+)$/);return n&&parseInt(n[1],10)<parseInt(n[2],10)?n[1]+"-"+n[2]:null});return r!=null&&r.every(Boolean)?r.join(","):null},Yt=e=>{var t;return(t=e==null?void 0:e.match(/(\.\*|\[[^\]]*\])$/))===null||t===void 0?void 0:t[0]};function Q(e){return e.replace(/(\.?\[[^\]\[]*\]|\.\*)$/g,"")}function ht(e){return Q(e)+".*"}function Zt(e,t){return e==null?void 0:e.replace(/(.|^)(\d+)/g,(r,i,n)=>i+(i==":"?n:String(parseInt(n)+t)))}function Qt(e,t=2){var r=Q(e).split(/]\.|\.\*\./g).pop().split(/\./g).slice(-3);return r=r.filter(i=>isNaN(parseInt(i))),r.map(i=>i.charAt(0).toUpperCase()+i.slice(1)).slice(-t).join(" ")}function te(e){return Q(e).split(".").pop()}function re(e){let t=e.getAttribute("data-path-scope");for(var r=0,i=e;i=i.previousElementSibling;)i.getAttribute("data-path-scope")==t&&r++;return r}function Ie(e,t,r){let i=e.getAttribute("data-path-scope");if(i==null)return;var n=re(e);if(n!=0)return;let s=e.parentNode;if(s!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var o=n+1,a=e,l=e;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==i&&(o++,a=l);for(var d=o;d<t;d++)s.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var d=Math.max(1,t);d<o;d++)a=a.previousElementSibling,s.removeChild(a.nextElementSibling)}}function $(e,t,r,i){var n,s;if(e){var o=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=L(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(e,t,r));var a=t.replace("data-path-","");if(t=="data-path-src"){let p=Array.from(e.children).find(b=>b.localName=="picture")||e;o=e.localName=="img"?e:p.querySelector("img, video")}else if(t=="data-path-href")o=e.querySelector("a")||e.closest("a");else if(t=="data-path-alt")o=(Array.from(e.children).find(b=>b.localName=="picture")||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")a="innerHTML";else if(t=="data-embed-src")Z(e,r);else if(t=="data-path-attributes"){let p=((n=e.getAttribute("data-attributes-keys"))===null||n===void 0?void 0:n.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var l in r){var d=r[l];$(e,l,typeof d=="object"&&d?JSON.stringify(d):d,i)}for(var u=0;u<p.length;u++)(r==null||!(p[u]in r))&&$(e,p[u],null,i);$(e,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var f=String((s=e.getAttribute("data-path-placeholder")||o[a])!==null&&s!==void 0?s:o.getAttribute(a));if(r!=null)if(a=="innerHTML"){for(var h=String(r),c=o;c.parentElement&&c.localName.match(/^(a|var|strong|em|i|b)$/);)c=c.parentElement;c.localName.match(/p|h\d|button|li/)&&(h=h.replace(/<(p|h\d|li|ul)[^>]*?>|<\/(p|h\d|li|ul)[^>]*?>/g," ").trim().replace(/\s+/g," ")),o.innerHTML!=h&&(o.innerHTML=h)}else o.getAttribute(a)!=r&&o.setAttribute(a,r);else a=="innerHTML"?o.innerHTML=f:o.removeAttribute(a)}}}var ee=["data-attributes-keys","data-path-attributes","data-path-scope"];function R(e,t,r,i){var n,s,o;let a=e;if(i||(t=((n=r==null?void 0:r.processData)===null||n===void 0?void 0:n.call(r,a,t))||t),a.nodeType==1){let u=a.getAttribute("data-path-scope");if(u){let h=re(a),c=Y(t,u,!1);h==0&&Ie(a,((s=r==null?void 0:r.shouldRepeat)===null||s===void 0?void 0:s.call(r,a,c))===!1?1:c.length,r),t={...t,[ht(u)]:c[h]}}let f=Array.prototype.slice.call(a.attributes).sort((h,c)=>ee.indexOf(h.name)-ee.indexOf(c.name));for(var l=0;l<f.length;l++){let{name:h,value:c}=f[l];h.startsWith("data-path")&&h!="data-path-scope"&&$(a,h,Y(t,c,!0),r),h=="data-embed-src"&&$(a,h,a.getAttribute(h),r)}}for(var l=0,d;d=a.childNodes[l++];)ie(d)&&R(d,t,r,!0);return i||(o=r==null?void 0:r.onRender)===null||o===void 0||o.call(r,a,t),a}function ie(e){return e.nodeType==1}function U(e,t,r,i){var n;let s=((n=i==null?void 0:i.processTemplate)===null||n===void 0?void 0:n.call(i,e,t,r))||t;if(e.innerHTML=s,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(var a=0,l;l=e.childNodes[a++];)ie(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return R(e,r,i)}function ne(e,t,r,i=!1){var n;let s=((n=r==null?void 0:r.processTemplate)===null||n===void 0?void 0:n.call(r,null,e,t))||e;if(typeof document=="undefined"||i){let o=ut(s);return R(o[0],t,r).outerHTML}else{let o=document.createElement("div");return o.innerHTML=s,R(o,t,r),o.innerHTML}}var oe=["initial","check","updated"],tt={};function We(){tt={}}async function et(e,t,r,i,n=tt){return F({url:e,options:t,validator:r,callback:i,cache:n}).then(rt).then(s=>s.response)}function se(e,t=!1){let r=String(e).replace("?head","");var i=tt[r];return!i&&!t&&(i=tt[r]={phase:null,initial:S(),check:S(),updated:S(),final:S()}),i}var mt=class extends Error{};async function F({url:e,options:t,validator:r,callback:i,cache:n},s="initial"){let o=new Date;if(n!=null){var a=se(e);if(oe.indexOf(a.phase)>=oe.indexOf(s))var l=a[s];else a.phase=s}let d=await(l||fetch(e,t));if(!l&&a&&(d.ok?a[s].resolve(d):a[s].reject(new Error("Fetch failed"))),!d.ok)throw new Error("Fetch failed");let u=new Date(d.headers.get("date"))<o||l&&s=="initial"&&(a.phase=="updated"||a.phase=="check");if((r==null?void 0:r(d,u))===!1)throw new mt("Response is not valid");return await(i==null?void 0:i(d,s,u)),{url:e,options:t,isCached:u,response:d,validator:r,callback:i,cache:n}}async function rt(e){let{url:t,isCached:r,options:i,validator:n,response:s,cache:o}=e;if(r){let{response:a}=await F({url:t+"?head",options:{...i,method:"HEAD",cache:"no-cache"},validator:n,cache:o},"check");if(a.headers.get("last-modified")!=s.headers.get("last-modified"))return gt(e)}return e}async function gt(e){return F({...e,options:{...e.options,cache:"reload"}},"updated")}var _="https://feaas.blob.core.windows.net";function j(e){let t=e.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(t){var[,r,i,n,s,o]=t;return{cdn:r,library:i,component:n,version:s,revision:o}}}function He(e){if(!e||!e.library||!e.component)throw new Error("Component requires `library` and `component` properties");return`${e.cdn&&e.cdn!=_?`${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 Be(e){return`${e.cdn&&e.cdn!=_?`${e.cdn}/styles/`:""}${e.library}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function vt(e){let t=e.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(t){var[,r,i,n]=t;return{cdn:r,library:i,revision:n}}else{let s=j(e);if(s){var{cdn:r,library:i,revision:n}=s;return n!=null&&n.match(/\d/)&&(n=void 0),{cdn:r,library:i,revision:n}}}}function it(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...j(e.src)}),`${e.cdn||e.hostname||_}/components/${e.library}/${e.component}/${e.version}/${e.revision||"published"}.html`}function I(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...vt(e.src)}),`${e.cdn||e.hostname||_}/styles/${e.library}/${e.revision||"published"}.css`}async function V(e,t,r=!1){let i=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,n=a=>a.clone().text().then(t),s=await Promise.all([e.instance&&F({options:{headers:{Accept:"text/html"},credentials:"omit"},url:it({...e,version:e.instance}),validator:i}).catch(a=>a),F({url:it(e),validator:i}).catch(a=>a)]),o=s.find(a=>a&&"isCached"in a&&a);if(!o||o instanceof Error)throw s.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return s[0]==o&&console.log("Using fork!",s),await n(o.response),r?o:rt({...o,callback:n}).catch(a=>{if(s[0]==o&&(gt({...o,callback:null,validator:null}),console.log("Fork was deleted"),!(s[1]instanceof Error)))return n(s[1].response),rt({...s[1],callback:n});throw a})}async function Ot(e){typeof e=="string"&&(e={src:e});var t;let{response:r}=await V(e,i=>{t=i},!0);return{...e,template:t,lastModified:r.headers.get("last-modified")}}async function bt(e,t){return typeof e=="string"&&(e={src:e}),et(I(e),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,i)=>r.clone().text().then(n=>t(n,i)))}function ze(e,t){return ae(e,t||(t=document.createElement("style"))),t}function ae(e,t){return t||(t=document.createElement("style")),bt(e,(r,i)=>{t.textContent=r}).then(()=>t)}function yt(e,t){var r=le(e);if(!r)var i=de(e);return bt(e,(n,s)=>{i&&(i.textContent=n),t==null||t(n,s)}).then(()=>r||i)}function Mt(e){return new Promise((t,r)=>{yt(e,t).catch(r)})}function le(e){return document.head.querySelector(`style[data-href="${I(e)}"]`)}function de(e){let t=I(e),r=document.createElement("style");return r.setAttribute("data-href",t),document.head.appendChild(r),r}function Ve(e,t){let r=document.createElement("div");r.innerHTML=e;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return R(i,t),r}function Lt(e,t){return ce(e,t||(t=document.createElement("div"))),t}async function ce(e,t){return t||(t=document.createElement("div")),t.childNodes.length?R(t,e.data,e):"template"in e?U(t,e.template,e.data,e):V(e,r=>U(t,r,e.data,e)).then(()=>t)}function Je(e){let{params:t,method:r,headers:i,body:n,url:s}=E(e);var o={url:s},a={...i};return i["Content-Type"]==="application/json"&&delete a["Content-Type"],i.Accept==="application/json"&&delete a.Accept,Object.keys(a).length>0&&(o.headers=a),r!=="GET"&&(o.method=r),r==="GET"||r==="HEAD"||Object.keys(n).length===0||(o.body=n),Object.keys(t).length>0&&(o={...o,params:t}),o}var At=e=>{if(typeof e.url!="string")return!1;for(var t in e)if(!(t=="body"||t=="params"||t=="headers"||t=="url"||t==="method"||t=="jsonpath"&&typeof e[t]=="string"))return!1;return!0};function ue(e){let{url:t,headers:r,params:i,method:n,body:s}=E(e),o,a=r["Content-Type"];n!="GET"&&n!="HEAD"&&(a==="application/json"&&(o=JSON.stringify(s)),a==="multipart/form-data"&&(o=Object.keys(s).reduce((d,u)=>(d.append(u,s[u]),d),new FormData)),a==="application/x-www-form-urlencoded"&&(o=new URLSearchParams(s)));let l=Object.keys(i).length?`?${new URLSearchParams(i)}`:"";return[`${t}${l}`,{headers:r,body:o,method:n}]}function E(e){let t={};for(let r in(e==null?void 0:e.headers)||{})if(e.headers.hasOwnProperty(r)){let i=r.replace(/^[a-z]|\-[a-z]/g,n=>n.toUpperCase());t[i]=e.headers[r]}return t.Accept||(t.Accept="application/json"),{params:(e==null?void 0:e.params)||{},headers:t,jsonpath:String((e==null?void 0:e.jsonpath)||"$"),method:((e==null?void 0:e.method)||"GET").toUpperCase(),body:(e==null?void 0:e.body)||{},url:String((e==null?void 0:e.url)||"")}}var Dt=async e=>{try{let[t,r]=ue(e),n=await(await E.fetchImplementation(t,{...r,method:r.method.toLowerCase()})).json();return e.jsonpath&&e.jsonpath!="$"?z(n,e.jsonpath):n}catch(t){return{}}};async function $t(e){if(!e)return e;if(At(e))return Dt(e);let t=Object.keys(e),r=await Promise.all(t.map(i=>At(e[i])?Dt(e[i]):null).filter(Boolean));return t.reduce((i,n)=>({...i,[n]:At(e[n])?r.shift():e[n]}),{})}E.clean=Je;E.toFetchArguments=ue;E.fetchOne=Dt;E.fetch=$t;E.isDataSettings=At;E.fetchImplementation=(...e)=>fetch(...e);function he(e){var t,r,i,n,s,o,a,l;let d,u=e.getAttribute("src");if(u){let y=j(u);if(!y)throw new Error(`Could not parse FEAAS Component source: ${u}`);var{cdn:f,library:h,component:c,version:p,revision:b}=y}let C=e.getAttribute("data");if(C!=null&&C!="")try{d=typeof C=="string"?JSON.parse(C):{}}catch(y){console.error(y)}return{data:d||{},cdn:(r=(t=e.getContextAttribute("cdn"))!==null&&t!==void 0?t:f)!==null&&r!==void 0?r:_,library:(i=e.getAttribute("library"))!==null&&i!==void 0?i:h,component:(n=e.getAttribute("component"))!==null&&n!==void 0?n:c,version:(o=(s=e.getAttribute("version"))!==null&&s!==void 0?s:p)!==null&&o!==void 0?o:"responsive",revision:(l=(a=e.getAttribute("revision"))!==null&&a!==void 0?a:b)!==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 nt=class extends A{setData(t){this.set({data:t})}getProps(){return he(this)}isJSONAttribute(t){return t=="data"}attributeChangedCallback(t,r,i){r!==i&&((t=="library"||t=="component"||t=="revision"||t=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(t,r,i),t==="data"&&this.fetchData())}async fetchData(){this.readyData=void 0,this.whenDataReady=this.whenDataReady.restart();let t=await E.fetch(this.props.data),r=this.alreadyRendered;await this.whenDataReady.resolve(t),r&&this.advance()}getEditor(){var t;return(t=document.querySelector("feaas-context"))===null||t===void 0?void 0:t.refs.editor}constructor(){super(),this.readyData={},this.whenDataReady=S(t=>this.readyData=t,t=>this.onError(t)),this.defaultProps={cdn:_,revision:"published",version:"responsive",withStylesheet:!0,editable:!1,suspended:!1,data:{}},this.onLoad=t=>{this.payload=t,this.advance()},this.getAttribute("data")||this.whenDataReady.resolve({}),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 i=r;return i}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(this.getOriginal())return;let t=()=>{this.payload&&(r||this.readyData&&this.onLoad(this.payload))};if(this.props.withStylesheet)var r=Mt({...this.props,revision:"published"}).then(()=>{r=null,t()});return Promise.all([r,this.whenDataReady.then(()=>t()),V(this.props,i=>{this.payload=i,t()})]).then(()=>this.payload)}flush(){this.readyData&&super.flush()}update(){if(this.alreadyRendered=!0,Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)R(this,this.readyData);else{if(this.needsRefresh=!0,this.getOriginal())return;U(this,this.payload,this.readyData)}}};nt.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];nt.register("feaas-component");function pe(e){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 ot=class extends A{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return pe(this)}attributeChangedCallback(t,r,i){if(r!==i)return t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,i)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
|
|
3
3
|
#loader {
|
|
4
4
|
position: absolute;
|
|
5
5
|
top: 0;
|
|
@@ -63,10 +63,10 @@ var Le=Object.defineProperty;var G=(e,t)=>{for(var r in t)Le(e,r,{get:t[r],enume
|
|
|
63
63
|
style="animation: 1.5s linear 0s infinite normal none running loader-circular-track"
|
|
64
64
|
></circle>
|
|
65
65
|
</svg>
|
|
66
|
-
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};
|
|
66
|
+
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};ot.observedAttributes=["hidden","opacity"];ot.register("feaas-loader");function fe(e){var t,r,i,n;let s=e.getAttribute("src");if(s)var{cdn:o,library:a,revision:l}=vt(s);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:(n=(i=e==null?void 0:e.getContextAttribute("cdn"))!==null&&i!==void 0?i:e==null?void 0:e.getContextAttribute("hostname"))!==null&&n!==void 0?n:_}}var wt=class extends A{constructor(){super(...arguments),this.onLoad=t=>{this.payload=t,this.advance()}}getProps(){return fe(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return yt(this.props,this.onLoad)}};wt.register("feaas-stylesheet");var Ct={};X(Ct,{convertBase64toBlob:()=>me,generate:()=>be,get:()=>qe,getVersionForThumbnail:()=>ge,load:()=>ve,responseToImage:()=>Ut,upload:()=>ye});var me=e=>fetch(e).then(t=>t.blob()),Ut=e=>e.blob().then(t=>new Promise((r,i)=>{let n=new Image;n.onerror=i,n.onload=()=>{r(n)},n.src=URL.createObjectURL(t)}));async function ge(e){return e.versions.length||await e.versions.fetch(),e.getVersionForWidth(800)}async function qe(e,t,r){try{if(!e.isNew)return await ve(e,t,r)}catch(n){e.sdk.log(`FEAAS: Thumbnail ${e.id}, version: ${(t==null?void 0:t.id)||"responsive"}, status: generating ${status}, reason: ${n}`)}let i=await be(e,t);return r==null||r(i,!1),i&&!e.isNew&&me(i.src).then(n=>ye(e,t,n)),i}async function ve(e,t,r){let i=t?t.getThumbnailURL():e.getThumbnailURL(),n=e.library.stylesheet,s=new Date(Math.max(Number(e.modifiedAt),Number(n.modifiedAt)));e.sdk.log(`FEAAS: Thumbnail ${e.id}/${(t==null?void 0:t.id)||"responsive"}, loading`);var o;return await et(i,{},(a,l)=>{let d=Math.abs(Number(new Date(a.headers.get("x-ms-meta-componentRenderedAt")))-Number(s))<2e3;return l&&!d&&Ut(a).then(u=>{o=u,r(u,l)}),d},(a,l,d)=>{e.sdk.log(`FEAAS: Thumbnail ${e.id}/${(t==null?void 0:t.id)||"responsive"}, status: ${l}`),Ut(a).then(u=>{o=u,r(u,d)})},null),o}async function be(e,t){let r=t||(e.isNew?null:await ge(e));if(!r||r.isViewEmpty())return null;let{stylesheet:i,datasources:n}=e.library;return await Ke(r.classList,i.getBreakpointForWidth(800,r.getBreakpoints()),r.view,n.reduce((o,a)=>Object.assign(o,{[a.id]:a.sample}),{}),i.css,e.sdk)}function Ke(e,t,r,i,n,s){let o=document.createElement("iframe");return o.style.position="absolute",o.style.top="-2000px",o.style.left="-2000px",o.style.width=t.props.minWidth+"px",o.style.height="720px",o.style.zIndex="100011",document.body.appendChild(o),new Promise((a,l)=>{let d=document.createElement("script");d.onerror=l,d.src=s.frontend+"/assets/html2canvas.js",d.onload=()=>{var c;(((c=o.contentWindow.document.fonts)===null||c===void 0?void 0:c.ready)||Promise.resolve()).then(function(){return o.contentWindow.html2canvas(h,{scale:Math.max(1.1,1e3/Math.min(1401,Math.max(320,t.props.minWidth))),width:Math.min(1401,Math.max(320,t.props.minWidth)),height:Math.max(1,Math.min(2e3,h.offsetHeight)),windowWidth:t.props.minWidth+"px",windowHeight:1e3,proxy:s.backend+"/proxy/media",backgroundColor:"#ffffff"}).then(p=>{let b=p.toDataURL("image/jpeg",.6);o.parentElement.removeChild(o);let C=new Image;C.onload=()=>{a(C)},C.onerror=l,C.src=b})})},o.contentWindow.document.head.appendChild(d);let u=o.contentWindow.document.createElement("style");u.textContent=`
|
|
67
67
|
${n}
|
|
68
68
|
body, html { padding: 0; margin: 0; overflow: hidden }
|
|
69
|
-
`;let
|
|
69
|
+
`;let f=o.contentWindow.document.createElement("style");f.textContent=`
|
|
70
70
|
body, html { padding: 0; margin: 0; overflow: hidden }
|
|
71
|
-
`,o.contentWindow.document.head.appendChild(u),o.contentWindow.document.head.appendChild(m);let h=Lt({template:r,data:i});h.classList.add(...e,"-feaas--preview","-emulate--"+t.details.slug),o.contentWindow.document.body.appendChild(h)})}async function ye(e,t,r){let i=t?t.getThumbnailURL():e.getThumbnailURL(),n=new Date(Math.max(Number(e.modifiedAt),Number(e.library.stylesheet.modifiedAt)));try{await e.sdk.uploadBlob("thumbnails",i.split(/\/thumbnails\//)[1],r,{headers:{"x-ms-blob-content-type":"image/jpg","x-ms-blob-cache-control":"public,max-age=31536000,immutable","x-ms-meta-versionId":t?t.id:null,"x-ms-meta-versionRevision":t?t.revision.toString():null,"x-ms-meta-componentId":e.id,"x-ms-meta-componentRenderedAt":n.toUTCString(),"x-ms-meta-componentModifiedAt":e.modifiedAt.toUTCString(),"x-ms-meta-componentCreatedAt":e.createdAt.toUTCString(),"x-ms-meta-modifiedAt":e.modifiedAt.toUTCString()}}),fetch(i,{cache:"no-cache"}).then(()=>{e.sdk.log("FEAAS: Thumbnail uploaded",i)})}catch(s){e.sdk.log("FEAAS: Thumbnail failed to upload",i,s)}return i}var Ft;typeof window!="undefined"&&(window.FEAASReactElement=B,(Ft=window.FEAASLoading)!==null&&Ft!==void 0||(window.FEAASLoading=Promise.resolve()));function Ae(e){let t=[];if(e){let r=e.ownerDocument.defaultView,i,n;for(;r!==window.top;){i=r.parent;for(let s=0;s<i.frames.length;s++)if(i.frames[s]===r){for(let o of i.document.getElementsByTagName("iframe"))if(o.contentWindow===r){n=o.getBoundingClientRect();let a=o.contentWindow.getComputedStyle(o);t.push({left:n.left+parseInt(a.borderLeftWidth),top:n.top+parseInt(a.borderTopWidth)})}r=i;break}}}return t.reduce((r,i)=>({left:r.left+i.left,top:r.top+i.top}),{left:0,top:0})}function we(e){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 ot=class extends y{constructor(){super(...arguments),this.framePoint={top:0,left:0},this.wrapperRect={top:0,left:0,width:0,height:0},this.bodyRect={top:0,left:0,width:0,height:0},this.defaultProps={hidden:!1},this.setTarget=(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 i=this.getPlaceholder();this.setTarget(i.editable,t.data)&&(this.loader=i.loader,document.body.appendChild(i.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 we(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,i=this.iframe.getBoundingClientRect(),n=this.getPlaceholder(),s=document.body.getBoundingClientRect(),o=this.measurements[this.editedUID];o&&(Object.assign(n.clipper.style,{position:"absolute",top:i.top+this.iframe.clientTop-s.top+"px",left:i.left+this.iframe.clientLeft-s.left+"px",width:t+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(n.positionable.style,{position:"absolute",top:o.top+"px",left:o.left+"px",width:o.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(n.loader.style,{position:"absolute",top:o.top+"px",left:o.left+"px",width:o.width+"px",height:o.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,i){r!==i&&(t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,i))}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:i,instance:n},{Editor:s,VersionStatusList:o,VersionStatusButton:a,Version:l,VersionMenu:d,EditorUIUndo:u,EditorUIMode:m,React:{useEffect:h,useMemo:c,useState:f,useContext:w},Chakra:{HStack:C,Box:b,Button:O,MenuItem:at},Chrome:k,ReactDOM:V,useSDK:H,useLibrary:Ne,useSlots:_e,useModelObserver:Pe,ConfirmationContext:Oe,VersionContext:nr}){if(!this.payload)return;let{React:g}=this.payload,Ht=H(),Bt=Ne(),[A,zt]=f(),{setConfirm:xt}=w(Oe),J=n||i;A&&(this.component=A),h(()=>{if(this.props.hidden)return;let N=Bt.components.getItem(r).clone();return N.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(St=>{N.versions.setItems(St);let T=N.findVersion(n,["staged","published"]),K=N.findVersion(i,["staged","published"]);if(T)T.deletedAt?(T.getDraft().changeAndNotify(K.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",T.id));else if(this.removeAttribute("forked"),this.shouldFork(K)){console.error("FEAAS Editor: Forking");let Rt=K.fork(n).id;this.setAttribute("instance",Rt)}else console.error("FEAAS Editor: Regular");zt(N)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),zt(null)},400)}},[i,this.props.hidden]);let Vt=Pe(A==null?void 0:A.versions,[]).filter(N=>N.id==J),q=Vt[0];q&&!this.props.hidden&&(this.version=q),h(()=>(this.unfork=()=>{xt({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let N=A.findVersion(i,["staged","published"]);A.findVersion(n).unstage().unpublish().changeAndNotify(N.toProperties()),A.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(A.findVersion(J).revert(),A.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{xt({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=()=>{xt({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:()=>{A.findVersion(J).commitData({view:this.editorContext.editor.getData({rootName:J}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",J),A.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[A]);let Me=c(()=>this.target,[A]);return c(()=>A&&_e(t,({picker:N,children:St})=>g.createElement(b,{ref:T=>{this.chrome=T?{positionable:T,wrapper:T.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},g.createElement(b,{className:"editor-wrapper",position:"absolute",left:0,top:0},g.createElement(s,{datasources:Ht.datasources,sdk:Ht,library:Bt,component:A,versions:Vt,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:St,chrome:({editor:T})=>T&&g.createElement(k,null),children:({isArchivedDisplayed:T,editor:K,status:Rt})=>g.createElement(b,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},g.createElement(b,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(b,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(b,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(b,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),q&&g.createElement(l,{version:q,node:Me,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:g.createElement(C,{justifyContent:"space-between"},g.createElement(u,{size:"sm",editor:Rt=="ready"?K:null}),g.createElement(m,{size:"sm"})),middle:(or,sr)=>[!1],right:g.createElement(g.Fragment,null,g.createElement(O,{variant:"secondary",size:"sm",onClick:this.close},"Close"),g.createElement(O,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),g.createElement(d,{isDisabled:!this.props.forked&&!this.props.changed},g.createElement(at,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),g.createElement(at,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[q,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};ot.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];ot.register("feaas-editor");function Ce(e){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"),dialog:e==null?void 0:e.getAttribute("dialog"),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,setAttribute:void 0,getAttribute:void 0}}var st=class extends y{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Ce(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){this.setAttribute("feaas-role","ui"),super.connectedCallback()}render({placeholder:t,context:r,mode:i,dialog:n,children:s,variant:o},{Picker:a,React:l,useLibrary:d,useSDK:u}){let[m,h]=l.useReducer(k=>k+1,0),c=d("collections"),f=d("components"),w=u("datasources"),C=d("stylesheet.styles"),b=f.find(k=>k.id==(r==null?void 0:r.getAttribute("component")));var O=r==null?void 0:r.getAttribute("data");if(O)try{O=JSON.parse(O)}catch(k){}let at=i=="datasources"?w.find(k=>k.id==n):null;return l.createElement(a,{rules:C,collections:c,themeContext:r,placeholder:t,component:b,datasource:at,data:O,versionId:r==null?void 0:r.getAttribute("version"),mode:i||(b?"component":null),setAttribute:(k,V,H)=>{V=="data"&&H&&(H=JSON.stringify(H)),this.props.setAttribute(k,V,H),h()},context:r,variant:o,onModeChange:(k,V)=>{this.set({mode:k,dialog:V})}},s)}};st.observedAttributes=["library","mode","frontend","src","hidden","variant","dialog"];st.register("feaas-picker");function Ee(e){var t,r,i,n,s;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",environment:(r=e==null?void 0:e.getAttribute("environment"))!==null&&r!==void 0?r:void 0,frontend:(i=e==null?void 0:e.getAttribute("frontend"))!==null&&i!==void 0?i:"https://components.sitecorecloud.io",backend:(n=e==null?void 0:e.getAttribute("backend"))!==null&&n!==void 0?n:"https://components.sitecorecloud.io/api",cdn:(s=e==null?void 0:e.getAttribute("cdn"))!==null&&s!==void 0?s:"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 W=class extends y{constructor(){super(...arguments),this.defaultProps={isolate:!0},this.onStatusChange=(t,r)=>{t=="ready"&&(this.whenSDKReady.resolve(r),this.dispatchEvent(new CustomEvent("feaasReady",{bubbles:!0,composed:!0,detail:r})))},this.whenSDKReady=S(t=>{this.sdk=t})}getProps(){return Ee(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}isReadyToLoad(){return 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(){this.setAttribute("feaas-role","ui"),Array.from(this.children).forEach(t=>{this.getRoot().appendChild(t)}),document.addEventListener("feaasMount",this),document.addEventListener("feaasUnmount",this),super.connectedCallback()}disconnectedCallback(){document.removeEventListener("feaasMount",this),document.removeEventListener("feaasUnmount",this),super.disconnectedCallback()}render({children:t,library:r},{AppContext:i,Chakra:{Button:n,Tooltip:s},React:o}){let a={containerRef:{current:this.getRoot()}};return s.defaultProps={hasArrow:!0,placement:"top",portalProps:a},o.createElement(i,{environment:this.props.environment,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:{resetScope:':where([feaas-role="ui"])',cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},t)}};W.observedAttributes=["library","component","version","revision","hostname","template"];W.register("feaas-context");W.prototype.clientside=jt;import P from"react";import xe from"react";import Ge from"react-dom";function It(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return e.replace(t,function(r){return"-"+r.toLowerCase()})}function Wt(e){let t=/-[a-z\u00E0-\u00F6\u00F8-\u00FE]/g;return e.replace(t,function(r){return r.slice(1).toUpperCase()})}var Xe=e=>Object.keys(e).reduce((t,r)=>{if(e[r].title)t[r]=e[r];else{let i=r.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()).join(" ");t[r]={...e[r],title:i}}return t},{}),Se=(e={})=>Object.keys(e).reduce((t,r)=>(t[It(r)]=e[r],t),{}),Ye=e=>{if(!e)return;if(!e.properties)return e;let t,r;return t=Se(e.properties),r=(e.required||[]).map(n=>It(n)),t=Xe(t),{...e,properties:t,required:r,title:void 0}},Ze=(e,t)=>{if(!e||!t)return;let r;return r=Se(e),Object.keys(t).filter(n=>/(integer|number)/.test(t[n].type)).forEach(n=>{r[n]?r[n]["ui:widget"]||(r[n]["ui:widget"]="updown"):r[n]={"ui:widget":"updown"}}),r},Qe=(e,t,r)=>{var i;switch((i=r==null?void 0:r[e])===null||i===void 0?void 0:i.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 tr(e){var t;let r=e.getAttributeNames(),i=e.getAttribute("data-external-id"),n=(t=v.registered[i])===null||t===void 0?void 0:t.schema;return r.reduce((o,a)=>{if(!a.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(a)){let l=e.getAttribute(a);return{...o,[Wt(a)]:Qe(Wt(a),l,n==null?void 0:n.properties)}}else return o},{})}var v=class extends y{load(){return Promise.resolve({React:xe,ReactDOM:Ge})}render(t,{React:r}){var i;let{dataExternalId:n}=t,s=(i=v.registered[n])===null||i===void 0?void 0:i.component;return s||console.warn("FEAASExternal: The component you requested is not registered"),r.createElement(r.Fragment,null,s&&r.createElement(s,{...t}))}getProps(){return tr(this)}static registerComponent(t,r){if(!r.name)throw new Error("Could not register external component. Please make sure you provide a name in the options");let i=r.name,{thumbnail:n,group:s,ui:o,...a}=r,l={...a,type:"object"};v.registered[i]={component:t,name:i,schema:l,uiSchema:o,thumbnail:n,group:s,title:(l==null?void 0:l.title)||i},v.setRegistrationCallback()}static setRegistrationCallback(){clearTimeout(v.registrationCallback),v.registrationCallback=setTimeout(()=>{var t;if(typeof window!="undefined"){let r=Object.keys(v.registered).map(i=>{var n;return{...v.registered[i],name:i,schema:Ye(v.registered[i].schema),uiSchema:Ze(v.registered[i].uiSchema,(n=v.registered[i].schema)===null||n===void 0?void 0:n.properties)}});(t=window.parent)===null||t===void 0||t.postMessage(JSON.stringify({action:"register-components",data:r}),"*")}},30)}static Preview(t){var r;let i=(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 i?xe.createElement(Re,{src:i,...t}):null}static linkComponents(t){return()=>t.map(r=>null)}static getComponent(t){return v.registered[t]}};v.registered={};v.register("feaas-external");v.setRegistrationCallback();var{getComponent:Et,linkComponents:er,registerComponent:rr}=v;var ji=async e=>{let t=await E.fetch((e==null?void 0:e.data)||{}),r={...e};if(("src"in e||"component"in e)&&(e==null?void 0:e.template)==null){let i=await Ot(e);r.template=i.template,r.lastModified=i.lastModified}return ke({...r,data:t})};function ke({data:e,...t}){let r="",i=null,n;return"template"in t&&t.template&&(n=Pt(t.template,e||{}).map(s=>Te(s,o=>{if(o.localName=="feaas-external"&&Et(o.getAttribute("data-external-id")))return[ir,{}]}))),"src"in t&&(t={...j(t.src),...t}),P.createElement(P.Fragment,null,"preload"in t&&i===!0&&"src"in t&&P.createElement(P.Fragment,null,P.createElement("link",{rel:"preload",as:"fetch",href:rt(t.src),crossOrigin:"anonymous"}),P.createElement("link",{rel:"preload",as:"style",href:I(t.src),crossOrigin:"anonymous"})),P.createElement("feaas-component",{...t,suppressHydrationWarning:!0,template:null,data:typeof e=="string"?e:e?JSON.stringify(e):null},n))}function ir(e){var t;let r=(t=Et(e["data-external-id"]))===null||t===void 0?void 0:t.component;return P.createElement("feaas-external",{...e},P.createElement(r,{...e}))}function Te(e,t){if(e.nodeType===3)return e.textContent;let r=Array.from(e.childNodes).map(a=>Te(a,t)),i={};for(let a=0;a<e.attributes.length;a++){let{name:l,value:d}=e.attributes[a];i[l]=d}let n=t==null?void 0:t(e),s=(n==null?void 0:n[0])||e.nodeName.toLowerCase(),o=Object.assign(i,(s==null?void 0:s[1])||{});return P.createElement(s,o,["img","br","input"].includes(s)?null:r)}var Re=ke;export{Re as Component,he as ComponentProps,W as Context,S as ControlledPromise,_ as DEFAULT_CDN_URL,ft as DOM,pt as DataPath,ct as DataScope,E as DataSettings,y as Element,v as External,it as FEAASComponent,he as FEAASComponentsProps,W as FEAASContext,Ee as FEAASContextProps,ot as FEAASEditor,we as FEAASEditorProps,y as FEAASElement,nt as FEAASLoader,pe as FEAASLoaderProps,st as FEAASPicker,Ce as FEAASPickerProps,ke as FEAASReactComponent,ir as FEAASReactExternal,wt as FEAASStylesheet,fe as FEAASStylesheetProps,Te as HTMLNodeToReact,mt as InvalidResponse,p as JSONPath,nt as Loader,lt as MyComponent,st as Picker,ji as ServerComponent,wt as Stylesheet,Ct as Thumbnail,Zt as adjustNumbers,Kt as autoloadScripts,Z as cleanCollectionBit,We as clearFetchCache,de as createStylesheet,tt as fetchAndRevalidate,z as fetchAndRevalidateComponent,bt as fetchAndRevalidateStylesheet,gt as fetchBypassingCache,Q as fetchCache,Ot as fetchComponent,$t as fetchData,et as fetchToValidateCache,F as fetchWithCacheAwareness,le as findStylesheet,Et as getComponent,He as getComponentSource,rt as getComponentURL,se as getFetchCache,Ae as getFramePosition,Qt as getHumanizedLabel,te as getLastPathBit,Yt as getQualifier,Be as getStylesheetSource,I as getStylesheetURL,er as linkComponents,Y as loadScript,yt as loadStylesheet,Mt as loadStylesheetAllowStale,ht as normalizeCollectionScope,qt as observeDOMElement,j as parseComponentSource,Gt as parseLimit,Xt as parseRange,vt as parseStylesheetSource,dt as queryObject,X as queryScopes,rr as registerComponent,Lt as renderComponent,Ve as renderComponentElement,ce as renderComponentPromise,U as renderDOMContent,R as renderDOMElement,je as renderHTMLContent,ze as renderStylesheet,ae as renderStylesheetPromise,L as serializeCH1RichText,$ as setDOMAttribute};
|
|
71
|
+
`,o.contentWindow.document.head.appendChild(u),o.contentWindow.document.head.appendChild(f);let h=Lt({template:r,data:i});h.classList.add(...e,"-feaas--preview","-emulate--"+t.details.slug),o.contentWindow.document.body.appendChild(h)})}async function ye(e,t,r){let i=t?t.getThumbnailURL():e.getThumbnailURL(),n=new Date(Math.max(Number(e.modifiedAt),Number(e.library.stylesheet.modifiedAt)));try{await e.sdk.uploadBlob("thumbnails",i.split(/\/thumbnails\//)[1],r,{headers:{"x-ms-blob-content-type":"image/jpg","x-ms-blob-cache-control":"public,max-age=31536000,immutable","x-ms-meta-versionId":t?t.id:null,"x-ms-meta-versionRevision":t?t.revision.toString():null,"x-ms-meta-componentId":e.id,"x-ms-meta-componentRenderedAt":n.toUTCString(),"x-ms-meta-componentModifiedAt":e.modifiedAt.toUTCString(),"x-ms-meta-componentCreatedAt":e.createdAt.toUTCString(),"x-ms-meta-modifiedAt":e.modifiedAt.toUTCString()}}),fetch(i,{cache:"no-cache"}).then(()=>{e.sdk.log("FEAAS: Thumbnail uploaded",i)})}catch(s){e.sdk.log("FEAAS: Thumbnail failed to upload",i,s)}return i}var Ft;typeof window!="undefined"&&(window.FEAASReactElement=B,(Ft=window.FEAASLoading)!==null&&Ft!==void 0||(window.FEAASLoading=Promise.resolve()));function Ae(e){let t=[];if(e){let r=e.ownerDocument.defaultView,i,n;for(;r!==window.top;){i=r.parent;for(let s=0;s<i.frames.length;s++)if(i.frames[s]===r){for(let o of i.document.getElementsByTagName("iframe"))if(o.contentWindow===r){n=o.getBoundingClientRect();let a=o.contentWindow.getComputedStyle(o);t.push({left:n.left+parseInt(a.borderLeftWidth),top:n.top+parseInt(a.borderTopWidth)})}r=i;break}}}return t.reduce((r,i)=>({left:r.left+i.left,top:r.top+i.top}),{left:0,top:0})}function we(e){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 st=class extends A{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 i=this.getPlaceholder();this.setTarget(i.editable,t.data)&&(this.loader=i.loader,document.body.appendChild(i.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 we(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,i=this.iframe.getBoundingClientRect(),n=this.getPlaceholder(),s=document.body.getBoundingClientRect(),o=this.measurements[this.editedUID];o&&(Object.assign(n.clipper.style,{position:"absolute",top:i.top+this.iframe.clientTop-s.top+"px",left:i.left+this.iframe.clientLeft-s.left+"px",width:t+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(n.positionable.style,{position:"absolute",top:o.top+"px",left:o.left+"px",width:o.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(n.loader.style,{position:"absolute",top:o.top+"px",left:o.left+"px",width:o.width+"px",height:o.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,i){r!==i&&(t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,i))}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:i,instance:n},{Editor:s,VersionStatusList:o,VersionStatusButton:a,Version:l,VersionMenu:d,EditorUIUndo:u,EditorUIMode:f,React:{useEffect:h,useMemo:c,useState:p,useContext:b},Chakra:{HStack:C,Box:y,Button:O,MenuItem:lt},Chrome:k,ReactDOM:J,useSDK:H,useLibrary:Te,useSlots:_e,useModelObserver:Pe,ConfirmationContext:Oe,VersionContext:nr}){if(!this.payload)return;let{React:g}=this.payload,Ht=H(),Bt=Te(),[w,zt]=p(),{setConfirm:xt}=b(Oe),q=n||i;w&&(this.component=w),h(()=>{if(this.props.hidden)return;let T=Bt.components.getItem(r).clone();return T.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(St=>{T.versions.setItems(St);let N=T.findVersion(n,["staged","published"]),G=T.findVersion(i,["staged","published"]);if(N)N.deletedAt?(N.getDraft().changeAndNotify(G.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",N.id));else if(this.removeAttribute("forked"),this.shouldFork(G)){console.error("FEAAS Editor: Forking");let Rt=G.fork(n).id;this.setAttribute("instance",Rt)}else console.error("FEAAS Editor: Regular");zt(T)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),zt(null)},400)}},[i,this.props.hidden]);let Vt=Pe(w==null?void 0:w.versions,[]).filter(T=>T.id==q),K=Vt[0];K&&!this.props.hidden&&(this.version=K),h(()=>(this.unfork=()=>{xt({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let T=w.findVersion(i,["staged","published"]);w.findVersion(n).unstage().unpublish().changeAndNotify(T.toProperties()),w.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(w.findVersion(q).revert(),w.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{xt({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=()=>{xt({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:()=>{w.findVersion(q).commitData({view:this.editorContext.editor.getData({rootName:q}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",q),w.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[w]);let Me=c(()=>this.target,[w]);return c(()=>w&&_e(t,({picker:T,children:St})=>g.createElement(y,{ref:N=>{this.chrome=N?{positionable:N,wrapper:N.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},g.createElement(y,{className:"editor-wrapper",position:"absolute",left:0,top:0},g.createElement(s,{datasources:Ht.datasources,sdk:Ht,library:Bt,component:w,versions:Vt,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:St,chrome:({editor:N})=>N&&g.createElement(k,null),children:({isArchivedDisplayed:N,editor:G,status:Rt})=>g.createElement(y,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},g.createElement(y,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(y,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(y,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(y,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),K&&g.createElement(l,{version:K,node:Me,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:g.createElement(C,{justifyContent:"space-between"},g.createElement(u,{size:"sm",editor:Rt=="ready"?G:null}),g.createElement(f,{size:"sm"})),middle:(or,sr)=>[!1],right:g.createElement(g.Fragment,null,g.createElement(O,{variant:"secondary",size:"sm",onClick:this.close},"Close"),g.createElement(O,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),g.createElement(d,{isDisabled:!this.props.forked&&!this.props.changed},g.createElement(lt,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),g.createElement(lt,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[K,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};st.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];st.register("feaas-editor");function Ce(e){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"),dialog:e==null?void 0:e.getAttribute("dialog"),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,setAttribute:void 0,getAttribute:void 0}}var at=class extends A{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Ce(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){this.setAttribute("feaas-role","ui"),super.connectedCallback()}render({placeholder:t,context:r,mode:i,dialog:n,children:s,variant:o},{Picker:a,React:l,useLibrary:d,useSDK:u}){let[f,h]=l.useReducer(k=>k+1,0),c=d("collections"),p=d("components"),b=u("datasources"),C=d("stylesheet.styles"),y=p.find(k=>k.id==(r==null?void 0:r.getAttribute("component")));var O=r==null?void 0:r.getAttribute("data");if(O)try{O=JSON.parse(O)}catch(k){}let lt=i=="datasources"?b.find(k=>k.id==n):null;return l.createElement(a,{rules:C,collections:c,themeContext:r,placeholder:t,component:y,datasource:lt,data:O,versionId:r==null?void 0:r.getAttribute("version"),mode:i||(y?"component":null),setAttribute:(k,J,H)=>{J=="data"&&H&&(H=JSON.stringify(H)),this.props.setAttribute(k,J,H),h()},context:r,variant:o,onModeChange:(k,J)=>{this.set({mode:k,dialog:J})}},s)}};at.observedAttributes=["library","mode","frontend","src","hidden","variant","dialog"];at.register("feaas-picker");function Ee(e){var t,r,i,n,s;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",environment:(r=e==null?void 0:e.getAttribute("environment"))!==null&&r!==void 0?r:void 0,frontend:(i=e==null?void 0:e.getAttribute("frontend"))!==null&&i!==void 0?i:"https://components.sitecorecloud.io",backend:(n=e==null?void 0:e.getAttribute("backend"))!==null&&n!==void 0?n:"https://components.sitecorecloud.io/api",cdn:(s=e==null?void 0:e.getAttribute("cdn"))!==null&&s!==void 0?s:"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 W=class extends A{constructor(){super(...arguments),this.defaultProps={isolate:!0},this.onStatusChange=(t,r)=>{t=="ready"&&(this.whenSDKReady.resolve(r),this.dispatchEvent(new CustomEvent("feaasReady",{bubbles:!0,composed:!0,detail:r})))},this.whenSDKReady=S(t=>{this.sdk=t})}getProps(){return Ee(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}isReadyToLoad(){return 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(){this.setAttribute("feaas-role","ui"),Array.from(this.children).forEach(t=>{this.getRoot().appendChild(t)}),document.addEventListener("feaasMount",this),document.addEventListener("feaasUnmount",this),super.connectedCallback()}disconnectedCallback(){document.removeEventListener("feaasMount",this),document.removeEventListener("feaasUnmount",this),super.disconnectedCallback()}render({children:t,library:r},{AppContext:i,Chakra:{Button:n,Tooltip:s},React:o}){let a={containerRef:{current:this.getRoot()}};return s.defaultProps={hasArrow:!0,placement:"top",portalProps:a},o.createElement(i,{environment:this.props.environment,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:{resetScope:':where([feaas-role="ui"])',cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},t)}};W.observedAttributes=["library","component","version","revision","hostname","template"];W.register("feaas-context");W.prototype.clientside=jt;import P from"react";import xe from"react";import Ge from"react-dom";function It(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return e.replace(t,function(r){return"-"+r.toLowerCase()})}function Wt(e){let t=/-[a-z\u00E0-\u00F6\u00F8-\u00FE]/g;return e.replace(t,function(r){return r.slice(1).toUpperCase()})}var Xe=e=>Object.keys(e).reduce((t,r)=>{if(e[r].title)t[r]=e[r];else{let i=r.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()).join(" ");t[r]={...e[r],title:i}}return t},{}),Se=(e={})=>Object.keys(e).reduce((t,r)=>(t[It(r)]=e[r],t),{}),Ye=e=>{if(!e)return;if(!e.properties)return e;let t,r;return t=Se(e.properties),r=(e.required||[]).map(n=>It(n)),t=Xe(t),{...e,properties:t,required:r,title:void 0}},Ze=(e,t)=>{if(!e||!t)return;let r;return r=Se(e),Object.keys(t).filter(n=>/(integer|number)/.test(t[n].type)).forEach(n=>{r[n]?r[n]["ui:widget"]||(r[n]["ui:widget"]="updown"):r[n]={"ui:widget":"updown"}}),r},Qe=(e,t,r)=>{var i;switch((i=r==null?void 0:r[e])===null||i===void 0?void 0:i.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 tr(e){var t;let r=e.getAttributeNames(),i=e.getAttribute("data-external-id"),n=(t=v.registered[i])===null||t===void 0?void 0:t.schema;return r.reduce((o,a)=>{if(!a.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(a)){let l=e.getAttribute(a);return{...o,[Wt(a)]:Qe(Wt(a),l,n==null?void 0:n.properties)}}else return o},{})}var v=class extends A{load(){return Promise.resolve({React:xe,ReactDOM:Ge})}render(t,{React:r}){var i;let{dataExternalId:n}=t,s=(i=v.registered[n])===null||i===void 0?void 0:i.component;return s||console.warn("FEAASExternal: The component you requested is not registered"),r.createElement(r.Fragment,null,s&&r.createElement(s,{...t}))}getProps(){return tr(this)}static registerComponent(t,r){if(!r.name)throw new Error("Could not register external component. Please make sure you provide a name in the options");let i=r.name,{thumbnail:n,group:s,ui:o,...a}=r,l={...a,type:"object"};v.registered[i]={component:t,name:i,schema:l,uiSchema:o,thumbnail:n,group:s,title:(l==null?void 0:l.title)||i},v.setRegistrationCallback()}static setRegistrationCallback(){clearTimeout(v.registrationCallback),v.registrationCallback=setTimeout(()=>{var t;if(typeof window!="undefined"){let r=Object.keys(v.registered).map(i=>{var n;return{...v.registered[i],name:i,schema:Ye(v.registered[i].schema),uiSchema:Ze(v.registered[i].uiSchema,(n=v.registered[i].schema)===null||n===void 0?void 0:n.properties)}});(t=window.parent)===null||t===void 0||t.postMessage(JSON.stringify({action:"register-components",data:r}),"*")}},30)}static Preview(t){var r;let i=(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 i?xe.createElement(Re,{src:i,...t}):null}static linkComponents(t){return()=>t.map(r=>null)}static getComponent(t){return v.registered[t]}};v.registered={};v.register("feaas-external");v.setRegistrationCallback();var{getComponent:Et,linkComponents:er,registerComponent:rr}=v;var ji=async e=>{let t=await E.fetch((e==null?void 0:e.data)||{}),r={...e};if(("src"in e||"component"in e)&&(e==null?void 0:e.template)==null){let i=await Ot(e);r.template=i.template,r.lastModified=i.lastModified}return ke({...r,data:t})};function ke({data:e,...t}){let r="",i=null,n;return"template"in t&&t.template&&(n=Pt(t.template,e||{}).map(s=>Ne(s,o=>{if(o.localName=="feaas-external"&&Et(o.getAttribute("data-external-id")))return[ir,{}]}))),"src"in t&&(t={...j(t.src),...t}),P.createElement(P.Fragment,null,"preload"in t&&i===!0&&"src"in t&&P.createElement(P.Fragment,null,P.createElement("link",{rel:"preload",as:"fetch",href:it(t.src),crossOrigin:"anonymous"}),P.createElement("link",{rel:"preload",as:"style",href:I(t.src),crossOrigin:"anonymous"})),P.createElement("feaas-component",{...t,suppressHydrationWarning:!0,template:null,data:typeof e=="string"?e:e?JSON.stringify(e):null},n))}function ir(e){var t;let r=(t=Et(e["data-external-id"]))===null||t===void 0?void 0:t.component;return P.createElement("feaas-external",{...e},P.createElement(r,{...e}))}function Ne(e,t){if(e.nodeType===3)return e.textContent;let r=Array.from(e.childNodes).map(a=>Ne(a,t)),i={};for(let a=0;a<e.attributes.length;a++){let{name:l,value:d}=e.attributes[a];i[l]=d}let n=t==null?void 0:t(e),s=(n==null?void 0:n[0])||e.nodeName.toLowerCase(),o=Object.assign(i,(s==null?void 0:s[1])||{});return P.createElement(s,o,["img","br","input"].includes(s)?null:r)}var Re=ke;export{Re as Component,he as ComponentProps,W as Context,S as ControlledPromise,_ as DEFAULT_CDN_URL,ft as DOM,pt as DataPath,ct as DataScope,E as DataSettings,A as Element,v as External,nt as FEAASComponent,he as FEAASComponentsProps,W as FEAASContext,Ee as FEAASContextProps,st as FEAASEditor,we as FEAASEditorProps,A as FEAASElement,ot as FEAASLoader,pe as FEAASLoaderProps,at as FEAASPicker,Ce as FEAASPickerProps,ke as FEAASReactComponent,ir as FEAASReactExternal,wt as FEAASStylesheet,fe as FEAASStylesheetProps,Ne as HTMLNodeToReact,mt as InvalidResponse,m as JSONPath,ot as Loader,dt as MyComponent,at as Picker,ji as ServerComponent,wt as Stylesheet,Ct as Thumbnail,Zt as adjustNumbers,Kt as autoloadScripts,Q as cleanCollectionBit,We as clearFetchCache,de as createStylesheet,et as fetchAndRevalidate,V as fetchAndRevalidateComponent,bt as fetchAndRevalidateStylesheet,gt as fetchBypassingCache,tt as fetchCache,Ot as fetchComponent,$t as fetchData,rt as fetchToValidateCache,F as fetchWithCacheAwareness,le as findStylesheet,Et as getComponent,He as getComponentSource,it as getComponentURL,se as getFetchCache,Ae as getFramePosition,Qt as getHumanizedLabel,te as getLastPathBit,Yt as getQualifier,Be as getStylesheetSource,I as getStylesheetURL,er as linkComponents,Z as loadScript,yt as loadStylesheet,Mt as loadStylesheetAllowStale,ht as normalizeCollectionScope,qt as observeDOMElement,j as parseComponentSource,Gt as parseLimit,Xt as parseRange,vt as parseStylesheetSource,z as queryObject,Y as queryScopes,rr as registerComponent,Lt as renderComponent,Ve as renderComponentElement,ce as renderComponentPromise,U as renderDOMContent,R as renderDOMElement,je as renderHTMLContent,ze as renderStylesheet,ae as renderStylesheetPromise,L as serializeCH1RichText,$ as setDOMAttribute};
|
|
72
72
|
//# sourceMappingURL=react.esm.js.map
|