import{P as e,F as t}from"./vaadin-grid-69a293c4.js";import{t as n}from"./templatize-8b3cf88e.js";class r extends e{static create(e,t){const n=new this;return n.__template=t,n.__component=e,n}static get is(){return"vaadin-template-renderer-templatizer"}constructor(){super(),this.__template=null,this.__component=null,this.__TemplateClass=null,this.__templateInstances=new Set}render(e,t={}){let n=e.__templateInstance;this.__hasTemplateInstance(n)&&this.__isTemplateInstanceAttachedToDOM(n)?this.__updateProperties(n,t):(this.__hasTemplateInstance(n)&&this.__disposeOfTemplateInstance(n),n=this.__createTemplateInstance(t),e.__templateInstance=n,e.innerHTML="",e.appendChild(n.root))}__updateProperties(e,t){e.item===t.item&&e._setPendingProperty("item"),e.__properties=t,e.setProperties(t)}__createTemplateInstance(e){this.__createTemplateClass(e);const t=new this.__TemplateClass(e);return t.__properties=e,this.__templateInstances.add(t),t}__disposeOfTemplateInstance(e){this.__templateInstances.delete(e)}__hasTemplateInstance(e){return this.__templateInstances.has(e)}__isTemplateInstanceAttachedToDOM(e){return 0!==e.children.length&&!!e.children[0].parentElement}__createTemplateClass(e){if(this.__TemplateClass)return;const t=Object.keys(e).reduce(((e,t)=>({...e,[t]:!0})),{});this.__TemplateClass=n(this.__template,this,{instanceProps:t,forwardHostProp(e,t){this.__templateInstances.forEach((n=>{n.forwardHostProp(e,t)}))},notifyInstanceProp(e,t,n){let r;r=t.split(".")[0],r=r[0].toUpperCase()+r.slice(1);const s=`_on${r}PropertyChanged`;this[s]&&this[s](e,t,n)}})}}customElements.define(r.is,r);class s extends r{static get is(){return"vaadin-template-renderer-grid-templatizer"}_onItemPropertyChanged(e,t,n){if("item"===t)return;if(!Array.isArray(this.__grid.items))return;t=`items.${this.__grid.items.indexOf(e.item)}.${t=t.replace(/^item\./,"")}`,this.__grid.notifyPath(t,n)}_onExpandedPropertyChanged(e,t,n){e.__properties.expanded!==n&&(n?this.__grid.expandItem(e.item):this.__grid.collapseItem(e.item))}_onSelectedPropertyChanged(e,t,n){e.__properties.selected!==n&&(n?this.__grid.selectItem(e.item):this.__grid.deselectItem(e.item))}_onDetailsOpenedPropertyChanged(e,t,n){e.__properties.detailsOpened!==n&&(n?this.__grid.openItemDetails(e.item):this.__grid.closeItemDetails(e.item))}get __grid(){return this.__component.__gridElement?this.__component:this.__component._grid}}function i(e,t,n=r){const s=n.create(e,t),i=(e,t,n)=>{s.render(e,n)};return t.__templatizer=s,i.__templatized=!0,i}function a(e,t,n){const r=e[t];if(r&&!r.__templatized){const t=e.localName;throw new Error(`Cannot use both a template and a renderer for <${t} />.`)}e[t]=n}function _(e,t){if(function(e){e.__suppressTemplateWarning||e.hasAttribute("suppress-template-warning")||(console.warn(`WARNING: <template> inside <${e.localName}> is deprecated. Use a renderer function instead (see https://vaad.in/template-renderer)`),e.__suppressTemplateWarning=!0)}(e),e.__gridElement)return void function(e,t){t.matches(".row-details")&&a(e,"rowDetailsRenderer",i(e,t,s))}(e,t);if(e.__gridColumnElement)return void function(e,t){if(t.matches(".header"))return void a(e,"headerRenderer",i(e,t));if(t.matches(".footer"))return void a(e,"footerRenderer",i(e,t));if(t.matches(".editor"))return void a(e,"editModeRenderer",i(e,t,s));a(e,"renderer",i(e,t,s))}(e,t);a(e,"renderer",i(e,t))}function o(e){t.getFlattenedNodes(e).filter((e=>e instanceof HTMLTemplateElement)).forEach((t=>{t.__templatizer||_(e,t)}))}customElements.define(s.is,s),window.Vaadin=window.Vaadin||{},window.Vaadin.templateRendererCallback=e=>{o(e),function(e){e.__templateObserver||(e.__templateObserver=new t(e,(()=>{o(e)})))}(e)};
