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