import{r as d,b1 as p,j as e,S as l,h as a,H as f}from"./vendor-ClLR6ncd.js";import{E as c,S as x}from"./Messages-BRmQDxrZ.js";import{C as h}from"./CheckboxWithLabel-D5KtBcIx.js";import{E as g,d as j,i as u,L as v,o as S}from"./index-OtVJl4GC.js";import"./lodash-ZyeDnt0e.js";import{a as w}from"./ui-DEn7LX9m.js";import{a as y}from"./OptionallyDenseCodeMirror-S3gxMpRM.js";import{B as C}from"./Box-Co2WcNPC.js";import{L as F}from"./Link-BLwKPJFF.js";import"./WarningMessage-4TK5GdCH.js";import"./Warning-DsmyDRzF.js";import"./ui-BOPU8Yl4.js";function L(){const[r,s]=d.useState();return{loadInitFileFromServer:g(["admin","initfile"],async()=>{const n=i=>(r===void 0&&s(i),i);try{return n(await u({url:"/initfile"}))}catch(i){if(i.message==="No initfile defined.")return n("");throw i}}),fileText:r,setFileText:s}}function b({warningsAreErrors:r,fileText:s}){return j(()=>{const t=new URL("/initfile",window.location.origin);return t.searchParams.append("warnings-are-errors",r.toString()),u({method:"put",url:t.toString(),data:s})})}function E(){const[r,s]=d.useState(!1),{fileText:t,loadInitFileFromServer:n,setFileText:i}=L(),o=b({warningsAreErrors:r,fileText:t}),{title:m}=p();return e.jsxs(l,{spacing:S(),sx:{flexGrow:1},children:[e.jsx(a,{variant:"h4",children:m}),e.jsxs(l,{spacing:1,sx:{flexGrow:1},children:[e.jsxs(C,{children:[e.jsxs(a,{display:"inline",children:["An initialization file can be specified for a server, which is a collection of Common Lisp code that is executed in every shared back-end as it is created. You can also use"," "]}),e.jsx(F,{display:"inline",href:"https://franz.com/support/documentation/current/doc/prolog.html",target:"_blank",rel:"noopener",children:"Allegro Prolog"}),e.jsxs(a,{display:"inline",children:[" ","syntax to define Prolog functors."]})]}),n.isError?e.jsx(c,{error:n.error}):n.isLoading?e.jsx(v,{}):e.jsxs(e.Fragment,{children:[e.jsx(y,{readOnly:!1,value:t||"",onChange:i}),e.jsx(h,{label:"Compilation warnings are considered errors and will prevent the file being saved",setter:s,value:r}),e.jsx(f,{variant:"contained",disabled:o.isLoading,onClick:o.mutate,children:"Save"})]}),e.jsx(c,{error:o.error,resetError:o.reset}),e.jsx(x,{message:o.isSuccess?"File saved!":null,reset:o.reset})]})]})}const R=w({Component:E});export{R as default};
