Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sitecore-feaas/clientside

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sitecore-feaas/clientside - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

2

dist/browser/index.js
var it=Object.defineProperty,Et=Object.defineProperties;var wt=Object.getOwnPropertyDescriptors;var rt=Object.getOwnPropertySymbols;var At=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable;var nt=(t,e,r)=>e in t?it(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,F=(t,e)=>{for(var r in e||(e={}))At.call(e,r)&&nt(t,r,e[r]);if(rt)for(var r of rt(e))St.call(e,r)&&nt(t,r,e[r]);return t},x=(t,e)=>Et(t,wt(e));var at=(t,e)=>{for(var r in e)it(t,r,{get:e[r],enumerable:!0})};var w=(t,e,r)=>new Promise((n,i)=>{var a=u=>{try{s(r.next(u))}catch(f){i(f)}},o=u=>{try{s(r.throw(u))}catch(f){i(f)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(a,o);s((r=r.apply(t,e)).next())});var Z={};at(Z,{autoloadScripts:()=>dt,cleanCollectionBit:()=>ct,loadScript:()=>q,normalizeCollectionScope:()=>ft,observeDOMElement:()=>pt,queryScopes:()=>Q,renderComponent:()=>Jt,renderComponentElement:()=>Bt,renderComponentPromise:()=>mt,renderDOMContent:()=>P,renderDOMElement:()=>A,renderStylesheet:()=>Nt,renderStylesheetPromise:()=>yt,setDOMAttribute:()=>C});function g(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?g=function(e){return typeof e}:g=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(t)}function _t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Dt(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}}),e&&B(t,e)}function R(t){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},R(t)}function B(t,e){return B=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},B(t,e)}function st(){if(typeof Reflect=="undefined"||!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(t){return!1}}function j(t,e,r){return st()?j=Reflect.construct:j=function(i,a,o){var s=[null];s.push.apply(s,a);var u=Function.bind.apply(i,s),f=new u;return o&&B(f,o.prototype),f},j.apply(null,arguments)}function Tt(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function G(t){var e=typeof Map=="function"?new Map:void 0;return G=function(n){if(n===null||!Tt(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return j(n,arguments,R(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),B(i,n)},G(t)}function Ct(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Pt(t,e){return e&&(typeof e=="object"||typeof e=="function")?e:Ct(t)}function Mt(t){var e=st();return function(){var n=R(t),i;if(e){var a=R(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return Pt(this,i)}}function ot(t){return Ot(t)||Lt(t)||ut(t)||Ht()}function Ot(t){if(Array.isArray(t))return K(t)}function Lt(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ut(t,e){if(!!t){if(typeof t=="string")return K(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 K(t,e)}}function K(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 Ht(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $t(t,e){var r=typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ut(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.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return a=u.done,u},e:function(u){o=!0,s=u},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(o)throw s}}}}var b=Object.prototype.hasOwnProperty;function k(t,e){return t=t.slice(),t.push(e),t}function T(t,e){return e=e.slice(),e.unshift(t),e}var xt=function(t){Dt(r,t);var e=Mt(r);function r(n){var i;return _t(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 r}(G(Error));function p(t,e,r,n,i){if(!(this instanceof p))try{return new p(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 a=t&&g(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 o={path:a?t.path:e};a?"json"in t&&(o.json=t.json):o.json=r;var s=this.evaluate(o);if(!s||g(s)!=="object")throw new xt(s);return s}}p.prototype.evaluate=function(t,e,r,n){var i=this,a=this.parent,o=this.parentProperty,s=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&&g(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 f=t;e=f.json,s=b.call(t,"flatten")?t.flatten:s,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,a=b.call(t,"parent")?t.parent:a,o=b.call(t,"parentProperty")?t.parentProperty:o,t=t.path}if(a=a||null,o=o||null,Array.isArray(t)&&(t=p.toPathString(t)),!(!t&&t!==""||!e)){var l=p.toPathArray(t);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;var c=this._trace(l,e,["$"],a,o,r).filter(function(h){return h&&!h.isParentSelector});return c.length?!u&&c.length===1&&!c[0].hasArrExpr?this._getPreferredOutput(c[0]):c.reduce(function(h,d){var y=i._getPreferredOutput(d);return s&&Array.isArray(y)?h=h.concat(y):h.push(y),h},[]):u?[]:void 0}};p.prototype._getPreferredOutput=function(t){var e=this.currResultType;switch(e){case"all":{var r=Array.isArray(t.path)?t.path:p.toPathArray(t.path);return t.pointer=p.toPointer(r),t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return p.toPathString(t[e]);case"pointer":return p.toPointer(t.path);default:throw new TypeError("Unknown result type")}};p.prototype._handleCallback=function(t,e,r){if(e){var n=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),e(n,r,t)}};p.prototype._trace=function(t,e,r,n,i,a,o,s){var u=this,f;if(!t.length)return f={path:r,value:e,parent:n,parentProperty:i,hasArrExpr:o},this._handleCallback(f,a,"value"),f;var l=t[0],c=t.slice(1),h=[];function d(m){Array.isArray(m)?m.forEach(function(_){h.push(_)}):h.push(m)}if((typeof l!="string"||s)&&e&&b.call(e,l))d(this._trace(c,e[l],k(r,l),e,l,a,o));else if(l==="*")this._walk(l,c,e,r,n,i,a,function(m,_,O,v,D,L,H,$){d(u._trace(T(m,O),v,D,L,H,$,!0,!0))});else if(l==="..")d(this._trace(c,e,r,n,i,a,o)),this._walk(l,c,e,r,n,i,a,function(m,_,O,v,D,L,H,$){g(v[m])==="object"&&d(u._trace(T(_,O),v[m],k(D,m),v,m,$,!0))});else{if(l==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:c,isParentSelector:!0};if(l==="~")return f={path:k(r,l),value:i,parent:n,parentProperty:null},this._handleCallback(f,a,"property"),f;if(l==="$")d(this._trace(c,e,r,null,null,a,o));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(l))d(this._slice(l,c,e,r,n,i,a));else if(l.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");this._walk(l,c,e,r,n,i,a,function(m,_,O,v,D,L,H,$){u._eval(_.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1"),v[m],m,D,L,H)&&d(u._trace(T(m,O),v,D,L,H,$,!0))})}else if(l[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");d(this._trace(T(this._eval(l,e,r[r.length-1],r.slice(0,-1),n,i),c),e,r,n,i,a,o))}else if(l[0]==="@"){var y=!1,S=l.slice(1,-2);switch(S){case"scalar":(!e||!["object","function"].includes(g(e)))&&(y=!0);break;case"boolean":case"string":case"undefined":case"function":g(e)===S&&(y=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(y=!0);break;case"number":Number.isFinite(e)&&(y=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(y=!0);break;case"object":e&&g(e)===S&&(y=!0);break;case"array":Array.isArray(e)&&(y=!0);break;case"other":y=this.currOtherTypeCallback(e,r,n,i);break;case"null":e===null&&(y=!0);break;default:throw new TypeError("Unknown value type "+S)}if(y)return f={path:r,value:e,parent:n,parentProperty:i},this._handleCallback(f,a,"value"),f}else if(l[0]==="`"&&e&&b.call(e,l.slice(1))){var V=l.slice(1);d(this._trace(c,e[V],k(r,V),e,V,a,o,!0))}else if(l.includes(",")){var gt=l.split(","),I=$t(gt),et;try{for(I.s();!(et=I.n()).done;){var vt=et.value;d(this._trace(T(vt,c),e,r,n,i,a,!0))}}catch(m){I.e(m)}finally{I.f()}}else!s&&e&&b.call(e,l)&&d(this._trace(c,e[l],k(r,l),e,l,a,o,!0))}if(this._hasParentSelector)for(var E=0;E<h.length;E++){var N=h[E];if(N&&N.isParentSelector){var M=this._trace(N.expr,e,N.path,n,i,a,o);if(Array.isArray(M)){h[E]=M[0];for(var Ft=M.length,Y=1;Y<Ft;Y++)E++,h.splice(E,0,M[Y])}else h[E]=M}}return h};p.prototype._walk=function(t,e,r,n,i,a,o,s){if(Array.isArray(r))for(var u=r.length,f=0;f<u;f++)s(f,t,e,r,n,i,a,o);else r&&g(r)==="object"&&Object.keys(r).forEach(function(l){s(l,t,e,r,n,i,a,o)})};p.prototype._slice=function(t,e,r,n,i,a,o){if(!!Array.isArray(r)){var s=r.length,u=t.split(":"),f=u[2]&&Number.parseInt(u[2])||1,l=u[0]&&Number.parseInt(u[0])||0,c=u[1]&&Number.parseInt(u[1])||s;l=l<0?Math.max(0,l+s):Math.min(s,l),c=c<0?Math.max(0,c+s):Math.min(s,c);for(var h=[],d=l;d<c;d+=f){var y=this._trace(T(d,e),r,n,i,a,o,!0);y.forEach(function(S){h.push(S)})}return h}};p.prototype._eval=function(t,e,r,n,i,a){t.includes("@parentProperty")&&(this.currSandbox._$_parentProperty=a,t=t.replace(/@parentProperty/g,"_$_parentProperty")),t.includes("@parent")&&(this.currSandbox._$_parent=i,t=t.replace(/@parent/g,"_$_parent")),t.includes("@property")&&(this.currSandbox._$_property=r,t=t.replace(/@property/g,"_$_property")),t.includes("@path")&&(this.currSandbox._$_path=p.toPathString(n.concat([r])),t=t.replace(/@path/g,"_$_path")),t.includes("@root")&&(this.currSandbox._$_root=this.json,t=t.replace(/@root/g,"_$_root")),/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/.test(t)&&(this.currSandbox._$_v=e,t=t.replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1"));try{return this.vm.runInNewContext(t,this.currSandbox)}catch(o){throw console.log(o),new Error("jsonPath: "+o.message+": "+t)}};p.cache={};p.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};p.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};p.toPathArray=function(t){var e=p.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(a,o){return"[#"+(r.push(o)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(a,o){return"['"+o.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(a,o){return";"+o.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),i=n.split(";").map(function(a){var o=a.match(/#([0-9]+)/);return!o||!o[1]?a:r[o[1]]});return e[t]=i,e[t].concat()};var kt=function(e,r,n){for(var i=e.length,a=0;a<i;a++){var o=e[a];n(o)&&r.push(e.splice(a--,1)[0])}};p.prototype.vm={runInNewContext:function(e,r){var n=Object.keys(r),i=[];kt(n,i,function(f){return typeof r[f]=="function"});var a=n.map(function(f,l){return r[f]}),o=i.reduce(function(f,l){var c=r[l].toString();return/function/.test(c)||(c="function "+c),"var "+l+"="+c+";"+f},"");e=o+e,!/(["'])use strict\1/.test(e)&&!n.includes("arguments")&&(e="var arguments = undefined;"+e),e=e.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var s=e.lastIndexOf(";"),u=s>-1?e.slice(0,s+1)+" return "+e.slice(s+1):" return "+e;return j(Function,ot(n).concat([u])).apply(void 0,ot(a))}};function X(t,e,r,n){return w(this,null,function*(){let i=new Date,a=yield fetch(t,e);if(!a.ok)throw new Error("Fetch failed");let o=new Date(a.headers.get("date"));var s=a;if(n(a,"cached"),o<i){let u=yield fetch(t+"?"+Math.random(),x(F({},e),{method:"HEAD",cache:"no-cache"}));if(u.headers.get("last-modified")!=a.headers.get("last-modified")){if(r(u)===!1)throw new Error("Response is stale");s=yield fetch(t,x(F({},e),{cache:"reload"}))}}if(r(s)===!1)throw new Error("Response is not valid");return a!==s&&n(s,"valid"),s})}function jt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,component:r,variant:n,version:i="published"}){return`${t}/components/${r}/variants/${n}/${i}.html`}function Rt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,version:r="published"}){return`${t}/styles/${e}/${r}.css`}function J(t,e){return w(this,null,function*(){return X(jt(t),{},r=>r.headers.get("x-ms-meta-variantDeletedAt")==null,r=>{r.text().then(e)})})}function z(t,e){return w(this,null,function*(){return X(Rt(t),{},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(e)})})}function Bt(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return A(n,e),r}function ct(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function ft(t){return ct(t)+".*"}function ht(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 It(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var i=ht(t);if(i!=0)return;let a=t.parentElement;if(a!=null){e==0?t.style.display="none":t.style.display&&(t.style.display="",t.getAttribute("style")==""&&t.removeAttribute("style"));for(var o=i+1,s=t,u=t;u=u.nextElementSibling;)u.getAttribute("data-path-scope")==n&&(o++,s=u);for(var f=o;f<e;f++)a.insertBefore(s.cloneNode(!0),s.nextElementSibling);for(var f=Math.max(1,e);f<o;f++)s=s.previousElementSibling,a.removeChild(s.nextElementSibling)}}function Q(t,e,r=!1,n=t){var i=e;let a=Object.keys(t).sort((s,u)=>u.length-s.length);for(let s of a)if(e.startsWith(s)){if(s==e){if(r)return t[s];continue}i=e.substring(s.length+1),n=t[s];break}let o=p({path:i,json:n});return r&&o?o[0]:o}function C(t,e,r,n){var l;if(!!t){var i=t;n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(t,e,r));var a=e.replace("data-path-","");if(e=="data-path-src")i=t.tagName=="IMG"?t:t.querySelector("img, video");else if(e=="data-path-href")i=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")a="innerHTML";else if(e=="data-embed-src")q(t,r);else if(e=="data-path-attributes"){let c=((l=t.getAttribute("data-attributes-keys"))==null?void 0:l.split(",").filter(Boolean))||[];for(var o in r){var s=r[o];C(t,o,typeof s=="object"&&s?JSON.stringify(s):s,n)}for(var u=0;u<c.length;u++)(r==null||!(c[u]in r))&&C(t,c[u],null,n);C(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!i){var f=String(t.getAttribute("data-path-placeholder")||i[a]);r!=null?a=="innerHTML"?i.innerHTML!=r&&(i.innerHTML=r):i.getAttribute(a)!=r&&i.setAttribute(a,r):a=="innerHTML"?i.innerHTML=f:i.removeAttribute(a)}}}function pt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,a=i.getAttribute("data-embed-src");a&&q(i,a),n.addedNodes&&n.addedNodes.forEach(o=>{o.nodeType==1&&dt(o,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function dt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];q(i,i.getAttribute("data-embed-src"))}if(e)return pt(t)}function q(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 a=r.ownerDocument.createElement("script");a.type="module",a.src=e,r.appendChild(a);break}}var lt=["data-attributes-keys","data-path-attributes","data-path-scope"];function A(t,e,r,n){var o,s,u;let i=t;if(n||(e=((o=r==null?void 0:r.processData)==null?void 0:o.call(r,i,e))||e),i.nodeType==1){let f=i.getAttribute("data-path-scope");if(f){let c=ht(i),h=Q(e,f,!1)||[];c==0&&It(i,((s=r==null?void 0:r.shouldRepeat)==null?void 0:s.call(r,i,h))===!1?1:h.length,r),e=x(F({},e),{[ft(f)]:h[c]})}let l=Array.prototype.slice.call(i.attributes).sort((c,h)=>lt.indexOf(c.name)-lt.indexOf(h.name));for(var a=0;a<l.length;a++){let{name:c,value:h}=l[a];c.startsWith("data-path")&&c!="data-path-scope"&&C(i,c,Q(e,h,!0),r),c=="data-embed-src"&&C(i,c,i.getAttribute(c),r)}}for(var a=0;a<i.children.length;a++)A(i.children[a],e,r,!0);return n||(u=r==null?void 0:r.onRender)==null||u.call(r,i,e),i}function P(t,e,r,n){var a;let i=((a=n==null?void 0:n.processTemplate)==null?void 0:a.call(n,t,e,r))||e;return t.innerHTML=i,t.classList.add("-feaas"),A(t,r,n)}function Nt(t,e){return yt(t,e||(e=document.createElement("style"))),e}function yt(t,e){return e||(e=document.createElement("style")),z(t,r=>{e.textContent=r}).then(()=>e)}function Jt(t,e){return mt(t,e||(e=document.createElement("div"))),e}function mt(t,e){return w(this,null,function*(){return e||(e=document.createElement("div")),e.childNodes.length?A(e,t.data,t):"template"in t?P(e,t.template,t.data,t):J(t,r=>P(e,r,t.data,t)).then(()=>e)})}var tt={};at(tt,{HTMLFeaasComponent:()=>W,HTMLFeaasStylesheet:()=>U});var bt=typeof HTMLElement=="undefined"?class{}:HTMLElement,W=class extends bt{constructor(){super(...arguments);this.connected=!1;this.template=null;this.data=void 0;this.isFetching=!1}static get observedAttributes(){return["data","library","component","variant","version","hostname","template"]}connectedCallback(){this.connected=!0,this.render()}disconnectedCallback(){}attributeChangedCallback(r,n,i){!this.connected||(r=="template"&&(this.template=i),r=="data"&&this.children.length>0?this.update():this.render())}update(){A(this,this.getProps().data)}setData(r){this.data=r,this.children.length>0?this.update():this.render()}getOriginal(){let r=this.getAttribute("data-path-scope");if(!!r){for(var n=this;(n=n.previousElementSibling)&&n.getAttribute("data-path-scope")==r;)var i=n;return i}}getData(){var r;if(this.data)return this.data;if(this.getAttribute("data")){let n=this.getAttribute("data");return typeof n=="string"?JSON.parse(n):{}}return((r=this.getOriginal())==null?void 0:r.getData())||{}}render(){if(this.getOriginal())return;let r=this.getProps();this.template==null?this.isFetching||r.component!=null&&r.variant!=null&&(this.isFetching=!0,J(r,n=>{this.template=n,this.isFetching=!1,P(this,this.template,r.data)}).catch(()=>{console.error(`FEAAS: Could not fetch component: ${r.component}/${r.variant}/${r.version}`)})):P(this,this.template,r.data)}getProps(){return{data:this.getData(),library:this.getAttribute("library")||void 0,component:this.getAttribute("component")||void 0,variant:this.getAttribute("variant")||void 0,version:this.getAttribute("version")||void 0,hostname:this.getAttribute("hostname")||void 0}}},U=class extends bt{constructor(){super(...arguments);this.connected=!1}static get observedAttributes(){return["library","version","hostname"]}connectedCallback(){this.connected=!0,this.render()}attributeChangedCallback(){this.connected&&this.render()}render(){let r=this.getProps();z(r,n=>{this.innerHTML="<style>"+n+"</style>"}).catch(n=>{console.error(`FEAAS: Could not fetch stylesheet for library ${r.library}`)})}getProps(){return{library:this.getAttribute("library")||void 0,version:this.getAttribute("version")||void 0,hostname:this.getAttribute("hostname")||void 0}}};typeof window!="undefined"&&!window.customElements.get("feaas-stylesheet")&&(window.customElements.define("feaas-stylesheet",U),window.customElements.define("feaas-component",W));var ne=F(F({},Z),tt);export{W as HTMLFeaasComponent,U as HTMLFeaasStylesheet,dt as autoloadScripts,ct as cleanCollectionBit,ne as default,X as fetchAndRevalidate,q as loadScript,ft as normalizeCollectionScope,pt as observeDOMElement,Q as queryScopes,Jt as renderComponent,Bt as renderComponentElement,mt as renderComponentPromise,P as renderDOMContent,A as renderDOMElement,Nt as renderStylesheet,yt as renderStylesheetPromise,C as setDOMAttribute};
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return a=u.done,u},e:function(u){o=!0,s=u},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(o)throw s}}}}var b=Object.prototype.hasOwnProperty;function k(t,e){return t=t.slice(),t.push(e),t}function T(t,e){return e=e.slice(),e.unshift(t),e}var xt=function(t){Dt(r,t);var e=Mt(r);function r(n){var i;return _t(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 r}(G(Error));function p(t,e,r,n,i){if(!(this instanceof p))try{return new p(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 a=t&&g(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 o={path:a?t.path:e};a?"json"in t&&(o.json=t.json):o.json=r;var s=this.evaluate(o);if(!s||g(s)!=="object")throw new xt(s);return s}}p.prototype.evaluate=function(t,e,r,n){var i=this,a=this.parent,o=this.parentProperty,s=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&&g(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 f=t;e=f.json,s=b.call(t,"flatten")?t.flatten:s,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,a=b.call(t,"parent")?t.parent:a,o=b.call(t,"parentProperty")?t.parentProperty:o,t=t.path}if(a=a||null,o=o||null,Array.isArray(t)&&(t=p.toPathString(t)),!(!t&&t!==""||!e)){var l=p.toPathArray(t);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;var c=this._trace(l,e,["$"],a,o,r).filter(function(h){return h&&!h.isParentSelector});return c.length?!u&&c.length===1&&!c[0].hasArrExpr?this._getPreferredOutput(c[0]):c.reduce(function(h,d){var y=i._getPreferredOutput(d);return s&&Array.isArray(y)?h=h.concat(y):h.push(y),h},[]):u?[]:void 0}};p.prototype._getPreferredOutput=function(t){var e=this.currResultType;switch(e){case"all":{var r=Array.isArray(t.path)?t.path:p.toPathArray(t.path);return t.pointer=p.toPointer(r),t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return p.toPathString(t[e]);case"pointer":return p.toPointer(t.path);default:throw new TypeError("Unknown result type")}};p.prototype._handleCallback=function(t,e,r){if(e){var n=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),e(n,r,t)}};p.prototype._trace=function(t,e,r,n,i,a,o,s){var u=this,f;if(!t.length)return f={path:r,value:e,parent:n,parentProperty:i,hasArrExpr:o},this._handleCallback(f,a,"value"),f;var l=t[0],c=t.slice(1),h=[];function d(m){Array.isArray(m)?m.forEach(function(_){h.push(_)}):h.push(m)}if((typeof l!="string"||s)&&e&&b.call(e,l))d(this._trace(c,e[l],k(r,l),e,l,a,o));else if(l==="*")this._walk(l,c,e,r,n,i,a,function(m,_,O,v,D,L,H,$){d(u._trace(T(m,O),v,D,L,H,$,!0,!0))});else if(l==="..")d(this._trace(c,e,r,n,i,a,o)),this._walk(l,c,e,r,n,i,a,function(m,_,O,v,D,L,H,$){g(v[m])==="object"&&d(u._trace(T(_,O),v[m],k(D,m),v,m,$,!0))});else{if(l==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:c,isParentSelector:!0};if(l==="~")return f={path:k(r,l),value:i,parent:n,parentProperty:null},this._handleCallback(f,a,"property"),f;if(l==="$")d(this._trace(c,e,r,null,null,a,o));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(l))d(this._slice(l,c,e,r,n,i,a));else if(l.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");this._walk(l,c,e,r,n,i,a,function(m,_,O,v,D,L,H,$){u._eval(_.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1"),v[m],m,D,L,H)&&d(u._trace(T(m,O),v,D,L,H,$,!0))})}else if(l[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");d(this._trace(T(this._eval(l,e,r[r.length-1],r.slice(0,-1),n,i),c),e,r,n,i,a,o))}else if(l[0]==="@"){var y=!1,S=l.slice(1,-2);switch(S){case"scalar":(!e||!["object","function"].includes(g(e)))&&(y=!0);break;case"boolean":case"string":case"undefined":case"function":g(e)===S&&(y=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(y=!0);break;case"number":Number.isFinite(e)&&(y=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(y=!0);break;case"object":e&&g(e)===S&&(y=!0);break;case"array":Array.isArray(e)&&(y=!0);break;case"other":y=this.currOtherTypeCallback(e,r,n,i);break;case"null":e===null&&(y=!0);break;default:throw new TypeError("Unknown value type "+S)}if(y)return f={path:r,value:e,parent:n,parentProperty:i},this._handleCallback(f,a,"value"),f}else if(l[0]==="`"&&e&&b.call(e,l.slice(1))){var V=l.slice(1);d(this._trace(c,e[V],k(r,V),e,V,a,o,!0))}else if(l.includes(",")){var gt=l.split(","),I=$t(gt),et;try{for(I.s();!(et=I.n()).done;){var vt=et.value;d(this._trace(T(vt,c),e,r,n,i,a,!0))}}catch(m){I.e(m)}finally{I.f()}}else!s&&e&&b.call(e,l)&&d(this._trace(c,e[l],k(r,l),e,l,a,o,!0))}if(this._hasParentSelector)for(var E=0;E<h.length;E++){var N=h[E];if(N&&N.isParentSelector){var M=this._trace(N.expr,e,N.path,n,i,a,o);if(Array.isArray(M)){h[E]=M[0];for(var Ft=M.length,Y=1;Y<Ft;Y++)E++,h.splice(E,0,M[Y])}else h[E]=M}}return h};p.prototype._walk=function(t,e,r,n,i,a,o,s){if(Array.isArray(r))for(var u=r.length,f=0;f<u;f++)s(f,t,e,r,n,i,a,o);else r&&g(r)==="object"&&Object.keys(r).forEach(function(l){s(l,t,e,r,n,i,a,o)})};p.prototype._slice=function(t,e,r,n,i,a,o){if(!!Array.isArray(r)){var s=r.length,u=t.split(":"),f=u[2]&&Number.parseInt(u[2])||1,l=u[0]&&Number.parseInt(u[0])||0,c=u[1]&&Number.parseInt(u[1])||s;l=l<0?Math.max(0,l+s):Math.min(s,l),c=c<0?Math.max(0,c+s):Math.min(s,c);for(var h=[],d=l;d<c;d+=f){var y=this._trace(T(d,e),r,n,i,a,o,!0);y.forEach(function(S){h.push(S)})}return h}};p.prototype._eval=function(t,e,r,n,i,a){t.includes("@parentProperty")&&(this.currSandbox._$_parentProperty=a,t=t.replace(/@parentProperty/g,"_$_parentProperty")),t.includes("@parent")&&(this.currSandbox._$_parent=i,t=t.replace(/@parent/g,"_$_parent")),t.includes("@property")&&(this.currSandbox._$_property=r,t=t.replace(/@property/g,"_$_property")),t.includes("@path")&&(this.currSandbox._$_path=p.toPathString(n.concat([r])),t=t.replace(/@path/g,"_$_path")),t.includes("@root")&&(this.currSandbox._$_root=this.json,t=t.replace(/@root/g,"_$_root")),/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/.test(t)&&(this.currSandbox._$_v=e,t=t.replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1"));try{return this.vm.runInNewContext(t,this.currSandbox)}catch(o){throw console.log(o),new Error("jsonPath: "+o.message+": "+t)}};p.cache={};p.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};p.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};p.toPathArray=function(t){var e=p.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(a,o){return"[#"+(r.push(o)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(a,o){return"['"+o.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(a,o){return";"+o.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),i=n.split(";").map(function(a){var o=a.match(/#([0-9]+)/);return!o||!o[1]?a:r[o[1]]});return e[t]=i,e[t].concat()};var kt=function(e,r,n){for(var i=e.length,a=0;a<i;a++){var o=e[a];n(o)&&r.push(e.splice(a--,1)[0])}};p.prototype.vm={runInNewContext:function(e,r){var n=Object.keys(r),i=[];kt(n,i,function(f){return typeof r[f]=="function"});var a=n.map(function(f,l){return r[f]}),o=i.reduce(function(f,l){var c=r[l].toString();return/function/.test(c)||(c="function "+c),"var "+l+"="+c+";"+f},"");e=o+e,!/(["'])use strict\1/.test(e)&&!n.includes("arguments")&&(e="var arguments = undefined;"+e),e=e.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var s=e.lastIndexOf(";"),u=s>-1?e.slice(0,s+1)+" return "+e.slice(s+1):" return "+e;return j(Function,ot(n).concat([u])).apply(void 0,ot(a))}};function X(t,e,r,n){return w(this,null,function*(){let i=new Date,a=yield fetch(t,e);if(!a.ok)throw new Error("Fetch failed");let o=new Date(a.headers.get("date"));var s=a;if(n(a,"cached"),o<i){let u=yield fetch(t+"?"+Math.random(),x(F({},e),{method:"HEAD",cache:"no-cache"}));if(u.headers.get("last-modified")!=a.headers.get("last-modified")){if(r(u)===!1)throw new Error("Response is stale");s=yield fetch(t,x(F({},e),{cache:"reload"}))}}if(r(s)===!1)throw new Error("Response is not valid");return a!==s&&n(s,"valid"),s})}function jt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,component:r,variant:n,version:i="published"}){return`${t}/components/${e}/${r}/${n}/${i}.html`}function Rt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,version:r="published"}){return`${t}/styles/${e}/${r}.css`}function J(t,e){return w(this,null,function*(){return X(jt(t),{},r=>r.headers.get("x-ms-meta-variantDeletedAt")==null,r=>{r.text().then(e)})})}function z(t,e){return w(this,null,function*(){return X(Rt(t),{},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(e)})})}function Bt(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return A(n,e),r}function ct(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function ft(t){return ct(t)+".*"}function ht(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 It(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var i=ht(t);if(i!=0)return;let a=t.parentElement;if(a!=null){e==0?t.style.display="none":t.style.display&&(t.style.display="",t.getAttribute("style")==""&&t.removeAttribute("style"));for(var o=i+1,s=t,u=t;u=u.nextElementSibling;)u.getAttribute("data-path-scope")==n&&(o++,s=u);for(var f=o;f<e;f++)a.insertBefore(s.cloneNode(!0),s.nextElementSibling);for(var f=Math.max(1,e);f<o;f++)s=s.previousElementSibling,a.removeChild(s.nextElementSibling)}}function Q(t,e,r=!1,n=t){var i=e;let a=Object.keys(t).sort((s,u)=>u.length-s.length);for(let s of a)if(e.startsWith(s)){if(s==e){if(r)return t[s];continue}i=e.substring(s.length+1),n=t[s];break}let o=p({path:i,json:n});return r&&o?o[0]:o}function C(t,e,r,n){var l;if(!!t){var i=t;n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(t,e,r));var a=e.replace("data-path-","");if(e=="data-path-src")i=t.tagName=="IMG"?t:t.querySelector("img, video");else if(e=="data-path-href")i=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")a="innerHTML";else if(e=="data-embed-src")q(t,r);else if(e=="data-path-attributes"){let c=((l=t.getAttribute("data-attributes-keys"))==null?void 0:l.split(",").filter(Boolean))||[];for(var o in r){var s=r[o];C(t,o,typeof s=="object"&&s?JSON.stringify(s):s,n)}for(var u=0;u<c.length;u++)(r==null||!(c[u]in r))&&C(t,c[u],null,n);C(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!i){var f=String(t.getAttribute("data-path-placeholder")||i[a]);r!=null?a=="innerHTML"?i.innerHTML!=r&&(i.innerHTML=r):i.getAttribute(a)!=r&&i.setAttribute(a,r):a=="innerHTML"?i.innerHTML=f:i.removeAttribute(a)}}}function pt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,a=i.getAttribute("data-embed-src");a&&q(i,a),n.addedNodes&&n.addedNodes.forEach(o=>{o.nodeType==1&&dt(o,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function dt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];q(i,i.getAttribute("data-embed-src"))}if(e)return pt(t)}function q(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 a=r.ownerDocument.createElement("script");a.type="module",a.src=e,r.appendChild(a);break}}var lt=["data-attributes-keys","data-path-attributes","data-path-scope"];function A(t,e,r,n){var o,s,u;let i=t;if(n||(e=((o=r==null?void 0:r.processData)==null?void 0:o.call(r,i,e))||e),i.nodeType==1){let f=i.getAttribute("data-path-scope");if(f){let c=ht(i),h=Q(e,f,!1)||[];c==0&&It(i,((s=r==null?void 0:r.shouldRepeat)==null?void 0:s.call(r,i,h))===!1?1:h.length,r),e=x(F({},e),{[ft(f)]:h[c]})}let l=Array.prototype.slice.call(i.attributes).sort((c,h)=>lt.indexOf(c.name)-lt.indexOf(h.name));for(var a=0;a<l.length;a++){let{name:c,value:h}=l[a];c.startsWith("data-path")&&c!="data-path-scope"&&C(i,c,Q(e,h,!0),r),c=="data-embed-src"&&C(i,c,i.getAttribute(c),r)}}for(var a=0;a<i.children.length;a++)A(i.children[a],e,r,!0);return n||(u=r==null?void 0:r.onRender)==null||u.call(r,i,e),i}function P(t,e,r,n){var a;let i=((a=n==null?void 0:n.processTemplate)==null?void 0:a.call(n,t,e,r))||e;return t.innerHTML=i,t.classList.add("-feaas"),A(t,r,n)}function Nt(t,e){return yt(t,e||(e=document.createElement("style"))),e}function yt(t,e){return e||(e=document.createElement("style")),z(t,r=>{e.textContent=r}).then(()=>e)}function Jt(t,e){return mt(t,e||(e=document.createElement("div"))),e}function mt(t,e){return w(this,null,function*(){return e||(e=document.createElement("div")),e.childNodes.length?A(e,t.data,t):"template"in t?P(e,t.template,t.data,t):J(t,r=>P(e,r,t.data,t)).then(()=>e)})}var tt={};at(tt,{HTMLFeaasComponent:()=>W,HTMLFeaasStylesheet:()=>U});var bt=typeof HTMLElement=="undefined"?class{}:HTMLElement,W=class extends bt{constructor(){super(...arguments);this.connected=!1;this.template=null;this.data=void 0;this.isFetching=!1}static get observedAttributes(){return["data","library","component","variant","version","hostname","template"]}connectedCallback(){this.connected=!0,this.render()}disconnectedCallback(){}attributeChangedCallback(r,n,i){!this.connected||(r=="template"&&(this.template=i),r=="data"&&this.children.length>0?this.update():this.render())}update(){A(this,this.getProps().data)}setData(r){this.data=r,this.children.length>0?this.update():this.render()}getOriginal(){let r=this.getAttribute("data-path-scope");if(!!r){for(var n=this;(n=n.previousElementSibling)&&n.getAttribute("data-path-scope")==r;)var i=n;return i}}getData(){var r;if(this.data)return this.data;if(this.getAttribute("data")){let n=this.getAttribute("data");return typeof n=="string"?JSON.parse(n):{}}return((r=this.getOriginal())==null?void 0:r.getData())||{}}render(){if(this.getOriginal())return;let r=this.getProps();this.template==null?this.isFetching||r.component!=null&&r.variant!=null&&(this.isFetching=!0,J(r,n=>{this.template=n,this.isFetching=!1,P(this,this.template,r.data)}).catch(()=>{console.error(`FEAAS: Could not fetch component: ${r.component}/${r.variant}/${r.version}`)})):P(this,this.template,r.data)}getProps(){return{data:this.getData(),library:this.getAttribute("library")||void 0,component:this.getAttribute("component")||void 0,variant:this.getAttribute("variant")||void 0,version:this.getAttribute("version")||void 0,hostname:this.getAttribute("hostname")||void 0}}},U=class extends bt{constructor(){super(...arguments);this.connected=!1}static get observedAttributes(){return["library","version","hostname"]}connectedCallback(){this.connected=!0,this.render()}attributeChangedCallback(){this.connected&&this.render()}render(){let r=this.getProps();z(r,n=>{this.innerHTML="<style>"+n+"</style>"}).catch(n=>{console.error(`FEAAS: Could not fetch stylesheet for library ${r.library}`)})}getProps(){return{library:this.getAttribute("library")||void 0,version:this.getAttribute("version")||void 0,hostname:this.getAttribute("hostname")||void 0}}};typeof window!="undefined"&&!window.customElements.get("feaas-stylesheet")&&(window.customElements.define("feaas-stylesheet",U),window.customElements.define("feaas-component",W));var ne=F(F({},Z),tt);export{W as HTMLFeaasComponent,U as HTMLFeaasStylesheet,dt as autoloadScripts,ct as cleanCollectionBit,ne as default,X as fetchAndRevalidate,q as loadScript,ft as normalizeCollectionScope,pt as observeDOMElement,Q as queryScopes,Jt as renderComponent,Bt as renderComponentElement,mt as renderComponentPromise,P as renderDOMContent,A as renderDOMElement,Nt as renderStylesheet,yt as renderStylesheetPromise,C as setDOMAttribute};

@@ -1,3 +0,3 @@

var it=Object.defineProperty,At=Object.defineProperties;var St=Object.getOwnPropertyDescriptors;var nt=Object.getOwnPropertySymbols;var wt=Object.prototype.hasOwnProperty,_t=Object.prototype.propertyIsEnumerable;var at=(t,e,r)=>e in t?it(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e||(e={}))wt.call(e,r)&&at(t,r,e[r]);if(nt)for(var r of nt(e))_t.call(e,r)&&at(t,r,e[r]);return t},w=(t,e)=>At(t,St(e));var ot=(t,e)=>{for(var r in e)it(t,r,{get:e[r],enumerable:!0})};var _=(t,e,r)=>new Promise((n,a)=>{var i=u=>{try{s(r.next(u))}catch(f){a(f)}},o=u=>{try{s(r.throw(u))}catch(f){a(f)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(i,o);s((r=r.apply(t,e)).next())});import v from"react";function K(t,e,r,n){return _(this,null,function*(){let a=new Date,i=yield fetch(t,e);if(!i.ok)throw new Error("Fetch failed");let o=new Date(i.headers.get("date"));var s=i;if(n(i,"cached"),o<a){let u=yield fetch(t+"?"+Math.random(),w(A({},e),{method:"HEAD",cache:"no-cache"}));if(u.headers.get("last-modified")!=i.headers.get("last-modified")){if(r(u)===!1)throw new Error("Response is stale");s=yield fetch(t,w(A({},e),{cache:"reload"}))}}if(r(s)===!1)throw new Error("Response is not valid");return i!==s&&n(s,"valid"),s})}function Dt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,component:r,variant:n,version:a="published"}){return`${t}/components/${r}/variants/${n}/${a}.html`}function Tt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,version:r="published"}){return`${t}/styles/${e}/${r}.css`}function M(t,e){return _(this,null,function*(){return K(Dt(t),{},r=>r.headers.get("x-ms-meta-variantDeletedAt")==null,r=>{r.text().then(e)})})}function P(t,e){return _(this,null,function*(){return K(Tt(t),{},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(e)})})}var tt={};ot(tt,{autoloadScripts:()=>yt,cleanCollectionBit:()=>ft,loadScript:()=>W,normalizeCollectionScope:()=>ht,observeDOMElement:()=>pt,queryScopes:()=>Z,renderComponent:()=>zt,renderComponentElement:()=>Nt,renderComponentPromise:()=>bt,renderDOMContent:()=>$,renderDOMElement:()=>E,renderStylesheet:()=>Jt,renderStylesheetPromise:()=>mt,setDOMAttribute:()=>L});function g(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?g=function(e){return typeof e}:g=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(t)}function Ct(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Mt(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}}),e&&J(t,e)}function I(t){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},I(t)}function J(t,e){return J=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},J(t,e)}function ut(){if(typeof Reflect=="undefined"||!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(t){return!1}}function N(t,e,r){return ut()?N=Reflect.construct:N=function(a,i,o){var s=[null];s.push.apply(s,i);var u=Function.bind.apply(a,s),f=new u;return o&&J(f,o.prototype),f},N.apply(null,arguments)}function Pt(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function X(t){var e=typeof Map=="function"?new Map:void 0;return X=function(n){if(n===null||!Pt(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(n))return e.get(n);e.set(n,a)}function a(){return N(n,arguments,I(this).constructor)}return a.prototype=Object.create(n.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),J(a,n)},X(t)}function Ot(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Lt(t,e){return e&&(typeof e=="object"||typeof e=="function")?e:Ot(t)}function $t(t){var e=ut();return function(){var n=I(t),a;if(e){var i=I(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return Lt(this,a)}}function st(t){return Ht(t)||xt(t)||lt(t)||kt()}function Ht(t){if(Array.isArray(t))return Q(t)}function xt(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function lt(t,e){if(!!t){if(typeof t=="string")return Q(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 Q(t,e)}}function Q(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 kt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
var it=Object.defineProperty,At=Object.defineProperties;var St=Object.getOwnPropertyDescriptors;var nt=Object.getOwnPropertySymbols;var wt=Object.prototype.hasOwnProperty,_t=Object.prototype.propertyIsEnumerable;var at=(t,e,r)=>e in t?it(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e||(e={}))wt.call(e,r)&&at(t,r,e[r]);if(nt)for(var r of nt(e))_t.call(e,r)&&at(t,r,e[r]);return t},w=(t,e)=>At(t,St(e));var ot=(t,e)=>{for(var r in e)it(t,r,{get:e[r],enumerable:!0})};var _=(t,e,r)=>new Promise((n,a)=>{var i=u=>{try{s(r.next(u))}catch(f){a(f)}},o=u=>{try{s(r.throw(u))}catch(f){a(f)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(i,o);s((r=r.apply(t,e)).next())});import v from"react";function K(t,e,r,n){return _(this,null,function*(){let a=new Date,i=yield fetch(t,e);if(!i.ok)throw new Error("Fetch failed");let o=new Date(i.headers.get("date"));var s=i;if(n(i,"cached"),o<a){let u=yield fetch(t+"?"+Math.random(),w(A({},e),{method:"HEAD",cache:"no-cache"}));if(u.headers.get("last-modified")!=i.headers.get("last-modified")){if(r(u)===!1)throw new Error("Response is stale");s=yield fetch(t,w(A({},e),{cache:"reload"}))}}if(r(s)===!1)throw new Error("Response is not valid");return i!==s&&n(s,"valid"),s})}function Dt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,component:r,variant:n,version:a="published"}){return`${t}/components/${e}/${r}/${n}/${a}.html`}function Tt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,version:r="published"}){return`${t}/styles/${e}/${r}.css`}function M(t,e){return _(this,null,function*(){return K(Dt(t),{},r=>r.headers.get("x-ms-meta-variantDeletedAt")==null,r=>{r.text().then(e)})})}function P(t,e){return _(this,null,function*(){return K(Tt(t),{},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(e)})})}var tt={};ot(tt,{autoloadScripts:()=>yt,cleanCollectionBit:()=>ft,loadScript:()=>W,normalizeCollectionScope:()=>ht,observeDOMElement:()=>pt,queryScopes:()=>Z,renderComponent:()=>zt,renderComponentElement:()=>Nt,renderComponentPromise:()=>bt,renderDOMContent:()=>$,renderDOMElement:()=>E,renderStylesheet:()=>Jt,renderStylesheetPromise:()=>mt,setDOMAttribute:()=>L});function g(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?g=function(e){return typeof e}:g=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(t)}function Ct(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Mt(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}}),e&&J(t,e)}function I(t){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},I(t)}function J(t,e){return J=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},J(t,e)}function ut(){if(typeof Reflect=="undefined"||!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(t){return!1}}function N(t,e,r){return ut()?N=Reflect.construct:N=function(a,i,o){var s=[null];s.push.apply(s,i);var u=Function.bind.apply(a,s),f=new u;return o&&J(f,o.prototype),f},N.apply(null,arguments)}function Pt(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function X(t){var e=typeof Map=="function"?new Map:void 0;return X=function(n){if(n===null||!Pt(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(n))return e.get(n);e.set(n,a)}function a(){return N(n,arguments,I(this).constructor)}return a.prototype=Object.create(n.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),J(a,n)},X(t)}function Ot(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Lt(t,e){return e&&(typeof e=="object"||typeof e=="function")?e:Ot(t)}function $t(t){var e=ut();return function(){var n=I(t),a;if(e){var i=I(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return Lt(this,a)}}function st(t){return Ht(t)||xt(t)||lt(t)||kt()}function Ht(t){if(Array.isArray(t))return Q(t)}function xt(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function lt(t,e){if(!!t){if(typeof t=="string")return Q(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 Q(t,e)}}function Q(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 kt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rt(t,e){var r=typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=lt(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return i=u.done,u},e:function(u){o=!0,s=u},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(o)throw s}}}}var b=Object.prototype.hasOwnProperty;function B(t,e){return t=t.slice(),t.push(e),t}function O(t,e){return e=e.slice(),e.unshift(t),e}var jt=function(t){Mt(r,t);var e=$t(r);function r(n){var a;return Ct(this,r),a=e.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),a.avoidNew=!0,a.value=n,a.name="NewError",a}return r}(X(Error));function d(t,e,r,n,a){if(!(this instanceof d))try{return new d(t,e,r,n,a)}catch(u){if(!u.avoidNew)throw u;return u.value}typeof t=="string"&&(a=n,n=r,r=e,e=t,t=null);var i=t&&g(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||a||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){var o={path:i?t.path:e};i?"json"in t&&(o.json=t.json):o.json=r;var s=this.evaluate(o);if(!s||g(s)!=="object")throw new jt(s);return s}}d.prototype.evaluate=function(t,e,r,n){var a=this,i=this.parent,o=this.parentProperty,s=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&&g(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 f=t;e=f.json,s=b.call(t,"flatten")?t.flatten:s,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,i=b.call(t,"parent")?t.parent:i,o=b.call(t,"parentProperty")?t.parentProperty:o,t=t.path}if(i=i||null,o=o||null,Array.isArray(t)&&(t=d.toPathString(t)),!(!t&&t!==""||!e)){var l=d.toPathArray(t);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;var c=this._trace(l,e,["$"],i,o,r).filter(function(h){return h&&!h.isParentSelector});return c.length?!u&&c.length===1&&!c[0].hasArrExpr?this._getPreferredOutput(c[0]):c.reduce(function(h,p){var y=a._getPreferredOutput(p);return s&&Array.isArray(y)?h=h.concat(y):h.push(y),h},[]):u?[]:void 0}};d.prototype._getPreferredOutput=function(t){var e=this.currResultType;switch(e){case"all":{var r=Array.isArray(t.path)?t.path:d.toPathArray(t.path);return t.pointer=d.toPointer(r),t.path=typeof t.path=="string"?t.path:d.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return d.toPathString(t[e]);case"pointer":return d.toPointer(t.path);default:throw new TypeError("Unknown result type")}};d.prototype._handleCallback=function(t,e,r){if(e){var n=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:d.toPathString(t.path),e(n,r,t)}};d.prototype._trace=function(t,e,r,n,a,i,o,s){var u=this,f;if(!t.length)return f={path:r,value:e,parent:n,parentProperty:a,hasArrExpr:o},this._handleCallback(f,i,"value"),f;var l=t[0],c=t.slice(1),h=[];function p(m){Array.isArray(m)?m.forEach(function(T){h.push(T)}):h.push(m)}if((typeof l!="string"||s)&&e&&b.call(e,l))p(this._trace(c,e[l],B(r,l),e,l,i,o));else if(l==="*")this._walk(l,c,e,r,n,a,i,function(m,T,x,F,C,k,R,j){p(u._trace(O(m,x),F,C,k,R,j,!0,!0))});else if(l==="..")p(this._trace(c,e,r,n,a,i,o)),this._walk(l,c,e,r,n,a,i,function(m,T,x,F,C,k,R,j){g(F[m])==="object"&&p(u._trace(O(T,x),F[m],B(C,m),F,m,j,!0))});else{if(l==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:c,isParentSelector:!0};if(l==="~")return f={path:B(r,l),value:a,parent:n,parentProperty:null},this._handleCallback(f,i,"property"),f;if(l==="$")p(this._trace(c,e,r,null,null,i,o));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(l))p(this._slice(l,c,e,r,n,a,i));else if(l.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");this._walk(l,c,e,r,n,a,i,function(m,T,x,F,C,k,R,j){u._eval(T.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1"),F[m],m,C,k,R)&&p(u._trace(O(m,x),F,C,k,R,j,!0))})}else if(l[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");p(this._trace(O(this._eval(l,e,r[r.length-1],r.slice(0,-1),n,a),c),e,r,n,a,i,o))}else if(l[0]==="@"){var y=!1,D=l.slice(1,-2);switch(D){case"scalar":(!e||!["object","function"].includes(g(e)))&&(y=!0);break;case"boolean":case"string":case"undefined":case"function":g(e)===D&&(y=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(y=!0);break;case"number":Number.isFinite(e)&&(y=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(y=!0);break;case"object":e&&g(e)===D&&(y=!0);break;case"array":Array.isArray(e)&&(y=!0);break;case"other":y=this.currOtherTypeCallback(e,r,n,a);break;case"null":e===null&&(y=!0);break;default:throw new TypeError("Unknown value type "+D)}if(y)return f={path:r,value:e,parent:n,parentProperty:a},this._handleCallback(f,i,"value"),f}else if(l[0]==="`"&&e&&b.call(e,l.slice(1))){var Y=l.slice(1);p(this._trace(c,e[Y],B(r,Y),e,Y,i,o,!0))}else if(l.includes(",")){var vt=l.split(","),z=Rt(vt),rt;try{for(z.s();!(rt=z.n()).done;){var Et=rt.value;p(this._trace(O(Et,c),e,r,n,a,i,!0))}}catch(m){z.e(m)}finally{z.f()}}else!s&&e&&b.call(e,l)&&p(this._trace(c,e[l],B(r,l),e,l,i,o,!0))}if(this._hasParentSelector)for(var S=0;S<h.length;S++){var q=h[S];if(q&&q.isParentSelector){var H=this._trace(q.expr,e,q.path,n,a,i,o);if(Array.isArray(H)){h[S]=H[0];for(var Ft=H.length,G=1;G<Ft;G++)S++,h.splice(S,0,H[G])}else h[S]=H}}return h};d.prototype._walk=function(t,e,r,n,a,i,o,s){if(Array.isArray(r))for(var u=r.length,f=0;f<u;f++)s(f,t,e,r,n,a,i,o);else r&&g(r)==="object"&&Object.keys(r).forEach(function(l){s(l,t,e,r,n,a,i,o)})};d.prototype._slice=function(t,e,r,n,a,i,o){if(!!Array.isArray(r)){var s=r.length,u=t.split(":"),f=u[2]&&Number.parseInt(u[2])||1,l=u[0]&&Number.parseInt(u[0])||0,c=u[1]&&Number.parseInt(u[1])||s;l=l<0?Math.max(0,l+s):Math.min(s,l),c=c<0?Math.max(0,c+s):Math.min(s,c);for(var h=[],p=l;p<c;p+=f){var y=this._trace(O(p,e),r,n,a,i,o,!0);y.forEach(function(D){h.push(D)})}return h}};d.prototype._eval=function(t,e,r,n,a,i){t.includes("@parentProperty")&&(this.currSandbox._$_parentProperty=i,t=t.replace(/@parentProperty/g,"_$_parentProperty")),t.includes("@parent")&&(this.currSandbox._$_parent=a,t=t.replace(/@parent/g,"_$_parent")),t.includes("@property")&&(this.currSandbox._$_property=r,t=t.replace(/@property/g,"_$_property")),t.includes("@path")&&(this.currSandbox._$_path=d.toPathString(n.concat([r])),t=t.replace(/@path/g,"_$_path")),t.includes("@root")&&(this.currSandbox._$_root=this.json,t=t.replace(/@root/g,"_$_root")),/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/.test(t)&&(this.currSandbox._$_v=e,t=t.replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1"));try{return this.vm.runInNewContext(t,this.currSandbox)}catch(o){throw console.log(o),new Error("jsonPath: "+o.message+": "+t)}};d.cache={};d.toPathString=function(t){for(var e=t,r=e.length,n="$",a=1;a<r;a++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[a])||(n+=/^[\*0-9]+$/.test(e[a])?"["+e[a]+"]":"['"+e[a]+"']");return n};d.toPointer=function(t){for(var e=t,r=e.length,n="",a=1;a<r;a++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[a])||(n+="/"+e[a].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return n};d.toPathArray=function(t){var e=d.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(i,o){return"[#"+(r.push(o)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(i,o){return"['"+o.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(i,o){return";"+o.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),a=n.split(";").map(function(i){var o=i.match(/#([0-9]+)/);return!o||!o[1]?i:r[o[1]]});return e[t]=a,e[t].concat()};var Bt=function(e,r,n){for(var a=e.length,i=0;i<a;i++){var o=e[i];n(o)&&r.push(e.splice(i--,1)[0])}};d.prototype.vm={runInNewContext:function(e,r){var n=Object.keys(r),a=[];Bt(n,a,function(f){return typeof r[f]=="function"});var i=n.map(function(f,l){return r[f]}),o=a.reduce(function(f,l){var c=r[l].toString();return/function/.test(c)||(c="function "+c),"var "+l+"="+c+";"+f},"");e=o+e,!/(["'])use strict\1/.test(e)&&!n.includes("arguments")&&(e="var arguments = undefined;"+e),e=e.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var s=e.lastIndexOf(";"),u=s>-1?e.slice(0,s+1)+" return "+e.slice(s+1):" return "+e;return N(Function,st(n).concat([u])).apply(void 0,st(i))}};function Nt(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return E(n,e),r}function ft(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function ht(t){return ft(t)+".*"}function dt(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 It(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var a=dt(t);if(a!=0)return;let i=t.parentElement;if(i!=null){e==0?t.style.display="none":t.style.display&&(t.style.display="",t.getAttribute("style")==""&&t.removeAttribute("style"));for(var o=a+1,s=t,u=t;u=u.nextElementSibling;)u.getAttribute("data-path-scope")==n&&(o++,s=u);for(var f=o;f<e;f++)i.insertBefore(s.cloneNode(!0),s.nextElementSibling);for(var f=Math.max(1,e);f<o;f++)s=s.previousElementSibling,i.removeChild(s.nextElementSibling)}}function Z(t,e,r=!1,n=t){var a=e;let i=Object.keys(t).sort((s,u)=>u.length-s.length);for(let s of i)if(e.startsWith(s)){if(s==e){if(r)return t[s];continue}a=e.substring(s.length+1),n=t[s];break}let o=d({path:a,json:n});return r&&o?o[0]:o}function L(t,e,r,n){var l;if(!!t){var a=t;n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(t,e,r));var i=e.replace("data-path-","");if(e=="data-path-src")a=t.tagName=="IMG"?t:t.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")i="innerHTML";else if(e=="data-embed-src")W(t,r);else if(e=="data-path-attributes"){let c=((l=t.getAttribute("data-attributes-keys"))==null?void 0:l.split(",").filter(Boolean))||[];for(var o in r){var s=r[o];L(t,o,typeof s=="object"&&s?JSON.stringify(s):s,n)}for(var u=0;u<c.length;u++)(r==null||!(c[u]in r))&&L(t,c[u],null,n);L(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!a){var f=String(t.getAttribute("data-path-placeholder")||a[i]);r!=null?i=="innerHTML"?a.innerHTML!=r&&(a.innerHTML=r):a.getAttribute(i)!=r&&a.setAttribute(i,r):i=="innerHTML"?a.innerHTML=f:a.removeAttribute(i)}}}function pt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let a=n.target,i=a.getAttribute("data-embed-src");i&&W(a,i),n.addedNodes&&n.addedNodes.forEach(o=>{o.nodeType==1&&yt(o,!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 a=r[n];W(a,a.getAttribute("data-embed-src"))}if(e)return pt(t)}function W(t,e){for(var r=t;r;r=r.parentElement)if(!r.parentElement){let a=r.querySelectorAll("script");for(var n=0;n<a.length;n++)if(a[n].getAttribute("src")==e)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let i=r.ownerDocument.createElement("script");i.type="module",i.src=e,r.appendChild(i);break}}var ct=["data-attributes-keys","data-path-attributes","data-path-scope"];function E(t,e,r,n){var o,s,u;let a=t;if(n||(e=((o=r==null?void 0:r.processData)==null?void 0:o.call(r,a,e))||e),a.nodeType==1){let f=a.getAttribute("data-path-scope");if(f){let c=dt(a),h=Z(e,f,!1)||[];c==0&&It(a,((s=r==null?void 0:r.shouldRepeat)==null?void 0:s.call(r,a,h))===!1?1:h.length,r),e=w(A({},e),{[ht(f)]:h[c]})}let l=Array.prototype.slice.call(a.attributes).sort((c,h)=>ct.indexOf(c.name)-ct.indexOf(h.name));for(var i=0;i<l.length;i++){let{name:c,value:h}=l[i];c.startsWith("data-path")&&c!="data-path-scope"&&L(a,c,Z(e,h,!0),r),c=="data-embed-src"&&L(a,c,a.getAttribute(c),r)}}for(var i=0;i<a.children.length;i++)E(a.children[i],e,r,!0);return n||(u=r==null?void 0:r.onRender)==null||u.call(r,a,e),a}function $(t,e,r,n){var i;let a=((i=n==null?void 0:n.processTemplate)==null?void 0:i.call(n,t,e,r))||e;return t.innerHTML=a,t.classList.add("-feaas"),E(t,r,n)}function Jt(t,e){return mt(t,e||(e=document.createElement("style"))),e}function mt(t,e){return e||(e=document.createElement("style")),P(t,r=>{e.textContent=r}).then(()=>e)}function zt(t,e){return bt(t,e||(e=document.createElement("div"))),e}function bt(t,e){return _(this,null,function*(){return e||(e=document.createElement("div")),e.childNodes.length?E(e,t.data,t):"template"in t?$(e,t.template,t.data,t):M(t,r=>$(e,r,t.data,t)).then(()=>e)})}var et={};ot(et,{HTMLFeaasComponent:()=>U,HTMLFeaasStylesheet:()=>V});var gt=typeof HTMLElement=="undefined"?class{}:HTMLElement,U=class extends gt{constructor(){super(...arguments);this.connected=!1;this.template=null;this.data=void 0;this.isFetching=!1}static get observedAttributes(){return["data","library","component","variant","version","hostname","template"]}connectedCallback(){this.connected=!0,this.render()}disconnectedCallback(){}attributeChangedCallback(r,n,a){!this.connected||(r=="template"&&(this.template=a),r=="data"&&this.children.length>0?this.update():this.render())}update(){E(this,this.getProps().data)}setData(r){this.data=r,this.children.length>0?this.update():this.render()}getOriginal(){let r=this.getAttribute("data-path-scope");if(!!r){for(var n=this;(n=n.previousElementSibling)&&n.getAttribute("data-path-scope")==r;)var a=n;return a}}getData(){var r;if(this.data)return this.data;if(this.getAttribute("data")){let n=this.getAttribute("data");return typeof n=="string"?JSON.parse(n):{}}return((r=this.getOriginal())==null?void 0:r.getData())||{}}render(){if(this.getOriginal())return;let r=this.getProps();this.template==null?this.isFetching||r.component!=null&&r.variant!=null&&(this.isFetching=!0,M(r,n=>{this.template=n,this.isFetching=!1,$(this,this.template,r.data)}).catch(()=>{console.error(`FEAAS: Could not fetch component: ${r.component}/${r.variant}/${r.version}`)})):$(this,this.template,r.data)}getProps(){return{data:this.getData(),library:this.getAttribute("library")||void 0,component:this.getAttribute("component")||void 0,variant:this.getAttribute("variant")||void 0,version:this.getAttribute("version")||void 0,hostname:this.getAttribute("hostname")||void 0}}},V=class extends gt{constructor(){super(...arguments);this.connected=!1}static get observedAttributes(){return["library","version","hostname"]}connectedCallback(){this.connected=!0,this.render()}attributeChangedCallback(){this.connected&&this.render()}render(){let r=this.getProps();P(r,n=>{this.innerHTML="<style>"+n+"</style>"}).catch(n=>{console.error(`FEAAS: Could not fetch stylesheet for library ${r.library}`)})}getProps(){return{library:this.getAttribute("library")||void 0,version:this.getAttribute("version")||void 0,hostname:this.getAttribute("hostname")||void 0}}};typeof window!="undefined"&&!window.customElements.get("feaas-stylesheet")&&(window.customElements.define("feaas-stylesheet",V),window.customElements.define("feaas-component",U));function qt(t){let[e,r]=v.useState("template"in t?t.template:null),n=t.data,a=v.useRef(null);return v.useEffect(()=>{e==null&&!("template"in t)&&M(t,r).catch(()=>{console.error(`FEAAS: Could not fetch component: ${t.library}/${t.component}/${t.variant}/${t.version}`)})},"template"in t?[t.template,null,null,null]:[t.library,t.component,t.variant,t.version,t.hostname]),v.useEffect(()=>{a.current&&e&&(a.current.innerHTML=e)},[a,e]),v.useEffect(()=>{e&&a.current&&E(a.current,n||{},t)},[a,e,n]),v.createElement("div",{ref:a,className:"-feaas"})}function Wt(t){let e=v.useRef(null),[r,n]=v.useState("");return v.useEffect(()=>{P(t,n).catch(a=>{console.error(`FEAAS: Could not fetch stylesheet for library ${t.library}`)})},[t.hostname,t.library]),v.createElement("style",{ref:e,rel:"stylesheet",className:"-stylesheet","data-library-id":t.library},[r])}var fe=w(A(A({},tt),et),{Stylesheet:Wt,Component:qt});export{qt as Component,U as HTMLFeaasComponent,V as HTMLFeaasStylesheet,Wt as Stylesheet,yt as autoloadScripts,ft as cleanCollectionBit,fe as default,M as fetchComponent,P as fetchStylesheet,Dt as getComponentURL,Tt as getStylesheetURL,W as loadScript,ht as normalizeCollectionScope,pt as observeDOMElement,Z as queryScopes,zt as renderComponent,Nt as renderComponentElement,bt as renderComponentPromise,$ as renderDOMContent,E as renderDOMElement,Jt as renderStylesheet,mt as renderStylesheetPromise,L as setDOMAttribute};

@@ -805,3 +805,3 @@ var __defProp = Object.defineProperty;

}) {
return `${hostname}/components/${component}/variants/${variant}/${version}.html`;
return `${hostname}/components/${library}/${component}/${variant}/${version}.html`;
}

@@ -808,0 +808,0 @@ function getStylesheetURL({

@@ -90,3 +90,3 @@ var __defProp = Object.defineProperty;

}) {
return `${hostname}/components/${component}/variants/${variant}/${version}.html`;
return `${hostname}/components/${library}/${component}/${variant}/${version}.html`;
}

@@ -93,0 +93,0 @@ function getStylesheetURL({

var it=Object.defineProperty,Et=Object.defineProperties;var wt=Object.getOwnPropertyDescriptors;var rt=Object.getOwnPropertySymbols;var At=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable;var nt=(t,e,r)=>e in t?it(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,F=(t,e)=>{for(var r in e||(e={}))At.call(e,r)&&nt(t,r,e[r]);if(rt)for(var r of rt(e))St.call(e,r)&&nt(t,r,e[r]);return t},x=(t,e)=>Et(t,wt(e));var at=(t,e)=>{for(var r in e)it(t,r,{get:e[r],enumerable:!0})};var w=(t,e,r)=>new Promise((n,i)=>{var a=u=>{try{s(r.next(u))}catch(f){i(f)}},o=u=>{try{s(r.throw(u))}catch(f){i(f)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(a,o);s((r=r.apply(t,e)).next())});var Z={};at(Z,{autoloadScripts:()=>dt,cleanCollectionBit:()=>ct,loadScript:()=>q,normalizeCollectionScope:()=>ft,observeDOMElement:()=>pt,queryScopes:()=>Q,renderComponent:()=>Jt,renderComponentElement:()=>Bt,renderComponentPromise:()=>mt,renderDOMContent:()=>P,renderDOMElement:()=>A,renderStylesheet:()=>Nt,renderStylesheetPromise:()=>yt,setDOMAttribute:()=>C});function g(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?g=function(e){return typeof e}:g=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(t)}function _t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Dt(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}}),e&&B(t,e)}function R(t){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},R(t)}function B(t,e){return B=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},B(t,e)}function st(){if(typeof Reflect=="undefined"||!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(t){return!1}}function j(t,e,r){return st()?j=Reflect.construct:j=function(i,a,o){var s=[null];s.push.apply(s,a);var u=Function.bind.apply(i,s),f=new u;return o&&B(f,o.prototype),f},j.apply(null,arguments)}function Tt(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function G(t){var e=typeof Map=="function"?new Map:void 0;return G=function(n){if(n===null||!Tt(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return j(n,arguments,R(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),B(i,n)},G(t)}function Ct(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Pt(t,e){return e&&(typeof e=="object"||typeof e=="function")?e:Ct(t)}function Mt(t){var e=st();return function(){var n=R(t),i;if(e){var a=R(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return Pt(this,i)}}function ot(t){return Ot(t)||Lt(t)||ut(t)||Ht()}function Ot(t){if(Array.isArray(t))return K(t)}function Lt(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function ut(t,e){if(!!t){if(typeof t=="string")return K(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 K(t,e)}}function K(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 Ht(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $t(t,e){var r=typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=ut(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.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return a=u.done,u},e:function(u){o=!0,s=u},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(o)throw s}}}}var b=Object.prototype.hasOwnProperty;function k(t,e){return t=t.slice(),t.push(e),t}function T(t,e){return e=e.slice(),e.unshift(t),e}var xt=function(t){Dt(r,t);var e=Mt(r);function r(n){var i;return _t(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 r}(G(Error));function p(t,e,r,n,i){if(!(this instanceof p))try{return new p(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 a=t&&g(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 o={path:a?t.path:e};a?"json"in t&&(o.json=t.json):o.json=r;var s=this.evaluate(o);if(!s||g(s)!=="object")throw new xt(s);return s}}p.prototype.evaluate=function(t,e,r,n){var i=this,a=this.parent,o=this.parentProperty,s=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&&g(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 f=t;e=f.json,s=b.call(t,"flatten")?t.flatten:s,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,a=b.call(t,"parent")?t.parent:a,o=b.call(t,"parentProperty")?t.parentProperty:o,t=t.path}if(a=a||null,o=o||null,Array.isArray(t)&&(t=p.toPathString(t)),!(!t&&t!==""||!e)){var l=p.toPathArray(t);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;var c=this._trace(l,e,["$"],a,o,r).filter(function(h){return h&&!h.isParentSelector});return c.length?!u&&c.length===1&&!c[0].hasArrExpr?this._getPreferredOutput(c[0]):c.reduce(function(h,d){var y=i._getPreferredOutput(d);return s&&Array.isArray(y)?h=h.concat(y):h.push(y),h},[]):u?[]:void 0}};p.prototype._getPreferredOutput=function(t){var e=this.currResultType;switch(e){case"all":{var r=Array.isArray(t.path)?t.path:p.toPathArray(t.path);return t.pointer=p.toPointer(r),t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return p.toPathString(t[e]);case"pointer":return p.toPointer(t.path);default:throw new TypeError("Unknown result type")}};p.prototype._handleCallback=function(t,e,r){if(e){var n=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),e(n,r,t)}};p.prototype._trace=function(t,e,r,n,i,a,o,s){var u=this,f;if(!t.length)return f={path:r,value:e,parent:n,parentProperty:i,hasArrExpr:o},this._handleCallback(f,a,"value"),f;var l=t[0],c=t.slice(1),h=[];function d(m){Array.isArray(m)?m.forEach(function(_){h.push(_)}):h.push(m)}if((typeof l!="string"||s)&&e&&b.call(e,l))d(this._trace(c,e[l],k(r,l),e,l,a,o));else if(l==="*")this._walk(l,c,e,r,n,i,a,function(m,_,O,v,D,L,H,$){d(u._trace(T(m,O),v,D,L,H,$,!0,!0))});else if(l==="..")d(this._trace(c,e,r,n,i,a,o)),this._walk(l,c,e,r,n,i,a,function(m,_,O,v,D,L,H,$){g(v[m])==="object"&&d(u._trace(T(_,O),v[m],k(D,m),v,m,$,!0))});else{if(l==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:c,isParentSelector:!0};if(l==="~")return f={path:k(r,l),value:i,parent:n,parentProperty:null},this._handleCallback(f,a,"property"),f;if(l==="$")d(this._trace(c,e,r,null,null,a,o));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(l))d(this._slice(l,c,e,r,n,i,a));else if(l.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");this._walk(l,c,e,r,n,i,a,function(m,_,O,v,D,L,H,$){u._eval(_.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1"),v[m],m,D,L,H)&&d(u._trace(T(m,O),v,D,L,H,$,!0))})}else if(l[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");d(this._trace(T(this._eval(l,e,r[r.length-1],r.slice(0,-1),n,i),c),e,r,n,i,a,o))}else if(l[0]==="@"){var y=!1,S=l.slice(1,-2);switch(S){case"scalar":(!e||!["object","function"].includes(g(e)))&&(y=!0);break;case"boolean":case"string":case"undefined":case"function":g(e)===S&&(y=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(y=!0);break;case"number":Number.isFinite(e)&&(y=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(y=!0);break;case"object":e&&g(e)===S&&(y=!0);break;case"array":Array.isArray(e)&&(y=!0);break;case"other":y=this.currOtherTypeCallback(e,r,n,i);break;case"null":e===null&&(y=!0);break;default:throw new TypeError("Unknown value type "+S)}if(y)return f={path:r,value:e,parent:n,parentProperty:i},this._handleCallback(f,a,"value"),f}else if(l[0]==="`"&&e&&b.call(e,l.slice(1))){var V=l.slice(1);d(this._trace(c,e[V],k(r,V),e,V,a,o,!0))}else if(l.includes(",")){var gt=l.split(","),I=$t(gt),et;try{for(I.s();!(et=I.n()).done;){var vt=et.value;d(this._trace(T(vt,c),e,r,n,i,a,!0))}}catch(m){I.e(m)}finally{I.f()}}else!s&&e&&b.call(e,l)&&d(this._trace(c,e[l],k(r,l),e,l,a,o,!0))}if(this._hasParentSelector)for(var E=0;E<h.length;E++){var N=h[E];if(N&&N.isParentSelector){var M=this._trace(N.expr,e,N.path,n,i,a,o);if(Array.isArray(M)){h[E]=M[0];for(var Ft=M.length,Y=1;Y<Ft;Y++)E++,h.splice(E,0,M[Y])}else h[E]=M}}return h};p.prototype._walk=function(t,e,r,n,i,a,o,s){if(Array.isArray(r))for(var u=r.length,f=0;f<u;f++)s(f,t,e,r,n,i,a,o);else r&&g(r)==="object"&&Object.keys(r).forEach(function(l){s(l,t,e,r,n,i,a,o)})};p.prototype._slice=function(t,e,r,n,i,a,o){if(!!Array.isArray(r)){var s=r.length,u=t.split(":"),f=u[2]&&Number.parseInt(u[2])||1,l=u[0]&&Number.parseInt(u[0])||0,c=u[1]&&Number.parseInt(u[1])||s;l=l<0?Math.max(0,l+s):Math.min(s,l),c=c<0?Math.max(0,c+s):Math.min(s,c);for(var h=[],d=l;d<c;d+=f){var y=this._trace(T(d,e),r,n,i,a,o,!0);y.forEach(function(S){h.push(S)})}return h}};p.prototype._eval=function(t,e,r,n,i,a){t.includes("@parentProperty")&&(this.currSandbox._$_parentProperty=a,t=t.replace(/@parentProperty/g,"_$_parentProperty")),t.includes("@parent")&&(this.currSandbox._$_parent=i,t=t.replace(/@parent/g,"_$_parent")),t.includes("@property")&&(this.currSandbox._$_property=r,t=t.replace(/@property/g,"_$_property")),t.includes("@path")&&(this.currSandbox._$_path=p.toPathString(n.concat([r])),t=t.replace(/@path/g,"_$_path")),t.includes("@root")&&(this.currSandbox._$_root=this.json,t=t.replace(/@root/g,"_$_root")),/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/.test(t)&&(this.currSandbox._$_v=e,t=t.replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1"));try{return this.vm.runInNewContext(t,this.currSandbox)}catch(o){throw console.log(o),new Error("jsonPath: "+o.message+": "+t)}};p.cache={};p.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};p.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};p.toPathArray=function(t){var e=p.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(a,o){return"[#"+(r.push(o)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(a,o){return"['"+o.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(a,o){return";"+o.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),i=n.split(";").map(function(a){var o=a.match(/#([0-9]+)/);return!o||!o[1]?a:r[o[1]]});return e[t]=i,e[t].concat()};var kt=function(e,r,n){for(var i=e.length,a=0;a<i;a++){var o=e[a];n(o)&&r.push(e.splice(a--,1)[0])}};p.prototype.vm={runInNewContext:function(e,r){var n=Object.keys(r),i=[];kt(n,i,function(f){return typeof r[f]=="function"});var a=n.map(function(f,l){return r[f]}),o=i.reduce(function(f,l){var c=r[l].toString();return/function/.test(c)||(c="function "+c),"var "+l+"="+c+";"+f},"");e=o+e,!/(["'])use strict\1/.test(e)&&!n.includes("arguments")&&(e="var arguments = undefined;"+e),e=e.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var s=e.lastIndexOf(";"),u=s>-1?e.slice(0,s+1)+" return "+e.slice(s+1):" return "+e;return j(Function,ot(n).concat([u])).apply(void 0,ot(a))}};function X(t,e,r,n){return w(this,null,function*(){let i=new Date,a=yield fetch(t,e);if(!a.ok)throw new Error("Fetch failed");let o=new Date(a.headers.get("date"));var s=a;if(n(a,"cached"),o<i){let u=yield fetch(t+"?"+Math.random(),x(F({},e),{method:"HEAD",cache:"no-cache"}));if(u.headers.get("last-modified")!=a.headers.get("last-modified")){if(r(u)===!1)throw new Error("Response is stale");s=yield fetch(t,x(F({},e),{cache:"reload"}))}}if(r(s)===!1)throw new Error("Response is not valid");return a!==s&&n(s,"valid"),s})}function jt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,component:r,variant:n,version:i="published"}){return`${t}/components/${r}/variants/${n}/${i}.html`}function Rt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,version:r="published"}){return`${t}/styles/${e}/${r}.css`}function J(t,e){return w(this,null,function*(){return X(jt(t),{},r=>r.headers.get("x-ms-meta-variantDeletedAt")==null,r=>{r.text().then(e)})})}function z(t,e){return w(this,null,function*(){return X(Rt(t),{},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(e)})})}function Bt(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return A(n,e),r}function ct(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function ft(t){return ct(t)+".*"}function ht(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 It(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var i=ht(t);if(i!=0)return;let a=t.parentElement;if(a!=null){e==0?t.style.display="none":t.style.display&&(t.style.display="",t.getAttribute("style")==""&&t.removeAttribute("style"));for(var o=i+1,s=t,u=t;u=u.nextElementSibling;)u.getAttribute("data-path-scope")==n&&(o++,s=u);for(var f=o;f<e;f++)a.insertBefore(s.cloneNode(!0),s.nextElementSibling);for(var f=Math.max(1,e);f<o;f++)s=s.previousElementSibling,a.removeChild(s.nextElementSibling)}}function Q(t,e,r=!1,n=t){var i=e;let a=Object.keys(t).sort((s,u)=>u.length-s.length);for(let s of a)if(e.startsWith(s)){if(s==e){if(r)return t[s];continue}i=e.substring(s.length+1),n=t[s];break}let o=p({path:i,json:n});return r&&o?o[0]:o}function C(t,e,r,n){var l;if(!!t){var i=t;n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(t,e,r));var a=e.replace("data-path-","");if(e=="data-path-src")i=t.tagName=="IMG"?t:t.querySelector("img, video");else if(e=="data-path-href")i=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")a="innerHTML";else if(e=="data-embed-src")q(t,r);else if(e=="data-path-attributes"){let c=((l=t.getAttribute("data-attributes-keys"))==null?void 0:l.split(",").filter(Boolean))||[];for(var o in r){var s=r[o];C(t,o,typeof s=="object"&&s?JSON.stringify(s):s,n)}for(var u=0;u<c.length;u++)(r==null||!(c[u]in r))&&C(t,c[u],null,n);C(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!i){var f=String(t.getAttribute("data-path-placeholder")||i[a]);r!=null?a=="innerHTML"?i.innerHTML!=r&&(i.innerHTML=r):i.getAttribute(a)!=r&&i.setAttribute(a,r):a=="innerHTML"?i.innerHTML=f:i.removeAttribute(a)}}}function pt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,a=i.getAttribute("data-embed-src");a&&q(i,a),n.addedNodes&&n.addedNodes.forEach(o=>{o.nodeType==1&&dt(o,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function dt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];q(i,i.getAttribute("data-embed-src"))}if(e)return pt(t)}function q(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 a=r.ownerDocument.createElement("script");a.type="module",a.src=e,r.appendChild(a);break}}var lt=["data-attributes-keys","data-path-attributes","data-path-scope"];function A(t,e,r,n){var o,s,u;let i=t;if(n||(e=((o=r==null?void 0:r.processData)==null?void 0:o.call(r,i,e))||e),i.nodeType==1){let f=i.getAttribute("data-path-scope");if(f){let c=ht(i),h=Q(e,f,!1)||[];c==0&&It(i,((s=r==null?void 0:r.shouldRepeat)==null?void 0:s.call(r,i,h))===!1?1:h.length,r),e=x(F({},e),{[ft(f)]:h[c]})}let l=Array.prototype.slice.call(i.attributes).sort((c,h)=>lt.indexOf(c.name)-lt.indexOf(h.name));for(var a=0;a<l.length;a++){let{name:c,value:h}=l[a];c.startsWith("data-path")&&c!="data-path-scope"&&C(i,c,Q(e,h,!0),r),c=="data-embed-src"&&C(i,c,i.getAttribute(c),r)}}for(var a=0;a<i.children.length;a++)A(i.children[a],e,r,!0);return n||(u=r==null?void 0:r.onRender)==null||u.call(r,i,e),i}function P(t,e,r,n){var a;let i=((a=n==null?void 0:n.processTemplate)==null?void 0:a.call(n,t,e,r))||e;return t.innerHTML=i,t.classList.add("-feaas"),A(t,r,n)}function Nt(t,e){return yt(t,e||(e=document.createElement("style"))),e}function yt(t,e){return e||(e=document.createElement("style")),z(t,r=>{e.textContent=r}).then(()=>e)}function Jt(t,e){return mt(t,e||(e=document.createElement("div"))),e}function mt(t,e){return w(this,null,function*(){return e||(e=document.createElement("div")),e.childNodes.length?A(e,t.data,t):"template"in t?P(e,t.template,t.data,t):J(t,r=>P(e,r,t.data,t)).then(()=>e)})}var tt={};at(tt,{HTMLFeaasComponent:()=>W,HTMLFeaasStylesheet:()=>U});var bt=typeof HTMLElement=="undefined"?class{}:HTMLElement,W=class extends bt{constructor(){super(...arguments);this.connected=!1;this.template=null;this.data=void 0;this.isFetching=!1}static get observedAttributes(){return["data","library","component","variant","version","hostname","template"]}connectedCallback(){this.connected=!0,this.render()}disconnectedCallback(){}attributeChangedCallback(r,n,i){!this.connected||(r=="template"&&(this.template=i),r=="data"&&this.children.length>0?this.update():this.render())}update(){A(this,this.getProps().data)}setData(r){this.data=r,this.children.length>0?this.update():this.render()}getOriginal(){let r=this.getAttribute("data-path-scope");if(!!r){for(var n=this;(n=n.previousElementSibling)&&n.getAttribute("data-path-scope")==r;)var i=n;return i}}getData(){var r;if(this.data)return this.data;if(this.getAttribute("data")){let n=this.getAttribute("data");return typeof n=="string"?JSON.parse(n):{}}return((r=this.getOriginal())==null?void 0:r.getData())||{}}render(){if(this.getOriginal())return;let r=this.getProps();this.template==null?this.isFetching||r.component!=null&&r.variant!=null&&(this.isFetching=!0,J(r,n=>{this.template=n,this.isFetching=!1,P(this,this.template,r.data)}).catch(()=>{console.error(`FEAAS: Could not fetch component: ${r.component}/${r.variant}/${r.version}`)})):P(this,this.template,r.data)}getProps(){return{data:this.getData(),library:this.getAttribute("library")||void 0,component:this.getAttribute("component")||void 0,variant:this.getAttribute("variant")||void 0,version:this.getAttribute("version")||void 0,hostname:this.getAttribute("hostname")||void 0}}},U=class extends bt{constructor(){super(...arguments);this.connected=!1}static get observedAttributes(){return["library","version","hostname"]}connectedCallback(){this.connected=!0,this.render()}attributeChangedCallback(){this.connected&&this.render()}render(){let r=this.getProps();z(r,n=>{this.innerHTML="<style>"+n+"</style>"}).catch(n=>{console.error(`FEAAS: Could not fetch stylesheet for library ${r.library}`)})}getProps(){return{library:this.getAttribute("library")||void 0,version:this.getAttribute("version")||void 0,hostname:this.getAttribute("hostname")||void 0}}};typeof window!="undefined"&&!window.customElements.get("feaas-stylesheet")&&(window.customElements.define("feaas-stylesheet",U),window.customElements.define("feaas-component",W));var ne=F(F({},Z),tt);export{W as HTMLFeaasComponent,U as HTMLFeaasStylesheet,dt as autoloadScripts,ct as cleanCollectionBit,ne as default,X as fetchAndRevalidate,q as loadScript,ft as normalizeCollectionScope,pt as observeDOMElement,Q as queryScopes,Jt as renderComponent,Bt as renderComponentElement,mt as renderComponentPromise,P as renderDOMContent,A as renderDOMElement,Nt as renderStylesheet,yt as renderStylesheetPromise,C as setDOMAttribute};
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var a=!0,o=!1,s;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return a=u.done,u},e:function(u){o=!0,s=u},f:function(){try{!a&&r.return!=null&&r.return()}finally{if(o)throw s}}}}var b=Object.prototype.hasOwnProperty;function k(t,e){return t=t.slice(),t.push(e),t}function T(t,e){return e=e.slice(),e.unshift(t),e}var xt=function(t){Dt(r,t);var e=Mt(r);function r(n){var i;return _t(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 r}(G(Error));function p(t,e,r,n,i){if(!(this instanceof p))try{return new p(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 a=t&&g(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 o={path:a?t.path:e};a?"json"in t&&(o.json=t.json):o.json=r;var s=this.evaluate(o);if(!s||g(s)!=="object")throw new xt(s);return s}}p.prototype.evaluate=function(t,e,r,n){var i=this,a=this.parent,o=this.parentProperty,s=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&&g(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 f=t;e=f.json,s=b.call(t,"flatten")?t.flatten:s,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,a=b.call(t,"parent")?t.parent:a,o=b.call(t,"parentProperty")?t.parentProperty:o,t=t.path}if(a=a||null,o=o||null,Array.isArray(t)&&(t=p.toPathString(t)),!(!t&&t!==""||!e)){var l=p.toPathArray(t);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;var c=this._trace(l,e,["$"],a,o,r).filter(function(h){return h&&!h.isParentSelector});return c.length?!u&&c.length===1&&!c[0].hasArrExpr?this._getPreferredOutput(c[0]):c.reduce(function(h,d){var y=i._getPreferredOutput(d);return s&&Array.isArray(y)?h=h.concat(y):h.push(y),h},[]):u?[]:void 0}};p.prototype._getPreferredOutput=function(t){var e=this.currResultType;switch(e){case"all":{var r=Array.isArray(t.path)?t.path:p.toPathArray(t.path);return t.pointer=p.toPointer(r),t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return p.toPathString(t[e]);case"pointer":return p.toPointer(t.path);default:throw new TypeError("Unknown result type")}};p.prototype._handleCallback=function(t,e,r){if(e){var n=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:p.toPathString(t.path),e(n,r,t)}};p.prototype._trace=function(t,e,r,n,i,a,o,s){var u=this,f;if(!t.length)return f={path:r,value:e,parent:n,parentProperty:i,hasArrExpr:o},this._handleCallback(f,a,"value"),f;var l=t[0],c=t.slice(1),h=[];function d(m){Array.isArray(m)?m.forEach(function(_){h.push(_)}):h.push(m)}if((typeof l!="string"||s)&&e&&b.call(e,l))d(this._trace(c,e[l],k(r,l),e,l,a,o));else if(l==="*")this._walk(l,c,e,r,n,i,a,function(m,_,O,v,D,L,H,$){d(u._trace(T(m,O),v,D,L,H,$,!0,!0))});else if(l==="..")d(this._trace(c,e,r,n,i,a,o)),this._walk(l,c,e,r,n,i,a,function(m,_,O,v,D,L,H,$){g(v[m])==="object"&&d(u._trace(T(_,O),v[m],k(D,m),v,m,$,!0))});else{if(l==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:c,isParentSelector:!0};if(l==="~")return f={path:k(r,l),value:i,parent:n,parentProperty:null},this._handleCallback(f,a,"property"),f;if(l==="$")d(this._trace(c,e,r,null,null,a,o));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(l))d(this._slice(l,c,e,r,n,i,a));else if(l.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");this._walk(l,c,e,r,n,i,a,function(m,_,O,v,D,L,H,$){u._eval(_.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1"),v[m],m,D,L,H)&&d(u._trace(T(m,O),v,D,L,H,$,!0))})}else if(l[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");d(this._trace(T(this._eval(l,e,r[r.length-1],r.slice(0,-1),n,i),c),e,r,n,i,a,o))}else if(l[0]==="@"){var y=!1,S=l.slice(1,-2);switch(S){case"scalar":(!e||!["object","function"].includes(g(e)))&&(y=!0);break;case"boolean":case"string":case"undefined":case"function":g(e)===S&&(y=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(y=!0);break;case"number":Number.isFinite(e)&&(y=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(y=!0);break;case"object":e&&g(e)===S&&(y=!0);break;case"array":Array.isArray(e)&&(y=!0);break;case"other":y=this.currOtherTypeCallback(e,r,n,i);break;case"null":e===null&&(y=!0);break;default:throw new TypeError("Unknown value type "+S)}if(y)return f={path:r,value:e,parent:n,parentProperty:i},this._handleCallback(f,a,"value"),f}else if(l[0]==="`"&&e&&b.call(e,l.slice(1))){var V=l.slice(1);d(this._trace(c,e[V],k(r,V),e,V,a,o,!0))}else if(l.includes(",")){var gt=l.split(","),I=$t(gt),et;try{for(I.s();!(et=I.n()).done;){var vt=et.value;d(this._trace(T(vt,c),e,r,n,i,a,!0))}}catch(m){I.e(m)}finally{I.f()}}else!s&&e&&b.call(e,l)&&d(this._trace(c,e[l],k(r,l),e,l,a,o,!0))}if(this._hasParentSelector)for(var E=0;E<h.length;E++){var N=h[E];if(N&&N.isParentSelector){var M=this._trace(N.expr,e,N.path,n,i,a,o);if(Array.isArray(M)){h[E]=M[0];for(var Ft=M.length,Y=1;Y<Ft;Y++)E++,h.splice(E,0,M[Y])}else h[E]=M}}return h};p.prototype._walk=function(t,e,r,n,i,a,o,s){if(Array.isArray(r))for(var u=r.length,f=0;f<u;f++)s(f,t,e,r,n,i,a,o);else r&&g(r)==="object"&&Object.keys(r).forEach(function(l){s(l,t,e,r,n,i,a,o)})};p.prototype._slice=function(t,e,r,n,i,a,o){if(!!Array.isArray(r)){var s=r.length,u=t.split(":"),f=u[2]&&Number.parseInt(u[2])||1,l=u[0]&&Number.parseInt(u[0])||0,c=u[1]&&Number.parseInt(u[1])||s;l=l<0?Math.max(0,l+s):Math.min(s,l),c=c<0?Math.max(0,c+s):Math.min(s,c);for(var h=[],d=l;d<c;d+=f){var y=this._trace(T(d,e),r,n,i,a,o,!0);y.forEach(function(S){h.push(S)})}return h}};p.prototype._eval=function(t,e,r,n,i,a){t.includes("@parentProperty")&&(this.currSandbox._$_parentProperty=a,t=t.replace(/@parentProperty/g,"_$_parentProperty")),t.includes("@parent")&&(this.currSandbox._$_parent=i,t=t.replace(/@parent/g,"_$_parent")),t.includes("@property")&&(this.currSandbox._$_property=r,t=t.replace(/@property/g,"_$_property")),t.includes("@path")&&(this.currSandbox._$_path=p.toPathString(n.concat([r])),t=t.replace(/@path/g,"_$_path")),t.includes("@root")&&(this.currSandbox._$_root=this.json,t=t.replace(/@root/g,"_$_root")),/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/.test(t)&&(this.currSandbox._$_v=e,t=t.replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1"));try{return this.vm.runInNewContext(t,this.currSandbox)}catch(o){throw console.log(o),new Error("jsonPath: "+o.message+": "+t)}};p.cache={};p.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};p.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};p.toPathArray=function(t){var e=p.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(a,o){return"[#"+(r.push(o)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(a,o){return"['"+o.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(a,o){return";"+o.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),i=n.split(";").map(function(a){var o=a.match(/#([0-9]+)/);return!o||!o[1]?a:r[o[1]]});return e[t]=i,e[t].concat()};var kt=function(e,r,n){for(var i=e.length,a=0;a<i;a++){var o=e[a];n(o)&&r.push(e.splice(a--,1)[0])}};p.prototype.vm={runInNewContext:function(e,r){var n=Object.keys(r),i=[];kt(n,i,function(f){return typeof r[f]=="function"});var a=n.map(function(f,l){return r[f]}),o=i.reduce(function(f,l){var c=r[l].toString();return/function/.test(c)||(c="function "+c),"var "+l+"="+c+";"+f},"");e=o+e,!/(["'])use strict\1/.test(e)&&!n.includes("arguments")&&(e="var arguments = undefined;"+e),e=e.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var s=e.lastIndexOf(";"),u=s>-1?e.slice(0,s+1)+" return "+e.slice(s+1):" return "+e;return j(Function,ot(n).concat([u])).apply(void 0,ot(a))}};function X(t,e,r,n){return w(this,null,function*(){let i=new Date,a=yield fetch(t,e);if(!a.ok)throw new Error("Fetch failed");let o=new Date(a.headers.get("date"));var s=a;if(n(a,"cached"),o<i){let u=yield fetch(t+"?"+Math.random(),x(F({},e),{method:"HEAD",cache:"no-cache"}));if(u.headers.get("last-modified")!=a.headers.get("last-modified")){if(r(u)===!1)throw new Error("Response is stale");s=yield fetch(t,x(F({},e),{cache:"reload"}))}}if(r(s)===!1)throw new Error("Response is not valid");return a!==s&&n(s,"valid"),s})}function jt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,component:r,variant:n,version:i="published"}){return`${t}/components/${e}/${r}/${n}/${i}.html`}function Rt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,version:r="published"}){return`${t}/styles/${e}/${r}.css`}function J(t,e){return w(this,null,function*(){return X(jt(t),{},r=>r.headers.get("x-ms-meta-variantDeletedAt")==null,r=>{r.text().then(e)})})}function z(t,e){return w(this,null,function*(){return X(Rt(t),{},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(e)})})}function Bt(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return A(n,e),r}function ct(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function ft(t){return ct(t)+".*"}function ht(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 It(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var i=ht(t);if(i!=0)return;let a=t.parentElement;if(a!=null){e==0?t.style.display="none":t.style.display&&(t.style.display="",t.getAttribute("style")==""&&t.removeAttribute("style"));for(var o=i+1,s=t,u=t;u=u.nextElementSibling;)u.getAttribute("data-path-scope")==n&&(o++,s=u);for(var f=o;f<e;f++)a.insertBefore(s.cloneNode(!0),s.nextElementSibling);for(var f=Math.max(1,e);f<o;f++)s=s.previousElementSibling,a.removeChild(s.nextElementSibling)}}function Q(t,e,r=!1,n=t){var i=e;let a=Object.keys(t).sort((s,u)=>u.length-s.length);for(let s of a)if(e.startsWith(s)){if(s==e){if(r)return t[s];continue}i=e.substring(s.length+1),n=t[s];break}let o=p({path:i,json:n});return r&&o?o[0]:o}function C(t,e,r,n){var l;if(!!t){var i=t;n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(t,e,r));var a=e.replace("data-path-","");if(e=="data-path-src")i=t.tagName=="IMG"?t:t.querySelector("img, video");else if(e=="data-path-href")i=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")a="innerHTML";else if(e=="data-embed-src")q(t,r);else if(e=="data-path-attributes"){let c=((l=t.getAttribute("data-attributes-keys"))==null?void 0:l.split(",").filter(Boolean))||[];for(var o in r){var s=r[o];C(t,o,typeof s=="object"&&s?JSON.stringify(s):s,n)}for(var u=0;u<c.length;u++)(r==null||!(c[u]in r))&&C(t,c[u],null,n);C(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!i){var f=String(t.getAttribute("data-path-placeholder")||i[a]);r!=null?a=="innerHTML"?i.innerHTML!=r&&(i.innerHTML=r):i.getAttribute(a)!=r&&i.setAttribute(a,r):a=="innerHTML"?i.innerHTML=f:i.removeAttribute(a)}}}function pt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,a=i.getAttribute("data-embed-src");a&&q(i,a),n.addedNodes&&n.addedNodes.forEach(o=>{o.nodeType==1&&dt(o,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function dt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var n=0;n<r.length;n++){let i=r[n];q(i,i.getAttribute("data-embed-src"))}if(e)return pt(t)}function q(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 a=r.ownerDocument.createElement("script");a.type="module",a.src=e,r.appendChild(a);break}}var lt=["data-attributes-keys","data-path-attributes","data-path-scope"];function A(t,e,r,n){var o,s,u;let i=t;if(n||(e=((o=r==null?void 0:r.processData)==null?void 0:o.call(r,i,e))||e),i.nodeType==1){let f=i.getAttribute("data-path-scope");if(f){let c=ht(i),h=Q(e,f,!1)||[];c==0&&It(i,((s=r==null?void 0:r.shouldRepeat)==null?void 0:s.call(r,i,h))===!1?1:h.length,r),e=x(F({},e),{[ft(f)]:h[c]})}let l=Array.prototype.slice.call(i.attributes).sort((c,h)=>lt.indexOf(c.name)-lt.indexOf(h.name));for(var a=0;a<l.length;a++){let{name:c,value:h}=l[a];c.startsWith("data-path")&&c!="data-path-scope"&&C(i,c,Q(e,h,!0),r),c=="data-embed-src"&&C(i,c,i.getAttribute(c),r)}}for(var a=0;a<i.children.length;a++)A(i.children[a],e,r,!0);return n||(u=r==null?void 0:r.onRender)==null||u.call(r,i,e),i}function P(t,e,r,n){var a;let i=((a=n==null?void 0:n.processTemplate)==null?void 0:a.call(n,t,e,r))||e;return t.innerHTML=i,t.classList.add("-feaas"),A(t,r,n)}function Nt(t,e){return yt(t,e||(e=document.createElement("style"))),e}function yt(t,e){return e||(e=document.createElement("style")),z(t,r=>{e.textContent=r}).then(()=>e)}function Jt(t,e){return mt(t,e||(e=document.createElement("div"))),e}function mt(t,e){return w(this,null,function*(){return e||(e=document.createElement("div")),e.childNodes.length?A(e,t.data,t):"template"in t?P(e,t.template,t.data,t):J(t,r=>P(e,r,t.data,t)).then(()=>e)})}var tt={};at(tt,{HTMLFeaasComponent:()=>W,HTMLFeaasStylesheet:()=>U});var bt=typeof HTMLElement=="undefined"?class{}:HTMLElement,W=class extends bt{constructor(){super(...arguments);this.connected=!1;this.template=null;this.data=void 0;this.isFetching=!1}static get observedAttributes(){return["data","library","component","variant","version","hostname","template"]}connectedCallback(){this.connected=!0,this.render()}disconnectedCallback(){}attributeChangedCallback(r,n,i){!this.connected||(r=="template"&&(this.template=i),r=="data"&&this.children.length>0?this.update():this.render())}update(){A(this,this.getProps().data)}setData(r){this.data=r,this.children.length>0?this.update():this.render()}getOriginal(){let r=this.getAttribute("data-path-scope");if(!!r){for(var n=this;(n=n.previousElementSibling)&&n.getAttribute("data-path-scope")==r;)var i=n;return i}}getData(){var r;if(this.data)return this.data;if(this.getAttribute("data")){let n=this.getAttribute("data");return typeof n=="string"?JSON.parse(n):{}}return((r=this.getOriginal())==null?void 0:r.getData())||{}}render(){if(this.getOriginal())return;let r=this.getProps();this.template==null?this.isFetching||r.component!=null&&r.variant!=null&&(this.isFetching=!0,J(r,n=>{this.template=n,this.isFetching=!1,P(this,this.template,r.data)}).catch(()=>{console.error(`FEAAS: Could not fetch component: ${r.component}/${r.variant}/${r.version}`)})):P(this,this.template,r.data)}getProps(){return{data:this.getData(),library:this.getAttribute("library")||void 0,component:this.getAttribute("component")||void 0,variant:this.getAttribute("variant")||void 0,version:this.getAttribute("version")||void 0,hostname:this.getAttribute("hostname")||void 0}}},U=class extends bt{constructor(){super(...arguments);this.connected=!1}static get observedAttributes(){return["library","version","hostname"]}connectedCallback(){this.connected=!0,this.render()}attributeChangedCallback(){this.connected&&this.render()}render(){let r=this.getProps();z(r,n=>{this.innerHTML="<style>"+n+"</style>"}).catch(n=>{console.error(`FEAAS: Could not fetch stylesheet for library ${r.library}`)})}getProps(){return{library:this.getAttribute("library")||void 0,version:this.getAttribute("version")||void 0,hostname:this.getAttribute("hostname")||void 0}}};typeof window!="undefined"&&!window.customElements.get("feaas-stylesheet")&&(window.customElements.define("feaas-stylesheet",U),window.customElements.define("feaas-component",W));var ne=F(F({},Z),tt);export{W as HTMLFeaasComponent,U as HTMLFeaasStylesheet,dt as autoloadScripts,ct as cleanCollectionBit,ne as default,X as fetchAndRevalidate,q as loadScript,ft as normalizeCollectionScope,pt as observeDOMElement,Q as queryScopes,Jt as renderComponent,Bt as renderComponentElement,mt as renderComponentPromise,P as renderDOMContent,A as renderDOMElement,Nt as renderStylesheet,yt as renderStylesheetPromise,C as setDOMAttribute};
{
"name": "@sitecore-feaas/clientside",
"version": "0.0.1",
"version": "0.0.2",
"scripts": {

@@ -5,0 +5,0 @@ "start": "webpack serve --open",

@@ -1,3 +0,3 @@

var it=Object.defineProperty,At=Object.defineProperties;var St=Object.getOwnPropertyDescriptors;var nt=Object.getOwnPropertySymbols;var wt=Object.prototype.hasOwnProperty,_t=Object.prototype.propertyIsEnumerable;var at=(t,e,r)=>e in t?it(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e||(e={}))wt.call(e,r)&&at(t,r,e[r]);if(nt)for(var r of nt(e))_t.call(e,r)&&at(t,r,e[r]);return t},w=(t,e)=>At(t,St(e));var ot=(t,e)=>{for(var r in e)it(t,r,{get:e[r],enumerable:!0})};var _=(t,e,r)=>new Promise((n,a)=>{var i=u=>{try{s(r.next(u))}catch(f){a(f)}},o=u=>{try{s(r.throw(u))}catch(f){a(f)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(i,o);s((r=r.apply(t,e)).next())});import v from"react";function K(t,e,r,n){return _(this,null,function*(){let a=new Date,i=yield fetch(t,e);if(!i.ok)throw new Error("Fetch failed");let o=new Date(i.headers.get("date"));var s=i;if(n(i,"cached"),o<a){let u=yield fetch(t+"?"+Math.random(),w(A({},e),{method:"HEAD",cache:"no-cache"}));if(u.headers.get("last-modified")!=i.headers.get("last-modified")){if(r(u)===!1)throw new Error("Response is stale");s=yield fetch(t,w(A({},e),{cache:"reload"}))}}if(r(s)===!1)throw new Error("Response is not valid");return i!==s&&n(s,"valid"),s})}function Dt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,component:r,variant:n,version:a="published"}){return`${t}/components/${r}/variants/${n}/${a}.html`}function Tt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,version:r="published"}){return`${t}/styles/${e}/${r}.css`}function M(t,e){return _(this,null,function*(){return K(Dt(t),{},r=>r.headers.get("x-ms-meta-variantDeletedAt")==null,r=>{r.text().then(e)})})}function P(t,e){return _(this,null,function*(){return K(Tt(t),{},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(e)})})}var tt={};ot(tt,{autoloadScripts:()=>yt,cleanCollectionBit:()=>ft,loadScript:()=>W,normalizeCollectionScope:()=>ht,observeDOMElement:()=>pt,queryScopes:()=>Z,renderComponent:()=>zt,renderComponentElement:()=>Nt,renderComponentPromise:()=>bt,renderDOMContent:()=>$,renderDOMElement:()=>E,renderStylesheet:()=>Jt,renderStylesheetPromise:()=>mt,setDOMAttribute:()=>L});function g(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?g=function(e){return typeof e}:g=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(t)}function Ct(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Mt(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}}),e&&J(t,e)}function I(t){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},I(t)}function J(t,e){return J=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},J(t,e)}function ut(){if(typeof Reflect=="undefined"||!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(t){return!1}}function N(t,e,r){return ut()?N=Reflect.construct:N=function(a,i,o){var s=[null];s.push.apply(s,i);var u=Function.bind.apply(a,s),f=new u;return o&&J(f,o.prototype),f},N.apply(null,arguments)}function Pt(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function X(t){var e=typeof Map=="function"?new Map:void 0;return X=function(n){if(n===null||!Pt(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(n))return e.get(n);e.set(n,a)}function a(){return N(n,arguments,I(this).constructor)}return a.prototype=Object.create(n.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),J(a,n)},X(t)}function Ot(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Lt(t,e){return e&&(typeof e=="object"||typeof e=="function")?e:Ot(t)}function $t(t){var e=ut();return function(){var n=I(t),a;if(e){var i=I(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return Lt(this,a)}}function st(t){return Ht(t)||xt(t)||lt(t)||kt()}function Ht(t){if(Array.isArray(t))return Q(t)}function xt(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function lt(t,e){if(!!t){if(typeof t=="string")return Q(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 Q(t,e)}}function Q(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 kt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
var it=Object.defineProperty,At=Object.defineProperties;var St=Object.getOwnPropertyDescriptors;var nt=Object.getOwnPropertySymbols;var wt=Object.prototype.hasOwnProperty,_t=Object.prototype.propertyIsEnumerable;var at=(t,e,r)=>e in t?it(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e||(e={}))wt.call(e,r)&&at(t,r,e[r]);if(nt)for(var r of nt(e))_t.call(e,r)&&at(t,r,e[r]);return t},w=(t,e)=>At(t,St(e));var ot=(t,e)=>{for(var r in e)it(t,r,{get:e[r],enumerable:!0})};var _=(t,e,r)=>new Promise((n,a)=>{var i=u=>{try{s(r.next(u))}catch(f){a(f)}},o=u=>{try{s(r.throw(u))}catch(f){a(f)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(i,o);s((r=r.apply(t,e)).next())});import v from"react";function K(t,e,r,n){return _(this,null,function*(){let a=new Date,i=yield fetch(t,e);if(!i.ok)throw new Error("Fetch failed");let o=new Date(i.headers.get("date"));var s=i;if(n(i,"cached"),o<a){let u=yield fetch(t+"?"+Math.random(),w(A({},e),{method:"HEAD",cache:"no-cache"}));if(u.headers.get("last-modified")!=i.headers.get("last-modified")){if(r(u)===!1)throw new Error("Response is stale");s=yield fetch(t,w(A({},e),{cache:"reload"}))}}if(r(s)===!1)throw new Error("Response is not valid");return i!==s&&n(s,"valid"),s})}function Dt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,component:r,variant:n,version:a="published"}){return`${t}/components/${e}/${r}/${n}/${a}.html`}function Tt({hostname:t="https://feaascomponentsapidev.blob.core.windows.net",library:e,version:r="published"}){return`${t}/styles/${e}/${r}.css`}function M(t,e){return _(this,null,function*(){return K(Dt(t),{},r=>r.headers.get("x-ms-meta-variantDeletedAt")==null,r=>{r.text().then(e)})})}function P(t,e){return _(this,null,function*(){return K(Tt(t),{},r=>r.headers.get("x-ms-meta-deletedAt")==null,r=>{r.text().then(e)})})}var tt={};ot(tt,{autoloadScripts:()=>yt,cleanCollectionBit:()=>ft,loadScript:()=>W,normalizeCollectionScope:()=>ht,observeDOMElement:()=>pt,queryScopes:()=>Z,renderComponent:()=>zt,renderComponentElement:()=>Nt,renderComponentPromise:()=>bt,renderDOMContent:()=>$,renderDOMElement:()=>E,renderStylesheet:()=>Jt,renderStylesheetPromise:()=>mt,setDOMAttribute:()=>L});function g(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?g=function(e){return typeof e}:g=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g(t)}function Ct(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Mt(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}}),e&&J(t,e)}function I(t){return I=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},I(t)}function J(t,e){return J=Object.setPrototypeOf||function(n,a){return n.__proto__=a,n},J(t,e)}function ut(){if(typeof Reflect=="undefined"||!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(t){return!1}}function N(t,e,r){return ut()?N=Reflect.construct:N=function(a,i,o){var s=[null];s.push.apply(s,i);var u=Function.bind.apply(a,s),f=new u;return o&&J(f,o.prototype),f},N.apply(null,arguments)}function Pt(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function X(t){var e=typeof Map=="function"?new Map:void 0;return X=function(n){if(n===null||!Pt(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e!="undefined"){if(e.has(n))return e.get(n);e.set(n,a)}function a(){return N(n,arguments,I(this).constructor)}return a.prototype=Object.create(n.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),J(a,n)},X(t)}function Ot(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Lt(t,e){return e&&(typeof e=="object"||typeof e=="function")?e:Ot(t)}function $t(t){var e=ut();return function(){var n=I(t),a;if(e){var i=I(this).constructor;a=Reflect.construct(n,arguments,i)}else a=n.apply(this,arguments);return Lt(this,a)}}function st(t){return Ht(t)||xt(t)||lt(t)||kt()}function Ht(t){if(Array.isArray(t))return Q(t)}function xt(t){if(typeof Symbol!="undefined"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function lt(t,e){if(!!t){if(typeof t=="string")return Q(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 Q(t,e)}}function Q(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 kt(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Rt(t,e){var r=typeof Symbol!="undefined"&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=lt(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0,a=function(){};return{s:a,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(u){throw u},f:a}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i=!0,o=!1,s;return{s:function(){r=r.call(t)},n:function(){var u=r.next();return i=u.done,u},e:function(u){o=!0,s=u},f:function(){try{!i&&r.return!=null&&r.return()}finally{if(o)throw s}}}}var b=Object.prototype.hasOwnProperty;function B(t,e){return t=t.slice(),t.push(e),t}function O(t,e){return e=e.slice(),e.unshift(t),e}var jt=function(t){Mt(r,t);var e=$t(r);function r(n){var a;return Ct(this,r),a=e.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),a.avoidNew=!0,a.value=n,a.name="NewError",a}return r}(X(Error));function d(t,e,r,n,a){if(!(this instanceof d))try{return new d(t,e,r,n,a)}catch(u){if(!u.avoidNew)throw u;return u.value}typeof t=="string"&&(a=n,n=r,r=e,e=t,t=null);var i=t&&g(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||a||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){var o={path:i?t.path:e};i?"json"in t&&(o.json=t.json):o.json=r;var s=this.evaluate(o);if(!s||g(s)!=="object")throw new jt(s);return s}}d.prototype.evaluate=function(t,e,r,n){var a=this,i=this.parent,o=this.parentProperty,s=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&&g(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 f=t;e=f.json,s=b.call(t,"flatten")?t.flatten:s,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,i=b.call(t,"parent")?t.parent:i,o=b.call(t,"parentProperty")?t.parentProperty:o,t=t.path}if(i=i||null,o=o||null,Array.isArray(t)&&(t=d.toPathString(t)),!(!t&&t!==""||!e)){var l=d.toPathArray(t);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;var c=this._trace(l,e,["$"],i,o,r).filter(function(h){return h&&!h.isParentSelector});return c.length?!u&&c.length===1&&!c[0].hasArrExpr?this._getPreferredOutput(c[0]):c.reduce(function(h,p){var y=a._getPreferredOutput(p);return s&&Array.isArray(y)?h=h.concat(y):h.push(y),h},[]):u?[]:void 0}};d.prototype._getPreferredOutput=function(t){var e=this.currResultType;switch(e){case"all":{var r=Array.isArray(t.path)?t.path:d.toPathArray(t.path);return t.pointer=d.toPointer(r),t.path=typeof t.path=="string"?t.path:d.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return d.toPathString(t[e]);case"pointer":return d.toPointer(t.path);default:throw new TypeError("Unknown result type")}};d.prototype._handleCallback=function(t,e,r){if(e){var n=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:d.toPathString(t.path),e(n,r,t)}};d.prototype._trace=function(t,e,r,n,a,i,o,s){var u=this,f;if(!t.length)return f={path:r,value:e,parent:n,parentProperty:a,hasArrExpr:o},this._handleCallback(f,i,"value"),f;var l=t[0],c=t.slice(1),h=[];function p(m){Array.isArray(m)?m.forEach(function(T){h.push(T)}):h.push(m)}if((typeof l!="string"||s)&&e&&b.call(e,l))p(this._trace(c,e[l],B(r,l),e,l,i,o));else if(l==="*")this._walk(l,c,e,r,n,a,i,function(m,T,x,F,C,k,R,j){p(u._trace(O(m,x),F,C,k,R,j,!0,!0))});else if(l==="..")p(this._trace(c,e,r,n,a,i,o)),this._walk(l,c,e,r,n,a,i,function(m,T,x,F,C,k,R,j){g(F[m])==="object"&&p(u._trace(O(T,x),F[m],B(C,m),F,m,j,!0))});else{if(l==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:c,isParentSelector:!0};if(l==="~")return f={path:B(r,l),value:a,parent:n,parentProperty:null},this._handleCallback(f,i,"property"),f;if(l==="$")p(this._trace(c,e,r,null,null,i,o));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(l))p(this._slice(l,c,e,r,n,a,i));else if(l.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");this._walk(l,c,e,r,n,a,i,function(m,T,x,F,C,k,R,j){u._eval(T.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1"),F[m],m,C,k,R)&&p(u._trace(O(m,x),F,C,k,R,j,!0))})}else if(l[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");p(this._trace(O(this._eval(l,e,r[r.length-1],r.slice(0,-1),n,a),c),e,r,n,a,i,o))}else if(l[0]==="@"){var y=!1,D=l.slice(1,-2);switch(D){case"scalar":(!e||!["object","function"].includes(g(e)))&&(y=!0);break;case"boolean":case"string":case"undefined":case"function":g(e)===D&&(y=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(y=!0);break;case"number":Number.isFinite(e)&&(y=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(y=!0);break;case"object":e&&g(e)===D&&(y=!0);break;case"array":Array.isArray(e)&&(y=!0);break;case"other":y=this.currOtherTypeCallback(e,r,n,a);break;case"null":e===null&&(y=!0);break;default:throw new TypeError("Unknown value type "+D)}if(y)return f={path:r,value:e,parent:n,parentProperty:a},this._handleCallback(f,i,"value"),f}else if(l[0]==="`"&&e&&b.call(e,l.slice(1))){var Y=l.slice(1);p(this._trace(c,e[Y],B(r,Y),e,Y,i,o,!0))}else if(l.includes(",")){var vt=l.split(","),z=Rt(vt),rt;try{for(z.s();!(rt=z.n()).done;){var Et=rt.value;p(this._trace(O(Et,c),e,r,n,a,i,!0))}}catch(m){z.e(m)}finally{z.f()}}else!s&&e&&b.call(e,l)&&p(this._trace(c,e[l],B(r,l),e,l,i,o,!0))}if(this._hasParentSelector)for(var S=0;S<h.length;S++){var q=h[S];if(q&&q.isParentSelector){var H=this._trace(q.expr,e,q.path,n,a,i,o);if(Array.isArray(H)){h[S]=H[0];for(var Ft=H.length,G=1;G<Ft;G++)S++,h.splice(S,0,H[G])}else h[S]=H}}return h};d.prototype._walk=function(t,e,r,n,a,i,o,s){if(Array.isArray(r))for(var u=r.length,f=0;f<u;f++)s(f,t,e,r,n,a,i,o);else r&&g(r)==="object"&&Object.keys(r).forEach(function(l){s(l,t,e,r,n,a,i,o)})};d.prototype._slice=function(t,e,r,n,a,i,o){if(!!Array.isArray(r)){var s=r.length,u=t.split(":"),f=u[2]&&Number.parseInt(u[2])||1,l=u[0]&&Number.parseInt(u[0])||0,c=u[1]&&Number.parseInt(u[1])||s;l=l<0?Math.max(0,l+s):Math.min(s,l),c=c<0?Math.max(0,c+s):Math.min(s,c);for(var h=[],p=l;p<c;p+=f){var y=this._trace(O(p,e),r,n,a,i,o,!0);y.forEach(function(D){h.push(D)})}return h}};d.prototype._eval=function(t,e,r,n,a,i){t.includes("@parentProperty")&&(this.currSandbox._$_parentProperty=i,t=t.replace(/@parentProperty/g,"_$_parentProperty")),t.includes("@parent")&&(this.currSandbox._$_parent=a,t=t.replace(/@parent/g,"_$_parent")),t.includes("@property")&&(this.currSandbox._$_property=r,t=t.replace(/@property/g,"_$_property")),t.includes("@path")&&(this.currSandbox._$_path=d.toPathString(n.concat([r])),t=t.replace(/@path/g,"_$_path")),t.includes("@root")&&(this.currSandbox._$_root=this.json,t=t.replace(/@root/g,"_$_root")),/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/.test(t)&&(this.currSandbox._$_v=e,t=t.replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1"));try{return this.vm.runInNewContext(t,this.currSandbox)}catch(o){throw console.log(o),new Error("jsonPath: "+o.message+": "+t)}};d.cache={};d.toPathString=function(t){for(var e=t,r=e.length,n="$",a=1;a<r;a++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[a])||(n+=/^[\*0-9]+$/.test(e[a])?"["+e[a]+"]":"['"+e[a]+"']");return n};d.toPointer=function(t){for(var e=t,r=e.length,n="",a=1;a<r;a++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(e[a])||(n+="/"+e[a].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return n};d.toPathArray=function(t){var e=d.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(i,o){return"[#"+(r.push(o)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(i,o){return"['"+o.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(i,o){return";"+o.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),a=n.split(";").map(function(i){var o=i.match(/#([0-9]+)/);return!o||!o[1]?i:r[o[1]]});return e[t]=a,e[t].concat()};var Bt=function(e,r,n){for(var a=e.length,i=0;i<a;i++){var o=e[i];n(o)&&r.push(e.splice(i--,1)[0])}};d.prototype.vm={runInNewContext:function(e,r){var n=Object.keys(r),a=[];Bt(n,a,function(f){return typeof r[f]=="function"});var i=n.map(function(f,l){return r[f]}),o=a.reduce(function(f,l){var c=r[l].toString();return/function/.test(c)||(c="function "+c),"var "+l+"="+c+";"+f},"");e=o+e,!/(["'])use strict\1/.test(e)&&!n.includes("arguments")&&(e="var arguments = undefined;"+e),e=e.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var s=e.lastIndexOf(";"),u=s>-1?e.slice(0,s+1)+" return "+e.slice(s+1):" return "+e;return N(Function,st(n).concat([u])).apply(void 0,st(i))}};function Nt(t,e){let r=document.createElement("div");r.innerHTML=t;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return E(n,e),r}function ft(t){return t.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function ht(t){return ft(t)+".*"}function dt(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 It(t,e,r){let n=t.getAttribute("data-path-scope");if(n==null)return;var a=dt(t);if(a!=0)return;let i=t.parentElement;if(i!=null){e==0?t.style.display="none":t.style.display&&(t.style.display="",t.getAttribute("style")==""&&t.removeAttribute("style"));for(var o=a+1,s=t,u=t;u=u.nextElementSibling;)u.getAttribute("data-path-scope")==n&&(o++,s=u);for(var f=o;f<e;f++)i.insertBefore(s.cloneNode(!0),s.nextElementSibling);for(var f=Math.max(1,e);f<o;f++)s=s.previousElementSibling,i.removeChild(s.nextElementSibling)}}function Z(t,e,r=!1,n=t){var a=e;let i=Object.keys(t).sort((s,u)=>u.length-s.length);for(let s of i)if(e.startsWith(s)){if(s==e){if(r)return t[s];continue}a=e.substring(s.length+1),n=t[s];break}let o=d({path:a,json:n});return r&&o?o[0]:o}function L(t,e,r,n){var l;if(!!t){var a=t;n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(t,e,r));var i=e.replace("data-path-","");if(e=="data-path-src")a=t.tagName=="IMG"?t:t.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")i="innerHTML";else if(e=="data-embed-src")W(t,r);else if(e=="data-path-attributes"){let c=((l=t.getAttribute("data-attributes-keys"))==null?void 0:l.split(",").filter(Boolean))||[];for(var o in r){var s=r[o];L(t,o,typeof s=="object"&&s?JSON.stringify(s):s,n)}for(var u=0;u<c.length;u++)(r==null||!(c[u]in r))&&L(t,c[u],null,n);L(t,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!a){var f=String(t.getAttribute("data-path-placeholder")||a[i]);r!=null?i=="innerHTML"?a.innerHTML!=r&&(a.innerHTML=r):a.getAttribute(i)!=r&&a.setAttribute(i,r):i=="innerHTML"?a.innerHTML=f:a.removeAttribute(i)}}}function pt(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let a=n.target,i=a.getAttribute("data-embed-src");i&&W(a,i),n.addedNodes&&n.addedNodes.forEach(o=>{o.nodeType==1&&yt(o,!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 a=r[n];W(a,a.getAttribute("data-embed-src"))}if(e)return pt(t)}function W(t,e){for(var r=t;r;r=r.parentElement)if(!r.parentElement){let a=r.querySelectorAll("script");for(var n=0;n<a.length;n++)if(a[n].getAttribute("src")==e)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let i=r.ownerDocument.createElement("script");i.type="module",i.src=e,r.appendChild(i);break}}var ct=["data-attributes-keys","data-path-attributes","data-path-scope"];function E(t,e,r,n){var o,s,u;let a=t;if(n||(e=((o=r==null?void 0:r.processData)==null?void 0:o.call(r,a,e))||e),a.nodeType==1){let f=a.getAttribute("data-path-scope");if(f){let c=dt(a),h=Z(e,f,!1)||[];c==0&&It(a,((s=r==null?void 0:r.shouldRepeat)==null?void 0:s.call(r,a,h))===!1?1:h.length,r),e=w(A({},e),{[ht(f)]:h[c]})}let l=Array.prototype.slice.call(a.attributes).sort((c,h)=>ct.indexOf(c.name)-ct.indexOf(h.name));for(var i=0;i<l.length;i++){let{name:c,value:h}=l[i];c.startsWith("data-path")&&c!="data-path-scope"&&L(a,c,Z(e,h,!0),r),c=="data-embed-src"&&L(a,c,a.getAttribute(c),r)}}for(var i=0;i<a.children.length;i++)E(a.children[i],e,r,!0);return n||(u=r==null?void 0:r.onRender)==null||u.call(r,a,e),a}function $(t,e,r,n){var i;let a=((i=n==null?void 0:n.processTemplate)==null?void 0:i.call(n,t,e,r))||e;return t.innerHTML=a,t.classList.add("-feaas"),E(t,r,n)}function Jt(t,e){return mt(t,e||(e=document.createElement("style"))),e}function mt(t,e){return e||(e=document.createElement("style")),P(t,r=>{e.textContent=r}).then(()=>e)}function zt(t,e){return bt(t,e||(e=document.createElement("div"))),e}function bt(t,e){return _(this,null,function*(){return e||(e=document.createElement("div")),e.childNodes.length?E(e,t.data,t):"template"in t?$(e,t.template,t.data,t):M(t,r=>$(e,r,t.data,t)).then(()=>e)})}var et={};ot(et,{HTMLFeaasComponent:()=>U,HTMLFeaasStylesheet:()=>V});var gt=typeof HTMLElement=="undefined"?class{}:HTMLElement,U=class extends gt{constructor(){super(...arguments);this.connected=!1;this.template=null;this.data=void 0;this.isFetching=!1}static get observedAttributes(){return["data","library","component","variant","version","hostname","template"]}connectedCallback(){this.connected=!0,this.render()}disconnectedCallback(){}attributeChangedCallback(r,n,a){!this.connected||(r=="template"&&(this.template=a),r=="data"&&this.children.length>0?this.update():this.render())}update(){E(this,this.getProps().data)}setData(r){this.data=r,this.children.length>0?this.update():this.render()}getOriginal(){let r=this.getAttribute("data-path-scope");if(!!r){for(var n=this;(n=n.previousElementSibling)&&n.getAttribute("data-path-scope")==r;)var a=n;return a}}getData(){var r;if(this.data)return this.data;if(this.getAttribute("data")){let n=this.getAttribute("data");return typeof n=="string"?JSON.parse(n):{}}return((r=this.getOriginal())==null?void 0:r.getData())||{}}render(){if(this.getOriginal())return;let r=this.getProps();this.template==null?this.isFetching||r.component!=null&&r.variant!=null&&(this.isFetching=!0,M(r,n=>{this.template=n,this.isFetching=!1,$(this,this.template,r.data)}).catch(()=>{console.error(`FEAAS: Could not fetch component: ${r.component}/${r.variant}/${r.version}`)})):$(this,this.template,r.data)}getProps(){return{data:this.getData(),library:this.getAttribute("library")||void 0,component:this.getAttribute("component")||void 0,variant:this.getAttribute("variant")||void 0,version:this.getAttribute("version")||void 0,hostname:this.getAttribute("hostname")||void 0}}},V=class extends gt{constructor(){super(...arguments);this.connected=!1}static get observedAttributes(){return["library","version","hostname"]}connectedCallback(){this.connected=!0,this.render()}attributeChangedCallback(){this.connected&&this.render()}render(){let r=this.getProps();P(r,n=>{this.innerHTML="<style>"+n+"</style>"}).catch(n=>{console.error(`FEAAS: Could not fetch stylesheet for library ${r.library}`)})}getProps(){return{library:this.getAttribute("library")||void 0,version:this.getAttribute("version")||void 0,hostname:this.getAttribute("hostname")||void 0}}};typeof window!="undefined"&&!window.customElements.get("feaas-stylesheet")&&(window.customElements.define("feaas-stylesheet",V),window.customElements.define("feaas-component",U));function qt(t){let[e,r]=v.useState("template"in t?t.template:null),n=t.data,a=v.useRef(null);return v.useEffect(()=>{e==null&&!("template"in t)&&M(t,r).catch(()=>{console.error(`FEAAS: Could not fetch component: ${t.library}/${t.component}/${t.variant}/${t.version}`)})},"template"in t?[t.template,null,null,null]:[t.library,t.component,t.variant,t.version,t.hostname]),v.useEffect(()=>{a.current&&e&&(a.current.innerHTML=e)},[a,e]),v.useEffect(()=>{e&&a.current&&E(a.current,n||{},t)},[a,e,n]),v.createElement("div",{ref:a,className:"-feaas"})}function Wt(t){let e=v.useRef(null),[r,n]=v.useState("");return v.useEffect(()=>{P(t,n).catch(a=>{console.error(`FEAAS: Could not fetch stylesheet for library ${t.library}`)})},[t.hostname,t.library]),v.createElement("style",{ref:e,rel:"stylesheet",className:"-stylesheet","data-library-id":t.library},[r])}var fe=w(A(A({},tt),et),{Stylesheet:Wt,Component:qt});export{qt as Component,U as HTMLFeaasComponent,V as HTMLFeaasStylesheet,Wt as Stylesheet,yt as autoloadScripts,ft as cleanCollectionBit,fe as default,M as fetchComponent,P as fetchStylesheet,Dt as getComponentURL,Tt as getStylesheetURL,W as loadScript,ht as normalizeCollectionScope,pt as observeDOMElement,Z as queryScopes,zt as renderComponent,Nt as renderComponentElement,bt as renderComponentPromise,$ as renderDOMContent,E as renderDOMElement,Jt as renderStylesheet,mt as renderStylesheetPromise,L as setDOMAttribute};

@@ -23,3 +23,3 @@ import { fetchAndRevalidate } from './fetch.js'

}: CloudTemplate) {
return `${hostname}/components/${component}/variants/${variant}/${version}.html`
return `${hostname}/components/${library}/${component}/${variant}/${version}.html`
}

@@ -26,0 +26,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc