@sitecore-feaas/clientside 0.2.0 → 0.2.1
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/README.md +51 -31
- package/build/components/FEAASComponent.js +2 -2
- package/build/components/FEAASComponent.js.map +1 -1
- package/build/components/FEAASElement.js +408 -37
- package/build/components/FEAASElement.js.map +1 -1
- package/build/components/FEAASLoader.js +2 -2
- package/build/components/FEAASLoader.js.map +1 -1
- package/build/components/FEAASReactElement.js +47 -0
- package/build/components/FEAASReactElement.js.map +1 -0
- package/build/components/FEAASStylesheet.js +2 -2
- package/build/components/FEAASStylesheet.js.map +1 -1
- package/build/headless.js +4 -3
- package/build/headless.js.map +1 -1
- package/build/ui/FEAASContext.js +14 -5
- package/build/ui/FEAASContext.js.map +1 -1
- package/build/ui/FEAASEditor.js +2 -2
- package/build/ui/FEAASEditor.js.map +1 -1
- package/build/ui/FEAASExternal.js +65 -23
- package/build/ui/FEAASExternal.js.map +1 -1
- package/build/ui/FEAASPicker.js +3 -2
- package/build/ui/FEAASPicker.js.map +1 -1
- package/dist/browser/headless.cjs +5 -5
- package/dist/browser/headless.cjs.map +4 -4
- package/dist/browser/headless.esm.js +5 -5
- package/dist/browser/headless.esm.js.map +1 -1
- package/dist/browser/index.cjs +7 -7
- package/dist/browser/index.cjs.map +4 -4
- package/dist/browser/index.esm.js +7 -7
- package/dist/browser/index.esm.js.map +1 -1
- package/dist/browser/react.cjs +6 -6
- package/dist/browser/react.cjs.map +4 -4
- package/dist/browser/react.esm.js +6 -6
- package/dist/browser/react.esm.js.map +1 -1
- package/dist/node/headless.cjs +3 -3
- package/dist/node/headless.cjs.map +4 -4
- package/dist/node/headless.esm.js +2 -2
- package/dist/node/headless.esm.js.map +4 -4
- package/dist/node/index.cjs +4 -4
- package/dist/node/index.cjs.map +4 -4
- package/dist/node/index.esm.js +3 -3
- package/dist/node/index.esm.js.map +4 -4
- package/dist/node/react.cjs +4 -4
- package/dist/node/react.cjs.map +4 -4
- package/dist/node/react.esm.js +4 -4
- package/dist/node/react.esm.js.map +4 -4
- package/headless.cjs +3 -3
- package/headless.cjs.map +4 -4
- package/headless.js +3 -3
- package/headless.js.map +4 -4
- package/package.json +10 -2
- package/react.cjs +6 -6
- package/react.cjs.map +4 -4
- package/react.js +6 -6
- package/react.js.map +4 -4
- package/scripts/test-setup.ts +1 -0
- package/src/components/FEAASComponent.tsx +4 -4
- package/src/components/FEAASElement.tsx +467 -42
- package/src/components/FEAASLoader.tsx +2 -2
- package/src/components/FEAASReactElement.tsx +61 -0
- package/src/components/FEAASStylesheet.tsx +3 -3
- package/src/headless.ts +5 -4
- package/src/ui/FEAASContext.tsx +16 -7
- package/src/ui/FEAASEditor.tsx +7 -7
- package/src/ui/FEAASExternal.tsx +76 -23
- package/src/ui/FEAASPicker.tsx +4 -3
- package/src/ui/tsconfig.json +1 -1
- package/test/FEAASBase.test.tsx +2 -2
- package/test/FEAASComponent.test.tsx +3 -1
- package/test/FEAASContext.test.tsx +206 -29
- package/test/FEAASPicker.test.tsx +4 -2
- package/types/components/FEAASComponent.d.ts +3 -3
- package/types/components/FEAASComponent.d.ts.map +1 -1
- package/types/components/FEAASElement.d.ts +292 -23
- package/types/components/FEAASElement.d.ts.map +1 -1
- package/types/components/FEAASLoader.d.ts +2 -2
- package/types/components/FEAASLoader.d.ts.map +1 -1
- package/types/components/FEAASReactElement.d.ts +30 -0
- package/types/components/FEAASReactElement.d.ts.map +1 -0
- package/types/components/FEAASStylesheet.d.ts +3 -3
- package/types/components/FEAASStylesheet.d.ts.map +1 -1
- package/types/headless.d.ts +4 -3
- package/types/headless.d.ts.map +1 -1
- package/types/tsbuildinfo +1 -1
- package/types/ui/FEAASContext.d.ts +8 -7
- package/types/ui/FEAASContext.d.ts.map +1 -1
- package/types/ui/FEAASEditor.d.ts +6 -6
- package/types/ui/FEAASEditor.d.ts.map +1 -1
- package/types/ui/FEAASExternal.d.ts +8 -10
- package/types/ui/FEAASExternal.d.ts.map +1 -1
- package/types/ui/FEAASPicker.d.ts +7 -6
- package/types/ui/FEAASPicker.d.ts.map +1 -1
- package/types/ui/tsbuildinfo +1 -0
- package/build/components/FEAASBase.js +0 -416
- package/build/components/FEAASBase.js.map +0 -1
- package/src/components/FEAASBase.tsx +0 -485
- package/types/components/FEAASBase.d.ts +0 -299
- package/types/components/FEAASBase.d.ts.map +0 -1
- package/types/tsbuildinfo_ui +0 -1
package/dist/browser/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var wt=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var be=Object.prototype.hasOwnProperty;var It=(e,t)=>{for(var r in t)wt(e,r,{get:t[r],enumerable:!0})},Ae=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of ye(t))!be.call(e,n)&&n!==r&&wt(e,n,{get:()=>t[n],enumerable:!(i=ge(t,n))||i.enumerable});return e};var we=e=>Ae(wt({},"__esModule",{value:!0}),e);var Qe={};It(Qe,{Base:()=>y,Component:()=>et,ComponentProps:()=>ne,DEFAULT_CDN_URL:()=>k,FEAASBase:()=>y,FEAASComponent:()=>et,FEAASComponentsProps:()=>ne,FEAASContext:()=>ot,FEAASContextProps:()=>me,FEAASEditor:()=>it,FEAASEditorProps:()=>pe,FEAASLoader:()=>rt,FEAASLoaderProps:()=>oe,FEAASPicker:()=>nt,FEAASPickerProps:()=>fe,FEAASStylesheet:()=>mt,FEAASStylesheetProps:()=>se,InvalidResponse:()=>ut,JSONPath:()=>f,Loader:()=>rt,MyComponent:()=>lt,Stylesheet:()=>mt,Thumbnail:()=>vt,autoloadScripts:()=>qt,cleanCollectionBit:()=>Kt,clearFetchCache:()=>He,createStylesheet:()=>re,fetchAndRevalidate:()=>Q,fetchAndRevalidateComponent:()=>j,fetchAndRevalidateStylesheet:()=>pt,fetchBypassingCache:()=>ct,fetchCache:()=>Y,fetchComponent:()=>Je,fetchToValidateCache:()=>Z,fetchWithCacheAwareness:()=>M,findStylesheet:()=>ee,getComponentSource:()=>Ve,getComponentURL:()=>kt,getFetchCache:()=>Xt,getFramePosition:()=>he,getQualifier:()=>Ue,getStylesheetSource:()=>ze,getStylesheetURL:()=>tt,loadScript:()=>G,loadStylesheet:()=>ft,loadStylesheetAllowStale:()=>Dt,normalizeCollectionScope:()=>Ft,observeDOMElement:()=>Jt,parseComponentSource:()=>X,parseLimit:()=>Be,parseRange:()=>Ie,parseStylesheetSource:()=>ht,queryScopes:()=>dt,renderComponent:()=>Nt,renderComponentElement:()=>Ke,renderComponentPromise:()=>ie,renderDOMContent:()=>U,renderDOMElement:()=>S,renderHTMLContent:()=>We,renderStylesheet:()=>qe,renderStylesheetPromise:()=>te,serializeCH1RichText:()=>B,setDOMAttribute:()=>I});module.exports=we(Qe);function _(e,t=r=>{}){var r;let i=()=>{var n,s;let o=new Promise((l,u)=>{n=d=>{e==null||e(d),l(d)},s=u});var a=Object.assign(o,{resolve:n,reject:s,restart:i,first:r});return r=a,a.catch(t),a};return i()}var Ee=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,y=class extends Ee{getProps(t){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=_(t=>{this.payload=t}),this.whenRendered=_(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),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.dispatchEvent(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)}}log(...t){console.log(...t)}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEvent(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected=!1)}getParent(t=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!t||r.tagName.startsWith("FEAAS-"))return r}getElements(t=this.getRoot(),r=!0){return Array.from(t.querySelectorAll("*")).map(i=>[!r||i.tagName.startsWith("FEAAS-")?i:null,i.shadowRoot?this.getElements(i.shadowRoot,r):null]).flat().filter(Boolean)}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 s=t.refs.parent;s;s=s.refs.parent)s.render&&((i=t.refs).parentReact||(i.parentReact=s),t.refs.topReact=s)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(t,r="uncaught",i=!1){let n=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:t});if(this.dispatchEvent(n),this.whenLoaded.reject(t),!n.defaultPrevented&&!i){this.whenRendered.reject(t);try{this.unmount()}catch(s){}return!0}return!1}shouldUpdateOnLoad(){return!0}async advance(){try{if(this.payload===void 0){if(!this.isReadyToLoad())return;this.payload=null,this.dispatchEvent(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;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:s,ReactDOMClient:o}=this.payload||{};if(!n)throw new Error(`${this.tagName}: React is not present in payload`);if(!s)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?o?(this.reactRoot||(this.reactRoot=o.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):s.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact?(t=this.forceUpdateReact)===null||t===void 0||t.call(this):(i=(r=this.refs.topReact).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).map((n,s)=>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(o){return{error:o}}componentDidCatch(o,a){console.error(`FEAAS: ${t.tagName} Error:`,o,a),t.onError(o,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(t=this,r){let{React:i,ReactDOM:n}=t.payload||{},s=this.getReactErrorBoundary(),o=this.getReactWrapper(t);return i.createElement(s,{key:t.tagName+"-"+t.getUID(),slot:t.getAttribute("slot")},i.createElement(o,null))}getReactWrapper(t=this,r=t.tagName){if(t.reactWrapper)return t.reactWrapper;let{React:i,ReactDOM:n}=t.payload||{};return t.reactWrapper=s=>{if(t.render){let[o,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 i=this.props[r],n=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();i==null||i===this.defaultProps[r]?this.removeAttribute(n):(typeof i=="string"||typeof i=="number"||typeof i=="boolean")&&this.getAttribute(n)!=String(i)&&this.setAttribute(n,String(i))}}catch(i){this.whenRendered.reject(i),this.onError(i,"set")}return this}import(t){return import( /*@vite-ignore*/ /* webpackIgnore: true */ t)}scheduleRender(){this.nextRender==null&&(this.whenRendered=this.whenRendered.restart()),cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(t=>{})})}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 $=class extends y{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([t,r])=>({React:t,ReactDOM:r}))}render({},{React:t}){return t.createElement(t.Fragment,null)}},lt=class extends ${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(s=>s+1)},[t]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",t),r.createElement("p",null,"Triggered updates: ",i))}};lt.observedAttributes=["counter"];function F(e){return F=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},F(e)}function jt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ut(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function Wt(e,t,r){return t&&Ut(e.prototype,t),r&&Ut(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function xe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&K(e,t)}function q(e){return q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},q(e)}function K(e,t){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(i,n){return i.__proto__=n,i},K(e,t)}function Ht(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function J(e,t,r){return Ht()?J=Reflect.construct.bind():J=function(n,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(n,a),u=new l;return o&&K(u,o.prototype),u},J.apply(null,arguments)}function Ce(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Et(e){var t=typeof Map=="function"?new Map:void 0;return Et=function(i){if(i===null||!Ce(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(i))return t.get(i);t.set(i,n)}function n(){return J(i,arguments,q(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),K(n,i)},Et(e)}function Se(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Re(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Se(e)}function _e(e){var t=Ht();return function(){var i=q(e),n;if(t){var s=q(this).constructor;n=Reflect.construct(i,arguments,s)}else n=i.apply(this,arguments);return Re(this,n)}}function Fe(e){return ke(e)||De(e)||Vt(e)||Ne()}function ke(e){if(Array.isArray(e))return xt(e)}function De(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Vt(e,t){if(e){if(typeof e=="string")return xt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xt(e,t)}}function xt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function Ne(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pe(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Vt(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var
|
|
3
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return s=l.done,l},e:function(l){o=!0,a=l},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}var w=Object.prototype.hasOwnProperty;function T(e,t){return e=e.slice(),e.push(t),e}function Ct(e,t){return t=t.slice(),t.unshift(e),t}var Te=function(e){xe(r,e);var t=_e(r);function r(i){var n;return jt(this,r),n=t.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),n.avoidNew=!0,n.value=i,n.name="NewError",n}return Wt(r)}(Et(Error));function f(e,t,r,i,n){if(!(this instanceof f))try{return new f(e,t,r,i,n)}catch(l){if(!l.avoidNew)throw l;return l.value}typeof e=="string"&&(n=i,i=r,r=t,t=e,e=null);var s=e&&F(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=w.call(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.preventEval=e.preventEval||!1,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||i||null,this.otherTypeCallback=e.otherTypeCallback||n||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){var o={path:s?e.path:t};s?"json"in e&&(o.json=e.json):o.json=r;var a=this.evaluate(o);if(!a||F(a)!=="object")throw new Te(a);return a}}f.prototype.evaluate=function(e,t,r,i){var n=this,s=this.parent,o=this.parentProperty,a=this.flatten,l=this.wrap;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=i||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&F(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(!w.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var u=e;t=u.json,a=w.call(e,"flatten")?e.flatten:a,this.currResultType=w.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=w.call(e,"sandbox")?e.sandbox:this.currSandbox,l=w.call(e,"wrap")?e.wrap:l,this.currPreventEval=w.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=w.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=w.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,s=w.call(e,"parent")?e.parent:s,o=w.call(e,"parentProperty")?e.parentProperty:o,e=e.path}if(s=s||null,o=o||null,Array.isArray(e)&&(e=f.toPathString(e)),!(!e&&e!==""||!t)){var d=f.toPathArray(e);d[0]==="$"&&d.length>1&&d.shift(),this._hasParentSelector=null;var h=this._trace(d,t,["$"],s,o,r).filter(function(c){return c&&!c.isParentSelector});return h.length?!l&&h.length===1&&!h[0].hasArrExpr?this._getPreferredOutput(h[0]):h.reduce(function(c,p){var E=n._getPreferredOutput(p);return a&&Array.isArray(E)?c=c.concat(E):c.push(E),c},[]):l?[]:void 0}};f.prototype._getPreferredOutput=function(e){var t=this.currResultType;switch(t){case"all":{var r=Array.isArray(e.path)?e.path:f.toPathArray(e.path);return e.pointer=f.toPointer(r),e.path=typeof e.path=="string"?e.path:f.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return f.toPathString(e[t]);case"pointer":return f.toPointer(e.path);default:throw new TypeError("Unknown result type")}};f.prototype._handleCallback=function(e,t,r){if(t){var i=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:f.toPathString(e.path),t(i,r,e)}};f.prototype._trace=function(e,t,r,i,n,s,o,a){var l=this,u;if(!e.length)return u={path:r,value:t,parent:i,parentProperty:n,hasArrExpr:o},this._handleCallback(u,s,"value"),u;var d=e[0],h=e.slice(1),c=[];function p(g){Array.isArray(g)?g.forEach(function(m){c.push(m)}):c.push(g)}if((typeof d!="string"||a)&&t&&w.call(t,d))p(this._trace(h,t[d],T(r,d),t,d,s,o));else if(d==="*")this._walk(t,function(g){p(l._trace(h,t[g],T(r,g),t,g,s,!0,!0))});else if(d==="..")p(this._trace(h,t,r,i,n,s,o)),this._walk(t,function(g){F(t[g])==="object"&&p(l._trace(e.slice(),t[g],T(r,g),t,g,s,!0))});else{if(d==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:h,isParentSelector:!0};if(d==="~")return u={path:T(r,d),value:n,parent:i,parentProperty:null},this._handleCallback(u,s,"property"),u;if(d==="$")p(this._trace(h,t,r,null,null,s,o));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(d))p(this._slice(d,h,t,r,i,n,s));else if(d.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var E=d.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1");this._walk(t,function(g){l._eval(E,t[g],g,r,i,n)&&p(l._trace(h,t[g],T(r,g),t,g,s,!0))})}else if(d[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");p(this._trace(Ct(this._eval(d,t,r[r.length-1],r.slice(0,-1),i,n),h),t,r,i,n,s,o))}else if(d[0]==="@"){var v=!1,x=d.slice(1,-2);switch(x){case"scalar":(!t||!["object","function"].includes(F(t)))&&(v=!0);break;case"boolean":case"string":case"undefined":case"function":F(t)===x&&(v=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(v=!0);break;case"number":Number.isFinite(t)&&(v=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(v=!0);break;case"object":t&&F(t)===x&&(v=!0);break;case"array":Array.isArray(t)&&(v=!0);break;case"other":v=this.currOtherTypeCallback(t,r,i,n);break;case"null":t===null&&(v=!0);break;default:throw new TypeError("Unknown value type "+x)}if(v)return u={path:r,value:t,parent:i,parentProperty:n},this._handleCallback(u,s,"value"),u}else if(d[0]==="`"&&t&&w.call(t,d.slice(1))){var A=d.slice(1);p(this._trace(h,t[A],T(r,A),t,A,s,o,!0))}else if(d.includes(",")){var st=d.split(","),N=Pe(st),at;try{for(N.s();!(at=N.n()).done;){var Ot=at.value;p(this._trace(Ct(Ot,h),t,r,i,n,s,!0))}}catch(g){N.e(g)}finally{N.f()}}else!a&&t&&w.call(t,d)&&p(this._trace(h,t[d],T(r,d),t,d,s,o,!0))}if(this._hasParentSelector)for(var D=0;D<c.length;D++){var L=c[D];if(L&&L.isParentSelector){var P=this._trace(L.expr,t,L.path,i,n,s,o);if(Array.isArray(P)){c[D]=P[0];for(var gt=P.length,W=1;W<gt;W++)D++,c.splice(D,0,P[W])}else c[D]=P}}return c};f.prototype._walk=function(e,t){if(Array.isArray(e))for(var r=e.length,i=0;i<r;i++)t(i);else e&&F(e)==="object"&&Object.keys(e).forEach(function(n){t(n)})};f.prototype._slice=function(e,t,r,i,n,s,o){if(Array.isArray(r)){var a=r.length,l=e.split(":"),u=l[2]&&Number.parseInt(l[2])||1,d=l[0]&&Number.parseInt(l[0])||0,h=l[1]&&Number.parseInt(l[1])||a;d=d<0?Math.max(0,d+a):Math.min(a,d),h=h<0?Math.max(0,h+a):Math.min(a,h);for(var c=[],p=d;p<h;p+=u){var E=this._trace(Ct(p,t),r,i,n,s,o,!0);E.forEach(function(v){c.push(v)})}return c}};f.prototype._eval=function(e,t,r,i,n,s){this.currSandbox._$_parentProperty=s,this.currSandbox._$_parent=n,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;var o=e.includes("@path");o&&(this.currSandbox._$_path=f.toPathString(i.concat([r])));var a="script:"+e;if(!f.cache[a]){var l=e.replace(/@parentProperty/g,"_$_parentProperty").replace(/@parent/g,"_$_parent").replace(/@property/g,"_$_property").replace(/@root/g,"_$_root").replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1");o&&(l=l.replace(/@path/g,"_$_path")),f.cache[a]=new this.vm.Script(l)}try{return f.cache[a].runInNewContext(this.currSandbox)}catch(u){throw new Error("jsonPath: "+u.message+": "+e)}};f.cache={};f.toPathString=function(e){for(var t=e,r=t.length,i="$",n=1;n<r;n++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[n])||(i+=/^[\*0-9]+$/.test(t[n])?"["+t[n]+"]":"['"+t[n]+"']");return i};f.toPointer=function(e){for(var t=e,r=t.length,i="",n=1;n<r;n++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[n])||(i+="/"+t[n].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return i};f.toPathArray=function(e){var t=f.cache;if(t[e])return t[e].concat();var r=[],i=e.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,";$&;").replace(/['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))['\]]/g,function(s,o){return"[#"+(r.push(o)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(s,o){return"['"+o.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(s,o){return";"+o.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),n=i.split(";").map(function(s){var o=s.match(/#([0-9]+)/);return!o||!o[1]?s:r[o[1]]});return t[e]=n,t[e].concat()};var Oe=function(t,r,i){for(var n=t.length,s=0;s<n;s++){var o=t[s];i(o)&&r.push(t.splice(s--,1)[0])}},Me=function(){function e(t){jt(this,e),this.code=t}return Wt(e,[{key:"runInNewContext",value:function(r){var i=this.code,n=Object.keys(r),s=[];Oe(n,s,function(d){return typeof r[d]=="function"});var o=n.map(function(d,h){return r[d]}),a=s.reduce(function(d,h){var c=r[h].toString();return/function/.test(c)||(c="function "+c),"var "+h+"="+c+";"+d},"");i=a+i,!/(["'])use strict\1/.test(i)&&!n.includes("arguments")&&(i="var arguments = undefined;"+i),i=i.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var l=i.lastIndexOf(";"),u=l>-1?i.slice(0,l+1)+" return "+i.slice(l+1):" return "+i;return J(Function,n.concat([u])).apply(void 0,Fe(o))}}]),e}();f.prototype.vm={Script:Me};function dt(e,t,r=!1,i=e){var n=t;let s=Object.keys(e).sort((a,l)=>l.length-a.length);for(let a of s)if(t.startsWith(a)){if(a==t){if(r)return e[a];continue}n=t.substring(a.length+1),i=e[a];break}var o=f({path:n,json:i});return Array.isArray(o)&&(o==null?void 0:o.length)==0&&(o=[n.replace(/^.*?\./,"_."),n.replace(/^.*?\./,""),n.replace(/^([^.]+).*?\.\$\./,"$1."),n.replace(/^.*?\.\$\./,"_."),n.replace(/^.*?\.\$\./,""),n.replace(/^[^.]+$/,"_")].filter((a,l,u)=>u.indexOf(a)===l).reduce((a,l)=>a.length>0?a:f({path:l,json:i}),[])),r&&Array.isArray(o)?o[0]:o}function St(e,t={},r){return r?`<${r}${Object.entries(t).map(([i,n])=>n!=null&&` ${i}="${n}"`).filter(Boolean).join("")}>${B(e)}</${r}>`.replace(/^<([a-z0-9][^>]*)><\/[^>]+>$/,"<$1 />"):B(e)}function B(e){var t;if(Array.isArray(e))return e.map(B).join(`
|
|
4
|
-
`).trim();if(typeof e=="string")return e;if(e==null)return"";switch(e.type){case"heading":let{level:r,...i}=e.attrs;return St(e.content,i,"h"+r);case"text":return(e.marks||[]).reduce((n,s)=>St(n,s.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[s.type]),(t=e.text)===null||t===void 0?void 0:t.replace(/\s+/," "));default:return St(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}var O=class{constructor(t,r=1,i){this.ownerDocument={createElement(n){return new O(n)}},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 Rt(this.childNodes)}set innerHTML(t){this.childNodes=_t(String(t!=null?t:""))}get outerHTML(){return Rt([this])}get children(){return this.childNodes.filter(t=>t.nodeType==1)}closest(t){let r=this;for(;r;){if(zt(t,r))return r;r=r.parentNode}return null}querySelectorAll(t){let r=t.split(/\s*,\s*/),i=[],n=s=>{for(let o of r)if(zt(o,s)){i.push(s);break}for(let o of s.childNodes)n(o)};for(let s of this.childNodes)n(s);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 s=n+t;s>=0&&s<i.length;s+=t){let o=i[s];if(!r||o.nodeType===1)return o}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 O(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 zt(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 s=n[1],o=n[3],a=t.getAttribute(s);if(typeof o=="undefined"){if(a===void 0)return!1}else if(a!==o)return!1}else return!1}else if(t.nodeName!==i)return!1;return!0}function _t(e){var t;let r=[],i=[];for(;e;){let n=e.match(/^<([\w-]+)(\s[^>]*)?>/),s=e.match(/^<\/([\w-]+)>/);if(n){let o=n[1],l=((t=(n[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||t===void 0?void 0:t.map(d=>{let[h,c,,p]=d.match(/([\w-]+)(="([^"]*)")?/);return{name:c,value:$e(p||"")}}))||[],u=new O(o,1);if(u.attributes=l,i.length>0){let d=i[i.length-1];d.childNodes.push(u),u.parentNode=d}else r.push(u);i.push(u),e=e.slice(n[0].length)}else if(s)i.pop(),e=e.slice(s[0].length);else{let o=e.indexOf("<"),a=e.slice(0,o!==-1?o:void 0),l=new O("#text",3);if(l.textContent=a,i.length>0){let u=i[i.length-1];u.childNodes.push(l),l.parentNode=u}else r.push(l);e=e.slice(a.length)}}return r}function Le(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function $e(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}function Rt(e){return e.map(t=>{if(t.nodeType===3)return t.textContent||"";let{nodeName:r,attributes:i}=t,n=i.map(({name:o,value:a})=>` ${o}="${Le(String(a))}"`).join(""),s=Rt(t.childNodes);return["img","input","br"].includes(r)?`<${r}${n} />`:`<${r}${n}>${s}</${r}>`}).join("")}function Jt(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(i=>{let n=i.target,s=n.getAttribute("data-embed-src");s&&G(n,s),i.addedNodes&&i.addedNodes.forEach(o=>{o.nodeType==1&&qt(o,!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];G(n,n.getAttribute("data-embed-src"))}if(t)return Jt(e)}function G(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 s=r.ownerDocument.createElement("script");s.setAttribute("type","module"),s.setAttribute("src",t),r.appendChild(s);break}}var Be=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},Ie=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},Ue=e=>{var t;return(t=e==null?void 0:e.match(/(\.\*|\[[^\]]+\])$/))===null||t===void 0?void 0:t[0]};function Kt(e){return e.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function Ft(e){return Kt(e)+".*"}function Yt(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 je(e,t,r){let i=e.getAttribute("data-path-scope");if(i==null)return;var n=Yt(e);if(n!=0)return;let s=e.parentNode;if(s!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var o=n+1,a=e,l=e;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==i&&(o++,a=l);for(var u=o;u<t;u++)s.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var u=Math.max(1,t);u<o;u++)a=a.previousElementSibling,s.removeChild(a.nextElementSibling)}}function I(e,t,r,i){var n,s;if(e){var o=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=B(r)),i!=null&&i.processValue&&(r=i==null?void 0:i.processValue(e,t,r));var a=t.replace("data-path-","");if(t=="data-path-src"){let c=Array.from(e.children).find(p=>p.localName=="picture")||e;o=e.localName=="img"?e:c.querySelector("img, video")}else if(t=="data-path-href")o=e.querySelector("a")||e.closest("a");else if(t=="data-path-alt")o=(Array.from(e.children).find(p=>p.localName=="picture")||e).querySelector("img, picture");else if(t=="data-path-hidden")r=r?null:!0;else if(t=="data-path"||t=="data-embed-html"||t=="html")a="innerHTML";else if(t=="data-embed-src")G(e,r);else if(t=="data-path-attributes"){let c=((n=e.getAttribute("data-attributes-keys"))===null||n===void 0?void 0:n.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var l in r){var u=r[l];I(e,l,typeof u=="object"&&u?JSON.stringify(u):u,i)}for(var d=0;d<c.length;d++)(r==null||!(c[d]in r))&&I(e,c[d],null,i);I(e,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var h=String((s=e.getAttribute("data-path-placeholder")||o[a])!==null&&s!==void 0?s:o.getAttribute(a));r!=null?a=="innerHTML"?o.innerHTML!=r&&(o.innerHTML=r):o.getAttribute(a)!=r&&o.setAttribute(a,r):a=="innerHTML"?o.innerHTML=h:o.removeAttribute(a)}}}var Gt=["data-attributes-keys","data-path-attributes","data-path-scope"];function S(e,t,r,i){var n,s,o;let a=e;if(i||(t=((n=r==null?void 0:r.processData)===null||n===void 0?void 0:n.call(r,a,t))||t),a.nodeType==1){let d=a.getAttribute("data-path-scope");if(d){let c=Yt(a),p=dt(t,d,!1)||[];c==0&&je(a,((s=r==null?void 0:r.shouldRepeat)===null||s===void 0?void 0:s.call(r,a,p))===!1?1:p.length,r),t={...t,[Ft(d)]:p[c]}}let h=Array.prototype.slice.call(a.attributes).sort((c,p)=>Gt.indexOf(c.name)-Gt.indexOf(p.name));for(var l=0;l<h.length;l++){let{name:c,value:p}=h[l];c.startsWith("data-path")&&c!="data-path-scope"&&I(a,c,dt(t,p,!0),r),c=="data-embed-src"&&I(a,c,a.getAttribute(c),r)}}for(var l=0,u;u=a.childNodes[l++];)Qt(u)&&S(u,t,r,!0);return i||(o=r==null?void 0:r.onRender)===null||o===void 0||o.call(r,a,t),a}function Qt(e){return e.nodeType==1}function U(e,t,r,i){var n;let s=((n=i==null?void 0:i.processTemplate)===null||n===void 0?void 0:n.call(i,e,t,r))||t;if(e.innerHTML=s,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(var a=0,l;l=e.childNodes[a++];)Qt(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return S(e,r,i)}function We(e,t,r,i=!1){var n;let s=((n=r==null?void 0:r.processTemplate)===null||n===void 0?void 0:n.call(r,null,e,t))||e;if(typeof document=="undefined"||i){let o=_t(s);return S(o[0],t,r).outerHTML}else{let o=document.createElement("div");return o.innerHTML=s,S(o,t,r),o.innerHTML}}var Zt=["initial","check","updated"],Y={};function He(){Y={}}async function Q(e,t,r,i,n=Y){return M({url:e,options:t,validator:r,callback:i,cache:n}).then(Z).then(s=>s.response)}function Xt(e,t=!1){let r=String(e).replace("?head","");var i=Y[r];return!i&&!t&&(i=Y[r]={phase:null,initial:_(),check:_(),updated:_(),final:_()}),i}var ut=class extends Error{};async function M({url:e,options:t,validator:r,callback:i,cache:n},s="initial"){let o=new Date;if(n!=null){var a=Xt(e);if(Zt.indexOf(a.phase)>=Zt.indexOf(s))var l=a[s];else a.phase=s}let u=await(l||fetch(e,t));if(!l&&a&&(u.ok?a[s].resolve(u):a[s].reject(new Error("Fetch failed"))),!u.ok)throw new Error("Fetch failed");let d=new Date(u.headers.get("date"))<o||l&&s=="initial"&&(a.phase=="updated"||a.phase=="check");if((r==null?void 0:r(u,d))===!1)throw new ut("Response is not valid");return await(i==null?void 0:i(u,s,d)),{url:e,options:t,isCached:d,response:u,validator:r,callback:i,cache:n}}async function Z(e){let{url:t,isCached:r,options:i,validator:n,response:s,cache:o}=e;if(r){let{response:a}=await M({url:t+"?head",options:{...i,method:"HEAD",cache:"no-cache"},validator:n,cache:o},"check");if(a.headers.get("last-modified")!=s.headers.get("last-modified"))return ct(e)}return e}async function ct(e){return M({...e,options:{...e.options,cache:"reload"}},"updated")}var k="https://feaas.blob.core.windows.net";function X(e){let t=e.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(t){var[,r,i,n,s,o]=t;return{cdn:r,library:i,component:n,version:s,revision:o}}}function Ve(e){if(!e||!e.library||!e.component)throw new Error("Component requires `library` and `component` properties");return`${e.cdn&&e.cdn!=k?`${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 ze(e){return`${e.cdn&&e.cdn!=k?`${e.cdn}/styles/`:""}${e.library}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function ht(e){let t=e.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(t){var[,r,i,n]=t;return{cdn:r,library:i,revision:n}}else{let s=X(e);if(s){var{cdn:r,library:i,revision:n}=s;return n!=null&&n.match(/\d/)&&(n=void 0),{cdn:r,library:i,revision:n}}}}function kt(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...X(e.src)}),`${e.cdn||e.hostname||k}/components/${e.library}/${e.component}/${e.version}/${e.revision||"published"}.html`}function tt(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...ht(e.src)}),`${e.cdn||e.hostname||k}/styles/${e.library}/${e.revision||"published"}.css`}async function j(e,t,r=!1){let i=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,n=a=>a.clone().text().then(t),s=await Promise.all([e.instance&&M({options:{headers:{Accept:"text/html"},credentials:"omit"},url:kt({...e,version:e.instance}),validator:i}).catch(a=>a),M({url:kt(e),validator:i}).catch(a=>a)]),o=s.find(a=>a&&"isCached"in a&&a);if(!o||o instanceof Error)throw s.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return s[0]==o&&console.log("Using fork!",s),await n(o.response),r?o:Z({...o,callback:n}).catch(a=>{if(s[0]==o&&(ct({...o,callback:null,validator:null}),console.log("Fork was deleted"),!(s[1]instanceof Error)))return n(s[1].response),Z({...s[1],callback:n});throw a})}async function Je(e){typeof e=="string"&&(e={src:e});var t;let{response:r}=await j(e,i=>{t=i},!0);return{...e,template:t,lastModified:r.headers.get("last-modified")}}async function pt(e,t){return typeof e=="string"&&(e={src:e}),Q(tt(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 qe(e,t){return te(e,t||(t=document.createElement("style"))),t}function te(e,t){return t||(t=document.createElement("style")),pt(e,(r,i)=>{t.textContent=r}).then(()=>t)}function ft(e,t){var r=ee(e);if(!r)var i=re(e);return pt(e,(n,s)=>{i&&(i.textContent=n),t==null||t(n,s)}).then(()=>r||i)}function Dt(e){return new Promise((t,r)=>{ft(e,t).catch(r)})}function ee(e){return document.head.querySelector(`style[data-href="${tt(e)}"]`)}function re(e){let t=tt(e),r=document.createElement("style");return r.setAttribute("data-href",t),document.head.appendChild(r),r}function Ke(e,t){let r=document.createElement("div");r.innerHTML=e;let i=document.createDocumentFragment();for(;r.firstChild;)i.appendChild(r.firstChild);return S(i,t),r}function Nt(e,t){return ie(e,t||(t=document.createElement("div"))),t}async function ie(e,t){return t||(t=document.createElement("div")),t.childNodes.length?S(t,e.data,e):"template"in e?U(t,e.template,e.data,e):j(e,r=>U(t,r,e.data,e)).then(()=>t)}function ne(e){var t,r,i,n,s,o,a,l;let u,d=e.getAttribute("src");if(d){let A=X(d);if(!A)throw new Error(`Could not parse FEAAS Component source: ${d}`);var{cdn:h,library:c,component:p,version:E,revision:v}=A}let x=e.getAttribute("data");if(x!=null&&x!="")try{u=typeof x=="string"?JSON.parse(x):{}}catch(A){}return{data:u||{},cdn:(r=(t=e.getContextAttribute("cdn"))!==null&&t!==void 0?t:h)!==null&&r!==void 0?r:k,library:(i=e.getAttribute("library"))!==null&&i!==void 0?i:c,component:(n=e.getAttribute("component"))!==null&&n!==void 0?n:p,version:(o=(s=e.getAttribute("version"))!==null&&s!==void 0?s:E)!==null&&o!==void 0?o:"responsive",revision:(l=(a=e.getAttribute("revision"))!==null&&a!==void 0?a:v)!==null&&l!==void 0?l:"published",hostname:e.getAttribute("hostname"),template:e.getAttribute("template"),instance:e.getAttribute("instance"),editable:e.getAttribute("editable")!=null,suspended:e.getAttribute("suspended")!=null,lastModified:e.getAttribute("last-modified"),withStylesheet:e.getAttribute("with-stylesheet")!="false"}}var et=class extends y{setData(t){this.set({data:t})}getProps(){return ne(this)}attributeChangedCallback(t,r,i){r!==i&&((t=="library"||t=="component"||t=="revision"||t=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(t,r,i))}getEditor(){var t;return(t=document.querySelector("feaas-context"))===null||t===void 0?void 0:t.refs.editor}constructor(){super(),this.defaultProps={cdn:k,revision:"published",version:"responsive",withStylesheet:!0,editable:!1,suspended:!1},this.onLoad=t=>{this.payload=t,this.advance()},this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let t=this.getEditor();if(t!=null&&t.setTarget(this))return t.open(),!0}getOriginal(){let t=this.getAttribute("data-path-scope");if(t){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==t;)var i=r;return i}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(!this.getOriginal()){if(this.props.withStylesheet)var t=Dt({...this.props,revision:"published"}).then(()=>{t=null,this.payload&&this.onLoad(this.payload)});return Promise.all([t,j(this.props,r=>{this.payload=r,t||this.onLoad(r)})]).then(()=>this.payload)}}update(){if(Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)S(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;U(this,this.payload,this.props.data)}}};et.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];et.register("feaas-component");function oe(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 rt=class extends y{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return oe(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=`
|
|
1
|
+
var Et=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var ye=Object.getOwnPropertyNames;var be=Object.prototype.hasOwnProperty;var It=(e,t)=>{for(var r in t)Et(e,r,{get:t[r],enumerable:!0})},Ae=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ye(t))!be.call(e,i)&&i!==r&&Et(e,i,{get:()=>t[i],enumerable:!(n=ge(t,i))||n.enumerable});return e};var Ee=e=>Ae(Et({},"__esModule",{value:!0}),e);var Qe={};It(Qe,{Component:()=>et,ComponentProps:()=>ie,Context:()=>ot,ControlledPromise:()=>S,DEFAULT_CDN_URL:()=>k,Element:()=>y,FEAASComponent:()=>et,FEAASComponentsProps:()=>ie,FEAASContext:()=>ot,FEAASContextProps:()=>me,FEAASEditor:()=>nt,FEAASEditorProps:()=>pe,FEAASElement:()=>y,FEAASLoader:()=>rt,FEAASLoaderProps:()=>oe,FEAASPicker:()=>it,FEAASPickerProps:()=>fe,FEAASStylesheet:()=>mt,FEAASStylesheetProps:()=>se,InvalidResponse:()=>ut,JSONPath:()=>f,Loader:()=>rt,MyComponent:()=>lt,Picker:()=>it,Stylesheet:()=>mt,Thumbnail:()=>vt,autoloadScripts:()=>qt,cleanCollectionBit:()=>Kt,clearFetchCache:()=>He,createStylesheet:()=>re,fetchAndRevalidate:()=>Q,fetchAndRevalidateComponent:()=>j,fetchAndRevalidateStylesheet:()=>pt,fetchBypassingCache:()=>ct,fetchCache:()=>Y,fetchComponent:()=>Je,fetchToValidateCache:()=>Z,fetchWithCacheAwareness:()=>M,findStylesheet:()=>ee,getComponentSource:()=>Ve,getComponentURL:()=>kt,getFetchCache:()=>Xt,getFramePosition:()=>he,getQualifier:()=>Be,getStylesheetSource:()=>ze,getStylesheetURL:()=>tt,loadScript:()=>G,loadStylesheet:()=>ft,loadStylesheetAllowStale:()=>Dt,normalizeCollectionScope:()=>Ft,observeDOMElement:()=>Jt,parseComponentSource:()=>X,parseLimit:()=>Ue,parseRange:()=>Ie,parseStylesheetSource:()=>ht,queryScopes:()=>dt,renderComponent:()=>Nt,renderComponentElement:()=>Ke,renderComponentPromise:()=>ne,renderDOMContent:()=>B,renderDOMElement:()=>R,renderHTMLContent:()=>We,renderStylesheet:()=>qe,renderStylesheetPromise:()=>te,serializeCH1RichText:()=>U,setDOMAttribute:()=>I});module.exports=Ee(Qe);function S(e,t=r=>{}){var r;let n=()=>{var i,s;let o=new Promise((l,u)=>{i=d=>{e==null||e(d),l(d)},s=u});var a=Object.assign(o,{resolve:i,reject:s,restart:n,first:r});return r=a,a.catch(t),a};return n()}var we=typeof HTMLElement=="undefined"?typeof windowJSDOM!="undefined"?windowJSDOM.HTMLElement:class{}:HTMLElement,y=class extends we{getProps(t){return{}}constructor(){super(),this.defaultProps={},this.connected=!1,this.refs={},this.descendants=[],this.whenLoaded=S(t=>{this.payload=t}),this.whenRendered=S(()=>this.initialized=!0,()=>cancelAnimationFrame(this.nextRender)),this.addEventListener("feaasMount",this),this.addEventListener("feaasUnmount",this)}getRoot(){return this}attributeChangedCallback(t,r,n){this.set()}connectedCallback(){this.mount()}disconnectedCallback(){this.unmount()}mount(){try{let t=this.getParent();if(t&&!t.connected||this.connected)return;this.connected=!0,this.log("FEAAS: Mount",this.tagName,this),this.dispatchEvent(new Event("feaasMount",{bubbles:!0,composed:!0})),this.getElements().map(r=>{var n;return(n=r.mount)===null||n===void 0?void 0:n.call(r)}),this.set()}catch(t){this.onError(t)}}log(...t){typeof process!="undefined"&&process.env.TESTING||console.log(...t)}unmount(){this.connected&&(this.log("FEAAS: Unmount",this),this.dispatchEvent(new Event("feaasUnmount",{bubbles:!0,composed:!0})),this.connected=!1)}getParent(t=!0){for(var r=this;r=r.parentElement||(r.parentNode instanceof ShadowRoot?r.parentNode.host:null);)if(!t||r.tagName.startsWith("FEAAS-"))return r}getElements(t=this.getRoot(),r=!0){return Array.from(t.querySelectorAll("*")).map(n=>[!r||n.tagName.startsWith("FEAAS-")?n:null,n.shadowRoot?this.getElements(n.shadowRoot,r):null]).flat().filter(Boolean)}handleEvent(t){let r=t.composedPath()[0];switch(t.type){case"feaasMount":r!=this&&this.nestedCallback(r);break;case"feaasUnmount":r!=this&&this.unnestedCallback(r);break}}unnestedCallback(t){let r=this.descendants.indexOf(t);r!=-1&&(this.log("FEAAS: Unnest",this,t),this.descendants.splice(r,-1),this.refs[t.getComponentName()]=null,t.refs.parent==this&&(t.refs.parent=null),t.refs.top==this&&(t.refs.top=t.refs.parent))}nestedCallback(t){var r,n;if(this.descendants.indexOf(t)==-1&&(this.descendants.push(t),this.log("FEAAS: Nest",this,t),this.refs[t.getComponentName()]=t,t.refs.top=this,(r=t.refs).parent||(r.parent=this),t.render))for(var s=t.refs.parent;s;s=s.refs.parent)s.render&&((n=t.refs).parentReact||(n.parentReact=s),t.refs.topReact=s)}getComponentName(){return this.tagName.replace("FEAAS-","").toLowerCase()}isReadyToLoad(){return this.payload===void 0&&this.getAttribute("hidden")==null}onError(t,r="uncaught",n=!1){let i=new CustomEvent("feaasError",{bubbles:!0,composed:!0,detail:t});if(this.dispatchEvent(i),this.whenLoaded.reject(t),!i.defaultPrevented&&!n){this.whenRendered.reject(t);try{this.unmount()}catch(s){}return!0}return!1}shouldUpdateOnLoad(){return!0}async advance(){try{if(this.payload===void 0){if(!this.isReadyToLoad())return;this.payload=null,this.dispatchEvent(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;let n=(r=(t=this.payload)===null||t===void 0?void 0:t.ReactDOM)===null||r===void 0?void 0:r.flushSync;n?n(()=>this.update()):this.update()}load(){return Promise.resolve(null)}update(){var t,r,n;if(this.payload==null||!this.render)return;let{React:i,ReactDOM:s,ReactDOMClient:o}=this.payload||{};if(!i)throw new Error(`${this.tagName}: React is not present in payload`);if(!s)throw new Error(`${this.tagName}: ReactDOM is not present in payload`);!this.refs.topReact&&!this.forceUpdateReact?o?(this.reactRoot||(this.reactRoot=o.createRoot(this.getReactRootElement())),this.reactRoot.render(this.getReactElement())):s.render(this.getReactElement(),this.getReactRootElement()):this.forceUpdateReact?(t=this.forceUpdateReact)===null||t===void 0||t.call(this):(n=(r=this.refs.topReact).forceUpdateReact)===null||n===void 0||n.call(r)}invokeReactRendering(){let{React:t,ReactDOM:r}=this.payload||{};if(!this.connected)return null;let n=this.descendants.filter(i=>i.refs.parentReact==this&&i.payload).map((i,s)=>this.getReactElement(i));return this.render({...this.props,children:n},this.payload)}getReactErrorBoundary(t=this,r=t.tagName){if(this.reactErrorBoundary)return this.reactErrorBoundary;let{React:n,ReactDOM:i}=t.payload||{};return this.reactErrorBoundary||(this.reactErrorBoundary=class extends n.Component{constructor(){super(...arguments),this.state={error:null}}static getDerivedStateFromError(o){return{error:o}}componentDidCatch(o,a){console.error(`FEAAS: ${t.tagName} Error:`,o,a),t.onError(o,"react")}render(){if(!this.state.error)return this.props.children}})}getReactElement(t=this,r){let{React:n,ReactDOM:i}=t.payload||{},s=this.getReactErrorBoundary(),o=this.getReactWrapper(t);return n.createElement(s,{key:t.tagName+"-"+t.getUID(),slot:t.getAttribute("slot")},n.createElement(o,null))}getReactWrapper(t=this,r=t.tagName){if(t.reactWrapper)return t.reactWrapper;let{React:n,ReactDOM:i}=t.payload||{};return t.reactWrapper=s=>{if(t.render){let[o,a]=n.useReducer(l=>l+1,0);return t.forceUpdateReact=a,i.createPortal(n.createElement(n.Fragment,null,t.invokeReactRendering()),t.getReactRootElement())}else return t.update()},Object.assign(t.reactWrapper,{key:t.tagName+"-"+t.getUID(),displayName:r}),t.reactWrapper}getUID(){return this.uid||(this.uid=String(Math.random()))}getShadowRoot(){return this.shadowRoot||this.attachShadow({mode:"open"}),this.shadowRoot}getReactRootElement(){return this.useShadowRoot?this.getShadowRoot():this.getRoot()}set(t){try{this.scheduleRender(),this.overrides={...this.overrides,...t},this.props={...this.getProps(),...this.overrides};for(var r in this.props){let n=this.props[r],i=r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();n==null||n===this.defaultProps[r]?this.removeAttribute(i):(typeof n=="string"||typeof n=="number"||typeof n=="boolean")&&this.getAttribute(i)!=String(n)&&this.setAttribute(i,String(n))}}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()),cancelAnimationFrame(this.nextRender),this.nextRender=requestAnimationFrame(()=>{this.nextRender=null,this.advance().catch(t=>{})})}formatURL(t,r){return typeof t=="string"&&t.match(/^\/[^\/]/)?r+t:t}getContextAttribute(t,r=this){for(var n=this;n=n.parentElement||(n.parentNode instanceof ShadowRoot?n.parentNode.host:null);)if(n.getAttribute(t)!=null)return n.getAttribute(t);return this.getAttribute(t)}static register(t,r){r==null&&(r=typeof window!="undefined"?window:null),r&&!r.customElements.get(t)&&r.customElements.define(t,this)}};var $=class extends y{load(){return Promise.all([import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react"),import( /*@vite-ignore*/ /* webpackIgnore: true */ "https://cdn.skypack.dev/react-dom")]).then(([t,r])=>({React:t,ReactDOM:r}))}render({},{React:t}){return t.createElement(t.Fragment,null)}},lt=class extends ${constructor(){super(...arguments),this.useShadowRoot=!0}getProps(){return{counter:parseFloat(this.getAttribute("counter"))}}render({counter:t},{React:r}){let[n,i]=r.useState(0);return r.useEffect(()=>{i(s=>s+1)},[t]),r.createElement(r.Fragment,null,r.createElement("p",null,"Rendering attribute: ",t),r.createElement("p",null,"Triggered updates: ",n))}};lt.observedAttributes=["counter"];function F(e){return F=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},F(e)}function jt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bt(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function Wt(e,t,r){return t&&Bt(e.prototype,t),r&&Bt(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function xe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&K(e,t)}function q(e){return q=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(r){return r.__proto__||Object.getPrototypeOf(r)},q(e)}function K(e,t){return K=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,i){return n.__proto__=i,n},K(e,t)}function Ht(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function J(e,t,r){return Ht()?J=Reflect.construct.bind():J=function(i,s,o){var a=[null];a.push.apply(a,s);var l=Function.bind.apply(i,a),u=new l;return o&&K(u,o.prototype),u},J.apply(null,arguments)}function Ce(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function wt(e){var t=typeof Map=="function"?new Map:void 0;return wt=function(n){if(n===null||!Ce(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(n))return t.get(n);t.set(n,i)}function i(){return J(n,arguments,q(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),K(i,n)},wt(e)}function Se(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Re(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Se(e)}function _e(e){var t=Ht();return function(){var n=q(e),i;if(t){var s=q(this).constructor;i=Reflect.construct(n,arguments,s)}else i=n.apply(this,arguments);return Re(this,i)}}function Fe(e){return ke(e)||De(e)||Vt(e)||Ne()}function ke(e){if(Array.isArray(e))return xt(e)}function De(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Vt(e,t){if(e){if(typeof e=="string")return xt(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return xt(e,t)}}function xt(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ne(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pe(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=Vt(e))||t&&e&&typeof e.length=="number"){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(l){throw l},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
3
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var s=!0,o=!1,a;return{s:function(){r=r.call(e)},n:function(){var l=r.next();return s=l.done,l},e:function(l){o=!0,a=l},f:function(){try{!s&&r.return!=null&&r.return()}finally{if(o)throw a}}}}var E=Object.prototype.hasOwnProperty;function T(e,t){return e=e.slice(),e.push(t),e}function Ct(e,t){return t=t.slice(),t.unshift(e),t}var Te=function(e){xe(r,e);var t=_e(r);function r(n){var i;return jt(this,r),i=t.call(this,'JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)'),i.avoidNew=!0,i.value=n,i.name="NewError",i}return Wt(r)}(wt(Error));function f(e,t,r,n,i){if(!(this instanceof f))try{return new f(e,t,r,n,i)}catch(l){if(!l.avoidNew)throw l;return l.value}typeof e=="string"&&(i=n,n=r,r=t,t=e,e=null);var s=e&&F(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=E.call(e,"wrap")?e.wrap:!0,this.sandbox=e.sandbox||{},this.preventEval=e.preventEval||!1,this.parent=e.parent||null,this.parentProperty=e.parentProperty||null,this.callback=e.callback||n||null,this.otherTypeCallback=e.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")},e.autostart!==!1){var o={path:s?e.path:t};s?"json"in e&&(o.json=e.json):o.json=r;var a=this.evaluate(o);if(!a||F(a)!=="object")throw new Te(a);return a}}f.prototype.evaluate=function(e,t,r,n){var i=this,s=this.parent,o=this.parentProperty,a=this.flatten,l=this.wrap;if(this.currResultType=this.resultType,this.currPreventEval=this.preventEval,this.currSandbox=this.sandbox,r=r||this.callback,this.currOtherTypeCallback=n||this.otherTypeCallback,t=t||this.json,e=e||this.path,e&&F(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(!E.call(e,"json"))throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().');var u=e;t=u.json,a=E.call(e,"flatten")?e.flatten:a,this.currResultType=E.call(e,"resultType")?e.resultType:this.currResultType,this.currSandbox=E.call(e,"sandbox")?e.sandbox:this.currSandbox,l=E.call(e,"wrap")?e.wrap:l,this.currPreventEval=E.call(e,"preventEval")?e.preventEval:this.currPreventEval,r=E.call(e,"callback")?e.callback:r,this.currOtherTypeCallback=E.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback,s=E.call(e,"parent")?e.parent:s,o=E.call(e,"parentProperty")?e.parentProperty:o,e=e.path}if(s=s||null,o=o||null,Array.isArray(e)&&(e=f.toPathString(e)),!(!e&&e!==""||!t)){var d=f.toPathArray(e);d[0]==="$"&&d.length>1&&d.shift(),this._hasParentSelector=null;var h=this._trace(d,t,["$"],s,o,r).filter(function(c){return c&&!c.isParentSelector});return h.length?!l&&h.length===1&&!h[0].hasArrExpr?this._getPreferredOutput(h[0]):h.reduce(function(c,p){var w=i._getPreferredOutput(p);return a&&Array.isArray(w)?c=c.concat(w):c.push(w),c},[]):l?[]:void 0}};f.prototype._getPreferredOutput=function(e){var t=this.currResultType;switch(t){case"all":{var r=Array.isArray(e.path)?e.path:f.toPathArray(e.path);return e.pointer=f.toPointer(r),e.path=typeof e.path=="string"?e.path:f.toPathString(e.path),e}case"value":case"parent":case"parentProperty":return e[t];case"path":return f.toPathString(e[t]);case"pointer":return f.toPointer(e.path);default:throw new TypeError("Unknown result type")}};f.prototype._handleCallback=function(e,t,r){if(t){var n=this._getPreferredOutput(e);e.path=typeof e.path=="string"?e.path:f.toPathString(e.path),t(n,r,e)}};f.prototype._trace=function(e,t,r,n,i,s,o,a){var l=this,u;if(!e.length)return u={path:r,value:t,parent:n,parentProperty:i,hasArrExpr:o},this._handleCallback(u,s,"value"),u;var d=e[0],h=e.slice(1),c=[];function p(g){Array.isArray(g)?g.forEach(function(m){c.push(m)}):c.push(g)}if((typeof d!="string"||a)&&t&&E.call(t,d))p(this._trace(h,t[d],T(r,d),t,d,s,o));else if(d==="*")this._walk(t,function(g){p(l._trace(h,t[g],T(r,g),t,g,s,!0,!0))});else if(d==="..")p(this._trace(h,t,r,n,i,s,o)),this._walk(t,function(g){F(t[g])==="object"&&p(l._trace(e.slice(),t[g],T(r,g),t,g,s,!0))});else{if(d==="^")return this._hasParentSelector=!0,{path:r.slice(0,-1),expr:h,isParentSelector:!0};if(d==="~")return u={path:T(r,d),value:i,parent:n,parentProperty:null},this._handleCallback(u,s,"property"),u;if(d==="$")p(this._trace(h,t,r,null,null,s,o));else if(/^(\x2D?[0-9]*):(\x2D?[0-9]*):?([0-9]*)$/.test(d))p(this._slice(d,h,t,r,n,i,s));else if(d.indexOf("?(")===0){if(this.currPreventEval)throw new Error("Eval [?(expr)] prevented in JSONPath expression.");var w=d.replace(/^\?\(((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?)\)$/,"$1");this._walk(t,function(g){l._eval(w,t[g],g,r,n,i)&&p(l._trace(h,t[g],T(r,g),t,g,s,!0))})}else if(d[0]==="("){if(this.currPreventEval)throw new Error("Eval [(expr)] prevented in JSONPath expression.");p(this._trace(Ct(this._eval(d,t,r[r.length-1],r.slice(0,-1),n,i),h),t,r,n,i,s,o))}else if(d[0]==="@"){var v=!1,x=d.slice(1,-2);switch(x){case"scalar":(!t||!["object","function"].includes(F(t)))&&(v=!0);break;case"boolean":case"string":case"undefined":case"function":F(t)===x&&(v=!0);break;case"integer":Number.isFinite(t)&&!(t%1)&&(v=!0);break;case"number":Number.isFinite(t)&&(v=!0);break;case"nonFinite":typeof t=="number"&&!Number.isFinite(t)&&(v=!0);break;case"object":t&&F(t)===x&&(v=!0);break;case"array":Array.isArray(t)&&(v=!0);break;case"other":v=this.currOtherTypeCallback(t,r,n,i);break;case"null":t===null&&(v=!0);break;default:throw new TypeError("Unknown value type "+x)}if(v)return u={path:r,value:t,parent:n,parentProperty:i},this._handleCallback(u,s,"value"),u}else if(d[0]==="`"&&t&&E.call(t,d.slice(1))){var A=d.slice(1);p(this._trace(h,t[A],T(r,A),t,A,s,o,!0))}else if(d.includes(",")){var st=d.split(","),N=Pe(st),at;try{for(N.s();!(at=N.n()).done;){var Ot=at.value;p(this._trace(Ct(Ot,h),t,r,n,i,s,!0))}}catch(g){N.e(g)}finally{N.f()}}else!a&&t&&E.call(t,d)&&p(this._trace(h,t[d],T(r,d),t,d,s,o,!0))}if(this._hasParentSelector)for(var D=0;D<c.length;D++){var L=c[D];if(L&&L.isParentSelector){var P=this._trace(L.expr,t,L.path,n,i,s,o);if(Array.isArray(P)){c[D]=P[0];for(var gt=P.length,W=1;W<gt;W++)D++,c.splice(D,0,P[W])}else c[D]=P}}return c};f.prototype._walk=function(e,t){if(Array.isArray(e))for(var r=e.length,n=0;n<r;n++)t(n);else e&&F(e)==="object"&&Object.keys(e).forEach(function(i){t(i)})};f.prototype._slice=function(e,t,r,n,i,s,o){if(Array.isArray(r)){var a=r.length,l=e.split(":"),u=l[2]&&Number.parseInt(l[2])||1,d=l[0]&&Number.parseInt(l[0])||0,h=l[1]&&Number.parseInt(l[1])||a;d=d<0?Math.max(0,d+a):Math.min(a,d),h=h<0?Math.max(0,h+a):Math.min(a,h);for(var c=[],p=d;p<h;p+=u){var w=this._trace(Ct(p,t),r,n,i,s,o,!0);w.forEach(function(v){c.push(v)})}return c}};f.prototype._eval=function(e,t,r,n,i,s){this.currSandbox._$_parentProperty=s,this.currSandbox._$_parent=i,this.currSandbox._$_property=r,this.currSandbox._$_root=this.json,this.currSandbox._$_v=t;var o=e.includes("@path");o&&(this.currSandbox._$_path=f.toPathString(n.concat([r])));var a="script:"+e;if(!f.cache[a]){var l=e.replace(/@parentProperty/g,"_$_parentProperty").replace(/@parent/g,"_$_parent").replace(/@property/g,"_$_property").replace(/@root/g,"_$_root").replace(/@([\t-\r \)\.\[\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF])/g,"_$_v$1");o&&(l=l.replace(/@path/g,"_$_path")),f.cache[a]=new this.vm.Script(l)}try{return f.cache[a].runInNewContext(this.currSandbox)}catch(u){throw new Error("jsonPath: "+u.message+": "+e)}};f.cache={};f.toPathString=function(e){for(var t=e,r=t.length,n="$",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[i])||(n+=/^[\*0-9]+$/.test(t[i])?"["+t[i]+"]":"['"+t[i]+"']");return n};f.toPointer=function(e){for(var t=e,r=t.length,n="",i=1;i<r;i++)/^(~|\^|@(?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\(\))$/.test(t[i])||(n+="/"+t[i].toString().replace(/~/g,"~0").replace(/\//g,"~1"));return n};f.toPathArray=function(e){var t=f.cache;if(t[e])return t[e].concat();var r=[],n=e.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/g,";$&;").replace(/['\[](\??\((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*?\))['\]]/g,function(s,o){return"[#"+(r.push(o)-1)+"]"}).replace(/\[["']((?:(?!['\]])[\s\S])*)["']\]/g,function(s,o){return"['"+o.replace(/\./g,"%@%").replace(/~/g,"%%@@%%")+"']"}).replace(/~/g,";~;").replace(/["']?\.["']?(?!(?:(?!\[)[\s\S])*\])|\[["']?/g,";").replace(/%@%/g,".").replace(/%%@@%%/g,"~").replace(/(?:;)?(\^+)(?:;)?/g,function(s,o){return";"+o.split("").join(";")+";"}).replace(/;;;|;;/g,";..;").replace(/;$|'?\]|'$/g,""),i=n.split(";").map(function(s){var o=s.match(/#([0-9]+)/);return!o||!o[1]?s:r[o[1]]});return t[e]=i,t[e].concat()};var Oe=function(t,r,n){for(var i=t.length,s=0;s<i;s++){var o=t[s];n(o)&&r.push(t.splice(s--,1)[0])}},Me=function(){function e(t){jt(this,e),this.code=t}return Wt(e,[{key:"runInNewContext",value:function(r){var n=this.code,i=Object.keys(r),s=[];Oe(i,s,function(d){return typeof r[d]=="function"});var o=i.map(function(d,h){return r[d]}),a=s.reduce(function(d,h){var c=r[h].toString();return/function/.test(c)||(c="function "+c),"var "+h+"="+c+";"+d},"");n=a+n,!/(["'])use strict\1/.test(n)&&!i.includes("arguments")&&(n="var arguments = undefined;"+n),n=n.replace(/;[\t-\r \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*$/,"");var l=n.lastIndexOf(";"),u=l>-1?n.slice(0,l+1)+" return "+n.slice(l+1):" return "+n;return J(Function,i.concat([u])).apply(void 0,Fe(o))}}]),e}();f.prototype.vm={Script:Me};function dt(e,t,r=!1,n=e){var i=t;let s=Object.keys(e).sort((a,l)=>l.length-a.length);for(let a of s)if(t.startsWith(a)){if(a==t){if(r)return e[a];continue}i=t.substring(a.length+1),n=e[a];break}var o=f({path:i,json:n});return Array.isArray(o)&&(o==null?void 0:o.length)==0&&(o=[i.replace(/^.*?\./,"_."),i.replace(/^.*?\./,""),i.replace(/^([^.]+).*?\.\$\./,"$1."),i.replace(/^.*?\.\$\./,"_."),i.replace(/^.*?\.\$\./,""),i.replace(/^[^.]+$/,"_")].filter((a,l,u)=>u.indexOf(a)===l).reduce((a,l)=>a.length>0?a:f({path:l,json:n}),[])),r&&Array.isArray(o)?o[0]:o}function St(e,t={},r){return r?`<${r}${Object.entries(t).map(([n,i])=>i!=null&&` ${n}="${i}"`).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(`
|
|
4
|
+
`).trim();if(typeof e=="string")return e;if(e==null)return"";switch(e.type){case"heading":let{level:r,...n}=e.attrs;return St(e.content,n,"h"+r);case"text":return(e.marks||[]).reduce((i,s)=>St(i,s.attrs,{link:"a",bold:"strong",italic:"em",strike:"s",underline:"u"}[s.type]),(t=e.text)===null||t===void 0?void 0:t.replace(/\s+/," "));default:return St(e.content||e.text,e.attrs,{bulletList:"ul",orderedList:"ol",listItem:"li",horizontalRule:"hr",paragraph:"p",codeBlock:"code",blockquote:"blockquote"}[e.type])}}var O=class{constructor(t,r=1,n){this.ownerDocument={createElement(i){return new O(i)}},this.nodeName=t,this.nodeType=r,this.textContent=n,this.attributes=[],this.childNodes=[]}setAttribute(t,r){let n=this.attributes.find(i=>i.name===t);n?n.value=r:this.attributes.push({name:t,value:r})}getAttribute(t){let r=this.attributes.find(n=>n.name===t);return r?r.value:void 0}insertBefore(t,r){if(t.parentNode=this,r===null)this.childNodes.push(t);else{let n=this.childNodes.indexOf(r);n!==-1&&this.childNodes.splice(n,0,t)}}removeAttribute(t){let r=this.attributes.findIndex(n=>n.name===t);r!==-1&&this.attributes.splice(r,1)}appendChild(t){t.parentNode=this,this.childNodes.push(t)}get tagName(){var t;return(t=this.nodeName)===null||t===void 0?void 0:t.toUpperCase()}get localName(){var t;return(t=this.nodeName)===null||t===void 0?void 0:t.toLowerCase()}get innerHTML(){return Rt(this.childNodes)}set innerHTML(t){this.childNodes=_t(String(t!=null?t:""))}get outerHTML(){return Rt([this])}get children(){return this.childNodes.filter(t=>t.nodeType==1)}closest(t){let r=this;for(;r;){if(zt(t,r))return r;r=r.parentNode}return null}querySelectorAll(t){let r=t.split(/\s*,\s*/),n=[],i=s=>{for(let o of r)if(zt(o,s)){n.push(s);break}for(let o of s.childNodes)i(o)};for(let s of this.childNodes)i(s);return n}querySelector(t){return this.querySelectorAll(t)[0]}findSibling(t,r){if(!this.parentNode)return null;let n=this.parentNode.childNodes,i=n.indexOf(this);if(i===-1)return null;for(let s=i+t;s>=0&&s<n.length;s+=t){let o=n[s];if(!r||o.nodeType===1)return o}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 O(this.nodeName,this.nodeType);if(r.attributes=JSON.parse(JSON.stringify(this.attributes)),this.textContent&&(r.textContent=this.textContent),t)for(let n of this.childNodes){let i=n.cloneNode(!0);r.appendChild(i)}return r}get parentElement(){var t;return((t=this.parentNode)===null||t===void 0?void 0:t.nodeType)==1?this.parentNode:null}};function zt(e,t){let r=e.match(/([.#]?[\w-]+|\[([\w-]+)(="([^"]*)")?\])/g);if(!r)return!1;for(let n of r)if(n.startsWith("#")){if(t.getAttribute("id")!==n.slice(1))return!1}else if(n.startsWith(".")){if(!(t.getAttribute("class")||"").split(" ").includes(n.slice(1)))return!1}else if(n.startsWith("[")){let i=n.match(/^\[([\w-]+)(="([^"]*)")?\]$/);if(i){let s=i[1],o=i[3],a=t.getAttribute(s);if(typeof o=="undefined"){if(a===void 0)return!1}else if(a!==o)return!1}else return!1}else if(t.nodeName!==n)return!1;return!0}function _t(e){var t;let r=[],n=[];for(;e;){let i=e.match(/^<([\w-]+)(\s[^>]*)?>/),s=e.match(/^<\/([\w-]+)>/);if(i){let o=i[1],l=((t=(i[2]||"").match(/([\w-]+)(="([^"]*)")?/g))===null||t===void 0?void 0:t.map(d=>{let[h,c,,p]=d.match(/([\w-]+)(="([^"]*)")?/);return{name:c,value:$e(p||"")}}))||[],u=new O(o,1);if(u.attributes=l,n.length>0){let d=n[n.length-1];d.childNodes.push(u),u.parentNode=d}else r.push(u);n.push(u),e=e.slice(i[0].length)}else if(s)n.pop(),e=e.slice(s[0].length);else{let o=e.indexOf("<"),a=e.slice(0,o!==-1?o:void 0),l=new O("#text",3);if(l.textContent=a,n.length>0){let u=n[n.length-1];u.childNodes.push(l),l.parentNode=u}else r.push(l);e=e.slice(a.length)}}return r}function Le(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function $e(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'")}function Rt(e){return e.map(t=>{if(t.nodeType===3)return t.textContent||"";let{nodeName:r,attributes:n}=t,i=n.map(({name:o,value:a})=>` ${o}="${Le(String(a))}"`).join(""),s=Rt(t.childNodes);return["img","input","br"].includes(r)?`<${r}${i} />`:`<${r}${i}>${s}</${r}>`}).join("")}function Jt(e){let t=new e.ownerDocument.defaultView.MutationObserver(r=>{r.forEach(n=>{let i=n.target,s=i.getAttribute("data-embed-src");s&&G(i,s),n.addedNodes&&n.addedNodes.forEach(o=>{o.nodeType==1&&qt(o,!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 n=0;n<r.length;n++){let i=r[n];G(i,i.getAttribute("data-embed-src"))}if(t)return Jt(e)}function G(e,t){for(var r=e;r;r=r.parentElement)if(!r.parentElement){let i=r.querySelectorAll("script");for(var n=0;n<i.length;n++)if(i[n].getAttribute("src")==t)return!0;r.tagName=="HTML"&&(r=r.querySelector("head")||r);let s=r.ownerDocument.createElement("script");s.setAttribute("type","module"),s.setAttribute("src",t),r.appendChild(s);break}}var Ue=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},Ie=e=>{var t;let r=(t=e==null?void 0:e.match(/\[([^\]]+)\]/))===null||t===void 0?void 0:t[1].split(/\s*,\s*/g).filter(Boolean).map(n=>{if(n.match(/^-?\d+$/))return n;let i=n.match(/^(\d+):(\d+)$/);return i&&parseInt(i[1],10)<parseInt(i[2],10)?i[1]+"-"+i[2]:null});return r!=null&&r.every(Boolean)?r.join(","):null},Be=e=>{var t;return(t=e==null?void 0:e.match(/(\.\*|\[[^\]]+\])$/))===null||t===void 0?void 0:t[0]};function Kt(e){return e.replace(/(\[[^\]\[]+\]|\.\*)$/g,"")}function Ft(e){return Kt(e)+".*"}function Yt(e){let t=e.getAttribute("data-path-scope");for(var r=0,n=e;n=n.previousElementSibling;)n.getAttribute("data-path-scope")==t&&r++;return r}function je(e,t,r){let n=e.getAttribute("data-path-scope");if(n==null)return;var i=Yt(e);if(i!=0)return;let s=e.parentNode;if(s!=null){t==0?e.setAttribute("hidden","hidden"):e.getAttribute("hidden")!=null&&e.removeAttribute("hidden");for(var o=i+1,a=e,l=e;l=l.nextElementSibling;)l.getAttribute("data-path-scope")==n&&(o++,a=l);for(var u=o;u<t;u++)s.insertBefore(a.cloneNode(!0),a.nextElementSibling);for(var u=Math.max(1,t);u<o;u++)a=a.previousElementSibling,s.removeChild(a.nextElementSibling)}}function I(e,t,r,n){var i,s;if(e){var o=e;(r==null?void 0:r.type)=="doc"&&Array.isArray(r.content)&&(r=U(r)),n!=null&&n.processValue&&(r=n==null?void 0:n.processValue(e,t,r));var a=t.replace("data-path-","");if(t=="data-path-src"){let c=Array.from(e.children).find(p=>p.localName=="picture")||e;o=e.localName=="img"?e:c.querySelector("img, video")}else if(t=="data-path-href")o=e.querySelector("a")||e.closest("a");else if(t=="data-path-alt")o=(Array.from(e.children).find(p=>p.localName=="picture")||e).querySelector("img, picture");else if(t=="data-path-hidden")r=r?null:!0;else if(t=="data-path"||t=="data-embed-html"||t=="html")a="innerHTML";else if(t=="data-embed-src")G(e,r);else if(t=="data-path-attributes"){let c=((i=e.getAttribute("data-attributes-keys"))===null||i===void 0?void 0:i.split(",").filter(Boolean))||[];if(!Array.isArray(r))for(var l in r){var u=r[l];I(e,l,typeof u=="object"&&u?JSON.stringify(u):u,n)}for(var d=0;d<c.length;d++)(r==null||!(c[d]in r))&&I(e,c[d],null,n);I(e,"data-attributes-keys",Object.keys(r||{}).join(","));return}if(typeof r=="boolean"&&(r=r?"":null),!!o){var h=String((s=e.getAttribute("data-path-placeholder")||o[a])!==null&&s!==void 0?s:o.getAttribute(a));r!=null?a=="innerHTML"?o.innerHTML!=r&&(o.innerHTML=r):o.getAttribute(a)!=r&&o.setAttribute(a,r):a=="innerHTML"?o.innerHTML=h:o.removeAttribute(a)}}}var Gt=["data-attributes-keys","data-path-attributes","data-path-scope"];function R(e,t,r,n){var i,s,o;let a=e;if(n||(t=((i=r==null?void 0:r.processData)===null||i===void 0?void 0:i.call(r,a,t))||t),a.nodeType==1){let d=a.getAttribute("data-path-scope");if(d){let c=Yt(a),p=dt(t,d,!1)||[];c==0&&je(a,((s=r==null?void 0:r.shouldRepeat)===null||s===void 0?void 0:s.call(r,a,p))===!1?1:p.length,r),t={...t,[Ft(d)]:p[c]}}let h=Array.prototype.slice.call(a.attributes).sort((c,p)=>Gt.indexOf(c.name)-Gt.indexOf(p.name));for(var l=0;l<h.length;l++){let{name:c,value:p}=h[l];c.startsWith("data-path")&&c!="data-path-scope"&&I(a,c,dt(t,p,!0),r),c=="data-embed-src"&&I(a,c,a.getAttribute(c),r)}}for(var l=0,u;u=a.childNodes[l++];)Qt(u)&&R(u,t,r,!0);return n||(o=r==null?void 0:r.onRender)===null||o===void 0||o.call(r,a,t),a}function Qt(e){return e.nodeType==1}function B(e,t,r,n){var i;let s=((i=n==null?void 0:n.processTemplate)===null||i===void 0?void 0:i.call(n,e,t,r))||t;if(e.innerHTML=s,e.classList.add("-feaas"),(e.closest(".component.feaas")||e).className.includes("-theme--"))for(var a=0,l;l=e.childNodes[a++];)Qt(l)&&(l.className=l.className.replace(/(\s|^)-theme--[^\s]+\s*/g,"$1"));return R(e,r,n)}function We(e,t,r,n=!1){var i;let s=((i=r==null?void 0:r.processTemplate)===null||i===void 0?void 0:i.call(r,null,e,t))||e;if(typeof document=="undefined"||n){let o=_t(s);return R(o[0],t,r).outerHTML}else{let o=document.createElement("div");return o.innerHTML=s,R(o,t,r),o.innerHTML}}var Zt=["initial","check","updated"],Y={};function He(){Y={}}async function Q(e,t,r,n,i=Y){return M({url:e,options:t,validator:r,callback:n,cache:i}).then(Z).then(s=>s.response)}function Xt(e,t=!1){let r=String(e).replace("?head","");var n=Y[r];return!n&&!t&&(n=Y[r]={phase:null,initial:S(),check:S(),updated:S(),final:S()}),n}var ut=class extends Error{};async function M({url:e,options:t,validator:r,callback:n,cache:i},s="initial"){let o=new Date;if(i!=null){var a=Xt(e);if(Zt.indexOf(a.phase)>=Zt.indexOf(s))var l=a[s];else a.phase=s}let u=await(l||fetch(e,t));if(!l&&a&&(u.ok?a[s].resolve(u):a[s].reject(new Error("Fetch failed"))),!u.ok)throw new Error("Fetch failed");let d=new Date(u.headers.get("date"))<o||l&&s=="initial"&&(a.phase=="updated"||a.phase=="check");if((r==null?void 0:r(u,d))===!1)throw new ut("Response is not valid");return await(n==null?void 0:n(u,s,d)),{url:e,options:t,isCached:d,response:u,validator:r,callback:n,cache:i}}async function Z(e){let{url:t,isCached:r,options:n,validator:i,response:s,cache:o}=e;if(r){let{response:a}=await M({url:t+"?head",options:{...n,method:"HEAD",cache:"no-cache"},validator:i,cache:o},"check");if(a.headers.get("last-modified")!=s.headers.get("last-modified"))return ct(e)}return e}async function ct(e){return M({...e,options:{...e.options,cache:"reload"}},"updated")}var k="https://feaas.blob.core.windows.net";function X(e){let t=e.match(/^(?:(.*?)\/components)?\/?([^\/]+)\/([^\/]+)(?:\/([^\/]+)(?:\/(published|staged|saved|\d+)(?:\.html?)?)?)?$/);if(t){var[,r,n,i,s,o]=t;return{cdn:r,library:n,component:i,version:s,revision:o}}}function Ve(e){if(!e||!e.library||!e.component)throw new Error("Component requires `library` and `component` properties");return`${e.cdn&&e.cdn!=k?`${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 ze(e){return`${e.cdn&&e.cdn!=k?`${e.cdn}/styles/`:""}${e.library}/${!e.revision||e.revision=="published"?"":e.revision}`.replace(/\/$|\/\/(?!.+\/styles\/)/g,"")}function ht(e){let t=e.match(/^(?:(.*?)\/styles\/)?([^\/]+)(?:\/(published|staged|saved|\d+)(?:.css)?)?$/);if(t){var[,r,n,i]=t;return{cdn:r,library:n,revision:i}}else{let s=X(e);if(s){var{cdn:r,library:n,revision:i}=s;return i!=null&&i.match(/\d/)&&(i=void 0),{cdn:r,library:n,revision:i}}}}function kt(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...X(e.src)}),`${e.cdn||e.hostname||k}/components/${e.library}/${e.component}/${e.version}/${e.revision||"published"}.html`}function tt(e){return typeof e=="string"&&(e={src:e}),"src"in e&&(e={...ht(e.src)}),`${e.cdn||e.hostname||k}/styles/${e.library}/${e.revision||"published"}.css`}async function j(e,t,r=!1){let n=a=>a.headers.get("x-ms-meta-versionDeletedAt")==null,i=a=>a.clone().text().then(t),s=await Promise.all([e.instance&&M({options:{headers:{Accept:"text/html"},credentials:"omit"},url:kt({...e,version:e.instance}),validator:n}).catch(a=>a),M({url:kt(e),validator:n}).catch(a=>a)]),o=s.find(a=>a&&"isCached"in a&&a);if(!o||o instanceof Error)throw s.find(l=>l&&l instanceof Error)||new Error("Can not fetch component");return s[0]==o&&console.log("Using fork!",s),await i(o.response),r?o:Z({...o,callback:i}).catch(a=>{if(s[0]==o&&(ct({...o,callback:null,validator:null}),console.log("Fork was deleted"),!(s[1]instanceof Error)))return i(s[1].response),Z({...s[1],callback:i});throw a})}async function Je(e){typeof e=="string"&&(e={src:e});var t;let{response:r}=await j(e,n=>{t=n},!0);return{...e,template:t,lastModified:r.headers.get("last-modified")}}async function pt(e,t){return typeof e=="string"&&(e={src:e}),Q(tt(e),{headers:{Accept:"text/css"},credentials:"omit"},r=>r.headers.get("x-ms-meta-deletedAt")==null,(r,n)=>r.clone().text().then(i=>t(i,n)))}function qe(e,t){return te(e,t||(t=document.createElement("style"))),t}function te(e,t){return t||(t=document.createElement("style")),pt(e,(r,n)=>{t.textContent=r}).then(()=>t)}function ft(e,t){var r=ee(e);if(!r)var n=re(e);return pt(e,(i,s)=>{n&&(n.textContent=i),t==null||t(i,s)}).then(()=>r||n)}function Dt(e){return new Promise((t,r)=>{ft(e,t).catch(r)})}function ee(e){return document.head.querySelector(`style[data-href="${tt(e)}"]`)}function re(e){let t=tt(e),r=document.createElement("style");return r.setAttribute("data-href",t),document.head.appendChild(r),r}function Ke(e,t){let r=document.createElement("div");r.innerHTML=e;let n=document.createDocumentFragment();for(;r.firstChild;)n.appendChild(r.firstChild);return R(n,t),r}function Nt(e,t){return ne(e,t||(t=document.createElement("div"))),t}async function ne(e,t){return t||(t=document.createElement("div")),t.childNodes.length?R(t,e.data,e):"template"in e?B(t,e.template,e.data,e):j(e,r=>B(t,r,e.data,e)).then(()=>t)}function ie(e){var t,r,n,i,s,o,a,l;let u,d=e.getAttribute("src");if(d){let A=X(d);if(!A)throw new Error(`Could not parse FEAAS Component source: ${d}`);var{cdn:h,library:c,component:p,version:w,revision:v}=A}let x=e.getAttribute("data");if(x!=null&&x!="")try{u=typeof x=="string"?JSON.parse(x):{}}catch(A){}return{data:u||{},cdn:(r=(t=e.getContextAttribute("cdn"))!==null&&t!==void 0?t:h)!==null&&r!==void 0?r:k,library:(n=e.getAttribute("library"))!==null&&n!==void 0?n:c,component:(i=e.getAttribute("component"))!==null&&i!==void 0?i:p,version:(o=(s=e.getAttribute("version"))!==null&&s!==void 0?s:w)!==null&&o!==void 0?o:"responsive",revision:(l=(a=e.getAttribute("revision"))!==null&&a!==void 0?a:v)!==null&&l!==void 0?l:"published",hostname:e.getAttribute("hostname"),template:e.getAttribute("template"),instance:e.getAttribute("instance"),editable:e.getAttribute("editable")!=null,suspended:e.getAttribute("suspended")!=null,lastModified:e.getAttribute("last-modified"),withStylesheet:e.getAttribute("with-stylesheet")!="false"}}var et=class extends y{setData(t){this.set({data:t})}getProps(){return ie(this)}attributeChangedCallback(t,r,n){r!==n&&((t=="library"||t=="component"||t=="revision"||t=="version")&&(this.payload=void 0),this.needsRefresh=!0,super.attributeChangedCallback(t,r,n))}getEditor(){var t;return(t=document.querySelector("feaas-context"))===null||t===void 0?void 0:t.refs.editor}constructor(){super(),this.defaultProps={cdn:k,revision:"published",version:"responsive",withStylesheet:!0,editable:!1,suspended:!1},this.onLoad=t=>{this.payload=t,this.advance()},this.addEventListener("click",()=>{this.props.editable&&this.edit()})}edit(){let t=this.getEditor();if(t!=null&&t.setTarget(this))return t.open(),!0}getOriginal(){let t=this.getAttribute("data-path-scope");if(t){for(var r=this;(r=r.previousElementSibling)&&r.getAttribute("data-path-scope")==t;)var n=r;return n}}isReadyToLoad(){return super.isReadyToLoad()&&this.props.library!=null&&this.props.component!=null&&this.props.version!=null}async load(){if(!this.getOriginal()){if(this.props.withStylesheet)var t=Dt({...this.props,revision:"published"}).then(()=>{t=null,this.payload&&this.onLoad(this.payload)});return Promise.all([t,j(this.props,r=>{this.payload=r,t||this.onLoad(r)})]).then(()=>this.payload)}}update(){if(Array.from(this.children).filter(t=>t.tagName!="BR").length>0&&!this.needsRefresh)R(this,this.props.data);else{if(this.needsRefresh=!0,this.getOriginal())return;B(this,this.payload,this.props.data)}}};et.observedAttributes=["library","component","version","revision","hostname","cdn","template","data","instance","editable","with-stylesheet"];et.register("feaas-component");function oe(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 rt=class extends y{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return oe(this)}attributeChangedCallback(t,r,n){if(r!==n)return t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),n?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,n)}connectedCallback(){this.payload=null,super.connectedCallback(),this.attributeChangedCallback("hidden",this.getAttribute("hidden"),this.getAttribute("hidden")),this.stylesheet=document.createElement("style"),this.stylesheet.textContent=`
|
|
5
5
|
#loader {
|
|
6
6
|
position: absolute;
|
|
7
7
|
top: 0;
|
|
@@ -65,8 +65,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
65
65
|
style="animation: 1.5s linear 0s infinite normal none running loader-circular-track"
|
|
66
66
|
></circle>
|
|
67
67
|
</svg>
|
|
68
|
-
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};rt.observedAttributes=["hidden","opacity"];rt.register("feaas-loader");function se(e){var t,r,i
|
|
69
|
-
${
|
|
68
|
+
</div>`,this.getRoot().appendChild(this.stylesheet),this.getRoot().appendChild(this.loader)}update(){this.loader.style.opacity=String(this.props.opacity)}};rt.observedAttributes=["hidden","opacity"];rt.register("feaas-loader");function se(e){var t,r,n,i;let s=e.getAttribute("src");if(s)var{cdn:o,library:a,revision:l}=ht(s);return{library:e==null?void 0:e.getContextAttribute("library"),revision:(r=(t=e==null?void 0:e.getAttribute("revision"))!==null&&t!==void 0?t:l)!==null&&r!==void 0?r:"published",cdn:(i=(n=e==null?void 0:e.getContextAttribute("cdn"))!==null&&n!==void 0?n:e==null?void 0:e.getContextAttribute("hostname"))!==null&&i!==void 0?i:k}}var mt=class extends y{constructor(){super(...arguments),this.onLoad=t=>{this.payload=t,this.advance()}}getProps(){return se(this)}isReadyToLoad(){return this.props.library!=null&&this.props.revision!=null&&this.props.cdn!=null}load(){return ft(this.props,this.onLoad)}};mt.register("feaas-stylesheet");var vt={};It(vt,{convertBase64toBlob:()=>ae,generate:()=>ue,get:()=>Ge,getVersionForThumbnail:()=>le,load:()=>de,responseToImage:()=>Pt,upload:()=>ce});var ae=e=>fetch(e).then(t=>t.blob()),Pt=e=>e.blob().then(t=>new Promise((r,n)=>{let i=new Image;i.onerror=n,i.onload=()=>{r(i)},i.src=URL.createObjectURL(t)}));async function le(e){return e.versions.length||await e.versions.fetch(),e.getVersionForWidth(800)}async function Ge(e,t,r){try{if(!e.isNew)return await de(e,t,r)}catch(i){e.sdk.log(`FEAAS: Thumbnail ${e.id}, version: ${(t==null?void 0:t.id)||"responsive"}, status: generating ${status}, reason: ${i}`)}let n=await ue(e,t);return r==null||r(n,!1),n&&!e.isNew&&ae(n.src).then(i=>ce(e,t,i)),n}async function de(e,t,r){let n=t?t.getThumbnailURL():e.getThumbnailURL(),i=e.library.stylesheet,s=new Date(Math.max(Number(e.modifiedAt),Number(i.modifiedAt)));e.sdk.log(`FEAAS: Thumbnail ${e.id}/${(t==null?void 0:t.id)||"responsive"}, loading`);var o;return await Q(n,{},(a,l)=>{let u=Math.abs(Number(new Date(a.headers.get("x-ms-meta-componentRenderedAt")))-Number(s))<2e3;return l&&!u&&Pt(a).then(d=>{o=d,r(d,l)}),u},(a,l,u)=>{e.sdk.log(`FEAAS: Thumbnail ${e.id}/${(t==null?void 0:t.id)||"responsive"}, status: ${l}`),Pt(a).then(d=>{o=d,r(d,u)})},null),o}async function ue(e,t){let r=t||(e.isNew?null:await le(e));if(!r||r.isViewEmpty())return null;let{stylesheet:n,datasources:i}=e.library;return await Ye(r.classList,n.getBreakpointForWidth(800,r.getBreakpoints()),r.view,i.reduce((o,a)=>Object.assign(o,{[a.id]:a.sample}),{}),n.css,e.sdk)}function Ye(e,t,r,n,i,s){let o=document.createElement("iframe");return o.style.position="absolute",o.style.top="-2000px",o.style.left="-2000px",o.style.width=t.props.minWidth+"px",o.style.height="720px",o.style.zIndex="100011",document.body.appendChild(o),new Promise((a,l)=>{let u=document.createElement("script");u.onerror=l,u.src=s.frontend+"/assets/html2canvas.js",u.onload=()=>{var c;(((c=o.contentWindow.document.fonts)===null||c===void 0?void 0:c.ready)||Promise.resolve()).then(function(){return o.contentWindow.html2canvas(h,{scale:Math.max(1.1,1e3/Math.min(1401,Math.max(320,t.props.minWidth))),width:Math.min(1401,Math.max(320,t.props.minWidth)),height:Math.max(1,Math.min(2e3,h.offsetHeight)),windowWidth:t.props.minWidth+"px",windowHeight:1e3,proxy:s.backend+"/proxy/media",backgroundColor:"#ffffff"}).then(p=>{let w=p.toDataURL("image/jpeg",.6);o.parentElement.removeChild(o);let v=new Image;v.onload=()=>{a(v)},v.onerror=l,v.src=w})})},o.contentWindow.document.head.appendChild(u);let d=o.contentWindow.document.createElement("style");d.textContent=`
|
|
69
|
+
${i}
|
|
70
70
|
body, html { padding: 0; margin: 0; overflow: hidden }
|
|
71
|
-
`,o.contentWindow.document.head.appendChild(d);let h=Nt({template:r,data:i});h.classList.add(...e,"-feaas--preview","-emulate--"+t.details.slug),o.contentWindow.document.body.appendChild(h)})}async function ce(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(s){e.sdk.log("FEAAS: Thumbnail failed to upload",i,s)}return i}var Tt;typeof window!="undefined"&&(window.FEAASElement=$,(Tt=window.FEAASLoading)!==null&&Tt!==void 0||(window.FEAASLoading=Promise.resolve()));function he(e){let t=[];if(e){let r=e.ownerDocument.defaultView,i,n;for(;r!==window.top;){i=r.parent;for(let s=0;s<i.frames.length;s++)if(i.frames[s]===r){for(let o of i.document.getElementsByTagName("iframe"))if(o.contentWindow===r){n=o.getBoundingClientRect();let a=o.contentWindow.getComputedStyle(o);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 pe(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 it=class extends y{constructor(){super(...arguments),this.framePoint={top:0,left:0},this.wrapperRect={top:0,left:0,width:0,height:0},this.bodyRect={top:0,left:0,width:0,height:0},this.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=he(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 pe(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(),s=document.body.getBoundingClientRect(),o=this.measurements[this.editedUID];o&&(Object.assign(n.clipper.style,{position:"absolute",top:i.top+this.iframe.clientTop-s.top+"px",left:i.left+this.iframe.clientLeft-s.left+"px",width:t+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(n.positionable.style,{position:"absolute",top:o.top+"px",left:o.left+"px",width:o.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(n.loader.style,{position:"absolute",top:o.top+"px",left:o.left+"px",width:o.width+"px",height:o.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:s,VersionStatusList:o,VersionStatusButton:a,Version:l,VersionMenu:u,EditorUIUndo:d,EditorUIMode:h,React:{useEffect:c,useMemo:p,useState:E,useContext:v},Chakra:{HStack:x,Box:A,Button:st,MenuItem:N},Chrome:at,ReactDOM:Ot,useSDK:D,useLibrary:L,useSlots:P,useModelObserver:gt,ConfirmationContext:W,VersionContext:g}){if(!this.payload)return;let{React:m}=this.payload,Mt=D(),Lt=L(),[b,$t]=E(),{setConfirm:yt}=v(W),H=n||i;b&&(this.component=b),c(()=>{if(this.props.hidden)return;let R=Lt.components.getItem(r).clone();return R.versions.search({ids:[i,n].filter(Boolean),componentIds:[r]}).then(bt=>{R.versions.setItems(bt);let C=R.findVersion(n,["staged","published"]),z=R.findVersion(i,["staged","published"]);if(C)C.deletedAt?(C.getDraft().changeAndNotify(z.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",C.id));else if(this.removeAttribute("forked"),this.shouldFork(z)){console.error("FEAAS Editor: Forking");let At=z.fork(n).id;this.setAttribute("instance",At)}else console.error("FEAAS Editor: Regular");$t(R)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),$t(null)},400)}},[i,this.props.hidden]);let Bt=gt(b==null?void 0:b.versions,[]).filter(R=>R.id==H),V=Bt[0];V&&!this.props.hidden&&(this.version=V),c(()=>(this.unfork=()=>{yt({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let R=b.findVersion(i,["staged","published"]);b.findVersion(n).unstage().unpublish().changeAndNotify(R.toProperties()),b.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(b.findVersion(H).revert(),b.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{yt({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=()=>{yt({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:()=>{b.findVersion(H).commitData({view:this.editorContext.editor.getData({rootName:H}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",H),b.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[b]);let ve=p(()=>this.target,[b]);return p(()=>b&&P(t,({picker:R,children:bt})=>m.createElement(A,{ref:C=>{this.chrome=C?{positionable:C,wrapper:C.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},m.createElement(A,{className:"editor-wrapper",position:"absolute",left:0,top:0},m.createElement(s,{datasources:Mt.datasources,sdk:Mt,library:Lt,component:b,versions:Bt,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:bt,chrome:({editor:C})=>C&&m.createElement(at,null),children:({isArchivedDisplayed:C,editor:z,status:At})=>m.createElement(A,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},m.createElement(A,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),m.createElement(A,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),m.createElement(A,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),m.createElement(A,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),V&&m.createElement(l,{version:V,node:ve,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:m.createElement(x,{justifyContent:"space-between"},m.createElement(d,{size:"sm",editor:At=="ready"?z:null}),m.createElement(h,{size:"sm"})),middle:(Ze,Xe)=>[!1],right:m.createElement(m.Fragment,null,m.createElement(st,{variant:"secondary",size:"sm",onClick:this.close},"Close"),m.createElement(st,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),m.createElement(u,{isDisabled:!this.props.forked&&!this.props.changed},m.createElement(N,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),m.createElement(N,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[V,this.props.forked,this.props.changed])}isReadyToLoad(){return this.props.component!=null&&this.props.version!=null&&!this.props.hidden}};it.observedAttributes=["library","component","version","revision","hidden","state","changed","forked"];it.register("feaas-editor");function fe(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"),placeholder:(e==null?void 0:e.getAttribute("placeholder"))||"No theme",frontend:(t=e==null?void 0:e.getContextAttribute("frontend"))!==null&&t!==void 0?t:"https://components.sitecorecloud.io",src:(r=e==null?void 0:e.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(e==null?void 0:e.getAttribute("hidden"))!=null,variant:e==null?void 0:e.getAttribute("variant"),context:void 0,onClose:void 0,onContextAttributeSet:void 0}}var nt=class extends y{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return fe(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}render({placeholder:t,context:r,mode:i,children:n,variant:s},{Picker:o,React:a,useLibrary:l}){let u=l("collections"),d=l("stylesheet.styles");return a.createElement(o,{rules:d,collections:u,themeContext:r,placeholder:t,mode:i||void 0,onModeChange:h=>{h||this.props.onClose(h)},onContextAttributeSet:this.props.onContextAttributeSet,context:r,variant:s},n)}};nt.observedAttributes=["library","mode","frontend","src","hidden","variant"];nt.register("feaas-picker");function me(e){var t,r,i,n;return{library:e==null?void 0:e.getAttribute("library"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/context.js",frontend:(r=e==null?void 0:e.getAttribute("frontend"))!==null&&r!==void 0?r:"https://components.sitecoreclud.io",backend:(i=e==null?void 0:e.getAttribute("backend"))!==null&&i!==void 0?i:"https://components.sitecoreclud.io/api",cdn:(n=e==null?void 0:e.getAttribute("cdn"))!==null&&n!==void 0?n:"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 ot=class extends y{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=_(t=>{this.sdk=t})}getProps(){return me(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}isReadyToLoad(){return console.log("Is ready?",this.props,super.isReadyToLoad()&&this.props.library!=null),super.isReadyToLoad()&&this.props.library!=null}getTheme(t){return t}getRoot(){return this.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(){Array.from(this.children).forEach(t=>{this.getRoot().appendChild(t)}),super.connectedCallback()}render({children:t,library:r},{AppContext:i,Chakra:{Button:n,Tooltip:s},React:o}){let a={containerRef:{current:this.getRoot()}};return s.defaultProps={hasArrow:!0,placement:"top",portalProps:a},o.createElement(i,{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:{cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},t)}};ot.observedAttributes=["library","component","version","revision","hostname","template"];ot.register("feaas-context");
|
|
71
|
+
`,o.contentWindow.document.head.appendChild(d);let h=Nt({template:r,data:n});h.classList.add(...e,"-feaas--preview","-emulate--"+t.details.slug),o.contentWindow.document.body.appendChild(h)})}async function ce(e,t,r){let n=t?t.getThumbnailURL():e.getThumbnailURL(),i=new Date(Math.max(Number(e.modifiedAt),Number(e.library.stylesheet.modifiedAt)));try{await e.sdk.uploadBlob("thumbnails",n.split(/\/thumbnails\//)[1],r,{headers:{"x-ms-blob-content-type":"image/jpg","x-ms-blob-cache-control":"public,max-age=31536000,immutable","x-ms-meta-versionId":t?t.id:null,"x-ms-meta-versionRevision":t?t.revision.toString():null,"x-ms-meta-componentId":e.id,"x-ms-meta-componentRenderedAt":i.toUTCString(),"x-ms-meta-componentModifiedAt":e.modifiedAt.toUTCString(),"x-ms-meta-componentCreatedAt":e.createdAt.toUTCString(),"x-ms-meta-modifiedAt":e.modifiedAt.toUTCString()}}),fetch(n,{cache:"no-cache"}).then(()=>{e.sdk.log("FEAAS: Thumbnail uploaded",n)})}catch(s){e.sdk.log("FEAAS: Thumbnail failed to upload",n,s)}return n}var Tt;typeof window!="undefined"&&(window.FEAASReactElement=$,(Tt=window.FEAASLoading)!==null&&Tt!==void 0||(window.FEAASLoading=Promise.resolve()));function he(e){let t=[];if(e){let r=e.ownerDocument.defaultView,n,i;for(;r!==window.top;){n=r.parent;for(let s=0;s<n.frames.length;s++)if(n.frames[s]===r){for(let o of n.document.getElementsByTagName("iframe"))if(o.contentWindow===r){i=o.getBoundingClientRect();let a=o.contentWindow.getComputedStyle(o);t.push({left:i.left+parseInt(a.borderLeftWidth),top:i.top+parseInt(a.borderTopWidth)})}r=n;break}}}return t.reduce((r,n)=>({left:r.left+n.left,top:r.top+n.top}),{left:0,top:0})}function pe(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 nt=class extends y{constructor(){super(...arguments),this.framePoint={top:0,left:0},this.wrapperRect={top:0,left:0,width:0,height:0},this.bodyRect={top:0,left:0,width:0,height:0},this.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=he(t.memoized.focusable)),this.chrome&&(this.wrapperRect=this.chrome.positionable.getBoundingClientRect(),this.bodyRect=this.chrome.positionable.ownerDocument.body.parentElement.getBoundingClientRect())},this.onMeasure=()=>{},this.onPosition=({focusable:t,root:r})=>{!this.chrome||this.props.hidden||(t?(this.chrome.wrapper.style.width=t.width+16*2+"px",this.chrome.wrapper.style.height=t.height+16*1+64+"px",this.chrome.wrapper.style.left=t.left-16+"px",this.chrome.wrapper.style.top=t.top-64+"px",this.chrome.wrapper.style.opacity="1",this.chrome.absolute=this.querySelector(".ui.overlays"),this.chrome.absolute&&(this.chrome.absolute.style.left=r.left+"px",this.chrome.absolute.style.top=r.top+"px")):(this.chrome.wrapper.style.opacity="0",this.chrome.wrapper.style.left="-1000px",this.chrome.wrapper.style.top="-1000px"))},this.onWindowMessage=t=>{var r;switch((r=t.data)===null||r===void 0?void 0:r.type){case"feaasEdit":let n=this.getPlaceholder();this.setTarget(n.editable,t.data)&&(this.loader=n.loader,document.body.appendChild(n.clipper),this.editedUID=t.data.id,this.setPlaceholder(),this.open());break;case"feaasMeasurements":this.measurements=t.data.measurements,this.props.hidden||this.setPlaceholder();break}},this.onContentChange=()=>{this.setAttribute("changed","changed"),requestAnimationFrame(()=>{this.setIframeComponentContent()})},this.onClose=()=>{var t;this.setAttribute("hidden","hidden"),this.placeholder&&(this.placeholder.positionable.style.opacity="0",this.placeholder.positionable.style.pointerEvents="none"),this.chrome&&(this.chrome.wrapper.style.opacity="0"),!((t=this.target)===null||t===void 0)&&t.parentNode&&(this.target.outerHTML=this.target.outerHTML),this.setTarget(null,{component:null,version:null,instance:null,revision:null}),this.setEditorContext({isFocused:!1})},this.onVersionStateChange=(t,r)=>{this.versionContext=t,this.setVersionContext=r},this.onEditorStateChange=(t,r)=>{this.editorContext=t,this.setEditorContext=r,t.editor&&this.props.state=="loading"&&!this.props.hidden&&(this.setAttribute("state","ready"),this.ownerDocument.fonts.ready.then(()=>setTimeout(()=>{this.setReadyState(),this.setIframeComponentContent()},100)))}}getProps(){return pe(this)}getReactRootElement(){return this.reactRootElement||(this.reactRootElement=document.createElement("div"),this.getRoot().appendChild(this.reactRootElement)),this.reactRootElement}showLoader(){this.loader||(this.loader=document.createElement("feaas-loader"),this.loader.setAttribute("opacity","0.6"),this.loader.style.zIndex="1000",this.target.appendChild(this.loader),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative"))}hideLoader(){this.loader&&(this.loader.setAttribute("hidden","hidden"),this.target.tagName=="FEAAS-COMPONENT"&&(this.target.style.position="relative",this.target.style.position=""))}load(){return import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}connectedCallback(){super.connectedCallback(),window.addEventListener("message",this.onWindowMessage)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("message",this.onWindowMessage)}setIframe(t){this.iframe=t}setIframeComponentContent(){this.placeholder&&this.iframe&&this.placeholder.editable.innerHTML&&this.iframe.contentWindow.postMessage({type:"feaasUpdate",id:this.editedUID,content:this.placeholder.editable.innerHTML})}setPlaceholder(){if(!this.iframe)return;let t=this.iframe.clientWidth,r=this.iframe.clientHeight,n=this.iframe.getBoundingClientRect(),i=this.getPlaceholder(),s=document.body.getBoundingClientRect(),o=this.measurements[this.editedUID];o&&(Object.assign(i.clipper.style,{position:"absolute",top:n.top+this.iframe.clientTop-s.top+"px",left:n.left+this.iframe.clientLeft-s.left+"px",width:t+"px",height:r+"px",pointerEvents:"none",zIndex:1,overflow:"hidden"}),Object.assign(i.positionable.style,{position:"absolute",top:o.top+"px",left:o.left+"px",width:o.width+"px",zIndex:2,transition:"opacity 0.4s",pointerEvents:this.props.hidden?"none":"all"}),Object.assign(i.loader.style,{position:"absolute",top:o.top+"px",left:o.left+"px",width:o.width+"px",height:o.height+"px",filter:"opacity(0.6)",zIndex:3,pointerEvents:"none"}),document.dispatchEvent(new Event("feaasRefresh",{bubbles:!0})))}getPlaceholder(){return this.placeholder?this.placeholder:(this.placeholder={clipper:document.createElement("div"),positionable:document.createElement("div"),editable:Object.assign(document.createElement("div"),{className:"-feaas"}),loader:document.createElement("feaas-loader")},this.placeholder.clipper.appendChild(this.placeholder.positionable),this.placeholder.positionable.appendChild(this.placeholder.editable),this.placeholder.clipper.appendChild(this.placeholder.loader),this.placeholder)}attributeChangedCallback(t,r,n){r!==n&&(t=="hidden"&&(this.style.setProperty("display","block","important"),this.style.setProperty("transition","opacity 0.3s","important"),n?(this.style.setProperty("opacity","0","important"),this.style.pointerEvents="none"):(this.style.setProperty("opacity","1","important"),this.style.pointerEvents="all")),super.attributeChangedCallback(t,r,n))}open(){clearTimeout(this.closing),this.removeAttribute("hidden"),this.removeAttribute("changed"),this.setLoadingState()}shouldFork(t){return t.forkOriginId==null&&this.props.instance!=null}cleanup(){var t;this.placeholder&&((t=this.placeholder.clipper)===null||t===void 0||t.remove(),this.placeholder=null)}close(){console.log("Editor is not ready")}unfork(){console.log("Editor is not ready")}discard(){console.log("Editor is not ready")}save(){console.log("Editor is not ready")}setVersionContext(t){console.log("Editor is not ready")}setEditorContext(t){console.log("Editor is not ready")}setLoadingState(){this.showLoader(),this.setAttribute("state","loading")}setReadyState(){this.hideLoader(),this.setEditorContext({activeVersionId:this.component.versions[0].id}),this.setAttribute("state","ready")}render({children:t,component:r,version:n,instance:i},{Editor:s,VersionStatusList:o,VersionStatusButton:a,Version:l,VersionMenu:u,EditorUIUndo:d,EditorUIMode:h,React:{useEffect:c,useMemo:p,useState:w,useContext:v},Chakra:{HStack:x,Box:A,Button:st,MenuItem:N},Chrome:at,ReactDOM:Ot,useSDK:D,useLibrary:L,useSlots:P,useModelObserver:gt,ConfirmationContext:W,VersionContext:g}){if(!this.payload)return;let{React:m}=this.payload,Mt=D(),Lt=L(),[b,$t]=w(),{setConfirm:yt}=v(W),H=i||n;b&&(this.component=b),c(()=>{if(this.props.hidden)return;let _=Lt.components.getItem(r).clone();return _.versions.search({ids:[n,i].filter(Boolean),componentIds:[r]}).then(bt=>{_.versions.setItems(bt);let C=_.findVersion(i,["staged","published"]),z=_.findVersion(n,["staged","published"]);if(C)C.deletedAt?(C.getDraft().changeAndNotify(z.toProperties()).restore(),console.error("FEAAS Editor: Restoring fork")):(console.error("FEAAS Editor: Pre-forked"),this.setAttribute("forked",C.id));else if(this.removeAttribute("forked"),this.shouldFork(z)){console.error("FEAAS Editor: Forking");let At=z.fork(i).id;this.setAttribute("instance",At)}else console.error("FEAAS Editor: Regular");$t(_)}),()=>{this.closing=setTimeout(()=>{this.closing=null,this.cleanup(),$t(null)},400)}},[n,this.props.hidden]);let Ut=gt(b==null?void 0:b.versions,[]).filter(_=>_.id==H),V=Ut[0];V&&!this.props.hidden&&(this.version=V),c(()=>(this.unfork=()=>{yt({title:"Reverting component customizations",button:"Discard",body:"Are you sure to reset component to its original state? All changes will be lost.",action:()=>{let _=b.findVersion(n,["staged","published"]);b.findVersion(i).unstage().unpublish().changeAndNotify(_.toProperties()),b.saveVersions(!1),this.setVersionContext({needsWrite:!0}),this.removeAttribute("forked"),requestAnimationFrame(this.onClose)}})},this.discard=()=>{this.props.changed&&(b.findVersion(H).revert(),b.saveVersions(!1),this.setVersionContext({needsWrite:!0}))},this.close=()=>{yt({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=()=>{yt({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:()=>{b.findVersion(H).commitData({view:this.editorContext.editor.getData({rootName:H}),model:""}).stage().publish(),this.removeAttribute("changed"),this.setAttribute("forked",H),b.saveVersions(!1)}})},()=>{delete this.unfork,delete this.discard,delete this.save,delete this.editorContext,delete this.versionContext,delete this.setEditorContext,delete this.setVersionContext}),[b]);let ve=p(()=>this.target,[b]);return p(()=>b&&P(t,({picker:_,children:bt})=>m.createElement(A,{ref:C=>{this.chrome=C?{positionable:C,wrapper:C.querySelector(".editor-chrome"),absolute:this.querySelector(".ui.overlays")}:null}},m.createElement(A,{className:"editor-wrapper",position:"absolute",left:0,top:0},m.createElement(s,{datasources:Mt.datasources,sdk:Mt,library:Lt,component:b,versions:Ut,context:{isAutosaveEnabled:!1,onChromeMeasure:this.onMeasure,onChromeBeforeMeasure:this.onBeforeMeasure,onChromeMeasureElement:this.onChromeMeasureElement,onChromePosition:this.onPosition,onContentChange:this.onContentChange}},{exports:this.onEditorStateChange,after:bt,chrome:({editor:C})=>C&&m.createElement(at,null),children:({isArchivedDisplayed:C,editor:z,status:At})=>m.createElement(A,{position:"absolute",left:0,top:0,className:"editor-chrome",p:4,boxShadow:"2xl",pointerEvents:"none",opacity:0,transition:"opacity 0.3s"},m.createElement(A,{left:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),m.createElement(A,{right:0,width:"4",top:0,bottom:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),m.createElement(A,{top:0,height:"16",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),m.createElement(A,{bottom:0,height:"4",left:0,right:0,backdropFilter:"blur(2px)",background:"rgb(244 244 244 / 80%)",position:"absolute"}),V&&m.createElement(l,{version:V,node:ve,ignoreBreakpoints:!0,deps:[this.props.forked,this.props.changed]},{exports:this.onVersionStateChange,left:m.createElement(x,{justifyContent:"space-between"},m.createElement(d,{size:"sm",editor:At=="ready"?z:null}),m.createElement(h,{size:"sm"})),middle:(Ze,Xe)=>[!1],right:m.createElement(m.Fragment,null,m.createElement(st,{variant:"secondary",size:"sm",onClick:this.close},"Close"),m.createElement(st,{variant:"primary",size:"sm",onClick:this.save,isDisabled:!this.props.changed},this.props.changed?this.props.forked?"Save":"Save customization":"Up to date"),m.createElement(u,{isDisabled:!this.props.forked&&!this.props.changed},m.createElement(N,{onClick:this.unfork,isDisabled:!this.props.forked},"Unfork"),m.createElement(N,{onClick:this.discard,isDisabled:!this.props.changed},"Discard")))}))})))),[V,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 fe(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"),placeholder:(e==null?void 0:e.getAttribute("placeholder"))||"No theme",frontend:(t=e==null?void 0:e.getContextAttribute("frontend"))!==null&&t!==void 0?t:"https://components.sitecorecloud.io",src:(r=e==null?void 0:e.getAttribute("src"))!==null&&r!==void 0?r:"/picker.js",hidden:(e==null?void 0:e.getAttribute("hidden"))!=null,variant:e==null?void 0:e.getAttribute("variant"),context:void 0,onClose:void 0,onContextAttributeSet:void 0}}var it=class extends y{constructor(){super(...arguments),this.defaultProps={hidden:!1}}getProps(){return fe(this)}load(){return this.import( /*@vite-ignore*/ /* webpackIgnore: true */ this.formatURL(this.props.src,this.props.frontend))}render({placeholder:t,context:r,mode:n,children:i,variant:s},{Picker:o,React:a,useLibrary:l}){let u=l("collections"),d=l("stylesheet.styles");return a.createElement(o,{rules:d,collections:u,themeContext:r,placeholder:t,mode:n||void 0,onModeChange:h=>{h||this.props.onClose(h)},onContextAttributeSet:this.props.onContextAttributeSet,context:r,variant:s},i)}};it.observedAttributes=["library","mode","frontend","src","hidden","variant"];it.register("feaas-picker");function me(e){var t,r,n,i;return{library:e==null?void 0:e.getAttribute("library"),src:(t=e==null?void 0:e.getAttribute("src"))!==null&&t!==void 0?t:"/context.js",frontend:(r=e==null?void 0:e.getAttribute("frontend"))!==null&&r!==void 0?r:"https://components.sitecorecloud.io",backend:(n=e==null?void 0:e.getAttribute("backend"))!==null&&n!==void 0?n:"https://components.sitecorecloud.io/api",cdn:(i=e==null?void 0:e.getAttribute("cdn"))!==null&&i!==void 0?i:"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 ot=class extends y{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=S(t=>{this.sdk=t})}getProps(){return me(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(){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()}render({children:t,library:r},{AppContext:n,Chakra:{Button:i,Tooltip:s},React:o}){let a={containerRef:{current:this.getRoot()}};return s.defaultProps={hasArrow:!0,placement:"top",portalProps:a},o.createElement(n,{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:".feaas-reset",cssVarsRoot:":host",resetCSS:!0,toastOptions:{portalProps:a}}},t)}};ot.observedAttributes=["library","component","version","revision","hostname","template"];ot.register("feaas-context");
|
|
72
72
|
//# sourceMappingURL=index.cjs.map
|