(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[464],{593:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/init",function(){return t(8616)}])},9099:function(e,n,t){"use strict";t.d(n,{Z:function(){return x}});var r=t(7294),i={boolean:function(e){return Boolean(e)},number:function(e){return parseInt(String(e),10)||0},string:function(e){return String(e)}},l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.postSet,t=e.preSet,r=e.set,l=e.setType,o=void 0===l?"string":l,u=e.valueKey,a=void 0===u?"value":u;return function(e){var l=e.target[a],u=i[o](l);null===t||void 0===t||t.call(null,e),null===r||void 0===r||r.call(null,u),null===n||void 0===n||n.call(null,e)}},o=t(7987);function u(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}function d(e){return function(e){if(Array.isArray(e))return u(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 u(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 u(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 f(e){var n=function(e,n){if("object"!==v(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!==v(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"===v(n)?n:String(n)}var v=function(e){return e&&"undefined"!==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};var p="input",m={boolean:!1,number:0,string:""},h={createInputOnChangeHandlerOptions:{},required:!1,valueType:"string"},g=(0,r.forwardRef)((function(e,n){var t=e.input,i=e.inputTestBatch,u=e.onBlurAppend,v=e.onFirstRender,g=e.onFocusAppend,x=e.onUnmount,y=e.required,b=void 0===y?h.required:y,j=e.valueKey,w=e.valueType,P=void 0===w?h.valueType:w,S=e.createInputOnChangeHandlerOptions,k=void 0===S?h.createInputOnChangeHandlerOptions:S,O=k.postSet,Z=k.valueKey,C=void 0===Z?j:Z,A=s(e.createInputOnChangeHandlerOptions,["postSet","valueKey"]),I=t.props,N=(0,r.useMemo)((function(){return null!==C&&void 0!==C?C:"checked"in I?"checked":"value"}),[I,C]),V=I.onBlur,R=I.onChange,M=I.onFocus,F=I[N],H=void 0===F?m[P]:F,T=s(I,["onBlur","onChange","onFocus",N].map(f)),E=(0,r.useState)(H),z=E[0],D=E[1],B=(0,r.useState)(!1),_=B[0],L=B[1],U=(0,r.useState)(!1),q=U[0],$=U[1],Q=(0,r.useCallback)((function(e){D(e)}),[]),J=(0,r.useMemo)((function(){var e;return i&&(i.isRequired=b,e=(0,o.LT)(a({},p,i))),e}),[i,b]),G=(0,r.useMemo)((function(){return null!==V&&void 0!==V?V:J&&function(){for(var e=arguments.length,n=new Array(e),t=0;te.length)&&(n=e.length);for(var t=0,r=new Array(n);t=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}function a(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,i,l=[],o=!0,u=!1;try{for(t=t.call(e);!(o=(r=t.next()).done)&&(l.push(r.value),!n||l.length!==n);o=!0);}catch(a){u=!0,i=a}finally{try{o||null==t.return||t.return()}finally{if(u)throw i}}return l}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return o(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 o(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.")}()}function c(e){var n=function(e,n){if("object"!==s(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,n||"default");if("object"!==s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"===s(n)?n:String(n)}var s=function(e){return e&&"undefined"!==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};var d={count:0,defaultMessageType:"info",onSet:void 0,usePlaceholder:!0},f=(0,i.forwardRef)((function(e,n){var t=e.count,o=void 0===t?d.count:t,s=e.defaultMessageType,f=void 0===s?d.defaultMessageType:s,v=e.onSet,p=e.usePlaceholder,m=void 0===p?d.usePlaceholder:p,h=(0,i.useState)({}),g=h[0],x=h[1],y=(0,i.useCallback)((function(e){return void 0!==g[e]}),[g]),b=(0,i.useCallback)((function(e,n){var t=0;x((function(r){r[e];var i=u(r,[e].map(c));return n&&(i[e]=n),t=Object.keys(i).length,i})),null===v||void 0===v||v.call(null,t)}),[v]),j=(0,i.useCallback)((function(e,n){var t=0,r=n?function(e,r){e[r]=n,t+=1}:void 0;x((function(n){var i={};return Object.keys(n).forEach((function(l){e.test(l)?null===r||void 0===r||r.call(null,i,l):(i[l]=n[l],t+=1)})),i})),null===v||void 0===v||v.call(null,t)}),[v]),w=(0,i.useMemo)((function(){var e=Object.entries(g),n=o>0,t=n?o:e.length,i=[];if(e.every((function(e){var n=a(e,2),o=n[0],u=n[1],c=u.children,s=u.type,d=void 0===s?f:s;return i.push((0,r.jsx)(l.Z,{type:d,children:c},"message-".concat(o))),i.length1&&void 0!==arguments[1]?arguments[1]:{},t=n.fillString,r=void 0===t?"0":t,i=n.maxLength,l=void 0===i?2:i,o=n.which,u=void 0===o?"Start":o;return String(e)["pad".concat(u)](l,r)};function P(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function S(e,n){if(null==e)return{};var t,r,i=function(e,n){if(null==e)return{};var t,r,i={},l=Object.keys(e);for(r=0;r=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var k={show:!0},O=function(e){var n=e.onClick,t=e.show,i=void 0===t?k.show:t,l=S(e,["onClick","show"]);return i?(0,r.jsx)(v.Z,function(e){for(var n=1;ne.length)&&(n=e.length);for(var t=0,r=new Array(n);t0&&void 0!==arguments[0]?arguments[0]:"",n=e.split(/\s/).filter((function(e){return!/and|of/.test(e)})).slice(0,5),t=n.length>1?2:n.length;return _[t](n)},U=function(e){var n=e.organizationPrefix,t=e.hostNumber,r=e.domainName;return[n,t,r].every((function(e){return Boolean(e)}))?"".concat(n,"-striker").concat(w(t),".").concat(r):""},q=(0,a.forwardRef)((function(e,n){var t,i,l,u,c=e.expectHostDetail,s=void 0!==c&&c,d=e.hostDetail,f=e.toggleSubmitDisabled,v=(0,a.useState)(),w=v[0],P=v[1],S=(0,a.useState)(!1),k=S[0],O=S[1],I=(0,a.useState)(!1),V=I[0],M=I[1],_=(0,a.useState)(!0),q=_[0],$=_[1],Q=(0,a.useState)(!0),J=Q[0],G=Q[1],K=(0,a.useRef)(!0),W=(0,a.useRef)({}),X=(0,a.useRef)({}),Y=(0,a.useRef)({}),ee=(0,a.useRef)({}),ne=(0,a.useRef)({}),te=(0,a.useRef)({}),re=(0,a.useRef)({}),ie=(0,a.useRef)({}),le=(0,a.useCallback)((function(e){var n;return null===(n=ie.current.setMessage)||void 0===n?void 0:n.call(null,B,e)}),[]),oe=(0,a.useCallback)((function(e){var n;return null===(n=ie.current.setMessage)||void 0===n?void 0:n.call(null,z,e)}),[]),ue=(0,a.useCallback)((function(e){var n;return null===(n=ie.current.setMessage)||void 0===n?void 0:n.call(null,T,e)}),[]),ae=(0,a.useCallback)((function(e){var n;return null===(n=ie.current.setMessage)||void 0===n?void 0:n.call(null,E,e)}),[]),ce=(0,a.useCallback)((function(e){var n;return null===(n=ie.current.setMessage)||void 0===n?void 0:n.call(null,F,e)}),[]),se=(0,a.useCallback)((function(e){var n;return null===(n=ie.current.setMessage)||void 0===n?void 0:n.call(null,H,e)}),[]),de=(0,a.useMemo)((function(){var e;return N(e={},F,{defaults:{getValue:function(){var e;return null===(e=W.current.getValue)||void 0===e?void 0:e.call(null)},onSuccess:function(){ce(void 0)}},tests:[{onFailure:function(){ce({children:(0,r.jsxs)(r.Fragment,{children:["Admin password cannot contain single-quote (",(0,r.jsx)(A.Q0,{text:"'"}),"), double-quote (",(0,r.jsx)(A.Q0,{text:'"'}),"), slash (",(0,r.jsx)(A.Q0,{text:"/"}),"), backslash (",(0,r.jsx)(A.Q0,{text:"\\"}),"), angle brackets (",(0,r.jsx)(A.Q0,{text:"<>"}),"), curly brackets (",(0,r.jsx)(A.Q0,{text:"{}"}),")."]})})},test:function(e){var n=e.value;return!/['"/\\><}{]/g.test(n)}},{test:C.HJ}]}),N(e,H,{defaults:{getValue:function(){var e,n;return null===(e=X.current)||void 0===e||null===(n=e.getValue)||void 0===n?void 0:n.call(null)},onSuccess:function(){se(void 0)}},tests:[{onFailure:function(){se({children:"Confirmation doesn't match admin password."})},test:function(e){var n;return e.value===(null===(n=W.current.getValue)||void 0===n?void 0:n.call(null))}},{test:C.HJ}]}),N(e,T,{defaults:{compare:[!J],getValue:function(){var e;return null===(e=ne.current.getValue)||void 0===e?void 0:e.call(null)},onSuccess:function(){ue(void 0)}},tests:[{onFailure:function(){ue({children:(0,r.jsxs)(r.Fragment,{children:["Domain name can only contain lowercase alphanumeric, hyphen (",(0,r.jsx)(A.Q0,{text:"-"}),"), and dot (",(0,r.jsx)(A.Q0,{text:"."}),") characters."]})})},test:function(e){var n=e.compare,t=e.value;return n[0]||g.FZ.test(t)}},{test:C.HJ}]}),N(e,E,{defaults:{compare:[!J],getValue:function(){var e;return null===(e=re.current.getValue)||void 0===e?void 0:e.call(null)},onSuccess:function(){ae(void 0)}},tests:[{onFailure:function(){ae({children:(0,r.jsxs)(r.Fragment,{children:["Host name can only contain lowercase alphanumeric, hyphen (",(0,r.jsx)(A.Q0,{text:"-"}),"), and dot (",(0,r.jsx)(A.Q0,{text:"."}),") characters."]})})},test:function(e){var n=e.compare,t=e.value;return n[0]||g.FZ.test(t)}},{test:C.HJ}]}),N(e,z,{defaults:{getValue:function(){var e;return null===(e=te.current.getValue)||void 0===e?void 0:e.call(null)},onSuccess:function(){oe(void 0)}},tests:[{onFailure:function(){oe({children:"Striker number can only contain digits."})},test:function(e){var n=e.value;return/^\d+$/.test(n)}},{test:C.HJ}]}),N(e,D,{defaults:{getValue:function(){var e;return null===(e=Y.current.getValue)||void 0===e?void 0:e.call(null)}},tests:[{test:C.HJ}]}),N(e,B,{defaults:{getValue:function(){var e;return null===(e=ee.current.getValue)||void 0===e?void 0:e.call(null)},max:5,min:1,onSuccess:function(){le(void 0)}},tests:[{onFailure:function(e){var n=e.max,t=e.min;le({children:"Organization prefix must be ".concat(t," to ").concat(n," lowercase alphanumeric characters.")})},test:function(e){var n=e.max,t=e.min,r=e.value;return RegExp("^[a-z0-9]{".concat(t,",").concat(n,"}$")).test(r)}}]}),e}),[J,ce,se,ue,ae,oe,le]),fe=(0,a.useMemo)((function(){return(0,C.LT)(de)}),[de]),ve=(0,a.useCallback)((function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.excludeTestIds,t=void 0===n?[]:n,r=e.inputs,i=e.isContinueOnFailure,l=e.isExcludeConfirmAdminPassword,o=void 0===l?!q:l;o&&t.push(H),null===f||void 0===f||f.call(null,fe({excludeTestIds:t,inputs:r,isContinueOnFailure:i,isIgnoreOnCallbacks:!0,isTestAll:!0}))}),[q,fe,f]),pe=(0,a.useCallback)((function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.organizationName,i=void 0===r?null===(t=Y.current.getValue)||void 0===t?void 0:t.call(null):r,l=L(i);return null===(e=ee.current.setValue)||void 0===e||e.call(null,l),ve({inputs:N({},B,{isIgnoreOnCallbacks:!1,value:l}),isContinueOnFailure:!0}),l}),[ve]),me=(0,a.useCallback)((function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=n.organizationPrefix,r=void 0===t?null===(i=ee.current.getValue)||void 0===i?void 0:i.call(null):t,o=n.hostNumber,a=void 0===o?null===(l=te.current.getValue)||void 0===l?void 0:l.call(null):o,c=n.domainName,s=void 0===c?null===(u=ne.current.getValue)||void 0===u?void 0:u.call(null):c,d=U({organizationPrefix:r,hostNumber:a,domainName:s});return null===(e=re.current.setValue)||void 0===e||e.call(null,d),ve({inputs:N({},E,{isIgnoreOnCallbacks:!1,value:d}),isContinueOnFailure:!0}),d}),[ve]),he=(0,a.useCallback)((function(){var e;return Boolean(null===(e=Y.current.getValue)||void 0===e?void 0:e.call(null))}),[]),ge=(0,a.useCallback)((function(){var e,n,t;return[null===(e=ee.current.getValue)||void 0===e?void 0:e.call(null),null===(n=te.current.getValue)||void 0===n?void 0:n.call(null),null===(t=ne.current.getValue)||void 0===t?void 0:t.call(null)].every((function(e){return Boolean(e)}))}),[]),xe=(0,a.useCallback)((function(){var e;(null===(e=ee.current.getIsChangedByUser)||void 0===e?void 0:e.call(null))?O(he()):pe()}),[he,pe]),ye=(0,a.useCallback)((function(){var e;(null===(e=re.current.getIsChangedByUser)||void 0===e?void 0:e.call(null))?M(ge()):me()}),[ge,me]),be=(0,a.useCallback)((function(){var e,n=pe();(null===(e=re.current.getIsChangedByUser)||void 0===e?void 0:e.call(null))||me({organizationPrefix:n})}),[me,pe]),je=(0,a.useCallback)((function(){me()}),[me]),we=(0,a.useCallback)((function(e){return function(n){return n===e?void 0:e}}),[]),Pe=(0,a.useMemo)((function(){return(0,r.jsx)(m.Z,{checked:J,onChange:function(e,n){var t;G(n),ve({inputs:(t={},N(t,T,{compare:[!n],isIgnoreOnCallbacks:!1}),N(t,E,{compare:[!n],isIgnoreOnCallbacks:!1}),t),isContinueOnFailure:!0})},sx:{padding:".2em"}})}),[J,ve]);return(0,a.useEffect)((function(){if([s,d,K.current,ne.current,re.current,te.current,Y.current,ee.current].every((function(e){return Boolean(e)}))){var e,n,t,r,i;K.current=!1;var l=d.domain,o=d.hostName,u=d.organization,a=d.prefix,c=d.sequence;null===(e=ne.current.setValue)||void 0===e||e.call(null,l),null===(n=re.current.setValue)||void 0===n||n.call(null,o),null===(t=te.current.setValue)||void 0===t||t.call(null,c),null===(r=Y.current.setValue)||void 0===r||r.call(null,u),null===(i=ee.current.setValue)||void 0===i||i.call(null,a),ve()}}),[s,d,ve]),(0,a.useImperativeHandle)(n,(function(){return{get:function(){var e,n,t,r,i,l;return{adminPassword:null===(e=W.current.getValue)||void 0===e?void 0:e.call(null),organizationName:null===(n=Y.current.getValue)||void 0===n?void 0:n.call(null),organizationPrefix:null===(t=ee.current.getValue)||void 0===t?void 0:t.call(null),domainName:null===(r=ne.current.getValue)||void 0===r?void 0:r.call(null),hostNumber:null===(i=te.current.getValue)||void 0===i?void 0:i.call(null),hostName:null===(l=re.current.getValue)||void 0===l?void 0:l.call(null)}}}})),(0,r.jsxs)(p.Z,{children:[(0,r.jsxs)(o.ZP,{columns:{xs:1,sm:2,md:3},container:!0,spacing:"1em",children:[(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsxs)(p.Z,{children:[(0,r.jsx)(x.Z,{input:(0,r.jsx)(j.Z,{id:"striker-init-general-organization-name",inputProps:{onBlur:xe},inputLabelProps:{isNotifyRequired:!0},label:"Organization name",onChange:function(){ve()},onHelp:function(){P(we("Name of the organization that maintains this Anvil! system. You can enter anything that makes sense to you."))}}),ref:Y}),(0,r.jsxs)(p.Z,{row:!0,sx:{"& > :first-child":{flexGrow:1}},children:[(0,r.jsx)(x.Z,{input:(0,r.jsx)(j.Z,{id:"striker-init-general-organization-prefix",inputProps:{endAdornment:(0,r.jsx)(Z,{show:k,onClick:be}),inputProps:{maxLength:5,sx:{minWidth:"2.5em"}},onBlur:function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r1?n-1:0),r=1;r1?n-1:0),r=1;r * > *":{width:"100%"}},children:[(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(x.Z,{input:(0,r.jsx)(j.Z,{id:"striker-init-general-admin-password",inputProps:{inputProps:{type:h.Z.password},onBlur:function(e){var n=e.target.value;fe({inputs:N({},F,{value:n})})},onPasswordVisibilityAppend:function(e){var n=e===h.Z.password;ve({isExcludeConfirmAdminPassword:!n}),$(n),se()}},inputLabelProps:{isNotifyRequired:!0},label:"Admin password",onChange:function(e){var n=e.target.value;ve({inputs:N({},F,{value:n})}),ce()},onHelp:function(){P(we("Password use to login to this Striker and connect to its database. Don't provide an used password here because it'll be stored as plaintext."))}}),ref:W})}),q&&(0,r.jsx)(o.ZP,{item:!0,xs:1,children:(0,r.jsx)(x.Z,{input:(0,r.jsx)(j.Z,{id:"striker-init-general-confirm-admin-password",inputProps:{inputProps:{type:h.Z.password},onBlur:function(e){var n=e.target.value;fe({inputs:N({},H,{value:n})})}},inputLabelProps:{isNotifyRequired:q},label:"Confirm password",onChange:function(e){var n=e.target.value;ve({inputs:N({},H,{value:n})}),se()}}),ref:X})})]})})]}),(0,r.jsx)(b.Z,{count:1,defaultMessageType:"warning",ref:ie}),(0,r.jsx)(y.Z,{children:(0,r.jsxs)(p.Z,{row:!0,sx:{"& > :last-child":{flexGrow:1}},children:[Pe,(0,r.jsx)(A.Ac,{inverted:!0,children:J?"Uncheck to skip domain and host name pattern validation.":"Check to re-enable domain and host name pattern validation."})]})}),w&&(0,r.jsx)(y.Z,{onClose:function(){P(void 0)},children:w})]})}));q.defaultProps={expectHostDetail:!1,hostDetail:void 0,toggleSubmitDisabled:void 0},q.displayName="GeneralInitForm";var $=q,Q=t(1770),J=t(1706),G=t(3377),K=t(2444),W=t(5741),X=t(8461),Y=t(3679),ee=t(2152),ne=t(2749);function te(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t