import{j as e,f as o}from"./p-f8363b1b.js";const l=e=>!("isConnected"in e)||e.isConnected,a=(()=>{let e;return(...o)=>{e&&clearTimeout(e),e=setTimeout((()=>{e=0,(e=>{for(let o of e.keys())e.set(o,e.get(o).filter(l))})(...o)}),2e3)}})(),t={env:"local",url:"http://localhost:3333",firebase:{apiKey:"AIzaSyAz5C9TRxQ9bUkTwVaD6Yc-Iisw57UslPM",authDomain:"fireenjin-live.firebaseapp.com",databaseURL:"https://fireenjin-live.firebaseio.com",projectId:"fireenjin-live",storageBucket:"fireenjin-live.appspot.com",messagingSenderId:"756564610596",appId:"1:756564610596:web:4fdf5a6ddfd319a93392b1",measurementId:"G-Q0ZHGFCQFN"},dynamicLinkDomain:"fireenjin.page.link"};function i(e,o){const l=e?e&&e.indexOf(".")>=0?e.split(".").reduce(((e,o)=>e&&e[o]||null),t):e&&void 0!==t[e]?t[e]:null:t;return o&&(!l&&!1!==l&&0!==l||null==l)?o:l}const{state:r,onChange:n}=(()=>{const l=((e,o=((e,o)=>e!==o))=>{let l=new Map(Object.entries(null!=e?e:{}));const a={dispose:[],get:[],set:[],reset:[]},t=()=>{l=new Map(Object.entries(null!=e?e:{})),a.reset.forEach((e=>e()))},i=e=>(a.get.forEach((o=>o(e))),l.get(e)),r=(e,t)=>{const i=l.get(e);o(t,i,e)&&(l.set(e,t),a.set.forEach((o=>o(e,t,i))))},n="undefined"==typeof Proxy?{}:new Proxy(e,{get:(e,o)=>i(o),ownKeys:()=>Array.from(l.keys()),getOwnPropertyDescriptor:()=>({enumerable:!0,configurable:!0}),has:(e,o)=>l.has(o),set:(e,o,l)=>(r(o,l),!0)}),s=(e,o)=>(a[e].push(o),()=>{((e,o)=>{const l=e.indexOf(o);l>=0&&(e[l]=e[e.length-1],e.length--)})(a[e],o)});return{state:n,get:i,set:r,on:s,onChange:(o,l)=>{const a=s("set",((e,a)=>{e===o&&l(a)})),t=s("reset",(()=>l(e[o])));return()=>{a(),t()}},use:(...e)=>{const o=e.reduce(((e,o)=>(o.set&&e.push(s("set",o.set)),o.get&&e.push(s("get",o.get)),o.reset&&e.push(s("reset",o.reset)),o.dispose&&e.push(s("dispose",o.dispose)),e)),[]);return()=>o.forEach((e=>e()))},dispose:()=>{a.dispose.forEach((e=>e())),t()},reset:t,forceUpdate:e=>{const o=l.get(e);a.set.forEach((l=>l(e,o,o)))}}})({config:i(),version:(null===localStorage||void 0===localStorage?void 0:localStorage.getItem)&&localStorage.getItem("fireenjin:version")?localStorage.getItem("fireenjin:version"):"1.1.0",profile:(null===localStorage||void 0===localStorage?void 0:localStorage.getItem)&&localStorage.getItem("fireenjin:profile")?JSON.parse(localStorage.getItem("fireenjin:profile")):{},session:null,templates:(null===localStorage||void 0===localStorage?void 0:localStorage.getItem)&&localStorage.getItem("fireenjin:templates")?JSON.parse(localStorage.getItem("fireenjin:templates")):[],partials:(null===localStorage||void 0===localStorage?void 0:localStorage.getItem)&&localStorage.getItem("fireenjin:partials")?JSON.parse(localStorage.getItem("fireenjin:partials")):[],template:(null===localStorage||void 0===localStorage?void 0:localStorage.getItem)&&localStorage.getItem("fireenjin:template")?JSON.parse(localStorage.getItem("fireenjin:template")):{},isOnline:!1,editorSizes:(null===localStorage||void 0===localStorage?void 0:localStorage.getItem)&&localStorage.getItem("fireenjin:editorSizes")?JSON.parse(localStorage.getItem("fireenjin:editorSizes")):[50,50],isPreviewing:!(!(null===localStorage||void 0===localStorage?void 0:localStorage.getItem)||!localStorage.getItem("fireenjin:isPreviewing"))&&JSON.parse(localStorage.getItem("fireenjin:isPreviewing"))},void 0);return l.use((()=>{if("function"!=typeof e)return{};const l=new Map;return{dispose:()=>l.clear(),get:o=>{const a=e();a&&((e,o,l)=>{const a=e.get(o);a?a.includes(l)||a.push(l):e.set(o,[l])})(l,o,a)},set:e=>{const t=l.get(e);t&&l.set(e,t.filter(o)),a(l)},reset:()=>{l.forEach((e=>e.forEach(o))),a(l)}}})()),l})();n("editorSizes",(e=>{localStorage.setItem("fireenjin:editorSizes",JSON.stringify(e))})),n("isPreviewing",(e=>{localStorage.setItem("fireenjin:isPreviewing",JSON.stringify(e))})),n("profile",(e=>{localStorage.setItem("fireenjin:profile",JSON.stringify(e))})),n("version",(e=>{localStorage.setItem("fireenjin:version",e)})),n("template",(e=>{localStorage.setItem("fireenjin:template",JSON.stringify(e))})),n("templates",(e=>{localStorage.setItem("fireenjin:templates",JSON.stringify(e))})),n("partials",(e=>{localStorage.setItem("fireenjin:partials",JSON.stringify(e))}));export{i as e,r as s}