import{a as e,l as t}from"./preact.module-CNakwbc9.js";import{d as n,s as r,t as i}from"./hooks.module-BrXTvcfS.js";import{a}from"./i18n-BaLR3UdQ.js";import{t as o}from"./jsxRuntime.module-Cao1NCKs.js";import{o as s}from"./react_utils-Bz0ffU2Y.js";import{J as c}from"./hooks-ClTXKdUl.js";import{t as l}from"./Modal-hBkTa-Ee.js";import{t as u}from"./Button-Du0dYm4Z.js";import{t as d}from"./FormTextBox-BLQGoABI.js";import{t as f}from"./FormGroup-DqPd4bBP.js";n(),t();function p(){let t=i(null),n=i(null),p=i(null),m=i(null),h=i(),[g,_]=r(``),[v,y]=r(!1),b=i(null);return c(`showPromptDialog`,e=>{h.current=e,_(e.defaultValue??``),y(!0)}),o(l,{className:`prompt-dialog`,title:h.current?.title??a(`prompt.title`),size:`lg`,zIndex:2e3,modalRef:t,formRef:n,onShown:()=>{h.current?.shown?.({$dialog:s(t),$question:s(p),$answer:s(m),$form:s(n)}),m.current?.focus(),m.current?.select()},onSubmit:()=>{b.current=g,y(!1)},onHidden:()=>{y(!1),h.current?.callback?.(b.current),b.current=null,h.current=void 0},footer:o(e,{children:[o(u,{text:a(`modal.cancel`),onClick:()=>y(!1)}),o(u,{text:a(`prompt.ok`),keyboardShortcut:`Enter`,kind:`primary`})]}),show:v,stackable:!0,children:o(f,{name:`prompt-dialog-answer`,label:h.current?.message,labelRef:p,children:o(d,{inputRef:m,currentValue:g,onChange:_,readOnly:h.current?.readOnly})})})}export{p as default};