"use strict";(self.webpackChunkpterodactyl_panel=self.webpackChunkpterodactyl_panel||[]).push([[987],{6987(e,a,t){t.r(a),t.d(a,{default:()=>w});var r=t(4859),n=t(7810),o=t(9748),i=t(6015),s=t(6454),l=t(766),c=t(713),d=t(5161),m=t(9385),u=t(4254),p=t(2246),v=t(7418),y=t(1071),h=t(9825);const g=["minecraft 1.17 requires running the server with java 16 or above","minecraft 1.18 requires running the server with java 17 or above","java.lang.unsupportedclassversionerror","unsupported major.minor version","has been compiled by a more recent version of the java runtime"],w=()=>{const[e,a]=(0,n.useState)(!1),[t,r]=(0,n.useState)(!1),[s,c]=(0,n.useState)(""),w=o.P.useStoreState(e=>e.server.data.uuid),b=o.P.useStoreState(e=>e.status.value),{clearFlashes:x,clearAndAddHttpError:V}=(0,d.A)(),{instance:j}=o.P.useStoreState(e=>e.socket),{data:T,isValidating:I,mutate:F}=(0,y.A)(w,null,{revalidateOnMount:!1});(0,n.useEffect)(()=>{e&&F().then(e=>{c(Object.values((null==e?void 0:e.dockerImages)||[])[0]||"")})},[e]),(0,p.A)(m.y.CONSOLE_OUTPUT,e=>{"running"!==b&&g.some(a=>e.toLowerCase().includes(a.toLowerCase()))&&a(!0)});return(0,n.useEffect)(()=>{x("feature:javaVersion")},[]),n.createElement(i.A,{visible:e,onDismissed:()=>a(!1),closeOnBackground:!1,showSpinnerOverlay:t},n.createElement(f,{key:"feature:javaVersion"}),n.createElement(_,null,"Unsupported Java Version"),n.createElement(A,null,"This server is currently running an unsupported version of Java and cannot be started.",n.createElement(v.A,{action:"startup.docker-image"}," Please select a supported version from the list below to continue starting the server.")),n.createElement(v.A,{action:"startup.docker-image"},n.createElement(S,null,n.createElement(h.A,{visible:!T||I},n.createElement(u.A,{disabled:!T,onChange:e=>c(e.target.value)},T?Object.keys(T.dockerImages).map(e=>n.createElement("option",{key:e,value:T.dockerImages[e]},e)):n.createElement("option",{disabled:!0}))))),n.createElement(E,null,n.createElement(k,{isSecondary:!0,onClick:()=>a(!1)},"Cancel"),n.createElement(v.A,{action:"startup.docker-image"},n.createElement(C,{onClick:()=>{r(!0),x("feature:javaVersion"),(0,l.A)(w,s).then(()=>{"offline"===b&&j&&j.send(m.T.SET_STATE,"restart"),a(!1)}).catch(e=>V({key:"feature:javaVersion",error:e})).then(()=>r(!1))}},"Update Docker Image"))))};var f=(0,r.Ay)(c.A).withConfig({displayName:"JavaVersionModalFeature___StyledFlashMessageRender",componentId:"sc-15l9se1-0"})({marginBottom:"1rem"}),_=(0,r.Ay)("h2").withConfig({displayName:"JavaVersionModalFeature___StyledH",componentId:"sc-15l9se1-1"})({fontSize:"1.5rem",lineHeight:"2rem",marginBottom:"1rem","--tw-text-opacity":"1",color:"hsla(214, 15%, 91%, var(--tw-text-opacity))"}),A=(0,r.Ay)("p").withConfig({displayName:"JavaVersionModalFeature___StyledP",componentId:"sc-15l9se1-2"})({marginTop:"1rem"}),S=(0,r.Ay)("div").withConfig({displayName:"JavaVersionModalFeature___StyledDiv",componentId:"sc-15l9se1-3"})({marginTop:"1rem"}),E=(0,r.Ay)("div").withConfig({displayName:"JavaVersionModalFeature___StyledDiv2",componentId:"sc-15l9se1-4"})({marginTop:"2rem",display:"flex",flexDirection:"column",justifyContent:"flex-end","> :not([hidden]) ~ :not([hidden])":{"--tw-space-y-reverse":0,marginTop:"calc(1rem * calc(1 - var(--tw-space-y-reverse)))",marginBottom:"calc(1rem * var(--tw-space-y-reverse))"},"@media (min-width: 640px)":{flexDirection:"row","> :not([hidden]) ~ :not([hidden])":{"--tw-space-x-reverse":0,marginRight:"calc(1rem * var(--tw-space-x-reverse))",marginLeft:"calc(1rem * calc(1 - var(--tw-space-x-reverse)))","--tw-space-y-reverse":0,marginTop:"calc(0px * calc(1 - var(--tw-space-y-reverse)))",marginBottom:"calc(0px * var(--tw-space-y-reverse))"}}}),k=(0,r.Ay)(s.Ay).withConfig({displayName:"JavaVersionModalFeature___StyledButton",componentId:"sc-15l9se1-5"})({width:"100%","@media (min-width: 640px)":{width:"auto"}}),C=(0,r.Ay)(s.Ay).withConfig({displayName:"JavaVersionModalFeature___StyledButton2",componentId:"sc-15l9se1-6"})({width:"100%","@media (min-width: 640px)":{width:"auto"}})}}]);