UNPKG

@cocalc/static

Version:

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

1 lines 12.8 kB
"use strict";(self.webpackChunk_cocalc_static=self.webpackChunk_cocalc_static||[]).push([[1655],{34532:(e,t,n)=>{n.d(t,{S:()=>y,q:()=>v});var r=n(32295),a=n(24809),l=n(19990),o=n(10978),c=n.n(o);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 u(e,t,n,r,a,l,o){try{var c=e[l](o),i=c.value}catch(e){return void n(e)}c.done?t(i):Promise.resolve(i).then(r,a)}function s(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var l=e.apply(t,n);function o(e){u(l,r,a,o,c,"next",e)}function c(e){u(l,r,a,o,c,"throw",e)}o(void 0)}))}}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,l=[],o=!0,c=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(l.push(r.value),!t||l.length!==t);o=!0);}catch(e){c=!0,a=e}finally{try{o||null==n.return||n.return()}finally{if(c)throw a}}return l}}(e,t)||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}}(e,t)||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.")}()}var d=function(e,t){var n,r,a,l,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return l={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(l[Symbol.iterator]=function(){return this}),l;function c(l){return function(c){return function(l){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(a=2&l[0]?r.return:l[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,l[1])).done)return a;switch(r=0,a&&(l=[2&l[0],a.value]),l[0]){case 0:case 1:a=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==l[0]&&2!==l[0])){o=0;continue}if(3===l[0]&&(!a||l[1]>a[0]&&l[1]<a[3])){o.label=l[1];break}if(6===l[0]&&o.label<a[1]){o.label=a[1],a=l;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(l);break}a[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=a=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}([l,c])}}},y="bars";function m(e){if("object"!=typeof e)return{};var t={};for(var n in e){var r="".concat(e[n]);""!=r&&(t[n]=r)}return t}function p(e){return JSON.stringify(m(e),null,2)}var v=function(e){var t=e.project_id,n=(0,r.useRedux)(["projects","project_map",t,"env"]),o=f((0,r.useState)(!1),2),i=o[0],u=o[1],v=f((0,r.useState)(p(null==n?void 0:n.toJS())),2),h=v[0],g=v[1],b=f((0,r.useState)(""),2),S=b[0],E=b[1],R=(0,r.useActions)({project_id:t}),w=(0,r.useIsMountedRef)(),x=f((0,r.useState)(!1),2),C=x[0],_=x[1],j=(0,r.useMemo)((function(){return p(null==n?void 0:n.toJS())==h}),[n,h]);function k(){return(k=s((function(){var e;return d(this,(function(t){switch(t.label){case 0:try{e=c()(h)}catch(e){return E(e.toString()),[2]}return g(p(m(e))),_(!0),[4,null==R?void 0:R.set_environment(e)];case 1:return t.sent(),w.current?(_(!1),[2]):[2]}}))}))).apply(this,arguments)}var A=i?'Enter custom environment variables as a JSON map from string to string, e.g., {"foo":"bar","x":"y"}. Unlike environment variables in .bashrc, these will be available to anything that runs in your project (e.g., Jupyter kernels). Delete a variable by setting it to the empty string. Restart your project for these changes to take effect.':"";return r.React.createElement(l.SettingBox,{title:"Custom environment variables",icon:y},""!=S?r.React.createElement(l.ErrorDisplay,{error:S}):void 0,r.React.createElement("textarea",{spellCheck:"false",onFocus:function(){return u(!0)},onBlur:function(){return u(!1)},disabled:C,className:"form-control",rows:4,style:{width:"100%"},value:h,onChange:function(e){g(e.target.value),E("")}}),r.React.createElement("br",null),r.React.createElement(a.Z,{disabled:j,onClick:function(){return g(p(null==n?void 0:n.toJS()))}},"Cancel"),r.React.createElement(l.Space,null),r.React.createElement(a.Z,{disabled:j,onClick:function(){return k.apply(this,arguments)}},C?"Saving...":j?"Saved":"Save..."),r.React.createElement("br",null),r.React.createElement("br",null),A)}},39074:(e,t,n)=>{n.d(t,{A:()=>c});var r=n(32295),a=n(19990),l=n(38628),o=n(13435),c=function(e){var t=e.image,n=(0,r.useTypedRedux)("compute_images","images"),c=(0,r.useTypedRedux)("customize","software"),i=(0,r.useMemo)((function(){return null==c?void 0:c.get("environments")}),[c]);if(null==n)return r.React.createElement(a.Loading,null);if(!t)return r.React.createElement(r.React.Fragment,null,"Default");if(t.startsWith(l.an)){var u=(0,l.yH)(t),s=(0,l.PF)(t),f=n.get(s);return null==f?r.React.createElement(r.React.Fragment,null,s):r.React.createElement(r.React.Fragment,null,f.get("display")," ",r.React.createElement("span",{style:{color:o.COLORS.GRAY,fontFamily:"monospace"}},"(",u,")"))}var d=i.get(t);return null==d?r.React.createElement(r.React.Fragment,null,t):r.React.createElement(r.React.Fragment,null,d.get("title"))}},32601:(e,t,n)=>{n.d(t,{H:()=>s});var r=n(2131),a=n(34408),l=n(32295),o=n(97636),c=n(19990);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 u(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,l=[],o=!0,c=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(l.push(r.value),!t||l.length!==t);o=!0);}catch(e){c=!0,a=e}finally{try{o||null==n.return||n.return()}finally{if(c)throw a}}return l}}(e,t)||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}}(e,t)||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.")}()}var s=function(e){var t,n=e.exclude,i=e.at_top,s=e.onChange,f=e.value,d=e.defaultValue,y=e.style,m=(0,l.useTypedRedux)("projects","project_map"),p=(0,l.useTypedRedux)("projects","all_projects_have_been_loaded"),v=u((0,l.useState)(!1),2),h=v[0],g=v[1],b=u((0,l.useState)(!1),2),S=b[0],E=b[1],R=(0,l.useMemo)((function(){if(null!=m){if(!f||null!=m.get(f)||p){var e=m,t=o.webapp_client.account_id,r=[];if(null!=n){var a=!0,c=!1,u=void 0;try{for(var s,d=n[Symbol.iterator]();!(a=(s=d.next()).done);a=!0){var y=s.value;null!=y&&e.has(y)&&(e=e.delete(y))}}catch(e){c=!0,u=e}finally{try{a||null==d.return||d.return()}finally{if(c)throw u}}}if(null!=i){var v=!0,g=!1,b=void 0;try{for(var E,R=i[Symbol.iterator]();!(v=(E=R.next()).done);v=!0){var w=E.value;null!=w&&e.has(w)&&(r.push({id:w,title:e.getIn([w,"title"])}),e=e.delete(w))}}catch(e){g=!0,b=e}finally{try{v||null==R.return||R.return()}finally{if(g)throw b}}}var x=e.valueSeq().toJS();x.sort((function(e,t){return e.last_edited<t.last_edited?1:e.last_edited>t.last_edited?-1:0}));var C=[],_=!0,j=!1,k=void 0;try{for(var A,L=x[Symbol.iterator]();!(_=(A=L.next()).done);_=!0){var O,Z,F=A.value,I=!!F.deleted,T=!!(null===(O=F.users)||void 0===O||null===(Z=O[null!=t?t:""])||void 0===Z?void 0:Z.hide);(F.project_id==f||I==h&&T==S)&&C.push({id:F.project_id,title:F.title})}}catch(e){j=!0,k=e}finally{try{_||null==L.return||L.return()}finally{if(j)throw k}}return r.concat(C)}l.redux.getActions("projects").load_all_projects()}}),[m,n,i,h,S]);return null==R?l.React.createElement(c.Loading,null):l.React.createElement("div",{style:y},l.React.createElement("div",{style:{display:"flex",flexDirection:"row"}},l.React.createElement(r.Z,{style:{marginRight:"15px",flex:1},showSearch:!0,placeholder:"Select a project...",optionFilterProp:"children",value:f,defaultValue:d,onChange:s,filterOption:function(e,n){return!!n&&(null!==(t="".concat(n.children).toLowerCase().indexOf(e.toLowerCase()))&&void 0!==t?t:0)>=0}},R.map((function(e){return l.React.createElement(r.Z.Option,{key:e.id,value:e.id},e.title)}))),l.React.createElement("div",{style:{margin:"auto"}},l.React.createElement(a.Z,{checked:S,onChange:function(e){return E(e.target.checked)}},"Hidden"),l.React.createElement(a.Z,{checked:h,onChange:function(e){return g(e.target.checked)}},"Deleted"),!p&&l.React.createElement("span",null,l.React.createElement("br",null),l.React.createElement("a",{onClick:function(){return l.redux.getActions("projects").load_all_projects()}},"Load all projects...")))))}},51187:(e,t,n)=>{n.d(t,{g:()=>E,P:()=>S});var r=n(32295),a=n(19990),l=n(52224),o=n(55857),c=n(24620),i=n(2131),u=n(85215),s=n(24809),f=n(18760),d=n(34408),y=n(20812),m=n(63505),p=n(63505);function v(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 h(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,l=[],o=!0,c=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(l.push(r.value),!t||l.length!==t);o=!0);}catch(e){c=!0,a=e}finally{try{o||null==n.return||n.return()}finally{if(c)throw a}}return l}}(e,t)||function(e,t){if(e){if("string"==typeof e)return v(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)?v(e,t):void 0}}(e,t)||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.")}()}var g=i.Z.Option;function b(e){var t=e.defaultLicenseId,n=e.onSave,r=e.onChange,a=e.onCancel,v=e.exclude,b=e.managedLicenses,S=e.confirmLabel,E=e.style,R=(0,m.useRef)(!0),w=h((0,m.useState)(null!=t?t:""),2),x=w[0],C=w[1],_=h((0,m.useState)(!1),2),j=_[0],k=_[1],A=(0,m.useMemo)((function(){if(j)return(0,y.keys)(b);var e=(0,c.days_ago)(1),t=[];for(var n in b){var r,a=(null!==(r=b[n])&&void 0!==r?r:{}).expires;(null==a||a>=e)&&t.push(n)}return t}),[b,j]),L=(0,m.useMemo)((function(){var e=[],t=!0,n=!1,r=void 0;try{for(var a,l=A[Symbol.iterator]();!(t=(a=l.next()).done);t=!0){var c=a.value;if(!(null==v?void 0:v.includes(c))){var i,u=null!==(i=b[c])&&void 0!==i?i:{},s=u.title,d=u.quota,y=u.expires;e.push(p.createElement(g,{key:c,value:c},p.createElement(f.Z,{style:{marginRight:"15px",padding:"3px 15px"},type:y&&y<=new Date?"error":"warning",message:p.createElement(p.Fragment,null,p.createElement("span",{style:{fontFamily:"monospace"}},c),p.createElement("span",{style:{color:"#666"}},s?" - "+s:"",p.createElement("br",null),d&&(0,o.wc)(d,!0),y&&p.createElement("span",null,", Expires ",y.toLocaleString())))})))}}}catch(e){n=!0,r=e}finally{try{t||null==l.return||l.return()}finally{if(n)throw r}}return e}),[b,A]),O=(0,c.isValidUUID)(x);return p.createElement("div",{style:E},p.createElement("div",{style:{width:"100%",display:"flex"}},p.createElement(i.Z,{style:{margin:"5px 15px 10px 0",flex:1},placeholder:"Enter license code "+(L.length>0?"or select from the ".concat(L.length," licenses you manage"):""),value:x||void 0,onBlur:function(){R.current=!0},onFocus:function(){R.current=!1},onChange:function(e){null==r||r(e),C(e)},onSearch:function(e){R.current||(null==r||r(e),C(e))},notFoundContent:null,showSearch:!0,allowClear:!0},L),(j||A.length<(0,c.len)(b))&&p.createElement(d.Z,{style:{marginTop:"10px",color:"#666",whiteSpace:"nowrap"},checked:j,onChange:function(){return k(!j)}},"Show expired")),function(){if(n||a)return p.createElement(u.Z,null,n&&p.createElement(s.Z,{disabled:!O,type:"primary",onClick:function(){n(x)}},p.createElement(l.JO,{name:"check"})," ",null!=S?S:"Apply License"),a&&p.createElement(s.Z,{onClick:a},"Cancel"))}(),!O&&x&&p.createElement(f.Z,{style:{margin:"15px"},type:"error",message:"Valid license keys are 36 characters long."}))}function S(){var e=(0,r.useTypedRedux)("billing","managed_licenses");return(0,r.useEffect)((function(){r.redux.getActions("billing").update_managed_licenses()}),[]),e}var E=function(e){var t=e.onSave,n=e.onCancel,l=e.onChange,o=e.exclude,c=e.style,i=e.confirmLabel,u=void 0===i?"Apply License":i,s=S();return null==s?r.React.createElement(a.Loading,null):r.React.createElement(b,{onSave:t,onCancel:n,onChange:l,exclude:o,managedLicenses:s.toJS(),confirmLabel:u,style:c})}}}]);