Local modifications to ClusterLabs/Anvil by Alteeve
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
97 KiB

(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[808],{4173:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/manage-element",function(){return t(8938)}])},4594:function(e,n,t){"use strict";var r=t(5893),o=t(6514),i=t(5113),a=t(4656),u=t(482),c=t(2994),s=t(7357),l=t(9890),d=t(7169),f=t(1363),p=t(6284);function m(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function h(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){m(e,n,t[n])}))}return e}function v(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var y=function(e){return(0,r.jsx)(o.Z,{in:!0,children:(0,r.jsx)(i.Z,h({},e))})};n.Z=function(e){var n=e.componentsProps,t=e.extendRenderInput,o=e.label,i=e.messageBoxProps,b=e.renderInput,g=e.sx,j=v(e,["componentsProps","extendRenderInput","label","messageBoxProps","renderInput","sx"]),x=h({paper:{sx:{backgroundColor:d.lD}}},n),w=null!==b&&void 0!==b?b:function(e){var n=e.fullWidth,i=e.InputProps,a=e.InputLabelProps,u=e.inputProps,c={formControlProps:{fullWidth:n,ref:i.ref},inputLabelProps:a,inputProps:{className:i.className,endAdornment:i.endAdornment,inputProps:u,startAdornment:i.startAdornment},label:o};return null===t||void 0===t||t.call(null,c,e),(0,r.jsx)(p.Z,h({},c))},k=h(m({},"& .".concat(a.Z.root," .").concat(u.Z.endAdornment),m({right:"7px"},"& .".concat(c.Z.root),{color:d.s7})),g);return(0,r.jsxs)(s.Z,{sx:{display:"flex",flexDirection:"column"},children:[(0,r.jsx)(l.Z,h({PaperComponent:y},j,{componentsProps:x,renderInput:w,sx:k})),(0,r.jsx)(f.Z,h({},i))]})}},4629:function(e,n,t){"use strict";var r=t(5893),o=t(7357),i=t(7294),a=t(4188),u=t(4825),c=t(4690),s=t(7504),l=t(4069),d=t(7869),f=t(6284),p=t(2152),m=t(7987),h=t(8859),v=t(2749);function y(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function b(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function g(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){b(e,n,t[n])}))}return e}function j(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function x(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||k(e,n)||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.")}()}function w(e){return function(e){if(Array.isArray(e))return y(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||k(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 k(e,n){if(e){if("string"===typeof e)return y(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?y(e,n):void 0}}var O={width:"100%"},I="gate-input",P="".concat(I,"-credential-id"),Z="".concat(I,"-credential-passphrase"),S="access",A=(0,i.forwardRef)((function(e,n){var t,y,b=e.formContainer,k=void 0===b||b,I=e.gridProps,A=void 0===I?{}:I,M=A.columns,F=void 0===M?{xs:1,sm:2}:M,T=(A.layout,A.spacing),C=void 0===T?"1em":T,U=e.identifierId,N=void 0===U?P:U,E=e.identifierInputTestBatchBuilder,R=void 0===E?m.Gn:E,B=e.identifierLabel,D=e.identifierOutlinedInputWithLabelProps,q=void 0===D?{}:D,L=q.formControlProps,_=void 0===L?{}:L,H=q.inputProps,V=e.onIdentifierBlurAppend,$=e.onSubmit,G=e.onSubmitAppend,z=e.passphraseId,W=void 0===z?Z:z,Q=e.passphraseLabel,Y=e.passphraseOutlinedInputWithLabelProps,J=void 0===Y?{}:Y,K=J.formControlProps,X=void 0===K?{}:K,ee=J.inputProps,ne=e.submitLabel,te=e.allowSubmit,re=void 0===te?k:te,oe=j(e.gridProps,["columns","layout","spacing"]),ie=j(e.identifierOutlinedInputWithLabelProps,["formControlProps","inputProps"]),ae=j(e.passphraseOutlinedInputWithLabelProps,["formControlProps","inputProps"]),ue=_.sx,ce=j(_,["sx"]),se=X.sx,le=j(X,["sx"]),de=(0,i.useRef)({}),fe=(0,i.useRef)({}),pe=(0,i.useRef)({}),me=x((0,v.Z)(!1),2),he=me[0],ve=me[1],ye=(0,h.Z)([P,Z],pe),be=ye.buildFinishInputTestBatchFunction,ge=ye.buildInputFirstRenderFunction,je=ye.buildInputUnmountFunction,xe=ye.isFormInvalid,we=ye.setMessage,ke=(0,i.useMemo)((function(){return null!==$&&void 0!==$?$:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r,o=n[0];o.preventDefault(),we(S),ve(!0);var i=o.target,a=i.elements,u=a.namedItem(P),c=u.value,s=a.namedItem(Z),l=s.value;null===G||void 0===G||(r=G).call.apply(r,[null,c,l,function(e){we(S,e)},ve].concat(w(n)))}}),[$,G,ve,we]),Oe=(0,i.useMemo)((function(){return he?(0,r.jsx)(p.Z,{mt:0}):(0,r.jsx)(c.Z,{row:!0,sx:{justifyContent:"flex-end"},children:(0,r.jsx)(u.Z,{disabled:xe,type:"submit",children:ne})})}),[xe,he,ne]),Ie=(0,i.useMemo)((function(){var e={};return re&&(e["gate-cell-message-group"]={children:(0,r.jsx)(d.Z,{count:1,defaultMessageType:"warning",ref:pe}),sm:2},e["gate-cell-submit"]={children:Oe,sm:2}),e}),[re,Oe]),Pe=(0,i.useMemo)((function(){var e={};return k&&(e.component="form",e.onSubmit=ke),e}),[k,ke]);return(0,i.useImperativeHandle)(n,(function(){return{get:function(){var e,n;return{identifier:null!==(t=null===(e=de.current.getValue)||void 0===e?void 0:e.call(null))&&void 0!==t?t:"",passphrase:null!==(y=null===(n=fe.current.getValue)||void 0===n?void 0:n.call(null))&&void 0!==y?y:""}},messageGroup:g({},pe.current),setIsSubmitting:function(e){ve(e)}}})),(0,r.jsx)(o.Z,g({},Pe,{children:(0,r.jsx)(s.Z,g({columns:F,layout:g({"gate-input-cell-credential-id":{children:(0,r.jsx)(l.Z,{input:(0,r.jsx)(f.Z,g({formControlProps:g({},ce,{sx:g({},O,ue)}),id:N,inputProps:H,label:B},ie)),inputTestBatch:R(B,(function(){we(N)}),{onFinishBatch:be(N)},(function(e){we(N,{children:e})})),onBlurAppend:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r;null===V||void 0===V||(r=V).call.apply(r,[null].concat(w(n)))},onFirstRender:ge(N),onUnmount:je(N),ref:de,required:!0})},"gate-input-cell-credential-passphrase":{children:(0,r.jsx)(l.Z,{input:(0,r.jsx)(f.Z,g({formControlProps:g({},le,{sx:g({},O,se)}),id:W,inputProps:ee,label:Q,type:a.Z.password},ae)),inputTestBatch:(0,m.Gn)(Q,(function(){we(W)}),{onFinishBatch:be(W)},(function(e){we(W,{children:e})})),onFirstRender:ge(W),onUnmount:je(W),ref:fe,required:!0})}},Ie),spacing:C},oe))}))}));A.displayName="GateForm",n.ZP=A},8938:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Ur}});var r=t(5893),o=t(9008),i=t(1163),a=t(7294),u=t(4390);function c(e,n){return null!=n&&"undefined"!==typeof Symbol&&n[Symbol.hasInstance]?n[Symbol.hasInstance](e):e instanceof n}var s=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=n.fallbackValue,r=void 0===t?"":t,o=n.joinSeparator,i=void 0===o?"":o,a=n.limit,u=void 0===a?1:a;return c(e,Array)?e.slice(0,u).join(i):null!==e&&void 0!==e?e:r},l=t(7504),d=t(1770),f=t(8750),p=t(2029),m=t(7357),h=t(4594),v=t(1496),y=t(4386),b=t(4188),g=t(4690),j=t(4069),x=t(6284),w=t(3679),k=t(2519),O=t(480),I=t(2852),P=t(7169),Z=t(7750);function S(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function A(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){S(e,n,t[n])}))}return e}var M=(0,v.ZP)(O.Z)({height:"3.5em",marginLeft:0,width:"100%"}),F=function(e){var n=e.baseInputProps,t=e.checked,o=e.formControlLabelProps,i=e.id,u=e.label,c=e.name,s=e.onChange,l=e.switchProps,d=(0,a.useMemo)((function(){return"string"===typeof u?(0,r.jsx)(Z.Ac,{inheritColour:!0,color:"".concat(P.s7,"AF"),children:u}):(0,r.jsx)(r.Fragment,{children:u})}),[u]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(M,A({componentsProps:{typography:{flexGrow:1}},control:(0,r.jsx)(I.Z,A({checked:t,edge:"end",name:c,onChange:s},l)),label:d,labelPlacement:"start"},o)),(0,r.jsx)("input",A({checked:t,hidden:!0,id:i,readOnly:!0},n))]})},T=t(7987);function C(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function U(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function N(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return C(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return C(e,n)}(e,n)||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 E=["1","on"],R=function(e){var n=e.formUtils,t=n.buildFinishInputTestBatchFunction,r=n.setMessage,o=e.id,i=e.label,a=t(o),u=function(){r(o)};return"ip"===i.toLowerCase()?(0,T._)(i,u,{onFinishBatch:a},(function(e){r(o,{children:e})})):{defaults:{onSuccess:u},onFinishBatch:a,tests:[{test:T.HJ}]}},B=function(e){var n=e.formUtils,t=e.id,o=e.isRequired,i=e.label,a=void 0===i?"":i,u=e.name,c=void 0===u?t:u,s=e.value,l=n.buildFinishInputTestBatchFunction,d=n.buildInputFirstRenderFunction,f=n.setMessage;return(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:t,label:a,name:c,value:s}),inputTestBatch:(0,T.qY)(a,(function(){f(t)}),{onFinishBatch:l(t)},(function(e){f(t,{children:e})})),onFirstRender:d(t),required:o,valueType:"number"},"".concat(t,"-wrapper"))},D={boolean:function(e){var n=e.id,t=e.isChecked,o=void 0!==t&&t,i=e.label,a=e.name,u=void 0===a?n:a;return(0,r.jsx)(j.Z,{input:(0,r.jsx)(F,{checked:o,id:n,label:i,name:u}),valueType:"boolean"},"".concat(n,"-wrapper"))},integer:B,second:B,select:function(e){var n=e.formUtils,t=e.id,o=e.isRequired,i=e.label,a=e.name,u=void 0===a?t:a,c=e.selectOptions,s=void 0===c?[]:c,l=e.value,d=void 0===l?"":l,f=n.buildFinishInputTestBatchFunction,p=n.buildInputFirstRenderFunction,m=n.setMessage;return(0,r.jsx)(j.Z,{input:(0,r.jsx)(k.Z,{id:t,label:i,name:u,selectItems:s,value:d}),inputTestBatch:{defaults:{onSuccess:function(){m(t)}},onFinishBatch:f(t),tests:[{test:T.HJ}]},onFirstRender:p(t),required:o},"".concat(t,"-wrapper"))},string:function(e){var n,t=e.formUtils,o=e.id,i=e.isRequired,a=e.isSensitive,u=void 0!==a&&a,c=e.label,s=void 0===c?"":c,l=e.name,d=void 0===l?o:l,f=e.value,p=t.buildInputFirstRenderFunction;return u&&(n=b.Z.password),(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:o,label:s,name:d,type:n,value:f}),inputTestBatch:R({formUtils:t,id:o,label:s}),onFirstRender:p(o),required:i},"".concat(o,"-wrapper"))}},q=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];return n.join("-")},L=(0,v.ZP)(g.Z)({margin:".4em 0"}),_=function(e){var n=e.fenceId,t=e.fenceParameterTooltipProps,o=e.fenceTemplate,i=e.formUtils,u=e.previousFenceName,c=e.previousFenceParameters,s=i.buildFinishInputTestBatchFunction,l=i.buildInputFirstRenderFunction,d=i.setMessage,f=(0,a.useMemo)((function(){var e;if(o&&n){var a=o[n].parameters,f={};c&&(f=Object.entries(c).reduce((function(e,t){var r=N(t,2),o=r[0],i=r[1];return e[q(n,o)]=i,e}),{}));var p=Object.entries(a).sort((function(e,n){return N(e,1)[0]>N(n,1)[0]?1:-1})).reduce((function(e,o){var a=N(o,2),u=a[0],c=a[1],s=c.content_type,l=c.default,d=c.deprecated,p=c.description,h=c.options,v=c.required;if("1"===String(d))return e;var b,g,j=e.optional,x=e.required,w=null!==(b=D[s])&&void 0!==b?b:D.string,k=q(n,u),O=null!==(g=f[k])&&void 0!==g?g:l,I="1"===String(v),P=/passw/i.test(u),S=w({formUtils:i,id:k,isChecked:E.includes(O),isRequired:I,isSensitive:P,label:u,selectOptions:h,value:O}),A=(0,r.jsx)(y.Z,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){U(e,n,t[n])}))}return e}({componentsProps:{tooltip:{sx:{maxWidth:{md:"62.6em"}}}},disableInteractive:!0,placement:"top-start",title:(0,r.jsx)(Z.Ac,{children:p})},t,{children:(0,r.jsx)(m.Z,{children:S})}),"".concat(k,"-tooltip"));return I?x.push(A):j.push(A),e}),{optional:[],required:[]}),h=p.optional,v=p.required,b=q(n,"name"),k="Fence device name";e=(0,r.jsxs)(g.Z,{sx:{"& > div:first-child":{marginTop:0},"& > div":{marginBottom:0}},children:[(0,r.jsx)(w.TZ,{expandInitially:!0,header:"Required parameters",children:(0,r.jsxs)(L,{children:[(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:b,label:k,name:b,value:u}),inputTestBatch:(0,T.Gn)(k,(function(){d(b)}),{onFinishBatch:s(b)},(function(e){d(b,{children:e})})),onFirstRender:l(b),required:!0},"".concat(b,"-wrapper")),v]})}),(0,r.jsx)(w.TZ,{header:"Optional parameters",children:(0,r.jsx)(L,{children:h})})]})}return e}),[s,l,n,t,o,i,u,c,d]);return(0,r.jsx)(r.Fragment,{children:f})},H=t(2152),V=t(1081);function $(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function G(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function z(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return $(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return $(e,n)}(e,n)||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 W="add-fence-input-agent",Q=function(e){var n=e.fenceTemplate,t=e.formUtils,o=e.loading,i=t.setValidity,u=(0,V.Z)(),c=(0,a.useState)(null),s=c[0],l=c[1],d=(0,a.useMemo)((function(){return n?Object.entries(n).sort((function(e,n){return z(e,1)[0]>z(n,1)[0]?1:-1})).map((function(e){var n=z(e,2),t=n[0],r=n[1].description;return{fenceDescription:"string"===typeof r?r:"No description.",fenceId:t,label:t}})):[]}),[n]),f=(0,a.useMemo)((function(){return(0,r.jsx)(h.Z,{id:W,isOptionEqualToValue:function(e,n){return e.fenceId===n.fenceId},label:"Fence device type",onChange:function(e,n){i(W,null!==n),l(n)},openOnFocus:!0,options:d,renderOption:function(e,n,t){var o=n.fenceDescription,i=n.fenceId,a=t.selected;return(0,r.jsxs)(m.Z,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){G(e,n,t[n])}))}return e}({component:"li",sx:{display:"flex",flexDirection:"column","& > *":{width:"100%"}}},e,{children:[(0,r.jsx)(Z.Ac,{inverted:!0,sx:{fontSize:"1.2em",fontWeight:a?400:void 0},children:i}),(0,r.jsx)(Z.Ac,{selected:!1,children:o})]}))},sx:{marginTop:".3em"},value:s})}),[d,s,i]),p=(0,a.useMemo)((function(){return(0,r.jsx)(_,{fenceId:null===s||void 0===s?void 0:s.fenceId,fenceTemplate:n,formUtils:t})}),[n,null===s||void 0===s?void 0:s.fenceId,t]),v=(0,a.useMemo)((function(){return o?(0,r.jsx)(H.Z,{}):(0,r.jsxs)(g.Z,{children:[f,p]})}),[f,p,o]);return(0,a.useEffect)((function(){u&&i(W,null!==s)}),[s,u,i]),(0,r.jsx)(r.Fragment,{children:v})},Y=t(157),J=function(e){var n=e.fenceId,t=e.fenceTemplate,o=e.formUtils,i=e.loading,u=e.previousFenceName,c=e.previousFenceParameters,s=(0,a.useMemo)((function(){return i?(0,r.jsx)(H.Z,{}):(0,r.jsx)(_,{fenceId:n,fenceTemplate:t,formUtils:o,previousFenceName:u,previousFenceParameters:c})}),[t,n,o,i,u,c]);return(0,r.jsx)(r.Fragment,{children:s})},K=t(2545),X=t(8610),ee=t(6125),ne=t(7869),te=t(1905),re=t(3906),oe=t(6632),ie=t(8859),ae=t(2749);function ue(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function ce(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function se(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){ce(e,n,t[n])}))}return e}function le(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return ue(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ue(e,n)}(e,n)||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 de=function(e){var n=e.id,t=new RegExp("^(fence[^-]+)".concat("-","([^\\s]+)$")),r=n.match(t);if(!r)throw Error("Not target input element");return r},fe=function(e,n,t){if("name"===e)throw n.name=t,Error("Not child parameter")},pe=function(e){if(!e)throw Error("Not parameter specification")},me=function(e,n){if([n,"",null,void 0].some((function(n){return e===n})))throw Error("Skippable parameter value")},he=function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];var o=le(t,1),i=o[0].target,a=i.elements;return Object.values(a).reduce((function(n,t){try{var r=le(de(t),3),o=r[1],i=r[2];n.agent=o;var a=t,u=a.checked,c=a.value;fe(i,n,c);var s=e[o].parameters[i];pe(s);var l=s.content_type,d=s.default,f=c;"boolean"===l&&(f=u?"1":""),me(f,d),n.parameters[i]=f}catch(p){return n}return n}),{agent:"",name:"",parameters:{}})},ve=function(){var e=(0,V.Z)(),n=(0,a.useRef)({}),t=(0,a.useRef)({}),o=(0,a.useRef)({}),i=le((0,oe.Z)(),2),c=i[0],s=i[1],l=le((0,oe.Z)(),2),f=l[0],m=l[1],h=le((0,ae.Z)(void 0),2),v=h[0],y=h[1],b=(0,a.useState)(!1),j=b[0],x=b[1],k=le((0,ae.Z)(!0),2),O=k[0],I=k[1],P=(0,te.Z)("".concat(p.Z,"/fence"),{refreshInterval:6e4}),S=P.data,A=P.isLoading,M=(0,ie.Z)([W],o),F=M.isFormInvalid,T=M.isFormSubmitting,C=M.submitForm,U=(0,re.Z)({list:S}),N=U.buildDeleteDialogProps,E=U.checks,R=U.getCheck,B=U.hasChecks,D=U.setCheck,q=(0,a.useCallback)((function(e){var n=e.cap,t=e.depth,r=e.key;return 0===t?n(r):r}),[]),L=(0,a.useMemo)((function(){return(0,r.jsx)(ee.Z,{allowEdit:!0,allowItemButton:j,disableDelete:!B,edit:j,header:!0,listItems:S,onAdd:function(){var e;m({actionProceedText:"Add",content:(0,r.jsx)(Q,{fenceTemplate:v,formUtils:M}),onSubmitAppend:function(e){var t;if(v){var o=he(v,e),i=o.agent,a=o.name;s({actionProceedText:"Add",content:(0,r.jsx)(X.Z,{entries:o,hasPassword:!0,getEntryLabel:q}),onProceedAppend:function(){C({body:o,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to add fence device. ",e]})},method:"post",successMsg:"Added fence device ".concat(a),url:"/fence"})},titleText:(0,r.jsxs)(Z.z,{children:["Add a"," ",(0,r.jsx)(Z.Q0,{fontSize:"inherit",children:i})," ","fence device with the following parameters?"]})}),null===(t=n.current.setOpen)||void 0===t||t.call(null,!0)}},titleText:"Add a fence device"}),null===(e=t.current.setOpen)||void 0===e||e.call(null,!0)},onDelete:function(){var e;s(N({getConfirmDialogTitle:function(e){return"Delete ".concat(e," fence device(s)?")},onProceedAppend:function(){C({body:{uuids:E},getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to delete fence device(s). ",e]})},method:"delete",url:"/fence"})},renderEntry:function(e){var n=e.key;return(0,r.jsx)(Z.Ac,{children:null===S||void 0===S?void 0:S[n].fenceName})}})),null===(e=n.current.setOpen)||void 0===e||e.call(null,!0)},onEdit:function(){x((function(e){return!e}))},onItemCheckboxChange:function(e,n,t){D(e,t)},onItemClick:function(e){var o,i=e.fenceAgent,a=e.fenceName,u=e.fenceParameters,c=e.fenceUUID;m({actionProceedText:"Update",content:(0,r.jsx)(J,{fenceId:i,fenceTemplate:v,formUtils:M,previousFenceName:a,previousFenceParameters:u}),onSubmitAppend:function(e){var t;if(v){var o=he(v,e);s({actionProceedText:"Update",content:(0,r.jsx)(X.Z,{entries:o,hasPassword:!0,getEntryLabel:q}),onProceedAppend:function(){C({body:o,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to update fence device. ",e]})},method:"put",successMsg:"Updated fence device ".concat(a),url:"/fence/".concat(c)})},titleText:(0,r.jsxs)(Z.z,{children:["Update"," ",(0,r.jsx)(Z.Q0,{fontSize:"inherit",children:a})," ","fence device with the following parameters?"]})}),null===(t=n.current.setOpen)||void 0===t||t.call(null,!0)}},titleText:(0,r.jsxs)(Z.z,{children:["Update fence device"," ",(0,r.jsx)(Z.Q0,{fontSize:"inherit",children:a})," ","parameters"]})}),null===(o=t.current.setOpen)||void 0===o||o.call(null,!0)},renderListItemCheckboxState:function(e){return R(e)},renderListItem:function(e,n){var t=n.fenceAgent,o=n.fenceName,i=n.fenceParameters;return(0,r.jsxs)(g.Z,{row:!0,children:[(0,r.jsx)(Z.Ac,{children:o}),(0,r.jsx)(Z.Ac,{children:Object.entries(i).reduce((function(e,n){var t=le(n,2),o=t[0],i=t[1],a=(0,r.jsxs)(r.Fragment,{children:[o,'="']});return a=/passw/i.test(o)?(0,r.jsxs)(r.Fragment,{children:[a,(0,r.jsx)(Z.PJ,{inline:!0,children:i})]}):(0,r.jsxs)(r.Fragment,{children:[a,i]}),(0,r.jsxs)(r.Fragment,{children:[e," ",a,'"']})}),t)})]})}})}),[N,E,S,v,M,R,q,B,j,D,s,m,C]),_=(0,a.useMemo)((function(){return O||A?(0,r.jsx)(H.Z,{}):L}),[A,O,L]),$=(0,a.useMemo)((function(){return(0,r.jsx)(ne.Z,{count:1,defaultMessageType:"warning",ref:o})}),[]);return e&&u.Z.get("/fence/template").then((function(e){var n=e.data;y(n)})).catch((function(e){(0,d.Z)(e)})).finally((function(){I(!1)})),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(w.s_,{children:[(0,r.jsx)(w.V9,{children:(0,r.jsx)(Z.z,{children:"Manage fence devices"})}),_]}),(0,r.jsx)(K.Z,se({dialogProps:{PaperProps:{sx:{minWidth:{xs:"90%",md:"50em"}}}},scrollBoxProps:{padding:".3em .5em"}},f,{disableProceed:F,loadingAction:T,preActionArea:$,ref:t,scrollContent:!0,showClose:!0})),(0,r.jsx)(Y.Z,se({closeOnProceed:!0,scrollBoxProps:{paddingRight:"1em"}},c,{ref:n,scrollContent:!0}))]})};function ye(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function be(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ge(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){be(e,n,t[n])}))}return e}function je(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return ye(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return ye(e,n)}(e,n)||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 xe,we="an-host-input",ke="".concat(we,"-cell"),Oe="IPMI IP",Ie=(be(xe={},"fence",(function(e,n){var t=n.dataset,r=t.hostId,o=void 0===r?"":r,i=t.fenceId,a=void 0===i?"":i,u=t.fenceName,c=void 0===u?"":u,s=n.value,l=e.hostConfig.hosts[o],d=l.fences,f=void 0===d?{}:d;f[a]={fenceName:c,fencePort:s},l.fences=f})),be(xe,"host",(function(e,n){var t=n.dataset,r=t.hostId,o=void 0===r?"":r,i=t.hostNumber,a=void 0===i?"":i,u=t.hostType,c=void 0===u?"":u,s=Number.parseInt(a,10);e.hostConfig.hosts[o]={hostNumber:s,hostType:c}})),be(xe,"ipmi",(function(e,n){var t=n.dataset.hostId,r=void 0===t?"":t,o=n.value;e.hostConfig.hosts[r].ipmiIp=o})),be(xe,"network",(function(e,n){var t=n.dataset,r=t.hostId,o=void 0===r?"":r,i=t.networkId,a=void 0===i?"":i,u=t.networkNumber,c=void 0===u?"":u,s=t.networkType,l=void 0===s?"":s,d=n.value,f=e.hostConfig.hosts[o],p=f.networks,m=void 0===p?{}:p,h=Number.parseInt(c,10);m[a]={networkIp:d,networkNumber:h,networkType:l},f.networks=m})),be(xe,"ups",(function(e,n){var t=n.checked,r=n.dataset,o=r.hostId,i=void 0===o?"":o,a=r.upsId,u=void 0===a?"":a,c=r.upsName,s=void 0===c?"":c,l=e.hostConfig.hosts[i],d=l.upses,f=void 0===d?{}:d;f[u]={isUsed:t,upsName:s},l.upses=f})),xe),Pe={xs:1,sm:2,md:3},Ze=function(e){var n=e.formUtils,t=n.buildFinishInputTestBatchFunction,o=n.buildInputFirstRenderFunction,i=n.buildInputUnmountFunction,u=n.setMessage,c=e.hostId,s=e.hostNumber,d=e.hostType,f=e.previous,p=void 0===f?{}:f,m=p.fences,h=void 0===m?{}:m,v=p.ipmiIp,y=p.networks,b=void 0===y?{}:y,k=p.upses,O=void 0===k?{}:k,I=e.hostLabel,P=void 0===I?"".concat(d.replace("node","subnode")," ").concat(s):I,S=(0,a.useMemo)((function(){return Object.entries(h)}),[h]),A=(0,a.useMemo)((function(){return Object.entries(b)}),[b]),M=(0,a.useMemo)((function(){return Object.entries(O)}),[O]),C=(0,a.useMemo)((function(){return Boolean(M.length)}),[M.length]),U=(0,a.useMemo)((function(){return"".concat(we,"-").concat(c)}),[c]),N=(0,a.useMemo)((function(){return function(e){return"".concat(we,"-").concat(e,"-ipmi-ip")}(c)}),[c]),E=(0,a.useMemo)((function(){return"".concat(ke,"-").concat(c,"-ipmi-ip")}),[c]),R=(0,a.useMemo)((function(){return S.reduce((function(e,n){var i=je(n,2),a=i[0],s=i[1],l=s.fenceName,d=s.fencePort,f="".concat(ke,"-").concat(c,"-").concat(a,"-port"),p=function(e,n){return"".concat(we,"-").concat(e,"-").concat(n,"-port")}(c,a),m="Port on ".concat(l);return e[f]={children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"fence","data-host-id":c,"data-fence-id":a,"data-fence-name":l},id:p,label:m,value:d}),inputTestBatch:(0,T.Gn)("".concat(c," ").concat(m),(function(){u(p)}),{onFinishBatch:t(p)},(function(e){u(p,{children:e})})),onFirstRender:o(p),required:!0})},e}),{})}),[t,o,S,c,u]),B=(0,a.useMemo)((function(){return A.reduce((function(e,n){var a=je(n,2),s=a[0],l=a[1],d=l.networkIp,f=l.networkNumber,p=l.networkType,m="".concat(ke,"-").concat(c,"-").concat(s,"-ip"),h=function(e,n){return"".concat(we,"-").concat(e,"-").concat(n,"-ip")}(c,s),v="".concat(p.toUpperCase()," ").concat(f," IP");return e[m]={children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"network","data-host-id":c,"data-network-id":s,"data-network-number":f,"data-network-type":p},id:h,label:v,value:d}),inputTestBatch:(0,T._)("".concat(c," ").concat(v),(function(){u(h)}),{onFinishBatch:t(h)},(function(e){u(h,{children:e})})),onFirstRender:o(h),onUnmount:i(h),required:!0})},e}),{})}),[A,c,t,o,i,u]),D=(0,a.useMemo)((function(){return M.reduce((function(e,n){var t=je(n,2),o=t[0],i=t[1],a=i.isUsed,u=i.upsName,s="".concat(ke,"-").concat(c,"-").concat(o,"-power-host"),l=function(e,n){return"".concat(we,"-").concat(e,"-").concat(n,"-power-host")}(c,o),d="Uses ".concat(u);return e[s]={children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(F,{baseInputProps:{"data-handler":"ups","data-host-id":c,"data-ups-id":o,"data-ups-name":u},checked:a,id:l,label:d}),valueType:"boolean"})},e}),{})}),[c,M]),q=(0,a.useMemo)((function(){return C&&(0,r.jsx)(l.Z,{columns:Pe,layout:D,spacing:"1em"})}),[C,D]);return(0,r.jsxs)(w.Lg,{mv:0,children:[(0,r.jsx)(w.CH,{children:(0,r.jsx)(Z.Ac,{children:P})}),(0,r.jsxs)(w.bc,{children:[(0,r.jsx)("input",{hidden:!0,id:U,readOnly:!0,"data-handler":"host","data-host-id":c,"data-host-number":s,"data-host-type":d}),(0,r.jsxs)(g.Z,{children:[(0,r.jsx)(l.Z,{columns:Pe,layout:ge({},B,be({},E,{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"ipmi","data-host-id":c},id:N,label:Oe,value:v}),inputTestBatch:(0,T._)("".concat(c," ").concat(Oe),(function(){u(N)}),{onFinishBatch:t(N)},(function(e){u(N,{children:e})})),onFirstRender:o(N),onUnmount:i(N),required:!0})}),R),spacing:"1em"}),q]})]})]})};function Se(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Ae(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return Se(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Se(e,n)}(e,n)||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 Me="".concat("an-host-config-input","-group"),Fe="".concat(Me,"-cell"),Te={node1:{hostNumber:1,hostType:"node"},node2:{hostNumber:2,hostType:"node"}},Ce=function(e){var n=e.formUtils,t=e.knownFences,o=void 0===t?{}:t,i=e.knownUpses,u=void 0===i?{}:i,c=e.networkListEntries,s=e.previous,d=(void 0===s?{}:s).hosts,f=void 0===d?Te:d,p=(0,a.useMemo)((function(){return Object.entries(f)}),[f]),m=(0,a.useMemo)((function(){return Object.values(o)}),[o]),h=(0,a.useMemo)((function(){return Object.values(u)}),[u]),v=(0,a.useMemo)((function(){return p.reduce((function(e,t){var o=Ae(t,2),i=o[0],a=o[1],u=a.fences,s=void 0===u?{}:u,l=a.hostNumber,d=a.hostType,f=a.ipmiIp,p=a.networks,v=void 0===p?{}:p,y=a.upses,b=void 0===y?{}:y,g=m.reduce((function(e,n){var t=n.fenceName,r=s[t],o=(void 0===r?{}:r).fencePort,i=void 0===o?"":o;return e[t]={fenceName:t,fencePort:i},e}),{}),j=c.reduce((function(e,n){var t=Ae(n,2),r=t[0],o=t[1],i=o.networkNumber,a=o.networkType,u=v[r],c=(void 0===u?{}:u).networkIp,s=void 0===c?"":c;return e[r]={networkIp:s,networkNumber:i,networkType:a},e}),{}),x=h.reduce((function(e,n){var t=n.upsName,r=b[t],o=(void 0===r?{}:r).isUsed,i=void 0===o||o;return e[t]={isUsed:i,upsName:t},e}),{});return e["".concat(Fe,"-").concat(i)]={children:(0,r.jsx)(Ze,{formUtils:n,hostId:i,hostNumber:l,hostType:d,previous:{fences:g,ipmiIp:f,networks:j,upses:x}}),md:3,sm:2},e}),{})}),[n,p,m,h,c]);return(0,r.jsx)(l.Z,{columns:{xs:1,sm:2,md:3},layout:v,spacing:"1em"})},Ue="an-id-input",Ne="".concat(Ue,"-domain"),Ee="".concat(Ue,"-prefix"),Re="".concat(Ue,"-sequence"),Be="Domain name",De="Prefix",qe="Sequence",Le=function(e){var n=e.formUtils,t=n.buildFinishInputTestBatchFunction,o=n.buildInputFirstRenderFunction,i=n.setMessage,a=e.previous,u=void 0===a?{}:a,c=u.domain,s=u.prefix,d=u.sequence;return(0,r.jsx)(l.Z,{columns:{xs:1,sm:2,md:3},layout:{"an-id-input-cell-prefix":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:Ee,label:De,value:s}),inputTestBatch:(0,T.Gn)(De,(function(){i(Ee)}),{onFinishBatch:t(Ee)},(function(e){i(Ee,{children:e})})),onFirstRender:o(Ee),required:!0})},"an-id-input-cell-domain":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:Ne,label:Be,value:c}),inputTestBatch:(0,T.Gn)(Be,(function(){i(Ne)}),{onFinishBatch:t(Ne)},(function(e){i(Ne,{children:e})})),onFirstRender:o(Ne),required:!0})},"an-id-input-cell-sequence":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:Re,label:qe,value:d}),inputTestBatch:(0,T.qY)(qe,(function(){i(Re)}),{onFinishBatch:t(Re)},(function(e){i(Re,{children:e})})),onFirstRender:o(Re),required:!0,valueType:"number"})}},spacing:"1em"})},_e=t(5934),He=t(3106),Ve=t(1706);function $e(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Ge(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function ze(e){return function(e){if(Array.isArray(e))return $e(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"===typeof e)return $e(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return $e(e,n)}(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 We="an-network-input",Qe="".concat(We,"-cell"),Ye={gateway:function(e,n){var t=n.dataset.networkId,r=void 0===t?"":t,o=n.value;e.networkConfig.networks[r].networkGateway=o},minip:function(e,n){var t=n.dataset.networkId,r=void 0===t?"":t,o=n.value;e.networkConfig.networks[r].networkMinIp=o},network:function(e,n){var t=n.dataset,r=t.networkId,o=void 0===r?"":r,i=t.networkNumber,a=void 0===i?"":i,u=t.networkType,c=void 0===u?"":u,s=e.networkConfig.networks,l=Number.parseInt(a,10);s[o]={networkNumber:l,networkType:c}},subnetmask:function(e,n){var t=n.dataset.networkId,r=void 0===t?"":t,o=n.value;e.networkConfig.networks[r].networkSubnetMask=o}},Je=function(e){var n,t=e.formUtils,o=t.buildFinishInputTestBatchFunction,i=t.buildInputFirstRenderFunction,u=t.buildInputUnmountFunction,c=t.setMessage,s=e.inputGatewayLabel,d=void 0===s?"Gateway":s,f=e.inputMinIpLabel,p=void 0===f?"IP address":f,m=e.inputSubnetMaskLabel,h=void 0===m?"Subnet mask":m,v=e.networkId,y=e.networkNumber,b=e.networkType,g=e.networkTypeOptions,O=e.onClose,I=e.onNetworkTypeChange,P=e.previous,Z=void 0===P?{}:P,S=Z.gateway,A=Z.minIp,M=Z.subnetMask,F=e.readonlyNetworkName,C=e.showCloseButton,U=e.showGateway,N=(0,a.useMemo)((function(){return"".concat(He.Z[b]," ").concat(y)}),[y,b]),E=(0,a.useMemo)((function(){return"".concat(Qe,"-").concat(v,"-gateway")}),[v]),R=(0,a.useMemo)((function(){return"".concat(Qe,"-").concat(v,"-ip")}),[v]),B=(0,a.useMemo)((function(){return"".concat(Qe,"-").concat(v,"-subnet-mask")}),[v]),D=(0,a.useMemo)((function(){return"".concat(We,"-").concat(v)}),[v]),q=(0,a.useMemo)((function(){return function(e){return"".concat(We,"-").concat(e,"-gateway")}(v)}),[v]),L=(0,a.useMemo)((function(){return function(e){return"".concat(We,"-").concat(e,"-min-ip")}(v)}),[v]),_=(0,a.useMemo)((function(){return function(e){return"".concat(We,"-").concat(e,"-network-type")}(v)}),[v]),H=(0,a.useMemo)((function(){return function(e){return"".concat(We,"-").concat(e,"-subnet-mask")}(v)}),[v]),V=(0,a.useMemo)((function(){return U?void 0:"none"}),[U]),$=(0,a.useMemo)((function(){return C&&(0,r.jsx)(Ve.Z,{mapPreset:"close",iconProps:{fontSize:"small"},onClick:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r;null===O||void 0===O||(r=O).call.apply(r,[null,{networkId:v,networkType:b}].concat(ze(n)))},sx:{padding:".2em",position:"absolute",right:"-.6rem",top:"-.2rem"}})}),[C,v,b,O]),G=(0,a.useMemo)((function(){var e;return U&&q&&(e=(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"gateway","data-network-id":v},id:q,label:d,value:S}),inputTestBatch:(0,T._)("".concat(N," ").concat(d),(function(){c(q)}),{onFinishBatch:o(q)},(function(e){c(q,{children:e})})),onFirstRender:i(q),onUnmount:u(q),required:U})),e}),[U,q,v,d,S,N,o,i,u,c]);return(0,r.jsxs)(w.Lg,{mv:0,children:[(0,r.jsxs)(w.CH,{children:[(0,r.jsx)(j.Z,{input:(0,r.jsx)(k.Z,{id:_,isReadOnly:F,onChange:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r;null===I||void 0===I||(r=I).call.apply(r,[null,{networkId:v,networkType:b}].concat(ze(n)))},selectItems:g,selectProps:{renderValue:function(){return N}},value:b})}),$]}),(0,r.jsxs)(w.bc,{children:[(0,r.jsx)("input",{hidden:!0,id:D,readOnly:!0,"data-handler":"network","data-network-id":v,"data-network-number":y,"data-network-type":b}),(0,r.jsx)(l.Z,{layout:(n={},Ge(n,R,{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"minip","data-network-id":v},id:L,label:p,value:A}),inputTestBatch:(0,T._)("".concat(N," ").concat(p),(function(){c(L)}),{onFinishBatch:o(L)},(function(e){c(L,{children:e})})),onFirstRender:i(L),onUnmount:u(L),required:!0})}),Ge(n,B,{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{baseInputProps:{"data-handler":"subnetmask","data-network-id":v},id:H,label:h,value:M}),inputTestBatch:(0,T._)("".concat(N," ").concat(h),(function(){c(H)}),{onFinishBatch:o(H)},(function(e){c(H,{children:e})})),onFirstRender:i(H),onUnmount:u(H),required:!0})}),Ge(n,E,{children:G,display:V}),n),spacing:"1em"})]})]})},Ke=t(6607);function Xe(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function en(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function nn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){en(e,n,t[n])}))}return e}function tn(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return Xe(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Xe(e,n)}(e,n)||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 rn="an-network-config-input",on="".concat(rn,"-cell"),an="".concat(rn,"-dns"),un="".concat(rn,"-mtu"),cn="".concat(rn,"-ntp"),sn=Object.entries(He.Z),ln=function(e){return"ifn"===e},dn=function(e){var n=e.formUtils,t=e.networkListEntries,o=e.previous,i=void 0===o?{}:o,u=i.dnsCsv,c=void 0===u?"8.8.8.8,8.8.4.4":u,s=i.mtu,d=i.ntpCsv,f=e.setNetworkList,p=n.buildFinishInputTestBatchFunction,m=n.buildInputFirstRenderFunction,h=n.setMessage,v=n.setMessageRe,y=(0,a.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.input,o=void 0===r?t:r,i=n.end,a=void 0===i?t.length:i,u=a-1,c=0;return o.every((function(n,t){return tn(n,2)[1].networkType===e&&(c+=1),t<u})),c}),[t]),b=(0,a.useMemo)((function(){return sn.map((function(e){var n=tn(e,2),t=n[0];return{displayValue:n[1],value:t}}))}),[]),g=(0,a.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.networkMinIp,t=void 0===n?"":n,r=e.networkSubnetMask,o=void 0===r?"":r,i=e.networkType,a=void 0===i?"ifn":i,u=e.networkGateway,c=void 0===u?ln(a)?"":void 0:u,s=e.networkNumber,l=void 0===s?y(a)+1:s;return{network:{networkGateway:c,networkMinIp:t,networkNumber:l,networkSubnetMask:o,networkType:a},networkId:(0,_e.Z)()}}),[y]),w=(0,a.useCallback)((function(e,n){return f((0,Ke.ZP)(e,n))}),[f]),k=(0,a.useCallback)((function(e,n){var r=e.networkId,o=e.networkType,i=n.target.value,a=String(i),u=!1,c=0,s=t.reduce((function(e,n){var t=tn(n,2),i=t[0],s=t[1],l=s.networkNumber,d=s.networkType;i===r&&(u=!0,d=a,v(RegExp(i)));var f=d===a;return f&&(c+=1),u?(f?l=c:d===o&&(l-=1),e[i]=nn({},s,{networkNumber:l,networkType:d})):e[i]=s,e}),{});f(s)}),[t,v,f]),O=(0,a.useCallback)((function(e){var n=e.networkId,r=e.networkType,o=!1,i=0,a=t.reduce((function(e,t){var a=tn(t,2),u=a[0],c=a[1];u===n?o=!0:(c.networkType===r&&(i+=1),e[u]=o?nn({},c,{networkNumber:i}):c);return e}),{});f(a)}),[t,f]),I=(0,a.useMemo)((function(){var e={};return e=t.reduce((function(e,t){var o=tn(t,2),i=o[0],a=o[1],u=a.networkGateway,c=a.networkMinIp,s=a.networkNumber,l=a.networkSubnetMask,d=a.networkType,f="".concat(on,"-").concat(i),p=1===s,m=ln(d),h="mn"===d||!p;return e[f]={children:(0,r.jsx)(Je,{formUtils:n,networkId:i,networkNumber:s,networkType:d,networkTypeOptions:b,onClose:O,onNetworkTypeChange:k,previous:{gateway:u,minIp:c,subnetMask:l},readonlyNetworkName:!h,showCloseButton:h,showGateway:m}),md:3,sm:2},e}),e)}),[n,t,b,O,k]);return(0,r.jsx)(l.Z,{columns:{xs:1,sm:2,md:3},layout:nn({},I,{"an-network-config-cell-add-network":{children:(0,r.jsx)(Ve.Z,{mapPreset:"add",onClick:function(){var e=g(),n=e.network,t=e.networkId;w(t,n)}}),display:"flex",justifyContent:"center",md:3,sm:2},"an-network-config-input-cell-dns":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:an,label:"DNS",value:c}),inputTestBatch:(0,T.dg)("DNS",(function(){h(an)}),{onFinishBatch:p(an)},(function(e){h(an,{children:e})})),onFirstRender:m(an),required:!0})},"an-network-config-input-cell-ntp":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:cn,label:"NTP",value:d}),inputTestBatch:(0,T.dg)("NTP",(function(){h(cn)}),{onFinishBatch:p(cn)},(function(e){h(cn,{children:e})})),onFirstRender:m(cn)})},"an-network-config-input-cell-mtu":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:un,inputProps:{placeholder:"1500"},label:"MTU",value:s}),inputTestBatch:(0,T.qY)("MTU",(function(){h(un)}),{onFinishBatch:p(un)},(function(e){h(un,{children:e})})),onFirstRender:m(un),valueType:"number"})}}),spacing:"1em"})};function fn(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var pn={bcn1:{networkMinIp:"10.201.0.0",networkNumber:1,networkSubnetMask:"255.255.0.0",networkType:"bcn"},sn1:{networkMinIp:"10.101.0.0",networkNumber:1,networkSubnetMask:"255.255.0.0",networkType:"sn"},ifn1:{networkMinIp:"",networkNumber:1,networkSubnetMask:"",networkType:"ifn"}},mn=function(e){var n=e.formUtils,t=e.knownFences,o=e.knownUpses,i=e.previous,u=void 0===i?{}:i,c=u.hostConfig,s=u.networkConfig,l=void 0===s?{}:s,d=fn(e.previous,["hostConfig","networkConfig"]),f=l.networks,p=void 0===f?pn:f,m=(0,a.useState)(p),h=m[0],v=m[1],y=(0,a.useMemo)((function(){return Object.entries(h)}),[h]);return(0,r.jsxs)(g.Z,{children:[(0,r.jsx)(Le,{formUtils:n,previous:d}),(0,r.jsx)(dn,{formUtils:n,networkListEntries:y,previous:l,setNetworkList:v}),(0,r.jsx)(Ce,{formUtils:n,knownFences:t,knownUpses:o,networkListEntries:y,previous:c})]})},hn=function(e){var n=e.formUtils,t=e.knownFences,o=e.knownUpses,i=e.previous;return(0,r.jsx)(mn,{formUtils:n,knownFences:t,knownUpses:o,previous:i})};function vn(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function yn(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function bn(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){yn(e,n,t[n])}))}return e}function gn(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return vn(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return vn(e,n)}(e,n)||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 jn="run-manifest-input",xn="".concat(jn,"-host"),wn="".concat(jn,"-an-description"),kn="".concat(jn,"-an-password"),On="".concat(jn,"-an-confirm-password"),In="Description",Pn="Password",Zn="Confirm password",Sn="--",An=(0,v.ZP)(Z.$_)({justifyContent:"end"}),Mn=function(e){return"".concat(xn,"-").concat(e)},Fn=function(e){var n=e.formUtils,t=n.buildFinishInputTestBatchFunction,o=n.buildInputFirstRenderFunction,i=n.setMessage,u=e.knownFences,c=void 0===u?{}:u,s=e.knownHosts,d=void 0===s?{}:s,f=e.knownUpses,p=void 0===f?{}:f,m=e.previous,h=void 0===m?{}:m,v=h.domain,y=h.hostConfig,w=void 0===y?{}:y,O=h.networkConfig,I=void 0===O?{}:O,P=(0,a.useRef)({}),S=w.hosts,A=void 0===S?{}:S,M=I.dnsCsv,F=I.mtu,C=I.networks,U=void 0===C?{}:C,N=I.ntpCsv,E=void 0===N?Sn:N,R=(0,a.useMemo)((function(){return Object.entries(A)}),[A]),B=(0,a.useMemo)((function(){return Object.entries(c)}),[c]),D=(0,a.useMemo)((function(){return Object.entries(d)}),[d]),q=(0,a.useMemo)((function(){return Object.entries(p)}),[p]),L=(0,a.useMemo)((function(){return Object.entries(U)}),[U]),_=(0,a.useMemo)((function(){return D.map((function(e){var n=gn(e,2)[1];return{displayValue:n.hostName,value:n.hostUUID}}))}),[D]),H=(0,a.useMemo)((function(){return R.reduce((function(e,n){var a=gn(n,2),u=a[0],c=a[1],s=c.hostName,l=c.hostNumber,d=c.hostType,f=e.headers,p=e.hosts,m=e.hostNames,h="".concat(d.replace("node","subnode")," ").concat(l);f["run-manifest-column-header-cell-".concat(u)]={children:(0,r.jsx)(Z.Ac,{children:h})};var y=Mn(u),b="".concat(h," host");return p["run-manifest-host-cell-".concat(u)]={children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(k.Z,{id:y,label:b,selectItems:_,value:""}),inputTestBatch:(0,T.Gn)(b,(function(){i(y)}),{onFinishBatch:t(y)},(function(e){i(y,{children:e})})),onFirstRender:o(y),required:!0})},m["run-manifest-new-host-name-cell-".concat(u)]={children:(0,r.jsxs)(Z.$_,{children:[s,".",v]})},e}),{headers:{"run-manifest-column-header-cell-offset":{}},hosts:{"run-manifest-host-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"Uses host"})}},hostNames:{"run-manifest-new-host-name-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"New hostname"})}}})}),[v,t,o,R,_,i]),V=H.headers,$=H.hosts,G=H.hostNames,z=(0,a.useMemo)((function(){return L.reduce((function(e,n){var t=gn(n,2),o=t[0],i=t[1],a=i.networkGateway,u=i.networkNumber,c=i.networkType,s=e.gateway,l=e.hostNetworks,d="run-manifest-host-network-cell-".concat(o),f="".concat(c.toUpperCase()).concat(u);l["".concat(d,"-header")]={children:(0,r.jsx)(Z.Ac,{children:f})},R.forEach((function(e){var n=gn(e,2),t=n[0],i=n[1].networks,a=(void 0===i?{}:i)[o],u=(void 0===a?{}:a).networkIp,c=void 0===u?Sn:u;l["".concat(d,"-").concat(t,"-ip")]={children:(0,r.jsx)(Z.$_,{children:c})}}));var p="run-manifest-gateway-cell";return a&&!s[p]&&(s[p]={children:(0,r.jsx)(An,{children:a})}),e}),{gateway:{"run-manifest-gateway-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"Gateway"})}},hostNetworks:{}})}),[R,L]),W=z.gateway,Q=z.hostNetworks,Y=(0,a.useMemo)((function(){return B.reduce((function(e,n){var t=gn(n,2),o=t[0],i=t[1].fenceName,a="run-manifest-fence-cell-".concat(o);return e["".concat(a,"-header")]={children:(0,r.jsxs)(Z.Ac,{children:["Port on ",i]})},R.forEach((function(n){var t=gn(n,2),o=t[0],u=t[1].fences,c=(void 0===u?{}:u)[i],s=(void 0===c?{}:c).fencePort,l=void 0===s?Sn:s;e["".concat(a,"-").concat(o,"-port")]={children:(0,r.jsx)(Z.$_,{children:l})}})),e}),{})}),[R,B]),J=(0,a.useMemo)((function(){return q.reduce((function(e,n){var t=gn(n,2),o=t[0],i=t[1].upsName,a="run-manifest-ups-cell-".concat(o);return e["".concat(a,"-header")]={children:(0,r.jsxs)(Z.Ac,{children:["Uses ",i]})},R.forEach((function(n){var t=gn(n,2),o=t[0],u=t[1].upses,c=(void 0===u?{}:u)[i],s=(void 0===c?{}:c).isUsed,l=void 0!==s&&s;e["".concat(a,"-").concat(o,"-is-used")]={children:(0,r.jsx)(Z.$_,{children:l?"yes":"no"})}})),e}),{})}),[R,q]),K=(0,a.useMemo)((function(){var e=(0,T.Gn)(Zn,(function(){i(On)}),{onFinishBatch:t(On)},(function(e){i(On,{children:e})})),n=o(On);return e.tests.push({onFailure:function(){i(On,{children:(0,r.jsx)(r.Fragment,{children:"Confirm password must match password."})})},test:function(e){var n,t=e.value;return(null===(n=P.current.getValue)||void 0===n?void 0:n.call(null))===t}}),{inputTestBatch:e,onFirstRender:n}}),[t,o,i]);return(0,r.jsxs)(g.Z,{children:[(0,r.jsx)(l.Z,{columns:{xs:1,sm:2},layout:{"run-manifest-input-cell-an-description":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:wn,label:In}),inputTestBatch:(0,T.Gn)(In,(function(){i(wn)}),{onFinishBatch:t(wn)},(function(e){i(wn,{children:e})})),onFirstRender:o(wn),required:!0}),sm:2},"run-manifest-input-cell-an-password":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:kn,label:Pn,type:b.Z.password}),inputTestBatch:(0,T.Gn)(Pn,(function(){i(kn)}),{onFinishBatch:t(kn)},(function(e){i(kn,{children:e})})),onFirstRender:o(kn),ref:P,required:!0})},"run-manifest-input-cell-an-confirm-password":{children:(0,r.jsx)(j.Z,bn({input:(0,r.jsx)(x.Z,{id:On,label:Zn,type:b.Z.password}),required:!0},K))}},spacing:"1em"}),(0,r.jsx)(l.Z,{alignItems:"center",columns:{xs:R.length+1},layout:bn({},V,$,G,Q,Y,J),columnSpacing:"1em",rowSpacing:"0.4em"}),(0,r.jsx)(l.Z,{columns:{xs:2},layout:bn({},W,{"run-manifest-dns-csv-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"DNS"})},"run-manifest-dns-csv-cell":{children:(0,r.jsx)(An,{children:M})},"run-manifest-ntp-csv-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"NTP"})},"run-manifest-ntp-csv-cell":{children:(0,r.jsx)(An,{children:E})},"run-manifest-mtu-cell-header":{children:(0,r.jsx)(Z.Ac,{children:"MTU"})},"run-manifest-mtu-cell":{children:(0,r.jsx)(An,{children:F})}}),spacing:"0.4em"})]})};function Tn(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Cn(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Un(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){Cn(e,n,t[n])}))}return e}function Nn(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||Rn(e,n)||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.")}()}function En(e){return function(e){if(Array.isArray(e))return Tn(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Rn(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 Rn(e,n){if(e){if("string"===typeof e)return Tn(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Tn(e,n):void 0}}var Bn=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=Nn(n,1),o=r[0].target,i=o.elements,a=i.namedItem(Ne),u=a.value,c=i.namedItem(Ee),s=c.value,l=i.namedItem(Re),d=l.value,f=i.namedItem(an),p=f.value,m=i.namedItem(un),h=m.value,v=i.namedItem(cn),y=v.value,b=Number.parseInt(h,10),g=Number.parseInt(d,10);return Object.values(i).reduce((function(e,n){var t=n.id;if(RegExp("^".concat(we)).test(t)){var r,o=n,i=o.dataset.handler;null===(r=Ie[void 0===i?"":i])||void 0===r||r.call(null,e,o)}else if(RegExp("^".concat(We)).test(t)){var a,u=n,c=u.dataset.handler;null===(a=Ye[void 0===c?"":c])||void 0===a||a.call(null,e,u)}return e}),{domain:u,hostConfig:{hosts:{}},networkConfig:{dnsCsv:p,mtu:b,networks:{},ntpCsv:y},prefix:s,sequence:g})},Dn=function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];var o=Nn(t,1),i=o[0].target,a=i.elements,u=a.namedItem(wn),c=u.value,s=a.namedItem(kn),l=s.value,d=Object.entries(e).reduce((function(e,n){var t=Nn(n,2),r=t[0],o=t[1],i=o.hostNumber,u=o.hostType,c=Mn(r),s=a.namedItem(c).value;return e[r]={hostNumber:i,hostType:u,hostUuid:s},e}),{});return{description:c,hosts:d,password:l}},qn=function(){var e=(0,V.Z)(),n=(0,a.useRef)({}),t=(0,a.useRef)({}),o=(0,a.useRef)({}),i=(0,a.useRef)({}),c=(0,a.useRef)({}),s=Nn((0,oe.Z)(),2),l=s[0],f=s[1],m=Nn((0,ae.Z)(void 0),2),h=m[0],v=m[1],y=(0,a.useState)(!1),b=y[0],j=y[1],x=Nn((0,ae.Z)(!0),2),k=x[0],O=x[1],I=Nn((0,ae.Z)(!0),2),P=I[0],S=I[1],A=Nn((0,ae.Z)(!0),2),M=A[0],F=A[1],T=Nn((0,ae.Z)(!1),2),C=T[0],U=T[1],N=Nn((0,ae.Z)(void 0),2),E=N[0],R=N[1],B=Nn((0,ae.Z)(void 0),2),D=B[0],q=B[1],L=(0,te.Z)("".concat(p.Z,"/manifest"),{refreshInterval:6e4}),_=L.data,$=L.isLoading,G=(0,ie.Z)([Ne,Ee,Re,an,un,cn],c),z=G.isFormInvalid,W=G.setMessage,Q=(0,ie.Z)([On,wn,kn],c),J=Q.isFormInvalid,ue=(0,re.Z)({list:_}),ce=ue.buildDeleteDialogProps,se=ue.checks,le=ue.getCheck,de=ue.hasChecks,fe=ue.setCheck,pe=(0,a.useMemo)((function(){return null!==E&&void 0!==E?E:{}}),[E]),me=pe.hostConfig,he=(void 0===me?{}:me).hosts,ve=void 0===he?{}:he,ye=pe.name,be=pe.uuid,ge=(0,a.useMemo)((function(){return null!==D&&void 0!==D?D:{}}),[D]),je=ge.domain,xe=ge.fences,we=ge.prefix,ke=ge.sequence,Oe=ge.upses,Ie=(0,a.useCallback)((function(e){var n=e.body,t=e.getErrorMsg,r=e.method,o=e.successMsg,i=e.url;U(!0),u.Z.request({data:n,method:r,url:i}).then((function(){W("api",{children:o,type:"info"})})).catch((function(e){var n=(0,d.Z)(e);n.children=t(n.children),W("api",n)})).finally((function(){U(!1)}))}),[U,W]),Pe=(0,a.useMemo)((function(){return{actionProceedText:"Add",content:(0,r.jsx)(mn,{formUtils:G,knownFences:xe,knownUpses:Oe,previous:{domain:je,prefix:we,sequence:ke}}),onSubmitAppend:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i,a=Bn.apply(void 0,En(t));f({actionProceedText:"Add",content:(0,r.jsx)(X.Z,{entries:a}),onProceedAppend:function(){Ie({body:a,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to add install manifest. ",e]})},method:"post",successMsg:"Successfully added install manifest",url:"/manifest"})},titleText:"Add install manifest?"}),null===(i=n.current.setOpen)||void 0===i||i.call(null,!0)},titleText:"Add an install manifest"}}),[G,xe,Oe,je,we,ke,f,Ie]),Ze=(0,a.useMemo)((function(){return{actionProceedText:"Edit",content:(0,r.jsx)(hn,{formUtils:G,knownFences:xe,knownUpses:Oe,previous:E}),onSubmitAppend:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i,a=Bn.apply(void 0,En(t));f({actionProceedText:"Edit",content:(0,r.jsx)(X.Z,{entries:a}),onProceedAppend:function(){Ie({body:a,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to update install manifest. ",e]})},method:"put",successMsg:"Successfully updated install manifest ".concat(ye),url:"/manifest/".concat(be)})},titleText:"Update install manifest ".concat(ye,"?")}),null===(i=n.current.setOpen)||void 0===i||i.call(null,!0)},loading:P,titleText:"Update install manifest ".concat(ye)}}),[G,xe,Oe,E,P,ye,f,Ie,be]),Se=(0,a.useMemo)((function(){return{actionProceedText:"Run",content:(0,r.jsx)(Fn,{formUtils:Q,knownFences:xe,knownHosts:h,knownUpses:Oe,previous:E}),loading:P,onSubmitAppend:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i,a=Dn.apply(void 0,[ve].concat(En(t)));f({actionProceedText:"Run",content:(0,r.jsx)(X.Z,{entries:a,hasPassword:!0}),onProceedAppend:function(){Ie({body:a,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to run install manifest. ",e]})},method:"put",successMsg:"Successfully ran install manifest ".concat(ye),url:"/command/run-manifest/".concat(be)})},titleText:"Run install manifest ".concat(ye,"?")}),null===(i=n.current.setOpen)||void 0===i||i.call(null,!0)},titleText:"Run install manifest ".concat(ye)}}),[Q,xe,h,Oe,E,P,ye,ve,f,Ie,be]),Ae=(0,a.useCallback)((function(e,n){S(!0),u.Z.get("manifest/".concat(e)).then((function(n){var t=n.data;t.uuid=e,R(t)})).catch((function(e){(0,d.Z)(e)})).finally((function(){S(!1),null===n||void 0===n||n.call(null)}))}),[S,R]),Me=(0,a.useMemo)((function(){return(0,r.jsx)(ee.Z,{allowEdit:!0,allowItemButton:b,disableDelete:!de,edit:b,header:!0,listEmpty:"No manifest(s) registered.",listItems:_,onAdd:function(){var e;null===(e=t.current.setOpen)||void 0===e||e.call(null,!0)},onDelete:function(){var e;f(ce({onProceedAppend:function(){Ie({body:{uuids:se},getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Delete manifest(s) failed. ",e]})},method:"delete",url:"/manifest"})},getConfirmDialogTitle:function(e){return"Delete ".concat(e," manifest(s)?")},renderEntry:function(e){var n=e.key;return(0,r.jsx)(Z.Ac,{children:null===_||void 0===_?void 0:_[n].manifestName})}})),null===(e=n.current.setOpen)||void 0===e||e.call(null,!0)},onEdit:function(){j((function(e){return!e}))},onItemCheckboxChange:function(e,n,t){fe(e,t)},onItemClick:function(e){var n,t=e.manifestName,r=e.manifestUUID;R({name:t,uuid:r}),null===(n=o.current.setOpen)||void 0===n||n.call(null,!0),Ae(r)},renderListItemCheckboxState:function(e){return le(e)},renderListItem:function(e,n){var t=n.manifestName;return(0,r.jsxs)(g.Z,{fullWidth:!0,row:!0,children:[(0,r.jsx)(Ve.Z,{disabled:b,mapPreset:"play",onClick:function(){var n;R({name:t,uuid:e}),null===(n=i.current.setOpen)||void 0===n||n.call(null,!0),Ae(e)},variant:"normal"}),(0,r.jsx)(Z.Ac,{children:t})]})}})}),[ce,se,le,Ae,de,b,_,fe,f,R,Ie]),Fe=(0,a.useMemo)((function(){return k||M||$?(0,r.jsx)(H.Z,{}):Me}),[k,$,M,Me]),Te=(0,a.useMemo)((function(){return(0,r.jsx)(ne.Z,{count:1,defaultMessageType:"warning",ref:c})}),[]);return e&&(u.Z.get("/manifest/template").then((function(e){var n=e.data;q(n)})).catch((function(e){(0,d.Z)(e)})).finally((function(){F(!1)})),u.Z.get("/host",{params:{types:"node"}}).then((function(e){var n=e.data;v(n)})).catch((function(e){(0,d.Z)(e)})).finally((function(){O(!1)}))),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(w.s_,{children:[(0,r.jsx)(w.V9,{children:(0,r.jsx)(Z.z,{children:"Manage manifests"})}),Fe]}),(0,r.jsx)(K.Z,Un({},Pe,{disableProceed:z,loadingAction:C,preActionArea:Te,ref:t,scrollContent:!0,showClose:!0})),(0,r.jsx)(K.Z,Un({},Ze,{disableProceed:z,loadingAction:C,preActionArea:Te,ref:o,scrollContent:!0,showClose:!0})),(0,r.jsx)(K.Z,Un({},Se,{disableProceed:J,loadingAction:C,preActionArea:Te,ref:i,scrollContent:!0,showClose:!0})),(0,r.jsx)(Y.Z,Un({closeOnProceed:!0},l,{ref:n,scrollContent:!0}))]})},Ln=qn,_n="common-ups-input-ip-address",Hn="common-ups-input-host-name",Vn="IP address",$n="Host name",Gn=function(e){var n=e.formUtils,t=n.buildFinishInputTestBatchFunction,o=n.buildInputFirstRenderFunction,i=n.setMessage,a=e.previous,u=void 0===a?{}:a,c=u.upsIPAddress,s=u.upsName;return(0,r.jsx)(l.Z,{columns:{xs:1,sm:2},layout:{"common-ups-input-cell-host-name":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:Hn,label:$n,value:s}),inputTestBatch:(0,T.Gn)($n,(function(){i(Hn)}),{onFinishBatch:t(Hn)},(function(e){i(Hn,{children:e})})),onFirstRender:o(Hn),required:!0})},"common-ups-input-cell-ip-address":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{id:_n,label:Vn,value:c}),inputTestBatch:(0,T._)(Vn,(function(){i(_n)}),{onFinishBatch:t(_n)},(function(e){i(_n,{children:e})})),onFirstRender:o(_n),required:!0})}},spacing:"1em"})},zn=t(5741);function Wn(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Qn(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return Wn(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Wn(e,n)}(e,n)||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 Yn="add-ups-select-ups-type-id",Jn=function(e){var n=e.formUtils,t=e.loading,o=e.previous,i=void 0===o?{}:o,u=e.upsTemplate,c=n.buildInputFirstRenderFunction,s=n.setValidity,l=i.upsTypeId,d=void 0===l?"":l,f=(0,V.Z)(),p=(0,a.useState)(d),m=p[0],h=p[1],v=(0,a.useMemo)((function(){return u?Object.entries(u).map((function(e){var n,t=Qn(e,2),o=t[0],i=t[1],a=i.brand,u=i.description,c=i.links[0];if(c){var s=c.linkHref,l=c.linkLabel;n=(0,r.jsx)(zn.Z,{href:s,onClick:function(e){e.stopPropagation()},sx:{display:"inline-flex",color:P.E5},target:"_blank",children:l})}return{displayValue:(0,r.jsxs)(g.Z,{spacing:0,children:[(0,r.jsx)(Z.Ac,{inverted:!0,children:a}),(0,r.jsxs)(Z.Ac,{inverted:!0,children:[u," (",n,")"]})]}),value:o}})):[]}),[u]),y=(0,a.useMemo)((function(){return u&&(0,r.jsx)(k.Z,{formControlProps:{sx:{marginTop:".3em"}},id:Yn,label:"UPS type",onChange:function(e){var n=e.target.value,t=String(n);s(Yn,!0),h(t)},required:!0,selectItems:v,selectProps:{onClearIndicatorClick:function(){s(Yn,!1),h("")},renderValue:function(e){var n=String(e);return u[n].brand}},value:m})}),[u,v,m,s]),b=(0,a.useMemo)((function(){return t?(0,r.jsx)(H.Z,{}):(0,r.jsxs)(g.Z,{children:[y,m&&(0,r.jsx)(Gn,{formUtils:n,previous:i})]})}),[n,m,t,y,i]);return(0,a.useEffect)((function(){f&&c(Yn)({isValid:Boolean(m)})}),[c,m,f]),b},Kn="edit-ups-input-ups-uuid",Xn=function(e){var n=e.formUtils,t=e.loading,o=e.previous,i=e.upsTemplate,u=e.upsUUID;return(0,a.useMemo)((function(){return t?(0,r.jsx)(H.Z,{}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Jn,{formUtils:n,previous:o,upsTemplate:i}),(0,r.jsx)("input",{hidden:!0,id:Kn,readOnly:!0,value:u})]})}),[n,t,o,i,u])};function et(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function nt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function tt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){nt(e,n,t[n])}))}return e}function rt(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return et(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return et(e,n)}(e,n)||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 ot=function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];var o,i=rt(t,1),a=i[0].target,u=a.elements,c=u.namedItem(Hn),s=c.value,l=u.namedItem(_n),d=l.value,f=u.namedItem(Yn),p="",m="",h="";f&&(p=(o=e[h=f.value]).agent,m=o.brand);var v=u.namedItem(Kn),y="";v&&(y=v.value);return{agent:p,brand:m,ipAddress:d,name:s,typeId:h,uuid:y}},it=function(e){var n=e.brand,t=e.ipAddress,o=e.name,i=e.uuid,a={"ups-brand":{label:"Brand",value:n},"ups-name":{label:"Host name",value:o},"ups-ip-address":{label:"IP address",value:t}};return(0,r.jsx)(ee.Z,{listItems:a,listItemProps:{sx:{padding:0}},renderListItem:function(e,n){var t=n.label,o=n.value;return(0,r.jsxs)(g.Z,{fullWidth:!0,growFirst:!0,row:!0,children:[(0,r.jsx)(Z.Ac,{children:t}),(0,r.jsx)(Z.$_,{children:o})]},"confirm-ups-".concat(i,"-").concat(e))}})},at=function(){var e=(0,V.Z)(),n=(0,a.useRef)({}),t=(0,a.useRef)({}),o=(0,a.useRef)({}),i=rt((0,oe.Z)(),2),c=i[0],s=i[1],l=rt((0,oe.Z)(),2),f=l[0],m=l[1],h=(0,a.useState)(!1),v=h[0],y=h[1],b=rt((0,ae.Z)(!0),2),j=b[0],x=b[1],k=rt((0,ae.Z)(void 0),2),O=k[0],I=k[1],P=(0,te.Z)("".concat(p.Z,"/ups"),{refreshInterval:6e4}),S=P.data,A=P.isLoading,M=(0,ie.Z)([_n,Hn,Yn],o),F=M.isFormInvalid,T=M.isFormSubmitting,C=M.submitForm,U=(0,re.Z)({list:S}),N=U.buildDeleteDialogProps,E=U.checks,R=U.getCheck,B=U.hasChecks,D=U.setCheck,q=(0,a.useCallback)((function(e){var t,o,i=e.upsAgent,a=e.upsIPAddress,u=e.upsName,c=e.upsUUID,l=null!==(o=null===(t=Object.entries(null!==O&&void 0!==O?O:{}).find((function(e){var n=rt(e,2)[1].agent;return i===n})))||void 0===t?void 0:t[0])&&void 0!==o?o:"";return{actionProceedText:"Update",content:(0,r.jsx)(Xn,{formUtils:M,previous:{upsIPAddress:a,upsName:u,upsTypeId:l},upsTemplate:O,upsUUID:c}),onSubmitAppend:function(e){var t;if(O){var o=ot(O,e),i=o.name;s({actionProceedText:"Update",content:it(o),onProceedAppend:function(){C({body:o,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to update UPS. ",e]})},method:"put",successMsg:"Successfully updated UPS ".concat(u),url:"/ups/".concat(c)})},titleText:(0,r.jsxs)(Z.z,{children:["Update"," ",(0,r.jsx)(Z.Q0,{fontSize:"inherit",children:i})," ","with the following data?"]})}),null===(t=n.current.setOpen)||void 0===t||t.call(null,!0)}},titleText:(0,r.jsxs)(Z.z,{children:["Update UPS"," ",(0,r.jsx)(Z.Q0,{fontSize:"inherit",children:u})]})}}),[M,s,C,O]),L=(0,a.useMemo)((function(){return{actionProceedText:"Add",content:(0,r.jsx)(Jn,{formUtils:M,upsTemplate:O}),onSubmitAppend:function(e){var t;if(O){var o=ot(O,e),i=o.brand,a=o.name;s({actionProceedText:"Add",content:it(o),onProceedAppend:function(){C({body:o,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to add UPS. ",e]})},method:"post",successMsg:"Successfully added UPS ".concat(a),url:"/ups"})},titleText:(0,r.jsxs)(Z.z,{children:["Add a"," ",(0,r.jsx)(Z.Q0,{fontSize:"inherit",children:i})," UPS with the following data?"]})}),null===(t=n.current.setOpen)||void 0===t||t.call(null,!0)}},titleText:"Add a UPS"}}),[M,s,C,O]),_=(0,a.useMemo)((function(){return(0,r.jsx)(ee.Z,{allowEdit:!0,allowItemButton:v,disableDelete:!B,edit:v,header:!0,listEmpty:"No Ups(es) registered.",listItems:S,onAdd:function(){var e;m(L),null===(e=t.current.setOpen)||void 0===e||e.call(null,!0)},onDelete:function(){var e;s(N({getConfirmDialogTitle:function(e){return"Delete ".concat(e," UPSes?")},onProceedAppend:function(){C({body:{uuids:E},getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to delete UPS(es). ",e]})},method:"delete",url:"/ups"})},renderEntry:function(e){var n=e.key;return(0,r.jsx)(Z.Ac,{children:null===S||void 0===S?void 0:S[n].upsName})}})),null===(e=n.current.setOpen)||void 0===e||e.call(null,!0)},onEdit:function(){y((function(e){return!e}))},onItemCheckboxChange:function(e,n,t){D(e,t)},onItemClick:function(e){var n;m(q(e)),null===(n=t.current.setOpen)||void 0===n||n.call(null,!0)},renderListItemCheckboxState:function(e){return R(e)},renderListItem:function(e,n){var t=n.upsAgent,o=n.upsIPAddress,i=n.upsName;return(0,r.jsxs)(g.Z,{fullWidth:!0,row:!0,children:[(0,r.jsx)(Z.Ac,{children:i}),(0,r.jsxs)(Z.Ac,{children:['agent="',t,'"']}),(0,r.jsxs)(Z.Ac,{children:['ip="',o,'"']})]})}})}),[L,N,q,E,R,B,v,D,s,m,C,S]),$=(0,a.useMemo)((function(){return j||A?(0,r.jsx)(H.Z,{}):_}),[j,A,_]),G=(0,a.useMemo)((function(){return(0,r.jsx)(ne.Z,{count:1,defaultMessageType:"warning",ref:o})}),[]);return e&&u.Z.get("/ups/template").then((function(e){var n=e.data;I(n)})).catch((function(e){(0,d.Z)(e)})).finally((function(){x(!1)})),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(w.s_,{children:[(0,r.jsx)(w.V9,{children:(0,r.jsx)(Z.z,{children:"Manage UPSes"})}),$]}),(0,r.jsx)(K.Z,tt({},f,{disableProceed:F,loadingAction:T,preActionArea:G,ref:t,showClose:!0})),(0,r.jsx)(Y.Z,tt({closeOnProceed:!0},c,{ref:n}))]})},ut=t(5697),ct=t(2186),st=t(4799),lt=t(4825),dt=t(4629),ft=t(575),pt=t(4568),mt=t(3640),ht=t(476),vt=t(8061);function yt(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function bt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function gt(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){bt(e,n,t[n])}))}return e}function jt(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function xt(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return yt(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return yt(e,n)}(e,n)||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 wt=function(e){var n=e.formControlProps,t=e.formControlLabelProps,o=e.formLabelProps,i=e.id,u=e.label,c=e.onChange,s=e.radioItems,l=e.radioProps,d=(void 0===l?{}:l).sx,f=e.radioGroupProps,p=jt(e.radioProps,["sx"]),m=(0,a.useMemo)((function(){return"string"===typeof u?(0,r.jsx)(Z.Ac,{children:u}):u}),[u]),h=(0,a.useMemo)((function(){return Object.entries(s).map((function(e){var n=xt(e,2),o=n[0],a=n[1],u=a.label,c=a.value,s="string"===typeof u?(0,r.jsx)(Z.Ac,{children:u}):u;return(0,r.jsx)(O.Z,gt({control:(0,r.jsx)(ft.Z,gt({},p,{sx:gt(bt({},"&.".concat(pt.Z.root),{color:P.s7}),d)})),value:c,label:s},t),"".concat(i,"-").concat(o))}))}),[t,i,s,d,p]);return(0,r.jsxs)(mt.Z,gt({},n,{children:[(0,r.jsx)(ht.Z,gt({},o,{children:m})),(0,r.jsx)(vt.Z,gt({onChange:c,row:!0},f,{children:h}))]}))},kt=t(3144);function Ot(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function It(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Pt(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return Ot(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ot(e,n)}(e,n)||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 Zt="Alteeve enterprise key",St="Host name",At="RedHat password",Mt="RedHat user",Ft="enterpriseKey",Tt="hostName",Ct="redhatPassword",Ut="redhatUser",Nt={xs:1,sm:2},Et=function(){var e=(0,kt.Z)().protect,n=(0,a.useRef)({}),t=(0,a.useRef)({}),o=(0,a.useRef)({}),i=(0,a.useRef)({}),c=(0,a.useRef)({}),s=(0,a.useRef)({}),f=(0,a.useState)(),p=f[0],h=f[1],v=(0,a.useState)(),y=v[0],k=v[1],O=Pt((0,ae.Z)(void 0,e),2),I=O[0],S=O[1],A=Pt((0,ae.Z)("",e),2),M=A[0],F=A[1],C=(0,a.useState)(""),U=C[0],N=C[1],E=(0,a.useState)(!0),R=E[0],B=E[1],D=(0,a.useState)(!1),q=D[0],L=D[1],_=(0,a.useState)(!0),V=_[0],$=_[1],G=(0,a.useState)(!0),z=G[0],W=G[1],Q=(0,a.useState)(!1),J=Q[0],K=Q[1],X=(0,a.useState)(!0),ee=X[0],te=X[1],re=(0,a.useState)(!1),oe=re[0],ie=re[1],ue=(0,a.useState)(!1),ce=ue[0],se=ue[1],le=(0,a.useState)(!1),de=le[0],fe=le[1],pe=(0,a.useState)(!1),me=pe[0],he=pe[1],ve=(0,a.useCallback)((function(e){var n;null===(n=s.current.setMessage)||void 0===n||n.call(null,Tt,e)}),[]),ye=(0,a.useCallback)((function(e){var n;null===(n=s.current.setMessage)||void 0===n||n.call(null,Ft,e)}),[]),be=(0,a.useCallback)((function(e){var n;null===(n=s.current.setMessage)||void 0===n||n.call(null,Ct,e)}),[]),ge=(0,a.useCallback)((function(e){var n;null===(n=s.current.setMessage)||void 0===n||n.call(null,Ut,e)}),[]),je=(0,a.useCallback)((function(e){var n;return null===(n=s.current.setMessage)||void 0===n?void 0:n.call(null,"submitPrepareHost",e)}),[]),xe=(0,a.useMemo)((function(){var e;return It(e={},Ft,(0,T.$e)(Zt,(function(){ye()}),void 0,(function(e){ye({children:e,type:"warning"})}))),It(e,Tt,(0,T.Ye)(St,(function(){ve()}),void 0,(function(e){ve({children:e,type:"warning"})}))),It(e,Ct,(0,T.Gn)(At,(function(){be()}),void 0,(function(e){be({children:e,type:"warning"})}))),It(e,Ut,(0,T.Gn)(Mt,(function(){ge()}),void 0,(function(e){ge({children:e,type:"warning"})}))),e}),[ye,ve,be,ge]),we=(0,a.useMemo)((function(){return(0,T.LT)(xe)}),[xe]),ke=(0,a.useMemo)((function(){return de?void 0:"none"}),[de]),Oe=(0,a.useMemo)((function(){return(0,r.jsx)(dt.ZP,{allowSubmit:ee,gridProps:{wrapperBoxProps:{sx:{display:J?"flex":"none"}}},identifierInputTestBatchBuilder:T._,identifierLabel:"Host IP address",onIdentifierBlurAppend:function(e){var n=e.target.value;if(y){var t=n!==y;te(t),ie(!t),fe(!t)}},onSubmitAppend:function(e,n,t,r){var i={ipAddress:e,password:n};u.Z.put("/command/inquire-host",i).then((function(r){var i=r.data,a=i.hostName,u=i.hostOS,c=i.hostUUID,s=i.isConnected,l=i.isInetConnected,d=i.isOSRegistered;if(s){var f;null===(f=o.current.setValue)||void 0===f||f.call(null,a);var p=we({inputs:It({},Tt,{value:a})});L(p),l&&/rhel/i.test(u)&&!d&&fe(!0),k(e),S(n),F(c),te(!1),ie(!0)}else t({children:"Failed to establish a connection with the given host credentials.",type:"error"})})).catch((function(e){var n=(0,d.Z)(e);null===t||void 0===t||t.call(null,n)})).finally((function(){r(!1)}))},passphraseLabel:"Host root password",submitLabel:"Test access"})}),[J,ee,y,S,F,we]),Ie=(0,a.useMemo)((function(){return(0,r.jsx)(l.Z,{columns:Nt,layout:{"preparehost-host-name":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{formControlProps:{sx:{width:"100%"}},id:"preparehost-host-name-input",inputProps:{onBlur:function(e){var n=e.target.value,t=we({inputs:It({},Tt,{value:n})});L(t)},onFocus:function(){ve()}},label:St}),ref:o})},"preparehost-enterprise-key":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{formControlProps:{sx:{width:"100%"}},id:"preparehost-enterprise-key-input",inputProps:{onBlur:function(e){var n=e.target.value;if(n){var t=we({inputs:It({},Ft,{value:n})});B(t)}},onFocus:function(){ye()}},label:Zt}),ref:t})}},spacing:"1em",wrapperBoxProps:{sx:{display:oe?void 0:"none"}}})}),[oe,ye,ve,we]),Pe=(0,a.useMemo)((function(){return(0,r.jsx)(l.Z,{columns:Nt,layout:{"preparehost-redhat-user":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{formControlProps:{sx:{width:"100%"}},id:"preparehost-redhat-user-input",inputProps:{onBlur:function(e){var n=e.target.value;if(n){var t=we({inputs:It({},Ut,{value:n})});W(t)}},onFocus:function(){ge()}},label:Mt}),ref:c})},"preparehost-redhat-password":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{formControlProps:{sx:{width:"100%"}},id:"preparehost-redhat-password-input",inputProps:{onBlur:function(e){var n=e.target.value;if(n){var t=we({inputs:It({},Ct,{value:n})});$(t)}},onFocus:function(){be()},onPasswordVisibilityAppend:function(e){se(e!==b.Z.password)},type:b.Z.password},label:At}),ref:i})}},spacing:"1em",wrapperBoxProps:{sx:{display:ke}}})}),[ke,be,ge,we]),Ze=(0,a.useMemo)((function(){return(0,r.jsx)(m.Z,{sx:{display:oe?void 0:"none"},children:(0,r.jsx)(ne.Z,{count:1,ref:s})})}),[oe]),Se=(0,a.useMemo)((function(){return me?(0,r.jsx)(H.Z,{mt:0}):(0,r.jsx)(g.Z,{row:!0,sx:{display:oe?"flex":"none",justifyContent:"flex-end"},children:(0,r.jsx)(lt.Z,{disabled:!q||!R||!z||!V,onClick:function(){var e,r,a,u,s,l=null===(e=i.current.getValue)||void 0===e?void 0:e.call(null);h({enterpriseKey:(null===(r=t.current.getValue)||void 0===r?void 0:r.call(null))||"none; using community version",hostName:(null===(a=o.current.getValue)||void 0===a?void 0:a.call(null))||"",redhatPassword:l||"none",redhatPasswordHidden:(null===l||void 0===l?void 0:l.replace(/./g,"*"))||"none",redhatUser:(null===(u=c.current.getValue)||void 0===u?void 0:u.call(null))||"none"}),je(),null===(s=n.current.setOpen)||void 0===s||s.call(null,!0)},children:"Prepare host"})})}),[R,q,V,z,oe,me,je]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(w.s_,{children:[(0,r.jsx)(w.V9,{children:(0,r.jsx)(Z.z,{children:"Prepare a host to include in Anvil!"})}),(0,r.jsxs)(g.Z,{children:[(0,r.jsx)(wt,{id:"preparehost-host-type",label:"Host type",onChange:function(e,n){N(n),K(!0)},radioItems:{node:{label:"Subnode",value:"node"},dr:{label:"Disaster Recovery (DR) host",value:"dr"}}}),Oe,Ie,Pe,Ze,Se]})]}),(0,r.jsx)(Y.Z,{actionProceedText:"Prepare",closeOnProceed:!0,content:(0,r.jsx)(l.Z,{calculateItemBreakpoints:function(e){return{xs:e%2===0?1:2}},columns:3,layout:{"preparehost-confirm-host-type-label":{children:(0,r.jsx)(Z.Ac,{children:"Host type"})},"preparehost-confirm-host-type-value":{children:(0,r.jsx)(Z.$_,{children:"dr"===U?"Disaster Recovery (DR)":"Subnode"})},"preparehost-confirm-host-name-label":{children:(0,r.jsx)(Z.Ac,{children:"Host name"})},"preparehost-confirm-host-name-value":{children:(0,r.jsx)(Z.$_,{children:null===p||void 0===p?void 0:p.hostName})},"preparehost-confirm-enterprise-key-label":{children:(0,r.jsx)(Z.Ac,{children:"Alteeve enterprise key"})},"preparehost-confirm-enterprise-key-value":{children:(0,r.jsx)(Z.$_,{children:null===p||void 0===p?void 0:p.enterpriseKey})},"preparehost-confirm-redhat-user-label":{children:(0,r.jsx)(Z.Ac,{children:"RedHat user"}),sx:{display:ke}},"preparehost-confirm-redhat-user-value":{children:(0,r.jsx)(Z.$_,{children:null===p||void 0===p?void 0:p.redhatUser}),sx:{display:ke}},"preparehost-confirm-redhat-password-label":{children:(0,r.jsx)(Z.Ac,{children:"RedHat password"}),sx:{display:ke}},"preparehost-confirm-redhat-password-value":{children:(0,r.jsxs)(g.Z,{row:!0,sx:{height:"100%",maxWidth:"100%"},children:[(0,r.jsx)(Z.$_,{sx:{flexGrow:1,maxWidth:"calc(100% - 3em)",overflowX:"scroll"},children:ce?null===p||void 0===p?void 0:p.redhatPassword:null===p||void 0===p?void 0:p.redhatPasswordHidden}),(0,r.jsx)(st.Z,{onClick:function(){se((function(e){return!e}))},sx:{color:P.s7,padding:0},children:ce?(0,r.jsx)(ut.Z,{}):(0,r.jsx)(ct.Z,{})})]}),sx:{display:ke}}},spacing:".6em"}),onCancelAppend:function(){se(!1)},onProceedAppend:function(){var e,n,r,a;he(!0),u.Z.put("/host/prepare",{enterpriseUUID:null===(e=t.current.getValue)||void 0===e?void 0:e.call(null),hostIPAddress:y,hostName:null===(n=o.current.getValue)||void 0===n?void 0:n.call(null),hostPassword:I,hostType:U,hostUUID:M,redhatPassword:null===(r=i.current.getValue)||void 0===r?void 0:r.call(null),redhatUser:null===(a=c.current.getValue)||void 0===a?void 0:a.call(null)}).then((function(){je({children:"Successfully initiated prepare host."}),setTimeout((function(){je()}),5e3)})).catch((function(e){var n=(0,d.Z)(e,{onResponseErrorAppend:function(e){var n;return 400===e.status&&(n={children:"The API found invalid values. Did you forget to fill in one of the RedHat fields?",type:"warning"}),n}});je(n)})).finally((function(){he(!1)}))},ref:n,titleText:"Confirm host preparation"})]})},Rt=t(8187),Bt=t(4596),Dt=t(634);function qt(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Lt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function _t(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){Lt(e,n,t[n])}))}return e}function Ht(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function Vt(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||Gt(e,n)||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.")}()}function $t(e){return function(e){if(Array.isArray(e))return qt(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Gt(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 Gt(e,n){if(e){if("string"===typeof e)return qt(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?qt(e,n):void 0}}var zt="prepare-network-host-name-input",Wt="prepare-network-netconf-input-group",Qt="Host name",Yt=function(e){for(var n=e.netconf,t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];var i,a=Vt(r,1),u=a[0].target,c=u.elements,s=c.namedItem(zt),l=s.value,d=_t({hostName:l},null===(i=n.get)||void 0===i?void 0:i.call(null));return d},Jt=function(e){var n=e.networks,t=void 0===n?[]:n,r=Ht(e,["networks"]),o=t.reduce((function(e,n){var t=n.interfaces,r=n.ipAddress,o=n.name,i=void 0===o?"":o,a=n.type,u=n.typeCount,c=n.subnetMask,s="".concat(a).concat(u),l=t.reduce((function(e,n,t){if(n){var r=n.networkInterfaceName;e["link".concat(t+1)]=r}return e}),{});return e[s]=_t({name:i,network:"".concat(r,"/").concat(c)},l),e}),{});return _t({},r,{networks:o})},Kt=function(e){var n=e.expectUUID,t=void 0!==n&&n,o=e.hostUUID,c=(0,i.useRouter)(),l=c.isReady,f=c.query.host_uuid,p=(0,a.useRef)({}),m=(0,a.useRef)({}),h=(0,a.useRef)({}),v=Vt((0,oe.Z)(),2),y=v[0],b=v[1],k=Vt((0,ae.Z)(void 0),2),O=k[0],I=k[1],P=Vt((0,ae.Z)(void 0),2),S=P[0],A=P[1],M=Vt((0,ae.Z)(!0),2),F=M[0],C=M[1],U=Vt((0,ae.Z)(void 0),2),N=U[0],E=U[1],R=(0,ie.Z)([zt,Wt],h),B=R.buildFinishInputTestBatchFunction,D=R.buildInputFirstRenderFunction,q=R.isFormInvalid,L=R.setMessage,_=R.setValidity,V=R.submitForm,$=(0,a.useMemo)((function(){return o!==N}),[o,N]),G=(0,a.useMemo)((function(){return Boolean(o)&&$}),[o,$]),z=(0,a.useMemo)((function(){return(0,r.jsx)(w.V9,{children:(0,r.jsxs)(Z.z,{children:["Prepare network on ",null===O||void 0===O?void 0:O.shortHostName]})})}),[O]),W=(0,a.useMemo)((function(){return(0,r.jsx)(Bt.Z,{expectHostDetail:!0,hostDetail:O,ref:m,toggleSubmitDisabled:function(e){_(Wt,e)}})}),[O,_]),Q=(0,a.useMemo)((function(){return(0,r.jsx)(ne.Z,{count:1,defaultMessageType:"warning",ref:h})}),[]),J=(0,a.useMemo)((function(){var e;return e=F?(0,r.jsx)(H.Z,{mt:0}):S?(0,r.jsx)(Rt.Z,_t({},S)):(0,r.jsxs)(r.Fragment,{children:[z,(0,r.jsxs)(g.Z,{component:"form",onSubmit:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var i,a=Vt(n,1),u=a[0];u.preventDefault();var c=Yt.apply(void 0,[{netconf:m.current}].concat($t(n)));b({actionProceedText:"Prepare",content:(0,r.jsx)(X.Z,{entries:Jt(c),getEntryLabel:function(e){var n=e.cap,t=e.key;return/^(dns|[a-z]+n\d+)/.test(t)?t.toUpperCase():n(t)}}),onProceedAppend:function(){var e;V({body:c,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to prepare network. ",e]})},method:"put",onSuccess:function(){(0,Dt.Z)(0)},setMsg:null===m||void 0===m||null===(e=m.current)||void 0===e?void 0:e.setMessage,successMsg:"Initiated prepare network on ".concat(null===O||void 0===O?void 0:O.shortHostName),url:"/host/".concat(o,"?handler=subnode-network")})},titleText:"Prepare ".concat(null===O||void 0===O?void 0:O.shortHostName," network?")}),null===(i=p.current.setOpen)||void 0===i||i.call(null,!0)},children:[(0,r.jsx)(j.Z,{input:(0,r.jsx)(x.Z,{formControlProps:{sx:{maxWidth:"20em"}},id:zt,label:Qt,value:null===O||void 0===O?void 0:O.hostName}),inputTestBatch:(0,T.Gn)(Qt,(function(){L(zt)}),{onFinishBatch:B(zt)},(function(e){L(zt,{children:e})})),onFirstRender:D(zt),required:!0}),Q,W,(0,r.jsx)(g.Z,{row:!0,justifyContent:"flex-end",children:(0,r.jsx)(lt.Z,{disabled:q,type:"submit",children:"Prepare network"})})]})]}),e}),[F,S,z,null===O||void 0===O?void 0:O.hostName,null===O||void 0===O?void 0:O.shortHostName,B,D,Q,W,q,b,V,o,L]),K=(0,a.useCallback)((function(e){C(!0),F&&u.Z.get("/host/".concat(e)).then((function(e){var n=e.data;E(n.hostUUID),I(n)})).catch((function(e){var n=(0,d.Z)(e).children;A({children:"Failed to get target host information; cannot continue. ".concat(n),type:"error"})})).finally((function(){C(!1)}))}),[C,F,E,I,A]);return(0,a.useEffect)((function(){t?G&&K(o):l&&!S&&(f?K(s(f)):(A({children:"No host UUID provided; cannot continue.",type:"error"}),C(!1)))}),[S,K,o,t,l,f,A,I,C,G]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(w.s_,{children:J}),(0,r.jsx)(Y.Z,_t({closeOnProceed:!0,scrollContent:!0},y,{ref:p}))]})},Xt=t(5316),er=t(1073);function nr(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function tr(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var rr=function(e){var n=e.label,t=tr(e,["label"]),o=(0,a.useMemo)((function(){return"string"===typeof n?(0,r.jsx)(Z.Ac,{inheritColour:!0,children:n}):n}),[n]);return(0,r.jsx)(Xt.Z,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){nr(e,n,t[n])}))}return e}({},t,{label:o,sx:nr({borderRadius:P.n_,color:P.s7,padding:".4em .8em",textTransform:"none"},"&.".concat(er.Z.selected),{color:P.Ej})}))},or=function(e){var n=e.changingTabId,t=e.children,o=e.retain,i=void 0!==o&&o,u=e.tabId,c=(0,a.useMemo)((function(){return n===u}),[n,u]),s=(0,a.useMemo)((function(){return i?(0,r.jsx)(m.Z,{sx:{display:c?"initial":"none"},children:t}):c&&t}),[t,c,i]);return(0,r.jsx)(r.Fragment,{children:s})},ir=t(2734),ar=t(8396),ur=t(7023),cr=t(852);function sr(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function lr(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function dr(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function fr(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return sr(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return sr(e,n)}(e,n)||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 pr="1.8em",mr=function(e){var n,t,o=e.orientation,i=e.variant,u=void 0===i?"fullWidth":i,c=dr(e,["orientation","variant"]),s=(0,ir.Z)(),l=(0,a.useCallback)((function(e){return s.breakpoints.up(e)}),[s]),d=(0,ar.Z)(l("xs")),f=(0,ar.Z)(l("sm")),p=(0,ar.Z)(l("md")),m=(0,ar.Z)(l("lg")),h=(0,ar.Z)(l("xl")),v=(0,a.useMemo)((function(){return[["xs",d],["sm",f],["md",p],["lg",m],["xl",h]]}),[m,p,f,h,d]),y=(0,a.useMemo)((function(){var e;return"object"===typeof o?v.some((function(n){var t=fr(n,2),r=t[0],i=t[1];return i&&o[r]&&(e=o[r]),!i})):e=o,e}),[v,o]);return(0,r.jsx)(ur.Z,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){lr(e,n,t[n])}))}return e}({},c,{orientation:y,variant:u,sx:(t={minHeight:"1em"},lr(t,"&.".concat(cr.Z.vertical),(n={minHeight:pr},lr(n,"& .".concat(er.Z.root),{alignItems:"flex-start",minHeight:pr,paddingLeft:"2em"}),lr(n,"& .".concat(cr.Z.indicator),{right:"initial"}),n)),lr(t,"& .".concat(er.Z.root),{minHeight:"1em"}),lr(t,"& .".concat(cr.Z.indicator),{backgroundColor:P.Ej,borderRadius:P.n_}),t)}))};function hr(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function vr(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function yr(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){vr(e,n,t[n])}))}return e}function br(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],a=!0,u=!1;try{for(t=t.call(e);!(a=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);a=!0);}catch(c){u=!0,o=c}finally{try{a||null==t.return||t.return()}finally{if(u)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return hr(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return hr(e,n)}(e,n)||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 gr,jr="prepare-host",xr="prepare-network",wr="manage-fence",kr="manage-ups",Or="manage-manifest",Ir=(vr(gr={},jr,"Prepare Host"),vr(gr,xr,"Prepare Network"),vr(gr,wr,"Manage Fence Devices"),vr(gr,kr,"Manage UPSes"),vr(gr,Or,"Manage Manifests"),gr),Pr="Loading",Zr={md:8,sm:6,xs:1},Sr={md:6,sm:4,xs:1},Ar=function(){return(0,r.jsx)(l.Z,{columns:Zr,layout:{"preparehost-left-column":{},"preparehost-center-column":yr({children:(0,r.jsx)(Et,{})},Sr)}})},Mr=function(){var e=(0,V.Z)(),n=(0,kt.Z)().protect,t=br((0,ae.Z)(void 0,n),2),o=t[0],i=t[1],c=(0,a.useState)(!1),s=c[0],f=c[1],p=(0,a.useMemo)((function(){var e;if(o){var n=Object.entries(o);e=(0,r.jsx)(mr,{onChange:function(e,n){f(n)},orientation:"vertical",value:s,children:n.map((function(e){var n=br(e,2),t=n[0],o=n[1].shortHostName;return(0,r.jsx)(rr,{label:o,value:t},"".concat(xr,"-").concat(t))}))})}else e=(0,r.jsx)(H.Z,{mt:0});return e}),[o,s]);return e&&u.Z.get("/host",{params:{types:["dr","node"]}}).then((function(e){var n=e.data;i(n),f(Object.keys(n)[0])})).catch((function(e){(0,d.Z)(e)})),(0,r.jsx)(l.Z,{columns:Zr,layout:{"preparenetwork-left-column":{children:(0,r.jsx)(w.s_,{children:p}),sm:2},"preparenetwork-center-column":yr({children:(0,r.jsx)(Kt,{expectUUID:!0,hostUUID:s||void 0})},Sr)}})},Fr=function(){return(0,r.jsx)(l.Z,{columns:Zr,layout:{"managefence-left-column":{},"managefence-center-column":yr({children:(0,r.jsx)(ve,{})},Sr)}})},Tr=function(){return(0,r.jsx)(l.Z,{columns:Zr,layout:{"manageups-left-column":{},"manageups-center-column":yr({children:(0,r.jsx)(at,{})},Sr)}})},Cr=function(){return(0,r.jsx)(l.Z,{columns:Zr,layout:{"managemanifest-left-column":{},"managemanifest-center-column":yr({children:(0,r.jsx)(Ln,{})},Sr)}})},Ur=function(){var e=(0,i.useRouter)(),n=e.isReady,t=e.query.step,u=(0,a.useState)(!1),c=u[0],l=u[1],d=(0,a.useState)(Pr),p=d[0],m=d[1];return(0,a.useEffect)((function(){if(n){var e=s(t,{fallbackValue:jr});Ir[e]||(e=jr),p===Pr&&m(Ir[e]),c||l(e)}}),[n,c,p,t]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.default,{children:(0,r.jsx)("title",{children:p})}),(0,r.jsx)(f.Z,{}),(0,r.jsx)(w.s_,{children:(0,r.jsxs)(mr,{onChange:function(e,n){l(n),m(Ir[n])},orientation:{xs:"vertical",sm:"horizontal"},value:c,children:[(0,r.jsx)(rr,{label:"Prepare host",value:jr}),(0,r.jsx)(rr,{label:"Prepare network",value:xr}),(0,r.jsx)(rr,{label:"Manage fence devices",value:wr}),(0,r.jsx)(rr,{label:"Manage UPSes",value:kr}),(0,r.jsx)(rr,{label:"Manage manifests",value:Or})]})}),(0,r.jsx)(or,{changingTabId:c,tabId:jr,children:(0,r.jsx)(Ar,{})}),(0,r.jsx)(or,{changingTabId:c,tabId:xr,children:(0,r.jsx)(Mr,{})}),(0,r.jsx)(or,{changingTabId:c,tabId:wr,children:(0,r.jsx)(Fr,{})}),(0,r.jsx)(or,{changingTabId:c,tabId:kr,children:(0,r.jsx)(Tr,{})}),(0,r.jsx)(or,{changingTabId:c,tabId:Or,children:(0,r.jsx)(Cr,{})})]})}}},function(e){e.O(0,[412,438,894,182,960,644,692,111,62,195,987,157,48,336,86,560,774,888,179],(function(){return n=4173,e(e.s=n);var n}));var n=e.O();_N_E=n}]);