@sitecore-feaas/clientside 0.1.17 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cloud.js +10 -2
- package/build/cloud.js.map +1 -1
- package/build/dom.js +73 -15
- package/build/dom.js.map +1 -1
- package/dist/browser/basic.esm.js +5 -4
- package/dist/browser/basic.esm.js.map +1 -1
- package/dist/browser/basic.js +5 -4
- package/dist/browser/basic.js.map +1 -1
- package/dist/browser/index.esm.js +6 -5
- package/dist/browser/index.esm.js.map +1 -1
- package/dist/browser/index.js +6 -5
- package/dist/browser/index.js.map +1 -1
- package/dist/node/basic.esm.js +3 -2
- package/dist/node/basic.esm.js.map +1 -1
- package/dist/node/basic.js +3 -2
- package/dist/node/basic.js.map +1 -1
- package/dist/node/index.esm.js +5 -4
- package/dist/node/index.esm.js.map +1 -1
- package/dist/node/index.js +5 -4
- package/dist/node/index.js.map +1 -1
- package/package.json +2 -2
- package/src/cloud.ts +10 -2
- package/src/components/FEAASStylesheet.ts +1 -1
- package/src/dom.ts +88 -14
- package/test/extras.ts +714 -0
- package/test/render.ts +44 -10
- package/test/tsconfig.json +5 -0
- package/types/cloud.d.ts.map +1 -1
- package/types/components/FEAASStylesheet.d.ts +3 -3
- package/types/components/FEAASStylesheet.d.ts.map +1 -1
- package/types/dom.d.ts +10 -0
- package/types/dom.d.ts.map +1 -1
- package/types/tsbuildinfo +1 -1
- package/types/tsbuildinfo_ui +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
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 u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}var b=Object.prototype.hasOwnProperty;function x(t,e){return t=t.slice(),t.push(e),t}function rt(t,e){return e=e.slice(),e.unshift(t),e}var Wt=function(t){Tt(r,t);var e=Lt(r);function r(n){var i;return st(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 at(r)}(tt(Error));function f(t,e,r,n,i){if(!(this instanceof f))try{return new f(t,e,r,n,i)}catch(u){if(!u.avoidNew)throw u;return u.value}typeof t=="string"&&(i=n,n=r,r=e,e=t,t=null);var o=t&&E(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=b.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||E(a)!=="object")throw new Wt(a);return a}}f.prototype.evaluate=function(t,e,r,n){var i=this,o=this.parent,s=this.parentProperty,a=this.flatten,u=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&&E(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(!b.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var d=t;e=d.json,a=b.call(t,"flatten")?t.flatten:a,this.currResultType=b.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=b.call(t,"sandbox")?t.sandbox:this.currSandbox,u=b.call(t,"wrap")?t.wrap:u,this.currPreventEval=b.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=b.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=b.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,o=b.call(t,"parent")?t.parent:o,s=b.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 c=f.toPathArray(t);c[0]==="$"&&c.length>1&&c.shift(),this._hasParentSelector=null;var l=this._trace(c,e,["$"],o,s,r).filter(function(h){return h&&!h.isParentSelector});return l.length?!u&&l.length===1&&!l[0].hasArrExpr?this._getPreferredOutput(l[0]):l.reduce(function(h,p){var R=i._getPreferredOutput(p);return a&&Array.isArray(R)?h=h.concat(R):h.push(R),h},[]):u?[]: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 u=this,d;if(!t.length)return d={path:r,value:e,parent:n,parentProperty:i,hasArrExpr:s},this._handleCallback(d,o,"value"),d;var c=t[0],l=t.slice(1),h=[];function p(y){Array.isArray(y)?y.forEach(function(k){h.push(k)}):h.push(y)}if((typeof c!="string"||a)&&e&&b.call(e,c))p(this._trace(l,e[c],x(r,c),e,c,o,s));else if(c==="*")this._walk(e,function(y){p(u._trace(l,e[y],x(r,y),e,y,o,!0,!0))});else if(c==="..")p(this._trace(l,e,r,n,i,o,s)),this._walk(e,function(y){E(e[y])==="object"&&p(u._trace(t.slice(),e[y],x(r,y),e,y,o,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:l,isParentSelector:!0};if(c==="~")return d={path:x(r,c),value:i,parent:n,parentProperty:null},this._handleCallback(d,o,"property"),d;if(c==="$")p(this._trace(l,e,r,null,null,o,s));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(c))p(this._slice(c,l,e,r,n,i,o));else if(c.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var R=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(e,function(y){u._eval(R,e[y],y,r,n,i)&&p(u._trace(l,e[y],x(r,y),e,y,o,!0))})}else if(c[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");p(this._trace(rt(this._eval(c,e,r[r.length-1],r.slice(0,-1),n,i),l),e,r,n,i,o,s))}else if(c[0]==="@"){var g=!1,C=c.slice(1,-2);switch(C){case"scalar":(!e||!["object","function"].includes(E(e)))&&(g=!0);break;case"boolean":case"string":case"undefined":case"function":E(e)===C&&(g=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(g=!0);break;case"number":Number.isFinite(e)&&(g=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(g=!0);break;case"object":e&&E(e)===C&&(g=!0);break;case"array":Array.isArray(e)&&(g=!0);break;case"other":g=this.currOtherTypeCallback(e,r,n,i);break;case"null":e===null&&(g=!0);break;default:throw new TypeError("Unknown value type "+C)}if(g)return d={path:r,value:e,parent:n,parentProperty:i},this._handleCallback(d,o,"value"),d}else if(c[0]==="`"&&e&&b.call(e,c.slice(1))){var O=c.slice(1);p(this._trace(l,e[O],x(r,O),e,O,o,s,!0))}else if(c.includes(",")){var Q=c.split(","),_=Ht(Q),m;try{for(_.s();!(m=_.n()).done;){var X=m.value;p(this._trace(rt(X,l),e,r,n,i,o,!0))}}catch(y){_.e(y)}finally{_.f()}}else!a&&e&&b.call(e,c)&&p(this._trace(l,e[c],x(r,c),e,c,o,s,!0))}if(this._hasParentSelector)for(var A=0;A<h.length;A++){var P=h[A];if(P&&P.isParentSelector){var w=this._trace(P.expr,e,P.path,n,i,o,s);if(Array.isArray(w)){h[A]=w[0];for(var H=w.length,F=1;F<H;F++)A++,h.splice(A,0,w[F])}else h[A]=w}}return h};f.prototype._walk=function(t,e){if(Array.isArray(t))for(var r=t.length,n=0;n<r;n++)e(n);else t&&E(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,u=t.split(":"),d=u[2]&&Number.parseInt(u[2])||1,c=u[0]&&Number.parseInt(u[0])||0,l=u[1]&&Number.parseInt(u[1])||a;c=c<0?Math.max(0,c+a):Math.min(a,c),l=l<0?Math.max(0,l+a):Math.min(a,l);for(var h=[],p=c;p<l;p+=d){var R=this._trace(rt(p,e),r,n,i,o,s,!0);R.forEach(function(g){h.push(g)})}return h}};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 u=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&&(u=u.replace(/@path/g,"_$_path")),f.cache[a]=new this.vm.Script(u)}try{return f.cache[a].runInNewContext(this.currSandbox)}catch(d){throw new Error("jsonPath: "+d.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 qt=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])}},zt=function(){function t(e){st(this,t),this.code=e}return at(t,[{key:"runInNewContext",value:function(r){var n=this.code,i=Object.keys(r),o=[];qt(i,o,function(c){return typeof r[c]=="function"});var s=i.map(function(c,l){return r[c]}),a=o.reduce(function(c,l){var h=r[l].toString();return/function/.test(h)||(h="function "+h),"var "+l+"="+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 u=n.lastIndexOf(";"),d=u>-1?n.slice(0,u+1)+" return "+n.slice(u+1):" return "+n;return M(Function,i.concat([d])).apply(void 0,jt(s))}}]),t}();f.prototype.vm={Script:zt};async function q(t,e,r,n){let i=new Date,o=await fetch(t,e);if(!o.ok)throw new Error("Fetch failed");let s=new Date(o.headers.get("date"));var a=o;if(n(o,"cached"),s<i){let u=await fetch(t+"?"+Math.random(),{...e,method:"HEAD",cache:"no-cache"});if(u.headers.get("last-modified")!=o.headers.get("last-modified")){if(r(u)===!1)throw new Error("Response is stale");a=await fetch(t,{...e,cache:"reload"})}}if(r(a)===!1)throw new Error("Response is not valid");return o!==a&&n(a,"valid"),a}function Jt({cdn:t="https://feaascomponentsapidev.blob.core.windows.net",hostname:e,library:r,component:n,version:i,revision:o="published"}){return`${t||e}/components/${r}/${n}/${i}/${o}.html`}function Vt({cdn:t="https://feaascomponentsapidev.blob.core.windows.net",hostname:e,library:r,revision:n="published"}){return`${t||e}/styles/${r}/${n}.css`}async function z(t,e){return q(Jt(t),{},r=>r.headers.get("x-ms-meta-versionDeletedAt")==null,r=>{r.text().then(e)})}async function J(t,e){return q(Vt(t),{},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(e)})}function Kt(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return S(n,e),r}function dt(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function ht(t){return dt(t)+".*"}function ft(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 Gt(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var i=ft(t);if(i!=0)return;let o=t.parentElement;if(o!=null){e==0?t.style.display="none":t.style.display&&(t.style.display="",t.getAttribute("style")==""&&t.removeAttribute("style"));for(var s=i+1,a=t,u=t;u=u.nextElementSibling;)u.getAttribute("data-path-scope")==n&&(s++,a=u);for(var d=s;d<e;d++)o.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var d=Math.max(1,e);d<s;d++)a=a.previousElementSibling,o.removeChild(a.nextElementSibling)}}function nt(t,e,r=!1,n=t){var i=e;let o=Object.keys(t).sort((a,u)=>u.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=f({path:i,json:n});return t!=null&&t._&&Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=f({path:i.replace(/^.*?\./,"_."),json:t})),r&&Array.isArray(s)?s[0]:s}function D(t,e,r,n){var i;if(t){var o=t;n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(t,e,r));var s=e.replace("data-path-","");if(e=="data-path-src")o=t.tagName=="IMG"?t:t.querySelector("img, video");else if(e=="data-path-href")o=t.querySelector("a")||t.closest("a");else if(e=="data-path-alt")o=t.querySelector("img, picture");else if(e=="data-path-hidden")r=r?null:!0;else if(e=="data-path"||e=="data-embed-html"||e=="html")s="innerHTML";else if(e=="data-embed-src")V(t,r);else if(e=="data-path-attributes"){let l=((i=t.getAttribute("data-attributes-keys"))===null||i===void 0?void 0:i.split(",").filter(Boolean))||[];for(var a in r){var u=r[a];D(t,a,typeof u=="object"&&u?JSON.stringify(u):u,n)}for(var d=0;d<l.length;d++)(r==null||!(l[d]in r))&&D(t,l[d],null,n);D(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var c=String(t.getAttribute("data-path-placeholder")||o[s]);r!=null?s=="innerHTML"?o.innerHTML!=r&&(o.innerHTML=r):o.getAttribute(s)!=r&&o.setAttribute(s,r):s=="innerHTML"?o.innerHTML=c:o.removeAttribute(s)}}}function pt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&V(i,o),n.addedNodes&&n.addedNodes.forEach(s=>{s.nodeType==1&&yt(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function yt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];V(i,i.getAttribute("data-embed-src"))}if(e)return pt(t)}function V(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.type="module",o.src=e,r.appendChild(o);break}}var lt=["data-attributes-keys","data-path-attributes","data-path-scope"];function S(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 l=ft(a),h=nt(e,d,!1)||[];l==0&&Gt(a,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,a,h))===!1?1:h.length,r),e={...e,[ht(d)]:h[l]}}let c=Array.prototype.slice.call(a.attributes).sort((l,h)=>lt.indexOf(l.name)-lt.indexOf(h.name));for(var u=0;u<c.length;u++){let{name:l,value:h}=c[u];l.startsWith("data-path")&&l!="data-path-scope"&&D(a,l,nt(e,h,!0),r),l=="data-embed-src"&&D(a,l,a.getAttribute(l),r)}}for(var u=0;u<a.children.length;u++)S(a.children[u],e,r,!0);return n||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,e),a}function L(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;return t.innerHTML=o,t.classList.add("-feaas"),S(t,r,n)}function Yt(t,e){return vt(t,e||(e=document.createElement("style"))),e}function vt(t,e){return e||(e=document.createElement("style")),J(t,r=>{e.textContent=r}).then(()=>e)}function Qt(t,e){return bt(t,e||(e=document.createElement("div"))),e}async function bt(t,e){return e||(e=document.createElement("div")),e.childNodes.length?S(e,t.data,t):"template"in t?L(e,t.template,t.data,t):z(t,r=>L(e,r,t.data,t)).then(()=>e)}var Xt=typeof HTMLElement=="undefined"?class{}:HTMLElement,v=class extends Xt{constructor(){super(...arguments),this.connected=null,this.refs={},this.descendants=[],this.onLoad=e=>{e!=null&&(this.payload=e,this.render())}}getProps(e){return{}}getRoot(){return this}attributeChangedCallback(e,r,n){this.set()}connectedCallback(){console.log("FEAAS: Connected",this),this.connected=new Event("feaasConnected",{bubbles:!0,composed:!0}),this.dispatchEvent(this.connected),this.addEventListener("feaasConnected",this),this.addEventListener("feaasDisconnected",this),this.set()}disconnectedCallback(){console.log("FEAAS: Disconnected",this),this.removeEventListener("feaasConnected",this),this.removeEventListener("feaasDisconnected",this),this.dispatchEvent(new Event("feaasDisconnected",{bubbles:!0,composed:!0})),this.connected=null}handleEvent(e){switch(e.type){case"feaasConnected":this.nestedCallback(e);break;case"feaasDisconnected":this.unnestedCallback(e);break}}unnestedCallback(e){let r=e.composedPath()[0],n=this.descendants.indexOf(r);n!=-1&&(console.log("FEAAS: Unnest",this,r),this.descendants.splice(n,-1),this.refs[r.getComponentName()]=null,r.refs.parent==this&&(r.refs.parent=null),r.refs.top==this&&(r.refs.top=r.refs.parent))}nestedCallback(e){var r,n;let i=e.composedPath()[0];if(this.descendants.indexOf(i)==-1&&(this.descendants.push(i),console.log("FEAAS: Nest",this,i),this.refs[i.getComponentName()]=i,i.refs.top=this,(r=i.refs).parent||(r.parent=this),i.renderReact))for(var s=i.refs.parent;s;s=s.refs.parent)s.renderReact&&((n=i.refs).parentReact||(n.parentReact=s),i.refs.topReact=s)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}async reify(){this.payload!==void 0?this.render():this.isReadyToLoad()&&(this.payload=null,this.load().then(this.onLoad))}load(){return Promise.resolve(null)}render(e=!1){var r,n,i;if(console.log("FEAAS: React",this.tagName,this.payload),this.payload==null)return;let{React:o,ReactDOM:s}=this.payload||{};if(!o)throw new Error(`${this.tagName}: React is not present in payload`);if(!s)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?s.render(o.createElement(this.getReactWrapper()),this.getReactRoot()):this.forceUpdateReact?(r=this.forceUpdateReact)===null||r===void 0||r.call(this):(i=(n=this.refs.topReact).forceUpdateReact)===null||i===void 0||i.call(n)}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{},n=this.descendants.filter(i=>i.refs.parentReact==this&&i.payload).map((i,o)=>e.createElement(this.getReactWrapper(i),{key:this.tagName+"-"+o,slot:i.getAttribute("slot")}));return this.renderReact({...this.props,children:n},this.payload)}getReactWrapper(e=this,r=e.tagName){let n=e.reactWrapper||(e.reactWrapper=i=>{if(e.renderReact){let{React:o,ReactDOM:s}=e.payload||{},[a,u]=o.useReducer(d=>d+1,0);return e.forceUpdateReact=u,s.createPortal(o.createElement(o.Fragment,null,e.invokeReactRendering()),e.getReactRoot())}else return e.render()});return Object.assign(n,{displayName:r}),n}getUID(){return this.uid||(this.uid=String(Math.random()))}getReactRoot(){return this.getRoot()}set(e){this.overrides={...this.overrides,...e},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let n=this.props[r];this.props[r]==null?this.removeAttribute(r):(typeof n=="string"||typeof n=="number")&&this.getAttribute(r)!=String(n)&&this.setAttribute(r,String(n))}this.scheduleRender()}scheduleRender(){cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.reify()})}formatURL(e,r){return typeof e=="string"&&e.match(/^\/[^\/]/)?r+e:e}getContextAttribute(e,r=this){var n,i;return(i=(n=r.closest(`[${e}]`))===null||n===void 0?void 0:n.getAttribute(e))!==null&&i!==void 0?i:this.getAttribute(e)}static register(e){typeof window!="undefined"&&!window.customElements.get(e)&&window.customElements.define(e,this)}};function gt(t=this){let e,r=t.getAttribute("data");if(r!=null)try{e=typeof r=="string"?JSON.parse(r):{}}catch(n){}return{data:e!=null?e:{},library:t.getAttribute("library"),component:t.getAttribute("component"),version:t.getAttribute("version"),revision:t.getAttribute("revision"),hostname:t.getAttribute("hostname"),cdn:t.getContextAttribute("cdn"),template:t.getAttribute("template"),suspended:t.getAttribute("suspended")!=null}}var j=class extends v{setData(e){this.set({data:e})}getProps(){return gt(this)}attributeChangedCallback(e,r,n){this.payload=void 0,this.needsRefresh=!0,super.attributeChangedCallback(e,r,n)}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())try{z(this.props,this.onLoad)}catch(e){console.error(`FEAAS: Could not fetch component: ${this.props.component}/${this.props.version}/${this.props.revision}`)}}render(){if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)S(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;L(this,this.payload,this.props.data)}}};j.observedAttributes=["library","component","version","revision","hostname","cdn","template","data"];j.register("feaas-component");function Zt(t=this){return{hidden:(t==null?void 0:t.getAttribute("hidden"))!=null}}var B=class extends v{attributeChangedCallback(e,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"))}connectedCallback(){this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
|
|
1
|
+
var tt=Object.defineProperty;var kt=Object.getOwnPropertyDescriptor;var Pt=Object.getOwnPropertyNames;var Dt=Object.prototype.hasOwnProperty;var Ot=(t,e)=>{for(var r in e)tt(t,r,{get:e[r],enumerable:!0})},Tt=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Pt(e))!Dt.call(t,i)&&i!==r&&tt(t,i,{get:()=>e[i],enumerable:!(n=kt(e,i))||n.enumerable});return t};var Mt=t=>Tt(tt({},"__esModule",{value:!0}),t);var re={};Ot(re,{Base:()=>b,Component:()=>B,FEAASBase:()=>b,FEAASComponent:()=>B,FEAASComponentsProps:()=>At,FEAASContext:()=>U,FEAASContextProps:()=>Ft,FEAASEditor:()=>Y,FEAASEditorProps:()=>Et,FEAASLoader:()=>I,FEAASLoaderProps:()=>ee,FEAASPicker:()=>Q,FEAASPickerLazy:()=>H,FEAASPickerLazyProps:()=>xt,FEAASPickerProps:()=>_t,FEAASStylesheet:()=>G,FEAASStylesheetProps:()=>wt,JSONPath:()=>f,Loader:()=>I,Stylesheet:()=>G,autoloadScripts:()=>vt,cleanCollectionBit:()=>ft,fetchAndRevalidate:()=>z,getFramePosition:()=>Rt,loadScript:()=>K,normalizeCollectionScope:()=>pt,observeDOMElement:()=>bt,queryScopes:()=>ot,renderComponent:()=>Zt,renderComponentElement:()=>Yt,renderComponentPromise:()=>mt,renderDOMContent:()=>N,renderDOMElement:()=>S,renderStylesheet:()=>Xt,renderStylesheetPromise:()=>gt,serializeCH1RichText:()=>j,setDOMAttribute:()=>D});module.exports=Mt(re);function R(t){return R=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R(t)}function ut(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function at(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 ct(t,e,r){return e&&at(t.prototype,e),r&&at(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function $t(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&&L(t,e)}function $(t){return $=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},$(t)}function L(t,e){return L=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},L(t,e)}function lt(){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 M(t,e,r){return lt()?M=Reflect.construct.bind():M=function(i,o,s){var a=[null];a.push.apply(a,o);var u=Function.bind.apply(i,a),d=new u;return s&&L(d,s.prototype),d},M.apply(null,arguments)}function Lt(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function et(t){var e=typeof Map=="function"?new Map:void 0;return et=function(n){if(n===null||!Lt(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 M(n,arguments,$(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),L(i,n)},et(t)}function Nt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function jt(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 Nt(t)}function Bt(t){var e=lt();return function(){var n=$(t),i;if(e){var o=$(this).constructor;i=Reflect.construct(n,arguments,o)}else i=n.apply(this,arguments);return jt(this,i)}}function It(t){return Ht(t)||Ut(t)||dt(t)||Wt()}function Ht(t){if(Array.isArray(t))return rt(t)}function Ut(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function dt(t,e){if(t){if(typeof t=="string")return rt(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 rt(t,e)}}function rt(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 Wt(){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 qt(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=dt(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(u){throw u},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 u=r.next();return o=u.done,u},e:function(u){s=!0,a=u},f:function(){try{!o&&r.return!=null&&r.return()}finally{if(s)throw a}}}}var v=Object.prototype.hasOwnProperty;function F(t,e){return t=t.slice(),t.push(e),t}function nt(t,e){return e=e.slice(),e.unshift(t),e}var zt=function(t){$t(r,t);var e=Bt(r);function r(n){var i;return ut(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 ct(r)}(et(Error));function f(t,e,r,n,i){if(!(this instanceof f))try{return new f(t,e,r,n,i)}catch(u){if(!u.avoidNew)throw u;return u.value}typeof t=="string"&&(i=n,n=r,r=e,e=t,t=null);var o=t&&R(t)==="object";if(t=t||{},this.json=t.json||r,this.path=t.path||e,this.resultType=t.resultType||"value",this.flatten=t.flatten||!1,this.wrap=v.call(t,"wrap")?t.wrap:!0,this.sandbox=t.sandbox||{},this.preventEval=t.preventEval||!1,this.parent=t.parent||null,this.parentProperty=t.parentProperty||null,this.callback=t.callback||n||null,this.otherTypeCallback=t.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){var s={path:o?t.path:e};o?"json"in t&&(s.json=t.json):s.json=r;var a=this.evaluate(s);if(!a||R(a)!=="object")throw new zt(a);return a}}f.prototype.evaluate=function(t,e,r,n){var i=this,o=this.parent,s=this.parentProperty,a=this.flatten,u=this.wrap;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,e=e||this.json,t=t||this.path,t&&R(t)==="object"&&!Array.isArray(t)){if(!t.path&&t.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!v.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var d=t;e=d.json,a=v.call(t,"flatten")?t.flatten:a,this.currResultType=v.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=v.call(t,"sandbox")?t.sandbox:this.currSandbox,u=v.call(t,"wrap")?t.wrap:u,this.currPreventEval=v.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=v.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=v.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,o=v.call(t,"parent")?t.parent:o,s=v.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 c=f.toPathArray(t);c[0]==="$"&&c.length>1&&c.shift(),this._hasParentSelector=null;var l=this._trace(c,e,["$"],o,s,r).filter(function(h){return h&&!h.isParentSelector});return l.length?!u&&l.length===1&&!l[0].hasArrExpr?this._getPreferredOutput(l[0]):l.reduce(function(h,p){var E=i._getPreferredOutput(p);return a&&Array.isArray(E)?h=h.concat(E):h.push(E),h},[]):u?[]: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 u=this,d;if(!t.length)return d={path:r,value:e,parent:n,parentProperty:i,hasArrExpr:s},this._handleCallback(d,o,"value"),d;var c=t[0],l=t.slice(1),h=[];function p(y){Array.isArray(y)?y.forEach(function(P){h.push(P)}):h.push(y)}if((typeof c!="string"||a)&&e&&v.call(e,c))p(this._trace(l,e[c],F(r,c),e,c,o,s));else if(c==="*")this._walk(e,function(y){p(u._trace(l,e[y],F(r,y),e,y,o,!0,!0))});else if(c==="..")p(this._trace(l,e,r,n,i,o,s)),this._walk(e,function(y){R(e[y])==="object"&&p(u._trace(t.slice(),e[y],F(r,y),e,y,o,!0))});else{if(c==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:l,isParentSelector:!0};if(c==="~")return d={path:F(r,c),value:i,parent:n,parentProperty:null},this._handleCallback(d,o,"property"),d;if(c==="$")p(this._trace(l,e,r,null,null,o,s));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(c))p(this._slice(c,l,e,r,n,i,o));else if(c.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var E=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(e,function(y){u._eval(E,e[y],y,r,n,i)&&p(u._trace(l,e[y],F(r,y),e,y,o,!0))})}else if(c[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");p(this._trace(nt(this._eval(c,e,r[r.length-1],r.slice(0,-1),n,i),l),e,r,n,i,o,s))}else if(c[0]==="@"){var g=!1,C=c.slice(1,-2);switch(C){case"scalar":(!e||!["object","function"].includes(R(e)))&&(g=!0);break;case"boolean":case"string":case"undefined":case"function":R(e)===C&&(g=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(g=!0);break;case"number":Number.isFinite(e)&&(g=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(g=!0);break;case"object":e&&R(e)===C&&(g=!0);break;case"array":Array.isArray(e)&&(g=!0);break;case"other":g=this.currOtherTypeCallback(e,r,n,i);break;case"null":e===null&&(g=!0);break;default:throw new TypeError("Unknown value type "+C)}if(g)return d={path:r,value:e,parent:n,parentProperty:i},this._handleCallback(d,o,"value"),d}else if(c[0]==="`"&&e&&v.call(e,c.slice(1))){var O=c.slice(1);p(this._trace(l,e[O],F(r,O),e,O,o,s,!0))}else if(c.includes(",")){var X=c.split(","),_=qt(X),m;try{for(_.s();!(m=_.n()).done;){var Z=m.value;p(this._trace(nt(Z,l),e,r,n,i,o,!0))}}catch(y){_.e(y)}finally{_.f()}}else!a&&e&&v.call(e,c)&&p(this._trace(l,e[c],F(r,c),e,c,o,s,!0))}if(this._hasParentSelector)for(var A=0;A<h.length;A++){var k=h[A];if(k&&k.isParentSelector){var w=this._trace(k.expr,e,k.path,n,i,o,s);if(Array.isArray(w)){h[A]=w[0];for(var W=w.length,x=1;x<W;x++)A++,h.splice(A,0,w[x])}else h[A]=w}}return h};f.prototype._walk=function(t,e){if(Array.isArray(t))for(var r=t.length,n=0;n<r;n++)e(n);else t&&R(t)==="object"&&Object.keys(t).forEach(function(i){e(i)})};f.prototype._slice=function(t,e,r,n,i,o,s){if(Array.isArray(r)){var a=r.length,u=t.split(":"),d=u[2]&&Number.parseInt(u[2])||1,c=u[0]&&Number.parseInt(u[0])||0,l=u[1]&&Number.parseInt(u[1])||a;c=c<0?Math.max(0,c+a):Math.min(a,c),l=l<0?Math.max(0,l+a):Math.min(a,l);for(var h=[],p=c;p<l;p+=d){var E=this._trace(nt(p,e),r,n,i,o,s,!0);E.forEach(function(g){h.push(g)})}return h}};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 u=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&&(u=u.replace(/@path/g,"_$_path")),f.cache[a]=new this.vm.Script(u)}try{return f.cache[a].runInNewContext(this.currSandbox)}catch(d){throw new Error("jsonPath: "+d.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 Jt=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])}},Vt=function(){function t(e){ut(this,t),this.code=e}return ct(t,[{key:"runInNewContext",value:function(r){var n=this.code,i=Object.keys(r),o=[];Jt(i,o,function(c){return typeof r[c]=="function"});var s=i.map(function(c,l){return r[c]}),a=o.reduce(function(c,l){var h=r[l].toString();return/function/.test(h)||(h="function "+h),"var "+l+"="+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 u=n.lastIndexOf(";"),d=u>-1?n.slice(0,u+1)+" return "+n.slice(u+1):" return "+n;return M(Function,i.concat([d])).apply(void 0,It(s))}}]),t}();f.prototype.vm={Script:Vt};async function z(t,e,r,n){let i=new Date,o=await fetch(t,e);if(!o.ok)throw new Error("Fetch failed");let s=new Date(o.headers.get("date"));var a=o;if(n(o,"cached"),s<i){let u=await fetch(t+"?"+Math.random(),{...e,method:"HEAD",cache:"no-cache"});if(u.headers.get("last-modified")!=o.headers.get("last-modified")){if(r(u)===!1)throw new Error("Response is stale");a=await fetch(t,{...e,cache:"reload"})}}if(r(a)===!1)throw new Error("Response is not valid");return o!==a&&n(a,"valid"),a}function Kt({cdn:t="https://feaascomponentsapidev.blob.core.windows.net",hostname:e,library:r,component:n,version:i,revision:o="published"}){return`${t||e}/components/${r}/${n}/${i}/${o}.html`}function Gt({cdn:t="https://feaascomponentsapidev.blob.core.windows.net",hostname:e,library:r,revision:n="published"}){return`${t||e}/styles/${r}/${n}.css`}async function J(t,e){return z(Kt(t),{headers:{Accept:"text/html"}},r=>r.headers.get("x-ms-meta-versionDeletedAt")==null,r=>{r.text().then(e)})}async function V(t,e){return z(Gt(t),{headers:{Accept:"text/css"}},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(e)})}function Yt(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return S(n,e),r}function ft(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function pt(t){return ft(t)+".*"}function yt(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 Qt(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var i=yt(t);if(i!=0)return;let o=t.parentElement;if(o!=null){e==0?t.setAttribute("hidden","hidden"):t.getAttribute("hidden")!=null&&t.removeAttribute("hidden");for(var s=i+1,a=t,u=t;u=u.nextElementSibling;)u.getAttribute("data-path-scope")==n&&(s++,a=u);for(var d=s;d<e;d++)o.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var d=Math.max(1,e);d<s;d++)a=a.previousElementSibling,o.removeChild(a.nextElementSibling)}}function ot(t,e,r=!1,n=t){var i=e;let o=Object.keys(t).sort((a,u)=>u.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=f({path:i,json:n});return Array.isArray(s)&&(s==null?void 0:s.length)==0&&(s=[i.replace(/^.*?\./,"_."),i.replace(/^.*?\./,""),i.replace(/^([^.]+).*?\.\$\./,"$1."),i.replace(/^.*?\.\$\./,"_."),i.replace(/^.*?\.\$\./,"")].filter((a,u,d)=>d.indexOf(a)===u).reduce((a,u)=>a.length>0?a:f({path:u,json:n}),[])),r&&Array.isArray(s)?s[0]:s}function D(t,e,r,n){var i;if(t){var o=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=j(r)),n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(t,e,r));var s=e.replace("data-path-","");if(e=="data-path-src")o=t.tagName=="IMG"?t:t.querySelector("img, video");else if(e=="data-path-href")o=t.querySelector("a")||t.closest("a");else if(e=="data-path-alt")o=t.querySelector("img, picture");else if(e=="data-path-hidden")r=r?null:!0;else if(e=="data-path"||e=="data-embed-html"||e=="html")s="innerHTML";else if(e=="data-embed-src")K(t,r);else if(e=="data-path-attributes"){let l=((i=t.getAttribute("data-attributes-keys"))===null||i===void 0?void 0:i.split(",").filter(Boolean))||[];for(var a in r){var u=r[a];D(t,a,typeof u=="object"&&u?JSON.stringify(u):u,n)}for(var d=0;d<l.length;d++)(r==null||!(l[d]in r))&&D(t,l[d],null,n);D(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var c=String(t.getAttribute("data-path-placeholder")||o[s]);r!=null?s=="innerHTML"?o.innerHTML!=r&&(o.innerHTML=r):o.getAttribute(s)!=r&&o.setAttribute(s,r):s=="innerHTML"?o.innerHTML=c:o.removeAttribute(s)}}}function bt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,o=i.getAttribute("data-embed-src");o&&K(i,o),n.addedNodes&&n.addedNodes.forEach(s=>{s.nodeType==1&&vt(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function vt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];K(i,i.getAttribute("data-embed-src"))}if(e)return bt(t)}function K(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.type="module",o.src=e,r.appendChild(o);break}}var ht=["data-attributes-keys","data-path-attributes","data-path-scope"];function S(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 l=yt(a),h=ot(e,d,!1)||[];l==0&&Qt(a,((o=r==null?void 0:r.shouldRepeat)===null||o===void 0?void 0:o.call(r,a,h))===!1?1:h.length,r),e={...e,[pt(d)]:h[l]}}let c=Array.prototype.slice.call(a.attributes).sort((l,h)=>ht.indexOf(l.name)-ht.indexOf(h.name));for(var u=0;u<c.length;u++){let{name:l,value:h}=c[u];l.startsWith("data-path")&&l!="data-path-scope"&&D(a,l,ot(e,h,!0),r),l=="data-embed-src"&&D(a,l,a.getAttribute(l),r)}}for(var u=0;u<a.children.length;u++)S(a.children[u],e,r,!0);return n||(s=r==null?void 0:r.onRender)===null||s===void 0||s.call(r,a,e),a}function N(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;return t.innerHTML=o,t.classList.add("-feaas"),S(t,r,n)}function Xt(t,e){return gt(t,e||(e=document.createElement("style"))),e}function gt(t,e){return e||(e=document.createElement("style")),V(t,r=>{e.textContent=r}).then(()=>e)}function Zt(t,e){return mt(t,e||(e=document.createElement("div"))),e}async function mt(t,e){return e||(e=document.createElement("div")),e.childNodes.length?S(e,t.data,t):"template"in t?N(e,t.template,t.data,t):J(t,r=>N(e,r,t.data,t)).then(()=>e)}function it(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 it(t.content,n,"h"+r);case"text":return(t.marks||[]).reduce((i,o)=>it(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 it(t.content||t.text,t.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[t.type])}}var te=typeof HTMLElement=="undefined"?class{}:HTMLElement,b=class extends te{constructor(){super(...arguments),this.connected=null,this.refs={},this.descendants=[],this.onLoad=e=>{e!=null&&(this.payload=e,this.render())}}getProps(e){return{}}getRoot(){return this}attributeChangedCallback(e,r,n){this.set()}connectedCallback(){console.log("FEAAS: Connected",this),this.connected=new Event("feaasConnected",{bubbles:!0,composed:!0}),this.dispatchEvent(this.connected),this.addEventListener("feaasConnected",this),this.addEventListener("feaasDisconnected",this),this.set()}disconnectedCallback(){console.log("FEAAS: Disconnected",this),this.removeEventListener("feaasConnected",this),this.removeEventListener("feaasDisconnected",this),this.dispatchEvent(new Event("feaasDisconnected",{bubbles:!0,composed:!0})),this.connected=null}handleEvent(e){switch(e.type){case"feaasConnected":this.nestedCallback(e);break;case"feaasDisconnected":this.unnestedCallback(e);break}}unnestedCallback(e){let r=e.composedPath()[0],n=this.descendants.indexOf(r);n!=-1&&(console.log("FEAAS: Unnest",this,r),this.descendants.splice(n,-1),this.refs[r.getComponentName()]=null,r.refs.parent==this&&(r.refs.parent=null),r.refs.top==this&&(r.refs.top=r.refs.parent))}nestedCallback(e){var r,n;let i=e.composedPath()[0];if(this.descendants.indexOf(i)==-1&&(this.descendants.push(i),console.log("FEAAS: Nest",this,i),this.refs[i.getComponentName()]=i,i.refs.top=this,(r=i.refs).parent||(r.parent=this),i.renderReact))for(var s=i.refs.parent;s;s=s.refs.parent)s.renderReact&&((n=i.refs).parentReact||(n.parentReact=s),i.refs.topReact=s)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}async reify(){this.payload!==void 0?this.render():this.isReadyToLoad()&&(this.payload=null,this.load().then(this.onLoad))}load(){return Promise.resolve(null)}render(e=!1){var r,n,i;if(console.log("FEAAS: React",this.tagName,this.payload),this.payload==null)return;let{React:o,ReactDOM:s}=this.payload||{};if(!o)throw new Error(`${this.tagName}: React is not present in payload`);if(!s)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?s.render(o.createElement(this.getReactWrapper()),this.getReactRoot()):this.forceUpdateReact?(r=this.forceUpdateReact)===null||r===void 0||r.call(this):(i=(n=this.refs.topReact).forceUpdateReact)===null||i===void 0||i.call(n)}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{},n=this.descendants.filter(i=>i.refs.parentReact==this&&i.payload).map((i,o)=>e.createElement(this.getReactWrapper(i),{key:this.tagName+"-"+o,slot:i.getAttribute("slot")}));return this.renderReact({...this.props,children:n},this.payload)}getReactWrapper(e=this,r=e.tagName){let n=e.reactWrapper||(e.reactWrapper=i=>{if(e.renderReact){let{React:o,ReactDOM:s}=e.payload||{},[a,u]=o.useReducer(d=>d+1,0);return e.forceUpdateReact=u,s.createPortal(o.createElement(o.Fragment,null,e.invokeReactRendering()),e.getReactRoot())}else return e.render()});return Object.assign(n,{displayName:r}),n}getUID(){return this.uid||(this.uid=String(Math.random()))}getReactRoot(){return this.getRoot()}set(e){this.overrides={...this.overrides,...e},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let n=this.props[r];this.props[r]==null?this.removeAttribute(r):(typeof n=="string"||typeof n=="number")&&this.getAttribute(r)!=String(n)&&this.setAttribute(r,String(n))}this.scheduleRender()}scheduleRender(){cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.reify()})}formatURL(e,r){return typeof e=="string"&&e.match(/^\/[^\/]/)?r+e:e}getContextAttribute(e,r=this){var n,i;return(i=(n=r.closest(`[${e}]`))===null||n===void 0?void 0:n.getAttribute(e))!==null&&i!==void 0?i:this.getAttribute(e)}static register(e){typeof window!="undefined"&&!window.customElements.get(e)&&window.customElements.define(e,this)}};function At(t=this){let e,r=t.getAttribute("data");if(r!=null)try{e=typeof r=="string"?JSON.parse(r):{}}catch(n){}return{data:e!=null?e:{},library:t.getAttribute("library"),component:t.getAttribute("component"),version:t.getAttribute("version"),revision:t.getAttribute("revision"),hostname:t.getAttribute("hostname"),cdn:t.getContextAttribute("cdn"),template:t.getAttribute("template"),suspended:t.getAttribute("suspended")!=null}}var B=class extends b{setData(e){this.set({data:e})}getProps(){return At(this)}attributeChangedCallback(e,r,n){this.payload=void 0,this.needsRefresh=!0,super.attributeChangedCallback(e,r,n)}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())try{J(this.props,this.onLoad)}catch(e){console.error(`FEAAS: Could not fetch component: ${this.props.component}/${this.props.version}/${this.props.revision}`)}}render(){if(Array.from(this.children).filter(e=>e.tagName!="BR").length>0&&!this.needsRefresh)S(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;N(this,this.payload,this.props.data)}}};B.observedAttributes=["library","component","version","revision","hostname","cdn","template","data"];B.register("feaas-component");function ee(t=this){return{hidden:(t==null?void 0:t.getAttribute("hidden"))!=null}}var I=class extends b{attributeChangedCallback(e,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"))}connectedCallback(){this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
|
|
4
5
|
#loader {
|
|
5
6
|
position: absolute;
|
|
6
7
|
top: 0;
|
|
@@ -64,10 +65,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
64
65
|
style="animation: 1.5s linear 0s infinite normal none running loader-circular-track"
|
|
65
66
|
></circle>
|
|
66
67
|
</svg>
|
|
67
|
-
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}};
|
|
68
|
+
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}};I.observedAttributes=["hidden"];I.register("feaas-loader");function wt(t=this){var e;return{library:t==null?void 0:t.getContextAttribute("library"),revision:(e=t==null?void 0:t.getAttribute("revision"))!==null&&e!==void 0?e:"published",cdn:(t==null?void 0:t.getContextAttribute("cdn"))||(t==null?void 0:t.getContextAttribute("hostname"))}}var G=class extends b{getProps(){return wt(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}async load(){V(this.props,this.onLoad)}render(){this.stylesheet||(this.stylesheet=document.createElement("style"),this.appendChild(this.stylesheet)),this.stylesheet.textContent=this.payload}};G.register("feaas-stylesheet");var st;typeof window!="undefined"&&((st=window.FEAASLoading)!==null&&st!==void 0||(window.FEAASLoading=Promise.resolve()));function Rt(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 Et(t=this){var e;return{context:HTMLElement,frontend:t==null?void 0:t.getContextAttribute("frontend"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/assets/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"),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")}}var Y=class extends b{constructor(){super(...arguments),this.framePoint={top:0,left:0},this.wrapperRect={top:0,left:0,width:0,height:0},this.bodyRect={top:0,left:0,width:0,height:0},this.getTarget=()=>document.querySelector("iframe").contentWindow.document.getElementById(this.props.for),this.onChromeMeasureElement=(e,r)=>(r==null&&(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=Rt(e.memoized.focusable)),this.wrapperRect=this.wrapper.getBoundingClientRect(),this.bodyRect=this.wrapper.ownerDocument.body.parentElement.getBoundingClientRect()},this.onMeasure=()=>{},this.onPosition=({focusable:e,root:r})=>{let n=this.wrapper.querySelector(".editor-chrome"),i=this.wrapper.querySelector(".ui.overlays");e?(n.style.width=e.width+16*2+"px",n.style.height=e.height+16*1+64+"px",n.style.left=e.left-16+"px",n.style.top=e.top-64+"px",i&&(i.style.left=r.left+"px",i.style.top=r.top+"px")):(n.style.left="-1000px",n.style.top="-1000px")}}getProps(){return Et(this)}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}renderReact({children:e,component:r,version:n},{Editor:i,VersionStatusList:o,Version:s,EditorUIUndo:a,EditorUIMode:u,React:{useEffect:d,useMemo:c,useState:l},Chakra:{HStack:h,Box:p},Chrome:E,ReactDOM:g,useSDK:C,useSlots:O,useModelObserver:X}){if(!this.payload)return;let{sdk:_}=C(),[m,Z]=l(),A=_.library;d(()=>Z(A.components.getItem(r)),[r,A]),d(()=>{m==null||m.versions.fetch()},[m]);let k=c(this.getTarget,[this.props.for]),w=X(m==null?void 0:m.versions),W=c(()=>(w==null?void 0:w.filter(x=>x.id==n||!n))||[],[w]);if(m)return O(e,({picker:x,children:y})=>React.createElement(p,{ref:P=>this.wrapper=P},React.createElement(p,{className:"editor-wrapper",position:"absolute",left:0,top:0},React.createElement(i,{datasources:_.datasources,sdk:_,library:_.library,component:m,versions:W,context:{onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition}},({editor:P,status:St,isArchivedDisplayed:Ct})=>({after:y,picker:x,chrome:P&&React.createElement(E,null),children:m.reduceVersionRevisions(W).filter(T=>{var q;return Ct||!(!((q=T.saved||T.draft)===null||q===void 0)&&q.deletedAt)}).map((T,q)=>React.createElement(p,{key:T.head.id,position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none"},React.createElement(p,{className:"borders",pointerEvents:"none",left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(p,{className:"borders",pointerEvents:"none",right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(p,{className:"borders",pointerEvents:"none",top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(p,{className:"borders",pointerEvents:"none",bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),React.createElement(s,{version:T.head,node:k},{left:React.createElement(h,{justifyContent:"space-between"},React.createElement(a,{size:"sm",editor:St=="ready"?P:null}),React.createElement(u,{size:"sm"})),middle:React.createElement(o,null)})))})))))}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null}};Y.register("feaas-editor");function _t(t=this){var e,r;return{part:(t==null?void 0:t.getAttribute("part"))||"picker",slot:(t==null?void 0:t.getAttribute("part"))||"slot",mode:t==null?void 0:t.getAttribute("mode"),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:"/assets/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,context:void 0,onClose:void 0}}var Q=class extends b{getProps(){return _t(this)}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}renderReact({context:e,mode:r,children:n},{Picker:i,React:o,ReactDOM:s}){return o.createElement(i,{mode:r||void 0,onClose:this.props.onClose,context:e},n)}};Q.register("feaas-picker");function xt(t=this){var e,r;return{library:(t==null?void 0:t.getAttribute("library"))||"library",mode:t==null?void 0:t.getAttribute("mode"),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:"/assets/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,context:null,getToken:null}}var H=class extends b{constructor(){super(...arguments),this.payload=null,this.onClose=()=>{this.removeAttribute("mode")}}getProps(){return xt(this)}render(){let{frontend:e,library:r,getToken:n,src:i,mode:o,context:s}=this.props;this.getAttribute("mode")==null?this.setAttribute("hidden","hidden"):this.removeAttribute("hidden"),this.children.length==0&&(this.innerHTML=`
|
|
68
69
|
<feaas-context library='${r}'>
|
|
69
70
|
<feaas-picker mode='${o}'>
|
|
70
71
|
<feaas-loader />
|
|
71
72
|
</feaas-context>
|
|
72
|
-
`),this.refs.context.set({frontend:e,library:r,getToken:n}),this.refs.picker.set({frontend:e,context:s,src:i,mode:o,onClose:this.onClose})}};
|
|
73
|
+
`),this.refs.context.set({frontend:e,library:r,getToken:n}),this.refs.picker.set({frontend:e,context:s,src:i,mode:o,onClose:this.onClose})}};H.observedAttributes=["library","mode","frontend","src","context"];H.register("feaas-picker-lazy");function Ft(t=this){var e,r,n,i;return{library:t==null?void 0:t.getAttribute("library"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/assets/context.js",frontend:(r=t==null?void 0:t.getAttribute("frontend"))!==null&&r!==void 0?r:"https://components.sitecoreclud.io",backend:(n=t==null?void 0:t.getAttribute("backend"))!==null&&n!==void 0?n:"https://components-api.sitecoreclud.io",cdn:(i=t==null?void 0:t.getAttribute("cdn"))!==null&&i!==void 0?i:"https://feaascompontsapiprod.blob.core.windows.net",getToken:null}}var U=class extends b{getProps(){return Ft(this)}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}getTheme(e){return e}getRoot(){return this.shadowRoot||this.attachShadow({mode:"open"})}getReactRoot(){return this.reactRoot||(this.reactRoot=document.createElement("div"),this.getRoot().appendChild(this.reactRoot)),this.reactRoot}nestedCallback(e){super.nestedCallback(e);let r=e.composedPath()[0];r.parentNode!=this.getRoot()&&this.getRoot().appendChild(r)}renderReact({children:e,library:r},{AppContext:n,Chakra:{Button:i,Tooltip:o},React:s}){let a={containerRef:{current:this.getRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.createElement(n,{libraryId:this.props.library,container:this.getRoot(),getToken:this.props.getToken,getTheme:this.getTheme,modalProps:{portalProps:a},chakraProps:{cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},e)}};U.observedAttributes=["library","component","version","revision","hostname","template"];U.register("feaas-context");
|
|
73
74
|
//# sourceMappingURL=index.js.map
|