@amp-labs/react 1.14.2 → 1.15.0

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,30 +1,30 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),y=require("react"),S=require("@chakra-ui/react");require("react-dom");function Ya(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const X=Ya(y),Ga={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}},warning:{bg:"red.50",outline:"2px solid red.100",outlineOffset:"0",borderColor:"red.100",color:"red.800",_hover:{bg:"red.100"}}},Za=S.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:Ga}}}),Qa=S.extendTheme(Za);function ec({children:e}){return a.jsx(S.ChakraProvider,{theme:Qa,children:e})}const Yo=y.createContext(null),tc=Yo.Provider,xe=()=>{const e=y.useContext(Yo);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var me=(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))(me||{});const Go=y.createContext(void 0);function dt(){const e=y.useContext(Go);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const nc=(()=>{const e={};return Object.values(me).forEach(t=>{e[t]={}}),e})();function rc({children:e}){const[t,n]=y.useState(nc),o=y.useCallback((p,h,v=!0)=>{n(f=>{const g={...f};return g[p]=g[p]||{},g[p][h]=v,g})},[n]),i=y.useCallback((p,h)=>{var v;return!!((v=t[p])!=null&&v[h])},[t]),r=y.useCallback((p,h)=>{var v;return(v=t[p])==null?void 0:v[h]},[t]),s=y.useCallback((p,h)=>{n(v=>{var g;const f={...v};return(g=f[p])==null||delete g[h],f})},[n]),c=y.useCallback(p=>{n(h=>{const v={...h};return v[p]={},v})},[n]),u=y.useCallback((p,h)=>{n(v=>{const f={...v};return f[p]=f[p]||{},h.forEach(g=>{f[p][g]=!0}),f})},[n]),d=y.useMemo(()=>({errorState:t,setErrorState:n,setError:o,isError:i,removeError:s,resetBoundary:c,setErrors:u,getError:r}),[t,n,o,i,s,c,u,r]);return a.jsx(Go.Provider,{value:d,children:e})}function ho(){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 oc(e,t){try{return process.env[e]}catch{return t}}function Zo(e){return e.charAt(0).toUpperCase()+e.slice(1)}function it(e,t){return(t==null?void 0:t.displayName)??Zo(e)}const Ir=e=>e.split(`
2
- `).filter(n=>n.trim()!==""),ic=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,ve=oc("REACT_APP_ENABLE_CSS",!1)==="true",sc="_box_3e1nt_1",mo={box:sc};function Dt({children:e,className:t,style:n}){return ve?a.jsx("div",{className:t?`${mo.box} ${t}`:mo.box,style:n,children:e}):a.jsx(S.Box,{className:t,style:n,borderWidth:1,borderRadius:4,children:e})}const ac="_container_1wvzr_1",go={container:ac};function Gt({children:e,className:t,style:n}){return ve?a.jsx("div",{className:t?`${go.container} ${t}`:go.container,style:n,children:e}):a.jsx(S.Container,{className:t,style:n,children:e})}const cc="_errorBoxContainer_1qhwq_1",uc="_errorBox_1qhwq_1",lc="_errorText_1qhwq_20",qn={errorBoxContainer:cc,errorBox:uc,errorText:lc};function ot({message:e}){return ve?a.jsxs(Gt,{className:qn.errorBoxContainer,children:[a.jsx(ho,{}),a.jsx(Dt,{className:qn.errorBox,children:a.jsx("p",{className:qn.errorText,children:e})})]}):a.jsxs(S.Box,{minHeight:"300px",padding:"30px",display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"center",children:[a.jsx(ho,{}),a.jsx(S.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(S.Text,{color:"#991B1B",fontSize:"md",children:e})})]})}const dc="https://api.withampersand.com/v1".replace(/\/+$/,"");class Qo{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:dc}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||ti}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 pc=new Qo,An=class An{constructor(t=pc){this.configuration=t,this.fetchApi=async(n,o)=>{let i={url:n,init:o};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let r;try{r=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const c of this.middleware)c.onError&&(r=await c.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:r?r.clone():void 0})||r);if(r===void 0)throw s instanceof Error?new mc(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(r=await s.post({fetch:this.fetchApi,url:i.url,init:i.init,response:r.clone()})||r);return r},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(o=>({pre:o}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(o=>({post:o}));return this.withMiddleware(...n)}isJsonMime(t){return t?An.jsonRegex.test(t):!1}async request(t,n){const{url:o,init:i}=await this.createFetchParams(t,n),r=await this.fetchApi(o,i);if(r&&r.status>=200&&r.status<300)return r;throw new ei(r,"Response returned an error code")}async createFetchParams(t,n){let o=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(o+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(d=>i[d]===void 0?delete i[d]:{});const r=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},c={...s,...await r({init:s,context:t})},u={...c,body:hc(c.body)||c.body instanceof URLSearchParams||fc(c.body)?c.body:JSON.stringify(c.body)};return{url:o,init:u}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};An.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let ze=An;function fc(e){return typeof Blob<"u"&&e instanceof Blob}function hc(e){return typeof FormData<"u"&&e instanceof FormData}class ei extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class mc extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class Y extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function M(e,t){const n=e[t];return n!=null}function ti(e,t=""){return Object.keys(e).map(n=>ni(n,e[n],t)).filter(n=>n.length>0).join("&")}function ni(e,t,n=""){const o=n+(n.length?`[${e}]`:e);if(t instanceof Array){const i=t.map(r=>encodeURIComponent(String(r))).join(`&${encodeURIComponent(o)}=`);return`${encodeURIComponent(o)}=${i}`}if(t instanceof Set){const i=Array.from(t);return ni(e,i,n)}return t instanceof Date?`${encodeURIComponent(o)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?ti(t,o):`${encodeURIComponent(o)}=${encodeURIComponent(String(t))}`}function wr(e,t){return Object.keys(e).reduce((n,o)=>({...n,[o]:t(e[o])}),{})}class ye{constructor(t,n=o=>o){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Nt{constructor(t){this.raw=t}async value(){}}class gc{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function yc(e){return vc(e)}function vc(e,t){return e==null?e:{fieldUsed:M(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:M(e,"keyFormat")?e.keyFormat:void 0}}function Ic(e){return wc(e)}function wc(e,t){return e==null?e:{name:e.name,valuePrefix:M(e,"valuePrefix")?e.valuePrefix:void 0}}function xc(e){return _c(e)}function _c(e,t){return e==null?e:{name:e.name}}function bc(e){return Cc(e)}function Cc(e,t){return e==null?e:{attachmentType:e.attachmentType,query:M(e,"query")?xc(e.query):void 0,header:M(e,"header")?Ic(e.header):void 0,docsURL:M(e,"docsURL")?e.docsURL:void 0}}function Oc(e){return Sc(e)}function Sc(e,t){return e}function Ec(e){return Nc(e)}function Nc(e,t){return e==null?e:{days:M(e,"days")?e.days:void 0,fullHistory:M(e,"fullHistory")?e.fullHistory:void 0}}function Tc(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function ri(e){return Rc(e)}function Rc(e,t){return e==null?e:{defaultPeriod:Ec(e.defaultPeriod)}}function Ac(e){if(e!==void 0)return e===null?null:{defaultPeriod:Tc(e.defaultPeriod)}}function jc(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Pc(e){if(e!==void 0)return e===null?null:{defaultPeriod:jc(e.defaultPeriod)}}function Dc(e){return kc(e)}function kc(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function oi(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Fc(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedFieldMappings:e.selectedFieldMappings,backfill:Pc(e.backfill)}}function Mc(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:wr(e.objects,Fc)}}function Kc(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function Lc(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:wr(e.objects,Kc)}}function $c(e){return Hc(e)}function Hc(e,t){return e==null?e:{apiKeyAsBasic:M(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:M(e,"apiKeyAsBasicOpts")?yc(e.apiKeyAsBasicOpts):void 0,docsURL:M(e,"docsURL")?e.docsURL:void 0}}function Vc(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function un(e){return Uc(e)}function Uc(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:M(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function Bc(e){return qc(e)}function qc(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Wc(e){return Jc(e)}function Jc(e,t){return e==null?e:{provider:e.provider,read:M(e,"read")?e.read:void 0,write:M(e,"write")?e.write:void 0,proxy:M(e,"proxy")?Dc(e.proxy):void 0}}function ii(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:oi(e.proxy)}}function zc(e){return Xc(e)}function Xc(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Wc(e.content)}}function Yc(e){return Gc(e)}function Gc(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function si(e){return Zc(e)}function Zc(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function gn(e){return Qc(e)}function Qc(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:M(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:M(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function yn(e){return eu(e)}function eu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:gn(e.providerApp),group:si(e.group),consumer:Yc(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:M(e,"ProviderConsumerRef")?e.ProviderConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function tu(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:ii(e.content)}}function nu(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:tu(e.config)}}function ru(e){return ou(e)}function ou(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function iu(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function su(e){return au(e)}function au(e,t){return e==null?e:{mode:M(e,"mode")?e.mode:void 0,pageSize:M(e,"pageSize")?e.pageSize:void 0}}function cu(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function uu(e){let t=!0;return t=t&&"fieldName"in e,t}function lu(e,t){return e==null?e:{fieldName:e.fieldName}}function du(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName}}function pu(e){let t=!0;return t=t&&"mapToName"in e,t}function ai(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:M(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:M(e,"default")?e.default:void 0,prompt:M(e,"prompt")?e.prompt:void 0}}function fu(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function yo(e){return hu(e)}function hu(e,t){return e==null?e:{...lu(e),...ai(e)}}function vo(e){if(e!==void 0)return e===null?null:uu(e)?du(e):pu(e)?fu(e):{}}function ci(e){return mu(e)}function mu(e,t){return e}function gu(e){return yu(e)}function yu(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,requiredFields:M(e,"requiredFields")?e.requiredFields.map(yo):void 0,optionalFields:M(e,"optionalFields")?e.optionalFields.map(yo):void 0,optionalFieldsAuto:M(e,"optionalFieldsAuto")?ci(e.optionalFieldsAuto):void 0,backfill:M(e,"backfill")?ri(e.backfill):void 0,delivery:M(e,"delivery")?su(e.delivery):void 0}}function vu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(vo),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(vo),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Ac(e.backfill),delivery:cu(e.delivery)}}function Iu(e){return wu(e)}function wu(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(gu):void 0}}function xu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(vu)}}function _u(e){return bu(e)}function bu(e,t){return e==null?e:{objectName:e.objectName}}function Cu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function Ou(e){return Su(e)}function Su(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(_u):void 0}}function Eu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Cu)}}function Nu(e){return Tu(e)}function Tu(e,t){return e==null?e:{name:e.name,displayName:M(e,"displayName")?e.displayName:void 0,provider:e.provider,read:M(e,"read")?Iu(e.read):void 0,write:M(e,"write")?Ou(e.write):void 0,proxy:M(e,"proxy")?ru(e.proxy):void 0}}function Ru(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:xu(e.read),write:Eu(e.write),proxy:iu(e.proxy)}}function Au(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Ru(e.content)}}function ju(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Au(e.latestRevision)}}function Pu(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Du(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 ku(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Fu(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Mu(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Ku(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 Lu(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:Fu(e.basicAuth),oauth2ClientCredentials:Mu(e.oauth2ClientCredentials),oauth2Password:Ku(e.oauth2Password)}}function $u(e){return Hu(e)}function Hu(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function Vu(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName}}function Wn(e){return Uu(e)}function Uu(e,t){return e==null?e:{...Vu(e),...ai(e)}}function Bu(e){return qu(e)}function qu(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,destination:e.destination,schedule:e.schedule,requiredFields:M(e,"requiredFields")?e.requiredFields.map(Wn):void 0,optionalFields:M(e,"optionalFields")?e.optionalFields.map(Wn):void 0,optionalFieldsAuto:M(e,"optionalFieldsAuto")?ci(e.optionalFieldsAuto):void 0,allFields:M(e,"allFields")?e.allFields.map(Wn):void 0,backfill:M(e,"backfill")?ri(e.backfill):void 0}}function Wu(e){return Ju(e)}function Ju(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(Bu):void 0}}function zu(e){return Xu(e)}function Xu(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function Yu(e){return Gu(e)}function Gu(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(zu):void 0}}function Zu(e){return Qu(e)}function Qu(e,t){return e==null?e:{name:e.name,displayName:M(e,"displayName")?e.displayName:void 0,provider:e.provider,read:M(e,"read")?Wu(e.read):void 0,write:M(e,"write")?Yu(e.write):void 0,proxy:M(e,"proxy")?$u(e.proxy):void 0}}function el(e){return tl(e)}function tl(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Zu(e.content)}}function nl(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 rl(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:ii(e.content)}}function ol(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:nl(e.connection),config:rl(e.config)}}function Ut(e){return il(e)}function il(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:M(e,"group")?si(e.group):void 0,healthStatus:e.healthStatus,connection:yn(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0,config:zc(e.config)}}function sl(e){return al(e)}function al(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Nu(e.content)}}function Io(e){return cl(e)}function cl(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:sl(e.latestRevision)}}function ul(e){return ll(e)}function ll(e,t){return e==null?e:{iconURL:M(e,"iconURL")?e.iconURL:void 0,logoURL:M(e,"logoURL")?e.logoURL:void 0}}function dl(e){return pl(e)}function pl(e,t){return e==null?e:{iconURL:M(e,"iconURL")?e.iconURL:void 0,logoURL:M(e,"logoURL")?e.logoURL:void 0}}function fl(e){return hl(e)}function hl(e,t){return e==null?e:{regular:M(e,"regular")?dl(e.regular):void 0,darkMode:M(e,"darkMode")?ul(e.darkMode):void 0}}function ml(e){return gl(e)}function gl(e,t){return e==null?e:{workspaceRefField:M(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:M(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:M(e,"scopesField")?e.scopesField:void 0}}function yl(e){return vl(e)}function vl(e,t){return e==null?e:{grantType:e.grantType,authURL:M(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:M(e,"audience")?e.audience:void 0,tokenMetadataFields:ml(e.tokenMetadataFields),docsURL:M(e,"docsURL")?e.docsURL:void 0,authURLParams:M(e,"authURLParams")?e.authURLParams:void 0}}function Il(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider}}function wl(e){return xl(e)}function xl(e,t){return e==null?e:{bulkWrite:Bc(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function wo(e){return _l(e)}function _l(e,t){return e==null?e:{name:e.name,authType:Oc(e.authType),baseURL:e.baseURL,oauth2Opts:M(e,"oauth2Opts")?yl(e.oauth2Opts):void 0,apiKeyOpts:M(e,"apiKeyOpts")?bc(e.apiKeyOpts):void 0,basicOpts:M(e,"basicOpts")?$c(e.basicOpts):void 0,support:wl(e.support),providerOpts:e.providerOpts,displayName:M(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:M(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:M(e,"media")?fl(e.media):void 0,labels:M(e,"labels")?e.labels:void 0}}function bl(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Mc(e.read),write:Lc(e.write),proxy:oi(e.proxy)}}function Cl(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:bl(e.content)}}function Ol(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Cl(e.config)}}function Sl(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Ol(e.installation)}}function El(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function Nl(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:El(e.project)}}function Tl(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 Rl(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Tl(e.providerApp)}}class Al extends ze{async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:o,body:Lu(t.generateConnectionParams)},n);return new ye(r,s=>yn(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 Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new Y("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o},n);return new ye(r,s=>yn(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 Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const o={};t.provider!==void 0&&(o.provider=t.provider),t.groupRef!==void 0&&(o.groupRef=t.groupRef),t.consumerRef!==void 0&&(o.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:o},n);return new ye(r,s=>s.map(yn))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class jl extends ze{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new Y("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new Y("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o,body:nu(t.installation)},n);return new ye(r,s=>Ut(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 Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new Y("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new Y("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o},n);return new Nt(r)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new Y("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new Y("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o},n);return new ye(r,s=>Ut(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 Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new Y("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new Y("installation","Required parameter requestParameters.installation was null or undefined when calling importInstallation.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o,body:ol(t.installation)},n);return new ye(r,s=>Ut(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 Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new Y("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const o={};t.groupRef!==void 0&&(o.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o},n);return new ye(r,s=>s.map(Ut))}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 Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new Y("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new Y("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new Y("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o,body:Sl(t.installationUpdate)},n);return new ye(r,s=>Ut(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Pl extends ze{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:o,body:Vc(t.batchUpsertIntegrationsRequest)},n);return new ye(r,s=>s.map(Io))}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 Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new Y("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:o,body:ju(t.integration)},n);return new Nt(r)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new Y("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o},n);return new Nt(r)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:o},n);return new ye(r,s=>s.map(Io))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Dl extends ze{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new Y("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const o={},i={};i["Content-Type"]="application/json";const r=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:o,body:Il(t.connectOAuthParams)},n);return this.isJsonMime(r.headers.get("content-type"))?new ye(r):new gc(r)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class kl extends ze{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new Y("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects",method:"POST",headers:i,query:o,body:Pu(t.project)},n);return new ye(r,s=>un(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 Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:o},n);return new Nt(r)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:o},n);return new ye(r,s=>un(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"GET",headers:o,query:n},t);return new ye(i,r=>r.map(un))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new Y("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:o,body:Nl(t.projectUpdate)},n);return new ye(r,s=>un(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Fl extends ze{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new Y("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:o},n);return new ye(r,s=>wo(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers",method:"GET",headers:o,query:n},t);return new ye(i,r=>wr(r,wo))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Ml extends ze{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new Y("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:o,body:Du(t.providerApp)},n);return new ye(r,s=>gn(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 Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new Y("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o},n);return new Nt(r)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:o},n);return new ye(r,s=>s.map(gn))}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 Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new Y("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new Y("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o,body:Rl(t.providerAppUpdate)},n);return new ye(r,s=>gn(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Kl extends ze{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new Y("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o,body:ku(t.revision)},n);return new Nt(r)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new Y("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new Y("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new Y("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new Y("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const o={};t.connectionId!==void 0&&(o.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o},n);return new ye(r,s=>el(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class Ll{constructor(t){this.connectionApi=new Al(t),this.installationApi=new jl(t),this.integrationApi=new Pl(t),this.oAuthApi=new Dl(t),this.projectApi=new kl(t),this.providerApi=new Fl(t),this.providerAppApi=new Ml(t),this.revisionApi=new Kl(t)}}const $l="1.14.2",Hl="v1",ln="https://api.withampersand.com";function ui(){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 ln;case"mock":return"http://127.0.0.1:4010";case"":return ln;default:return e??ln}}catch{return ln}}const Vl=(e,t)=>`${e}/${t}`;function Ul(){return Vl(ui(),Hl)}const Bl=ui(),ql=Ul(),Wl=new Qo({basePath:ql,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":$l}});let Jl=new Ll(Wl);const fe=()=>Jl;function zl(){return a.jsx(S.Box,{className:"loading-icon",height:"100%",width:"100%",display:"flex",justifyContent:"center",marginTop:"20%",marginBottom:"20%",children:a.jsx(S.Stack,{alignItems:"center",children:a.jsx(S.Spinner,{height:"100px",width:"100px",alignSelf:"center",thickness:"8px",speed:"1s",emptyColor:"gray.200",color:"blue.500",size:"xl",margin:"20px"})})})}const Xl="_loader_h78nh_1",Yl="_rotate_h78nh_1",Gl="_ball1_h78nh_1",Zl="_ball2_h78nh_1",Ql={loader:Xl,rotate:Yl,ball1:Gl,ball2:Zl};function ed(){return a.jsx("span",{className:Ql.loader})}function qe(){return ve?a.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:a.jsx(ed,{})}):a.jsx(zl,{})}const Ce=async(e,t)=>{var n;if(e instanceof ei){const{status:o,statusText:i}=e.response;console.error(o===500?"Internal Server Error (500):":o===400?"Bad Request (400):":`Error (${o}):`,i);const r=await e.response.json(),s=((n=r==null?void 0:r.causes)==null?void 0:n.join(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),y=require("react"),N=require("@chakra-ui/react");require("react-dom");function Ya(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Y=Ya(y),Ga={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}},warning:{bg:"red.50",outline:"2px solid red.100",outlineOffset:"0",borderColor:"red.100",color:"red.800",_hover:{bg:"red.100"}}},Za=N.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:Ga}}}),Qa=N.extendTheme(Za);function ec({children:e}){return a.jsx(N.ChakraProvider,{theme:Qa,children:e})}const Yo=y.createContext(null),tc=Yo.Provider,xe=()=>{const e=y.useContext(Yo);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var me=(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))(me||{});const Go=y.createContext(void 0);function dt(){const e=y.useContext(Go);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const nc=(()=>{const e={};return Object.values(me).forEach(t=>{e[t]={}}),e})();function rc({children:e}){const[t,n]=y.useState(nc),o=y.useCallback((p,h,g=!0)=>{n(f=>{const m={...f};return m[p]=m[p]||{},m[p][h]=g,m})},[n]),i=y.useCallback((p,h)=>{var g;return!!((g=t[p])!=null&&g[h])},[t]),r=y.useCallback((p,h)=>{var g;return(g=t[p])==null?void 0:g[h]},[t]),s=y.useCallback((p,h)=>{n(g=>{var m;const f={...g};return(m=f[p])==null||delete m[h],f})},[n]),c=y.useCallback(p=>{n(h=>{const g={...h};return g[p]={},g})},[n]),u=y.useCallback((p,h)=>{n(g=>{const f={...g};return f[p]=f[p]||{},h.forEach(m=>{f[p][m]=!0}),f})},[n]),d=y.useMemo(()=>({errorState:t,setErrorState:n,setError:o,isError:i,removeError:s,resetBoundary:c,setErrors:u,getError:r}),[t,n,o,i,s,c,u,r]);return a.jsx(Go.Provider,{value:d,children:e})}function ho(){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 oc(e,t){try{return process.env[e]}catch{return t}}function Zo(e){return e.charAt(0).toUpperCase()+e.slice(1)}function it(e,t){return(t==null?void 0:t.displayName)??Zo(e)}const Ir=e=>e.split(`
2
+ `).filter(n=>n.trim()!==""),ic=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,ve=oc("REACT_APP_ENABLE_CSS",!1)==="true",sc="_box_3e1nt_1",mo={box:sc};function Dt({children:e,className:t,style:n}){return ve?a.jsx("div",{className:t?`${mo.box} ${t}`:mo.box,style:n,children:e}):a.jsx(N.Box,{className:t,style:n,borderWidth:1,borderRadius:4,children:e})}const ac="_container_1wvzr_1",go={container:ac};function Gt({children:e,className:t,style:n}){return ve?a.jsx("div",{className:t?`${go.container} ${t}`:go.container,style:n,children:e}):a.jsx(N.Container,{className:t,style:n,children:e})}const cc="_errorBoxContainer_1qhwq_1",uc="_errorBox_1qhwq_1",lc="_errorText_1qhwq_20",qn={errorBoxContainer:cc,errorBox:uc,errorText:lc};function ot({message:e}){return ve?a.jsxs(Gt,{className:qn.errorBoxContainer,children:[a.jsx(ho,{}),a.jsx(Dt,{className:qn.errorBox,children:a.jsx("p",{className:qn.errorText,children:e})})]}):a.jsxs(N.Box,{minHeight:"300px",padding:"30px",display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"center",children:[a.jsx(ho,{}),a.jsx(N.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(N.Text,{color:"#991B1B",fontSize:"md",children:e})})]})}const dc="https://api.withampersand.com/v1".replace(/\/+$/,"");class Qo{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:dc}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||ti}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 pc=new Qo,An=class An{constructor(t=pc){this.configuration=t,this.fetchApi=async(n,o)=>{let i={url:n,init:o};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let r;try{r=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const c of this.middleware)c.onError&&(r=await c.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:r?r.clone():void 0})||r);if(r===void 0)throw s instanceof Error?new mc(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(r=await s.post({fetch:this.fetchApi,url:i.url,init:i.init,response:r.clone()})||r);return r},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(o=>({pre:o}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(o=>({post:o}));return this.withMiddleware(...n)}isJsonMime(t){return t?An.jsonRegex.test(t):!1}async request(t,n){const{url:o,init:i}=await this.createFetchParams(t,n),r=await this.fetchApi(o,i);if(r&&r.status>=200&&r.status<300)return r;throw new ei(r,"Response returned an error code")}async createFetchParams(t,n){let o=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(o+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(d=>i[d]===void 0?delete i[d]:{});const r=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},c={...s,...await r({init:s,context:t})},u={...c,body:hc(c.body)||c.body instanceof URLSearchParams||fc(c.body)?c.body:JSON.stringify(c.body)};return{url:o,init:u}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};An.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Xe=An;function fc(e){return typeof Blob<"u"&&e instanceof Blob}function hc(e){return typeof FormData<"u"&&e instanceof FormData}class ei extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class mc extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class G extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function M(e,t){const n=e[t];return n!=null}function ti(e,t=""){return Object.keys(e).map(n=>ni(n,e[n],t)).filter(n=>n.length>0).join("&")}function ni(e,t,n=""){const o=n+(n.length?`[${e}]`:e);if(t instanceof Array){const i=t.map(r=>encodeURIComponent(String(r))).join(`&${encodeURIComponent(o)}=`);return`${encodeURIComponent(o)}=${i}`}if(t instanceof Set){const i=Array.from(t);return ni(e,i,n)}return t instanceof Date?`${encodeURIComponent(o)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?ti(t,o):`${encodeURIComponent(o)}=${encodeURIComponent(String(t))}`}function wr(e,t){return Object.keys(e).reduce((n,o)=>({...n,[o]:t(e[o])}),{})}class ye{constructor(t,n=o=>o){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Et{constructor(t){this.raw=t}async value(){}}class gc{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function yc(e){return vc(e)}function vc(e,t){return e==null?e:{fieldUsed:M(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:M(e,"keyFormat")?e.keyFormat:void 0}}function Ic(e){return wc(e)}function wc(e,t){return e==null?e:{name:e.name,valuePrefix:M(e,"valuePrefix")?e.valuePrefix:void 0}}function xc(e){return _c(e)}function _c(e,t){return e==null?e:{name:e.name}}function bc(e){return Cc(e)}function Cc(e,t){return e==null?e:{attachmentType:e.attachmentType,query:M(e,"query")?xc(e.query):void 0,header:M(e,"header")?Ic(e.header):void 0,docsURL:M(e,"docsURL")?e.docsURL:void 0}}function Oc(e){return Sc(e)}function Sc(e,t){return e}function Nc(e){return Ec(e)}function Ec(e,t){return e==null?e:{days:M(e,"days")?e.days:void 0,fullHistory:M(e,"fullHistory")?e.fullHistory:void 0}}function Tc(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function ri(e){return Rc(e)}function Rc(e,t){return e==null?e:{defaultPeriod:Nc(e.defaultPeriod)}}function Ac(e){if(e!==void 0)return e===null?null:{defaultPeriod:Tc(e.defaultPeriod)}}function jc(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Pc(e){if(e!==void 0)return e===null?null:{defaultPeriod:jc(e.defaultPeriod)}}function Dc(e){return kc(e)}function kc(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function oi(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Fc(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedFieldMappings:e.selectedFieldMappings,backfill:Pc(e.backfill)}}function Mc(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:wr(e.objects,Fc)}}function Kc(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function Lc(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:wr(e.objects,Kc)}}function $c(e){return Hc(e)}function Hc(e,t){return e==null?e:{apiKeyAsBasic:M(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:M(e,"apiKeyAsBasicOpts")?yc(e.apiKeyAsBasicOpts):void 0,docsURL:M(e,"docsURL")?e.docsURL:void 0}}function Vc(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function un(e){return Uc(e)}function Uc(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:M(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function Bc(e){return qc(e)}function qc(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Wc(e){return Jc(e)}function Jc(e,t){return e==null?e:{provider:e.provider,read:M(e,"read")?e.read:void 0,write:M(e,"write")?e.write:void 0,proxy:M(e,"proxy")?Dc(e.proxy):void 0}}function ii(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:oi(e.proxy)}}function zc(e){return Xc(e)}function Xc(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Wc(e.content)}}function Yc(e){return Gc(e)}function Gc(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function si(e){return Zc(e)}function Zc(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function gn(e){return Qc(e)}function Qc(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:M(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:M(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function yn(e){return eu(e)}function eu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:gn(e.providerApp),group:si(e.group),consumer:Yc(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:M(e,"ProviderConsumerRef")?e.ProviderConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function tu(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:ii(e.content)}}function nu(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:tu(e.config)}}function ru(e){return ou(e)}function ou(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function iu(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function su(e){return au(e)}function au(e,t){return e==null?e:{mode:M(e,"mode")?e.mode:void 0,pageSize:M(e,"pageSize")?e.pageSize:void 0}}function cu(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function uu(e){let t=!0;return t=t&&"fieldName"in e,t}function lu(e,t){return e==null?e:{fieldName:e.fieldName}}function du(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName}}function pu(e){let t=!0;return t=t&&"mapToName"in e,t}function ai(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:M(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:M(e,"default")?e.default:void 0,prompt:M(e,"prompt")?e.prompt:void 0}}function fu(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function yo(e){return hu(e)}function hu(e,t){return e==null?e:{...lu(e),...ai(e)}}function vo(e){if(e!==void 0)return e===null?null:uu(e)?du(e):pu(e)?fu(e):{}}function ci(e){return mu(e)}function mu(e,t){return e}function gu(e){return yu(e)}function yu(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,requiredFields:M(e,"requiredFields")?e.requiredFields.map(yo):void 0,optionalFields:M(e,"optionalFields")?e.optionalFields.map(yo):void 0,optionalFieldsAuto:M(e,"optionalFieldsAuto")?ci(e.optionalFieldsAuto):void 0,backfill:M(e,"backfill")?ri(e.backfill):void 0,delivery:M(e,"delivery")?su(e.delivery):void 0}}function vu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(vo),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(vo),optionalFieldsAuto:e.optionalFieldsAuto,backfill:Ac(e.backfill),delivery:cu(e.delivery)}}function Iu(e){return wu(e)}function wu(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(gu):void 0}}function xu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(vu)}}function _u(e){return bu(e)}function bu(e,t){return e==null?e:{objectName:e.objectName}}function Cu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function Ou(e){return Su(e)}function Su(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(_u):void 0}}function Nu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Cu)}}function Eu(e){return Tu(e)}function Tu(e,t){return e==null?e:{name:e.name,displayName:M(e,"displayName")?e.displayName:void 0,provider:e.provider,read:M(e,"read")?Iu(e.read):void 0,write:M(e,"write")?Ou(e.write):void 0,proxy:M(e,"proxy")?ru(e.proxy):void 0}}function Ru(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:xu(e.read),write:Nu(e.write),proxy:iu(e.proxy)}}function Au(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Ru(e.content)}}function ju(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Au(e.latestRevision)}}function Pu(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Du(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 ku(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Fu(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Mu(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Ku(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 Lu(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:Fu(e.basicAuth),oauth2ClientCredentials:Mu(e.oauth2ClientCredentials),oauth2Password:Ku(e.oauth2Password)}}function $u(e){return Hu(e)}function Hu(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function Vu(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName}}function Wn(e){return Uu(e)}function Uu(e,t){return e==null?e:{...Vu(e),...ai(e)}}function Bu(e){return qu(e)}function qu(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,destination:e.destination,schedule:e.schedule,requiredFields:M(e,"requiredFields")?e.requiredFields.map(Wn):void 0,optionalFields:M(e,"optionalFields")?e.optionalFields.map(Wn):void 0,optionalFieldsAuto:M(e,"optionalFieldsAuto")?ci(e.optionalFieldsAuto):void 0,allFields:M(e,"allFields")?e.allFields.map(Wn):void 0,backfill:M(e,"backfill")?ri(e.backfill):void 0}}function Wu(e){return Ju(e)}function Ju(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(Bu):void 0}}function zu(e){return Xu(e)}function Xu(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function Yu(e){return Gu(e)}function Gu(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(zu):void 0}}function Zu(e){return Qu(e)}function Qu(e,t){return e==null?e:{name:e.name,displayName:M(e,"displayName")?e.displayName:void 0,provider:e.provider,read:M(e,"read")?Wu(e.read):void 0,write:M(e,"write")?Yu(e.write):void 0,proxy:M(e,"proxy")?$u(e.proxy):void 0}}function el(e){return tl(e)}function tl(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Zu(e.content)}}function nl(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 rl(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:ii(e.content)}}function ol(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:nl(e.connection),config:rl(e.config)}}function Ut(e){return il(e)}function il(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:M(e,"group")?si(e.group):void 0,healthStatus:e.healthStatus,connection:yn(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0,config:zc(e.config)}}function sl(e){return al(e)}function al(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Eu(e.content)}}function Io(e){return cl(e)}function cl(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:sl(e.latestRevision)}}function ul(e){return ll(e)}function ll(e,t){return e==null?e:{iconURL:M(e,"iconURL")?e.iconURL:void 0,logoURL:M(e,"logoURL")?e.logoURL:void 0}}function dl(e){return pl(e)}function pl(e,t){return e==null?e:{iconURL:M(e,"iconURL")?e.iconURL:void 0,logoURL:M(e,"logoURL")?e.logoURL:void 0}}function fl(e){return hl(e)}function hl(e,t){return e==null?e:{regular:M(e,"regular")?dl(e.regular):void 0,darkMode:M(e,"darkMode")?ul(e.darkMode):void 0}}function ml(e){return gl(e)}function gl(e,t){return e==null?e:{workspaceRefField:M(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:M(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:M(e,"scopesField")?e.scopesField:void 0}}function yl(e){return vl(e)}function vl(e,t){return e==null?e:{grantType:e.grantType,authURL:M(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:M(e,"audience")?e.audience:void 0,tokenMetadataFields:ml(e.tokenMetadataFields),docsURL:M(e,"docsURL")?e.docsURL:void 0,authURLParams:M(e,"authURLParams")?e.authURLParams:void 0}}function Il(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider}}function wl(e){return xl(e)}function xl(e,t){return e==null?e:{bulkWrite:Bc(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function wo(e){return _l(e)}function _l(e,t){return e==null?e:{name:e.name,authType:Oc(e.authType),baseURL:e.baseURL,oauth2Opts:M(e,"oauth2Opts")?yl(e.oauth2Opts):void 0,apiKeyOpts:M(e,"apiKeyOpts")?bc(e.apiKeyOpts):void 0,basicOpts:M(e,"basicOpts")?$c(e.basicOpts):void 0,support:wl(e.support),providerOpts:e.providerOpts,displayName:M(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:M(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:M(e,"media")?fl(e.media):void 0,labels:M(e,"labels")?e.labels:void 0}}function bl(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Mc(e.read),write:Lc(e.write),proxy:oi(e.proxy)}}function Cl(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:bl(e.content)}}function Ol(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Cl(e.config)}}function Sl(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Ol(e.installation)}}function Nl(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function El(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:Nl(e.project)}}function Tl(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 Rl(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Tl(e.providerApp)}}class Al extends Xe{async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:o,body:Lu(t.generateConnectionParams)},n);return new ye(r,s=>yn(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 G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new G("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o},n);return new ye(r,s=>yn(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 G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const o={};t.provider!==void 0&&(o.provider=t.provider),t.groupRef!==void 0&&(o.groupRef=t.groupRef),t.consumerRef!==void 0&&(o.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:o},n);return new ye(r,s=>s.map(yn))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class jl extends Xe{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new G("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o,body:nu(t.installation)},n);return new ye(r,s=>Ut(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 G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new G("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o},n);return new Et(r)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new G("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o},n);return new ye(r,s=>Ut(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 G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new G("installation","Required parameter requestParameters.installation was null or undefined when calling importInstallation.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o,body:ol(t.installation)},n);return new ye(r,s=>Ut(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 G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const o={};t.groupRef!==void 0&&(o.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o},n);return new ye(r,s=>s.map(Ut))}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 G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new G("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new G("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o,body:Sl(t.installationUpdate)},n);return new ye(r,s=>Ut(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Pl extends Xe{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:o,body:Vc(t.batchUpsertIntegrationsRequest)},n);return new ye(r,s=>s.map(Io))}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 G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new G("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:o,body:ju(t.integration)},n);return new Et(r)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o},n);return new Et(r)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:o},n);return new ye(r,s=>s.map(Io))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Dl extends Xe{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new G("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const o={},i={};i["Content-Type"]="application/json";const r=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:o,body:Il(t.connectOAuthParams)},n);return this.isJsonMime(r.headers.get("content-type"))?new ye(r):new gc(r)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class kl extends Xe{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new G("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects",method:"POST",headers:i,query:o,body:Pu(t.project)},n);return new ye(r,s=>un(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 G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:o},n);return new Et(r)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:o},n);return new ye(r,s=>un(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"GET",headers:o,query:n},t);return new ye(i,r=>r.map(un))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new G("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:o,body:El(t.projectUpdate)},n);return new ye(r,s=>un(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Fl extends Xe{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new G("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:o},n);return new ye(r,s=>wo(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers",method:"GET",headers:o,query:n},t);return new ye(i,r=>wr(r,wo))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Ml extends Xe{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new G("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:o,body:Du(t.providerApp)},n);return new ye(r,s=>gn(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 G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new G("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o},n);return new Et(r)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:o},n);return new ye(r,s=>s.map(gn))}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 G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new G("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new G("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o,body:Rl(t.providerAppUpdate)},n);return new ye(r,s=>gn(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Kl extends Xe{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o,body:ku(t.revision)},n);return new Et(r)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new G("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new G("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const o={};t.connectionId!==void 0&&(o.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=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:o},n);return new ye(r,s=>el(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class Ll{constructor(t){this.connectionApi=new Al(t),this.installationApi=new jl(t),this.integrationApi=new Pl(t),this.oAuthApi=new Dl(t),this.projectApi=new kl(t),this.providerApi=new Fl(t),this.providerAppApi=new Ml(t),this.revisionApi=new Kl(t)}}const $l="1.15.0",Hl="v1",ln="https://api.withampersand.com";function ui(){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 ln;case"mock":return"http://127.0.0.1:4010";case"":return ln;default:return e??ln}}catch{return ln}}const Vl=(e,t)=>`${e}/${t}`;function Ul(){return Vl(ui(),Hl)}const Bl=ui(),ql=Ul(),Wl=new Qo({basePath:ql,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":$l}});let Jl=new Ll(Wl);const fe=()=>Jl;function zl(){return a.jsx(N.Box,{className:"loading-icon",height:"100%",width:"100%",display:"flex",justifyContent:"center",marginTop:"20%",marginBottom:"20%",children:a.jsx(N.Stack,{alignItems:"center",children:a.jsx(N.Spinner,{height:"100px",width:"100px",alignSelf:"center",thickness:"8px",speed:"1s",emptyColor:"gray.200",color:"blue.500",size:"xl",margin:"20px"})})})}const Xl="_loader_h78nh_1",Yl="_rotate_h78nh_1",Gl="_ball1_h78nh_1",Zl="_ball2_h78nh_1",Ql={loader:Xl,rotate:Yl,ball1:Gl,ball2:Zl};function ed(){return a.jsx("span",{className:Ql.loader})}function qe(){return ve?a.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:a.jsx(ed,{})}):a.jsx(zl,{})}const Ce=async(e,t)=>{var n;if(e instanceof ei){const{status:o,statusText:i}=e.response;console.error(o===500?"Internal Server Error (500):":o===400?"Bad Request (400):":`Error (${o}):`,i);const r=await e.response.json(),s=((n=r==null?void 0:r.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)},li=y.createContext({integrations:null}),di=()=>{const e=y.useContext(li);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function td({projectIdOrName:e,children:t}){const n=xe(),{setError:o,isError:i}=dt(),[r,s]=y.useState(null),[c,u]=y.useState(!0);y.useEffect(()=>{fe().integrationApi.listIntegrations({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(p=>{u(!1),s(p||[])}).catch(p=>{console.error("Error retrieving integration information."),Ce(p),u(!1),o(me.INTEGRATION_LIST,e)})},[e,n,o]);const d=y.useMemo(()=>({integrations:r}),[r]);return i(me.INTEGRATION_LIST,e)?a.jsx(ot,{message:"Error retrieving integrations for the project, double check the API key"}):a.jsx(li.Provider,{value:d,children:c?a.jsx(qe,{}):t})}const pi=y.createContext({project:null,appName:"",projectId:"",projectIdOrName:""}),Ie=()=>{const e=y.useContext(pi);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function nd({projectIdOrName:e,children:t}){const n=xe(),{isError:o,setError:i}=dt(),[r,s]=y.useState(null),[c,u]=y.useState(!0);y.useEffect(()=>{fe().projectApi.getProject({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(p=>{u(!1),s(p)}).catch(p=>{console.error("Error loading Ampersand project."),Ce(p),i(me.PROJECT,e),u(!1)})},[e,n,u,i]);const d=y.useMemo(()=>({projectId:(r==null?void 0:r.id)||"",projectIdOrName:e,project:r,appName:(r==null?void 0:r.appName)||""}),[e,r]);return o(me.PROJECT,e)?a.jsx(ot,{message:`Error loading project ${e}`}):a.jsx(pi.Provider,{value:d,children:c?a.jsx(qe,{}):t})}function rd(e){const{options:{apiKey:t,projectId:n,project:o},children:i}=e,r=o||n;if(n&&o)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!r)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(ec,{children:a.jsx(rc,{children:a.jsx(tc,{value:t,children:a.jsx(nd,{projectIdOrName:r,children:a.jsx(td,{projectIdOrName:r,children:i})})})})})}const fi=y.createContext(null);function od(){const e=y.useContext(fi);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
4
- component is wrapped with AmpersandProvider`);return e}const id=()=>{const[e,t]=y.useState(!1),n=y.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}},hi=y.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 Ye(){const e=y.useContext(hi);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function sd({children:e,integration:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,onInstallSuccess:s,onUpdateSuccess:c,onUninstallSuccess:u}){const d=xe(),{projectId:p}=Ie(),{integrations:h}=di(),{setError:v,isError:f}=dt(),{isIntegrationDeleted:g,setIntegrationDeleted:x}=id(),[w,O]=y.useState([]),[I,C]=y.useState(!0),b=(w==null?void 0:w[0])||null,m=y.useMemo(()=>ic(t,h||[]),[t,h]);y.useEffect(()=>{m===null&&(h!=null&&h.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,m,h]);const j=y.useCallback(B=>{O([B])},[O]),$=y.useCallback(()=>{m!=null&&m.id&&fe().installationApi.listInstallations({projectIdOrName:p,integrationId:m.id,groupRef:i},{headers:{"X-Api-Key":d??""}}).then(B=>{C(!1),O(B||[])}).catch(B=>{v(me.INSTALLATION_LIST,m.id),C(!1),console.error("Error retrieving installation information: ",B)})},[m,p,d,v,i]),F=(m==null?void 0:m.id)||"";y.useEffect(()=>{$()},[$]);const V=y.useMemo(()=>({integrationId:(m==null?void 0:m.id)||"",provider:(m==null?void 0:m.provider)||"",integrationObj:m,consumerRef:n,consumerName:o,groupRef:i,groupName:r,installation:b,setInstallation:j,resetInstallations:$,onInstallSuccess:s,onUpdateSuccess:c,onUninstallSuccess:u,isIntegrationDeleted:g,setIntegrationDeleted:x}),[m,n,o,i,r,b,j,$,s,c,u,g,x]);if(m!==null){const B=`Error retrieving installation information for integration "${(m==null?void 0:m.name)||"unknown"}"`;return f(me.INSTALLATION_LIST,F)?a.jsx(ot,{message:B}):a.jsx(hi.Provider,{value:V,children:I?a.jsx(qe,{}):e})}return a.jsx(ot,{message:`Integration "${t}" not found`})}const mi=y.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),kt=()=>{const e=y.useContext(mi);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function gi({provider:e,groupRef:t,children:n}){const o=xe(),{projectId:i}=Ie(),[r,s]=y.useState(null),[c,u]=y.useState(null),[d,p]=y.useState(!0),{setError:h,isError:v}=dt(),{provider:f}=Ye();if(!i)throw new Error("ConnectionsProvider must be used within AmpersandProvider");const g=e||f;if(!g)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");y.useEffect(()=>{fe().connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:g},{headers:{"X-Api-Key":o??""}}).then(w=>{p(!1),s(w)}).catch(w=>{console.error(`Error retrieving existing OAuth connections for group ID ${t}.`),Ce(w),p(!1),h(me.CONNECTION_LIST,i)})},[i,o,t,g,h]);const x=y.useMemo(()=>({connections:r,selectedConnection:c,setConnections:s,setSelectedConnection:u}),[r,c,s,u]);return v(me.CONNECTION_LIST,i)?a.jsx(ot,{message:"Error retrieving existing connections"}):a.jsx(mi.Provider,{value:x,children:d?a.jsx(qe,{}):n})}var dn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xn={exports:{}};xn.exports;(function(e,t){var n=200,o="__lodash_hash_undefined__",i=1,r=2,s=9007199254740991,c="[object Arguments]",u="[object Array]",d="[object AsyncFunction]",p="[object Boolean]",h="[object Date]",v="[object Error]",f="[object Function]",g="[object GeneratorFunction]",x="[object Map]",w="[object Number]",O="[object Null]",I="[object Object]",C="[object Promise]",b="[object Proxy]",m="[object RegExp]",j="[object Set]",$="[object String]",F="[object Symbol]",V="[object Undefined]",B="[object WeakMap]",Z="[object ArrayBuffer]",G="[object DataView]",te="[object Float32Array]",Q="[object Float64Array]",ue="[object Int8Array]",le="[object Int16Array]",re="[object Int32Array]",Oe="[object Uint8Array]",Ee="[object Uint8ClampedArray]",N="[object Uint16Array]",K="[object Uint32Array]",k=/[\\^$.*+?()[\]{}|]/g,D=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,T={};T[te]=T[Q]=T[ue]=T[le]=T[re]=T[Oe]=T[Ee]=T[N]=T[K]=!0,T[c]=T[u]=T[Z]=T[p]=T[G]=T[h]=T[v]=T[f]=T[x]=T[w]=T[I]=T[m]=T[j]=T[$]=T[B]=!1;var q=typeof dn=="object"&&dn&&dn.Object===Object&&dn,J=typeof self=="object"&&self&&self.Object===Object&&self,U=q||J||Function("return this")(),z=t&&!t.nodeType&&t,W=z&&!0&&e&&!e.nodeType&&e,oe=W&&W.exports===z,A=oe&&q.process,de=function(){try{return A&&A.binding&&A.binding("util")}catch{}}(),L=de&&de.isTypedArray;function Ne(l,_){for(var E=-1,H=l==null?0:l.length,pe=0,ee=[];++E<H;){var ge=l[E];_(ge,E,l)&&(ee[pe++]=ge)}return ee}function Te(l,_){for(var E=-1,H=_.length,pe=l.length;++E<H;)l[pe+E]=_[E];return l}function Ge(l,_){for(var E=-1,H=l==null?0:l.length;++E<H;)if(_(l[E],E,l))return!0;return!1}function Ve(l,_){for(var E=-1,H=Array(l);++E<l;)H[E]=_(E);return H}function Ct(l){return function(_){return l(_)}}function Mt(l,_){return l.has(_)}function Ue(l,_){return l==null?void 0:l[_]}function ft(l){var _=-1,E=Array(l.size);return l.forEach(function(H,pe){E[++_]=[pe,H]}),E}function Kt(l,_){return function(E){return l(_(E))}}function Ot(l){var _=-1,E=Array(l.size);return l.forEach(function(H){E[++_]=H}),E}var We=Array.prototype,Ze=Function.prototype,je=Object.prototype,Re=U["__core-js_shared__"],en=Ze.toString,Je=je.hasOwnProperty,Yr=function(){var l=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""}(),Gr=je.toString,Zs=RegExp("^"+en.call(Je).replace(k,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Zr=oe?U.Buffer:void 0,tn=U.Symbol,Qr=U.Uint8Array,eo=je.propertyIsEnumerable,Qs=We.splice,ht=tn?tn.toStringTag:void 0,to=Object.getOwnPropertySymbols,ea=Zr?Zr.isBuffer:void 0,ta=Kt(Object.keys,Object),Ln=St(U,"DataView"),Lt=St(U,"Map"),$n=St(U,"Promise"),Hn=St(U,"Set"),Vn=St(U,"WeakMap"),$t=St(Object,"create"),na=yt(Ln),ra=yt(Lt),oa=yt($n),ia=yt(Hn),sa=yt(Vn),no=tn?tn.prototype:void 0,Un=no?no.valueOf:void 0;function mt(l){var _=-1,E=l==null?0:l.length;for(this.clear();++_<E;){var H=l[_];this.set(H[0],H[1])}}function aa(){this.__data__=$t?$t(null):{},this.size=0}function ca(l){var _=this.has(l)&&delete this.__data__[l];return this.size-=_?1:0,_}function ua(l){var _=this.__data__;if($t){var E=_[l];return E===o?void 0:E}return Je.call(_,l)?_[l]:void 0}function la(l){var _=this.__data__;return $t?_[l]!==void 0:Je.call(_,l)}function da(l,_){var E=this.__data__;return this.size+=this.has(l)?0:1,E[l]=$t&&_===void 0?o:_,this}mt.prototype.clear=aa,mt.prototype.delete=ca,mt.prototype.get=ua,mt.prototype.has=la,mt.prototype.set=da;function Qe(l){var _=-1,E=l==null?0:l.length;for(this.clear();++_<E;){var H=l[_];this.set(H[0],H[1])}}function pa(){this.__data__=[],this.size=0}function fa(l){var _=this.__data__,E=rn(_,l);if(E<0)return!1;var H=_.length-1;return E==H?_.pop():Qs.call(_,E,1),--this.size,!0}function ha(l){var _=this.__data__,E=rn(_,l);return E<0?void 0:_[E][1]}function ma(l){return rn(this.__data__,l)>-1}function ga(l,_){var E=this.__data__,H=rn(E,l);return H<0?(++this.size,E.push([l,_])):E[H][1]=_,this}Qe.prototype.clear=pa,Qe.prototype.delete=fa,Qe.prototype.get=ha,Qe.prototype.has=ma,Qe.prototype.set=ga;function gt(l){var _=-1,E=l==null?0:l.length;for(this.clear();++_<E;){var H=l[_];this.set(H[0],H[1])}}function ya(){this.size=0,this.__data__={hash:new mt,map:new(Lt||Qe),string:new mt}}function va(l){var _=on(this,l).delete(l);return this.size-=_?1:0,_}function Ia(l){return on(this,l).get(l)}function wa(l){return on(this,l).has(l)}function xa(l,_){var E=on(this,l),H=E.size;return E.set(l,_),this.size+=E.size==H?0:1,this}gt.prototype.clear=ya,gt.prototype.delete=va,gt.prototype.get=Ia,gt.prototype.has=wa,gt.prototype.set=xa;function nn(l){var _=-1,E=l==null?0:l.length;for(this.__data__=new gt;++_<E;)this.add(l[_])}function _a(l){return this.__data__.set(l,o),this}function ba(l){return this.__data__.has(l)}nn.prototype.add=nn.prototype.push=_a,nn.prototype.has=ba;function st(l){var _=this.__data__=new Qe(l);this.size=_.size}function Ca(){this.__data__=new Qe,this.size=0}function Oa(l){var _=this.__data__,E=_.delete(l);return this.size=_.size,E}function Sa(l){return this.__data__.get(l)}function Ea(l){return this.__data__.has(l)}function Na(l,_){var E=this.__data__;if(E instanceof Qe){var H=E.__data__;if(!Lt||H.length<n-1)return H.push([l,_]),this.size=++E.size,this;E=this.__data__=new gt(H)}return E.set(l,_),this.size=E.size,this}st.prototype.clear=Ca,st.prototype.delete=Oa,st.prototype.get=Sa,st.prototype.has=Ea,st.prototype.set=Na;function Ta(l,_){var E=sn(l),H=!E&&Ba(l),pe=!E&&!H&&Bn(l),ee=!E&&!H&&!pe&&po(l),ge=E||H||pe||ee,_e=ge?Ve(l.length,String):[],be=_e.length;for(var he in l)Je.call(l,he)&&!(ge&&(he=="length"||pe&&(he=="offset"||he=="parent")||ee&&(he=="buffer"||he=="byteLength"||he=="byteOffset")||La(he,be)))&&_e.push(he);return _e}function rn(l,_){for(var E=l.length;E--;)if(ao(l[E][0],_))return E;return-1}function Ra(l,_,E){var H=_(l);return sn(l)?H:Te(H,E(l))}function Ht(l){return l==null?l===void 0?V:O:ht&&ht in Object(l)?Ma(l):Ua(l)}function ro(l){return Vt(l)&&Ht(l)==c}function oo(l,_,E,H,pe){return l===_?!0:l==null||_==null||!Vt(l)&&!Vt(_)?l!==l&&_!==_:Aa(l,_,E,H,oo,pe)}function Aa(l,_,E,H,pe,ee){var ge=sn(l),_e=sn(_),be=ge?u:at(l),he=_e?u:at(_);be=be==c?I:be,he=he==c?I:he;var Pe=be==I,Be=he==I,Se=be==he;if(Se&&Bn(l)){if(!Bn(_))return!1;ge=!0,Pe=!1}if(Se&&!Pe)return ee||(ee=new st),ge||po(l)?io(l,_,E,H,pe,ee):ka(l,_,be,E,H,pe,ee);if(!(E&i)){var Le=Pe&&Je.call(l,"__wrapped__"),$e=Be&&Je.call(_,"__wrapped__");if(Le||$e){var ct=Le?l.value():l,et=$e?_.value():_;return ee||(ee=new st),pe(ct,et,E,H,ee)}}return Se?(ee||(ee=new st),Fa(l,_,E,H,pe,ee)):!1}function ja(l){if(!lo(l)||Ha(l))return!1;var _=co(l)?Zs:D;return _.test(yt(l))}function Pa(l){return Vt(l)&&uo(l.length)&&!!T[Ht(l)]}function Da(l){if(!Va(l))return ta(l);var _=[];for(var E in Object(l))Je.call(l,E)&&E!="constructor"&&_.push(E);return _}function io(l,_,E,H,pe,ee){var ge=E&i,_e=l.length,be=_.length;if(_e!=be&&!(ge&&be>_e))return!1;var he=ee.get(l);if(he&&ee.get(_))return he==_;var Pe=-1,Be=!0,Se=E&r?new nn:void 0;for(ee.set(l,_),ee.set(_,l);++Pe<_e;){var Le=l[Pe],$e=_[Pe];if(H)var ct=ge?H($e,Le,Pe,_,l,ee):H(Le,$e,Pe,l,_,ee);if(ct!==void 0){if(ct)continue;Be=!1;break}if(Se){if(!Ge(_,function(et,vt){if(!Mt(Se,vt)&&(Le===et||pe(Le,et,E,H,ee)))return Se.push(vt)})){Be=!1;break}}else if(!(Le===$e||pe(Le,$e,E,H,ee))){Be=!1;break}}return ee.delete(l),ee.delete(_),Be}function ka(l,_,E,H,pe,ee,ge){switch(E){case G:if(l.byteLength!=_.byteLength||l.byteOffset!=_.byteOffset)return!1;l=l.buffer,_=_.buffer;case Z:return!(l.byteLength!=_.byteLength||!ee(new Qr(l),new Qr(_)));case p:case h:case w:return ao(+l,+_);case v:return l.name==_.name&&l.message==_.message;case m:case $:return l==_+"";case x:var _e=ft;case j:var be=H&i;if(_e||(_e=Ot),l.size!=_.size&&!be)return!1;var he=ge.get(l);if(he)return he==_;H|=r,ge.set(l,_);var Pe=io(_e(l),_e(_),H,pe,ee,ge);return ge.delete(l),Pe;case F:if(Un)return Un.call(l)==Un.call(_)}return!1}function Fa(l,_,E,H,pe,ee){var ge=E&i,_e=so(l),be=_e.length,he=so(_),Pe=he.length;if(be!=Pe&&!ge)return!1;for(var Be=be;Be--;){var Se=_e[Be];if(!(ge?Se in _:Je.call(_,Se)))return!1}var Le=ee.get(l);if(Le&&ee.get(_))return Le==_;var $e=!0;ee.set(l,_),ee.set(_,l);for(var ct=ge;++Be<be;){Se=_e[Be];var et=l[Se],vt=_[Se];if(H)var fo=ge?H(vt,et,Se,_,l,ee):H(et,vt,Se,l,_,ee);if(!(fo===void 0?et===vt||pe(et,vt,E,H,ee):fo)){$e=!1;break}ct||(ct=Se=="constructor")}if($e&&!ct){var an=l.constructor,cn=_.constructor;an!=cn&&"constructor"in l&&"constructor"in _&&!(typeof an=="function"&&an instanceof an&&typeof cn=="function"&&cn instanceof cn)&&($e=!1)}return ee.delete(l),ee.delete(_),$e}function so(l){return Ra(l,Ja,Ka)}function on(l,_){var E=l.__data__;return $a(_)?E[typeof _=="string"?"string":"hash"]:E.map}function St(l,_){var E=Ue(l,_);return ja(E)?E:void 0}function Ma(l){var _=Je.call(l,ht),E=l[ht];try{l[ht]=void 0;var H=!0}catch{}var pe=Gr.call(l);return H&&(_?l[ht]=E:delete l[ht]),pe}var Ka=to?function(l){return l==null?[]:(l=Object(l),Ne(to(l),function(_){return eo.call(l,_)}))}:za,at=Ht;(Ln&&at(new Ln(new ArrayBuffer(1)))!=G||Lt&&at(new Lt)!=x||$n&&at($n.resolve())!=C||Hn&&at(new Hn)!=j||Vn&&at(new Vn)!=B)&&(at=function(l){var _=Ht(l),E=_==I?l.constructor:void 0,H=E?yt(E):"";if(H)switch(H){case na:return G;case ra:return x;case oa:return C;case ia:return j;case sa:return B}return _});function La(l,_){return _=_??s,!!_&&(typeof l=="number"||P.test(l))&&l>-1&&l%1==0&&l<_}function $a(l){var _=typeof l;return _=="string"||_=="number"||_=="symbol"||_=="boolean"?l!=="__proto__":l===null}function Ha(l){return!!Yr&&Yr in l}function Va(l){var _=l&&l.constructor,E=typeof _=="function"&&_.prototype||je;return l===E}function Ua(l){return Gr.call(l)}function yt(l){if(l!=null){try{return en.call(l)}catch{}try{return l+""}catch{}}return""}function ao(l,_){return l===_||l!==l&&_!==_}var Ba=ro(function(){return arguments}())?ro:function(l){return Vt(l)&&Je.call(l,"callee")&&!eo.call(l,"callee")},sn=Array.isArray;function qa(l){return l!=null&&uo(l.length)&&!co(l)}var Bn=ea||Xa;function Wa(l,_){return oo(l,_)}function co(l){if(!lo(l))return!1;var _=Ht(l);return _==f||_==g||_==d||_==b}function uo(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=s}function lo(l){var _=typeof l;return l!=null&&(_=="object"||_=="function")}function Vt(l){return l!=null&&typeof l=="object"}var po=L?Ct(L):Pa;function Ja(l){return qa(l)?Ta(l):Da(l)}function za(){return[]}function Xa(){return!1}e.exports=Wa})(xn,xn.exports);var ad=xn.exports;const cd=xr(ad),xt="other";function Xe(e){return e.mapToName!==void 0}function ud(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(o=>o.objectName===t))||null}function ld(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Xe(n)&&!!n.fieldName))||null}function dd(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(o=>Xe(o)&&!!o.mapToName))||[]}function pd(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Xe(n)&&!!n.fieldName))||null}const yi=(e,t)=>{var n,o,i;return(i=(o=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:o.objects)==null?void 0:i[t]};function fd(e){return Xe(e)?e.mapToName:e.fieldName}const vi=(e,t)=>{var o,i,r;const n=[];return(r=(i=(o=t.content)==null?void 0:o.read)==null?void 0:i.objects)==null||r.forEach(s=>{n.push({name:s==null?void 0:s.objectName,completed:e?!!yi(e,s.objectName):!1})}),n},Ii=e=>{var n;return{name:xt,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function hd(e,t){var r;const n=vi(e,t),i=!!((r=t==null?void 0:t.content)!=null&&r.write)?Ii(e):void 0;return i&&n.push(i),n}function wi(e,t,n){const o=(e==null?void 0:e.filter(r=>!(t!=null&&t[r==null?void 0:r.mapToName])))||[],i=o.map(r=>r.mapToName);return n(me.MAPPING,i),o!=null&&o.length&&console.error("required fields not met",o.map(r=>r.mapToDisplayName)),{errorList:i}}function _r(e,t){return cd(e,t)}const md=(e,t,n)=>{var f,g,x,w,O,I;if(!e)return null;const o=ud(e,t),i=o&&ld(o),r=o&&pd(o),s=o&&dd(o),c=(o==null?void 0:o.allFields)||[],u=n==null?void 0:n.content,d=((x=(g=(f=u==null?void 0:u.read)==null?void 0:f.objects)==null?void 0:g[t])==null?void 0:x.selectedFields)||{},p=((I=(O=(w=u==null?void 0:u.read)==null?void 0:w.objects)==null?void 0:O[t])==null?void 0:I.selectedFieldMappings)||{},h={...d},v={...p};return{allFields:c,requiredFields:i,optionalFields:r,requiredMapFields:s,selectedOptionalFields:d,selectedFieldMappings:p,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:h,requiredMapFields:v}}},gd=(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,o=Object.keys(n||{}),i={};o.forEach(u=>{i[u]=!0});const r={...i};return{writeObjects:(e==null?void 0:e.objects)||[],selectedNonConfigurableWriteFields:i,isWriteModified:!1,savedConfig:{selectedNonConfigurableWriteFields:r}}};function xi(e,t,n){var r,s;const o=(r=e==null?void 0:e.content)==null?void 0:r.read,i=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:md(o,t,n),write:gd(i,n)}}const _i=(e,t,n,o)=>{const i=xi(e,n,t);o(n,i)},yd=(e,t,n)=>{const o=hd(t,e),i={};o.forEach(({name:r,completed:s})=>{s&&(i[r]=xi(e,r,t))}),n(i)},bi=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},o=new Set;return t==null||t.forEach(r=>o.add(fd(r))),{...Array.from(o).reduce((r,s)=>({...r,[s]:!0}),{}),...n||{}}},Ci=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(o=>{t[o]!==void 0?n[o]=t[o]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${o}`)}),n};function Oi(e,t){return t[e]||void 0}async function br({createConfig:e,projectId:t,integrationId:n,groupRef:o,connectionId:i,apiKey:r,setError:s,setInstallation:c,onInstallSuccess:u}){const d={projectIdOrName:t,integrationId:n,installation:{groupRef:o,connectionId:i,config:e}};try{const p=await fe().installationApi.createInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}});c(p),u==null||u(p.id,p.config)}catch(p){Ce(p,s)}}function jn(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const vd=(e,t)=>{const n=e.content.read,o=n==null?void 0:n.objects;return o==null?void 0:o.find(i=>i.objectName===t)},Id=(e,t,n,o)=>{const i=bi(e),r=Ci(e),s=vd(n,t);if(!s)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${o}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:s.schedule,destination:s.destination,selectedFields:i,selectedFieldMappings:r,backfill:s.backfill}}}}};return jn(n)&&(c.content.proxy={enabled:!0}),c},wd=(e,t,n,o,i,r,s,c,u,d,p,h)=>{const v=Id(u,r,c,o);return v?br({createConfig:v,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:d,setInstallation:p,onInstallSuccess:h}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Si=e=>{var r,s;const t={},n=(r=e.write)==null?void 0:r.writeObjects,o=(s=e.write)==null?void 0:s.selectedNonConfigurableWriteFields,i=o?Object.keys(o):[];return n&&n.forEach(c=>{const u=c.objectName;i.includes(u)&&(t[u]={objectName:u})}),t},xd=e=>{const t=e.content.write;return t==null?void 0:t.objects},_d=(e,t,n)=>{if(!xd(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=Si(e),r={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return jn(t)&&(r.content.proxy={enabled:!0}),r},bd=(e,t,n,o,i,r,s,c,u,d,p)=>{const h=_d(c,s,o);return h?br({createConfig:h,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:r,setError:u,setInstallation:d,onInstallSuccess:p}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Cd=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-background").trim()||"#FEF2F2",Od=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-border").trim()||"#FECACA",Sd=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-text").trim()||"#991B1B",Ed={backgroundColor:Cd,borderColor:Od,color:Sd,padding:".5rem 1rem"};function Ei({children:e,style:t}){return a.jsx(Dt,{style:{...Ed,...t},children:e})}var Ni={exports:{}};/*!
4
+ component is wrapped with AmpersandProvider`);return e}const id=()=>{const[e,t]=y.useState(!1),n=y.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}},hi=y.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 We(){const e=y.useContext(hi);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function sd({children:e,integration:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,onInstallSuccess:s,onUpdateSuccess:c,onUninstallSuccess:u,fieldMapping:d}){const p=xe(),{projectId:h}=Ie(),{integrations:g}=di(),{setError:f,isError:m}=dt(),{isIntegrationDeleted:x,setIntegrationDeleted:w}=id(),[O,v]=y.useState([]),[C,b]=y.useState(!0),I=(O==null?void 0:O[0])||null,S=y.useMemo(()=>ic(t,g||[]),[t,g]);y.useEffect(()=>{S===null&&(g!=null&&g.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,S,g]);const H=y.useCallback(X=>{v([X])},[v]),k=y.useCallback(()=>{S!=null&&S.id&&fe().installationApi.listInstallations({projectIdOrName:h,integrationId:S.id,groupRef:i},{headers:{"X-Api-Key":p??""}}).then(X=>{b(!1),v(X||[])}).catch(X=>{f(me.INSTALLATION_LIST,S.id),b(!1),console.error("Error retrieving installation information: ",X)})},[S,h,p,f,i]),V=(S==null?void 0:S.id)||"";y.useEffect(()=>{k()},[k]);const z=y.useMemo(()=>({integrationId:(S==null?void 0:S.id)||"",provider:(S==null?void 0:S.provider)||"",integrationObj:S,consumerRef:n,consumerName:o,groupRef:i,groupName:r,installation:I,setInstallation:H,resetInstallations:k,onInstallSuccess:s,onUpdateSuccess:c,onUninstallSuccess:u,isIntegrationDeleted:x,setIntegrationDeleted:w,fieldMapping:d}),[S,n,o,i,r,I,H,k,s,c,u,x,w,d]);if(S!==null){const X=`Error retrieving installation information for integration "${(S==null?void 0:S.name)||"unknown"}"`;return m(me.INSTALLATION_LIST,V)?a.jsx(ot,{message:X}):a.jsx(hi.Provider,{value:z,children:C?a.jsx(qe,{}):e})}return a.jsx(ot,{message:`Integration "${t}" not found`})}const mi=y.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),kt=()=>{const e=y.useContext(mi);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function gi({provider:e,groupRef:t,children:n}){const o=xe(),{projectId:i}=Ie(),[r,s]=y.useState(null),[c,u]=y.useState(null),[d,p]=y.useState(!0),{setError:h,isError:g}=dt(),{provider:f}=We();if(!i)throw new Error("ConnectionsProvider must be used within AmpersandProvider");const m=e||f;if(!m)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");y.useEffect(()=>{fe().connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:m},{headers:{"X-Api-Key":o??""}}).then(w=>{p(!1),s(w)}).catch(w=>{console.error(`Error retrieving existing OAuth connections for group ID ${t}.`),Ce(w),p(!1),h(me.CONNECTION_LIST,i)})},[i,o,t,m,h]);const x=y.useMemo(()=>({connections:r,selectedConnection:c,setConnections:s,setSelectedConnection:u}),[r,c,s,u]);return g(me.CONNECTION_LIST,i)?a.jsx(ot,{message:"Error retrieving existing connections"}):a.jsx(mi.Provider,{value:x,children:d?a.jsx(qe,{}):n})}var dn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xn={exports:{}};xn.exports;(function(e,t){var n=200,o="__lodash_hash_undefined__",i=1,r=2,s=9007199254740991,c="[object Arguments]",u="[object Array]",d="[object AsyncFunction]",p="[object Boolean]",h="[object Date]",g="[object Error]",f="[object Function]",m="[object GeneratorFunction]",x="[object Map]",w="[object Number]",O="[object Null]",v="[object Object]",C="[object Promise]",b="[object Proxy]",I="[object RegExp]",S="[object Set]",H="[object String]",k="[object Symbol]",V="[object Undefined]",z="[object WeakMap]",X="[object ArrayBuffer]",Z="[object DataView]",te="[object Float32Array]",Q="[object Float64Array]",ue="[object Int8Array]",le="[object Int16Array]",re="[object Int32Array]",Oe="[object Uint8Array]",Ne="[object Uint8ClampedArray]",T="[object Uint16Array]",K="[object Uint32Array]",F=/[\\^$.*+?()[\]{}|]/g,D=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,R={};R[te]=R[Q]=R[ue]=R[le]=R[re]=R[Oe]=R[Ne]=R[T]=R[K]=!0,R[c]=R[u]=R[X]=R[p]=R[Z]=R[h]=R[g]=R[f]=R[x]=R[w]=R[v]=R[I]=R[S]=R[H]=R[z]=!1;var B=typeof dn=="object"&&dn&&dn.Object===Object&&dn,W=typeof self=="object"&&self&&self.Object===Object&&self,U=B||W||Function("return this")(),J=t&&!t.nodeType&&t,q=J&&!0&&e&&!e.nodeType&&e,oe=q&&q.exports===J,j=oe&&B.process,de=function(){try{return j&&j.binding&&j.binding("util")}catch{}}(),L=de&&de.isTypedArray;function Ee(l,_){for(var E=-1,$=l==null?0:l.length,pe=0,ee=[];++E<$;){var ge=l[E];_(ge,E,l)&&(ee[pe++]=ge)}return ee}function Te(l,_){for(var E=-1,$=_.length,pe=l.length;++E<$;)l[pe+E]=_[E];return l}function Ge(l,_){for(var E=-1,$=l==null?0:l.length;++E<$;)if(_(l[E],E,l))return!0;return!1}function Ve(l,_){for(var E=-1,$=Array(l);++E<l;)$[E]=_(E);return $}function Ct(l){return function(_){return l(_)}}function Mt(l,_){return l.has(_)}function Ue(l,_){return l==null?void 0:l[_]}function ft(l){var _=-1,E=Array(l.size);return l.forEach(function($,pe){E[++_]=[pe,$]}),E}function Kt(l,_){return function(E){return l(_(E))}}function Ot(l){var _=-1,E=Array(l.size);return l.forEach(function($){E[++_]=$}),E}var Je=Array.prototype,Ze=Function.prototype,je=Object.prototype,Re=U["__core-js_shared__"],en=Ze.toString,ze=je.hasOwnProperty,Yr=function(){var l=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""}(),Gr=je.toString,Zs=RegExp("^"+en.call(ze).replace(F,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Zr=oe?U.Buffer:void 0,tn=U.Symbol,Qr=U.Uint8Array,eo=je.propertyIsEnumerable,Qs=Je.splice,ht=tn?tn.toStringTag:void 0,to=Object.getOwnPropertySymbols,ea=Zr?Zr.isBuffer:void 0,ta=Kt(Object.keys,Object),Ln=St(U,"DataView"),Lt=St(U,"Map"),$n=St(U,"Promise"),Hn=St(U,"Set"),Vn=St(U,"WeakMap"),$t=St(Object,"create"),na=yt(Ln),ra=yt(Lt),oa=yt($n),ia=yt(Hn),sa=yt(Vn),no=tn?tn.prototype:void 0,Un=no?no.valueOf:void 0;function mt(l){var _=-1,E=l==null?0:l.length;for(this.clear();++_<E;){var $=l[_];this.set($[0],$[1])}}function aa(){this.__data__=$t?$t(null):{},this.size=0}function ca(l){var _=this.has(l)&&delete this.__data__[l];return this.size-=_?1:0,_}function ua(l){var _=this.__data__;if($t){var E=_[l];return E===o?void 0:E}return ze.call(_,l)?_[l]:void 0}function la(l){var _=this.__data__;return $t?_[l]!==void 0:ze.call(_,l)}function da(l,_){var E=this.__data__;return this.size+=this.has(l)?0:1,E[l]=$t&&_===void 0?o:_,this}mt.prototype.clear=aa,mt.prototype.delete=ca,mt.prototype.get=ua,mt.prototype.has=la,mt.prototype.set=da;function Qe(l){var _=-1,E=l==null?0:l.length;for(this.clear();++_<E;){var $=l[_];this.set($[0],$[1])}}function pa(){this.__data__=[],this.size=0}function fa(l){var _=this.__data__,E=rn(_,l);if(E<0)return!1;var $=_.length-1;return E==$?_.pop():Qs.call(_,E,1),--this.size,!0}function ha(l){var _=this.__data__,E=rn(_,l);return E<0?void 0:_[E][1]}function ma(l){return rn(this.__data__,l)>-1}function ga(l,_){var E=this.__data__,$=rn(E,l);return $<0?(++this.size,E.push([l,_])):E[$][1]=_,this}Qe.prototype.clear=pa,Qe.prototype.delete=fa,Qe.prototype.get=ha,Qe.prototype.has=ma,Qe.prototype.set=ga;function gt(l){var _=-1,E=l==null?0:l.length;for(this.clear();++_<E;){var $=l[_];this.set($[0],$[1])}}function ya(){this.size=0,this.__data__={hash:new mt,map:new(Lt||Qe),string:new mt}}function va(l){var _=on(this,l).delete(l);return this.size-=_?1:0,_}function Ia(l){return on(this,l).get(l)}function wa(l){return on(this,l).has(l)}function xa(l,_){var E=on(this,l),$=E.size;return E.set(l,_),this.size+=E.size==$?0:1,this}gt.prototype.clear=ya,gt.prototype.delete=va,gt.prototype.get=Ia,gt.prototype.has=wa,gt.prototype.set=xa;function nn(l){var _=-1,E=l==null?0:l.length;for(this.__data__=new gt;++_<E;)this.add(l[_])}function _a(l){return this.__data__.set(l,o),this}function ba(l){return this.__data__.has(l)}nn.prototype.add=nn.prototype.push=_a,nn.prototype.has=ba;function st(l){var _=this.__data__=new Qe(l);this.size=_.size}function Ca(){this.__data__=new Qe,this.size=0}function Oa(l){var _=this.__data__,E=_.delete(l);return this.size=_.size,E}function Sa(l){return this.__data__.get(l)}function Na(l){return this.__data__.has(l)}function Ea(l,_){var E=this.__data__;if(E instanceof Qe){var $=E.__data__;if(!Lt||$.length<n-1)return $.push([l,_]),this.size=++E.size,this;E=this.__data__=new gt($)}return E.set(l,_),this.size=E.size,this}st.prototype.clear=Ca,st.prototype.delete=Oa,st.prototype.get=Sa,st.prototype.has=Na,st.prototype.set=Ea;function Ta(l,_){var E=sn(l),$=!E&&Ba(l),pe=!E&&!$&&Bn(l),ee=!E&&!$&&!pe&&po(l),ge=E||$||pe||ee,_e=ge?Ve(l.length,String):[],be=_e.length;for(var he in l)ze.call(l,he)&&!(ge&&(he=="length"||pe&&(he=="offset"||he=="parent")||ee&&(he=="buffer"||he=="byteLength"||he=="byteOffset")||La(he,be)))&&_e.push(he);return _e}function rn(l,_){for(var E=l.length;E--;)if(ao(l[E][0],_))return E;return-1}function Ra(l,_,E){var $=_(l);return sn(l)?$:Te($,E(l))}function Ht(l){return l==null?l===void 0?V:O:ht&&ht in Object(l)?Ma(l):Ua(l)}function ro(l){return Vt(l)&&Ht(l)==c}function oo(l,_,E,$,pe){return l===_?!0:l==null||_==null||!Vt(l)&&!Vt(_)?l!==l&&_!==_:Aa(l,_,E,$,oo,pe)}function Aa(l,_,E,$,pe,ee){var ge=sn(l),_e=sn(_),be=ge?u:at(l),he=_e?u:at(_);be=be==c?v:be,he=he==c?v:he;var Pe=be==v,Be=he==v,Se=be==he;if(Se&&Bn(l)){if(!Bn(_))return!1;ge=!0,Pe=!1}if(Se&&!Pe)return ee||(ee=new st),ge||po(l)?io(l,_,E,$,pe,ee):ka(l,_,be,E,$,pe,ee);if(!(E&i)){var Le=Pe&&ze.call(l,"__wrapped__"),$e=Be&&ze.call(_,"__wrapped__");if(Le||$e){var ct=Le?l.value():l,et=$e?_.value():_;return ee||(ee=new st),pe(ct,et,E,$,ee)}}return Se?(ee||(ee=new st),Fa(l,_,E,$,pe,ee)):!1}function ja(l){if(!lo(l)||Ha(l))return!1;var _=co(l)?Zs:D;return _.test(yt(l))}function Pa(l){return Vt(l)&&uo(l.length)&&!!R[Ht(l)]}function Da(l){if(!Va(l))return ta(l);var _=[];for(var E in Object(l))ze.call(l,E)&&E!="constructor"&&_.push(E);return _}function io(l,_,E,$,pe,ee){var ge=E&i,_e=l.length,be=_.length;if(_e!=be&&!(ge&&be>_e))return!1;var he=ee.get(l);if(he&&ee.get(_))return he==_;var Pe=-1,Be=!0,Se=E&r?new nn:void 0;for(ee.set(l,_),ee.set(_,l);++Pe<_e;){var Le=l[Pe],$e=_[Pe];if($)var ct=ge?$($e,Le,Pe,_,l,ee):$(Le,$e,Pe,l,_,ee);if(ct!==void 0){if(ct)continue;Be=!1;break}if(Se){if(!Ge(_,function(et,vt){if(!Mt(Se,vt)&&(Le===et||pe(Le,et,E,$,ee)))return Se.push(vt)})){Be=!1;break}}else if(!(Le===$e||pe(Le,$e,E,$,ee))){Be=!1;break}}return ee.delete(l),ee.delete(_),Be}function ka(l,_,E,$,pe,ee,ge){switch(E){case Z:if(l.byteLength!=_.byteLength||l.byteOffset!=_.byteOffset)return!1;l=l.buffer,_=_.buffer;case X:return!(l.byteLength!=_.byteLength||!ee(new Qr(l),new Qr(_)));case p:case h:case w:return ao(+l,+_);case g:return l.name==_.name&&l.message==_.message;case I:case H:return l==_+"";case x:var _e=ft;case S:var be=$&i;if(_e||(_e=Ot),l.size!=_.size&&!be)return!1;var he=ge.get(l);if(he)return he==_;$|=r,ge.set(l,_);var Pe=io(_e(l),_e(_),$,pe,ee,ge);return ge.delete(l),Pe;case k:if(Un)return Un.call(l)==Un.call(_)}return!1}function Fa(l,_,E,$,pe,ee){var ge=E&i,_e=so(l),be=_e.length,he=so(_),Pe=he.length;if(be!=Pe&&!ge)return!1;for(var Be=be;Be--;){var Se=_e[Be];if(!(ge?Se in _:ze.call(_,Se)))return!1}var Le=ee.get(l);if(Le&&ee.get(_))return Le==_;var $e=!0;ee.set(l,_),ee.set(_,l);for(var ct=ge;++Be<be;){Se=_e[Be];var et=l[Se],vt=_[Se];if($)var fo=ge?$(vt,et,Se,_,l,ee):$(et,vt,Se,l,_,ee);if(!(fo===void 0?et===vt||pe(et,vt,E,$,ee):fo)){$e=!1;break}ct||(ct=Se=="constructor")}if($e&&!ct){var an=l.constructor,cn=_.constructor;an!=cn&&"constructor"in l&&"constructor"in _&&!(typeof an=="function"&&an instanceof an&&typeof cn=="function"&&cn instanceof cn)&&($e=!1)}return ee.delete(l),ee.delete(_),$e}function so(l){return Ra(l,Ja,Ka)}function on(l,_){var E=l.__data__;return $a(_)?E[typeof _=="string"?"string":"hash"]:E.map}function St(l,_){var E=Ue(l,_);return ja(E)?E:void 0}function Ma(l){var _=ze.call(l,ht),E=l[ht];try{l[ht]=void 0;var $=!0}catch{}var pe=Gr.call(l);return $&&(_?l[ht]=E:delete l[ht]),pe}var Ka=to?function(l){return l==null?[]:(l=Object(l),Ee(to(l),function(_){return eo.call(l,_)}))}:za,at=Ht;(Ln&&at(new Ln(new ArrayBuffer(1)))!=Z||Lt&&at(new Lt)!=x||$n&&at($n.resolve())!=C||Hn&&at(new Hn)!=S||Vn&&at(new Vn)!=z)&&(at=function(l){var _=Ht(l),E=_==v?l.constructor:void 0,$=E?yt(E):"";if($)switch($){case na:return Z;case ra:return x;case oa:return C;case ia:return S;case sa:return z}return _});function La(l,_){return _=_??s,!!_&&(typeof l=="number"||P.test(l))&&l>-1&&l%1==0&&l<_}function $a(l){var _=typeof l;return _=="string"||_=="number"||_=="symbol"||_=="boolean"?l!=="__proto__":l===null}function Ha(l){return!!Yr&&Yr in l}function Va(l){var _=l&&l.constructor,E=typeof _=="function"&&_.prototype||je;return l===E}function Ua(l){return Gr.call(l)}function yt(l){if(l!=null){try{return en.call(l)}catch{}try{return l+""}catch{}}return""}function ao(l,_){return l===_||l!==l&&_!==_}var Ba=ro(function(){return arguments}())?ro:function(l){return Vt(l)&&ze.call(l,"callee")&&!eo.call(l,"callee")},sn=Array.isArray;function qa(l){return l!=null&&uo(l.length)&&!co(l)}var Bn=ea||Xa;function Wa(l,_){return oo(l,_)}function co(l){if(!lo(l))return!1;var _=Ht(l);return _==f||_==m||_==d||_==b}function uo(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=s}function lo(l){var _=typeof l;return l!=null&&(_=="object"||_=="function")}function Vt(l){return l!=null&&typeof l=="object"}var po=L?Ct(L):Pa;function Ja(l){return qa(l)?Ta(l):Da(l)}function za(){return[]}function Xa(){return!1}e.exports=Wa})(xn,xn.exports);var ad=xn.exports;const cd=xr(ad),xt="other";function Ye(e){return e.mapToName!==void 0}function ud(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(o=>o.objectName===t))||null}function ld(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Ye(n)&&!!n.fieldName))||null}function dd(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(o=>Ye(o)&&!!o.mapToName))||[]}function pd(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Ye(n)&&!!n.fieldName))||null}const yi=(e,t)=>{var n,o,i;return(i=(o=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:o.objects)==null?void 0:i[t]};function fd(e){return Ye(e)?e.mapToName:e.fieldName}const vi=(e,t)=>{var o,i,r;const n=[];return(r=(i=(o=t.content)==null?void 0:o.read)==null?void 0:i.objects)==null||r.forEach(s=>{n.push({name:s==null?void 0:s.objectName,completed:e?!!yi(e,s.objectName):!1})}),n},Ii=e=>{var n;return{name:xt,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function hd(e,t){var r;const n=vi(e,t),i=!!((r=t==null?void 0:t.content)!=null&&r.write)?Ii(e):void 0;return i&&n.push(i),n}function wi(e,t,n){const o=(e==null?void 0:e.filter(r=>!(t!=null&&t[r==null?void 0:r.mapToName])))||[],i=o.map(r=>r.mapToName);return n(me.MAPPING,i),o!=null&&o.length&&console.error("required fields not met",o.map(r=>r.mapToDisplayName)),{errorList:i}}function _r(e,t){return cd(e,t)}const md=(e,t,n)=>{var f,m,x,w,O,v;if(!e)return null;const o=ud(e,t),i=o&&ld(o),r=o&&pd(o),s=o&&dd(o),c=(o==null?void 0:o.allFields)||[],u=n==null?void 0:n.content,d=((x=(m=(f=u==null?void 0:u.read)==null?void 0:f.objects)==null?void 0:m[t])==null?void 0:x.selectedFields)||{},p=((v=(O=(w=u==null?void 0:u.read)==null?void 0:w.objects)==null?void 0:O[t])==null?void 0:v.selectedFieldMappings)||{},h={...d},g={...p};return{allFields:c,requiredFields:i,optionalFields:r,requiredMapFields:s,selectedOptionalFields:d,selectedFieldMappings:p,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:h,requiredMapFields:g}}},gd=(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,o=Object.keys(n||{}),i={};o.forEach(u=>{i[u]=!0});const r={...i};return{writeObjects:(e==null?void 0:e.objects)||[],selectedNonConfigurableWriteFields:i,isWriteModified:!1,savedConfig:{selectedNonConfigurableWriteFields:r}}};function xi(e,t,n){var r,s;const o=(r=e==null?void 0:e.content)==null?void 0:r.read,i=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:md(o,t,n),write:gd(i,n)}}const _i=(e,t,n,o)=>{const i=xi(e,n,t);o(n,i)},yd=(e,t,n)=>{const o=hd(t,e),i={};o.forEach(({name:r,completed:s})=>{s&&(i[r]=xi(e,r,t))}),n(i)},bi=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},o=new Set;return t==null||t.forEach(r=>o.add(fd(r))),{...Array.from(o).reduce((r,s)=>({...r,[s]:!0}),{}),...n||{}}},Ci=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(o=>{t[o]!==void 0?n[o]=t[o]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${o}`)}),n};function Oi(e,t){return t[e]||void 0}async function br({createConfig:e,projectId:t,integrationId:n,groupRef:o,connectionId:i,apiKey:r,setError:s,setInstallation:c,onInstallSuccess:u}){const d={projectIdOrName:t,integrationId:n,installation:{groupRef:o,connectionId:i,config:e}};try{const p=await fe().installationApi.createInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}});c(p),u==null||u(p.id,p.config)}catch(p){Ce(p,s)}}function jn(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const vd=(e,t)=>{const n=e.content.read,o=n==null?void 0:n.objects;return o==null?void 0:o.find(i=>i.objectName===t)},Id=(e,t,n,o)=>{const i=bi(e),r=Ci(e),s=vd(n,t);if(!s)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${o}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:s.schedule,destination:s.destination,selectedFields:i,selectedFieldMappings:r,backfill:s.backfill}}}}};return jn(n)&&(c.content.proxy={enabled:!0}),c},wd=(e,t,n,o,i,r,s,c,u,d,p,h)=>{const g=Id(u,r,c,o);return g?br({createConfig:g,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:d,setInstallation:p,onInstallSuccess:h}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Si=e=>{var r,s;const t={},n=(r=e.write)==null?void 0:r.writeObjects,o=(s=e.write)==null?void 0:s.selectedNonConfigurableWriteFields,i=o?Object.keys(o):[];return n&&n.forEach(c=>{const u=c.objectName;i.includes(u)&&(t[u]={objectName:u})}),t},xd=e=>{const t=e.content.write;return t==null?void 0:t.objects},_d=(e,t,n)=>{if(!xd(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=Si(e),r={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return jn(t)&&(r.content.proxy={enabled:!0}),r},bd=(e,t,n,o,i,r,s,c,u,d,p)=>{const h=_d(c,s,o);return h?br({createConfig:h,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:r,setError:u,setInstallation:d,onInstallSuccess:p}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Cd=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-background").trim()||"#FEF2F2",Od=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-border").trim()||"#FECACA",Sd=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-text").trim()||"#991B1B",Nd={backgroundColor:Cd,borderColor:Od,color:Sd,padding:".5rem 1rem"};function Ni({children:e,style:t}){return a.jsx(Dt,{style:{...Nd,...t},children:e})}var Ei={exports:{}};/*!
5
5
  Copyright (c) 2018 Jed Watson.
6
6
  Licensed under the MIT License (MIT), see
7
7
  http://jedwatson.github.io/classnames
8
- */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r="",s=0;s<arguments.length;s++){var c=arguments[s];c&&(r=i(r,o(c)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return n.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var s="";for(var c in r)t.call(r,c)&&r[c]&&(s=i(s,c));return s}function i(r,s){return s?r?r+" "+s:r+s:r}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Ni);var Nd=Ni.exports;const zt=xr(Nd),Td="_button_rchgn_1",Rd="_buttonError_rchgn_21",Ad="_danger_rchgn_40",jd="_ghost_rchgn_50",Jn={button:Td,buttonError:Rd,danger:Ad,ghost:jd};function He({className:e,style:t,type:n,children:o,variant:i,...r}){const s=zt(Jn.button,{[Jn.danger]:i==="danger",[Jn.ghost]:i==="ghost",[e||""]:!!e});return a.jsx("button",{type:n,className:s,style:t,...r,children:o})}function Pd(){return a.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Ti="uninstall-installation",Dd=y.forwardRef(({text:e="Uninstall"},t)=>{const n=S.useTab({ref:t}),o=S.useMultiStyleConfig("Tabs",n);return a.jsxs(S.Button,{__css:o.warningTab,...n,minHeight:15,children:[a.jsxs(S.Box,{as:"span",display:"flex",alignItems:"center",gap:2,my:2,mx:4,children:[Pd(),a.jsx(S.Box,{textAlign:"left",children:a.jsx(S.Text,{color:"red.800",children:e})})]}),n.children]})}),Ri=y.createContext({hydratedRevision:null,loading:!1}),Zt=()=>{const e=y.useContext(Ri);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function kd({projectId:e,children:t}){var C;const{selectedConnection:n}=kt(),{integrationId:o,integrationObj:i}=Ye(),[r,s]=y.useState(null),[c,u]=y.useState(!0),{isError:d,removeError:p,setError:h}=dt(),v=xe(),f=n==null?void 0:n.id,g=(C=i==null?void 0:i.latestRevision)==null?void 0:C.id,x=(i==null?void 0:i.name)||o;y.useEffect(()=>{e&&o&&g&&f&&v&&fe().revisionApi.getHydratedRevision({projectIdOrName:e,integrationId:o,revisionId:g,connectionId:f},{headers:{"X-Api-Key":v??""}}).then(b=>{s(b),u(!1),p(me.HYDRATED_REVISION,x)}).catch(b=>{console.error(`Error loading integration ${x}.`),Ce(b),u(!1),h(me.HYDRATED_REVISION,x)})},[e,o,g,f,v,p,h,x]);const w=y.useMemo(()=>({hydratedRevision:r,loading:c}),[r,c]),I=`Error retrieving integration details for '${(i==null?void 0:i.name)||o||"unknown integration"}. This is sometimes caused by insufficient permissions with your credentials'`;return a.jsx(Ri.Provider,{value:w,children:d(me.HYDRATED_REVISION,x)?a.jsx(ot,{message:I}):t})}function nt(e,t){if(e==null)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.includes(o))continue;n[o]=e[o]}return n}function ne(){return ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},ne.apply(null,arguments)}function ir(e,t){return ir=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ir(e,t)}function Fd(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ir(e,t)}var sr={exports:{}},pn={exports:{}},ie={};/** @license React v16.13.1
8
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var r="",s=0;s<arguments.length;s++){var c=arguments[s];c&&(r=i(r,o(c)))}return r}function o(r){if(typeof r=="string"||typeof r=="number")return r;if(typeof r!="object")return"";if(Array.isArray(r))return n.apply(null,r);if(r.toString!==Object.prototype.toString&&!r.toString.toString().includes("[native code]"))return r.toString();var s="";for(var c in r)t.call(r,c)&&r[c]&&(s=i(s,c));return s}function i(r,s){return s?r?r+" "+s:r+s:r}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Ei);var Ed=Ei.exports;const zt=xr(Ed),Td="_button_rchgn_1",Rd="_buttonError_rchgn_21",Ad="_danger_rchgn_40",jd="_ghost_rchgn_50",Jn={button:Td,buttonError:Rd,danger:Ad,ghost:jd};function He({className:e,style:t,type:n,children:o,variant:i,...r}){const s=zt(Jn.button,{[Jn.danger]:i==="danger",[Jn.ghost]:i==="ghost",[e||""]:!!e});return a.jsx("button",{type:n,className:s,style:t,...r,children:o})}function Pd(){return a.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Ti="uninstall-installation",Dd=y.forwardRef(({text:e="Uninstall"},t)=>{const n=N.useTab({ref:t}),o=N.useMultiStyleConfig("Tabs",n);return a.jsxs(N.Button,{__css:o.warningTab,...n,minHeight:15,children:[a.jsxs(N.Box,{as:"span",display:"flex",alignItems:"center",gap:2,my:2,mx:4,children:[Pd(),a.jsx(N.Box,{textAlign:"left",children:a.jsx(N.Text,{color:"red.800",children:e})})]}),n.children]})}),Ri=y.createContext({hydratedRevision:null,loading:!1}),Zt=()=>{const e=y.useContext(Ri);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function kd({projectId:e,children:t}){var C;const{selectedConnection:n}=kt(),{integrationId:o,integrationObj:i}=We(),[r,s]=y.useState(null),[c,u]=y.useState(!0),{isError:d,removeError:p,setError:h}=dt(),g=xe(),f=n==null?void 0:n.id,m=(C=i==null?void 0:i.latestRevision)==null?void 0:C.id,x=(i==null?void 0:i.name)||o;y.useEffect(()=>{e&&o&&m&&f&&g&&fe().revisionApi.getHydratedRevision({projectIdOrName:e,integrationId:o,revisionId:m,connectionId:f},{headers:{"X-Api-Key":g??""}}).then(b=>{s(b),u(!1),p(me.HYDRATED_REVISION,x)}).catch(b=>{console.error(`Error loading integration ${x}.`),Ce(b),u(!1),h(me.HYDRATED_REVISION,x)})},[e,o,m,f,g,p,h,x]);const w=y.useMemo(()=>({hydratedRevision:r,loading:c}),[r,c]),v=`Error retrieving integration details for '${(i==null?void 0:i.name)||o||"unknown integration"}. This is sometimes caused by insufficient permissions with your credentials'`;return a.jsx(Ri.Provider,{value:w,children:d(me.HYDRATED_REVISION,x)?a.jsx(ot,{message:v}):t})}function nt(e,t){if(e==null)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(t.includes(o))continue;n[o]=e[o]}return n}function ne(){return ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},ne.apply(null,arguments)}function ir(e,t){return ir=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},ir(e,t)}function Fd(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,ir(e,t)}var sr={exports:{}},pn={exports:{}},ie={};/** @license React v16.13.1
9
9
  * react-is.production.min.js
10
10
  *
11
11
  * Copyright (c) Facebook, Inc. and its affiliates.
12
12
  *
13
13
  * This source code is licensed under the MIT license found in the
14
14
  * LICENSE file in the root directory of this source tree.
15
- */var xo;function Md(){if(xo)return ie;xo=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,r=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,p=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,v=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,x=e?Symbol.for("react.block"):60121,w=e?Symbol.for("react.fundamental"):60117,O=e?Symbol.for("react.responder"):60118,I=e?Symbol.for("react.scope"):60119;function C(m){if(typeof m=="object"&&m!==null){var j=m.$$typeof;switch(j){case t:switch(m=m.type,m){case u:case d:case o:case r:case i:case h:return m;default:switch(m=m&&m.$$typeof,m){case c:case p:case g:case f:case s:return m;default:return j}}case n:return j}}}function b(m){return C(m)===d}return ie.AsyncMode=u,ie.ConcurrentMode=d,ie.ContextConsumer=c,ie.ContextProvider=s,ie.Element=t,ie.ForwardRef=p,ie.Fragment=o,ie.Lazy=g,ie.Memo=f,ie.Portal=n,ie.Profiler=r,ie.StrictMode=i,ie.Suspense=h,ie.isAsyncMode=function(m){return b(m)||C(m)===u},ie.isConcurrentMode=b,ie.isContextConsumer=function(m){return C(m)===c},ie.isContextProvider=function(m){return C(m)===s},ie.isElement=function(m){return typeof m=="object"&&m!==null&&m.$$typeof===t},ie.isForwardRef=function(m){return C(m)===p},ie.isFragment=function(m){return C(m)===o},ie.isLazy=function(m){return C(m)===g},ie.isMemo=function(m){return C(m)===f},ie.isPortal=function(m){return C(m)===n},ie.isProfiler=function(m){return C(m)===r},ie.isStrictMode=function(m){return C(m)===i},ie.isSuspense=function(m){return C(m)===h},ie.isValidElementType=function(m){return typeof m=="string"||typeof m=="function"||m===o||m===d||m===r||m===i||m===h||m===v||typeof m=="object"&&m!==null&&(m.$$typeof===g||m.$$typeof===f||m.$$typeof===s||m.$$typeof===c||m.$$typeof===p||m.$$typeof===w||m.$$typeof===O||m.$$typeof===I||m.$$typeof===x)},ie.typeOf=C,ie}var se={};/** @license React v16.13.1
15
+ */var xo;function Md(){if(xo)return ie;xo=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,r=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,p=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,g=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,x=e?Symbol.for("react.block"):60121,w=e?Symbol.for("react.fundamental"):60117,O=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function C(I){if(typeof I=="object"&&I!==null){var S=I.$$typeof;switch(S){case t:switch(I=I.type,I){case u:case d:case o:case r:case i:case h:return I;default:switch(I=I&&I.$$typeof,I){case c:case p:case m:case f:case s:return I;default:return S}}case n:return S}}}function b(I){return C(I)===d}return ie.AsyncMode=u,ie.ConcurrentMode=d,ie.ContextConsumer=c,ie.ContextProvider=s,ie.Element=t,ie.ForwardRef=p,ie.Fragment=o,ie.Lazy=m,ie.Memo=f,ie.Portal=n,ie.Profiler=r,ie.StrictMode=i,ie.Suspense=h,ie.isAsyncMode=function(I){return b(I)||C(I)===u},ie.isConcurrentMode=b,ie.isContextConsumer=function(I){return C(I)===c},ie.isContextProvider=function(I){return C(I)===s},ie.isElement=function(I){return typeof I=="object"&&I!==null&&I.$$typeof===t},ie.isForwardRef=function(I){return C(I)===p},ie.isFragment=function(I){return C(I)===o},ie.isLazy=function(I){return C(I)===m},ie.isMemo=function(I){return C(I)===f},ie.isPortal=function(I){return C(I)===n},ie.isProfiler=function(I){return C(I)===r},ie.isStrictMode=function(I){return C(I)===i},ie.isSuspense=function(I){return C(I)===h},ie.isValidElementType=function(I){return typeof I=="string"||typeof I=="function"||I===o||I===d||I===r||I===i||I===h||I===g||typeof I=="object"&&I!==null&&(I.$$typeof===m||I.$$typeof===f||I.$$typeof===s||I.$$typeof===c||I.$$typeof===p||I.$$typeof===w||I.$$typeof===O||I.$$typeof===v||I.$$typeof===x)},ie.typeOf=C,ie}var se={};/** @license React v16.13.1
16
16
  * react-is.development.js
17
17
  *
18
18
  * Copyright (c) Facebook, Inc. and its affiliates.
19
19
  *
20
20
  * This source code is licensed under the MIT license found in the
21
21
  * LICENSE file in the root directory of this source tree.
22
- */var _o;function Kd(){return _o||(_o=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,r=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,p=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,v=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,x=e?Symbol.for("react.block"):60121,w=e?Symbol.for("react.fundamental"):60117,O=e?Symbol.for("react.responder"):60118,I=e?Symbol.for("react.scope"):60119;function C(A){return typeof A=="string"||typeof A=="function"||A===o||A===d||A===r||A===i||A===h||A===v||typeof A=="object"&&A!==null&&(A.$$typeof===g||A.$$typeof===f||A.$$typeof===s||A.$$typeof===c||A.$$typeof===p||A.$$typeof===w||A.$$typeof===O||A.$$typeof===I||A.$$typeof===x)}function b(A){if(typeof A=="object"&&A!==null){var de=A.$$typeof;switch(de){case t:var L=A.type;switch(L){case u:case d:case o:case r:case i:case h:return L;default:var Ne=L&&L.$$typeof;switch(Ne){case c:case p:case g:case f:case s:return Ne;default:return de}}case n:return de}}}var m=u,j=d,$=c,F=s,V=t,B=p,Z=o,G=g,te=f,Q=n,ue=r,le=i,re=h,Oe=!1;function Ee(A){return Oe||(Oe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),N(A)||b(A)===u}function N(A){return b(A)===d}function K(A){return b(A)===c}function k(A){return b(A)===s}function D(A){return typeof A=="object"&&A!==null&&A.$$typeof===t}function P(A){return b(A)===p}function T(A){return b(A)===o}function q(A){return b(A)===g}function J(A){return b(A)===f}function U(A){return b(A)===n}function z(A){return b(A)===r}function W(A){return b(A)===i}function oe(A){return b(A)===h}se.AsyncMode=m,se.ConcurrentMode=j,se.ContextConsumer=$,se.ContextProvider=F,se.Element=V,se.ForwardRef=B,se.Fragment=Z,se.Lazy=G,se.Memo=te,se.Portal=Q,se.Profiler=ue,se.StrictMode=le,se.Suspense=re,se.isAsyncMode=Ee,se.isConcurrentMode=N,se.isContextConsumer=K,se.isContextProvider=k,se.isElement=D,se.isForwardRef=P,se.isFragment=T,se.isLazy=q,se.isMemo=J,se.isPortal=U,se.isProfiler=z,se.isStrictMode=W,se.isSuspense=oe,se.isValidElementType=C,se.typeOf=b}()),se}var bo;function Ai(){return bo||(bo=1,process.env.NODE_ENV==="production"?pn.exports=Md():pn.exports=Kd()),pn.exports}/*
22
+ */var _o;function Kd(){return _o||(_o=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,r=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,u=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,p=e?Symbol.for("react.forward_ref"):60112,h=e?Symbol.for("react.suspense"):60113,g=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,x=e?Symbol.for("react.block"):60121,w=e?Symbol.for("react.fundamental"):60117,O=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function C(j){return typeof j=="string"||typeof j=="function"||j===o||j===d||j===r||j===i||j===h||j===g||typeof j=="object"&&j!==null&&(j.$$typeof===m||j.$$typeof===f||j.$$typeof===s||j.$$typeof===c||j.$$typeof===p||j.$$typeof===w||j.$$typeof===O||j.$$typeof===v||j.$$typeof===x)}function b(j){if(typeof j=="object"&&j!==null){var de=j.$$typeof;switch(de){case t:var L=j.type;switch(L){case u:case d:case o:case r:case i:case h:return L;default:var Ee=L&&L.$$typeof;switch(Ee){case c:case p:case m:case f:case s:return Ee;default:return de}}case n:return de}}}var I=u,S=d,H=c,k=s,V=t,z=p,X=o,Z=m,te=f,Q=n,ue=r,le=i,re=h,Oe=!1;function Ne(j){return Oe||(Oe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),T(j)||b(j)===u}function T(j){return b(j)===d}function K(j){return b(j)===c}function F(j){return b(j)===s}function D(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function P(j){return b(j)===p}function R(j){return b(j)===o}function B(j){return b(j)===m}function W(j){return b(j)===f}function U(j){return b(j)===n}function J(j){return b(j)===r}function q(j){return b(j)===i}function oe(j){return b(j)===h}se.AsyncMode=I,se.ConcurrentMode=S,se.ContextConsumer=H,se.ContextProvider=k,se.Element=V,se.ForwardRef=z,se.Fragment=X,se.Lazy=Z,se.Memo=te,se.Portal=Q,se.Profiler=ue,se.StrictMode=le,se.Suspense=re,se.isAsyncMode=Ne,se.isConcurrentMode=T,se.isContextConsumer=K,se.isContextProvider=F,se.isElement=D,se.isForwardRef=P,se.isFragment=R,se.isLazy=B,se.isMemo=W,se.isPortal=U,se.isProfiler=J,se.isStrictMode=q,se.isSuspense=oe,se.isValidElementType=C,se.typeOf=b}()),se}var bo;function Ai(){return bo||(bo=1,process.env.NODE_ENV==="production"?pn.exports=Md():pn.exports=Kd()),pn.exports}/*
23
23
  object-assign
24
24
  (c) Sindre Sorhus
25
25
  @license MIT
26
- */var zn,Co;function Ld(){if(Co)return zn;Co=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function o(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function i(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var s={},c=0;c<10;c++)s["_"+String.fromCharCode(c)]=c;var u=Object.getOwnPropertyNames(s).map(function(p){return s[p]});if(u.join("")!=="0123456789")return!1;var d={};return"abcdefghijklmnopqrst".split("").forEach(function(p){d[p]=p}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return zn=i()?Object.assign:function(r,s){for(var c,u=o(r),d,p=1;p<arguments.length;p++){c=Object(arguments[p]);for(var h in c)t.call(c,h)&&(u[h]=c[h]);if(e){d=e(c);for(var v=0;v<d.length;v++)n.call(c,d[v])&&(u[d[v]]=c[d[v]])}}return u},zn}var Xn,Oo;function Cr(){if(Oo)return Xn;Oo=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Xn=e,Xn}var Yn,So;function ji(){return So||(So=1,Yn=Function.call.bind(Object.prototype.hasOwnProperty)),Yn}var Gn,Eo;function $d(){if(Eo)return Gn;Eo=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Cr(),n={},o=ji();e=function(r){var s="Warning: "+r;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(r,s,c,u,d){if(process.env.NODE_ENV!=="production"){for(var p in r)if(o(r,p)){var h;try{if(typeof r[p]!="function"){var v=Error((u||"React class")+": "+c+" type `"+p+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[p]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw v.name="Invariant Violation",v}h=r[p](s,p,u,c,null,t)}catch(g){h=g}if(h&&!(h instanceof Error)&&e((u||"React class")+": type specification of "+c+" `"+p+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in n)){n[h.message]=!0;var f=d?d():"";e("Failed "+c+" type: "+h.message+(f??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Gn=i,Gn}var Zn,No;function Hd(){if(No)return Zn;No=1;var e=Ai(),t=Ld(),n=Cr(),o=ji(),i=$d(),r=function(){};process.env.NODE_ENV!=="production"&&(r=function(c){var u="Warning: "+c;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}});function s(){return null}return Zn=function(c,u){var d=typeof Symbol=="function"&&Symbol.iterator,p="@@iterator";function h(N){var K=N&&(d&&N[d]||N[p]);if(typeof K=="function")return K}var v="<<anonymous>>",f={array:O("array"),bigint:O("bigint"),bool:O("boolean"),func:O("function"),number:O("number"),object:O("object"),string:O("string"),symbol:O("symbol"),any:I(),arrayOf:C,element:b(),elementType:m(),instanceOf:j,node:B(),objectOf:F,oneOf:$,oneOfType:V,shape:G,exact:te};function g(N,K){return N===K?N!==0||1/N===1/K:N!==N&&K!==K}function x(N,K){this.message=N,this.data=K&&typeof K=="object"?K:{},this.stack=""}x.prototype=Error.prototype;function w(N){if(process.env.NODE_ENV!=="production")var K={},k=0;function D(T,q,J,U,z,W,oe){if(U=U||v,W=W||J,oe!==n){if(u){var A=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw A.name="Invariant Violation",A}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var de=U+":"+J;!K[de]&&k<3&&(r("You are manually calling a React.PropTypes validation function for the `"+W+"` prop on `"+U+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),K[de]=!0,k++)}}return q[J]==null?T?q[J]===null?new x("The "+z+" `"+W+"` is marked as required "+("in `"+U+"`, but its value is `null`.")):new x("The "+z+" `"+W+"` is marked as required in "+("`"+U+"`, but its value is `undefined`.")):null:N(q,J,U,z,W)}var P=D.bind(null,!1);return P.isRequired=D.bind(null,!0),P}function O(N){function K(k,D,P,T,q,J){var U=k[D],z=le(U);if(z!==N){var W=re(U);return new x("Invalid "+T+" `"+q+"` of type "+("`"+W+"` supplied to `"+P+"`, expected ")+("`"+N+"`."),{expectedType:N})}return null}return w(K)}function I(){return w(s)}function C(N){function K(k,D,P,T,q){if(typeof N!="function")return new x("Property `"+q+"` of component `"+P+"` has invalid PropType notation inside arrayOf.");var J=k[D];if(!Array.isArray(J)){var U=le(J);return new x("Invalid "+T+" `"+q+"` of type "+("`"+U+"` supplied to `"+P+"`, expected an array."))}for(var z=0;z<J.length;z++){var W=N(J,z,P,T,q+"["+z+"]",n);if(W instanceof Error)return W}return null}return w(K)}function b(){function N(K,k,D,P,T){var q=K[k];if(!c(q)){var J=le(q);return new x("Invalid "+P+" `"+T+"` of type "+("`"+J+"` supplied to `"+D+"`, expected a single ReactElement."))}return null}return w(N)}function m(){function N(K,k,D,P,T){var q=K[k];if(!e.isValidElementType(q)){var J=le(q);return new x("Invalid "+P+" `"+T+"` of type "+("`"+J+"` supplied to `"+D+"`, expected a single ReactElement type."))}return null}return w(N)}function j(N){function K(k,D,P,T,q){if(!(k[D]instanceof N)){var J=N.name||v,U=Ee(k[D]);return new x("Invalid "+T+" `"+q+"` of type "+("`"+U+"` supplied to `"+P+"`, expected ")+("instance of `"+J+"`."))}return null}return w(K)}function $(N){if(!Array.isArray(N))return process.env.NODE_ENV!=="production"&&(arguments.length>1?r("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):r("Invalid argument supplied to oneOf, expected an array.")),s;function K(k,D,P,T,q){for(var J=k[D],U=0;U<N.length;U++)if(g(J,N[U]))return null;var z=JSON.stringify(N,function(oe,A){var de=re(A);return de==="symbol"?String(A):A});return new x("Invalid "+T+" `"+q+"` of value `"+String(J)+"` "+("supplied to `"+P+"`, expected one of "+z+"."))}return w(K)}function F(N){function K(k,D,P,T,q){if(typeof N!="function")return new x("Property `"+q+"` of component `"+P+"` has invalid PropType notation inside objectOf.");var J=k[D],U=le(J);if(U!=="object")return new x("Invalid "+T+" `"+q+"` of type "+("`"+U+"` supplied to `"+P+"`, expected an object."));for(var z in J)if(o(J,z)){var W=N(J,z,P,T,q+"."+z,n);if(W instanceof Error)return W}return null}return w(K)}function V(N){if(!Array.isArray(N))return process.env.NODE_ENV!=="production"&&r("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var K=0;K<N.length;K++){var k=N[K];if(typeof k!="function")return r("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Oe(k)+" at index "+K+"."),s}function D(P,T,q,J,U){for(var z=[],W=0;W<N.length;W++){var oe=N[W],A=oe(P,T,q,J,U,n);if(A==null)return null;A.data&&o(A.data,"expectedType")&&z.push(A.data.expectedType)}var de=z.length>0?", expected one of type ["+z.join(", ")+"]":"";return new x("Invalid "+J+" `"+U+"` supplied to "+("`"+q+"`"+de+"."))}return w(D)}function B(){function N(K,k,D,P,T){return Q(K[k])?null:new x("Invalid "+P+" `"+T+"` supplied to "+("`"+D+"`, expected a ReactNode."))}return w(N)}function Z(N,K,k,D,P){return new x((N||"React class")+": "+K+" type `"+k+"."+D+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+P+"`.")}function G(N){function K(k,D,P,T,q){var J=k[D],U=le(J);if(U!=="object")return new x("Invalid "+T+" `"+q+"` of type `"+U+"` "+("supplied to `"+P+"`, expected `object`."));for(var z in N){var W=N[z];if(typeof W!="function")return Z(P,T,q,z,re(W));var oe=W(J,z,P,T,q+"."+z,n);if(oe)return oe}return null}return w(K)}function te(N){function K(k,D,P,T,q){var J=k[D],U=le(J);if(U!=="object")return new x("Invalid "+T+" `"+q+"` of type `"+U+"` "+("supplied to `"+P+"`, expected `object`."));var z=t({},k[D],N);for(var W in z){var oe=N[W];if(o(N,W)&&typeof oe!="function")return Z(P,T,q,W,re(oe));if(!oe)return new x("Invalid "+T+" `"+q+"` key `"+W+"` supplied to `"+P+"`.\nBad object: "+JSON.stringify(k[D],null," ")+`
27
- Valid keys: `+JSON.stringify(Object.keys(N),null," "));var A=oe(J,W,P,T,q+"."+W,n);if(A)return A}return null}return w(K)}function Q(N){switch(typeof N){case"number":case"string":case"undefined":return!0;case"boolean":return!N;case"object":if(Array.isArray(N))return N.every(Q);if(N===null||c(N))return!0;var K=h(N);if(K){var k=K.call(N),D;if(K!==N.entries){for(;!(D=k.next()).done;)if(!Q(D.value))return!1}else for(;!(D=k.next()).done;){var P=D.value;if(P&&!Q(P[1]))return!1}}else return!1;return!0;default:return!1}}function ue(N,K){return N==="symbol"?!0:K?K["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&K instanceof Symbol:!1}function le(N){var K=typeof N;return Array.isArray(N)?"array":N instanceof RegExp?"object":ue(K,N)?"symbol":K}function re(N){if(typeof N>"u"||N===null)return""+N;var K=le(N);if(K==="object"){if(N instanceof Date)return"date";if(N instanceof RegExp)return"regexp"}return K}function Oe(N){var K=re(N);switch(K){case"array":case"object":return"an "+K;case"boolean":case"date":case"regexp":return"a "+K;default:return K}}function Ee(N){return!N.constructor||!N.constructor.name?v:N.constructor.name}return f.checkPropTypes=i,f.resetWarningCache=i.resetWarningCache,f.PropTypes=f,f},Zn}var Qn,To;function Vd(){if(To)return Qn;To=1;var e=Cr();function t(){}function n(){}return n.resetWarningCache=t,Qn=function(){function o(s,c,u,d,p,h){if(h!==e){var v=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw v.name="Invariant Violation",v}}o.isRequired=o;function i(){return o}var r={array:o,bigint:o,bool:o,func:o,number:o,object:o,string:o,symbol:o,any:o,arrayOf:i,element:o,elementType:o,instanceOf:i,node:o,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return r.PropTypes=r,r},Qn}if(process.env.NODE_ENV!=="production"){var Ud=Ai(),Bd=!0;sr.exports=Hd()(Ud.isElement,Bd)}else sr.exports=Vd()();var qd=sr.exports;const R=xr(qd);var ar={exports:{}},ae={};/**
26
+ */var zn,Co;function Ld(){if(Co)return zn;Co=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function o(r){if(r==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(r)}function i(){try{if(!Object.assign)return!1;var r=new String("abc");if(r[5]="de",Object.getOwnPropertyNames(r)[0]==="5")return!1;for(var s={},c=0;c<10;c++)s["_"+String.fromCharCode(c)]=c;var u=Object.getOwnPropertyNames(s).map(function(p){return s[p]});if(u.join("")!=="0123456789")return!1;var d={};return"abcdefghijklmnopqrst".split("").forEach(function(p){d[p]=p}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return zn=i()?Object.assign:function(r,s){for(var c,u=o(r),d,p=1;p<arguments.length;p++){c=Object(arguments[p]);for(var h in c)t.call(c,h)&&(u[h]=c[h]);if(e){d=e(c);for(var g=0;g<d.length;g++)n.call(c,d[g])&&(u[d[g]]=c[d[g]])}}return u},zn}var Xn,Oo;function Cr(){if(Oo)return Xn;Oo=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Xn=e,Xn}var Yn,So;function ji(){return So||(So=1,Yn=Function.call.bind(Object.prototype.hasOwnProperty)),Yn}var Gn,No;function $d(){if(No)return Gn;No=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Cr(),n={},o=ji();e=function(r){var s="Warning: "+r;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(r,s,c,u,d){if(process.env.NODE_ENV!=="production"){for(var p in r)if(o(r,p)){var h;try{if(typeof r[p]!="function"){var g=Error((u||"React class")+": "+c+" type `"+p+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[p]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}h=r[p](s,p,u,c,null,t)}catch(m){h=m}if(h&&!(h instanceof Error)&&e((u||"React class")+": type specification of "+c+" `"+p+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof h+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),h instanceof Error&&!(h.message in n)){n[h.message]=!0;var f=d?d():"";e("Failed "+c+" type: "+h.message+(f??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},Gn=i,Gn}var Zn,Eo;function Hd(){if(Eo)return Zn;Eo=1;var e=Ai(),t=Ld(),n=Cr(),o=ji(),i=$d(),r=function(){};process.env.NODE_ENV!=="production"&&(r=function(c){var u="Warning: "+c;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}});function s(){return null}return Zn=function(c,u){var d=typeof Symbol=="function"&&Symbol.iterator,p="@@iterator";function h(T){var K=T&&(d&&T[d]||T[p]);if(typeof K=="function")return K}var g="<<anonymous>>",f={array:O("array"),bigint:O("bigint"),bool:O("boolean"),func:O("function"),number:O("number"),object:O("object"),string:O("string"),symbol:O("symbol"),any:v(),arrayOf:C,element:b(),elementType:I(),instanceOf:S,node:z(),objectOf:k,oneOf:H,oneOfType:V,shape:Z,exact:te};function m(T,K){return T===K?T!==0||1/T===1/K:T!==T&&K!==K}function x(T,K){this.message=T,this.data=K&&typeof K=="object"?K:{},this.stack=""}x.prototype=Error.prototype;function w(T){if(process.env.NODE_ENV!=="production")var K={},F=0;function D(R,B,W,U,J,q,oe){if(U=U||g,q=q||W,oe!==n){if(u){var j=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw j.name="Invariant Violation",j}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var de=U+":"+W;!K[de]&&F<3&&(r("You are manually calling a React.PropTypes validation function for the `"+q+"` prop on `"+U+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),K[de]=!0,F++)}}return B[W]==null?R?B[W]===null?new x("The "+J+" `"+q+"` is marked as required "+("in `"+U+"`, but its value is `null`.")):new x("The "+J+" `"+q+"` is marked as required in "+("`"+U+"`, but its value is `undefined`.")):null:T(B,W,U,J,q)}var P=D.bind(null,!1);return P.isRequired=D.bind(null,!0),P}function O(T){function K(F,D,P,R,B,W){var U=F[D],J=le(U);if(J!==T){var q=re(U);return new x("Invalid "+R+" `"+B+"` of type "+("`"+q+"` supplied to `"+P+"`, expected ")+("`"+T+"`."),{expectedType:T})}return null}return w(K)}function v(){return w(s)}function C(T){function K(F,D,P,R,B){if(typeof T!="function")return new x("Property `"+B+"` of component `"+P+"` has invalid PropType notation inside arrayOf.");var W=F[D];if(!Array.isArray(W)){var U=le(W);return new x("Invalid "+R+" `"+B+"` of type "+("`"+U+"` supplied to `"+P+"`, expected an array."))}for(var J=0;J<W.length;J++){var q=T(W,J,P,R,B+"["+J+"]",n);if(q instanceof Error)return q}return null}return w(K)}function b(){function T(K,F,D,P,R){var B=K[F];if(!c(B)){var W=le(B);return new x("Invalid "+P+" `"+R+"` of type "+("`"+W+"` supplied to `"+D+"`, expected a single ReactElement."))}return null}return w(T)}function I(){function T(K,F,D,P,R){var B=K[F];if(!e.isValidElementType(B)){var W=le(B);return new x("Invalid "+P+" `"+R+"` of type "+("`"+W+"` supplied to `"+D+"`, expected a single ReactElement type."))}return null}return w(T)}function S(T){function K(F,D,P,R,B){if(!(F[D]instanceof T)){var W=T.name||g,U=Ne(F[D]);return new x("Invalid "+R+" `"+B+"` of type "+("`"+U+"` supplied to `"+P+"`, expected ")+("instance of `"+W+"`."))}return null}return w(K)}function H(T){if(!Array.isArray(T))return process.env.NODE_ENV!=="production"&&(arguments.length>1?r("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):r("Invalid argument supplied to oneOf, expected an array.")),s;function K(F,D,P,R,B){for(var W=F[D],U=0;U<T.length;U++)if(m(W,T[U]))return null;var J=JSON.stringify(T,function(oe,j){var de=re(j);return de==="symbol"?String(j):j});return new x("Invalid "+R+" `"+B+"` of value `"+String(W)+"` "+("supplied to `"+P+"`, expected one of "+J+"."))}return w(K)}function k(T){function K(F,D,P,R,B){if(typeof T!="function")return new x("Property `"+B+"` of component `"+P+"` has invalid PropType notation inside objectOf.");var W=F[D],U=le(W);if(U!=="object")return new x("Invalid "+R+" `"+B+"` of type "+("`"+U+"` supplied to `"+P+"`, expected an object."));for(var J in W)if(o(W,J)){var q=T(W,J,P,R,B+"."+J,n);if(q instanceof Error)return q}return null}return w(K)}function V(T){if(!Array.isArray(T))return process.env.NODE_ENV!=="production"&&r("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var K=0;K<T.length;K++){var F=T[K];if(typeof F!="function")return r("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+Oe(F)+" at index "+K+"."),s}function D(P,R,B,W,U){for(var J=[],q=0;q<T.length;q++){var oe=T[q],j=oe(P,R,B,W,U,n);if(j==null)return null;j.data&&o(j.data,"expectedType")&&J.push(j.data.expectedType)}var de=J.length>0?", expected one of type ["+J.join(", ")+"]":"";return new x("Invalid "+W+" `"+U+"` supplied to "+("`"+B+"`"+de+"."))}return w(D)}function z(){function T(K,F,D,P,R){return Q(K[F])?null:new x("Invalid "+P+" `"+R+"` supplied to "+("`"+D+"`, expected a ReactNode."))}return w(T)}function X(T,K,F,D,P){return new x((T||"React class")+": "+K+" type `"+F+"."+D+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+P+"`.")}function Z(T){function K(F,D,P,R,B){var W=F[D],U=le(W);if(U!=="object")return new x("Invalid "+R+" `"+B+"` of type `"+U+"` "+("supplied to `"+P+"`, expected `object`."));for(var J in T){var q=T[J];if(typeof q!="function")return X(P,R,B,J,re(q));var oe=q(W,J,P,R,B+"."+J,n);if(oe)return oe}return null}return w(K)}function te(T){function K(F,D,P,R,B){var W=F[D],U=le(W);if(U!=="object")return new x("Invalid "+R+" `"+B+"` of type `"+U+"` "+("supplied to `"+P+"`, expected `object`."));var J=t({},F[D],T);for(var q in J){var oe=T[q];if(o(T,q)&&typeof oe!="function")return X(P,R,B,q,re(oe));if(!oe)return new x("Invalid "+R+" `"+B+"` key `"+q+"` supplied to `"+P+"`.\nBad object: "+JSON.stringify(F[D],null," ")+`
27
+ Valid keys: `+JSON.stringify(Object.keys(T),null," "));var j=oe(W,q,P,R,B+"."+q,n);if(j)return j}return null}return w(K)}function Q(T){switch(typeof T){case"number":case"string":case"undefined":return!0;case"boolean":return!T;case"object":if(Array.isArray(T))return T.every(Q);if(T===null||c(T))return!0;var K=h(T);if(K){var F=K.call(T),D;if(K!==T.entries){for(;!(D=F.next()).done;)if(!Q(D.value))return!1}else for(;!(D=F.next()).done;){var P=D.value;if(P&&!Q(P[1]))return!1}}else return!1;return!0;default:return!1}}function ue(T,K){return T==="symbol"?!0:K?K["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&K instanceof Symbol:!1}function le(T){var K=typeof T;return Array.isArray(T)?"array":T instanceof RegExp?"object":ue(K,T)?"symbol":K}function re(T){if(typeof T>"u"||T===null)return""+T;var K=le(T);if(K==="object"){if(T instanceof Date)return"date";if(T instanceof RegExp)return"regexp"}return K}function Oe(T){var K=re(T);switch(K){case"array":case"object":return"an "+K;case"boolean":case"date":case"regexp":return"a "+K;default:return K}}function Ne(T){return!T.constructor||!T.constructor.name?g:T.constructor.name}return f.checkPropTypes=i,f.resetWarningCache=i.resetWarningCache,f.PropTypes=f,f},Zn}var Qn,To;function Vd(){if(To)return Qn;To=1;var e=Cr();function t(){}function n(){}return n.resetWarningCache=t,Qn=function(){function o(s,c,u,d,p,h){if(h!==e){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}}o.isRequired=o;function i(){return o}var r={array:o,bigint:o,bool:o,func:o,number:o,object:o,string:o,symbol:o,any:o,arrayOf:i,element:o,elementType:o,instanceOf:i,node:o,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return r.PropTypes=r,r},Qn}if(process.env.NODE_ENV!=="production"){var Ud=Ai(),Bd=!0;sr.exports=Hd()(Ud.isElement,Bd)}else sr.exports=Vd()();var qd=sr.exports;const A=xr(qd);var ar={exports:{}},ae={};/**
28
28
  * @license React
29
29
  * react-is.production.min.js
30
30
  *
@@ -32,7 +32,7 @@ Valid keys: `+JSON.stringify(Object.keys(N),null," "));var A=oe(J,W,P,T,q+"."+W
32
32
  *
33
33
  * This source code is licensed under the MIT license found in the
34
34
  * LICENSE file in the root directory of this source tree.
35
- */var Ro;function Wd(){if(Ro)return ae;Ro=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),r=Symbol.for("react.provider"),s=Symbol.for("react.context"),c=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),g;g=Symbol.for("react.module.reference");function x(w){if(typeof w=="object"&&w!==null){var O=w.$$typeof;switch(O){case e:switch(w=w.type,w){case n:case i:case o:case d:case p:return w;default:switch(w=w&&w.$$typeof,w){case c:case s:case u:case v:case h:case r:return w;default:return O}}case t:return O}}}return ae.ContextConsumer=s,ae.ContextProvider=r,ae.Element=e,ae.ForwardRef=u,ae.Fragment=n,ae.Lazy=v,ae.Memo=h,ae.Portal=t,ae.Profiler=i,ae.StrictMode=o,ae.Suspense=d,ae.SuspenseList=p,ae.isAsyncMode=function(){return!1},ae.isConcurrentMode=function(){return!1},ae.isContextConsumer=function(w){return x(w)===s},ae.isContextProvider=function(w){return x(w)===r},ae.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===e},ae.isForwardRef=function(w){return x(w)===u},ae.isFragment=function(w){return x(w)===n},ae.isLazy=function(w){return x(w)===v},ae.isMemo=function(w){return x(w)===h},ae.isPortal=function(w){return x(w)===t},ae.isProfiler=function(w){return x(w)===i},ae.isStrictMode=function(w){return x(w)===o},ae.isSuspense=function(w){return x(w)===d},ae.isSuspenseList=function(w){return x(w)===p},ae.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===n||w===i||w===o||w===d||w===p||w===f||typeof w=="object"&&w!==null&&(w.$$typeof===v||w.$$typeof===h||w.$$typeof===r||w.$$typeof===s||w.$$typeof===u||w.$$typeof===g||w.getModuleId!==void 0)},ae.typeOf=x,ae}var ce={};/**
35
+ */var Ro;function Wd(){if(Ro)return ae;Ro=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),r=Symbol.for("react.provider"),s=Symbol.for("react.context"),c=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),m;m=Symbol.for("react.module.reference");function x(w){if(typeof w=="object"&&w!==null){var O=w.$$typeof;switch(O){case e:switch(w=w.type,w){case n:case i:case o:case d:case p:return w;default:switch(w=w&&w.$$typeof,w){case c:case s:case u:case g:case h:case r:return w;default:return O}}case t:return O}}}return ae.ContextConsumer=s,ae.ContextProvider=r,ae.Element=e,ae.ForwardRef=u,ae.Fragment=n,ae.Lazy=g,ae.Memo=h,ae.Portal=t,ae.Profiler=i,ae.StrictMode=o,ae.Suspense=d,ae.SuspenseList=p,ae.isAsyncMode=function(){return!1},ae.isConcurrentMode=function(){return!1},ae.isContextConsumer=function(w){return x(w)===s},ae.isContextProvider=function(w){return x(w)===r},ae.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===e},ae.isForwardRef=function(w){return x(w)===u},ae.isFragment=function(w){return x(w)===n},ae.isLazy=function(w){return x(w)===g},ae.isMemo=function(w){return x(w)===h},ae.isPortal=function(w){return x(w)===t},ae.isProfiler=function(w){return x(w)===i},ae.isStrictMode=function(w){return x(w)===o},ae.isSuspense=function(w){return x(w)===d},ae.isSuspenseList=function(w){return x(w)===p},ae.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===n||w===i||w===o||w===d||w===p||w===f||typeof w=="object"&&w!==null&&(w.$$typeof===g||w.$$typeof===h||w.$$typeof===r||w.$$typeof===s||w.$$typeof===u||w.$$typeof===m||w.getModuleId!==void 0)},ae.typeOf=x,ae}var ce={};/**
36
36
  * @license React
37
37
  * react-is.development.js
38
38
  *
@@ -40,4 +40,4 @@ Valid keys: `+JSON.stringify(Object.keys(N),null," "));var A=oe(J,W,P,T,q+"."+W
40
40
  *
41
41
  * This source code is licensed under the MIT license found in the
42
42
  * LICENSE file in the root directory of this source tree.
43
- */var Ao;function Jd(){return Ao||(Ao=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),r=Symbol.for("react.provider"),s=Symbol.for("react.context"),c=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),g=!1,x=!1,w=!1,O=!1,I=!1,C;C=Symbol.for("react.module.reference");function b(L){return!!(typeof L=="string"||typeof L=="function"||L===n||L===i||I||L===o||L===d||L===p||O||L===f||g||x||w||typeof L=="object"&&L!==null&&(L.$$typeof===v||L.$$typeof===h||L.$$typeof===r||L.$$typeof===s||L.$$typeof===u||L.$$typeof===C||L.getModuleId!==void 0))}function m(L){if(typeof L=="object"&&L!==null){var Ne=L.$$typeof;switch(Ne){case e:var Te=L.type;switch(Te){case n:case i:case o:case d:case p:return Te;default:var Ge=Te&&Te.$$typeof;switch(Ge){case c:case s:case u:case v:case h:case r:return Ge;default:return Ne}}case t:return Ne}}}var j=s,$=r,F=e,V=u,B=n,Z=v,G=h,te=t,Q=i,ue=o,le=d,re=p,Oe=!1,Ee=!1;function N(L){return Oe||(Oe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function K(L){return Ee||(Ee=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function k(L){return m(L)===s}function D(L){return m(L)===r}function P(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function T(L){return m(L)===u}function q(L){return m(L)===n}function J(L){return m(L)===v}function U(L){return m(L)===h}function z(L){return m(L)===t}function W(L){return m(L)===i}function oe(L){return m(L)===o}function A(L){return m(L)===d}function de(L){return m(L)===p}ce.ContextConsumer=j,ce.ContextProvider=$,ce.Element=F,ce.ForwardRef=V,ce.Fragment=B,ce.Lazy=Z,ce.Memo=G,ce.Portal=te,ce.Profiler=Q,ce.StrictMode=ue,ce.Suspense=le,ce.SuspenseList=re,ce.isAsyncMode=N,ce.isConcurrentMode=K,ce.isContextConsumer=k,ce.isContextProvider=D,ce.isElement=P,ce.isForwardRef=T,ce.isFragment=q,ce.isLazy=J,ce.isMemo=U,ce.isPortal=z,ce.isProfiler=W,ce.isStrictMode=oe,ce.isSuspense=A,ce.isSuspenseList=de,ce.isValidElementType=b,ce.typeOf=m}()),ce}process.env.NODE_ENV==="production"?ar.exports=Wd():ar.exports=Jd();var jo=ar.exports;const Po=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Do=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",er=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Do(n.overflowY,t)||Do(n.overflowX,t)||(o=>{const i=(r=>{if(!r.ownerDocument||!r.ownerDocument.defaultView)return null;try{return r.ownerDocument.defaultView.frameElement}catch{return null}})(o);return!!i&&(i.clientHeight<o.scrollHeight||i.clientWidth<o.scrollWidth)})(e)}return!1},fn=(e,t,n,o,i,r,s,c)=>r<e&&s>t||r>e&&s<t?0:r<=e&&c<=n||s>=t&&c>=n?r-e-o:s>t&&c<n||r<e&&c>n?s-t+i:0,zd=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Xd=(e,t)=>{var n,o,i,r;if(typeof document>"u")return[];const{scrollMode:s,block:c,inline:u,boundary:d,skipOverflowHiddenElements:p}=t,h=typeof d=="function"?d:le=>le!==d;if(!Po(e))throw new TypeError("Invalid target");const v=document.scrollingElement||document.documentElement,f=[];let g=e;for(;Po(g)&&h(g);){if(g=zd(g),g===v){f.push(g);break}g!=null&&g===document.body&&er(g)&&!er(document.documentElement)||g!=null&&er(g,p)&&f.push(g)}const x=(o=(n=window.visualViewport)==null?void 0:n.width)!=null?o:innerWidth,w=(r=(i=window.visualViewport)==null?void 0:i.height)!=null?r:innerHeight,{scrollX:O,scrollY:I}=window,{height:C,width:b,top:m,right:j,bottom:$,left:F}=e.getBoundingClientRect(),{top:V,right:B,bottom:Z,left:G}=(le=>{const re=window.getComputedStyle(le);return{top:parseFloat(re.scrollMarginTop)||0,right:parseFloat(re.scrollMarginRight)||0,bottom:parseFloat(re.scrollMarginBottom)||0,left:parseFloat(re.scrollMarginLeft)||0}})(e);let te=c==="start"||c==="nearest"?m-V:c==="end"?$+Z:m+C/2-V+Z,Q=u==="center"?F+b/2-G+B:u==="end"?j+B:F-G;const ue=[];for(let le=0;le<f.length;le++){const re=f[le],{height:Oe,width:Ee,top:N,right:K,bottom:k,left:D}=re.getBoundingClientRect();if(s==="if-needed"&&m>=0&&F>=0&&$<=w&&j<=x&&m>=N&&$<=k&&F>=D&&j<=K)return ue;const P=getComputedStyle(re),T=parseInt(P.borderLeftWidth,10),q=parseInt(P.borderTopWidth,10),J=parseInt(P.borderRightWidth,10),U=parseInt(P.borderBottomWidth,10);let z=0,W=0;const oe="offsetWidth"in re?re.offsetWidth-re.clientWidth-T-J:0,A="offsetHeight"in re?re.offsetHeight-re.clientHeight-q-U:0,de="offsetWidth"in re?re.offsetWidth===0?0:Ee/re.offsetWidth:0,L="offsetHeight"in re?re.offsetHeight===0?0:Oe/re.offsetHeight:0;if(v===re)z=c==="start"?te:c==="end"?te-w:c==="nearest"?fn(I,I+w,w,q,U,I+te,I+te+C,C):te-w/2,W=u==="start"?Q:u==="center"?Q-x/2:u==="end"?Q-x:fn(O,O+x,x,T,J,O+Q,O+Q+b,b),z=Math.max(0,z+I),W=Math.max(0,W+O);else{z=c==="start"?te-N-q:c==="end"?te-k+U+A:c==="nearest"?fn(N,k,Oe,q,U+A,te,te+C,C):te-(N+Oe/2)+A/2,W=u==="start"?Q-D-T:u==="center"?Q-(D+Ee/2)+oe/2:u==="end"?Q-K+J+oe:fn(D,K,Ee,T,J+oe,Q,Q+b,b);const{scrollLeft:Ne,scrollTop:Te}=re;z=L===0?0:Math.max(0,Math.min(Te+z/L,re.scrollHeight-Oe/L+A)),W=de===0?0:Math.max(0,Math.min(Ne+W/de,re.scrollWidth-Ee/de+oe)),te+=Te-z,Q+=Ne-W}ue.push({el:re,top:z,left:W})}return ue};var Tt=function(){return Tt=Object.assign||function(t){for(var n,o=1,i=arguments.length;o<i;o++){n=arguments[o];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Tt.apply(this,arguments)};var Yd=0;function ko(e){return typeof e=="function"?e:De}function De(){}function Pi(e,t){if(e){var n=Xd(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(o){var i=o.el,r=o.top,s=o.left;i.scrollTop=r,i.scrollLeft=s})}}function Fo(e,t,n){var o=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return o}function Or(e,t){var n;function o(){n&&clearTimeout(n)}function i(){for(var r=arguments.length,s=new Array(r),c=0;c<r;c++)s[c]=arguments[c];o(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return i.cancel=o,i}function we(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(o){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return t.some(function(c){return c&&c.apply(void 0,[o].concat(r)),o.preventDownshiftDefault||o.hasOwnProperty("nativeEvent")&&o.nativeEvent.preventDownshiftDefault})}}function Et(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(o){t.forEach(function(i){typeof i=="function"?i(o):i&&(i.current=o)})}}function Di(){return String(Yd++)}function Gd(e){var t=e.isOpen,n=e.resultCount,o=e.previousResultCount;return t?n?n!==o?n+" result"+(n===1?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function Mo(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function ki(e){return typeof e.type=="string"}function Fi(e){return e.props}function Zd(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var Qd=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function hn(e){e===void 0&&(e={});var t={};return Qd.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function _n(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,o){return n[o]=bn(t,o)?t[o]:e[o],n},{})}function bn(e,t){return e[t]!==void 0}function cr(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function ep(e){return Object.prototype.toString.call(e)==="[object Object]"}function wt(e,t,n,o,i){var r=n.length;if(r===0)return-1;var s=r-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var c=e+t;c<0?c=s:c>s&&(c=0);var u=Rt(c,t<0,n,o,i);return u===-1?e>=r?-1:e:u}function Rt(e,t,n,o,i){i===void 0&&(i=!1);var r=n.length;if(t){for(var s=e;s>=0;s--)if(!o(n[s],s))return s}else for(var c=e;c<r;c++)if(!o(n[c],c))return c;return i?Rt(t?r-1:0,t,n,o):-1}function Cn(e,t,n,o){return o===void 0&&(o=!0),n&&t.some(function(i){return i&&(Fo(i,e,n)||o&&Fo(i,n.document.activeElement,n))})}var Sr=De;process.env.NODE_ENV!=="production"&&(Sr=function(t,n,o){var i="This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props";Object.keys(t).forEach(function(r){n[r]!==void 0&&o[r]===void 0?console.error('downshift: A component has changed the controlled prop "'+r+'" to be uncontrolled. '+i):n[r]===void 0&&o[r]!==void 0&&console.error('downshift: A component has changed the uncontrolled prop "'+r+'" to be controlled. '+i)})});var tp=Or(function(e){Mi(e).textContent=""},500);function Mi(e){var t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}function Ki(e,t){if(!(!e||!t)){var n=Mi(t);n.textContent=e,tp(t)}}function np(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Li=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,$i=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Hi=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,vn=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,In=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Vi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Ui=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Bi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,qi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Wi=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Ji=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,zi=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Xi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,ur=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Yi=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Gi=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Zi=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,rp=Object.freeze({__proto__:null,blurButton:Yi,blurInput:Ji,changeInput:zi,clickButton:ur,clickItem:Wi,controlledPropUpdatedSelectedItem:Gi,itemMouseEnter:Hi,keyDownArrowDown:In,keyDownArrowUp:vn,keyDownEnd:qi,keyDownEnter:Ui,keyDownEscape:Vi,keyDownHome:Bi,keyDownSpaceButton:Xi,mouseUp:$i,touchEnd:Zi,unknown:Li}),op=["refKey","ref"],ip=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],sp=["onKeyDown","onBlur","onChange","onInput","onChangeText"],ap=["refKey","ref"],cp=["onMouseMove","onMouseDown","onClick","onPress","index","item"],up=function(){var e=function(t){function n(i){var r;r=t.call(this,i)||this,r.id=r.props.id||"downshift-"+Di(),r.menuId=r.props.menuId||r.id+"-menu",r.labelId=r.props.labelId||r.id+"-label",r.inputId=r.props.inputId||r.id+"-input",r.getItemId=r.props.getItemId||function(I){return r.id+"-item-"+I},r.items=[],r.itemCount=null,r.previousResultCount=0,r.timeoutIds=[],r.internalSetTimeout=function(I,C){var b=setTimeout(function(){r.timeoutIds=r.timeoutIds.filter(function(m){return m!==b}),I()},C);r.timeoutIds.push(b)},r.setItemCount=function(I){r.itemCount=I},r.unsetItemCount=function(){r.itemCount=null},r.isItemDisabled=function(I,C){var b=r.getItemNodeFromIndex(C);return b&&b.hasAttribute("disabled")},r.setHighlightedIndex=function(I,C){I===void 0&&(I=r.props.defaultHighlightedIndex),C===void 0&&(C={}),C=hn(C),r.internalSetState(ne({highlightedIndex:I},C))},r.clearSelection=function(I){r.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:r.props.defaultHighlightedIndex,isOpen:r.props.defaultIsOpen},I)},r.selectItem=function(I,C,b){C=hn(C),r.internalSetState(ne({isOpen:r.props.defaultIsOpen,highlightedIndex:r.props.defaultHighlightedIndex,selectedItem:I,inputValue:r.props.itemToString(I)},C),b)},r.selectItemAtIndex=function(I,C,b){var m=r.items[I];m!=null&&r.selectItem(m,C,b)},r.selectHighlightedItem=function(I,C){return r.selectItemAtIndex(r.getState().highlightedIndex,I,C)},r.internalSetState=function(I,C){var b,m,j={},$=typeof I=="function";return!$&&I.hasOwnProperty("inputValue")&&r.props.onInputValueChange(I.inputValue,ne({},r.getStateAndHelpers(),I)),r.setState(function(F){var V;F=r.getState(F);var B=$?I(F):I;B=r.props.stateReducer(F,B),b=B.hasOwnProperty("selectedItem");var Z={};return b&&B.selectedItem!==F.selectedItem&&(m=B.selectedItem),(V=B).type||(V.type=Li),Object.keys(B).forEach(function(G){F[G]!==B[G]&&(j[G]=B[G]),G!=="type"&&(B[G],bn(r.props,G)||(Z[G]=B[G]))}),$&&B.hasOwnProperty("inputValue")&&r.props.onInputValueChange(B.inputValue,ne({},r.getStateAndHelpers(),B)),Z},function(){ko(C)();var F=Object.keys(j).length>1;F&&r.props.onStateChange(j,r.getStateAndHelpers()),b&&r.props.onSelect(I.selectedItem,r.getStateAndHelpers()),m!==void 0&&r.props.onChange(m,r.getStateAndHelpers()),r.props.onUserAction(j,r.getStateAndHelpers())})},r.rootRef=function(I){return r._rootNode=I},r.getRootProps=function(I,C){var b,m=I===void 0?{}:I,j=m.refKey,$=j===void 0?"ref":j,F=m.ref,V=nt(m,op),B=C===void 0?{}:C,Z=B.suppressRefError,G=Z===void 0?!1:Z;r.getRootProps.called=!0,r.getRootProps.refKey=$,r.getRootProps.suppressRefError=G;var te=r.getState(),Q=te.isOpen;return ne((b={},b[$]=Et(F,r.rootRef),b.role="combobox",b["aria-expanded"]=Q,b["aria-haspopup"]="listbox",b["aria-owns"]=Q?r.menuId:void 0,b["aria-labelledby"]=r.labelId,b),V)},r.keyDownHandlers={ArrowDown:function(C){var b=this;if(C.preventDefault(),this.getState().isOpen){var m=C.shiftKey?5:1;this.moveHighlightedIndex(m,{type:In})}else this.internalSetState({isOpen:!0,type:In},function(){var j=b.getItemCount();if(j>0){var $=b.getState(),F=$.highlightedIndex,V=wt(F,1,{length:j},b.isItemDisabled,!0);b.setHighlightedIndex(V,{type:In})}})},ArrowUp:function(C){var b=this;if(C.preventDefault(),this.getState().isOpen){var m=C.shiftKey?-5:-1;this.moveHighlightedIndex(m,{type:vn})}else this.internalSetState({isOpen:!0,type:vn},function(){var j=b.getItemCount();if(j>0){var $=b.getState(),F=$.highlightedIndex,V=wt(F,-1,{length:j},b.isItemDisabled,!0);b.setHighlightedIndex(V,{type:vn})}})},Enter:function(C){if(C.which!==229){var b=this.getState(),m=b.isOpen,j=b.highlightedIndex;if(m&&j!=null){C.preventDefault();var $=this.items[j],F=this.getItemNodeFromIndex(j);if($==null||F&&F.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Ui})}}},Escape:function(C){C.preventDefault(),this.reset(ne({type:Vi},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},r.buttonKeyDownHandlers=ne({},r.keyDownHandlers,{" ":function(C){C.preventDefault(),this.toggleMenu({type:Xi})}}),r.inputKeyDownHandlers=ne({},r.keyDownHandlers,{Home:function(C){var b=this.getState(),m=b.isOpen;if(m){C.preventDefault();var j=this.getItemCount();if(!(j<=0||!m)){var $=Rt(0,!1,{length:j},this.isItemDisabled);this.setHighlightedIndex($,{type:Bi})}}},End:function(C){var b=this.getState(),m=b.isOpen;if(m){C.preventDefault();var j=this.getItemCount();if(!(j<=0||!m)){var $=Rt(j-1,!0,{length:j},this.isItemDisabled);this.setHighlightedIndex($,{type:qi})}}}}),r.getToggleButtonProps=function(I){var C=I===void 0?{}:I,b=C.onClick;C.onPress;var m=C.onKeyDown,j=C.onKeyUp,$=C.onBlur,F=nt(C,ip),V=r.getState(),B=V.isOpen,Z={onClick:we(b,r.buttonHandleClick),onKeyDown:we(m,r.buttonHandleKeyDown),onKeyUp:we(j,r.buttonHandleKeyUp),onBlur:we($,r.buttonHandleBlur)},G=F.disabled?{}:Z;return ne({type:"button",role:"button","aria-label":B?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},G,F)},r.buttonHandleKeyUp=function(I){I.preventDefault()},r.buttonHandleKeyDown=function(I){var C=cr(I);r.buttonKeyDownHandlers[C]&&r.buttonKeyDownHandlers[C].call(r,I)},r.buttonHandleClick=function(I){if(I.preventDefault(),r.props.environment){var C=r.props.environment.document,b=C.body,m=C.activeElement;b&&b===m&&I.target.focus()}process.env.NODE_ENV==="test"?r.toggleMenu({type:ur}):r.internalSetTimeout(function(){return r.toggleMenu({type:ur})})},r.buttonHandleBlur=function(I){var C=I.target;r.internalSetTimeout(function(){if(!(r.isMouseDown||!r.props.environment)){var b=r.props.environment.document.activeElement;(b==null||b.id!==r.inputId)&&b!==C&&r.reset({type:Yi})}})},r.getLabelProps=function(I){return ne({htmlFor:r.inputId,id:r.labelId},I)},r.getInputProps=function(I){var C=I===void 0?{}:I,b=C.onKeyDown,m=C.onBlur,j=C.onChange,$=C.onInput;C.onChangeText;var F=nt(C,sp),V,B={};V="onChange";var Z=r.getState(),G=Z.inputValue,te=Z.isOpen,Q=Z.highlightedIndex;if(!F.disabled){var ue;B=(ue={},ue[V]=we(j,$,r.inputHandleChange),ue.onKeyDown=we(b,r.inputHandleKeyDown),ue.onBlur=we(m,r.inputHandleBlur),ue)}return ne({"aria-autocomplete":"list","aria-activedescendant":te&&typeof Q=="number"&&Q>=0?r.getItemId(Q):void 0,"aria-controls":te?r.menuId:void 0,"aria-labelledby":F&&F["aria-label"]?void 0:r.labelId,autoComplete:"off",value:G,id:r.inputId},B,F)},r.inputHandleKeyDown=function(I){var C=cr(I);C&&r.inputKeyDownHandlers[C]&&r.inputKeyDownHandlers[C].call(r,I)},r.inputHandleChange=function(I){r.internalSetState({type:zi,isOpen:!0,inputValue:I.target.value,highlightedIndex:r.props.defaultHighlightedIndex})},r.inputHandleBlur=function(){r.internalSetTimeout(function(){var I;if(!(r.isMouseDown||!r.props.environment)){var C=r.props.environment.document.activeElement,b=(C==null||(I=C.dataset)==null?void 0:I.toggle)&&r._rootNode&&r._rootNode.contains(C);b||r.reset({type:Ji})}})},r.menuRef=function(I){r._menuNode=I},r.getMenuProps=function(I,C){var b,m=I===void 0?{}:I,j=m.refKey,$=j===void 0?"ref":j,F=m.ref,V=nt(m,ap),B=C===void 0?{}:C,Z=B.suppressRefError,G=Z===void 0?!1:Z;return r.getMenuProps.called=!0,r.getMenuProps.refKey=$,r.getMenuProps.suppressRefError=G,ne((b={},b[$]=Et(F,r.menuRef),b.role="listbox",b["aria-labelledby"]=V&&V["aria-label"]?void 0:r.labelId,b.id=r.menuId,b),V)},r.getItemProps=function(I){var C,b=I===void 0?{}:I,m=b.onMouseMove,j=b.onMouseDown,$=b.onClick;b.onPress;var F=b.index,V=b.item,B=V===void 0?process.env.NODE_ENV==="production"?void 0:Zd("getItemProps","item"):V,Z=nt(b,cp);F===void 0?(r.items.push(B),F=r.items.indexOf(B)):r.items[F]=B;var G="onClick",te=$,Q=(C={onMouseMove:we(m,function(){F!==r.getState().highlightedIndex&&(r.setHighlightedIndex(F,{type:Hi}),r.avoidScrolling=!0,r.internalSetTimeout(function(){return r.avoidScrolling=!1},250))}),onMouseDown:we(j,function(le){le.preventDefault()})},C[G]=we(te,function(){r.selectItemAtIndex(F,{type:Wi})}),C),ue=Z.disabled?{onMouseDown:Q.onMouseDown}:Q;return ne({id:r.getItemId(F),role:"option","aria-selected":r.getState().highlightedIndex===F},ue,Z)},r.clearItems=function(){r.items=[]},r.reset=function(I,C){I===void 0&&(I={}),I=hn(I),r.internalSetState(function(b){var m=b.selectedItem;return ne({isOpen:r.props.defaultIsOpen,highlightedIndex:r.props.defaultHighlightedIndex,inputValue:r.props.itemToString(m)},I)},C)},r.toggleMenu=function(I,C){I===void 0&&(I={}),I=hn(I),r.internalSetState(function(b){var m=b.isOpen;return ne({isOpen:!m},m&&{highlightedIndex:r.props.defaultHighlightedIndex},I)},function(){var b=r.getState(),m=b.isOpen,j=b.highlightedIndex;m&&r.getItemCount()>0&&typeof j=="number"&&r.setHighlightedIndex(j,I),ko(C)()})},r.openMenu=function(I){r.internalSetState({isOpen:!0},I)},r.closeMenu=function(I){r.internalSetState({isOpen:!1},I)},r.updateStatus=Or(function(){var I;if((I=r.props)!=null&&(I=I.environment)!=null&&I.document){var C=r.getState(),b=r.items[C.highlightedIndex],m=r.getItemCount(),j=r.props.getA11yStatusMessage(ne({itemToString:r.props.itemToString,previousResultCount:r.previousResultCount,resultCount:m,highlightedItem:b},C));r.previousResultCount=m,Ki(j,r.props.environment.document)}},200);var s=r.props,c=s.defaultHighlightedIndex,u=s.initialHighlightedIndex,d=u===void 0?c:u,p=s.defaultIsOpen,h=s.initialIsOpen,v=h===void 0?p:h,f=s.initialInputValue,g=f===void 0?"":f,x=s.initialSelectedItem,w=x===void 0?null:x,O=r.getState({highlightedIndex:d,isOpen:v,inputValue:g,selectedItem:w});return O.selectedItem!=null&&r.props.initialInputValue===void 0&&(O.inputValue=r.props.itemToString(O.selectedItem)),r.state=O,r}Fd(n,t);var o=n.prototype;return o.internalClearTimeouts=function(){this.timeoutIds.forEach(function(r){clearTimeout(r)}),this.timeoutIds=[]},o.getState=function(r){return r===void 0&&(r=this.state),_n(r,this.props)},o.getItemCount=function(){var r=this.items.length;return this.itemCount!=null?r=this.itemCount:this.props.itemCount!==void 0&&(r=this.props.itemCount),r},o.getItemNodeFromIndex=function(r){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(r)):null},o.scrollHighlightedItemIntoView=function(){{var r=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(r,this._menuNode)}},o.moveHighlightedIndex=function(r,s){var c=this.getItemCount(),u=this.getState(),d=u.highlightedIndex;if(c>0){var p=wt(d,r,{length:c},this.isItemDisabled,!0);this.setHighlightedIndex(p,s)}},o.getStateAndHelpers=function(){var r=this.getState(),s=r.highlightedIndex,c=r.inputValue,u=r.selectedItem,d=r.isOpen,p=this.props.itemToString,h=this.id,v=this.getRootProps,f=this.getToggleButtonProps,g=this.getLabelProps,x=this.getMenuProps,w=this.getInputProps,O=this.getItemProps,I=this.openMenu,C=this.closeMenu,b=this.toggleMenu,m=this.selectItem,j=this.selectItemAtIndex,$=this.selectHighlightedItem,F=this.setHighlightedIndex,V=this.clearSelection,B=this.clearItems,Z=this.reset,G=this.setItemCount,te=this.unsetItemCount,Q=this.internalSetState;return{getRootProps:v,getToggleButtonProps:f,getLabelProps:g,getMenuProps:x,getInputProps:w,getItemProps:O,reset:Z,openMenu:I,closeMenu:C,toggleMenu:b,selectItem:m,selectItemAtIndex:j,selectHighlightedItem:$,setHighlightedIndex:F,clearSelection:V,clearItems:B,setItemCount:G,unsetItemCount:te,setState:Q,itemToString:p,id:h,highlightedIndex:s,inputValue:c,isOpen:d,selectedItem:u}},o.componentDidMount=function(){var r=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Ko(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){r.internalClearTimeouts()};else{var s=function(){r.isMouseDown=!0},c=function(f){r.isMouseDown=!1;var g=Cn(f.target,[r._rootNode,r._menuNode],r.props.environment);!g&&r.getState().isOpen&&r.reset({type:$i},function(){return r.props.onOuterClick(r.getStateAndHelpers())})},u=function(){r.isTouchMove=!1},d=function(){r.isTouchMove=!0},p=function(f){var g=Cn(f.target,[r._rootNode,r._menuNode],r.props.environment,!1);!r.isTouchMove&&!g&&r.getState().isOpen&&r.reset({type:Zi},function(){return r.props.onOuterClick(r.getStateAndHelpers())})},h=this.props.environment;h.addEventListener("mousedown",s),h.addEventListener("mouseup",c),h.addEventListener("touchstart",u),h.addEventListener("touchmove",d),h.addEventListener("touchend",p),this.cleanup=function(){r.internalClearTimeouts(),r.updateStatus.cancel(),h.removeEventListener("mousedown",s),h.removeEventListener("mouseup",c),h.removeEventListener("touchstart",u),h.removeEventListener("touchmove",d),h.removeEventListener("touchend",p)}}},o.shouldScroll=function(r,s){var c=this.props.highlightedIndex===void 0?this.getState():this.props,u=c.highlightedIndex,d=s.highlightedIndex===void 0?r:s,p=d.highlightedIndex,h=u&&this.getState().isOpen&&!r.isOpen,v=u!==p;return h||v},o.componentDidUpdate=function(r,s){process.env.NODE_ENV!=="production"&&(Sr(this.state,r,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Ko(this._menuNode,this.getMenuProps)),bn(this.props,"selectedItem")&&this.props.selectedItemChanged(r.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Gi,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,r)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},o.componentWillUnmount=function(){this.cleanup()},o.render=function(){var r=Mo(this.props.children,De);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var s=Mo(r(this.getStateAndHelpers()));if(!s)return null;if(this.getRootProps.called||this.props.suppressRefError)return process.env.NODE_ENV!=="production"&&!this.getRootProps.suppressRefError&&!this.props.suppressRefError&&lp(s,this.getRootProps),s;if(ki(s))return y.cloneElement(s,this.getRootProps(Fi(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(y.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Gd,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&ep(n)&&!n.hasOwnProperty("toString")&&console.warn("downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.","The object that was passed:",n),String(n))},onStateChange:De,onInputValueChange:De,onUserAction:De,onChange:De,onSelect:De,onOuterClick:De,selectedItemChanged:function(n,o){return n!==o},environment:typeof window>"u"?void 0:window,stateReducer:function(n,o){return o},suppressRefError:!1,scrollIntoView:Pi},e.stateChangeTypes=rp,e}();process.env.NODE_ENV!=="production"&&(up.propTypes={children:R.func,defaultHighlightedIndex:R.number,defaultIsOpen:R.bool,initialHighlightedIndex:R.number,initialSelectedItem:R.any,initialInputValue:R.string,initialIsOpen:R.bool,getA11yStatusMessage:R.func,itemToString:R.func,onChange:R.func,onSelect:R.func,onStateChange:R.func,onInputValueChange:R.func,onUserAction:R.func,onOuterClick:R.func,selectedItemChanged:R.func,stateReducer:R.func,itemCount:R.number,id:R.string,environment:R.shape({addEventListener:R.func.isRequired,removeEventListener:R.func.isRequired,document:R.shape({createElement:R.func.isRequired,getElementById:R.func.isRequired,activeElement:R.any.isRequired,body:R.any.isRequired}).isRequired,Node:R.func.isRequired}),suppressRefError:R.bool,scrollIntoView:R.func,selectedItem:R.any,isOpen:R.bool,inputValue:R.string,highlightedIndex:R.number,labelId:R.string,inputId:R.string,menuId:R.string,getItemId:R.func});function Ko(e,t){var n=t.refKey;e||console.error('downshift: The ref prop "'+n+'" from getMenuProps was not applied correctly on your menu element.')}function lp(e,t){var n=t.refKey,o=n!=="ref",i=!ki(e);i&&!o&&!jo.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!i&&o&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!jo.isForwardRef(e)&&!Fi(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Qi={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function dp(e,t,n){var o=e.props,i=e.type,r={};Object.keys(t).forEach(function(s){pp(s,e,t,n),n[s]!==t[s]&&(r[s]=n[s])}),o.onStateChange&&Object.keys(r).length&&o.onStateChange(ne({type:i},r))}function pp(e,t,n,o){var i=t.props,r=t.type,s="on"+Er(e)+"Change";i[s]&&o[e]!==void 0&&o[e]!==n[e]&&i[s](ne({type:r},o))}function fp(e,t){return t.changes}var Lo=Or(function(e,t){Ki(e,t)},200),hp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?y.useLayoutEffect:y.useEffect,mp="useId"in y?function(t){var n=t.id,o=t.labelId,i=t.menuId,r=t.getItemId,s=t.toggleButtonId,c=t.inputId,u="downshift-"+y.useId();n||(n=u);var d=y.useRef({labelId:o||n+"-label",menuId:i||n+"-menu",getItemId:r||function(p){return n+"-item-"+p},toggleButtonId:s||n+"-toggle-button",inputId:c||n+"-input"});return d.current}:function(t){var n=t.id,o=n===void 0?"downshift-"+Di():n,i=t.labelId,r=t.menuId,s=t.getItemId,c=t.toggleButtonId,u=t.inputId,d=y.useRef({labelId:i||o+"-label",menuId:r||o+"-menu",getItemId:s||function(p){return o+"-item-"+p},toggleButtonId:c||o+"-toggle-button",inputId:u||o+"-input"});return d.current};function gp(e,t,n,o){var i,r;if(e===void 0){if(t===void 0)throw new Error(o);i=n[t],r=t}else r=t===void 0?n.indexOf(e):t,i=e;return[i,r]}function Er(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function es(e){var t=y.useRef(e);return t.current=e,t}function yp(e,t,n,o){var i=y.useRef(),r=y.useRef(),s=y.useCallback(function(f,g){r.current=g,f=_n(f,g.props);var x=e(f,g),w=g.props.stateReducer(f,ne({},g,{changes:x}));return w},[e]),c=y.useReducer(s,t,n),u=c[0],d=c[1],p=es(t),h=y.useCallback(function(f){return d(ne({props:p.current},f))},[p]),v=r.current;return y.useEffect(function(){var f=_n(i.current,v==null?void 0:v.props),g=v&&i.current&&!o(f,u);g&&dp(v,f,u),i.current=u},[u,v,o]),[u,h]}var qt={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:fp,scrollIntoView:Pi,environment:typeof window>"u"?void 0:window};function ut(e,t,n){n===void 0&&(n=Qi);var o=e["default"+Er(t)];return o!==void 0?o:n[t]}function Wt(e,t,n){n===void 0&&(n=Qi);var o=e[t];if(o!==void 0)return o;var i=e["initial"+Er(t)];return i!==void 0?i:ut(e,t,n)}function vp(e){var t=Wt(e,"selectedItem"),n=Wt(e,"isOpen"),o=bp(e),i=Wt(e,"inputValue");return{highlightedIndex:o<0&&t&&n?e.items.findIndex(function(r){return e.itemToKey(r)===e.itemToKey(t)}):o,isOpen:n,selectedItem:t,inputValue:i}}function Jt(e,t,n){var o=e.items,i=e.initialHighlightedIndex,r=e.defaultHighlightedIndex,s=e.isItemDisabled,c=e.itemToKey,u=t.selectedItem,d=t.highlightedIndex;return o.length===0?-1:i!==void 0&&d===i&&!s(o[i],i)?i:r!==void 0&&!s(o[r],r)?r:u?o.findIndex(function(p){return c(u)===c(p)}):n<0&&!s(o[o.length-1],o.length-1)?o.length-1:n>0&&!s(o[0],0)?0:-1}function Ip(e,t,n){var o=y.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return y.useEffect(function(){if(!e)return De;var i=n.map(function(p){return p.current});function r(){o.current.isTouchEnd=!1,o.current.isMouseDown=!0}function s(p){o.current.isMouseDown=!1,Cn(p.target,i,e)||t()}function c(){o.current.isTouchEnd=!1,o.current.isTouchMove=!1}function u(){o.current.isTouchMove=!0}function d(p){o.current.isTouchEnd=!0,!o.current.isTouchMove&&!Cn(p.target,i,e,!1)&&t()}return e.addEventListener("mousedown",r),e.addEventListener("mouseup",s),e.addEventListener("touchstart",c),e.addEventListener("touchmove",u),e.addEventListener("touchend",d),function(){e.removeEventListener("mousedown",r),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",c),e.removeEventListener("touchmove",u),e.removeEventListener("touchend",d)}},[n,e,t]),o.current}var ts=function(){return De};process.env.NODE_ENV!=="production"&&(ts=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];var i=y.useRef(n.reduce(function(s,c){return s[c]={},s},{}));y.useEffect(function(){Object.keys(i.current).forEach(function(s){var c=i.current[s];if(!Object.keys(c).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var u=c.suppressRefError,d=c.refKey,p=c.elementRef;u||p!=null&&p.current||console.error('downshift: The ref prop "'+d+'" from '+s+" was not applied correctly on your element.")})},[]);var r=y.useCallback(function(s,c,u,d){i.current[s]={suppressRefError:c,refKey:u,elementRef:d}},[]);return r});function wp(e,t,n,o){o===void 0&&(o={});var i=o.document,r=Pn();y.useEffect(function(){if(!(!e||r||!i)){var s=e(t);Lo(s,i)}},n),y.useEffect(function(){return function(){Lo.cancel(),np(i)}},[i])}function xp(e){var t=e.highlightedIndex,n=e.isOpen,o=e.itemRefs,i=e.getItemNodeFromIndex,r=e.menuElement,s=e.scrollIntoView,c=y.useRef(!0);return hp(function(){t<0||!n||!Object.keys(o.current).length||(c.current===!1?c.current=!0:s(i(t),r))},[t]),c}var ns=De;process.env.NODE_ENV!=="production"&&(ns=function(t){var n=t.props,o=t.state,i=y.useRef(n),r=Pn();y.useEffect(function(){r||(Sr(o,i.current,n),i.current=n)},[o,n,r])});function $o(e,t,n){var o;n===void 0&&(n=!0);var i=((o=e.items)==null?void 0:o.length)&&t>=0;return ne({isOpen:!1,highlightedIndex:-1},i&&ne({selectedItem:e.items[t],isOpen:ut(e,"isOpen"),highlightedIndex:ut(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function _p(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Pn(){var e=y.useRef(!0);return y.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function lr(e){var t=ut(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function bp(e){var t=Wt(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var wn={environment:R.shape({addEventListener:R.func.isRequired,removeEventListener:R.func.isRequired,document:R.shape({createElement:R.func.isRequired,getElementById:R.func.isRequired,activeElement:R.any.isRequired,body:R.any.isRequired}).isRequired,Node:R.func.isRequired}),itemToString:R.func,itemToKey:R.func,stateReducer:R.func},rs=ne({},wn,{getA11yStatusMessage:R.func,highlightedIndex:R.number,defaultHighlightedIndex:R.number,initialHighlightedIndex:R.number,isOpen:R.bool,defaultIsOpen:R.bool,initialIsOpen:R.bool,selectedItem:R.any,initialSelectedItem:R.any,defaultSelectedItem:R.any,id:R.string,labelId:R.string,menuId:R.string,getItemId:R.func,toggleButtonId:R.string,onSelectedItemChange:R.func,onHighlightedIndexChange:R.func,onStateChange:R.func,onIsOpenChange:R.func,scrollIntoView:R.func});function Cp(e,t,n){var o=t.type,i=t.props,r;switch(o){case n.ItemMouseMove:r={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:r={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:r={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Jt(i,e,0)};break;case n.FunctionOpenMenu:r={isOpen:!0,highlightedIndex:Jt(i,e,0)};break;case n.FunctionCloseMenu:r={isOpen:!1};break;case n.FunctionSetHighlightedIndex:r={highlightedIndex:i.isItemDisabled(i.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:r={inputValue:t.inputValue};break;case n.FunctionReset:r={highlightedIndex:lr(i),isOpen:ut(i,"isOpen"),selectedItem:ut(i,"selectedItem"),inputValue:ut(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return ne({},e,r)}Tt(Tt({},rs),{items:R.array.isRequired,isItemDisabled:R.func});Tt(Tt({},qt),{isItemDisabled:function(){return!1}});process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;var Nr=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Tr=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Rr=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Ar=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,jr=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Pr=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Dr=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,kr=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Fr=process.env.NODE_ENV!=="production"?"__input_change__":8,On=process.env.NODE_ENV!=="production"?"__input_blur__":9,Mr=process.env.NODE_ENV!=="production"?"__input_click__":10,os=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,is=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,Kr=process.env.NODE_ENV!=="production"?"__item_click__":13,ss=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,as=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,cs=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,us=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,ls=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,Lr=process.env.NODE_ENV!=="production"?"__function_select_item__":19,ds=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,ps=process.env.NODE_ENV!=="production"?"__function_reset__":21,$r=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,fs=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:$r,FunctionCloseMenu:us,FunctionOpenMenu:cs,FunctionReset:ps,FunctionSelectItem:Lr,FunctionSetHighlightedIndex:ls,FunctionSetInputValue:ds,FunctionToggleMenu:as,InputBlur:On,InputChange:Fr,InputClick:Mr,InputKeyDownArrowDown:Nr,InputKeyDownArrowUp:Tr,InputKeyDownEnd:jr,InputKeyDownEnter:kr,InputKeyDownEscape:Rr,InputKeyDownHome:Ar,InputKeyDownPageDown:Dr,InputKeyDownPageUp:Pr,ItemClick:Kr,ItemMouseMove:is,MenuMouseLeave:os,ToggleButtonClick:ss});function Op(e){var t=vp(e),n=t.selectedItem,o=t.inputValue;return o===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(o=e.itemToString(n)),ne({},t,{inputValue:o})}var Sp=ne({},rs,{items:R.array.isRequired,isItemDisabled:R.func,inputValue:R.string,defaultInputValue:R.string,initialInputValue:R.string,inputId:R.string,onInputValueChange:R.func});function Ep(e,t,n,o){var i=y.useRef(),r=yp(e,t,n,o),s=r[0],c=r[1],u=Pn();return y.useEffect(function(){if(bn(t,"selectedItem")){if(!u){var d=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);d&&c({type:$r,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[_n(s,t),c]}var hs=De;process.env.NODE_ENV!=="production"&&(hs=function(t,n){R.checkPropTypes(Sp,t,"prop",n.name)});var Np=ne({},qt,{isItemDisabled:function(){return!1}});function Tp(e,t){var n,o=t.type,i=t.props,r=t.altKey,s;switch(o){case Kr:s={isOpen:ut(i,"isOpen"),highlightedIndex:lr(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case Nr:e.isOpen?s={highlightedIndex:wt(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:r&&e.selectedItem==null?-1:Jt(i,e,1),isOpen:i.items.length>=0};break;case Tr:e.isOpen?r?s=$o(i,e.highlightedIndex):s={highlightedIndex:wt(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:Jt(i,e,-1),isOpen:i.items.length>=0};break;case kr:s=$o(i,e.highlightedIndex);break;case Rr:s=ne({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Pr:s={highlightedIndex:wt(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case Dr:s={highlightedIndex:wt(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case Ar:s={highlightedIndex:Rt(0,!1,i.items,i.isItemDisabled)};break;case jr:s={highlightedIndex:Rt(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case On:s=ne({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=i.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])});break;case Fr:s={isOpen:!0,highlightedIndex:lr(i),inputValue:t.inputValue};break;case Mr:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Jt(i,e,0)};break;case Lr:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case $r:s={inputValue:t.inputValue};break;default:return Cp(e,t,fs)}return ne({},e,s)}var Rp=["onMouseLeave","refKey","ref"],Ap=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],jp=["onClick","onPress","refKey","ref"],Pp=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];Hr.stateChangeTypes=fs;function Hr(e){e===void 0&&(e={}),hs(e,Hr);var t=ne({},Np,e),n=t.items,o=t.scrollIntoView,i=t.environment,r=t.getA11yStatusMessage,s=Ep(Tp,t,Op,_p),c=s[0],u=s[1],d=c.isOpen,p=c.highlightedIndex,h=c.selectedItem,v=c.inputValue,f=y.useRef(null),g=y.useRef({}),x=y.useRef(null),w=y.useRef(null),O=Pn(),I=mp(t),C=y.useRef(),b=es({state:c,props:t}),m=y.useCallback(function(k){return g.current[I.getItemId(k)]},[I]);wp(r,c,[d,p,h,v],i);var j=xp({menuElement:f.current,highlightedIndex:p,isOpen:d,itemRefs:g,scrollIntoView:o,getItemNodeFromIndex:m});ns({props:t,state:c}),y.useEffect(function(){var k=Wt(t,"isOpen");k&&x.current&&x.current.focus()},[]),y.useEffect(function(){O||(C.current=n.length)});var $=Ip(i,y.useCallback(function(){b.current.state.isOpen&&u({type:On,selectItem:!1})},[u,b]),y.useMemo(function(){return[f,w,x]},[f.current,w.current,x.current])),F=ts("getInputProps","getMenuProps");y.useEffect(function(){d||(g.current={})},[d]),y.useEffect(function(){var k;!d||!(i!=null&&i.document)||!(x!=null&&(k=x.current)!=null&&k.focus)||i.document.activeElement!==x.current&&x.current.focus()},[d,i]);var V=y.useMemo(function(){return{ArrowDown:function(D){D.preventDefault(),u({type:Nr,altKey:D.altKey})},ArrowUp:function(D){D.preventDefault(),u({type:Tr,altKey:D.altKey})},Home:function(D){b.current.state.isOpen&&(D.preventDefault(),u({type:Ar}))},End:function(D){b.current.state.isOpen&&(D.preventDefault(),u({type:jr}))},Escape:function(D){var P=b.current.state;(P.isOpen||P.inputValue||P.selectedItem||P.highlightedIndex>-1)&&(D.preventDefault(),u({type:Rr}))},Enter:function(D){var P=b.current.state;!P.isOpen||D.which===229||(D.preventDefault(),u({type:kr}))},PageUp:function(D){b.current.state.isOpen&&(D.preventDefault(),u({type:Pr}))},PageDown:function(D){b.current.state.isOpen&&(D.preventDefault(),u({type:Dr}))}}},[u,b]),B=y.useCallback(function(k){return ne({id:I.labelId,htmlFor:I.inputId},k)},[I]),Z=y.useCallback(function(k,D){var P,T=k===void 0?{}:k,q=T.onMouseLeave,J=T.refKey,U=J===void 0?"ref":J,z=T.ref,W=nt(T,Rp),oe=D===void 0?{}:D,A=oe.suppressRefError,de=A===void 0?!1:A;return F("getMenuProps",de,U,f),ne((P={},P[U]=Et(z,function(L){f.current=L}),P.id=I.menuId,P.role="listbox",P["aria-labelledby"]=W&&W["aria-label"]?void 0:""+I.labelId,P.onMouseLeave=we(q,function(){u({type:os})}),P),W)},[u,F,I]),G=y.useCallback(function(k){var D,P,T=k===void 0?{}:k,q=T.item,J=T.index,U=T.refKey,z=U===void 0?"ref":U,W=T.ref,oe=T.onMouseMove,A=T.onMouseDown,de=T.onClick;T.onPress;var L=T.disabled,Ne=nt(T,Ap);L!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Te=b.current,Ge=Te.props,Ve=Te.state,Ct=gp(q,J,Ge.items,"Pass either item or index to getItemProps!"),Mt=Ct[0],Ue=Ct[1],ft=Ge.isItemDisabled(Mt,Ue),Kt="onClick",Ot=de,We=function(){$.isTouchEnd||Ue===Ve.highlightedIndex||(j.current=!1,u({type:is,index:Ue,disabled:ft}))},Ze=function(){u({type:Kr,index:Ue})},je=function(en){return en.preventDefault()};return ne((D={},D[z]=Et(W,function(Re){Re&&(g.current[I.getItemId(Ue)]=Re)}),D["aria-disabled"]=ft,D["aria-selected"]=Ue===Ve.highlightedIndex,D.id=I.getItemId(Ue),D.role="option",D),!ft&&(P={},P[Kt]=we(Ot,Ze),P),{onMouseMove:we(oe,We),onMouseDown:we(A,je)},Ne)},[u,I,b,$,j]),te=y.useCallback(function(k){var D,P=k===void 0?{}:k,T=P.onClick;P.onPress;var q=P.refKey,J=q===void 0?"ref":q,U=P.ref,z=nt(P,jp),W=b.current.state,oe=function(){u({type:ss})};return ne((D={},D[J]=Et(U,function(A){w.current=A}),D["aria-controls"]=I.menuId,D["aria-expanded"]=W.isOpen,D.id=I.toggleButtonId,D.tabIndex=-1,D),!z.disabled&&ne({},{onClick:we(T,oe)}),z)},[u,b,I]),Q=y.useCallback(function(k,D){var P,T=k===void 0?{}:k,q=T.onKeyDown,J=T.onChange,U=T.onInput,z=T.onBlur;T.onChangeText;var W=T.onClick,oe=T.refKey,A=oe===void 0?"ref":oe,de=T.ref,L=nt(T,Pp),Ne=D===void 0?{}:D,Te=Ne.suppressRefError,Ge=Te===void 0?!1:Te;F("getInputProps",Ge,A,x);var Ve=b.current.state,Ct=function(je){var Re=cr(je);Re&&V[Re]&&V[Re](je)},Mt=function(je){u({type:Fr,inputValue:je.target.value})},Ue=function(je){if(i!=null&&i.document&&Ve.isOpen&&!$.isMouseDown){var Re=je.relatedTarget===null&&i.document.activeElement!==i.document.body;u({type:On,selectItem:!Re})}},ft=function(){u({type:Mr})},Kt="onChange",Ot={};if(!L.disabled){var We;Ot=(We={},We[Kt]=we(J,U,Mt),We.onKeyDown=we(q,Ct),We.onBlur=we(z,Ue),We.onClick=we(W,ft),We)}return ne((P={},P[A]=Et(de,function(Ze){x.current=Ze}),P["aria-activedescendant"]=Ve.isOpen&&Ve.highlightedIndex>-1?I.getItemId(Ve.highlightedIndex):"",P["aria-autocomplete"]="list",P["aria-controls"]=I.menuId,P["aria-expanded"]=Ve.isOpen,P["aria-labelledby"]=L&&L["aria-label"]?void 0:I.labelId,P.autoComplete="off",P.id=I.inputId,P.role="combobox",P.value=Ve.inputValue,P),Ot,L)},[u,I,i,V,b,$,F]),ue=y.useCallback(function(){u({type:as})},[u]),le=y.useCallback(function(){u({type:us})},[u]),re=y.useCallback(function(){u({type:cs})},[u]),Oe=y.useCallback(function(k){u({type:ls,highlightedIndex:k})},[u]),Ee=y.useCallback(function(k){u({type:Lr,selectedItem:k})},[u]),N=y.useCallback(function(k){u({type:ds,inputValue:k})},[u]),K=y.useCallback(function(){u({type:ps})},[u]);return{getItemProps:G,getLabelProps:B,getMenuProps:Z,getInputProps:Q,getToggleButtonProps:te,toggleMenu:ue,openMenu:re,closeMenu:le,setHighlightedIndex:Oe,setInputValue:N,selectItem:Ee,reset:K,highlightedIndex:p,isOpen:d,selectedItem:h,inputValue:v}}wn.stateReducer,wn.itemToKey,wn.environment,R.array,R.array,R.array,R.func,R.number,R.number,R.number,R.func,R.func,R.string,R.string;qt.itemToKey,qt.stateReducer,qt.environment;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;const Dp="_comboboxContainer_12y8e_1",kp="_label_12y8e_8",Fp="_inputContainer_12y8e_12",Mp="_input_12y8e_12",Kp="_toggleButton_12y8e_25",Lp="_menu_12y8e_30",$p="_menuItem_12y8e_43",Hp="_highlighted_12y8e_50",Vp="_selected_12y8e_54",Up="_hidden_12y8e_58",tt={comboboxContainer:Dp,label:kp,inputContainer:Fp,input:Mp,toggleButton:Kp,menu:Lp,menuItem:$p,highlighted:Hp,selected:Vp,hidden:Up};function Bp(e){const t=e.toLowerCase();return function(o){return!e||o.label.toLowerCase().includes(t)||o.value.toLowerCase().includes(t)}}function qp({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:o}){const[i,r]=y.useState(e),s=f=>{r(e.filter(Bp(f)))},{isOpen:c,getToggleButtonProps:u,getMenuProps:d,getInputProps:p,highlightedIndex:h,getItemProps:v}=Hr({items:i,selectedItem:t?e.find(f=>f.value===t):null,itemToString:f=>(f==null?void 0:f.label)||"",onInputValueChange:({inputValue:f})=>s(f),onSelectedItemChange:({selectedItem:f})=>n(f)});return a.jsxs("div",{children:[a.jsx("div",{className:tt.comboboxContainer,children:a.jsxs("div",{className:tt.inputContainer,children:[a.jsx("input",{placeholder:o,className:tt.input,...p()}),a.jsx("button",{"aria-label":"toggle menu",className:tt.toggleButton,type:"button",...u(),children:c?a.jsx(a.Fragment,{children:"↑"}):a.jsx(a.Fragment,{children:"↓"})})]})}),a.jsx("ul",{className:`${tt.menu} ${c&&e.length?"":tt.hidden}`,...d(),children:c&&i.map((f,g)=>a.jsx("li",{className:`${tt.menuItem} ${h===g?tt.highlighted:""} ${t===(f==null?void 0:f.value)?tt.selected:""}`,...v({item:f,index:g}),children:a.jsx("span",{children:f.label})},f.id))})]})}const ms=y.createContext(null);function gs(){const e=y.useContext(ms);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const ys=y.createContext(()=>{});function Wp(){const e=y.useContext(ys);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var vs=Symbol.for("immer-nothing"),Ho=Symbol.for("immer-draftable"),ke=Symbol.for("immer-state"),Jp=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Ae(e,...t){if(process.env.NODE_ENV!=="production"){const n=Jp[e],o=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var At=Object.getPrototypeOf;function jt(e){return!!e&&!!e[ke]}function _t(e){var t;return e?Is(e)||Array.isArray(e)||!!e[Ho]||!!((t=e.constructor)!=null&&t[Ho])||kn(e)||Fn(e):!1}var zp=Object.prototype.constructor.toString();function Is(e){if(!e||typeof e!="object")return!1;const t=At(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===zp}function Sn(e,t){Dn(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,o)=>t(o,n,e))}function Dn(e){const t=e[ke];return t?t.type_:Array.isArray(e)?1:kn(e)?2:Fn(e)?3:0}function dr(e,t){return Dn(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ws(e,t,n){const o=Dn(e);o===2?e.set(t,n):o===3?e.add(n):e[t]=n}function Xp(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function kn(e){return e instanceof Map}function Fn(e){return e instanceof Set}function It(e){return e.copy_||e.base_}function pr(e,t){if(kn(e))return new Map(e);if(Fn(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Is(e);if(t===!0||t==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(e);delete o[ke];let i=Reflect.ownKeys(o);for(let r=0;r<i.length;r++){const s=i[r],c=o[s];c.writable===!1&&(c.writable=!0,c.configurable=!0),(c.get||c.set)&&(o[s]={configurable:!0,writable:!0,enumerable:c.enumerable,value:e[s]})}return Object.create(At(e),o)}else{const o=At(e);if(o!==null&&n)return{...e};const i=Object.create(o);return Object.assign(i,e)}}function Vr(e,t=!1){return Mn(e)||jt(e)||!_t(e)||(Dn(e)>1&&(e.set=e.add=e.clear=e.delete=Yp),Object.freeze(e),t&&Object.entries(e).forEach(([n,o])=>Vr(o,!0))),e}function Yp(){Ae(2)}function Mn(e){return Object.isFrozen(e)}var Gp={};function bt(e){const t=Gp[e];return t||Ae(0,e),t}var Xt;function xs(){return Xt}function Zp(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Vo(e,t){t&&(bt("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fr(e){hr(e),e.drafts_.forEach(Qp),e.drafts_=null}function hr(e){e===Xt&&(Xt=e.parent_)}function Uo(e){return Xt=Zp(Xt,e)}function Qp(e){const t=e[ke];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Bo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[ke].modified_&&(fr(t),Ae(4)),_t(e)&&(e=En(t,e),t.parent_||Nn(t,e)),t.patches_&&bt("Patches").generateReplacementPatches_(n[ke].base_,e,t.patches_,t.inversePatches_)):e=En(t,n,[]),fr(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==vs?e:void 0}function En(e,t,n){if(Mn(t))return t;const o=t[ke];if(!o)return Sn(t,(i,r)=>qo(e,o,t,i,r,n)),t;if(o.scope_!==e)return t;if(!o.modified_)return Nn(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const i=o.copy_;let r=i,s=!1;o.type_===3&&(r=new Set(i),i.clear(),s=!0),Sn(r,(c,u)=>qo(e,o,i,c,u,n,s)),Nn(e,i,!1),n&&e.patches_&&bt("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function qo(e,t,n,o,i,r,s){if(process.env.NODE_ENV!=="production"&&i===n&&Ae(5),jt(i)){const c=r&&t&&t.type_!==3&&!dr(t.assigned_,o)?r.concat(o):void 0,u=En(e,i,c);if(ws(n,o,u),jt(u))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(_t(i)&&!Mn(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;En(e,i),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,o)&&Nn(e,i)}}function Nn(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Vr(t,n)}function ef(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:xs(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=o,r=Ur;n&&(i=[o],r=Yt);const{revoke:s,proxy:c}=Proxy.revocable(i,r);return o.draft_=c,o.revoke_=s,c}var Ur={get(e,t){if(t===ke)return e;const n=It(e);if(!dr(n,t))return tf(e,n,t);const o=n[t];return e.finalized_||!_t(o)?o:o===tr(e.base_,t)?(nr(e),e.copy_[t]=gr(o,e)):o},has(e,t){return t in It(e)},ownKeys(e){return Reflect.ownKeys(It(e))},set(e,t,n){const o=_s(It(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const i=tr(It(e),t),r=i==null?void 0:i[ke];if(r&&r.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Xp(n,i)&&(n!==void 0||dr(e.base_,t)))return!0;nr(e),mr(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return tr(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,nr(e),mr(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=It(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:n[t]}},defineProperty(){Ae(11)},getPrototypeOf(e){return At(e.base_)},setPrototypeOf(){Ae(12)}},Yt={};Sn(Ur,(e,t)=>{Yt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Yt.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ae(13),Yt.set.call(this,e,t,void 0)};Yt.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ae(14),Ur.set.call(this,e[0],t,n,e[0])};function tr(e,t){const n=e[ke];return(n?It(n):e)[t]}function tf(e,t,n){var i;const o=_s(t,n);return o?"value"in o?o.value:(i=o.get)==null?void 0:i.call(e.draft_):void 0}function _s(e,t){if(!(t in e))return;let n=At(e);for(;n;){const o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=At(n)}}function mr(e){e.modified_||(e.modified_=!0,e.parent_&&mr(e.parent_))}function nr(e){e.copy_||(e.copy_=pr(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var nf=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,o)=>{if(typeof t=="function"&&typeof n!="function"){const r=n;n=t;const s=this;return function(u=r,...d){return s.produce(u,p=>n.call(this,p,...d))}}typeof n!="function"&&Ae(6),o!==void 0&&typeof o!="function"&&Ae(7);let i;if(_t(t)){const r=Uo(this),s=gr(t,void 0);let c=!0;try{i=n(s),c=!1}finally{c?fr(r):hr(r)}return Vo(r,o),Bo(i,r)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===vs&&(i=void 0),this.autoFreeze_&&Vr(i,!0),o){const r=[],s=[];bt("Patches").generateReplacementPatches_(t,i,r,s),o(r,s)}return i}else Ae(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...c)=>this.produceWithPatches(s,u=>t(u,...c));let o,i;return[this.produce(t,n,(s,c)=>{o=s,i=c}),o,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){_t(e)||Ae(8),jt(e)&&(e=rf(e));const t=Uo(this),n=gr(e,void 0);return n[ke].isManual_=!0,hr(t),n}finishDraft(e,t){const n=e&&e[ke];(!n||!n.isManual_)&&Ae(9);const{scope_:o}=n;return Vo(o,t),Bo(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const o=bt("Patches").applyPatches_;return jt(e)?o(e,t):this.produce(e,i=>o(i,t))}};function gr(e,t){const n=kn(e)?bt("MapSet").proxyMap_(e,t):Fn(e)?bt("MapSet").proxySet_(e,t):ef(e,t);return(t?t.scope_:xs()).drafts_.push(n),n}function rf(e){return jt(e)||Ae(10,e),bs(e)}function bs(e){if(!_t(e)||Mn(e))return e;const t=e[ke];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=pr(e,t.scope_.immer_.useStrictShallowCopy_)}else n=pr(e,!0);return Sn(n,(o,i)=>{ws(n,o,bs(i))}),t&&(t.finalized_=!1),n}var Fe=new nf,Bt=Fe.produce;Fe.produceWithPatches.bind(Fe);Fe.setAutoFreeze.bind(Fe);Fe.setUseStrictShallowCopy.bind(Fe);Fe.applyPatches.bind(Fe);Fe.createDraft.bind(Fe);Fe.finishDraft.bind(Fe);const Cs=y.createContext(void 0),of={};function Br(){const e=y.useContext(Cs);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function sf({children:e}){const{installation:t}=Ye(),{hydratedRevision:n,loading:o}=Zt(),[i,r]=y.useState(of),s=t==null?void 0:t.config;y.useEffect(()=>{n!=null&&n.content&&!o&&s&&!(Object.entries(i).length>0)&&yd(n,s,r)},[n,o,s,i]);const c=y.useCallback((f,g)=>{r(x=>Bt(x,w=>{w[f]=Bt(w[f],g)}))},[r]),u=y.useCallback((f,g)=>{r(x=>Bt(x,w=>{w[f]=g}))},[r]),d=y.useCallback(()=>{r(Bt(f=>{const g=f.other.write;g&&(g.isWriteModified=!1)}))},[r]),p=y.useCallback(f=>{r(Bt(g=>{var w;const x=(w=g[f])==null?void 0:w.read;x&&(x.isOptionalFieldsModified=!1,x.isRequiredMapFieldsModified=!1)}))},[r]),h=y.useCallback(f=>{f===xt?d():p(f)},[p,d]),v=y.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:r,setConfigureState:c,resetConfigureState:u,resetPendingConfigurationState:h}),[i,u,h,c]);return a.jsx(Cs.Provider,{value:v,children:e})}const pt=()=>{const{appName:e}=Ie(),{objectConfigurationsState:t,setConfigureState:n}=Br(),{selectedObjectName:o}=gs(),i=Oi(o||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:o}};function af(e,t,n){var i;const o=((i=e==null?void 0:e.read)==null?void 0:i.selectedFieldMappings)||{};if(o[t]=n,e!=null&&e.read){const r=e.read.savedConfig.requiredMapFields,c=!_r(r,o);e.read.isRequiredMapFieldsModified=c}}function Os(e,t,n,o){t(e,i=>af(i,n,o))}function cf({field:e,onSelectChange:t,allFields:n}){var f;const{configureState:o,selectedObjectName:i,setConfigureState:r}=pt(),[s,c]=y.useState(!0),u=(f=o==null?void 0:o.read)==null?void 0:f.selectedFieldMappings,d=u==null?void 0:u[e.mapToName];y.useEffect(()=>{e._default&&!d&&i&&o&&Os(i,r,e.mapToName,e._default),c(!1)},[e,r,i,d,o]);const p=y.useMemo(()=>n==null?void 0:n.map(g=>a.jsx("option",{value:g.fieldName,children:g.displayName},g.fieldName)),[n]),h=y.useMemo(()=>n.map(g=>({id:g.fieldName,label:g.displayName,value:g.fieldName})),[n]),v=ve?a.jsx(qp,{items:h,selectedValue:d||null,onSelectedItemChange:g=>{t({target:{name:e.mapToName,value:g==null?void 0:g.value}})},placeholder:"Please select one"}):a.jsx(S.Select,{name:e.mapToName,variant:"flushed",value:d||void 0,onChange:t,placeholder:d?void 0:"Please select one",disabled:s,children:p});return a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[a.jsx("h3",{style:{fontWeight:500},children:e.mapToDisplayName}),a.jsx("p",{style:{paddingBottom:"1rem"},children:e==null?void 0:e.prompt}),v]},e.mapToName)}const uf="_divider_j6suu_1",Wo={divider:uf};function qr({className:e,style:t}){return ve?a.jsx("hr",{className:e?`${Wo.divider} ${e}`:Wo.divider,style:t}):a.jsx(S.Divider,{className:e,style:t})}const lf=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-text-secondary").trim()||"#737373";function Ft({string:e}){return a.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"2rem",paddingBottom:"1rem"},children:[a.jsx("h3",{style:{color:lf,fontSize:"1rem",fontWeight:"500"},children:e}),a.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:a.jsx(qr,{style:{marginLeft:"1rem"}})})]})}function df(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=pt(),{isError:o,removeError:i}=dt(),r=c=>{const{value:u,name:d}=c.target;u&&(e&&Os(e,n,d,u),o(me.MAPPING,d)&&i(me.MAPPING,d))},s=y.useMemo(()=>{var c,u;return((u=(c=t==null?void 0:t.read)==null?void 0:c.requiredMapFields)==null?void 0:u.filter(Xe))||[]},[t]);return s.length?a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:"Map the following fields (required)"}),a.jsx("div",{style:{display:"flex",gap:"2rem",flexDirection:"column"},children:s.map(c=>{var u;return a.jsxs(S.FormControl,{isInvalid:o(me.MAPPING,c.mapToName),children:[a.jsx(cf,{allFields:((u=t.read)==null?void 0:u.allFields)||[],field:c,onSelectChange:r}),a.jsx(S.FormErrorMessage,{children:" * required"})]},c.mapToName)})})]}):null}function pf(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Ss(...e){return t=>e.forEach(n=>pf(n,t))}function Es(...e){return X.useCallback(Ss(...e),e)}function ff(e,t=[]){let n=[];function o(r,s){const c=X.createContext(s),u=n.length;n=[...n,s];const d=h=>{var O;const{scope:v,children:f,...g}=h,x=((O=v==null?void 0:v[e])==null?void 0:O[u])||c,w=X.useMemo(()=>g,Object.values(g));return a.jsx(x.Provider,{value:w,children:f})};d.displayName=r+"Provider";function p(h,v){var x;const f=((x=v==null?void 0:v[e])==null?void 0:x[u])||c,g=X.useContext(f);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${h}\` must be used within \`${r}\``)}return[d,p]}const i=()=>{const r=n.map(s=>X.createContext(s));return function(c){const u=(c==null?void 0:c[e])||r;return X.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return i.scopeName=e,[o,hf(i,...t)]}function hf(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(r){const s=o.reduce((c,{useScope:u,scopeName:d})=>{const h=u(r)[`__scope${d}`];return{...c,...h}},{});return X.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Jo(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function Ns(e){const t=X.useRef(e);return X.useEffect(()=>{t.current=e}),X.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function mf({prop:e,defaultProp:t,onChange:n=()=>{}}){const[o,i]=gf({defaultProp:t,onChange:n}),r=e!==void 0,s=r?e:o,c=Ns(n),u=X.useCallback(d=>{if(r){const h=typeof d=="function"?d(e):d;h!==e&&c(h)}else i(d)},[r,e,i,c]);return[s,u]}function gf({defaultProp:e,onChange:t}){const n=X.useState(e),[o]=n,i=X.useRef(o),r=Ns(t);return X.useEffect(()=>{i.current!==o&&(r(o),i.current=o)},[o,i,r]),n}function yf(e){const t=X.useRef({value:e,previous:e});return X.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var yr=globalThis!=null&&globalThis.document?X.useLayoutEffect:()=>{};function vf(e){const[t,n]=X.useState(void 0);return yr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const r=i[0];let s,c;if("borderBoxSize"in r){const u=r.borderBoxSize,d=Array.isArray(u)?u[0]:u;s=d.inlineSize,c=d.blockSize}else s=e.offsetWidth,c=e.offsetHeight;n({width:s,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}function If(e,t){return X.useReducer((n,o)=>t[n][o]??n,e)}var Ts=e=>{const{present:t,children:n}=e,o=wf(t),i=typeof n=="function"?n({present:o.isPresent}):X.Children.only(n),r=Es(o.ref,xf(i));return typeof n=="function"||o.isPresent?X.cloneElement(i,{ref:r}):null};Ts.displayName="Presence";function wf(e){const[t,n]=X.useState(),o=X.useRef({}),i=X.useRef(e),r=X.useRef("none"),s=e?"mounted":"unmounted",[c,u]=If(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return X.useEffect(()=>{const d=mn(o.current);r.current=c==="mounted"?d:"none"},[c]),yr(()=>{const d=o.current,p=i.current;if(p!==e){const v=r.current,f=mn(d);e?u("MOUNT"):f==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(p&&v!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),yr(()=>{if(t){let d;const p=t.ownerDocument.defaultView??window,h=f=>{const x=mn(o.current).includes(f.animationName);if(f.target===t&&x&&(u("ANIMATION_END"),!i.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",d=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},v=f=>{f.target===t&&(r.current=mn(o.current))};return t.addEventListener("animationstart",v),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{p.clearTimeout(d),t.removeEventListener("animationstart",v),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:X.useCallback(d=>{d&&(o.current=getComputedStyle(d)),n(d)},[])}}function mn(e){return(e==null?void 0:e.animationName)||"none"}function xf(e){var o,i;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Rs=X.forwardRef((e,t)=>{const{children:n,...o}=e,i=X.Children.toArray(n),r=i.find(bf);if(r){const s=r.props.children,c=i.map(u=>u===r?X.Children.count(s)>1?X.Children.only(null):X.isValidElement(s)?s.props.children:null:u);return a.jsx(vr,{...o,ref:t,children:X.isValidElement(s)?X.cloneElement(s,void 0,c):null})}return a.jsx(vr,{...o,ref:t,children:n})});Rs.displayName="Slot";var vr=X.forwardRef((e,t)=>{const{children:n,...o}=e;if(X.isValidElement(n)){const i=Of(n);return X.cloneElement(n,{...Cf(o,n.props),ref:t?Ss(t,i):i})}return X.Children.count(n)>1?X.Children.only(null):null});vr.displayName="SlotClone";var _f=({children:e})=>a.jsx(a.Fragment,{children:e});function bf(e){return X.isValidElement(e)&&e.type===_f}function Cf(e,t){const n={...t};for(const o in t){const i=e[o],r=t[o];/^on[A-Z]/.test(o)?i&&r?n[o]=(...c)=>{r(...c),i(...c)}:i&&(n[o]=i):o==="style"?n[o]={...i,...r}:o==="className"&&(n[o]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}function Of(e){var o,i;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Sf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],As=Sf.reduce((e,t)=>{const n=X.forwardRef((o,i)=>{const{asChild:r,...s}=o,c=r?Rs:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Wr="Checkbox",[Ef,Sm]=ff(Wr),[Nf,Tf]=Ef(Wr),js=X.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:o,checked:i,defaultChecked:r,required:s,disabled:c,value:u="on",onCheckedChange:d,form:p,...h}=e,[v,f]=X.useState(null),g=Es(t,b=>f(b)),x=X.useRef(!1),w=v?p||!!v.closest("form"):!0,[O=!1,I]=mf({prop:i,defaultProp:r,onChange:d}),C=X.useRef(O);return X.useEffect(()=>{const b=v==null?void 0:v.form;if(b){const m=()=>I(C.current);return b.addEventListener("reset",m),()=>b.removeEventListener("reset",m)}},[v,I]),a.jsxs(Nf,{scope:n,state:O,disabled:c,children:[a.jsx(As.button,{type:"button",role:"checkbox","aria-checked":lt(O)?"mixed":O,"aria-required":s,"data-state":ks(O),"data-disabled":c?"":void 0,disabled:c,value:u,...h,ref:g,onKeyDown:Jo(e.onKeyDown,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:Jo(e.onClick,b=>{I(m=>lt(m)?!0:!m),w&&(x.current=b.isPropagationStopped(),x.current||b.stopPropagation())})}),w&&a.jsx(Rf,{control:v,bubbles:!x.current,name:o,value:u,checked:O,required:s,disabled:c,form:p,style:{transform:"translateX(-100%)"},defaultChecked:lt(r)?!1:r})]})});js.displayName=Wr;var Ps="CheckboxIndicator",Ds=X.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:o,...i}=e,r=Tf(Ps,n);return a.jsx(Ts,{present:o||lt(r.state)||r.state===!0,children:a.jsx(As.span,{"data-state":ks(r.state),"data-disabled":r.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Ds.displayName=Ps;var Rf=e=>{const{control:t,checked:n,bubbles:o=!0,defaultChecked:i,...r}=e,s=X.useRef(null),c=yf(n),u=vf(t);X.useEffect(()=>{const p=s.current,h=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==n&&f){const g=new Event("click",{bubbles:o});p.indeterminate=lt(n),f.call(p,lt(n)?!1:n),p.dispatchEvent(g)}},[c,n,o]);const d=X.useRef(lt(n)?!1:n);return a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??d.current,...r,tabIndex:-1,ref:s,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function lt(e){return e==="indeterminate"}function ks(e){return lt(e)?"indeterminate":e?"checked":"unchecked"}var Fs=js,Ms=Ds;function Ks(e,t){if(e==null)return{};var n={},o=Object.keys(e),i,r;for(r=0;r<o.length;r++)i=o[r],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Af=["color"],Ls=y.forwardRef(function(e,t){var n=e.color,o=n===void 0?"currentColor":n,i=Ks(e,Af);return y.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),y.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))}),jf=["color"],Pf=y.forwardRef(function(e,t){var n=e.color,o=n===void 0?"currentColor":n,i=Ks(e,jf);return y.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),y.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))});const Df="_checkboxGroupContainer_j54z7_1",kf="_stack_j54z7_6",Ff="_selectAllContainer_j54z7_11",Mf="_fieldContainer_j54z7_18",Kf="_checkbox_j54z7_1",Pt={checkboxGroupContainer:Df,stack:kf,selectAllContainer:Ff,fieldContainer:Mf,checkbox:Kf};function $s({id:e,isChecked:t,label:n,onCheckedChange:o}){return a.jsxs("div",{className:Pt.fieldContainer,children:[a.jsx(Fs,{className:Pt.checkbox,id:e,onCheckedChange:o,checked:t,children:a.jsx(Ms,{children:a.jsx(Ls,{})})}),a.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Hs({id:e,isChecked:t,label:n,onCheckedChange:o,isIndeterminate:i}){return a.jsxs("div",{className:Pt.selectAllContainer,children:[a.jsx(Fs,{className:Pt.checkbox,id:e,onCheckedChange:o,children:a.jsxs(Ms,{children:[i&&a.jsx(Pf,{}),t===!0&&a.jsx(Ls,{})]})}),a.jsx("label",{htmlFor:e,children:n})]})}function Vs({children:e}){return a.jsx("div",{className:Pt.checkboxGroupContainer,children:e})}function Us({children:e}){return a.jsx("div",{className:Pt.stack,children:e})}function Lf(e,t,n){var i,r;const o=((i=e==null?void 0:e.read)==null?void 0:i.selectedOptionalFields)||{};if(o[t]=n,n||delete o[t],(r=e.read)!=null&&r.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,u=!_r(s,o);e.read.isOptionalFieldsModified=u}else console.warn("read.savedConfig.optionalFields is undefined")}function Tn(e,t,n,o){t(e,i=>Lf(i,n,o))}function $f(){var h,v;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:o}=pt(),i=(h=t==null?void 0:t.read)==null?void 0:h.selectedOptionalFields,r=(f,g)=>{f!=="indeterminate"&&o&&t&&Tn(o,n,g,f)},s=(v=t==null?void 0:t.read)==null?void 0:v.optionalFields,c=f=>{o&&s&&s.forEach(g=>{Xe(g)||Tn(o,n,g.fieldName,f)})},u=!!(s&&s.length>0),d=Object.keys(i||{}).length===(s==null?void 0:s.length),p=!d&&Object.keys(i||{}).length>0;return u&&a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`${e} reads the following optional fields`}),a.jsxs(Vs,{children:[((s==null?void 0:s.length)||0)>=2&&a.jsx(Hs,{id:"select-all-fields",isChecked:d,label:"Select all",onCheckedChange:c,isIndeterminate:p}),a.jsx(Us,{children:s.map(f=>Xe(f)?null:a.jsx($s,{id:f.fieldName,isChecked:!!(i!=null&&i[f==null?void 0:f.fieldName]),label:f.displayName,onCheckedChange:g=>r(g,f.fieldName)},f.fieldName))})]})]})}function Hf(){var h,v;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:o}=pt(),i=(h=t==null?void 0:t.read)==null?void 0:h.selectedOptionalFields,r=f=>{const{name:g,checked:x}=f.target;o&&t&&Tn(o,n,g,x)},s=(v=t==null?void 0:t.read)==null?void 0:v.optionalFields,c=f=>{const{checked:g}=f.target;o&&s&&s.forEach(x=>{Xe(x)||Tn(o,n,x.fieldName,g)})},u=!!(s&&s.length>0),d=Object.keys(i||{}).length===(s==null?void 0:s.length),p=!d&&Object.keys(i||{}).length>0;return u&&a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`${e} reads the following optional fields`}),a.jsxs(S.Stack,{marginBottom:10,maxHeight:300,overflowY:"scroll",border:"2px solid #EFEFEF",borderRadius:8,gap:0,children:[((s==null?void 0:s.length)||0)>=2&&a.jsx(S.Box,{backgroundColor:"gray.50",paddingX:4,paddingY:2,children:a.jsx(S.Checkbox,{name:"selectAll",id:"selectAll",onChange:c,isIndeterminate:p,isChecked:d,children:"Select all"})}),s.map(f=>Xe(f)?null:a.jsx(S.Box,{paddingX:4,paddingY:2,borderBottom:"1px",borderColor:"gray.100",children:a.jsx(S.Checkbox,{name:f.fieldName,id:f.fieldName,isChecked:!!(i!=null&&i[f==null?void 0:f.fieldName]),onChange:r,children:a.jsx("p",{style:{overflowWrap:"anywhere"},children:f.displayName})})},f.fieldName))]})]})}function Vf(){return ve?a.jsx($f,{}):a.jsx(Hf,{})}const Uf=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-badge").trim()||"#e5e5e5",Bf=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-badge-text").trim()||"#404040",qf={color:Bf,backgroundColor:Uf,borderRadius:"4px",display:"inline-block",fontSize:"0.75rem",fontWeight:500,lineHeight:"1.25",padding:"0.25rem 0.5rem"};function Wf({children:e,style:t,...n}){return a.jsx("span",{style:{...qf,...t},...n,children:e})}function Jf(){var o,i,r;const{configureState:e,selectedObjectName:t}=pt(),{appName:n}=Ie();return a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`${n} reads the following ${t} fields`}),a.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:"2rem"},children:(i=(o=e==null?void 0:e.read)==null?void 0:o.requiredFields)!=null&&i.length?(r=e.read)==null?void 0:r.requiredFields.map(s=>Xe(s)?null:a.jsx(Wf,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function zf(){return a.jsxs(a.Fragment,{children:[a.jsx(Jf,{}),a.jsx(df,{}),a.jsx(Vf,{})]})}function Xf(e,t,n){var o,i,r;if(((o=e==null?void 0:e.write)==null?void 0:o.selectedNonConfigurableWriteFields)===null&&(e.write.selectedNonConfigurableWriteFields={}),e!=null&&e.write){const s=e.write.selectedNonConfigurableWriteFields;if(s[t]=n,n||delete s[t],(r=(i=e==null?void 0:e.write)==null?void 0:i.savedConfig)!=null&&r.selectedNonConfigurableWriteFields){const c=e.write.savedConfig.selectedNonConfigurableWriteFields,d=!_r(c,s);e.write.isWriteModified=d}}}function Rn(e,t,n,o){t(e,i=>{Xf(i,n,o)})}function Yf(){var h,v,f,g;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:o}=pt(),i=(h=n==null?void 0:n.write)==null?void 0:h.selectedNonConfigurableWriteFields,r=(v=n==null?void 0:n.write)==null?void 0:v.writeObjects,s=(x,w)=>{x!=="indeterminate"&&t&&n&&Rn(t,o,w,x)},c=x=>{var w,O;t&&n&&((O=(w=n==null?void 0:n.write)==null?void 0:w.writeObjects)==null||O.forEach(I=>{Rn(t,o,I.objectName,x)}))},u=!!r,d=Object.keys(i||{}).length===((g=(f=n==null?void 0:n.write)==null?void 0:f.writeObjects)==null?void 0:g.length),p=!d&&Object.keys(i||{}).length>0;return u&&a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`Allow ${e} to write to these object`}),a.jsxs(Vs,{children:[((r==null?void 0:r.length)||0)>=2&&a.jsx(Hs,{id:"select-all-fields",onCheckedChange:c,isIndeterminate:p,isChecked:d,label:"Select all"}),a.jsx(Us,{children:r.map(x=>a.jsx($s,{id:x.objectName,onCheckedChange:w=>s(w,x.objectName),isChecked:!!(i!=null&&i[x.objectName]),label:x.displayName},x.objectName))})]})]})}function Gf(){var h,v,f,g;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:o}=pt(),i=(h=n==null?void 0:n.write)==null?void 0:h.selectedNonConfigurableWriteFields,r=(v=n==null?void 0:n.write)==null?void 0:v.writeObjects,s=x=>{const{name:w,checked:O}=x.target;t&&n&&Rn(t,o,w,O)},c=x=>{var O,I;const{checked:w}=x.target;t&&n&&((I=(O=n==null?void 0:n.write)==null?void 0:O.writeObjects)==null||I.forEach(C=>{Rn(t,o,C.objectName,w)}))},u=!!r,d=Object.keys(i||{}).length===((g=(f=n==null?void 0:n.write)==null?void 0:f.writeObjects)==null?void 0:g.length),p=!d&&Object.keys(i||{}).length>0;return u&&a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`Allow ${e} to write to these object`}),a.jsxs(S.Stack,{marginBottom:10,maxHeight:300,overflowY:"scroll",border:"2px solid #EFEFEF",borderRadius:8,gap:0,children:[((r==null?void 0:r.length)||0)>=2&&a.jsx(S.Box,{backgroundColor:"gray.50",paddingX:4,paddingY:2,children:a.jsx(S.Checkbox,{name:"selectAll",id:"selectAll",onChange:c,isIndeterminate:p,isChecked:d,children:"Select all"})}),r.map(x=>a.jsx(S.Box,{display:"flex",alignItems:"center",borderBottom:"1px",borderColor:"gray.100",paddingX:4,paddingY:2,children:a.jsx(S.Checkbox,{name:x.objectName,id:x.objectName,onChange:s,isChecked:!!(i!=null&&i[x.objectName]),children:a.jsx("p",{style:{overflowWrap:"anywhere"},children:x.displayName})})},x.objectName))]})]})}function Zf(){return ve?a.jsx(Yf,{}):a.jsx(Gf,{})}function Qf(){const e=xe(),{projectId:t,appName:n}=Ie(),{integrationId:o,installation:i,resetInstallations:r,setIntegrationDeleted:s,onUninstallSuccess:c}=Ye(),[u,d]=y.useState(!1),p=!t||!o||!(i!=null&&i.id)||u,h=async()=>{if(!p){d(!0),console.warn("uninstalling installation",{projectId:t,integrationId:o,installationId:i.id});try{await fe().installationApi.deleteInstallation({projectIdOrName:t,integrationId:o,installationId:i.id},{headers:{"X-Api-Key":e,"Content-Type":"application/json"}}),console.warn("successfully uninstalled installation: ",i.id),c==null||c(i==null?void 0:i.id),r(),s()}catch(x){console.error("Error uninstalling installation."),Ce(x)}finally{d(!1)}}},v=u?"Uninstalling...":"Yes, uninstall",f=i!=null&&i.id?`Once you uninstall this integration, all your configuration will be lost, and "${n}" may stop working.`:"You've successfully uninstalled the integration.",g=ve?a.jsx(He,{type:"button",onClick:h,disabled:p,variant:"danger",children:v}):a.jsx(S.Button,{onClick:h,variant:"warning",isDisabled:p,children:v});return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[a.jsx("p",{children:f}),(i==null?void 0:i.id)&&g]})}const eh=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-neutral-100").trim()||"#f5f5f5",th=getComputedStyle(document.documentElement).getPropertyValue("--amp-shadows-sm").trim()||"0 1px 2px 0 rgba(0, 0, 0, 0.05)";function Bs({onSave:e,onReset:t,isLoading:n,isCreateMode:o=!1,errorMsg:i}){var j,$,F;const{installation:r}=Ye(),{hydratedRevision:s,loading:c}=Zt(),{configureState:u,selectedObjectName:d}=pt(),p=r==null?void 0:r.config,h=p&&d&&!!yi(p,d)||!1,v=((j=u==null?void 0:u.read)==null?void 0:j.isOptionalFieldsModified)||(($=u==null?void 0:u.read)==null?void 0:$.isRequiredMapFieldsModified),f=(F=u==null?void 0:u.write)==null?void 0:F.isWriteModified,O=c||n||!u||!d||!(v||f||o||d!==xt&&!h),I=d===xt,C=d===Ti,b=ve?a.jsx(He,{type:"submit",disabled:O,children:o?"Install":"Save"}):a.jsx(S.Button,{type:"submit",variant:"primary",isDisabled:O,children:o?"Install":"Save"}),m=ve?a.jsx(He,{type:"button",onClick:t,disabled:O,variant:"ghost",children:"Reset"}):a.jsx(S.Button,{isDisabled:O,onClick:t,children:"Reset"});return n?a.jsx(qe,{}):a.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[a.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:"1rem",marginBottom:"2rem"},children:[b,m]}),a.jsxs(Dt,{style:{padding:"2rem",minHeight:"300px",backgroundColor:"white",borderColor:eh,boxShadow:th},children:[i&&a.jsx(Ei,{children:typeof i=="string"?i:"Installation Failed."}),c&&a.jsx(qe,{}),s&&!C&&!I&&a.jsx(zf,{}),s&&!C&&I&&a.jsx(Zf,{}),!c&&C&&a.jsx(Qf,{})]})]})}const qs=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:o,onInstallSuccess:i,onUpdateSuccess:r}=Ye(),{hydratedRevision:s,loading:c}=Zt(),{selectedObjectName:u}=gs(),{selectedConnection:d}=kt(),p=xe(),{projectId:h}=Ie(),{resetBoundary:v,setErrors:f,setError:g,getError:x}=dt(),{resetConfigureState:w,objectConfigurationsState:O,resetPendingConfigurationState:I}=Br(),C=Oi(u||"",O),{onNextIncompleteTab:b}=Wp(),m=y.useCallback(()=>{v(me.INSTALLATION_MUTATION)},[v]),j=y.useCallback(F=>F?V=>{g(me.INSTALLATION_MUTATION,F,V)}:V=>{console.error("objectName is required to set installation error: ",V)},[g]),$=y.useCallback(F=>F?x(me.INSTALLATION_MUTATION,F):"",[x]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:o,hydratedRevision:s,loading:c,selectedObjectName:u,selectedConnection:d,apiKey:p,projectId:h,resetBoundary:v,setErrors:f,setMutateInstallationError:j,getMutateInstallationError:$,resetMutateInstallationErrorState:m,resetConfigureState:w,objectConfigurationsState:O,resetPendingConfigurationState:I,configureState:C,onInstallSuccess:i,onUpdateSuccess:r,onNextIncompleteTab:b}},nh=void 0;function rh(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:o,hydratedRevision:i,loading:r,selectedObjectName:s,selectedConnection:c,apiKey:u,projectId:d,resetBoundary:p,setErrors:h,setMutateInstallationError:v,getMutateInstallationError:f,resetMutateInstallationErrorState:g,resetConfigureState:x,objectConfigurationsState:w,resetPendingConfigurationState:O,configureState:I,onInstallSuccess:C,onNextIncompleteTab:b}=qs(),[m,j]=y.useState(!1),$=s===xt,F=f(s),V=y.useCallback(()=>{p(me.MAPPING),i!=null&&i.content&&!r&&s&&_i(i,nh,s,x)},[p,i,r,s,x]);y.useEffect(()=>{!I&&(i!=null&&i.content)&&!r&&V()},[I,w,i,r,V]);const B=()=>{g();const{requiredMapFields:te,selectedFieldMappings:Q}=(I==null?void 0:I.read)||{},{errorList:ue}=wi(te,Q,h);ue.length>0||(s&&(c!=null&&c.id)&&u&&d&&e&&t&&n&&i?(j(!0),wd(d,e,t,n,c.id,s,u,i,I,v(s),o,C).finally(()=>{j(!1),O(s),b()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},Z=()=>{g(),s&&(c!=null&&c.id)&&u&&d&&e&&t&&n&&i?(j(!0),bd(d,e,t,n,c.id,u,i,I,v(s),o,C).finally(()=>{j(!1),O(s),b()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},G=te=>{te.preventDefault(),$?Z():B()};return a.jsx(Bs,{errorMsg:F,isCreateMode:!0,isLoading:m,onSave:G,onReset:V})}function oh({updateConfig:e,projectId:t,integrationId:n,installationId:o,apiKey:i,selectedObjectName:r,setInstallation:s,onUpdateSuccess:c,setError:u}){const d={projectIdOrName:t,installationId:o,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${r}`],installation:{config:e}}};return fe().installationApi.updateInstallation(d,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}}).then(p=>{s(p),c==null||c(p.id,p.config)}).catch(p=>{Ce(p,u)})}const ih=(e,t,n,o,i,r)=>{const s=bi(e),c=Ci(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:o,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:c,backfill:r}}}}};return jn(i)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},sh=(e,t,n,o,i,r,s,c,u,d,p)=>{const h=ih(r,o||"",c,c.schedule,u,c.backfill);return h?oh({updateConfig:h,projectId:e,integrationId:t,installationId:n,apiKey:i,selectedObjectName:o,setError:d,setInstallation:s,onUpdateSuccess:p}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},ah=(e,t)=>{const o={content:{write:{objects:Si(e)}}};return jn(t)&&(o.content||(o.content={}),o.content.proxy={enabled:!0}),o},ch=(e,t,n,o,i,r,s,c,u)=>{const d=ah(i,r);if(!d)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const p={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:d}}};return fe().installationApi.updateInstallation(p,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(h=>{c(h),u==null||u(h.id,h.config)}).catch(h=>{Ce(h,s)})};function uh({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:o,loading:i,selectedObjectName:r,apiKey:s,projectId:c,resetBoundary:u,setErrors:d,setMutateInstallationError:p,getMutateInstallationError:h,resetConfigureState:v,resetPendingConfigurationState:f,configureState:g,onUpdateSuccess:x,onNextIncompleteTab:w}=qs(),[O,I]=y.useState(!1),C=r===xt,b=h(r),{config:m}=e,j=y.useCallback(()=>{u(me.MAPPING),o!=null&&o.content&&!i&&r&&_i(o,m,r,v)},[u,o,i,r,m,v]);y.useEffect(()=>{g||j()},[g,j]),y.useEffect(()=>{e&&j()},[e,j]);const $=y.useMemo(()=>{var G,te,Q;return(Q=(te=(G=o==null?void 0:o.content)==null?void 0:G.read)==null?void 0:te.objects)==null?void 0:Q.find(ue=>(ue==null?void 0:ue.objectName)===r)},[o,r]),F=()=>{const{requiredMapFields:Z,selectedFieldMappings:G}=(g==null?void 0:g.read)||{},{errorList:te}=wi(Z,G,d);te.length>0||(o&&e&&r&&s&&c&&$?(I(!0),sh(c,t.id,e.id,r,s,g,n,$,o,p(r),x).finally(()=>{I(!1),f(r),w()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},V=()=>{e&&r&&s&&c&&o?(I(!0),ch(c,t.id,e.id,s,g,o,p(r),n,x).finally(()=>{I(!1),f(r),w()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},B=Z=>{Z.preventDefault(),C?V():F()};return a.jsx(Bs,{errorMsg:b,onSave:B,onReset:j,isLoading:O})}function lh(){const{integrationObj:e,installation:t}=Ye();return e?t&&e?a.jsx(uh,{installation:t,integrationObj:e}):a.jsx(rh,{}):a.jsx(ot,{message:"We can't load the integration"})}function dh(){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("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),a.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Jr({text:e,children:t}){return a.jsx(Gt,{children:a.jsxs(Dt,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"},children:[a.jsx(dh,{}),a.jsx("p",{children:e}),t]})})}const ph=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function fh({projectId:e,integrationId:t,groupRef:n,consumerRef:o,connectionId:i,apiKey:r,hydratedRevision:s,setError:c,setInstallation:u,onInstallSuccess:d}){const p=ph(s,o);return p?br({createConfig:p,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:r,setError:c,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function hh({provider:e}){const t=`You have successfully installed your ${it(e)} integration.`;return a.jsx(Jr,{text:t})}const mh=e=>{const{read:t,write:n,proxy:o}=(e==null?void 0:e.content)??{};return!t&&!n&&(o==null?void 0:o.enabled)||!1};function gh({children:e,resetComponent:t}){var b;const{projectId:n}=Ie(),o=xe(),{hydratedRevision:i,loading:r}=Zt(),{integrationObj:s,installation:c,groupRef:u,consumerRef:d,setInstallation:p,onInstallSuccess:h,isIntegrationDeleted:v}=Ye(),{selectedConnection:f}=kt(),[g,x]=y.useState(!1),w=r||g,O=(b=i==null?void 0:i.content)==null?void 0:b.provider,I=mh(i),C=m=>{console.error("Error when creating proxy installation:",m)};return y.useEffect(()=>{!w&&i&&I&&!c&&f&&o&&(s!=null&&s.id)&&(x(!0),fh({apiKey:o,projectId:n,integrationId:s==null?void 0:s.id,groupRef:u,consumerRef:d,connectionId:f==null?void 0:f.id,hydratedRevision:i,setError:C,setInstallation:p,onInstallSuccess:h}).then(()=>{x(!1)}).catch(m=>{x(!1),console.error("Error when creating proxy installation:",m)}))},[i,I,c,f,o,n,s==null?void 0:s.id,u,d,p,w,h]),s?w?a.jsx(qe,{}):I&&O&&c?a.jsx(hh,{provider:O}):v?a.jsx(Jr,{text:"Integration successfully uninstalled.",children:ve&&a.jsx(He,{type:"button",onClick:t,style:{width:"100%"},children:"Reinstall Integration"})}):a.jsx("div",{children:e}):a.jsx(ot,{message:"We can't load the integration"})}function Ws(){return a.jsxs("footer",{style:{backgroundColor:"#EFEFEF",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[a.jsx("p",{children:"Secured by"}),a.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:a.jsx("img",{style:{height:".8em"},src:"https://ampersand-website.vercel.app/logo-black.svg",alt:"Ampersand"})})]})}function Me({children:e}){return a.jsx(Gt,{children:a.jsxs(Dt,{children:[a.jsx("div",{style:{padding:"3rem 2rem"},children:e}),a.jsx(Ws,{})]})})}function Qt({children:e}){return a.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function Ke({error:e}){return e?a.jsx(Ei,{style:{marginTop:"2em"},children:e}):null}function zr({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o,children:i,title:r}){if(!r&&!o)throw new Error("Either title or providerName is required");return a.jsxs(Me,{children:[a.jsx(Qt,{children:r||`Set up ${o} integration`}),a.jsx(Ke,{error:t}),i,a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const yh="_link_oo2kv_1",vh={link:yh};function Xr({href:e,className:t,style:n,label:o,children:i,newTab:r=!1}){return ve?a.jsx("a",{className:vh.link,style:n,href:e,"aria-label":o||void 0,target:r?"_blank":"_self",rel:r?"noopener noreferrer":void 0,children:i}):a.jsx(S.Link,{href:e,className:t,style:n,"aria-label":o||void 0,target:r?"_blank":"_self",rel:r?"noopener noreferrer":void 0,color:"#737373",children:i})}const Ih=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-text-secondary").trim()||"#737373";function Kn({url:e,providerDisplayName:t,credentialName:n}){return a.jsxs("p",{style:{color:Ih},children:[a.jsx(Xr,{href:e,newTab:!0,children:a.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const wh="_input_19woe_1",xh="_inputError_19woe_17",_h="_error_19woe_31",rr={input:wh,inputError:xh,error:_h};function bh({id:e,type:t,className:n,isError:o=!1,...i}){const r=o?zt(rr.inputError,rr.input):rr.input;return a.jsx("input",{id:e,type:t,className:zt(r,n),...i})}const Ch="_textarea_1efhx_1",Oh="_textareaError_1efhx_13",Sh="_error_1efhx_27",or={textarea:Ch,textareaError:Oh,error:Sh};function Eh({className:e,isError:t=!1,...n}){const o=t?zt(or.textareaError,or.textarea):or.textarea;return a.jsx("textarea",{className:zt(e,o),...n})}const rt={Input:bh,Textarea:Eh};function Nh({provider:e,providerInfo:t,handleSubmit:n,error:o,isButtonDisabled:i}){var x;const[r,s]=y.useState(!1),c=()=>s(!r),[u,d]=y.useState(""),p=w=>d(w.currentTarget.value),h=u.length>0,v=i||!h,f=it(e,t),g=(x=t.apiKeyOpts)==null?void 0:x.docsURL;return a.jsx(Me,{children:a.jsxs(S.FormControl,{children:[a.jsx(S.FormLabel,{my:"6",children:a.jsx(S.Heading,{as:"h4",size:"md",children:`Set up ${f} integration`})}),a.jsx(Ke,{error:o}),a.jsxs(S.Stack,{spacing:4,children:[g&&a.jsx(Kn,{url:g,providerDisplayName:f,credentialName:"API key"}),a.jsxs(S.InputGroup,{size:"md",children:[a.jsx(S.Input,{onChange:p,pr:"4.5rem",type:r?"text":"password",placeholder:"API Key"}),a.jsx(S.InputRightElement,{width:"4.5rem",children:a.jsx(S.Button,{h:"1.75rem",size:"sm",onClick:c,children:r?"Hide":"Show"})})]})]}),a.jsx("br",{}),a.jsx(S.Button,{variant:"primary",isDisabled:v,width:"100%",type:"submit",onClick:()=>{n({apiKey:u})},children:"Next"})]})})}function Th({provider:e,providerInfo:t,handleSubmit:n,error:o,isButtonDisabled:i}){var x;const[r,s]=y.useState(!1),c=()=>s(w=>!w),[u,d]=y.useState(""),p=w=>d(w.currentTarget.value),h=u.length>0,v=i||!h,f=it(e,t),g=(x=t.apiKeyOpts)==null?void 0:x.docsURL;return a.jsx(zr,{providerName:f,handleSubmit:()=>{n({apiKey:u})},error:o,isButtonDisabled:v,children:a.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[g&&a.jsx(Kn,{url:g,providerDisplayName:f,credentialName:"API key"}),a.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[a.jsx(rt.Input,{id:"password",name:"password",type:r?"text":"password",placeholder:"Password",onChange:w=>p(w)}),a.jsx(He,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,children:r?"Hide":"Show"})]})]})})}function Rh({...e}){return ve?a.jsx(Th,{...e}):a.jsx(Nh,{...e})}function Ah({provider:e,providerInfo:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,children:s,selectedConnection:c,setSelectedConnection:u}){const d=Ie(),[p,h]=y.useState(!1),[v,f]=y.useState(null),g=xe();y.useEffect(()=>{if(e&&fe&&p&&v!=null){const w={groupName:r,groupRef:i,consumerName:o,consumerRef:n,provider:e,apiKey:v};fe().connectionApi.generateConnection({projectIdOrName:d.projectId,generateConnectionParams:w},{headers:{"X-Api-Key":g??"","Content-Type":"application/json"}}).then(O=>{u(O)}).catch(O=>{console.error("Error loading provider info."),Ce(O)})}},[g,e,p,o,n,r,i,d,u,v]);const x=w=>{f(w.apiKey),h(!0)};return c===null?a.jsx(Rh,{provider:e,providerInfo:t,handleSubmit:x,error:null}):s}function jh({provider:e,providerInfo:t,handleSubmit:n,error:o,isButtonDisabled:i}){var I;const[r,s]=y.useState(!1),c=()=>s(!r),[u,d]=y.useState(""),[p,h]=y.useState(""),v=C=>d(C.currentTarget.value),f=C=>h(C.currentTarget.value),g=it(e,t),x=(I=t.basicOpts)==null?void 0:I.docsURL,w=u.length>0,O=i||!w;return a.jsx(Me,{children:a.jsxs(S.FormControl,{children:[a.jsx(S.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(S.Heading,{as:"h4",size:"md",children:`Set up ${g} integration`})}),a.jsx(Ke,{error:o}),a.jsx("br",{}),a.jsxs(S.Stack,{spacing:4,children:[x&&a.jsx(Kn,{url:x,providerDisplayName:g,credentialName:"credentials"}),a.jsx(S.Input,{placeholder:"Username",onChange:v}),a.jsxs(S.InputGroup,{size:"md",children:[a.jsx(S.Input,{onChange:f,pr:"4.5rem",type:r?"text":"password",placeholder:"Password"}),a.jsx(S.InputRightElement,{width:"4.5rem",children:a.jsx(S.Button,{h:"1.75rem",size:"sm",onClick:c,children:r?"Hide":"Show"})})]})]}),a.jsx("br",{}),a.jsx(S.Button,{variant:"primary",isDisabled:O,width:"100%",type:"submit",onClick:()=>{n({user:u,pass:p})},children:"Next"})]})})}function Ph({provider:e,providerInfo:t,handleSubmit:n,error:o,isButtonDisabled:i}){var O;const[r,s]=y.useState(!1),c=()=>s(I=>!I),[u,d]=y.useState({username:"",password:""}),{username:p,password:h}=u,v=it(e,t),f=(O=t.basicOpts)==null?void 0:O.docsURL,g=p.length>0,x=i||!g,w=I=>{const{name:C,value:b}=I.currentTarget;d(m=>({...m,[C]:b}))};return a.jsx(zr,{providerName:v,handleSubmit:()=>{n({user:p,pass:h})},error:o,isButtonDisabled:x,children:a.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[f&&a.jsx(Kn,{url:f,providerDisplayName:v,credentialName:"credentials"}),a.jsx(rt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:I=>w(I)}),a.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[a.jsx(rt.Input,{id:"password",name:"password",type:r?"text":"password",placeholder:"Password",onChange:I=>w(I)}),a.jsx(He,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,children:r?"Hide":"Show"})]})]})})}function Dh({...e}){return ve?a.jsx(Ph,{...e}):a.jsx(jh,{...e})}function kh({provider:e,providerInfo:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,children:s,selectedConnection:c,setSelectedConnection:u}){const d=Ie(),[p,h]=y.useState(!1),[v,f]=y.useState(null),g=xe();y.useEffect(()=>{if(e&&fe&&p&&v!=null){const w={groupName:r,groupRef:i,consumerName:o,consumerRef:n,provider:e,basicAuth:{username:v.user,password:v.pass}};fe().connectionApi.generateConnection({projectIdOrName:d.projectId,generateConnectionParams:w},{headers:{"X-Api-Key":g??"","Content-Type":"application/json"}}).then(O=>{u(O)}).catch(O=>{console.error("Error loading provider info."),Ce(O)})}},[g,e,p,o,n,r,i,d,v,u]);const x=w=>{const{user:O,pass:I}=w;f({user:O,pass:I}),h(!0)};return c===null?a.jsx(Dh,{provider:e,providerInfo:t,handleSubmit:x,error:null}):s}function Fh({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o}){return a.jsx(Me,{children:a.jsxs(S.FormControl,{children:[a.jsx(S.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(S.Heading,{as:"h4",size:"md",children:`Set up ${o} integration`})}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsx(S.Button,{variant:"primary",isDisabled:n,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function Mh({...e}){return ve?a.jsx(zr,{...e}):a.jsx(Fh,{...e})}function Kh({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,children:r,selectedConnection:s,setSelectedConnection:c,providerName:u}){const d=Ie(),p=xe(),[h,v]=y.useState(!1);y.useEffect(()=>{if(e&&fe&&h){const g={groupName:i,groupRef:o,consumerName:n,consumerRef:t,provider:e};fe().connectionApi.generateConnection({projectIdOrName:d.projectId,generateConnectionParams:g},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(x=>{c(x)}).catch(x=>{console.error("Error loading provider info."),Ce(x)})}},[p,e,h,n,t,i,o,c,d]);const f=()=>{v(!0)};return s===null?a.jsx(Mh,{handleSubmit:f,error:null,providerName:u}):r}const Js=async(e,t,n,o,i,r,s,c)=>{var d;const u=await fe().providerApi.getProvider({provider:i},{headers:{"X-Api-Key":o??""}});if(!u)throw new Error(`Provider ${i} not found`);if(u.authType==="oauth2"&&((d=u.oauth2Opts)==null?void 0:d.grantType)==="authorizationCode"){const h=(await fe().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":o??""}})).find(x=>x.provider===i),v=it(i,u);if(!h)throw new Error(`You must first set up a ${v} Provider App using the Ampersand Console.`);const f={connectOAuthParams:{providerWorkspaceRef:r,projectId:e,groupRef:n,groupName:c,consumerRef:t,consumerName:s,providerAppId:h.id,provider:i}};return await fe().oAuthApi.oauthConnect(f)}throw new Error(`Provider ${i} does not support an OAuth2 web flow.`)},zo=600,Xo=600,Lh="AUTHORIZATION_SUCCEEDED",$h="AUTHORIZATION_FAILED";function Hh(e,t,n){return y.useCallback(async o=>{const i=await fe().connectionApi.getConnection({projectIdOrName:e,connectionId:o},{headers:{"X-Api-Key":t??""}});n(i)},[e,t,n])}function Vh(e,t,n,o){return y.useCallback(()=>{if(!o)return;const i=window.screenX+(window.outerWidth-zo)/2,r=window.screenY+(window.outerHeight-Xo)/2.5,s=`width=${zo},height=${Xo},left=${i},top=${r}`,c=window.open(o,e,s);t(c),window.addEventListener("message",n,!1)},[o,e,t,n])}function Uh(e,t){return y.useCallback(n=>{var o,i;if(n.origin===Bl){if(n.data.eventType===Lh){const r=(o=n.data.data)==null?void 0:o.connection;r?e(r):console.error("Connection ID not found in event data: ",{event:n})}n.data.eventType===$h&&(console.error("OAuth failed: ",{event:n}),t==null||t(((i=n==null?void 0:n.data)==null?void 0:i.message)??"OAuth failed. Please try again."))}},[t,e])}function zs({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:o,error:i}){const r=xe(),{projectId:s}=Ie(),[c,u]=y.useState(null),[d,p]=y.useState(null),{setSelectedConnection:h}=kt(),v=Uh(u,o),f=Vh(n,p,v,t),g=Hh(s,r,h);y.useEffect(()=>{t&&!d&&f()},[t,d,f,v,n]),y.useEffect(()=>{c&&g(c).then(()=>{d==null||d.close()}).catch(w=>{console.error("Error refreshing connection: ",w),o==null||o(w.message??"Unexpected error: not able to refresh connection")})},[c,r,h,g,d,o]);const x=d&&setInterval(()=>{(d!=null&&d.closed||!d)&&x&&(clearInterval(x),window.removeEventListener("message",v),p(null),!c&&!i?(console.error("OAuth failed. Please try again."),o==null||o("OAuth failed. Please try again.")):c&&o&&(o==null||o(null)))},500);return a.jsx("div",{children:e})}function Bh({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o}){return a.jsx(Me,{children:a.jsxs(S.FormControl,{children:[a.jsx(S.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(S.Heading,{as:"h4",size:"md",children:`Set up ${o} integration`})}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsx(S.Button,{variant:"primary",isDisabled:n,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function qh({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o}){return ve?a.jsxs(Me,{children:[a.jsx(Qt,{children:`Set up ${o} integration`}),a.jsx(Ke,{error:t}),a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]}):a.jsx(Bh,{handleSubmit:e,error:t,isButtonDisabled:n,providerName:o})}function Wh({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,providerName:r}){const{projectId:s}=Ie(),c=xe(),[u,d]=y.useState(null),[p,h]=y.useState(null),v=async()=>{h(null);try{const g=await Js(s,t,o,c,e,void 0,n,i);d(g)}catch(g){console.error("Could not fetch OAuth popup URL."),Ce(g),h(g.message??"Unexpected error")}},f=y.useCallback(g=>{h(g),d(null)},[]);return a.jsx(zs,{windowTitle:`Connect to ${r}`,oauthUrl:u,onError:f,children:a.jsx(qh,{handleSubmit:v,error:p,providerName:r})})}const Jh=S.createIcon({displayName:"ExternalLinkIcon",path:a.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[a.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),a.jsx("path",{d:"M15 3h6v6"}),a.jsx("path",{d:"M10 14L21 3"})]})}),Xs="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function zh({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o}){return a.jsx(Me,{children:a.jsxs(S.FormControl,{children:[a.jsx(S.FormLabel,{children:a.jsx(S.Heading,{as:"h4",size:"md",children:"Enter your Salesforce subdomain"})}),a.jsxs(Xr,{href:Xs,newTab:!0,children:["What is my Salesforce subdomain? ",a.jsx(Jh,{})]}),a.jsx(Ke,{error:n}),a.jsxs("div",{style:{display:"flex",marginTop:"1em"},children:[a.jsx(S.Input,{placeholder:"my-domain",onChange:i=>t(i.currentTarget.value)}),a.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),a.jsx("br",{}),a.jsx(S.Button,{variant:"primary",isDisabled:o,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function Xh({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o}){const i={handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o};return ve?a.jsxs(Me,{children:[a.jsx(Qt,{children:"Enter your Salesforce subdomain"}),a.jsx(Xr,{href:Xs,newTab:!0,children:"What is my Salesforce subdomain?"}),a.jsx(Ke,{error:n}),a.jsxs("div",{style:{display:"flex",marginTop:"1em"},children:[a.jsx(rt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:r=>t(r.currentTarget.value)}),a.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:o,type:"submit",onClick:e,children:"Next"})]}):a.jsx(zh,{...i})}function Yh({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o,providerName:i}){return a.jsx(Me,{children:a.jsxs(S.FormControl,{children:[a.jsx(S.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsxs(S.Heading,{as:"h4",size:"md",children:["Enter your ",i," workspace"]})}),a.jsx(Ke,{error:n}),a.jsx(S.Flex,{marginTop:"1em",children:a.jsx(S.Input,{placeholder:"MyWorkspace",onChange:r=>t(r.currentTarget.value)})}),a.jsx("br",{}),a.jsx(S.Button,{variant:"primary",isDisabled:o,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function Gh({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o,providerName:i}){if(!ve){const r={handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o,providerName:i};return a.jsx(Yh,{...r})}return a.jsxs(Me,{children:[a.jsxs(Qt,{children:["Enter your ",i," workspace"]}),a.jsx(Ke,{error:n}),a.jsx("br",{}),a.jsx(rt.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:r=>t(r.currentTarget.value)}),a.jsx("br",{}),a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:o,type:"submit",onClick:e,children:"Next"})]})}const Zh="salesforce";function Qh({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,providerName:r}){const{projectId:s}=Ie(),c=xe(),[u,d]=y.useState(""),[p,h]=y.useState(null),[v,f]=y.useState(null),g=async()=>{if(f(null),!u){f("Workspace is required");return}try{const O=await Js(s,t,o,c,e,u,n,i);h(O)}catch(O){console.error(O),f((O==null?void 0:O.message)??"Unexpected error")}},x=y.useCallback(O=>{f(O),h(null)},[]),w=e===Zh?a.jsx(Xh,{handleSubmit:g,setWorkspace:d,error:v,isButtonDisabled:u.length===0}):a.jsx(Gh,{handleSubmit:g,setWorkspace:d,error:v,isButtonDisabled:u.length===0,providerName:r});return a.jsx(zs,{windowTitle:`Connect to ${r}`,oauthUrl:p,onError:x,children:w})}function em({handleSubmit:e,error:t,explicitScopesRequired:n,isButtonDisabled:o,providerName:i}){const[r,s]=y.useState(!1),[c,u]=y.useState(""),[d,p]=y.useState(""),[h,v]=y.useState(""),f=()=>s(!r),g=m=>u(m.currentTarget.value),x=m=>p(m.currentTarget.value),w=m=>v(m.currentTarget.value),O=c.length>0,I=d.length>0,C=o||!O||!I,b=()=>{const m={clientId:d,clientSecret:c};n&&h.length>0&&(m.scopes=Ir(h)),e(m)};return a.jsx(Me,{children:a.jsxs(S.FormControl,{children:[a.jsx(S.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(S.Heading,{as:"h4",size:"md",children:`Set up ${i} integration`})}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsxs(S.Stack,{spacing:4,children:[a.jsx(S.Input,{placeholder:"Client ID",onChange:x}),a.jsxs(S.InputGroup,{size:"md",children:[a.jsx(S.Input,{onChange:g,pr:"4.5rem",type:r?"text":"password",placeholder:"Client Secret"}),a.jsx(S.InputRightElement,{width:"4.5rem",children:a.jsx(S.Button,{h:"1.75rem",size:"sm",onClick:f,children:r?"Hide":"Show"})})]}),n&&a.jsx(S.Textarea,{placeholder:"Scopes separated by new line",onChange:w})]}),a.jsx("br",{}),a.jsx(S.Button,{variant:"primary",isDisabled:C,width:"100%",type:"submit",onClick:b,children:"Next"})]})})}function tm({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,explicitScopesRequired:r,providerName:s,selectedConnection:c,setSelectedConnection:u}){const{projectId:d}=Ie(),p=xe(),[h,v]=y.useState(null),f=async g=>{v(null);const x={groupName:i,groupRef:o,consumerName:n,consumerRef:t,provider:e,oauth2ClientCredentials:{clientId:g.clientId,clientSecret:g.clientSecret,scopes:g.scopes}};fe().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:x},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(w=>{u(w)}).catch(w=>{console.error("Error loading provider info."),Ce(w),v("Error loading provider info")})};return c===null?a.jsx(em,{providerName:s,handleSubmit:f,error:h,explicitScopesRequired:r}):a.jsx(qe,{})}function nm({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o,explicitScopesRequired:i}){const[r,s]=y.useState(!1),[c,u]=y.useState(""),[d,p]=y.useState(""),[h,v]=y.useState(""),[f,g]=y.useState(""),x=()=>s(!r),w=V=>u(V.currentTarget.value),O=V=>p(V.currentTarget.value),I=V=>v(V.currentTarget.value),C=V=>g(V.currentTarget.value),b=c.length>0,m=d.length>0,j=h.length>0,$=n||!b||!m||!j,F=()=>{const V={workspace:h,clientId:d,clientSecret:c};i&&f.length>0&&(V.scopes=Ir(f)),e(V)};return a.jsx(Me,{children:a.jsxs(S.FormControl,{children:[a.jsx(S.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(S.Heading,{as:"h4",size:"md",children:`Set up ${o} integration`})}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsxs(S.Stack,{spacing:4,children:[a.jsx(S.Input,{placeholder:"MyWorkspace",onChange:I}),a.jsx(S.Input,{placeholder:"Client ID",onChange:O}),a.jsxs(S.InputGroup,{size:"md",children:[a.jsx(S.Input,{onChange:w,pr:"4.5rem",type:r?"text":"password",placeholder:"Client Secret"}),a.jsx(S.InputRightElement,{width:"4.5rem",children:a.jsx(S.Button,{h:"1.75rem",size:"sm",onClick:x,children:r?"Hide":"Show"})})]}),i&&a.jsx(S.Textarea,{placeholder:"Scopes separated by new line",onChange:C})]}),a.jsx("br",{}),a.jsx(S.Button,{variant:"primary",isDisabled:$,width:"100%",type:"submit",onClick:F,children:"Next"})]})})}function rm({provider:e,providerName:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,explicitScopesRequired:s,selectedConnection:c,setSelectedConnection:u}){const{projectId:d}=Ie(),p=xe(),[h,v]=y.useState(null),f=async g=>{v(null);const x={groupName:r,groupRef:i,consumerName:o,consumerRef:n,provider:e,providerWorkspaceRef:g.workspace,oauth2ClientCredentials:{clientId:g.clientId,clientSecret:g.clientSecret,scopes:g.scopes}};fe().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:x},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(w=>{u(w)}).catch(w=>{console.error("Error loading provider info."),Ce(w),v("Error loading provider info")})};return c===null?a.jsx(nm,{providerName:t,handleSubmit:f,error:h,explicitScopesRequired:s}):a.jsx(qe,{})}function om({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o,explicitScopesRequired:i,explicitWorkspaceRequired:r}){const[s,c]=y.useState(!1),[u,d]=y.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),p=()=>c(m=>!m),h=m=>{const{name:j,value:$}=m.currentTarget;d(F=>({...F,[j]:$}))},{clientSecret:v,clientId:f,workspace:g,scopes:x}=u,w=v.length>0,O=f.length>0,I=r?g.length>0:!0,C=n||!w||!O||!I,b=()=>{const m={clientId:f,clientSecret:v};r&&(m.workspace=g),i&&x.length>0&&(m.scopes=Ir(x)),e(m)};return a.jsxs(Me,{children:[a.jsx(Qt,{children:`Set up ${o} integration`}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[r&&a.jsx(rt.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:m=>h(m)}),a.jsx(rt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:m=>h(m)}),a.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[a.jsx(rt.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:m=>h(m)}),a.jsx(He,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:p,children:s?"Hide":"Show"})]}),i&&a.jsx(rt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:m=>h(m)})]}),a.jsx("br",{}),a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:C,type:"submit",onClick:b,children:"Next"})]})}function im({provider:e,providerName:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,explicitScopesRequired:s,explicitWorkspaceRequired:c,selectedConnection:u,setSelectedConnection:d}){const{projectId:p}=Ie(),h=xe(),[v,f]=y.useState(null),g=async x=>{f(null);const w={groupName:r,groupRef:i,consumerName:o,consumerRef:n,provider:e,providerWorkspaceRef:x.workspace,oauth2ClientCredentials:{clientId:x.clientId,clientSecret:x.clientSecret,scopes:x.scopes}};fe().connectionApi.generateConnection({projectIdOrName:p,generateConnectionParams:w},{headers:{"X-Api-Key":h??"","Content-Type":"application/json"}}).then(O=>{d(O)}).catch(O=>{console.error("Error loading provider info."),Ce(O),f("Error loading provider info")})};return u===null?a.jsx(om,{providerName:t,handleSubmit:g,error:v,explicitScopesRequired:s,explicitWorkspaceRequired:c}):a.jsx(qe,{})}function sm({...e}){return ve?a.jsx(im,{...e}):e.explicitWorkspaceRequired?a.jsx(rm,{...e}):a.jsx(tm,{...e})}const am="authorizationCode",cm="clientCredentials";function um({provider:e,providerInfo:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,selectedConnection:s,setSelectedConnection:c}){if(t.oauth2Opts===void 0)return a.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:u,explicitScopesRequired:d,explicitWorkspaceRequired:p}=t.oauth2Opts,h=it(e,t),v={provider:e,consumerRef:n,consumerName:o,groupRef:i,groupName:r,providerName:h};return u===am?p?a.jsx(Qh,{...v}):a.jsx(Wh,{...v}):u===cm?a.jsx(sm,{...v,explicitWorkspaceRequired:p,explicitScopesRequired:d,selectedConnection:s,setSelectedConnection:c}):u==="password"?a.jsx("em",{children:"Password flow not supported yet"}):u==="PKCE"?a.jsx("em",{children:"PKCE flow not supported yet"}):a.jsxs("em",{children:["Unsupported grant type: ",u]})}function lm(e){const{selectedConnection:t}=kt();y.useEffect(()=>{e&&t&&e(t.id)},[e,t])}function dm({onSuccess:e}){lm(e)}const pm=async(e,t)=>{const n=await fe().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!n)throw new Error(`Provider ${t} not found`);return n};function Ys({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,children:r,onSuccess:s}){const c=xe(),[u,d]=y.useState(null),{provider:p}=Ye(),{selectedConnection:h,setSelectedConnection:v,connections:f}=kt();dm({onSuccess:s});const g=e||p,x=(u==null?void 0:u.displayName)??Zo(g);if(y.useEffect(()=>{if(!h&&f&&f.length>0){const[O]=f;v(O)}pm(c,g).then(O=>{d(O)}).catch(O=>{console.error("Error loading provider info."),Ce(O)})},[f,h,v,c,g]),!e&&!p)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(h)return r;if(u==null)return a.jsx("strong",{children:"Provider not found"});const w={provider:g,consumerRef:t,consumerName:n,groupRef:o,groupName:i,selectedConnection:h,setSelectedConnection:v,providerName:x,providerInfo:u};return u.authType==="none"?a.jsx(Kh,{...w,children:r}):u.authType==="basic"?a.jsx(kh,{...w,children:r}):u.authType==="apiKey"?a.jsx(Ah,{...w,children:r}):a.jsx(um,{...w})}const fm=a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[a.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),a.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function hm(e,t){return t?y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},y.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?fm:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:a.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}const Gs=y.forwardRef(({objectName:e,completed:t,pending:n,displayName:o},i)=>{const r=S.useTab({ref:i}),s=S.useMultiStyleConfig("Tabs",r);return a.jsxs(S.Button,{__css:s.tab,...r,variant:"outline",minHeight:15,children:[a.jsxs(S.Box,{as:"span",display:"flex",alignItems:"center",gap:2,mr:"3",children:[hm(t,n),a.jsxs(S.Box,{textAlign:"left",children:[a.jsx(S.Text,{children:o||e}),n&&a.jsx(S.Text,{fontSize:10,fontStyle:"italic",children:"pending"})]})]}),r.children]})});function mm({pending:e,completed:t,displayName:n}){return a.jsxs(a.Fragment,{children:[a.jsx(qr,{style:{margin:"1rem 0"}}),a.jsx(Gs,{objectName:xt,completed:t,pending:e,displayName:n},"other-write")]})}function gm(e,t){return e!=null&&e[t]?e[t]:{name:Ti,completed:!1}}const ym=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-background-secondary").trim()||"#FCFCFC";function vm({children:e}){var O,I,C;const{project:t}=Ie(),{installation:n,provider:o}=Ye(),{hydratedRevision:i}=Zt(),{objectConfigurationsState:r}=Br(),[s,c]=y.useState(0),u=(t==null?void 0:t.appName)||"",d=n==null?void 0:n.config,p=i&&vi(d,i),h=p!==null,v=!!((O=i==null?void 0:i.content)!=null&&O.write),f=v?Ii(d):void 0,g=y.useMemo(()=>{const b=[...p||[]];return f&&v&&b.push(f),b},[p,f,v]),x=gm(g,s),w=y.useCallback(()=>{const b=g.find(m=>x!==m&&!m.completed);b&&c(g.indexOf(b))},[g,x]);return a.jsx(ys.Provider,{value:w,children:a.jsx(ms.Provider,{value:x==null?void 0:x.name,children:a.jsxs(Gt,{style:{maxWidth:"55rem"},children:[a.jsxs(Dt,{style:{display:"flex",gap:"1rem",padding:"3rem",backgroundColor:ym},children:[a.jsxs("div",{style:{width:"20rem"},children:[a.jsxs(S.Text,{children:[it(o)," integration"]}),a.jsx(S.Text,{marginBottom:"20px",fontSize:"1.125rem",fontWeight:"500",children:u}),h&&a.jsxs(S.Tabs,{index:s,onChange:c,orientation:"horizontal",children:[p.map(b=>{var m,j,$,F;return a.jsx(Gs,{objectName:b.name,completed:b.completed,pending:((j=(m=r[b.name])==null?void 0:m.read)==null?void 0:j.isOptionalFieldsModified)||((F=($=r[b.name])==null?void 0:$.read)==null?void 0:F.isRequiredMapFieldsModified)},b.name)}),v&&f&&a.jsx(mm,{completed:f.completed,pending:(C=(I=r==null?void 0:r.other)==null?void 0:I.write)==null?void 0:C.isWriteModified,displayName:p!=null&&p.length?"other":"write"}),n&&a.jsxs(a.Fragment,{children:[a.jsx(qr,{style:{margin:"3rem 0 1rem 0"}}),a.jsx(Dd,{text:"Uninstall"},"uninstall-installation")]})]})]}),e]}),a.jsx(Ws,{})]})})})}function Im(){const[e,t]=y.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}function wm({integration:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,onInstallSuccess:r,onUpdateSuccess:s,onUninstallSuccess:c}){var v;const{projectId:u}=Ie(),{errorState:d}=dt(),{seed:p,reset:h}=Im();return(v=d[me.INTEGRATION_LIST])!=null&&v.apiError?a.jsx(ot,{message:"Something went wrong, couldn't find integration information"}):a.jsx(sd,{integration:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,onInstallSuccess:r,onUpdateSuccess:s,onUninstallSuccess:c,children:a.jsx(gi,{groupRef:o,children:a.jsx(Ys,{consumerRef:t,consumerName:n,groupRef:o,groupName:i,children:a.jsx(kd,{projectId:u,children:a.jsx(gh,{resetComponent:h,children:a.jsx(sf,{children:a.jsx(vm,{children:a.jsx(lh,{})})})})})})})},p)}function xm(){return a.jsxs(Gt,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[a.jsx(qe,{}),a.jsx("p",{children:"Redirecting"})]})}function _m({redirectURL:e,children:t}){return y.useEffect(()=>{e&&window.location.replace(e)},[e]),e?a.jsx(xm,{}):t}function bm({provider:e}){const{appName:t}=Ie(),n=`You have successfully connected your ${it(e)} account to ${t}.`;return a.jsx(Jr,{text:n})}function Cm({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,redirectUrl:r,onSuccess:s}){return a.jsx(gi,{provider:e,groupRef:o,children:a.jsx(Ys,{provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,onSuccess:s,children:a.jsx(_m,{redirectURL:r,children:a.jsx(bm,{provider:e})})})})}const Om=(e,t)=>{const n=xe(),{projectId:o}=Ie(),{integrations:i}=di(),[r,s]=y.useState(!1),[c,u]=y.useState(null);if(!n||!o)throw new Error("useIsIntegrationInstalled must be used within AmpersandProvider");if(!e)throw new Error("useIsIntegrationInstalled requires an integration name");if(!t)throw new Error("useIsIntegrationInstalled requires a groupRef");const d=y.useMemo(()=>i==null?void 0:i.reduce((p,h)=>(h==null?void 0:h.name)===e?h:p,{}),[i,e]);return y.useEffect(()=>{d&&fe().installationApi.listInstallations({projectIdOrName:o,integrationId:d.id,groupRef:t},{headers:{"x-api-key":n}}).then(p=>{s(!0),u(p.length>0)}).catch(p=>{console.error("Error listing installations."),Ce(p),s(!0)})},[t,n,o,d]),{isLoaded:r,isIntegrationInstalled:c}};exports.AmpersandContext=fi;exports.AmpersandProvider=rd;exports.ConnectProvider=Cm;exports.InstallIntegration=wm;exports.useAmpersandProvider=od;exports.useIsIntegrationInstalled=Om;
43
+ */var Ao;function Jd(){return Ao||(Ao=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),r=Symbol.for("react.provider"),s=Symbol.for("react.context"),c=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),m=!1,x=!1,w=!1,O=!1,v=!1,C;C=Symbol.for("react.module.reference");function b(L){return!!(typeof L=="string"||typeof L=="function"||L===n||L===i||v||L===o||L===d||L===p||O||L===f||m||x||w||typeof L=="object"&&L!==null&&(L.$$typeof===g||L.$$typeof===h||L.$$typeof===r||L.$$typeof===s||L.$$typeof===u||L.$$typeof===C||L.getModuleId!==void 0))}function I(L){if(typeof L=="object"&&L!==null){var Ee=L.$$typeof;switch(Ee){case e:var Te=L.type;switch(Te){case n:case i:case o:case d:case p:return Te;default:var Ge=Te&&Te.$$typeof;switch(Ge){case c:case s:case u:case g:case h:case r:return Ge;default:return Ee}}case t:return Ee}}}var S=s,H=r,k=e,V=u,z=n,X=g,Z=h,te=t,Q=i,ue=o,le=d,re=p,Oe=!1,Ne=!1;function T(L){return Oe||(Oe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function K(L){return Ne||(Ne=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function F(L){return I(L)===s}function D(L){return I(L)===r}function P(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function R(L){return I(L)===u}function B(L){return I(L)===n}function W(L){return I(L)===g}function U(L){return I(L)===h}function J(L){return I(L)===t}function q(L){return I(L)===i}function oe(L){return I(L)===o}function j(L){return I(L)===d}function de(L){return I(L)===p}ce.ContextConsumer=S,ce.ContextProvider=H,ce.Element=k,ce.ForwardRef=V,ce.Fragment=z,ce.Lazy=X,ce.Memo=Z,ce.Portal=te,ce.Profiler=Q,ce.StrictMode=ue,ce.Suspense=le,ce.SuspenseList=re,ce.isAsyncMode=T,ce.isConcurrentMode=K,ce.isContextConsumer=F,ce.isContextProvider=D,ce.isElement=P,ce.isForwardRef=R,ce.isFragment=B,ce.isLazy=W,ce.isMemo=U,ce.isPortal=J,ce.isProfiler=q,ce.isStrictMode=oe,ce.isSuspense=j,ce.isSuspenseList=de,ce.isValidElementType=b,ce.typeOf=I}()),ce}process.env.NODE_ENV==="production"?ar.exports=Wd():ar.exports=Jd();var jo=ar.exports;const Po=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Do=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",er=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Do(n.overflowY,t)||Do(n.overflowX,t)||(o=>{const i=(r=>{if(!r.ownerDocument||!r.ownerDocument.defaultView)return null;try{return r.ownerDocument.defaultView.frameElement}catch{return null}})(o);return!!i&&(i.clientHeight<o.scrollHeight||i.clientWidth<o.scrollWidth)})(e)}return!1},fn=(e,t,n,o,i,r,s,c)=>r<e&&s>t||r>e&&s<t?0:r<=e&&c<=n||s>=t&&c>=n?r-e-o:s>t&&c<n||r<e&&c>n?s-t+i:0,zd=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Xd=(e,t)=>{var n,o,i,r;if(typeof document>"u")return[];const{scrollMode:s,block:c,inline:u,boundary:d,skipOverflowHiddenElements:p}=t,h=typeof d=="function"?d:le=>le!==d;if(!Po(e))throw new TypeError("Invalid target");const g=document.scrollingElement||document.documentElement,f=[];let m=e;for(;Po(m)&&h(m);){if(m=zd(m),m===g){f.push(m);break}m!=null&&m===document.body&&er(m)&&!er(document.documentElement)||m!=null&&er(m,p)&&f.push(m)}const x=(o=(n=window.visualViewport)==null?void 0:n.width)!=null?o:innerWidth,w=(r=(i=window.visualViewport)==null?void 0:i.height)!=null?r:innerHeight,{scrollX:O,scrollY:v}=window,{height:C,width:b,top:I,right:S,bottom:H,left:k}=e.getBoundingClientRect(),{top:V,right:z,bottom:X,left:Z}=(le=>{const re=window.getComputedStyle(le);return{top:parseFloat(re.scrollMarginTop)||0,right:parseFloat(re.scrollMarginRight)||0,bottom:parseFloat(re.scrollMarginBottom)||0,left:parseFloat(re.scrollMarginLeft)||0}})(e);let te=c==="start"||c==="nearest"?I-V:c==="end"?H+X:I+C/2-V+X,Q=u==="center"?k+b/2-Z+z:u==="end"?S+z:k-Z;const ue=[];for(let le=0;le<f.length;le++){const re=f[le],{height:Oe,width:Ne,top:T,right:K,bottom:F,left:D}=re.getBoundingClientRect();if(s==="if-needed"&&I>=0&&k>=0&&H<=w&&S<=x&&I>=T&&H<=F&&k>=D&&S<=K)return ue;const P=getComputedStyle(re),R=parseInt(P.borderLeftWidth,10),B=parseInt(P.borderTopWidth,10),W=parseInt(P.borderRightWidth,10),U=parseInt(P.borderBottomWidth,10);let J=0,q=0;const oe="offsetWidth"in re?re.offsetWidth-re.clientWidth-R-W:0,j="offsetHeight"in re?re.offsetHeight-re.clientHeight-B-U:0,de="offsetWidth"in re?re.offsetWidth===0?0:Ne/re.offsetWidth:0,L="offsetHeight"in re?re.offsetHeight===0?0:Oe/re.offsetHeight:0;if(g===re)J=c==="start"?te:c==="end"?te-w:c==="nearest"?fn(v,v+w,w,B,U,v+te,v+te+C,C):te-w/2,q=u==="start"?Q:u==="center"?Q-x/2:u==="end"?Q-x:fn(O,O+x,x,R,W,O+Q,O+Q+b,b),J=Math.max(0,J+v),q=Math.max(0,q+O);else{J=c==="start"?te-T-B:c==="end"?te-F+U+j:c==="nearest"?fn(T,F,Oe,B,U+j,te,te+C,C):te-(T+Oe/2)+j/2,q=u==="start"?Q-D-R:u==="center"?Q-(D+Ne/2)+oe/2:u==="end"?Q-K+W+oe:fn(D,K,Ne,R,W+oe,Q,Q+b,b);const{scrollLeft:Ee,scrollTop:Te}=re;J=L===0?0:Math.max(0,Math.min(Te+J/L,re.scrollHeight-Oe/L+j)),q=de===0?0:Math.max(0,Math.min(Ee+q/de,re.scrollWidth-Ne/de+oe)),te+=Te-J,Q+=Ee-q}ue.push({el:re,top:J,left:q})}return ue};var Tt=function(){return Tt=Object.assign||function(t){for(var n,o=1,i=arguments.length;o<i;o++){n=arguments[o];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Tt.apply(this,arguments)};var Yd=0;function ko(e){return typeof e=="function"?e:De}function De(){}function Pi(e,t){if(e){var n=Xd(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(o){var i=o.el,r=o.top,s=o.left;i.scrollTop=r,i.scrollLeft=s})}}function Fo(e,t,n){var o=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return o}function Or(e,t){var n;function o(){n&&clearTimeout(n)}function i(){for(var r=arguments.length,s=new Array(r),c=0;c<r;c++)s[c]=arguments[c];o(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return i.cancel=o,i}function we(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(o){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return t.some(function(c){return c&&c.apply(void 0,[o].concat(r)),o.preventDownshiftDefault||o.hasOwnProperty("nativeEvent")&&o.nativeEvent.preventDownshiftDefault})}}function Nt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(o){t.forEach(function(i){typeof i=="function"?i(o):i&&(i.current=o)})}}function Di(){return String(Yd++)}function Gd(e){var t=e.isOpen,n=e.resultCount,o=e.previousResultCount;return t?n?n!==o?n+" result"+(n===1?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function Mo(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function ki(e){return typeof e.type=="string"}function Fi(e){return e.props}function Zd(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var Qd=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function hn(e){e===void 0&&(e={});var t={};return Qd.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function _n(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,o){return n[o]=bn(t,o)?t[o]:e[o],n},{})}function bn(e,t){return e[t]!==void 0}function cr(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function ep(e){return Object.prototype.toString.call(e)==="[object Object]"}function wt(e,t,n,o,i){var r=n.length;if(r===0)return-1;var s=r-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var c=e+t;c<0?c=s:c>s&&(c=0);var u=Rt(c,t<0,n,o,i);return u===-1?e>=r?-1:e:u}function Rt(e,t,n,o,i){i===void 0&&(i=!1);var r=n.length;if(t){for(var s=e;s>=0;s--)if(!o(n[s],s))return s}else for(var c=e;c<r;c++)if(!o(n[c],c))return c;return i?Rt(t?r-1:0,t,n,o):-1}function Cn(e,t,n,o){return o===void 0&&(o=!0),n&&t.some(function(i){return i&&(Fo(i,e,n)||o&&Fo(i,n.document.activeElement,n))})}var Sr=De;process.env.NODE_ENV!=="production"&&(Sr=function(t,n,o){var i="This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props";Object.keys(t).forEach(function(r){n[r]!==void 0&&o[r]===void 0?console.error('downshift: A component has changed the controlled prop "'+r+'" to be uncontrolled. '+i):n[r]===void 0&&o[r]!==void 0&&console.error('downshift: A component has changed the uncontrolled prop "'+r+'" to be controlled. '+i)})});var tp=Or(function(e){Mi(e).textContent=""},500);function Mi(e){var t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}function Ki(e,t){if(!(!e||!t)){var n=Mi(t);n.textContent=e,tp(t)}}function np(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Li=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,$i=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Hi=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,vn=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,In=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Vi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Ui=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Bi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,qi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Wi=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Ji=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,zi=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Xi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,ur=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Yi=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Gi=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Zi=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,rp=Object.freeze({__proto__:null,blurButton:Yi,blurInput:Ji,changeInput:zi,clickButton:ur,clickItem:Wi,controlledPropUpdatedSelectedItem:Gi,itemMouseEnter:Hi,keyDownArrowDown:In,keyDownArrowUp:vn,keyDownEnd:qi,keyDownEnter:Ui,keyDownEscape:Vi,keyDownHome:Bi,keyDownSpaceButton:Xi,mouseUp:$i,touchEnd:Zi,unknown:Li}),op=["refKey","ref"],ip=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],sp=["onKeyDown","onBlur","onChange","onInput","onChangeText"],ap=["refKey","ref"],cp=["onMouseMove","onMouseDown","onClick","onPress","index","item"],up=function(){var e=function(t){function n(i){var r;r=t.call(this,i)||this,r.id=r.props.id||"downshift-"+Di(),r.menuId=r.props.menuId||r.id+"-menu",r.labelId=r.props.labelId||r.id+"-label",r.inputId=r.props.inputId||r.id+"-input",r.getItemId=r.props.getItemId||function(v){return r.id+"-item-"+v},r.items=[],r.itemCount=null,r.previousResultCount=0,r.timeoutIds=[],r.internalSetTimeout=function(v,C){var b=setTimeout(function(){r.timeoutIds=r.timeoutIds.filter(function(I){return I!==b}),v()},C);r.timeoutIds.push(b)},r.setItemCount=function(v){r.itemCount=v},r.unsetItemCount=function(){r.itemCount=null},r.isItemDisabled=function(v,C){var b=r.getItemNodeFromIndex(C);return b&&b.hasAttribute("disabled")},r.setHighlightedIndex=function(v,C){v===void 0&&(v=r.props.defaultHighlightedIndex),C===void 0&&(C={}),C=hn(C),r.internalSetState(ne({highlightedIndex:v},C))},r.clearSelection=function(v){r.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:r.props.defaultHighlightedIndex,isOpen:r.props.defaultIsOpen},v)},r.selectItem=function(v,C,b){C=hn(C),r.internalSetState(ne({isOpen:r.props.defaultIsOpen,highlightedIndex:r.props.defaultHighlightedIndex,selectedItem:v,inputValue:r.props.itemToString(v)},C),b)},r.selectItemAtIndex=function(v,C,b){var I=r.items[v];I!=null&&r.selectItem(I,C,b)},r.selectHighlightedItem=function(v,C){return r.selectItemAtIndex(r.getState().highlightedIndex,v,C)},r.internalSetState=function(v,C){var b,I,S={},H=typeof v=="function";return!H&&v.hasOwnProperty("inputValue")&&r.props.onInputValueChange(v.inputValue,ne({},r.getStateAndHelpers(),v)),r.setState(function(k){var V;k=r.getState(k);var z=H?v(k):v;z=r.props.stateReducer(k,z),b=z.hasOwnProperty("selectedItem");var X={};return b&&z.selectedItem!==k.selectedItem&&(I=z.selectedItem),(V=z).type||(V.type=Li),Object.keys(z).forEach(function(Z){k[Z]!==z[Z]&&(S[Z]=z[Z]),Z!=="type"&&(z[Z],bn(r.props,Z)||(X[Z]=z[Z]))}),H&&z.hasOwnProperty("inputValue")&&r.props.onInputValueChange(z.inputValue,ne({},r.getStateAndHelpers(),z)),X},function(){ko(C)();var k=Object.keys(S).length>1;k&&r.props.onStateChange(S,r.getStateAndHelpers()),b&&r.props.onSelect(v.selectedItem,r.getStateAndHelpers()),I!==void 0&&r.props.onChange(I,r.getStateAndHelpers()),r.props.onUserAction(S,r.getStateAndHelpers())})},r.rootRef=function(v){return r._rootNode=v},r.getRootProps=function(v,C){var b,I=v===void 0?{}:v,S=I.refKey,H=S===void 0?"ref":S,k=I.ref,V=nt(I,op),z=C===void 0?{}:C,X=z.suppressRefError,Z=X===void 0?!1:X;r.getRootProps.called=!0,r.getRootProps.refKey=H,r.getRootProps.suppressRefError=Z;var te=r.getState(),Q=te.isOpen;return ne((b={},b[H]=Nt(k,r.rootRef),b.role="combobox",b["aria-expanded"]=Q,b["aria-haspopup"]="listbox",b["aria-owns"]=Q?r.menuId:void 0,b["aria-labelledby"]=r.labelId,b),V)},r.keyDownHandlers={ArrowDown:function(C){var b=this;if(C.preventDefault(),this.getState().isOpen){var I=C.shiftKey?5:1;this.moveHighlightedIndex(I,{type:In})}else this.internalSetState({isOpen:!0,type:In},function(){var S=b.getItemCount();if(S>0){var H=b.getState(),k=H.highlightedIndex,V=wt(k,1,{length:S},b.isItemDisabled,!0);b.setHighlightedIndex(V,{type:In})}})},ArrowUp:function(C){var b=this;if(C.preventDefault(),this.getState().isOpen){var I=C.shiftKey?-5:-1;this.moveHighlightedIndex(I,{type:vn})}else this.internalSetState({isOpen:!0,type:vn},function(){var S=b.getItemCount();if(S>0){var H=b.getState(),k=H.highlightedIndex,V=wt(k,-1,{length:S},b.isItemDisabled,!0);b.setHighlightedIndex(V,{type:vn})}})},Enter:function(C){if(C.which!==229){var b=this.getState(),I=b.isOpen,S=b.highlightedIndex;if(I&&S!=null){C.preventDefault();var H=this.items[S],k=this.getItemNodeFromIndex(S);if(H==null||k&&k.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Ui})}}},Escape:function(C){C.preventDefault(),this.reset(ne({type:Vi},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},r.buttonKeyDownHandlers=ne({},r.keyDownHandlers,{" ":function(C){C.preventDefault(),this.toggleMenu({type:Xi})}}),r.inputKeyDownHandlers=ne({},r.keyDownHandlers,{Home:function(C){var b=this.getState(),I=b.isOpen;if(I){C.preventDefault();var S=this.getItemCount();if(!(S<=0||!I)){var H=Rt(0,!1,{length:S},this.isItemDisabled);this.setHighlightedIndex(H,{type:Bi})}}},End:function(C){var b=this.getState(),I=b.isOpen;if(I){C.preventDefault();var S=this.getItemCount();if(!(S<=0||!I)){var H=Rt(S-1,!0,{length:S},this.isItemDisabled);this.setHighlightedIndex(H,{type:qi})}}}}),r.getToggleButtonProps=function(v){var C=v===void 0?{}:v,b=C.onClick;C.onPress;var I=C.onKeyDown,S=C.onKeyUp,H=C.onBlur,k=nt(C,ip),V=r.getState(),z=V.isOpen,X={onClick:we(b,r.buttonHandleClick),onKeyDown:we(I,r.buttonHandleKeyDown),onKeyUp:we(S,r.buttonHandleKeyUp),onBlur:we(H,r.buttonHandleBlur)},Z=k.disabled?{}:X;return ne({type:"button",role:"button","aria-label":z?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},Z,k)},r.buttonHandleKeyUp=function(v){v.preventDefault()},r.buttonHandleKeyDown=function(v){var C=cr(v);r.buttonKeyDownHandlers[C]&&r.buttonKeyDownHandlers[C].call(r,v)},r.buttonHandleClick=function(v){if(v.preventDefault(),r.props.environment){var C=r.props.environment.document,b=C.body,I=C.activeElement;b&&b===I&&v.target.focus()}process.env.NODE_ENV==="test"?r.toggleMenu({type:ur}):r.internalSetTimeout(function(){return r.toggleMenu({type:ur})})},r.buttonHandleBlur=function(v){var C=v.target;r.internalSetTimeout(function(){if(!(r.isMouseDown||!r.props.environment)){var b=r.props.environment.document.activeElement;(b==null||b.id!==r.inputId)&&b!==C&&r.reset({type:Yi})}})},r.getLabelProps=function(v){return ne({htmlFor:r.inputId,id:r.labelId},v)},r.getInputProps=function(v){var C=v===void 0?{}:v,b=C.onKeyDown,I=C.onBlur,S=C.onChange,H=C.onInput;C.onChangeText;var k=nt(C,sp),V,z={};V="onChange";var X=r.getState(),Z=X.inputValue,te=X.isOpen,Q=X.highlightedIndex;if(!k.disabled){var ue;z=(ue={},ue[V]=we(S,H,r.inputHandleChange),ue.onKeyDown=we(b,r.inputHandleKeyDown),ue.onBlur=we(I,r.inputHandleBlur),ue)}return ne({"aria-autocomplete":"list","aria-activedescendant":te&&typeof Q=="number"&&Q>=0?r.getItemId(Q):void 0,"aria-controls":te?r.menuId:void 0,"aria-labelledby":k&&k["aria-label"]?void 0:r.labelId,autoComplete:"off",value:Z,id:r.inputId},z,k)},r.inputHandleKeyDown=function(v){var C=cr(v);C&&r.inputKeyDownHandlers[C]&&r.inputKeyDownHandlers[C].call(r,v)},r.inputHandleChange=function(v){r.internalSetState({type:zi,isOpen:!0,inputValue:v.target.value,highlightedIndex:r.props.defaultHighlightedIndex})},r.inputHandleBlur=function(){r.internalSetTimeout(function(){var v;if(!(r.isMouseDown||!r.props.environment)){var C=r.props.environment.document.activeElement,b=(C==null||(v=C.dataset)==null?void 0:v.toggle)&&r._rootNode&&r._rootNode.contains(C);b||r.reset({type:Ji})}})},r.menuRef=function(v){r._menuNode=v},r.getMenuProps=function(v,C){var b,I=v===void 0?{}:v,S=I.refKey,H=S===void 0?"ref":S,k=I.ref,V=nt(I,ap),z=C===void 0?{}:C,X=z.suppressRefError,Z=X===void 0?!1:X;return r.getMenuProps.called=!0,r.getMenuProps.refKey=H,r.getMenuProps.suppressRefError=Z,ne((b={},b[H]=Nt(k,r.menuRef),b.role="listbox",b["aria-labelledby"]=V&&V["aria-label"]?void 0:r.labelId,b.id=r.menuId,b),V)},r.getItemProps=function(v){var C,b=v===void 0?{}:v,I=b.onMouseMove,S=b.onMouseDown,H=b.onClick;b.onPress;var k=b.index,V=b.item,z=V===void 0?process.env.NODE_ENV==="production"?void 0:Zd("getItemProps","item"):V,X=nt(b,cp);k===void 0?(r.items.push(z),k=r.items.indexOf(z)):r.items[k]=z;var Z="onClick",te=H,Q=(C={onMouseMove:we(I,function(){k!==r.getState().highlightedIndex&&(r.setHighlightedIndex(k,{type:Hi}),r.avoidScrolling=!0,r.internalSetTimeout(function(){return r.avoidScrolling=!1},250))}),onMouseDown:we(S,function(le){le.preventDefault()})},C[Z]=we(te,function(){r.selectItemAtIndex(k,{type:Wi})}),C),ue=X.disabled?{onMouseDown:Q.onMouseDown}:Q;return ne({id:r.getItemId(k),role:"option","aria-selected":r.getState().highlightedIndex===k},ue,X)},r.clearItems=function(){r.items=[]},r.reset=function(v,C){v===void 0&&(v={}),v=hn(v),r.internalSetState(function(b){var I=b.selectedItem;return ne({isOpen:r.props.defaultIsOpen,highlightedIndex:r.props.defaultHighlightedIndex,inputValue:r.props.itemToString(I)},v)},C)},r.toggleMenu=function(v,C){v===void 0&&(v={}),v=hn(v),r.internalSetState(function(b){var I=b.isOpen;return ne({isOpen:!I},I&&{highlightedIndex:r.props.defaultHighlightedIndex},v)},function(){var b=r.getState(),I=b.isOpen,S=b.highlightedIndex;I&&r.getItemCount()>0&&typeof S=="number"&&r.setHighlightedIndex(S,v),ko(C)()})},r.openMenu=function(v){r.internalSetState({isOpen:!0},v)},r.closeMenu=function(v){r.internalSetState({isOpen:!1},v)},r.updateStatus=Or(function(){var v;if((v=r.props)!=null&&(v=v.environment)!=null&&v.document){var C=r.getState(),b=r.items[C.highlightedIndex],I=r.getItemCount(),S=r.props.getA11yStatusMessage(ne({itemToString:r.props.itemToString,previousResultCount:r.previousResultCount,resultCount:I,highlightedItem:b},C));r.previousResultCount=I,Ki(S,r.props.environment.document)}},200);var s=r.props,c=s.defaultHighlightedIndex,u=s.initialHighlightedIndex,d=u===void 0?c:u,p=s.defaultIsOpen,h=s.initialIsOpen,g=h===void 0?p:h,f=s.initialInputValue,m=f===void 0?"":f,x=s.initialSelectedItem,w=x===void 0?null:x,O=r.getState({highlightedIndex:d,isOpen:g,inputValue:m,selectedItem:w});return O.selectedItem!=null&&r.props.initialInputValue===void 0&&(O.inputValue=r.props.itemToString(O.selectedItem)),r.state=O,r}Fd(n,t);var o=n.prototype;return o.internalClearTimeouts=function(){this.timeoutIds.forEach(function(r){clearTimeout(r)}),this.timeoutIds=[]},o.getState=function(r){return r===void 0&&(r=this.state),_n(r,this.props)},o.getItemCount=function(){var r=this.items.length;return this.itemCount!=null?r=this.itemCount:this.props.itemCount!==void 0&&(r=this.props.itemCount),r},o.getItemNodeFromIndex=function(r){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(r)):null},o.scrollHighlightedItemIntoView=function(){{var r=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(r,this._menuNode)}},o.moveHighlightedIndex=function(r,s){var c=this.getItemCount(),u=this.getState(),d=u.highlightedIndex;if(c>0){var p=wt(d,r,{length:c},this.isItemDisabled,!0);this.setHighlightedIndex(p,s)}},o.getStateAndHelpers=function(){var r=this.getState(),s=r.highlightedIndex,c=r.inputValue,u=r.selectedItem,d=r.isOpen,p=this.props.itemToString,h=this.id,g=this.getRootProps,f=this.getToggleButtonProps,m=this.getLabelProps,x=this.getMenuProps,w=this.getInputProps,O=this.getItemProps,v=this.openMenu,C=this.closeMenu,b=this.toggleMenu,I=this.selectItem,S=this.selectItemAtIndex,H=this.selectHighlightedItem,k=this.setHighlightedIndex,V=this.clearSelection,z=this.clearItems,X=this.reset,Z=this.setItemCount,te=this.unsetItemCount,Q=this.internalSetState;return{getRootProps:g,getToggleButtonProps:f,getLabelProps:m,getMenuProps:x,getInputProps:w,getItemProps:O,reset:X,openMenu:v,closeMenu:C,toggleMenu:b,selectItem:I,selectItemAtIndex:S,selectHighlightedItem:H,setHighlightedIndex:k,clearSelection:V,clearItems:z,setItemCount:Z,unsetItemCount:te,setState:Q,itemToString:p,id:h,highlightedIndex:s,inputValue:c,isOpen:d,selectedItem:u}},o.componentDidMount=function(){var r=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Ko(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){r.internalClearTimeouts()};else{var s=function(){r.isMouseDown=!0},c=function(f){r.isMouseDown=!1;var m=Cn(f.target,[r._rootNode,r._menuNode],r.props.environment);!m&&r.getState().isOpen&&r.reset({type:$i},function(){return r.props.onOuterClick(r.getStateAndHelpers())})},u=function(){r.isTouchMove=!1},d=function(){r.isTouchMove=!0},p=function(f){var m=Cn(f.target,[r._rootNode,r._menuNode],r.props.environment,!1);!r.isTouchMove&&!m&&r.getState().isOpen&&r.reset({type:Zi},function(){return r.props.onOuterClick(r.getStateAndHelpers())})},h=this.props.environment;h.addEventListener("mousedown",s),h.addEventListener("mouseup",c),h.addEventListener("touchstart",u),h.addEventListener("touchmove",d),h.addEventListener("touchend",p),this.cleanup=function(){r.internalClearTimeouts(),r.updateStatus.cancel(),h.removeEventListener("mousedown",s),h.removeEventListener("mouseup",c),h.removeEventListener("touchstart",u),h.removeEventListener("touchmove",d),h.removeEventListener("touchend",p)}}},o.shouldScroll=function(r,s){var c=this.props.highlightedIndex===void 0?this.getState():this.props,u=c.highlightedIndex,d=s.highlightedIndex===void 0?r:s,p=d.highlightedIndex,h=u&&this.getState().isOpen&&!r.isOpen,g=u!==p;return h||g},o.componentDidUpdate=function(r,s){process.env.NODE_ENV!=="production"&&(Sr(this.state,r,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Ko(this._menuNode,this.getMenuProps)),bn(this.props,"selectedItem")&&this.props.selectedItemChanged(r.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Gi,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,r)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},o.componentWillUnmount=function(){this.cleanup()},o.render=function(){var r=Mo(this.props.children,De);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var s=Mo(r(this.getStateAndHelpers()));if(!s)return null;if(this.getRootProps.called||this.props.suppressRefError)return process.env.NODE_ENV!=="production"&&!this.getRootProps.suppressRefError&&!this.props.suppressRefError&&lp(s,this.getRootProps),s;if(ki(s))return y.cloneElement(s,this.getRootProps(Fi(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(y.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Gd,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&ep(n)&&!n.hasOwnProperty("toString")&&console.warn("downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.","The object that was passed:",n),String(n))},onStateChange:De,onInputValueChange:De,onUserAction:De,onChange:De,onSelect:De,onOuterClick:De,selectedItemChanged:function(n,o){return n!==o},environment:typeof window>"u"?void 0:window,stateReducer:function(n,o){return o},suppressRefError:!1,scrollIntoView:Pi},e.stateChangeTypes=rp,e}();process.env.NODE_ENV!=="production"&&(up.propTypes={children:A.func,defaultHighlightedIndex:A.number,defaultIsOpen:A.bool,initialHighlightedIndex:A.number,initialSelectedItem:A.any,initialInputValue:A.string,initialIsOpen:A.bool,getA11yStatusMessage:A.func,itemToString:A.func,onChange:A.func,onSelect:A.func,onStateChange:A.func,onInputValueChange:A.func,onUserAction:A.func,onOuterClick:A.func,selectedItemChanged:A.func,stateReducer:A.func,itemCount:A.number,id:A.string,environment:A.shape({addEventListener:A.func.isRequired,removeEventListener:A.func.isRequired,document:A.shape({createElement:A.func.isRequired,getElementById:A.func.isRequired,activeElement:A.any.isRequired,body:A.any.isRequired}).isRequired,Node:A.func.isRequired}),suppressRefError:A.bool,scrollIntoView:A.func,selectedItem:A.any,isOpen:A.bool,inputValue:A.string,highlightedIndex:A.number,labelId:A.string,inputId:A.string,menuId:A.string,getItemId:A.func});function Ko(e,t){var n=t.refKey;e||console.error('downshift: The ref prop "'+n+'" from getMenuProps was not applied correctly on your menu element.')}function lp(e,t){var n=t.refKey,o=n!=="ref",i=!ki(e);i&&!o&&!jo.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!i&&o&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!jo.isForwardRef(e)&&!Fi(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Qi={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function dp(e,t,n){var o=e.props,i=e.type,r={};Object.keys(t).forEach(function(s){pp(s,e,t,n),n[s]!==t[s]&&(r[s]=n[s])}),o.onStateChange&&Object.keys(r).length&&o.onStateChange(ne({type:i},r))}function pp(e,t,n,o){var i=t.props,r=t.type,s="on"+Nr(e)+"Change";i[s]&&o[e]!==void 0&&o[e]!==n[e]&&i[s](ne({type:r},o))}function fp(e,t){return t.changes}var Lo=Or(function(e,t){Ki(e,t)},200),hp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?y.useLayoutEffect:y.useEffect,mp="useId"in y?function(t){var n=t.id,o=t.labelId,i=t.menuId,r=t.getItemId,s=t.toggleButtonId,c=t.inputId,u="downshift-"+y.useId();n||(n=u);var d=y.useRef({labelId:o||n+"-label",menuId:i||n+"-menu",getItemId:r||function(p){return n+"-item-"+p},toggleButtonId:s||n+"-toggle-button",inputId:c||n+"-input"});return d.current}:function(t){var n=t.id,o=n===void 0?"downshift-"+Di():n,i=t.labelId,r=t.menuId,s=t.getItemId,c=t.toggleButtonId,u=t.inputId,d=y.useRef({labelId:i||o+"-label",menuId:r||o+"-menu",getItemId:s||function(p){return o+"-item-"+p},toggleButtonId:c||o+"-toggle-button",inputId:u||o+"-input"});return d.current};function gp(e,t,n,o){var i,r;if(e===void 0){if(t===void 0)throw new Error(o);i=n[t],r=t}else r=t===void 0?n.indexOf(e):t,i=e;return[i,r]}function Nr(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function es(e){var t=y.useRef(e);return t.current=e,t}function yp(e,t,n,o){var i=y.useRef(),r=y.useRef(),s=y.useCallback(function(f,m){r.current=m,f=_n(f,m.props);var x=e(f,m),w=m.props.stateReducer(f,ne({},m,{changes:x}));return w},[e]),c=y.useReducer(s,t,n),u=c[0],d=c[1],p=es(t),h=y.useCallback(function(f){return d(ne({props:p.current},f))},[p]),g=r.current;return y.useEffect(function(){var f=_n(i.current,g==null?void 0:g.props),m=g&&i.current&&!o(f,u);m&&dp(g,f,u),i.current=u},[u,g,o]),[u,h]}var qt={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:fp,scrollIntoView:Pi,environment:typeof window>"u"?void 0:window};function ut(e,t,n){n===void 0&&(n=Qi);var o=e["default"+Nr(t)];return o!==void 0?o:n[t]}function Wt(e,t,n){n===void 0&&(n=Qi);var o=e[t];if(o!==void 0)return o;var i=e["initial"+Nr(t)];return i!==void 0?i:ut(e,t,n)}function vp(e){var t=Wt(e,"selectedItem"),n=Wt(e,"isOpen"),o=bp(e),i=Wt(e,"inputValue");return{highlightedIndex:o<0&&t&&n?e.items.findIndex(function(r){return e.itemToKey(r)===e.itemToKey(t)}):o,isOpen:n,selectedItem:t,inputValue:i}}function Jt(e,t,n){var o=e.items,i=e.initialHighlightedIndex,r=e.defaultHighlightedIndex,s=e.isItemDisabled,c=e.itemToKey,u=t.selectedItem,d=t.highlightedIndex;return o.length===0?-1:i!==void 0&&d===i&&!s(o[i],i)?i:r!==void 0&&!s(o[r],r)?r:u?o.findIndex(function(p){return c(u)===c(p)}):n<0&&!s(o[o.length-1],o.length-1)?o.length-1:n>0&&!s(o[0],0)?0:-1}function Ip(e,t,n){var o=y.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return y.useEffect(function(){if(!e)return De;var i=n.map(function(p){return p.current});function r(){o.current.isTouchEnd=!1,o.current.isMouseDown=!0}function s(p){o.current.isMouseDown=!1,Cn(p.target,i,e)||t()}function c(){o.current.isTouchEnd=!1,o.current.isTouchMove=!1}function u(){o.current.isTouchMove=!0}function d(p){o.current.isTouchEnd=!0,!o.current.isTouchMove&&!Cn(p.target,i,e,!1)&&t()}return e.addEventListener("mousedown",r),e.addEventListener("mouseup",s),e.addEventListener("touchstart",c),e.addEventListener("touchmove",u),e.addEventListener("touchend",d),function(){e.removeEventListener("mousedown",r),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",c),e.removeEventListener("touchmove",u),e.removeEventListener("touchend",d)}},[n,e,t]),o.current}var ts=function(){return De};process.env.NODE_ENV!=="production"&&(ts=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];var i=y.useRef(n.reduce(function(s,c){return s[c]={},s},{}));y.useEffect(function(){Object.keys(i.current).forEach(function(s){var c=i.current[s];if(!Object.keys(c).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var u=c.suppressRefError,d=c.refKey,p=c.elementRef;u||p!=null&&p.current||console.error('downshift: The ref prop "'+d+'" from '+s+" was not applied correctly on your element.")})},[]);var r=y.useCallback(function(s,c,u,d){i.current[s]={suppressRefError:c,refKey:u,elementRef:d}},[]);return r});function wp(e,t,n,o){o===void 0&&(o={});var i=o.document,r=Pn();y.useEffect(function(){if(!(!e||r||!i)){var s=e(t);Lo(s,i)}},n),y.useEffect(function(){return function(){Lo.cancel(),np(i)}},[i])}function xp(e){var t=e.highlightedIndex,n=e.isOpen,o=e.itemRefs,i=e.getItemNodeFromIndex,r=e.menuElement,s=e.scrollIntoView,c=y.useRef(!0);return hp(function(){t<0||!n||!Object.keys(o.current).length||(c.current===!1?c.current=!0:s(i(t),r))},[t]),c}var ns=De;process.env.NODE_ENV!=="production"&&(ns=function(t){var n=t.props,o=t.state,i=y.useRef(n),r=Pn();y.useEffect(function(){r||(Sr(o,i.current,n),i.current=n)},[o,n,r])});function $o(e,t,n){var o;n===void 0&&(n=!0);var i=((o=e.items)==null?void 0:o.length)&&t>=0;return ne({isOpen:!1,highlightedIndex:-1},i&&ne({selectedItem:e.items[t],isOpen:ut(e,"isOpen"),highlightedIndex:ut(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function _p(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Pn(){var e=y.useRef(!0);return y.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function lr(e){var t=ut(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function bp(e){var t=Wt(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var wn={environment:A.shape({addEventListener:A.func.isRequired,removeEventListener:A.func.isRequired,document:A.shape({createElement:A.func.isRequired,getElementById:A.func.isRequired,activeElement:A.any.isRequired,body:A.any.isRequired}).isRequired,Node:A.func.isRequired}),itemToString:A.func,itemToKey:A.func,stateReducer:A.func},rs=ne({},wn,{getA11yStatusMessage:A.func,highlightedIndex:A.number,defaultHighlightedIndex:A.number,initialHighlightedIndex:A.number,isOpen:A.bool,defaultIsOpen:A.bool,initialIsOpen:A.bool,selectedItem:A.any,initialSelectedItem:A.any,defaultSelectedItem:A.any,id:A.string,labelId:A.string,menuId:A.string,getItemId:A.func,toggleButtonId:A.string,onSelectedItemChange:A.func,onHighlightedIndexChange:A.func,onStateChange:A.func,onIsOpenChange:A.func,scrollIntoView:A.func});function Cp(e,t,n){var o=t.type,i=t.props,r;switch(o){case n.ItemMouseMove:r={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:r={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:r={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Jt(i,e,0)};break;case n.FunctionOpenMenu:r={isOpen:!0,highlightedIndex:Jt(i,e,0)};break;case n.FunctionCloseMenu:r={isOpen:!1};break;case n.FunctionSetHighlightedIndex:r={highlightedIndex:i.isItemDisabled(i.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:r={inputValue:t.inputValue};break;case n.FunctionReset:r={highlightedIndex:lr(i),isOpen:ut(i,"isOpen"),selectedItem:ut(i,"selectedItem"),inputValue:ut(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return ne({},e,r)}Tt(Tt({},rs),{items:A.array.isRequired,isItemDisabled:A.func});Tt(Tt({},qt),{isItemDisabled:function(){return!1}});process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;var Er=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Tr=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Rr=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Ar=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,jr=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Pr=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Dr=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,kr=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Fr=process.env.NODE_ENV!=="production"?"__input_change__":8,On=process.env.NODE_ENV!=="production"?"__input_blur__":9,Mr=process.env.NODE_ENV!=="production"?"__input_click__":10,os=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,is=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,Kr=process.env.NODE_ENV!=="production"?"__item_click__":13,ss=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,as=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,cs=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,us=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,ls=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,Lr=process.env.NODE_ENV!=="production"?"__function_select_item__":19,ds=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,ps=process.env.NODE_ENV!=="production"?"__function_reset__":21,$r=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,fs=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:$r,FunctionCloseMenu:us,FunctionOpenMenu:cs,FunctionReset:ps,FunctionSelectItem:Lr,FunctionSetHighlightedIndex:ls,FunctionSetInputValue:ds,FunctionToggleMenu:as,InputBlur:On,InputChange:Fr,InputClick:Mr,InputKeyDownArrowDown:Er,InputKeyDownArrowUp:Tr,InputKeyDownEnd:jr,InputKeyDownEnter:kr,InputKeyDownEscape:Rr,InputKeyDownHome:Ar,InputKeyDownPageDown:Dr,InputKeyDownPageUp:Pr,ItemClick:Kr,ItemMouseMove:is,MenuMouseLeave:os,ToggleButtonClick:ss});function Op(e){var t=vp(e),n=t.selectedItem,o=t.inputValue;return o===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(o=e.itemToString(n)),ne({},t,{inputValue:o})}var Sp=ne({},rs,{items:A.array.isRequired,isItemDisabled:A.func,inputValue:A.string,defaultInputValue:A.string,initialInputValue:A.string,inputId:A.string,onInputValueChange:A.func});function Np(e,t,n,o){var i=y.useRef(),r=yp(e,t,n,o),s=r[0],c=r[1],u=Pn();return y.useEffect(function(){if(bn(t,"selectedItem")){if(!u){var d=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);d&&c({type:$r,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[_n(s,t),c]}var hs=De;process.env.NODE_ENV!=="production"&&(hs=function(t,n){A.checkPropTypes(Sp,t,"prop",n.name)});var Ep=ne({},qt,{isItemDisabled:function(){return!1}});function Tp(e,t){var n,o=t.type,i=t.props,r=t.altKey,s;switch(o){case Kr:s={isOpen:ut(i,"isOpen"),highlightedIndex:lr(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case Er:e.isOpen?s={highlightedIndex:wt(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:r&&e.selectedItem==null?-1:Jt(i,e,1),isOpen:i.items.length>=0};break;case Tr:e.isOpen?r?s=$o(i,e.highlightedIndex):s={highlightedIndex:wt(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:Jt(i,e,-1),isOpen:i.items.length>=0};break;case kr:s=$o(i,e.highlightedIndex);break;case Rr:s=ne({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Pr:s={highlightedIndex:wt(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case Dr:s={highlightedIndex:wt(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case Ar:s={highlightedIndex:Rt(0,!1,i.items,i.isItemDisabled)};break;case jr:s={highlightedIndex:Rt(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case On:s=ne({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=i.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])});break;case Fr:s={isOpen:!0,highlightedIndex:lr(i),inputValue:t.inputValue};break;case Mr:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Jt(i,e,0)};break;case Lr:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case $r:s={inputValue:t.inputValue};break;default:return Cp(e,t,fs)}return ne({},e,s)}var Rp=["onMouseLeave","refKey","ref"],Ap=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],jp=["onClick","onPress","refKey","ref"],Pp=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];Hr.stateChangeTypes=fs;function Hr(e){e===void 0&&(e={}),hs(e,Hr);var t=ne({},Ep,e),n=t.items,o=t.scrollIntoView,i=t.environment,r=t.getA11yStatusMessage,s=Np(Tp,t,Op,_p),c=s[0],u=s[1],d=c.isOpen,p=c.highlightedIndex,h=c.selectedItem,g=c.inputValue,f=y.useRef(null),m=y.useRef({}),x=y.useRef(null),w=y.useRef(null),O=Pn(),v=mp(t),C=y.useRef(),b=es({state:c,props:t}),I=y.useCallback(function(F){return m.current[v.getItemId(F)]},[v]);wp(r,c,[d,p,h,g],i);var S=xp({menuElement:f.current,highlightedIndex:p,isOpen:d,itemRefs:m,scrollIntoView:o,getItemNodeFromIndex:I});ns({props:t,state:c}),y.useEffect(function(){var F=Wt(t,"isOpen");F&&x.current&&x.current.focus()},[]),y.useEffect(function(){O||(C.current=n.length)});var H=Ip(i,y.useCallback(function(){b.current.state.isOpen&&u({type:On,selectItem:!1})},[u,b]),y.useMemo(function(){return[f,w,x]},[f.current,w.current,x.current])),k=ts("getInputProps","getMenuProps");y.useEffect(function(){d||(m.current={})},[d]),y.useEffect(function(){var F;!d||!(i!=null&&i.document)||!(x!=null&&(F=x.current)!=null&&F.focus)||i.document.activeElement!==x.current&&x.current.focus()},[d,i]);var V=y.useMemo(function(){return{ArrowDown:function(D){D.preventDefault(),u({type:Er,altKey:D.altKey})},ArrowUp:function(D){D.preventDefault(),u({type:Tr,altKey:D.altKey})},Home:function(D){b.current.state.isOpen&&(D.preventDefault(),u({type:Ar}))},End:function(D){b.current.state.isOpen&&(D.preventDefault(),u({type:jr}))},Escape:function(D){var P=b.current.state;(P.isOpen||P.inputValue||P.selectedItem||P.highlightedIndex>-1)&&(D.preventDefault(),u({type:Rr}))},Enter:function(D){var P=b.current.state;!P.isOpen||D.which===229||(D.preventDefault(),u({type:kr}))},PageUp:function(D){b.current.state.isOpen&&(D.preventDefault(),u({type:Pr}))},PageDown:function(D){b.current.state.isOpen&&(D.preventDefault(),u({type:Dr}))}}},[u,b]),z=y.useCallback(function(F){return ne({id:v.labelId,htmlFor:v.inputId},F)},[v]),X=y.useCallback(function(F,D){var P,R=F===void 0?{}:F,B=R.onMouseLeave,W=R.refKey,U=W===void 0?"ref":W,J=R.ref,q=nt(R,Rp),oe=D===void 0?{}:D,j=oe.suppressRefError,de=j===void 0?!1:j;return k("getMenuProps",de,U,f),ne((P={},P[U]=Nt(J,function(L){f.current=L}),P.id=v.menuId,P.role="listbox",P["aria-labelledby"]=q&&q["aria-label"]?void 0:""+v.labelId,P.onMouseLeave=we(B,function(){u({type:os})}),P),q)},[u,k,v]),Z=y.useCallback(function(F){var D,P,R=F===void 0?{}:F,B=R.item,W=R.index,U=R.refKey,J=U===void 0?"ref":U,q=R.ref,oe=R.onMouseMove,j=R.onMouseDown,de=R.onClick;R.onPress;var L=R.disabled,Ee=nt(R,Ap);L!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Te=b.current,Ge=Te.props,Ve=Te.state,Ct=gp(B,W,Ge.items,"Pass either item or index to getItemProps!"),Mt=Ct[0],Ue=Ct[1],ft=Ge.isItemDisabled(Mt,Ue),Kt="onClick",Ot=de,Je=function(){H.isTouchEnd||Ue===Ve.highlightedIndex||(S.current=!1,u({type:is,index:Ue,disabled:ft}))},Ze=function(){u({type:Kr,index:Ue})},je=function(en){return en.preventDefault()};return ne((D={},D[J]=Nt(q,function(Re){Re&&(m.current[v.getItemId(Ue)]=Re)}),D["aria-disabled"]=ft,D["aria-selected"]=Ue===Ve.highlightedIndex,D.id=v.getItemId(Ue),D.role="option",D),!ft&&(P={},P[Kt]=we(Ot,Ze),P),{onMouseMove:we(oe,Je),onMouseDown:we(j,je)},Ee)},[u,v,b,H,S]),te=y.useCallback(function(F){var D,P=F===void 0?{}:F,R=P.onClick;P.onPress;var B=P.refKey,W=B===void 0?"ref":B,U=P.ref,J=nt(P,jp),q=b.current.state,oe=function(){u({type:ss})};return ne((D={},D[W]=Nt(U,function(j){w.current=j}),D["aria-controls"]=v.menuId,D["aria-expanded"]=q.isOpen,D.id=v.toggleButtonId,D.tabIndex=-1,D),!J.disabled&&ne({},{onClick:we(R,oe)}),J)},[u,b,v]),Q=y.useCallback(function(F,D){var P,R=F===void 0?{}:F,B=R.onKeyDown,W=R.onChange,U=R.onInput,J=R.onBlur;R.onChangeText;var q=R.onClick,oe=R.refKey,j=oe===void 0?"ref":oe,de=R.ref,L=nt(R,Pp),Ee=D===void 0?{}:D,Te=Ee.suppressRefError,Ge=Te===void 0?!1:Te;k("getInputProps",Ge,j,x);var Ve=b.current.state,Ct=function(je){var Re=cr(je);Re&&V[Re]&&V[Re](je)},Mt=function(je){u({type:Fr,inputValue:je.target.value})},Ue=function(je){if(i!=null&&i.document&&Ve.isOpen&&!H.isMouseDown){var Re=je.relatedTarget===null&&i.document.activeElement!==i.document.body;u({type:On,selectItem:!Re})}},ft=function(){u({type:Mr})},Kt="onChange",Ot={};if(!L.disabled){var Je;Ot=(Je={},Je[Kt]=we(W,U,Mt),Je.onKeyDown=we(B,Ct),Je.onBlur=we(J,Ue),Je.onClick=we(q,ft),Je)}return ne((P={},P[j]=Nt(de,function(Ze){x.current=Ze}),P["aria-activedescendant"]=Ve.isOpen&&Ve.highlightedIndex>-1?v.getItemId(Ve.highlightedIndex):"",P["aria-autocomplete"]="list",P["aria-controls"]=v.menuId,P["aria-expanded"]=Ve.isOpen,P["aria-labelledby"]=L&&L["aria-label"]?void 0:v.labelId,P.autoComplete="off",P.id=v.inputId,P.role="combobox",P.value=Ve.inputValue,P),Ot,L)},[u,v,i,V,b,H,k]),ue=y.useCallback(function(){u({type:as})},[u]),le=y.useCallback(function(){u({type:us})},[u]),re=y.useCallback(function(){u({type:cs})},[u]),Oe=y.useCallback(function(F){u({type:ls,highlightedIndex:F})},[u]),Ne=y.useCallback(function(F){u({type:Lr,selectedItem:F})},[u]),T=y.useCallback(function(F){u({type:ds,inputValue:F})},[u]),K=y.useCallback(function(){u({type:ps})},[u]);return{getItemProps:Z,getLabelProps:z,getMenuProps:X,getInputProps:Q,getToggleButtonProps:te,toggleMenu:ue,openMenu:re,closeMenu:le,setHighlightedIndex:Oe,setInputValue:T,selectItem:Ne,reset:K,highlightedIndex:p,isOpen:d,selectedItem:h,inputValue:g}}wn.stateReducer,wn.itemToKey,wn.environment,A.array,A.array,A.array,A.func,A.number,A.number,A.number,A.func,A.func,A.string,A.string;qt.itemToKey,qt.stateReducer,qt.environment;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;const Dp="_comboboxContainer_12y8e_1",kp="_label_12y8e_8",Fp="_inputContainer_12y8e_12",Mp="_input_12y8e_12",Kp="_toggleButton_12y8e_25",Lp="_menu_12y8e_30",$p="_menuItem_12y8e_43",Hp="_highlighted_12y8e_50",Vp="_selected_12y8e_54",Up="_hidden_12y8e_58",tt={comboboxContainer:Dp,label:kp,inputContainer:Fp,input:Mp,toggleButton:Kp,menu:Lp,menuItem:$p,highlighted:Hp,selected:Vp,hidden:Up};function Bp(e){const t=e.toLowerCase();return function(o){return!e||o.label.toLowerCase().includes(t)||o.value.toLowerCase().includes(t)}}function qp({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:o}){const[i,r]=y.useState(e),s=f=>{r(e.filter(Bp(f)))},{isOpen:c,getToggleButtonProps:u,getMenuProps:d,getInputProps:p,highlightedIndex:h,getItemProps:g}=Hr({items:i,selectedItem:t?e.find(f=>f.value===t):null,itemToString:f=>(f==null?void 0:f.label)||"",onInputValueChange:({inputValue:f})=>s(f),onSelectedItemChange:({selectedItem:f})=>n(f)});return a.jsxs("div",{children:[a.jsx("div",{className:tt.comboboxContainer,children:a.jsxs("div",{className:tt.inputContainer,children:[a.jsx("input",{placeholder:o,className:tt.input,...p()}),a.jsx("button",{"aria-label":"toggle menu",className:tt.toggleButton,type:"button",...u(),children:c?a.jsx(a.Fragment,{children:"↑"}):a.jsx(a.Fragment,{children:"↓"})})]})}),a.jsx("ul",{className:`${tt.menu} ${c&&e.length?"":tt.hidden}`,...d(),children:c&&i.map((f,m)=>a.jsx("li",{className:`${tt.menuItem} ${h===m?tt.highlighted:""} ${t===(f==null?void 0:f.value)?tt.selected:""}`,...g({item:f,index:m}),children:a.jsx("span",{children:f.label})},f.id))})]})}const ms=y.createContext(null);function gs(){const e=y.useContext(ms);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const ys=y.createContext(()=>{});function Wp(){const e=y.useContext(ys);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var vs=Symbol.for("immer-nothing"),Ho=Symbol.for("immer-draftable"),ke=Symbol.for("immer-state"),Jp=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Ae(e,...t){if(process.env.NODE_ENV!=="production"){const n=Jp[e],o=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var At=Object.getPrototypeOf;function jt(e){return!!e&&!!e[ke]}function _t(e){var t;return e?Is(e)||Array.isArray(e)||!!e[Ho]||!!((t=e.constructor)!=null&&t[Ho])||kn(e)||Fn(e):!1}var zp=Object.prototype.constructor.toString();function Is(e){if(!e||typeof e!="object")return!1;const t=At(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===zp}function Sn(e,t){Dn(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,o)=>t(o,n,e))}function Dn(e){const t=e[ke];return t?t.type_:Array.isArray(e)?1:kn(e)?2:Fn(e)?3:0}function dr(e,t){return Dn(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ws(e,t,n){const o=Dn(e);o===2?e.set(t,n):o===3?e.add(n):e[t]=n}function Xp(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function kn(e){return e instanceof Map}function Fn(e){return e instanceof Set}function It(e){return e.copy_||e.base_}function pr(e,t){if(kn(e))return new Map(e);if(Fn(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Is(e);if(t===!0||t==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(e);delete o[ke];let i=Reflect.ownKeys(o);for(let r=0;r<i.length;r++){const s=i[r],c=o[s];c.writable===!1&&(c.writable=!0,c.configurable=!0),(c.get||c.set)&&(o[s]={configurable:!0,writable:!0,enumerable:c.enumerable,value:e[s]})}return Object.create(At(e),o)}else{const o=At(e);if(o!==null&&n)return{...e};const i=Object.create(o);return Object.assign(i,e)}}function Vr(e,t=!1){return Mn(e)||jt(e)||!_t(e)||(Dn(e)>1&&(e.set=e.add=e.clear=e.delete=Yp),Object.freeze(e),t&&Object.entries(e).forEach(([n,o])=>Vr(o,!0))),e}function Yp(){Ae(2)}function Mn(e){return Object.isFrozen(e)}var Gp={};function bt(e){const t=Gp[e];return t||Ae(0,e),t}var Xt;function xs(){return Xt}function Zp(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Vo(e,t){t&&(bt("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fr(e){hr(e),e.drafts_.forEach(Qp),e.drafts_=null}function hr(e){e===Xt&&(Xt=e.parent_)}function Uo(e){return Xt=Zp(Xt,e)}function Qp(e){const t=e[ke];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Bo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[ke].modified_&&(fr(t),Ae(4)),_t(e)&&(e=Nn(t,e),t.parent_||En(t,e)),t.patches_&&bt("Patches").generateReplacementPatches_(n[ke].base_,e,t.patches_,t.inversePatches_)):e=Nn(t,n,[]),fr(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==vs?e:void 0}function Nn(e,t,n){if(Mn(t))return t;const o=t[ke];if(!o)return Sn(t,(i,r)=>qo(e,o,t,i,r,n)),t;if(o.scope_!==e)return t;if(!o.modified_)return En(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const i=o.copy_;let r=i,s=!1;o.type_===3&&(r=new Set(i),i.clear(),s=!0),Sn(r,(c,u)=>qo(e,o,i,c,u,n,s)),En(e,i,!1),n&&e.patches_&&bt("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function qo(e,t,n,o,i,r,s){if(process.env.NODE_ENV!=="production"&&i===n&&Ae(5),jt(i)){const c=r&&t&&t.type_!==3&&!dr(t.assigned_,o)?r.concat(o):void 0,u=Nn(e,i,c);if(ws(n,o,u),jt(u))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(_t(i)&&!Mn(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Nn(e,i),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,o)&&En(e,i)}}function En(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Vr(t,n)}function ef(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:xs(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=o,r=Ur;n&&(i=[o],r=Yt);const{revoke:s,proxy:c}=Proxy.revocable(i,r);return o.draft_=c,o.revoke_=s,c}var Ur={get(e,t){if(t===ke)return e;const n=It(e);if(!dr(n,t))return tf(e,n,t);const o=n[t];return e.finalized_||!_t(o)?o:o===tr(e.base_,t)?(nr(e),e.copy_[t]=gr(o,e)):o},has(e,t){return t in It(e)},ownKeys(e){return Reflect.ownKeys(It(e))},set(e,t,n){const o=_s(It(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const i=tr(It(e),t),r=i==null?void 0:i[ke];if(r&&r.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Xp(n,i)&&(n!==void 0||dr(e.base_,t)))return!0;nr(e),mr(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return tr(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,nr(e),mr(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=It(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:n[t]}},defineProperty(){Ae(11)},getPrototypeOf(e){return At(e.base_)},setPrototypeOf(){Ae(12)}},Yt={};Sn(Ur,(e,t)=>{Yt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Yt.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ae(13),Yt.set.call(this,e,t,void 0)};Yt.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ae(14),Ur.set.call(this,e[0],t,n,e[0])};function tr(e,t){const n=e[ke];return(n?It(n):e)[t]}function tf(e,t,n){var i;const o=_s(t,n);return o?"value"in o?o.value:(i=o.get)==null?void 0:i.call(e.draft_):void 0}function _s(e,t){if(!(t in e))return;let n=At(e);for(;n;){const o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=At(n)}}function mr(e){e.modified_||(e.modified_=!0,e.parent_&&mr(e.parent_))}function nr(e){e.copy_||(e.copy_=pr(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var nf=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,o)=>{if(typeof t=="function"&&typeof n!="function"){const r=n;n=t;const s=this;return function(u=r,...d){return s.produce(u,p=>n.call(this,p,...d))}}typeof n!="function"&&Ae(6),o!==void 0&&typeof o!="function"&&Ae(7);let i;if(_t(t)){const r=Uo(this),s=gr(t,void 0);let c=!0;try{i=n(s),c=!1}finally{c?fr(r):hr(r)}return Vo(r,o),Bo(i,r)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===vs&&(i=void 0),this.autoFreeze_&&Vr(i,!0),o){const r=[],s=[];bt("Patches").generateReplacementPatches_(t,i,r,s),o(r,s)}return i}else Ae(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...c)=>this.produceWithPatches(s,u=>t(u,...c));let o,i;return[this.produce(t,n,(s,c)=>{o=s,i=c}),o,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){_t(e)||Ae(8),jt(e)&&(e=rf(e));const t=Uo(this),n=gr(e,void 0);return n[ke].isManual_=!0,hr(t),n}finishDraft(e,t){const n=e&&e[ke];(!n||!n.isManual_)&&Ae(9);const{scope_:o}=n;return Vo(o,t),Bo(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const o=bt("Patches").applyPatches_;return jt(e)?o(e,t):this.produce(e,i=>o(i,t))}};function gr(e,t){const n=kn(e)?bt("MapSet").proxyMap_(e,t):Fn(e)?bt("MapSet").proxySet_(e,t):ef(e,t);return(t?t.scope_:xs()).drafts_.push(n),n}function rf(e){return jt(e)||Ae(10,e),bs(e)}function bs(e){if(!_t(e)||Mn(e))return e;const t=e[ke];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=pr(e,t.scope_.immer_.useStrictShallowCopy_)}else n=pr(e,!0);return Sn(n,(o,i)=>{ws(n,o,bs(i))}),t&&(t.finalized_=!1),n}var Fe=new nf,Bt=Fe.produce;Fe.produceWithPatches.bind(Fe);Fe.setAutoFreeze.bind(Fe);Fe.setUseStrictShallowCopy.bind(Fe);Fe.applyPatches.bind(Fe);Fe.createDraft.bind(Fe);Fe.finishDraft.bind(Fe);const Cs=y.createContext(void 0),of={};function Br(){const e=y.useContext(Cs);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function sf({children:e}){const{installation:t}=We(),{hydratedRevision:n,loading:o}=Zt(),[i,r]=y.useState(of),s=t==null?void 0:t.config;y.useEffect(()=>{n!=null&&n.content&&!o&&s&&!(Object.entries(i).length>0)&&yd(n,s,r)},[n,o,s,i]);const c=y.useCallback((f,m)=>{r(x=>Bt(x,w=>{w[f]=Bt(w[f],m)}))},[r]),u=y.useCallback((f,m)=>{r(x=>Bt(x,w=>{w[f]=m}))},[r]),d=y.useCallback(()=>{r(Bt(f=>{const m=f.other.write;m&&(m.isWriteModified=!1)}))},[r]),p=y.useCallback(f=>{r(Bt(m=>{var w;const x=(w=m[f])==null?void 0:w.read;x&&(x.isOptionalFieldsModified=!1,x.isRequiredMapFieldsModified=!1)}))},[r]),h=y.useCallback(f=>{f===xt?d():p(f)},[p,d]),g=y.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:r,setConfigureState:c,resetConfigureState:u,resetPendingConfigurationState:h}),[i,u,h,c]);return a.jsx(Cs.Provider,{value:g,children:e})}const pt=()=>{const{appName:e}=Ie(),{objectConfigurationsState:t,setConfigureState:n}=Br(),{selectedObjectName:o}=gs(),i=Oi(o||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:o}};function af(e,t,n){var i;const o=((i=e==null?void 0:e.read)==null?void 0:i.selectedFieldMappings)||{};if(o[t]=n,e!=null&&e.read){const r=e.read.savedConfig.requiredMapFields,c=!_r(r,o);e.read.isRequiredMapFieldsModified=c}}function Os(e,t,n,o){t(e,i=>af(i,n,o))}function cf({field:e,onSelectChange:t,allFields:n}){var f;const{configureState:o,selectedObjectName:i,setConfigureState:r}=pt(),[s,c]=y.useState(!0),u=(f=o==null?void 0:o.read)==null?void 0:f.selectedFieldMappings,d=u==null?void 0:u[e.mapToName];y.useEffect(()=>{e._default&&!d&&i&&o&&Os(i,r,e.mapToName,e._default),c(!1)},[e,r,i,d,o]);const p=y.useMemo(()=>n==null?void 0:n.map(m=>a.jsx("option",{value:m.fieldName,children:m.displayName},m.fieldName)),[n]),h=y.useMemo(()=>n.map(m=>({id:m.fieldName,label:m.displayName,value:m.fieldName})),[n]),g=ve?a.jsx(qp,{items:h,selectedValue:d||null,onSelectedItemChange:m=>{t({target:{name:e.mapToName,value:m==null?void 0:m.value}})},placeholder:"Please select one"}):a.jsx(N.Select,{name:e.mapToName,variant:"flushed",value:d||void 0,onChange:t,placeholder:d?void 0:"Please select one",disabled:s,children:p});return a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[a.jsx("h3",{style:{fontWeight:500},children:e.mapToDisplayName}),a.jsx("p",{style:{paddingBottom:"1rem"},children:e==null?void 0:e.prompt}),g]},e.mapToName)}const uf="_divider_j6suu_1",Wo={divider:uf};function qr({className:e,style:t}){return ve?a.jsx("hr",{className:e?`${Wo.divider} ${e}`:Wo.divider,style:t}):a.jsx(N.Divider,{className:e,style:t})}const lf=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-text-secondary").trim()||"#737373";function Ft({string:e}){return a.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"2rem",paddingBottom:"1rem"},children:[a.jsx("h3",{style:{color:lf,fontSize:"1rem",fontWeight:"500"},children:e}),a.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:a.jsx(qr,{style:{marginLeft:"1rem"}})})]})}function df(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=pt(),{fieldMapping:o}=We(),{isError:i,removeError:r}=dt(),s=u=>{const{value:d,name:p}=u.target;d&&(e&&Os(e,n,p,d),i(me.MAPPING,p)&&r(me.MAPPING,p))},c=y.useMemo(()=>{var p;if(!e||!o)return[];const u=o?Object.values(o[e]||{}).flat():[];return(((p=t==null?void 0:t.read)==null?void 0:p.requiredMapFields)||[]).concat(u).reduce((h,g)=>h.find(m=>m.mapToName===g.mapToName)?h.map(m=>m.mapToName===g.mapToName?g:m):h.concat(g),new Array).filter(Ye)||[]},[t,o,e]);return c.length?a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:"Map the following fields (required)"}),a.jsx("div",{style:{display:"flex",gap:"2rem",flexDirection:"column"},children:c.map(u=>{var d;return a.jsxs(N.FormControl,{isInvalid:i(me.MAPPING,u.mapToName),children:[a.jsx(cf,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:u,onSelectChange:s}),a.jsx(N.FormErrorMessage,{children:" * required"})]},u.mapToName)})})]}):null}function pf(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Ss(...e){return t=>e.forEach(n=>pf(n,t))}function Ns(...e){return Y.useCallback(Ss(...e),e)}function ff(e,t=[]){let n=[];function o(r,s){const c=Y.createContext(s),u=n.length;n=[...n,s];const d=h=>{var O;const{scope:g,children:f,...m}=h,x=((O=g==null?void 0:g[e])==null?void 0:O[u])||c,w=Y.useMemo(()=>m,Object.values(m));return a.jsx(x.Provider,{value:w,children:f})};d.displayName=r+"Provider";function p(h,g){var x;const f=((x=g==null?void 0:g[e])==null?void 0:x[u])||c,m=Y.useContext(f);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${h}\` must be used within \`${r}\``)}return[d,p]}const i=()=>{const r=n.map(s=>Y.createContext(s));return function(c){const u=(c==null?void 0:c[e])||r;return Y.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return i.scopeName=e,[o,hf(i,...t)]}function hf(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(r){const s=o.reduce((c,{useScope:u,scopeName:d})=>{const h=u(r)[`__scope${d}`];return{...c,...h}},{});return Y.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Jo(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function Es(e){const t=Y.useRef(e);return Y.useEffect(()=>{t.current=e}),Y.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function mf({prop:e,defaultProp:t,onChange:n=()=>{}}){const[o,i]=gf({defaultProp:t,onChange:n}),r=e!==void 0,s=r?e:o,c=Es(n),u=Y.useCallback(d=>{if(r){const h=typeof d=="function"?d(e):d;h!==e&&c(h)}else i(d)},[r,e,i,c]);return[s,u]}function gf({defaultProp:e,onChange:t}){const n=Y.useState(e),[o]=n,i=Y.useRef(o),r=Es(t);return Y.useEffect(()=>{i.current!==o&&(r(o),i.current=o)},[o,i,r]),n}function yf(e){const t=Y.useRef({value:e,previous:e});return Y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var yr=globalThis!=null&&globalThis.document?Y.useLayoutEffect:()=>{};function vf(e){const[t,n]=Y.useState(void 0);return yr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const r=i[0];let s,c;if("borderBoxSize"in r){const u=r.borderBoxSize,d=Array.isArray(u)?u[0]:u;s=d.inlineSize,c=d.blockSize}else s=e.offsetWidth,c=e.offsetHeight;n({width:s,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}function If(e,t){return Y.useReducer((n,o)=>t[n][o]??n,e)}var Ts=e=>{const{present:t,children:n}=e,o=wf(t),i=typeof n=="function"?n({present:o.isPresent}):Y.Children.only(n),r=Ns(o.ref,xf(i));return typeof n=="function"||o.isPresent?Y.cloneElement(i,{ref:r}):null};Ts.displayName="Presence";function wf(e){const[t,n]=Y.useState(),o=Y.useRef({}),i=Y.useRef(e),r=Y.useRef("none"),s=e?"mounted":"unmounted",[c,u]=If(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Y.useEffect(()=>{const d=mn(o.current);r.current=c==="mounted"?d:"none"},[c]),yr(()=>{const d=o.current,p=i.current;if(p!==e){const g=r.current,f=mn(d);e?u("MOUNT"):f==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(p&&g!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),yr(()=>{if(t){let d;const p=t.ownerDocument.defaultView??window,h=f=>{const x=mn(o.current).includes(f.animationName);if(f.target===t&&x&&(u("ANIMATION_END"),!i.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",d=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},g=f=>{f.target===t&&(r.current=mn(o.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{p.clearTimeout(d),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:Y.useCallback(d=>{d&&(o.current=getComputedStyle(d)),n(d)},[])}}function mn(e){return(e==null?void 0:e.animationName)||"none"}function xf(e){var o,i;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Rs=Y.forwardRef((e,t)=>{const{children:n,...o}=e,i=Y.Children.toArray(n),r=i.find(bf);if(r){const s=r.props.children,c=i.map(u=>u===r?Y.Children.count(s)>1?Y.Children.only(null):Y.isValidElement(s)?s.props.children:null:u);return a.jsx(vr,{...o,ref:t,children:Y.isValidElement(s)?Y.cloneElement(s,void 0,c):null})}return a.jsx(vr,{...o,ref:t,children:n})});Rs.displayName="Slot";var vr=Y.forwardRef((e,t)=>{const{children:n,...o}=e;if(Y.isValidElement(n)){const i=Of(n);return Y.cloneElement(n,{...Cf(o,n.props),ref:t?Ss(t,i):i})}return Y.Children.count(n)>1?Y.Children.only(null):null});vr.displayName="SlotClone";var _f=({children:e})=>a.jsx(a.Fragment,{children:e});function bf(e){return Y.isValidElement(e)&&e.type===_f}function Cf(e,t){const n={...t};for(const o in t){const i=e[o],r=t[o];/^on[A-Z]/.test(o)?i&&r?n[o]=(...c)=>{r(...c),i(...c)}:i&&(n[o]=i):o==="style"?n[o]={...i,...r}:o==="className"&&(n[o]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}function Of(e){var o,i;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Sf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],As=Sf.reduce((e,t)=>{const n=Y.forwardRef((o,i)=>{const{asChild:r,...s}=o,c=r?Rs:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Wr="Checkbox",[Nf,Sm]=ff(Wr),[Ef,Tf]=Nf(Wr),js=Y.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:o,checked:i,defaultChecked:r,required:s,disabled:c,value:u="on",onCheckedChange:d,form:p,...h}=e,[g,f]=Y.useState(null),m=Ns(t,b=>f(b)),x=Y.useRef(!1),w=g?p||!!g.closest("form"):!0,[O=!1,v]=mf({prop:i,defaultProp:r,onChange:d}),C=Y.useRef(O);return Y.useEffect(()=>{const b=g==null?void 0:g.form;if(b){const I=()=>v(C.current);return b.addEventListener("reset",I),()=>b.removeEventListener("reset",I)}},[g,v]),a.jsxs(Ef,{scope:n,state:O,disabled:c,children:[a.jsx(As.button,{type:"button",role:"checkbox","aria-checked":lt(O)?"mixed":O,"aria-required":s,"data-state":ks(O),"data-disabled":c?"":void 0,disabled:c,value:u,...h,ref:m,onKeyDown:Jo(e.onKeyDown,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:Jo(e.onClick,b=>{v(I=>lt(I)?!0:!I),w&&(x.current=b.isPropagationStopped(),x.current||b.stopPropagation())})}),w&&a.jsx(Rf,{control:g,bubbles:!x.current,name:o,value:u,checked:O,required:s,disabled:c,form:p,style:{transform:"translateX(-100%)"},defaultChecked:lt(r)?!1:r})]})});js.displayName=Wr;var Ps="CheckboxIndicator",Ds=Y.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:o,...i}=e,r=Tf(Ps,n);return a.jsx(Ts,{present:o||lt(r.state)||r.state===!0,children:a.jsx(As.span,{"data-state":ks(r.state),"data-disabled":r.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Ds.displayName=Ps;var Rf=e=>{const{control:t,checked:n,bubbles:o=!0,defaultChecked:i,...r}=e,s=Y.useRef(null),c=yf(n),u=vf(t);Y.useEffect(()=>{const p=s.current,h=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==n&&f){const m=new Event("click",{bubbles:o});p.indeterminate=lt(n),f.call(p,lt(n)?!1:n),p.dispatchEvent(m)}},[c,n,o]);const d=Y.useRef(lt(n)?!1:n);return a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??d.current,...r,tabIndex:-1,ref:s,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function lt(e){return e==="indeterminate"}function ks(e){return lt(e)?"indeterminate":e?"checked":"unchecked"}var Fs=js,Ms=Ds;function Ks(e,t){if(e==null)return{};var n={},o=Object.keys(e),i,r;for(r=0;r<o.length;r++)i=o[r],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Af=["color"],Ls=y.forwardRef(function(e,t){var n=e.color,o=n===void 0?"currentColor":n,i=Ks(e,Af);return y.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),y.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))}),jf=["color"],Pf=y.forwardRef(function(e,t){var n=e.color,o=n===void 0?"currentColor":n,i=Ks(e,jf);return y.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),y.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))});const Df="_checkboxGroupContainer_j54z7_1",kf="_stack_j54z7_6",Ff="_selectAllContainer_j54z7_11",Mf="_fieldContainer_j54z7_18",Kf="_checkbox_j54z7_1",Pt={checkboxGroupContainer:Df,stack:kf,selectAllContainer:Ff,fieldContainer:Mf,checkbox:Kf};function $s({id:e,isChecked:t,label:n,onCheckedChange:o}){return a.jsxs("div",{className:Pt.fieldContainer,children:[a.jsx(Fs,{className:Pt.checkbox,id:e,onCheckedChange:o,checked:t,children:a.jsx(Ms,{children:a.jsx(Ls,{})})}),a.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Hs({id:e,isChecked:t,label:n,onCheckedChange:o,isIndeterminate:i}){return a.jsxs("div",{className:Pt.selectAllContainer,children:[a.jsx(Fs,{className:Pt.checkbox,id:e,onCheckedChange:o,children:a.jsxs(Ms,{children:[i&&a.jsx(Pf,{}),t===!0&&a.jsx(Ls,{})]})}),a.jsx("label",{htmlFor:e,children:n})]})}function Vs({children:e}){return a.jsx("div",{className:Pt.checkboxGroupContainer,children:e})}function Us({children:e}){return a.jsx("div",{className:Pt.stack,children:e})}function Lf(e,t,n){var i,r;const o=((i=e==null?void 0:e.read)==null?void 0:i.selectedOptionalFields)||{};if(o[t]=n,n||delete o[t],(r=e.read)!=null&&r.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,u=!_r(s,o);e.read.isOptionalFieldsModified=u}else console.warn("read.savedConfig.optionalFields is undefined")}function Tn(e,t,n,o){t(e,i=>Lf(i,n,o))}function $f(){var h,g;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:o}=pt(),i=(h=t==null?void 0:t.read)==null?void 0:h.selectedOptionalFields,r=(f,m)=>{f!=="indeterminate"&&o&&t&&Tn(o,n,m,f)},s=(g=t==null?void 0:t.read)==null?void 0:g.optionalFields,c=f=>{o&&s&&s.forEach(m=>{Ye(m)||Tn(o,n,m.fieldName,f)})},u=!!(s&&s.length>0),d=Object.keys(i||{}).length===(s==null?void 0:s.length),p=!d&&Object.keys(i||{}).length>0;return u&&a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`${e} reads the following optional fields`}),a.jsxs(Vs,{children:[((s==null?void 0:s.length)||0)>=2&&a.jsx(Hs,{id:"select-all-fields",isChecked:d,label:"Select all",onCheckedChange:c,isIndeterminate:p}),a.jsx(Us,{children:s.map(f=>Ye(f)?null:a.jsx($s,{id:f.fieldName,isChecked:!!(i!=null&&i[f==null?void 0:f.fieldName]),label:f.displayName,onCheckedChange:m=>r(m,f.fieldName)},f.fieldName))})]})]})}function Hf(){var h,g;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:o}=pt(),i=(h=t==null?void 0:t.read)==null?void 0:h.selectedOptionalFields,r=f=>{const{name:m,checked:x}=f.target;o&&t&&Tn(o,n,m,x)},s=(g=t==null?void 0:t.read)==null?void 0:g.optionalFields,c=f=>{const{checked:m}=f.target;o&&s&&s.forEach(x=>{Ye(x)||Tn(o,n,x.fieldName,m)})},u=!!(s&&s.length>0),d=Object.keys(i||{}).length===(s==null?void 0:s.length),p=!d&&Object.keys(i||{}).length>0;return u&&a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`${e} reads the following optional fields`}),a.jsxs(N.Stack,{marginBottom:10,maxHeight:300,overflowY:"scroll",border:"2px solid #EFEFEF",borderRadius:8,gap:0,children:[((s==null?void 0:s.length)||0)>=2&&a.jsx(N.Box,{backgroundColor:"gray.50",paddingX:4,paddingY:2,children:a.jsx(N.Checkbox,{name:"selectAll",id:"selectAll",onChange:c,isIndeterminate:p,isChecked:d,children:"Select all"})}),s.map(f=>Ye(f)?null:a.jsx(N.Box,{paddingX:4,paddingY:2,borderBottom:"1px",borderColor:"gray.100",children:a.jsx(N.Checkbox,{name:f.fieldName,id:f.fieldName,isChecked:!!(i!=null&&i[f==null?void 0:f.fieldName]),onChange:r,children:a.jsx("p",{style:{overflowWrap:"anywhere"},children:f.displayName})})},f.fieldName))]})]})}function Vf(){return ve?a.jsx($f,{}):a.jsx(Hf,{})}const Uf=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-badge").trim()||"#e5e5e5",Bf=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-badge-text").trim()||"#404040",qf={color:Bf,backgroundColor:Uf,borderRadius:"4px",display:"inline-block",fontSize:"0.75rem",fontWeight:500,lineHeight:"1.25",padding:"0.25rem 0.5rem"};function Wf({children:e,style:t,...n}){return a.jsx("span",{style:{...qf,...t},...n,children:e})}function Jf(){var o,i,r;const{configureState:e,selectedObjectName:t}=pt(),{appName:n}=Ie();return a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`${n} reads the following ${t} fields`}),a.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:"2rem"},children:(i=(o=e==null?void 0:e.read)==null?void 0:o.requiredFields)!=null&&i.length?(r=e.read)==null?void 0:r.requiredFields.map(s=>Ye(s)?null:a.jsx(Wf,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function zf(){return a.jsxs(a.Fragment,{children:[a.jsx(Jf,{}),a.jsx(df,{}),a.jsx(Vf,{})]})}function Xf(e,t,n){var o,i,r;if(((o=e==null?void 0:e.write)==null?void 0:o.selectedNonConfigurableWriteFields)===null&&(e.write.selectedNonConfigurableWriteFields={}),e!=null&&e.write){const s=e.write.selectedNonConfigurableWriteFields;if(s[t]=n,n||delete s[t],(r=(i=e==null?void 0:e.write)==null?void 0:i.savedConfig)!=null&&r.selectedNonConfigurableWriteFields){const c=e.write.savedConfig.selectedNonConfigurableWriteFields,d=!_r(c,s);e.write.isWriteModified=d}}}function Rn(e,t,n,o){t(e,i=>{Xf(i,n,o)})}function Yf(){var h,g,f,m;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:o}=pt(),i=(h=n==null?void 0:n.write)==null?void 0:h.selectedNonConfigurableWriteFields,r=(g=n==null?void 0:n.write)==null?void 0:g.writeObjects,s=(x,w)=>{x!=="indeterminate"&&t&&n&&Rn(t,o,w,x)},c=x=>{var w,O;t&&n&&((O=(w=n==null?void 0:n.write)==null?void 0:w.writeObjects)==null||O.forEach(v=>{Rn(t,o,v.objectName,x)}))},u=!!r,d=Object.keys(i||{}).length===((m=(f=n==null?void 0:n.write)==null?void 0:f.writeObjects)==null?void 0:m.length),p=!d&&Object.keys(i||{}).length>0;return u&&a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`Allow ${e} to write to these object`}),a.jsxs(Vs,{children:[((r==null?void 0:r.length)||0)>=2&&a.jsx(Hs,{id:"select-all-fields",onCheckedChange:c,isIndeterminate:p,isChecked:d,label:"Select all"}),a.jsx(Us,{children:r.map(x=>a.jsx($s,{id:x.objectName,onCheckedChange:w=>s(w,x.objectName),isChecked:!!(i!=null&&i[x.objectName]),label:x.displayName},x.objectName))})]})]})}function Gf(){var h,g,f,m;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:o}=pt(),i=(h=n==null?void 0:n.write)==null?void 0:h.selectedNonConfigurableWriteFields,r=(g=n==null?void 0:n.write)==null?void 0:g.writeObjects,s=x=>{const{name:w,checked:O}=x.target;t&&n&&Rn(t,o,w,O)},c=x=>{var O,v;const{checked:w}=x.target;t&&n&&((v=(O=n==null?void 0:n.write)==null?void 0:O.writeObjects)==null||v.forEach(C=>{Rn(t,o,C.objectName,w)}))},u=!!r,d=Object.keys(i||{}).length===((m=(f=n==null?void 0:n.write)==null?void 0:f.writeObjects)==null?void 0:m.length),p=!d&&Object.keys(i||{}).length>0;return u&&a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`Allow ${e} to write to these object`}),a.jsxs(N.Stack,{marginBottom:10,maxHeight:300,overflowY:"scroll",border:"2px solid #EFEFEF",borderRadius:8,gap:0,children:[((r==null?void 0:r.length)||0)>=2&&a.jsx(N.Box,{backgroundColor:"gray.50",paddingX:4,paddingY:2,children:a.jsx(N.Checkbox,{name:"selectAll",id:"selectAll",onChange:c,isIndeterminate:p,isChecked:d,children:"Select all"})}),r.map(x=>a.jsx(N.Box,{display:"flex",alignItems:"center",borderBottom:"1px",borderColor:"gray.100",paddingX:4,paddingY:2,children:a.jsx(N.Checkbox,{name:x.objectName,id:x.objectName,onChange:s,isChecked:!!(i!=null&&i[x.objectName]),children:a.jsx("p",{style:{overflowWrap:"anywhere"},children:x.displayName})})},x.objectName))]})]})}function Zf(){return ve?a.jsx(Yf,{}):a.jsx(Gf,{})}function Qf(){const e=xe(),{projectId:t,appName:n}=Ie(),{integrationId:o,installation:i,resetInstallations:r,setIntegrationDeleted:s,onUninstallSuccess:c}=We(),[u,d]=y.useState(!1),p=!t||!o||!(i!=null&&i.id)||u,h=async()=>{if(!p){d(!0),console.warn("uninstalling installation",{projectId:t,integrationId:o,installationId:i.id});try{await fe().installationApi.deleteInstallation({projectIdOrName:t,integrationId:o,installationId:i.id},{headers:{"X-Api-Key":e,"Content-Type":"application/json"}}),console.warn("successfully uninstalled installation: ",i.id),c==null||c(i==null?void 0:i.id),r(),s()}catch(x){console.error("Error uninstalling installation."),Ce(x)}finally{d(!1)}}},g=u?"Uninstalling...":"Yes, uninstall",f=i!=null&&i.id?`Once you uninstall this integration, all your configuration will be lost, and "${n}" may stop working.`:"You've successfully uninstalled the integration.",m=ve?a.jsx(He,{type:"button",onClick:h,disabled:p,variant:"danger",children:g}):a.jsx(N.Button,{onClick:h,variant:"warning",isDisabled:p,children:g});return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[a.jsx("p",{children:f}),(i==null?void 0:i.id)&&m]})}const eh=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-neutral-100").trim()||"#f5f5f5",th=getComputedStyle(document.documentElement).getPropertyValue("--amp-shadows-sm").trim()||"0 1px 2px 0 rgba(0, 0, 0, 0.05)";function Bs({onSave:e,onReset:t,isLoading:n,isCreateMode:o=!1,errorMsg:i}){var S,H,k;const{installation:r}=We(),{hydratedRevision:s,loading:c}=Zt(),{configureState:u,selectedObjectName:d}=pt(),p=r==null?void 0:r.config,h=p&&d&&!!yi(p,d)||!1,g=((S=u==null?void 0:u.read)==null?void 0:S.isOptionalFieldsModified)||((H=u==null?void 0:u.read)==null?void 0:H.isRequiredMapFieldsModified),f=(k=u==null?void 0:u.write)==null?void 0:k.isWriteModified,O=c||n||!u||!d||!(g||f||o||d!==xt&&!h),v=d===xt,C=d===Ti,b=ve?a.jsx(He,{type:"submit",disabled:O,children:o?"Install":"Save"}):a.jsx(N.Button,{type:"submit",variant:"primary",isDisabled:O,children:o?"Install":"Save"}),I=ve?a.jsx(He,{type:"button",onClick:t,disabled:O,variant:"ghost",children:"Reset"}):a.jsx(N.Button,{isDisabled:O,onClick:t,children:"Reset"});return n?a.jsx(qe,{}):a.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[a.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:"1rem",marginBottom:"2rem"},children:[b,I]}),a.jsxs(Dt,{style:{padding:"2rem",minHeight:"300px",backgroundColor:"white",borderColor:eh,boxShadow:th},children:[i&&a.jsx(Ni,{children:typeof i=="string"?i:"Installation Failed."}),c&&a.jsx(qe,{}),s&&!C&&!v&&a.jsx(zf,{}),s&&!C&&v&&a.jsx(Zf,{}),!c&&C&&a.jsx(Qf,{})]})]})}const qs=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:o,onInstallSuccess:i,onUpdateSuccess:r}=We(),{hydratedRevision:s,loading:c}=Zt(),{selectedObjectName:u}=gs(),{selectedConnection:d}=kt(),p=xe(),{projectId:h}=Ie(),{resetBoundary:g,setErrors:f,setError:m,getError:x}=dt(),{resetConfigureState:w,objectConfigurationsState:O,resetPendingConfigurationState:v}=Br(),C=Oi(u||"",O),{onNextIncompleteTab:b}=Wp(),I=y.useCallback(()=>{g(me.INSTALLATION_MUTATION)},[g]),S=y.useCallback(k=>k?V=>{m(me.INSTALLATION_MUTATION,k,V)}:V=>{console.error("objectName is required to set installation error: ",V)},[m]),H=y.useCallback(k=>k?x(me.INSTALLATION_MUTATION,k):"",[x]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:o,hydratedRevision:s,loading:c,selectedObjectName:u,selectedConnection:d,apiKey:p,projectId:h,resetBoundary:g,setErrors:f,setMutateInstallationError:S,getMutateInstallationError:H,resetMutateInstallationErrorState:I,resetConfigureState:w,objectConfigurationsState:O,resetPendingConfigurationState:v,configureState:C,onInstallSuccess:i,onUpdateSuccess:r,onNextIncompleteTab:b}},nh=void 0;function rh(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:o,hydratedRevision:i,loading:r,selectedObjectName:s,selectedConnection:c,apiKey:u,projectId:d,resetBoundary:p,setErrors:h,setMutateInstallationError:g,getMutateInstallationError:f,resetMutateInstallationErrorState:m,resetConfigureState:x,objectConfigurationsState:w,resetPendingConfigurationState:O,configureState:v,onInstallSuccess:C,onNextIncompleteTab:b}=qs(),[I,S]=y.useState(!1),H=s===xt,k=f(s),V=y.useCallback(()=>{p(me.MAPPING),i!=null&&i.content&&!r&&s&&_i(i,nh,s,x)},[p,i,r,s,x]);y.useEffect(()=>{!v&&(i!=null&&i.content)&&!r&&V()},[v,w,i,r,V]);const z=()=>{m();const{requiredMapFields:te,selectedFieldMappings:Q}=(v==null?void 0:v.read)||{},{errorList:ue}=wi(te,Q,h);ue.length>0||(s&&(c!=null&&c.id)&&u&&d&&e&&t&&n&&i?(S(!0),wd(d,e,t,n,c.id,s,u,i,v,g(s),o,C).finally(()=>{S(!1),O(s),b()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},X=()=>{m(),s&&(c!=null&&c.id)&&u&&d&&e&&t&&n&&i?(S(!0),bd(d,e,t,n,c.id,u,i,v,g(s),o,C).finally(()=>{S(!1),O(s),b()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},Z=te=>{te.preventDefault(),H?X():z()};return a.jsx(Bs,{errorMsg:k,isCreateMode:!0,isLoading:I,onSave:Z,onReset:V})}function oh({updateConfig:e,projectId:t,integrationId:n,installationId:o,apiKey:i,selectedObjectName:r,setInstallation:s,onUpdateSuccess:c,setError:u}){const d={projectIdOrName:t,installationId:o,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${r}`],installation:{config:e}}};return fe().installationApi.updateInstallation(d,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}}).then(p=>{s(p),c==null||c(p.id,p.config)}).catch(p=>{Ce(p,u)})}const ih=(e,t,n,o,i,r)=>{const s=bi(e),c=Ci(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:o,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:c,backfill:r}}}}};return jn(i)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},sh=(e,t,n,o,i,r,s,c,u,d,p)=>{const h=ih(r,o||"",c,c.schedule,u,c.backfill);return h?oh({updateConfig:h,projectId:e,integrationId:t,installationId:n,apiKey:i,selectedObjectName:o,setError:d,setInstallation:s,onUpdateSuccess:p}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},ah=(e,t)=>{const o={content:{write:{objects:Si(e)}}};return jn(t)&&(o.content||(o.content={}),o.content.proxy={enabled:!0}),o},ch=(e,t,n,o,i,r,s,c,u)=>{const d=ah(i,r);if(!d)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const p={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:d}}};return fe().installationApi.updateInstallation(p,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(h=>{c(h),u==null||u(h.id,h.config)}).catch(h=>{Ce(h,s)})};function uh({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:o,loading:i,selectedObjectName:r,apiKey:s,projectId:c,resetBoundary:u,setErrors:d,setMutateInstallationError:p,getMutateInstallationError:h,resetConfigureState:g,resetPendingConfigurationState:f,configureState:m,onUpdateSuccess:x,onNextIncompleteTab:w}=qs(),[O,v]=y.useState(!1),C=r===xt,b=h(r),{config:I}=e,S=y.useCallback(()=>{u(me.MAPPING),o!=null&&o.content&&!i&&r&&_i(o,I,r,g)},[u,o,i,r,I,g]);y.useEffect(()=>{m||S()},[m,S]),y.useEffect(()=>{e&&S()},[e,S]);const H=y.useMemo(()=>{var Z,te,Q;return(Q=(te=(Z=o==null?void 0:o.content)==null?void 0:Z.read)==null?void 0:te.objects)==null?void 0:Q.find(ue=>(ue==null?void 0:ue.objectName)===r)},[o,r]),k=()=>{const{requiredMapFields:X,selectedFieldMappings:Z}=(m==null?void 0:m.read)||{},{errorList:te}=wi(X,Z,d);te.length>0||(o&&e&&r&&s&&c&&H?(v(!0),sh(c,t.id,e.id,r,s,m,n,H,o,p(r),x).finally(()=>{v(!1),f(r),w()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},V=()=>{e&&r&&s&&c&&o?(v(!0),ch(c,t.id,e.id,s,m,o,p(r),n,x).finally(()=>{v(!1),f(r),w()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},z=X=>{X.preventDefault(),C?V():k()};return a.jsx(Bs,{errorMsg:b,onSave:z,onReset:S,isLoading:O})}function lh(){const{integrationObj:e,installation:t}=We();return e?t&&e?a.jsx(uh,{installation:t,integrationObj:e}):a.jsx(rh,{}):a.jsx(ot,{message:"We can't load the integration"})}function dh(){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("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),a.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Jr({text:e,children:t}){return a.jsx(Gt,{children:a.jsxs(Dt,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"},children:[a.jsx(dh,{}),a.jsx("p",{children:e}),t]})})}const ph=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function fh({projectId:e,integrationId:t,groupRef:n,consumerRef:o,connectionId:i,apiKey:r,hydratedRevision:s,setError:c,setInstallation:u,onInstallSuccess:d}){const p=ph(s,o);return p?br({createConfig:p,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:r,setError:c,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function hh({provider:e}){const t=`You have successfully installed your ${it(e)} integration.`;return a.jsx(Jr,{text:t})}const mh=e=>{const{read:t,write:n,proxy:o}=(e==null?void 0:e.content)??{};return!t&&!n&&(o==null?void 0:o.enabled)||!1};function gh({children:e,resetComponent:t}){var b;const{projectId:n}=Ie(),o=xe(),{hydratedRevision:i,loading:r}=Zt(),{integrationObj:s,installation:c,groupRef:u,consumerRef:d,setInstallation:p,onInstallSuccess:h,isIntegrationDeleted:g}=We(),{selectedConnection:f}=kt(),[m,x]=y.useState(!1),w=r||m,O=(b=i==null?void 0:i.content)==null?void 0:b.provider,v=mh(i),C=I=>{console.error("Error when creating proxy installation:",I)};return y.useEffect(()=>{!w&&i&&v&&!c&&f&&o&&(s!=null&&s.id)&&(x(!0),fh({apiKey:o,projectId:n,integrationId:s==null?void 0:s.id,groupRef:u,consumerRef:d,connectionId:f==null?void 0:f.id,hydratedRevision:i,setError:C,setInstallation:p,onInstallSuccess:h}).then(()=>{x(!1)}).catch(I=>{x(!1),console.error("Error when creating proxy installation:",I)}))},[i,v,c,f,o,n,s==null?void 0:s.id,u,d,p,w,h]),s?w?a.jsx(qe,{}):v&&O&&c?a.jsx(hh,{provider:O}):g?a.jsx(Jr,{text:"Integration successfully uninstalled.",children:ve&&a.jsx(He,{type:"button",onClick:t,style:{width:"100%"},children:"Reinstall Integration"})}):a.jsx("div",{children:e}):a.jsx(ot,{message:"We can't load the integration"})}function Ws(){return a.jsxs("footer",{style:{backgroundColor:"#EFEFEF",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[a.jsx("p",{children:"Secured by"}),a.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:a.jsx("img",{style:{height:".8em"},src:"https://ampersand-website.vercel.app/logo-black.svg",alt:"Ampersand"})})]})}function Me({children:e}){return a.jsx(Gt,{children:a.jsxs(Dt,{children:[a.jsx("div",{style:{padding:"3rem 2rem"},children:e}),a.jsx(Ws,{})]})})}function Qt({children:e}){return a.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function Ke({error:e}){return e?a.jsx(Ni,{style:{marginTop:"2em"},children:e}):null}function zr({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o,children:i,title:r}){if(!r&&!o)throw new Error("Either title or providerName is required");return a.jsxs(Me,{children:[a.jsx(Qt,{children:r||`Set up ${o} integration`}),a.jsx(Ke,{error:t}),i,a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const yh="_link_oo2kv_1",vh={link:yh};function Xr({href:e,className:t,style:n,label:o,children:i,newTab:r=!1}){return ve?a.jsx("a",{className:vh.link,style:n,href:e,"aria-label":o||void 0,target:r?"_blank":"_self",rel:r?"noopener noreferrer":void 0,children:i}):a.jsx(N.Link,{href:e,className:t,style:n,"aria-label":o||void 0,target:r?"_blank":"_self",rel:r?"noopener noreferrer":void 0,color:"#737373",children:i})}const Ih=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-text-secondary").trim()||"#737373";function Kn({url:e,providerDisplayName:t,credentialName:n}){return a.jsxs("p",{style:{color:Ih},children:[a.jsx(Xr,{href:e,newTab:!0,children:a.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const wh="_input_19woe_1",xh="_inputError_19woe_17",_h="_error_19woe_31",rr={input:wh,inputError:xh,error:_h};function bh({id:e,type:t,className:n,isError:o=!1,...i}){const r=o?zt(rr.inputError,rr.input):rr.input;return a.jsx("input",{id:e,type:t,className:zt(r,n),...i})}const Ch="_textarea_1efhx_1",Oh="_textareaError_1efhx_13",Sh="_error_1efhx_27",or={textarea:Ch,textareaError:Oh,error:Sh};function Nh({className:e,isError:t=!1,...n}){const o=t?zt(or.textareaError,or.textarea):or.textarea;return a.jsx("textarea",{className:zt(e,o),...n})}const rt={Input:bh,Textarea:Nh};function Eh({provider:e,providerInfo:t,handleSubmit:n,error:o,isButtonDisabled:i}){var x;const[r,s]=y.useState(!1),c=()=>s(!r),[u,d]=y.useState(""),p=w=>d(w.currentTarget.value),h=u.length>0,g=i||!h,f=it(e,t),m=(x=t.apiKeyOpts)==null?void 0:x.docsURL;return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{my:"6",children:a.jsx(N.Heading,{as:"h4",size:"md",children:`Set up ${f} integration`})}),a.jsx(Ke,{error:o}),a.jsxs(N.Stack,{spacing:4,children:[m&&a.jsx(Kn,{url:m,providerDisplayName:f,credentialName:"API key"}),a.jsxs(N.InputGroup,{size:"md",children:[a.jsx(N.Input,{onChange:p,pr:"4.5rem",type:r?"text":"password",placeholder:"API Key"}),a.jsx(N.InputRightElement,{width:"4.5rem",children:a.jsx(N.Button,{h:"1.75rem",size:"sm",onClick:c,children:r?"Hide":"Show"})})]})]}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:g,width:"100%",type:"submit",onClick:()=>{n({apiKey:u})},children:"Next"})]})})}function Th({provider:e,providerInfo:t,handleSubmit:n,error:o,isButtonDisabled:i}){var x;const[r,s]=y.useState(!1),c=()=>s(w=>!w),[u,d]=y.useState(""),p=w=>d(w.currentTarget.value),h=u.length>0,g=i||!h,f=it(e,t),m=(x=t.apiKeyOpts)==null?void 0:x.docsURL;return a.jsx(zr,{providerName:f,handleSubmit:()=>{n({apiKey:u})},error:o,isButtonDisabled:g,children:a.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[m&&a.jsx(Kn,{url:m,providerDisplayName:f,credentialName:"API key"}),a.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[a.jsx(rt.Input,{id:"password",name:"password",type:r?"text":"password",placeholder:"Password",onChange:w=>p(w)}),a.jsx(He,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,children:r?"Hide":"Show"})]})]})})}function Rh({...e}){return ve?a.jsx(Th,{...e}):a.jsx(Eh,{...e})}function Ah({provider:e,providerInfo:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,children:s,selectedConnection:c,setSelectedConnection:u}){const d=Ie(),[p,h]=y.useState(!1),[g,f]=y.useState(null),m=xe();y.useEffect(()=>{if(e&&fe&&p&&g!=null){const w={groupName:r,groupRef:i,consumerName:o,consumerRef:n,provider:e,apiKey:g};fe().connectionApi.generateConnection({projectIdOrName:d.projectId,generateConnectionParams:w},{headers:{"X-Api-Key":m??"","Content-Type":"application/json"}}).then(O=>{u(O)}).catch(O=>{console.error("Error loading provider info."),Ce(O)})}},[m,e,p,o,n,r,i,d,u,g]);const x=w=>{f(w.apiKey),h(!0)};return c===null?a.jsx(Rh,{provider:e,providerInfo:t,handleSubmit:x,error:null}):s}function jh({provider:e,providerInfo:t,handleSubmit:n,error:o,isButtonDisabled:i}){var v;const[r,s]=y.useState(!1),c=()=>s(!r),[u,d]=y.useState(""),[p,h]=y.useState(""),g=C=>d(C.currentTarget.value),f=C=>h(C.currentTarget.value),m=it(e,t),x=(v=t.basicOpts)==null?void 0:v.docsURL,w=u.length>0,O=i||!w;return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(N.Heading,{as:"h4",size:"md",children:`Set up ${m} integration`})}),a.jsx(Ke,{error:o}),a.jsx("br",{}),a.jsxs(N.Stack,{spacing:4,children:[x&&a.jsx(Kn,{url:x,providerDisplayName:m,credentialName:"credentials"}),a.jsx(N.Input,{placeholder:"Username",onChange:g}),a.jsxs(N.InputGroup,{size:"md",children:[a.jsx(N.Input,{onChange:f,pr:"4.5rem",type:r?"text":"password",placeholder:"Password"}),a.jsx(N.InputRightElement,{width:"4.5rem",children:a.jsx(N.Button,{h:"1.75rem",size:"sm",onClick:c,children:r?"Hide":"Show"})})]})]}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:O,width:"100%",type:"submit",onClick:()=>{n({user:u,pass:p})},children:"Next"})]})})}function Ph({provider:e,providerInfo:t,handleSubmit:n,error:o,isButtonDisabled:i}){var O;const[r,s]=y.useState(!1),c=()=>s(v=>!v),[u,d]=y.useState({username:"",password:""}),{username:p,password:h}=u,g=it(e,t),f=(O=t.basicOpts)==null?void 0:O.docsURL,m=p.length>0,x=i||!m,w=v=>{const{name:C,value:b}=v.currentTarget;d(I=>({...I,[C]:b}))};return a.jsx(zr,{providerName:g,handleSubmit:()=>{n({user:p,pass:h})},error:o,isButtonDisabled:x,children:a.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[f&&a.jsx(Kn,{url:f,providerDisplayName:g,credentialName:"credentials"}),a.jsx(rt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:v=>w(v)}),a.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[a.jsx(rt.Input,{id:"password",name:"password",type:r?"text":"password",placeholder:"Password",onChange:v=>w(v)}),a.jsx(He,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,children:r?"Hide":"Show"})]})]})})}function Dh({...e}){return ve?a.jsx(Ph,{...e}):a.jsx(jh,{...e})}function kh({provider:e,providerInfo:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,children:s,selectedConnection:c,setSelectedConnection:u}){const d=Ie(),[p,h]=y.useState(!1),[g,f]=y.useState(null),m=xe();y.useEffect(()=>{if(e&&fe&&p&&g!=null){const w={groupName:r,groupRef:i,consumerName:o,consumerRef:n,provider:e,basicAuth:{username:g.user,password:g.pass}};fe().connectionApi.generateConnection({projectIdOrName:d.projectId,generateConnectionParams:w},{headers:{"X-Api-Key":m??"","Content-Type":"application/json"}}).then(O=>{u(O)}).catch(O=>{console.error("Error loading provider info."),Ce(O)})}},[m,e,p,o,n,r,i,d,g,u]);const x=w=>{const{user:O,pass:v}=w;f({user:O,pass:v}),h(!0)};return c===null?a.jsx(Dh,{provider:e,providerInfo:t,handleSubmit:x,error:null}):s}function Fh({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o}){return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(N.Heading,{as:"h4",size:"md",children:`Set up ${o} integration`})}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:n,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function Mh({...e}){return ve?a.jsx(zr,{...e}):a.jsx(Fh,{...e})}function Kh({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,children:r,selectedConnection:s,setSelectedConnection:c,providerName:u}){const d=Ie(),p=xe(),[h,g]=y.useState(!1);y.useEffect(()=>{if(e&&fe&&h){const m={groupName:i,groupRef:o,consumerName:n,consumerRef:t,provider:e};fe().connectionApi.generateConnection({projectIdOrName:d.projectId,generateConnectionParams:m},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(x=>{c(x)}).catch(x=>{console.error("Error loading provider info."),Ce(x)})}},[p,e,h,n,t,i,o,c,d]);const f=()=>{g(!0)};return s===null?a.jsx(Mh,{handleSubmit:f,error:null,providerName:u}):r}const Js=async(e,t,n,o,i,r,s,c)=>{var d;const u=await fe().providerApi.getProvider({provider:i},{headers:{"X-Api-Key":o??""}});if(!u)throw new Error(`Provider ${i} not found`);if(u.authType==="oauth2"&&((d=u.oauth2Opts)==null?void 0:d.grantType)==="authorizationCode"){const h=(await fe().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":o??""}})).find(x=>x.provider===i),g=it(i,u);if(!h)throw new Error(`You must first set up a ${g} Provider App using the Ampersand Console.`);const f={connectOAuthParams:{providerWorkspaceRef:r,projectId:e,groupRef:n,groupName:c,consumerRef:t,consumerName:s,providerAppId:h.id,provider:i}};return await fe().oAuthApi.oauthConnect(f)}throw new Error(`Provider ${i} does not support an OAuth2 web flow.`)},zo=600,Xo=600,Lh="AUTHORIZATION_SUCCEEDED",$h="AUTHORIZATION_FAILED";function Hh(e,t,n){return y.useCallback(async o=>{const i=await fe().connectionApi.getConnection({projectIdOrName:e,connectionId:o},{headers:{"X-Api-Key":t??""}});n(i)},[e,t,n])}function Vh(e,t,n,o){return y.useCallback(()=>{if(!o)return;const i=window.screenX+(window.outerWidth-zo)/2,r=window.screenY+(window.outerHeight-Xo)/2.5,s=`width=${zo},height=${Xo},left=${i},top=${r}`,c=window.open(o,e,s);t(c),window.addEventListener("message",n,!1)},[o,e,t,n])}function Uh(e,t){return y.useCallback(n=>{var o,i;if(n.origin===Bl){if(n.data.eventType===Lh){const r=(o=n.data.data)==null?void 0:o.connection;r?e(r):console.error("Connection ID not found in event data: ",{event:n})}n.data.eventType===$h&&(console.error("OAuth failed: ",{event:n}),t==null||t(((i=n==null?void 0:n.data)==null?void 0:i.message)??"OAuth failed. Please try again."))}},[t,e])}function zs({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:o,error:i}){const r=xe(),{projectId:s}=Ie(),[c,u]=y.useState(null),[d,p]=y.useState(null),{setSelectedConnection:h}=kt(),g=Uh(u,o),f=Vh(n,p,g,t),m=Hh(s,r,h);y.useEffect(()=>{t&&!d&&f()},[t,d,f,g,n]),y.useEffect(()=>{c&&m(c).then(()=>{d==null||d.close()}).catch(w=>{console.error("Error refreshing connection: ",w),o==null||o(w.message??"Unexpected error: not able to refresh connection")})},[c,r,h,m,d,o]);const x=d&&setInterval(()=>{(d!=null&&d.closed||!d)&&x&&(clearInterval(x),window.removeEventListener("message",g),p(null),!c&&!i?(console.error("OAuth failed. Please try again."),o==null||o("OAuth failed. Please try again.")):c&&o&&(o==null||o(null)))},500);return a.jsx("div",{children:e})}function Bh({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o}){return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(N.Heading,{as:"h4",size:"md",children:`Set up ${o} integration`})}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:n,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function qh({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o}){return ve?a.jsxs(Me,{children:[a.jsx(Qt,{children:`Set up ${o} integration`}),a.jsx(Ke,{error:t}),a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]}):a.jsx(Bh,{handleSubmit:e,error:t,isButtonDisabled:n,providerName:o})}function Wh({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,providerName:r}){const{projectId:s}=Ie(),c=xe(),[u,d]=y.useState(null),[p,h]=y.useState(null),g=async()=>{h(null);try{const m=await Js(s,t,o,c,e,void 0,n,i);d(m)}catch(m){console.error("Could not fetch OAuth popup URL."),Ce(m),h(m.message??"Unexpected error")}},f=y.useCallback(m=>{h(m),d(null)},[]);return a.jsx(zs,{windowTitle:`Connect to ${r}`,oauthUrl:u,onError:f,children:a.jsx(qh,{handleSubmit:g,error:p,providerName:r})})}const Jh=N.createIcon({displayName:"ExternalLinkIcon",path:a.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[a.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),a.jsx("path",{d:"M15 3h6v6"}),a.jsx("path",{d:"M10 14L21 3"})]})}),Xs="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function zh({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o}){return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{children:a.jsx(N.Heading,{as:"h4",size:"md",children:"Enter your Salesforce subdomain"})}),a.jsxs(Xr,{href:Xs,newTab:!0,children:["What is my Salesforce subdomain? ",a.jsx(Jh,{})]}),a.jsx(Ke,{error:n}),a.jsxs("div",{style:{display:"flex",marginTop:"1em"},children:[a.jsx(N.Input,{placeholder:"my-domain",onChange:i=>t(i.currentTarget.value)}),a.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:o,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function Xh({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o}){const i={handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o};return ve?a.jsxs(Me,{children:[a.jsx(Qt,{children:"Enter your Salesforce subdomain"}),a.jsx(Xr,{href:Xs,newTab:!0,children:"What is my Salesforce subdomain?"}),a.jsx(Ke,{error:n}),a.jsxs("div",{style:{display:"flex",marginTop:"1em"},children:[a.jsx(rt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:r=>t(r.currentTarget.value)}),a.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:o,type:"submit",onClick:e,children:"Next"})]}):a.jsx(zh,{...i})}function Yh({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o,providerName:i}){return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsxs(N.Heading,{as:"h4",size:"md",children:["Enter your ",i," workspace"]})}),a.jsx(Ke,{error:n}),a.jsx(N.Flex,{marginTop:"1em",children:a.jsx(N.Input,{placeholder:"MyWorkspace",onChange:r=>t(r.currentTarget.value)})}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:o,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function Gh({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o,providerName:i}){if(!ve){const r={handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o,providerName:i};return a.jsx(Yh,{...r})}return a.jsxs(Me,{children:[a.jsxs(Qt,{children:["Enter your ",i," workspace"]}),a.jsx(Ke,{error:n}),a.jsx("br",{}),a.jsx(rt.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:r=>t(r.currentTarget.value)}),a.jsx("br",{}),a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:o,type:"submit",onClick:e,children:"Next"})]})}const Zh="salesforce";function Qh({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,providerName:r}){const{projectId:s}=Ie(),c=xe(),[u,d]=y.useState(""),[p,h]=y.useState(null),[g,f]=y.useState(null),m=async()=>{if(f(null),!u){f("Workspace is required");return}try{const O=await Js(s,t,o,c,e,u,n,i);h(O)}catch(O){console.error(O),f((O==null?void 0:O.message)??"Unexpected error")}},x=y.useCallback(O=>{f(O),h(null)},[]),w=e===Zh?a.jsx(Xh,{handleSubmit:m,setWorkspace:d,error:g,isButtonDisabled:u.length===0}):a.jsx(Gh,{handleSubmit:m,setWorkspace:d,error:g,isButtonDisabled:u.length===0,providerName:r});return a.jsx(zs,{windowTitle:`Connect to ${r}`,oauthUrl:p,onError:x,children:w})}function em({handleSubmit:e,error:t,explicitScopesRequired:n,isButtonDisabled:o,providerName:i}){const[r,s]=y.useState(!1),[c,u]=y.useState(""),[d,p]=y.useState(""),[h,g]=y.useState(""),f=()=>s(!r),m=I=>u(I.currentTarget.value),x=I=>p(I.currentTarget.value),w=I=>g(I.currentTarget.value),O=c.length>0,v=d.length>0,C=o||!O||!v,b=()=>{const I={clientId:d,clientSecret:c};n&&h.length>0&&(I.scopes=Ir(h)),e(I)};return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(N.Heading,{as:"h4",size:"md",children:`Set up ${i} integration`})}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsxs(N.Stack,{spacing:4,children:[a.jsx(N.Input,{placeholder:"Client ID",onChange:x}),a.jsxs(N.InputGroup,{size:"md",children:[a.jsx(N.Input,{onChange:m,pr:"4.5rem",type:r?"text":"password",placeholder:"Client Secret"}),a.jsx(N.InputRightElement,{width:"4.5rem",children:a.jsx(N.Button,{h:"1.75rem",size:"sm",onClick:f,children:r?"Hide":"Show"})})]}),n&&a.jsx(N.Textarea,{placeholder:"Scopes separated by new line",onChange:w})]}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:C,width:"100%",type:"submit",onClick:b,children:"Next"})]})})}function tm({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,explicitScopesRequired:r,providerName:s,selectedConnection:c,setSelectedConnection:u}){const{projectId:d}=Ie(),p=xe(),[h,g]=y.useState(null),f=async m=>{g(null);const x={groupName:i,groupRef:o,consumerName:n,consumerRef:t,provider:e,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes}};fe().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:x},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(w=>{u(w)}).catch(w=>{console.error("Error loading provider info."),Ce(w),g("Error loading provider info")})};return c===null?a.jsx(em,{providerName:s,handleSubmit:f,error:h,explicitScopesRequired:r}):a.jsx(qe,{})}function nm({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o,explicitScopesRequired:i}){const[r,s]=y.useState(!1),[c,u]=y.useState(""),[d,p]=y.useState(""),[h,g]=y.useState(""),[f,m]=y.useState(""),x=()=>s(!r),w=V=>u(V.currentTarget.value),O=V=>p(V.currentTarget.value),v=V=>g(V.currentTarget.value),C=V=>m(V.currentTarget.value),b=c.length>0,I=d.length>0,S=h.length>0,H=n||!b||!I||!S,k=()=>{const V={workspace:h,clientId:d,clientSecret:c};i&&f.length>0&&(V.scopes=Ir(f)),e(V)};return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(N.Heading,{as:"h4",size:"md",children:`Set up ${o} integration`})}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsxs(N.Stack,{spacing:4,children:[a.jsx(N.Input,{placeholder:"MyWorkspace",onChange:v}),a.jsx(N.Input,{placeholder:"Client ID",onChange:O}),a.jsxs(N.InputGroup,{size:"md",children:[a.jsx(N.Input,{onChange:w,pr:"4.5rem",type:r?"text":"password",placeholder:"Client Secret"}),a.jsx(N.InputRightElement,{width:"4.5rem",children:a.jsx(N.Button,{h:"1.75rem",size:"sm",onClick:x,children:r?"Hide":"Show"})})]}),i&&a.jsx(N.Textarea,{placeholder:"Scopes separated by new line",onChange:C})]}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:H,width:"100%",type:"submit",onClick:k,children:"Next"})]})})}function rm({provider:e,providerName:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,explicitScopesRequired:s,selectedConnection:c,setSelectedConnection:u}){const{projectId:d}=Ie(),p=xe(),[h,g]=y.useState(null),f=async m=>{g(null);const x={groupName:r,groupRef:i,consumerName:o,consumerRef:n,provider:e,providerWorkspaceRef:m.workspace,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes}};fe().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:x},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(w=>{u(w)}).catch(w=>{console.error("Error loading provider info."),Ce(w),g("Error loading provider info")})};return c===null?a.jsx(nm,{providerName:t,handleSubmit:f,error:h,explicitScopesRequired:s}):a.jsx(qe,{})}function om({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o,explicitScopesRequired:i,explicitWorkspaceRequired:r}){const[s,c]=y.useState(!1),[u,d]=y.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),p=()=>c(I=>!I),h=I=>{const{name:S,value:H}=I.currentTarget;d(k=>({...k,[S]:H}))},{clientSecret:g,clientId:f,workspace:m,scopes:x}=u,w=g.length>0,O=f.length>0,v=r?m.length>0:!0,C=n||!w||!O||!v,b=()=>{const I={clientId:f,clientSecret:g};r&&(I.workspace=m),i&&x.length>0&&(I.scopes=Ir(x)),e(I)};return a.jsxs(Me,{children:[a.jsx(Qt,{children:`Set up ${o} integration`}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[r&&a.jsx(rt.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:I=>h(I)}),a.jsx(rt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:I=>h(I)}),a.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[a.jsx(rt.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:I=>h(I)}),a.jsx(He,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:p,children:s?"Hide":"Show"})]}),i&&a.jsx(rt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:I=>h(I)})]}),a.jsx("br",{}),a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:C,type:"submit",onClick:b,children:"Next"})]})}function im({provider:e,providerName:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,explicitScopesRequired:s,explicitWorkspaceRequired:c,selectedConnection:u,setSelectedConnection:d}){const{projectId:p}=Ie(),h=xe(),[g,f]=y.useState(null),m=async x=>{f(null);const w={groupName:r,groupRef:i,consumerName:o,consumerRef:n,provider:e,providerWorkspaceRef:x.workspace,oauth2ClientCredentials:{clientId:x.clientId,clientSecret:x.clientSecret,scopes:x.scopes}};fe().connectionApi.generateConnection({projectIdOrName:p,generateConnectionParams:w},{headers:{"X-Api-Key":h??"","Content-Type":"application/json"}}).then(O=>{d(O)}).catch(O=>{console.error("Error loading provider info."),Ce(O),f("Error loading provider info")})};return u===null?a.jsx(om,{providerName:t,handleSubmit:m,error:g,explicitScopesRequired:s,explicitWorkspaceRequired:c}):a.jsx(qe,{})}function sm({...e}){return ve?a.jsx(im,{...e}):e.explicitWorkspaceRequired?a.jsx(rm,{...e}):a.jsx(tm,{...e})}const am="authorizationCode",cm="clientCredentials";function um({provider:e,providerInfo:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,selectedConnection:s,setSelectedConnection:c}){if(t.oauth2Opts===void 0)return a.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:u,explicitScopesRequired:d,explicitWorkspaceRequired:p}=t.oauth2Opts,h=it(e,t),g={provider:e,consumerRef:n,consumerName:o,groupRef:i,groupName:r,providerName:h};return u===am?p?a.jsx(Qh,{...g}):a.jsx(Wh,{...g}):u===cm?a.jsx(sm,{...g,explicitWorkspaceRequired:p,explicitScopesRequired:d,selectedConnection:s,setSelectedConnection:c}):u==="password"?a.jsx("em",{children:"Password flow not supported yet"}):u==="PKCE"?a.jsx("em",{children:"PKCE flow not supported yet"}):a.jsxs("em",{children:["Unsupported grant type: ",u]})}function lm(e){const{selectedConnection:t}=kt();y.useEffect(()=>{e&&t&&e(t.id)},[e,t])}function dm({onSuccess:e}){lm(e)}const pm=async(e,t)=>{const n=await fe().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!n)throw new Error(`Provider ${t} not found`);return n};function Ys({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,children:r,onSuccess:s}){const c=xe(),[u,d]=y.useState(null),{provider:p}=We(),{selectedConnection:h,setSelectedConnection:g,connections:f}=kt();dm({onSuccess:s});const m=e||p,x=(u==null?void 0:u.displayName)??Zo(m);if(y.useEffect(()=>{if(!h&&f&&f.length>0){const[O]=f;g(O)}pm(c,m).then(O=>{d(O)}).catch(O=>{console.error("Error loading provider info."),Ce(O)})},[f,h,g,c,m]),!e&&!p)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(h)return r;if(u==null)return a.jsx("strong",{children:"Provider not found"});const w={provider:m,consumerRef:t,consumerName:n,groupRef:o,groupName:i,selectedConnection:h,setSelectedConnection:g,providerName:x,providerInfo:u};return u.authType==="none"?a.jsx(Kh,{...w,children:r}):u.authType==="basic"?a.jsx(kh,{...w,children:r}):u.authType==="apiKey"?a.jsx(Ah,{...w,children:r}):a.jsx(um,{...w})}const fm=a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[a.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),a.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function hm(e,t){return t?y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},y.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?fm:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:a.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}const Gs=y.forwardRef(({objectName:e,completed:t,pending:n,displayName:o},i)=>{const r=N.useTab({ref:i}),s=N.useMultiStyleConfig("Tabs",r);return a.jsxs(N.Button,{__css:s.tab,...r,variant:"outline",minHeight:15,children:[a.jsxs(N.Box,{as:"span",display:"flex",alignItems:"center",gap:2,mr:"3",children:[hm(t,n),a.jsxs(N.Box,{textAlign:"left",children:[a.jsx(N.Text,{children:o||e}),n&&a.jsx(N.Text,{fontSize:10,fontStyle:"italic",children:"pending"})]})]}),r.children]})});function mm({pending:e,completed:t,displayName:n}){return a.jsxs(a.Fragment,{children:[a.jsx(qr,{style:{margin:"1rem 0"}}),a.jsx(Gs,{objectName:xt,completed:t,pending:e,displayName:n},"other-write")]})}function gm(e,t){return e!=null&&e[t]?e[t]:{name:Ti,completed:!1}}const ym=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-background-secondary").trim()||"#FCFCFC";function vm({children:e}){var O,v,C;const{project:t}=Ie(),{installation:n,provider:o}=We(),{hydratedRevision:i}=Zt(),{objectConfigurationsState:r}=Br(),[s,c]=y.useState(0),u=(t==null?void 0:t.appName)||"",d=n==null?void 0:n.config,p=i&&vi(d,i),h=p!==null,g=!!((O=i==null?void 0:i.content)!=null&&O.write),f=g?Ii(d):void 0,m=y.useMemo(()=>{const b=[...p||[]];return f&&g&&b.push(f),b},[p,f,g]),x=gm(m,s),w=y.useCallback(()=>{const b=m.find(I=>x!==I&&!I.completed);b&&c(m.indexOf(b))},[m,x]);return a.jsx(ys.Provider,{value:w,children:a.jsx(ms.Provider,{value:x==null?void 0:x.name,children:a.jsxs(Gt,{style:{maxWidth:"55rem"},children:[a.jsxs(Dt,{style:{display:"flex",gap:"1rem",padding:"3rem",backgroundColor:ym},children:[a.jsxs("div",{style:{width:"20rem"},children:[a.jsxs(N.Text,{children:[it(o)," integration"]}),a.jsx(N.Text,{marginBottom:"20px",fontSize:"1.125rem",fontWeight:"500",children:u}),h&&a.jsxs(N.Tabs,{index:s,onChange:c,orientation:"horizontal",children:[p.map(b=>{var I,S,H,k;return a.jsx(Gs,{objectName:b.name,completed:b.completed,pending:((S=(I=r[b.name])==null?void 0:I.read)==null?void 0:S.isOptionalFieldsModified)||((k=(H=r[b.name])==null?void 0:H.read)==null?void 0:k.isRequiredMapFieldsModified)},b.name)}),g&&f&&a.jsx(mm,{completed:f.completed,pending:(C=(v=r==null?void 0:r.other)==null?void 0:v.write)==null?void 0:C.isWriteModified,displayName:p!=null&&p.length?"other":"write"}),n&&a.jsxs(a.Fragment,{children:[a.jsx(qr,{style:{margin:"3rem 0 1rem 0"}}),a.jsx(Dd,{text:"Uninstall"},"uninstall-installation")]})]})]}),e]}),a.jsx(Ws,{})]})})})}function Im(){const[e,t]=y.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}function wm({integration:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,onInstallSuccess:r,onUpdateSuccess:s,onUninstallSuccess:c,fieldMapping:u}){var f;const{projectId:d}=Ie(),{errorState:p}=dt(),{seed:h,reset:g}=Im();return(f=p[me.INTEGRATION_LIST])!=null&&f.apiError?a.jsx(ot,{message:"Something went wrong, couldn't find integration information"}):a.jsx(sd,{integration:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,onInstallSuccess:r,onUpdateSuccess:s,onUninstallSuccess:c,fieldMapping:u,children:a.jsx(gi,{groupRef:o,children:a.jsx(Ys,{consumerRef:t,consumerName:n,groupRef:o,groupName:i,children:a.jsx(kd,{projectId:d,children:a.jsx(gh,{resetComponent:g,children:a.jsx(sf,{children:a.jsx(vm,{children:a.jsx(lh,{})})})})})})})},h)}function xm(){return a.jsxs(Gt,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[a.jsx(qe,{}),a.jsx("p",{children:"Redirecting"})]})}function _m({redirectURL:e,children:t}){return y.useEffect(()=>{e&&window.location.replace(e)},[e]),e?a.jsx(xm,{}):t}function bm({provider:e}){const{appName:t}=Ie(),n=`You have successfully connected your ${it(e)} account to ${t}.`;return a.jsx(Jr,{text:n})}function Cm({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,redirectUrl:r,onSuccess:s}){return a.jsx(gi,{provider:e,groupRef:o,children:a.jsx(Ys,{provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,onSuccess:s,children:a.jsx(_m,{redirectURL:r,children:a.jsx(bm,{provider:e})})})})}const Om=(e,t)=>{const n=xe(),{projectId:o}=Ie(),{integrations:i}=di(),[r,s]=y.useState(!1),[c,u]=y.useState(null);if(!n||!o)throw new Error("useIsIntegrationInstalled must be used within AmpersandProvider");if(!e)throw new Error("useIsIntegrationInstalled requires an integration name");if(!t)throw new Error("useIsIntegrationInstalled requires a groupRef");const d=y.useMemo(()=>i==null?void 0:i.reduce((p,h)=>(h==null?void 0:h.name)===e?h:p,{}),[i,e]);return y.useEffect(()=>{d&&fe().installationApi.listInstallations({projectIdOrName:o,integrationId:d.id,groupRef:t},{headers:{"x-api-key":n}}).then(p=>{s(!0),u(p.length>0)}).catch(p=>{console.error("Error listing installations."),Ce(p),s(!0)})},[t,n,o,d]),{isLoaded:r,isIntegrationInstalled:c}};exports.AmpersandContext=fi;exports.AmpersandProvider=rd;exports.ConnectProvider=Cm;exports.InstallIntegration=wm;exports.useAmpersandProvider=od;exports.useIsIntegrationInstalled=Om;