import{r as i,h as o}from"./p-03169580.js";import{F as l}from"./p-2b31742f.js";import{s as n}from"./p-511f6a28.js";import"./p-59c95c5f.js";const d="";let v=class{constructor(o){i(this,o)}async search(i){var o,d;const v=(o=i===null||i===void 0?void 0:i.target)===null||o===void 0?void 0:o.value;if(!((d=n===null||n===void 0?void 0:n.templates)===null||d===void 0?void 0:d.length)||!(v===null||v===void 0?void 0:v.length)){this.searchResults=null;return}const r=new l((n===null||n===void 0?void 0:n.templates)||[],{keys:["subject","description"],fieldNormWeight:1,sortFn:(i,o)=>{var l,n,d,v;return((l=i===null||i===void 0?void 0:i.item)===null||l===void 0?void 0:l.type)>((n=o===null||o===void 0?void 0:o.item)===null||n===void 0?void 0:n.type)?1:((d=o===null||o===void 0?void 0:o.item)===null||d===void 0?void 0:d.type)>((v=i===null||i===void 0?void 0:i.item)===null||v===void 0?void 0:v.type)?-1:0}});this.searchResults=await r.search(v).map((i=>i===null||i===void 0?void 0:i.item))}async cancel(){this.searchResults=null}render(){const i=this.searchResults||(n===null||n===void 0?void 0:n.templates)||[];return[o("ion-content",{class:"ion-padding"},o("ion-grid",null,o("ion-row",null,o("ion-col",{size:"8"},o("ion-searchbar",null)),o("ion-col",{size:"4"},o("ion-button",{expand:"block",class:"ion-float-right",href:"/templates/new"},"Add Template")))),o("ion-card",null,o("ion-list",{class:"ion-no-padding"},i.map(((l,n)=>{var d;return[((d=i===null||i===void 0?void 0:i[n-1])===null||d===void 0?void 0:d.type)!==(l===null||l===void 0?void 0:l.type)&&o("ion-item-divider",{color:"primary"},l.type),o("ion-item",{href:`/templates/${l===null||l===void 0?void 0:l.id}`,detail:true},o("ion-label",null,o("h2",null,(l===null||l===void 0?void 0:l.subject)||""),o("p",null,(l===null||l===void 0?void 0:l.description)||"No Description on File...")))]}))))),o("app-footer",null)]}};v.style=d;export{v as fireenjin_mx_page_home};
//# sourceMappingURL=p-4b2b2817.entry.js.map