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