@sitecore-feaas/clientside 0.6.4 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cdn.js.map +1 -1
- package/build/components/FEAASComponent.js +1 -2
- package/build/components/FEAASComponent.js.map +1 -1
- package/build/components/FEAASElement.js.map +1 -1
- package/build/components/FEAASLoader.js +1 -2
- package/build/components/FEAASLoader.js.map +1 -1
- package/build/components/FEAASReactElement.js +1 -2
- package/build/components/FEAASReactElement.js.map +1 -1
- package/build/components/FEAASStylesheet.js.map +1 -1
- package/build/dom/component.js.map +1 -1
- package/build/dom/html.js.map +1 -1
- package/build/dom/rendering.js.map +1 -1
- package/build/dom/scripts.js.map +1 -1
- package/build/dom/stylesheet.js.map +1 -1
- package/build/dom/thumbnail.js.map +1 -1
- package/build/fetch.js +6 -2
- package/build/fetch.js.map +1 -1
- package/build/headless.js.map +1 -1
- package/build/ui/FEAASContext.js +1 -2
- package/build/ui/FEAASContext.js.map +1 -1
- package/build/ui/FEAASEditor.js +1 -2
- package/build/ui/FEAASEditor.js.map +1 -1
- package/build/ui/FEAASExternal.js.map +1 -1
- package/build/ui/FEAASPicker.js +1 -2
- package/build/ui/FEAASPicker.js.map +1 -1
- package/build/ui/react.js.map +1 -1
- package/build/utils/data.js.map +1 -1
- package/build/utils/settings.js.map +1 -1
- package/dist/browser/headless.cjs +8 -9
- package/dist/browser/headless.cjs.map +4 -4
- package/dist/browser/headless.esm.js +8 -9
- package/dist/browser/headless.esm.js.map +1 -1
- package/dist/browser/index.cjs +10 -11
- package/dist/browser/index.cjs.map +4 -4
- package/dist/browser/index.esm.js +10 -11
- package/dist/browser/index.esm.js.map +1 -1
- package/dist/browser/react.cjs +11 -12
- package/dist/browser/react.cjs.map +4 -4
- package/dist/browser/react.esm.js +11 -12
- package/dist/browser/react.esm.js.map +1 -1
- package/dist/node/headless.cjs +8 -7
- package/dist/node/headless.cjs.map +4 -4
- package/dist/node/headless.esm.js +8 -7
- package/dist/node/headless.esm.js.map +4 -4
- package/dist/node/index.cjs +7 -6
- package/dist/node/index.cjs.map +4 -4
- package/dist/node/index.esm.js +7 -6
- package/dist/node/index.esm.js.map +4 -4
- package/dist/node/react.cjs +11 -10
- package/dist/node/react.cjs.map +4 -4
- package/dist/node/react.esm.js +11 -10
- package/dist/node/react.esm.js.map +4 -4
- package/headless.cjs +8 -7
- package/headless.cjs.map +4 -4
- package/headless.js +8 -7
- package/headless.js.map +4 -4
- package/package.json +3 -4
- package/react.cjs +11 -12
- package/react.cjs.map +4 -4
- package/react.js +11 -12
- package/react.js.map +4 -4
- package/src/fetch.ts +7 -2
- package/test/FEAASBase.test.tsx +4 -4
- package/test/FEAASComponent.react.test.tsx +1 -1
- package/test/FEAASComponent.test.tsx +1 -1
- package/test/FEAASExternal.test.tsx +29 -12
- package/test/FEAASStylesheet.test.tsx +1 -1
- package/test/fetch.ts +21 -5
- package/types/fetch.d.ts +1 -1
- package/types/fetch.d.ts.map +1 -1
- package/types/utils/settings.d.ts +5 -5
package/dist/node/index.cjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
var Ue=Object.create;var xt=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var je=Object.getOwnPropertyNames;var We=Object.getPrototypeOf,He=Object.prototype.hasOwnProperty;var V=(t,e)=>{for(var r in e)xt(t,r,{get:e[r],enumerable:!0})},me=(t,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of je(e))!He.call(t,n)&&n!==r&&xt(t,n,{get:()=>e[n],enumerable:!(i=Ie(e,n))||i.enumerable});return t};var Be=(t,e,r)=>(r=t!=null?Ue(We(t)):{},me(e||!t||!t.__esModule?xt(r,"default",{value:t,enumerable:!0}):r,t)),ze=t=>me(xt({},"__esModule",{value:!0}),t);var tr={};V(tr,{Component:()=>rt,ComponentProps:()=>ie,Context:()=>I,ControlledPromise:()=>x,DEFAULT_CDN_URL:()=>T,DOM:()=>mt,DataPath:()=>ft,DataScope:()=>ut,DataSettings:()=>w,Element:()=>E,FEAASComponent:()=>rt,FEAASComponentsProps:()=>ie,FEAASContext:()=>I,FEAASContextProps:()=>he,FEAASEditor:()=>nt,FEAASEditorProps:()=>de,FEAASElement:()=>E,FEAASLoader:()=>it,FEAASLoaderProps:()=>ne,FEAASPicker:()=>ot,FEAASPickerProps:()=>ce,FEAASStylesheet:()=>At,FEAASStylesheetProps:()=>oe,InvalidResponse:()=>gt,JSONPath:()=>m,Loader:()=>it,MyComponent:()=>ht,Picker:()=>ot,Stylesheet:()=>At,Thumbnail:()=>Et,WebComponent:()=>$t,adjustNumbers:()=>qt,autoloadScripts:()=>Bt,cleanCollectionBit:()=>K,clearFetchCache:()=>xe,createStylesheet:()=>te,customizeDataSettings:()=>_.customizeDataSettings,fetchAndRevalidate:()=>Y,fetchAndRevalidateComponent:()=>z,fetchAndRevalidateStylesheet:()=>yt,fetchBypassingCache:()=>vt,fetchCache:()=>X,fetchComponent:()=>_e,fetchData:()=>Nt,fetchToValidateCache:()=>Q,fetchWithCacheAwareness:()=>U,findStylesheet:()=>Zt,getComponent:()=>_.getComponent,getComponentSource:()=>Se,getComponentURL:()=>Rt,getFetchCache:()=>Yt,getFramePosition:()=>le,getHumanizedLabel:()=>Gt,getLastPathBit:()=>Kt,getQualifier:()=>Jt,getStylesheetSource:()=>Re,getStylesheetURL:()=>tt,loadScript:()=>G,loadStylesheet:()=>bt,loadStylesheetAllowStale:()=>_t,normalizeCollectionScope:()=>pt,observeDOMElement:()=>Ht,parseComponentSource:()=>Z,parseLimit:()=>zt,parseRange:()=>Vt,parseStylesheetSource:()=>B,queryObject:()=>H,queryObjectRaw:()=>St,queryScopes:()=>q,registerComponent:()=>_.registerComponent,registerDatasource:()=>_.registerDatasource,renderComponent:()=>kt,renderComponentElement:()=>Ne,renderComponentPromise:()=>ee,renderDOMContent:()=>F,renderDOMElement:()=>R,renderHTMLContent:()=>Xt,renderStylesheet:()=>ke,renderStylesheetPromise:()=>Qt,serializeCH1RichText:()=>L,setDOMAttribute:()=>O});module.exports=ze(tr);var ue={};V(ue,{Component:()=>rt,ComponentProps:()=>ie,Context:()=>I,ControlledPromise:()=>x,DEFAULT_CDN_URL:()=>T,DOM:()=>mt,DataPath:()=>ft,DataScope:()=>ut,DataSettings:()=>w,Element:()=>E,FEAASComponent:()=>rt,FEAASComponentsProps:()=>ie,FEAASContext:()=>I,FEAASContextProps:()=>he,FEAASEditor:()=>nt,FEAASEditorProps:()=>de,FEAASElement:()=>E,FEAASLoader:()=>it,FEAASLoaderProps:()=>ne,FEAASPicker:()=>ot,FEAASPickerProps:()=>ce,FEAASStylesheet:()=>At,FEAASStylesheetProps:()=>oe,InvalidResponse:()=>gt,JSONPath:()=>m,Loader:()=>it,MyComponent:()=>ht,Picker:()=>ot,Stylesheet:()=>At,Thumbnail:()=>Et,WebComponent:()=>$t,adjustNumbers:()=>qt,autoloadScripts:()=>Bt,cleanCollectionBit:()=>K,clearFetchCache:()=>xe,createStylesheet:()=>te,customizeDataSettings:()=>_.customizeDataSettings,fetchAndRevalidate:()=>Y,fetchAndRevalidateComponent:()=>z,fetchAndRevalidateStylesheet:()=>yt,fetchBypassingCache:()=>vt,fetchCache:()=>X,fetchComponent:()=>_e,fetchData:()=>Nt,fetchToValidateCache:()=>Q,fetchWithCacheAwareness:()=>U,findStylesheet:()=>Zt,getComponent:()=>_.getComponent,getComponentSource:()=>Se,getComponentURL:()=>Rt,getFetchCache:()=>Yt,getFramePosition:()=>le,getHumanizedLabel:()=>Gt,getLastPathBit:()=>Kt,getQualifier:()=>Jt,getStylesheetSource:()=>Re,getStylesheetURL:()=>tt,loadScript:()=>G,loadStylesheet:()=>bt,loadStylesheetAllowStale:()=>_t,normalizeCollectionScope:()=>pt,observeDOMElement:()=>Ht,parseComponentSource:()=>Z,parseLimit:()=>zt,parseRange:()=>Vt,parseStylesheetSource:()=>B,queryObject:()=>H,queryObjectRaw:()=>St,queryScopes:()=>q,registerComponent:()=>_.registerComponent,registerDatasource:()=>_.registerDatasource,renderComponent:()=>kt,renderComponentElement:()=>Ne,renderComponentPromise:()=>ee,renderDOMContent:()=>F,renderDOMElement:()=>R,renderHTMLContent:()=>Xt,renderStylesheet:()=>ke,renderStylesheetPromise:()=>Qt,serializeCH1RichText:()=>L,setDOMAttribute:()=>O});function x(t,e=r=>{}){var r;let i=()=>{var n,o;let s=new Promise((l,d)=>{n=h=>{t==null||t(h),l(h)},o=d});var a=Object.assign(s,{resolve:n,reject:o,restart:i,first:r});return r=a,a.catch(e),a};return i()}var $t=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,E=class extends $t{getProps(e){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=x(e=>{this.payload=e}),this.whenRendered=x(()=>this.initialized=!0,()=>this.cancelRender()),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(e,r,i){this.set()}connectedCallback(){this.mount()}disconnectedCallback(){this.unmount()}mount(){try{let e=this.getParent();if(e&&!e.connected||this.connected)return;this.connected=!0,this.log("FEAAS: Mount",this.tagName,this),this.dispatchEventIndirectly(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var i;return(i=r.mount)===null||i===void 0?void 0:i.call(r)}),this.set()}catch(e){this.onError(e)}}dispatchEventIndirectly(e){this.dispatchEvent(e);let r=this.getParent();r&&!r.contains(this)&&(Object.defineProperty(e,"target",{value:this,writable:!1}),Object.defineProperty(e,"composedPath",{value:()=>[this],writable:!1}),r.handleEvent(e))}isJSONAttribute(e){return!1}log(...e){let r=e[0];(typeof location!="undefined"&&(location!=null&&location.hostname.startsWith("components-"))||localStorage["Sitecore.Components.Debug"])&&console.log(r+" "+e.slice(1).map(i=>i&&typeof i=="object"?"%O":"%s").join(" "),...e.slice(1))}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEventIndirectly(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected&&this.initialized&&this.render&&this.update(),this.cancelRender(),this.connected=!1,this.initialized&&this.render&&this.update())}getParent(e=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!e||r.tagName.startsWith("FEAAS-"))return r;if(this.tagName!="FEAAS-CONTEXT")return document.querySelector("feaas-context")}getElements(e=this.getRoot(),r=!0){return Array.from(e.querySelectorAll("*")).map(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.shadowRoot,r):null]).flat().filter(Boolean)}handleEvent(e){let r=e.composedPath()[0];switch(e.type){case"feaasMount":r!=this&&this.nestedCallback(r);break;case"feaasUnmount":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(e){let r=this.descendants.indexOf(e);r!=-1&&(this.log("FEAAS: Unnest",this,e),this.descendants.splice(r,1),this.refs[e.getComponentName()]=null,e.refs.parent==this&&(e.refs.parent=null),e.refs.top==this&&(e.refs.top=e.refs.parent))}nestedCallback(e){var r,i;if(this.descendants.indexOf(e)==-1&&(this.descendants.push(e),this.log("FEAAS: Nest",this,e),this.refs[e.getComponentName()]=e,e.refs.top=this,(r=e.refs).parent||(r.parent=this),e.render))for(var o=e.refs.parent;o;o=o.refs.parent)o.render&&((i=e.refs).parentReact||(i.parentReact=o),e.refs.topReact=o)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(e,r="uncaught",i=!1){let n=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:e});if(this.dispatchEventIndirectly(n),this.whenLoaded.reject(e),!n.defaultPrevented&&!i){this.whenRendered.reject(e);try{this.unmount()}catch(o){}return!0}return!1}shouldUpdateOnLoad(){return!0}async advance(){try{if(this.payload===void 0){if(!this.isReadyToLoad())return;this.payload=null,this.dispatchEventIndirectly(new Event("feaasLoad",{bubbles:!0,composed:!0}));let e=await this.load().catch(r=>{throw this.payload=void 0,r});if(this.whenLoaded.resolve(e),this.onLoad)return}else if(this.payload==null)return;this.flush(),this.whenRendered.resolve(this)}catch(e){this.onError(e)}}flush(){var e,r;if(!this.connected)return;let i=(r=(e=this.payload)===null||e===void 0?void 0:e.ReactDOM)===null||r===void 0?void 0:r.flushSync;i?i(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var e,r,i;if(this.payload==null||!this.render)return;let{React:n,ReactDOM:o,ReactDOMClient:s}=this.payload||{};if(!n)throw new Error(`${this.tagName}: React is not present in payload`);if(!o)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);this.getAttribute("hydrate")=="false"&&this.firstElementChild||(!this.refs.topReact&&!this.forceUpdateReact?(this.reactRoot||(this.reactRoot=s.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):this.forceUpdateReact&&this.connected?(e=this.forceUpdateReact)===null||e===void 0||e.call(this):(i=(r=this.refs.topReact)===null||r===void 0?void 0:r.forceUpdateReact)===null||i===void 0||i.call(r))}invokeReactRendering(){let{React:e,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let i=this.descendants.filter(n=>n.refs.parentReact==this&&n.payload&&n.connected).map((n,o)=>this.getReactElement(n));return this.render({...this.props,children:i},this.payload)}getReactErrorBoundary(e=this,r=e.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:i,ReactDOM:n}=e.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends i.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,a){console.error(`FEAAS: ${e.tagName} Error:`,s,a),e.onError(s,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(e=this,r){let{React:i,ReactDOM:n}=e.payload||{},o=this.getReactErrorBoundary(),s=this.getReactWrapper(e);return i.createElement(o,{key:e.tagName+"-"+e.getUID(),slot:e.getAttribute("slot")},i.createElement(s,null))}getReactWrapper(e=this,r=e.tagName){if(e.reactWrapper)return e.reactWrapper;let{React:i,ReactDOM:n}=e.payload||{};return e.reactWrapper=o=>{if(e.render){let[s,a]=i.useReducer(l=>l+1,0);return e.forceUpdateReact=a,n.createPortal(i.createElement(i.Fragment,null,e.invokeReactRendering()),e.getReactRootElement())}else return e.update()},Object.assign(e.reactWrapper,{key:e.tagName+"-"+e.getUID(),displayName:r}),e.reactWrapper}getUID(){return this.uid||(this.uid=String(Math.random()))}getShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}getReactRootElement(){return this.useShadowRoot?this.getShadowRoot():this.getRoot()}set(e){try{this.scheduleRender(),this.overrides={...this.overrides,...e},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let n=this.isJSONAttribute(r),o=this.props[r],s=n?JSON.stringify(o):String(o),a=this.defaultProps[r],l=n?JSON.stringify(a):String(a),d=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),h=this.getAttribute(d);try{var i=n?JSON.stringify(JSON.parse(h)):h}catch(f){var i=null}o==null||s===l?this.removeAttribute(d):(typeof o=="string"||typeof o=="number"||typeof o=="boolean"||n)&&i!=s&&this.setAttribute(d,s)}}catch(n){this.whenRendered.reject(n),this.onError(n,"set")}return this}import(e){return import( /*@vite-ignore*/ /* webpackIgnore: true */ e)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),this.cancelRender(),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(e=>{})})}cancelRender(){cancelAnimationFrame(this.nextRender)}formatURL(e,r){return typeof e=="string"&&e.match(/^\/[^\/]/)?r+e:e}getContextAttribute(e,r=this){for(var i=this;i=i.parentElement||(i.parentNode instanceof ShadowRoot?i.parentNode.host:null);)if(i.getAttribute(e)!=null)return i.getAttribute(e);return this.getAttribute(e)}static register(e,r){r==null&&(r=typeof window!="undefined"?window:null),r&&!r.customElements.get(e)&&r.customElements.define(e,this)}};var J=class extends E{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom/client")]).then(([e,r,i])=>({React:e,ReactDOM:r,ReactDOMClient:i}))}render({},{React:e}){return e.createElement(e.Fragment,null)}},ht=class extends J{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:e},{React:r}){let[i,n]=r.useState(0);return r.useEffect(()=>{n(o=>o+1)},[e]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",e),r.createElement("p",null,"Triggered updates: ",i))}};ht.observedAttributes=["counter"];var mt={};V(mt,{renderDOMContent:()=>F,renderDOMElement:()=>R,renderHTMLContent:()=>Xt,setDOMAttribute:()=>O});var ut={};V(ut,{JSONPath:()=>m,queryObject:()=>H,queryObjectRaw:()=>St,queryScopes:()=>q,serializeCH1RichText:()=>L});var ge=Be(require("vm"),1),{hasOwnProperty:S}=Object.prototype;function W(t,e){return t=t.slice(),t.push(e),t}function Ft(t,e){return e=e.slice(),e.unshift(t),e}var Ut=class extends Error{constructor(e){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=e,this.name="NewError"}};function m(t,e,r,i,n){if(!(this instanceof m))try{return new m(t,e,r,i,n)}catch(s){if(!s.avoidNew)throw s;return s.value}typeof t=="string"&&(n=i,i=r,r=e,e=t,t=null);let o=t&&typeof t=="object";if(t=t||{},this.json=t.json||r,this.path=t.path||e,this.resultType=t.resultType||"value",this.flatten=t.flatten||!1,this.wrap=S.call(t,"wrap")?t.wrap:!0,this.sandbox=t.sandbox||{},this.preventEval=t.preventEval||!1,this.parent=t.parent||null,this.parentProperty=t.parentProperty||null,this.callback=t.callback||i||null,this.otherTypeCallback=t.otherTypeCallback||n||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},t.autostart!==!1){let s={path:o?t.path:e};o?"json"in t&&(s.json=t.json):s.json=r;let a=this.evaluate(s);if(!a||typeof a!="object")throw new Ut(a);return a}}m.prototype.evaluate=function(t,e,r,i){let n=this.parent,o=this.parentProperty,{flatten:s,wrap:a}=this;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=i||this.otherTypeCallback,e=e||this.json,t=t||this.path,t&&typeof t=="object"&&!Array.isArray(t)){if(!t.path&&t.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!S.call(t,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:e}=t),s=S.call(t,"flatten")?t.flatten:s,this.currResultType=S.call(t,"resultType")?t.resultType:this.currResultType,this.currSandbox=S.call(t,"sandbox")?t.sandbox:this.currSandbox,a=S.call(t,"wrap")?t.wrap:a,this.currPreventEval=S.call(t,"preventEval")?t.preventEval:this.currPreventEval,r=S.call(t,"callback")?t.callback:r,this.currOtherTypeCallback=S.call(t,"otherTypeCallback")?t.otherTypeCallback:this.currOtherTypeCallback,n=S.call(t,"parent")?t.parent:n,o=S.call(t,"parentProperty")?t.parentProperty:o,t=t.path}if(n=n||null,o=o||null,Array.isArray(t)&&(t=m.toPathString(t)),!t&&t!==""||!e)return;let l=m.toPathArray(t);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;let d=this._trace(l,e,["$"],n,o,r).filter(function(h){return h&&!h.isParentSelector});return d.length?!a&&d.length===1&&!d[0].hasArrExpr?this._getPreferredOutput(d[0]):d.reduce((h,f)=>{let u=this._getPreferredOutput(f);return s&&Array.isArray(u)?h=h.concat(u):h.push(u),h},[]):a?[]:void 0};m.prototype._getPreferredOutput=function(t){let e=this.currResultType;switch(e){case"all":{let r=Array.isArray(t.path)?t.path:m.toPathArray(t.path);return t.pointer=m.toPointer(r),t.path=typeof t.path=="string"?t.path:m.toPathString(t.path),t}case"value":case"parent":case"parentProperty":return t[e];case"path":return m.toPathString(t[e]);case"pointer":return m.toPointer(t.path);default:throw new TypeError("Unknown result type")}};m.prototype._handleCallback=function(t,e,r){if(e){let i=this._getPreferredOutput(t);t.path=typeof t.path=="string"?t.path:m.toPathString(t.path),e(i,r,t)}};m.prototype._trace=function(t,e,r,i,n,o,s,a){let l;if(!t.length)return l={path:r,value:e,parent:i,parentProperty:n,hasArrExpr:s},this._handleCallback(l,o,"value"),l;let d=t[0],h=t.slice(1),f=[];function u(c){Array.isArray(c)?c.forEach(p=>{f.push(p)}):f.push(c)}if((typeof d!="string"||a)&&e&&S.call(e,d))u(this._trace(h,e[d],W(r,d),e,d,o,s));else if(d==="*")this._walk(e,c=>{u(this._trace(h,e[c],W(r,c),e,c,o,!0,!0))});else if(d==="..")u(this._trace(h,e,r,i,n,o,s)),this._walk(e,c=>{typeof e[c]=="object"&&u(this._trace(t.slice(),e[c],W(r,c),e,c,o,!0))});else{if(d==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:h,isParentSelector:!0};if(d==="~")return l={path:W(r,d),value:n,parent:i,parentProperty:null},this._handleCallback(l,o,"property"),l;if(d==="$")u(this._trace(h,e,r,null,null,o,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(d))u(this._slice(d,h,e,r,i,n,o));else if(d.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let c=d.replace(/^\?\((.*?)\)$/u,"$1");this._walk(e,p=>{this._eval(c,e[p],p,r,i,n)&&u(this._trace(h,e[p],W(r,p),e,p,o,!0))})}else if(d[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");u(this._trace(Ft(this._eval(d,e,r[r.length-1],r.slice(0,-1),i,n),h),e,r,i,n,o,s))}else if(d[0]==="@"){let c=!1,p=d.slice(1,-2);switch(p){case"scalar":(!e||!["object","function"].includes(typeof e))&&(c=!0);break;case"boolean":case"string":case"undefined":case"function":typeof e===p&&(c=!0);break;case"integer":Number.isFinite(e)&&!(e%1)&&(c=!0);break;case"number":Number.isFinite(e)&&(c=!0);break;case"nonFinite":typeof e=="number"&&!Number.isFinite(e)&&(c=!0);break;case"object":e&&typeof e===p&&(c=!0);break;case"array":Array.isArray(e)&&(c=!0);break;case"other":c=this.currOtherTypeCallback(e,r,i,n);break;case"null":e===null&&(c=!0);break;default:throw new TypeError("Unknown value type "+p)}if(c)return l={path:r,value:e,parent:i,parentProperty:n},this._handleCallback(l,o,"value"),l}else if(d[0]==="`"&&e&&S.call(e,d.slice(1))){let c=d.slice(1);u(this._trace(h,e[c],W(r,c),e,c,o,s,!0))}else if(d.includes(",")){let c=d.split(",");for(let p of c)u(this._trace(Ft(p,h),e,r,i,n,o,!0))}else!a&&e&&S.call(e,d)&&u(this._trace(h,e[d],W(r,d),e,d,o,s,!0))}if(this._hasParentSelector)for(let c=0;c<f.length;c++){let p=f[c];if(p&&p.isParentSelector){let b=this._trace(p.expr,e,p.path,i,n,o,s);if(Array.isArray(b)){f[c]=b[0];let A=b.length;for(let g=1;g<A;g++)c++,f.splice(c,0,b[g])}else f[c]=b}}return f};m.prototype._walk=function(t,e){if(Array.isArray(t)){let r=t.length;for(let i=0;i<r;i++)e(i)}else t&&typeof t=="object"&&Object.keys(t).forEach(r=>{e(r)})};m.prototype._slice=function(t,e,r,i,n,o,s){if(!Array.isArray(r))return;let a=r.length,l=t.split(":"),d=l[2]&&Number.parseInt(l[2])||1,h=l[0]&&Number.parseInt(l[0])||0,f=l[1]&&Number.parseInt(l[1])||a;h=h<0?Math.max(0,h+a):Math.min(a,h),f=f<0?Math.max(0,f+a):Math.min(a,f);let u=[];for(let c=h;c<f;c+=d)this._trace(Ft(c,e),r,i,n,o,s,!0).forEach(b=>{u.push(b)});return u};m.prototype._eval=function(t,e,r,i,n,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=n,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=e;let s=t.includes("@path");s&&(this.currSandbox._$_path=m.toPathString(i.concat([r])));let a="script:"+t;if(!m.cache[a]){let l=t.replace(/@parentProperty/gu,"_$_parentProperty").replace(/@parent/gu,"_$_parent").replace(/@property/gu,"_$_property").replace(/@root/gu,"_$_root").replace(/@([.\s)[])/gu,"_$_v$1");s&&(l=l.replace(/@path/gu,"_$_path")),m.cache[a]=new this.vm.Script(l)}try{return m.cache[a].runInNewContext(this.currSandbox)}catch(l){throw new Error("jsonPath: "+l.message+": "+t)}};m.cache={};m.toPathString=function(t){let e=t,r=e.length,i="$";for(let n=1;n<r;n++)/^(~|\^|@.*?\(\))$/u.test(e[n])||(i+=/^[0-9*]+$/u.test(e[n])?"["+e[n]+"]":"['"+e[n]+"']");return i};m.toPointer=function(t){let e=t,r=e.length,i="";for(let n=1;n<r;n++)/^(~|\^|@.*?\(\))$/u.test(e[n])||(i+="/"+e[n].toString().replace(/~/gu,"~0").replace(/\//gu,"~1"));return i};m.toPathArray=function(t){let{cache:e}=m;if(e[t])return e[t].concat();let r=[],n=t.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replace(/[['](\??\(.*?\))[\]']/gu,function(o,s){return"[#"+(r.push(s)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(o,s){return"['"+s.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(o,s){return";"+s.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"").split(";").map(function(o){let s=o.match(/#(\d+)/u);return!s||!s[1]?o:r[s[1]]});return e[t]=n,e[t].concat()};m.prototype.vm=ge.default;function St(t,e){try{return m({path:e,json:t})}catch(r){return[]}}function H(t,e,r=!0){let i=St(t,e)||[];return r?i.flat(1/0):i}function q(t,e,r=!1,i=t,n=!0){var o=e;let s=Object.keys(t).sort((l,d)=>d.length-l.length);for(let l of s)if(e.startsWith(l)){if(l==e){if(r)return t[l];continue}o=e.substring(l.length+1),i=t[l];break}var a=H(i,o,n);return a.length==0&&(a=[o.replace(/^.*?\./,"_."),o.replace(/^.*?\./,""),o.replace(/^([^.]+).*?\.\$([\.\[])/,"$1$2"),o.replace(/^.*?\.\$([\.\[])/,"_$1"),o.replace(/^.*?\.\$([\.\[])/,"$$$1"),o.replace(/^[^.]+$/,"_")].filter((l,d,h)=>h.indexOf(l)===d).reduce((l,d)=>l.length>0?l:H(i,d,n),[])),r?a[0]:a}function It(t,e={},r){return r?`<${r}${Object.entries(e).map(([i,n])=>n!=null&&` ${i}="${n}"`).filter(Boolean).join("")}>${L(t)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):L(t)}function L(t){var e;if(Array.isArray(t))return t.map(L).join(`
|
|
2
|
-
`).trim();if(typeof t=="string")return t;if(t==null)return"";switch(t.type){case"heading":let{level:r,...i}=t.attrs;return It(t.content,i,"h"+r);case"text":return(t.marks||[]).reduce((n,o)=>It(n,o.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[o.type]),(e=t.text)===null||e===void 0?void 0:e.replace(/\s+/," "));default:return It(t.content||t.text,t.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[t.type])}}var $=class{constructor(e,r=1,i){this.ownerDocument={createElement(n){return new $(n)},createDocumentFragment(){return new $(null,11)}},this.nodeName=e,this.nodeType=r,this.textContent=i,this.attributes=[],this.childNodes=[]}setAttribute(e,r){let i=this.attributes.find(n=>n.name===e);i?i.value=r:this.attributes.push({name:e,value:r})}getAttribute(e){let r=this.attributes.find(i=>i.name===e);return r?r.value:void 0}insertBefore(e,r){if(e.parentNode=this,r===null)this.childNodes.push(e);else{let i=this.childNodes.indexOf(r);i!==-1&&this.childNodes.splice(i,0,e)}}removeAttribute(e){let r=this.attributes.findIndex(i=>i.name===e);r!==-1&&this.attributes.splice(r,1)}appendChild(e){e.parentNode=this,this.childNodes.push(e)}get tagName(){var e;return(e=this.nodeName)===null||e===void 0?void 0:e.toUpperCase()}get localName(){var e;return(e=this.nodeName)===null||e===void 0?void 0:e.toLowerCase()}get innerHTML(){return jt(this.childNodes)}set innerHTML(e){this.childNodes=Wt(String(e!=null?e:""))}get outerHTML(){return jt([this])}get children(){return this.childNodes.filter(e=>e.nodeType==1)}closest(e){let r=this;for(;r;){if(ve(e,r))return r;r=r.parentNode}return null}querySelectorAll(e){let r=e.split(/\s*,\s*/),i=[],n=o=>{for(let s of r)if(ve(s,o)){i.push(o);break}for(let s of o.childNodes)n(s)};for(let o of this.childNodes)n(o);return i}querySelector(e){return this.querySelectorAll(e)[0]}findSibling(e,r){if(!this.parentNode)return null;let i=this.parentNode.childNodes,n=i.indexOf(this);if(n===-1)return null;for(let o=n+e;o>=0&&o<i.length;o+=e){let s=i[o];if(!r||s.nodeType===1)return s}return null}removeChild(e){let r=this.childNodes.indexOf(e);if(r!==-1)return this.childNodes.splice(r,1),e.parentNode=void 0,e}get previousSibling(){return this.findSibling(-1)}get nextSibling(){return this.findSibling(1)}get previousElementSibling(){return this.findSibling(-1,!0)}get nextElementSibling(){return this.findSibling(1,!0)}cloneNode(e=!1){let r=new $(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),e)for(let i of this.childNodes){let n=i.cloneNode(!0);r.appendChild(n)}return r}get parentElement(){var e;return((e=this.parentNode)===null||e===void 0?void 0:e.nodeType)==1?this.parentNode:null}};function ve(t,e){let r=t.match(/([.#]?[\w-]+|\[([\w-]+)(="([^"]*)")?\])/g);if(!r)return!1;for(let i of r)if(i.startsWith("#")){if(e.getAttribute("id")!==i.slice(1))return!1}else if(i.startsWith(".")){if(!(e.getAttribute("class")||"").split(" ").includes(i.slice(1)))return!1}else if(i.startsWith("[")){let n=i.match(/^\[([\w-]+)(="([^"]*)")?\]$/);if(n){let o=n[1],s=n[3],a=e.getAttribute(o);if(typeof s=="undefined"){if(a===void 0)return!1}else if(a!==s)return!1}else return!1}else if(e.nodeName!==i)return!1;return!0}function Wt(t){var e;let r=[],i=[];for(;t;){let n=t.match(/^<([\w-]+)(\s[^>]*)?>/),o=t.match(/^<\/([\w-]+)>/);if(n){let s=n[1].toLowerCase(),l=((e=(n[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||e===void 0?void 0:e.map(h=>{let[f,u,,c]=h.match(/([\w-]+)(="([^"]*)")?/);return{name:u,value:Je(c||"")}}))||[],d=new $(s,1);if(d.attributes=l,i.length>0){let h=i[i.length-1];h.childNodes.push(d),d.parentNode=h}else r.push(d);["img","input","br"].includes(s)||i.push(d),t=t.slice(n[0].length)}else if(o)i.pop(),t=t.slice(o[0].length);else{let s=t.indexOf("<"),a=t.slice(0,s!==-1?s:void 0),l=new $("#text",3);if(l.textContent=a,i.length>0){let d=i[i.length-1];d.childNodes.push(l),l.parentNode=d}else r.push(l);t=t.slice(a.length)}}return r}function Ve(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Je(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}function jt(t){return t.map(e=>{if(e.nodeType===3)return e.textContent||"";let{nodeName:r,attributes:i}=e,n=i.map(({name:s,value:a})=>` ${s}="${Ve(String(a))}"`).join(""),o=jt(e.childNodes);return["img","input","br"].includes(r)?`<${r}${n} />`:`<${r}${n}>${o}</${r}>`}).join("")}function Ht(t){let e=new t.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let n=i.target,o=n.getAttribute("data-embed-src");o&&G(n,o),i.addedNodes&&i.addedNodes.forEach(s=>{s.nodeType==1&&Bt(s,!1)})})});return e.observe(t,{attributes:!0,subtree:!0,childList:!0}),e}function Bt(t,e=!0){let r=t.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let n=r[i];G(n,n.getAttribute("data-embed-src"))}if(e)return Ht(t)}function G(t,e){for(var r=t;r;r=r.parentElement)if(!r.parentElement){let n=r.querySelectorAll("script");for(var i=0;i<n.length;i++)if(n[i].getAttribute("src")==e)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let o=r.ownerDocument.createElement("script");o.setAttribute("type","module"),o.setAttribute("src",e),r.appendChild(o);break}}var ft={};V(ft,{adjustNumbers:()=>qt,cleanCollectionBit:()=>K,getHumanizedLabel:()=>Gt,getLastPathBit:()=>Kt,getQualifier:()=>Jt,normalizeCollectionScope:()=>pt,parseLimit:()=>zt,parseRange:()=>Vt});var zt=t=>{var e;let r=parseInt((e=t==null?void 0:t.match(/\[0:(\d+)\]/))===null||e===void 0?void 0:e[1],10);return!isNaN(r)&&r>0?String(r):null},Vt=t=>{var e;let r=(e=t==null?void 0:t.match(/\[([^\]]+)\]/))===null||e===void 0?void 0:e[1].split(/\s*,\s*/g).filter(Boolean).map(i=>{if(i.match(/^-?\d+$/))return i;let n=i.match(/^(\d+):(\d+)$/);return n&&parseInt(n[1],10)<parseInt(n[2],10)?n[1]+"-"+n[2]:null});return r!=null&&r.every(Boolean)?r.join(","):null},Jt=t=>{var e;return(e=t==null?void 0:t.match(/(\.\*|\[[^\]]*\])$/))===null||e===void 0?void 0:e[0]};function K(t){return t.replace(/(\.?\[[^\]\[]*\]|\.\*)$/g,"")}function pt(t){return K(t)+".*"}function qt(t,e){return t==null?void 0:t.replace(/(.|^)(\d+)/g,(r,i,n)=>i+(i==":"?n:String(parseInt(n)+e)))}function Gt(t,e=2){var r=K(t).split(/]\.|\.\*\./g).pop().split(/\./g).slice(-3);return r=r.filter(i=>isNaN(parseInt(i))),r.map(i=>i.charAt(0).toUpperCase()+i.slice(1)).slice(-e).join(" ")}function Kt(t){return K(t).split(".").pop()}var qe=["January","February","March","April","May","June","July","August","September","October","November","December"],ye=t=>{if(!t||typeof t.getDay!="function")return;let e=t.getFullYear(),r=qe[t.getMonth()],i=t.getDate();return`${r} ${i}, ${e}`},be=function(t){return String(new Date(t))!=="Invalid Date"&&!isNaN(Number(new Date(t)))};function Ee(t){let e=t.getAttribute("data-path-scope");for(var r=0,i=t;i=i.previousElementSibling;)i.getAttribute("data-path-scope")==e&&r++;return r}function Ge(t,e,r){let i=t.getAttribute("data-path-scope");if(i==null)return;var n=Ee(t);if(n!=0)return;let o=t.parentNode;if(o!=null){e==0?t.setAttribute("hidden","hidden"):t.getAttribute("hidden")!=null&&t.removeAttribute("hidden");for(var s=n+1,a=t,l=t;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==i&&(s++,a=l);for(var d=s;d<e;d++)o.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var d=Math.max(1,e);d<s;d++)a=a.previousElementSibling,o.removeChild(a.nextElementSibling)}}function O(t,e,r,i,n=!0){var o,s,a;if(!t)return;var l=t;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=L(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(t,e,r));var d=e.replace("data-path-","");if(e=="data-path-src"||e=="data-path-alt"){let g=Array.from(t.children).find(k=>k.localName=="picture")||t;l=t.localName=="img"?t:g.querySelector("img, video")}else if(e=="data-path-href")l=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")d="innerHTML";else if(e=="data-embed-src"&&n)G(t,r);else if(e=="data-path-attributes"){if(!Array.isArray(r)){let g=((o=t.getAttribute("data-attributes-keys"))===null||o===void 0?void 0:o.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var h in r){var f=r[h];O(t,h,typeof f=="object"&&f?JSON.stringify(f):f,i,n)}for(var u=0;u<g.length;u++)(r==null||!(g[u]in r))&&O(t,g[u],null,i,n);O(t,"data-attributes-keys",Object.keys(r||{}).join(","),{},n)}if(t.tagName=="FEAAS-EXTERNAL"){let g=String(t.getAttribute("data-path-attributes")||"").slice(0,-1).split(".")[0]||"_";O(t,"datasources",JSON.stringify({[g]:r}),{},n)}return}if(typeof r=="boolean"&&d!=="hidden"&&(r=r?"":null),!l)return;if((d=="innerHTML"||d=="src")&&(r==null||r==="")){var p=String((a=(s=t.getAttribute("data-path-placeholder")||l[d])!==null&&s!==void 0?s:l.getAttribute(d))!==null&&a!==void 0?a:"");d=="innerHTML"?l.innerHTML=p:p?l.setAttribute(d,p):l.removeAttribute(d)}else if(r!=null)if(d=="innerHTML"){for(var b=String(r),A=l;A.parentElement&&A.localName.match(/^(a|var|strong|em|i|b)$/);)A=A.parentElement;A.localName.match(/p|h\d|button|time|li/)&&(b=b.replace(/<(p|h\d|li|ul)[^>]*?>|<\/(p|h\d|li|ul)[^>]*?>/g," ").trim().replace(/\s+/g," ")),String(A.getAttribute("class")).includes("-inline--time")&&be(b)&&(b=ye(new Date(b))),l.innerHTML!=b&&(l.innerHTML=b)}else l.getAttribute(d)!=r&&l.setAttribute(d,r);else l.removeAttribute(d)}var Ae=["data-attributes-keys","data-path-attributes","data-path-scope"];function R(t,e,r,i,n=!0){var o,s,a;let l=t;if(i||(e=((o=r==null?void 0:r.processData)===null||o===void 0?void 0:o.call(r,l,e))||e),l.nodeType==1){let f=l.getAttribute("data-path-scope");if(f){let c=Ee(l),p=q(e,f,!1);c==0&&Ge(l,((s=r==null?void 0:r.shouldRepeat)===null||s===void 0?void 0:s.call(r,l,p))===!1?1:p.length,r),e={...e,[pt(f)]:p[c]}}let u=Array.prototype.slice.call(l.attributes).sort((c,p)=>Ae.indexOf(c.name)-Ae.indexOf(p.name));for(var d=0;d<u.length;d++){let{name:c,value:p}=u[d];c.startsWith("data-path")&&c!="data-path-scope"&&O(l,c,q(e,p,!0,void 0,l.tagName!="FEAAS-EXTERNAL"),r,n),c=="data-embed-src"&&O(l,c,l.getAttribute(c),r,n)}}for(var d=0,h;h=l.childNodes[d++];)we(h)&&R(h,e,r,!0,n);return i||(a=r==null?void 0:r.onRender)===null||a===void 0||a.call(r,l,e),l}function we(t){return t.nodeType==1}function F(t,e,r,i,n=!0){var o;let s=((o=i==null?void 0:i.processTemplate)===null||o===void 0?void 0:o.call(i,t,e,r))||e;if(t.innerHTML=s,t.classList.add("-feaas"),(t.closest(".component.feaas")||t).className.includes("-theme--"))for(var l=0,d;d=t.childNodes[l++];)we(d)&&(d.className=d.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return R(t,r,i,null,n)}function Xt(t,e,r,i=!1,n=!0){var o;let s=((o=r==null?void 0:r.processTemplate)===null||o===void 0?void 0:o.call(r,null,t,e))||t;if(typeof document=="undefined"||i){let a=Wt(s);return R(a[0],e,r,null,n).outerHTML}else{let a=document.createElement("div");return a.innerHTML=s,R(a,e,r,null,n),a.innerHTML}}var Ce=["initial","check","updated"],X={};function xe(){X={}}async function Y(t,e,r,i,n=X){return U({url:t,options:e,validator:r,callback:i,cache:n}).then(Q).then(o=>o.response)}async function U({url:t,options:e,validator:r,callback:i,cache:n},o="initial"){let s=new Date;if(n!=null){var a=Yt(t);if(Ce.indexOf(a.phase)>=Ce.indexOf(o))var l=a[o];else a.phase=o}let d=await(l||fetch(t,e));if(!l&&a&&(d.ok?a[o].resolve(d):a[o].reject(new Error("Fetch failed"))),!d.ok)throw new Error("Fetch failed");let h=new Date(d.headers.get("date"))<s||l&&o=="initial"&&(a.phase=="updated"||a.phase=="check");if((r==null?void 0:r(d,h))===!1)throw new gt("Response is not valid");return await(i==null?void 0:i(d,o,h)),{url:t,options:e,isCached:h,response:d,validator:r,callback:i,cache:n}}function Yt(t,e=!1){let r=String(t).replace("?head","");var i=X[r];return!i&&!e&&(i=X[r]={phase:null,initial:x(),check:x(),updated:x(),final:x()}),i}var gt=class extends Error{};async function Q(t){let{url:e,isCached:r,options:i,validator:n,response:o,cache:s}=t;if(r){let{response:a}=await U({url:e+(e.toString().includes("?")?"&":"?")+"head",options:{...i,method:"HEAD",cache:"no-cache"},validator:n,cache:s},"check");if(a.headers.get("last-modified")!=o.headers.get("last-modified"))return vt(t)}return t}async function vt(t){return U({...t,options:{...t.options,cache:"reload"}},"updated")}var T="https://feaas.blob.core.windows.net";function Z(t){let e=t==null?void 0:t.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(e){var[,r,i,n,o,s]=e;return{cdn:r,library:i,component:n,version:o,revision:s}}}function Se(t){if(!t||!t.library||!t.component)throw new Error("Component requires `library` and `component` properties");return`${t.cdn&&t.cdn!=T?`${t.cdn}/components`:""}/${t.library}/${t.component}/${!t.version||t.version=="responsive"&&(!t.revision||t.revision=="published")?"":t.version}/${!t.revision||t.revision=="published"?"":t.revision}`.replace(/(^\/|\/$|\/\/)(?!.+\/components\/)/g,"")}function Re(t){return`${t.cdn&&t.cdn!=T?`${t.cdn}/styles/`:""}${t.library}/${!t.revision||t.revision=="published"?"":t.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function B(t){let e=t==null?void 0:t.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(e){var[,r,i,n]=e;return{cdn:r,library:i,revision:n}}else{let o=Z(t);if(o){var{cdn:r,library:i,revision:n}=o;return n!=null&&n.match(/\d/)&&(n=void 0),{cdn:r,library:i,revision:n}}}}function Rt(t){return typeof t=="string"&&(t={src:t}),"src"in t&&t.src?t={...Z(t.src)}:t={...t},`${t.cdn||t.hostname||T}/components/${t.library}/${t.component}/${t.version||"responsive"}/${t.revision||"published"}.html`}function tt(t){if(typeof t=="string"&&(t={src:t}),"src"in t){if(String(t.src).includes("v1/files/components/styles"))return t.src;t={...B(t.src)}}else t={...t};return`${t.cdn||t.hostname||T}/styles/${t.library}/${t.revision=="staged"?"staged":t.revision=="saved"?"saved":"published"}.css`}async function z(t,e,r=!1){let i=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,n=a=>a.clone().text().then(e),o=await Promise.all([t.instance&&U({options:{headers:{Accept:"text/html"},credentials:"omit"},url:Rt({...t,version:t.instance}),validator:i}).catch(a=>a),U({url:Rt(t),validator:i}).catch(a=>a)]),s=o.find(a=>a&&"isCached"in a&&a);if(!s||s instanceof Error)throw o.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return o[0]==s&&console.log("Using fork!",o),await n(s.response),r?s:Q({...s,callback:n}).catch(a=>{if(o[0]==s&&(vt({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return n(o[1].response),Q({...o[1],callback:n});throw a})}async function _e(t){typeof t=="string"&&(t={src:t});var e;let{response:r}=await z(t,i=>{e=i},!0);return{...t,template:e,lastModified:r.headers.get("last-modified")}}async function yt(t,e){return Y(tt(t),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,i)=>r.clone().text().then(n=>e(n,i)))}function ke(t,e){return Qt(t,e||(e=document.createElement("style"))),e}function Qt(t,e){return e||(e=document.createElement("style")),yt(t,(r,i)=>{e.textContent=r}).then(()=>e)}var Ke=new WeakSet;function bt(t,e){var r,i=Zt(t);if(i){if(Ke.has(i))return Promise.resolve(i);t=i.getAttribute("data-href")||i.getAttribute("href")}return yt(t,(n,o)=>{o=="initial"&&i||(r||(r=!i||i.tagName=="LINK"?te(t):i),r.textContent=n),e==null||e(n,o)}).then(()=>r||i)}function _t(t){return new Promise((e,r)=>{bt(t,e).catch(r)})}function Zt(t){let e=tt(t),{library:r}=B(e),i=`/files/components/styles/${r}.css`;return document.querySelector(`style[data-href="${e}"],
|
|
3
|
-
link[rel="stylesheet"][href="${e}"],
|
|
1
|
+
var qe=Object.create;var Rt=Object.defineProperty;var Xe=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var Qe=Object.getPrototypeOf,Ye=Object.prototype.hasOwnProperty;var q=(e,t)=>{for(var r in t)Rt(e,r,{get:t[r],enumerable:!0})},Ae=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ge(t))!Ye.call(e,n)&&n!==r&&Rt(e,n,{get:()=>t[n],enumerable:!(i=Xe(t,n))||i.enumerable});return e};var Ze=(e,t,r)=>(r=e!=null?qe(Qe(e)):{},Ae(t||!e||!e.__esModule?Rt(r,"default",{value:e,enumerable:!0}):r,e)),Je=e=>Ae(Rt({},"__esModule",{value:!0}),e);var br={};q(br,{Component:()=>ot,ComponentProps:()=>he,Context:()=>H,ControlledPromise:()=>O,DEFAULT_CDN_URL:()=>_,DOM:()=>yt,DataPath:()=>bt,DataScope:()=>gt,DataSettings:()=>w,Element:()=>C,FEAASComponent:()=>ot,FEAASComponentsProps:()=>he,FEAASContext:()=>H,FEAASContextProps:()=>ye,FEAASEditor:()=>at,FEAASEditorProps:()=>me,FEAASElement:()=>C,FEAASLoader:()=>st,FEAASLoaderProps:()=>ce,FEAASPicker:()=>lt,FEAASPickerProps:()=>be,FEAASStylesheet:()=>Ct,FEAASStylesheetProps:()=>ue,InvalidResponse:()=>vt,JSONPath:()=>b,Loader:()=>st,MyComponent:()=>ft,Picker:()=>lt,Stylesheet:()=>Ct,Thumbnail:()=>wt,WebComponent:()=>Ft,adjustNumbers:()=>te,autoloadScripts:()=>Qt,cleanCollectionBit:()=>Z,clearFetchCache:()=>Te,createStylesheet:()=>ae,customizeDataSettings:()=>D.customizeDataSettings,fetchAndRevalidate:()=>tt,fetchAndRevalidateComponent:()=>K,fetchAndRevalidateStylesheet:()=>xt,fetchBypassingCache:()=>Et,fetchCache:()=>J,fetchComponent:()=>Ie,fetchData:()=>Nt,fetchToValidateCache:()=>et,fetchWithCacheAwareness:()=>B,findStylesheet:()=>se,getComponent:()=>D.getComponent,getComponentSource:()=>Me,getComponentURL:()=>Dt,getFetchCache:()=>ne,getFramePosition:()=>ge,getHumanizedLabel:()=>ee,getLastPathBit:()=>re,getQualifier:()=>Jt,getStylesheetSource:()=>Le,getStylesheetURL:()=>it,loadScript:()=>Y,loadStylesheet:()=>At,loadStylesheetAllowStale:()=>Pt,normalizeCollectionScope:()=>mt,observeDOMElement:()=>Gt,parseComponentSource:()=>rt,parseLimit:()=>Yt,parseRange:()=>Zt,parseStylesheetSource:()=>z,queryObject:()=>V,queryObjectRaw:()=>kt,queryScopes:()=>Q,registerComponent:()=>D.registerComponent,registerDatasource:()=>D.registerDatasource,renderComponent:()=>_t,renderComponentElement:()=>Ue,renderComponentPromise:()=>le,renderDOMContent:()=>j,renderDOMElement:()=>R,renderHTMLContent:()=>ie,renderStylesheet:()=>$e,renderStylesheetPromise:()=>oe,serializeCH1RichText:()=>U,setDOMAttribute:()=>M});module.exports=Je(br);var ve={};q(ve,{Component:()=>ot,ComponentProps:()=>he,Context:()=>H,ControlledPromise:()=>O,DEFAULT_CDN_URL:()=>_,DOM:()=>yt,DataPath:()=>bt,DataScope:()=>gt,DataSettings:()=>w,Element:()=>C,FEAASComponent:()=>ot,FEAASComponentsProps:()=>he,FEAASContext:()=>H,FEAASContextProps:()=>ye,FEAASEditor:()=>at,FEAASEditorProps:()=>me,FEAASElement:()=>C,FEAASLoader:()=>st,FEAASLoaderProps:()=>ce,FEAASPicker:()=>lt,FEAASPickerProps:()=>be,FEAASStylesheet:()=>Ct,FEAASStylesheetProps:()=>ue,InvalidResponse:()=>vt,JSONPath:()=>b,Loader:()=>st,MyComponent:()=>ft,Picker:()=>lt,Stylesheet:()=>Ct,Thumbnail:()=>wt,WebComponent:()=>Ft,adjustNumbers:()=>te,autoloadScripts:()=>Qt,cleanCollectionBit:()=>Z,clearFetchCache:()=>Te,createStylesheet:()=>ae,customizeDataSettings:()=>D.customizeDataSettings,fetchAndRevalidate:()=>tt,fetchAndRevalidateComponent:()=>K,fetchAndRevalidateStylesheet:()=>xt,fetchBypassingCache:()=>Et,fetchCache:()=>J,fetchComponent:()=>Ie,fetchData:()=>Nt,fetchToValidateCache:()=>et,fetchWithCacheAwareness:()=>B,findStylesheet:()=>se,getComponent:()=>D.getComponent,getComponentSource:()=>Me,getComponentURL:()=>Dt,getFetchCache:()=>ne,getFramePosition:()=>ge,getHumanizedLabel:()=>ee,getLastPathBit:()=>re,getQualifier:()=>Jt,getStylesheetSource:()=>Le,getStylesheetURL:()=>it,loadScript:()=>Y,loadStylesheet:()=>At,loadStylesheetAllowStale:()=>Pt,normalizeCollectionScope:()=>mt,observeDOMElement:()=>Gt,parseComponentSource:()=>rt,parseLimit:()=>Yt,parseRange:()=>Zt,parseStylesheetSource:()=>z,queryObject:()=>V,queryObjectRaw:()=>kt,queryScopes:()=>Q,registerComponent:()=>D.registerComponent,registerDatasource:()=>D.registerDatasource,renderComponent:()=>_t,renderComponentElement:()=>Ue,renderComponentPromise:()=>le,renderDOMContent:()=>j,renderDOMElement:()=>R,renderHTMLContent:()=>ie,renderStylesheet:()=>$e,renderStylesheetPromise:()=>oe,serializeCH1RichText:()=>U,setDOMAttribute:()=>M});function O(e,t=r=>{}){var r;let i=()=>{var n,o;let s=new Promise((l,h)=>{n=c=>{e==null||e(c),l(c)},o=h});var a=Object.assign(s,{resolve:n,reject:o,restart:i,first:r});return r=a,a.catch(t),a};return i()}var Ft=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,C=class extends Ft{getProps(t){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=O(t=>{this.payload=t}),this.whenRendered=O(()=>this.initialized=!0,()=>this.cancelRender()),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(t,r,i){this.set()}connectedCallback(){this.mount()}disconnectedCallback(){this.unmount()}mount(){try{let t=this.getParent();if(t&&!t.connected||this.connected)return;this.connected=!0,this.log("FEAAS: Mount",this.tagName,this),this.dispatchEventIndirectly(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var i;return(i=r.mount)===null||i===void 0?void 0:i.call(r)}),this.set()}catch(t){this.onError(t)}}dispatchEventIndirectly(t){this.dispatchEvent(t);let r=this.getParent();r&&!r.contains(this)&&(Object.defineProperty(t,"target",{value:this,writable:!1}),Object.defineProperty(t,"composedPath",{value:()=>[this],writable:!1}),r.handleEvent(t))}isJSONAttribute(t){return!1}log(...t){let r=t[0];(typeof location!="undefined"&&(location!=null&&location.hostname.startsWith("components-"))||localStorage["Sitecore.Components.Debug"])&&console.log(r+" "+t.slice(1).map(i=>i&&typeof i=="object"?"%O":"%s").join(" "),...t.slice(1))}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEventIndirectly(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected&&this.initialized&&this.render&&this.update(),this.cancelRender(),this.connected=!1,this.initialized&&this.render&&this.update())}getParent(t=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!t||r.tagName.startsWith("FEAAS-"))return r;if(this.tagName!="FEAAS-CONTEXT")return document.querySelector("feaas-context")}getElements(t=this.getRoot(),r=!0){return Array.from(t.querySelectorAll("*")).map(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.shadowRoot,r):null]).flat().filter(Boolean)}handleEvent(t){let r=t.composedPath()[0];switch(t.type){case"feaasMount":r!=this&&this.nestedCallback(r);break;case"feaasUnmount":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(t){let r=this.descendants.indexOf(t);r!=-1&&(this.log("FEAAS: Unnest",this,t),this.descendants.splice(r,1),this.refs[t.getComponentName()]=null,t.refs.parent==this&&(t.refs.parent=null),t.refs.top==this&&(t.refs.top=t.refs.parent))}nestedCallback(t){var r,i;if(this.descendants.indexOf(t)==-1&&(this.descendants.push(t),this.log("FEAAS: Nest",this,t),this.refs[t.getComponentName()]=t,t.refs.top=this,(r=t.refs).parent||(r.parent=this),t.render))for(var o=t.refs.parent;o;o=o.refs.parent)o.render&&((i=t.refs).parentReact||(i.parentReact=o),t.refs.topReact=o)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(t,r="uncaught",i=!1){let n=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:t});if(this.dispatchEventIndirectly(n),this.whenLoaded.reject(t),!n.defaultPrevented&&!i){this.whenRendered.reject(t);try{this.unmount()}catch(o){}return!0}return!1}shouldUpdateOnLoad(){return!0}async advance(){try{if(this.payload===void 0){if(!this.isReadyToLoad())return;this.payload=null,this.dispatchEventIndirectly(new Event("feaasLoad",{bubbles:!0,composed:!0}));let t=await this.load().catch(r=>{throw this.payload=void 0,r});if(this.whenLoaded.resolve(t),this.onLoad)return}else if(this.payload==null)return;this.flush(),this.whenRendered.resolve(this)}catch(t){this.onError(t)}}flush(){var t,r;if(!this.connected)return;let i=(r=(t=this.payload)===null||t===void 0?void 0:t.ReactDOM)===null||r===void 0?void 0:r.flushSync;i?i(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var t,r,i;if(this.payload==null||!this.render)return;let{React:n,ReactDOM:o,ReactDOMClient:s}=this.payload||{};if(!n)throw new Error(`${this.tagName}: React is not present in payload`);if(!o)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);this.getAttribute("hydrate")=="false"&&this.firstElementChild||(!this.refs.topReact&&!this.forceUpdateReact?(this.reactRoot||(this.reactRoot=s.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):this.forceUpdateReact&&this.connected?(t=this.forceUpdateReact)===null||t===void 0||t.call(this):(i=(r=this.refs.topReact)===null||r===void 0?void 0:r.forceUpdateReact)===null||i===void 0||i.call(r))}invokeReactRendering(){let{React:t,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let i=this.descendants.filter(n=>n.refs.parentReact==this&&n.payload&&n.connected).map((n,o)=>this.getReactElement(n));return this.render({...this.props,children:i},this.payload)}getReactErrorBoundary(t=this,r=t.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:i,ReactDOM:n}=t.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends i.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(s){return{error:s}}componentDidCatch(s,a){console.error(`FEAAS: ${t.tagName} Error:`,s,a),t.onError(s,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(t=this,r){let{React:i,ReactDOM:n}=t.payload||{},o=this.getReactErrorBoundary(),s=this.getReactWrapper(t);return i.createElement(o,{key:t.tagName+"-"+t.getUID(),slot:t.getAttribute("slot")},i.createElement(s,null))}getReactWrapper(t=this,r=t.tagName){if(t.reactWrapper)return t.reactWrapper;let{React:i,ReactDOM:n}=t.payload||{};return t.reactWrapper=o=>{if(t.render){let[s,a]=i.useReducer(l=>l+1,0);return t.forceUpdateReact=a,n.createPortal(i.createElement(i.Fragment,null,t.invokeReactRendering()),t.getReactRootElement())}else return t.update()},Object.assign(t.reactWrapper,{key:t.tagName+"-"+t.getUID(),displayName:r}),t.reactWrapper}getUID(){return this.uid||(this.uid=String(Math.random()))}getShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}getReactRootElement(){return this.useShadowRoot?this.getShadowRoot():this.getRoot()}set(t){try{this.scheduleRender(),this.overrides={...this.overrides,...t},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let n=this.isJSONAttribute(r),o=this.props[r],s=n?JSON.stringify(o):String(o),a=this.defaultProps[r],l=n?JSON.stringify(a):String(a),h=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),c=this.getAttribute(h);try{var i=n?JSON.stringify(JSON.parse(c)):c}catch(f){var i=null}o==null||s===l?this.removeAttribute(h):(typeof o=="string"||typeof o=="number"||typeof o=="boolean"||n)&&i!=s&&this.setAttribute(h,s)}}catch(n){this.whenRendered.reject(n),this.onError(n,"set")}return this}import(t){return import( /*@vite-ignore*/ /* webpackIgnore: true */ t)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),this.cancelRender(),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(t=>{})})}cancelRender(){cancelAnimationFrame(this.nextRender)}formatURL(t,r){return typeof t=="string"&&t.match(/^\/[^\/]/)?r+t:t}getContextAttribute(t,r=this){for(var i=this;i=i.parentElement||(i.parentNode instanceof ShadowRoot?i.parentNode.host:null);)if(i.getAttribute(t)!=null)return i.getAttribute(t);return this.getAttribute(t)}static register(t,r){r==null&&(r=typeof window!="undefined"?window:null),r&&!r.customElements.get(t)&&r.customElements.define(t,this)}};var X=class extends C{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom/client")]).then(([t,r,i])=>({React:t,ReactDOM:r,ReactDOMClient:i}))}render({},{React:t}){return t.createElement(t.Fragment,null)}},ft=class extends X{constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:t},{React:r}){let[i,n]=r.useState(0);return r.useEffect(()=>{n(o=>o+1)},[t]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",t),r.createElement("p",null,"Triggered updates: ",i))}};ft.observedAttributes=["counter"];var yt={};q(yt,{renderDOMContent:()=>j,renderDOMElement:()=>R,renderHTMLContent:()=>ie,setDOMAttribute:()=>M});var gt={};q(gt,{JSONPath:()=>b,queryObject:()=>V,queryObjectRaw:()=>kt,queryScopes:()=>Q,serializeCH1RichText:()=>U});var we=Ze(require("vm"),1),Bt=class{add(t,r,i){if(typeof arguments[0]!="string")for(let n in arguments[0])this.add(n,arguments[0][n],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(n){this[n]=this[n]||[],r&&this[n][i?"unshift":"push"](r)},this)}run(t,r){this[t]=this[t]||[],this[t].forEach(function(i){i.call(r&&r.context?r.context:r,r)})}},Ht=class{constructor(t){this.jsep=t,this.registered={}}register(...t){t.forEach(r=>{if(typeof r!="object"||!r.name||!r.init)throw new Error("Invalid JSEP plugin format");this.registered[r.name]||(r.init(this.jsep),this.registered[r.name]=r)})}},d=class{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+d.version}static addUnaryOp(t){return d.max_unop_len=Math.max(t.length,d.max_unop_len),d.unary_ops[t]=1,d}static addBinaryOp(t,r,i){return d.max_binop_len=Math.max(t.length,d.max_binop_len),d.binary_ops[t]=r,i?d.right_associative.add(t):d.right_associative.delete(t),d}static addIdentifierChar(t){return d.additional_identifier_chars.add(t),d}static addLiteral(t,r){return d.literals[t]=r,d}static removeUnaryOp(t){return delete d.unary_ops[t],t.length===d.max_unop_len&&(d.max_unop_len=d.getMaxKeyLen(d.unary_ops)),d}static removeAllUnaryOps(){return d.unary_ops={},d.max_unop_len=0,d}static removeIdentifierChar(t){return d.additional_identifier_chars.delete(t),d}static removeBinaryOp(t){return delete d.binary_ops[t],t.length===d.max_binop_len&&(d.max_binop_len=d.getMaxKeyLen(d.binary_ops)),d.right_associative.delete(t),d}static removeAllBinaryOps(){return d.binary_ops={},d.max_binop_len=0,d}static removeLiteral(t){return delete d.literals[t],d}static removeAllLiterals(){return d.literals={},d}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new d(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(r=>r.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return d.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!d.binary_ops[String.fromCharCode(t)]||d.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return d.isIdentifierStart(t)||d.isDecimalDigit(t)}throwError(t){let r=new Error(t+" at character "+this.index);throw r.index=this.index,r.description=t,r}runHook(t,r){if(d.hooks[t]){let i={context:this,node:r};return d.hooks.run(t,i),i.node}return r}searchHook(t){if(d.hooks[t]){let r={context:this};return d.hooks[t].find(function(i){return i.call(r.context,r),r.node}),r.node}}gobbleSpaces(){let t=this.code;for(;t===d.SPACE_CODE||t===d.TAB_CODE||t===d.LF_CODE||t===d.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let t=this.gobbleExpressions(),r=t.length===1?t[0]:{type:d.COMPOUND,body:t};return this.runHook("after-all",r)}gobbleExpressions(t){let r=[],i,n;for(;this.index<this.expr.length;)if(i=this.code,i===d.SEMCOL_CODE||i===d.COMMA_CODE)this.index++;else if(n=this.gobbleExpression())r.push(n);else if(this.index<this.expr.length){if(i===t)break;this.throwError('Unexpected "'+this.char+'"')}return r}gobbleExpression(){let t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,d.max_binop_len),r=t.length;for(;r>0;){if(d.binary_ops.hasOwnProperty(t)&&(!d.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!d.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=r,t;t=t.substr(0,--r)}return!1}gobbleBinaryExpression(){let t,r,i,n,o,s,a,l,h;if(s=this.gobbleToken(),!s||(r=this.gobbleBinaryOp(),!r))return s;for(o={value:r,prec:d.binaryPrecedence(r),right_a:d.right_associative.has(r)},a=this.gobbleToken(),a||this.throwError("Expected expression after "+r),n=[s,o,a];r=this.gobbleBinaryOp();){if(i=d.binaryPrecedence(r),i===0){this.index-=r.length;break}o={value:r,prec:i,right_a:d.right_associative.has(r)},h=r;let c=f=>o.right_a&&f.right_a?i>f.prec:i<=f.prec;for(;n.length>2&&c(n[n.length-2]);)a=n.pop(),r=n.pop().value,s=n.pop(),t={type:d.BINARY_EXP,operator:r,left:s,right:a},n.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+h),n.push(o,t)}for(l=n.length-1,t=n[l];l>1;)t={type:d.BINARY_EXP,operator:n[l-1].value,left:n[l-2],right:t},l-=2;return t}gobbleToken(){let t,r,i,n;if(this.gobbleSpaces(),n=this.searchHook("gobble-token"),n)return this.runHook("after-token",n);if(t=this.code,d.isDecimalDigit(t)||t===d.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===d.SQUOTE_CODE||t===d.DQUOTE_CODE)n=this.gobbleStringLiteral();else if(t===d.OBRACK_CODE)n=this.gobbleArray();else{for(r=this.expr.substr(this.index,d.max_unop_len),i=r.length;i>0;){if(d.unary_ops.hasOwnProperty(r)&&(!d.isIdentifierStart(this.code)||this.index+r.length<this.expr.length&&!d.isIdentifierPart(this.expr.charCodeAt(this.index+r.length)))){this.index+=i;let o=this.gobbleToken();return o||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:d.UNARY_EXP,operator:r,argument:o,prefix:!0})}r=r.substr(0,--i)}d.isIdentifierStart(t)?(n=this.gobbleIdentifier(),d.literals.hasOwnProperty(n.name)?n={type:d.LITERAL,value:d.literals[n.name],raw:n.name}:n.name===d.this_str&&(n={type:d.THIS_EXP})):t===d.OPAREN_CODE&&(n=this.gobbleGroup())}return n?(n=this.gobbleTokenProperty(n),this.runHook("after-token",n)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let r=this.code;for(;r===d.PERIOD_CODE||r===d.OBRACK_CODE||r===d.OPAREN_CODE||r===d.QUMARK_CODE;){let i;if(r===d.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==d.PERIOD_CODE)break;i=!0,this.index+=2,this.gobbleSpaces(),r=this.code}this.index++,r===d.OBRACK_CODE?(t={type:d.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),r=this.code,r!==d.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):r===d.OPAREN_CODE?t={type:d.CALL_EXP,arguments:this.gobbleArguments(d.CPAREN_CODE),callee:t}:(r===d.PERIOD_CODE||i)&&(i&&this.index--,this.gobbleSpaces(),t={type:d.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),i&&(t.optional=!0),this.gobbleSpaces(),r=this.code}return t}gobbleNumericLiteral(){let t="",r,i;for(;d.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===d.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);d.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(r=this.char,r==="e"||r==="E"){for(t+=this.expr.charAt(this.index++),r=this.char,(r==="+"||r==="-")&&(t+=this.expr.charAt(this.index++));d.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);d.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return i=this.code,d.isIdentifierStart(i)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(i===d.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===d.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:d.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="",r=this.index,i=this.expr.charAt(this.index++),n=!1;for(;this.index<this.expr.length;){let o=this.expr.charAt(this.index++);if(o===i){n=!0;break}else if(o==="\\")switch(o=this.expr.charAt(this.index++),o){case"n":t+=`
|
|
2
|
+
`;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=o}else t+=o}return n||this.throwError('Unclosed quote after "'+t+'"'),{type:d.LITERAL,value:t,raw:this.expr.substring(r,this.index)}}gobbleIdentifier(){let t=this.code,r=this.index;for(d.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,d.isIdentifierPart(t));)this.index++;return{type:d.IDENTIFIER,name:this.expr.slice(r,this.index)}}gobbleArguments(t){let r=[],i=!1,n=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===t){i=!0,this.index++,t===d.CPAREN_CODE&&n&&n>=r.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(o===d.COMMA_CODE){if(this.index++,n++,n!==r.length){if(t===d.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===d.CBRACK_CODE)for(let s=r.length;s<n;s++)r.push(null)}}else if(r.length!==n&&n!==0)this.throwError("Expected comma");else{let s=this.gobbleExpression();(!s||s.type===d.COMPOUND)&&this.throwError("Expected comma"),r.push(s)}}return i||this.throwError("Expected "+String.fromCharCode(t)),r}gobbleGroup(){this.index++;let t=this.gobbleExpressions(d.CPAREN_CODE);if(this.code===d.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:d.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:d.ARRAY_EXP,elements:this.gobbleArguments(d.CBRACK_CODE)}}},tr=new Bt;Object.assign(d,{hooks:tr,plugins:new Ht(d),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});d.max_unop_len=d.getMaxKeyLen(d.unary_ops);d.max_binop_len=d.getMaxKeyLen(d.binary_ops);var T=e=>new d(e).parse(),er=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(d).filter(e=>!er.includes(e)&&T[e]===void 0).forEach(e=>{T[e]=d[e]});T.Jsep=d;var rr="ConditionalExpression",ir={name:"ternary",init(e){e.hooks.add("after-expression",function(r){if(r.node&&this.code===e.QUMARK_CODE){this.index++;let i=r.node,n=this.gobbleExpression();if(n||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let o=this.gobbleExpression();if(o||this.throwError("Expected expression"),r.node={type:rr,test:i,consequent:n,alternate:o},i.operator&&e.binary_ops[i.operator]<=.9){let s=i;for(;s.right.operator&&e.binary_ops[s.right.operator]<=.9;)s=s.right;r.node.test=s.right,s.right=r.node,r.node=i}}else this.throwError("Expected :")}})}};T.plugins.register(ir);var Ce=47,nr=92,or={name:"regex",init(e){e.hooks.add("gobble-token",function(r){if(this.code===Ce){let i=++this.index,n=!1;for(;this.index<this.expr.length;){if(this.code===Ce&&!n){let o=this.expr.slice(i,this.index),s="";for(;++this.index<this.expr.length;){let l=this.code;if(l>=97&&l<=122||l>=65&&l<=90||l>=48&&l<=57)s+=this.char;else break}let a;try{a=new RegExp(o,s)}catch(l){this.throwError(l.message)}return r.node={type:e.LITERAL,value:a,raw:this.expr.slice(i-1,this.index)},r.node=this.gobbleTokenProperty(r.node),r.node}this.code===e.OBRACK_CODE?n=!0:n&&this.code===e.CBRACK_CODE&&(n=!1),this.index+=this.code===nr?2:1}this.throwError("Unclosed Regex")}})}},jt=43,sr=45,G={name:"assignment",assignmentOperators:new Set(["=","*=","**=","/=","%=","+=","-=","<<=",">>=",">>>=","&=","^=","|=","||=","&&=","??="]),updateOperators:[jt,sr],assignmentPrecedence:.9,init(e){let t=[e.IDENTIFIER,e.MEMBER_EXP];G.assignmentOperators.forEach(i=>e.addBinaryOp(i,G.assignmentPrecedence,!0)),e.hooks.add("gobble-token",function(n){let o=this.code;G.updateOperators.some(s=>s===o&&s===this.expr.charCodeAt(this.index+1))&&(this.index+=2,n.node={type:"UpdateExpression",operator:o===jt?"++":"--",argument:this.gobbleTokenProperty(this.gobbleIdentifier()),prefix:!0},(!n.node.argument||!t.includes(n.node.argument.type))&&this.throwError(`Unexpected ${n.node.operator}`))}),e.hooks.add("after-token",function(n){if(n.node){let o=this.code;G.updateOperators.some(s=>s===o&&s===this.expr.charCodeAt(this.index+1))&&(t.includes(n.node.type)||this.throwError(`Unexpected ${n.node.operator}`),this.index+=2,n.node={type:"UpdateExpression",operator:o===jt?"++":"--",argument:n.node,prefix:!1})}}),e.hooks.add("after-expression",function(n){n.node&&r(n.node)});function r(i){G.assignmentOperators.has(i.operator)?(i.type="AssignmentExpression",r(i.left),r(i.right)):i.operator||Object.values(i).forEach(n=>{n&&typeof n=="object"&&r(n)})}}};T.plugins.register(or,G);T.addUnaryOp("typeof");T.addLiteral("null",null);T.addLiteral("undefined",void 0);var ar=new Set(["constructor","__proto__","__defineGetter__","__defineSetter__"]),v={evalAst(e,t){switch(e.type){case"BinaryExpression":case"LogicalExpression":return v.evalBinaryExpression(e,t);case"Compound":return v.evalCompound(e,t);case"ConditionalExpression":return v.evalConditionalExpression(e,t);case"Identifier":return v.evalIdentifier(e,t);case"Literal":return v.evalLiteral(e,t);case"MemberExpression":return v.evalMemberExpression(e,t);case"UnaryExpression":return v.evalUnaryExpression(e,t);case"ArrayExpression":return v.evalArrayExpression(e,t);case"CallExpression":return v.evalCallExpression(e,t);case"AssignmentExpression":return v.evalAssignmentExpression(e,t);default:throw SyntaxError("Unexpected expression",e)}},evalBinaryExpression(e,t){return{"||":(i,n)=>i||n(),"&&":(i,n)=>i&&n(),"|":(i,n)=>i|n(),"^":(i,n)=>i^n(),"&":(i,n)=>i&n(),"==":(i,n)=>i==n(),"!=":(i,n)=>i!=n(),"===":(i,n)=>i===n(),"!==":(i,n)=>i!==n(),"<":(i,n)=>i<n(),">":(i,n)=>i>n(),"<=":(i,n)=>i<=n(),">=":(i,n)=>i>=n(),"<<":(i,n)=>i<<n(),">>":(i,n)=>i>>n(),">>>":(i,n)=>i>>>n(),"+":(i,n)=>i+n(),"-":(i,n)=>i-n(),"*":(i,n)=>i*n(),"/":(i,n)=>i/n(),"%":(i,n)=>i%n()}[e.operator](v.evalAst(e.left,t),()=>v.evalAst(e.right,t))},evalCompound(e,t){let r;for(let i=0;i<e.body.length;i++){e.body[i].type==="Identifier"&&["var","let","const"].includes(e.body[i].name)&&e.body[i+1]&&e.body[i+1].type==="AssignmentExpression"&&(i+=1);let n=e.body[i];r=v.evalAst(n,t)}return r},evalConditionalExpression(e,t){return v.evalAst(e.test,t)?v.evalAst(e.consequent,t):v.evalAst(e.alternate,t)},evalIdentifier(e,t){if(Object.hasOwn(t,e.name))return t[e.name];throw ReferenceError(`${e.name} is not defined`)},evalLiteral(e){return e.value},evalMemberExpression(e,t){let r=e.computed?v.evalAst(e.property):e.property.name,i=v.evalAst(e.object,t);if(i==null)throw TypeError(`Cannot read properties of ${i} (reading '${r}')`);if(!Object.hasOwn(i,r)&&ar.has(r))throw TypeError(`Cannot read properties of ${i} (reading '${r}')`);let n=i[r];return typeof n=="function"?n.bind(i):n},evalUnaryExpression(e,t){return{"-":i=>-v.evalAst(i,t),"!":i=>!v.evalAst(i,t),"~":i=>~v.evalAst(i,t),"+":i=>+v.evalAst(i,t),typeof:i=>typeof v.evalAst(i,t)}[e.operator](e.argument)},evalArrayExpression(e,t){return e.elements.map(r=>v.evalAst(r,t))},evalCallExpression(e,t){let r=e.arguments.map(n=>v.evalAst(n,t));return v.evalAst(e.callee,t)(...r)},evalAssignmentExpression(e,t){if(e.left.type!=="Identifier")throw SyntaxError("Invalid left-hand side in assignment");let r=e.left.name,i=v.evalAst(e.right,t);return t[r]=i,t[r]}},Wt=class{constructor(t){this.code=t,this.ast=T(this.code)}runInNewContext(t){let r=Object.assign(Object.create(null),t);return v.evalAst(this.ast,r)}};function $(e,t){return e=e.slice(),e.push(t),e}function Vt(e,t){return t=t.slice(),t.unshift(e),t}var zt=class extends Error{constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),this.avoidNew=!0,this.value=t,this.name="NewError"}};function b(e,t,r,i,n){if(!(this instanceof b))try{return new b(e,t,r,i,n)}catch(s){if(!s.avoidNew)throw s;return s.value}typeof e=="string"&&(n=i,i=r,r=t,t=e,e=null);let o=e&&typeof e=="object";if(e=e||{},this.json=e.json||r,this.path=e.path||t,this.resultType=e.resultType||"value",this.flatten=e.flatten||!1,this.wrap=Object.hasOwn(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.eval=e.eval===void 0?"safe":e.eval,this.ignoreEvalErrors=typeof e.ignoreEvalErrors>"u"?!1:e.ignoreEvalErrors,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||i||null,this.otherTypeCallback=e.otherTypeCallback||n||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){let s={path:o?e.path:t};o?"json"in e&&(s.json=e.json):s.json=r;let a=this.evaluate(s);if(!a||typeof a!="object")throw new zt(a);return a}}b.prototype.evaluate=function(e,t,r,i){let n=this.parent,o=this.parentProperty,{flatten:s,wrap:a}=this;if(this.currResultType=this.resultType,this.currEval=this.eval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=i||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&typeof e=="object"&&!Array.isArray(e)){if(!e.path&&e.path!=="")throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().');if(!Object.hasOwn(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');({json:t}=e),s=Object.hasOwn(e,"flatten")?e.flatten:s,this.currResultType=Object.hasOwn(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=Object.hasOwn(e,"sandbox")?e.sandbox:this.currSandbox,a=Object.hasOwn(e,"wrap")?e.wrap:a,this.currEval=Object.hasOwn(e,"eval")?e.eval:this.currEval,r=Object.hasOwn(e,"callback")?e.callback:r,this.currOtherTypeCallback=Object.hasOwn(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,n=Object.hasOwn(e,"parent")?e.parent:n,o=Object.hasOwn(e,"parentProperty")?e.parentProperty:o,e=e.path}if(n=n||null,o=o||null,Array.isArray(e)&&(e=b.toPathString(e)),!e&&e!==""||!t)return;let l=b.toPathArray(e);l[0]==="$"&&l.length>1&&l.shift(),this._hasParentSelector=null;let h=this._trace(l,t,["$"],n,o,r).filter(function(c){return c&&!c.isParentSelector});return h.length?!a&&h.length===1&&!h[0].hasArrExpr?this._getPreferredOutput(h[0]):h.reduce((c,f)=>{let p=this._getPreferredOutput(f);return s&&Array.isArray(p)?c=c.concat(p):c.push(p),c},[]):a?[]:void 0};b.prototype._getPreferredOutput=function(e){let t=this.currResultType;switch(t){case"all":{let r=Array.isArray(e.path)?e.path:b.toPathArray(e.path);return e.pointer=b.toPointer(r),e.path=typeof e.path=="string"?e.path:b.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return b.toPathString(e[t]);case"pointer":return b.toPointer(e.path);default:throw new TypeError("Unknown result type")}};b.prototype._handleCallback=function(e,t,r){if(t){let i=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:b.toPathString(e.path),t(i,r,e)}};b.prototype._trace=function(e,t,r,i,n,o,s,a){let l;if(!e.length)return l={path:r,value:t,parent:i,parentProperty:n,hasArrExpr:s},this._handleCallback(l,o,"value"),l;let h=e[0],c=e.slice(1),f=[];function p(u){Array.isArray(u)?u.forEach(g=>{f.push(g)}):f.push(u)}if((typeof h!="string"||a)&&t&&Object.hasOwn(t,h))p(this._trace(c,t[h],$(r,h),t,h,o,s));else if(h==="*")this._walk(t,u=>{p(this._trace(c,t[u],$(r,u),t,u,o,!0,!0))});else if(h==="..")p(this._trace(c,t,r,i,n,o,s)),this._walk(t,u=>{typeof t[u]=="object"&&p(this._trace(e.slice(),t[u],$(r,u),t,u,o,!0))});else{if(h==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:c,isParentSelector:!0};if(h==="~")return l={path:$(r,h),value:n,parent:i,parentProperty:null},this._handleCallback(l,o,"property"),l;if(h==="$")p(this._trace(c,t,r,null,null,o,s));else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(h))p(this._slice(h,c,t,r,i,n,o));else if(h.indexOf("?(")===0){if(this.currEval===!1)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");let u=h.replace(/^\?\((.*?)\)$/u,"$1"),g=/@.?([^?]*)[['](\??\(.*?\))(?!.\)\])[\]']/gu.exec(u);g?this._walk(t,m=>{let E=[g[2]],y=g[1]?t[m][g[1]]:t[m];this._trace(E,y,r,i,n,o,!0).length>0&&p(this._trace(c,t[m],$(r,m),t,m,o,!0))}):this._walk(t,m=>{this._eval(u,t[m],m,r,i,n)&&p(this._trace(c,t[m],$(r,m),t,m,o,!0))})}else if(h[0]==="("){if(this.currEval===!1)throw new Error("Eval [(expr)] prevented in JSONPath expression.");p(this._trace(Vt(this._eval(h,t,r.at(-1),r.slice(0,-1),i,n),c),t,r,i,n,o,s))}else if(h[0]==="@"){let u=!1,g=h.slice(1,-2);switch(g){case"scalar":(!t||!["object","function"].includes(typeof t))&&(u=!0);break;case"boolean":case"string":case"undefined":case"function":typeof t===g&&(u=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(u=!0);break;case"number":Number.isFinite(t)&&(u=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(u=!0);break;case"object":t&&typeof t===g&&(u=!0);break;case"array":Array.isArray(t)&&(u=!0);break;case"other":u=this.currOtherTypeCallback(t,r,i,n);break;case"null":t===null&&(u=!0);break;default:throw new TypeError("Unknown value type "+g)}if(u)return l={path:r,value:t,parent:i,parentProperty:n},this._handleCallback(l,o,"value"),l}else if(h[0]==="`"&&t&&Object.hasOwn(t,h.slice(1))){let u=h.slice(1);p(this._trace(c,t[u],$(r,u),t,u,o,s,!0))}else if(h.includes(",")){let u=h.split(",");for(let g of u)p(this._trace(Vt(g,c),t,r,i,n,o,!0))}else!a&&t&&Object.hasOwn(t,h)&&p(this._trace(c,t[h],$(r,h),t,h,o,s,!0))}if(this._hasParentSelector)for(let u=0;u<f.length;u++){let g=f[u];if(g&&g.isParentSelector){let m=this._trace(g.expr,t,g.path,i,n,o,s);if(Array.isArray(m)){f[u]=m[0];let E=m.length;for(let y=1;y<E;y++)u++,f.splice(u,0,m[y])}else f[u]=m}}return f};b.prototype._walk=function(e,t){if(Array.isArray(e)){let r=e.length;for(let i=0;i<r;i++)t(i)}else e&&typeof e=="object"&&Object.keys(e).forEach(r=>{t(r)})};b.prototype._slice=function(e,t,r,i,n,o,s){if(!Array.isArray(r))return;let a=r.length,l=e.split(":"),h=l[2]&&Number.parseInt(l[2])||1,c=l[0]&&Number.parseInt(l[0])||0,f=l[1]&&Number.parseInt(l[1])||a;c=c<0?Math.max(0,c+a):Math.min(a,c),f=f<0?Math.max(0,f+a):Math.min(a,f);let p=[];for(let u=c;u<f;u+=h)this._trace(Vt(u,t),r,i,n,o,s,!0).forEach(m=>{p.push(m)});return p};b.prototype._eval=function(e,t,r,i,n,o){this.currSandbox._$_parentProperty=o,this.currSandbox._$_parent=n,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;let s=e.includes("@path");s&&(this.currSandbox._$_path=b.toPathString(i.concat([r])));let a=this.currEval+"Script:"+e;if(!b.cache[a]){let l=e.replaceAll("@parentProperty","_$_parentProperty").replaceAll("@parent","_$_parent").replaceAll("@property","_$_property").replaceAll("@root","_$_root").replaceAll(/@([.\s)[])/gu,"_$_v$1");if(s&&(l=l.replaceAll("@path","_$_path")),this.currEval==="safe"||this.currEval===!0||this.currEval===void 0)b.cache[a]=new this.safeVm.Script(l);else if(this.currEval==="native")b.cache[a]=new this.vm.Script(l);else if(typeof this.currEval=="function"&&this.currEval.prototype&&Object.hasOwn(this.currEval.prototype,"runInNewContext")){let h=this.currEval;b.cache[a]=new h(l)}else if(typeof this.currEval=="function")b.cache[a]={runInNewContext:h=>this.currEval(l,h)};else throw new TypeError(`Unknown "eval" property "${this.currEval}"`)}try{return b.cache[a].runInNewContext(this.currSandbox)}catch(l){if(this.ignoreEvalErrors)return!1;throw new Error("jsonPath: "+l.message+": "+e)}};b.cache={};b.toPathString=function(e){let t=e,r=t.length,i="$";for(let n=1;n<r;n++)/^(~|\^|@.*?\(\))$/u.test(t[n])||(i+=/^[0-9*]+$/u.test(t[n])?"["+t[n]+"]":"['"+t[n]+"']");return i};b.toPointer=function(e){let t=e,r=t.length,i="";for(let n=1;n<r;n++)/^(~|\^|@.*?\(\))$/u.test(t[n])||(i+="/"+t[n].toString().replaceAll("~","~0").replaceAll("/","~1"));return i};b.toPathArray=function(e){let{cache:t}=b;if(t[e])return t[e].concat();let r=[],n=e.replaceAll(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replaceAll(/[['](\??\(.*?\))[\]'](?!.\])/gu,function(o,s){return"[#"+(r.push(s)-1)+"]"}).replaceAll(/\[['"]([^'\]]*)['"]\]/gu,function(o,s){return"['"+s.replaceAll(".","%@%").replaceAll("~","%%@@%%")+"']"}).replaceAll("~",";~;").replaceAll(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replaceAll("%@%",".").replaceAll("%%@@%%","~").replaceAll(/(?:;)?(\^+)(?:;)?/gu,function(o,s){return";"+s.split("").join(";")+";"}).replaceAll(/;;;|;;/gu,";..;").replaceAll(/;$|'?\]|'$/gu,"").split(";").map(function(o){let s=o.match(/#(\d+)/u);return!s||!s[1]?o:r[s[1]]});return t[e]=n,t[e].concat()};b.prototype.safeVm={Script:Wt};b.prototype.vm=we.default;function kt(e,t){try{return b({path:t,json:e})}catch(r){return[]}}function V(e,t,r=!0){let i=kt(e,t)||[];return r?i.flat(1/0):i}function Q(e,t,r=!1,i=e,n=!0){var o=t;let s=Object.keys(e).sort((l,h)=>h.length-l.length);for(let l of s)if(t.startsWith(l)){if(l==t){if(r)return e[l];continue}o=t.substring(l.length+1),i=e[l];break}var a=V(i,o,n);return a.length==0&&(a=[o.replace(/^.*?\./,"_."),o.replace(/^.*?\./,""),o.replace(/^([^.]+).*?\.\$([\.\[])/,"$1$2"),o.replace(/^.*?\.\$([\.\[])/,"_$1"),o.replace(/^.*?\.\$([\.\[])/,"$$$1"),o.replace(/^[^.]+$/,"_")].filter((l,h,c)=>c.indexOf(l)===h).reduce((l,h)=>l.length>0?l:V(i,h,n),[])),r?a[0]:a}function Kt(e,t={},r){return r?`<${r}${Object.entries(t).map(([i,n])=>n!=null&&` ${i}="${n}"`).filter(Boolean).join("")}>${U(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):U(e)}function U(e){var t;if(Array.isArray(e))return e.map(U).join(`
|
|
3
|
+
`).trim();if(typeof e=="string")return e;if(e==null)return"";switch(e.type){case"heading":let{level:r,...i}=e.attrs;return Kt(e.content,i,"h"+r);case"text":return(e.marks||[]).reduce((n,o)=>Kt(n,o.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[o.type]),(t=e.text)===null||t===void 0?void 0:t.replace(/\s+/," "));default:return Kt(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}var F=class{constructor(t,r=1,i){this.ownerDocument={createElement(n){return new F(n)},createDocumentFragment(){return new F(null,11)}},this.nodeName=t,this.nodeType=r,this.textContent=i,this.attributes=[],this.childNodes=[]}setAttribute(t,r){let i=this.attributes.find(n=>n.name===t);i?i.value=r:this.attributes.push({name:t,value:r})}getAttribute(t){let r=this.attributes.find(i=>i.name===t);return r?r.value:void 0}insertBefore(t,r){if(t.parentNode=this,r===null)this.childNodes.push(t);else{let i=this.childNodes.indexOf(r);i!==-1&&this.childNodes.splice(i,0,t)}}removeAttribute(t){let r=this.attributes.findIndex(i=>i.name===t);r!==-1&&this.attributes.splice(r,1)}appendChild(t){t.parentNode=this,this.childNodes.push(t)}get tagName(){var t;return(t=this.nodeName)===null||t===void 0?void 0:t.toUpperCase()}get localName(){var t;return(t=this.nodeName)===null||t===void 0?void 0:t.toLowerCase()}get innerHTML(){return qt(this.childNodes)}set innerHTML(t){this.childNodes=Xt(String(t!=null?t:""))}get outerHTML(){return qt([this])}get children(){return this.childNodes.filter(t=>t.nodeType==1)}closest(t){let r=this;for(;r;){if(Se(t,r))return r;r=r.parentNode}return null}querySelectorAll(t){let r=t.split(/\s*,\s*/),i=[],n=o=>{for(let s of r)if(Se(s,o)){i.push(o);break}for(let s of o.childNodes)n(s)};for(let o of this.childNodes)n(o);return i}querySelector(t){return this.querySelectorAll(t)[0]}findSibling(t,r){if(!this.parentNode)return null;let i=this.parentNode.childNodes,n=i.indexOf(this);if(n===-1)return null;for(let o=n+t;o>=0&&o<i.length;o+=t){let s=i[o];if(!r||s.nodeType===1)return s}return null}removeChild(t){let r=this.childNodes.indexOf(t);if(r!==-1)return this.childNodes.splice(r,1),t.parentNode=void 0,t}get previousSibling(){return this.findSibling(-1)}get nextSibling(){return this.findSibling(1)}get previousElementSibling(){return this.findSibling(-1,!0)}get nextElementSibling(){return this.findSibling(1,!0)}cloneNode(t=!1){let r=new F(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),t)for(let i of this.childNodes){let n=i.cloneNode(!0);r.appendChild(n)}return r}get parentElement(){var t;return((t=this.parentNode)===null||t===void 0?void 0:t.nodeType)==1?this.parentNode:null}};function Se(e,t){let r=e.match(/([.#]?[\w-]+|\[([\w-]+)(="([^"]*)")?\])/g);if(!r)return!1;for(let i of r)if(i.startsWith("#")){if(t.getAttribute("id")!==i.slice(1))return!1}else if(i.startsWith(".")){if(!(t.getAttribute("class")||"").split(" ").includes(i.slice(1)))return!1}else if(i.startsWith("[")){let n=i.match(/^\[([\w-]+)(="([^"]*)")?\]$/);if(n){let o=n[1],s=n[3],a=t.getAttribute(o);if(typeof s=="undefined"){if(a===void 0)return!1}else if(a!==s)return!1}else return!1}else if(t.nodeName!==i)return!1;return!0}function Xt(e){var t;let r=[],i=[];for(;e;){let n=e.match(/^<([\w-]+)(\s[^>]*)?>/),o=e.match(/^<\/([\w-]+)>/);if(n){let s=n[1].toLowerCase(),l=((t=(n[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||t===void 0?void 0:t.map(c=>{let[f,p,,u]=c.match(/([\w-]+)(="([^"]*)")?/);return{name:p,value:dr(u||"")}}))||[],h=new F(s,1);if(h.attributes=l,i.length>0){let c=i[i.length-1];c.childNodes.push(h),h.parentNode=c}else r.push(h);["img","input","br"].includes(s)||i.push(h),e=e.slice(n[0].length)}else if(o)i.pop(),e=e.slice(o[0].length);else{let s=e.indexOf("<"),a=e.slice(0,s!==-1?s:void 0),l=new F("#text",3);if(l.textContent=a,i.length>0){let h=i[i.length-1];h.childNodes.push(l),l.parentNode=h}else r.push(l);e=e.slice(a.length)}}return r}function lr(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function dr(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}function qt(e){return e.map(t=>{if(t.nodeType===3)return t.textContent||"";let{nodeName:r,attributes:i}=t,n=i.map(({name:s,value:a})=>` ${s}="${lr(String(a))}"`).join(""),o=qt(t.childNodes);return["img","input","br"].includes(r)?`<${r}${n} />`:`<${r}${n}>${o}</${r}>`}).join("")}function Gt(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let n=i.target,o=n.getAttribute("data-embed-src");o&&Y(n,o),i.addedNodes&&i.addedNodes.forEach(s=>{s.nodeType==1&&Qt(s,!1)})})});return t.observe(e,{attributes:!0,subtree:!0,childList:!0}),t}function Qt(e,t=!0){let r=e.querySelectorAll("[data-embed-src]");for(var i=0;i<r.length;i++){let n=r[i];Y(n,n.getAttribute("data-embed-src"))}if(t)return Gt(e)}function Y(e,t){for(var r=e;r;r=r.parentElement)if(!r.parentElement){let n=r.querySelectorAll("script");for(var i=0;i<n.length;i++)if(n[i].getAttribute("src")==t)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let o=r.ownerDocument.createElement("script");o.setAttribute("type","module"),o.setAttribute("src",t),r.appendChild(o);break}}var bt={};q(bt,{adjustNumbers:()=>te,cleanCollectionBit:()=>Z,getHumanizedLabel:()=>ee,getLastPathBit:()=>re,getQualifier:()=>Jt,normalizeCollectionScope:()=>mt,parseLimit:()=>Yt,parseRange:()=>Zt});var Yt=e=>{var t;let r=parseInt((t=e==null?void 0:e.match(/\[0:(\d+)\]/))===null||t===void 0?void 0:t[1],10);return!isNaN(r)&&r>0?String(r):null},Zt=e=>{var t;let r=(t=e==null?void 0:e.match(/\[([^\]]+)\]/))===null||t===void 0?void 0:t[1].split(/\s*,\s*/g).filter(Boolean).map(i=>{if(i.match(/^-?\d+$/))return i;let n=i.match(/^(\d+):(\d+)$/);return n&&parseInt(n[1],10)<parseInt(n[2],10)?n[1]+"-"+n[2]:null});return r!=null&&r.every(Boolean)?r.join(","):null},Jt=e=>{var t;return(t=e==null?void 0:e.match(/(\.\*|\[[^\]]*\])$/))===null||t===void 0?void 0:t[0]};function Z(e){return e.replace(/(\.?\[[^\]\[]*\]|\.\*)$/g,"")}function mt(e){return Z(e)+".*"}function te(e,t){return e==null?void 0:e.replace(/(.|^)(\d+)/g,(r,i,n)=>i+(i==":"?n:String(parseInt(n)+t)))}function ee(e,t=2){var r=Z(e).split(/]\.|\.\*\./g).pop().split(/\./g).slice(-3);return r=r.filter(i=>isNaN(parseInt(i))),r.map(i=>i.charAt(0).toUpperCase()+i.slice(1)).slice(-t).join(" ")}function re(e){return Z(e).split(".").pop()}var hr=["January","February","March","April","May","June","July","August","September","October","November","December"],Oe=e=>{if(!e||typeof e.getDay!="function")return;let t=e.getFullYear(),r=hr[e.getMonth()],i=e.getDate();return`${r} ${i}, ${t}`},Re=function(e){return String(new Date(e))!=="Invalid Date"&&!isNaN(Number(new Date(e)))};function De(e){let t=e.getAttribute("data-path-scope");for(var r=0,i=e;i=i.previousElementSibling;)i.getAttribute("data-path-scope")==t&&r++;return r}function cr(e,t,r){let i=e.getAttribute("data-path-scope");if(i==null)return;var n=De(e);if(n!=0)return;let o=e.parentNode;if(o!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var s=n+1,a=e,l=e;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==i&&(s++,a=l);for(var h=s;h<t;h++)o.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var h=Math.max(1,t);h<s;h++)a=a.previousElementSibling,o.removeChild(a.nextElementSibling)}}function M(e,t,r,i,n=!0){var o,s,a;if(!e)return;var l=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=U(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(e,t,r));var h=t.replace("data-path-","");if(t=="data-path-src"||t=="data-path-alt"){let y=Array.from(e.children).find(k=>k.localName=="picture")||e;l=e.localName=="img"?e:y.querySelector("img, video")}else if(t=="data-path-href")l=e.querySelector("a")||e.closest("a");else if(t=="data-path-hidden")r=r?null:!0;else if(t=="data-path"||t=="data-embed-html"||t=="html")h="innerHTML";else if(t=="data-embed-src"&&n)Y(e,r);else if(t=="data-path-attributes"){if(!Array.isArray(r)){let y=((o=e.getAttribute("data-attributes-keys"))===null||o===void 0?void 0:o.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var c in r){var f=r[c];M(e,c,typeof f=="object"&&f?JSON.stringify(f):f,i,n)}for(var p=0;p<y.length;p++)(r==null||!(y[p]in r))&&M(e,y[p],null,i,n);M(e,"data-attributes-keys",Object.keys(r||{}).join(","),{},n)}if(e.tagName=="FEAAS-EXTERNAL"){let y=String(e.getAttribute("data-path-attributes")||"").slice(0,-1).split(".")[0]||"_";M(e,"datasources",JSON.stringify({[y]:r}),{},n)}return}if(typeof r=="boolean"&&h!=="hidden"&&(r=r?"":null),!l)return;if((h=="innerHTML"||h=="src")&&(r==null||r==="")){var g=String((a=(s=e.getAttribute("data-path-placeholder")||l[h])!==null&&s!==void 0?s:l.getAttribute(h))!==null&&a!==void 0?a:"");h=="innerHTML"?l.innerHTML=g:g?l.setAttribute(h,g):l.removeAttribute(h)}else if(r!=null)if(h=="innerHTML"){for(var m=String(r),E=l;E.parentElement&&E.localName.match(/^(a|var|strong|em|i|b)$/);)E=E.parentElement;E.localName.match(/p|h\d|button|time|li/)&&(m=m.replace(/<(p|h\d|li|ul)[^>]*?>|<\/(p|h\d|li|ul)[^>]*?>/g," ").trim().replace(/\s+/g," ")),String(E.getAttribute("class")).includes("-inline--time")&&Re(m)&&(m=Oe(new Date(m))),l.innerHTML!=m&&(l.innerHTML=m)}else l.getAttribute(h)!=r&&l.setAttribute(h,r);else l.removeAttribute(h)}var ke=["data-attributes-keys","data-path-attributes","data-path-scope"];function R(e,t,r,i,n=!0){var o,s,a;let l=e;if(i||(t=((o=r==null?void 0:r.processData)===null||o===void 0?void 0:o.call(r,l,t))||t),l.nodeType==1){let f=l.getAttribute("data-path-scope");if(f){let u=De(l),g=Q(t,f,!1);u==0&&cr(l,((s=r==null?void 0:r.shouldRepeat)===null||s===void 0?void 0:s.call(r,l,g))===!1?1:g.length,r),t={...t,[mt(f)]:g[u]}}let p=Array.prototype.slice.call(l.attributes).sort((u,g)=>ke.indexOf(u.name)-ke.indexOf(g.name));for(var h=0;h<p.length;h++){let{name:u,value:g}=p[h];u.startsWith("data-path")&&u!="data-path-scope"&&M(l,u,Q(t,g,!0,void 0,l.tagName!="FEAAS-EXTERNAL"),r,n),u=="data-embed-src"&&M(l,u,l.getAttribute(u),r,n)}}for(var h=0,c;c=l.childNodes[h++];)Pe(c)&&R(c,t,r,!0,n);return i||(a=r==null?void 0:r.onRender)===null||a===void 0||a.call(r,l,t),l}function Pe(e){return e.nodeType==1}function j(e,t,r,i,n=!0){var o;let s=((o=i==null?void 0:i.processTemplate)===null||o===void 0?void 0:o.call(i,e,t,r))||t;if(e.innerHTML=s,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(var l=0,h;h=e.childNodes[l++];)Pe(h)&&(h.className=h.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return R(e,r,i,null,n)}function ie(e,t,r,i=!1,n=!0){var o;let s=((o=r==null?void 0:r.processTemplate)===null||o===void 0?void 0:o.call(r,null,e,t))||e;if(typeof document=="undefined"||i){let a=Xt(s);return R(a[0],t,r,null,n).outerHTML}else{let a=document.createElement("div");return a.innerHTML=s,R(a,t,r,null,n),a.innerHTML}}var _e=["initial","check","updated"];function Ne(){return Object.create(null)}var J=Ne();function Te(){J=Ne()}async function tt(e,t,r,i,n=J){return B({url:e,options:t,validator:r,callback:i,cache:n}).then(et).then(o=>o.response)}async function B({url:e,options:t,validator:r,callback:i,cache:n},o="initial"){let s=new Date;if(n!=null){var a=ne(e);if(_e.indexOf(a.phase)>=_e.indexOf(o))var l=a[o];else a.phase=o}let h=await(l||fetch(e,t));if(!l&&a&&(h.ok?a[o].resolve(h):a[o].reject(new Error("Fetch failed"))),!h.ok)throw new Error("Fetch failed");let c=new Date(h.headers.get("date"))<s||l&&o=="initial"&&(a.phase=="updated"||a.phase=="check");if((r==null?void 0:r(h,c))===!1)throw new vt("Response is not valid");return await(i==null?void 0:i(h,o,c)),{url:e,options:t,isCached:c,response:h,validator:r,callback:i,cache:n}}function ne(e,t=!1){let r=String(e).replace("?head","");var i=J[r];return!i&&!t&&(i=J[r]={phase:null,initial:O(),check:O(),updated:O(),final:O()}),i}var vt=class extends Error{};async function et(e){let{url:t,isCached:r,options:i,validator:n,response:o,cache:s}=e;if(r){let{response:a}=await B({url:t+(t.toString().includes("?")?"&":"?")+"head",options:{...i,method:"HEAD",cache:"no-cache"},validator:n,cache:s},"check");if(a.headers.get("last-modified")!=o.headers.get("last-modified"))return Et(e)}return e}async function Et(e){return B({...e,options:{...e.options,cache:"reload"}},"updated")}var _="https://feaas.blob.core.windows.net";function rt(e){let t=e==null?void 0:e.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(t){var[,r,i,n,o,s]=t;return{cdn:r,library:i,component:n,version:o,revision:s}}}function Me(e){if(!e||!e.library||!e.component)throw new Error("Component requires `library` and `component` properties");return`${e.cdn&&e.cdn!=_?`${e.cdn}/components`:""}/${e.library}/${e.component}/${!e.version||e.version=="responsive"&&(!e.revision||e.revision=="published")?"":e.version}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/(^\/|\/$|\/\/)(?!.+\/components\/)/g,"")}function Le(e){return`${e.cdn&&e.cdn!=_?`${e.cdn}/styles/`:""}${e.library}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function z(e){let t=e==null?void 0:e.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(t){var[,r,i,n]=t;return{cdn:r,library:i,revision:n}}else{let o=rt(e);if(o){var{cdn:r,library:i,revision:n}=o;return n!=null&&n.match(/\d/)&&(n=void 0),{cdn:r,library:i,revision:n}}}}function Dt(e){return typeof e=="string"&&(e={src:e}),"src"in e&&e.src?e={...rt(e.src)}:e={...e},`${e.cdn||e.hostname||_}/components/${e.library}/${e.component}/${e.version||"responsive"}/${e.revision||"published"}.html`}function it(e){if(typeof e=="string"&&(e={src:e}),"src"in e){if(String(e.src).includes("v1/files/components/styles"))return e.src;e={...z(e.src)}}else e={...e};return`${e.cdn||e.hostname||_}/styles/${e.library}/${e.revision=="staged"?"staged":e.revision=="saved"?"saved":"published"}.css`}async function K(e,t,r=!1){let i=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,n=a=>a.clone().text().then(t),o=await Promise.all([e.instance&&B({options:{headers:{Accept:"text/html"},credentials:"omit"},url:Dt({...e,version:e.instance}),validator:i}).catch(a=>a),B({url:Dt(e),validator:i}).catch(a=>a)]),s=o.find(a=>a&&"isCached"in a&&a);if(!s||s instanceof Error)throw o.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return o[0]==s&&console.log("Using fork!",o),await n(s.response),r?s:et({...s,callback:n}).catch(a=>{if(o[0]==s&&(Et({...s,callback:null,validator:null}),console.log("Fork was deleted"),!(o[1]instanceof Error)))return n(o[1].response),et({...o[1],callback:n});throw a})}async function Ie(e){typeof e=="string"&&(e={src:e});var t;let{response:r}=await K(e,i=>{t=i},!0);return{...e,template:t,lastModified:r.headers.get("last-modified")}}async function xt(e,t){return tt(it(e),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,i)=>r.clone().text().then(n=>t(n,i)))}function $e(e,t){return oe(e,t||(t=document.createElement("style"))),t}function oe(e,t){return t||(t=document.createElement("style")),xt(e,(r,i)=>{t.textContent=r}).then(()=>t)}var ur=new WeakSet;function At(e,t){var r,i=se(e);if(i){if(ur.has(i))return Promise.resolve(i);e=i.getAttribute("data-href")||i.getAttribute("href")}return xt(e,(n,o)=>{o=="initial"&&i||(r||(r=!i||i.tagName=="LINK"?ae(e):i),r.textContent=n),t==null||t(n,o)}).then(()=>r||i)}function Pt(e){return new Promise((t,r)=>{At(e,t).catch(r)})}function se(e){let t=it(e),{library:r}=z(t),i=`/files/components/styles/${r}.css`;return document.querySelector(`style[data-href="${t}"],
|
|
4
|
+
link[rel="stylesheet"][href="${t}"],
|
|
4
5
|
style[data-href*="${i}"],
|
|
5
|
-
link[rel="stylesheet"][href*="${i}"]`)}function
|
|
6
|
+
link[rel="stylesheet"][href*="${i}"]`)}function ae(e){let t=it(e),r=document.createElement("style");return r.setAttribute("data-href",t),document.head.appendChild(r),r}function Ue(e,t){let r=document.createElement("div");r.innerHTML=e;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return R(i,t),r}function _t(e,t,r=!0){return le(e,t||(t=document.createElement("div")),r),t}async function le(e,t,r=!0){return t||(t=document.createElement("div")),t.childNodes.length?R(t,e.data,e,null,r):"template"in e?j(t,e.template,e.data,e,r):K(e,i=>j(t,i,e.data,e,r)).then(()=>t)}var Fe=require("@sitecore/byoc");function pr(e){let{params:t,method:r,headers:i,body:n,url:o}=w(e);var s={url:o},a={...i};return i["Content-Type"]==="application/json"&&delete a["Content-Type"],i.Accept==="application/json"&&delete a.Accept,Object.keys(a).length>0&&(s.headers=a),r!=="GET"&&(s.method=r),r==="GET"||r==="HEAD"||Object.keys(n).length===0||(s.body=n),Object.keys(t).length>0&&(s={...s,params:t}),s}var nt=e=>{if(!e||typeof e.url!="string")return!1;for(var t in e)if(!(t=="body"||t=="params"||t=="headers"||t=="url"||t==="method"||t=="jsonpath"&&typeof e[t]=="string"))return!1;return!0};function je(e){let{url:t,headers:r,params:i,method:n,body:o}=w(e),s,a=r["Content-Type"];n!="GET"&&n!="HEAD"&&(a==="application/json"&&(s=JSON.stringify(o)),a==="multipart/form-data"&&(s=Object.keys(o).reduce((h,c)=>(h.append(c,o[c]),h),new FormData)),a==="application/x-www-form-urlencoded"&&(s=new URLSearchParams(o)));let l=Object.keys(i).length?`?${new URLSearchParams(i)}`:"";return[`${t}${l}`,{headers:r,body:s,method:n}]}function w(e){let t={};for(let r in(e==null?void 0:e.headers)||{})if(e.headers.hasOwnProperty(r)){let i=r.replace(/^[a-z]|\-[a-z]/g,n=>n.toUpperCase());t[i]=e.headers[r]}return t.Accept||(t.Accept="application/json"),{params:(e==null?void 0:e.params)||{},headers:t,jsonpath:String((e==null?void 0:e.jsonpath)||"$"),method:((e==null?void 0:e.method)||"GET").toUpperCase(),body:(e==null?void 0:e.body)||{},url:String((e==null?void 0:e.url)||"")}}var de=async(e,t)=>{let r=(0,Fe.customizeDataSettings)(t,e);if(r instanceof Promise)return r;let i=e;r&&(i=w(r));try{let[n,o]=je(i),a=await(await w.fetchImplementation(n,{...o,method:o.method.toLowerCase()})).json();return i.jsonpath&&i.jsonpath!="$"?V(a,i.jsonpath):a}catch(n){return{}}};async function Nt(e){if(!e)return e;if(nt(e))return de(e);let t=Object.keys(e),r=await Promise.all(t.map(i=>nt(e[i])?de(e[i],i):null).filter(Boolean));return t.reduce((i,n)=>({...i,[n]:nt(e[n])?r.shift():e[n]}),{})}function fr(e){return e?nt(e)||Object.values(e).some(nt):!1}w.clean=pr;w.toFetchArguments=je;w.fetchOne=de;w.fetch=Nt;w.isDataSettings=nt;w.hasDataSettings=fr;w.fetchImplementation=(...e)=>fetch(...e);function he(e){var t,r,i,n,o,s,a,l;let h,c=e.getAttribute("src");if(c){let k=rt(c);if(!k)throw new Error(`Could not parse FEAAS Component source: ${c}`);var{cdn:f,library:p,component:u,version:g,revision:m}=k}let E=e.getAttribute("data");if(E!=null&&E!="")try{h=typeof E=="string"?JSON.parse(E):{}}catch(k){console.error(k)}let y=e.getAttribute("fetch");return{data:h||{},cdn:(r=(t=e.getContextAttribute("cdn"))!==null&&t!==void 0?t:f)!==null&&r!==void 0?r:_,library:(i=e.getAttribute("library"))!==null&&i!==void 0?i:p,component:(n=e.getAttribute("component"))!==null&&n!==void 0?n:u,version:(s=(o=e.getAttribute("version"))!==null&&o!==void 0?o:g)!==null&&s!==void 0?s:"responsive",revision:(l=(a=e.getAttribute("revision"))!==null&&a!==void 0?a:m)!==null&&l!==void 0?l:"published",hostname:e.getAttribute("hostname"),template:e.getAttribute("template"),instance:e.getAttribute("instance"),editable:e.getAttribute("editable")!=null,suspended:e.getAttribute("suspended")!=null,lastModified:e.getAttribute("last-modified"),fetch:y=="false"||y==null&&e.hasAttribute("fetch")?[]:y==null||y=="true"?["data","template","stylesheet"]:y.split(/(\s+|\-)+/g).filter(Boolean)}}var ot=class extends C{setData(t){this.set({data:t})}getProps(){return he(this)}isJSONAttribute(t){return t=="data"}attributeChangedCallback(t,r,i){r!==i&&((t=="library"||t=="component"||t=="revision"||t=="version")&&(this.payload=void 0,this.alreadyRendered&&this.connected&&(this.needsRefresh=!0,this.needsToFetchTemplate=!0)),super.attributeChangedCallback(t,r,i),t=="data"&&(this.needsRefresh=!0,(this.props.fetch.includes("data")||this.alreadyRendered||!w.hasDataSettings(this.props.data))&&this.fetchData()))}async fetchData(){this.readyData=void 0,this.whenDataReady=this.whenDataReady.restart();let t=await w.fetch(this.props.data),r=this.alreadyRendered;await this.whenDataReady.resolve(t),r&&this.advance()}getEditor(){var t;return(t=document.querySelector("feaas-context"))===null||t===void 0?void 0:t.refs.editor}constructor(){super(),this.readyData={},this.whenDataReady=O(r=>this.readyData=r,r=>this.onError(r)),this.defaultProps={cdn:_,revision:"published",version:"responsive",editable:!1,suspended:!1,data:{}},this.onLoad=r=>{this.payload=r,this.advance()};let t=this.getAttribute("data");this.getAttribute("data")||this.whenDataReady.resolve({}),this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let t=this.getEditor();if(t!=null&&t.setTarget(this))return t.open(),!0}getOriginal(){let t=this.getAttribute("data-path-scope");if(t){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==t;)var i=r;return i}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){var t;if(this.getOriginal())return;let r=()=>{this.payload!=null&&(i||this.readyData&&this.onLoad(this.payload))};if(this.props.fetch.includes("stylesheet"))var i=Pt({...this.props}).then(()=>{i=null,r()});if(this.props.fetch.includes("template")||this.needsToFetchTemplate){this.needsToFetchTemplate=!1;var n=K(this.props,o=>{this.payload=o,this.needsRefresh=!0,r()})}else this.payload=(t=this.props.template)!==null&&t!==void 0?t:this.innerHTML;return Promise.all([i,this.whenDataReady.then(()=>r()),n]).then(()=>this.payload)}flush(){this.readyData&&super.flush()}update(){if(this.alreadyRendered=!0,!(!this.props.fetch.includes("data")&&!this.props.fetch.includes("template")&&this.firstElementChild&&!this.needsRefresh))if(Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)R(this,this.readyData);else{if(this.needsRefresh=!1,this.getOriginal())return;j(this,this.payload,this.readyData)}}};ot.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet","fetch"];ot.register("feaas-component");function ce(e){return{opacity:e!=null&&e.getAttribute("opacity")?parseFloat(e==null?void 0:e.getAttribute("opacity")):1,hidden:(e==null?void 0:e.getAttribute("hidden"))!=null}}var st=class extends C{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return ce(this)}attributeChangedCallback(t,r,i){if(r!==i)return t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,i)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
|
|
6
7
|
#loader {
|
|
7
8
|
position: absolute;
|
|
8
9
|
top: 0;
|
|
@@ -66,10 +67,10 @@ var Ue=Object.create;var xt=Object.defineProperty;var Ie=Object.getOwnPropertyDe
|
|
|
66
67
|
style="animation: 1.5s linear 0s infinite normal none running loader-circular-track"
|
|
67
68
|
></circle>
|
|
68
69
|
</svg>
|
|
69
|
-
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};
|
|
70
|
+
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};st.observedAttributes=["hidden","opacity"];st.register("feaas-loader");function ue(e){var t,r,i,n;let o=e.getAttribute("src");if(o)var{cdn:s,library:a,revision:l}=z(o);return{library:e==null?void 0:e.getContextAttribute("library"),revision:(r=(t=e==null?void 0:e.getAttribute("revision"))!==null&&t!==void 0?t:l)!==null&&r!==void 0?r:"published",cdn:(n=(i=e==null?void 0:e.getContextAttribute("cdn"))!==null&&i!==void 0?i:e==null?void 0:e.getContextAttribute("hostname"))!==null&&n!==void 0?n:_}}var Ct=class extends C{constructor(){super(...arguments),this.onLoad=t=>{this.payload=t,this.advance()}}getProps(){return ue(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return At(this.props,this.onLoad)}};Ct.register("feaas-stylesheet");var wt={};q(wt,{convertBase64toBlob:()=>Be,generate:()=>Ve,get:()=>gr,getVersionForThumbnail:()=>He,load:()=>We,responseToImage:()=>pe,upload:()=>ze});var Be=e=>fetch(e).then(t=>t.blob()),pe=e=>e.blob().then(t=>new Promise((r,i)=>{let n=new Image;n.onerror=i,n.onload=()=>{r(n)},n.src=URL.createObjectURL(t)}));async function He(e){return e.versions.length||await e.versions.fetch(),e.getVersionForWidth(800)}async function gr(e,t,r){try{if(!e.isNew)return await We(e,t,r)}catch(n){e.sdk.log(`FEAAS: Thumbnail ${e.id}, version: ${(t==null?void 0:t.id)||"responsive"}, status: generating ${status}, reason: ${n}`)}let i=await Ve(e,t);return r==null||r(i,!1),i&&!e.isNew&&Be(i.src).then(n=>ze(e,t,n)),i}async function We(e,t,r){let i=t?t.getThumbnailURL():e.getThumbnailURL(),n=e.library.stylesheet,o=new Date(Math.max(Number(e.modifiedAt),Number(n.modifiedAt)));e.sdk.log(`FEAAS: Thumbnail ${e.id}/${(t==null?void 0:t.id)||"responsive"}, loading`);var s;return await tt(i,{},(a,l)=>{let h=Math.abs(Number(new Date(a.headers.get("x-ms-meta-componentRenderedAt")))-Number(o))<2e3;return l&&!h&&pe(a).then(c=>{s=c,r(c,l)}),h},(a,l,h)=>{e.sdk.log(`FEAAS: Thumbnail ${e.id}/${(t==null?void 0:t.id)||"responsive"}, status: ${l}`),pe(a).then(c=>{s=c,r(c,h)})},null),s}async function Ve(e,t,r){let i=t||(e.isNew?null:await He(e));if(!i||i.isViewEmpty())return null;let n=r||e.library.stylesheets.first,{datasources:o}=e.sdk;return await mr(i.classList,n.getBreakpointForWidth(800,i.getBreakpoints()),i.view,o.reduce((a,l)=>Object.assign(a,{[l.id]:l.sample}),{}),n.css,e.sdk)}function mr(e,t,r,i,n,o){let s=document.createElement("iframe");return s.style.position="absolute",s.style.top="-2000px",s.style.left="-2000px",s.style.width=t.props.minWidth+"px",s.style.height="720px",s.style.zIndex="100011",document.body.appendChild(s),new Promise((a,l)=>{let h=document.createElement("script");h.onerror=l,h.src=o.frontend+"/assets/html2canvas.js",h.onload=()=>{var u;(((u=s.contentWindow.document.fonts)===null||u===void 0?void 0:u.ready)||Promise.resolve()).then(function(){return s.contentWindow.html2canvas(p,{scale:Math.max(1.1,1e3/Math.min(1401,Math.max(320,t.props.minWidth))),width:Math.min(1401,Math.max(320,t.props.minWidth)),height:Math.max(1,Math.min(2e3,p.offsetHeight)),windowWidth:t.props.minWidth||t.props.maxWidth+"px",windowHeight:1e3,proxy:o.backend+"/proxy/media",backgroundColor:"#ffffff"}).then(g=>{let m=g.toDataURL("image/jpeg",.6);s.parentElement.removeChild(s);let E=new Image;E.onload=()=>{a(E)},E.onerror=l,E.src=m})})},s.contentWindow.document.head.appendChild(h);let c=s.contentWindow.document.createElement("style");c.textContent=`
|
|
70
71
|
${n}
|
|
71
72
|
body, html { padding: 0; margin: 0; overflow: hidden }
|
|
72
73
|
`;let f=s.contentWindow.document.createElement("style");f.textContent=`
|
|
73
74
|
body, html { padding: 0; margin: 0; overflow: hidden }
|
|
74
|
-
`,s.contentWindow.document.head.appendChild(h),s.contentWindow.document.head.appendChild(f);let u=kt({template:r,data:i},null,!1);u.classList.add(...t,"-feaas--preview","-emulate--"+e.details.slug),s.contentWindow.document.body.appendChild(u)})}async function $e(t,e,r){let i=e?e.getThumbnailURL():t.getThumbnailURL(),n=new Date(Math.max(Number(t.modifiedAt),Number(t.library.stylesheet.modifiedAt)));try{await t.sdk.uploadBlob("thumbnails",i.split(/\/thumbnails\//)[1],r,{headers:{"x-ms-blob-content-type":"image/jpg","x-ms-blob-cache-control":"public,max-age=31536000,immutable","x-ms-meta-versionId":e?e.id:null,"x-ms-meta-versionRevision":e?e.revision.toString():null,"x-ms-meta-componentId":t.id,"x-ms-meta-componentRenderedAt":n.toUTCString(),"x-ms-meta-componentModifiedAt":t.modifiedAt.toUTCString(),"x-ms-meta-componentCreatedAt":t.createdAt.toUTCString(),"x-ms-meta-modifiedAt":t.modifiedAt.toUTCString()}}),fetch(i,{cache:"no-cache"}).then(()=>{t.sdk.log("FEAAS: Thumbnail uploaded",i)})}catch(o){t.sdk.log("FEAAS: Thumbnail failed to upload",i,o)}return i}var _=require("@sitecore/byoc"),ae;typeof window!="undefined"&&(window.FEAASReactElement=J,(ae=window.FEAASLoading)!==null&&ae!==void 0||(window.FEAASLoading=Promise.resolve()));function le(t){let e=[];if(t){let r=t.ownerDocument.defaultView,i,n;for(;r!==window.top;){i=r.parent;for(let o=0;o<i.frames.length;o++)if(i.frames[o]===r){for(let s of i.document.getElementsByTagName("iframe"))if(s.contentWindow===r){n=s.getBoundingClientRect();let a=s.contentWindow.getComputedStyle(s);e.push({left:n.left+parseInt(a.borderLeftWidth),top:n.top+parseInt(a.borderTopWidth)})}r=i;break}}}return e.reduce((r,i)=>({left:r.left+i.left,top:r.top+i.top}),{left:0,top:0})}function de(t){var e;return{context:HTMLElement,frontend:t==null?void 0:t.getContextAttribute("frontend"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/editor.js",library:t==null?void 0:t.getAttribute("library"),component:t==null?void 0:t.getAttribute("component"),version:t==null?void 0:t.getAttribute("version"),instance:t==null?void 0:t.getAttribute("instance"),forked:t==null?void 0:t.getAttribute("forked"),revision:(t==null?void 0:t.getAttribute("revision"))||"saved",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,for:t==null?void 0:t.getAttribute("for"),state:(t==null?void 0:t.getAttribute("state"))||"idle",changed:(t==null?void 0:t.getAttribute("changed"))!=null}}var nt=class extends E{constructor(){super(...arguments),this.framePoint={top:0,left:0},this.wrapperRect={top:0,left:0,width:0,height:0},this.bodyRect={top:0,left:0,width:0,height:0},this.defaultProps={hidden:!1},this.setTarget=(e,r={component:e.getAttribute("component"),version:e.getAttribute("version"),revision:e.getAttribute("revision"),instance:e.getAttribute("instance")})=>{if(!this.closing&&(!this.target||e==null))return this.set(r),this.target=e,!0},this.onChromeMeasureElement=(e,r=e.getBoundingClientRect())=>e.ownerDocument==document?{left:r.left-this.bodyRect.left,top:r.top-this.bodyRect.top,width:r.width,height:r.height}:{left:r.left+this.framePoint.left-this.bodyRect.left,top:r.top+this.framePoint.top-this.bodyRect.top,width:r.width,height:r.height},this.onBeforeMeasure=e=>{e.memoized.focusable&&(this.framePoint=le(e.memoized.focusable)),this.chrome&&(this.wrapperRect=this.chrome.positionable.getBoundingClientRect(),this.bodyRect=this.chrome.positionable.ownerDocument.body.parentElement.getBoundingClientRect())},this.onMeasure=()=>{},this.onPosition=({focusable:e,root:r})=>{!this.chrome||this.props.hidden||(e?(this.chrome.wrapper.style.width=e.width+16*2+"px",this.chrome.wrapper.style.height=e.height+16*1+64+"px",this.chrome.wrapper.style.left=e.left-16+"px",this.chrome.wrapper.style.top=e.top-64+"px",this.chrome.wrapper.style.opacity="1",this.chrome.absolute=this.querySelector(".ui.overlays"),this.chrome.absolute&&(this.chrome.absolute.style.left=r.left+"px",this.chrome.absolute.style.top=r.top+"px")):(this.chrome.wrapper.style.opacity="0",this.chrome.wrapper.style.left="-1000px",this.chrome.wrapper.style.top="-1000px"))},this.onWindowMessage=e=>{var r;switch((r=e.data)===null||r===void 0?void 0:r.type){case"feaasEdit":let i=this.getPlaceholder();this.setTarget(i.editable,e.data)&&(this.loader=i.loader,document.body.appendChild(i.clipper),this.editedUID=e.data.id,this.setPlaceholder(),this.open());break;case"feaasMeasurements":this.measurements=e.data.measurements,this.props.hidden||this.setPlaceholder();break}},this.onContentChange=()=>{this.setAttribute("changed","changed"),requestAnimationFrame(()=>{this.setIframeComponentContent()})},this.onClose=()=>{var e;this.setAttribute("hidden","hidden"),this.placeholder&&(this.placeholder.positionable.style.opacity="0",this.placeholder.positionable.style.pointerEvents="none"),this.chrome&&(this.chrome.wrapper.style.opacity="0"),!((e=this.target)===null||e===void 0)&&e.parentNode&&(this.target.outerHTML=this.target.outerHTML),this.setTarget(null,{component:null,version:null,instance:null,revision:null}),this.setEditorContext({isFocused:!1})},this.onVersionStateChange=(e,r)=>{this.versionContext=e,this.setVersionContext=r},this.onEditorStateChange=(e,r)=>{this.editorContext=e,this.setEditorContext=r,e.editor&&this.props.state=="loading"&&!this.props.hidden&&(this.setAttribute("state","ready"),this.ownerDocument.fonts.ready.then(()=>setTimeout(()=>{this.setReadyState(),this.setIframeComponentContent()},100)))}}getProps(){return de(this)}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}showLoader(){this.loader||(this.loader=document.createElement("feaas-loader"),this.loader.setAttribute("opacity","0.6"),this.loader.style.zIndex="1000",this.target.appendChild(this.loader),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative"))}hideLoader(){this.loader&&(this.loader.setAttribute("hidden","hidden"),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative",this.target.style.position=""))}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.onWindowMessage)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.onWindowMessage)}setIframe(e){this.iframe=e}setIframeComponentContent(){this.placeholder&&this.iframe&&this.placeholder.editable.innerHTML&&this.iframe.contentWindow.postMessage({type:"feaasUpdate",id:this.editedUID,content:this.placeholder.editable.innerHTML})}setPlaceholder(){if(!this.iframe)return;let e=this.iframe.clientWidth,r=this.iframe.clientHeight,i=this.iframe.getBoundingClientRect(),n=this.getPlaceholder(),o=document.body.getBoundingClientRect(),s=this.measurements[this.editedUID];s&&(Object.assign(n.clipper.style,{position:"absolute",top:i.top+this.iframe.clientTop-o.top+"px",left:i.left+this.iframe.clientLeft-o.left+"px",width:e+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(n.positionable.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(n.loader.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",height:s.height+"px",filter:"opacity(0.6)",zIndex:3,pointerEvents:"none"}),document.dispatchEvent(new Event("feaasRefresh",{bubbles:!0})))}getPlaceholder(){return this.placeholder?this.placeholder:(this.placeholder={clipper:document.createElement("div"),positionable:document.createElement("div"),editable:Object.assign(document.createElement("div"),{className:"-feaas"}),loader:document.createElement("feaas-loader")},this.placeholder.clipper.appendChild(this.placeholder.positionable),this.placeholder.positionable.appendChild(this.placeholder.editable),this.placeholder.clipper.appendChild(this.placeholder.loader),this.placeholder)}attributeChangedCallback(e,r,i){r!==i&&(e=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(e,r,i))}open(){clearTimeout(this.closing),this.removeAttribute("hidden"),this.removeAttribute("changed"),this.setLoadingState()}shouldFork(e){return e.forkOriginId==null&&this.props.instance!=null}cleanup(){var e;this.placeholder&&((e=this.placeholder.clipper)===null||e===void 0||e.remove(),this.placeholder=null)}close(){console.log("Editor is not ready")}unfork(){console.log("Editor is not ready")}discard(){console.log("Editor is not ready")}save(){console.log("Editor is not ready")}setVersionContext(e){console.log("Editor is not ready")}setEditorContext(e){console.log("Editor is not ready")}setLoadingState(){this.showLoader(),this.setAttribute("state","loading")}setReadyState(){this.hideLoader(),this.setEditorContext({activeVersionId:this.component.versions[0].id}),this.setAttribute("state","ready")}render({children:e,component:r,version:i,instance:n},{Editor:o,VersionStatusList:s,VersionStatusButton:a,Version:l,VersionMenu:d,EditorUIUndo:h,EditorUIMode:f,React:{useEffect:u,useMemo:c,useState:p,useContext:b},Chakra:{HStack:A,Box:g,Button:k,MenuItem:wt},Chrome:Tt,ReactDOM:pe,useSDK:Pt,useLibrary:Ot,useSlots:M,useModelObserver:Mt,ConfirmationContext:Dt,VersionContext:st}){if(!this.payload)return;let{React:v}=this.payload,Ct=Pt(),at=Ot(),[y,P]=p(),{setConfirm:D}=b(Dt),lt=n||i;y&&(this.component=y),u(()=>{if(this.props.hidden)return;let C=at.components.getItem(r).clone();return C.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(j=>{C.versions.setItems(j);let N=C.findVersion(n,["staged","published"]),ct=C.findVersion(i,["staged","published"]);if(N)N.deletedAt?(N.getDraft().changeAndNotify(ct.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",N.id));else if(this.removeAttribute("forked"),this.shouldFork(ct)){console.error("FEAAS Editor: Forking");let Lt=ct.fork(n).id;this.setAttribute("instance",Lt)}else console.error("FEAAS Editor: Regular");P(C)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),P(null)},400)}},[i,this.props.hidden]);let fe=Mt(y==null?void 0:y.versions,[]).filter(C=>C.id==lt),dt=fe[0];dt&&!this.props.hidden&&(this.version=dt),u(()=>(this.unfork=()=>{D({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let C=y.findVersion(i,["staged","published"]);y.findVersion(n).unstage().unpublish().changeAndNotify(C.toProperties()),y.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(y.findVersion(lt).revert(),y.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{D({title:"Component has unsaved changes",button:"Discard",body:"Are you sure to close editor and discard changes?",bypass:!this.props.changed,action:()=>{this.discard(),requestAnimationFrame(this.onClose)}})},this.save=()=>{D({bypass:!!this.props.forked,title:"Customizing component",button:"Save",body:"Changes to the component will only be visible on that page. Changes to component done in Component Builder will not be reflected here. It will be possible to revert the customization.",action:()=>{var C,j;(j=(C=y.findVersion(lt).commitData({view:this.editorContext.editor.getData({rootName:lt}),model:""}))===null||C===void 0?void 0:C.stage())===null||j===void 0||j.publish(),this.removeAttribute("changed"),this.setAttribute("forked",lt),y.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[y]);let Fe=c(()=>this.target,[y]);return c(()=>y&&M(e,({picker:C,children:j})=>v.createElement(g,{ref:N=>{this.chrome=N?{positionable:N,wrapper:N.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},v.createElement(g,{className:"editor-wrapper",position:"absolute",left:0,top:0},v.createElement(o,{datasources:Ct.datasources,sdk:Ct,library:at,component:y,versions:fe,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:j,chrome:({editor:N})=>N&&v.createElement(Tt,null),children:({isArchivedDisplayed:N,editor:ct,status:Lt})=>v.createElement(g,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},v.createElement(g,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),v.createElement(g,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),v.createElement(g,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),v.createElement(g,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),dt&&v.createElement(l,{version:dt,node:Fe,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:v.createElement(A,{justifyContent:"space-between"},v.createElement(h,{size:"sm",editor:Lt=="ready"?ct:null}),v.createElement(f,{size:"sm"})),middle:(er,rr)=>[!1],right:v.createElement(v.Fragment,null,v.createElement(k,{variant:"secondary",size:"sm",onClick:this.close},"Close"),v.createElement(k,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),v.createElement(d,{isDisabled:!this.props.forked&&!this.props.changed},v.createElement(wt,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),v.createElement(wt,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[dt,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};nt.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];nt.register("feaas-editor");function ce(t){var e,r;return{part:(t==null?void 0:t.getAttribute("part"))||"picker",slot:(t==null?void 0:t.getAttribute("part"))||"picker",mode:t==null?void 0:t.getAttribute("mode"),dialog:t==null?void 0:t.getAttribute("dialog"),placeholder:(t==null?void 0:t.getAttribute("placeholder"))||"No theme",frontend:(e=t==null?void 0:t.getContextAttribute("frontend"))!==null&&e!==void 0?e:"https://components.sitecorecloud.io",src:(r=t==null?void 0:t.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(t==null?void 0:t.getAttribute("hidden"))!=null,variant:t==null?void 0:t.getAttribute("variant"),context:void 0,onClose:void 0,setAttribute:void 0,getAttribute:void 0}}var ot=class extends E{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return ce(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){this.setAttribute("feaas-role","ui"),super.connectedCallback()}render({placeholder:e,context:r,mode:i,dialog:n,children:o,variant:s},{Picker:a,React:l,useContext:d,EnvironmentContext:h,useLibrary:f,useSDK:u,BYOC:c}){var p,b,A;let[g,k]=l.useReducer(y=>y+1,0),wt=u(),Tt=d(h),pe=f("collections"),Pt=f("components"),Ot=u("datasources"),M=f(),Mt=((b=(p=M==null?void 0:M.stylesheets)===null||p===void 0?void 0:p.first)===null||b===void 0?void 0:b.rules)||((A=M==null?void 0:M.stylesheet)===null||A===void 0?void 0:A.styles),Dt=u("renderingHost.expandedComponents");var st=r==null?void 0:r.getAttribute("data");if(st)try{st=JSON.parse(st)}catch(y){}if(r)var v=wt.ExternalComponent.getDefinition(r),Ct=v&&!v.getConfiguration(r),at=(v==null?void 0:v.type)=="feaas"?Pt.find(y=>y.id==r.getAttribute("component")):c==null?void 0:c.getComponent(String(r.getAttribute("data-external-id")));return l.createElement(a,{cdn:Tt.cdn,rules:Mt,collections:pe,themeContext:r,placeholder:e,embed:at,externalComponents:Dt,datasources:Ot,data:st,versionId:r==null?void 0:r.getAttribute("version"),mode:i||(Ct?"library":at?"context":null),setAttribute:(y,P,D)=>{P=="data"&&D&&(D=JSON.stringify(D)),this.props.setAttribute(y,P,D),k()},getAttribute:(y,P)=>r==null?void 0:r.getAttribute(P),dialog:n,context:r,variant:s,onModeChange:(y,P)=>{this.set({mode:y,dialog:P})}},o)}};ot.observedAttributes=["library","mode","frontend","src","hidden","variant","dialog"];ot.register("feaas-picker");function he(t){var e,r,i,n,o;return{library:t==null?void 0:t.getAttribute("library"),src:(e=t==null?void 0:t.getAttribute("src"))!==null&&e!==void 0?e:"/context.js",environment:(r=t==null?void 0:t.getAttribute("environment"))!==null&&r!==void 0?r:void 0,frontend:(i=t==null?void 0:t.getAttribute("frontend"))!==null&&i!==void 0?i:"https://components.sitecorecloud.io",backend:(n=t==null?void 0:t.getAttribute("backend"))!==null&&n!==void 0?n:"https://components.sitecorecloud.io/api",cdn:(o=t==null?void 0:t.getAttribute("cdn"))!==null&&o!==void 0?o:"https://feaas.blob.core.windows.net",auth:null,isolate:(t==null?void 0:t.getAttribute("isolate"))==null||(t==null?void 0:t.getAttribute("isolate"))=="true"}}var I=class extends E{constructor(){super(...arguments),this.defaultProps={isolate:!0},this.onStatusChange=(e,r)=>{e=="ready"&&(this.whenSDKReady.resolve(r),this.dispatchEvent(new CustomEvent("feaasReady",{bubbles:!0,composed:!0,detail:r})))},this.whenSDKReady=x(e=>{this.sdk=e})}getProps(){return he(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null}getTheme(e){return e}getRoot(){return this.getAttribute("isolate")==="false"?this:this.shadowRoot||this.attachShadow({mode:"open"})}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}connectedCallback(){this.setAttribute("feaas-role","ui"),Array.from(this.children).forEach(e=>{this.getRoot().appendChild(e)}),document.addEventListener("feaasMount",this),document.addEventListener("feaasUnmount",this),super.connectedCallback()}disconnectedCallback(){document.removeEventListener("feaasMount",this),document.removeEventListener("feaasUnmount",this),super.disconnectedCallback()}getPortalRoot(){return this.getRoot()}render({children:e,library:r},{AppContext:i,Chakra:{Button:n,Tooltip:o},React:s}){let a={containerRef:{current:this.getPortalRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.createElement(i,{environment:this.props.environment,backend:this.props.backend,libraryId:this.props.library,container:this.getRoot(),auth:this.props.auth,getTheme:this.getTheme,onStatusChange:this.onStatusChange,modalProps:{portalProps:a},chakraProps:{resetScope:':where([feaas-role="ui"])',cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},e)}};I.observedAttributes=["library","component","version","revision","hostname","template"];I.register("feaas-context");I.prototype.clientside=ue;0&&(module.exports={Component,ComponentProps,Context,ControlledPromise,DEFAULT_CDN_URL,DOM,DataPath,DataScope,DataSettings,Element,FEAASComponent,FEAASComponentsProps,FEAASContext,FEAASContextProps,FEAASEditor,FEAASEditorProps,FEAASElement,FEAASLoader,FEAASLoaderProps,FEAASPicker,FEAASPickerProps,FEAASStylesheet,FEAASStylesheetProps,InvalidResponse,JSONPath,Loader,MyComponent,Picker,Stylesheet,Thumbnail,WebComponent,adjustNumbers,autoloadScripts,cleanCollectionBit,clearFetchCache,createStylesheet,customizeDataSettings,fetchAndRevalidate,fetchAndRevalidateComponent,fetchAndRevalidateStylesheet,fetchBypassingCache,fetchCache,fetchComponent,fetchData,fetchToValidateCache,fetchWithCacheAwareness,findStylesheet,getComponent,getComponentSource,getComponentURL,getFetchCache,getFramePosition,getHumanizedLabel,getLastPathBit,getQualifier,getStylesheetSource,getStylesheetURL,loadScript,loadStylesheet,loadStylesheetAllowStale,normalizeCollectionScope,observeDOMElement,parseComponentSource,parseLimit,parseRange,parseStylesheetSource,queryObject,queryObjectRaw,queryScopes,registerComponent,registerDatasource,renderComponent,renderComponentElement,renderComponentPromise,renderDOMContent,renderDOMElement,renderHTMLContent,renderStylesheet,renderStylesheetPromise,serializeCH1RichText,setDOMAttribute});
|
|
75
|
+
`,s.contentWindow.document.head.appendChild(c),s.contentWindow.document.head.appendChild(f);let p=_t({template:r,data:i},null,!1);p.classList.add(...e,"-feaas--preview","-emulate--"+t.details.slug),s.contentWindow.document.body.appendChild(p)})}async function ze(e,t,r){let i=t?t.getThumbnailURL():e.getThumbnailURL(),n=new Date(Math.max(Number(e.modifiedAt),Number(e.library.stylesheet.modifiedAt)));try{await e.sdk.uploadBlob("thumbnails",i.split(/\/thumbnails\//)[1],r,{headers:{"x-ms-blob-content-type":"image/jpg","x-ms-blob-cache-control":"public,max-age=31536000,immutable","x-ms-meta-versionId":t?t.id:null,"x-ms-meta-versionRevision":t?t.revision.toString():null,"x-ms-meta-componentId":e.id,"x-ms-meta-componentRenderedAt":n.toUTCString(),"x-ms-meta-componentModifiedAt":e.modifiedAt.toUTCString(),"x-ms-meta-componentCreatedAt":e.createdAt.toUTCString(),"x-ms-meta-modifiedAt":e.modifiedAt.toUTCString()}}),fetch(i,{cache:"no-cache"}).then(()=>{e.sdk.log("FEAAS: Thumbnail uploaded",i)})}catch(o){e.sdk.log("FEAAS: Thumbnail failed to upload",i,o)}return i}var D=require("@sitecore/byoc"),fe;typeof window!="undefined"&&(window.FEAASReactElement=X,(fe=window.FEAASLoading)!==null&&fe!==void 0||(window.FEAASLoading=Promise.resolve()));function ge(e){let t=[];if(e){let r=e.ownerDocument.defaultView,i,n;for(;r!==window.top;){i=r.parent;for(let o=0;o<i.frames.length;o++)if(i.frames[o]===r){for(let s of i.document.getElementsByTagName("iframe"))if(s.contentWindow===r){n=s.getBoundingClientRect();let a=s.contentWindow.getComputedStyle(s);t.push({left:n.left+parseInt(a.borderLeftWidth),top:n.top+parseInt(a.borderTopWidth)})}r=i;break}}}return t.reduce((r,i)=>({left:r.left+i.left,top:r.top+i.top}),{left:0,top:0})}function me(e){var t;return{context:HTMLElement,frontend:e==null?void 0:e.getContextAttribute("frontend"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/editor.js",library:e==null?void 0:e.getAttribute("library"),component:e==null?void 0:e.getAttribute("component"),version:e==null?void 0:e.getAttribute("version"),instance:e==null?void 0:e.getAttribute("instance"),forked:e==null?void 0:e.getAttribute("forked"),revision:(e==null?void 0:e.getAttribute("revision"))||"saved",hidden:(e==null?void 0:e.getAttribute("hidden"))!=null,for:e==null?void 0:e.getAttribute("for"),state:(e==null?void 0:e.getAttribute("state"))||"idle",changed:(e==null?void 0:e.getAttribute("changed"))!=null}}var at=class extends C{constructor(){super(...arguments),this.framePoint={top:0,left:0},this.wrapperRect={top:0,left:0,width:0,height:0},this.bodyRect={top:0,left:0,width:0,height:0},this.defaultProps={hidden:!1},this.setTarget=(t,r={component:t.getAttribute("component"),version:t.getAttribute("version"),revision:t.getAttribute("revision"),instance:t.getAttribute("instance")})=>{if(!this.closing&&(!this.target||t==null))return this.set(r),this.target=t,!0},this.onChromeMeasureElement=(t,r=t.getBoundingClientRect())=>t.ownerDocument==document?{left:r.left-this.bodyRect.left,top:r.top-this.bodyRect.top,width:r.width,height:r.height}:{left:r.left+this.framePoint.left-this.bodyRect.left,top:r.top+this.framePoint.top-this.bodyRect.top,width:r.width,height:r.height},this.onBeforeMeasure=t=>{t.memoized.focusable&&(this.framePoint=ge(t.memoized.focusable)),this.chrome&&(this.wrapperRect=this.chrome.positionable.getBoundingClientRect(),this.bodyRect=this.chrome.positionable.ownerDocument.body.parentElement.getBoundingClientRect())},this.onMeasure=()=>{},this.onPosition=({focusable:t,root:r})=>{!this.chrome||this.props.hidden||(t?(this.chrome.wrapper.style.width=t.width+16*2+"px",this.chrome.wrapper.style.height=t.height+16*1+64+"px",this.chrome.wrapper.style.left=t.left-16+"px",this.chrome.wrapper.style.top=t.top-64+"px",this.chrome.wrapper.style.opacity="1",this.chrome.absolute=this.querySelector(".ui.overlays"),this.chrome.absolute&&(this.chrome.absolute.style.left=r.left+"px",this.chrome.absolute.style.top=r.top+"px")):(this.chrome.wrapper.style.opacity="0",this.chrome.wrapper.style.left="-1000px",this.chrome.wrapper.style.top="-1000px"))},this.onWindowMessage=t=>{var r;switch((r=t.data)===null||r===void 0?void 0:r.type){case"feaasEdit":let i=this.getPlaceholder();this.setTarget(i.editable,t.data)&&(this.loader=i.loader,document.body.appendChild(i.clipper),this.editedUID=t.data.id,this.setPlaceholder(),this.open());break;case"feaasMeasurements":this.measurements=t.data.measurements,this.props.hidden||this.setPlaceholder();break}},this.onContentChange=()=>{this.setAttribute("changed","changed"),requestAnimationFrame(()=>{this.setIframeComponentContent()})},this.onClose=()=>{var t;this.setAttribute("hidden","hidden"),this.placeholder&&(this.placeholder.positionable.style.opacity="0",this.placeholder.positionable.style.pointerEvents="none"),this.chrome&&(this.chrome.wrapper.style.opacity="0"),!((t=this.target)===null||t===void 0)&&t.parentNode&&(this.target.outerHTML=this.target.outerHTML),this.setTarget(null,{component:null,version:null,instance:null,revision:null}),this.setEditorContext({isFocused:!1})},this.onVersionStateChange=(t,r)=>{this.versionContext=t,this.setVersionContext=r},this.onEditorStateChange=(t,r)=>{this.editorContext=t,this.setEditorContext=r,t.editor&&this.props.state=="loading"&&!this.props.hidden&&(this.setAttribute("state","ready"),this.ownerDocument.fonts.ready.then(()=>setTimeout(()=>{this.setReadyState(),this.setIframeComponentContent()},100)))}}getProps(){return me(this)}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}showLoader(){this.loader||(this.loader=document.createElement("feaas-loader"),this.loader.setAttribute("opacity","0.6"),this.loader.style.zIndex="1000",this.target.appendChild(this.loader),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative"))}hideLoader(){this.loader&&(this.loader.setAttribute("hidden","hidden"),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative",this.target.style.position=""))}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.onWindowMessage)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.onWindowMessage)}setIframe(t){this.iframe=t}setIframeComponentContent(){this.placeholder&&this.iframe&&this.placeholder.editable.innerHTML&&this.iframe.contentWindow.postMessage({type:"feaasUpdate",id:this.editedUID,content:this.placeholder.editable.innerHTML})}setPlaceholder(){if(!this.iframe)return;let t=this.iframe.clientWidth,r=this.iframe.clientHeight,i=this.iframe.getBoundingClientRect(),n=this.getPlaceholder(),o=document.body.getBoundingClientRect(),s=this.measurements[this.editedUID];s&&(Object.assign(n.clipper.style,{position:"absolute",top:i.top+this.iframe.clientTop-o.top+"px",left:i.left+this.iframe.clientLeft-o.left+"px",width:t+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(n.positionable.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(n.loader.style,{position:"absolute",top:s.top+"px",left:s.left+"px",width:s.width+"px",height:s.height+"px",filter:"opacity(0.6)",zIndex:3,pointerEvents:"none"}),document.dispatchEvent(new Event("feaasRefresh",{bubbles:!0})))}getPlaceholder(){return this.placeholder?this.placeholder:(this.placeholder={clipper:document.createElement("div"),positionable:document.createElement("div"),editable:Object.assign(document.createElement("div"),{className:"-feaas"}),loader:document.createElement("feaas-loader")},this.placeholder.clipper.appendChild(this.placeholder.positionable),this.placeholder.positionable.appendChild(this.placeholder.editable),this.placeholder.clipper.appendChild(this.placeholder.loader),this.placeholder)}attributeChangedCallback(t,r,i){r!==i&&(t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),i?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,i))}open(){clearTimeout(this.closing),this.removeAttribute("hidden"),this.removeAttribute("changed"),this.setLoadingState()}shouldFork(t){return t.forkOriginId==null&&this.props.instance!=null}cleanup(){var t;this.placeholder&&((t=this.placeholder.clipper)===null||t===void 0||t.remove(),this.placeholder=null)}close(){console.log("Editor is not ready")}unfork(){console.log("Editor is not ready")}discard(){console.log("Editor is not ready")}save(){console.log("Editor is not ready")}setVersionContext(t){console.log("Editor is not ready")}setEditorContext(t){console.log("Editor is not ready")}setLoadingState(){this.showLoader(),this.setAttribute("state","loading")}setReadyState(){this.hideLoader(),this.setEditorContext({activeVersionId:this.component.versions[0].id}),this.setAttribute("state","ready")}render({children:t,component:r,version:i,instance:n},{Editor:o,VersionStatusList:s,VersionStatusButton:a,Version:l,VersionMenu:h,EditorUIUndo:c,EditorUIMode:f,React:{useEffect:p,useMemo:u,useState:g,useContext:m},Chakra:{HStack:E,Box:y,Button:k,MenuItem:St},Chrome:Tt,ReactDOM:Ee,useSDK:Mt,useLibrary:Lt,useSlots:L,useModelObserver:It,ConfirmationContext:$t,VersionContext:dt}){if(!this.payload)return;let{React:x}=this.payload,Ot=Mt(),ht=Lt(),[A,N]=g(),{setConfirm:I}=m($t),ct=n||i;A&&(this.component=A),p(()=>{if(this.props.hidden)return;let S=ht.components.getItem(r).clone();return S.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(W=>{S.versions.setItems(W);let P=S.findVersion(n,["staged","published"]),pt=S.findVersion(i,["staged","published"]);if(P)P.deletedAt?(P.getDraft().changeAndNotify(pt.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",P.id));else if(this.removeAttribute("forked"),this.shouldFork(pt)){console.error("FEAAS Editor: Forking");let Ut=pt.fork(n).id;this.setAttribute("instance",Ut)}else console.error("FEAAS Editor: Regular");N(S)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),N(null)},400)}},[i,this.props.hidden]);let xe=It(A==null?void 0:A.versions,[]).filter(S=>S.id==ct),ut=xe[0];ut&&!this.props.hidden&&(this.version=ut),p(()=>(this.unfork=()=>{I({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let S=A.findVersion(i,["staged","published"]);A.findVersion(n).unstage().unpublish().changeAndNotify(S.toProperties()),A.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(A.findVersion(ct).revert(),A.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{I({title:"Component has unsaved changes",button:"Discard",body:"Are you sure to close editor and discard changes?",bypass:!this.props.changed,action:()=>{this.discard(),requestAnimationFrame(this.onClose)}})},this.save=()=>{I({bypass:!!this.props.forked,title:"Customizing component",button:"Save",body:"Changes to the component will only be visible on that page. Changes to component done in Component Builder will not be reflected here. It will be possible to revert the customization.",action:()=>{var S,W;(W=(S=A.findVersion(ct).commitData({view:this.editorContext.editor.getData({rootName:ct}),model:""}))===null||S===void 0?void 0:S.stage())===null||W===void 0||W.publish(),this.removeAttribute("changed"),this.setAttribute("forked",ct),A.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[A]);let Ke=u(()=>this.target,[A]);return u(()=>A&&L(t,({picker:S,children:W})=>x.createElement(y,{ref:P=>{this.chrome=P?{positionable:P,wrapper:P.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},x.createElement(y,{className:"editor-wrapper",position:"absolute",left:0,top:0},x.createElement(o,{datasources:Ot.datasources,sdk:Ot,library:ht,component:A,versions:xe,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:W,chrome:({editor:P})=>P&&x.createElement(Tt,null),children:({isArchivedDisplayed:P,editor:pt,status:Ut})=>x.createElement(y,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},x.createElement(y,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),x.createElement(y,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),x.createElement(y,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),x.createElement(y,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),ut&&x.createElement(l,{version:ut,node:Ke,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:x.createElement(E,{justifyContent:"space-between"},x.createElement(c,{size:"sm",editor:Ut=="ready"?pt:null}),x.createElement(f,{size:"sm"})),middle:(yr,vr)=>[!1],right:x.createElement(x.Fragment,null,x.createElement(k,{variant:"secondary",size:"sm",onClick:this.close},"Close"),x.createElement(k,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),x.createElement(h,{isDisabled:!this.props.forked&&!this.props.changed},x.createElement(St,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),x.createElement(St,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[ut,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};at.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];at.register("feaas-editor");function be(e){var t,r;return{part:(e==null?void 0:e.getAttribute("part"))||"picker",slot:(e==null?void 0:e.getAttribute("part"))||"picker",mode:e==null?void 0:e.getAttribute("mode"),dialog:e==null?void 0:e.getAttribute("dialog"),placeholder:(e==null?void 0:e.getAttribute("placeholder"))||"No theme",frontend:(t=e==null?void 0:e.getContextAttribute("frontend"))!==null&&t!==void 0?t:"https://components.sitecorecloud.io",src:(r=e==null?void 0:e.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(e==null?void 0:e.getAttribute("hidden"))!=null,variant:e==null?void 0:e.getAttribute("variant"),context:void 0,onClose:void 0,setAttribute:void 0,getAttribute:void 0}}var lt=class extends C{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return be(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){this.setAttribute("feaas-role","ui"),super.connectedCallback()}render({placeholder:t,context:r,mode:i,dialog:n,children:o,variant:s},{Picker:a,React:l,useContext:h,EnvironmentContext:c,useLibrary:f,useSDK:p,BYOC:u}){var g,m,E;let[y,k]=l.useReducer(A=>A+1,0),St=p(),Tt=h(c),Ee=f("collections"),Mt=f("components"),Lt=p("datasources"),L=f(),It=((m=(g=L==null?void 0:L.stylesheets)===null||g===void 0?void 0:g.first)===null||m===void 0?void 0:m.rules)||((E=L==null?void 0:L.stylesheet)===null||E===void 0?void 0:E.styles),$t=p("renderingHost.expandedComponents");var dt=r==null?void 0:r.getAttribute("data");if(dt)try{dt=JSON.parse(dt)}catch(A){}if(r)var x=St.ExternalComponent.getDefinition(r),Ot=x&&!x.getConfiguration(r),ht=(x==null?void 0:x.type)=="feaas"?Mt.find(A=>A.id==r.getAttribute("component")):u==null?void 0:u.getComponent(String(r.getAttribute("data-external-id")));return l.createElement(a,{cdn:Tt.cdn,rules:It,collections:Ee,themeContext:r,placeholder:t,embed:ht,externalComponents:$t,datasources:Lt,data:dt,versionId:r==null?void 0:r.getAttribute("version"),mode:i||(Ot?"library":ht?"context":null),setAttribute:(A,N,I)=>{N=="data"&&I&&(I=JSON.stringify(I)),this.props.setAttribute(A,N,I),k()},getAttribute:(A,N)=>r==null?void 0:r.getAttribute(N),dialog:n,context:r,variant:s,onModeChange:(A,N)=>{this.set({mode:A,dialog:N})}},o)}};lt.observedAttributes=["library","mode","frontend","src","hidden","variant","dialog"];lt.register("feaas-picker");function ye(e){var t,r,i,n,o;return{library:e==null?void 0:e.getAttribute("library"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/context.js",environment:(r=e==null?void 0:e.getAttribute("environment"))!==null&&r!==void 0?r:void 0,frontend:(i=e==null?void 0:e.getAttribute("frontend"))!==null&&i!==void 0?i:"https://components.sitecorecloud.io",backend:(n=e==null?void 0:e.getAttribute("backend"))!==null&&n!==void 0?n:"https://components.sitecorecloud.io/api",cdn:(o=e==null?void 0:e.getAttribute("cdn"))!==null&&o!==void 0?o:"https://feaas.blob.core.windows.net",auth:null,isolate:(e==null?void 0:e.getAttribute("isolate"))==null||(e==null?void 0:e.getAttribute("isolate"))=="true"}}var H=class extends C{constructor(){super(...arguments),this.defaultProps={isolate:!0},this.onStatusChange=(t,r)=>{t=="ready"&&(this.whenSDKReady.resolve(r),this.dispatchEvent(new CustomEvent("feaasReady",{bubbles:!0,composed:!0,detail:r})))},this.whenSDKReady=O(t=>{this.sdk=t})}getProps(){return ye(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null}getTheme(t){return t}getRoot(){return this.getAttribute("isolate")==="false"?this:this.shadowRoot||this.attachShadow({mode:"open"})}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}connectedCallback(){this.setAttribute("feaas-role","ui"),Array.from(this.children).forEach(t=>{this.getRoot().appendChild(t)}),document.addEventListener("feaasMount",this),document.addEventListener("feaasUnmount",this),super.connectedCallback()}disconnectedCallback(){document.removeEventListener("feaasMount",this),document.removeEventListener("feaasUnmount",this),super.disconnectedCallback()}getPortalRoot(){return this.getRoot()}render({children:t,library:r},{AppContext:i,Chakra:{Button:n,Tooltip:o},React:s}){let a={containerRef:{current:this.getPortalRoot()}};return o.defaultProps={hasArrow:!0,placement:"top",portalProps:a},s.createElement(i,{environment:this.props.environment,backend:this.props.backend,libraryId:this.props.library,container:this.getRoot(),auth:this.props.auth,getTheme:this.getTheme,onStatusChange:this.onStatusChange,modalProps:{portalProps:a},chakraProps:{resetScope:':where([feaas-role="ui"])',cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},t)}};H.observedAttributes=["library","component","version","revision","hostname","template"];H.register("feaas-context");H.prototype.clientside=ve;0&&(module.exports={Component,ComponentProps,Context,ControlledPromise,DEFAULT_CDN_URL,DOM,DataPath,DataScope,DataSettings,Element,FEAASComponent,FEAASComponentsProps,FEAASContext,FEAASContextProps,FEAASEditor,FEAASEditorProps,FEAASElement,FEAASLoader,FEAASLoaderProps,FEAASPicker,FEAASPickerProps,FEAASStylesheet,FEAASStylesheetProps,InvalidResponse,JSONPath,Loader,MyComponent,Picker,Stylesheet,Thumbnail,WebComponent,adjustNumbers,autoloadScripts,cleanCollectionBit,clearFetchCache,createStylesheet,customizeDataSettings,fetchAndRevalidate,fetchAndRevalidateComponent,fetchAndRevalidateStylesheet,fetchBypassingCache,fetchCache,fetchComponent,fetchData,fetchToValidateCache,fetchWithCacheAwareness,findStylesheet,getComponent,getComponentSource,getComponentURL,getFetchCache,getFramePosition,getHumanizedLabel,getLastPathBit,getQualifier,getStylesheetSource,getStylesheetURL,loadScript,loadStylesheet,loadStylesheetAllowStale,normalizeCollectionScope,observeDOMElement,parseComponentSource,parseLimit,parseRange,parseStylesheetSource,queryObject,queryObjectRaw,queryScopes,registerComponent,registerDatasource,renderComponent,renderComponentElement,renderComponentPromise,renderDOMContent,renderDOMElement,renderHTMLContent,renderStylesheet,renderStylesheetPromise,serializeCH1RichText,setDOMAttribute});
|
|
75
76
|
//# sourceMappingURL=index.cjs.map
|