var s=(e,t,i)=>new Promise((r,d)=>{var f=o=>{try{n(i.next(o))}catch(c){d(c)}},u=o=>{try{n(i.throw(o))}catch(c){d(c)}},n=o=>o.done?r(o.value):Promise.resolve(o.value).then(f,u);n((i=i.apply(e,t)).next())});import{cb as w,bf as l}from"./bootstrap-Bqxdt4iG.js";const k=w("custom-links",{state:()=>({version:0}),getters:{isMockMode:()=>!1},actions:{getList(e){return s(this,null,function*(){var c,g;let t=l.from("custom_links").select("*",{count:"exact"});t=t.eq("isDelete",!1),e!=null&&e.title&&(t=t.ilike("title",`%${e.title}%`)),t=e!=null&&e.sortBy?t.order(e.sortBy,{ascending:e.sortOrder!=="desc"}):t.order("sortOrder",{ascending:!0}).order("createdAt",{ascending:!1});const i=(c=e==null?void 0:e.page)!=null?c:1,r=(g=e==null?void 0:e.pageSize)!=null?g:10,d=(i-1)*r,f=d+r-1;t=t.range(d,f);const{data:u,error:n,count:o}=yield t;if(n)throw n;return{items:u!=null?u:[],total:o!=null?o:0,page:i,pageSize:r}})},getVisibleForHome(){return s(this,null,function*(){const{data:e,error:t}=yield l.from("custom_links").select("*").eq("isDelete",!1).order("sortOrder",{ascending:!0}).order("createdAt",{ascending:!1});if(t)throw t;return e!=null?e:[]})},getDetail(e){return s(this,null,function*(){const{data:t,error:i}=yield l.from("custom_links").select("*").eq("id",e).eq("isDelete",!1).single();if(i)throw i;return t})},create(e){return s(this,null,function*(){const{data:t,error:i}=yield l.from("custom_links").insert(e).select().single();if(i||!t)throw i!=null?i:new Error("Create failed");return this.version++,t})},update(e,t){return s(this,null,function*(){const{data:i,error:r}=yield l.from("custom_links").update(t).eq("id",e).select().single();if(r)throw r;return this.version++,i})},remove(e){return s(this,null,function*(){const{error:t}=yield l.from("custom_links").update({isDelete:!0}).eq("id",e);if(t)throw t;return this.version++,!0})},invalidate(){this.version++}}});export{k as u};
