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
101 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 b=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,y=e.renderInput,g=e.sx,j=v(e,["componentsProps","extendRenderInput","label","messageBoxProps","renderInput","sx"]),w=h({paper:{sx:{backgroundColor:d.lD}}},n),x=null!==y&&void 0!==y?y: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:b},j,{componentsProps:w,renderInput:x,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(2027),h=t(8859),v=t(2749);function b(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 y(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){y(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 w(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 x(e){return function(e){if(Array.isArray(e))return b(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 b(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)?b(e,n):void 0}}var O={width:"100%"},I="gate-input",P="".concat(I,"-credential-id"),S="".concat(I,"-credential-passphrase"),Z="access",A=(0,i.forwardRef)((function(e,n){var t,b,y=e.formContainer,k=void 0===y||y,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,$=e.onIdentifierBlurAppend,G=e.onSubmit,V=e.onSubmitAppend,z=e.passphraseId,W=void 0===z?S: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=w((0,v.Z)(!1),2),he=me[0],ve=me[1],be=(0,h.Z)([P,S],pe),ye=be.buildFinishInputTestBatchFunction,ge=be.buildInputFirstRenderFunction,je=be.buildInputUnmountFunction,we=be.isFormInvalid,xe=be.setMessage,ke=(0,i.useMemo)((function(){return null!==G&&void 0!==G?G: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(),xe(Z),ve(!0);var i=o.target,a=i.elements,u=a.namedItem(P),c=u.value,s=a.namedItem(S),l=s.value;null===V||void 0===V||(r=V).call.apply(r,[null,c,l,function(e){xe(Z,e)},ve].concat(x(n)))}}),[G,V,ve,xe]),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:we,type:"submit",children:ne})})}),[we,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!==(b=null===(n=fe.current.getValue)||void 0===n?void 0:n.call(null))&&void 0!==b?b:""}},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(){xe(N)}),{onFinishBatch:ye(N)},(function(e){xe(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===$||void 0===$||(r=$).call.apply(r,[null].concat(x(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(){xe(W)}),{onFinishBatch:ye(W)},(function(e){xe(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 Lr}});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),b=t(4386),y=t(4188),g=t(4690),j=t(4069),w=t(6284),x=t(3679),k=t(2519),O=t(480),I=t(2852),P=t(7169),S=t(7750);function Z(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){Z(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)(S.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(2027);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)(w.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=y.Z.password),(0,r.jsx)(j.Z,{input:(0,r.jsx)(w.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 y,g,j=e.optional,w=e.required,x=null!==(y=D[s])&&void 0!==y?y: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),Z=x({formUtils:i,id:k,isChecked:E.includes(O),isRequired:I,isSensitive:P,label:u,selectOptions:h,value:O}),A=(0,r.jsx)(b.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)(S.Ac,{children:p})},t,{children:(0,r.jsx)(m.Z,{children:Z})}),"".concat(k,"-tooltip"));return I?w.push(A):j.push(A),e}),{optional:[],required:[]}),h=p.optional,v=p.required,y=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)(x.TZ,{expandInitially:!0,header:"Required parameters",children:(0,r.jsxs)(L,{children:[(0,r.jsx)(j.Z,{input:(0,r.jsx)(w.Z,{id:y,label:k,name:y,value:u}),inputTestBatch:(0,T.Gn)(k,(function(){d(y)}),{onFinishBatch:s(y)},(function(e){d(y,{children:e})})),onFirstRender:l(y),required:!0},"".concat(y,"-wrapper")),v]})}),(0,r.jsx)(x.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),$=t(1081);function G(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 V(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 G(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 G(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,$.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){V(e,n,t[n])}))}return e}({component:"li",sx:{display:"flex",flexDirection:"column","& > *":{width:"100%"}}},e,{children:[(0,r.jsx)(S.Ac,{inverted:!0,sx:{fontSize:"1.2em",fontWeight:a?400:void 0},children:i}),(0,r.jsx)(S.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,$.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],b=h[1],y=le((0,ae.Z)(void 0),2),j=y[0],w=y[1],k=(0,a.useState)(!1),O=k[0],I=k[1],P=le((0,ae.Z)(!0),2),Z=P[0],A=P[1],M=(0,te.Z)("".concat(p.Z,"/fence"),{onSuccess:function(e){return b(e)},refreshInterval:6e4}).isLoading,F=(0,a.useCallback)((function(){u.Z.get("/fence").then((function(e){var n=e.data;b(n)}))}),[b]),T=(0,ie.Z)([W],o),C=T.isFormInvalid,U=T.isFormSubmitting,N=T.submitForm,E=(0,re.Z)({list:v}),R=E.buildDeleteDialogProps,B=E.checks,D=E.getCheck,q=E.hasChecks,L=E.resetChecks,_=E.setCheck,G=(0,a.useCallback)((function(e){var n=e.cap,t=e.depth,r=e.key;return 0===t?n(r):r}),[]),V=(0,a.useMemo)((function(){return(0,r.jsx)(ee.Z,{allowEdit:!0,allowItemButton:O,disableDelete:!q,edit:O,header:!0,listItems:v,onAdd:function(){var e;m({actionProceedText:"Add",content:(0,r.jsx)(Q,{fenceTemplate:j,formUtils:T}),onSubmitAppend:function(e){var t;if(j){var o=he(j,e),i=o.agent,a=o.name;s({actionProceedText:"Add",content:(0,r.jsx)(X.Z,{entries:o,hasPassword:!0,getEntryLabel:G}),onProceedAppend:function(){N({body:o,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to add fence device. ",e]})},method:"post",onSuccess:function(){return F()},successMsg:"Added fence device ".concat(a),url:"/fence"})},titleText:(0,r.jsxs)(S.z,{children:["Add a"," ",(0,r.jsx)(S.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(R({getConfirmDialogTitle:function(e){return"Delete ".concat(e," fence device(s)?")},onProceedAppend:function(){N({body:{uuids:B},getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to delete fence device(s). ",e]})},method:"delete",onSuccess:function(){F(),L()},url:"/fence"})},renderEntry:function(e){var n=e.key;return(0,r.jsx)(S.Ac,{children:null===v||void 0===v?void 0:v[n].fenceName})}})),null===(e=n.current.setOpen)||void 0===e||e.call(null,!0)},onEdit:function(){I((function(e){return!e}))},onItemCheckboxChange:function(e,n,t){_(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:j,formUtils:T,previousFenceName:a,previousFenceParameters:u}),onSubmitAppend:function(e){var t;if(j){var o=he(j,e);s({actionProceedText:"Update",content:(0,r.jsx)(X.Z,{entries:o,hasPassword:!0,getEntryLabel:G}),onProceedAppend:function(){N({body:o,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to update fence device. ",e]})},method:"put",onSuccess:function(){return F()},successMsg:"Updated fence device ".concat(a),url:"/fence/".concat(c)})},titleText:(0,r.jsxs)(S.z,{children:["Update"," ",(0,r.jsx)(S.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)(S.z,{children:["Update fence device"," ",(0,r.jsx)(S.Q0,{fontSize:"inherit",children:a})," ","parameters"]})}),null===(o=t.current.setOpen)||void 0===o||o.call(null,!0)},renderListItemCheckboxState:function(e){return D(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)(S.Ac,{children:o}),(0,r.jsx)(S.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)(S.PJ,{inline:!0,children:i})]}):(0,r.jsxs)(r.Fragment,{children:[a,i]}),(0,r.jsxs)(r.Fragment,{children:[e," ",a,'"']})}),t)})]})}})}),[R,B,v,j,T,D,F,G,q,O,L,_,s,m,N]),z=(0,a.useMemo)((function(){return Z||M?(0,r.jsx)(H.Z,{}):V}),[M,Z,V]),ue=(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;w(n)})).catch((function(e){(0,d.Z)(e)})).finally((function(){A(!1)})),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(x.s_,{children:[(0,r.jsx)(x.V9,{children:(0,r.jsx)(S.z,{children:"Manage fence devices"})}),z]}),(0,r.jsx)(K.Z,se({dialogProps:{PaperProps:{sx:{minWidth:{xs:"90%",md:"50em"}}}},scrollBoxProps:{padding:".3em .5em"}},f,{disableProceed:C,loadingAction:U,preActionArea:ue,ref:t,scrollContent:!0,showClose:!0})),(0,r.jsx)(Y.Z,se({closeOnProceed:!0,scrollBoxProps:{paddingRight:"1em"}},c,{ref:n,scrollContent:!0}))]})},be=t(8951);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 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 je(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){ge(e,n,t[n])}))}return e}function we(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,ke="an-host-input",Oe="".concat(ke,"-cell"),Ie="IPMI IP",Pe=(ge(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})),ge(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}})),ge(xe,"ipmi",(function(e,n){var t=n.dataset.hostId,r=void 0===t?"":t,o=n.value;e.hostConfig.hosts[r].ipmiIp=o})),ge(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})),ge(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),Se={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,b=p.networks,y=void 0===b?{}:b,k=p.upses,O=void 0===k?{}:k,I=e.hostLabel,P=void 0===I?"".concat(d.replace("node","subnode")," ").concat(s):I,Z=(0,a.useMemo)((function(){return Object.entries(h)}),[h]),A=(0,a.useMemo)((function(){return Object.entries(y)}),[y]),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(ke,"-").concat(c)}),[c]),N=(0,a.useMemo)((function(){return function(e){return"".concat(ke,"-").concat(e,"-ipmi-ip")}(c)}),[c]),E=(0,a.useMemo)((function(){return"".concat(Oe,"-").concat(c,"-ipmi-ip")}),[c]),R=(0,a.useMemo)((function(){return Z.reduce((function(e,n){var i=we(n,2),a=i[0],s=i[1],l=s.fenceName,d=s.fencePort,f="".concat(Oe,"-").concat(c,"-").concat(a,"-port"),p=function(e,n){return"".concat(ke,"-").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)(w.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,Z,c,u]),B=(0,a.useMemo)((function(){return A.reduce((function(e,n){var a=we(n,2),s=a[0],l=a[1],d=l.networkIp,f=l.networkNumber,p=l.networkType,m="".concat(Oe,"-").concat(c,"-").concat(s,"-ip"),h=function(e,n){return"".concat(ke,"-").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)(w.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=we(n,2),o=t[0],i=t[1],a=i.isUsed,u=i.upsName,s="".concat(Oe,"-").concat(c,"-").concat(o,"-power-host"),l=function(e,n){return"".concat(ke,"-").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:Se,layout:D,spacing:"1em"})}),[C,D]);return(0,r.jsxs)(x.Lg,{mv:0,children:[(0,r.jsx)(x.CH,{children:(0,r.jsx)(S.Ac,{children:P})}),(0,r.jsxs)(x.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:Se,layout:je({},B,ge({},E,{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(w.Z,{baseInputProps:{"data-handler":"ipmi","data-host-id":c},id:N,label:Ie,value:v}),inputTestBatch:(0,T._)("".concat(c," ").concat(Ie),(function(){u(N)}),{onFinishBatch:t(N)},(function(e){u(N,{children:e})})),onFirstRender:o(N),onUnmount:i(N)})}),R),spacing:"1em"}),q]})]})]})};function Ae(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 Me(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 Ae(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 Ae(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 Fe="".concat("an-host-config-input","-group"),Te="".concat(Fe,"-cell"),Ce={node1:{hostNumber:1,hostType:"node"},node2:{hostNumber:2,hostType:"node"}},Ue=function(e){var n=e.anSeq,t=e.minIp,r=e.offset3,o=void 0===r?10:r,i=e.step3,a=void 0===i?2:i,u=e.subnetMask,c=e.subSeq;try{var s=new be.Netmask("".concat(t,"/").concat(u));if(16!==s.bitmask)return"".concat(s.base.replace(/\.0/g,""),".");var l=(n-1)*a+o,d=c;return t.replace(/^((\d+\.){2})\d+\.\d+$/,"$1".concat(l,".").concat(d))}catch(f){return""}},Ne=function(e){var n=e.anSequence,t=e.formUtils,o=e.knownFences,i=void 0===o?{}:o,u=e.knownUpses,c=void 0===u?{}:u,s=e.networkListEntries,d=e.previous,f=(void 0===d?{}:d).hosts,p=void 0===f?Ce:f,m=(0,a.useMemo)((function(){return Object.entries(p)}),[p]),h=(0,a.useMemo)((function(){return Object.values(i)}),[i]),v=(0,a.useMemo)((function(){return Object.values(c)}),[c]),b=(0,a.useMemo)((function(){return m.reduce((function(e,o){var i=Me(o,2),a=i[0],u=i[1],c=u.fences,l=void 0===c?{}:c,d=u.hostNumber,f=u.hostType,p=u.ipmiIp,m=u.networks,b=void 0===m?{}:m,y=u.upses,g=void 0===y?{}:y,j=p,w=h.reduce((function(e,n){var t=n.fenceName,r=l[t],o=(void 0===r?{}:r).fencePort,i=void 0===o?"":o;return e[t]={fenceName:t,fencePort:i},e}),{}),x=s.reduce((function(e,t){var r=Me(t,2),o=r[0],i=r[1],a=i.networkMinIp,u=i.networkNumber,c=i.networkSubnetMask,s=i.networkType,l=b[o],f=(void 0===l?{}:l).networkIp,p=void 0===f?"":f;return p||(p=Ue({anSeq:n,minIp:a,subnetMask:c,subSeq:d})),j||"bcn"!==s||1!==u||(j=Ue({anSeq:n,minIp:a,offset3:11,subnetMask:c,subSeq:d})),e[o]={networkIp:p,networkNumber:u,networkType:s},e}),{}),k=v.reduce((function(e,n){var t=n.upsName,r=g[t],o=(void 0===r?{}:r).isUsed,i=void 0===o||o;return e[t]={isUsed:i,upsName:t},e}),{});return e["".concat(Te,"-").concat(a)]={children:(0,r.jsx)(Ze,{formUtils:t,hostId:a,hostNumber:d,hostType:f,previous:{fences:w,ipmiIp:j,networks:x,upses:k}}),md:3,sm:2},e}),{})}),[n,t,m,h,v,s]);return(0,r.jsx)(l.Z,{columns:{xs:1,sm:2,md:3},layout:b,spacing:"1em"})},Ee=t(6486),Re="an-id-input",Be="".concat(Re,"-domain"),De="".concat(Re,"-prefix"),qe="".concat(Re,"-sequence"),Le="Domain name",_e="Prefix",He="Sequence",$e=function(e){var n=e.debounceWait,t=void 0===n?500:n,o=e.formUtils,i=o.buildFinishInputTestBatchFunction,u=o.buildInputFirstRenderFunction,c=o.setMessage,s=e.onSequenceChange,d=e.previous,f=void 0===d?{}:d,p=f.domain,m=f.prefix,h=f.sequence,v=(0,a.useMemo)((function(){return s&&(0,Ee.debounce)(s,t)}),[t,s]);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)(w.Z,{id:De,label:_e,value:m}),inputTestBatch:(0,T.Gn)(_e,(function(){c(De)}),{onFinishBatch:i(De)},(function(e){c(De,{children:e})})),onFirstRender:u(De),required:!0})},"an-id-input-cell-domain":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(w.Z,{id:Be,label:Le,value:p}),inputTestBatch:(0,T.Gn)(Le,(function(){c(Be)}),{onFinishBatch:i(Be)},(function(e){c(Be,{children:e})})),onFirstRender:u(Be),required:!0})},"an-id-input-cell-sequence":{children:(0,r.jsx)(j.Z,{createInputOnChangeHandlerOptions:{postSet:v},input:(0,r.jsx)(w.Z,{id:qe,label:He,value:h}),inputTestBatch:(0,T.qY)(He,(function(){c(qe)}),{onFinishBatch:i(qe)},(function(e){c(qe,{children:e})})),onFirstRender:u(qe),required:!0,valueType:"number"})}},spacing:"1em"})},Ge=t(5934),Ve=t(3106),ze=t(7971);function We(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 Qe(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Ye(e){return function(e){if(Array.isArray(e))return We(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 We(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 We(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 Je="an-network-input",Ke="".concat(Je,"-cell"),Xe={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}},en=function(e){var n,t=e.debounceWait,o=void 0===t?500:t,i=e.formUtils,u=i.buildFinishInputTestBatchFunction,c=i.buildInputFirstRenderFunction,s=i.buildInputUnmountFunction,d=i.setMessage,f=e.inputGatewayLabel,p=void 0===f?"Gateway":f,m=e.inputMinIpLabel,h=void 0===m?"IP address":m,v=e.inputSubnetMaskLabel,b=void 0===v?"Subnet mask":v,y=e.networkId,g=e.networkNumber,O=e.networkType,I=e.networkTypeOptions,P=e.onClose,S=e.onNetworkGatewayChange,Z=e.onNetworkMinIpChange,A=e.onNetworkSubnetMaskChange,M=e.onNetworkTypeChange,F=e.previous,C=void 0===F?{}:F,U=C.gateway,N=C.minIp,E=C.subnetMask,R=e.readonlyNetworkName,B=e.showCloseButton,D=e.showGateway,q=(0,a.useMemo)((function(){return"".concat(Ve.Z[O]," ").concat(g)}),[g,O]),L=(0,a.useMemo)((function(){return"".concat(Ke,"-").concat(y,"-gateway")}),[y]),_=(0,a.useMemo)((function(){return"".concat(Ke,"-").concat(y,"-ip")}),[y]),H=(0,a.useMemo)((function(){return"".concat(Ke,"-").concat(y,"-subnet-mask")}),[y]),$=(0,a.useMemo)((function(){return"".concat(Je,"-").concat(y)}),[y]),G=(0,a.useMemo)((function(){return function(e){return"".concat(Je,"-").concat(e,"-gateway")}(y)}),[y]),V=(0,a.useMemo)((function(){return function(e){return"".concat(Je,"-").concat(e,"-min-ip")}(y)}),[y]),z=(0,a.useMemo)((function(){return function(e){return"".concat(Je,"-").concat(e,"-network-type")}(y)}),[y]),W=(0,a.useMemo)((function(){return function(e){return"".concat(Je,"-").concat(e,"-subnet-mask")}(y)}),[y]),Q=(0,a.useMemo)((function(){return D?void 0:"none"}),[D]),Y=(0,a.useMemo)((function(){return S&&(0,Ee.debounce)(S,o)}),[o,S]),J=(0,a.useMemo)((function(){return Z&&(0,Ee.debounce)(Z,o)}),[o,Z]),K=(0,a.useMemo)((function(){return A&&(0,Ee.debounce)(A,o)}),[o,A]),X=(0,a.useMemo)((function(){return B&&(0,r.jsx)(ze.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===P||void 0===P||(r=P).call.apply(r,[null,{networkId:y,networkType:O}].concat(Ye(n)))},sx:{padding:".2em",position:"absolute",right:"-.6rem",top:"-.2rem"}})}),[B,y,O,P]),ee=(0,a.useMemo)((function(){var e;return D&&G&&(e=(0,r.jsx)(j.Z,{createInputOnChangeHandlerOptions:{postSet:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r;return null===Y||void 0===Y?void 0:(r=Y).call.apply(r,[null,{networkId:y,networkType:O}].concat(Ye(n)))}},input:(0,r.jsx)(w.Z,{baseInputProps:{"data-handler":"gateway","data-network-id":y},id:G,label:p,value:U}),inputTestBatch:(0,T._)("".concat(q," ").concat(p),(function(){d(G)}),{onFinishBatch:u(G)},(function(e){d(G,{children:e})})),onFirstRender:c(G),onUnmount:s(G),required:D})),e}),[D,G,y,p,U,q,u,c,s,Y,O,d]);return(0,r.jsxs)(x.Lg,{mv:0,children:[(0,r.jsxs)(x.CH,{children:[(0,r.jsx)(j.Z,{input:(0,r.jsx)(k.Z,{id:z,isReadOnly:R,onChange:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r;null===M||void 0===M||(r=M).call.apply(r,[null,{networkId:y,networkType:O}].concat(Ye(n)))},selectItems:I,selectProps:{renderValue:function(){return q}},value:O})}),X]}),(0,r.jsxs)(x.bc,{children:[(0,r.jsx)("input",{hidden:!0,id:$,readOnly:!0,"data-handler":"network","data-network-id":y,"data-network-number":g,"data-network-type":O}),(0,r.jsx)(l.Z,{layout:(n={},Qe(n,_,{children:(0,r.jsx)(j.Z,{createInputOnChangeHandlerOptions:{postSet:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r;return null===J||void 0===J?void 0:(r=J).call.apply(r,[null,{networkId:y,networkType:O}].concat(Ye(n)))}},input:(0,r.jsx)(w.Z,{baseInputProps:{"data-handler":"minip","data-network-id":y},id:V,label:h,value:N}),inputTestBatch:(0,T._)("".concat(q," ").concat(h),(function(){d(V)}),{onFinishBatch:u(V)},(function(e){d(V,{children:e})})),onFirstRender:c(V),onUnmount:s(V),required:!0})}),Qe(n,H,{children:(0,r.jsx)(j.Z,{createInputOnChangeHandlerOptions:{postSet:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r;return null===K||void 0===K?void 0:(r=K).call.apply(r,[null,{networkId:y,networkType:O}].concat(Ye(n)))}},input:(0,r.jsx)(w.Z,{baseInputProps:{"data-handler":"subnetmask","data-network-id":y},id:W,label:b,value:E}),inputTestBatch:(0,T._)("".concat(q," ").concat(b),(function(){d(W)}),{onFinishBatch:u(W)},(function(e){d(W,{children:e})})),onFirstRender:c(W),onUnmount:s(W),required:!0})}),Qe(n,L,{children:ee,display:Q}),n),spacing:"1em"})]})]})},nn=t(6607);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 rn(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function on(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){rn(e,n,t[n])}))}return e}function an(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 un(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 tn(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 tn(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 cn="an-network-config-input",sn="".concat(cn,"-cell"),ln="".concat(cn,"-dns"),dn="".concat(cn,"-mtu"),fn="".concat(cn,"-ntp"),pn=Object.entries(Ve.Z),mn={bcn:{base:"10.201.0.0",mask:"255.255.0.0"},mn:{base:"10.199.0.0",mask:"255.255.0.0"},sn:{base:"10.101.0.0",mask:"255.255.0.0"}},hn=function(e){return"ifn"===e},vn=function(e){return"mn"===e},bn=function(e){var n,t=e.entries,r=e.type,o=t.filter((function(e){return un(e,2)[1].networkType===r})).sort((function(e,n){return un(e,2)[1].networkNumber>un(n,2)[1].networkNumber?1:-1})).pop();if(!o)return null!==(n=mn[r])&&void 0!==n?n:{};var i=un(o,2)[1],a=i.networkMinIp,u=i.networkSubnetMask;try{var c=new be.Netmask("".concat(a,"/").concat(u)).next();return{base:c.base,mask:c.mask}}catch(s){return{}}},yn=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,b=(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 un(n,2)[1].networkType===e&&(c+=1),t<u})),c}),[t]),y=(0,a.useMemo)((function(){return pn.map((function(e){var n=un(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,r=void 0===n?"":n,o=e.networkSubnetMask,i=void 0===o?"":o,a=e.networkType,u=void 0===a?t.some((function(e){var n=un(e,2)[1].networkType;return vn(n)}))?"ifn":"mn":a,c=e.networkGateway,s=void 0===c?hn(u)?"":void 0:c,l=e.networkNumber,d=void 0===l?b(u)+1:l,f=bn({entries:t,type:u}),p=f.base,m=void 0===p?r:p,h=f.mask,v=void 0===h?i:h;return{network:{networkGateway:s,networkMinIp:m,networkNumber:d,networkSubnetMask:v,networkType:u},networkId:(0,Ge.Z)()}}),[b,t]),x=(0,a.useCallback)((function(e,n){return f((0,nn.ZP)(e,n))}),[f]),k=(0,a.useCallback)((function(e,n,t){return f((function(r){var o=on({},r),i=o[e];return i&&(i[n]=t),o}))}),[f]),O=(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 i=un(n,2),s=i[0],l=i[1],d=l.networkNumber,f=l.networkType,p=l.networkMinIp,m=l.networkSubnetMask,h=an(l,["networkNumber","networkType","networkMinIp","networkSubnetMask"]),b=d,y=f;s===r&&(u=!0,y=a,v(RegExp(s)));var g=y===a;if(g&&(c+=1),u){g?b=c:y===o&&(b-=1);var j=bn({entries:t,type:y}),w=j.base,x=void 0===w?p:w,k=j.mask,O=void 0===k?m:k;e[s]=on({},h,{networkMinIp:x,networkSubnetMask:O,networkNumber:b,networkType:y})}else e[s]=l;return e}),{});f(s)}),[t,v,f]),I=(0,a.useCallback)((function(e){var n=e.networkId,r=e.networkType,o=!1,i=0,a=t.reduce((function(e,t){var a=un(t,2),u=a[0],c=a[1];if(u===n)return o=!0,e;var s=c.networkType===r;return s&&(i+=1),e[u]=o&&s?on({},c,{networkNumber:i}):c,e}),{});f(a)}),[t,f]),P=(0,a.useMemo)((function(){var e={};return e=t.reduce((function(e,t){var o=un(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(sn,"-").concat(i),p=1===s,m=hn(d),h=vn(d)||!p;return e[f]={children:(0,r.jsx)(en,{formUtils:n,networkId:i,networkNumber:s,networkType:d,networkTypeOptions:y,onClose:I,onNetworkMinIpChange:function(e,n){var t=e.networkId,r=n.target.value;return k(t,"networkMinIp",r)},onNetworkSubnetMaskChange:function(e,n){var t=e.networkId,r=n.target.value;return k(t,"networkSubnetMask",r)},onNetworkTypeChange:O,previous:{gateway:u,minIp:c,subnetMask:l},readonlyNetworkName:!h,showCloseButton:h,showGateway:m}),md:3,sm:2},e}),e)}),[t,n,y,I,O,k]);return(0,r.jsx)(l.Z,{columns:{xs:1,sm:2,md:3},layout:on({},P,{"an-network-config-cell-add-network":{children:(0,r.jsx)(ze.Z,{mapPreset:"add",onClick:function(){var e=g(),n=e.network,t=e.networkId;x(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)(w.Z,{id:ln,label:"DNS",value:c}),inputTestBatch:(0,T.dg)("DNS",(function(){h(ln)}),{onFinishBatch:p(ln)},(function(e){h(ln,{children:e})})),onFirstRender:m(ln),required:!0})},"an-network-config-input-cell-ntp":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(w.Z,{id:fn,label:"NTP",value:d}),inputTestBatch:(0,T.dg)("NTP",(function(){h(fn)}),{onFinishBatch:p(fn)},(function(e){h(fn,{children:e})})),onFirstRender:m(fn)})},"an-network-config-input-cell-mtu":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(w.Z,{id:dn,inputProps:{placeholder:"1500"},label:"MTU",value:s}),inputTestBatch:(0,T.qY)("MTU",(function(){h(dn)}),{onFinishBatch:p(dn)},(function(e){h(dn,{children:e})})),onFirstRender:m(dn),valueType:"number"})}}),spacing:"1em"})};function gn(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 jn={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"}},wn=function(e){var n,t=e.formUtils,o=e.knownFences,i=e.knownUpses,u=e.previous,c=void 0===u?{}:u,s=c.hostConfig,l=c.networkConfig,d=void 0===l?{}:l,f=gn(e.previous,["hostConfig","networkConfig"]),p=d.networks,m=void 0===p?jn:p,h=(0,a.useState)(null!==(n=null===f||void 0===f?void 0:f.sequence)&&void 0!==n?n:0),v=h[0],b=h[1],y=(0,a.useState)(m),j=y[0],w=y[1],x=(0,a.useMemo)((function(){return Object.entries(j)}),[j]);return(0,r.jsxs)(g.Z,{children:[(0,r.jsx)($e,{formUtils:t,onSequenceChange:function(e){var n=e.target.value;b(Number(n))},previous:f}),(0,r.jsx)(yn,{formUtils:t,networkListEntries:x,previous:d,setNetworkList:w}),(0,r.jsx)(Ne,{anSequence:v,formUtils:t,knownFences:o,knownUpses:i,networkListEntries:x,previous:s})]})},xn=function(e){var n=e.formUtils,t=e.knownFences,o=e.knownUpses,i=e.previous;return(0,r.jsx)(wn,{formUtils:n,knownFences:t,knownUpses:o,previous:i})};function kn(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 On(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function In(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){On(e,n,t[n])}))}return e}function Pn(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 kn(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 kn(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 Sn="run-manifest-input",Zn="".concat(Sn,"-host"),An="".concat(Sn,"-an-description"),Mn="".concat(Sn,"-an-password"),Fn="".concat(Sn,"-an-confirm-password"),Tn="Description",Cn="Password",Un="Confirm password",Nn="--",En=(0,v.ZP)(S.$_)({justifyContent:"end"}),Rn=function(e){return"".concat(Zn,"-").concat(e)},Bn=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,b=h.hostConfig,x=void 0===b?{}:b,O=h.networkConfig,I=void 0===O?{}:O,P=(0,a.useRef)({}),Z=x.hosts,A=void 0===Z?{}:Z,M=I.dnsCsv,F=I.mtu,C=I.networks,U=void 0===C?{}:C,N=I.ntpCsv,E=void 0===N?Nn: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=Pn(e,2)[1];return{displayValue:n.hostName,value:n.hostUUID}}))}),[D]),H=(0,a.useMemo)((function(){return R.reduce((function(e,n){var a=Pn(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)(S.Ac,{children:h})};var b=Rn(u),y="".concat(h," host");return p["run-manifest-host-cell-".concat(u)]={children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(k.Z,{id:b,label:y,selectItems:_,value:""}),inputTestBatch:(0,T.Gn)(y,(function(){i(b)}),{onFinishBatch:t(b)},(function(e){i(b,{children:e})})),onFirstRender:o(b),required:!0})},m["run-manifest-new-host-name-cell-".concat(u)]={children:(0,r.jsxs)(S.$_,{children:[s,".",v]})},e}),{headers:{"run-manifest-column-header-cell-offset":{}},hosts:{"run-manifest-host-cell-header":{children:(0,r.jsx)(S.Ac,{children:"Uses host"})}},hostNames:{"run-manifest-new-host-name-cell-header":{children:(0,r.jsx)(S.Ac,{children:"New hostname"})}}})}),[v,t,o,R,_,i]),$=H.headers,G=H.hosts,V=H.hostNames,z=(0,a.useMemo)((function(){return L.reduce((function(e,n){var t=Pn(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)(S.Ac,{children:f})},R.forEach((function(e){var n=Pn(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?Nn:u;l["".concat(d,"-").concat(t,"-ip")]={children:(0,r.jsx)(S.$_,{children:c})}}));var p="run-manifest-gateway-cell";return a&&!s[p]&&(s[p]={children:(0,r.jsx)(En,{children:a})}),e}),{gateway:{"run-manifest-gateway-cell-header":{children:(0,r.jsx)(S.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=Pn(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)(S.Ac,{children:["Port on ",i]})},R.forEach((function(n){var t=Pn(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?Nn:s;e["".concat(a,"-").concat(o,"-port")]={children:(0,r.jsx)(S.$_,{children:l})}})),e}),{})}),[R,B]),J=(0,a.useMemo)((function(){return q.reduce((function(e,n){var t=Pn(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)(S.Ac,{children:["Uses ",i]})},R.forEach((function(n){var t=Pn(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)(S.$_,{children:l?"yes":"no"})}})),e}),{})}),[R,q]),K=(0,a.useMemo)((function(){var e=(0,T.Gn)(Un,(function(){i(Fn)}),{onFinishBatch:t(Fn)},(function(e){i(Fn,{children:e})})),n=o(Fn);return e.tests.push({onFailure:function(){i(Fn,{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)(w.Z,{id:An,label:Tn}),inputTestBatch:(0,T.Gn)(Tn,(function(){i(An)}),{onFinishBatch:t(An)},(function(e){i(An,{children:e})})),onFirstRender:o(An),required:!0}),sm:2},"run-manifest-input-cell-an-password":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(w.Z,{id:Mn,label:Cn,type:y.Z.password}),inputTestBatch:(0,T.Gn)(Cn,(function(){i(Mn)}),{onFinishBatch:t(Mn)},(function(e){i(Mn,{children:e})})),onFirstRender:o(Mn),ref:P,required:!0})},"run-manifest-input-cell-an-confirm-password":{children:(0,r.jsx)(j.Z,In({input:(0,r.jsx)(w.Z,{id:Fn,label:Un,type:y.Z.password}),required:!0},K))}},spacing:"1em"}),(0,r.jsx)(l.Z,{alignItems:"center",columns:{xs:R.length+1},layout:In({},$,G,V,Q,Y,J),columnSpacing:"1em",rowSpacing:"0.4em"}),(0,r.jsx)(l.Z,{columns:{xs:2},layout:In({},W,{"run-manifest-dns-csv-cell-header":{children:(0,r.jsx)(S.Ac,{children:"DNS"})},"run-manifest-dns-csv-cell":{children:(0,r.jsx)(En,{children:M})},"run-manifest-ntp-csv-cell-header":{children:(0,r.jsx)(S.Ac,{children:"NTP"})},"run-manifest-ntp-csv-cell":{children:(0,r.jsx)(En,{children:E})},"run-manifest-mtu-cell-header":{children:(0,r.jsx)(S.Ac,{children:"MTU"})},"run-manifest-mtu-cell":{children:(0,r.jsx)(En,{children:F})}}),spacing:"0.4em"})]})};function Dn(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,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Ln(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){qn(e,n,t[n])}))}return 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)||$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.")}()}function Hn(e){return function(e){if(Array.isArray(e))return Dn(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(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.")}()}function $n(e,n){if(e){if("string"===typeof e)return Dn(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)?Dn(e,n):void 0}}var Gn=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=_n(n,1),o=r[0].target,i=o.elements,a=i.namedItem(Be),u=a.value,c=i.namedItem(De),s=c.value,l=i.namedItem(qe),d=l.value,f=i.namedItem(ln),p=f.value,m=i.namedItem(dn),h=m.value,v=i.namedItem(fn),b=v.value,y=Number.parseInt(h,10),g=Number.parseInt(d,10);return Object.values(i).reduce((function(e,n){var t=n.id;if(RegExp("^".concat(ke)).test(t)){var r,o=n,i=o.dataset.handler;null===(r=Pe[void 0===i?"":i])||void 0===r||r.call(null,e,o)}else if(RegExp("^".concat(Je)).test(t)){var a,u=n,c=u.dataset.handler;null===(a=Xe[void 0===c?"":c])||void 0===a||a.call(null,e,u)}return e}),{domain:u,hostConfig:{hosts:{}},networkConfig:{dnsCsv:p,mtu:y,networks:{},ntpCsv:b},prefix:s,sequence:g})},Vn=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=_n(t,1),i=o[0].target,a=i.elements,u=a.namedItem(An),c=u.value,s=a.namedItem(Mn),l=s.value,d=Object.entries(e).reduce((function(e,n){var t=_n(n,2),r=t[0],o=t[1],i=o.hostNumber,u=o.hostType,c=Rn(r),s=a.namedItem(c).value;return e[r]={hostNumber:i,hostType:u,hostUuid:s},e}),{});return{description:c,hosts:d,password:l}},zn=function(){var e=(0,$.Z)(),n=(0,a.useRef)({}),t=(0,a.useRef)({}),o=(0,a.useRef)({}),i=(0,a.useRef)({}),c=(0,a.useRef)({}),s=_n((0,oe.Z)(),2),l=s[0],f=s[1],m=_n((0,ae.Z)(void 0),2),h=m[0],v=m[1],b=(0,a.useState)(!1),y=b[0],j=b[1],w=_n((0,ae.Z)(!0),2),k=w[0],O=w[1],I=_n((0,ae.Z)(!0),2),P=I[0],Z=I[1],A=_n((0,ae.Z)(!0),2),M=A[0],F=A[1],T=_n((0,ae.Z)(void 0),2),C=T[0],U=T[1],N=_n((0,ae.Z)(void 0),2),E=N[0],R=N[1],B=_n((0,ae.Z)(void 0),2),D=B[0],q=B[1],L=(0,te.Z)("".concat(p.Z,"/manifest"),{onSuccess:function(e){return U(e)},refreshInterval:6e4}).isLoading,_=(0,a.useCallback)((function(){u.Z.get("/manifest").then((function(e){var n=e.data;U(n)}))}),[U]),G=(0,ie.Z)([Be,De,qe,ln,dn,fn],c),V=G.isFormInvalid,z=G.isFormSubmitting,W=G.submitForm,Q=(0,ie.Z)([Fn,An,Mn],c),J=Q.isFormInvalid,ue=Q.isFormSubmitting,ce=Q.submitForm,se=(0,re.Z)({list:C}),le=se.buildDeleteDialogProps,de=se.checks,fe=se.getCheck,pe=se.hasChecks,me=se.resetChecks,he=se.setCheck,ve=(0,a.useMemo)((function(){return null!==E&&void 0!==E?E:{}}),[E]),be=ve.hostConfig,ye=(void 0===be?{}:be).hosts,ge=void 0===ye?{}:ye,je=ve.name,we=ve.uuid,xe=(0,a.useMemo)((function(){return null!==D&&void 0!==D?D:{}}),[D]),ke=xe.domain,Oe=xe.fences,Ie=xe.prefix,Pe=xe.sequence,Se=xe.upses,Ze=(0,a.useMemo)((function(){return{actionProceedText:"Add",content:(0,r.jsx)(wn,{formUtils:G,knownFences:Oe,knownUpses:Se,previous:{domain:ke,prefix:Ie,sequence:Pe}}),onSubmitAppend:function(){for(var e=arguments.length,t=new Array(e),o=0;o<e;o++)t[o]=arguments[o];var i,a=Gn.apply(void 0,Hn(t));f({actionProceedText:"Add",content:(0,r.jsx)(X.Z,{entries:a,maxDepth:6}),onProceedAppend:function(){W({body:a,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to add install manifest. ",e]})},method:"post",onSuccess:function(){return _()},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,_,Oe,Se,ke,Ie,Pe,f,W]),Ae=(0,a.useMemo)((function(){return{actionProceedText:"Edit",content:(0,r.jsx)(xn,{formUtils:G,knownFences:Oe,knownUpses:Se,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=Gn.apply(void 0,Hn(t));f({actionProceedText:"Edit",content:(0,r.jsx)(X.Z,{entries:a,maxDepth:6}),onProceedAppend:function(){W({body:a,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to update install manifest. ",e]})},method:"put",onSuccess:function(){return _()},successMsg:"Successfully updated install manifest ".concat(je),url:"/manifest/".concat(we)})},titleText:"Update install manifest ".concat(je,"?")}),null===(i=n.current.setOpen)||void 0===i||i.call(null,!0)},loading:P,titleText:"Update install manifest ".concat(je)}}),[G,Oe,Se,E,P,je,f,W,we,_]),Me=(0,a.useMemo)((function(){return{actionProceedText:"Run",content:(0,r.jsx)(Bn,{formUtils:Q,knownFences:Oe,knownHosts:h,knownUpses:Se,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=Vn.apply(void 0,[ge].concat(Hn(t)));f({actionProceedText:"Run",content:(0,r.jsx)(X.Z,{entries:a,hasPassword:!0}),onProceedAppend:function(){ce({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(je),url:"/command/run-manifest/".concat(we)})},titleText:"Run install manifest ".concat(je,"?")}),null===(i=n.current.setOpen)||void 0===i||i.call(null,!0)},titleText:"Run install manifest ".concat(je)}}),[Q,Oe,h,Se,E,P,je,ge,f,ce,we]),Fe=(0,a.useCallback)((function(e,n){Z(!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(){Z(!1),null===n||void 0===n||n.call(null)}))}),[Z,R]),Te=(0,a.useMemo)((function(){return(0,r.jsx)(ee.Z,{allowEdit:!0,allowItemButton:y,disableDelete:!pe,edit:y,header:!0,listEmpty:"No manifest(s) registered.",listItems:C,onAdd:function(){var e;null===(e=t.current.setOpen)||void 0===e||e.call(null,!0)},onDelete:function(){var e;f(le({onProceedAppend:function(){W({body:{uuids:de},getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Delete manifest(s) failed. ",e]})},method:"delete",onSuccess:function(){_(),me()},url:"/manifest"})},getConfirmDialogTitle:function(e){return"Delete ".concat(e," manifest(s)?")},renderEntry:function(e){var n=e.key;return(0,r.jsx)(S.Ac,{children:null===C||void 0===C?void 0:C[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){he(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),Fe(r)},renderListItemCheckboxState:function(e){return fe(e)},renderListItem:function(e,n){var t=n.manifestName;return(0,r.jsxs)(g.Z,{fullWidth:!0,row:!0,children:[(0,r.jsx)(ze.Z,{disabled:y,mapPreset:"play",onClick:function(){var n;R({name:t,uuid:e}),null===(n=i.current.setOpen)||void 0===n||n.call(null,!0),Fe(e)},variant:"normal"}),(0,r.jsx)(S.Ac,{children:t})]})}})}),[le,de,fe,Fe,_,pe,y,C,me,he,f,R,W]),Ce=(0,a.useMemo)((function(){return k||M||L?(0,r.jsx)(H.Z,{}):Te}),[k,L,M,Te]),Ue=(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)(x.s_,{children:[(0,r.jsx)(x.V9,{children:(0,r.jsx)(S.z,{children:"Manage manifests"})}),Ce]}),(0,r.jsx)(K.Z,Ln({},Ze,{disableProceed:V,loadingAction:z,preActionArea:Ue,ref:t,scrollContent:!0,showClose:!0})),(0,r.jsx)(K.Z,Ln({},Ae,{disableProceed:V,loadingAction:z,preActionArea:Ue,ref:o,scrollContent:!0,showClose:!0})),(0,r.jsx)(K.Z,Ln({},Me,{disableProceed:J,loadingAction:ue,preActionArea:Ue,ref:i,scrollContent:!0,showClose:!0})),(0,r.jsx)(Y.Z,Ln({closeOnProceed:!0},l,{ref:n,scrollContent:!0,wide:!0}))]})},Wn=zn,Qn="common-ups-input-ip-address",Yn="common-ups-input-host-name",Jn="IP address",Kn="Host name",Xn=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)(w.Z,{id:Yn,label:Kn,value:s}),inputTestBatch:(0,T.Gn)(Kn,(function(){i(Yn)}),{onFinishBatch:t(Yn)},(function(e){i(Yn,{children:e})})),onFirstRender:o(Yn),required:!0})},"common-ups-input-cell-ip-address":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(w.Z,{id:Qn,label:Jn,value:c}),inputTestBatch:(0,T._)(Jn,(function(){i(Qn)}),{onFinishBatch:t(Qn)},(function(e){i(Qn,{children:e})})),onFirstRender:o(Qn),required:!0})}},spacing:"1em"})},et=t(5741);function nt(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 tt(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 nt(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 nt(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 rt="add-ups-select-ups-type-id",ot=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,$.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=tt(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)(et.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)(S.Ac,{inverted:!0,children:a}),(0,r.jsxs)(S.Ac,{inverted:!0,children:[u," (",n,")"]})]}),value:o}})):[]}),[u]),b=(0,a.useMemo)((function(){return u&&(0,r.jsx)(k.Z,{formControlProps:{sx:{marginTop:".3em"}},id:rt,label:"UPS type",onChange:function(e){var n=e.target.value,t=String(n);s(rt,!0),h(t)},required:!0,selectItems:v,selectProps:{onClearIndicatorClick:function(){s(rt,!1),h("")},renderValue:function(e){var n=String(e);return u[n].brand}},value:m})}),[u,v,m,s]),y=(0,a.useMemo)((function(){return t?(0,r.jsx)(H.Z,{}):(0,r.jsxs)(g.Z,{children:[b,m&&(0,r.jsx)(Xn,{formUtils:n,previous:i})]})}),[n,m,t,b,i]);return(0,a.useEffect)((function(){f&&c(rt)({isValid:Boolean(m)})}),[c,m,f]),y},it="edit-ups-input-ups-uuid",at=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)(ot,{formUtils:n,previous:o,upsTemplate:i}),(0,r.jsx)("input",{hidden:!0,id:it,readOnly:!0,value:u})]})}),[n,t,o,i,u])};function ut(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 ct(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function st(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){ct(e,n,t[n])}))}return e}function lt(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 ut(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 ut(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 dt=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=lt(t,1),a=i[0].target,u=a.elements,c=u.namedItem(Yn),s=c.value,l=u.namedItem(Qn),d=l.value,f=u.namedItem(rt),p="",m="",h="";f&&(p=(o=e[h=f.value]).agent,m=o.brand);var v=u.namedItem(it),b="";v&&(b=v.value);return{agent:p,brand:m,ipAddress:d,name:s,typeId:h,uuid:b}},ft=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)(S.Ac,{children:t}),(0,r.jsx)(S.$_,{children:o})]},"confirm-ups-".concat(i,"-").concat(e))}})},pt=function(){var e=(0,$.Z)(),n=(0,a.useRef)({}),t=(0,a.useRef)({}),o=(0,a.useRef)({}),i=lt((0,oe.Z)(),2),c=i[0],s=i[1],l=lt((0,oe.Z)(),2),f=l[0],m=l[1],h=(0,a.useState)(!1),v=h[0],b=h[1],y=lt((0,ae.Z)(!0),2),j=y[0],w=y[1],k=lt((0,ae.Z)(void 0),2),O=k[0],I=k[1],P=(0,te.Z)("".concat(p.Z,"/ups"),{refreshInterval:6e4}),Z=P.data,A=P.isLoading,M=(0,ie.Z)([Qn,Yn,rt],o),F=M.isFormInvalid,T=M.isFormSubmitting,C=M.submitForm,U=(0,re.Z)({list:Z}),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=lt(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)(at,{formUtils:M,previous:{upsIPAddress:a,upsName:u,upsTypeId:l},upsTemplate:O,upsUUID:c}),onSubmitAppend:function(e){var t;if(O){var o=dt(O,e),i=o.name;s({actionProceedText:"Update",content:ft(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)(S.z,{children:["Update"," ",(0,r.jsx)(S.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)(S.z,{children:["Update UPS"," ",(0,r.jsx)(S.Q0,{fontSize:"inherit",children:u})]})}}),[M,s,C,O]),L=(0,a.useMemo)((function(){return{actionProceedText:"Add",content:(0,r.jsx)(ot,{formUtils:M,upsTemplate:O}),onSubmitAppend:function(e){var t;if(O){var o=dt(O,e),i=o.brand,a=o.name;s({actionProceedText:"Add",content:ft(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)(S.z,{children:["Add a"," ",(0,r.jsx)(S.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:Z,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)(S.Ac,{children:null===Z||void 0===Z?void 0:Z[n].upsName})}})),null===(e=n.current.setOpen)||void 0===e||e.call(null,!0)},onEdit:function(){b((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)(S.Ac,{children:i}),(0,r.jsxs)(S.Ac,{children:['agent="',t,'"']}),(0,r.jsxs)(S.Ac,{children:['ip="',o,'"']})]})}})}),[L,N,q,E,R,B,v,D,s,m,C,Z]),G=(0,a.useMemo)((function(){return j||A?(0,r.jsx)(H.Z,{}):_}),[j,A,_]),V=(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(){w(!1)})),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(x.s_,{children:[(0,r.jsx)(x.V9,{children:(0,r.jsx)(S.z,{children:"Manage UPSes"})}),G]}),(0,r.jsx)(K.Z,st({},f,{disableProceed:F,loadingAction:T,preActionArea:V,ref:t,showClose:!0})),(0,r.jsx)(Y.Z,st({closeOnProceed:!0},c,{ref:n}))]})},mt=t(5697),ht=t(2186),vt=t(4799),bt=t(4825),yt=t(4629),gt=t(575),jt=t(4568),wt=t(3640),xt=t(476),kt=t(8061);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){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){It(e,n,t[n])}))}return e}function St(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 Zt(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 At=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=St(e.radioProps,["sx"]),m=(0,a.useMemo)((function(){return"string"===typeof u?(0,r.jsx)(S.Ac,{children:u}):u}),[u]),h=(0,a.useMemo)((function(){return Object.entries(s).map((function(e){var n=Zt(e,2),o=n[0],a=n[1],u=a.label,c=a.value,s="string"===typeof u?(0,r.jsx)(S.Ac,{children:u}):u;return(0,r.jsx)(O.Z,Pt({control:(0,r.jsx)(gt.Z,Pt({},p,{sx:Pt(It({},"&.".concat(jt.Z.root),{color:P.s7}),d)})),value:c,label:s},t),"".concat(i,"-").concat(o))}))}),[t,i,s,d,p]);return(0,r.jsxs)(wt.Z,Pt({},n,{children:[(0,r.jsx)(xt.Z,Pt({},o,{children:m})),(0,r.jsx)(kt.Z,Pt({onChange:c,row:!0},f,{children:h}))]}))},Mt=t(3144);function Ft(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 Tt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Ct(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 Ft(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 Ft(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 Ut="Alteeve enterprise key",Nt="Host name",Et="RedHat password",Rt="RedHat user",Bt="enterpriseKey",Dt="hostName",qt="redhatPassword",Lt="redhatUser",_t={xs:1,sm:2},Ht=function(){var e=(0,Mt.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)(),b=v[0],k=v[1],O=Ct((0,ae.Z)(void 0,e),2),I=O[0],Z=O[1],A=Ct((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),$=_[0],G=_[1],V=(0,a.useState)(!0),z=V[0],W=V[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,Dt,e)}),[]),be=(0,a.useCallback)((function(e){var n;null===(n=s.current.setMessage)||void 0===n||n.call(null,Bt,e)}),[]),ye=(0,a.useCallback)((function(e){var n;null===(n=s.current.setMessage)||void 0===n||n.call(null,qt,e)}),[]),ge=(0,a.useCallback)((function(e){var n;null===(n=s.current.setMessage)||void 0===n||n.call(null,Lt,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)}),[]),we=(0,a.useMemo)((function(){var e;return Tt(e={},Bt,(0,T.$e)(Ut,(function(){be()}),void 0,(function(e){be({children:e,type:"warning"})}))),Tt(e,Dt,(0,T.Ye)(Nt,(function(){ve()}),void 0,(function(e){ve({children:e,type:"warning"})}))),Tt(e,qt,(0,T.Gn)(Et,(function(){ye()}),void 0,(function(e){ye({children:e,type:"warning"})}))),Tt(e,Lt,(0,T.Gn)(Rt,(function(){ge()}),void 0,(function(e){ge({children:e,type:"warning"})}))),e}),[be,ve,ye,ge]),xe=(0,a.useMemo)((function(){return(0,T.LT)(we)}),[we]),ke=(0,a.useMemo)((function(){return de?void 0:"none"}),[de]),Oe=(0,a.useMemo)((function(){return(0,r.jsx)(yt.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(b){var t=n!==b;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=xe({inputs:Tt({},Dt,{value:a})});L(p),l&&/rhel/i.test(u)&&!d&&fe(!0),k(e),Z(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,b,Z,F,xe]),Ie=(0,a.useMemo)((function(){return(0,r.jsx)(l.Z,{columns:_t,layout:{"preparehost-host-name":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(w.Z,{formControlProps:{sx:{width:"100%"}},id:"preparehost-host-name-input",inputProps:{onBlur:function(e){var n=e.target.value,t=xe({inputs:Tt({},Dt,{value:n})});L(t)},onFocus:function(){ve()}},label:Nt}),ref:o})},"preparehost-enterprise-key":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(w.Z,{formControlProps:{sx:{width:"100%"}},id:"preparehost-enterprise-key-input",inputProps:{onBlur:function(e){var n=e.target.value;if(n){var t=xe({inputs:Tt({},Bt,{value:n})});B(t)}},onFocus:function(){be()}},label:Ut}),ref:t})}},spacing:"1em",wrapperBoxProps:{sx:{display:oe?void 0:"none"}}})}),[oe,be,ve,xe]),Pe=(0,a.useMemo)((function(){return(0,r.jsx)(l.Z,{columns:_t,layout:{"preparehost-redhat-user":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(w.Z,{formControlProps:{sx:{width:"100%"}},id:"preparehost-redhat-user-input",inputProps:{onBlur:function(e){var n=e.target.value;if(n){var t=xe({inputs:Tt({},Lt,{value:n})});W(t)}},onFocus:function(){ge()}},label:Rt}),ref:c})},"preparehost-redhat-password":{children:(0,r.jsx)(j.Z,{input:(0,r.jsx)(w.Z,{formControlProps:{sx:{width:"100%"}},id:"preparehost-redhat-password-input",inputProps:{onBlur:function(e){var n=e.target.value;if(n){var t=xe({inputs:Tt({},qt,{value:n})});G(t)}},onFocus:function(){ye()},onPasswordVisibilityAppend:function(e){se(e!==y.Z.password)},type:y.Z.password},label:Et}),ref:i})}},spacing:"1em",wrapperBoxProps:{sx:{display:ke}}})}),[ke,ye,ge,xe]),Se=(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]),Ze=(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)(bt.Z,{disabled:!q||!R||!z||!$,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,$,z,oe,me,je]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(x.s_,{children:[(0,r.jsx)(x.V9,{children:(0,r.jsx)(S.z,{children:"Prepare a host to include in Anvil!"})}),(0,r.jsxs)(g.Z,{children:[(0,r.jsx)(At,{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,Se,Ze]})]}),(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)(S.Ac,{children:"Host type"})},"preparehost-confirm-host-type-value":{children:(0,r.jsx)(S.$_,{children:"dr"===U?"Disaster Recovery (DR)":"Subnode"})},"preparehost-confirm-host-name-label":{children:(0,r.jsx)(S.Ac,{children:"Host name"})},"preparehost-confirm-host-name-value":{children:(0,r.jsx)(S.$_,{children:null===p||void 0===p?void 0:p.hostName})},"preparehost-confirm-enterprise-key-label":{children:(0,r.jsx)(S.Ac,{children:"Alteeve enterprise key"})},"preparehost-confirm-enterprise-key-value":{children:(0,r.jsx)(S.$_,{children:null===p||void 0===p?void 0:p.enterpriseKey})},"preparehost-confirm-redhat-user-label":{children:(0,r.jsx)(S.Ac,{children:"RedHat user"}),sx:{display:ke}},"preparehost-confirm-redhat-user-value":{children:(0,r.jsx)(S.$_,{children:null===p||void 0===p?void 0:p.redhatUser}),sx:{display:ke}},"preparehost-confirm-redhat-password-label":{children:(0,r.jsx)(S.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)(S.$_,{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)(vt.Z,{onClick:function(){se((function(e){return!e}))},sx:{color:P.s7,padding:0},children:ce?(0,r.jsx)(mt.Z,{}):(0,r.jsx)(ht.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:b,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"})]})},$t=t(8187),Gt=t(4596),Vt=t(634);function zt(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 Wt(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Qt(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){Wt(e,n,t[n])}))}return e}function Yt(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 Jt(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)||Xt(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 Kt(e){return function(e){if(Array.isArray(e))return zt(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||Xt(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 Xt(e,n){if(e){if("string"===typeof e)return zt(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)?zt(e,n):void 0}}var er="prepare-network-host-name-input",nr="prepare-network-netconf-input-group",tr="Host name",rr=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=Jt(r,1),u=a[0].target,c=u.elements,s=c.namedItem(er),l=s.value,d=Qt({hostName:l},null===(i=n.get)||void 0===i?void 0:i.call(null));return d},or=function(e){var n=e.networks,t=void 0===n?[]:n,r=Yt(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]=Qt({name:i,network:"".concat(r,"/").concat(c)},l),e}),{});return Qt({},r,{networks:o})},ir=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=Jt((0,oe.Z)(),2),b=v[0],y=v[1],k=Jt((0,ae.Z)(void 0),2),O=k[0],I=k[1],P=Jt((0,ae.Z)(void 0),2),Z=P[0],A=P[1],M=Jt((0,ae.Z)(!0),2),F=M[0],C=M[1],U=Jt((0,ae.Z)(void 0),2),N=U[0],E=U[1],R=(0,ie.Z)([er,nr],h),B=R.buildFinishInputTestBatchFunction,D=R.buildInputFirstRenderFunction,q=R.isFormInvalid,L=R.setMessage,_=R.setValidity,$=R.submitForm,G=(0,a.useMemo)((function(){return o!==N}),[o,N]),V=(0,a.useMemo)((function(){return Boolean(o)&&G}),[o,G]),z=(0,a.useMemo)((function(){return(0,r.jsx)(x.V9,{children:(0,r.jsxs)(S.z,{children:["Prepare network on ",null===O||void 0===O?void 0:O.shortHostName]})})}),[O]),W=(0,a.useMemo)((function(){return(0,r.jsx)(Gt.Z,{expectHostDetail:!0,hostDetail:O,ref:m,toggleSubmitDisabled:function(e){_(nr,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}):Z?(0,r.jsx)($t.Z,Qt({},Z)):(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=Jt(n,1),u=a[0];u.preventDefault();var c=rr.apply(void 0,[{netconf:m.current}].concat(Kt(n)));y({actionProceedText:"Prepare",content:(0,r.jsx)(X.Z,{entries:or(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;$({body:c,getErrorMsg:function(e){return(0,r.jsxs)(r.Fragment,{children:["Failed to prepare network. ",e]})},method:"put",onSuccess:function(){(0,Vt.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)(w.Z,{formControlProps:{sx:{maxWidth:"20em"}},id:er,label:tr,value:null===O||void 0===O?void 0:O.hostName}),inputTestBatch:(0,T.Gn)(tr,(function(){L(er)}),{onFinishBatch:B(er)},(function(e){L(er,{children:e})})),onFirstRender:D(er),required:!0}),Q,W,(0,r.jsx)(g.Z,{row:!0,justifyContent:"flex-end",children:(0,r.jsx)(bt.Z,{disabled:q,type:"submit",children:"Prepare network"})})]})]}),e}),[F,Z,z,null===O||void 0===O?void 0:O.hostName,null===O||void 0===O?void 0:O.shortHostName,B,D,Q,W,q,y,$,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?V&&K(o):l&&!Z&&(f?K(s(f)):(A({children:"No host UUID provided; cannot continue.",type:"error"}),C(!1)))}),[Z,K,o,t,l,f,A,I,C,V]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(x.s_,{children:J}),(0,r.jsx)(Y.Z,Qt({closeOnProceed:!0,scrollContent:!0},b,{ref:p}))]})},ar=t(5316),ur=t(1073);function cr(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function sr(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 lr=function(e){var n=e.label,t=sr(e,["label"]),o=(0,a.useMemo)((function(){return"string"===typeof n?(0,r.jsx)(S.Ac,{inheritColour:!0,children:n}):n}),[n]);return(0,r.jsx)(ar.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){cr(e,n,t[n])}))}return e}({},t,{label:o,sx:cr({borderRadius:P.n_,color:P.s7,padding:".4em .8em",textTransform:"none"},"&.".concat(ur.Z.selected),{color:P.Ej})}))},dr=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})},fr=t(2734),pr=t(8396),mr=t(7023),hr=t(852);function vr(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 br(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,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 gr(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 vr(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 vr(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 jr="1.8em",wr=function(e){var n,t,o=e.orientation,i=e.variant,u=void 0===i?"fullWidth":i,c=yr(e,["orientation","variant"]),s=(0,fr.Z)(),l=(0,a.useCallback)((function(e){return s.breakpoints.up(e)}),[s]),d=(0,pr.Z)(l("xs")),f=(0,pr.Z)(l("sm")),p=(0,pr.Z)(l("md")),m=(0,pr.Z)(l("lg")),h=(0,pr.Z)(l("xl")),v=(0,a.useMemo)((function(){return[["xs",d],["sm",f],["md",p],["lg",m],["xl",h]]}),[m,p,f,h,d]),b=(0,a.useMemo)((function(){var e;return"object"===typeof o?v.some((function(n){var t=gr(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)(mr.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){br(e,n,t[n])}))}return e}({},c,{orientation:b,variant:u,sx:(t={minHeight:"1em"},br(t,"&.".concat(hr.Z.vertical),(n={minHeight:jr},br(n,"& .".concat(ur.Z.root),{alignItems:"flex-start",minHeight:jr,paddingLeft:"2em"}),br(n,"& .".concat(hr.Z.indicator),{right:"initial"}),n)),br(t,"& .".concat(ur.Z.root),{minHeight:"1em"}),br(t,"& .".concat(hr.Z.indicator),{backgroundColor:P.Ej,borderRadius:P.n_}),t)}))};function xr(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 kr(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function Or(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){kr(e,n,t[n])}))}return e}function Ir(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 xr(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 xr(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,Sr="prepare-host",Zr="prepare-network",Ar="manage-fence",Mr="manage-ups",Fr="manage-manifest",Tr=(kr(Pr={},Sr,"Prepare Host"),kr(Pr,Zr,"Prepare Network"),kr(Pr,Ar,"Manage Fence Devices"),kr(Pr,Mr,"Manage UPSes"),kr(Pr,Fr,"Manage Manifests"),Pr),Cr="Loading",Ur={md:8,sm:6,xs:1},Nr={md:6,sm:4,xs:1},Er=function(){return(0,r.jsx)(l.Z,{columns:Ur,layout:{"preparehost-left-column":{},"preparehost-center-column":Or({children:(0,r.jsx)(Ht,{})},Nr)}})},Rr=function(){var e=(0,$.Z)(),n=(0,Mt.Z)().protect,t=Ir((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)(wr,{onChange:function(e,n){f(n)},orientation:"vertical",value:s,children:n.map((function(e){var n=Ir(e,2),t=n[0],o=n[1].shortHostName;return(0,r.jsx)(lr,{label:o,value:t},"".concat(Zr,"-").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:Ur,layout:{"preparenetwork-left-column":{children:(0,r.jsx)(x.s_,{children:p}),sm:2},"preparenetwork-center-column":Or({children:(0,r.jsx)(ir,{expectUUID:!0,hostUUID:s||void 0})},Nr)}})},Br=function(){return(0,r.jsx)(l.Z,{columns:Ur,layout:{"managefence-left-column":{},"managefence-center-column":Or({children:(0,r.jsx)(ve,{})},Nr)}})},Dr=function(){return(0,r.jsx)(l.Z,{columns:Ur,layout:{"manageups-left-column":{},"manageups-center-column":Or({children:(0,r.jsx)(pt,{})},Nr)}})},qr=function(){return(0,r.jsx)(l.Z,{columns:Ur,layout:{"managemanifest-left-column":{},"managemanifest-center-column":Or({children:(0,r.jsx)(Wn,{})},Nr)}})},Lr=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)(Cr),p=d[0],m=d[1];return(0,a.useEffect)((function(){if(n){var e=s(t,{fallbackValue:Sr});Tr[e]||(e=Sr),p===Cr&&m(Tr[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)(x.s_,{children:(0,r.jsxs)(wr,{onChange:function(e,n){l(n),m(Tr[n])},orientation:{xs:"vertical",sm:"horizontal"},value:c,children:[(0,r.jsx)(lr,{label:"Prepare host",value:Sr}),(0,r.jsx)(lr,{label:"Prepare network",value:Zr}),(0,r.jsx)(lr,{label:"Manage fence devices",value:Ar}),(0,r.jsx)(lr,{label:"Manage UPSes",value:Mr}),(0,r.jsx)(lr,{label:"Manage manifests",value:Fr})]})}),(0,r.jsx)(dr,{changingTabId:c,tabId:Sr,children:(0,r.jsx)(Er,{})}),(0,r.jsx)(dr,{changingTabId:c,tabId:Zr,children:(0,r.jsx)(Rr,{})}),(0,r.jsx)(dr,{changingTabId:c,tabId:Ar,children:(0,r.jsx)(Br,{})}),(0,r.jsx)(dr,{changingTabId:c,tabId:Mr,children:(0,r.jsx)(Dr,{})}),(0,r.jsx)(dr,{changingTabId:c,tabId:Fr,children:(0,r.jsx)(qr,{})})]})}}},function(e){e.O(0,[662,498,910,894,839,213,209,644,404,195,668,284,157,27,48,336,86,560,774,888,179],(function(){return n=4173,e(e.s=n);var n}));var n=e.O();_N_E=n}]);