import*as t from"@wordpress/interactivity";var e={d:(t,o)=>{for(var r in o)e.o(o,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:o[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e)};const o=(r={getContext:()=>t.getContext,getElement:()=>t.getElement,store:()=>t.store},s={},e.d(s,r),s);var r,s;(0,o.store)("create-block",{actions:{toggle:()=>{const t=(0,o.getContext)();t.isOpen=!t.isOpen,console.log(t)}},callbacks:{loaded:()=>{const t=(0,o.getContext)(),e=t.post_id;let r=JSON.parse(localStorage.getItem("pageHistory"));const s=Array.isArray(r)&&r.some((t=>t.postId===e));t.isfavorited=!!s},init:()=>{const t=(0,o.getContext)(),e=((0,o.getElement)(),t.post_id);let r=JSON.parse(localStorage.getItem("pageHistory"));const s=Array.isArray(r)&&r.some((t=>t.postId===e));t.isfavorited=!!s,t.loaded=!0}},favorite:{toggle:()=>{const t=(0,o.getContext)(),e=window.location.href,r=t.title,s=t.post_id,a=t.eyeCatch,i={url:e,title:r,postId:s,eyeCatch:a,timestamp:(new Date).toISOString()};let l=JSON.parse(localStorage.getItem("pageHistory"));if(l||(l=[]),Array.isArray(l)&&l.some((t=>t.postId===s))){const e=l.filter((t=>t.postId!==s));localStorage.setItem("pageHistory",JSON.stringify(e)),t.isfavorited=!1}else l.push(i),localStorage.setItem("pageHistory",JSON.stringify(l)),t.isfavorited=!0;JSON.parse(localStorage.getItem("pageHistory"))}}});