1import{r as p,u as j,j as a}from"./app-BeGqF6ux.js";import{P as v}from"./index-Dkf2GVy1.js";import{B as y,M as C,I}from"./Tooltip-DYcxt1UG.js";import{I as S}from"./Input-CzZXrXpb.js";import"./dayjs-BlgjZc9C.js";import{u as B}from"./useTranslation-kJHeU9i8.js";import"./button.styles-7lPNyjJO.js";import"./iconBase-CN8tsjra.js";import"./helpers-CgA5RTdO.js";function P(){const{t:e}=B(),[f,o]=p.useState(!1),{data:l,setData:x,post:h,processing:r,errors:t,reset:A,clearErrors:d,setError:g}=j({name:""}),n=p.useRef(!1),m=()=>{o(!1),A(),d()},c=()=>{!r&&!n.current&&m()},u=()=>{if(!(n.current||r)){if(l.name.trim()===""){g("name",e("bibleAdmin.add.nameRequired"));return}n.current=!0,h(v("admin.bibles.store"),{preserveScroll:!0,onSuccess:m,onFinish:()=>{n.current=!1}})}},i=t.bibleApiUnsure,b=!!i;return a.jsxs(a.Fragment,{children:[a.jsx(y,{type:"button",variant:"primary",size:"sm",onClick:()=>o(!0),children:e("bibleAdmin.add.open")}),a.jsx(C,{open:f,onClose:c,header:{title:e("bibleAdmin.add.title"),closeDisabled:r},footer:{primaryAction:{label:e("bibleAdmin.add.submit"),onClick:u,variant:"primary",loading:r,disabled:r||b},secondaryAction:{label:e(b?"bibleAdmin.add.close":"bibleAdmin.add.cancel"),onClick:c,variant:"tertiary",disabled:r},align:"end"},children:a.jsxs("form",{noValidate:!0,className:"flex flex-col gap-4 pt-2",onSubmit:s=>{s.preventDefault(),u()},children:[i&&a.jsx(I,{variant:"error",message:i}),a.jsx(S,{label:e("bibleAdmin.add.nameLabel"),name:"name",value:l.name,placeholder:e("bibleAdmin.add.namePlaceholder"),required:!0,maxLength:96,invalid:t.name,caption:t.name,onChange:s=>{x("name",String(s)),d("name")}}),a.jsx("button",{type:"submit",className:"hidden",tabIndex:-1,"aria-hidden":"true"})]})})]})}export{P as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.