@cocalc/static
Version:
CoCalc's static frontend Webpack-based build system and framework
1 lines • 13.3 kB
JavaScript
;(self.webpackChunk_cocalc_static=self.webpackChunk_cocalc_static||[]).push([[3125],{63826:(e,t,n)=>{n.d(t,{g:()=>d});var r=n(63505),o=n(55779);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(e,t,n,r,o,i,a){try{var c=e[i](a),l=c.value}catch(e){return void n(e)}c.done?t(l):Promise.resolve(l).then(r,o)}function c(){return c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},c.apply(this,arguments)}var l=r.useEffect,f=r.useRef,u=r.useState;function d(e){return function(t){var n,d,s=(n=u(!1),d=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i=[],a=!0,c=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(e){c=!0,o=e}finally{try{a||null==n.return||n.return()}finally{if(c)throw o}}return i}}(n,d)||function(e,t){if(e){if("string"==typeof e)return i(e,t);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)?i(e,t):void 0}}(n,d)||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.")}()),m=s[0],b=s[1],_=f(null),h=(0,o.XM)();return l((function(){var t;(t=function(){var t;return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((o=(o=a.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(this,(function(n){switch(n.label){case 0:return[4,e()];case 1:return t=n.sent(),h.current&&(_.current=t,b(!0)),[2]}}))},function(){var e=this,n=arguments;return new Promise((function(r,o){var i=t.apply(e,n);function c(e){a(i,r,o,c,l,"next",e)}function l(e){a(i,r,o,c,l,"throw",e)}c(void 0)}))})()}),[]),m&&null!=_.current?r.createElement(_.current,c({},t)):r.createElement("div",null,"Loading...")}}},11359:(e,t,n)=>{n.d(t,{C:()=>m,P:()=>s});var r=n(33638),o=n(6279),i=n(67941),a=n(24620),c=n(94873),l=n(51853),f=n(16609),u=n(8407);function d(e){r.commands.save(e)}function s(e){var t,n,r=(0,a.filename_extension_notilde)(e).toLowerCase();return r||(r="noext-".concat((0,a.path_split)(e).tail).toLowerCase()),null!==(n=null===(t=o.file_associations[r])||void 0===t?void 0:t.opts)&&void 0!==n?n:{}}function m(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0,m=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",_=t.get("theme");null==l.EDITOR_COLOR_SCHEMES[_]&&(console.warn("codemirror theme '".concat(_,"' not known -- fallback to 'Default'")),_="default");var h=(0,a.defaults)(s(e),{spellcheck:!1,undoDepth:0,mode:"txt",show_trailing_whitespace:t.get("show_trailing_whitespace",!0),allow_javascript_eval:!0,line_numbers:t.get("line_numbers",!0),first_line_number:t.get("first_line_number",1),indent_unit:t.get("tab_size"),tab_size:t.get("tab_size"),smart_indent:t.get("smart_indent",!0),electric_chars:t.get("electric_chars",!0),match_brackets:t.get("match_brackets",!0),code_folding:t.get("code_folding",!0),auto_close_brackets:t.get("auto_close_brackets",!1),match_xml_tags:t.get("match_xml_tags",!0),auto_close_xml_tags:t.get("auto_close_xml_tags",!0),auto_close_latex:t.get("auto_close_latex",!0),line_wrapping:t.get("line_wrapping",!0),spaces_instead_of_tabs:t.get("spaces_instead_of_tabs",!0),style_active_line:t.get("style_active_line",!0),bindings:t.get("bindings"),theme:_});if(null==h.mode)throw Error("mode must be specified");var g={"Ctrl-'":"indentAuto","Cmd-'":"indentAuto","Cmd-/":"toggleComment","Ctrl-/":"toggleComment","Ctrl-Space":"autocomplete","Alt-Space":"autocomplete",Tab:function(e){b(e,h.spaces_instead_of_tabs)},"Shift-Tab":function(e){e.unindent_selection()},"Shift-Cmd-L":function(e){e.align_assignments()},"Shift-Ctrl-L":function(e){e.align_assignments()},"Alt-Q":function(e){e.fill_paragraph()},"Cmd-Q":function(e){e.fill_paragraph()}};if(i.IS_TOUCH&&(0,f.v)(g,r,m,h),null!=o){var p=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e?void 0!==o.force_build&&o.force_build(m):void 0!==o.build?o.build(m):(0,c.G$)().get("show_exec_warning")&&o.set_error("You can evaluate code in a file with the extension 'sagews' or 'ipynb'. Please create a Sage Worksheet or Jupyter notebook instead.")},C={"Cmd-S":function(e){d(e)},"Alt-S":function(e){d(e)},"Ctrl-S":function(e){d(e)},"Cmd-P":function(){r.print()},"Shift-Ctrl-.":function(){o.increase_font_size(m)},"Shift-Ctrl-,":function(){o.decrease_font_size(m)},"Shift-Cmd-.":function(){o.increase_font_size(m)},"Shift-Cmd-,":function(){o.decrease_font_size(m)},"Ctrl-L":function(e){e.execCommand("jumpToLine")},"Cmd-L":function(e){e.execCommand("jumpToLine")},"Cmd-F":function(e){e.execCommand("find")},"Ctrl-F":function(e){e.execCommand("find")},"Cmd-G":function(e){e.execCommand("findNext")},"Ctrl-G":function(e){e.execCommand("findNext")},"Shift-Cmd-G":function(e){e.execCommand("findPrev")},"Shift-Ctrl-G":function(e){e.execCommand("findPrev")},"Shift-Cmd-F":function(){r.format(m)},"Shift-Ctrl-F":function(){r.format(m)},"Shift-Enter":function(){p()},"Shift-Alt-Enter":function(){p(!0)},"Shift-Alt-T":function(){p(!0)},"Shift-Cmd-T":function(){p(!0)},"Cmd-T":function(){p()},"Alt-T":function(){p()}};for(var v in C){var x=C[v];g[v]=x}if("emacs"!==h.bindings&&(g["Ctrl-P"]=function(){return r.print(m)}),null!=o.sync&&(g["Alt-Enter"]=function(){return o.sync(m,r)},g["Cmd-Enter"]=function(){return o.sync(m,r)}),!h.read_only&&"emacs"!==h.bindings){var y={bold:"Cmd-B Ctrl-B",italic:"Cmd-I Ctrl-I",underline:"Cmd-U Ctrl-U",comment:"Shift-Ctrl-3",strikethrough:"Shift-Cmd-X Shift-Ctrl-X",subscript:"Cmd-= Ctrl-=",superscript:"Shift-Cmd-= Shift-Ctrl-="},S=function(e,t){return g[e]=function(e){e.edit_selection({cmd:t}),r.set_syncstring_to_codemirror()}};for(var w in y){var A=y[w],k=!0,L=!1,T=void 0;try{for(var O,P=A.split(" ")[Symbol.iterator]();!(k=(O=P.next()).done);k=!0){var z=O.value;S(z,w)}}catch(e){L=!0,T=e}finally{try{k||null==P.return||P.return()}finally{if(L)throw T}}}}}h.match_xml_tags&&(g["Ctrl-J"]="toMatchingTag"),i.isMobile.Android()&&(h.style_active_line=!1);var E=(0,a.filename_extension_notilde)(e).toLowerCase(),M=["js","jsx","ts","tsx","json","md","rmd","r","html","c","c++","cc","cpp","h","bib"];M.includes(E)&&(h.tab_size=h.indent_unit=2),"go"===E&&(h.spaces_instead_of_tabs=!1,h.tab_size=h.indent_unit=4);var j={spellcheck:h.spellcheck,firstLineNumber:h.first_line_number,autofocus:!1,mode:{name:h.mode,globalVars:!0},lineNumbers:h.line_numbers,showTrailingSpace:h.show_trailing_whitespace,indentUnit:(0,u.k)(h.indent_unit),tabSize:(0,u.k)(h.tab_size),smartIndent:h.smart_indent,electricChars:h.electric_chars,undoDepth:h.undo_depth,matchBrackets:h.match_brackets,autoCloseBrackets:h.auto_close_brackets&&!["hs","lhs"].includes(E),autoCloseTags:-1!==h.mode.indexOf("xml")||-1!==h.mode.indexOf("html")||-1!==h.mode.indexOf("cml")||-1!==h.mode.indexOf("kml")?h.auto_close_xml_tags:void 0,autoCloseLatex:-1!==h.mode.indexOf("tex")?h.auto_close_latex:void 0,leanSymbols:-1!==h.mode.indexOf("lean"),lineWrapping:h.line_wrapping,readOnly:h.read_only,styleActiveLine:h.style_active_line,indentWithTabs:!h.spaces_instead_of_tabs,showCursorWhenSelecting:!0,extraKeys:g,cursorScrollMargin:3,viewportMargin:10};if(h.match_xml_tags&&(j.matchTags={bothTags:!0}),h.code_folding?(g["Ctrl-Q"]=function(e){return e.foldCodeSelectionAware()},j.foldGutter=!0,j.gutters=["CodeMirror-linenumbers","CodeMirror-foldgutter"]):j.gutters=["CodeMirror-linenumbers"],n){var D=!0,I=!1,U=void 0;try{for(var G,N=n[Symbol.iterator]();!(D=(G=N.next()).done);D=!0){var F=G.value;j.gutters.push(F)}}catch(e){I=!0,U=e}finally{try{D||null==N.return||N.return()}finally{if(I)throw U}}}return null!=h.bindings&&"standard"!==h.bindings&&(j.keyMap=h.bindings),null!=h.theme?j.theme=h.theme:j.theme="default",j.spellcheck&&(j.inputStyle="contenteditable"),j}function b(e,t){e.somethingSelected()?r.commands.defaultTab(e):t?e.tab_as_space():r.commands.defaultTab(e)}},16609:(e,t,n)=>{n.d(t,{v:()=>i});var r=n(33638),o=n(24620);function i(e,t,n,i){(0,o.merge)(e,{"Shift-Alt-L":function(e){return e.align_assignments()},"Alt-Z":function(e){return e.undo()},"Shift-Alt-Z":function(e){return e.redo()},"Alt-A":function(e){return e.execCommand("selectAll")},"Shift-Alt-A":function(e){return e.execCommand("selectAll")},"Shift-Alt-K":function(e){return e.execCommand("killLine")},"Alt-D":function(e){return e.execCommand("selectNextOccurrence")},"Alt-F":function(e){return e.execCommand("find")},"Shift-Alt-F":function(e){return e.execCommand("replace")},"Shift-Alt-R":function(e){return e.execCommand("replaceAll")},"Shift-Alt-D":function(e){return e.execCommand("duplicateLine")},"Alt-G":function(e){return e.execCommand("findNext")},"Shift-Alt-G":function(e){return e.execCommand("findPrev")},"Cmd-Up":function(e){return e.execCommand("goPageUp")},"Cmd-Down":function(e){return e.execCommand("goPageDown")},"Alt-K":function(e){return e.execCommand("goPageUp")},"Alt-J":function(e){return e.execCommand("goPageDown")},"Alt-P":function(e){return e.execCommand("goLineUp")},"Alt-N":function(e){return e.execCommand("goLineDown")},"Alt-L":function(e){return e.execCommand("jumpToLine")},"Alt-C":function(){return t.copy(n)},"Alt-X":function(){return t.cut(n)},"Alt-V":function(){return t.paste(n)},"Alt-S":function(){return t.save(!0)}}),"vim"===(null==i?void 0:i.bindings)&&(e["Alt-C"]=function(e){r.Vim.exitInsertMode(e)},e["Alt-F"]=function(e){e.execCommand("goPageDown")},e["Alt-B"]=function(e){e.execCommand("goPageUp")})}},8407:(e,t,n)=>{function r(e){return"number"!=typeof e||isNaN(e)||e<=1?4:e}function o(e){var t=e.getWrapperElement();t.classList.add("smc-vfill"),t.setAttribute("style",t.getAttribute("style")+"; height:100%; font-family:monospace !important;")}n.d(t,{L:()=>o,k:()=>r})},61655:(e,t,n)=>{n.d(t,{iw:()=>o,vn:()=>r}),n(24620);var r={"solarized-dark":{comment:"Solarized dark",colors:["#eee8d5","#dc322f","#859900","#b58900","#268bd2","#d33682","#2aa198","#073642","#fdf6e3","#cb4b16","#93a1a1","#839496","#657b83","#6c71c4","#586e75","#002b36","#eee8d5","#002b36"]},"solarized-light":{comment:"Solarized light",colors:["#073642","#dc322f","#859900","#b58900","#268bd2","#d33682","#2aa198","#eee8d5","#002b36","#cb4b16","#586e75","#657b83","#839496","#6c71c4","#93a1a1","#fdf6e3","#073642","#fdf6e3"]},"low-contrast":{comment:"Low contrast dark",colors:["#222222","#9e5641","#6c7e55","#caaf2b","#7fb8d8","#956d9d","#4c8ea1","#808080","#454545","#cc896d","#c4df90","#ffe080","#b8ddea","#c18fcb","#6bc1d0","#cdcdcd","#cdcdcd","#343434"]},"raven-dark":{comment:"Raven dark",colors:["#3f3e3b","#b36b65","#4f8c61","#8d7e45","#6181b8","#a46d9d","#0e8e9a","#b6b7bb","#7f7f83","#efa29b","#86c596","#c7b679","#9ab9f3","#dfa4d7","#5ec7d4","#feffff","#a6a7aa","#32312e"]},default:{comment:"Default black on white",colors:["#2e3436","#cc0000","#4e9a06","#c4a000","#3465a4","#75507b","#06989a","#d3d7cf","#555753","#ef2929","#8ae234","#fce94f","#729fcf","#ad7fa8","#34e2e2","#eeeeec","#000000","#ffffff"]},mono:{comment:"Monochrome dark",colors:["#000000","#434343","#6b6b6b","#969696","#4a4a4a","#707070","#a9a9a9","#ffffff","#222222","#434343","#a5a5a5","#e5e5e5","#4d4d4d","#747474","#c4c4c4","#dedede","#b0b0b0","#282828"]},tango:{comment:"Tango light",colors:["#2e3436","#cc0000","#4e9a06","#c4a000","#3465a4","#75507b","#06989a","#d3d7cf","#555753","#ef2929","#8ae234","#fce94f","#729fcf","#ad7fa8","#34e2e2","#eeeeec","#000000","#ffffff"]},infred:{comment:"Infinite red dark",colors:["#6c6c6c","#e9897c","#b6e77d","#ecebbe","#a9cdeb","#ea96eb","#c9caec","#f2f2f2","#747474","#f99286","#c3f786","#fcfbcc","#b6defb","#fba1fb","#d7d9fc","#e2e2e2","#f2f2f2","#101010"]},"raven-light":{comment:"Raven light",colors:["#e7dfd5","#f46864","#00ae58","#ac9510","#389bff","#dc6dd2","#00b0cc","#5b636b","#8f98a1","#b42b33","#007525","#726000","#0066cb","#a03398","#007793","#00020e","#69717a","#faf0e6"]}},o={};for(var i in r)o[i]=r[i].comment}}]);