@amp-labs/react 1.8.0 → 1.9.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/amp-react.cjs.js +3 -2
- package/build/amp-react.es.js +2915 -2743
- package/package.json +10 -8
package/build/amp-react.cjs.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),I=require("react"),w=require("@chakra-ui/react"),Mi=require("@emotion/react"),uo=require("@emotion/styled"),$i={warning:{bg:"red.50",outlineColor:"red.800",outline:"2px solid",outlineOffset:"0",borderColor:"red.800",color:"red.800",_hover:{bg:"red.100"}}},Ui=w.extendTheme({components:{Tabs:{baseStyle:{tab:{width:"100%",borderRadius:"4px",_hover:{bg:"gray.300"},_selected:{color:"black",fontWeight:"500",bg:"gray.200",border:"none",_hover:{bg:"gray.300"}}},warningTab:{width:"100%",borderRadius:"4px",_hover:{bg:"red.200"},_selected:{color:"red.800",fontWeight:"500",bg:"red.100",border:"none",_hover:{bg:"red.200"}}}}},Button:{variants:$i}}}),qi=w.extendTheme(w.withDefaultColorScheme({colorScheme:"facebook",components:["Button"]}),Ui);function Wi({children:e}){return s.jsx(w.ChakraProvider,{theme:qi,children:e})}const Fo=I.createContext(null),zi=Fo.Provider,X=()=>{const e=I.useContext(Fo);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var G=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e))(G||{});const Po=I.createContext(void 0);function Je(){const e=I.useContext(Po);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Ji=(()=>{const e={};return Object.values(G).forEach(t=>{e[t]={}}),e})();function Hi({children:e}){const[t,r]=I.useState(Ji),n=I.useCallback((g,m)=>{r(b=>{const y={...b};return y[g]=y[g]||{},y[g][m]=!0,y})},[r]),o=I.useCallback((g,m)=>{var b;return!!((b=t[g])!=null&&b[m])},[t]),a=I.useCallback((g,m)=>{r(b=>{var v;const y={...b};return(v=y[g])==null||delete v[m],y})},[r]),c=I.useCallback(g=>{r(m=>{const b={...m};return b[g]={},b})},[r]),u=I.useCallback((g,m)=>{r(b=>{const y={...b};return y[g]=y[g]||{},m.forEach(v=>{y[g][v]=!0}),y})},[r]),p=I.useMemo(()=>({errorState:t,setErrorState:r,setError:n,isError:o,removeError:a,resetBoundary:c,setErrors:u}),[t,r,n,o,a,c,u]);return s.jsx(Po.Provider,{value:p,children:e})}function Te({message:e}){return s.jsx(w.Box,{className:"loading-icon",height:"100%",width:"100%",display:"flex",justifyContent:"center",marginTop:"20%",marginBottom:"20%",children:s.jsxs(w.Stack,{alignItems:"center",children:[s.jsx(w.Spinner,{height:"100px",width:"100px",alignSelf:"center",thickness:"8px",speed:"1s",emptyColor:"gray.200",color:"blue.500",size:"xl",margin:"20px"}),e&&s.jsx(w.Text,{fontSize:"40px",color:"#4299e1",children:e})]})})}function Pe({message:e}){return s.jsxs(w.Box,{minHeight:"300px",padding:"30px",display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"center",children:[s.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("path",{d:"M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]}),s.jsx(w.Box,{boxSizing:"border-box",display:"flex",justifyContent:"center",alignItems:"center","align-self":"stretch",padding:"12px 50px 12px 50px",borderRadius:"8px",border:"2px solid #FECACA",background:"#FEF2F2",children:s.jsx(w.Text,{color:"#991B1B",fontSize:"md",children:e})})]})}const Ki="https://api.withampersand.com/v1".replace(/\/+$/,"");class Do{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Ki}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Bo}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Gi=new Do,_r=class _r{constructor(t=Gi){this.configuration=t,this.fetchApi=async(r,n)=>{let o={url:r,init:n};for(const c of this.middleware)c.pre&&(o=await c.pre({fetch:this.fetchApi,...o})||o);let a;try{a=await(this.configuration.fetchApi||fetch)(o.url,o.init)}catch(c){for(const u of this.middleware)u.onError&&(a=await u.onError({fetch:this.fetchApi,url:o.url,init:o.init,error:c,response:a?a.clone():void 0})||a);if(a===void 0)throw c instanceof Error?new Zi(c,"The request failed and the interceptors did not return an alternative response"):c}for(const c of this.middleware)c.post&&(a=await c.post({fetch:this.fetchApi,url:o.url,init:o.init,response:a.clone()})||a);return a},this.middleware=t.middleware}withMiddleware(...t){const r=this.clone();return r.middleware=r.middleware.concat(...t),r}withPreMiddleware(...t){const r=t.map(n=>({pre:n}));return this.withMiddleware(...r)}withPostMiddleware(...t){const r=t.map(n=>({post:n}));return this.withMiddleware(...r)}isJsonMime(t){return t?_r.jsonRegex.test(t):!1}async request(t,r){const{url:n,init:o}=await this.createFetchParams(t,r),a=await this.fetchApi(n,o);if(a&&a.status>=200&&a.status<300)return a;throw new Yi(a,"Response returned an error code")}async createFetchParams(t,r){let n=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(n+="?"+this.configuration.queryParamsStringify(t.query));const o=Object.assign({},this.configuration.headers,t.headers);Object.keys(o).forEach(g=>o[g]===void 0?delete o[g]:{});const a=typeof r=="function"?r:async()=>r,c={method:t.method,headers:o,body:t.body,credentials:this.configuration.credentials},u={...c,...await a({init:c,context:t})},p={...u,body:Xi(u.body)||u.body instanceof URLSearchParams||Vi(u.body)?u.body:JSON.stringify(u.body)};return{url:n,init:p}}clone(){const t=this.constructor,r=new t(this.configuration);return r.middleware=this.middleware.slice(),r}};_r.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let ne=_r;function Vi(e){return typeof Blob<"u"&&e instanceof Blob}function Xi(e){return typeof FormData<"u"&&e instanceof FormData}class Yi extends Error{constructor(t,r){super(r),this.response=t,this.name="ResponseError"}}class Zi extends Error{constructor(t,r){super(r),this.cause=t,this.name="FetchError"}}class _ extends Error{constructor(t,r){super(r),this.field=t,this.name="RequiredError"}}function N(e,t){const r=e[t];return r!=null}function Bo(e,t=""){return Object.keys(e).map(r=>Lo(r,e[r],t)).filter(r=>r.length>0).join("&")}function Lo(e,t,r=""){const n=r+(r.length?`[${e}]`:e);if(t instanceof Array){const o=t.map(a=>encodeURIComponent(String(a))).join(`&${encodeURIComponent(n)}=`);return`${encodeURIComponent(n)}=${o}`}if(t instanceof Set){const o=Array.from(t);return Lo(e,o,r)}return t instanceof Date?`${encodeURIComponent(n)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Bo(t,n):`${encodeURIComponent(n)}=${encodeURIComponent(String(t))}`}function Qn(e,t){return Object.keys(e).reduce((r,n)=>({...r,[n]:t(e[n])}),{})}class M{constructor(t,r=n=>n){this.raw=t,this.transformer=r}async value(){return this.transformer(await this.raw.json())}}class De{constructor(t){this.raw=t}async value(){}}class Qi{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function ea(e){return ta(e)}function ta(e,t){return e==null?e:{name:e.name,valuePrefix:N(e,"valuePrefix")?e.valuePrefix:void 0}}function ra(e){return na(e)}function na(e,t){return e==null?e:{name:e.name}}function oa(e){return ia(e)}function ia(e,t){return e==null?e:{attachmentType:e.attachmentType,query:N(e,"query")?ra(e.query):void 0,header:N(e,"header")?ea(e.header):void 0,docsURL:N(e,"docsURL")?e.docsURL:void 0}}function aa(e){return sa(e)}function sa(e,t){return e}function ca(e){return da(e)}function da(e,t){return e==null?e:{days:N(e,"days")?e.days:void 0,fullHistory:N(e,"fullHistory")?e.fullHistory:void 0}}function Mo(e){return la(e)}function la(e,t){return e==null?e:{defaultPeriod:ca(e.defaultPeriod)}}function ua(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function pa(e){if(e!==void 0)return e===null?null:{defaultPeriod:ua(e.defaultPeriod)}}function fa(e){return ha(e)}function ha(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function $o(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ga(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedFieldMappings:e.selectedFieldMappings,backfill:pa(e.backfill)}}function ma(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Qn(e.objects,ga)}}function wa(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function ya(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Qn(e.objects,wa)}}function Ia(e){return va(e)}function va(e,t){return e==null?e:{docsURL:N(e,"docsURL")?e.docsURL:void 0}}function Uo(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl}}function gr(e){return ba(e)}function ba(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:N(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function Sa(e){return xa(e)}function xa(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Oa(e){return Ca(e)}function Ca(e,t){return e==null?e:{provider:e.provider,read:N(e,"read")?e.read:void 0,write:N(e,"write")?e.write:void 0,proxy:N(e,"proxy")?fa(e.proxy):void 0}}function qo(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:$o(e.proxy)}}function Ta(e){return Na(e)}function Na(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Oa(e.content)}}function Ra(e){return _a(e)}function _a(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function Wo(e){return ja(e)}function ja(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function Ir(e){return Aa(e)}function Aa(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:N(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:N(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function vr(e){return ka(e)}function ka(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:Ir(e.providerApp),group:Wo(e.group),consumer:Ra(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:N(e,"ProviderConsumerRef")?e.ProviderConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function Ea(e){if(e!==void 0)return e===null?null:{consumerRef:e.consumerRef,consumerName:e.consumerName}}function Fa(e){if(e!==void 0)return e===null?null:{url:e.url,headers:e.headers}}function Pa(e){if(e!==void 0)return e===null?null:{name:e.name,type:e.type,metadata:Fa(e.metadata)}}function Da(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,groupName:e.groupName}}function Ba(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:qo(e.content)}}function La(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Ba(e.config)}}function Ma(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl}}function $a(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Ma(e.latestRevision)}}function Ua(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function qa(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Wa(e){return za(e)}function za(e,t){return e==null?e:{url:N(e,"url")?e.url:void 0,headers:N(e,"headers")?e.headers:void 0}}function Ja(e){if(e!==void 0)return e===null?null:{url:e.url,headers:e.headers}}function mr(e){return Ha(e)}function Ha(e,t){return e==null?e:{id:e.id,name:e.name,type:e.type,metadata:Wa(e.metadata),createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0}}function Ka(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Ga(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret}}function Va(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password,clientId:e.clientId,clientSecret:e.clientSecret}}function Xa(e){if(e!==void 0)return e===null?null:{projectId:e.projectId,providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:Ka(e.basicAuth),oauth2ClientCredentials:Ga(e.oauth2ClientCredentials),oauth2Password:Va(e.oauth2Password)}}function Ya(e){return Za(e)}function Za(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function Qa(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName}}function zo(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:N(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:N(e,"default")?e.default:void 0,prompt:N(e,"prompt")?e.prompt:void 0}}function Bn(e){return es(e)}function es(e,t){return e==null?e:{...Qa(e),...zo(e)}}function Jo(e){return ts(e)}function ts(e,t){return e}function rs(e){return ns(e)}function ns(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,destination:e.destination,schedule:e.schedule,requiredFields:N(e,"requiredFields")?e.requiredFields.map(Bn):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(Bn):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?Jo(e.optionalFieldsAuto):void 0,allFields:N(e,"allFields")?e.allFields.map(Bn):void 0,backfill:N(e,"backfill")?Mo(e.backfill):void 0}}function os(e){return is(e)}function is(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(rs):void 0}}function as(e){return ss(e)}function ss(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function cs(e){return ds(e)}function ds(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(as):void 0}}function ls(e){return us(e)}function us(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,provider:e.provider,read:N(e,"read")?os(e.read):void 0,write:N(e,"write")?cs(e.write):void 0,proxy:N(e,"proxy")?Ya(e.proxy):void 0}}function ps(e){return fs(e)}function fs(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:ls(e.content)}}function hs(e){if(e!==void 0)return e===null?null:{providerAppId:e.providerAppId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:e.providerConsumerRef,refreshToken:e.refreshToken,scopes:e.scopes}}function gs(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:qo(e.content)}}function ms(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:hs(e.connection),config:gs(e.config)}}function qt(e){return ws(e)}function ws(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:N(e,"group")?Wo(e.group):void 0,healthStatus:e.healthStatus,connection:vr(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,config:Ta(e.config)}}function ys(e){return Is(e)}function Is(e,t){return e==null?e:{enabled:N(e,"enabled")?e.enabled:void 0}}function vs(e,t){return e==null?e:{fieldName:e.fieldName}}function po(e){return bs(e)}function bs(e,t){return e==null?e:{...vs(e),...zo(e)}}function Ss(e){return xs(e)}function xs(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,requiredFields:N(e,"requiredFields")?e.requiredFields.map(po):void 0,optionalFields:N(e,"optionalFields")?e.optionalFields.map(po):void 0,optionalFieldsAuto:N(e,"optionalFieldsAuto")?Jo(e.optionalFieldsAuto):void 0,backfill:N(e,"backfill")?Mo(e.backfill):void 0}}function Os(e){return Cs(e)}function Cs(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Ss):void 0}}function Ts(e){return Ns(e)}function Ns(e,t){return e==null?e:{objectName:e.objectName}}function Rs(e){return _s(e)}function _s(e,t){return e==null?e:{objects:N(e,"objects")?e.objects.map(Ts):void 0}}function js(e){return As(e)}function As(e,t){return e==null?e:{name:e.name,displayName:N(e,"displayName")?e.displayName:void 0,provider:e.provider,read:N(e,"read")?Os(e.read):void 0,write:N(e,"write")?Rs(e.write):void 0,proxy:N(e,"proxy")?ys(e.proxy):void 0}}function ks(e){return Es(e)}function Es(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:js(e.content)}}function fo(e){return Fs(e)}function Fs(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:N(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:ks(e.latestRevision)}}function Ps(e){return Ds(e)}function Ds(e,t){return e==null?e:{msg:e.msg,operationEventId:N(e,"operation_event_id")?e.operation_event_id:void 0,operationId:N(e,"operation_id")?e.operation_id:void 0}}function Bs(e){return Ls(e)}function Ls(e,t){return e==null?e:{timestamp:e.timestamp,message:Ps(e.message),severity:e.severity}}function Ms(e){return $s(e)}function $s(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function Us(e){return qs(e)}function qs(e,t){return e==null?e:{iconURL:N(e,"iconURL")?e.iconURL:void 0,logoURL:N(e,"logoURL")?e.logoURL:void 0}}function Ws(e){return zs(e)}function zs(e,t){return e==null?e:{regular:N(e,"regular")?Us(e.regular):void 0,darkMode:N(e,"darkMode")?Ms(e.darkMode):void 0}}function Js(e){return Hs(e)}function Hs(e,t){return e==null?e:{workspaceRefField:N(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:N(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:N(e,"scopesField")?e.scopesField:void 0}}function Ks(e){return Gs(e)}function Gs(e,t){return e==null?e:{grantType:e.grantType,authURL:N(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:N(e,"audience")?e.audience:void 0,tokenMetadataFields:Js(e.tokenMetadataFields),docsURL:N(e,"docsURL")?e.docsURL:void 0,authURLParams:N(e,"authURLParams")?e.authURLParams:void 0}}function Vs(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider}}function ho(e){return Xs(e)}function Xs(e,t){return e==null?e:{projectId:e.projectId,integrationId:e.integrationId,configId:e.configId,actionType:e.actionType,id:e.id,installationId:e.installationId,status:e.status,result:N(e,"result")?e.result:void 0,latestOperationEventId:N(e,"latestOperationEventId")?e.latestOperationEventId:void 0,metadata:N(e,"metadata")?e.metadata:void 0,createTime:N(e,"createTime")?new Date(e.createTime):void 0}}function Ys(e){return Zs(e)}function Zs(e,t){return e==null?e:{bulkWrite:Sa(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function go(e){return Qs(e)}function Qs(e,t){return e==null?e:{name:e.name,authType:aa(e.authType),baseURL:e.baseURL,oauth2Opts:N(e,"oauth2Opts")?Ks(e.oauth2Opts):void 0,apiKeyOpts:N(e,"apiKeyOpts")?oa(e.apiKeyOpts):void 0,basicOpts:N(e,"basicOpts")?Ia(e.basicOpts):void 0,support:Ys(e.support),providerOpts:e.providerOpts,displayName:N(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:N(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:N(e,"media")?Ws(e.media):void 0}}function ec(e){return tc(e)}function tc(e,t){return e==null?e:{url:e.url,bucket:e.bucket,path:e.path}}function rc(e){if(e!==void 0)return e===null?null:{name:e.name,metadata:Ja(e.metadata)}}function nc(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,destination:rc(e.destination)}}function oc(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:ma(e.read),write:ya(e.write),proxy:$o(e.proxy)}}function ic(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:oc(e.content)}}function ac(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:ic(e.config)}}function sc(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:ac(e.installation)}}function cc(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function dc(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:cc(e.project)}}function lc(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function uc(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:lc(e.providerApp)}}class pc extends ne{async generateConnectionRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:n,body:Xa(t.generateConnectionParams)},r);return new M(a,c=>vr(c))}async generateConnection(t,r){return await(await this.generateConnectionRaw(t,r)).value()}async getConnectionRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new _("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:o,query:n},r);return new M(a,c=>vr(c))}async getConnection(t,r){return await(await this.getConnectionRaw(t,r)).value()}async listConnectionsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const n={};t.provider!==void 0&&(n.provider=t.provider),t.groupRef!==void 0&&(n.groupRef=t.groupRef),t.consumerRef!==void 0&&(n.consumerRef=t.consumerRef);const o={},a=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:n},r);return new M(a,c=>c.map(vr))}async listConnections(t,r){return await(await this.listConnectionsRaw(t,r)).value()}}class fc extends ne{async createConsumerRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createConsumer.");if(t.consumer===null||t.consumer===void 0)throw new _("consumer","Required parameter requestParameters.consumer was null or undefined when calling createConsumer.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects/{projectIdOrName}/consumers".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:n,body:Ea(t.consumer)},r);return new De(a)}async createConsumer(t,r){await this.createConsumerRaw(t,r)}}class hc extends ne{async createDestinationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createDestination.");if(t.destination===null||t.destination===void 0)throw new _("destination","Required parameter requestParameters.destination was null or undefined when calling createDestination.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects/{projectIdOrName}/destinations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:n,body:Pa(t.destination)},r);return new M(a,c=>mr(c))}async createDestination(t,r){return await(await this.createDestinationRaw(t,r)).value()}async deleteDestinationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteDestination.");if(t.destinationId===null||t.destinationId===void 0)throw new _("destinationId","Required parameter requestParameters.destinationId was null or undefined when calling deleteDestination.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}/destinations/{destinationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{destinationId}",encodeURIComponent(String(t.destinationId))),method:"DELETE",headers:o,query:n},r);return new De(a)}async deleteDestination(t,r){await this.deleteDestinationRaw(t,r)}async getDestinationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getDestination.");if(t.destinationName===null||t.destinationName===void 0)throw new _("destinationName","Required parameter requestParameters.destinationName was null or undefined when calling getDestination.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}/destinations/{destinationName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{destinationName}",encodeURIComponent(String(t.destinationName))),method:"GET",headers:o,query:n},r);return new M(a,c=>mr(c))}async getDestination(t,r){return await(await this.getDestinationRaw(t,r)).value()}async listDestinationsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listDestinations.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}/destinations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:n},r);return new M(a,c=>c.map(mr))}async listDestinations(t,r){return await(await this.listDestinationsRaw(t,r)).value()}async updateDestinationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateDestination.");if(t.destinationId===null||t.destinationId===void 0)throw new _("destinationId","Required parameter requestParameters.destinationId was null or undefined when calling updateDestination.");if(t.destinationUpdate===null||t.destinationUpdate===void 0)throw new _("destinationUpdate","Required parameter requestParameters.destinationUpdate was null or undefined when calling updateDestination.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects/{projectIdOrName}/destinations/{destinationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{destinationId}",encodeURIComponent(String(t.destinationId))),method:"PATCH",headers:o,query:n,body:nc(t.destinationUpdate)},r);return new M(a,c=>mr(c))}async updateDestination(t,r){return await(await this.updateDestinationRaw(t,r)).value()}}class gc extends ne{async createGroupRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createGroup.");if(t.group===null||t.group===void 0)throw new _("group","Required parameter requestParameters.group was null or undefined when calling createGroup.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects/{projectIdOrName}/groups".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:n,body:Da(t.group)},r);return new De(a)}async createGroup(t,r){await this.createGroupRaw(t,r)}}class mc extends ne{async createInstallationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new _("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:n,body:La(t.installation)},r);return new M(a,c=>qt(c))}async createInstallation(t,r){return await(await this.createInstallationRaw(t,r)).value()}async deleteInstallationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new _("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:o,query:n},r);return new De(a)}async deleteInstallation(t,r){await this.deleteInstallationRaw(t,r)}async getInstallationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new _("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:o,query:n},r);return new M(a,c=>qt(c))}async getInstallation(t,r){return await(await this.getInstallationRaw(t,r)).value()}async importInstallationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new _("installation","Required parameter requestParameters.installation was null or undefined when calling importInstallation.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations:import".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:n,body:ms(t.installation)},r);return new M(a,c=>qt(c))}async importInstallation(t,r){return await(await this.importInstallationRaw(t,r)).value()}async listInstallationsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const n={};t.groupRef!==void 0&&(n.groupRef=t.groupRef);const o={},a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:o,query:n},r);return new M(a,c=>c.map(qt))}async listInstallations(t,r){return await(await this.listInstallationsRaw(t,r)).value()}async updateInstallationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new _("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new _("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:o,query:n,body:sc(t.installationUpdate)},r);return new M(a,c=>qt(c))}async updateInstallation(t,r){return await(await this.updateInstallationRaw(t,r)).value()}}class wc extends ne{async batchUpsertIntegrationsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:n,body:Uo(t.batchUpsertIntegrationsRequest)},r);return new M(a,c=>c.map(fo))}async batchUpsertIntegrations(t,r){return await(await this.batchUpsertIntegrationsRaw(t,r)).value()}async createIntegrationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new _("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:n,body:$a(t.integration)},r);return new De(a)}async createIntegration(t,r){await this.createIntegrationRaw(t,r)}async deleteIntegrationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:o,query:n},r);return new De(a)}async deleteIntegration(t,r){await this.deleteIntegrationRaw(t,r)}async listIntegrationsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:n},r);return new M(a,c=>c.map(fo))}async listIntegrations(t,r){return await(await this.listIntegrationsRaw(t,r)).value()}}class yc extends ne{async oauthConnectRaw(t,r){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new _("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:n,body:Vs(t.connectOAuthParams)},r);return this.isJsonMime(a.headers.get("content-type"))?new M(a):new Qi(a)}async oauthConnect(t,r){return await(await this.oauthConnectRaw(t,r)).value()}}class Ic extends ne{async getOperationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getOperation.");if(t.operationId===null||t.operationId===void 0)throw new _("operationId","Required parameter requestParameters.operationId was null or undefined when calling getOperation.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}/operations/{operationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{operationId}",encodeURIComponent(String(t.operationId))),method:"GET",headers:o,query:n},r);return new M(a,c=>ho(c))}async getOperation(t,r){return await(await this.getOperationRaw(t,r)).value()}async listOperationLogsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listOperationLogs.");if(t.operationId===null||t.operationId===void 0)throw new _("operationId","Required parameter requestParameters.operationId was null or undefined when calling listOperationLogs.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}/operations/{operationId}/logs".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{operationId}",encodeURIComponent(String(t.operationId))),method:"GET",headers:o,query:n},r);return new M(a,c=>c.map(Bs))}async listOperationLogs(t,r){return await(await this.listOperationLogsRaw(t,r)).value()}async listOperationsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listOperations.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listOperations.");if(t.installationId===null||t.installationId===void 0)throw new _("installationId","Required parameter requestParameters.installationId was null or undefined when calling listOperations.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}/operations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:o,query:n},r);return new M(a,c=>c.map(ho))}async listOperations(t,r){return await(await this.listOperationsRaw(t,r)).value()}}class vc extends ne{async createProjectRaw(t,r){if(t.project===null||t.project===void 0)throw new _("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects",method:"POST",headers:o,query:n,body:Ua(t.project)},r);return new M(a,c=>gr(c))}async createProject(t,r){return await(await this.createProjectRaw(t,r)).value()}async deleteProjectRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:o,query:n},r);return new De(a)}async deleteProject(t,r){await this.deleteProjectRaw(t,r)}async getProjectRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:n},r);return new M(a,c=>gr(c))}async getProject(t,r){return await(await this.getProjectRaw(t,r)).value()}async listProjectsRaw(t){const r={},n={},o=await this.request({path:"/projects",method:"GET",headers:n,query:r},t);return new M(o,a=>a.map(gr))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new _("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:n,body:dc(t.projectUpdate)},r);return new M(a,c=>gr(c))}async updateProject(t,r){return await(await this.updateProjectRaw(t,r)).value()}}class bc extends ne{async getProviderRaw(t,r){if(t.provider===null||t.provider===void 0)throw new _("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const n={},o={},a=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:n},r);return new M(a,c=>go(c))}async getProvider(t,r){return await(await this.getProviderRaw(t,r)).value()}async listProvidersRaw(t){const r={},n={},o=await this.request({path:"/providers",method:"GET",headers:n,query:r},t);return new M(o,a=>Qn(a,go))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Sc extends ne{async createProviderAppRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new _("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:n,body:qa(t.providerApp)},r);return new M(a,c=>Ir(c))}async createProviderApp(t,r){return await(await this.createProviderAppRaw(t,r)).value()}async deleteProviderAppRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new _("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:o,query:n},r);return new De(a)}async deleteProviderApp(t,r){await this.deleteProviderAppRaw(t,r)}async listProviderAppsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const n={},o={},a=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:n},r);return new M(a,c=>c.map(Ir))}async listProviderApps(t,r){return await(await this.listProviderAppsRaw(t,r)).value()}async updateProviderAppRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new _("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new _("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:n,body:uc(t.providerAppUpdate)},r);return new M(a,c=>Ir(c))}async updateProviderApp(t,r){return await(await this.updateProviderAppRaw(t,r)).value()}}class xc extends ne{async createRevisionRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const n={},o={};o["Content-Type"]="application/json";const a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:n,body:Uo(t.revision)},r);return new De(a)}async createRevision(t,r){await this.createRevisionRaw(t,r)}async getHydratedRevisionRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new _("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new _("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const n={};t.connectionId!==void 0&&(n.connectionId=t.connectionId);const o={},a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:o,query:n},r);return new M(a,c=>ps(c))}async getHydratedRevision(t,r){return await(await this.getHydratedRevisionRaw(t,r)).value()}}class Oc extends ne{async generateUploadUrlRaw(t){const r={},n={},o=await this.request({path:"/generate-upload-url",method:"GET",headers:n,query:r},t);return new M(o,a=>ec(a))}async generateUploadUrl(t){return await(await this.generateUploadUrlRaw(t)).value()}}class Cc{constructor(t){this.connectionApi=new pc(t),this.consumerApi=new fc(t),this.destinationApi=new hc(t),this.groupApi=new gc(t),this.installationApi=new mc(t),this.integrationApi=new wc(t),this.oAuthApi=new yc(t),this.operationApi=new Ic(t),this.projectApi=new vc(t),this.providerApi=new bc(t),this.providerAppApi=new Sc(t),this.revisionApi=new xc(t),this.uploadURLApi=new Oc(t)}}const Tc="1.8.0",Nc="v1",wr="https://api.withampersand.com";function Ho(){try{const e=process.env.REACT_APP_AMP_SERVER;switch(e){case"local":return"http://localhost:8080";case"dev":return"https://dev-api.withampersand.com";case"staging":return"https://staging-api.withampersand.com";case"prod":return wr;case"mock":return"http://127.0.0.1:4010";case"":return wr;default:return e??wr}}catch{return wr}}const Rc=(e,t)=>`${e}/${t}`;function _c(){return Rc(Ho(),Nc)}const jc=Ho(),Ac=_c(),kc=new Do({basePath:Ac,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Tc}});let Ec=new Cc(kc);const H=()=>Ec,Ko=I.createContext({integrations:null}),Go=()=>{const e=I.useContext(Ko);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function Fc({projectIdOrName:e,children:t}){const r=X(),{setError:n,isError:o}=Je(),[a,c]=I.useState(null),[u,p]=I.useState(!0);I.useEffect(()=>{H().integrationApi.listIntegrations({projectIdOrName:e},{headers:{"X-Api-Key":r??""}}).then(m=>{p(!1),c(m||[])}).catch(m=>{p(!1),n(G.INTEGRATION_LIST,e),console.error("Error retrieving integration information for : ",m)})},[e,r,n]);const g=I.useMemo(()=>({integrations:a}),[a]);return o(G.INTEGRATION_LIST,e)?s.jsx(Pe,{message:"Error retrieving integrations for the project, double check the API key"}):s.jsx(Ko.Provider,{value:g,children:u?s.jsx(Te,{}):t})}const Vo=I.createContext({project:null,appName:"",projectId:""}),V=()=>{const e=I.useContext(Vo);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Pc({projectIdOrName:e,children:t}){const r=X(),{isError:n,setError:o}=Je(),[a,c]=I.useState(null),[u,p]=I.useState(!0);I.useEffect(()=>{H().projectApi.getProject({projectIdOrName:e},{headers:{"X-Api-Key":r??""}}).then(m=>{p(!1),c(m)}).catch(m=>{o(G.PROJECT,e),p(!1),console.error("Error loading Ampersand project: ",m)})},[e,r,p,o]);const g=I.useMemo(()=>({projectId:e,project:a,appName:(a==null?void 0:a.appName)||""}),[e,a]);return n(G.PROJECT,e)?s.jsx(Pe,{message:`Error loading project ${e}`}):s.jsx(Vo.Provider,{value:g,children:u?s.jsx(Te,{}):t})}function Dc(e){const{options:{apiKey:t,projectId:r,project:n},children:o}=e,a=n||r;if(r&&n)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!a)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return s.jsx(Wi,{children:s.jsx(Hi,{children:s.jsx(zi,{value:t,children:s.jsx(Pc,{projectIdOrName:a,children:s.jsx(Fc,{projectIdOrName:a,children:o})})})})})}const Xo=I.createContext(null);function Bc(){const e=I.useContext(Xo);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
2
|
-
component is wrapped with AmpersandProvider`);return e}function de(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Lc=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(r=>r.name===e)??null,Yo=I.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0});function Ne(){const e=I.useContext(Yo);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Mc({children:e,integration:t,consumerRef:r,consumerName:n,groupRef:o,groupName:a,onInstallSuccess:c,onUpdateSuccess:u}){const p=X(),{projectId:g}=V(),{integrations:m}=Go(),[b,y]=I.useState([]),[v,x]=I.useState(!0),{setError:S,isError:O}=Je(),j=(b==null?void 0:b[0])||null,T=I.useMemo(()=>Lc(t,m||[]),[t,m]);I.useEffect(()=>{T===null&&(m!=null&&m.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,T,m]);const P=I.useCallback(J=>{y([J])},[y]),L=I.useCallback(()=>{T!=null&&T.id&&H().installationApi.listInstallations({projectIdOrName:g,integrationId:T.id,groupRef:o},{headers:{"X-Api-Key":p??""}}).then(J=>{x(!1),y(J||[])}).catch(J=>{S(G.INSTALLATION_LIST,T.id),x(!1),console.error("Error retrieving installation information: ",J)})},[T,g,p,S,o]),Z=(T==null?void 0:T.id)||"";I.useEffect(()=>{L()},[L]);const te=I.useMemo(()=>({integrationId:(T==null?void 0:T.id)||"",provider:(T==null?void 0:T.provider)||"",integrationObj:T,consumerRef:r,consumerName:n,groupRef:o,groupName:a,installation:j,setInstallation:P,resetInstallations:L,onInstallSuccess:c,onUpdateSuccess:u}),[T,r,n,o,a,j,P,L,c,u]);if(T!==null){const J=`Error retrieving installation information for integration "${(T==null?void 0:T.name)||"unknown"}"`;return O(G.INSTALLATION_LIST,Z)?s.jsx(Pe,{message:J}):s.jsx(Yo.Provider,{value:te,children:v?s.jsx(Te,{}):e})}return s.jsx(Pe,{message:`Integration "${t}" not found`})}const Zo=I.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),xt=()=>{const e=I.useContext(Zo);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function Qo({provider:e,groupRef:t,children:r}){const n=X(),{projectId:o}=V(),[a,c]=I.useState(null),[u,p]=I.useState(null),[g,m]=I.useState(!0),{setError:b,isError:y}=Je(),{provider:v}=Ne();if(!o)throw new Error("ConnectionsProvider must be used within AmpersandProvider");const x=e||v;if(!x)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");I.useEffect(()=>{H().connectionApi.listConnections({projectIdOrName:o,groupRef:t,provider:x},{headers:{"X-Api-Key":n??""}}).then(O=>{m(!1),c(O)}).catch(O=>{m(!1),b(G.CONNECTION_LIST,o),console.error(`Error retrieving existing OAuth connections for group ID ${t}:`,O)})},[o,n,t,x,b]);const S=I.useMemo(()=>({connections:a,selectedConnection:u,setConnections:c,setSelectedConnection:p}),[a,u,c,p]);return y(G.CONNECTION_LIST,o)?s.jsx(Pe,{message:"Error retrieving existing connections"}):s.jsx(Zo.Provider,{value:S,children:g?s.jsx(Te,{}):r})}var We=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function eo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xr={exports:{}};xr.exports;(function(e,t){var r=200,n="__lodash_hash_undefined__",o=1,a=2,c=9007199254740991,u="[object Arguments]",p="[object Array]",g="[object AsyncFunction]",m="[object Boolean]",b="[object Date]",y="[object Error]",v="[object Function]",x="[object GeneratorFunction]",S="[object Map]",O="[object Number]",j="[object Null]",T="[object Object]",P="[object Promise]",L="[object Proxy]",Z="[object RegExp]",te="[object Set]",J="[object String]",ie="[object Symbol]",be="[object Undefined]",he="[object WeakMap]",Re="[object ArrayBuffer]",ct="[object DataView]",Br="[object Float32Array]",Lr="[object Float64Array]",Mr="[object Int8Array]",$r="[object Int16Array]",Ur="[object Int32Array]",qr="[object Uint8Array]",Wr="[object Uint8ClampedArray]",zr="[object Uint16Array]",Jr="[object Uint32Array]",Hr=/[\\^$.*+?()[\]{}|]/g,$=/^\[object .+?Constructor\]$/,Yt=/^(?:0|[1-9]\d*)$/,U={};U[Br]=U[Lr]=U[Mr]=U[$r]=U[Ur]=U[qr]=U[Wr]=U[zr]=U[Jr]=!0,U[u]=U[p]=U[Re]=U[m]=U[ct]=U[b]=U[y]=U[v]=U[S]=U[O]=U[T]=U[Z]=U[te]=U[J]=U[he]=!1;var Be=typeof We=="object"&&We&&We.Object===Object&&We,Zt=typeof self=="object"&&self&&self.Object===Object&&self,re=Be||Zt||Function("return this")(),Ct=t&&!t.nodeType&&t,dt=Ct&&!0&&e&&!e.nodeType&&e,Tt=dt&&dt.exports===Ct,lt=Tt&&Be.process,Qt=function(){try{return lt&<.binding&<.binding("util")}catch{}}(),er=Qt&&Qt.isTypedArray;function Kr(l,i){for(var d=-1,f=l==null?0:l.length,C=0,R=[];++d<f;){var A=l[d];i(A,d,l)&&(R[C++]=A)}return R}function Gr(l,i){for(var d=-1,f=i.length,C=l.length;++d<f;)l[C+d]=i[d];return l}function Vr(l,i){for(var d=-1,f=l==null?0:l.length;++d<f;)if(i(l[d],d,l))return!0;return!1}function Xr(l,i){for(var d=-1,f=Array(l);++d<l;)f[d]=i(d);return f}function Yr(l){return function(i){return l(i)}}function ut(l,i){return l.has(i)}function Nt(l,i){return l==null?void 0:l[i]}function pt(l){var i=-1,d=Array(l.size);return l.forEach(function(f,C){d[++i]=[C,f]}),d}function Se(l,i){return function(d){return l(i(d))}}function tr(l){var i=-1,d=Array(l.size);return l.forEach(function(f){d[++i]=f}),d}var rr=Array.prototype,Zr=Function.prototype,ft=Object.prototype,Le=re["__core-js_shared__"],Rt=Zr.toString,ae=ft.hasOwnProperty,_t=function(){var l=/[^.]+$/.exec(Le&&Le.keys&&Le.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""}(),jt=ft.toString,Qr=RegExp("^"+Rt.call(ae).replace(Hr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nr=Tt?re.Buffer:void 0,le=re.Symbol,He=re.Uint8Array,or=ft.propertyIsEnumerable,ir=rr.splice,_e=le?le.toStringTag:void 0,At=Object.getOwnPropertySymbols,Ke=nr?nr.isBuffer:void 0,en=Se(Object.keys,Object),ge=$e(re,"DataView"),Ge=$e(re,"Map"),kt=$e(re,"Promise"),Et=$e(re,"Set"),Ft=$e(re,"WeakMap"),Ve=$e(Object,"create"),me=Ie(ge),tn=Ie(Ge),rn=Ie(kt),nn=Ie(Et),on=Ie(Ft),ar=le?le.prototype:void 0,xe=ar?ar.valueOf:void 0;function je(l){var i=-1,d=l==null?0:l.length;for(this.clear();++i<d;){var f=l[i];this.set(f[0],f[1])}}function an(){this.__data__=Ve?Ve(null):{},this.size=0}function sn(l){var i=this.has(l)&&delete this.__data__[l];return this.size-=i?1:0,i}function cn(l){var i=this.__data__;if(Ve){var d=i[l];return d===n?void 0:d}return ae.call(i,l)?i[l]:void 0}function dn(l){var i=this.__data__;return Ve?i[l]!==void 0:ae.call(i,l)}function Me(l,i){var d=this.__data__;return this.size+=this.has(l)?0:1,d[l]=Ve&&i===void 0?n:i,this}je.prototype.clear=an,je.prototype.delete=sn,je.prototype.get=cn,je.prototype.has=dn,je.prototype.set=Me;function we(l){var i=-1,d=l==null?0:l.length;for(this.clear();++i<d;){var f=l[i];this.set(f[0],f[1])}}function ln(){this.__data__=[],this.size=0}function un(l){var i=this.__data__,d=mt(i,l);if(d<0)return!1;var f=i.length-1;return d==f?i.pop():ir.call(i,d,1),--this.size,!0}function pn(l){var i=this.__data__,d=mt(i,l);return d<0?void 0:i[d][1]}function fn(l){return mt(this.__data__,l)>-1}function hn(l,i){var d=this.__data__,f=mt(d,l);return f<0?(++this.size,d.push([l,i])):d[f][1]=i,this}we.prototype.clear=ln,we.prototype.delete=un,we.prototype.get=pn,we.prototype.has=fn,we.prototype.set=hn;function ye(l){var i=-1,d=l==null?0:l.length;for(this.clear();++i<d;){var f=l[i];this.set(f[0],f[1])}}function gn(){this.size=0,this.__data__={hash:new je,map:new(Ge||we),string:new je}}function ht(l){var i=Ze(this,l).delete(l);return this.size-=i?1:0,i}function Pt(l){return Ze(this,l).get(l)}function mn(l){return Ze(this,l).has(l)}function gt(l,i){var d=Ze(this,l),f=d.size;return d.set(l,i),this.size+=d.size==f?0:1,this}ye.prototype.clear=gn,ye.prototype.delete=ht,ye.prototype.get=Pt,ye.prototype.has=mn,ye.prototype.set=gt;function Xe(l){var i=-1,d=l==null?0:l.length;for(this.__data__=new ye;++i<d;)this.add(l[i])}function wn(l){return this.__data__.set(l,n),this}function yn(l){return this.__data__.has(l)}Xe.prototype.add=Xe.prototype.push=wn,Xe.prototype.has=yn;function Oe(l){var i=this.__data__=new we(l);this.size=i.size}function sr(){this.__data__=new we,this.size=0}function In(l){var i=this.__data__,d=i.delete(l);return this.size=i.size,d}function vn(l){return this.__data__.get(l)}function bn(l){return this.__data__.has(l)}function Sn(l,i){var d=this.__data__;if(d instanceof we){var f=d.__data__;if(!Ge||f.length<r-1)return f.push([l,i]),this.size=++d.size,this;d=this.__data__=new ye(f)}return d.set(l,i),this.size=d.size,this}Oe.prototype.clear=sr,Oe.prototype.delete=In,Oe.prototype.get=vn,Oe.prototype.has=bn,Oe.prototype.set=Sn;function xn(l,i){var d=Qe(l),f=!d&&Fn(l),C=!d&&!f&&vt(l),R=!d&&!f&&!C&&Ut(l),A=d||f||C||R,F=A?Xr(l.length,String):[],k=F.length;for(var E in l)ae.call(l,E)&&!(A&&(E=="length"||C&&(E=="offset"||E=="parent")||R&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||An(E,k)))&&F.push(E);return F}function mt(l,i){for(var d=l.length;d--;)if(It(l[d][0],i))return d;return-1}function On(l,i,d){var f=i(l);return Qe(l)?f:Gr(f,d(l))}function Ye(l){return l==null?l===void 0?be:j:_e&&_e in Object(l)?_n(l):Lt(l)}function cr(l){return et(l)&&Ye(l)==u}function dr(l,i,d,f,C){return l===i?!0:l==null||i==null||!et(l)&&!et(i)?l!==l&&i!==i:wt(l,i,d,f,dr,C)}function wt(l,i,d,f,C,R){var A=Qe(l),F=Qe(i),k=A?p:ue(l),E=F?p:ue(i);k=k==u?T:k,E=E==u?T:E;var q=k==T,W=E==T,K=k==E;if(K&&vt(l)){if(!vt(i))return!1;A=!0,q=!1}if(K&&!q)return R||(R=new Oe),A||Ut(l)?Bt(l,i,d,f,C,R):Nn(l,i,k,d,f,C,R);if(!(d&o)){var Q=q&&ae.call(l,"__wrapped__"),ee=W&&ae.call(i,"__wrapped__");if(Q||ee){var ve=Q?l.value():l,ke=ee?i.value():i;return R||(R=new Oe),C(ve,ke,d,f,R)}}return K?(R||(R=new Oe),Rn(l,i,d,f,C,R)):!1}function Dt(l){if(!$t(l)||En(l))return!1;var i=Ue(l)?Qr:$;return i.test(Ie(l))}function Cn(l){return et(l)&&ur(l.length)&&!!U[Ye(l)]}function Tn(l){if(!yt(l))return en(l);var i=[];for(var d in Object(l))ae.call(l,d)&&d!="constructor"&&i.push(d);return i}function Bt(l,i,d,f,C,R){var A=d&o,F=l.length,k=i.length;if(F!=k&&!(A&&k>F))return!1;var E=R.get(l);if(E&&R.get(i))return E==i;var q=-1,W=!0,K=d&a?new Xe:void 0;for(R.set(l,i),R.set(i,l);++q<F;){var Q=l[q],ee=i[q];if(f)var ve=A?f(ee,Q,q,i,l,R):f(Q,ee,q,l,i,R);if(ve!==void 0){if(ve)continue;W=!1;break}if(K){if(!Vr(i,function(ke,tt){if(!ut(K,tt)&&(Q===ke||C(Q,ke,d,f,R)))return K.push(tt)})){W=!1;break}}else if(!(Q===ee||C(Q,ee,d,f,R))){W=!1;break}}return R.delete(l),R.delete(i),W}function Nn(l,i,d,f,C,R,A){switch(d){case ct:if(l.byteLength!=i.byteLength||l.byteOffset!=i.byteOffset)return!1;l=l.buffer,i=i.buffer;case Re:return!(l.byteLength!=i.byteLength||!R(new He(l),new He(i)));case m:case b:case O:return It(+l,+i);case y:return l.name==i.name&&l.message==i.message;case Z:case J:return l==i+"";case S:var F=pt;case te:var k=f&o;if(F||(F=tr),l.size!=i.size&&!k)return!1;var E=A.get(l);if(E)return E==i;f|=a,A.set(l,i);var q=Bt(F(l),F(i),f,C,R,A);return A.delete(l),q;case ie:if(xe)return xe.call(l)==xe.call(i)}return!1}function Rn(l,i,d,f,C,R){var A=d&o,F=lr(l),k=F.length,E=lr(i),q=E.length;if(k!=q&&!A)return!1;for(var W=k;W--;){var K=F[W];if(!(A?K in i:ae.call(i,K)))return!1}var Q=R.get(l);if(Q&&R.get(i))return Q==i;var ee=!0;R.set(l,i),R.set(i,l);for(var ve=A;++W<k;){K=F[W];var ke=l[K],tt=i[K];if(f)var lo=A?f(tt,ke,K,i,l,R):f(ke,tt,K,l,i,R);if(!(lo===void 0?ke===tt||C(ke,tt,d,f,R):lo)){ee=!1;break}ve||(ve=K=="constructor")}if(ee&&!ve){var fr=l.constructor,hr=i.constructor;fr!=hr&&"constructor"in l&&"constructor"in i&&!(typeof fr=="function"&&fr instanceof fr&&typeof hr=="function"&&hr instanceof hr)&&(ee=!1)}return R.delete(l),R.delete(i),ee}function lr(l){return On(l,Pn,jn)}function Ze(l,i){var d=l.__data__;return kn(i)?d[typeof i=="string"?"string":"hash"]:d.map}function $e(l,i){var d=Nt(l,i);return Dt(d)?d:void 0}function _n(l){var i=ae.call(l,_e),d=l[_e];try{l[_e]=void 0;var f=!0}catch{}var C=jt.call(l);return f&&(i?l[_e]=d:delete l[_e]),C}var jn=At?function(l){return l==null?[]:(l=Object(l),Kr(At(l),function(i){return or.call(l,i)}))}:Dn,ue=Ye;(ge&&ue(new ge(new ArrayBuffer(1)))!=ct||Ge&&ue(new Ge)!=S||kt&&ue(kt.resolve())!=P||Et&&ue(new Et)!=te||Ft&&ue(new Ft)!=he)&&(ue=function(l){var i=Ye(l),d=i==T?l.constructor:void 0,f=d?Ie(d):"";if(f)switch(f){case me:return ct;case tn:return S;case rn:return P;case nn:return te;case on:return he}return i});function An(l,i){return i=i??c,!!i&&(typeof l=="number"||Yt.test(l))&&l>-1&&l%1==0&&l<i}function kn(l){var i=typeof l;return i=="string"||i=="number"||i=="symbol"||i=="boolean"?l!=="__proto__":l===null}function En(l){return!!_t&&_t in l}function yt(l){var i=l&&l.constructor,d=typeof i=="function"&&i.prototype||ft;return l===d}function Lt(l){return jt.call(l)}function Ie(l){if(l!=null){try{return Rt.call(l)}catch{}try{return l+""}catch{}}return""}function It(l,i){return l===i||l!==l&&i!==i}var Fn=cr(function(){return arguments}())?cr:function(l){return et(l)&&ae.call(l,"callee")&&!or.call(l,"callee")},Qe=Array.isArray;function Mt(l){return l!=null&&ur(l.length)&&!Ue(l)}var vt=Ke||pr;function Ae(l,i){return dr(l,i)}function Ue(l){if(!$t(l))return!1;var i=Ye(l);return i==v||i==x||i==g||i==L}function ur(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=c}function $t(l){var i=typeof l;return l!=null&&(i=="object"||i=="function")}function et(l){return l!=null&&typeof l=="object"}var Ut=er?Yr(er):Cn;function Pn(l){return Mt(l)?xn(l):Tn(l)}function Dn(){return[]}function pr(){return!1}e.exports=Ae})(xr,xr.exports);var $c=xr.exports;const Uc=eo($c),it="other";function ze(e){return e.mapToName!==void 0}function qc(e,t){var r;return((r=e==null?void 0:e.objects)==null?void 0:r.find(n=>n.objectName===t))||null}function Wc(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(r=>!ze(r)&&!!r.fieldName))||null}function zc(e){var r;return((r=e==null?void 0:e.requiredFields)==null?void 0:r.filter(n=>ze(n)&&!!n.mapToName))||[]}function Jc(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(r=>!ze(r)&&!!r.fieldName))||null}const ei=(e,t)=>{var r,n,o;return(o=(n=(r=e==null?void 0:e.content)==null?void 0:r.read)==null?void 0:n.objects)==null?void 0:o[t]};function Hc(e){return ze(e)?e.mapToName:e.fieldName}const ti=(e,t)=>{var n,o,a;const r=[];return(a=(o=(n=t.content)==null?void 0:n.read)==null?void 0:o.objects)==null||a.forEach(c=>{r.push({name:c==null?void 0:c.objectName,completed:e?!!ei(e,c.objectName):!1})}),r},ri=e=>{var r;return{name:it,completed:e?!!((r=e==null?void 0:e.content)!=null&&r.write):!1}};function Kc(e,t){var a;const r=ti(e,t),o=!!((a=t==null?void 0:t.content)!=null&&a.write)?ri(e):void 0;return o&&r.push(o),r}function ni(e,t,r){const n=(e==null?void 0:e.filter(a=>!(t!=null&&t[a==null?void 0:a.mapToName])))||[],o=n.map(a=>a.mapToName);return r(G.MAPPING,o),n!=null&&n.length&&console.error("required fields not met",n.map(a=>a.mapToDisplayName)),{errorList:o}}function to(e,t){return Uc(e,t)}const Gc=(e,t,r)=>{var v,x,S,O,j,T;if(!e)return null;const n=qc(e,t),o=n&&Wc(n),a=n&&Jc(n),c=n&&zc(n),u=(n==null?void 0:n.allFields)||[],p=r==null?void 0:r.content,g=((S=(x=(v=p==null?void 0:p.read)==null?void 0:v.objects)==null?void 0:x[t])==null?void 0:S.selectedFields)||{},m=((T=(j=(O=p==null?void 0:p.read)==null?void 0:O.objects)==null?void 0:j[t])==null?void 0:T.selectedFieldMappings)||{},b={...g},y={...m};return{allFields:u,requiredFields:o,optionalFields:a,requiredMapFields:c,selectedOptionalFields:g,selectedFieldMappings:m,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:b,requiredMapFields:y}}},Vc=(e,t)=>{var c,u;if(!e)return null;const r=(u=(c=t==null?void 0:t.content)==null?void 0:c.write)==null?void 0:u.objects,n=Object.keys(r||{}),o={};n.forEach(p=>{o[p]=!0});const a={...o};return{writeObjects:(e==null?void 0:e.objects)||[],selectedNonConfigurableWriteFields:o,isWriteModified:!1,savedConfig:{selectedNonConfigurableWriteFields:a}}};function oi(e,t,r){var a,c;const n=(a=e==null?void 0:e.content)==null?void 0:a.read,o=(c=e==null?void 0:e.content)==null?void 0:c.write;return{read:Gc(n,t,r),write:Vc(o,r)}}const ii=(e,t,r,n)=>{const o=oi(e,r,t);n(r,o)},Xc=(e,t,r)=>{const n=Kc(t,e),o={};n.forEach(({name:a,completed:c})=>{c&&(o[a]=oi(e,a,t))}),r(o)},ai=e=>{const{requiredFields:t,selectedOptionalFields:r}=(e==null?void 0:e.read)||{},n=new Set;return t==null||t.forEach(a=>n.add(Hc(a))),{...Array.from(n).reduce((a,c)=>({...a,[c]:!0}),{}),...r||{}}},si=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},r={};return t&&Object.keys(t).forEach(n=>{t[n]!==void 0?r[n]=t[n]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${n}`)}),r};function ci(e,t){return t[e]||void 0}function ro({createConfig:e,projectId:t,integrationId:r,groupRef:n,connectionId:o,apiKey:a,setInstallation:c,onInstallSuccess:u}){const p={projectIdOrName:t,integrationId:r,installation:{groupRef:n,connectionId:o,config:e}};return H().installationApi.createInstallation(p,{headers:{"X-Api-Key":a,"Content-Type":"application/json"}}).then(g=>{c(g),u==null||u(g.id,g.config)}).catch(g=>{console.error("ERROR: ",g)})}function jr(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Yc=(e,t)=>{const r=e.content.read,n=r==null?void 0:r.objects;return n==null?void 0:n.find(o=>o.objectName===t)},Zc=(e,t,r,n)=>{const o=ai(e),a=si(e),c=Yc(r,t);if(!c)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const u={revisionId:r.id,createdBy:`consumer:${n}`,content:{provider:r.content.provider,read:{objects:{[t]:{objectName:t,schedule:c.schedule,destination:c.destination,selectedFields:o,selectedFieldMappings:a,backfill:c.backfill}}}}};return jr(r)&&(u.content.proxy={enabled:!0}),u},Qc=(e,t,r,n,o,a,c,u,p,g,m)=>{const b=Zc(p,a,u,n);return b?ro({createConfig:b,projectId:e,integrationId:t,groupRef:r,connectionId:o,apiKey:c,setInstallation:g,onInstallSuccess:m}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},di=e=>{var a,c;const t={},r=(a=e.write)==null?void 0:a.writeObjects,n=(c=e.write)==null?void 0:c.selectedNonConfigurableWriteFields,o=n?Object.keys(n):[];return r&&r.forEach(u=>{const p=u.objectName;o.includes(p)&&(t[p]={objectName:p})}),t},ed=e=>{const t=e.content.write;return t==null?void 0:t.objects},td=(e,t,r)=>{if(!ed(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=di(e),a={revisionId:t.id,createdBy:`consumer:${r}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return jr(t)&&(a.content.proxy={enabled:!0}),a},rd=(e,t,r,n,o,a,c,u,p,g)=>{const m=td(u,c,n);return m?ro({createConfig:m,projectId:e,integrationId:t,groupRef:r,connectionId:o,apiKey:a,setInstallation:p,onInstallSuccess:g}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))};function nd(){return s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const li="uninstall-installation",od=I.forwardRef(({text:e="Uninstall"},t)=>{const r=w.useTab({ref:t}),n=w.useMultiStyleConfig("Tabs",r);return s.jsxs(w.Button,{__css:n.warningTab,...r,minHeight:15,children:[s.jsxs(w.Box,{as:"span",display:"flex",alignItems:"center",gap:2,my:2,mx:4,children:[nd(),s.jsx(w.Box,{textAlign:"left",children:s.jsx(w.Text,{color:"red.800",children:e})})]}),r.children]})}),ui=I.createContext({hydratedRevision:null,loading:!1}),Gt=()=>{const e=I.useContext(ui);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function id({projectId:e,children:t}){var P;const{selectedConnection:r}=xt(),{integrationId:n,integrationObj:o}=Ne(),[a,c]=I.useState(null),[u,p]=I.useState(!0),{isError:g,removeError:m,setError:b}=Je(),y=X(),v=r==null?void 0:r.id,x=(P=o==null?void 0:o.latestRevision)==null?void 0:P.id,S=(o==null?void 0:o.name)||n;I.useEffect(()=>{e&&n&&x&&v&&y&&H().revisionApi.getHydratedRevision({projectIdOrName:e,integrationId:n,revisionId:x,connectionId:v},{headers:{"X-Api-Key":y??""}}).then(L=>{c(L),p(!1),m(G.HYDRATED_REVISION,S)}).catch(L=>{console.error(`Error loading integration ${S}`,L),p(!1),b(G.HYDRATED_REVISION,S)})},[e,n,x,v,y,m,b,S]);const O=I.useMemo(()=>({hydratedRevision:a,loading:u}),[a,u]),T=`Error retrieving integration details for '${(o==null?void 0:o.name)||n||"unknown integration"}. This is sometimes caused by insufficient permissions with your credentials'`;return s.jsx(ui.Provider,{value:O,children:g(G.HYDRATED_REVISION,S)?s.jsx(Pe,{message:T}):t})}var pi=Symbol.for("immer-nothing"),mo=Symbol.for("immer-draftable"),se=Symbol.for("immer-state"),ad=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function oe(e,...t){if(process.env.NODE_ENV!=="production"){const r=ad[e],n=typeof r=="function"?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var bt=Object.getPrototypeOf;function St(e){return!!e&&!!e[se]}function at(e){var t;return e?fi(e)||Array.isArray(e)||!!e[mo]||!!((t=e.constructor)!=null&&t[mo])||kr(e)||Er(e):!1}var sd=Object.prototype.constructor.toString();function fi(e){if(!e||typeof e!="object")return!1;const t=bt(e);if(t===null)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===sd}function Or(e,t){Ar(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function Ar(e){const t=e[se];return t?t.type_:Array.isArray(e)?1:kr(e)?2:Er(e)?3:0}function qn(e,t){return Ar(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function hi(e,t,r){const n=Ar(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function cd(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function kr(e){return e instanceof Map}function Er(e){return e instanceof Set}function rt(e){return e.copy_||e.base_}function Wn(e,t){if(kr(e))return new Map(e);if(Er(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=fi(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[se];let o=Reflect.ownKeys(n);for(let a=0;a<o.length;a++){const c=o[a],u=n[c];u.writable===!1&&(u.writable=!0,u.configurable=!0),(u.get||u.set)&&(n[c]={configurable:!0,writable:!0,enumerable:u.enumerable,value:e[c]})}return Object.create(bt(e),n)}else{const n=bt(e);if(n!==null&&r)return{...e};const o=Object.create(n);return Object.assign(o,e)}}function no(e,t=!1){return Fr(e)||St(e)||!at(e)||(Ar(e)>1&&(e.set=e.add=e.clear=e.delete=dd),Object.freeze(e),t&&Object.entries(e).forEach(([r,n])=>no(n,!0))),e}function dd(){oe(2)}function Fr(e){return Object.isFrozen(e)}var ld={};function st(e){const t=ld[e];return t||oe(0,e),t}var Ht;function gi(){return Ht}function ud(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function wo(e,t){t&&(st("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function zn(e){Jn(e),e.drafts_.forEach(pd),e.drafts_=null}function Jn(e){e===Ht&&(Ht=e.parent_)}function yo(e){return Ht=ud(Ht,e)}function pd(e){const t=e[se];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Io(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[se].modified_&&(zn(t),oe(4)),at(e)&&(e=Cr(t,e),t.parent_||Tr(t,e)),t.patches_&&st("Patches").generateReplacementPatches_(r[se].base_,e,t.patches_,t.inversePatches_)):e=Cr(t,r,[]),zn(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==pi?e:void 0}function Cr(e,t,r){if(Fr(t))return t;const n=t[se];if(!n)return Or(t,(o,a)=>vo(e,n,t,o,a,r)),t;if(n.scope_!==e)return t;if(!n.modified_)return Tr(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const o=n.copy_;let a=o,c=!1;n.type_===3&&(a=new Set(o),o.clear(),c=!0),Or(a,(u,p)=>vo(e,n,o,u,p,r,c)),Tr(e,o,!1),r&&e.patches_&&st("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function vo(e,t,r,n,o,a,c){if(process.env.NODE_ENV!=="production"&&o===r&&oe(5),St(o)){const u=a&&t&&t.type_!==3&&!qn(t.assigned_,n)?a.concat(n):void 0,p=Cr(e,o,u);if(hi(r,n,p),St(p))e.canAutoFreeze_=!1;else return}else c&&r.add(o);if(at(o)&&!Fr(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Cr(e,o),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,n)&&Tr(e,o)}}function Tr(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&no(t,r)}function fd(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:gi(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,a=oo;r&&(o=[n],a=Kt);const{revoke:c,proxy:u}=Proxy.revocable(o,a);return n.draft_=u,n.revoke_=c,u}var oo={get(e,t){if(t===se)return e;const r=rt(e);if(!qn(r,t))return hd(e,r,t);const n=r[t];return e.finalized_||!at(n)?n:n===Ln(e.base_,t)?(Mn(e),e.copy_[t]=Kn(n,e)):n},has(e,t){return t in rt(e)},ownKeys(e){return Reflect.ownKeys(rt(e))},set(e,t,r){const n=mi(rt(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const o=Ln(rt(e),t),a=o==null?void 0:o[se];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(cd(r,o)&&(r!==void 0||qn(e.base_,t)))return!0;Mn(e),Hn(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Ln(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Mn(e),Hn(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=rt(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){oe(11)},getPrototypeOf(e){return bt(e.base_)},setPrototypeOf(){oe(12)}},Kt={};Or(oo,(e,t)=>{Kt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Kt.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&oe(13),Kt.set.call(this,e,t,void 0)};Kt.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&oe(14),oo.set.call(this,e[0],t,r,e[0])};function Ln(e,t){const r=e[se];return(r?rt(r):e)[t]}function hd(e,t,r){var o;const n=mi(t,r);return n?"value"in n?n.value:(o=n.get)==null?void 0:o.call(e.draft_):void 0}function mi(e,t){if(!(t in e))return;let r=bt(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=bt(r)}}function Hn(e){e.modified_||(e.modified_=!0,e.parent_&&Hn(e.parent_))}function Mn(e){e.copy_||(e.copy_=Wn(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var gd=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const a=r;r=t;const c=this;return function(p=a,...g){return c.produce(p,m=>r.call(this,m,...g))}}typeof r!="function"&&oe(6),n!==void 0&&typeof n!="function"&&oe(7);let o;if(at(t)){const a=yo(this),c=Kn(t,void 0);let u=!0;try{o=r(c),u=!1}finally{u?zn(a):Jn(a)}return wo(a,n),Io(o,a)}else if(!t||typeof t!="object"){if(o=r(t),o===void 0&&(o=t),o===pi&&(o=void 0),this.autoFreeze_&&no(o,!0),n){const a=[],c=[];st("Patches").generateReplacementPatches_(t,o,a,c),n(a,c)}return o}else oe(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(c,...u)=>this.produceWithPatches(c,p=>t(p,...u));let n,o;return[this.produce(t,r,(c,u)=>{n=c,o=u}),n,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){at(e)||oe(8),St(e)&&(e=md(e));const t=yo(this),r=Kn(e,void 0);return r[se].isManual_=!0,Jn(t),r}finishDraft(e,t){const r=e&&e[se];(!r||!r.isManual_)&&oe(9);const{scope_:n}=r;return wo(n,t),Io(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const o=t[r];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}r>-1&&(t=t.slice(r+1));const n=st("Patches").applyPatches_;return St(e)?n(e,t):this.produce(e,o=>n(o,t))}};function Kn(e,t){const r=kr(e)?st("MapSet").proxyMap_(e,t):Er(e)?st("MapSet").proxySet_(e,t):fd(e,t);return(t?t.scope_:gi()).drafts_.push(r),r}function md(e){return St(e)||oe(10,e),wi(e)}function wi(e){if(!at(e)||Fr(e))return e;const t=e[se];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Wn(e,t.scope_.immer_.useStrictShallowCopy_)}else r=Wn(e,!0);return Or(r,(n,o)=>{hi(r,n,wi(o))}),t&&(t.finalized_=!1),r}var ce=new gd,Wt=ce.produce;ce.produceWithPatches.bind(ce);ce.setAutoFreeze.bind(ce);ce.setUseStrictShallowCopy.bind(ce);ce.applyPatches.bind(ce);ce.createDraft.bind(ce);ce.finishDraft.bind(ce);const yi=I.createContext(void 0),wd={};function io(){const e=I.useContext(yi);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function yd({children:e}){const{installation:t}=Ne(),{hydratedRevision:r,loading:n}=Gt(),[o,a]=I.useState(wd),c=t==null?void 0:t.config;I.useEffect(()=>{r!=null&&r.content&&!n&&c&&!(Object.entries(o).length>0)&&Xc(r,c,a)},[r,n,c,o]);const u=I.useCallback((v,x)=>{a(S=>Wt(S,O=>{O[v]=Wt(O[v],x)}))},[a]),p=I.useCallback((v,x)=>{a(S=>Wt(S,O=>{O[v]=x}))},[a]),g=I.useCallback(()=>{a(Wt(v=>{const x=v.other.write;x&&(x.isWriteModified=!1)}))},[a]),m=I.useCallback(v=>{a(Wt(x=>{var O;const S=(O=x[v])==null?void 0:O.read;S&&(S.isOptionalFieldsModified=!1,S.isRequiredMapFieldsModified=!1)}))},[a]),b=I.useCallback(v=>{v===it?g():m(v)},[m,g]),y=I.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:a,setConfigureState:u,resetConfigureState:p,resetPendingConfigurationState:b}),[o,p,b,u]);return s.jsx(yi.Provider,{value:y,children:e})}const Id=s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[s.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),s.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function vd(e,t){return t?I.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},I.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?Id:s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:s.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}const Ii=I.forwardRef(({objectName:e,completed:t,pending:r,displayName:n},o)=>{const a=w.useTab({ref:o}),c=w.useMultiStyleConfig("Tabs",a);return s.jsxs(w.Button,{__css:c.tab,...a,variant:"outline",minHeight:15,children:[s.jsxs(w.Box,{as:"span",display:"flex",alignItems:"center",gap:2,mr:"3",children:[vd(t,r),s.jsxs(w.Box,{textAlign:"left",children:[s.jsx(w.Text,{children:n||e}),r&&s.jsx(w.Text,{fontSize:10,fontStyle:"italic",children:"pending"})]})]}),a.children]})});function bd({pending:e,completed:t,displayName:r}){return s.jsxs(s.Fragment,{children:[s.jsx(w.Divider,{marginY:3}),s.jsx(Ii,{objectName:it,completed:t,pending:e,displayName:r},"other-write")]})}const vi=I.createContext(null);function bi(){const e=I.useContext(vi);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}function Sd(e,t){return e!=null&&e[t]?e[t]:{name:li,completed:!1}}function xd({children:e}){var O,j,T;const{project:t}=V(),{installation:r,provider:n}=Ne(),{hydratedRevision:o}=Gt(),{objectConfigurationsState:a}=io(),[c,u]=I.useState(0),p=(t==null?void 0:t.appName)||"",g=r==null?void 0:r.config,m=o&&ti(g,o),b=m!==null,y=!!((O=o==null?void 0:o.content)!=null&&O.write),v=y?ri(g):void 0,x=[...m||[]];v&&y&&x.push(v);const S=Sd(x,c);return s.jsx(vi.Provider,{value:S==null?void 0:S.name,children:s.jsxs(w.Box,{p:8,maxWidth:"55rem",border:"1px solid #EFEFEF",borderRadius:6,boxShadow:"md",margin:"auto",bgColor:"whitesmoke",display:"flex",gap:"6",minHeight:"100%",color:"gray.800",fontSize:"md",children:[s.jsxs(w.Box,{width:"20rem",children:[s.jsxs(w.Text,{children:[de(n)," integration"]}),s.jsx(w.Text,{marginBottom:"20px",fontSize:"1.125rem",fontWeight:"500",children:p}),b&&s.jsxs(w.Tabs,{index:c,onChange:u,orientation:"horizontal",children:[m.map(P=>{var L,Z,te,J;return s.jsx(Ii,{objectName:P.name,completed:P.completed,pending:((Z=(L=a[P.name])==null?void 0:L.read)==null?void 0:Z.isOptionalFieldsModified)||((J=(te=a[P.name])==null?void 0:te.read)==null?void 0:J.isRequiredMapFieldsModified)},P.name)}),y&&v&&s.jsx(bd,{completed:v.completed,pending:(T=(j=a==null?void 0:a.other)==null?void 0:j.write)==null?void 0:T.isWriteModified,displayName:m!=null&&m.length?"other":"write"}),r&&s.jsxs(s.Fragment,{children:[s.jsx(w.Divider,{marginTop:10,marginBottom:3}),s.jsx(od,{text:"Uninstall"},"uninstall-installation")]})]})]}),e]})})}const Ot=()=>{const{appName:e}=V(),{objectConfigurationsState:t,setConfigureState:r}=io(),{selectedObjectName:n}=bi(),o=ci(n||"",t);return{appName:e,configureState:o,setConfigureState:r,selectedObjectName:n}};function Od(e,t,r){var o;const n=((o=e==null?void 0:e.read)==null?void 0:o.selectedFieldMappings)||{};if(n[t]=r,e!=null&&e.read){const a=e.read.savedConfig.requiredMapFields,u=!to(a,n);e.read.isRequiredMapFieldsModified=u}}function Si(e,t,r,n){t(e,o=>Od(o,r,n))}function Cd({field:e,onSelectChange:t,allFields:r}){var b;const{configureState:n,selectedObjectName:o,setConfigureState:a}=Ot(),[c,u]=I.useState(!0),p=(b=n==null?void 0:n.read)==null?void 0:b.selectedFieldMappings,g=p==null?void 0:p[e.mapToName];I.useEffect(()=>{e._default&&!g&&o&&n&&Si(o,a,e.mapToName,e._default),u(!1)},[e,a,o,g,n]);const m=I.useMemo(()=>r==null?void 0:r.map(y=>s.jsx("option",{value:y.fieldName,children:y.displayName},y.fieldName)),[r]);return s.jsxs(w.Stack,{children:[s.jsx(w.Text,{fontWeight:"500",children:e.mapToDisplayName}),s.jsx(w.Text,{marginBottom:"5px",fontSize:14,children:e==null?void 0:e.prompt}),s.jsx(w.Select,{name:e.mapToName,variant:"flushed",value:g||void 0,onChange:t,placeholder:g?void 0:"Please select one",disabled:c,children:m})]},e.mapToName)}function Pr({string:e}){return s.jsxs(w.Flex,{position:"relative",paddingTop:8,paddingBottom:4,children:[s.jsx(w.Heading,{color:"gray.500",as:"h3",fontSize:16,fontWeight:"500",children:e}),s.jsx(w.Flex,{flex:"1",justifyContent:"flex-end",alignItems:"center",children:s.jsx(w.Divider,{marginLeft:2})})]})}function Td(){const{selectedObjectName:e,configureState:t,setConfigureState:r}=Ot(),{isError:n,removeError:o}=Je(),a=u=>{const{value:p,name:g}=u.target;p&&(e&&Si(e,r,g,p),n(G.MAPPING,g)&&o(G.MAPPING,g))},c=I.useMemo(()=>{var u,p;return((p=(u=t==null?void 0:t.read)==null?void 0:u.requiredMapFields)==null?void 0:p.filter(ze))||[]},[t]);return c.length?s.jsxs(w.Box,{children:[s.jsx(Pr,{string:"Map the following fields (required)"}),s.jsx(w.Stack,{children:c.map(u=>{var p;return s.jsxs(w.FormControl,{isInvalid:n(G.MAPPING,u.mapToName),children:[s.jsx(Cd,{allFields:((p=t.read)==null?void 0:p.allFields)||[],field:u,onSelectChange:a}),s.jsx(w.FormErrorMessage,{children:" * required"})]},u.mapToName)})})]}):null}function Nd(e,t,r){var o,a;const n=((o=e==null?void 0:e.read)==null?void 0:o.selectedOptionalFields)||{};if(n[t]=r,r||delete n[t],(a=e.read)!=null&&a.savedConfig.optionalFields){const c=e.read.savedConfig.optionalFields,p=!to(c,n);e.read.isOptionalFieldsModified=p}else console.warn("read.savedConfig.optionalFields is undefined")}function bo(e,t,r,n){t(e,o=>Nd(o,r,n))}function Rd(){var b,y;const{appName:e,configureState:t,setConfigureState:r,selectedObjectName:n}=Ot(),o=(b=t==null?void 0:t.read)==null?void 0:b.selectedOptionalFields,a=v=>{const{name:x,checked:S}=v.target;n&&t&&bo(n,r,x,S)},c=(y=t==null?void 0:t.read)==null?void 0:y.optionalFields,u=v=>{const{checked:x}=v.target;n&&c&&c.forEach(S=>{ze(S)||bo(n,r,S.fieldName,x)})},p=!!(c&&c.length>0),g=Object.keys(o||{}).length===(c==null?void 0:c.length),m=!g&&Object.keys(o||{}).length>0;return p&&s.jsxs(s.Fragment,{children:[s.jsx(Pr,{string:`${e} reads the following optional fields`}),s.jsxs(w.Stack,{marginBottom:10,maxHeight:300,overflowY:"scroll",border:"2px solid #EFEFEF",borderRadius:8,gap:0,children:[((c==null?void 0:c.length)||0)>=2&&s.jsx(w.Box,{backgroundColor:"gray.50",paddingX:4,paddingY:2,children:s.jsx(w.Checkbox,{name:"selectAll",id:"selectAll",onChange:u,isIndeterminate:m,isChecked:g,children:"Select all"})}),c.map(v=>ze(v)?null:s.jsx(w.Box,{paddingX:4,paddingY:2,borderBottom:"1px",borderColor:"gray.100",children:s.jsx(w.Checkbox,{name:v.fieldName,id:v.fieldName,isChecked:!!(o!=null&&o[v==null?void 0:v.fieldName]),onChange:a,children:v.displayName})},v.fieldName))]})]})}function _d(){var n,o,a;const{configureState:e,selectedObjectName:t}=Ot(),{appName:r}=V();return s.jsxs(s.Fragment,{children:[s.jsx(Pr,{string:`${r} reads the following ${t} fields`}),s.jsx(w.Box,{marginBottom:"20px",display:"flex",gap:1,children:(o=(n=e==null?void 0:e.read)==null?void 0:n.requiredFields)!=null&&o.length?(a=e.read)==null?void 0:a.requiredFields.map(c=>ze(c)?null:s.jsx(w.Tag,{children:c.displayName},c.fieldName)):"There are no required fields."})]})}function jd(){return s.jsxs(s.Fragment,{children:[s.jsx(_d,{}),s.jsx(Td,{}),s.jsx(Rd,{})]})}function Ad(e,t,r){var n,o,a;if(((n=e==null?void 0:e.write)==null?void 0:n.selectedNonConfigurableWriteFields)===null&&(e.write.selectedNonConfigurableWriteFields={}),e!=null&&e.write){const c=e.write.selectedNonConfigurableWriteFields;if(c[t]=r,r||delete c[t],(a=(o=e==null?void 0:e.write)==null?void 0:o.savedConfig)!=null&&a.selectedNonConfigurableWriteFields){const u=e.write.savedConfig.selectedNonConfigurableWriteFields,g=!to(u,c);e.write.isWriteModified=g}}}function So(e,t,r,n){t(e,o=>{Ad(o,r,n)})}function kd(){var b,y,v,x;const{appName:e,selectedObjectName:t,configureState:r,setConfigureState:n}=Ot(),o=(b=r==null?void 0:r.write)==null?void 0:b.selectedNonConfigurableWriteFields,a=(y=r==null?void 0:r.write)==null?void 0:y.writeObjects,c=S=>{const{name:O,checked:j}=S.target;t&&r&&So(t,n,O,j)},u=S=>{var j,T;const{checked:O}=S.target;t&&r&&((T=(j=r==null?void 0:r.write)==null?void 0:j.writeObjects)==null||T.forEach(P=>{So(t,n,P.objectName,O)}))},p=!!a,g=Object.keys(o||{}).length===((x=(v=r==null?void 0:r.write)==null?void 0:v.writeObjects)==null?void 0:x.length),m=!g&&Object.keys(o||{}).length>0;return p&&s.jsxs(s.Fragment,{children:[s.jsx(Pr,{string:`Allow ${e} to write to these object`}),s.jsxs(w.Stack,{marginBottom:10,maxHeight:300,overflowY:"scroll",border:"2px solid #EFEFEF",borderRadius:8,gap:0,children:[((a==null?void 0:a.length)||0)>=2&&s.jsx(w.Box,{backgroundColor:"gray.50",paddingX:4,paddingY:2,children:s.jsx(w.Checkbox,{name:"selectAll",id:"selectAll",onChange:u,isIndeterminate:m,isChecked:g,children:"Select all"})}),a.map(S=>s.jsx(w.Box,{display:"flex",alignItems:"center",borderBottom:"1px",borderColor:"gray.100",paddingX:4,paddingY:2,children:s.jsx(w.Checkbox,{name:S.objectName,id:S.objectName,onChange:c,isChecked:!!(o!=null&&o[S.objectName]),children:S.displayName})},S.objectName))]})]})}function Ed(){const e=X(),{projectId:t,appName:r}=V(),{integrationId:n,installation:o,resetInstallations:a}=Ne(),[c,u]=I.useState(!1),p=!t||!n||!(o!=null&&o.id)||c,g=async()=>{if(!p){u(!0),console.warn("uninstalling installation",{projectId:t,integrationId:n,installationId:o.id});try{await H().installationApi.deleteInstallation({projectIdOrName:t,integrationId:n,installationId:o.id},{headers:{"X-Api-Key":e,"Content-Type":"application/json"}}),a(),console.warn("successfully uninstalled installation: ",o.id)}catch(y){console.error("error uninstalling installation",y)}finally{u(!1)}}},m=c?"Uninstalling...":"Yes, uninstall",b=o!=null&&o.id?`Once you uninstall this integration, all your configuration will be lost, and "${r}" may stop working.`:"You've successfully uninstalled the integration.";return s.jsxs(w.Stack,{children:[s.jsx(w.Text,{paddingBottom:3,children:b}),(o==null?void 0:o.id)&&s.jsx(w.Button,{onClick:g,variant:"warning",isDisabled:p,children:m})]})}function xi({onSave:e,onReset:t,isLoading:r,isCreateMode:n=!1}){var P,L,Z;const{installation:o}=Ne(),{hydratedRevision:a,loading:c}=Gt(),{configureState:u,selectedObjectName:p}=Ot(),g=o==null?void 0:o.config,m=g&&p&&!!ei(g,p)||!1,b=((P=u==null?void 0:u.read)==null?void 0:P.isOptionalFieldsModified)||((L=u==null?void 0:u.read)==null?void 0:L.isRequiredMapFieldsModified),y=(Z=u==null?void 0:u.write)==null?void 0:Z.isWriteModified,O=c||r||!u||!p||!(b||y||n||p!==it&&!m),j=p===it,T=p===li;return r?s.jsx(Te,{}):s.jsxs("form",{style:{width:"100%",maxWidth:"50rem"},onSubmit:e,children:[s.jsxs(w.Stack,{direction:"row",spacing:4,marginBottom:"20px",flexDir:"row-reverse",children:[s.jsx(w.Button,{backgroundColor:"gray.800",_hover:{backgroundColor:"gray.600"},type:"submit",isDisabled:O,children:n?"Install":"Save"}),s.jsx(w.Button,{backgroundColor:"gray.200",color:"blackAlpha.700",_hover:{backgroundColor:"gray.300"},isDisabled:O,onClick:t,children:"Reset"})]}),s.jsxs(w.Box,{p:8,width:"100%",border:"1px solid #EFEFEF",borderRadius:8,boxShadow:"md",textAlign:["left"],margin:"auto",bgColor:"white",maxHeight:"100%",overflowY:"scroll",minHeight:300,children:[c&&s.jsx(Te,{}),a&&!T&&!j&&s.jsx(jd,{}),a&&!T&&j&&s.jsx(kd,{}),!c&&T&&s.jsx(Ed,{})]})]})}const Oi=()=>{const{integrationId:e,groupRef:t,consumerRef:r,setInstallation:n,onInstallSuccess:o,onUpdateSuccess:a}=Ne(),{hydratedRevision:c,loading:u}=Gt(),{selectedObjectName:p}=bi(),{selectedConnection:g}=xt(),m=X(),{projectId:b}=V(),{resetBoundary:y,setErrors:v}=Je(),{resetConfigureState:x,objectConfigurationsState:S,resetPendingConfigurationState:O}=io(),j=ci(p||"",S);return{integrationId:e,groupRef:t,consumerRef:r,setInstallation:n,hydratedRevision:c,loading:u,selectedObjectName:p,selectedConnection:g,apiKey:m,projectId:b,resetBoundary:y,setErrors:v,resetConfigureState:x,objectConfigurationsState:S,resetPendingConfigurationState:O,configureState:j,onInstallSuccess:o,onUpdateSuccess:a}},Fd=void 0;function Pd(){const{integrationId:e,groupRef:t,consumerRef:r,setInstallation:n,hydratedRevision:o,loading:a,selectedObjectName:c,selectedConnection:u,apiKey:p,projectId:g,resetBoundary:m,setErrors:b,resetConfigureState:y,objectConfigurationsState:v,resetPendingConfigurationState:x,configureState:S,onInstallSuccess:O}=Oi(),[j,T]=I.useState(!1),P=c===it,L=I.useCallback(()=>{m(G.MAPPING),o!=null&&o.content&&!a&&c&&ii(o,Fd,c,y)},[m,o,a,c,y]);I.useEffect(()=>{!S&&(o!=null&&o.content)&&!a&&L()},[S,v,o,a,L]);const Z=()=>{const{requiredMapFields:ie,selectedFieldMappings:be}=(S==null?void 0:S.read)||{},{errorList:he}=ni(ie,be,b);he.length>0||(c&&(u!=null&&u.id)&&p&&g&&e&&t&&r&&o?(T(!0),Qc(g,e,t,r,u.id,c,p,o,S,n,O).finally(()=>{T(!1),x(c)})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},te=()=>{c&&(u!=null&&u.id)&&p&&g&&e&&t&&r&&o?(T(!0),rd(g,e,t,r,u.id,p,o,S,n,O).finally(()=>{T(!1),x(c)})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},J=ie=>{ie.preventDefault(),P?te():Z()};return s.jsx(xi,{isCreateMode:!0,isLoading:j,onSave:J,onReset:L})}function Dd({updateConfig:e,projectId:t,integrationId:r,installationId:n,apiKey:o,selectedObjectName:a,setInstallation:c,onUpdateSuccess:u}){const p={projectIdOrName:t,installationId:n,integrationId:r,installationUpdate:{updateMask:[`config.content.read.objects.${a}`],installation:{config:e}}};return H().installationApi.updateInstallation(p,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(g=>{c(g),u==null||u(g.id,g.config)}).catch(g=>{console.error("ERROR: ",g)})}const Bd=(e,t,r,n,o)=>{const a=ai(e),c=si(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:n,destination:(r==null?void 0:r.destination)||"",selectedFields:a,selectedFieldMappings:c}}}}};return jr(o)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},Ld=(e,t,r,n,o,a,c,u,p,g)=>{const m=Bd(a,n||"",u,u.schedule,p);return m?Dd({updateConfig:m,projectId:e,integrationId:t,installationId:r,apiKey:o,selectedObjectName:n,setInstallation:c,onUpdateSuccess:g}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},Md=(e,t)=>{const n={content:{write:{objects:di(e)}}};return jr(t)&&(n.content||(n.content={}),n.content.proxy={enabled:!0}),n},$d=(e,t,r,n,o,a,c,u)=>{const p=Md(o,a);if(!p)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const g={projectIdOrName:e,installationId:r,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:p}}};return H().installationApi.updateInstallation(g,{headers:{"X-Api-Key":n,"Content-Type":"application/json"}}).then(m=>{c(m),u==null||u(m.id,m.config)}).catch(m=>{console.error("ERROR: ",m)})};function Ud({installation:e,integrationObj:t}){const{setInstallation:r,hydratedRevision:n,loading:o,selectedObjectName:a,apiKey:c,projectId:u,resetBoundary:p,setErrors:g,resetConfigureState:m,resetPendingConfigurationState:b,configureState:y,onUpdateSuccess:v}=Oi(),[x,S]=I.useState(!1),O=a===it,{config:j}=e,T=I.useCallback(()=>{p(G.MAPPING),n!=null&&n.content&&!o&&a&&ii(n,j,a,m)},[p,n,o,a,j,m]);I.useEffect(()=>{y||T()},[y,T]),I.useEffect(()=>{e&&T()},[e,T]);const P=I.useMemo(()=>{var ie,be,he;return(he=(be=(ie=n==null?void 0:n.content)==null?void 0:ie.read)==null?void 0:be.objects)==null?void 0:he.find(Re=>(Re==null?void 0:Re.objectName)===a)},[n,a]),L=()=>{const{requiredMapFields:J,selectedFieldMappings:ie}=(y==null?void 0:y.read)||{},{errorList:be}=ni(J,ie,g);be.length>0||(n&&e&&a&&c&&u&&P?(S(!0),Ld(u,t.id,e.id,a,c,y,r,P,n,v).finally(()=>{S(!1),b(a)})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},Z=()=>{e&&a&&c&&u&&n?(S(!0),$d(u,t.id,e.id,c,y,n,r,v).finally(()=>{S(!1),b(a)})):console.error("UpdateInstallation - onSaveUpdate missing required props")},te=J=>{J.preventDefault(),O?Z():L()};return s.jsx(xi,{onSave:te,onReset:T,isLoading:x})}function qd(){const{integrationObj:e,installation:t}=Ne();return e?t&&e?s.jsx(Ud,{installation:t,integrationObj:e}):s.jsx(Pd,{}):s.jsx(Pe,{message:"We can't load the integration"})}const Wd=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function zd({projectId:e,integrationId:t,groupRef:r,consumerRef:n,connectionId:o,apiKey:a,hydratedRevision:c,setInstallation:u,onInstallSuccess:p}){const g=Wd(c,n);return g?ro({createConfig:g,projectId:e,integrationId:t,groupRef:r,connectionId:o,apiKey:a,setInstallation:u,onInstallSuccess:p}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function Jd(){return s.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),s.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ci({text:e}){return s.jsx(w.Container,{children:s.jsxs(w.Box,{p:8,maxWidth:"600px",minHeight:"290px",borderWidth:1,borderRadius:8,boxShadow:"lg",margin:"auto",marginTop:"40px",bgColor:"white",paddingTop:"100px",color:"gray.800",fontSize:"md",children:[s.jsx(w.Box,{width:"100%",display:"flex",alignContent:"center",justifyContent:"center",children:s.jsx(w.Box,{margin:"auto",children:s.jsx(Jd,{})})}),s.jsx(w.Box,{textAlign:"center",paddingTop:"25px",children:e})]})})}function Hd({provider:e}){const t=`You have successfully installed your ${de(e)} integration.`;return s.jsx(Ci,{text:t})}const Kd=e=>{const{read:t,write:r,proxy:n}=(e==null?void 0:e.content)??{};return!t&&!r&&(n==null?void 0:n.enabled)||!1};function Gd({children:e}){var O;const{projectId:t}=V(),r=X(),{hydratedRevision:n,loading:o}=Gt(),{integrationObj:a,installation:c,groupRef:u,consumerRef:p,setInstallation:g}=Ne(),{selectedConnection:m}=xt(),[b,y]=I.useState(!1),v=o||b,x=(O=n==null?void 0:n.content)==null?void 0:O.provider,S=Kd(n);return I.useEffect(()=>{!v&&n&&S&&!c&&m&&r&&(a!=null&&a.id)&&(y(!0),zd({apiKey:r,projectId:t,integrationId:a==null?void 0:a.id,groupRef:u,consumerRef:p,connectionId:m==null?void 0:m.id,hydratedRevision:n,setInstallation:g}).then(()=>{y(!1)}).catch(j=>{y(!1),console.error("Error when creating proxy installation:",j)}))},[n,S,c,m,r,t,a==null?void 0:a.id,u,p,g,v]),a?v?s.jsx(Te,{}):S&&x&&c?s.jsx(Hd,{provider:x}):s.jsx("div",{children:e}):s.jsx(Pe,{message:"We can't load the integration"})}function Vd({children:e}){return s.jsx(w.Container,{children:s.jsx(w.Box,{p:8,maxWidth:"600px",borderWidth:1,borderRadius:8,boxShadow:"lg",textAlign:["left"],margin:"auto",marginTop:"40px",bgColor:"white",color:"gray.800",fontSize:"md",children:e})})}function Xd({error:e}){return e?s.jsxs(w.Alert,{status:"error",marginTop:"2em",children:[s.jsx(w.AlertIcon,{}),s.jsx(w.AlertDescription,{children:e})]}):null}function Yd({provider:e,handleSubmit:t,error:r,isButtonDisabled:n}){const[o,a]=I.useState(!1),c=()=>a(!o),[u,p]=I.useState(""),g=y=>p(y.currentTarget.value),m=u.length>0,b=n||!m;return s.jsx(Vd,{children:s.jsxs(w.FormControl,{children:[s.jsx(w.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsx(w.Heading,{as:"h4",size:"md",children:`Set up ${de(e)} integration`})}),s.jsx(Xd,{error:r}),s.jsx("br",{}),s.jsx(w.Stack,{spacing:4,children:s.jsxs(w.InputGroup,{size:"md",children:[s.jsx(w.Input,{onChange:g,pr:"4.5rem",type:o?"text":"password",placeholder:"API Key"}),s.jsx(w.InputRightElement,{width:"4.5rem",children:s.jsx(w.Button,{h:"1.75rem",size:"sm",onClick:c,children:o?"Hide":"Show"})})]})}),s.jsx("br",{}),s.jsx(w.Button,{isDisabled:b,width:"100%",type:"submit",onClick:()=>{t(u)},children:"Next"})]})})}function Zd({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:o,children:a,selectedConnection:c,setSelectedConnection:u}){const p=V(),[g,m]=I.useState(!1),[b,y]=I.useState(null),v=X();I.useEffect(()=>{if(e&&H&&g&&b!=null){const S={projectId:p.projectId,groupName:o,groupRef:n,consumerName:r,consumerRef:t,provider:e,apiKey:b};H().connectionApi.generateConnection({projectIdOrName:p.projectId,generateConnectionParams:S},{headers:{"X-Api-Key":v??"","Content-Type":"application/json"}}).then(O=>{u(O)}).catch(O=>{console.error("Error loading provider info: ",O)})}},[v,e,g,r,t,o,n,p,u,b]);const x=S=>{y(S),m(!0)};return c===null?s.jsx(Yd,{provider:e,handleSubmit:x,error:null}):a}function Qd({children:e}){return s.jsx(w.Container,{children:s.jsx(w.Box,{p:8,maxWidth:"600px",borderWidth:1,borderRadius:8,boxShadow:"lg",textAlign:["left"],margin:"auto",marginTop:"40px",bgColor:"white",color:"gray.800",fontSize:"md",children:e})})}function el({error:e}){return e?s.jsxs(w.Alert,{status:"error",marginTop:"2em",children:[s.jsx(w.AlertIcon,{}),s.jsx(w.AlertDescription,{children:e})]}):null}function tl({provider:e,handleSubmit:t,error:r,isButtonDisabled:n}){const[o,a]=I.useState(!1),c=()=>a(!o),[u,p]=I.useState(""),[g,m]=I.useState(""),b=S=>p(S.currentTarget.value),y=S=>m(S.currentTarget.value),v=u.length>0,x=n||!v;return s.jsx(Qd,{children:s.jsxs(w.FormControl,{children:[s.jsx(w.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsx(w.Heading,{as:"h4",size:"md",children:`Set up ${de(e)} integration`})}),s.jsx(el,{error:r}),s.jsx("br",{}),s.jsxs(w.Stack,{spacing:4,children:[s.jsx(w.Input,{placeholder:"Username",onChange:b}),s.jsxs(w.InputGroup,{size:"md",children:[s.jsx(w.Input,{onChange:y,pr:"4.5rem",type:o?"text":"password",placeholder:"Password"}),s.jsx(w.InputRightElement,{width:"4.5rem",children:s.jsx(w.Button,{h:"1.75rem",size:"sm",onClick:c,children:o?"Hide":"Show"})})]})]}),s.jsx("br",{}),s.jsx(w.Button,{isDisabled:x,width:"100%",type:"submit",onClick:()=>{t(u,g)},children:"Next"})]})})}function rl({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:o,children:a,selectedConnection:c,setSelectedConnection:u}){const p=V(),[g,m]=I.useState(!1),[b,y]=I.useState(null),v=X();I.useEffect(()=>{if(e&&H&&g&&b!=null){const S={projectId:p.projectId,groupName:o,groupRef:n,consumerName:r,consumerRef:t,provider:e,basicAuth:{username:b.user,password:b.pass}};H().connectionApi.generateConnection({projectIdOrName:p.projectId,generateConnectionParams:S},{headers:{"X-Api-Key":v??"","Content-Type":"application/json"}}).then(O=>{u(O)}).catch(O=>{console.error("Error loading provider info: ",O)})}},[v,e,g,r,t,o,n,p,b,u]);const x=(S,O)=>{y({user:S,pass:O}),m(!0)};return c===null?s.jsx(tl,{provider:e,handleSubmit:x,error:null}):a}function nl(e){const{selectedConnection:t}=xt();I.useEffect(()=>{e&&t&&e(t.id)},[e,t])}function ol({onSuccess:e}){nl(e)}function il({children:e}){return s.jsx(w.Container,{children:s.jsx(w.Box,{p:8,maxWidth:"600px",borderWidth:1,borderRadius:8,boxShadow:"lg",textAlign:["left"],margin:"auto",marginTop:"40px",bgColor:"white",color:"gray.800",fontSize:"md",children:e})})}function al({error:e}){return e?s.jsxs(w.Alert,{status:"error",marginTop:"2em",children:[s.jsx(w.AlertIcon,{}),s.jsx(w.AlertDescription,{children:e})]}):null}function sl({provider:e,handleSubmit:t,error:r,isButtonDisabled:n}){return s.jsx(il,{children:s.jsxs(w.FormControl,{children:[s.jsx(w.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsx(w.Heading,{as:"h4",size:"md",children:`Set up ${de(e)} integration`})}),s.jsx(al,{error:r}),s.jsx("br",{}),s.jsx(w.Button,{isDisabled:n,width:"100%",type:"submit",onClick:t,children:"Next"})]})})}function cl({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:o,children:a,selectedConnection:c,setSelectedConnection:u}){const p=V(),g=X(),[m,b]=I.useState(!1);I.useEffect(()=>{if(e&&H&&m){const v={projectId:p.projectId,groupName:o,groupRef:n,consumerName:r,consumerRef:t,provider:e};H().connectionApi.generateConnection({projectIdOrName:p.projectId,generateConnectionParams:v},{headers:{"X-Api-Key":g??"","Content-Type":"application/json"}}).then(x=>{u(x)}).catch(x=>{console.error("Error loading provider info: ",x)})}},[g,e,m,r,t,o,n,u,p]);const y=()=>{b(!0)};return c===null?s.jsx(sl,{provider:e,handleSubmit:y,error:null}):a}function Vt({children:e}){return s.jsx(w.Container,{children:s.jsx(w.Box,{p:8,maxWidth:"600px",borderWidth:1,borderRadius:8,boxShadow:"lg",textAlign:["left"],margin:"auto",marginTop:"40px",bgColor:"white",color:"gray.800",fontSize:"md",children:e})})}function Xt({error:e}){return e?s.jsxs(w.Alert,{status:"error",marginTop:"2em",children:[s.jsx(w.AlertIcon,{}),s.jsx(w.AlertDescription,{children:e})]}):null}function dl({provider:e,handleSubmit:t,error:r,isButtonDisabled:n}){const[o,a]=I.useState(!1),[c,u]=I.useState(""),[p,g]=I.useState(""),m=()=>a(!o),b=O=>u(O.currentTarget.value),y=O=>g(O.currentTarget.value),v=c.length>0,x=p.length>0,S=n||!v||!x;return s.jsx(Vt,{children:s.jsxs(w.FormControl,{children:[s.jsx(w.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsx(w.Heading,{as:"h4",size:"md",children:`Set up ${de(e)} integration`})}),s.jsx(Xt,{error:r}),s.jsx("br",{}),s.jsxs(w.Stack,{spacing:4,children:[s.jsx(w.Input,{placeholder:"Client ID",onChange:y}),s.jsxs(w.InputGroup,{size:"md",children:[s.jsx(w.Input,{onChange:b,pr:"4.5rem",type:o?"text":"password",placeholder:"Client Secret"}),s.jsx(w.InputRightElement,{width:"4.5rem",children:s.jsx(w.Button,{h:"1.75rem",size:"sm",onClick:m,children:o?"Hide":"Show"})})]})]}),s.jsx("br",{}),s.jsx(w.Button,{isDisabled:S,width:"100%",type:"submit",onClick:()=>{t({clientId:p,clientSecret:c})},children:"Next"})]})})}function ll({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:o,selectedConnection:a,setSelectedConnection:c}){const{projectId:u}=V(),p=X(),[g,m]=I.useState(null),b=async y=>{m(null);const v={projectId:u,groupName:o,groupRef:n,consumerName:r,consumerRef:t,provider:e,oauth2ClientCredentials:{clientId:y.clientId,clientSecret:y.clientSecret}};H().connectionApi.generateConnection({projectIdOrName:u,generateConnectionParams:v},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(x=>{c(x)}).catch(x=>{console.error("Error loading provider info: ",x),m("Error loading provider info")})};return a===null?s.jsx(dl,{provider:e,handleSubmit:b,error:g}):s.jsx(Te,{})}const Ti=async(e,t,r,n,o,a,c,u)=>{var g;const p=await H().providerApi.getProvider({provider:o},{headers:{"X-Api-Key":n??""}});if(!p)throw new Error(`Provider ${o} not found`);if(p.authType==="oauth2"&&((g=p.oauth2Opts)==null?void 0:g.grantType)==="authorizationCode"){const b=(await H().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":n??""}})).find(x=>x.provider===o);if(!b)throw new Error(`You must first set up a ${de(o)} Provider App using the Ampersand Console.`);const y={connectOAuthParams:{providerWorkspaceRef:a,projectId:e,groupRef:r,groupName:u,consumerRef:t,consumerName:c,providerAppId:b.id,provider:o}};return await H().oAuthApi.oauthConnect(y)}throw new Error(`Provider ${o} does not support an OAuth2 web flow.`)},xo=600,Oo=600,ul="AUTHORIZATION_SUCCEEDED",pl="AUTHORIZATION_FAILED";function fl(e,t,r){return I.useCallback(async n=>{const o=await H().connectionApi.getConnection({projectIdOrName:e,connectionId:n},{headers:{"X-Api-Key":t??""}});r(o)},[e,t,r])}function hl(e,t,r,n){return I.useCallback(()=>{if(!n)return;const o=window.screenX+(window.outerWidth-xo)/2,a=window.screenY+(window.outerHeight-Oo)/2.5,c=`width=${xo},height=${Oo},left=${o},top=${a}`,u=window.open(n,e,c);t(u),window.addEventListener("message",r,!1)},[n,e,t,r])}function gl(e){return I.useCallback(t=>{var r;if(t.origin===jc){if(t.data.eventType===ul){const n=(r=t.data.data)==null?void 0:r.connection;n?e(n):console.error("Connection ID not found in event data: ",{event:t})}t.data.eventType===pl&&console.error("OAuth failed: ",{event:t})}},[e])}function Ni({children:e,oauthUrl:t,windowTitle:r="Connect to Provider",onClose:n}){const o=X(),{projectId:a}=V(),[c,u]=I.useState(null),[p,g]=I.useState(null),{setSelectedConnection:m}=xt(),b=gl(u),y=hl(r,g,b,t),v=fl(a,o,m);I.useEffect(()=>{t&&!p&&y()},[t,p,y,b,r]),I.useEffect(()=>{c&&v(c).then(()=>{p==null||p.close()}).catch(S=>{console.error("Error refreshing connection: ",S),n(S.message??"Unexpected error: not able to refresh connection")})},[c,o,m,v,p,n]);const x=p&&setInterval(()=>{(p!=null&&p.closed||!p)&&x&&(clearInterval(x),window.removeEventListener("message",b),g(null),c?c&&n&&n(null):(console.error("OAuth failed. Please try again."),n&&n("OAuth failed. Please try again.")))},500);return s.jsx("div",{children:e})}function ml({provider:e,handleSubmit:t,error:r,isButtonDisabled:n}){return s.jsx(Vt,{children:s.jsxs(w.FormControl,{children:[s.jsx(w.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsx(w.Heading,{as:"h4",size:"md",children:`Set up ${de(e)} integration`})}),s.jsx(Xt,{error:r}),s.jsx("br",{}),s.jsx(w.Button,{isDisabled:n,width:"100%",type:"submit",onClick:t,children:"Next"})]})})}function wl({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:o}){const{projectId:a}=V(),c=X(),[u,p]=I.useState(null),[g,m]=I.useState(null),b=async()=>{m(null);try{const v=await Ti(a,t,n,c,e,void 0,r,o);p(v)}catch(v){console.error("Could not fetch OAuth popup URL",{err:v}),m(v.message??"Unexpected error")}},y=I.useCallback(v=>{m(v),p(null)},[]);return s.jsx(Ni,{windowTitle:`Connect to ${de(e)}`,oauthUrl:u,onClose:y,children:s.jsx(ml,{provider:e,handleSubmit:b,error:g})})}function yl({provider:e,handleSubmit:t,error:r,isButtonDisabled:n}){const[o,a]=I.useState(!1),[c,u]=I.useState(""),[p,g]=I.useState(""),[m,b]=I.useState(""),y=()=>a(!o),v=L=>u(L.currentTarget.value),x=L=>g(L.currentTarget.value),S=L=>b(L.currentTarget.value),O=c.length>0,j=p.length>0,T=m.length>0,P=n||!O||!j||!T;return s.jsx(Vt,{children:s.jsxs(w.FormControl,{children:[s.jsx(w.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsx(w.Heading,{as:"h4",size:"md",children:`Set up ${de(e)} integration`})}),s.jsx(Xt,{error:r}),s.jsx("br",{}),s.jsxs(w.Stack,{spacing:4,children:[s.jsx(w.Input,{placeholder:"MyWorkspace",onChange:S}),s.jsx(w.Input,{placeholder:"Client ID",onChange:x}),s.jsxs(w.InputGroup,{size:"md",children:[s.jsx(w.Input,{onChange:v,pr:"4.5rem",type:o?"text":"password",placeholder:"Client Secret"}),s.jsx(w.InputRightElement,{width:"4.5rem",children:s.jsx(w.Button,{h:"1.75rem",size:"sm",onClick:y,children:o?"Hide":"Show"})})]})]}),s.jsx("br",{}),s.jsx(w.Button,{isDisabled:P,width:"100%",type:"submit",onClick:()=>{t({workspace:m,clientId:p,clientSecret:c})},children:"Next"})]})})}function Il({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:o,selectedConnection:a,setSelectedConnection:c}){const{projectId:u}=V(),p=X(),[g,m]=I.useState(null),b=async y=>{m(null);const v={projectId:u,groupName:o,groupRef:n,consumerName:r,consumerRef:t,provider:e,providerWorkspaceRef:y.workspace,oauth2ClientCredentials:{clientId:y.clientId,clientSecret:y.clientSecret}};H().connectionApi.generateConnection({projectIdOrName:u,generateConnectionParams:v},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(x=>{c(x)}).catch(x=>{console.error("Error loading provider info: ",x),m("Error loading provider info")})};return a===null?s.jsx(yl,{provider:e,handleSubmit:b,error:g}):s.jsx(Te,{})}function vl(){const e=I.useContext(Mi.ThemeContext);if(!e)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `<ChakraProvider />` or `<ThemeProvider />`");return e}var Ri=I.createContext({});Ri.displayName="ColorModeContext";function _i(){const e=I.useContext(Ri);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function bl(){const e=_i(),t=vl();return{...e,theme:t}}var Sl=(...e)=>e.filter(Boolean).join(" ");function ot(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}function nt(e,...t){return xl(e)?e(...t):e}var xl=e=>typeof e=="function",Nr={exports:{}};Nr.exports;(function(e,t){var r=200,n="__lodash_hash_undefined__",o=800,a=16,c=9007199254740991,u="[object Arguments]",p="[object Array]",g="[object AsyncFunction]",m="[object Boolean]",b="[object Date]",y="[object Error]",v="[object Function]",x="[object GeneratorFunction]",S="[object Map]",O="[object Number]",j="[object Null]",T="[object Object]",P="[object Proxy]",L="[object RegExp]",Z="[object Set]",te="[object String]",J="[object Undefined]",ie="[object WeakMap]",be="[object ArrayBuffer]",he="[object DataView]",Re="[object Float32Array]",ct="[object Float64Array]",Br="[object Int8Array]",Lr="[object Int16Array]",Mr="[object Int32Array]",$r="[object Uint8Array]",Ur="[object Uint8ClampedArray]",qr="[object Uint16Array]",Wr="[object Uint32Array]",zr=/[\\^$.*+?()[\]{}|]/g,Jr=/^\[object .+?Constructor\]$/,Hr=/^(?:0|[1-9]\d*)$/,$={};$[Re]=$[ct]=$[Br]=$[Lr]=$[Mr]=$[$r]=$[Ur]=$[qr]=$[Wr]=!0,$[u]=$[p]=$[be]=$[m]=$[he]=$[b]=$[y]=$[v]=$[S]=$[O]=$[T]=$[L]=$[Z]=$[te]=$[ie]=!1;var Yt=typeof We=="object"&&We&&We.Object===Object&&We,U=typeof self=="object"&&self&&self.Object===Object&&self,Be=Yt||U||Function("return this")(),Zt=t&&!t.nodeType&&t,re=Zt&&!0&&e&&!e.nodeType&&e,Ct=re&&re.exports===Zt,dt=Ct&&Yt.process,Tt=function(){try{var i=re&&re.require&&re.require("util").types;return i||dt&&dt.binding&&dt.binding("util")}catch{}}(),lt=Tt&&Tt.isTypedArray;function Qt(i,d,f){switch(f.length){case 0:return i.call(d);case 1:return i.call(d,f[0]);case 2:return i.call(d,f[0],f[1]);case 3:return i.call(d,f[0],f[1],f[2])}return i.apply(d,f)}function er(i,d){for(var f=-1,C=Array(i);++f<i;)C[f]=d(f);return C}function Kr(i){return function(d){return i(d)}}function Gr(i,d){return i==null?void 0:i[d]}function Vr(i,d){return function(f){return i(d(f))}}var Xr=Array.prototype,Yr=Function.prototype,ut=Object.prototype,Nt=Be["__core-js_shared__"],pt=Yr.toString,Se=ut.hasOwnProperty,tr=function(){var i=/[^.]+$/.exec(Nt&&Nt.keys&&Nt.keys.IE_PROTO||"");return i?"Symbol(src)_1."+i:""}(),rr=ut.toString,Zr=pt.call(Object),ft=RegExp("^"+pt.call(Se).replace(zr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Le=Ct?Be.Buffer:void 0,Rt=Be.Symbol,ae=Be.Uint8Array;Le&&Le.allocUnsafe;var _t=Vr(Object.getPrototypeOf,Object),jt=Object.create,Qr=ut.propertyIsEnumerable,nr=Xr.splice,le=Rt?Rt.toStringTag:void 0,He=function(){try{var i=Dt(Object,"defineProperty");return i({},"",{}),i}catch{}}(),or=Le?Le.isBuffer:void 0,ir=Math.max,_e=Date.now,At=Dt(Be,"Map"),Ke=Dt(Object,"create"),en=function(){function i(){}return function(d){if(!Ae(d))return{};if(jt)return jt(d);i.prototype=d;var f=new i;return i.prototype=void 0,f}}();function ge(i){var d=-1,f=i==null?0:i.length;for(this.clear();++d<f;){var C=i[d];this.set(C[0],C[1])}}function Ge(){this.__data__=Ke?Ke(null):{},this.size=0}function kt(i){var d=this.has(i)&&delete this.__data__[i];return this.size-=d?1:0,d}function Et(i){var d=this.__data__;if(Ke){var f=d[i];return f===n?void 0:f}return Se.call(d,i)?d[i]:void 0}function Ft(i){var d=this.__data__;return Ke?d[i]!==void 0:Se.call(d,i)}function Ve(i,d){var f=this.__data__;return this.size+=this.has(i)?0:1,f[i]=Ke&&d===void 0?n:d,this}ge.prototype.clear=Ge,ge.prototype.delete=kt,ge.prototype.get=Et,ge.prototype.has=Ft,ge.prototype.set=Ve;function me(i){var d=-1,f=i==null?0:i.length;for(this.clear();++d<f;){var C=i[d];this.set(C[0],C[1])}}function tn(){this.__data__=[],this.size=0}function rn(i){var d=this.__data__,f=ht(d,i);if(f<0)return!1;var C=d.length-1;return f==C?d.pop():nr.call(d,f,1),--this.size,!0}function nn(i){var d=this.__data__,f=ht(d,i);return f<0?void 0:d[f][1]}function on(i){return ht(this.__data__,i)>-1}function ar(i,d){var f=this.__data__,C=ht(f,i);return C<0?(++this.size,f.push([i,d])):f[C][1]=d,this}me.prototype.clear=tn,me.prototype.delete=rn,me.prototype.get=nn,me.prototype.has=on,me.prototype.set=ar;function xe(i){var d=-1,f=i==null?0:i.length;for(this.clear();++d<f;){var C=i[d];this.set(C[0],C[1])}}function je(){this.size=0,this.__data__={hash:new ge,map:new(At||me),string:new ge}}function an(i){var d=wt(this,i).delete(i);return this.size-=d?1:0,d}function sn(i){return wt(this,i).get(i)}function cn(i){return wt(this,i).has(i)}function dn(i,d){var f=wt(this,i),C=f.size;return f.set(i,d),this.size+=f.size==C?0:1,this}xe.prototype.clear=je,xe.prototype.delete=an,xe.prototype.get=sn,xe.prototype.has=cn,xe.prototype.set=dn;function Me(i){var d=this.__data__=new me(i);this.size=d.size}function we(){this.__data__=new me,this.size=0}function ln(i){var d=this.__data__,f=d.delete(i);return this.size=d.size,f}function un(i){return this.__data__.get(i)}function pn(i){return this.__data__.has(i)}function fn(i,d){var f=this.__data__;if(f instanceof me){var C=f.__data__;if(!At||C.length<r-1)return C.push([i,d]),this.size=++f.size,this;f=this.__data__=new xe(C)}return f.set(i,d),this.size=f.size,this}Me.prototype.clear=we,Me.prototype.delete=ln,Me.prototype.get=un,Me.prototype.has=pn,Me.prototype.set=fn;function hn(i,d){var f=Ie(i),C=!f&&Lt(i),R=!f&&!C&&Qe(i),A=!f&&!C&&!R&&$t(i),F=f||C||R||A,k=F?er(i.length,String):[],E=k.length;for(var q in i)F&&(q=="length"||R&&(q=="offset"||q=="parent")||A&&(q=="buffer"||q=="byteLength"||q=="byteOffset")||Bt(q,E))||k.push(q);return k}function ye(i,d,f){(f!==void 0&&!yt(i[d],f)||f===void 0&&!(d in i))&&Pt(i,d,f)}function gn(i,d,f){var C=i[d];(!(Se.call(i,d)&&yt(C,f))||f===void 0&&!(d in i))&&Pt(i,d,f)}function ht(i,d){for(var f=i.length;f--;)if(yt(i[f][0],d))return f;return-1}function Pt(i,d,f){d=="__proto__"&&He?He(i,d,{configurable:!0,enumerable:!0,value:f,writable:!0}):i[d]=f}var mn=dr();function gt(i){return i==null?i===void 0?J:j:le&&le in Object(i)?Cn(i):_n(i)}function Xe(i){return Ue(i)&>(i)==u}function wn(i){if(!Ae(i)||lr(i))return!1;var d=Mt(i)?ft:Jr;return d.test(En(i))}function yn(i){return Ue(i)&&vt(i.length)&&!!$[gt(i)]}function Oe(i){if(!Ae(i))return $e(i);var d=Ze(i),f=[];for(var C in i)C=="constructor"&&(d||!Se.call(i,C))||f.push(C);return f}function sr(i,d,f,C,R){i!==d&&mn(d,function(A,F){if(R||(R=new Me),Ae(A))In(i,d,F,f,sr,C,R);else{var k=C?C(ue(i,F),A,F+"",i,d,R):void 0;k===void 0&&(k=A),ye(i,F,k)}},Ut)}function In(i,d,f,C,R,A,F){var k=ue(i,f),E=ue(d,f),q=F.get(E);if(q){ye(i,f,q);return}var W=A?A(k,E,f+"",i,d,F):void 0,K=W===void 0;if(K){var Q=Ie(E),ee=!Q&&Qe(E),ve=!Q&&!ee&&$t(E);W=E,Q||ee||ve?Ie(k)?W=k:Fn(k)?W=On(k):ee?(K=!1,W=Sn(E)):ve?(K=!1,W=mt(E)):W=[]:ur(E)||Lt(E)?(W=k,Lt(k)?W=et(k):(!Ae(k)||Mt(k))&&(W=Tn(E))):K=!1}K&&(F.set(E,W),R(W,E,C,A,F),F.delete(E)),ye(i,f,W)}function vn(i,d){return An(jn(i,d,pr),i+"")}var bn=He?function(i,d){return He(i,"toString",{configurable:!0,enumerable:!1,value:Dn(d),writable:!0})}:pr;function Sn(i,d){return i.slice()}function xn(i){var d=new i.constructor(i.byteLength);return new ae(d).set(new ae(i)),d}function mt(i,d){var f=xn(i.buffer);return new i.constructor(f,i.byteOffset,i.length)}function On(i,d){var f=-1,C=i.length;for(d||(d=Array(C));++f<C;)d[f]=i[f];return d}function Ye(i,d,f,C){var R=!f;f||(f={});for(var A=-1,F=d.length;++A<F;){var k=d[A],E=void 0;E===void 0&&(E=i[k]),R?Pt(f,k,E):gn(f,k,E)}return f}function cr(i){return vn(function(d,f){var C=-1,R=f.length,A=R>1?f[R-1]:void 0,F=R>2?f[2]:void 0;for(A=i.length>3&&typeof A=="function"?(R--,A):void 0,F&&Nn(f[0],f[1],F)&&(A=R<3?void 0:A,R=1),d=Object(d);++C<R;){var k=f[C];k&&i(d,k,C,A)}return d})}function dr(i){return function(d,f,C){for(var R=-1,A=Object(d),F=C(d),k=F.length;k--;){var E=F[++R];if(f(A[E],E,A)===!1)break}return d}}function wt(i,d){var f=i.__data__;return Rn(d)?f[typeof d=="string"?"string":"hash"]:f.map}function Dt(i,d){var f=Gr(i,d);return wn(f)?f:void 0}function Cn(i){var d=Se.call(i,le),f=i[le];try{i[le]=void 0;var C=!0}catch{}var R=rr.call(i);return C&&(d?i[le]=f:delete i[le]),R}function Tn(i){return typeof i.constructor=="function"&&!Ze(i)?en(_t(i)):{}}function Bt(i,d){var f=typeof i;return d=d??c,!!d&&(f=="number"||f!="symbol"&&Hr.test(i))&&i>-1&&i%1==0&&i<d}function Nn(i,d,f){if(!Ae(f))return!1;var C=typeof d;return(C=="number"?It(f)&&Bt(d,f.length):C=="string"&&d in f)?yt(f[d],i):!1}function Rn(i){var d=typeof i;return d=="string"||d=="number"||d=="symbol"||d=="boolean"?i!=="__proto__":i===null}function lr(i){return!!tr&&tr in i}function Ze(i){var d=i&&i.constructor,f=typeof d=="function"&&d.prototype||ut;return i===f}function $e(i){var d=[];if(i!=null)for(var f in Object(i))d.push(f);return d}function _n(i){return rr.call(i)}function jn(i,d,f){return d=ir(d===void 0?i.length-1:d,0),function(){for(var C=arguments,R=-1,A=ir(C.length-d,0),F=Array(A);++R<A;)F[R]=C[d+R];R=-1;for(var k=Array(d+1);++R<d;)k[R]=C[R];return k[d]=f(F),Qt(i,this,k)}}function ue(i,d){if(!(d==="constructor"&&typeof i[d]=="function")&&d!="__proto__")return i[d]}var An=kn(bn);function kn(i){var d=0,f=0;return function(){var C=_e(),R=a-(C-f);if(f=C,R>0){if(++d>=o)return arguments[0]}else d=0;return i.apply(void 0,arguments)}}function En(i){if(i!=null){try{return pt.call(i)}catch{}try{return i+""}catch{}}return""}function yt(i,d){return i===d||i!==i&&d!==d}var Lt=Xe(function(){return arguments}())?Xe:function(i){return Ue(i)&&Se.call(i,"callee")&&!Qr.call(i,"callee")},Ie=Array.isArray;function It(i){return i!=null&&vt(i.length)&&!Mt(i)}function Fn(i){return Ue(i)&&It(i)}var Qe=or||l;function Mt(i){if(!Ae(i))return!1;var d=gt(i);return d==v||d==x||d==g||d==P}function vt(i){return typeof i=="number"&&i>-1&&i%1==0&&i<=c}function Ae(i){var d=typeof i;return i!=null&&(d=="object"||d=="function")}function Ue(i){return i!=null&&typeof i=="object"}function ur(i){if(!Ue(i)||gt(i)!=T)return!1;var d=_t(i);if(d===null)return!0;var f=Se.call(d,"constructor")&&d.constructor;return typeof f=="function"&&f instanceof f&&pt.call(f)==Zr}var $t=lt?Kr(lt):yn;function et(i){return Ye(i,Ut(i))}function Ut(i){return It(i)?hn(i):Oe(i)}var Pn=cr(function(i,d,f,C){sr(i,d,f,C)});function Dn(i){return function(){return i}}function pr(i){return i}function l(){return!1}e.exports=Pn})(Nr,Nr.exports);var Ol=Nr.exports;const Fe=eo(Ol);var Cl=e=>/!(important)?$/.test(e),Co=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,Tl=(e,t)=>r=>{const n=String(t),o=Cl(n),a=Co(n),c=e?`${e}.${a}`:a;let u=ot(r.__cssMap)&&c in r.__cssMap?r.__cssMap[c].varRef:t;return u=Co(u),o?`${u} !important`:u};function ao(e){const{scale:t,transform:r,compose:n}=e;return(a,c)=>{var u;const p=Tl(t,a)(c);let g=(u=r==null?void 0:r(p,c))!=null?u:p;return n&&(g=n(g,c)),g}}var yr=(...e)=>t=>e.reduce((r,n)=>n(r),t);function pe(e,t){return r=>{const n={property:r,scale:e};return n.transform=ao({scale:e,transform:t}),n}}var Nl=({rtl:e,ltr:t})=>r=>r.direction==="rtl"?e:t;function Rl(e){const{property:t,scale:r,transform:n}=e;return{scale:r,property:Nl(t),transform:r?ao({scale:r,compose:n}):n}}var ji=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function _l(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...ji].join(" ")}function jl(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...ji].join(" ")}var Al={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},kl={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function El(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var Fl={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},Gn={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},Pl=new Set(Object.values(Gn)),Vn=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),Dl=e=>e.trim();function Bl(e,t){if(e==null||Vn.has(e))return e;if(!(Xn(e)||Vn.has(e)))return`url('${e}')`;const o=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),a=o==null?void 0:o[1],c=o==null?void 0:o[2];if(!a||!c)return e;const u=a.includes("-gradient")?a:`${a}-gradient`,[p,...g]=c.split(",").map(Dl).filter(Boolean);if((g==null?void 0:g.length)===0)return e;const m=p in Gn?Gn[p]:p;g.unshift(m);const b=g.map(y=>{if(Pl.has(y))return y;const v=y.indexOf(" "),[x,S]=v!==-1?[y.substr(0,v),y.substr(v+1)]:[y],O=Xn(S)?S:S&&S.split(" "),j=`colors.${x}`,T=j in t.__cssMap?t.__cssMap[j].varRef:x;return O?[T,...Array.isArray(O)?O:[O]].join(" "):T});return`${u}(${b.join(", ")})`}var Xn=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),Ll=(e,t)=>Bl(e,t??{});function Ml(e){return/^var\(--.+\)$/.test(e)}var $l=e=>{const t=parseFloat(e.toString()),r=e.toString().replace(String(t),"");return{unitless:!r,value:t,unit:r}},Ce=e=>t=>`${e}(${t})`,D={filter(e){return e!=="auto"?e:Al},backdropFilter(e){return e!=="auto"?e:kl},ring(e){return El(D.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?_l():e==="auto-gpu"?jl():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=$l(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const r={left:"right",right:"left"};return t.direction==="rtl"?r[e]:e},degree(e){if(Ml(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:Ll,blur:Ce("blur"),opacity:Ce("opacity"),brightness:Ce("brightness"),contrast:Ce("contrast"),dropShadow:Ce("drop-shadow"),grayscale:Ce("grayscale"),hueRotate:e=>Ce("hue-rotate")(D.degree(e)),invert:Ce("invert"),saturate:Ce("saturate"),sepia:Ce("sepia"),bgImage(e){return e==null||Xn(e)||Vn.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:r,divide:n}=(t=Fl[e])!=null?t:{},o={flexDirection:e};return r&&(o[r]=1),n&&(o[n]=1),o}},h={borderWidths:pe("borderWidths"),borderStyles:pe("borderStyles"),colors:pe("colors"),borders:pe("borders"),gradients:pe("gradients",D.gradient),radii:pe("radii",D.px),space:pe("space",yr(D.vh,D.px)),spaceT:pe("space",yr(D.vh,D.px)),degreeT(e){return{property:e,transform:D.degree}},prop(e,t,r){return{property:e,scale:t,...t&&{transform:ao({scale:t,transform:r})}}},propT(e,t){return{property:e,transform:t}},sizes:pe("sizes",yr(D.vh,D.px)),sizesT:pe("sizes",yr(D.vh,D.fraction)),shadows:pe("shadows"),logical:Rl,blur:pe("blur",D.blur)},br={background:h.colors("background"),backgroundColor:h.colors("backgroundColor"),backgroundImage:h.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:D.bgClip},bgSize:h.prop("backgroundSize"),bgPosition:h.prop("backgroundPosition"),bg:h.colors("background"),bgColor:h.colors("backgroundColor"),bgPos:h.prop("backgroundPosition"),bgRepeat:h.prop("backgroundRepeat"),bgAttachment:h.prop("backgroundAttachment"),bgGradient:h.gradients("backgroundImage"),bgClip:{transform:D.bgClip}};Object.assign(br,{bgImage:br.backgroundImage,bgImg:br.backgroundImage});var B={border:h.borders("border"),borderWidth:h.borderWidths("borderWidth"),borderStyle:h.borderStyles("borderStyle"),borderColor:h.colors("borderColor"),borderRadius:h.radii("borderRadius"),borderTop:h.borders("borderTop"),borderBlockStart:h.borders("borderBlockStart"),borderTopLeftRadius:h.radii("borderTopLeftRadius"),borderStartStartRadius:h.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:h.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:h.radii("borderTopRightRadius"),borderStartEndRadius:h.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:h.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:h.borders("borderRight"),borderInlineEnd:h.borders("borderInlineEnd"),borderBottom:h.borders("borderBottom"),borderBlockEnd:h.borders("borderBlockEnd"),borderBottomLeftRadius:h.radii("borderBottomLeftRadius"),borderBottomRightRadius:h.radii("borderBottomRightRadius"),borderLeft:h.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:h.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:h.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:h.borders(["borderLeft","borderRight"]),borderInline:h.borders("borderInline"),borderY:h.borders(["borderTop","borderBottom"]),borderBlock:h.borders("borderBlock"),borderTopWidth:h.borderWidths("borderTopWidth"),borderBlockStartWidth:h.borderWidths("borderBlockStartWidth"),borderTopColor:h.colors("borderTopColor"),borderBlockStartColor:h.colors("borderBlockStartColor"),borderTopStyle:h.borderStyles("borderTopStyle"),borderBlockStartStyle:h.borderStyles("borderBlockStartStyle"),borderBottomWidth:h.borderWidths("borderBottomWidth"),borderBlockEndWidth:h.borderWidths("borderBlockEndWidth"),borderBottomColor:h.colors("borderBottomColor"),borderBlockEndColor:h.colors("borderBlockEndColor"),borderBottomStyle:h.borderStyles("borderBottomStyle"),borderBlockEndStyle:h.borderStyles("borderBlockEndStyle"),borderLeftWidth:h.borderWidths("borderLeftWidth"),borderInlineStartWidth:h.borderWidths("borderInlineStartWidth"),borderLeftColor:h.colors("borderLeftColor"),borderInlineStartColor:h.colors("borderInlineStartColor"),borderLeftStyle:h.borderStyles("borderLeftStyle"),borderInlineStartStyle:h.borderStyles("borderInlineStartStyle"),borderRightWidth:h.borderWidths("borderRightWidth"),borderInlineEndWidth:h.borderWidths("borderInlineEndWidth"),borderRightColor:h.colors("borderRightColor"),borderInlineEndColor:h.colors("borderInlineEndColor"),borderRightStyle:h.borderStyles("borderRightStyle"),borderInlineEndStyle:h.borderStyles("borderInlineEndStyle"),borderTopRadius:h.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:h.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:h.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:h.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(B,{rounded:B.borderRadius,roundedTop:B.borderTopRadius,roundedTopLeft:B.borderTopLeftRadius,roundedTopRight:B.borderTopRightRadius,roundedTopStart:B.borderStartStartRadius,roundedTopEnd:B.borderStartEndRadius,roundedBottom:B.borderBottomRadius,roundedBottomLeft:B.borderBottomLeftRadius,roundedBottomRight:B.borderBottomRightRadius,roundedBottomStart:B.borderEndStartRadius,roundedBottomEnd:B.borderEndEndRadius,roundedLeft:B.borderLeftRadius,roundedRight:B.borderRightRadius,roundedStart:B.borderInlineStartRadius,roundedEnd:B.borderInlineEndRadius,borderStart:B.borderInlineStart,borderEnd:B.borderInlineEnd,borderTopStartRadius:B.borderStartStartRadius,borderTopEndRadius:B.borderStartEndRadius,borderBottomStartRadius:B.borderEndStartRadius,borderBottomEndRadius:B.borderEndEndRadius,borderStartRadius:B.borderInlineStartRadius,borderEndRadius:B.borderInlineEndRadius,borderStartWidth:B.borderInlineStartWidth,borderEndWidth:B.borderInlineEndWidth,borderStartColor:B.borderInlineStartColor,borderEndColor:B.borderInlineEndColor,borderStartStyle:B.borderInlineStartStyle,borderEndStyle:B.borderInlineEndStyle});var Ul={color:h.colors("color"),textColor:h.colors("color"),fill:h.colors("fill"),stroke:h.colors("stroke")},Yn={boxShadow:h.shadows("boxShadow"),mixBlendMode:!0,blendMode:h.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:h.prop("backgroundBlendMode"),opacity:!0};Object.assign(Yn,{shadow:Yn.boxShadow});var ql={filter:{transform:D.filter},blur:h.blur("--chakra-blur"),brightness:h.propT("--chakra-brightness",D.brightness),contrast:h.propT("--chakra-contrast",D.contrast),hueRotate:h.propT("--chakra-hue-rotate",D.hueRotate),invert:h.propT("--chakra-invert",D.invert),saturate:h.propT("--chakra-saturate",D.saturate),dropShadow:h.propT("--chakra-drop-shadow",D.dropShadow),backdropFilter:{transform:D.backdropFilter},backdropBlur:h.blur("--chakra-backdrop-blur"),backdropBrightness:h.propT("--chakra-backdrop-brightness",D.brightness),backdropContrast:h.propT("--chakra-backdrop-contrast",D.contrast),backdropHueRotate:h.propT("--chakra-backdrop-hue-rotate",D.hueRotate),backdropInvert:h.propT("--chakra-backdrop-invert",D.invert),backdropSaturate:h.propT("--chakra-backdrop-saturate",D.saturate)},Rr={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:D.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:h.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:h.space("gap"),rowGap:h.space("rowGap"),columnGap:h.space("columnGap")};Object.assign(Rr,{flexDir:Rr.flexDirection});var Ai={gridGap:h.space("gridGap"),gridColumnGap:h.space("gridColumnGap"),gridRowGap:h.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},Wl={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:D.outline},outlineOffset:!0,outlineColor:h.colors("outlineColor")},fe={width:h.sizesT("width"),inlineSize:h.sizesT("inlineSize"),height:h.sizes("height"),blockSize:h.sizes("blockSize"),boxSize:h.sizes(["width","height"]),minWidth:h.sizes("minWidth"),minInlineSize:h.sizes("minInlineSize"),minHeight:h.sizes("minHeight"),minBlockSize:h.sizes("minBlockSize"),maxWidth:h.sizes("maxWidth"),maxInlineSize:h.sizes("maxInlineSize"),maxHeight:h.sizes("maxHeight"),maxBlockSize:h.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var r,n,o;return{[`@media screen and (min-width: ${(o=(n=(r=t.__breakpoints)==null?void 0:r.get(e))==null?void 0:n.minW)!=null?o:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var r,n,o;return{[`@media screen and (max-width: ${(o=(n=(r=t.__breakpoints)==null?void 0:r.get(e))==null?void 0:n._minW)!=null?o:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:h.propT("float",D.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(fe,{w:fe.width,h:fe.height,minW:fe.minWidth,maxW:fe.maxWidth,minH:fe.minHeight,maxH:fe.maxHeight,overscroll:fe.overscrollBehavior,overscrollX:fe.overscrollBehaviorX,overscrollY:fe.overscrollBehaviorY});var zl={listStyleType:!0,listStylePosition:!0,listStylePos:h.prop("listStylePosition"),listStyleImage:!0,listStyleImg:h.prop("listStyleImage")};function Jl(e,t,r,n){const o=typeof t=="string"?t.split("."):[t];for(n=0;n<o.length&&e;n+=1)e=e[o[n]];return e===void 0?r:e}var Hl=e=>{const t=new WeakMap;return(n,o,a,c)=>{if(typeof n>"u")return e(n,o,a);t.has(n)||t.set(n,new Map);const u=t.get(n);if(u.has(o))return u.get(o);const p=e(n,o,a,c);return u.set(o,p),p}},Kl=Hl(Jl),Gl={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},Vl={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},$n=(e,t,r)=>{const n={},o=Kl(e,t,{});for(const a in o)a in r&&r[a]!=null||(n[a]=o[a]);return n},Xl={srOnly:{transform(e){return e===!0?Gl:e==="focusable"?Vl:{}}},layerStyle:{processResult:!0,transform:(e,t,r)=>$n(t,`layerStyles.${e}`,r)},textStyle:{processResult:!0,transform:(e,t,r)=>$n(t,`textStyles.${e}`,r)},apply:{processResult:!0,transform:(e,t,r)=>$n(t,e,r)}},Jt={position:!0,pos:h.prop("position"),zIndex:h.prop("zIndex","zIndices"),inset:h.spaceT("inset"),insetX:h.spaceT(["left","right"]),insetInline:h.spaceT("insetInline"),insetY:h.spaceT(["top","bottom"]),insetBlock:h.spaceT("insetBlock"),top:h.spaceT("top"),insetBlockStart:h.spaceT("insetBlockStart"),bottom:h.spaceT("bottom"),insetBlockEnd:h.spaceT("insetBlockEnd"),left:h.spaceT("left"),insetInlineStart:h.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:h.spaceT("right"),insetInlineEnd:h.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(Jt,{insetStart:Jt.insetInlineStart,insetEnd:Jt.insetInlineEnd});var Yl={ring:{transform:D.ring},ringColor:h.colors("--chakra-ring-color"),ringOffset:h.prop("--chakra-ring-offset-width"),ringOffsetColor:h.colors("--chakra-ring-offset-color"),ringInset:h.prop("--chakra-ring-inset")},z={margin:h.spaceT("margin"),marginTop:h.spaceT("marginTop"),marginBlockStart:h.spaceT("marginBlockStart"),marginRight:h.spaceT("marginRight"),marginInlineEnd:h.spaceT("marginInlineEnd"),marginBottom:h.spaceT("marginBottom"),marginBlockEnd:h.spaceT("marginBlockEnd"),marginLeft:h.spaceT("marginLeft"),marginInlineStart:h.spaceT("marginInlineStart"),marginX:h.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:h.spaceT("marginInline"),marginY:h.spaceT(["marginTop","marginBottom"]),marginBlock:h.spaceT("marginBlock"),padding:h.space("padding"),paddingTop:h.space("paddingTop"),paddingBlockStart:h.space("paddingBlockStart"),paddingRight:h.space("paddingRight"),paddingBottom:h.space("paddingBottom"),paddingBlockEnd:h.space("paddingBlockEnd"),paddingLeft:h.space("paddingLeft"),paddingInlineStart:h.space("paddingInlineStart"),paddingInlineEnd:h.space("paddingInlineEnd"),paddingX:h.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:h.space("paddingInline"),paddingY:h.space(["paddingTop","paddingBottom"]),paddingBlock:h.space("paddingBlock")};Object.assign(z,{m:z.margin,mt:z.marginTop,mr:z.marginRight,me:z.marginInlineEnd,marginEnd:z.marginInlineEnd,mb:z.marginBottom,ml:z.marginLeft,ms:z.marginInlineStart,marginStart:z.marginInlineStart,mx:z.marginX,my:z.marginY,p:z.padding,pt:z.paddingTop,py:z.paddingY,px:z.paddingX,pb:z.paddingBottom,pl:z.paddingLeft,ps:z.paddingInlineStart,paddingStart:z.paddingInlineStart,pr:z.paddingRight,pe:z.paddingInlineEnd,paddingEnd:z.paddingInlineEnd});var Zl={textDecorationColor:h.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:h.shadows("textShadow")},Ql={clipPath:!0,transform:h.propT("transform",D.transform),transformOrigin:!0,translateX:h.spaceT("--chakra-translate-x"),translateY:h.spaceT("--chakra-translate-y"),skewX:h.degreeT("--chakra-skew-x"),skewY:h.degreeT("--chakra-skew-y"),scaleX:h.prop("--chakra-scale-x"),scaleY:h.prop("--chakra-scale-y"),scale:h.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:h.degreeT("--chakra-rotate")},eu={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:h.prop("transitionDuration","transition.duration"),transitionProperty:h.prop("transitionProperty","transition.property"),transitionTimingFunction:h.prop("transitionTimingFunction","transition.easing")},tu={fontFamily:h.prop("fontFamily","fonts"),fontSize:h.prop("fontSize","fontSizes",D.px),fontWeight:h.prop("fontWeight","fontWeights"),lineHeight:h.prop("lineHeight","lineHeights"),letterSpacing:h.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},ru={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:h.spaceT("scrollMargin"),scrollMarginTop:h.spaceT("scrollMarginTop"),scrollMarginBottom:h.spaceT("scrollMarginBottom"),scrollMarginLeft:h.spaceT("scrollMarginLeft"),scrollMarginRight:h.spaceT("scrollMarginRight"),scrollMarginX:h.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:h.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:h.spaceT("scrollPadding"),scrollPaddingTop:h.spaceT("scrollPaddingTop"),scrollPaddingBottom:h.spaceT("scrollPaddingBottom"),scrollPaddingLeft:h.spaceT("scrollPaddingLeft"),scrollPaddingRight:h.spaceT("scrollPaddingRight"),scrollPaddingX:h.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:h.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function ki(e){return ot(e)&&e.reference?e.reference:String(e)}var Dr=(e,...t)=>t.map(ki).join(` ${e} `).replace(/calc/g,""),To=(...e)=>`calc(${Dr("+",...e)})`,No=(...e)=>`calc(${Dr("-",...e)})`,Zn=(...e)=>`calc(${Dr("*",...e)})`,Ro=(...e)=>`calc(${Dr("/",...e)})`,_o=e=>{const t=ki(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:Zn(t,-1)},zt=Object.assign(e=>({add:(...t)=>zt(To(e,...t)),subtract:(...t)=>zt(No(e,...t)),multiply:(...t)=>zt(Zn(e,...t)),divide:(...t)=>zt(Ro(e,...t)),negate:()=>zt(_o(e)),toString:()=>e.toString()}),{add:To,subtract:No,multiply:Zn,divide:Ro,negate:_o});function nu(e){const t=parseFloat(e.toString()),r=e.toString().replace(String(t),"");return{unitless:!r,value:t,unit:r}}function jo(e){if(e==null)return e;const{unitless:t}=nu(e);return t||typeof e=="number"?`${e}px`:e}function ou(e,t){const r=["@media screen"];return e&&r.push("and",`(min-width: ${jo(e)})`),t&&r.push("and",`(max-width: ${jo(t)})`),r.join(" ")}var Y={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},qe=e=>Ei(t=>e(t,"&"),"[role=group]","[data-group]",".group"),Ee=e=>Ei(t=>e(t,"~ &"),"[data-peer]",".peer"),Ei=(e,...t)=>t.map(e).join(", "),so={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:qe(Y.hover),_peerHover:Ee(Y.hover),_groupFocus:qe(Y.focus),_peerFocus:Ee(Y.focus),_groupFocusVisible:qe(Y.focusVisible),_peerFocusVisible:Ee(Y.focusVisible),_groupActive:qe(Y.active),_peerActive:Ee(Y.active),_groupDisabled:qe(Y.disabled),_peerDisabled:Ee(Y.disabled),_groupInvalid:qe(Y.invalid),_peerInvalid:Ee(Y.invalid),_groupChecked:qe(Y.checked),_peerChecked:Ee(Y.checked),_groupFocusWithin:qe(Y.focusWithin),_peerFocusWithin:Ee(Y.focusWithin),_peerPlaceholderShown:Ee(Y.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},iu=Object.keys(so),co=Fe({},br,B,Ul,Rr,fe,ql,Yl,Wl,Ai,Xl,Jt,Yn,z,ru,tu,Zl,Ql,zl,eu);Object.assign({},z,fe,Rr,Ai,Jt);var au=[...Object.keys(co),...iu],su={...co,...so},cu=e=>e in su,du=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:r,toArrayValue:n,media:o}=t.__breakpoints,a={};for(const c in e){let u=nt(e[c],t);if(u==null)continue;if(u=ot(u)&&r(u)?n(u):u,!Array.isArray(u)){a[c]=u;continue}const p=u.slice(0,o.length).length;for(let g=0;g<p;g+=1){const m=o==null?void 0:o[g];if(!m){a[c]=u[g];continue}a[m]=a[m]||{},u[g]!=null&&(a[m][c]=u[g])}}return a};function lu(e){const t=[];let r="",n=!1;for(let o=0;o<e.length;o++){const a=e[o];a==="("?(n=!0,r+=a):a===")"?(n=!1,r+=a):a===","&&!n?(t.push(r),r=""):r+=a}return r=r.trim(),r&&t.push(r),t}function uu(e){return/^var\(--.+\)$/.test(e)}var pu=(e,t)=>e.startsWith("--")&&typeof t=="string"&&!uu(t),fu=(e,t)=>{var r,n;if(t==null)return t;const o=p=>{var g,m;return(m=(g=e.__cssMap)==null?void 0:g[p])==null?void 0:m.varRef},a=p=>{var g;return(g=o(p))!=null?g:p},[c,u]=lu(t);return t=(n=(r=o(c))!=null?r:a(u))!=null?n:a(t),t};function hu(e){const{configs:t={},pseudos:r={},theme:n}=e,o=(a,c=!1)=>{var u,p,g;const m=nt(a,n),b=du(m)(n);let y={};for(let v in b){const x=b[v];let S=nt(x,n);v in r&&(v=r[v]),pu(v,S)&&(S=fu(n,S));let O=t[v];if(O===!0&&(O={property:v}),ot(S)){y[v]=(u=y[v])!=null?u:{},y[v]=Fe({},y[v],o(S,!0));continue}let j=(g=(p=O==null?void 0:O.transform)==null?void 0:p.call(O,S,n,m))!=null?g:S;j=O!=null&&O.processResult?o(j,!0):j;const T=nt(O==null?void 0:O.property,n);if(!c&&(O!=null&&O.static)){const P=nt(O.static,n);y=Fe({},y,P)}if(T&&Array.isArray(T)){for(const P of T)y[P]=j;continue}if(T){T==="&"&&ot(j)?y=Fe({},y,j):y[T]=j;continue}if(ot(j)){y=Fe({},y,j);continue}y[v]=j}return y};return o}var gu=e=>t=>hu({theme:t,pseudos:so,configs:co})(e);function mu(e,t){if(Array.isArray(e))return e;if(ot(e))return t(e);if(e!=null)return[e]}function wu(e,t){for(let r=t+1;r<e.length;r++)if(e[r]!=null)return r;return-1}function yu(e){const t=e.__breakpoints;return function(n,o,a,c){var u,p;if(!t)return;const g={},m=mu(a,t.toArrayValue);if(!m)return g;const b=m.length,y=b===1,v=!!n.parts;for(let x=0;x<b;x++){const S=t.details[x],O=t.details[wu(m,x)],j=ou(S.minW,O==null?void 0:O._minW),T=nt((u=n[o])==null?void 0:u[m[x]],c);if(T){if(v){(p=n.parts)==null||p.forEach(P=>{Fe(g,{[P]:y?T[P]:{[j]:T[P]}})});continue}if(!v){y?Fe(g,T):g[j]=T;continue}g[j]=T}}return g}}function Iu(e){return t=>{var r;const{variant:n,size:o,theme:a}=t,c=yu(a);return Fe({},nt((r=e.baseStyle)!=null?r:{},t),c(e,"sizes",o,t),c(e,"variants",n,t))}}function vu(e,t){const r={};return Object.keys(e).forEach(n=>{t.includes(n)||(r[n]=e[n])}),r}function bu(e,t,r,n){const o=typeof t=="string"?t.split("."):[t];for(n=0;n<o.length&&e;n+=1)e=e[o[n]];return e===void 0?r:e}var Su=e=>{const t=new WeakMap;return(n,o,a,c)=>{if(typeof n>"u")return e(n,o,a);t.has(n)||t.set(n,new Map);const u=t.get(n);if(u.has(o))return u.get(o);const p=e(n,o,a,c);return u.set(o,p),p}},xu=Su(bu);function Fi(e,t){const r={};return Object.keys(e).forEach(n=>{const o=e[n];t(o,n,e)&&(r[n]=o)}),r}var Pi=e=>Fi(e,t=>t!=null);function Ou(e){return typeof e=="function"}process.env.NODE_ENV;process.env.NODE_ENV;function Cu(e,...t){return Ou(e)?e(...t):e}var Tu=typeof Element<"u",Nu=typeof Map=="function",Ru=typeof Set=="function",_u=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Sr(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,n,o;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(!Sr(e[n],t[n]))return!1;return!0}var a;if(Nu&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(a=e.entries();!(n=a.next()).done;)if(!t.has(n.value[0]))return!1;for(a=e.entries();!(n=a.next()).done;)if(!Sr(n.value[1],t.get(n.value[0])))return!1;return!0}if(Ru&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(a=e.entries();!(n=a.next()).done;)if(!t.has(n.value[0]))return!1;return!0}if(_u&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(e[n]!==t[n])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[n]))return!1;if(Tu&&e instanceof Element)return!1;for(n=r;n--!==0;)if(!((o[n]==="_owner"||o[n]==="__v"||o[n]==="__o")&&e.$$typeof)&&!Sr(e[o[n]],t[o[n]]))return!1;return!0}return e!==e&&t!==t}var ju=function(t,r){try{return Sr(t,r)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}};const Au=eo(ju);function ku(e,t={}){var r;const{styleConfig:n,...o}=t,{theme:a,colorMode:c}=bl(),u=xu(a,`components.${e}`),p=n||u,g=Fe({theme:a,colorMode:c},(r=p==null?void 0:p.defaultProps)!=null?r:{},Pi(vu(o,["children"]))),m=I.useRef({});if(p){const y=Iu(p)(g);Au(m.current,y)||(m.current=y)}return m.current}function Eu(e,t={}){return ku(e,t)}var Fu=new Set([...au,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),Pu=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function Du(e){return Pu.has(e)||!Fu.has(e)}function Bu(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const r={...e};for(const n of t)if(n!=null)for(const o in n)Object.prototype.hasOwnProperty.call(n,o)&&(o in r&&delete r[o],r[o]=n[o]);return r}var Ao,Lu=(Ao=uo.default)!=null?Ao:uo,Mu=({baseStyle:e})=>t=>{const{theme:r,css:n,__css:o,sx:a,...c}=t,u=Fi(c,(b,y)=>cu(y)),p=Cu(e,t),g=Bu({},o,p,Pi(u),a),m=gu(g)(t.theme);return n?[m,n]:m};function Un(e,t){const{baseStyle:r,...n}=t??{};n.shouldForwardProp||(n.shouldForwardProp=Du);const o=Mu({baseStyle:r}),a=Lu(e,n)(o);return I.forwardRef(function(p,g){const{colorMode:m,forced:b}=_i();return I.createElement(a,{ref:g,"data-theme":b?m:void 0,...p})})}function $u(){const e=new Map;return new Proxy(Un,{apply(t,r,n){return Un(...n)},get(t,r){return e.has(r)||e.set(r,Un(r)),e.get(r)}})}var ko=$u();function Di(e){return I.forwardRef(e)}var Eo={path:s.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[s.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),s.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),s.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Bi=Di((e,t)=>{const{as:r,viewBox:n,color:o="currentColor",focusable:a=!1,children:c,className:u,__css:p,...g}=e,m=Sl("chakra-icon",u),b=Eu("Icon",e),y={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:o,...p,...b},v={ref:t,focusable:a,className:m,__css:y},x=n??Eo.viewBox;if(r&&typeof r!="string")return s.jsx(ko.svg,{as:r,...v,...g});const S=c??Eo.path;return s.jsx(ko.svg,{verticalAlign:"middle",viewBox:x,...v,...g,children:S})});Bi.displayName="Icon";function Uu(e){const{viewBox:t="0 0 24 24",d:r,displayName:n,defaultProps:o={}}=e,a=I.Children.toArray(e.path),c=Di((u,p)=>s.jsx(Bi,{ref:p,viewBox:t,...o,...u,children:a.length?a:s.jsx("path",{fill:"currentColor",d:r})}));return c.displayName=n,c}var qu=Uu({displayName:"ExternalLinkIcon",path:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[s.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),s.jsx("path",{d:"M15 3h6v6"}),s.jsx("path",{d:"M10 14L21 3"})]})});const Wu="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function zu({handleSubmit:e,setWorkspace:t,error:r,isButtonDisabled:n}){return s.jsx(Vt,{children:s.jsxs(w.FormControl,{children:[s.jsx(w.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsx(w.Heading,{as:"h4",size:"md",children:"Enter your Salesforce subdomain"})}),s.jsxs(w.Link,{href:Wu,color:"blackAlpha.600",isExternal:!0,children:["What is my Salesforce subdomain?",s.jsx(qu,{mx:"2px"})]}),s.jsx(Xt,{error:r}),s.jsxs(w.Flex,{marginTop:"1em",children:[s.jsx(w.Input,{placeholder:"MyDomain",onChange:o=>t(o.currentTarget.value)}),s.jsx(w.Text,{lineHeight:"2.2em",marginLeft:"0.4em",children:".my.salesforce.com"})]}),s.jsx("br",{}),s.jsx(w.Button,{isDisabled:n,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function Ju({provider:e,handleSubmit:t,setWorkspace:r,error:n,isButtonDisabled:o}){return s.jsx(Vt,{children:s.jsxs(w.FormControl,{children:[s.jsx(w.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsxs(w.Heading,{as:"h4",size:"md",children:["Enter your ",de(e)," workspace"]})}),s.jsx(Xt,{error:n}),s.jsx(w.Flex,{marginTop:"1em",children:s.jsx(w.Input,{placeholder:"MyWorkspace",onChange:a=>r(a.currentTarget.value)})}),s.jsx("br",{}),s.jsx(w.Button,{isDisabled:o,width:"100%",type:"submit",onClick:t,children:"Next"})]})})}const Hu="salesforce";function Ku({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:o}){const{projectId:a}=V(),c=X(),[u,p]=I.useState(""),[g,m]=I.useState(null),[b,y]=I.useState(null),v=async()=>{if(y(null),!u){y("Workspace is required");return}try{const O=await Ti(a,t,n,c,e,u,r,o);m(O)}catch(O){console.error(O),y((O==null?void 0:O.message)??"Unexpected error")}},x=I.useCallback(O=>{y(O),m(null)},[]),S=e===Hu?s.jsx(zu,{handleSubmit:v,setWorkspace:p,error:b,isButtonDisabled:u.length===0}):s.jsx(Ju,{provider:e,handleSubmit:v,setWorkspace:p,error:b,isButtonDisabled:u.length===0});return s.jsx(Ni,{windowTitle:`Connect to ${de(e)}`,oauthUrl:g,onClose:x,children:S})}function Gu({provider:e,providerInfo:t,consumerRef:r,consumerName:n,groupRef:o,groupName:a,selectedConnection:c,setSelectedConnection:u}){if(t.oauth2Opts===void 0)return s.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:p}=t.oauth2Opts,g=t.oauth2Opts.explicitWorkspaceRequired;return p==="authorizationCode"?g?s.jsx(Ku,{provider:e,consumerRef:r,consumerName:n,groupRef:o,groupName:a}):s.jsx(wl,{provider:e,consumerRef:r,consumerName:n,groupRef:o,groupName:a}):p==="clientCredentials"?g?s.jsx(Il,{provider:e,consumerRef:r,consumerName:n,groupRef:o,groupName:a,setSelectedConnection:u,selectedConnection:c}):s.jsx(ll,{provider:e,consumerRef:r,consumerName:n,groupRef:o,groupName:a,setSelectedConnection:u,selectedConnection:c}):p==="password"?s.jsx("em",{children:"Password flow not supported yet"}):p==="PKCE"?s.jsx("em",{children:"PKCE flow not supported yet"}):s.jsxs("em",{children:["Unsupported grant type: ",p]})}const Vu=async(e,t)=>{const r=await H().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!r)throw new Error(`Provider ${t} not found`);return r};function Li({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:o,children:a,onSuccess:c}){const u=X(),[p,g]=I.useState(null),{provider:m}=Ne(),{selectedConnection:b,setSelectedConnection:y,connections:v}=xt();ol({onSuccess:c});const x=e||m;if(I.useEffect(()=>{if(!b&&v&&v.length>0){const[S]=v;y(S)}Vu(u,x).then(S=>{g(S)}).catch(S=>{console.error("Error loading provider info: ",S)})},[v,b,y,u,x]),!e&&!m)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");return b?a:p==null?s.jsx("strong",{children:"Provider not found"}):p.authType==="none"?s.jsx(cl,{provider:x,consumerRef:t,consumerName:r,setSelectedConnection:y,selectedConnection:b,groupRef:n,groupName:o,children:a}):p.authType==="basic"?s.jsx(rl,{provider:x,consumerRef:t,consumerName:r,setSelectedConnection:y,selectedConnection:b,groupRef:n,groupName:o,children:a}):p.authType==="apiKey"?s.jsx(Zd,{provider:x,consumerRef:t,consumerName:r,setSelectedConnection:y,selectedConnection:b,groupRef:n,groupName:o,children:a}):s.jsx(Gu,{provider:x,providerInfo:p,consumerRef:t,consumerName:r,groupRef:n,groupName:o,setSelectedConnection:y,selectedConnection:b})}function Xu({integration:e,consumerRef:t,consumerName:r,groupRef:n,groupName:o,onInstallSuccess:a,onUpdateSuccess:c}){var g;const{projectId:u}=V(),{errorState:p}=Je();return(g=p[G.INTEGRATION_LIST])!=null&&g.apiError?s.jsx(Pe,{message:"Something went wrong, couldn't find integration information"}):s.jsx(Mc,{integration:e,consumerRef:t,consumerName:r,groupRef:n,groupName:o,onInstallSuccess:a,onUpdateSuccess:c,children:s.jsx(Qo,{groupRef:n,children:s.jsx(Li,{consumerRef:t,consumerName:r,groupRef:n,groupName:o,children:s.jsx(id,{projectId:u,children:s.jsx(Gd,{children:s.jsx(yd,{children:s.jsx(xd,{children:s.jsx(qd,{})})})})})})})})}function Yu({redirectURL:e,children:t}){return I.useEffect(()=>{e&&window.location.replace(e)},[e]),e?s.jsx(w.Box,{display:"flex",alignItems:"center",justifyContent:"center",children:s.jsx(Te,{message:"Redirecting..."})}):t}function Zu({provider:e}){const{appName:t}=V(),r=`You have successfully connected your ${de(e)} account to ${t}.`;return s.jsx(Ci,{text:r})}function Qu({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:o,redirectUrl:a,onSuccess:c}){return s.jsx(Qo,{provider:e,groupRef:n,children:s.jsx(Li,{provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:o,onSuccess:c,children:s.jsx(Yu,{redirectURL:a,children:s.jsx(Zu,{provider:e})})})})}const ep=(e,t)=>{const r=X(),{projectId:n}=V(),{integrations:o}=Go(),[a,c]=I.useState(!1),[u,p]=I.useState(null);if(!r||!n)throw new Error("useIsIntegrationInstalled must be used within AmpersandProvider");if(!e)throw new Error("useIsIntegrationInstalled requires an integration name");if(!t)throw new Error("useIsIntegrationInstalled requires a groupRef");const g=I.useMemo(()=>o==null?void 0:o.reduce((m,b)=>(b==null?void 0:b.name)===e?b:m,{}),[o,e]);return I.useEffect(()=>{g&&H().installationApi.listInstallations({projectIdOrName:n,integrationId:g.id,groupRef:t},{headers:{"x-api-key":r}}).then(m=>{c(!0),p(m.length>0)}).catch(m=>{console.error("Error listing installations: ",m),c(!0)})},[t,r,n,g]),{isLoaded:a,isIntegrationInstalled:u}};exports.AmpersandContext=Xo;exports.AmpersandProvider=Dc;exports.ConnectProvider=Qu;exports.InstallIntegration=Xu;exports.useAmpersandProvider=Bc;exports.useIsIntegrationInstalled=ep;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),I=require("react"),y=require("@chakra-ui/react"),$o=require("@emotion/react"),li=require("@emotion/styled"),qo={warning:{bg:"red.50",outlineColor:"red.800",outline:"2px solid",outlineOffset:"0",borderColor:"red.800",color:"red.800",_hover:{bg:"red.100"}}},Wo=y.extendTheme({components:{Tabs:{baseStyle:{tab:{width:"100%",borderRadius:"4px",_hover:{bg:"gray.300"},_selected:{color:"black",fontWeight:"500",bg:"gray.200",border:"none",_hover:{bg:"gray.300"}}},warningTab:{width:"100%",borderRadius:"4px",_hover:{bg:"red.200"},_selected:{color:"red.800",fontWeight:"500",bg:"red.100",border:"none",_hover:{bg:"red.200"}}}}},Button:{variants:qo}}}),zo=y.extendTheme(y.withDefaultColorScheme({colorScheme:"facebook",components:["Button"]}),Wo);function Jo({children:e}){return s.jsx(y.ChakraProvider,{theme:zo,children:e})}const Ei=I.createContext(null),Ho=Ei.Provider,Z=()=>{const e=I.useContext(Ei);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var V=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e))(V||{});const Fi=I.createContext(void 0);function We(){const e=I.useContext(Fi);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Xo=(()=>{const e={};return Object.values(V).forEach(t=>{e[t]={}}),e})();function Go({children:e}){const[t,r]=I.useState(Xo),n=I.useCallback((h,m)=>{r(v=>{const w={...v};return w[h]=w[h]||{},w[h][m]=!0,w})},[r]),i=I.useCallback((h,m)=>{var v;return!!((v=t[h])!=null&&v[m])},[t]),a=I.useCallback((h,m)=>{r(v=>{var b;const w={...v};return(b=w[h])==null||delete b[m],w})},[r]),c=I.useCallback(h=>{r(m=>{const v={...m};return v[h]={},v})},[r]),u=I.useCallback((h,m)=>{r(v=>{const w={...v};return w[h]=w[h]||{},m.forEach(b=>{w[h][b]=!0}),w})},[r]),p=I.useMemo(()=>({errorState:t,setErrorState:r,setError:n,isError:i,removeError:a,resetBoundary:c,setErrors:u}),[t,r,n,i,a,c,u]);return s.jsx(Fi.Provider,{value:p,children:e})}function Ce({message:e}){return s.jsx(y.Box,{className:"loading-icon",height:"100%",width:"100%",display:"flex",justifyContent:"center",marginTop:"20%",marginBottom:"20%",children:s.jsxs(y.Stack,{alignItems:"center",children:[s.jsx(y.Spinner,{height:"100px",width:"100px",alignSelf:"center",thickness:"8px",speed:"1s",emptyColor:"gray.200",color:"blue.500",size:"xl",margin:"20px"}),e&&s.jsx(y.Text,{fontSize:"40px",color:"#4299e1",children:e})]})})}function Fe({message:e}){return s.jsxs(y.Box,{minHeight:"300px",padding:"30px",display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"center",children:[s.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("path",{d:"M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]}),s.jsx(y.Box,{boxSizing:"border-box",display:"flex",justifyContent:"center",alignItems:"center","align-self":"stretch",padding:"12px 50px 12px 50px",borderRadius:"8px",border:"2px solid #FECACA",background:"#FEF2F2",children:s.jsx(y.Text,{color:"#991B1B",fontSize:"md",children:e})})]})}const Vo="https://api.withampersand.com/v1".replace(/\/+$/,"");class Pi{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Vo}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Di}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const Yo=new Pi,Ar=class Ar{constructor(t=Yo){this.configuration=t,this.fetchApi=async(r,n)=>{let i={url:r,init:n};for(const c of this.middleware)c.pre&&(i=await c.pre({fetch:this.fetchApi,...i})||i);let a;try{a=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(c){for(const u of this.middleware)u.onError&&(a=await u.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:c,response:a?a.clone():void 0})||a);if(a===void 0)throw c instanceof Error?new ta(c,"The request failed and the interceptors did not return an alternative response"):c}for(const c of this.middleware)c.post&&(a=await c.post({fetch:this.fetchApi,url:i.url,init:i.init,response:a.clone()})||a);return a},this.middleware=t.middleware}withMiddleware(...t){const r=this.clone();return r.middleware=r.middleware.concat(...t),r}withPreMiddleware(...t){const r=t.map(n=>({pre:n}));return this.withMiddleware(...r)}withPostMiddleware(...t){const r=t.map(n=>({post:n}));return this.withMiddleware(...r)}isJsonMime(t){return t?Ar.jsonRegex.test(t):!1}async request(t,r){const{url:n,init:i}=await this.createFetchParams(t,r),a=await this.fetchApi(n,i);if(a&&a.status>=200&&a.status<300)return a;throw new ea(a,"Response returned an error code")}async createFetchParams(t,r){let n=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(n+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(h=>i[h]===void 0?delete i[h]:{});const a=typeof r=="function"?r:async()=>r,c={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},u={...c,...await a({init:c,context:t})},p={...u,body:Qo(u.body)||u.body instanceof URLSearchParams||Zo(u.body)?u.body:JSON.stringify(u.body)};return{url:n,init:p}}clone(){const t=this.constructor,r=new t(this.configuration);return r.middleware=this.middleware.slice(),r}};Ar.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let oe=Ar;function Zo(e){return typeof Blob<"u"&&e instanceof Blob}function Qo(e){return typeof FormData<"u"&&e instanceof FormData}class ea extends Error{constructor(t,r){super(r),this.response=t,this.name="ResponseError"}}class ta extends Error{constructor(t,r){super(r),this.cause=t,this.name="FetchError"}}class _ extends Error{constructor(t,r){super(r),this.field=t,this.name="RequiredError"}}function T(e,t){const r=e[t];return r!=null}function Di(e,t=""){return Object.keys(e).map(r=>Bi(r,e[r],t)).filter(r=>r.length>0).join("&")}function Bi(e,t,r=""){const n=r+(r.length?`[${e}]`:e);if(t instanceof Array){const i=t.map(a=>encodeURIComponent(String(a))).join(`&${encodeURIComponent(n)}=`);return`${encodeURIComponent(n)}=${i}`}if(t instanceof Set){const i=Array.from(t);return Bi(e,i,r)}return t instanceof Date?`${encodeURIComponent(n)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Di(t,n):`${encodeURIComponent(n)}=${encodeURIComponent(String(t))}`}function Qn(e,t){return Object.keys(e).reduce((r,n)=>({...r,[n]:t(e[n])}),{})}class L{constructor(t,r=n=>n){this.raw=t,this.transformer=r}async value(){return this.transformer(await this.raw.json())}}class Pe{constructor(t){this.raw=t}async value(){}}class ra{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function na(e){return ia(e)}function ia(e,t){return e==null?e:{fieldUsed:T(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:T(e,"keyFormat")?e.keyFormat:void 0}}function oa(e){return aa(e)}function aa(e,t){return e==null?e:{name:e.name,valuePrefix:T(e,"valuePrefix")?e.valuePrefix:void 0}}function sa(e){return ca(e)}function ca(e,t){return e==null?e:{name:e.name}}function da(e){return la(e)}function la(e,t){return e==null?e:{attachmentType:e.attachmentType,query:T(e,"query")?sa(e.query):void 0,header:T(e,"header")?oa(e.header):void 0,docsURL:T(e,"docsURL")?e.docsURL:void 0}}function ua(e){return pa(e)}function pa(e,t){return e}function fa(e){return ha(e)}function ha(e,t){return e==null?e:{days:T(e,"days")?e.days:void 0,fullHistory:T(e,"fullHistory")?e.fullHistory:void 0}}function Li(e){return ga(e)}function ga(e,t){return e==null?e:{defaultPeriod:fa(e.defaultPeriod)}}function ma(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function ya(e){if(e!==void 0)return e===null?null:{defaultPeriod:ma(e.defaultPeriod)}}function wa(e){return Ia(e)}function Ia(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function Ki(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function va(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedFieldMappings:e.selectedFieldMappings,backfill:ya(e.backfill)}}function ba(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Qn(e.objects,va)}}function Sa(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function xa(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Qn(e.objects,Sa)}}function Oa(e){return Ca(e)}function Ca(e,t){return e==null?e:{apiKeyAsBasic:T(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:T(e,"apiKeyAsBasicOpts")?na(e.apiKeyAsBasicOpts):void 0,docsURL:T(e,"docsURL")?e.docsURL:void 0}}function Mi(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl}}function gr(e){return Na(e)}function Na(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:T(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0}}function Ta(e){return Ra(e)}function Ra(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Aa(e){return _a(e)}function _a(e,t){return e==null?e:{provider:e.provider,read:T(e,"read")?e.read:void 0,write:T(e,"write")?e.write:void 0,proxy:T(e,"proxy")?wa(e.proxy):void 0}}function Ui(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:Ki(e.proxy)}}function ja(e){return ka(e)}function ka(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Aa(e.content)}}function Ea(e){return Fa(e)}function Fa(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0}}function $i(e){return Pa(e)}function Pa(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0}}function Ir(e){return Da(e)}function Da(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:T(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:T(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0}}function vr(e){return Ba(e)}function Ba(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:Ir(e.providerApp),group:$i(e.group),consumer:Ea(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:T(e,"ProviderConsumerRef")?e.ProviderConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0}}function La(e){if(e!==void 0)return e===null?null:{consumerRef:e.consumerRef,consumerName:e.consumerName}}function Ka(e){if(e!==void 0)return e===null?null:{url:e.url,headers:e.headers}}function Ma(e){if(e!==void 0)return e===null?null:{name:e.name,type:e.type,metadata:Ka(e.metadata)}}function Ua(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,groupName:e.groupName}}function $a(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Ui(e.content)}}function qa(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:$a(e.config)}}function Wa(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl}}function za(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Wa(e.latestRevision)}}function Ja(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Ha(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Xa(e){return Ga(e)}function Ga(e,t){return e==null?e:{url:T(e,"url")?e.url:void 0,headers:T(e,"headers")?e.headers:void 0}}function Va(e){if(e!==void 0)return e===null?null:{url:e.url,headers:e.headers}}function mr(e){return Ya(e)}function Ya(e,t){return e==null?e:{id:e.id,name:e.name,type:e.type,metadata:Xa(e.metadata),createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0}}function Za(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Qa(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function es(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function ts(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,groupName:e.groupName,groupRef:e.groupRef,consumerName:e.consumerName,consumerRef:e.consumerRef,provider:e.provider,apiKey:e.apiKey,basicAuth:Za(e.basicAuth),oauth2ClientCredentials:Qa(e.oauth2ClientCredentials),oauth2Password:es(e.oauth2Password)}}function rs(e){return ns(e)}function ns(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function is(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName}}function qi(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:T(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:T(e,"default")?e.default:void 0,prompt:T(e,"prompt")?e.prompt:void 0}}function Bn(e){return os(e)}function os(e,t){return e==null?e:{...is(e),...qi(e)}}function Wi(e){return as(e)}function as(e,t){return e}function ss(e){return cs(e)}function cs(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,destination:e.destination,schedule:e.schedule,requiredFields:T(e,"requiredFields")?e.requiredFields.map(Bn):void 0,optionalFields:T(e,"optionalFields")?e.optionalFields.map(Bn):void 0,optionalFieldsAuto:T(e,"optionalFieldsAuto")?Wi(e.optionalFieldsAuto):void 0,allFields:T(e,"allFields")?e.allFields.map(Bn):void 0,backfill:T(e,"backfill")?Li(e.backfill):void 0}}function ds(e){return ls(e)}function ls(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(ss):void 0}}function us(e){return ps(e)}function ps(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function fs(e){return hs(e)}function hs(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(us):void 0}}function gs(e){return ms(e)}function ms(e,t){return e==null?e:{name:e.name,displayName:T(e,"displayName")?e.displayName:void 0,provider:e.provider,read:T(e,"read")?ds(e.read):void 0,write:T(e,"write")?fs(e.write):void 0,proxy:T(e,"proxy")?rs(e.proxy):void 0}}function ys(e){return ws(e)}function ws(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:gs(e.content)}}function Is(e){if(e!==void 0)return e===null?null:{providerAppId:e.providerAppId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:e.providerConsumerRef,refreshToken:e.refreshToken,scopes:e.scopes}}function vs(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:Ui(e.content)}}function bs(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:Is(e.connection),config:vs(e.config)}}function $t(e){return Ss(e)}function Ss(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:T(e,"group")?$i(e.group):void 0,healthStatus:e.healthStatus,connection:vr(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0,config:ja(e.config)}}function xs(e){return Os(e)}function Os(e,t){return e==null?e:{enabled:T(e,"enabled")?e.enabled:void 0}}function Cs(e,t){return e==null?e:{fieldName:e.fieldName}}function ui(e){return Ns(e)}function Ns(e,t){return e==null?e:{...Cs(e),...qi(e)}}function Ts(e){return Rs(e)}function Rs(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,requiredFields:T(e,"requiredFields")?e.requiredFields.map(ui):void 0,optionalFields:T(e,"optionalFields")?e.optionalFields.map(ui):void 0,optionalFieldsAuto:T(e,"optionalFieldsAuto")?Wi(e.optionalFieldsAuto):void 0,backfill:T(e,"backfill")?Li(e.backfill):void 0}}function As(e){return _s(e)}function _s(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(Ts):void 0}}function js(e){return ks(e)}function ks(e,t){return e==null?e:{objectName:e.objectName}}function Es(e){return Fs(e)}function Fs(e,t){return e==null?e:{objects:T(e,"objects")?e.objects.map(js):void 0}}function Ps(e){return Ds(e)}function Ds(e,t){return e==null?e:{name:e.name,displayName:T(e,"displayName")?e.displayName:void 0,provider:e.provider,read:T(e,"read")?As(e.read):void 0,write:T(e,"write")?Es(e.write):void 0,proxy:T(e,"proxy")?xs(e.proxy):void 0}}function Bs(e){return Ls(e)}function Ls(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Ps(e.content)}}function pi(e){return Ks(e)}function Ks(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:T(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Bs(e.latestRevision)}}function Ms(e){return Us(e)}function Us(e,t){return e==null?e:{msg:e.msg,operationEventId:T(e,"operation_event_id")?e.operation_event_id:void 0,operationId:T(e,"operation_id")?e.operation_id:void 0}}function $s(e){return qs(e)}function qs(e,t){return e==null?e:{timestamp:e.timestamp,message:Ms(e.message),severity:e.severity}}function Ws(e){return zs(e)}function zs(e,t){return e==null?e:{iconURL:T(e,"iconURL")?e.iconURL:void 0,logoURL:T(e,"logoURL")?e.logoURL:void 0}}function Js(e){return Hs(e)}function Hs(e,t){return e==null?e:{iconURL:T(e,"iconURL")?e.iconURL:void 0,logoURL:T(e,"logoURL")?e.logoURL:void 0}}function Xs(e){return Gs(e)}function Gs(e,t){return e==null?e:{regular:T(e,"regular")?Js(e.regular):void 0,darkMode:T(e,"darkMode")?Ws(e.darkMode):void 0}}function Vs(e){return Ys(e)}function Ys(e,t){return e==null?e:{workspaceRefField:T(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:T(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:T(e,"scopesField")?e.scopesField:void 0}}function Zs(e){return Qs(e)}function Qs(e,t){return e==null?e:{grantType:e.grantType,authURL:T(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:T(e,"audience")?e.audience:void 0,tokenMetadataFields:Vs(e.tokenMetadataFields),docsURL:T(e,"docsURL")?e.docsURL:void 0,authURLParams:T(e,"authURLParams")?e.authURLParams:void 0}}function ec(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider}}function fi(e){return tc(e)}function tc(e,t){return e==null?e:{projectId:e.projectId,integrationId:e.integrationId,configId:e.configId,actionType:e.actionType,id:e.id,installationId:e.installationId,status:e.status,result:T(e,"result")?e.result:void 0,latestOperationEventId:T(e,"latestOperationEventId")?e.latestOperationEventId:void 0,metadata:T(e,"metadata")?e.metadata:void 0,createTime:T(e,"createTime")?new Date(e.createTime):void 0}}function rc(e){return nc(e)}function nc(e,t){return e==null?e:{bulkWrite:Ta(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function hi(e){return ic(e)}function ic(e,t){return e==null?e:{name:e.name,authType:ua(e.authType),baseURL:e.baseURL,oauth2Opts:T(e,"oauth2Opts")?Zs(e.oauth2Opts):void 0,apiKeyOpts:T(e,"apiKeyOpts")?da(e.apiKeyOpts):void 0,basicOpts:T(e,"basicOpts")?Oa(e.basicOpts):void 0,support:rc(e.support),providerOpts:e.providerOpts,displayName:T(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:T(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:T(e,"media")?Xs(e.media):void 0,labels:T(e,"labels")?e.labels:void 0}}function oc(e){return ac(e)}function ac(e,t){return e==null?e:{url:e.url,bucket:e.bucket,path:e.path}}function sc(e){if(e!==void 0)return e===null?null:{name:e.name,metadata:Va(e.metadata)}}function cc(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,destination:sc(e.destination)}}function dc(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:ba(e.read),write:xa(e.write),proxy:Ki(e.proxy)}}function lc(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:dc(e.content)}}function uc(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:lc(e.config)}}function pc(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:uc(e.installation)}}function fc(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function hc(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:fc(e.project)}}function gc(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function mc(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:gc(e.providerApp)}}class yc extends oe{async generateConnectionRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:n,body:ts(t.generateConnectionParams)},r);return new L(a,c=>vr(c))}async generateConnection(t,r){return await(await this.generateConnectionRaw(t,r)).value()}async getConnectionRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new _("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:i,query:n},r);return new L(a,c=>vr(c))}async getConnection(t,r){return await(await this.getConnectionRaw(t,r)).value()}async listConnectionsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const n={};t.provider!==void 0&&(n.provider=t.provider),t.groupRef!==void 0&&(n.groupRef=t.groupRef),t.consumerRef!==void 0&&(n.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:n},r);return new L(a,c=>c.map(vr))}async listConnections(t,r){return await(await this.listConnectionsRaw(t,r)).value()}}class wc extends oe{async createConsumerRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createConsumer.");if(t.consumer===null||t.consumer===void 0)throw new _("consumer","Required parameter requestParameters.consumer was null or undefined when calling createConsumer.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/consumers".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:n,body:La(t.consumer)},r);return new Pe(a)}async createConsumer(t,r){await this.createConsumerRaw(t,r)}}class Ic extends oe{async createDestinationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createDestination.");if(t.destination===null||t.destination===void 0)throw new _("destination","Required parameter requestParameters.destination was null or undefined when calling createDestination.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/destinations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:n,body:Ma(t.destination)},r);return new L(a,c=>mr(c))}async createDestination(t,r){return await(await this.createDestinationRaw(t,r)).value()}async deleteDestinationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteDestination.");if(t.destinationId===null||t.destinationId===void 0)throw new _("destinationId","Required parameter requestParameters.destinationId was null or undefined when calling deleteDestination.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/destinations/{destinationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{destinationId}",encodeURIComponent(String(t.destinationId))),method:"DELETE",headers:i,query:n},r);return new Pe(a)}async deleteDestination(t,r){await this.deleteDestinationRaw(t,r)}async getDestinationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getDestination.");if(t.destinationName===null||t.destinationName===void 0)throw new _("destinationName","Required parameter requestParameters.destinationName was null or undefined when calling getDestination.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/destinations/{destinationName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{destinationName}",encodeURIComponent(String(t.destinationName))),method:"GET",headers:i,query:n},r);return new L(a,c=>mr(c))}async getDestination(t,r){return await(await this.getDestinationRaw(t,r)).value()}async listDestinationsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listDestinations.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/destinations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:n},r);return new L(a,c=>c.map(mr))}async listDestinations(t,r){return await(await this.listDestinationsRaw(t,r)).value()}async updateDestinationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateDestination.");if(t.destinationId===null||t.destinationId===void 0)throw new _("destinationId","Required parameter requestParameters.destinationId was null or undefined when calling updateDestination.");if(t.destinationUpdate===null||t.destinationUpdate===void 0)throw new _("destinationUpdate","Required parameter requestParameters.destinationUpdate was null or undefined when calling updateDestination.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/destinations/{destinationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{destinationId}",encodeURIComponent(String(t.destinationId))),method:"PATCH",headers:i,query:n,body:cc(t.destinationUpdate)},r);return new L(a,c=>mr(c))}async updateDestination(t,r){return await(await this.updateDestinationRaw(t,r)).value()}}class vc extends oe{async createGroupRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createGroup.");if(t.group===null||t.group===void 0)throw new _("group","Required parameter requestParameters.group was null or undefined when calling createGroup.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/groups".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:n,body:Ua(t.group)},r);return new Pe(a)}async createGroup(t,r){await this.createGroupRaw(t,r)}}class bc extends oe{async createInstallationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new _("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:n,body:qa(t.installation)},r);return new L(a,c=>$t(c))}async createInstallation(t,r){return await(await this.createInstallationRaw(t,r)).value()}async deleteInstallationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new _("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:i,query:n},r);return new Pe(a)}async deleteInstallation(t,r){await this.deleteInstallationRaw(t,r)}async getInstallationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new _("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:i,query:n},r);return new L(a,c=>$t(c))}async getInstallation(t,r){return await(await this.getInstallationRaw(t,r)).value()}async importInstallationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new _("installation","Required parameter requestParameters.installation was null or undefined when calling importInstallation.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations:import".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:n,body:bs(t.installation)},r);return new L(a,c=>$t(c))}async importInstallation(t,r){return await(await this.importInstallationRaw(t,r)).value()}async listInstallationsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const n={};t.groupRef!==void 0&&(n.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:i,query:n},r);return new L(a,c=>c.map($t))}async listInstallations(t,r){return await(await this.listInstallationsRaw(t,r)).value()}async updateInstallationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new _("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new _("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:i,query:n,body:pc(t.installationUpdate)},r);return new L(a,c=>$t(c))}async updateInstallation(t,r){return await(await this.updateInstallationRaw(t,r)).value()}}class Sc extends oe{async batchUpsertIntegrationsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:n,body:Mi(t.batchUpsertIntegrationsRequest)},r);return new L(a,c=>c.map(pi))}async batchUpsertIntegrations(t,r){return await(await this.batchUpsertIntegrationsRaw(t,r)).value()}async createIntegrationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new _("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:n,body:za(t.integration)},r);return new Pe(a)}async createIntegration(t,r){await this.createIntegrationRaw(t,r)}async deleteIntegrationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:i,query:n},r);return new Pe(a)}async deleteIntegration(t,r){await this.deleteIntegrationRaw(t,r)}async listIntegrationsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:n},r);return new L(a,c=>c.map(pi))}async listIntegrations(t,r){return await(await this.listIntegrationsRaw(t,r)).value()}}class xc extends oe{async oauthConnectRaw(t,r){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new _("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const n={},i={};i["Content-Type"]="application/json";const a=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:n,body:ec(t.connectOAuthParams)},r);return this.isJsonMime(a.headers.get("content-type"))?new L(a):new ra(a)}async oauthConnect(t,r){return await(await this.oauthConnectRaw(t,r)).value()}}class Oc extends oe{async getOperationRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getOperation.");if(t.operationId===null||t.operationId===void 0)throw new _("operationId","Required parameter requestParameters.operationId was null or undefined when calling getOperation.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/operations/{operationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{operationId}",encodeURIComponent(String(t.operationId))),method:"GET",headers:i,query:n},r);return new L(a,c=>fi(c))}async getOperation(t,r){return await(await this.getOperationRaw(t,r)).value()}async listOperationLogsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listOperationLogs.");if(t.operationId===null||t.operationId===void 0)throw new _("operationId","Required parameter requestParameters.operationId was null or undefined when calling listOperationLogs.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/operations/{operationId}/logs".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{operationId}",encodeURIComponent(String(t.operationId))),method:"GET",headers:i,query:n},r);return new L(a,c=>c.map($s))}async listOperationLogs(t,r){return await(await this.listOperationLogsRaw(t,r)).value()}async listOperationsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listOperations.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listOperations.");if(t.installationId===null||t.installationId===void 0)throw new _("installationId","Required parameter requestParameters.installationId was null or undefined when calling listOperations.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}/operations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:i,query:n},r);return new L(a,c=>c.map(fi))}async listOperations(t,r){return await(await this.listOperationsRaw(t,r)).value()}}class Cc extends oe{async createProjectRaw(t,r){if(t.project===null||t.project===void 0)throw new _("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects",method:"POST",headers:i,query:n,body:Ja(t.project)},r);return new L(a,c=>gr(c))}async createProject(t,r){return await(await this.createProjectRaw(t,r)).value()}async deleteProjectRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:n},r);return new Pe(a)}async deleteProject(t,r){await this.deleteProjectRaw(t,r)}async getProjectRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:n},r);return new L(a,c=>gr(c))}async getProject(t,r){return await(await this.getProjectRaw(t,r)).value()}async listProjectsRaw(t){const r={},n={};this.configuration&&this.configuration.apiKey&&(n["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"GET",headers:n,query:r},t);return new L(i,a=>a.map(gr))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new _("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:n,body:hc(t.projectUpdate)},r);return new L(a,c=>gr(c))}async updateProject(t,r){return await(await this.updateProjectRaw(t,r)).value()}}class Nc extends oe{async getProviderRaw(t,r){if(t.provider===null||t.provider===void 0)throw new _("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:n},r);return new L(a,c=>hi(c))}async getProvider(t,r){return await(await this.getProviderRaw(t,r)).value()}async listProvidersRaw(t){const r={},n={};this.configuration&&this.configuration.apiKey&&(n["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers",method:"GET",headers:n,query:r},t);return new L(i,a=>Qn(a,hi))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Tc extends oe{async createProviderAppRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new _("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:n,body:Ha(t.providerApp)},r);return new L(a,c=>Ir(c))}async createProviderApp(t,r){return await(await this.createProviderAppRaw(t,r)).value()}async deleteProviderAppRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new _("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:i,query:n},r);return new Pe(a)}async deleteProviderApp(t,r){await this.deleteProviderAppRaw(t,r)}async listProviderAppsRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const n={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:n},r);return new L(a,c=>c.map(Ir))}async listProviderApps(t,r){return await(await this.listProviderAppsRaw(t,r)).value()}async updateProviderAppRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new _("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new _("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:i,query:n,body:mc(t.providerAppUpdate)},r);return new L(a,c=>Ir(c))}async updateProviderApp(t,r){return await(await this.updateProviderAppRaw(t,r)).value()}}class Rc extends oe{async createRevisionRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const n={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:n,body:Mi(t.revision)},r);return new Pe(a)}async createRevision(t,r){await this.createRevisionRaw(t,r)}async getHydratedRevisionRaw(t,r){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new _("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new _("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new _("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new _("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const n={};t.connectionId!==void 0&&(n.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const a=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:i,query:n},r);return new L(a,c=>ys(c))}async getHydratedRevision(t,r){return await(await this.getHydratedRevisionRaw(t,r)).value()}}class Ac extends oe{async generateUploadUrlRaw(t){const r={},n={};this.configuration&&this.configuration.apiKey&&(n["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/generate-upload-url",method:"GET",headers:n,query:r},t);return new L(i,a=>oc(a))}async generateUploadUrl(t){return await(await this.generateUploadUrlRaw(t)).value()}}class _c{constructor(t){this.connectionApi=new yc(t),this.consumerApi=new wc(t),this.destinationApi=new Ic(t),this.groupApi=new vc(t),this.installationApi=new bc(t),this.integrationApi=new Sc(t),this.oAuthApi=new xc(t),this.operationApi=new Oc(t),this.projectApi=new Cc(t),this.providerApi=new Nc(t),this.providerAppApi=new Tc(t),this.revisionApi=new Rc(t),this.uploadURLApi=new Ac(t)}}const jc="1.9.0-rc.1",kc="v1",yr="https://api.withampersand.com";function zi(){try{const e=process.env.REACT_APP_AMP_SERVER;switch(e){case"local":return"http://localhost:8080";case"dev":return"https://dev-api.withampersand.com";case"staging":return"https://staging-api.withampersand.com";case"prod":return yr;case"mock":return"http://127.0.0.1:4010";case"":return yr;default:return e??yr}}catch{return yr}}const Ec=(e,t)=>`${e}/${t}`;function Fc(){return Ec(zi(),kc)}const Pc=zi(),Dc=Fc(),Bc=new Pi({basePath:Dc,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":jc}});let Lc=new _c(Bc);const H=()=>Lc,Ji=I.createContext({integrations:null}),Hi=()=>{const e=I.useContext(Ji);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function Kc({projectIdOrName:e,children:t}){const r=Z(),{setError:n,isError:i}=We(),[a,c]=I.useState(null),[u,p]=I.useState(!0);I.useEffect(()=>{H().integrationApi.listIntegrations({projectIdOrName:e},{headers:{"X-Api-Key":r??""}}).then(m=>{p(!1),c(m||[])}).catch(m=>{p(!1),n(V.INTEGRATION_LIST,e),console.error("Error retrieving integration information for : ",m)})},[e,r,n]);const h=I.useMemo(()=>({integrations:a}),[a]);return i(V.INTEGRATION_LIST,e)?s.jsx(Fe,{message:"Error retrieving integrations for the project, double check the API key"}):s.jsx(Ji.Provider,{value:h,children:u?s.jsx(Ce,{}):t})}const Xi=I.createContext({project:null,appName:"",projectId:"",projectIdOrName:""}),Y=()=>{const e=I.useContext(Xi);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Mc({projectIdOrName:e,children:t}){const r=Z(),{isError:n,setError:i}=We(),[a,c]=I.useState(null),[u,p]=I.useState(!0);I.useEffect(()=>{H().projectApi.getProject({projectIdOrName:e},{headers:{"X-Api-Key":r??""}}).then(m=>{p(!1),c(m)}).catch(m=>{i(V.PROJECT,e),p(!1),console.error("Error loading Ampersand project: ",m)})},[e,r,p,i]);const h=I.useMemo(()=>({projectId:(a==null?void 0:a.id)||"",projectIdOrName:e,project:a,appName:(a==null?void 0:a.appName)||""}),[e,a]);return n(V.PROJECT,e)?s.jsx(Fe,{message:`Error loading project ${e}`}):s.jsx(Xi.Provider,{value:h,children:u?s.jsx(Ce,{}):t})}function Uc(e){const{options:{apiKey:t,projectId:r,project:n},children:i}=e,a=n||r;if(r&&n)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!a)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return s.jsx(Jo,{children:s.jsx(Go,{children:s.jsx(Ho,{value:t,children:s.jsx(Mc,{projectIdOrName:a,children:s.jsx(Kc,{projectIdOrName:a,children:i})})})})})}const Gi=I.createContext(null);function $c(){const e=I.useContext(Gi);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
2
|
+
component is wrapped with AmpersandProvider`);return e}function Vi(e){return e.charAt(0).toUpperCase()+e.slice(1)}function st(e,t){return(t==null?void 0:t.displayName)??Vi(e)}const Yi=e=>e.split(`
|
|
3
|
+
`).filter(r=>r.trim()!==""),qc=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(r=>r.name===e)??null,Zi=I.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0});function Ne(){const e=I.useContext(Zi);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Wc({children:e,integration:t,consumerRef:r,consumerName:n,groupRef:i,groupName:a,onInstallSuccess:c,onUpdateSuccess:u}){const p=Z(),{projectId:h}=Y(),{integrations:m}=Hi(),[v,w]=I.useState([]),[b,x]=I.useState(!0),{setError:S,isError:O}=We(),A=(v==null?void 0:v[0])||null,N=I.useMemo(()=>qc(t,m||[]),[t,m]);I.useEffect(()=>{N===null&&(m!=null&&m.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,N,m]);const P=I.useCallback(q=>{w([q])},[w]),K=I.useCallback(()=>{N!=null&&N.id&&H().installationApi.listInstallations({projectIdOrName:h,integrationId:N.id,groupRef:i},{headers:{"X-Api-Key":p??""}}).then(q=>{x(!1),w(q||[])}).catch(q=>{S(V.INSTALLATION_LIST,N.id),x(!1),console.error("Error retrieving installation information: ",q)})},[N,h,p,S,i]),M=(N==null?void 0:N.id)||"";I.useEffect(()=>{K()},[K]);const Q=I.useMemo(()=>({integrationId:(N==null?void 0:N.id)||"",provider:(N==null?void 0:N.provider)||"",integrationObj:N,consumerRef:r,consumerName:n,groupRef:i,groupName:a,installation:A,setInstallation:P,resetInstallations:K,onInstallSuccess:c,onUpdateSuccess:u}),[N,r,n,i,a,A,P,K,c,u]);if(N!==null){const q=`Error retrieving installation information for integration "${(N==null?void 0:N.name)||"unknown"}"`;return O(V.INSTALLATION_LIST,M)?s.jsx(Fe,{message:q}):s.jsx(Zi.Provider,{value:Q,children:b?s.jsx(Ce,{}):e})}return s.jsx(Fe,{message:`Integration "${t}" not found`})}const Qi=I.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),xt=()=>{const e=I.useContext(Qi);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function eo({provider:e,groupRef:t,children:r}){const n=Z(),{projectId:i}=Y(),[a,c]=I.useState(null),[u,p]=I.useState(null),[h,m]=I.useState(!0),{setError:v,isError:w}=We(),{provider:b}=Ne();if(!i)throw new Error("ConnectionsProvider must be used within AmpersandProvider");const x=e||b;if(!x)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");I.useEffect(()=>{H().connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:x},{headers:{"X-Api-Key":n??""}}).then(O=>{m(!1),c(O)}).catch(O=>{m(!1),v(V.CONNECTION_LIST,i),console.error(`Error retrieving existing OAuth connections for group ID ${t}:`,O)})},[i,n,t,x,v]);const S=I.useMemo(()=>({connections:a,selectedConnection:u,setConnections:c,setSelectedConnection:p}),[a,u,c,p]);return w(V.CONNECTION_LIST,i)?s.jsx(Fe,{message:"Error retrieving existing connections"}):s.jsx(Qi.Provider,{value:S,children:h?s.jsx(Ce,{}):r})}var $e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ei(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xr={exports:{}};xr.exports;(function(e,t){var r=200,n="__lodash_hash_undefined__",i=1,a=2,c=9007199254740991,u="[object Arguments]",p="[object Array]",h="[object AsyncFunction]",m="[object Boolean]",v="[object Date]",w="[object Error]",b="[object Function]",x="[object GeneratorFunction]",S="[object Map]",O="[object Number]",A="[object Null]",N="[object Object]",P="[object Promise]",K="[object Proxy]",M="[object RegExp]",Q="[object Set]",q="[object String]",ne="[object Symbol]",G="[object Undefined]",he="[object WeakMap]",Te="[object ArrayBuffer]",ct="[object DataView]",Br="[object Float32Array]",Lr="[object Float64Array]",Kr="[object Int8Array]",Mr="[object Int16Array]",Ur="[object Int32Array]",$r="[object Uint8Array]",qr="[object Uint8ClampedArray]",Wr="[object Uint16Array]",zr="[object Uint32Array]",Jr=/[\\^$.*+?()[\]{}|]/g,U=/^\[object .+?Constructor\]$/,Yt=/^(?:0|[1-9]\d*)$/,$={};$[Br]=$[Lr]=$[Kr]=$[Mr]=$[Ur]=$[$r]=$[qr]=$[Wr]=$[zr]=!0,$[u]=$[p]=$[Te]=$[m]=$[ct]=$[v]=$[w]=$[b]=$[S]=$[O]=$[N]=$[M]=$[Q]=$[q]=$[he]=!1;var De=typeof $e=="object"&&$e&&$e.Object===Object&&$e,Zt=typeof self=="object"&&self&&self.Object===Object&&self,ie=De||Zt||Function("return this")(),Ct=t&&!t.nodeType&&t,dt=Ct&&!0&&e&&!e.nodeType&&e,Nt=dt&&dt.exports===Ct,lt=Nt&&De.process,Qt=function(){try{return lt&<.binding&<.binding("util")}catch{}}(),er=Qt&&Qt.isTypedArray;function Hr(l,o){for(var d=-1,f=l==null?0:l.length,C=0,R=[];++d<f;){var j=l[d];o(j,d,l)&&(R[C++]=j)}return R}function Xr(l,o){for(var d=-1,f=o.length,C=l.length;++d<f;)l[C+d]=o[d];return l}function Gr(l,o){for(var d=-1,f=l==null?0:l.length;++d<f;)if(o(l[d],d,l))return!0;return!1}function Vr(l,o){for(var d=-1,f=Array(l);++d<l;)f[d]=o(d);return f}function Yr(l){return function(o){return l(o)}}function ut(l,o){return l.has(o)}function Tt(l,o){return l==null?void 0:l[o]}function pt(l){var o=-1,d=Array(l.size);return l.forEach(function(f,C){d[++o]=[C,f]}),d}function be(l,o){return function(d){return l(o(d))}}function tr(l){var o=-1,d=Array(l.size);return l.forEach(function(f){d[++o]=f}),d}var rr=Array.prototype,Zr=Function.prototype,ft=Object.prototype,Be=ie["__core-js_shared__"],Rt=Zr.toString,se=ft.hasOwnProperty,At=function(){var l=/[^.]+$/.exec(Be&&Be.keys&&Be.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""}(),_t=ft.toString,Qr=RegExp("^"+Rt.call(se).replace(Jr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nr=Nt?ie.Buffer:void 0,le=ie.Symbol,ze=ie.Uint8Array,ir=ft.propertyIsEnumerable,or=rr.splice,Re=le?le.toStringTag:void 0,jt=Object.getOwnPropertySymbols,Je=nr?nr.isBuffer:void 0,en=be(Object.keys,Object),ge=Ke(ie,"DataView"),He=Ke(ie,"Map"),kt=Ke(ie,"Promise"),Et=Ke(ie,"Set"),Ft=Ke(ie,"WeakMap"),Xe=Ke(Object,"create"),me=Ie(ge),tn=Ie(He),rn=Ie(kt),nn=Ie(Et),on=Ie(Ft),ar=le?le.prototype:void 0,Se=ar?ar.valueOf:void 0;function Ae(l){var o=-1,d=l==null?0:l.length;for(this.clear();++o<d;){var f=l[o];this.set(f[0],f[1])}}function an(){this.__data__=Xe?Xe(null):{},this.size=0}function sn(l){var o=this.has(l)&&delete this.__data__[l];return this.size-=o?1:0,o}function cn(l){var o=this.__data__;if(Xe){var d=o[l];return d===n?void 0:d}return se.call(o,l)?o[l]:void 0}function dn(l){var o=this.__data__;return Xe?o[l]!==void 0:se.call(o,l)}function Le(l,o){var d=this.__data__;return this.size+=this.has(l)?0:1,d[l]=Xe&&o===void 0?n:o,this}Ae.prototype.clear=an,Ae.prototype.delete=sn,Ae.prototype.get=cn,Ae.prototype.has=dn,Ae.prototype.set=Le;function ye(l){var o=-1,d=l==null?0:l.length;for(this.clear();++o<d;){var f=l[o];this.set(f[0],f[1])}}function ln(){this.__data__=[],this.size=0}function un(l){var o=this.__data__,d=mt(o,l);if(d<0)return!1;var f=o.length-1;return d==f?o.pop():or.call(o,d,1),--this.size,!0}function pn(l){var o=this.__data__,d=mt(o,l);return d<0?void 0:o[d][1]}function fn(l){return mt(this.__data__,l)>-1}function hn(l,o){var d=this.__data__,f=mt(d,l);return f<0?(++this.size,d.push([l,o])):d[f][1]=o,this}ye.prototype.clear=ln,ye.prototype.delete=un,ye.prototype.get=pn,ye.prototype.has=fn,ye.prototype.set=hn;function we(l){var o=-1,d=l==null?0:l.length;for(this.clear();++o<d;){var f=l[o];this.set(f[0],f[1])}}function gn(){this.size=0,this.__data__={hash:new Ae,map:new(He||ye),string:new Ae}}function ht(l){var o=Ye(this,l).delete(l);return this.size-=o?1:0,o}function Pt(l){return Ye(this,l).get(l)}function mn(l){return Ye(this,l).has(l)}function gt(l,o){var d=Ye(this,l),f=d.size;return d.set(l,o),this.size+=d.size==f?0:1,this}we.prototype.clear=gn,we.prototype.delete=ht,we.prototype.get=Pt,we.prototype.has=mn,we.prototype.set=gt;function Ge(l){var o=-1,d=l==null?0:l.length;for(this.__data__=new we;++o<d;)this.add(l[o])}function yn(l){return this.__data__.set(l,n),this}function wn(l){return this.__data__.has(l)}Ge.prototype.add=Ge.prototype.push=yn,Ge.prototype.has=wn;function xe(l){var o=this.__data__=new ye(l);this.size=o.size}function sr(){this.__data__=new ye,this.size=0}function In(l){var o=this.__data__,d=o.delete(l);return this.size=o.size,d}function vn(l){return this.__data__.get(l)}function bn(l){return this.__data__.has(l)}function Sn(l,o){var d=this.__data__;if(d instanceof ye){var f=d.__data__;if(!He||f.length<r-1)return f.push([l,o]),this.size=++d.size,this;d=this.__data__=new we(f)}return d.set(l,o),this.size=d.size,this}xe.prototype.clear=sr,xe.prototype.delete=In,xe.prototype.get=vn,xe.prototype.has=bn,xe.prototype.set=Sn;function xn(l,o){var d=Ze(l),f=!d&&Fn(l),C=!d&&!f&&vt(l),R=!d&&!f&&!C&&Ut(l),j=d||f||C||R,F=j?Vr(l.length,String):[],k=F.length;for(var E in l)se.call(l,E)&&!(j&&(E=="length"||C&&(E=="offset"||E=="parent")||R&&(E=="buffer"||E=="byteLength"||E=="byteOffset")||jn(E,k)))&&F.push(E);return F}function mt(l,o){for(var d=l.length;d--;)if(It(l[d][0],o))return d;return-1}function On(l,o,d){var f=o(l);return Ze(l)?f:Xr(f,d(l))}function Ve(l){return l==null?l===void 0?G:A:Re&&Re in Object(l)?An(l):Lt(l)}function cr(l){return Qe(l)&&Ve(l)==u}function dr(l,o,d,f,C){return l===o?!0:l==null||o==null||!Qe(l)&&!Qe(o)?l!==l&&o!==o:yt(l,o,d,f,dr,C)}function yt(l,o,d,f,C,R){var j=Ze(l),F=Ze(o),k=j?p:ue(l),E=F?p:ue(o);k=k==u?N:k,E=E==u?N:E;var W=k==N,z=E==N,X=k==E;if(X&&vt(l)){if(!vt(o))return!1;j=!0,W=!1}if(X&&!W)return R||(R=new xe),j||Ut(l)?Bt(l,o,d,f,C,R):Tn(l,o,k,d,f,C,R);if(!(d&i)){var te=W&&se.call(l,"__wrapped__"),re=z&&se.call(o,"__wrapped__");if(te||re){var ve=te?l.value():l,je=re?o.value():o;return R||(R=new xe),C(ve,je,d,f,R)}}return X?(R||(R=new xe),Rn(l,o,d,f,C,R)):!1}function Dt(l){if(!Mt(l)||En(l))return!1;var o=Me(l)?Qr:U;return o.test(Ie(l))}function Cn(l){return Qe(l)&&ur(l.length)&&!!$[Ve(l)]}function Nn(l){if(!wt(l))return en(l);var o=[];for(var d in Object(l))se.call(l,d)&&d!="constructor"&&o.push(d);return o}function Bt(l,o,d,f,C,R){var j=d&i,F=l.length,k=o.length;if(F!=k&&!(j&&k>F))return!1;var E=R.get(l);if(E&&R.get(o))return E==o;var W=-1,z=!0,X=d&a?new Ge:void 0;for(R.set(l,o),R.set(o,l);++W<F;){var te=l[W],re=o[W];if(f)var ve=j?f(re,te,W,o,l,R):f(te,re,W,l,o,R);if(ve!==void 0){if(ve)continue;z=!1;break}if(X){if(!Gr(o,function(je,et){if(!ut(X,et)&&(te===je||C(te,je,d,f,R)))return X.push(et)})){z=!1;break}}else if(!(te===re||C(te,re,d,f,R))){z=!1;break}}return R.delete(l),R.delete(o),z}function Tn(l,o,d,f,C,R,j){switch(d){case ct:if(l.byteLength!=o.byteLength||l.byteOffset!=o.byteOffset)return!1;l=l.buffer,o=o.buffer;case Te:return!(l.byteLength!=o.byteLength||!R(new ze(l),new ze(o)));case m:case v:case O:return It(+l,+o);case w:return l.name==o.name&&l.message==o.message;case M:case q:return l==o+"";case S:var F=pt;case Q:var k=f&i;if(F||(F=tr),l.size!=o.size&&!k)return!1;var E=j.get(l);if(E)return E==o;f|=a,j.set(l,o);var W=Bt(F(l),F(o),f,C,R,j);return j.delete(l),W;case ne:if(Se)return Se.call(l)==Se.call(o)}return!1}function Rn(l,o,d,f,C,R){var j=d&i,F=lr(l),k=F.length,E=lr(o),W=E.length;if(k!=W&&!j)return!1;for(var z=k;z--;){var X=F[z];if(!(j?X in o:se.call(o,X)))return!1}var te=R.get(l);if(te&&R.get(o))return te==o;var re=!0;R.set(l,o),R.set(o,l);for(var ve=j;++z<k;){X=F[z];var je=l[X],et=o[X];if(f)var di=j?f(et,je,X,o,l,R):f(je,et,X,l,o,R);if(!(di===void 0?je===et||C(je,et,d,f,R):di)){re=!1;break}ve||(ve=X=="constructor")}if(re&&!ve){var fr=l.constructor,hr=o.constructor;fr!=hr&&"constructor"in l&&"constructor"in o&&!(typeof fr=="function"&&fr instanceof fr&&typeof hr=="function"&&hr instanceof hr)&&(re=!1)}return R.delete(l),R.delete(o),re}function lr(l){return On(l,Pn,_n)}function Ye(l,o){var d=l.__data__;return kn(o)?d[typeof o=="string"?"string":"hash"]:d.map}function Ke(l,o){var d=Tt(l,o);return Dt(d)?d:void 0}function An(l){var o=se.call(l,Re),d=l[Re];try{l[Re]=void 0;var f=!0}catch{}var C=_t.call(l);return f&&(o?l[Re]=d:delete l[Re]),C}var _n=jt?function(l){return l==null?[]:(l=Object(l),Hr(jt(l),function(o){return ir.call(l,o)}))}:Dn,ue=Ve;(ge&&ue(new ge(new ArrayBuffer(1)))!=ct||He&&ue(new He)!=S||kt&&ue(kt.resolve())!=P||Et&&ue(new Et)!=Q||Ft&&ue(new Ft)!=he)&&(ue=function(l){var o=Ve(l),d=o==N?l.constructor:void 0,f=d?Ie(d):"";if(f)switch(f){case me:return ct;case tn:return S;case rn:return P;case nn:return Q;case on:return he}return o});function jn(l,o){return o=o??c,!!o&&(typeof l=="number"||Yt.test(l))&&l>-1&&l%1==0&&l<o}function kn(l){var o=typeof l;return o=="string"||o=="number"||o=="symbol"||o=="boolean"?l!=="__proto__":l===null}function En(l){return!!At&&At in l}function wt(l){var o=l&&l.constructor,d=typeof o=="function"&&o.prototype||ft;return l===d}function Lt(l){return _t.call(l)}function Ie(l){if(l!=null){try{return Rt.call(l)}catch{}try{return l+""}catch{}}return""}function It(l,o){return l===o||l!==l&&o!==o}var Fn=cr(function(){return arguments}())?cr:function(l){return Qe(l)&&se.call(l,"callee")&&!ir.call(l,"callee")},Ze=Array.isArray;function Kt(l){return l!=null&&ur(l.length)&&!Me(l)}var vt=Je||pr;function _e(l,o){return dr(l,o)}function Me(l){if(!Mt(l))return!1;var o=Ve(l);return o==b||o==x||o==h||o==K}function ur(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=c}function Mt(l){var o=typeof l;return l!=null&&(o=="object"||o=="function")}function Qe(l){return l!=null&&typeof l=="object"}var Ut=er?Yr(er):Cn;function Pn(l){return Kt(l)?xn(l):Nn(l)}function Dn(){return[]}function pr(){return!1}e.exports=_e})(xr,xr.exports);var zc=xr.exports;const Jc=ei(zc),it="other";function qe(e){return e.mapToName!==void 0}function Hc(e,t){var r;return((r=e==null?void 0:e.objects)==null?void 0:r.find(n=>n.objectName===t))||null}function Xc(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(r=>!qe(r)&&!!r.fieldName))||null}function Gc(e){var r;return((r=e==null?void 0:e.requiredFields)==null?void 0:r.filter(n=>qe(n)&&!!n.mapToName))||[]}function Vc(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(r=>!qe(r)&&!!r.fieldName))||null}const to=(e,t)=>{var r,n,i;return(i=(n=(r=e==null?void 0:e.content)==null?void 0:r.read)==null?void 0:n.objects)==null?void 0:i[t]};function Yc(e){return qe(e)?e.mapToName:e.fieldName}const ro=(e,t)=>{var n,i,a;const r=[];return(a=(i=(n=t.content)==null?void 0:n.read)==null?void 0:i.objects)==null||a.forEach(c=>{r.push({name:c==null?void 0:c.objectName,completed:e?!!to(e,c.objectName):!1})}),r},no=e=>{var r;return{name:it,completed:e?!!((r=e==null?void 0:e.content)!=null&&r.write):!1}};function Zc(e,t){var a;const r=ro(e,t),i=!!((a=t==null?void 0:t.content)!=null&&a.write)?no(e):void 0;return i&&r.push(i),r}function io(e,t,r){const n=(e==null?void 0:e.filter(a=>!(t!=null&&t[a==null?void 0:a.mapToName])))||[],i=n.map(a=>a.mapToName);return r(V.MAPPING,i),n!=null&&n.length&&console.error("required fields not met",n.map(a=>a.mapToDisplayName)),{errorList:i}}function ti(e,t){return Jc(e,t)}const Qc=(e,t,r)=>{var b,x,S,O,A,N;if(!e)return null;const n=Hc(e,t),i=n&&Xc(n),a=n&&Vc(n),c=n&&Gc(n),u=(n==null?void 0:n.allFields)||[],p=r==null?void 0:r.content,h=((S=(x=(b=p==null?void 0:p.read)==null?void 0:b.objects)==null?void 0:x[t])==null?void 0:S.selectedFields)||{},m=((N=(A=(O=p==null?void 0:p.read)==null?void 0:O.objects)==null?void 0:A[t])==null?void 0:N.selectedFieldMappings)||{},v={...h},w={...m};return{allFields:u,requiredFields:i,optionalFields:a,requiredMapFields:c,selectedOptionalFields:h,selectedFieldMappings:m,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:v,requiredMapFields:w}}},ed=(e,t)=>{var c,u;if(!e)return null;const r=(u=(c=t==null?void 0:t.content)==null?void 0:c.write)==null?void 0:u.objects,n=Object.keys(r||{}),i={};n.forEach(p=>{i[p]=!0});const a={...i};return{writeObjects:(e==null?void 0:e.objects)||[],selectedNonConfigurableWriteFields:i,isWriteModified:!1,savedConfig:{selectedNonConfigurableWriteFields:a}}};function oo(e,t,r){var a,c;const n=(a=e==null?void 0:e.content)==null?void 0:a.read,i=(c=e==null?void 0:e.content)==null?void 0:c.write;return{read:Qc(n,t,r),write:ed(i,r)}}const ao=(e,t,r,n)=>{const i=oo(e,r,t);n(r,i)},td=(e,t,r)=>{const n=Zc(t,e),i={};n.forEach(({name:a,completed:c})=>{c&&(i[a]=oo(e,a,t))}),r(i)},so=e=>{const{requiredFields:t,selectedOptionalFields:r}=(e==null?void 0:e.read)||{},n=new Set;return t==null||t.forEach(a=>n.add(Yc(a))),{...Array.from(n).reduce((a,c)=>({...a,[c]:!0}),{}),...r||{}}},co=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},r={};return t&&Object.keys(t).forEach(n=>{t[n]!==void 0?r[n]=t[n]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${n}`)}),r};function lo(e,t){return t[e]||void 0}function ri({createConfig:e,projectId:t,integrationId:r,groupRef:n,connectionId:i,apiKey:a,setInstallation:c,onInstallSuccess:u}){const p={projectIdOrName:t,integrationId:r,installation:{groupRef:n,connectionId:i,config:e}};return H().installationApi.createInstallation(p,{headers:{"X-Api-Key":a,"Content-Type":"application/json"}}).then(h=>{c(h),u==null||u(h.id,h.config)}).catch(h=>{console.error("ERROR: ",h)})}function _r(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const rd=(e,t)=>{const r=e.content.read,n=r==null?void 0:r.objects;return n==null?void 0:n.find(i=>i.objectName===t)},nd=(e,t,r,n)=>{const i=so(e),a=co(e),c=rd(r,t);if(!c)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const u={revisionId:r.id,createdBy:`consumer:${n}`,content:{provider:r.content.provider,read:{objects:{[t]:{objectName:t,schedule:c.schedule,destination:c.destination,selectedFields:i,selectedFieldMappings:a,backfill:c.backfill}}}}};return _r(r)&&(u.content.proxy={enabled:!0}),u},id=(e,t,r,n,i,a,c,u,p,h,m)=>{const v=nd(p,a,u,n);return v?ri({createConfig:v,projectId:e,integrationId:t,groupRef:r,connectionId:i,apiKey:c,setInstallation:h,onInstallSuccess:m}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},uo=e=>{var a,c;const t={},r=(a=e.write)==null?void 0:a.writeObjects,n=(c=e.write)==null?void 0:c.selectedNonConfigurableWriteFields,i=n?Object.keys(n):[];return r&&r.forEach(u=>{const p=u.objectName;i.includes(p)&&(t[p]={objectName:p})}),t},od=e=>{const t=e.content.write;return t==null?void 0:t.objects},ad=(e,t,r)=>{if(!od(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=uo(e),a={revisionId:t.id,createdBy:`consumer:${r}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return _r(t)&&(a.content.proxy={enabled:!0}),a},sd=(e,t,r,n,i,a,c,u,p,h)=>{const m=ad(u,c,n);return m?ri({createConfig:m,projectId:e,integrationId:t,groupRef:r,connectionId:i,apiKey:a,setInstallation:p,onInstallSuccess:h}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))};function cd(){return s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),s.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const po="uninstall-installation",dd=I.forwardRef(({text:e="Uninstall"},t)=>{const r=y.useTab({ref:t}),n=y.useMultiStyleConfig("Tabs",r);return s.jsxs(y.Button,{__css:n.warningTab,...r,minHeight:15,children:[s.jsxs(y.Box,{as:"span",display:"flex",alignItems:"center",gap:2,my:2,mx:4,children:[cd(),s.jsx(y.Box,{textAlign:"left",children:s.jsx(y.Text,{color:"red.800",children:e})})]}),r.children]})}),fo=I.createContext({hydratedRevision:null,loading:!1}),Xt=()=>{const e=I.useContext(fo);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function ld({projectId:e,children:t}){var P;const{selectedConnection:r}=xt(),{integrationId:n,integrationObj:i}=Ne(),[a,c]=I.useState(null),[u,p]=I.useState(!0),{isError:h,removeError:m,setError:v}=We(),w=Z(),b=r==null?void 0:r.id,x=(P=i==null?void 0:i.latestRevision)==null?void 0:P.id,S=(i==null?void 0:i.name)||n;I.useEffect(()=>{e&&n&&x&&b&&w&&H().revisionApi.getHydratedRevision({projectIdOrName:e,integrationId:n,revisionId:x,connectionId:b},{headers:{"X-Api-Key":w??""}}).then(K=>{c(K),p(!1),m(V.HYDRATED_REVISION,S)}).catch(K=>{console.error(`Error loading integration ${S}`,K),p(!1),v(V.HYDRATED_REVISION,S)})},[e,n,x,b,w,m,v,S]);const O=I.useMemo(()=>({hydratedRevision:a,loading:u}),[a,u]),N=`Error retrieving integration details for '${(i==null?void 0:i.name)||n||"unknown integration"}. This is sometimes caused by insufficient permissions with your credentials'`;return s.jsx(fo.Provider,{value:O,children:h(V.HYDRATED_REVISION,S)?s.jsx(Fe,{message:N}):t})}var ho=Symbol.for("immer-nothing"),gi=Symbol.for("immer-draftable"),ce=Symbol.for("immer-state"),ud=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function ae(e,...t){if(process.env.NODE_ENV!=="production"){const r=ud[e],n=typeof r=="function"?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var bt=Object.getPrototypeOf;function St(e){return!!e&&!!e[ce]}function ot(e){var t;return e?go(e)||Array.isArray(e)||!!e[gi]||!!((t=e.constructor)!=null&&t[gi])||kr(e)||Er(e):!1}var pd=Object.prototype.constructor.toString();function go(e){if(!e||typeof e!="object")return!1;const t=bt(e);if(t===null)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===pd}function Or(e,t){jr(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,n)=>t(n,r,e))}function jr(e){const t=e[ce];return t?t.type_:Array.isArray(e)?1:kr(e)?2:Er(e)?3:0}function $n(e,t){return jr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function mo(e,t,r){const n=jr(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function fd(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function kr(e){return e instanceof Map}function Er(e){return e instanceof Set}function tt(e){return e.copy_||e.base_}function qn(e,t){if(kr(e))return new Map(e);if(Er(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=go(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[ce];let i=Reflect.ownKeys(n);for(let a=0;a<i.length;a++){const c=i[a],u=n[c];u.writable===!1&&(u.writable=!0,u.configurable=!0),(u.get||u.set)&&(n[c]={configurable:!0,writable:!0,enumerable:u.enumerable,value:e[c]})}return Object.create(bt(e),n)}else{const n=bt(e);if(n!==null&&r)return{...e};const i=Object.create(n);return Object.assign(i,e)}}function ni(e,t=!1){return Fr(e)||St(e)||!ot(e)||(jr(e)>1&&(e.set=e.add=e.clear=e.delete=hd),Object.freeze(e),t&&Object.entries(e).forEach(([r,n])=>ni(n,!0))),e}function hd(){ae(2)}function Fr(e){return Object.isFrozen(e)}var gd={};function at(e){const t=gd[e];return t||ae(0,e),t}var Jt;function yo(){return Jt}function md(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function mi(e,t){t&&(at("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Wn(e){zn(e),e.drafts_.forEach(yd),e.drafts_=null}function zn(e){e===Jt&&(Jt=e.parent_)}function yi(e){return Jt=md(Jt,e)}function yd(e){const t=e[ce];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function wi(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[ce].modified_&&(Wn(t),ae(4)),ot(e)&&(e=Cr(t,e),t.parent_||Nr(t,e)),t.patches_&&at("Patches").generateReplacementPatches_(r[ce].base_,e,t.patches_,t.inversePatches_)):e=Cr(t,r,[]),Wn(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==ho?e:void 0}function Cr(e,t,r){if(Fr(t))return t;const n=t[ce];if(!n)return Or(t,(i,a)=>Ii(e,n,t,i,a,r)),t;if(n.scope_!==e)return t;if(!n.modified_)return Nr(e,n.base_,!0),n.base_;if(!n.finalized_){n.finalized_=!0,n.scope_.unfinalizedDrafts_--;const i=n.copy_;let a=i,c=!1;n.type_===3&&(a=new Set(i),i.clear(),c=!0),Or(a,(u,p)=>Ii(e,n,i,u,p,r,c)),Nr(e,i,!1),r&&e.patches_&&at("Patches").generatePatches_(n,r,e.patches_,e.inversePatches_)}return n.copy_}function Ii(e,t,r,n,i,a,c){if(process.env.NODE_ENV!=="production"&&i===r&&ae(5),St(i)){const u=a&&t&&t.type_!==3&&!$n(t.assigned_,n)?a.concat(n):void 0,p=Cr(e,i,u);if(mo(r,n,p),St(p))e.canAutoFreeze_=!1;else return}else c&&r.add(i);if(ot(i)&&!Fr(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Cr(e,i),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,n)&&Nr(e,i)}}function Nr(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&ni(t,r)}function wd(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:yo(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=n,a=ii;r&&(i=[n],a=Ht);const{revoke:c,proxy:u}=Proxy.revocable(i,a);return n.draft_=u,n.revoke_=c,u}var ii={get(e,t){if(t===ce)return e;const r=tt(e);if(!$n(r,t))return Id(e,r,t);const n=r[t];return e.finalized_||!ot(n)?n:n===Ln(e.base_,t)?(Kn(e),e.copy_[t]=Hn(n,e)):n},has(e,t){return t in tt(e)},ownKeys(e){return Reflect.ownKeys(tt(e))},set(e,t,r){const n=wo(tt(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const i=Ln(tt(e),t),a=i==null?void 0:i[ce];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(fd(r,i)&&(r!==void 0||$n(e.base_,t)))return!0;Kn(e),Jn(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Ln(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Kn(e),Jn(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=tt(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){ae(11)},getPrototypeOf(e){return bt(e.base_)},setPrototypeOf(){ae(12)}},Ht={};Or(ii,(e,t)=>{Ht[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Ht.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&ae(13),Ht.set.call(this,e,t,void 0)};Ht.set=function(e,t,r){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&ae(14),ii.set.call(this,e[0],t,r,e[0])};function Ln(e,t){const r=e[ce];return(r?tt(r):e)[t]}function Id(e,t,r){var i;const n=wo(t,r);return n?"value"in n?n.value:(i=n.get)==null?void 0:i.call(e.draft_):void 0}function wo(e,t){if(!(t in e))return;let r=bt(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=bt(r)}}function Jn(e){e.modified_||(e.modified_=!0,e.parent_&&Jn(e.parent_))}function Kn(e){e.copy_||(e.copy_=qn(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var vd=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const a=r;r=t;const c=this;return function(p=a,...h){return c.produce(p,m=>r.call(this,m,...h))}}typeof r!="function"&&ae(6),n!==void 0&&typeof n!="function"&&ae(7);let i;if(ot(t)){const a=yi(this),c=Hn(t,void 0);let u=!0;try{i=r(c),u=!1}finally{u?Wn(a):zn(a)}return mi(a,n),wi(i,a)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===ho&&(i=void 0),this.autoFreeze_&&ni(i,!0),n){const a=[],c=[];at("Patches").generateReplacementPatches_(t,i,a,c),n(a,c)}return i}else ae(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(c,...u)=>this.produceWithPatches(c,p=>t(p,...u));let n,i;return[this.produce(t,r,(c,u)=>{n=c,i=u}),n,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ot(e)||ae(8),St(e)&&(e=bd(e));const t=yi(this),r=Hn(e,void 0);return r[ce].isManual_=!0,zn(t),r}finishDraft(e,t){const r=e&&e[ce];(!r||!r.isManual_)&&ae(9);const{scope_:n}=r;return mi(n,t),wi(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));const n=at("Patches").applyPatches_;return St(e)?n(e,t):this.produce(e,i=>n(i,t))}};function Hn(e,t){const r=kr(e)?at("MapSet").proxyMap_(e,t):Er(e)?at("MapSet").proxySet_(e,t):wd(e,t);return(t?t.scope_:yo()).drafts_.push(r),r}function bd(e){return St(e)||ae(10,e),Io(e)}function Io(e){if(!ot(e)||Fr(e))return e;const t=e[ce];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=qn(e,t.scope_.immer_.useStrictShallowCopy_)}else r=qn(e,!0);return Or(r,(n,i)=>{mo(r,n,Io(i))}),t&&(t.finalized_=!1),r}var de=new vd,qt=de.produce;de.produceWithPatches.bind(de);de.setAutoFreeze.bind(de);de.setUseStrictShallowCopy.bind(de);de.applyPatches.bind(de);de.createDraft.bind(de);de.finishDraft.bind(de);const vo=I.createContext(void 0),Sd={};function oi(){const e=I.useContext(vo);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function xd({children:e}){const{installation:t}=Ne(),{hydratedRevision:r,loading:n}=Xt(),[i,a]=I.useState(Sd),c=t==null?void 0:t.config;I.useEffect(()=>{r!=null&&r.content&&!n&&c&&!(Object.entries(i).length>0)&&td(r,c,a)},[r,n,c,i]);const u=I.useCallback((b,x)=>{a(S=>qt(S,O=>{O[b]=qt(O[b],x)}))},[a]),p=I.useCallback((b,x)=>{a(S=>qt(S,O=>{O[b]=x}))},[a]),h=I.useCallback(()=>{a(qt(b=>{const x=b.other.write;x&&(x.isWriteModified=!1)}))},[a]),m=I.useCallback(b=>{a(qt(x=>{var O;const S=(O=x[b])==null?void 0:O.read;S&&(S.isOptionalFieldsModified=!1,S.isRequiredMapFieldsModified=!1)}))},[a]),v=I.useCallback(b=>{b===it?h():m(b)},[m,h]),w=I.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:a,setConfigureState:u,resetConfigureState:p,resetPendingConfigurationState:v}),[i,p,v,u]);return s.jsx(vo.Provider,{value:w,children:e})}const Od=s.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[s.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),s.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function Cd(e,t){return t?I.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},I.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?Od:s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:s.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}const bo=I.forwardRef(({objectName:e,completed:t,pending:r,displayName:n},i)=>{const a=y.useTab({ref:i}),c=y.useMultiStyleConfig("Tabs",a);return s.jsxs(y.Button,{__css:c.tab,...a,variant:"outline",minHeight:15,children:[s.jsxs(y.Box,{as:"span",display:"flex",alignItems:"center",gap:2,mr:"3",children:[Cd(t,r),s.jsxs(y.Box,{textAlign:"left",children:[s.jsx(y.Text,{children:n||e}),r&&s.jsx(y.Text,{fontSize:10,fontStyle:"italic",children:"pending"})]})]}),a.children]})});function Nd({pending:e,completed:t,displayName:r}){return s.jsxs(s.Fragment,{children:[s.jsx(y.Divider,{marginY:3}),s.jsx(bo,{objectName:it,completed:t,pending:e,displayName:r},"other-write")]})}const So=I.createContext(null);function xo(){const e=I.useContext(So);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}function Td(e,t){return e!=null&&e[t]?e[t]:{name:po,completed:!1}}function Rd({children:e}){var O,A,N;const{project:t}=Y(),{installation:r,provider:n}=Ne(),{hydratedRevision:i}=Xt(),{objectConfigurationsState:a}=oi(),[c,u]=I.useState(0),p=(t==null?void 0:t.appName)||"",h=r==null?void 0:r.config,m=i&&ro(h,i),v=m!==null,w=!!((O=i==null?void 0:i.content)!=null&&O.write),b=w?no(h):void 0,x=[...m||[]];b&&w&&x.push(b);const S=Td(x,c);return s.jsx(So.Provider,{value:S==null?void 0:S.name,children:s.jsxs(y.Box,{p:8,maxWidth:"55rem",border:"1px solid #EFEFEF",borderRadius:6,boxShadow:"md",margin:"auto",bgColor:"whitesmoke",display:"flex",gap:"6",minHeight:"100%",color:"gray.800",fontSize:"md",children:[s.jsxs(y.Box,{width:"20rem",children:[s.jsxs(y.Text,{children:[st(n)," integration"]}),s.jsx(y.Text,{marginBottom:"20px",fontSize:"1.125rem",fontWeight:"500",children:p}),v&&s.jsxs(y.Tabs,{index:c,onChange:u,orientation:"horizontal",children:[m.map(P=>{var K,M,Q,q;return s.jsx(bo,{objectName:P.name,completed:P.completed,pending:((M=(K=a[P.name])==null?void 0:K.read)==null?void 0:M.isOptionalFieldsModified)||((q=(Q=a[P.name])==null?void 0:Q.read)==null?void 0:q.isRequiredMapFieldsModified)},P.name)}),w&&b&&s.jsx(Nd,{completed:b.completed,pending:(N=(A=a==null?void 0:a.other)==null?void 0:A.write)==null?void 0:N.isWriteModified,displayName:m!=null&&m.length?"other":"write"}),r&&s.jsxs(s.Fragment,{children:[s.jsx(y.Divider,{marginTop:10,marginBottom:3}),s.jsx(dd,{text:"Uninstall"},"uninstall-installation")]})]})]}),e]})})}const Ot=()=>{const{appName:e}=Y(),{objectConfigurationsState:t,setConfigureState:r}=oi(),{selectedObjectName:n}=xo(),i=lo(n||"",t);return{appName:e,configureState:i,setConfigureState:r,selectedObjectName:n}};function Ad(e,t,r){var i;const n=((i=e==null?void 0:e.read)==null?void 0:i.selectedFieldMappings)||{};if(n[t]=r,e!=null&&e.read){const a=e.read.savedConfig.requiredMapFields,u=!ti(a,n);e.read.isRequiredMapFieldsModified=u}}function Oo(e,t,r,n){t(e,i=>Ad(i,r,n))}function _d({field:e,onSelectChange:t,allFields:r}){var v;const{configureState:n,selectedObjectName:i,setConfigureState:a}=Ot(),[c,u]=I.useState(!0),p=(v=n==null?void 0:n.read)==null?void 0:v.selectedFieldMappings,h=p==null?void 0:p[e.mapToName];I.useEffect(()=>{e._default&&!h&&i&&n&&Oo(i,a,e.mapToName,e._default),u(!1)},[e,a,i,h,n]);const m=I.useMemo(()=>r==null?void 0:r.map(w=>s.jsx("option",{value:w.fieldName,children:w.displayName},w.fieldName)),[r]);return s.jsxs(y.Stack,{children:[s.jsx(y.Text,{fontWeight:"500",children:e.mapToDisplayName}),s.jsx(y.Text,{marginBottom:"5px",fontSize:14,children:e==null?void 0:e.prompt}),s.jsx(y.Select,{name:e.mapToName,variant:"flushed",value:h||void 0,onChange:t,placeholder:h?void 0:"Please select one",disabled:c,children:m})]},e.mapToName)}function Pr({string:e}){return s.jsxs(y.Flex,{position:"relative",paddingTop:8,paddingBottom:4,children:[s.jsx(y.Heading,{color:"gray.500",as:"h3",fontSize:16,fontWeight:"500",children:e}),s.jsx(y.Flex,{flex:"1",justifyContent:"flex-end",alignItems:"center",children:s.jsx(y.Divider,{marginLeft:2})})]})}function jd(){const{selectedObjectName:e,configureState:t,setConfigureState:r}=Ot(),{isError:n,removeError:i}=We(),a=u=>{const{value:p,name:h}=u.target;p&&(e&&Oo(e,r,h,p),n(V.MAPPING,h)&&i(V.MAPPING,h))},c=I.useMemo(()=>{var u,p;return((p=(u=t==null?void 0:t.read)==null?void 0:u.requiredMapFields)==null?void 0:p.filter(qe))||[]},[t]);return c.length?s.jsxs(y.Box,{children:[s.jsx(Pr,{string:"Map the following fields (required)"}),s.jsx(y.Stack,{children:c.map(u=>{var p;return s.jsxs(y.FormControl,{isInvalid:n(V.MAPPING,u.mapToName),children:[s.jsx(_d,{allFields:((p=t.read)==null?void 0:p.allFields)||[],field:u,onSelectChange:a}),s.jsx(y.FormErrorMessage,{children:" * required"})]},u.mapToName)})})]}):null}function kd(e,t,r){var i,a;const n=((i=e==null?void 0:e.read)==null?void 0:i.selectedOptionalFields)||{};if(n[t]=r,r||delete n[t],(a=e.read)!=null&&a.savedConfig.optionalFields){const c=e.read.savedConfig.optionalFields,p=!ti(c,n);e.read.isOptionalFieldsModified=p}else console.warn("read.savedConfig.optionalFields is undefined")}function vi(e,t,r,n){t(e,i=>kd(i,r,n))}function Ed(){var v,w;const{appName:e,configureState:t,setConfigureState:r,selectedObjectName:n}=Ot(),i=(v=t==null?void 0:t.read)==null?void 0:v.selectedOptionalFields,a=b=>{const{name:x,checked:S}=b.target;n&&t&&vi(n,r,x,S)},c=(w=t==null?void 0:t.read)==null?void 0:w.optionalFields,u=b=>{const{checked:x}=b.target;n&&c&&c.forEach(S=>{qe(S)||vi(n,r,S.fieldName,x)})},p=!!(c&&c.length>0),h=Object.keys(i||{}).length===(c==null?void 0:c.length),m=!h&&Object.keys(i||{}).length>0;return p&&s.jsxs(s.Fragment,{children:[s.jsx(Pr,{string:`${e} reads the following optional fields`}),s.jsxs(y.Stack,{marginBottom:10,maxHeight:300,overflowY:"scroll",border:"2px solid #EFEFEF",borderRadius:8,gap:0,children:[((c==null?void 0:c.length)||0)>=2&&s.jsx(y.Box,{backgroundColor:"gray.50",paddingX:4,paddingY:2,children:s.jsx(y.Checkbox,{name:"selectAll",id:"selectAll",onChange:u,isIndeterminate:m,isChecked:h,children:"Select all"})}),c.map(b=>qe(b)?null:s.jsx(y.Box,{paddingX:4,paddingY:2,borderBottom:"1px",borderColor:"gray.100",children:s.jsx(y.Checkbox,{name:b.fieldName,id:b.fieldName,isChecked:!!(i!=null&&i[b==null?void 0:b.fieldName]),onChange:a,children:b.displayName})},b.fieldName))]})]})}function Fd(){var n,i,a;const{configureState:e,selectedObjectName:t}=Ot(),{appName:r}=Y();return s.jsxs(s.Fragment,{children:[s.jsx(Pr,{string:`${r} reads the following ${t} fields`}),s.jsx(y.Box,{marginBottom:"20px",display:"flex",gap:1,children:(i=(n=e==null?void 0:e.read)==null?void 0:n.requiredFields)!=null&&i.length?(a=e.read)==null?void 0:a.requiredFields.map(c=>qe(c)?null:s.jsx(y.Tag,{children:c.displayName},c.fieldName)):"There are no required fields."})]})}function Pd(){return s.jsxs(s.Fragment,{children:[s.jsx(Fd,{}),s.jsx(jd,{}),s.jsx(Ed,{})]})}function Dd(e,t,r){var n,i,a;if(((n=e==null?void 0:e.write)==null?void 0:n.selectedNonConfigurableWriteFields)===null&&(e.write.selectedNonConfigurableWriteFields={}),e!=null&&e.write){const c=e.write.selectedNonConfigurableWriteFields;if(c[t]=r,r||delete c[t],(a=(i=e==null?void 0:e.write)==null?void 0:i.savedConfig)!=null&&a.selectedNonConfigurableWriteFields){const u=e.write.savedConfig.selectedNonConfigurableWriteFields,h=!ti(u,c);e.write.isWriteModified=h}}}function bi(e,t,r,n){t(e,i=>{Dd(i,r,n)})}function Bd(){var v,w,b,x;const{appName:e,selectedObjectName:t,configureState:r,setConfigureState:n}=Ot(),i=(v=r==null?void 0:r.write)==null?void 0:v.selectedNonConfigurableWriteFields,a=(w=r==null?void 0:r.write)==null?void 0:w.writeObjects,c=S=>{const{name:O,checked:A}=S.target;t&&r&&bi(t,n,O,A)},u=S=>{var A,N;const{checked:O}=S.target;t&&r&&((N=(A=r==null?void 0:r.write)==null?void 0:A.writeObjects)==null||N.forEach(P=>{bi(t,n,P.objectName,O)}))},p=!!a,h=Object.keys(i||{}).length===((x=(b=r==null?void 0:r.write)==null?void 0:b.writeObjects)==null?void 0:x.length),m=!h&&Object.keys(i||{}).length>0;return p&&s.jsxs(s.Fragment,{children:[s.jsx(Pr,{string:`Allow ${e} to write to these object`}),s.jsxs(y.Stack,{marginBottom:10,maxHeight:300,overflowY:"scroll",border:"2px solid #EFEFEF",borderRadius:8,gap:0,children:[((a==null?void 0:a.length)||0)>=2&&s.jsx(y.Box,{backgroundColor:"gray.50",paddingX:4,paddingY:2,children:s.jsx(y.Checkbox,{name:"selectAll",id:"selectAll",onChange:u,isIndeterminate:m,isChecked:h,children:"Select all"})}),a.map(S=>s.jsx(y.Box,{display:"flex",alignItems:"center",borderBottom:"1px",borderColor:"gray.100",paddingX:4,paddingY:2,children:s.jsx(y.Checkbox,{name:S.objectName,id:S.objectName,onChange:c,isChecked:!!(i!=null&&i[S.objectName]),children:S.displayName})},S.objectName))]})]})}function Ld(){const e=Z(),{projectId:t,appName:r}=Y(),{integrationId:n,installation:i,resetInstallations:a}=Ne(),[c,u]=I.useState(!1),p=!t||!n||!(i!=null&&i.id)||c,h=async()=>{if(!p){u(!0),console.warn("uninstalling installation",{projectId:t,integrationId:n,installationId:i.id});try{await H().installationApi.deleteInstallation({projectIdOrName:t,integrationId:n,installationId:i.id},{headers:{"X-Api-Key":e,"Content-Type":"application/json"}}),a(),console.warn("successfully uninstalled installation: ",i.id)}catch(w){console.error("error uninstalling installation",w)}finally{u(!1)}}},m=c?"Uninstalling...":"Yes, uninstall",v=i!=null&&i.id?`Once you uninstall this integration, all your configuration will be lost, and "${r}" may stop working.`:"You've successfully uninstalled the integration.";return s.jsxs(y.Stack,{children:[s.jsx(y.Text,{paddingBottom:3,children:v}),(i==null?void 0:i.id)&&s.jsx(y.Button,{onClick:h,variant:"warning",isDisabled:p,children:m})]})}function Co({onSave:e,onReset:t,isLoading:r,isCreateMode:n=!1}){var P,K,M;const{installation:i}=Ne(),{hydratedRevision:a,loading:c}=Xt(),{configureState:u,selectedObjectName:p}=Ot(),h=i==null?void 0:i.config,m=h&&p&&!!to(h,p)||!1,v=((P=u==null?void 0:u.read)==null?void 0:P.isOptionalFieldsModified)||((K=u==null?void 0:u.read)==null?void 0:K.isRequiredMapFieldsModified),w=(M=u==null?void 0:u.write)==null?void 0:M.isWriteModified,O=c||r||!u||!p||!(v||w||n||p!==it&&!m),A=p===it,N=p===po;return r?s.jsx(Ce,{}):s.jsxs("form",{style:{width:"100%",maxWidth:"50rem"},onSubmit:e,children:[s.jsxs(y.Stack,{direction:"row",spacing:4,marginBottom:"20px",flexDir:"row-reverse",children:[s.jsx(y.Button,{backgroundColor:"gray.800",_hover:{backgroundColor:"gray.600"},type:"submit",isDisabled:O,children:n?"Install":"Save"}),s.jsx(y.Button,{backgroundColor:"gray.200",color:"blackAlpha.700",_hover:{backgroundColor:"gray.300"},isDisabled:O,onClick:t,children:"Reset"})]}),s.jsxs(y.Box,{p:8,width:"100%",border:"1px solid #EFEFEF",borderRadius:8,boxShadow:"md",textAlign:["left"],margin:"auto",bgColor:"white",maxHeight:"100%",overflowY:"scroll",minHeight:300,children:[c&&s.jsx(Ce,{}),a&&!N&&!A&&s.jsx(Pd,{}),a&&!N&&A&&s.jsx(Bd,{}),!c&&N&&s.jsx(Ld,{})]})]})}const No=()=>{const{integrationId:e,groupRef:t,consumerRef:r,setInstallation:n,onInstallSuccess:i,onUpdateSuccess:a}=Ne(),{hydratedRevision:c,loading:u}=Xt(),{selectedObjectName:p}=xo(),{selectedConnection:h}=xt(),m=Z(),{projectId:v}=Y(),{resetBoundary:w,setErrors:b}=We(),{resetConfigureState:x,objectConfigurationsState:S,resetPendingConfigurationState:O}=oi(),A=lo(p||"",S);return{integrationId:e,groupRef:t,consumerRef:r,setInstallation:n,hydratedRevision:c,loading:u,selectedObjectName:p,selectedConnection:h,apiKey:m,projectId:v,resetBoundary:w,setErrors:b,resetConfigureState:x,objectConfigurationsState:S,resetPendingConfigurationState:O,configureState:A,onInstallSuccess:i,onUpdateSuccess:a}},Kd=void 0;function Md(){const{integrationId:e,groupRef:t,consumerRef:r,setInstallation:n,hydratedRevision:i,loading:a,selectedObjectName:c,selectedConnection:u,apiKey:p,projectId:h,resetBoundary:m,setErrors:v,resetConfigureState:w,objectConfigurationsState:b,resetPendingConfigurationState:x,configureState:S,onInstallSuccess:O}=No(),[A,N]=I.useState(!1),P=c===it,K=I.useCallback(()=>{m(V.MAPPING),i!=null&&i.content&&!a&&c&&ao(i,Kd,c,w)},[m,i,a,c,w]);I.useEffect(()=>{!S&&(i!=null&&i.content)&&!a&&K()},[S,b,i,a,K]);const M=()=>{const{requiredMapFields:ne,selectedFieldMappings:G}=(S==null?void 0:S.read)||{},{errorList:he}=io(ne,G,v);he.length>0||(c&&(u!=null&&u.id)&&p&&h&&e&&t&&r&&i?(N(!0),id(h,e,t,r,u.id,c,p,i,S,n,O).finally(()=>{N(!1),x(c)})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},Q=()=>{c&&(u!=null&&u.id)&&p&&h&&e&&t&&r&&i?(N(!0),sd(h,e,t,r,u.id,p,i,S,n,O).finally(()=>{N(!1),x(c)})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},q=ne=>{ne.preventDefault(),P?Q():M()};return s.jsx(Co,{isCreateMode:!0,isLoading:A,onSave:q,onReset:K})}function Ud({updateConfig:e,projectId:t,integrationId:r,installationId:n,apiKey:i,selectedObjectName:a,setInstallation:c,onUpdateSuccess:u}){const p={projectIdOrName:t,installationId:n,integrationId:r,installationUpdate:{updateMask:[`config.content.read.objects.${a}`],installation:{config:e}}};return H().installationApi.updateInstallation(p,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}}).then(h=>{c(h),u==null||u(h.id,h.config)}).catch(h=>{console.error("ERROR: ",h)})}const $d=(e,t,r,n,i)=>{const a=so(e),c=co(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:n,destination:(r==null?void 0:r.destination)||"",selectedFields:a,selectedFieldMappings:c}}}}};return _r(i)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},qd=(e,t,r,n,i,a,c,u,p,h)=>{const m=$d(a,n||"",u,u.schedule,p);return m?Ud({updateConfig:m,projectId:e,integrationId:t,installationId:r,apiKey:i,selectedObjectName:n,setInstallation:c,onUpdateSuccess:h}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},Wd=(e,t)=>{const n={content:{write:{objects:uo(e)}}};return _r(t)&&(n.content||(n.content={}),n.content.proxy={enabled:!0}),n},zd=(e,t,r,n,i,a,c,u)=>{const p=Wd(i,a);if(!p)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const h={projectIdOrName:e,installationId:r,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:p}}};return H().installationApi.updateInstallation(h,{headers:{"X-Api-Key":n,"Content-Type":"application/json"}}).then(m=>{c(m),u==null||u(m.id,m.config)}).catch(m=>{console.error("ERROR: ",m)})};function Jd({installation:e,integrationObj:t}){const{setInstallation:r,hydratedRevision:n,loading:i,selectedObjectName:a,apiKey:c,projectId:u,resetBoundary:p,setErrors:h,resetConfigureState:m,resetPendingConfigurationState:v,configureState:w,onUpdateSuccess:b}=No(),[x,S]=I.useState(!1),O=a===it,{config:A}=e,N=I.useCallback(()=>{p(V.MAPPING),n!=null&&n.content&&!i&&a&&ao(n,A,a,m)},[p,n,i,a,A,m]);I.useEffect(()=>{w||N()},[w,N]),I.useEffect(()=>{e&&N()},[e,N]);const P=I.useMemo(()=>{var ne,G,he;return(he=(G=(ne=n==null?void 0:n.content)==null?void 0:ne.read)==null?void 0:G.objects)==null?void 0:he.find(Te=>(Te==null?void 0:Te.objectName)===a)},[n,a]),K=()=>{const{requiredMapFields:q,selectedFieldMappings:ne}=(w==null?void 0:w.read)||{},{errorList:G}=io(q,ne,h);G.length>0||(n&&e&&a&&c&&u&&P?(S(!0),qd(u,t.id,e.id,a,c,w,r,P,n,b).finally(()=>{S(!1),v(a)})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},M=()=>{e&&a&&c&&u&&n?(S(!0),zd(u,t.id,e.id,c,w,n,r,b).finally(()=>{S(!1),v(a)})):console.error("UpdateInstallation - onSaveUpdate missing required props")},Q=q=>{q.preventDefault(),O?M():K()};return s.jsx(Co,{onSave:Q,onReset:N,isLoading:x})}function Hd(){const{integrationObj:e,installation:t}=Ne();return e?t&&e?s.jsx(Jd,{installation:t,integrationObj:e}):s.jsx(Md,{}):s.jsx(Fe,{message:"We can't load the integration"})}const Xd=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function Gd({projectId:e,integrationId:t,groupRef:r,consumerRef:n,connectionId:i,apiKey:a,hydratedRevision:c,setInstallation:u,onInstallSuccess:p}){const h=Xd(c,n);return h?ri({createConfig:h,projectId:e,integrationId:t,groupRef:r,connectionId:i,apiKey:a,setInstallation:u,onInstallSuccess:p}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function Vd(){return s.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[s.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),s.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function To({text:e}){return s.jsx(y.Container,{children:s.jsxs(y.Box,{p:8,maxWidth:"600px",minHeight:"290px",borderWidth:1,borderRadius:8,boxShadow:"lg",margin:"auto",marginTop:"40px",bgColor:"white",paddingTop:"100px",color:"gray.800",fontSize:"md",children:[s.jsx(y.Box,{width:"100%",display:"flex",alignContent:"center",justifyContent:"center",children:s.jsx(y.Box,{margin:"auto",children:s.jsx(Vd,{})})}),s.jsx(y.Box,{textAlign:"center",paddingTop:"25px",children:e})]})})}function Yd({provider:e}){const t=`You have successfully installed your ${st(e)} integration.`;return s.jsx(To,{text:t})}const Zd=e=>{const{read:t,write:r,proxy:n}=(e==null?void 0:e.content)??{};return!t&&!r&&(n==null?void 0:n.enabled)||!1};function Qd({children:e}){var A;const{projectId:t}=Y(),r=Z(),{hydratedRevision:n,loading:i}=Xt(),{integrationObj:a,installation:c,groupRef:u,consumerRef:p,setInstallation:h,onInstallSuccess:m}=Ne(),{selectedConnection:v}=xt(),[w,b]=I.useState(!1),x=i||w,S=(A=n==null?void 0:n.content)==null?void 0:A.provider,O=Zd(n);return I.useEffect(()=>{!x&&n&&O&&!c&&v&&r&&(a!=null&&a.id)&&(b(!0),Gd({apiKey:r,projectId:t,integrationId:a==null?void 0:a.id,groupRef:u,consumerRef:p,connectionId:v==null?void 0:v.id,hydratedRevision:n,setInstallation:h,onInstallSuccess:m}).then(()=>{b(!1)}).catch(N=>{b(!1),console.error("Error when creating proxy installation:",N)}))},[n,O,c,v,r,t,a==null?void 0:a.id,u,p,h,x,m]),a?x?s.jsx(Ce,{}):O&&S&&c?s.jsx(Yd,{provider:S}):s.jsx("div",{children:e}):s.jsx(Fe,{message:"We can't load the integration"})}function el({children:e}){return s.jsx(y.Container,{children:s.jsx(y.Box,{p:8,maxWidth:"600px",borderWidth:1,borderRadius:8,boxShadow:"lg",textAlign:["left"],margin:"auto",marginTop:"40px",bgColor:"white",color:"gray.800",fontSize:"md",children:e})})}function tl({error:e}){return e?s.jsxs(y.Alert,{status:"error",marginTop:"2em",children:[s.jsx(y.AlertIcon,{}),s.jsx(y.AlertDescription,{children:e})]}):null}function Ro({url:e,providerDisplayName:t,credentialName:r}){return s.jsxs(y.Text,{align:"left",color:"darkgray",children:[s.jsx(y.Link,{href:e,target:"_blank",rel:"noreferrer",color:"blackAlpha.600",isExternal:!0,children:s.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",r,"."]})}function rl({provider:e,providerInfo:t,handleSubmit:r,error:n,isButtonDisabled:i}){var S;const[a,c]=I.useState(!1),u=()=>c(!a),[p,h]=I.useState(""),m=O=>h(O.currentTarget.value),v=p.length>0,w=i||!v,b=st(e,t),x=(S=t.apiKeyOpts)==null?void 0:S.docsURL;return s.jsx(el,{children:s.jsxs(y.FormControl,{children:[s.jsx(y.FormLabel,{my:"6",children:s.jsx(y.Heading,{as:"h4",size:"md",children:`Set up ${b} integration`})}),s.jsx(tl,{error:n}),s.jsxs(y.Stack,{spacing:4,children:[x&&s.jsx(Ro,{url:x,providerDisplayName:b,credentialName:"API key"}),s.jsxs(y.InputGroup,{size:"md",children:[s.jsx(y.Input,{onChange:m,pr:"4.5rem",type:a?"text":"password",placeholder:"API Key"}),s.jsx(y.InputRightElement,{width:"4.5rem",children:s.jsx(y.Button,{h:"1.75rem",size:"sm",onClick:u,children:a?"Hide":"Show"})})]})]}),s.jsx("br",{}),s.jsx(y.Button,{isDisabled:w,width:"100%",type:"submit",onClick:()=>{r(p)},children:"Next"})]})})}function nl({provider:e,providerInfo:t,consumerRef:r,consumerName:n,groupRef:i,groupName:a,children:c,selectedConnection:u,setSelectedConnection:p}){const h=Y(),[m,v]=I.useState(!1),[w,b]=I.useState(null),x=Z();I.useEffect(()=>{if(e&&H&&m&&w!=null){const O={groupName:a,groupRef:i,consumerName:n,consumerRef:r,provider:e,apiKey:w};H().connectionApi.generateConnection({projectIdOrName:h.projectId,generateConnectionParams:O},{headers:{"X-Api-Key":x??"","Content-Type":"application/json"}}).then(A=>{p(A)}).catch(A=>{console.error("Error loading provider info: ",A)})}},[x,e,m,n,r,a,i,h,p,w]);const S=O=>{b(O),v(!0)};return u===null?s.jsx(rl,{provider:e,providerInfo:t,handleSubmit:S,error:null}):c}function il({children:e}){return s.jsx(y.Container,{children:s.jsx(y.Box,{p:8,maxWidth:"600px",borderWidth:1,borderRadius:8,boxShadow:"lg",textAlign:["left"],margin:"auto",marginTop:"40px",bgColor:"white",color:"gray.800",fontSize:"md",children:e})})}function ol({error:e}){return e?s.jsxs(y.Alert,{status:"error",marginTop:"2em",children:[s.jsx(y.AlertIcon,{}),s.jsx(y.AlertDescription,{children:e})]}):null}function al({provider:e,providerInfo:t,handleSubmit:r,error:n,isButtonDisabled:i}){var N;const[a,c]=I.useState(!1),u=()=>c(!a),[p,h]=I.useState(""),[m,v]=I.useState(""),w=P=>h(P.currentTarget.value),b=P=>v(P.currentTarget.value),x=st(e,t),S=(N=t.basicOpts)==null?void 0:N.docsURL,O=p.length>0,A=i||!O;return s.jsx(il,{children:s.jsxs(y.FormControl,{children:[s.jsx(y.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsx(y.Heading,{as:"h4",size:"md",children:`Set up ${x} integration`})}),s.jsx(ol,{error:n}),s.jsx("br",{}),s.jsxs(y.Stack,{spacing:4,children:[S&&s.jsx(Ro,{url:S,providerDisplayName:x,credentialName:"credentials"}),s.jsx(y.Input,{placeholder:"Username",onChange:w}),s.jsxs(y.InputGroup,{size:"md",children:[s.jsx(y.Input,{onChange:b,pr:"4.5rem",type:a?"text":"password",placeholder:"Password"}),s.jsx(y.InputRightElement,{width:"4.5rem",children:s.jsx(y.Button,{h:"1.75rem",size:"sm",onClick:u,children:a?"Hide":"Show"})})]})]}),s.jsx("br",{}),s.jsx(y.Button,{isDisabled:A,width:"100%",type:"submit",onClick:()=>{r(p,m)},children:"Next"})]})})}function sl({provider:e,providerInfo:t,consumerRef:r,consumerName:n,groupRef:i,groupName:a,children:c,selectedConnection:u,setSelectedConnection:p}){const h=Y(),[m,v]=I.useState(!1),[w,b]=I.useState(null),x=Z();I.useEffect(()=>{if(e&&H&&m&&w!=null){const O={groupName:a,groupRef:i,consumerName:n,consumerRef:r,provider:e,basicAuth:{username:w.user,password:w.pass}};H().connectionApi.generateConnection({projectIdOrName:h.projectId,generateConnectionParams:O},{headers:{"X-Api-Key":x??"","Content-Type":"application/json"}}).then(A=>{p(A)}).catch(A=>{console.error("Error loading provider info: ",A)})}},[x,e,m,n,r,a,i,h,w,p]);const S=(O,A)=>{b({user:O,pass:A}),v(!0)};return u===null?s.jsx(al,{provider:e,providerInfo:t,handleSubmit:S,error:null}):c}function cl(e){const{selectedConnection:t}=xt();I.useEffect(()=>{e&&t&&e(t.id)},[e,t])}function dl({onSuccess:e}){cl(e)}function ll({children:e}){return s.jsx(y.Container,{children:s.jsx(y.Box,{p:8,maxWidth:"600px",borderWidth:1,borderRadius:8,boxShadow:"lg",textAlign:["left"],margin:"auto",marginTop:"40px",bgColor:"white",color:"gray.800",fontSize:"md",children:e})})}function ul({error:e}){return e?s.jsxs(y.Alert,{status:"error",marginTop:"2em",children:[s.jsx(y.AlertIcon,{}),s.jsx(y.AlertDescription,{children:e})]}):null}function pl({handleSubmit:e,error:t,isButtonDisabled:r,providerName:n}){return s.jsx(ll,{children:s.jsxs(y.FormControl,{children:[s.jsx(y.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsx(y.Heading,{as:"h4",size:"md",children:`Set up ${n} integration`})}),s.jsx(ul,{error:t}),s.jsx("br",{}),s.jsx(y.Button,{isDisabled:r,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function fl({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:i,children:a,selectedConnection:c,setSelectedConnection:u,providerName:p}){const h=Y(),m=Z(),[v,w]=I.useState(!1);I.useEffect(()=>{if(e&&H&&v){const x={groupName:i,groupRef:n,consumerName:r,consumerRef:t,provider:e};H().connectionApi.generateConnection({projectIdOrName:h.projectId,generateConnectionParams:x},{headers:{"X-Api-Key":m??"","Content-Type":"application/json"}}).then(S=>{u(S)}).catch(S=>{console.error("Error loading provider info: ",S)})}},[m,e,v,r,t,i,n,u,h]);const b=()=>{w(!0)};return c===null?s.jsx(pl,{handleSubmit:b,error:null,providerName:p}):a}function Gt({children:e}){return s.jsx(y.Container,{children:s.jsx(y.Box,{p:8,maxWidth:"600px",borderWidth:1,borderRadius:8,boxShadow:"lg",textAlign:["left"],margin:"auto",marginTop:"40px",bgColor:"white",color:"gray.800",fontSize:"md",children:e})})}function Vt({error:e}){return e?s.jsxs(y.Alert,{status:"error",marginTop:"2em",children:[s.jsx(y.AlertIcon,{}),s.jsx(y.AlertDescription,{children:e})]}):null}function hl({handleSubmit:e,error:t,explicitScopesRequired:r,isButtonDisabled:n,providerName:i}){const[a,c]=I.useState(!1),[u,p]=I.useState(""),[h,m]=I.useState(""),[v,w]=I.useState(""),b=()=>c(!a),x=M=>p(M.currentTarget.value),S=M=>m(M.currentTarget.value),O=M=>w(M.currentTarget.value),A=u.length>0,N=h.length>0,P=n||!A||!N,K=()=>{const M={clientId:h,clientSecret:u};r&&v.length>0&&(M.scopes=Yi(v)),e(M)};return s.jsx(Gt,{children:s.jsxs(y.FormControl,{children:[s.jsx(y.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsx(y.Heading,{as:"h4",size:"md",children:`Set up ${i} integration`})}),s.jsx(Vt,{error:t}),s.jsx("br",{}),s.jsxs(y.Stack,{spacing:4,children:[s.jsx(y.Input,{placeholder:"Client ID",onChange:S}),s.jsxs(y.InputGroup,{size:"md",children:[s.jsx(y.Input,{onChange:x,pr:"4.5rem",type:a?"text":"password",placeholder:"Client Secret"}),s.jsx(y.InputRightElement,{width:"4.5rem",children:s.jsx(y.Button,{h:"1.75rem",size:"sm",onClick:b,children:a?"Hide":"Show"})})]}),r&&s.jsx(y.Textarea,{placeholder:"Scopes separated by new line",onChange:O})]}),s.jsx("br",{}),s.jsx(y.Button,{isDisabled:P,width:"100%",type:"submit",onClick:K,children:"Next"})]})})}function gl({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:i,explicitScopesRequired:a,providerName:c,selectedConnection:u,setSelectedConnection:p}){const{projectId:h}=Y(),m=Z(),[v,w]=I.useState(null),b=async x=>{w(null);const S={groupName:i,groupRef:n,consumerName:r,consumerRef:t,provider:e,oauth2ClientCredentials:{clientId:x.clientId,clientSecret:x.clientSecret,scopes:x.scopes}};H().connectionApi.generateConnection({projectIdOrName:h,generateConnectionParams:S},{headers:{"X-Api-Key":m??"","Content-Type":"application/json"}}).then(O=>{p(O)}).catch(O=>{console.error("Error loading provider info: ",O),w("Error loading provider info")})};return u===null?s.jsx(hl,{providerName:c,handleSubmit:b,error:v,explicitScopesRequired:a}):s.jsx(Ce,{})}const Ao=async(e,t,r,n,i,a,c,u)=>{var h;const p=await H().providerApi.getProvider({provider:i},{headers:{"X-Api-Key":n??""}});if(!p)throw new Error(`Provider ${i} not found`);if(p.authType==="oauth2"&&((h=p.oauth2Opts)==null?void 0:h.grantType)==="authorizationCode"){const v=(await H().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":n??""}})).find(S=>S.provider===i),w=st(i,p);if(!v)throw new Error(`You must first set up a ${w} Provider App using the Ampersand Console.`);const b={connectOAuthParams:{providerWorkspaceRef:a,projectId:e,groupRef:r,groupName:u,consumerRef:t,consumerName:c,providerAppId:v.id,provider:i}};return await H().oAuthApi.oauthConnect(b)}throw new Error(`Provider ${i} does not support an OAuth2 web flow.`)},Si=600,xi=600,ml="AUTHORIZATION_SUCCEEDED",yl="AUTHORIZATION_FAILED";function wl(e,t,r){return I.useCallback(async n=>{const i=await H().connectionApi.getConnection({projectIdOrName:e,connectionId:n},{headers:{"X-Api-Key":t??""}});r(i)},[e,t,r])}function Il(e,t,r,n){return I.useCallback(()=>{if(!n)return;const i=window.screenX+(window.outerWidth-Si)/2,a=window.screenY+(window.outerHeight-xi)/2.5,c=`width=${Si},height=${xi},left=${i},top=${a}`,u=window.open(n,e,c);t(u),window.addEventListener("message",r,!1)},[n,e,t,r])}function vl(e){return I.useCallback(t=>{var r;if(t.origin===Pc){if(t.data.eventType===ml){const n=(r=t.data.data)==null?void 0:r.connection;n?e(n):console.error("Connection ID not found in event data: ",{event:t})}t.data.eventType===yl&&console.error("OAuth failed: ",{event:t})}},[e])}function _o({children:e,oauthUrl:t,windowTitle:r="Connect to Provider",onClose:n}){const i=Z(),{projectId:a}=Y(),[c,u]=I.useState(null),[p,h]=I.useState(null),{setSelectedConnection:m}=xt(),v=vl(u),w=Il(r,h,v,t),b=wl(a,i,m);I.useEffect(()=>{t&&!p&&w()},[t,p,w,v,r]),I.useEffect(()=>{c&&b(c).then(()=>{p==null||p.close()}).catch(S=>{console.error("Error refreshing connection: ",S),n(S.message??"Unexpected error: not able to refresh connection")})},[c,i,m,b,p,n]);const x=p&&setInterval(()=>{(p!=null&&p.closed||!p)&&x&&(clearInterval(x),window.removeEventListener("message",v),h(null),c?c&&n&&n(null):(console.error("OAuth failed. Please try again."),n&&n("OAuth failed. Please try again.")))},500);return s.jsx("div",{children:e})}function bl({handleSubmit:e,error:t,isButtonDisabled:r,providerName:n}){return s.jsx(Gt,{children:s.jsxs(y.FormControl,{children:[s.jsx(y.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsx(y.Heading,{as:"h4",size:"md",children:`Set up ${n} integration`})}),s.jsx(Vt,{error:t}),s.jsx("br",{}),s.jsx(y.Button,{isDisabled:r,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function Sl({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:i,providerName:a}){const{projectId:c}=Y(),u=Z(),[p,h]=I.useState(null),[m,v]=I.useState(null),w=async()=>{v(null);try{const x=await Ao(c,t,n,u,e,void 0,r,i);h(x)}catch(x){console.error("Could not fetch OAuth popup URL",{err:x}),v(x.message??"Unexpected error")}},b=I.useCallback(x=>{v(x),h(null)},[]);return s.jsx(_o,{windowTitle:`Connect to ${a}`,oauthUrl:p,onClose:b,children:s.jsx(bl,{handleSubmit:w,error:m,providerName:a})})}function xl({handleSubmit:e,error:t,isButtonDisabled:r,providerName:n,explicitScopesRequired:i}){const[a,c]=I.useState(!1),[u,p]=I.useState(""),[h,m]=I.useState(""),[v,w]=I.useState(""),[b,x]=I.useState(""),S=()=>c(!a),O=G=>p(G.currentTarget.value),A=G=>m(G.currentTarget.value),N=G=>w(G.currentTarget.value),P=G=>x(G.currentTarget.value),K=u.length>0,M=h.length>0,Q=v.length>0,q=r||!K||!M||!Q,ne=()=>{const G={workspace:v,clientId:h,clientSecret:u};i&&b.length>0&&(G.scopes=Yi(b)),e(G)};return s.jsx(Gt,{children:s.jsxs(y.FormControl,{children:[s.jsx(y.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsx(y.Heading,{as:"h4",size:"md",children:`Set up ${n} integration`})}),s.jsx(Vt,{error:t}),s.jsx("br",{}),s.jsxs(y.Stack,{spacing:4,children:[s.jsx(y.Input,{placeholder:"MyWorkspace",onChange:N}),s.jsx(y.Input,{placeholder:"Client ID",onChange:A}),s.jsxs(y.InputGroup,{size:"md",children:[s.jsx(y.Input,{onChange:O,pr:"4.5rem",type:a?"text":"password",placeholder:"Client Secret"}),s.jsx(y.InputRightElement,{width:"4.5rem",children:s.jsx(y.Button,{h:"1.75rem",size:"sm",onClick:S,children:a?"Hide":"Show"})})]}),i&&s.jsx(y.Textarea,{placeholder:"Scopes separated by new line",onChange:P})]}),s.jsx("br",{}),s.jsx(y.Button,{isDisabled:q,width:"100%",type:"submit",onClick:ne,children:"Next"})]})})}function Ol({provider:e,providerName:t,consumerRef:r,consumerName:n,groupRef:i,groupName:a,explicitScopesRequired:c,selectedConnection:u,setSelectedConnection:p}){const{projectId:h}=Y(),m=Z(),[v,w]=I.useState(null),b=async x=>{w(null);const S={groupName:a,groupRef:i,consumerName:n,consumerRef:r,provider:e,providerWorkspaceRef:x.workspace,oauth2ClientCredentials:{clientId:x.clientId,clientSecret:x.clientSecret,scopes:x.scopes}};H().connectionApi.generateConnection({projectIdOrName:h,generateConnectionParams:S},{headers:{"X-Api-Key":m??"","Content-Type":"application/json"}}).then(O=>{p(O)}).catch(O=>{console.error("Error loading provider info: ",O),w("Error loading provider info")})};return u===null?s.jsx(xl,{providerName:t,handleSubmit:b,error:v,explicitScopesRequired:c}):s.jsx(Ce,{})}function Cl(){const e=I.useContext($o.ThemeContext);if(!e)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `<ChakraProvider />` or `<ThemeProvider />`");return e}var jo=I.createContext({});jo.displayName="ColorModeContext";function ko(){const e=I.useContext(jo);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function Nl(){const e=ko(),t=Cl();return{...e,theme:t}}var Tl=(...e)=>e.filter(Boolean).join(" ");function nt(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}function rt(e,...t){return Rl(e)?e(...t):e}var Rl=e=>typeof e=="function",Tr={exports:{}};Tr.exports;(function(e,t){var r=200,n="__lodash_hash_undefined__",i=800,a=16,c=9007199254740991,u="[object Arguments]",p="[object Array]",h="[object AsyncFunction]",m="[object Boolean]",v="[object Date]",w="[object Error]",b="[object Function]",x="[object GeneratorFunction]",S="[object Map]",O="[object Number]",A="[object Null]",N="[object Object]",P="[object Proxy]",K="[object RegExp]",M="[object Set]",Q="[object String]",q="[object Undefined]",ne="[object WeakMap]",G="[object ArrayBuffer]",he="[object DataView]",Te="[object Float32Array]",ct="[object Float64Array]",Br="[object Int8Array]",Lr="[object Int16Array]",Kr="[object Int32Array]",Mr="[object Uint8Array]",Ur="[object Uint8ClampedArray]",$r="[object Uint16Array]",qr="[object Uint32Array]",Wr=/[\\^$.*+?()[\]{}|]/g,zr=/^\[object .+?Constructor\]$/,Jr=/^(?:0|[1-9]\d*)$/,U={};U[Te]=U[ct]=U[Br]=U[Lr]=U[Kr]=U[Mr]=U[Ur]=U[$r]=U[qr]=!0,U[u]=U[p]=U[G]=U[m]=U[he]=U[v]=U[w]=U[b]=U[S]=U[O]=U[N]=U[K]=U[M]=U[Q]=U[ne]=!1;var Yt=typeof $e=="object"&&$e&&$e.Object===Object&&$e,$=typeof self=="object"&&self&&self.Object===Object&&self,De=Yt||$||Function("return this")(),Zt=t&&!t.nodeType&&t,ie=Zt&&!0&&e&&!e.nodeType&&e,Ct=ie&&ie.exports===Zt,dt=Ct&&Yt.process,Nt=function(){try{var o=ie&&ie.require&&ie.require("util").types;return o||dt&&dt.binding&&dt.binding("util")}catch{}}(),lt=Nt&&Nt.isTypedArray;function Qt(o,d,f){switch(f.length){case 0:return o.call(d);case 1:return o.call(d,f[0]);case 2:return o.call(d,f[0],f[1]);case 3:return o.call(d,f[0],f[1],f[2])}return o.apply(d,f)}function er(o,d){for(var f=-1,C=Array(o);++f<o;)C[f]=d(f);return C}function Hr(o){return function(d){return o(d)}}function Xr(o,d){return o==null?void 0:o[d]}function Gr(o,d){return function(f){return o(d(f))}}var Vr=Array.prototype,Yr=Function.prototype,ut=Object.prototype,Tt=De["__core-js_shared__"],pt=Yr.toString,be=ut.hasOwnProperty,tr=function(){var o=/[^.]+$/.exec(Tt&&Tt.keys&&Tt.keys.IE_PROTO||"");return o?"Symbol(src)_1."+o:""}(),rr=ut.toString,Zr=pt.call(Object),ft=RegExp("^"+pt.call(be).replace(Wr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=Ct?De.Buffer:void 0,Rt=De.Symbol,se=De.Uint8Array;Be&&Be.allocUnsafe;var At=Gr(Object.getPrototypeOf,Object),_t=Object.create,Qr=ut.propertyIsEnumerable,nr=Vr.splice,le=Rt?Rt.toStringTag:void 0,ze=function(){try{var o=Dt(Object,"defineProperty");return o({},"",{}),o}catch{}}(),ir=Be?Be.isBuffer:void 0,or=Math.max,Re=Date.now,jt=Dt(De,"Map"),Je=Dt(Object,"create"),en=function(){function o(){}return function(d){if(!_e(d))return{};if(_t)return _t(d);o.prototype=d;var f=new o;return o.prototype=void 0,f}}();function ge(o){var d=-1,f=o==null?0:o.length;for(this.clear();++d<f;){var C=o[d];this.set(C[0],C[1])}}function He(){this.__data__=Je?Je(null):{},this.size=0}function kt(o){var d=this.has(o)&&delete this.__data__[o];return this.size-=d?1:0,d}function Et(o){var d=this.__data__;if(Je){var f=d[o];return f===n?void 0:f}return be.call(d,o)?d[o]:void 0}function Ft(o){var d=this.__data__;return Je?d[o]!==void 0:be.call(d,o)}function Xe(o,d){var f=this.__data__;return this.size+=this.has(o)?0:1,f[o]=Je&&d===void 0?n:d,this}ge.prototype.clear=He,ge.prototype.delete=kt,ge.prototype.get=Et,ge.prototype.has=Ft,ge.prototype.set=Xe;function me(o){var d=-1,f=o==null?0:o.length;for(this.clear();++d<f;){var C=o[d];this.set(C[0],C[1])}}function tn(){this.__data__=[],this.size=0}function rn(o){var d=this.__data__,f=ht(d,o);if(f<0)return!1;var C=d.length-1;return f==C?d.pop():nr.call(d,f,1),--this.size,!0}function nn(o){var d=this.__data__,f=ht(d,o);return f<0?void 0:d[f][1]}function on(o){return ht(this.__data__,o)>-1}function ar(o,d){var f=this.__data__,C=ht(f,o);return C<0?(++this.size,f.push([o,d])):f[C][1]=d,this}me.prototype.clear=tn,me.prototype.delete=rn,me.prototype.get=nn,me.prototype.has=on,me.prototype.set=ar;function Se(o){var d=-1,f=o==null?0:o.length;for(this.clear();++d<f;){var C=o[d];this.set(C[0],C[1])}}function Ae(){this.size=0,this.__data__={hash:new ge,map:new(jt||me),string:new ge}}function an(o){var d=yt(this,o).delete(o);return this.size-=d?1:0,d}function sn(o){return yt(this,o).get(o)}function cn(o){return yt(this,o).has(o)}function dn(o,d){var f=yt(this,o),C=f.size;return f.set(o,d),this.size+=f.size==C?0:1,this}Se.prototype.clear=Ae,Se.prototype.delete=an,Se.prototype.get=sn,Se.prototype.has=cn,Se.prototype.set=dn;function Le(o){var d=this.__data__=new me(o);this.size=d.size}function ye(){this.__data__=new me,this.size=0}function ln(o){var d=this.__data__,f=d.delete(o);return this.size=d.size,f}function un(o){return this.__data__.get(o)}function pn(o){return this.__data__.has(o)}function fn(o,d){var f=this.__data__;if(f instanceof me){var C=f.__data__;if(!jt||C.length<r-1)return C.push([o,d]),this.size=++f.size,this;f=this.__data__=new Se(C)}return f.set(o,d),this.size=f.size,this}Le.prototype.clear=ye,Le.prototype.delete=ln,Le.prototype.get=un,Le.prototype.has=pn,Le.prototype.set=fn;function hn(o,d){var f=Ie(o),C=!f&&Lt(o),R=!f&&!C&&Ze(o),j=!f&&!C&&!R&&Mt(o),F=f||C||R||j,k=F?er(o.length,String):[],E=k.length;for(var W in o)F&&(W=="length"||R&&(W=="offset"||W=="parent")||j&&(W=="buffer"||W=="byteLength"||W=="byteOffset")||Bt(W,E))||k.push(W);return k}function we(o,d,f){(f!==void 0&&!wt(o[d],f)||f===void 0&&!(d in o))&&Pt(o,d,f)}function gn(o,d,f){var C=o[d];(!(be.call(o,d)&&wt(C,f))||f===void 0&&!(d in o))&&Pt(o,d,f)}function ht(o,d){for(var f=o.length;f--;)if(wt(o[f][0],d))return f;return-1}function Pt(o,d,f){d=="__proto__"&&ze?ze(o,d,{configurable:!0,enumerable:!0,value:f,writable:!0}):o[d]=f}var mn=dr();function gt(o){return o==null?o===void 0?q:A:le&&le in Object(o)?Cn(o):An(o)}function Ge(o){return Me(o)&>(o)==u}function yn(o){if(!_e(o)||lr(o))return!1;var d=Kt(o)?ft:zr;return d.test(En(o))}function wn(o){return Me(o)&&vt(o.length)&&!!U[gt(o)]}function xe(o){if(!_e(o))return Ke(o);var d=Ye(o),f=[];for(var C in o)C=="constructor"&&(d||!be.call(o,C))||f.push(C);return f}function sr(o,d,f,C,R){o!==d&&mn(d,function(j,F){if(R||(R=new Le),_e(j))In(o,d,F,f,sr,C,R);else{var k=C?C(ue(o,F),j,F+"",o,d,R):void 0;k===void 0&&(k=j),we(o,F,k)}},Ut)}function In(o,d,f,C,R,j,F){var k=ue(o,f),E=ue(d,f),W=F.get(E);if(W){we(o,f,W);return}var z=j?j(k,E,f+"",o,d,F):void 0,X=z===void 0;if(X){var te=Ie(E),re=!te&&Ze(E),ve=!te&&!re&&Mt(E);z=E,te||re||ve?Ie(k)?z=k:Fn(k)?z=On(k):re?(X=!1,z=Sn(E)):ve?(X=!1,z=mt(E)):z=[]:ur(E)||Lt(E)?(z=k,Lt(k)?z=Qe(k):(!_e(k)||Kt(k))&&(z=Nn(E))):X=!1}X&&(F.set(E,z),R(z,E,C,j,F),F.delete(E)),we(o,f,z)}function vn(o,d){return jn(_n(o,d,pr),o+"")}var bn=ze?function(o,d){return ze(o,"toString",{configurable:!0,enumerable:!1,value:Dn(d),writable:!0})}:pr;function Sn(o,d){return o.slice()}function xn(o){var d=new o.constructor(o.byteLength);return new se(d).set(new se(o)),d}function mt(o,d){var f=xn(o.buffer);return new o.constructor(f,o.byteOffset,o.length)}function On(o,d){var f=-1,C=o.length;for(d||(d=Array(C));++f<C;)d[f]=o[f];return d}function Ve(o,d,f,C){var R=!f;f||(f={});for(var j=-1,F=d.length;++j<F;){var k=d[j],E=void 0;E===void 0&&(E=o[k]),R?Pt(f,k,E):gn(f,k,E)}return f}function cr(o){return vn(function(d,f){var C=-1,R=f.length,j=R>1?f[R-1]:void 0,F=R>2?f[2]:void 0;for(j=o.length>3&&typeof j=="function"?(R--,j):void 0,F&&Tn(f[0],f[1],F)&&(j=R<3?void 0:j,R=1),d=Object(d);++C<R;){var k=f[C];k&&o(d,k,C,j)}return d})}function dr(o){return function(d,f,C){for(var R=-1,j=Object(d),F=C(d),k=F.length;k--;){var E=F[++R];if(f(j[E],E,j)===!1)break}return d}}function yt(o,d){var f=o.__data__;return Rn(d)?f[typeof d=="string"?"string":"hash"]:f.map}function Dt(o,d){var f=Xr(o,d);return yn(f)?f:void 0}function Cn(o){var d=be.call(o,le),f=o[le];try{o[le]=void 0;var C=!0}catch{}var R=rr.call(o);return C&&(d?o[le]=f:delete o[le]),R}function Nn(o){return typeof o.constructor=="function"&&!Ye(o)?en(At(o)):{}}function Bt(o,d){var f=typeof o;return d=d??c,!!d&&(f=="number"||f!="symbol"&&Jr.test(o))&&o>-1&&o%1==0&&o<d}function Tn(o,d,f){if(!_e(f))return!1;var C=typeof d;return(C=="number"?It(f)&&Bt(d,f.length):C=="string"&&d in f)?wt(f[d],o):!1}function Rn(o){var d=typeof o;return d=="string"||d=="number"||d=="symbol"||d=="boolean"?o!=="__proto__":o===null}function lr(o){return!!tr&&tr in o}function Ye(o){var d=o&&o.constructor,f=typeof d=="function"&&d.prototype||ut;return o===f}function Ke(o){var d=[];if(o!=null)for(var f in Object(o))d.push(f);return d}function An(o){return rr.call(o)}function _n(o,d,f){return d=or(d===void 0?o.length-1:d,0),function(){for(var C=arguments,R=-1,j=or(C.length-d,0),F=Array(j);++R<j;)F[R]=C[d+R];R=-1;for(var k=Array(d+1);++R<d;)k[R]=C[R];return k[d]=f(F),Qt(o,this,k)}}function ue(o,d){if(!(d==="constructor"&&typeof o[d]=="function")&&d!="__proto__")return o[d]}var jn=kn(bn);function kn(o){var d=0,f=0;return function(){var C=Re(),R=a-(C-f);if(f=C,R>0){if(++d>=i)return arguments[0]}else d=0;return o.apply(void 0,arguments)}}function En(o){if(o!=null){try{return pt.call(o)}catch{}try{return o+""}catch{}}return""}function wt(o,d){return o===d||o!==o&&d!==d}var Lt=Ge(function(){return arguments}())?Ge:function(o){return Me(o)&&be.call(o,"callee")&&!Qr.call(o,"callee")},Ie=Array.isArray;function It(o){return o!=null&&vt(o.length)&&!Kt(o)}function Fn(o){return Me(o)&&It(o)}var Ze=ir||l;function Kt(o){if(!_e(o))return!1;var d=gt(o);return d==b||d==x||d==h||d==P}function vt(o){return typeof o=="number"&&o>-1&&o%1==0&&o<=c}function _e(o){var d=typeof o;return o!=null&&(d=="object"||d=="function")}function Me(o){return o!=null&&typeof o=="object"}function ur(o){if(!Me(o)||gt(o)!=N)return!1;var d=At(o);if(d===null)return!0;var f=be.call(d,"constructor")&&d.constructor;return typeof f=="function"&&f instanceof f&&pt.call(f)==Zr}var Mt=lt?Hr(lt):wn;function Qe(o){return Ve(o,Ut(o))}function Ut(o){return It(o)?hn(o):xe(o)}var Pn=cr(function(o,d,f,C){sr(o,d,f,C)});function Dn(o){return function(){return o}}function pr(o){return o}function l(){return!1}e.exports=Pn})(Tr,Tr.exports);var Al=Tr.exports;const Ee=ei(Al);var _l=e=>/!(important)?$/.test(e),Oi=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,jl=(e,t)=>r=>{const n=String(t),i=_l(n),a=Oi(n),c=e?`${e}.${a}`:a;let u=nt(r.__cssMap)&&c in r.__cssMap?r.__cssMap[c].varRef:t;return u=Oi(u),i?`${u} !important`:u};function ai(e){const{scale:t,transform:r,compose:n}=e;return(a,c)=>{var u;const p=jl(t,a)(c);let h=(u=r==null?void 0:r(p,c))!=null?u:p;return n&&(h=n(h,c)),h}}var wr=(...e)=>t=>e.reduce((r,n)=>n(r),t);function pe(e,t){return r=>{const n={property:r,scale:e};return n.transform=ai({scale:e,transform:t}),n}}var kl=({rtl:e,ltr:t})=>r=>r.direction==="rtl"?e:t;function El(e){const{property:t,scale:r,transform:n}=e;return{scale:r,property:kl(t),transform:r?ai({scale:r,compose:n}):n}}var Eo=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function Fl(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...Eo].join(" ")}function Pl(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...Eo].join(" ")}var Dl={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},Bl={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function Ll(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var Kl={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},Xn={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},Ml=new Set(Object.values(Xn)),Gn=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),Ul=e=>e.trim();function $l(e,t){if(e==null||Gn.has(e))return e;if(!(Vn(e)||Gn.has(e)))return`url('${e}')`;const i=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),a=i==null?void 0:i[1],c=i==null?void 0:i[2];if(!a||!c)return e;const u=a.includes("-gradient")?a:`${a}-gradient`,[p,...h]=c.split(",").map(Ul).filter(Boolean);if((h==null?void 0:h.length)===0)return e;const m=p in Xn?Xn[p]:p;h.unshift(m);const v=h.map(w=>{if(Ml.has(w))return w;const b=w.indexOf(" "),[x,S]=b!==-1?[w.substr(0,b),w.substr(b+1)]:[w],O=Vn(S)?S:S&&S.split(" "),A=`colors.${x}`,N=A in t.__cssMap?t.__cssMap[A].varRef:x;return O?[N,...Array.isArray(O)?O:[O]].join(" "):N});return`${u}(${v.join(", ")})`}var Vn=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),ql=(e,t)=>$l(e,t??{});function Wl(e){return/^var\(--.+\)$/.test(e)}var zl=e=>{const t=parseFloat(e.toString()),r=e.toString().replace(String(t),"");return{unitless:!r,value:t,unit:r}},Oe=e=>t=>`${e}(${t})`,D={filter(e){return e!=="auto"?e:Dl},backdropFilter(e){return e!=="auto"?e:Bl},ring(e){return Ll(D.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?Fl():e==="auto-gpu"?Pl():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=zl(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const r={left:"right",right:"left"};return t.direction==="rtl"?r[e]:e},degree(e){if(Wl(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:ql,blur:Oe("blur"),opacity:Oe("opacity"),brightness:Oe("brightness"),contrast:Oe("contrast"),dropShadow:Oe("drop-shadow"),grayscale:Oe("grayscale"),hueRotate:e=>Oe("hue-rotate")(D.degree(e)),invert:Oe("invert"),saturate:Oe("saturate"),sepia:Oe("sepia"),bgImage(e){return e==null||Vn(e)||Gn.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:r,divide:n}=(t=Kl[e])!=null?t:{},i={flexDirection:e};return r&&(i[r]=1),n&&(i[n]=1),i}},g={borderWidths:pe("borderWidths"),borderStyles:pe("borderStyles"),colors:pe("colors"),borders:pe("borders"),gradients:pe("gradients",D.gradient),radii:pe("radii",D.px),space:pe("space",wr(D.vh,D.px)),spaceT:pe("space",wr(D.vh,D.px)),degreeT(e){return{property:e,transform:D.degree}},prop(e,t,r){return{property:e,scale:t,...t&&{transform:ai({scale:t,transform:r})}}},propT(e,t){return{property:e,transform:t}},sizes:pe("sizes",wr(D.vh,D.px)),sizesT:pe("sizes",wr(D.vh,D.fraction)),shadows:pe("shadows"),logical:El,blur:pe("blur",D.blur)},br={background:g.colors("background"),backgroundColor:g.colors("backgroundColor"),backgroundImage:g.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:D.bgClip},bgSize:g.prop("backgroundSize"),bgPosition:g.prop("backgroundPosition"),bg:g.colors("background"),bgColor:g.colors("backgroundColor"),bgPos:g.prop("backgroundPosition"),bgRepeat:g.prop("backgroundRepeat"),bgAttachment:g.prop("backgroundAttachment"),bgGradient:g.gradients("backgroundImage"),bgClip:{transform:D.bgClip}};Object.assign(br,{bgImage:br.backgroundImage,bgImg:br.backgroundImage});var B={border:g.borders("border"),borderWidth:g.borderWidths("borderWidth"),borderStyle:g.borderStyles("borderStyle"),borderColor:g.colors("borderColor"),borderRadius:g.radii("borderRadius"),borderTop:g.borders("borderTop"),borderBlockStart:g.borders("borderBlockStart"),borderTopLeftRadius:g.radii("borderTopLeftRadius"),borderStartStartRadius:g.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:g.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:g.radii("borderTopRightRadius"),borderStartEndRadius:g.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:g.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:g.borders("borderRight"),borderInlineEnd:g.borders("borderInlineEnd"),borderBottom:g.borders("borderBottom"),borderBlockEnd:g.borders("borderBlockEnd"),borderBottomLeftRadius:g.radii("borderBottomLeftRadius"),borderBottomRightRadius:g.radii("borderBottomRightRadius"),borderLeft:g.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:g.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:g.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:g.borders(["borderLeft","borderRight"]),borderInline:g.borders("borderInline"),borderY:g.borders(["borderTop","borderBottom"]),borderBlock:g.borders("borderBlock"),borderTopWidth:g.borderWidths("borderTopWidth"),borderBlockStartWidth:g.borderWidths("borderBlockStartWidth"),borderTopColor:g.colors("borderTopColor"),borderBlockStartColor:g.colors("borderBlockStartColor"),borderTopStyle:g.borderStyles("borderTopStyle"),borderBlockStartStyle:g.borderStyles("borderBlockStartStyle"),borderBottomWidth:g.borderWidths("borderBottomWidth"),borderBlockEndWidth:g.borderWidths("borderBlockEndWidth"),borderBottomColor:g.colors("borderBottomColor"),borderBlockEndColor:g.colors("borderBlockEndColor"),borderBottomStyle:g.borderStyles("borderBottomStyle"),borderBlockEndStyle:g.borderStyles("borderBlockEndStyle"),borderLeftWidth:g.borderWidths("borderLeftWidth"),borderInlineStartWidth:g.borderWidths("borderInlineStartWidth"),borderLeftColor:g.colors("borderLeftColor"),borderInlineStartColor:g.colors("borderInlineStartColor"),borderLeftStyle:g.borderStyles("borderLeftStyle"),borderInlineStartStyle:g.borderStyles("borderInlineStartStyle"),borderRightWidth:g.borderWidths("borderRightWidth"),borderInlineEndWidth:g.borderWidths("borderInlineEndWidth"),borderRightColor:g.colors("borderRightColor"),borderInlineEndColor:g.colors("borderInlineEndColor"),borderRightStyle:g.borderStyles("borderRightStyle"),borderInlineEndStyle:g.borderStyles("borderInlineEndStyle"),borderTopRadius:g.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:g.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:g.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:g.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(B,{rounded:B.borderRadius,roundedTop:B.borderTopRadius,roundedTopLeft:B.borderTopLeftRadius,roundedTopRight:B.borderTopRightRadius,roundedTopStart:B.borderStartStartRadius,roundedTopEnd:B.borderStartEndRadius,roundedBottom:B.borderBottomRadius,roundedBottomLeft:B.borderBottomLeftRadius,roundedBottomRight:B.borderBottomRightRadius,roundedBottomStart:B.borderEndStartRadius,roundedBottomEnd:B.borderEndEndRadius,roundedLeft:B.borderLeftRadius,roundedRight:B.borderRightRadius,roundedStart:B.borderInlineStartRadius,roundedEnd:B.borderInlineEndRadius,borderStart:B.borderInlineStart,borderEnd:B.borderInlineEnd,borderTopStartRadius:B.borderStartStartRadius,borderTopEndRadius:B.borderStartEndRadius,borderBottomStartRadius:B.borderEndStartRadius,borderBottomEndRadius:B.borderEndEndRadius,borderStartRadius:B.borderInlineStartRadius,borderEndRadius:B.borderInlineEndRadius,borderStartWidth:B.borderInlineStartWidth,borderEndWidth:B.borderInlineEndWidth,borderStartColor:B.borderInlineStartColor,borderEndColor:B.borderInlineEndColor,borderStartStyle:B.borderInlineStartStyle,borderEndStyle:B.borderInlineEndStyle});var Jl={color:g.colors("color"),textColor:g.colors("color"),fill:g.colors("fill"),stroke:g.colors("stroke")},Yn={boxShadow:g.shadows("boxShadow"),mixBlendMode:!0,blendMode:g.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:g.prop("backgroundBlendMode"),opacity:!0};Object.assign(Yn,{shadow:Yn.boxShadow});var Hl={filter:{transform:D.filter},blur:g.blur("--chakra-blur"),brightness:g.propT("--chakra-brightness",D.brightness),contrast:g.propT("--chakra-contrast",D.contrast),hueRotate:g.propT("--chakra-hue-rotate",D.hueRotate),invert:g.propT("--chakra-invert",D.invert),saturate:g.propT("--chakra-saturate",D.saturate),dropShadow:g.propT("--chakra-drop-shadow",D.dropShadow),backdropFilter:{transform:D.backdropFilter},backdropBlur:g.blur("--chakra-backdrop-blur"),backdropBrightness:g.propT("--chakra-backdrop-brightness",D.brightness),backdropContrast:g.propT("--chakra-backdrop-contrast",D.contrast),backdropHueRotate:g.propT("--chakra-backdrop-hue-rotate",D.hueRotate),backdropInvert:g.propT("--chakra-backdrop-invert",D.invert),backdropSaturate:g.propT("--chakra-backdrop-saturate",D.saturate)},Rr={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:D.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:g.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:g.space("gap"),rowGap:g.space("rowGap"),columnGap:g.space("columnGap")};Object.assign(Rr,{flexDir:Rr.flexDirection});var Fo={gridGap:g.space("gridGap"),gridColumnGap:g.space("gridColumnGap"),gridRowGap:g.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},Xl={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:D.outline},outlineOffset:!0,outlineColor:g.colors("outlineColor")},fe={width:g.sizesT("width"),inlineSize:g.sizesT("inlineSize"),height:g.sizes("height"),blockSize:g.sizes("blockSize"),boxSize:g.sizes(["width","height"]),minWidth:g.sizes("minWidth"),minInlineSize:g.sizes("minInlineSize"),minHeight:g.sizes("minHeight"),minBlockSize:g.sizes("minBlockSize"),maxWidth:g.sizes("maxWidth"),maxInlineSize:g.sizes("maxInlineSize"),maxHeight:g.sizes("maxHeight"),maxBlockSize:g.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var r,n,i;return{[`@media screen and (min-width: ${(i=(n=(r=t.__breakpoints)==null?void 0:r.get(e))==null?void 0:n.minW)!=null?i:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var r,n,i;return{[`@media screen and (max-width: ${(i=(n=(r=t.__breakpoints)==null?void 0:r.get(e))==null?void 0:n._minW)!=null?i:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:g.propT("float",D.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(fe,{w:fe.width,h:fe.height,minW:fe.minWidth,maxW:fe.maxWidth,minH:fe.minHeight,maxH:fe.maxHeight,overscroll:fe.overscrollBehavior,overscrollX:fe.overscrollBehaviorX,overscrollY:fe.overscrollBehaviorY});var Gl={listStyleType:!0,listStylePosition:!0,listStylePos:g.prop("listStylePosition"),listStyleImage:!0,listStyleImg:g.prop("listStyleImage")};function Vl(e,t,r,n){const i=typeof t=="string"?t.split("."):[t];for(n=0;n<i.length&&e;n+=1)e=e[i[n]];return e===void 0?r:e}var Yl=e=>{const t=new WeakMap;return(n,i,a,c)=>{if(typeof n>"u")return e(n,i,a);t.has(n)||t.set(n,new Map);const u=t.get(n);if(u.has(i))return u.get(i);const p=e(n,i,a,c);return u.set(i,p),p}},Zl=Yl(Vl),Ql={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},eu={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},Mn=(e,t,r)=>{const n={},i=Zl(e,t,{});for(const a in i)a in r&&r[a]!=null||(n[a]=i[a]);return n},tu={srOnly:{transform(e){return e===!0?Ql:e==="focusable"?eu:{}}},layerStyle:{processResult:!0,transform:(e,t,r)=>Mn(t,`layerStyles.${e}`,r)},textStyle:{processResult:!0,transform:(e,t,r)=>Mn(t,`textStyles.${e}`,r)},apply:{processResult:!0,transform:(e,t,r)=>Mn(t,e,r)}},zt={position:!0,pos:g.prop("position"),zIndex:g.prop("zIndex","zIndices"),inset:g.spaceT("inset"),insetX:g.spaceT(["left","right"]),insetInline:g.spaceT("insetInline"),insetY:g.spaceT(["top","bottom"]),insetBlock:g.spaceT("insetBlock"),top:g.spaceT("top"),insetBlockStart:g.spaceT("insetBlockStart"),bottom:g.spaceT("bottom"),insetBlockEnd:g.spaceT("insetBlockEnd"),left:g.spaceT("left"),insetInlineStart:g.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:g.spaceT("right"),insetInlineEnd:g.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(zt,{insetStart:zt.insetInlineStart,insetEnd:zt.insetInlineEnd});var ru={ring:{transform:D.ring},ringColor:g.colors("--chakra-ring-color"),ringOffset:g.prop("--chakra-ring-offset-width"),ringOffsetColor:g.colors("--chakra-ring-offset-color"),ringInset:g.prop("--chakra-ring-inset")},J={margin:g.spaceT("margin"),marginTop:g.spaceT("marginTop"),marginBlockStart:g.spaceT("marginBlockStart"),marginRight:g.spaceT("marginRight"),marginInlineEnd:g.spaceT("marginInlineEnd"),marginBottom:g.spaceT("marginBottom"),marginBlockEnd:g.spaceT("marginBlockEnd"),marginLeft:g.spaceT("marginLeft"),marginInlineStart:g.spaceT("marginInlineStart"),marginX:g.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:g.spaceT("marginInline"),marginY:g.spaceT(["marginTop","marginBottom"]),marginBlock:g.spaceT("marginBlock"),padding:g.space("padding"),paddingTop:g.space("paddingTop"),paddingBlockStart:g.space("paddingBlockStart"),paddingRight:g.space("paddingRight"),paddingBottom:g.space("paddingBottom"),paddingBlockEnd:g.space("paddingBlockEnd"),paddingLeft:g.space("paddingLeft"),paddingInlineStart:g.space("paddingInlineStart"),paddingInlineEnd:g.space("paddingInlineEnd"),paddingX:g.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:g.space("paddingInline"),paddingY:g.space(["paddingTop","paddingBottom"]),paddingBlock:g.space("paddingBlock")};Object.assign(J,{m:J.margin,mt:J.marginTop,mr:J.marginRight,me:J.marginInlineEnd,marginEnd:J.marginInlineEnd,mb:J.marginBottom,ml:J.marginLeft,ms:J.marginInlineStart,marginStart:J.marginInlineStart,mx:J.marginX,my:J.marginY,p:J.padding,pt:J.paddingTop,py:J.paddingY,px:J.paddingX,pb:J.paddingBottom,pl:J.paddingLeft,ps:J.paddingInlineStart,paddingStart:J.paddingInlineStart,pr:J.paddingRight,pe:J.paddingInlineEnd,paddingEnd:J.paddingInlineEnd});var nu={textDecorationColor:g.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:g.shadows("textShadow")},iu={clipPath:!0,transform:g.propT("transform",D.transform),transformOrigin:!0,translateX:g.spaceT("--chakra-translate-x"),translateY:g.spaceT("--chakra-translate-y"),skewX:g.degreeT("--chakra-skew-x"),skewY:g.degreeT("--chakra-skew-y"),scaleX:g.prop("--chakra-scale-x"),scaleY:g.prop("--chakra-scale-y"),scale:g.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:g.degreeT("--chakra-rotate")},ou={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:g.prop("transitionDuration","transition.duration"),transitionProperty:g.prop("transitionProperty","transition.property"),transitionTimingFunction:g.prop("transitionTimingFunction","transition.easing")},au={fontFamily:g.prop("fontFamily","fonts"),fontSize:g.prop("fontSize","fontSizes",D.px),fontWeight:g.prop("fontWeight","fontWeights"),lineHeight:g.prop("lineHeight","lineHeights"),letterSpacing:g.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},su={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:g.spaceT("scrollMargin"),scrollMarginTop:g.spaceT("scrollMarginTop"),scrollMarginBottom:g.spaceT("scrollMarginBottom"),scrollMarginLeft:g.spaceT("scrollMarginLeft"),scrollMarginRight:g.spaceT("scrollMarginRight"),scrollMarginX:g.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:g.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:g.spaceT("scrollPadding"),scrollPaddingTop:g.spaceT("scrollPaddingTop"),scrollPaddingBottom:g.spaceT("scrollPaddingBottom"),scrollPaddingLeft:g.spaceT("scrollPaddingLeft"),scrollPaddingRight:g.spaceT("scrollPaddingRight"),scrollPaddingX:g.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:g.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function Po(e){return nt(e)&&e.reference?e.reference:String(e)}var Dr=(e,...t)=>t.map(Po).join(` ${e} `).replace(/calc/g,""),Ci=(...e)=>`calc(${Dr("+",...e)})`,Ni=(...e)=>`calc(${Dr("-",...e)})`,Zn=(...e)=>`calc(${Dr("*",...e)})`,Ti=(...e)=>`calc(${Dr("/",...e)})`,Ri=e=>{const t=Po(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:Zn(t,-1)},Wt=Object.assign(e=>({add:(...t)=>Wt(Ci(e,...t)),subtract:(...t)=>Wt(Ni(e,...t)),multiply:(...t)=>Wt(Zn(e,...t)),divide:(...t)=>Wt(Ti(e,...t)),negate:()=>Wt(Ri(e)),toString:()=>e.toString()}),{add:Ci,subtract:Ni,multiply:Zn,divide:Ti,negate:Ri});function cu(e){const t=parseFloat(e.toString()),r=e.toString().replace(String(t),"");return{unitless:!r,value:t,unit:r}}function Ai(e){if(e==null)return e;const{unitless:t}=cu(e);return t||typeof e=="number"?`${e}px`:e}function du(e,t){const r=["@media screen"];return e&&r.push("and",`(min-width: ${Ai(e)})`),t&&r.push("and",`(max-width: ${Ai(t)})`),r.join(" ")}var ee={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},Ue=e=>Do(t=>e(t,"&"),"[role=group]","[data-group]",".group"),ke=e=>Do(t=>e(t,"~ &"),"[data-peer]",".peer"),Do=(e,...t)=>t.map(e).join(", "),si={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:Ue(ee.hover),_peerHover:ke(ee.hover),_groupFocus:Ue(ee.focus),_peerFocus:ke(ee.focus),_groupFocusVisible:Ue(ee.focusVisible),_peerFocusVisible:ke(ee.focusVisible),_groupActive:Ue(ee.active),_peerActive:ke(ee.active),_groupDisabled:Ue(ee.disabled),_peerDisabled:ke(ee.disabled),_groupInvalid:Ue(ee.invalid),_peerInvalid:ke(ee.invalid),_groupChecked:Ue(ee.checked),_peerChecked:ke(ee.checked),_groupFocusWithin:Ue(ee.focusWithin),_peerFocusWithin:ke(ee.focusWithin),_peerPlaceholderShown:ke(ee.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},lu=Object.keys(si),ci=Ee({},br,B,Jl,Rr,fe,Hl,ru,Xl,Fo,tu,zt,Yn,J,su,au,nu,iu,Gl,ou);Object.assign({},J,fe,Rr,Fo,zt);var uu=[...Object.keys(ci),...lu],pu={...ci,...si},fu=e=>e in pu,hu=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:r,toArrayValue:n,media:i}=t.__breakpoints,a={};for(const c in e){let u=rt(e[c],t);if(u==null)continue;if(u=nt(u)&&r(u)?n(u):u,!Array.isArray(u)){a[c]=u;continue}const p=u.slice(0,i.length).length;for(let h=0;h<p;h+=1){const m=i==null?void 0:i[h];if(!m){a[c]=u[h];continue}a[m]=a[m]||{},u[h]!=null&&(a[m][c]=u[h])}}return a};function gu(e){const t=[];let r="",n=!1;for(let i=0;i<e.length;i++){const a=e[i];a==="("?(n=!0,r+=a):a===")"?(n=!1,r+=a):a===","&&!n?(t.push(r),r=""):r+=a}return r=r.trim(),r&&t.push(r),t}function mu(e){return/^var\(--.+\)$/.test(e)}var yu=(e,t)=>e.startsWith("--")&&typeof t=="string"&&!mu(t),wu=(e,t)=>{var r,n;if(t==null)return t;const i=p=>{var h,m;return(m=(h=e.__cssMap)==null?void 0:h[p])==null?void 0:m.varRef},a=p=>{var h;return(h=i(p))!=null?h:p},[c,u]=gu(t);return t=(n=(r=i(c))!=null?r:a(u))!=null?n:a(t),t};function Iu(e){const{configs:t={},pseudos:r={},theme:n}=e,i=(a,c=!1)=>{var u,p,h;const m=rt(a,n),v=hu(m)(n);let w={};for(let b in v){const x=v[b];let S=rt(x,n);b in r&&(b=r[b]),yu(b,S)&&(S=wu(n,S));let O=t[b];if(O===!0&&(O={property:b}),nt(S)){w[b]=(u=w[b])!=null?u:{},w[b]=Ee({},w[b],i(S,!0));continue}let A=(h=(p=O==null?void 0:O.transform)==null?void 0:p.call(O,S,n,m))!=null?h:S;A=O!=null&&O.processResult?i(A,!0):A;const N=rt(O==null?void 0:O.property,n);if(!c&&(O!=null&&O.static)){const P=rt(O.static,n);w=Ee({},w,P)}if(N&&Array.isArray(N)){for(const P of N)w[P]=A;continue}if(N){N==="&"&&nt(A)?w=Ee({},w,A):w[N]=A;continue}if(nt(A)){w=Ee({},w,A);continue}w[b]=A}return w};return i}var vu=e=>t=>Iu({theme:t,pseudos:si,configs:ci})(e);function bu(e,t){if(Array.isArray(e))return e;if(nt(e))return t(e);if(e!=null)return[e]}function Su(e,t){for(let r=t+1;r<e.length;r++)if(e[r]!=null)return r;return-1}function xu(e){const t=e.__breakpoints;return function(n,i,a,c){var u,p;if(!t)return;const h={},m=bu(a,t.toArrayValue);if(!m)return h;const v=m.length,w=v===1,b=!!n.parts;for(let x=0;x<v;x++){const S=t.details[x],O=t.details[Su(m,x)],A=du(S.minW,O==null?void 0:O._minW),N=rt((u=n[i])==null?void 0:u[m[x]],c);if(N){if(b){(p=n.parts)==null||p.forEach(P=>{Ee(h,{[P]:w?N[P]:{[A]:N[P]}})});continue}if(!b){w?Ee(h,N):h[A]=N;continue}h[A]=N}}return h}}function Ou(e){return t=>{var r;const{variant:n,size:i,theme:a}=t,c=xu(a);return Ee({},rt((r=e.baseStyle)!=null?r:{},t),c(e,"sizes",i,t),c(e,"variants",n,t))}}function Cu(e,t){const r={};return Object.keys(e).forEach(n=>{t.includes(n)||(r[n]=e[n])}),r}function Nu(e,t,r,n){const i=typeof t=="string"?t.split("."):[t];for(n=0;n<i.length&&e;n+=1)e=e[i[n]];return e===void 0?r:e}var Tu=e=>{const t=new WeakMap;return(n,i,a,c)=>{if(typeof n>"u")return e(n,i,a);t.has(n)||t.set(n,new Map);const u=t.get(n);if(u.has(i))return u.get(i);const p=e(n,i,a,c);return u.set(i,p),p}},Ru=Tu(Nu);function Bo(e,t){const r={};return Object.keys(e).forEach(n=>{const i=e[n];t(i,n,e)&&(r[n]=i)}),r}var Lo=e=>Bo(e,t=>t!=null);function Au(e){return typeof e=="function"}process.env.NODE_ENV;process.env.NODE_ENV;function _u(e,...t){return Au(e)?e(...t):e}var ju=typeof Element<"u",ku=typeof Map=="function",Eu=typeof Set=="function",Fu=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Sr(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var r,n,i;if(Array.isArray(e)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(!Sr(e[n],t[n]))return!1;return!0}var a;if(ku&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(a=e.entries();!(n=a.next()).done;)if(!t.has(n.value[0]))return!1;for(a=e.entries();!(n=a.next()).done;)if(!Sr(n.value[1],t.get(n.value[0])))return!1;return!0}if(Eu&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(a=e.entries();!(n=a.next()).done;)if(!t.has(n.value[0]))return!1;return!0}if(Fu&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(r=e.length,r!=t.length)return!1;for(n=r;n--!==0;)if(e[n]!==t[n])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),r=i.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[n]))return!1;if(ju&&e instanceof Element)return!1;for(n=r;n--!==0;)if(!((i[n]==="_owner"||i[n]==="__v"||i[n]==="__o")&&e.$$typeof)&&!Sr(e[i[n]],t[i[n]]))return!1;return!0}return e!==e&&t!==t}var Pu=function(t,r){try{return Sr(t,r)}catch(n){if((n.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw n}};const Du=ei(Pu);function Bu(e,t={}){var r;const{styleConfig:n,...i}=t,{theme:a,colorMode:c}=Nl(),u=Ru(a,`components.${e}`),p=n||u,h=Ee({theme:a,colorMode:c},(r=p==null?void 0:p.defaultProps)!=null?r:{},Lo(Cu(i,["children"]))),m=I.useRef({});if(p){const w=Ou(p)(h);Du(m.current,w)||(m.current=w)}return m.current}function Lu(e,t={}){return Bu(e,t)}var Ku=new Set([...uu,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),Mu=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function Uu(e){return Mu.has(e)||!Ku.has(e)}function $u(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const r={...e};for(const n of t)if(n!=null)for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&(i in r&&delete r[i],r[i]=n[i]);return r}var _i,qu=(_i=li.default)!=null?_i:li,Wu=({baseStyle:e})=>t=>{const{theme:r,css:n,__css:i,sx:a,...c}=t,u=Bo(c,(v,w)=>fu(w)),p=_u(e,t),h=$u({},i,p,Lo(u),a),m=vu(h)(t.theme);return n?[m,n]:m};function Un(e,t){const{baseStyle:r,...n}=t??{};n.shouldForwardProp||(n.shouldForwardProp=Uu);const i=Wu({baseStyle:r}),a=qu(e,n)(i);return I.forwardRef(function(p,h){const{colorMode:m,forced:v}=ko();return I.createElement(a,{ref:h,"data-theme":v?m:void 0,...p})})}function zu(){const e=new Map;return new Proxy(Un,{apply(t,r,n){return Un(...n)},get(t,r){return e.has(r)||e.set(r,Un(r)),e.get(r)}})}var ji=zu();function Ko(e){return I.forwardRef(e)}var ki={path:s.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[s.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),s.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),s.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},Mo=Ko((e,t)=>{const{as:r,viewBox:n,color:i="currentColor",focusable:a=!1,children:c,className:u,__css:p,...h}=e,m=Tl("chakra-icon",u),v=Lu("Icon",e),w={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:i,...p,...v},b={ref:t,focusable:a,className:m,__css:w},x=n??ki.viewBox;if(r&&typeof r!="string")return s.jsx(ji.svg,{as:r,...b,...h});const S=c??ki.path;return s.jsx(ji.svg,{verticalAlign:"middle",viewBox:x,...b,...h,children:S})});Mo.displayName="Icon";function Ju(e){const{viewBox:t="0 0 24 24",d:r,displayName:n,defaultProps:i={}}=e,a=I.Children.toArray(e.path),c=Ko((u,p)=>s.jsx(Mo,{ref:p,viewBox:t,...i,...u,children:a.length?a:s.jsx("path",{fill:"currentColor",d:r})}));return c.displayName=n,c}var Hu=Ju({displayName:"ExternalLinkIcon",path:s.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[s.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),s.jsx("path",{d:"M15 3h6v6"}),s.jsx("path",{d:"M10 14L21 3"})]})});const Xu="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function Gu({handleSubmit:e,setWorkspace:t,error:r,isButtonDisabled:n}){return s.jsx(Gt,{children:s.jsxs(y.FormControl,{children:[s.jsx(y.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsx(y.Heading,{as:"h4",size:"md",children:"Enter your Salesforce subdomain"})}),s.jsxs(y.Link,{href:Xu,color:"blackAlpha.600",isExternal:!0,children:["What is my Salesforce subdomain?",s.jsx(Hu,{mx:"2px"})]}),s.jsx(Vt,{error:r}),s.jsxs(y.Flex,{marginTop:"1em",children:[s.jsx(y.Input,{placeholder:"MyDomain",onChange:i=>t(i.currentTarget.value)}),s.jsx(y.Text,{lineHeight:"2.2em",marginLeft:"0.4em",children:".my.salesforce.com"})]}),s.jsx("br",{}),s.jsx(y.Button,{isDisabled:n,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function Vu({handleSubmit:e,setWorkspace:t,error:r,isButtonDisabled:n,providerName:i}){return s.jsx(Gt,{children:s.jsxs(y.FormControl,{children:[s.jsx(y.FormLabel,{marginTop:"16",marginBottom:"0",children:s.jsxs(y.Heading,{as:"h4",size:"md",children:["Enter your ",i," workspace"]})}),s.jsx(Vt,{error:r}),s.jsx(y.Flex,{marginTop:"1em",children:s.jsx(y.Input,{placeholder:"MyWorkspace",onChange:a=>t(a.currentTarget.value)})}),s.jsx("br",{}),s.jsx(y.Button,{isDisabled:n,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}const Yu="salesforce";function Zu({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:i,providerName:a}){const{projectId:c}=Y(),u=Z(),[p,h]=I.useState(""),[m,v]=I.useState(null),[w,b]=I.useState(null),x=async()=>{if(b(null),!p){b("Workspace is required");return}try{const A=await Ao(c,t,n,u,e,p,r,i);v(A)}catch(A){console.error(A),b((A==null?void 0:A.message)??"Unexpected error")}},S=I.useCallback(A=>{b(A),v(null)},[]),O=e===Yu?s.jsx(Gu,{handleSubmit:x,setWorkspace:h,error:w,isButtonDisabled:p.length===0}):s.jsx(Vu,{handleSubmit:x,setWorkspace:h,error:w,isButtonDisabled:p.length===0,providerName:a});return s.jsx(_o,{windowTitle:`Connect to ${a}`,oauthUrl:m,onClose:S,children:O})}const Qu="authorizationCode",ep="clientCredentials";function tp({provider:e,providerInfo:t,consumerRef:r,consumerName:n,groupRef:i,groupName:a,selectedConnection:c,setSelectedConnection:u}){if(t.oauth2Opts===void 0)return s.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:p,explicitScopesRequired:h,explicitWorkspaceRequired:m}=t.oauth2Opts,v=st(e,t);return p===Qu?m?s.jsx(Zu,{provider:e,consumerRef:r,consumerName:n,groupRef:i,groupName:a,providerName:v}):s.jsx(Sl,{provider:e,consumerRef:r,consumerName:n,groupRef:i,groupName:a,providerName:v}):p===ep?m?s.jsx(Ol,{provider:e,consumerRef:r,consumerName:n,groupRef:i,groupName:a,explicitScopesRequired:h,setSelectedConnection:u,selectedConnection:c,providerName:v}):s.jsx(gl,{provider:e,consumerRef:r,consumerName:n,groupRef:i,groupName:a,explicitScopesRequired:h,setSelectedConnection:u,selectedConnection:c,providerName:v}):p==="password"?s.jsx("em",{children:"Password flow not supported yet"}):p==="PKCE"?s.jsx("em",{children:"PKCE flow not supported yet"}):s.jsxs("em",{children:["Unsupported grant type: ",p]})}const rp=async(e,t)=>{const r=await H().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!r)throw new Error(`Provider ${t} not found`);return r};function Uo({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:i,children:a,onSuccess:c}){const u=Z(),[p,h]=I.useState(null),{provider:m}=Ne(),{selectedConnection:v,setSelectedConnection:w,connections:b}=xt();dl({onSuccess:c});const x=e||m,S=(p==null?void 0:p.displayName)??Vi(x);if(I.useEffect(()=>{if(!v&&b&&b.length>0){const[O]=b;w(O)}rp(u,x).then(O=>{h(O)}).catch(O=>{console.error("Error loading provider info: ",O)})},[b,v,w,u,x]),!e&&!m)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");return v?a:p==null?s.jsx("strong",{children:"Provider not found"}):p.authType==="none"?s.jsx(fl,{provider:x,consumerRef:t,consumerName:r,setSelectedConnection:w,selectedConnection:v,groupRef:n,groupName:i,providerName:S,children:a}):p.authType==="basic"?s.jsx(sl,{provider:x,providerInfo:p,consumerRef:t,consumerName:r,setSelectedConnection:w,selectedConnection:v,groupRef:n,groupName:i,children:a}):p.authType==="apiKey"?s.jsx(nl,{provider:x,providerInfo:p,consumerRef:t,consumerName:r,setSelectedConnection:w,selectedConnection:v,groupRef:n,groupName:i,children:a}):s.jsx(tp,{provider:x,providerInfo:p,consumerRef:t,consumerName:r,groupRef:n,groupName:i,setSelectedConnection:w,selectedConnection:v})}function np({integration:e,consumerRef:t,consumerName:r,groupRef:n,groupName:i,onInstallSuccess:a,onUpdateSuccess:c}){var h;const{projectId:u}=Y(),{errorState:p}=We();return(h=p[V.INTEGRATION_LIST])!=null&&h.apiError?s.jsx(Fe,{message:"Something went wrong, couldn't find integration information"}):s.jsx(Wc,{integration:e,consumerRef:t,consumerName:r,groupRef:n,groupName:i,onInstallSuccess:a,onUpdateSuccess:c,children:s.jsx(eo,{groupRef:n,children:s.jsx(Uo,{consumerRef:t,consumerName:r,groupRef:n,groupName:i,children:s.jsx(ld,{projectId:u,children:s.jsx(Qd,{children:s.jsx(xd,{children:s.jsx(Rd,{children:s.jsx(Hd,{})})})})})})})})}function ip({redirectURL:e,children:t}){return I.useEffect(()=>{e&&window.location.replace(e)},[e]),e?s.jsx(y.Box,{display:"flex",alignItems:"center",justifyContent:"center",children:s.jsx(Ce,{message:"Redirecting..."})}):t}function op({provider:e}){const{appName:t}=Y(),r=`You have successfully connected your ${st(e)} account to ${t}.`;return s.jsx(To,{text:r})}function ap({provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:i,redirectUrl:a,onSuccess:c}){return s.jsx(eo,{provider:e,groupRef:n,children:s.jsx(Uo,{provider:e,consumerRef:t,consumerName:r,groupRef:n,groupName:i,onSuccess:c,children:s.jsx(ip,{redirectURL:a,children:s.jsx(op,{provider:e})})})})}const sp=(e,t)=>{const r=Z(),{projectId:n}=Y(),{integrations:i}=Hi(),[a,c]=I.useState(!1),[u,p]=I.useState(null);if(!r||!n)throw new Error("useIsIntegrationInstalled must be used within AmpersandProvider");if(!e)throw new Error("useIsIntegrationInstalled requires an integration name");if(!t)throw new Error("useIsIntegrationInstalled requires a groupRef");const h=I.useMemo(()=>i==null?void 0:i.reduce((m,v)=>(v==null?void 0:v.name)===e?v:m,{}),[i,e]);return I.useEffect(()=>{h&&H().installationApi.listInstallations({projectIdOrName:n,integrationId:h.id,groupRef:t},{headers:{"x-api-key":r}}).then(m=>{c(!0),p(m.length>0)}).catch(m=>{console.error("Error listing installations: ",m),c(!0)})},[t,r,n,h]),{isLoaded:a,isIntegrationInstalled:u}};exports.AmpersandContext=Gi;exports.AmpersandProvider=Uc;exports.ConnectProvider=ap;exports.InstallIntegration=np;exports.useAmpersandProvider=$c;exports.useIsIntegrationInstalled=sp;
|