import n from"@babel/runtime/helpers/slicedToArray";import{useState as o,useEffect as t}from"react";import{getAppIdentifier as e}from"../utils/devcenter.js";var i={},r={},p=function(p){var u,l=p.CLIAppComponent,a=p.CLIAppSettings,c=p.app,s=p.version,d=c.app.app_key,f=process.env.REACT_APP_DEBUG_DC_APP_KEY===d,m=f?"http://127.0.0.1:3000/app.js":null==c||null===(u=c.package)||void 0===u?void 0:u.url,v=e({appKey:d,version:s,isLocalDebugMode:f}),A=o(!1),C=n(A,2),g=C[0],_=C[1],b=i[v],h=l||(null==b?void 0:b.component)||null,E=a||(null==b?void 0:b.settings)||null,w=function(){_(!1),(r[v]||[]).forEach((function(n){return n()})),delete r[v]};return t((function(){v in r&&(_(!0),r[v].push((function(){_(!1)})))}),[]),t((function(){if(!(!m||!v||h&&E||v in r)){if(!l&&!b||null!=b&&b.component){if(_(!0),!b||!b.script){var n=document.createElement("script");n.src=m,n.onload=function(){i[v]=window[v]&&window[v].default,w()},i[v]={component:null,script:n},setTimeout((function(){return document.body.appendChild(n)}))}var o=i[v].script;if(o.onload){var t=o.onload;o.onload=function(){t(),w()}}o.onabort=w,o.error=w}r[v]=[function(){return _(!1)}]}}),[m]),{isLoading:g,AppComponent:h,AppSettings:E}};export{p as default};
//# sourceMappingURL=useDevCenterApp.js.map
