import{__spreadArray}from"tslib";import{b as balBrowser}from"./browser-a623d3a0.js";var defaultLoggerConfig={components:[],event:false,lifecycle:false,render:false,custom:false};var getConfig=function(){var r=defaultLoggerConfig;if(balBrowser.hasWindow&&window.BaloiseDesignSystem&&window.BaloiseDesignSystem.config&&window.BaloiseDesignSystem.config.logger){r=window.BaloiseDesignSystem.config.logger}return r};var buildLogger=function(r){var e=function(e,n){var a=[];for(var o=2;o<arguments.length;o++){a[o-2]=arguments[o]}var t=getConfig();if(t.components.includes(r)&&t[e]){console.log.apply(console,__spreadArray([n],a,false))}};return{custom:function(n){var a=[];for(var o=1;o<arguments.length;o++){a[o-1]=arguments[o]}return e.apply(void 0,__spreadArray(["custom"," ➡️ [".concat(r,"] - ").concat(n)],a,false))},lifecycle:function(n){var a=[];for(var o=1;o<arguments.length;o++){a[o-1]=arguments[o]}return e.apply(void 0,__spreadArray(["lifecycle","".concat(n==="connectedCallback"?"🟢":n==="disconnectedCallback"?"🔴":n==="componentDidLoad"?"🏁":" ➡️"," [").concat(r,"] - (").concat(n,")")],a,false))},event:function(n){var a=[];for(var o=1;o<arguments.length;o++){a[o-1]=arguments[o]}return e.apply(void 0,__spreadArray(["event","🔥 [".concat(r,"] - (").concat(n,")")],a,false))},render:function(){var n=[];for(var a=0;a<arguments.length;a++){n[a]=arguments[a]}return e.apply(void 0,__spreadArray(["render","🖌️ [".concat(r,"] - (render)")],n,false))}}};function Logger(r){if(r===void 0){r="unknown"}return function(e,n,a){var o=e.connectedCallback,t=e.disconnectedCallback,i=e.render,f=e.componentDidLoad,s=e.createLogger;var c=buildLogger(r);e.connectedCallback=function(){var r=this;c.lifecycle("connectedCallback",this);var e=Object.keys(this).filter((function(r){return r.startsWith("bal")})).filter((function(e){return typeof r[e]==="object"}));var n=function(n){var o=e[n];var t=a[o];a[o]={emit:function(){var e;var n=[];for(var a=0;a<arguments.length;a++){n[a]=arguments[a]}c.event.apply(c,__spreadArray([o,r],n,false));return(e=t.emit).call.apply(e,__spreadArray([r],n,false))}}};var a=this;for(var t=0;t<e.length;t++){n(t)}s.call(this,c.custom);return o&&o.call(this)};e.disconnectedCallback=function(){c.lifecycle("disconnectedCallback",this);return t&&t.call(this)};e.componentDidLoad=function(){c.lifecycle("componentDidLoad",this);return f&&f.call(this)};e.render=function(){c.render(this);return i.call(this)}}}export{Logger as L,defaultLoggerConfig as d};