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,bs as S,c as w}from"./main-634.js";import{a6 as E}from"./bf-746-82.js";import{N as C}from"./bf-123-109.js";import"./bf-275-83.js";import"./bf-822-108.js";import"./bf-25-81.js";function H({getgistConf:s,setGetgistConf:a,step:t,setstep:b,isInfo:m}){const[d,f]=c.useState(!1),[p,x]=c.useState({name:"",api_key:""}),[k,_]=c.useState(!1),[h,u]=c.useState(!1),A=()=>{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),_(!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:A,isLoading:h}),e.jsx("br",{}),e.jsx(C,{nextPageHandler:()=>N(),disabled:!d})]})]})}export{H as default};
