@amp-labs/react 1.17.3 → 1.17.4

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.
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),g=require("react"),T=require("@chakra-ui/react");require("react-dom");function Fl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const $=Fl(g),Ml={primary:{bg:"black",color:"white",_hover:{bg:"gray.700",_disabled:{bg:"gray.600"}},_disabled:{bg:"gray.600",color:"gray.300",cursor:"not-allowed",opacity:1}},danger:{bg:"red.50",outline:"2px solid red.100",outlineOffset:"0",borderColor:"red.100",color:"red.800",_hover:{bg:"red.100"}}},Ll=T.extendTheme({components:{Tabs:{baseStyle:{tab:{width:"100%",borderRadius:"4px",_hover:{bg:"gray.200"},_selected:{color:"black",fontWeight:"500",bg:"gray.100",border:"none",_hover:{bg:"gray.200"}}},warningTab:{width:"100%",borderRadius:"4px",_hover:{bg:"red.100"},_selected:{color:"red.800",fontWeight:"500",bg:"red.50",border:"none",_hover:{bg:"red.100"}}}}},Button:{variants:Ml}}}),$l=T.extendTheme(Ll);function Kl({children:e}){return a.jsx(T.ChakraProvider,{theme:$l,children:e})}const Ms=g.createContext(null),Vl=Ms.Provider,Ve=()=>{const e=g.useContext(Ms);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var Se=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e))(Se||{});const Ls=g.createContext(void 0);function sn(){const e=g.useContext(Ls);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Hl=(()=>{const e={};return Object.values(Se).forEach(t=>{e[t]={}}),e})();function Bl({children:e}){const[t,n]=g.useState(Hl),r=g.useCallback((d,f,h=!0)=>{n(p=>{const m={...p};return m[d]=m[d]||{},m[d][f]=h,m})},[n]),i=g.useCallback((d,f)=>{var h;return!!((h=t[d])!=null&&h[f])},[t]),o=g.useCallback((d,f)=>{var h;return(h=t[d])==null?void 0:h[f]},[t]),s=g.useCallback((d,f)=>{n(h=>{var m;const p={...h};return(m=p[d])==null||delete m[f],p})},[n]),c=g.useCallback(d=>{n(f=>{const h={...f};return h[d]={},h})},[n]),l=g.useCallback((d,f)=>{n(h=>{const p={...h};return p[d]=p[d]||{},f.forEach(m=>{p[d][m]=!0}),p})},[n]),u=g.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:c,setErrors:l,getError:o}),[t,n,r,i,s,c,l,o]);return a.jsx(Ls.Provider,{value:u,children:e})}function Ui(){return a.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.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"}),a.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ul(e,t){try{return process.env[e]}catch{return t}}function Xn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function At(e,t){return(t==null?void 0:t.displayName)??Xn(e)}const Uo=e=>e.split(`
2
- `).filter(n=>n.trim()!==""),ql=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,je=Ul("REACT_APP_ENABLE_CSS",!1)==="true",Wl="_box_1is6l_1",qi={box:Wl};function an({children:e,className:t,style:n}){return je?a.jsx("div",{className:t?`${qi.box} ${t}`:qi.box,style:n,children:e}):a.jsx(T.Box,{className:t,style:n,borderWidth:1,borderRadius:4,children:e})}const Jl="_container_1wvzr_1",Wi={container:Jl};function Mn({children:e,className:t,style:n}){return je?a.jsx("div",{className:t?`${Wi.container} ${t}`:Wi.container,style:n,children:e}):a.jsx(T.Container,{className:t,style:n,children:e})}const zl="_errorBoxContainer_1qhwq_1",Xl="_errorBox_1qhwq_1",Gl="_errorText_1qhwq_20",so={errorBoxContainer:zl,errorBox:Xl,errorText:Gl};function qt({message:e}){return je?a.jsxs(Mn,{className:so.errorBoxContainer,children:[a.jsx(Ui,{}),a.jsx(an,{className:so.errorBox,children:a.jsx("p",{className:so.errorText,children:e})})]}):a.jsxs(T.Box,{minHeight:"300px",padding:"30px",display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"center",children:[a.jsx(Ui,{}),a.jsx(T.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:a.jsx(T.Text,{color:"#991B1B",fontSize:"md",children:e})})]})}const Yl="https://api.withampersand.com/v1".replace(/\/+$/,"");class $s{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Yl}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Vs}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 Zl=new $s,Ur=class Ur{constructor(t=Zl){this.configuration=t,this.fetchApi=async(n,r)=>{let i={url:n,init:r};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let o;try{o=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const c of this.middleware)c.onError&&(o=await c.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:o?o.clone():void 0})||o);if(o===void 0)throw s instanceof Error?new tu(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(o=await s.post({fetch:this.fetchApi,url:i.url,init:i.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?Ur.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:i}=await this.createFetchParams(t,n),o=await this.fetchApi(r,i);if(o&&o.status>=200&&o.status<300)return o;throw new Ks(o,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(u=>i[u]===void 0?delete i[u]:{});const o=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},c={...s,...await o({init:s,context:t})},l={...c,body:eu(c.body)||c.body instanceof URLSearchParams||Ql(c.body)?c.body:JSON.stringify(c.body)};return{url:r,init:l}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Ur.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let jt=Ur;function Ql(e){return typeof Blob<"u"&&e instanceof Blob}function eu(e){return typeof FormData<"u"&&e instanceof FormData}class Ks extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class tu extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ie extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function K(e,t){const n=e[t];return n!=null}function Vs(e,t=""){return Object.keys(e).map(n=>Hs(n,e[n],t)).filter(n=>n.length>0).join("&")}function Hs(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const i=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${i}`}if(t instanceof Set){const i=Array.from(t);return Hs(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Vs(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function qo(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class De{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Nn{constructor(t){this.raw=t}async value(){}}class nu{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function ru(e){return ou(e)}function ou(e,t){return e==null?e:{fieldUsed:K(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:K(e,"keyFormat")?e.keyFormat:void 0}}function iu(e){return su(e)}function su(e,t){return e==null?e:{name:e.name,valuePrefix:K(e,"valuePrefix")?e.valuePrefix:void 0}}function au(e){return cu(e)}function cu(e,t){return e==null?e:{name:e.name}}function lu(e){return uu(e)}function uu(e,t){return e==null?e:{attachmentType:e.attachmentType,query:K(e,"query")?au(e.query):void 0,header:K(e,"header")?iu(e.header):void 0,docsURL:K(e,"docsURL")?e.docsURL:void 0}}function du(e){return pu(e)}function pu(e,t){return e}function fu(e){return mu(e)}function mu(e,t){return e==null?e:{days:K(e,"days")?e.days:void 0,fullHistory:K(e,"fullHistory")?e.fullHistory:void 0}}function hu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Bs(e){return gu(e)}function gu(e,t){return e==null?e:{defaultPeriod:fu(e.defaultPeriod)}}function yu(e){if(e!==void 0)return e===null?null:{defaultPeriod:hu(e.defaultPeriod)}}function vu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function wu(e){if(e!==void 0)return e===null?null:{defaultPeriod:vu(e.defaultPeriod)}}function Iu(e){return xu(e)}function xu(e,t){return e==null?e:{enabled:K(e,"enabled")?e.enabled:void 0}}function Us(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function bu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:wu(e.backfill)}}function _u(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qo(e.objects,bu)}}function Cu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function Su(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qo(e.objects,Cu)}}function Eu(e){return Ou(e)}function Ou(e,t){return e==null?e:{apiKeyAsBasic:K(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:K(e,"apiKeyAsBasicOpts")?ru(e.apiKeyAsBasicOpts):void 0,docsURL:K(e,"docsURL")?e.docsURL:void 0}}function Nu(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function gr(e){return Tu(e)}function Tu(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:K(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Ru(e){return Au(e)}function Au(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function ju(e){return Pu(e)}function Pu(e,t){return e==null?e:{provider:e.provider,read:K(e,"read")?e.read:void 0,write:K(e,"write")?e.write:void 0,proxy:K(e,"proxy")?Iu(e.proxy):void 0}}function qs(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:Us(e.proxy)}}function Du(e){return ku(e)}function ku(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:ju(e.content)}}function Fu(e){return Mu(e)}function Mu(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Ws(e){return Lu(e)}function Lu(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Cr(e){return $u(e)}function $u(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:K(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:K(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Sr(e){return Ku(e)}function Ku(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:Cr(e.providerApp),group:Ws(e.group),consumer:Fu(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:K(e,"ProviderConsumerRef")?e.ProviderConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Vu(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:qs(e.content)}}function Hu(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Vu(e.config)}}function Bu(e){return Uu(e)}function Uu(e,t){return e==null?e:{enabled:K(e,"enabled")?e.enabled:void 0}}function qu(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Wu(e){return Ju(e)}function Ju(e,t){return e==null?e:{mode:K(e,"mode")?e.mode:void 0,pageSize:K(e,"pageSize")?e.pageSize:void 0}}function zu(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Xu(e){let t=!0;return t=t&&"fieldName"in e,t}function Gu(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:K(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Yu(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Zu(e){let t=!0;return t=t&&"mapToName"in e,t}function Js(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:K(e,"default")?e.default:void 0,prompt:K(e,"prompt")?e.prompt:void 0}}function Qu(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Ji(e){return ed(e)}function ed(e,t){return e==null?e:{...Gu(e),...Js(e)}}function zi(e){if(e!==void 0)return e===null?null:Xu(e)?Yu(e):Zu(e)?Qu(e):{}}function zs(e){return td(e)}function td(e,t){return e}function nd(e){return rd(e)}function rd(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:K(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:K(e,"requiredFields")?e.requiredFields.map(Ji):void 0,optionalFields:K(e,"optionalFields")?e.optionalFields.map(Ji):void 0,optionalFieldsAuto:K(e,"optionalFieldsAuto")?zs(e.optionalFieldsAuto):void 0,backfill:K(e,"backfill")?Bs(e.backfill):void 0,delivery:K(e,"delivery")?Wu(e.delivery):void 0}}function od(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(zi),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(zi),optionalFieldsAuto:e.optionalFieldsAuto,backfill:yu(e.backfill),delivery:zu(e.delivery)}}function id(e){return sd(e)}function sd(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(nd):void 0}}function ad(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(od)}}function cd(e){return ld(e)}function ld(e,t){return e==null?e:{objectName:e.objectName,inheritMappingFromRead:K(e,"inheritMappingFromRead")?e.inheritMappingFromRead:void 0}}function ud(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMappingFromRead:e.inheritMappingFromRead}}function dd(e){return pd(e)}function pd(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(cd):void 0}}function fd(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ud)}}function md(e){return hd(e)}function hd(e,t){return e==null?e:{name:e.name,displayName:K(e,"displayName")?e.displayName:void 0,provider:e.provider,read:K(e,"read")?id(e.read):void 0,write:K(e,"write")?dd(e.write):void 0,proxy:K(e,"proxy")?Bu(e.proxy):void 0}}function gd(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:ad(e.read),write:fd(e.write),proxy:qu(e.proxy)}}function yd(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:gd(e.content)}}function vd(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:yd(e.latestRevision)}}function wd(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Id(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 xd(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function bd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function _d(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Cd(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 Sd(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:bd(e.basicAuth),oauth2ClientCredentials:_d(e.oauth2ClientCredentials),oauth2Password:Cd(e.oauth2Password)}}function Ed(e){return Od(e)}function Od(e,t){return e==null?e:{enabled:K(e,"enabled")?e.enabled:void 0}}function Nd(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:K(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0,displayName:e.displayName}}function ao(e){return Td(e)}function Td(e,t){return e==null?e:{...Nd(e),...Js(e)}}function Rd(e){return Ad(e)}function Ad(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:K(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:K(e,"requiredFields")?e.requiredFields.map(ao):void 0,optionalFields:K(e,"optionalFields")?e.optionalFields.map(ao):void 0,optionalFieldsAuto:K(e,"optionalFieldsAuto")?zs(e.optionalFieldsAuto):void 0,allFields:K(e,"allFields")?e.allFields.map(ao):void 0,backfill:K(e,"backfill")?Bs(e.backfill):void 0}}function jd(e){return Pd(e)}function Pd(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(Rd):void 0}}function Dd(e){return kd(e)}function kd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function Fd(e){return Md(e)}function Md(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(Dd):void 0}}function Ld(e){return $d(e)}function $d(e,t){return e==null?e:{name:e.name,displayName:K(e,"displayName")?e.displayName:void 0,provider:e.provider,read:K(e,"read")?jd(e.read):void 0,write:K(e,"write")?Fd(e.write):void 0,proxy:K(e,"proxy")?Ed(e.proxy):void 0}}function Kd(e){return Vd(e)}function Vd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Ld(e.content)}}function Hd(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 Bd(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:qs(e.content)}}function Ud(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:Hd(e.connection),config:Bd(e.config)}}function Un(e){return qd(e)}function qd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:K(e,"group")?Ws(e.group):void 0,healthStatus:e.healthStatus,connection:Sr(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0,config:Du(e.config)}}function Wd(e){return Jd(e)}function Jd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:md(e.content)}}function Xi(e){return zd(e)}function zd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Wd(e.latestRevision)}}function Xd(e){return Gd(e)}function Gd(e,t){return e==null?e:{iconURL:K(e,"iconURL")?e.iconURL:void 0,logoURL:K(e,"logoURL")?e.logoURL:void 0}}function Yd(e){return Zd(e)}function Zd(e,t){return e==null?e:{iconURL:K(e,"iconURL")?e.iconURL:void 0,logoURL:K(e,"logoURL")?e.logoURL:void 0}}function Qd(e){return ep(e)}function ep(e,t){return e==null?e:{regular:K(e,"regular")?Yd(e.regular):void 0,darkMode:K(e,"darkMode")?Xd(e.darkMode):void 0}}function tp(e){return np(e)}function np(e,t){return e==null?e:{workspaceRefField:K(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:K(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:K(e,"scopesField")?e.scopesField:void 0}}function rp(e){return op(e)}function op(e,t){return e==null?e:{grantType:e.grantType,authURL:K(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:K(e,"audience")?e.audience:void 0,tokenMetadataFields:tp(e.tokenMetadataFields),docsURL:K(e,"docsURL")?e.docsURL:void 0,authURLParams:K(e,"authURLParams")?e.authURLParams:void 0}}function ip(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,enableCSRFProtection:e.enableCSRFProtection}}function sp(e){return ap(e)}function ap(e,t){return e==null?e:{bulkWrite:Ru(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function Gi(e){return cp(e)}function cp(e,t){return e==null?e:{name:e.name,authType:du(e.authType),baseURL:e.baseURL,oauth2Opts:K(e,"oauth2Opts")?rp(e.oauth2Opts):void 0,apiKeyOpts:K(e,"apiKeyOpts")?lu(e.apiKeyOpts):void 0,basicOpts:K(e,"basicOpts")?Eu(e.basicOpts):void 0,support:sp(e.support),providerOpts:e.providerOpts,displayName:K(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:K(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:K(e,"media")?Qd(e.media):void 0,labels:K(e,"labels")?e.labels:void 0}}function lp(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:_u(e.read),write:Su(e.write),proxy:Us(e.proxy)}}function up(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:lp(e.content)}}function dp(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:up(e.config)}}function pp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:dp(e.installation)}}function fp(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function mp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:fp(e.project)}}function hp(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 gp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:hp(e.providerApp)}}class yp extends jt{async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Sd(t.generateConnectionParams)},n);return new De(o,s=>Sr(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r},n);return new De(o,s=>Sr(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(Sr))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class vp extends jt{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r,body:Hu(t.installation)},n);return new De(o,s=>Un(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r},n);return new Nn(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r},n);return new De(o,s=>Un(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async importInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling importInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r,body:Ud(t.installation)},n);return new De(o,s=>Un(s))}async importInstallation(t,n){return await(await this.importInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r},n);return new De(o,s=>s.map(Un))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ie("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r,body:pp(t.installationUpdate)},n);return new De(o,s=>Un(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class wp extends jt{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:Nu(t.batchUpsertIntegrationsRequest)},n);return new De(o,s=>s.map(Xi))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ie("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:vd(t.integration)},n);return new Nn(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r},n);return new Nn(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(Xi))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Ip extends jt{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ie("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};i["Content-Type"]="application/json";const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:ip(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new De(o):new nu(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class xp extends jt{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ie("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:wd(t.project)},n);return new De(o,s=>gr(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:r},n);return new Nn(o)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>gr(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new De(i,o=>o.map(gr))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ie("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:mp(t.projectUpdate)},n);return new De(o,s=>gr(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class bp extends jt{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ie("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new De(o,s=>Gi(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new De(i,o=>qo(o,Gi))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class _p extends jt{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ie("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Id(t.providerApp)},n);return new De(o,s=>Cr(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r},n);return new Nn(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(Cr))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ie("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r,body:gp(t.providerAppUpdate)},n);return new De(o,s=>Cr(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Cp extends jt{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r,body:xd(t.revision)},n);return new Nn(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ie("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r},n);return new De(o,s=>Kd(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class Sp{constructor(t){this.connectionApi=new yp(t),this.installationApi=new vp(t),this.integrationApi=new wp(t),this.oAuthApi=new Ip(t),this.projectApi=new xp(t),this.providerApi=new bp(t),this.providerAppApi=new _p(t),this.revisionApi=new Cp(t)}}const Ep="1.17.3",Op="v1",yr="https://api.withampersand.com";function Xs(){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 Np=(e,t)=>`${e}/${t}`;function Tp(){return Np(Xs(),Op)}const Rp=Xs(),Ap=Tp(),jp=new $s({basePath:Ap,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Ep}});let Pp=new Sp(jp);const Ee=()=>Pp;function Dp(){return a.jsx(T.Box,{className:"loading-icon",height:"100%",width:"100%",display:"flex",justifyContent:"center",marginTop:"20%",marginBottom:"20%",children:a.jsx(T.Stack,{alignItems:"center",children:a.jsx(T.Spinner,{height:"100px",width:"100px",alignSelf:"center",thickness:"8px",speed:"1s",emptyColor:"gray.200",color:"blue.500",size:"xl",margin:"20px"})})})}const kp="_loader_h78nh_1",Fp="_rotate_h78nh_1",Mp="_ball1_h78nh_1",Lp="_ball2_h78nh_1",$p={loader:kp,rotate:Fp,ball1:Mp,ball2:Lp};function Kp(){return a.jsx("span",{className:$p.loader})}function Nt(){return je?a.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:a.jsx(Kp,{})}):a.jsx(Dp,{})}const Ge=async(e,t)=>{var n;if(e instanceof Ks){const{status:r,statusText:i}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,i);const o=await e.response.json(),s=((n=o==null?void 0:o.causes)==null?void 0:n.join(`
2
+ `).filter(n=>n.trim()!==""),ql=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,je=Ul("REACT_APP_ENABLE_CSS",!1)==="true",Wl="_box_1is6l_1",qi={box:Wl};function an({children:e,className:t,style:n}){return je?a.jsx("div",{className:t?`${qi.box} ${t}`:qi.box,style:n,children:e}):a.jsx(T.Box,{className:t,style:n,borderWidth:1,borderRadius:4,children:e})}const Jl="_container_1wvzr_1",Wi={container:Jl};function Mn({children:e,className:t,style:n}){return je?a.jsx("div",{className:t?`${Wi.container} ${t}`:Wi.container,style:n,children:e}):a.jsx(T.Container,{className:t,style:n,children:e})}const zl="_errorBoxContainer_1qhwq_1",Xl="_errorBox_1qhwq_1",Gl="_errorText_1qhwq_20",so={errorBoxContainer:zl,errorBox:Xl,errorText:Gl};function qt({message:e}){return je?a.jsxs(Mn,{className:so.errorBoxContainer,children:[a.jsx(Ui,{}),a.jsx(an,{className:so.errorBox,children:a.jsx("p",{className:so.errorText,children:e})})]}):a.jsxs(T.Box,{minHeight:"300px",padding:"30px",display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"center",children:[a.jsx(Ui,{}),a.jsx(T.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:a.jsx(T.Text,{color:"#991B1B",fontSize:"md",children:e})})]})}const Yl="https://api.withampersand.com/v1".replace(/\/+$/,"");class $s{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Yl}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Vs}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 Zl=new $s,Ur=class Ur{constructor(t=Zl){this.configuration=t,this.fetchApi=async(n,r)=>{let i={url:n,init:r};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let o;try{o=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const c of this.middleware)c.onError&&(o=await c.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:o?o.clone():void 0})||o);if(o===void 0)throw s instanceof Error?new tu(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(o=await s.post({fetch:this.fetchApi,url:i.url,init:i.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?Ur.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:i}=await this.createFetchParams(t,n),o=await this.fetchApi(r,i);if(o&&o.status>=200&&o.status<300)return o;throw new Ks(o,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(u=>i[u]===void 0?delete i[u]:{});const o=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},c={...s,...await o({init:s,context:t})},l={...c,body:eu(c.body)||c.body instanceof URLSearchParams||Ql(c.body)?c.body:JSON.stringify(c.body)};return{url:r,init:l}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Ur.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let jt=Ur;function Ql(e){return typeof Blob<"u"&&e instanceof Blob}function eu(e){return typeof FormData<"u"&&e instanceof FormData}class Ks extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class tu extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ie extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function K(e,t){const n=e[t];return n!=null}function Vs(e,t=""){return Object.keys(e).map(n=>Hs(n,e[n],t)).filter(n=>n.length>0).join("&")}function Hs(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const i=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${i}`}if(t instanceof Set){const i=Array.from(t);return Hs(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Vs(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function qo(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class De{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Nn{constructor(t){this.raw=t}async value(){}}class nu{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function ru(e){return ou(e)}function ou(e,t){return e==null?e:{fieldUsed:K(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:K(e,"keyFormat")?e.keyFormat:void 0}}function iu(e){return su(e)}function su(e,t){return e==null?e:{name:e.name,valuePrefix:K(e,"valuePrefix")?e.valuePrefix:void 0}}function au(e){return cu(e)}function cu(e,t){return e==null?e:{name:e.name}}function lu(e){return uu(e)}function uu(e,t){return e==null?e:{attachmentType:e.attachmentType,query:K(e,"query")?au(e.query):void 0,header:K(e,"header")?iu(e.header):void 0,docsURL:K(e,"docsURL")?e.docsURL:void 0}}function du(e){return pu(e)}function pu(e,t){return e}function fu(e){return mu(e)}function mu(e,t){return e==null?e:{days:K(e,"days")?e.days:void 0,fullHistory:K(e,"fullHistory")?e.fullHistory:void 0}}function hu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Bs(e){return gu(e)}function gu(e,t){return e==null?e:{defaultPeriod:fu(e.defaultPeriod)}}function yu(e){if(e!==void 0)return e===null?null:{defaultPeriod:hu(e.defaultPeriod)}}function vu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function wu(e){if(e!==void 0)return e===null?null:{defaultPeriod:vu(e.defaultPeriod)}}function Iu(e){return xu(e)}function xu(e,t){return e==null?e:{enabled:K(e,"enabled")?e.enabled:void 0}}function Us(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function bu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:wu(e.backfill)}}function _u(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qo(e.objects,bu)}}function Cu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function Su(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:qo(e.objects,Cu)}}function Eu(e){return Ou(e)}function Ou(e,t){return e==null?e:{apiKeyAsBasic:K(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:K(e,"apiKeyAsBasicOpts")?ru(e.apiKeyAsBasicOpts):void 0,docsURL:K(e,"docsURL")?e.docsURL:void 0}}function Nu(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function gr(e){return Tu(e)}function Tu(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:K(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Ru(e){return Au(e)}function Au(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function ju(e){return Pu(e)}function Pu(e,t){return e==null?e:{provider:e.provider,read:K(e,"read")?e.read:void 0,write:K(e,"write")?e.write:void 0,proxy:K(e,"proxy")?Iu(e.proxy):void 0}}function qs(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:Us(e.proxy)}}function Du(e){return ku(e)}function ku(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:ju(e.content)}}function Fu(e){return Mu(e)}function Mu(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Ws(e){return Lu(e)}function Lu(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Cr(e){return $u(e)}function $u(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:K(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:K(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Sr(e){return Ku(e)}function Ku(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:Cr(e.providerApp),group:Ws(e.group),consumer:Fu(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:K(e,"ProviderConsumerRef")?e.ProviderConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Vu(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:qs(e.content)}}function Hu(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Vu(e.config)}}function Bu(e){return Uu(e)}function Uu(e,t){return e==null?e:{enabled:K(e,"enabled")?e.enabled:void 0}}function qu(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Wu(e){return Ju(e)}function Ju(e,t){return e==null?e:{mode:K(e,"mode")?e.mode:void 0,pageSize:K(e,"pageSize")?e.pageSize:void 0}}function zu(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Xu(e){let t=!0;return t=t&&"fieldName"in e,t}function Gu(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:K(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Yu(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Zu(e){let t=!0;return t=t&&"mapToName"in e,t}function Js(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:K(e,"default")?e.default:void 0,prompt:K(e,"prompt")?e.prompt:void 0}}function Qu(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Ji(e){return ed(e)}function ed(e,t){return e==null?e:{...Gu(e),...Js(e)}}function zi(e){if(e!==void 0)return e===null?null:Xu(e)?Yu(e):Zu(e)?Qu(e):{}}function zs(e){return td(e)}function td(e,t){return e}function nd(e){return rd(e)}function rd(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:K(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:K(e,"requiredFields")?e.requiredFields.map(Ji):void 0,optionalFields:K(e,"optionalFields")?e.optionalFields.map(Ji):void 0,optionalFieldsAuto:K(e,"optionalFieldsAuto")?zs(e.optionalFieldsAuto):void 0,backfill:K(e,"backfill")?Bs(e.backfill):void 0,delivery:K(e,"delivery")?Wu(e.delivery):void 0}}function od(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(zi),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(zi),optionalFieldsAuto:e.optionalFieldsAuto,backfill:yu(e.backfill),delivery:zu(e.delivery)}}function id(e){return sd(e)}function sd(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(nd):void 0}}function ad(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(od)}}function cd(e){return ld(e)}function ld(e,t){return e==null?e:{objectName:e.objectName,inheritMappingFromRead:K(e,"inheritMappingFromRead")?e.inheritMappingFromRead:void 0}}function ud(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMappingFromRead:e.inheritMappingFromRead}}function dd(e){return pd(e)}function pd(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(cd):void 0}}function fd(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ud)}}function md(e){return hd(e)}function hd(e,t){return e==null?e:{name:e.name,displayName:K(e,"displayName")?e.displayName:void 0,provider:e.provider,read:K(e,"read")?id(e.read):void 0,write:K(e,"write")?dd(e.write):void 0,proxy:K(e,"proxy")?Bu(e.proxy):void 0}}function gd(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:ad(e.read),write:fd(e.write),proxy:qu(e.proxy)}}function yd(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:gd(e.content)}}function vd(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:yd(e.latestRevision)}}function wd(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Id(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 xd(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function bd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function _d(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Cd(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 Sd(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:bd(e.basicAuth),oauth2ClientCredentials:_d(e.oauth2ClientCredentials),oauth2Password:Cd(e.oauth2Password)}}function Ed(e){return Od(e)}function Od(e,t){return e==null?e:{enabled:K(e,"enabled")?e.enabled:void 0}}function Nd(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:K(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0,displayName:e.displayName}}function ao(e){return Td(e)}function Td(e,t){return e==null?e:{...Nd(e),...Js(e)}}function Rd(e){return Ad(e)}function Ad(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:K(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:K(e,"requiredFields")?e.requiredFields.map(ao):void 0,optionalFields:K(e,"optionalFields")?e.optionalFields.map(ao):void 0,optionalFieldsAuto:K(e,"optionalFieldsAuto")?zs(e.optionalFieldsAuto):void 0,allFields:K(e,"allFields")?e.allFields.map(ao):void 0,backfill:K(e,"backfill")?Bs(e.backfill):void 0}}function jd(e){return Pd(e)}function Pd(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(Rd):void 0}}function Dd(e){return kd(e)}function kd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function Fd(e){return Md(e)}function Md(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(Dd):void 0}}function Ld(e){return $d(e)}function $d(e,t){return e==null?e:{name:e.name,displayName:K(e,"displayName")?e.displayName:void 0,provider:e.provider,read:K(e,"read")?jd(e.read):void 0,write:K(e,"write")?Fd(e.write):void 0,proxy:K(e,"proxy")?Ed(e.proxy):void 0}}function Kd(e){return Vd(e)}function Vd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Ld(e.content)}}function Hd(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 Bd(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:qs(e.content)}}function Ud(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:Hd(e.connection),config:Bd(e.config)}}function Un(e){return qd(e)}function qd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:K(e,"group")?Ws(e.group):void 0,healthStatus:e.healthStatus,connection:Sr(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0,config:Du(e.config)}}function Wd(e){return Jd(e)}function Jd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:md(e.content)}}function Xi(e){return zd(e)}function zd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Wd(e.latestRevision)}}function Xd(e){return Gd(e)}function Gd(e,t){return e==null?e:{iconURL:K(e,"iconURL")?e.iconURL:void 0,logoURL:K(e,"logoURL")?e.logoURL:void 0}}function Yd(e){return Zd(e)}function Zd(e,t){return e==null?e:{iconURL:K(e,"iconURL")?e.iconURL:void 0,logoURL:K(e,"logoURL")?e.logoURL:void 0}}function Qd(e){return ep(e)}function ep(e,t){return e==null?e:{regular:K(e,"regular")?Yd(e.regular):void 0,darkMode:K(e,"darkMode")?Xd(e.darkMode):void 0}}function tp(e){return np(e)}function np(e,t){return e==null?e:{workspaceRefField:K(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:K(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:K(e,"scopesField")?e.scopesField:void 0}}function rp(e){return op(e)}function op(e,t){return e==null?e:{grantType:e.grantType,authURL:K(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:K(e,"audience")?e.audience:void 0,tokenMetadataFields:tp(e.tokenMetadataFields),docsURL:K(e,"docsURL")?e.docsURL:void 0,authURLParams:K(e,"authURLParams")?e.authURLParams:void 0}}function ip(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,enableCSRFProtection:e.enableCSRFProtection}}function sp(e){return ap(e)}function ap(e,t){return e==null?e:{bulkWrite:Ru(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function Gi(e){return cp(e)}function cp(e,t){return e==null?e:{name:e.name,authType:du(e.authType),baseURL:e.baseURL,oauth2Opts:K(e,"oauth2Opts")?rp(e.oauth2Opts):void 0,apiKeyOpts:K(e,"apiKeyOpts")?lu(e.apiKeyOpts):void 0,basicOpts:K(e,"basicOpts")?Eu(e.basicOpts):void 0,support:sp(e.support),providerOpts:e.providerOpts,displayName:K(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:K(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:K(e,"media")?Qd(e.media):void 0,labels:K(e,"labels")?e.labels:void 0}}function lp(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:_u(e.read),write:Su(e.write),proxy:Us(e.proxy)}}function up(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:lp(e.content)}}function dp(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:up(e.config)}}function pp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:dp(e.installation)}}function fp(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function mp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:fp(e.project)}}function hp(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 gp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:hp(e.providerApp)}}class yp extends jt{async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Sd(t.generateConnectionParams)},n);return new De(o,s=>Sr(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r},n);return new De(o,s=>Sr(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(Sr))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class vp extends jt{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r,body:Hu(t.installation)},n);return new De(o,s=>Un(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r},n);return new Nn(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r},n);return new De(o,s=>Un(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async importInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling importInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r,body:Ud(t.installation)},n);return new De(o,s=>Un(s))}async importInstallation(t,n){return await(await this.importInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r},n);return new De(o,s=>s.map(Un))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ie("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r,body:pp(t.installationUpdate)},n);return new De(o,s=>Un(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class wp extends jt{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:Nu(t.batchUpsertIntegrationsRequest)},n);return new De(o,s=>s.map(Xi))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ie("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:vd(t.integration)},n);return new Nn(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r},n);return new Nn(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(Xi))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Ip extends jt{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ie("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};i["Content-Type"]="application/json";const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:ip(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new De(o):new nu(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class xp extends jt{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ie("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:wd(t.project)},n);return new De(o,s=>gr(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:r},n);return new Nn(o)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>gr(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new De(i,o=>o.map(gr))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ie("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:mp(t.projectUpdate)},n);return new De(o,s=>gr(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class bp extends jt{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ie("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new De(o,s=>Gi(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new De(i,o=>qo(o,Gi))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class _p extends jt{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ie("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Id(t.providerApp)},n);return new De(o,s=>Cr(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r},n);return new Nn(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(Cr))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ie("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r,body:gp(t.providerAppUpdate)},n);return new De(o,s=>Cr(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Cp extends jt{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r,body:xd(t.revision)},n);return new Nn(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ie("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=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:r},n);return new De(o,s=>Kd(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class Sp{constructor(t){this.connectionApi=new yp(t),this.installationApi=new vp(t),this.integrationApi=new wp(t),this.oAuthApi=new Ip(t),this.projectApi=new xp(t),this.providerApi=new bp(t),this.providerAppApi=new _p(t),this.revisionApi=new Cp(t)}}const Ep="1.17.4",Op="v1",yr="https://api.withampersand.com";function Xs(){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 Np=(e,t)=>`${e}/${t}`;function Tp(){return Np(Xs(),Op)}const Rp=Xs(),Ap=Tp(),jp=new $s({basePath:Ap,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Ep}});let Pp=new Sp(jp);const Ee=()=>Pp;function Dp(){return a.jsx(T.Box,{className:"loading-icon",height:"100%",width:"100%",display:"flex",justifyContent:"center",marginTop:"20%",marginBottom:"20%",children:a.jsx(T.Stack,{alignItems:"center",children:a.jsx(T.Spinner,{height:"100px",width:"100px",alignSelf:"center",thickness:"8px",speed:"1s",emptyColor:"gray.200",color:"blue.500",size:"xl",margin:"20px"})})})}const kp="_loader_h78nh_1",Fp="_rotate_h78nh_1",Mp="_ball1_h78nh_1",Lp="_ball2_h78nh_1",$p={loader:kp,rotate:Fp,ball1:Mp,ball2:Lp};function Kp(){return a.jsx("span",{className:$p.loader})}function Nt(){return je?a.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:a.jsx(Kp,{})}):a.jsx(Dp,{})}const Ge=async(e,t)=>{var n;if(e instanceof Ks){const{status:r,statusText:i}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,i);const o=await e.response.json(),s=((n=o==null?void 0:o.causes)==null?void 0:n.join(`
3
3
  `))||"[ERROR] Creating installation failed.";console.error("[Error Message]",s),t&&t(s)}else console.error("Unexpected error:",e.message)},Gs=g.createContext({integrations:null}),Ys=()=>{const e=g.useContext(Gs);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function Vp({projectIdOrName:e,children:t}){const n=Ve(),{setError:r,isError:i}=sn(),[o,s]=g.useState(null),[c,l]=g.useState(!0);g.useEffect(()=>{Ee().integrationApi.listIntegrations({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(d=>{l(!1),s(d||[])}).catch(d=>{console.error("Error retrieving integration information."),Ge(d),l(!1),r(Se.INTEGRATION_LIST,e)})},[e,n,r]);const u=g.useMemo(()=>({integrations:o}),[o]);return i(Se.INTEGRATION_LIST,e)?a.jsx(qt,{message:"Error retrieving integrations for the project, double check the API key"}):a.jsx(Gs.Provider,{value:u,children:c?a.jsx(Nt,{}):t})}const Zs=g.createContext({project:null,appName:"",projectId:"",projectIdOrName:""}),Re=()=>{const e=g.useContext(Zs);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Hp({projectIdOrName:e,children:t}){const n=Ve(),{isError:r,setError:i}=sn(),[o,s]=g.useState(null),[c,l]=g.useState(!0);g.useEffect(()=>{Ee().projectApi.getProject({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(d=>{l(!1),s(d)}).catch(d=>{console.error("Error loading Ampersand project."),Ge(d),i(Se.PROJECT,e),l(!1)})},[e,n,l,i]);const u=g.useMemo(()=>({projectId:(o==null?void 0:o.id)||"",projectIdOrName:e,project:o,appName:(o==null?void 0:o.appName)||""}),[e,o]);return r(Se.PROJECT,e)?a.jsx(qt,{message:`Error loading project ${e}`}):a.jsx(Zs.Provider,{value:u,children:c?a.jsx(Nt,{}):t})}function Bp(e){const{options:{apiKey:t,projectId:n,project:r},children:i}=e,o=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!o)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return a.jsx(Kl,{children:a.jsx(Bl,{children:a.jsx(Vl,{value:t,children:a.jsx(Hp,{projectIdOrName:o,children:a.jsx(Vp,{projectIdOrName:o,children:i})})})})})}const Qs=g.createContext(null);function Up(){const e=g.useContext(Qs);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
4
- component is wrapped with AmpersandProvider`);return e}const qp=()=>{const[e,t]=g.useState(!1),n=g.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}},ea=g.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function ot(){const e=g.useContext(ea);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Wp({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:c,onUninstallSuccess:l,fieldMapping:u}){const d=Ve(),{projectId:f}=Re(),{integrations:h}=Ys(),{setError:p,isError:m}=sn(),{isIntegrationDeleted:y,setIntegrationDeleted:I}=qp(),[C,w]=g.useState([]),[_,b]=g.useState(!0),x=(C==null?void 0:C[0])||null,E=g.useMemo(()=>ql(t,h||[]),[t,h]);g.useEffect(()=>{E===null&&(h!=null&&h.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,E,h]);const M=g.useCallback(X=>{w([X])},[w]),O=g.useCallback(()=>{E!=null&&E.id&&Ee().installationApi.listInstallations({projectIdOrName:f,integrationId:E.id,groupRef:i},{headers:{"X-Api-Key":d??""}}).then(X=>{b(!1),w(X||[])}).catch(X=>{p(Se.INSTALLATION_LIST,E.id),b(!1),console.error("Error retrieving installation information: ",X)})},[E,f,d,p,i]),V=(E==null?void 0:E.id)||"";g.useEffect(()=>{O()},[O]);const J=g.useMemo(()=>({integrationId:(E==null?void 0:E.id)||"",provider:(E==null?void 0:E.provider)||"",integrationObj:E,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:x,setInstallation:M,resetInstallations:O,onInstallSuccess:s,onUpdateSuccess:c,onUninstallSuccess:l,isIntegrationDeleted:y,setIntegrationDeleted:I,fieldMapping:u}),[E,n,r,i,o,x,M,O,s,c,l,y,I,u]);if(E!==null){const X=`Error retrieving installation information for integration "${(E==null?void 0:E.name)||"unknown"}"`;return m(Se.INSTALLATION_LIST,V)?a.jsx(qt,{message:X}):a.jsx(ea.Provider,{value:J,children:_?a.jsx(Nt,{}):e})}return a.jsx(qt,{message:`Integration "${t}" not found`})}const ta=g.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Ln=()=>{const e=g.useContext(ta);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function na({provider:e,groupRef:t,children:n}){const r=Ve(),{projectId:i}=Re(),[o,s]=g.useState(null),[c,l]=g.useState(null),[u,d]=g.useState(!0),{setError:f,isError:h}=sn(),{provider:p}=ot();if(!i)throw new Error("ConnectionsProvider must be used within AmpersandProvider");const m=e||p;if(!m)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");g.useEffect(()=>{Ee().connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:m},{headers:{"X-Api-Key":r??""}}).then(I=>{d(!1),s(I)}).catch(I=>{console.error(`Error retrieving existing OAuth connections for group ID ${t}.`),Ge(I),d(!1),f(Se.CONNECTION_LIST,i)})},[i,r,t,m,f]);const y=g.useMemo(()=>({connections:o,selectedConnection:c,setConnections:s,setSelectedConnection:l}),[o,c,s,l]);return h(Se.CONNECTION_LIST,i)?a.jsx(qt,{message:"Error retrieving existing connections"}):a.jsx(ta.Provider,{value:y,children:u?a.jsx(Nt,{}):n})}var vr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tr={exports:{}};Tr.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,c="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",h="[object Error]",p="[object Function]",m="[object GeneratorFunction]",y="[object Map]",I="[object Number]",C="[object Null]",w="[object Object]",_="[object Promise]",b="[object Proxy]",x="[object RegExp]",E="[object Set]",M="[object String]",O="[object Symbol]",V="[object Undefined]",J="[object WeakMap]",X="[object ArrayBuffer]",Z="[object DataView]",te="[object Float32Array]",q="[object Float64Array]",ae="[object Int8Array]",re="[object Int16Array]",ee="[object Int32Array]",pe="[object Uint8Array]",me="[object Uint8ClampedArray]",N="[object Uint16Array]",P="[object Uint32Array]",L=/[\\^$.*+?()[\]{}|]/g,k=/^\[object .+?Constructor\]$/,D=/^(?:0|[1-9]\d*)$/,A={};A[te]=A[q]=A[ae]=A[re]=A[ee]=A[pe]=A[me]=A[N]=A[P]=!0,A[c]=A[l]=A[X]=A[d]=A[Z]=A[f]=A[h]=A[p]=A[y]=A[I]=A[w]=A[x]=A[E]=A[M]=A[J]=!1;var G=typeof vr=="object"&&vr&&vr.Object===Object&&vr,Y=typeof self=="object"&&self&&self.Object===Object&&self,H=G||Y||Function("return this")(),Q=t&&!t.nodeType&&t,W=Q&&!0&&e&&!e.nodeType&&e,ce=W&&W.exports===Q,j=ce&&G.process,fe=function(){try{return j&&j.binding&&j.binding("util")}catch{}}(),B=fe&&fe.isTypedArray;function Ie(v,S){for(var R=-1,z=v==null?0:v.length,_e=0,le=[];++R<z;){var Ae=v[R];S(Ae,R,v)&&(le[_e++]=Ae)}return le}function ke(v,S){for(var R=-1,z=S.length,_e=v.length;++R<z;)v[_e+R]=S[R];return v}function qe(v,S){for(var R=-1,z=v==null?0:v.length;++R<z;)if(S(v[R],R,v))return!0;return!1}function Fe(v,S){for(var R=-1,z=Array(v);++R<v;)z[R]=S(R);return z}function he(v){return function(S){return v(S)}}function It(v,S){return v.has(S)}function We(v,S){return v==null?void 0:v[S]}function it(v){var S=-1,R=Array(v.size);return v.forEach(function(z,_e){R[++S]=[_e,z]}),R}function xt(v,S){return function(R){return v(S(R))}}function bt(v){var S=-1,R=Array(v.size);return v.forEach(function(z){R[++S]=z}),R}var Je=Array.prototype,He=Function.prototype,Me=Object.prototype,Oe=H["__core-js_shared__"],_t=He.toString,Ye=Me.hasOwnProperty,Ft=function(){var v=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||"");return v?"Symbol(src)_1."+v:""}(),Jt=Me.toString,st=RegExp("^"+_t.call(Ye).replace(L,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ne=ce?H.Buffer:void 0,Mt=H.Symbol,zt=H.Uint8Array,Lt=Me.propertyIsEnumerable,ln=Je.splice,et=Mt?Mt.toStringTag:void 0,$t=Object.getOwnPropertySymbols,Xt=Ne?Ne.isBuffer:void 0,un=xt(Object.keys,Object),Gt=Cn(H,"DataView"),Ce=Cn(H,"Map"),Ze=Cn(H,"Promise"),ne=Cn(H,"Set"),de=Cn(H,"WeakMap"),Le=Cn(Object,"create"),Kt=fn(Gt),U=fn(Ce),oe=fn(Ze),se=fn(ne),Pe=fn(de),$e=Mt?Mt.prototype:void 0,tt=$e?$e.valueOf:void 0;function Be(v){var S=-1,R=v==null?0:v.length;for(this.clear();++S<R;){var z=v[S];this.set(z[0],z[1])}}function ze(){this.__data__=Le?Le(null):{},this.size=0}function nt(v){var S=this.has(v)&&delete this.__data__[v];return this.size-=S?1:0,S}function be(v){var S=this.__data__;if(Le){var R=S[v];return R===r?void 0:R}return Ye.call(S,v)?S[v]:void 0}function dn(v){var S=this.__data__;return Le?S[v]!==void 0:Ye.call(S,v)}function ro(v,S){var R=this.__data__;return this.size+=this.has(v)?0:1,R[v]=Le&&S===void 0?r:S,this}Be.prototype.clear=ze,Be.prototype.delete=nt,Be.prototype.get=be,Be.prototype.has=dn,Be.prototype.set=ro;function mt(v){var S=-1,R=v==null?0:v.length;for(this.clear();++S<R;){var z=v[S];this.set(z[0],z[1])}}function ar(){this.__data__=[],this.size=0}function cr(v){var S=this.__data__,R=dr(S,v);if(R<0)return!1;var z=S.length-1;return R==z?S.pop():ln.call(S,R,1),--this.size,!0}function lr(v){var S=this.__data__,R=dr(S,v);return R<0?void 0:S[R][1]}function xe(v){return dr(this.__data__,v)>-1}function Ct(v,S){var R=this.__data__,z=dr(R,v);return z<0?(++this.size,R.push([v,S])):R[z][1]=S,this}mt.prototype.clear=ar,mt.prototype.delete=cr,mt.prototype.get=lr,mt.prototype.has=xe,mt.prototype.set=Ct;function St(v){var S=-1,R=v==null?0:v.length;for(this.clear();++S<R;){var z=v[S];this.set(z[0],z[1])}}function pn(){this.size=0,this.__data__={hash:new Be,map:new(Ce||mt),string:new Be}}function oo(v){var S=pr(this,v).delete(v);return this.size-=S?1:0,S}function Vn(v){return pr(this,v).get(v)}function sl(v){return pr(this,v).has(v)}function al(v,S){var R=pr(this,v),z=R.size;return R.set(v,S),this.size+=R.size==z?0:1,this}St.prototype.clear=pn,St.prototype.delete=oo,St.prototype.get=Vn,St.prototype.has=sl,St.prototype.set=al;function ur(v){var S=-1,R=v==null?0:v.length;for(this.__data__=new St;++S<R;)this.add(v[S])}function cl(v){return this.__data__.set(v,r),this}function ll(v){return this.__data__.has(v)}ur.prototype.add=ur.prototype.push=cl,ur.prototype.has=ll;function Yt(v){var S=this.__data__=new mt(v);this.size=S.size}function ul(){this.__data__=new mt,this.size=0}function dl(v){var S=this.__data__,R=S.delete(v);return this.size=S.size,R}function pl(v){return this.__data__.get(v)}function fl(v){return this.__data__.has(v)}function ml(v,S){var R=this.__data__;if(R instanceof mt){var z=R.__data__;if(!Ce||z.length<n-1)return z.push([v,S]),this.size=++R.size,this;R=this.__data__=new St(z)}return R.set(v,S),this.size=R.size,this}Yt.prototype.clear=ul,Yt.prototype.delete=dl,Yt.prototype.get=pl,Yt.prototype.has=fl,Yt.prototype.set=ml;function hl(v,S){var R=fr(v),z=!R&&Rl(v),_e=!R&&!z&&io(v),le=!R&&!z&&!_e&&Hi(v),Ae=R||z||_e||le,Ue=Ae?Fe(v.length,String):[],Xe=Ue.length;for(var Te in v)Ye.call(v,Te)&&!(Ae&&(Te=="length"||_e&&(Te=="offset"||Te=="parent")||le&&(Te=="buffer"||Te=="byteLength"||Te=="byteOffset")||Sl(Te,Xe)))&&Ue.push(Te);return Ue}function dr(v,S){for(var R=v.length;R--;)if(Li(v[R][0],S))return R;return-1}function gl(v,S,R){var z=S(v);return fr(v)?z:ke(z,R(v))}function Hn(v){return v==null?v===void 0?V:C:et&&et in Object(v)?_l(v):Tl(v)}function Di(v){return Bn(v)&&Hn(v)==c}function ki(v,S,R,z,_e){return v===S?!0:v==null||S==null||!Bn(v)&&!Bn(S)?v!==v&&S!==S:yl(v,S,R,z,ki,_e)}function yl(v,S,R,z,_e,le){var Ae=fr(v),Ue=fr(S),Xe=Ae?l:Zt(v),Te=Ue?l:Zt(S);Xe=Xe==c?w:Xe,Te=Te==c?w:Te;var at=Xe==w,Et=Te==w,Qe=Xe==Te;if(Qe&&io(v)){if(!io(S))return!1;Ae=!0,at=!1}if(Qe&&!at)return le||(le=new Yt),Ae||Hi(v)?Fi(v,S,R,z,_e,le):xl(v,S,Xe,R,z,_e,le);if(!(R&i)){var ht=at&&Ye.call(v,"__wrapped__"),gt=Et&&Ye.call(S,"__wrapped__");if(ht||gt){var Qt=ht?v.value():v,Vt=gt?S.value():S;return le||(le=new Yt),_e(Qt,Vt,R,z,le)}}return Qe?(le||(le=new Yt),bl(v,S,R,z,_e,le)):!1}function vl(v){if(!Vi(v)||Ol(v))return!1;var S=$i(v)?st:k;return S.test(fn(v))}function wl(v){return Bn(v)&&Ki(v.length)&&!!A[Hn(v)]}function Il(v){if(!Nl(v))return un(v);var S=[];for(var R in Object(v))Ye.call(v,R)&&R!="constructor"&&S.push(R);return S}function Fi(v,S,R,z,_e,le){var Ae=R&i,Ue=v.length,Xe=S.length;if(Ue!=Xe&&!(Ae&&Xe>Ue))return!1;var Te=le.get(v);if(Te&&le.get(S))return Te==S;var at=-1,Et=!0,Qe=R&o?new ur:void 0;for(le.set(v,S),le.set(S,v);++at<Ue;){var ht=v[at],gt=S[at];if(z)var Qt=Ae?z(gt,ht,at,S,v,le):z(ht,gt,at,v,S,le);if(Qt!==void 0){if(Qt)continue;Et=!1;break}if(Qe){if(!qe(S,function(Vt,mn){if(!It(Qe,mn)&&(ht===Vt||_e(ht,Vt,R,z,le)))return Qe.push(mn)})){Et=!1;break}}else if(!(ht===gt||_e(ht,gt,R,z,le))){Et=!1;break}}return le.delete(v),le.delete(S),Et}function xl(v,S,R,z,_e,le,Ae){switch(R){case Z:if(v.byteLength!=S.byteLength||v.byteOffset!=S.byteOffset)return!1;v=v.buffer,S=S.buffer;case X:return!(v.byteLength!=S.byteLength||!le(new zt(v),new zt(S)));case d:case f:case I:return Li(+v,+S);case h:return v.name==S.name&&v.message==S.message;case x:case M:return v==S+"";case y:var Ue=it;case E:var Xe=z&i;if(Ue||(Ue=bt),v.size!=S.size&&!Xe)return!1;var Te=Ae.get(v);if(Te)return Te==S;z|=o,Ae.set(v,S);var at=Fi(Ue(v),Ue(S),z,_e,le,Ae);return Ae.delete(v),at;case O:if(tt)return tt.call(v)==tt.call(S)}return!1}function bl(v,S,R,z,_e,le){var Ae=R&i,Ue=Mi(v),Xe=Ue.length,Te=Mi(S),at=Te.length;if(Xe!=at&&!Ae)return!1;for(var Et=Xe;Et--;){var Qe=Ue[Et];if(!(Ae?Qe in S:Ye.call(S,Qe)))return!1}var ht=le.get(v);if(ht&&le.get(S))return ht==S;var gt=!0;le.set(v,S),le.set(S,v);for(var Qt=Ae;++Et<Xe;){Qe=Ue[Et];var Vt=v[Qe],mn=S[Qe];if(z)var Bi=Ae?z(mn,Vt,Qe,S,v,le):z(Vt,mn,Qe,v,S,le);if(!(Bi===void 0?Vt===mn||_e(Vt,mn,R,z,le):Bi)){gt=!1;break}Qt||(Qt=Qe=="constructor")}if(gt&&!Qt){var mr=v.constructor,hr=S.constructor;mr!=hr&&"constructor"in v&&"constructor"in S&&!(typeof mr=="function"&&mr instanceof mr&&typeof hr=="function"&&hr instanceof hr)&&(gt=!1)}return le.delete(v),le.delete(S),gt}function Mi(v){return gl(v,Pl,Cl)}function pr(v,S){var R=v.__data__;return El(S)?R[typeof S=="string"?"string":"hash"]:R.map}function Cn(v,S){var R=We(v,S);return vl(R)?R:void 0}function _l(v){var S=Ye.call(v,et),R=v[et];try{v[et]=void 0;var z=!0}catch{}var _e=Jt.call(v);return z&&(S?v[et]=R:delete v[et]),_e}var Cl=$t?function(v){return v==null?[]:(v=Object(v),Ie($t(v),function(S){return Lt.call(v,S)}))}:Dl,Zt=Hn;(Gt&&Zt(new Gt(new ArrayBuffer(1)))!=Z||Ce&&Zt(new Ce)!=y||Ze&&Zt(Ze.resolve())!=_||ne&&Zt(new ne)!=E||de&&Zt(new de)!=J)&&(Zt=function(v){var S=Hn(v),R=S==w?v.constructor:void 0,z=R?fn(R):"";if(z)switch(z){case Kt:return Z;case U:return y;case oe:return _;case se:return E;case Pe:return J}return S});function Sl(v,S){return S=S??s,!!S&&(typeof v=="number"||D.test(v))&&v>-1&&v%1==0&&v<S}function El(v){var S=typeof v;return S=="string"||S=="number"||S=="symbol"||S=="boolean"?v!=="__proto__":v===null}function Ol(v){return!!Ft&&Ft in v}function Nl(v){var S=v&&v.constructor,R=typeof S=="function"&&S.prototype||Me;return v===R}function Tl(v){return Jt.call(v)}function fn(v){if(v!=null){try{return _t.call(v)}catch{}try{return v+""}catch{}}return""}function Li(v,S){return v===S||v!==v&&S!==S}var Rl=Di(function(){return arguments}())?Di:function(v){return Bn(v)&&Ye.call(v,"callee")&&!Lt.call(v,"callee")},fr=Array.isArray;function Al(v){return v!=null&&Ki(v.length)&&!$i(v)}var io=Xt||kl;function jl(v,S){return ki(v,S)}function $i(v){if(!Vi(v))return!1;var S=Hn(v);return S==p||S==m||S==u||S==b}function Ki(v){return typeof v=="number"&&v>-1&&v%1==0&&v<=s}function Vi(v){var S=typeof v;return v!=null&&(S=="object"||S=="function")}function Bn(v){return v!=null&&typeof v=="object"}var Hi=B?he(B):wl;function Pl(v){return Al(v)?hl(v):Il(v)}function Dl(){return[]}function kl(){return!1}e.exports=jl})(Tr,Tr.exports);var Jp=Tr.exports;const zp=Wo(Jp),nn="other";function Pt(e){return e.mapToName!==void 0}function Xp(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Gp(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Pt(n)&&!!n.fieldName))||null}function Yp(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Pt(r)&&!!r.mapToName))||[]}function Zp(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Pt(n)&&!!n.fieldName))||null}const ra=(e,t)=>{var n,r,i;return(i=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:i[t]};function Qp(e){return Pt(e)?e.mapToName:e.fieldName}const Jo=(e,t)=>{var r,i,o;const n=[];return(o=(i=(r=t.content)==null?void 0:r.read)==null?void 0:i.objects)==null||o.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&Xn(s==null?void 0:s.objectName),completed:e?!!ra(e,s.objectName):!1})}),n},zo=e=>{var n;return{name:nn,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function ef(e,t){var o;const n=Jo(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?zo(e):void 0;return i&&n.push(i),n}function oa(e,t,n){const r=(e==null?void 0:e.filter(o=>!(t!=null&&t[o==null?void 0:o.mapToName])))||[],i=r.map(o=>o.mapToName);return n(Se.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Xo(e,t){return zp(e,t)}const tf=(e,t,n)=>{var p,m,y,I,C,w;if(!e)return null;const r=Xp(e,t),i=r&&Gp(r),o=r&&Zp(r),s=r&&Yp(r),c=(r==null?void 0:r.allFields)||[],l=n==null?void 0:n.content,u=((y=(m=(p=l==null?void 0:l.read)==null?void 0:p.objects)==null?void 0:m[t])==null?void 0:y.selectedFields)||{},d=((w=(C=(I=l==null?void 0:l.read)==null?void 0:I.objects)==null?void 0:C[t])==null?void 0:w.selectedFieldMappings)||{},f={...u},h={...d};return{allFields:c,requiredFields:i,optionalFields:o,requiredMapFields:s,selectedOptionalFields:u,selectedFieldMappings:d,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:f,requiredMapFields:h}}},nf=(e,t)=>{var s,c;if(!e)return null;const n=(c=(s=t==null?void 0:t.content)==null?void 0:s.write)==null?void 0:c.objects,r=Object.keys(n||{}),i={};r.forEach(l=>{i[l]=!0});const o={...i};return{writeObjects:(e==null?void 0:e.objects)||[],selectedNonConfigurableWriteFields:i,isWriteModified:!1,savedConfig:{selectedNonConfigurableWriteFields:o}}};function ia(e,t,n){var o,s;const r=(o=e==null?void 0:e.content)==null?void 0:o.read,i=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:tf(r,t,n),write:nf(i,n)}}const sa=(e,t,n,r)=>{const i=ia(e,n,t);r(n,i)},rf=(e,t,n)=>{const r=ef(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=ia(e,o,t))}),n(i)},aa=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(Qp(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},ca=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n};function la(e,t){return t[e]||void 0}async function Go({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:i,apiKey:o,setError:s,setInstallation:c,onInstallSuccess:l}){const u={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:i,config:e}};try{const d=await Ee().installationApi.createInstallation(u,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}});c(d),l==null||l(d.id,d.config)}catch(d){Ge(d,s)}}function qr(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const of=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(i=>i.objectName===t)},sf=(e,t,n,r)=>{const i=aa(e),o=ca(e),s=of(n,t);if(!s)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:s.schedule,destination:s.destination,selectedFields:i,selectedFieldMappings:o,backfill:s.backfill}}}}};return qr(n)&&(c.content.proxy={enabled:!0}),c},af=(e,t,n,r,i,o,s,c,l,u,d,f)=>{const h=sf(l,o,c,r);return h?Go({createConfig:h,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:u,setInstallation:d,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},ua=e=>{var o,s;const t={},n=(o=e.write)==null?void 0:o.writeObjects,r=(s=e.write)==null?void 0:s.selectedNonConfigurableWriteFields,i=r?Object.keys(r):[];return n&&n.forEach(c=>{const l=c.objectName;i.includes(l)&&(t[l]={objectName:l})}),t},cf=e=>{const t=e.content.write;return t==null?void 0:t.objects},lf=(e,t,n)=>{if(!cf(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=ua(e),o={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return qr(t)&&(o.content.proxy={enabled:!0}),o},uf=(e,t,n,r,i,o,s,c,l,u,d)=>{const f=lf(c,s,r);return f?Go({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:l,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},df=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-background").trim()||"#FEF2F2",pf=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-border").trim()||"#FECACA",ff=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-text").trim()||"#991B1B",mf={backgroundColor:df,borderColor:pf,color:ff,padding:".5rem 1rem"};function da({children:e,style:t}){return a.jsx(an,{style:{...mf,...t},children:e})}var pa={exports:{}};/*!
4
+ component is wrapped with AmpersandProvider`);return e}const qp=()=>{const[e,t]=g.useState(!1),n=g.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}},ea=g.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function ot(){const e=g.useContext(ea);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Wp({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:c,onUninstallSuccess:l,fieldMapping:u}){const d=Ve(),{projectId:f}=Re(),{integrations:h}=Ys(),{setError:p,isError:m}=sn(),{isIntegrationDeleted:y,setIntegrationDeleted:I}=qp(),[C,w]=g.useState([]),[_,b]=g.useState(!0),x=(C==null?void 0:C[0])||null,E=g.useMemo(()=>ql(t,h||[]),[t,h]);g.useEffect(()=>{E===null&&(h!=null&&h.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,E,h]);const M=g.useCallback(X=>{w([X])},[w]),O=g.useCallback(()=>{E!=null&&E.id&&Ee().installationApi.listInstallations({projectIdOrName:f,integrationId:E.id,groupRef:i},{headers:{"X-Api-Key":d??""}}).then(X=>{b(!1),w(X||[])}).catch(X=>{p(Se.INSTALLATION_LIST,E.id),b(!1),console.error("Error retrieving installation information: ",X)})},[E,f,d,p,i]),V=(E==null?void 0:E.id)||"";g.useEffect(()=>{O()},[O]);const J=g.useMemo(()=>({integrationId:(E==null?void 0:E.id)||"",provider:(E==null?void 0:E.provider)||"",integrationObj:E,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:x,setInstallation:M,resetInstallations:O,onInstallSuccess:s,onUpdateSuccess:c,onUninstallSuccess:l,isIntegrationDeleted:y,setIntegrationDeleted:I,fieldMapping:u}),[E,n,r,i,o,x,M,O,s,c,l,y,I,u]);if(E!==null){const X=`Error retrieving installation information for integration "${(E==null?void 0:E.name)||"unknown"}"`;return m(Se.INSTALLATION_LIST,V)?a.jsx(qt,{message:X}):a.jsx(ea.Provider,{value:J,children:_?a.jsx(Nt,{}):e})}return a.jsx(qt,{message:`Integration "${t}" not found`})}const ta=g.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Ln=()=>{const e=g.useContext(ta);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function na({provider:e,groupRef:t,children:n}){const r=Ve(),{projectId:i}=Re(),[o,s]=g.useState(null),[c,l]=g.useState(null),[u,d]=g.useState(!0),{setError:f,isError:h}=sn(),{provider:p}=ot();if(!i)throw new Error("ConnectionsProvider must be used within AmpersandProvider");const m=e||p;if(!m)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");g.useEffect(()=>{Ee().connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:m},{headers:{"X-Api-Key":r??""}}).then(I=>{d(!1),s(I)}).catch(I=>{console.error(`Error retrieving existing OAuth connections for group ID ${t}.`),Ge(I),d(!1),f(Se.CONNECTION_LIST,i)})},[i,r,t,m,f]);const y=g.useMemo(()=>({connections:o,selectedConnection:c,setConnections:s,setSelectedConnection:l}),[o,c,s,l]);return h(Se.CONNECTION_LIST,i)?a.jsx(qt,{message:"Error retrieving existing connections"}):a.jsx(ta.Provider,{value:y,children:u?a.jsx(Nt,{}):n})}var vr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Tr={exports:{}};Tr.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,c="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",h="[object Error]",p="[object Function]",m="[object GeneratorFunction]",y="[object Map]",I="[object Number]",C="[object Null]",w="[object Object]",_="[object Promise]",b="[object Proxy]",x="[object RegExp]",E="[object Set]",M="[object String]",O="[object Symbol]",V="[object Undefined]",J="[object WeakMap]",X="[object ArrayBuffer]",Z="[object DataView]",te="[object Float32Array]",q="[object Float64Array]",ae="[object Int8Array]",re="[object Int16Array]",ee="[object Int32Array]",pe="[object Uint8Array]",me="[object Uint8ClampedArray]",N="[object Uint16Array]",P="[object Uint32Array]",L=/[\\^$.*+?()[\]{}|]/g,k=/^\[object .+?Constructor\]$/,D=/^(?:0|[1-9]\d*)$/,A={};A[te]=A[q]=A[ae]=A[re]=A[ee]=A[pe]=A[me]=A[N]=A[P]=!0,A[c]=A[l]=A[X]=A[d]=A[Z]=A[f]=A[h]=A[p]=A[y]=A[I]=A[w]=A[x]=A[E]=A[M]=A[J]=!1;var G=typeof vr=="object"&&vr&&vr.Object===Object&&vr,Y=typeof self=="object"&&self&&self.Object===Object&&self,H=G||Y||Function("return this")(),Q=t&&!t.nodeType&&t,W=Q&&!0&&e&&!e.nodeType&&e,ce=W&&W.exports===Q,j=ce&&G.process,fe=function(){try{return j&&j.binding&&j.binding("util")}catch{}}(),B=fe&&fe.isTypedArray;function Ie(v,S){for(var R=-1,z=v==null?0:v.length,_e=0,le=[];++R<z;){var Ae=v[R];S(Ae,R,v)&&(le[_e++]=Ae)}return le}function ke(v,S){for(var R=-1,z=S.length,_e=v.length;++R<z;)v[_e+R]=S[R];return v}function qe(v,S){for(var R=-1,z=v==null?0:v.length;++R<z;)if(S(v[R],R,v))return!0;return!1}function Fe(v,S){for(var R=-1,z=Array(v);++R<v;)z[R]=S(R);return z}function he(v){return function(S){return v(S)}}function It(v,S){return v.has(S)}function We(v,S){return v==null?void 0:v[S]}function it(v){var S=-1,R=Array(v.size);return v.forEach(function(z,_e){R[++S]=[_e,z]}),R}function xt(v,S){return function(R){return v(S(R))}}function bt(v){var S=-1,R=Array(v.size);return v.forEach(function(z){R[++S]=z}),R}var Je=Array.prototype,He=Function.prototype,Me=Object.prototype,Oe=H["__core-js_shared__"],_t=He.toString,Ye=Me.hasOwnProperty,Ft=function(){var v=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||"");return v?"Symbol(src)_1."+v:""}(),Jt=Me.toString,st=RegExp("^"+_t.call(Ye).replace(L,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ne=ce?H.Buffer:void 0,Mt=H.Symbol,zt=H.Uint8Array,Lt=Me.propertyIsEnumerable,ln=Je.splice,et=Mt?Mt.toStringTag:void 0,$t=Object.getOwnPropertySymbols,Xt=Ne?Ne.isBuffer:void 0,un=xt(Object.keys,Object),Gt=Cn(H,"DataView"),Ce=Cn(H,"Map"),Ze=Cn(H,"Promise"),ne=Cn(H,"Set"),de=Cn(H,"WeakMap"),Le=Cn(Object,"create"),Kt=fn(Gt),U=fn(Ce),oe=fn(Ze),se=fn(ne),Pe=fn(de),$e=Mt?Mt.prototype:void 0,tt=$e?$e.valueOf:void 0;function Be(v){var S=-1,R=v==null?0:v.length;for(this.clear();++S<R;){var z=v[S];this.set(z[0],z[1])}}function ze(){this.__data__=Le?Le(null):{},this.size=0}function nt(v){var S=this.has(v)&&delete this.__data__[v];return this.size-=S?1:0,S}function be(v){var S=this.__data__;if(Le){var R=S[v];return R===r?void 0:R}return Ye.call(S,v)?S[v]:void 0}function dn(v){var S=this.__data__;return Le?S[v]!==void 0:Ye.call(S,v)}function ro(v,S){var R=this.__data__;return this.size+=this.has(v)?0:1,R[v]=Le&&S===void 0?r:S,this}Be.prototype.clear=ze,Be.prototype.delete=nt,Be.prototype.get=be,Be.prototype.has=dn,Be.prototype.set=ro;function mt(v){var S=-1,R=v==null?0:v.length;for(this.clear();++S<R;){var z=v[S];this.set(z[0],z[1])}}function ar(){this.__data__=[],this.size=0}function cr(v){var S=this.__data__,R=dr(S,v);if(R<0)return!1;var z=S.length-1;return R==z?S.pop():ln.call(S,R,1),--this.size,!0}function lr(v){var S=this.__data__,R=dr(S,v);return R<0?void 0:S[R][1]}function xe(v){return dr(this.__data__,v)>-1}function Ct(v,S){var R=this.__data__,z=dr(R,v);return z<0?(++this.size,R.push([v,S])):R[z][1]=S,this}mt.prototype.clear=ar,mt.prototype.delete=cr,mt.prototype.get=lr,mt.prototype.has=xe,mt.prototype.set=Ct;function St(v){var S=-1,R=v==null?0:v.length;for(this.clear();++S<R;){var z=v[S];this.set(z[0],z[1])}}function pn(){this.size=0,this.__data__={hash:new Be,map:new(Ce||mt),string:new Be}}function oo(v){var S=pr(this,v).delete(v);return this.size-=S?1:0,S}function Vn(v){return pr(this,v).get(v)}function sl(v){return pr(this,v).has(v)}function al(v,S){var R=pr(this,v),z=R.size;return R.set(v,S),this.size+=R.size==z?0:1,this}St.prototype.clear=pn,St.prototype.delete=oo,St.prototype.get=Vn,St.prototype.has=sl,St.prototype.set=al;function ur(v){var S=-1,R=v==null?0:v.length;for(this.__data__=new St;++S<R;)this.add(v[S])}function cl(v){return this.__data__.set(v,r),this}function ll(v){return this.__data__.has(v)}ur.prototype.add=ur.prototype.push=cl,ur.prototype.has=ll;function Yt(v){var S=this.__data__=new mt(v);this.size=S.size}function ul(){this.__data__=new mt,this.size=0}function dl(v){var S=this.__data__,R=S.delete(v);return this.size=S.size,R}function pl(v){return this.__data__.get(v)}function fl(v){return this.__data__.has(v)}function ml(v,S){var R=this.__data__;if(R instanceof mt){var z=R.__data__;if(!Ce||z.length<n-1)return z.push([v,S]),this.size=++R.size,this;R=this.__data__=new St(z)}return R.set(v,S),this.size=R.size,this}Yt.prototype.clear=ul,Yt.prototype.delete=dl,Yt.prototype.get=pl,Yt.prototype.has=fl,Yt.prototype.set=ml;function hl(v,S){var R=fr(v),z=!R&&Rl(v),_e=!R&&!z&&io(v),le=!R&&!z&&!_e&&Hi(v),Ae=R||z||_e||le,Ue=Ae?Fe(v.length,String):[],Xe=Ue.length;for(var Te in v)Ye.call(v,Te)&&!(Ae&&(Te=="length"||_e&&(Te=="offset"||Te=="parent")||le&&(Te=="buffer"||Te=="byteLength"||Te=="byteOffset")||Sl(Te,Xe)))&&Ue.push(Te);return Ue}function dr(v,S){for(var R=v.length;R--;)if(Li(v[R][0],S))return R;return-1}function gl(v,S,R){var z=S(v);return fr(v)?z:ke(z,R(v))}function Hn(v){return v==null?v===void 0?V:C:et&&et in Object(v)?_l(v):Tl(v)}function Di(v){return Bn(v)&&Hn(v)==c}function ki(v,S,R,z,_e){return v===S?!0:v==null||S==null||!Bn(v)&&!Bn(S)?v!==v&&S!==S:yl(v,S,R,z,ki,_e)}function yl(v,S,R,z,_e,le){var Ae=fr(v),Ue=fr(S),Xe=Ae?l:Zt(v),Te=Ue?l:Zt(S);Xe=Xe==c?w:Xe,Te=Te==c?w:Te;var at=Xe==w,Et=Te==w,Qe=Xe==Te;if(Qe&&io(v)){if(!io(S))return!1;Ae=!0,at=!1}if(Qe&&!at)return le||(le=new Yt),Ae||Hi(v)?Fi(v,S,R,z,_e,le):xl(v,S,Xe,R,z,_e,le);if(!(R&i)){var ht=at&&Ye.call(v,"__wrapped__"),gt=Et&&Ye.call(S,"__wrapped__");if(ht||gt){var Qt=ht?v.value():v,Vt=gt?S.value():S;return le||(le=new Yt),_e(Qt,Vt,R,z,le)}}return Qe?(le||(le=new Yt),bl(v,S,R,z,_e,le)):!1}function vl(v){if(!Vi(v)||Ol(v))return!1;var S=$i(v)?st:k;return S.test(fn(v))}function wl(v){return Bn(v)&&Ki(v.length)&&!!A[Hn(v)]}function Il(v){if(!Nl(v))return un(v);var S=[];for(var R in Object(v))Ye.call(v,R)&&R!="constructor"&&S.push(R);return S}function Fi(v,S,R,z,_e,le){var Ae=R&i,Ue=v.length,Xe=S.length;if(Ue!=Xe&&!(Ae&&Xe>Ue))return!1;var Te=le.get(v);if(Te&&le.get(S))return Te==S;var at=-1,Et=!0,Qe=R&o?new ur:void 0;for(le.set(v,S),le.set(S,v);++at<Ue;){var ht=v[at],gt=S[at];if(z)var Qt=Ae?z(gt,ht,at,S,v,le):z(ht,gt,at,v,S,le);if(Qt!==void 0){if(Qt)continue;Et=!1;break}if(Qe){if(!qe(S,function(Vt,mn){if(!It(Qe,mn)&&(ht===Vt||_e(ht,Vt,R,z,le)))return Qe.push(mn)})){Et=!1;break}}else if(!(ht===gt||_e(ht,gt,R,z,le))){Et=!1;break}}return le.delete(v),le.delete(S),Et}function xl(v,S,R,z,_e,le,Ae){switch(R){case Z:if(v.byteLength!=S.byteLength||v.byteOffset!=S.byteOffset)return!1;v=v.buffer,S=S.buffer;case X:return!(v.byteLength!=S.byteLength||!le(new zt(v),new zt(S)));case d:case f:case I:return Li(+v,+S);case h:return v.name==S.name&&v.message==S.message;case x:case M:return v==S+"";case y:var Ue=it;case E:var Xe=z&i;if(Ue||(Ue=bt),v.size!=S.size&&!Xe)return!1;var Te=Ae.get(v);if(Te)return Te==S;z|=o,Ae.set(v,S);var at=Fi(Ue(v),Ue(S),z,_e,le,Ae);return Ae.delete(v),at;case O:if(tt)return tt.call(v)==tt.call(S)}return!1}function bl(v,S,R,z,_e,le){var Ae=R&i,Ue=Mi(v),Xe=Ue.length,Te=Mi(S),at=Te.length;if(Xe!=at&&!Ae)return!1;for(var Et=Xe;Et--;){var Qe=Ue[Et];if(!(Ae?Qe in S:Ye.call(S,Qe)))return!1}var ht=le.get(v);if(ht&&le.get(S))return ht==S;var gt=!0;le.set(v,S),le.set(S,v);for(var Qt=Ae;++Et<Xe;){Qe=Ue[Et];var Vt=v[Qe],mn=S[Qe];if(z)var Bi=Ae?z(mn,Vt,Qe,S,v,le):z(Vt,mn,Qe,v,S,le);if(!(Bi===void 0?Vt===mn||_e(Vt,mn,R,z,le):Bi)){gt=!1;break}Qt||(Qt=Qe=="constructor")}if(gt&&!Qt){var mr=v.constructor,hr=S.constructor;mr!=hr&&"constructor"in v&&"constructor"in S&&!(typeof mr=="function"&&mr instanceof mr&&typeof hr=="function"&&hr instanceof hr)&&(gt=!1)}return le.delete(v),le.delete(S),gt}function Mi(v){return gl(v,Pl,Cl)}function pr(v,S){var R=v.__data__;return El(S)?R[typeof S=="string"?"string":"hash"]:R.map}function Cn(v,S){var R=We(v,S);return vl(R)?R:void 0}function _l(v){var S=Ye.call(v,et),R=v[et];try{v[et]=void 0;var z=!0}catch{}var _e=Jt.call(v);return z&&(S?v[et]=R:delete v[et]),_e}var Cl=$t?function(v){return v==null?[]:(v=Object(v),Ie($t(v),function(S){return Lt.call(v,S)}))}:Dl,Zt=Hn;(Gt&&Zt(new Gt(new ArrayBuffer(1)))!=Z||Ce&&Zt(new Ce)!=y||Ze&&Zt(Ze.resolve())!=_||ne&&Zt(new ne)!=E||de&&Zt(new de)!=J)&&(Zt=function(v){var S=Hn(v),R=S==w?v.constructor:void 0,z=R?fn(R):"";if(z)switch(z){case Kt:return Z;case U:return y;case oe:return _;case se:return E;case Pe:return J}return S});function Sl(v,S){return S=S??s,!!S&&(typeof v=="number"||D.test(v))&&v>-1&&v%1==0&&v<S}function El(v){var S=typeof v;return S=="string"||S=="number"||S=="symbol"||S=="boolean"?v!=="__proto__":v===null}function Ol(v){return!!Ft&&Ft in v}function Nl(v){var S=v&&v.constructor,R=typeof S=="function"&&S.prototype||Me;return v===R}function Tl(v){return Jt.call(v)}function fn(v){if(v!=null){try{return _t.call(v)}catch{}try{return v+""}catch{}}return""}function Li(v,S){return v===S||v!==v&&S!==S}var Rl=Di(function(){return arguments}())?Di:function(v){return Bn(v)&&Ye.call(v,"callee")&&!Lt.call(v,"callee")},fr=Array.isArray;function Al(v){return v!=null&&Ki(v.length)&&!$i(v)}var io=Xt||kl;function jl(v,S){return ki(v,S)}function $i(v){if(!Vi(v))return!1;var S=Hn(v);return S==p||S==m||S==u||S==b}function Ki(v){return typeof v=="number"&&v>-1&&v%1==0&&v<=s}function Vi(v){var S=typeof v;return v!=null&&(S=="object"||S=="function")}function Bn(v){return v!=null&&typeof v=="object"}var Hi=B?he(B):wl;function Pl(v){return Al(v)?hl(v):Il(v)}function Dl(){return[]}function kl(){return!1}e.exports=jl})(Tr,Tr.exports);var Jp=Tr.exports;const zp=Wo(Jp),nn="other";function Pt(e){return!e.fieldName}function Xp(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Gp(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Pt(n)&&!!n.fieldName))||null}function Yp(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Pt(r)&&!!r.mapToName))||[]}function Zp(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Pt(n)&&!!n.fieldName))||null}const ra=(e,t)=>{var n,r,i;return(i=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:i[t]};function Qp(e){return Pt(e)?e.mapToName:e.fieldName}const Jo=(e,t)=>{var r,i,o;const n=[];return(o=(i=(r=t.content)==null?void 0:r.read)==null?void 0:i.objects)==null||o.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&Xn(s==null?void 0:s.objectName),completed:e?!!ra(e,s.objectName):!1})}),n},zo=e=>{var n;return{name:nn,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function ef(e,t){var o;const n=Jo(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?zo(e):void 0;return i&&n.push(i),n}function oa(e,t,n){const r=(e==null?void 0:e.filter(o=>!(t!=null&&t[o==null?void 0:o.mapToName])))||[],i=r.map(o=>o.mapToName);return n(Se.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Xo(e,t){return zp(e,t)}const tf=(e,t,n)=>{var p,m,y,I,C,w;if(!e)return null;const r=Xp(e,t),i=r&&Gp(r),o=r&&Zp(r),s=r&&Yp(r),c=(r==null?void 0:r.allFields)||[],l=n==null?void 0:n.content,u=((y=(m=(p=l==null?void 0:l.read)==null?void 0:p.objects)==null?void 0:m[t])==null?void 0:y.selectedFields)||{},d=((w=(C=(I=l==null?void 0:l.read)==null?void 0:I.objects)==null?void 0:C[t])==null?void 0:w.selectedFieldMappings)||{},f={...u},h={...d};return{allFields:c,requiredFields:i,optionalFields:o,requiredMapFields:s,selectedOptionalFields:u,selectedFieldMappings:d,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:f,requiredMapFields:h}}},nf=(e,t)=>{var s,c;if(!e)return null;const n=(c=(s=t==null?void 0:t.content)==null?void 0:s.write)==null?void 0:c.objects,r=Object.keys(n||{}),i={};r.forEach(l=>{i[l]=!0});const o={...i};return{writeObjects:(e==null?void 0:e.objects)||[],selectedNonConfigurableWriteFields:i,isWriteModified:!1,savedConfig:{selectedNonConfigurableWriteFields:o}}};function ia(e,t,n){var o,s;const r=(o=e==null?void 0:e.content)==null?void 0:o.read,i=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:tf(r,t,n),write:nf(i,n)}}const sa=(e,t,n,r)=>{const i=ia(e,n,t);r(n,i)},rf=(e,t,n)=>{const r=ef(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=ia(e,o,t))}),n(i)},aa=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(Qp(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},ca=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n};function la(e,t){return t[e]||void 0}async function Go({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:i,apiKey:o,setError:s,setInstallation:c,onInstallSuccess:l}){const u={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:i,config:e}};try{const d=await Ee().installationApi.createInstallation(u,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}});c(d),l==null||l(d.id,d.config)}catch(d){Ge(d,s)}}function qr(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const of=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(i=>i.objectName===t)},sf=(e,t,n,r)=>{const i=aa(e),o=ca(e),s=of(n,t);if(!s)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:s.schedule,destination:s.destination,selectedFields:i,selectedFieldMappings:o,backfill:s.backfill}}}}};return qr(n)&&(c.content.proxy={enabled:!0}),c},af=(e,t,n,r,i,o,s,c,l,u,d,f)=>{const h=sf(l,o,c,r);return h?Go({createConfig:h,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:u,setInstallation:d,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},ua=e=>{var o,s;const t={},n=(o=e.write)==null?void 0:o.writeObjects,r=(s=e.write)==null?void 0:s.selectedNonConfigurableWriteFields,i=r?Object.keys(r):[];return n&&n.forEach(c=>{const l=c.objectName;i.includes(l)&&(t[l]={objectName:l})}),t},cf=e=>{const t=e.content.write;return t==null?void 0:t.objects},lf=(e,t,n)=>{if(!cf(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=ua(e),o={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return qr(t)&&(o.content.proxy={enabled:!0}),o},uf=(e,t,n,r,i,o,s,c,l,u,d)=>{const f=lf(c,s,r);return f?Go({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:l,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},df=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-background").trim()||"#FEF2F2",pf=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-border").trim()||"#FECACA",ff=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-text").trim()||"#991B1B",mf={backgroundColor:df,borderColor:pf,color:ff,padding:".5rem 1rem"};function da({children:e,style:t}){return a.jsx(an,{style:{...mf,...t},children:e})}var pa={exports:{}};/*!
5
5
  Copyright (c) 2018 Jed Watson.
6
6
  Licensed under the MIT License (MIT), see
7
7
  http://jedwatson.github.io/classnames
@@ -2025,7 +2025,7 @@ class uf {
2025
2025
  this.connectionApi = new tf(t), this.installationApi = new nf(t), this.integrationApi = new rf(t), this.oAuthApi = new of(t), this.projectApi = new af(t), this.providerApi = new sf(t), this.providerAppApi = new cf(t), this.revisionApi = new lf(t);
2026
2026
  }
2027
2027
  }
2028
- const df = "1.17.3", pf = "v1", Dr = "https://api.withampersand.com";
2028
+ const df = "1.17.4", pf = "v1", Dr = "https://api.withampersand.com";
2029
2029
  function bs() {
2030
2030
  try {
2031
2031
  const e = process.env.REACT_APP_AMP_SERVER;
@@ -2841,7 +2841,7 @@ Jr.exports;
2841
2841
  var Af = Jr.exports;
2842
2842
  const Pf = /* @__PURE__ */ pi(Af), hn = "other";
2843
2843
  function qt(e) {
2844
- return e.mapToName !== void 0;
2844
+ return !e.fieldName;
2845
2845
  }
2846
2846
  function Df(e, t) {
2847
2847
  var n;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amp-labs/react",
3
- "version": "1.17.3",
3
+ "version": "1.17.4",
4
4
  "description": "Ampersand React library.",
5
5
  "author": {
6
6
  "name": "Ampersand Labs",