(()=>{"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 i in s)e.o(s,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:s[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{STORE_NAME:()=>n,default:()=>g,store:()=>v});var s={};e.r(s),e.d(s,{getError:()=>p,isResolving:()=>u});const i=window.wp.data,o=window.wp.apiFetch;var r=e.n(o);const n="wc-affiliate/notices",c="SET_IS_RESOLVING",a="SET_ERROR",d={setIsResolving:(e,t)=>({type:c,key:e,isResolving:t}),setError:(e,t)=>({type:a,key:e,error:t}),dismissNoticeAction:(e,t)=>({type:"DISMISS_NOTICE",noticeType:e,response:t}),dismissNotice:e=>async({dispatch:t})=>{const s=`dismiss-notice-${e}`;t(d.setIsResolving(s,!0));try{const s=await r()({path:"/wc-affiliate/v1/notices/dismiss-notice",method:"POST",data:{notice_type:e}});return t(d.dismissNoticeAction(e,s)),s}catch(e){const i=e.message||"Failed to dismiss notice";throw t(d.setError(s,i)),e}finally{t(d.setIsResolving(s,!1))}}},l=d,y={isResolving:{},errors:{}},f={dismissNotice:e=>async({dispatch:t})=>{const s=`dismiss-notice-${e}`;t(l.setIsResolving(s,!0));try{return await r()({path:"/wc-affiliate/v1/notices/dismiss-notice",method:"POST",data:{notice_type:e}})}catch(e){const i=e.message||"Failed to dismiss notice";throw t(l.setError(s,i)),e}finally{t(l.setIsResolving(s,!1))}}};function u(e,t){return e.isResolving[t]||!1}function p(e,t){return e.errors[t]||""}const v=(0,i.createReduxStore)(n,{reducer:function(e=y,t){switch(t.type){case c:return{...e,isResolving:{...e.isResolving,[t.key]:t.isResolving}};case a:return{...e,errors:{...e.errors,[t.key]:t.error}};default:return e}},actions:l,selectors:s,resolvers:f});(0,i.register)(v);const g=v;(window.wcAffiliate=window.wcAffiliate||{}).noticesStore=t})();