var v=Object.defineProperty;var u=Object.getOwnPropertySymbols;var I=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var y=(i,a,e)=>a in i?v(i,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[a]=e,m=(i,a)=>{for(var e in a||(a={}))I.call(a,e)&&y(i,e,a[e]);if(u)for(var e of u(a))S.call(a,e)&&y(i,e,a[e]);return i};import{j as t,_ as s,b as w}from"./main.2.9.0.js";import{b as d}from"./react-router.DMwpH23k.js";import{B as P}from"./BackIcn._8Wofmn2.js";import{y as j}from"./Note.NSUdvR3c.js";import{T}from"./TutorialLink.CFG7bS5c.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.CEA_lFLo.js";function R({getgistConf:i,setGetgistConf:a,step:e,setstep:f,isInfo:p}){const[o,k]=d.useState(!1),[h,b]=d.useState({name:"",api_key:""}),[N,A]=d.useState(!1),[l,g]=d.useState(!1),_=()=>{const n=m({},i);if(!n.name||!n.api_key){b({name:n.name?"":s("Integration name can't be empty","bit-integrations"),api_key:n.api_key?"":s("API Key can't be empty","bit-integrations")});return}g("auth");const c={api_key:n.api_key};w(c,"getgist_authorize").then(r=>{r!=null&&r.success&&k(!0),A(!0),g(!1)})},x=n=>{const c=m({},i),r=m({},h);r[n.target.name]="",c[n.target.name]=n.target.value,b(r),a(c)},z=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),f(2)};return t.jsxs("div",{className:"btcd-stp-page",style:{width:e===1&&900,height:e===1&&"auto"},children:[t.jsx(T,{linkKey:"getgist"}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:x,name:"name",value:i.name,type:"text",placeholder:s("Integration Name...","bit-integrations"),disabled:p}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:h.name}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:s("API Key:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:x,name:"api_key",value:i.api_key,type:"text",placeholder:s("Integration Name...","bit-integrations"),disabled:p}),t.jsx("div",{style:{color:"red",fontSize:"15px"},children:h.api_key}),t.jsxs("small",{className:"d-blk mt-5",children:[s("To get API , Please Visit","bit-integrations")," ",t.jsx("a",{className:"btcd-link",href:"https://app.getgist.com/projects/jgmmrszy/settings/api-key",target:"_blank",rel:"noreferrer",children:s("Getgist API Console","bit-integrations")})]}),l==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(j,{size:25,clr:"#022217",className:"mr-2"}),s("Checking API Key!!!","bit-integrations")]}),N&&!o&&!l&&t.jsxs("div",{className:"flx mt-5",style:{color:"red"},children:[t.jsx("span",{className:"btcd-icn mr-2",style:{fontSize:30,marginTop:-5},children:"×"}),s("Sorry, Api key is invalid","bit-integrations")]}),!p&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:_,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:o||l,children:[o?s("Authorized ✔","bit-integrations"):s("Authorize","bit-integrations"),l&&t.jsx(j,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>z(),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!o,children:[s("Next","bit-integrations"),t.jsx(P,{className:"ml-1 rev-icn"})]})]})]})}export{R as default};
