UNPKG

@cocalc/static

Version:

CoCalc's static frontend Webpack-based build system and framework

1 lines 9.81 kB
(self.webpackChunk_cocalc_static=self.webpackChunk_cocalc_static||[]).push([[1375],{61375:function(e,r,n){"use strict";function t(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},s=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(r[n]=e[n]);return r.default=e,r};Object.defineProperty(r,"__esModule",{value:!0});var a=o(n(51056)),i=n(22800),l=s(n(63505));function c(e,r,n,o){var s,a,i=r?null:function(e){var r={};switch(e.bg&&(r.backgroundColor="rgb(".concat(e.bg,")")),e.fg&&(r.color="rgb(".concat(e.fg,")")),e.decoration){case"bold":r.fontWeight="bold";break;case"dim":r.opacity="0.5";break;case"italic":r.fontStyle="italic";break;case"hidden":r.visibility="hidden";break;case"strikethrough":r.textDecoration="line-through";break;case"underline":r.textDecoration="underline";break;case"blink":r.textDecoration="blink"}return r}(n),c=r?function(e){var r="";return e.bg&&(r+="".concat(e.bg,"-bg ")),e.fg&&(r+="".concat(e.fg,"-fg ")),e.decoration&&(r+="ansi-".concat(e.decoration," ")),""===r?null:r=r.substring(0,r.length-1)}(n):null;if(!e)return l.createElement("span",{style:i,key:o,className:c},n.content);for(var u,f=[],h=/(\s|^)(https?:\/\/(?:www\.|(?!www))[^\s.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/g,g=0;null!==(u=h.exec(n.content));){var p=(a=3,function(e){if(Array.isArray(e))return e}(s=u)||function(e,r){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var t,o,s=[],a=!0,i=!1;try{for(n=n.call(e);!(a=(t=n.next()).done)&&(s.push(t.value),!r||s.length!==r);a=!0);}catch(e){i=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(i)throw o}}return s}}(s,a)||function(e,r){if(e){if("string"==typeof e)return t(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}(s,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),b=p[1],d=p[2],v=u.index+b.length;v>g&&f.push(n.content.substring(g,v));var y=d.startsWith("www.")?"http://".concat(d):d;f.push(l.createElement("a",{key:g,href:y,target:"_blank"},"".concat(d))),g=h.lastIndex}return g<n.content.length&&f.push(n.content.substring(g)),l.createElement("span",{style:i,key:o,className:c},f)}function u(e){var r=e;do{r=(e=r).replace(/[^\n]\x08/gm,"")}while(r.length<e.length);return e}r.default=function(e){var r=e.className,n=e.useClasses,t=e.children,o=e.linkify;return l.createElement("code",{className:r},function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e=i.escapeCarriageReturn(u(e)),a.default.ansiToJson(e,{json:!0,remove_empty:!0,use_classes:r})}(null!=t?t:"",null!=n&&n).map(c.bind(null,null!=o&&o,null!=n&&n)))}},51056:e=>{"use strict";var r,n=(r=function(e,r){for(var n=0;n<r.length;n++){var t=r[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,t.key,t)}},function(e,n,t){return n&&r(e.prototype,n),t&&r(e,t),e});var t=[[{color:"0, 0, 0",class:"ansi-black"},{color:"187, 0, 0",class:"ansi-red"},{color:"0, 187, 0",class:"ansi-green"},{color:"187, 187, 0",class:"ansi-yellow"},{color:"0, 0, 187",class:"ansi-blue"},{color:"187, 0, 187",class:"ansi-magenta"},{color:"0, 187, 187",class:"ansi-cyan"},{color:"255,255,255",class:"ansi-white"}],[{color:"85, 85, 85",class:"ansi-bright-black"},{color:"255, 85, 85",class:"ansi-bright-red"},{color:"0, 255, 0",class:"ansi-bright-green"},{color:"255, 255, 85",class:"ansi-bright-yellow"},{color:"85, 85, 255",class:"ansi-bright-blue"},{color:"255, 85, 255",class:"ansi-bright-magenta"},{color:"85, 255, 255",class:"ansi-bright-cyan"},{color:"255, 255, 255",class:"ansi-bright-white"}]],o=function(){function e(){(function(e,r){if(n=e,!(null!=(t=r)&&"undefined"!=typeof Symbol&&t[Symbol.hasInstance]?t[Symbol.hasInstance](n):n instanceof t))throw new TypeError("Cannot call a class as a function");var n,t})(this,e),this.fg=this.bg=this.fg_truecolor=this.bg_truecolor=null,this.bright=0}return n(e,null,[{key:"escapeForHtml",value:function(r){return(new e).escapeForHtml(r)}},{key:"linkify",value:function(r){return(new e).linkify(r)}},{key:"ansiToHtml",value:function(r,n){return(new e).ansiToHtml(r,n)}},{key:"ansiToJson",value:function(r,n){return(new e).ansiToJson(r,n)}},{key:"ansiToText",value:function(r){return(new e).ansiToText(r)}}]),n(e,[{key:"setupPalette",value:function(){this.PALETTE_COLORS=[];for(var e=0;e<2;++e)for(var r=0;r<8;++r)this.PALETTE_COLORS.push(t[e][r].color);for(var n=[0,95,135,175,215,255],o=function(e,r,t){return n[e]+", "+n[r]+", "+n[t]},s=0;s<6;++s)for(var a=0;a<6;++a)for(var i=0;i<6;++i)this.PALETTE_COLORS.push(o(s,a,i));for(var l=8,c=0;c<24;++c,l+=10)this.PALETTE_COLORS.push(o(l,l,l))}},{key:"escapeForHtml",value:function(e){return e.replace(/[&<>]/gm,(function(e){return"&"==e?"&amp;":"<"==e?"&lt;":">"==e?"&gt;":""}))}},{key:"linkify",value:function(e){return e.replace(/(https?:\/\/[^\s]+)/gm,(function(e){return'<a href="'+e+'">'+e+"</a>"}))}},{key:"ansiToHtml",value:function(e,r){return this.process(e,r,!0)}},{key:"ansiToJson",value:function(e,r){return(r=r||{}).json=!0,r.clearLine=!1,this.process(e,r,!0)}},{key:"ansiToText",value:function(e){return this.process(e,{},!1)}},{key:"process",value:function(e,r,n){var t=this,o=e.split(/\033\[/),s=o.shift();null==r&&(r={}),r.clearLine=/\r/.test(e);var a=o.map((function(e){return t.processChunk(e,r,n)}));if(r&&r.json){var i=this.processChunkJson("");return i.content=s,i.clearLine=r.clearLine,a.unshift(i),r.remove_empty&&(a=a.filter((function(e){return!e.isEmpty()}))),a}return a.unshift(s),a.join("")}},{key:"processChunkJson",value:function(e,r,n){var o=(r=void 0===r?{}:r).use_classes=void 0!==r.use_classes&&r.use_classes,s=r.key=o?"class":"color",a={content:e,fg:null,bg:null,fg_truecolor:null,bg_truecolor:null,clearLine:r.clearLine,decoration:null,was_processed:!1,isEmpty:function(){return!a.content}},i=e.match(/^([!\x3c-\x3f]*)([\d;]*)([\x20-\x2c]*[\x40-\x7e])([\s\S]*)/m);if(!i)return a;a.content=i[4];var l=i[2].split(";");if(""!==i[1]||"m"!==i[3])return a;if(!n)return a;var c=this;for(c.decoration=null;l.length>0;){var u=l.shift(),f=parseInt(u);if(isNaN(f)||0===f)c.fg=c.bg=c.decoration=null;else if(1===f)c.decoration="bold";else if(2===f)c.decoration="dim";else if(3==f)c.decoration="italic";else if(4==f)c.decoration="underline";else if(5==f)c.decoration="blink";else if(7===f)c.decoration="reverse";else if(8===f)c.decoration="hidden";else if(9===f)c.decoration="strikethrough";else if(39==f)c.fg=null;else if(49==f)c.bg=null;else if(f>=30&&f<38)c.fg=t[0][f%10][s];else if(f>=90&&f<98)c.fg=t[1][f%10][s];else if(f>=40&&f<48)c.bg=t[0][f%10][s];else if(f>=100&&f<108)c.bg=t[1][f%10][s];else if(38===f||48===f){var h=38===f;if(l.length>=1){var g=l.shift();if("5"===g&&l.length>=1){var p=parseInt(l.shift());if(p>=0&&p<=255)if(o){var b=p>=16?"ansi-palette-"+p:t[p>7?1:0][p%8].class;h?c.fg=b:c.bg=b}else this.PALETTE_COLORS||c.setupPalette(),h?c.fg=this.PALETTE_COLORS[p]:c.bg=this.PALETTE_COLORS[p]}else if("2"===g&&l.length>=3){var d=parseInt(l.shift()),v=parseInt(l.shift()),y=parseInt(l.shift());if(d>=0&&d<=255&&v>=0&&v<=255&&y>=0&&y<=255){var m=d+", "+v+", "+y;o?h?(c.fg="ansi-truecolor",c.fg_truecolor=m):(c.bg="ansi-truecolor",c.bg_truecolor=m):h?c.fg=m:c.bg=m}}}}}return null===c.fg&&null===c.bg&&null===c.decoration||(a.fg=c.fg,a.bg=c.bg,a.fg_truecolor=c.fg_truecolor,a.bg_truecolor=c.bg_truecolor,a.decoration=c.decoration,a.was_processed=!0),a}},{key:"processChunk",value:function(e,r,n){var t=this;r=r||{};var o=this.processChunkJson(e,r,n);if(r.json)return o;if(o.isEmpty())return"";if(!o.was_processed)return o.content;var s=r.use_classes,a=[],i=[],l={},c=function(e){var r=[],n=void 0;for(n in e)e.hasOwnProperty(n)&&r.push("data-"+n+'="'+t.escapeForHtml(e[n])+'"');return r.length>0?" "+r.join(" "):""};return o.fg&&(s?(i.push(o.fg+"-fg"),null!==o.fg_truecolor&&(l["ansi-truecolor-fg"]=o.fg_truecolor,o.fg_truecolor=null)):a.push("color:rgb("+o.fg+")")),o.bg&&(s?(i.push(o.bg+"-bg"),null!==o.bg_truecolor&&(l["ansi-truecolor-bg"]=o.bg_truecolor,o.bg_truecolor=null)):a.push("background-color:rgb("+o.bg+")")),o.decoration&&(s?i.push("ansi-"+o.decoration):"bold"===o.decoration?a.push("font-weight:bold"):"dim"===o.decoration?a.push("opacity:0.5"):"italic"===o.decoration?a.push("font-style:italic"):"reverse"===o.decoration?a.push("filter:invert(100%)"):"hidden"===o.decoration?a.push("visibility:hidden"):"strikethrough"===o.decoration?a.push("text-decoration:line-through"):a.push("text-decoration:"+o.decoration)),s?'<span class="'+i.join(" ")+'"'+c(l)+">"+o.content+"</span>":'<span style="'+a.join(";")+'"'+c(l)+">"+o.content+"</span>"}}]),e}();e.exports=o},22800:e=>{function r(e){if(!e)return"";if(!/\r/.test(e))return e;for(e=e.replace(/\r+\n/gm,"\n");/\r[^$]/.test(e);){var r=/^(.*)\r+/m.exec(e)[1],n=/\r+(.*)$/m.exec(e)[1];n+=r.slice(n.length,r.length),e=e.replace(/\r+.*$/m,"\r").replace(/^.*\r/m,n)}return e}function n(e){for(var r=0,n=0;n<e.length;n++)e[r].length<=e[n].length&&(r=n);return r}function t(e){if(!/\r/.test(e))return e;for(var r=e.split("\r"),t=[];r.length>0;){var o=n(r);t.push(r[o]),r=r.slice(o+1)}return t.join("\r")}e.exports=r,e.exports.escapeCarriageReturn=r,e.exports.escapeCarriageReturnSafe=function(e){if(!e)return"";if(!/\r/.test(e))return e;if(!/\n/.test(e))return t(e);var n=(e=e.replace(/\r+\n/gm,"\n")).lastIndexOf("\n");return r(e.slice(0,n))+"\n"+t(e.slice(n+1))}}}]);