analogger 1.12.2 → 1.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -1
- package/dist/analogger-browser-demo.min.mjs +3 -0
- package/dist/analogger-browser.min.mjs +2 -2
- package/generated/terminal/node_modules/define-property/index.mjs +37 -0
- package/generated/terminal/node_modules/flatted/cjs/index.mjs +105 -0
- package/generated/terminal/node_modules/is-accessor-descriptor/index.mjs +74 -0
- package/generated/terminal/node_modules/is-data-descriptor/index.mjs +55 -0
- package/generated/terminal/node_modules/is-descriptor/index.mjs +30 -0
- package/generated/terminal/node_modules/is-number/index.mjs +24 -0
- package/generated/terminal/node_modules/kind-of/index.mjs +135 -0
- package/generated/terminal/node_modules/to-ansi/index.mjs +682 -0
- package/generated/terminal/node_modules/window-size/index.mjs +38 -0
- package/generated/terminal/node_modules/window-size/utils.mjs +132 -0
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
## [1.12.
|
|
1
|
+
## [1.12.3](https://github.com/thimpat/analogger/compare/v1.12.2...v1.12.3) (2022-05-04)
|
|
2
2
|
|
|
3
|
+
## [1.12.2](https://github.com/thimpat/analogger/compare/v1.12.1...v1.12.2) (2022-05-04)
|
|
4
|
+
|
|
3
5
|
## [1.12.1](https://github.com/thimpat/analogger/compare/v1.12.0...v1.12.1) (2022-04-22)
|
|
4
6
|
|
|
5
7
|
# [1.12.0](https://github.com/thimpat/analogger/compare/v1.11.0...v1.12.0) (2022-04-22)
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
var Te=Object.defineProperty,xe=Object.defineProperties;var be=Object.getOwnPropertyDescriptors;var ee=Object.getOwnPropertySymbols;var Le=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable;var z=(o,e,t)=>e in o?Te(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,F=(o,e)=>{for(var t in e||(e={}))Le.call(e,t)&&z(o,t,e[t]);if(ee)for(var t of ee(e))Oe.call(e,t)&&z(o,t,e[t]);return o},te=(o,e)=>xe(o,be(e));var m=(o,e,t)=>(z(o,typeof e!="symbol"?e+"":e,t),t),oe=(o,e,t)=>{if(!e.has(o))throw TypeError("Cannot "+t)};var h=(o,e,t)=>(oe(o,e,"read from private field"),t?t.call(o):e.get(o)),D=(o,e,t)=>{if(e.has(o))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(o):e.set(o,t)};var re=(o,e,t)=>(oe(o,e,"access private method"),t);var f={STANDARD:{},TEST:{color:"#B18904",symbol:"\u23F0"},TEST2:{color:"rgb(127, 127, 127)",symbol:"\u23F0"},TEST3:{color:"blue",symbol:"\u23F0"},C1:null,C2:null,C3:null,DEFAULT:{}},A={ALL:"ALL",DEV1:"TOM",DEV2:"TIM",DEV3:"ME",USER:"USER"};var se={Foreground:38,Background:48},S="\x1B[1D",ne="\x1B[0m"+S,P={Bold:"\x1B[1m"+S,Underline:"\x1B[4m"+S,Reversed:"\x1B[7m"+S},we={Bold:"\x1B[1m"+S,Underline:"\x1B[4m"+S,Reversed:"\x1B[7m"+S},K={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function ye(o){return!!K[o]}var ie=(o,e,t)=>o===e&&e===t?o<8?16:o>248?231:Math.round((o-8)/247*24)+232:16+36*Math.round(o/255*5)+6*Math.round(e/255*5)+Math.round(t/255*5),le=o=>{let e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;o=o.replace(e,function(r,s,n,i){return s+s+n+n+i+i});let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);return t?{red:parseInt(t[1],16),blue:parseInt(t[2],16),green:parseInt(t[3],16)}:{}},ae=function({red:o,green:e,blue:t}){let r=o<<16|e<<8|t<<0;return"#"+(16777216+r).toString(16).slice(1)},fe=function(o){let e=o.matchAll(/\d+/g),t=[];for(let r of e){let s=parseInt(r[0]);if(s>255)return null;t.push(s)}return t.length!==3?null:{red:t[0],green:t[1],blue:t[2]}},Re=function(o){let e=fe(o);return e&&ae(e)},Y=function(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e},ce=({hue:o,saturation:e,lightness:t})=>{let r,s,n;if(e===0)r=s=n=t;else{let i=t<.5?t*(1+e):t+e-t*e,l=2*t-i;r=Y(l,i,o+1/3),s=Y(l,i,o),n=Y(l,i,o-1/3)}return{red:Math.round(r*255),blue:Math.round(n*255),green:Math.round(s*255)}},de=o=>{let e=o.toLowerCase();return typeof K[e]!="undefined"?K[e]:""};function v({red:o,blue:e,green:t},r=!0){if(o===void 0||e===void 0||t===void 0)return"";let s=ie(o,e,t);return`\x1B[${r?se.Foreground:se.Background};5;`+s+"m "+S}function M(o,e=!0){let{red:t,green:r,blue:s}=le(o);return v({red:t,green:r,blue:s},e)}function G({hue:o,saturation:e,lightness:t},r){let{red:s,green:n,blue:i}=ce({hue:o,saturation:e,lightness:t});return v({red:s,green:n,blue:i},r)}function Q(o,e=!0){try{let t;return o=o||"",o?((typeof o=="string"||o instanceof String)&&(o=o.trim()),ye(o)?(t=de(o),M(t,e)):typeof o=="object"&&!!o.red&&!!o.blue&&!!o.green?v(o,e):typeof o=="object"&&!!o.hue&&!!o.saturation&&!!o.lightness?G(o,e):o.startsWith("#")?M(o,e):(o=o.toString(),/^[\da-fA-F]+$/.test(o)?M("#"+o,e):"")):""}catch(t){console.error("TO_ANSI_INVALID_ARGUMENT_ERROR",t.message)}}function V(o,{fg:e,bg:t,isUnderline:r=!1,isBold:s=!1,isReversed:n=!1}){let i=!1,l="";return e&&(i=!0,l=l+e),t&&(i=!0,l=l+t),r&&(i=!0,l=l+P.Underline),s&&(i=!0,l=l+P.Bold),n&&(i=!0,l=l+P.Reversed),i?l+o+ne:o}function Ae(o,{fg:e={},bg:t={},isUnderline:r=!1,isBold:s=!1,isReversed:n=!1}){return e&&(e=v(F({},e))),t&&(t=v(F({},t),!1)),V(o,{fg:e,bg:t,isUnderline:r,isBold:s,isReversed:n})}function Se(o,{fg:e="",bg:t="",isUnderline:r=!1,isBold:s=!1,isReversed:n=!1}){return e&&(e=G(F({},e))),t&&(t=G(F({},t),!1)),V(o,{fg:e,bg:t,isUnderline:r,isBold:s,isReversed:n})}function Ce(o,{fg:e="",bg:t="",isUnderline:r=!1,isBold:s=!1,isReversed:n=!1}){return e&&(e=M(e)),t&&(t=M(t,!1)),V(o,{fg:e,bg:t,isUnderline:r,isBold:s,isReversed:n})}function Fe(o,e=null){if(!e)return o;let{fg:t="",bg:r="",isUnderline:s=!1,isBold:n=!1,isReversed:i=!1}=e;return t&&(t=Q(t)),r&&(r=Q(r,!1)),V(o,{fg:t,bg:r,isUnderline:s,isBold:n,isReversed:i})}var _={fromRgb:v,fromHexa:M,fromHsl:G,fromColor:Q,getTextFromRgb:Ae,getTextFromHsl:Se,getTextFromHex:Ce,getTextFromColor:Fe,colorNameToHex:de,hslToRgb:ce,hexToRgb:le,rgbToHex:ae,rgbToAnsi256:ie,rgbStringToRgb:fe,rgbStringToHex:Re,hue2rgb:Y,RESET:ne,FONT_STYLE:P,STYLE:we};var ge={COLOR_TABLE:["#d2466e","#FFA07A","#FF7F50","#FF6347","#FFE4B5","#ADFF2F","#808000","#40E0D0","#1E90FF","#EE82EE","#708090","#DEB887","#FE642E","#210B61","#088A4B","#5E610B","#FA8258","#088A68","#B40431"],SYSTEM:{BROWSER:"BROWSER",NODE:"NODE"}},U=ge.COLOR_TABLE,k=ge.SYSTEM;var{parse:$e,stringify:Ne}=JSON,{keys:je}=Object,De=String,Me="string";var he="object",ve=(o,e)=>e;var ue=(o,e,t)=>{let r=De(e.push(t)-1);return o.set(t,r),r};var pe=(o,e,t)=>{let r=e&&typeof e===he?(O,u)=>O===""||-1<e.indexOf(O)?u:void 0:e||ve,s=new Map,n=[],i=[],l=+ue(s,n,r.call({"":o},"",o)),E=!l;for(;l<n.length;)E=!0,i[l]=Ne(n[l++],C,t);return"["+i.join(",")+"]";function C(O,u){if(E)return E=!E,u;let w=r.call(this,O,u);switch(typeof w){case he:if(w===null)return w;case Me:return s.get(w)||ue(s,n,w)}return w}};var q={};q={};var y={DEFAULT:"DEFAULT",ERROR:"ERROR"},W=`
|
|
2
|
+
`,L,H,I,B,J,me,T=class{constructor(){D(this,J);m(this,"system","");m(this,"logIndex",0);m(this,"logCounter",0);m(this,"contexts",[]);m(this,"targets",{});m(this,"activeTarget",null);m(this,"indexColor",0);m(this,"format","");m(this,"keepLog",!1);m(this,"logHistory",[]);m(this,"$containers",null);m(this,"options",{hideHookMessage:!1});D(this,L,console.log);D(this,H,console.info);D(this,I,console.warn);D(this,B,console.error);m(this,"isBrowser0",null);m(this,"originalFormatFunction");if(T.Instance)return T.Instance;T.Instance=this,this.system=typeof process=="object"?k.NODE:k.BROWSER,this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.setOptions(this.options),this.rawLog=h(this,L),this.rawInfo=h(this,H),this.rawWarn=h(this,I),this.rawError=h(this,B),console.rawLog=h(this,L),console.rawInfo=h(this,H),console.rawWarn=h(this,I),console.rawError=h(this,B),console.table=this.table,console.buildTable=this.buildTable,console.isNode=this.isNode,console.isBrowser=this.isBrowser,console.truncateMessage=this.truncateMessage,console.rawLog=this.rawLog,console.rawInfo=this.rawInfo,console.rawWarn=this.rawWarn,console.rawError=this.rawError,console.isBrowser0=this.system===k.BROWSER,this.ALIGN=T.ALIGN,this.ENVIRONMENT_TYPE=T.ENVIRONMENT_TYPE}keepLogHistory(){this.keepLog=!0}releaseLogHistory(){this.keepLog=!1}resetLogHistory(){this.logHistory=[]}getLogHistory(e=!0,t=W){let r=JSON.parse(JSON.stringify(this.logHistory.slice(0)));return e?r.join(t):r}isNode(){return this.system===k.NODE}isBrowser(){return!this.isNode()}resetLogger(){this.options={},this.options.timeLenMax=10,this.options.contextLenMax=10,this.options.idLenMax=5,this.options.lidLenMax=6,this.options.messageLenMax=void 0,this.options.symbolLenMax=60,this.options.hideHookMessage=void 0,this.options.hidePassingTests=void 0,this.options.hideLog=void 0,this.options.hideError=void 0,this.options.oneConsolePerContext=!0,this.options.logToDom=void 0,this.options.logToFile=void 0,this.options.logToDomlogToFile=void 0,this.options.silent=!1}resetOptions(){this.resetLogger()}setOptions({contextLenMax:e=10,idLenMax:t=5,lidLenMax:r=6,symbolLenMax:s=2,messageLenMax:n=void 0,hideLog:i=void 0,hideError:l=void 0,hideHookMessage:E=void 0,hidePassingTests:C=void 0,logToDom:O=void 0,logToFile:u=void 0,oneConsolePerContext:w=void 0,silent:j=void 0}=null){this.options.contextLenMax=e,this.options.idLenMax=t,this.options.lidLenMax=r,this.options.messageLenMax=n,this.options.symbolLenMax=s,C!==void 0&&(this.options.hidePassingTests=!!C),E!==void 0&&(this.options.hideHookMessage=!!E),i!==void 0&&(this.options.hideLog=!!i),l!==void 0&&(this.options.hideError=!!l),w!==void 0&&(this.options.oneConsolePerContext=!!w),O!==void 0&&(this.options.logToDom=O||"#analogger"),u===!1?this.options.logToFile=!1:u!==void 0&&(this.isBrowser()||(this.options.logToFile=u||"./analogger.log"),h(this,L).call(this,"LogToFile is not supported in this environment. ")),j!==void 0&&(this.options.silent=!!j,this.options.hideLog=this.options.silent)}getOptions(){return this.options}truncateMessage(e="",{fit:t=0,align:r=T.ALIGN.LEFT,ellipsis:s="..."}={}){return e=""+e,t&&e.length>t&&(e=e.substring(0,t-s.length)+s),e=r===T.ALIGN.LEFT?e.padEnd(t," "):e.padStart(t," "),e}buildTable(e,{ellipsis:t="...",ColumnMinChars:r=6,columnMaxChars:s=0,verticalSeparator:n=" \u2502 ",horizontalSeparator:i="\u2500",availableLength:l=0,onCompleteHeaders:E=null,onCompleteSeparators:C=null,onCompleteLines:O=null}={}){let u="";if(Array.isArray(e)||(e=Object.values(Object.values(e))),!e||!e.length)return"";let j=e[0],x=Object.keys(j);e.unshift(x),i=i.repeat(100);let p={};for(let d=1;d<e.length;++d){let c=e[d];for(let b=0;b<x.length;++b){let R=x[b],X=c[R];p[R]=p[R]||0;let N;try{N=JSON.stringify(X).length}catch(He){}N=N||r,p[R]=Math.max(p[R],N,R.length)}}this.isBrowser0||(q=q||{},l||(l=q.width||process.stdout.columns||120-n.length-1-5)),l=l-4;let Z=Object.values(p).reduce((d,c)=>d+c,0);if(l<Z){let d=l/Z;for(let c in p)p[c]=Math.floor(p[c]*d)-1,r&&p[c]<r&&(p[c]=r),s&&p[c]>s&&(p[c]=s),p[c]=p[c]}let g;g="";for(let d=0;d<x.length;++d){let c=x[d],b=p[c];g+=this.truncateMessage(c,{fit:b,ellipsis:t}),g+=n}E&&(g=E(g,x)),u+=this.truncateMessage(g,{fit:l}),u+=W,g="";let Ee=i;for(let d=0;d<x.length;++d){let c=x[d],b=p[c];g+=this.truncateMessage(Ee,{fit:b,ellipsis:""}),g+=n}C&&(g=C(g,x)),u+=this.truncateMessage(g,{fit:l}),u+=W;for(let d=1;d<e.length;++d){g="";let c=e[d];for(let b=0;b<x.length;++b){let R=x[b],X=c[R],N=p[R];g+=this.truncateMessage(X,{fit:N,ellipsis:t}),g+=n}O&&(g=O(g,c)),u+=this.truncateMessage(g,{fit:l}),u+=W}return this.rawLog(u),u}onBuildLog({contextName:e,message:t="",lid:r="",symbol:s=""}={}){let n=new Date,i=("0"+n.getHours()).slice(-2)+":"+("0"+n.getMinutes()).slice(-2)+":"+("0"+n.getSeconds()).slice(-2);return i=this.truncateMessage(i,{fit:this.options.timeLenMax}),e=this.truncateMessage(e,{fit:this.options.contextLenMax,align:T.ALIGN.RIGHT}),r=this.truncateMessage(r,{fit:this.options.lidLenMax}),this.options.messageLenMax!==void 0&&(t=this.truncateMessage(t,{fit:this.options.messageLenMax})),s=this.truncateMessage(s,{fit:this.options.symbolLenMax}),`[${i}] ${e}: (${r}) ${s} ${t}`}onErrorForUserTarget(e,...t){this.errorUserTargetHandler(e,...t)}onError(e,...t){e.target===this.targets.USER&&this.onErrorForUserTarget(e,...t)}onDisplayLog(...e){this.log(...e)}onDisplayError(...e){this.error(...e)}setLogFormat(e){if(typeof e!="function")return console.error("Invalid parameter for setFormat. It is expecting a function or method."),!1;this.format=e.bind(this)}resetLogFormatter(){this.format=this.originalFormatFunction}setErrorHandler(e){this.errorTargetHandler=e.bind(this)}setErrorHandlerForUserTarget(e){this.errorUserTargetHandler=e.bind(this)}isContextValid(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null?e.hasOwnProperty("contextName")&&e.hasOwnProperty("target"):!1}setContext(e,t){this.contexts[e]=t}setDefaultContext(e){this.setContext(y.DEFAULT,e)}generateDefaultContext(){let e=this.contexts[y.DEFAULT]||{};return e=Object.assign({},{name:y.DEFAULT,contextName:y.DEFAULT,target:"ALL",symbol:"\u26A1",color:U[1]},e),e.id=this.logIndex++,e}generateNewContext(){let e=this.generateDefaultContext();return e.color=U[this.indexColor++%(U.length-3)+2],e.symbol="",e}generateErrorContext(){let e=this.generateDefaultContext();return e.name=y.ERROR,e.contextName=y.ERROR,e.color=U[0],e.symbol="\u274C",e.error=!0,e}setContexts(e){let t=Object.keys(e);e[y.DEFAULT]=this.contexts[y.DEFAULT]=this.generateDefaultContext(),e[y.ERROR]=this.contexts[y.ERROR]=this.generateErrorContext(),t.forEach(r=>{let s=e[r]||{};s.contextName=r,s.name=r,this.contexts[r]=re(this,J,me).call(this,s),e[r]=this.contexts[r]})}setTargets(e={}){this.targets=Object.assign({},e,{ALL:"ALL",USER:"USER"})}setActiveTarget(e){this.activeTarget=e}isTargetAllowed(e){return!e||!this.activeTarget||e===this.targets.ALL?!0:this.activeTarget===e}setColumns(e,t,r){let s=0;for(let i in t){if(i==="name")continue;let l=t[i],E=document.createElement("span");E.classList.add("analogger-col",`analogger-col-${i}`,`analogger-col-${s}`),++s,E.textContent=l,e.append(E)}let n=document.createElement("span");n.classList.add("analogger-col","analogger-col-text",`analogger-col-${s}`),n.textContent=r,e.append(n)}writeLogToDom(e,t){this.$containers=this.$containers||document.querySelectorAll(this.options.logToDom);for(let r=0;r<this.$containers.length;++r){let s=this.$containers[r],n=s.querySelector(".analogger-view");n||(n=document.createElement("div"),n.classList.add("analogger-view"),s.append(n));let i=document.createElement("div");i.classList.add("to-esm-line"),i.style.color=e.color,i.setAttribute("data-log-counter",this.logCounter),i.setAttribute("data-log-index",this.logIndex),this.setColumns(i,e,t),n.append(i)}}writeLogToFile(e){try{fs.appendFileSync(this.options.logToFilePath,e+this.EOL)}catch(t){console.rawError("LOG_TO_FILE_FAILURE: ",t.message)}}convertArgumentsToText(e){let t=[],r,s=e.length;for(let n=0;n<s;++n){let i,l=e[n];try{i=JSON.stringify(l)}catch(E){}if(!i)try{i=pe(l)}catch(E){}t.push(i)}return r=t.join("\u2022"),r}processOutput(e={}){try{let t="";if(!this.isTargetAllowed(e.target))return;let r=Array.prototype.slice.call(arguments);r.shift(),t=this.convertArgumentsToText(r);let s="",n="";if(n=this.format(te(F({},e),{message:t})),++this.logCounter,this.isBrowser()?(e.environnment=T.ENVIRONMENT_TYPE.BROWSER,this.options.logToDom&&this.writeLogToDom(e,n),s=`%c${n}`):(e.environnment=T.ENVIRONMENT_TYPE.NODE,s=_.getTextFromColor(n,{fg:e.color}),this.options.logToFile&&this.writeLogToFile(n)),this.keepLog&&this.logHistory.push(s),this.options.hideLog)return;this.isBrowser()?h(this,L).call(this,s,`color: ${e.color}`):h(this,L).call(this,s),this.errorTargetHandler(e,r)}catch(t){console.error("AnaLogger:",t.message)}}isExtendedOptionsPassed(e){return typeof e!="object"?!1:e.hasOwnProperty("context")||e.hasOwnProperty("target")||e.hasOwnProperty("color")||e.hasOwnProperty("lid")}convertToContext(e,t){t=t||this.generateDefaultContext(),e=e||t;let r=e;if(e.context&&typeof e.context=="object"){let s=Object.assign({},e);delete s.context,r=Object.assign({},e.context,s)}return r=Object.assign({},t,r),delete r.context,r}log(e,...t){if(!this.isExtendedOptionsPassed(e)){let s=this.generateDefaultContext();this.processOutput.apply(this,[s,e,...t]);return}let r=this.convertToContext(e);this.processOutput.apply(this,[r,...t])}error(e,...t){if(this.options.hideError)return;if(!this.isExtendedOptionsPassed(e)){let i=this.generateErrorContext();this.processOutput.apply(this,[i,e,...t]);return}let r=this.generateErrorContext(),s=this.convertToContext(e,r),n=Array.prototype.slice.call(arguments,1);this.log(s,...n)}overrideError(){this.options.hideHookMessage||h(this,L).call(this,"AnaLogger: Hook placed on console.error"),console.error=this.onDisplayError.bind(this)}overrideConsole({log:e=!0,info:t=!0,warn:r=!0,error:s=!1}={}){this.options.hideHookMessage||h(this,L).call(this,"AnaLogger: Hook placed on console.log"),e&&(console.log=this.onDisplayLog.bind(this)),t&&(console.info=this.onDisplayLog.bind(this)),r&&(console.warn=this.onDisplayLog.bind(this)),s&&this.overrideError()}removeOverrideError(){console.warn=h(this,B)}removeOverride({log:e=!0,info:t=!0,warn:r=!0,error:s=!1}={}){e&&(console.log=h(this,L)),t&&(console.info=h(this,H)),r&&(console.warn=h(this,I)),s&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){return this.buildTable(...e)}alert(...e){if(this.isNode())return this.log(...e);let t=e.join(" | ");alert(t)}assert(e,t=!0,...r){let s;try{return typeof e=="function"?(s=e(...r),s!==t?(this.error("Asset failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)):e!==t?(this.error("Assert failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)}catch(n){this.error("Unexpected error in assert")}return!1}},$=T;L=new WeakMap,H=new WeakMap,I=new WeakMap,B=new WeakMap,J=new WeakSet,me=function(e){let t=e,r=this.generateNewContext();return t=Object.assign({},r,t),t.color.toLowerCase().indexOf("rgb")>-1?t.color=_.rgbStringToHex(t.color):t.color.indexOf("#")===-1&&(t.color=_.colorNameToHex(t.color)),t},m($,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),m($,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"});var a=new $;a.keepLogHistory();a.setContexts(f);a.setTargets(A);a.setActiveTarget(A.DEV3);a.setOptions({logToDom:".analogger"});a.setOptions({silent:!0});console.log("==========================");a.log(f.C1,"You should not see this C1");a.log(f.C2,"You should not see this C2");a.log(f.C3,"You should not see this C3");a.setOptions({silent:!1,hideError:!1,logToFile:"./logme.log"});a.log(f.C1,"You should see this C100");a.log(f.C2,"You should see this C200");a.log(f.C3,"You should see this C300");console.log("============= From History ===========================");console.log(a.getLogHistory());console.log("============= From History (Closed) ==================");a.assert(!0);a.assert(!1);a.assert(()=>!0,!0);a.assert((o,e)=>o===e,!0,2,2);console.log("-------------------------- console.log is about to be overridden");a.overrideConsole();console.log("Log After override <= Console.log is overridden");console.error("-------------------------- console.error is about to be overridden");a.overrideError();console.error("Hook on Error placed after override <= Console.error is also overridden");console.log("==========================");a.log(f.STANDARD,"Basic Log example 2","+Something 0","+Something 1");a.log({context:f.TEST,lid:1e5},"Test Log example");a.log({context:f.TEST,target:A.DEV3,lid:100001},"Test Log example with active target");a.log({context:f.TEST,target:A.DEV1,lid:100002},"Test Log example with DEV1 target");a.log({context:f.TEST,target:A.DEV2,lid:100003},"Test Log example with DEV2 target");a.log("Test Log example with DEFAULT target");a.log(f.TEST,"Test Log example","+Something 3");a.log(f.C1,"Test Log example C1");a.log(f.C2,"Test Log example C2");a.log(f.C3,"Test Log example C3");console.log(f.C1,"Test Log example C4");console.log(f.C1,"Test Log example C5");console.log(f.C1,"Test Log example C6");console.error({context:f.ERROR,lid:2e5},"Testing Error 1");console.error(f.ERROR,"Testing Error 2");console.error("Testing Error 3");console.error(void 0,"Testing Error 4");console.error({context:f.ERROR,target:A.USER,lid:200010},"Testing Error 4");a.info("Hello from alert",{aaa:1012});a.setActiveTarget(A.USER);a.setErrorHandlerForUserTarget(function(o){a.log("User explicitly see this message"),a.info("User explicitly see this message",o)});console.error({context:f.ERROR,target:A.USER,lid:200020},"Testing Error that triggers a special handler");a.setLogFormat(function({contextName:o,message:e}){return`${o}: ${e}`});console.log(f.C1,"Test Log example C4 with new format");console.log(f.C1,"Test Log example C5 with new format");console.log(f.C1,"Test Log example C6 with new format");a.log("Basic Log example 1");
|
|
3
|
+
/*! (c) 2020 Andrea Giammarchi */
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var
|
|
2
|
-
`,L,H,I,B,J,me,T=class{constructor(){D(this,J);m(this,"system","");m(this,"logIndex",0);m(this,"logCounter",0);m(this,"contexts",[]);m(this,"targets",{});m(this,"activeTarget",null);m(this,"indexColor",0);m(this,"format","");m(this,"keepLog",!1);m(this,"logHistory",[]);m(this,"$containers",null);m(this,"options",{hideHookMessage:!1});D(this,L,console.log);D(this,H,console.info);D(this,I,console.warn);D(this,B,console.error);m(this,"isBrowser0",null);m(this,"originalFormatFunction");if(T.Instance)return T.Instance;T.Instance=this,this.system=typeof process=="object"?k.NODE:k.BROWSER,this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.setOptions(this.options),this.rawLog=h(this,L),this.rawInfo=h(this,H),this.rawWarn=h(this,I),this.rawError=h(this,B),console.rawLog=h(this,L),console.rawInfo=h(this,H),console.rawWarn=h(this,I),console.rawError=h(this,B),console.table=this.table,console.buildTable=this.buildTable,console.isNode=this.isNode,console.isBrowser=this.isBrowser,console.truncateMessage=this.truncateMessage,console.rawLog=this.rawLog,console.rawInfo=this.rawInfo,console.rawWarn=this.rawWarn,console.rawError=this.rawError,console.isBrowser0=this.system===k.BROWSER,this.ALIGN=T.ALIGN,this.ENVIRONMENT_TYPE=T.ENVIRONMENT_TYPE}keepLogHistory(){this.keepLog=!0}releaseLogHistory(){this.keepLog=!1}resetLogHistory(){this.logHistory=[]}getLogHistory(e=!0,t=W){let r=JSON.parse(JSON.stringify(this.logHistory.slice(0)));return e?r.join(t):r}isNode(){return this.system===k.NODE}isBrowser(){return!this.isNode()}resetLogger(){this.options={},this.options.timeLenMax=10,this.options.contextLenMax=10,this.options.idLenMax=5,this.options.lidLenMax=6,this.options.messageLenMax=void 0,this.options.symbolLenMax=60,this.options.hideHookMessage=void 0,this.options.hidePassingTests=void 0,this.options.hideLog=void 0,this.options.hideError=void 0,this.options.oneConsolePerContext=!0,this.options.logToDom=void 0,this.options.logToFile=void 0,this.options.logToDomlogToFile=void 0,this.options.silent=!1}resetOptions(){this.resetLogger()}setOptions({contextLenMax:e=10,idLenMax:t=5,lidLenMax:r=6,symbolLenMax:s=2,messageLenMax:n=void 0,hideLog:i=void 0,hideError:l=void 0,hideHookMessage:E=void 0,hidePassingTests:C=void 0,logToDom:O=void 0,logToFile:u=void 0,oneConsolePerContext:w=void 0,silent:j=void 0}=null){this.options.contextLenMax=e,this.options.idLenMax=t,this.options.lidLenMax=r,this.options.messageLenMax=n,this.options.symbolLenMax=s,C!==void 0&&(this.options.hidePassingTests=!!C),E!==void 0&&(this.options.hideHookMessage=!!E),i!==void 0&&(this.options.hideLog=!!i),l!==void 0&&(this.options.hideError=!!l),w!==void 0&&(this.options.oneConsolePerContext=!!w),O!==void 0&&(this.options.logToDom=O||"#analogger"),u===!1?this.options.logToFile=!1:u!==void 0&&(this.isBrowser()||(this.options.logToFile=u||"./analogger.log"),h(this,L).call(this,"LogToFile is not supported in this environment. ")),j!==void 0&&(this.options.silent=!!j,this.options.hideLog=this.options.silent)}getOptions(){return this.options}truncateMessage(e="",{fit:t=0,align:r=T.ALIGN.LEFT,ellipsis:s="..."}={}){return e=""+e,t&&e.length>t&&(e=e.substring(0,t-s.length)+s),e=r===T.ALIGN.LEFT?e.padEnd(t," "):e.padStart(t," "),e}buildTable(e,{ellipsis:t="...",ColumnMinChars:r=6,columnMaxChars:s=0,verticalSeparator:n=" \u2502 ",horizontalSeparator:i="\u2500",availableLength:l=0,onCompleteHeaders:E=null,onCompleteSeparators:C=null,onCompleteLines:O=null}={}){let u="";if(Array.isArray(e)||(e=Object.values(Object.values(e))),!e||!e.length)return"";let j=e[0],x=Object.keys(j);e.unshift(x),i=i.repeat(100);let p={};for(let d=1;d<e.length;++d){let c=e[d];for(let b=0;b<x.length;++b){let R=x[b],X=c[R];p[R]=p[R]||0;let N;try{N=JSON.stringify(X).length}catch(He){}N=N||r,p[R]=Math.max(p[R],N,R.length)}}this.isBrowser0||(q=q||{},l||(l=q.width||process.stdout.columns||120-n.length-1-5)),l=l-4;let Z=Object.values(p).reduce((d,c)=>d+c,0);if(l<Z){let d=l/Z;for(let c in p)p[c]=Math.floor(p[c]*d)-1,r&&p[c]<r&&(p[c]=r),s&&p[c]>s&&(p[c]=s),p[c]=p[c]}let g;g="";for(let d=0;d<x.length;++d){let c=x[d],b=p[c];g+=this.truncateMessage(c,{fit:b,ellipsis:t}),g+=n}E&&(g=E(g,x)),u+=this.truncateMessage(g,{fit:l}),u+=W,g="";let Ee=i;for(let d=0;d<x.length;++d){let c=x[d],b=p[c];g+=this.truncateMessage(Ee,{fit:b,ellipsis:""}),g+=n}C&&(g=C(g,x)),u+=this.truncateMessage(g,{fit:l}),u+=W;for(let d=1;d<e.length;++d){g="";let c=e[d];for(let b=0;b<x.length;++b){let R=x[b],X=c[R],N=p[R];g+=this.truncateMessage(X,{fit:N,ellipsis:t}),g+=n}O&&(g=O(g,c)),u+=this.truncateMessage(g,{fit:l}),u+=W}return this.rawLog(u),u}onBuildLog({contextName:e,message:t="",lid:r="",symbol:s=""}={}){let n=new Date,i=("0"+n.getHours()).slice(-2)+":"+("0"+n.getMinutes()).slice(-2)+":"+("0"+n.getSeconds()).slice(-2);return i=this.truncateMessage(i,{fit:this.options.timeLenMax}),e=this.truncateMessage(e,{fit:this.options.contextLenMax,align:T.ALIGN.RIGHT}),r=this.truncateMessage(r,{fit:this.options.lidLenMax}),this.options.messageLenMax!==void 0&&(t=this.truncateMessage(t,{fit:this.options.messageLenMax})),s=this.truncateMessage(s,{fit:this.options.symbolLenMax}),`[${i}] ${e}: (${r}) ${s} ${t}`}onErrorForUserTarget(e,...t){this.errorUserTargetHandler(e,...t)}onError(e,...t){e.target===this.targets.USER&&this.onErrorForUserTarget(e,...t)}onDisplayLog(...e){this.log(...e)}onDisplayError(...e){this.error(...e)}setLogFormat(e){if(typeof e!="function")return console.error("Invalid parameter for setFormat. It is expecting a function or method."),!1;this.format=e.bind(this)}resetLogFormatter(){this.format=this.originalFormatFunction}setErrorHandler(e){this.errorTargetHandler=e.bind(this)}setErrorHandlerForUserTarget(e){this.errorUserTargetHandler=e.bind(this)}isContextValid(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null?e.hasOwnProperty("contextName")&&e.hasOwnProperty("target"):!1}setContext(e,t){this.contexts[e]=t}setDefaultContext(e){this.setContext(y.DEFAULT,e)}generateDefaultContext(){let e=this.contexts[y.DEFAULT]||{};return e=Object.assign({},{name:y.DEFAULT,contextName:y.DEFAULT,target:"ALL",symbol:"\u26A1",color:U[1]},e),e.id=this.logIndex++,e}generateNewContext(){let e=this.generateDefaultContext();return e.color=U[this.indexColor++%(U.length-3)+2],e.symbol="",e}generateErrorContext(){let e=this.generateDefaultContext();return e.name=y.ERROR,e.contextName=y.ERROR,e.color=U[0],e.symbol="\u274C",e.error=!0,e}setContexts(e){let t=Object.keys(e);e[y.DEFAULT]=this.contexts[y.DEFAULT]=this.generateDefaultContext(),e[y.ERROR]=this.contexts[y.ERROR]=this.generateErrorContext(),t.forEach(r=>{let s=e[r]||{};s.contextName=r,s.name=r,this.contexts[r]=re(this,J,me).call(this,s),e[r]=this.contexts[r]})}setTargets(e={}){this.targets=Object.assign({},e,{ALL:"ALL",USER:"USER"})}setActiveTarget(e){this.activeTarget=e}isTargetAllowed(e){return!e||!this.activeTarget||e===this.targets.ALL?!0:this.activeTarget===e}setColumns(e,t,r){let s=0;for(let i in t){if(i==="name")continue;let l=t[i],E=document.createElement("span");E.classList.add("analogger-col",`analogger-col-${i}`,`analogger-col-${s}`),++s,E.textContent=l,e.append(E)}let n=document.createElement("span");n.classList.add("analogger-col","analogger-col-text",`analogger-col-${s}`),n.textContent=r,e.append(n)}writeLogToDom(e,t){this.$containers=this.$containers||document.querySelectorAll(this.options.logToDom);for(let r=0;r<this.$containers.length;++r){let s=this.$containers[r],n=s.querySelector(".analogger-view");n||(n=document.createElement("div"),n.classList.add("analogger-view"),s.append(n));let i=document.createElement("div");i.classList.add("to-esm-line"),i.style.color=e.color,i.setAttribute("data-log-counter",this.logCounter),i.setAttribute("data-log-index",this.logIndex),this.setColumns(i,e,t),n.append(i)}}writeLogToFile(e){try{fs.appendFileSync(this.options.logToFilePath,e+this.EOL)}catch(t){console.rawError("LOG_TO_FILE_FAILURE: ",t.message)}}convertArgumentsToText(e){let t=[],r,s=e.length;for(let n=0;n<s;++n){let i,l=e[n];try{i=JSON.stringify(l)}catch(E){}if(!i)try{i=pe(l)}catch(E){}t.push(i)}return r=t.join("\u2022"),r}processOutput(e={}){try{let t="";if(!this.isTargetAllowed(e.target))return;let r=Array.prototype.slice.call(arguments);r.shift(),t=this.convertArgumentsToText(r);let s="",n="";if(n=this.format(te(F({},e),{message:t})),++this.logCounter,this.isBrowser()?(e.environnment=T.ENVIRONMENT_TYPE.BROWSER,this.options.logToDom&&this.writeLogToDom(e,n),s=`%c${n}`):(e.environnment=T.ENVIRONMENT_TYPE.NODE,s=_.getTextFromColor(n,{fg:e.color}),this.options.logToFile&&this.writeLogToFile(n)),this.keepLog&&this.logHistory.push(s),this.options.hideLog)return;this.isBrowser()?h(this,L).call(this,s,`color: ${e.color}`):h(this,L).call(this,s),this.errorTargetHandler(e,r)}catch(t){console.error("AnaLogger:",t.message)}}isExtendedOptionsPassed(e){return typeof e!="object"?!1:e.hasOwnProperty("context")||e.hasOwnProperty("target")||e.hasOwnProperty("color")||e.hasOwnProperty("lid")}convertToContext(e,t){t=t||this.generateDefaultContext(),e=e||t;let r=e;if(e.context&&typeof e.context=="object"){let s=Object.assign({},e);delete s.context,r=Object.assign({},e.context,s)}return r=Object.assign({},t,r),delete r.context,r}log(e,...t){if(!this.isExtendedOptionsPassed(e)){let s=this.generateDefaultContext();this.processOutput.apply(this,[s,e,...t]);return}let r=this.convertToContext(e);this.processOutput.apply(this,[r,...t])}error(e,...t){if(this.options.hideError)return;if(!this.isExtendedOptionsPassed(e)){let i=this.generateErrorContext();this.processOutput.apply(this,[i,e,...t]);return}let r=this.generateErrorContext(),s=this.convertToContext(e,r),n=Array.prototype.slice.call(arguments,1);this.log(s,...n)}overrideError(){this.options.hideHookMessage||h(this,L).call(this,"AnaLogger: Hook placed on console.error"),console.error=this.onDisplayError.bind(this)}overrideConsole({log:e=!0,info:t=!0,warn:r=!0,error:s=!1}={}){this.options.hideHookMessage||h(this,L).call(this,"AnaLogger: Hook placed on console.log"),e&&(console.log=this.onDisplayLog.bind(this)),t&&(console.info=this.onDisplayLog.bind(this)),r&&(console.warn=this.onDisplayLog.bind(this)),s&&this.overrideError()}removeOverrideError(){console.warn=h(this,B)}removeOverride({log:e=!0,info:t=!0,warn:r=!0,error:s=!1}={}){e&&(console.log=h(this,L)),t&&(console.info=h(this,H)),r&&(console.warn=h(this,I)),s&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){return this.buildTable(...e)}alert(...e){if(this.isNode())return this.log(...e);let t=e.join(" | ");alert(t)}assert(e,t=!0,...r){let s;try{return typeof e=="function"?(s=e(...r),s!==t?(this.error("Asset failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)):e!==t?(this.error("Assert failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)}catch(n){this.error("Unexpected error in assert")}return!1}},$=T;L=new WeakMap,H=new WeakMap,I=new WeakMap,B=new WeakMap,J=new WeakSet,me=function(e){let t=e,r=this.generateNewContext();return t=Object.assign({},r,t),t.color.toLowerCase().indexOf("rgb")>-1?t.color=_.rgbStringToHex(t.color):t.color.indexOf("#")===-1&&(t.color=_.colorNameToHex(t.color)),t},m($,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),m($,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"});var a=new $;a.keepLogHistory();a.setContexts(f);a.setTargets(A);a.setActiveTarget(A.DEV3);a.setOptions({logToDom:".analogger"});a.setOptions({silent:!0});console.log("==========================");a.log(f.C1,"You should not see this C1");a.log(f.C2,"You should not see this C2");a.log(f.C3,"You should not see this C3");a.setOptions({silent:!1,hideError:!1,logToFile:"./logme.log"});a.log(f.C1,"You should see this C100");a.log(f.C2,"You should see this C200");a.log(f.C3,"You should see this C300");console.log("============= From History ===========================");console.log(a.getLogHistory());console.log("============= From History (Closed) ==================");a.assert(!0);a.assert(!1);a.assert(()=>!0,!0);a.assert((o,e)=>o===e,!0,2,2);console.log("-------------------------- console.log is about to be overridden");a.overrideConsole();console.log("Log After override <= Console.log is overridden");console.error("-------------------------- console.error is about to be overridden");a.overrideError();console.error("Hook on Error placed after override <= Console.error is also overridden");console.log("==========================");a.log(f.STANDARD,"Basic Log example 2","+Something 0","+Something 1");a.log({context:f.TEST,lid:1e5},"Test Log example");a.log({context:f.TEST,target:A.DEV3,lid:100001},"Test Log example with active target");a.log({context:f.TEST,target:A.DEV1,lid:100002},"Test Log example with DEV1 target");a.log({context:f.TEST,target:A.DEV2,lid:100003},"Test Log example with DEV2 target");a.log("Test Log example with DEFAULT target");a.log(f.TEST,"Test Log example","+Something 3");a.log(f.C1,"Test Log example C1");a.log(f.C2,"Test Log example C2");a.log(f.C3,"Test Log example C3");console.log(f.C1,"Test Log example C4");console.log(f.C1,"Test Log example C5");console.log(f.C1,"Test Log example C6");console.error({context:f.ERROR,lid:2e5},"Testing Error 1");console.error(f.ERROR,"Testing Error 2");console.error("Testing Error 3");console.error(void 0,"Testing Error 4");console.error({context:f.ERROR,target:A.USER,lid:200010},"Testing Error 4");a.info("Hello from alert",{aaa:1012});a.setActiveTarget(A.USER);a.setErrorHandlerForUserTarget(function(o){a.log("User explicitly see this message"),a.info("User explicitly see this message",o)});console.error({context:f.ERROR,target:A.USER,lid:200020},"Testing Error that triggers a special handler");a.setLogFormat(function({contextName:o,message:e}){return`${o}: ${e}`});console.log(f.C1,"Test Log example C4 with new format");console.log(f.C1,"Test Log example C5 with new format");console.log(f.C1,"Test Log example C6 with new format");a.log("Basic Log example 1");
|
|
1
|
+
var pe=Object.defineProperty,me=Object.defineProperties;var be=Object.getOwnPropertyDescriptors;var K=Object.getOwnPropertySymbols;var Ee=Object.prototype.hasOwnProperty,xe=Object.prototype.propertyIsEnumerable;var J=(r,e,t)=>e in r?pe(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,A=(r,e)=>{for(var t in e||(e={}))Ee.call(e,t)&&J(r,t,e[t]);if(K)for(var t of K(e))xe.call(e,t)&&J(r,t,e[t]);return r},Q=(r,e)=>me(r,be(e));var g=(r,e,t)=>(J(r,typeof e!="symbol"?e+"":e,t),t),Z=(r,e,t)=>{if(!e.has(r))throw TypeError("Cannot "+t)};var d=(r,e,t)=>(Z(r,e,"read from private field"),t?t.call(r):e.get(r)),F=(r,e,t)=>{if(e.has(r))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(r):e.set(r,t)};var ee=(r,e,t)=>(Z(r,e,"access private method"),t);var te={Foreground:38,Background:48},y="\x1B[1D",re="\x1B[0m"+y,C={Bold:"\x1B[1m"+y,Underline:"\x1B[4m"+y,Reversed:"\x1B[7m"+y},Te={Bold:"\x1B[1m"+y,Underline:"\x1B[4m"+y,Reversed:"\x1B[7m"+y},V={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function Le(r){return!!V[r]}var se=(r,e,t)=>r===e&&e===t?r<8?16:r>248?231:Math.round((r-8)/247*24)+232:16+36*Math.round(r/255*5)+6*Math.round(e/255*5)+Math.round(t/255*5),ne=r=>{let e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;r=r.replace(e,function(s,n,o,i){return n+n+o+o+i+i});let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(r);return t?{red:parseInt(t[1],16),blue:parseInt(t[2],16),green:parseInt(t[3],16)}:{}},oe=function({red:r,green:e,blue:t}){let s=r<<16|e<<8|t<<0;return"#"+(16777216+s).toString(16).slice(1)},ie=function(r){let e=r.matchAll(/\d+/g),t=[];for(let s of e){let n=parseInt(s[0]);if(n>255)return null;t.push(n)}return t.length!==3?null:{red:t[0],green:t[1],blue:t[2]}},Oe=function(r){let e=ie(r);return e&&oe(e)},P=function(e,t,s){return s<0&&(s+=1),s>1&&(s-=1),s<1/6?e+(t-e)*6*s:s<1/2?t:s<2/3?e+(t-e)*(2/3-s)*6:e},fe=({hue:r,saturation:e,lightness:t})=>{let s,n,o;if(e===0)s=n=o=t;else{let i=t<.5?t*(1+e):t+e-t*e,f=2*t-i;s=P(f,i,r+1/3),n=P(f,i,r),o=P(f,i,r-1/3)}return{red:Math.round(s*255),blue:Math.round(o*255),green:Math.round(n*255)}},ae=r=>{let e=r.toLowerCase();return typeof V[e]!="undefined"?V[e]:""};function S({red:r,blue:e,green:t},s=!0){if(r===void 0||e===void 0||t===void 0)return"";let n=se(r,e,t);return`\x1B[${s?te.Foreground:te.Background};5;`+n+"m "+y}function M(r,e=!0){let{red:t,green:s,blue:n}=ne(r);return S({red:t,green:s,blue:n},e)}function k({hue:r,saturation:e,lightness:t},s){let{red:n,green:o,blue:i}=fe({hue:r,saturation:e,lightness:t});return S({red:n,green:o,blue:i},s)}function z(r,e=!0){try{let t;return r=r||"",r?((typeof r=="string"||r instanceof String)&&(r=r.trim()),Le(r)?(t=ae(r),M(t,e)):typeof r=="object"&&!!r.red&&!!r.blue&&!!r.green?S(r,e):typeof r=="object"&&!!r.hue&&!!r.saturation&&!!r.lightness?k(r,e):r.startsWith("#")?M(r,e):(r=r.toString(),/^[\da-fA-F]+$/.test(r)?M("#"+r,e):"")):""}catch(t){console.error("TO_ANSI_INVALID_ARGUMENT_ERROR",t.message)}}function $(r,{fg:e,bg:t,isUnderline:s=!1,isBold:n=!1,isReversed:o=!1}){let i=!1,f="";return e&&(i=!0,f=f+e),t&&(i=!0,f=f+t),s&&(i=!0,f=f+C.Underline),n&&(i=!0,f=f+C.Bold),o&&(i=!0,f=f+C.Reversed),i?f+r+re:r}function we(r,{fg:e={},bg:t={},isUnderline:s=!1,isBold:n=!1,isReversed:o=!1}){return e&&(e=S(A({},e))),t&&(t=S(A({},t),!1)),$(r,{fg:e,bg:t,isUnderline:s,isBold:n,isReversed:o})}function ye(r,{fg:e="",bg:t="",isUnderline:s=!1,isBold:n=!1,isReversed:o=!1}){return e&&(e=k(A({},e))),t&&(t=k(A({},t),!1)),$(r,{fg:e,bg:t,isUnderline:s,isBold:n,isReversed:o})}function Re(r,{fg:e="",bg:t="",isUnderline:s=!1,isBold:n=!1,isReversed:o=!1}){return e&&(e=M(e)),t&&(t=M(t,!1)),$(r,{fg:e,bg:t,isUnderline:s,isBold:n,isReversed:o})}function Ae(r,e=null){if(!e)return r;let{fg:t="",bg:s="",isUnderline:n=!1,isBold:o=!1,isReversed:i=!1}=e;return t&&(t=z(t)),s&&(s=z(s,!1)),$(r,{fg:t,bg:s,isUnderline:n,isBold:o,isReversed:i})}var W={fromRgb:S,fromHexa:M,fromHsl:k,fromColor:z,getTextFromRgb:we,getTextFromHsl:ye,getTextFromHex:Re,getTextFromColor:Ae,colorNameToHex:ae,hslToRgb:fe,hexToRgb:ne,rgbToHex:oe,rgbToAnsi256:se,rgbStringToRgb:ie,rgbStringToHex:Oe,hue2rgb:P,RESET:re,FONT_STYLE:C,STYLE:Te};var le={COLOR_TABLE:["#d2466e","#FFA07A","#FF7F50","#FF6347","#FFE4B5","#ADFF2F","#808000","#40E0D0","#1E90FF","#EE82EE","#708090","#DEB887","#FE642E","#210B61","#088A4B","#5E610B","#FA8258","#088A68","#B40431"],SYSTEM:{BROWSER:"BROWSER",NODE:"NODE"}},H=le.COLOR_TABLE,B=le.SYSTEM;var{parse:Ue,stringify:Ne}=JSON,{keys:je}=Object,Fe=String,Me="string";var ce="object",Se=(r,e)=>e;var de=(r,e,t)=>{let s=Fe(e.push(t)-1);return r.set(t,s),s};var he=(r,e,t)=>{let s=e&&typeof e===ce?(T,h)=>T===""||-1<e.indexOf(T)?h:void 0:e||Se,n=new Map,o=[],i=[],f=+de(n,o,s.call({"":r},"",r)),p=!f;for(;f<o.length;)p=!0,i[f]=Ne(o[f++],R,t);return"["+i.join(",")+"]";function R(T,h){if(p)return p=!p,h;let L=s.call(this,T,h);switch(typeof L){case ce:if(L===null)return L;case Me:return n.get(L)||de(n,o,L)}return L}};var _={};_={};var O={DEFAULT:"DEFAULT",ERROR:"ERROR"},Y=`
|
|
2
|
+
`,x,D,v,I,G,ue,m=class{constructor(){F(this,G);g(this,"system","");g(this,"logIndex",0);g(this,"logCounter",0);g(this,"contexts",[]);g(this,"targets",{});g(this,"activeTarget",null);g(this,"indexColor",0);g(this,"format","");g(this,"keepLog",!1);g(this,"logHistory",[]);g(this,"$containers",null);g(this,"options",{hideHookMessage:!1});F(this,x,console.log);F(this,D,console.info);F(this,v,console.warn);F(this,I,console.error);g(this,"isBrowser0",null);g(this,"originalFormatFunction");if(m.Instance)return m.Instance;m.Instance=this,this.system=typeof process=="object"?B.NODE:B.BROWSER,this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.setOptions(this.options),this.rawLog=d(this,x),this.rawInfo=d(this,D),this.rawWarn=d(this,v),this.rawError=d(this,I),console.rawLog=d(this,x),console.rawInfo=d(this,D),console.rawWarn=d(this,v),console.rawError=d(this,I),console.table=this.table,console.buildTable=this.buildTable,console.isNode=this.isNode,console.isBrowser=this.isBrowser,console.truncateMessage=this.truncateMessage,console.rawLog=this.rawLog,console.rawInfo=this.rawInfo,console.rawWarn=this.rawWarn,console.rawError=this.rawError,console.isBrowser0=this.system===B.BROWSER,this.ALIGN=m.ALIGN,this.ENVIRONMENT_TYPE=m.ENVIRONMENT_TYPE}keepLogHistory(){this.keepLog=!0}releaseLogHistory(){this.keepLog=!1}resetLogHistory(){this.logHistory=[]}getLogHistory(e=!0,t=Y){let s=JSON.parse(JSON.stringify(this.logHistory.slice(0)));return e?s.join(t):s}isNode(){return this.system===B.NODE}isBrowser(){return!this.isNode()}resetLogger(){this.options={},this.options.timeLenMax=10,this.options.contextLenMax=10,this.options.idLenMax=5,this.options.lidLenMax=6,this.options.messageLenMax=void 0,this.options.symbolLenMax=60,this.options.hideHookMessage=void 0,this.options.hidePassingTests=void 0,this.options.hideLog=void 0,this.options.hideError=void 0,this.options.oneConsolePerContext=!0,this.options.logToDom=void 0,this.options.logToFile=void 0,this.options.logToDomlogToFile=void 0,this.options.silent=!1}resetOptions(){this.resetLogger()}setOptions({contextLenMax:e=10,idLenMax:t=5,lidLenMax:s=6,symbolLenMax:n=2,messageLenMax:o=void 0,hideLog:i=void 0,hideError:f=void 0,hideHookMessage:p=void 0,hidePassingTests:R=void 0,logToDom:T=void 0,logToFile:h=void 0,oneConsolePerContext:L=void 0,silent:j=void 0}=null){this.options.contextLenMax=e,this.options.idLenMax=t,this.options.lidLenMax=s,this.options.messageLenMax=o,this.options.symbolLenMax=n,R!==void 0&&(this.options.hidePassingTests=!!R),p!==void 0&&(this.options.hideHookMessage=!!p),i!==void 0&&(this.options.hideLog=!!i),f!==void 0&&(this.options.hideError=!!f),L!==void 0&&(this.options.oneConsolePerContext=!!L),T!==void 0&&(this.options.logToDom=T||"#analogger"),h===!1?this.options.logToFile=!1:h!==void 0&&(this.isBrowser()||(this.options.logToFile=h||"./analogger.log"),d(this,x).call(this,"LogToFile is not supported in this environment. ")),j!==void 0&&(this.options.silent=!!j,this.options.hideLog=this.options.silent)}getOptions(){return this.options}truncateMessage(e="",{fit:t=0,align:s=m.ALIGN.LEFT,ellipsis:n="..."}={}){return e=""+e,t&&e.length>t&&(e=e.substring(0,t-n.length)+n),e=s===m.ALIGN.LEFT?e.padEnd(t," "):e.padStart(t," "),e}buildTable(e,{ellipsis:t="...",ColumnMinChars:s=6,columnMaxChars:n=0,verticalSeparator:o=" \u2502 ",horizontalSeparator:i="\u2500",availableLength:f=0,onCompleteHeaders:p=null,onCompleteSeparators:R=null,onCompleteLines:T=null}={}){let h="";if(Array.isArray(e)||(e=Object.values(Object.values(e))),!e||!e.length)return"";let j=e[0],b=Object.keys(j);e.unshift(b),i=i.repeat(100);let u={};for(let l=1;l<e.length;++l){let a=e[l];for(let E=0;E<b.length;++E){let w=b[E],q=a[w];u[w]=u[w]||0;let N;try{N=JSON.stringify(q).length}catch(ve){}N=N||s,u[w]=Math.max(u[w],N,w.length)}}this.isBrowser0||(_=_||{},f||(f=_.width||process.stdout.columns||120-o.length-1-5)),f=f-4;let X=Object.values(u).reduce((l,a)=>l+a,0);if(f<X){let l=f/X;for(let a in u)u[a]=Math.floor(u[a]*l)-1,s&&u[a]<s&&(u[a]=s),n&&u[a]>n&&(u[a]=n),u[a]=u[a]}let c;c="";for(let l=0;l<b.length;++l){let a=b[l],E=u[a];c+=this.truncateMessage(a,{fit:E,ellipsis:t}),c+=o}p&&(c=p(c,b)),h+=this.truncateMessage(c,{fit:f}),h+=Y,c="";let ge=i;for(let l=0;l<b.length;++l){let a=b[l],E=u[a];c+=this.truncateMessage(ge,{fit:E,ellipsis:""}),c+=o}R&&(c=R(c,b)),h+=this.truncateMessage(c,{fit:f}),h+=Y;for(let l=1;l<e.length;++l){c="";let a=e[l];for(let E=0;E<b.length;++E){let w=b[E],q=a[w],N=u[w];c+=this.truncateMessage(q,{fit:N,ellipsis:t}),c+=o}T&&(c=T(c,a)),h+=this.truncateMessage(c,{fit:f}),h+=Y}return this.rawLog(h),h}onBuildLog({contextName:e,message:t="",lid:s="",symbol:n=""}={}){let o=new Date,i=("0"+o.getHours()).slice(-2)+":"+("0"+o.getMinutes()).slice(-2)+":"+("0"+o.getSeconds()).slice(-2);return i=this.truncateMessage(i,{fit:this.options.timeLenMax}),e=this.truncateMessage(e,{fit:this.options.contextLenMax,align:m.ALIGN.RIGHT}),s=this.truncateMessage(s,{fit:this.options.lidLenMax}),this.options.messageLenMax!==void 0&&(t=this.truncateMessage(t,{fit:this.options.messageLenMax})),n=this.truncateMessage(n,{fit:this.options.symbolLenMax}),`[${i}] ${e}: (${s}) ${n} ${t}`}onErrorForUserTarget(e,...t){this.errorUserTargetHandler(e,...t)}onError(e,...t){e.target===this.targets.USER&&this.onErrorForUserTarget(e,...t)}onDisplayLog(...e){this.log(...e)}onDisplayError(...e){this.error(...e)}setLogFormat(e){if(typeof e!="function")return console.error("Invalid parameter for setFormat. It is expecting a function or method."),!1;this.format=e.bind(this)}resetLogFormatter(){this.format=this.originalFormatFunction}setErrorHandler(e){this.errorTargetHandler=e.bind(this)}setErrorHandlerForUserTarget(e){this.errorUserTargetHandler=e.bind(this)}isContextValid(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null?e.hasOwnProperty("contextName")&&e.hasOwnProperty("target"):!1}setContext(e,t){this.contexts[e]=t}setDefaultContext(e){this.setContext(O.DEFAULT,e)}generateDefaultContext(){let e=this.contexts[O.DEFAULT]||{};return e=Object.assign({},{name:O.DEFAULT,contextName:O.DEFAULT,target:"ALL",symbol:"\u26A1",color:H[1]},e),e.id=this.logIndex++,e}generateNewContext(){let e=this.generateDefaultContext();return e.color=H[this.indexColor++%(H.length-3)+2],e.symbol="",e}generateErrorContext(){let e=this.generateDefaultContext();return e.name=O.ERROR,e.contextName=O.ERROR,e.color=H[0],e.symbol="\u274C",e.error=!0,e}setContexts(e){let t=Object.keys(e);e[O.DEFAULT]=this.contexts[O.DEFAULT]=this.generateDefaultContext(),e[O.ERROR]=this.contexts[O.ERROR]=this.generateErrorContext(),t.forEach(s=>{let n=e[s]||{};n.contextName=s,n.name=s,this.contexts[s]=ee(this,G,ue).call(this,n),e[s]=this.contexts[s]})}setTargets(e={}){this.targets=Object.assign({},e,{ALL:"ALL",USER:"USER"})}setActiveTarget(e){this.activeTarget=e}isTargetAllowed(e){return!e||!this.activeTarget||e===this.targets.ALL?!0:this.activeTarget===e}setColumns(e,t,s){let n=0;for(let i in t){if(i==="name")continue;let f=t[i],p=document.createElement("span");p.classList.add("analogger-col",`analogger-col-${i}`,`analogger-col-${n}`),++n,p.textContent=f,e.append(p)}let o=document.createElement("span");o.classList.add("analogger-col","analogger-col-text",`analogger-col-${n}`),o.textContent=s,e.append(o)}writeLogToDom(e,t){this.$containers=this.$containers||document.querySelectorAll(this.options.logToDom);for(let s=0;s<this.$containers.length;++s){let n=this.$containers[s],o=n.querySelector(".analogger-view");o||(o=document.createElement("div"),o.classList.add("analogger-view"),n.append(o));let i=document.createElement("div");i.classList.add("to-esm-line"),i.style.color=e.color,i.setAttribute("data-log-counter",this.logCounter),i.setAttribute("data-log-index",this.logIndex),this.setColumns(i,e,t),o.append(i)}}writeLogToFile(e){try{fs.appendFileSync(this.options.logToFilePath,e+this.EOL)}catch(t){console.rawError("LOG_TO_FILE_FAILURE: ",t.message)}}convertArgumentsToText(e){let t=[],s,n=e.length;for(let o=0;o<n;++o){let i,f=e[o];try{i=JSON.stringify(f)}catch(p){}if(!i)try{i=he(f)}catch(p){}t.push(i)}return s=t.join("\u2022"),s}processOutput(e={}){try{let t="";if(!this.isTargetAllowed(e.target))return;let s=Array.prototype.slice.call(arguments);s.shift(),t=this.convertArgumentsToText(s);let n="",o="";if(o=this.format(Q(A({},e),{message:t})),++this.logCounter,this.isBrowser()?(e.environnment=m.ENVIRONMENT_TYPE.BROWSER,this.options.logToDom&&this.writeLogToDom(e,o),n=`%c${o}`):(e.environnment=m.ENVIRONMENT_TYPE.NODE,n=W.getTextFromColor(o,{fg:e.color}),this.options.logToFile&&this.writeLogToFile(o)),this.keepLog&&this.logHistory.push(n),this.options.hideLog)return;this.isBrowser()?d(this,x).call(this,n,`color: ${e.color}`):d(this,x).call(this,n),this.errorTargetHandler(e,s)}catch(t){console.error("AnaLogger:",t.message)}}isExtendedOptionsPassed(e){return typeof e!="object"?!1:e.hasOwnProperty("context")||e.hasOwnProperty("target")||e.hasOwnProperty("color")||e.hasOwnProperty("lid")}convertToContext(e,t){t=t||this.generateDefaultContext(),e=e||t;let s=e;if(e.context&&typeof e.context=="object"){let n=Object.assign({},e);delete n.context,s=Object.assign({},e.context,n)}return s=Object.assign({},t,s),delete s.context,s}log(e,...t){if(!this.isExtendedOptionsPassed(e)){let n=this.generateDefaultContext();this.processOutput.apply(this,[n,e,...t]);return}let s=this.convertToContext(e);this.processOutput.apply(this,[s,...t])}error(e,...t){if(this.options.hideError)return;if(!this.isExtendedOptionsPassed(e)){let i=this.generateErrorContext();this.processOutput.apply(this,[i,e,...t]);return}let s=this.generateErrorContext(),n=this.convertToContext(e,s),o=Array.prototype.slice.call(arguments,1);this.log(n,...o)}overrideError(){this.options.hideHookMessage||d(this,x).call(this,"AnaLogger: Hook placed on console.error"),console.error=this.onDisplayError.bind(this)}overrideConsole({log:e=!0,info:t=!0,warn:s=!0,error:n=!1}={}){this.options.hideHookMessage||d(this,x).call(this,"AnaLogger: Hook placed on console.log"),e&&(console.log=this.onDisplayLog.bind(this)),t&&(console.info=this.onDisplayLog.bind(this)),s&&(console.warn=this.onDisplayLog.bind(this)),n&&this.overrideError()}removeOverrideError(){console.warn=d(this,I)}removeOverride({log:e=!0,info:t=!0,warn:s=!0,error:n=!1}={}){e&&(console.log=d(this,x)),t&&(console.info=d(this,D)),s&&(console.warn=d(this,v)),n&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){return this.buildTable(...e)}alert(...e){if(this.isNode())return this.log(...e);let t=e.join(" | ");alert(t)}assert(e,t=!0,...s){let n;try{return typeof e=="function"?(n=e(...s),n!==t?(this.error("Asset failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)):e!==t?(this.error("Assert failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)}catch(o){this.error("Unexpected error in assert")}return!1}},U=m;x=new WeakMap,D=new WeakMap,v=new WeakMap,I=new WeakMap,G=new WeakSet,ue=function(e){let t=e,s=this.generateNewContext();return t=Object.assign({},s,t),t.color.toLowerCase().indexOf("rgb")>-1?t.color=W.rgbStringToHex(t.color):t.color.indexOf("#")===-1&&(t.color=W.colorNameToHex(t.color)),t},g(U,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),g(U,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"});var De=new U,We=De;export{De as anaLogger,We as default};
|
|
3
3
|
/*! (c) 2020 Andrea Giammarchi */
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT EDIT THIS FILE DIRECTLY.
|
|
3
|
+
* This file is generated following the conversion of
|
|
4
|
+
* [./node_modules/define-property/index.js]{@link ./node_modules/define-property/index.js}
|
|
5
|
+
*
|
|
6
|
+
**/
|
|
7
|
+
import isDescriptor from "../is-descriptor/index.mjs";
|
|
8
|
+
/*!
|
|
9
|
+
* define-property <https://github.com/jonschlinkert/define-property>
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) 2015, 2017, Jon Schlinkert.
|
|
12
|
+
* Released under the MIT License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
'use strict';
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export default function defineProperty(obj, prop, val) {
|
|
19
|
+
if (typeof obj !== 'object' && typeof obj !== 'function') {
|
|
20
|
+
throw new TypeError('expected an object or function.');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (typeof prop !== 'string') {
|
|
24
|
+
throw new TypeError('expected `prop` to be a string.');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (isDescriptor(val) && ('set' in val || 'get' in val)) {
|
|
28
|
+
return Object.defineProperty(obj, prop, val);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return Object.defineProperty(obj, prop, {
|
|
32
|
+
configurable: true,
|
|
33
|
+
enumerable: false,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: val
|
|
36
|
+
});
|
|
37
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT EDIT THIS FILE DIRECTLY.
|
|
3
|
+
* This file is generated following the conversion of
|
|
4
|
+
* [./node_modules/flatted/cjs/index.js]{@link ./node_modules/flatted/cjs/index.js}
|
|
5
|
+
*
|
|
6
|
+
**/
|
|
7
|
+
'use strict';
|
|
8
|
+
/*! (c) 2020 Andrea Giammarchi */
|
|
9
|
+
|
|
10
|
+
const {parse: $parse, stringify: $stringify} = JSON;
|
|
11
|
+
const {keys} = Object;
|
|
12
|
+
|
|
13
|
+
const Primitive = String; // it could be Number
|
|
14
|
+
const primitive = 'string'; // it could be 'number'
|
|
15
|
+
|
|
16
|
+
const ignore = {};
|
|
17
|
+
const object = 'object';
|
|
18
|
+
|
|
19
|
+
const noop = (_, value) => value;
|
|
20
|
+
|
|
21
|
+
const primitives = value => (
|
|
22
|
+
value instanceof Primitive ? Primitive(value) : value
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
const Primitives = (_, value) => (
|
|
26
|
+
typeof value === primitive ? new Primitive(value) : value
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const revive = (input, parsed, output, $) => {
|
|
30
|
+
const lazy = [];
|
|
31
|
+
for (let ke = keys(output), {length} = ke, y = 0; y < length; y++) {
|
|
32
|
+
const k = ke[y];
|
|
33
|
+
const value = output[k];
|
|
34
|
+
if (value instanceof Primitive) {
|
|
35
|
+
const tmp = input[value];
|
|
36
|
+
if (typeof tmp === object && !parsed.has(tmp)) {
|
|
37
|
+
parsed.add(tmp);
|
|
38
|
+
output[k] = ignore;
|
|
39
|
+
lazy.push({k, a: [input, parsed, tmp, $]});
|
|
40
|
+
}
|
|
41
|
+
else
|
|
42
|
+
output[k] = $.call(output, k, tmp);
|
|
43
|
+
}
|
|
44
|
+
else if (output[k] !== ignore)
|
|
45
|
+
output[k] = $.call(output, k, value);
|
|
46
|
+
}
|
|
47
|
+
for (let {length} = lazy, i = 0; i < length; i++) {
|
|
48
|
+
const {k, a} = lazy[i];
|
|
49
|
+
output[k] = $.call(output, k, revive.apply(null, a));
|
|
50
|
+
}
|
|
51
|
+
return output;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const set = (known, input, value) => {
|
|
55
|
+
const index = Primitive(input.push(value) - 1);
|
|
56
|
+
known.set(value, index);
|
|
57
|
+
return index;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const parse = (text, reviver) => {
|
|
61
|
+
const input = $parse(text, Primitives).map(primitives);
|
|
62
|
+
const value = input[0];
|
|
63
|
+
const $ = reviver || noop;
|
|
64
|
+
const tmp = typeof value === object && value ?
|
|
65
|
+
revive(input, new Set, value, $) :
|
|
66
|
+
value;
|
|
67
|
+
return $.call({'': tmp}, '', tmp);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
export const stringify = (value, replacer, space) => {
|
|
72
|
+
const $ = replacer && typeof replacer === object ?
|
|
73
|
+
(k, v) => (k === '' || -1 < replacer.indexOf(k) ? v : void 0) :
|
|
74
|
+
(replacer || noop);
|
|
75
|
+
const known = new Map;
|
|
76
|
+
const input = [];
|
|
77
|
+
const output = [];
|
|
78
|
+
let i = +set(known, input, $.call({'': value}, '', value));
|
|
79
|
+
let firstRun = !i;
|
|
80
|
+
while (i < input.length) {
|
|
81
|
+
firstRun = true;
|
|
82
|
+
output[i] = $stringify(input[i++], replace, space);
|
|
83
|
+
}
|
|
84
|
+
return '[' + output.join(',') + ']';
|
|
85
|
+
function replace(key, value) {
|
|
86
|
+
if (firstRun) {
|
|
87
|
+
firstRun = !firstRun;
|
|
88
|
+
return value;
|
|
89
|
+
}
|
|
90
|
+
const after = $.call(this, key, value);
|
|
91
|
+
switch (typeof after) {
|
|
92
|
+
case object:
|
|
93
|
+
if (after === null) return after;
|
|
94
|
+
case primitive:
|
|
95
|
+
return known.get(after) || set(known, input, after);
|
|
96
|
+
}
|
|
97
|
+
return after;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
export const toJSON = any => $parse(stringify(any));
|
|
103
|
+
|
|
104
|
+
export const fromJSON = any => parse($stringify(any));
|
|
105
|
+
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT EDIT THIS FILE DIRECTLY.
|
|
3
|
+
* This file is generated following the conversion of
|
|
4
|
+
* [./node_modules/is-accessor-descriptor/index.js]{@link ./node_modules/is-accessor-descriptor/index.js}
|
|
5
|
+
*
|
|
6
|
+
**/
|
|
7
|
+
import typeOf from "../kind-of/index.mjs";
|
|
8
|
+
/*!
|
|
9
|
+
* is-accessor-descriptor <https://github.com/jonschlinkert/is-accessor-descriptor>
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) 2015-2017, Jon Schlinkert.
|
|
12
|
+
* Released under the MIT License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
'use strict';
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
var accessor = {
|
|
19
|
+
get: 'function',
|
|
20
|
+
set: 'function',
|
|
21
|
+
configurable: 'boolean',
|
|
22
|
+
enumerable: 'boolean'
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
function isAccessorDescriptor(obj, prop) {
|
|
26
|
+
if (typeof prop === 'string') {
|
|
27
|
+
var val = Object.getOwnPropertyDescriptor(obj, prop);
|
|
28
|
+
return typeof val !== 'undefined';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (typeOf(obj) !== 'object') {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (has(obj, 'value') || has(obj, 'writable')) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!has(obj, 'get') || typeof obj.get !== 'function') {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// tldr: it's valid to have "set" be undefined
|
|
44
|
+
// "set" might be undefined if `Object.getOwnPropertyDescriptor`
|
|
45
|
+
// was used to get the value, and only `get` was defined by the user
|
|
46
|
+
if (has(obj, 'set') && typeof obj[key] !== 'function' && typeof obj[key] !== 'undefined') {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
for (var key in obj) {
|
|
51
|
+
if (!accessor.hasOwnProperty(key)) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (typeOf(obj[key]) === accessor[key]) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (typeof obj[key] !== 'undefined') {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function has(obj, key) {
|
|
67
|
+
return {}.hasOwnProperty.call(obj, key);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Expose `isAccessorDescriptor`
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
export default isAccessorDescriptor;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT EDIT THIS FILE DIRECTLY.
|
|
3
|
+
* This file is generated following the conversion of
|
|
4
|
+
* [./node_modules/is-data-descriptor/index.js]{@link ./node_modules/is-data-descriptor/index.js}
|
|
5
|
+
*
|
|
6
|
+
**/
|
|
7
|
+
import typeOf from "../kind-of/index.mjs";
|
|
8
|
+
/*!
|
|
9
|
+
* is-data-descriptor <https://github.com/jonschlinkert/is-data-descriptor>
|
|
10
|
+
*
|
|
11
|
+
* Copyright (c) 2015-2017, Jon Schlinkert.
|
|
12
|
+
* Released under the MIT License.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
'use strict';
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
export default function isDataDescriptor(obj, prop) {
|
|
19
|
+
// data descriptor properties
|
|
20
|
+
var data = {
|
|
21
|
+
configurable: 'boolean',
|
|
22
|
+
enumerable: 'boolean',
|
|
23
|
+
writable: 'boolean'
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
if (typeOf(obj) !== 'object') {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (typeof prop === 'string') {
|
|
31
|
+
var val = Object.getOwnPropertyDescriptor(obj, prop);
|
|
32
|
+
return typeof val !== 'undefined';
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!('value' in obj) && !('writable' in obj)) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
for (var key in obj) {
|
|
40
|
+
if (key === 'value') continue;
|
|
41
|
+
|
|
42
|
+
if (!data.hasOwnProperty(key)) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (typeOf(obj[key]) === data[key]) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (typeof obj[key] !== 'undefined') {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return true;
|
|
55
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT EDIT THIS FILE DIRECTLY.
|
|
3
|
+
* This file is generated following the conversion of
|
|
4
|
+
* [./node_modules/is-descriptor/index.js]{@link ./node_modules/is-descriptor/index.js}
|
|
5
|
+
*
|
|
6
|
+
**/
|
|
7
|
+
import typeOf from "../kind-of/index.mjs";
|
|
8
|
+
import isAccessor from "../is-accessor-descriptor/index.mjs";
|
|
9
|
+
import isData from "../is-data-descriptor/index.mjs";
|
|
10
|
+
/*!
|
|
11
|
+
* is-descriptor <https://github.com/jonschlinkert/is-descriptor>
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) 2015-2017, Jon Schlinkert.
|
|
14
|
+
* Released under the MIT License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
'use strict';
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
export default function isDescriptor(obj, key) {
|
|
23
|
+
if (typeOf(obj) !== 'object') {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
if ('get' in obj) {
|
|
27
|
+
return isAccessor(obj, key);
|
|
28
|
+
}
|
|
29
|
+
return isData(obj, key);
|
|
30
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DO NOT EDIT THIS FILE DIRECTLY.
|
|
3
|
+
* This file is generated following the conversion of
|
|
4
|
+
* [./node_modules/is-number/index.js]{@link ./node_modules/is-number/index.js}
|
|
5
|
+
*
|
|
6
|
+
**/
|
|
7
|
+
/*!
|
|
8
|
+
* is-number <https://github.com/jonschlinkert/is-number>
|
|
9
|
+
*
|
|
10
|
+
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
11
|
+
* Released under the MIT License.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
'use strict';
|
|
15
|
+
|
|
16
|
+
export default function(num) {
|
|
17
|
+
if (typeof num === 'number') {
|
|
18
|
+
return num - num === 0;
|
|
19
|
+
}
|
|
20
|
+
if (typeof num === 'string' && num.trim() !== '') {
|
|
21
|
+
return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
};
|