You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
38 KiB
1 lines
38 KiB
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[825],{4594:function(e,t,n){var r=n(5893),o=n(6514),i=n(5113),a=n(4656),s=n(482),l=n(2994),u=n(7357),c=n(9890),p=n(7169),d=n(1363),f=n(6284);function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function m(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){v(e,t,n[t])}))}return e}function x(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var g=function(e){return(0,r.jsx)(o.Z,{in:!0,children:(0,r.jsx)(i.Z,m({},e))})};t.Z=function(e){var t=e.componentsProps,n=e.extendRenderInput,o=e.label,i=e.messageBoxProps,h=e.renderInput,b=e.sx,y=x(e,["componentsProps","extendRenderInput","label","messageBoxProps","renderInput","sx"]),U=m({paper:{sx:{backgroundColor:p.lD}}},t),S=null!==h&&void 0!==h?h:function(e){var t=e.fullWidth,i=e.InputProps,a=e.InputLabelProps,s=e.inputProps,l={formControlProps:{fullWidth:t,ref:i.ref},inputLabelProps:a,inputProps:{className:i.className,endAdornment:i.endAdornment,inputProps:s,startAdornment:i.startAdornment},label:o};return null===n||void 0===n||n.call(null,l,e),(0,r.jsx)(f.Z,m({},l))},j=m(v({},"& .".concat(a.Z.root," .").concat(s.Z.endAdornment),v({right:"7px"},"& .".concat(l.Z.root),{color:p.s7})),b);return(0,r.jsxs)(u.Z,{sx:{display:"flex",flexDirection:"column"},children:[(0,r.jsx)(c.Z,m({PaperComponent:g},y,{componentsProps:U,renderInput:S,sx:j})),(0,r.jsx)(d.Z,m({},i))]})}},5521:function(e,t,n){n.d(t,{Z:function(){return E}});var r=n(5893),o=n(1113),i=n(1496),a=n(2293),s=n(7357),l=n(2992),u=n(4799),c=n(7294),p=n(7169),d=n(4433),f=n(9029),v=n(7533),m=n(8462),x=n(7212),g=n(8619),h=[{text:"Anvil",image:"/pngs/anvil_icon_on.png",uri:"/manage-element"},{text:"Files",image:"/pngs/files_on.png",uri:"/file-manager"},{text:"Configure",image:"/pngs/configure_icon_on.png",uri:"/config"},{text:"Help",image:"/pngs/help_icon_on.png",uri:"https://alteeve.com/w/Support"}],b={width:"40em",height:"40em"},y=n(4390),U=n(582),S=n(4690),j=n(1770),I=n(7750),P=n(1081);function D(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 w(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,o,i=[],a=!0,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(l){s=!0,o=l}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return i}}(e,t)||function(e,t){if(!e)return;if("string"===typeof e)return D(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return D(e,t)}(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 Z=function(){var e=(0,P.Z)(),t=(0,c.useState)({}),n=t[0],r=t[1],o=(0,c.useCallback)((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"suiapi.";return n["".concat(t).concat(e)]}),[n]),i=(0,c.useCallback)((function(){return o("user")}),[o]);return(0,c.useEffect)((function(){if(e){var t=document.cookie.split(/\s*;\s*/);r(t.reduce((function(e,t){var n,r=w(t.split("=",2),2),o=r[0],i=r[1],a=decodeURIComponent(i);if(a.startsWith("j:"))try{n=JSON.parse(a.substring(2))}catch(s){n=i}else n=i;return e[o]=n,e}),{}))}}),[e]),{cookieJar:n,getCookie:o,getSessionUser:i}};function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function A(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){O(e,t,n[t])}))}return e}var M="AnvilDrawer",C={actionIcon:"".concat(M,"-actionIcon"),list:"".concat(M,"-list")},k=(0,i.ZP)(v.ZP)((function(){var e;return O(e={},"& .".concat(C.list),{width:"200px"}),O(e,"& .".concat(C.actionIcon),{fontSize:"2.3em",color:p.of}),e})),G=function(e){var t=e.open,n=e.setOpen,o=(0,Z().getSessionUser)();return(0,r.jsx)(k,{BackdropProps:{invisible:!0},anchor:"left",open:t,onClose:function(){return n(!t)},children:(0,r.jsx)("div",{role:"presentation",children:(0,r.jsxs)(m.Z,{className:C.list,children:[(0,r.jsx)(x.ZP,{children:(0,r.jsx)(I.Ac,{children:o?(0,r.jsxs)(r.Fragment,{children:["Welcome, ",o.name]}):"Unregistered"})}),(0,r.jsx)(U.Z,{}),(0,r.jsx)(g.Z,{component:"a",href:"/index.html",children:(0,r.jsxs)(S.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)(d.Z,{className:C.actionIcon}),(0,r.jsx)(I.Ac,{children:"Dashboard"})]})}),h.map((function(e){return(0,r.jsx)(g.Z,{component:"a",href:e.uri,children:(0,r.jsxs)(S.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)("img",A({alt:e.text,src:e.image},b)),(0,r.jsx)(I.Ac,{children:e.text})]})},"anvil-drawer-".concat(e.image))})),(0,r.jsx)(g.Z,{onClick:function(){y.Z.put("/auth/logout").then((function(){window.location.replace("/login")})).catch((function(e){(0,j.Z)(e)}))},children:(0,r.jsxs)(S.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)(f.Z,{className:C.actionIcon}),(0,r.jsx)(I.Ac,{children:"Logout"})]})})]})})})},B=n(3377),z=n(2444);function T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var N="Header",F={input:"".concat(N,"-input"),barElement:"".concat(N,"-barElement"),iconBox:"".concat(N,"-iconBox"),searchBar:"".concat(N,"-searchBar"),icons:"".concat(N,"-icons")},L=(0,i.ZP)(a.Z)((function(e){var t,n=e.theme;return T(t={paddingTop:n.spacing(.5),paddingBottom:n.spacing(.5),paddingLeft:n.spacing(3),paddingRight:n.spacing(3),borderBottom:"solid 1px",borderBottomColor:p.hM,position:"static"},"& .".concat(F.input),{height:"2.8em",width:"30vw",backgroundColor:n.palette.secondary.main,borderRadius:p.n_}),T(t,"& .".concat(F.barElement),{padding:0}),T(t,"& .".concat(F.iconBox),T({},n.breakpoints.down("sm"),{display:"none"})),T(t,"& .".concat(F.searchBar),T({},n.breakpoints.down("sm"),{flexGrow:1,paddingLeft:"15vw"})),T(t,"& .".concat(F.icons),{paddingLeft:".1em",paddingRight:".1em"}),t})),E=function(){var e=(0,c.useRef)({}),t=(0,c.useRef)({}),n=(0,c.useState)(!1),i=n[0],a=n[1];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(L,{children:(0,r.jsxs)(s.Z,{display:"flex",justifyContent:"space-between",flexDirection:"row",children:[(0,r.jsx)(S.Z,{row:!0,children:(0,r.jsx)(l.Z,{onClick:function(){return a(!i)},children:(0,r.jsx)("img",{alt:"",src:"/pngs/logo.png",width:"160",height:"40"})})}),(0,r.jsx)(S.Z,{className:F.iconBox,row:!0,spacing:0,children:(0,r.jsx)(s.Z,{children:(0,r.jsx)(u.Z,{onClick:function(e){var n,r,o=e.currentTarget;null===(n=t.current.setAnchor)||void 0===n||n.call(null,o),null===(r=t.current.setOpen)||void 0===r||r.call(null,!0)},sx:{color:p.of,padding:"0 .1rem"},children:(0,r.jsx)(B.Z,{icon:o.Z,ref:e})})})})]})}),(0,r.jsx)(G,{open:i,setOpen:a}),(0,r.jsx)(z.Z,{onFetchSuccessAppend:function(t){var n;null===(n=e.current.indicate)||void 0===n||n.call(null,Object.keys(t).length>0)},ref:t})]})}},4968:function(e,t,n){n.d(t,{Z:function(){return Ue}});var r=n(5893),o=n(7294),a=n(7357),s=n(6886),l=n(8262),u=n(5537),c=n(5934),p=n(7169),d=n(4390),f=n(4594),v=n(157),m=n(4825),x=n(5737),g=n(1706),h=n(8187),b=n(6284),y=n(7120),U=n(4656),S=n(1363),j=n(7783);function I(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){I(e,t,n[t])}))}return e}var D={inputWithLabelProps:{},messageBoxProps:{},selectWithLabelProps:{}},w=function(e){var t=e.id,n=e.label,o=e.inputWithLabelProps,i=void 0===o?D.inputWithLabelProps:o,s=e.messageBoxProps,l=void 0===s?D.messageBoxProps:s,u=e.selectItems,c=e.selectWithLabelProps,d=void 0===c?D.selectWithLabelProps:c;return(0,r.jsxs)(a.Z,{children:[(0,r.jsxs)(a.Z,{sx:I({display:"flex",flexDirection:"row","& > :first-child":{flexGrow:1},"& > :not(:last-child)":{marginRight:".5em"}},"&:hover\n .".concat(y.Z.root,"\n .").concat(U.Z.root,"\n .").concat(U.Z.notchedOutline),{borderColor:p.s7}),children:[(0,r.jsx)(b.Z,P({id:t,label:n},i)),(0,r.jsx)(j.Z,P({formControlProps:{fullWidth:!1},id:"".concat(t,"-nested-select"),selectItems:u},d))]}),(0,r.jsx)(S.Z,P({},l))]})};w.defaultProps=D;var Z=w,O=n(3679),A=n(3640),M=n(6727),C=n(1184),k=n(9),G=n(192),B=n(7750);function z(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 T(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function N(e,t){return null!=t&&"undefined"!==typeof Symbol&&t[Symbol.hasInstance]?t[Symbol.hasInstance](e):e instanceof t}function F(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){T(e,t,n[t])}))}return e}function L(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function E(e){return function(e){if(Array.isArray(e))return z(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"===typeof e)return z(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return z(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var W={inputLabelProps:{},isAllowTextInput:!1,labelId:"",messageBoxProps:{},sliderProps:{}},V={root:"".concat("SliderInputLabelDecorator","-root")},R=function(e){var t=e.isFocused,n=e.label,o=p.s7,i="solid",s="0",l="0 .6em 0 .4em",u="1px 0 0 0",c="0.3";return t&&(s="-1px",l="0 1em 0 1em",u="2px 0 0 0",c="1"),(0,r.jsxs)(a.Z,{className:V.root,sx:{display:"flex",flexDirection:"row",position:"absolute",top:s,width:"calc(100% - 6px)","> :last-child":{flexGrow:1}},children:[(0,r.jsx)(a.Z,{sx:{borderColor:o,borderStyle:i,borderWidth:u,content:'""',opacity:c,width:".6em"}}),(0,r.jsx)(B.Ac,{sx:{fontSize:".75em",margin:l,visibility:"hidden"},text:n}),(0,r.jsx)(a.Z,{sx:{borderColor:o,borderStyle:i,borderWidth:u,content:'""',opacity:c}})]})},_=function(e,t){var n=Number.parseFloat(e);return Number.isNaN(n)?t:n},Q=function(e){return N(e,Array)?e.map((function(e){return String(e)})):[String(e)]},q=function(e){var t,n=e.messageBoxProps,i=void 0===n?W.messageBoxProps:n,s=e.isAllowTextInput,l=void 0===s?W.isAllowTextInput:s,u=e.label,c=e.labelId,d=void 0===c?W.labelId:c,f=e.inputLabelProps,v=void 0===f?W.inputLabelProps:f,m=e.sliderProps,x=void 0===m?W.sliderProps:m,g=e.value,h=x.max,b=x.min,y=x.onChange,j=x.sx,I=x.valueLabelDisplay,P=g,D=(0,o.useState)({range:Q(g)}),w=D[0],Z=D[1],O=(0,o.useState)(!1),B=O[0],z=O[1],q=function(){z(!1)},H=function(){z(!0)},$=function(){P=function(e,t){return N(t,Array)?e.map((function(e,n){return _(e,t[n])})):_(e[0],t)}(w.range,P),null===y||void 0===y||y.call(null,P)};return(0,r.jsxs)(A.Z,{sx:{display:"flex",flexDirection:"column","&:hover":(t={},T(t,"& .".concat(V.root," div"),{opacity:1}),T(t,"& .".concat(U.Z.notchedOutline),{borderColor:p.s7}),t)},children:[(0,r.jsx)(G.Z,F({className:B?M.Z.focused:"",id:d,shrink:!0},v,{children:u})),R({isFocused:B,label:u}),(0,r.jsxs)(a.Z,{sx:{alignItems:"center",display:"flex",flexDirection:"row","> :first-child":{flexGrow:1}},children:[(0,r.jsx)(C.ZP,{"aria-labelledby":d,max:h,min:b,onBlur:q,onChange:function(e,t){Z({range:Q(t)}),null===y||void 0===y||y.call(null,t)},onFocus:H,sx:F(T({color:p.s7,marginLeft:"1em",marginRight:"1em"},"& .".concat(C.TW.thumb),{borderRadius:p.n_,transform:"translate(-50%, -50%) rotate(45deg)"}),j),value:P,valueLabelDisplay:I}),w.range.map((function(e,t){return function(e){var t=e.key,n=e.isFocused,o=L(e,["key","isFocused"]);return(0,r.jsx)(k.Z,F({key:t,className:n?U.Z.focused:"",type:"number"},o))}({key:"slider-nested-text-input-".concat(t),inputProps:{max:h,min:b},isFocused:B,onBlur:q,onChange:function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];w.range[t]=n[0].target.value,Z(F({},w)),$.apply(void 0,E(n))},onFocus:H,sx:l?void 0:{visibility:"collapse"},value:e})}))]}),(0,r.jsx)(S.Z,F({},i))]})};q.defaultProps=W;var H=q,$=n(2152),J=n(7987);function Y(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 K(e){if(Array.isArray(e))return e}function X(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ee(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function te(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ne(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter((function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})))),r.forEach((function(t){X(e,t,n[t])}))}return e}function re(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function oe(e,t){return K(e)||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,s=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(i.push(r.value),!t||i.length!==t);a=!0);}catch(l){s=!0,o=l}finally{try{a||null==n.return||n.return()}finally{if(s)throw o}}return i}}(e,t)||se(e,t)||te()}function ie(e){return K(e)||ee(e)||se(e,i)||te()}function ae(e){return function(e){if(Array.isArray(e))return Y(e)}(e)||ee(e)||se(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function se(e,t){if(e){if("string"===typeof e)return Y(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)?Y(e,t):void 0}}var le,ue,ce=BigInt(0),pe=[{value:"B"},{value:"KiB"},{value:"MiB"},{value:"GiB"},{value:"TiB"}],de="GiB",fe=BigInt(65536),ve=BigInt(104857600),me={backgroundColor:p.Ej,color:p.lD,"&:hover":{backgroundColor:p.Ej}},xe=function(e,t){var n=t.onButtonClick;return(0,r.jsx)(m.Z,{disabled:void 0===n,onClick:n,sx:{minWidth:"unset",whiteSpace:"nowrap"},children:"Max: ".concat(e)})},ge=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.endAdornment,n=e.mainLabel,o=e.subLabel;return(0,r.jsxs)(a.Z,{sx:{alignItems:"center",display:"flex",flexDirection:"row",width:"100%","& > :first-child":{flexGrow:1}},children:[(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column"},children:[n&&(0,r.jsx)(B.Ac,{inverted:!0,text:n}),o&&(0,r.jsx)(B.Ac,{inverted:!0,text:o})]}),t]})},he=function(e,t,n,r,o,i,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},l=s.includeAnvilUUIDs,u=void 0===l?[]:l,c=s.includeFileUUIDs,p=void 0===c?[]:c,d=s.includeStorageGroupUUIDs,f=void 0===d?[]:d,v=function(){return!0},m=function(){return!0},x=function(){return!0};u.length>0&&(v=function(e){return u.includes(e)}),p.length>0&&(m=function(e){return p.includes(e)}),f.length>0&&(x=function(e){return f.includes(e)});var g={},h=i.reduce((function(e,t,n){var r,i=null!==(r=o[n])&&void 0!==r?r:ce;return e.all+=i,""===t||(void 0===e[t]&&(e[t]=ce),e[t]+=i),e}),{all:ce}),b=e.reduce((function(e,s){var l=s.anvilUUID;if(v(l)){var u,c=s.anvilTotalCPUCores,p=s.anvilTotalAvailableMemory,d=s.files,f=s.fileUUIDs,b=s.storageGroups,y=[],U=ce,S=ce;if(b.forEach((function(e){var t=e.storageGroupUUID,n=e.storageGroupFree;x(t)&&(y.push(t),S+=n,n>U&&(U=n))})),[function(){return b.length>0},function(){return n<=c},function(){return r<=p},function(){return i.every((function(e,n){var r,i=null!==(r=o[n])&&void 0!==r?r:ce,a=!0,s=i<=U;return""!==e&&(a=y.includes(e),s=i<=t[e].storageGroupFree),a&&s}))},function(){return Object.entries(h).every((function(e){var n=oe(e,2),r=n[0],o=n[1];return"all"===r?o<=S:o<=t[r].storageGroupFree}))},function(){return a.every((function(e){return""===e||f.includes(e)}))}].every((function(e){return e()})))e.anvils.push(s),e.anvilUUIDs.push(l),e.maxCPUCores=Math.max(c,e.maxCPUCores),p>e.maxMemory&&(e.maxMemory=p),d.forEach((function(e){var t=e.fileUUID;m(t)&&(g[t]=!0)})),(u=e.storageGroupUUIDs).push.apply(u,ae(y)),e.maxVirtualDiskSizes.fill(U)}return e}),{anvils:[],anvilUUIDs:[],fileUUIDs:[],maxCPUCores:0,maxMemory:ce,maxVirtualDiskSizes:i.map((function(){return ce})),storageGroupUUIDs:[]});return b.fileUUIDs=Object.keys(g),i.forEach((function(e,n){""!==e&&(b.maxVirtualDiskSizes[n]=t[e].storageGroupFree)})),b},be=function(e){return e.filter((function(e){return""!==e}))},ye=function(e){return{fromUnit:"B",onSuccess:{string:e},precision:0,toUnit:"ibyte"}};(0,x.Bh)(fe,ye((function(e,t){le="".concat(e," ").concat(t)}))),(0,x.Bh)(ve,ye((function(e,t){ue="".concat(e," ").concat(t)})));var Ue=function(e){var t=e.dialogProps.open,n=e.onClose,i=(0,o.useState)([]),y=i[0],U=i[1],S=(0,o.useState)({}),I=S[0],P=S[1],D=(0,o.useState)({}),w=D[0],A=D[1],M=(0,o.useState)({}),C=M[0],k=M[1],G=(0,o.useState)({}),z=G[0],T=G[1],N=(0,o.useState)([]),F=N[0],L=N[1],E=(0,o.useState)([]),W=E[0],V=E[1],R=(0,o.useState)([]),_=R[0],Q=R[1],q=(0,o.useState)([]),Y=q[0],K=q[1],ee=(0,o.useState)(""),te=ee[0],se=ee[1],ye=(0,o.useState)(),Ue=ye[0],Se=ye[1],je=(0,o.useState)(1),Ie=je[0],Pe=je[1],De=(0,o.useState)(0),we=De[0],Ze=De[1],Oe=(0,o.useState)(),Ae=Oe[0],Me=Oe[1],Ce=(0,o.useState)(ce),ke=Ce[0],Ge=Ce[1],Be=(0,o.useState)(ce),ze=Be[0],Te=Be[1],Ne=(0,o.useState)(),Fe=Ne[0],Le=Ne[1],Ee=(0,o.useState)("0"),We=Ee[0],Ve=Ee[1],Re=(0,o.useState)(""),_e=Re[0],Qe=Re[1],qe=(0,o.useState)(de),He=qe[0],$e=qe[1],Je=(0,o.useState)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.existingVirtualDisks,n=void 0===t?{stateIds:[],inputMaxes:[],inputSizeMessages:[],inputSizes:[],inputStorageGroupUUIDMessages:[],inputStorageGroupUUIDs:[],inputUnits:[],maxes:[],sizes:[]}:t,r=e.stateId,o=void 0===r?(0,c.Z)():r,i=e.inputMax,a=void 0===i?"0":i,s=e.inputSize,l=void 0===s?"":s,u=e.inputSizeMessage,p=void 0===u?void 0:u,d=e.inputStorageGroupUUID,f=void 0===d?"":d,v=e.inputStorageGroupUUIDMessage,m=void 0===v?void 0:v,x=e.inputUnit,g=void 0===x?de:x,h=e.max,b=void 0===h?ce:h,y=e.setVirtualDisks,U=e.size,S=void 0===U?ce:U,j=n.stateIds,I=n.inputMaxes,P=n.inputSizeMessages,D=n.inputSizes,w=n.inputStorageGroupUUIDMessages,Z=n.inputStorageGroupUUIDs,O=n.inputUnits,A=n.maxes,M=n.sizes;return j.push(o),I.push(a),P.push(p),D.push(l),w.push(m),Z.push(f),O.push(g),A.push(b),M.push(S),null===y||void 0===y||y.call(null,ne({},n)),n}()),Ye=Je[0],Ke=Je[1],Xe=(0,o.useState)(""),et=Xe[0],tt=Xe[1],nt=(0,o.useState)(),rt=nt[0],ot=nt[1],it=(0,o.useState)(""),at=it[0],st=it[1],lt=(0,o.useState)()[0],ut=(0,o.useState)(""),ct=ut[0],pt=ut[1],dt=(0,o.useState)(),ft=dt[0],vt=dt[1],mt=(0,o.useState)(null),xt=mt[0],gt=mt[1],ht=(0,o.useState)(),bt=ht[0],yt=ht[1],Ut=(0,o.useState)([]),St=Ut[0],jt=Ut[1],It=(0,o.useState)([]),Pt=It[0],Dt=It[1],wt=(0,o.useState)([]),Zt=wt[0],Ot=wt[1],At=(0,o.useState)(!1),Mt=At[0],Ct=At[1],kt=(0,o.useState)(!1),Gt=kt[0],Bt=kt[1],zt=(0,o.useState)(!1),Tt=zt[0],Nt=zt[1],Ft=(0,o.useState)(0),Lt=Ft[0],Et=Ft[1],Wt={serverName:{defaults:{onSuccess:function(){Se(void 0)},value:te},tests:[{onFailure:function(){Se({text:"The server name length must be 1 to 16 characters.",type:"warning"})},test:function(e){var t=e.value.length;return t>=1&&t<=16}},{onFailure:function(){Se({text:"The server name is expected to only contain alphanumeric, hyphen, or underscore characters.",type:"warning"})},test:function(e){var t=e.value;return/^[a-zA-Z0-9_-]+$/.test(t)}},{onFailure:function(){Se({text:"This server name already exists, please choose another name.",type:"warning"})},test:function(e){var t=e.value;return void 0===C[t]}}]},cpuCores:{defaults:{max:we,min:1,onSuccess:function(){Me(void 0)},value:Ie},tests:[{onFailure:function(){Me({text:"Non available.",type:"warning"})},test:J.X7},{onFailure:function(e){var t=e.displayMax,n=e.displayMin;Me({text:"The number of CPU cores is expected to be between ".concat(n," and ").concat(t,"."),type:"warning"})},test:J.SQ}]},memory:{defaults:{displayMax:"".concat(We," ").concat(He),displayMin:le,max:ze,min:fe,onSuccess:function(){Le(void 0)},value:ke},tests:[{onFailure:function(){Le({text:"Non available.",type:"warning"})},test:J.X7},{onFailure:function(e){var t=e.displayMax,n=e.displayMin;Le({text:"Memory is expected to be between ".concat(n," and ").concat(t,"."),type:"warning"})},test:J.SQ}]},installISO:{defaults:{onSuccess:function(){ot(void 0)},value:et},tests:[{test:J.HJ}]},anvil:{defaults:{onSuccess:function(){vt(void 0)},value:ct},tests:[{test:J.HJ}]},optimizeForOS:{defaults:{onSuccess:function(){yt(void 0)},value:null===xt||void 0===xt?void 0:xt.key},tests:[{test:J.HJ}]}};Ye.inputSizeMessages.forEach((function(e,t){Wt["vd".concat(t,"Size")]={defaults:{displayMax:"".concat(Ye.inputMaxes[t]," ").concat(Ye.inputUnits[t]),displayMin:ue,max:Ye.maxes[t],min:ve,onSuccess:function(){Ye.inputSizeMessages[t]=void 0},value:Ye.sizes[t]},onFinishBatch:function(){Ke(ne({},Ye))},tests:[{onFailure:function(){Ye.inputSizeMessages[t]={text:"Non available.",type:"warning"}},test:J.X7},{onFailure:function(e){var n=e.displayMax,r=e.displayMin;Ye.inputSizeMessages[t]={text:"Virtual disk ".concat(t," size is expected to be between ").concat(r," and ").concat(n,"."),type:"warning"}},test:J.SQ}]},Wt["vd".concat(t,"StorageGroup")]={defaults:{onSuccess:function(){Ye.inputStorageGroupUUIDMessages[t]=void 0},value:Ye.inputStorageGroupUUIDs[t]},onFinishBatch:function(){Ke(ne({},Ye))},tests:[{test:J.HJ}]}}));var Vt,Rt,_t,Qt,qt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.allAnvils,n=void 0===t?y:t,r=e.cpuCores,o=void 0===r?Ie:r,i=e.fileUUIDs,a=void 0===i?[et,at]:i,s=e.includeAnvilUUIDs,l=void 0===s?be([ct]):s,u=e.includeFileUUIDs,c=e.includeStorageGroupUUIDs,p=e.inputMemoryUnit,d=void 0===p?He:p,f=e.memory,v=void 0===f?ke:f,m=e.storageGroupUUIDMapToData,g=void 0===m?z:m,h=e.virtualDisks,b=void 0===h?Ye:h,U=he(n,g,o,v,b.sizes,b.inputStorageGroupUUIDs,a,{includeAnvilUUIDs:l,includeFileUUIDs:u,includeStorageGroupUUIDs:c}),S=U.anvilUUIDs,j=U.fileUUIDs,I=U.maxCPUCores,P=U.maxMemory,D=U.maxVirtualDiskSizes,w=U.storageGroupUUIDs;Ze(I),Te(P);var Z=[];b.maxes=D,b.maxes.forEach((function(e,t){(0,x.Bh)(e,{fromUnit:"B",onSuccess:{string:function(e,n){b.inputMaxes[t]=e,Z[t]="".concat(e," ").concat(n)}},toUnit:b.inputUnits[t]})})),Ke(ne({},b)),jt(S),Dt(j),Ot(w);var O="";return(0,x.Bh)(P,{fromUnit:"B",onSuccess:{string:function(e,t){Ve(e),O="".concat(e," ").concat(t)}},toUnit:d}),{formattedMaxMemory:O,formattedMaxVDSizes:Z,maxCPUCores:I,maxMemory:P,maxVirtualDiskSizes:D}},Ht=(0,o.useCallback)(qt,[]),$t=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=ie(t),o=r[0],i=r.slice(1);return J.BD.apply(void 0,[ne({tests:Wt},o)].concat(ae(i)))},Jt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.cmValue,n=void 0===t?ce:t,r=e.cmUnit,o=void 0===r?He:r;Ge(n);var i=qt({inputMemoryUnit:o,memory:n}),a=i.formattedMaxMemory,s=i.maxMemory;$t({inputs:{memory:{displayMax:a,max:s,value:n}}})},Yt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.value,n=void 0===t?_e:t,r=e.unit,o=void 0===r?He:r;n!==_e&&Qe(n),o!==He&&$e(o),(0,x.KY)(n,o,(function(e){return Jt({cmValue:e,cmUnit:o})}),(function(){return Jt({cmUnit:o})}))},Kt=function(e){tt(e),qt({fileUUIDs:[e,at]})},Xt=function(e){st(e),qt({fileUUIDs:[et,e]})},en=function(e){var t=be([e]);pt(e),qt({includeAnvilUUIDs:t})};return(0,o.useEffect)((function(){d.Z.get("/anvil",{params:{anvilUUIDs:"all",isForProvisionServer:!0}}).then((function(e){var t=e.data,n=function(e){var t={},n=e.reduce((function(e,n){var o=n.anvilUUID,i=n.anvilName,s=n.anvilTotalMemory,l=n.anvilTotalAllocatedMemory,u=n.anvilTotalAvailableMemory,c=n.hosts,p=n.servers,d=n.storageGroups,f=n.files,v=d.reduce((function(t,n){var a=ne({},n,{anvilUUID:o,anvilName:i,storageGroupSize:BigInt(n.storageGroupSize),storageGroupFree:BigInt(n.storageGroupFree),humanizedStorageGroupFree:""});return(0,x.Bh)(n.storageGroupFree,{fromUnit:"B",onSuccess:{string:function(e,t){a.humanizedStorageGroupFree="".concat(e," ").concat(t)}},precision:0,toUnit:"ibyte"}),t.anvilStorageGroupUUIDs.push(n.storageGroupUUID),t.anvilStorageGroups.push(a),e.storageGroups.push(a),e.storageGroupSelectItems.push({displayValue:ge({endAdornment:(0,r.jsx)(B.Ac,{inverted:!0,text:"~".concat(a.humanizedStorageGroupFree," free")}),mainLabel:n.storageGroupName,subLabel:i}),value:n.storageGroupUUID}),e.storageGroupUUIDMapToData[n.storageGroupUUID]=a,t}),{anvilStorageGroups:[],anvilStorageGroupUUIDs:[]}),m=v.anvilStorageGroups,g=v.anvilStorageGroupUUIDs,h=[];f.forEach((function(e){var n=e.fileUUID;h.push(n),t[n]=e}));var b=ne({},n,{anvilTotalMemory:BigInt(s),anvilTotalAllocatedMemory:BigInt(l),anvilTotalAvailableMemory:BigInt(u),humanizedAnvilTotalAvailableMemory:"",hosts:c.map((function(e){return ne({},e,{hostMemory:BigInt(e.hostMemory)})})),servers:p.map((function(t){var n=t.serverMemory,r=t.serverName,o=ne({},re(t,["serverMemory","serverName"]),{serverMemory:BigInt(n),serverName:r});return e.serverNameMapToData[r]=o,o})),storageGroupUUIDs:g,storageGroups:m,fileUUIDs:h});return(0,x.Bh)(u,{fromUnit:"B",onSuccess:{string:function(e,t){b.humanizedAnvilTotalAvailableMemory="".concat(e," ").concat(t)}},precision:0,toUnit:"ibyte"}),e.anvils.push(b),e.anvilSelectItems.push({displayValue:ge({endAdornment:(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column",width:"8rem"},children:[(0,r.jsx)(B.Ac,{inverted:!0,text:"CPU: ".concat(b.anvilTotalCPUCores," cores")}),(0,r.jsx)(B.Ac,{inverted:!0,text:"Memory: ~".concat(b.humanizedAnvilTotalAvailableMemory)})]}),mainLabel:b.anvilName,subLabel:b.anvilDescription}),value:o}),e.anvilUUIDMapToData[o]=b,e}),{anvils:[],anvilSelectItems:[],anvilUUIDMapToData:{},files:[],fileSelectItems:[],fileUUIDMapToData:{},serverNameMapToData:{},storageGroups:[],storageGroupSelectItems:[],storageGroupUUIDMapToData:{}});return Object.values(t).forEach((function(e){n.files.push(e),n.fileSelectItems.push({displayValue:e.fileName,value:e.fileUUID}),n.fileUUIDMapToData[e.fileUUID]=e})),n}(t.anvils),o=n.anvils,i=n.anvilSelectItems,s=n.anvilUUIDMapToData,l=n.fileSelectItems,u=n.fileUUIDMapToData,c=n.serverNameMapToData,p=n.storageGroupSelectItems,d=n.storageGroupUUIDMapToData;U(o),P(s),A(u),k(c),T(d),L(i),V(l),K(p),Ht({allAnvils:o,storageGroupUUIDMapToData:d}),Q(t.osList.map((function(e){var t=oe(e.replace(/^key=([^\s]+),name=['"](.*)['"]$/,"$1,$2").split(","),2),n=t[0];return{label:t[1],key:n}}))),Ct(!0)}))}),[Ht]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(l.Z,{fullWidth:!0,maxWidth:"sm",open:t,PaperComponent:O.s_,PaperProps:{sx:{overflow:"visible"}},children:[(0,r.jsxs)(O.V9,{children:[(0,r.jsx)(B.z,{text:"Provision a Server"}),(0,r.jsx)(g.Z,{onClick:n,sx:{backgroundColor:p.hM,color:p.lD,"&:hover":{backgroundColor:p.hM}},children:(0,r.jsx)(u.Z,{})})]}),Mt?(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column",maxHeight:"50vh",overflowY:"scroll",paddingTop:".6em","& > :not(:first-child)":{marginTop:"1em"}},children:[(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"column"},children:(0,r.jsx)(b.Z,{id:"ps-server-name",label:"Server name",inputProps:{onChange:function(e){var t=e.target.value;se(t),$t({inputs:{serverName:{value:t}}})},value:te},inputLabelProps:{isNotifyRequired:0===te.length},messageBoxProps:Ue})}),(Vt="ps-cpu-cores",Rt="CPU cores",_t=Ie,Qt={messageBoxProps:Ae,sliderProps:{onChange:function(e){var t=e;if(t!==Ie){Pe(t);var n=qt({cpuCores:t}).maxCPUCores;$t({inputs:{cpuCores:{max:n,value:t}}})}},max:we,min:1}},(0,r.jsx)(H,ne({isAllowTextInput:!0,label:Rt,labelId:"".concat(Vt,"-label"),value:_t},Qt))),(0,r.jsx)(Z,{id:"ps-memory",label:"Memory",messageBoxProps:Fe,inputWithLabelProps:{inputProps:{endAdornment:xe("".concat(We," ").concat(He),{onButtonClick:function(){Qe(We),Jt({cmValue:ze})}}),onChange:function(e){var t=e.target.value;Yt({value:t})},type:"number",value:_e},inputLabelProps:{isNotifyRequired:ke===ce}},selectItems:pe,selectWithLabelProps:{selectProps:{onChange:function(e){var t=e.target.value;Yt({unit:t})},value:He}}}),Ye.stateIds.map((function(e,t){return function(e,t,n,o,i,s,l,u){var c=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t;return e[n][r]},p=function(r,o){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t;e[r][i]=o,n(ne({},e))},d=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ce;p("sizes",n);var r=s({virtualDisks:e}),o=r.formattedMaxVDSizes,i=r.maxVirtualDiskSizes;u({inputs:X({},"vd".concat(t,"Size"),{displayMax:"".concat(o[t]),max:i[t],value:n})})},f=function(e){var t=e.value,n=void 0===t?c("inputSizes"):t,r=e.unit,o=void 0===r?c("inputUnits"):r;n!==c("inputSizes")&&p("inputSizes",n),o!==c("inputUnits")&&p("inputUnits",o),(0,x.KY)(n,o,(function(e){return d(e)}),(function(){return d()}))},v=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c("inputStorageGroupUUIDs");t!==c("inputStorageGroupUUIDs")&&p("inputStorageGroupUUIDs",t),s({virtualDisks:e})};return(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column","& > :not(:first-child)":{marginTop:"1em"}},children:[(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"column"},children:(0,r.jsx)(Z,{id:"ps-virtual-disk-size-".concat(t),label:"Virtual disk size",messageBoxProps:c("inputSizeMessages"),inputWithLabelProps:{inputProps:{endAdornment:xe("".concat(c("inputMaxes")," ").concat(c("inputUnits")),{onButtonClick:function(){p("inputSizes",c("inputMaxes")),d(c("maxes"))}}),onChange:function(e){var t=e.target.value;f({value:t})},type:"number",value:c("inputSizes")},inputLabelProps:{isNotifyRequired:c("sizes")===ce}},selectItems:pe,selectWithLabelProps:{selectProps:{onChange:function(e){var t=e.target.value;f({unit:t})},value:c("inputUnits")}}})}),(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"column"},children:(0,r.jsx)(j.Z,{id:"ps-storage-group-".concat(t),label:"Storage group",disableItem:function(e){return!(i.includes(e)&&c("sizes")<=l[e].storageGroupFree)},inputLabelProps:{isNotifyRequired:0===c("inputStorageGroupUUIDs").length},messageBoxProps:c("inputStorageGroupUUIDMessages"),selectItems:o,selectProps:{onChange:function(e){var t=e.target.value;v(t)},onClearIndicatorClick:function(){return v("")},renderValue:function(e){var t,n=null!==(t=l[e])&&void 0!==t?t:{},r=n.anvilName,o=void 0===r?"?":r,i=n.storageGroupName,a=void 0===i?"Unknown (".concat(e,")"):i;return"".concat(a," (").concat(o,")")},value:c("inputStorageGroupUUIDs")}})})]},"ps-virtual-disk-".concat(c("stateIds")))}(Ye,t,Ke,Y,Zt,qt,z,$t)})),(0,r.jsx)(j.Z,{disableItem:function(e){return e===at},hideItem:function(e){return!Pt.includes(e)},id:"ps-install-image",inputLabelProps:{isNotifyRequired:0===et.length},label:"Install ISO",messageBoxProps:rt,selectItems:W,selectProps:{onChange:function(e){var t=e.target.value;Kt(t)},onClearIndicatorClick:function(){return Kt("")},value:et}}),(0,r.jsx)(j.Z,{disableItem:function(e){return e===et},hideItem:function(e){return!Pt.includes(e)},id:"ps-driver-image",label:"Driver ISO",messageBoxProps:lt,selectItems:W,selectProps:{onChange:function(e){var t=e.target.value;Xt(t)},onClearIndicatorClick:function(){return Xt("")},value:at}}),(0,r.jsx)(j.Z,{disableItem:function(e){return!St.includes(e)},id:"ps-anvil",inputLabelProps:{isNotifyRequired:0===ct.length},label:"Anvil node pair",messageBoxProps:ft,selectItems:F,selectProps:{onChange:function(e){var t=e.target.value;en(t)},onClearIndicatorClick:function(){return en("")},renderValue:function(e){var t,n=(null!==(t=I[e])&&void 0!==t?t:{}).anvilName;return void 0===n?"Unknown ".concat(e):n},value:ct}}),(0,r.jsx)(f.Z,{id:"ps-optimize-for-os",extendRenderInput:function(e){var t=e.inputLabelProps;(void 0===t?{}:t).isNotifyRequired=null===xt},isOptionEqualToValue:function(e,t){return e.key===t.key},label:"Optimize for OS",messageBoxProps:bt,noOptionsText:"No matching OS",onChange:function(e,t){gt(t)},openOnFocus:!0,options:_,renderOption:function(e,t){return(0,o.createElement)("li",ne({},e,{key:"ps-optimize-for-os-".concat(t.key),children:[t.label," (",t.key,")"]}))},value:xt})]}):(0,r.jsx)($.Z,{}),(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column",marginTop:"1em","& > :not(:first-child)":{marginTop:"1em"}},children:[Lt>0&&(0,r.jsx)(h.Z,{isAllowClose:!0,text:"Provision server job registered. You can provision another server, or exit; it won't affect the registered job."}),Tt?(0,r.jsx)($.Z,{mt:0}):(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end",width:"100%"},children:(0,r.jsx)(m.Z,{disabled:!$t({isIgnoreOnCallbacks:!0}),onClick:function(){Bt(!0)},sx:me,children:"Provision"})})]})]}),Gt&&(0,r.jsx)(v.Z,{actionProceedText:"Provision",content:(0,r.jsxs)(s.ZP,{container:!0,columns:8,direction:"column",children:[(0,r.jsx)(s.ZP,{direction:"row",item:!0,xs:8,children:(0,r.jsxs)(B.Ac,{children:["Server ",(0,r.jsx)(B.Q0,{text:te})," will be created on anvil node pair"," ",(0,r.jsx)(B.Q0,{text:I[ct].anvilName})," ","with the following properties:"]})}),(0,r.jsxs)(s.ZP,{container:!0,direction:"row",item:!0,xs:8,children:[(0,r.jsx)(s.ZP,{item:!0,xs:2,children:(0,r.jsx)(B.Ac,{text:"CPU"})}),(0,r.jsx)(s.ZP,{item:!0,xs:3,children:(0,r.jsxs)(B.Ac,{children:[(0,r.jsx)(B.Q0,{text:Ie})," core(s)"]})}),(0,r.jsx)(s.ZP,{item:!0,xs:3,children:(0,r.jsxs)(B.Ac,{children:[(0,r.jsx)(B.Q0,{text:we})," core(s) available"]})})]}),(0,r.jsxs)(s.ZP,{container:!0,direction:"row",item:!0,xs:8,children:[(0,r.jsx)(s.ZP,{item:!0,xs:2,children:(0,r.jsx)(B.Ac,{text:"Memory"})}),(0,r.jsx)(s.ZP,{item:!0,xs:3,children:(0,r.jsx)(B.Q0,{text:"".concat(_e," ").concat(He)})}),(0,r.jsx)(s.ZP,{item:!0,xs:3,children:(0,r.jsxs)(B.Ac,{children:[(0,r.jsx)(B.Q0,{text:"".concat(We," ").concat(He)})," ","available"]})})]}),Ye.stateIds.map((function(e,t){var n=Ye.inputMaxes[t],o=Ye.inputSizes[t],i=Ye.inputUnits[t],a=z[Ye.inputStorageGroupUUIDs[t]].storageGroupName;return(0,r.jsxs)(s.ZP,{container:!0,direction:"row",item:!0,xs:8,children:[(0,r.jsx)(s.ZP,{item:!0,xs:2,children:(0,r.jsxs)(B.Ac,{children:["Virtual disk ",(0,r.jsx)(B.Q0,{text:t})]})}),(0,r.jsx)(s.ZP,{item:!0,xs:3,children:(0,r.jsxs)(B.Ac,{children:[(0,r.jsx)(B.Q0,{text:"".concat(o," ").concat(i)})," on"," ",a]})}),(0,r.jsx)(s.ZP,{item:!0,xs:3,children:(0,r.jsxs)(B.Ac,{children:[(0,r.jsx)(B.Q0,{text:"".concat(n," ").concat(i)})," ","available"]})})]},"ps-virtual-disk-".concat(e,"-summary"))})),(0,r.jsxs)(s.ZP,{container:!0,direction:"row",item:!0,xs:8,children:[(0,r.jsx)(s.ZP,{item:!0,xs:2,children:(0,r.jsx)(B.Ac,{text:"Install ISO"})}),(0,r.jsx)(s.ZP,{item:!0,xs:6,children:(0,r.jsx)(B.Q0,{text:w[et].fileName})})]}),(0,r.jsxs)(s.ZP,{container:!0,direction:"row",item:!0,xs:8,children:[(0,r.jsx)(s.ZP,{item:!0,xs:2,children:(0,r.jsx)(B.Ac,{text:"Driver ISO"})}),(0,r.jsx)(s.ZP,{item:!0,xs:6,children:w[at]?(0,r.jsx)(B.Q0,{text:w[at].fileName}):(0,r.jsx)(B.Ac,{text:"none"})})]}),(0,r.jsxs)(s.ZP,{container:!0,direction:"row",item:!0,xs:8,children:[(0,r.jsx)(s.ZP,{item:!0,xs:2,children:(0,r.jsx)(B.Ac,{text:"Optimize for OS"})}),(0,r.jsx)(s.ZP,{item:!0,xs:6,children:(0,r.jsx)(B.Ac,{text:"".concat(null===xt||void 0===xt?void 0:xt.label)})})]})]}),dialogProps:{open:Gt},onCancelAppend:function(){Bt(!1)},onProceedAppend:function(){var e={serverName:te,cpuCores:Ie,memory:ke.toString(),virtualDisks:Ye.stateIds.map((function(e,t){return{storageSize:Ye.sizes[t].toString(),storageGroupUUID:Ye.inputStorageGroupUUIDs[t]}})),installISOFileUUID:et,driverISOFileUUID:at,anvilUUID:ct,optimizeForOS:null===xt||void 0===xt?void 0:xt.key};Nt(!0),d.Z.post("/server",e).then((function(){Nt(!1),Et(Lt+1)})),Bt(!1)},proceedButtonProps:{sx:me},titleText:"Provision ".concat(te,"?")})]})}},1081:function(e,t,n){var r=n(7294);t.Z=function(){var e=(0,r.useRef)(!0);return e.current?(e.current=!1,!0):e.current}},5737:function(e,t,n){n.d(t,{Bh:function(){return o},KY:function(){return i},MU:function(){return a}});var r=n(4490),o=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.fromUnit,o=t.onFailure,i=t.onSuccess,a=t.precision,s=t.toUnit,l=(0,r.gO)(e,{fromUnit:n,precision:a,toUnit:s});if(l){var u=l.value,c=l.unit;try{var p,d,f;null===i||void 0===i||null===(p=i.bigint)||void 0===p||p.call(null,BigInt(u),c),null===i||void 0===i||null===(d=i.number)||void 0===d||d.call(null,parseFloat(u),c),null===i||void 0===i||null===(f=i.string)||void 0===f||f.call(null,u,c)}catch(v){null===o||void 0===o||o.call(null,v,u,c)}}else null===o||void 0===o||o.call(null)},i=function(e,t,n,r){o(e,{fromUnit:t,onFailure:r,onSuccess:{bigint:n},precision:0,toUnit:"B"})},a=function(e){return(0,r._d)(e,{toUnit:"ibyte"})}}}]); |