web-component-wrapper 0.0.597 → 0.0.598

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.
@@ -0,0 +1 @@
1
+ "use strict";if("undefined"!=typeof module&&null!==module&&"undefined"!==eval("typeof require")&&null!==eval("require")&&"main"in eval("require")&&"undefined"!==eval("typeof require.main")&&null!==eval("require.main")){var ORIGINAL_MAIN_MODULE=module;module!==eval("require.main")&&"paths"in module&&"paths"in eval("require.main")&&"undefined"!=typeof __dirname&&null!==__dirname&&(module.paths=eval("require.main.paths").concat(module.paths.filter((function(path){return eval("require.main.paths").includes(path)}))))}if(null==window)var window="undefined"==typeof global||null===global?{}:global;!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("clientnode"),require("clientnode/property-types"),require("react"),require("react-dom"),require("react-dom/client"),require("@babel/runtime/helpers/initializerDefineProperty"),require("@babel/runtime/helpers/applyDecoratedDescriptor"),require("@babel/runtime/helpers/initializerWarningHelper"));else if("function"==typeof define&&define.amd)define(["clientnode","clientnode/property-types","react","react-dom","react-dom/client","@babel/runtime/helpers/initializerDefineProperty","@babel/runtime/helpers/applyDecoratedDescriptor","@babel/runtime/helpers/initializerWarningHelper"],t);else{var r="object"==typeof exports?t(require("clientnode"),require("clientnode/property-types"),require("react"),require("react-dom"),require("react-dom/client"),require("@babel/runtime/helpers/initializerDefineProperty"),require("@babel/runtime/helpers/applyDecoratedDescriptor"),require("@babel/runtime/helpers/initializerWarningHelper")):t(e.clientnode,e["clientnode/property-types"],e.react,e["react-dom"],e["react-dom/client"],e["@babel/runtime/helpers/initializerDefineProperty"],e["@babel/runtime/helpers/applyDecoratedDescriptor"],e["@babel/runtime/helpers/initializerWarningHelper"]);for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(this,((e,t,r,s,n,i,o,a)=>(()=>{var p=[t=>{t.exports=e},e=>{e.exports=t},(e,t,r)=>{r.d(t,{default:()=>i});var s=r(0),n=r(1);const i=function(e={}){return e={readAttribute:!0,type:n.string,...e},function(t,r){if("string"!=typeof r)return;const n=t.self||t.constructor;if(e.readAttribute){Object.prototype.hasOwnProperty.call(n,"observedAttributes")||(n.observedAttributes=n.observedAttributes?[...n.observedAttributes]:[]);const e=(0,s.camelCaseToDelimited)(r);n.observedAttributes&&!n.observedAttributes.includes(e)&&n.observedAttributes.push(e)}if(e.type&&(Object.prototype.hasOwnProperty.call(n,"propertyTypes")||(n.propertyTypes=n.propertyTypes?{...n.propertyTypes}:{}),!n.propertyTypes||!e.update&&Object.prototype.hasOwnProperty.call(n,r)||(n.propertyTypes[r]=e.type)),e.writeAttribute&&(Object.prototype.hasOwnProperty.call(n,"propertiesToReflectAsAttributes")||(n.propertiesToReflectAsAttributes=n.propertiesToReflectAsAttributes?(0,s.copy)(n.propertiesToReflectAsAttributes):[]),e.update||n.propertiesToReflectAsAttributes instanceof Map&&!n.propertiesToReflectAsAttributes.has(r)||Array.isArray(n.propertiesToReflectAsAttributes)&&!n.propertiesToReflectAsAttributes.includes(r)||"object"==typeof n.propertiesToReflectAsAttributes&&!Object.prototype.hasOwnProperty.call(n.propertiesToReflectAsAttributes,r))){let t;"boolean"==typeof e.writeAttribute?e.writeAttribute&&n.propertyTypes&&Object.prototype.hasOwnProperty.call(n.propertyTypes,r)&&(t=n.propertyTypes[r]):t=e.writeAttribute,void 0!==t&&(Array.isArray(n.propertiesToReflectAsAttributes)&&(!0===e.writeAttribute?n.propertiesToReflectAsAttributes.push(r):n.normalizePropertyTypeList&&(n.propertiesToReflectAsAttributes=n.normalizePropertyTypeList(n.propertiesToReflectAsAttributes))),n.propertiesToReflectAsAttributes instanceof Map&&n.propertiesToReflectAsAttributes.set(r,t),"object"==typeof n.propertiesToReflectAsAttributes&&(n.propertiesToReflectAsAttributes[r]=t))}e.alias&&(Object.prototype.hasOwnProperty.call(n,"propertyAliases")||(n.propertyAliases=n.propertyAliases?{...n.propertyAliases}:{}),!n.propertyAliases||!e.update&&Object.prototype.hasOwnProperty.call(n,r)||(n.propertyAliases[r]=e.alias))}}},(e,t,r)=>{r.d(t,{default:()=>b});var s,n,i,o,a=r(4),p=r.n(a),l=r(5),c=r.n(l),h=(r(6),r(0)),d=r(1),u=r(2);const f=new h.Logger({name:"web-component-wrapper-web"}),m="undefined"==typeof HTMLElement?class{}:HTMLElement;let y=(s=(0,u.default)({type:d.boolean,writeAttribute:!0}),o=class e extends m{constructor(){super(),this.renderState={promise:Promise.resolve(""),pending:!1,resolve:h.NOOP},this.childComponentInstances=[],this.batchAttributeUpdates=!0,this.batchPropertyUpdates=!0,this.batchUpdates=!0,this.batchedAttributeUpdateRunning=!0,this.batchedPropertyUpdateRunning=!0,this.batchedUpdateRunning=!0,this.connectionRegistered=!1,this.pendingAttributeUpdates=[],this.parentInstance=null,this.rootInstance=void 0,this.hostDomNode=void 0,this.scope={...h.UTILITY_SCOPE},this.domNodeEventBindings=new Map,this.domNodeTemplateCache=new Map,this.externalProperties={},this.ignoreAttributeUpdateObservations=!1,this.internalProperties={},this.outputEventNames=new Set,this.instance=null,p()(this,"isRoot",i,this),this.runDomConnectionAndRenderingInSameEventQueue=!1,this.self=e,this.slots={},this.prepareNewRenderingPromise(),this.self=this.constructor,this.self._propertiesToReflectAsAttributes||(this.self._propertiesToReflectAsAttributes=this.self.normalizePropertyTypeList(this.self.propertiesToReflectAsAttributes)),this.generateAliasIndex(),this.hostDomNode=this,this.rootInstance=this,this.defineGetterAndSetterInterface()}attributeChangedCallback(e,t,r){this.ignoreAttributeUpdateObservations||t===r||this.onUpdateAttribute(e,r)}onUpdateAttribute(e,t){const r=new Promise((r=>this.pendingAttributeUpdates.push((()=>{this.evaluateStringOrNullAndSetAsProperty(e,t),this.batchAttributeUpdates?this.batchedAttributeUpdateRunning||this.batchedUpdateRunning||(this.batchedAttributeUpdateRunning=!0,this.batchedUpdateRunning=!0,(0,h.timeout)((()=>{this.batchedAttributeUpdateRunning=!1,this.batchedUpdateRunning=!1,this.render("attributeChanged")}))):this.render("attributeChanged"),r()}))));if(this.connectionRegistered)for(;this.pendingAttributeUpdates.length;)this.pendingAttributeUpdates.shift()();return r}connectedCallback(){try{this.isConnected=!0}catch{}for(this.connectionRegistered=!0,this.parentInstance=this,this.rootInstance=this,this.attachEventHandler(),this.self.determineRootBinding&&(this.determineRootBinding(),this.parentInstance!==this&&this.parentInstance.childComponentInstances&&this.parentInstance.childComponentInstances.push(this)),this.self.applyRootBinding&&this.isRoot&&(this.determineRenderScope(),this.applyBinding(this,this.scope));this.pendingAttributeUpdates.length;)this.pendingAttributeUpdates.shift()();this.batchedAttributeUpdateRunning=!1,this.batchedPropertyUpdateRunning=!1,this.batchedUpdateRunning=!1,this.grabGivenSlots(),this.reflectExternalProperties(this.externalProperties),this.runDomConnectionAndRenderingInSameEventQueue?this.render("connected"):(0,h.timeout)((()=>{this.render("connected")}))}disconnectedCallback(){this.unRender("disconnected"),this.unregisterConnectionState()}defineGetterAndSetterInterface(){const e=(0,h.unique)(Object.keys(this.self.propertyTypes).concat(this.self._propertyAliasIndex?Object.keys(this.self._propertyAliasIndex):[]));for(const t of e)Object.prototype.hasOwnProperty.call(this,t)&&this.setPropertyValue(t,this[t]),Object.defineProperty(this,t,{configurable:!0,get:()=>this.getPropertyValue(t),set:e=>{this.setPropertyValue(t,e),this.triggerPropertySpecificRendering(t,e)}})}getPropertyAlias(e){return this.self._propertyAliasIndex&&Object.prototype.hasOwnProperty.call(this.self._propertyAliasIndex,e)?this.self._propertyAliasIndex[e]:null}getPropertyValue(t){var r;const s=this.instance?.current?.properties&&(Object.prototype.hasOwnProperty.call(!e.propertyTypes,t)||Object.prototype.hasOwnProperty.call(this.instance.current.properties,t))?this.instance.current.properties[t]:null!==(r=this.internalProperties[t])&&void 0!==r?r:this.externalProperties[t];return this.instance?.current?.state&&Object.prototype.hasOwnProperty.call(this.instance.current.state,t)?this.instance.current.state[t]:s}setExternalPropertyValue(e,t){this.externalProperties[e]=t;const r=this.getPropertyAlias(e);r&&(this.externalProperties[r]=t)}setInternalPropertyValue(e,t){this.internalProperties[e]=t;const r=this.getPropertyAlias(e);r&&(this.internalProperties[r]=t)}setPropertyValue(e,t){this.reflectProperties({[e]:t}),this.setInternalPropertyValue(e,t)}triggerPropertySpecificRendering(e,t){if(this.batchPropertyUpdates)this.batchedPropertyUpdateRunning||this.batchedUpdateRunning||(this.batchedPropertyUpdateRunning=!0,this.batchedUpdateRunning=!0,(0,h.timeout)((()=>{void 0!==t&&this.isStateProperty(e)?(this.render("preStatePropertyChanged"),(0,h.timeout)((()=>{this.setInternalPropertyValue(e,void 0),this.batchedPropertyUpdateRunning=!1,this.batchedUpdateRunning=!1,this.render("postStatePropertyChanged"),this.triggerOutputEvents()}))):(this.batchedPropertyUpdateRunning=!1,this.batchedUpdateRunning=!1,this.render("propertyChanged"),this.triggerOutputEvents())})));else{const r=this.isStateProperty(e);this.render(r?"preStatePropertyChanged":"propertyChanged"),void 0!==t&&r&&(this.setInternalPropertyValue(e,void 0),this.render("postStatePropertyChanged")),this.triggerOutputEvents()}}unregisterConnectionState(){try{this.isConnected=!1}catch{}this.connectionRegistered=!1,this.slots={}}unregisterDomNodeEventBindings(){for(const e of this.domNodeEventBindings.values())for(const t of e.values())t()}applyBinding(e,t){if(e.getAttributeNames)for(const r of e.getAttributeNames()){let s;if(r.startsWith("data-bind-")?s=r.substring(10):r.startsWith("bind-")&&(s=r.substring(5)),s){const n=e.getAttribute(r);if(null===n)continue;if(s.startsWith("attribute-")||s.startsWith("property-")){const i=(0,h.evaluate)(n,t,!1,!0,e);if(i.error){f.warn("Error occurred during processing given",`attribute binding "${r}" on node:`,e,i.error);continue}s.startsWith("attribute-")?e.setAttribute(s.substring(10),i.result):e[(0,h.delimitedToCamelCase)(s.substring(9))]=i.result}else if(s.startsWith("on-")){s=(0,h.delimitedToCamelCase)(s.substring(3)),t={log:f,event:void 0,parameters:void 0,...t};const i=(0,h.compile)(n,t,!0,!0,e);i.error?f.warn("Error occurred during compiling given event",`binding "${r}" on node:`,e,i.error):this.addSecureEventListener(e,s,((...s)=>{t.event=s[0],t.parameters=s;try{i.templateFunction(...i.originalScopeNames.map((e=>t[e])))}catch(t){f.warn("Error occurred during processing","given event binding",`"${r}" on node:`,e,`Given expression "${n}" could`,"not be evaluated with given scope",'names "'+i.scopeNames.join('", "')+`": ${(0,h.represent)(t)}`)}}))}}}}applyBindings(e,t,r=!0){for(;e;)!e.attributes?.length||!r&&e.getAttribute("slot")||this.applyBinding(e,t),e.nodeName.toLowerCase().includes("-")||this.applyBindings(e.firstChild,t),e=e.nextSibling}compileDomNodeTemplate(e,t=[],r={}){r={ignoreComponents:!0,ignoreNestedComponents:!0,unsafe:this.self.renderUnsafe,...r};const s=e.nodeName.toLowerCase();if(r.ignoreComponents&&s.includes("-"))return null;if(r.unsafe){let r=e.innerHTML;if(!r&&e.template&&(r=e.template),this.self.hasCode(r)){const s=(0,h.compile)(`\`${r}\``,t);return{domNode:e,children:[],error:s.error,scopeNames:s.scopeNames,template:r,templateFunction:s.templateFunction}}return null}let n=null;if("#text"===s){const t=e.textContent;t&&this.self.hasCode(t)&&(n=t.replace(/&nbsp;/g," ").trim())}const i=[],o={children:i,domNode:e};if(n){const e=(0,h.compile)(`\`${n}\``,t);o.error=e.error,o.scopeNames=e.scopeNames,o.template=n,o.templateFunction=e.templateFunction}let a=e.firstChild;for(;a;){if(!r.filter||r.filter(a)){const e=this.compileDomNodeTemplate(a,t,{...r,ignoreComponents:r.ignoreNestedComponents});e&&i.push(e)}a=a.nextSibling}return o}evaluateCompiledDomNodeTemplate(e,t){const{domNode:r,error:s,templateFunction:n,scopeNames:i}=e;if(!n||!i)return null;if(s)return f.warn("Error occurred during compiling node content:",s),null;let o=null;try{o=n(...i.map((e=>t[e])))}catch(s){f.warn(`Error occurred when "${this.self._name}" is running`,`"${String(n)}": with bound`,`names "${i.join('", "')}":`,`"${s}". Rendering node:`,r)}return o}evaluateDomNodeTemplate(e,t={},r={}){const s=(r={domNodeTemplateCache:this.domNodeTemplateCache,ignoreComponents:!0,ignoreNestedComponents:!0,unsafe:this.self.renderUnsafe,...r}).domNodeTemplateCache;if(!s.has(e)){const n={filter:r.filter,ignoreComponents:r.ignoreComponents,ignoreNestedComponents:r.ignoreNestedComponents,unsafe:r.unsafe},i=this.compileDomNodeTemplate(e,t,n);i&&s.set(e,i)}if(s.has(e)){const n=s.get(e),i=this.evaluateCompiledDomNodeTemplate(n,t);if(null!==i&&(r.unsafe&&e.innerHTML?e.innerHTML=i:e.textContent=i),n.children.length){const e=r=>{for(const s of r){const r=this.evaluateCompiledDomNodeTemplate(s,t);null!==r&&(s.domNode.textContent=r),s.children.length&&e(s.children)}};e(n.children)}}r.applyBindings&&this.applyBindings(e,t)}addSecureEventListener(e,t,r,s,n){this.domNodeEventBindings.has(e)||this.domNodeEventBindings.set(e,new Map);const i=this.domNodeEventBindings.get(e),o=i.get(t);o&&o!==r&&o();const a=()=>{e.removeEventListener(t,r,n),i.delete(t),0===i.size&&this.domNodeEventBindings.delete(e)};return i.set(t,a),e.addEventListener(t,r,s),a}determineRootBinding(){let t=this.parentNode;for(;t;){const r=t instanceof e||t.nodeName.includes("-")&&"#document-fragment"!==t.nodeName,s=null===t.parentNode&&"[object ShadowRoot]"===t.toString();r?(this.rootInstance===this&&(this.parentInstance=t,this.setPropertyValue("isRoot",!1)),this.rootInstance=t):s&&this.setPropertyValue("isRoot",!1),t=t.parentNode}}static hasCode(e){return"string"==typeof e&&e.includes("${")&&e.includes("}")&&/\${[\s\S]+}/.test(e)}static normalizePropertyTypeList(t){if("string"==typeof t&&(t=[t]),Array.isArray(t)){const r=t,s=new Map;for(const t of r)Object.prototype.hasOwnProperty.call(e.propertyTypes,t)&&s.set(t,e.propertyTypes[t]);return s}return(0,h.convertPlainObjectToMap)(t)}attachEventHandler(){if(null===this.self.eventToPropertyMapping)return;const e=this.attachExplicitDefinedOutputEventHandler();this.attachImplicitDefinedOutputEventHandler(!e)}attachExplicitDefinedOutputEventHandler(){if(!this.self.eventToPropertyMapping)return!1;let e=!1;for(const t of Object.keys(this.self.eventToPropertyMapping))Object.prototype.hasOwnProperty.call(this.internalProperties,t)||(e=!0,this.outputEventNames.add(t),this.setInternalPropertyValue(t,(async(...e)=>{const r=await this.reflectEventToProperties(t,e);r&&(e[0]=r),this.forwardEvent(t,e)})));return e}attachImplicitDefinedOutputEventHandler(e=!0){for(const[t,r]of Object.entries(this.self.propertyTypes))Object.prototype.hasOwnProperty.call(this.internalProperties,t)||![d.func,"function"].includes(r)||this.self.renderProperties.includes(t)||(this.outputEventNames.add(t),this.setInternalPropertyValue(t,((...r)=>{e&&this.reflectEventToProperties(t,r),this.forwardEvent(t,r)})))}triggerOutputEvents(){for(const e of this.outputEventNames)this.forwardEvent(e,[this.externalProperties])}forwardEvent(e,t){return e.length>3&&e.startsWith("on")&&(e=(0,h.lowerCase)(e.substring(2))),this.dispatchEvent(new CustomEvent(e,{detail:{parameters:t}}))}applySlots(t,r){for(const s of Array.from(t.querySelectorAll("slot"))){const t=s.getAttribute("name");if(null===t||"default"===t)if(this.slots.default){if(this.self.renderSlots){if(this.self.evaluateSlots)for(const e of this.slots.default)this.evaluateDomNodeTemplate(e,r);(0,h.replace)(s,this.slots.default,e.trimSlots)}}else this.slots.default=(0,h.unwrap)(s).map((e=>this.grabSlotContent(e)));else this.slots[t]?this.self.renderSlots&&(this.self.evaluateSlots&&this.evaluateDomNodeTemplate(this.slots[t],r),(0,h.replace)(s,this.slots[t],e.trimSlots)):this.slots[t]=this.grabSlotContent((0,h.unwrap)(s).filter((e=>"#text"!==e.nodeName.toLowerCase()))[0])}}grabSlotContent(e){const t=d.node.firstElementChild?e:null;if(t&&"textarea"===t.firstElementChild?.nodeName.toLowerCase()&&(!t.firstElementChild.hasAttribute("data-no-template")||"false"===t.firstElementChild.getAttribute("data-no-template"))){const e=t.firstElementChild.value;t.classList.remove("web-component-template");const r=t.cloneNode();return t.classList.add("web-component-template"),r.innerHTML="",r.template=e,r}return this.self.cloneSlots?e.cloneNode(!0):e}grabGivenSlots(){this.slots={};for(const e of Array.from(this.querySelectorAll("[slot]"))){let t=e.parentNode,r=!0;for(;t;){if(t.nodeName.includes("-")){t===this&&(r=!1);break}t=t.parentNode}if(r)continue;const s=e.getAttribute("slot")?.trim();this.slots[null!=s?s:e.nodeName.toLowerCase()]=this.grabSlotContent(e)}this.slots.default?this.slots.default=[].concat(this.slots.default):this.childNodes.length>0?this.slots.default=Array.from(this.childNodes).map((e=>this.grabSlotContent(e))):this.slots.default=[]}isStateProperty(e){return Boolean(this.instance?.current?.state&&(Object.prototype.hasOwnProperty.call(this.instance.current.state,e)||this.instance.current.state.modelState&&Object.prototype.hasOwnProperty.call(this.instance.current.state.modelState,e)))}generateAliasIndex(){if(!this.self._propertyAliasIndex){this.self._propertyAliasIndex={...this.self.propertyAliases};for(const[e,t]of Object.entries(this.self._propertyAliasIndex))Object.prototype.hasOwnProperty.call(this.self._propertyAliasIndex,t)||(this.self._propertyAliasIndex[t]=e)}}reflectExternalProperties(e){this.ignoreAttributeUpdateObservations=!0;for(const[t,r]of Object.entries(e)){if(this.setExternalPropertyValue(t,r),!this.isConnected)continue;const e=(0,h.camelCaseToDelimited)(t);if(this.self._propertiesToReflectAsAttributes?.has(t))switch(this.self._propertiesToReflectAsAttributes.get(t)){case d.boolean:case"boolean":r?""!==this.getAttribute(e)&&this.setAttribute(e,""):this.hasAttribute(e)&&this.removeAttribute(e);break;case d.func:case"function":break;case"json":if(r){const t=JSON.stringify(r);if(t&&this.getAttribute(e)!==t){this.setAttribute(e,t);break}}this.hasAttribute(e)&&this.removeAttribute(e);break;case d.number:case"number":if("number"!=typeof r||isNaN(r))this.hasAttribute(e)&&this.removeAttribute(e);else{const t=String(r);this.getAttribute(e)!==t&&this.setAttribute(e,t)}break;case d.string:case"string":r?this.getAttribute(e)!==r&&this.setAttribute(e,r):this.hasAttribute(e)&&this.removeAttribute(e);break;case d.any:case d.array:case d.arrayOf:case d.element:case d.elementType:case d.instanceOf:case d.node:case d.object:case"object":case d.objectOf:case d.shape:case d.exact:case d.symbol:default:if(r){const t=(0,h.represent)(r);if(t&&this.getAttribute(e)!==t){this.setAttribute(e,t);break}}this.hasAttribute(e)&&this.removeAttribute(e)}}this.ignoreAttributeUpdateObservations=!1}reflectProperties(e){if(this.reflectExternalProperties(e),this.instance?.current?.state&&"object"==typeof this.instance.current.state)for(const e of Object.keys(this.instance.current.state).concat(this.instance.current.state.modelState?Object.keys(this.instance.current.state.modelState):[]))Object.prototype.hasOwnProperty.call(this.internalProperties,e)&&this.setInternalPropertyValue(e,void 0);this.internalProperties.model?.state&&(delete this.internalProperties.model.state,this.setInternalPropertyValue("model",this.internalProperties.model));for(const t of this.self.controllableProperties)Object.prototype.hasOwnProperty.call(e,t)&&this.setInternalPropertyValue(t,e[t])}async reflectEventToProperties(e,t){const r=this.batchUpdates;this.batchUpdates=!1;let s=null,n=!1;if(this.self.eventToPropertyMapping&&Object.prototype.hasOwnProperty.call(this.self.eventToPropertyMapping,e)&&(0,h.isFunction)(this.self.eventToPropertyMapping[e])){const r=this.self.eventToPropertyMapping[e](...t,this),i=r&&"then"in r&&(0,h.isFunction)(r.then)?await r:r;n=!0,Array.isArray(i)?(s=i[0],this.reflectProperties(s),(0,h.extend)(!0,this.internalProperties,i[1])):null===i?n=!1:"object"==typeof i&&(s=i,this.reflectProperties(i))}if(!n&&t.length>0&&(0,h.isObject)(t[0])){let e=t[0];if("persist"in t[0]&&(0,h.isFunction)(t[0].persist)){e={};for(const r of Object.keys(this.self.propertyTypes))for(const s of[r].concat(null!==(i=this.getPropertyAlias(r))&&void 0!==i?i:[])){var i;const r=t[0].currentTarget&&Object.prototype.hasOwnProperty.call(t[0].currentTarget,s)?t[0].currentTarget[s]:this.getPropertyValue(s);r!==this.externalProperties[s]&&(e[s]=r)}}else[null,void 0].includes(e.detail?.value)||(e={...e.detail});s=e,this.reflectProperties(e)}return this.triggerRender("propertyReflected"),this.batchUpdates=r,s}evaluateStringOrNullAndSetAsProperty(e,t){const r=e.startsWith("-"),s=r?e.substring(1):e;let n=(0,h.delimitedToCamelCase)(s);const i=this.getPropertyAlias(n);if(i&&Object.prototype.hasOwnProperty.call(this.self.propertyTypes,i)&&(n=i),Object.prototype.hasOwnProperty.call(this.self.propertyTypes,n)){const s=this.self.propertyTypes[n];if(r){if(t){const r=(0,h.evaluate)(t,{...h.UTILITY_SCOPE},!1,!0,this);r.error?(f.warn("Failed to process pre-evaluation attribute",`"${e}": ${r.error}. Will be`,'set to "undefined".'),this.setInternalPropertyValue(n,void 0)):(this.setInternalPropertyValue(n,r.result),this.setExternalPropertyValue(n,r.result))}}else switch(s){case d.boolean:case"boolean":{const e=![null,"false"].includes(t);this.setInternalPropertyValue(n,e),this.setExternalPropertyValue(n,e);break}case d.func:case"function":{let r,s=null;const i=["data","event","firstArgument","firstParameter","options"];if(t){const n=(0,h.compile)(t,i.concat("parameters","scope",h.UTILITY_SCOPE_NAMES),!0,!0,this);s=n.error,r=n.templateFunction,s&&f.warn("Failed to compile given handler",`"${e}": ${s}.`)}this.setInternalPropertyValue(n,((...o)=>{let a;if(this.outputEventNames.has(n)&&this.reflectEventToProperties(n,o),!s){const s={parameters:o,...h.UTILITY_SCOPE};for(const e of i)s[e]=o[0];try{a=r?.(...i.map((e=>s[e])),o,s,...h.UTILITY_SCOPE_NAMES.map((e=>h.UTILITY_SCOPE[e])))}catch(r){f.warn("Failed to evaluate function",`"${e}" with expression`,`"${t}" and scope`,"variables",`"${i.join('", "')}" set to`,`"${(0,h.represent)(o)}":`,`${r}. Set property`,'to "undefined".')}}return this.self.renderProperties.includes(n)||this.forwardEvent(n,o),a})),s||this.setExternalPropertyValue(n,r);break}case"json":if(t){let r;try{r=JSON.parse(t)}catch(t){f.warn("Error occurred during parsing given json",`attribute "${e}":`,(0,h.represent)(t));break}this.setInternalPropertyValue(n,r),this.setExternalPropertyValue(n,(0,h.copy)(r,!1,1))}else this.setInternalPropertyValue(n,null),this.setExternalPropertyValue(n,null);break;case d.number:case"number":{if(null===t){this.setInternalPropertyValue(n,t),this.setExternalPropertyValue(n,t);break}let e=parseFloat(t);isNaN(e)&&(e=void 0),this.setInternalPropertyValue(n,e),this.setExternalPropertyValue(n,e);break}case d.string:case"string":this.setInternalPropertyValue(n,t),this.setExternalPropertyValue(n,t);break;case d.any:case d.array:case d.arrayOf:case d.element:case d.elementType:case d.instanceOf:case d.node:case d.object:case"object":case d.objectOf:case d.oneOf:case d.oneOfType:case d.shape:case d.exact:case d.symbol:default:if(t){const r=(0,h.evaluate)(t,{},!1,!0,this);if(r.error){f.warn("Error occurred during processing given",`attribute configuration "${e}":`,r.error);break}this.setInternalPropertyValue(n,r.result),this.setExternalPropertyValue(n,(0,h.copy)(r.result,!1,1))}else this.hasAttribute(e)?(this.setInternalPropertyValue(n,!0),this.setExternalPropertyValue(n,!0)):(this.setInternalPropertyValue(n,null),this.setExternalPropertyValue(n,null))}}}async waitForNestedComponentRendering(){this.childComponentInstances&&await Promise.all(this.childComponentInstances.map((e=>e.renderState.pending?e.renderState.promise:Promise.resolve())))}async resolveRenderingPromiseIfSet(e,t){t&&(await this.waitForNestedComponentRendering(),this.renderState.pending=!1,this.renderState.resolve(e),this.prepareNewRenderingPromise())}prepareNewRenderingPromise(){this.renderState.pending||(this.renderState.promise=new Promise((e=>{this.renderState.resolve=t=>{this.renderState.pending=!1,e(t)}})))}triggerRender(e){this.batchUpdates?this.batchedUpdateRunning||(this.batchedUpdateRunning=!0,(0,h.timeout)((()=>{this.batchedUpdateRunning=!1,this.render(e)}))):this.render(e)}applyShadowRootIfNotExisting(){this.self.shadowDOM&&this.hostDomNode===this&&(this.hostDomNode=(!("attachShadow"in this)&&"ShadyDOM"in window?window.ShadyDOM.wrap(this):this).attachShadow((0,h.isObject)(this.self.shadowDOM)?this.self.shadowDOM:{mode:"open"}))}determineRenderScope(e={}){this.scope={...this.parentInstance?.scope||{},...this.scope,...this.internalProperties,parentInstance:this.parentInstance,rootInstance:this.rootInstance,self:this,[(0,h.lowerCase)(this.self._name)||"instance"]:this,...e},this.scope.scope=this.scope}async render(e="unknown",t=!0){if(this.unRender("reRender",e),this.childComponentInstances=[],this.renderState.pending=!0,this.isRoot&&(await this.resolveRenderingPromiseIfSet(e,t),t&&(await Promise.all(this.self.pendingRenderPromises),this.self.pendingRenderPromises=[])),this.self.pendingRenderPromises.push(this.renderState.promise),this.determineRenderScope(),!this.self.doRender||!this.dispatchEvent(new CustomEvent("render",{detail:{reason:e,scope:this.scope}})))return void await this.resolveRenderingPromiseIfSet(e,t);const r=(0,h.evaluate)(`\`${this.self.content}\``,this.scope);if(r.error)return f.warn(`Failed to process template: ${r.error}`),this.renderState.resolve(e),void await Promise.all(this.self.pendingRenderPromises);this.applyShadowRootIfNotExisting();const s=document.createElement("div");s.innerHTML=r.result,this.applySlots(s,{...this.scope,parentInstance:this}),this.hostDomNode.innerHTML=s.innerHTML,await(0,h.timeout)(),this.waitForNestedComponentRendering().then((()=>{this.applyBindings(this.hostDomNode.firstChild,this.scope,this.self.renderSlots)})),await this.resolveRenderingPromiseIfSet(e,t)}unRender(e="unknown",t){this.unregisterDomNodeEventBindings()}},o.applyRootBinding=!0,o.pendingRenderPromises=[],o.content="<slot>Please provide a template to transclude.</slot>",o.determineRootBinding=!0,o.shadowDOM=null,o.observedAttributes=[],o.controllableProperties=[],o.eventToPropertyMapping={},o.propertyAliases={},o.propertyTypes={onClick:d.func},o.propertiesToReflectAsAttributes=[],o.renderProperties=["children"],o.doRender=!1,o.cloneSlots=!1,o.evaluateSlots=!1,o.renderSlots=!0,o.trimSlots=!0,o.renderUnsafe=!1,o._name="BaseWeb",o._propertyAliasIndex=void 0,o._propertiesToReflectAsAttributes=void 0,n=o,i=c()(n.prototype,"isRoot",[s],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),n);const b=y},e=>{e.exports=i},e=>{e.exports=o},e=>{e.exports=a},e=>{e.exports=r},,e=>{e.exports=s},e=>{e.exports=n}],l={};function c(e){var t=l[e];if(void 0!==t)return t.exports;var r=l[e]={exports:{}};return p[e](r,r.exports,c),r.exports}c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},c.d=(e,t)=>{for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var h={};c.r(h),c.d(h,{ReactWeb:()=>v,api:()=>A,default:()=>w,log:()=>P});var d=c(0),u=c(1),f=c(7),m=c.n(f),y=c(9),b=c(10),g=c(3);const P=new d.Logger({name:"web-component-wrapper-web"});class v extends g.default{constructor(...e){super(...e),this.unmountOnDisconnect=!0,this.compiledSlots={},this.preparedSlots={},this.reactRoot=null,this.rootReactInstance=null,this.self=v,this.wrapMemorizingWrapper=null,this.isWrapped=!1,this.reflectInstanceProperties=()=>{this.instance?.current&&this.instance.current.properties&&this.reflectProperties(this.instance.current.properties)}}connectedCallback(){this.applyComponentWrapper(),this.rootReactInstance=this,super.connectedCallback()}disconnectedCallback(){this.unRender("disconnected"),this.unmountOnDisconnect&&this.reactRoot?.unmount(),this.unregisterConnectionState()}reflectExternalProperties(e){this.isRoot&&super.reflectExternalProperties(e)}async render(e="unknown",t=!0){if(super.unRender("reRender",e),this.childComponentInstances=[],this.renderState.pending=!0,this.isRoot&&(this.self.pendingRenderPromises=[]),this.self.pendingRenderPromises.push(this.renderState.promise),this.rootReactInstance!==this||!this.dispatchEvent(new CustomEvent("render",{detail:{reason:e,scope:this.scope}})))return this.resolveRenderingPromiseIfSet(e,t);if(this.determineRenderScope(),0===Object.keys(this.compiledSlots).length&&this.preCompileSlots(),this.evaluateSlots({...this.scope,parentInstance:this}),this.prepareProperties(this.internalProperties),this.applyShadowRootIfNotExisting(),this.rootInstance!==this&&!this.reactRoot){let e=this.firstChild;for(;e;){const t=e.nextSibling;this.removeChild(e),e=t}}if(!this.reactRoot){const e=this.id||this.internalProperties.id||this.externalProperties.id||this.name||this.internalProperties.name||this.externalProperties.name;let t="";"string"==typeof e&&(t=e),this.reactRoot=(0,b.createRoot)(this.hostDomNode,{identifierPrefix:t})}(0,y.flushSync)((()=>{this.reactRoot?.render((0,f.createElement)(this.self.content,this.internalProperties)),this.resolveRenderingPromiseIfSet(e,t)})),t&&await this.renderState.promise}setPropertyValue(e,t){this.reflectProperties({[e]:(0,d.copy)(t,!1,1)}),this.setInternalPropertyValue(e,(0,d.copy)(t,!1,1))}setInternalPropertyValue(e,t){null===t?t=u.NullSymbol:void 0===t&&(t=u.UndefinedSymbol),super.setInternalPropertyValue(e,t)}preCompileDomNodes(e,t={},r=!1){if(1===(e=e.filter((e=>e.nodeType!==Node.TEXT_NODE||"string"==typeof e.nodeValue&&""!==e.nodeValue.trim()))).length)return this.preCompileDomNode(e[0],t,r);let s=1;const n=[];for(const i of e){const e=this.preCompileDomNode(i,t,r,s.toString());n.push(e),s+=1}return r?e=>(...t)=>{const r=[];for(const s of n){const n=s(e);"function"==typeof n&&r.push(n(...t))}return(0,f.createElement)(f.Fragment,{children:r})}:n}preCompileDomNode(e,t={},r=!1,s){if(r){const r=this.preCompileDomNode(e,{...t,data:void 0,firstArgument:void 0,firstParameter:void 0,options:void 0,scope:void 0,parameters:void 0},!1,s);return e=>(...t)=>{const s=t.length>0?t[0]:null;return r({...e,data:s,firstArgument:s,firstParameter:s,options:s,scope:s,parameters:t})}}if(e.nodeType===Node.TEXT_NODE){const t="string"==typeof e.nodeValue?e.nodeValue.trim():"",r=s&&t?(0,f.createElement)(f.Fragment,{children:t,key:s}):t||null;return()=>r}if(!e.getAttributeNames)return()=>null;const n={};let i;const o=this.self.isReactComponent(e);o?(e.determineRenderScope(),0===Object.keys(this.compiledSlots).length&&e.preCompileSlots(),s&&!Object.prototype.hasOwnProperty.call(n,"key")&&(n.key=s),i=e.constructor.content):(n.key=s,i=e.tagName.toLowerCase());let a=Object.keys(t);const p={};for(const r of e.getAttributeNames()){let s=e.getAttribute(r);if(null===s)continue;let i=!1,l="";if(r.startsWith("data-bind-")?l=r.substring(10):r.startsWith("bind-")&&(l=r.substring(5)),l.startsWith("attribute-")||"attributes"===l||l.startsWith("property-")||"properties"===l){const{error:t,originalScopeNames:n,templateFunction:o}=(0,d.compile)(s,a);if(t){P.warn("Error occurred during compiling given attribute",`binding "${r}" on node:`,e,t);continue}"attributes"===l||"properties"===l?i=!0:l=l.startsWith("attribute-")?l.substring(10):l.substring(9),s={originalScopeNames:n,templateFunction:o.bind(this)}}else if(l.startsWith("on-")){l=(0,d.delimitedToCamelCase)(l),Object.prototype.hasOwnProperty.call(t,"event")||(a=[...a,"event"]),Object.prototype.hasOwnProperty.call(t,"parameters")||(a=[...a,"parameters"]);const{error:n,originalScopeNames:i,scopeNames:o,templateFunction:p}=(0,d.compile)(s,a,!0);if(n){P.warn("Error occurred during compiling given event",`binding "${r}" on node:`,e,n);continue}const c=p.bind(this);s=(...n)=>{t.event=n[0],t.parameters=n;try{c(...i.map((e=>t[e])))}catch(t){P.warn("Error occurred during processing given",`event binding "${r}" on node: `,e,`Given expression "${s}" could`,"not be evaluated with given scope names",`"${o.join('", "')}":`,(0,d.represent)(t))}}}else l=r;const c={class:"className",for:"htmlFor"};Object.prototype.hasOwnProperty.call(c,l)&&(l=c[l]),l=(0,d.delimitedToCamelCase)(l),s?.originalScopeNames?p[i?"":l]=s:o||(n[l]=s)}if(!o){const r=Array.from(e.childNodes);r.length&&(n.children=this.preCompileDomNodes(r,t))}return r=>{(r={...t,...r}).scope=r;let s={...n};for(const[e,{originalScopeNames:t,templateFunction:n}]of Object.entries(p)){const i=n(...t.map((e=>r[e])));""===e?s={...s,...i}:s[e]=i}return Object.prototype.hasOwnProperty.call(s,"innerHTML")&&(s.dangerouslySetInnerHTML={__html:s.innerHTML},delete s.children,delete s.innerHTML),Object.prototype.hasOwnProperty.call(s,"textContent")?(s.children=s.textContent,delete s.textContent):o?(s={...e.internalProperties,...s},r={...s,...r,parentInstance:e},e.evaluateSlots(r),e.prepareProperties(s)):s.children&&(s.children=this.evaluatePreCompiledDomNodes(s.children,r)),(0,f.createElement)(i,s)}}evaluatePreCompiledDomNodes(e,t={}){if(!Array.isArray(e))return e(t);if(1===e.length)return e[0](t);const r=[];for(const s of e){const e=s(t);e&&r.push(e)}return r}preCompileSlots(){for(const e in this.slots)this.slots[e]&&"default"!==e&&(this.compiledSlots[e]=this.preCompileDomNode(this.slots[e],{...this.scope,parentInstance:this},[u.func,"function"].includes(this.self.propertyTypes[e])));this.slots.default&&this.slots.default.length>0&&(this.compiledSlots.children=this.preCompileDomNodes(this.slots.default,{...this.scope,parentInstance:this},[u.func,"function"].includes(this.self.propertyTypes.children)))}evaluateSlots(e){this.preparedSlots={};for(const t in this.compiledSlots)Object.prototype.hasOwnProperty.call(this.compiledSlots,t)&&("children"===t?this.preparedSlots.children=this.evaluatePreCompiledDomNodes(this.compiledSlots[t],e):this.preparedSlots[t]=this.compiledSlots[t](e))}static isReactComponent(e){const t=e.constructor;return"object"==typeof t.content&&(!t.attachWebComponentAdapterIfNotExists||"react"===t.content.webComponentAdapterWrapped)}determineRootBinding(){super.determineRootBinding();let e=this.parentNode;for(;e;){if(this.self.isReactComponent(e)){this.rootReactInstance=e;break}e=e.parentNode}}applyComponentWrapper(){if("string"==typeof this.self.content||this.isWrapped)return;this.isWrapped=!0;const e=this.self.content.wrapped||this.self.content;this.self.content.webComponentAdapterWrapped?this.wrapMemorizingWrapper&&(this.self.content=(0,f.memo)(this.self.content),this.self.content.wrapped=e):this.self.attachWebComponentAdapterIfNotExists?(this.self.content.displayName||(this.self.content.displayName=this.self._name),this.self.content=(0,f.forwardRef)(((t,r)=>((0,f.useImperativeHandle)(r,(()=>({properties:t})),[t]),(0,f.createElement)(e,t)))),(this.wrapMemorizingWrapper||null===this.wrapMemorizingWrapper)&&(this.self.content=(0,f.memo)(this.self.content)),this.self.content.wrapped=e,this.self.content.webComponentAdapterWrapped="react"):this.wrapMemorizingWrapper&&(this.self.content=(0,f.memo)(this.self.content),this.self.content.wrapped=e)}prepareProperties(e){(0,d.extend)(e,this.preparedSlots),this.self.removeKnownUnwantedPropertyKeys(this.self,e),e.ref||(this.instance=(0,f.createRef)(),e.ref=e=>{this.instance?this.instance.current=e:this.instance={current:e},this.reflectInstanceProperties()})}static removeKnownUnwantedPropertyKeys(e,t){if("string"!=typeof e.content)for(const r of["isRoot","isTrusted","__composed"])Object.prototype.hasOwnProperty.call(t,r)&&(Object.prototype.hasOwnProperty.call(e.content,"propTypes")&&!Object.prototype.hasOwnProperty.call(e.content.propTypes,r)||Object.prototype.hasOwnProperty.call(e.content,"wrapped")&&Object.prototype.hasOwnProperty.call(e.content.wrapped,"propTypes")&&!Object.prototype.hasOwnProperty.call(e.content.wrapped.propTypes,r))&&delete t[r]}}v.attachWebComponentAdapterIfNotExists=!0,v.content="div",v.react=m(),v._name="ReactWebComponent";const A={component:v,register:(e=(0,d.camelCaseToDelimited)(v._name))=>{customElements.define(e,v)}},w=v;return h})()));
package/dist/Web.js ADDED
@@ -0,0 +1 @@
1
+ "use strict";if("undefined"!=typeof module&&null!==module&&"undefined"!==eval("typeof require")&&null!==eval("require")&&"main"in eval("require")&&"undefined"!==eval("typeof require.main")&&null!==eval("require.main")){var ORIGINAL_MAIN_MODULE=module;module!==eval("require.main")&&"paths"in module&&"paths"in eval("require.main")&&"undefined"!=typeof __dirname&&null!==__dirname&&(module.paths=eval("require.main.paths").concat(module.paths.filter((function(path){return eval("require.main.paths").includes(path)}))))}if(null==window)var window="undefined"==typeof global||null===global?{}:global;!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@babel/runtime/helpers/initializerDefineProperty"),require("@babel/runtime/helpers/applyDecoratedDescriptor"),require("@babel/runtime/helpers/initializerWarningHelper"),require("clientnode"),require("clientnode/property-types"));else if("function"==typeof define&&define.amd)define(["@babel/runtime/helpers/initializerDefineProperty","@babel/runtime/helpers/applyDecoratedDescriptor","@babel/runtime/helpers/initializerWarningHelper","clientnode","clientnode/property-types"],t);else{var r="object"==typeof exports?t(require("@babel/runtime/helpers/initializerDefineProperty"),require("@babel/runtime/helpers/applyDecoratedDescriptor"),require("@babel/runtime/helpers/initializerWarningHelper"),require("clientnode"),require("clientnode/property-types")):t(e["@babel/runtime/helpers/initializerDefineProperty"],e["@babel/runtime/helpers/applyDecoratedDescriptor"],e["@babel/runtime/helpers/initializerWarningHelper"],e.clientnode,e["clientnode/property-types"]);for(var s in r)("object"==typeof exports?exports:e)[s]=r[s]}}(this,((e,t,r,s,i)=>(()=>{var n=[e=>{e.exports=s},e=>{e.exports=i},(e,t,r)=>{r.d(t,{default:()=>n});var s=r(0),i=r(1);const n=function(e={}){return e={readAttribute:!0,type:i.string,...e},function(t,r){if("string"!=typeof r)return;const i=t.self||t.constructor;if(e.readAttribute){Object.prototype.hasOwnProperty.call(i,"observedAttributes")||(i.observedAttributes=i.observedAttributes?[...i.observedAttributes]:[]);const e=(0,s.camelCaseToDelimited)(r);i.observedAttributes&&!i.observedAttributes.includes(e)&&i.observedAttributes.push(e)}if(e.type&&(Object.prototype.hasOwnProperty.call(i,"propertyTypes")||(i.propertyTypes=i.propertyTypes?{...i.propertyTypes}:{}),!i.propertyTypes||!e.update&&Object.prototype.hasOwnProperty.call(i,r)||(i.propertyTypes[r]=e.type)),e.writeAttribute&&(Object.prototype.hasOwnProperty.call(i,"propertiesToReflectAsAttributes")||(i.propertiesToReflectAsAttributes=i.propertiesToReflectAsAttributes?(0,s.copy)(i.propertiesToReflectAsAttributes):[]),e.update||i.propertiesToReflectAsAttributes instanceof Map&&!i.propertiesToReflectAsAttributes.has(r)||Array.isArray(i.propertiesToReflectAsAttributes)&&!i.propertiesToReflectAsAttributes.includes(r)||"object"==typeof i.propertiesToReflectAsAttributes&&!Object.prototype.hasOwnProperty.call(i.propertiesToReflectAsAttributes,r))){let t;"boolean"==typeof e.writeAttribute?e.writeAttribute&&i.propertyTypes&&Object.prototype.hasOwnProperty.call(i.propertyTypes,r)&&(t=i.propertyTypes[r]):t=e.writeAttribute,void 0!==t&&(Array.isArray(i.propertiesToReflectAsAttributes)&&(!0===e.writeAttribute?i.propertiesToReflectAsAttributes.push(r):i.normalizePropertyTypeList&&(i.propertiesToReflectAsAttributes=i.normalizePropertyTypeList(i.propertiesToReflectAsAttributes))),i.propertiesToReflectAsAttributes instanceof Map&&i.propertiesToReflectAsAttributes.set(r,t),"object"==typeof i.propertiesToReflectAsAttributes&&(i.propertiesToReflectAsAttributes[r]=t))}e.alias&&(Object.prototype.hasOwnProperty.call(i,"propertyAliases")||(i.propertyAliases=i.propertyAliases?{...i.propertyAliases}:{}),!i.propertyAliases||!e.update&&Object.prototype.hasOwnProperty.call(i,r)||(i.propertyAliases[r]=e.alias))}}},,t=>{t.exports=e},e=>{e.exports=t},e=>{e.exports=r}],o={};function a(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}};return n[e](r,r.exports,a),r.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),a.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var l={};a.r(l),a.d(l,{GenericHTMLElement:()=>v,Web:()=>w,api:()=>T,default:()=>O,log:()=>A});var p,c,h,d,u=a(4),f=a.n(u),y=a(5),b=a.n(y),m=(a(6),a(0)),g=a(1),P=a(2);const A=new m.Logger({name:"web-component-wrapper-web"}),v="undefined"==typeof HTMLElement?class{}:HTMLElement;let w=(p=(0,P.default)({type:g.boolean,writeAttribute:!0}),d=class e extends v{constructor(){super(),this.renderState={promise:Promise.resolve(""),pending:!1,resolve:m.NOOP},this.childComponentInstances=[],this.batchAttributeUpdates=!0,this.batchPropertyUpdates=!0,this.batchUpdates=!0,this.batchedAttributeUpdateRunning=!0,this.batchedPropertyUpdateRunning=!0,this.batchedUpdateRunning=!0,this.connectionRegistered=!1,this.pendingAttributeUpdates=[],this.parentInstance=null,this.rootInstance=void 0,this.hostDomNode=void 0,this.scope={...m.UTILITY_SCOPE},this.domNodeEventBindings=new Map,this.domNodeTemplateCache=new Map,this.externalProperties={},this.ignoreAttributeUpdateObservations=!1,this.internalProperties={},this.outputEventNames=new Set,this.instance=null,f()(this,"isRoot",h,this),this.runDomConnectionAndRenderingInSameEventQueue=!1,this.self=e,this.slots={},this.prepareNewRenderingPromise(),this.self=this.constructor,this.self._propertiesToReflectAsAttributes||(this.self._propertiesToReflectAsAttributes=this.self.normalizePropertyTypeList(this.self.propertiesToReflectAsAttributes)),this.generateAliasIndex(),this.hostDomNode=this,this.rootInstance=this,this.defineGetterAndSetterInterface()}attributeChangedCallback(e,t,r){this.ignoreAttributeUpdateObservations||t===r||this.onUpdateAttribute(e,r)}onUpdateAttribute(e,t){const r=new Promise((r=>this.pendingAttributeUpdates.push((()=>{this.evaluateStringOrNullAndSetAsProperty(e,t),this.batchAttributeUpdates?this.batchedAttributeUpdateRunning||this.batchedUpdateRunning||(this.batchedAttributeUpdateRunning=!0,this.batchedUpdateRunning=!0,(0,m.timeout)((()=>{this.batchedAttributeUpdateRunning=!1,this.batchedUpdateRunning=!1,this.render("attributeChanged")}))):this.render("attributeChanged"),r()}))));if(this.connectionRegistered)for(;this.pendingAttributeUpdates.length;)this.pendingAttributeUpdates.shift()();return r}connectedCallback(){try{this.isConnected=!0}catch{}for(this.connectionRegistered=!0,this.parentInstance=this,this.rootInstance=this,this.attachEventHandler(),this.self.determineRootBinding&&(this.determineRootBinding(),this.parentInstance!==this&&this.parentInstance.childComponentInstances&&this.parentInstance.childComponentInstances.push(this)),this.self.applyRootBinding&&this.isRoot&&(this.determineRenderScope(),this.applyBinding(this,this.scope));this.pendingAttributeUpdates.length;)this.pendingAttributeUpdates.shift()();this.batchedAttributeUpdateRunning=!1,this.batchedPropertyUpdateRunning=!1,this.batchedUpdateRunning=!1,this.grabGivenSlots(),this.reflectExternalProperties(this.externalProperties),this.runDomConnectionAndRenderingInSameEventQueue?this.render("connected"):(0,m.timeout)((()=>{this.render("connected")}))}disconnectedCallback(){this.unRender("disconnected"),this.unregisterConnectionState()}defineGetterAndSetterInterface(){const e=(0,m.unique)(Object.keys(this.self.propertyTypes).concat(this.self._propertyAliasIndex?Object.keys(this.self._propertyAliasIndex):[]));for(const t of e)Object.prototype.hasOwnProperty.call(this,t)&&this.setPropertyValue(t,this[t]),Object.defineProperty(this,t,{configurable:!0,get:()=>this.getPropertyValue(t),set:e=>{this.setPropertyValue(t,e),this.triggerPropertySpecificRendering(t,e)}})}getPropertyAlias(e){return this.self._propertyAliasIndex&&Object.prototype.hasOwnProperty.call(this.self._propertyAliasIndex,e)?this.self._propertyAliasIndex[e]:null}getPropertyValue(t){var r;const s=this.instance?.current?.properties&&(Object.prototype.hasOwnProperty.call(!e.propertyTypes,t)||Object.prototype.hasOwnProperty.call(this.instance.current.properties,t))?this.instance.current.properties[t]:null!==(r=this.internalProperties[t])&&void 0!==r?r:this.externalProperties[t];return this.instance?.current?.state&&Object.prototype.hasOwnProperty.call(this.instance.current.state,t)?this.instance.current.state[t]:s}setExternalPropertyValue(e,t){this.externalProperties[e]=t;const r=this.getPropertyAlias(e);r&&(this.externalProperties[r]=t)}setInternalPropertyValue(e,t){this.internalProperties[e]=t;const r=this.getPropertyAlias(e);r&&(this.internalProperties[r]=t)}setPropertyValue(e,t){this.reflectProperties({[e]:t}),this.setInternalPropertyValue(e,t)}triggerPropertySpecificRendering(e,t){if(this.batchPropertyUpdates)this.batchedPropertyUpdateRunning||this.batchedUpdateRunning||(this.batchedPropertyUpdateRunning=!0,this.batchedUpdateRunning=!0,(0,m.timeout)((()=>{void 0!==t&&this.isStateProperty(e)?(this.render("preStatePropertyChanged"),(0,m.timeout)((()=>{this.setInternalPropertyValue(e,void 0),this.batchedPropertyUpdateRunning=!1,this.batchedUpdateRunning=!1,this.render("postStatePropertyChanged"),this.triggerOutputEvents()}))):(this.batchedPropertyUpdateRunning=!1,this.batchedUpdateRunning=!1,this.render("propertyChanged"),this.triggerOutputEvents())})));else{const r=this.isStateProperty(e);this.render(r?"preStatePropertyChanged":"propertyChanged"),void 0!==t&&r&&(this.setInternalPropertyValue(e,void 0),this.render("postStatePropertyChanged")),this.triggerOutputEvents()}}unregisterConnectionState(){try{this.isConnected=!1}catch{}this.connectionRegistered=!1,this.slots={}}unregisterDomNodeEventBindings(){for(const e of this.domNodeEventBindings.values())for(const t of e.values())t()}applyBinding(e,t){if(e.getAttributeNames)for(const r of e.getAttributeNames()){let s;if(r.startsWith("data-bind-")?s=r.substring(10):r.startsWith("bind-")&&(s=r.substring(5)),s){const i=e.getAttribute(r);if(null===i)continue;if(s.startsWith("attribute-")||s.startsWith("property-")){const n=(0,m.evaluate)(i,t,!1,!0,e);if(n.error){A.warn("Error occurred during processing given",`attribute binding "${r}" on node:`,e,n.error);continue}s.startsWith("attribute-")?e.setAttribute(s.substring(10),n.result):e[(0,m.delimitedToCamelCase)(s.substring(9))]=n.result}else if(s.startsWith("on-")){s=(0,m.delimitedToCamelCase)(s.substring(3)),t={log:A,event:void 0,parameters:void 0,...t};const n=(0,m.compile)(i,t,!0,!0,e);n.error?A.warn("Error occurred during compiling given event",`binding "${r}" on node:`,e,n.error):this.addSecureEventListener(e,s,((...s)=>{t.event=s[0],t.parameters=s;try{n.templateFunction(...n.originalScopeNames.map((e=>t[e])))}catch(t){A.warn("Error occurred during processing","given event binding",`"${r}" on node:`,e,`Given expression "${i}" could`,"not be evaluated with given scope",'names "'+n.scopeNames.join('", "')+`": ${(0,m.represent)(t)}`)}}))}}}}applyBindings(e,t,r=!0){for(;e;)!e.attributes?.length||!r&&e.getAttribute("slot")||this.applyBinding(e,t),e.nodeName.toLowerCase().includes("-")||this.applyBindings(e.firstChild,t),e=e.nextSibling}compileDomNodeTemplate(e,t=[],r={}){r={ignoreComponents:!0,ignoreNestedComponents:!0,unsafe:this.self.renderUnsafe,...r};const s=e.nodeName.toLowerCase();if(r.ignoreComponents&&s.includes("-"))return null;if(r.unsafe){let r=e.innerHTML;if(!r&&e.template&&(r=e.template),this.self.hasCode(r)){const s=(0,m.compile)(`\`${r}\``,t);return{domNode:e,children:[],error:s.error,scopeNames:s.scopeNames,template:r,templateFunction:s.templateFunction}}return null}let i=null;if("#text"===s){const t=e.textContent;t&&this.self.hasCode(t)&&(i=t.replace(/&nbsp;/g," ").trim())}const n=[],o={children:n,domNode:e};if(i){const e=(0,m.compile)(`\`${i}\``,t);o.error=e.error,o.scopeNames=e.scopeNames,o.template=i,o.templateFunction=e.templateFunction}let a=e.firstChild;for(;a;){if(!r.filter||r.filter(a)){const e=this.compileDomNodeTemplate(a,t,{...r,ignoreComponents:r.ignoreNestedComponents});e&&n.push(e)}a=a.nextSibling}return o}evaluateCompiledDomNodeTemplate(e,t){const{domNode:r,error:s,templateFunction:i,scopeNames:n}=e;if(!i||!n)return null;if(s)return A.warn("Error occurred during compiling node content:",s),null;let o=null;try{o=i(...n.map((e=>t[e])))}catch(s){A.warn(`Error occurred when "${this.self._name}" is running`,`"${String(i)}": with bound`,`names "${n.join('", "')}":`,`"${s}". Rendering node:`,r)}return o}evaluateDomNodeTemplate(e,t={},r={}){const s=(r={domNodeTemplateCache:this.domNodeTemplateCache,ignoreComponents:!0,ignoreNestedComponents:!0,unsafe:this.self.renderUnsafe,...r}).domNodeTemplateCache;if(!s.has(e)){const i={filter:r.filter,ignoreComponents:r.ignoreComponents,ignoreNestedComponents:r.ignoreNestedComponents,unsafe:r.unsafe},n=this.compileDomNodeTemplate(e,t,i);n&&s.set(e,n)}if(s.has(e)){const i=s.get(e),n=this.evaluateCompiledDomNodeTemplate(i,t);if(null!==n&&(r.unsafe&&e.innerHTML?e.innerHTML=n:e.textContent=n),i.children.length){const e=r=>{for(const s of r){const r=this.evaluateCompiledDomNodeTemplate(s,t);null!==r&&(s.domNode.textContent=r),s.children.length&&e(s.children)}};e(i.children)}}r.applyBindings&&this.applyBindings(e,t)}addSecureEventListener(e,t,r,s,i){this.domNodeEventBindings.has(e)||this.domNodeEventBindings.set(e,new Map);const n=this.domNodeEventBindings.get(e),o=n.get(t);o&&o!==r&&o();const a=()=>{e.removeEventListener(t,r,i),n.delete(t),0===n.size&&this.domNodeEventBindings.delete(e)};return n.set(t,a),e.addEventListener(t,r,s),a}determineRootBinding(){let t=this.parentNode;for(;t;){const r=t instanceof e||t.nodeName.includes("-")&&"#document-fragment"!==t.nodeName,s=null===t.parentNode&&"[object ShadowRoot]"===t.toString();r?(this.rootInstance===this&&(this.parentInstance=t,this.setPropertyValue("isRoot",!1)),this.rootInstance=t):s&&this.setPropertyValue("isRoot",!1),t=t.parentNode}}static hasCode(e){return"string"==typeof e&&e.includes("${")&&e.includes("}")&&/\${[\s\S]+}/.test(e)}static normalizePropertyTypeList(t){if("string"==typeof t&&(t=[t]),Array.isArray(t)){const r=t,s=new Map;for(const t of r)Object.prototype.hasOwnProperty.call(e.propertyTypes,t)&&s.set(t,e.propertyTypes[t]);return s}return(0,m.convertPlainObjectToMap)(t)}attachEventHandler(){if(null===this.self.eventToPropertyMapping)return;const e=this.attachExplicitDefinedOutputEventHandler();this.attachImplicitDefinedOutputEventHandler(!e)}attachExplicitDefinedOutputEventHandler(){if(!this.self.eventToPropertyMapping)return!1;let e=!1;for(const t of Object.keys(this.self.eventToPropertyMapping))Object.prototype.hasOwnProperty.call(this.internalProperties,t)||(e=!0,this.outputEventNames.add(t),this.setInternalPropertyValue(t,(async(...e)=>{const r=await this.reflectEventToProperties(t,e);r&&(e[0]=r),this.forwardEvent(t,e)})));return e}attachImplicitDefinedOutputEventHandler(e=!0){for(const[t,r]of Object.entries(this.self.propertyTypes))Object.prototype.hasOwnProperty.call(this.internalProperties,t)||![g.func,"function"].includes(r)||this.self.renderProperties.includes(t)||(this.outputEventNames.add(t),this.setInternalPropertyValue(t,((...r)=>{e&&this.reflectEventToProperties(t,r),this.forwardEvent(t,r)})))}triggerOutputEvents(){for(const e of this.outputEventNames)this.forwardEvent(e,[this.externalProperties])}forwardEvent(e,t){return e.length>3&&e.startsWith("on")&&(e=(0,m.lowerCase)(e.substring(2))),this.dispatchEvent(new CustomEvent(e,{detail:{parameters:t}}))}applySlots(t,r){for(const s of Array.from(t.querySelectorAll("slot"))){const t=s.getAttribute("name");if(null===t||"default"===t)if(this.slots.default){if(this.self.renderSlots){if(this.self.evaluateSlots)for(const e of this.slots.default)this.evaluateDomNodeTemplate(e,r);(0,m.replace)(s,this.slots.default,e.trimSlots)}}else this.slots.default=(0,m.unwrap)(s).map((e=>this.grabSlotContent(e)));else this.slots[t]?this.self.renderSlots&&(this.self.evaluateSlots&&this.evaluateDomNodeTemplate(this.slots[t],r),(0,m.replace)(s,this.slots[t],e.trimSlots)):this.slots[t]=this.grabSlotContent((0,m.unwrap)(s).filter((e=>"#text"!==e.nodeName.toLowerCase()))[0])}}grabSlotContent(e){const t=g.node.firstElementChild?e:null;if(t&&"textarea"===t.firstElementChild?.nodeName.toLowerCase()&&(!t.firstElementChild.hasAttribute("data-no-template")||"false"===t.firstElementChild.getAttribute("data-no-template"))){const e=t.firstElementChild.value;t.classList.remove("web-component-template");const r=t.cloneNode();return t.classList.add("web-component-template"),r.innerHTML="",r.template=e,r}return this.self.cloneSlots?e.cloneNode(!0):e}grabGivenSlots(){this.slots={};for(const e of Array.from(this.querySelectorAll("[slot]"))){let t=e.parentNode,r=!0;for(;t;){if(t.nodeName.includes("-")){t===this&&(r=!1);break}t=t.parentNode}if(r)continue;const s=e.getAttribute("slot")?.trim();this.slots[null!=s?s:e.nodeName.toLowerCase()]=this.grabSlotContent(e)}this.slots.default?this.slots.default=[].concat(this.slots.default):this.childNodes.length>0?this.slots.default=Array.from(this.childNodes).map((e=>this.grabSlotContent(e))):this.slots.default=[]}isStateProperty(e){return Boolean(this.instance?.current?.state&&(Object.prototype.hasOwnProperty.call(this.instance.current.state,e)||this.instance.current.state.modelState&&Object.prototype.hasOwnProperty.call(this.instance.current.state.modelState,e)))}generateAliasIndex(){if(!this.self._propertyAliasIndex){this.self._propertyAliasIndex={...this.self.propertyAliases};for(const[e,t]of Object.entries(this.self._propertyAliasIndex))Object.prototype.hasOwnProperty.call(this.self._propertyAliasIndex,t)||(this.self._propertyAliasIndex[t]=e)}}reflectExternalProperties(e){this.ignoreAttributeUpdateObservations=!0;for(const[t,r]of Object.entries(e)){if(this.setExternalPropertyValue(t,r),!this.isConnected)continue;const e=(0,m.camelCaseToDelimited)(t);if(this.self._propertiesToReflectAsAttributes?.has(t))switch(this.self._propertiesToReflectAsAttributes.get(t)){case g.boolean:case"boolean":r?""!==this.getAttribute(e)&&this.setAttribute(e,""):this.hasAttribute(e)&&this.removeAttribute(e);break;case g.func:case"function":break;case"json":if(r){const t=JSON.stringify(r);if(t&&this.getAttribute(e)!==t){this.setAttribute(e,t);break}}this.hasAttribute(e)&&this.removeAttribute(e);break;case g.number:case"number":if("number"!=typeof r||isNaN(r))this.hasAttribute(e)&&this.removeAttribute(e);else{const t=String(r);this.getAttribute(e)!==t&&this.setAttribute(e,t)}break;case g.string:case"string":r?this.getAttribute(e)!==r&&this.setAttribute(e,r):this.hasAttribute(e)&&this.removeAttribute(e);break;case g.any:case g.array:case g.arrayOf:case g.element:case g.elementType:case g.instanceOf:case g.node:case g.object:case"object":case g.objectOf:case g.shape:case g.exact:case g.symbol:default:if(r){const t=(0,m.represent)(r);if(t&&this.getAttribute(e)!==t){this.setAttribute(e,t);break}}this.hasAttribute(e)&&this.removeAttribute(e)}}this.ignoreAttributeUpdateObservations=!1}reflectProperties(e){if(this.reflectExternalProperties(e),this.instance?.current?.state&&"object"==typeof this.instance.current.state)for(const e of Object.keys(this.instance.current.state).concat(this.instance.current.state.modelState?Object.keys(this.instance.current.state.modelState):[]))Object.prototype.hasOwnProperty.call(this.internalProperties,e)&&this.setInternalPropertyValue(e,void 0);this.internalProperties.model?.state&&(delete this.internalProperties.model.state,this.setInternalPropertyValue("model",this.internalProperties.model));for(const t of this.self.controllableProperties)Object.prototype.hasOwnProperty.call(e,t)&&this.setInternalPropertyValue(t,e[t])}async reflectEventToProperties(e,t){const r=this.batchUpdates;this.batchUpdates=!1;let s=null,i=!1;if(this.self.eventToPropertyMapping&&Object.prototype.hasOwnProperty.call(this.self.eventToPropertyMapping,e)&&(0,m.isFunction)(this.self.eventToPropertyMapping[e])){const r=this.self.eventToPropertyMapping[e](...t,this),n=r&&"then"in r&&(0,m.isFunction)(r.then)?await r:r;i=!0,Array.isArray(n)?(s=n[0],this.reflectProperties(s),(0,m.extend)(!0,this.internalProperties,n[1])):null===n?i=!1:"object"==typeof n&&(s=n,this.reflectProperties(n))}if(!i&&t.length>0&&(0,m.isObject)(t[0])){let e=t[0];if("persist"in t[0]&&(0,m.isFunction)(t[0].persist)){e={};for(const r of Object.keys(this.self.propertyTypes))for(const s of[r].concat(null!==(n=this.getPropertyAlias(r))&&void 0!==n?n:[])){var n;const r=t[0].currentTarget&&Object.prototype.hasOwnProperty.call(t[0].currentTarget,s)?t[0].currentTarget[s]:this.getPropertyValue(s);r!==this.externalProperties[s]&&(e[s]=r)}}else[null,void 0].includes(e.detail?.value)||(e={...e.detail});s=e,this.reflectProperties(e)}return this.triggerRender("propertyReflected"),this.batchUpdates=r,s}evaluateStringOrNullAndSetAsProperty(e,t){const r=e.startsWith("-"),s=r?e.substring(1):e;let i=(0,m.delimitedToCamelCase)(s);const n=this.getPropertyAlias(i);if(n&&Object.prototype.hasOwnProperty.call(this.self.propertyTypes,n)&&(i=n),Object.prototype.hasOwnProperty.call(this.self.propertyTypes,i)){const s=this.self.propertyTypes[i];if(r){if(t){const r=(0,m.evaluate)(t,{...m.UTILITY_SCOPE},!1,!0,this);r.error?(A.warn("Failed to process pre-evaluation attribute",`"${e}": ${r.error}. Will be`,'set to "undefined".'),this.setInternalPropertyValue(i,void 0)):(this.setInternalPropertyValue(i,r.result),this.setExternalPropertyValue(i,r.result))}}else switch(s){case g.boolean:case"boolean":{const e=![null,"false"].includes(t);this.setInternalPropertyValue(i,e),this.setExternalPropertyValue(i,e);break}case g.func:case"function":{let r,s=null;const n=["data","event","firstArgument","firstParameter","options"];if(t){const i=(0,m.compile)(t,n.concat("parameters","scope",m.UTILITY_SCOPE_NAMES),!0,!0,this);s=i.error,r=i.templateFunction,s&&A.warn("Failed to compile given handler",`"${e}": ${s}.`)}this.setInternalPropertyValue(i,((...o)=>{let a;if(this.outputEventNames.has(i)&&this.reflectEventToProperties(i,o),!s){const s={parameters:o,...m.UTILITY_SCOPE};for(const e of n)s[e]=o[0];try{a=r?.(...n.map((e=>s[e])),o,s,...m.UTILITY_SCOPE_NAMES.map((e=>m.UTILITY_SCOPE[e])))}catch(r){A.warn("Failed to evaluate function",`"${e}" with expression`,`"${t}" and scope`,"variables",`"${n.join('", "')}" set to`,`"${(0,m.represent)(o)}":`,`${r}. Set property`,'to "undefined".')}}return this.self.renderProperties.includes(i)||this.forwardEvent(i,o),a})),s||this.setExternalPropertyValue(i,r);break}case"json":if(t){let r;try{r=JSON.parse(t)}catch(t){A.warn("Error occurred during parsing given json",`attribute "${e}":`,(0,m.represent)(t));break}this.setInternalPropertyValue(i,r),this.setExternalPropertyValue(i,(0,m.copy)(r,!1,1))}else this.setInternalPropertyValue(i,null),this.setExternalPropertyValue(i,null);break;case g.number:case"number":{if(null===t){this.setInternalPropertyValue(i,t),this.setExternalPropertyValue(i,t);break}let e=parseFloat(t);isNaN(e)&&(e=void 0),this.setInternalPropertyValue(i,e),this.setExternalPropertyValue(i,e);break}case g.string:case"string":this.setInternalPropertyValue(i,t),this.setExternalPropertyValue(i,t);break;case g.any:case g.array:case g.arrayOf:case g.element:case g.elementType:case g.instanceOf:case g.node:case g.object:case"object":case g.objectOf:case g.oneOf:case g.oneOfType:case g.shape:case g.exact:case g.symbol:default:if(t){const r=(0,m.evaluate)(t,{},!1,!0,this);if(r.error){A.warn("Error occurred during processing given",`attribute configuration "${e}":`,r.error);break}this.setInternalPropertyValue(i,r.result),this.setExternalPropertyValue(i,(0,m.copy)(r.result,!1,1))}else this.hasAttribute(e)?(this.setInternalPropertyValue(i,!0),this.setExternalPropertyValue(i,!0)):(this.setInternalPropertyValue(i,null),this.setExternalPropertyValue(i,null))}}}async waitForNestedComponentRendering(){this.childComponentInstances&&await Promise.all(this.childComponentInstances.map((e=>e.renderState.pending?e.renderState.promise:Promise.resolve())))}async resolveRenderingPromiseIfSet(e,t){t&&(await this.waitForNestedComponentRendering(),this.renderState.pending=!1,this.renderState.resolve(e),this.prepareNewRenderingPromise())}prepareNewRenderingPromise(){this.renderState.pending||(this.renderState.promise=new Promise((e=>{this.renderState.resolve=t=>{this.renderState.pending=!1,e(t)}})))}triggerRender(e){this.batchUpdates?this.batchedUpdateRunning||(this.batchedUpdateRunning=!0,(0,m.timeout)((()=>{this.batchedUpdateRunning=!1,this.render(e)}))):this.render(e)}applyShadowRootIfNotExisting(){this.self.shadowDOM&&this.hostDomNode===this&&(this.hostDomNode=(!("attachShadow"in this)&&"ShadyDOM"in window?window.ShadyDOM.wrap(this):this).attachShadow((0,m.isObject)(this.self.shadowDOM)?this.self.shadowDOM:{mode:"open"}))}determineRenderScope(e={}){this.scope={...this.parentInstance?.scope||{},...this.scope,...this.internalProperties,parentInstance:this.parentInstance,rootInstance:this.rootInstance,self:this,[(0,m.lowerCase)(this.self._name)||"instance"]:this,...e},this.scope.scope=this.scope}async render(e="unknown",t=!0){if(this.unRender("reRender",e),this.childComponentInstances=[],this.renderState.pending=!0,this.isRoot&&(await this.resolveRenderingPromiseIfSet(e,t),t&&(await Promise.all(this.self.pendingRenderPromises),this.self.pendingRenderPromises=[])),this.self.pendingRenderPromises.push(this.renderState.promise),this.determineRenderScope(),!this.self.doRender||!this.dispatchEvent(new CustomEvent("render",{detail:{reason:e,scope:this.scope}})))return void await this.resolveRenderingPromiseIfSet(e,t);const r=(0,m.evaluate)(`\`${this.self.content}\``,this.scope);if(r.error)return A.warn(`Failed to process template: ${r.error}`),this.renderState.resolve(e),void await Promise.all(this.self.pendingRenderPromises);this.applyShadowRootIfNotExisting();const s=document.createElement("div");s.innerHTML=r.result,this.applySlots(s,{...this.scope,parentInstance:this}),this.hostDomNode.innerHTML=s.innerHTML,await(0,m.timeout)(),this.waitForNestedComponentRendering().then((()=>{this.applyBindings(this.hostDomNode.firstChild,this.scope,this.self.renderSlots)})),await this.resolveRenderingPromiseIfSet(e,t)}unRender(e="unknown",t){this.unregisterDomNodeEventBindings()}},d.applyRootBinding=!0,d.pendingRenderPromises=[],d.content="<slot>Please provide a template to transclude.</slot>",d.determineRootBinding=!0,d.shadowDOM=null,d.observedAttributes=[],d.controllableProperties=[],d.eventToPropertyMapping={},d.propertyAliases={},d.propertyTypes={onClick:g.func},d.propertiesToReflectAsAttributes=[],d.renderProperties=["children"],d.doRender=!1,d.cloneSlots=!1,d.evaluateSlots=!1,d.renderSlots=!0,d.trimSlots=!0,d.renderUnsafe=!1,d._name="BaseWeb",d._propertyAliasIndex=void 0,d._propertiesToReflectAsAttributes=void 0,c=d,h=b()(c.prototype,"isRoot",[p],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return!0}}),c);const T={component:w,register:(e=(0,m.camelCaseToDelimited)(w._name))=>{customElements.define(e,w)}},O=w;return l})()));