@sitecore-feaas/clientside 0.4.0-alpha.9 → 0.4.0

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.
Files changed (50) hide show
  1. package/README.md +2 -3
  2. package/build/components/FEAASElement.js +0 -2
  3. package/build/components/FEAASElement.js.map +1 -1
  4. package/build/dom/html.js +3 -2
  5. package/build/dom/html.js.map +1 -1
  6. package/build/ui/react.js +2 -3
  7. package/build/ui/react.js.map +1 -1
  8. package/dist/browser/headless.cjs +2 -2
  9. package/dist/browser/headless.cjs.map +2 -2
  10. package/dist/browser/headless.esm.js +2 -2
  11. package/dist/browser/headless.esm.js.map +1 -1
  12. package/dist/browser/index.cjs +2 -2
  13. package/dist/browser/index.cjs.map +2 -2
  14. package/dist/browser/index.esm.js +2 -2
  15. package/dist/browser/index.esm.js.map +1 -1
  16. package/dist/browser/react.cjs +7 -7
  17. package/dist/browser/react.cjs.map +4 -4
  18. package/dist/browser/react.esm.js +7 -7
  19. package/dist/browser/react.esm.js.map +1 -1
  20. package/dist/node/headless.cjs +3 -3
  21. package/dist/node/headless.cjs.map +2 -2
  22. package/dist/node/headless.esm.js +4 -4
  23. package/dist/node/headless.esm.js.map +2 -2
  24. package/dist/node/index.cjs +2 -2
  25. package/dist/node/index.cjs.map +2 -2
  26. package/dist/node/index.esm.js +2 -2
  27. package/dist/node/index.esm.js.map +2 -2
  28. package/dist/node/react.cjs +5 -5
  29. package/dist/node/react.cjs.map +4 -4
  30. package/dist/node/react.esm.js +5 -5
  31. package/dist/node/react.esm.js.map +4 -4
  32. package/headless.cjs +3 -3
  33. package/headless.cjs.map +2 -2
  34. package/headless.js +3 -3
  35. package/headless.js.map +2 -2
  36. package/package.json +2 -2
  37. package/react.cjs +7 -7
  38. package/react.cjs.map +4 -4
  39. package/react.js +7 -7
  40. package/react.js.map +4 -4
  41. package/scripts/build.js +10 -1
  42. package/scripts/test-setup.ts +0 -1
  43. package/src/components/FEAASElement.tsx +0 -1
  44. package/src/dom/html.ts +2 -2
  45. package/src/ui/react.tsx +3 -3
  46. package/test/FEAASComponent.react.test.tsx +11 -11
  47. package/test/ServerComponent.test.tsx +23 -0
  48. package/types/components/FEAASElement.d.ts.map +1 -1
  49. package/types/ui/react.d.ts +2 -1
  50. package/types/ui/react.d.ts.map +1 -1
@@ -1,7 +1,7 @@
1
- var Sr=Object.defineProperty;var ue=(e,t)=>{for(var r in t)Sr(e,r,{get:t[r],enumerable:!0})};import B from"react";var De={};ue(De,{renderDOMContent:()=>Y,renderDOMElement:()=>O,renderHTMLContent:()=>jt,setDOMAttribute:()=>V});var ke={};ue(ke,{JSONPath:()=>v,queryObject:()=>ee,queryObjectRaw:()=>Qe,queryScopes:()=>pe,serializeCH1RichText:()=>z});function M(e){return M=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},M(e)}function Ct(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function bt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function wt(e,t,r){return t&&bt(e.prototype,t),r&&bt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function Or(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&he(e,t)}function de(e){return de=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},de(e)}function he(e,t){return he=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},he(e,t)}function At(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function ce(e,t,r){return At()?ce=Reflect.construct.bind():ce=function(i,o,s){var a=[null];a.push.apply(a,o);var l=Function.bind.apply(i,a),u=new l;return s&&he(u,s.prototype),u},ce.apply(null,arguments)}function Rr(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Ke(e){var t=typeof Map=="function"?new Map:void 0;return Ke=function(n){if(n===null||!Rr(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,i)}function i(){return ce(n,arguments,de(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),he(i,n)},Ke(e)}function _r(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function kr(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return _r(e)}function Nr(e){var t=At();return function(){var n=de(e),i;if(t){var o=de(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return kr(this,i)}}function Fr(e){return Dr(e)||Pr(e)||Et(e)||Tr()}function Dr(e){if(Array.isArray(e))return qe(e)}function Pr(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Et(e,t){if(e){if(typeof e=="string")return qe(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return qe(e,t)}}function qe(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Tr(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mr(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Et(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return o=l.done,l},e:function(l){s=!0,a=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}var S=Object.prototype.hasOwnProperty;function J(e,t){return e=e.slice(),e.push(t),e}function Ge(e,t){return t=t.slice(),t.unshift(e),t}var Lr=function(e){Or(r,e);var t=Nr(r);function r(n){var i;return Ct(this,r),i=t.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),i.avoidNew=!0,i.value=n,i.name="NewError",i}return wt(r)}(Ke(Error));function v(e,t,r,n,i){if(!(this instanceof v))try{return new v(e,t,r,n,i)}catch(l){if(!l.avoidNew)throw l;return l.value}typeof e=="string"&&(i=n,n=r,r=t,t=e,e=null);var o=e&&M(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=S.call(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.preventEval=e.preventEval||!1,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||n||null,this.otherTypeCallback=e.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){var s={path:o?e.path:t};o?"json"in e&&(s.json=e.json):s.json=r;var a=this.evaluate(s);if(!a||M(a)!=="object")throw new Lr(a);return a}}v.prototype.evaluate=function(e,t,r,n){var i=this,o=this.parent,s=this.parentProperty,a=this.flatten,l=this.wrap;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&M(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(!S.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var u=e;t=u.json,a=S.call(e,"flatten")?e.flatten:a,this.currResultType=S.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=S.call(e,"sandbox")?e.sandbox:this.currSandbox,l=S.call(e,"wrap")?e.wrap:l,this.currPreventEval=S.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=S.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=S.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,o=S.call(e,"parent")?e.parent:o,s=S.call(e,"parentProperty")?e.parentProperty:s,e=e.path}if(o=o||null,s=s||null,Array.isArray(e)&&(e=v.toPathString(e)),!(!e&&e!==""||!t)){var c=v.toPathArray(e);c[0]==="$"&&c.length>1&&c.shift(),this._hasParentSelector=null;var d=this._trace(c,t,["$"],o,s,r).filter(function(h){return h&&!h.isParentSelector});return d.length?!l&&d.length===1&&!d[0].hasArrExpr?this._getPreferredOutput(d[0]):d.reduce(function(h,p){var f=i._getPreferredOutput(p);return a&&Array.isArray(f)?h=h.concat(f):h.push(f),h},[]):l?[]:void 0}};v.prototype._getPreferredOutput=function(e){var t=this.currResultType;switch(t){case"all":{var r=Array.isArray(e.path)?e.path:v.toPathArray(e.path);return e.pointer=v.toPointer(r),e.path=typeof e.path=="string"?e.path:v.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return v.toPathString(e[t]);case"pointer":return v.toPointer(e.path);default:throw new TypeError("Unknown result type")}};v.prototype._handleCallback=function(e,t,r){if(t){var n=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:v.toPathString(e.path),t(n,r,e)}};v.prototype._trace=function(e,t,r,n,i,o,s,a){var l=this,u;if(!e.length)return u={path:r,value:t,parent:n,parentProperty:i,hasArrExpr:s},this._handleCallback(u,o,"value"),u;var c=e[0],d=e.slice(1),h=[];function p(b){Array.isArray(b)?b.forEach(function(g){h.push(g)}):h.push(b)}if((typeof c!="string"||a)&&t&&S.call(t,c))p(this._trace(d,t[c],J(r,c),t,c,o,s));else if(c==="*")this._walk(t,function(b){p(l._trace(d,t[b],J(r,b),t,b,o,!0,!0))});else if(c==="..")p(this._trace(d,t,r,n,i,o,s)),this._walk(t,function(b){M(t[b])==="object"&&p(l._trace(e.slice(),t[b],J(r,b),t,b,o,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:d,isParentSelector:!0};if(c==="~")return u={path:J(r,c),value:i,parent:n,parentProperty:null},this._handleCallback(u,o,"property"),u;if(c==="$")p(this._trace(d,t,r,null,null,o,s));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(c))p(this._slice(c,d,t,r,n,i,o));else if(c.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var f=c.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1");this._walk(t,function(b){l._eval(f,t[b],b,r,n,i)&&p(l._trace(d,t[b],J(r,b),t,b,o,!0))})}else if(c[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");p(this._trace(Ge(this._eval(c,t,r[r.length-1],r.slice(0,-1),n,i),d),t,r,n,i,o,s))}else if(c[0]==="@"){var m=!1,y=c.slice(1,-2);switch(y){case"scalar":(!t||!["object","function"].includes(M(t)))&&(m=!0);break;case"boolean":case"string":case"undefined":case"function":M(t)===y&&(m=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(m=!0);break;case"number":Number.isFinite(t)&&(m=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(m=!0);break;case"object":t&&M(t)===y&&(m=!0);break;case"array":Array.isArray(t)&&(m=!0);break;case"other":m=this.currOtherTypeCallback(t,r,n,i);break;case"null":t===null&&(m=!0);break;default:throw new TypeError("Unknown value type "+y)}if(m)return u={path:r,value:t,parent:n,parentProperty:i},this._handleCallback(u,o,"value"),u}else if(c[0]==="`"&&t&&S.call(t,c.slice(1))){var C=c.slice(1);p(this._trace(d,t[C],J(r,C),t,C,o,s,!0))}else if(c.includes(",")){var Q=c.split(","),j=Mr(Q),X;try{for(j.s();!(X=j.n()).done;){var Re=X.value;p(this._trace(Ge(Re,d),t,r,n,i,o,!0))}}catch(b){j.e(b)}finally{j.f()}}else!a&&t&&S.call(t,c)&&p(this._trace(d,t[c],J(r,c),t,c,o,s,!0))}if(this._hasParentSelector)for(var k=0;k<h.length;k++){var I=h[k];if(I&&I.isParentSelector){var N=this._trace(I.expr,t,I.path,n,i,o,s);if(Array.isArray(N)){h[k]=N[0];for(var se=N.length,H=1;H<se;H++)k++,h.splice(k,0,N[H])}else h[k]=N}}return h};v.prototype._walk=function(e,t){if(Array.isArray(e))for(var r=e.length,n=0;n<r;n++)t(n);else e&&M(e)==="object"&&Object.keys(e).forEach(function(i){t(i)})};v.prototype._slice=function(e,t,r,n,i,o,s){if(Array.isArray(r)){var a=r.length,l=e.split(":"),u=l[2]&&Number.parseInt(l[2])||1,c=l[0]&&Number.parseInt(l[0])||0,d=l[1]&&Number.parseInt(l[1])||a;c=c<0?Math.max(0,c+a):Math.min(a,c),d=d<0?Math.max(0,d+a):Math.min(a,d);for(var h=[],p=c;p<d;p+=u){var f=this._trace(Ge(p,t),r,n,i,o,s,!0);f.forEach(function(m){h.push(m)})}return h}};v.prototype._eval=function(e,t,r,n,i,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=i,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;var s=e.includes("@path");s&&(this.currSandbox._$_path=v.toPathString(n.concat([r])));var a="script:"+e;if(!v.cache[a]){var l=e.replace(/@parentProperty/g,"_$_parentProperty").replace(/@parent/g,"_$_parent").replace(/@property/g,"_$_property").replace(/@root/g,"_$_root").replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1");s&&(l=l.replace(/@path/g,"_$_path")),v.cache[a]=new this.vm.Script(l)}try{return v.cache[a].runInNewContext(this.currSandbox)}catch(u){throw new Error("jsonPath: "+u.message+": "+e)}};v.cache={};v.toPathString=function(e){for(var t=e,r=t.length,n="$",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[i])||(n+=/^[\*0-9]+$/.test(t[i])?"["+t[i]+"]":"['"+t[i]+"']");return n};v.toPointer=function(e){for(var t=e,r=t.length,n="",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[i])||(n+="/"+t[i].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return n};v.toPathArray=function(e){var t=v.cache;if(t[e])return t[e].concat();var r=[],n=e.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,";$&;").replace(/['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))['\]]/g,function(o,s){return"[#"+(r.push(s)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(o,s){return"['"+s.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(o,s){return";"+s.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),i=n.split(";").map(function(o){var s=o.match(/#([0-9]+)/);return!s||!s[1]?o:r[s[1]]});return t[e]=i,t[e].concat()};var jr=function(t,r,n){for(var i=t.length,o=0;o<i;o++){var s=t[o];n(s)&&r.push(t.splice(o--,1)[0])}},$r=function(){function e(t){Ct(this,e),this.code=t}return wt(e,[{key:"runInNewContext",value:function(r){var n=this.code,i=Object.keys(r),o=[];jr(i,o,function(c){return typeof r[c]=="function"});var s=i.map(function(c,d){return r[c]}),a=o.reduce(function(c,d){var h=r[d].toString();return/function/.test(h)||(h="function "+h),"var "+d+"="+h+";"+c},"");n=a+n,!/(["'])use strict\1/.test(n)&&!i.includes("arguments")&&(n="var arguments = undefined;"+n),n=n.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var l=n.lastIndexOf(";"),u=l>-1?n.slice(0,l+1)+" return "+n.slice(l+1):" return "+n;return ce(Function,i.concat([u])).apply(void 0,Fr(s))}}]),e}();v.prototype.vm={Script:$r};function Qe(e,t){try{return v({path:t,json:e})}catch(r){return[]}}function ee(e,t){var r;return((r=Qe(e,t))===null||r===void 0?void 0:r.flat(1/0))||[]}function pe(e,t,r=!1,n=e){var i=t;let o=Object.keys(e).sort((a,l)=>l.length-a.length);for(let a of o)if(t.startsWith(a)){if(a==t){if(r)return e[a];continue}i=t.substring(a.length+1),n=e[a];break}var s=ee(n,i);return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[i.replace(/^.*?\./,"_."),i.replace(/^.*?\./,""),i.replace(/^([^.]+).*?\.\$([\.\[])/,"$1$2"),i.replace(/^.*?\.\$([\.\[])/,"_$1"),i.replace(/^.*?\.\$([\.\[])/,"$$$1"),i.replace(/^[^.]+$/,"_")].filter((a,l,u)=>u.indexOf(a)===l).reduce((a,l)=>a.length>0?a:ee(n,l),[])),r&&Array.isArray(s)?s[0]:s}function Ze(e,t={},r){return r?`<${r}${Object.entries(t).map(([n,i])=>i!=null&&` ${n}="${i}"`).filter(Boolean).join("")}>${z(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):z(e)}function z(e){var t;if(Array.isArray(e))return e.map(z).join(`
4
- `).trim();if(typeof e=="string")return e;if(e==null)return"";switch(e.type){case"heading":let{level:r,...n}=e.attrs;return Ze(e.content,n,"h"+r);case"text":return(e.marks||[]).reduce((i,o)=>Ze(i,o.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[o.type]),(t=e.text)===null||t===void 0?void 0:t.replace(/\s+/," "));default:return Ze(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}function xt(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&fe(i,o),n.addedNodes&&n.addedNodes.forEach(s=>{s.nodeType==1&&St(s,!1)})})});return t.observe(e,{attributes:!0,subtree:!0,childList:!0}),t}function St(e,t=!0){let r=e.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];fe(i,i.getAttribute("data-embed-src"))}if(t)return xt(e)}function fe(e,t){for(var r=e;r;r=r.parentElement)if(!r.parentElement){let i=r.querySelectorAll("script");for(var n=0;n<i.length;n++)if(i[n].getAttribute("src")==t)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let o=r.ownerDocument.createElement("script");o.setAttribute("type","module"),o.setAttribute("src",t),r.appendChild(o);break}}var Fe={};ue(Fe,{adjustNumbers:()=>kt,cleanCollectionBit:()=>me,getHumanizedLabel:()=>Nt,getLastPathBit:()=>Ft,getQualifier:()=>_t,normalizeCollectionScope:()=>Ne,parseLimit:()=>Ot,parseRange:()=>Rt});var Ot=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},Rt=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(n=>{if(n.match(/^-?\d+$/))return n;let i=n.match(/^(\d+):(\d+)$/);return i&&parseInt(i[1],10)<parseInt(i[2],10)?i[1]+"-"+i[2]:null});return r!=null&&r.every(Boolean)?r.join(","):null},_t=e=>{var t;return(t=e==null?void 0:e.match(/(\.\*|\[[^\]]*\])$/))===null||t===void 0?void 0:t[0]};function me(e){return e.replace(/(\.?\[[^\]\[]*\]|\.\*)$/g,"")}function Ne(e){return me(e)+".*"}function kt(e,t){return e==null?void 0:e.replace(/(.|^)(\d+)/g,(r,n,i)=>n+(n==":"?i:String(parseInt(i)+t)))}function Nt(e,t=2){var r=me(e).split(/]\.|\.\*\./g).pop().split(/\./g).slice(-3);return r=r.filter(n=>isNaN(parseInt(n))),r.map(n=>n.charAt(0).toUpperCase()+n.slice(1)).slice(-t).join(" ")}function Ft(e){return me(e).split(".").pop()}var Br=["January","February","March","April","May","June","July","August","September","October","November","December"],Dt=e=>{if(!e||typeof e.getDay!="function")return;let t=e.getFullYear(),r=Br[e.getMonth()],n=e.getDate();return`${r} ${n}, ${t}`},Pt=function(e){return String(new Date(e))!=="Invalid Date"&&!isNaN(Number(new Date(e)))};function Mt(e){let t=e.getAttribute("data-path-scope");for(var r=0,n=e;n=n.previousElementSibling;)n.getAttribute("data-path-scope")==t&&r++;return r}function Ir(e,t,r){let n=e.getAttribute("data-path-scope");if(n==null)return;var i=Mt(e);if(i!=0)return;let o=e.parentNode;if(o!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var s=i+1,a=e,l=e;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==n&&(s++,a=l);for(var u=s;u<t;u++)o.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var u=Math.max(1,t);u<s;u++)a=a.previousElementSibling,o.removeChild(a.nextElementSibling)}}function V(e,t,r,n){var i,o,s;if(!e)return;var a=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=z(r)),n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(e,t,r));var l=t.replace("data-path-","");if(t=="data-path-src"||t=="data-path-alt"){let y=Array.from(e.children).find(C=>C.localName=="picture")||e;a=e.localName=="img"?e:y.querySelector("img, video")}else if(t=="data-path-href")a=e.querySelector("a")||e.closest("a");else if(t=="data-path-hidden")r=r?null:!0;else if(t=="data-path"||t=="data-embed-html"||t=="html")l="innerHTML";else if(t=="data-embed-src")fe(e,r);else if(t=="data-path-attributes"){let y=((i=e.getAttribute("data-attributes-keys"))===null||i===void 0?void 0:i.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var u in r){var c=r[u];V(e,u,typeof c=="object"&&c?JSON.stringify(c):c,n)}for(var d=0;d<y.length;d++)(r==null||!(y[d]in r))&&V(e,y[d],null,n);V(e,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!a)return;if((l=="innerHTML"||l=="src")&&(r==null||r==="")){var p=String((s=(o=e.getAttribute("data-path-placeholder")||a[l])!==null&&o!==void 0?o:a.getAttribute(l))!==null&&s!==void 0?s:"");l=="innerHTML"?a.innerHTML=p:p?a.setAttribute(l,p):a.removeAttribute(l)}else if(r!=null)if(l=="innerHTML"){for(var f=String(r),m=a;m.parentElement&&m.localName.match(/^(a|var|strong|em|i|b)$/);)m=m.parentElement;m.localName.match(/p|h\d|button|time|li/)&&(f=f.replace(/<(p|h\d|li|ul)[^>]*?>|<\/(p|h\d|li|ul)[^>]*?>/g," ").trim().replace(/\s+/g," ")),String(m.getAttribute("class")).includes("-inline--time")&&Pt(f)&&(f=Dt(new Date(f))),a.innerHTML!=f&&(a.innerHTML=f)}else a.getAttribute(l)!=r&&a.setAttribute(l,r);else a.removeAttribute(l)}var Tt=["data-attributes-keys","data-path-attributes","data-path-scope"];function O(e,t,r,n){var i,o,s;let a=e;if(n||(t=((i=r==null?void 0:r.processData)===null||i===void 0?void 0:i.call(r,a,t))||t),a.nodeType==1){let c=a.getAttribute("data-path-scope");if(c){let h=Mt(a),p=pe(t,c,!1);h==0&&Ir(a,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,a,p))===!1?1:p.length,r),t={...t,[Ne(c)]:p[h]}}let d=Array.prototype.slice.call(a.attributes).sort((h,p)=>Tt.indexOf(h.name)-Tt.indexOf(p.name));for(var l=0;l<d.length;l++){let{name:h,value:p}=d[l];h.startsWith("data-path")&&h!="data-path-scope"&&V(a,h,pe(t,p,!0),r),h=="data-embed-src"&&V(a,h,a.getAttribute(h),r)}}for(var l=0,u;u=a.childNodes[l++];)Lt(u)&&O(u,t,r,!0);return n||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,t),a}function Lt(e){return e.nodeType==1}function Y(e,t,r,n){var i;let o=((i=n==null?void 0:n.processTemplate)===null||i===void 0?void 0:i.call(n,e,t,r))||t;if(e.innerHTML=o,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(var a=0,l;l=e.childNodes[a++];)Lt(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return O(e,r,n)}function jt(e,t,r,n=!1){var i;let o=((i=r==null?void 0:r.processTemplate)===null||i===void 0?void 0:i.call(r,null,e,t))||e;if(typeof document=="undefined"||n){let s=Pe(o);return O(s[0],t,r).outerHTML}else{let s=document.createElement("div");return s.innerHTML=o,O(s,t,r),s.innerHTML}}var K=class{constructor(t,r=1,n){this.ownerDocument={createElement(i){return new K(i)}},this.nodeName=t,this.nodeType=r,this.textContent=n,this.attributes=[],this.childNodes=[]}setAttribute(t,r){let n=this.attributes.find(i=>i.name===t);n?n.value=r:this.attributes.push({name:t,value:r})}getAttribute(t){let r=this.attributes.find(n=>n.name===t);return r?r.value:void 0}insertBefore(t,r){if(t.parentNode=this,r===null)this.childNodes.push(t);else{let n=this.childNodes.indexOf(r);n!==-1&&this.childNodes.splice(n,0,t)}}removeAttribute(t){let r=this.attributes.findIndex(n=>n.name===t);r!==-1&&this.attributes.splice(r,1)}appendChild(t){t.parentNode=this,this.childNodes.push(t)}get tagName(){var t;return(t=this.nodeName)===null||t===void 0?void 0:t.toUpperCase()}get localName(){var t;return(t=this.nodeName)===null||t===void 0?void 0:t.toLowerCase()}get innerHTML(){return Xe(this.childNodes)}set innerHTML(t){this.childNodes=Pe(String(t!=null?t:""))}get outerHTML(){return Xe([this])}get children(){return this.childNodes.filter(t=>t.nodeType==1)}closest(t){let r=this;for(;r;){if($t(t,r))return r;r=r.parentNode}return null}querySelectorAll(t){let r=t.split(/\s*,\s*/),n=[],i=o=>{for(let s of r)if($t(s,o)){n.push(o);break}for(let s of o.childNodes)i(s)};for(let o of this.childNodes)i(o);return n}querySelector(t){return this.querySelectorAll(t)[0]}findSibling(t,r){if(!this.parentNode)return null;let n=this.parentNode.childNodes,i=n.indexOf(this);if(i===-1)return null;for(let o=i+t;o>=0&&o<n.length;o+=t){let s=n[o];if(!r||s.nodeType===1)return s}return null}removeChild(t){let r=this.childNodes.indexOf(t);if(r!==-1)return this.childNodes.splice(r,1),t.parentNode=void 0,t}get previousSibling(){return this.findSibling(-1)}get nextSibling(){return this.findSibling(1)}get previousElementSibling(){return this.findSibling(-1,!0)}get nextElementSibling(){return this.findSibling(1,!0)}cloneNode(t=!1){let r=new K(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),t)for(let n of this.childNodes){let i=n.cloneNode(!0);r.appendChild(i)}return r}get parentElement(){var t;return((t=this.parentNode)===null||t===void 0?void 0:t.nodeType)==1?this.parentNode:null}};function $t(e,t){let r=e.match(/([.#]?[\w-]+|\[([\w-]+)(="([^"]*)")?\])/g);if(!r)return!1;for(let n of r)if(n.startsWith("#")){if(t.getAttribute("id")!==n.slice(1))return!1}else if(n.startsWith(".")){if(!(t.getAttribute("class")||"").split(" ").includes(n.slice(1)))return!1}else if(n.startsWith("[")){let i=n.match(/^\[([\w-]+)(="([^"]*)")?\]$/);if(i){let o=i[1],s=i[3],a=t.getAttribute(o);if(typeof s=="undefined"){if(a===void 0)return!1}else if(a!==s)return!1}else return!1}else if(t.nodeName!==n)return!1;return!0}function Pe(e){var t;let r=[],n=[];for(;e;){let i=e.match(/^<([\w-]+)(\s[^>]*)?>/),o=e.match(/^<\/([\w-]+)>/);if(i){let s=i[1],l=((t=(i[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||t===void 0?void 0:t.map(c=>{let[d,h,,p]=c.match(/([\w-]+)(="([^"]*)")?/);return{name:h,value:Wr(p||"")}}))||[],u=new K(s,1);if(u.attributes=l,n.length>0){let c=n[n.length-1];c.childNodes.push(u),u.parentNode=c}else r.push(u);n.push(u),e=e.slice(i[0].length)}else if(o)n.pop(),e=e.slice(o[0].length);else{let s=e.indexOf("<"),a=e.slice(0,s!==-1?s:void 0),l=new K("#text",3);if(l.textContent=a,n.length>0){let u=n[n.length-1];u.childNodes.push(l),l.parentNode=u}else r.push(l);e=e.slice(a.length)}}return r}function Ur(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function Wr(e){return e.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'")}function Xe(e){return e.map(t=>{if(t.nodeType===3)return t.textContent||"";let{nodeName:r,attributes:n}=t,i=n.map(({name:s,value:a})=>` ${s}="${Ur(String(a))}"`).join(""),o=Xe(t.childNodes);return["img","input","br"].includes(r)?`<${r}${i} />`:`<${r}${i}>${o}</${r}>`}).join("")}function Hr(e,t,r){return et(e,t,r)[0].outerHTML}function et(e,t,r){var n;let i=((n=r==null?void 0:r.processTemplate)===null||n===void 0?void 0:n.call(r,null,e,t))||e;return Pe(i).map(s=>O(s,t,r))}function Jr(e){let{params:t,method:r,headers:n,body:i,url:o}=E(e);var s={url:o},a={...n};return n["Content-Type"]==="application/json"&&delete a["Content-Type"],n.Accept==="application/json"&&delete a.Accept,Object.keys(a).length>0&&(s.headers=a),r!=="GET"&&(s.method=r),r==="GET"||r==="HEAD"||Object.keys(i).length===0||(s.body=i),Object.keys(t).length>0&&(s={...s,params:t}),s}var Te=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 Bt(e){let{url:t,headers:r,params:n,method:i,body:o}=E(e),s,a=r["Content-Type"];i!="GET"&&i!="HEAD"&&(a==="application/json"&&(s=JSON.stringify(o)),a==="multipart/form-data"&&(s=Object.keys(o).reduce((u,c)=>(u.append(c,o[c]),u),new FormData)),a==="application/x-www-form-urlencoded"&&(s=new URLSearchParams(o)));let l=Object.keys(n).length?`?${new URLSearchParams(n)}`:"";return[`${t}${l}`,{headers:r,body:s,method:i}]}function E(e){let t={};for(let r in(e==null?void 0:e.headers)||{})if(e.headers.hasOwnProperty(r)){let n=r.replace(/^[a-z]|\-[a-z]/g,i=>i.toUpperCase());t[n]=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 tt=async e=>{try{let[t,r]=Bt(e),i=await(await E.fetchImplementation(t,{...r,method:r.method.toLowerCase()})).json();return e.jsonpath&&e.jsonpath!="$"?ee(i,e.jsonpath):i}catch(t){return{}}};async function rt(e){if(!e)return e;if(Te(e))return tt(e);let t=Object.keys(e),r=await Promise.all(t.map(n=>Te(e[n])?tt(e[n]):null).filter(Boolean));return t.reduce((n,i)=>({...n,[i]:Te(e[i])?r.shift():e[i]}),{})}E.clean=Jr;E.toFetchArguments=Bt;E.fetchOne=tt;E.fetch=rt;E.isDataSettings=Te;E.fetchImplementation=(...e)=>fetch(...e);var ut={};ue(ut,{Component:()=>Ce,ComponentProps:()=>Yt,Context:()=>Z,ControlledPromise:()=>R,DEFAULT_CDN_URL:()=>L,DOM:()=>De,DataPath:()=>Fe,DataScope:()=>ke,DataSettings:()=>E,Element:()=>A,FEAASComponent:()=>Ce,FEAASComponentsProps:()=>Yt,FEAASContext:()=>Z,FEAASContextProps:()=>ir,FEAASEditor:()=>Ae,FEAASEditorProps:()=>rr,FEAASElement:()=>A,FEAASLoader:()=>we,FEAASLoaderProps:()=>Kt,FEAASPicker:()=>Ee,FEAASPickerProps:()=>nr,FEAASStylesheet:()=>Ie,FEAASStylesheetProps:()=>qt,InvalidResponse:()=>Le,JSONPath:()=>v,Loader:()=>we,MyComponent:()=>Me,Picker:()=>Ee,Stylesheet:()=>Ie,Thumbnail:()=>Ue,WebComponent:()=>It,adjustNumbers:()=>kt,autoloadScripts:()=>St,cleanCollectionBit:()=>me,clearFetchCache:()=>zr,createStylesheet:()=>zt,fetchAndRevalidate:()=>ge,fetchAndRevalidateComponent:()=>ne,fetchAndRevalidateStylesheet:()=>$e,fetchBypassingCache:()=>je,fetchCache:()=>ve,fetchComponent:()=>it,fetchData:()=>rt,fetchToValidateCache:()=>ye,fetchWithCacheAwareness:()=>q,findStylesheet:()=>Jt,getComponentSource:()=>Vr,getComponentURL:()=>be,getFetchCache:()=>Wt,getFramePosition:()=>tr,getHumanizedLabel:()=>Nt,getLastPathBit:()=>Ft,getQualifier:()=>_t,getStylesheetSource:()=>nt,getStylesheetURL:()=>W,loadScript:()=>fe,loadStylesheet:()=>Be,loadStylesheetAllowStale:()=>ot,normalizeCollectionScope:()=>Ne,observeDOMElement:()=>xt,parseComponentSource:()=>G,parseLimit:()=>Ot,parseRange:()=>Rt,parseStylesheetSource:()=>re,queryObject:()=>ee,queryObjectRaw:()=>Qe,queryScopes:()=>pe,renderComponent:()=>st,renderComponentElement:()=>Kr,renderComponentPromise:()=>Vt,renderDOMContent:()=>Y,renderDOMElement:()=>O,renderHTMLContent:()=>jt,renderStylesheet:()=>Yr,renderStylesheetPromise:()=>Ht,serializeCH1RichText:()=>z,setDOMAttribute:()=>V});function R(e,t=r=>{}){var r;let n=()=>{var i,o;let s=new Promise((l,u)=>{i=c=>{e==null||e(c),l(c)},o=u});var a=Object.assign(s,{resolve:i,reject:o,restart:n,first:r});return r=a,a.catch(t),a};return n()}var It=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,A=class extends It{getProps(t){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=R(t=>{this.payload=t}),this.whenRendered=R(()=>this.initialized=!0,()=>this.cancelRender()),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(t,r,n){this.set()}connectedCallback(){this.mount()}disconnectedCallback(){this.unmount()}mount(){try{let t=this.getParent();if(t&&!t.connected||this.connected)return;this.connected=!0,this.log("FEAAS: Mount",this.tagName,this),this.dispatchEventIndirectly(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var n;return(n=r.mount)===null||n===void 0?void 0:n.call(r)}),this.set()}catch(t){this.onError(t)}}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];(typeof location!="undefined"&&(location!=null&&location.hostname.startsWith("components-"))||localStorage["Sitecore.Components.Debug"])&&console.log(r+" "+t.slice(1).map(n=>n&&typeof n=="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&&this.initialized&&this.render&&this.update(),this.cancelRender(),this.connected=!1,this.initialized&&this.render&&this.update())}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(n=>[!r||n.tagName.startsWith("FEAAS-")?n:null,n.shadowRoot?this.getElements(n.shadowRoot,r):null]).flat().filter(Boolean)}handleEvent(t){let r=t.composedPath()[0];switch(t.type){case"feaasMount":r!=this&&this.nestedCallback(r);break;case"feaasUnmount":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(t){let r=this.descendants.indexOf(t);r!=-1&&(this.log("FEAAS: Unnest",this,t),this.descendants.splice(r,1),this.refs[t.getComponentName()]=null,t.refs.parent==this&&(t.refs.parent=null),t.refs.top==this&&(t.refs.top=t.refs.parent))}nestedCallback(t){var r,n;if(this.descendants.indexOf(t)==-1&&(this.descendants.push(t),this.log("FEAAS: Nest",this,t),this.refs[t.getComponentName()]=t,t.refs.top=this,(r=t.refs).parent||(r.parent=this),t.render))for(var o=t.refs.parent;o;o=o.refs.parent)o.render&&((n=t.refs).parentReact||(n.parentReact=o),t.refs.topReact=o)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(t,r="uncaught",n=!1){let i=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:t});if(this.dispatchEventIndirectly(i),this.whenLoaded.reject(t),!i.defaultPrevented&&!n){this.whenRendered.reject(t);try{this.unmount()}catch(o){}return!0}return!1}shouldUpdateOnLoad(){return!0}async advance(){try{if(this.payload===void 0){if(!this.isReadyToLoad())return;this.payload=null,this.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 n=(r=(t=this.payload)===null||t===void 0?void 0:t.ReactDOM)===null||r===void 0?void 0:r.flushSync;n?n(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var t,r,n;if(this.payload==null||!this.render)return;let{React:i,ReactDOM:o,ReactDOMClient:s}=this.payload||{};if(!i)throw new Error(`${this.tagName}: React is not present in payload`);if(!o)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);this.getAttribute("hydrate")!="false"&&(!this.refs.topReact&&!this.forceUpdateReact?s?(this.reactRoot||(this.reactRoot=s.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):o.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact&&this.connected?(t=this.forceUpdateReact)===null||t===void 0||t.call(this):(n=(r=this.refs.topReact)===null||r===void 0?void 0:r.forceUpdateReact)===null||n===void 0||n.call(r))}invokeReactRendering(){let{React:t,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let n=this.descendants.filter(i=>i.refs.parentReact==this&&i.payload&&i.connected).map((i,o)=>this.getReactElement(i));return this.render({...this.props,children:n},this.payload)}getReactErrorBoundary(t=this,r=t.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:n,ReactDOM:i}=t.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends n.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,a){console.error(`FEAAS: ${t.tagName} Error:`,s,a),t.onError(s,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(t=this,r){let{React:n,ReactDOM:i}=t.payload||{},o=this.getReactErrorBoundary(),s=this.getReactWrapper(t);return n.createElement(o,{key:t.tagName+"-"+t.getUID(),slot:t.getAttribute("slot")},n.createElement(s,null))}getReactWrapper(t=this,r=t.tagName){if(t.reactWrapper)return t.reactWrapper;let{React:n,ReactDOM:i}=t.payload||{};return t.reactWrapper=o=>{if(t.render){let[s,a]=n.useReducer(l=>l+1,0);return t.forceUpdateReact=a,i.createPortal(n.createElement(n.Fragment,null,t.invokeReactRendering()),t.getReactRootElement())}else return t.update()},Object.assign(t.reactWrapper,{key:t.tagName+"-"+t.getUID(),displayName:r}),t.reactWrapper}getUID(){return this.uid||(this.uid=String(Math.random()))}getShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}getReactRootElement(){return this.useShadowRoot?this.getShadowRoot():this.getRoot()}set(t){try{this.scheduleRender(),this.overrides={...this.overrides,...t},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let i=this.isJSONAttribute(r),o=this.props[r],s=i?JSON.stringify(o):String(o),a=this.defaultProps[r],l=i?JSON.stringify(a):String(a),u=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),c=this.getAttribute(u);try{var n=i?JSON.stringify(JSON.parse(c)):c}catch(d){var n=null}o==null||s===l?this.removeAttribute(u):(typeof o=="string"||typeof o=="number"||typeof o=="boolean"||i)&&n!=s&&this.setAttribute(u,s)}}catch(i){this.whenRendered.reject(i),this.onError(i,"set")}return this}import(t){return import( /*@vite-ignore*/ /* webpackIgnore: true */ t)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),this.cancelRender(),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(t=>{})})}cancelRender(){cancelAnimationFrame(this.nextRender)}formatURL(t,r){return typeof t=="string"&&t.match(/^\/[^\/]/)?r+t:t}getContextAttribute(t,r=this){for(var n=this;n=n.parentElement||(n.parentNode instanceof ShadowRoot?n.parentNode.host:null);)if(n.getAttribute(t)!=null)return n.getAttribute(t);return this.getAttribute(t)}static register(t,r){r==null&&(r=typeof window!="undefined"?window:null),r&&!r.customElements.get(t)&&r.customElements.define(t,this)}};var te=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)}},Me=class extends te{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:t},{React:r}){let[n,i]=r.useState(0);return r.useEffect(()=>{i(o=>o+1)},[t]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",t),r.createElement("p",null,"Triggered updates: ",n))}};Me.observedAttributes=["counter"];var Ut=["initial","check","updated"],ve={};function zr(){ve={}}async function ge(e,t,r,n,i=ve){return q({url:e,options:t,validator:r,callback:n,cache:i}).then(ye).then(o=>o.response)}function Wt(e,t=!1){let r=String(e).replace("?head","");var n=ve[r];return!n&&!t&&(n=ve[r]={phase:null,initial:R(),check:R(),updated:R(),final:R()}),n}var Le=class extends Error{};async function q({url:e,options:t,validator:r,callback:n,cache:i},o="initial"){let s=new Date;if(i!=null){var a=Wt(e);if(Ut.indexOf(a.phase)>=Ut.indexOf(o))var l=a[o];else a.phase=o}let u=await(l||fetch(e,t));if(!l&&a&&(u.ok?a[o].resolve(u):a[o].reject(new Error("Fetch failed"))),!u.ok)throw new Error("Fetch failed");let c=new Date(u.headers.get("date"))<s||l&&o=="initial"&&(a.phase=="updated"||a.phase=="check");if((r==null?void 0:r(u,c))===!1)throw new Le("Response is not valid");return await(n==null?void 0:n(u,o,c)),{url:e,options:t,isCached:c,response:u,validator:r,callback:n,cache:i}}async function ye(e){let{url:t,isCached:r,options:n,validator:i,response:o,cache:s}=e;if(r){let{response:a}=await q({url:t+"?head",options:{...n,method:"HEAD",cache:"no-cache"},validator:i,cache:s},"check");if(a.headers.get("last-modified")!=o.headers.get("last-modified"))return je(e)}return e}async function je(e){return q({...e,options:{...e.options,cache:"reload"}},"updated")}var L="https://feaas.blob.core.windows.net";function G(e){let t=e.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(t){var[,r,n,i,o,s]=t;return{cdn:r,library:n,component:i,version:o,revision:s}}}function Vr(e){if(!e||!e.library||!e.component)throw new Error("Component requires `library` and `component` properties");return`${e.cdn&&e.cdn!=L?`${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 nt(e){return`${e.cdn&&e.cdn!=L?`${e.cdn}/styles/`:""}${e.library}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function re(e){let t=e.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(t){var[,r,n,i]=t;return{cdn:r,library:n,revision:i}}else{let o=G(e);if(o){var{cdn:r,library:n,revision:i}=o;return i!=null&&i.match(/\d/)&&(i=void 0),{cdn:r,library:n,revision:i}}}}function be(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...G(e.src)}),`${e.cdn||e.hostname||L}/components/${e.library}/${e.component}/${e.version}/${e.revision||"published"}.html`}function W(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...re(e.src)}),`${e.cdn||e.hostname||L}/styles/${e.library}/${e.revision=="staged"?"staged":e.revision=="saved"?"saved":"published"}.css`}async function ne(e,t,r=!1){let n=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,i=a=>a.clone().text().then(t),o=await Promise.all([e.instance&&q({options:{headers:{Accept:"text/html"},credentials:"omit"},url:be({...e,version:e.instance}),validator:n}).catch(a=>a),q({url:be(e),validator:n}).catch(a=>a)]),s=o.find(a=>a&&"isCached"in a&&a);if(!s||s instanceof Error)throw o.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return o[0]==s&&console.log("Using fork!",o),await i(s.response),r?s:ye({...s,callback:i}).catch(a=>{if(o[0]==s&&(je({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),ye({...o[1],callback:i});throw a})}async function it(e){typeof e=="string"&&(e={src:e});var t;let{response:r}=await ne(e,n=>{t=n},!0);return{...e,template:t,lastModified:r.headers.get("last-modified")}}async function $e(e,t){return typeof e=="string"&&(e={src:e}),ge(W(e),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,n)=>r.clone().text().then(i=>t(i,n)))}function Yr(e,t){return Ht(e,t||(t=document.createElement("style"))),t}function Ht(e,t){return t||(t=document.createElement("style")),$e(e,(r,n)=>{t.textContent=r}).then(()=>t)}function Be(e,t){var r=Jt(e);if(r){if(r.tagName=="LINK")return t(null,"initial"),Promise.resolve(r)}else var n=zt(e);return $e(e,(i,o)=>{n&&(n.textContent=i),t==null||t(i,o)}).then(()=>r||n)}function ot(e){return new Promise((t,r)=>{Be(e,t).catch(r)})}function Jt(e){return document.head.querySelector(`style[data-href="${W(e)}"]`)||document.querySelector(`link[rel="stylesheet"][href="${W(e)}"]`)}function zt(e){let t=W(e),r=document.createElement("style");return r.setAttribute("data-href",t),document.head.appendChild(r),r}function Kr(e,t){let r=document.createElement("div");r.innerHTML=e;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return O(n,t),r}function st(e,t){return Vt(e,t||(t=document.createElement("div"))),t}async function Vt(e,t){return t||(t=document.createElement("div")),t.childNodes.length?O(t,e.data,e):"template"in e?Y(t,e.template,e.data,e):ne(e,r=>Y(t,r,e.data,e)).then(()=>t)}function Yt(e){var t,r,n,i,o,s,a,l;let u,c=e.getAttribute("src");if(c){let C=G(c);if(!C)throw new Error(`Could not parse FEAAS Component source: ${c}`);var{cdn:d,library:h,component:p,version:f,revision:m}=C}let y=e.getAttribute("data");if(y!=null&&y!="")try{u=typeof y=="string"?JSON.parse(y):{}}catch(C){console.error(C)}return{data:u||{},cdn:(r=(t=e.getContextAttribute("cdn"))!==null&&t!==void 0?t:d)!==null&&r!==void 0?r:L,library:(n=e.getAttribute("library"))!==null&&n!==void 0?n:h,component:(i=e.getAttribute("component"))!==null&&i!==void 0?i:p,version:(s=(o=e.getAttribute("version"))!==null&&o!==void 0?o:f)!==null&&s!==void 0?s:"responsive",revision:(l=(a=e.getAttribute("revision"))!==null&&a!==void 0?a:m)!==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 Ce=class extends A{setData(t){this.set({data:t})}getProps(){return Yt(this)}isJSONAttribute(t){return t=="data"}attributeChangedCallback(t,r,n){r!==n&&((t=="library"||t=="component"||t=="revision"||t=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(t,r,n),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=R(t=>this.readyData=t,t=>this.onError(t)),this.defaultProps={cdn:L,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 n=r;return n}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(this.getOriginal())return;let t=()=>{this.payload&&(r||this.readyData&&this.onLoad(this.payload))};if(this.props.withStylesheet)var r=ot({...this.props}).then(()=>{r=null,t()});return Promise.all([r,this.whenDataReady.then(()=>t()),ne(this.props,n=>{this.payload=n,t()})]).then(()=>this.payload)}flush(){this.readyData&&super.flush()}update(){if(this.alreadyRendered=!0,this.getAttribute("hydrate")!="false")if(Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)O(this,this.readyData);else{if(this.needsRefresh=!0,this.getOriginal())return;Y(this,this.payload,this.readyData)}}};Ce.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];Ce.register("feaas-component");function Kt(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 we=class extends A{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Kt(this)}attributeChangedCallback(t,r,n){if(r!==n)return t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),n?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,n)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
1
+ var Ge=Object.defineProperty;var lt=(t,e)=>{for(var r in e)Ge(t,r,{get:e[r],enumerable:!0})};import B from"react";import*as O from"@sitecore/byoc/react";var Ft={};lt(Ft,{renderDOMContent:()=>q,renderDOMElement:()=>_,renderHTMLContent:()=>Ee,setDOMAttribute:()=>Y});var St={};lt(St,{JSONPath:()=>f,queryObject:()=>et,queryObjectRaw:()=>zt,queryScopes:()=>ht,serializeCH1RichText:()=>J});function L(t){return L=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L(t)}function ie(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function ne(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function oe(t,e,r){return e&&ne(t.prototype,e),r&&ne(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function Ke(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ut(t,e)}function ct(t){return ct=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},ct(t)}function ut(t,e){return ut=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},ut(t,e)}function se(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function dt(t,e,r){return se()?dt=Reflect.construct.bind():dt=function(i,o,s){var a=[null];a.push.apply(a,o);var l=Function.bind.apply(i,a),c=new l;return s&&ut(c,s.prototype),c},dt.apply(null,arguments)}function Qe(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Bt(t){var e=typeof Map=="function"?new Map:void 0;return Bt=function(n){if(n===null||!Qe(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return dt(n,arguments,ct(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ut(i,n)},Bt(t)}function Xe(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ze(t,e){if(e&&(typeof e=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Xe(t)}function tr(t){var e=se();return function(){var n=ct(t),i;if(e){var o=ct(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return Ze(this,i)}}function er(t){return rr(t)||nr(t)||ae(t)||ir()}function rr(t){if(Array.isArray(t))return Ut(t)}function nr(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ae(t,e){if(t){if(typeof t=="string")return Ut(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ut(t,e)}}function Ut(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ir(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
2
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function or(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ae(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
3
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,s=!1,a;return{s:function(){r=r.call(t)},n:function(){var l=r.next();return o=l.done,l},e:function(l){s=!0,a=l},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}var S=Object.prototype.hasOwnProperty;function V(t,e){return t=t.slice(),t.push(e),t}function Wt(t,e){return e=e.slice(),e.unshift(t),e}var sr=function(t){Ke(r,t);var e=tr(r);function r(n){var i;return ie(this,r),i=e.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),i.avoidNew=!0,i.value=n,i.name="NewError",i}return oe(r)}(Bt(Error));function f(t,e,r,n,i){if(!(this instanceof f))try{return new f(t,e,r,n,i)}catch(l){if(!l.avoidNew)throw l;return l.value}typeof t=="string"&&(i=n,n=r,r=e,e=t,t=null);var o=t&&L(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=S.call(t,"wrap")?t.wrap:!0,this.sandbox=t.sandbox||{},this.preventEval=t.preventEval||!1,this.parent=t.parent||null,this.parentProperty=t.parentProperty||null,this.callback=t.callback||n||null,this.otherTypeCallback=t.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){var s={path:o?t.path:e};o?"json"in t&&(s.json=t.json):s.json=r;var a=this.evaluate(s);if(!a||L(a)!=="object")throw new sr(a);return a}}f.prototype.evaluate=function(t,e,r,n){var i=this,o=this.parent,s=this.parentProperty,a=this.flatten,l=this.wrap;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,e=e||this.json,t=t||this.path,t&&L(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(!S.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var c=t;e=c.json,a=S.call(t,"flatten")?t.flatten:a,this.currResultType=S.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=S.call(t,"sandbox")?t.sandbox:this.currSandbox,l=S.call(t,"wrap")?t.wrap:l,this.currPreventEval=S.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=S.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=S.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,o=S.call(t,"parent")?t.parent:o,s=S.call(t,"parentProperty")?t.parentProperty:s,t=t.path}if(o=o||null,s=s||null,Array.isArray(t)&&(t=f.toPathString(t)),!(!t&&t!==""||!e)){var d=f.toPathArray(t);d[0]==="$"&&d.length>1&&d.shift(),this._hasParentSelector=null;var h=this._trace(d,e,["$"],o,s,r).filter(function(u){return u&&!u.isParentSelector});return h.length?!l&&h.length===1&&!h[0].hasArrExpr?this._getPreferredOutput(h[0]):h.reduce(function(u,p){var v=i._getPreferredOutput(p);return a&&Array.isArray(v)?u=u.concat(v):u.push(v),u},[]):l?[]:void 0}};f.prototype._getPreferredOutput=function(t){var e=this.currResultType;switch(e){case"all":{var r=Array.isArray(t.path)?t.path:f.toPathArray(t.path);return t.pointer=f.toPointer(r),t.path=typeof t.path=="string"?t.path:f.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return f.toPathString(t[e]);case"pointer":return f.toPointer(t.path);default:throw new TypeError("Unknown result type")}};f.prototype._handleCallback=function(t,e,r){if(e){var n=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:f.toPathString(t.path),e(n,r,t)}};f.prototype._trace=function(t,e,r,n,i,o,s,a){var l=this,c;if(!t.length)return c={path:r,value:e,parent:n,parentProperty:i,hasArrExpr:s},this._handleCallback(c,o,"value"),c;var d=t[0],h=t.slice(1),u=[];function p(b){Array.isArray(b)?b.forEach(function(g){u.push(g)}):u.push(b)}if((typeof d!="string"||a)&&e&&S.call(e,d))p(this._trace(h,e[d],V(r,d),e,d,o,s));else if(d==="*")this._walk(e,function(b){p(l._trace(h,e[b],V(r,b),e,b,o,!0,!0))});else if(d==="..")p(this._trace(h,e,r,n,i,o,s)),this._walk(e,function(b){L(e[b])==="object"&&p(l._trace(t.slice(),e[b],V(r,b),e,b,o,!0))});else{if(d==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:h,isParentSelector:!0};if(d==="~")return c={path:V(r,d),value:i,parent:n,parentProperty:null},this._handleCallback(c,o,"property"),c;if(d==="$")p(this._trace(h,e,r,null,null,o,s));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(d))p(this._slice(d,h,e,r,n,i,o));else if(d.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var v=d.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1");this._walk(e,function(b){l._eval(v,e[b],b,r,n,i)&&p(l._trace(h,e[b],V(r,b),e,b,o,!0))})}else if(d[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");p(this._trace(Wt(this._eval(d,e,r[r.length-1],r.slice(0,-1),n,i),h),e,r,n,i,o,s))}else if(d[0]==="@"){var m=!1,y=d.slice(1,-2);switch(y){case"scalar":(!e||!["object","function"].includes(L(e)))&&(m=!0);break;case"boolean":case"string":case"undefined":case"function":L(e)===y&&(m=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(m=!0);break;case"number":Number.isFinite(e)&&(m=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(m=!0);break;case"object":e&&L(e)===y&&(m=!0);break;case"array":Array.isArray(e)&&(m=!0);break;case"other":m=this.currOtherTypeCallback(e,r,n,i);break;case"null":e===null&&(m=!0);break;default:throw new TypeError("Unknown value type "+y)}if(m)return c={path:r,value:e,parent:n,parentProperty:i},this._handleCallback(c,o,"value"),c}else if(d[0]==="`"&&e&&S.call(e,d.slice(1))){var A=d.slice(1);p(this._trace(h,e[A],V(r,A),e,A,o,s,!0))}else if(d.includes(",")){var Z=d.split(","),j=or(Z),tt;try{for(j.s();!(tt=j.n()).done;){var wt=tt.value;p(this._trace(Wt(wt,h),e,r,n,i,o,!0))}}catch(b){j.e(b)}finally{j.f()}}else!a&&e&&S.call(e,d)&&p(this._trace(h,e[d],V(r,d),e,d,o,s,!0))}if(this._hasParentSelector)for(var D=0;D<u.length;D++){var U=u[D];if(U&&U.isParentSelector){var N=this._trace(U.expr,e,U.path,n,i,o,s);if(Array.isArray(N)){u[D]=N[0];for(var ot=N.length,z=1;z<ot;z++)D++,u.splice(D,0,N[z])}else u[D]=N}}return u};f.prototype._walk=function(t,e){if(Array.isArray(t))for(var r=t.length,n=0;n<r;n++)e(n);else t&&L(t)==="object"&&Object.keys(t).forEach(function(i){e(i)})};f.prototype._slice=function(t,e,r,n,i,o,s){if(Array.isArray(r)){var a=r.length,l=t.split(":"),c=l[2]&&Number.parseInt(l[2])||1,d=l[0]&&Number.parseInt(l[0])||0,h=l[1]&&Number.parseInt(l[1])||a;d=d<0?Math.max(0,d+a):Math.min(a,d),h=h<0?Math.max(0,h+a):Math.min(a,h);for(var u=[],p=d;p<h;p+=c){var v=this._trace(Wt(p,e),r,n,i,o,s,!0);v.forEach(function(m){u.push(m)})}return u}};f.prototype._eval=function(t,e,r,n,i,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=i,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;var s=t.includes("@path");s&&(this.currSandbox._$_path=f.toPathString(n.concat([r])));var a="script:"+t;if(!f.cache[a]){var l=t.replace(/@parentProperty/g,"_$_parentProperty").replace(/@parent/g,"_$_parent").replace(/@property/g,"_$_property").replace(/@root/g,"_$_root").replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1");s&&(l=l.replace(/@path/g,"_$_path")),f.cache[a]=new this.vm.Script(l)}try{return f.cache[a].runInNewContext(this.currSandbox)}catch(c){throw new Error("jsonPath: "+c.message+": "+t)}};f.cache={};f.toPathString=function(t){for(var e=t,r=e.length,n="$",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[i])||(n+=/^[\*0-9]+$/.test(e[i])?"["+e[i]+"]":"['"+e[i]+"']");return n};f.toPointer=function(t){for(var e=t,r=e.length,n="",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[i])||(n+="/"+e[i].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return n};f.toPathArray=function(t){var e=f.cache;if(e[t])return e[t].concat();var r=[],n=t.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,";$&;").replace(/['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))['\]]/g,function(o,s){return"[#"+(r.push(s)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(o,s){return"['"+s.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(o,s){return";"+s.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),i=n.split(";").map(function(o){var s=o.match(/#([0-9]+)/);return!s||!s[1]?o:r[s[1]]});return e[t]=i,e[t].concat()};var ar=function(e,r,n){for(var i=e.length,o=0;o<i;o++){var s=e[o];n(s)&&r.push(e.splice(o--,1)[0])}},lr=function(){function t(e){ie(this,t),this.code=e}return oe(t,[{key:"runInNewContext",value:function(r){var n=this.code,i=Object.keys(r),o=[];ar(i,o,function(d){return typeof r[d]=="function"});var s=i.map(function(d,h){return r[d]}),a=o.reduce(function(d,h){var u=r[h].toString();return/function/.test(u)||(u="function "+u),"var "+h+"="+u+";"+d},"");n=a+n,!/(["'])use strict\1/.test(n)&&!i.includes("arguments")&&(n="var arguments = undefined;"+n),n=n.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var l=n.lastIndexOf(";"),c=l>-1?n.slice(0,l+1)+" return "+n.slice(l+1):" return "+n;return dt(Function,i.concat([c])).apply(void 0,er(s))}}]),t}();f.prototype.vm={Script:lr};function zt(t,e){try{return f({path:e,json:t})}catch(r){return[]}}function et(t,e){var r;return((r=zt(t,e))===null||r===void 0?void 0:r.flat(1/0))||[]}function ht(t,e,r=!1,n=t){var i=e;let o=Object.keys(t).sort((a,l)=>l.length-a.length);for(let a of o)if(e.startsWith(a)){if(a==e){if(r)return t[a];continue}i=e.substring(a.length+1),n=t[a];break}var s=et(n,i);return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[i.replace(/^.*?\./,"_."),i.replace(/^.*?\./,""),i.replace(/^([^.]+).*?\.\$([\.\[])/,"$1$2"),i.replace(/^.*?\.\$([\.\[])/,"_$1"),i.replace(/^.*?\.\$([\.\[])/,"$$$1"),i.replace(/^[^.]+$/,"_")].filter((a,l,c)=>c.indexOf(a)===l).reduce((a,l)=>a.length>0?a:et(n,l),[])),r&&Array.isArray(s)?s[0]:s}function Ht(t,e={},r){return r?`<${r}${Object.entries(e).map(([n,i])=>i!=null&&` ${n}="${i}"`).filter(Boolean).join("")}>${J(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):J(t)}function J(t){var e;if(Array.isArray(t))return t.map(J).join(`
4
+ `).trim();if(typeof t=="string")return t;if(t==null)return"";switch(t.type){case"heading":let{level:r,...n}=t.attrs;return Ht(t.content,n,"h"+r);case"text":return(t.marks||[]).reduce((i,o)=>Ht(i,o.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[o.type]),(e=t.text)===null||e===void 0?void 0:e.replace(/\s+/," "));default:return Ht(t.content||t.text,t.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[t.type])}}function le(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&pt(i,o),n.addedNodes&&n.addedNodes.forEach(s=>{s.nodeType==1&&de(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function de(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];pt(i,i.getAttribute("data-embed-src"))}if(e)return le(t)}function pt(t,e){for(var r=t;r;r=r.parentElement)if(!r.parentElement){let i=r.querySelectorAll("script");for(var n=0;n<i.length;n++)if(i[n].getAttribute("src")==e)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let o=r.ownerDocument.createElement("script");o.setAttribute("type","module"),o.setAttribute("src",e),r.appendChild(o);break}}var _t={};lt(_t,{adjustNumbers:()=>pe,cleanCollectionBit:()=>ft,getHumanizedLabel:()=>fe,getLastPathBit:()=>me,getQualifier:()=>he,normalizeCollectionScope:()=>Rt,parseLimit:()=>ce,parseRange:()=>ue});var ce=t=>{var e;let r=parseInt((e=t==null?void 0:t.match(/\[0:(\d+)\]/))===null||e===void 0?void 0:e[1],10);return!isNaN(r)&&r>0?String(r):null},ue=t=>{var e;let r=(e=t==null?void 0:t.match(/\[([^\]]+)\]/))===null||e===void 0?void 0:e[1].split(/\s*,\s*/g).filter(Boolean).map(n=>{if(n.match(/^-?\d+$/))return n;let i=n.match(/^(\d+):(\d+)$/);return i&&parseInt(i[1],10)<parseInt(i[2],10)?i[1]+"-"+i[2]:null});return r!=null&&r.every(Boolean)?r.join(","):null},he=t=>{var e;return(e=t==null?void 0:t.match(/(\.\*|\[[^\]]*\])$/))===null||e===void 0?void 0:e[0]};function ft(t){return t.replace(/(\.?\[[^\]\[]*\]|\.\*)$/g,"")}function Rt(t){return ft(t)+".*"}function pe(t,e){return t==null?void 0:t.replace(/(.|^)(\d+)/g,(r,n,i)=>n+(n==":"?i:String(parseInt(i)+e)))}function fe(t,e=2){var r=ft(t).split(/]\.|\.\*\./g).pop().split(/\./g).slice(-3);return r=r.filter(n=>isNaN(parseInt(n))),r.map(n=>n.charAt(0).toUpperCase()+n.slice(1)).slice(-e).join(" ")}function me(t){return ft(t).split(".").pop()}var dr=["January","February","March","April","May","June","July","August","September","October","November","December"],ve=t=>{if(!t||typeof t.getDay!="function")return;let e=t.getFullYear(),r=dr[t.getMonth()],n=t.getDate();return`${r} ${n}, ${e}`},ge=function(t){return String(new Date(t))!=="Invalid Date"&&!isNaN(Number(new Date(t)))};function be(t){let e=t.getAttribute("data-path-scope");for(var r=0,n=t;n=n.previousElementSibling;)n.getAttribute("data-path-scope")==e&&r++;return r}function cr(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var i=be(t);if(i!=0)return;let o=t.parentNode;if(o!=null){e==0?t.setAttribute("hidden","hidden"):t.getAttribute("hidden")!=null&&t.removeAttribute("hidden");for(var s=i+1,a=t,l=t;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==n&&(s++,a=l);for(var c=s;c<e;c++)o.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var c=Math.max(1,e);c<s;c++)a=a.previousElementSibling,o.removeChild(a.nextElementSibling)}}function Y(t,e,r,n){var i,o,s;if(!t)return;var a=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=J(r)),n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(t,e,r));var l=e.replace("data-path-","");if(e=="data-path-src"||e=="data-path-alt"){let y=Array.from(t.children).find(A=>A.localName=="picture")||t;a=t.localName=="img"?t:y.querySelector("img, video")}else if(e=="data-path-href")a=t.querySelector("a")||t.closest("a");else if(e=="data-path-hidden")r=r?null:!0;else if(e=="data-path"||e=="data-embed-html"||e=="html")l="innerHTML";else if(e=="data-embed-src")pt(t,r);else if(e=="data-path-attributes"){let y=((i=t.getAttribute("data-attributes-keys"))===null||i===void 0?void 0:i.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var c in r){var d=r[c];Y(t,c,typeof d=="object"&&d?JSON.stringify(d):d,n)}for(var h=0;h<y.length;h++)(r==null||!(y[h]in r))&&Y(t,y[h],null,n);Y(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!a)return;if((l=="innerHTML"||l=="src")&&(r==null||r==="")){var p=String((s=(o=t.getAttribute("data-path-placeholder")||a[l])!==null&&o!==void 0?o:a.getAttribute(l))!==null&&s!==void 0?s:"");l=="innerHTML"?a.innerHTML=p:p?a.setAttribute(l,p):a.removeAttribute(l)}else if(r!=null)if(l=="innerHTML"){for(var v=String(r),m=a;m.parentElement&&m.localName.match(/^(a|var|strong|em|i|b)$/);)m=m.parentElement;m.localName.match(/p|h\d|button|time|li/)&&(v=v.replace(/<(p|h\d|li|ul)[^>]*?>|<\/(p|h\d|li|ul)[^>]*?>/g," ").trim().replace(/\s+/g," ")),String(m.getAttribute("class")).includes("-inline--time")&&ge(v)&&(v=ve(new Date(v))),a.innerHTML!=v&&(a.innerHTML=v)}else a.getAttribute(l)!=r&&a.setAttribute(l,r);else a.removeAttribute(l)}var ye=["data-attributes-keys","data-path-attributes","data-path-scope"];function _(t,e,r,n){var i,o,s;let a=t;if(n||(e=((i=r==null?void 0:r.processData)===null||i===void 0?void 0:i.call(r,a,e))||e),a.nodeType==1){let d=a.getAttribute("data-path-scope");if(d){let u=be(a),p=ht(e,d,!1);u==0&&cr(a,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,a,p))===!1?1:p.length,r),e={...e,[Rt(d)]:p[u]}}let h=Array.prototype.slice.call(a.attributes).sort((u,p)=>ye.indexOf(u.name)-ye.indexOf(p.name));for(var l=0;l<h.length;l++){let{name:u,value:p}=h[l];u.startsWith("data-path")&&u!="data-path-scope"&&Y(a,u,ht(e,p,!0),r),u=="data-embed-src"&&Y(a,u,a.getAttribute(u),r)}}for(var l=0,c;c=a.childNodes[l++];)Ae(c)&&_(c,e,r,!0);return n||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,e),a}function Ae(t){return t.nodeType==1}function q(t,e,r,n){var i;let o=((i=n==null?void 0:n.processTemplate)===null||i===void 0?void 0:i.call(n,t,e,r))||e;if(t.innerHTML=o,t.classList.add("-feaas"),(t.closest(".component.feaas")||t).className.includes("-theme--"))for(var a=0,l;l=t.childNodes[a++];)Ae(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return _(t,r,n)}function Ee(t,e,r,n=!1){var i;let o=((i=r==null?void 0:r.processTemplate)===null||i===void 0?void 0:i.call(r,null,t,e))||t;if(typeof document=="undefined"||n){let s=Ot(o);return _(s[0],e,r).outerHTML}else{let s=document.createElement("div");return s.innerHTML=o,_(s,e,r),s.innerHTML}}var G=class{constructor(e,r=1,n){this.ownerDocument={createElement(i){return new G(i)}},this.nodeName=e,this.nodeType=r,this.textContent=n,this.attributes=[],this.childNodes=[]}setAttribute(e,r){let n=this.attributes.find(i=>i.name===e);n?n.value=r:this.attributes.push({name:e,value:r})}getAttribute(e){let r=this.attributes.find(n=>n.name===e);return r?r.value:void 0}insertBefore(e,r){if(e.parentNode=this,r===null)this.childNodes.push(e);else{let n=this.childNodes.indexOf(r);n!==-1&&this.childNodes.splice(n,0,e)}}removeAttribute(e){let r=this.attributes.findIndex(n=>n.name===e);r!==-1&&this.attributes.splice(r,1)}appendChild(e){e.parentNode=this,this.childNodes.push(e)}get tagName(){var e;return(e=this.nodeName)===null||e===void 0?void 0:e.toUpperCase()}get localName(){var e;return(e=this.nodeName)===null||e===void 0?void 0:e.toLowerCase()}get innerHTML(){return Vt(this.childNodes)}set innerHTML(e){this.childNodes=Ot(String(e!=null?e:""))}get outerHTML(){return Vt([this])}get children(){return this.childNodes.filter(e=>e.nodeType==1)}closest(e){let r=this;for(;r;){if(Ce(e,r))return r;r=r.parentNode}return null}querySelectorAll(e){let r=e.split(/\s*,\s*/),n=[],i=o=>{for(let s of r)if(Ce(s,o)){n.push(o);break}for(let s of o.childNodes)i(s)};for(let o of this.childNodes)i(o);return n}querySelector(e){return this.querySelectorAll(e)[0]}findSibling(e,r){if(!this.parentNode)return null;let n=this.parentNode.childNodes,i=n.indexOf(this);if(i===-1)return null;for(let o=i+e;o>=0&&o<n.length;o+=e){let s=n[o];if(!r||s.nodeType===1)return s}return null}removeChild(e){let r=this.childNodes.indexOf(e);if(r!==-1)return this.childNodes.splice(r,1),e.parentNode=void 0,e}get previousSibling(){return this.findSibling(-1)}get nextSibling(){return this.findSibling(1)}get previousElementSibling(){return this.findSibling(-1,!0)}get nextElementSibling(){return this.findSibling(1,!0)}cloneNode(e=!1){let r=new G(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),e)for(let n of this.childNodes){let i=n.cloneNode(!0);r.appendChild(i)}return r}get parentElement(){var e;return((e=this.parentNode)===null||e===void 0?void 0:e.nodeType)==1?this.parentNode:null}};function Ce(t,e){let r=t.match(/([.#]?[\w-]+|\[([\w-]+)(="([^"]*)")?\])/g);if(!r)return!1;for(let n of r)if(n.startsWith("#")){if(e.getAttribute("id")!==n.slice(1))return!1}else if(n.startsWith(".")){if(!(e.getAttribute("class")||"").split(" ").includes(n.slice(1)))return!1}else if(n.startsWith("[")){let i=n.match(/^\[([\w-]+)(="([^"]*)")?\]$/);if(i){let o=i[1],s=i[3],a=e.getAttribute(o);if(typeof s=="undefined"){if(a===void 0)return!1}else if(a!==s)return!1}else return!1}else if(e.nodeName!==n)return!1;return!0}function Ot(t){var e;let r=[],n=[];for(;t;){let i=t.match(/^<([\w-]+)(\s[^>]*)?>/),o=t.match(/^<\/([\w-]+)>/);if(i){let s=i[1].toLowerCase(),l=((e=(i[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||e===void 0?void 0:e.map(d=>{let[h,u,,p]=d.match(/([\w-]+)(="([^"]*)")?/);return{name:u,value:hr(p||"")}}))||[],c=new G(s,1);if(c.attributes=l,n.length>0){let d=n[n.length-1];d.childNodes.push(c),c.parentNode=d}else r.push(c);["img","input","br"].includes(s)||n.push(c),t=t.slice(i[0].length)}else if(o)n.pop(),t=t.slice(o[0].length);else{let s=t.indexOf("<"),a=t.slice(0,s!==-1?s:void 0),l=new G("#text",3);if(l.textContent=a,n.length>0){let c=n[n.length-1];c.childNodes.push(l),l.parentNode=c}else r.push(l);t=t.slice(a.length)}}return r}function ur(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function hr(t){return t.replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#x27;/g,"'")}function Vt(t){return t.map(e=>{if(e.nodeType===3)return e.textContent||"";let{nodeName:r,attributes:n}=e,i=n.map(({name:s,value:a})=>` ${s}="${ur(String(a))}"`).join(""),o=Vt(e.childNodes);return["img","input","br"].includes(r)?`<${r}${i} />`:`<${r}${i}>${o}</${r}>`}).join("")}function pr(t,e,r){return Jt(t,e,r)[0].outerHTML}function Jt(t,e,r){var n;let i=((n=r==null?void 0:r.processTemplate)===null||n===void 0?void 0:n.call(r,null,t,e))||t;return Ot(i).map(s=>_(s,e,r))}function fr(t){let{params:e,method:r,headers:n,body:i,url:o}=w(t);var s={url:o},a={...n};return n["Content-Type"]==="application/json"&&delete a["Content-Type"],n.Accept==="application/json"&&delete a.Accept,Object.keys(a).length>0&&(s.headers=a),r!=="GET"&&(s.method=r),r==="GET"||r==="HEAD"||Object.keys(i).length===0||(s.body=i),Object.keys(e).length>0&&(s={...s,params:e}),s}var Dt=t=>{if(typeof t.url!="string")return!1;for(var e in t)if(!(e=="body"||e=="params"||e=="headers"||e=="url"||e==="method"||e=="jsonpath"&&typeof t[e]=="string"))return!1;return!0};function we(t){let{url:e,headers:r,params:n,method:i,body:o}=w(t),s,a=r["Content-Type"];i!="GET"&&i!="HEAD"&&(a==="application/json"&&(s=JSON.stringify(o)),a==="multipart/form-data"&&(s=Object.keys(o).reduce((c,d)=>(c.append(d,o[d]),c),new FormData)),a==="application/x-www-form-urlencoded"&&(s=new URLSearchParams(o)));let l=Object.keys(n).length?`?${new URLSearchParams(n)}`:"";return[`${e}${l}`,{headers:r,body:s,method:i}]}function w(t){let e={};for(let r in(t==null?void 0:t.headers)||{})if(t.headers.hasOwnProperty(r)){let n=r.replace(/^[a-z]|\-[a-z]/g,i=>i.toUpperCase());e[n]=t.headers[r]}return e.Accept||(e.Accept="application/json"),{params:(t==null?void 0:t.params)||{},headers:e,jsonpath:String((t==null?void 0:t.jsonpath)||"$"),method:((t==null?void 0:t.method)||"GET").toUpperCase(),body:(t==null?void 0:t.body)||{},url:String((t==null?void 0:t.url)||"")}}var Yt=async t=>{try{let[e,r]=we(t),i=await(await w.fetchImplementation(e,{...r,method:r.method.toLowerCase()})).json();return t.jsonpath&&t.jsonpath!="$"?et(i,t.jsonpath):i}catch(e){return{}}};async function qt(t){if(!t)return t;if(Dt(t))return Yt(t);let e=Object.keys(t),r=await Promise.all(e.map(n=>Dt(t[n])?Yt(t[n]):null).filter(Boolean));return e.reduce((n,i)=>({...n,[i]:Dt(t[i])?r.shift():t[i]}),{})}w.clean=fr;w.toFetchArguments=we;w.fetchOne=Yt;w.fetch=qt;w.isDataSettings=Dt;w.fetchImplementation=(...t)=>fetch(...t);var ee={};lt(ee,{Component:()=>bt,ComponentProps:()=>Ne,Context:()=>X,ControlledPromise:()=>F,DEFAULT_CDN_URL:()=>$,DOM:()=>Ft,DataPath:()=>_t,DataScope:()=>St,DataSettings:()=>w,Element:()=>C,FEAASComponent:()=>bt,FEAASComponentsProps:()=>Ne,FEAASContext:()=>X,FEAASContextProps:()=>We,FEAASEditor:()=>Et,FEAASEditorProps:()=>Be,FEAASElement:()=>C,FEAASLoader:()=>At,FEAASLoaderProps:()=>ke,FEAASPicker:()=>Ct,FEAASPickerProps:()=>Ue,FEAASStylesheet:()=>Lt,FEAASStylesheetProps:()=>Pe,InvalidResponse:()=>kt,JSONPath:()=>f,Loader:()=>At,MyComponent:()=>Nt,Picker:()=>Ct,Stylesheet:()=>Lt,Thumbnail:()=>$t,WebComponent:()=>xe,adjustNumbers:()=>pe,autoloadScripts:()=>de,cleanCollectionBit:()=>ft,clearFetchCache:()=>mr,createStylesheet:()=>Oe,fetchAndRevalidate:()=>vt,fetchAndRevalidateComponent:()=>it,fetchAndRevalidateStylesheet:()=>Tt,fetchBypassingCache:()=>Pt,fetchCache:()=>mt,fetchComponent:()=>Kt,fetchData:()=>qt,fetchToValidateCache:()=>gt,fetchWithCacheAwareness:()=>K,findStylesheet:()=>Fe,getComponentSource:()=>vr,getComponentURL:()=>yt,getFetchCache:()=>Re,getFramePosition:()=>Ie,getHumanizedLabel:()=>fe,getLastPathBit:()=>me,getQualifier:()=>he,getStylesheetSource:()=>Gt,getStylesheetURL:()=>H,loadScript:()=>pt,loadStylesheet:()=>Mt,loadStylesheetAllowStale:()=>Qt,normalizeCollectionScope:()=>Rt,observeDOMElement:()=>le,parseComponentSource:()=>Q,parseLimit:()=>ce,parseRange:()=>ue,parseStylesheetSource:()=>nt,queryObject:()=>et,queryObjectRaw:()=>zt,queryScopes:()=>ht,renderComponent:()=>Xt,renderComponentElement:()=>yr,renderComponentPromise:()=>De,renderDOMContent:()=>q,renderDOMElement:()=>_,renderHTMLContent:()=>Ee,renderStylesheet:()=>gr,renderStylesheetPromise:()=>_e,serializeCH1RichText:()=>J,setDOMAttribute:()=>Y});function F(t,e=r=>{}){var r;let n=()=>{var i,o;let s=new Promise((l,c)=>{i=d=>{t==null||t(d),l(d)},o=c});var a=Object.assign(s,{resolve:i,reject:o,restart:n,first:r});return r=a,a.catch(e),a};return n()}var xe=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,C=class extends xe{getProps(e){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=F(e=>{this.payload=e}),this.whenRendered=F(()=>this.initialized=!0,()=>this.cancelRender()),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(e,r,n){this.set()}connectedCallback(){this.mount()}disconnectedCallback(){this.unmount()}mount(){try{let e=this.getParent();if(e&&!e.connected||this.connected)return;this.connected=!0,this.log("FEAAS: Mount",this.tagName,this),this.dispatchEventIndirectly(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var n;return(n=r.mount)===null||n===void 0?void 0:n.call(r)}),this.set()}catch(e){this.onError(e)}}dispatchEventIndirectly(e){this.dispatchEvent(e);let r=this.getParent();r&&!r.contains(this)&&(Object.defineProperty(e,"target",{value:this,writable:!1}),Object.defineProperty(e,"composedPath",{value:()=>[this],writable:!1}),r.handleEvent(e))}isJSONAttribute(e){return!1}log(...e){let r=e[0];(typeof location!="undefined"&&(location!=null&&location.hostname.startsWith("components-"))||localStorage["Sitecore.Components.Debug"])&&console.log(r+" "+e.slice(1).map(n=>n&&typeof n=="object"?"%O":"%s").join(" "),...e.slice(1))}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEventIndirectly(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected&&this.initialized&&this.render&&this.update(),this.cancelRender(),this.connected=!1,this.initialized&&this.render&&this.update())}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;if(this.tagName!="FEAAS-CONTEXT")return document.querySelector("feaas-context")}getElements(e=this.getRoot(),r=!0){return Array.from(e.querySelectorAll("*")).map(n=>[!r||n.tagName.startsWith("FEAAS-")?n:null,n.shadowRoot?this.getElements(n.shadowRoot,r):null]).flat().filter(Boolean)}handleEvent(e){let r=e.composedPath()[0];switch(e.type){case"feaasMount":r!=this&&this.nestedCallback(r);break;case"feaasUnmount":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(e){let r=this.descendants.indexOf(e);r!=-1&&(this.log("FEAAS: Unnest",this,e),this.descendants.splice(r,1),this.refs[e.getComponentName()]=null,e.refs.parent==this&&(e.refs.parent=null),e.refs.top==this&&(e.refs.top=e.refs.parent))}nestedCallback(e){var r,n;if(this.descendants.indexOf(e)==-1&&(this.descendants.push(e),this.log("FEAAS: Nest",this,e),this.refs[e.getComponentName()]=e,e.refs.top=this,(r=e.refs).parent||(r.parent=this),e.render))for(var o=e.refs.parent;o;o=o.refs.parent)o.render&&((n=e.refs).parentReact||(n.parentReact=o),e.refs.topReact=o)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(e,r="uncaught",n=!1){let i=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:e});if(this.dispatchEventIndirectly(i),this.whenLoaded.reject(e),!i.defaultPrevented&&!n){this.whenRendered.reject(e);try{this.unmount()}catch(o){}return!0}return!1}shouldUpdateOnLoad(){return!0}async advance(){try{if(this.payload===void 0){if(!this.isReadyToLoad())return;this.payload=null,this.dispatchEventIndirectly(new Event("feaasLoad",{bubbles:!0,composed:!0}));let e=await this.load().catch(r=>{throw this.payload=void 0,r});if(this.whenLoaded.resolve(e),this.onLoad)return}else if(this.payload==null)return;this.flush(),this.whenRendered.resolve(this)}catch(e){this.onError(e)}}flush(){var e,r;if(!this.connected)return;let n=(r=(e=this.payload)===null||e===void 0?void 0:e.ReactDOM)===null||r===void 0?void 0:r.flushSync;n?n(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var e,r,n;if(this.payload==null||!this.render)return;let{React:i,ReactDOM:o,ReactDOMClient:s}=this.payload||{};if(!i)throw new Error(`${this.tagName}: React is not present in payload`);if(!o)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);this.getAttribute("hydrate")!="false"&&(!this.refs.topReact&&!this.forceUpdateReact?s?(this.reactRoot||(this.reactRoot=s.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):o.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact&&this.connected?(e=this.forceUpdateReact)===null||e===void 0||e.call(this):(n=(r=this.refs.topReact)===null||r===void 0?void 0:r.forceUpdateReact)===null||n===void 0||n.call(r))}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let n=this.descendants.filter(i=>i.refs.parentReact==this&&i.payload&&i.connected).map((i,o)=>this.getReactElement(i));return this.render({...this.props,children:n},this.payload)}getReactErrorBoundary(e=this,r=e.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:n,ReactDOM:i}=e.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends n.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,a){console.error(`FEAAS: ${e.tagName} Error:`,s,a),e.onError(s,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(e=this,r){let{React:n,ReactDOM:i}=e.payload||{},o=this.getReactErrorBoundary(),s=this.getReactWrapper(e);return n.createElement(o,{key:e.tagName+"-"+e.getUID(),slot:e.getAttribute("slot")},n.createElement(s,null))}getReactWrapper(e=this,r=e.tagName){if(e.reactWrapper)return e.reactWrapper;let{React:n,ReactDOM:i}=e.payload||{};return e.reactWrapper=o=>{if(e.render){let[s,a]=n.useReducer(l=>l+1,0);return e.forceUpdateReact=a,i.createPortal(n.createElement(n.Fragment,null,e.invokeReactRendering()),e.getReactRootElement())}else return e.update()},Object.assign(e.reactWrapper,{key:e.tagName+"-"+e.getUID(),displayName:r}),e.reactWrapper}getUID(){return this.uid||(this.uid=String(Math.random()))}getShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}getReactRootElement(){return this.useShadowRoot?this.getShadowRoot():this.getRoot()}set(e){try{this.scheduleRender(),this.overrides={...this.overrides,...e},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let i=this.isJSONAttribute(r),o=this.props[r],s=i?JSON.stringify(o):String(o),a=this.defaultProps[r],l=i?JSON.stringify(a):String(a),c=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),d=this.getAttribute(c);try{var n=i?JSON.stringify(JSON.parse(d)):d}catch(h){var n=null}o==null||s===l?this.removeAttribute(c):(typeof o=="string"||typeof o=="number"||typeof o=="boolean"||i)&&n!=s&&this.setAttribute(c,s)}}catch(i){this.whenRendered.reject(i),this.onError(i,"set")}return this}import(e){return import( /*@vite-ignore*/ /* webpackIgnore: true */ e)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),this.cancelRender(),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(e=>{})})}cancelRender(){cancelAnimationFrame(this.nextRender)}formatURL(e,r){return typeof e=="string"&&e.match(/^\/[^\/]/)?r+e:e}getContextAttribute(e,r=this){for(var n=this;n=n.parentElement||(n.parentNode instanceof ShadowRoot?n.parentNode.host:null);)if(n.getAttribute(e)!=null)return n.getAttribute(e);return this.getAttribute(e)}static register(e,r){r==null&&(r=typeof window!="undefined"?window:null),r&&!r.customElements.get(e)&&r.customElements.define(e,this)}};var rt=class extends C{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)}},Nt=class extends rt{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:e},{React:r}){let[n,i]=r.useState(0);return r.useEffect(()=>{i(o=>o+1)},[e]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",e),r.createElement("p",null,"Triggered updates: ",n))}};Nt.observedAttributes=["counter"];var Se=["initial","check","updated"],mt={};function mr(){mt={}}async function vt(t,e,r,n,i=mt){return K({url:t,options:e,validator:r,callback:n,cache:i}).then(gt).then(o=>o.response)}function Re(t,e=!1){let r=String(t).replace("?head","");var n=mt[r];return!n&&!e&&(n=mt[r]={phase:null,initial:F(),check:F(),updated:F(),final:F()}),n}var kt=class extends Error{};async function K({url:t,options:e,validator:r,callback:n,cache:i},o="initial"){let s=new Date;if(i!=null){var a=Re(t);if(Se.indexOf(a.phase)>=Se.indexOf(o))var l=a[o];else a.phase=o}let c=await(l||fetch(t,e));if(!l&&a&&(c.ok?a[o].resolve(c):a[o].reject(new Error("Fetch failed"))),!c.ok)throw new Error("Fetch failed");let d=new Date(c.headers.get("date"))<s||l&&o=="initial"&&(a.phase=="updated"||a.phase=="check");if((r==null?void 0:r(c,d))===!1)throw new kt("Response is not valid");return await(n==null?void 0:n(c,o,d)),{url:t,options:e,isCached:d,response:c,validator:r,callback:n,cache:i}}async function gt(t){let{url:e,isCached:r,options:n,validator:i,response:o,cache:s}=t;if(r){let{response:a}=await K({url:e+"?head",options:{...n,method:"HEAD",cache:"no-cache"},validator:i,cache:s},"check");if(a.headers.get("last-modified")!=o.headers.get("last-modified"))return Pt(t)}return t}async function Pt(t){return K({...t,options:{...t.options,cache:"reload"}},"updated")}var $="https://feaas.blob.core.windows.net";function Q(t){let e=t.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(e){var[,r,n,i,o,s]=e;return{cdn:r,library:n,component:i,version:o,revision:s}}}function vr(t){if(!t||!t.library||!t.component)throw new Error("Component requires `library` and `component` properties");return`${t.cdn&&t.cdn!=$?`${t.cdn}/components`:""}/${t.library}/${t.component}/${!t.version||t.version=="responsive"&&(!t.revision||t.revision=="published")?"":t.version}/${!t.revision||t.revision=="published"?"":t.revision}`.replace(/(^\/|\/$|\/\/)(?!.+\/components\/)/g,"")}function Gt(t){return`${t.cdn&&t.cdn!=$?`${t.cdn}/styles/`:""}${t.library}/${!t.revision||t.revision=="published"?"":t.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function nt(t){let e=t.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(e){var[,r,n,i]=e;return{cdn:r,library:n,revision:i}}else{let o=Q(t);if(o){var{cdn:r,library:n,revision:i}=o;return i!=null&&i.match(/\d/)&&(i=void 0),{cdn:r,library:n,revision:i}}}}function yt(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...Q(t.src)}),`${t.cdn||t.hostname||$}/components/${t.library}/${t.component}/${t.version}/${t.revision||"published"}.html`}function H(t){return typeof t=="string"&&(t={src:t}),"src"in t&&(t={...nt(t.src)}),`${t.cdn||t.hostname||$}/styles/${t.library}/${t.revision=="staged"?"staged":t.revision=="saved"?"saved":"published"}.css`}async function it(t,e,r=!1){let n=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,i=a=>a.clone().text().then(e),o=await Promise.all([t.instance&&K({options:{headers:{Accept:"text/html"},credentials:"omit"},url:yt({...t,version:t.instance}),validator:n}).catch(a=>a),K({url:yt(t),validator:n}).catch(a=>a)]),s=o.find(a=>a&&"isCached"in a&&a);if(!s||s instanceof Error)throw o.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return o[0]==s&&console.log("Using fork!",o),await i(s.response),r?s:gt({...s,callback:i}).catch(a=>{if(o[0]==s&&(Pt({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return i(o[1].response),gt({...o[1],callback:i});throw a})}async function Kt(t){typeof t=="string"&&(t={src:t});var e;let{response:r}=await it(t,n=>{e=n},!0);return{...t,template:e,lastModified:r.headers.get("last-modified")}}async function Tt(t,e){return typeof t=="string"&&(t={src:t}),vt(H(t),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,n)=>r.clone().text().then(i=>e(i,n)))}function gr(t,e){return _e(t,e||(e=document.createElement("style"))),e}function _e(t,e){return e||(e=document.createElement("style")),Tt(t,(r,n)=>{e.textContent=r}).then(()=>e)}function Mt(t,e){var r=Fe(t);if(r){if(r.tagName=="LINK")return e(null,"initial"),Promise.resolve(r)}else var n=Oe(t);return Tt(t,(i,o)=>{n&&(n.textContent=i),e==null||e(i,o)}).then(()=>r||n)}function Qt(t){return new Promise((e,r)=>{Mt(t,e).catch(r)})}function Fe(t){return document.head.querySelector(`style[data-href="${H(t)}"]`)||document.querySelector(`link[rel="stylesheet"][href="${H(t)}"]`)}function Oe(t){let e=H(t),r=document.createElement("style");return r.setAttribute("data-href",e),document.head.appendChild(r),r}function yr(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return _(n,e),r}function Xt(t,e){return De(t,e||(e=document.createElement("div"))),e}async function De(t,e){return e||(e=document.createElement("div")),e.childNodes.length?_(e,t.data,t):"template"in t?q(e,t.template,t.data,t):it(t,r=>q(e,r,t.data,t)).then(()=>e)}function Ne(t){var e,r,n,i,o,s,a,l;let c,d=t.getAttribute("src");if(d){let A=Q(d);if(!A)throw new Error(`Could not parse FEAAS Component source: ${d}`);var{cdn:h,library:u,component:p,version:v,revision:m}=A}let y=t.getAttribute("data");if(y!=null&&y!="")try{c=typeof y=="string"?JSON.parse(y):{}}catch(A){console.error(A)}return{data:c||{},cdn:(r=(e=t.getContextAttribute("cdn"))!==null&&e!==void 0?e:h)!==null&&r!==void 0?r:$,library:(n=t.getAttribute("library"))!==null&&n!==void 0?n:u,component:(i=t.getAttribute("component"))!==null&&i!==void 0?i:p,version:(s=(o=t.getAttribute("version"))!==null&&o!==void 0?o:v)!==null&&s!==void 0?s:"responsive",revision:(l=(a=t.getAttribute("revision"))!==null&&a!==void 0?a:m)!==null&&l!==void 0?l:"published",hostname:t.getAttribute("hostname"),template:t.getAttribute("template"),instance:t.getAttribute("instance"),editable:t.getAttribute("editable")!=null,suspended:t.getAttribute("suspended")!=null,lastModified:t.getAttribute("last-modified"),withStylesheet:t.getAttribute("with-stylesheet")!="false"}}var bt=class extends C{setData(e){this.set({data:e})}getProps(){return Ne(this)}isJSONAttribute(e){return e=="data"}attributeChangedCallback(e,r,n){r!==n&&((e=="library"||e=="component"||e=="revision"||e=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(e,r,n),e==="data"&&this.fetchData())}async fetchData(){this.readyData=void 0,this.whenDataReady=this.whenDataReady.restart();let e=await w.fetch(this.props.data),r=this.alreadyRendered;await this.whenDataReady.resolve(e),r&&this.advance()}getEditor(){var e;return(e=document.querySelector("feaas-context"))===null||e===void 0?void 0:e.refs.editor}constructor(){super(),this.readyData={},this.whenDataReady=F(e=>this.readyData=e,e=>this.onError(e)),this.defaultProps={cdn:$,revision:"published",version:"responsive",withStylesheet:!0,editable:!1,suspended:!1,data:{}},this.onLoad=e=>{this.payload=e,this.advance()},this.getAttribute("data")||this.whenDataReady.resolve({}),this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let e=this.getEditor();if(e!=null&&e.setTarget(this))return e.open(),!0}getOriginal(){let e=this.getAttribute("data-path-scope");if(e){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==e;)var n=r;return n}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(this.getOriginal())return;let e=()=>{this.payload&&(r||this.readyData&&this.onLoad(this.payload))};if(this.props.withStylesheet)var r=Qt({...this.props}).then(()=>{r=null,e()});return Promise.all([r,this.whenDataReady.then(()=>e()),it(this.props,n=>{this.payload=n,e()})]).then(()=>this.payload)}flush(){this.readyData&&super.flush()}update(){if(this.alreadyRendered=!0,this.getAttribute("hydrate")!="false")if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)_(this,this.readyData);else{if(this.needsRefresh=!0,this.getOriginal())return;q(this,this.payload,this.readyData)}}};bt.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];bt.register("feaas-component");function ke(t){return{opacity:t!=null&&t.getAttribute("opacity")?parseFloat(t==null?void 0:t.getAttribute("opacity")):1,hidden:(t==null?void 0:t.getAttribute("hidden"))!=null}}var At=class extends C{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return ke(this)}attributeChangedCallback(e,r,n){if(r!==n)return e=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),n?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(e,r,n)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
5
5
  #loader {
6
6
  position: absolute;
7
7
  top: 0;
@@ -65,10 +65,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
65
65
  style="animation: 1.5s linear 0s infinite normal none running loader-circular-track"
66
66
  ></circle>
67
67
  </svg>
68
- </div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};we.observedAttributes=["hidden","opacity"];we.register("feaas-loader");function qt(e){var t,r,n,i;let o=e.getAttribute("src");if(o)var{cdn:s,library:a,revision:l}=re(o);return{library:e==null?void 0:e.getContextAttribute("library"),revision:(r=(t=e==null?void 0:e.getAttribute("revision"))!==null&&t!==void 0?t:l)!==null&&r!==void 0?r:"published",cdn:(i=(n=e==null?void 0:e.getContextAttribute("cdn"))!==null&&n!==void 0?n:e==null?void 0:e.getContextAttribute("hostname"))!==null&&i!==void 0?i:L}}var Ie=class extends A{constructor(){super(...arguments),this.onLoad=t=>{this.payload=t,this.advance()}}getProps(){return qt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return Be(this.props,this.onLoad)}};Ie.register("feaas-stylesheet");var Ue={};ue(Ue,{convertBase64toBlob:()=>Gt,generate:()=>Xt,get:()=>qr,getVersionForThumbnail:()=>Zt,load:()=>Qt,responseToImage:()=>at,upload:()=>er});var Gt=e=>fetch(e).then(t=>t.blob()),at=e=>e.blob().then(t=>new Promise((r,n)=>{let i=new Image;i.onerror=n,i.onload=()=>{r(i)},i.src=URL.createObjectURL(t)}));async function Zt(e){return e.versions.length||await e.versions.fetch(),e.getVersionForWidth(800)}async function qr(e,t,r){try{if(!e.isNew)return await Qt(e,t,r)}catch(i){e.sdk.log(`FEAAS: Thumbnail ${e.id}, version: ${(t==null?void 0:t.id)||"responsive"}, status: generating ${status}, reason: ${i}`)}let n=await Xt(e,t);return r==null||r(n,!1),n&&!e.isNew&&Gt(n.src).then(i=>er(e,t,i)),n}async function Qt(e,t,r){let n=t?t.getThumbnailURL():e.getThumbnailURL(),i=e.library.stylesheet,o=new Date(Math.max(Number(e.modifiedAt),Number(i.modifiedAt)));e.sdk.log(`FEAAS: Thumbnail ${e.id}/${(t==null?void 0:t.id)||"responsive"}, loading`);var s;return await ge(n,{},(a,l)=>{let u=Math.abs(Number(new Date(a.headers.get("x-ms-meta-componentRenderedAt")))-Number(o))<2e3;return l&&!u&&at(a).then(c=>{s=c,r(c,l)}),u},(a,l,u)=>{e.sdk.log(`FEAAS: Thumbnail ${e.id}/${(t==null?void 0:t.id)||"responsive"}, status: ${l}`),at(a).then(c=>{s=c,r(c,u)})},null),s}async function Xt(e,t,r){let n=t||(e.isNew?null:await Zt(e));if(!n||n.isViewEmpty())return null;let i=r||e.library.stylesheets.first,{datasources:o}=e.sdk;return await Gr(n.classList,i.getBreakpointForWidth(800,n.getBreakpoints()),n.view,o.reduce((a,l)=>Object.assign(a,{[l.id]:l.sample}),{}),i.css,e.sdk)}function Gr(e,t,r,n,i,o){let s=document.createElement("iframe");return s.style.position="absolute",s.style.top="-2000px",s.style.left="-2000px",s.style.width=t.props.minWidth+"px",s.style.height="720px",s.style.zIndex="100011",document.body.appendChild(s),new Promise((a,l)=>{let u=document.createElement("script");u.onerror=l,u.src=o.frontend+"/assets/html2canvas.js",u.onload=()=>{var p;(((p=s.contentWindow.document.fonts)===null||p===void 0?void 0:p.ready)||Promise.resolve()).then(function(){return s.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:o.backend+"/proxy/media",backgroundColor:"#ffffff"}).then(f=>{let m=f.toDataURL("image/jpeg",.6);s.parentElement.removeChild(s);let y=new Image;y.onload=()=>{a(y)},y.onerror=l,y.src=m})})},s.contentWindow.document.head.appendChild(u);let c=s.contentWindow.document.createElement("style");c.textContent=`
68
+ </div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};At.observedAttributes=["hidden","opacity"];At.register("feaas-loader");function Pe(t){var e,r,n,i;let o=t.getAttribute("src");if(o)var{cdn:s,library:a,revision:l}=nt(o);return{library:t==null?void 0:t.getContextAttribute("library"),revision:(r=(e=t==null?void 0:t.getAttribute("revision"))!==null&&e!==void 0?e:l)!==null&&r!==void 0?r:"published",cdn:(i=(n=t==null?void 0:t.getContextAttribute("cdn"))!==null&&n!==void 0?n:t==null?void 0:t.getContextAttribute("hostname"))!==null&&i!==void 0?i:$}}var Lt=class extends C{constructor(){super(...arguments),this.onLoad=e=>{this.payload=e,this.advance()}}getProps(){return Pe(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return Mt(this.props,this.onLoad)}};Lt.register("feaas-stylesheet");var $t={};lt($t,{convertBase64toBlob:()=>Te,generate:()=>$e,get:()=>br,getVersionForThumbnail:()=>Me,load:()=>Le,responseToImage:()=>Zt,upload:()=>je});var Te=t=>fetch(t).then(e=>e.blob()),Zt=t=>t.blob().then(e=>new Promise((r,n)=>{let i=new Image;i.onerror=n,i.onload=()=>{r(i)},i.src=URL.createObjectURL(e)}));async function Me(t){return t.versions.length||await t.versions.fetch(),t.getVersionForWidth(800)}async function br(t,e,r){try{if(!t.isNew)return await Le(t,e,r)}catch(i){t.sdk.log(`FEAAS: Thumbnail ${t.id}, version: ${(e==null?void 0:e.id)||"responsive"}, status: generating ${status}, reason: ${i}`)}let n=await $e(t,e);return r==null||r(n,!1),n&&!t.isNew&&Te(n.src).then(i=>je(t,e,i)),n}async function Le(t,e,r){let n=e?e.getThumbnailURL():t.getThumbnailURL(),i=t.library.stylesheet,o=new Date(Math.max(Number(t.modifiedAt),Number(i.modifiedAt)));t.sdk.log(`FEAAS: Thumbnail ${t.id}/${(e==null?void 0:e.id)||"responsive"}, loading`);var s;return await vt(n,{},(a,l)=>{let c=Math.abs(Number(new Date(a.headers.get("x-ms-meta-componentRenderedAt")))-Number(o))<2e3;return l&&!c&&Zt(a).then(d=>{s=d,r(d,l)}),c},(a,l,c)=>{t.sdk.log(`FEAAS: Thumbnail ${t.id}/${(e==null?void 0:e.id)||"responsive"}, status: ${l}`),Zt(a).then(d=>{s=d,r(d,c)})},null),s}async function $e(t,e,r){let n=e||(t.isNew?null:await Me(t));if(!n||n.isViewEmpty())return null;let i=r||t.library.stylesheets.first,{datasources:o}=t.sdk;return await Ar(n.classList,i.getBreakpointForWidth(800,n.getBreakpoints()),n.view,o.reduce((a,l)=>Object.assign(a,{[l.id]:l.sample}),{}),i.css,t.sdk)}function Ar(t,e,r,n,i,o){let s=document.createElement("iframe");return s.style.position="absolute",s.style.top="-2000px",s.style.left="-2000px",s.style.width=e.props.minWidth+"px",s.style.height="720px",s.style.zIndex="100011",document.body.appendChild(s),new Promise((a,l)=>{let c=document.createElement("script");c.onerror=l,c.src=o.frontend+"/assets/html2canvas.js",c.onload=()=>{var p;(((p=s.contentWindow.document.fonts)===null||p===void 0?void 0:p.ready)||Promise.resolve()).then(function(){return s.contentWindow.html2canvas(u,{scale:Math.max(1.1,1e3/Math.min(1401,Math.max(320,e.props.minWidth))),width:Math.min(1401,Math.max(320,e.props.minWidth)),height:Math.max(1,Math.min(2e3,u.offsetHeight)),windowWidth:e.props.minWidth+"px",windowHeight:1e3,proxy:o.backend+"/proxy/media",backgroundColor:"#ffffff"}).then(v=>{let m=v.toDataURL("image/jpeg",.6);s.parentElement.removeChild(s);let y=new Image;y.onload=()=>{a(y)},y.onerror=l,y.src=m})})},s.contentWindow.document.head.appendChild(c);let d=s.contentWindow.document.createElement("style");d.textContent=`
69
69
  ${i}
70
70
  body, html { padding: 0; margin: 0; overflow: hidden }
71
- `;let d=s.contentWindow.document.createElement("style");d.textContent=`
71
+ `;let h=s.contentWindow.document.createElement("style");h.textContent=`
72
72
  body, html { padding: 0; margin: 0; overflow: hidden }
73
- `,s.contentWindow.document.head.appendChild(c),s.contentWindow.document.head.appendChild(d);let h=st({template:r,data:n});h.classList.add(...e,"-feaas--preview","-emulate--"+t.details.slug),s.contentWindow.document.body.appendChild(h)})}async function er(e,t,r){let n=t?t.getThumbnailURL():e.getThumbnailURL(),i=new Date(Math.max(Number(e.modifiedAt),Number(e.library.stylesheet.modifiedAt)));try{await e.sdk.uploadBlob("thumbnails",n.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":i.toUTCString(),"x-ms-meta-componentModifiedAt":e.modifiedAt.toUTCString(),"x-ms-meta-componentCreatedAt":e.createdAt.toUTCString(),"x-ms-meta-modifiedAt":e.modifiedAt.toUTCString()}}),fetch(n,{cache:"no-cache"}).then(()=>{e.sdk.log("FEAAS: Thumbnail uploaded",n)})}catch(o){e.sdk.log("FEAAS: Thumbnail failed to upload",n,o)}return n}var lt;typeof window!="undefined"&&(window.FEAASReactElement=te,(lt=window.FEAASLoading)!==null&&lt!==void 0||(window.FEAASLoading=Promise.resolve()));function tr(e){let t=[];if(e){let r=e.ownerDocument.defaultView,n,i;for(;r!==window.top;){n=r.parent;for(let o=0;o<n.frames.length;o++)if(n.frames[o]===r){for(let s of n.document.getElementsByTagName("iframe"))if(s.contentWindow===r){i=s.getBoundingClientRect();let a=s.contentWindow.getComputedStyle(s);t.push({left:i.left+parseInt(a.borderLeftWidth),top:i.top+parseInt(a.borderTopWidth)})}r=n;break}}}return t.reduce((r,n)=>({left:r.left+n.left,top:r.top+n.top}),{left:0,top:0})}function rr(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 Ae=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=tr(t.memoized.focusable)),this.chrome&&(this.wrapperRect=this.chrome.positionable.getBoundingClientRect(),this.bodyRect=this.chrome.positionable.ownerDocument.body.parentElement.getBoundingClientRect())},this.onMeasure=()=>{},this.onPosition=({focusable:t,root:r})=>{!this.chrome||this.props.hidden||(t?(this.chrome.wrapper.style.width=t.width+16*2+"px",this.chrome.wrapper.style.height=t.height+16*1+64+"px",this.chrome.wrapper.style.left=t.left-16+"px",this.chrome.wrapper.style.top=t.top-64+"px",this.chrome.wrapper.style.opacity="1",this.chrome.absolute=this.querySelector(".ui.overlays"),this.chrome.absolute&&(this.chrome.absolute.style.left=r.left+"px",this.chrome.absolute.style.top=r.top+"px")):(this.chrome.wrapper.style.opacity="0",this.chrome.wrapper.style.left="-1000px",this.chrome.wrapper.style.top="-1000px"))},this.onWindowMessage=t=>{var r;switch((r=t.data)===null||r===void 0?void 0:r.type){case"feaasEdit":let n=this.getPlaceholder();this.setTarget(n.editable,t.data)&&(this.loader=n.loader,document.body.appendChild(n.clipper),this.editedUID=t.data.id,this.setPlaceholder(),this.open());break;case"feaasMeasurements":this.measurements=t.data.measurements,this.props.hidden||this.setPlaceholder();break}},this.onContentChange=()=>{this.setAttribute("changed","changed"),requestAnimationFrame(()=>{this.setIframeComponentContent()})},this.onClose=()=>{var t;this.setAttribute("hidden","hidden"),this.placeholder&&(this.placeholder.positionable.style.opacity="0",this.placeholder.positionable.style.pointerEvents="none"),this.chrome&&(this.chrome.wrapper.style.opacity="0"),!((t=this.target)===null||t===void 0)&&t.parentNode&&(this.target.outerHTML=this.target.outerHTML),this.setTarget(null,{component:null,version:null,instance:null,revision:null}),this.setEditorContext({isFocused:!1})},this.onVersionStateChange=(t,r)=>{this.versionContext=t,this.setVersionContext=r},this.onEditorStateChange=(t,r)=>{this.editorContext=t,this.setEditorContext=r,t.editor&&this.props.state=="loading"&&!this.props.hidden&&(this.setAttribute("state","ready"),this.ownerDocument.fonts.ready.then(()=>setTimeout(()=>{this.setReadyState(),this.setIframeComponentContent()},100)))}}getProps(){return rr(this)}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}showLoader(){this.loader||(this.loader=document.createElement("feaas-loader"),this.loader.setAttribute("opacity","0.6"),this.loader.style.zIndex="1000",this.target.appendChild(this.loader),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative"))}hideLoader(){this.loader&&(this.loader.setAttribute("hidden","hidden"),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative",this.target.style.position=""))}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.onWindowMessage)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.onWindowMessage)}setIframe(t){this.iframe=t}setIframeComponentContent(){this.placeholder&&this.iframe&&this.placeholder.editable.innerHTML&&this.iframe.contentWindow.postMessage({type:"feaasUpdate",id:this.editedUID,content:this.placeholder.editable.innerHTML})}setPlaceholder(){if(!this.iframe)return;let t=this.iframe.clientWidth,r=this.iframe.clientHeight,n=this.iframe.getBoundingClientRect(),i=this.getPlaceholder(),o=document.body.getBoundingClientRect(),s=this.measurements[this.editedUID];s&&(Object.assign(i.clipper.style,{position:"absolute",top:n.top+this.iframe.clientTop-o.top+"px",left:n.left+this.iframe.clientLeft-o.left+"px",width:t+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(i.positionable.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(i.loader.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",height:s.height+"px",filter:"opacity(0.6)",zIndex:3,pointerEvents:"none"}),document.dispatchEvent(new Event("feaasRefresh",{bubbles:!0})))}getPlaceholder(){return this.placeholder?this.placeholder:(this.placeholder={clipper:document.createElement("div"),positionable:document.createElement("div"),editable:Object.assign(document.createElement("div"),{className:"-feaas"}),loader:document.createElement("feaas-loader")},this.placeholder.clipper.appendChild(this.placeholder.positionable),this.placeholder.positionable.appendChild(this.placeholder.editable),this.placeholder.clipper.appendChild(this.placeholder.loader),this.placeholder)}attributeChangedCallback(t,r,n){r!==n&&(t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),n?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,n))}open(){clearTimeout(this.closing),this.removeAttribute("hidden"),this.removeAttribute("changed"),this.setLoadingState()}shouldFork(t){return t.forkOriginId==null&&this.props.instance!=null}cleanup(){var t;this.placeholder&&((t=this.placeholder.clipper)===null||t===void 0||t.remove(),this.placeholder=null)}close(){console.log("Editor is not ready")}unfork(){console.log("Editor is not ready")}discard(){console.log("Editor is not ready")}save(){console.log("Editor is not ready")}setVersionContext(t){console.log("Editor is not ready")}setEditorContext(t){console.log("Editor is not ready")}setLoadingState(){this.showLoader(),this.setAttribute("state","loading")}setReadyState(){this.hideLoader(),this.setEditorContext({activeVersionId:this.component.versions[0].id}),this.setAttribute("state","ready")}render({children:t,component:r,version:n,instance:i},{Editor:o,VersionStatusList:s,VersionStatusButton:a,Version:l,VersionMenu:u,EditorUIUndo:c,EditorUIMode:d,React:{useEffect:h,useMemo:p,useState:f,useContext:m},Chakra:{HStack:y,Box:C,Button:Q,MenuItem:j},Chrome:X,ReactDOM:Re,useSDK:k,useLibrary:I,useSlots:N,useModelObserver:se,ConfirmationContext:H,VersionContext:b}){if(!this.payload)return;let{React:g}=this.payload,U=k(),_e=I(),[w,x]=f(),{setConfirm:D}=m(H),P=i||n;w&&(this.component=w),h(()=>{if(this.props.hidden)return;let T=_e.components.getItem(r).clone();return T.versions.search({ids:[n,i].filter(Boolean),componentIds:[r]}).then(Ve=>{T.versions.setItems(Ve);let F=T.findVersion(i,["staged","published"]),le=T.findVersion(n,["staged","published"]);if(F)F.deletedAt?(F.getDraft().changeAndNotify(le.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",F.id));else if(this.removeAttribute("forked"),this.shouldFork(le)){console.error("FEAAS Editor: Forking");let Ye=le.fork(i).id;this.setAttribute("instance",Ye)}else console.error("FEAAS Editor: Regular");x(T)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),x(null)},400)}},[n,this.props.hidden]);let yt=se(w==null?void 0:w.versions,[]).filter(T=>T.id==P),ae=yt[0];ae&&!this.props.hidden&&(this.version=ae),h(()=>(this.unfork=()=>{D({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(n,["staged","published"]);w.findVersion(i).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(P).revert(),w.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{D({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=()=>{D({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(P).commitData({view:this.editorContext.editor.getData({rootName:P}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",P),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 xr=p(()=>this.target,[w]);return p(()=>w&&N(t,({picker:T,children:Ve})=>g.createElement(C,{ref:F=>{this.chrome=F?{positionable:F,wrapper:F.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},g.createElement(C,{className:"editor-wrapper",position:"absolute",left:0,top:0},g.createElement(o,{datasources:U.datasources,sdk:U,library:_e,component:w,versions:yt,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:Ve,chrome:({editor:F})=>F&&g.createElement(X,null),children:({isArchivedDisplayed:F,editor:le,status:Ye})=>g.createElement(C,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},g.createElement(C,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(C,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(C,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(C,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),ae&&g.createElement(l,{version:ae,node:xr,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:g.createElement(y,{justifyContent:"space-between"},g.createElement(c,{size:"sm",editor:Ye=="ready"?le:null}),g.createElement(d,{size:"sm"})),middle:(Sn,On)=>[!1],right:g.createElement(g.Fragment,null,g.createElement(Q,{variant:"secondary",size:"sm",onClick:this.close},"Close"),g.createElement(Q,{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(u,{isDisabled:!this.props.forked&&!this.props.changed},g.createElement(j,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),g.createElement(j,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[ae,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};Ae.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];Ae.register("feaas-editor");function nr(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 Ee=class extends A{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return nr(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:n,dialog:i,children:o,variant:s},{Picker:a,React:l,useContext:u,EnvironmentContext:c,useLibrary:d,useSDK:h,BYOC:p}){var f,m,y;let[C,Q]=l.useReducer(x=>x+1,0),j=h(),X=u(c),Re=d("collections"),k=d("components"),I=h("datasources"),N=d(),se=((m=(f=N.stylesheets)===null||f===void 0?void 0:f.first)===null||m===void 0?void 0:m.rules)||((y=N==null?void 0:N.stylesheet)===null||y===void 0?void 0:y.styles),H=k.find(x=>x.id==(r==null?void 0:r.getAttribute("component"))),b=h("externalComponents");var g=r==null?void 0:r.getAttribute("data");if(g)try{g=JSON.parse(g)}catch(x){}if(r)var U=j.ExternalComponent.getDefinition(r),_e=U&&!U.getConfiguration(r),w=(U==null?void 0:U.type)=="feaas"?k.find(x=>x.id==r.getAttribute("component")):p==null?void 0:p.getComponent(String(r.getAttribute("data-external-id")));return l.createElement(a,{cdn:X.cdn,rules:se,collections:Re,themeContext:r,placeholder:t,component:H,embed:w,externalComponents:b,datasources:I,data:g,versionId:r==null?void 0:r.getAttribute("version"),mode:n||(_e?"library":w?"context":null),setAttribute:(x,D,P)=>{D=="data"&&P&&(P=JSON.stringify(P)),this.props.setAttribute(x,D,P),Q()},getAttribute:(x,D)=>r==null?void 0:r.getAttribute(D),dialog:i,context:r,variant:s,onModeChange:(x,D)=>{this.set({mode:x,dialog:D})}},o)}};Ee.observedAttributes=["library","mode","frontend","src","hidden","variant","dialog"];Ee.register("feaas-picker");function ir(e){var t,r,n,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",environment:(r=e==null?void 0:e.getAttribute("environment"))!==null&&r!==void 0?r:void 0,frontend:(n=e==null?void 0:e.getAttribute("frontend"))!==null&&n!==void 0?n:"https://components.sitecorecloud.io",backend:(i=e==null?void 0:e.getAttribute("backend"))!==null&&i!==void 0?i:"https://components.sitecorecloud.io/api",cdn:(o=e==null?void 0:e.getAttribute("cdn"))!==null&&o!==void 0?o:"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 Z=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=R(t=>{this.sdk=t})}getProps(){return ir(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()}getPortalRoot(){return this.getRoot()}render({children:t,library:r},{AppContext:n,Chakra:{Button:i,Tooltip:o},React:s}){let a={containerRef:{current:this.getPortalRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.createElement(n,{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)}};Z.observedAttributes=["library","component","version","revision","hostname","template"];Z.register("feaas-context");Z.prototype.clientside=ut;import _ from"react";var or=(e={})=>Object.keys(e).reduce((t,r)=>Object.assign(t,{[We(r)]:e[r]}),{});function We(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return He(e).replace(t,function(r){return"-"+r.toLowerCase()})}function He(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,r)=>r===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function Zr(e,t={}){let r=e.properties||{};return{type:"object",...e,properties:Object.keys(r).reduce((n,i)=>Object.assign(n,{[i]:{...r[i],default:t.hasOwnProperty(i)?t[i]:r[i].default,title:r[i].title||We(i).split("-").map(o=>o.charAt(0).toUpperCase()+o.slice(1).toLowerCase()).join(" ")}}),{})}}var Qr=(e,t)=>{let r={...e};return Object.keys(t).filter(n=>/(integer|number)/.test(t[n].type)).forEach(n=>{var i;!((i=r[n])===null||i===void 0)&&i["ui:widget"]||(r[n]={...r[n],"ui:widget":"updown"})}),r};function ar(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function Xr(e,t){return Object.keys(t).reduce((r,n)=>{let i=t[n],o=He(n),s=e?.properties[o],a=s?.type,l=ar(i,a);return l!=null&&!n.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(n)?{...r,[o]:l}:r},{})}function en(e,t){return{...tn(e),...Xr(e,t)}}function tn(e){return Object.keys(e.properties).reduce((t,r)=>{var n,i;return((n=e.properties[r])===null||n===void 0?void 0:n.default)!=null?{...t,[r]:(i=e.properties[r])===null||i===void 0?void 0:i.default}:t},{})}function rn(e,t,r){let{thumbnail:n="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:i,id:o=e.name,group:s=null,ui:a,isHidden:l=!1,uiSchema:u,schema:c,...d}=e,h=c||d||{},p=u||a||{},f=Zr({description:"External component",...h,type:"object"},r),m=Qr(p,f.properties||{});return{component:t,name:i,schema:f,uiSchema:m,thumbnail:n,group:s,isHidden:l,id:o,title:f?.title||d?.title||i}}var sr,ie=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},nn=ie.BYOCWebComponent||(ie.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),xe=ie.BYOCComponentsFrozen?{}:ie.BYOCComponents||(ie.BYOCComponents={}),on=()=>{ie.BYOCComponentsFrozen=!0};function sn(e,t,r={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let n=rn(t,e,r);xe[n.id]=n,lr(e)&&cr.register("byoc-"+We(t.name),void 0,e),ur()}function lr(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function an(e,t={}){var r;let n=(r=dt(e))===null||r===void 0?void 0:r.schema;return n?en(n,t):t}function dt(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,r]=e.split("?");var n=xe[t];if(r){let i=xe[e];if(!i&&!n)return null;i&&(n={...n,...i,component:i.component||n?.component}),r.split(/\&/g).forEach(o=>{var s,a,l;let[u,c]=o.split("="),d=((s=n.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};n={...n,schema:{...n.schema,properties:{...n.schema.properties,[u]:{...d,default:ar(decodeURIComponent(c),d.type)}}},uiSchema:{...n.uiSchema,[u]:{...n.uiSchema[u],"ui:widget":(l=(a=n.uiSchema[u])===null||a===void 0?void 0:a["ui:widget"])!==null&&l!==void 0?l:"hidden"}}}})}return n}function ur(){clearTimeout(sr),sr=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(xe)}),"*"))},30)}ur();var cr=class extends nn{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(e=>{sn(null,e)})}catch{}}static register(e,t,r=this){t==null&&(t=typeof window<"u"?window:void 0),t&&!t.customElements.get(e)&&t.customElements.define(e,r)}};cr.register("byoc-registration");var ct=new Map,ht=null,pt=null;function ft(e){var t;let{componentName:r,...n}=e,i=(t=dt(r))===null||t===void 0?void 0:t.component;if(!ct.get(r)){let s=pt(()=>Promise.resolve(ht),{ssr:!1,loading:()=>_.createElement(Je,{...n,componentName:r})});ct.set(r,s)}let o=ct.get(r);return _.createElement(o,{...e,fallback:i?_.createElement(i,{...e}):null})}function dr(e,t){return pt=e,ht=t,t}function mt(e){if(Object.keys(e).length!=0)return pt?ft(e):Je(e)}function hr(){return on(),_.createElement(_.Fragment,null,_.createElement("byoc-registration",{components:JSON.stringify(Object.values(xe)),suppressHydrationWarning:!0}),_.createElement(ht,null))}function Je(e){let{componentName:t,fallback:r,...n}=e,i=dt(t),o=i?.component;if(!o&&r||!t)return _.createElement("feaas-external",{"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},r);let s=an(t,n);delete s.suppressHydrationWarning;var a=null;return o&&lr(o)?_.createElement("byoc-"+We(i.id),{...or(s),suppressHydrationWarning:!0}):_.createElement(_.Fragment,null,_.createElement("feaas-external",{...or(s),"data-external-id":t,suppressHydrationWarning:!0,hydrate:"false"},o==null?null:_.createElement(o,{...s})))}var fr=(e={})=>Object.keys(e).reduce((t,r)=>Object.assign(t,{[vt(r)]:e[r]}),{});function mr(e){let t=/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g;return vt(e).replace(t,function(r){return"-"+r.toLowerCase()})}function vt(e){return e=e.replace(/[-_ ]+/g," "),e=e.charAt(0).toLowerCase()+e.slice(1),e.split(/\s+/).map((t,r)=>r===0?t:t.charAt(0).toUpperCase()+t.slice(1)).join("")}function un(e,t={}){let r=e.properties||{};return{type:"object",...e,properties:Object.keys(r).reduce((n,i)=>Object.assign(n,{[i]:{...r[i],default:t.hasOwnProperty(i)?t[i]:r[i].default,title:r[i].title||mr(i).split("-").map(o=>o.charAt(0).toUpperCase()+o.slice(1).toLowerCase()).join(" ")}}),{})}}var cn=(e,t)=>{let r={...e};return Object.keys(t).filter(n=>/(integer|number)/.test(t[n].type)).forEach(n=>{var i;!((i=r[n])===null||i===void 0)&&i["ui:widget"]||(r[n]={...r[n],"ui:widget":"updown"})}),r};function vr(e,t){switch(t){case"string":return e;case"object":try{return typeof e=="object"&&e!=null?e:JSON.parse(e)}catch{return null}case"array":try{return Array.isArray(e)?e:JSON.parse(e)}catch{return null}case"number":return parseFloat(e);case"integer":return parseInt(e);case"boolean":return e=="true"||e=="1";default:return e}}function dn(e,t){return Object.keys(t).reduce((r,n)=>{let i=t[n],o=vt(n),s=e?.properties[o],a=s?.type,l=vr(i,a);return l!=null&&!n.startsWith("data-attribute")&&!["class","id","contenteditable"].includes(n)?{...r,[o]:l}:r},{})}function hn(e,t){return{...pn(e),...dn(e,t)}}function pn(e){return Object.keys(e.properties).reduce((t,r)=>{var n,i;return((n=e.properties[r])===null||n===void 0?void 0:n.default)!=null?{...t,[r]:(i=e.properties[r])===null||i===void 0?void 0:i.default}:t},{})}function fn(e,t,r){let{thumbnail:n="https://feaasstatic.blob.core.windows.net/assets/thumbnails/byoc.svg",name:i,id:o=e.name,group:s=null,ui:a,isHidden:l=!1,uiSchema:u,schema:c,...d}=e,h=c||d||{},p=u||a||{},f=un({description:"External component",...h,type:"object"},r),m=cn(p,f.properties||{});return{component:t,name:i,schema:f,uiSchema:m,thumbnail:n,group:s,isHidden:l,id:o,title:f?.title||d?.title||i}}var pr,Se=typeof global<"u"?global:typeof window<"u"?window:typeof self<"u"?self:{},mn=Se.BYOCWebComponent||(Se.BYOCWebComponent=typeof HTMLElement<"u"?HTMLElement:typeof windowJSDOM<"u"?windowJSDOM.HTMLElement:class{setAttribute(){}}),oe=Se.BYOCComponentsFrozen?{}:Se.BYOCComponents||(Se.BYOCComponents={});function gt(e,t,r={}){if(!t?.name)throw new Error("Could not register external component. Please make sure you provide a name in the options"+JSON.stringify(t));let n=fn(t,e,r);oe[n.id]=n,vn(e)&&yr.register("byoc-"+mr(t.name),void 0,e),ze()}function vn(e){return e&&"prototype"in e&&"setAttribute"in e.prototype}function gr(e,t={}){var r;let n=(r=Oe(e))===null||r===void 0?void 0:r.schema;return n?hn(n,t):t}function Oe(e){if(typeof e!="string"){if(e&&"schema"in e)return e;throw new Error(`Component name should be a string, got ${typeof e}`)}let[t,r]=e.split("?");var n=oe[t];if(r){let i=oe[e];if(!i&&!n)return null;i&&(n={...n,...i,component:i.component||n?.component}),r.split(/\&/g).forEach(o=>{var s,a,l;let[u,c]=o.split("="),d=((s=n.schema.properties)===null||s===void 0?void 0:s[u])||{type:"string"};n={...n,schema:{...n.schema,properties:{...n.schema.properties,[u]:{...d,default:vr(decodeURIComponent(c),d.type)}}},uiSchema:{...n.uiSchema,[u]:{...n.uiSchema[u],"ui:widget":(l=(a=n.uiSchema[u])===null||a===void 0?void 0:a["ui:widget"])!==null&&l!==void 0?l:"hidden"}}}})}return n}function ze(){clearTimeout(pr),pr=setTimeout(()=>{var e;typeof window<"u"&&window.parent!==window&&((e=window.parent)===null||e===void 0||e.postMessage(JSON.stringify({action:"register-components",data:Object.values(oe)}),"*"))},30)}ze();var yr=class extends mn{connectedCallback(){try{JSON.parse(String(this.getAttribute("components"))).forEach(e=>{gt(null,e)})}catch{}}static register(e,t,r=this){t==null&&(t=typeof window<"u"?window:void 0),t&&!t.customElements.get(e)&&t.customElements.define(e,r)}};yr.register("byoc-registration");import br from"react";import yn from"react-dom";var Cr=gr;function bn(e){let t=fr(Array.from(e.attributes).reduce((r,{name:n,value:i})=>Object.assign(r,{[n]:i}),{}));return Cr(t.dataExternalId,t)}var $=class extends A{load(){return Promise.resolve({React:br,ReactDOM:yn})}update(){var t;let{dataExternalId:r}=this.props;if(!(!(!((t=Oe(r))===null||t===void 0)&&t.component)&&this.getAttribute("hydrate")=="false"))return super.update()}render(t,{React:r}){var n;let{dataExternalId:i}=t;console.log(t);let o=(n=Oe(i))===null||n===void 0?void 0:n.component;return o||console.warn(`FEAASExternal: \`${i}\` is not registered`),r.createElement(r.Fragment,null,o&&r.createElement(o,{...t}))}getProps(){return bn(this)}static Preview(t){var r;let n=(t==null?void 0:t.src)||(typeof window!="undefined"?(r=window.location.search.match(/feaasSrc=([^&]+)/))===null||r===void 0?void 0:r[1]:null);return n?br.createElement(wr,{src:n,...t}):null}static linkComponents(t){return()=>t.map(r=>null)}};$.registered=oe;$.registerComponent=gt;$.setRegistrationCallback=ze;$.getComponent=Oe;$.register("feaas-external");var{getComponent:Cn,linkComponents:wn,registerComponent:An}=$;var En=e=>("src"in e&&(e=re(e.src)),B.createElement("link",{rel:"stylesheet",href:nt(e)})),xn=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 n=await it(e);r.template=n.template,r.lastModified=n.lastModified,r.hydrate=!1}return Ar({...r,data:t})};function Ar({data:e,...t}){let r=null,n;return"template"in t&&t.template&&(n=et(t.template,e||{}).map((i,o)=>Er(i,(s,a)=>{if(s.localName=="feaas-external"){let u={};for(var l in a){let c=l=="data-external-id"?"componentName":He(l);u[c]=a[l]}return[mt,u]}},o))),"src"in t&&(t={...G(t.src),...t}),B.createElement(B.Fragment,null,"preload"in t&&r===!0&&"src"in t&&B.createElement(B.Fragment,null,B.createElement("link",{rel:"preload",as:"fetch",href:be(t.src),crossOrigin:"anonymous"}),B.createElement("link",{rel:"preload",as:"style",href:W(t.src),crossOrigin:"anonymous"})),B.createElement("feaas-component",{class:"-feaas",...t,suppressHydrationWarning:!0,template:null,data:typeof e=="string"?e:e?JSON.stringify(e):null,hydrate:"false"},n))}function Er(e,t,r){if(e.nodeType===3)return e.textContent;let n=Array.from(e.childNodes).map((l,u)=>Er(l,t,u)),i={};for(let l=0;l<e.attributes.length;l++){let{name:u,value:c}=e.attributes[l];u=="style"?i[u]=String(c||"").trim().split(/\s*;\s*/).reduce((d,h)=>{let[p,f]=h.split(":");return{...d,[p]:f}},{}):u=="class"?i.className=c:i[u]=c}let o=t==null?void 0:t(e,i),s=(o==null?void 0:o[0])||e.nodeName.toLowerCase(),a=Object.assign({key:r,suppressHydrationWarning:!0},(o==null?void 0:o[1])||i);return B.createElement(s,a,["img","br","input"].includes(s)?null:n)}var lo=dr,uo=hr,co=mt,ho=Je,po=ft,wr=Ar,fo=xn,mo=En;export{wr as Component,Yt as ComponentProps,Z as Context,R as ControlledPromise,L as DEFAULT_CDN_URL,De as DOM,Fe as DataPath,ke as DataScope,E as DataSettings,A as Element,$ as External,co as ExternalComponent,uo as ExternalComponentBundle,Ce as FEAASComponent,Yt as FEAASComponentsProps,Z as FEAASContext,ir as FEAASContextProps,Ae as FEAASEditor,rr as FEAASEditorProps,A as FEAASElement,Cr as FEAASExternalPropsObject,we as FEAASLoader,Kt as FEAASLoaderProps,Ee as FEAASPicker,nr as FEAASPickerProps,Ar as FEAASReactComponent,xn as FEAASReactServerComponent,En as FEAASReactStylesheet,Ie as FEAASStylesheet,qt as FEAASStylesheetProps,Er as HTMLNodeToReact,Le as InvalidResponse,v as JSONPath,we as Loader,Me as MyComponent,po as NextExternalComponent,Ee as Picker,ho as ReactExternalComponent,fo as ServerComponent,mo as Stylesheet,Ue as Thumbnail,It as WebComponent,kt as adjustNumbers,St as autoloadScripts,me as cleanCollectionBit,zr as clearFetchCache,zt as createStylesheet,lo as enableNextClientsideComponents,ge as fetchAndRevalidate,ne as fetchAndRevalidateComponent,$e as fetchAndRevalidateStylesheet,je as fetchBypassingCache,ve as fetchCache,it as fetchComponent,rt as fetchData,ye as fetchToValidateCache,q as fetchWithCacheAwareness,Jt as findStylesheet,Cn as getComponent,Vr as getComponentSource,be as getComponentURL,Wt as getFetchCache,tr as getFramePosition,Nt as getHumanizedLabel,Ft as getLastPathBit,_t as getQualifier,nt as getStylesheetSource,W as getStylesheetURL,wn as linkComponents,fe as loadScript,Be as loadStylesheet,ot as loadStylesheetAllowStale,Ne as normalizeCollectionScope,xt as observeDOMElement,G as parseComponentSource,Ot as parseLimit,Rt as parseRange,re as parseStylesheetSource,ee as queryObject,Qe as queryObjectRaw,pe as queryScopes,An as registerComponent,st as renderComponent,Kr as renderComponentElement,Vt as renderComponentPromise,Y as renderDOMContent,O as renderDOMElement,Hr as renderHTMLContent,Yr as renderStylesheet,Ht as renderStylesheetPromise,z as serializeCH1RichText,V as setDOMAttribute};
73
+ `,s.contentWindow.document.head.appendChild(d),s.contentWindow.document.head.appendChild(h);let u=Xt({template:r,data:n});u.classList.add(...t,"-feaas--preview","-emulate--"+e.details.slug),s.contentWindow.document.body.appendChild(u)})}async function je(t,e,r){let n=e?e.getThumbnailURL():t.getThumbnailURL(),i=new Date(Math.max(Number(t.modifiedAt),Number(t.library.stylesheet.modifiedAt)));try{await t.sdk.uploadBlob("thumbnails",n.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":e?e.id:null,"x-ms-meta-versionRevision":e?e.revision.toString():null,"x-ms-meta-componentId":t.id,"x-ms-meta-componentRenderedAt":i.toUTCString(),"x-ms-meta-componentModifiedAt":t.modifiedAt.toUTCString(),"x-ms-meta-componentCreatedAt":t.createdAt.toUTCString(),"x-ms-meta-modifiedAt":t.modifiedAt.toUTCString()}}),fetch(n,{cache:"no-cache"}).then(()=>{t.sdk.log("FEAAS: Thumbnail uploaded",n)})}catch(o){t.sdk.log("FEAAS: Thumbnail failed to upload",n,o)}return n}var te;typeof window!="undefined"&&(window.FEAASReactElement=rt,(te=window.FEAASLoading)!==null&&te!==void 0||(window.FEAASLoading=Promise.resolve()));function Ie(t){let e=[];if(t){let r=t.ownerDocument.defaultView,n,i;for(;r!==window.top;){n=r.parent;for(let o=0;o<n.frames.length;o++)if(n.frames[o]===r){for(let s of n.document.getElementsByTagName("iframe"))if(s.contentWindow===r){i=s.getBoundingClientRect();let a=s.contentWindow.getComputedStyle(s);e.push({left:i.left+parseInt(a.borderLeftWidth),top:i.top+parseInt(a.borderTopWidth)})}r=n;break}}}return e.reduce((r,n)=>({left:r.left+n.left,top:r.top+n.top}),{left:0,top:0})}function Be(t){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 Et=class extends C{constructor(){super(...arguments),this.framePoint={top:0,left:0},this.wrapperRect={top:0,left:0,width:0,height:0},this.bodyRect={top:0,left:0,width:0,height:0},this.defaultProps={hidden:!1},this.setTarget=(e,r={component:e.getAttribute("component"),version:e.getAttribute("version"),revision:e.getAttribute("revision"),instance:e.getAttribute("instance")})=>{if(!this.closing&&(!this.target||e==null))return this.set(r),this.target=e,!0},this.onChromeMeasureElement=(e,r=e.getBoundingClientRect())=>e.ownerDocument==document?{left:r.left-this.bodyRect.left,top:r.top-this.bodyRect.top,width:r.width,height:r.height}:{left:r.left+this.framePoint.left-this.bodyRect.left,top:r.top+this.framePoint.top-this.bodyRect.top,width:r.width,height:r.height},this.onBeforeMeasure=e=>{e.memoized.focusable&&(this.framePoint=Ie(e.memoized.focusable)),this.chrome&&(this.wrapperRect=this.chrome.positionable.getBoundingClientRect(),this.bodyRect=this.chrome.positionable.ownerDocument.body.parentElement.getBoundingClientRect())},this.onMeasure=()=>{},this.onPosition=({focusable:e,root:r})=>{!this.chrome||this.props.hidden||(e?(this.chrome.wrapper.style.width=e.width+16*2+"px",this.chrome.wrapper.style.height=e.height+16*1+64+"px",this.chrome.wrapper.style.left=e.left-16+"px",this.chrome.wrapper.style.top=e.top-64+"px",this.chrome.wrapper.style.opacity="1",this.chrome.absolute=this.querySelector(".ui.overlays"),this.chrome.absolute&&(this.chrome.absolute.style.left=r.left+"px",this.chrome.absolute.style.top=r.top+"px")):(this.chrome.wrapper.style.opacity="0",this.chrome.wrapper.style.left="-1000px",this.chrome.wrapper.style.top="-1000px"))},this.onWindowMessage=e=>{var r;switch((r=e.data)===null||r===void 0?void 0:r.type){case"feaasEdit":let n=this.getPlaceholder();this.setTarget(n.editable,e.data)&&(this.loader=n.loader,document.body.appendChild(n.clipper),this.editedUID=e.data.id,this.setPlaceholder(),this.open());break;case"feaasMeasurements":this.measurements=e.data.measurements,this.props.hidden||this.setPlaceholder();break}},this.onContentChange=()=>{this.setAttribute("changed","changed"),requestAnimationFrame(()=>{this.setIframeComponentContent()})},this.onClose=()=>{var e;this.setAttribute("hidden","hidden"),this.placeholder&&(this.placeholder.positionable.style.opacity="0",this.placeholder.positionable.style.pointerEvents="none"),this.chrome&&(this.chrome.wrapper.style.opacity="0"),!((e=this.target)===null||e===void 0)&&e.parentNode&&(this.target.outerHTML=this.target.outerHTML),this.setTarget(null,{component:null,version:null,instance:null,revision:null}),this.setEditorContext({isFocused:!1})},this.onVersionStateChange=(e,r)=>{this.versionContext=e,this.setVersionContext=r},this.onEditorStateChange=(e,r)=>{this.editorContext=e,this.setEditorContext=r,e.editor&&this.props.state=="loading"&&!this.props.hidden&&(this.setAttribute("state","ready"),this.ownerDocument.fonts.ready.then(()=>setTimeout(()=>{this.setReadyState(),this.setIframeComponentContent()},100)))}}getProps(){return Be(this)}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}showLoader(){this.loader||(this.loader=document.createElement("feaas-loader"),this.loader.setAttribute("opacity","0.6"),this.loader.style.zIndex="1000",this.target.appendChild(this.loader),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative"))}hideLoader(){this.loader&&(this.loader.setAttribute("hidden","hidden"),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative",this.target.style.position=""))}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.onWindowMessage)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.onWindowMessage)}setIframe(e){this.iframe=e}setIframeComponentContent(){this.placeholder&&this.iframe&&this.placeholder.editable.innerHTML&&this.iframe.contentWindow.postMessage({type:"feaasUpdate",id:this.editedUID,content:this.placeholder.editable.innerHTML})}setPlaceholder(){if(!this.iframe)return;let e=this.iframe.clientWidth,r=this.iframe.clientHeight,n=this.iframe.getBoundingClientRect(),i=this.getPlaceholder(),o=document.body.getBoundingClientRect(),s=this.measurements[this.editedUID];s&&(Object.assign(i.clipper.style,{position:"absolute",top:n.top+this.iframe.clientTop-o.top+"px",left:n.left+this.iframe.clientLeft-o.left+"px",width:e+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(i.positionable.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(i.loader.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",height:s.height+"px",filter:"opacity(0.6)",zIndex:3,pointerEvents:"none"}),document.dispatchEvent(new Event("feaasRefresh",{bubbles:!0})))}getPlaceholder(){return this.placeholder?this.placeholder:(this.placeholder={clipper:document.createElement("div"),positionable:document.createElement("div"),editable:Object.assign(document.createElement("div"),{className:"-feaas"}),loader:document.createElement("feaas-loader")},this.placeholder.clipper.appendChild(this.placeholder.positionable),this.placeholder.positionable.appendChild(this.placeholder.editable),this.placeholder.clipper.appendChild(this.placeholder.loader),this.placeholder)}attributeChangedCallback(e,r,n){r!==n&&(e=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),n?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(e,r,n))}open(){clearTimeout(this.closing),this.removeAttribute("hidden"),this.removeAttribute("changed"),this.setLoadingState()}shouldFork(e){return e.forkOriginId==null&&this.props.instance!=null}cleanup(){var e;this.placeholder&&((e=this.placeholder.clipper)===null||e===void 0||e.remove(),this.placeholder=null)}close(){console.log("Editor is not ready")}unfork(){console.log("Editor is not ready")}discard(){console.log("Editor is not ready")}save(){console.log("Editor is not ready")}setVersionContext(e){console.log("Editor is not ready")}setEditorContext(e){console.log("Editor is not ready")}setLoadingState(){this.showLoader(),this.setAttribute("state","loading")}setReadyState(){this.hideLoader(),this.setEditorContext({activeVersionId:this.component.versions[0].id}),this.setAttribute("state","ready")}render({children:e,component:r,version:n,instance:i},{Editor:o,VersionStatusList:s,VersionStatusButton:a,Version:l,VersionMenu:c,EditorUIUndo:d,EditorUIMode:h,React:{useEffect:u,useMemo:p,useState:v,useContext:m},Chakra:{HStack:y,Box:A,Button:Z,MenuItem:j},Chrome:tt,ReactDOM:wt,useSDK:D,useLibrary:U,useSlots:N,useModelObserver:ot,ConfirmationContext:z,VersionContext:b}){if(!this.payload)return;let{React:g}=this.payload,W=D(),xt=U(),[E,x]=v(),{setConfirm:P}=m(z),T=i||n;E&&(this.component=E),u(()=>{if(this.props.hidden)return;let M=xt.components.getItem(r).clone();return M.versions.search({ids:[n,i].filter(Boolean),componentIds:[r]}).then(jt=>{M.versions.setItems(jt);let k=M.findVersion(i,["staged","published"]),at=M.findVersion(n,["staged","published"]);if(k)k.deletedAt?(k.getDraft().changeAndNotify(at.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",k.id));else if(this.removeAttribute("forked"),this.shouldFork(at)){console.error("FEAAS Editor: Forking");let It=at.fork(i).id;this.setAttribute("instance",It)}else console.error("FEAAS Editor: Regular");x(M)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),x(null)},400)}},[n,this.props.hidden]);let re=ot(E==null?void 0:E.versions,[]).filter(M=>M.id==T),st=re[0];st&&!this.props.hidden&&(this.version=st),u(()=>(this.unfork=()=>{P({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let M=E.findVersion(n,["staged","published"]);E.findVersion(i).unstage().unpublish().changeAndNotify(M.toProperties()),E.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(E.findVersion(T).revert(),E.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{P({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=()=>{P({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:()=>{E.findVersion(T).commitData({view:this.editorContext.editor.getData({rootName:T}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",T),E.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[E]);let qe=p(()=>this.target,[E]);return p(()=>E&&N(e,({picker:M,children:jt})=>g.createElement(A,{ref:k=>{this.chrome=k?{positionable:k,wrapper:k.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},g.createElement(A,{className:"editor-wrapper",position:"absolute",left:0,top:0},g.createElement(o,{datasources:W.datasources,sdk:W,library:xt,component:E,versions:re,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:jt,chrome:({editor:k})=>k&&g.createElement(tt,null),children:({isArchivedDisplayed:k,editor:at,status:It})=>g.createElement(A,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},g.createElement(A,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(A,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(A,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),g.createElement(A,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),st&&g.createElement(l,{version:st,node:qe,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:g.createElement(y,{justifyContent:"space-between"},g.createElement(d,{size:"sm",editor:It=="ready"?at:null}),g.createElement(h,{size:"sm"})),middle:(Fr,Or)=>[!1],right:g.createElement(g.Fragment,null,g.createElement(Z,{variant:"secondary",size:"sm",onClick:this.close},"Close"),g.createElement(Z,{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(c,{isDisabled:!this.props.forked&&!this.props.changed},g.createElement(j,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),g.createElement(j,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[st,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};Et.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];Et.register("feaas-editor");function Ue(t){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"),dialog:t==null?void 0:t.getAttribute("dialog"),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,setAttribute:void 0,getAttribute:void 0}}var Ct=class extends C{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return Ue(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){this.setAttribute("feaas-role","ui"),super.connectedCallback()}render({placeholder:e,context:r,mode:n,dialog:i,children:o,variant:s},{Picker:a,React:l,useContext:c,EnvironmentContext:d,useLibrary:h,useSDK:u,BYOC:p}){var v,m,y;let[A,Z]=l.useReducer(x=>x+1,0),j=u(),tt=c(d),wt=h("collections"),D=h("components"),U=u("datasources"),N=h(),ot=((m=(v=N.stylesheets)===null||v===void 0?void 0:v.first)===null||m===void 0?void 0:m.rules)||((y=N==null?void 0:N.stylesheet)===null||y===void 0?void 0:y.styles),z=D.find(x=>x.id==(r==null?void 0:r.getAttribute("component"))),b=u("externalComponents");var g=r==null?void 0:r.getAttribute("data");if(g)try{g=JSON.parse(g)}catch(x){}if(r)var W=j.ExternalComponent.getDefinition(r),xt=W&&!W.getConfiguration(r),E=(W==null?void 0:W.type)=="feaas"?D.find(x=>x.id==r.getAttribute("component")):p==null?void 0:p.getComponent(String(r.getAttribute("data-external-id")));return l.createElement(a,{cdn:tt.cdn,rules:ot,collections:wt,themeContext:r,placeholder:e,component:z,embed:E,externalComponents:b,datasources:U,data:g,versionId:r==null?void 0:r.getAttribute("version"),mode:n||(xt?"library":E?"context":null),setAttribute:(x,P,T)=>{P=="data"&&T&&(T=JSON.stringify(T)),this.props.setAttribute(x,P,T),Z()},getAttribute:(x,P)=>r==null?void 0:r.getAttribute(P),dialog:i,context:r,variant:s,onModeChange:(x,P)=>{this.set({mode:x,dialog:P})}},o)}};Ct.observedAttributes=["library","mode","frontend","src","hidden","variant","dialog"];Ct.register("feaas-picker");function We(t){var e,r,n,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",environment:(r=t==null?void 0:t.getAttribute("environment"))!==null&&r!==void 0?r:void 0,frontend:(n=t==null?void 0:t.getAttribute("frontend"))!==null&&n!==void 0?n:"https://components.sitecorecloud.io",backend:(i=t==null?void 0:t.getAttribute("backend"))!==null&&i!==void 0?i:"https://components.sitecorecloud.io/api",cdn:(o=t==null?void 0:t.getAttribute("cdn"))!==null&&o!==void 0?o:"https://feaas.blob.core.windows.net",auth:null,isolate:(t==null?void 0:t.getAttribute("isolate"))==null||(t==null?void 0:t.getAttribute("isolate"))=="true"}}var X=class extends C{constructor(){super(...arguments),this.defaultProps={isolate:!0},this.onStatusChange=(e,r)=>{e=="ready"&&(this.whenSDKReady.resolve(r),this.dispatchEvent(new CustomEvent("feaasReady",{bubbles:!0,composed:!0,detail:r})))},this.whenSDKReady=F(e=>{this.sdk=e})}getProps(){return We(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(e){return e}getRoot(){return this.getAttribute("isolate")==="false"?this:this.shadowRoot||this.attachShadow({mode:"open"})}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}connectedCallback(){this.setAttribute("feaas-role","ui"),Array.from(this.children).forEach(e=>{this.getRoot().appendChild(e)}),document.addEventListener("feaasMount",this),document.addEventListener("feaasUnmount",this),super.connectedCallback()}disconnectedCallback(){document.removeEventListener("feaasMount",this),document.removeEventListener("feaasUnmount",this),super.disconnectedCallback()}getPortalRoot(){return this.getRoot()}render({children:e,library:r},{AppContext:n,Chakra:{Button:i,Tooltip:o},React:s}){let a={containerRef:{current:this.getPortalRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.createElement(n,{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}}},e)}};X.observedAttributes=["library","component","version","revision","hostname","template"];X.register("feaas-context");X.prototype.clientside=ee;import*as R from"@sitecore/byoc";import He from"react";import Er from"react-dom";var ze=R.getComponentProperties;function Cr(t){let e=R.objectKeysToCamelCase(Array.from(t.attributes).reduce((r,{name:n,value:i})=>Object.assign(r,{[n]:i}),{}));return ze(e.dataExternalId,e)}var I=class extends C{load(){return Promise.resolve({React:He,ReactDOM:Er})}update(){var e;let{dataExternalId:r}=this.props;if(!(!(!((e=R.getComponent(r))===null||e===void 0)&&e.component)&&this.getAttribute("hydrate")=="false"))return super.update()}render(e,{React:r}){var n;let{dataExternalId:i}=e;console.log(e);let o=(n=R.getComponent(i))===null||n===void 0?void 0:n.component;return o||console.warn(`FEAASExternal: \`${i}\` is not registered`),r.createElement(r.Fragment,null,o&&r.createElement(o,{...e}))}getProps(){return Cr(this)}static Preview(e){var r;let n=(e==null?void 0:e.src)||(typeof window!="undefined"?(r=window.location.search.match(/feaasSrc=([^&]+)/))===null||r===void 0?void 0:r[1]:null);return n?He.createElement(Ve,{src:n,...e}):null}static linkComponents(e){return()=>e.map(r=>null)}};I.registered=R.registered;I.registerComponent=R.registerComponent;I.setRegistrationCallback=R.setRegistrationCallback;I.getComponent=R.getComponent;I.register("feaas-external");var{getComponent:wr,linkComponents:xr,registerComponent:Sr}=I;var Rr=t=>("src"in t&&(t=nt(t.src)),B.createElement("link",{rel:"stylesheet",href:Gt(t)})),_r=async({...t})=>{let e=await w.fetch((t==null?void 0:t.data)||{}),r={...t};if(("src"in t||"component"in t)&&(t==null?void 0:t.template)==null){let n=await Kt(t);r.template=n.template,r.lastModified=n.lastModified,r.hydrate=!1}return Je({...r,data:e})};function Je({data:t,...e}){let r=null,n;return"template"in e&&e.template&&(n=Jt(e.template,t||{}).map((i,o)=>Ye(i,(s,a)=>{if(s.localName=="feaas-external"){let c={};for(var l in a){let d=l=="data-external-id"?"componentName":O.toCamelCase(l);c[d]=a[l]}return[O.Component,c]}},o))),"src"in e&&(e={...Q(e.src),...e}),B.createElement(B.Fragment,null,"preload"in e&&r===!0&&"src"in e&&B.createElement(B.Fragment,null,B.createElement("link",{rel:"preload",as:"fetch",href:yt(e.src),crossOrigin:"anonymous"}),B.createElement("link",{rel:"preload",as:"style",href:H(e.src),crossOrigin:"anonymous"})),B.createElement("feaas-component",{class:"-feaas",...e,hydrate:e.hydrate===!1?"false":null,suppressHydrationWarning:!0,template:null,data:typeof t=="string"?t:t?JSON.stringify(t):null},n))}function Ye(t,e,r){if(t.nodeType===3)return t.textContent;let n=Array.from(t.childNodes).map((l,c)=>Ye(l,e,c)),i={};for(let l=0;l<t.attributes.length;l++){let{name:c,value:d}=t.attributes[l];c=="style"?i[c]=String(d||"").trim().split(/\s*;\s*/).reduce((h,u)=>{let[p,v]=u.split(":");return{...h,[p]:v}},{}):c=="class"?i.className=d:i[c]=d}let o=e==null?void 0:e(t,i),s=(o==null?void 0:o[0])||t.nodeName.toLowerCase(),a=Object.assign({key:r,suppressHydrationWarning:!0},(o==null?void 0:o[1])||i);return B.createElement(s,a,["img","br","input"].includes(s)?null:n)}var ai=O.enableNextClientsideComponents,li=O.Bundle,di=O.Component,ci=O.RegularComponent,ui=O.NextComponent,Ve=Je,hi=_r,pi=Rr;export{Ve as Component,Ne as ComponentProps,X as Context,F as ControlledPromise,$ as DEFAULT_CDN_URL,Ft as DOM,_t as DataPath,St as DataScope,w as DataSettings,C as Element,I as External,di as ExternalComponent,li as ExternalComponentBundle,bt as FEAASComponent,Ne as FEAASComponentsProps,X as FEAASContext,We as FEAASContextProps,Et as FEAASEditor,Be as FEAASEditorProps,C as FEAASElement,ze as FEAASExternalPropsObject,At as FEAASLoader,ke as FEAASLoaderProps,Ct as FEAASPicker,Ue as FEAASPickerProps,Je as FEAASReactComponent,_r as FEAASReactServerComponent,Rr as FEAASReactStylesheet,Lt as FEAASStylesheet,Pe as FEAASStylesheetProps,Ye as HTMLNodeToReact,kt as InvalidResponse,f as JSONPath,At as Loader,Nt as MyComponent,ui as NextExternalComponent,Ct as Picker,ci as ReactExternalComponent,hi as ServerComponent,pi as Stylesheet,$t as Thumbnail,xe as WebComponent,pe as adjustNumbers,de as autoloadScripts,ft as cleanCollectionBit,mr as clearFetchCache,Oe as createStylesheet,ai as enableNextClientsideComponents,vt as fetchAndRevalidate,it as fetchAndRevalidateComponent,Tt as fetchAndRevalidateStylesheet,Pt as fetchBypassingCache,mt as fetchCache,Kt as fetchComponent,qt as fetchData,gt as fetchToValidateCache,K as fetchWithCacheAwareness,Fe as findStylesheet,wr as getComponent,vr as getComponentSource,yt as getComponentURL,Re as getFetchCache,Ie as getFramePosition,fe as getHumanizedLabel,me as getLastPathBit,he as getQualifier,Gt as getStylesheetSource,H as getStylesheetURL,xr as linkComponents,pt as loadScript,Mt as loadStylesheet,Qt as loadStylesheetAllowStale,Rt as normalizeCollectionScope,le as observeDOMElement,Q as parseComponentSource,ce as parseLimit,ue as parseRange,nt as parseStylesheetSource,et as queryObject,zt as queryObjectRaw,ht as queryScopes,Sr as registerComponent,Xt as renderComponent,yr as renderComponentElement,De as renderComponentPromise,q as renderDOMContent,_ as renderDOMElement,pr as renderHTMLContent,gr as renderStylesheet,_e as renderStylesheetPromise,J as serializeCH1RichText,Y as setDOMAttribute};
74
74
  //# sourceMappingURL=react.esm.js.map