(()=>{"use strict";var e={n:t=>{var s=t&&t.__esModule?()=>t.default:()=>t;return e.d(s,{a:s}),s},d:(t,s)=>{for(var a in s)e.o(s,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:s[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.apiFetch;var s=e.n(t);const a=window.wp.data,d={services:[]},r={setItems:(e,t)=>({type:"SET_ITEMS",model:e,items:t}),setItem:(e,t)=>async({dispatch:a})=>{await s()({path:"/wbkdata/v1/save-item/",method:"POST",data:{model:e,data:t}}),a({type:"SET_ITEM",model:e,data:t})},addItem:(e,t)=>async({dispatch:a})=>{await s()({path:"/wbkdata/v1/save-item/",method:"POST",data:{model:e,data:t}}),a({type:"ADD_ITEM",model:e,data:t})},deleteItems:(e,t)=>async({dispatch:a})=>{await s()({path:"/wbkdata/v1/delete-items/",method:"POST",data:{model:e,ids:t}}),a({type:"DELETE_ITEMS",model:e,ids:t})}},i=(0,a.createReduxStore)("webba_booking/data_store",{reducer(e=d,t){switch(t.type){case"SET_ITEMS":if("services"===t.model)return{...e,services:t.items};case"SET_ITEM":if("services"===t.model){const s=e.services.map(e=>e.id===t.data.id?{...e,...t.data}:e);return{...e,services:s}}case"ADD_ITEM":if("services"===t.model){const s=e.services;return s.push(t.data),{...e,services:s}}case"DELETE_ITEMS":if("services"===t.model){const s=t.data.ids,a=e.services.filter(e=>!s.includes(e.id));return{...e,services:a}}}return e},actions:r,selectors:{getItems:(e,t)=>{if("services"===t)return e.services},getBookingsByUser(e){}},resolvers:{getItems:e=>async({dispatch:t})=>{const a=new URLSearchParams({model:e}).toString(),d=await s()({path:`/wbkdata/v1/get-items/?${a}`});t.setItems("services",d)}}});(0,a.register)(i)})();