import{bN as L,L as A,aI as n,b0 as N,ao as e,aq as f,bq as P,aA as w,f as b,e as E,hp as k,v,du as C,dm as y}from"./app-k0jcl5PQ.js";import{F}from"./kLXBNYk1.chunk.js";import{L as s}from"./CCKlkV4O.chunk.js";import{b as H}from"./BCKXZxoz.chunk.js";const _="_input_ts5j9_9",I={input:_},l="share.pincode",o=A.encloseNamespace(l);function q(p){L({title:o("pageTitle")});const[a,g]=n.useState(p.pincode??""),[d,i]=n.useState(!1),[c,u]=n.useState(""),x=N();async function m(t){var h;if(t==null||t.preventDefault(),!!a){i(!0);try{const r=await x(w.getPincodeByCode(a)),S={application:E.SHARE,action:b.Share.VIEW_SHARE_LINK,args:[r.shareId]};k.setPincode(r.shareId,a);const j=v.getHref(S);C.PageLoad(j)}catch(r){if(((h=r.responseJSON)==null?void 0:h.status)===y.NotFound){u(o("incorrectPincodeError")),i(!1);return}u(o("ajaxErrorMessage")),i(!1)}}}return n.useEffect(()=>{p.pincode&&window.setTimeout(m,500)},[]),e.jsxs(s,{children:[e.jsx(s.LeftProductImage,{images:H}),e.jsxs(s.Right,{children:[e.jsx(s.Header,{}),e.jsx(s.Content,{children:e.jsx(s.NarrowContent,{children:e.jsxs("form",{onSubmit:m,className:"position-relative",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{className:"h2",htmlFor:"link-password",children:e.jsx(f,{namespace:l,phrase:"info"})}),e.jsx("input",{id:"link-password",type:"text",className:`form-control form-control-lg ${I.input} ${c?"is-invalid":""}`,placeholder:o("placeholder"),onChange:t=>g(t.target.value),value:a,autoComplete:"off","aria-errormessage":"linkPasswordError"}),c&&e.jsx(F,{className:"mb-3",name:"linkPassword",children:c})]}),e.jsx(P,{variant:"dark",showSpinner:d,type:"submit",className:"w-100 mt-3 btn-lg",disabled:d||!a,children:e.jsx(f,{namespace:l,phrase:"confirm"})})]})})})]})]})}export{q as PincodeView};
//# sourceMappingURL=D7AciBfv.chunk.js.map
