@sitecore-feaas/clientside 0.1.23 → 0.1.25
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/FEAASBase.js +14 -7
- package/build/components/FEAASBase.js.map +1 -1
- package/build/components/FEAASComponent.js +10 -9
- package/build/components/FEAASComponent.js.map +1 -1
- package/build/components/FEAASElement.js +30 -0
- package/build/components/FEAASElement.js.map +1 -1
- package/build/components/FEAASLoader.js +2 -1
- package/build/components/FEAASLoader.js.map +1 -1
- package/build/dom.js +8 -5
- package/build/dom.js.map +1 -1
- package/build/fetch.js +0 -1
- package/build/fetch.js.map +1 -1
- package/build/ui/FEAASContext.js +13 -1
- package/build/ui/FEAASContext.js.map +1 -1
- package/dist/browser/basic.esm.js +5 -5
- package/dist/browser/basic.esm.js.map +1 -1
- package/dist/browser/basic.js +5 -5
- package/dist/browser/basic.js.map +1 -1
- package/dist/browser/index.esm.js +5 -5
- package/dist/browser/index.esm.js.map +1 -1
- package/dist/browser/index.js +5 -5
- package/dist/browser/index.js.map +1 -1
- package/dist/node/basic.esm.js +3 -3
- package/dist/node/basic.esm.js.map +1 -1
- package/dist/node/basic.js +3 -3
- package/dist/node/basic.js.map +1 -1
- package/dist/node/index.esm.js +3 -3
- package/dist/node/index.esm.js.map +1 -1
- package/dist/node/index.js +3 -3
- package/dist/node/index.js.map +1 -1
- package/examples/index.html +0 -8
- package/package.json +4 -4
- package/src/components/FEAASBase.tsx +11 -3
- package/src/components/FEAASElement.tsx +33 -0
- package/src/dom.ts +13 -10
- package/src/fetch.ts +0 -1
- package/src/ui/FEAASContext.tsx +12 -0
- package/src/ui/FEAASEditor.tsx +1 -1
- package/src/ui/FEAASPicker.tsx +1 -1
- package/test/tsconfig.json +1 -1
- package/types/components/FEAASBase.d.ts +4 -2
- package/types/components/FEAASBase.d.ts.map +1 -1
- package/types/components/FEAASComponent.d.ts +1 -1
- package/types/components/FEAASComponent.d.ts.map +1 -1
- package/types/components/FEAASElement.d.ts +15 -3
- package/types/components/FEAASElement.d.ts.map +1 -1
- package/types/components/FEAASLoader.d.ts +1 -1
- package/types/components/FEAASLoader.d.ts.map +1 -1
- package/types/components/FEAASStylesheet.d.ts +1 -1
- package/types/components/FEAASStylesheet.d.ts.map +1 -1
- package/types/dom.d.ts +3 -3
- package/types/dom.d.ts.map +1 -1
- package/types/fetch.d.ts.map +1 -1
- package/types/tsbuildinfo +1 -1
- package/types/tsbuildinfo_ui +1 -1
- package/types/ui/FEAASContext.d.ts +2 -0
- package/types/ui/FEAASContext.d.ts.map +1 -1
- package/types/ui/FEAASEditor.d.ts +1 -1
- package/types/ui/FEAASEditor.d.ts.map +1 -1
- package/types/ui/FEAASPicker.d.ts +1 -1
- package/types/ui/FEAASPicker.d.ts.map +1 -1
package/dist/node/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var Mt=Object.create;var j=Object.defineProperty;var Lt=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var Dt=Object.getPrototypeOf,$t=Object.prototype.hasOwnProperty;var Ft=(t,e)=>{for(var r in e)j(t,r,{get:e[r],enumerable:!0})},at=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Nt(e))!$t.call(t,o)&&o!==r&&j(t,o,{get:()=>e[o],enumerable:!(i=Lt(e,o))||i.enumerable});return t};var It=(t,e,r)=>(r=t!=null?Mt(Dt(t)):{},at(e||!t||!t.__esModule?j(r,"default",{value:t,enumerable:!0}):r,t)),Ut=t=>at(j({},"__esModule",{value:!0}),t);var qt={};Ft(qt,{Base:()=>y,Component:()=>D,FEAASBase:()=>y,FEAASComponent:()=>D,FEAASComponentsProps:()=>mt,FEAASContext:()=>U,FEAASContextProps:()=>xt,FEAASEditor:()=>F,FEAASEditorProps:()=>Ct,FEAASLoader:()=>$,FEAASLoaderProps:()=>vt,FEAASPicker:()=>I,FEAASPickerProps:()=>wt,FEAASStylesheet:()=>q,FEAASStylesheetProps:()=>At,JSONPath:()=>p,Loader:()=>$,Stylesheet:()=>q,autoloadScripts:()=>gt,cleanCollectionBit:()=>ht,fetchAndRevalidate:()=>Z,fetchAndValidate:()=>k,getFramePosition:()=>Et,invalidateRequest:()=>B,loadScript:()=>H,normalizeCollectionScope:()=>ut,observeDOMElement:()=>ft,queryScopes:()=>et,refetchAndValidate:()=>M,renderComponent:()=>Ht,renderComponentElement:()=>Bt,renderComponentPromise:()=>yt,renderDOMContent:()=>L,renderDOMElement:()=>R,renderStylesheet:()=>zt,renderStylesheetPromise:()=>bt,serializeCH1RichText:()=>N,setDOMAttribute:()=>S});module.exports=Ut(qt);var Wt=typeof HTMLElement=="undefined"?class{}:HTMLElement,y=class extends Wt{constructor(){super(),this.connected=!1,this.refs={},this.descendants=[],this.onLoad=e=>{e!=null&&(this.payload=e,this.update())},this.addEventListener("feaasConnected",this),this.addEventListener("feaasDisconnected",this)}getProps(e){return{}}getRoot(){return this}attributeChangedCallback(e,r,i){this.set()}connectedCallback(){this.initialize()}initialize(){let e=this.getParent();if(!(e&&!e.connected)&&!this.connected)return this.connected=!0,console.log("FEAAS: Connected",this.tagName,this),this.dispatchEvent(new Event("feaasConnected",{bubbles:!0,composed:!0})),this.getElements().map(r=>r.initialize()),this.set(),!0}getParent(e=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!e||r.tagName.startsWith("FEAAS-"))return r}getElements(e=this.getRoot(),r=!0){return Array.from(e.querySelectorAll("*")).map(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.shadowRoot,r):null]).flat().filter(Boolean)}disconnectedCallback(){this.connected&&(console.log("FEAAS: Disconnected",this),this.dispatchEvent(new Event("feaasDisconnected",{bubbles:!0,composed:!0})),this.connected=null)}handleEvent(e){let r=e.composedPath()[0];switch(e.type){case"feaasConnected":r!=this&&this.nestedCallback(r);break;case"feaasDisconnected":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(e){let r=this.descendants.indexOf(e);r!=-1&&(console.log("FEAAS: Unnest",this,e),this.descendants.splice(r,-1),this.refs[e.getComponentName()]=null,e.refs.parent==this&&(e.refs.parent=null),e.refs.top==this&&(e.refs.top=e.refs.parent))}nestedCallback(e){var r,i;if(this.descendants.indexOf(e)==-1&&(this.descendants.push(e),console.log("FEAAS: Nest",this,e),this.refs[e.getComponentName()]=e,e.refs.top=this,(r=e.refs).parent||(r.parent=this),e.render))for(var n=e.refs.parent;n;n=n.refs.parent)n.render&&((i=e.refs).parentReact||(i.parentReact=n),e.refs.topReact=n)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}async reify(){this.payload!==void 0?this.update():this.isReadyToLoad()&&(this.payload=null,this.load().then(this.onLoad))}load(){return Promise.resolve(null)}update(e=!1){var r,i,o;if(console.log("FEAAS: React",this.tagName,this.payload),this.payload==null)return;let{React:n,ReactDOM:s,ReactDOMClient:a}=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?a?(this.reactRoot||(this.reactRoot=a.createRoot(this.getReactRootElement())),this.reactRoot.render(n.createElement(this.getReactWrapper()))):s.render(n.createElement(this.getReactWrapper()),this.getReactRootElement()):this.forceUpdateReact?(r=this.forceUpdateReact)===null||r===void 0||r.call(this):(o=(i=this.refs.topReact).forceUpdateReact)===null||o===void 0||o.call(i)}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{},i=this.descendants.filter(o=>o.refs.parentReact==this&&o.payload).map((o,n)=>e.createElement(this.getReactWrapper(o),{key:this.tagName+"-"+n,slot:o.getAttribute("slot")}));return this.render({...this.props,children:i},this.payload)}getReactWrapper(e=this,r=e.tagName){let i=e.reactWrapper||(e.reactWrapper=o=>{if(e.render){let{React:n,ReactDOM:s}=e.payload||{},[a,d]=n.useReducer(l=>l+1,0);return e.forceUpdateReact=d,s.createPortal(n.createElement(n.Fragment,null,e.invokeReactRendering()),e.getReactRootElement())}else return e.update()});return Object.assign(i,{displayName:r}),i}getUID(){return this.uid||(this.uid=String(Math.random()))}getReactRootElement(){return this.getRoot()}set(e){this.overrides={...this.overrides,...e},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let i=this.props[r];this.props[r]==null?this.removeAttribute(r):(typeof i=="string"||typeof i=="number")&&this.getAttribute(r)!=String(i)&&this.setAttribute(r,String(i))}this.scheduleRender()}scheduleRender(){cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.reify()})}formatURL(e,r){return typeof e=="string"&&e.match(/^\/[^\/]/)?r+e:e}getContextAttribute(e,r=this){for(var i=this;i=i.parentElement||(i.parentNode instanceof ShadowRoot?i.parentNode.host:null);)if(i.getAttribute(e)!=null)return i.getAttribute(e);return this.getAttribute(e)}static register(e){typeof window!="undefined"&&!window.customElements.get(e)&&window.customElements.define(e,this)}};var O=class extends y{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([e,r])=>({React:e,ReactDOM:r}))}render({},{React:e}){return e.createElement(e.Fragment,null)}};var lt=It(require("vm"),1),{hasOwnProperty:v}=Object.prototype;function x(t,e){return t=t.slice(),t.push(e),t}function Q(t,e){return e=e.slice(),e.unshift(t),e}var X=class extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}};function p(t,e,r,i,o){if(!(this instanceof p))try{return new p(t,e,r,i,o)}catch(s){if(!s.avoidNew)throw s;return s.value}typeof t=="string"&&(o=i,i=r,r=e,e=t,t=null);let n=t&&typeof t=="object";if(t=t||{},this.json=t.json||r,this.path=t.path||e,this.resultType=t.resultType||"value",this.flatten=t.flatten||!1,this.wrap=v.call(t,"wrap")?t.wrap:!0,this.sandbox=t.sandbox||{},this.preventEval=t.preventEval||!1,this.parent=t.parent||null,this.parentProperty=t.parentProperty||null,this.callback=t.callback||i||null,this.otherTypeCallback=t.otherTypeCallback||o||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){let s={path:n?t.path:e};n?"json"in t&&(s.json=t.json):s.json=r;let a=this.evaluate(s);if(!a||typeof a!="object")throw new X(a);return a}}p.prototype.evaluate=function(t,e,r,i){let o=this.parent,n=this.parentProperty,{flatten:s,wrap:a}=this;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=i||this.otherTypeCallback,e=e||this.json,t=t||this.path,t&&typeof t=="object"&&!Array.isArray(t)){if(!t.path&&t.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!v.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=t),s=v.call(t,"flatten")?t.flatten:s,this.currResultType=v.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=v.call(t,"sandbox")?t.sandbox:this.currSandbox,a=v.call(t,"wrap")?t.wrap:a,this.currPreventEval=v.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=v.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=v.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,o=v.call(t,"parent")?t.parent:o,n=v.call(t,"parentProperty")?t.parentProperty:n,t=t.path}if(o=o||null,n=n||null,Array.isArray(t)&&(t=p.toPathString(t)),!t&&t!==""||!e)return;let d=p.toPathArray(t);d[0]==="$"&&d.length>1&&d.shift(),this._hasParentSelector=null;let l=this._trace(d,e,["$"],o,n,r).filter(function(u){return u&&!u.isParentSelector});return l.length?!a&&l.length===1&&!l[0].hasArrExpr?this._getPreferredOutput(l[0]):l.reduce((u,h)=>{let f=this._getPreferredOutput(h);return s&&Array.isArray(f)?u=u.concat(f):u.push(f),u},[]):a?[]:void 0};p.prototype._getPreferredOutput=function(t){let e=this.currResultType;switch(e){case"all":{let r=Array.isArray(t.path)?t.path:p.toPathArray(t.path);return t.pointer=p.toPointer(r),t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return p.toPathString(t[e]);case"pointer":return p.toPointer(t.path);default:throw new TypeError("Unknown result type")}};p.prototype._handleCallback=function(t,e,r){if(e){let i=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),e(i,r,t)}};p.prototype._trace=function(t,e,r,i,o,n,s,a){let d;if(!t.length)return d={path:r,value:e,parent:i,parentProperty:o,hasArrExpr:s},this._handleCallback(d,n,"value"),d;let l=t[0],u=t.slice(1),h=[];function f(c){Array.isArray(c)?c.forEach(g=>{h.push(g)}):h.push(c)}if((typeof l!="string"||a)&&e&&v.call(e,l))f(this._trace(u,e[l],x(r,l),e,l,n,s));else if(l==="*")this._walk(e,c=>{f(this._trace(u,e[c],x(r,c),e,c,n,!0,!0))});else if(l==="..")f(this._trace(u,e,r,i,o,n,s)),this._walk(e,c=>{typeof e[c]=="object"&&f(this._trace(t.slice(),e[c],x(r,c),e,c,n,!0))});else{if(l==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:u,isParentSelector:!0};if(l==="~")return d={path:x(r,l),value:o,parent:i,parentProperty:null},this._handleCallback(d,n,"property"),d;if(l==="$")f(this._trace(u,e,r,null,null,n,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(l))f(this._slice(l,u,e,r,i,o,n));else if(l.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let c=l.replace(/^\?\((.*?)\)$/u,"$1");this._walk(e,g=>{this._eval(c,e[g],g,r,i,o)&&f(this._trace(u,e[g],x(r,g),e,g,n,!0))})}else if(l[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");f(this._trace(Q(this._eval(l,e,r[r.length-1],r.slice(0,-1),i,o),u),e,r,i,o,n,s))}else if(l[0]==="@"){let c=!1,g=l.slice(1,-2);switch(g){case"scalar":(!e||!["object","function"].includes(typeof e))&&(c=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===g&&(c=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(c=!0);break;case"number":Number.isFinite(e)&&(c=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(c=!0);break;case"object":e&&typeof e===g&&(c=!0);break;case"array":Array.isArray(e)&&(c=!0);break;case"other":c=this.currOtherTypeCallback(e,r,i,o);break;case"null":e===null&&(c=!0);break;default:throw new TypeError("Unknown value type "+g)}if(c)return d={path:r,value:e,parent:i,parentProperty:o},this._handleCallback(d,n,"value"),d}else if(l[0]==="`"&&e&&v.call(e,l.slice(1))){let c=l.slice(1);f(this._trace(u,e[c],x(r,c),e,c,n,s,!0))}else if(l.includes(",")){let c=l.split(",");for(let g of c)f(this._trace(Q(g,u),e,r,i,o,n,!0))}else!a&&e&&v.call(e,l)&&f(this._trace(u,e[l],x(r,l),e,l,n,s,!0))}if(this._hasParentSelector)for(let c=0;c<h.length;c++){let g=h[c];if(g&&g.isParentSelector){let w=this._trace(g.expr,e,g.path,i,o,n,s);if(Array.isArray(w)){h[c]=w[0];let J=w.length;for(let A=1;A<J;A++)c++,h.splice(c,0,w[A])}else h[c]=w}}return h};p.prototype._walk=function(t,e){if(Array.isArray(t)){let r=t.length;for(let i=0;i<r;i++)e(i)}else t&&typeof t=="object"&&Object.keys(t).forEach(r=>{e(r)})};p.prototype._slice=function(t,e,r,i,o,n,s){if(!Array.isArray(r))return;let a=r.length,d=t.split(":"),l=d[2]&&Number.parseInt(d[2])||1,u=d[0]&&Number.parseInt(d[0])||0,h=d[1]&&Number.parseInt(d[1])||a;u=u<0?Math.max(0,u+a):Math.min(a,u),h=h<0?Math.max(0,h+a):Math.min(a,h);let f=[];for(let c=u;c<h;c+=l)this._trace(Q(c,e),r,i,o,n,s,!0).forEach(w=>{f.push(w)});return f};p.prototype._eval=function(t,e,r,i,o,n){this.currSandbox._$_parentProperty=n,this.currSandbox._$_parent=o,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;let s=t.includes("@path");s&&(this.currSandbox._$_path=p.toPathString(i.concat([r])));let a="script:"+t;if(!p.cache[a]){let d=t.replace(/@parentProperty/gu,"_$_parentProperty").replace(/@parent/gu,"_$_parent").replace(/@property/gu,"_$_property").replace(/@root/gu,"_$_root").replace(/@([.\s)[])/gu,"_$_v$1");s&&(d=d.replace(/@path/gu,"_$_path")),p.cache[a]=new this.vm.Script(d)}try{return p.cache[a].runInNewContext(this.currSandbox)}catch(d){throw new Error("jsonPath: "+d.message+": "+t)}};p.cache={};p.toPathString=function(t){let e=t,r=e.length,i="$";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(e[o])||(i+=/^[0-9*]+$/u.test(e[o])?"["+e[o]+"]":"['"+e[o]+"']");return i};p.toPointer=function(t){let e=t,r=e.length,i="";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(e[o])||(i+="/"+e[o].toString().replace(/~/gu,"~0").replace(/\//gu,"~1"));return i};p.toPathArray=function(t){let{cache:e}=p;if(e[t])return e[t].concat();let r=[],o=t.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replace(/[['](\??\(.*?\))[\]']/gu,function(n,s){return"[#"+(r.push(s)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(n,s){return"['"+s.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(n,s){return";"+s.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"").split(";").map(function(n){let s=n.match(/#(\d+)/u);return!s||!s[1]?n:r[s[1]]});return e[t]=o,e[t].concat()};p.prototype.vm=lt.default;async function Z(t,e,r,i){return k({url:t,options:e,validator:r,callback:i}).then(M).then(o=>o.response)}async function k({url:t,options:e,validator:r,callback:i},o="initial"){let n=new Date;console.log("fetch",o,t);let s=await fetch(t,e);if(!s.ok)throw new Error("Fetch failed");if((r==null?void 0:r(s))===!1)throw new Error("Response is not valid");let a=new Date(s.headers.get("date"))<n;return i==null||i(s,o),{url:t,options:e,isCached:a,response:s,validator:r}}async function M(t){let{url:e,isCached:r,options:i,validator:o,response:n,callback:s}=t;if(r){let{response:a}=await k({url:e+"?"+Math.random(),options:{...i,method:"HEAD",cache:"no-cache"},validator:o},"check");if(a.headers.get("last-modified")!=n.headers.get("last-modified"))return B(t)}return t}async function B(t){let{url:e,options:r,validator:i,callback:o}=t;return k({url:e,options:{...r,cache:"reload"},validator:i,callback:o},"updated")}function dt({cdn:t="https://feaascomponentsapidev.blob.core.windows.net",hostname:e,library:r,component:i,version:o,revision:n="published"}){return`${t||e}/components/${r}/${i}/${o}/${n}.html`}function jt({cdn:t="https://feaascomponentsapidev.blob.core.windows.net",hostname:e,library:r,revision:i="published"}){return`${t||e}/styles/${r}/${i}.css`}async function V(t,e){let r=s=>s.headers.get("x-ms-meta-versionDeletedAt")==null,i=s=>{s.text().then(e)},o=await Promise.all([t.instance&&k({options:{headers:{Accept:"text/html"}},url:dt({...t,version:t.instance}),validator:r}).catch(s=>s),k({url:dt(t),validator:r}).catch(s=>s)]),n=o.find(s=>s&&"isCached"in s&&s);if(!n||n instanceof Error)throw o.find(a=>a&&a instanceof Error)||new Error("Can not fetch component");return o[0]==n&&console.log("Using fork!",o),i(n.response),M({...n,callback:i}).catch(s=>{if(o[0]==n&&(B({...n,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),M({...o[1],callback:i});throw s})}async function z(t,e){return Z(jt(t),{headers:{Accept:"text/css"}},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(e)})}function Bt(t,e){let r=document.createElement("div");r.innerHTML=t;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return R(i,e),r}function ht(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function ut(t){return ht(t)+".*"}function pt(t){let e=t.getAttribute("data-path-scope");for(var r=0,i=t;i=i.previousElementSibling;)i.getAttribute("data-path-scope")==e&&r++;return r}function Vt(t,e,r){let i=t.getAttribute("data-path-scope");if(i==null)return;var o=pt(t);if(o!=0)return;let n=t.parentElement;if(n!=null){e==0?t.setAttribute("hidden","hidden"):t.getAttribute("hidden")!=null&&t.removeAttribute("hidden");for(var s=o+1,a=t,d=t;d=d.nextElementSibling;)d.getAttribute("data-path-scope")==i&&(s++,a=d);for(var l=s;l<e;l++)n.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var l=Math.max(1,e);l<s;l++)a=a.previousElementSibling,n.removeChild(a.nextElementSibling)}}function et(t,e,r=!1,i=t){var o=e;let n=Object.keys(t).sort((a,d)=>d.length-a.length);for(let a of n)if(e.startsWith(a)){if(a==e){if(r)return t[a];continue}o=e.substring(a.length+1),i=t[a];break}var s=p({path:o,json:i});return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[o.replace(/^.*?\./,"_."),o.replace(/^.*?\./,""),o.replace(/^([^.]+).*?\.\$\./,"$1."),o.replace(/^.*?\.\$\./,"_."),o.replace(/^.*?\.\$\./,"")].filter((a,d,l)=>l.indexOf(a)===d).reduce((a,d)=>a.length>0?a:p({path:d,json:i}),[])),r&&Array.isArray(s)?s[0]:s}function S(t,e,r,i){var o;if(t){var n=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=N(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(t,e,r));var s=e.replace("data-path-","");if(e=="data-path-src")n=t.tagName=="IMG"?t:t.querySelector("img, video");else if(e=="data-path-href")n=t.querySelector("a")||t.closest("a");else if(e=="data-path-alt")n=t.querySelector("img, picture");else if(e=="data-path-hidden")r=r?null:!0;else if(e=="data-path"||e=="data-embed-html"||e=="html")s="innerHTML";else if(e=="data-embed-src")H(t,r);else if(e=="data-path-attributes"){let h=((o=t.getAttribute("data-attributes-keys"))===null||o===void 0?void 0:o.split(",").filter(Boolean))||[];for(var a in r){var d=r[a];S(t,a,typeof d=="object"&&d?JSON.stringify(d):d,i)}for(var l=0;l<h.length;l++)(r==null||!(h[l]in r))&&S(t,h[l],null,i);S(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!n){var u=String(t.getAttribute("data-path-placeholder")||n[s]);r!=null?s=="innerHTML"?n.innerHTML!=r&&(n.innerHTML=r):n.getAttribute(s)!=r&&n.setAttribute(s,r):s=="innerHTML"?n.innerHTML=u:n.removeAttribute(s)}}}function ft(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let o=i.target,n=o.getAttribute("data-embed-src");n&&H(o,n),i.addedNodes&&i.addedNodes.forEach(s=>{s.nodeType==1&>(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function gt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let o=r[i];H(o,o.getAttribute("data-embed-src"))}if(e)return ft(t)}function H(t,e){for(var r=t;r;r=r.parentElement)if(!r.parentElement){let o=r.querySelectorAll("script");for(var i=0;i<o.length;i++)if(o[i].getAttribute("src")==e)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let n=r.ownerDocument.createElement("script");n.type="module",n.src=e,r.appendChild(n);break}}var ct=["data-attributes-keys","data-path-attributes","data-path-scope"];function R(t,e,r,i){var o,n,s;let a=t;if(i||(e=((o=r==null?void 0:r.processData)===null||o===void 0?void 0:o.call(r,a,e))||e),a.nodeType==1){let l=a.getAttribute("data-path-scope");if(l){let h=pt(a),f=et(e,l,!1)||[];h==0&&Vt(a,((n=r==null?void 0:r.shouldRepeat)===null||n===void 0?void 0:n.call(r,a,f))===!1?1:f.length,r),e={...e,[ut(l)]:f[h]}}let u=Array.prototype.slice.call(a.attributes).sort((h,f)=>ct.indexOf(h.name)-ct.indexOf(f.name));for(var d=0;d<u.length;d++){let{name:h,value:f}=u[d];h.startsWith("data-path")&&h!="data-path-scope"&&S(a,h,et(e,f,!0),r),h=="data-embed-src"&&S(a,h,a.getAttribute(h),r)}}for(var d=0;d<a.children.length;d++)R(a.children[d],e,r,!0);return i||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,e),a}function L(t,e,r,i){var o;let n=((o=i==null?void 0:i.processTemplate)===null||o===void 0?void 0:o.call(i,t,e,r))||e;if(t.innerHTML=n,t.classList.add("-feaas"),(t.closest(".component.feaas")||t).className.includes("-theme--"))for(let a of t.children)a.className=a.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1");return R(t,r,i)}function zt(t,e){return bt(t,e||(e=document.createElement("style"))),e}function bt(t,e){return e||(e=document.createElement("style")),z(t,r=>{e.textContent=r}).then(()=>e)}function Ht(t,e){return yt(t,e||(e=document.createElement("div"))),e}async function yt(t,e){return e||(e=document.createElement("div")),e.childNodes.length?R(e,t.data,t):"template"in t?L(e,t.template,t.data,t):V(t,r=>L(e,r,t.data,t)).then(()=>e)}function tt(t,e={},r){return r?`<${r}${Object.entries(e).map(([i,o])=>o!=null&&` ${i}="${o}"`).filter(Boolean).join("")}>${N(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):N(t)}function N(t){var e;if(Array.isArray(t))return t.map(N).join(`
|
|
2
|
-
`).trim();if(typeof
|
|
1
|
+
var Lt=Object.create;var j=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var $t=Object.getPrototypeOf,Ft=Object.prototype.hasOwnProperty;var It=(e,t)=>{for(var r in t)j(e,r,{get:t[r],enumerable:!0})},lt=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Nt(t))!Ft.call(e,o)&&o!==r&&j(e,o,{get:()=>t[o],enumerable:!(i=Dt(t,o))||i.enumerable});return e};var Ut=(e,t,r)=>(r=e!=null?Lt($t(e)):{},lt(t||!e||!e.__esModule?j(r,"default",{value:e,enumerable:!0}):r,e)),Wt=e=>lt(j({},"__esModule",{value:!0}),e);var Jt={};It(Jt,{Base:()=>y,Component:()=>N,FEAASBase:()=>y,FEAASComponent:()=>N,FEAASComponentsProps:()=>vt,FEAASContext:()=>U,FEAASContextProps:()=>Rt,FEAASEditor:()=>F,FEAASEditorProps:()=>wt,FEAASLoader:()=>$,FEAASLoaderProps:()=>At,FEAASPicker:()=>I,FEAASPickerProps:()=>xt,FEAASStylesheet:()=>J,FEAASStylesheetProps:()=>Et,JSONPath:()=>p,Loader:()=>$,MyComponent:()=>B,Stylesheet:()=>J,autoloadScripts:()=>bt,cleanCollectionBit:()=>ut,fetchAndRevalidate:()=>tt,fetchAndValidate:()=>R,getFramePosition:()=>Ct,invalidateRequest:()=>V,loadScript:()=>q,normalizeCollectionScope:()=>pt,observeDOMElement:()=>gt,queryScopes:()=>rt,refetchAndValidate:()=>M,renderComponent:()=>qt,renderComponentElement:()=>Vt,renderComponentPromise:()=>mt,renderDOMContent:()=>L,renderDOMElement:()=>k,renderStylesheet:()=>Ht,renderStylesheetPromise:()=>yt,serializeCH1RichText:()=>D,setDOMAttribute:()=>_});module.exports=Wt(Jt);var jt=typeof HTMLElement=="undefined"?class{}:HTMLElement,y=class extends jt{getProps(t){return{}}constructor(){super(),this.connected=!1,this.refs={},this.descendants=[],this.onLoad=t=>{t!=null&&(this.payload=t,this.update())},this.addEventListener("feaasConnected",this),this.addEventListener("feaasDisconnected",this)}getRoot(){return this}attributeChangedCallback(t,r,i){this.set()}connectedCallback(){this.initialize()}initialize(){let t=this.getParent();if(!(t&&!t.connected)&&!this.connected)return this.connected=!0,console.log("FEAAS: Connected",this.tagName,this),this.dispatchEvent(new Event("feaasConnected",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var i;return(i=r.initialize)===null||i===void 0?void 0:i.call(r)}),this.set(),!0}getParent(t=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!t||r.tagName.startsWith("FEAAS-"))return r}getElements(t=this.getRoot(),r=!0){return Array.from(t.querySelectorAll("*")).map(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.shadowRoot,r):null]).flat().filter(Boolean)}disconnectedCallback(){this.connected&&(console.log("FEAAS: Disconnected",this),this.dispatchEvent(new Event("feaasDisconnected",{bubbles:!0,composed:!0})),this.connected=null)}handleEvent(t){let r=t.composedPath()[0];switch(t.type){case"feaasConnected":r!=this&&this.nestedCallback(r);break;case"feaasDisconnected":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(t){let r=this.descendants.indexOf(t);r!=-1&&(console.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),console.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}async reify(){this.payload!==void 0?this.update():this.isReadyToLoad()&&(this.payload=null,this.load().then(this.onLoad))}load(){return Promise.resolve(null)}update(t=!1){var r,i,o;if(console.log("FEAAS: React",this.tagName,this.payload),this.payload==null)return;let{React:s,ReactDOM:n,ReactDOMClient:a}=this.payload||{};if(!s)throw new Error(`${this.tagName}: React is not present in payload`);if(!n)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?a?(this.reactRoot||(this.reactRoot=a.createRoot(this.getReactRootElement())),this.reactRoot.render(s.createElement(this.getReactWrapper()))):n.render(s.createElement(this.getReactWrapper()),this.getReactRootElement()):this.forceUpdateReact?(r=this.forceUpdateReact)===null||r===void 0||r.call(this):(o=(i=this.refs.topReact).forceUpdateReact)===null||o===void 0||o.call(i)}invokeReactRendering(){let{React:t,ReactDOM:r}=this.payload||{},i=this.descendants.filter(o=>o.refs.parentReact==this&&o.payload).map((o,s)=>t.createElement(this.getReactWrapper(o),{key:o.tagName+"-"+o.getUID(),slot:o.getAttribute("slot")}));return this.render({...this.props,children:i},this.payload)}getReactWrapper(t=this,r=t.tagName){let i=t.reactWrapper||(t.reactWrapper=o=>{if(t.render){let{React:s,ReactDOM:n}=t.payload||{},[a,d]=s.useReducer(l=>l+1,0);return t.forceUpdateReact=d,n.createPortal(s.createElement(s.Fragment,null,t.invokeReactRendering()),t.getReactRootElement())}else return t.update()});return Object.assign(i,{key:this.tagName+"-"+this.getUID(),displayName:r}),i}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){this.overrides={...this.overrides,...t},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let i=this.props[r];this.props[r]==null?this.removeAttribute(r):(typeof i=="string"||typeof i=="number")&&this.getAttribute(r)!=String(i)&&this.setAttribute(r,String(i))}this.scheduleRender()}scheduleRender(){cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.reify()})}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){typeof window!="undefined"&&!window.customElements.get(t)&&window.customElements.define(t,this)}};var S=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)}},B=class extends S{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:t},{React:r}){let[i,o]=r.useState(0);return r.useEffect(()=>{o(s=>s+1)},[t]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",t),r.createElement("p",null,"Triggered updates: ",i))}};B.observedAttributes=["counter"];var dt=Ut(require("vm"),1),{hasOwnProperty:v}=Object.prototype;function x(e,t){return e=e.slice(),e.push(t),e}function X(e,t){return t=t.slice(),t.unshift(e),t}var Z=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,o){if(!(this instanceof p))try{return new p(e,t,r,i,o)}catch(n){if(!n.avoidNew)throw n;return n.value}typeof e=="string"&&(o=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=v.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||o||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){let n={path:s?e.path:t};s?"json"in e&&(n.json=e.json):n.json=r;let a=this.evaluate(n);if(!a||typeof a!="object")throw new Z(a);return a}}p.prototype.evaluate=function(e,t,r,i){let o=this.parent,s=this.parentProperty,{flatten:n,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(!v.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),n=v.call(e,"flatten")?e.flatten:n,this.currResultType=v.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=v.call(e,"sandbox")?e.sandbox:this.currSandbox,a=v.call(e,"wrap")?e.wrap:a,this.currPreventEval=v.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=v.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=v.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,o=v.call(e,"parent")?e.parent:o,s=v.call(e,"parentProperty")?e.parentProperty:s,e=e.path}if(o=o||null,s=s||null,Array.isArray(e)&&(e=p.toPathString(e)),!e&&e!==""||!t)return;let d=p.toPathArray(e);d[0]==="$"&&d.length>1&&d.shift(),this._hasParentSelector=null;let l=this._trace(d,t,["$"],o,s,r).filter(function(u){return u&&!u.isParentSelector});return l.length?!a&&l.length===1&&!l[0].hasArrExpr?this._getPreferredOutput(l[0]):l.reduce((u,h)=>{let f=this._getPreferredOutput(h);return n&&Array.isArray(f)?u=u.concat(f):u.push(f),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,o,s,n,a){let d;if(!e.length)return d={path:r,value:t,parent:i,parentProperty:o,hasArrExpr:n},this._handleCallback(d,s,"value"),d;let l=e[0],u=e.slice(1),h=[];function f(c){Array.isArray(c)?c.forEach(g=>{h.push(g)}):h.push(c)}if((typeof l!="string"||a)&&t&&v.call(t,l))f(this._trace(u,t[l],x(r,l),t,l,s,n));else if(l==="*")this._walk(t,c=>{f(this._trace(u,t[c],x(r,c),t,c,s,!0,!0))});else if(l==="..")f(this._trace(u,t,r,i,o,s,n)),this._walk(t,c=>{typeof t[c]=="object"&&f(this._trace(e.slice(),t[c],x(r,c),t,c,s,!0))});else{if(l==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:u,isParentSelector:!0};if(l==="~")return d={path:x(r,l),value:o,parent:i,parentProperty:null},this._handleCallback(d,s,"property"),d;if(l==="$")f(this._trace(u,t,r,null,null,s,n));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(l))f(this._slice(l,u,t,r,i,o,s));else if(l.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let c=l.replace(/^\?\((.*?)\)$/u,"$1");this._walk(t,g=>{this._eval(c,t[g],g,r,i,o)&&f(this._trace(u,t[g],x(r,g),t,g,s,!0))})}else if(l[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");f(this._trace(X(this._eval(l,t,r[r.length-1],r.slice(0,-1),i,o),u),t,r,i,o,s,n))}else if(l[0]==="@"){let c=!1,g=l.slice(1,-2);switch(g){case"scalar":(!t||!["object","function"].includes(typeof t))&&(c=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===g&&(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===g&&(c=!0);break;case"array":Array.isArray(t)&&(c=!0);break;case"other":c=this.currOtherTypeCallback(t,r,i,o);break;case"null":t===null&&(c=!0);break;default:throw new TypeError("Unknown value type "+g)}if(c)return d={path:r,value:t,parent:i,parentProperty:o},this._handleCallback(d,s,"value"),d}else if(l[0]==="`"&&t&&v.call(t,l.slice(1))){let c=l.slice(1);f(this._trace(u,t[c],x(r,c),t,c,s,n,!0))}else if(l.includes(",")){let c=l.split(",");for(let g of c)f(this._trace(X(g,u),t,r,i,o,s,!0))}else!a&&t&&v.call(t,l)&&f(this._trace(u,t[l],x(r,l),t,l,s,n,!0))}if(this._hasParentSelector)for(let c=0;c<h.length;c++){let g=h[c];if(g&&g.isParentSelector){let w=this._trace(g.expr,t,g.path,i,o,s,n);if(Array.isArray(w)){h[c]=w[0];let K=w.length;for(let A=1;A<K;A++)c++,h.splice(c,0,w[A])}else h[c]=w}}return h};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,o,s,n){if(!Array.isArray(r))return;let a=r.length,d=e.split(":"),l=d[2]&&Number.parseInt(d[2])||1,u=d[0]&&Number.parseInt(d[0])||0,h=d[1]&&Number.parseInt(d[1])||a;u=u<0?Math.max(0,u+a):Math.min(a,u),h=h<0?Math.max(0,h+a):Math.min(a,h);let f=[];for(let c=u;c<h;c+=l)this._trace(X(c,t),r,i,o,s,n,!0).forEach(w=>{f.push(w)});return f};p.prototype._eval=function(e,t,r,i,o,s){this.currSandbox._$_parentProperty=s,this.currSandbox._$_parent=o,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;let n=e.includes("@path");n&&(this.currSandbox._$_path=p.toPathString(i.concat([r])));let a="script:"+e;if(!p.cache[a]){let d=e.replace(/@parentProperty/gu,"_$_parentProperty").replace(/@parent/gu,"_$_parent").replace(/@property/gu,"_$_property").replace(/@root/gu,"_$_root").replace(/@([.\s)[])/gu,"_$_v$1");n&&(d=d.replace(/@path/gu,"_$_path")),p.cache[a]=new this.vm.Script(d)}try{return p.cache[a].runInNewContext(this.currSandbox)}catch(d){throw new Error("jsonPath: "+d.message+": "+e)}};p.cache={};p.toPathString=function(e){let t=e,r=t.length,i="$";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(t[o])||(i+=/^[0-9*]+$/u.test(t[o])?"["+t[o]+"]":"['"+t[o]+"']");return i};p.toPointer=function(e){let t=e,r=t.length,i="";for(let o=1;o<r;o++)/^(~|\^|@.*?\(\))$/u.test(t[o])||(i+="/"+t[o].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=[],o=e.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replace(/[['](\??\(.*?\))[\]']/gu,function(s,n){return"[#"+(r.push(n)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(s,n){return"['"+n.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(s,n){return";"+n.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"").split(";").map(function(s){let n=s.match(/#(\d+)/u);return!n||!n[1]?s:r[n[1]]});return t[e]=o,t[e].concat()};p.prototype.vm=dt.default;async function tt(e,t,r,i){return R({url:e,options:t,validator:r,callback:i}).then(M).then(o=>o.response)}async function R({url:e,options:t,validator:r,callback:i},o="initial"){let s=new Date,n=await fetch(e,t);if(!n.ok)throw new Error("Fetch failed");if((r==null?void 0:r(n))===!1)throw new Error("Response is not valid");let a=new Date(n.headers.get("date"))<s;return i==null||i(n,o),{url:e,options:t,isCached:a,response:n,validator:r}}async function M(e){let{url:t,isCached:r,options:i,validator:o,response:s,callback:n}=e;if(r){let{response:a}=await R({url:t+"?"+Math.random(),options:{...i,method:"HEAD",cache:"no-cache"},validator:o},"check");if(a.headers.get("last-modified")!=s.headers.get("last-modified"))return V(e)}return e}async function V(e){let{url:t,options:r,validator:i,callback:o}=e;return R({url:t,options:{...r,cache:"reload"},validator:i,callback:o},"updated")}function ct({cdn:e="https://feaascomponentsapidev.blob.core.windows.net",hostname:t,library:r,component:i,version:o,revision:s="published"}){return`${e||t}/components/${r}/${i}/${o}/${s}.html`}function Bt({cdn:e="https://feaascomponentsapidev.blob.core.windows.net",hostname:t,library:r,revision:i="published"}){return`${e||t}/styles/${r}/${i}.css`}async function z(e,t){let r=n=>n.headers.get("x-ms-meta-versionDeletedAt")==null,i=n=>{n.text().then(t)},o=await Promise.all([e.instance&&R({options:{headers:{Accept:"text/html"}},url:ct({...e,version:e.instance}),validator:r}).catch(n=>n),R({url:ct(e),validator:r}).catch(n=>n)]),s=o.find(n=>n&&"isCached"in n&&n);if(!s||s instanceof Error)throw o.find(a=>a&&a instanceof Error)||new Error("Can not fetch component");return o[0]==s&&console.log("Using fork!",o),i(s.response),M({...s,callback:i}).catch(n=>{if(o[0]==s&&(V({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),M({...o[1],callback:i});throw n})}async function H(e,t){return tt(Bt(e),{headers:{Accept:"text/css"}},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(t)})}function Vt(e,t){let r=document.createElement("div");r.innerHTML=e;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return k(i,t),r}function ut(e){return e.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function pt(e){return ut(e)+".*"}function ft(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 zt(e,t,r){let i=e.getAttribute("data-path-scope");if(i==null)return;var o=ft(e);if(o!=0)return;let s=e.parentElement;if(s!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var n=o+1,a=e,d=e;d=d.nextElementSibling;)d.getAttribute("data-path-scope")==i&&(n++,a=d);for(var l=n;l<t;l++)s.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var l=Math.max(1,t);l<n;l++)a=a.previousElementSibling,s.removeChild(a.nextElementSibling)}}function rt(e,t,r=!1,i=e){var o=t;let s=Object.keys(e).sort((a,d)=>d.length-a.length);for(let a of s)if(t.startsWith(a)){if(a==t){if(r)return e[a];continue}o=t.substring(a.length+1),i=e[a];break}var n=p({path:o,json:i});return Array.isArray(n)&&(n==null?void 0:n.length)==0&&(n=[o.replace(/^.*?\./,"_."),o.replace(/^.*?\./,""),o.replace(/^([^.]+).*?\.\$\./,"$1."),o.replace(/^.*?\.\$\./,"_."),o.replace(/^.*?\.\$\./,""),o.replace(/^[^.]+$/,"_")].filter((a,d,l)=>l.indexOf(a)===d).reduce((a,d)=>a.length>0?a:p({path:d,json:i}),[])),r&&Array.isArray(n)?n[0]:n}function _(e,t,r,i){var o;if(e){var s=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=D(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(e,t,r));var n=t.replace("data-path-","");if(t=="data-path-src")s=e.tagName=="IMG"?e:e.querySelector("img, video");else if(t=="data-path-href")s=e.querySelector("a")||e.closest("a");else if(t=="data-path-alt")s=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")n="innerHTML";else if(t=="data-embed-src")q(e,r);else if(t=="data-path-attributes"){let h=((o=e.getAttribute("data-attributes-keys"))===null||o===void 0?void 0:o.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var a in r){var d=r[a];_(e,a,typeof d=="object"&&d?JSON.stringify(d):d,i)}for(var l=0;l<h.length;l++)(r==null||!(h[l]in r))&&_(e,h[l],null,i);_(e,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!s){var u=String(e.getAttribute("data-path-placeholder")||s[n]);r!=null?n=="innerHTML"?s.innerHTML!=r&&(s.innerHTML=r):s.getAttribute(n)!=r&&s.setAttribute(n,r):n=="innerHTML"?s.innerHTML=u:s.removeAttribute(n)}}}function gt(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let o=i.target,s=o.getAttribute("data-embed-src");s&&q(o,s),i.addedNodes&&i.addedNodes.forEach(n=>{n.nodeType==1&&bt(n,!1)})})});return t.observe(e,{attributes:!0,subtree:!0,childList:!0}),t}function bt(e,t=!0){let r=e.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let o=r[i];q(o,o.getAttribute("data-embed-src"))}if(t)return gt(e)}function q(e,t){for(var r=e;r;r=r.parentElement)if(!r.parentElement){let o=r.querySelectorAll("script");for(var i=0;i<o.length;i++)if(o[i].getAttribute("src")==t)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let s=r.ownerDocument.createElement("script");s.type="module",s.src=t,r.appendChild(s);break}}var ht=["data-attributes-keys","data-path-attributes","data-path-scope"];function k(e,t,r,i){var o,s,n;let a=e;if(i||(t=((o=r==null?void 0:r.processData)===null||o===void 0?void 0:o.call(r,a,t))||t),a.nodeType==1){let l=a.getAttribute("data-path-scope");if(l){let h=ft(a),f=rt(t,l,!1)||[];h==0&&zt(a,((s=r==null?void 0:r.shouldRepeat)===null||s===void 0?void 0:s.call(r,a,f))===!1?1:f.length,r),t={...t,[pt(l)]:f[h]}}let u=Array.prototype.slice.call(a.attributes).sort((h,f)=>ht.indexOf(h.name)-ht.indexOf(f.name));for(var d=0;d<u.length;d++){let{name:h,value:f}=u[d];h.startsWith("data-path")&&h!="data-path-scope"&&_(a,h,rt(t,f,!0),r),h=="data-embed-src"&&_(a,h,a.getAttribute(h),r)}}for(var d=0;d<a.children.length;d++)k(a.children[d],t,r,!0);return i||(n=r==null?void 0:r.onRender)===null||n===void 0||n.call(r,a,t),a}function L(e,t,r,i){var o;let s=((o=i==null?void 0:i.processTemplate)===null||o===void 0?void 0:o.call(i,e,t,r))||t;if(e.innerHTML=s,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(let a of e.children)a.className=a.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1");return k(e,r,i)}function Ht(e,t){return yt(e,t||(t=document.createElement("style"))),t}function yt(e,t){return t||(t=document.createElement("style")),H(e,r=>{t.textContent=r}).then(()=>t)}function qt(e,t){return mt(e,t||(t=document.createElement("div"))),t}async function mt(e,t){return t||(t=document.createElement("div")),t.childNodes.length?k(t,e.data,e):"template"in e?L(t,e.template,e.data,e):z(e,r=>L(t,r,e.data,e)).then(()=>t)}function et(e,t={},r){return r?`<${r}${Object.entries(t).map(([i,o])=>o!=null&&` ${i}="${o}"`).filter(Boolean).join("")}>${D(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):D(e)}function D(e){var t;if(Array.isArray(e))return e.map(D).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 et(e.content,i,"h"+r);case"text":return(e.marks||[]).reduce((o,s)=>et(o,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 et(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}function vt(e=this){let t,r=e.getAttribute("data");if(r!=null)try{t=typeof r=="string"?JSON.parse(r):{}}catch(i){}return{data:t!=null?t:{},library:e.getAttribute("library"),component:e.getAttribute("component"),version:e.getAttribute("version"),revision:e.getAttribute("revision"),hostname:e.getAttribute("hostname"),cdn:e.getContextAttribute("cdn"),template:e.getAttribute("template"),instance:e.getAttribute("instance"),editable:e.getAttribute("editable")!=null,suspended:e.getAttribute("suspended")!=null}}var N=class extends y{setData(t){this.set({data:t})}getProps(){return vt(this)}attributeChangedCallback(t,r,i){r!==i&&(this.payload=void 0,this.needsRefresh=!0,super.attributeChangedCallback(t,r,i))}getEditor(){var t;return(t=document.querySelector("feaas-context"))===null||t===void 0?void 0:t.refs.editor}constructor(){super(),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())try{z(this.props,this.onLoad)}catch(t){console.error(`FEAAS: Could not fetch component: ${this.props.component}/${this.props.version}/${this.props.revision}`)}}update(){if(Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)k(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;L(this,this.payload,this.props.data)}}};N.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable"];N.register("feaas-component");function At(e=this){return{opacity:e!=null&&e.getAttribute("opacity")?parseFloat(e==null?void 0:e.getAttribute("opacity")):1,hidden:(e==null?void 0:e.getAttribute("hidden"))!=null}}var $=class extends y{getProps(){return At(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,5 +63,5 @@ var Mt=Object.create;var j=Object.defineProperty;var Lt=Object.getOwnPropertyDes
|
|
|
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)}};$.observedAttributes=["hidden","opacity"];$.register("feaas-loader");function At(t=this){var e;return{library:t==null?void 0:t.getContextAttribute("library"),revision:(e=t==null?void 0:t.getAttribute("revision"))!==null&&e!==void 0?e:"published",cdn:(t==null?void 0:t.getContextAttribute("cdn"))||(t==null?void 0:t.getContextAttribute("hostname"))}}var q=class extends y{getProps(){return At(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}async load(){z(this.props,this.onLoad)}update(){this.stylesheet||(this.stylesheet=document.createElement("style"),this.appendChild(this.stylesheet)),this.stylesheet.textContent=this.payload}};q.register("feaas-stylesheet");var rt;typeof window!="undefined"&&(window.FEAASElement=O,(rt=window.FEAASLoading)!==null&&rt!==void 0||(window.FEAASLoading=Promise.resolve()));function Et(t){let e=[];if(t){let r=t.ownerDocument.defaultView,i,o;for(;r!==window.top;){i=r.parent;for(let n=0;n<i.frames.length;n++)if(i.frames[n]===r){for(let s of i.document.getElementsByTagName("iframe"))if(s.contentWindow===r){o=s.getBoundingClientRect();let a=s.contentWindow.getComputedStyle(s);e.push({left:o.left+parseInt(a.borderLeftWidth),top:o.top+parseInt(a.borderTopWidth)})}r=i;break}}}return e.reduce((r,i)=>({left:r.left+i.left,top:r.top+i.top}),{left:0,top:0})}function Ct(t=this){var e;return{context:HTMLElement,frontend:t==null?void 0:t.getContextAttribute("frontend"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/editor.js",library:t==null?void 0:t.getAttribute("library"),component:t==null?void 0:t.getAttribute("component"),version:t==null?void 0:t.getAttribute("version"),instance:t==null?void 0:t.getAttribute("instance"),forked:t==null?void 0:t.getAttribute("forked"),revision:(t==null?void 0:t.getAttribute("revision"))||"saved",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,for:t==null?void 0:t.getAttribute("for"),state:(t==null?void 0:t.getAttribute("state"))||"idle",changed:(t==null?void 0:t.getAttribute("changed"))!=null}}var F=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.setTarget=(e,r={component:e.getAttribute("component"),version:e.getAttribute("version"),revision:e.getAttribute("revision"),instance:e.getAttribute("instance")})=>{if(!this.closing&&(!this.target||e==null))return this.set(r),this.target=e,!0},this.onChromeMeasureElement=(e,r=e.getBoundingClientRect())=>e.ownerDocument==document?{left:r.left-this.bodyRect.left,top:r.top-this.bodyRect.top,width:r.width,height:r.height}:{left:r.left+this.framePoint.left-this.bodyRect.left,top:r.top+this.framePoint.top-this.bodyRect.top,width:r.width,height:r.height},this.onBeforeMeasure=e=>{e.memoized.focusable&&(this.framePoint=Et(e.memoized.focusable)),this.chrome&&(this.wrapperRect=this.chrome.positionable.getBoundingClientRect(),this.bodyRect=this.chrome.positionable.ownerDocument.body.parentElement.getBoundingClientRect())},this.onMeasure=()=>{},this.onPosition=({focusable:e,root:r})=>{!this.chrome||this.props.hidden||(e?(this.chrome.wrapper.style.width=e.width+16*2+"px",this.chrome.wrapper.style.height=e.height+16*1+64+"px",this.chrome.wrapper.style.left=e.left-16+"px",this.chrome.wrapper.style.top=e.top-64+"px",this.chrome.wrapper.style.opacity="1",this.chrome.absolute=this.querySelector(".ui.overlays"),this.chrome.absolute&&(this.chrome.absolute.style.left=r.left+"px",this.chrome.absolute.style.top=r.top+"px")):(this.chrome.wrapper.style.opacity="0",this.chrome.wrapper.style.left="-1000px",this.chrome.wrapper.style.top="-1000px"))},this.onWindowMessage=e=>{var r;switch((r=e.data)===null||r===void 0?void 0:r.type){case"feaasEdit":let i=this.getPlaceholder();this.setTarget(i.editable,e.data)&&(this.loader=i.loader,document.body.appendChild(i.clipper),this.editedUID=e.data.id,this.setPlaceholder(),this.open());break;case"feaasMeasurements":this.measurements=e.data.measurements,this.props.hidden||this.setPlaceholder();break}},this.onContentChange=()=>{this.setAttribute("changed","changed"),requestAnimationFrame(()=>{this.setIframeComponentContent()})},this.onClose=()=>{var e;this.setAttribute("hidden","hidden"),this.placeholder&&(this.placeholder.positionable.style.opacity="0",this.placeholder.positionable.style.pointerEvents="none"),this.chrome&&(this.chrome.wrapper.style.opacity="0"),!((e=this.target)===null||e===void 0)&&e.parentNode&&(this.target.outerHTML=this.target.outerHTML),this.setTarget(null,{component:null,version:null,instance:null,revision:null}),this.setEditorContext({isFocused:!1})},this.onVersionStateChange=(e,r)=>{this.versionContext=e,this.setVersionContext=r},this.onEditorStateChange=(e,r)=>{this.editorContext=e,this.setEditorContext=r,e.editor&&this.props.state=="loading"&&!this.props.hidden&&(this.setAttribute("state","ready"),this.ownerDocument.fonts.ready.then(()=>setTimeout(()=>{this.setReadyState(),this.setIframeComponentContent()},100)))}}getProps(){return Ct(this)}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}showLoader(){this.loader||(this.loader=document.createElement("feaas-loader"),this.loader.setAttribute("opacity","0.6"),this.loader.style.zIndex="1000",this.target.appendChild(this.loader),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative"))}hideLoader(){this.loader&&(this.loader.setAttribute("hidden","hidden"),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative",this.target.style.position=""))}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.onWindowMessage)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.onWindowMessage)}setIframe(e){this.iframe=e}setIframeComponentContent(){this.placeholder&&this.iframe&&this.placeholder.editable.innerHTML&&this.iframe.contentWindow.postMessage({type:"feaasUpdate",id:this.editedUID,content:this.placeholder.editable.innerHTML})}setPlaceholder(){let e=this.iframe.clientWidth,r=this.iframe.clientHeight,i=this.iframe.getBoundingClientRect(),o=this.getPlaceholder(),n=document.body.getBoundingClientRect(),s=this.measurements[this.editedUID];s&&(Object.assign(o.clipper.style,{position:"absolute",top:i.top+this.iframe.clientTop-n.top+"px",left:i.left+this.iframe.clientLeft-n.left+"px",width:e+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(o.positionable.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(o.loader.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",height:s.height+"px",filter:"opacity(0.6)",zIndex:3,pointerEvents:"none"}),document.dispatchEvent(new Event("feaasRefresh",{bubbles:!0})))}getPlaceholder(){return this.placeholder?this.placeholder:(this.placeholder={clipper:document.createElement("div"),positionable:document.createElement("div"),editable:Object.assign(document.createElement("div"),{className:"-feaas"}),loader:document.createElement("feaas-loader")},this.placeholder.clipper.appendChild(this.placeholder.positionable),this.placeholder.positionable.appendChild(this.placeholder.editable),this.placeholder.clipper.appendChild(this.placeholder.loader),this.placeholder)}attributeChangedCallback(e,r,i){r!==i&&(e=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(e,r,i))}open(){clearTimeout(this.closing),this.removeAttribute("hidden"),this.removeAttribute("changed"),this.setLoadingState()}shouldFork(e){return e.forkOriginId==null&&this.props.instance!=null}cleanup(){var e;this.placeholder&&((e=this.placeholder.clipper)===null||e===void 0||e.remove(),this.placeholder=null)}close(){console.log("Editor is not ready")}unfork(){console.log("Editor is not ready")}discard(){console.log("Editor is not ready")}save(){console.log("Editor is not ready")}setVersionContext(e){console.log("Editor is not ready")}setEditorContext(e){console.log("Editor is not ready")}setLoadingState(){this.showLoader(),this.setAttribute("state","loading")}setReadyState(){this.hideLoader(),this.setEditorContext({activeVersionId:this.component.versions[0].id}),this.setAttribute("state","ready")}render({children:e,component:r,version:i,instance:o},{Editor:n,VersionStatusList:s,VersionStatusButton:a,Version:d,VersionMenu:l,EditorUIUndo:u,EditorUIMode:h,React:{useEffect:f,useMemo:c,useState:g,useContext:w},Chakra:{HStack:J,Box:A,Button:it,MenuItem:ot},Chrome:kt,ReactDOM:Jt,useSDK:Rt,useSlots:St,useModelObserver:_t,ConfirmationContext:Pt,VersionContext:Kt}){if(!this.payload)return;let{React:b}=this.payload,{sdk:W}=Rt(),[m,nt]=g(),{setConfirm:K}=w(Pt),_=o||i,Tt=W.library;m&&(this.component=m),f(()=>{if(this.props.hidden)return;let C=Tt.components.getItem(r).clone();return C.versions.search({ids:[i,o].filter(Boolean),componentIds:[r]}).then(G=>{C.versions.setItems(G);let E=C.findVersion(o,["staged","published"]),T=C.findVersion(i,["staged","published"]);if(E)E.deletedAt?(E.getDraft().changeAndNotify(T.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",E.id));else if(this.removeAttribute("forked"),this.shouldFork(T)){console.error("FEAAS Editor: Forking");let Y=T.fork(o).id;this.setAttribute("instance",Y)}else console.error("FEAAS Editor: Regular");nt(C)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),nt(null)},400)}},[i,this.props.hidden]);let st=_t(m==null?void 0:m.versions,[]).filter(C=>C.id==_),P=st[0];P&&!this.props.hidden&&(this.version=P),f(()=>(this.unfork=()=>{K({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let C=m.findVersion(i,["staged","published"]);m.findVersion(o).unstage().unpublish().changeAndNotify(C.toProperties()),m.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(m.findVersion(_).revert(),m.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{K({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=()=>{K({bypass:!!this.props.forked,title:"Customizing component",button:"Save",body:"Changes to the component will only be visible on that page. Changes to component done in Component Builder will not be reflected here. It will be possible to revert the customization.",action:()=>{m.findVersion(_).commitData({view:this.editorContext.editor.getData({rootName:_}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",_),m.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[m]);let Ot=c(()=>this.target,[m]);return c(()=>m&&St(e,({picker:C,children:G})=>b.createElement(A,{ref:E=>{this.chrome=E?{positionable:E,wrapper:E.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},b.createElement(A,{className:"editor-wrapper",position:"absolute",left:0,top:0},b.createElement(n,{datasources:W.datasources,sdk:W,library:W.library,component:m,versions:st,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:G,chrome:({editor:E})=>E&&b.createElement(kt,null),children:({isArchivedDisplayed:E,editor:T,status:Y})=>b.createElement(A,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},b.createElement(A,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),b.createElement(A,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),b.createElement(A,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),b.createElement(A,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),P&&b.createElement(d,{version:P,node:Ot,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:b.createElement(J,{justifyContent:"space-between"},b.createElement(u,{size:"sm",editor:Y=="ready"?T:null}),b.createElement(h,{size:"sm"})),middle:(Gt,Yt)=>[!1],right:b.createElement(b.Fragment,null,b.createElement(it,{variant:"secondary",size:"sm",onClick:this.close},"Close"),b.createElement(it,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),b.createElement(l,{isDisabled:!this.props.forked&&!this.props.changed},b.createElement(ot,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),b.createElement(ot,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[P,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};F.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];F.register("feaas-editor");function wt(t=this){var e,r;return{part:(t==null?void 0:t.getAttribute("part"))||"picker",slot:(t==null?void 0:t.getAttribute("part"))||"picker",mode:t==null?void 0:t.getAttribute("mode"),placeholder:(t==null?void 0:t.getAttribute("placeholder"))||"No theme",frontend:(e=t==null?void 0:t.getContextAttribute("frontend"))!==null&&e!==void 0?e:"https://components.sitecorecloud.io",src:(r=t==null?void 0:t.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,variant:t==null?void 0:t.getAttribute("variant"),context:void 0,onClose:void 0,onContextAttributeSet:void 0}}var I=class extends y{getProps(){return wt(this)}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}render({placeholder:e,context:r,mode:i,children:o,variant:n},{Picker:s,React:a,ReactDOM:d}){return a.createElement(s,{placeholder:e,mode:i||void 0,onClose:this.props.onClose,onContextAttributeSet:this.props.onContextAttributeSet,context:r,variant:n},o)}};I.observedAttributes=["library","mode","frontend","src","hidden","variant"];I.register("feaas-picker");function xt(t=this){var e,r,i,o;return{library:t==null?void 0:t.getAttribute("library"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/context.js",frontend:(r=t==null?void 0:t.getAttribute("frontend"))!==null&&r!==void 0?r:"https://components.sitecoreclud.io",backend:(i=t==null?void 0:t.getAttribute("backend"))!==null&&i!==void 0?i:"https://components-api.sitecoreclud.io",cdn:(o=t==null?void 0:t.getAttribute("cdn"))!==null&&o!==void 0?o:"https://feaascompontsapiprod.blob.core.windows.net",getToken:null}}var U=class extends y{getProps(){return xt(this)}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}getTheme(e){return e}getRoot(){return this.shadowRoot||this.attachShadow({mode:"open"})}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}connectedCallback(){Array.from(this.children).forEach(e=>{this.getRoot().appendChild(e)}),super.connectedCallback()}render({children:e,library:r},{AppContext:i,Chakra:{Button:o,Tooltip:n},React:s}){let a={containerRef:{current:this.getRoot()}};return n.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.createElement(i,{backend:this.props.backend,libraryId:this.props.library,container:this.getRoot(),getToken:this.props.getToken,getTheme:this.getTheme,modalProps:{portalProps:a},chakraProps:{cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},e)}};U.observedAttributes=["library","component","version","revision","hostname","template"];U.register("feaas-context");0&&(module.exports={Base,Component,FEAASBase,FEAASComponent,FEAASComponentsProps,FEAASContext,FEAASContextProps,FEAASEditor,FEAASEditorProps,FEAASLoader,FEAASLoaderProps,FEAASPicker,FEAASPickerProps,FEAASStylesheet,FEAASStylesheetProps,JSONPath,Loader,Stylesheet,autoloadScripts,cleanCollectionBit,fetchAndRevalidate,fetchAndValidate,getFramePosition,invalidateRequest,loadScript,normalizeCollectionScope,observeDOMElement,queryScopes,refetchAndValidate,renderComponent,renderComponentElement,renderComponentPromise,renderDOMContent,renderDOMElement,renderStylesheet,renderStylesheetPromise,serializeCH1RichText,setDOMAttribute});
|
|
66
|
+
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};$.observedAttributes=["hidden","opacity"];$.register("feaas-loader");function Et(e=this){var t;return{library:e==null?void 0:e.getContextAttribute("library"),revision:(t=e==null?void 0:e.getAttribute("revision"))!==null&&t!==void 0?t:"published",cdn:(e==null?void 0:e.getContextAttribute("cdn"))||(e==null?void 0:e.getContextAttribute("hostname"))}}var J=class extends y{getProps(){return Et(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}async load(){H(this.props,this.onLoad)}update(){this.stylesheet||(this.stylesheet=document.createElement("style"),this.appendChild(this.stylesheet)),this.stylesheet.textContent=this.payload}};J.register("feaas-stylesheet");var it;typeof window!="undefined"&&(window.FEAASElement=S,(it=window.FEAASLoading)!==null&&it!==void 0||(window.FEAASLoading=Promise.resolve()));function Ct(e){let t=[];if(e){let r=e.ownerDocument.defaultView,i,o;for(;r!==window.top;){i=r.parent;for(let s=0;s<i.frames.length;s++)if(i.frames[s]===r){for(let n of i.document.getElementsByTagName("iframe"))if(n.contentWindow===r){o=n.getBoundingClientRect();let a=n.contentWindow.getComputedStyle(n);t.push({left:o.left+parseInt(a.borderLeftWidth),top:o.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 wt(e=this){var t;return{context:HTMLElement,frontend:e==null?void 0:e.getContextAttribute("frontend"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/editor.js",library:e==null?void 0:e.getAttribute("library"),component:e==null?void 0:e.getAttribute("component"),version:e==null?void 0:e.getAttribute("version"),instance:e==null?void 0:e.getAttribute("instance"),forked:e==null?void 0:e.getAttribute("forked"),revision:(e==null?void 0:e.getAttribute("revision"))||"saved",hidden:(e==null?void 0:e.getAttribute("hidden"))!=null,for:e==null?void 0:e.getAttribute("for"),state:(e==null?void 0:e.getAttribute("state"))||"idle",changed:(e==null?void 0:e.getAttribute("changed"))!=null}}var F=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.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=Ct(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 wt(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(){let t=this.iframe.clientWidth,r=this.iframe.clientHeight,i=this.iframe.getBoundingClientRect(),o=this.getPlaceholder(),s=document.body.getBoundingClientRect(),n=this.measurements[this.editedUID];n&&(Object.assign(o.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(o.positionable.style,{position:"absolute",top:n.top+"px",left:n.left+"px",width:n.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(o.loader.style,{position:"absolute",top:n.top+"px",left:n.left+"px",width:n.width+"px",height:n.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:o},{Editor:s,VersionStatusList:n,VersionStatusButton:a,Version:d,VersionMenu:l,EditorUIUndo:u,EditorUIMode:h,React:{useEffect:f,useMemo:c,useState:g,useContext:w},Chakra:{HStack:K,Box:A,Button:ot,MenuItem:st},Chrome:kt,ReactDOM:Kt,useSDK:St,useSlots:_t,useModelObserver:Pt,ConfirmationContext:Tt,VersionContext:Gt}){if(!this.payload)return;let{React:b}=this.payload,{sdk:W}=St(),[m,nt]=g(),{setConfirm:G}=w(Tt),P=o||i,Ot=W.library;m&&(this.component=m),f(()=>{if(this.props.hidden)return;let C=Ot.components.getItem(r).clone();return C.versions.search({ids:[i,o].filter(Boolean),componentIds:[r]}).then(Y=>{C.versions.setItems(Y);let E=C.findVersion(o,["staged","published"]),O=C.findVersion(i,["staged","published"]);if(E)E.deletedAt?(E.getDraft().changeAndNotify(O.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",E.id));else if(this.removeAttribute("forked"),this.shouldFork(O)){console.error("FEAAS Editor: Forking");let Q=O.fork(o).id;this.setAttribute("instance",Q)}else console.error("FEAAS Editor: Regular");nt(C)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),nt(null)},400)}},[i,this.props.hidden]);let at=Pt(m==null?void 0:m.versions,[]).filter(C=>C.id==P),T=at[0];T&&!this.props.hidden&&(this.version=T),f(()=>(this.unfork=()=>{G({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let C=m.findVersion(i,["staged","published"]);m.findVersion(o).unstage().unpublish().changeAndNotify(C.toProperties()),m.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(m.findVersion(P).revert(),m.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{G({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=()=>{G({bypass:!!this.props.forked,title:"Customizing component",button:"Save",body:"Changes to the component will only be visible on that page. Changes to component done in Component Builder will not be reflected here. It will be possible to revert the customization.",action:()=>{m.findVersion(P).commitData({view:this.editorContext.editor.getData({rootName:P}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",P),m.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[m]);let Mt=c(()=>this.target,[m]);return c(()=>m&&_t(t,({picker:C,children:Y})=>b.createElement(A,{ref:E=>{this.chrome=E?{positionable:E,wrapper:E.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},b.createElement(A,{className:"editor-wrapper",position:"absolute",left:0,top:0},b.createElement(s,{datasources:W.datasources,sdk:W,library:W.library,component:m,versions:at,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:Y,chrome:({editor:E})=>E&&b.createElement(kt,null),children:({isArchivedDisplayed:E,editor:O,status:Q})=>b.createElement(A,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},b.createElement(A,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),b.createElement(A,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),b.createElement(A,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),b.createElement(A,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),T&&b.createElement(d,{version:T,node:Mt,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:b.createElement(K,{justifyContent:"space-between"},b.createElement(u,{size:"sm",editor:Q=="ready"?O:null}),b.createElement(h,{size:"sm"})),middle:(Yt,Qt)=>[!1],right:b.createElement(b.Fragment,null,b.createElement(ot,{variant:"secondary",size:"sm",onClick:this.close},"Close"),b.createElement(ot,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),b.createElement(l,{isDisabled:!this.props.forked&&!this.props.changed},b.createElement(st,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),b.createElement(st,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[T,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};F.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];F.register("feaas-editor");function xt(e=this){var t,r;return{part:(e==null?void 0:e.getAttribute("part"))||"picker",slot:(e==null?void 0:e.getAttribute("part"))||"picker",mode:e==null?void 0:e.getAttribute("mode"),placeholder:(e==null?void 0:e.getAttribute("placeholder"))||"No theme",frontend:(t=e==null?void 0:e.getContextAttribute("frontend"))!==null&&t!==void 0?t:"https://components.sitecorecloud.io",src:(r=e==null?void 0:e.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(e==null?void 0:e.getAttribute("hidden"))!=null,variant:e==null?void 0:e.getAttribute("variant"),context:void 0,onClose:void 0,onContextAttributeSet:void 0}}var I=class extends y{getProps(){return xt(this)}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}render({placeholder:t,context:r,mode:i,children:o,variant:s},{Picker:n,React:a,ReactDOM:d}){return a.createElement(n,{placeholder:t,mode:i||void 0,onClose:this.props.onClose,onContextAttributeSet:this.props.onContextAttributeSet,context:r,variant:s},o)}};I.observedAttributes=["library","mode","frontend","src","hidden","variant"];I.register("feaas-picker");function Rt(e=this){var t,r,i,o;return{library:e==null?void 0:e.getAttribute("library"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/context.js",frontend:(r=e==null?void 0:e.getAttribute("frontend"))!==null&&r!==void 0?r:"https://components.sitecoreclud.io",backend:(i=e==null?void 0:e.getAttribute("backend"))!==null&&i!==void 0?i:"https://components-api.sitecoreclud.io",cdn:(o=e==null?void 0:e.getAttribute("cdn"))!==null&&o!==void 0?o:"https://feaascompontsapiprod.blob.core.windows.net",getToken:null}}var U=class extends y{constructor(){super(...arguments),this.onStatusChange=t=>{t=="ready"&&this.dispatchEvent(new Event("feaasReady",{bubbles:!0,composed:!0}))}}getProps(){return Rt(this)}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}isReadyToLoad(){return console.log("Is ready?",this.props,super.isReadyToLoad()&&this.props.library!=null),super.isReadyToLoad()&&this.props.library!=null}getTheme(t){return t}getRoot(){return this.shadowRoot||this.attachShadow({mode:"open"})}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}connectedCallback(){Array.from(this.children).forEach(t=>{this.getRoot().appendChild(t)}),super.connectedCallback()}render({children:t,library:r},{AppContext:i,Chakra:{Button:o,Tooltip:s},React:n}){let a={containerRef:{current:this.getRoot()}};return s.defaultProps={hasArrow:!0,placement:"top",portalProps:a},n.createElement(i,{backend:this.props.backend,libraryId:this.props.library,container:this.getRoot(),getToken:this.props.getToken,getTheme:this.getTheme,onStatusChange:this.onStatusChange,modalProps:{portalProps:a},chakraProps:{cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},t)}};U.observedAttributes=["library","component","version","revision","hostname","template"];U.register("feaas-context");0&&(module.exports={Base,Component,FEAASBase,FEAASComponent,FEAASComponentsProps,FEAASContext,FEAASContextProps,FEAASEditor,FEAASEditorProps,FEAASLoader,FEAASLoaderProps,FEAASPicker,FEAASPickerProps,FEAASStylesheet,FEAASStylesheetProps,JSONPath,Loader,MyComponent,Stylesheet,autoloadScripts,cleanCollectionBit,fetchAndRevalidate,fetchAndValidate,getFramePosition,invalidateRequest,loadScript,normalizeCollectionScope,observeDOMElement,queryScopes,refetchAndValidate,renderComponent,renderComponentElement,renderComponentPromise,renderDOMContent,renderDOMElement,renderStylesheet,renderStylesheetPromise,serializeCH1RichText,setDOMAttribute});
|
|
67
67
|
//# sourceMappingURL=index.js.map
|