@amp-labs/react 2.2.4 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,30 +1,30 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),h=require("react");require("react-dom");function Hl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const V=Hl(h),Fs=h.createContext(null),Ul=Fs.Provider,ze=()=>{const e=h.useContext(Fs);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var _e=(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))(_e||{});const Ms=h.createContext(void 0);function St(){const e=h.useContext(Ms);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Bl=(()=>{const e={};return Object.values(_e).forEach(t=>{e[t]={}}),e})();function ql({children:e}){const[t,n]=h.useState(Bl),r=h.useCallback((d,f,m=!0)=>{n(p=>{const g={...p};return g[d]=g[d]||{},g[d][f]=m,g})},[n]),i=h.useCallback((d,f)=>{var m;return!!((m=t[d])!=null&&m[f])},[t]),o=h.useCallback((d,f)=>{var m;return(m=t[d])==null?void 0:m[f]},[t]),s=h.useCallback((d,f)=>{n(m=>{var g;const p={...m};return(g=p[d])==null||delete g[f],p})},[n]),a=h.useCallback(d=>{n(f=>{const m={...f};return m[d]={},m})},[n]),c=h.useCallback((d,f)=>{n(m=>{const p={...m};return p[d]=p[d]||{},f.forEach(g=>{p[d][g]=!0}),p})},[n]),u=h.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:a,setErrors:c,getError:o}),[t,n,r,i,s,a,c,o]);return l.jsx(Ms.Provider,{value:u,children:e})}const Wl="https://api.withampersand.com/v1".replace(/\/+$/,"");class Vo{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Wl}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||js}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 Jl=new Vo,$r=class $r{constructor(t=Jl){this.configuration=t,this.fetchApi=async(n,r)=>{let i={url:n,init:r};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let o;try{o=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const a of this.middleware)a.onError&&(o=await a.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:o?o.clone():void 0})||o);if(o===void 0)throw s instanceof Error?new Gl(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(o=await s.post({fetch:this.fetchApi,url:i.url,init:i.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?$r.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:i}=await this.createFetchParams(t,n),o=await this.fetchApi(r,i);if(o&&o.status>=200&&o.status<300)return o;throw new ks(o,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(u=>i[u]===void 0?delete i[u]:{});const o=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},a={...s,...await o({init:s,context:t})},c={...a,body:Xl(a.body)||a.body instanceof URLSearchParams||zl(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:c}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};$r.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Et=$r;function zl(e){return typeof Blob<"u"&&e instanceof Blob}function Xl(e){return typeof FormData<"u"&&e instanceof FormData}class ks extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Gl extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class oe extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function P(e,t){const n=e[t];return n!=null}function js(e,t=""){return Object.keys(e).map(n=>Ls(n,e[n],t)).filter(n=>n.length>0).join("&")}function Ls(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const i=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${i}`}if(t instanceof Set){const i=Array.from(t);return Ls(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?js(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Vr(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class De{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class fn{constructor(t){this.raw=t}async value(){}}class Yl{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Zl(e){return Ql(e)}function Ql(e,t){return e==null?e:{fieldUsed:P(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:P(e,"keyFormat")?e.keyFormat:void 0}}function eu(e){return tu(e)}function tu(e,t){return e==null?e:{name:e.name,valuePrefix:P(e,"valuePrefix")?e.valuePrefix:void 0}}function nu(e){return ru(e)}function ru(e,t){return e==null?e:{name:e.name}}function ou(e){return iu(e)}function iu(e,t){return e==null?e:{attachmentType:e.attachmentType,query:P(e,"query")?nu(e.query):void 0,header:P(e,"header")?eu(e.header):void 0,docsURL:P(e,"docsURL")?e.docsURL:void 0}}function su(e){return au(e)}function au(e,t){return e}function cu(e){return lu(e)}function lu(e,t){return e==null?e:{days:P(e,"days")?e.days:void 0,fullHistory:P(e,"fullHistory")?e.fullHistory:void 0}}function uu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Ks(e){return du(e)}function du(e,t){return e==null?e:{defaultPeriod:cu(e.defaultPeriod)}}function pu(e){if(e!==void 0)return e===null?null:{defaultPeriod:uu(e.defaultPeriod)}}function fu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function mu(e){if(e!==void 0)return e===null?null:{defaultPeriod:fu(e.defaultPeriod)}}function hu(e){return gu(e)}function gu(e,t){return e==null?e:{enabled:P(e,"enabled")?e.enabled:void 0}}function $s(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function vu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:mu(e.backfill)}}function yu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Vr(e.objects,vu)}}function Iu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults}}function wu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Vr(e.objects,Iu)}}function _u(e){return bu(e)}function bu(e,t){return e==null?e:{apiKeyAsBasic:P(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:P(e,"apiKeyAsBasicOpts")?Zl(e.apiKeyAsBasicOpts):void 0,docsURL:P(e,"docsURL")?e.docsURL:void 0}}function xu(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function dr(e){return Cu(e)}function Cu(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:P(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0}}function Ou(e){return Eu(e)}function Eu(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Nu(e){return Su(e)}function Su(e,t){return e==null?e:{provider:e.provider,read:P(e,"read")?e.read:void 0,write:P(e,"write")?e.write:void 0,proxy:P(e,"proxy")?hu(e.proxy):void 0}}function Tu(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:$s(e.proxy)}}function Ru(e){return Au(e)}function Au(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Nu(e.content)}}function Pu(e){return Du(e)}function Du(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0}}function Vs(e){return Fu(e)}function Fu(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0}}function Mu(e){return ku(e)}function ku(e,t){return e==null?e:{token:e.token}}function ju(e){return Lu(e)}function Lu(e,t){return e==null?e:{token:e.token}}function Ku(e){return $u(e)}function $u(e,t){return e==null?e:{accessToken:P(e,"accessToken")?Mu(e.accessToken):void 0,refreshToken:P(e,"refreshToken")?ju(e.refreshToken):void 0,scopes:P(e,"scopes")?e.scopes:void 0}}function wr(e){return Vu(e)}function Vu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:P(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:P(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0}}function _r(e){return Hu(e)}function Hu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:P(e,"providerApp")?wr(e.providerApp):void 0,group:Vs(e.group),consumer:Pu(e.consumer),providerWorkspaceRef:P(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:P(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:P(e,"oauth2AuthorizationCode")?Ku(e.oauth2AuthorizationCode):void 0}}function Uu(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Tu(e.content)}}function Bu(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Uu(e.config)}}function qu(e){return Wu(e)}function Wu(e,t){return e==null?e:{enabled:P(e,"enabled")?e.enabled:void 0}}function Ju(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function zu(e){return Xu(e)}function Xu(e,t){return e==null?e:{mode:P(e,"mode")?e.mode:void 0,pageSize:P(e,"pageSize")?e.pageSize:void 0}}function Gu(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Yu(e){let t=!0;return t=t&&"fieldName"in e,t}function Zu(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:P(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:P(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function Qu(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function ed(e){let t=!0;return t=t&&"mapToName"in e,t}function Hs(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:P(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:P(e,"default")?e.default:void 0,prompt:P(e,"prompt")?e.prompt:void 0}}function td(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Ki(e){return nd(e)}function nd(e,t){return e==null?e:{...Zu(e),...Hs(e)}}function $i(e){if(e!==void 0)return e===null?null:Yu(e)?Qu(e):ed(e)?td(e):{}}function Us(e){return rd(e)}function rd(e,t){return e}function od(e){return id(e)}function id(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:P(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:P(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:P(e,"requiredFields")?e.requiredFields.map(Ki):void 0,optionalFields:P(e,"optionalFields")?e.optionalFields.map(Ki):void 0,optionalFieldsAuto:P(e,"optionalFieldsAuto")?Us(e.optionalFieldsAuto):void 0,backfill:P(e,"backfill")?Ks(e.backfill):void 0,delivery:P(e,"delivery")?zu(e.delivery):void 0}}function sd(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map($i),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map($i),optionalFieldsAuto:e.optionalFieldsAuto,backfill:pu(e.backfill),delivery:Gu(e.delivery)}}function ad(e){return cd(e)}function cd(e,t){return e==null?e:{objects:P(e,"objects")?e.objects.map(od):void 0}}function ld(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(sd)}}function ud(e){return dd(e)}function dd(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:P(e,"inheritMapping")?e.inheritMapping:void 0}}function pd(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping}}function fd(e){return md(e)}function md(e,t){return e==null?e:{objects:P(e,"objects")?e.objects.map(ud):void 0}}function hd(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(pd)}}function gd(e){return vd(e)}function vd(e,t){return e==null?e:{name:e.name,displayName:P(e,"displayName")?e.displayName:void 0,provider:e.provider,read:P(e,"read")?ad(e.read):void 0,write:P(e,"write")?fd(e.write):void 0,proxy:P(e,"proxy")?qu(e.proxy):void 0}}function yd(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:ld(e.read),write:hd(e.write),proxy:Ju(e.proxy)}}function Id(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:yd(e.content)}}function wd(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Id(e.latestRevision)}}function _d(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function bd(e){if(e!==void 0)return e===null?null:{externalRef:e.externalRef,provider:e.provider,clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function xd(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Cd(e){return Od(e)}function Od(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Ed(e){return Nd(e)}function Nd(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:P(e,"valueType")?e.valueType:void 0,providerType:P(e,"providerType")?e.providerType:void 0,readOnly:P(e,"readOnly")?e.readOnly:void 0,values:P(e,"values")?e.values.map(Cd):void 0}}function Sd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Td(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Rd(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 Ad(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function Pd(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function Dd(e){if(e!==void 0)return e===null?null:{accessToken:Ad(e.accessToken),refreshToken:Pd(e.refreshToken),scopes:e.scopes}}function Fd(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:Sd(e.basicAuth),oauth2ClientCredentials:Td(e.oauth2ClientCredentials),oauth2Password:Rd(e.oauth2Password),oauth2AuthorizationCode:Dd(e.oauth2AuthorizationCode)}}function Md(e){return kd(e)}function kd(e,t){return e==null?e:{enabled:P(e,"enabled")?e.enabled:void 0}}function jd(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:P(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:P(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function oo(e){return Ld(e)}function Ld(e,t){return e==null?e:{...jd(e),...Hs(e)}}function Kd(e){return $d(e)}function $d(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:P(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:P(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:P(e,"requiredFields")?e.requiredFields.map(oo):void 0,optionalFields:P(e,"optionalFields")?e.optionalFields.map(oo):void 0,optionalFieldsAuto:P(e,"optionalFieldsAuto")?Us(e.optionalFieldsAuto):void 0,allFields:P(e,"allFields")?e.allFields.map(oo):void 0,allFieldsMetadata:P(e,"allFieldsMetadata")?Vr(e.allFieldsMetadata,Ed):void 0,backfill:P(e,"backfill")?Ks(e.backfill):void 0}}function Vd(e){return Hd(e)}function Hd(e,t){return e==null?e:{objects:P(e,"objects")?e.objects.map(Kd):void 0}}function Ud(e){return Bd(e)}function Bd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function qd(e){return Wd(e)}function Wd(e,t){return e==null?e:{objects:P(e,"objects")?e.objects.map(Ud):void 0}}function Jd(e){return zd(e)}function zd(e,t){return e==null?e:{name:e.name,displayName:P(e,"displayName")?e.displayName:void 0,provider:e.provider,read:P(e,"read")?Vd(e.read):void 0,write:P(e,"write")?qd(e.write):void 0,proxy:P(e,"proxy")?Md(e.proxy):void 0}}function Xd(e){return Gd(e)}function Gd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Jd(e.content)}}function pr(e){return Yd(e)}function Yd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:P(e,"group")?Vs(e.group):void 0,healthStatus:e.healthStatus,connection:_r(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0,config:Ru(e.config)}}function Zd(e){return Qd(e)}function Qd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:gd(e.content)}}function Vi(e){return ep(e)}function ep(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Zd(e.latestRevision)}}function tp(e){return np(e)}function np(e,t){return e==null?e:{iconURL:P(e,"iconURL")?e.iconURL:void 0,logoURL:P(e,"logoURL")?e.logoURL:void 0}}function rp(e){return op(e)}function op(e,t){return e==null?e:{iconURL:P(e,"iconURL")?e.iconURL:void 0,logoURL:P(e,"logoURL")?e.logoURL:void 0}}function ip(e){return sp(e)}function sp(e,t){return e==null?e:{regular:P(e,"regular")?rp(e.regular):void 0,darkMode:P(e,"darkMode")?tp(e.darkMode):void 0}}function ap(e){return cp(e)}function cp(e,t){return e==null?e:{workspaceRefField:P(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:P(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:P(e,"scopesField")?e.scopesField:void 0}}function lp(e){return up(e)}function up(e,t){return e==null?e:{grantType:e.grantType,authURL:P(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:P(e,"audience")?e.audience:void 0,tokenMetadataFields:ap(e.tokenMetadataFields),docsURL:P(e,"docsURL")?e.docsURL:void 0,authURLParams:P(e,"authURLParams")?e.authURLParams:void 0}}function dp(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function pp(e){return fp(e)}function fp(e,t){return e==null?e:{bulkWrite:Ou(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function Hi(e){return mp(e)}function mp(e,t){return e==null?e:{name:e.name,authType:su(e.authType),baseURL:e.baseURL,oauth2Opts:P(e,"oauth2Opts")?lp(e.oauth2Opts):void 0,apiKeyOpts:P(e,"apiKeyOpts")?ou(e.apiKeyOpts):void 0,basicOpts:P(e,"basicOpts")?_u(e.basicOpts):void 0,support:pp(e.support),providerOpts:e.providerOpts,displayName:P(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:P(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:P(e,"media")?ip(e.media):void 0,labels:P(e,"labels")?e.labels:void 0}}function hp(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:yu(e.read),write:wu(e.write),proxy:$s(e.proxy)}}function gp(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:hp(e.content)}}function vp(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:gp(e.config)}}function yp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:vp(e.installation)}}function Ip(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function wp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:Ip(e.project)}}function _p(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 bp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:_p(e.providerApp)}}class xp extends Et{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new oe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:i,query:r},n);return new fn(o)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Fd(t.generateConnectionParams)},n);return new De(o,s=>_r(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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new oe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:i,query:r},n);return new De(o,s=>_r(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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(_r))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class Cp extends Et{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new oe("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Bu(t.installation)},n);return new De(o,s=>pr(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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:i,query:r},n);return new fn(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:i,query:r},n);return new De(o,s=>pr(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(pr))}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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new oe("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:i,query:r,body:yp(t.installationUpdate)},n);return new De(o,s=>pr(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Op extends Et{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:xu(t.batchUpsertIntegrationsRequest)},n);return new De(o,s=>s.map(Vi))}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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new oe("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:wd(t.integration)},n);return new fn(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:i,query:r},n);return new fn(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(Vi))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Ep extends Et{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new oe("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};i["Content-Type"]="application/json";const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:dp(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new De(o):new Yl(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class Np extends Et{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new oe("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:_d(t.project)},n);return new De(o,s=>dr(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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:r},n);return new fn(o)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>dr(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new De(i,o=>o.map(dr))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new oe("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:wp(t.projectUpdate)},n);return new De(o,s=>dr(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Sp extends Et{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new oe("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new De(o,s=>Hi(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new De(i,o=>Vr(o,Hi))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Tp extends Et{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new oe("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:bd(t.providerApp)},n);return new De(o,s=>wr(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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new oe("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:i,query:r},n);return new fn(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(wr))}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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new oe("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new oe("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:i,query:r,body:bp(t.providerAppUpdate)},n);return new De(o,s=>wr(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Rp extends Et{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:xd(t.revision)},n);return new fn(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new oe("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new oe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:i,query:r},n);return new De(o,s=>Xd(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class Bs{constructor(t){this.connectionApi=new xp(t),this.installationApi=new Cp(t),this.integrationApi=new Op(t),this.oAuthApi=new Ep(t),this.projectApi=new Np(t),this.providerApi=new Sp(t),this.providerAppApi=new Tp(t),this.revisionApi=new Rp(t)}}const qs="2.2.4",Ap="v1",fr="https://api.withampersand.com";function Ws(){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 fr;case"mock":return"http://127.0.0.1:4010";case"":return fr;default:return e??fr}}catch{return fr}}const Pp=(e,t)=>`${e}/${t}`;function Dp(){return Pp(Ws(),Ap)}const Fp=Ws(),Js=Dp(),Mp=new Vo({basePath:Js,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":qs}});let kp=new Bs(Mp);const Te=()=>kp;function zs(){const e=ze();return h.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new Vo({basePath:Js,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":qs,"X-Api-Key":e}});return new Bs(n)},[e])}const Je=async(e,t)=>{var n;if(e instanceof ks){const{status:r,statusText:i}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,i);const o=await e.response.json(),s=((n=o==null?void 0:o.causes)==null?void 0:n.join(`
2
- `))||"[ERROR] Creating installation failed.";console.error("[Error Message]",s),t&&t(s)}else console.error("Unexpected error:",e.message)},Xs=h.createContext({integrations:null,isLoading:!0}),Ho=()=>{const e=h.useContext(Xs);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function jp({projectIdOrName:e,children:t}){const n=ze(),{setError:r}=St(),[i,o]=h.useState(null),[s,a]=h.useState(!0);h.useEffect(()=>{Te().integrationApi.listIntegrations({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(u=>{a(!1),o(u||[])}).catch(u=>{console.error("Error retrieving integration information."),Je(u),a(!1),r(_e.INTEGRATION_LIST,e)})},[e,n,r]);const c=h.useMemo(()=>({integrations:i,isLoading:s}),[i,s]);return l.jsx(Xs.Provider,{value:c,children:t})}const Gs=h.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Ae=()=>{const e=h.useContext(Gs);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Lp({projectIdOrName:e,children:t}){const n=zs(),{setError:r}=St(),[i,o]=h.useState(null),[s,a]=h.useState(!0);h.useEffect(()=>{async function u(){(await n()).projectApi.getProject({projectIdOrName:e}).then(f=>{a(!1),o(f)}).catch(f=>{console.error("Error loading Ampersand project."),Je(f),r(_e.PROJECT,e),a(!1)})}u()},[e,a,r,n]);const c=h.useMemo(()=>({projectId:(i==null?void 0:i.id)||"",projectIdOrName:e,project:i,appName:(i==null?void 0:i.appName)||"",isLoading:s}),[e,i,s]);return l.jsx(Gs.Provider,{value:c,children:t})}function Kp(e){const{options:{apiKey:t,projectId:n,project:r},children:i}=e,o=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!o)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return l.jsx(ql,{children:l.jsx(Ul,{value:t,children:l.jsx(Lp,{projectIdOrName:o,children:l.jsx(jp,{projectIdOrName:o,children:i})})})})}const Ys=h.createContext(null);function $p(){const e=h.useContext(Ys);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
3
- component is wrapped with AmpersandProvider`);return e}function Vp(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Hp="_box_1p7c5_1",Ui={box:Hp};function Qt({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${Ui.box} ${t}`:Ui.box,style:n,children:e})}const Up="_container_1wvzr_1",Bi={container:Up};function Pn({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${Bi.container} ${t}`:Bi.container,style:n,children:e})}const Bp="_errorBoxContainer_4sdb2_1",qp="_errorBox_4sdb2_1",Wp="_errorText_4sdb2_20",io={errorBoxContainer:Bp,errorBox:qp,errorText:Wp};function Zs({message:e}){return l.jsxs(Pn,{className:io.errorBoxContainer,children:[l.jsx(Vp,{}),l.jsx(Qt,{className:io.errorBox,children:l.jsx("p",{className:io.errorText,children:e})})]})}const Jp="_loader_6ubm6_1",zp="_rotate_6ubm6_1",Xp="_ball1_6ubm6_1",Gp="_ball2_6ubm6_1",Yp={loader:Jp,rotate:zp,ball1:Xp,ball2:Gp};function Zp(){return l.jsx("span",{className:Yp.loader})}function Un(){return l.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:l.jsx(Zp,{})})}function Qs({children:e}){return l.jsx(Pn,{style:{maxWidth:"55rem"},children:l.jsx(Qt,{children:e})})}function Hr(){return l.jsx(Qs,{children:l.jsx(Un,{})})}function $t({message:e}){return l.jsx(Qs,{children:l.jsx(Zs,{message:e})})}const ea=()=>{const[e,t]=h.useState(!1),n=h.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}};function Uo(e,t){try{return process.env[e]}catch{return t}}function Bn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function en(e,t){return(t==null?void 0:t.displayName)??Bn(e)}const Qp=e=>e.split(`
4
- `).filter(n=>n.trim()!==""),ef=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,ta=h.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 nt(){const e=h.useContext(ta);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function tf({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:u}){const d=ze(),{projectId:f}=Ae(),{integrations:m}=Ho(),{setError:p,isError:g}=St(),{isIntegrationDeleted:I,setIntegrationDeleted:_}=ea(),[C,y]=h.useState([]),[b,x]=h.useState(!0),w=(C==null?void 0:C[0])||null,E=h.useMemo(()=>ef(t,m||[]),[t,m]);h.useEffect(()=>{E===null&&(m!=null&&m.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,E,m]);const j=h.useCallback(z=>{y([z])},[y]),N=h.useCallback(()=>{E!=null&&E.id&&Te().installationApi.listInstallations({projectIdOrName:f,integrationId:E.id,groupRef:i},{headers:{"X-Api-Key":d??""}}).then(z=>{x(!1),y(z||[])}).catch(z=>{p(_e.INSTALLATION_LIST,E.id),x(!1),console.error("Error retrieving installation information: ",z)})},[E,f,d,p,i]),U=(E==null?void 0:E.id)||"";h.useEffect(()=>{N()},[N]);const W=h.useMemo(()=>({integrationId:(E==null?void 0:E.id)||"",provider:(E==null?void 0:E.provider)||"",integrationObj:E,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:w,setInstallation:j,resetInstallations:N,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:I,setIntegrationDeleted:_,fieldMapping:u}),[E,n,r,i,o,w,j,N,s,a,c,I,_,u]);if(b)return l.jsx(Hr,{});if(E===null)return l.jsx($t,{message:`Integration "${t}" not found`});if(g(_e.INSTALLATION_LIST,U)){const z=`Error retrieving installation information for integration "${(E==null?void 0:E.name)||"unknown"}"`;return l.jsx($t,{message:z})}return l.jsx(ta.Provider,{value:W,children:e})}const na=h.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{},isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}}),In=()=>{const e=h.useContext(na);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function ra({provider:e,groupRef:t,children:n}){const r=zs(),{projectId:i,isLoading:o}=Ae(),[s,a]=h.useState(null),[c,u]=h.useState(null),[d,f]=h.useState(!0),{setError:m,isError:p}=St(),{provider:g}=nt(),{isIntegrationDeleted:I,setIntegrationDeleted:_}=ea(),C=e||g;if(!C)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");h.useEffect(()=>{async function b(){const x=await r();if(!i)throw new Error("Project ID not found. Component must be used within AmpersandProvider");x.connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:C}).then(w=>{f(!1),a(w)}).catch(w=>{console.error(`Error retrieving existing connections for group ID ${t}.`),Je(w),f(!1),m(_e.CONNECTION_LIST,i)})}i&&b()},[i,t,C,m,r,I]),h.useEffect(()=>{c&&(c.provider!==C?(console.warn("Provider has changed, resetting selected connection"),u(null)):s!=null&&s.length&&(s.some(x=>x.id===c.id)||(console.warn("Selected connection not found in connections list, resetting selected connection"),u(null))))},[s,c,C]),h.useEffect(()=>{if(!c&&s&&s.length>0){const[b]=s;u(b)}},[s,c]);const y=h.useMemo(()=>({connections:s,selectedConnection:c,setConnections:a,setSelectedConnection:u,isIntegrationDeleted:I,setIntegrationDeleted:_}),[s,c,a,u,I,_]);if(d||o)return l.jsx(Hr,{});if(p(_e.PROJECT,i))return l.jsx($t,{message:`Error loading project ${i}`});if(p(_e.CONNECTION_LIST,i))return l.jsx($t,{message:"Error retrieving existing connections"});if(!i)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return l.jsx(na.Provider,{value:y,children:n})}function oa(){const[e,t]=h.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const nf="_resetContainer_lkwv9_4",ia={resetContainer:nf};var mr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Or={exports:{}};Or.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",u="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",m="[object Error]",p="[object Function]",g="[object GeneratorFunction]",I="[object Map]",_="[object Number]",C="[object Null]",y="[object Object]",b="[object Promise]",x="[object Proxy]",w="[object RegExp]",E="[object Set]",j="[object String]",N="[object Symbol]",U="[object Undefined]",W="[object WeakMap]",z="[object ArrayBuffer]",Y="[object DataView]",ee="[object Float32Array]",B="[object Float64Array]",se="[object Int8Array]",ne="[object Int16Array]",Q="[object Int32Array]",de="[object Uint8Array]",fe="[object Uint8ClampedArray]",S="[object Uint16Array]",D="[object Uint32Array]",L=/[\\^$.*+?()[\]{}|]/g,M=/^\[object .+?Constructor\]$/,F=/^(?:0|[1-9]\d*)$/,R={};R[ee]=R[B]=R[se]=R[ne]=R[Q]=R[de]=R[fe]=R[S]=R[D]=!0,R[a]=R[c]=R[z]=R[d]=R[Y]=R[f]=R[m]=R[p]=R[I]=R[_]=R[y]=R[w]=R[E]=R[j]=R[W]=!1;var X=typeof mr=="object"&&mr&&mr.Object===Object&&mr,G=typeof self=="object"&&self&&self.Object===Object&&self,K=X||G||Function("return this")(),Z=t&&!t.nodeType&&t,q=Z&&!0&&e&&!e.nodeType&&e,ae=q&&q.exports===Z,A=ae&&X.process,pe=function(){try{return A&&A.binding&&A.binding("util")}catch{}}(),$=pe&&pe.isTypedArray;function Ie(v,O){for(var T=-1,J=v==null?0:v.length,xe=0,ce=[];++T<J;){var Se=v[T];O(Se,T,v)&&(ce[xe++]=Se)}return ce}function Pe(v,O){for(var T=-1,J=O.length,xe=v.length;++T<J;)v[xe+T]=O[T];return v}function He(v,O){for(var T=-1,J=v==null?0:v.length;++T<J;)if(O(v[T],T,v))return!0;return!1}function Fe(v,O){for(var T=-1,J=Array(v);++T<v;)J[T]=O(T);return J}function me(v){return function(O){return v(O)}}function gt(v,O){return v.has(O)}function Ue(v,O){return v==null?void 0:v[O]}function rt(v){var O=-1,T=Array(v.size);return v.forEach(function(J,xe){T[++O]=[xe,J]}),T}function vt(v,O){return function(T){return v(O(T))}}function yt(v){var O=-1,T=Array(v.size);return v.forEach(function(J){T[++O]=J}),T}var Be=Array.prototype,Ke=Function.prototype,Me=Object.prototype,Oe=K["__core-js_shared__"],It=Ke.toString,Xe=Me.hasOwnProperty,At=function(){var v=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||"");return v?"Symbol(src)_1."+v:""}(),Vt=Me.toString,ot=RegExp("^"+It.call(Xe).replace(L,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ee=ae?K.Buffer:void 0,Pt=K.Symbol,Ht=K.Uint8Array,Dt=Me.propertyIsEnumerable,nn=Be.splice,Ze=Pt?Pt.toStringTag:void 0,Ft=Object.getOwnPropertySymbols,Ut=Ee?Ee.isBuffer:void 0,rn=vt(Object.keys,Object),Bt=wn(K,"DataView"),Ce=wn(K,"Map"),Ge=wn(K,"Promise"),te=wn(K,"Set"),ue=wn(K,"WeakMap"),ke=wn(Object,"create"),Mt=an(Bt),H=an(Ce),re=an(Ge),ie=an(te),Re=an(ue),je=Pt?Pt.prototype:void 0,Qe=je?je.valueOf:void 0;function $e(v){var O=-1,T=v==null?0:v.length;for(this.clear();++O<T;){var J=v[O];this.set(J[0],J[1])}}function qe(){this.__data__=ke?ke(null):{},this.size=0}function et(v){var O=this.has(v)&&delete this.__data__[v];return this.size-=O?1:0,O}function be(v){var O=this.__data__;if(ke){var T=O[v];return T===r?void 0:T}return Xe.call(O,v)?O[v]:void 0}function on(v){var O=this.__data__;return ke?O[v]!==void 0:Xe.call(O,v)}function to(v,O){var T=this.__data__;return this.size+=this.has(v)?0:1,T[v]=ke&&O===void 0?r:O,this}$e.prototype.clear=qe,$e.prototype.delete=et,$e.prototype.get=be,$e.prototype.has=on,$e.prototype.set=to;function pt(v){var O=-1,T=v==null?0:v.length;for(this.clear();++O<T;){var J=v[O];this.set(J[0],J[1])}}function nr(){this.__data__=[],this.size=0}function rr(v){var O=this.__data__,T=sr(O,v);if(T<0)return!1;var J=O.length-1;return T==J?O.pop():nn.call(O,T,1),--this.size,!0}function or(v){var O=this.__data__,T=sr(O,v);return T<0?void 0:O[T][1]}function we(v){return sr(this.__data__,v)>-1}function wt(v,O){var T=this.__data__,J=sr(T,v);return J<0?(++this.size,T.push([v,O])):T[J][1]=O,this}pt.prototype.clear=nr,pt.prototype.delete=rr,pt.prototype.get=or,pt.prototype.has=we,pt.prototype.set=wt;function _t(v){var O=-1,T=v==null?0:v.length;for(this.clear();++O<T;){var J=v[O];this.set(J[0],J[1])}}function sn(){this.size=0,this.__data__={hash:new $e,map:new(Ce||pt),string:new $e}}function no(v){var O=ar(this,v).delete(v);return this.size-=O?1:0,O}function kn(v){return ar(this,v).get(v)}function pl(v){return ar(this,v).has(v)}function fl(v,O){var T=ar(this,v),J=T.size;return T.set(v,O),this.size+=T.size==J?0:1,this}_t.prototype.clear=sn,_t.prototype.delete=no,_t.prototype.get=kn,_t.prototype.has=pl,_t.prototype.set=fl;function ir(v){var O=-1,T=v==null?0:v.length;for(this.__data__=new _t;++O<T;)this.add(v[O])}function ml(v){return this.__data__.set(v,r),this}function hl(v){return this.__data__.has(v)}ir.prototype.add=ir.prototype.push=ml,ir.prototype.has=hl;function qt(v){var O=this.__data__=new pt(v);this.size=O.size}function gl(){this.__data__=new pt,this.size=0}function vl(v){var O=this.__data__,T=O.delete(v);return this.size=O.size,T}function yl(v){return this.__data__.get(v)}function Il(v){return this.__data__.has(v)}function wl(v,O){var T=this.__data__;if(T instanceof pt){var J=T.__data__;if(!Ce||J.length<n-1)return J.push([v,O]),this.size=++T.size,this;T=this.__data__=new _t(J)}return T.set(v,O),this.size=T.size,this}qt.prototype.clear=gl,qt.prototype.delete=vl,qt.prototype.get=yl,qt.prototype.has=Il,qt.prototype.set=wl;function _l(v,O){var T=cr(v),J=!T&&kl(v),xe=!T&&!J&&ro(v),ce=!T&&!J&&!xe&&ji(v),Se=T||J||xe||ce,Ve=Se?Fe(v.length,String):[],We=Ve.length;for(var Ne in v)Xe.call(v,Ne)&&!(Se&&(Ne=="length"||xe&&(Ne=="offset"||Ne=="parent")||ce&&(Ne=="buffer"||Ne=="byteLength"||Ne=="byteOffset")||Al(Ne,We)))&&Ve.push(Ne);return Ve}function sr(v,O){for(var T=v.length;T--;)if(Di(v[T][0],O))return T;return-1}function bl(v,O,T){var J=O(v);return cr(v)?J:Pe(J,T(v))}function jn(v){return v==null?v===void 0?U:C:Ze&&Ze in Object(v)?Tl(v):Ml(v)}function Ti(v){return Ln(v)&&jn(v)==a}function Ri(v,O,T,J,xe){return v===O?!0:v==null||O==null||!Ln(v)&&!Ln(O)?v!==v&&O!==O:xl(v,O,T,J,Ri,xe)}function xl(v,O,T,J,xe,ce){var Se=cr(v),Ve=cr(O),We=Se?c:Wt(v),Ne=Ve?c:Wt(O);We=We==a?y:We,Ne=Ne==a?y:Ne;var it=We==y,bt=Ne==y,Ye=We==Ne;if(Ye&&ro(v)){if(!ro(O))return!1;Se=!0,it=!1}if(Ye&&!it)return ce||(ce=new qt),Se||ji(v)?Ai(v,O,T,J,xe,ce):Nl(v,O,We,T,J,xe,ce);if(!(T&i)){var ft=it&&Xe.call(v,"__wrapped__"),mt=bt&&Xe.call(O,"__wrapped__");if(ft||mt){var Jt=ft?v.value():v,kt=mt?O.value():O;return ce||(ce=new qt),xe(Jt,kt,T,J,ce)}}return Ye?(ce||(ce=new qt),Sl(v,O,T,J,xe,ce)):!1}function Cl(v){if(!ki(v)||Dl(v))return!1;var O=Fi(v)?ot:M;return O.test(an(v))}function Ol(v){return Ln(v)&&Mi(v.length)&&!!R[jn(v)]}function El(v){if(!Fl(v))return rn(v);var O=[];for(var T in Object(v))Xe.call(v,T)&&T!="constructor"&&O.push(T);return O}function Ai(v,O,T,J,xe,ce){var Se=T&i,Ve=v.length,We=O.length;if(Ve!=We&&!(Se&&We>Ve))return!1;var Ne=ce.get(v);if(Ne&&ce.get(O))return Ne==O;var it=-1,bt=!0,Ye=T&o?new ir:void 0;for(ce.set(v,O),ce.set(O,v);++it<Ve;){var ft=v[it],mt=O[it];if(J)var Jt=Se?J(mt,ft,it,O,v,ce):J(ft,mt,it,v,O,ce);if(Jt!==void 0){if(Jt)continue;bt=!1;break}if(Ye){if(!He(O,function(kt,cn){if(!gt(Ye,cn)&&(ft===kt||xe(ft,kt,T,J,ce)))return Ye.push(cn)})){bt=!1;break}}else if(!(ft===mt||xe(ft,mt,T,J,ce))){bt=!1;break}}return ce.delete(v),ce.delete(O),bt}function Nl(v,O,T,J,xe,ce,Se){switch(T){case Y:if(v.byteLength!=O.byteLength||v.byteOffset!=O.byteOffset)return!1;v=v.buffer,O=O.buffer;case z:return!(v.byteLength!=O.byteLength||!ce(new Ht(v),new Ht(O)));case d:case f:case _:return Di(+v,+O);case m:return v.name==O.name&&v.message==O.message;case w:case j:return v==O+"";case I:var Ve=rt;case E:var We=J&i;if(Ve||(Ve=yt),v.size!=O.size&&!We)return!1;var Ne=Se.get(v);if(Ne)return Ne==O;J|=o,Se.set(v,O);var it=Ai(Ve(v),Ve(O),J,xe,ce,Se);return Se.delete(v),it;case N:if(Qe)return Qe.call(v)==Qe.call(O)}return!1}function Sl(v,O,T,J,xe,ce){var Se=T&i,Ve=Pi(v),We=Ve.length,Ne=Pi(O),it=Ne.length;if(We!=it&&!Se)return!1;for(var bt=We;bt--;){var Ye=Ve[bt];if(!(Se?Ye in O:Xe.call(O,Ye)))return!1}var ft=ce.get(v);if(ft&&ce.get(O))return ft==O;var mt=!0;ce.set(v,O),ce.set(O,v);for(var Jt=Se;++bt<We;){Ye=Ve[bt];var kt=v[Ye],cn=O[Ye];if(J)var Li=Se?J(cn,kt,Ye,O,v,ce):J(kt,cn,Ye,v,O,ce);if(!(Li===void 0?kt===cn||xe(kt,cn,T,J,ce):Li)){mt=!1;break}Jt||(Jt=Ye=="constructor")}if(mt&&!Jt){var lr=v.constructor,ur=O.constructor;lr!=ur&&"constructor"in v&&"constructor"in O&&!(typeof lr=="function"&&lr instanceof lr&&typeof ur=="function"&&ur instanceof ur)&&(mt=!1)}return ce.delete(v),ce.delete(O),mt}function Pi(v){return bl(v,Kl,Rl)}function ar(v,O){var T=v.__data__;return Pl(O)?T[typeof O=="string"?"string":"hash"]:T.map}function wn(v,O){var T=Ue(v,O);return Cl(T)?T:void 0}function Tl(v){var O=Xe.call(v,Ze),T=v[Ze];try{v[Ze]=void 0;var J=!0}catch{}var xe=Vt.call(v);return J&&(O?v[Ze]=T:delete v[Ze]),xe}var Rl=Ft?function(v){return v==null?[]:(v=Object(v),Ie(Ft(v),function(O){return Dt.call(v,O)}))}:$l,Wt=jn;(Bt&&Wt(new Bt(new ArrayBuffer(1)))!=Y||Ce&&Wt(new Ce)!=I||Ge&&Wt(Ge.resolve())!=b||te&&Wt(new te)!=E||ue&&Wt(new ue)!=W)&&(Wt=function(v){var O=jn(v),T=O==y?v.constructor:void 0,J=T?an(T):"";if(J)switch(J){case Mt:return Y;case H:return I;case re:return b;case ie:return E;case Re:return W}return O});function Al(v,O){return O=O??s,!!O&&(typeof v=="number"||F.test(v))&&v>-1&&v%1==0&&v<O}function Pl(v){var O=typeof v;return O=="string"||O=="number"||O=="symbol"||O=="boolean"?v!=="__proto__":v===null}function Dl(v){return!!At&&At in v}function Fl(v){var O=v&&v.constructor,T=typeof O=="function"&&O.prototype||Me;return v===T}function Ml(v){return Vt.call(v)}function an(v){if(v!=null){try{return It.call(v)}catch{}try{return v+""}catch{}}return""}function Di(v,O){return v===O||v!==v&&O!==O}var kl=Ti(function(){return arguments}())?Ti:function(v){return Ln(v)&&Xe.call(v,"callee")&&!Dt.call(v,"callee")},cr=Array.isArray;function jl(v){return v!=null&&Mi(v.length)&&!Fi(v)}var ro=Ut||Vl;function Ll(v,O){return Ri(v,O)}function Fi(v){if(!ki(v))return!1;var O=jn(v);return O==p||O==g||O==u||O==x}function Mi(v){return typeof v=="number"&&v>-1&&v%1==0&&v<=s}function ki(v){var O=typeof v;return v!=null&&(O=="object"||O=="function")}function Ln(v){return v!=null&&typeof v=="object"}var ji=$?me($):Ol;function Kl(v){return jl(v)?_l(v):El(v)}function $l(){return[]}function Vl(){return!1}e.exports=Ll})(Or,Or.exports);var rf=Or.exports;const of=Bo(rf),mn="other",Er="uninstall-installation";function Gt(e){return!e.fieldName}function sf(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function af(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Gt(n)&&!!n.fieldName))||null}function cf(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Gt(r)&&!!r.mapToName))||[]}function lf(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>Gt(r)&&!!r.mapToName))||[]}function uf(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Gt(n)&&!!n.fieldName))||null}const sa=(e,t)=>{var n,r,i;return(i=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:i[t]};function df(e){return Gt(e)?e.mapToName:e.fieldName}const aa=(e,t)=>{var r,i,o;const n=[];return(o=(i=(r=t.content)==null?void 0:r.read)==null?void 0:i.objects)==null||o.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&Bn(s==null?void 0:s.objectName),completed:e?!!sa(e,s.objectName):!1})}),n},ca=e=>{var n;return{name:mn,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function pf(e,t){var o;const n=aa(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?ca(e):void 0;return i&&n.push(i),n}function la(e,t,n){const r=(e==null?void 0:e.filter(o=>!(t!=null&&t[o==null?void 0:o.mapToName])))||[],i=r.map(o=>o.mapToName);return n(_e.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Ur(e,t){return of(e,t)}const ff=(e,t,n)=>{var _,C,y,b,x,w,E,j,N;if(!e)return null;const r=sf(e,t),i=r&&af(r),o=r&&uf(r),s=r&&cf(r),a=r&&lf(r),c=(r==null?void 0:r.allFields)||[],u=(r==null?void 0:r.allFieldsMetadata)||{},d=n==null?void 0:n.content,f=((y=(C=(_=d==null?void 0:d.read)==null?void 0:_.objects)==null?void 0:C[t])==null?void 0:y.selectedFields)||{},m=((w=(x=(b=d==null?void 0:d.read)==null?void 0:b.objects)==null?void 0:x[t])==null?void 0:w.selectedValueMappings)||{},p=((N=(j=(E=d==null?void 0:d.read)==null?void 0:E.objects)==null?void 0:j[t])==null?void 0:N.selectedFieldMappings)||{},g={...f},I={...p};return{allFields:c,allFieldsMetadata:u,requiredFields:i,optionalFields:o,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:f,selectedFieldMappings:p,selectedValueMappings:m,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:g,requiredMapFields:I,selectedValueMappings:m}}},mf=(e,t)=>{var s,a;if(!e)return null;const n=(a=(s=t==null?void 0:t.content)==null?void 0:s.write)==null?void 0:a.objects,r=Object.keys(n||{}),i={};r.forEach(c=>{i[c]=!0});const o={...i};return{writeObjects:(e==null?void 0:e.objects)||[],selectedNonConfigurableWriteFields:i,isWriteModified:!1,savedConfig:{selectedNonConfigurableWriteFields:o}}};function ua(e,t,n){var o,s;const r=(o=e==null?void 0:e.content)==null?void 0:o.read,i=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:ff(r,t,n),write:mf(i,n)}}const da=(e,t,n,r)=>{const i=ua(e,n,t);r(n,i)},hf=(e,t,n)=>{const r=pf(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=ua(e,o,t))}),n(i)},pa=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(df(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},fa=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n},ma=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function ha(e,t){return t[e]||void 0}async function qo({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:i,apiKey:o,setError:s,setInstallation:a,onInstallSuccess:c}){const u={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:i,config:e}};try{const d=await Te().installationApi.createInstallation(u,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}});a(d),c==null||c(d.id,d.config)}catch(d){Je(d,s)}}function Br(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const gf=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(i=>i.objectName===t)},vf=(e,t,n,r)=>{const i=pa(e),o=fa(e),s=ma(e),a=gf(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:a.schedule,destination:a.destination,selectedFields:i,selectedFieldMappings:o,selectedValueMappings:s||{},backfill:a.backfill}}}}};return Br(n)&&(c.content.proxy={enabled:!0}),c},yf=(e,t,n,r,i,o,s,a,c,u,d,f)=>{const m=vf(c,o,a,r);return m?qo({createConfig:m,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:u,setInstallation:d,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},ga=e=>{var o,s;const t={},n=(o=e.write)==null?void 0:o.writeObjects,r=(s=e.write)==null?void 0:s.selectedNonConfigurableWriteFields,i=r?Object.keys(r):[];return n&&n.forEach(a=>{const c=a.objectName;i.includes(c)&&(t[c]={objectName:c})}),t},If=e=>{const t=e.content.write;return t==null?void 0:t.objects},wf=(e,t,n)=>{if(!If(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=ga(e),o={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return Br(t)&&(o.content.proxy={enabled:!0}),o},_f=(e,t,n,r,i,o,s,a,c,u,d)=>{const f=wf(a,s,r);return f?qo({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:c,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},bf={backgroundColor:"var(--amp-colors-status-critical-muted)",borderColor:"var(--amp-colors-status-critical-muted)",color:"var(--amp-colors-status-critical-dark)",padding:".5rem 1rem"};function va({children:e,style:t}){return l.jsx(Qt,{style:{...bf,...t},children:e})}var ya={exports:{}};/*!
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),g=require("react");require("react-dom");function zl(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const H=zl(g),js=g.createContext(null),Xl=js.Provider,ze=()=>{const e=g.useContext(js);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var _e=(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))(_e||{});const Ls=g.createContext(void 0);function Tt(){const e=g.useContext(Ls);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Gl=(()=>{const e={};return Object.values(_e).forEach(t=>{e[t]={}}),e})();function Yl({children:e}){const[t,n]=g.useState(Gl),r=g.useCallback((d,p,f=!0)=>{n(m=>{const v={...m};return v[d]=v[d]||{},v[d][p]=f,v})},[n]),i=g.useCallback((d,p)=>{var f;return!!((f=t[d])!=null&&f[p])},[t]),o=g.useCallback((d,p)=>{var f;return(f=t[d])==null?void 0:f[p]},[t]),s=g.useCallback((d,p)=>{n(f=>{var v;const m={...f};return(v=m[d])==null||delete v[p],m})},[n]),a=g.useCallback(d=>{n(p=>{const f={...p};return f[d]={},f})},[n]),c=g.useCallback((d,p)=>{n(f=>{const m={...f};return m[d]=m[d]||{},p.forEach(v=>{m[d][v]=!0}),m})},[n]),u=g.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:a,setErrors:c,getError:o}),[t,n,r,i,s,a,c,o]);return l.jsx(Ls.Provider,{value:u,children:e})}const Zl="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ho{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Zl}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Ks}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 Ql=new Ho,$r=class $r{constructor(t=Ql){this.configuration=t,this.fetchApi=async(n,r)=>{let i={url:n,init:r};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let o;try{o=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const a of this.middleware)a.onError&&(o=await a.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:o?o.clone():void 0})||o);if(o===void 0)throw s instanceof Error?new nu(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(o=await s.post({fetch:this.fetchApi,url:i.url,init:i.init,response:o.clone()})||o);return o},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(r=>({pre:r}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(r=>({post:r}));return this.withMiddleware(...n)}isJsonMime(t){return t?$r.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:i}=await this.createFetchParams(t,n),o=await this.fetchApi(r,i);if(o&&o.status>=200&&o.status<300)return o;throw new Vs(o,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(u=>i[u]===void 0?delete i[u]:{});const o=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},a={...s,...await o({init:s,context:t})},c={...a,body:tu(a.body)||a.body instanceof URLSearchParams||eu(a.body)?a.body:JSON.stringify(a.body)};return{url:r,init:c}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};$r.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Nt=$r;function eu(e){return typeof Blob<"u"&&e instanceof Blob}function tu(e){return typeof FormData<"u"&&e instanceof FormData}class Vs extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class nu extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class oe extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function R(e,t){const n=e[t];return n!=null}function Ks(e,t=""){return Object.keys(e).map(n=>$s(n,e[n],t)).filter(n=>n.length>0).join("&")}function $s(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const i=t.map(o=>encodeURIComponent(String(o))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${i}`}if(t instanceof Set){const i=Array.from(t);return $s(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Ks(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Hr(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class De{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class mn{constructor(t){this.raw=t}async value(){}}class ru{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function ou(e){return iu(e)}function iu(e,t){return e==null?e:{fieldUsed:R(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:R(e,"keyFormat")?e.keyFormat:void 0}}function su(e){return au(e)}function au(e,t){return e==null?e:{name:e.name,valuePrefix:R(e,"valuePrefix")?e.valuePrefix:void 0}}function cu(e){return lu(e)}function lu(e,t){return e==null?e:{name:e.name}}function uu(e){return du(e)}function du(e,t){return e==null?e:{attachmentType:e.attachmentType,query:R(e,"query")?cu(e.query):void 0,header:R(e,"header")?su(e.header):void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function pu(e){return fu(e)}function fu(e,t){return e}function mu(e){return hu(e)}function hu(e,t){return e==null?e:{days:R(e,"days")?e.days:void 0,fullHistory:R(e,"fullHistory")?e.fullHistory:void 0}}function gu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Hs(e){return vu(e)}function vu(e,t){return e==null?e:{defaultPeriod:mu(e.defaultPeriod)}}function yu(e){if(e!==void 0)return e===null?null:{defaultPeriod:gu(e.defaultPeriod)}}function wu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Iu(e){if(e!==void 0)return e===null?null:{defaultPeriod:wu(e.defaultPeriod)}}function _u(e){return bu(e)}function bu(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Us(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function xu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedValueMappings:e.selectedValueMappings,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Iu(e.backfill)}}function Cu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Hr(e.objects,xu)}}function Ou(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults}}function Eu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Hr(e.objects,Ou)}}function Nu(e){return Su(e)}function Su(e,t){return e==null?e:{apiKeyAsBasic:R(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:R(e,"apiKeyAsBasicOpts")?ou(e.apiKeyAsBasicOpts):void 0,docsURL:R(e,"docsURL")?e.docsURL:void 0}}function Tu(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function pr(e){return Ru(e)}function Ru(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:R(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function Au(e){return Pu(e)}function Pu(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Du(e){return Mu(e)}function Mu(e,t){return e==null?e:{provider:e.provider,read:R(e,"read")?e.read:void 0,write:R(e,"write")?e.write:void 0,proxy:R(e,"proxy")?_u(e.proxy):void 0}}function Fu(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:Us(e.proxy)}}function ku(e){return ju(e)}function ju(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Du(e.content)}}function Lu(e){return Vu(e)}function Vu(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function Bs(e){return Ku(e)}function Ku(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function $u(e){return Hu(e)}function Hu(e,t){return e==null?e:{token:e.token}}function Uu(e){return Bu(e)}function Bu(e,t){return e==null?e:{token:e.token}}function Wu(e){return qu(e)}function qu(e,t){return e==null?e:{accessToken:R(e,"accessToken")?$u(e.accessToken):void 0,refreshToken:R(e,"refreshToken")?Uu(e.refreshToken):void 0,scopes:R(e,"scopes")?e.scopes:void 0}}function _r(e){return Ju(e)}function Ju(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:R(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:R(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0}}function br(e){return zu(e)}function zu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:R(e,"providerApp")?_r(e.providerApp):void 0,group:Bs(e.group),consumer:Lu(e.consumer),providerWorkspaceRef:R(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:R(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:R(e,"oauth2AuthorizationCode")?Wu(e.oauth2AuthorizationCode):void 0}}function Xu(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Fu(e.content)}}function Gu(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:Xu(e.config)}}function Yu(e){return Zu(e)}function Zu(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Qu(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function ed(e){return td(e)}function td(e,t){return e==null?e:{mode:R(e,"mode")?e.mode:void 0,pageSize:R(e,"pageSize")?e.pageSize:void 0}}function nd(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function rd(e){let t=!0;return t=t&&"fieldName"in e,t}function od(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function id(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function sd(e){let t=!0;return t=t&&"mapToName"in e,t}function Ws(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:R(e,"default")?e.default:void 0,prompt:R(e,"prompt")?e.prompt:void 0}}function ad(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function $i(e){return cd(e)}function cd(e,t){return e==null?e:{...od(e),...Ws(e)}}function Hi(e){if(e!==void 0)return e===null?null:rd(e)?id(e):sd(e)?ad(e):{}}function qs(e){return ld(e)}function ld(e,t){return e}function ud(e){return dd(e)}function dd(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:R(e,"requiredFields")?e.requiredFields.map($i):void 0,optionalFields:R(e,"optionalFields")?e.optionalFields.map($i):void 0,optionalFieldsAuto:R(e,"optionalFieldsAuto")?qs(e.optionalFieldsAuto):void 0,backfill:R(e,"backfill")?Hs(e.backfill):void 0,delivery:R(e,"delivery")?ed(e.delivery):void 0}}function pd(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(Hi),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Hi),optionalFieldsAuto:e.optionalFieldsAuto,backfill:yu(e.backfill),delivery:nd(e.delivery)}}function fd(e){return md(e)}function md(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(ud):void 0}}function hd(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(pd)}}function Js(e){return gd(e)}function gd(e,t){return e==null?e:{allowAnyFields:R(e,"allowAnyFields")?e.allowAnyFields:void 0}}function vd(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function yd(e){return wd(e)}function wd(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:R(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:R(e,"valueDefaults")?Js(e.valueDefaults):void 0}}function Id(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:vd(e.valueDefaults)}}function _d(e){return bd(e)}function bd(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(yd):void 0}}function xd(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Id)}}function Cd(e){return Od(e)}function Od(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,provider:e.provider,read:R(e,"read")?fd(e.read):void 0,write:R(e,"write")?_d(e.write):void 0,proxy:R(e,"proxy")?Yu(e.proxy):void 0}}function Ed(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:hd(e.read),write:xd(e.write),proxy:Qu(e.proxy)}}function Nd(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Ed(e.content)}}function Sd(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:Nd(e.latestRevision)}}function Td(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function Rd(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 Ad(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Pd(e){return Dd(e)}function Dd(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function Md(e){return Fd(e)}function Fd(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,valueType:R(e,"valueType")?e.valueType:void 0,providerType:R(e,"providerType")?e.providerType:void 0,readOnly:R(e,"readOnly")?e.readOnly:void 0,values:R(e,"values")?e.values.map(Pd):void 0}}function kd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function jd(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Ld(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 Vd(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function Kd(e){if(e!==void 0)return e===null?null:{token:e.token,expiresAt:e.expiresAt===void 0?void 0:e.expiresAt.toISOString(),issuedAt:e.issuedAt===void 0?void 0:e.issuedAt.toISOString()}}function $d(e){if(e!==void 0)return e===null?null:{accessToken:Vd(e.accessToken),refreshToken:Kd(e.refreshToken),scopes:e.scopes}}function Hd(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:kd(e.basicAuth),oauth2ClientCredentials:jd(e.oauth2ClientCredentials),oauth2Password:Ld(e.oauth2Password),oauth2AuthorizationCode:$d(e.oauth2AuthorizationCode)}}function Ud(e){return Bd(e)}function Bd(e,t){return e==null?e:{enabled:R(e,"enabled")?e.enabled:void 0}}function Wd(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function io(e){return qd(e)}function qd(e,t){return e==null?e:{...Wd(e),...Ws(e)}}function Jd(e){return zd(e)}function zd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:R(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:R(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:R(e,"requiredFields")?e.requiredFields.map(io):void 0,optionalFields:R(e,"optionalFields")?e.optionalFields.map(io):void 0,optionalFieldsAuto:R(e,"optionalFieldsAuto")?qs(e.optionalFieldsAuto):void 0,allFields:R(e,"allFields")?e.allFields.map(io):void 0,allFieldsMetadata:R(e,"allFieldsMetadata")?Hr(e.allFieldsMetadata,Md):void 0,backfill:R(e,"backfill")?Hs(e.backfill):void 0}}function Xd(e){return Gd(e)}function Gd(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Jd):void 0}}function Yd(e){return Zd(e)}function Zd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:R(e,"valueDefaults")?Js(e.valueDefaults):void 0}}function Qd(e){return ep(e)}function ep(e,t){return e==null?e:{objects:R(e,"objects")?e.objects.map(Yd):void 0}}function tp(e){return np(e)}function np(e,t){return e==null?e:{name:e.name,displayName:R(e,"displayName")?e.displayName:void 0,provider:e.provider,read:R(e,"read")?Xd(e.read):void 0,write:R(e,"write")?Qd(e.write):void 0,proxy:R(e,"proxy")?Ud(e.proxy):void 0}}function rp(e){return op(e)}function op(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:tp(e.content)}}function fr(e){return ip(e)}function ip(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:R(e,"group")?Bs(e.group):void 0,healthStatus:e.healthStatus,connection:br(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,config:ku(e.config)}}function sp(e){return ap(e)}function ap(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Cd(e.content)}}function Ui(e){return cp(e)}function cp(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:R(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:sp(e.latestRevision)}}function lp(e){return up(e)}function up(e,t){return e==null?e:{iconURL:R(e,"iconURL")?e.iconURL:void 0,logoURL:R(e,"logoURL")?e.logoURL:void 0}}function dp(e){return pp(e)}function pp(e,t){return e==null?e:{iconURL:R(e,"iconURL")?e.iconURL:void 0,logoURL:R(e,"logoURL")?e.logoURL:void 0}}function fp(e){return mp(e)}function mp(e,t){return e==null?e:{regular:R(e,"regular")?dp(e.regular):void 0,darkMode:R(e,"darkMode")?lp(e.darkMode):void 0}}function hp(e){return gp(e)}function gp(e,t){return e==null?e:{workspaceRefField:R(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:R(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:R(e,"scopesField")?e.scopesField:void 0}}function vp(e){return yp(e)}function yp(e,t){return e==null?e:{grantType:e.grantType,authURL:R(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:R(e,"audience")?e.audience:void 0,tokenMetadataFields:hp(e.tokenMetadataFields),docsURL:R(e,"docsURL")?e.docsURL:void 0,authURLParams:R(e,"authURLParams")?e.authURLParams:void 0}}function wp(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider,enableCSRFProtection:e.enableCSRFProtection}}function Ip(e){return _p(e)}function _p(e,t){return e==null?e:{bulkWrite:Au(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function Bi(e){return bp(e)}function bp(e,t){return e==null?e:{name:e.name,authType:pu(e.authType),baseURL:e.baseURL,oauth2Opts:R(e,"oauth2Opts")?vp(e.oauth2Opts):void 0,apiKeyOpts:R(e,"apiKeyOpts")?uu(e.apiKeyOpts):void 0,basicOpts:R(e,"basicOpts")?Nu(e.basicOpts):void 0,support:Ip(e.support),providerOpts:e.providerOpts,displayName:R(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:R(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:R(e,"media")?fp(e.media):void 0,labels:R(e,"labels")?e.labels:void 0}}function xp(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Cu(e.read),write:Eu(e.write),proxy:Us(e.proxy)}}function Cp(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:xp(e.content)}}function Op(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Cp(e.config)}}function Ep(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Op(e.installation)}}function Np(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function Sp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:Np(e.project)}}function Tp(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 Rp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Tp(e.providerApp)}}class Ap extends Nt{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new oe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:i,query:r},n);return new mn(o)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Hd(t.generateConnectionParams)},n);return new De(o,s=>br(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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new oe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={};t.includeCreds!==void 0&&(r.includeCreds=t.includeCreds),t.includeRefreshToken!==void 0&&(r.includeRefreshToken=t.includeRefreshToken),t.refresh!==void 0&&(r.refresh=t.refresh);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:i,query:r},n);return new De(o,s=>br(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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(br))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class Pp extends Nt{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new oe("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Gu(t.installation)},n);return new De(o,s=>fr(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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:i,query:r},n);return new mn(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:i,query:r},n);return new De(o,s=>fr(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(fr))}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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new oe("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new oe("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:i,query:r,body:Ep(t.installationUpdate)},n);return new De(o,s=>fr(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Dp extends Nt{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:Tu(t.batchUpsertIntegrationsRequest)},n);return new De(o,s=>s.map(Ui))}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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new oe("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Sd(t.integration)},n);return new mn(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:i,query:r},n);return new mn(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(Ui))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Mp extends Nt{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new oe("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};i["Content-Type"]="application/json";const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:wp(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new De(o):new ru(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class Fp extends Nt{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new oe("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:Td(t.project)},n);return new De(o,s=>pr(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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:r},n);return new mn(o)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>pr(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new De(i,o=>o.map(pr))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new oe("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:Sp(t.projectUpdate)},n);return new De(o,s=>pr(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class kp extends Nt{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new oe("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new De(o,s=>Bi(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},r={};this.configuration&&this.configuration.apiKey&&(r["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new De(i,o=>Hr(o,Bi))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class jp extends Nt{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new oe("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:Rd(t.providerApp)},n);return new De(o,s=>_r(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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new oe("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:i,query:r},n);return new mn(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new De(o,s=>s.map(_r))}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 oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new oe("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new oe("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:i,query:r,body:Rp(t.providerAppUpdate)},n);return new De(o,s=>_r(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Lp extends Nt{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Ad(t.revision)},n);return new mn(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new oe("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new oe("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new oe("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new oe("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:i,query:r},n);return new De(o,s=>rp(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class zs{constructor(t){this.connectionApi=new Ap(t),this.installationApi=new Pp(t),this.integrationApi=new Dp(t),this.oAuthApi=new Mp(t),this.projectApi=new Fp(t),this.providerApi=new kp(t),this.providerAppApi=new jp(t),this.revisionApi=new Lp(t)}}const Xs="2.3.1",Vp="v1",mr="https://api.withampersand.com";function Gs(){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 mr;case"mock":return"http://127.0.0.1:4010";case"":return mr;default:return e??mr}}catch{return mr}}const Kp=(e,t)=>`${e}/${t}`;function $p(){return Kp(Gs(),Vp)}const Hp=Gs(),Ys=$p(),Up=new Ho({basePath:Ys,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Xs}});let Bp=new zs(Up);const Te=()=>Bp;function Zs(){const e=ze();return g.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new Ho({basePath:Ys,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Xs,"X-Api-Key":e}});return new zs(n)},[e])}const Je=async(e,t)=>{var n;if(e instanceof Vs){const{status:r,statusText:i}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,i);const o=await e.response.json(),s=((n=o==null?void 0:o.causes)==null?void 0:n.join(`
2
+ `))||"[ERROR] Creating installation failed.";console.error("[Error Message]",s),t&&t(s)}else console.error("Unexpected error:",e.message)},Qs=g.createContext({integrations:null,isLoading:!0}),Uo=()=>{const e=g.useContext(Qs);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function Wp({projectIdOrName:e,children:t}){const n=ze(),{setError:r}=Tt(),[i,o]=g.useState(null),[s,a]=g.useState(!0);g.useEffect(()=>{Te().integrationApi.listIntegrations({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(u=>{a(!1),o(u||[])}).catch(u=>{console.error("Error retrieving integration information."),Je(u),a(!1),r(_e.INTEGRATION_LIST,e)})},[e,n,r]);const c=g.useMemo(()=>({integrations:i,isLoading:s}),[i,s]);return l.jsx(Qs.Provider,{value:c,children:t})}const ea=g.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Ae=()=>{const e=g.useContext(ea);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function qp({projectIdOrName:e,children:t}){const n=Zs(),{setError:r}=Tt(),[i,o]=g.useState(null),[s,a]=g.useState(!0);g.useEffect(()=>{async function u(){(await n()).projectApi.getProject({projectIdOrName:e}).then(p=>{a(!1),o(p)}).catch(p=>{console.error("Error loading Ampersand project."),Je(p),r(_e.PROJECT,e),a(!1)})}u()},[e,a,r,n]);const c=g.useMemo(()=>({projectId:(i==null?void 0:i.id)||"",projectIdOrName:e,project:i,appName:(i==null?void 0:i.appName)||"",isLoading:s}),[e,i,s]);return l.jsx(ea.Provider,{value:c,children:t})}function Jp(e){const{options:{apiKey:t,projectId:n,project:r},children:i}=e,o=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!o)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return l.jsx(Yl,{children:l.jsx(Xl,{value:t,children:l.jsx(qp,{projectIdOrName:o,children:l.jsx(Wp,{projectIdOrName:o,children:i})})})})}const ta=g.createContext(null);function zp(){const e=g.useContext(ta);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
3
+ component is wrapped with AmpersandProvider`);return e}function Xp(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.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"}),l.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Gp="_box_1p7c5_1",Wi={box:Gp};function en({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${Wi.box} ${t}`:Wi.box,style:n,children:e})}const Yp="_container_1wvzr_1",qi={container:Yp};function Dn({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${qi.container} ${t}`:qi.container,style:n,children:e})}const Zp="_errorBoxContainer_4sdb2_1",Qp="_errorBox_4sdb2_1",ef="_errorText_4sdb2_20",so={errorBoxContainer:Zp,errorBox:Qp,errorText:ef};function na({message:e}){return l.jsxs(Dn,{className:so.errorBoxContainer,children:[l.jsx(Xp,{}),l.jsx(en,{className:so.errorBox,children:l.jsx("p",{className:so.errorText,children:e})})]})}const tf="_loader_6ubm6_1",nf="_rotate_6ubm6_1",rf="_ball1_6ubm6_1",of="_ball2_6ubm6_1",sf={loader:tf,rotate:nf,ball1:rf,ball2:of};function af(){return l.jsx("span",{className:sf.loader})}function Un(){return l.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:l.jsx(af,{})})}function ra({children:e}){return l.jsx(Dn,{style:{maxWidth:"55rem"},children:l.jsx(en,{children:e})})}function Ur(){return l.jsx(ra,{children:l.jsx(Un,{})})}function Kt({message:e}){return l.jsx(ra,{children:l.jsx(na,{message:e})})}const oa=()=>{const[e,t]=g.useState(!1),n=g.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}};function Bo(e,t){try{return process.env[e]}catch{return t}}function Bn(e){return e.charAt(0).toUpperCase()+e.slice(1)}function tn(e,t){return(t==null?void 0:t.displayName)??Bn(e)}const cf=e=>e.split(`
4
+ `).filter(n=>n.trim()!==""),lf=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,ia=g.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function rt(){const e=g.useContext(ia);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function uf({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:u}){const d=ze(),{projectId:p}=Ae(),{integrations:f}=Uo(),{setError:m,isError:v}=Tt(),{isIntegrationDeleted:h,setIntegrationDeleted:w}=oa(),[C,y]=g.useState([]),[b,x]=g.useState(!0),_=(C==null?void 0:C[0])||null,E=g.useMemo(()=>lf(t,f||[]),[t,f]);g.useEffect(()=>{E===null&&(f!=null&&f.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,E,f]);const D=g.useCallback(q=>{y([q])},[y]),N=g.useCallback(()=>{E!=null&&E.id&&Te().installationApi.listInstallations({projectIdOrName:p,integrationId:E.id,groupRef:i},{headers:{"X-Api-Key":d??""}}).then(q=>{x(!1),y(q||[])}).catch(q=>{m(_e.INSTALLATION_LIST,E.id),x(!1),console.error("Error retrieving installation information: ",q)})},[E,p,d,m,i]),B=(E==null?void 0:E.id)||"";g.useEffect(()=>{N()},[N]);const W=g.useMemo(()=>({integrationId:(E==null?void 0:E.id)||"",provider:(E==null?void 0:E.provider)||"",integrationObj:E,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:_,setInstallation:D,resetInstallations:N,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:h,setIntegrationDeleted:w,fieldMapping:u}),[E,n,r,i,o,_,D,N,s,a,c,h,w,u]);if(b)return l.jsx(Ur,{});if(E===null)return l.jsx(Kt,{message:`Integration "${t}" not found`});if(v(_e.INSTALLATION_LIST,B)){const q=`Error retrieving installation information for integration "${(E==null?void 0:E.name)||"unknown"}"`;return l.jsx(Kt,{message:q})}return l.jsx(ia.Provider,{value:W,children:e})}const sa=g.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{},isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}}),In=()=>{const e=g.useContext(sa);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function aa({provider:e,groupRef:t,children:n}){const r=Zs(),{projectId:i,isLoading:o}=Ae(),[s,a]=g.useState(null),[c,u]=g.useState(null),[d,p]=g.useState(!0),{setError:f,isError:m}=Tt(),{provider:v}=rt(),{isIntegrationDeleted:h,setIntegrationDeleted:w}=oa(),C=e||v;if(!C)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");g.useEffect(()=>{async function b(){const x=await r();if(!i)throw new Error("Project ID not found. Component must be used within AmpersandProvider");x.connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:C}).then(_=>{p(!1),a(_)}).catch(_=>{console.error(`Error retrieving existing connections for group ID ${t}.`),Je(_),p(!1),f(_e.CONNECTION_LIST,i)})}i&&b()},[i,t,C,f,r,h]),g.useEffect(()=>{c&&(c.provider!==C?(console.warn("Provider has changed, resetting selected connection"),u(null)):s!=null&&s.length&&(s.some(x=>x.id===c.id)||(console.warn("Selected connection not found in connections list, resetting selected connection"),u(null))))},[s,c,C]),g.useEffect(()=>{if(!c&&s&&s.length>0){const[b]=s;u(b)}},[s,c]);const y=g.useMemo(()=>({connections:s,selectedConnection:c,setConnections:a,setSelectedConnection:u,isIntegrationDeleted:h,setIntegrationDeleted:w}),[s,c,a,u,h,w]);if(d||o)return l.jsx(Ur,{});if(m(_e.PROJECT,i))return l.jsx(Kt,{message:`Error loading project ${i}`});if(m(_e.CONNECTION_LIST,i))return l.jsx(Kt,{message:"Error retrieving existing connections"});if(!i)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return l.jsx(sa.Provider,{value:y,children:n})}function ca(){const[e,t]=g.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const df="_resetContainer_lkwv9_4",la={resetContainer:df};var hr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Wo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Er={exports:{}};Er.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",u="[object AsyncFunction]",d="[object Boolean]",p="[object Date]",f="[object Error]",m="[object Function]",v="[object GeneratorFunction]",h="[object Map]",w="[object Number]",C="[object Null]",y="[object Object]",b="[object Promise]",x="[object Proxy]",_="[object RegExp]",E="[object Set]",D="[object String]",N="[object Symbol]",B="[object Undefined]",W="[object WeakMap]",q="[object ArrayBuffer]",X="[object DataView]",ee="[object Float32Array]",$="[object Float64Array]",ie="[object Int8Array]",te="[object Int16Array]",G="[object Int32Array]",le="[object Uint8Array]",pe="[object Uint8ClampedArray]",S="[object Uint16Array]",M="[object Uint32Array]",L=/[\\^$.*+?()[\]{}|]/g,k=/^\[object .+?Constructor\]$/,F=/^(?:0|[1-9]\d*)$/,A={};A[ee]=A[$]=A[ie]=A[te]=A[G]=A[le]=A[pe]=A[S]=A[M]=!0,A[a]=A[c]=A[q]=A[d]=A[X]=A[p]=A[f]=A[m]=A[h]=A[w]=A[y]=A[_]=A[E]=A[D]=A[W]=!1;var Y=typeof hr=="object"&&hr&&hr.Object===Object&&hr,Z=typeof self=="object"&&self&&self.Object===Object&&self,V=Y||Z||Function("return this")(),Q=t&&!t.nodeType&&t,J=Q&&!0&&e&&!e.nodeType&&e,ae=J&&J.exports===Q,P=ae&&Y.process,fe=function(){try{return P&&P.binding&&P.binding("util")}catch{}}(),K=fe&&fe.isTypedArray;function we(I,O){for(var T=-1,z=I==null?0:I.length,xe=0,ce=[];++T<z;){var Se=I[T];O(Se,T,I)&&(ce[xe++]=Se)}return ce}function Pe(I,O){for(var T=-1,z=O.length,xe=I.length;++T<z;)I[xe+T]=O[T];return I}function He(I,O){for(var T=-1,z=I==null?0:I.length;++T<z;)if(O(I[T],T,I))return!0;return!1}function Me(I,O){for(var T=-1,z=Array(I);++T<I;)z[T]=O(T);return z}function me(I){return function(O){return I(O)}}function vt(I,O){return I.has(O)}function Ue(I,O){return I==null?void 0:I[O]}function ot(I){var O=-1,T=Array(I.size);return I.forEach(function(z,xe){T[++O]=[xe,z]}),T}function yt(I,O){return function(T){return I(O(T))}}function wt(I){var O=-1,T=Array(I.size);return I.forEach(function(z){T[++O]=z}),T}var Be=Array.prototype,Ve=Function.prototype,Fe=Object.prototype,Oe=V["__core-js_shared__"],It=Ve.toString,Xe=Fe.hasOwnProperty,At=function(){var I=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||"");return I?"Symbol(src)_1."+I:""}(),Ht=Fe.toString,it=RegExp("^"+It.call(Xe).replace(L,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ee=ae?V.Buffer:void 0,Pt=V.Symbol,Ut=V.Uint8Array,Dt=Fe.propertyIsEnumerable,rn=Be.splice,Qe=Pt?Pt.toStringTag:void 0,Mt=Object.getOwnPropertySymbols,Bt=Ee?Ee.isBuffer:void 0,on=yt(Object.keys,Object),Wt=_n(V,"DataView"),Ce=_n(V,"Map"),Ge=_n(V,"Promise"),ne=_n(V,"Set"),de=_n(V,"WeakMap"),ke=_n(Object,"create"),Ft=cn(Wt),U=cn(Ce),re=cn(Ge),se=cn(ne),Re=cn(de),je=Pt?Pt.prototype:void 0,et=je?je.valueOf:void 0;function Ke(I){var O=-1,T=I==null?0:I.length;for(this.clear();++O<T;){var z=I[O];this.set(z[0],z[1])}}function We(){this.__data__=ke?ke(null):{},this.size=0}function tt(I){var O=this.has(I)&&delete this.__data__[I];return this.size-=O?1:0,O}function be(I){var O=this.__data__;if(ke){var T=O[I];return T===r?void 0:T}return Xe.call(O,I)?O[I]:void 0}function sn(I){var O=this.__data__;return ke?O[I]!==void 0:Xe.call(O,I)}function no(I,O){var T=this.__data__;return this.size+=this.has(I)?0:1,T[I]=ke&&O===void 0?r:O,this}Ke.prototype.clear=We,Ke.prototype.delete=tt,Ke.prototype.get=be,Ke.prototype.has=sn,Ke.prototype.set=no;function pt(I){var O=-1,T=I==null?0:I.length;for(this.clear();++O<T;){var z=I[O];this.set(z[0],z[1])}}function rr(){this.__data__=[],this.size=0}function or(I){var O=this.__data__,T=ar(O,I);if(T<0)return!1;var z=O.length-1;return T==z?O.pop():rn.call(O,T,1),--this.size,!0}function ir(I){var O=this.__data__,T=ar(O,I);return T<0?void 0:O[T][1]}function Ie(I){return ar(this.__data__,I)>-1}function _t(I,O){var T=this.__data__,z=ar(T,I);return z<0?(++this.size,T.push([I,O])):T[z][1]=O,this}pt.prototype.clear=rr,pt.prototype.delete=or,pt.prototype.get=ir,pt.prototype.has=Ie,pt.prototype.set=_t;function bt(I){var O=-1,T=I==null?0:I.length;for(this.clear();++O<T;){var z=I[O];this.set(z[0],z[1])}}function an(){this.size=0,this.__data__={hash:new Ke,map:new(Ce||pt),string:new Ke}}function ro(I){var O=cr(this,I).delete(I);return this.size-=O?1:0,O}function kn(I){return cr(this,I).get(I)}function yl(I){return cr(this,I).has(I)}function wl(I,O){var T=cr(this,I),z=T.size;return T.set(I,O),this.size+=T.size==z?0:1,this}bt.prototype.clear=an,bt.prototype.delete=ro,bt.prototype.get=kn,bt.prototype.has=yl,bt.prototype.set=wl;function sr(I){var O=-1,T=I==null?0:I.length;for(this.__data__=new bt;++O<T;)this.add(I[O])}function Il(I){return this.__data__.set(I,r),this}function _l(I){return this.__data__.has(I)}sr.prototype.add=sr.prototype.push=Il,sr.prototype.has=_l;function qt(I){var O=this.__data__=new pt(I);this.size=O.size}function bl(){this.__data__=new pt,this.size=0}function xl(I){var O=this.__data__,T=O.delete(I);return this.size=O.size,T}function Cl(I){return this.__data__.get(I)}function Ol(I){return this.__data__.has(I)}function El(I,O){var T=this.__data__;if(T instanceof pt){var z=T.__data__;if(!Ce||z.length<n-1)return z.push([I,O]),this.size=++T.size,this;T=this.__data__=new bt(z)}return T.set(I,O),this.size=T.size,this}qt.prototype.clear=bl,qt.prototype.delete=xl,qt.prototype.get=Cl,qt.prototype.has=Ol,qt.prototype.set=El;function Nl(I,O){var T=lr(I),z=!T&&Hl(I),xe=!T&&!z&&oo(I),ce=!T&&!z&&!xe&&Vi(I),Se=T||z||xe||ce,$e=Se?Me(I.length,String):[],qe=$e.length;for(var Ne in I)Xe.call(I,Ne)&&!(Se&&(Ne=="length"||xe&&(Ne=="offset"||Ne=="parent")||ce&&(Ne=="buffer"||Ne=="byteLength"||Ne=="byteOffset")||jl(Ne,qe)))&&$e.push(Ne);return $e}function ar(I,O){for(var T=I.length;T--;)if(Fi(I[T][0],O))return T;return-1}function Sl(I,O,T){var z=O(I);return lr(I)?z:Pe(z,T(I))}function jn(I){return I==null?I===void 0?B:C:Qe&&Qe in Object(I)?Fl(I):$l(I)}function Ai(I){return Ln(I)&&jn(I)==a}function Pi(I,O,T,z,xe){return I===O?!0:I==null||O==null||!Ln(I)&&!Ln(O)?I!==I&&O!==O:Tl(I,O,T,z,Pi,xe)}function Tl(I,O,T,z,xe,ce){var Se=lr(I),$e=lr(O),qe=Se?c:Jt(I),Ne=$e?c:Jt(O);qe=qe==a?y:qe,Ne=Ne==a?y:Ne;var st=qe==y,xt=Ne==y,Ye=qe==Ne;if(Ye&&oo(I)){if(!oo(O))return!1;Se=!0,st=!1}if(Ye&&!st)return ce||(ce=new qt),Se||Vi(I)?Di(I,O,T,z,xe,ce):Dl(I,O,qe,T,z,xe,ce);if(!(T&i)){var ft=st&&Xe.call(I,"__wrapped__"),mt=xt&&Xe.call(O,"__wrapped__");if(ft||mt){var zt=ft?I.value():I,kt=mt?O.value():O;return ce||(ce=new qt),xe(zt,kt,T,z,ce)}}return Ye?(ce||(ce=new qt),Ml(I,O,T,z,xe,ce)):!1}function Rl(I){if(!Li(I)||Vl(I))return!1;var O=ki(I)?it:k;return O.test(cn(I))}function Al(I){return Ln(I)&&ji(I.length)&&!!A[jn(I)]}function Pl(I){if(!Kl(I))return on(I);var O=[];for(var T in Object(I))Xe.call(I,T)&&T!="constructor"&&O.push(T);return O}function Di(I,O,T,z,xe,ce){var Se=T&i,$e=I.length,qe=O.length;if($e!=qe&&!(Se&&qe>$e))return!1;var Ne=ce.get(I);if(Ne&&ce.get(O))return Ne==O;var st=-1,xt=!0,Ye=T&o?new sr:void 0;for(ce.set(I,O),ce.set(O,I);++st<$e;){var ft=I[st],mt=O[st];if(z)var zt=Se?z(mt,ft,st,O,I,ce):z(ft,mt,st,I,O,ce);if(zt!==void 0){if(zt)continue;xt=!1;break}if(Ye){if(!He(O,function(kt,ln){if(!vt(Ye,ln)&&(ft===kt||xe(ft,kt,T,z,ce)))return Ye.push(ln)})){xt=!1;break}}else if(!(ft===mt||xe(ft,mt,T,z,ce))){xt=!1;break}}return ce.delete(I),ce.delete(O),xt}function Dl(I,O,T,z,xe,ce,Se){switch(T){case X:if(I.byteLength!=O.byteLength||I.byteOffset!=O.byteOffset)return!1;I=I.buffer,O=O.buffer;case q:return!(I.byteLength!=O.byteLength||!ce(new Ut(I),new Ut(O)));case d:case p:case w:return Fi(+I,+O);case f:return I.name==O.name&&I.message==O.message;case _:case D:return I==O+"";case h:var $e=ot;case E:var qe=z&i;if($e||($e=wt),I.size!=O.size&&!qe)return!1;var Ne=Se.get(I);if(Ne)return Ne==O;z|=o,Se.set(I,O);var st=Di($e(I),$e(O),z,xe,ce,Se);return Se.delete(I),st;case N:if(et)return et.call(I)==et.call(O)}return!1}function Ml(I,O,T,z,xe,ce){var Se=T&i,$e=Mi(I),qe=$e.length,Ne=Mi(O),st=Ne.length;if(qe!=st&&!Se)return!1;for(var xt=qe;xt--;){var Ye=$e[xt];if(!(Se?Ye in O:Xe.call(O,Ye)))return!1}var ft=ce.get(I);if(ft&&ce.get(O))return ft==O;var mt=!0;ce.set(I,O),ce.set(O,I);for(var zt=Se;++xt<qe;){Ye=$e[xt];var kt=I[Ye],ln=O[Ye];if(z)var Ki=Se?z(ln,kt,Ye,O,I,ce):z(kt,ln,Ye,I,O,ce);if(!(Ki===void 0?kt===ln||xe(kt,ln,T,z,ce):Ki)){mt=!1;break}zt||(zt=Ye=="constructor")}if(mt&&!zt){var ur=I.constructor,dr=O.constructor;ur!=dr&&"constructor"in I&&"constructor"in O&&!(typeof ur=="function"&&ur instanceof ur&&typeof dr=="function"&&dr instanceof dr)&&(mt=!1)}return ce.delete(I),ce.delete(O),mt}function Mi(I){return Sl(I,Wl,kl)}function cr(I,O){var T=I.__data__;return Ll(O)?T[typeof O=="string"?"string":"hash"]:T.map}function _n(I,O){var T=Ue(I,O);return Rl(T)?T:void 0}function Fl(I){var O=Xe.call(I,Qe),T=I[Qe];try{I[Qe]=void 0;var z=!0}catch{}var xe=Ht.call(I);return z&&(O?I[Qe]=T:delete I[Qe]),xe}var kl=Mt?function(I){return I==null?[]:(I=Object(I),we(Mt(I),function(O){return Dt.call(I,O)}))}:ql,Jt=jn;(Wt&&Jt(new Wt(new ArrayBuffer(1)))!=X||Ce&&Jt(new Ce)!=h||Ge&&Jt(Ge.resolve())!=b||ne&&Jt(new ne)!=E||de&&Jt(new de)!=W)&&(Jt=function(I){var O=jn(I),T=O==y?I.constructor:void 0,z=T?cn(T):"";if(z)switch(z){case Ft:return X;case U:return h;case re:return b;case se:return E;case Re:return W}return O});function jl(I,O){return O=O??s,!!O&&(typeof I=="number"||F.test(I))&&I>-1&&I%1==0&&I<O}function Ll(I){var O=typeof I;return O=="string"||O=="number"||O=="symbol"||O=="boolean"?I!=="__proto__":I===null}function Vl(I){return!!At&&At in I}function Kl(I){var O=I&&I.constructor,T=typeof O=="function"&&O.prototype||Fe;return I===T}function $l(I){return Ht.call(I)}function cn(I){if(I!=null){try{return It.call(I)}catch{}try{return I+""}catch{}}return""}function Fi(I,O){return I===O||I!==I&&O!==O}var Hl=Ai(function(){return arguments}())?Ai:function(I){return Ln(I)&&Xe.call(I,"callee")&&!Dt.call(I,"callee")},lr=Array.isArray;function Ul(I){return I!=null&&ji(I.length)&&!ki(I)}var oo=Bt||Jl;function Bl(I,O){return Pi(I,O)}function ki(I){if(!Li(I))return!1;var O=jn(I);return O==m||O==v||O==u||O==x}function ji(I){return typeof I=="number"&&I>-1&&I%1==0&&I<=s}function Li(I){var O=typeof I;return I!=null&&(O=="object"||O=="function")}function Ln(I){return I!=null&&typeof I=="object"}var Vi=K?me(K):Al;function Wl(I){return Ul(I)?Nl(I):Pl(I)}function ql(){return[]}function Jl(){return!1}e.exports=Bl})(Er,Er.exports);var pf=Er.exports;const ua=Wo(pf),hn="other",Nr="uninstall-installation";function Yt(e){return!e.fieldName}function qo(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function ff(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Yt(n)&&!!n.fieldName))||null}function mf(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Yt(r)&&!!r.mapToName))||[]}function hf(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>Yt(r)&&!!r.mapToName))||[]}function gf(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Yt(n)&&!!n.fieldName))||null}const da=(e,t)=>{var n,r,i;return(i=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:i[t]};function vf(e){return Yt(e)?e.mapToName:e.fieldName}const pa=(e,t)=>{var r,i,o;const n=[];return(o=(i=(r=t.content)==null?void 0:r.read)==null?void 0:i.objects)==null||o.forEach(s=>{n.push({name:s==null?void 0:s.objectName,displayName:(s==null?void 0:s.mapToDisplayName)||(s==null?void 0:s.displayName)||(s==null?void 0:s.objectName)&&Bn(s==null?void 0:s.objectName),completed:e?!!da(e,s.objectName):!1})}),n},fa=e=>{var n;return{name:hn,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function yf(e,t){var o;const n=pa(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?fa(e):void 0;return i&&n.push(i),n}function ma(e,t,n){const r=(e==null?void 0:e.filter(o=>!(t!=null&&t[o==null?void 0:o.mapToName])))||[],i=r.map(o=>o.mapToName);return n(_e.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function ha(e,t){return ua(e,t)}function ga(e,t){return ua(e,t)}const wf=(e,t,n)=>{var w,C,y,b,x,_,E,D,N;if(!e)return null;const r=qo(e,t),i=r&&ff(r),o=r&&gf(r),s=r&&mf(r),a=r&&hf(r),c=(r==null?void 0:r.allFields)||[],u=(r==null?void 0:r.allFieldsMetadata)||{},d=n==null?void 0:n.content,p=((y=(C=(w=d==null?void 0:d.read)==null?void 0:w.objects)==null?void 0:C[t])==null?void 0:y.selectedFields)||{},f=((_=(x=(b=d==null?void 0:d.read)==null?void 0:b.objects)==null?void 0:x[t])==null?void 0:_.selectedValueMappings)||{},m=((N=(D=(E=d==null?void 0:d.read)==null?void 0:E.objects)==null?void 0:D[t])==null?void 0:N.selectedFieldMappings)||{},v={...p},h={...m};return{allFields:c,allFieldsMetadata:u,requiredFields:i,optionalFields:o,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:p,selectedFieldMappings:m,selectedValueMappings:f,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:v,requiredMapFields:h,selectedValueMappings:f}}},If=(e,t)=>{var r,i;if(!e)return null;const n=(i=(r=t==null?void 0:t.content)==null?void 0:r.write)==null?void 0:i.objects;return{writeObjects:(e==null?void 0:e.objects)||[],selectedWriteObjects:n||{},isWriteModified:!1,savedConfig:{selectedWriteObjects:n||{}}}};function va(e,t,n){var o,s;const r=(o=e==null?void 0:e.content)==null?void 0:o.read,i=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:wf(r,t,n),write:If(i,n)}}const ya=(e,t,n,r)=>{const i=va(e,n,t);r(n,i)},_f=(e,t,n)=>{const r=yf(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=va(e,o,t))}),n(i)},wa=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(vf(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},Ia=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n},_a=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function ba(e,t){return t[e]||void 0}async function Jo({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:i,apiKey:o,setError:s,setInstallation:a,onInstallSuccess:c}){const u={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:i,config:e}};try{const d=await Te().installationApi.createInstallation(u,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}});a(d),c==null||c(d.id,d.config)}catch(d){Je(d,s)}}function Br(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const bf=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(i=>i.objectName===t)},xf=(e,t,n,r)=>{const i=wa(e),o=Ia(e),s=_a(e),a=bf(n,t);if(!a)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:a.schedule,destination:a.destination,selectedFields:i,selectedFieldMappings:o,selectedValueMappings:s||{},backfill:a.backfill}}}}};return Br(n)&&(c.content.proxy={enabled:!0}),c},Cf=(e,t,n,r,i,o,s,a,c,u,d,p)=>{const f=xf(c,o,a,r);return f?Jo({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:u,setInstallation:d,onInstallSuccess:p}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},xa=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},Of=e=>{const t=e.content.write;return t==null?void 0:t.objects},Ef=(e,t,n)=>{if(!Of(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=xa(e),o={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return Br(t)&&(o.content.proxy={enabled:!0}),o},Nf=(e,t,n,r,i,o,s,a,c,u,d)=>{const p=Ef(a,s,r);return p?Jo({createConfig:p,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:c,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Sf={backgroundColor:"var(--amp-colors-status-critical-muted)",borderColor:"var(--amp-colors-status-critical-muted)",color:"var(--amp-colors-status-critical-dark)",padding:".5rem 1rem"};function Ca({children:e,style:t}){return l.jsx(en,{style:{...Sf,...t},children:e})}var Oa={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 o="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(o=i(o,r(a)))}return o}function r(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var s="";for(var a in o)t.call(o,a)&&o[a]&&(s=i(s,a));return s}function i(o,s){return s?o?o+" "+s:o+s:o}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(ya);var xf=ya.exports;const at=Bo(xf),Cf="_button_1kk7v_1",Of="_buttonError_1kk7v_20",Ef="_danger_1kk7v_34",Nf="_ghost_1kk7v_39",so={button:Cf,buttonError:Of,danger:Ef,ghost:Nf};function lt({className:e,style:t,type:n,children:r,variant:i,...o}){const s=at(so.button,{[so.danger]:i==="danger",[so.ghost]:i==="ghost",[e||""]:!!e});return l.jsx("button",{type:n,className:s,style:t,...o,children:r})}const Ia=h.createContext({hydratedRevision:null,loading:!1}),Dn=()=>{const e=h.useContext(Ia);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function Sf({projectId:e,children:t}){var C;const{selectedConnection:n}=In(),{integrationId:r,integrationObj:i}=nt(),[o,s]=h.useState(null),[a,c]=h.useState(!0),{isError:u,removeError:d,setError:f}=St(),m=ze(),p=n==null?void 0:n.id,g=(C=i==null?void 0:i.latestRevision)==null?void 0:C.id,I=(i==null?void 0:i.name)||r;h.useEffect(()=>{e&&r&&g&&p&&m&&Te().revisionApi.getHydratedRevision({projectIdOrName:e,integrationId:r,revisionId:g,connectionId:p},{headers:{"X-Api-Key":m??""}}).then(y=>{s(y),c(!1),d(_e.HYDRATED_REVISION,I)}).catch(y=>{console.error(`Error loading integration ${I}.`),Je(y),c(!1),f(_e.HYDRATED_REVISION,I)})},[e,r,g,p,m,d,f,I]);const _=h.useMemo(()=>({hydratedRevision:o,loading:a}),[o,a]);if(u(_e.HYDRATED_REVISION,I)){const b=`Error retrieving integration details for '${(i==null?void 0:i.name)||r||"unknown integration"}. This is sometimes caused by insufficient permissions with your credentials'`;return l.jsx($t,{message:b})}return l.jsx(Ia.Provider,{value:_,children:t})}const Tf="_formControl_9qd8d_1",Rf="_formLabel_9qd8d_5",Af="_formLabelRequired_9qd8d_11",Pf="_formInput_9qd8d_16",Df="_formInputInvalid_9qd8d_20",Ff="_formError_9qd8d_24",Mf="_disabled_9qd8d_30",ln={formControl:Tf,formLabel:Rf,formLabelRequired:Af,formInput:Pf,formInputInvalid:Df,formError:Ff,disabled:Mf};function Wo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:i=!1,errorMessage:o,children:s}){return l.jsxs("div",{className:at(ln.formControl,{[ln.disabled]:r}),children:[t&&l.jsx("label",{htmlFor:e,className:at(ln.formLabel,{[ln.formLabelRequired]:n}),children:t}),l.jsx("div",{id:e,className:at(ln.formInput,{[ln.formInputInvalid]:i}),children:s}),i&&o&&l.jsx("div",{className:ln.formError,role:"alert",children:o})]})}const wa=h.createContext(null);function _a(){const e=h.useContext(wa);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const ba=h.createContext(()=>{});function kf(){const e=h.useContext(ba);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var xa=Symbol.for("immer-nothing"),qi=Symbol.for("immer-draftable"),ut=Symbol.for("immer-state"),jf=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 tt(e,...t){if(process.env.NODE_ENV!=="production"){const n=jf[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Cn=Object.getPrototypeOf;function On(e){return!!e&&!!e[ut]}function hn(e){var t;return e?Ca(e)||Array.isArray(e)||!!e[qi]||!!((t=e.constructor)!=null&&t[qi])||Wr(e)||Jr(e):!1}var Lf=Object.prototype.constructor.toString();function Ca(e){if(!e||typeof e!="object")return!1;const t=Cn(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)===Lf}function Nr(e,t){qr(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function qr(e){const t=e[ut];return t?t.type_:Array.isArray(e)?1:Wr(e)?2:Jr(e)?3:0}function bo(e,t){return qr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Oa(e,t,n){const r=qr(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Kf(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Wr(e){return e instanceof Map}function Jr(e){return e instanceof Set}function un(e){return e.copy_||e.base_}function xo(e,t){if(Wr(e))return new Map(e);if(Jr(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Ca(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[ut];let i=Reflect.ownKeys(r);for(let o=0;o<i.length;o++){const s=i[o],a=r[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Cn(e),r)}else{const r=Cn(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function Jo(e,t=!1){return zr(e)||On(e)||!hn(e)||(qr(e)>1&&(e.set=e.add=e.clear=e.delete=$f),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Jo(r,!0))),e}function $f(){tt(2)}function zr(e){return Object.isFrozen(e)}var Vf={};function gn(e){const t=Vf[e];return t||tt(0,e),t}var qn;function Ea(){return qn}function Hf(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Wi(e,t){t&&(gn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Co(e){Oo(e),e.drafts_.forEach(Uf),e.drafts_=null}function Oo(e){e===qn&&(qn=e.parent_)}function Ji(e){return qn=Hf(qn,e)}function Uf(e){const t=e[ut];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function zi(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[ut].modified_&&(Co(t),tt(4)),hn(e)&&(e=Sr(t,e),t.parent_||Tr(t,e)),t.patches_&&gn("Patches").generateReplacementPatches_(n[ut].base_,e,t.patches_,t.inversePatches_)):e=Sr(t,n,[]),Co(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==xa?e:void 0}function Sr(e,t,n){if(zr(t))return t;const r=t[ut];if(!r)return Nr(t,(i,o)=>Xi(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Tr(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let o=i,s=!1;r.type_===3&&(o=new Set(i),i.clear(),s=!0),Nr(o,(a,c)=>Xi(e,r,i,a,c,n,s)),Tr(e,i,!1),n&&e.patches_&&gn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Xi(e,t,n,r,i,o,s){if(process.env.NODE_ENV!=="production"&&i===n&&tt(5),On(i)){const a=o&&t&&t.type_!==3&&!bo(t.assigned_,r)?o.concat(r):void 0,c=Sr(e,i,a);if(Oa(n,r,c),On(c))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(hn(i)&&!zr(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Sr(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Tr(e,i)}}function Tr(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Jo(t,n)}function Bf(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Ea(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=zo;n&&(i=[r],o=Wn);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var zo={get(e,t){if(t===ut)return e;const n=un(e);if(!bo(n,t))return qf(e,n,t);const r=n[t];return e.finalized_||!hn(r)?r:r===ao(e.base_,t)?(co(e),e.copy_[t]=No(r,e)):r},has(e,t){return t in un(e)},ownKeys(e){return Reflect.ownKeys(un(e))},set(e,t,n){const r=Na(un(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=ao(un(e),t),o=i==null?void 0:i[ut];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Kf(n,i)&&(n!==void 0||bo(e.base_,t)))return!0;co(e),Eo(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 ao(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,co(e),Eo(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=un(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){tt(11)},getPrototypeOf(e){return Cn(e.base_)},setPrototypeOf(){tt(12)}},Wn={};Nr(zo,(e,t)=>{Wn[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Wn.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&tt(13),Wn.set.call(this,e,t,void 0)};Wn.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&tt(14),zo.set.call(this,e[0],t,n,e[0])};function ao(e,t){const n=e[ut];return(n?un(n):e)[t]}function qf(e,t,n){var i;const r=Na(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Na(e,t){if(!(t in e))return;let n=Cn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Cn(n)}}function Eo(e){e.modified_||(e.modified_=!0,e.parent_&&Eo(e.parent_))}function co(e){e.copy_||(e.copy_=xo(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Wf=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const o=n;n=t;const s=this;return function(c=o,...u){return s.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&tt(6),r!==void 0&&typeof r!="function"&&tt(7);let i;if(hn(t)){const o=Ji(this),s=No(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?Co(o):Oo(o)}return Wi(o,r),zi(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===xa&&(i=void 0),this.autoFreeze_&&Jo(i,!0),r){const o=[],s=[];gn("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else tt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let r,i;return[this.produce(t,n,(s,a)=>{r=s,i=a}),r,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){hn(e)||tt(8),On(e)&&(e=Jf(e));const t=Ji(this),n=No(e,void 0);return n[ut].isManual_=!0,Oo(t),n}finishDraft(e,t){const n=e&&e[ut];(!n||!n.isManual_)&&tt(9);const{scope_:r}=n;return Wi(r,t),zi(void 0,r)}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 r=gn("Patches").applyPatches_;return On(e)?r(e,t):this.produce(e,i=>r(i,t))}};function No(e,t){const n=Wr(e)?gn("MapSet").proxyMap_(e,t):Jr(e)?gn("MapSet").proxySet_(e,t):Bf(e,t);return(t?t.scope_:Ea()).drafts_.push(n),n}function Jf(e){return On(e)||tt(10,e),Sa(e)}function Sa(e){if(!hn(e)||zr(e))return e;const t=e[ut];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=xo(e,t.scope_.immer_.useStrictShallowCopy_)}else n=xo(e,!0);return Nr(n,(r,i)=>{Oa(n,r,Sa(i))}),t&&(t.finalized_=!1),n}var dt=new Wf,Kn=dt.produce;dt.produceWithPatches.bind(dt);dt.setAutoFreeze.bind(dt);dt.setUseStrictShallowCopy.bind(dt);dt.applyPatches.bind(dt);dt.createDraft.bind(dt);dt.finishDraft.bind(dt);const Ta=h.createContext(void 0),zf={};function Xo(){const e=h.useContext(Ta);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function Xf({children:e}){const{installation:t}=nt(),{hydratedRevision:n,loading:r}=Dn(),[i,o]=h.useState(zf),s=t==null?void 0:t.config;h.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(i).length>0)&&hf(n,s,o)},[n,r,s,i]);const a=h.useCallback((p,g)=>{o(I=>Kn(I,_=>{_[p]=Kn(_[p],g)}))},[o]),c=h.useCallback((p,g)=>{o(I=>Kn(I,_=>{_[p]=g}))},[o]),u=h.useCallback(()=>{o(Kn(p=>{const g=p.other.write;g&&(g.isWriteModified=!1)}))},[o]),d=h.useCallback(p=>{o(Kn(g=>{var _;const I=(_=g[p])==null?void 0:_.read;I&&(I.isOptionalFieldsModified=!1,I.isRequiredMapFieldsModified=!1,I.isValueMappingsModified=!1)}))},[o]),f=h.useCallback(p=>{p===mn?u():d(p)},[d,u]),m=h.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:f}),[i,c,f,a]);return l.jsx(Ta.Provider,{value:m,children:e})}const Tt=()=>{const{appName:e}=Ae(),{objectConfigurationsState:t,setConfigureState:n}=Xo(),{selectedObjectName:r}=_a(),i=ha(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}},Gf="_divider_1kmoj_1",Gi={divider:Gf};function Go({className:e,style:t}){return l.jsx("hr",{className:e?`${Gi.divider} ${e}`:Gi.divider,style:t})}function Fn({string:e}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(Go,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Yf(e,t,n,r,i){if(e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[i]||(e.read.selectedValueMappings[i]={}),e.read.selectedValueMappings[i][n]=r,e!=null&&e.read&&e.read.selectedValueMappings)){const o=e.read.savedConfig.selectedValueMappings,s=e.read.selectedValueMappings,a=!Ur(o,s);e.read.isValueMappingsModified=a}}function Zf(e,t,n,r,i){t(e,o=>Yf(o,e,n,r,i))}function Lt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function le(){return le=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},le.apply(null,arguments)}function So(e,t){return So=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},So(e,t)}function Qf(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,So(e,t)}var To={exports:{}},hr={exports:{}},he={};/** @license React v16.13.1
8
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(o=i(o,r(a)))}return o}function r(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var s="";for(var a in o)t.call(o,a)&&o[a]&&(s=i(s,a));return s}function i(o,s){return s?o?o+" "+s:o+s:o}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Oa);var Tf=Oa.exports;const ct=Wo(Tf),Rf="_button_1kk7v_1",Af="_buttonError_1kk7v_20",Pf="_danger_1kk7v_34",Df="_ghost_1kk7v_39",ao={button:Rf,buttonError:Af,danger:Pf,ghost:Df};function Ze({className:e,style:t,type:n,children:r,variant:i,...o}){const s=ct(ao.button,{[ao.danger]:i==="danger",[ao.ghost]:i==="ghost",[e||""]:!!e});return l.jsx("button",{type:n,className:s,style:t,...o,children:r})}const Ea=g.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),$t=()=>{const e=g.useContext(Ea);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function Mf({projectId:e,children:t}){var C;const{selectedConnection:n}=In(),{integrationId:r,integrationObj:i}=rt(),[o,s]=g.useState(null),[a,c]=g.useState(!0),{isError:u,removeError:d,setError:p}=Tt(),f=ze(),m=n==null?void 0:n.id,v=(C=i==null?void 0:i.latestRevision)==null?void 0:C.id,h=(i==null?void 0:i.name)||r;g.useEffect(()=>{e&&r&&v&&m&&f&&Te().revisionApi.getHydratedRevision({projectIdOrName:e,integrationId:r,revisionId:v,connectionId:m},{headers:{"X-Api-Key":f??""}}).then(y=>{s(y),c(!1),d(_e.HYDRATED_REVISION,h)}).catch(y=>{console.error(`Error loading integration ${h}.`),Je(y),c(!1),p(_e.HYDRATED_REVISION,h)})},[e,r,v,m,f,d,p,h]);const w=g.useMemo(()=>{var y,b,x;return{hydratedRevision:o,loading:a,readAction:(y=o==null?void 0:o.content)==null?void 0:y.read,writeObjects:((x=(b=o==null?void 0:o.content)==null?void 0:b.write)==null?void 0:x.objects)||[]}},[o,a]);if(u(_e.HYDRATED_REVISION,h)){const b=`Error retrieving integration details for '${(i==null?void 0:i.name)||r||"unknown integration"}. This is sometimes caused by insufficient permissions with your credentials'`;return l.jsx(Kt,{message:b})}return l.jsx(Ea.Provider,{value:w,children:t})}function Lt(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}function ue(){return ue=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ue.apply(null,arguments)}function xo(e,t){return xo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},xo(e,t)}function Ff(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,xo(e,t)}var Co={exports:{}},gr={exports:{}},he={};/** @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 Yi;function em(){if(Yi)return he;Yi=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,I=e?Symbol.for("react.block"):60121,_=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function b(w){if(typeof w=="object"&&w!==null){var E=w.$$typeof;switch(E){case t:switch(w=w.type,w){case c:case u:case r:case o:case i:case f:return w;default:switch(w=w&&w.$$typeof,w){case a:case d:case g:case p:case s:return w;default:return E}}case n:return E}}}function x(w){return b(w)===u}return he.AsyncMode=c,he.ConcurrentMode=u,he.ContextConsumer=a,he.ContextProvider=s,he.Element=t,he.ForwardRef=d,he.Fragment=r,he.Lazy=g,he.Memo=p,he.Portal=n,he.Profiler=o,he.StrictMode=i,he.Suspense=f,he.isAsyncMode=function(w){return x(w)||b(w)===c},he.isConcurrentMode=x,he.isContextConsumer=function(w){return b(w)===a},he.isContextProvider=function(w){return b(w)===s},he.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===t},he.isForwardRef=function(w){return b(w)===d},he.isFragment=function(w){return b(w)===r},he.isLazy=function(w){return b(w)===g},he.isMemo=function(w){return b(w)===p},he.isPortal=function(w){return b(w)===n},he.isProfiler=function(w){return b(w)===o},he.isStrictMode=function(w){return b(w)===i},he.isSuspense=function(w){return b(w)===f},he.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===r||w===u||w===o||w===i||w===f||w===m||typeof w=="object"&&w!==null&&(w.$$typeof===g||w.$$typeof===p||w.$$typeof===s||w.$$typeof===a||w.$$typeof===d||w.$$typeof===_||w.$$typeof===C||w.$$typeof===y||w.$$typeof===I)},he.typeOf=b,he}var ge={};/** @license React v16.13.1
15
+ */var Ji;function kf(){if(Ji)return he;Ji=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,w=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function b(_){if(typeof _=="object"&&_!==null){var E=_.$$typeof;switch(E){case t:switch(_=_.type,_){case c:case u:case r:case o:case i:case p:return _;default:switch(_=_&&_.$$typeof,_){case a:case d:case v:case m:case s:return _;default:return E}}case n:return E}}}function x(_){return b(_)===u}return he.AsyncMode=c,he.ConcurrentMode=u,he.ContextConsumer=a,he.ContextProvider=s,he.Element=t,he.ForwardRef=d,he.Fragment=r,he.Lazy=v,he.Memo=m,he.Portal=n,he.Profiler=o,he.StrictMode=i,he.Suspense=p,he.isAsyncMode=function(_){return x(_)||b(_)===c},he.isConcurrentMode=x,he.isContextConsumer=function(_){return b(_)===a},he.isContextProvider=function(_){return b(_)===s},he.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===t},he.isForwardRef=function(_){return b(_)===d},he.isFragment=function(_){return b(_)===r},he.isLazy=function(_){return b(_)===v},he.isMemo=function(_){return b(_)===m},he.isPortal=function(_){return b(_)===n},he.isProfiler=function(_){return b(_)===o},he.isStrictMode=function(_){return b(_)===i},he.isSuspense=function(_){return b(_)===p},he.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===r||_===u||_===o||_===i||_===p||_===f||typeof _=="object"&&_!==null&&(_.$$typeof===v||_.$$typeof===m||_.$$typeof===s||_.$$typeof===a||_.$$typeof===d||_.$$typeof===w||_.$$typeof===C||_.$$typeof===y||_.$$typeof===h)},he.typeOf=b,he}var ge={};/** @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 Zi;function tm(){return Zi||(Zi=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,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,I=e?Symbol.for("react.block"):60121,_=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function b(A){return typeof A=="string"||typeof A=="function"||A===r||A===u||A===o||A===i||A===f||A===m||typeof A=="object"&&A!==null&&(A.$$typeof===g||A.$$typeof===p||A.$$typeof===s||A.$$typeof===a||A.$$typeof===d||A.$$typeof===_||A.$$typeof===C||A.$$typeof===y||A.$$typeof===I)}function x(A){if(typeof A=="object"&&A!==null){var pe=A.$$typeof;switch(pe){case t:var $=A.type;switch($){case c:case u:case r:case o:case i:case f:return $;default:var Ie=$&&$.$$typeof;switch(Ie){case a:case d:case g:case p:case s:return Ie;default:return pe}}case n:return pe}}}var w=c,E=u,j=a,N=s,U=t,W=d,z=r,Y=g,ee=p,B=n,se=o,ne=i,Q=f,de=!1;function fe(A){return de||(de=!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.")),S(A)||x(A)===c}function S(A){return x(A)===u}function D(A){return x(A)===a}function L(A){return x(A)===s}function M(A){return typeof A=="object"&&A!==null&&A.$$typeof===t}function F(A){return x(A)===d}function R(A){return x(A)===r}function X(A){return x(A)===g}function G(A){return x(A)===p}function K(A){return x(A)===n}function Z(A){return x(A)===o}function q(A){return x(A)===i}function ae(A){return x(A)===f}ge.AsyncMode=w,ge.ConcurrentMode=E,ge.ContextConsumer=j,ge.ContextProvider=N,ge.Element=U,ge.ForwardRef=W,ge.Fragment=z,ge.Lazy=Y,ge.Memo=ee,ge.Portal=B,ge.Profiler=se,ge.StrictMode=ne,ge.Suspense=Q,ge.isAsyncMode=fe,ge.isConcurrentMode=S,ge.isContextConsumer=D,ge.isContextProvider=L,ge.isElement=M,ge.isForwardRef=F,ge.isFragment=R,ge.isLazy=X,ge.isMemo=G,ge.isPortal=K,ge.isProfiler=Z,ge.isStrictMode=q,ge.isSuspense=ae,ge.isValidElementType=b,ge.typeOf=x}()),ge}var Qi;function Ra(){return Qi||(Qi=1,process.env.NODE_ENV==="production"?hr.exports=em():hr.exports=tm()),hr.exports}/*
22
+ */var zi;function jf(){return zi||(zi=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,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,c=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,w=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function b(P){return typeof P=="string"||typeof P=="function"||P===r||P===u||P===o||P===i||P===p||P===f||typeof P=="object"&&P!==null&&(P.$$typeof===v||P.$$typeof===m||P.$$typeof===s||P.$$typeof===a||P.$$typeof===d||P.$$typeof===w||P.$$typeof===C||P.$$typeof===y||P.$$typeof===h)}function x(P){if(typeof P=="object"&&P!==null){var fe=P.$$typeof;switch(fe){case t:var K=P.type;switch(K){case c:case u:case r:case o:case i:case p:return K;default:var we=K&&K.$$typeof;switch(we){case a:case d:case v:case m:case s:return we;default:return fe}}case n:return fe}}}var _=c,E=u,D=a,N=s,B=t,W=d,q=r,X=v,ee=m,$=n,ie=o,te=i,G=p,le=!1;function pe(P){return le||(le=!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.")),S(P)||x(P)===c}function S(P){return x(P)===u}function M(P){return x(P)===a}function L(P){return x(P)===s}function k(P){return typeof P=="object"&&P!==null&&P.$$typeof===t}function F(P){return x(P)===d}function A(P){return x(P)===r}function Y(P){return x(P)===v}function Z(P){return x(P)===m}function V(P){return x(P)===n}function Q(P){return x(P)===o}function J(P){return x(P)===i}function ae(P){return x(P)===p}ge.AsyncMode=_,ge.ConcurrentMode=E,ge.ContextConsumer=D,ge.ContextProvider=N,ge.Element=B,ge.ForwardRef=W,ge.Fragment=q,ge.Lazy=X,ge.Memo=ee,ge.Portal=$,ge.Profiler=ie,ge.StrictMode=te,ge.Suspense=G,ge.isAsyncMode=pe,ge.isConcurrentMode=S,ge.isContextConsumer=M,ge.isContextProvider=L,ge.isElement=k,ge.isForwardRef=F,ge.isFragment=A,ge.isLazy=Y,ge.isMemo=Z,ge.isPortal=V,ge.isProfiler=Q,ge.isStrictMode=J,ge.isSuspense=ae,ge.isValidElementType=b,ge.typeOf=x}()),ge}var Xi;function Na(){return Xi||(Xi=1,process.env.NODE_ENV==="production"?gr.exports=kf():gr.exports=jf()),gr.exports}/*
23
23
  object-assign
24
24
  (c) Sindre Sorhus
25
25
  @license MIT
26
- */var lo,es;function nm(){if(es)return lo;es=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function i(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var s={},a=0;a<10;a++)s["_"+String.fromCharCode(a)]=a;var c=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(c.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return lo=i()?Object.assign:function(o,s){for(var a,c=r(o),u,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var f in a)t.call(a,f)&&(c[f]=a[f]);if(e){u=e(a);for(var m=0;m<u.length;m++)n.call(a,u[m])&&(c[u[m]]=a[u[m]])}}return c},lo}var uo,ts;function Yo(){if(ts)return uo;ts=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return uo=e,uo}var po,ns;function Aa(){return ns||(ns=1,po=Function.call.bind(Object.prototype.hasOwnProperty)),po}var fo,rs;function rm(){if(rs)return fo;rs=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Yo(),n={},r=Aa();e=function(o){var s="Warning: "+o;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(o,s,a,c,u){if(process.env.NODE_ENV!=="production"){for(var d in o)if(r(o,d)){var f;try{if(typeof o[d]!="function"){var m=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}f=o[d](s,d,c,a,null,t)}catch(g){f=g}if(f&&!(f instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof f+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),f instanceof Error&&!(f.message in n)){n[f.message]=!0;var p=u?u():"";e("Failed "+a+" type: "+f.message+(p??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},fo=i,fo}var mo,os;function om(){if(os)return mo;os=1;var e=Ra(),t=nm(),n=Yo(),r=Aa(),i=rm(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(a){var c="Warning: "+a;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function s(){return null}return mo=function(a,c){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function f(S){var D=S&&(u&&S[u]||S[d]);if(typeof D=="function")return D}var m="<<anonymous>>",p={array:C("array"),bigint:C("bigint"),bool:C("boolean"),func:C("function"),number:C("number"),object:C("object"),string:C("string"),symbol:C("symbol"),any:y(),arrayOf:b,element:x(),elementType:w(),instanceOf:E,node:W(),objectOf:N,oneOf:j,oneOfType:U,shape:Y,exact:ee};function g(S,D){return S===D?S!==0||1/S===1/D:S!==S&&D!==D}function I(S,D){this.message=S,this.data=D&&typeof D=="object"?D:{},this.stack=""}I.prototype=Error.prototype;function _(S){if(process.env.NODE_ENV!=="production")var D={},L=0;function M(R,X,G,K,Z,q,ae){if(K=K||m,q=q||G,ae!==n){if(c){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 pe=K+":"+G;!D[pe]&&L<3&&(o("You are manually calling a React.PropTypes validation function for the `"+q+"` prop on `"+K+"`. 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."),D[pe]=!0,L++)}}return X[G]==null?R?X[G]===null?new I("The "+Z+" `"+q+"` is marked as required "+("in `"+K+"`, but its value is `null`.")):new I("The "+Z+" `"+q+"` is marked as required in "+("`"+K+"`, but its value is `undefined`.")):null:S(X,G,K,Z,q)}var F=M.bind(null,!1);return F.isRequired=M.bind(null,!0),F}function C(S){function D(L,M,F,R,X,G){var K=L[M],Z=ne(K);if(Z!==S){var q=Q(K);return new I("Invalid "+R+" `"+X+"` of type "+("`"+q+"` supplied to `"+F+"`, expected ")+("`"+S+"`."),{expectedType:S})}return null}return _(D)}function y(){return _(s)}function b(S){function D(L,M,F,R,X){if(typeof S!="function")return new I("Property `"+X+"` of component `"+F+"` has invalid PropType notation inside arrayOf.");var G=L[M];if(!Array.isArray(G)){var K=ne(G);return new I("Invalid "+R+" `"+X+"` of type "+("`"+K+"` supplied to `"+F+"`, expected an array."))}for(var Z=0;Z<G.length;Z++){var q=S(G,Z,F,R,X+"["+Z+"]",n);if(q instanceof Error)return q}return null}return _(D)}function x(){function S(D,L,M,F,R){var X=D[L];if(!a(X)){var G=ne(X);return new I("Invalid "+F+" `"+R+"` of type "+("`"+G+"` supplied to `"+M+"`, expected a single ReactElement."))}return null}return _(S)}function w(){function S(D,L,M,F,R){var X=D[L];if(!e.isValidElementType(X)){var G=ne(X);return new I("Invalid "+F+" `"+R+"` of type "+("`"+G+"` supplied to `"+M+"`, expected a single ReactElement type."))}return null}return _(S)}function E(S){function D(L,M,F,R,X){if(!(L[M]instanceof S)){var G=S.name||m,K=fe(L[M]);return new I("Invalid "+R+" `"+X+"` of type "+("`"+K+"` supplied to `"+F+"`, expected ")+("instance of `"+G+"`."))}return null}return _(D)}function j(S){if(!Array.isArray(S))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("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])."):o("Invalid argument supplied to oneOf, expected an array.")),s;function D(L,M,F,R,X){for(var G=L[M],K=0;K<S.length;K++)if(g(G,S[K]))return null;var Z=JSON.stringify(S,function(ae,A){var pe=Q(A);return pe==="symbol"?String(A):A});return new I("Invalid "+R+" `"+X+"` of value `"+String(G)+"` "+("supplied to `"+F+"`, expected one of "+Z+"."))}return _(D)}function N(S){function D(L,M,F,R,X){if(typeof S!="function")return new I("Property `"+X+"` of component `"+F+"` has invalid PropType notation inside objectOf.");var G=L[M],K=ne(G);if(K!=="object")return new I("Invalid "+R+" `"+X+"` of type "+("`"+K+"` supplied to `"+F+"`, expected an object."));for(var Z in G)if(r(G,Z)){var q=S(G,Z,F,R,X+"."+Z,n);if(q instanceof Error)return q}return null}return _(D)}function U(S){if(!Array.isArray(S))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var D=0;D<S.length;D++){var L=S[D];if(typeof L!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+de(L)+" at index "+D+"."),s}function M(F,R,X,G,K){for(var Z=[],q=0;q<S.length;q++){var ae=S[q],A=ae(F,R,X,G,K,n);if(A==null)return null;A.data&&r(A.data,"expectedType")&&Z.push(A.data.expectedType)}var pe=Z.length>0?", expected one of type ["+Z.join(", ")+"]":"";return new I("Invalid "+G+" `"+K+"` supplied to "+("`"+X+"`"+pe+"."))}return _(M)}function W(){function S(D,L,M,F,R){return B(D[L])?null:new I("Invalid "+F+" `"+R+"` supplied to "+("`"+M+"`, expected a ReactNode."))}return _(S)}function z(S,D,L,M,F){return new I((S||"React class")+": "+D+" type `"+L+"."+M+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+F+"`.")}function Y(S){function D(L,M,F,R,X){var G=L[M],K=ne(G);if(K!=="object")return new I("Invalid "+R+" `"+X+"` of type `"+K+"` "+("supplied to `"+F+"`, expected `object`."));for(var Z in S){var q=S[Z];if(typeof q!="function")return z(F,R,X,Z,Q(q));var ae=q(G,Z,F,R,X+"."+Z,n);if(ae)return ae}return null}return _(D)}function ee(S){function D(L,M,F,R,X){var G=L[M],K=ne(G);if(K!=="object")return new I("Invalid "+R+" `"+X+"` of type `"+K+"` "+("supplied to `"+F+"`, expected `object`."));var Z=t({},L[M],S);for(var q in Z){var ae=S[q];if(r(S,q)&&typeof ae!="function")return z(F,R,X,q,Q(ae));if(!ae)return new I("Invalid "+R+" `"+X+"` key `"+q+"` supplied to `"+F+"`.\nBad object: "+JSON.stringify(L[M],null," ")+`
27
- Valid keys: `+JSON.stringify(Object.keys(S),null," "));var A=ae(G,q,F,R,X+"."+q,n);if(A)return A}return null}return _(D)}function B(S){switch(typeof S){case"number":case"string":case"undefined":return!0;case"boolean":return!S;case"object":if(Array.isArray(S))return S.every(B);if(S===null||a(S))return!0;var D=f(S);if(D){var L=D.call(S),M;if(D!==S.entries){for(;!(M=L.next()).done;)if(!B(M.value))return!1}else for(;!(M=L.next()).done;){var F=M.value;if(F&&!B(F[1]))return!1}}else return!1;return!0;default:return!1}}function se(S,D){return S==="symbol"?!0:D?D["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&D instanceof Symbol:!1}function ne(S){var D=typeof S;return Array.isArray(S)?"array":S instanceof RegExp?"object":se(D,S)?"symbol":D}function Q(S){if(typeof S>"u"||S===null)return""+S;var D=ne(S);if(D==="object"){if(S instanceof Date)return"date";if(S instanceof RegExp)return"regexp"}return D}function de(S){var D=Q(S);switch(D){case"array":case"object":return"an "+D;case"boolean":case"date":case"regexp":return"a "+D;default:return D}}function fe(S){return!S.constructor||!S.constructor.name?m:S.constructor.name}return p.checkPropTypes=i,p.resetWarningCache=i.resetWarningCache,p.PropTypes=p,p},mo}var ho,is;function im(){if(is)return ho;is=1;var e=Yo();function t(){}function n(){}return n.resetWarningCache=t,ho=function(){function r(s,a,c,u,d,f){if(f!==e){var m=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 m.name="Invariant Violation",m}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},ho}if(process.env.NODE_ENV!=="production"){var sm=Ra(),am=!0;To.exports=om()(sm.isElement,am)}else To.exports=im()();var cm=To.exports;const k=Bo(cm);var Ro={exports:{}},ve={};/**
26
+ */var co,Gi;function Lf(){if(Gi)return co;Gi=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function i(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var s={},a=0;a<10;a++)s["_"+String.fromCharCode(a)]=a;var c=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(c.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return co=i()?Object.assign:function(o,s){for(var a,c=r(o),u,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var p in a)t.call(a,p)&&(c[p]=a[p]);if(e){u=e(a);for(var f=0;f<u.length;f++)n.call(a,u[f])&&(c[u[f]]=a[u[f]])}}return c},co}var lo,Yi;function zo(){if(Yi)return lo;Yi=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return lo=e,lo}var uo,Zi;function Sa(){return Zi||(Zi=1,uo=Function.call.bind(Object.prototype.hasOwnProperty)),uo}var po,Qi;function Vf(){if(Qi)return po;Qi=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=zo(),n={},r=Sa();e=function(o){var s="Warning: "+o;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(o,s,a,c,u){if(process.env.NODE_ENV!=="production"){for(var d in o)if(r(o,d)){var p;try{if(typeof o[d]!="function"){var f=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw f.name="Invariant Violation",f}p=o[d](s,d,c,a,null,t)}catch(v){p=v}if(p&&!(p instanceof Error)&&e((c||"React class")+": type specification of "+a+" `"+d+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof p+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),p instanceof Error&&!(p.message in n)){n[p.message]=!0;var m=u?u():"";e("Failed "+a+" type: "+p.message+(m??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},po=i,po}var fo,es;function Kf(){if(es)return fo;es=1;var e=Na(),t=Lf(),n=zo(),r=Sa(),i=Vf(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(a){var c="Warning: "+a;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function s(){return null}return fo=function(a,c){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function p(S){var M=S&&(u&&S[u]||S[d]);if(typeof M=="function")return M}var f="<<anonymous>>",m={array:C("array"),bigint:C("bigint"),bool:C("boolean"),func:C("function"),number:C("number"),object:C("object"),string:C("string"),symbol:C("symbol"),any:y(),arrayOf:b,element:x(),elementType:_(),instanceOf:E,node:W(),objectOf:N,oneOf:D,oneOfType:B,shape:X,exact:ee};function v(S,M){return S===M?S!==0||1/S===1/M:S!==S&&M!==M}function h(S,M){this.message=S,this.data=M&&typeof M=="object"?M:{},this.stack=""}h.prototype=Error.prototype;function w(S){if(process.env.NODE_ENV!=="production")var M={},L=0;function k(A,Y,Z,V,Q,J,ae){if(V=V||f,J=J||Z,ae!==n){if(c){var P=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 P.name="Invariant Violation",P}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var fe=V+":"+Z;!M[fe]&&L<3&&(o("You are manually calling a React.PropTypes validation function for the `"+J+"` prop on `"+V+"`. 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."),M[fe]=!0,L++)}}return Y[Z]==null?A?Y[Z]===null?new h("The "+Q+" `"+J+"` is marked as required "+("in `"+V+"`, but its value is `null`.")):new h("The "+Q+" `"+J+"` is marked as required in "+("`"+V+"`, but its value is `undefined`.")):null:S(Y,Z,V,Q,J)}var F=k.bind(null,!1);return F.isRequired=k.bind(null,!0),F}function C(S){function M(L,k,F,A,Y,Z){var V=L[k],Q=te(V);if(Q!==S){var J=G(V);return new h("Invalid "+A+" `"+Y+"` of type "+("`"+J+"` supplied to `"+F+"`, expected ")+("`"+S+"`."),{expectedType:S})}return null}return w(M)}function y(){return w(s)}function b(S){function M(L,k,F,A,Y){if(typeof S!="function")return new h("Property `"+Y+"` of component `"+F+"` has invalid PropType notation inside arrayOf.");var Z=L[k];if(!Array.isArray(Z)){var V=te(Z);return new h("Invalid "+A+" `"+Y+"` of type "+("`"+V+"` supplied to `"+F+"`, expected an array."))}for(var Q=0;Q<Z.length;Q++){var J=S(Z,Q,F,A,Y+"["+Q+"]",n);if(J instanceof Error)return J}return null}return w(M)}function x(){function S(M,L,k,F,A){var Y=M[L];if(!a(Y)){var Z=te(Y);return new h("Invalid "+F+" `"+A+"` of type "+("`"+Z+"` supplied to `"+k+"`, expected a single ReactElement."))}return null}return w(S)}function _(){function S(M,L,k,F,A){var Y=M[L];if(!e.isValidElementType(Y)){var Z=te(Y);return new h("Invalid "+F+" `"+A+"` of type "+("`"+Z+"` supplied to `"+k+"`, expected a single ReactElement type."))}return null}return w(S)}function E(S){function M(L,k,F,A,Y){if(!(L[k]instanceof S)){var Z=S.name||f,V=pe(L[k]);return new h("Invalid "+A+" `"+Y+"` of type "+("`"+V+"` supplied to `"+F+"`, expected ")+("instance of `"+Z+"`."))}return null}return w(M)}function D(S){if(!Array.isArray(S))return process.env.NODE_ENV!=="production"&&(arguments.length>1?o("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])."):o("Invalid argument supplied to oneOf, expected an array.")),s;function M(L,k,F,A,Y){for(var Z=L[k],V=0;V<S.length;V++)if(v(Z,S[V]))return null;var Q=JSON.stringify(S,function(ae,P){var fe=G(P);return fe==="symbol"?String(P):P});return new h("Invalid "+A+" `"+Y+"` of value `"+String(Z)+"` "+("supplied to `"+F+"`, expected one of "+Q+"."))}return w(M)}function N(S){function M(L,k,F,A,Y){if(typeof S!="function")return new h("Property `"+Y+"` of component `"+F+"` has invalid PropType notation inside objectOf.");var Z=L[k],V=te(Z);if(V!=="object")return new h("Invalid "+A+" `"+Y+"` of type "+("`"+V+"` supplied to `"+F+"`, expected an object."));for(var Q in Z)if(r(Z,Q)){var J=S(Z,Q,F,A,Y+"."+Q,n);if(J instanceof Error)return J}return null}return w(M)}function B(S){if(!Array.isArray(S))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var M=0;M<S.length;M++){var L=S[M];if(typeof L!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+le(L)+" at index "+M+"."),s}function k(F,A,Y,Z,V){for(var Q=[],J=0;J<S.length;J++){var ae=S[J],P=ae(F,A,Y,Z,V,n);if(P==null)return null;P.data&&r(P.data,"expectedType")&&Q.push(P.data.expectedType)}var fe=Q.length>0?", expected one of type ["+Q.join(", ")+"]":"";return new h("Invalid "+Z+" `"+V+"` supplied to "+("`"+Y+"`"+fe+"."))}return w(k)}function W(){function S(M,L,k,F,A){return $(M[L])?null:new h("Invalid "+F+" `"+A+"` supplied to "+("`"+k+"`, expected a ReactNode."))}return w(S)}function q(S,M,L,k,F){return new h((S||"React class")+": "+M+" type `"+L+"."+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+F+"`.")}function X(S){function M(L,k,F,A,Y){var Z=L[k],V=te(Z);if(V!=="object")return new h("Invalid "+A+" `"+Y+"` of type `"+V+"` "+("supplied to `"+F+"`, expected `object`."));for(var Q in S){var J=S[Q];if(typeof J!="function")return q(F,A,Y,Q,G(J));var ae=J(Z,Q,F,A,Y+"."+Q,n);if(ae)return ae}return null}return w(M)}function ee(S){function M(L,k,F,A,Y){var Z=L[k],V=te(Z);if(V!=="object")return new h("Invalid "+A+" `"+Y+"` of type `"+V+"` "+("supplied to `"+F+"`, expected `object`."));var Q=t({},L[k],S);for(var J in Q){var ae=S[J];if(r(S,J)&&typeof ae!="function")return q(F,A,Y,J,G(ae));if(!ae)return new h("Invalid "+A+" `"+Y+"` key `"+J+"` supplied to `"+F+"`.\nBad object: "+JSON.stringify(L[k],null," ")+`
27
+ Valid keys: `+JSON.stringify(Object.keys(S),null," "));var P=ae(Z,J,F,A,Y+"."+J,n);if(P)return P}return null}return w(M)}function $(S){switch(typeof S){case"number":case"string":case"undefined":return!0;case"boolean":return!S;case"object":if(Array.isArray(S))return S.every($);if(S===null||a(S))return!0;var M=p(S);if(M){var L=M.call(S),k;if(M!==S.entries){for(;!(k=L.next()).done;)if(!$(k.value))return!1}else for(;!(k=L.next()).done;){var F=k.value;if(F&&!$(F[1]))return!1}}else return!1;return!0;default:return!1}}function ie(S,M){return S==="symbol"?!0:M?M["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&M instanceof Symbol:!1}function te(S){var M=typeof S;return Array.isArray(S)?"array":S instanceof RegExp?"object":ie(M,S)?"symbol":M}function G(S){if(typeof S>"u"||S===null)return""+S;var M=te(S);if(M==="object"){if(S instanceof Date)return"date";if(S instanceof RegExp)return"regexp"}return M}function le(S){var M=G(S);switch(M){case"array":case"object":return"an "+M;case"boolean":case"date":case"regexp":return"a "+M;default:return M}}function pe(S){return!S.constructor||!S.constructor.name?f:S.constructor.name}return m.checkPropTypes=i,m.resetWarningCache=i.resetWarningCache,m.PropTypes=m,m},fo}var mo,ts;function $f(){if(ts)return mo;ts=1;var e=zo();function t(){}function n(){}return n.resetWarningCache=t,mo=function(){function r(s,a,c,u,d,p){if(p!==e){var f=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 f.name="Invariant Violation",f}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},mo}if(process.env.NODE_ENV!=="production"){var Hf=Na(),Uf=!0;Co.exports=Kf()(Hf.isElement,Uf)}else Co.exports=$f()();var Bf=Co.exports;const j=Wo(Bf);var Oo={exports:{}},ve={};/**
28
28
  * @license React
29
29
  * react-is.production.min.js
30
30
  *
@@ -32,7 +32,7 @@ Valid keys: `+JSON.stringify(Object.keys(S),null," "));var A=ae(G,q,F,R,X+"."+q
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 ss;function lm(){if(ss)return ve;ss=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g;g=Symbol.for("react.module.reference");function I(_){if(typeof _=="object"&&_!==null){var C=_.$$typeof;switch(C){case e:switch(_=_.type,_){case n:case i:case r:case u:case d:return _;default:switch(_=_&&_.$$typeof,_){case a:case s:case c:case m:case f:case o:return _;default:return C}}case t:return C}}}return ve.ContextConsumer=s,ve.ContextProvider=o,ve.Element=e,ve.ForwardRef=c,ve.Fragment=n,ve.Lazy=m,ve.Memo=f,ve.Portal=t,ve.Profiler=i,ve.StrictMode=r,ve.Suspense=u,ve.SuspenseList=d,ve.isAsyncMode=function(){return!1},ve.isConcurrentMode=function(){return!1},ve.isContextConsumer=function(_){return I(_)===s},ve.isContextProvider=function(_){return I(_)===o},ve.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===e},ve.isForwardRef=function(_){return I(_)===c},ve.isFragment=function(_){return I(_)===n},ve.isLazy=function(_){return I(_)===m},ve.isMemo=function(_){return I(_)===f},ve.isPortal=function(_){return I(_)===t},ve.isProfiler=function(_){return I(_)===i},ve.isStrictMode=function(_){return I(_)===r},ve.isSuspense=function(_){return I(_)===u},ve.isSuspenseList=function(_){return I(_)===d},ve.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===n||_===i||_===r||_===u||_===d||_===p||typeof _=="object"&&_!==null&&(_.$$typeof===m||_.$$typeof===f||_.$$typeof===o||_.$$typeof===s||_.$$typeof===c||_.$$typeof===g||_.getModuleId!==void 0)},ve.typeOf=I,ve}var ye={};/**
35
+ */var ns;function Wf(){if(ns)return ve;ns=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),v;v=Symbol.for("react.module.reference");function h(w){if(typeof w=="object"&&w!==null){var C=w.$$typeof;switch(C){case e:switch(w=w.type,w){case n:case i:case r:case u:case d:return w;default:switch(w=w&&w.$$typeof,w){case a:case s:case c:case f:case p:case o:return w;default:return C}}case t:return C}}}return ve.ContextConsumer=s,ve.ContextProvider=o,ve.Element=e,ve.ForwardRef=c,ve.Fragment=n,ve.Lazy=f,ve.Memo=p,ve.Portal=t,ve.Profiler=i,ve.StrictMode=r,ve.Suspense=u,ve.SuspenseList=d,ve.isAsyncMode=function(){return!1},ve.isConcurrentMode=function(){return!1},ve.isContextConsumer=function(w){return h(w)===s},ve.isContextProvider=function(w){return h(w)===o},ve.isElement=function(w){return typeof w=="object"&&w!==null&&w.$$typeof===e},ve.isForwardRef=function(w){return h(w)===c},ve.isFragment=function(w){return h(w)===n},ve.isLazy=function(w){return h(w)===f},ve.isMemo=function(w){return h(w)===p},ve.isPortal=function(w){return h(w)===t},ve.isProfiler=function(w){return h(w)===i},ve.isStrictMode=function(w){return h(w)===r},ve.isSuspense=function(w){return h(w)===u},ve.isSuspenseList=function(w){return h(w)===d},ve.isValidElementType=function(w){return typeof w=="string"||typeof w=="function"||w===n||w===i||w===r||w===u||w===d||w===m||typeof w=="object"&&w!==null&&(w.$$typeof===f||w.$$typeof===p||w.$$typeof===o||w.$$typeof===s||w.$$typeof===c||w.$$typeof===v||w.getModuleId!==void 0)},ve.typeOf=h,ve}var ye={};/**
36
36
  * @license React
37
37
  * react-is.development.js
38
38
  *
@@ -40,10 +40,10 @@ Valid keys: `+JSON.stringify(Object.keys(S),null," "));var A=ae(G,q,F,R,X+"."+q
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 as;function um(){return as||(as=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=!1,I=!1,_=!1,C=!1,y=!1,b;b=Symbol.for("react.module.reference");function x($){return!!(typeof $=="string"||typeof $=="function"||$===n||$===i||y||$===r||$===u||$===d||C||$===p||g||I||_||typeof $=="object"&&$!==null&&($.$$typeof===m||$.$$typeof===f||$.$$typeof===o||$.$$typeof===s||$.$$typeof===c||$.$$typeof===b||$.getModuleId!==void 0))}function w($){if(typeof $=="object"&&$!==null){var Ie=$.$$typeof;switch(Ie){case e:var Pe=$.type;switch(Pe){case n:case i:case r:case u:case d:return Pe;default:var He=Pe&&Pe.$$typeof;switch(He){case a:case s:case c:case m:case f:case o:return He;default:return Ie}}case t:return Ie}}}var E=s,j=o,N=e,U=c,W=n,z=m,Y=f,ee=t,B=i,se=r,ne=u,Q=d,de=!1,fe=!1;function S($){return de||(de=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function D($){return fe||(fe=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function L($){return w($)===s}function M($){return w($)===o}function F($){return typeof $=="object"&&$!==null&&$.$$typeof===e}function R($){return w($)===c}function X($){return w($)===n}function G($){return w($)===m}function K($){return w($)===f}function Z($){return w($)===t}function q($){return w($)===i}function ae($){return w($)===r}function A($){return w($)===u}function pe($){return w($)===d}ye.ContextConsumer=E,ye.ContextProvider=j,ye.Element=N,ye.ForwardRef=U,ye.Fragment=W,ye.Lazy=z,ye.Memo=Y,ye.Portal=ee,ye.Profiler=B,ye.StrictMode=se,ye.Suspense=ne,ye.SuspenseList=Q,ye.isAsyncMode=S,ye.isConcurrentMode=D,ye.isContextConsumer=L,ye.isContextProvider=M,ye.isElement=F,ye.isForwardRef=R,ye.isFragment=X,ye.isLazy=G,ye.isMemo=K,ye.isPortal=Z,ye.isProfiler=q,ye.isStrictMode=ae,ye.isSuspense=A,ye.isSuspenseList=pe,ye.isValidElementType=x,ye.typeOf=w}()),ye}process.env.NODE_ENV==="production"?Ro.exports=lm():Ro.exports=um();var cs=Ro.exports;const ls=e=>typeof e=="object"&&e!=null&&e.nodeType===1,us=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",go=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return us(n.overflowY,t)||us(n.overflowX,t)||(r=>{const i=(o=>{if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeight<r.scrollHeight||i.clientWidth<r.scrollWidth)})(e)}return!1},gr=(e,t,n,r,i,o,s,a)=>o<e&&s>t||o>e&&s<t?0:o<=e&&a<=n||s>=t&&a>=n?o-e-r:s>t&&a<n||o<e&&a>n?s-t+i:0,dm=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},pm=(e,t)=>{var n,r,i,o;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:u,skipOverflowHiddenElements:d}=t,f=typeof u=="function"?u:ne=>ne!==u;if(!ls(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let g=e;for(;ls(g)&&f(g);){if(g=dm(g),g===m){p.push(g);break}g!=null&&g===document.body&&go(g)&&!go(document.documentElement)||g!=null&&go(g,d)&&p.push(g)}const I=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,_=(o=(i=window.visualViewport)==null?void 0:i.height)!=null?o:innerHeight,{scrollX:C,scrollY:y}=window,{height:b,width:x,top:w,right:E,bottom:j,left:N}=e.getBoundingClientRect(),{top:U,right:W,bottom:z,left:Y}=(ne=>{const Q=window.getComputedStyle(ne);return{top:parseFloat(Q.scrollMarginTop)||0,right:parseFloat(Q.scrollMarginRight)||0,bottom:parseFloat(Q.scrollMarginBottom)||0,left:parseFloat(Q.scrollMarginLeft)||0}})(e);let ee=a==="start"||a==="nearest"?w-U:a==="end"?j+z:w+b/2-U+z,B=c==="center"?N+x/2-Y+W:c==="end"?E+W:N-Y;const se=[];for(let ne=0;ne<p.length;ne++){const Q=p[ne],{height:de,width:fe,top:S,right:D,bottom:L,left:M}=Q.getBoundingClientRect();if(s==="if-needed"&&w>=0&&N>=0&&j<=_&&E<=I&&w>=S&&j<=L&&N>=M&&E<=D)return se;const F=getComputedStyle(Q),R=parseInt(F.borderLeftWidth,10),X=parseInt(F.borderTopWidth,10),G=parseInt(F.borderRightWidth,10),K=parseInt(F.borderBottomWidth,10);let Z=0,q=0;const ae="offsetWidth"in Q?Q.offsetWidth-Q.clientWidth-R-G:0,A="offsetHeight"in Q?Q.offsetHeight-Q.clientHeight-X-K:0,pe="offsetWidth"in Q?Q.offsetWidth===0?0:fe/Q.offsetWidth:0,$="offsetHeight"in Q?Q.offsetHeight===0?0:de/Q.offsetHeight:0;if(m===Q)Z=a==="start"?ee:a==="end"?ee-_:a==="nearest"?gr(y,y+_,_,X,K,y+ee,y+ee+b,b):ee-_/2,q=c==="start"?B:c==="center"?B-I/2:c==="end"?B-I:gr(C,C+I,I,R,G,C+B,C+B+x,x),Z=Math.max(0,Z+y),q=Math.max(0,q+C);else{Z=a==="start"?ee-S-X:a==="end"?ee-L+K+A:a==="nearest"?gr(S,L,de,X,K+A,ee,ee+b,b):ee-(S+de/2)+A/2,q=c==="start"?B-M-R:c==="center"?B-(M+fe/2)+ae/2:c==="end"?B-D+G+ae:gr(M,D,fe,R,G+ae,B,B+x,x);const{scrollLeft:Ie,scrollTop:Pe}=Q;Z=$===0?0:Math.max(0,Math.min(Pe+Z/$,Q.scrollHeight-de/$+A)),q=pe===0?0:Math.max(0,Math.min(Ie+q/pe,Q.scrollWidth-fe/pe+ae)),ee+=Pe-Z,B+=Ie-q}se.push({el:Q,top:Z,left:q})}return se};var En=function(){return En=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},En.apply(this,arguments)};var fm=0;function ds(e){return typeof e=="function"?e:st}function st(){}function Pa(e,t){if(e){var n=pm(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var i=r.el,o=r.top,s=r.left;i.scrollTop=o,i.scrollLeft=s})}}function ps(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Zo(e,t){var n;function r(){n&&clearTimeout(n)}function i(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return i.cancel=r,i}function Le(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(o)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function bn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(i){typeof i=="function"?i(r):i&&(i.current=r)})}}function Da(){return String(fm++)}function mm(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?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 fs(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Fa(e){return typeof e.type=="string"}function Ma(e){return e.props}function hm(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var gm=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function vr(e){e===void 0&&(e={});var t={};return gm.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function Rr(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=Ar(t,r)?t[r]:e[r],n},{})}function Ar(e,t){return e[t]!==void 0}function Ao(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function vm(e){return Object.prototype.toString.call(e)==="[object Object]"}function dn(e,t,n,r,i){var o=n.length;if(o===0)return-1;var s=o-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var a=e+t;a<0?a=s:a>s&&(a=0);var c=Nn(a,t<0,n,r,i);return c===-1?e>=o?-1:e:c}function Nn(e,t,n,r,i){i===void 0&&(i=!1);var o=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<o;a++)if(!r(n[a],a))return a;return i?Nn(t?o-1:0,t,n,r):-1}function Pr(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(ps(i,e,n)||r&&ps(i,n.document.activeElement,n))})}var Qo=st;process.env.NODE_ENV!=="production"&&(Qo=function(t,n,r){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(o){n[o]!==void 0&&r[o]===void 0?console.error('downshift: A component has changed the controlled prop "'+o+'" to be uncontrolled. '+i):n[o]===void 0&&r[o]!==void 0&&console.error('downshift: A component has changed the uncontrolled prop "'+o+'" to be controlled. '+i)})});var ym=Zo(function(e){ka(e).textContent=""},500);function ka(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 ja(e,t){if(!(!e||!t)){var n=ka(t);n.textContent=e,ym(t)}}function Im(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var La=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Ka=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,$a=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,br=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,xr=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Va=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Ha=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Ua=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Ba=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,qa=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Wa=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Ja=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,za=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,Po=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Xa=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Ga=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Ya=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,wm=Object.freeze({__proto__:null,blurButton:Xa,blurInput:Wa,changeInput:Ja,clickButton:Po,clickItem:qa,controlledPropUpdatedSelectedItem:Ga,itemMouseEnter:$a,keyDownArrowDown:xr,keyDownArrowUp:br,keyDownEnd:Ba,keyDownEnter:Ha,keyDownEscape:Va,keyDownHome:Ua,keyDownSpaceButton:za,mouseUp:Ka,touchEnd:Ya,unknown:La}),_m=["refKey","ref"],bm=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],xm=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Cm=["refKey","ref"],Om=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Em=function(){var e=function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+Da(),o.menuId=o.props.menuId||o.id+"-menu",o.labelId=o.props.labelId||o.id+"-label",o.inputId=o.props.inputId||o.id+"-input",o.getItemId=o.props.getItemId||function(y){return o.id+"-item-"+y},o.items=[],o.itemCount=null,o.previousResultCount=0,o.timeoutIds=[],o.internalSetTimeout=function(y,b){var x=setTimeout(function(){o.timeoutIds=o.timeoutIds.filter(function(w){return w!==x}),y()},b);o.timeoutIds.push(x)},o.setItemCount=function(y){o.itemCount=y},o.unsetItemCount=function(){o.itemCount=null},o.isItemDisabled=function(y,b){var x=o.getItemNodeFromIndex(b);return x&&x.hasAttribute("disabled")},o.setHighlightedIndex=function(y,b){y===void 0&&(y=o.props.defaultHighlightedIndex),b===void 0&&(b={}),b=vr(b),o.internalSetState(le({highlightedIndex:y},b))},o.clearSelection=function(y){o.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:o.props.defaultHighlightedIndex,isOpen:o.props.defaultIsOpen},y)},o.selectItem=function(y,b,x){b=vr(b),o.internalSetState(le({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,selectedItem:y,inputValue:o.props.itemToString(y)},b),x)},o.selectItemAtIndex=function(y,b,x){var w=o.items[y];w!=null&&o.selectItem(w,b,x)},o.selectHighlightedItem=function(y,b){return o.selectItemAtIndex(o.getState().highlightedIndex,y,b)},o.internalSetState=function(y,b){var x,w,E={},j=typeof y=="function";return!j&&y.hasOwnProperty("inputValue")&&o.props.onInputValueChange(y.inputValue,le({},o.getStateAndHelpers(),y)),o.setState(function(N){var U;N=o.getState(N);var W=j?y(N):y;W=o.props.stateReducer(N,W),x=W.hasOwnProperty("selectedItem");var z={};return x&&W.selectedItem!==N.selectedItem&&(w=W.selectedItem),(U=W).type||(U.type=La),Object.keys(W).forEach(function(Y){N[Y]!==W[Y]&&(E[Y]=W[Y]),Y!=="type"&&(W[Y],Ar(o.props,Y)||(z[Y]=W[Y]))}),j&&W.hasOwnProperty("inputValue")&&o.props.onInputValueChange(W.inputValue,le({},o.getStateAndHelpers(),W)),z},function(){ds(b)();var N=Object.keys(E).length>1;N&&o.props.onStateChange(E,o.getStateAndHelpers()),x&&o.props.onSelect(y.selectedItem,o.getStateAndHelpers()),w!==void 0&&o.props.onChange(w,o.getStateAndHelpers()),o.props.onUserAction(E,o.getStateAndHelpers())})},o.rootRef=function(y){return o._rootNode=y},o.getRootProps=function(y,b){var x,w=y===void 0?{}:y,E=w.refKey,j=E===void 0?"ref":E,N=w.ref,U=Lt(w,_m),W=b===void 0?{}:b,z=W.suppressRefError,Y=z===void 0?!1:z;o.getRootProps.called=!0,o.getRootProps.refKey=j,o.getRootProps.suppressRefError=Y;var ee=o.getState(),B=ee.isOpen;return le((x={},x[j]=bn(N,o.rootRef),x.role="combobox",x["aria-expanded"]=B,x["aria-haspopup"]="listbox",x["aria-owns"]=B?o.menuId:void 0,x["aria-labelledby"]=o.labelId,x),U)},o.keyDownHandlers={ArrowDown:function(b){var x=this;if(b.preventDefault(),this.getState().isOpen){var w=b.shiftKey?5:1;this.moveHighlightedIndex(w,{type:xr})}else this.internalSetState({isOpen:!0,type:xr},function(){var E=x.getItemCount();if(E>0){var j=x.getState(),N=j.highlightedIndex,U=dn(N,1,{length:E},x.isItemDisabled,!0);x.setHighlightedIndex(U,{type:xr})}})},ArrowUp:function(b){var x=this;if(b.preventDefault(),this.getState().isOpen){var w=b.shiftKey?-5:-1;this.moveHighlightedIndex(w,{type:br})}else this.internalSetState({isOpen:!0,type:br},function(){var E=x.getItemCount();if(E>0){var j=x.getState(),N=j.highlightedIndex,U=dn(N,-1,{length:E},x.isItemDisabled,!0);x.setHighlightedIndex(U,{type:br})}})},Enter:function(b){if(b.which!==229){var x=this.getState(),w=x.isOpen,E=x.highlightedIndex;if(w&&E!=null){b.preventDefault();var j=this.items[E],N=this.getItemNodeFromIndex(E);if(j==null||N&&N.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Ha})}}},Escape:function(b){b.preventDefault(),this.reset(le({type:Va},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=le({},o.keyDownHandlers,{" ":function(b){b.preventDefault(),this.toggleMenu({type:za})}}),o.inputKeyDownHandlers=le({},o.keyDownHandlers,{Home:function(b){var x=this.getState(),w=x.isOpen;if(w){b.preventDefault();var E=this.getItemCount();if(!(E<=0||!w)){var j=Nn(0,!1,{length:E},this.isItemDisabled);this.setHighlightedIndex(j,{type:Ua})}}},End:function(b){var x=this.getState(),w=x.isOpen;if(w){b.preventDefault();var E=this.getItemCount();if(!(E<=0||!w)){var j=Nn(E-1,!0,{length:E},this.isItemDisabled);this.setHighlightedIndex(j,{type:Ba})}}}}),o.getToggleButtonProps=function(y){var b=y===void 0?{}:y,x=b.onClick;b.onPress;var w=b.onKeyDown,E=b.onKeyUp,j=b.onBlur,N=Lt(b,bm),U=o.getState(),W=U.isOpen,z={onClick:Le(x,o.buttonHandleClick),onKeyDown:Le(w,o.buttonHandleKeyDown),onKeyUp:Le(E,o.buttonHandleKeyUp),onBlur:Le(j,o.buttonHandleBlur)},Y=N.disabled?{}:z;return le({type:"button",role:"button","aria-label":W?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},Y,N)},o.buttonHandleKeyUp=function(y){y.preventDefault()},o.buttonHandleKeyDown=function(y){var b=Ao(y);o.buttonKeyDownHandlers[b]&&o.buttonKeyDownHandlers[b].call(o,y)},o.buttonHandleClick=function(y){if(y.preventDefault(),o.props.environment){var b=o.props.environment.document,x=b.body,w=b.activeElement;x&&x===w&&y.target.focus()}process.env.NODE_ENV==="test"?o.toggleMenu({type:Po}):o.internalSetTimeout(function(){return o.toggleMenu({type:Po})})},o.buttonHandleBlur=function(y){var b=y.target;o.internalSetTimeout(function(){if(!(o.isMouseDown||!o.props.environment)){var x=o.props.environment.document.activeElement;(x==null||x.id!==o.inputId)&&x!==b&&o.reset({type:Xa})}})},o.getLabelProps=function(y){return le({htmlFor:o.inputId,id:o.labelId},y)},o.getInputProps=function(y){var b=y===void 0?{}:y,x=b.onKeyDown,w=b.onBlur,E=b.onChange,j=b.onInput;b.onChangeText;var N=Lt(b,xm),U,W={};U="onChange";var z=o.getState(),Y=z.inputValue,ee=z.isOpen,B=z.highlightedIndex;if(!N.disabled){var se;W=(se={},se[U]=Le(E,j,o.inputHandleChange),se.onKeyDown=Le(x,o.inputHandleKeyDown),se.onBlur=Le(w,o.inputHandleBlur),se)}return le({"aria-autocomplete":"list","aria-activedescendant":ee&&typeof B=="number"&&B>=0?o.getItemId(B):void 0,"aria-controls":ee?o.menuId:void 0,"aria-labelledby":N&&N["aria-label"]?void 0:o.labelId,autoComplete:"off",value:Y,id:o.inputId},W,N)},o.inputHandleKeyDown=function(y){var b=Ao(y);b&&o.inputKeyDownHandlers[b]&&o.inputKeyDownHandlers[b].call(o,y)},o.inputHandleChange=function(y){o.internalSetState({type:Ja,isOpen:!0,inputValue:y.target.value,highlightedIndex:o.props.defaultHighlightedIndex})},o.inputHandleBlur=function(){o.internalSetTimeout(function(){var y;if(!(o.isMouseDown||!o.props.environment)){var b=o.props.environment.document.activeElement,x=(b==null||(y=b.dataset)==null?void 0:y.toggle)&&o._rootNode&&o._rootNode.contains(b);x||o.reset({type:Wa})}})},o.menuRef=function(y){o._menuNode=y},o.getMenuProps=function(y,b){var x,w=y===void 0?{}:y,E=w.refKey,j=E===void 0?"ref":E,N=w.ref,U=Lt(w,Cm),W=b===void 0?{}:b,z=W.suppressRefError,Y=z===void 0?!1:z;return o.getMenuProps.called=!0,o.getMenuProps.refKey=j,o.getMenuProps.suppressRefError=Y,le((x={},x[j]=bn(N,o.menuRef),x.role="listbox",x["aria-labelledby"]=U&&U["aria-label"]?void 0:o.labelId,x.id=o.menuId,x),U)},o.getItemProps=function(y){var b,x=y===void 0?{}:y,w=x.onMouseMove,E=x.onMouseDown,j=x.onClick;x.onPress;var N=x.index,U=x.item,W=U===void 0?process.env.NODE_ENV==="production"?void 0:hm("getItemProps","item"):U,z=Lt(x,Om);N===void 0?(o.items.push(W),N=o.items.indexOf(W)):o.items[N]=W;var Y="onClick",ee=j,B=(b={onMouseMove:Le(w,function(){N!==o.getState().highlightedIndex&&(o.setHighlightedIndex(N,{type:$a}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:Le(E,function(ne){ne.preventDefault()})},b[Y]=Le(ee,function(){o.selectItemAtIndex(N,{type:qa})}),b),se=z.disabled?{onMouseDown:B.onMouseDown}:B;return le({id:o.getItemId(N),role:"option","aria-selected":o.getState().highlightedIndex===N},se,z)},o.clearItems=function(){o.items=[]},o.reset=function(y,b){y===void 0&&(y={}),y=vr(y),o.internalSetState(function(x){var w=x.selectedItem;return le({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,inputValue:o.props.itemToString(w)},y)},b)},o.toggleMenu=function(y,b){y===void 0&&(y={}),y=vr(y),o.internalSetState(function(x){var w=x.isOpen;return le({isOpen:!w},w&&{highlightedIndex:o.props.defaultHighlightedIndex},y)},function(){var x=o.getState(),w=x.isOpen,E=x.highlightedIndex;w&&o.getItemCount()>0&&typeof E=="number"&&o.setHighlightedIndex(E,y),ds(b)()})},o.openMenu=function(y){o.internalSetState({isOpen:!0},y)},o.closeMenu=function(y){o.internalSetState({isOpen:!1},y)},o.updateStatus=Zo(function(){var y;if((y=o.props)!=null&&(y=y.environment)!=null&&y.document){var b=o.getState(),x=o.items[b.highlightedIndex],w=o.getItemCount(),E=o.props.getA11yStatusMessage(le({itemToString:o.props.itemToString,previousResultCount:o.previousResultCount,resultCount:w,highlightedItem:x},b));o.previousResultCount=w,ja(E,o.props.environment.document)}},200);var s=o.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,u=c===void 0?a:c,d=s.defaultIsOpen,f=s.initialIsOpen,m=f===void 0?d:f,p=s.initialInputValue,g=p===void 0?"":p,I=s.initialSelectedItem,_=I===void 0?null:I,C=o.getState({highlightedIndex:u,isOpen:m,inputValue:g,selectedItem:_});return C.selectedItem!=null&&o.props.initialInputValue===void 0&&(C.inputValue=o.props.itemToString(C.selectedItem)),o.state=C,o}Qf(n,t);var r=n.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach(function(o){clearTimeout(o)}),this.timeoutIds=[]},r.getState=function(o){return o===void 0&&(o=this.state),Rr(o,this.props)},r.getItemCount=function(){var o=this.items.length;return this.itemCount!=null?o=this.itemCount:this.props.itemCount!==void 0&&(o=this.props.itemCount),o},r.getItemNodeFromIndex=function(o){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(o)):null},r.scrollHighlightedItemIntoView=function(){{var o=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(o,this._menuNode)}},r.moveHighlightedIndex=function(o,s){var a=this.getItemCount(),c=this.getState(),u=c.highlightedIndex;if(a>0){var d=dn(u,o,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(d,s)}},r.getStateAndHelpers=function(){var o=this.getState(),s=o.highlightedIndex,a=o.inputValue,c=o.selectedItem,u=o.isOpen,d=this.props.itemToString,f=this.id,m=this.getRootProps,p=this.getToggleButtonProps,g=this.getLabelProps,I=this.getMenuProps,_=this.getInputProps,C=this.getItemProps,y=this.openMenu,b=this.closeMenu,x=this.toggleMenu,w=this.selectItem,E=this.selectItemAtIndex,j=this.selectHighlightedItem,N=this.setHighlightedIndex,U=this.clearSelection,W=this.clearItems,z=this.reset,Y=this.setItemCount,ee=this.unsetItemCount,B=this.internalSetState;return{getRootProps:m,getToggleButtonProps:p,getLabelProps:g,getMenuProps:I,getInputProps:_,getItemProps:C,reset:z,openMenu:y,closeMenu:b,toggleMenu:x,selectItem:w,selectItemAtIndex:E,selectHighlightedItem:j,setHighlightedIndex:N,clearSelection:U,clearItems:W,setItemCount:Y,unsetItemCount:ee,setState:B,itemToString:d,id:f,highlightedIndex:s,inputValue:a,isOpen:u,selectedItem:c}},r.componentDidMount=function(){var o=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&ms(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){o.internalClearTimeouts()};else{var s=function(){o.isMouseDown=!0},a=function(p){o.isMouseDown=!1;var g=Pr(p.target,[o._rootNode,o._menuNode],o.props.environment);!g&&o.getState().isOpen&&o.reset({type:Ka},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},c=function(){o.isTouchMove=!1},u=function(){o.isTouchMove=!0},d=function(p){var g=Pr(p.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!g&&o.getState().isOpen&&o.reset({type:Ya},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},f=this.props.environment;f.addEventListener("mousedown",s),f.addEventListener("mouseup",a),f.addEventListener("touchstart",c),f.addEventListener("touchmove",u),f.addEventListener("touchend",d),this.cleanup=function(){o.internalClearTimeouts(),o.updateStatus.cancel(),f.removeEventListener("mousedown",s),f.removeEventListener("mouseup",a),f.removeEventListener("touchstart",c),f.removeEventListener("touchmove",u),f.removeEventListener("touchend",d)}}},r.shouldScroll=function(o,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,u=s.highlightedIndex===void 0?o:s,d=u.highlightedIndex,f=c&&this.getState().isOpen&&!o.isOpen,m=c!==d;return f||m},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(Qo(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&ms(this._menuNode,this.getMenuProps)),Ar(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Ga,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,o)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var o=fs(this.props.children,st);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=fs(o(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&&Nm(s,this.getRootProps),s;if(Fa(s))return h.cloneElement(s,this.getRootProps(Ma(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}(h.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:mm,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&vm(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:st,onInputValueChange:st,onUserAction:st,onChange:st,onSelect:st,onOuterClick:st,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:Pa},e.stateChangeTypes=wm,e}();process.env.NODE_ENV!=="production"&&(Em.propTypes={children:k.func,defaultHighlightedIndex:k.number,defaultIsOpen:k.bool,initialHighlightedIndex:k.number,initialSelectedItem:k.any,initialInputValue:k.string,initialIsOpen:k.bool,getA11yStatusMessage:k.func,itemToString:k.func,onChange:k.func,onSelect:k.func,onStateChange:k.func,onInputValueChange:k.func,onUserAction:k.func,onOuterClick:k.func,selectedItemChanged:k.func,stateReducer:k.func,itemCount:k.number,id:k.string,environment:k.shape({addEventListener:k.func.isRequired,removeEventListener:k.func.isRequired,document:k.shape({createElement:k.func.isRequired,getElementById:k.func.isRequired,activeElement:k.any.isRequired,body:k.any.isRequired}).isRequired,Node:k.func.isRequired}),suppressRefError:k.bool,scrollIntoView:k.func,selectedItem:k.any,isOpen:k.bool,inputValue:k.string,highlightedIndex:k.number,labelId:k.string,inputId:k.string,menuId:k.string,getItemId:k.func});function ms(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 Nm(e,t){var n=t.refKey,r=n!=="ref",i=!Fa(e);i&&!r&&!cs.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!i&&r&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!cs.isForwardRef(e)&&!Ma(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Za={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Sm(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){Tm(s,e,t,n),n[s]!==t[s]&&(o[s]=n[s])}),r.onStateChange&&Object.keys(o).length&&r.onStateChange(le({type:i},o))}function Tm(e,t,n,r){var i=t.props,o=t.type,s="on"+ei(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](le({type:o},r))}function Rm(e,t){return t.changes}var hs=Zo(function(e,t){ja(e,t)},200),Am=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?h.useLayoutEffect:h.useEffect,Pm="useId"in h?function(t){var n=t.id,r=t.labelId,i=t.menuId,o=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+h.useId();n||(n=c);var u=h.useRef({labelId:r||n+"-label",menuId:i||n+"-menu",getItemId:o||function(d){return n+"-item-"+d},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return u.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+Da():n,i=t.labelId,o=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,u=h.useRef({labelId:i||r+"-label",menuId:o||r+"-menu",getItemId:s||function(d){return r+"-item-"+d},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return u.current};function Dm(e,t,n,r){var i,o;if(e===void 0){if(t===void 0)throw new Error(r);i=n[t],o=t}else o=t===void 0?n.indexOf(e):t,i=e;return[i,o]}function ei(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Qa(e){var t=h.useRef(e);return t.current=e,t}function Fm(e,t,n,r){var i=h.useRef(),o=h.useRef(),s=h.useCallback(function(p,g){o.current=g,p=Rr(p,g.props);var I=e(p,g),_=g.props.stateReducer(p,le({},g,{changes:I}));return _},[e]),a=h.useReducer(s,t,n),c=a[0],u=a[1],d=Qa(t),f=h.useCallback(function(p){return u(le({props:d.current},p))},[d]),m=o.current;return h.useEffect(function(){var p=Rr(i.current,m==null?void 0:m.props),g=m&&i.current&&!r(p,c);g&&Sm(m,p,c),i.current=c},[c,m,r]),[c,f]}var $n={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:Rm,scrollIntoView:Pa,environment:typeof window>"u"?void 0:window};function zt(e,t,n){n===void 0&&(n=Za);var r=e["default"+ei(t)];return r!==void 0?r:n[t]}function Vn(e,t,n){n===void 0&&(n=Za);var r=e[t];if(r!==void 0)return r;var i=e["initial"+ei(t)];return i!==void 0?i:zt(e,t,n)}function Mm(e){var t=Vn(e,"selectedItem"),n=Vn(e,"isOpen"),r=$m(e),i=Vn(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(o){return e.itemToKey(o)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:i}}function Hn(e,t,n){var r=e.items,i=e.initialHighlightedIndex,o=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,u=t.highlightedIndex;return r.length===0?-1:i!==void 0&&u===i&&!s(r[i],i)?i:o!==void 0&&!s(r[o],o)?o:c?r.findIndex(function(d){return a(c)===a(d)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function km(e,t,n){var r=h.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return h.useEffect(function(){if(!e)return st;var i=n.map(function(d){return d.current});function o(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(d){r.current.isMouseDown=!1,Pr(d.target,i,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function u(d){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!Pr(d.target,i,e,!1)&&t()}return e.addEventListener("mousedown",o),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",c),e.addEventListener("touchend",u),function(){e.removeEventListener("mousedown",o),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",u)}},[n,e,t]),r.current}var ec=function(){return st};process.env.NODE_ENV!=="production"&&(ec=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=h.useRef(n.reduce(function(s,a){return s[a]={},s},{}));h.useEffect(function(){Object.keys(i.current).forEach(function(s){var a=i.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var c=a.suppressRefError,u=a.refKey,d=a.elementRef;c||d!=null&&d.current||console.error('downshift: The ref prop "'+u+'" from '+s+" was not applied correctly on your element.")})},[]);var o=h.useCallback(function(s,a,c,u){i.current[s]={suppressRefError:a,refKey:c,elementRef:u}},[]);return o});function jm(e,t,n,r){r===void 0&&(r={});var i=r.document,o=Xr();h.useEffect(function(){if(!(!e||o||!i)){var s=e(t);hs(s,i)}},n),h.useEffect(function(){return function(){hs.cancel(),Im(i)}},[i])}function Lm(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,i=e.getItemNodeFromIndex,o=e.menuElement,s=e.scrollIntoView,a=h.useRef(!0);return Am(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(i(t),o))},[t]),a}var tc=st;process.env.NODE_ENV!=="production"&&(tc=function(t){var n=t.props,r=t.state,i=h.useRef(n),o=Xr();h.useEffect(function(){o||(Qo(r,i.current,n),i.current=n)},[r,n,o])});function gs(e,t,n){var r;n===void 0&&(n=!0);var i=((r=e.items)==null?void 0:r.length)&&t>=0;return le({isOpen:!1,highlightedIndex:-1},i&&le({selectedItem:e.items[t],isOpen:zt(e,"isOpen"),highlightedIndex:zt(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function Km(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Xr(){var e=h.useRef(!0);return h.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Do(e){var t=zt(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function $m(e){var t=Vn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Cr={environment:k.shape({addEventListener:k.func.isRequired,removeEventListener:k.func.isRequired,document:k.shape({createElement:k.func.isRequired,getElementById:k.func.isRequired,activeElement:k.any.isRequired,body:k.any.isRequired}).isRequired,Node:k.func.isRequired}),itemToString:k.func,itemToKey:k.func,stateReducer:k.func},nc=le({},Cr,{getA11yStatusMessage:k.func,highlightedIndex:k.number,defaultHighlightedIndex:k.number,initialHighlightedIndex:k.number,isOpen:k.bool,defaultIsOpen:k.bool,initialIsOpen:k.bool,selectedItem:k.any,initialSelectedItem:k.any,defaultSelectedItem:k.any,id:k.string,labelId:k.string,menuId:k.string,getItemId:k.func,toggleButtonId:k.string,onSelectedItemChange:k.func,onHighlightedIndexChange:k.func,onStateChange:k.func,onIsOpenChange:k.func,scrollIntoView:k.func});function Vm(e,t,n){var r=t.type,i=t.props,o;switch(r){case n.ItemMouseMove:o={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:o={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:o={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Hn(i,e,0)};break;case n.FunctionOpenMenu:o={isOpen:!0,highlightedIndex:Hn(i,e,0)};break;case n.FunctionCloseMenu:o={isOpen:!1};break;case n.FunctionSetHighlightedIndex:o={highlightedIndex:i.isItemDisabled(i.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:o={inputValue:t.inputValue};break;case n.FunctionReset:o={highlightedIndex:Do(i),isOpen:zt(i,"isOpen"),selectedItem:zt(i,"selectedItem"),inputValue:zt(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return le({},e,o)}En(En({},nc),{items:k.array.isRequired,isItemDisabled:k.func});En(En({},$n),{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 ti=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,ni=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,ri=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,oi=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,ii=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,si=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,ai=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,ci=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,li=process.env.NODE_ENV!=="production"?"__input_change__":8,Dr=process.env.NODE_ENV!=="production"?"__input_blur__":9,ui=process.env.NODE_ENV!=="production"?"__input_click__":10,rc=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,oc=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,di=process.env.NODE_ENV!=="production"?"__item_click__":13,ic=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,sc=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,ac=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,cc=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,lc=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,pi=process.env.NODE_ENV!=="production"?"__function_select_item__":19,uc=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,dc=process.env.NODE_ENV!=="production"?"__function_reset__":21,fi=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,pc=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:fi,FunctionCloseMenu:cc,FunctionOpenMenu:ac,FunctionReset:dc,FunctionSelectItem:pi,FunctionSetHighlightedIndex:lc,FunctionSetInputValue:uc,FunctionToggleMenu:sc,InputBlur:Dr,InputChange:li,InputClick:ui,InputKeyDownArrowDown:ti,InputKeyDownArrowUp:ni,InputKeyDownEnd:ii,InputKeyDownEnter:ci,InputKeyDownEscape:ri,InputKeyDownHome:oi,InputKeyDownPageDown:ai,InputKeyDownPageUp:si,ItemClick:di,ItemMouseMove:oc,MenuMouseLeave:rc,ToggleButtonClick:ic});function Hm(e){var t=Mm(e),n=t.selectedItem,r=t.inputValue;return r===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),le({},t,{inputValue:r})}var Um=le({},nc,{items:k.array.isRequired,isItemDisabled:k.func,inputValue:k.string,defaultInputValue:k.string,initialInputValue:k.string,inputId:k.string,onInputValueChange:k.func});function Bm(e,t,n,r){var i=h.useRef(),o=Fm(e,t,n,r),s=o[0],a=o[1],c=Xr();return h.useEffect(function(){if(Ar(t,"selectedItem")){if(!c){var u=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);u&&a({type:fi,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Rr(s,t),a]}var fc=st;process.env.NODE_ENV!=="production"&&(fc=function(t,n){k.checkPropTypes(Um,t,"prop",n.name)});var qm=le({},$n,{isItemDisabled:function(){return!1}});function Wm(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case di:s={isOpen:zt(i,"isOpen"),highlightedIndex:Do(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case ti:e.isOpen?s={highlightedIndex:dn(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:o&&e.selectedItem==null?-1:Hn(i,e,1),isOpen:i.items.length>=0};break;case ni:e.isOpen?o?s=gs(i,e.highlightedIndex):s={highlightedIndex:dn(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:Hn(i,e,-1),isOpen:i.items.length>=0};break;case ci:s=gs(i,e.highlightedIndex);break;case ri:s=le({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case si:s={highlightedIndex:dn(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case ai:s={highlightedIndex:dn(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case oi:s={highlightedIndex:Nn(0,!1,i.items,i.isItemDisabled)};break;case ii:s={highlightedIndex:Nn(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case Dr:s=le({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 li:s={isOpen:!0,highlightedIndex:Do(i),inputValue:t.inputValue};break;case ui:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Hn(i,e,0)};break;case pi:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case fi:s={inputValue:t.inputValue};break;default:return Vm(e,t,pc)}return le({},e,s)}var Jm=["onMouseLeave","refKey","ref"],zm=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],Xm=["onClick","onPress","refKey","ref"],Gm=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];mi.stateChangeTypes=pc;function mi(e){e===void 0&&(e={}),fc(e,mi);var t=le({},qm,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=Bm(Wm,t,Hm,Km),a=s[0],c=s[1],u=a.isOpen,d=a.highlightedIndex,f=a.selectedItem,m=a.inputValue,p=h.useRef(null),g=h.useRef({}),I=h.useRef(null),_=h.useRef(null),C=Xr(),y=Pm(t),b=h.useRef(),x=Qa({state:a,props:t}),w=h.useCallback(function(L){return g.current[y.getItemId(L)]},[y]);jm(o,a,[u,d,f,m],i);var E=Lm({menuElement:p.current,highlightedIndex:d,isOpen:u,itemRefs:g,scrollIntoView:r,getItemNodeFromIndex:w});tc({props:t,state:a}),h.useEffect(function(){var L=Vn(t,"isOpen");L&&I.current&&I.current.focus()},[]),h.useEffect(function(){C||(b.current=n.length)});var j=km(i,h.useCallback(function(){x.current.state.isOpen&&c({type:Dr,selectItem:!1})},[c,x]),h.useMemo(function(){return[p,_,I]},[p.current,_.current,I.current])),N=ec("getInputProps","getMenuProps");h.useEffect(function(){u||(g.current={})},[u]),h.useEffect(function(){var L;!u||!(i!=null&&i.document)||!(I!=null&&(L=I.current)!=null&&L.focus)||i.document.activeElement!==I.current&&I.current.focus()},[u,i]);var U=h.useMemo(function(){return{ArrowDown:function(M){M.preventDefault(),c({type:ti,altKey:M.altKey})},ArrowUp:function(M){M.preventDefault(),c({type:ni,altKey:M.altKey})},Home:function(M){x.current.state.isOpen&&(M.preventDefault(),c({type:oi}))},End:function(M){x.current.state.isOpen&&(M.preventDefault(),c({type:ii}))},Escape:function(M){var F=x.current.state;(F.isOpen||F.inputValue||F.selectedItem||F.highlightedIndex>-1)&&(M.preventDefault(),c({type:ri}))},Enter:function(M){var F=x.current.state;!F.isOpen||M.which===229||(M.preventDefault(),c({type:ci}))},PageUp:function(M){x.current.state.isOpen&&(M.preventDefault(),c({type:si}))},PageDown:function(M){x.current.state.isOpen&&(M.preventDefault(),c({type:ai}))}}},[c,x]),W=h.useCallback(function(L){return le({id:y.labelId,htmlFor:y.inputId},L)},[y]),z=h.useCallback(function(L,M){var F,R=L===void 0?{}:L,X=R.onMouseLeave,G=R.refKey,K=G===void 0?"ref":G,Z=R.ref,q=Lt(R,Jm),ae=M===void 0?{}:M,A=ae.suppressRefError,pe=A===void 0?!1:A;return N("getMenuProps",pe,K,p),le((F={},F[K]=bn(Z,function($){p.current=$}),F.id=y.menuId,F.role="listbox",F["aria-labelledby"]=q&&q["aria-label"]?void 0:""+y.labelId,F.onMouseLeave=Le(X,function(){c({type:rc})}),F),q)},[c,N,y]),Y=h.useCallback(function(L){var M,F,R=L===void 0?{}:L,X=R.item,G=R.index,K=R.refKey,Z=K===void 0?"ref":K,q=R.ref,ae=R.onMouseMove,A=R.onMouseDown,pe=R.onClick;R.onPress;var $=R.disabled,Ie=Lt(R,zm);$!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Pe=x.current,He=Pe.props,Fe=Pe.state,me=Dm(X,G,He.items,"Pass either item or index to getItemProps!"),gt=me[0],Ue=me[1],rt=He.isItemDisabled(gt,Ue),vt="onClick",yt=pe,Be=function(){j.isTouchEnd||Ue===Fe.highlightedIndex||(E.current=!1,c({type:oc,index:Ue,disabled:rt}))},Ke=function(){c({type:di,index:Ue})},Me=function(It){return It.preventDefault()};return le((M={},M[Z]=bn(q,function(Oe){Oe&&(g.current[y.getItemId(Ue)]=Oe)}),M["aria-disabled"]=rt,M["aria-selected"]=Ue===Fe.highlightedIndex,M.id=y.getItemId(Ue),M.role="option",M),!rt&&(F={},F[vt]=Le(yt,Ke),F),{onMouseMove:Le(ae,Be),onMouseDown:Le(A,Me)},Ie)},[c,y,x,j,E]),ee=h.useCallback(function(L){var M,F=L===void 0?{}:L,R=F.onClick;F.onPress;var X=F.refKey,G=X===void 0?"ref":X,K=F.ref,Z=Lt(F,Xm),q=x.current.state,ae=function(){c({type:ic})};return le((M={},M[G]=bn(K,function(A){_.current=A}),M["aria-controls"]=y.menuId,M["aria-expanded"]=q.isOpen,M.id=y.toggleButtonId,M.tabIndex=-1,M),!Z.disabled&&le({},{onClick:Le(R,ae)}),Z)},[c,x,y]),B=h.useCallback(function(L,M){var F,R=L===void 0?{}:L,X=R.onKeyDown,G=R.onChange,K=R.onInput,Z=R.onBlur;R.onChangeText;var q=R.onClick,ae=R.refKey,A=ae===void 0?"ref":ae,pe=R.ref,$=Lt(R,Gm),Ie=M===void 0?{}:M,Pe=Ie.suppressRefError,He=Pe===void 0?!1:Pe;N("getInputProps",He,A,I);var Fe=x.current.state,me=function(Me){var Oe=Ao(Me);Oe&&U[Oe]&&U[Oe](Me)},gt=function(Me){c({type:li,inputValue:Me.target.value})},Ue=function(Me){if(i!=null&&i.document&&Fe.isOpen&&!j.isMouseDown){var Oe=Me.relatedTarget===null&&i.document.activeElement!==i.document.body;c({type:Dr,selectItem:!Oe})}},rt=function(){c({type:ui})},vt="onChange",yt={};if(!$.disabled){var Be;yt=(Be={},Be[vt]=Le(G,K,gt),Be.onKeyDown=Le(X,me),Be.onBlur=Le(Z,Ue),Be.onClick=Le(q,rt),Be)}return le((F={},F[A]=bn(pe,function(Ke){I.current=Ke}),F["aria-activedescendant"]=Fe.isOpen&&Fe.highlightedIndex>-1?y.getItemId(Fe.highlightedIndex):"",F["aria-autocomplete"]="list",F["aria-controls"]=y.menuId,F["aria-expanded"]=Fe.isOpen,F["aria-labelledby"]=$&&$["aria-label"]?void 0:y.labelId,F.autoComplete="off",F.id=y.inputId,F.role="combobox",F.value=Fe.inputValue,F),yt,$)},[c,y,i,U,x,j,N]),se=h.useCallback(function(){c({type:sc})},[c]),ne=h.useCallback(function(){c({type:cc})},[c]),Q=h.useCallback(function(){c({type:ac})},[c]),de=h.useCallback(function(L){c({type:lc,highlightedIndex:L})},[c]),fe=h.useCallback(function(L){c({type:pi,selectedItem:L})},[c]),S=h.useCallback(function(L){c({type:uc,inputValue:L})},[c]),D=h.useCallback(function(){c({type:dc})},[c]);return{getItemProps:Y,getLabelProps:W,getMenuProps:z,getInputProps:B,getToggleButtonProps:ee,toggleMenu:se,openMenu:Q,closeMenu:ne,setHighlightedIndex:de,setInputValue:S,selectItem:fe,reset:D,highlightedIndex:d,isOpen:u,selectedItem:f,inputValue:m}}Cr.stateReducer,Cr.itemToKey,Cr.environment,k.array,k.array,k.array,k.func,k.number,k.number,k.number,k.func,k.func,k.string,k.string;$n.itemToKey,$n.stateReducer,$n.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 Ym="_comboboxContainer_9s7ov_1",Zm="_label_9s7ov_8",Qm="_inputContainer_9s7ov_12",eh="_input_9s7ov_12",th="_toggleButton_9s7ov_33",nh="_menu_9s7ov_39",rh="_menuItem_9s7ov_54",oh="_highlighted_9s7ov_61",ih="_selected_9s7ov_65",sh="_hidden_9s7ov_69",jt={comboboxContainer:Ym,label:Zm,inputContainer:Qm,input:eh,toggleButton:th,menu:nh,menuItem:rh,highlighted:oh,selected:ih,hidden:sh};function ah(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function mc({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:i,style:o}){const[s,a]=h.useState(e),c=h.useRef(null);h.useEffect(()=>a(e),[e]);const u=w=>{a(e.filter(ah(w)))},{isOpen:d,getToggleButtonProps:f,getMenuProps:m,getInputProps:p,highlightedIndex:g,getItemProps:I,setInputValue:_}=mi({items:s,selectedItem:t?e.find(w=>w.value===t):null,itemToString:w=>(w==null?void 0:w.label)||"",onInputValueChange:({inputValue:w})=>u(w),onSelectedItemChange:({selectedItem:w})=>{var E;(E=c.current)==null||E.blur(),n(w)}}),C=()=>{_(""),a(e)},y=()=>C(),b=h.useMemo(()=>{var w;return(w=e.find(E=>E.value===t))==null?void 0:w.label},[e,t]),x=()=>_(b||"");return l.jsxs("div",{style:{position:"relative",...o},children:[l.jsx("div",{className:jt.comboboxContainer,children:l.jsxs("div",{className:jt.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:i,placeholder:b||r,className:jt.input,...p({onFocus:y,onBlur:x,ref:c})}),l.jsx("button",{style:{border:"none"},disabled:i,"aria-label":"toggle menu",className:jt.toggleButton,type:"button",...f(),children:d?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${jt.menu} ${d&&e.length?"":jt.hidden}`,...m(),children:d&&s.map((w,E)=>l.jsx("li",{className:`${jt.menuItem} ${g===E?jt.highlighted:""} ${t===(w==null?void 0:w.value)?jt.selected:""}`,...I({item:w,index:E}),children:l.jsx("span",{children:w.label})},w.id))})]})}function ch({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r}){var p;const{configureState:i,selectedObjectName:o,setConfigureState:s}=Tt(),[a,c]=h.useState(!0),u=h.useMemo(()=>{var g,I;return((I=(g=i==null?void 0:i.read)==null?void 0:g.selectedValueMappings)==null?void 0:I[n])||{}},[(p=i==null?void 0:i.read)==null?void 0:p.selectedValueMappings,n]),d=h.useMemo(()=>u==null?void 0:u[e.mappedValue],[u,e.mappedValue]);h.useEffect(()=>{c(!1)},[e,s,o,d,i]);const f=h.useMemo(()=>r.map(g=>({id:g.value,label:g.displayValue,value:g.value})),[r]),m=h.useMemo(()=>l.jsx(mc,{disabled:a,items:f,selectedValue:d||null,onSelectedItemChange:g=>{if(Object.values(u).some(I=>I===g.value)){console.error(`Each ${n} must be mapped to a unique value`);return}t({target:{name:e.mappedValue,value:g==null?void 0:g.value,fieldName:n}})},placeholder:"Please select one"}),[a,f,d,u,t,e.mappedValue,n]);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[l.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:l.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),m]},e.mappedValue)}function lh(){const{fieldMapping:e}=nt(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Tt(),{isError:i,removeError:o}=St(),s=c=>{const{value:u,name:d,fieldName:f}=c.target;u&&(t&&Zf(t,r,d,u,f),i(_e.MAPPING,d)&&o(_e.MAPPING,d))},a=h.useMemo(()=>t&&e?Object.values(e[t]||{}).flat().filter(u=>u.fieldName):[],[t,e]);return a!=null&&a.length?l.jsx(l.Fragment,{children:a.map(c=>{var u,d,f,m,p,g,I,_,C,y,b,x,w;return c.fieldName&&["singleSelect","multiSelect"].includes((f=(d=(u=n==null?void 0:n.read)==null?void 0:u.allFieldsMetadata)==null?void 0:d[c.fieldName])==null?void 0:f.valueType)&&((g=(p=(m=n==null?void 0:n.read)==null?void 0:m.allFieldsMetadata)==null?void 0:p[c.fieldName])!=null&&g.values)&&((I=c==null?void 0:c.mappedValues)==null?void 0:I.length)===((b=(y=(C=(_=n==null?void 0:n.read)==null?void 0:_.allFieldsMetadata)==null?void 0:C[c.fieldName])==null?void 0:y.values)==null?void 0:b.length)?l.jsxs(l.Fragment,{children:[l.jsx(Fn,{string:`Map the values for ${c.fieldName}`}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.jsx(Wo,{id:c.fieldName,children:(x=c==null?void 0:c.mappedValues)==null?void 0:x.map(E=>{var j,N,U;return l.jsx(ch,{allValueOptions:((U=(N=(j=n==null?void 0:n.read)==null?void 0:j.allFieldsMetadata)==null?void 0:N[c.fieldName])==null?void 0:U.values)||[],mappedValue:E,onSelectChange:s,fieldName:(c==null?void 0:c.fieldName)||""},`${E.mappedValue}-${c.fieldName}`)})},c.fieldName)})]}):(console.error("invalid configuration for mapping values found:",c,(w=n==null?void 0:n.read)==null?void 0:w.allFieldsMetadata),null)})}):null}const Sn=Math.min,pn=Math.max,Fr=Math.round,yr=Math.floor,Yt=e=>({x:e,y:e}),uh={left:"right",right:"left",bottom:"top",top:"bottom"},dh={start:"end",end:"start"};function Fo(e,t,n){return pn(e,Sn(t,n))}function Gn(e,t){return typeof e=="function"?e(t):e}function vn(e){return e.split("-")[0]}function Yn(e){return e.split("-")[1]}function hc(e){return e==="x"?"y":"x"}function hi(e){return e==="y"?"height":"width"}function Tn(e){return["top","bottom"].includes(vn(e))?"y":"x"}function gi(e){return hc(Tn(e))}function ph(e,t,n){n===void 0&&(n=!1);const r=Yn(e),i=gi(e),o=hi(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Mr(s)),[s,Mr(s)]}function fh(e){const t=Mr(e);return[Mo(e),t,Mo(t)]}function Mo(e){return e.replace(/start|end/g,t=>dh[t])}function mh(e,t,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?o:s;default:return[]}}function hh(e,t,n,r){const i=Yn(e);let o=mh(vn(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Mo)))),o}function Mr(e){return e.replace(/left|right|bottom|top/g,t=>uh[t])}function gh(e){return{top:0,right:0,bottom:0,left:0,...e}}function gc(e){return typeof e!="number"?gh(e):{top:e,right:e,bottom:e,left:e}}function kr(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function vs(e,t,n){let{reference:r,floating:i}=e;const o=Tn(t),s=gi(t),a=hi(s),c=vn(t),u=o==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,m=r[a]/2-i[a]/2;let p;switch(c){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(Yn(t)){case"start":p[s]-=m*(n&&u?-1:1);break;case"end":p[s]+=m*(n&&u?-1:1);break}return p}const vh=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:f}=vs(u,r,c),m=r,p={},g=0;for(let I=0;I<a.length;I++){const{name:_,fn:C}=a[I],{x:y,y:b,data:x,reset:w}=await C({x:d,y:f,initialPlacement:r,placement:m,strategy:i,middlewareData:p,rects:u,platform:s,elements:{reference:e,floating:t}});d=y??d,f=b??f,p={...p,[_]:{...p[_],...x}},w&&g<=50&&(g++,typeof w=="object"&&(w.placement&&(m=w.placement),w.rects&&(u=w.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):w.rects),{x:d,y:f}=vs(u,m,c)),I=-1)}return{x:d,y:f,placement:m,strategy:i,middlewareData:p}};async function vc(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=Gn(t,e),g=gc(p),_=a[m?f==="floating"?"reference":"floating":f],C=kr(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(_)))==null||n?_:_.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),y=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,b=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),x=await(o.isElement==null?void 0:o.isElement(b))?await(o.getScale==null?void 0:o.getScale(b))||{x:1,y:1}:{x:1,y:1},w=kr(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:b,strategy:c}):y);return{top:(C.top-w.top+g.top)/x.y,bottom:(w.bottom-C.bottom+g.bottom)/x.y,left:(C.left-w.left+g.left)/x.x,right:(w.right-C.right+g.right)/x.x}}const yh=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=Gn(e,t)||{};if(u==null)return{};const f=gc(d),m={x:n,y:r},p=gi(i),g=hi(p),I=await s.getDimensions(u),_=p==="y",C=_?"top":"left",y=_?"bottom":"right",b=_?"clientHeight":"clientWidth",x=o.reference[g]+o.reference[p]-m[p]-o.floating[g],w=m[p]-o.reference[p],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let j=E?E[b]:0;(!j||!await(s.isElement==null?void 0:s.isElement(E)))&&(j=a.floating[b]||o.floating[g]);const N=x/2-w/2,U=j/2-I[g]/2-1,W=Sn(f[C],U),z=Sn(f[y],U),Y=W,ee=j-I[g]-z,B=j/2-I[g]/2+N,se=Fo(Y,B,ee),ne=!c.arrow&&Yn(i)!=null&&B!==se&&o.reference[g]/2-(B<Y?W:z)-I[g]/2<0,Q=ne?B<Y?B-Y:B-ee:0;return{[p]:m[p]+Q,data:{[p]:se,centerOffset:B-se-Q,...ne&&{alignmentOffset:Q}},reset:ne}}}),Ih=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:I=!0,..._}=Gn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const C=vn(i),y=Tn(a),b=vn(a)===a,x=await(c.isRTL==null?void 0:c.isRTL(u.floating)),w=m||(b||!I?[Mr(a)]:fh(a)),E=g!=="none";!m&&E&&w.push(...hh(a,I,g,x));const j=[a,...w],N=await vc(t,_),U=[];let W=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&U.push(N[C]),f){const B=ph(i,s,x);U.push(N[B[0]],N[B[1]])}if(W=[...W,{placement:i,overflows:U}],!U.every(B=>B<=0)){var z,Y;const B=(((z=o.flip)==null?void 0:z.index)||0)+1,se=j[B];if(se)return{data:{index:B,overflows:W},reset:{placement:se}};let ne=(Y=W.filter(Q=>Q.overflows[0]<=0).sort((Q,de)=>Q.overflows[1]-de.overflows[1])[0])==null?void 0:Y.placement;if(!ne)switch(p){case"bestFit":{var ee;const Q=(ee=W.filter(de=>{if(E){const fe=Tn(de.placement);return fe===y||fe==="y"}return!0}).map(de=>[de.placement,de.overflows.filter(fe=>fe>0).reduce((fe,S)=>fe+S,0)]).sort((de,fe)=>de[1]-fe[1])[0])==null?void 0:ee[0];Q&&(ne=Q);break}case"initialPlacement":ne=a;break}if(i!==ne)return{reset:{placement:ne}}}return{}}}};async function wh(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=vn(n),a=Yn(n),c=Tn(n)==="y",u=["left","top"].includes(s)?-1:1,d=o&&c?-1:1,f=Gn(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:g}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof g=="number"&&(p=a==="end"?g*-1:g),c?{x:p*d,y:m*u}:{x:m*u,y:p*d}}const _h=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,c=await wh(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:s}}}}},bh=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:_=>{let{x:C,y}=_;return{x:C,y}}},...c}=Gn(e,t),u={x:n,y:r},d=await vc(t,c),f=Tn(vn(i)),m=hc(f);let p=u[m],g=u[f];if(o){const _=m==="y"?"top":"left",C=m==="y"?"bottom":"right",y=p+d[_],b=p-d[C];p=Fo(y,p,b)}if(s){const _=f==="y"?"top":"left",C=f==="y"?"bottom":"right",y=g+d[_],b=g-d[C];g=Fo(y,g,b)}const I=a.fn({...t,[m]:p,[f]:g});return{...I,data:{x:I.x-n,y:I.y-r,enabled:{[m]:o,[f]:s}}}}}};function Gr(){return typeof window<"u"}function Mn(e){return yc(e)?(e.nodeName||"").toLowerCase():"#document"}function ct(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rt(e){var t;return(t=(yc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function yc(e){return Gr()?e instanceof Node||e instanceof ct(e).Node:!1}function Ct(e){return Gr()?e instanceof Element||e instanceof ct(e).Element:!1}function Nt(e){return Gr()?e instanceof HTMLElement||e instanceof ct(e).HTMLElement:!1}function ys(e){return!Gr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ct(e).ShadowRoot}function Zn(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Ot(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function xh(e){return["table","td","th"].includes(Mn(e))}function Yr(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function vi(e){const t=yi(),n=Ct(e)?Ot(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Ch(e){let t=Zt(e);for(;Nt(t)&&!Rn(t);){if(vi(t))return t;if(Yr(t))return null;t=Zt(t)}return null}function yi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Rn(e){return["html","body","#document"].includes(Mn(e))}function Ot(e){return ct(e).getComputedStyle(e)}function Zr(e){return Ct(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Zt(e){if(Mn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ys(e)&&e.host||Rt(e);return ys(t)?t.host:t}function Ic(e){const t=Zt(e);return Rn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Nt(t)&&Zn(t)?t:Ic(t)}function Jn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Ic(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=ct(i);if(o){const a=ko(s);return t.concat(s,s.visualViewport||[],Zn(i)?i:[],a&&n?Jn(a):[])}return t.concat(i,Jn(i,[],n))}function ko(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function wc(e){const t=Ot(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Nt(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=Fr(n)!==o||Fr(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function Ii(e){return Ct(e)?e:e.contextElement}function xn(e){const t=Ii(e);if(!Nt(t))return Yt(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=wc(t);let s=(o?Fr(n.width):n.width)/r,a=(o?Fr(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const Oh=Yt(0);function _c(e){const t=ct(e);return!yi()||!t.visualViewport?Oh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Eh(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ct(e)?!1:t}function yn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=Ii(e);let s=Yt(1);t&&(r?Ct(r)&&(s=xn(r)):s=xn(e));const a=Eh(o,n,r)?_c(o):Yt(0);let c=(i.left+a.x)/s.x,u=(i.top+a.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const m=ct(o),p=r&&Ct(r)?ct(r):r;let g=m,I=ko(g);for(;I&&r&&p!==g;){const _=xn(I),C=I.getBoundingClientRect(),y=Ot(I),b=C.left+(I.clientLeft+parseFloat(y.paddingLeft))*_.x,x=C.top+(I.clientTop+parseFloat(y.paddingTop))*_.y;c*=_.x,u*=_.y,d*=_.x,f*=_.y,c+=b,u+=x,g=ct(I),I=ko(g)}}return kr({width:d,height:f,x:c,y:u})}function Nh(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=Rt(r),a=t?Yr(t.floating):!1;if(r===s||a&&o)return n;let c={scrollLeft:0,scrollTop:0},u=Yt(1);const d=Yt(0),f=Nt(r);if((f||!f&&!o)&&((Mn(r)!=="body"||Zn(s))&&(c=Zr(r)),Nt(r))){const m=yn(r);u=xn(r),d.x=m.x+r.clientLeft,d.y=m.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function Sh(e){return Array.from(e.getClientRects())}function jo(e,t){const n=Zr(e).scrollLeft;return t?t.left+n:yn(Rt(e)).left+n}function Th(e){const t=Rt(e),n=Zr(e),r=e.ownerDocument.body,i=pn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=pn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+jo(e);const a=-n.scrollTop;return Ot(r).direction==="rtl"&&(s+=pn(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function Rh(e,t){const n=ct(e),r=Rt(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,c=0;if(i){o=i.width,s=i.height;const u=yi();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a,y:c}}function Ah(e,t){const n=yn(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Nt(e)?xn(e):Yt(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,c=i*o.x,u=r*o.y;return{width:s,height:a,x:c,y:u}}function Is(e,t,n){let r;if(t==="viewport")r=Rh(e,n);else if(t==="document")r=Th(Rt(e));else if(Ct(t))r=Ah(t,n);else{const i=_c(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return kr(r)}function bc(e,t){const n=Zt(e);return n===t||!Ct(n)||Rn(n)?!1:Ot(n).position==="fixed"||bc(n,t)}function Ph(e,t){const n=t.get(e);if(n)return n;let r=Jn(e,[],!1).filter(a=>Ct(a)&&Mn(a)!=="body"),i=null;const o=Ot(e).position==="fixed";let s=o?Zt(e):e;for(;Ct(s)&&!Rn(s);){const a=Ot(s),c=vi(s);!c&&a.position==="fixed"&&(i=null),(o?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Zn(s)&&!c&&bc(e,s))?r=r.filter(d=>d!==s):i=a,s=Zt(s)}return t.set(e,r),r}function Dh(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Yr(t)?[]:Ph(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((u,d)=>{const f=Is(t,d,i);return u.top=pn(f.top,u.top),u.right=Sn(f.right,u.right),u.bottom=Sn(f.bottom,u.bottom),u.left=pn(f.left,u.left),u},Is(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Fh(e){const{width:t,height:n}=wc(e);return{width:t,height:n}}function Mh(e,t,n){const r=Nt(t),i=Rt(t),o=n==="fixed",s=yn(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Yt(0);if(r||!r&&!o)if((Mn(t)!=="body"||Zn(i))&&(a=Zr(t)),r){const p=yn(t,!0,o,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else i&&(c.x=jo(i));let u=0,d=0;if(i&&!r&&!o){const p=i.getBoundingClientRect();d=p.top+a.scrollTop,u=p.left+a.scrollLeft-jo(i,p)}const f=s.left+a.scrollLeft-c.x-u,m=s.top+a.scrollTop-c.y-d;return{x:f,y:m,width:s.width,height:s.height}}function vo(e){return Ot(e).position==="static"}function ws(e,t){if(!Nt(e)||Ot(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Rt(e)===n&&(n=n.ownerDocument.body),n}function xc(e,t){const n=ct(e);if(Yr(e))return n;if(!Nt(e)){let i=Zt(e);for(;i&&!Rn(i);){if(Ct(i)&&!vo(i))return i;i=Zt(i)}return n}let r=ws(e,t);for(;r&&xh(r)&&vo(r);)r=ws(r,t);return r&&Rn(r)&&vo(r)&&!vi(r)?n:r||Ch(e)||n}const kh=async function(e){const t=this.getOffsetParent||xc,n=this.getDimensions,r=await n(e.floating);return{reference:Mh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function jh(e){return Ot(e).direction==="rtl"}const Lh={convertOffsetParentRelativeRectToViewportRelativeRect:Nh,getDocumentElement:Rt,getClippingRect:Dh,getOffsetParent:xc,getElementRects:kh,getClientRects:Sh,getDimensions:Fh,getScale:xn,isElement:Ct,isRTL:jh};function Kh(e,t){let n=null,r;const i=Rt(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const{left:u,top:d,width:f,height:m}=e.getBoundingClientRect();if(a||t(),!f||!m)return;const p=yr(d),g=yr(i.clientWidth-(u+f)),I=yr(i.clientHeight-(d+m)),_=yr(u),y={rootMargin:-p+"px "+-g+"px "+-I+"px "+-_+"px",threshold:pn(0,Sn(1,c))||1};let b=!0;function x(w){const E=w[0].intersectionRatio;if(E!==c){if(!b)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(x,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(x,y)}n.observe(e)}return s(!0),o}function $h(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Ii(e),d=i||o?[...u?Jn(u):[],...Jn(t)]:[];d.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),o&&C.addEventListener("resize",n)});const f=u&&a?Kh(u,n):null;let m=-1,p=null;s&&(p=new ResizeObserver(C=>{let[y]=C;y&&y.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=p)==null||b.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let g,I=c?yn(e):null;c&&_();function _(){const C=yn(e);I&&(C.x!==I.x||C.y!==I.y||C.width!==I.width||C.height!==I.height)&&n(),I=C,g=requestAnimationFrame(_)}return n(),()=>{var C;d.forEach(y=>{i&&y.removeEventListener("scroll",n),o&&y.removeEventListener("resize",n)}),f==null||f(),(C=p)==null||C.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const Vh=_h,Hh=bh,Uh=Ih,Bh=yh,_s=(e,t,n)=>{const r=new Map,i={platform:Lh,...n},o={...i.platform,_c:r};return vh(e,t,{...i,platform:o})};/*
43
+ */var rs;function qf(){return rs||(rs=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),a=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),f=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),v=!1,h=!1,w=!1,C=!1,y=!1,b;b=Symbol.for("react.module.reference");function x(K){return!!(typeof K=="string"||typeof K=="function"||K===n||K===i||y||K===r||K===u||K===d||C||K===m||v||h||w||typeof K=="object"&&K!==null&&(K.$$typeof===f||K.$$typeof===p||K.$$typeof===o||K.$$typeof===s||K.$$typeof===c||K.$$typeof===b||K.getModuleId!==void 0))}function _(K){if(typeof K=="object"&&K!==null){var we=K.$$typeof;switch(we){case e:var Pe=K.type;switch(Pe){case n:case i:case r:case u:case d:return Pe;default:var He=Pe&&Pe.$$typeof;switch(He){case a:case s:case c:case f:case p:case o:return He;default:return we}}case t:return we}}}var E=s,D=o,N=e,B=c,W=n,q=f,X=p,ee=t,$=i,ie=r,te=u,G=d,le=!1,pe=!1;function S(K){return le||(le=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function M(K){return pe||(pe=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function L(K){return _(K)===s}function k(K){return _(K)===o}function F(K){return typeof K=="object"&&K!==null&&K.$$typeof===e}function A(K){return _(K)===c}function Y(K){return _(K)===n}function Z(K){return _(K)===f}function V(K){return _(K)===p}function Q(K){return _(K)===t}function J(K){return _(K)===i}function ae(K){return _(K)===r}function P(K){return _(K)===u}function fe(K){return _(K)===d}ye.ContextConsumer=E,ye.ContextProvider=D,ye.Element=N,ye.ForwardRef=B,ye.Fragment=W,ye.Lazy=q,ye.Memo=X,ye.Portal=ee,ye.Profiler=$,ye.StrictMode=ie,ye.Suspense=te,ye.SuspenseList=G,ye.isAsyncMode=S,ye.isConcurrentMode=M,ye.isContextConsumer=L,ye.isContextProvider=k,ye.isElement=F,ye.isForwardRef=A,ye.isFragment=Y,ye.isLazy=Z,ye.isMemo=V,ye.isPortal=Q,ye.isProfiler=J,ye.isStrictMode=ae,ye.isSuspense=P,ye.isSuspenseList=fe,ye.isValidElementType=x,ye.typeOf=_}()),ye}process.env.NODE_ENV==="production"?Oo.exports=Wf():Oo.exports=qf();var os=Oo.exports;const is=e=>typeof e=="object"&&e!=null&&e.nodeType===1,ss=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",ho=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return ss(n.overflowY,t)||ss(n.overflowX,t)||(r=>{const i=(o=>{if(!o.ownerDocument||!o.ownerDocument.defaultView)return null;try{return o.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!i&&(i.clientHeight<r.scrollHeight||i.clientWidth<r.scrollWidth)})(e)}return!1},vr=(e,t,n,r,i,o,s,a)=>o<e&&s>t||o>e&&s<t?0:o<=e&&a<=n||s>=t&&a>=n?o-e-r:s>t&&a<n||o<e&&a>n?s-t+i:0,Jf=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},zf=(e,t)=>{var n,r,i,o;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:u,skipOverflowHiddenElements:d}=t,p=typeof u=="function"?u:te=>te!==u;if(!is(e))throw new TypeError("Invalid target");const f=document.scrollingElement||document.documentElement,m=[];let v=e;for(;is(v)&&p(v);){if(v=Jf(v),v===f){m.push(v);break}v!=null&&v===document.body&&ho(v)&&!ho(document.documentElement)||v!=null&&ho(v,d)&&m.push(v)}const h=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,w=(o=(i=window.visualViewport)==null?void 0:i.height)!=null?o:innerHeight,{scrollX:C,scrollY:y}=window,{height:b,width:x,top:_,right:E,bottom:D,left:N}=e.getBoundingClientRect(),{top:B,right:W,bottom:q,left:X}=(te=>{const G=window.getComputedStyle(te);return{top:parseFloat(G.scrollMarginTop)||0,right:parseFloat(G.scrollMarginRight)||0,bottom:parseFloat(G.scrollMarginBottom)||0,left:parseFloat(G.scrollMarginLeft)||0}})(e);let ee=a==="start"||a==="nearest"?_-B:a==="end"?D+q:_+b/2-B+q,$=c==="center"?N+x/2-X+W:c==="end"?E+W:N-X;const ie=[];for(let te=0;te<m.length;te++){const G=m[te],{height:le,width:pe,top:S,right:M,bottom:L,left:k}=G.getBoundingClientRect();if(s==="if-needed"&&_>=0&&N>=0&&D<=w&&E<=h&&_>=S&&D<=L&&N>=k&&E<=M)return ie;const F=getComputedStyle(G),A=parseInt(F.borderLeftWidth,10),Y=parseInt(F.borderTopWidth,10),Z=parseInt(F.borderRightWidth,10),V=parseInt(F.borderBottomWidth,10);let Q=0,J=0;const ae="offsetWidth"in G?G.offsetWidth-G.clientWidth-A-Z:0,P="offsetHeight"in G?G.offsetHeight-G.clientHeight-Y-V:0,fe="offsetWidth"in G?G.offsetWidth===0?0:pe/G.offsetWidth:0,K="offsetHeight"in G?G.offsetHeight===0?0:le/G.offsetHeight:0;if(f===G)Q=a==="start"?ee:a==="end"?ee-w:a==="nearest"?vr(y,y+w,w,Y,V,y+ee,y+ee+b,b):ee-w/2,J=c==="start"?$:c==="center"?$-h/2:c==="end"?$-h:vr(C,C+h,h,A,Z,C+$,C+$+x,x),Q=Math.max(0,Q+y),J=Math.max(0,J+C);else{Q=a==="start"?ee-S-Y:a==="end"?ee-L+V+P:a==="nearest"?vr(S,L,le,Y,V+P,ee,ee+b,b):ee-(S+le/2)+P/2,J=c==="start"?$-k-A:c==="center"?$-(k+pe/2)+ae/2:c==="end"?$-M+Z+ae:vr(k,M,pe,A,Z+ae,$,$+x,x);const{scrollLeft:we,scrollTop:Pe}=G;Q=K===0?0:Math.max(0,Math.min(Pe+Q/K,G.scrollHeight-le/K+P)),J=fe===0?0:Math.max(0,Math.min(we+J/fe,G.scrollWidth-pe/fe+ae)),ee+=Pe-Q,$+=we-J}ie.push({el:G,top:Q,left:J})}return ie};var On=function(){return On=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},On.apply(this,arguments)};var Xf=0;function as(e){return typeof e=="function"?e:at}function at(){}function Ta(e,t){if(e){var n=zf(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var i=r.el,o=r.top,s=r.left;i.scrollTop=o,i.scrollLeft=s})}}function cs(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Xo(e,t){var n;function r(){n&&clearTimeout(n)}function i(){for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return i.cancel=r,i}function Le(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(o)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function xn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(i){typeof i=="function"?i(r):i&&(i.current=r)})}}function Ra(){return String(Xf++)}function Gf(e){var t=e.isOpen,n=e.resultCount,r=e.previousResultCount;return t?n?n!==r?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 ls(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Aa(e){return typeof e.type=="string"}function Pa(e){return e.props}function Yf(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var Zf=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function yr(e){e===void 0&&(e={});var t={};return Zf.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function Sr(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=Tr(t,r)?t[r]:e[r],n},{})}function Tr(e,t){return e[t]!==void 0}function Eo(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Qf(e){return Object.prototype.toString.call(e)==="[object Object]"}function pn(e,t,n,r,i){var o=n.length;if(o===0)return-1;var s=o-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var a=e+t;a<0?a=s:a>s&&(a=0);var c=En(a,t<0,n,r,i);return c===-1?e>=o?-1:e:c}function En(e,t,n,r,i){i===void 0&&(i=!1);var o=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<o;a++)if(!r(n[a],a))return a;return i?En(t?o-1:0,t,n,r):-1}function Rr(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(cs(i,e,n)||r&&cs(i,n.document.activeElement,n))})}var Go=at;process.env.NODE_ENV!=="production"&&(Go=function(t,n,r){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(o){n[o]!==void 0&&r[o]===void 0?console.error('downshift: A component has changed the controlled prop "'+o+'" to be uncontrolled. '+i):n[o]===void 0&&r[o]!==void 0&&console.error('downshift: A component has changed the uncontrolled prop "'+o+'" to be controlled. '+i)})});var em=Xo(function(e){Da(e).textContent=""},500);function Da(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 Ma(e,t){if(!(!e||!t)){var n=Da(t);n.textContent=e,em(t)}}function tm(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Fa=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,ka=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,ja=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,xr=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Cr=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,La=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Va=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Ka=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,$a=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Ha=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Ua=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Ba=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Wa=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,No=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,qa=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Ja=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,za=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,nm=Object.freeze({__proto__:null,blurButton:qa,blurInput:Ua,changeInput:Ba,clickButton:No,clickItem:Ha,controlledPropUpdatedSelectedItem:Ja,itemMouseEnter:ja,keyDownArrowDown:Cr,keyDownArrowUp:xr,keyDownEnd:$a,keyDownEnter:Va,keyDownEscape:La,keyDownHome:Ka,keyDownSpaceButton:Wa,mouseUp:ka,touchEnd:za,unknown:Fa}),rm=["refKey","ref"],om=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],im=["onKeyDown","onBlur","onChange","onInput","onChangeText"],sm=["refKey","ref"],am=["onMouseMove","onMouseDown","onClick","onPress","index","item"],cm=function(){var e=function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+Ra(),o.menuId=o.props.menuId||o.id+"-menu",o.labelId=o.props.labelId||o.id+"-label",o.inputId=o.props.inputId||o.id+"-input",o.getItemId=o.props.getItemId||function(y){return o.id+"-item-"+y},o.items=[],o.itemCount=null,o.previousResultCount=0,o.timeoutIds=[],o.internalSetTimeout=function(y,b){var x=setTimeout(function(){o.timeoutIds=o.timeoutIds.filter(function(_){return _!==x}),y()},b);o.timeoutIds.push(x)},o.setItemCount=function(y){o.itemCount=y},o.unsetItemCount=function(){o.itemCount=null},o.isItemDisabled=function(y,b){var x=o.getItemNodeFromIndex(b);return x&&x.hasAttribute("disabled")},o.setHighlightedIndex=function(y,b){y===void 0&&(y=o.props.defaultHighlightedIndex),b===void 0&&(b={}),b=yr(b),o.internalSetState(ue({highlightedIndex:y},b))},o.clearSelection=function(y){o.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:o.props.defaultHighlightedIndex,isOpen:o.props.defaultIsOpen},y)},o.selectItem=function(y,b,x){b=yr(b),o.internalSetState(ue({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,selectedItem:y,inputValue:o.props.itemToString(y)},b),x)},o.selectItemAtIndex=function(y,b,x){var _=o.items[y];_!=null&&o.selectItem(_,b,x)},o.selectHighlightedItem=function(y,b){return o.selectItemAtIndex(o.getState().highlightedIndex,y,b)},o.internalSetState=function(y,b){var x,_,E={},D=typeof y=="function";return!D&&y.hasOwnProperty("inputValue")&&o.props.onInputValueChange(y.inputValue,ue({},o.getStateAndHelpers(),y)),o.setState(function(N){var B;N=o.getState(N);var W=D?y(N):y;W=o.props.stateReducer(N,W),x=W.hasOwnProperty("selectedItem");var q={};return x&&W.selectedItem!==N.selectedItem&&(_=W.selectedItem),(B=W).type||(B.type=Fa),Object.keys(W).forEach(function(X){N[X]!==W[X]&&(E[X]=W[X]),X!=="type"&&(W[X],Tr(o.props,X)||(q[X]=W[X]))}),D&&W.hasOwnProperty("inputValue")&&o.props.onInputValueChange(W.inputValue,ue({},o.getStateAndHelpers(),W)),q},function(){as(b)();var N=Object.keys(E).length>1;N&&o.props.onStateChange(E,o.getStateAndHelpers()),x&&o.props.onSelect(y.selectedItem,o.getStateAndHelpers()),_!==void 0&&o.props.onChange(_,o.getStateAndHelpers()),o.props.onUserAction(E,o.getStateAndHelpers())})},o.rootRef=function(y){return o._rootNode=y},o.getRootProps=function(y,b){var x,_=y===void 0?{}:y,E=_.refKey,D=E===void 0?"ref":E,N=_.ref,B=Lt(_,rm),W=b===void 0?{}:b,q=W.suppressRefError,X=q===void 0?!1:q;o.getRootProps.called=!0,o.getRootProps.refKey=D,o.getRootProps.suppressRefError=X;var ee=o.getState(),$=ee.isOpen;return ue((x={},x[D]=xn(N,o.rootRef),x.role="combobox",x["aria-expanded"]=$,x["aria-haspopup"]="listbox",x["aria-owns"]=$?o.menuId:void 0,x["aria-labelledby"]=o.labelId,x),B)},o.keyDownHandlers={ArrowDown:function(b){var x=this;if(b.preventDefault(),this.getState().isOpen){var _=b.shiftKey?5:1;this.moveHighlightedIndex(_,{type:Cr})}else this.internalSetState({isOpen:!0,type:Cr},function(){var E=x.getItemCount();if(E>0){var D=x.getState(),N=D.highlightedIndex,B=pn(N,1,{length:E},x.isItemDisabled,!0);x.setHighlightedIndex(B,{type:Cr})}})},ArrowUp:function(b){var x=this;if(b.preventDefault(),this.getState().isOpen){var _=b.shiftKey?-5:-1;this.moveHighlightedIndex(_,{type:xr})}else this.internalSetState({isOpen:!0,type:xr},function(){var E=x.getItemCount();if(E>0){var D=x.getState(),N=D.highlightedIndex,B=pn(N,-1,{length:E},x.isItemDisabled,!0);x.setHighlightedIndex(B,{type:xr})}})},Enter:function(b){if(b.which!==229){var x=this.getState(),_=x.isOpen,E=x.highlightedIndex;if(_&&E!=null){b.preventDefault();var D=this.items[E],N=this.getItemNodeFromIndex(E);if(D==null||N&&N.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Va})}}},Escape:function(b){b.preventDefault(),this.reset(ue({type:La},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=ue({},o.keyDownHandlers,{" ":function(b){b.preventDefault(),this.toggleMenu({type:Wa})}}),o.inputKeyDownHandlers=ue({},o.keyDownHandlers,{Home:function(b){var x=this.getState(),_=x.isOpen;if(_){b.preventDefault();var E=this.getItemCount();if(!(E<=0||!_)){var D=En(0,!1,{length:E},this.isItemDisabled);this.setHighlightedIndex(D,{type:Ka})}}},End:function(b){var x=this.getState(),_=x.isOpen;if(_){b.preventDefault();var E=this.getItemCount();if(!(E<=0||!_)){var D=En(E-1,!0,{length:E},this.isItemDisabled);this.setHighlightedIndex(D,{type:$a})}}}}),o.getToggleButtonProps=function(y){var b=y===void 0?{}:y,x=b.onClick;b.onPress;var _=b.onKeyDown,E=b.onKeyUp,D=b.onBlur,N=Lt(b,om),B=o.getState(),W=B.isOpen,q={onClick:Le(x,o.buttonHandleClick),onKeyDown:Le(_,o.buttonHandleKeyDown),onKeyUp:Le(E,o.buttonHandleKeyUp),onBlur:Le(D,o.buttonHandleBlur)},X=N.disabled?{}:q;return ue({type:"button",role:"button","aria-label":W?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},X,N)},o.buttonHandleKeyUp=function(y){y.preventDefault()},o.buttonHandleKeyDown=function(y){var b=Eo(y);o.buttonKeyDownHandlers[b]&&o.buttonKeyDownHandlers[b].call(o,y)},o.buttonHandleClick=function(y){if(y.preventDefault(),o.props.environment){var b=o.props.environment.document,x=b.body,_=b.activeElement;x&&x===_&&y.target.focus()}process.env.NODE_ENV==="test"?o.toggleMenu({type:No}):o.internalSetTimeout(function(){return o.toggleMenu({type:No})})},o.buttonHandleBlur=function(y){var b=y.target;o.internalSetTimeout(function(){if(!(o.isMouseDown||!o.props.environment)){var x=o.props.environment.document.activeElement;(x==null||x.id!==o.inputId)&&x!==b&&o.reset({type:qa})}})},o.getLabelProps=function(y){return ue({htmlFor:o.inputId,id:o.labelId},y)},o.getInputProps=function(y){var b=y===void 0?{}:y,x=b.onKeyDown,_=b.onBlur,E=b.onChange,D=b.onInput;b.onChangeText;var N=Lt(b,im),B,W={};B="onChange";var q=o.getState(),X=q.inputValue,ee=q.isOpen,$=q.highlightedIndex;if(!N.disabled){var ie;W=(ie={},ie[B]=Le(E,D,o.inputHandleChange),ie.onKeyDown=Le(x,o.inputHandleKeyDown),ie.onBlur=Le(_,o.inputHandleBlur),ie)}return ue({"aria-autocomplete":"list","aria-activedescendant":ee&&typeof $=="number"&&$>=0?o.getItemId($):void 0,"aria-controls":ee?o.menuId:void 0,"aria-labelledby":N&&N["aria-label"]?void 0:o.labelId,autoComplete:"off",value:X,id:o.inputId},W,N)},o.inputHandleKeyDown=function(y){var b=Eo(y);b&&o.inputKeyDownHandlers[b]&&o.inputKeyDownHandlers[b].call(o,y)},o.inputHandleChange=function(y){o.internalSetState({type:Ba,isOpen:!0,inputValue:y.target.value,highlightedIndex:o.props.defaultHighlightedIndex})},o.inputHandleBlur=function(){o.internalSetTimeout(function(){var y;if(!(o.isMouseDown||!o.props.environment)){var b=o.props.environment.document.activeElement,x=(b==null||(y=b.dataset)==null?void 0:y.toggle)&&o._rootNode&&o._rootNode.contains(b);x||o.reset({type:Ua})}})},o.menuRef=function(y){o._menuNode=y},o.getMenuProps=function(y,b){var x,_=y===void 0?{}:y,E=_.refKey,D=E===void 0?"ref":E,N=_.ref,B=Lt(_,sm),W=b===void 0?{}:b,q=W.suppressRefError,X=q===void 0?!1:q;return o.getMenuProps.called=!0,o.getMenuProps.refKey=D,o.getMenuProps.suppressRefError=X,ue((x={},x[D]=xn(N,o.menuRef),x.role="listbox",x["aria-labelledby"]=B&&B["aria-label"]?void 0:o.labelId,x.id=o.menuId,x),B)},o.getItemProps=function(y){var b,x=y===void 0?{}:y,_=x.onMouseMove,E=x.onMouseDown,D=x.onClick;x.onPress;var N=x.index,B=x.item,W=B===void 0?process.env.NODE_ENV==="production"?void 0:Yf("getItemProps","item"):B,q=Lt(x,am);N===void 0?(o.items.push(W),N=o.items.indexOf(W)):o.items[N]=W;var X="onClick",ee=D,$=(b={onMouseMove:Le(_,function(){N!==o.getState().highlightedIndex&&(o.setHighlightedIndex(N,{type:ja}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:Le(E,function(te){te.preventDefault()})},b[X]=Le(ee,function(){o.selectItemAtIndex(N,{type:Ha})}),b),ie=q.disabled?{onMouseDown:$.onMouseDown}:$;return ue({id:o.getItemId(N),role:"option","aria-selected":o.getState().highlightedIndex===N},ie,q)},o.clearItems=function(){o.items=[]},o.reset=function(y,b){y===void 0&&(y={}),y=yr(y),o.internalSetState(function(x){var _=x.selectedItem;return ue({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,inputValue:o.props.itemToString(_)},y)},b)},o.toggleMenu=function(y,b){y===void 0&&(y={}),y=yr(y),o.internalSetState(function(x){var _=x.isOpen;return ue({isOpen:!_},_&&{highlightedIndex:o.props.defaultHighlightedIndex},y)},function(){var x=o.getState(),_=x.isOpen,E=x.highlightedIndex;_&&o.getItemCount()>0&&typeof E=="number"&&o.setHighlightedIndex(E,y),as(b)()})},o.openMenu=function(y){o.internalSetState({isOpen:!0},y)},o.closeMenu=function(y){o.internalSetState({isOpen:!1},y)},o.updateStatus=Xo(function(){var y;if((y=o.props)!=null&&(y=y.environment)!=null&&y.document){var b=o.getState(),x=o.items[b.highlightedIndex],_=o.getItemCount(),E=o.props.getA11yStatusMessage(ue({itemToString:o.props.itemToString,previousResultCount:o.previousResultCount,resultCount:_,highlightedItem:x},b));o.previousResultCount=_,Ma(E,o.props.environment.document)}},200);var s=o.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,u=c===void 0?a:c,d=s.defaultIsOpen,p=s.initialIsOpen,f=p===void 0?d:p,m=s.initialInputValue,v=m===void 0?"":m,h=s.initialSelectedItem,w=h===void 0?null:h,C=o.getState({highlightedIndex:u,isOpen:f,inputValue:v,selectedItem:w});return C.selectedItem!=null&&o.props.initialInputValue===void 0&&(C.inputValue=o.props.itemToString(C.selectedItem)),o.state=C,o}Ff(n,t);var r=n.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach(function(o){clearTimeout(o)}),this.timeoutIds=[]},r.getState=function(o){return o===void 0&&(o=this.state),Sr(o,this.props)},r.getItemCount=function(){var o=this.items.length;return this.itemCount!=null?o=this.itemCount:this.props.itemCount!==void 0&&(o=this.props.itemCount),o},r.getItemNodeFromIndex=function(o){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(o)):null},r.scrollHighlightedItemIntoView=function(){{var o=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(o,this._menuNode)}},r.moveHighlightedIndex=function(o,s){var a=this.getItemCount(),c=this.getState(),u=c.highlightedIndex;if(a>0){var d=pn(u,o,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(d,s)}},r.getStateAndHelpers=function(){var o=this.getState(),s=o.highlightedIndex,a=o.inputValue,c=o.selectedItem,u=o.isOpen,d=this.props.itemToString,p=this.id,f=this.getRootProps,m=this.getToggleButtonProps,v=this.getLabelProps,h=this.getMenuProps,w=this.getInputProps,C=this.getItemProps,y=this.openMenu,b=this.closeMenu,x=this.toggleMenu,_=this.selectItem,E=this.selectItemAtIndex,D=this.selectHighlightedItem,N=this.setHighlightedIndex,B=this.clearSelection,W=this.clearItems,q=this.reset,X=this.setItemCount,ee=this.unsetItemCount,$=this.internalSetState;return{getRootProps:f,getToggleButtonProps:m,getLabelProps:v,getMenuProps:h,getInputProps:w,getItemProps:C,reset:q,openMenu:y,closeMenu:b,toggleMenu:x,selectItem:_,selectItemAtIndex:E,selectHighlightedItem:D,setHighlightedIndex:N,clearSelection:B,clearItems:W,setItemCount:X,unsetItemCount:ee,setState:$,itemToString:d,id:p,highlightedIndex:s,inputValue:a,isOpen:u,selectedItem:c}},r.componentDidMount=function(){var o=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&us(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){o.internalClearTimeouts()};else{var s=function(){o.isMouseDown=!0},a=function(m){o.isMouseDown=!1;var v=Rr(m.target,[o._rootNode,o._menuNode],o.props.environment);!v&&o.getState().isOpen&&o.reset({type:ka},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},c=function(){o.isTouchMove=!1},u=function(){o.isTouchMove=!0},d=function(m){var v=Rr(m.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!v&&o.getState().isOpen&&o.reset({type:za},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},p=this.props.environment;p.addEventListener("mousedown",s),p.addEventListener("mouseup",a),p.addEventListener("touchstart",c),p.addEventListener("touchmove",u),p.addEventListener("touchend",d),this.cleanup=function(){o.internalClearTimeouts(),o.updateStatus.cancel(),p.removeEventListener("mousedown",s),p.removeEventListener("mouseup",a),p.removeEventListener("touchstart",c),p.removeEventListener("touchmove",u),p.removeEventListener("touchend",d)}}},r.shouldScroll=function(o,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,u=s.highlightedIndex===void 0?o:s,d=u.highlightedIndex,p=c&&this.getState().isOpen&&!o.isOpen,f=c!==d;return p||f},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(Go(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&us(this._menuNode,this.getMenuProps)),Tr(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Ja,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,o)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var o=ls(this.props.children,at);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=ls(o(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&&lm(s,this.getRootProps),s;if(Aa(s))return g.cloneElement(s,this.getRootProps(Pa(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}(g.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Gf,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Qf(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:at,onInputValueChange:at,onUserAction:at,onChange:at,onSelect:at,onOuterClick:at,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:Ta},e.stateChangeTypes=nm,e}();process.env.NODE_ENV!=="production"&&(cm.propTypes={children:j.func,defaultHighlightedIndex:j.number,defaultIsOpen:j.bool,initialHighlightedIndex:j.number,initialSelectedItem:j.any,initialInputValue:j.string,initialIsOpen:j.bool,getA11yStatusMessage:j.func,itemToString:j.func,onChange:j.func,onSelect:j.func,onStateChange:j.func,onInputValueChange:j.func,onUserAction:j.func,onOuterClick:j.func,selectedItemChanged:j.func,stateReducer:j.func,itemCount:j.number,id:j.string,environment:j.shape({addEventListener:j.func.isRequired,removeEventListener:j.func.isRequired,document:j.shape({createElement:j.func.isRequired,getElementById:j.func.isRequired,activeElement:j.any.isRequired,body:j.any.isRequired}).isRequired,Node:j.func.isRequired}),suppressRefError:j.bool,scrollIntoView:j.func,selectedItem:j.any,isOpen:j.bool,inputValue:j.string,highlightedIndex:j.number,labelId:j.string,inputId:j.string,menuId:j.string,getItemId:j.func});function us(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 lm(e,t){var n=t.refKey,r=n!=="ref",i=!Aa(e);i&&!r&&!os.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!i&&r&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!os.isForwardRef(e)&&!Pa(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Xa={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function um(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){dm(s,e,t,n),n[s]!==t[s]&&(o[s]=n[s])}),r.onStateChange&&Object.keys(o).length&&r.onStateChange(ue({type:i},o))}function dm(e,t,n,r){var i=t.props,o=t.type,s="on"+Yo(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](ue({type:o},r))}function pm(e,t){return t.changes}var ds=Xo(function(e,t){Ma(e,t)},200),fm=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?g.useLayoutEffect:g.useEffect,mm="useId"in g?function(t){var n=t.id,r=t.labelId,i=t.menuId,o=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+g.useId();n||(n=c);var u=g.useRef({labelId:r||n+"-label",menuId:i||n+"-menu",getItemId:o||function(d){return n+"-item-"+d},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"});return u.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+Ra():n,i=t.labelId,o=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,u=g.useRef({labelId:i||r+"-label",menuId:o||r+"-menu",getItemId:s||function(d){return r+"-item-"+d},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return u.current};function hm(e,t,n,r){var i,o;if(e===void 0){if(t===void 0)throw new Error(r);i=n[t],o=t}else o=t===void 0?n.indexOf(e):t,i=e;return[i,o]}function Yo(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Ga(e){var t=g.useRef(e);return t.current=e,t}function gm(e,t,n,r){var i=g.useRef(),o=g.useRef(),s=g.useCallback(function(m,v){o.current=v,m=Sr(m,v.props);var h=e(m,v),w=v.props.stateReducer(m,ue({},v,{changes:h}));return w},[e]),a=g.useReducer(s,t,n),c=a[0],u=a[1],d=Ga(t),p=g.useCallback(function(m){return u(ue({props:d.current},m))},[d]),f=o.current;return g.useEffect(function(){var m=Sr(i.current,f==null?void 0:f.props),v=f&&i.current&&!r(m,c);v&&um(f,m,c),i.current=c},[c,f,r]),[c,p]}var Kn={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:pm,scrollIntoView:Ta,environment:typeof window>"u"?void 0:window};function Xt(e,t,n){n===void 0&&(n=Xa);var r=e["default"+Yo(t)];return r!==void 0?r:n[t]}function $n(e,t,n){n===void 0&&(n=Xa);var r=e[t];if(r!==void 0)return r;var i=e["initial"+Yo(t)];return i!==void 0?i:Xt(e,t,n)}function vm(e){var t=$n(e,"selectedItem"),n=$n(e,"isOpen"),r=bm(e),i=$n(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(o){return e.itemToKey(o)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:i}}function Hn(e,t,n){var r=e.items,i=e.initialHighlightedIndex,o=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,u=t.highlightedIndex;return r.length===0?-1:i!==void 0&&u===i&&!s(r[i],i)?i:o!==void 0&&!s(r[o],o)?o:c?r.findIndex(function(d){return a(c)===a(d)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function ym(e,t,n){var r=g.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return g.useEffect(function(){if(!e)return at;var i=n.map(function(d){return d.current});function o(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(d){r.current.isMouseDown=!1,Rr(d.target,i,e)||t()}function a(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function c(){r.current.isTouchMove=!0}function u(d){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!Rr(d.target,i,e,!1)&&t()}return e.addEventListener("mousedown",o),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",c),e.addEventListener("touchend",u),function(){e.removeEventListener("mousedown",o),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",u)}},[n,e,t]),r.current}var Ya=function(){return at};process.env.NODE_ENV!=="production"&&(Ya=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=g.useRef(n.reduce(function(s,a){return s[a]={},s},{}));g.useEffect(function(){Object.keys(i.current).forEach(function(s){var a=i.current[s];if(!Object.keys(a).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var c=a.suppressRefError,u=a.refKey,d=a.elementRef;c||d!=null&&d.current||console.error('downshift: The ref prop "'+u+'" from '+s+" was not applied correctly on your element.")})},[]);var o=g.useCallback(function(s,a,c,u){i.current[s]={suppressRefError:a,refKey:c,elementRef:u}},[]);return o});function wm(e,t,n,r){r===void 0&&(r={});var i=r.document,o=Wr();g.useEffect(function(){if(!(!e||o||!i)){var s=e(t);ds(s,i)}},n),g.useEffect(function(){return function(){ds.cancel(),tm(i)}},[i])}function Im(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,i=e.getItemNodeFromIndex,o=e.menuElement,s=e.scrollIntoView,a=g.useRef(!0);return fm(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(i(t),o))},[t]),a}var Za=at;process.env.NODE_ENV!=="production"&&(Za=function(t){var n=t.props,r=t.state,i=g.useRef(n),o=Wr();g.useEffect(function(){o||(Go(r,i.current,n),i.current=n)},[r,n,o])});function ps(e,t,n){var r;n===void 0&&(n=!0);var i=((r=e.items)==null?void 0:r.length)&&t>=0;return ue({isOpen:!1,highlightedIndex:-1},i&&ue({selectedItem:e.items[t],isOpen:Xt(e,"isOpen"),highlightedIndex:Xt(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function _m(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Wr(){var e=g.useRef(!0);return g.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function So(e){var t=Xt(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function bm(e){var t=$n(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Or={environment:j.shape({addEventListener:j.func.isRequired,removeEventListener:j.func.isRequired,document:j.shape({createElement:j.func.isRequired,getElementById:j.func.isRequired,activeElement:j.any.isRequired,body:j.any.isRequired}).isRequired,Node:j.func.isRequired}),itemToString:j.func,itemToKey:j.func,stateReducer:j.func},Qa=ue({},Or,{getA11yStatusMessage:j.func,highlightedIndex:j.number,defaultHighlightedIndex:j.number,initialHighlightedIndex:j.number,isOpen:j.bool,defaultIsOpen:j.bool,initialIsOpen:j.bool,selectedItem:j.any,initialSelectedItem:j.any,defaultSelectedItem:j.any,id:j.string,labelId:j.string,menuId:j.string,getItemId:j.func,toggleButtonId:j.string,onSelectedItemChange:j.func,onHighlightedIndexChange:j.func,onStateChange:j.func,onIsOpenChange:j.func,scrollIntoView:j.func});function xm(e,t,n){var r=t.type,i=t.props,o;switch(r){case n.ItemMouseMove:o={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:o={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:o={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Hn(i,e,0)};break;case n.FunctionOpenMenu:o={isOpen:!0,highlightedIndex:Hn(i,e,0)};break;case n.FunctionCloseMenu:o={isOpen:!1};break;case n.FunctionSetHighlightedIndex:o={highlightedIndex:i.isItemDisabled(i.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:o={inputValue:t.inputValue};break;case n.FunctionReset:o={highlightedIndex:So(i),isOpen:Xt(i,"isOpen"),selectedItem:Xt(i,"selectedItem"),inputValue:Xt(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return ue({},e,o)}On(On({},Qa),{items:j.array.isRequired,isItemDisabled:j.func});On(On({},Kn),{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 Zo=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Qo=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,ei=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,ti=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,ni=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,ri=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,oi=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,ii=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,si=process.env.NODE_ENV!=="production"?"__input_change__":8,Ar=process.env.NODE_ENV!=="production"?"__input_blur__":9,ai=process.env.NODE_ENV!=="production"?"__input_click__":10,ec=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,tc=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ci=process.env.NODE_ENV!=="production"?"__item_click__":13,nc=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,rc=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,oc=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,ic=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,sc=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,li=process.env.NODE_ENV!=="production"?"__function_select_item__":19,ac=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,cc=process.env.NODE_ENV!=="production"?"__function_reset__":21,ui=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,lc=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ui,FunctionCloseMenu:ic,FunctionOpenMenu:oc,FunctionReset:cc,FunctionSelectItem:li,FunctionSetHighlightedIndex:sc,FunctionSetInputValue:ac,FunctionToggleMenu:rc,InputBlur:Ar,InputChange:si,InputClick:ai,InputKeyDownArrowDown:Zo,InputKeyDownArrowUp:Qo,InputKeyDownEnd:ni,InputKeyDownEnter:ii,InputKeyDownEscape:ei,InputKeyDownHome:ti,InputKeyDownPageDown:oi,InputKeyDownPageUp:ri,ItemClick:ci,ItemMouseMove:tc,MenuMouseLeave:ec,ToggleButtonClick:nc});function Cm(e){var t=vm(e),n=t.selectedItem,r=t.inputValue;return r===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(r=e.itemToString(n)),ue({},t,{inputValue:r})}var Om=ue({},Qa,{items:j.array.isRequired,isItemDisabled:j.func,inputValue:j.string,defaultInputValue:j.string,initialInputValue:j.string,inputId:j.string,onInputValueChange:j.func});function Em(e,t,n,r){var i=g.useRef(),o=gm(e,t,n,r),s=o[0],a=o[1],c=Wr();return g.useEffect(function(){if(Tr(t,"selectedItem")){if(!c){var u=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);u&&a({type:ui,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Sr(s,t),a]}var uc=at;process.env.NODE_ENV!=="production"&&(uc=function(t,n){j.checkPropTypes(Om,t,"prop",n.name)});var Nm=ue({},Kn,{isItemDisabled:function(){return!1}});function Sm(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case ci:s={isOpen:Xt(i,"isOpen"),highlightedIndex:So(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case Zo:e.isOpen?s={highlightedIndex:pn(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:o&&e.selectedItem==null?-1:Hn(i,e,1),isOpen:i.items.length>=0};break;case Qo:e.isOpen?o?s=ps(i,e.highlightedIndex):s={highlightedIndex:pn(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:Hn(i,e,-1),isOpen:i.items.length>=0};break;case ii:s=ps(i,e.highlightedIndex);break;case ei:s=ue({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case ri:s={highlightedIndex:pn(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case oi:s={highlightedIndex:pn(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case ti:s={highlightedIndex:En(0,!1,i.items,i.isItemDisabled)};break;case ni:s={highlightedIndex:En(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case Ar:s=ue({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 si:s={isOpen:!0,highlightedIndex:So(i),inputValue:t.inputValue};break;case ai:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Hn(i,e,0)};break;case li:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case ui:s={inputValue:t.inputValue};break;default:return xm(e,t,lc)}return ue({},e,s)}var Tm=["onMouseLeave","refKey","ref"],Rm=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],Am=["onClick","onPress","refKey","ref"],Pm=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];di.stateChangeTypes=lc;function di(e){e===void 0&&(e={}),uc(e,di);var t=ue({},Nm,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=Em(Sm,t,Cm,_m),a=s[0],c=s[1],u=a.isOpen,d=a.highlightedIndex,p=a.selectedItem,f=a.inputValue,m=g.useRef(null),v=g.useRef({}),h=g.useRef(null),w=g.useRef(null),C=Wr(),y=mm(t),b=g.useRef(),x=Ga({state:a,props:t}),_=g.useCallback(function(L){return v.current[y.getItemId(L)]},[y]);wm(o,a,[u,d,p,f],i);var E=Im({menuElement:m.current,highlightedIndex:d,isOpen:u,itemRefs:v,scrollIntoView:r,getItemNodeFromIndex:_});Za({props:t,state:a}),g.useEffect(function(){var L=$n(t,"isOpen");L&&h.current&&h.current.focus()},[]),g.useEffect(function(){C||(b.current=n.length)});var D=ym(i,g.useCallback(function(){x.current.state.isOpen&&c({type:Ar,selectItem:!1})},[c,x]),g.useMemo(function(){return[m,w,h]},[m.current,w.current,h.current])),N=Ya("getInputProps","getMenuProps");g.useEffect(function(){u||(v.current={})},[u]),g.useEffect(function(){var L;!u||!(i!=null&&i.document)||!(h!=null&&(L=h.current)!=null&&L.focus)||i.document.activeElement!==h.current&&h.current.focus()},[u,i]);var B=g.useMemo(function(){return{ArrowDown:function(k){k.preventDefault(),c({type:Zo,altKey:k.altKey})},ArrowUp:function(k){k.preventDefault(),c({type:Qo,altKey:k.altKey})},Home:function(k){x.current.state.isOpen&&(k.preventDefault(),c({type:ti}))},End:function(k){x.current.state.isOpen&&(k.preventDefault(),c({type:ni}))},Escape:function(k){var F=x.current.state;(F.isOpen||F.inputValue||F.selectedItem||F.highlightedIndex>-1)&&(k.preventDefault(),c({type:ei}))},Enter:function(k){var F=x.current.state;!F.isOpen||k.which===229||(k.preventDefault(),c({type:ii}))},PageUp:function(k){x.current.state.isOpen&&(k.preventDefault(),c({type:ri}))},PageDown:function(k){x.current.state.isOpen&&(k.preventDefault(),c({type:oi}))}}},[c,x]),W=g.useCallback(function(L){return ue({id:y.labelId,htmlFor:y.inputId},L)},[y]),q=g.useCallback(function(L,k){var F,A=L===void 0?{}:L,Y=A.onMouseLeave,Z=A.refKey,V=Z===void 0?"ref":Z,Q=A.ref,J=Lt(A,Tm),ae=k===void 0?{}:k,P=ae.suppressRefError,fe=P===void 0?!1:P;return N("getMenuProps",fe,V,m),ue((F={},F[V]=xn(Q,function(K){m.current=K}),F.id=y.menuId,F.role="listbox",F["aria-labelledby"]=J&&J["aria-label"]?void 0:""+y.labelId,F.onMouseLeave=Le(Y,function(){c({type:ec})}),F),J)},[c,N,y]),X=g.useCallback(function(L){var k,F,A=L===void 0?{}:L,Y=A.item,Z=A.index,V=A.refKey,Q=V===void 0?"ref":V,J=A.ref,ae=A.onMouseMove,P=A.onMouseDown,fe=A.onClick;A.onPress;var K=A.disabled,we=Lt(A,Rm);K!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Pe=x.current,He=Pe.props,Me=Pe.state,me=hm(Y,Z,He.items,"Pass either item or index to getItemProps!"),vt=me[0],Ue=me[1],ot=He.isItemDisabled(vt,Ue),yt="onClick",wt=fe,Be=function(){D.isTouchEnd||Ue===Me.highlightedIndex||(E.current=!1,c({type:tc,index:Ue,disabled:ot}))},Ve=function(){c({type:ci,index:Ue})},Fe=function(It){return It.preventDefault()};return ue((k={},k[Q]=xn(J,function(Oe){Oe&&(v.current[y.getItemId(Ue)]=Oe)}),k["aria-disabled"]=ot,k["aria-selected"]=Ue===Me.highlightedIndex,k.id=y.getItemId(Ue),k.role="option",k),!ot&&(F={},F[yt]=Le(wt,Ve),F),{onMouseMove:Le(ae,Be),onMouseDown:Le(P,Fe)},we)},[c,y,x,D,E]),ee=g.useCallback(function(L){var k,F=L===void 0?{}:L,A=F.onClick;F.onPress;var Y=F.refKey,Z=Y===void 0?"ref":Y,V=F.ref,Q=Lt(F,Am),J=x.current.state,ae=function(){c({type:nc})};return ue((k={},k[Z]=xn(V,function(P){w.current=P}),k["aria-controls"]=y.menuId,k["aria-expanded"]=J.isOpen,k.id=y.toggleButtonId,k.tabIndex=-1,k),!Q.disabled&&ue({},{onClick:Le(A,ae)}),Q)},[c,x,y]),$=g.useCallback(function(L,k){var F,A=L===void 0?{}:L,Y=A.onKeyDown,Z=A.onChange,V=A.onInput,Q=A.onBlur;A.onChangeText;var J=A.onClick,ae=A.refKey,P=ae===void 0?"ref":ae,fe=A.ref,K=Lt(A,Pm),we=k===void 0?{}:k,Pe=we.suppressRefError,He=Pe===void 0?!1:Pe;N("getInputProps",He,P,h);var Me=x.current.state,me=function(Fe){var Oe=Eo(Fe);Oe&&B[Oe]&&B[Oe](Fe)},vt=function(Fe){c({type:si,inputValue:Fe.target.value})},Ue=function(Fe){if(i!=null&&i.document&&Me.isOpen&&!D.isMouseDown){var Oe=Fe.relatedTarget===null&&i.document.activeElement!==i.document.body;c({type:Ar,selectItem:!Oe})}},ot=function(){c({type:ai})},yt="onChange",wt={};if(!K.disabled){var Be;wt=(Be={},Be[yt]=Le(Z,V,vt),Be.onKeyDown=Le(Y,me),Be.onBlur=Le(Q,Ue),Be.onClick=Le(J,ot),Be)}return ue((F={},F[P]=xn(fe,function(Ve){h.current=Ve}),F["aria-activedescendant"]=Me.isOpen&&Me.highlightedIndex>-1?y.getItemId(Me.highlightedIndex):"",F["aria-autocomplete"]="list",F["aria-controls"]=y.menuId,F["aria-expanded"]=Me.isOpen,F["aria-labelledby"]=K&&K["aria-label"]?void 0:y.labelId,F.autoComplete="off",F.id=y.inputId,F.role="combobox",F.value=Me.inputValue,F),wt,K)},[c,y,i,B,x,D,N]),ie=g.useCallback(function(){c({type:rc})},[c]),te=g.useCallback(function(){c({type:ic})},[c]),G=g.useCallback(function(){c({type:oc})},[c]),le=g.useCallback(function(L){c({type:sc,highlightedIndex:L})},[c]),pe=g.useCallback(function(L){c({type:li,selectedItem:L})},[c]),S=g.useCallback(function(L){c({type:ac,inputValue:L})},[c]),M=g.useCallback(function(){c({type:cc})},[c]);return{getItemProps:X,getLabelProps:W,getMenuProps:q,getInputProps:$,getToggleButtonProps:ee,toggleMenu:ie,openMenu:G,closeMenu:te,setHighlightedIndex:le,setInputValue:S,selectItem:pe,reset:M,highlightedIndex:d,isOpen:u,selectedItem:p,inputValue:f}}Or.stateReducer,Or.itemToKey,Or.environment,j.array,j.array,j.array,j.func,j.number,j.number,j.number,j.func,j.func,j.string,j.string;Kn.itemToKey,Kn.stateReducer,Kn.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 Dm="_comboboxContainer_9s7ov_1",Mm="_label_9s7ov_8",Fm="_inputContainer_9s7ov_12",km="_input_9s7ov_12",jm="_toggleButton_9s7ov_33",Lm="_menu_9s7ov_39",Vm="_menuItem_9s7ov_54",Km="_highlighted_9s7ov_61",$m="_selected_9s7ov_65",Hm="_hidden_9s7ov_69",jt={comboboxContainer:Dm,label:Mm,inputContainer:Fm,input:km,toggleButton:jm,menu:Lm,menuItem:Vm,highlighted:Km,selected:$m,hidden:Hm};function Um(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function pi({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:i,style:o}){const[s,a]=g.useState(e),c=g.useRef(null);g.useEffect(()=>a(e),[e]);const u=_=>{a(e.filter(Um(_)))},{isOpen:d,getToggleButtonProps:p,getMenuProps:f,getInputProps:m,highlightedIndex:v,getItemProps:h,setInputValue:w}=di({items:s,selectedItem:t?e.find(_=>_.value===t):null,itemToString:_=>(_==null?void 0:_.label)||"",onInputValueChange:({inputValue:_})=>u(_),onSelectedItemChange:({selectedItem:_})=>{var E;(E=c.current)==null||E.blur(),n(_)}}),C=()=>{w(""),a(e)},y=()=>C(),b=g.useMemo(()=>{var _;return(_=e.find(E=>E.value===t))==null?void 0:_.label},[e,t]),x=()=>w(b||"");return l.jsxs("div",{style:{position:"relative",...o},children:[l.jsx("div",{className:jt.comboboxContainer,children:l.jsxs("div",{className:jt.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:i,placeholder:b||r,className:jt.input,...m({onFocus:y,onBlur:x,ref:c})}),l.jsx("button",{style:{border:"none"},disabled:i,"aria-label":"toggle menu",className:jt.toggleButton,type:"button",...p(),children:d?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${jt.menu} ${d&&e.length?"":jt.hidden}`,...f(),children:d&&s.map((_,E)=>l.jsx("li",{className:`${jt.menuItem} ${v===E?jt.highlighted:""} ${t===(_==null?void 0:_.value)?jt.selected:""}`,...h({item:_,index:E}),children:l.jsx("span",{children:_.label})},_.id))})]})}const Nn=Math.min,fn=Math.max,Pr=Math.round,wr=Math.floor,Zt=e=>({x:e,y:e}),Bm={left:"right",right:"left",bottom:"top",top:"bottom"},Wm={start:"end",end:"start"};function To(e,t,n){return fn(e,Nn(t,n))}function Yn(e,t){return typeof e=="function"?e(t):e}function gn(e){return e.split("-")[0]}function Zn(e){return e.split("-")[1]}function dc(e){return e==="x"?"y":"x"}function fi(e){return e==="y"?"height":"width"}function Sn(e){return["top","bottom"].includes(gn(e))?"y":"x"}function mi(e){return dc(Sn(e))}function qm(e,t,n){n===void 0&&(n=!1);const r=Zn(e),i=mi(e),o=fi(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Dr(s)),[s,Dr(s)]}function Jm(e){const t=Dr(e);return[Ro(e),t,Ro(t)]}function Ro(e){return e.replace(/start|end/g,t=>Wm[t])}function zm(e,t,n){const r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?o:s;default:return[]}}function Xm(e,t,n,r){const i=Zn(e);let o=zm(gn(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Ro)))),o}function Dr(e){return e.replace(/left|right|bottom|top/g,t=>Bm[t])}function Gm(e){return{top:0,right:0,bottom:0,left:0,...e}}function pc(e){return typeof e!="number"?Gm(e):{top:e,right:e,bottom:e,left:e}}function Mr(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function fs(e,t,n){let{reference:r,floating:i}=e;const o=Sn(t),s=mi(t),a=fi(s),c=gn(t),u=o==="y",d=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let m;switch(c){case"top":m={x:d,y:r.y-i.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:p};break;case"left":m={x:r.x-i.width,y:p};break;default:m={x:r.x,y:r.y}}switch(Zn(t)){case"start":m[s]-=f*(n&&u?-1:1);break;case"end":m[s]+=f*(n&&u?-1:1);break}return m}const Ym=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,a=o.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:p}=fs(u,r,c),f=r,m={},v=0;for(let h=0;h<a.length;h++){const{name:w,fn:C}=a[h],{x:y,y:b,data:x,reset:_}=await C({x:d,y:p,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:u,platform:s,elements:{reference:e,floating:t}});d=y??d,p=b??p,m={...m,[w]:{...m[w],...x}},_&&v<=50&&(v++,typeof _=="object"&&(_.placement&&(f=_.placement),_.rects&&(u=_.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):_.rects),{x:d,y:p}=fs(u,f,c)),h=-1)}return{x:d,y:p,placement:f,strategy:i,middlewareData:m}};async function fc(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:f=!1,padding:m=0}=Yn(t,e),v=pc(m),w=a[f?p==="floating"?"reference":"floating":p],C=Mr(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(w)))==null||n?w:w.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),y=p==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,b=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),x=await(o.isElement==null?void 0:o.isElement(b))?await(o.getScale==null?void 0:o.getScale(b))||{x:1,y:1}:{x:1,y:1},_=Mr(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:b,strategy:c}):y);return{top:(C.top-_.top+v.top)/x.y,bottom:(_.bottom-C.bottom+v.bottom)/x.y,left:(C.left-_.left+v.left)/x.x,right:(_.right-C.right+v.right)/x.x}}const Zm=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=Yn(e,t)||{};if(u==null)return{};const p=pc(d),f={x:n,y:r},m=mi(i),v=fi(m),h=await s.getDimensions(u),w=m==="y",C=w?"top":"left",y=w?"bottom":"right",b=w?"clientHeight":"clientWidth",x=o.reference[v]+o.reference[m]-f[m]-o.floating[v],_=f[m]-o.reference[m],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let D=E?E[b]:0;(!D||!await(s.isElement==null?void 0:s.isElement(E)))&&(D=a.floating[b]||o.floating[v]);const N=x/2-_/2,B=D/2-h[v]/2-1,W=Nn(p[C],B),q=Nn(p[y],B),X=W,ee=D-h[v]-q,$=D/2-h[v]/2+N,ie=To(X,$,ee),te=!c.arrow&&Zn(i)!=null&&$!==ie&&o.reference[v]/2-($<X?W:q)-h[v]/2<0,G=te?$<X?$-X:$-ee:0;return{[m]:f[m]+G,data:{[m]:ie,centerOffset:$-ie-G,...te&&{alignmentOffset:G}},reset:te}}}),Qm=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:p=!0,fallbackPlacements:f,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:h=!0,...w}=Yn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const C=gn(i),y=Sn(a),b=gn(a)===a,x=await(c.isRTL==null?void 0:c.isRTL(u.floating)),_=f||(b||!h?[Dr(a)]:Jm(a)),E=v!=="none";!f&&E&&_.push(...Xm(a,h,v,x));const D=[a,..._],N=await fc(t,w),B=[];let W=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&B.push(N[C]),p){const $=qm(i,s,x);B.push(N[$[0]],N[$[1]])}if(W=[...W,{placement:i,overflows:B}],!B.every($=>$<=0)){var q,X;const $=(((q=o.flip)==null?void 0:q.index)||0)+1,ie=D[$];if(ie)return{data:{index:$,overflows:W},reset:{placement:ie}};let te=(X=W.filter(G=>G.overflows[0]<=0).sort((G,le)=>G.overflows[1]-le.overflows[1])[0])==null?void 0:X.placement;if(!te)switch(m){case"bestFit":{var ee;const G=(ee=W.filter(le=>{if(E){const pe=Sn(le.placement);return pe===y||pe==="y"}return!0}).map(le=>[le.placement,le.overflows.filter(pe=>pe>0).reduce((pe,S)=>pe+S,0)]).sort((le,pe)=>le[1]-pe[1])[0])==null?void 0:ee[0];G&&(te=G);break}case"initialPlacement":te=a;break}if(i!==te)return{reset:{placement:te}}}return{}}}};async function eh(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=gn(n),a=Zn(n),c=Sn(n)==="y",u=["left","top"].includes(s)?-1:1,d=o&&c?-1:1,p=Yn(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof v=="number"&&(m=a==="end"?v*-1:v),c?{x:m*d,y:f*u}:{x:f*u,y:m*d}}const th=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:o,placement:s,middlewareData:a}=t,c=await eh(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:o+c.y,data:{...c,placement:s}}}}},nh=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:w=>{let{x:C,y}=w;return{x:C,y}}},...c}=Yn(e,t),u={x:n,y:r},d=await fc(t,c),p=Sn(gn(i)),f=dc(p);let m=u[f],v=u[p];if(o){const w=f==="y"?"top":"left",C=f==="y"?"bottom":"right",y=m+d[w],b=m-d[C];m=To(y,m,b)}if(s){const w=p==="y"?"top":"left",C=p==="y"?"bottom":"right",y=v+d[w],b=v-d[C];v=To(y,v,b)}const h=a.fn({...t,[f]:m,[p]:v});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:o,[p]:s}}}}}};function qr(){return typeof window<"u"}function Mn(e){return mc(e)?(e.nodeName||"").toLowerCase():"#document"}function lt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Rt(e){var t;return(t=(mc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function mc(e){return qr()?e instanceof Node||e instanceof lt(e).Node:!1}function Ot(e){return qr()?e instanceof Element||e instanceof lt(e).Element:!1}function St(e){return qr()?e instanceof HTMLElement||e instanceof lt(e).HTMLElement:!1}function ms(e){return!qr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof lt(e).ShadowRoot}function Qn(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Et(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function rh(e){return["table","td","th"].includes(Mn(e))}function Jr(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function hi(e){const t=gi(),n=Ot(e)?Et(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function oh(e){let t=Qt(e);for(;St(t)&&!Tn(t);){if(hi(t))return t;if(Jr(t))return null;t=Qt(t)}return null}function gi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Tn(e){return["html","body","#document"].includes(Mn(e))}function Et(e){return lt(e).getComputedStyle(e)}function zr(e){return Ot(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Qt(e){if(Mn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ms(e)&&e.host||Rt(e);return ms(t)?t.host:t}function hc(e){const t=Qt(e);return Tn(t)?e.ownerDocument?e.ownerDocument.body:e.body:St(t)&&Qn(t)?t:hc(t)}function Wn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=hc(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=lt(i);if(o){const a=Ao(s);return t.concat(s,s.visualViewport||[],Qn(i)?i:[],a&&n?Wn(a):[])}return t.concat(i,Wn(i,[],n))}function Ao(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gc(e){const t=Et(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=St(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,a=Pr(n)!==o||Pr(r)!==s;return a&&(n=o,r=s),{width:n,height:r,$:a}}function vi(e){return Ot(e)?e:e.contextElement}function Cn(e){const t=vi(e);if(!St(t))return Zt(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=gc(t);let s=(o?Pr(n.width):n.width)/r,a=(o?Pr(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const ih=Zt(0);function vc(e){const t=lt(e);return!gi()||!t.visualViewport?ih:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function sh(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==lt(e)?!1:t}function vn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=vi(e);let s=Zt(1);t&&(r?Ot(r)&&(s=Cn(r)):s=Cn(e));const a=sh(o,n,r)?vc(o):Zt(0);let c=(i.left+a.x)/s.x,u=(i.top+a.y)/s.y,d=i.width/s.x,p=i.height/s.y;if(o){const f=lt(o),m=r&&Ot(r)?lt(r):r;let v=f,h=Ao(v);for(;h&&r&&m!==v;){const w=Cn(h),C=h.getBoundingClientRect(),y=Et(h),b=C.left+(h.clientLeft+parseFloat(y.paddingLeft))*w.x,x=C.top+(h.clientTop+parseFloat(y.paddingTop))*w.y;c*=w.x,u*=w.y,d*=w.x,p*=w.y,c+=b,u+=x,v=lt(h),h=Ao(v)}}return Mr({width:d,height:p,x:c,y:u})}function ah(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=Rt(r),a=t?Jr(t.floating):!1;if(r===s||a&&o)return n;let c={scrollLeft:0,scrollTop:0},u=Zt(1);const d=Zt(0),p=St(r);if((p||!p&&!o)&&((Mn(r)!=="body"||Qn(s))&&(c=zr(r)),St(r))){const f=vn(r);u=Cn(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function ch(e){return Array.from(e.getClientRects())}function Po(e,t){const n=zr(e).scrollLeft;return t?t.left+n:vn(Rt(e)).left+n}function lh(e){const t=Rt(e),n=zr(e),r=e.ownerDocument.body,i=fn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=fn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Po(e);const a=-n.scrollTop;return Et(r).direction==="rtl"&&(s+=fn(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function uh(e,t){const n=lt(e),r=Rt(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,a=0,c=0;if(i){o=i.width,s=i.height;const u=gi();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a,y:c}}function dh(e,t){const n=vn(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=St(e)?Cn(e):Zt(1),s=e.clientWidth*o.x,a=e.clientHeight*o.y,c=i*o.x,u=r*o.y;return{width:s,height:a,x:c,y:u}}function hs(e,t,n){let r;if(t==="viewport")r=uh(e,n);else if(t==="document")r=lh(Rt(e));else if(Ot(t))r=dh(t,n);else{const i=vc(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Mr(r)}function yc(e,t){const n=Qt(e);return n===t||!Ot(n)||Tn(n)?!1:Et(n).position==="fixed"||yc(n,t)}function ph(e,t){const n=t.get(e);if(n)return n;let r=Wn(e,[],!1).filter(a=>Ot(a)&&Mn(a)!=="body"),i=null;const o=Et(e).position==="fixed";let s=o?Qt(e):e;for(;Ot(s)&&!Tn(s);){const a=Et(s),c=hi(s);!c&&a.position==="fixed"&&(i=null),(o?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Qn(s)&&!c&&yc(e,s))?r=r.filter(d=>d!==s):i=a,s=Qt(s)}return t.set(e,r),r}function fh(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Jr(t)?[]:ph(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((u,d)=>{const p=hs(t,d,i);return u.top=fn(p.top,u.top),u.right=Nn(p.right,u.right),u.bottom=Nn(p.bottom,u.bottom),u.left=fn(p.left,u.left),u},hs(t,a,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function mh(e){const{width:t,height:n}=gc(e);return{width:t,height:n}}function hh(e,t,n){const r=St(t),i=Rt(t),o=n==="fixed",s=vn(e,!0,o,t);let a={scrollLeft:0,scrollTop:0};const c=Zt(0);if(r||!r&&!o)if((Mn(t)!=="body"||Qn(i))&&(a=zr(t)),r){const m=vn(t,!0,o,t);c.x=m.x+t.clientLeft,c.y=m.y+t.clientTop}else i&&(c.x=Po(i));let u=0,d=0;if(i&&!r&&!o){const m=i.getBoundingClientRect();d=m.top+a.scrollTop,u=m.left+a.scrollLeft-Po(i,m)}const p=s.left+a.scrollLeft-c.x-u,f=s.top+a.scrollTop-c.y-d;return{x:p,y:f,width:s.width,height:s.height}}function go(e){return Et(e).position==="static"}function gs(e,t){if(!St(e)||Et(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Rt(e)===n&&(n=n.ownerDocument.body),n}function wc(e,t){const n=lt(e);if(Jr(e))return n;if(!St(e)){let i=Qt(e);for(;i&&!Tn(i);){if(Ot(i)&&!go(i))return i;i=Qt(i)}return n}let r=gs(e,t);for(;r&&rh(r)&&go(r);)r=gs(r,t);return r&&Tn(r)&&go(r)&&!hi(r)?n:r||oh(e)||n}const gh=async function(e){const t=this.getOffsetParent||wc,n=this.getDimensions,r=await n(e.floating);return{reference:hh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function vh(e){return Et(e).direction==="rtl"}const yh={convertOffsetParentRelativeRectToViewportRelativeRect:ah,getDocumentElement:Rt,getClippingRect:fh,getOffsetParent:wc,getElementRects:gh,getClientRects:ch,getDimensions:mh,getScale:Cn,isElement:Ot,isRTL:vh};function wh(e,t){let n=null,r;const i=Rt(e);function o(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const{left:u,top:d,width:p,height:f}=e.getBoundingClientRect();if(a||t(),!p||!f)return;const m=wr(d),v=wr(i.clientWidth-(u+p)),h=wr(i.clientHeight-(d+f)),w=wr(u),y={rootMargin:-m+"px "+-v+"px "+-h+"px "+-w+"px",threshold:fn(0,Nn(1,c))||1};let b=!0;function x(_){const E=_[0].intersectionRatio;if(E!==c){if(!b)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(x,{...y,root:i.ownerDocument})}catch{n=new IntersectionObserver(x,y)}n.observe(e)}return s(!0),o}function Ih(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=vi(e),d=i||o?[...u?Wn(u):[],...Wn(t)]:[];d.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),o&&C.addEventListener("resize",n)});const p=u&&a?wh(u,n):null;let f=-1,m=null;s&&(m=new ResizeObserver(C=>{let[y]=C;y&&y.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=m)==null||b.observe(t)})),n()}),u&&!c&&m.observe(u),m.observe(t));let v,h=c?vn(e):null;c&&w();function w(){const C=vn(e);h&&(C.x!==h.x||C.y!==h.y||C.width!==h.width||C.height!==h.height)&&n(),h=C,v=requestAnimationFrame(w)}return n(),()=>{var C;d.forEach(y=>{i&&y.removeEventListener("scroll",n),o&&y.removeEventListener("resize",n)}),p==null||p(),(C=m)==null||C.disconnect(),m=null,c&&cancelAnimationFrame(v)}}const _h=th,bh=nh,xh=Qm,Ch=Zm,vs=(e,t,n)=>{const r=new Map,i={platform:yh,...n},o={...i.platform,_c:r};return Ym(e,t,{...i,platform:o})};/*
44
44
  * React Tooltip
45
45
  * {@link https://github.com/ReactTooltip/react-tooltip}
46
46
  * @copyright ReactTooltip Team
47
47
  * @license MIT
48
- */const qh="react-tooltip-core-styles",Wh="react-tooltip-base-styles",bs={core:!1,base:!1};function xs({css:e,id:t=Wh,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||bs[n]||n==="core"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=qh),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.id=t,c.type="text/css",s==="top"&&a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c),c.styleSheet?c.styleSheet.cssText=e:c.appendChild(document.createTextNode(e)),bs[n]=!0}const Cs=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[Vh(Number(i)),Uh({fallbackAxisSideDirection:"start"}),Hh({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=s;return n?(c.push(Bh({element:n,padding:5})),_s(e,t,{placement:r,strategy:o,middleware:c}).then(({x:u,y:d,placement:f,middlewareData:m})=>{var p,g;const I={left:`${u}px`,top:`${d}px`,border:a},{x:_,y:C}=(p=m.arrow)!==null&&p!==void 0?p:{x:0,y:0},y=(g={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&g!==void 0?g:"bottom",b=a&&{borderBottom:a,borderRight:a};let x=0;if(a){const w=`${a}`.match(/(\d+)px/);x=w!=null&&w[1]?Number(w[1]):1}return{tooltipStyles:I,tooltipArrowStyles:{left:_!=null?`${_}px`:"",top:C!=null?`${C}px`:"",right:"",bottom:"",...b,[y]:`-${4+x}px`},place:f}})):_s(e,t,{placement:"bottom",strategy:o,middleware:c}).then(({x:u,y:d,placement:f})=>({tooltipStyles:{left:`${u}px`,top:`${d}px`},tooltipArrowStyles:{},place:f}))},Os=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Es=(e,t,n)=>{let r=null;const i=function(...o){const s=()=>{r=null};!r&&(e.apply(this,o),r=setTimeout(s,t))};return i.cancel=()=>{r&&(clearTimeout(r),r=null)},i},Ns=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Lo=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,o)=>Lo(i,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Ns(e)||!Ns(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(i=>Lo(e[i],t[i]))},Jh=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some(n=>{const r=t.getPropertyValue(n);return r==="auto"||r==="scroll"})},Ss=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Jh(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},zh=typeof window<"u"?h.useLayoutEffect:h.useEffect,ht=e=>{e.current&&(clearTimeout(e.current),e.current=null)},Xh="DEFAULT_TOOLTIP_ID",Gh={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},Yh=h.createContext({getTooltipData:()=>Gh});function Cc(e=Xh){return h.useContext(Yh).getTooltipData(e)}var _n={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},yo={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const Zh=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:i="dark",anchorId:o,anchorSelect:s,place:a="top",offset:c=10,events:u=["hover"],openOnClick:d=!1,positionStrategy:f="absolute",middlewares:m,wrapper:p,delayShow:g=0,delayHide:I=0,float:_=!1,hidden:C=!1,noArrow:y=!1,clickable:b=!1,closeOnEsc:x=!1,closeOnScroll:w=!1,closeOnResize:E=!1,openEvents:j,closeEvents:N,globalCloseEvents:U,imperativeModeOnly:W,style:z,position:Y,afterShow:ee,afterHide:B,disableTooltip:se,content:ne,contentWrapperRef:Q,isOpen:de,defaultIsOpen:fe=!1,setIsOpen:S,activeAnchor:D,setActiveAnchor:L,border:M,opacity:F,arrowColor:R,role:X="tooltip"})=>{var G;const K=h.useRef(null),Z=h.useRef(null),q=h.useRef(null),ae=h.useRef(null),A=h.useRef(null),[pe,$]=h.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ie,Pe]=h.useState(!1),[He,Fe]=h.useState(!1),[me,gt]=h.useState(null),Ue=h.useRef(!1),rt=h.useRef(null),{anchorRefs:vt,setActiveAnchor:yt}=Cc(t),Be=h.useRef(!1),[Ke,Me]=h.useState([]),Oe=h.useRef(!1),It=d||u.includes("click"),Xe=It||(j==null?void 0:j.click)||(j==null?void 0:j.dblclick)||(j==null?void 0:j.mousedown),At=j?{...j}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!j&&It&&Object.assign(At,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Vt=N?{...N}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!N&&It&&Object.assign(Vt,{mouseleave:!1,blur:!1,mouseout:!1});const ot=U?{...U}:{escape:x||!1,scroll:w||!1,resize:E||!1,clickOutsideAnchor:Xe||!1};W&&(Object.assign(At,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Vt,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(ot,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),zh(()=>(Oe.current=!0,()=>{Oe.current=!1}),[]);const Ee=H=>{Oe.current&&(H&&Fe(!0),setTimeout(()=>{Oe.current&&(S==null||S(H),de===void 0&&Pe(H))},10))};h.useEffect(()=>{if(de===void 0)return()=>null;de&&Fe(!0);const H=setTimeout(()=>{Pe(de)},10);return()=>{clearTimeout(H)}},[de]),h.useEffect(()=>{if(Ie!==Ue.current)if(ht(A),Ue.current=Ie,Ie)ee==null||ee();else{const H=(re=>{const ie=re.match(/^([\d.]+)(ms|s)$/);if(!ie)return 0;const[,Re,je]=ie;return Number(Re)*(je==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));A.current=setTimeout(()=>{Fe(!1),gt(null),B==null||B()},H+25)}},[Ie]);const Pt=H=>{$(re=>Lo(re,H)?re:H)},Ht=(H=g)=>{ht(q),He?Ee(!0):q.current=setTimeout(()=>{Ee(!0)},H)},Dt=(H=I)=>{ht(ae),ae.current=setTimeout(()=>{Be.current||Ee(!1)},H)},nn=H=>{var re;if(!H)return;const ie=(re=H.currentTarget)!==null&&re!==void 0?re:H.target;if(!(ie!=null&&ie.isConnected))return L(null),void yt({current:null});g?Ht():Ee(!0),L(ie),yt({current:ie}),ht(ae)},Ze=()=>{b?Dt(I||100):I?Dt():Ee(!1),ht(q)},Ft=({x:H,y:re})=>{var ie;const Re={getBoundingClientRect:()=>({x:H,y:re,width:0,height:0,top:re,left:H,right:H,bottom:re})};Cs({place:(ie=me==null?void 0:me.place)!==null&&ie!==void 0?ie:a,offset:c,elementReference:Re,tooltipReference:K.current,tooltipArrowReference:Z.current,strategy:f,middlewares:m,border:M}).then(je=>{Pt(je)})},Ut=H=>{if(!H)return;const re=H,ie={x:re.clientX,y:re.clientY};Ft(ie),rt.current=ie},rn=H=>{var re;if(!Ie)return;const ie=H.target;ie.isConnected&&(!((re=K.current)===null||re===void 0)&&re.contains(ie)||[document.querySelector(`[id='${o}']`),...Ke].some(Re=>Re==null?void 0:Re.contains(ie))||(Ee(!1),ht(q)))},Bt=Es(nn,50),Ce=Es(Ze,50),Ge=H=>{Ce.cancel(),Bt(H)},te=()=>{Bt.cancel(),Ce()},ue=h.useCallback(()=>{var H,re;const ie=(H=me==null?void 0:me.position)!==null&&H!==void 0?H:Y;ie?Ft(ie):_?rt.current&&Ft(rt.current):D!=null&&D.isConnected&&Cs({place:(re=me==null?void 0:me.place)!==null&&re!==void 0?re:a,offset:c,elementReference:D,tooltipReference:K.current,tooltipArrowReference:Z.current,strategy:f,middlewares:m,border:M}).then(Re=>{Oe.current&&Pt(Re)})},[Ie,D,ne,z,a,me==null?void 0:me.place,c,f,Y,me==null?void 0:me.position,_]);h.useEffect(()=>{var H,re;const ie=new Set(vt);Ke.forEach(we=>{se!=null&&se(we)||ie.add({current:we})});const Re=document.querySelector(`[id='${o}']`);Re&&!(se!=null&&se(Re))&&ie.add({current:Re});const je=()=>{Ee(!1)},Qe=Ss(D),$e=Ss(K.current);ot.scroll&&(window.addEventListener("scroll",je),Qe==null||Qe.addEventListener("scroll",je),$e==null||$e.addEventListener("scroll",je));let qe=null;ot.resize?window.addEventListener("resize",je):D&&K.current&&(qe=$h(D,K.current,ue,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const et=we=>{we.key==="Escape"&&Ee(!1)};ot.escape&&window.addEventListener("keydown",et),ot.clickOutsideAnchor&&window.addEventListener("click",rn);const be=[],on=we=>{Ie&&(we==null?void 0:we.target)===D||nn(we)},to=we=>{Ie&&(we==null?void 0:we.target)===D&&Ze()},pt=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],nr=["click","dblclick","mousedown","mouseup"];Object.entries(At).forEach(([we,wt])=>{wt&&(pt.includes(we)?be.push({event:we,listener:Ge}):nr.includes(we)&&be.push({event:we,listener:on}))}),Object.entries(Vt).forEach(([we,wt])=>{wt&&(pt.includes(we)?be.push({event:we,listener:te}):nr.includes(we)&&be.push({event:we,listener:to}))}),_&&be.push({event:"pointermove",listener:Ut});const rr=()=>{Be.current=!0},or=()=>{Be.current=!1,Ze()};return b&&!Xe&&((H=K.current)===null||H===void 0||H.addEventListener("mouseenter",rr),(re=K.current)===null||re===void 0||re.addEventListener("mouseleave",or)),be.forEach(({event:we,listener:wt})=>{ie.forEach(_t=>{var sn;(sn=_t.current)===null||sn===void 0||sn.addEventListener(we,wt)})}),()=>{var we,wt;ot.scroll&&(window.removeEventListener("scroll",je),Qe==null||Qe.removeEventListener("scroll",je),$e==null||$e.removeEventListener("scroll",je)),ot.resize?window.removeEventListener("resize",je):qe==null||qe(),ot.clickOutsideAnchor&&window.removeEventListener("click",rn),ot.escape&&window.removeEventListener("keydown",et),b&&!Xe&&((we=K.current)===null||we===void 0||we.removeEventListener("mouseenter",rr),(wt=K.current)===null||wt===void 0||wt.removeEventListener("mouseleave",or)),be.forEach(({event:_t,listener:sn})=>{ie.forEach(no=>{var kn;(kn=no.current)===null||kn===void 0||kn.removeEventListener(_t,sn)})})}},[D,ue,He,vt,Ke,j,N,U,It,g,I]),h.useEffect(()=>{var H,re;let ie=(re=(H=me==null?void 0:me.anchorSelect)!==null&&H!==void 0?H:s)!==null&&re!==void 0?re:"";!ie&&t&&(ie=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Re=new MutationObserver(je=>{const Qe=[],$e=[];je.forEach(qe=>{if(qe.type==="attributes"&&qe.attributeName==="data-tooltip-id"&&(qe.target.getAttribute("data-tooltip-id")===t?Qe.push(qe.target):qe.oldValue===t&&$e.push(qe.target)),qe.type==="childList"){if(D){const et=[...qe.removedNodes].filter(be=>be.nodeType===1);if(ie)try{$e.push(...et.filter(be=>be.matches(ie))),$e.push(...et.flatMap(be=>[...be.querySelectorAll(ie)]))}catch{}et.some(be=>{var on;return!!(!((on=be==null?void 0:be.contains)===null||on===void 0)&&on.call(be,D))&&(Fe(!1),Ee(!1),L(null),ht(q),ht(ae),!0)})}if(ie)try{const et=[...qe.addedNodes].filter(be=>be.nodeType===1);Qe.push(...et.filter(be=>be.matches(ie))),Qe.push(...et.flatMap(be=>[...be.querySelectorAll(ie)]))}catch{}}}),(Qe.length||$e.length)&&Me(qe=>[...qe.filter(et=>!$e.includes(et)),...Qe])});return Re.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Re.disconnect()}},[t,s,me==null?void 0:me.anchorSelect,D]),h.useEffect(()=>{ue()},[ue]),h.useEffect(()=>{if(!(Q!=null&&Q.current))return()=>null;const H=new ResizeObserver(()=>{setTimeout(()=>ue())});return H.observe(Q.current),()=>{H.disconnect()}},[ne,Q==null?void 0:Q.current]),h.useEffect(()=>{var H;const re=document.querySelector(`[id='${o}']`),ie=[...Ke,re];D&&ie.includes(D)||L((H=Ke[0])!==null&&H!==void 0?H:re)},[o,Ke,D]),h.useEffect(()=>(fe&&Ee(!0),()=>{ht(q),ht(ae)}),[]),h.useEffect(()=>{var H;let re=(H=me==null?void 0:me.anchorSelect)!==null&&H!==void 0?H:s;if(!re&&t&&(re=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),re)try{const ie=Array.from(document.querySelectorAll(re));Me(ie)}catch{Me([])}},[t,s,me==null?void 0:me.anchorSelect]),h.useEffect(()=>{q.current&&(ht(q),Ht(g))},[g]);const ke=(G=me==null?void 0:me.content)!==null&&G!==void 0?G:ne,Mt=Ie&&Object.keys(pe.tooltipStyles).length>0;return h.useImperativeHandle(e,()=>({open:H=>{if(H!=null&&H.anchorSelect)try{document.querySelector(H.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${H.anchorSelect}" is not a valid CSS selector`)}gt(H??null),H!=null&&H.delay?Ht(H.delay):Ee(!0)},close:H=>{H!=null&&H.delay?Dt(H.delay):Ee(!1)},activeAnchor:D,place:pe.place,isOpen:!!(He&&!C&&ke&&Mt)})),He&&!C&&ke?h.createElement(p,{id:t,role:X,className:at("react-tooltip",_n.tooltip,yo.tooltip,yo[i],n,`react-tooltip__place-${pe.place}`,_n[Mt?"show":"closing"],Mt?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&_n.fixed,b&&_n.clickable),onTransitionEnd:H=>{ht(A),Ie||H.propertyName!=="opacity"||(Fe(!1),gt(null),B==null||B())},style:{...z,...pe.tooltipStyles,opacity:F!==void 0&&Mt?F:void 0},ref:K},ke,h.createElement(p,{className:at("react-tooltip-arrow",_n.arrow,yo.arrow,r,y&&_n.noArrow),style:{...pe.tooltipArrowStyles,background:R?`linear-gradient(to right bottom, transparent 50%, ${R} 50%)`:void 0},ref:Z})):null},Qh=({content:e})=>h.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),eg=h.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:i,render:o,className:s,classNameArrow:a,variant:c="dark",place:u="top",offset:d=10,wrapper:f="div",children:m=null,events:p=["hover"],openOnClick:g=!1,positionStrategy:I="absolute",middlewares:_,delayShow:C=0,delayHide:y=0,float:b=!1,hidden:x=!1,noArrow:w=!1,clickable:E=!1,closeOnEsc:j=!1,closeOnScroll:N=!1,closeOnResize:U=!1,openEvents:W,closeEvents:z,globalCloseEvents:Y,imperativeModeOnly:ee=!1,style:B,position:se,isOpen:ne,defaultIsOpen:Q=!1,disableStyleInjection:de=!1,border:fe,opacity:S,arrowColor:D,setIsOpen:L,afterShow:M,afterHide:F,disableTooltip:R,role:X="tooltip"},G)=>{const[K,Z]=h.useState(r),[q,ae]=h.useState(i),[A,pe]=h.useState(u),[$,Ie]=h.useState(c),[Pe,He]=h.useState(d),[Fe,me]=h.useState(C),[gt,Ue]=h.useState(y),[rt,vt]=h.useState(b),[yt,Be]=h.useState(x),[Ke,Me]=h.useState(f),[Oe,It]=h.useState(p),[Xe,At]=h.useState(I),[Vt,ot]=h.useState(null),[Ee,Pt]=h.useState(null),Ht=h.useRef(de),{anchorRefs:Dt,activeAnchor:nn}=Cc(e),Ze=Ce=>Ce==null?void 0:Ce.getAttributeNames().reduce((Ge,te)=>{var ue;return te.startsWith("data-tooltip-")&&(Ge[te.replace(/^data-tooltip-/,"")]=(ue=Ce==null?void 0:Ce.getAttribute(te))!==null&&ue!==void 0?ue:null),Ge},{}),Ft=Ce=>{const Ge={place:te=>{var ue;pe((ue=te)!==null&&ue!==void 0?ue:u)},content:te=>{Z(te??r)},html:te=>{ae(te??i)},variant:te=>{var ue;Ie((ue=te)!==null&&ue!==void 0?ue:c)},offset:te=>{He(te===null?d:Number(te))},wrapper:te=>{var ue;Me((ue=te)!==null&&ue!==void 0?ue:f)},events:te=>{const ue=te==null?void 0:te.split(" ");It(ue??p)},"position-strategy":te=>{var ue;At((ue=te)!==null&&ue!==void 0?ue:I)},"delay-show":te=>{me(te===null?C:Number(te))},"delay-hide":te=>{Ue(te===null?y:Number(te))},float:te=>{vt(te===null?b:te==="true")},hidden:te=>{Be(te===null?x:te==="true")},"class-name":te=>{ot(te)}};Object.values(Ge).forEach(te=>te(null)),Object.entries(Ce).forEach(([te,ue])=>{var ke;(ke=Ge[te])===null||ke===void 0||ke.call(Ge,ue)})};h.useEffect(()=>{Z(r)},[r]),h.useEffect(()=>{ae(i)},[i]),h.useEffect(()=>{pe(u)},[u]),h.useEffect(()=>{Ie(c)},[c]),h.useEffect(()=>{He(d)},[d]),h.useEffect(()=>{me(C)},[C]),h.useEffect(()=>{Ue(y)},[y]),h.useEffect(()=>{vt(b)},[b]),h.useEffect(()=>{Be(x)},[x]),h.useEffect(()=>{At(I)},[I]),h.useEffect(()=>{Ht.current!==de&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[de]),h.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:de==="core",disableBase:de}}))},[]),h.useEffect(()=>{var Ce;const Ge=new Set(Dt);let te=n;if(!te&&e&&(te=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),te)try{document.querySelectorAll(te).forEach(re=>{Ge.add({current:re})})}catch{console.warn(`[react-tooltip] "${te}" is not a valid CSS selector`)}const ue=document.querySelector(`[id='${t}']`);if(ue&&Ge.add({current:ue}),!Ge.size)return()=>null;const ke=(Ce=Ee??ue)!==null&&Ce!==void 0?Ce:nn.current,Mt=new MutationObserver(re=>{re.forEach(ie=>{var Re;if(!ke||ie.type!=="attributes"||!(!((Re=ie.attributeName)===null||Re===void 0)&&Re.startsWith("data-tooltip-")))return;const je=Ze(ke);Ft(je)})}),H={attributes:!0,childList:!1,subtree:!1};if(ke){const re=Ze(ke);Ft(re),Mt.observe(ke,H)}return()=>{Mt.disconnect()}},[Dt,nn,Ee,t,n]),h.useEffect(()=>{B!=null&&B.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),fe&&!Os("border",`${fe}`)&&console.warn(`[react-tooltip] "${fe}" is not a valid \`border\`.`),B!=null&&B.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),S&&!Os("opacity",`${S}`)&&console.warn(`[react-tooltip] "${S}" is not a valid \`opacity\`.`)},[]);let Ut=m;const rn=h.useRef(null);if(o){const Ce=o({content:(Ee==null?void 0:Ee.getAttribute("data-tooltip-content"))||K||null,activeAnchor:Ee});Ut=Ce?h.createElement("div",{ref:rn,className:"react-tooltip-content-wrapper"},Ce):null}else K&&(Ut=K);q&&(Ut=h.createElement(Qh,{content:q}));const Bt={forwardRef:G,id:e,anchorId:t,anchorSelect:n,className:at(s,Vt),classNameArrow:a,content:Ut,contentWrapperRef:rn,place:A,variant:$,offset:Pe,wrapper:Ke,events:Oe,openOnClick:g,positionStrategy:Xe,middlewares:_,delayShow:Fe,delayHide:gt,float:rt,hidden:yt,noArrow:w,clickable:E,closeOnEsc:j,closeOnScroll:N,closeOnResize:U,openEvents:W,closeEvents:z,globalCloseEvents:Y,imperativeModeOnly:ee,style:B,position:se,isOpen:ne,defaultIsOpen:Q,border:fe,opacity:S,arrowColor:D,setIsOpen:L,afterShow:M,afterHide:F,disableTooltip:R,activeAnchor:Ee,setActiveAnchor:Ce=>Pt(Ce),role:X};return h.createElement(Zh,{...Bt})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||xs({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||xs({css:`
49
- .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function tg(){return l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[l.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[l.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_2896_16290",children:l.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function ng({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:tg()}),l.jsx(eg,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function rg(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};if(t.forEach(i=>{const{field:o,value:s}=i;s===null?delete n[o]:n[o]=s}),e!=null&&e.read){const i=e.read.savedConfig.requiredMapFields,s=!Ur(i,n);e.read.isRequiredMapFieldsModified=s}}function jr(e,t,n){t(e,r=>rg(r,n))}function wi({field:e,onSelectChange:t,allFields:n}){var m;const{configureState:r,selectedObjectName:i,setConfigureState:o}=Tt(),[s,a]=h.useState(!0),c=(m=r==null?void 0:r.read)==null?void 0:m.selectedFieldMappings,u=c==null?void 0:c[e.mapToName];h.useEffect(()=>{e._default&&!u&&i&&r&&jr(i,o,[{field:e.mapToName,value:e._default}]),a(!1)},[e,o,i,u,r]);const d=h.useMemo(()=>n.map(p=>({id:p.fieldName,label:p.displayName,value:p.fieldName})),[n]),f=l.jsx(mc,{disabled:s,items:d,selectedValue:u||null,onSelectedItemChange:p=>{t({target:{name:e.mapToName,value:p==null?void 0:p.value}})},placeholder:"Please select one"});return l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[l.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName}),l.jsx("span",{children:(e==null?void 0:e.prompt)&&l.jsx(ng,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),f]},e.mapToName)}function og(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=Tt(),{isError:r,removeError:i}=St(),o=a=>{const{value:c,name:u}=a.target;c&&(e&&jr(e,n,[{field:u,value:c}]),r(_e.MAPPING,u)&&i(_e.MAPPING,u))},s=h.useMemo(()=>{var a;return((a=t==null?void 0:t.read)==null?void 0:a.optionalMapFields)||[]},[t]);return s!=null&&s.length?l.jsxs(l.Fragment,{children:[l.jsx(Fn,{string:"Map the following optional fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:s.map(a=>{var c;return l.jsx(Wo,{id:a.mapToName,children:l.jsx(wi,{allFields:((c=t==null?void 0:t.read)==null?void 0:c.allFields)||[],field:a,onSelectChange:o})},a.mapToName)})})]}):null}const ig=(e,t)=>e.filter(n=>!t.includes(n));function sg(){var m;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Tt(),{fieldMapping:r}=nt(),{isError:i,removeError:o}=St(),s=p=>{const{value:g,name:I}=p.target;g&&(e&&jr(e,n,[{field:I,value:g}]),i(_e.MAPPING,I)&&o(_e.MAPPING,I))},a=h.useMemo(()=>{var _;const p=((_=t==null?void 0:t.read)==null?void 0:_.requiredMapFields)||[],g=e&&r?Object.values(r[e]||{}).flat().filter(C=>!C.fieldName):[];return p.concat(g).reduce((C,y)=>C.find(x=>x.mapToName===y.mapToName)?C.map(x=>x.mapToName===y.mapToName?y:x):C.concat(y),new Array)},[t,r,e]),c=((m=t==null?void 0:t.read)==null?void 0:m.selectedFieldMappings)||{},u=Object.keys(c),d=a.map(p=>p.mapToName),f=ig(u,d);return e&&f.length?(jr(e,n,f.map(p=>({field:p,value:null}))),null):a!=null&&a.length?l.jsxs(l.Fragment,{children:[l.jsx(Fn,{string:"Map the following fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:a.map(p=>{var g;return l.jsx(Wo,{id:p.mapToName,isInvalid:i(_e.MAPPING,p.mapToName),errorMessage:"* required",children:l.jsx(wi,{allFields:((g=t==null?void 0:t.read)==null?void 0:g.allFields)||[],field:p,onSelectChange:s})},p.mapToName)})})]}):null}const ag={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function cg({children:e,style:t}){return l.jsx(Qt,{style:{...ag,...t},children:e})}function lg(){var d,f,m;const{project:e}=Ae(),{hydratedRevision:t}=Dn(),{selectedObjectName:n}=Tt(),{provider:r}=nt(),i=e==null?void 0:e.appName,o=en(r),s=(m=(f=(d=t==null?void 0:t.content)==null?void 0:d.read)==null?void 0:f.objects)==null?void 0:m.find(p=>p.objectName===n),a=(s==null?void 0:s.displayName)||n&&Bn(n),c=s==null?void 0:s.mapToName,u=(s==null?void 0:s.mapToDisplayName)||c&&Bn(c);return u&&i&&o?l.jsx(cg,{style:{marginTop:"1rem"},children:l.jsxs("p",{style:{margin:"1rem 0"},children:[l.jsx("b",{children:u})," in ",i," is mapped to ",l.jsx("b",{children:a})," in ",o,"."]})}):null}function Ts(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Oc(...e){return t=>{let n=!1;const r=e.map(i=>{const o=Ts(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():Ts(e[i],null)}}}}function zn(...e){return V.useCallback(Oc(...e),e)}function Qr(e,t=[]){let n=[];function r(o,s){const a=V.createContext(s),c=n.length;n=[...n,s];const u=f=>{var C;const{scope:m,children:p,...g}=f,I=((C=m==null?void 0:m[e])==null?void 0:C[c])||a,_=V.useMemo(()=>g,Object.values(g));return l.jsx(I.Provider,{value:_,children:p})};u.displayName=o+"Provider";function d(f,m){var I;const p=((I=m==null?void 0:m[e])==null?void 0:I[c])||a,g=V.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,d]}const i=()=>{const o=n.map(s=>V.createContext(s));return function(a){const c=(a==null?void 0:a[e])||o;return V.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[r,ug(i,...t)]}function ug(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:c,scopeName:u})=>{const f=c(o)[`__scope${u}`];return{...a,...f}},{});return V.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function xt(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 _i(e){const t=V.useRef(e);return V.useEffect(()=>{t.current=e}),V.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function bi({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=dg({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=_i(n),c=V.useCallback(u=>{if(o){const f=typeof u=="function"?u(e):u;f!==e&&a(f)}else i(u)},[o,e,i,a]);return[s,c]}function dg({defaultProp:e,onChange:t}){const n=V.useState(e),[r]=n,i=V.useRef(r),o=_i(t);return V.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}function pg(e){const t=V.useRef({value:e,previous:e});return V.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Lr=globalThis!=null&&globalThis.document?V.useLayoutEffect:()=>{};function fg(e){const[t,n]=V.useState(void 0);return Lr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function mg(e,t){return V.useReducer((n,r)=>t[n][r]??n,e)}var xi=e=>{const{present:t,children:n}=e,r=hg(t),i=typeof n=="function"?n({present:r.isPresent}):V.Children.only(n),o=zn(r.ref,gg(i));return typeof n=="function"||r.isPresent?V.cloneElement(i,{ref:o}):null};xi.displayName="Presence";function hg(e){const[t,n]=V.useState(),r=V.useRef({}),i=V.useRef(e),o=V.useRef("none"),s=e?"mounted":"unmounted",[a,c]=mg(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return V.useEffect(()=>{const u=Ir(r.current);o.current=a==="mounted"?u:"none"},[a]),Lr(()=>{const u=r.current,d=i.current;if(d!==e){const m=o.current,p=Ir(u);e?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),Lr(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const I=Ir(r.current).includes(p.animationName);if(p.target===t&&I&&(c("ANIMATION_END"),!i.current)){const _=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=_)})}},m=p=>{p.target===t&&(o.current=Ir(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:V.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Ir(e){return(e==null?void 0:e.animationName)||"none"}function gg(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.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 Kr=V.forwardRef((e,t)=>{const{children:n,...r}=e,i=V.Children.toArray(n),o=i.find(yg);if(o){const s=o.props.children,a=i.map(c=>c===o?V.Children.count(s)>1?V.Children.only(null):V.isValidElement(s)?s.props.children:null:c);return l.jsx(Ko,{...r,ref:t,children:V.isValidElement(s)?V.cloneElement(s,void 0,a):null})}return l.jsx(Ko,{...r,ref:t,children:n})});Kr.displayName="Slot";var Ko=V.forwardRef((e,t)=>{const{children:n,...r}=e;if(V.isValidElement(n)){const i=wg(n);return V.cloneElement(n,{...Ig(r,n.props),ref:t?Oc(t,i):i})}return V.Children.count(n)>1?V.Children.only(null):null});Ko.displayName="SlotClone";var vg=({children:e})=>l.jsx(l.Fragment,{children:e});function yg(e){return V.isValidElement(e)&&e.type===vg}function Ig(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{o(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function wg(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.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 _g=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],tn=_g.reduce((e,t)=>{const n=V.forwardRef((r,i)=>{const{asChild:o,...s}=r,a=o?Kr:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Ci="Checkbox",[bg,Ly]=Qr(Ci),[xg,Cg]=bg(Ci),Ec=V.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:c="on",onCheckedChange:u,form:d,...f}=e,[m,p]=V.useState(null),g=zn(t,x=>p(x)),I=V.useRef(!1),_=m?d||!!m.closest("form"):!0,[C=!1,y]=bi({prop:i,defaultProp:o,onChange:u}),b=V.useRef(C);return V.useEffect(()=>{const x=m==null?void 0:m.form;if(x){const w=()=>y(b.current);return x.addEventListener("reset",w),()=>x.removeEventListener("reset",w)}},[m,y]),l.jsxs(xg,{scope:n,state:C,disabled:a,children:[l.jsx(tn.button,{type:"button",role:"checkbox","aria-checked":Xt(C)?"mixed":C,"aria-required":s,"data-state":Tc(C),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:g,onKeyDown:xt(e.onKeyDown,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:xt(e.onClick,x=>{y(w=>Xt(w)?!0:!w),_&&(I.current=x.isPropagationStopped(),I.current||x.stopPropagation())})}),_&&l.jsx(Og,{control:m,bubbles:!I.current,name:r,value:c,checked:C,required:s,disabled:a,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Xt(o)?!1:o})]})});Ec.displayName=Ci;var Nc="CheckboxIndicator",Sc=V.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=Cg(Nc,n);return l.jsx(xi,{present:r||Xt(o.state)||o.state===!0,children:l.jsx(tn.span,{"data-state":Tc(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Sc.displayName=Nc;var Og=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,s=V.useRef(null),a=pg(n),c=fg(t);V.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(a!==n&&p){const g=new Event("click",{bubbles:r});d.indeterminate=Xt(n),p.call(d,Xt(n)?!1:n),d.dispatchEvent(g)}},[a,n,r]);const u=V.useRef(Xt(n)?!1:n);return l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...o,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Xt(e){return e==="indeterminate"}function Tc(e){return Xt(e)?"indeterminate":e?"checked":"unchecked"}var Rc=Ec,Ac=Sc;function Pc(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Eg=["color"],Dc=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Pc(e,Eg);return h.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}),h.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:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Ng=["color"],Sg=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Pc(e,Ng);return h.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}),h.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:r,fillRule:"evenodd",clipRule:"evenodd"}))});const Tg="_checkboxGroupContainer_1ya1t_1",Rg="_stack_1ya1t_6",Ag="_selectAllContainer_1ya1t_11",Pg="_fieldContainer_1ya1t_18",Dg="_checkbox_1ya1t_1",An={checkboxGroupContainer:Tg,stack:Rg,selectAllContainer:Ag,fieldContainer:Pg,checkbox:Dg};function Fc({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:An.fieldContainer,children:[l.jsx(Rc,{className:An.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(Ac,{children:l.jsx(Dc,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Mc({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return l.jsxs("div",{className:An.selectAllContainer,children:[l.jsx(Rc,{className:An.checkbox,id:e,onCheckedChange:r,children:l.jsxs(Ac,{children:[i&&l.jsx(Sg,{}),t===!0&&l.jsx(Dc,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function kc({children:e}){return l.jsx("div",{className:An.checkboxGroupContainer,children:e})}function jc({children:e}){return l.jsx("div",{className:An.stack,children:e})}function Fg(e,t,n){var i,o;const r=((i=e==null?void 0:e.read)==null?void 0:i.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(o=e.read)!=null&&o.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,c=!Ur(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function Rs(e,t,n,r){t(e,i=>Fg(i,n,r))}function Mg(){var f,m;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Tt(),i=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,o=(p,g)=>{p!=="indeterminate"&&r&&t&&Rs(r,n,g,p)},s=(m=t==null?void 0:t.read)==null?void 0:m.optionalFields,a=p=>{r&&s&&s.forEach(g=>{Gt(g)||Rs(r,n,g.fieldName,p)})},c=!!(s&&s.length>0),u=Object.keys(i||{}).length===(s==null?void 0:s.length),d=!u&&Object.keys(i||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(Fn,{string:`${e} reads the following optional fields`}),l.jsxs(kc,{children:[((s==null?void 0:s.length)||0)>=2&&l.jsx(Mc,{id:"select-all-fields",isChecked:u,label:"Select all",onCheckedChange:a,isIndeterminate:d}),l.jsx(jc,{children:s.map(p=>Gt(p)?null:l.jsx(Fc,{id:p.fieldName,isChecked:!!(i!=null&&i[p==null?void 0:p.fieldName]),label:p.displayName,onCheckedChange:g=>o(g,p.fieldName)},p.fieldName))})]})]})}function kg(){return l.jsx(Mg,{})}const jg={color:"var(--amp-colors-text-regular)",backgroundColor:"var(--amp-colors-bg-highlight)",borderRadius:"4px",display:"inline-block",fontSize:"0.75rem",fontWeight:500,lineHeight:"1.25",padding:"0.25rem 0.5rem"};function Lg({children:e,style:t,...n}){return l.jsx("span",{style:{...jg,...t},...n,children:e})}function Kg(){var r,i,o;const{configureState:e,selectedObjectName:t}=Tt(),{appName:n}=Ae();return l.jsxs(l.Fragment,{children:[l.jsx(Fn,{string:`${n} reads the following ${t} fields`}),l.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(i=(r=e==null?void 0:e.read)==null?void 0:r.requiredFields)!=null&&i.length?(o=e.read)==null?void 0:o.requiredFields.map(s=>Gt(s)?null:l.jsx(Lg,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function $g(){return l.jsxs(l.Fragment,{children:[l.jsx(lg,{}),l.jsx(Kg,{}),l.jsx(sg,{}),l.jsx(lh,{}),l.jsx(og,{}),l.jsx(kg,{})]})}const Vg="_input_10rzg_1",Hg="_inputError_10rzg_27",Ug="_error_10rzg_43",Io={input:Vg,inputError:Hg,error:Ug};function Bg({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?at(Io.inputError,Io.input):Io.input;return l.jsx("input",{id:e,type:t,className:at(o,n),...i})}function qg(e,t,n){var r,i,o;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedNonConfigurableWriteFields)===null&&(e.write.selectedNonConfigurableWriteFields={}),e!=null&&e.write){const s=e.write.selectedNonConfigurableWriteFields;if(s[t]=n,n||delete s[t],(o=(i=e==null?void 0:e.write)==null?void 0:i.savedConfig)!=null&&o.selectedNonConfigurableWriteFields){const a=e.write.savedConfig.selectedNonConfigurableWriteFields,u=!Ur(a,s);e.write.isWriteModified=u}}}function As(e,t,n,r){t(e,i=>{qg(i,n,r)})}function Wg(){var f,m,p,g;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Tt(),i=(f=n==null?void 0:n.write)==null?void 0:f.selectedNonConfigurableWriteFields,o=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects,s=(I,_)=>{I!=="indeterminate"&&t&&n&&As(t,r,_,I)},a=I=>{var _,C;t&&n&&((C=(_=n==null?void 0:n.write)==null?void 0:_.writeObjects)==null||C.forEach(y=>{As(t,r,y.objectName,I)}))},c=!!o,u=Object.keys(i||{}).length===((g=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null?void 0:g.length),d=!u&&Object.keys(i||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(Fn,{string:`Allow ${e} to write to these objects`}),l.jsxs(kc,{children:[((o==null?void 0:o.length)||0)>=2&&l.jsx(Mc,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:u,label:"Select all"}),l.jsx(jc,{children:o.map(I=>l.jsx(Fc,{id:I.objectName,onCheckedChange:_=>s(_,I.objectName),isChecked:!!(i!=null&&i[I.objectName]),label:I.displayName},I.objectName))})]})]})}const Jg=!1;function zg(){return l.jsxs(l.Fragment,{children:[l.jsx(Wg,{}),Jg]})}function Lc({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const r=ze(),{projectId:i}=Ae(),{integrationId:o,installation:s,resetInstallations:a,setIntegrationDeleted:c,onUninstallSuccess:u}=nt(),[d,f]=h.useState(!1),m=!i||!o||!(s!=null&&s.id)||d,p=async()=>{if(!m){f(!0),console.warn("uninstalling installation",{projectId:i,integrationId:o,installationId:s.id});try{await Te().installationApi.deleteInstallation({projectIdOrName:i,integrationId:o,installationId:s.id},{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}),console.warn("successfully uninstalled installation:",s.id),u==null||u(s==null?void 0:s.id),a(),c()}catch(_){console.error("Error uninstalling installation."),Je(_)}finally{f(!1)}}},g=d?"Uninstalling...":e,I=l.jsx(lt,{type:"button",onClick:p,disabled:m,variant:t,style:n,children:g});return s!=null&&s.id?I:null}function Xg(){const{appName:e}=Ae(),{installation:t}=nt();return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t!=null&&t.id?l.jsxs("p",{children:["Once you uninstall this integration, all your configuration will be lost, and"," ",l.jsx("b",{children:e})," may stop working."]}):l.jsx("p",{children:"You've successfully uninstalled the integration."}),l.jsx(Lc,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}function Kc({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){var E,j,N,U;const{installation:o}=nt(),{hydratedRevision:s,loading:a}=Dn(),{configureState:c,selectedObjectName:u}=Tt(),d=o==null?void 0:o.config,f=d&&u&&!!sa(d,u)||!1,m=((E=c==null?void 0:c.read)==null?void 0:E.isOptionalFieldsModified)||((j=c==null?void 0:c.read)==null?void 0:j.isRequiredMapFieldsModified)||((N=c==null?void 0:c.read)==null?void 0:N.isValueMappingsModified),p=(U=c==null?void 0:c.write)==null?void 0:U.isWriteModified,C=a||n||!c||!u||!(m||p||r||u!==mn&&!f),y=u===mn,b=u===Er,x=l.jsx(lt,{type:"submit",disabled:C,children:r?"Install":"Save"}),w=l.jsx(lt,{type:"button",onClick:t,disabled:C,variant:"ghost",children:"Reset"});return n?l.jsx(Un,{}):l.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px"},children:[x,w]}),l.jsxs(Qt,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[i&&l.jsx(va,{children:typeof i=="string"?i:"Installation Failed."}),a&&l.jsx(Un,{}),s&&!b&&!y&&l.jsx($g,{}),s&&!b&&y&&l.jsx(zg,{}),!a&&b&&l.jsx(Xg,{})]})]})}const $c=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o}=nt(),{hydratedRevision:s,loading:a}=Dn(),{selectedObjectName:c}=_a(),{selectedConnection:u}=In(),d=ze(),{projectId:f}=Ae(),{resetBoundary:m,setErrors:p,setError:g,getError:I}=St(),{resetConfigureState:_,objectConfigurationsState:C,resetPendingConfigurationState:y}=Xo(),b=ha(c||"",C),{onNextIncompleteTab:x}=kf(),w=h.useCallback(()=>{m(_e.INSTALLATION_MUTATION)},[m]),E=h.useCallback(N=>N?U=>{g(_e.INSTALLATION_MUTATION,N,U)}:U=>{console.error("objectName is required to set installation error: ",U)},[g]),j=h.useCallback(N=>N?I(_e.INSTALLATION_MUTATION,N):"",[I]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:u,apiKey:d,projectId:f,resetBoundary:m,setErrors:p,setMutateInstallationError:E,getMutateInstallationError:j,resetMutateInstallationErrorState:w,resetConfigureState:_,objectConfigurationsState:C,resetPendingConfigurationState:y,configureState:b,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:x}},Gg=void 0;function Yg(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:i,loading:o,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:u,resetBoundary:d,setErrors:f,setMutateInstallationError:m,getMutateInstallationError:p,resetMutateInstallationErrorState:g,resetConfigureState:I,objectConfigurationsState:_,resetPendingConfigurationState:C,configureState:y,onInstallSuccess:b,onNextIncompleteTab:x}=$c(),[w,E]=h.useState(!1),j=s===mn,N=p(s),U=h.useCallback(()=>{d(_e.MAPPING),i!=null&&i.content&&!o&&s&&da(i,Gg,s,I)},[d,i,o,s,I]);h.useEffect(()=>{!y&&(i!=null&&i.content)&&!o&&U()},[y,_,i,o,U]);const W=()=>{g();const{requiredMapFields:ee,selectedFieldMappings:B}=(y==null?void 0:y.read)||{},{errorList:se}=la(ee,B,f);se.length>0||(s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&i?(E(!0),yf(u,e,t,n,a.id,s,c,i,y,m(s),r,b).finally(()=>{E(!1),C(s),x()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},z=()=>{g(),s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&i?(E(!0),_f(u,e,t,n,a.id,c,i,y,m(s),r,b).finally(()=>{E(!1),C(s),x()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},Y=ee=>{ee.preventDefault(),j?z():W()};return l.jsx(Kc,{errorMsg:N,isCreateMode:!0,isLoading:w,onSave:Y,onReset:U})}function Zg({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:i,selectedObjectName:o,setInstallation:s,onUpdateSuccess:a,setError:c}){const u={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${o}`],installation:{config:e}}};return Te().installationApi.updateInstallation(u,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}}).then(d=>{s(d),a==null||a(d.id,d.config)}).catch(d=>{Je(d,c)})}const Qg=(e,t,n,r,i,o)=>{const s=pa(e),a=fa(e),c=ma(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:c||{},backfill:o}}}}};return Br(i)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},ev=(e,t,n,r,i,o,s,a,c,u,d)=>{const f=Qg(o,r||"",a,a.schedule,c,a.backfill);return f?Zg({updateConfig:f,projectId:e,integrationId:t,installationId:n,apiKey:i,selectedObjectName:r,setError:u,setInstallation:s,onUpdateSuccess:d}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},tv=(e,t)=>{const r={content:{write:{objects:ga(e)}}};return Br(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},nv=(e,t,n,r,i,o,s,a,c)=>{const u=tv(i,o);if(!u)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const d={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:u}}};return Te().installationApi.updateInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(f=>{a(f),c==null||c(f.id,f.config)}).catch(f=>{Je(f,s)})};function rv({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:i,selectedObjectName:o,apiKey:s,projectId:a,resetBoundary:c,setErrors:u,setMutateInstallationError:d,getMutateInstallationError:f,resetConfigureState:m,resetPendingConfigurationState:p,configureState:g,onUpdateSuccess:I,onNextIncompleteTab:_}=$c(),[C,y]=h.useState(!1),b=o===mn,x=f(o),{config:w}=e,E=h.useCallback(()=>{c(_e.MAPPING),r!=null&&r.content&&!i&&o&&da(r,w,o,m)},[c,r,i,o,w,m]);h.useEffect(()=>{g||E()},[g,E]),h.useEffect(()=>{e&&E()},[e,E]);const j=h.useMemo(()=>{var Y,ee,B;return(B=(ee=(Y=r==null?void 0:r.content)==null?void 0:Y.read)==null?void 0:ee.objects)==null?void 0:B.find(se=>(se==null?void 0:se.objectName)===o)},[r,o]),N=()=>{const{requiredMapFields:z,selectedFieldMappings:Y}=(g==null?void 0:g.read)||{},{errorList:ee}=la(z,Y,u);ee.length>0||(r&&e&&o&&s&&a&&j?(y(!0),ev(a,t.id,e.id,o,s,g,n,j,r,d(o),I).finally(()=>{y(!1),p(o),_()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},U=()=>{e&&o&&s&&a&&r?(y(!0),nv(a,t.id,e.id,s,g,r,d(o),n,I).finally(()=>{y(!1),p(o),_()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},W=z=>{z.preventDefault(),b?U():N()};return l.jsx(Kc,{errorMsg:x,onSave:W,onReset:E,isLoading:C})}function ov(){const{integrationObj:e,installation:t}=nt();return e?t&&e?l.jsx(rv,{installation:t,integrationObj:e}):l.jsx(Yg,{}):l.jsx(Zs,{message:"We can't load the integration"})}const iv=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function sv({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:i,apiKey:o,hydratedRevision:s,setError:a,setInstallation:c,onInstallSuccess:u}){const d=iv(s,r);return d?qo({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:a,setInstallation:c,onInstallSuccess:u}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function av(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),l.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Oi({text:e,children:t}){return l.jsx(Pn,{children:l.jsxs(Qt,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[l.jsx(av,{}),l.jsx("p",{children:e}),t]})})}function cv({provider:e}){const t=`You have successfully installed your ${en(e)} integration.`;return l.jsx(Oi,{text:t,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(Lc,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const lv=e=>{const{read:t,write:n,proxy:r}=(e==null?void 0:e.content)??{};return!t&&!n&&(r==null?void 0:r.enabled)||!1};function uv({children:e}){var b;const{projectId:t}=Ae(),n=ze(),{hydratedRevision:r,loading:i}=Dn(),{integrationObj:o,installation:s,groupRef:a,consumerRef:c,setInstallation:u,onInstallSuccess:d,isIntegrationDeleted:f}=nt(),{selectedConnection:m}=In(),[p,g]=h.useState(!1),I=i||p,_=(b=r==null?void 0:r.content)==null?void 0:b.provider,C=lv(r),y=x=>{console.error("Error when creating proxy installation:",x)};return h.useEffect(()=>{!I&&r&&C&&!s&&m&&n&&(o!=null&&o.id)&&!f&&(g(!0),sv({apiKey:n,projectId:t,integrationId:o==null?void 0:o.id,groupRef:a,consumerRef:c,connectionId:m==null?void 0:m.id,hydratedRevision:r,setError:y,setInstallation:u,onInstallSuccess:d}).then(()=>{g(!1)}).catch(x=>{g(!1),console.error("Error when creating proxy installation:",x)}))},[r,C,s,m,n,t,o==null?void 0:o.id,a,c,u,I,d,f]),o?I?l.jsx(Hr,{}):C&&_&&s?l.jsx(cv,{provider:_}):l.jsx("div",{children:e}):l.jsx($t,{message:"We can't load the integration"})}function Vc(){return l.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[l.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),l.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:l.jsxs("picture",{children:[l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",media:"(prefers-color-scheme: light)"}),l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1735853540/ampersand_logo_white.svg",media:"(prefers-color-scheme: dark)"}),l.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})]})})]})}function Qn({children:e}){return l.jsx(Pn,{children:l.jsxs(Qt,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(Vc,{})]})})}function er({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function tr({error:e}){return e?l.jsx(va,{style:{marginTop:"2em"},children:e}):null}function Ei({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:i,title:o}){if(!o&&!r)throw new Error("Either title or providerName is required");return l.jsxs(Qn,{children:[l.jsx(er,{children:o||`Set up ${r} integration`}),l.jsx(tr,{error:t}),i,l.jsx(lt,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const dv="_link_oo2kv_1",pv={link:dv};function Hc({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return l.jsx("a",{className:at(pv.link,t),style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i})}function Uc({url:e,providerDisplayName:t,credentialName:n}){return l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[l.jsx(Hc,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const fv="_textarea_18zl4_1",mv="_textareaError_18zl4_14",hv="_error_18zl4_29",wo={textarea:fv,textareaError:mv,error:hv};function gv({className:e,isError:t=!1,...n}){const r=t?at(wo.textareaError,wo.textarea):wo.textarea;return l.jsx("textarea",{className:at(e,r),...n})}const Kt={Input:Bg,Textarea:gv};function vv({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var I;const[o,s]=h.useState(!1),a=()=>s(_=>!_),[c,u]=h.useState(""),d=_=>u(_.currentTarget.value),f=c.length>0,m=i||!f,p=en(e,t),g=(I=t.apiKeyOpts)==null?void 0:I.docsURL;return l.jsx(Ei,{providerName:p,handleSubmit:()=>{n({apiKey:c})},error:r,isButtonDisabled:m,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[g&&l.jsx(Uc,{url:g,providerDisplayName:p,credentialName:"API key"}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Kt.Input,{id:"password",name:"password",type:o?"text":"password",placeholder:"API Key",onChange:_=>d(_)}),l.jsx(lt,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function yv({...e}){return l.jsx(vv,{...e})}function Iv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const u=Ae(),[d,f]=h.useState(!1),[m,p]=h.useState(null),g=ze();h.useEffect(()=>{if(e&&Te&&d&&m!=null){const _={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:m};Te().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:_},{headers:{"X-Api-Key":g??"","Content-Type":"application/json"}}).then(C=>{c(C)}).catch(C=>{console.error("Error loading provider info."),Je(C)})}},[g,e,d,r,n,o,i,u,c,m]);const I=_=>{p(_.apiKey),f(!0)};return a===null?l.jsx(yv,{provider:e,providerInfo:t,handleSubmit:I,error:null}):s}function wv({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var C;const[o,s]=h.useState(!1),a=()=>s(y=>!y),[c,u]=h.useState({username:"",password:""}),{username:d,password:f}=c,m=en(e,t),p=(C=t.basicOpts)==null?void 0:C.docsURL,g=d.length>0,I=i||!g,_=y=>{const{name:b,value:x}=y.currentTarget;u(w=>({...w,[b]:x}))};return l.jsx(Ei,{providerName:m,handleSubmit:()=>{n({user:d,pass:f})},error:r,isButtonDisabled:I,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[p&&l.jsx(Uc,{url:p,providerDisplayName:m,credentialName:"credentials"}),l.jsx(Kt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:y=>_(y)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Kt.Input,{id:"password",name:"password",type:o?"text":"password",placeholder:"Password",onChange:y=>_(y)}),l.jsx(lt,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function _v({...e}){return l.jsx(wv,{...e})}function bv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const u=Ae(),[d,f]=h.useState(!1),[m,p]=h.useState(null),g=ze();h.useEffect(()=>{if(e&&Te&&d&&m!=null){const _={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m.user,password:m.pass}};Te().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:_},{headers:{"X-Api-Key":g??"","Content-Type":"application/json"}}).then(C=>{c(C)}).catch(C=>{console.error("Error loading provider info."),Je(C)})}},[g,e,d,r,n,o,i,u,m,c]);const I=_=>{const{user:C,pass:y}=_;p({user:C,pass:y}),f(!0)};return a===null?l.jsx(_v,{provider:e,providerInfo:t,handleSubmit:I,error:null}):s}function xv({...e}){return l.jsx(Ei,{...e})}function Cv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,setSelectedConnection:a,providerName:c}){const u=Ae(),d=ze(),[f,m]=h.useState(!1);h.useEffect(()=>{if(e&&Te&&f){const g={groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e};Te().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:g},{headers:{"X-Api-Key":d??"","Content-Type":"application/json"}}).then(I=>{a(I)}).catch(I=>{console.error("Error loading provider info."),Je(I)})}},[d,e,f,n,t,i,r,a,u]);const p=()=>{m(!0)};return s===null?l.jsx(xv,{handleSubmit:p,error:null,providerName:c}):o}const Ov=Uo("VITE_AMP_ENABLE_CSRF",!1),Ev=Uo("NEXT_AMP_ENABLE_CSRF",!1),Nv=Uo("REACT_APP_AMP_ENABLE_CSRF",!1),Sv=!!Ov||!!Ev||!!Nv,Bc=async(e,t,n,r,i,o,s,a)=>{var u,d;const c=await Te().providerApi.getProvider({provider:i},{headers:{"X-Api-Key":r??""}});if(!c)throw new Error(`Provider ${i} not found`);if(c.authType==="oauth2"&&(((u=c.oauth2Opts)==null?void 0:u.grantType)==="authorizationCode"||((d=c.oauth2Opts)==null?void 0:d.grantType)==="authorizationCodePKCE")){const m=(await Te().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(_=>_.provider===i),p=en(i,c);if(!m)throw new Error(`You must first set up a ${p} Provider App using the Ampersand Console.`);const g={connectOAuthParams:{providerWorkspaceRef:o,projectId:e,groupRef:n,groupName:a,consumerRef:t,consumerName:s,providerAppId:m.id,provider:i,enableCSRFProtection:Sv}};return await Te().oAuthApi.oauthConnect(g,{credentials:"include",headers:{"X-Api-Key":r??"","Content-Type":"application/json"}})}throw new Error(`Provider ${i} does not support an OAuth2 web flow.`)},Ps=600,Ds=600,Tv="AUTHORIZATION_SUCCEEDED",Rv="AUTHORIZATION_FAILED";function Av(e,t,n){return h.useCallback(async r=>{const i=await Te().connectionApi.getConnection({projectIdOrName:e,connectionId:r},{headers:{"X-Api-Key":t??""}});n(i)},[e,t,n])}function Pv(e,t,n,r){return h.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-Ps)/2,o=window.screenY+(window.outerHeight-Ds)/2.5,s=`width=${Ps},height=${Ds},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function Dv(e,t){return h.useCallback(n=>{var r,i;if(n.origin===Fp){if(n.data.eventType===Tv){const o=(r=n.data.data)==null?void 0:r.connection;o?e(o):console.error("Connection ID not found in event data: ",{event:n})}n.data.eventType===Rv&&(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 qc({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i}){const o=ze(),{projectId:s}=Ae(),[a,c]=h.useState(null),[u,d]=h.useState(null),{setSelectedConnection:f}=In(),m=Dv(c,r),p=Pv(n,d,m,t),g=Av(s,o,f);return h.useEffect(()=>{t&&!u&&p()},[t,u,p,m,n]),h.useEffect(()=>{a&&g(a).then(()=>{u==null||u.close()}).catch(I=>{console.error("Error refreshing connection: ",I),r==null||r(I.message??"Unexpected error: not able to refresh connection")})},[a,o,f,g,u,r]),h.useEffect(()=>{if(!u)return;const I=setInterval(()=>{u.closed&&(clearInterval(I),window.removeEventListener("message",m),d(null),!a&&!i?(console.error("OAuth failed. Please try again."),r==null||r("OAuth failed. Please try again.")):a&&(r==null||r(null)))},500);return()=>{clearInterval(I),window.removeEventListener("message",m)}},[u,a,i,m,r]),l.jsx("div",{children:e})}function Fv({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(Qn,{children:[l.jsx(er,{children:`Set up ${r} integration`}),l.jsx(tr,{error:t}),l.jsx(lt,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function Mv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Ae(),a=ze(),[c,u]=h.useState(null),[d,f]=h.useState(null),m=async()=>{f(null);try{const g=await Bc(s,t,r,a,e,void 0,n,i);u(g)}catch(g){console.error("Could not fetch OAuth popup URL."),Je(g),f(g.message??"Unexpected error")}},p=h.useCallback(g=>{f(g),u(null)},[]);return l.jsx(qc,{windowTitle:`Connect to ${o}`,oauthUrl:c,onError:p,children:l.jsx(Fv,{handleSubmit:m,error:d,providerName:o})})}const kv="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function jv({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(Qn,{children:[l.jsx(er,{children:"Enter your Salesforce subdomain"}),l.jsx(Hc,{href:kv,newTab:!0,children:"What is my Salesforce subdomain?"}),l.jsx(tr,{error:n}),l.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[l.jsx(Kt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:i=>t(i.currentTarget.value)}),l.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),l.jsx(lt,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function Lv({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:i}){return l.jsxs(Qn,{children:[l.jsxs(er,{children:["Enter your ",i," workspace"]}),l.jsx(tr,{error:n}),l.jsx("br",{}),l.jsx(Kt.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:o=>t(o.currentTarget.value)}),l.jsx("br",{}),l.jsx(lt,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Kv="salesforce";function $v({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Ae(),a=ze(),[c,u]=h.useState(""),[d,f]=h.useState(null),[m,p]=h.useState(null),g=async()=>{if(p(null),!c){p("Workspace is required");return}try{const C=await Bc(s,t,r,a,e,c,n,i);f(C)}catch(C){console.error(C),p((C==null?void 0:C.message)??"Unexpected error")}},I=h.useCallback(C=>{p(C),f(null)},[]),_=e===Kv?l.jsx(jv,{handleSubmit:g,setWorkspace:u,error:m,isButtonDisabled:c.length===0}):l.jsx(Lv,{handleSubmit:g,setWorkspace:u,error:m,isButtonDisabled:c.length===0,providerName:o});return l.jsx(qc,{windowTitle:`Connect to ${o}`,oauthUrl:d,onError:I,children:_})}function Vv({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:i,explicitWorkspaceRequired:o}){const[s,a]=h.useState(!1),[c,u]=h.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),d=()=>a(w=>!w),f=w=>{const{name:E,value:j}=w.currentTarget;u(N=>({...N,[E]:j}))},{clientSecret:m,clientId:p,workspace:g,scopes:I}=c,_=m.length>0,C=p.length>0,y=o?g.length>0:!0,b=n||!_||!C||!y,x=()=>{const w={clientId:p,clientSecret:m};o&&(w.workspace=g),i&&I.length>0&&(w.scopes=Qp(I)),e(w)};return l.jsxs(Qn,{children:[l.jsx(er,{children:`Set up ${r} integration`}),l.jsx(tr,{error:t}),l.jsx("br",{}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[o&&l.jsx(Kt.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:w=>f(w)}),l.jsx(Kt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:w=>f(w)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Kt.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:w=>f(w)}),l.jsx(lt,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:d,children:s?"Hide":"Show"})]}),i&&l.jsx(Kt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:w=>f(w)})]}),l.jsx("br",{}),l.jsx(lt,{style:{marginTop:"1em",width:"100%"},disabled:b,type:"submit",onClick:x,children:"Next"})]})}function Hv({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c,setSelectedConnection:u}){const{projectId:d}=Ae(),f=ze(),[m,p]=h.useState(null),g=async I=>{p(null);const _={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:I.workspace,oauth2ClientCredentials:{clientId:I.clientId,clientSecret:I.clientSecret,scopes:I.scopes}};Te().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:_},{headers:{"X-Api-Key":f??"","Content-Type":"application/json"}}).then(C=>{u(C)}).catch(C=>{console.error("Error loading provider info."),Je(C),p("Error loading provider info")})};return c===null?l.jsx(Vv,{providerName:t,handleSubmit:g,error:m,explicitScopesRequired:s,explicitWorkspaceRequired:a}):l.jsx(Un,{})}function Uv({...e}){return l.jsx(Hv,{...e})}const Bv="authorizationCode",qv="authorizationCodePKCE",Wv="clientCredentials";function Jv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,selectedConnection:s,setSelectedConnection:a}){if(t.oauth2Opts===void 0)return l.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:c,explicitScopesRequired:u,explicitWorkspaceRequired:d}=t.oauth2Opts,f=en(e,t),m={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:f};return c===Bv||c===qv?d?l.jsx($v,{...m}):l.jsx(Mv,{...m}):c===Wv?l.jsx(Uv,{...m,explicitWorkspaceRequired:d,explicitScopesRequired:u,selectedConnection:s,setSelectedConnection:a}):c==="password"?l.jsx("em",{children:"Password flow not supported yet"}):l.jsxs("em",{children:["Unsupported grant type: ",c]})}function zv(e){const{selectedConnection:t}=In();h.useEffect(()=>{e&&t&&e(t)},[e,t])}function Xv({onSuccess:e}){zv(e)}const Gv=async(e,t)=>{const n=await Te().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!n)throw new Error(`Provider ${t} not found`);return n};function Wc({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const u=ze(),[d,f]=h.useState(null),{provider:m,isIntegrationDeleted:p}=nt(),{selectedConnection:g,setSelectedConnection:I}=In();Xv({onSuccess:s});const _=e||m,C=(d==null?void 0:d.displayName)??Bn(_);if(h.useEffect(()=>{Gv(u,_).then(b=>{f(b)}).catch(b=>{console.error("Error loading provider info."),Je(b)})},[u,_]),!e&&!m)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return l.jsx(Oi,{text:"Integration successfully uninstalled.",children:l.jsx(lt,{type:"button",onClick:c,style:{width:"100%"},children:"Reinstall Integration"})});if(g)return o;if(d==null)return l.jsx("strong",{children:"Provider not found"});const y={provider:_,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:g,setSelectedConnection:I,providerName:C,providerInfo:d,onDisconnectSuccess:a};return d.authType==="none"?l.jsx(Cv,{...y,children:o}):d.authType==="basic"?l.jsx(bv,{...y,children:o}):d.authType==="apiKey"?l.jsx(Iv,{...y,children:o}):l.jsx(Jv,{...y})}function Yv(e){const t=e+"CollectionProvider",[n,r]=Qr(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:g,children:I}=p,_=h.useRef(null),C=h.useRef(new Map).current;return l.jsx(i,{scope:g,itemMap:C,collectionRef:_,children:I})};s.displayName=t;const a=e+"CollectionSlot",c=h.forwardRef((p,g)=>{const{scope:I,children:_}=p,C=o(a,I),y=zn(g,C.collectionRef);return l.jsx(Kr,{ref:y,children:_})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=h.forwardRef((p,g)=>{const{scope:I,children:_,...C}=p,y=h.useRef(null),b=zn(g,y),x=o(u,I);return h.useEffect(()=>(x.itemMap.set(y,{ref:y,...C}),()=>void x.itemMap.delete(y))),l.jsx(Kr,{[d]:"",ref:b,children:_})});f.displayName=u;function m(p){const g=o(e+"CollectionConsumer",p);return h.useCallback(()=>{const _=g.collectionRef.current;if(!_)return[];const C=Array.from(_.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((x,w)=>C.indexOf(x.ref.current)-C.indexOf(w.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},m,r]}var Zv=V.useId||(()=>{}),Qv=0;function Jc(e){const[t,n]=V.useState(Zv());return Lr(()=>{e||n(r=>r??String(Qv++))},[e]),e||(t?`radix-${t}`:"")}var ey=V.createContext(void 0);function zc(e){const t=V.useContext(ey);return e||t||"ltr"}var _o="rovingFocusGroup.onEntryFocus",ty={bubbles:!1,cancelable:!0},eo="RovingFocusGroup",[$o,Xc,ny]=Yv(eo),[ry,Gc]=Qr(eo,[ny]),[oy,iy]=ry(eo),Yc=V.forwardRef((e,t)=>l.jsx($o.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx($o.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(sy,{...e,ref:t})})}));Yc.displayName=eo;var sy=V.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,m=V.useRef(null),p=zn(t,m),g=zc(o),[I=null,_]=bi({prop:s,defaultProp:a,onChange:c}),[C,y]=V.useState(!1),b=_i(u),x=Xc(n),w=V.useRef(!1),[E,j]=V.useState(0);return V.useEffect(()=>{const N=m.current;if(N)return N.addEventListener(_o,b),()=>N.removeEventListener(_o,b)},[b]),l.jsx(oy,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:I,onItemFocus:V.useCallback(N=>_(N),[_]),onItemShiftTab:V.useCallback(()=>y(!0),[]),onFocusableItemAdd:V.useCallback(()=>j(N=>N+1),[]),onFocusableItemRemove:V.useCallback(()=>j(N=>N-1),[]),children:l.jsx(tn.div,{tabIndex:C||E===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:xt(e.onMouseDown,()=>{w.current=!0}),onFocus:xt(e.onFocus,N=>{const U=!w.current;if(N.target===N.currentTarget&&U&&!C){const W=new CustomEvent(_o,ty);if(N.currentTarget.dispatchEvent(W),!W.defaultPrevented){const z=x().filter(ne=>ne.focusable),Y=z.find(ne=>ne.active),ee=z.find(ne=>ne.id===I),se=[Y,ee,...z].filter(Boolean).map(ne=>ne.ref.current);el(se,d)}}w.current=!1}),onBlur:xt(e.onBlur,()=>y(!1))})})}),Zc="RovingFocusGroupItem",Qc=V.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,a=Jc(),c=o||a,u=iy(Zc,n),d=u.currentTabStopId===c,f=Xc(n),{onFocusableItemAdd:m,onFocusableItemRemove:p}=u;return V.useEffect(()=>{if(r)return m(),()=>p()},[r,m,p]),l.jsx($o.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:l.jsx(tn.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:xt(e.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:xt(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:xt(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const I=ly(g,u.orientation,u.dir);if(I!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let C=f().filter(y=>y.focusable).map(y=>y.ref.current);if(I==="last")C.reverse();else if(I==="prev"||I==="next"){I==="prev"&&C.reverse();const y=C.indexOf(g.currentTarget);C=u.loop?uy(C,y+1):C.slice(y+1)}setTimeout(()=>el(C))}})})})});Qc.displayName=Zc;var ay={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function cy(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function ly(e,t,n){const r=cy(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ay[r]}function el(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function uy(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var dy=Yc,py=Qc,Ni="Tabs",[fy,Ky]=Qr(Ni,[Gc]),tl=Gc(),[my,Si]=fy(Ni),nl=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=zc(a),[f,m]=bi({prop:r,onChange:i,defaultProp:o});return l.jsx(my,{scope:n,baseId:Jc(),value:f,onValueChange:m,orientation:s,dir:d,activationMode:c,children:l.jsx(tn.div,{dir:d,"data-orientation":s,...u,ref:t})})});nl.displayName=Ni;var rl="TabsList",ol=V.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=Si(rl,n),s=tl(n);return l.jsx(dy,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:l.jsx(tn.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});ol.displayName=rl;var il="TabsTrigger",sl=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=Si(il,n),a=tl(n),c=cl(s.baseId,r),u=ll(s.baseId,r),d=r===s.value;return l.jsx(py,{asChild:!0,...a,focusable:!i,active:d,children:l.jsx(tn.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...o,ref:t,onMouseDown:xt(e.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:xt(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:xt(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!i&&f&&s.onValueChange(r)})})})});sl.displayName=il;var al="TabsContent",hy=V.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=Si(al,n),c=cl(a.baseId,r),u=ll(a.baseId,r),d=r===a.value,f=V.useRef(d);return V.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(xi,{present:i||d,children:({present:m})=>l.jsx(tn.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&o})})});hy.displayName=al;function cl(e,t){return`${e}-trigger-${t}`}function ll(e,t){return`${e}-content-${t}`}var gy=nl,vy=ol,ul=sl;const yy=l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[l.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),l.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function Iy(e,t){return t?h.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},h.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?yy:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:l.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function wy(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.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:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const _y="_tabsRoot_ktpr0_1",by="_tabsList_ktpr0_6",xy="_tabTrigger_ktpr0_12",Cy="_danger_ktpr0_29",Xn={tabsRoot:_y,tabsList:by,tabTrigger:xy,danger:Cy};function dl({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(ul,{value:e,className:Xn.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Iy(t,n),l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsx("span",{children:r||e}),n&&l.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function Oy({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(Go,{style:{margin:"1rem 0"}}),l.jsx(dl,{objectName:mn,completed:e,pending:t,displayName:n},"other-write")]})}function Ey(){return l.jsxs(l.Fragment,{children:[l.jsx(Go,{style:{margin:"3rem 0 1rem 0"}}),l.jsx(ul,{value:Er,className:at(Xn.tabTrigger,Xn.danger),children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[wy(),l.jsx("span",{children:"Uninstall"})]})})]})}function Ny({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:i,showUninstallButton:o}){var s,a;return l.jsx(gy,{value:e,className:Xn.tabsRoot,onValueChange:n,children:l.jsxs(vy,{className:Xn.tabsList,children:[t.map(c=>{var u,d,f,m,p,g;return l.jsx(dl,{objectName:c.name,displayName:c.displayName,completed:c.completed,pending:((d=(u=r==null?void 0:r[c.name])==null?void 0:u.read)==null?void 0:d.isOptionalFieldsModified)||((m=(f=r==null?void 0:r[c.name])==null?void 0:f.read)==null?void 0:m.isRequiredMapFieldsModified)||((g=(p=r==null?void 0:r[c.name])==null?void 0:p.read)==null?void 0:g.isValueMappingsModified)||!1},c.name)}),i&&l.jsx(Oy,{completed:i.completed,pending:((a=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:a.isWriteModified)||!1,displayName:"Write"}),o&&l.jsx(Ey,{})]})})}function Sy(e,t){return t===Er?{name:Er,completed:!1}:e.find(n=>n.name===t)}function Ty({children:e}){var C;const{project:t}=Ae(),{installation:n,provider:r}=nt(),{hydratedRevision:i}=Dn(),{objectConfigurationsState:o}=Xo(),[s,a]=h.useState(""),c=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=i&&aa(u,i),f=d!==null,m=!!((C=i==null?void 0:i.content)!=null&&C.write),p=m?ca(u):void 0,g=h.useMemo(()=>{const y=[...d||[]];return p&&m&&y.push(p),y},[d,p,m]),I=Sy(g,s),_=h.useCallback(()=>{const y=g.find(b=>I!==b&&!b.completed);y&&a(y.name)},[g,I]);return h.useEffect(()=>{!s&&g.length>0&&a(g[0].name)},[g,s,_]),l.jsx(ba.Provider,{value:_,children:l.jsx(wa.Provider,{value:I==null?void 0:I.name,children:l.jsxs(Pn,{style:{maxWidth:"55rem"},children:[l.jsxs(Qt,{style:{display:"flex",gap:"1rem",padding:"3rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[l.jsxs("div",{style:{width:"20rem"},children:[l.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[en(r)," integration"]}),l.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),f&&l.jsx(Ny,{value:s,readNavObjects:d,onValueChange:y=>a(y),objectConfigurationsState:o,writeNavObject:p,showUninstallButton:!!n})]}),e]}),l.jsx(Vc,{})]})})})}function Ry({...e}){return l.jsx(Ty,{...e})}function Ay({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var C;const{projectId:u,projectIdOrName:d,isLoading:f}=Ae(),{isLoading:m}=Ho(),{isError:p,errorState:g}=St(),{seed:I,reset:_}=oa();return f||m?l.jsx(Hr,{}):p(_e.PROJECT,d)?l.jsx($t,{message:`Error loading project ${d}`}):p(_e.INTEGRATION_LIST,d)?l.jsx($t,{message:"Error retrieving integrations for the project, double check the API key"}):(C=g[_e.INTEGRATION_LIST])!=null&&C.apiError?l.jsx($t,{message:"Something went wrong, couldn't find integration information"}):l.jsx("div",{className:ia.resetContainer,children:l.jsx(tf,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:l.jsx(ra,{groupRef:r,children:l.jsx(Wc,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,resetComponent:_,children:l.jsx(Sf,{projectId:u,children:l.jsx(uv,{children:l.jsx(Xf,{children:l.jsx(Ry,{children:l.jsx(ov,{})})})})})})})},I)})}function Py(){return l.jsxs(Pn,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(Un,{}),l.jsx("p",{children:"Redirecting"})]})}function Dy({redirectURL:e,children:t}){return h.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(Py,{}):t}function Fy({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:i}){const o=ze(),{projectId:s}=Ae(),{selectedConnection:a,setConnections:c}=In(),[u,d]=h.useState(!1),f=!s||!a||!a.id||u,m=async()=>{if(!f){d(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id});try{await Te().connectionApi.deleteConnection({projectIdOrName:s,connectionId:a==null?void 0:a.id},{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}),console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),Te().connectionApi.listConnections({projectIdOrName:s},{headers:{"X-Api-Key":o??""}}).then(I=>{c(I),i()}).catch(I=>{Je(I)})}catch(I){console.error("Error deleting connection."),Je(I)}finally{d(!1)}}},p=u?"Disconnecting...":e;return l.jsx(lt,{type:"button",onClick:m,disabled:f,variant:t,style:n,children:p})}function My({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Ae(),i=`You have successfully connected your ${en(e)} account to ${r}.`;return l.jsx(Oi,{text:i,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(Fy,{resetComponent:n,onDisconnectSuccess:t,buttonText:"Remove Connection",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}function ky({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:u,reset:d}=oa(),f=h.useCallback(m=>{s?s(m.id):c&&c(m)},[s,c]);return l.jsx("div",{className:ia.resetContainer,children:l.jsx(ra,{provider:e,groupRef:r,children:l.jsx(Wc,{resetComponent:d,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onSuccess:f,onDisconnectSuccess:a,children:l.jsx(Dy,{redirectURL:o,children:l.jsx(My,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},u)}const jy=(e,t)=>{const n=ze(),{projectId:r,isLoading:i}=Ae(),{integrations:o}=Ho(),[s,a]=h.useState(!1),[c,u]=h.useState(null);if(!n||!i&&!r)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 f=h.useMemo(()=>o==null?void 0:o.reduce((m,p)=>(p==null?void 0:p.name)===e?p:m,{}),[o,e]);return h.useEffect(()=>{!f||i||Te().installationApi.listInstallations({projectIdOrName:r,integrationId:f.id,groupRef:t},{headers:{"x-api-key":n}}).then(m=>{a(!0),u(m.length>0)}).catch(m=>{console.error("Error listing installations."),Je(m),a(!0)})},[t,n,r,f,i]),{isLoaded:s,isIntegrationInstalled:c}};exports.AmpersandContext=Ys;exports.AmpersandProvider=Kp;exports.ConnectProvider=ky;exports.FieldMapping=wi;exports.InstallIntegration=Ay;exports.useAmpersandProvider=$p;exports.useIsIntegrationInstalled=jy;
48
+ */const Oh="react-tooltip-core-styles",Eh="react-tooltip-base-styles",ys={core:!1,base:!1};function ws({css:e,id:t=Eh,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||ys[n]||n==="core"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=Oh),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const a=document.head||document.getElementsByTagName("head")[0],c=document.createElement("style");c.id=t,c.type="text/css",s==="top"&&a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c),c.styleSheet?c.styleSheet.cssText=e:c.appendChild(document.createTextNode(e)),ys[n]=!0}const Is=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[_h(Number(i)),xh({fallbackAxisSideDirection:"start"}),bh({padding:5})],border:a})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const c=s;return n?(c.push(Ch({element:n,padding:5})),vs(e,t,{placement:r,strategy:o,middleware:c}).then(({x:u,y:d,placement:p,middlewareData:f})=>{var m,v;const h={left:`${u}px`,top:`${d}px`,border:a},{x:w,y:C}=(m=f.arrow)!==null&&m!==void 0?m:{x:0,y:0},y=(v={top:"bottom",right:"left",bottom:"top",left:"right"}[p.split("-")[0]])!==null&&v!==void 0?v:"bottom",b=a&&{borderBottom:a,borderRight:a};let x=0;if(a){const _=`${a}`.match(/(\d+)px/);x=_!=null&&_[1]?Number(_[1]):1}return{tooltipStyles:h,tooltipArrowStyles:{left:w!=null?`${w}px`:"",top:C!=null?`${C}px`:"",right:"",bottom:"",...b,[y]:`-${4+x}px`},place:p}})):vs(e,t,{placement:"bottom",strategy:o,middleware:c}).then(({x:u,y:d,placement:p})=>({tooltipStyles:{left:`${u}px`,top:`${d}px`},tooltipArrowStyles:{},place:p}))},_s=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),bs=(e,t,n)=>{let r=null;const i=function(...o){const s=()=>{r=null};!r&&(e.apply(this,o),r=setTimeout(s,t))};return i.cancel=()=>{r&&(clearTimeout(r),r=null)},i},xs=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",Do=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,o)=>Do(i,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!xs(e)||!xs(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(i=>Do(e[i],t[i]))},Nh=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some(n=>{const r=t.getPropertyValue(n);return r==="auto"||r==="scroll"})},Cs=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Nh(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},Sh=typeof window<"u"?g.useLayoutEffect:g.useEffect,ht=e=>{e.current&&(clearTimeout(e.current),e.current=null)},Th="DEFAULT_TOOLTIP_ID",Rh={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},Ah=g.createContext({getTooltipData:()=>Rh});function Ic(e=Th){return g.useContext(Ah).getTooltipData(e)}var bn={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},vo={tooltip:"styles-module_tooltip__mnnfp",arrow:"styles-module_arrow__K0L3T",dark:"styles-module_dark__xNqje",light:"styles-module_light__Z6W-X",success:"styles-module_success__A2AKt",warning:"styles-module_warning__SCK0X",error:"styles-module_error__JvumD",info:"styles-module_info__BWdHW"};const Ph=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:i="dark",anchorId:o,anchorSelect:s,place:a="top",offset:c=10,events:u=["hover"],openOnClick:d=!1,positionStrategy:p="absolute",middlewares:f,wrapper:m,delayShow:v=0,delayHide:h=0,float:w=!1,hidden:C=!1,noArrow:y=!1,clickable:b=!1,closeOnEsc:x=!1,closeOnScroll:_=!1,closeOnResize:E=!1,openEvents:D,closeEvents:N,globalCloseEvents:B,imperativeModeOnly:W,style:q,position:X,afterShow:ee,afterHide:$,disableTooltip:ie,content:te,contentWrapperRef:G,isOpen:le,defaultIsOpen:pe=!1,setIsOpen:S,activeAnchor:M,setActiveAnchor:L,border:k,opacity:F,arrowColor:A,role:Y="tooltip"})=>{var Z;const V=g.useRef(null),Q=g.useRef(null),J=g.useRef(null),ae=g.useRef(null),P=g.useRef(null),[fe,K]=g.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[we,Pe]=g.useState(!1),[He,Me]=g.useState(!1),[me,vt]=g.useState(null),Ue=g.useRef(!1),ot=g.useRef(null),{anchorRefs:yt,setActiveAnchor:wt}=Ic(t),Be=g.useRef(!1),[Ve,Fe]=g.useState([]),Oe=g.useRef(!1),It=d||u.includes("click"),Xe=It||(D==null?void 0:D.click)||(D==null?void 0:D.dblclick)||(D==null?void 0:D.mousedown),At=D?{...D}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!D&&It&&Object.assign(At,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Ht=N?{...N}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!N&&It&&Object.assign(Ht,{mouseleave:!1,blur:!1,mouseout:!1});const it=B?{...B}:{escape:x||!1,scroll:_||!1,resize:E||!1,clickOutsideAnchor:Xe||!1};W&&(Object.assign(At,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Ht,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(it,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),Sh(()=>(Oe.current=!0,()=>{Oe.current=!1}),[]);const Ee=U=>{Oe.current&&(U&&Me(!0),setTimeout(()=>{Oe.current&&(S==null||S(U),le===void 0&&Pe(U))},10))};g.useEffect(()=>{if(le===void 0)return()=>null;le&&Me(!0);const U=setTimeout(()=>{Pe(le)},10);return()=>{clearTimeout(U)}},[le]),g.useEffect(()=>{if(we!==Ue.current)if(ht(P),Ue.current=we,we)ee==null||ee();else{const U=(re=>{const se=re.match(/^([\d.]+)(ms|s)$/);if(!se)return 0;const[,Re,je]=se;return Number(Re)*(je==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));P.current=setTimeout(()=>{Me(!1),vt(null),$==null||$()},U+25)}},[we]);const Pt=U=>{K(re=>Do(re,U)?re:U)},Ut=(U=v)=>{ht(J),He?Ee(!0):J.current=setTimeout(()=>{Ee(!0)},U)},Dt=(U=h)=>{ht(ae),ae.current=setTimeout(()=>{Be.current||Ee(!1)},U)},rn=U=>{var re;if(!U)return;const se=(re=U.currentTarget)!==null&&re!==void 0?re:U.target;if(!(se!=null&&se.isConnected))return L(null),void wt({current:null});v?Ut():Ee(!0),L(se),wt({current:se}),ht(ae)},Qe=()=>{b?Dt(h||100):h?Dt():Ee(!1),ht(J)},Mt=({x:U,y:re})=>{var se;const Re={getBoundingClientRect:()=>({x:U,y:re,width:0,height:0,top:re,left:U,right:U,bottom:re})};Is({place:(se=me==null?void 0:me.place)!==null&&se!==void 0?se:a,offset:c,elementReference:Re,tooltipReference:V.current,tooltipArrowReference:Q.current,strategy:p,middlewares:f,border:k}).then(je=>{Pt(je)})},Bt=U=>{if(!U)return;const re=U,se={x:re.clientX,y:re.clientY};Mt(se),ot.current=se},on=U=>{var re;if(!we)return;const se=U.target;se.isConnected&&(!((re=V.current)===null||re===void 0)&&re.contains(se)||[document.querySelector(`[id='${o}']`),...Ve].some(Re=>Re==null?void 0:Re.contains(se))||(Ee(!1),ht(J)))},Wt=bs(rn,50),Ce=bs(Qe,50),Ge=U=>{Ce.cancel(),Wt(U)},ne=()=>{Wt.cancel(),Ce()},de=g.useCallback(()=>{var U,re;const se=(U=me==null?void 0:me.position)!==null&&U!==void 0?U:X;se?Mt(se):w?ot.current&&Mt(ot.current):M!=null&&M.isConnected&&Is({place:(re=me==null?void 0:me.place)!==null&&re!==void 0?re:a,offset:c,elementReference:M,tooltipReference:V.current,tooltipArrowReference:Q.current,strategy:p,middlewares:f,border:k}).then(Re=>{Oe.current&&Pt(Re)})},[we,M,te,q,a,me==null?void 0:me.place,c,p,X,me==null?void 0:me.position,w]);g.useEffect(()=>{var U,re;const se=new Set(yt);Ve.forEach(Ie=>{ie!=null&&ie(Ie)||se.add({current:Ie})});const Re=document.querySelector(`[id='${o}']`);Re&&!(ie!=null&&ie(Re))&&se.add({current:Re});const je=()=>{Ee(!1)},et=Cs(M),Ke=Cs(V.current);it.scroll&&(window.addEventListener("scroll",je),et==null||et.addEventListener("scroll",je),Ke==null||Ke.addEventListener("scroll",je));let We=null;it.resize?window.addEventListener("resize",je):M&&V.current&&(We=Ih(M,V.current,de,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const tt=Ie=>{Ie.key==="Escape"&&Ee(!1)};it.escape&&window.addEventListener("keydown",tt),it.clickOutsideAnchor&&window.addEventListener("click",on);const be=[],sn=Ie=>{we&&(Ie==null?void 0:Ie.target)===M||rn(Ie)},no=Ie=>{we&&(Ie==null?void 0:Ie.target)===M&&Qe()},pt=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],rr=["click","dblclick","mousedown","mouseup"];Object.entries(At).forEach(([Ie,_t])=>{_t&&(pt.includes(Ie)?be.push({event:Ie,listener:Ge}):rr.includes(Ie)&&be.push({event:Ie,listener:sn}))}),Object.entries(Ht).forEach(([Ie,_t])=>{_t&&(pt.includes(Ie)?be.push({event:Ie,listener:ne}):rr.includes(Ie)&&be.push({event:Ie,listener:no}))}),w&&be.push({event:"pointermove",listener:Bt});const or=()=>{Be.current=!0},ir=()=>{Be.current=!1,Qe()};return b&&!Xe&&((U=V.current)===null||U===void 0||U.addEventListener("mouseenter",or),(re=V.current)===null||re===void 0||re.addEventListener("mouseleave",ir)),be.forEach(({event:Ie,listener:_t})=>{se.forEach(bt=>{var an;(an=bt.current)===null||an===void 0||an.addEventListener(Ie,_t)})}),()=>{var Ie,_t;it.scroll&&(window.removeEventListener("scroll",je),et==null||et.removeEventListener("scroll",je),Ke==null||Ke.removeEventListener("scroll",je)),it.resize?window.removeEventListener("resize",je):We==null||We(),it.clickOutsideAnchor&&window.removeEventListener("click",on),it.escape&&window.removeEventListener("keydown",tt),b&&!Xe&&((Ie=V.current)===null||Ie===void 0||Ie.removeEventListener("mouseenter",or),(_t=V.current)===null||_t===void 0||_t.removeEventListener("mouseleave",ir)),be.forEach(({event:bt,listener:an})=>{se.forEach(ro=>{var kn;(kn=ro.current)===null||kn===void 0||kn.removeEventListener(bt,an)})})}},[M,de,He,yt,Ve,D,N,B,It,v,h]),g.useEffect(()=>{var U,re;let se=(re=(U=me==null?void 0:me.anchorSelect)!==null&&U!==void 0?U:s)!==null&&re!==void 0?re:"";!se&&t&&(se=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Re=new MutationObserver(je=>{const et=[],Ke=[];je.forEach(We=>{if(We.type==="attributes"&&We.attributeName==="data-tooltip-id"&&(We.target.getAttribute("data-tooltip-id")===t?et.push(We.target):We.oldValue===t&&Ke.push(We.target)),We.type==="childList"){if(M){const tt=[...We.removedNodes].filter(be=>be.nodeType===1);if(se)try{Ke.push(...tt.filter(be=>be.matches(se))),Ke.push(...tt.flatMap(be=>[...be.querySelectorAll(se)]))}catch{}tt.some(be=>{var sn;return!!(!((sn=be==null?void 0:be.contains)===null||sn===void 0)&&sn.call(be,M))&&(Me(!1),Ee(!1),L(null),ht(J),ht(ae),!0)})}if(se)try{const tt=[...We.addedNodes].filter(be=>be.nodeType===1);et.push(...tt.filter(be=>be.matches(se))),et.push(...tt.flatMap(be=>[...be.querySelectorAll(se)]))}catch{}}}),(et.length||Ke.length)&&Fe(We=>[...We.filter(tt=>!Ke.includes(tt)),...et])});return Re.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Re.disconnect()}},[t,s,me==null?void 0:me.anchorSelect,M]),g.useEffect(()=>{de()},[de]),g.useEffect(()=>{if(!(G!=null&&G.current))return()=>null;const U=new ResizeObserver(()=>{setTimeout(()=>de())});return U.observe(G.current),()=>{U.disconnect()}},[te,G==null?void 0:G.current]),g.useEffect(()=>{var U;const re=document.querySelector(`[id='${o}']`),se=[...Ve,re];M&&se.includes(M)||L((U=Ve[0])!==null&&U!==void 0?U:re)},[o,Ve,M]),g.useEffect(()=>(pe&&Ee(!0),()=>{ht(J),ht(ae)}),[]),g.useEffect(()=>{var U;let re=(U=me==null?void 0:me.anchorSelect)!==null&&U!==void 0?U:s;if(!re&&t&&(re=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),re)try{const se=Array.from(document.querySelectorAll(re));Fe(se)}catch{Fe([])}},[t,s,me==null?void 0:me.anchorSelect]),g.useEffect(()=>{J.current&&(ht(J),Ut(v))},[v]);const ke=(Z=me==null?void 0:me.content)!==null&&Z!==void 0?Z:te,Ft=we&&Object.keys(fe.tooltipStyles).length>0;return g.useImperativeHandle(e,()=>({open:U=>{if(U!=null&&U.anchorSelect)try{document.querySelector(U.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${U.anchorSelect}" is not a valid CSS selector`)}vt(U??null),U!=null&&U.delay?Ut(U.delay):Ee(!0)},close:U=>{U!=null&&U.delay?Dt(U.delay):Ee(!1)},activeAnchor:M,place:fe.place,isOpen:!!(He&&!C&&ke&&Ft)})),He&&!C&&ke?g.createElement(m,{id:t,role:Y,className:ct("react-tooltip",bn.tooltip,vo.tooltip,vo[i],n,`react-tooltip__place-${fe.place}`,bn[Ft?"show":"closing"],Ft?"react-tooltip__show":"react-tooltip__closing",p==="fixed"&&bn.fixed,b&&bn.clickable),onTransitionEnd:U=>{ht(P),we||U.propertyName!=="opacity"||(Me(!1),vt(null),$==null||$())},style:{...q,...fe.tooltipStyles,opacity:F!==void 0&&Ft?F:void 0},ref:V},ke,g.createElement(m,{className:ct("react-tooltip-arrow",bn.arrow,vo.arrow,r,y&&bn.noArrow),style:{...fe.tooltipArrowStyles,background:A?`linear-gradient(to right bottom, transparent 50%, ${A} 50%)`:void 0},ref:Q})):null},Dh=({content:e})=>g.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),Mh=g.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:i,render:o,className:s,classNameArrow:a,variant:c="dark",place:u="top",offset:d=10,wrapper:p="div",children:f=null,events:m=["hover"],openOnClick:v=!1,positionStrategy:h="absolute",middlewares:w,delayShow:C=0,delayHide:y=0,float:b=!1,hidden:x=!1,noArrow:_=!1,clickable:E=!1,closeOnEsc:D=!1,closeOnScroll:N=!1,closeOnResize:B=!1,openEvents:W,closeEvents:q,globalCloseEvents:X,imperativeModeOnly:ee=!1,style:$,position:ie,isOpen:te,defaultIsOpen:G=!1,disableStyleInjection:le=!1,border:pe,opacity:S,arrowColor:M,setIsOpen:L,afterShow:k,afterHide:F,disableTooltip:A,role:Y="tooltip"},Z)=>{const[V,Q]=g.useState(r),[J,ae]=g.useState(i),[P,fe]=g.useState(u),[K,we]=g.useState(c),[Pe,He]=g.useState(d),[Me,me]=g.useState(C),[vt,Ue]=g.useState(y),[ot,yt]=g.useState(b),[wt,Be]=g.useState(x),[Ve,Fe]=g.useState(p),[Oe,It]=g.useState(m),[Xe,At]=g.useState(h),[Ht,it]=g.useState(null),[Ee,Pt]=g.useState(null),Ut=g.useRef(le),{anchorRefs:Dt,activeAnchor:rn}=Ic(e),Qe=Ce=>Ce==null?void 0:Ce.getAttributeNames().reduce((Ge,ne)=>{var de;return ne.startsWith("data-tooltip-")&&(Ge[ne.replace(/^data-tooltip-/,"")]=(de=Ce==null?void 0:Ce.getAttribute(ne))!==null&&de!==void 0?de:null),Ge},{}),Mt=Ce=>{const Ge={place:ne=>{var de;fe((de=ne)!==null&&de!==void 0?de:u)},content:ne=>{Q(ne??r)},html:ne=>{ae(ne??i)},variant:ne=>{var de;we((de=ne)!==null&&de!==void 0?de:c)},offset:ne=>{He(ne===null?d:Number(ne))},wrapper:ne=>{var de;Fe((de=ne)!==null&&de!==void 0?de:p)},events:ne=>{const de=ne==null?void 0:ne.split(" ");It(de??m)},"position-strategy":ne=>{var de;At((de=ne)!==null&&de!==void 0?de:h)},"delay-show":ne=>{me(ne===null?C:Number(ne))},"delay-hide":ne=>{Ue(ne===null?y:Number(ne))},float:ne=>{yt(ne===null?b:ne==="true")},hidden:ne=>{Be(ne===null?x:ne==="true")},"class-name":ne=>{it(ne)}};Object.values(Ge).forEach(ne=>ne(null)),Object.entries(Ce).forEach(([ne,de])=>{var ke;(ke=Ge[ne])===null||ke===void 0||ke.call(Ge,de)})};g.useEffect(()=>{Q(r)},[r]),g.useEffect(()=>{ae(i)},[i]),g.useEffect(()=>{fe(u)},[u]),g.useEffect(()=>{we(c)},[c]),g.useEffect(()=>{He(d)},[d]),g.useEffect(()=>{me(C)},[C]),g.useEffect(()=>{Ue(y)},[y]),g.useEffect(()=>{yt(b)},[b]),g.useEffect(()=>{Be(x)},[x]),g.useEffect(()=>{At(h)},[h]),g.useEffect(()=>{Ut.current!==le&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[le]),g.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:le==="core",disableBase:le}}))},[]),g.useEffect(()=>{var Ce;const Ge=new Set(Dt);let ne=n;if(!ne&&e&&(ne=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ne)try{document.querySelectorAll(ne).forEach(re=>{Ge.add({current:re})})}catch{console.warn(`[react-tooltip] "${ne}" is not a valid CSS selector`)}const de=document.querySelector(`[id='${t}']`);if(de&&Ge.add({current:de}),!Ge.size)return()=>null;const ke=(Ce=Ee??de)!==null&&Ce!==void 0?Ce:rn.current,Ft=new MutationObserver(re=>{re.forEach(se=>{var Re;if(!ke||se.type!=="attributes"||!(!((Re=se.attributeName)===null||Re===void 0)&&Re.startsWith("data-tooltip-")))return;const je=Qe(ke);Mt(je)})}),U={attributes:!0,childList:!1,subtree:!1};if(ke){const re=Qe(ke);Mt(re),Ft.observe(ke,U)}return()=>{Ft.disconnect()}},[Dt,rn,Ee,t,n]),g.useEffect(()=>{$!=null&&$.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),pe&&!_s("border",`${pe}`)&&console.warn(`[react-tooltip] "${pe}" is not a valid \`border\`.`),$!=null&&$.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),S&&!_s("opacity",`${S}`)&&console.warn(`[react-tooltip] "${S}" is not a valid \`opacity\`.`)},[]);let Bt=f;const on=g.useRef(null);if(o){const Ce=o({content:(Ee==null?void 0:Ee.getAttribute("data-tooltip-content"))||V||null,activeAnchor:Ee});Bt=Ce?g.createElement("div",{ref:on,className:"react-tooltip-content-wrapper"},Ce):null}else V&&(Bt=V);J&&(Bt=g.createElement(Dh,{content:J}));const Wt={forwardRef:Z,id:e,anchorId:t,anchorSelect:n,className:ct(s,Ht),classNameArrow:a,content:Bt,contentWrapperRef:on,place:P,variant:K,offset:Pe,wrapper:Ve,events:Oe,openOnClick:v,positionStrategy:Xe,middlewares:w,delayShow:Me,delayHide:vt,float:ot,hidden:wt,noArrow:_,clickable:E,closeOnEsc:D,closeOnScroll:N,closeOnResize:B,openEvents:W,closeEvents:q,globalCloseEvents:X,imperativeModeOnly:ee,style:$,position:ie,isOpen:te,defaultIsOpen:G,border:pe,opacity:S,arrowColor:M,setIsOpen:L,afterShow:k,afterHide:F,disableTooltip:A,activeAnchor:Ee,setActiveAnchor:Ce=>Pt(Ce),role:Y};return g.createElement(Ph,{...Wt})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||ws({css:":root{--rt-color-white:#fff;--rt-color-dark:#222;--rt-color-success:#8dc572;--rt-color-error:#be6464;--rt-color-warning:#f0ad4e;--rt-color-info:#337ab7;--rt-opacity:0.9;--rt-transition-show-delay:0.15s;--rt-transition-closing-delay:0.15s}.core-styles-module_tooltip__3vRRp{position:absolute;top:0;left:0;pointer-events:none;opacity:0;will-change:opacity}.core-styles-module_fixed__pcSol{position:fixed}.core-styles-module_arrow__cvMwQ{position:absolute;background:inherit}.core-styles-module_noArrow__xock6{display:none}.core-styles-module_clickable__ZuTTB{pointer-events:auto}.core-styles-module_show__Nt9eE{opacity:var(--rt-opacity);transition:opacity var(--rt-transition-show-delay)ease-out}.core-styles-module_closing__sGnxF{opacity:0;transition:opacity var(--rt-transition-closing-delay)ease-in}",type:"core"}),e.detail.disableBase||ws({css:`
49
+ .styles-module_tooltip__mnnfp{padding:8px 16px;border-radius:3px;font-size:90%;width:max-content}.styles-module_arrow__K0L3T{width:8px;height:8px}[class*='react-tooltip__place-top']>.styles-module_arrow__K0L3T{transform:rotate(45deg)}[class*='react-tooltip__place-right']>.styles-module_arrow__K0L3T{transform:rotate(135deg)}[class*='react-tooltip__place-bottom']>.styles-module_arrow__K0L3T{transform:rotate(225deg)}[class*='react-tooltip__place-left']>.styles-module_arrow__K0L3T{transform:rotate(315deg)}.styles-module_dark__xNqje{background:var(--rt-color-dark);color:var(--rt-color-white)}.styles-module_light__Z6W-X{background-color:var(--rt-color-white);color:var(--rt-color-dark)}.styles-module_success__A2AKt{background-color:var(--rt-color-success);color:var(--rt-color-white)}.styles-module_warning__SCK0X{background-color:var(--rt-color-warning);color:var(--rt-color-white)}.styles-module_error__JvumD{background-color:var(--rt-color-error);color:var(--rt-color-white)}.styles-module_info__BWdHW{background-color:var(--rt-color-info);color:var(--rt-color-white)}`,type:"base"})});function Fh(){return l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[l.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[l.jsx("path",{d:"M8.00032 11.167L8.00032 7.83366M8.00032 1.83366C4.33366 1.83366 1.33366 4.83366 1.33366 8.50033C1.33366 12.167 4.33366 15.167 8.00033 15.167C11.667 15.167 14.667 12.167 14.667 8.50033C14.667 4.83366 11.667 1.83366 8.00032 1.83366Z",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),l.jsx("defs",{children:l.jsx("clipPath",{id:"clip0_2896_16290",children:l.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function kh({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:Fh()}),l.jsx(Mh,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const _c=g.createContext(null);function bc(){const e=g.useContext(_c);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const xc=g.createContext(()=>{});function jh(){const e=g.useContext(xc);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var Cc=Symbol.for("immer-nothing"),Os=Symbol.for("immer-draftable"),ut=Symbol.for("immer-state"),Lh=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 nt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Lh[e],r=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Rn=Object.getPrototypeOf;function An(e){return!!e&&!!e[ut]}function yn(e){var t;return e?Oc(e)||Array.isArray(e)||!!e[Os]||!!((t=e.constructor)!=null&&t[Os])||Gr(e)||Yr(e):!1}var Vh=Object.prototype.constructor.toString();function Oc(e){if(!e||typeof e!="object")return!1;const t=Rn(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)===Vh}function Fr(e,t){Xr(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Xr(e){const t=e[ut];return t?t.type_:Array.isArray(e)?1:Gr(e)?2:Yr(e)?3:0}function Mo(e,t){return Xr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ec(e,t,n){const r=Xr(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Kh(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Gr(e){return e instanceof Map}function Yr(e){return e instanceof Set}function dn(e){return e.copy_||e.base_}function Fo(e,t){if(Gr(e))return new Map(e);if(Yr(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Oc(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[ut];let i=Reflect.ownKeys(r);for(let o=0;o<i.length;o++){const s=i[o],a=r[s];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(r[s]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[s]})}return Object.create(Rn(e),r)}else{const r=Rn(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function yi(e,t=!1){return Zr(e)||An(e)||!yn(e)||(Xr(e)>1&&(e.set=e.add=e.clear=e.delete=$h),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>yi(r,!0))),e}function $h(){nt(2)}function Zr(e){return Object.isFrozen(e)}var Hh={};function wn(e){const t=Hh[e];return t||nt(0,e),t}var qn;function Nc(){return qn}function Uh(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Es(e,t){t&&(wn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ko(e){jo(e),e.drafts_.forEach(Bh),e.drafts_=null}function jo(e){e===qn&&(qn=e.parent_)}function Ns(e){return qn=Uh(qn,e)}function Bh(e){const t=e[ut];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ss(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[ut].modified_&&(ko(t),nt(4)),yn(e)&&(e=kr(t,e),t.parent_||jr(t,e)),t.patches_&&wn("Patches").generateReplacementPatches_(n[ut].base_,e,t.patches_,t.inversePatches_)):e=kr(t,n,[]),ko(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Cc?e:void 0}function kr(e,t,n){if(Zr(t))return t;const r=t[ut];if(!r)return Fr(t,(i,o)=>Ts(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return jr(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const i=r.copy_;let o=i,s=!1;r.type_===3&&(o=new Set(i),i.clear(),s=!0),Fr(o,(a,c)=>Ts(e,r,i,a,c,n,s)),jr(e,i,!1),n&&e.patches_&&wn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Ts(e,t,n,r,i,o,s){if(process.env.NODE_ENV!=="production"&&i===n&&nt(5),An(i)){const a=o&&t&&t.type_!==3&&!Mo(t.assigned_,r)?o.concat(r):void 0,c=kr(e,i,a);if(Ec(n,r,c),An(c))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(yn(i)&&!Zr(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;kr(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&jr(e,i)}}function jr(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&yi(t,n)}function Wh(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Nc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=wi;n&&(i=[r],o=Jn);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var wi={get(e,t){if(t===ut)return e;const n=dn(e);if(!Mo(n,t))return qh(e,n,t);const r=n[t];return e.finalized_||!yn(r)?r:r===yo(e.base_,t)?(wo(e),e.copy_[t]=Vo(r,e)):r},has(e,t){return t in dn(e)},ownKeys(e){return Reflect.ownKeys(dn(e))},set(e,t,n){const r=Sc(dn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=yo(dn(e),t),o=i==null?void 0:i[ut];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Kh(n,i)&&(n!==void 0||Mo(e.base_,t)))return!0;wo(e),Lo(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 yo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,wo(e),Lo(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=dn(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:r.enumerable,value:n[t]}},defineProperty(){nt(11)},getPrototypeOf(e){return Rn(e.base_)},setPrototypeOf(){nt(12)}},Jn={};Fr(wi,(e,t)=>{Jn[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Jn.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&nt(13),Jn.set.call(this,e,t,void 0)};Jn.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&nt(14),wi.set.call(this,e[0],t,n,e[0])};function yo(e,t){const n=e[ut];return(n?dn(n):e)[t]}function qh(e,t,n){var i;const r=Sc(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Sc(e,t){if(!(t in e))return;let n=Rn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Rn(n)}}function Lo(e){e.modified_||(e.modified_=!0,e.parent_&&Lo(e.parent_))}function wo(e){e.copy_||(e.copy_=Fo(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Jh=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const o=n;n=t;const s=this;return function(c=o,...u){return s.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&nt(6),r!==void 0&&typeof r!="function"&&nt(7);let i;if(yn(t)){const o=Ns(this),s=Vo(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?ko(o):jo(o)}return Es(o,r),Ss(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Cc&&(i=void 0),this.autoFreeze_&&yi(i,!0),r){const o=[],s=[];wn("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else nt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let r,i;return[this.produce(t,n,(s,a)=>{r=s,i=a}),r,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){yn(e)||nt(8),An(e)&&(e=zh(e));const t=Ns(this),n=Vo(e,void 0);return n[ut].isManual_=!0,jo(t),n}finishDraft(e,t){const n=e&&e[ut];(!n||!n.isManual_)&&nt(9);const{scope_:r}=n;return Es(r,t),Ss(void 0,r)}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 r=wn("Patches").applyPatches_;return An(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Vo(e,t){const n=Gr(e)?wn("MapSet").proxyMap_(e,t):Yr(e)?wn("MapSet").proxySet_(e,t):Wh(e,t);return(t?t.scope_:Nc()).drafts_.push(n),n}function zh(e){return An(e)||nt(10,e),Tc(e)}function Tc(e){if(!yn(e)||Zr(e))return e;const t=e[ut];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Fo(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Fo(e,!0);return Fr(n,(r,i)=>{Ec(n,r,Tc(i))}),t&&(t.finalized_=!1),n}var dt=new Jh,Vn=dt.produce;dt.produceWithPatches.bind(dt);dt.setAutoFreeze.bind(dt);dt.setUseStrictShallowCopy.bind(dt);dt.applyPatches.bind(dt);dt.createDraft.bind(dt);dt.finishDraft.bind(dt);const Rc=g.createContext(void 0),Xh={};function Ii(){const e=g.useContext(Rc);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function Gh({children:e}){const{installation:t}=rt(),{hydratedRevision:n,loading:r}=$t(),[i,o]=g.useState(Xh),s=t==null?void 0:t.config;g.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(i).length>0)&&_f(n,s,o)},[n,r,s,i]);const a=g.useCallback((m,v)=>{o(h=>Vn(h,w=>{w[m]=Vn(w[m],v)}))},[o]),c=g.useCallback((m,v)=>{o(h=>Vn(h,w=>{w[m]=v}))},[o]),u=g.useCallback(()=>{o(Vn(m=>{const v=m.other.write;v&&(v.isWriteModified=!1)}))},[o]),d=g.useCallback(m=>{o(Vn(v=>{var w;const h=(w=v[m])==null?void 0:w.read;h&&(h.isOptionalFieldsModified=!1,h.isRequiredMapFieldsModified=!1,h.isValueMappingsModified=!1)}))},[o]),p=g.useCallback(m=>{m===hn?u():d(m)},[d,u]),f=g.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:p}),[i,c,p,a]);return l.jsx(Rc.Provider,{value:f,children:e})}const gt=()=>{const{appName:e}=Ae(),{objectConfigurationsState:t,setConfigureState:n}=Ii(),{selectedObjectName:r}=bc(),i=ba(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}};function Yh(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};if(t.forEach(i=>{const{field:o,value:s}=i;s===null?delete n[o]:n[o]=s}),e!=null&&e.read){const i=e.read.savedConfig.requiredMapFields,s=!ga(i,n);e.read.isRequiredMapFieldsModified=s}}function zn(e,t,n){t(e,r=>Yh(r,n))}function _i({field:e,onSelectChange:t,allFields:n}){var m;const{configureState:r,selectedObjectName:i,setConfigureState:o}=gt(),[s,a]=g.useState(!0),c=(m=r==null?void 0:r.read)==null?void 0:m.selectedFieldMappings,u=c==null?void 0:c[e.mapToName];g.useEffect(()=>{e._default&&!u&&i&&r&&zn(i,o,[{field:e.mapToName,value:e._default}]),a(!1)},[e,o,i,u,r]);const d=g.useMemo(()=>n.map(v=>({id:v.fieldName,label:v.displayName,value:v.fieldName})),[n]),p=l.jsx(pi,{disabled:s,items:d,selectedValue:u||null,onSelectedItemChange:v=>{t({target:{name:e.mapToName,value:v==null?void 0:v.value}})},placeholder:"Please select one",style:{width:"100%"}}),f=g.useCallback(()=>{i&&zn(i,o,[{field:e.mapToName,value:null}])},[e.mapToName,i,o]);return l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[l.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName}),l.jsx("span",{children:(e==null?void 0:e.prompt)&&l.jsx(kh,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[p,l.jsx(Ze,{type:"button",variant:"ghost",onClick:f,children:"clear"})]})]},e.mapToName)}const Zh="_formControl_9qd8d_1",Qh="_formLabel_9qd8d_5",eg="_formLabelRequired_9qd8d_11",tg="_formInput_9qd8d_16",ng="_formInputInvalid_9qd8d_20",rg="_formError_9qd8d_24",og="_disabled_9qd8d_30",un={formControl:Zh,formLabel:Qh,formLabelRequired:eg,formInput:tg,formInputInvalid:ng,formError:rg,disabled:og};function bi({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:i=!1,errorMessage:o,children:s}){return l.jsxs("div",{className:ct(un.formControl,{[un.disabled]:r}),children:[t&&l.jsx("label",{htmlFor:e,className:ct(un.formLabel,{[un.formLabelRequired]:n}),children:t}),l.jsx("div",{id:e,className:ct(un.formInput,{[un.formInputInvalid]:i}),children:s}),i&&o&&l.jsx("div",{className:un.formError,role:"alert",children:o})]})}const ig="_divider_1kmoj_1",Rs={divider:ig};function Qr({className:e,style:t}){return l.jsx("hr",{className:e?`${Rs.divider} ${e}`:Rs.divider,style:t})}function Fn({string:e}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsx("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:e}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(Qr,{style:{width:"100%",marginLeft:"1rem"}})})]})}function sg(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=gt(),{isError:r,removeError:i}=Tt(),o=a=>{const{value:c,name:u}=a.target;c&&(e&&zn(e,n,[{field:u,value:c}]),r(_e.MAPPING,u)&&i(_e.MAPPING,u))},s=g.useMemo(()=>{var a;return((a=t==null?void 0:t.read)==null?void 0:a.optionalMapFields)||[]},[t]);return s!=null&&s.length?l.jsxs(l.Fragment,{children:[l.jsx(Fn,{string:"Map the following optional fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:s.map(a=>{var c;return l.jsx(bi,{id:a.mapToName,children:l.jsx(_i,{allFields:((c=t==null?void 0:t.read)==null?void 0:c.allFields)||[],field:a,onSelectChange:o})},a.mapToName)})})]}):null}const ag=(e,t)=>e.filter(n=>!t.includes(n));function cg(){var v,h;const{selectedObjectName:e,configureState:t,setConfigureState:n}=gt(),{fieldMapping:r}=rt(),{isError:i,removeError:o}=Tt(),s=w=>{const{value:C,name:y}=w.target;C&&(e&&zn(e,n,[{field:y,value:C}]),i(_e.MAPPING,y)&&o(_e.MAPPING,y))},a=g.useMemo(()=>{var b;const w=((b=t==null?void 0:t.read)==null?void 0:b.requiredMapFields)||[],C=e&&r?Object.values(r[e]||{}).flat().filter(x=>!x.fieldName):[];return w.concat(C).reduce((x,_)=>x.find(D=>D.mapToName===_.mapToName)?x.map(D=>D.mapToName===_.mapToName?_:D):x.concat(_),new Array)},[t,r,e]),c=((v=t==null?void 0:t.read)==null?void 0:v.selectedFieldMappings)||{},u=Object.keys(c),d=((h=t==null?void 0:t.read)==null?void 0:h.optionalMapFields)||[],f=a.concat(d).map(w=>w.mapToName),m=ag(u,f);return e&&m.length?(zn(e,n,m.map(w=>({field:w,value:null}))),null):a!=null&&a.length?l.jsxs(l.Fragment,{children:[l.jsx(Fn,{string:"Map the following fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:a.map(w=>{var C;return l.jsx(bi,{id:w.mapToName,isInvalid:i(_e.MAPPING,w.mapToName),errorMessage:"* required",children:l.jsx(_i,{allFields:((C=t==null?void 0:t.read)==null?void 0:C.allFields)||[],field:w,onSelectChange:s})},w.mapToName)})})]}):null}const lg={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function ug({children:e,style:t}){return l.jsx(en,{style:{...lg,...t},children:e})}function dg(){var d,p,f;const{project:e}=Ae(),{hydratedRevision:t}=$t(),{selectedObjectName:n}=gt(),{provider:r}=rt(),i=e==null?void 0:e.appName,o=tn(r),s=(f=(p=(d=t==null?void 0:t.content)==null?void 0:d.read)==null?void 0:p.objects)==null?void 0:f.find(m=>m.objectName===n),a=(s==null?void 0:s.displayName)||n&&Bn(n),c=s==null?void 0:s.mapToName,u=(s==null?void 0:s.mapToDisplayName)||c&&Bn(c);return u&&i&&o?l.jsx(ug,{style:{marginTop:"1rem"},children:l.jsxs("p",{style:{margin:"1rem 0"},children:[l.jsx("b",{children:u})," in ",i," is mapped to ",l.jsx("b",{children:a})," in ",o,"."]})}):null}function As(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ac(...e){return t=>{let n=!1;const r=e.map(i=>{const o=As(i,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let i=0;i<r.length;i++){const o=r[i];typeof o=="function"?o():As(e[i],null)}}}}function Xn(...e){return H.useCallback(Ac(...e),e)}function eo(e,t=[]){let n=[];function r(o,s){const a=H.createContext(s),c=n.length;n=[...n,s];const u=p=>{var C;const{scope:f,children:m,...v}=p,h=((C=f==null?void 0:f[e])==null?void 0:C[c])||a,w=H.useMemo(()=>v,Object.values(v));return l.jsx(h.Provider,{value:w,children:m})};u.displayName=o+"Provider";function d(p,f){var h;const m=((h=f==null?void 0:f[e])==null?void 0:h[c])||a,v=H.useContext(m);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${p}\` must be used within \`${o}\``)}return[u,d]}const i=()=>{const o=n.map(s=>H.createContext(s));return function(a){const c=(a==null?void 0:a[e])||o;return H.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[r,pg(i,...t)]}function pg(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(o){const s=r.reduce((a,{useScope:c,scopeName:u})=>{const p=c(o)[`__scope${u}`];return{...a,...p}},{});return H.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Ct(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 xi(e){const t=H.useRef(e);return H.useEffect(()=>{t.current=e}),H.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Ci({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=fg({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=xi(n),c=H.useCallback(u=>{if(o){const p=typeof u=="function"?u(e):u;p!==e&&a(p)}else i(u)},[o,e,i,a]);return[s,c]}function fg({defaultProp:e,onChange:t}){const n=H.useState(e),[r]=n,i=H.useRef(r),o=xi(t);return H.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}function mg(e){const t=H.useRef({value:e,previous:e});return H.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Lr=globalThis!=null&&globalThis.document?H.useLayoutEffect:()=>{};function hg(e){const[t,n]=H.useState(void 0);return Lr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const o=i[0];let s,a;if("borderBoxSize"in o){const c=o.borderBoxSize,u=Array.isArray(c)?c[0]:c;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function gg(e,t){return H.useReducer((n,r)=>t[n][r]??n,e)}var Oi=e=>{const{present:t,children:n}=e,r=vg(t),i=typeof n=="function"?n({present:r.isPresent}):H.Children.only(n),o=Xn(r.ref,yg(i));return typeof n=="function"||r.isPresent?H.cloneElement(i,{ref:o}):null};Oi.displayName="Presence";function vg(e){const[t,n]=H.useState(),r=H.useRef({}),i=H.useRef(e),o=H.useRef("none"),s=e?"mounted":"unmounted",[a,c]=gg(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return H.useEffect(()=>{const u=Ir(r.current);o.current=a==="mounted"?u:"none"},[a]),Lr(()=>{const u=r.current,d=i.current;if(d!==e){const f=o.current,m=Ir(u);e?c("MOUNT"):m==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&f!==m?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),Lr(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,p=m=>{const h=Ir(r.current).includes(m.animationName);if(m.target===t&&h&&(c("ANIMATION_END"),!i.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},f=m=>{m.target===t&&(o.current=Ir(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:H.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Ir(e){return(e==null?void 0:e.animationName)||"none"}function yg(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.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 Vr=H.forwardRef((e,t)=>{const{children:n,...r}=e,i=H.Children.toArray(n),o=i.find(Ig);if(o){const s=o.props.children,a=i.map(c=>c===o?H.Children.count(s)>1?H.Children.only(null):H.isValidElement(s)?s.props.children:null:c);return l.jsx(Ko,{...r,ref:t,children:H.isValidElement(s)?H.cloneElement(s,void 0,a):null})}return l.jsx(Ko,{...r,ref:t,children:n})});Vr.displayName="Slot";var Ko=H.forwardRef((e,t)=>{const{children:n,...r}=e;if(H.isValidElement(n)){const i=bg(n);return H.cloneElement(n,{..._g(r,n.props),ref:t?Ac(t,i):i})}return H.Children.count(n)>1?H.Children.only(null):null});Ko.displayName="SlotClone";var wg=({children:e})=>l.jsx(l.Fragment,{children:e});function Ig(e){return H.isValidElement(e)&&e.type===wg}function _g(e,t){const n={...t};for(const r in t){const i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...a)=>{o(...a),i(...a)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function bg(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.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 xg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],nn=xg.reduce((e,t)=>{const n=H.forwardRef((r,i)=>{const{asChild:o,...s}=r,a=o?Vr:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Ei="Checkbox",[Cg,Gy]=eo(Ei),[Og,Eg]=Cg(Ei),Pc=H.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:a,value:c="on",onCheckedChange:u,form:d,...p}=e,[f,m]=H.useState(null),v=Xn(t,x=>m(x)),h=H.useRef(!1),w=f?d||!!f.closest("form"):!0,[C=!1,y]=Ci({prop:i,defaultProp:o,onChange:u}),b=H.useRef(C);return H.useEffect(()=>{const x=f==null?void 0:f.form;if(x){const _=()=>y(b.current);return x.addEventListener("reset",_),()=>x.removeEventListener("reset",_)}},[f,y]),l.jsxs(Og,{scope:n,state:C,disabled:a,children:[l.jsx(nn.button,{type:"button",role:"checkbox","aria-checked":Gt(C)?"mixed":C,"aria-required":s,"data-state":Fc(C),"data-disabled":a?"":void 0,disabled:a,value:c,...p,ref:v,onKeyDown:Ct(e.onKeyDown,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:Ct(e.onClick,x=>{y(_=>Gt(_)?!0:!_),w&&(h.current=x.isPropagationStopped(),h.current||x.stopPropagation())})}),w&&l.jsx(Ng,{control:f,bubbles:!h.current,name:r,value:c,checked:C,required:s,disabled:a,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Gt(o)?!1:o})]})});Pc.displayName=Ei;var Dc="CheckboxIndicator",Mc=H.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=Eg(Dc,n);return l.jsx(Oi,{present:r||Gt(o.state)||o.state===!0,children:l.jsx(nn.span,{"data-state":Fc(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Mc.displayName=Dc;var Ng=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,s=H.useRef(null),a=mg(n),c=hg(t);H.useEffect(()=>{const d=s.current,p=window.HTMLInputElement.prototype,m=Object.getOwnPropertyDescriptor(p,"checked").set;if(a!==n&&m){const v=new Event("click",{bubbles:r});d.indeterminate=Gt(n),m.call(d,Gt(n)?!1:n),d.dispatchEvent(v)}},[a,n,r]);const u=H.useRef(Gt(n)?!1:n);return l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...o,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Gt(e){return e==="indeterminate"}function Fc(e){return Gt(e)?"indeterminate":e?"checked":"unchecked"}var kc=Pc,jc=Mc;function Lc(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Sg=["color"],Vc=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Lc(e,Sg);return g.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}),g.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:r,fillRule:"evenodd",clipRule:"evenodd"}))}),Tg=["color"],Rg=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Lc(e,Tg);return g.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}),g.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:r,fillRule:"evenodd",clipRule:"evenodd"}))});const Ag="_checkboxGroupContainer_1ya1t_1",Pg="_stack_1ya1t_6",Dg="_selectAllContainer_1ya1t_11",Mg="_fieldContainer_1ya1t_18",Fg="_checkbox_1ya1t_1",Pn={checkboxGroupContainer:Ag,stack:Pg,selectAllContainer:Dg,fieldContainer:Mg,checkbox:Fg};function Kc({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:Pn.fieldContainer,children:[l.jsx(kc,{className:Pn.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(jc,{children:l.jsx(Vc,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function $c({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return l.jsxs("div",{className:Pn.selectAllContainer,children:[l.jsx(kc,{className:Pn.checkbox,id:e,onCheckedChange:r,children:l.jsxs(jc,{children:[i&&l.jsx(Rg,{}),t===!0&&l.jsx(Vc,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function Hc({children:e}){return l.jsx("div",{className:Pn.checkboxGroupContainer,children:e})}function Uc({children:e}){return l.jsx("div",{className:Pn.stack,children:e})}function kg(e,t,n){var i,o;const r=((i=e==null?void 0:e.read)==null?void 0:i.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(o=e.read)!=null&&o.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,c=!ga(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function Ps(e,t,n,r){t(e,i=>kg(i,n,r))}function jg(){var p,f;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=gt(),i=(p=t==null?void 0:t.read)==null?void 0:p.selectedOptionalFields,o=(m,v)=>{m!=="indeterminate"&&r&&t&&Ps(r,n,v,m)},s=(f=t==null?void 0:t.read)==null?void 0:f.optionalFields,a=m=>{r&&s&&s.forEach(v=>{Yt(v)||Ps(r,n,v.fieldName,m)})},c=!!(s&&s.length>0),u=Object.keys(i||{}).length===(s==null?void 0:s.length),d=!u&&Object.keys(i||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(Fn,{string:`${e} reads the following optional fields`}),l.jsxs(Hc,{children:[((s==null?void 0:s.length)||0)>=2&&l.jsx($c,{id:"select-all-fields",isChecked:u,label:"Select all",onCheckedChange:a,isIndeterminate:d}),l.jsx(Uc,{children:s.map(m=>Yt(m)?null:l.jsx(Kc,{id:m.fieldName,isChecked:!!(i!=null&&i[m==null?void 0:m.fieldName]),label:m.displayName,onCheckedChange:v=>o(v,m.fieldName)},m.fieldName))})]})]})}function Lg(){return l.jsx(jg,{})}const Vg={color:"var(--amp-colors-text-regular)",backgroundColor:"var(--amp-colors-bg-highlight)",borderRadius:"4px",display:"inline-block",fontSize:"0.75rem",fontWeight:500,lineHeight:"1.25",padding:"0.25rem 0.5rem"};function Kg({children:e,style:t,...n}){return l.jsx("span",{style:{...Vg,...t},...n,children:e})}function $g(){var r,i,o;const{configureState:e,selectedObjectName:t}=gt(),{appName:n}=Ae();return l.jsxs(l.Fragment,{children:[l.jsx(Fn,{string:`${n} reads the following ${t} fields`}),l.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(i=(r=e==null?void 0:e.read)==null?void 0:r.requiredFields)!=null&&i.length?(o=e.read)==null?void 0:o.requiredFields.map(s=>Yt(s)?null:l.jsx(Kg,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function Hg(e,t,n,r,i){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[i]||(e.read.selectedValueMappings[i]={}),e.read.selectedValueMappings[i][n]=r)}function Ug(e,t,n,r,i){t(e,o=>Hg(o,e,n,r,i))}function Bg(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function Wg({string:e,fieldName:t}){return l.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"1rem",paddingBottom:".5rem"},children:[l.jsxs("h3",{style:{color:"var(--amp-colors-text-muted)",fontSize:"1rem",fontWeight:"400"},children:[e,l.jsx("b",{children:t})]}),l.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:l.jsx(Qr,{style:{width:"100%",marginLeft:"1rem"}})})]})}function qg({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r}){var m;const{configureState:i,selectedObjectName:o,setConfigureState:s}=gt(),[a,c]=g.useState(!0),u=g.useMemo(()=>{var v,h;return((h=(v=i==null?void 0:i.read)==null?void 0:v.selectedValueMappings)==null?void 0:h[n])||{}},[(m=i==null?void 0:i.read)==null?void 0:m.selectedValueMappings,n]),d=g.useMemo(()=>u==null?void 0:u[e.mappedValue],[u,e.mappedValue]);g.useEffect(()=>{c(!1)},[e,s,o,d,i]);const p=g.useMemo(()=>r.map(v=>({id:v.value,label:v.displayValue,value:v.value})),[r]),f=g.useMemo(()=>l.jsx(pi,{disabled:a,items:p,selectedValue:d||null,onSelectedItemChange:v=>{if(v){if(Object.values(u).some(h=>h===v.value&&h!==d)){console.error(`Each ${n} must be mapped to a unique value`);return}t({target:{name:e.mappedValue,value:v.value,fieldName:n}})}},placeholder:"Please select one"},d),[a,p,d,u,t,e.mappedValue,n]);return l.jsxs("div",{style:{display:"flex",flexDirection:"column",marginBottom:".25rem"},children:[l.jsx("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:l.jsx("span",{style:{fontWeight:500},children:e.mappedDisplayValue})}),f]},e.mappedValue)}function Jg(){var f,m,v;const{fieldMapping:e}=rt(),{selectedObjectName:t,configureState:n,setConfigureState:r}=gt(),{isError:i,removeError:o}=Tt(),s=(f=n==null?void 0:n.read)==null?void 0:f.selectedFieldMappings,a=(m=n==null?void 0:n.read)==null?void 0:m.selectedValueMappings,c=(v=n==null?void 0:n.read)==null?void 0:v.isValueMappingsModified,u=g.useRef(!1),d=g.useMemo(()=>{const h=t&&e?Object.values(e[t]||{}).flat().filter(w=>w.mappedValues).map(w=>({...w})):[];for(let w=0;w<h.length;w+=1)s!=null&&s[h[w].mapToName]&&(h[w].fieldName=s[h[w].mapToName]);return h},[t,e,s]),p=g.useCallback(h=>{const{value:w,name:C,fieldName:y}=h.target;w&&(t&&Ug(t,r,C,w,y),i(_e.MAPPING,C)&&o(_e.MAPPING,C))},[t,r,i,o]);return g.useEffect(()=>{if(t&&a){const h=(e==null?void 0:e[t].filter(C=>C.fieldName&&C.mappedValues.length>0))||[];h.every(C=>{const y=a[C.fieldName]||{};return Object.keys(y).length===Object.keys(C.mappedValues).length})&&h.length>0?!c&&!u.current&&(Bg(t,r,!0),u.current=!0):u.current=!1}},[a,d,t,r,e,c]),d!=null&&d.length?l.jsx(l.Fragment,{children:d.map(h=>{var w,C,y,b,x,_,E,D,N,B,W,q,X,ee,$,ie;return h.fieldName?["singleSelect","multiSelect"].includes((y=(C=(w=n==null?void 0:n.read)==null?void 0:w.allFieldsMetadata)==null?void 0:C[h.fieldName])==null?void 0:y.valueType)?(_=(x=(b=n==null?void 0:n.read)==null?void 0:b.allFieldsMetadata)==null?void 0:x[h.fieldName])!=null&&_.values?(N=(D=(E=n==null?void 0:n.read)==null?void 0:E.allFieldsMetadata)==null?void 0:D[h.fieldName])!=null&&N.values&&Object.keys((h==null?void 0:h.mappedValues)||[]).length===Object.keys(((q=(W=(B=n==null?void 0:n.read)==null?void 0:B.allFieldsMetadata)==null?void 0:W[h.fieldName])==null?void 0:q.values)||[]).length?l.jsxs(l.Fragment,{children:[l.jsx(Wg,{string:"Map the values for ",fieldName:h.mapToName||h.fieldName}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.jsx(bi,{id:h.mapToName||h.fieldName,children:(ie=h==null?void 0:h.mappedValues)==null?void 0:ie.map(te=>{var G,le,pe;return l.jsx(qg,{allValueOptions:((pe=(le=(G=n==null?void 0:n.read)==null?void 0:G.allFieldsMetadata)==null?void 0:le[h.fieldName])==null?void 0:pe.values)||[],mappedValue:te,onSelectChange:p,fieldName:(h==null?void 0:h.fieldName)||""},`${te.mappedValue}-${h.fieldName}`)})},h.mapToName||h.fieldName)})]}):(console.error("field values and the values to be mapped are not of the same length",h,($=(ee=(X=n==null?void 0:n.read)==null?void 0:X.allFieldsMetadata)==null?void 0:ee[h.fieldName])==null?void 0:$.values),null):(console.error("field has no values array",h),null):(console.error("fieldName is not a singleSelect or multiSelect",h),null):(console.error("fieldName is undefined",h),null)})}):null}function zg(){return l.jsxs(l.Fragment,{children:[l.jsx(dg,{}),l.jsx($g,{}),l.jsx(cg,{}),l.jsx(Jg,{}),l.jsx(sg,{}),l.jsx(Lg,{})]})}const Xg="_input_10rzg_1",Gg="_inputError_10rzg_27",Yg="_error_10rzg_43",Io={input:Xg,inputError:Gg,error:Yg};function Kr({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?ct(Io.inputError,Io.input):Io.input;return l.jsx("input",{id:e,type:t,className:ct(o,n),...i})}function Zg({objectName:e,onAddDefaultValue:t}){const{readAction:n,loading:r}=$t(),[i,o]=g.useState(null),[s,a]=g.useState(""),c=n&&qo(n,e),u=g.useMemo(()=>(c==null?void 0:c.allFields)||[],[c]),d=r||!u||u.length===0,p=g.useMemo(()=>u.map(w=>({id:w.fieldName,label:w.displayName,value:w.fieldName})),[u]),f=w=>{const{value:C,name:y}=w.target;C&&o({label:y,value:C})},m=w=>{const{value:C}=w.target;a(C)},v=()=>{s&&(i!=null&&i.value)&&(t(i==null?void 0:i.value,i.label,s),o(null),a(""))},h=l.jsx(pi,{style:{width:"100%"},disabled:d,items:p,selectedValue:(i==null?void 0:i.value)||null,onSelectedItemChange:w=>{f({target:{name:w==null?void 0:w.label,value:w==null?void 0:w.value}})},placeholder:"Please select field."});return l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[h,l.jsx(Kr,{id:"new-default-value",type:"text",value:s,onChange:m,style:{width:"10rem"},placeholder:"default value"}),l.jsx(Ze,{type:"button",onClick:v,variant:"ghost",children:"+"})]})}function Qg(e,t,n,r){var i,o,s,a;if(((i=e==null?void 0:e.write)==null?void 0:i.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const c=e.write.selectedWriteObjects;if(r&&(c[t]||(c[t]={}),c[t].selectedValueDefaults||(c[t].selectedValueDefaults={}),c[t].selectedValueDefaults[n]=r),r||(o=c[t])!=null&&o.selectedValueDefaults&&delete c[t].selectedValueDefaults[n],(a=(s=e==null?void 0:e.write)==null?void 0:s.savedConfig)!=null&&a.selectedWriteObjects){const u=e.write.savedConfig.selectedWriteObjects,p=!ha(u,c);e.write.isWriteModified=p}}}function Ds(e,t,n,r,i){i(e,o=>{Qg(o,t,n,r)})}const ev=(e,t,n)=>{var o;const r=n&&qo(n,t),i=r==null?void 0:r.allFieldsMetadata;return((o=i==null?void 0:i[e])==null?void 0:o.displayName)||e};function tv({objectName:e}){var p;const{readAction:t}=$t(),{selectedObjectName:n,configureState:r,setConfigureState:i}=gt(),o=(p=r==null?void 0:r.write)==null?void 0:p.selectedWriteObjects,s=o==null?void 0:o[e],a=g.useMemo(()=>(s==null?void 0:s.selectedValueDefaults)||{},[s]),c=g.useCallback((f,m,v)=>{Ds(n||"",e,f,v,i)},[e,n,i]),u=f=>{Ds(n||"",e,f,null,i)},d=Object.keys(a).map(f=>({field:f,defaultValue:a[f],fieldDisplayName:t?ev(f,e,t):f}));return l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{paddingBottom:"1rem",display:"flex",flexDirection:"column",gap:".5rem"},children:d.map(({field:f,fieldDisplayName:m,defaultValue:v})=>l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[l.jsx(Kr,{id:f,type:"text",disabled:!0,value:m,style:{width:"100%"}}),l.jsx(Kr,{id:`${f}-${v}`,type:"text",disabled:!0,value:v,style:{width:"10rem"}}),l.jsx(Ze,{type:"button",variant:"ghost",onClick:()=>u(f),children:"x"})]},`${f}-${v}`))}),l.jsx(Zg,{objectName:e,onAddDefaultValue:c}),l.jsx("div",{style:{textAlign:"right",padding:".25rem 0",color:"var(--amp-colors-text-muted)"},children:"click + to confirm"})]})}const nv=(e,t)=>!!t.find(n=>{var r;return n.objectName===e&&((r=n==null?void 0:n.valueDefaults)==null?void 0:r.allowAnyFields)});function rv(){var i;const{configureState:e}=gt(),{writeObjects:t}=$t(),n=(i=e==null?void 0:e.write)==null?void 0:i.selectedWriteObjects;return!!t&&l.jsx(l.Fragment,{children:t.map(o=>n!=null&&n[o.objectName]&&nv(o.objectName,t)?l.jsxs(l.Fragment,{children:[l.jsx(Fn,{string:`Defaults for ${o.displayName} `}),l.jsx(tv,{objectName:o.objectName})]}):null)})}function ov(e,t,n){var r,i,o;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedWriteObjects)===null&&(e.write.selectedWriteObjects={}),e!=null&&e.write){const s=e.write.selectedWriteObjects;if(n&&(s[t]={objectName:t}),n||delete s[t],(o=(i=e==null?void 0:e.write)==null?void 0:i.savedConfig)!=null&&o.selectedWriteObjects){const a=e.write.savedConfig.selectedWriteObjects,u=!ha(a,s);e.write.isWriteModified=u}}}function Ms(e,t,n,r){t(e,i=>{ov(i,n,r)})}function iv(){var p,f,m,v;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=gt(),i=(p=n==null?void 0:n.write)==null?void 0:p.selectedWriteObjects,o=(f=n==null?void 0:n.write)==null?void 0:f.writeObjects,s=(h,w)=>{h!=="indeterminate"&&t&&n&&Ms(t,r,w,h)},a=h=>{var w,C;t&&n&&((C=(w=n==null?void 0:n.write)==null?void 0:w.writeObjects)==null||C.forEach(y=>{Ms(t,r,y.objectName,h)}))},c=!!o,u=Object.keys(i||{}).length===((v=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects)==null?void 0:v.length),d=!u&&Object.keys(i||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(Fn,{string:`Allow ${e} to write to these objects`}),l.jsxs(Hc,{children:[((o==null?void 0:o.length)||0)>=2&&l.jsx($c,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:u,label:"Select all"}),l.jsx(Uc,{children:o.map(h=>l.jsx(Kc,{id:h.objectName,onCheckedChange:w=>s(w,h.objectName),isChecked:!!(i!=null&&i[h.objectName]),label:h.displayName},h.objectName))})]})]})}function sv(){return l.jsxs(l.Fragment,{children:[l.jsx(iv,{}),l.jsx(rv,{})]})}function Bc({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const r=ze(),{projectId:i}=Ae(),{integrationId:o,installation:s,resetInstallations:a,setIntegrationDeleted:c,onUninstallSuccess:u}=rt(),[d,p]=g.useState(!1),f=!i||!o||!(s!=null&&s.id)||d,m=async()=>{if(!f){p(!0),console.warn("uninstalling installation",{projectId:i,integrationId:o,installationId:s.id});try{await Te().installationApi.deleteInstallation({projectIdOrName:i,integrationId:o,installationId:s.id},{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}),console.warn("successfully uninstalled installation:",s.id),u==null||u(s==null?void 0:s.id),a(),c()}catch(w){console.error("Error uninstalling installation."),Je(w)}finally{p(!1)}}},v=d?"Uninstalling...":e,h=l.jsx(Ze,{type:"button",onClick:m,disabled:f,variant:t,style:n,children:v});return s!=null&&s.id?h:null}function av(){const{appName:e}=Ae(),{installation:t}=rt();return l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t!=null&&t.id?l.jsxs("p",{children:["Once you uninstall this integration, all your configuration will be lost, and"," ",l.jsx("b",{children:e})," may stop working."]}):l.jsx("p",{children:"You've successfully uninstalled the integration."}),l.jsx(Bc,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}function Wc({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){var E,D,N,B;const{installation:o}=rt(),{hydratedRevision:s,loading:a}=$t(),{configureState:c,selectedObjectName:u}=gt(),d=o==null?void 0:o.config,p=d&&u&&!!da(d,u)||!1,f=((E=c==null?void 0:c.read)==null?void 0:E.isOptionalFieldsModified)||((D=c==null?void 0:c.read)==null?void 0:D.isRequiredMapFieldsModified)||((N=c==null?void 0:c.read)==null?void 0:N.isValueMappingsModified),m=(B=c==null?void 0:c.write)==null?void 0:B.isWriteModified,C=a||n||!c||!u||!(f||m||r||u!==hn&&!p),y=u===hn,b=u===Nr,x=l.jsx(Ze,{type:"submit",disabled:C,children:r?"Install":"Save"}),_=l.jsx(Ze,{type:"button",onClick:t,disabled:C,variant:"ghost",children:"Reset"});return n?l.jsx(Un,{}):l.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px"},children:[x,_]}),l.jsxs(en,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[i&&l.jsx(Ca,{children:typeof i=="string"?i:"Installation Failed."}),a&&l.jsx(Un,{}),s&&!b&&!y&&l.jsx(zg,{}),s&&!b&&y&&l.jsx(sv,{}),!a&&b&&l.jsx(av,{})]})]})}const qc=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o}=rt(),{hydratedRevision:s,loading:a}=$t(),{selectedObjectName:c}=bc(),{selectedConnection:u}=In(),d=ze(),{projectId:p}=Ae(),{resetBoundary:f,setErrors:m,setError:v,getError:h}=Tt(),{resetConfigureState:w,objectConfigurationsState:C,resetPendingConfigurationState:y}=Ii(),b=ba(c||"",C),{onNextIncompleteTab:x}=jh(),_=g.useCallback(()=>{f(_e.INSTALLATION_MUTATION)},[f]),E=g.useCallback(N=>N?B=>{v(_e.INSTALLATION_MUTATION,N,B)}:B=>{console.error("objectName is required to set installation error: ",B)},[v]),D=g.useCallback(N=>N?h(_e.INSTALLATION_MUTATION,N):"",[h]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:u,apiKey:d,projectId:p,resetBoundary:f,setErrors:m,setMutateInstallationError:E,getMutateInstallationError:D,resetMutateInstallationErrorState:_,resetConfigureState:w,objectConfigurationsState:C,resetPendingConfigurationState:y,configureState:b,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:x}},cv=void 0;function lv(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:i,loading:o,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:u,resetBoundary:d,setErrors:p,setMutateInstallationError:f,getMutateInstallationError:m,resetMutateInstallationErrorState:v,resetConfigureState:h,objectConfigurationsState:w,resetPendingConfigurationState:C,configureState:y,onInstallSuccess:b,onNextIncompleteTab:x}=qc(),[_,E]=g.useState(!1),D=s===hn,N=m(s),B=g.useCallback(()=>{d(_e.MAPPING),i!=null&&i.content&&!o&&s&&ya(i,cv,s,h)},[d,i,o,s,h]);g.useEffect(()=>{!y&&(i!=null&&i.content)&&!o&&B()},[y,w,i,o,B]);const W=()=>{v();const{requiredMapFields:ee,selectedFieldMappings:$}=(y==null?void 0:y.read)||{},{errorList:ie}=ma(ee,$,p);ie.length>0||(s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&i?(E(!0),Cf(u,e,t,n,a.id,s,c,i,y,f(s),r,b).finally(()=>{E(!1),C(s),x()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},q=()=>{v(),s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&i?(E(!0),Nf(u,e,t,n,a.id,c,i,y,f(s),r,b).finally(()=>{E(!1),C(s),x()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},X=ee=>{ee.preventDefault(),D?q():W()};return l.jsx(Wc,{errorMsg:N,isCreateMode:!0,isLoading:_,onSave:X,onReset:B})}function uv({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:i,selectedObjectName:o,setInstallation:s,onUpdateSuccess:a,setError:c}){const u={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${o}`],installation:{config:e}}};return Te().installationApi.updateInstallation(u,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}}).then(d=>{s(d),a==null||a(d.id,d.config)}).catch(d=>{Je(d,c)})}const dv=(e,t,n,r,i,o)=>{const s=wa(e),a=Ia(e),c=_a(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:c||{},backfill:o}}}}};return Br(i)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},pv=(e,t,n,r,i,o,s,a,c,u,d)=>{const p=dv(o,r||"",a,a.schedule,c,a.backfill);return p?uv({updateConfig:p,projectId:e,integrationId:t,installationId:n,apiKey:i,selectedObjectName:r,setError:u,setInstallation:s,onUpdateSuccess:d}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},fv=(e,t)=>{const r={content:{write:{objects:xa(e)}}};return Br(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},mv=(e,t,n,r,i,o,s,a,c)=>{const u=fv(i,o);if(!u)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const d={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:u}}};return Te().installationApi.updateInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(p=>{a(p),c==null||c(p.id,p.config)}).catch(p=>{Je(p,s)})};function hv({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:i,selectedObjectName:o,apiKey:s,projectId:a,resetBoundary:c,setErrors:u,setMutateInstallationError:d,getMutateInstallationError:p,resetConfigureState:f,resetPendingConfigurationState:m,configureState:v,onUpdateSuccess:h,onNextIncompleteTab:w}=qc(),[C,y]=g.useState(!1),b=o===hn,x=p(o),{config:_}=e,E=g.useCallback(()=>{c(_e.MAPPING),r!=null&&r.content&&!i&&o&&ya(r,_,o,f)},[c,r,i,o,_,f]);g.useEffect(()=>{v||E()},[v,E]),g.useEffect(()=>{e&&E()},[e,E]);const D=g.useMemo(()=>{var X,ee,$;return($=(ee=(X=r==null?void 0:r.content)==null?void 0:X.read)==null?void 0:ee.objects)==null?void 0:$.find(ie=>(ie==null?void 0:ie.objectName)===o)},[r,o]),N=()=>{const{requiredMapFields:q,selectedFieldMappings:X}=(v==null?void 0:v.read)||{},{errorList:ee}=ma(q,X,u);ee.length>0||(r&&e&&o&&s&&a&&D?(y(!0),pv(a,t.id,e.id,o,s,v,n,D,r,d(o),h).finally(()=>{y(!1),m(o),w()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},B=()=>{e&&o&&s&&a&&r?(y(!0),mv(a,t.id,e.id,s,v,r,d(o),n,h).finally(()=>{y(!1),m(o),w()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},W=q=>{q.preventDefault(),b?B():N()};return l.jsx(Wc,{errorMsg:x,onSave:W,onReset:E,isLoading:C})}function gv(){const{integrationObj:e,installation:t}=rt();return e?t&&e?l.jsx(hv,{installation:t,integrationObj:e}):l.jsx(lv,{}):l.jsx(na,{message:"We can't load the integration"})}const vv=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function yv({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:i,apiKey:o,hydratedRevision:s,setError:a,setInstallation:c,onInstallSuccess:u}){const d=vv(s,r);return d?Jo({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:a,setInstallation:c,onInstallSuccess:u}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function wv(){return l.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),l.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Ni({text:e,children:t}){return l.jsx(Dn,{children:l.jsxs(en,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[l.jsx(wv,{}),l.jsx("p",{children:e}),t]})})}function Iv({provider:e}){const t=`You have successfully installed your ${tn(e)} integration.`;return l.jsx(Ni,{text:t,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(Bc,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const _v=e=>{const{read:t,write:n,proxy:r}=(e==null?void 0:e.content)??{};return!t&&!n&&(r==null?void 0:r.enabled)||!1};function bv({children:e}){var b;const{projectId:t}=Ae(),n=ze(),{hydratedRevision:r,loading:i}=$t(),{integrationObj:o,installation:s,groupRef:a,consumerRef:c,setInstallation:u,onInstallSuccess:d,isIntegrationDeleted:p}=rt(),{selectedConnection:f}=In(),[m,v]=g.useState(!1),h=i||m,w=(b=r==null?void 0:r.content)==null?void 0:b.provider,C=_v(r),y=x=>{console.error("Error when creating proxy installation:",x)};return g.useEffect(()=>{!h&&r&&C&&!s&&f&&n&&(o!=null&&o.id)&&!p&&(v(!0),yv({apiKey:n,projectId:t,integrationId:o==null?void 0:o.id,groupRef:a,consumerRef:c,connectionId:f==null?void 0:f.id,hydratedRevision:r,setError:y,setInstallation:u,onInstallSuccess:d}).then(()=>{v(!1)}).catch(x=>{v(!1),console.error("Error when creating proxy installation:",x)}))},[r,C,s,f,n,t,o==null?void 0:o.id,a,c,u,h,d,p]),o?h?l.jsx(Ur,{}):C&&w&&s?l.jsx(Iv,{provider:w}):l.jsx("div",{children:e}):l.jsx(Kt,{message:"We can't load the integration"})}function Jc(){return l.jsxs("footer",{style:{backgroundColor:"light-dark(#EFEFEF, #646266)",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[l.jsx("p",{style:{color:"light-dark(gray, #EFEFEF)"},children:"Secured by"}),l.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:l.jsxs("picture",{children:[l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",media:"(prefers-color-scheme: light)"}),l.jsx("source",{srcSet:"https://res.cloudinary.com/dycvts6vp/image/upload/v1735853540/ampersand_logo_white.svg",media:"(prefers-color-scheme: dark)"}),l.jsx("img",{style:{height:".8em"},src:"https://res.cloudinary.com/dycvts6vp/image/upload/v1723671980/ampersand-logo-black.svg",alt:"Ampersand"})]})})]})}function er({children:e}){return l.jsx(Dn,{children:l.jsxs(en,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(Jc,{})]})})}function tr({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function nr({error:e}){return e?l.jsx(Ca,{style:{marginTop:"2em"},children:e}):null}function Si({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:i,title:o}){if(!o&&!r)throw new Error("Either title or providerName is required");return l.jsxs(er,{children:[l.jsx(tr,{children:o||`Set up ${r} integration`}),l.jsx(nr,{error:t}),i,l.jsx(Ze,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const xv="_link_oo2kv_1",Cv={link:xv};function zc({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return l.jsx("a",{className:ct(Cv.link,t),style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i})}function Xc({url:e,providerDisplayName:t,credentialName:n}){return l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[l.jsx(zc,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const Ov="_textarea_18zl4_1",Ev="_textareaError_18zl4_14",Nv="_error_18zl4_29",_o={textarea:Ov,textareaError:Ev,error:Nv};function Sv({className:e,isError:t=!1,...n}){const r=t?ct(_o.textareaError,_o.textarea):_o.textarea;return l.jsx("textarea",{className:ct(e,r),...n})}const Vt={Input:Kr,Textarea:Sv};function Tv({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var h;const[o,s]=g.useState(!1),a=()=>s(w=>!w),[c,u]=g.useState(""),d=w=>u(w.currentTarget.value),p=c.length>0,f=i||!p,m=tn(e,t),v=(h=t.apiKeyOpts)==null?void 0:h.docsURL;return l.jsx(Si,{providerName:m,handleSubmit:()=>{n({apiKey:c})},error:r,isButtonDisabled:f,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&l.jsx(Xc,{url:v,providerDisplayName:m,credentialName:"API key"}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Vt.Input,{id:"password",name:"password",type:o?"text":"password",placeholder:"API Key",onChange:w=>d(w)}),l.jsx(Ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function Rv({...e}){return l.jsx(Tv,{...e})}function Av({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const u=Ae(),[d,p]=g.useState(!1),[f,m]=g.useState(null),v=ze();g.useEffect(()=>{if(e&&Te&&d&&f!=null){const w={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:f};Te().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:w},{headers:{"X-Api-Key":v??"","Content-Type":"application/json"}}).then(C=>{c(C)}).catch(C=>{console.error("Error loading provider info."),Je(C)})}},[v,e,d,r,n,o,i,u,c,f]);const h=w=>{m(w.apiKey),p(!0)};return a===null?l.jsx(Rv,{provider:e,providerInfo:t,handleSubmit:h,error:null}):s}function Pv({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var C;const[o,s]=g.useState(!1),a=()=>s(y=>!y),[c,u]=g.useState({username:"",password:""}),{username:d,password:p}=c,f=tn(e,t),m=(C=t.basicOpts)==null?void 0:C.docsURL,v=d.length>0,h=i||!v,w=y=>{const{name:b,value:x}=y.currentTarget;u(_=>({..._,[b]:x}))};return l.jsx(Si,{providerName:f,handleSubmit:()=>{n({user:d,pass:p})},error:r,isButtonDisabled:h,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[m&&l.jsx(Xc,{url:m,providerDisplayName:f,credentialName:"credentials"}),l.jsx(Vt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:y=>w(y)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Vt.Input,{id:"password",name:"password",type:o?"text":"password",placeholder:"Password",onChange:y=>w(y)}),l.jsx(Ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function Dv({...e}){return l.jsx(Pv,{...e})}function Mv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const u=Ae(),[d,p]=g.useState(!1),[f,m]=g.useState(null),v=ze();g.useEffect(()=>{if(e&&Te&&d&&f!=null){const w={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:f.user,password:f.pass}};Te().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:w},{headers:{"X-Api-Key":v??"","Content-Type":"application/json"}}).then(C=>{c(C)}).catch(C=>{console.error("Error loading provider info."),Je(C)})}},[v,e,d,r,n,o,i,u,f,c]);const h=w=>{const{user:C,pass:y}=w;m({user:C,pass:y}),p(!0)};return a===null?l.jsx(Dv,{provider:e,providerInfo:t,handleSubmit:h,error:null}):s}function Fv({...e}){return l.jsx(Si,{...e})}function kv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,setSelectedConnection:a,providerName:c}){const u=Ae(),d=ze(),[p,f]=g.useState(!1);g.useEffect(()=>{if(e&&Te&&p){const v={groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e};Te().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:v},{headers:{"X-Api-Key":d??"","Content-Type":"application/json"}}).then(h=>{a(h)}).catch(h=>{console.error("Error loading provider info."),Je(h)})}},[d,e,p,n,t,i,r,a,u]);const m=()=>{f(!0)};return s===null?l.jsx(Fv,{handleSubmit:m,error:null,providerName:c}):o}const jv=Bo("VITE_AMP_ENABLE_CSRF",!1),Lv=Bo("NEXT_AMP_ENABLE_CSRF",!1),Vv=Bo("REACT_APP_AMP_ENABLE_CSRF",!1),Kv=!!jv||!!Lv||!!Vv,Gc=async(e,t,n,r,i,o,s,a)=>{var u,d;const c=await Te().providerApi.getProvider({provider:i},{headers:{"X-Api-Key":r??""}});if(!c)throw new Error(`Provider ${i} not found`);if(c.authType==="oauth2"&&(((u=c.oauth2Opts)==null?void 0:u.grantType)==="authorizationCode"||((d=c.oauth2Opts)==null?void 0:d.grantType)==="authorizationCodePKCE")){const f=(await Te().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(w=>w.provider===i),m=tn(i,c);if(!f)throw new Error(`You must first set up a ${m} Provider App using the Ampersand Console.`);const v={connectOAuthParams:{providerWorkspaceRef:o,projectId:e,groupRef:n,groupName:a,consumerRef:t,consumerName:s,providerAppId:f.id,provider:i,enableCSRFProtection:Kv}};return await Te().oAuthApi.oauthConnect(v,{credentials:"include",headers:{"X-Api-Key":r??"","Content-Type":"application/json"}})}throw new Error(`Provider ${i} does not support an OAuth2 web flow.`)},Fs=600,ks=600,$v="AUTHORIZATION_SUCCEEDED",Hv="AUTHORIZATION_FAILED";function Uv(e,t,n){return g.useCallback(async r=>{const i=await Te().connectionApi.getConnection({projectIdOrName:e,connectionId:r},{headers:{"X-Api-Key":t??""}});n(i)},[e,t,n])}function Bv(e,t,n,r){return g.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-Fs)/2,o=window.screenY+(window.outerHeight-ks)/2.5,s=`width=${Fs},height=${ks},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function Wv(e,t){return g.useCallback(n=>{var r,i;if(n.origin===Hp){if(n.data.eventType===$v){const o=(r=n.data.data)==null?void 0:r.connection;o?e(o):console.error("Connection ID not found in event data: ",{event:n})}n.data.eventType===Hv&&(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 Yc({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i}){const o=ze(),{projectId:s}=Ae(),[a,c]=g.useState(null),[u,d]=g.useState(null),{setSelectedConnection:p}=In(),f=Wv(c,r),m=Bv(n,d,f,t),v=Uv(s,o,p);return g.useEffect(()=>{t&&!u&&m()},[t,u,m,f,n]),g.useEffect(()=>{a&&v(a).then(()=>{u==null||u.close()}).catch(h=>{console.error("Error refreshing connection: ",h),r==null||r(h.message??"Unexpected error: not able to refresh connection")})},[a,o,p,v,u,r]),g.useEffect(()=>{if(!u)return;const h=setInterval(()=>{u.closed&&(clearInterval(h),window.removeEventListener("message",f),d(null),!a&&!i?(console.error("OAuth failed. Please try again."),r==null||r("OAuth failed. Please try again.")):a&&(r==null||r(null)))},500);return()=>{clearInterval(h),window.removeEventListener("message",f)}},[u,a,i,f,r]),l.jsx("div",{children:e})}function qv({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(er,{children:[l.jsx(tr,{children:`Set up ${r} integration`}),l.jsx(nr,{error:t}),l.jsx(Ze,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function Jv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Ae(),a=ze(),[c,u]=g.useState(null),[d,p]=g.useState(null),f=async()=>{p(null);try{const v=await Gc(s,t,r,a,e,void 0,n,i);u(v)}catch(v){console.error("Could not fetch OAuth popup URL."),Je(v),p(v.message??"Unexpected error")}},m=g.useCallback(v=>{p(v),u(null)},[]);return l.jsx(Yc,{windowTitle:`Connect to ${o}`,oauthUrl:c,onError:m,children:l.jsx(qv,{handleSubmit:f,error:d,providerName:o})})}const zv="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function Xv({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(er,{children:[l.jsx(tr,{children:"Enter your Salesforce subdomain"}),l.jsx(zc,{href:zv,newTab:!0,children:"What is my Salesforce subdomain?"}),l.jsx(nr,{error:n}),l.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[l.jsx(Vt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:i=>t(i.currentTarget.value)}),l.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),l.jsx(Ze,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function Gv({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:i}){return l.jsxs(er,{children:[l.jsxs(tr,{children:["Enter your ",i," workspace"]}),l.jsx(nr,{error:n}),l.jsx("br",{}),l.jsx(Vt.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:o=>t(o.currentTarget.value)}),l.jsx("br",{}),l.jsx(Ze,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Yv="salesforce";function Zv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Ae(),a=ze(),[c,u]=g.useState(""),[d,p]=g.useState(null),[f,m]=g.useState(null),v=async()=>{if(m(null),!c){m("Workspace is required");return}try{const C=await Gc(s,t,r,a,e,c,n,i);p(C)}catch(C){console.error(C),m((C==null?void 0:C.message)??"Unexpected error")}},h=g.useCallback(C=>{m(C),p(null)},[]),w=e===Yv?l.jsx(Xv,{handleSubmit:v,setWorkspace:u,error:f,isButtonDisabled:c.length===0}):l.jsx(Gv,{handleSubmit:v,setWorkspace:u,error:f,isButtonDisabled:c.length===0,providerName:o});return l.jsx(Yc,{windowTitle:`Connect to ${o}`,oauthUrl:d,onError:h,children:w})}function Qv({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:i,explicitWorkspaceRequired:o}){const[s,a]=g.useState(!1),[c,u]=g.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),d=()=>a(_=>!_),p=_=>{const{name:E,value:D}=_.currentTarget;u(N=>({...N,[E]:D}))},{clientSecret:f,clientId:m,workspace:v,scopes:h}=c,w=f.length>0,C=m.length>0,y=o?v.length>0:!0,b=n||!w||!C||!y,x=()=>{const _={clientId:m,clientSecret:f};o&&(_.workspace=v),i&&h.length>0&&(_.scopes=cf(h)),e(_)};return l.jsxs(er,{children:[l.jsx(tr,{children:`Set up ${r} integration`}),l.jsx(nr,{error:t}),l.jsx("br",{}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[o&&l.jsx(Vt.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:_=>p(_)}),l.jsx(Vt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:_=>p(_)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(Vt.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:_=>p(_)}),l.jsx(Ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:d,children:s?"Hide":"Show"})]}),i&&l.jsx(Vt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:_=>p(_)})]}),l.jsx("br",{}),l.jsx(Ze,{style:{marginTop:"1em",width:"100%"},disabled:b,type:"submit",onClick:x,children:"Next"})]})}function ey({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c,setSelectedConnection:u}){const{projectId:d}=Ae(),p=ze(),[f,m]=g.useState(null),v=async h=>{m(null);const w={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:h.workspace,oauth2ClientCredentials:{clientId:h.clientId,clientSecret:h.clientSecret,scopes:h.scopes}};Te().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:w},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(C=>{u(C)}).catch(C=>{console.error("Error loading provider info."),Je(C),m("Error loading provider info")})};return c===null?l.jsx(Qv,{providerName:t,handleSubmit:v,error:f,explicitScopesRequired:s,explicitWorkspaceRequired:a}):l.jsx(Un,{})}function ty({...e}){return l.jsx(ey,{...e})}const ny="authorizationCode",ry="authorizationCodePKCE",oy="clientCredentials";function iy({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,selectedConnection:s,setSelectedConnection:a}){if(t.oauth2Opts===void 0)return l.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:c,explicitScopesRequired:u,explicitWorkspaceRequired:d}=t.oauth2Opts,p=tn(e,t),f={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:p};return c===ny||c===ry?d?l.jsx(Zv,{...f}):l.jsx(Jv,{...f}):c===oy?l.jsx(ty,{...f,explicitWorkspaceRequired:d,explicitScopesRequired:u,selectedConnection:s,setSelectedConnection:a}):c==="password"?l.jsx("em",{children:"Password flow not supported yet"}):l.jsxs("em",{children:["Unsupported grant type: ",c]})}function sy(e){const{selectedConnection:t}=In();g.useEffect(()=>{e&&t&&e(t)},[e,t])}function ay({onSuccess:e}){sy(e)}const cy=async(e,t)=>{const n=await Te().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!n)throw new Error(`Provider ${t} not found`);return n};function Zc({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const u=ze(),[d,p]=g.useState(null),{provider:f,isIntegrationDeleted:m}=rt(),{selectedConnection:v,setSelectedConnection:h}=In();ay({onSuccess:s});const w=e||f,C=(d==null?void 0:d.displayName)??Bn(w);if(g.useEffect(()=>{cy(u,w).then(b=>{p(b)}).catch(b=>{console.error("Error loading provider info."),Je(b)})},[u,w]),!e&&!f)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(m)return l.jsx(Ni,{text:"Integration successfully uninstalled.",children:l.jsx(Ze,{type:"button",onClick:c,style:{width:"100%"},children:"Reinstall Integration"})});if(v)return o;if(d==null)return l.jsx("strong",{children:"Provider not found"});const y={provider:w,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:v,setSelectedConnection:h,providerName:C,providerInfo:d,onDisconnectSuccess:a};return d.authType==="none"?l.jsx(kv,{...y,children:o}):d.authType==="basic"?l.jsx(Mv,{...y,children:o}):d.authType==="apiKey"?l.jsx(Av,{...y,children:o}):l.jsx(iy,{...y})}function ly(e){const t=e+"CollectionProvider",[n,r]=eo(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:v,children:h}=m,w=g.useRef(null),C=g.useRef(new Map).current;return l.jsx(i,{scope:v,itemMap:C,collectionRef:w,children:h})};s.displayName=t;const a=e+"CollectionSlot",c=g.forwardRef((m,v)=>{const{scope:h,children:w}=m,C=o(a,h),y=Xn(v,C.collectionRef);return l.jsx(Vr,{ref:y,children:w})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",p=g.forwardRef((m,v)=>{const{scope:h,children:w,...C}=m,y=g.useRef(null),b=Xn(v,y),x=o(u,h);return g.useEffect(()=>(x.itemMap.set(y,{ref:y,...C}),()=>void x.itemMap.delete(y))),l.jsx(Vr,{[d]:"",ref:b,children:w})});p.displayName=u;function f(m){const v=o(e+"CollectionConsumer",m);return g.useCallback(()=>{const w=v.collectionRef.current;if(!w)return[];const C=Array.from(w.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((x,_)=>C.indexOf(x.ref.current)-C.indexOf(_.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:c,ItemSlot:p},f,r]}var uy=H.useId||(()=>{}),dy=0;function Qc(e){const[t,n]=H.useState(uy());return Lr(()=>{e||n(r=>r??String(dy++))},[e]),e||(t?`radix-${t}`:"")}var py=H.createContext(void 0);function el(e){const t=H.useContext(py);return e||t||"ltr"}var bo="rovingFocusGroup.onEntryFocus",fy={bubbles:!1,cancelable:!0},to="RovingFocusGroup",[$o,tl,my]=ly(to),[hy,nl]=eo(to,[my]),[gy,vy]=hy(to),rl=H.forwardRef((e,t)=>l.jsx($o.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx($o.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(yy,{...e,ref:t})})}));rl.displayName=to;var yy=H.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...p}=e,f=H.useRef(null),m=Xn(t,f),v=el(o),[h=null,w]=Ci({prop:s,defaultProp:a,onChange:c}),[C,y]=H.useState(!1),b=xi(u),x=tl(n),_=H.useRef(!1),[E,D]=H.useState(0);return H.useEffect(()=>{const N=f.current;if(N)return N.addEventListener(bo,b),()=>N.removeEventListener(bo,b)},[b]),l.jsx(gy,{scope:n,orientation:r,dir:v,loop:i,currentTabStopId:h,onItemFocus:H.useCallback(N=>w(N),[w]),onItemShiftTab:H.useCallback(()=>y(!0),[]),onFocusableItemAdd:H.useCallback(()=>D(N=>N+1),[]),onFocusableItemRemove:H.useCallback(()=>D(N=>N-1),[]),children:l.jsx(nn.div,{tabIndex:C||E===0?-1:0,"data-orientation":r,...p,ref:m,style:{outline:"none",...e.style},onMouseDown:Ct(e.onMouseDown,()=>{_.current=!0}),onFocus:Ct(e.onFocus,N=>{const B=!_.current;if(N.target===N.currentTarget&&B&&!C){const W=new CustomEvent(bo,fy);if(N.currentTarget.dispatchEvent(W),!W.defaultPrevented){const q=x().filter(te=>te.focusable),X=q.find(te=>te.active),ee=q.find(te=>te.id===h),ie=[X,ee,...q].filter(Boolean).map(te=>te.ref.current);sl(ie,d)}}_.current=!1}),onBlur:Ct(e.onBlur,()=>y(!1))})})}),ol="RovingFocusGroupItem",il=H.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,a=Qc(),c=o||a,u=vy(ol,n),d=u.currentTabStopId===c,p=tl(n),{onFocusableItemAdd:f,onFocusableItemRemove:m}=u;return H.useEffect(()=>{if(r)return f(),()=>m()},[r,f,m]),l.jsx($o.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:l.jsx(nn.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Ct(e.onMouseDown,v=>{r?u.onItemFocus(c):v.preventDefault()}),onFocus:Ct(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:Ct(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const h=_y(v,u.orientation,u.dir);if(h!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let C=p().filter(y=>y.focusable).map(y=>y.ref.current);if(h==="last")C.reverse();else if(h==="prev"||h==="next"){h==="prev"&&C.reverse();const y=C.indexOf(v.currentTarget);C=u.loop?by(C,y+1):C.slice(y+1)}setTimeout(()=>sl(C))}})})})});il.displayName=ol;var wy={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Iy(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function _y(e,t,n){const r=Iy(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return wy[r]}function sl(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function by(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var xy=rl,Cy=il,Ti="Tabs",[Oy,Yy]=eo(Ti,[nl]),al=nl(),[Ey,Ri]=Oy(Ti),cl=H.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=el(a),[p,f]=Ci({prop:r,onChange:i,defaultProp:o});return l.jsx(Ey,{scope:n,baseId:Qc(),value:p,onValueChange:f,orientation:s,dir:d,activationMode:c,children:l.jsx(nn.div,{dir:d,"data-orientation":s,...u,ref:t})})});cl.displayName=Ti;var ll="TabsList",ul=H.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=Ri(ll,n),s=al(n);return l.jsx(xy,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:l.jsx(nn.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});ul.displayName=ll;var dl="TabsTrigger",pl=H.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=Ri(dl,n),a=al(n),c=ml(s.baseId,r),u=hl(s.baseId,r),d=r===s.value;return l.jsx(Cy,{asChild:!0,...a,focusable:!i,active:d,children:l.jsx(nn.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:c,...o,ref:t,onMouseDown:Ct(e.onMouseDown,p=>{!i&&p.button===0&&p.ctrlKey===!1?s.onValueChange(r):p.preventDefault()}),onKeyDown:Ct(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&s.onValueChange(r)}),onFocus:Ct(e.onFocus,()=>{const p=s.activationMode!=="manual";!d&&!i&&p&&s.onValueChange(r)})})})});pl.displayName=dl;var fl="TabsContent",Ny=H.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=Ri(fl,n),c=ml(a.baseId,r),u=hl(a.baseId,r),d=r===a.value,p=H.useRef(d);return H.useEffect(()=>{const f=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(f)},[]),l.jsx(Oi,{present:i||d,children:({present:f})=>l.jsx(nn.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!f,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:f&&o})})});Ny.displayName=fl;function ml(e,t){return`${e}-trigger-${t}`}function hl(e,t){return`${e}-content-${t}`}var Sy=cl,Ty=ul,gl=pl;const Ry=l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[l.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),l.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function Ay(e,t){return t?g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},g.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?Ry:l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:l.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}function Py(){return l.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.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:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),l.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#E73D3D",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Dy="_tabsRoot_ktpr0_1",My="_tabsList_ktpr0_6",Fy="_tabTrigger_ktpr0_12",ky="_danger_ktpr0_29",Gn={tabsRoot:Dy,tabsList:My,tabTrigger:Fy,danger:ky};function vl({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(gl,{value:e,className:Gn.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Ay(t,n),l.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[l.jsx("span",{children:r||e}),n&&l.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function jy({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(Qr,{style:{margin:"1rem 0"}}),l.jsx(vl,{objectName:hn,completed:e,pending:t,displayName:n},"other-write")]})}function Ly(){return l.jsxs(l.Fragment,{children:[l.jsx(Qr,{style:{margin:"3rem 0 1rem 0"}}),l.jsx(gl,{value:Nr,className:ct(Gn.tabTrigger,Gn.danger),children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Py(),l.jsx("span",{children:"Uninstall"})]})})]})}function Vy({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:i,showUninstallButton:o}){var s,a;return l.jsx(Sy,{value:e,className:Gn.tabsRoot,onValueChange:n,children:l.jsxs(Ty,{className:Gn.tabsList,children:[t.map(c=>{var u,d,p,f,m,v;return l.jsx(vl,{objectName:c.name,displayName:c.displayName,completed:c.completed,pending:((d=(u=r==null?void 0:r[c.name])==null?void 0:u.read)==null?void 0:d.isOptionalFieldsModified)||((f=(p=r==null?void 0:r[c.name])==null?void 0:p.read)==null?void 0:f.isRequiredMapFieldsModified)||((v=(m=r==null?void 0:r[c.name])==null?void 0:m.read)==null?void 0:v.isValueMappingsModified)||!1},c.name)}),i&&l.jsx(jy,{completed:i.completed,pending:((a=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:a.isWriteModified)||!1,displayName:"Write"}),o&&l.jsx(Ly,{})]})})}function Ky(e,t){return t===Nr?{name:Nr,completed:!1}:e.find(n=>n.name===t)}function $y({children:e}){var C;const{project:t}=Ae(),{installation:n,provider:r}=rt(),{hydratedRevision:i}=$t(),{objectConfigurationsState:o}=Ii(),[s,a]=g.useState(""),c=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=i&&pa(u,i),p=d!==null,f=!!((C=i==null?void 0:i.content)!=null&&C.write),m=f?fa(u):void 0,v=g.useMemo(()=>{const y=[...d||[]];return m&&f&&y.push(m),y},[d,m,f]),h=Ky(v,s),w=g.useCallback(()=>{const y=v.find(b=>h!==b&&!b.completed);y&&a(y.name)},[v,h]);return g.useEffect(()=>{!s&&v.length>0&&a(v[0].name)},[v,s,w]),l.jsx(xc.Provider,{value:w,children:l.jsx(_c.Provider,{value:h==null?void 0:h.name,children:l.jsxs(Dn,{style:{maxWidth:"55rem"},children:[l.jsxs(en,{style:{display:"flex",gap:"1rem",padding:"3rem",backgroundColor:"var(--amp-colors-bg-primary)"},children:[l.jsxs("div",{style:{width:"20rem"},children:[l.jsxs("h1",{style:{fontSize:"small",fontWeight:"400"},children:[tn(r)," integration"]}),l.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),p&&l.jsx(Vy,{value:s,readNavObjects:d,onValueChange:y=>a(y),objectConfigurationsState:o,writeNavObject:m,showUninstallButton:!!n})]}),e]}),l.jsx(Jc,{})]})})})}function Hy({...e}){return l.jsx($y,{...e})}function Uy({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var C;const{projectId:u,projectIdOrName:d,isLoading:p}=Ae(),{isLoading:f}=Uo(),{isError:m,errorState:v}=Tt(),{seed:h,reset:w}=ca();return p||f?l.jsx(Ur,{}):m(_e.PROJECT,d)?l.jsx(Kt,{message:`Error loading project ${d}`}):m(_e.INTEGRATION_LIST,d)?l.jsx(Kt,{message:"Error retrieving integrations for the project, double check the API key"}):(C=v[_e.INTEGRATION_LIST])!=null&&C.apiError?l.jsx(Kt,{message:"Something went wrong, couldn't find integration information"}):l.jsx("div",{className:la.resetContainer,children:l.jsx(uf,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:l.jsx(aa,{groupRef:r,children:l.jsx(Zc,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,resetComponent:w,children:l.jsx(Mf,{projectId:u,children:l.jsx(bv,{children:l.jsx(Gh,{children:l.jsx(Hy,{children:l.jsx(gv,{})})})})})})})},h)})}function By(){return l.jsxs(Dn,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(Un,{}),l.jsx("p",{children:"Redirecting"})]})}function Wy({redirectURL:e,children:t}){return g.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(By,{}):t}function qy({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:i}){const o=ze(),{projectId:s}=Ae(),{selectedConnection:a,setConnections:c}=In(),[u,d]=g.useState(!1),p=!s||!a||!a.id||u,f=async()=>{if(!p){d(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id});try{await Te().connectionApi.deleteConnection({projectIdOrName:s,connectionId:a==null?void 0:a.id},{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}),console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),Te().connectionApi.listConnections({projectIdOrName:s},{headers:{"X-Api-Key":o??""}}).then(h=>{c(h),i()}).catch(h=>{Je(h)})}catch(h){console.error("Error deleting connection."),Je(h)}finally{d(!1)}}},m=u?"Disconnecting...":e;return l.jsx(Ze,{type:"button",onClick:f,disabled:p,variant:t,style:n,children:m})}function Jy({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Ae(),i=`You have successfully connected your ${tn(e)} account to ${r}.`;return l.jsx(Ni,{text:i,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(qy,{resetComponent:n,onDisconnectSuccess:t,buttonText:"Remove Connection",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}function zy({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:u,reset:d}=ca(),p=g.useCallback(f=>{s?s(f.id):c&&c(f)},[s,c]);return l.jsx("div",{className:la.resetContainer,children:l.jsx(aa,{provider:e,groupRef:r,children:l.jsx(Zc,{resetComponent:d,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onSuccess:p,onDisconnectSuccess:a,children:l.jsx(Wy,{redirectURL:o,children:l.jsx(Jy,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},u)}const Xy=(e,t)=>{const n=ze(),{projectId:r,isLoading:i}=Ae(),{integrations:o}=Uo(),[s,a]=g.useState(!1),[c,u]=g.useState(null);if(!n||!i&&!r)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 p=g.useMemo(()=>o==null?void 0:o.reduce((f,m)=>(m==null?void 0:m.name)===e?m:f,{}),[o,e]);return g.useEffect(()=>{!p||i||Te().installationApi.listInstallations({projectIdOrName:r,integrationId:p.id,groupRef:t},{headers:{"x-api-key":n}}).then(f=>{a(!0),u(f.length>0)}).catch(f=>{console.error("Error listing installations."),Je(f),a(!0)})},[t,n,r,p,i]),{isLoaded:s,isIntegrationInstalled:c}};exports.AmpersandContext=ta;exports.AmpersandProvider=Jp;exports.ConnectProvider=zy;exports.FieldMapping=_i;exports.InstallIntegration=Uy;exports.useAmpersandProvider=zp;exports.useIsIntegrationInstalled=Xy;