var I=Object.defineProperty;var g=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var j=(s,a,t)=>a in s?I(s,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[a]=t,l=(s,a)=>{for(var t in a||(a={}))v.call(a,t)&&j(s,t,a[t]);if(g)for(var t of g(a))z.call(a,t)&&j(s,t,a[t]);return s};import{r as c,j as e,_ as r,L as P,aL as S,c as w}from"./main-40.js";import{A as E}from"./bf-541-403.js";import{N as L}from"./bf-504-404.js";import"./bf-586-70.js";import"./bf-141-80.js";function M({getgistConf:s,setGetgistConf:a,step:t,setstep:b,isInfo:m}){const[d,f]=c.useState(!1),[p,x]=c.useState({name:"",api_key:""}),[k,A]=c.useState(!1),[h,u]=c.useState(!1),_=()=>{const n=l({},s);if(!n.name||!n.api_key){x({name:n.name?"":r("Integration name cann't be empty"),api_key:n.api_key?"":r("API Key cann't be empty")});return}u("auth");const o={api_key:n.api_key};w(o,"bitforms_getgist_authorize").then(i=>{i!=null&&i.success&&f(!0),A(!0),u(!1)})},y=n=>{const o=l({},s),i=l({},p);i[n.target.name]="",o[n.target.name]=n.target.value,x(i),a(o)},N=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),b(2)};return e.jsxs("div",{className:"btcd-stp-page",style:{width:t===1&&900,height:t===1&&"auto"},children:[e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:r("Integration Name:")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:y,name:"name",value:s.name,type:"text",placeholder:r("Integration Name..."),disabled:m}),e.jsx("div",{style:{color:"red",fontSize:"15px"},children:p.name}),e.jsx("div",{className:"mt-3",children:e.jsx("b",{children:r("API Key:")})}),e.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:y,name:"api_key",value:s.api_key,type:"text",placeholder:r("Integration API Key..."),disabled:m}),e.jsx("div",{style:{color:"red",fontSize:"15px"},children:p.api_key}),e.jsxs("small",{className:"d-blk mt-5",children:[r("To get API, Please Visit")," ",e.jsx("a",{className:"btcd-link",href:"https://app.getgist.com/projects/jgmmrszy/settings/api-key",target:"_blank",rel:"noreferrer",children:r("Getgist API Console")})]}),h==="auth"&&e.jsxs("div",{className:"flx mt-5",children:[e.jsx(P,{size:25,clr:"#022217",className:"mr-2"}),"Checking API Key!!!"]}),k&&!d&&!h&&e.jsxs("div",{className:"flx mt-5",style:{color:"red"},children:[e.jsx(S,{size:"20"}),"Sorry, API key is invalid"]}),!m&&e.jsxs(e.Fragment,{children:[e.jsx(E,{isAuthorized:d,handleAuthorize:_,isLoading:h}),e.jsx("br",{}),e.jsx(L,{nextPageHandler:()=>N(),disabled:!d})]})]})}export{M as default};
