@amp-labs/react 2.3.2 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,30 +1,30 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),h=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 U=zl(h),ks=h.createContext(null),Xl=ks.Provider,ze=()=>{const e=h.useContext(ks);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var me=(e=>(e.MAPPING="mappingError",e.INTEGRATION_LIST="integrationListError",e.PROJECT="projectError",e.CONNECTION_LIST="connectionListError",e.HYDRATED_REVISION="hydratedRevisionError",e.INSTALLATION_LIST="installationListError",e.INSTALLATION_MUTATION="installationMutationError",e.VALUE_MAPPING="valueMappingError",e))(me||{});const Ls=h.createContext(void 0);function Nt(){const e=h.useContext(Ls);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Gl=(()=>{const e={};return Object.values(me).forEach(t=>{e[t]={}}),e})();function Yl({children:e}){const[t,n]=h.useState(Gl),r=h.useCallback((d,p,m=!0)=>{n(f=>{const v={...f};return v[d]=v[d]||{},v[d][p]=m,v})},[n]),i=h.useCallback((d,p)=>{var m;return!!((m=t[d])!=null&&m[p])},[t]),o=h.useCallback((d,p)=>{var m;return(m=t[d])==null?void 0:m[p]},[t]),s=h.useCallback((d,p)=>{n(m=>{var v;const f={...m};return(v=f[d])==null||delete v[p],f})},[n]),a=h.useCallback(d=>{n(p=>{const m={...p};return m[d]={},m})},[n]),c=h.useCallback((d,p)=>{n(m=>{const f={...m};return f[d]=f[d]||{},p.forEach(v=>{f[d][v]=!0}),f})},[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(Ls.Provider,{value:u,children:e})}const Zl="https://api.withampersand.com/v1".replace(/\/+$/,"");class Bo{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 Bo,$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 St=$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 A(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 Ur(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:A(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:A(e,"keyFormat")?e.keyFormat:void 0}}function su(e){return au(e)}function au(e,t){return e==null?e:{name:e.name,valuePrefix:A(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:A(e,"query")?cu(e.query):void 0,header:A(e,"header")?su(e.header):void 0,docsURL:A(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:A(e,"days")?e.days:void 0,fullHistory:A(e,"fullHistory")?e.fullHistory:void 0}}function gu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Us(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:A(e,"enabled")?e.enabled:void 0}}function Hs(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:Ur(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:Ur(e.objects,Ou)}}function Nu(e){return Su(e)}function Su(e,t){return e==null?e:{apiKeyAsBasic:A(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:A(e,"apiKeyAsBasicOpts")?ou(e.apiKeyAsBasicOpts):void 0,docsURL:A(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 Au(e)}function Au(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:A(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:A(e,"updateTime")?new Date(e.updateTime):void 0}}function Ru(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:A(e,"read")?e.read:void 0,write:A(e,"write")?e.write:void 0,proxy:A(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:Hs(e.proxy)}}function ju(e){return ku(e)}function ku(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content: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:A(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:A(e,"updateTime")?new Date(e.updateTime):void 0}}function $u(e){return Uu(e)}function Uu(e,t){return e==null?e:{token:e.token}}function Hu(e){return Bu(e)}function Bu(e,t){return e==null?e:{token:e.token}}function qu(e){return Wu(e)}function Wu(e,t){return e==null?e:{accessToken:A(e,"accessToken")?$u(e.accessToken):void 0,refreshToken:A(e,"refreshToken")?Hu(e.refreshToken):void 0,scopes:A(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:A(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:A(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:A(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:A(e,"providerApp")?_r(e.providerApp):void 0,group:Bs(e.group),consumer:Lu(e.consumer),providerWorkspaceRef:A(e,"providerWorkspaceRef")?e.providerWorkspaceRef:void 0,providerConsumerRef:A(e,"providerConsumerRef")?e.providerConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:A(e,"updateTime")?new Date(e.updateTime):void 0,authScheme:e.authScheme,status:e.status,oauth2AuthorizationCode:A(e,"oauth2AuthorizationCode")?qu(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:A(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:A(e,"mode")?e.mode:void 0,pageSize:A(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:A(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:A(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 qs(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:A(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:A(e,"default")?e.default:void 0,prompt:A(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),...qs(e)}}function Ui(e){if(e!==void 0)return e===null?null:rd(e)?id(e):sd(e)?ad(e):{}}function Ws(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:A(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:A(e,"mapToDisplayName")?e.mapToDisplayName:void 0,requiredFields:A(e,"requiredFields")?e.requiredFields.map($i):void 0,optionalFields:A(e,"optionalFields")?e.optionalFields.map($i):void 0,optionalFieldsAuto:A(e,"optionalFieldsAuto")?Ws(e.optionalFieldsAuto):void 0,backfill:A(e,"backfill")?Us(e.backfill):void 0,delivery:A(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(Ui),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Ui),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:A(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:A(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:A(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:A(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:A(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:A(e,"displayName")?e.displayName:void 0,provider:e.provider,read:A(e,"read")?fd(e.read):void 0,write:A(e,"write")?_d(e.write):void 0,proxy:A(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 Ad(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 Rd(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:A(e,"valueType")?e.valueType:void 0,providerType:A(e,"providerType")?e.providerType:void 0,readOnly:A(e,"readOnly")?e.readOnly:void 0,values:A(e,"values")?e.values.map(Pd):void 0}}function jd(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function kd(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 Ud(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:jd(e.basicAuth),oauth2ClientCredentials:kd(e.oauth2ClientCredentials),oauth2Password:Ld(e.oauth2Password),oauth2AuthorizationCode:$d(e.oauth2AuthorizationCode)}}function Hd(e){return Bd(e)}function Bd(e,t){return e==null?e:{enabled:A(e,"enabled")?e.enabled:void 0}}function qd(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName,mapToName:A(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:A(e,"mapToDisplayName")?e.mapToDisplayName:void 0}}function ao(e){return Wd(e)}function Wd(e,t){return e==null?e:{...qd(e),...qs(e)}}function Jd(e){return zd(e)}function zd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,mapToName:A(e,"mapToName")?e.mapToName:void 0,mapToDisplayName:A(e,"mapToDisplayName")?e.mapToDisplayName:void 0,destination:e.destination,schedule:e.schedule,requiredFields:A(e,"requiredFields")?e.requiredFields.map(ao):void 0,optionalFields:A(e,"optionalFields")?e.optionalFields.map(ao):void 0,optionalFieldsAuto:A(e,"optionalFieldsAuto")?Ws(e.optionalFieldsAuto):void 0,allFields:A(e,"allFields")?e.allFields.map(ao):void 0,allFieldsMetadata:A(e,"allFieldsMetadata")?Ur(e.allFieldsMetadata,Md):void 0,backfill:A(e,"backfill")?Us(e.backfill):void 0}}function Xd(e){return Gd(e)}function Gd(e,t){return e==null?e:{objects:A(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:A(e,"valueDefaults")?Js(e.valueDefaults):void 0}}function Qd(e){return ep(e)}function ep(e,t){return e==null?e:{objects:A(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:A(e,"displayName")?e.displayName:void 0,provider:e.provider,read:A(e,"read")?Xd(e.read):void 0,write:A(e,"write")?Qd(e.write):void 0,proxy:A(e,"proxy")?Hd(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:A(e,"group")?Bs(e.group):void 0,healthStatus:e.healthStatus,connection:br(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:A(e,"updateTime")?new Date(e.updateTime):void 0,config:ju(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 Hi(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:A(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:A(e,"iconURL")?e.iconURL:void 0,logoURL:A(e,"logoURL")?e.logoURL:void 0}}function dp(e){return pp(e)}function pp(e,t){return e==null?e:{iconURL:A(e,"iconURL")?e.iconURL:void 0,logoURL:A(e,"logoURL")?e.logoURL:void 0}}function fp(e){return mp(e)}function mp(e,t){return e==null?e:{regular:A(e,"regular")?dp(e.regular):void 0,darkMode:A(e,"darkMode")?lp(e.darkMode):void 0}}function hp(e){return gp(e)}function gp(e,t){return e==null?e:{workspaceRefField:A(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:A(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:A(e,"scopesField")?e.scopesField:void 0}}function vp(e){return yp(e)}function yp(e,t){return e==null?e:{grantType:e.grantType,authURL:A(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:A(e,"audience")?e.audience:void 0,tokenMetadataFields:hp(e.tokenMetadataFields),docsURL:A(e,"docsURL")?e.docsURL:void 0,authURLParams:A(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:Ru(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:A(e,"oauth2Opts")?vp(e.oauth2Opts):void 0,apiKeyOpts:A(e,"apiKeyOpts")?uu(e.apiKeyOpts):void 0,basicOpts:A(e,"basicOpts")?Nu(e.basicOpts):void 0,support:Ip(e.support),providerOpts:e.providerOpts,displayName:A(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:A(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:A(e,"media")?fp(e.media):void 0,labels:A(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:Hs(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 Ap(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Tp(e.providerApp)}}class Rp extends St{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:Ud(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 St{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 St{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(Hi))}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(Hi))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class Mp extends St{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 St{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 jp extends St{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=>Ur(o,Bi))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class kp extends St{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:Ad(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:Ap(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 St{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:Rd(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 Rp(t),this.installationApi=new Pp(t),this.integrationApi=new Dp(t),this.oAuthApi=new Mp(t),this.projectApi=new Fp(t),this.providerApi=new jp(t),this.providerAppApi=new kp(t),this.revisionApi=new Lp(t)}}const Xs="2.3.2",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 Up=Gs(),Ys=$p(),Hp=new Bo({basePath:Ys,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Xs}});let Bp=new zs(Hp);const Te=()=>Bp;function Zs(){const e=ze();return h.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new Bo({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=h.createContext({integrations:null,isLoading:!0}),qo=()=>{const e=h.useContext(Qs);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function qp({projectIdOrName:e,children:t}){const n=ze(),{setError:r}=Nt(),[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(me.INTEGRATION_LIST,e)})},[e,n,r]);const c=h.useMemo(()=>({integrations:i,isLoading:s}),[i,s]);return l.jsx(Qs.Provider,{value:c,children:t})}const ea=h.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Re=()=>{const e=h.useContext(ea);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Wp({projectIdOrName:e,children:t}){const n=Zs(),{setError:r}=Nt(),[i,o]=h.useState(null),[s,a]=h.useState(!0);h.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(me.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(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(Wp,{projectIdOrName:o,children:l.jsx(qp,{projectIdOrName:o,children:i})})})})}const ta=h.createContext(null);function zp(){const e=h.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",qi={box:Gp};function en({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${qi.box} ${t}`:qi.box,style:n,children:e})}const Yp="_container_1wvzr_1",Wi={container:Yp};function Dn({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${Wi.container} ${t}`:Wi.container,style:n,children:e})}const Zp="_errorBoxContainer_4sdb2_1",Qp="_errorBox_4sdb2_1",ef="_errorText_4sdb2_20",co={errorBoxContainer:Zp,errorBox:Qp,errorText:ef};function na({message:e}){return l.jsxs(Dn,{className:co.errorBoxContainer,children:[l.jsx(Xp,{}),l.jsx(en,{className:co.errorBox,children:l.jsx("p",{className:co.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 Hn(){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 Hr(){return l.jsx(ra,{children:l.jsx(Hn,{})})}function Kt({message:e}){return l.jsx(ra,{children:l.jsx(na,{message:e})})}const oa=()=>{const[e,t]=h.useState(!1),n=h.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}};function Wo(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=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 Qe(){const e=h.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}=Re(),{integrations:m}=qo(),{setError:f,isError:v}=Nt(),{isIntegrationDeleted:I,setIntegrationDeleted:g}=oa(),[C,y]=h.useState([]),[b,x]=h.useState(!0),_=(C==null?void 0:C[0])||null,E=h.useMemo(()=>lf(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 k=h.useCallback(W=>{y([W])},[y]),S=h.useCallback(()=>{E!=null&&E.id&&Te().installationApi.listInstallations({projectIdOrName:p,integrationId:E.id,groupRef:i},{headers:{"X-Api-Key":d??""}}).then(W=>{x(!1),y(W||[])}).catch(W=>{f(me.INSTALLATION_LIST,E.id),x(!1),console.error("Error retrieving installation information: ",W)})},[E,p,d,f,i]),B=(E==null?void 0:E.id)||"";h.useEffect(()=>{S()},[S]);const q=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:_,setInstallation:k,resetInstallations:S,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:I,setIntegrationDeleted:g,fieldMapping:u}),[E,n,r,i,o,_,k,S,s,a,c,I,g,u]);if(b)return l.jsx(Hr,{});if(E===null)return l.jsx(Kt,{message:`Integration "${t}" not found`});if(v(me.INSTALLATION_LIST,B)){const W=`Error retrieving installation information for integration "${(E==null?void 0:E.name)||"unknown"}"`;return l.jsx(Kt,{message:W})}return l.jsx(ia.Provider,{value:q,children:e})}const sa=h.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{},isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}}),In=()=>{const e=h.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}=Re(),[s,a]=h.useState(null),[c,u]=h.useState(null),[d,p]=h.useState(!0),{setError:m,isError:f}=Nt(),{provider:v}=Qe(),{isIntegrationDeleted:I,setIntegrationDeleted:g}=oa(),C=e||v;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(_=>{p(!1),a(_)}).catch(_=>{console.error(`Error retrieving existing connections for group ID ${t}.`),Je(_),p(!1),m(me.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:g}),[s,c,a,u,I,g]);if(d||o)return l.jsx(Hr,{});if(f(me.PROJECT,i))return l.jsx(Kt,{message:`Error loading project ${i}`});if(f(me.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]=h.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 Jo(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]",m="[object Error]",f="[object Function]",v="[object GeneratorFunction]",I="[object Map]",g="[object Number]",C="[object Null]",y="[object Object]",b="[object Promise]",x="[object Proxy]",_="[object RegExp]",E="[object Set]",k="[object String]",S="[object Symbol]",B="[object Undefined]",q="[object WeakMap]",W="[object ArrayBuffer]",G="[object DataView]",ee="[object Float32Array]",$="[object Float64Array]",ie="[object Int8Array]",te="[object Int16Array]",X="[object Int32Array]",le="[object Uint8Array]",pe="[object Uint8ClampedArray]",N="[object Uint16Array]",D="[object Uint32Array]",L=/[\\^$.*+?()[\]{}|]/g,F=/^\[object .+?Constructor\]$/,M=/^(?:0|[1-9]\d*)$/,R={};R[ee]=R[$]=R[ie]=R[te]=R[X]=R[le]=R[pe]=R[N]=R[D]=!0,R[a]=R[c]=R[W]=R[d]=R[G]=R[p]=R[m]=R[f]=R[I]=R[g]=R[y]=R[_]=R[E]=R[k]=R[q]=!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 Ie(w,O){for(var T=-1,z=w==null?0:w.length,xe=0,ce=[];++T<z;){var Se=w[T];O(Se,T,w)&&(ce[xe++]=Se)}return ce}function Pe(w,O){for(var T=-1,z=O.length,xe=w.length;++T<z;)w[xe+T]=O[T];return w}function Ue(w,O){for(var T=-1,z=w==null?0:w.length;++T<z;)if(O(w[T],T,w))return!0;return!1}function Me(w,O){for(var T=-1,z=Array(w);++T<w;)z[T]=O(T);return z}function he(w){return function(O){return w(O)}}function vt(w,O){return w.has(O)}function He(w,O){return w==null?void 0:w[O]}function ot(w){var O=-1,T=Array(w.size);return w.forEach(function(z,xe){T[++O]=[xe,z]}),T}function yt(w,O){return function(T){return w(O(T))}}function wt(w){var O=-1,T=Array(w.size);return w.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,Rt=function(){var w=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||"");return w?"Symbol(src)_1."+w:""}(),Ut=Fe.toString,it=RegExp("^"+It.call(Xe).replace(L,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ee=ae?V.Buffer:void 0,Pt=V.Symbol,Ht=V.Uint8Array,Dt=Fe.propertyIsEnumerable,rn=Be.splice,et=Pt?Pt.toStringTag:void 0,Mt=Object.getOwnPropertySymbols,Bt=Ee?Ee.isBuffer:void 0,on=yt(Object.keys,Object),qt=_n(V,"DataView"),Ce=_n(V,"Map"),Ge=_n(V,"Promise"),ne=_n(V,"Set"),de=_n(V,"WeakMap"),je=_n(Object,"create"),Ft=cn(qt),H=cn(Ce),re=cn(Ge),se=cn(ne),Ae=cn(de),ke=Pt?Pt.prototype:void 0,tt=ke?ke.valueOf:void 0;function Ke(w){var O=-1,T=w==null?0:w.length;for(this.clear();++O<T;){var z=w[O];this.set(z[0],z[1])}}function qe(){this.__data__=je?je(null):{},this.size=0}function nt(w){var O=this.has(w)&&delete this.__data__[w];return this.size-=O?1:0,O}function be(w){var O=this.__data__;if(je){var T=O[w];return T===r?void 0:T}return Xe.call(O,w)?O[w]:void 0}function sn(w){var O=this.__data__;return je?O[w]!==void 0:Xe.call(O,w)}function oo(w,O){var T=this.__data__;return this.size+=this.has(w)?0:1,T[w]=je&&O===void 0?r:O,this}Ke.prototype.clear=qe,Ke.prototype.delete=nt,Ke.prototype.get=be,Ke.prototype.has=sn,Ke.prototype.set=oo;function ft(w){var O=-1,T=w==null?0:w.length;for(this.clear();++O<T;){var z=w[O];this.set(z[0],z[1])}}function rr(){this.__data__=[],this.size=0}function or(w){var O=this.__data__,T=ar(O,w);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(w){var O=this.__data__,T=ar(O,w);return T<0?void 0:O[T][1]}function _e(w){return ar(this.__data__,w)>-1}function _t(w,O){var T=this.__data__,z=ar(T,w);return z<0?(++this.size,T.push([w,O])):T[z][1]=O,this}ft.prototype.clear=rr,ft.prototype.delete=or,ft.prototype.get=ir,ft.prototype.has=_e,ft.prototype.set=_t;function bt(w){var O=-1,T=w==null?0:w.length;for(this.clear();++O<T;){var z=w[O];this.set(z[0],z[1])}}function an(){this.size=0,this.__data__={hash:new Ke,map:new(Ce||ft),string:new Ke}}function io(w){var O=cr(this,w).delete(w);return this.size-=O?1:0,O}function jn(w){return cr(this,w).get(w)}function yl(w){return cr(this,w).has(w)}function wl(w,O){var T=cr(this,w),z=T.size;return T.set(w,O),this.size+=T.size==z?0:1,this}bt.prototype.clear=an,bt.prototype.delete=io,bt.prototype.get=jn,bt.prototype.has=yl,bt.prototype.set=wl;function sr(w){var O=-1,T=w==null?0:w.length;for(this.__data__=new bt;++O<T;)this.add(w[O])}function Il(w){return this.__data__.set(w,r),this}function _l(w){return this.__data__.has(w)}sr.prototype.add=sr.prototype.push=Il,sr.prototype.has=_l;function Wt(w){var O=this.__data__=new ft(w);this.size=O.size}function bl(){this.__data__=new ft,this.size=0}function xl(w){var O=this.__data__,T=O.delete(w);return this.size=O.size,T}function Cl(w){return this.__data__.get(w)}function Ol(w){return this.__data__.has(w)}function El(w,O){var T=this.__data__;if(T instanceof ft){var z=T.__data__;if(!Ce||z.length<n-1)return z.push([w,O]),this.size=++T.size,this;T=this.__data__=new bt(z)}return T.set(w,O),this.size=T.size,this}Wt.prototype.clear=bl,Wt.prototype.delete=xl,Wt.prototype.get=Cl,Wt.prototype.has=Ol,Wt.prototype.set=El;function Nl(w,O){var T=lr(w),z=!T&&Ul(w),xe=!T&&!z&&so(w),ce=!T&&!z&&!xe&&Vi(w),Se=T||z||xe||ce,$e=Se?Me(w.length,String):[],We=$e.length;for(var Ne in w)Xe.call(w,Ne)&&!(Se&&(Ne=="length"||xe&&(Ne=="offset"||Ne=="parent")||ce&&(Ne=="buffer"||Ne=="byteLength"||Ne=="byteOffset")||kl(Ne,We)))&&$e.push(Ne);return $e}function ar(w,O){for(var T=w.length;T--;)if(Fi(w[T][0],O))return T;return-1}function Sl(w,O,T){var z=O(w);return lr(w)?z:Pe(z,T(w))}function kn(w){return w==null?w===void 0?B:C:et&&et in Object(w)?Fl(w):$l(w)}function Ri(w){return Ln(w)&&kn(w)==a}function Pi(w,O,T,z,xe){return w===O?!0:w==null||O==null||!Ln(w)&&!Ln(O)?w!==w&&O!==O:Tl(w,O,T,z,Pi,xe)}function Tl(w,O,T,z,xe,ce){var Se=lr(w),$e=lr(O),We=Se?c:Jt(w),Ne=$e?c:Jt(O);We=We==a?y:We,Ne=Ne==a?y:Ne;var st=We==y,xt=Ne==y,Ye=We==Ne;if(Ye&&so(w)){if(!so(O))return!1;Se=!0,st=!1}if(Ye&&!st)return ce||(ce=new Wt),Se||Vi(w)?Di(w,O,T,z,xe,ce):Dl(w,O,We,T,z,xe,ce);if(!(T&i)){var mt=st&&Xe.call(w,"__wrapped__"),ht=xt&&Xe.call(O,"__wrapped__");if(mt||ht){var zt=mt?w.value():w,jt=ht?O.value():O;return ce||(ce=new Wt),xe(zt,jt,T,z,ce)}}return Ye?(ce||(ce=new Wt),Ml(w,O,T,z,xe,ce)):!1}function Al(w){if(!Li(w)||Vl(w))return!1;var O=ji(w)?it:F;return O.test(cn(w))}function Rl(w){return Ln(w)&&ki(w.length)&&!!R[kn(w)]}function Pl(w){if(!Kl(w))return on(w);var O=[];for(var T in Object(w))Xe.call(w,T)&&T!="constructor"&&O.push(T);return O}function Di(w,O,T,z,xe,ce){var Se=T&i,$e=w.length,We=O.length;if($e!=We&&!(Se&&We>$e))return!1;var Ne=ce.get(w);if(Ne&&ce.get(O))return Ne==O;var st=-1,xt=!0,Ye=T&o?new sr:void 0;for(ce.set(w,O),ce.set(O,w);++st<$e;){var mt=w[st],ht=O[st];if(z)var zt=Se?z(ht,mt,st,O,w,ce):z(mt,ht,st,w,O,ce);if(zt!==void 0){if(zt)continue;xt=!1;break}if(Ye){if(!Ue(O,function(jt,ln){if(!vt(Ye,ln)&&(mt===jt||xe(mt,jt,T,z,ce)))return Ye.push(ln)})){xt=!1;break}}else if(!(mt===ht||xe(mt,ht,T,z,ce))){xt=!1;break}}return ce.delete(w),ce.delete(O),xt}function Dl(w,O,T,z,xe,ce,Se){switch(T){case G:if(w.byteLength!=O.byteLength||w.byteOffset!=O.byteOffset)return!1;w=w.buffer,O=O.buffer;case W:return!(w.byteLength!=O.byteLength||!ce(new Ht(w),new Ht(O)));case d:case p:case g:return Fi(+w,+O);case m:return w.name==O.name&&w.message==O.message;case _:case k:return w==O+"";case I:var $e=ot;case E:var We=z&i;if($e||($e=wt),w.size!=O.size&&!We)return!1;var Ne=Se.get(w);if(Ne)return Ne==O;z|=o,Se.set(w,O);var st=Di($e(w),$e(O),z,xe,ce,Se);return Se.delete(w),st;case S:if(tt)return tt.call(w)==tt.call(O)}return!1}function Ml(w,O,T,z,xe,ce){var Se=T&i,$e=Mi(w),We=$e.length,Ne=Mi(O),st=Ne.length;if(We!=st&&!Se)return!1;for(var xt=We;xt--;){var Ye=$e[xt];if(!(Se?Ye in O:Xe.call(O,Ye)))return!1}var mt=ce.get(w);if(mt&&ce.get(O))return mt==O;var ht=!0;ce.set(w,O),ce.set(O,w);for(var zt=Se;++xt<We;){Ye=$e[xt];var jt=w[Ye],ln=O[Ye];if(z)var Ki=Se?z(ln,jt,Ye,O,w,ce):z(jt,ln,Ye,w,O,ce);if(!(Ki===void 0?jt===ln||xe(jt,ln,T,z,ce):Ki)){ht=!1;break}zt||(zt=Ye=="constructor")}if(ht&&!zt){var ur=w.constructor,dr=O.constructor;ur!=dr&&"constructor"in w&&"constructor"in O&&!(typeof ur=="function"&&ur instanceof ur&&typeof dr=="function"&&dr instanceof dr)&&(ht=!1)}return ce.delete(w),ce.delete(O),ht}function Mi(w){return Sl(w,ql,jl)}function cr(w,O){var T=w.__data__;return Ll(O)?T[typeof O=="string"?"string":"hash"]:T.map}function _n(w,O){var T=He(w,O);return Al(T)?T:void 0}function Fl(w){var O=Xe.call(w,et),T=w[et];try{w[et]=void 0;var z=!0}catch{}var xe=Ut.call(w);return z&&(O?w[et]=T:delete w[et]),xe}var jl=Mt?function(w){return w==null?[]:(w=Object(w),Ie(Mt(w),function(O){return Dt.call(w,O)}))}:Wl,Jt=kn;(qt&&Jt(new qt(new ArrayBuffer(1)))!=G||Ce&&Jt(new Ce)!=I||Ge&&Jt(Ge.resolve())!=b||ne&&Jt(new ne)!=E||de&&Jt(new de)!=q)&&(Jt=function(w){var O=kn(w),T=O==y?w.constructor:void 0,z=T?cn(T):"";if(z)switch(z){case Ft:return G;case H:return I;case re:return b;case se:return E;case Ae:return q}return O});function kl(w,O){return O=O??s,!!O&&(typeof w=="number"||M.test(w))&&w>-1&&w%1==0&&w<O}function Ll(w){var O=typeof w;return O=="string"||O=="number"||O=="symbol"||O=="boolean"?w!=="__proto__":w===null}function Vl(w){return!!Rt&&Rt in w}function Kl(w){var O=w&&w.constructor,T=typeof O=="function"&&O.prototype||Fe;return w===T}function $l(w){return Ut.call(w)}function cn(w){if(w!=null){try{return It.call(w)}catch{}try{return w+""}catch{}}return""}function Fi(w,O){return w===O||w!==w&&O!==O}var Ul=Ri(function(){return arguments}())?Ri:function(w){return Ln(w)&&Xe.call(w,"callee")&&!Dt.call(w,"callee")},lr=Array.isArray;function Hl(w){return w!=null&&ki(w.length)&&!ji(w)}var so=Bt||Jl;function Bl(w,O){return Pi(w,O)}function ji(w){if(!Li(w))return!1;var O=kn(w);return O==f||O==v||O==u||O==x}function ki(w){return typeof w=="number"&&w>-1&&w%1==0&&w<=s}function Li(w){var O=typeof w;return w!=null&&(O=="object"||O=="function")}function Ln(w){return w!=null&&typeof w=="object"}var Vi=K?he(K):Rl;function ql(w){return Hl(w)?Nl(w):Pl(w)}function Wl(){return[]}function Jl(){return!1}e.exports=Bl})(Er,Er.exports);var pf=Er.exports;const ua=Jo(pf),hn="other",Nr="uninstall-installation";function Yt(e){return!e.fieldName}function zo(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(me.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 g,C,y,b,x,_,E,k,S;if(!e)return null;const r=zo(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=(g=d==null?void 0:d.read)==null?void 0:g.objects)==null?void 0:C[t])==null?void 0:y.selectedFields)||{},m=((_=(x=(b=d==null?void 0:d.read)==null?void 0:b.objects)==null?void 0:x[t])==null?void 0:_.selectedValueMappings)||{},f=((S=(k=(E=d==null?void 0:d.read)==null?void 0:E.objects)==null?void 0:k[t])==null?void 0:S.selectedFieldMappings)||{},v={...p},I={...f};return{allFields:c,allFieldsMetadata:u,requiredFields:i,optionalFields:o,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:p,selectedFieldMappings:f,selectedValueMappings:m,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:v,requiredMapFields:I,selectedValueMappings:m}}},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 Xo({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 m=xf(c,o,a,r);return m?Xo({createConfig:m,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?Xo({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:{}};/*!
1
+ "use strict";var ya=e=>{throw TypeError(e)};var wo=(e,t,n)=>t.has(e)||ya("Cannot "+n);var O=(e,t,n)=>(wo(e,t,"read from private field"),n?n.call(e):t.get(e)),ae=(e,t,n)=>t.has(e)?ya("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Y=(e,t,n,r)=>(wo(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),me=(e,t,n)=>(wo(e,t,"access private method"),n);var wi=(e,t,n,r)=>({set _(o){Y(e,t,o,n)},get _(){return O(e,t,r)}});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),w=require("react");require("react-dom");function ef(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 $=ef(w);var ri=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Yn=typeof window>"u"||"Deno"in globalThis;function Rt(){}function tf(e,t){return typeof e=="function"?e(t):e}function Lo(e){return typeof e=="number"&&e>=0&&e!==1/0}function Dc(e,t){return Math.max(e+(t||0)-Date.now(),0)}function lr(e,t){return typeof e=="function"?e(t):e}function Kt(e,t){return typeof e=="function"?e(t):e}function va(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==ys(s,t.options))return!1}else if(!Hr(t.queryKey,s))return!1}if(n!=="all"){const c=t.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function wa(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(qr(t.options.mutationKey)!==qr(i))return!1}else if(!Hr(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function ys(e,t){return((t==null?void 0:t.queryKeyHashFn)||qr)(e)}function qr(e){return JSON.stringify(e,(t,n)=>$o(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function Hr(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!Hr(e[n],t[n])):!1}function Vo(e,t){if(e===t)return e;const n=Ia(e)&&Ia(t);if(n||$o(e)&&$o(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let c=0;for(let u=0;u<s;u++){const d=n?u:i[u];(!n&&r.includes(d)||n)&&e[d]===void 0&&t[d]===void 0?(a[d]=void 0,c++):(a[d]=Vo(e[d],t[d]),a[d]===e[d]&&e[d]!==void 0&&c++)}return o===s&&c===o?e:a}return t}function Ko(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Ia(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function $o(e){if(!ba(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!ba(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ba(e){return Object.prototype.toString.call(e)==="[object Object]"}function nf(e){return new Promise(t=>{setTimeout(t,e)})}function Uo(e,t,n){if(typeof n.structuralSharing=="function")return n.structuralSharing(e,t);if(n.structuralSharing!==!1){if(process.env.NODE_ENV!=="production")try{return Vo(e,t)}catch(r){console.error(`Structural sharing requires data to be JSON serializable. To fix this, turn off structuralSharing or return JSON-serializable data from your queryFn. [${n.queryHash}]: ${r}`)}return Vo(e,t)}return t}function rf(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function of(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Mi=Symbol();function Fc(e,t){return process.env.NODE_ENV!=="production"&&e.queryFn===Mi&&console.error(`Attempted to invoke queryFn when set to skipToken. This is likely a configuration error. Query hash: '${e.queryHash}'`),!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Mi?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var Hn,In,dr,Cc,sf=(Cc=class extends ri{constructor(){super();ae(this,Hn);ae(this,In);ae(this,dr);Y(this,dr,t=>{if(!Yn&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){O(this,In)||this.setEventListener(O(this,dr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,In))==null||t.call(this),Y(this,In,void 0))}setEventListener(t){var n;Y(this,dr,t),(n=O(this,In))==null||n.call(this),Y(this,In,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){O(this,Hn)!==t&&(Y(this,Hn,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof O(this,Hn)=="boolean"?O(this,Hn):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},Hn=new WeakMap,In=new WeakMap,dr=new WeakMap,Cc),vs=new sf,fr,bn,pr,Oc,af=(Oc=class extends ri{constructor(){super();ae(this,fr,!0);ae(this,bn);ae(this,pr);Y(this,pr,t=>{if(!Yn&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){O(this,bn)||this.setEventListener(O(this,pr))}onUnsubscribe(){var t;this.hasListeners()||((t=O(this,bn))==null||t.call(this),Y(this,bn,void 0))}setEventListener(t){var n;Y(this,pr,t),(n=O(this,bn))==null||n.call(this),Y(this,bn,t(this.setOnline.bind(this)))}setOnline(t){O(this,fr)!==t&&(Y(this,fr,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return O(this,fr)}},fr=new WeakMap,bn=new WeakMap,pr=new WeakMap,Oc),ji=new af;function qo(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function cf(e){return Math.min(1e3*2**e,3e4)}function Mc(e){return(e??"online")==="online"?ji.isOnline():!0}var jc=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Io(e){return e instanceof jc}function kc(e){let t=!1,n=0,r=!1,o;const i=qo(),s=v=>{var m;r||(h(new jc(v)),(m=e.abort)==null||m.call(e))},a=()=>{t=!0},c=()=>{t=!1},u=()=>vs.isFocused()&&(e.networkMode==="always"||ji.isOnline())&&e.canRun(),d=()=>Mc(e.networkMode)&&e.canRun(),f=v=>{var m;r||(r=!0,(m=e.onSuccess)==null||m.call(e,v),o==null||o(),i.resolve(v))},h=v=>{var m;r||(r=!0,(m=e.onError)==null||m.call(e,v),o==null||o(),i.reject(v))},p=()=>new Promise(v=>{var m;o=C=>{(r||u())&&v(C)},(m=e.onPause)==null||m.call(e)}).then(()=>{var v;o=void 0,r||(v=e.onContinue)==null||v.call(e)}),g=()=>{if(r)return;let v;const m=n===0?e.initialPromise:void 0;try{v=m??e.fn()}catch(C){v=Promise.reject(C)}Promise.resolve(v).then(f).catch(C=>{var S;if(r)return;const y=e.retry??(Yn?0:3),_=e.retryDelay??cf,x=typeof _=="function"?_(n,C):_,b=y===!0||typeof y=="number"&&n<y||typeof y=="function"&&y(n,C);if(t||!b){h(C);return}n++,(S=e.onFail)==null||S.call(e,n,C),nf(x).then(()=>u()?void 0:p()).then(()=>{t?h(C):g()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:c,canStart:d,start:()=>(d()?g():p().then(g),i)}}function lf(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0);const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(c=>{n(c)})})})};return{batch:a=>{let c;t++;try{c=a()}finally{t--,t||s()}return c},batchCalls:a=>(...c)=>{i(()=>{a(...c)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var et=lf(),Bn,Ec,Lc=(Ec=class{constructor(){ae(this,Bn)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Lo(this.gcTime)&&Y(this,Bn,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Yn?1/0:5*60*1e3))}clearGcTimeout(){O(this,Bn)&&(clearTimeout(O(this,Bn)),Y(this,Bn,void 0))}},Bn=new WeakMap,Ec),hr,mr,Tt,ot,Zr,Wn,Lt,sn,Sc,uf=(Sc=class extends Lc{constructor(t){super();ae(this,Lt);ae(this,hr);ae(this,mr);ae(this,Tt);ae(this,ot);ae(this,Zr);ae(this,Wn);Y(this,Wn,!1),Y(this,Zr,t.defaultOptions),this.setOptions(t.options),this.observers=[],Y(this,Tt,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,Y(this,hr,df(this.options)),this.state=t.state??O(this,hr),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=O(this,ot))==null?void 0:t.promise}setOptions(t){this.options={...O(this,Zr),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&O(this,Tt).remove(this)}setData(t,n){const r=Uo(this.state.data,t,this.options);return me(this,Lt,sn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){me(this,Lt,sn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=O(this,ot))==null?void 0:r.promise;return(o=O(this,ot))==null||o.cancel(t),n?n.then(Rt).catch(Rt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(O(this,hr))}isActive(){return this.observers.some(t=>Kt(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Mi||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Dc(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,ot))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=O(this,ot))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),O(this,Tt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(O(this,ot)&&(O(this,Wn)?O(this,ot).cancel({revert:!0}):O(this,ot).cancelRetry()),this.scheduleGc()),O(this,Tt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||me(this,Lt,sn).call(this,{type:"invalidate"})}fetch(t,n){var c,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(O(this,ot))return O(this,ot).continueRetry(),O(this,ot).promise}if(t&&this.setOptions(t),!this.options.queryFn){const f=this.observers.find(h=>h.options.queryFn);f&&this.setOptions(f.options)}process.env.NODE_ENV!=="production"&&(Array.isArray(this.options.queryKey)||console.error("As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"));const r=new AbortController,o=f=>{Object.defineProperty(f,"signal",{enumerable:!0,get:()=>(Y(this,Wn,!0),r.signal)})},i=()=>{const f=Fc(this.options,n),h={queryKey:this.queryKey,meta:this.meta};return o(h),Y(this,Wn,!1),this.options.persister?this.options.persister(f,h,this):f(h)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};o(s),(c=this.options.behavior)==null||c.onFetch(s,this),Y(this,mr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&me(this,Lt,sn).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const a=f=>{var h,p,g,v;Io(f)&&f.silent||me(this,Lt,sn).call(this,{type:"error",error:f}),Io(f)||((p=(h=O(this,Tt).config).onError)==null||p.call(h,f,this),(v=(g=O(this,Tt).config).onSettled)==null||v.call(g,this.state.data,f,this)),this.scheduleGc()};return Y(this,ot,kc({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:f=>{var h,p,g,v;if(f===void 0){process.env.NODE_ENV!=="production"&&console.error(`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`),a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(f)}catch(m){a(m);return}(p=(h=O(this,Tt).config).onSuccess)==null||p.call(h,f,this),(v=(g=O(this,Tt).config).onSettled)==null||v.call(g,f,this.state.error,this),this.scheduleGc()},onError:a,onFail:(f,h)=>{me(this,Lt,sn).call(this,{type:"failed",failureCount:f,error:h})},onPause:()=>{me(this,Lt,sn).call(this,{type:"pause"})},onContinue:()=>{me(this,Lt,sn).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),O(this,ot).start()}},hr=new WeakMap,mr=new WeakMap,Tt=new WeakMap,ot=new WeakMap,Zr=new WeakMap,Wn=new WeakMap,Lt=new WeakSet,sn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Vc(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return Io(o)&&o.revert&&O(this,mr)?{...O(this,mr),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),et.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),O(this,Tt).notify({query:this,type:"updated",action:t})})},Sc);function Vc(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Mc(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function df(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Bt,Nc,ff=(Nc=class extends ri{constructor(t={}){super();ae(this,Bt);this.config=t,Y(this,Bt,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??ys(o,n);let s=this.get(i);return s||(s=new uf({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){O(this,Bt).has(t.queryHash)||(O(this,Bt).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=O(this,Bt).get(t.queryHash);n&&(t.destroy(),n===t&&O(this,Bt).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){et.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return O(this,Bt).get(t)}getAll(){return[...O(this,Bt).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>va(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>va(t,r)):n}notify(t){et.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){et.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){et.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Bt=new WeakMap,Nc),Wt,ct,Jn,Jt,wn,Tc,pf=(Tc=class extends Lc{constructor(t){super();ae(this,Jt);ae(this,Wt);ae(this,ct);ae(this,Jn);this.mutationId=t.mutationId,Y(this,ct,t.mutationCache),Y(this,Wt,[]),this.state=t.state||hf(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){O(this,Wt).includes(t)||(O(this,Wt).push(t),this.clearGcTimeout(),O(this,ct).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){Y(this,Wt,O(this,Wt).filter(n=>n!==t)),this.scheduleGc(),O(this,ct).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){O(this,Wt).length||(this.state.status==="pending"?this.scheduleGc():O(this,ct).remove(this))}continue(){var t;return((t=O(this,Jn))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,c,u,d,f,h,p,g,v,m,C,y,_,x,b,S,R;Y(this,Jn,kc({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(N,M)=>{me(this,Jt,wn).call(this,{type:"failed",failureCount:N,error:M})},onPause:()=>{me(this,Jt,wn).call(this,{type:"pause"})},onContinue:()=>{me(this,Jt,wn).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>O(this,ct).canRun(this)}));const n=this.state.status==="pending",r=!O(this,Jn).canStart();try{if(!n){me(this,Jt,wn).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=O(this,ct).config).onMutate)==null?void 0:i.call(o,t,this));const M=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));M!==this.state.context&&me(this,Jt,wn).call(this,{type:"pending",context:M,variables:t,isPaused:r})}const N=await O(this,Jn).start();return await((u=(c=O(this,ct).config).onSuccess)==null?void 0:u.call(c,N,t,this.state.context,this)),await((f=(d=this.options).onSuccess)==null?void 0:f.call(d,N,t,this.state.context)),await((p=(h=O(this,ct).config).onSettled)==null?void 0:p.call(h,N,null,this.state.variables,this.state.context,this)),await((v=(g=this.options).onSettled)==null?void 0:v.call(g,N,null,t,this.state.context)),me(this,Jt,wn).call(this,{type:"success",data:N}),N}catch(N){try{throw await((C=(m=O(this,ct).config).onError)==null?void 0:C.call(m,N,t,this.state.context,this)),await((_=(y=this.options).onError)==null?void 0:_.call(y,N,t,this.state.context)),await((b=(x=O(this,ct).config).onSettled)==null?void 0:b.call(x,void 0,N,this.state.variables,this.state.context,this)),await((R=(S=this.options).onSettled)==null?void 0:R.call(S,void 0,N,t,this.state.context)),N}finally{me(this,Jt,wn).call(this,{type:"error",error:N})}}finally{O(this,ct).runNext(this)}}},Wt=new WeakMap,ct=new WeakMap,Jn=new WeakMap,Jt=new WeakSet,wn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),et.batch(()=>{O(this,Wt).forEach(r=>{r.onMutationUpdate(t)}),O(this,ct).notify({mutation:this,type:"updated",action:t})})},Tc);function hf(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var an,Vt,ei,Rc,mf=(Rc=class extends ri{constructor(t={}){super();ae(this,an);ae(this,Vt);ae(this,ei);this.config=t,Y(this,an,new Set),Y(this,Vt,new Map),Y(this,ei,0)}build(t,n,r){const o=new pf({mutationCache:this,mutationId:++wi(this,ei)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){O(this,an).add(t);const n=Ii(t);if(typeof n=="string"){const r=O(this,Vt).get(n);r?r.push(t):O(this,Vt).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(O(this,an).delete(t)){const n=Ii(t);if(typeof n=="string"){const r=O(this,Vt).get(n);if(r)if(r.length>1){const o=r.indexOf(t);o!==-1&&r.splice(o,1)}else r[0]===t&&O(this,Vt).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=Ii(t);if(typeof n=="string"){const r=O(this,Vt).get(n),o=r==null?void 0:r.find(i=>i.state.status==="pending");return!o||o===t}else return!0}runNext(t){var r;const n=Ii(t);if(typeof n=="string"){const o=(r=O(this,Vt).get(n))==null?void 0:r.find(i=>i!==t&&i.state.isPaused);return(o==null?void 0:o.continue())??Promise.resolve()}else return Promise.resolve()}clear(){et.batch(()=>{O(this,an).forEach(t=>{this.notify({type:"removed",mutation:t})}),O(this,an).clear(),O(this,Vt).clear()})}getAll(){return Array.from(O(this,an))}find(t){const n={exact:!0,...t};return this.getAll().find(r=>wa(n,r))}findAll(t={}){return this.getAll().filter(n=>wa(t,n))}notify(t){et.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return et.batch(()=>Promise.all(t.map(n=>n.continue().catch(Rt))))}},an=new WeakMap,Vt=new WeakMap,ei=new WeakMap,Rc);function Ii(e){var t;return(t=e.options.scope)==null?void 0:t.id}function _a(e){return{onFetch:(t,n)=>{var d,f,h,p,g;const r=t.options,o=(h=(f=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:f.fetchMore)==null?void 0:h.direction,i=((p=t.state.data)==null?void 0:p.pages)||[],s=((g=t.state.data)==null?void 0:g.pageParams)||[];let a={pages:[],pageParams:[]},c=0;const u=async()=>{let v=!1;const m=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(t.signal.aborted?v=!0:t.signal.addEventListener("abort",()=>{v=!0}),t.signal)})},C=Fc(t.options,t.fetchOptions),y=async(_,x,b)=>{if(v)return Promise.reject();if(x==null&&_.pages.length)return Promise.resolve(_);const S={queryKey:t.queryKey,pageParam:x,direction:b?"backward":"forward",meta:t.options.meta};m(S);const R=await C(S),{maxPages:N}=t.options,M=b?of:rf;return{pages:M(_.pages,R,N),pageParams:M(_.pageParams,x,N)}};if(o&&i.length){const _=o==="backward",x=_?gf:xa,b={pages:i,pageParams:s},S=x(r,b);a=await y(b,S,_)}else{const _=e??i.length;do{const x=c===0?s[0]??r.initialPageParam:xa(r,a);if(c>0&&x==null)break;a=await y(a,x),c++}while(c<_)}return a};t.options.persister?t.fetchFn=()=>{var v,m;return(m=(v=t.options).persister)==null?void 0:m.call(v,u,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function xa(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function gf(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Me,_n,xn,gr,yr,Cn,vr,wr,Ac,yf=(Ac=class{constructor(e={}){ae(this,Me);ae(this,_n);ae(this,xn);ae(this,gr);ae(this,yr);ae(this,Cn);ae(this,vr);ae(this,wr);Y(this,Me,e.queryCache||new ff),Y(this,_n,e.mutationCache||new mf),Y(this,xn,e.defaultOptions||{}),Y(this,gr,new Map),Y(this,yr,new Map),Y(this,Cn,0)}mount(){wi(this,Cn)._++,O(this,Cn)===1&&(Y(this,vr,vs.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Me).onFocus())})),Y(this,wr,ji.subscribe(async e=>{e&&(await this.resumePausedMutations(),O(this,Me).onOnline())})))}unmount(){var e,t;wi(this,Cn)._--,O(this,Cn)===0&&((e=O(this,vr))==null||e.call(this),Y(this,vr,void 0),(t=O(this,wr))==null||t.call(this),Y(this,wr,void 0))}isFetching(e){return O(this,Me).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return O(this,_n).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Me).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=O(this,Me).build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(lr(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return O(this,Me).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=O(this,Me).get(r.queryHash),i=o==null?void 0:o.state.data,s=tf(t,i);if(s!==void 0)return O(this,Me).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return et.batch(()=>O(this,Me).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=O(this,Me).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=O(this,Me);et.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=O(this,Me),r={type:"active",...e};return et.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=et.batch(()=>O(this,Me).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Rt).catch(Rt)}invalidateQueries(e,t={}){return et.batch(()=>{if(O(this,Me).findAll(e).forEach(r=>{r.invalidate()}),(e==null?void 0:e.refetchType)==="none")return Promise.resolve();const n={...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"};return this.refetchQueries(n,t)})}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=et.batch(()=>O(this,Me).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Rt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Rt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=O(this,Me).build(this,t);return n.isStaleByTime(lr(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Rt).catch(Rt)}fetchInfiniteQuery(e){return e.behavior=_a(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Rt).catch(Rt)}ensureInfiniteQueryData(e){return e.behavior=_a(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ji.isOnline()?O(this,_n).resumePausedMutations():Promise.resolve()}getQueryCache(){return O(this,Me)}getMutationCache(){return O(this,_n)}getDefaultOptions(){return O(this,xn)}setDefaultOptions(e){Y(this,xn,e)}setQueryDefaults(e,t){O(this,gr).set(qr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...O(this,gr).values()],n={};return t.forEach(r=>{Hr(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){O(this,yr).set(qr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...O(this,yr).values()];let n={};return t.forEach(r=>{Hr(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...O(this,xn).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ys(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===Mi&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...O(this,xn).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){O(this,Me).clear(),O(this,_n).clear()}},Me=new WeakMap,_n=new WeakMap,xn=new WeakMap,gr=new WeakMap,yr=new WeakMap,Cn=new WeakMap,vr=new WeakMap,wr=new WeakMap,Ac),ht,ge,ti,lt,zn,Ir,On,zt,ni,br,_r,Gn,Xn,En,xr,Oe,Vr,Ho,Bo,Wo,Jo,zo,Go,Xo,Kc,Pc,vf=(Pc=class extends ri{constructor(t,n){super();ae(this,Oe);ae(this,ht);ae(this,ge);ae(this,ti);ae(this,lt);ae(this,zn);ae(this,Ir);ae(this,On);ae(this,zt);ae(this,ni);ae(this,br);ae(this,_r);ae(this,Gn);ae(this,Xn);ae(this,En);ae(this,xr,new Set);this.options=n,Y(this,ht,t),Y(this,zt,null),Y(this,On,qo()),this.options.experimental_prefetchInRender||O(this,On).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(O(this,ge).addObserver(this),Ca(O(this,ge),this.options)?me(this,Oe,Vr).call(this):this.updateResult(),me(this,Oe,Jo).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Qo(O(this,ge),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Qo(O(this,ge),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,me(this,Oe,zo).call(this),me(this,Oe,Go).call(this),O(this,ge).removeObserver(this)}setOptions(t,n){const r=this.options,o=O(this,ge);if(this.options=O(this,ht).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Kt(this.options.enabled,O(this,ge))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");me(this,Oe,Xo).call(this),O(this,ge).setOptions(this.options),r._defaulted&&!Ko(this.options,r)&&O(this,ht).getQueryCache().notify({type:"observerOptionsUpdated",query:O(this,ge),observer:this});const i=this.hasListeners();i&&Oa(O(this,ge),o,this.options,r)&&me(this,Oe,Vr).call(this),this.updateResult(n),i&&(O(this,ge)!==o||Kt(this.options.enabled,O(this,ge))!==Kt(r.enabled,O(this,ge))||lr(this.options.staleTime,O(this,ge))!==lr(r.staleTime,O(this,ge)))&&me(this,Oe,Ho).call(this);const s=me(this,Oe,Bo).call(this);i&&(O(this,ge)!==o||Kt(this.options.enabled,O(this,ge))!==Kt(r.enabled,O(this,ge))||s!==O(this,En))&&me(this,Oe,Wo).call(this,s)}getOptimisticResult(t){const n=O(this,ht).getQueryCache().build(O(this,ht),t),r=this.createResult(n,t);return If(this,r)&&(Y(this,lt,r),Y(this,Ir,this.options),Y(this,zn,O(this,ge).state)),r}getCurrentResult(){return O(this,lt)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){O(this,xr).add(t)}getCurrentQuery(){return O(this,ge)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=O(this,ht).defaultQueryOptions(t),r=O(this,ht).getQueryCache().build(O(this,ht),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return me(this,Oe,Vr).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),O(this,lt)))}createResult(t,n){var N;const r=O(this,ge),o=this.options,i=O(this,lt),s=O(this,zn),a=O(this,Ir),u=t!==r?t.state:O(this,ti),{state:d}=t;let f={...d},h=!1,p;if(n._optimisticResults){const M=this.hasListeners(),U=!M&&Ca(t,n),q=M&&Oa(t,r,n,o);(U||q)&&(f={...f,...Vc(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(f.fetchStatus="idle")}let{error:g,errorUpdatedAt:v,status:m}=f;if(n.select&&f.data!==void 0)if(i&&f.data===(s==null?void 0:s.data)&&n.select===O(this,ni))p=O(this,br);else try{Y(this,ni,n.select),p=n.select(f.data),p=Uo(i==null?void 0:i.data,p,n),Y(this,br,p),Y(this,zt,null)}catch(M){Y(this,zt,M)}else p=f.data;if(n.placeholderData!==void 0&&p===void 0&&m==="pending"){let M;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))M=i.data;else if(M=typeof n.placeholderData=="function"?n.placeholderData((N=O(this,_r))==null?void 0:N.state.data,O(this,_r)):n.placeholderData,n.select&&M!==void 0)try{M=n.select(M),Y(this,zt,null)}catch(U){Y(this,zt,U)}M!==void 0&&(m="success",p=Uo(i==null?void 0:i.data,M,n),h=!0)}O(this,zt)&&(g=O(this,zt),p=O(this,br),v=Date.now(),m="error");const C=f.fetchStatus==="fetching",y=m==="pending",_=m==="error",x=y&&C,b=p!==void 0,R={status:m,fetchStatus:f.fetchStatus,isPending:y,isSuccess:m==="success",isError:_,isInitialLoading:x,isLoading:x,data:p,dataUpdatedAt:f.dataUpdatedAt,error:g,errorUpdatedAt:v,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:f.dataUpdateCount>0||f.errorUpdateCount>0,isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:C,isRefetching:C&&!y,isLoadingError:_&&!b,isPaused:f.fetchStatus==="paused",isPlaceholderData:h,isRefetchError:_&&b,isStale:ws(t,n),refetch:this.refetch,promise:O(this,On)};if(this.options.experimental_prefetchInRender){const M=G=>{R.status==="error"?G.reject(R.error):R.data!==void 0&&G.resolve(R.data)},U=()=>{const G=Y(this,On,R.promise=qo());M(G)},q=O(this,On);switch(q.status){case"pending":t.queryHash===r.queryHash&&M(q);break;case"fulfilled":(R.status==="error"||R.data!==q.value)&&U();break;case"rejected":(R.status!=="error"||R.error!==q.reason)&&U();break}}return R}updateResult(t){const n=O(this,lt),r=this.createResult(O(this,ge),this.options);if(Y(this,zn,O(this,ge).state),Y(this,Ir,this.options),O(this,zn).data!==void 0&&Y(this,_r,O(this,ge)),Ko(r,n))return;Y(this,lt,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!O(this,xr).size)return!0;const c=new Set(a??O(this,xr));return this.options.throwOnError&&c.add("error"),Object.keys(O(this,lt)).some(u=>{const d=u;return O(this,lt)[d]!==n[d]&&c.has(d)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),me(this,Oe,Kc).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&me(this,Oe,Jo).call(this)}},ht=new WeakMap,ge=new WeakMap,ti=new WeakMap,lt=new WeakMap,zn=new WeakMap,Ir=new WeakMap,On=new WeakMap,zt=new WeakMap,ni=new WeakMap,br=new WeakMap,_r=new WeakMap,Gn=new WeakMap,Xn=new WeakMap,En=new WeakMap,xr=new WeakMap,Oe=new WeakSet,Vr=function(t){me(this,Oe,Xo).call(this);let n=O(this,ge).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Rt)),n},Ho=function(){me(this,Oe,zo).call(this);const t=lr(this.options.staleTime,O(this,ge));if(Yn||O(this,lt).isStale||!Lo(t))return;const r=Dc(O(this,lt).dataUpdatedAt,t)+1;Y(this,Gn,setTimeout(()=>{O(this,lt).isStale||this.updateResult()},r))},Bo=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(O(this,ge)):this.options.refetchInterval)??!1},Wo=function(t){me(this,Oe,Go).call(this),Y(this,En,t),!(Yn||Kt(this.options.enabled,O(this,ge))===!1||!Lo(O(this,En))||O(this,En)===0)&&Y(this,Xn,setInterval(()=>{(this.options.refetchIntervalInBackground||vs.isFocused())&&me(this,Oe,Vr).call(this)},O(this,En)))},Jo=function(){me(this,Oe,Ho).call(this),me(this,Oe,Wo).call(this,me(this,Oe,Bo).call(this))},zo=function(){O(this,Gn)&&(clearTimeout(O(this,Gn)),Y(this,Gn,void 0))},Go=function(){O(this,Xn)&&(clearInterval(O(this,Xn)),Y(this,Xn,void 0))},Xo=function(){const t=O(this,ht).getQueryCache().build(O(this,ht),this.options);if(t===O(this,ge))return;const n=O(this,ge);Y(this,ge,t),Y(this,ti,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Kc=function(t){et.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(O(this,lt))}),O(this,ht).getQueryCache().notify({query:O(this,ge),type:"observerResultsUpdated"})})},Pc);function wf(e,t){return Kt(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ca(e,t){return wf(e,t)||e.state.data!==void 0&&Qo(e,t,t.refetchOnMount)}function Qo(e,t,n){if(Kt(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&ws(e,t)}return!1}function Oa(e,t,n,r){return(e!==t||Kt(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&ws(e,n)}function ws(e,t){return Kt(t.enabled,e)!==!1&&e.isStaleByTime(lr(t.staleTime,e))}function If(e,t){return!Ko(e.getCurrentResult(),t)}var $c=$.createContext(void 0),bf=e=>{const t=$.useContext($c);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},_f=({client:e,children:t})=>($.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx($c.Provider,{value:e,children:t})),Uc=$.createContext(!1),xf=()=>$.useContext(Uc);Uc.Provider;function Cf(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Of=$.createContext(Cf()),Ef=()=>$.useContext(Of);function Sf(e,t){return typeof e=="function"?e(...t):!!e}function Ea(){}var Nf=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Tf=e=>{$.useEffect(()=>{e.clearReset()},[e])},Rf=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&Sf(n,[e.error,r]),Af=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},Pf=(e,t)=>e.isLoading&&e.isFetching&&!t,Df=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Sa=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Ff(e,t,n){var f,h,p,g,v;if(process.env.NODE_ENV!=="production"&&(typeof e!="object"||Array.isArray(e)))throw new Error('Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object');const r=bf(),o=xf(),i=Ef(),s=r.defaultQueryOptions(e);(h=(f=r.getDefaultOptions().queries)==null?void 0:f._experimental_beforeQuery)==null||h.call(f,s),s._optimisticResults=o?"isRestoring":"optimistic",Af(s),Nf(s,i),Tf(i);const a=!r.getQueryCache().get(s.queryHash),[c]=$.useState(()=>new t(r,s)),u=c.getOptimisticResult(s),d=!o&&e.subscribed!==!1;if($.useSyncExternalStore($.useCallback(m=>{const C=d?c.subscribe(et.batchCalls(m)):Ea;return c.updateResult(),C},[c,d]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),$.useEffect(()=>{c.setOptions(s,{listeners:!1})},[s,c]),Df(s,u))throw Sa(s,c,i);if(Rf({result:u,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw u.error;if((g=(p=r.getDefaultOptions().queries)==null?void 0:p._experimental_afterQuery)==null||g.call(p,s,u),s.experimental_prefetchInRender&&!Yn&&Pf(u,o)){const m=a?Sa(s,c,i):(v=r.getQueryCache().get(s.queryHash))==null?void 0:v.promise;m==null||m.catch(Ea).finally(()=>{c.updateResult()})}return s.notifyOnChangeProps?u:c.trackResult(u)}function Mf(e,t){return Ff(e,vf)}const qc=w.createContext(null),jf=qc.Provider,tt=()=>{const e=w.useContext(qc);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var we=(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.VALUE_MAPPING="valueMappingError",e))(we||{});const Hc=w.createContext(void 0);function Ht(){const e=w.useContext(Hc);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const kf=(()=>{const e={};return Object.values(we).forEach(t=>{e[t]={}}),e})();function Lf({children:e}){const[t,n]=w.useState(kf),r=w.useCallback((d,f,h=!0)=>{n(p=>{const g={...p};return g[d]=g[d]||{},g[d][f]=h,g})},[n]),o=w.useCallback((d,f)=>{var h;return!!((h=t[d])!=null&&h[f])},[t]),i=w.useCallback((d,f)=>{var h;return(h=t[d])==null?void 0:h[f]},[t]),s=w.useCallback((d,f)=>{n(h=>{var g;const p={...h};return(g=p[d])==null||delete g[f],p})},[n]),a=w.useCallback(d=>{n(f=>{const h={...f};return h[d]={},h})},[n]),c=w.useCallback((d,f)=>{n(h=>{const p={...h};return p[d]=p[d]||{},f.forEach(g=>{p[d][g]=!0}),p})},[n]),u=w.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:o,removeError:s,resetBoundary:a,setErrors:c,getError:i}),[t,n,r,o,s,a,c,i]);return l.jsx(Hc.Provider,{value:u,children:e})}const Vf="https://api.withampersand.com/v1".replace(/\/+$/,"");class Is{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Vf}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||Wc}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 Kf=new Is,Yi=class Yi{constructor(t=Kf){this.configuration=t,this.fetchApi=async(n,r)=>{let o={url:n,init:r};for(const s of this.middleware)s.pre&&(o=await s.pre({fetch:this.fetchApi,...o})||o);let i;try{i=await(this.configuration.fetchApi||fetch)(o.url,o.init)}catch(s){for(const a of this.middleware)a.onError&&(i=await a.onError({fetch:this.fetchApi,url:o.url,init:o.init,error:s,response:i?i.clone():void 0})||i);if(i===void 0)throw s instanceof Error?new qf(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(i=await s.post({fetch:this.fetchApi,url:o.url,init:o.init,response:i.clone()})||i);return i},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?Yi.jsonRegex.test(t):!1}async request(t,n){const{url:r,init:o}=await this.createFetchParams(t,n),i=await this.fetchApi(r,o);if(i&&i.status>=200&&i.status<300)return i;throw new Bc(i,"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 o=Object.assign({},this.configuration.headers,t.headers);Object.keys(o).forEach(u=>o[u]===void 0?delete o[u]:{});const i=typeof n=="function"?n:async()=>n,s={method:t.method,headers:o,body:t.body,credentials:this.configuration.credentials},a={...s,...await i({init:s,context:t})},c={...a,body:Uf(a.body)||a.body instanceof URLSearchParams||$f(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}};Yi.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Gt=Yi;function $f(e){return typeof Blob<"u"&&e instanceof Blob}function Uf(e){return typeof FormData<"u"&&e instanceof FormData}class Bc extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class qf extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class se 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 Wc(e,t=""){return Object.keys(e).map(n=>Jc(n,e[n],t)).filter(n=>n.length>0).join("&")}function Jc(e,t,n=""){const r=n+(n.length?`[${e}]`:e);if(t instanceof Array){const o=t.map(i=>encodeURIComponent(String(i))).join(`&${encodeURIComponent(r)}=`);return`${encodeURIComponent(r)}=${o}`}if(t instanceof Set){const o=Array.from(t);return Jc(e,o,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?Wc(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Zi(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class Ke{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Zn{constructor(t){this.raw=t}async value(){}}class Hf{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function Bf(e){return Wf(e)}function Wf(e,t){return e==null?e:{fieldUsed:P(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:P(e,"keyFormat")?e.keyFormat:void 0}}function Jf(e){return zf(e)}function zf(e,t){return e==null?e:{name:e.name,valuePrefix:P(e,"valuePrefix")?e.valuePrefix:void 0}}function Gf(e){return Xf(e)}function Xf(e,t){return e==null?e:{name:e.name}}function Qf(e){return Yf(e)}function Yf(e,t){return e==null?e:{attachmentType:e.attachmentType,query:P(e,"query")?Gf(e.query):void 0,header:P(e,"header")?Jf(e.header):void 0,docsURL:P(e,"docsURL")?e.docsURL:void 0}}function Zf(e){return ep(e)}function ep(e,t){return e}function tp(e){return np(e)}function np(e,t){return e==null?e:{days:P(e,"days")?e.days:void 0,fullHistory:P(e,"fullHistory")?e.fullHistory:void 0}}function rp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function zc(e){return ip(e)}function ip(e,t){return e==null?e:{defaultPeriod:tp(e.defaultPeriod)}}function op(e){if(e!==void 0)return e===null?null:{defaultPeriod:rp(e.defaultPeriod)}}function sp(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function ap(e){if(e!==void 0)return e===null?null:{defaultPeriod:sp(e.defaultPeriod)}}function cp(e){return lp(e)}function lp(e,t){return e==null?e:{enabled:P(e,"enabled")?e.enabled:void 0}}function Gc(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function up(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:ap(e.backfill)}}function dp(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Zi(e.objects,up)}}function fp(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,selectedValueDefaults:e.selectedValueDefaults}}function pp(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Zi(e.objects,fp)}}function hp(e){return mp(e)}function mp(e,t){return e==null?e:{apiKeyAsBasic:P(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:P(e,"apiKeyAsBasicOpts")?Bf(e.apiKeyAsBasicOpts):void 0,docsURL:P(e,"docsURL")?e.docsURL:void 0}}function gp(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function bi(e){return yp(e)}function yp(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 vp(e){return wp(e)}function wp(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Ip(e){return bp(e)}function bp(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")?cp(e.proxy):void 0}}function _p(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:Gc(e.proxy)}}function xp(e){return Cp(e)}function Cp(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Ip(e.content)}}function Op(e){return Ep(e)}function Ep(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 Xc(e){return Sp(e)}function Sp(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 Np(e){return Tp(e)}function Tp(e,t){return e==null?e:{token:e.token}}function Rp(e){return Ap(e)}function Ap(e,t){return e==null?e:{token:e.token}}function Pp(e){return Dp(e)}function Dp(e,t){return e==null?e:{accessToken:P(e,"accessToken")?Np(e.accessToken):void 0,refreshToken:P(e,"refreshToken")?Rp(e.refreshToken):void 0,scopes:P(e,"scopes")?e.scopes:void 0}}function Ri(e){return Fp(e)}function Fp(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 Ai(e){return Mp(e)}function Mp(e,t){return e==null?e:{id:e.id,projectId:e.projectId,provider:e.provider,providerApp:P(e,"providerApp")?Ri(e.providerApp):void 0,group:Xc(e.group),consumer:Op(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")?Pp(e.oauth2AuthorizationCode):void 0}}function jp(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:_p(e.content)}}function kp(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:jp(e.config)}}function Lp(e){return Vp(e)}function Vp(e,t){return e==null?e:{enabled:P(e,"enabled")?e.enabled:void 0}}function Kp(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function $p(e){return Up(e)}function Up(e,t){return e==null?e:{mode:P(e,"mode")?e.mode:void 0,pageSize:P(e,"pageSize")?e.pageSize:void 0}}function qp(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function Hp(e){let t=!0;return t=t&&"fieldName"in e,t}function Bp(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 Wp(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName}}function Jp(e){let t=!0;return t=t&&"mapToName"in e,t}function Qc(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 zp(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Na(e){return Gp(e)}function Gp(e,t){return e==null?e:{...Bp(e),...Qc(e)}}function Ta(e){if(e!==void 0)return e===null?null:Hp(e)?Wp(e):Jp(e)?zp(e):{}}function Yc(e){return Xp(e)}function Xp(e,t){return e}function Qp(e){return Yp(e)}function Yp(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(Na):void 0,optionalFields:P(e,"optionalFields")?e.optionalFields.map(Na):void 0,optionalFieldsAuto:P(e,"optionalFieldsAuto")?Yc(e.optionalFieldsAuto):void 0,backfill:P(e,"backfill")?zc(e.backfill):void 0,delivery:P(e,"delivery")?$p(e.delivery):void 0}}function Zp(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(Ta),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(Ta),optionalFieldsAuto:e.optionalFieldsAuto,backfill:op(e.backfill),delivery:qp(e.delivery)}}function eh(e){return th(e)}function th(e,t){return e==null?e:{objects:P(e,"objects")?e.objects.map(Qp):void 0}}function nh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Zp)}}function Zc(e){return rh(e)}function rh(e,t){return e==null?e:{allowAnyFields:P(e,"allowAnyFields")?e.allowAnyFields:void 0}}function ih(e){if(e!==void 0)return e===null?null:{allowAnyFields:e.allowAnyFields}}function oh(e){return sh(e)}function sh(e,t){return e==null?e:{objectName:e.objectName,inheritMapping:P(e,"inheritMapping")?e.inheritMapping:void 0,valueDefaults:P(e,"valueDefaults")?Zc(e.valueDefaults):void 0}}function ah(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMapping:e.inheritMapping,valueDefaults:ih(e.valueDefaults)}}function ch(e){return lh(e)}function lh(e,t){return e==null?e:{objects:P(e,"objects")?e.objects.map(oh):void 0}}function uh(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(ah)}}function dh(e){return fh(e)}function fh(e,t){return e==null?e:{name:e.name,displayName:P(e,"displayName")?e.displayName:void 0,provider:e.provider,read:P(e,"read")?eh(e.read):void 0,write:P(e,"write")?ch(e.write):void 0,proxy:P(e,"proxy")?Lp(e.proxy):void 0}}function ph(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:nh(e.read),write:uh(e.write),proxy:Kp(e.proxy)}}function hh(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:ph(e.content)}}function mh(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:hh(e.latestRevision)}}function gh(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function yh(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 vh(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function wh(e){return Ih(e)}function Ih(e,t){return e==null?e:{value:e.value,displayValue:e.displayValue}}function bh(e){return _h(e)}function _h(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(wh):void 0}}function xh(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Ch(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Oh(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 Eh(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 Sh(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 Nh(e){if(e!==void 0)return e===null?null:{accessToken:Eh(e.accessToken),refreshToken:Sh(e.refreshToken),scopes:e.scopes}}function Th(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:xh(e.basicAuth),oauth2ClientCredentials:Ch(e.oauth2ClientCredentials),oauth2Password:Oh(e.oauth2Password),oauth2AuthorizationCode:Nh(e.oauth2AuthorizationCode)}}function Rh(e){return Ah(e)}function Ah(e,t){return e==null?e:{enabled:P(e,"enabled")?e.enabled:void 0}}function Ph(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 bo(e){return Dh(e)}function Dh(e,t){return e==null?e:{...Ph(e),...Qc(e)}}function Fh(e){return Mh(e)}function Mh(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(bo):void 0,optionalFields:P(e,"optionalFields")?e.optionalFields.map(bo):void 0,optionalFieldsAuto:P(e,"optionalFieldsAuto")?Yc(e.optionalFieldsAuto):void 0,allFields:P(e,"allFields")?e.allFields.map(bo):void 0,allFieldsMetadata:P(e,"allFieldsMetadata")?Zi(e.allFieldsMetadata,bh):void 0,backfill:P(e,"backfill")?zc(e.backfill):void 0}}function jh(e){return kh(e)}function kh(e,t){return e==null?e:{objects:P(e,"objects")?e.objects.map(Fh):void 0}}function Lh(e){return Vh(e)}function Vh(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,valueDefaults:P(e,"valueDefaults")?Zc(e.valueDefaults):void 0}}function Kh(e){return $h(e)}function $h(e,t){return e==null?e:{objects:P(e,"objects")?e.objects.map(Lh):void 0}}function Uh(e){return qh(e)}function qh(e,t){return e==null?e:{name:e.name,displayName:P(e,"displayName")?e.displayName:void 0,provider:e.provider,read:P(e,"read")?jh(e.read):void 0,write:P(e,"write")?Kh(e.write):void 0,proxy:P(e,"proxy")?Rh(e.proxy):void 0}}function Hh(e){return Bh(e)}function Bh(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Uh(e.content)}}function _i(e){return Wh(e)}function Wh(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:P(e,"group")?Xc(e.group):void 0,healthStatus:e.healthStatus,connection:Ai(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:P(e,"updateTime")?new Date(e.updateTime):void 0,config:xp(e.config)}}function Jh(e){return zh(e)}function zh(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:dh(e.content)}}function Ra(e){return Gh(e)}function Gh(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:Jh(e.latestRevision)}}function Xh(e){return Qh(e)}function Qh(e,t){return e==null?e:{iconURL:P(e,"iconURL")?e.iconURL:void 0,logoURL:P(e,"logoURL")?e.logoURL:void 0}}function Yh(e){return Zh(e)}function Zh(e,t){return e==null?e:{iconURL:P(e,"iconURL")?e.iconURL:void 0,logoURL:P(e,"logoURL")?e.logoURL:void 0}}function em(e){return tm(e)}function tm(e,t){return e==null?e:{regular:P(e,"regular")?Yh(e.regular):void 0,darkMode:P(e,"darkMode")?Xh(e.darkMode):void 0}}function nm(e){return rm(e)}function rm(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 im(e){return om(e)}function om(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:nm(e.tokenMetadataFields),docsURL:P(e,"docsURL")?e.docsURL:void 0,authURLParams:P(e,"authURLParams")?e.authURLParams:void 0}}function sm(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 am(e){return cm(e)}function cm(e,t){return e==null?e:{bulkWrite:vp(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function Aa(e){return lm(e)}function lm(e,t){return e==null?e:{name:e.name,authType:Zf(e.authType),baseURL:e.baseURL,oauth2Opts:P(e,"oauth2Opts")?im(e.oauth2Opts):void 0,apiKeyOpts:P(e,"apiKeyOpts")?Qf(e.apiKeyOpts):void 0,basicOpts:P(e,"basicOpts")?hp(e.basicOpts):void 0,support:am(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")?em(e.media):void 0,labels:P(e,"labels")?e.labels:void 0}}function um(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:dp(e.read),write:pp(e.write),proxy:Gc(e.proxy)}}function dm(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:um(e.content)}}function fm(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:dm(e.config)}}function pm(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:fm(e.installation)}}function hm(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function mm(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:hm(e.project)}}function gm(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 ym(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:gm(e.providerApp)}}class vm extends Gt{async deleteConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new se("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling deleteConnection.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"DELETE",headers:o,query:r},n);return new Zn(i)}async deleteConnection(t,n){await this.deleteConnectionRaw(t,n)}async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:Th(t.generateConnectionParams)},n);return new Ke(i,s=>Ai(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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new se("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 o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:o,query:r},n);return new Ke(i,s=>Ai(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 se("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 o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Ke(i,s=>s.map(Ai))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class wm extends Gt{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new se("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:kp(t.installation)},n);return new Ke(i,s=>_i(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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new se("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:o,query:r},n);return new Zn(i)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new se("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:o,query:r},n);return new Ke(i,s=>_i(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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:o,query:r},n);return new Ke(i,s=>s.map(_i))}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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new se("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new se("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:o,query:r,body:pm(t.installationUpdate)},n);return new Ke(i,s=>_i(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Im extends Gt{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:o,query:r,body:gp(t.batchUpsertIntegrationsRequest)},n);return new Ke(i,s=>s.map(Ra))}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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new se("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:mh(t.integration)},n);return new Zn(i)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:o,query:r},n);return new Zn(i)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Ke(i,s=>s.map(Ra))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class bm extends Gt{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new se("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},o={};o["Content-Type"]="application/json";const i=await this.request({path:"/oauth-connect",method:"POST",headers:o,query:r,body:sm(t.connectOAuthParams)},n);return this.isJsonMime(i.headers.get("content-type"))?new Ke(i):new Hf(i)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class _m extends Gt{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new se("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"POST",headers:o,query:r,body:gh(t.project)},n);return new Ke(i,s=>bi(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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:o,query:r},n);return new Zn(i)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Ke(i,s=>bi(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 o=await this.request({path:"/projects",method:"GET",headers:r,query:n},t);return new Ke(o,i=>i.map(bi))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new se("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:o,query:r,body:mm(t.projectUpdate)},n);return new Ke(i,s=>bi(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class xm extends Gt{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new se("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:o,query:r},n);return new Ke(i,s=>Aa(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 o=await this.request({path:"/providers",method:"GET",headers:r,query:n},t);return new Ke(o,i=>Zi(i,Aa))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Cm extends Gt{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new se("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:o,query:r,body:yh(t.providerApp)},n);return new Ke(i,s=>Ri(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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new se("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:o,query:r},n);return new Zn(i)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:o,query:r},n);return new Ke(i,s=>s.map(Ri))}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 se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new se("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new se("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:o,query:r,body:ym(t.providerAppUpdate)},n);return new Ke(i,s=>Ri(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Om extends Gt{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const r={},o={};o["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:o,query:r,body:vh(t.revision)},n);return new Zn(i)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new se("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new se("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new se("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new se("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:o,query:r},n);return new Ke(i,s=>Hh(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class el{constructor(t){this.connectionApi=new vm(t),this.installationApi=new wm(t),this.integrationApi=new Im(t),this.oAuthApi=new bm(t),this.projectApi=new _m(t),this.providerApi=new xm(t),this.providerAppApi=new Cm(t),this.revisionApi=new Om(t)}}const tl="2.4.0",Em="v1",xi="https://api.withampersand.com";function nl(){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 xi;case"mock":return"http://127.0.0.1:4010";case"":return xi;default:return e??xi}}catch{return xi}}const Sm=(e,t)=>`${e}/${t}`;function Nm(){return Sm(nl(),Em)}const Tm=nl(),rl=Nm(),Rm=new Is({basePath:rl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":tl}});let Am=new el(Rm);const je=()=>Am;function il(){const e=tt();return w.useCallback(async()=>{e||console.error("Unable to create API service without API key.");const n=new Is({basePath:rl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":tl,"X-Api-Key":e}});return new el(n)},[e])}const st=async(e,t)=>{var n;if(e instanceof Bc){const{status:r,statusText:o}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,o);const i=await e.response.json(),s=((n=i==null?void 0:i.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)},ol=w.createContext({integrations:null,isLoading:!0}),bs=()=>{const e=w.useContext(ol);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function Pm({projectIdOrName:e,children:t}){const n=tt(),{setError:r}=Ht(),[o,i]=w.useState(null),[s,a]=w.useState(!0);w.useEffect(()=>{je().integrationApi.listIntegrations({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(u=>{a(!1),i(u||[])}).catch(u=>{console.error("Error retrieving integration information."),st(u),a(!1),r(we.INTEGRATION_LIST,e)})},[e,n,r]);const c=w.useMemo(()=>({integrations:o,isLoading:s}),[o,s]);return l.jsx(ol.Provider,{value:c,children:t})}const Dm=e=>{const t=il();return Mf({queryKey:["project",e],queryFn:async()=>(await t()).projectApi.getProject({projectIdOrName:e})})},sl=w.createContext({project:null,appName:"",projectId:"",projectIdOrName:"",isLoading:!0}),Le=()=>{const e=w.useContext(sl);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Fm({projectIdOrName:e,children:t}){const{setError:n}=Ht(),{data:r,isLoading:o,isError:i}=Dm(e);w.useEffect(()=>{i&&n(we.PROJECT,e)},[i,e,n]);const s=w.useMemo(()=>({projectId:(r==null?void 0:r.id)||"",projectIdOrName:e,project:r||null,appName:(r==null?void 0:r.appName)||"",isLoading:o}),[e,r,o]);return l.jsx(sl.Provider,{value:s,children:t})}const Mm=new yf;function jm(e){const{options:{apiKey:t,projectId:n,project:r},children:o}=e,i=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!i)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(_f,{client:Mm,children:l.jsx(Lf,{children:l.jsx(jf,{value:t,children:l.jsx(Fm,{projectIdOrName:i,children:l.jsx(Pm,{projectIdOrName:i,children:o})})})})})}const al=w.createContext(null);function km(){const e=w.useContext(al);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
3
+ component is wrapped with AmpersandProvider`);return e}function Lm(){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 Vm="_box_1p7c5_1",Pa={box:Vm};function Pn({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${Pa.box} ${t}`:Pa.box,style:n,children:e})}const Km="_container_1wvzr_1",Da={container:Km};function Pr({children:e,className:t,style:n}){return l.jsx("div",{className:t?`${Da.container} ${t}`:Da.container,style:n,children:e})}const $m="_errorBoxContainer_4sdb2_1",Um="_errorBox_4sdb2_1",qm="_errorText_4sdb2_20",_o={errorBoxContainer:$m,errorBox:Um,errorText:qm};function cl({message:e}){return l.jsxs(Pr,{className:_o.errorBoxContainer,children:[l.jsx(Lm,{}),l.jsx(Pn,{className:_o.errorBox,children:l.jsx("p",{className:_o.errorText,children:e})})]})}const Hm="_loader_6ubm6_1",Bm="_rotate_6ubm6_1",Wm="_ball1_6ubm6_1",Jm="_ball2_6ubm6_1",zm={loader:Hm,rotate:Bm,ball1:Wm,ball2:Jm};function Gm(){return l.jsx("span",{className:zm.loader})}function Br(){return l.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:l.jsx(Gm,{})})}function ll({children:e}){return l.jsx(Pr,{style:{maxWidth:"55rem"},children:l.jsx(Pn,{children:e})})}function eo(){return l.jsx(ll,{children:l.jsx(Br,{})})}function un({message:e}){return l.jsx(ll,{children:l.jsx(cl,{message:e})})}const ul=()=>{const[e,t]=w.useState(!1),n=w.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}};function _s(e,t){try{return process.env[e]}catch{return t}}function Wr(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Dn(e,t){return(t==null?void 0:t.displayName)??Wr(e)}const Xm=e=>e.split(`
4
+ `).filter(n=>n.trim()!==""),Qm=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,dl=w.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 ut(){const e=w.useContext(dl);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Ym({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,fieldMapping:u}){const d=tt(),{projectId:f}=Le(),{integrations:h}=bs(),{setError:p,isError:g}=Ht(),{isIntegrationDeleted:v,setIntegrationDeleted:m}=ul(),[C,y]=w.useState([]),[_,x]=w.useState(!0),b=(C==null?void 0:C[0])||null,S=w.useMemo(()=>Qm(t,h||[]),[t,h]);w.useEffect(()=>{S===null&&(h!=null&&h.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,S,h]);const R=w.useCallback(q=>{y([q])},[y]),N=w.useCallback(()=>{S!=null&&S.id&&je().installationApi.listInstallations({projectIdOrName:f,integrationId:S.id,groupRef:o},{headers:{"X-Api-Key":d??""}}).then(q=>{x(!1),y(q||[])}).catch(q=>{p(we.INSTALLATION_LIST,S.id),x(!1),console.error("Error retrieving installation information: ",q)})},[S,f,d,p,o]),M=(S==null?void 0:S.id)||"";w.useEffect(()=>{N()},[N]);const U=w.useMemo(()=>({integrationId:(S==null?void 0:S.id)||"",provider:(S==null?void 0:S.provider)||"",integrationObj:S,consumerRef:n,consumerName:r,groupRef:o,groupName:i,installation:b,setInstallation:R,resetInstallations:N,onInstallSuccess:s,onUpdateSuccess:a,onUninstallSuccess:c,isIntegrationDeleted:v,setIntegrationDeleted:m,fieldMapping:u}),[S,n,r,o,i,b,R,N,s,a,c,v,m,u]);if(_)return l.jsx(eo,{});if(S===null)return l.jsx(un,{message:`Integration "${t}" not found`});if(g(we.INSTALLATION_LIST,M)){const q=`Error retrieving installation information for integration "${(S==null?void 0:S.name)||"unknown"}"`;return l.jsx(un,{message:q})}return l.jsx(dl.Provider,{value:U,children:e})}const fl=w.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{},isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}}),or=()=>{const e=w.useContext(fl);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function pl({provider:e,groupRef:t,children:n}){const r=il(),{projectId:o,isLoading:i}=Le(),[s,a]=w.useState(null),[c,u]=w.useState(null),[d,f]=w.useState(!0),{setError:h,isError:p}=Ht(),{provider:g}=ut(),{isIntegrationDeleted:v,setIntegrationDeleted:m}=ul(),C=e||g;if(!C)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");w.useEffect(()=>{async function _(){const x=await r();if(!o)throw new Error("Project ID not found. Component must be used within AmpersandProvider");x.connectionApi.listConnections({projectIdOrName:o,groupRef:t,provider:C}).then(b=>{f(!1),a(b)}).catch(b=>{console.error(`Error retrieving existing connections for group ID ${t}.`),st(b),f(!1),h(we.CONNECTION_LIST,o)})}o&&_()},[o,t,C,h,r,v]),w.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]),w.useEffect(()=>{if(!c&&s&&s.length>0){const[_]=s;u(_)}},[s,c]);const y=w.useMemo(()=>({connections:s,selectedConnection:c,setConnections:a,setSelectedConnection:u,isIntegrationDeleted:v,setIntegrationDeleted:m}),[s,c,a,u,v,m]);if(d||i)return l.jsx(eo,{});if(p(we.PROJECT,o))return l.jsx(un,{message:`Error loading project ${o}`});if(p(we.CONNECTION_LIST,o))return l.jsx(un,{message:"Error retrieving existing connections"});if(!o)throw new Error("Project ID not found. ConnectionsProvider must be used within AmpersandProvider");return l.jsx(fl.Provider,{value:y,children:n})}function hl(){const[e,t]=w.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}const Zm="_resetContainer_lkwv9_4",ml={resetContainer:Zm};var Ci=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ki={exports:{}};ki.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",o=1,i=2,s=9007199254740991,a="[object Arguments]",c="[object Array]",u="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",h="[object Error]",p="[object Function]",g="[object GeneratorFunction]",v="[object Map]",m="[object Number]",C="[object Null]",y="[object Object]",_="[object Promise]",x="[object Proxy]",b="[object RegExp]",S="[object Set]",R="[object String]",N="[object Symbol]",M="[object Undefined]",U="[object WeakMap]",q="[object ArrayBuffer]",G="[object DataView]",ne="[object Float32Array]",W="[object Float64Array]",ce="[object Int8Array]",re="[object Int16Array]",Q="[object Int32Array]",fe="[object Uint8Array]",ye="[object Uint8ClampedArray]",T="[object Uint16Array]",j="[object Uint32Array]",K=/[\\^$.*+?()[\]{}|]/g,L=/^\[object .+?Constructor\]$/,k=/^(?:0|[1-9]\d*)$/,D={};D[ne]=D[W]=D[ce]=D[re]=D[Q]=D[fe]=D[ye]=D[T]=D[j]=!0,D[a]=D[c]=D[q]=D[d]=D[G]=D[f]=D[h]=D[p]=D[v]=D[m]=D[y]=D[b]=D[S]=D[R]=D[U]=!1;var Z=typeof Ci=="object"&&Ci&&Ci.Object===Object&&Ci,ee=typeof self=="object"&&self&&self.Object===Object&&self,H=Z||ee||Function("return this")(),te=t&&!t.nodeType&&t,z=te&&!0&&e&&!e.nodeType&&e,ue=z&&z.exports===te,F=ue&&Z.process,ve=function(){try{return F&&F.binding&&F.binding("util")}catch{}}(),B=ve&&ve.isTypedArray;function Ee(I,E){for(var A=-1,X=I==null?0:I.length,Te=0,de=[];++A<X;){var Fe=I[A];E(Fe,A,I)&&(de[Te++]=Fe)}return de}function Ve(I,E){for(var A=-1,X=E.length,Te=I.length;++A<X;)I[Te+A]=E[A];return I}function Ge(I,E){for(var A=-1,X=I==null?0:I.length;++A<X;)if(E(I[A],A,I))return!0;return!1}function $e(I,E){for(var A=-1,X=Array(I);++A<I;)X[A]=E(A);return X}function Ie(I){return function(E){return I(E)}}function At(I,E){return I.has(E)}function Xe(I,E){return I==null?void 0:I[E]}function gt(I){var E=-1,A=Array(I.size);return I.forEach(function(X,Te){A[++E]=[Te,X]}),A}function Pt(I,E){return function(A){return I(E(A))}}function Dt(I){var E=-1,A=Array(I.size);return I.forEach(function(X){A[++E]=X}),A}var Qe=Array.prototype,We=Function.prototype,Ue=Object.prototype,Ae=H["__core-js_shared__"],Ft=We.toString,nt=Ue.hasOwnProperty,Yt=function(){var I=/[^.]+$/.exec(Ae&&Ae.keys&&Ae.keys.IE_PROTO||"");return I?"Symbol(src)_1."+I:""}(),fn=Ue.toString,yt=RegExp("^"+Ft.call(nt).replace(K,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Pe=ue?H.Buffer:void 0,Zt=H.Symbol,pn=H.Uint8Array,en=Ue.propertyIsEnumerable,Mn=Qe.splice,dt=Zt?Zt.toStringTag:void 0,tn=Object.getOwnPropertySymbols,hn=Pe?Pe.isBuffer:void 0,jn=Pt(Object.keys,Object),mn=sr(H,"DataView"),Re=sr(H,"Map"),rt=sr(H,"Promise"),ie=sr(H,"Set"),he=sr(H,"WeakMap"),qe=sr(Object,"create"),nn=Vn(mn),J=Vn(Re),oe=Vn(rt),le=Vn(ie),ke=Vn(he),He=Zt?Zt.prototype:void 0,ft=He?He.valueOf:void 0;function Je(I){var E=-1,A=I==null?0:I.length;for(this.clear();++E<A;){var X=I[E];this.set(X[0],X[1])}}function Ye(){this.__data__=qe?qe(null):{},this.size=0}function pt(I){var E=this.has(I)&&delete this.__data__[I];return this.size-=E?1:0,E}function Ne(I){var E=this.__data__;if(qe){var A=E[I];return A===r?void 0:A}return nt.call(E,I)?E[I]:void 0}function kn(I){var E=this.__data__;return qe?E[I]!==void 0:nt.call(E,I)}function go(I,E){var A=this.__data__;return this.size+=this.has(I)?0:1,A[I]=qe&&E===void 0?r:E,this}Je.prototype.clear=Ye,Je.prototype.delete=pt,Je.prototype.get=Ne,Je.prototype.has=kn,Je.prototype.set=go;function Ot(I){var E=-1,A=I==null?0:I.length;for(this.clear();++E<A;){var X=I[E];this.set(X[0],X[1])}}function ui(){this.__data__=[],this.size=0}function di(I){var E=this.__data__,A=hi(E,I);if(A<0)return!1;var X=E.length-1;return A==X?E.pop():Mn.call(E,A,1),--this.size,!0}function fi(I){var E=this.__data__,A=hi(E,I);return A<0?void 0:E[A][1]}function Se(I){return hi(this.__data__,I)>-1}function Mt(I,E){var A=this.__data__,X=hi(A,I);return X<0?(++this.size,A.push([I,E])):A[X][1]=E,this}Ot.prototype.clear=ui,Ot.prototype.delete=di,Ot.prototype.get=fi,Ot.prototype.has=Se,Ot.prototype.set=Mt;function jt(I){var E=-1,A=I==null?0:I.length;for(this.clear();++E<A;){var X=I[E];this.set(X[0],X[1])}}function Ln(){this.size=0,this.__data__={hash:new Je,map:new(Re||Ot),string:new Je}}function yo(I){var E=mi(this,I).delete(I);return this.size-=E?1:0,E}function Mr(I){return mi(this,I).get(I)}function Cd(I){return mi(this,I).has(I)}function Od(I,E){var A=mi(this,I),X=A.size;return A.set(I,E),this.size+=A.size==X?0:1,this}jt.prototype.clear=Ln,jt.prototype.delete=yo,jt.prototype.get=Mr,jt.prototype.has=Cd,jt.prototype.set=Od;function pi(I){var E=-1,A=I==null?0:I.length;for(this.__data__=new jt;++E<A;)this.add(I[E])}function Ed(I){return this.__data__.set(I,r),this}function Sd(I){return this.__data__.has(I)}pi.prototype.add=pi.prototype.push=Ed,pi.prototype.has=Sd;function gn(I){var E=this.__data__=new Ot(I);this.size=E.size}function Nd(){this.__data__=new Ot,this.size=0}function Td(I){var E=this.__data__,A=E.delete(I);return this.size=E.size,A}function Rd(I){return this.__data__.get(I)}function Ad(I){return this.__data__.has(I)}function Pd(I,E){var A=this.__data__;if(A instanceof Ot){var X=A.__data__;if(!Re||X.length<n-1)return X.push([I,E]),this.size=++A.size,this;A=this.__data__=new jt(X)}return A.set(I,E),this.size=A.size,this}gn.prototype.clear=Nd,gn.prototype.delete=Td,gn.prototype.get=Rd,gn.prototype.has=Ad,gn.prototype.set=Pd;function Dd(I,E){var A=gi(I),X=!A&&zd(I),Te=!A&&!X&&vo(I),de=!A&&!X&&!Te&&ma(I),Fe=A||X||Te||de,ze=Fe?$e(I.length,String):[],Ze=ze.length;for(var De in I)nt.call(I,De)&&!(Fe&&(De=="length"||Te&&(De=="offset"||De=="parent")||de&&(De=="buffer"||De=="byteLength"||De=="byteOffset")||qd(De,Ze)))&&ze.push(De);return ze}function hi(I,E){for(var A=I.length;A--;)if(da(I[A][0],E))return A;return-1}function Fd(I,E,A){var X=E(I);return gi(I)?X:Ve(X,A(I))}function jr(I){return I==null?I===void 0?M:C:dt&&dt in Object(I)?$d(I):Jd(I)}function aa(I){return kr(I)&&jr(I)==a}function ca(I,E,A,X,Te){return I===E?!0:I==null||E==null||!kr(I)&&!kr(E)?I!==I&&E!==E:Md(I,E,A,X,ca,Te)}function Md(I,E,A,X,Te,de){var Fe=gi(I),ze=gi(E),Ze=Fe?c:yn(I),De=ze?c:yn(E);Ze=Ze==a?y:Ze,De=De==a?y:De;var vt=Ze==y,kt=De==y,it=Ze==De;if(it&&vo(I)){if(!vo(E))return!1;Fe=!0,vt=!1}if(it&&!vt)return de||(de=new gn),Fe||ma(I)?la(I,E,A,X,Te,de):Vd(I,E,Ze,A,X,Te,de);if(!(A&o)){var Et=vt&&nt.call(I,"__wrapped__"),St=kt&&nt.call(E,"__wrapped__");if(Et||St){var vn=Et?I.value():I,rn=St?E.value():E;return de||(de=new gn),Te(vn,rn,A,X,de)}}return it?(de||(de=new gn),Kd(I,E,A,X,Te,de)):!1}function jd(I){if(!ha(I)||Bd(I))return!1;var E=fa(I)?yt:L;return E.test(Vn(I))}function kd(I){return kr(I)&&pa(I.length)&&!!D[jr(I)]}function Ld(I){if(!Wd(I))return jn(I);var E=[];for(var A in Object(I))nt.call(I,A)&&A!="constructor"&&E.push(A);return E}function la(I,E,A,X,Te,de){var Fe=A&o,ze=I.length,Ze=E.length;if(ze!=Ze&&!(Fe&&Ze>ze))return!1;var De=de.get(I);if(De&&de.get(E))return De==E;var vt=-1,kt=!0,it=A&i?new pi:void 0;for(de.set(I,E),de.set(E,I);++vt<ze;){var Et=I[vt],St=E[vt];if(X)var vn=Fe?X(St,Et,vt,E,I,de):X(Et,St,vt,I,E,de);if(vn!==void 0){if(vn)continue;kt=!1;break}if(it){if(!Ge(E,function(rn,Kn){if(!At(it,Kn)&&(Et===rn||Te(Et,rn,A,X,de)))return it.push(Kn)})){kt=!1;break}}else if(!(Et===St||Te(Et,St,A,X,de))){kt=!1;break}}return de.delete(I),de.delete(E),kt}function Vd(I,E,A,X,Te,de,Fe){switch(A){case G:if(I.byteLength!=E.byteLength||I.byteOffset!=E.byteOffset)return!1;I=I.buffer,E=E.buffer;case q:return!(I.byteLength!=E.byteLength||!de(new pn(I),new pn(E)));case d:case f:case m:return da(+I,+E);case h:return I.name==E.name&&I.message==E.message;case b:case R:return I==E+"";case v:var ze=gt;case S:var Ze=X&o;if(ze||(ze=Dt),I.size!=E.size&&!Ze)return!1;var De=Fe.get(I);if(De)return De==E;X|=i,Fe.set(I,E);var vt=la(ze(I),ze(E),X,Te,de,Fe);return Fe.delete(I),vt;case N:if(ft)return ft.call(I)==ft.call(E)}return!1}function Kd(I,E,A,X,Te,de){var Fe=A&o,ze=ua(I),Ze=ze.length,De=ua(E),vt=De.length;if(Ze!=vt&&!Fe)return!1;for(var kt=Ze;kt--;){var it=ze[kt];if(!(Fe?it in E:nt.call(E,it)))return!1}var Et=de.get(I);if(Et&&de.get(E))return Et==E;var St=!0;de.set(I,E),de.set(E,I);for(var vn=Fe;++kt<Ze;){it=ze[kt];var rn=I[it],Kn=E[it];if(X)var ga=Fe?X(Kn,rn,it,E,I,de):X(rn,Kn,it,I,E,de);if(!(ga===void 0?rn===Kn||Te(rn,Kn,A,X,de):ga)){St=!1;break}vn||(vn=it=="constructor")}if(St&&!vn){var yi=I.constructor,vi=E.constructor;yi!=vi&&"constructor"in I&&"constructor"in E&&!(typeof yi=="function"&&yi instanceof yi&&typeof vi=="function"&&vi instanceof vi)&&(St=!1)}return de.delete(I),de.delete(E),St}function ua(I){return Fd(I,Qd,Ud)}function mi(I,E){var A=I.__data__;return Hd(E)?A[typeof E=="string"?"string":"hash"]:A.map}function sr(I,E){var A=Xe(I,E);return jd(A)?A:void 0}function $d(I){var E=nt.call(I,dt),A=I[dt];try{I[dt]=void 0;var X=!0}catch{}var Te=fn.call(I);return X&&(E?I[dt]=A:delete I[dt]),Te}var Ud=tn?function(I){return I==null?[]:(I=Object(I),Ee(tn(I),function(E){return en.call(I,E)}))}:Yd,yn=jr;(mn&&yn(new mn(new ArrayBuffer(1)))!=G||Re&&yn(new Re)!=v||rt&&yn(rt.resolve())!=_||ie&&yn(new ie)!=S||he&&yn(new he)!=U)&&(yn=function(I){var E=jr(I),A=E==y?I.constructor:void 0,X=A?Vn(A):"";if(X)switch(X){case nn:return G;case J:return v;case oe:return _;case le:return S;case ke:return U}return E});function qd(I,E){return E=E??s,!!E&&(typeof I=="number"||k.test(I))&&I>-1&&I%1==0&&I<E}function Hd(I){var E=typeof I;return E=="string"||E=="number"||E=="symbol"||E=="boolean"?I!=="__proto__":I===null}function Bd(I){return!!Yt&&Yt in I}function Wd(I){var E=I&&I.constructor,A=typeof E=="function"&&E.prototype||Ue;return I===A}function Jd(I){return fn.call(I)}function Vn(I){if(I!=null){try{return Ft.call(I)}catch{}try{return I+""}catch{}}return""}function da(I,E){return I===E||I!==I&&E!==E}var zd=aa(function(){return arguments}())?aa:function(I){return kr(I)&&nt.call(I,"callee")&&!en.call(I,"callee")},gi=Array.isArray;function Gd(I){return I!=null&&pa(I.length)&&!fa(I)}var vo=hn||Zd;function Xd(I,E){return ca(I,E)}function fa(I){if(!ha(I))return!1;var E=jr(I);return E==p||E==g||E==u||E==x}function pa(I){return typeof I=="number"&&I>-1&&I%1==0&&I<=s}function ha(I){var E=typeof I;return I!=null&&(E=="object"||E=="function")}function kr(I){return I!=null&&typeof I=="object"}var ma=B?Ie(B):kd;function Qd(I){return Gd(I)?Dd(I):Ld(I)}function Yd(){return[]}function Zd(){return!1}e.exports=Xd})(ki,ki.exports);var eg=ki.exports;const gl=xs(eg),er="other",Li="uninstall-installation";function Tn(e){return!e.fieldName}function Cs(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function tg(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Tn(n)&&!!n.fieldName))||null}function ng(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>Tn(r)&&!!r.mapToName))||[]}function rg(e){var n;return((n=e==null?void 0:e.optionalFields)==null?void 0:n.filter(r=>Tn(r)&&!!r.mapToName))||[]}function ig(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Tn(n)&&!!n.fieldName))||null}const yl=(e,t)=>{var n,r,o;return(o=(r=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:r.objects)==null?void 0:o[t]};function og(e){return Tn(e)?e.mapToName:e.fieldName}const vl=(e,t)=>{var r,o,i;const n=[];return(i=(o=(r=t.content)==null?void 0:r.read)==null?void 0:o.objects)==null||i.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)&&Wr(s==null?void 0:s.objectName),completed:e?!!yl(e,s.objectName):!1})}),n},wl=e=>{var n;return{name:er,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function sg(e,t){var i;const n=vl(e,t),o=!!((i=t==null?void 0:t.content)!=null&&i.write)?wl(e):void 0;return o&&n.push(o),n}function Il(e,t,n){const r=(e==null?void 0:e.filter(i=>!(t!=null&&t[i==null?void 0:i.mapToName])))||[],o=r.map(i=>i.mapToName);return n(we.MAPPING,o),r!=null&&r.length&&console.error("required fields not met",r.map(i=>i.mapToDisplayName)),{errorList:o}}function bl(e,t){return gl(e,t)}function _l(e,t){return gl(e,t)}const ag=(e,t,n)=>{var m,C,y,_,x,b,S,R,N;if(!e)return null;const r=Cs(e,t),o=r&&tg(r),i=r&&ig(r),s=r&&ng(r),a=r&&rg(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=(m=d==null?void 0:d.read)==null?void 0:m.objects)==null?void 0:C[t])==null?void 0:y.selectedFields)||{},h=((b=(x=(_=d==null?void 0:d.read)==null?void 0:_.objects)==null?void 0:x[t])==null?void 0:b.selectedValueMappings)||{},p=((N=(R=(S=d==null?void 0:d.read)==null?void 0:S.objects)==null?void 0:R[t])==null?void 0:N.selectedFieldMappings)||{},g={...f},v={...p};return{allFields:c,allFieldsMetadata:u,requiredFields:o,optionalFields:i,requiredMapFields:s,optionalMapFields:a,selectedOptionalFields:f,selectedFieldMappings:p,selectedValueMappings:h,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,isValueMappingsModified:!1,savedConfig:{optionalFields:g,requiredMapFields:v,selectedValueMappings:h}}},cg=(e,t)=>{var r,o;if(!e)return null;const n=(o=(r=t==null?void 0:t.content)==null?void 0:r.write)==null?void 0:o.objects;return{writeObjects:(e==null?void 0:e.objects)||[],selectedWriteObjects:n||{},isWriteModified:!1,savedConfig:{selectedWriteObjects:n||{}}}};function xl(e,t,n){var i,s;const r=(i=e==null?void 0:e.content)==null?void 0:i.read,o=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:ag(r,t,n),write:cg(o,n)}}const Cl=(e,t,n,r)=>{const o=xl(e,n,t);r(n,o)},lg=(e,t,n)=>{const r=sg(t,e),o={};r.forEach(({name:i,completed:s})=>{s&&(o[i]=xl(e,i,t))}),n(o)},Ol=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(i=>r.add(og(i))),{...Array.from(r).reduce((i,s)=>({...i,[s]:!0}),{}),...n||{}}},El=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},Sl=e=>{const{selectedValueMappings:t}=(e==null?void 0:e.read)||{};return t};function Nl(e,t){return t[e]||void 0}async function Os({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:o,apiKey:i,setError:s,setInstallation:a,onInstallSuccess:c}){const u={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:o,config:e}};try{const d=await je().installationApi.createInstallation(u,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}});a(d),c==null||c(d.id,d.config)}catch(d){st(d,s)}}function to(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const ug=(e,t)=>{const n=e.content.read,r=n==null?void 0:n.objects;return r==null?void 0:r.find(o=>o.objectName===t)},dg=(e,t,n,r)=>{const o=Ol(e),i=El(e),s=Sl(e),a=ug(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:o,selectedFieldMappings:i,selectedValueMappings:s||{},backfill:a.backfill}}}}};return to(n)&&(c.content.proxy={enabled:!0}),c},fg=(e,t,n,r,o,i,s,a,c,u,d,f)=>{const h=dg(c,i,a,r);return h?Os({createConfig:h,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:s,setError:u,setInstallation:d,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Tl=e=>{var t;return{...(t=e.write)==null?void 0:t.selectedWriteObjects}},pg=e=>{const t=e.content.write;return t==null?void 0:t.objects},hg=(e,t,n)=>{if(!pg(t))return console.error("Error when getting write objects from hydratedRevision"),null;const o=Tl(e),i={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:o}}};return to(t)&&(i.content.proxy={enabled:!0}),i},mg=(e,t,n,r,o,i,s,a,c,u,d)=>{const f=hg(a,s,r);return f?Os({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:c,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},gg={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 Rl({children:e,style:t}){return l.jsx(Pn,{style:{...gg,...t},children:e})}var Al={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})()})(Oa);var Tf=Oa.exports;const ct=Jo(Tf),Af="_button_1kk7v_1",Rf="_buttonError_1kk7v_20",Pf="_danger_1kk7v_34",Df="_ghost_1kk7v_39",lo={button:Af,buttonError:Rf,danger:Pf,ghost:Df};function Ze({className:e,style:t,type:n,children:r,variant:i,...o}){const s=ct(lo.button,{[lo.danger]:i==="danger",[lo.ghost]:i==="ghost",[e||""]:!!e});return l.jsx("button",{type:n,className:s,style:t,...o,children:r})}const Ea=h.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),$t=()=>{const e=h.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}=Qe(),[o,s]=h.useState(null),[a,c]=h.useState(!0),{isError:u,removeError:d,setError:p}=Nt(),m=ze(),f=n==null?void 0:n.id,v=(C=i==null?void 0:i.latestRevision)==null?void 0:C.id,I=(i==null?void 0:i.name)||r;h.useEffect(()=>{e&&r&&v&&f&&m&&Te().revisionApi.getHydratedRevision({projectIdOrName:e,integrationId:r,revisionId:v,connectionId:f},{headers:{"X-Api-Key":m??""}}).then(y=>{s(y),c(!1),d(me.HYDRATED_REVISION,I)}).catch(y=>{console.error(`Error loading integration ${I}.`),Je(y),c(!1),p(me.HYDRATED_REVISION,I)})},[e,r,v,f,m,d,p,I]);const g=h.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(me.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(Kt,{message:b})}return l.jsx(Ea.Provider,{value:g,children:t})}const Na=h.createContext(null);function Sa(){const e=h.useContext(Na);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const Ta=h.createContext(()=>{});function Ff(){const e=h.useContext(Ta);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var Aa=Symbol.for("immer-nothing"),Ji=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 rt(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 On=Object.getPrototypeOf;function En(e){return!!e&&!!e[ut]}function gn(e){var t;return e?Ra(e)||Array.isArray(e)||!!e[Ji]||!!((t=e.constructor)!=null&&t[Ji])||Wr(e)||Jr(e):!1}var kf=Object.prototype.constructor.toString();function Ra(e){if(!e||typeof e!="object")return!1;const t=On(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)===kf}function Sr(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 Oo(e,t){return qr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Pa(e,t,n){const r=qr(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Lf(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 dn(e){return e.copy_||e.base_}function Eo(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=Ra(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(On(e),r)}else{const r=On(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function Go(e,t=!1){return zr(e)||En(e)||!gn(e)||(qr(e)>1&&(e.set=e.add=e.clear=e.delete=Vf),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Go(r,!0))),e}function Vf(){rt(2)}function zr(e){return Object.isFrozen(e)}var Kf={};function vn(e){const t=Kf[e];return t||rt(0,e),t}var qn;function Da(){return qn}function $f(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function zi(e,t){t&&(vn("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function No(e){So(e),e.drafts_.forEach(Uf),e.drafts_=null}function So(e){e===qn&&(qn=e.parent_)}function Xi(e){return qn=$f(qn,e)}function Uf(e){const t=e[ut];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Gi(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[ut].modified_&&(No(t),rt(4)),gn(e)&&(e=Tr(t,e),t.parent_||Ar(t,e)),t.patches_&&vn("Patches").generateReplacementPatches_(n[ut].base_,e,t.patches_,t.inversePatches_)):e=Tr(t,n,[]),No(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Aa?e:void 0}function Tr(e,t,n){if(zr(t))return t;const r=t[ut];if(!r)return Sr(t,(i,o)=>Yi(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Ar(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),Sr(o,(a,c)=>Yi(e,r,i,a,c,n,s)),Ar(e,i,!1),n&&e.patches_&&vn("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Yi(e,t,n,r,i,o,s){if(process.env.NODE_ENV!=="production"&&i===n&&rt(5),En(i)){const a=o&&t&&t.type_!==3&&!Oo(t.assigned_,r)?o.concat(r):void 0,c=Tr(e,i,a);if(Pa(n,r,c),En(c))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(gn(i)&&!zr(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Tr(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Ar(e,i)}}function Ar(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Go(t,n)}function Hf(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Da(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=Yo;n&&(i=[r],o=Wn);const{revoke:s,proxy:a}=Proxy.revocable(i,o);return r.draft_=a,r.revoke_=s,a}var Yo={get(e,t){if(t===ut)return e;const n=dn(e);if(!Oo(n,t))return Bf(e,n,t);const r=n[t];return e.finalized_||!gn(r)?r:r===uo(e.base_,t)?(po(e),e.copy_[t]=Ao(r,e)):r},has(e,t){return t in dn(e)},ownKeys(e){return Reflect.ownKeys(dn(e))},set(e,t,n){const r=Ma(dn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=uo(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(Lf(n,i)&&(n!==void 0||Oo(e.base_,t)))return!0;po(e),To(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 uo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,po(e),To(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(){rt(11)},getPrototypeOf(e){return On(e.base_)},setPrototypeOf(){rt(12)}},Wn={};Sr(Yo,(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))&&rt(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))&&rt(14),Yo.set.call(this,e[0],t,n,e[0])};function uo(e,t){const n=e[ut];return(n?dn(n):e)[t]}function Bf(e,t,n){var i;const r=Ma(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function Ma(e,t){if(!(t in e))return;let n=On(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=On(n)}}function To(e){e.modified_||(e.modified_=!0,e.parent_&&To(e.parent_))}function po(e){e.copy_||(e.copy_=Eo(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var qf=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"&&rt(6),r!==void 0&&typeof r!="function"&&rt(7);let i;if(gn(t)){const o=Xi(this),s=Ao(t,void 0);let a=!0;try{i=n(s),a=!1}finally{a?No(o):So(o)}return zi(o,r),Gi(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===Aa&&(i=void 0),this.autoFreeze_&&Go(i,!0),r){const o=[],s=[];vn("Patches").generateReplacementPatches_(t,i,o,s),r(o,s)}return i}else rt(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){gn(e)||rt(8),En(e)&&(e=Wf(e));const t=Xi(this),n=Ao(e,void 0);return n[ut].isManual_=!0,So(t),n}finishDraft(e,t){const n=e&&e[ut];(!n||!n.isManual_)&&rt(9);const{scope_:r}=n;return zi(r,t),Gi(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=vn("Patches").applyPatches_;return En(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Ao(e,t){const n=Wr(e)?vn("MapSet").proxyMap_(e,t):Jr(e)?vn("MapSet").proxySet_(e,t):Hf(e,t);return(t?t.scope_:Da()).drafts_.push(n),n}function Wf(e){return En(e)||rt(10,e),Fa(e)}function Fa(e){if(!gn(e)||zr(e))return e;const t=e[ut];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Eo(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Eo(e,!0);return Sr(n,(r,i)=>{Pa(n,r,Fa(i))}),t&&(t.finalized_=!1),n}var dt=new qf,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 ja=h.createContext(void 0),Jf={};function Zo(){const e=h.useContext(ja);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function zf({children:e}){const{installation:t}=Qe(),{hydratedRevision:n,loading:r}=$t(),[i,o]=h.useState(Jf),s=t==null?void 0:t.config;h.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(i).length>0)&&_f(n,s,o)},[n,r,s,i]);const a=h.useCallback((f,v)=>{o(I=>Vn(I,g=>{g[f]=Vn(g[f],v)}))},[o]),c=h.useCallback((f,v)=>{o(I=>Vn(I,g=>{g[f]=v}))},[o]),u=h.useCallback(()=>{o(Vn(f=>{const v=f.other.write;v&&(v.isWriteModified=!1)}))},[o]),d=h.useCallback(f=>{o(Vn(v=>{var g;const I=(g=v[f])==null?void 0:g.read;I&&(I.isOptionalFieldsModified=!1,I.isRequiredMapFieldsModified=!1,I.isValueMappingsModified=!1)}))},[o]),p=h.useCallback(f=>{f===hn?u():d(f)},[d,u]),m=h.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:p}),[i,c,p,a]);return l.jsx(ja.Provider,{value:m,children:e})}const pt=()=>{const{appName:e}=Re(),{objectConfigurationsState:t,setConfigureState:n}=Zo(),{selectedObjectName:r}=Sa(),i=ba(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}};function Xf(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 Jn(e,t,n){t(e,r=>Xf(r,n))}const Gf=(e,t)=>e.filter(n=>!t.has(n));function Yf(){var m,f,v;const{selectedObjectName:e,configureState:t,setConfigureState:n}=pt(),{fieldMapping:r}=Qe(),i=((m=t==null?void 0:t.read)==null?void 0:m.selectedFieldMappings)||{},o=Object.keys(i),s=((f=t==null?void 0:t.read)==null?void 0:f.requiredMapFields)||[],a=((v=t==null?void 0:t.read)==null?void 0:v.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(I=>!I.fieldName):[],u=s.concat(c,a).map(I=>I.mapToName),d=new Set(u),p=Gf(o,d);h.useEffect(()=>{e&&p.length&&Jn(e,n,p.map(I=>({field:I,value:null})))},[e,n,p])}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 Ro(e,t){return Ro=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ro(e,t)}function Zf(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Ro(e,t)}var Po={exports:{}},gr={exports:{}},ge={};/** @license React v16.13.1
8
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var i="",s=0;s<arguments.length;s++){var a=arguments[s];a&&(i=o(i,r(a)))}return i}function r(i){if(typeof i=="string"||typeof i=="number")return i;if(typeof i!="object")return"";if(Array.isArray(i))return n.apply(null,i);if(i.toString!==Object.prototype.toString&&!i.toString.toString().includes("[native code]"))return i.toString();var s="";for(var a in i)t.call(i,a)&&i[a]&&(s=o(s,a));return s}function o(i,s){return s?i?i+" "+s:i+s:i}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Al);var yg=Al.exports;const It=xs(yg),vg="_button_1kk7v_1",wg="_buttonError_1kk7v_20",Ig="_danger_1kk7v_34",bg="_ghost_1kk7v_39",xo={button:vg,buttonError:wg,danger:Ig,ghost:bg};function at({className:e,style:t,type:n,children:r,variant:o,...i}){const s=It(xo.button,{[xo.danger]:o==="danger",[xo.ghost]:o==="ghost",[e||""]:!!e});return l.jsx("button",{type:n,className:s,style:t,...i,children:r})}const Pl=w.createContext({hydratedRevision:null,loading:!1,readAction:void 0,writeObjects:[]}),dn=()=>{const e=w.useContext(Pl);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function _g({projectId:e,children:t}){var C;const{selectedConnection:n}=or(),{integrationId:r,integrationObj:o}=ut(),[i,s]=w.useState(null),[a,c]=w.useState(!0),{isError:u,removeError:d,setError:f}=Ht(),h=tt(),p=n==null?void 0:n.id,g=(C=o==null?void 0:o.latestRevision)==null?void 0:C.id,v=(o==null?void 0:o.name)||r;w.useEffect(()=>{e&&r&&g&&p&&h&&je().revisionApi.getHydratedRevision({projectIdOrName:e,integrationId:r,revisionId:g,connectionId:p},{headers:{"X-Api-Key":h??""}}).then(y=>{s(y),c(!1),d(we.HYDRATED_REVISION,v)}).catch(y=>{console.error(`Error loading integration ${v}.`),st(y),c(!1),f(we.HYDRATED_REVISION,v)})},[e,r,g,p,h,d,f,v]);const m=w.useMemo(()=>{var y,_,x;return{hydratedRevision:i,loading:a,readAction:(y=i==null?void 0:i.content)==null?void 0:y.read,writeObjects:((x=(_=i==null?void 0:i.content)==null?void 0:_.write)==null?void 0:x.objects)||[]}},[i,a]);if(u(we.HYDRATED_REVISION,v)){const _=`Error retrieving integration details for '${(o==null?void 0:o.name)||r||"unknown integration"}. This is sometimes caused by insufficient permissions with your credentials'`;return l.jsx(un,{message:_})}return l.jsx(Pl.Provider,{value:m,children:t})}const Dl=w.createContext(null);function Fl(){const e=w.useContext(Dl);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const Ml=w.createContext(()=>{});function xg(){const e=w.useContext(Ml);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var jl=Symbol.for("immer-nothing"),Fa=Symbol.for("immer-draftable"),_t=Symbol.for("immer-state"),Cg=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 mt(e,...t){if(process.env.NODE_ENV!=="production"){const n=Cg[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 Cr=Object.getPrototypeOf;function Or(e){return!!e&&!!e[_t]}function tr(e){var t;return e?kl(e)||Array.isArray(e)||!!e[Fa]||!!((t=e.constructor)!=null&&t[Fa])||ro(e)||io(e):!1}var Og=Object.prototype.constructor.toString();function kl(e){if(!e||typeof e!="object")return!1;const t=Cr(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)===Og}function Vi(e,t){no(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function no(e){const t=e[_t];return t?t.type_:Array.isArray(e)?1:ro(e)?2:io(e)?3:0}function Yo(e,t){return no(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ll(e,t,n){const r=no(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Eg(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function ro(e){return e instanceof Map}function io(e){return e instanceof Set}function Un(e){return e.copy_||e.base_}function Zo(e,t){if(ro(e))return new Map(e);if(io(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=kl(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[_t];let o=Reflect.ownKeys(r);for(let i=0;i<o.length;i++){const s=o[i],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(Cr(e),r)}else{const r=Cr(e);if(r!==null&&n)return{...e};const o=Object.create(r);return Object.assign(o,e)}}function Es(e,t=!1){return oo(e)||Or(e)||!tr(e)||(no(e)>1&&(e.set=e.add=e.clear=e.delete=Sg),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>Es(r,!0))),e}function Sg(){mt(2)}function oo(e){return Object.isFrozen(e)}var Ng={};function nr(e){const t=Ng[e];return t||mt(0,e),t}var Jr;function Vl(){return Jr}function Tg(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ma(e,t){t&&(nr("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function es(e){ts(e),e.drafts_.forEach(Rg),e.drafts_=null}function ts(e){e===Jr&&(Jr=e.parent_)}function ja(e){return Jr=Tg(Jr,e)}function Rg(e){const t=e[_t];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function ka(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[_t].modified_&&(es(t),mt(4)),tr(e)&&(e=Ki(t,e),t.parent_||$i(t,e)),t.patches_&&nr("Patches").generateReplacementPatches_(n[_t].base_,e,t.patches_,t.inversePatches_)):e=Ki(t,n,[]),es(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==jl?e:void 0}function Ki(e,t,n){if(oo(t))return t;const r=t[_t];if(!r)return Vi(t,(o,i)=>La(e,r,t,o,i,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return $i(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const o=r.copy_;let i=o,s=!1;r.type_===3&&(i=new Set(o),o.clear(),s=!0),Vi(i,(a,c)=>La(e,r,o,a,c,n,s)),$i(e,o,!1),n&&e.patches_&&nr("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function La(e,t,n,r,o,i,s){if(process.env.NODE_ENV!=="production"&&o===n&&mt(5),Or(o)){const a=i&&t&&t.type_!==3&&!Yo(t.assigned_,r)?i.concat(r):void 0,c=Ki(e,o,a);if(Ll(n,r,c),Or(c))e.canAutoFreeze_=!1;else return}else s&&n.add(o);if(tr(o)&&!oo(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ki(e,o),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&$i(e,o)}}function $i(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Es(t,n)}function Ag(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Vl(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=r,i=Ss;n&&(o=[r],i=zr);const{revoke:s,proxy:a}=Proxy.revocable(o,i);return r.draft_=a,r.revoke_=s,a}var Ss={get(e,t){if(t===_t)return e;const n=Un(e);if(!Yo(n,t))return Pg(e,n,t);const r=n[t];return e.finalized_||!tr(r)?r:r===Co(e.base_,t)?(Oo(e),e.copy_[t]=rs(r,e)):r},has(e,t){return t in Un(e)},ownKeys(e){return Reflect.ownKeys(Un(e))},set(e,t,n){const r=Kl(Un(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const o=Co(Un(e),t),i=o==null?void 0:o[_t];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Eg(n,o)&&(n!==void 0||Yo(e.base_,t)))return!0;Oo(e),ns(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 Co(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Oo(e),ns(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(){mt(11)},getPrototypeOf(e){return Cr(e.base_)},setPrototypeOf(){mt(12)}},zr={};Vi(Ss,(e,t)=>{zr[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});zr.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&mt(13),zr.set.call(this,e,t,void 0)};zr.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&mt(14),Ss.set.call(this,e[0],t,n,e[0])};function Co(e,t){const n=e[_t];return(n?Un(n):e)[t]}function Pg(e,t,n){var o;const r=Kl(t,n);return r?"value"in r?r.value:(o=r.get)==null?void 0:o.call(e.draft_):void 0}function Kl(e,t){if(!(t in e))return;let n=Cr(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Cr(n)}}function ns(e){e.modified_||(e.modified_=!0,e.parent_&&ns(e.parent_))}function Oo(e){e.copy_||(e.copy_=Zo(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Dg=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,r)=>{if(typeof t=="function"&&typeof n!="function"){const i=n;n=t;const s=this;return function(c=i,...u){return s.produce(c,d=>n.call(this,d,...u))}}typeof n!="function"&&mt(6),r!==void 0&&typeof r!="function"&&mt(7);let o;if(tr(t)){const i=ja(this),s=rs(t,void 0);let a=!0;try{o=n(s),a=!1}finally{a?es(i):ts(i)}return Ma(i,r),ka(o,i)}else if(!t||typeof t!="object"){if(o=n(t),o===void 0&&(o=t),o===jl&&(o=void 0),this.autoFreeze_&&Es(o,!0),r){const i=[],s=[];nr("Patches").generateReplacementPatches_(t,o,i,s),r(i,s)}return o}else mt(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...a)=>this.produceWithPatches(s,c=>t(c,...a));let r,o;return[this.produce(t,n,(s,a)=>{r=s,o=a}),r,o]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){tr(e)||mt(8),Or(e)&&(e=Fg(e));const t=ja(this),n=rs(e,void 0);return n[_t].isManual_=!0,ts(t),n}finishDraft(e,t){const n=e&&e[_t];(!n||!n.isManual_)&&mt(9);const{scope_:r}=n;return Ma(r,t),ka(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 o=t[n];if(o.path.length===0&&o.op==="replace"){e=o.value;break}}n>-1&&(t=t.slice(n+1));const r=nr("Patches").applyPatches_;return Or(e)?r(e,t):this.produce(e,o=>r(o,t))}};function rs(e,t){const n=ro(e)?nr("MapSet").proxyMap_(e,t):io(e)?nr("MapSet").proxySet_(e,t):Ag(e,t);return(t?t.scope_:Vl()).drafts_.push(n),n}function Fg(e){return Or(e)||mt(10,e),$l(e)}function $l(e){if(!tr(e)||oo(e))return e;const t=e[_t];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Zo(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Zo(e,!0);return Vi(n,(r,o)=>{Ll(n,r,$l(o))}),t&&(t.finalized_=!1),n}var xt=new Dg,Lr=xt.produce;xt.produceWithPatches.bind(xt);xt.setAutoFreeze.bind(xt);xt.setUseStrictShallowCopy.bind(xt);xt.applyPatches.bind(xt);xt.createDraft.bind(xt);xt.finishDraft.bind(xt);const Ul=w.createContext(void 0),Mg={};function Ns(){const e=w.useContext(Ul);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function jg({children:e}){const{installation:t}=ut(),{hydratedRevision:n,loading:r}=dn(),[o,i]=w.useState(Mg),s=t==null?void 0:t.config;w.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(o).length>0)&&lg(n,s,i)},[n,r,s,o]);const a=w.useCallback((p,g)=>{i(v=>Lr(v,m=>{m[p]=Lr(m[p],g)}))},[i]),c=w.useCallback((p,g)=>{i(v=>Lr(v,m=>{m[p]=g}))},[i]),u=w.useCallback(()=>{i(Lr(p=>{const g=p.other.write;g&&(g.isWriteModified=!1)}))},[i]),d=w.useCallback(p=>{i(Lr(g=>{var m;const v=(m=g[p])==null?void 0:m.read;v&&(v.isOptionalFieldsModified=!1,v.isRequiredMapFieldsModified=!1,v.isValueMappingsModified=!1)}))},[i]),f=w.useCallback(p=>{p===er?u():d(p)},[d,u]),h=w.useMemo(()=>({objectConfigurationsState:o,setObjectConfigurationsState:i,setConfigureState:a,resetConfigureState:c,resetPendingConfigurationState:f}),[o,c,f,a]);return l.jsx(Ul.Provider,{value:h,children:e})}const Ct=()=>{const{appName:e}=Le(),{objectConfigurationsState:t,setConfigureState:n}=Ns(),{selectedObjectName:r}=Fl(),o=Nl(r||"",t);return{appName:e,configureState:o,setConfigureState:n,selectedObjectName:r}};function kg(e,t){var r;const n=((r=e==null?void 0:e.read)==null?void 0:r.selectedFieldMappings)||{};if(t.forEach(o=>{const{field:i,value:s}=o;s===null?delete n[i]:n[i]=s}),e!=null&&e.read){const o=e.read.savedConfig.requiredMapFields,s=!_l(o,n);e.read.isRequiredMapFieldsModified=s}}function Gr(e,t,n){t(e,r=>kg(r,n))}const Lg=(e,t)=>e.filter(n=>!t.has(n));function Vg(){var h,p,g;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Ct(),{fieldMapping:r}=ut(),o=((h=t==null?void 0:t.read)==null?void 0:h.selectedFieldMappings)||{},i=Object.keys(o),s=((p=t==null?void 0:t.read)==null?void 0:p.requiredMapFields)||[],a=((g=t==null?void 0:t.read)==null?void 0:g.optionalMapFields)||[],c=e&&r?Object.values(r[e]||{}).flat().filter(v=>!v.fieldName):[],u=s.concat(c,a).map(v=>v.mapToName),d=new Set(u),f=Lg(i,d);w.useEffect(()=>{e&&f.length&&Gr(e,n,f.map(v=>({field:v,value:null})))},[e,n,f])}function cn(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 pe(){return pe=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},pe.apply(null,arguments)}function is(e,t){return is=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},is(e,t)}function Kg(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,is(e,t)}var os={exports:{}},Oi={exports:{}},be={};/** @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 Zi;function Qf(){if(Zi)return ge;Zi=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,m=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,I=e?Symbol.for("react.block"):60121,g=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 f:case s:return _;default:return E}}case n:return E}}}function x(_){return b(_)===u}return ge.AsyncMode=c,ge.ConcurrentMode=u,ge.ContextConsumer=a,ge.ContextProvider=s,ge.Element=t,ge.ForwardRef=d,ge.Fragment=r,ge.Lazy=v,ge.Memo=f,ge.Portal=n,ge.Profiler=o,ge.StrictMode=i,ge.Suspense=p,ge.isAsyncMode=function(_){return x(_)||b(_)===c},ge.isConcurrentMode=x,ge.isContextConsumer=function(_){return b(_)===a},ge.isContextProvider=function(_){return b(_)===s},ge.isElement=function(_){return typeof _=="object"&&_!==null&&_.$$typeof===t},ge.isForwardRef=function(_){return b(_)===d},ge.isFragment=function(_){return b(_)===r},ge.isLazy=function(_){return b(_)===v},ge.isMemo=function(_){return b(_)===f},ge.isPortal=function(_){return b(_)===n},ge.isProfiler=function(_){return b(_)===o},ge.isStrictMode=function(_){return b(_)===i},ge.isSuspense=function(_){return b(_)===p},ge.isValidElementType=function(_){return typeof _=="string"||typeof _=="function"||_===r||_===u||_===o||_===i||_===p||_===m||typeof _=="object"&&_!==null&&(_.$$typeof===v||_.$$typeof===f||_.$$typeof===s||_.$$typeof===a||_.$$typeof===d||_.$$typeof===g||_.$$typeof===C||_.$$typeof===y||_.$$typeof===I)},ge.typeOf=b,ge}var ve={};/** @license React v16.13.1
15
+ */var Va;function $g(){if(Va)return be;Va=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,o=e?Symbol.for("react.strict_mode"):60108,i=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,h=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function _(b){if(typeof b=="object"&&b!==null){var S=b.$$typeof;switch(S){case t:switch(b=b.type,b){case c:case u:case r:case i:case o:case f:return b;default:switch(b=b&&b.$$typeof,b){case a:case d:case g:case p:case s:return b;default:return S}}case n:return S}}}function x(b){return _(b)===u}return be.AsyncMode=c,be.ConcurrentMode=u,be.ContextConsumer=a,be.ContextProvider=s,be.Element=t,be.ForwardRef=d,be.Fragment=r,be.Lazy=g,be.Memo=p,be.Portal=n,be.Profiler=i,be.StrictMode=o,be.Suspense=f,be.isAsyncMode=function(b){return x(b)||_(b)===c},be.isConcurrentMode=x,be.isContextConsumer=function(b){return _(b)===a},be.isContextProvider=function(b){return _(b)===s},be.isElement=function(b){return typeof b=="object"&&b!==null&&b.$$typeof===t},be.isForwardRef=function(b){return _(b)===d},be.isFragment=function(b){return _(b)===r},be.isLazy=function(b){return _(b)===g},be.isMemo=function(b){return _(b)===p},be.isPortal=function(b){return _(b)===n},be.isProfiler=function(b){return _(b)===i},be.isStrictMode=function(b){return _(b)===o},be.isSuspense=function(b){return _(b)===f},be.isValidElementType=function(b){return typeof b=="string"||typeof b=="function"||b===r||b===u||b===i||b===o||b===f||b===h||typeof b=="object"&&b!==null&&(b.$$typeof===g||b.$$typeof===p||b.$$typeof===s||b.$$typeof===a||b.$$typeof===d||b.$$typeof===m||b.$$typeof===C||b.$$typeof===y||b.$$typeof===v)},be.typeOf=_,be}var _e={};/** @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 Qi;function em(){return Qi||(Qi=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,m=e?Symbol.for("react.suspense_list"):60120,f=e?Symbol.for("react.memo"):60115,v=e?Symbol.for("react.lazy"):60116,I=e?Symbol.for("react.block"):60121,g=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===m||typeof P=="object"&&P!==null&&(P.$$typeof===v||P.$$typeof===f||P.$$typeof===s||P.$$typeof===a||P.$$typeof===d||P.$$typeof===g||P.$$typeof===C||P.$$typeof===y||P.$$typeof===I)}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 Ie=K&&K.$$typeof;switch(Ie){case a:case d:case v:case f:case s:return Ie;default:return fe}}case n:return fe}}}var _=c,E=u,k=a,S=s,B=t,q=d,W=r,G=v,ee=f,$=n,ie=o,te=i,X=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.")),N(P)||x(P)===c}function N(P){return x(P)===u}function D(P){return x(P)===a}function L(P){return x(P)===s}function F(P){return typeof P=="object"&&P!==null&&P.$$typeof===t}function M(P){return x(P)===d}function R(P){return x(P)===r}function Y(P){return x(P)===v}function Z(P){return x(P)===f}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}ve.AsyncMode=_,ve.ConcurrentMode=E,ve.ContextConsumer=k,ve.ContextProvider=S,ve.Element=B,ve.ForwardRef=q,ve.Fragment=W,ve.Lazy=G,ve.Memo=ee,ve.Portal=$,ve.Profiler=ie,ve.StrictMode=te,ve.Suspense=X,ve.isAsyncMode=pe,ve.isConcurrentMode=N,ve.isContextConsumer=D,ve.isContextProvider=L,ve.isElement=F,ve.isForwardRef=M,ve.isFragment=R,ve.isLazy=Y,ve.isMemo=Z,ve.isPortal=V,ve.isProfiler=Q,ve.isStrictMode=J,ve.isSuspense=ae,ve.isValidElementType=b,ve.typeOf=x}()),ve}var es;function ka(){return es||(es=1,process.env.NODE_ENV==="production"?gr.exports=Qf():gr.exports=em()),gr.exports}/*
22
+ */var Ka;function Ug(){return Ka||(Ka=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,o=e?Symbol.for("react.strict_mode"):60108,i=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,h=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,g=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function _(F){return typeof F=="string"||typeof F=="function"||F===r||F===u||F===i||F===o||F===f||F===h||typeof F=="object"&&F!==null&&(F.$$typeof===g||F.$$typeof===p||F.$$typeof===s||F.$$typeof===a||F.$$typeof===d||F.$$typeof===m||F.$$typeof===C||F.$$typeof===y||F.$$typeof===v)}function x(F){if(typeof F=="object"&&F!==null){var ve=F.$$typeof;switch(ve){case t:var B=F.type;switch(B){case c:case u:case r:case i:case o:case f:return B;default:var Ee=B&&B.$$typeof;switch(Ee){case a:case d:case g:case p:case s:return Ee;default:return ve}}case n:return ve}}}var b=c,S=u,R=a,N=s,M=t,U=d,q=r,G=g,ne=p,W=n,ce=i,re=o,Q=f,fe=!1;function ye(F){return fe||(fe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),T(F)||x(F)===c}function T(F){return x(F)===u}function j(F){return x(F)===a}function K(F){return x(F)===s}function L(F){return typeof F=="object"&&F!==null&&F.$$typeof===t}function k(F){return x(F)===d}function D(F){return x(F)===r}function Z(F){return x(F)===g}function ee(F){return x(F)===p}function H(F){return x(F)===n}function te(F){return x(F)===i}function z(F){return x(F)===o}function ue(F){return x(F)===f}_e.AsyncMode=b,_e.ConcurrentMode=S,_e.ContextConsumer=R,_e.ContextProvider=N,_e.Element=M,_e.ForwardRef=U,_e.Fragment=q,_e.Lazy=G,_e.Memo=ne,_e.Portal=W,_e.Profiler=ce,_e.StrictMode=re,_e.Suspense=Q,_e.isAsyncMode=ye,_e.isConcurrentMode=T,_e.isContextConsumer=j,_e.isContextProvider=K,_e.isElement=L,_e.isForwardRef=k,_e.isFragment=D,_e.isLazy=Z,_e.isMemo=ee,_e.isPortal=H,_e.isProfiler=te,_e.isStrictMode=z,_e.isSuspense=ue,_e.isValidElementType=_,_e.typeOf=x}()),_e}var $a;function ql(){return $a||($a=1,process.env.NODE_ENV==="production"?Oi.exports=$g():Oi.exports=Ug()),Oi.exports}/*
23
23
  object-assign
24
24
  (c) Sindre Sorhus
25
25
  @license MIT
26
- */var fo,ts;function tm(){if(ts)return fo;ts=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 fo=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 m=0;m<u.length;m++)n.call(a,u[m])&&(c[u[m]]=a[u[m]])}}return c},fo}var mo,ns;function Qo(){if(ns)return mo;ns=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return mo=e,mo}var ho,rs;function La(){return rs||(rs=1,ho=Function.call.bind(Object.prototype.hasOwnProperty)),ho}var go,os;function nm(){if(os)return go;os=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Qo(),n={},r=La();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 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}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 f=u?u():"";e("Failed "+a+" type: "+p.message+(f??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},go=i,go}var vo,is;function rm(){if(is)return vo;is=1;var e=ka(),t=tm(),n=Qo(),r=La(),i=nm(),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 vo=function(a,c){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function p(N){var D=N&&(u&&N[u]||N[d]);if(typeof D=="function")return D}var m="<<anonymous>>",f={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:q(),objectOf:S,oneOf:k,oneOfType:B,shape:G,exact:ee};function v(N,D){return N===D?N!==0||1/N===1/D:N!==N&&D!==D}function I(N,D){this.message=N,this.data=D&&typeof D=="object"?D:{},this.stack=""}I.prototype=Error.prototype;function g(N){if(process.env.NODE_ENV!=="production")var D={},L=0;function F(R,Y,Z,V,Q,J,ae){if(V=V||m,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;!D[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."),D[fe]=!0,L++)}}return Y[Z]==null?R?Y[Z]===null?new I("The "+Q+" `"+J+"` is marked as required "+("in `"+V+"`, but its value is `null`.")):new I("The "+Q+" `"+J+"` is marked as required in "+("`"+V+"`, but its value is `undefined`.")):null:N(Y,Z,V,Q,J)}var M=F.bind(null,!1);return M.isRequired=F.bind(null,!0),M}function C(N){function D(L,F,M,R,Y,Z){var V=L[F],Q=te(V);if(Q!==N){var J=X(V);return new I("Invalid "+R+" `"+Y+"` of type "+("`"+J+"` supplied to `"+M+"`, expected ")+("`"+N+"`."),{expectedType:N})}return null}return g(D)}function y(){return g(s)}function b(N){function D(L,F,M,R,Y){if(typeof N!="function")return new I("Property `"+Y+"` of component `"+M+"` has invalid PropType notation inside arrayOf.");var Z=L[F];if(!Array.isArray(Z)){var V=te(Z);return new I("Invalid "+R+" `"+Y+"` of type "+("`"+V+"` supplied to `"+M+"`, expected an array."))}for(var Q=0;Q<Z.length;Q++){var J=N(Z,Q,M,R,Y+"["+Q+"]",n);if(J instanceof Error)return J}return null}return g(D)}function x(){function N(D,L,F,M,R){var Y=D[L];if(!a(Y)){var Z=te(Y);return new I("Invalid "+M+" `"+R+"` of type "+("`"+Z+"` supplied to `"+F+"`, expected a single ReactElement."))}return null}return g(N)}function _(){function N(D,L,F,M,R){var Y=D[L];if(!e.isValidElementType(Y)){var Z=te(Y);return new I("Invalid "+M+" `"+R+"` of type "+("`"+Z+"` supplied to `"+F+"`, expected a single ReactElement type."))}return null}return g(N)}function E(N){function D(L,F,M,R,Y){if(!(L[F]instanceof N)){var Z=N.name||m,V=pe(L[F]);return new I("Invalid "+R+" `"+Y+"` of type "+("`"+V+"` supplied to `"+M+"`, expected ")+("instance of `"+Z+"`."))}return null}return g(D)}function k(N){if(!Array.isArray(N))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,F,M,R,Y){for(var Z=L[F],V=0;V<N.length;V++)if(v(Z,N[V]))return null;var Q=JSON.stringify(N,function(ae,P){var fe=X(P);return fe==="symbol"?String(P):P});return new I("Invalid "+R+" `"+Y+"` of value `"+String(Z)+"` "+("supplied to `"+M+"`, expected one of "+Q+"."))}return g(D)}function S(N){function D(L,F,M,R,Y){if(typeof N!="function")return new I("Property `"+Y+"` of component `"+M+"` has invalid PropType notation inside objectOf.");var Z=L[F],V=te(Z);if(V!=="object")return new I("Invalid "+R+" `"+Y+"` of type "+("`"+V+"` supplied to `"+M+"`, expected an object."));for(var Q in Z)if(r(Z,Q)){var J=N(Z,Q,M,R,Y+"."+Q,n);if(J instanceof Error)return J}return null}return g(D)}function B(N){if(!Array.isArray(N))return process.env.NODE_ENV!=="production"&&o("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var D=0;D<N.length;D++){var L=N[D];if(typeof L!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+le(L)+" at index "+D+"."),s}function F(M,R,Y,Z,V){for(var Q=[],J=0;J<N.length;J++){var ae=N[J],P=ae(M,R,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 I("Invalid "+Z+" `"+V+"` supplied to "+("`"+Y+"`"+fe+"."))}return g(F)}function q(){function N(D,L,F,M,R){return $(D[L])?null:new I("Invalid "+M+" `"+R+"` supplied to "+("`"+F+"`, expected a ReactNode."))}return g(N)}function W(N,D,L,F,M){return new I((N||"React class")+": "+D+" type `"+L+"."+F+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+M+"`.")}function G(N){function D(L,F,M,R,Y){var Z=L[F],V=te(Z);if(V!=="object")return new I("Invalid "+R+" `"+Y+"` of type `"+V+"` "+("supplied to `"+M+"`, expected `object`."));for(var Q in N){var J=N[Q];if(typeof J!="function")return W(M,R,Y,Q,X(J));var ae=J(Z,Q,M,R,Y+"."+Q,n);if(ae)return ae}return null}return g(D)}function ee(N){function D(L,F,M,R,Y){var Z=L[F],V=te(Z);if(V!=="object")return new I("Invalid "+R+" `"+Y+"` of type `"+V+"` "+("supplied to `"+M+"`, expected `object`."));var Q=t({},L[F],N);for(var J in Q){var ae=N[J];if(r(N,J)&&typeof ae!="function")return W(M,R,Y,J,X(ae));if(!ae)return new I("Invalid "+R+" `"+Y+"` key `"+J+"` supplied to `"+M+"`.\nBad object: "+JSON.stringify(L[F],null," ")+`
27
- Valid keys: `+JSON.stringify(Object.keys(N),null," "));var P=ae(Z,J,M,R,Y+"."+J,n);if(P)return P}return null}return g(D)}function $(N){switch(typeof N){case"number":case"string":case"undefined":return!0;case"boolean":return!N;case"object":if(Array.isArray(N))return N.every($);if(N===null||a(N))return!0;var D=p(N);if(D){var L=D.call(N),F;if(D!==N.entries){for(;!(F=L.next()).done;)if(!$(F.value))return!1}else for(;!(F=L.next()).done;){var M=F.value;if(M&&!$(M[1]))return!1}}else return!1;return!0;default:return!1}}function ie(N,D){return N==="symbol"?!0:D?D["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&D instanceof Symbol:!1}function te(N){var D=typeof N;return Array.isArray(N)?"array":N instanceof RegExp?"object":ie(D,N)?"symbol":D}function X(N){if(typeof N>"u"||N===null)return""+N;var D=te(N);if(D==="object"){if(N instanceof Date)return"date";if(N instanceof RegExp)return"regexp"}return D}function le(N){var D=X(N);switch(D){case"array":case"object":return"an "+D;case"boolean":case"date":case"regexp":return"a "+D;default:return D}}function pe(N){return!N.constructor||!N.constructor.name?m:N.constructor.name}return f.checkPropTypes=i,f.resetWarningCache=i.resetWarningCache,f.PropTypes=f,f},vo}var yo,ss;function om(){if(ss)return yo;ss=1;var e=Qo();function t(){}function n(){}return n.resetWarningCache=t,yo=function(){function r(s,a,c,u,d,p){if(p!==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},yo}if(process.env.NODE_ENV!=="production"){var im=ka(),sm=!0;Po.exports=rm()(im.isElement,sm)}else Po.exports=om()();var am=Po.exports;const j=Jo(am);var Do={exports:{}},ye={};/**
26
+ */var Eo,Ua;function qg(){if(Ua)return Eo;Ua=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(i){if(i==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(i)}function o(){try{if(!Object.assign)return!1;var i=new String("abc");if(i[5]="de",Object.getOwnPropertyNames(i)[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 Eo=o()?Object.assign:function(i,s){for(var a,c=r(i),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 h=0;h<u.length;h++)n.call(a,u[h])&&(c[u[h]]=a[u[h]])}}return c},Eo}var So,qa;function Ts(){if(qa)return So;qa=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return So=e,So}var No,Ha;function Hl(){return Ha||(Ha=1,No=Function.call.bind(Object.prototype.hasOwnProperty)),No}var To,Ba;function Hg(){if(Ba)return To;Ba=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Ts(),n={},r=Hl();e=function(i){var s="Warning: "+i;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function o(i,s,a,c,u){if(process.env.NODE_ENV!=="production"){for(var d in i)if(r(i,d)){var f;try{if(typeof i[d]!="function"){var h=Error((c||"React class")+": "+a+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw h.name="Invariant Violation",h}f=i[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 o.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},To=o,To}var Ro,Wa;function Bg(){if(Wa)return Ro;Wa=1;var e=ql(),t=qg(),n=Ts(),r=Hl(),o=Hg(),i=function(){};process.env.NODE_ENV!=="production"&&(i=function(a){var c="Warning: "+a;typeof console<"u"&&console.error(c);try{throw new Error(c)}catch{}});function s(){return null}return Ro=function(a,c){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function f(T){var j=T&&(u&&T[u]||T[d]);if(typeof j=="function")return j}var h="<<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:_,element:x(),elementType:b(),instanceOf:S,node:U(),objectOf:N,oneOf:R,oneOfType:M,shape:G,exact:ne};function g(T,j){return T===j?T!==0||1/T===1/j:T!==T&&j!==j}function v(T,j){this.message=T,this.data=j&&typeof j=="object"?j:{},this.stack=""}v.prototype=Error.prototype;function m(T){if(process.env.NODE_ENV!=="production")var j={},K=0;function L(D,Z,ee,H,te,z,ue){if(H=H||h,z=z||ee,ue!==n){if(c){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}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var ve=H+":"+ee;!j[ve]&&K<3&&(i("You are manually calling a React.PropTypes validation function for the `"+z+"` prop on `"+H+"`. 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."),j[ve]=!0,K++)}}return Z[ee]==null?D?Z[ee]===null?new v("The "+te+" `"+z+"` is marked as required "+("in `"+H+"`, but its value is `null`.")):new v("The "+te+" `"+z+"` is marked as required in "+("`"+H+"`, but its value is `undefined`.")):null:T(Z,ee,H,te,z)}var k=L.bind(null,!1);return k.isRequired=L.bind(null,!0),k}function C(T){function j(K,L,k,D,Z,ee){var H=K[L],te=re(H);if(te!==T){var z=Q(H);return new v("Invalid "+D+" `"+Z+"` of type "+("`"+z+"` supplied to `"+k+"`, expected ")+("`"+T+"`."),{expectedType:T})}return null}return m(j)}function y(){return m(s)}function _(T){function j(K,L,k,D,Z){if(typeof T!="function")return new v("Property `"+Z+"` of component `"+k+"` has invalid PropType notation inside arrayOf.");var ee=K[L];if(!Array.isArray(ee)){var H=re(ee);return new v("Invalid "+D+" `"+Z+"` of type "+("`"+H+"` supplied to `"+k+"`, expected an array."))}for(var te=0;te<ee.length;te++){var z=T(ee,te,k,D,Z+"["+te+"]",n);if(z instanceof Error)return z}return null}return m(j)}function x(){function T(j,K,L,k,D){var Z=j[K];if(!a(Z)){var ee=re(Z);return new v("Invalid "+k+" `"+D+"` of type "+("`"+ee+"` supplied to `"+L+"`, expected a single ReactElement."))}return null}return m(T)}function b(){function T(j,K,L,k,D){var Z=j[K];if(!e.isValidElementType(Z)){var ee=re(Z);return new v("Invalid "+k+" `"+D+"` of type "+("`"+ee+"` supplied to `"+L+"`, expected a single ReactElement type."))}return null}return m(T)}function S(T){function j(K,L,k,D,Z){if(!(K[L]instanceof T)){var ee=T.name||h,H=ye(K[L]);return new v("Invalid "+D+" `"+Z+"` of type "+("`"+H+"` supplied to `"+k+"`, expected ")+("instance of `"+ee+"`."))}return null}return m(j)}function R(T){if(!Array.isArray(T))return process.env.NODE_ENV!=="production"&&(arguments.length>1?i("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])."):i("Invalid argument supplied to oneOf, expected an array.")),s;function j(K,L,k,D,Z){for(var ee=K[L],H=0;H<T.length;H++)if(g(ee,T[H]))return null;var te=JSON.stringify(T,function(ue,F){var ve=Q(F);return ve==="symbol"?String(F):F});return new v("Invalid "+D+" `"+Z+"` of value `"+String(ee)+"` "+("supplied to `"+k+"`, expected one of "+te+"."))}return m(j)}function N(T){function j(K,L,k,D,Z){if(typeof T!="function")return new v("Property `"+Z+"` of component `"+k+"` has invalid PropType notation inside objectOf.");var ee=K[L],H=re(ee);if(H!=="object")return new v("Invalid "+D+" `"+Z+"` of type "+("`"+H+"` supplied to `"+k+"`, expected an object."));for(var te in ee)if(r(ee,te)){var z=T(ee,te,k,D,Z+"."+te,n);if(z instanceof Error)return z}return null}return m(j)}function M(T){if(!Array.isArray(T))return process.env.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),s;for(var j=0;j<T.length;j++){var K=T[j];if(typeof K!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+fe(K)+" at index "+j+"."),s}function L(k,D,Z,ee,H){for(var te=[],z=0;z<T.length;z++){var ue=T[z],F=ue(k,D,Z,ee,H,n);if(F==null)return null;F.data&&r(F.data,"expectedType")&&te.push(F.data.expectedType)}var ve=te.length>0?", expected one of type ["+te.join(", ")+"]":"";return new v("Invalid "+ee+" `"+H+"` supplied to "+("`"+Z+"`"+ve+"."))}return m(L)}function U(){function T(j,K,L,k,D){return W(j[K])?null:new v("Invalid "+k+" `"+D+"` supplied to "+("`"+L+"`, expected a ReactNode."))}return m(T)}function q(T,j,K,L,k){return new v((T||"React class")+": "+j+" type `"+K+"."+L+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+k+"`.")}function G(T){function j(K,L,k,D,Z){var ee=K[L],H=re(ee);if(H!=="object")return new v("Invalid "+D+" `"+Z+"` of type `"+H+"` "+("supplied to `"+k+"`, expected `object`."));for(var te in T){var z=T[te];if(typeof z!="function")return q(k,D,Z,te,Q(z));var ue=z(ee,te,k,D,Z+"."+te,n);if(ue)return ue}return null}return m(j)}function ne(T){function j(K,L,k,D,Z){var ee=K[L],H=re(ee);if(H!=="object")return new v("Invalid "+D+" `"+Z+"` of type `"+H+"` "+("supplied to `"+k+"`, expected `object`."));var te=t({},K[L],T);for(var z in te){var ue=T[z];if(r(T,z)&&typeof ue!="function")return q(k,D,Z,z,Q(ue));if(!ue)return new v("Invalid "+D+" `"+Z+"` key `"+z+"` supplied to `"+k+"`.\nBad object: "+JSON.stringify(K[L],null," ")+`
27
+ Valid keys: `+JSON.stringify(Object.keys(T),null," "));var F=ue(ee,z,k,D,Z+"."+z,n);if(F)return F}return null}return m(j)}function W(T){switch(typeof T){case"number":case"string":case"undefined":return!0;case"boolean":return!T;case"object":if(Array.isArray(T))return T.every(W);if(T===null||a(T))return!0;var j=f(T);if(j){var K=j.call(T),L;if(j!==T.entries){for(;!(L=K.next()).done;)if(!W(L.value))return!1}else for(;!(L=K.next()).done;){var k=L.value;if(k&&!W(k[1]))return!1}}else return!1;return!0;default:return!1}}function ce(T,j){return T==="symbol"?!0:j?j["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&j instanceof Symbol:!1}function re(T){var j=typeof T;return Array.isArray(T)?"array":T instanceof RegExp?"object":ce(j,T)?"symbol":j}function Q(T){if(typeof T>"u"||T===null)return""+T;var j=re(T);if(j==="object"){if(T instanceof Date)return"date";if(T instanceof RegExp)return"regexp"}return j}function fe(T){var j=Q(T);switch(j){case"array":case"object":return"an "+j;case"boolean":case"date":case"regexp":return"a "+j;default:return j}}function ye(T){return!T.constructor||!T.constructor.name?h:T.constructor.name}return p.checkPropTypes=o,p.resetWarningCache=o.resetWarningCache,p.PropTypes=p,p},Ro}var Ao,Ja;function Wg(){if(Ja)return Ao;Ja=1;var e=Ts();function t(){}function n(){}return n.resetWarningCache=t,Ao=function(){function r(s,a,c,u,d,f){if(f!==e){var h=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 h.name="Invariant Violation",h}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},Ao}if(process.env.NODE_ENV!=="production"){var Jg=ql(),zg=!0;os.exports=Bg()(Jg.isElement,zg)}else os.exports=Wg()();var Gg=os.exports;const V=xs(Gg);var ss={exports:{}},xe={};/**
28
28
  * @license React
29
29
  * react-is.production.min.js
30
30
  *
@@ -32,7 +32,7 @@ Valid keys: `+JSON.stringify(Object.keys(N),null," "));var P=ae(Z,J,M,R,Y+"."+J
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 as;function cm(){if(as)return ye;as=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"),m=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),v;v=Symbol.for("react.module.reference");function I(g){if(typeof g=="object"&&g!==null){var C=g.$$typeof;switch(C){case e:switch(g=g.type,g){case n:case i:case r:case u:case d:return g;default:switch(g=g&&g.$$typeof,g){case a:case s:case c:case m:case p:case o:return g;default:return C}}case t:return C}}}return ye.ContextConsumer=s,ye.ContextProvider=o,ye.Element=e,ye.ForwardRef=c,ye.Fragment=n,ye.Lazy=m,ye.Memo=p,ye.Portal=t,ye.Profiler=i,ye.StrictMode=r,ye.Suspense=u,ye.SuspenseList=d,ye.isAsyncMode=function(){return!1},ye.isConcurrentMode=function(){return!1},ye.isContextConsumer=function(g){return I(g)===s},ye.isContextProvider=function(g){return I(g)===o},ye.isElement=function(g){return typeof g=="object"&&g!==null&&g.$$typeof===e},ye.isForwardRef=function(g){return I(g)===c},ye.isFragment=function(g){return I(g)===n},ye.isLazy=function(g){return I(g)===m},ye.isMemo=function(g){return I(g)===p},ye.isPortal=function(g){return I(g)===t},ye.isProfiler=function(g){return I(g)===i},ye.isStrictMode=function(g){return I(g)===r},ye.isSuspense=function(g){return I(g)===u},ye.isSuspenseList=function(g){return I(g)===d},ye.isValidElementType=function(g){return typeof g=="string"||typeof g=="function"||g===n||g===i||g===r||g===u||g===d||g===f||typeof g=="object"&&g!==null&&(g.$$typeof===m||g.$$typeof===p||g.$$typeof===o||g.$$typeof===s||g.$$typeof===c||g.$$typeof===v||g.getModuleId!==void 0)},ye.typeOf=I,ye}var we={};/**
35
+ */var za;function Xg(){if(za)return xe;za=1;var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),i=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"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g;g=Symbol.for("react.module.reference");function v(m){if(typeof m=="object"&&m!==null){var C=m.$$typeof;switch(C){case e:switch(m=m.type,m){case n:case o:case r:case u:case d:return m;default:switch(m=m&&m.$$typeof,m){case a:case s:case c:case h:case f:case i:return m;default:return C}}case t:return C}}}return xe.ContextConsumer=s,xe.ContextProvider=i,xe.Element=e,xe.ForwardRef=c,xe.Fragment=n,xe.Lazy=h,xe.Memo=f,xe.Portal=t,xe.Profiler=o,xe.StrictMode=r,xe.Suspense=u,xe.SuspenseList=d,xe.isAsyncMode=function(){return!1},xe.isConcurrentMode=function(){return!1},xe.isContextConsumer=function(m){return v(m)===s},xe.isContextProvider=function(m){return v(m)===i},xe.isElement=function(m){return typeof m=="object"&&m!==null&&m.$$typeof===e},xe.isForwardRef=function(m){return v(m)===c},xe.isFragment=function(m){return v(m)===n},xe.isLazy=function(m){return v(m)===h},xe.isMemo=function(m){return v(m)===f},xe.isPortal=function(m){return v(m)===t},xe.isProfiler=function(m){return v(m)===o},xe.isStrictMode=function(m){return v(m)===r},xe.isSuspense=function(m){return v(m)===u},xe.isSuspenseList=function(m){return v(m)===d},xe.isValidElementType=function(m){return typeof m=="string"||typeof m=="function"||m===n||m===o||m===r||m===u||m===d||m===p||typeof m=="object"&&m!==null&&(m.$$typeof===h||m.$$typeof===f||m.$$typeof===i||m.$$typeof===s||m.$$typeof===c||m.$$typeof===g||m.getModuleId!==void 0)},xe.typeOf=v,xe}var Ce={};/**
36
36
  * @license React
37
37
  * react-is.development.js
38
38
  *
@@ -40,10 +40,10 @@ Valid keys: `+JSON.stringify(Object.keys(N),null," "));var P=ae(Z,J,M,R,Y+"."+J
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 cs;function lm(){return cs||(cs=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"),m=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),v=!1,I=!1,g=!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===f||v||I||g||typeof K=="object"&&K!==null&&(K.$$typeof===m||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 Ie=K.$$typeof;switch(Ie){case e:var Pe=K.type;switch(Pe){case n:case i:case r:case u:case d:return Pe;default:var Ue=Pe&&Pe.$$typeof;switch(Ue){case a:case s:case c:case m:case p:case o:return Ue;default:return Ie}}case t:return Ie}}}var E=s,k=o,S=e,B=c,q=n,W=m,G=p,ee=t,$=i,ie=r,te=u,X=d,le=!1,pe=!1;function N(K){return le||(le=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function D(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 F(K){return _(K)===o}function M(K){return typeof K=="object"&&K!==null&&K.$$typeof===e}function R(K){return _(K)===c}function Y(K){return _(K)===n}function Z(K){return _(K)===m}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}we.ContextConsumer=E,we.ContextProvider=k,we.Element=S,we.ForwardRef=B,we.Fragment=q,we.Lazy=W,we.Memo=G,we.Portal=ee,we.Profiler=$,we.StrictMode=ie,we.Suspense=te,we.SuspenseList=X,we.isAsyncMode=N,we.isConcurrentMode=D,we.isContextConsumer=L,we.isContextProvider=F,we.isElement=M,we.isForwardRef=R,we.isFragment=Y,we.isLazy=Z,we.isMemo=V,we.isPortal=Q,we.isProfiler=J,we.isStrictMode=ae,we.isSuspense=P,we.isSuspenseList=fe,we.isValidElementType=x,we.typeOf=_}()),we}process.env.NODE_ENV==="production"?Do.exports=cm():Do.exports=lm();var ls=Do.exports;const us=e=>typeof e=="object"&&e!=null&&e.nodeType===1,ds=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",wo=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return ds(n.overflowY,t)||ds(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,um=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},dm=(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(!us(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,f=[];let v=e;for(;us(v)&&p(v);){if(v=um(v),v===m){f.push(v);break}v!=null&&v===document.body&&wo(v)&&!wo(document.documentElement)||v!=null&&wo(v,d)&&f.push(v)}const I=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,g=(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:k,left:S}=e.getBoundingClientRect(),{top:B,right:q,bottom:W,left:G}=(te=>{const X=window.getComputedStyle(te);return{top:parseFloat(X.scrollMarginTop)||0,right:parseFloat(X.scrollMarginRight)||0,bottom:parseFloat(X.scrollMarginBottom)||0,left:parseFloat(X.scrollMarginLeft)||0}})(e);let ee=a==="start"||a==="nearest"?_-B:a==="end"?k+W:_+b/2-B+W,$=c==="center"?S+x/2-G+q:c==="end"?E+q:S-G;const ie=[];for(let te=0;te<f.length;te++){const X=f[te],{height:le,width:pe,top:N,right:D,bottom:L,left:F}=X.getBoundingClientRect();if(s==="if-needed"&&_>=0&&S>=0&&k<=g&&E<=I&&_>=N&&k<=L&&S>=F&&E<=D)return ie;const M=getComputedStyle(X),R=parseInt(M.borderLeftWidth,10),Y=parseInt(M.borderTopWidth,10),Z=parseInt(M.borderRightWidth,10),V=parseInt(M.borderBottomWidth,10);let Q=0,J=0;const ae="offsetWidth"in X?X.offsetWidth-X.clientWidth-R-Z:0,P="offsetHeight"in X?X.offsetHeight-X.clientHeight-Y-V:0,fe="offsetWidth"in X?X.offsetWidth===0?0:pe/X.offsetWidth:0,K="offsetHeight"in X?X.offsetHeight===0?0:le/X.offsetHeight:0;if(m===X)Q=a==="start"?ee:a==="end"?ee-g:a==="nearest"?vr(y,y+g,g,Y,V,y+ee,y+ee+b,b):ee-g/2,J=c==="start"?$:c==="center"?$-I/2:c==="end"?$-I:vr(C,C+I,I,R,Z,C+$,C+$+x,x),Q=Math.max(0,Q+y),J=Math.max(0,J+C);else{Q=a==="start"?ee-N-Y:a==="end"?ee-L+V+P:a==="nearest"?vr(N,L,le,Y,V+P,ee,ee+b,b):ee-(N+le/2)+P/2,J=c==="start"?$-F-R:c==="center"?$-(F+pe/2)+ae/2:c==="end"?$-D+Z+ae:vr(F,D,pe,R,Z+ae,$,$+x,x);const{scrollLeft:Ie,scrollTop:Pe}=X;Q=K===0?0:Math.max(0,Math.min(Pe+Q/K,X.scrollHeight-le/K+P)),J=fe===0?0:Math.max(0,Math.min(Ie+J/fe,X.scrollWidth-pe/fe+ae)),ee+=Pe-Q,$+=Ie-J}ie.push({el:X,top:Q,left:J})}return ie};var Nn=function(){return Nn=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},Nn.apply(this,arguments)};var pm=0;function ps(e){return typeof e=="function"?e:at}function at(){}function Va(e,t){if(e){var n=dm(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 fs(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function ei(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 Ka(){return String(pm++)}function fm(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 ms(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function $a(e){return typeof e.type=="string"}function Ua(e){return e.props}function mm(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var hm=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function yr(e){e===void 0&&(e={});var t={};return hm.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]=Pr(t,r)?t[r]:e[r],n},{})}function Pr(e,t){return e[t]!==void 0}function Mo(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function gm(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=Sn(a,t<0,n,r,i);return c===-1?e>=o?-1:e:c}function Sn(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?Sn(t?o-1:0,t,n,r):-1}function Dr(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(fs(i,e,n)||r&&fs(i,n.document.activeElement,n))})}var ti=at;process.env.NODE_ENV!=="production"&&(ti=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 vm=ei(function(e){Ha(e).textContent=""},500);function Ha(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 Ba(e,t){if(!(!e||!t)){var n=Ha(t);n.textContent=e,vm(t)}}function ym(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var qa=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Wa=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,za=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Xa=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Ga=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Ya=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Za=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Qa=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,ec=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,tc=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,Fo=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,nc=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,rc=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,oc=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,wm=Object.freeze({__proto__:null,blurButton:nc,blurInput:Qa,changeInput:ec,clickButton:Fo,clickItem:Za,controlledPropUpdatedSelectedItem:rc,itemMouseEnter:Ja,keyDownArrowDown:Cr,keyDownArrowUp:xr,keyDownEnd:Ya,keyDownEnter:Xa,keyDownEscape:za,keyDownHome:Ga,keyDownSpaceButton:tc,mouseUp:Wa,touchEnd:oc,unknown:qa}),Im=["refKey","ref"],_m=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],bm=["onKeyDown","onBlur","onChange","onInput","onChangeText"],xm=["refKey","ref"],Cm=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Om=function(){var e=function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+Ka(),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={},k=typeof y=="function";return!k&&y.hasOwnProperty("inputValue")&&o.props.onInputValueChange(y.inputValue,ue({},o.getStateAndHelpers(),y)),o.setState(function(S){var B;S=o.getState(S);var q=k?y(S):y;q=o.props.stateReducer(S,q),x=q.hasOwnProperty("selectedItem");var W={};return x&&q.selectedItem!==S.selectedItem&&(_=q.selectedItem),(B=q).type||(B.type=qa),Object.keys(q).forEach(function(G){S[G]!==q[G]&&(E[G]=q[G]),G!=="type"&&(q[G],Pr(o.props,G)||(W[G]=q[G]))}),k&&q.hasOwnProperty("inputValue")&&o.props.onInputValueChange(q.inputValue,ue({},o.getStateAndHelpers(),q)),W},function(){ps(b)();var S=Object.keys(E).length>1;S&&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,k=E===void 0?"ref":E,S=_.ref,B=Lt(_,Im),q=b===void 0?{}:b,W=q.suppressRefError,G=W===void 0?!1:W;o.getRootProps.called=!0,o.getRootProps.refKey=k,o.getRootProps.suppressRefError=G;var ee=o.getState(),$=ee.isOpen;return ue((x={},x[k]=xn(S,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 k=x.getState(),S=k.highlightedIndex,B=pn(S,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 k=x.getState(),S=k.highlightedIndex,B=pn(S,-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 k=this.items[E],S=this.getItemNodeFromIndex(E);if(k==null||S&&S.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Xa})}}},Escape:function(b){b.preventDefault(),this.reset(ue({type:za},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=ue({},o.keyDownHandlers,{" ":function(b){b.preventDefault(),this.toggleMenu({type:tc})}}),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 k=Sn(0,!1,{length:E},this.isItemDisabled);this.setHighlightedIndex(k,{type:Ga})}}},End:function(b){var x=this.getState(),_=x.isOpen;if(_){b.preventDefault();var E=this.getItemCount();if(!(E<=0||!_)){var k=Sn(E-1,!0,{length:E},this.isItemDisabled);this.setHighlightedIndex(k,{type:Ya})}}}}),o.getToggleButtonProps=function(y){var b=y===void 0?{}:y,x=b.onClick;b.onPress;var _=b.onKeyDown,E=b.onKeyUp,k=b.onBlur,S=Lt(b,_m),B=o.getState(),q=B.isOpen,W={onClick:Le(x,o.buttonHandleClick),onKeyDown:Le(_,o.buttonHandleKeyDown),onKeyUp:Le(E,o.buttonHandleKeyUp),onBlur:Le(k,o.buttonHandleBlur)},G=S.disabled?{}:W;return ue({type:"button",role:"button","aria-label":q?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},G,S)},o.buttonHandleKeyUp=function(y){y.preventDefault()},o.buttonHandleKeyDown=function(y){var b=Mo(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:Fo}):o.internalSetTimeout(function(){return o.toggleMenu({type:Fo})})},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:nc})}})},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,k=b.onInput;b.onChangeText;var S=Lt(b,bm),B,q={};B="onChange";var W=o.getState(),G=W.inputValue,ee=W.isOpen,$=W.highlightedIndex;if(!S.disabled){var ie;q=(ie={},ie[B]=Le(E,k,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":S&&S["aria-label"]?void 0:o.labelId,autoComplete:"off",value:G,id:o.inputId},q,S)},o.inputHandleKeyDown=function(y){var b=Mo(y);b&&o.inputKeyDownHandlers[b]&&o.inputKeyDownHandlers[b].call(o,y)},o.inputHandleChange=function(y){o.internalSetState({type:ec,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:Qa})}})},o.menuRef=function(y){o._menuNode=y},o.getMenuProps=function(y,b){var x,_=y===void 0?{}:y,E=_.refKey,k=E===void 0?"ref":E,S=_.ref,B=Lt(_,xm),q=b===void 0?{}:b,W=q.suppressRefError,G=W===void 0?!1:W;return o.getMenuProps.called=!0,o.getMenuProps.refKey=k,o.getMenuProps.suppressRefError=G,ue((x={},x[k]=xn(S,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,k=x.onClick;x.onPress;var S=x.index,B=x.item,q=B===void 0?process.env.NODE_ENV==="production"?void 0:mm("getItemProps","item"):B,W=Lt(x,Cm);S===void 0?(o.items.push(q),S=o.items.indexOf(q)):o.items[S]=q;var G="onClick",ee=k,$=(b={onMouseMove:Le(_,function(){S!==o.getState().highlightedIndex&&(o.setHighlightedIndex(S,{type:Ja}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:Le(E,function(te){te.preventDefault()})},b[G]=Le(ee,function(){o.selectItemAtIndex(S,{type:Za})}),b),ie=W.disabled?{onMouseDown:$.onMouseDown}:$;return ue({id:o.getItemId(S),role:"option","aria-selected":o.getState().highlightedIndex===S},ie,W)},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),ps(b)()})},o.openMenu=function(y){o.internalSetState({isOpen:!0},y)},o.closeMenu=function(y){o.internalSetState({isOpen:!1},y)},o.updateStatus=ei(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=_,Ba(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,m=p===void 0?d:p,f=s.initialInputValue,v=f===void 0?"":f,I=s.initialSelectedItem,g=I===void 0?null:I,C=o.getState({highlightedIndex:u,isOpen:m,inputValue:v,selectedItem:g});return C.selectedItem!=null&&o.props.initialInputValue===void 0&&(C.inputValue=o.props.itemToString(C.selectedItem)),o.state=C,o}Zf(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=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,m=this.getRootProps,f=this.getToggleButtonProps,v=this.getLabelProps,I=this.getMenuProps,g=this.getInputProps,C=this.getItemProps,y=this.openMenu,b=this.closeMenu,x=this.toggleMenu,_=this.selectItem,E=this.selectItemAtIndex,k=this.selectHighlightedItem,S=this.setHighlightedIndex,B=this.clearSelection,q=this.clearItems,W=this.reset,G=this.setItemCount,ee=this.unsetItemCount,$=this.internalSetState;return{getRootProps:m,getToggleButtonProps:f,getLabelProps:v,getMenuProps:I,getInputProps:g,getItemProps:C,reset:W,openMenu:y,closeMenu:b,toggleMenu:x,selectItem:_,selectItemAtIndex:E,selectHighlightedItem:k,setHighlightedIndex:S,clearSelection:B,clearItems:q,setItemCount:G,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&&hs(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){o.internalClearTimeouts()};else{var s=function(){o.isMouseDown=!0},a=function(f){o.isMouseDown=!1;var v=Dr(f.target,[o._rootNode,o._menuNode],o.props.environment);!v&&o.getState().isOpen&&o.reset({type:Wa},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},c=function(){o.isTouchMove=!1},u=function(){o.isTouchMove=!0},d=function(f){var v=Dr(f.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!v&&o.getState().isOpen&&o.reset({type:oc},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,m=c!==d;return p||m},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(ti(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&hs(this._menuNode,this.getMenuProps)),Pr(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:rc,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=ms(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=ms(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&&Em(s,this.getRootProps),s;if($a(s))return h.cloneElement(s,this.getRootProps(Ua(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:fm,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&gm(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:Va},e.stateChangeTypes=wm,e}();process.env.NODE_ENV!=="production"&&(Om.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 hs(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 Em(e,t){var n=t.refKey,r=n!=="ref",i=!$a(e);i&&!r&&!ls.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+'"'),!ls.isForwardRef(e)&&!Ua(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var ic={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Nm(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){Sm(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 Sm(e,t,n,r){var i=t.props,o=t.type,s="on"+ni(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](ue({type:o},r))}function Tm(e,t){return t.changes}var gs=ei(function(e,t){Ba(e,t)},200),Am=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?h.useLayoutEffect:h.useEffect,Rm="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-"+Ka():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 Pm(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 ni(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function sc(e){var t=h.useRef(e);return t.current=e,t}function Dm(e,t,n,r){var i=h.useRef(),o=h.useRef(),s=h.useCallback(function(f,v){o.current=v,f=Rr(f,v.props);var I=e(f,v),g=v.props.stateReducer(f,ue({},v,{changes:I}));return g},[e]),a=h.useReducer(s,t,n),c=a[0],u=a[1],d=sc(t),p=h.useCallback(function(f){return u(ue({props:d.current},f))},[d]),m=o.current;return h.useEffect(function(){var f=Rr(i.current,m==null?void 0:m.props),v=m&&i.current&&!r(f,c);v&&Nm(m,f,c),i.current=c},[c,m,r]),[c,p]}var Kn={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:Tm,scrollIntoView:Va,environment:typeof window>"u"?void 0:window};function Xt(e,t,n){n===void 0&&(n=ic);var r=e["default"+ni(t)];return r!==void 0?r:n[t]}function $n(e,t,n){n===void 0&&(n=ic);var r=e[t];if(r!==void 0)return r;var i=e["initial"+ni(t)];return i!==void 0?i:Xt(e,t,n)}function Mm(e){var t=$n(e,"selectedItem"),n=$n(e,"isOpen"),r=Vm(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 Un(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 Fm(e,t,n){var r=h.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return h.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,Dr(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&&!Dr(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 ac=function(){return at};process.env.NODE_ENV!=="production"&&(ac=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);gs(s,i)}},n),h.useEffect(function(){return function(){gs.cancel(),ym(i)}},[i])}function km(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 cc=at;process.env.NODE_ENV!=="production"&&(cc=function(t){var n=t.props,r=t.state,i=h.useRef(n),o=Xr();h.useEffect(function(){o||(ti(r,i.current,n),i.current=n)},[r,n,o])});function vs(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 Lm(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 jo(e){var t=Xt(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function Vm(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},lc=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 Km(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:Un(i,e,0)};break;case n.FunctionOpenMenu:o={isOpen:!0,highlightedIndex:Un(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:jo(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)}Nn(Nn({},lc),{items:j.array.isRequired,isItemDisabled:j.func});Nn(Nn({},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 ri=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,oi=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,ii=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,si=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,ai=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,ci=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,li=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,ui=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,di=process.env.NODE_ENV!=="production"?"__input_change__":8,Mr=process.env.NODE_ENV!=="production"?"__input_blur__":9,pi=process.env.NODE_ENV!=="production"?"__input_click__":10,uc=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,dc=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,fi=process.env.NODE_ENV!=="production"?"__item_click__":13,pc=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,fc=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,mc=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,hc=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,gc=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,mi=process.env.NODE_ENV!=="production"?"__function_select_item__":19,vc=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,yc=process.env.NODE_ENV!=="production"?"__function_reset__":21,hi=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,wc=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:hi,FunctionCloseMenu:hc,FunctionOpenMenu:mc,FunctionReset:yc,FunctionSelectItem:mi,FunctionSetHighlightedIndex:gc,FunctionSetInputValue:vc,FunctionToggleMenu:fc,InputBlur:Mr,InputChange:di,InputClick:pi,InputKeyDownArrowDown:ri,InputKeyDownArrowUp:oi,InputKeyDownEnd:ai,InputKeyDownEnter:ui,InputKeyDownEscape:ii,InputKeyDownHome:si,InputKeyDownPageDown:li,InputKeyDownPageUp:ci,ItemClick:fi,ItemMouseMove:dc,MenuMouseLeave:uc,ToggleButtonClick:pc});function $m(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)),ue({},t,{inputValue:r})}var Um=ue({},lc,{items:j.array.isRequired,isItemDisabled:j.func,inputValue:j.string,defaultInputValue:j.string,initialInputValue:j.string,inputId:j.string,onInputValueChange:j.func});function Hm(e,t,n,r){var i=h.useRef(),o=Dm(e,t,n,r),s=o[0],a=o[1],c=Xr();return h.useEffect(function(){if(Pr(t,"selectedItem")){if(!c){var u=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);u&&a({type:hi,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Rr(s,t),a]}var Ic=at;process.env.NODE_ENV!=="production"&&(Ic=function(t,n){j.checkPropTypes(Um,t,"prop",n.name)});var Bm=ue({},Kn,{isItemDisabled:function(){return!1}});function qm(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case fi:s={isOpen:Xt(i,"isOpen"),highlightedIndex:jo(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case ri:e.isOpen?s={highlightedIndex:pn(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:o&&e.selectedItem==null?-1:Un(i,e,1),isOpen:i.items.length>=0};break;case oi:e.isOpen?o?s=vs(i,e.highlightedIndex):s={highlightedIndex:pn(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:Un(i,e,-1),isOpen:i.items.length>=0};break;case ui:s=vs(i,e.highlightedIndex);break;case ii:s=ue({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case ci:s={highlightedIndex:pn(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case li:s={highlightedIndex:pn(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case si:s={highlightedIndex:Sn(0,!1,i.items,i.isItemDisabled)};break;case ai:s={highlightedIndex:Sn(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case Mr: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 di:s={isOpen:!0,highlightedIndex:jo(i),inputValue:t.inputValue};break;case pi:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Un(i,e,0)};break;case mi:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case hi:s={inputValue:t.inputValue};break;default:return Km(e,t,wc)}return ue({},e,s)}var Wm=["onMouseLeave","refKey","ref"],Jm=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],zm=["onClick","onPress","refKey","ref"],Xm=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];gi.stateChangeTypes=wc;function gi(e){e===void 0&&(e={}),Ic(e,gi);var t=ue({},Bm,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=Hm(qm,t,$m,Lm),a=s[0],c=s[1],u=a.isOpen,d=a.highlightedIndex,p=a.selectedItem,m=a.inputValue,f=h.useRef(null),v=h.useRef({}),I=h.useRef(null),g=h.useRef(null),C=Xr(),y=Rm(t),b=h.useRef(),x=sc({state:a,props:t}),_=h.useCallback(function(L){return v.current[y.getItemId(L)]},[y]);jm(o,a,[u,d,p,m],i);var E=km({menuElement:f.current,highlightedIndex:d,isOpen:u,itemRefs:v,scrollIntoView:r,getItemNodeFromIndex:_});cc({props:t,state:a}),h.useEffect(function(){var L=$n(t,"isOpen");L&&I.current&&I.current.focus()},[]),h.useEffect(function(){C||(b.current=n.length)});var k=Fm(i,h.useCallback(function(){x.current.state.isOpen&&c({type:Mr,selectItem:!1})},[c,x]),h.useMemo(function(){return[f,g,I]},[f.current,g.current,I.current])),S=ac("getInputProps","getMenuProps");h.useEffect(function(){u||(v.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 B=h.useMemo(function(){return{ArrowDown:function(F){F.preventDefault(),c({type:ri,altKey:F.altKey})},ArrowUp:function(F){F.preventDefault(),c({type:oi,altKey:F.altKey})},Home:function(F){x.current.state.isOpen&&(F.preventDefault(),c({type:si}))},End:function(F){x.current.state.isOpen&&(F.preventDefault(),c({type:ai}))},Escape:function(F){var M=x.current.state;(M.isOpen||M.inputValue||M.selectedItem||M.highlightedIndex>-1)&&(F.preventDefault(),c({type:ii}))},Enter:function(F){var M=x.current.state;!M.isOpen||F.which===229||(F.preventDefault(),c({type:ui}))},PageUp:function(F){x.current.state.isOpen&&(F.preventDefault(),c({type:ci}))},PageDown:function(F){x.current.state.isOpen&&(F.preventDefault(),c({type:li}))}}},[c,x]),q=h.useCallback(function(L){return ue({id:y.labelId,htmlFor:y.inputId},L)},[y]),W=h.useCallback(function(L,F){var M,R=L===void 0?{}:L,Y=R.onMouseLeave,Z=R.refKey,V=Z===void 0?"ref":Z,Q=R.ref,J=Lt(R,Wm),ae=F===void 0?{}:F,P=ae.suppressRefError,fe=P===void 0?!1:P;return S("getMenuProps",fe,V,f),ue((M={},M[V]=xn(Q,function(K){f.current=K}),M.id=y.menuId,M.role="listbox",M["aria-labelledby"]=J&&J["aria-label"]?void 0:""+y.labelId,M.onMouseLeave=Le(Y,function(){c({type:uc})}),M),J)},[c,S,y]),G=h.useCallback(function(L){var F,M,R=L===void 0?{}:L,Y=R.item,Z=R.index,V=R.refKey,Q=V===void 0?"ref":V,J=R.ref,ae=R.onMouseMove,P=R.onMouseDown,fe=R.onClick;R.onPress;var K=R.disabled,Ie=Lt(R,Jm);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,Ue=Pe.props,Me=Pe.state,he=Pm(Y,Z,Ue.items,"Pass either item or index to getItemProps!"),vt=he[0],He=he[1],ot=Ue.isItemDisabled(vt,He),yt="onClick",wt=fe,Be=function(){k.isTouchEnd||He===Me.highlightedIndex||(E.current=!1,c({type:dc,index:He,disabled:ot}))},Ve=function(){c({type:fi,index:He})},Fe=function(It){return It.preventDefault()};return ue((F={},F[Q]=xn(J,function(Oe){Oe&&(v.current[y.getItemId(He)]=Oe)}),F["aria-disabled"]=ot,F["aria-selected"]=He===Me.highlightedIndex,F.id=y.getItemId(He),F.role="option",F),!ot&&(M={},M[yt]=Le(wt,Ve),M),{onMouseMove:Le(ae,Be),onMouseDown:Le(P,Fe)},Ie)},[c,y,x,k,E]),ee=h.useCallback(function(L){var F,M=L===void 0?{}:L,R=M.onClick;M.onPress;var Y=M.refKey,Z=Y===void 0?"ref":Y,V=M.ref,Q=Lt(M,zm),J=x.current.state,ae=function(){c({type:pc})};return ue((F={},F[Z]=xn(V,function(P){g.current=P}),F["aria-controls"]=y.menuId,F["aria-expanded"]=J.isOpen,F.id=y.toggleButtonId,F.tabIndex=-1,F),!Q.disabled&&ue({},{onClick:Le(R,ae)}),Q)},[c,x,y]),$=h.useCallback(function(L,F){var M,R=L===void 0?{}:L,Y=R.onKeyDown,Z=R.onChange,V=R.onInput,Q=R.onBlur;R.onChangeText;var J=R.onClick,ae=R.refKey,P=ae===void 0?"ref":ae,fe=R.ref,K=Lt(R,Xm),Ie=F===void 0?{}:F,Pe=Ie.suppressRefError,Ue=Pe===void 0?!1:Pe;S("getInputProps",Ue,P,I);var Me=x.current.state,he=function(Fe){var Oe=Mo(Fe);Oe&&B[Oe]&&B[Oe](Fe)},vt=function(Fe){c({type:di,inputValue:Fe.target.value})},He=function(Fe){if(i!=null&&i.document&&Me.isOpen&&!k.isMouseDown){var Oe=Fe.relatedTarget===null&&i.document.activeElement!==i.document.body;c({type:Mr,selectItem:!Oe})}},ot=function(){c({type:pi})},yt="onChange",wt={};if(!K.disabled){var Be;wt=(Be={},Be[yt]=Le(Z,V,vt),Be.onKeyDown=Le(Y,he),Be.onBlur=Le(Q,He),Be.onClick=Le(J,ot),Be)}return ue((M={},M[P]=xn(fe,function(Ve){I.current=Ve}),M["aria-activedescendant"]=Me.isOpen&&Me.highlightedIndex>-1?y.getItemId(Me.highlightedIndex):"",M["aria-autocomplete"]="list",M["aria-controls"]=y.menuId,M["aria-expanded"]=Me.isOpen,M["aria-labelledby"]=K&&K["aria-label"]?void 0:y.labelId,M.autoComplete="off",M.id=y.inputId,M.role="combobox",M.value=Me.inputValue,M),wt,K)},[c,y,i,B,x,k,S]),ie=h.useCallback(function(){c({type:fc})},[c]),te=h.useCallback(function(){c({type:hc})},[c]),X=h.useCallback(function(){c({type:mc})},[c]),le=h.useCallback(function(L){c({type:gc,highlightedIndex:L})},[c]),pe=h.useCallback(function(L){c({type:mi,selectedItem:L})},[c]),N=h.useCallback(function(L){c({type:vc,inputValue:L})},[c]),D=h.useCallback(function(){c({type:yc})},[c]);return{getItemProps:G,getLabelProps:q,getMenuProps:W,getInputProps:$,getToggleButtonProps:ee,toggleMenu:ie,openMenu:X,closeMenu:te,setHighlightedIndex:le,setInputValue:N,selectItem:pe,reset:D,highlightedIndex:d,isOpen:u,selectedItem:p,inputValue:m}}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 Gm="_comboboxContainer_9s7ov_1",Ym="_label_9s7ov_8",Zm="_inputContainer_9s7ov_12",Qm="_input_9s7ov_12",eh="_toggleButton_9s7ov_33",th="_menu_9s7ov_39",nh="_menuItem_9s7ov_54",rh="_highlighted_9s7ov_61",oh="_selected_9s7ov_65",ih="_hidden_9s7ov_69",kt={comboboxContainer:Gm,label:Ym,inputContainer:Zm,input:Qm,toggleButton:eh,menu:th,menuItem:nh,highlighted:rh,selected:oh,hidden:ih};function sh(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function vi({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=_=>{a(e.filter(sh(_)))},{isOpen:d,getToggleButtonProps:p,getMenuProps:m,getInputProps:f,highlightedIndex:v,getItemProps:I,setInputValue:g}=gi({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=()=>{g(""),a(e)},y=()=>C(),b=h.useMemo(()=>{var _;return(_=e.find(E=>E.value===t))==null?void 0:_.label},[e,t]),x=()=>g(b||"");return l.jsxs("div",{style:{position:"relative",...o},children:[l.jsx("div",{className:kt.comboboxContainer,children:l.jsxs("div",{className:kt.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:i,placeholder:b||r,className:kt.input,...f({onFocus:y,onBlur:x,ref:c})}),l.jsx("button",{style:{border:"none"},disabled:i,"aria-label":"toggle menu",className:kt.toggleButton,type:"button",...p(),children:d?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${kt.menu} ${d&&e.length?"":kt.hidden}`,...m(),children:d&&s.map((_,E)=>l.jsx("li",{className:`${kt.menuItem} ${v===E?kt.highlighted:""} ${t===(_==null?void 0:_.value)?kt.selected:""}`,...I({item:_,index:E}),children:l.jsx("span",{children:_.label})},_.id))})]})}const Tn=Math.min,fn=Math.max,Fr=Math.round,wr=Math.floor,Zt=e=>({x:e,y:e}),ah={left:"right",right:"left",bottom:"top",top:"bottom"},ch={start:"end",end:"start"};function ko(e,t,n){return fn(e,Tn(t,n))}function Yn(e,t){return typeof e=="function"?e(t):e}function yn(e){return e.split("-")[0]}function Zn(e){return e.split("-")[1]}function _c(e){return e==="x"?"y":"x"}function yi(e){return e==="y"?"height":"width"}function An(e){return["top","bottom"].includes(yn(e))?"y":"x"}function wi(e){return _c(An(e))}function lh(e,t,n){n===void 0&&(n=!1);const r=Zn(e),i=wi(e),o=yi(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=jr(s)),[s,jr(s)]}function uh(e){const t=jr(e);return[Lo(e),t,Lo(t)]}function Lo(e){return e.replace(/start|end/g,t=>ch[t])}function dh(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 ph(e,t,n,r){const i=Zn(e);let o=dh(yn(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(Lo)))),o}function jr(e){return e.replace(/left|right|bottom|top/g,t=>ah[t])}function fh(e){return{top:0,right:0,bottom:0,left:0,...e}}function bc(e){return typeof e!="number"?fh(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 ys(e,t,n){let{reference:r,floating:i}=e;const o=An(t),s=wi(t),a=yi(s),c=yn(t),u=o==="y",d=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,m=r[a]/2-i[a]/2;let f;switch(c){case"top":f={x:d,y:r.y-i.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:p};break;case"left":f={x:r.x-i.width,y:p};break;default:f={x:r.x,y:r.y}}switch(Zn(t)){case"start":f[s]-=m*(n&&u?-1:1);break;case"end":f[s]+=m*(n&&u?-1:1);break}return f}const mh=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}=ys(u,r,c),m=r,f={},v=0;for(let I=0;I<a.length;I++){const{name:g,fn:C}=a[I],{x:y,y:b,data:x,reset:_}=await C({x:d,y:p,initialPlacement:r,placement:m,strategy:i,middlewareData:f,rects:u,platform:s,elements:{reference:e,floating:t}});d=y??d,p=b??p,f={...f,[g]:{...f[g],...x}},_&&v<=50&&(v++,typeof _=="object"&&(_.placement&&(m=_.placement),_.rects&&(u=_.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):_.rects),{x:d,y:p}=ys(u,m,c)),I=-1)}return{x:d,y:p,placement:m,strategy:i,middlewareData:f}};async function xc(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:m=!1,padding:f=0}=Yn(t,e),v=bc(f),g=a[m?p==="floating"?"reference":"floating":p],C=kr(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(g)))==null||n?g:g.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},_=kr(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 hh=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=bc(d),m={x:n,y:r},f=wi(i),v=yi(f),I=await s.getDimensions(u),g=f==="y",C=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=o.reference[v]+o.reference[f]-m[f]-o.floating[v],_=m[f]-o.reference[f],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let k=E?E[b]:0;(!k||!await(s.isElement==null?void 0:s.isElement(E)))&&(k=a.floating[b]||o.floating[v]);const S=x/2-_/2,B=k/2-I[v]/2-1,q=Tn(p[C],B),W=Tn(p[y],B),G=q,ee=k-I[v]-W,$=k/2-I[v]/2+S,ie=ko(G,$,ee),te=!c.arrow&&Zn(i)!=null&&$!==ie&&o.reference[v]/2-($<G?q:W)-I[v]/2<0,X=te?$<G?$-G:$-ee:0;return{[f]:m[f]+X,data:{[f]:ie,centerOffset:$-ie-X,...te&&{alignmentOffset:X}},reset:te}}}),gh=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:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:I=!0,...g}=Yn(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const C=yn(i),y=An(a),b=yn(a)===a,x=await(c.isRTL==null?void 0:c.isRTL(u.floating)),_=m||(b||!I?[jr(a)]:uh(a)),E=v!=="none";!m&&E&&_.push(...ph(a,I,v,x));const k=[a,..._],S=await xc(t,g),B=[];let q=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&B.push(S[C]),p){const $=lh(i,s,x);B.push(S[$[0]],S[$[1]])}if(q=[...q,{placement:i,overflows:B}],!B.every($=>$<=0)){var W,G;const $=(((W=o.flip)==null?void 0:W.index)||0)+1,ie=k[$];if(ie)return{data:{index:$,overflows:q},reset:{placement:ie}};let te=(G=q.filter(X=>X.overflows[0]<=0).sort((X,le)=>X.overflows[1]-le.overflows[1])[0])==null?void 0:G.placement;if(!te)switch(f){case"bestFit":{var ee;const X=(ee=q.filter(le=>{if(E){const pe=An(le.placement);return pe===y||pe==="y"}return!0}).map(le=>[le.placement,le.overflows.filter(pe=>pe>0).reduce((pe,N)=>pe+N,0)]).sort((le,pe)=>le[1]-pe[1])[0])==null?void 0:ee[0];X&&(te=X);break}case"initialPlacement":te=a;break}if(i!==te)return{reset:{placement:te}}}return{}}}};async function vh(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=yn(n),a=Zn(n),c=An(n)==="y",u=["left","top"].includes(s)?-1:1,d=o&&c?-1:1,p=Yn(t,e);let{mainAxis:m,crossAxis:f,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"&&(f=a==="end"?v*-1:v),c?{x:f*d,y:m*u}:{x:m*u,y:f*d}}const yh=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 vh(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}}}}},wh=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:g=>{let{x:C,y}=g;return{x:C,y}}},...c}=Yn(e,t),u={x:n,y:r},d=await xc(t,c),p=An(yn(i)),m=_c(p);let f=u[m],v=u[p];if(o){const g=m==="y"?"top":"left",C=m==="y"?"bottom":"right",y=f+d[g],b=f-d[C];f=ko(y,f,b)}if(s){const g=p==="y"?"top":"left",C=p==="y"?"bottom":"right",y=v+d[g],b=v-d[C];v=ko(y,v,b)}const I=a.fn({...t,[m]:f,[p]:v});return{...I,data:{x:I.x-n,y:I.y-r,enabled:{[m]:o,[p]:s}}}}}};function Gr(){return typeof window<"u"}function Mn(e){return Cc(e)?(e.nodeName||"").toLowerCase():"#document"}function lt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function At(e){var t;return(t=(Cc(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Cc(e){return Gr()?e instanceof Node||e instanceof lt(e).Node:!1}function Ot(e){return Gr()?e instanceof Element||e instanceof lt(e).Element:!1}function Tt(e){return Gr()?e instanceof HTMLElement||e instanceof lt(e).HTMLElement:!1}function ws(e){return!Gr()||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 Ih(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 Ii(e){const t=_i(),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 _h(e){let t=Qt(e);for(;Tt(t)&&!Rn(t);){if(Ii(t))return t;if(Yr(t))return null;t=Qt(t)}return null}function _i(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Rn(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||ws(e)&&e.host||At(e);return ws(t)?t.host:t}function Oc(e){const t=Qt(e);return Rn(t)?e.ownerDocument?e.ownerDocument.body:e.body:Tt(t)&&Qn(t)?t:Oc(t)}function zn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=Oc(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=lt(i);if(o){const a=Vo(s);return t.concat(s,s.visualViewport||[],Qn(i)?i:[],a&&n?zn(a):[])}return t.concat(i,zn(i,[],n))}function Vo(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ec(e){const t=Et(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=Tt(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 bi(e){return Ot(e)?e:e.contextElement}function Cn(e){const t=bi(e);if(!Tt(t))return Zt(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=Ec(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 bh=Zt(0);function Nc(e){const t=lt(e);return!_i()||!t.visualViewport?bh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function xh(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==lt(e)?!1:t}function wn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=bi(e);let s=Zt(1);t&&(r?Ot(r)&&(s=Cn(r)):s=Cn(e));const a=xh(o,n,r)?Nc(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 m=lt(o),f=r&&Ot(r)?lt(r):r;let v=m,I=Vo(v);for(;I&&r&&f!==v;){const g=Cn(I),C=I.getBoundingClientRect(),y=Et(I),b=C.left+(I.clientLeft+parseFloat(y.paddingLeft))*g.x,x=C.top+(I.clientTop+parseFloat(y.paddingTop))*g.y;c*=g.x,u*=g.y,d*=g.x,p*=g.y,c+=b,u+=x,v=lt(I),I=Vo(v)}}return kr({width:d,height:p,x:c,y:u})}function Ch(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=At(r),a=t?Yr(t.floating):!1;if(r===s||a&&o)return n;let c={scrollLeft:0,scrollTop:0},u=Zt(1);const d=Zt(0),p=Tt(r);if((p||!p&&!o)&&((Mn(r)!=="body"||Qn(s))&&(c=Zr(r)),Tt(r))){const m=wn(r);u=Cn(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 Oh(e){return Array.from(e.getClientRects())}function Ko(e,t){const n=Zr(e).scrollLeft;return t?t.left+n:wn(At(e)).left+n}function Eh(e){const t=At(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+Ko(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 Nh(e,t){const n=lt(e),r=At(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=_i();(!u||u&&t==="fixed")&&(a=i.offsetLeft,c=i.offsetTop)}return{width:o,height:s,x:a,y:c}}function Sh(e,t){const n=wn(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=Tt(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 Is(e,t,n){let r;if(t==="viewport")r=Nh(e,n);else if(t==="document")r=Eh(At(e));else if(Ot(t))r=Sh(t,n);else{const i=Nc(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return kr(r)}function Sc(e,t){const n=Qt(e);return n===t||!Ot(n)||Rn(n)?!1:Et(n).position==="fixed"||Sc(n,t)}function Th(e,t){const n=t.get(e);if(n)return n;let r=zn(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)&&!Rn(s);){const a=Et(s),c=Ii(s);!c&&a.position==="fixed"&&(i=null),(o?!c&&!i:!c&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Qn(s)&&!c&&Sc(e,s))?r=r.filter(d=>d!==s):i=a,s=Qt(s)}return t.set(e,r),r}function Ah(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Yr(t)?[]:Th(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((u,d)=>{const p=Is(t,d,i);return u.top=fn(p.top,u.top),u.right=Tn(p.right,u.right),u.bottom=Tn(p.bottom,u.bottom),u.left=fn(p.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 Rh(e){const{width:t,height:n}=Ec(e);return{width:t,height:n}}function Ph(e,t,n){const r=Tt(t),i=At(t),o=n==="fixed",s=wn(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 f=wn(t,!0,o,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else i&&(c.x=Ko(i));let u=0,d=0;if(i&&!r&&!o){const f=i.getBoundingClientRect();d=f.top+a.scrollTop,u=f.left+a.scrollLeft-Ko(i,f)}const p=s.left+a.scrollLeft-c.x-u,m=s.top+a.scrollTop-c.y-d;return{x:p,y:m,width:s.width,height:s.height}}function Io(e){return Et(e).position==="static"}function _s(e,t){if(!Tt(e)||Et(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return At(e)===n&&(n=n.ownerDocument.body),n}function Tc(e,t){const n=lt(e);if(Yr(e))return n;if(!Tt(e)){let i=Qt(e);for(;i&&!Rn(i);){if(Ot(i)&&!Io(i))return i;i=Qt(i)}return n}let r=_s(e,t);for(;r&&Ih(r)&&Io(r);)r=_s(r,t);return r&&Rn(r)&&Io(r)&&!Ii(r)?n:r||_h(e)||n}const Dh=async function(e){const t=this.getOffsetParent||Tc,n=this.getDimensions,r=await n(e.floating);return{reference:Ph(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Mh(e){return Et(e).direction==="rtl"}const Fh={convertOffsetParentRelativeRectToViewportRelativeRect:Ch,getDocumentElement:At,getClippingRect:Ah,getOffsetParent:Tc,getElementRects:Dh,getClientRects:Oh,getDimensions:Rh,getScale:Cn,isElement:Ot,isRTL:Mh};function jh(e,t){let n=null,r;const i=At(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:m}=e.getBoundingClientRect();if(a||t(),!p||!m)return;const f=wr(d),v=wr(i.clientWidth-(u+p)),I=wr(i.clientHeight-(d+m)),g=wr(u),y={rootMargin:-f+"px "+-v+"px "+-I+"px "+-g+"px",threshold:fn(0,Tn(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 kh(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=bi(e),d=i||o?[...u?zn(u):[],...zn(t)]:[];d.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),o&&C.addEventListener("resize",n)});const p=u&&a?jh(u,n):null;let m=-1,f=null;s&&(f=new ResizeObserver(C=>{let[y]=C;y&&y.target===u&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var b;(b=f)==null||b.observe(t)})),n()}),u&&!c&&f.observe(u),f.observe(t));let v,I=c?wn(e):null;c&&g();function g(){const C=wn(e);I&&(C.x!==I.x||C.y!==I.y||C.width!==I.width||C.height!==I.height)&&n(),I=C,v=requestAnimationFrame(g)}return n(),()=>{var C;d.forEach(y=>{i&&y.removeEventListener("scroll",n),o&&y.removeEventListener("resize",n)}),p==null||p(),(C=f)==null||C.disconnect(),f=null,c&&cancelAnimationFrame(v)}}const Lh=yh,Vh=wh,Kh=gh,$h=hh,bs=(e,t,n)=>{const r=new Map,i={platform:Fh,...n},o={...i.platform,_c:r};return mh(e,t,{...i,platform:o})};/*
43
+ */var Ga;function Qg(){return Ga||(Ga=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"),o=Symbol.for("react.profiler"),i=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"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),g=!1,v=!1,m=!1,C=!1,y=!1,_;_=Symbol.for("react.module.reference");function x(B){return!!(typeof B=="string"||typeof B=="function"||B===n||B===o||y||B===r||B===u||B===d||C||B===p||g||v||m||typeof B=="object"&&B!==null&&(B.$$typeof===h||B.$$typeof===f||B.$$typeof===i||B.$$typeof===s||B.$$typeof===c||B.$$typeof===_||B.getModuleId!==void 0))}function b(B){if(typeof B=="object"&&B!==null){var Ee=B.$$typeof;switch(Ee){case e:var Ve=B.type;switch(Ve){case n:case o:case r:case u:case d:return Ve;default:var Ge=Ve&&Ve.$$typeof;switch(Ge){case a:case s:case c:case h:case f:case i:return Ge;default:return Ee}}case t:return Ee}}}var S=s,R=i,N=e,M=c,U=n,q=h,G=f,ne=t,W=o,ce=r,re=u,Q=d,fe=!1,ye=!1;function T(B){return fe||(fe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function j(B){return ye||(ye=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function K(B){return b(B)===s}function L(B){return b(B)===i}function k(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function D(B){return b(B)===c}function Z(B){return b(B)===n}function ee(B){return b(B)===h}function H(B){return b(B)===f}function te(B){return b(B)===t}function z(B){return b(B)===o}function ue(B){return b(B)===r}function F(B){return b(B)===u}function ve(B){return b(B)===d}Ce.ContextConsumer=S,Ce.ContextProvider=R,Ce.Element=N,Ce.ForwardRef=M,Ce.Fragment=U,Ce.Lazy=q,Ce.Memo=G,Ce.Portal=ne,Ce.Profiler=W,Ce.StrictMode=ce,Ce.Suspense=re,Ce.SuspenseList=Q,Ce.isAsyncMode=T,Ce.isConcurrentMode=j,Ce.isContextConsumer=K,Ce.isContextProvider=L,Ce.isElement=k,Ce.isForwardRef=D,Ce.isFragment=Z,Ce.isLazy=ee,Ce.isMemo=H,Ce.isPortal=te,Ce.isProfiler=z,Ce.isStrictMode=ue,Ce.isSuspense=F,Ce.isSuspenseList=ve,Ce.isValidElementType=x,Ce.typeOf=b}()),Ce}process.env.NODE_ENV==="production"?ss.exports=Xg():ss.exports=Qg();var Xa=ss.exports;const Qa=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Ya=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",Po=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Ya(n.overflowY,t)||Ya(n.overflowX,t)||(r=>{const o=(i=>{if(!i.ownerDocument||!i.ownerDocument.defaultView)return null;try{return i.ownerDocument.defaultView.frameElement}catch{return null}})(r);return!!o&&(o.clientHeight<r.scrollHeight||o.clientWidth<r.scrollWidth)})(e)}return!1},Ei=(e,t,n,r,o,i,s,a)=>i<e&&s>t||i>e&&s<t?0:i<=e&&a<=n||s>=t&&a>=n?i-e-r:s>t&&a<n||i<e&&a>n?s-t+o:0,Yg=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Zg=(e,t)=>{var n,r,o,i;if(typeof document>"u")return[];const{scrollMode:s,block:a,inline:c,boundary:u,skipOverflowHiddenElements:d}=t,f=typeof u=="function"?u:re=>re!==u;if(!Qa(e))throw new TypeError("Invalid target");const h=document.scrollingElement||document.documentElement,p=[];let g=e;for(;Qa(g)&&f(g);){if(g=Yg(g),g===h){p.push(g);break}g!=null&&g===document.body&&Po(g)&&!Po(document.documentElement)||g!=null&&Po(g,d)&&p.push(g)}const v=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,m=(i=(o=window.visualViewport)==null?void 0:o.height)!=null?i:innerHeight,{scrollX:C,scrollY:y}=window,{height:_,width:x,top:b,right:S,bottom:R,left:N}=e.getBoundingClientRect(),{top:M,right:U,bottom:q,left:G}=(re=>{const Q=window.getComputedStyle(re);return{top:parseFloat(Q.scrollMarginTop)||0,right:parseFloat(Q.scrollMarginRight)||0,bottom:parseFloat(Q.scrollMarginBottom)||0,left:parseFloat(Q.scrollMarginLeft)||0}})(e);let ne=a==="start"||a==="nearest"?b-M:a==="end"?R+q:b+_/2-M+q,W=c==="center"?N+x/2-G+U:c==="end"?S+U:N-G;const ce=[];for(let re=0;re<p.length;re++){const Q=p[re],{height:fe,width:ye,top:T,right:j,bottom:K,left:L}=Q.getBoundingClientRect();if(s==="if-needed"&&b>=0&&N>=0&&R<=m&&S<=v&&b>=T&&R<=K&&N>=L&&S<=j)return ce;const k=getComputedStyle(Q),D=parseInt(k.borderLeftWidth,10),Z=parseInt(k.borderTopWidth,10),ee=parseInt(k.borderRightWidth,10),H=parseInt(k.borderBottomWidth,10);let te=0,z=0;const ue="offsetWidth"in Q?Q.offsetWidth-Q.clientWidth-D-ee:0,F="offsetHeight"in Q?Q.offsetHeight-Q.clientHeight-Z-H:0,ve="offsetWidth"in Q?Q.offsetWidth===0?0:ye/Q.offsetWidth:0,B="offsetHeight"in Q?Q.offsetHeight===0?0:fe/Q.offsetHeight:0;if(h===Q)te=a==="start"?ne:a==="end"?ne-m:a==="nearest"?Ei(y,y+m,m,Z,H,y+ne,y+ne+_,_):ne-m/2,z=c==="start"?W:c==="center"?W-v/2:c==="end"?W-v:Ei(C,C+v,v,D,ee,C+W,C+W+x,x),te=Math.max(0,te+y),z=Math.max(0,z+C);else{te=a==="start"?ne-T-Z:a==="end"?ne-K+H+F:a==="nearest"?Ei(T,K,fe,Z,H+F,ne,ne+_,_):ne-(T+fe/2)+F/2,z=c==="start"?W-L-D:c==="center"?W-(L+ye/2)+ue/2:c==="end"?W-j+ee+ue:Ei(L,j,ye,D,ee+ue,W,W+x,x);const{scrollLeft:Ee,scrollTop:Ve}=Q;te=B===0?0:Math.max(0,Math.min(Ve+te/B,Q.scrollHeight-fe/B+F)),z=ve===0?0:Math.max(0,Math.min(Ee+z/ve,Q.scrollWidth-ye/ve+ue)),ne+=Ve-te,W+=Ee-z}ce.push({el:Q,top:te,left:z})}return ce};var Er=function(){return Er=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},Er.apply(this,arguments)};var ey=0;function Za(e){return typeof e=="function"?e:wt}function wt(){}function Bl(e,t){if(e){var n=Zg(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(r){var o=r.el,i=r.top,s=r.left;o.scrollTop=i,o.scrollLeft=s})}}function ec(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Rs(e,t){var n;function r(){n&&clearTimeout(n)}function o(){for(var i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return o.cancel=r,o}function Be(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,i=new Array(o>1?o-1:0),s=1;s<o;s++)i[s-1]=arguments[s];return t.some(function(a){return a&&a.apply(void 0,[r].concat(i)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function cr(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){t.forEach(function(o){typeof o=="function"?o(r):o&&(o.current=r)})}}function Wl(){return String(ey++)}function ty(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 tc(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function Jl(e){return typeof e.type=="string"}function zl(e){return e.props}function ny(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var ry=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Si(e){e===void 0&&(e={});var t={};return ry.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function Ui(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=qi(t,r)?t[r]:e[r],n},{})}function qi(e,t){return e[t]!==void 0}function as(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function iy(e){return Object.prototype.toString.call(e)==="[object Object]"}function qn(e,t,n,r,o){var i=n.length;if(i===0)return-1;var s=i-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=Sr(a,t<0,n,r,o);return c===-1?e>=i?-1:e:c}function Sr(e,t,n,r,o){o===void 0&&(o=!1);var i=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var a=e;a<i;a++)if(!r(n[a],a))return a;return o?Sr(t?i-1:0,t,n,r):-1}function Hi(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(o){return o&&(ec(o,e,n)||r&&ec(o,n.document.activeElement,n))})}var As=wt;process.env.NODE_ENV!=="production"&&(As=function(t,n,r){var o="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(i){n[i]!==void 0&&r[i]===void 0?console.error('downshift: A component has changed the controlled prop "'+i+'" to be uncontrolled. '+o):n[i]===void 0&&r[i]!==void 0&&console.error('downshift: A component has changed the uncontrolled prop "'+i+'" to be controlled. '+o)})});var oy=Rs(function(e){Gl(e).textContent=""},500);function Gl(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 Xl(e,t){if(!(!e||!t)){var n=Gl(t);n.textContent=e,oy(t)}}function sy(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Ql=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,Yl=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Zl=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Pi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Di=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,eu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,tu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,nu=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,ru=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,iu=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,ou=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,su=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,au=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,cs=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,cu=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,lu=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,uu=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,ay=Object.freeze({__proto__:null,blurButton:cu,blurInput:ou,changeInput:su,clickButton:cs,clickItem:iu,controlledPropUpdatedSelectedItem:lu,itemMouseEnter:Zl,keyDownArrowDown:Di,keyDownArrowUp:Pi,keyDownEnd:ru,keyDownEnter:tu,keyDownEscape:eu,keyDownHome:nu,keyDownSpaceButton:au,mouseUp:Yl,touchEnd:uu,unknown:Ql}),cy=["refKey","ref"],ly=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],uy=["onKeyDown","onBlur","onChange","onInput","onChangeText"],dy=["refKey","ref"],fy=["onMouseMove","onMouseDown","onClick","onPress","index","item"],py=function(){var e=function(t){function n(o){var i;i=t.call(this,o)||this,i.id=i.props.id||"downshift-"+Wl(),i.menuId=i.props.menuId||i.id+"-menu",i.labelId=i.props.labelId||i.id+"-label",i.inputId=i.props.inputId||i.id+"-input",i.getItemId=i.props.getItemId||function(y){return i.id+"-item-"+y},i.items=[],i.itemCount=null,i.previousResultCount=0,i.timeoutIds=[],i.internalSetTimeout=function(y,_){var x=setTimeout(function(){i.timeoutIds=i.timeoutIds.filter(function(b){return b!==x}),y()},_);i.timeoutIds.push(x)},i.setItemCount=function(y){i.itemCount=y},i.unsetItemCount=function(){i.itemCount=null},i.isItemDisabled=function(y,_){var x=i.getItemNodeFromIndex(_);return x&&x.hasAttribute("disabled")},i.setHighlightedIndex=function(y,_){y===void 0&&(y=i.props.defaultHighlightedIndex),_===void 0&&(_={}),_=Si(_),i.internalSetState(pe({highlightedIndex:y},_))},i.clearSelection=function(y){i.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:i.props.defaultHighlightedIndex,isOpen:i.props.defaultIsOpen},y)},i.selectItem=function(y,_,x){_=Si(_),i.internalSetState(pe({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,selectedItem:y,inputValue:i.props.itemToString(y)},_),x)},i.selectItemAtIndex=function(y,_,x){var b=i.items[y];b!=null&&i.selectItem(b,_,x)},i.selectHighlightedItem=function(y,_){return i.selectItemAtIndex(i.getState().highlightedIndex,y,_)},i.internalSetState=function(y,_){var x,b,S={},R=typeof y=="function";return!R&&y.hasOwnProperty("inputValue")&&i.props.onInputValueChange(y.inputValue,pe({},i.getStateAndHelpers(),y)),i.setState(function(N){var M;N=i.getState(N);var U=R?y(N):y;U=i.props.stateReducer(N,U),x=U.hasOwnProperty("selectedItem");var q={};return x&&U.selectedItem!==N.selectedItem&&(b=U.selectedItem),(M=U).type||(M.type=Ql),Object.keys(U).forEach(function(G){N[G]!==U[G]&&(S[G]=U[G]),G!=="type"&&(U[G],qi(i.props,G)||(q[G]=U[G]))}),R&&U.hasOwnProperty("inputValue")&&i.props.onInputValueChange(U.inputValue,pe({},i.getStateAndHelpers(),U)),q},function(){Za(_)();var N=Object.keys(S).length>1;N&&i.props.onStateChange(S,i.getStateAndHelpers()),x&&i.props.onSelect(y.selectedItem,i.getStateAndHelpers()),b!==void 0&&i.props.onChange(b,i.getStateAndHelpers()),i.props.onUserAction(S,i.getStateAndHelpers())})},i.rootRef=function(y){return i._rootNode=y},i.getRootProps=function(y,_){var x,b=y===void 0?{}:y,S=b.refKey,R=S===void 0?"ref":S,N=b.ref,M=cn(b,cy),U=_===void 0?{}:_,q=U.suppressRefError,G=q===void 0?!1:q;i.getRootProps.called=!0,i.getRootProps.refKey=R,i.getRootProps.suppressRefError=G;var ne=i.getState(),W=ne.isOpen;return pe((x={},x[R]=cr(N,i.rootRef),x.role="combobox",x["aria-expanded"]=W,x["aria-haspopup"]="listbox",x["aria-owns"]=W?i.menuId:void 0,x["aria-labelledby"]=i.labelId,x),M)},i.keyDownHandlers={ArrowDown:function(_){var x=this;if(_.preventDefault(),this.getState().isOpen){var b=_.shiftKey?5:1;this.moveHighlightedIndex(b,{type:Di})}else this.internalSetState({isOpen:!0,type:Di},function(){var S=x.getItemCount();if(S>0){var R=x.getState(),N=R.highlightedIndex,M=qn(N,1,{length:S},x.isItemDisabled,!0);x.setHighlightedIndex(M,{type:Di})}})},ArrowUp:function(_){var x=this;if(_.preventDefault(),this.getState().isOpen){var b=_.shiftKey?-5:-1;this.moveHighlightedIndex(b,{type:Pi})}else this.internalSetState({isOpen:!0,type:Pi},function(){var S=x.getItemCount();if(S>0){var R=x.getState(),N=R.highlightedIndex,M=qn(N,-1,{length:S},x.isItemDisabled,!0);x.setHighlightedIndex(M,{type:Pi})}})},Enter:function(_){if(_.which!==229){var x=this.getState(),b=x.isOpen,S=x.highlightedIndex;if(b&&S!=null){_.preventDefault();var R=this.items[S],N=this.getItemNodeFromIndex(S);if(R==null||N&&N.hasAttribute("disabled"))return;this.selectHighlightedItem({type:tu})}}},Escape:function(_){_.preventDefault(),this.reset(pe({type:eu},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},i.buttonKeyDownHandlers=pe({},i.keyDownHandlers,{" ":function(_){_.preventDefault(),this.toggleMenu({type:au})}}),i.inputKeyDownHandlers=pe({},i.keyDownHandlers,{Home:function(_){var x=this.getState(),b=x.isOpen;if(b){_.preventDefault();var S=this.getItemCount();if(!(S<=0||!b)){var R=Sr(0,!1,{length:S},this.isItemDisabled);this.setHighlightedIndex(R,{type:nu})}}},End:function(_){var x=this.getState(),b=x.isOpen;if(b){_.preventDefault();var S=this.getItemCount();if(!(S<=0||!b)){var R=Sr(S-1,!0,{length:S},this.isItemDisabled);this.setHighlightedIndex(R,{type:ru})}}}}),i.getToggleButtonProps=function(y){var _=y===void 0?{}:y,x=_.onClick;_.onPress;var b=_.onKeyDown,S=_.onKeyUp,R=_.onBlur,N=cn(_,ly),M=i.getState(),U=M.isOpen,q={onClick:Be(x,i.buttonHandleClick),onKeyDown:Be(b,i.buttonHandleKeyDown),onKeyUp:Be(S,i.buttonHandleKeyUp),onBlur:Be(R,i.buttonHandleBlur)},G=N.disabled?{}:q;return pe({type:"button",role:"button","aria-label":U?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},G,N)},i.buttonHandleKeyUp=function(y){y.preventDefault()},i.buttonHandleKeyDown=function(y){var _=as(y);i.buttonKeyDownHandlers[_]&&i.buttonKeyDownHandlers[_].call(i,y)},i.buttonHandleClick=function(y){if(y.preventDefault(),i.props.environment){var _=i.props.environment.document,x=_.body,b=_.activeElement;x&&x===b&&y.target.focus()}process.env.NODE_ENV==="test"?i.toggleMenu({type:cs}):i.internalSetTimeout(function(){return i.toggleMenu({type:cs})})},i.buttonHandleBlur=function(y){var _=y.target;i.internalSetTimeout(function(){if(!(i.isMouseDown||!i.props.environment)){var x=i.props.environment.document.activeElement;(x==null||x.id!==i.inputId)&&x!==_&&i.reset({type:cu})}})},i.getLabelProps=function(y){return pe({htmlFor:i.inputId,id:i.labelId},y)},i.getInputProps=function(y){var _=y===void 0?{}:y,x=_.onKeyDown,b=_.onBlur,S=_.onChange,R=_.onInput;_.onChangeText;var N=cn(_,uy),M,U={};M="onChange";var q=i.getState(),G=q.inputValue,ne=q.isOpen,W=q.highlightedIndex;if(!N.disabled){var ce;U=(ce={},ce[M]=Be(S,R,i.inputHandleChange),ce.onKeyDown=Be(x,i.inputHandleKeyDown),ce.onBlur=Be(b,i.inputHandleBlur),ce)}return pe({"aria-autocomplete":"list","aria-activedescendant":ne&&typeof W=="number"&&W>=0?i.getItemId(W):void 0,"aria-controls":ne?i.menuId:void 0,"aria-labelledby":N&&N["aria-label"]?void 0:i.labelId,autoComplete:"off",value:G,id:i.inputId},U,N)},i.inputHandleKeyDown=function(y){var _=as(y);_&&i.inputKeyDownHandlers[_]&&i.inputKeyDownHandlers[_].call(i,y)},i.inputHandleChange=function(y){i.internalSetState({type:su,isOpen:!0,inputValue:y.target.value,highlightedIndex:i.props.defaultHighlightedIndex})},i.inputHandleBlur=function(){i.internalSetTimeout(function(){var y;if(!(i.isMouseDown||!i.props.environment)){var _=i.props.environment.document.activeElement,x=(_==null||(y=_.dataset)==null?void 0:y.toggle)&&i._rootNode&&i._rootNode.contains(_);x||i.reset({type:ou})}})},i.menuRef=function(y){i._menuNode=y},i.getMenuProps=function(y,_){var x,b=y===void 0?{}:y,S=b.refKey,R=S===void 0?"ref":S,N=b.ref,M=cn(b,dy),U=_===void 0?{}:_,q=U.suppressRefError,G=q===void 0?!1:q;return i.getMenuProps.called=!0,i.getMenuProps.refKey=R,i.getMenuProps.suppressRefError=G,pe((x={},x[R]=cr(N,i.menuRef),x.role="listbox",x["aria-labelledby"]=M&&M["aria-label"]?void 0:i.labelId,x.id=i.menuId,x),M)},i.getItemProps=function(y){var _,x=y===void 0?{}:y,b=x.onMouseMove,S=x.onMouseDown,R=x.onClick;x.onPress;var N=x.index,M=x.item,U=M===void 0?process.env.NODE_ENV==="production"?void 0:ny("getItemProps","item"):M,q=cn(x,fy);N===void 0?(i.items.push(U),N=i.items.indexOf(U)):i.items[N]=U;var G="onClick",ne=R,W=(_={onMouseMove:Be(b,function(){N!==i.getState().highlightedIndex&&(i.setHighlightedIndex(N,{type:Zl}),i.avoidScrolling=!0,i.internalSetTimeout(function(){return i.avoidScrolling=!1},250))}),onMouseDown:Be(S,function(re){re.preventDefault()})},_[G]=Be(ne,function(){i.selectItemAtIndex(N,{type:iu})}),_),ce=q.disabled?{onMouseDown:W.onMouseDown}:W;return pe({id:i.getItemId(N),role:"option","aria-selected":i.getState().highlightedIndex===N},ce,q)},i.clearItems=function(){i.items=[]},i.reset=function(y,_){y===void 0&&(y={}),y=Si(y),i.internalSetState(function(x){var b=x.selectedItem;return pe({isOpen:i.props.defaultIsOpen,highlightedIndex:i.props.defaultHighlightedIndex,inputValue:i.props.itemToString(b)},y)},_)},i.toggleMenu=function(y,_){y===void 0&&(y={}),y=Si(y),i.internalSetState(function(x){var b=x.isOpen;return pe({isOpen:!b},b&&{highlightedIndex:i.props.defaultHighlightedIndex},y)},function(){var x=i.getState(),b=x.isOpen,S=x.highlightedIndex;b&&i.getItemCount()>0&&typeof S=="number"&&i.setHighlightedIndex(S,y),Za(_)()})},i.openMenu=function(y){i.internalSetState({isOpen:!0},y)},i.closeMenu=function(y){i.internalSetState({isOpen:!1},y)},i.updateStatus=Rs(function(){var y;if((y=i.props)!=null&&(y=y.environment)!=null&&y.document){var _=i.getState(),x=i.items[_.highlightedIndex],b=i.getItemCount(),S=i.props.getA11yStatusMessage(pe({itemToString:i.props.itemToString,previousResultCount:i.previousResultCount,resultCount:b,highlightedItem:x},_));i.previousResultCount=b,Xl(S,i.props.environment.document)}},200);var s=i.props,a=s.defaultHighlightedIndex,c=s.initialHighlightedIndex,u=c===void 0?a:c,d=s.defaultIsOpen,f=s.initialIsOpen,h=f===void 0?d:f,p=s.initialInputValue,g=p===void 0?"":p,v=s.initialSelectedItem,m=v===void 0?null:v,C=i.getState({highlightedIndex:u,isOpen:h,inputValue:g,selectedItem:m});return C.selectedItem!=null&&i.props.initialInputValue===void 0&&(C.inputValue=i.props.itemToString(C.selectedItem)),i.state=C,i}Kg(n,t);var r=n.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach(function(i){clearTimeout(i)}),this.timeoutIds=[]},r.getState=function(i){return i===void 0&&(i=this.state),Ui(i,this.props)},r.getItemCount=function(){var i=this.items.length;return this.itemCount!=null?i=this.itemCount:this.props.itemCount!==void 0&&(i=this.props.itemCount),i},r.getItemNodeFromIndex=function(i){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(i)):null},r.scrollHighlightedItemIntoView=function(){{var i=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(i,this._menuNode)}},r.moveHighlightedIndex=function(i,s){var a=this.getItemCount(),c=this.getState(),u=c.highlightedIndex;if(a>0){var d=qn(u,i,{length:a},this.isItemDisabled,!0);this.setHighlightedIndex(d,s)}},r.getStateAndHelpers=function(){var i=this.getState(),s=i.highlightedIndex,a=i.inputValue,c=i.selectedItem,u=i.isOpen,d=this.props.itemToString,f=this.id,h=this.getRootProps,p=this.getToggleButtonProps,g=this.getLabelProps,v=this.getMenuProps,m=this.getInputProps,C=this.getItemProps,y=this.openMenu,_=this.closeMenu,x=this.toggleMenu,b=this.selectItem,S=this.selectItemAtIndex,R=this.selectHighlightedItem,N=this.setHighlightedIndex,M=this.clearSelection,U=this.clearItems,q=this.reset,G=this.setItemCount,ne=this.unsetItemCount,W=this.internalSetState;return{getRootProps:h,getToggleButtonProps:p,getLabelProps:g,getMenuProps:v,getInputProps:m,getItemProps:C,reset:q,openMenu:y,closeMenu:_,toggleMenu:x,selectItem:b,selectItemAtIndex:S,selectHighlightedItem:R,setHighlightedIndex:N,clearSelection:M,clearItems:U,setItemCount:G,unsetItemCount:ne,setState:W,itemToString:d,id:f,highlightedIndex:s,inputValue:a,isOpen:u,selectedItem:c}},r.componentDidMount=function(){var i=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&nc(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){i.internalClearTimeouts()};else{var s=function(){i.isMouseDown=!0},a=function(p){i.isMouseDown=!1;var g=Hi(p.target,[i._rootNode,i._menuNode],i.props.environment);!g&&i.getState().isOpen&&i.reset({type:Yl},function(){return i.props.onOuterClick(i.getStateAndHelpers())})},c=function(){i.isTouchMove=!1},u=function(){i.isTouchMove=!0},d=function(p){var g=Hi(p.target,[i._rootNode,i._menuNode],i.props.environment,!1);!i.isTouchMove&&!g&&i.getState().isOpen&&i.reset({type:uu},function(){return i.props.onOuterClick(i.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(){i.internalClearTimeouts(),i.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(i,s){var a=this.props.highlightedIndex===void 0?this.getState():this.props,c=a.highlightedIndex,u=s.highlightedIndex===void 0?i:s,d=u.highlightedIndex,f=c&&this.getState().isOpen&&!i.isOpen,h=c!==d;return f||h},r.componentDidUpdate=function(i,s){process.env.NODE_ENV!=="production"&&(As(this.state,i,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&nc(this._menuNode,this.getMenuProps)),qi(this.props,"selectedItem")&&this.props.selectedItemChanged(i.selectedItem,this.props.selectedItem)&&this.internalSetState({type:lu,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,i)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var i=tc(this.props.children,wt);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=tc(i(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&&hy(s,this.getRootProps),s;if(Jl(s))return w.cloneElement(s,this.getRootProps(zl(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}(w.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:ty,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&iy(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:wt,onInputValueChange:wt,onUserAction:wt,onChange:wt,onSelect:wt,onOuterClick:wt,selectedItemChanged:function(n,r){return n!==r},environment:typeof window>"u"?void 0:window,stateReducer:function(n,r){return r},suppressRefError:!1,scrollIntoView:Bl},e.stateChangeTypes=ay,e}();process.env.NODE_ENV!=="production"&&(py.propTypes={children:V.func,defaultHighlightedIndex:V.number,defaultIsOpen:V.bool,initialHighlightedIndex:V.number,initialSelectedItem:V.any,initialInputValue:V.string,initialIsOpen:V.bool,getA11yStatusMessage:V.func,itemToString:V.func,onChange:V.func,onSelect:V.func,onStateChange:V.func,onInputValueChange:V.func,onUserAction:V.func,onOuterClick:V.func,selectedItemChanged:V.func,stateReducer:V.func,itemCount:V.number,id:V.string,environment:V.shape({addEventListener:V.func.isRequired,removeEventListener:V.func.isRequired,document:V.shape({createElement:V.func.isRequired,getElementById:V.func.isRequired,activeElement:V.any.isRequired,body:V.any.isRequired}).isRequired,Node:V.func.isRequired}),suppressRefError:V.bool,scrollIntoView:V.func,selectedItem:V.any,isOpen:V.bool,inputValue:V.string,highlightedIndex:V.number,labelId:V.string,inputId:V.string,menuId:V.string,getItemId:V.func});function nc(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 hy(e,t){var n=t.refKey,r=n!=="ref",o=!Jl(e);o&&!r&&!Xa.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!o&&r&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!Xa.isForwardRef(e)&&!zl(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var du={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function my(e,t,n){var r=e.props,o=e.type,i={};Object.keys(t).forEach(function(s){gy(s,e,t,n),n[s]!==t[s]&&(i[s]=n[s])}),r.onStateChange&&Object.keys(i).length&&r.onStateChange(pe({type:o},i))}function gy(e,t,n,r){var o=t.props,i=t.type,s="on"+Ps(e)+"Change";o[s]&&r[e]!==void 0&&r[e]!==n[e]&&o[s](pe({type:i},r))}function yy(e,t){return t.changes}var rc=Rs(function(e,t){Xl(e,t)},200),vy=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?w.useLayoutEffect:w.useEffect,wy="useId"in w?function(t){var n=t.id,r=t.labelId,o=t.menuId,i=t.getItemId,s=t.toggleButtonId,a=t.inputId,c="downshift-"+w.useId();n||(n=c);var u=w.useRef({labelId:r||n+"-label",menuId:o||n+"-menu",getItemId:i||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-"+Wl():n,o=t.labelId,i=t.menuId,s=t.getItemId,a=t.toggleButtonId,c=t.inputId,u=w.useRef({labelId:o||r+"-label",menuId:i||r+"-menu",getItemId:s||function(d){return r+"-item-"+d},toggleButtonId:a||r+"-toggle-button",inputId:c||r+"-input"});return u.current};function Iy(e,t,n,r){var o,i;if(e===void 0){if(t===void 0)throw new Error(r);o=n[t],i=t}else i=t===void 0?n.indexOf(e):t,o=e;return[o,i]}function Ps(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function fu(e){var t=w.useRef(e);return t.current=e,t}function by(e,t,n,r){var o=w.useRef(),i=w.useRef(),s=w.useCallback(function(p,g){i.current=g,p=Ui(p,g.props);var v=e(p,g),m=g.props.stateReducer(p,pe({},g,{changes:v}));return m},[e]),a=w.useReducer(s,t,n),c=a[0],u=a[1],d=fu(t),f=w.useCallback(function(p){return u(pe({props:d.current},p))},[d]),h=i.current;return w.useEffect(function(){var p=Ui(o.current,h==null?void 0:h.props),g=h&&o.current&&!r(p,c);g&&my(h,p,c),o.current=c},[c,h,r]),[c,f]}var Kr={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:yy,scrollIntoView:Bl,environment:typeof window>"u"?void 0:window};function Sn(e,t,n){n===void 0&&(n=du);var r=e["default"+Ps(t)];return r!==void 0?r:n[t]}function $r(e,t,n){n===void 0&&(n=du);var r=e[t];if(r!==void 0)return r;var o=e["initial"+Ps(t)];return o!==void 0?o:Sn(e,t,n)}function _y(e){var t=$r(e,"selectedItem"),n=$r(e,"isOpen"),r=Sy(e),o=$r(e,"inputValue");return{highlightedIndex:r<0&&t&&n?e.items.findIndex(function(i){return e.itemToKey(i)===e.itemToKey(t)}):r,isOpen:n,selectedItem:t,inputValue:o}}function Ur(e,t,n){var r=e.items,o=e.initialHighlightedIndex,i=e.defaultHighlightedIndex,s=e.isItemDisabled,a=e.itemToKey,c=t.selectedItem,u=t.highlightedIndex;return r.length===0?-1:o!==void 0&&u===o&&!s(r[o],o)?o:i!==void 0&&!s(r[i],i)?i: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 xy(e,t,n){var r=w.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return w.useEffect(function(){if(!e)return wt;var o=n.map(function(d){return d.current});function i(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(d){r.current.isMouseDown=!1,Hi(d.target,o,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&&!Hi(d.target,o,e,!1)&&t()}return e.addEventListener("mousedown",i),e.addEventListener("mouseup",s),e.addEventListener("touchstart",a),e.addEventListener("touchmove",c),e.addEventListener("touchend",u),function(){e.removeEventListener("mousedown",i),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",a),e.removeEventListener("touchmove",c),e.removeEventListener("touchend",u)}},[n,e,t]),r.current}var pu=function(){return wt};process.env.NODE_ENV!=="production"&&(pu=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var o=w.useRef(n.reduce(function(s,a){return s[a]={},s},{}));w.useEffect(function(){Object.keys(o.current).forEach(function(s){var a=o.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 i=w.useCallback(function(s,a,c,u){o.current[s]={suppressRefError:a,refKey:c,elementRef:u}},[]);return i});function Cy(e,t,n,r){r===void 0&&(r={});var o=r.document,i=so();w.useEffect(function(){if(!(!e||i||!o)){var s=e(t);rc(s,o)}},n),w.useEffect(function(){return function(){rc.cancel(),sy(o)}},[o])}function Oy(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,o=e.getItemNodeFromIndex,i=e.menuElement,s=e.scrollIntoView,a=w.useRef(!0);return vy(function(){t<0||!n||!Object.keys(r.current).length||(a.current===!1?a.current=!0:s(o(t),i))},[t]),a}var hu=wt;process.env.NODE_ENV!=="production"&&(hu=function(t){var n=t.props,r=t.state,o=w.useRef(n),i=so();w.useEffect(function(){i||(As(r,o.current,n),o.current=n)},[r,n,i])});function ic(e,t,n){var r;n===void 0&&(n=!0);var o=((r=e.items)==null?void 0:r.length)&&t>=0;return pe({isOpen:!1,highlightedIndex:-1},o&&pe({selectedItem:e.items[t],isOpen:Sn(e,"isOpen"),highlightedIndex:Sn(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function Ey(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function so(){var e=w.useRef(!0);return w.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function ls(e){var t=Sn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function Sy(e){var t=$r(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Fi={environment:V.shape({addEventListener:V.func.isRequired,removeEventListener:V.func.isRequired,document:V.shape({createElement:V.func.isRequired,getElementById:V.func.isRequired,activeElement:V.any.isRequired,body:V.any.isRequired}).isRequired,Node:V.func.isRequired}),itemToString:V.func,itemToKey:V.func,stateReducer:V.func},mu=pe({},Fi,{getA11yStatusMessage:V.func,highlightedIndex:V.number,defaultHighlightedIndex:V.number,initialHighlightedIndex:V.number,isOpen:V.bool,defaultIsOpen:V.bool,initialIsOpen:V.bool,selectedItem:V.any,initialSelectedItem:V.any,defaultSelectedItem:V.any,id:V.string,labelId:V.string,menuId:V.string,getItemId:V.func,toggleButtonId:V.string,onSelectedItemChange:V.func,onHighlightedIndexChange:V.func,onStateChange:V.func,onIsOpenChange:V.func,scrollIntoView:V.func});function Ny(e,t,n){var r=t.type,o=t.props,i;switch(r){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Ur(o,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:Ur(o,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:o.isItemDisabled(o.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:ls(o),isOpen:Sn(o,"isOpen"),selectedItem:Sn(o,"selectedItem"),inputValue:Sn(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return pe({},e,i)}Er(Er({},mu),{items:V.array.isRequired,isItemDisabled:V.func});Er(Er({},Kr),{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 Ds=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Fs=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Ms=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,js=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,ks=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Ls=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Vs=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,Ks=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,$s=process.env.NODE_ENV!=="production"?"__input_change__":8,Bi=process.env.NODE_ENV!=="production"?"__input_blur__":9,Us=process.env.NODE_ENV!=="production"?"__input_click__":10,gu=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,yu=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,qs=process.env.NODE_ENV!=="production"?"__item_click__":13,vu=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,wu=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Iu=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,bu=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,_u=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,Hs=process.env.NODE_ENV!=="production"?"__function_select_item__":19,xu=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Cu=process.env.NODE_ENV!=="production"?"__function_reset__":21,Bs=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Ou=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:Bs,FunctionCloseMenu:bu,FunctionOpenMenu:Iu,FunctionReset:Cu,FunctionSelectItem:Hs,FunctionSetHighlightedIndex:_u,FunctionSetInputValue:xu,FunctionToggleMenu:wu,InputBlur:Bi,InputChange:$s,InputClick:Us,InputKeyDownArrowDown:Ds,InputKeyDownArrowUp:Fs,InputKeyDownEnd:ks,InputKeyDownEnter:Ks,InputKeyDownEscape:Ms,InputKeyDownHome:js,InputKeyDownPageDown:Vs,InputKeyDownPageUp:Ls,ItemClick:qs,ItemMouseMove:yu,MenuMouseLeave:gu,ToggleButtonClick:vu});function Ty(e){var t=_y(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)),pe({},t,{inputValue:r})}var Ry=pe({},mu,{items:V.array.isRequired,isItemDisabled:V.func,inputValue:V.string,defaultInputValue:V.string,initialInputValue:V.string,inputId:V.string,onInputValueChange:V.func});function Ay(e,t,n,r){var o=w.useRef(),i=by(e,t,n,r),s=i[0],a=i[1],c=so();return w.useEffect(function(){if(qi(t,"selectedItem")){if(!c){var u=t.itemToKey(t.selectedItem)!==t.itemToKey(o.current);u&&a({type:Bs,inputValue:t.itemToString(t.selectedItem)})}o.current=s.selectedItem===o.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Ui(s,t),a]}var Eu=wt;process.env.NODE_ENV!=="production"&&(Eu=function(t,n){V.checkPropTypes(Ry,t,"prop",n.name)});var Py=pe({},Kr,{isItemDisabled:function(){return!1}});function Dy(e,t){var n,r=t.type,o=t.props,i=t.altKey,s;switch(r){case qs:s={isOpen:Sn(o,"isOpen"),highlightedIndex:ls(o),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case Ds:e.isOpen?s={highlightedIndex:qn(e.highlightedIndex,1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:i&&e.selectedItem==null?-1:Ur(o,e,1),isOpen:o.items.length>=0};break;case Fs:e.isOpen?i?s=ic(o,e.highlightedIndex):s={highlightedIndex:qn(e.highlightedIndex,-1,o.items,o.isItemDisabled,!0)}:s={highlightedIndex:Ur(o,e,-1),isOpen:o.items.length>=0};break;case Ks:s=ic(o,e.highlightedIndex);break;case Ms:s=pe({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Ls:s={highlightedIndex:qn(e.highlightedIndex,-10,o.items,o.isItemDisabled,!0)};break;case Vs:s={highlightedIndex:qn(e.highlightedIndex,10,o.items,o.isItemDisabled,!0)};break;case js:s={highlightedIndex:Sr(0,!1,o.items,o.isItemDisabled)};break;case ks:s={highlightedIndex:Sr(o.items.length-1,!0,o.items,o.isItemDisabled)};break;case Bi:s=pe({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=o.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case $s:s={isOpen:!0,highlightedIndex:ls(o),inputValue:t.inputValue};break;case Us:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Ur(o,e,0)};break;case Hs:s={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case Bs:s={inputValue:t.inputValue};break;default:return Ny(e,t,Ou)}return pe({},e,s)}var Fy=["onMouseLeave","refKey","ref"],My=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],jy=["onClick","onPress","refKey","ref"],ky=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];Ws.stateChangeTypes=Ou;function Ws(e){e===void 0&&(e={}),Eu(e,Ws);var t=pe({},Py,e),n=t.items,r=t.scrollIntoView,o=t.environment,i=t.getA11yStatusMessage,s=Ay(Dy,t,Ty,Ey),a=s[0],c=s[1],u=a.isOpen,d=a.highlightedIndex,f=a.selectedItem,h=a.inputValue,p=w.useRef(null),g=w.useRef({}),v=w.useRef(null),m=w.useRef(null),C=so(),y=wy(t),_=w.useRef(),x=fu({state:a,props:t}),b=w.useCallback(function(K){return g.current[y.getItemId(K)]},[y]);Cy(i,a,[u,d,f,h],o);var S=Oy({menuElement:p.current,highlightedIndex:d,isOpen:u,itemRefs:g,scrollIntoView:r,getItemNodeFromIndex:b});hu({props:t,state:a}),w.useEffect(function(){var K=$r(t,"isOpen");K&&v.current&&v.current.focus()},[]),w.useEffect(function(){C||(_.current=n.length)});var R=xy(o,w.useCallback(function(){x.current.state.isOpen&&c({type:Bi,selectItem:!1})},[c,x]),w.useMemo(function(){return[p,m,v]},[p.current,m.current,v.current])),N=pu("getInputProps","getMenuProps");w.useEffect(function(){u||(g.current={})},[u]),w.useEffect(function(){var K;!u||!(o!=null&&o.document)||!(v!=null&&(K=v.current)!=null&&K.focus)||o.document.activeElement!==v.current&&v.current.focus()},[u,o]);var M=w.useMemo(function(){return{ArrowDown:function(L){L.preventDefault(),c({type:Ds,altKey:L.altKey})},ArrowUp:function(L){L.preventDefault(),c({type:Fs,altKey:L.altKey})},Home:function(L){x.current.state.isOpen&&(L.preventDefault(),c({type:js}))},End:function(L){x.current.state.isOpen&&(L.preventDefault(),c({type:ks}))},Escape:function(L){var k=x.current.state;(k.isOpen||k.inputValue||k.selectedItem||k.highlightedIndex>-1)&&(L.preventDefault(),c({type:Ms}))},Enter:function(L){var k=x.current.state;!k.isOpen||L.which===229||(L.preventDefault(),c({type:Ks}))},PageUp:function(L){x.current.state.isOpen&&(L.preventDefault(),c({type:Ls}))},PageDown:function(L){x.current.state.isOpen&&(L.preventDefault(),c({type:Vs}))}}},[c,x]),U=w.useCallback(function(K){return pe({id:y.labelId,htmlFor:y.inputId},K)},[y]),q=w.useCallback(function(K,L){var k,D=K===void 0?{}:K,Z=D.onMouseLeave,ee=D.refKey,H=ee===void 0?"ref":ee,te=D.ref,z=cn(D,Fy),ue=L===void 0?{}:L,F=ue.suppressRefError,ve=F===void 0?!1:F;return N("getMenuProps",ve,H,p),pe((k={},k[H]=cr(te,function(B){p.current=B}),k.id=y.menuId,k.role="listbox",k["aria-labelledby"]=z&&z["aria-label"]?void 0:""+y.labelId,k.onMouseLeave=Be(Z,function(){c({type:gu})}),k),z)},[c,N,y]),G=w.useCallback(function(K){var L,k,D=K===void 0?{}:K,Z=D.item,ee=D.index,H=D.refKey,te=H===void 0?"ref":H,z=D.ref,ue=D.onMouseMove,F=D.onMouseDown,ve=D.onClick;D.onPress;var B=D.disabled,Ee=cn(D,My);B!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Ve=x.current,Ge=Ve.props,$e=Ve.state,Ie=Iy(Z,ee,Ge.items,"Pass either item or index to getItemProps!"),At=Ie[0],Xe=Ie[1],gt=Ge.isItemDisabled(At,Xe),Pt="onClick",Dt=ve,Qe=function(){R.isTouchEnd||Xe===$e.highlightedIndex||(S.current=!1,c({type:yu,index:Xe,disabled:gt}))},We=function(){c({type:qs,index:Xe})},Ue=function(Ft){return Ft.preventDefault()};return pe((L={},L[te]=cr(z,function(Ae){Ae&&(g.current[y.getItemId(Xe)]=Ae)}),L["aria-disabled"]=gt,L["aria-selected"]=Xe===$e.highlightedIndex,L.id=y.getItemId(Xe),L.role="option",L),!gt&&(k={},k[Pt]=Be(Dt,We),k),{onMouseMove:Be(ue,Qe),onMouseDown:Be(F,Ue)},Ee)},[c,y,x,R,S]),ne=w.useCallback(function(K){var L,k=K===void 0?{}:K,D=k.onClick;k.onPress;var Z=k.refKey,ee=Z===void 0?"ref":Z,H=k.ref,te=cn(k,jy),z=x.current.state,ue=function(){c({type:vu})};return pe((L={},L[ee]=cr(H,function(F){m.current=F}),L["aria-controls"]=y.menuId,L["aria-expanded"]=z.isOpen,L.id=y.toggleButtonId,L.tabIndex=-1,L),!te.disabled&&pe({},{onClick:Be(D,ue)}),te)},[c,x,y]),W=w.useCallback(function(K,L){var k,D=K===void 0?{}:K,Z=D.onKeyDown,ee=D.onChange,H=D.onInput,te=D.onBlur;D.onChangeText;var z=D.onClick,ue=D.refKey,F=ue===void 0?"ref":ue,ve=D.ref,B=cn(D,ky),Ee=L===void 0?{}:L,Ve=Ee.suppressRefError,Ge=Ve===void 0?!1:Ve;N("getInputProps",Ge,F,v);var $e=x.current.state,Ie=function(Ue){var Ae=as(Ue);Ae&&M[Ae]&&M[Ae](Ue)},At=function(Ue){c({type:$s,inputValue:Ue.target.value})},Xe=function(Ue){if(o!=null&&o.document&&$e.isOpen&&!R.isMouseDown){var Ae=Ue.relatedTarget===null&&o.document.activeElement!==o.document.body;c({type:Bi,selectItem:!Ae})}},gt=function(){c({type:Us})},Pt="onChange",Dt={};if(!B.disabled){var Qe;Dt=(Qe={},Qe[Pt]=Be(ee,H,At),Qe.onKeyDown=Be(Z,Ie),Qe.onBlur=Be(te,Xe),Qe.onClick=Be(z,gt),Qe)}return pe((k={},k[F]=cr(ve,function(We){v.current=We}),k["aria-activedescendant"]=$e.isOpen&&$e.highlightedIndex>-1?y.getItemId($e.highlightedIndex):"",k["aria-autocomplete"]="list",k["aria-controls"]=y.menuId,k["aria-expanded"]=$e.isOpen,k["aria-labelledby"]=B&&B["aria-label"]?void 0:y.labelId,k.autoComplete="off",k.id=y.inputId,k.role="combobox",k.value=$e.inputValue,k),Dt,B)},[c,y,o,M,x,R,N]),ce=w.useCallback(function(){c({type:wu})},[c]),re=w.useCallback(function(){c({type:bu})},[c]),Q=w.useCallback(function(){c({type:Iu})},[c]),fe=w.useCallback(function(K){c({type:_u,highlightedIndex:K})},[c]),ye=w.useCallback(function(K){c({type:Hs,selectedItem:K})},[c]),T=w.useCallback(function(K){c({type:xu,inputValue:K})},[c]),j=w.useCallback(function(){c({type:Cu})},[c]);return{getItemProps:G,getLabelProps:U,getMenuProps:q,getInputProps:W,getToggleButtonProps:ne,toggleMenu:ce,openMenu:Q,closeMenu:re,setHighlightedIndex:fe,setInputValue:T,selectItem:ye,reset:j,highlightedIndex:d,isOpen:u,selectedItem:f,inputValue:h}}Fi.stateReducer,Fi.itemToKey,Fi.environment,V.array,V.array,V.array,V.func,V.number,V.number,V.number,V.func,V.func,V.string,V.string;Kr.itemToKey,Kr.stateReducer,Kr.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 Ly="_comboboxContainer_9s7ov_1",Vy="_label_9s7ov_8",Ky="_inputContainer_9s7ov_12",$y="_input_9s7ov_12",Uy="_toggleButton_9s7ov_33",qy="_menu_9s7ov_39",Hy="_menuItem_9s7ov_54",By="_highlighted_9s7ov_61",Wy="_selected_9s7ov_65",Jy="_hidden_9s7ov_69",on={comboboxContainer:Ly,label:Vy,inputContainer:Ky,input:$y,toggleButton:Uy,menu:qy,menuItem:Hy,highlighted:By,selected:Wy,hidden:Jy};function zy(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function Js({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r,disabled:o,style:i}){const[s,a]=w.useState(e),c=w.useRef(null);w.useEffect(()=>a(e),[e]);const u=b=>{a(e.filter(zy(b)))},{isOpen:d,getToggleButtonProps:f,getMenuProps:h,getInputProps:p,highlightedIndex:g,getItemProps:v,setInputValue:m}=Ws({items:s,selectedItem:t?e.find(b=>b.value===t):null,itemToString:b=>(b==null?void 0:b.label)||"",onInputValueChange:({inputValue:b})=>u(b),onSelectedItemChange:({selectedItem:b})=>{var S;(S=c.current)==null||S.blur(),n(b)}}),C=()=>{m(""),a(e)},y=()=>C(),_=w.useMemo(()=>{var b;return(b=e.find(S=>S.value===t))==null?void 0:b.label},[e,t]),x=()=>m(_||"");return l.jsxs("div",{style:{position:"relative",...i},children:[l.jsx("div",{className:on.comboboxContainer,children:l.jsxs("div",{className:on.inputContainer,children:[l.jsx("input",{style:{border:"none"},disabled:o,placeholder:_||r,className:on.input,...p({onFocus:y,onBlur:x,ref:c})}),l.jsx("button",{style:{border:"none"},disabled:o,"aria-label":"toggle menu",className:on.toggleButton,type:"button",...f(),children:d?l.jsx(l.Fragment,{children:"↑"}):l.jsx(l.Fragment,{children:"↓"})})]})}),l.jsx("ul",{className:`${on.menu} ${d&&e.length?"":on.hidden}`,...h(),children:d&&s.map((b,S)=>l.jsx("li",{className:`${on.menuItem} ${g===S?on.highlighted:""} ${t===(b==null?void 0:b.value)?on.selected:""}`,...v({item:b,index:S}),children:l.jsx("span",{children:b.label})},b.id))})]})}const Nr=Math.min,Qn=Math.max,Wi=Math.round,Ni=Math.floor,Rn=e=>({x:e,y:e}),Gy={left:"right",right:"left",bottom:"top",top:"bottom"},Xy={start:"end",end:"start"};function us(e,t,n){return Qn(e,Nr(t,n))}function ii(e,t){return typeof e=="function"?e(t):e}function rr(e){return e.split("-")[0]}function oi(e){return e.split("-")[1]}function Su(e){return e==="x"?"y":"x"}function zs(e){return e==="y"?"height":"width"}function Tr(e){return["top","bottom"].includes(rr(e))?"y":"x"}function Gs(e){return Su(Tr(e))}function Qy(e,t,n){n===void 0&&(n=!1);const r=oi(e),o=Gs(e),i=zs(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=Ji(s)),[s,Ji(s)]}function Yy(e){const t=Ji(e);return[ds(e),t,ds(t)]}function ds(e){return e.replace(/start|end/g,t=>Xy[t])}function Zy(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function ev(e,t,n,r){const o=oi(e);let i=Zy(rr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(ds)))),i}function Ji(e){return e.replace(/left|right|bottom|top/g,t=>Gy[t])}function tv(e){return{top:0,right:0,bottom:0,left:0,...e}}function Nu(e){return typeof e!="number"?tv(e):{top:e,right:e,bottom:e,left:e}}function zi(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function oc(e,t,n){let{reference:r,floating:o}=e;const i=Tr(t),s=Gs(t),a=zs(s),c=rr(t),u=i==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[a]/2-o[a]/2;let p;switch(c){case"top":p={x:d,y:r.y-o.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-o.width,y:f};break;default:p={x:r.x,y:r.y}}switch(oi(t)){case"start":p[s]-=h*(n&&u?-1:1);break;case"end":p[s]+=h*(n&&u?-1:1);break}return p}const nv=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),c=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:f}=oc(u,r,c),h=r,p={},g=0;for(let v=0;v<a.length;v++){const{name:m,fn:C}=a[v],{x:y,y:_,data:x,reset:b}=await C({x:d,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:p,rects:u,platform:s,elements:{reference:e,floating:t}});d=y??d,f=_??f,p={...p,[m]:{...p[m],...x}},b&&g<=50&&(g++,typeof b=="object"&&(b.placement&&(h=b.placement),b.rects&&(u=b.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):b.rects),{x:d,y:f}=oc(u,h,c)),v=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:p}};async function Tu(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:a,strategy:c}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:h=!1,padding:p=0}=ii(t,e),g=Nu(p),m=a[h?f==="floating"?"reference":"floating":f],C=zi(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(m)))==null||n?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),y=f==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),x=await(i.isElement==null?void 0:i.isElement(_))?await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1}:{x:1,y:1},b=zi(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:_,strategy:c}):y);return{top:(C.top-b.top+g.top)/x.y,bottom:(b.bottom-C.bottom+g.bottom)/x.y,left:(C.left-b.left+g.left)/x.x,right:(b.right-C.right+g.right)/x.x}}const rv=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:c}=t,{element:u,padding:d=0}=ii(e,t)||{};if(u==null)return{};const f=Nu(d),h={x:n,y:r},p=Gs(o),g=zs(p),v=await s.getDimensions(u),m=p==="y",C=m?"top":"left",y=m?"bottom":"right",_=m?"clientHeight":"clientWidth",x=i.reference[g]+i.reference[p]-h[p]-i.floating[g],b=h[p]-i.reference[p],S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let R=S?S[_]:0;(!R||!await(s.isElement==null?void 0:s.isElement(S)))&&(R=a.floating[_]||i.floating[g]);const N=x/2-b/2,M=R/2-v[g]/2-1,U=Nr(f[C],M),q=Nr(f[y],M),G=U,ne=R-v[g]-q,W=R/2-v[g]/2+N,ce=us(G,W,ne),re=!c.arrow&&oi(o)!=null&&W!==ce&&i.reference[g]/2-(W<G?U:q)-v[g]/2<0,Q=re?W<G?W-G:W-ne:0;return{[p]:h[p]+Q,data:{[p]:ce,centerOffset:W-ce-Q,...re&&{alignmentOffset:Q}},reset:re}}}),iv=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:v=!0,...m}=ii(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const C=rr(o),y=Tr(a),_=rr(a)===a,x=await(c.isRTL==null?void 0:c.isRTL(u.floating)),b=h||(_||!v?[Ji(a)]:Yy(a)),S=g!=="none";!h&&S&&b.push(...ev(a,v,g,x));const R=[a,...b],N=await Tu(t,m),M=[];let U=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&M.push(N[C]),f){const W=Qy(o,s,x);M.push(N[W[0]],N[W[1]])}if(U=[...U,{placement:o,overflows:M}],!M.every(W=>W<=0)){var q,G;const W=(((q=i.flip)==null?void 0:q.index)||0)+1,ce=R[W];if(ce)return{data:{index:W,overflows:U},reset:{placement:ce}};let re=(G=U.filter(Q=>Q.overflows[0]<=0).sort((Q,fe)=>Q.overflows[1]-fe.overflows[1])[0])==null?void 0:G.placement;if(!re)switch(p){case"bestFit":{var ne;const Q=(ne=U.filter(fe=>{if(S){const ye=Tr(fe.placement);return ye===y||ye==="y"}return!0}).map(fe=>[fe.placement,fe.overflows.filter(ye=>ye>0).reduce((ye,T)=>ye+T,0)]).sort((fe,ye)=>fe[1]-ye[1])[0])==null?void 0:ne[0];Q&&(re=Q);break}case"initialPlacement":re=a;break}if(o!==re)return{reset:{placement:re}}}return{}}}};async function ov(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=rr(n),a=oi(n),c=Tr(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,f=ii(t,e);let{mainAxis:h,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:h*u}:{x:h*u,y:p*d}}const sv=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,c=await ov(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+c.x,y:i+c.y,data:{...c,placement:s}}}}},av=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:m=>{let{x:C,y}=m;return{x:C,y}}},...c}=ii(e,t),u={x:n,y:r},d=await Tu(t,c),f=Tr(rr(o)),h=Su(f);let p=u[h],g=u[f];if(i){const m=h==="y"?"top":"left",C=h==="y"?"bottom":"right",y=p+d[m],_=p-d[C];p=us(y,p,_)}if(s){const m=f==="y"?"top":"left",C=f==="y"?"bottom":"right",y=g+d[m],_=g-d[C];g=us(y,g,_)}const v=a.fn({...t,[h]:p,[f]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[h]:i,[f]:s}}}}}};function ao(){return typeof window<"u"}function Dr(e){return Ru(e)?(e.nodeName||"").toLowerCase():"#document"}function bt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Qt(e){var t;return(t=(Ru(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ru(e){return ao()?e instanceof Node||e instanceof bt(e).Node:!1}function Ut(e){return ao()?e instanceof Element||e instanceof bt(e).Element:!1}function Xt(e){return ao()?e instanceof HTMLElement||e instanceof bt(e).HTMLElement:!1}function sc(e){return!ao()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof bt(e).ShadowRoot}function si(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=qt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function cv(e){return["table","td","th"].includes(Dr(e))}function co(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Xs(e){const t=Qs(),n=Ut(e)?qt(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 lv(e){let t=An(e);for(;Xt(t)&&!Rr(t);){if(Xs(t))return t;if(co(t))return null;t=An(t)}return null}function Qs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Rr(e){return["html","body","#document"].includes(Dr(e))}function qt(e){return bt(e).getComputedStyle(e)}function lo(e){return Ut(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function An(e){if(Dr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||sc(e)&&e.host||Qt(e);return sc(t)?t.host:t}function Au(e){const t=An(e);return Rr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Xt(t)&&si(t)?t:Au(t)}function Xr(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Au(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=bt(o);if(i){const a=fs(s);return t.concat(s,s.visualViewport||[],si(o)?o:[],a&&n?Xr(a):[])}return t.concat(o,Xr(o,[],n))}function fs(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Pu(e){const t=qt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Xt(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Wi(n)!==i||Wi(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Ys(e){return Ut(e)?e:e.contextElement}function ur(e){const t=Ys(e);if(!Xt(t))return Rn(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Pu(t);let s=(i?Wi(n.width):n.width)/r,a=(i?Wi(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const uv=Rn(0);function Du(e){const t=bt(e);return!Qs()||!t.visualViewport?uv:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function dv(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==bt(e)?!1:t}function ir(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Ys(e);let s=Rn(1);t&&(r?Ut(r)&&(s=ur(r)):s=ur(e));const a=dv(i,n,r)?Du(i):Rn(0);let c=(o.left+a.x)/s.x,u=(o.top+a.y)/s.y,d=o.width/s.x,f=o.height/s.y;if(i){const h=bt(i),p=r&&Ut(r)?bt(r):r;let g=h,v=fs(g);for(;v&&r&&p!==g;){const m=ur(v),C=v.getBoundingClientRect(),y=qt(v),_=C.left+(v.clientLeft+parseFloat(y.paddingLeft))*m.x,x=C.top+(v.clientTop+parseFloat(y.paddingTop))*m.y;c*=m.x,u*=m.y,d*=m.x,f*=m.y,c+=_,u+=x,g=bt(v),v=fs(g)}}return zi({width:d,height:f,x:c,y:u})}function fv(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Qt(r),a=t?co(t.floating):!1;if(r===s||a&&i)return n;let c={scrollLeft:0,scrollTop:0},u=Rn(1);const d=Rn(0),f=Xt(r);if((f||!f&&!i)&&((Dr(r)!=="body"||si(s))&&(c=lo(r)),Xt(r))){const h=ir(r);u=ur(r),d.x=h.x+r.clientLeft,d.y=h.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 pv(e){return Array.from(e.getClientRects())}function ps(e,t){const n=lo(e).scrollLeft;return t?t.left+n:ir(Qt(e)).left+n}function hv(e){const t=Qt(e),n=lo(e),r=e.ownerDocument.body,o=Qn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Qn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+ps(e);const a=-n.scrollTop;return qt(r).direction==="rtl"&&(s+=Qn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function mv(e,t){const n=bt(e),r=Qt(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,c=0;if(o){i=o.width,s=o.height;const u=Qs();(!u||u&&t==="fixed")&&(a=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:a,y:c}}function gv(e,t){const n=ir(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Xt(e)?ur(e):Rn(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,c=o*i.x,u=r*i.y;return{width:s,height:a,x:c,y:u}}function ac(e,t,n){let r;if(t==="viewport")r=mv(e,n);else if(t==="document")r=hv(Qt(e));else if(Ut(t))r=gv(t,n);else{const o=Du(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return zi(r)}function Fu(e,t){const n=An(e);return n===t||!Ut(n)||Rr(n)?!1:qt(n).position==="fixed"||Fu(n,t)}function yv(e,t){const n=t.get(e);if(n)return n;let r=Xr(e,[],!1).filter(a=>Ut(a)&&Dr(a)!=="body"),o=null;const i=qt(e).position==="fixed";let s=i?An(e):e;for(;Ut(s)&&!Rr(s);){const a=qt(s),c=Xs(s);!c&&a.position==="fixed"&&(o=null),(i?!c&&!o:!c&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||si(s)&&!c&&Fu(e,s))?r=r.filter(d=>d!==s):o=a,s=An(s)}return t.set(e,r),r}function vv(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?co(t)?[]:yv(t,this._c):[].concat(n),r],a=s[0],c=s.reduce((u,d)=>{const f=ac(t,d,o);return u.top=Qn(f.top,u.top),u.right=Nr(f.right,u.right),u.bottom=Nr(f.bottom,u.bottom),u.left=Qn(f.left,u.left),u},ac(t,a,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function wv(e){const{width:t,height:n}=Pu(e);return{width:t,height:n}}function Iv(e,t,n){const r=Xt(t),o=Qt(t),i=n==="fixed",s=ir(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Rn(0);if(r||!r&&!i)if((Dr(t)!=="body"||si(o))&&(a=lo(t)),r){const p=ir(t,!0,i,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else o&&(c.x=ps(o));let u=0,d=0;if(o&&!r&&!i){const p=o.getBoundingClientRect();d=p.top+a.scrollTop,u=p.left+a.scrollLeft-ps(o,p)}const f=s.left+a.scrollLeft-c.x-u,h=s.top+a.scrollTop-c.y-d;return{x:f,y:h,width:s.width,height:s.height}}function Do(e){return qt(e).position==="static"}function cc(e,t){if(!Xt(e)||qt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Qt(e)===n&&(n=n.ownerDocument.body),n}function Mu(e,t){const n=bt(e);if(co(e))return n;if(!Xt(e)){let o=An(e);for(;o&&!Rr(o);){if(Ut(o)&&!Do(o))return o;o=An(o)}return n}let r=cc(e,t);for(;r&&cv(r)&&Do(r);)r=cc(r,t);return r&&Rr(r)&&Do(r)&&!Xs(r)?n:r||lv(e)||n}const bv=async function(e){const t=this.getOffsetParent||Mu,n=this.getDimensions,r=await n(e.floating);return{reference:Iv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function _v(e){return qt(e).direction==="rtl"}const xv={convertOffsetParentRelativeRectToViewportRelativeRect:fv,getDocumentElement:Qt,getClippingRect:vv,getOffsetParent:Mu,getElementRects:bv,getClientRects:pv,getDimensions:wv,getScale:ur,isElement:Ut,isRTL:_v};function Cv(e,t){let n=null,r;const o=Qt(e);function i(){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),i();const{left:u,top:d,width:f,height:h}=e.getBoundingClientRect();if(a||t(),!f||!h)return;const p=Ni(d),g=Ni(o.clientWidth-(u+f)),v=Ni(o.clientHeight-(d+h)),m=Ni(u),y={rootMargin:-p+"px "+-g+"px "+-v+"px "+-m+"px",threshold:Qn(0,Nr(1,c))||1};let _=!0;function x(b){const S=b[0].intersectionRatio;if(S!==c){if(!_)return s();S?s(!1,S):r=setTimeout(()=>{s(!1,1e-7)},1e3)}_=!1}try{n=new IntersectionObserver(x,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(x,y)}n.observe(e)}return s(!0),i}function Ov(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Ys(e),d=o||i?[...u?Xr(u):[],...Xr(t)]:[];d.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),i&&C.addEventListener("resize",n)});const f=u&&a?Cv(u,n):null;let h=-1,p=null;s&&(p=new ResizeObserver(C=>{let[y]=C;y&&y.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var _;(_=p)==null||_.observe(t)})),n()}),u&&!c&&p.observe(u),p.observe(t));let g,v=c?ir(e):null;c&&m();function m(){const C=ir(e);v&&(C.x!==v.x||C.y!==v.y||C.width!==v.width||C.height!==v.height)&&n(),v=C,g=requestAnimationFrame(m)}return n(),()=>{var C;d.forEach(y=>{o&&y.removeEventListener("scroll",n),i&&y.removeEventListener("resize",n)}),f==null||f(),(C=p)==null||C.disconnect(),p=null,c&&cancelAnimationFrame(g)}}const Ev=sv,Sv=av,Nv=iv,Tv=rv,lc=(e,t,n)=>{const r=new Map,o={platform:xv,...n},i={...o.platform,_c:r};return nv(e,t,{...o,platform:i})};/*
44
44
  * React Tooltip
45
45
  * {@link https://github.com/ReactTooltip/react-tooltip}
46
46
  * @copyright ReactTooltip Team
47
47
  * @license MIT
48
- */const Uh="react-tooltip-core-styles",Hh="react-tooltip-base-styles",xs={core:!1,base:!1};function Cs({css:e,id:t=Hh,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||xs[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=Uh),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)),xs[n]=!0}const Os=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[Lh(Number(i)),Kh({fallbackAxisSideDirection:"start"}),Vh({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($h({element:n,padding:5})),bs(e,t,{placement:r,strategy:o,middleware:c}).then(({x:u,y:d,placement:p,middlewareData:m})=>{var f,v;const I={left:`${u}px`,top:`${d}px`,border:a},{x:g,y:C}=(f=m.arrow)!==null&&f!==void 0?f:{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:I,tooltipArrowStyles:{left:g!=null?`${g}px`:"",top:C!=null?`${C}px`:"",right:"",bottom:"",...b,[y]:`-${4+x}px`},place:p}})):bs(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}))},Es=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),Ns=(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},Ss=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",$o=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,o)=>$o(i,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Ss(e)||!Ss(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(i=>$o(e[i],t[i]))},Bh=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"})},Ts=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Bh(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},qh=typeof window<"u"?h.useLayoutEffect:h.useEffect,gt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},Wh="DEFAULT_TOOLTIP_ID",Jh={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},zh=h.createContext({getTooltipData:()=>Jh});function Ac(e=Wh){return h.useContext(zh).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"},_o={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 Xh=({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:m,wrapper:f,delayShow:v=0,delayHide:I=0,float:g=!1,hidden:C=!1,noArrow:y=!1,clickable:b=!1,closeOnEsc:x=!1,closeOnScroll:_=!1,closeOnResize:E=!1,openEvents:k,closeEvents:S,globalCloseEvents:B,imperativeModeOnly:q,style:W,position:G,afterShow:ee,afterHide:$,disableTooltip:ie,content:te,contentWrapperRef:X,isOpen:le,defaultIsOpen:pe=!1,setIsOpen:N,activeAnchor:D,setActiveAnchor:L,border:F,opacity:M,arrowColor:R,role:Y="tooltip"})=>{var Z;const V=h.useRef(null),Q=h.useRef(null),J=h.useRef(null),ae=h.useRef(null),P=h.useRef(null),[fe,K]=h.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ie,Pe]=h.useState(!1),[Ue,Me]=h.useState(!1),[he,vt]=h.useState(null),He=h.useRef(!1),ot=h.useRef(null),{anchorRefs:yt,setActiveAnchor:wt}=Ac(t),Be=h.useRef(!1),[Ve,Fe]=h.useState([]),Oe=h.useRef(!1),It=d||u.includes("click"),Xe=It||(k==null?void 0:k.click)||(k==null?void 0:k.dblclick)||(k==null?void 0:k.mousedown),Rt=k?{...k}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!k&&It&&Object.assign(Rt,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Ut=S?{...S}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!S&&It&&Object.assign(Ut,{mouseleave:!1,blur:!1,mouseout:!1});const it=B?{...B}:{escape:x||!1,scroll:_||!1,resize:E||!1,clickOutsideAnchor:Xe||!1};q&&(Object.assign(Rt,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Ut,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(it,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),qh(()=>(Oe.current=!0,()=>{Oe.current=!1}),[]);const Ee=H=>{Oe.current&&(H&&Me(!0),setTimeout(()=>{Oe.current&&(N==null||N(H),le===void 0&&Pe(H))},10))};h.useEffect(()=>{if(le===void 0)return()=>null;le&&Me(!0);const H=setTimeout(()=>{Pe(le)},10);return()=>{clearTimeout(H)}},[le]),h.useEffect(()=>{if(Ie!==He.current)if(gt(P),He.current=Ie,Ie)ee==null||ee();else{const H=(re=>{const se=re.match(/^([\d.]+)(ms|s)$/);if(!se)return 0;const[,Ae,ke]=se;return Number(Ae)*(ke==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));P.current=setTimeout(()=>{Me(!1),vt(null),$==null||$()},H+25)}},[Ie]);const Pt=H=>{K(re=>$o(re,H)?re:H)},Ht=(H=v)=>{gt(J),Ue?Ee(!0):J.current=setTimeout(()=>{Ee(!0)},H)},Dt=(H=I)=>{gt(ae),ae.current=setTimeout(()=>{Be.current||Ee(!1)},H)},rn=H=>{var re;if(!H)return;const se=(re=H.currentTarget)!==null&&re!==void 0?re:H.target;if(!(se!=null&&se.isConnected))return L(null),void wt({current:null});v?Ht():Ee(!0),L(se),wt({current:se}),gt(ae)},et=()=>{b?Dt(I||100):I?Dt():Ee(!1),gt(J)},Mt=({x:H,y:re})=>{var se;const Ae={getBoundingClientRect:()=>({x:H,y:re,width:0,height:0,top:re,left:H,right:H,bottom:re})};Os({place:(se=he==null?void 0:he.place)!==null&&se!==void 0?se:a,offset:c,elementReference:Ae,tooltipReference:V.current,tooltipArrowReference:Q.current,strategy:p,middlewares:m,border:F}).then(ke=>{Pt(ke)})},Bt=H=>{if(!H)return;const re=H,se={x:re.clientX,y:re.clientY};Mt(se),ot.current=se},on=H=>{var re;if(!Ie)return;const se=H.target;se.isConnected&&(!((re=V.current)===null||re===void 0)&&re.contains(se)||[document.querySelector(`[id='${o}']`),...Ve].some(Ae=>Ae==null?void 0:Ae.contains(se))||(Ee(!1),gt(J)))},qt=Ns(rn,50),Ce=Ns(et,50),Ge=H=>{Ce.cancel(),qt(H)},ne=()=>{qt.cancel(),Ce()},de=h.useCallback(()=>{var H,re;const se=(H=he==null?void 0:he.position)!==null&&H!==void 0?H:G;se?Mt(se):g?ot.current&&Mt(ot.current):D!=null&&D.isConnected&&Os({place:(re=he==null?void 0:he.place)!==null&&re!==void 0?re:a,offset:c,elementReference:D,tooltipReference:V.current,tooltipArrowReference:Q.current,strategy:p,middlewares:m,border:F}).then(Ae=>{Oe.current&&Pt(Ae)})},[Ie,D,te,W,a,he==null?void 0:he.place,c,p,G,he==null?void 0:he.position,g]);h.useEffect(()=>{var H,re;const se=new Set(yt);Ve.forEach(_e=>{ie!=null&&ie(_e)||se.add({current:_e})});const Ae=document.querySelector(`[id='${o}']`);Ae&&!(ie!=null&&ie(Ae))&&se.add({current:Ae});const ke=()=>{Ee(!1)},tt=Ts(D),Ke=Ts(V.current);it.scroll&&(window.addEventListener("scroll",ke),tt==null||tt.addEventListener("scroll",ke),Ke==null||Ke.addEventListener("scroll",ke));let qe=null;it.resize?window.addEventListener("resize",ke):D&&V.current&&(qe=kh(D,V.current,de,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const nt=_e=>{_e.key==="Escape"&&Ee(!1)};it.escape&&window.addEventListener("keydown",nt),it.clickOutsideAnchor&&window.addEventListener("click",on);const be=[],sn=_e=>{Ie&&(_e==null?void 0:_e.target)===D||rn(_e)},oo=_e=>{Ie&&(_e==null?void 0:_e.target)===D&&et()},ft=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],rr=["click","dblclick","mousedown","mouseup"];Object.entries(Rt).forEach(([_e,_t])=>{_t&&(ft.includes(_e)?be.push({event:_e,listener:Ge}):rr.includes(_e)&&be.push({event:_e,listener:sn}))}),Object.entries(Ut).forEach(([_e,_t])=>{_t&&(ft.includes(_e)?be.push({event:_e,listener:ne}):rr.includes(_e)&&be.push({event:_e,listener:oo}))}),g&&be.push({event:"pointermove",listener:Bt});const or=()=>{Be.current=!0},ir=()=>{Be.current=!1,et()};return b&&!Xe&&((H=V.current)===null||H===void 0||H.addEventListener("mouseenter",or),(re=V.current)===null||re===void 0||re.addEventListener("mouseleave",ir)),be.forEach(({event:_e,listener:_t})=>{se.forEach(bt=>{var an;(an=bt.current)===null||an===void 0||an.addEventListener(_e,_t)})}),()=>{var _e,_t;it.scroll&&(window.removeEventListener("scroll",ke),tt==null||tt.removeEventListener("scroll",ke),Ke==null||Ke.removeEventListener("scroll",ke)),it.resize?window.removeEventListener("resize",ke):qe==null||qe(),it.clickOutsideAnchor&&window.removeEventListener("click",on),it.escape&&window.removeEventListener("keydown",nt),b&&!Xe&&((_e=V.current)===null||_e===void 0||_e.removeEventListener("mouseenter",or),(_t=V.current)===null||_t===void 0||_t.removeEventListener("mouseleave",ir)),be.forEach(({event:bt,listener:an})=>{se.forEach(io=>{var jn;(jn=io.current)===null||jn===void 0||jn.removeEventListener(bt,an)})})}},[D,de,Ue,yt,Ve,k,S,B,It,v,I]),h.useEffect(()=>{var H,re;let se=(re=(H=he==null?void 0:he.anchorSelect)!==null&&H!==void 0?H:s)!==null&&re!==void 0?re:"";!se&&t&&(se=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Ae=new MutationObserver(ke=>{const tt=[],Ke=[];ke.forEach(qe=>{if(qe.type==="attributes"&&qe.attributeName==="data-tooltip-id"&&(qe.target.getAttribute("data-tooltip-id")===t?tt.push(qe.target):qe.oldValue===t&&Ke.push(qe.target)),qe.type==="childList"){if(D){const nt=[...qe.removedNodes].filter(be=>be.nodeType===1);if(se)try{Ke.push(...nt.filter(be=>be.matches(se))),Ke.push(...nt.flatMap(be=>[...be.querySelectorAll(se)]))}catch{}nt.some(be=>{var sn;return!!(!((sn=be==null?void 0:be.contains)===null||sn===void 0)&&sn.call(be,D))&&(Me(!1),Ee(!1),L(null),gt(J),gt(ae),!0)})}if(se)try{const nt=[...qe.addedNodes].filter(be=>be.nodeType===1);tt.push(...nt.filter(be=>be.matches(se))),tt.push(...nt.flatMap(be=>[...be.querySelectorAll(se)]))}catch{}}}),(tt.length||Ke.length)&&Fe(qe=>[...qe.filter(nt=>!Ke.includes(nt)),...tt])});return Ae.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Ae.disconnect()}},[t,s,he==null?void 0:he.anchorSelect,D]),h.useEffect(()=>{de()},[de]),h.useEffect(()=>{if(!(X!=null&&X.current))return()=>null;const H=new ResizeObserver(()=>{setTimeout(()=>de())});return H.observe(X.current),()=>{H.disconnect()}},[te,X==null?void 0:X.current]),h.useEffect(()=>{var H;const re=document.querySelector(`[id='${o}']`),se=[...Ve,re];D&&se.includes(D)||L((H=Ve[0])!==null&&H!==void 0?H:re)},[o,Ve,D]),h.useEffect(()=>(pe&&Ee(!0),()=>{gt(J),gt(ae)}),[]),h.useEffect(()=>{var H;let re=(H=he==null?void 0:he.anchorSelect)!==null&&H!==void 0?H: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,he==null?void 0:he.anchorSelect]),h.useEffect(()=>{J.current&&(gt(J),Ht(v))},[v]);const je=(Z=he==null?void 0:he.content)!==null&&Z!==void 0?Z:te,Ft=Ie&&Object.keys(fe.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`)}vt(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:fe.place,isOpen:!!(Ue&&!C&&je&&Ft)})),Ue&&!C&&je?h.createElement(f,{id:t,role:Y,className:ct("react-tooltip",bn.tooltip,_o.tooltip,_o[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:H=>{gt(P),Ie||H.propertyName!=="opacity"||(Me(!1),vt(null),$==null||$())},style:{...W,...fe.tooltipStyles,opacity:M!==void 0&&Ft?M:void 0},ref:V},je,h.createElement(f,{className:ct("react-tooltip-arrow",bn.arrow,_o.arrow,r,y&&bn.noArrow),style:{...fe.tooltipArrowStyles,background:R?`linear-gradient(to right bottom, transparent 50%, ${R} 50%)`:void 0},ref:Q})):null},Gh=({content:e})=>h.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),Yh=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:p="div",children:m=null,events:f=["hover"],openOnClick:v=!1,positionStrategy:I="absolute",middlewares:g,delayShow:C=0,delayHide:y=0,float:b=!1,hidden:x=!1,noArrow:_=!1,clickable:E=!1,closeOnEsc:k=!1,closeOnScroll:S=!1,closeOnResize:B=!1,openEvents:q,closeEvents:W,globalCloseEvents:G,imperativeModeOnly:ee=!1,style:$,position:ie,isOpen:te,defaultIsOpen:X=!1,disableStyleInjection:le=!1,border:pe,opacity:N,arrowColor:D,setIsOpen:L,afterShow:F,afterHide:M,disableTooltip:R,role:Y="tooltip"},Z)=>{const[V,Q]=h.useState(r),[J,ae]=h.useState(i),[P,fe]=h.useState(u),[K,Ie]=h.useState(c),[Pe,Ue]=h.useState(d),[Me,he]=h.useState(C),[vt,He]=h.useState(y),[ot,yt]=h.useState(b),[wt,Be]=h.useState(x),[Ve,Fe]=h.useState(p),[Oe,It]=h.useState(f),[Xe,Rt]=h.useState(I),[Ut,it]=h.useState(null),[Ee,Pt]=h.useState(null),Ht=h.useRef(le),{anchorRefs:Dt,activeAnchor:rn}=Ac(e),et=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;Ie((de=ne)!==null&&de!==void 0?de:c)},offset:ne=>{Ue(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??f)},"position-strategy":ne=>{var de;Rt((de=ne)!==null&&de!==void 0?de:I)},"delay-show":ne=>{he(ne===null?C:Number(ne))},"delay-hide":ne=>{He(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 je;(je=Ge[ne])===null||je===void 0||je.call(Ge,de)})};h.useEffect(()=>{Q(r)},[r]),h.useEffect(()=>{ae(i)},[i]),h.useEffect(()=>{fe(u)},[u]),h.useEffect(()=>{Ie(c)},[c]),h.useEffect(()=>{Ue(d)},[d]),h.useEffect(()=>{he(C)},[C]),h.useEffect(()=>{He(y)},[y]),h.useEffect(()=>{yt(b)},[b]),h.useEffect(()=>{Be(x)},[x]),h.useEffect(()=>{Rt(I)},[I]),h.useEffect(()=>{Ht.current!==le&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[le]),h.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:le==="core",disableBase:le}}))},[]),h.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 je=(Ce=Ee??de)!==null&&Ce!==void 0?Ce:rn.current,Ft=new MutationObserver(re=>{re.forEach(se=>{var Ae;if(!je||se.type!=="attributes"||!(!((Ae=se.attributeName)===null||Ae===void 0)&&Ae.startsWith("data-tooltip-")))return;const ke=et(je);Mt(ke)})}),H={attributes:!0,childList:!1,subtree:!1};if(je){const re=et(je);Mt(re),Ft.observe(je,H)}return()=>{Ft.disconnect()}},[Dt,rn,Ee,t,n]),h.useEffect(()=>{$!=null&&$.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),pe&&!Es("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."),N&&!Es("opacity",`${N}`)&&console.warn(`[react-tooltip] "${N}" is not a valid \`opacity\`.`)},[]);let Bt=m;const on=h.useRef(null);if(o){const Ce=o({content:(Ee==null?void 0:Ee.getAttribute("data-tooltip-content"))||V||null,activeAnchor:Ee});Bt=Ce?h.createElement("div",{ref:on,className:"react-tooltip-content-wrapper"},Ce):null}else V&&(Bt=V);J&&(Bt=h.createElement(Gh,{content:J}));const qt={forwardRef:Z,id:e,anchorId:t,anchorSelect:n,className:ct(s,Ut),classNameArrow:a,content:Bt,contentWrapperRef:on,place:P,variant:K,offset:Pe,wrapper:Ve,events:Oe,openOnClick:v,positionStrategy:Xe,middlewares:g,delayShow:Me,delayHide:vt,float:ot,hidden:wt,noArrow:_,clickable:E,closeOnEsc:k,closeOnScroll:S,closeOnResize:B,openEvents:q,closeEvents:W,globalCloseEvents:G,imperativeModeOnly:ee,style:$,position:ie,isOpen:te,defaultIsOpen:X,border:pe,opacity:N,arrowColor:D,setIsOpen:L,afterShow:F,afterHide:M,disableTooltip:R,activeAnchor:Ee,setActiveAnchor:Ce=>Pt(Ce),role:Y};return h.createElement(Xh,{...qt})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||Cs({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||Cs({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 Zh(){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 Qh({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:Zh()}),l.jsx(Yh,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function Qr({field:e,onSelectChange:t,allFields:n}){var f;const{configureState:r,selectedObjectName:i,setConfigureState:o}=pt(),[s,a]=h.useState(!0),c=(f=r==null?void 0:r.read)==null?void 0:f.selectedFieldMappings,u=c==null?void 0:c[e.mapToName];h.useEffect(()=>{e._default&&!u&&i&&r&&Jn(i,o,[{field:e.mapToName,value:e._default}]),a(!1)},[e,o,i,u,r]);const d=h.useMemo(()=>n.map(v=>({id:v.fieldName,label:v.displayName,value:v.fieldName})),[n]),p=l.jsx(vi,{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%"}}),m=h.useCallback(()=>{i&&Jn(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(Qh,{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:m,children:"clear"})]})]},e.mapToName)}const eg="_formControl_9qd8d_1",tg="_formLabel_9qd8d_5",ng="_formLabelRequired_9qd8d_11",rg="_formInput_9qd8d_16",og="_formInputInvalid_9qd8d_20",ig="_formError_9qd8d_24",sg="_disabled_9qd8d_30",un={formControl:eg,formLabel:tg,formLabelRequired:ng,formInput:rg,formInputInvalid:og,formError:ig,disabled:sg};function eo({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 ag="_divider_1kmoj_1",As={divider:ag};function to({className:e,style:t}){return l.jsx("hr",{className:e?`${As.divider} ${e}`:As.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(to,{style:{width:"100%",marginLeft:"1rem"}})})]})}function cg({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>l.jsx(eo,{id:r.mapToName,children:l.jsx(Qr,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function lg(){var d;const{selectedObjectName:e,configureState:t,setConfigureState:n}=pt(),{isError:r,removeError:i}=Nt(),o=((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],{fieldMapping:s}=Qe(),a=p=>{const{value:m,name:f}=p.target;m&&(e&&Jn(e,n,[{field:f,value:m}]),r(me.MAPPING,f)&&i(me.MAPPING,f))},c=h.useMemo(()=>!e||!s?[]:Object.values(s[e]||{}).flat().filter(p=>!p.fieldName),[s,e]),u=h.useMemo(()=>{var f;return(((f=t==null?void 0:t.read)==null?void 0:f.optionalMapFields)||[]).filter(v=>!c.some(I=>I.mapToName===v.mapToName))},[t,c]);return u.length||c.length?l.jsxs(l.Fragment,{children:[l.jsx(Fn,{string:"Map the following optional fields"}),l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[u==null?void 0:u.map(p=>l.jsx(eo,{id:p.mapToName,children:l.jsx(Qr,{allFields:o,field:p,onSelectChange:a})},p.mapToName)),(c==null?void 0:c.length)&&l.jsx(cg,{dynamicFieldMappings:c,onSelectChange:a,allFields:o})]})]}):null}function ug(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=pt(),{isError:r,removeError:i}=Nt(),o=a=>{const{value:c,name:u}=a.target;c&&(e&&Jn(e,n,[{field:u,value:c}]),r(me.MAPPING,u)&&i(me.MAPPING,u))},s=h.useMemo(()=>{var a;return((a=t==null?void 0:t.read)==null?void 0:a.requiredMapFields)||[]},[t]);return s!=null&&s.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:s.map(a=>{var c;return l.jsx(eo,{id:a.mapToName,isInvalid:r(me.MAPPING,a.mapToName),errorMessage:"* required",children:l.jsx(Qr,{allFields:((c=t==null?void 0:t.read)==null?void 0:c.allFields)||[],field:a,onSelectChange:o})},a.mapToName)})})]}):null}const dg={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function pg({children:e,style:t}){return l.jsx(en,{style:{...dg,...t},children:e})}function fg(){var d,p,m;const{project:e}=Re(),{hydratedRevision:t}=$t(),{selectedObjectName:n}=pt(),{provider:r}=Qe(),i=e==null?void 0:e.appName,o=tn(r),s=(m=(p=(d=t==null?void 0:t.content)==null?void 0:d.read)==null?void 0:p.objects)==null?void 0:m.find(f=>f.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(pg,{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 Rs(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Rc(...e){return t=>{let n=!1;const r=e.map(i=>{const o=Rs(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():Rs(e[i],null)}}}}function Xn(...e){return U.useCallback(Rc(...e),e)}function no(e,t=[]){let n=[];function r(o,s){const a=U.createContext(s),c=n.length;n=[...n,s];const u=p=>{var C;const{scope:m,children:f,...v}=p,I=((C=m==null?void 0:m[e])==null?void 0:C[c])||a,g=U.useMemo(()=>v,Object.values(v));return l.jsx(I.Provider,{value:g,children:f})};u.displayName=o+"Provider";function d(p,m){var I;const f=((I=m==null?void 0:m[e])==null?void 0:I[c])||a,v=U.useContext(f);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=>U.createContext(s));return function(a){const c=(a==null?void 0:a[e])||o;return U.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return i.scopeName=e,[r,mg(i,...t)]}function mg(...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 U.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=U.useRef(e);return U.useEffect(()=>{t.current=e}),U.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]=hg({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,a=xi(n),c=U.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 hg({defaultProp:e,onChange:t}){const n=U.useState(e),[r]=n,i=U.useRef(r),o=xi(t);return U.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}function gg(e){const t=U.useRef({value:e,previous:e});return U.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?U.useLayoutEffect:()=>{};function vg(e){const[t,n]=U.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 yg(e,t){return U.useReducer((n,r)=>t[n][r]??n,e)}var Oi=e=>{const{present:t,children:n}=e,r=wg(t),i=typeof n=="function"?n({present:r.isPresent}):U.Children.only(n),o=Xn(r.ref,Ig(i));return typeof n=="function"||r.isPresent?U.cloneElement(i,{ref:o}):null};Oi.displayName="Presence";function wg(e){const[t,n]=U.useState(),r=U.useRef({}),i=U.useRef(e),o=U.useRef("none"),s=e?"mounted":"unmounted",[a,c]=yg(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return U.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,f=Ir(u);e?c("MOUNT"):f==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&m!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,c]),Lr(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,p=f=>{const I=Ir(r.current).includes(f.animationName);if(f.target===t&&I&&(c("ANIMATION_END"),!i.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},m=f=>{f.target===t&&(o.current=Ir(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:U.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Ir(e){return(e==null?void 0:e.animationName)||"none"}function Ig(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=U.forwardRef((e,t)=>{const{children:n,...r}=e,i=U.Children.toArray(n),o=i.find(bg);if(o){const s=o.props.children,a=i.map(c=>c===o?U.Children.count(s)>1?U.Children.only(null):U.isValidElement(s)?s.props.children:null:c);return l.jsx(Uo,{...r,ref:t,children:U.isValidElement(s)?U.cloneElement(s,void 0,a):null})}return l.jsx(Uo,{...r,ref:t,children:n})});Vr.displayName="Slot";var Uo=U.forwardRef((e,t)=>{const{children:n,...r}=e;if(U.isValidElement(n)){const i=Cg(n);return U.cloneElement(n,{...xg(r,n.props),ref:t?Rc(t,i):i})}return U.Children.count(n)>1?U.Children.only(null):null});Uo.displayName="SlotClone";var _g=({children:e})=>l.jsx(l.Fragment,{children:e});function bg(e){return U.isValidElement(e)&&e.type===_g}function xg(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 Cg(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 Og=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],nn=Og.reduce((e,t)=>{const n=U.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",[Eg,Zy]=no(Ei),[Ng,Sg]=Eg(Ei),Pc=U.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,[m,f]=U.useState(null),v=Xn(t,x=>f(x)),I=U.useRef(!1),g=m?d||!!m.closest("form"):!0,[C=!1,y]=Ci({prop:i,defaultProp:o,onChange:u}),b=U.useRef(C);return U.useEffect(()=>{const x=m==null?void 0:m.form;if(x){const _=()=>y(b.current);return x.addEventListener("reset",_),()=>x.removeEventListener("reset",_)}},[m,y]),l.jsxs(Ng,{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:!_),g&&(I.current=x.isPropagationStopped(),I.current||x.stopPropagation())})}),g&&l.jsx(Tg,{control:m,bubbles:!I.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=U.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=Sg(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 Tg=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,s=U.useRef(null),a=gg(n),c=vg(t);U.useEffect(()=>{const d=s.current,p=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(p,"checked").set;if(a!==n&&f){const v=new Event("click",{bubbles:r});d.indeterminate=Gt(n),f.call(d,Gt(n)?!1:n),d.dispatchEvent(v)}},[a,n,r]);const u=U.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 jc=Pc,kc=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 Ag=["color"],Vc=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Lc(e,Ag);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"}))}),Rg=["color"],Pg=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Lc(e,Rg);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 Dg="_checkboxGroupContainer_1ya1t_1",Mg="_stack_1ya1t_6",Fg="_selectAllContainer_1ya1t_11",jg="_fieldContainer_1ya1t_18",kg="_checkbox_1ya1t_1",Pn={checkboxGroupContainer:Dg,stack:Mg,selectAllContainer:Fg,fieldContainer:jg,checkbox:kg};function Kc({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:Pn.fieldContainer,children:[l.jsx(jc,{className:Pn.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(kc,{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(jc,{className:Pn.checkbox,id:e,onCheckedChange:r,children:l.jsxs(kc,{children:[i&&l.jsx(Pg,{}),t===!0&&l.jsx(Vc,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function Uc({children:e}){return l.jsx("div",{className:Pn.checkboxGroupContainer,children:e})}function Hc({children:e}){return l.jsx("div",{className:Pn.stack,children:e})}function Lg(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=>Lg(i,n,r))}function Vg(){var p,m;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=pt(),i=(p=t==null?void 0:t.read)==null?void 0:p.selectedOptionalFields,o=(f,v)=>{f!=="indeterminate"&&r&&t&&Ps(r,n,v,f)},s=(m=t==null?void 0:t.read)==null?void 0:m.optionalFields,a=f=>{r&&s&&s.forEach(v=>{Yt(v)||Ps(r,n,v.fieldName,f)})},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(Uc,{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(Hc,{children:s.map(f=>Yt(f)?null:l.jsx(Kc,{id:f.fieldName,isChecked:!!(i!=null&&i[f==null?void 0:f.fieldName]),label:f.displayName,onCheckedChange:v=>o(v,f.fieldName)},f.fieldName))})]})]})}function Kg(){return l.jsx(Vg,{})}const $g={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 Ug({children:e,style:t,...n}){return l.jsx("span",{style:{...$g,...t},...n,children:e})}function Hg(){var r,i,o;const{configureState:e,selectedObjectName:t}=pt(),{appName:n}=Re();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(Ug,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function Bg(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 qg(e,t,n,r,i){t(e,o=>Bg(o,e,n,r,i))}function Wg(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function Jg({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(to,{style:{width:"100%",marginLeft:"1rem"}})})]})}function zg({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:i}){var y;const{configureState:o,selectedObjectName:s,setConfigureState:a}=pt(),[c,u]=h.useState(!0),{getError:d,setError:p,resetBoundary:m}=Nt(),f=h.useMemo(()=>{var b,x;return((x=(b=o==null?void 0:o.read)==null?void 0:b.selectedValueMappings)==null?void 0:x[n])||{}},[(y=o==null?void 0:o.read)==null?void 0:y.selectedValueMappings,n]),v=h.useMemo(()=>f==null?void 0:f[e.mappedValue],[f,e.mappedValue]);h.useEffect(()=>{u(!1)},[e,a,s,v,o]);const I=h.useMemo(()=>r.map(b=>({id:b.value,label:b.displayValue,value:b.value})),[r]),g=h.useCallback(b=>{if(b){if(Object.values(f).some(x=>x===b.value&&x!==v)){const x=[...Object.entries(f).filter(([_,E])=>E===b.value&&E!==v).map(([_])=>_),e.mappedValue];p(me.VALUE_MAPPING,n,x);return}d(me.VALUE_MAPPING,n)&&m(me.VALUE_MAPPING),t({target:{name:e.mappedValue,value:b.value,fieldName:n}})}},[t,f,v,n,e.mappedValue,m,p,d]),C=h.useMemo(()=>l.jsx(vi,{disabled:c,items:I,selectedValue:v||null,onSelectedItemChange:g,placeholder:"Please select one",style:{border:i?"2px solid red":void 0,borderRadius:"8px"}},v),[v,c,I,g,i]);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})}),C]},e.mappedValue)}function Xg(){var f,v,I;const{fieldMapping:e}=Qe(),{selectedObjectName:t,configureState:n,setConfigureState:r}=pt(),{isError:i,removeError:o,getError:s}=Nt(),a=(f=n==null?void 0:n.read)==null?void 0:f.selectedFieldMappings,c=(v=n==null?void 0:n.read)==null?void 0:v.selectedValueMappings,u=(I=n==null?void 0:n.read)==null?void 0:I.isValueMappingsModified,d=h.useRef(!1),p=h.useMemo(()=>{const g=t&&e?Object.values(e[t]||{}).flat().filter(C=>C.mappedValues).map(C=>({...C})):[];if(a)for(let C=0;C<g.length;C+=1)a!=null&&a[g[C].mapToName]&&(g[C].fieldName=a[g[C].mapToName]);return g},[t,e,a]),m=h.useCallback(g=>{const{value:C,name:y,fieldName:b}=g.target;C&&(t&&qg(t,r,y,C,b),i(me.VALUE_MAPPING,y)&&o(me.VALUE_MAPPING,y))},[t,r,i,o]);return h.useEffect(()=>{if(t&&c){const g=(e==null?void 0:e[t].filter(y=>y.fieldName&&y.mappedValues.length>0))||[];g.every(y=>{const b=c[y.fieldName]||{};return Object.keys(b).length===Object.keys(y.mappedValues).length})&&g.length>0?!u&&!d.current&&(Wg(t,r,!0),d.current=!0):d.current=!1}},[c,p,t,r,e,u]),p!=null&&p.length?l.jsx(l.Fragment,{children:p.map(g=>{var C,y,b,x,_,E,k,S,B,q,W,G,ee,$,ie,te;return g.fieldName?["singleSelect","multiSelect"].includes((b=(y=(C=n==null?void 0:n.read)==null?void 0:C.allFieldsMetadata)==null?void 0:y[g.fieldName])==null?void 0:b.valueType)?(E=(_=(x=n==null?void 0:n.read)==null?void 0:x.allFieldsMetadata)==null?void 0:_[g.fieldName])!=null&&E.values?(B=(S=(k=n==null?void 0:n.read)==null?void 0:k.allFieldsMetadata)==null?void 0:S[g.fieldName])!=null&&B.values&&Object.keys((g==null?void 0:g.mappedValues)||[]).length===Object.keys(((G=(W=(q=n==null?void 0:n.read)==null?void 0:q.allFieldsMetadata)==null?void 0:W[g.fieldName])==null?void 0:G.values)||[]).length?l.jsxs(l.Fragment,{children:[l.jsx(Jg,{string:"Map the values for ",fieldName:g.mapToName||g.fieldName}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.jsx(eo,{id:g.mapToName||g.fieldName,children:(te=g==null?void 0:g.mappedValues)==null?void 0:te.map(X=>{var N,D,L;const le=s(me.VALUE_MAPPING,g.fieldName),pe=Array.isArray(le)&&le.includes(X.mappedValue);return l.jsxs(l.Fragment,{children:[l.jsx(zg,{allValueOptions:((L=(D=(N=n==null?void 0:n.read)==null?void 0:N.allFieldsMetadata)==null?void 0:D[g.fieldName])==null?void 0:L.values)||[],mappedValue:X,onSelectChange:m,fieldName:(g==null?void 0:g.fieldName)||"",hasError:pe},`${X.mappedValue}-${g.fieldName}`),pe&&l.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${g.mapToName||g.fieldName} must be mapped to a unique value`},X.mappedValue)]})})},g.mapToName||g.fieldName)})]}):(console.error("field values and the values to be mapped are not of the same length",g,(ie=($=(ee=n==null?void 0:n.read)==null?void 0:ee.allFieldsMetadata)==null?void 0:$[g.fieldName])==null?void 0:ie.values),null):(console.error("field has no values array",g),null):(console.error("fieldName is not a singleSelect or multiSelect",g),null):(console.error("fieldName is undefined",g),null)})}):null}function Gg(){return Yf(),l.jsxs(l.Fragment,{children:[l.jsx(fg,{}),l.jsx(Hg,{}),l.jsx(ug,{}),l.jsx(lg,{}),l.jsx(Xg,{}),l.jsx(Kg,{})]})}const Yg="_input_10rzg_1",Zg="_inputError_10rzg_27",Qg="_error_10rzg_43",bo={input:Yg,inputError:Zg,error:Qg};function Kr({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?ct(bo.inputError,bo.input):bo.input;return l.jsx("input",{id:e,type:t,className:ct(o,n),...i})}function ev({objectName:e,onAddDefaultValue:t}){const{readAction:n,loading:r}=$t(),[i,o]=h.useState(null),[s,a]=h.useState(""),c=n&&zo(n,e),u=h.useMemo(()=>(c==null?void 0:c.allFields)||[],[c]),d=r||!u||u.length===0,p=h.useMemo(()=>u.map(g=>({id:g.fieldName,label:g.displayName,value:g.fieldName})),[u]),m=g=>{const{value:C,name:y}=g.target;C&&o({label:y,value:C})},f=g=>{const{value:C}=g.target;a(C)},v=()=>{s&&(i!=null&&i.value)&&(t(i==null?void 0:i.value,i.label,s),o(null),a(""))},I=l.jsx(vi,{style:{width:"100%"},disabled:d,items:p,selectedValue:(i==null?void 0:i.value)||null,onSelectedItemChange:g=>{m({target:{name:g==null?void 0:g.label,value:g==null?void 0:g.value}})},placeholder:"Please select field."});return l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[I,l.jsx(Kr,{id:"new-default-value",type:"text",value:s,onChange:f,style:{width:"10rem"},placeholder:"default value"}),l.jsx(Ze,{type:"button",onClick:v,variant:"ghost",children:"+"})]})}function tv(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=>{tv(o,t,n,r)})}const nv=(e,t,n)=>{var o;const r=n&&zo(n,t),i=r==null?void 0:r.allFieldsMetadata;return((o=i==null?void 0:i[e])==null?void 0:o.displayName)||e};function rv({objectName:e}){var p;const{readAction:t}=$t(),{selectedObjectName:n,configureState:r,setConfigureState:i}=pt(),o=(p=r==null?void 0:r.write)==null?void 0:p.selectedWriteObjects,s=o==null?void 0:o[e],a=h.useMemo(()=>(s==null?void 0:s.selectedValueDefaults)||{},[s]),c=h.useCallback((m,f,v)=>{Ds(n||"",e,m,v,i)},[e,n,i]),u=m=>{Ds(n||"",e,m,null,i)},d=Object.keys(a).map(m=>({field:m,defaultValue:a[m],fieldDisplayName:t?nv(m,e,t):m}));return l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{paddingBottom:"1rem",display:"flex",flexDirection:"column",gap:".5rem"},children:d.map(({field:m,fieldDisplayName:f,defaultValue:v})=>l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[l.jsx(Kr,{id:m,type:"text",disabled:!0,value:f,style:{width:"100%"}}),l.jsx(Kr,{id:`${m}-${v}`,type:"text",disabled:!0,value:v,style:{width:"10rem"}}),l.jsx(Ze,{type:"button",variant:"ghost",onClick:()=>u(m),children:"x"})]},`${m}-${v}`))}),l.jsx(ev,{objectName:e,onAddDefaultValue:c}),l.jsx("div",{style:{textAlign:"right",padding:".25rem 0",color:"var(--amp-colors-text-muted)"},children:"click + to confirm"})]})}const ov=(e,t)=>!!t.find(n=>{var r;return n.objectName===e&&((r=n==null?void 0:n.valueDefaults)==null?void 0:r.allowAnyFields)});function iv(){var i;const{configureState:e}=pt(),{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]&&ov(o.objectName,t)?l.jsxs(l.Fragment,{children:[l.jsx(Fn,{string:`Defaults for ${o.displayName} `}),l.jsx(rv,{objectName:o.objectName})]}):null)})}function sv(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=>{sv(i,n,r)})}function av(){var p,m,f,v;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=pt(),i=(p=n==null?void 0:n.write)==null?void 0:p.selectedWriteObjects,o=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects,s=(I,g)=>{I!=="indeterminate"&&t&&n&&Ms(t,r,g,I)},a=I=>{var g,C;t&&n&&((C=(g=n==null?void 0:n.write)==null?void 0:g.writeObjects)==null||C.forEach(y=>{Ms(t,r,y.objectName,I)}))},c=!!o,u=Object.keys(i||{}).length===((v=(f=n==null?void 0:n.write)==null?void 0:f.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(Uc,{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(Hc,{children:o.map(I=>l.jsx(Kc,{id:I.objectName,onCheckedChange:g=>s(g,I.objectName),isChecked:!!(i!=null&&i[I.objectName]),label:I.displayName},I.objectName))})]})]})}function cv(){return l.jsxs(l.Fragment,{children:[l.jsx(av,{}),l.jsx(iv,{})]})}function Bc({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const r=ze(),{projectId:i}=Re(),{integrationId:o,installation:s,resetInstallations:a,setIntegrationDeleted:c,onUninstallSuccess:u}=Qe(),[d,p]=h.useState(!1),m=!i||!o||!(s!=null&&s.id)||d,f=async()=>{if(!m){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(g){console.error("Error uninstalling installation."),Je(g)}finally{p(!1)}}},v=d?"Uninstalling...":e,I=l.jsx(Ze,{type:"button",onClick:f,disabled:m,variant:t,style:n,children:v});return s!=null&&s.id?I:null}function lv(){const{appName:e}=Re(),{installation:t}=Qe();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 qc({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){var E,k,S,B;const{installation:o}=Qe(),{hydratedRevision:s,loading:a}=$t(),{configureState:c,selectedObjectName:u}=pt(),d=o==null?void 0:o.config,p=d&&u&&!!da(d,u)||!1,m=((E=c==null?void 0:c.read)==null?void 0:E.isOptionalFieldsModified)||((k=c==null?void 0:c.read)==null?void 0:k.isRequiredMapFieldsModified)||((S=c==null?void 0:c.read)==null?void 0:S.isValueMappingsModified),f=(B=c==null?void 0:c.write)==null?void 0:B.isWriteModified,C=a||n||!c||!u||!(m||f||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(Hn,{}):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(Hn,{}),s&&!b&&!y&&l.jsx(Gg,{}),s&&!b&&y&&l.jsx(cv,{}),!a&&b&&l.jsx(lv,{})]})]})}const Wc=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o}=Qe(),{hydratedRevision:s,loading:a}=$t(),{selectedObjectName:c}=Sa(),{selectedConnection:u}=In(),d=ze(),{projectId:p}=Re(),{resetBoundary:m,setErrors:f,setError:v,getError:I}=Nt(),{resetConfigureState:g,objectConfigurationsState:C,resetPendingConfigurationState:y}=Zo(),b=ba(c||"",C),{onNextIncompleteTab:x}=Ff(),_=h.useCallback(()=>{m(me.INSTALLATION_MUTATION)},[m]),E=h.useCallback(S=>S?B=>{v(me.INSTALLATION_MUTATION,S,B)}:B=>{console.error("objectName is required to set installation error: ",B)},[v]),k=h.useCallback(S=>S?I(me.INSTALLATION_MUTATION,S):"",[I]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:u,apiKey:d,projectId:p,resetBoundary:m,setErrors:f,setMutateInstallationError:E,getMutateInstallationError:k,resetMutateInstallationErrorState:_,resetConfigureState:g,objectConfigurationsState:C,resetPendingConfigurationState:y,configureState:b,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:x}},uv=void 0;function dv(){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:m,getMutateInstallationError:f,resetMutateInstallationErrorState:v,resetConfigureState:I,objectConfigurationsState:g,resetPendingConfigurationState:C,configureState:y,onInstallSuccess:b,onNextIncompleteTab:x}=Wc(),[_,E]=h.useState(!1),k=s===hn,S=f(s),B=h.useCallback(()=>{d(me.MAPPING),i!=null&&i.content&&!o&&s&&ya(i,uv,s,I)},[d,i,o,s,I]);h.useEffect(()=>{!y&&(i!=null&&i.content)&&!o&&B()},[y,g,i,o,B]);const q=()=>{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,m(s),r,b).finally(()=>{E(!1),C(s),x()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},W=()=>{v(),s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&i?(E(!0),Nf(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")},G=ee=>{ee.preventDefault(),k?W():q()};return l.jsx(qc,{errorMsg:S,isCreateMode:!0,isLoading:_,onSave:G,onReset:B})}function pv({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 fv=(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},mv=(e,t,n,r,i,o,s,a,c,u,d)=>{const p=fv(o,r||"",a,a.schedule,c,a.backfill);return p?pv({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))},hv=(e,t)=>{const r={content:{write:{objects:xa(e)}}};return Br(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},gv=(e,t,n,r,i,o,s,a,c)=>{const u=hv(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 vv({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:m,resetPendingConfigurationState:f,configureState:v,onUpdateSuccess:I,onNextIncompleteTab:g}=Wc(),[C,y]=h.useState(!1),b=o===hn,x=p(o),{config:_}=e,E=h.useCallback(()=>{c(me.MAPPING),r!=null&&r.content&&!i&&o&&ya(r,_,o,m)},[c,r,i,o,_,m]);h.useEffect(()=>{v||E()},[v,E]);const k=h.useMemo(()=>{var G,ee,$;return($=(ee=(G=r==null?void 0:r.content)==null?void 0:G.read)==null?void 0:ee.objects)==null?void 0:$.find(ie=>(ie==null?void 0:ie.objectName)===o)},[r,o]),S=()=>{const{requiredMapFields:W,selectedFieldMappings:G}=(v==null?void 0:v.read)||{},{errorList:ee}=ma(W,G,u);ee.length>0||(r&&e&&o&&s&&a&&k?(y(!0),mv(a,t.id,e.id,o,s,v,n,k,r,d(o),I).finally(()=>{y(!1),f(o),g()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},B=()=>{e&&o&&s&&a&&r?(y(!0),gv(a,t.id,e.id,s,v,r,d(o),n,I).finally(()=>{y(!1),f(o),g()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},q=W=>{W.preventDefault(),b?B():S()};return l.jsx(qc,{errorMsg:x,onSave:q,onReset:E,isLoading:C})}function yv(){const{integrationObj:e,installation:t}=Qe();return e?t&&e?l.jsx(vv,{installation:t,integrationObj:e}):l.jsx(dv,{}):l.jsx(na,{message:"We can't load the integration"})}const wv=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function Iv({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:i,apiKey:o,hydratedRevision:s,setError:a,setInstallation:c,onInstallSuccess:u}){const d=wv(s,r);return d?Xo({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 _v(){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(_v,{}),l.jsx("p",{children:e}),t]})})}function bv({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 xv=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 Cv({children:e}){var b;const{projectId:t}=Re(),n=ze(),{hydratedRevision:r,loading:i}=$t(),{integrationObj:o,installation:s,groupRef:a,consumerRef:c,setInstallation:u,onInstallSuccess:d,isIntegrationDeleted:p}=Qe(),{selectedConnection:m}=In(),[f,v]=h.useState(!1),I=i||f,g=(b=r==null?void 0:r.content)==null?void 0:b.provider,C=xv(r),y=x=>{console.error("Error when creating proxy installation:",x)};return h.useEffect(()=>{!I&&r&&C&&!s&&m&&n&&(o!=null&&o.id)&&!p&&(v(!0),Iv({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(()=>{v(!1)}).catch(x=>{v(!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,p]),o?I?l.jsx(Hr,{}):C&&g&&s?l.jsx(bv,{provider:g}):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 Ov="_link_oo2kv_1",Ev={link:Ov};function zc({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return l.jsx("a",{className:ct(Ev.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 Nv="_textarea_18zl4_1",Sv="_textareaError_18zl4_14",Tv="_error_18zl4_29",xo={textarea:Nv,textareaError:Sv,error:Tv};function Av({className:e,isError:t=!1,...n}){const r=t?ct(xo.textareaError,xo.textarea):xo.textarea;return l.jsx("textarea",{className:ct(e,r),...n})}const Vt={Input:Kr,Textarea:Av};function Rv({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var I;const[o,s]=h.useState(!1),a=()=>s(g=>!g),[c,u]=h.useState(""),d=g=>u(g.currentTarget.value),p=c.length>0,m=i||!p,f=tn(e,t),v=(I=t.apiKeyOpts)==null?void 0:I.docsURL;return l.jsx(Si,{providerName:f,handleSubmit:()=>{n({apiKey:c})},error:r,isButtonDisabled:m,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[v&&l.jsx(Xc,{url:v,providerDisplayName:f,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:g=>d(g)}),l.jsx(Ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function Pv({...e}){return l.jsx(Rv,{...e})}function Dv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const u=Re(),[d,p]=h.useState(!1),[m,f]=h.useState(null),v=ze();h.useEffect(()=>{if(e&&Te&&d&&m!=null){const g={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:m};Te().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:g},{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,m]);const I=g=>{f(g.apiKey),p(!0)};return a===null?l.jsx(Pv,{provider:e,providerInfo:t,handleSubmit:I,error:null}):s}function Mv({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:p}=c,m=tn(e,t),f=(C=t.basicOpts)==null?void 0:C.docsURL,v=d.length>0,I=i||!v,g=y=>{const{name:b,value:x}=y.currentTarget;u(_=>({..._,[b]:x}))};return l.jsx(Si,{providerName:m,handleSubmit:()=>{n({user:d,pass:p})},error:r,isButtonDisabled:I,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[f&&l.jsx(Xc,{url:f,providerDisplayName:m,credentialName:"credentials"}),l.jsx(Vt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:y=>g(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=>g(y)}),l.jsx(Ze,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:o?"Hide":"Show"})]})]})})}function Fv({...e}){return l.jsx(Mv,{...e})}function jv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:a,setSelectedConnection:c}){const u=Re(),[d,p]=h.useState(!1),[m,f]=h.useState(null),v=ze();h.useEffect(()=>{if(e&&Te&&d&&m!=null){const g={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m.user,password:m.pass}};Te().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:g},{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,m,c]);const I=g=>{const{user:C,pass:y}=g;f({user:C,pass:y}),p(!0)};return a===null?l.jsx(Fv,{provider:e,providerInfo:t,handleSubmit:I,error:null}):s}function kv({...e}){return l.jsx(Si,{...e})}function Lv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,setSelectedConnection:a,providerName:c}){const u=Re(),d=ze(),[p,m]=h.useState(!1);h.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(I=>{a(I)}).catch(I=>{console.error("Error loading provider info."),Je(I)})}},[d,e,p,n,t,i,r,a,u]);const f=()=>{m(!0)};return s===null?l.jsx(kv,{handleSubmit:f,error:null,providerName:c}):o}const Vv=Wo("VITE_AMP_ENABLE_CSRF",!1),Kv=Wo("NEXT_AMP_ENABLE_CSRF",!1),$v=Wo("REACT_APP_AMP_ENABLE_CSRF",!1),Uv=!!Vv||!!Kv||!!$v,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 m=(await Te().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(g=>g.provider===i),f=tn(i,c);if(!m)throw new Error(`You must first set up a ${f} Provider App using the Ampersand Console.`);const v={connectOAuthParams:{providerWorkspaceRef:o,projectId:e,groupRef:n,groupName:a,consumerRef:t,consumerName:s,providerAppId:m.id,provider:i,enableCSRFProtection:Uv}};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,js=600,Hv="AUTHORIZATION_SUCCEEDED",Bv="AUTHORIZATION_FAILED";function qv(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 Wv(e,t,n,r){return h.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-Fs)/2,o=window.screenY+(window.outerHeight-js)/2.5,s=`width=${Fs},height=${js},left=${i},top=${o}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function Jv(e,t){return h.useCallback(n=>{var r,i;if(n.origin===Up){if(n.data.eventType===Hv){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===Bv&&(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}=Re(),[a,c]=h.useState(null),[u,d]=h.useState(null),{setSelectedConnection:p}=In(),m=Jv(c,r),f=Wv(n,d,m,t),v=qv(s,o,p);return h.useEffect(()=>{t&&!u&&f()},[t,u,f,m,n]),h.useEffect(()=>{a&&v(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,p,v,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 zv({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 Xv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Re(),a=ze(),[c,u]=h.useState(null),[d,p]=h.useState(null),m=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")}},f=h.useCallback(v=>{p(v),u(null)},[]);return l.jsx(Yc,{windowTitle:`Connect to ${o}`,oauthUrl:c,onError:f,children:l.jsx(zv,{handleSubmit:m,error:d,providerName:o})})}const Gv="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function Yv({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:Gv,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 Zv({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 Qv="salesforce";function ey({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=Re(),a=ze(),[c,u]=h.useState(""),[d,p]=h.useState(null),[m,f]=h.useState(null),v=async()=>{if(f(null),!c){f("Workspace is required");return}try{const C=await Gc(s,t,r,a,e,c,n,i);p(C)}catch(C){console.error(C),f((C==null?void 0:C.message)??"Unexpected error")}},I=h.useCallback(C=>{f(C),p(null)},[]),g=e===Qv?l.jsx(Yv,{handleSubmit:v,setWorkspace:u,error:m,isButtonDisabled:c.length===0}):l.jsx(Zv,{handleSubmit:v,setWorkspace:u,error:m,isButtonDisabled:c.length===0,providerName:o});return l.jsx(Yc,{windowTitle:`Connect to ${o}`,oauthUrl:d,onError:I,children:g})}function ty({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(_=>!_),p=_=>{const{name:E,value:k}=_.currentTarget;u(S=>({...S,[E]:k}))},{clientSecret:m,clientId:f,workspace:v,scopes:I}=c,g=m.length>0,C=f.length>0,y=o?v.length>0:!0,b=n||!g||!C||!y,x=()=>{const _={clientId:f,clientSecret:m};o&&(_.workspace=v),i&&I.length>0&&(_.scopes=cf(I)),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 ny({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c,setSelectedConnection:u}){const{projectId:d}=Re(),p=ze(),[m,f]=h.useState(null),v=async I=>{f(null);const g={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:g},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(C=>{u(C)}).catch(C=>{console.error("Error loading provider info."),Je(C),f("Error loading provider info")})};return c===null?l.jsx(ty,{providerName:t,handleSubmit:v,error:m,explicitScopesRequired:s,explicitWorkspaceRequired:a}):l.jsx(Hn,{})}function ry({...e}){return l.jsx(ny,{...e})}const oy="authorizationCode",iy="authorizationCodePKCE",sy="clientCredentials";function ay({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),m={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:p};return c===oy||c===iy?d?l.jsx(ey,{...m}):l.jsx(Xv,{...m}):c===sy?l.jsx(ry,{...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 cy(e){const{selectedConnection:t}=In();h.useEffect(()=>{e&&t&&e(t)},[e,t])}function ly({onSuccess:e}){cy(e)}const uy=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]=h.useState(null),{provider:m,isIntegrationDeleted:f}=Qe(),{selectedConnection:v,setSelectedConnection:I}=In();ly({onSuccess:s});const g=e||m,C=(d==null?void 0:d.displayName)??Bn(g);if(h.useEffect(()=>{uy(u,g).then(b=>{p(b)}).catch(b=>{console.error("Error loading provider info."),Je(b)})},[u,g]),!e&&!m)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(f)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:g,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:v,setSelectedConnection:I,providerName:C,providerInfo:d,onDisconnectSuccess:a};return d.authType==="none"?l.jsx(Lv,{...y,children:o}):d.authType==="basic"?l.jsx(jv,{...y,children:o}):d.authType==="apiKey"?l.jsx(Dv,{...y,children:o}):l.jsx(ay,{...y})}function dy(e){const t=e+"CollectionProvider",[n,r]=no(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=f=>{const{scope:v,children:I}=f,g=h.useRef(null),C=h.useRef(new Map).current;return l.jsx(i,{scope:v,itemMap:C,collectionRef:g,children:I})};s.displayName=t;const a=e+"CollectionSlot",c=h.forwardRef((f,v)=>{const{scope:I,children:g}=f,C=o(a,I),y=Xn(v,C.collectionRef);return l.jsx(Vr,{ref:y,children:g})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",p=h.forwardRef((f,v)=>{const{scope:I,children:g,...C}=f,y=h.useRef(null),b=Xn(v,y),x=o(u,I);return h.useEffect(()=>(x.itemMap.set(y,{ref:y,...C}),()=>void x.itemMap.delete(y))),l.jsx(Vr,{[d]:"",ref:b,children:g})});p.displayName=u;function m(f){const v=o(e+"CollectionConsumer",f);return h.useCallback(()=>{const g=v.collectionRef.current;if(!g)return[];const C=Array.from(g.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},m,r]}var py=U.useId||(()=>{}),fy=0;function Qc(e){const[t,n]=U.useState(py());return Lr(()=>{e||n(r=>r??String(fy++))},[e]),e||(t?`radix-${t}`:"")}var my=U.createContext(void 0);function el(e){const t=U.useContext(my);return e||t||"ltr"}var Co="rovingFocusGroup.onEntryFocus",hy={bubbles:!1,cancelable:!0},ro="RovingFocusGroup",[Ho,tl,gy]=dy(ro),[vy,nl]=no(ro,[gy]),[yy,wy]=vy(ro),rl=U.forwardRef((e,t)=>l.jsx(Ho.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Ho.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Iy,{...e,ref:t})})}));rl.displayName=ro;var Iy=U.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,m=U.useRef(null),f=Xn(t,m),v=el(o),[I=null,g]=Ci({prop:s,defaultProp:a,onChange:c}),[C,y]=U.useState(!1),b=xi(u),x=tl(n),_=U.useRef(!1),[E,k]=U.useState(0);return U.useEffect(()=>{const S=m.current;if(S)return S.addEventListener(Co,b),()=>S.removeEventListener(Co,b)},[b]),l.jsx(yy,{scope:n,orientation:r,dir:v,loop:i,currentTabStopId:I,onItemFocus:U.useCallback(S=>g(S),[g]),onItemShiftTab:U.useCallback(()=>y(!0),[]),onFocusableItemAdd:U.useCallback(()=>k(S=>S+1),[]),onFocusableItemRemove:U.useCallback(()=>k(S=>S-1),[]),children:l.jsx(nn.div,{tabIndex:C||E===0?-1:0,"data-orientation":r,...p,ref:f,style:{outline:"none",...e.style},onMouseDown:Ct(e.onMouseDown,()=>{_.current=!0}),onFocus:Ct(e.onFocus,S=>{const B=!_.current;if(S.target===S.currentTarget&&B&&!C){const q=new CustomEvent(Co,hy);if(S.currentTarget.dispatchEvent(q),!q.defaultPrevented){const W=x().filter(te=>te.focusable),G=W.find(te=>te.active),ee=W.find(te=>te.id===I),ie=[G,ee,...W].filter(Boolean).map(te=>te.ref.current);sl(ie,d)}}_.current=!1}),onBlur:Ct(e.onBlur,()=>y(!1))})})}),ol="RovingFocusGroupItem",il=U.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,a=Qc(),c=o||a,u=wy(ol,n),d=u.currentTabStopId===c,p=tl(n),{onFocusableItemAdd:m,onFocusableItemRemove:f}=u;return U.useEffect(()=>{if(r)return m(),()=>f()},[r,m,f]),l.jsx(Ho.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 I=xy(v,u.orientation,u.dir);if(I!==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(I==="last")C.reverse();else if(I==="prev"||I==="next"){I==="prev"&&C.reverse();const y=C.indexOf(v.currentTarget);C=u.loop?Cy(C,y+1):C.slice(y+1)}setTimeout(()=>sl(C))}})})})});il.displayName=ol;var _y={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function by(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function xy(e,t,n){const r=by(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return _y[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 Cy(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Oy=rl,Ey=il,Ti="Tabs",[Ny,Qy]=no(Ti,[nl]),al=nl(),[Sy,Ai]=Ny(Ti),cl=U.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,m]=Ci({prop:r,onChange:i,defaultProp:o});return l.jsx(Sy,{scope:n,baseId:Qc(),value:p,onValueChange:m,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=U.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=Ai(ll,n),s=al(n);return l.jsx(Oy,{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=U.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=Ai(dl,n),a=al(n),c=ml(s.baseId,r),u=hl(s.baseId,r),d=r===s.value;return l.jsx(Ey,{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",Ty=U.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,a=Ai(fl,n),c=ml(a.baseId,r),u=hl(a.baseId,r),d=r===a.value,p=U.useRef(d);return U.useEffect(()=>{const m=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(Oi,{present:i||d,children:({present:m})=>l.jsx(nn.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:p.current?"0s":void 0},children:m&&o})})});Ty.displayName=fl;function ml(e,t){return`${e}-trigger-${t}`}function hl(e,t){return`${e}-content-${t}`}var Ay=cl,Ry=ul,gl=pl;const Py=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 Dy(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?Py: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 My(){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 Fy="_tabsRoot_ktpr0_1",jy="_tabsList_ktpr0_6",ky="_tabTrigger_ktpr0_12",Ly="_danger_ktpr0_29",Gn={tabsRoot:Fy,tabsList:jy,tabTrigger:ky,danger:Ly};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:[Dy(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 Vy({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(to,{style:{margin:"1rem 0"}}),l.jsx(vl,{objectName:hn,completed:e,pending:t,displayName:n},"other-write")]})}function Ky(){return l.jsxs(l.Fragment,{children:[l.jsx(to,{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:[My(),l.jsx("span",{children:"Uninstall"})]})})]})}function $y({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:i,showUninstallButton:o}){var s,a;return l.jsx(Ay,{value:e,className:Gn.tabsRoot,onValueChange:n,children:l.jsxs(Ry,{className:Gn.tabsList,children:[t.map(c=>{var u,d,p,m,f,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)||((m=(p=r==null?void 0:r[c.name])==null?void 0:p.read)==null?void 0:m.isRequiredMapFieldsModified)||((v=(f=r==null?void 0:r[c.name])==null?void 0:f.read)==null?void 0:v.isValueMappingsModified)||!1},c.name)}),i&&l.jsx(Vy,{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(Ky,{})]})})}function Uy(e,t){return t===Nr?{name:Nr,completed:!1}:e.find(n=>n.name===t)}function Hy({children:e}){var C;const{project:t}=Re(),{installation:n,provider:r}=Qe(),{hydratedRevision:i}=$t(),{objectConfigurationsState:o}=Zo(),[s,a]=h.useState(""),c=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=i&&pa(u,i),p=d!==null,m=!!((C=i==null?void 0:i.content)!=null&&C.write),f=m?fa(u):void 0,v=h.useMemo(()=>{const y=[...d||[]];return f&&m&&y.push(f),y},[d,f,m]),I=Uy(v,s),g=h.useCallback(()=>{const y=v.find(b=>I!==b&&!b.completed);y&&a(y.name)},[v,I]);return h.useEffect(()=>{!s&&v.length>0&&a(v[0].name)},[v,s,g]),l.jsx(Ta.Provider,{value:g,children:l.jsx(Na.Provider,{value:I==null?void 0:I.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($y,{value:s,readNavObjects:d,onValueChange:y=>a(y),objectConfigurationsState:o,writeNavObject:f,showUninstallButton:!!n})]}),e]}),l.jsx(Jc,{})]})})})}function By({...e}){return l.jsx(Hy,{...e})}function qy({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}=Re(),{isLoading:m}=qo(),{isError:f,errorState:v}=Nt(),{seed:I,reset:g}=ca();return p||m?l.jsx(Hr,{}):f(me.PROJECT,d)?l.jsx(Kt,{message:`Error loading project ${d}`}):f(me.INTEGRATION_LIST,d)?l.jsx(Kt,{message:"Error retrieving integrations for the project, double check the API key"}):(C=v[me.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:g,children:l.jsx(Mf,{projectId:u,children:l.jsx(Cv,{children:l.jsx(zf,{children:l.jsx(By,{children:l.jsx(yv,{})})})})})})})},I)})}function Wy(){return l.jsxs(Dn,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(Hn,{}),l.jsx("p",{children:"Redirecting"})]})}function Jy({redirectURL:e,children:t}){return h.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(Wy,{}):t}function zy({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:i}){const o=ze(),{projectId:s}=Re(),{selectedConnection:a,setConnections:c}=In(),[u,d]=h.useState(!1),p=!s||!a||!a.id||u,m=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(I=>{c(I),i()}).catch(I=>{Je(I)})}catch(I){console.error("Error deleting connection."),Je(I)}finally{d(!1)}}},f=u?"Disconnecting...":e;return l.jsx(Ze,{type:"button",onClick:m,disabled:p,variant:t,style:n,children:f})}function Xy({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Re(),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(zy,{resetComponent:n,onDisconnectSuccess:t,buttonText:"Remove Connection",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}function Gy({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=h.useCallback(m=>{s?s(m.id):c&&c(m)},[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(Jy,{redirectURL:o,children:l.jsx(Xy,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},u)}const Yy=(e,t)=>{const n=ze(),{projectId:r,isLoading:i}=Re(),{integrations:o}=qo(),[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 p=h.useMemo(()=>o==null?void 0:o.reduce((m,f)=>(f==null?void 0:f.name)===e?f:m,{}),[o,e]);return h.useEffect(()=>{!p||i||Te().installationApi.listInstallations({projectIdOrName:r,integrationId:p.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,p,i]),{isLoaded:s,isIntegrationInstalled:c}};exports.AmpersandContext=ta;exports.AmpersandProvider=Jp;exports.ConnectProvider=Gy;exports.FieldMapping=Qr;exports.InstallIntegration=qy;exports.useAmpersandProvider=zp;exports.useIsIntegrationInstalled=Yy;
48
+ */const Rv="react-tooltip-core-styles",Av="react-tooltip-base-styles",uc={core:!1,base:!1};function dc({css:e,id:t=Av,type:n="base",ref:r}){var o,i;if(!e||typeof document>"u"||uc[n]||n==="core"&&typeof process<"u"&&(!((o=process==null?void 0:process.env)===null||o===void 0)&&o.REACT_TOOLTIP_DISABLE_CORE_STYLES)||n!=="base"&&typeof process<"u"&&(!((i=process==null?void 0:process.env)===null||i===void 0)&&i.REACT_TOOLTIP_DISABLE_BASE_STYLES))return;n==="core"&&(t=Rv),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)),uc[n]=!0}const fc=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:o=10,strategy:i="absolute",middlewares:s=[Ev(Number(o)),Nv({fallbackAxisSideDirection:"start"}),Sv({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(Tv({element:n,padding:5})),lc(e,t,{placement:r,strategy:i,middleware:c}).then(({x:u,y:d,placement:f,middlewareData:h})=>{var p,g;const v={left:`${u}px`,top:`${d}px`,border:a},{x:m,y:C}=(p=h.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",_=a&&{borderBottom:a,borderRight:a};let x=0;if(a){const b=`${a}`.match(/(\d+)px/);x=b!=null&&b[1]?Number(b[1]):1}return{tooltipStyles:v,tooltipArrowStyles:{left:m!=null?`${m}px`:"",top:C!=null?`${C}px`:"",right:"",bottom:"",..._,[y]:`-${4+x}px`},place:f}})):lc(e,t,{placement:"bottom",strategy:i,middleware:c}).then(({x:u,y:d,placement:f})=>({tooltipStyles:{left:`${u}px`,top:`${d}px`},tooltipArrowStyles:{},place:f}))},pc=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),hc=(e,t,n)=>{let r=null;const o=function(...i){const s=()=>{r=null};!r&&(e.apply(this,i),r=setTimeout(s,t))};return o.cancel=()=>{r&&(clearTimeout(r),r=null)},o},mc=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",hs=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((o,i)=>hs(o,t[i]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!mc(e)||!mc(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(o=>hs(e[o],t[o]))},Pv=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"})},gc=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(Pv(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},Dv=typeof window<"u"?w.useLayoutEffect:w.useEffect,Nt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},Fv="DEFAULT_TOOLTIP_ID",Mv={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},jv=w.createContext({getTooltipData:()=>Mv});function ju(e=Fv){return w.useContext(jv).getTooltipData(e)}var ar={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"},Fo={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 kv=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:o="dark",anchorId:i,anchorSelect:s,place:a="top",offset:c=10,events:u=["hover"],openOnClick:d=!1,positionStrategy:f="absolute",middlewares:h,wrapper:p,delayShow:g=0,delayHide:v=0,float:m=!1,hidden:C=!1,noArrow:y=!1,clickable:_=!1,closeOnEsc:x=!1,closeOnScroll:b=!1,closeOnResize:S=!1,openEvents:R,closeEvents:N,globalCloseEvents:M,imperativeModeOnly:U,style:q,position:G,afterShow:ne,afterHide:W,disableTooltip:ce,content:re,contentWrapperRef:Q,isOpen:fe,defaultIsOpen:ye=!1,setIsOpen:T,activeAnchor:j,setActiveAnchor:K,border:L,opacity:k,arrowColor:D,role:Z="tooltip"})=>{var ee;const H=w.useRef(null),te=w.useRef(null),z=w.useRef(null),ue=w.useRef(null),F=w.useRef(null),[ve,B]=w.useState({tooltipStyles:{},tooltipArrowStyles:{},place:a}),[Ee,Ve]=w.useState(!1),[Ge,$e]=w.useState(!1),[Ie,At]=w.useState(null),Xe=w.useRef(!1),gt=w.useRef(null),{anchorRefs:Pt,setActiveAnchor:Dt}=ju(t),Qe=w.useRef(!1),[We,Ue]=w.useState([]),Ae=w.useRef(!1),Ft=d||u.includes("click"),nt=Ft||(R==null?void 0:R.click)||(R==null?void 0:R.dblclick)||(R==null?void 0:R.mousedown),Yt=R?{...R}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!R&&Ft&&Object.assign(Yt,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const fn=N?{...N}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!N&&Ft&&Object.assign(fn,{mouseleave:!1,blur:!1,mouseout:!1});const yt=M?{...M}:{escape:x||!1,scroll:b||!1,resize:S||!1,clickOutsideAnchor:nt||!1};U&&(Object.assign(Yt,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(fn,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(yt,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),Dv(()=>(Ae.current=!0,()=>{Ae.current=!1}),[]);const Pe=J=>{Ae.current&&(J&&$e(!0),setTimeout(()=>{Ae.current&&(T==null||T(J),fe===void 0&&Ve(J))},10))};w.useEffect(()=>{if(fe===void 0)return()=>null;fe&&$e(!0);const J=setTimeout(()=>{Ve(fe)},10);return()=>{clearTimeout(J)}},[fe]),w.useEffect(()=>{if(Ee!==Xe.current)if(Nt(F),Xe.current=Ee,Ee)ne==null||ne();else{const J=(oe=>{const le=oe.match(/^([\d.]+)(ms|s)$/);if(!le)return 0;const[,ke,He]=le;return Number(ke)*(He==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));F.current=setTimeout(()=>{$e(!1),At(null),W==null||W()},J+25)}},[Ee]);const Zt=J=>{B(oe=>hs(oe,J)?oe:J)},pn=(J=g)=>{Nt(z),Ge?Pe(!0):z.current=setTimeout(()=>{Pe(!0)},J)},en=(J=v)=>{Nt(ue),ue.current=setTimeout(()=>{Qe.current||Pe(!1)},J)},Mn=J=>{var oe;if(!J)return;const le=(oe=J.currentTarget)!==null&&oe!==void 0?oe:J.target;if(!(le!=null&&le.isConnected))return K(null),void Dt({current:null});g?pn():Pe(!0),K(le),Dt({current:le}),Nt(ue)},dt=()=>{_?en(v||100):v?en():Pe(!1),Nt(z)},tn=({x:J,y:oe})=>{var le;const ke={getBoundingClientRect:()=>({x:J,y:oe,width:0,height:0,top:oe,left:J,right:J,bottom:oe})};fc({place:(le=Ie==null?void 0:Ie.place)!==null&&le!==void 0?le:a,offset:c,elementReference:ke,tooltipReference:H.current,tooltipArrowReference:te.current,strategy:f,middlewares:h,border:L}).then(He=>{Zt(He)})},hn=J=>{if(!J)return;const oe=J,le={x:oe.clientX,y:oe.clientY};tn(le),gt.current=le},jn=J=>{var oe;if(!Ee)return;const le=J.target;le.isConnected&&(!((oe=H.current)===null||oe===void 0)&&oe.contains(le)||[document.querySelector(`[id='${i}']`),...We].some(ke=>ke==null?void 0:ke.contains(le))||(Pe(!1),Nt(z)))},mn=hc(Mn,50),Re=hc(dt,50),rt=J=>{Re.cancel(),mn(J)},ie=()=>{mn.cancel(),Re()},he=w.useCallback(()=>{var J,oe;const le=(J=Ie==null?void 0:Ie.position)!==null&&J!==void 0?J:G;le?tn(le):m?gt.current&&tn(gt.current):j!=null&&j.isConnected&&fc({place:(oe=Ie==null?void 0:Ie.place)!==null&&oe!==void 0?oe:a,offset:c,elementReference:j,tooltipReference:H.current,tooltipArrowReference:te.current,strategy:f,middlewares:h,border:L}).then(ke=>{Ae.current&&Zt(ke)})},[Ee,j,re,q,a,Ie==null?void 0:Ie.place,c,f,G,Ie==null?void 0:Ie.position,m]);w.useEffect(()=>{var J,oe;const le=new Set(Pt);We.forEach(Se=>{ce!=null&&ce(Se)||le.add({current:Se})});const ke=document.querySelector(`[id='${i}']`);ke&&!(ce!=null&&ce(ke))&&le.add({current:ke});const He=()=>{Pe(!1)},ft=gc(j),Je=gc(H.current);yt.scroll&&(window.addEventListener("scroll",He),ft==null||ft.addEventListener("scroll",He),Je==null||Je.addEventListener("scroll",He));let Ye=null;yt.resize?window.addEventListener("resize",He):j&&H.current&&(Ye=Ov(j,H.current,he,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const pt=Se=>{Se.key==="Escape"&&Pe(!1)};yt.escape&&window.addEventListener("keydown",pt),yt.clickOutsideAnchor&&window.addEventListener("click",jn);const Ne=[],kn=Se=>{Ee&&(Se==null?void 0:Se.target)===j||Mn(Se)},go=Se=>{Ee&&(Se==null?void 0:Se.target)===j&&dt()},Ot=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],ui=["click","dblclick","mousedown","mouseup"];Object.entries(Yt).forEach(([Se,Mt])=>{Mt&&(Ot.includes(Se)?Ne.push({event:Se,listener:rt}):ui.includes(Se)&&Ne.push({event:Se,listener:kn}))}),Object.entries(fn).forEach(([Se,Mt])=>{Mt&&(Ot.includes(Se)?Ne.push({event:Se,listener:ie}):ui.includes(Se)&&Ne.push({event:Se,listener:go}))}),m&&Ne.push({event:"pointermove",listener:hn});const di=()=>{Qe.current=!0},fi=()=>{Qe.current=!1,dt()};return _&&!nt&&((J=H.current)===null||J===void 0||J.addEventListener("mouseenter",di),(oe=H.current)===null||oe===void 0||oe.addEventListener("mouseleave",fi)),Ne.forEach(({event:Se,listener:Mt})=>{le.forEach(jt=>{var Ln;(Ln=jt.current)===null||Ln===void 0||Ln.addEventListener(Se,Mt)})}),()=>{var Se,Mt;yt.scroll&&(window.removeEventListener("scroll",He),ft==null||ft.removeEventListener("scroll",He),Je==null||Je.removeEventListener("scroll",He)),yt.resize?window.removeEventListener("resize",He):Ye==null||Ye(),yt.clickOutsideAnchor&&window.removeEventListener("click",jn),yt.escape&&window.removeEventListener("keydown",pt),_&&!nt&&((Se=H.current)===null||Se===void 0||Se.removeEventListener("mouseenter",di),(Mt=H.current)===null||Mt===void 0||Mt.removeEventListener("mouseleave",fi)),Ne.forEach(({event:jt,listener:Ln})=>{le.forEach(yo=>{var Mr;(Mr=yo.current)===null||Mr===void 0||Mr.removeEventListener(jt,Ln)})})}},[j,he,Ge,Pt,We,R,N,M,Ft,g,v]),w.useEffect(()=>{var J,oe;let le=(oe=(J=Ie==null?void 0:Ie.anchorSelect)!==null&&J!==void 0?J:s)!==null&&oe!==void 0?oe:"";!le&&t&&(le=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const ke=new MutationObserver(He=>{const ft=[],Je=[];He.forEach(Ye=>{if(Ye.type==="attributes"&&Ye.attributeName==="data-tooltip-id"&&(Ye.target.getAttribute("data-tooltip-id")===t?ft.push(Ye.target):Ye.oldValue===t&&Je.push(Ye.target)),Ye.type==="childList"){if(j){const pt=[...Ye.removedNodes].filter(Ne=>Ne.nodeType===1);if(le)try{Je.push(...pt.filter(Ne=>Ne.matches(le))),Je.push(...pt.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}pt.some(Ne=>{var kn;return!!(!((kn=Ne==null?void 0:Ne.contains)===null||kn===void 0)&&kn.call(Ne,j))&&($e(!1),Pe(!1),K(null),Nt(z),Nt(ue),!0)})}if(le)try{const pt=[...Ye.addedNodes].filter(Ne=>Ne.nodeType===1);ft.push(...pt.filter(Ne=>Ne.matches(le))),ft.push(...pt.flatMap(Ne=>[...Ne.querySelectorAll(le)]))}catch{}}}),(ft.length||Je.length)&&Ue(Ye=>[...Ye.filter(pt=>!Je.includes(pt)),...ft])});return ke.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{ke.disconnect()}},[t,s,Ie==null?void 0:Ie.anchorSelect,j]),w.useEffect(()=>{he()},[he]),w.useEffect(()=>{if(!(Q!=null&&Q.current))return()=>null;const J=new ResizeObserver(()=>{setTimeout(()=>he())});return J.observe(Q.current),()=>{J.disconnect()}},[re,Q==null?void 0:Q.current]),w.useEffect(()=>{var J;const oe=document.querySelector(`[id='${i}']`),le=[...We,oe];j&&le.includes(j)||K((J=We[0])!==null&&J!==void 0?J:oe)},[i,We,j]),w.useEffect(()=>(ye&&Pe(!0),()=>{Nt(z),Nt(ue)}),[]),w.useEffect(()=>{var J;let oe=(J=Ie==null?void 0:Ie.anchorSelect)!==null&&J!==void 0?J:s;if(!oe&&t&&(oe=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),oe)try{const le=Array.from(document.querySelectorAll(oe));Ue(le)}catch{Ue([])}},[t,s,Ie==null?void 0:Ie.anchorSelect]),w.useEffect(()=>{z.current&&(Nt(z),pn(g))},[g]);const qe=(ee=Ie==null?void 0:Ie.content)!==null&&ee!==void 0?ee:re,nn=Ee&&Object.keys(ve.tooltipStyles).length>0;return w.useImperativeHandle(e,()=>({open:J=>{if(J!=null&&J.anchorSelect)try{document.querySelector(J.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${J.anchorSelect}" is not a valid CSS selector`)}At(J??null),J!=null&&J.delay?pn(J.delay):Pe(!0)},close:J=>{J!=null&&J.delay?en(J.delay):Pe(!1)},activeAnchor:j,place:ve.place,isOpen:!!(Ge&&!C&&qe&&nn)})),Ge&&!C&&qe?w.createElement(p,{id:t,role:Z,className:It("react-tooltip",ar.tooltip,Fo.tooltip,Fo[o],n,`react-tooltip__place-${ve.place}`,ar[nn?"show":"closing"],nn?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&ar.fixed,_&&ar.clickable),onTransitionEnd:J=>{Nt(F),Ee||J.propertyName!=="opacity"||($e(!1),At(null),W==null||W())},style:{...q,...ve.tooltipStyles,opacity:k!==void 0&&nn?k:void 0},ref:H},qe,w.createElement(p,{className:It("react-tooltip-arrow",ar.arrow,Fo.arrow,r,y&&ar.noArrow),style:{...ve.tooltipArrowStyles,background:D?`linear-gradient(to right bottom, transparent 50%, ${D} 50%)`:void 0},ref:te})):null},Lv=({content:e})=>w.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),Vv=w.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:o,render:i,className:s,classNameArrow:a,variant:c="dark",place:u="top",offset:d=10,wrapper:f="div",children:h=null,events:p=["hover"],openOnClick:g=!1,positionStrategy:v="absolute",middlewares:m,delayShow:C=0,delayHide:y=0,float:_=!1,hidden:x=!1,noArrow:b=!1,clickable:S=!1,closeOnEsc:R=!1,closeOnScroll:N=!1,closeOnResize:M=!1,openEvents:U,closeEvents:q,globalCloseEvents:G,imperativeModeOnly:ne=!1,style:W,position:ce,isOpen:re,defaultIsOpen:Q=!1,disableStyleInjection:fe=!1,border:ye,opacity:T,arrowColor:j,setIsOpen:K,afterShow:L,afterHide:k,disableTooltip:D,role:Z="tooltip"},ee)=>{const[H,te]=w.useState(r),[z,ue]=w.useState(o),[F,ve]=w.useState(u),[B,Ee]=w.useState(c),[Ve,Ge]=w.useState(d),[$e,Ie]=w.useState(C),[At,Xe]=w.useState(y),[gt,Pt]=w.useState(_),[Dt,Qe]=w.useState(x),[We,Ue]=w.useState(f),[Ae,Ft]=w.useState(p),[nt,Yt]=w.useState(v),[fn,yt]=w.useState(null),[Pe,Zt]=w.useState(null),pn=w.useRef(fe),{anchorRefs:en,activeAnchor:Mn}=ju(e),dt=Re=>Re==null?void 0:Re.getAttributeNames().reduce((rt,ie)=>{var he;return ie.startsWith("data-tooltip-")&&(rt[ie.replace(/^data-tooltip-/,"")]=(he=Re==null?void 0:Re.getAttribute(ie))!==null&&he!==void 0?he:null),rt},{}),tn=Re=>{const rt={place:ie=>{var he;ve((he=ie)!==null&&he!==void 0?he:u)},content:ie=>{te(ie??r)},html:ie=>{ue(ie??o)},variant:ie=>{var he;Ee((he=ie)!==null&&he!==void 0?he:c)},offset:ie=>{Ge(ie===null?d:Number(ie))},wrapper:ie=>{var he;Ue((he=ie)!==null&&he!==void 0?he:f)},events:ie=>{const he=ie==null?void 0:ie.split(" ");Ft(he??p)},"position-strategy":ie=>{var he;Yt((he=ie)!==null&&he!==void 0?he:v)},"delay-show":ie=>{Ie(ie===null?C:Number(ie))},"delay-hide":ie=>{Xe(ie===null?y:Number(ie))},float:ie=>{Pt(ie===null?_:ie==="true")},hidden:ie=>{Qe(ie===null?x:ie==="true")},"class-name":ie=>{yt(ie)}};Object.values(rt).forEach(ie=>ie(null)),Object.entries(Re).forEach(([ie,he])=>{var qe;(qe=rt[ie])===null||qe===void 0||qe.call(rt,he)})};w.useEffect(()=>{te(r)},[r]),w.useEffect(()=>{ue(o)},[o]),w.useEffect(()=>{ve(u)},[u]),w.useEffect(()=>{Ee(c)},[c]),w.useEffect(()=>{Ge(d)},[d]),w.useEffect(()=>{Ie(C)},[C]),w.useEffect(()=>{Xe(y)},[y]),w.useEffect(()=>{Pt(_)},[_]),w.useEffect(()=>{Qe(x)},[x]),w.useEffect(()=>{Yt(v)},[v]),w.useEffect(()=>{pn.current!==fe&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[fe]),w.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:fe==="core",disableBase:fe}}))},[]),w.useEffect(()=>{var Re;const rt=new Set(en);let ie=n;if(!ie&&e&&(ie=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ie)try{document.querySelectorAll(ie).forEach(oe=>{rt.add({current:oe})})}catch{console.warn(`[react-tooltip] "${ie}" is not a valid CSS selector`)}const he=document.querySelector(`[id='${t}']`);if(he&&rt.add({current:he}),!rt.size)return()=>null;const qe=(Re=Pe??he)!==null&&Re!==void 0?Re:Mn.current,nn=new MutationObserver(oe=>{oe.forEach(le=>{var ke;if(!qe||le.type!=="attributes"||!(!((ke=le.attributeName)===null||ke===void 0)&&ke.startsWith("data-tooltip-")))return;const He=dt(qe);tn(He)})}),J={attributes:!0,childList:!1,subtree:!1};if(qe){const oe=dt(qe);tn(oe),nn.observe(qe,J)}return()=>{nn.disconnect()}},[en,Mn,Pe,t,n]),w.useEffect(()=>{W!=null&&W.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),ye&&!pc("border",`${ye}`)&&console.warn(`[react-tooltip] "${ye}" is not a valid \`border\`.`),W!=null&&W.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),T&&!pc("opacity",`${T}`)&&console.warn(`[react-tooltip] "${T}" is not a valid \`opacity\`.`)},[]);let hn=h;const jn=w.useRef(null);if(i){const Re=i({content:(Pe==null?void 0:Pe.getAttribute("data-tooltip-content"))||H||null,activeAnchor:Pe});hn=Re?w.createElement("div",{ref:jn,className:"react-tooltip-content-wrapper"},Re):null}else H&&(hn=H);z&&(hn=w.createElement(Lv,{content:z}));const mn={forwardRef:ee,id:e,anchorId:t,anchorSelect:n,className:It(s,fn),classNameArrow:a,content:hn,contentWrapperRef:jn,place:F,variant:B,offset:Ve,wrapper:We,events:Ae,openOnClick:g,positionStrategy:nt,middlewares:m,delayShow:$e,delayHide:At,float:gt,hidden:Dt,noArrow:b,clickable:S,closeOnEsc:R,closeOnScroll:N,closeOnResize:M,openEvents:U,closeEvents:q,globalCloseEvents:G,imperativeModeOnly:ne,style:W,position:ce,isOpen:re,defaultIsOpen:Q,border:ye,opacity:T,arrowColor:j,setIsOpen:K,afterShow:L,afterHide:k,disableTooltip:D,activeAnchor:Pe,setActiveAnchor:Re=>Zt(Re),role:Z};return w.createElement(kv,{...mn})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||dc({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||dc({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 Kv(){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 $v({id:e,tooltipText:t}){return l.jsxs(l.Fragment,{children:[l.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:Kv()}),l.jsx(Vv,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}function uo({field:e,onSelectChange:t,allFields:n}){var p;const{configureState:r,selectedObjectName:o,setConfigureState:i}=Ct(),[s,a]=w.useState(!0),c=(p=r==null?void 0:r.read)==null?void 0:p.selectedFieldMappings,u=c==null?void 0:c[e.mapToName];w.useEffect(()=>{e._default&&!u&&o&&r&&Gr(o,i,[{field:e.mapToName,value:e._default}]),a(!1)},[e,i,o,u,r]);const d=w.useMemo(()=>n.map(g=>({id:g.fieldName,label:g.displayName,value:g.fieldName})),[n]),f=l.jsx(Js,{disabled:s,items:d,selectedValue:u||null,onSelectedItemChange:g=>{t({target:{name:e.mapToName,value:g==null?void 0:g.value}})},placeholder:"Please select one",style:{width:"100%"}}),h=w.useCallback(()=>{o&&Gr(o,i,[{field:e.mapToName,value:null}])},[e.mapToName,o,i]);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($v,{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:[f,l.jsx(at,{type:"button",variant:"ghost",onClick:h,children:"clear"})]})]},e.mapToName)}const Uv="_formControl_9qd8d_1",qv="_formLabel_9qd8d_5",Hv="_formLabelRequired_9qd8d_11",Bv="_formInput_9qd8d_16",Wv="_formInputInvalid_9qd8d_20",Jv="_formError_9qd8d_24",zv="_disabled_9qd8d_30",$n={formControl:Uv,formLabel:qv,formLabelRequired:Hv,formInput:Bv,formInputInvalid:Wv,formError:Jv,disabled:zv};function fo({id:e,label:t,isRequired:n=!1,isDisabled:r=!1,isInvalid:o=!1,errorMessage:i,children:s}){return l.jsxs("div",{className:It($n.formControl,{[$n.disabled]:r}),children:[t&&l.jsx("label",{htmlFor:e,className:It($n.formLabel,{[$n.formLabelRequired]:n}),children:t}),l.jsx("div",{id:e,className:It($n.formInput,{[$n.formInputInvalid]:o}),children:s}),o&&i&&l.jsx("div",{className:$n.formError,role:"alert",children:i})]})}const Gv="_divider_1kmoj_1",yc={divider:Gv};function po({className:e,style:t}){return l.jsx("hr",{className:e?`${yc.divider} ${e}`:yc.divider,style:t})}function Fr({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(po,{style:{width:"100%",marginLeft:"1rem"}})})]})}function Xv({dynamicFieldMappings:e,onSelectChange:t,allFields:n}){return e.length?l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:e.map(r=>l.jsx(fo,{id:r.mapToName,children:l.jsx(uo,{allFields:n,field:r,onSelectChange:t})},r.mapToName))}):null}function Qv(){var d;const{selectedObjectName:e,configureState:t,setConfigureState:n}=Ct(),{isError:r,removeError:o}=Ht(),i=((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],{fieldMapping:s}=ut(),a=f=>{const{value:h,name:p}=f.target;h&&(e&&Gr(e,n,[{field:p,value:h}]),r(we.MAPPING,p)&&o(we.MAPPING,p))},c=w.useMemo(()=>!e||!s?[]:Object.values(s[e]||{}).flat().filter(f=>!f.fieldName),[s,e]),u=w.useMemo(()=>{var p;return(((p=t==null?void 0:t.read)==null?void 0:p.optionalMapFields)||[]).filter(g=>!c.some(v=>v.mapToName===g.mapToName))},[t,c]);return u.length||c.length?l.jsxs(l.Fragment,{children:[l.jsx(Fr,{string:"Map the following optional fields"}),l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:[u==null?void 0:u.map(f=>l.jsx(fo,{id:f.mapToName,children:l.jsx(uo,{allFields:i,field:f,onSelectChange:a})},f.mapToName)),(c==null?void 0:c.length)&&l.jsx(Xv,{dynamicFieldMappings:c,onSelectChange:a,allFields:i})]})]}):null}function Yv(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=Ct(),{isError:r,removeError:o}=Ht(),i=a=>{const{value:c,name:u}=a.target;c&&(e&&Gr(e,n,[{field:u,value:c}]),r(we.MAPPING,u)&&o(we.MAPPING,u))},s=w.useMemo(()=>{var a;return((a=t==null?void 0:t.read)==null?void 0:a.requiredMapFields)||[]},[t]);return s!=null&&s.length?l.jsxs(l.Fragment,{children:[l.jsx(Fr,{string:"Map the following fields"}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:s.map(a=>{var c;return l.jsx(fo,{id:a.mapToName,isInvalid:r(we.MAPPING,a.mapToName),errorMessage:"* required",children:l.jsx(uo,{allFields:((c=t==null?void 0:t.read)==null?void 0:c.allFields)||[],field:a,onSelectChange:i})},a.mapToName)})})]}):null}const Zv={backgroundColor:"var(--amp-colors-bg-highlight)",borderColor:"var(--amp-colors-bg-highlight)",padding:".5rem 1rem"};function ew({children:e,style:t}){return l.jsx(Pn,{style:{...Zv,...t},children:e})}function tw(){var d,f,h;const{project:e}=Le(),{hydratedRevision:t}=dn(),{selectedObjectName:n}=Ct(),{provider:r}=ut(),o=e==null?void 0:e.appName,i=Dn(r),s=(h=(f=(d=t==null?void 0:t.content)==null?void 0:d.read)==null?void 0:f.objects)==null?void 0:h.find(p=>p.objectName===n),a=(s==null?void 0:s.displayName)||n&&Wr(n),c=s==null?void 0:s.mapToName,u=(s==null?void 0:s.mapToDisplayName)||c&&Wr(c);return u&&o&&i?l.jsx(ew,{style:{marginTop:"1rem"},children:l.jsxs("p",{style:{margin:"1rem 0"},children:[l.jsx("b",{children:u})," in ",o," is mapped to ",l.jsx("b",{children:a})," in ",i,"."]})}):null}function vc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ku(...e){return t=>{let n=!1;const r=e.map(o=>{const i=vc(o,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){const i=r[o];typeof i=="function"?i():vc(e[o],null)}}}}function Qr(...e){return $.useCallback(ku(...e),e)}function ho(e,t=[]){let n=[];function r(i,s){const a=$.createContext(s),c=n.length;n=[...n,s];const u=f=>{var C;const{scope:h,children:p,...g}=f,v=((C=h==null?void 0:h[e])==null?void 0:C[c])||a,m=$.useMemo(()=>g,Object.values(g));return l.jsx(v.Provider,{value:m,children:p})};u.displayName=i+"Provider";function d(f,h){var v;const p=((v=h==null?void 0:h[e])==null?void 0:v[c])||a,g=$.useContext(p);if(g)return g;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[u,d]}const o=()=>{const i=n.map(s=>$.createContext(s));return function(a){const c=(a==null?void 0:a[e])||i;return $.useMemo(()=>({[`__scope${e}`]:{...a,[e]:c}}),[a,c])}};return o.scopeName=e,[r,nw(o,...t)]}function nw(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:c,scopeName:u})=>{const f=c(i)[`__scope${u}`];return{...a,...f}},{});return $.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function $t(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Zs(e){const t=$.useRef(e);return $.useEffect(()=>{t.current=e}),$.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function ea({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=rw({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=Zs(n),c=$.useCallback(u=>{if(i){const f=typeof u=="function"?u(e):u;f!==e&&a(f)}else o(u)},[i,e,o,a]);return[s,c]}function rw({defaultProp:e,onChange:t}){const n=$.useState(e),[r]=n,o=$.useRef(r),i=Zs(t);return $.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function iw(e){const t=$.useRef({value:e,previous:e});return $.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Gi=globalThis!=null&&globalThis.document?$.useLayoutEffect:()=>{};function ow(e){const[t,n]=$.useState(void 0);return Gi(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const c=i.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 sw(e,t){return $.useReducer((n,r)=>t[n][r]??n,e)}var ta=e=>{const{present:t,children:n}=e,r=aw(t),o=typeof n=="function"?n({present:r.isPresent}):$.Children.only(n),i=Qr(r.ref,cw(o));return typeof n=="function"||r.isPresent?$.cloneElement(o,{ref:i}):null};ta.displayName="Presence";function aw(e){const[t,n]=$.useState(),r=$.useRef({}),o=$.useRef(e),i=$.useRef("none"),s=e?"mounted":"unmounted",[a,c]=sw(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return $.useEffect(()=>{const u=Ti(r.current);i.current=a==="mounted"?u:"none"},[a]),Gi(()=>{const u=r.current,d=o.current;if(d!==e){const h=i.current,p=Ti(u);e?c("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,c]),Gi(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const v=Ti(r.current).includes(p.animationName);if(p.target===t&&v&&(c("ANIMATION_END"),!o.current)){const m=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=m)})}},h=p=>{p.target===t&&(i.current=Ti(r.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:$.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Ti(e){return(e==null?void 0:e.animationName)||"none"}function cw(e){var r,o;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=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Xi=$.forwardRef((e,t)=>{const{children:n,...r}=e,o=$.Children.toArray(n),i=o.find(uw);if(i){const s=i.props.children,a=o.map(c=>c===i?$.Children.count(s)>1?$.Children.only(null):$.isValidElement(s)?s.props.children:null:c);return l.jsx(ms,{...r,ref:t,children:$.isValidElement(s)?$.cloneElement(s,void 0,a):null})}return l.jsx(ms,{...r,ref:t,children:n})});Xi.displayName="Slot";var ms=$.forwardRef((e,t)=>{const{children:n,...r}=e;if($.isValidElement(n)){const o=fw(n);return $.cloneElement(n,{...dw(r,n.props),ref:t?ku(t,o):o})}return $.Children.count(n)>1?$.Children.only(null):null});ms.displayName="SlotClone";var lw=({children:e})=>l.jsx(l.Fragment,{children:e});function uw(e){return $.isValidElement(e)&&e.type===lw}function dw(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function fw(e){var r,o;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=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var pw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Fn=pw.reduce((e,t)=>{const n=$.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?Xi:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),na="Checkbox",[hw,$b]=ho(na),[mw,gw]=hw(na),Lu=$.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:i,required:s,disabled:a,value:c="on",onCheckedChange:u,form:d,...f}=e,[h,p]=$.useState(null),g=Qr(t,x=>p(x)),v=$.useRef(!1),m=h?d||!!h.closest("form"):!0,[C=!1,y]=ea({prop:o,defaultProp:i,onChange:u}),_=$.useRef(C);return $.useEffect(()=>{const x=h==null?void 0:h.form;if(x){const b=()=>y(_.current);return x.addEventListener("reset",b),()=>x.removeEventListener("reset",b)}},[h,y]),l.jsxs(mw,{scope:n,state:C,disabled:a,children:[l.jsx(Fn.button,{type:"button",role:"checkbox","aria-checked":Nn(C)?"mixed":C,"aria-required":s,"data-state":$u(C),"data-disabled":a?"":void 0,disabled:a,value:c,...f,ref:g,onKeyDown:$t(e.onKeyDown,x=>{x.key==="Enter"&&x.preventDefault()}),onClick:$t(e.onClick,x=>{y(b=>Nn(b)?!0:!b),m&&(v.current=x.isPropagationStopped(),v.current||x.stopPropagation())})}),m&&l.jsx(yw,{control:h,bubbles:!v.current,name:r,value:c,checked:C,required:s,disabled:a,form:d,style:{transform:"translateX(-100%)"},defaultChecked:Nn(i)?!1:i})]})});Lu.displayName=na;var Vu="CheckboxIndicator",Ku=$.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,i=gw(Vu,n);return l.jsx(ta,{present:r||Nn(i.state)||i.state===!0,children:l.jsx(Fn.span,{"data-state":$u(i.state),"data-disabled":i.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Ku.displayName=Vu;var yw=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...i}=e,s=$.useRef(null),a=iw(n),c=ow(t);$.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=Nn(n),p.call(d,Nn(n)?!1:n),d.dispatchEvent(g)}},[a,n,r]);const u=$.useRef(Nn(n)?!1:n);return l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??u.current,...i,tabIndex:-1,ref:s,style:{...e.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Nn(e){return e==="indeterminate"}function $u(e){return Nn(e)?"indeterminate":e?"checked":"unchecked"}var Uu=Lu,qu=Ku;function Hu(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i<r.length;i++)o=r[i],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var vw=["color"],Bu=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Hu(e,vw);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),w.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"}))}),ww=["color"],Iw=w.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=Hu(e,ww);return w.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),w.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 bw="_checkboxGroupContainer_1ya1t_1",_w="_stack_1ya1t_6",xw="_selectAllContainer_1ya1t_11",Cw="_fieldContainer_1ya1t_18",Ow="_checkbox_1ya1t_1",Ar={checkboxGroupContainer:bw,stack:_w,selectAllContainer:xw,fieldContainer:Cw,checkbox:Ow};function Wu({id:e,isChecked:t,label:n,onCheckedChange:r}){return l.jsxs("div",{className:Ar.fieldContainer,children:[l.jsx(Uu,{className:Ar.checkbox,id:e,onCheckedChange:r,checked:t,children:l.jsx(qu,{children:l.jsx(Bu,{})})}),l.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Ju({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:o}){return l.jsxs("div",{className:Ar.selectAllContainer,children:[l.jsx(Uu,{className:Ar.checkbox,id:e,onCheckedChange:r,children:l.jsxs(qu,{children:[o&&l.jsx(Iw,{}),t===!0&&l.jsx(Bu,{})]})}),l.jsx("label",{htmlFor:e,children:n})]})}function zu({children:e}){return l.jsx("div",{className:Ar.checkboxGroupContainer,children:e})}function Gu({children:e}){return l.jsx("div",{className:Ar.stack,children:e})}function Ew(e,t,n){var o,i;const r=((o=e==null?void 0:e.read)==null?void 0:o.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(i=e.read)!=null&&i.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,c=!_l(s,r);e.read.isOptionalFieldsModified=c}else console.warn("read.savedConfig.optionalFields is undefined")}function wc(e,t,n,r){t(e,o=>Ew(o,n,r))}function Sw(){var f,h;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=Ct(),o=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,i=(p,g)=>{p!=="indeterminate"&&r&&t&&wc(r,n,g,p)},s=(h=t==null?void 0:t.read)==null?void 0:h.optionalFields,a=p=>{r&&s&&s.forEach(g=>{Tn(g)||wc(r,n,g.fieldName,p)})},c=!!(s&&s.length>0),u=Object.keys(o||{}).length===(s==null?void 0:s.length),d=!u&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(Fr,{string:`${e} reads the following optional fields`}),l.jsxs(zu,{children:[((s==null?void 0:s.length)||0)>=2&&l.jsx(Ju,{id:"select-all-fields",isChecked:u,label:"Select all",onCheckedChange:a,isIndeterminate:d}),l.jsx(Gu,{children:s.map(p=>Tn(p)?null:l.jsx(Wu,{id:p.fieldName,isChecked:!!(o!=null&&o[p==null?void 0:p.fieldName]),label:p.displayName,onCheckedChange:g=>i(g,p.fieldName)},p.fieldName))})]})]})}function Nw(){return l.jsx(Sw,{})}const Tw={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 Rw({children:e,style:t,...n}){return l.jsx("span",{style:{...Tw,...t},...n,children:e})}function Aw(){var r,o,i;const{configureState:e,selectedObjectName:t}=Ct(),{appName:n}=Le();return l.jsxs(l.Fragment,{children:[l.jsx(Fr,{string:`${n} reads the following ${t} fields`}),l.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:".5rem",flexWrap:"wrap"},children:(o=(r=e==null?void 0:e.read)==null?void 0:r.requiredFields)!=null&&o.length?(i=e.read)==null?void 0:i.requiredFields.map(s=>Tn(s)?null:l.jsx(Rw,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function Pw(e,t,n,r,o){e.read&&(e.read.selectedValueMappings||(e.read.selectedValueMappings={}),e.read.selectedValueMappings[o]||(e.read.selectedValueMappings[o]={}),e.read.selectedValueMappings[o][n]=r)}function Dw(e,t,n,r,o){t(e,i=>Pw(i,e,n,r,o))}function Fw(e,t,n){t(e,r=>{r.read&&(r.read.isValueMappingsModified=n)})}function Mw({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(po,{style:{width:"100%",marginLeft:"1rem"}})})]})}function jw({mappedValue:e,onSelectChange:t,fieldName:n,allValueOptions:r,hasError:o}){var y;const{configureState:i,selectedObjectName:s,setConfigureState:a}=Ct(),[c,u]=w.useState(!0),{getError:d,setError:f,resetBoundary:h}=Ht(),p=w.useMemo(()=>{var _,x;return((x=(_=i==null?void 0:i.read)==null?void 0:_.selectedValueMappings)==null?void 0:x[n])||{}},[(y=i==null?void 0:i.read)==null?void 0:y.selectedValueMappings,n]),g=w.useMemo(()=>p==null?void 0:p[e.mappedValue],[p,e.mappedValue]);w.useEffect(()=>{u(!1)},[e,a,s,g,i]);const v=w.useMemo(()=>r.map(_=>({id:_.value,label:_.displayValue,value:_.value})),[r]),m=w.useCallback(_=>{if(_){if(Object.values(p).some(x=>x===_.value&&x!==g)){const x=[...Object.entries(p).filter(([b,S])=>S===_.value&&S!==g).map(([b])=>b),e.mappedValue];f(we.VALUE_MAPPING,n,x);return}d(we.VALUE_MAPPING,n)&&h(we.VALUE_MAPPING),t({target:{name:e.mappedValue,value:_.value,fieldName:n}})}},[t,p,g,n,e.mappedValue,h,f,d]),C=w.useMemo(()=>l.jsx(Js,{disabled:c,items:v,selectedValue:g||null,onSelectedItemChange:m,placeholder:"Please select one",style:{border:o?"2px solid red":void 0,borderRadius:"8px"}},g),[g,c,v,m,o]);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})}),C]},e.mappedValue)}function kw(){var p,g,v;const{fieldMapping:e}=ut(),{selectedObjectName:t,configureState:n,setConfigureState:r}=Ct(),{isError:o,removeError:i,getError:s}=Ht(),a=(p=n==null?void 0:n.read)==null?void 0:p.selectedFieldMappings,c=(g=n==null?void 0:n.read)==null?void 0:g.selectedValueMappings,u=(v=n==null?void 0:n.read)==null?void 0:v.isValueMappingsModified,d=w.useRef(!1),f=w.useMemo(()=>{const m=t&&e?Object.values(e[t]||{}).flat().filter(C=>C.mappedValues).map(C=>({...C})):[];if(a)for(let C=0;C<m.length;C+=1)a!=null&&a[m[C].mapToName]&&(m[C].fieldName=a[m[C].mapToName]);return m},[t,e,a]),h=w.useCallback(m=>{const{value:C,name:y,fieldName:_}=m.target;C&&(t&&Dw(t,r,y,C,_),o(we.VALUE_MAPPING,y)&&i(we.VALUE_MAPPING,y))},[t,r,o,i]);return w.useEffect(()=>{if(t&&c){const m=(e==null?void 0:e[t].filter(y=>y.fieldName&&y.mappedValues.length>0))||[];m.every(y=>{const _=c[y.fieldName]||{};return Object.keys(_).length===Object.keys(y.mappedValues).length})&&m.length>0?!u&&!d.current&&(Fw(t,r,!0),d.current=!0):d.current=!1}},[c,f,t,r,e,u]),f!=null&&f.length?l.jsx(l.Fragment,{children:f.map(m=>{var C,y,_,x,b,S,R,N,M,U,q,G,ne,W,ce,re;return m.fieldName?["singleSelect","multiSelect"].includes((_=(y=(C=n==null?void 0:n.read)==null?void 0:C.allFieldsMetadata)==null?void 0:y[m.fieldName])==null?void 0:_.valueType)?(S=(b=(x=n==null?void 0:n.read)==null?void 0:x.allFieldsMetadata)==null?void 0:b[m.fieldName])!=null&&S.values?(M=(N=(R=n==null?void 0:n.read)==null?void 0:R.allFieldsMetadata)==null?void 0:N[m.fieldName])!=null&&M.values&&Object.keys((m==null?void 0:m.mappedValues)||[]).length===Object.keys(((G=(q=(U=n==null?void 0:n.read)==null?void 0:U.allFieldsMetadata)==null?void 0:q[m.fieldName])==null?void 0:G.values)||[]).length?l.jsxs(l.Fragment,{children:[l.jsx(Mw,{string:"Map the values for ",fieldName:m.mapToName||m.fieldName}),l.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:l.jsx(fo,{id:m.mapToName||m.fieldName,children:(re=m==null?void 0:m.mappedValues)==null?void 0:re.map(Q=>{var T,j,K;const fe=s(we.VALUE_MAPPING,m.fieldName),ye=Array.isArray(fe)&&fe.includes(Q.mappedValue);return l.jsxs(l.Fragment,{children:[l.jsx(jw,{allValueOptions:((K=(j=(T=n==null?void 0:n.read)==null?void 0:T.allFieldsMetadata)==null?void 0:j[m.fieldName])==null?void 0:K.values)||[],mappedValue:Q,onSelectChange:h,fieldName:(m==null?void 0:m.fieldName)||"",hasError:ye},`${Q.mappedValue}-${m.fieldName}`),ye&&l.jsx("span",{style:{color:"red",fontSize:"14px",marginTop:"4px"},children:`Each ${m.mapToName||m.fieldName} must be mapped to a unique value`},Q.mappedValue)]})})},m.mapToName||m.fieldName)})]}):(console.error("field values and the values to be mapped are not of the same length",m,(ce=(W=(ne=n==null?void 0:n.read)==null?void 0:ne.allFieldsMetadata)==null?void 0:W[m.fieldName])==null?void 0:ce.values),null):(console.error("field has no values array",m),null):(console.error("fieldName is not a singleSelect or multiSelect",m),null):(console.error("fieldName is undefined",m),null)})}):null}function Lw(){return Vg(),l.jsxs(l.Fragment,{children:[l.jsx(tw,{}),l.jsx(Aw,{}),l.jsx(Yv,{}),l.jsx(Qv,{}),l.jsx(kw,{}),l.jsx(Nw,{})]})}const Vw="_input_10rzg_1",Kw="_inputError_10rzg_27",$w="_error_10rzg_43",Mo={input:Vw,inputError:Kw,error:$w};function Qi({id:e,type:t,className:n,isError:r=!1,...o}){const i=r?It(Mo.inputError,Mo.input):Mo.input;return l.jsx("input",{id:e,type:t,className:It(i,n),...o})}function Uw({objectName:e,onAddDefaultValue:t}){const{readAction:n,loading:r}=dn(),[o,i]=w.useState(null),[s,a]=w.useState(""),c=n&&Cs(n,e),u=w.useMemo(()=>(c==null?void 0:c.allFields)||[],[c]),d=r||!u||u.length===0,f=w.useMemo(()=>u.map(m=>({id:m.fieldName,label:m.displayName,value:m.fieldName})),[u]),h=m=>{const{value:C,name:y}=m.target;C&&i({label:y,value:C})},p=m=>{const{value:C}=m.target;a(C)},g=()=>{s&&(o!=null&&o.value)&&(t(o==null?void 0:o.value,o.label,s),i(null),a(""))},v=l.jsx(Js,{style:{width:"100%"},disabled:d,items:f,selectedValue:(o==null?void 0:o.value)||null,onSelectedItemChange:m=>{h({target:{name:m==null?void 0:m.label,value:m==null?void 0:m.value}})},placeholder:"Please select field."});return l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[v,l.jsx(Qi,{id:"new-default-value",type:"text",value:s,onChange:p,style:{width:"10rem"},placeholder:"default value"}),l.jsx(at,{type:"button",onClick:g,variant:"ghost",children:"+"})]})}function qw(e,t,n,r){var o,i,s,a;if(((o=e==null?void 0:e.write)==null?void 0:o.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||(i=c[t])!=null&&i.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,f=!bl(u,c);e.write.isWriteModified=f}}}function Ic(e,t,n,r,o){o(e,i=>{qw(i,t,n,r)})}const Hw=(e,t,n)=>{var i;const r=n&&Cs(n,t),o=r==null?void 0:r.allFieldsMetadata;return((i=o==null?void 0:o[e])==null?void 0:i.displayName)||e};function Bw({objectName:e}){var f;const{readAction:t}=dn(),{selectedObjectName:n,configureState:r,setConfigureState:o}=Ct(),i=(f=r==null?void 0:r.write)==null?void 0:f.selectedWriteObjects,s=i==null?void 0:i[e],a=w.useMemo(()=>(s==null?void 0:s.selectedValueDefaults)||{},[s]),c=w.useCallback((h,p,g)=>{Ic(n||"",e,h,g,o)},[e,n,o]),u=h=>{Ic(n||"",e,h,null,o)},d=Object.keys(a).map(h=>({field:h,defaultValue:a[h],fieldDisplayName:t?Hw(h,e,t):h}));return l.jsxs(l.Fragment,{children:[l.jsx("div",{style:{paddingBottom:"1rem",display:"flex",flexDirection:"column",gap:".5rem"},children:d.map(({field:h,fieldDisplayName:p,defaultValue:g})=>l.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem"},children:[l.jsx(Qi,{id:h,type:"text",disabled:!0,value:p,style:{width:"100%"}}),l.jsx(Qi,{id:`${h}-${g}`,type:"text",disabled:!0,value:g,style:{width:"10rem"}}),l.jsx(at,{type:"button",variant:"ghost",onClick:()=>u(h),children:"x"})]},`${h}-${g}`))}),l.jsx(Uw,{objectName:e,onAddDefaultValue:c}),l.jsx("div",{style:{textAlign:"right",padding:".25rem 0",color:"var(--amp-colors-text-muted)"},children:"click + to confirm"})]})}const Ww=(e,t)=>!!t.find(n=>{var r;return n.objectName===e&&((r=n==null?void 0:n.valueDefaults)==null?void 0:r.allowAnyFields)});function Jw(){var o;const{configureState:e}=Ct(),{writeObjects:t}=dn(),n=(o=e==null?void 0:e.write)==null?void 0:o.selectedWriteObjects;return!!t&&l.jsx(l.Fragment,{children:t.map(i=>n!=null&&n[i.objectName]&&Ww(i.objectName,t)?l.jsxs(l.Fragment,{children:[l.jsx(Fr,{string:`Defaults for ${i.displayName} `}),l.jsx(Bw,{objectName:i.objectName})]}):null)})}function zw(e,t,n){var r,o,i;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],(i=(o=e==null?void 0:e.write)==null?void 0:o.savedConfig)!=null&&i.selectedWriteObjects){const a=e.write.savedConfig.selectedWriteObjects,u=!bl(a,s);e.write.isWriteModified=u}}}function bc(e,t,n,r){t(e,o=>{zw(o,n,r)})}function Gw(){var f,h,p,g;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=Ct(),o=(f=n==null?void 0:n.write)==null?void 0:f.selectedWriteObjects,i=(h=n==null?void 0:n.write)==null?void 0:h.writeObjects,s=(v,m)=>{v!=="indeterminate"&&t&&n&&bc(t,r,m,v)},a=v=>{var m,C;t&&n&&((C=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects)==null||C.forEach(y=>{bc(t,r,y.objectName,v)}))},c=!!i,u=Object.keys(o||{}).length===((g=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null?void 0:g.length),d=!u&&Object.keys(o||{}).length>0;return c&&l.jsxs(l.Fragment,{children:[l.jsx(Fr,{string:`Allow ${e} to write to these objects`}),l.jsxs(zu,{children:[((i==null?void 0:i.length)||0)>=2&&l.jsx(Ju,{id:"select-all-fields",onCheckedChange:a,isIndeterminate:d,isChecked:u,label:"Select all"}),l.jsx(Gu,{children:i.map(v=>l.jsx(Wu,{id:v.objectName,onCheckedChange:m=>s(m,v.objectName),isChecked:!!(o!=null&&o[v.objectName]),label:v.displayName},v.objectName))})]})]})}function Xw(){return l.jsxs(l.Fragment,{children:[l.jsx(Gw,{}),l.jsx(Jw,{})]})}function Xu({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={}}){const r=tt(),{projectId:o}=Le(),{integrationId:i,installation:s,resetInstallations:a,setIntegrationDeleted:c,onUninstallSuccess:u}=ut(),[d,f]=w.useState(!1),h=!o||!i||!(s!=null&&s.id)||d,p=async()=>{if(!h){f(!0),console.warn("uninstalling installation",{projectId:o,integrationId:i,installationId:s.id});try{await je().installationApi.deleteInstallation({projectIdOrName:o,integrationId:i,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(m){console.error("Error uninstalling installation."),st(m)}finally{f(!1)}}},g=d?"Uninstalling...":e,v=l.jsx(at,{type:"button",onClick:p,disabled:h,variant:t,style:n,children:g});return s!=null&&s.id?v:null}function Qw(){const{appName:e}=Le(),{installation:t}=ut();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(Xu,{buttonText:"Yes, uninstall",buttonVariant:"danger"})]})}function Qu({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:o}){var S,R,N,M;const{installation:i}=ut(),{hydratedRevision:s,loading:a}=dn(),{configureState:c,selectedObjectName:u}=Ct(),d=i==null?void 0:i.config,f=d&&u&&!!yl(d,u)||!1,h=((S=c==null?void 0:c.read)==null?void 0:S.isOptionalFieldsModified)||((R=c==null?void 0:c.read)==null?void 0:R.isRequiredMapFieldsModified)||((N=c==null?void 0:c.read)==null?void 0:N.isValueMappingsModified),p=(M=c==null?void 0:c.write)==null?void 0:M.isWriteModified,C=a||n||!c||!u||!(h||p||r||u!==er&&!f),y=u===er,_=u===Li,x=l.jsx(at,{type:"submit",disabled:C,children:r?"Install":"Save"}),b=l.jsx(at,{type:"button",onClick:t,disabled:C,variant:"ghost",children:"Reset"});return n?l.jsx(Br,{}):l.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[l.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:".8rem",marginBottom:"20px"},children:[x,b]}),l.jsxs(Pn,{style:{padding:"1rem 2rem",minHeight:"300px",backgroundColor:"var(--amp-colors-bg-primary)",borderColor:"var(--amp-colors-border)"},children:[o&&l.jsx(Rl,{children:typeof o=="string"?o:"Installation Failed."}),a&&l.jsx(Br,{}),s&&!_&&!y&&l.jsx(Lw,{}),s&&!_&&y&&l.jsx(Xw,{}),!a&&_&&l.jsx(Qw,{})]})]})}const Yu=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:o,onUpdateSuccess:i}=ut(),{hydratedRevision:s,loading:a}=dn(),{selectedObjectName:c}=Fl(),{selectedConnection:u}=or(),d=tt(),{projectId:f}=Le(),{resetBoundary:h,setErrors:p,setError:g,getError:v}=Ht(),{resetConfigureState:m,objectConfigurationsState:C,resetPendingConfigurationState:y}=Ns(),_=Nl(c||"",C),{onNextIncompleteTab:x}=xg(),b=w.useCallback(()=>{h(we.INSTALLATION_MUTATION)},[h]),S=w.useCallback(N=>N?M=>{g(we.INSTALLATION_MUTATION,N,M)}:M=>{console.error("objectName is required to set installation error: ",M)},[g]),R=w.useCallback(N=>N?v(we.INSTALLATION_MUTATION,N):"",[v]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:a,selectedObjectName:c,selectedConnection:u,apiKey:d,projectId:f,resetBoundary:h,setErrors:p,setMutateInstallationError:S,getMutateInstallationError:R,resetMutateInstallationErrorState:b,resetConfigureState:m,objectConfigurationsState:C,resetPendingConfigurationState:y,configureState:_,onInstallSuccess:o,onUpdateSuccess:i,onNextIncompleteTab:x}},Yw=void 0;function Zw(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:o,loading:i,selectedObjectName:s,selectedConnection:a,apiKey:c,projectId:u,resetBoundary:d,setErrors:f,setMutateInstallationError:h,getMutateInstallationError:p,resetMutateInstallationErrorState:g,resetConfigureState:v,objectConfigurationsState:m,resetPendingConfigurationState:C,configureState:y,onInstallSuccess:_,onNextIncompleteTab:x}=Yu(),[b,S]=w.useState(!1),R=s===er,N=p(s),M=w.useCallback(()=>{d(we.MAPPING),o!=null&&o.content&&!i&&s&&Cl(o,Yw,s,v)},[d,o,i,s,v]);w.useEffect(()=>{!y&&(o!=null&&o.content)&&!i&&M()},[y,m,o,i,M]);const U=()=>{g();const{requiredMapFields:ne,selectedFieldMappings:W}=(y==null?void 0:y.read)||{},{errorList:ce}=Il(ne,W,f);ce.length>0||(s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(S(!0),fg(u,e,t,n,a.id,s,c,o,y,h(s),r,_).finally(()=>{S(!1),C(s),x()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},q=()=>{g(),s&&(a!=null&&a.id)&&c&&u&&e&&t&&n&&o?(S(!0),mg(u,e,t,n,a.id,c,o,y,h(s),r,_).finally(()=>{S(!1),C(s),x()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},G=ne=>{ne.preventDefault(),R?q():U()};return l.jsx(Qu,{errorMsg:N,isCreateMode:!0,isLoading:b,onSave:G,onReset:M})}function eI({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:o,selectedObjectName:i,setInstallation:s,onUpdateSuccess:a,setError:c}){const u={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${i}`],installation:{config:e}}};return je().installationApi.updateInstallation(u,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(d=>{s(d),a==null||a(d.id,d.config)}).catch(d=>{st(d,c)})}const tI=(e,t,n,r,o,i)=>{const s=Ol(e),a=El(e),c=Sl(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:a,selectedValueMappings:c||{},backfill:i}}}}};return to(o)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},nI=(e,t,n,r,o,i,s,a,c,u,d)=>{const f=tI(i,r||"",a,a.schedule,c,a.backfill);return f?eI({updateConfig:f,projectId:e,integrationId:t,installationId:n,apiKey:o,selectedObjectName:r,setError:u,setInstallation:s,onUpdateSuccess:d}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},rI=(e,t)=>{const r={content:{write:{objects:Tl(e)}}};return to(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},iI=(e,t,n,r,o,i,s,a,c)=>{const u=rI(o,i);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 je().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=>{st(f,s)})};function oI({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:o,selectedObjectName:i,apiKey:s,projectId:a,resetBoundary:c,setErrors:u,setMutateInstallationError:d,getMutateInstallationError:f,resetConfigureState:h,resetPendingConfigurationState:p,configureState:g,onUpdateSuccess:v,onNextIncompleteTab:m}=Yu(),[C,y]=w.useState(!1),_=i===er,x=f(i),{config:b}=e,S=w.useCallback(()=>{c(we.MAPPING),r!=null&&r.content&&!o&&i&&Cl(r,b,i,h)},[c,r,o,i,b,h]);w.useEffect(()=>{g||S()},[g,S]);const R=w.useMemo(()=>{var G,ne,W;return(W=(ne=(G=r==null?void 0:r.content)==null?void 0:G.read)==null?void 0:ne.objects)==null?void 0:W.find(ce=>(ce==null?void 0:ce.objectName)===i)},[r,i]),N=()=>{const{requiredMapFields:q,selectedFieldMappings:G}=(g==null?void 0:g.read)||{},{errorList:ne}=Il(q,G,u);ne.length>0||(r&&e&&i&&s&&a&&R?(y(!0),nI(a,t.id,e.id,i,s,g,n,R,r,d(i),v).finally(()=>{y(!1),p(i),m()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},M=()=>{e&&i&&s&&a&&r?(y(!0),iI(a,t.id,e.id,s,g,r,d(i),n,v).finally(()=>{y(!1),p(i),m()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},U=q=>{q.preventDefault(),_?M():N()};return l.jsx(Qu,{errorMsg:x,onSave:U,onReset:S,isLoading:C})}function sI(){const{integrationObj:e,installation:t}=ut();return e?t&&e?l.jsx(oI,{installation:t,integrationObj:e}):l.jsx(Zw,{}):l.jsx(cl,{message:"We can't load the integration"})}const aI=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function cI({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:o,apiKey:i,hydratedRevision:s,setError:a,setInstallation:c,onInstallSuccess:u}){const d=aI(s,r);return d?Os({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:o,apiKey:i,setError:a,setInstallation:c,onInstallSuccess:u}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function lI(){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 ra({text:e,children:t}){return l.jsx(Pr,{children:l.jsxs(Pn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem"},children:[l.jsx(lI,{}),l.jsx("p",{children:e}),t]})})}function uI({provider:e}){const t=`You have successfully installed your ${Dn(e)} integration.`;return l.jsx(ra,{text:t,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(Xu,{buttonText:"Uninstall",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}const dI=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 fI({children:e}){var _;const{projectId:t}=Le(),n=tt(),{hydratedRevision:r,loading:o}=dn(),{integrationObj:i,installation:s,groupRef:a,consumerRef:c,setInstallation:u,onInstallSuccess:d,isIntegrationDeleted:f}=ut(),{selectedConnection:h}=or(),[p,g]=w.useState(!1),v=o||p,m=(_=r==null?void 0:r.content)==null?void 0:_.provider,C=dI(r),y=x=>{console.error("Error when creating proxy installation:",x)};return w.useEffect(()=>{!v&&r&&C&&!s&&h&&n&&(i!=null&&i.id)&&!f&&(g(!0),cI({apiKey:n,projectId:t,integrationId:i==null?void 0:i.id,groupRef:a,consumerRef:c,connectionId:h==null?void 0:h.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,h,n,t,i==null?void 0:i.id,a,c,u,v,d,f]),i?v?l.jsx(eo,{}):C&&m&&s?l.jsx(uI,{provider:m}):l.jsx("div",{children:e}):l.jsx(un,{message:"We can't load the integration"})}function Zu(){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 ai({children:e}){return l.jsx(Pr,{children:l.jsxs(Pn,{children:[l.jsx("div",{style:{padding:"3rem 2rem"},children:e}),l.jsx(Zu,{})]})})}function ci({children:e}){return l.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function li({error:e}){return e?l.jsx(Rl,{style:{marginTop:"2em"},children:e}):null}function ia({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:o,title:i}){if(!i&&!r)throw new Error("Either title or providerName is required");return l.jsxs(ai,{children:[l.jsx(ci,{children:i||`Set up ${r} integration`}),l.jsx(li,{error:t}),o,l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const pI="_link_oo2kv_1",hI={link:pI};function ed({href:e,className:t,style:n,label:r,children:o,newTab:i=!1}){return l.jsx("a",{className:It(hI.link,t),style:n,href:e,"aria-label":r||void 0,target:i?"_blank":"_self",rel:i?"noopener noreferrer":void 0,children:o})}function td({url:e,providerDisplayName:t,credentialName:n}){return l.jsxs("p",{style:{color:"var(--amp-colors-text-muted)"},children:[l.jsx(ed,{href:e,newTab:!0,children:l.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const mI="_textarea_18zl4_1",gI="_textareaError_18zl4_14",yI="_error_18zl4_29",jo={textarea:mI,textareaError:gI,error:yI};function vI({className:e,isError:t=!1,...n}){const r=t?It(jo.textareaError,jo.textarea):jo.textarea;return l.jsx("textarea",{className:It(e,r),...n})}const ln={Input:Qi,Textarea:vI};function wI({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){var v;const[i,s]=w.useState(!1),a=()=>s(m=>!m),[c,u]=w.useState(""),d=m=>u(m.currentTarget.value),f=c.length>0,h=o||!f,p=Dn(e,t),g=(v=t.apiKeyOpts)==null?void 0:v.docsURL;return l.jsx(ia,{providerName:p,handleSubmit:()=>{n({apiKey:c})},error:r,isButtonDisabled:h,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[g&&l.jsx(td,{url:g,providerDisplayName:p,credentialName:"API key"}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(ln.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"API Key",onChange:m=>d(m)}),l.jsx(at,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:i?"Hide":"Show"})]})]})})}function II({...e}){return l.jsx(wI,{...e})}function bI({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a,setSelectedConnection:c}){const u=Le(),[d,f]=w.useState(!1),[h,p]=w.useState(null),g=tt();w.useEffect(()=>{if(e&&je&&d&&h!=null){const m={groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,apiKey:h};je().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:m},{headers:{"X-Api-Key":g??"","Content-Type":"application/json"}}).then(C=>{c(C)}).catch(C=>{console.error("Error loading provider info."),st(C)})}},[g,e,d,r,n,i,o,u,c,h]);const v=m=>{p(m.apiKey),f(!0)};return a===null?l.jsx(II,{provider:e,providerInfo:t,handleSubmit:v,error:null}):s}function _I({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:o}){var C;const[i,s]=w.useState(!1),a=()=>s(y=>!y),[c,u]=w.useState({username:"",password:""}),{username:d,password:f}=c,h=Dn(e,t),p=(C=t.basicOpts)==null?void 0:C.docsURL,g=d.length>0,v=o||!g,m=y=>{const{name:_,value:x}=y.currentTarget;u(b=>({...b,[_]:x}))};return l.jsx(ia,{providerName:h,handleSubmit:()=>{n({user:d,pass:f})},error:r,isButtonDisabled:v,children:l.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[p&&l.jsx(td,{url:p,providerDisplayName:h,credentialName:"credentials"}),l.jsx(ln.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:y=>m(y)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(ln.Input,{id:"password",name:"password",type:i?"text":"password",placeholder:"Password",onChange:y=>m(y)}),l.jsx(at,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:a,children:i?"Hide":"Show"})]})]})})}function xI({...e}){return l.jsx(_I,{...e})}function CI({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,children:s,selectedConnection:a,setSelectedConnection:c}){const u=Le(),[d,f]=w.useState(!1),[h,p]=w.useState(null),g=tt();w.useEffect(()=>{if(e&&je&&d&&h!=null){const m={groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:h.user,password:h.pass}};je().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:m},{headers:{"X-Api-Key":g??"","Content-Type":"application/json"}}).then(C=>{c(C)}).catch(C=>{console.error("Error loading provider info."),st(C)})}},[g,e,d,r,n,i,o,u,h,c]);const v=m=>{const{user:C,pass:y}=m;p({user:C,pass:y}),f(!0)};return a===null?l.jsx(xI,{provider:e,providerInfo:t,handleSubmit:v,error:null}):s}function OI({...e}){return l.jsx(ia,{...e})}function EI({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,selectedConnection:s,setSelectedConnection:a,providerName:c}){const u=Le(),d=tt(),[f,h]=w.useState(!1);w.useEffect(()=>{if(e&&je&&f){const g={groupName:o,groupRef:r,consumerName:n,consumerRef:t,provider:e};je().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:g},{headers:{"X-Api-Key":d??"","Content-Type":"application/json"}}).then(v=>{a(v)}).catch(v=>{console.error("Error loading provider info."),st(v)})}},[d,e,f,n,t,o,r,a,u]);const p=()=>{h(!0)};return s===null?l.jsx(OI,{handleSubmit:p,error:null,providerName:c}):i}const SI=_s("VITE_AMP_ENABLE_CSRF",!1),NI=_s("NEXT_AMP_ENABLE_CSRF",!1),TI=_s("REACT_APP_AMP_ENABLE_CSRF",!1),RI=!!SI||!!NI||!!TI,nd=async(e,t,n,r,o,i,s,a)=>{var u,d;const c=await je().providerApi.getProvider({provider:o},{headers:{"X-Api-Key":r??""}});if(!c)throw new Error(`Provider ${o} 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 h=(await je().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(m=>m.provider===o),p=Dn(o,c);if(!h)throw new Error(`You must first set up a ${p} Provider App using the Ampersand Console.`);const g={connectOAuthParams:{providerWorkspaceRef:i,projectId:e,groupRef:n,groupName:a,consumerRef:t,consumerName:s,providerAppId:h.id,provider:o,enableCSRFProtection:RI}};return await je().oAuthApi.oauthConnect(g,{credentials:"include",headers:{"X-Api-Key":r??"","Content-Type":"application/json"}})}throw new Error(`Provider ${o} does not support an OAuth2 web flow.`)},_c=600,xc=600,AI="AUTHORIZATION_SUCCEEDED",PI="AUTHORIZATION_FAILED";function DI(e,t,n){return w.useCallback(async r=>{const o=await je().connectionApi.getConnection({projectIdOrName:e,connectionId:r},{headers:{"X-Api-Key":t??""}});n(o)},[e,t,n])}function FI(e,t,n,r){return w.useCallback(()=>{if(!r)return;const o=window.screenX+(window.outerWidth-_c)/2,i=window.screenY+(window.outerHeight-xc)/2.5,s=`width=${_c},height=${xc},left=${o},top=${i}`,a=window.open(r,e,s);t(a),window.addEventListener("message",n,!1)},[r,e,t,n])}function MI(e,t){return w.useCallback(n=>{var r,o;if(n.origin===Tm){if(n.data.eventType===AI){const i=(r=n.data.data)==null?void 0:r.connection;i?e(i):console.error("Connection ID not found in event data: ",{event:n})}n.data.eventType===PI&&(console.error("OAuth failed: ",{event:n}),t==null||t(((o=n==null?void 0:n.data)==null?void 0:o.message)??"OAuth failed. Please try again."))}},[t,e])}function rd({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:o}){const i=tt(),{projectId:s}=Le(),[a,c]=w.useState(null),[u,d]=w.useState(null),{setSelectedConnection:f}=or(),h=MI(c,r),p=FI(n,d,h,t),g=DI(s,i,f);return w.useEffect(()=>{t&&!u&&p()},[t,u,p,h,n]),w.useEffect(()=>{a&&g(a).then(()=>{u==null||u.close()}).catch(v=>{console.error("Error refreshing connection: ",v),r==null||r(v.message??"Unexpected error: not able to refresh connection")})},[a,i,f,g,u,r]),w.useEffect(()=>{if(!u)return;const v=setInterval(()=>{u.closed&&(clearInterval(v),window.removeEventListener("message",h),d(null),!a&&!o?(console.error("OAuth failed. Please try again."),r==null||r("OAuth failed. Please try again.")):a&&(r==null||r(null)))},500);return()=>{clearInterval(v),window.removeEventListener("message",h)}},[u,a,o,h,r]),l.jsx("div",{children:e})}function jI({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return l.jsxs(ai,{children:[l.jsx(ci,{children:`Set up ${r} integration`}),l.jsx(li,{error:t}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}function kI({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const{projectId:s}=Le(),a=tt(),[c,u]=w.useState(null),[d,f]=w.useState(null),h=async()=>{f(null);try{const g=await nd(s,t,r,a,e,void 0,n,o);u(g)}catch(g){console.error("Could not fetch OAuth popup URL."),st(g),f(g.message??"Unexpected error")}},p=w.useCallback(g=>{f(g),u(null)},[]);return l.jsx(rd,{windowTitle:`Connect to ${i}`,oauthUrl:c,onError:p,children:l.jsx(jI,{handleSubmit:h,error:d,providerName:i})})}const LI="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function VI({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return l.jsxs(ai,{children:[l.jsx(ci,{children:"Enter your Salesforce subdomain"}),l.jsx(ed,{href:LI,newTab:!0,children:"What is my Salesforce subdomain?"}),l.jsx(li,{error:n}),l.jsxs("div",{style:{display:"flex",marginTop:"1em",alignItems:"center"},children:[l.jsx(ln.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),l.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}function KI({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:o}){return l.jsxs(ai,{children:[l.jsxs(ci,{children:["Enter your ",o," workspace"]}),l.jsx(li,{error:n}),l.jsx("br",{}),l.jsx(ln.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:i=>t(i.currentTarget.value)}),l.jsx("br",{}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const $I="salesforce";function UI({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,providerName:i}){const{projectId:s}=Le(),a=tt(),[c,u]=w.useState(""),[d,f]=w.useState(null),[h,p]=w.useState(null),g=async()=>{if(p(null),!c){p("Workspace is required");return}try{const C=await nd(s,t,r,a,e,c,n,o);f(C)}catch(C){console.error(C),p((C==null?void 0:C.message)??"Unexpected error")}},v=w.useCallback(C=>{p(C),f(null)},[]),m=e===$I?l.jsx(VI,{handleSubmit:g,setWorkspace:u,error:h,isButtonDisabled:c.length===0}):l.jsx(KI,{handleSubmit:g,setWorkspace:u,error:h,isButtonDisabled:c.length===0,providerName:i});return l.jsx(rd,{windowTitle:`Connect to ${i}`,oauthUrl:d,onError:v,children:m})}function qI({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:o,explicitWorkspaceRequired:i}){const[s,a]=w.useState(!1),[c,u]=w.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),d=()=>a(b=>!b),f=b=>{const{name:S,value:R}=b.currentTarget;u(N=>({...N,[S]:R}))},{clientSecret:h,clientId:p,workspace:g,scopes:v}=c,m=h.length>0,C=p.length>0,y=i?g.length>0:!0,_=n||!m||!C||!y,x=()=>{const b={clientId:p,clientSecret:h};i&&(b.workspace=g),o&&v.length>0&&(b.scopes=Xm(v)),e(b)};return l.jsxs(ai,{children:[l.jsx(ci,{children:`Set up ${r} integration`}),l.jsx(li,{error:t}),l.jsx("br",{}),l.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[i&&l.jsx(ln.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:b=>f(b)}),l.jsx(ln.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:b=>f(b)}),l.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[l.jsx(ln.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:b=>f(b)}),l.jsx(at,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:d,children:s?"Hide":"Show"})]}),o&&l.jsx(ln.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:b=>f(b)})]}),l.jsx("br",{}),l.jsx(at,{style:{marginTop:"1em",width:"100%"},disabled:_,type:"submit",onClick:x,children:"Next"})]})}function HI({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,explicitScopesRequired:s,explicitWorkspaceRequired:a,selectedConnection:c,setSelectedConnection:u}){const{projectId:d}=Le(),f=tt(),[h,p]=w.useState(null),g=async v=>{p(null);const m={groupName:i,groupRef:o,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:v.workspace,oauth2ClientCredentials:{clientId:v.clientId,clientSecret:v.clientSecret,scopes:v.scopes}};je().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:m},{headers:{"X-Api-Key":f??"","Content-Type":"application/json"}}).then(C=>{u(C)}).catch(C=>{console.error("Error loading provider info."),st(C),p("Error loading provider info")})};return c===null?l.jsx(qI,{providerName:t,handleSubmit:g,error:h,explicitScopesRequired:s,explicitWorkspaceRequired:a}):l.jsx(Br,{})}function BI({...e}){return l.jsx(HI,{...e})}const WI="authorizationCode",JI="authorizationCodePKCE",zI="clientCredentials";function GI({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:o,groupName:i,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=Dn(e,t),h={provider:e,consumerRef:n,consumerName:r,groupRef:o,groupName:i,providerName:f};return c===WI||c===JI?d?l.jsx(UI,{...h}):l.jsx(kI,{...h}):c===zI?l.jsx(BI,{...h,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 XI(e){const{selectedConnection:t}=or();w.useEffect(()=>{e&&t&&e(t)},[e,t])}function QI({onSuccess:e}){XI(e)}const YI=async(e,t)=>{const n=await je().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!n)throw new Error(`Provider ${t} not found`);return n};function id({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,children:i,onSuccess:s,onDisconnectSuccess:a,resetComponent:c}){const u=tt(),[d,f]=w.useState(null),{provider:h,isIntegrationDeleted:p}=ut(),{selectedConnection:g,setSelectedConnection:v}=or();QI({onSuccess:s});const m=e||h,C=(d==null?void 0:d.displayName)??Wr(m);if(w.useEffect(()=>{YI(u,m).then(_=>{f(_)}).catch(_=>{console.error("Error loading provider info."),st(_)})},[u,m]),!e&&!h)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(p)return l.jsx(ra,{text:"Integration successfully uninstalled.",children:l.jsx(at,{type:"button",onClick:c,style:{width:"100%"},children:"Reinstall Integration"})});if(g)return i;if(d==null)return l.jsx("strong",{children:"Provider not found"});const y={provider:m,consumerRef:t,consumerName:n,groupRef:r,groupName:o,selectedConnection:g,setSelectedConnection:v,providerName:C,providerInfo:d,onDisconnectSuccess:a};return d.authType==="none"?l.jsx(EI,{...y,children:i}):d.authType==="basic"?l.jsx(CI,{...y,children:i}):d.authType==="apiKey"?l.jsx(bI,{...y,children:i}):l.jsx(GI,{...y})}function ZI(e){const t=e+"CollectionProvider",[n,r]=ho(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:g,children:v}=p,m=w.useRef(null),C=w.useRef(new Map).current;return l.jsx(o,{scope:g,itemMap:C,collectionRef:m,children:v})};s.displayName=t;const a=e+"CollectionSlot",c=w.forwardRef((p,g)=>{const{scope:v,children:m}=p,C=i(a,v),y=Qr(g,C.collectionRef);return l.jsx(Xi,{ref:y,children:m})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=w.forwardRef((p,g)=>{const{scope:v,children:m,...C}=p,y=w.useRef(null),_=Qr(g,y),x=i(u,v);return w.useEffect(()=>(x.itemMap.set(y,{ref:y,...C}),()=>void x.itemMap.delete(y))),l.jsx(Xi,{[d]:"",ref:_,children:m})});f.displayName=u;function h(p){const g=i(e+"CollectionConsumer",p);return w.useCallback(()=>{const m=g.collectionRef.current;if(!m)return[];const C=Array.from(m.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((x,b)=>C.indexOf(x.ref.current)-C.indexOf(b.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:c,ItemSlot:f},h,r]}var eb=$.useId||(()=>{}),tb=0;function od(e){const[t,n]=$.useState(eb());return Gi(()=>{e||n(r=>r??String(tb++))},[e]),e||(t?`radix-${t}`:"")}var nb=$.createContext(void 0);function sd(e){const t=$.useContext(nb);return e||t||"ltr"}var ko="rovingFocusGroup.onEntryFocus",rb={bubbles:!1,cancelable:!0},mo="RovingFocusGroup",[gs,ad,ib]=ZI(mo),[ob,cd]=ho(mo,[ib]),[sb,ab]=ob(mo),ld=$.forwardRef((e,t)=>l.jsx(gs.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(gs.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(cb,{...e,ref:t})})}));ld.displayName=mo;var cb=$.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=$.useRef(null),p=Qr(t,h),g=sd(i),[v=null,m]=ea({prop:s,defaultProp:a,onChange:c}),[C,y]=$.useState(!1),_=Zs(u),x=ad(n),b=$.useRef(!1),[S,R]=$.useState(0);return $.useEffect(()=>{const N=h.current;if(N)return N.addEventListener(ko,_),()=>N.removeEventListener(ko,_)},[_]),l.jsx(sb,{scope:n,orientation:r,dir:g,loop:o,currentTabStopId:v,onItemFocus:$.useCallback(N=>m(N),[m]),onItemShiftTab:$.useCallback(()=>y(!0),[]),onFocusableItemAdd:$.useCallback(()=>R(N=>N+1),[]),onFocusableItemRemove:$.useCallback(()=>R(N=>N-1),[]),children:l.jsx(Fn.div,{tabIndex:C||S===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:$t(e.onMouseDown,()=>{b.current=!0}),onFocus:$t(e.onFocus,N=>{const M=!b.current;if(N.target===N.currentTarget&&M&&!C){const U=new CustomEvent(ko,rb);if(N.currentTarget.dispatchEvent(U),!U.defaultPrevented){const q=x().filter(re=>re.focusable),G=q.find(re=>re.active),ne=q.find(re=>re.id===v),ce=[G,ne,...q].filter(Boolean).map(re=>re.ref.current);fd(ce,d)}}b.current=!1}),onBlur:$t(e.onBlur,()=>y(!1))})})}),ud="RovingFocusGroupItem",dd=$.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=od(),c=i||a,u=ab(ud,n),d=u.currentTabStopId===c,f=ad(n),{onFocusableItemAdd:h,onFocusableItemRemove:p}=u;return $.useEffect(()=>{if(r)return h(),()=>p()},[r,h,p]),l.jsx(gs.ItemSlot,{scope:n,id:c,focusable:r,active:o,children:l.jsx(Fn.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:$t(e.onMouseDown,g=>{r?u.onItemFocus(c):g.preventDefault()}),onFocus:$t(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:$t(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const v=db(g,u.orientation,u.dir);if(v!==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(v==="last")C.reverse();else if(v==="prev"||v==="next"){v==="prev"&&C.reverse();const y=C.indexOf(g.currentTarget);C=u.loop?fb(C,y+1):C.slice(y+1)}setTimeout(()=>fd(C))}})})})});dd.displayName=ud;var lb={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ub(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function db(e,t,n){const r=ub(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return lb[r]}function fd(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function fb(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var pb=ld,hb=dd,oa="Tabs",[mb,Ub]=ho(oa,[cd]),pd=cd(),[gb,sa]=mb(oa),hd=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:c="automatic",...u}=e,d=sd(a),[f,h]=ea({prop:r,onChange:o,defaultProp:i});return l.jsx(gb,{scope:n,baseId:od(),value:f,onValueChange:h,orientation:s,dir:d,activationMode:c,children:l.jsx(Fn.div,{dir:d,"data-orientation":s,...u,ref:t})})});hd.displayName=oa;var md="TabsList",gd=$.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=sa(md,n),s=pd(n);return l.jsx(pb,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:l.jsx(Fn.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});gd.displayName=md;var yd="TabsTrigger",vd=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=sa(yd,n),a=pd(n),c=Id(s.baseId,r),u=bd(s.baseId,r),d=r===s.value;return l.jsx(hb,{asChild:!0,...a,focusable:!o,active:d,children:l.jsx(Fn.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:c,...i,ref:t,onMouseDown:$t(e.onMouseDown,f=>{!o&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:$t(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:$t(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!o&&f&&s.onValueChange(r)})})})});vd.displayName=yd;var wd="TabsContent",yb=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=sa(wd,n),c=Id(a.baseId,r),u=bd(a.baseId,r),d=r===a.value,f=$.useRef(d);return $.useEffect(()=>{const h=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(h)},[]),l.jsx(ta,{present:o||d,children:({present:h})=>l.jsx(Fn.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:h&&i})})});yb.displayName=wd;function Id(e,t){return`${e}-trigger-${t}`}function bd(e,t){return`${e}-content-${t}`}var vb=hd,wb=gd,_d=vd;const Ib=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 bb(e,t){return t?w.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},w.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?Ib: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 _b(){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 xb="_tabsRoot_ktpr0_1",Cb="_tabsList_ktpr0_6",Ob="_tabTrigger_ktpr0_12",Eb="_danger_ktpr0_29",Yr={tabsRoot:xb,tabsList:Cb,tabTrigger:Ob,danger:Eb};function xd({objectName:e,completed:t,pending:n,displayName:r}){return l.jsx(_d,{value:e,className:Yr.tabTrigger,children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[bb(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 Sb({completed:e,pending:t,displayName:n}){return l.jsxs(l.Fragment,{children:[l.jsx(po,{style:{margin:"1rem 0"}}),l.jsx(xd,{objectName:er,completed:e,pending:t,displayName:n},"other-write")]})}function Nb(){return l.jsxs(l.Fragment,{children:[l.jsx(po,{style:{margin:"3rem 0 1rem 0"}}),l.jsx(_d,{value:Li,className:It(Yr.tabTrigger,Yr.danger),children:l.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[_b(),l.jsx("span",{children:"Uninstall"})]})})]})}function Tb({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,writeNavObject:o,showUninstallButton:i}){var s,a;return l.jsx(vb,{value:e,className:Yr.tabsRoot,onValueChange:n,children:l.jsxs(wb,{className:Yr.tabsList,children:[t.map(c=>{var u,d,f,h,p,g;return l.jsx(xd,{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)||((h=(f=r==null?void 0:r[c.name])==null?void 0:f.read)==null?void 0:h.isRequiredMapFieldsModified)||((g=(p=r==null?void 0:r[c.name])==null?void 0:p.read)==null?void 0:g.isValueMappingsModified)||!1},c.name)}),o&&l.jsx(Sb,{completed:o.completed,pending:((a=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:a.isWriteModified)||!1,displayName:"Write"}),i&&l.jsx(Nb,{})]})})}function Rb(e,t){return t===Li?{name:Li,completed:!1}:e.find(n=>n.name===t)}function Ab({children:e}){var C;const{project:t}=Le(),{installation:n,provider:r}=ut(),{hydratedRevision:o}=dn(),{objectConfigurationsState:i}=Ns(),[s,a]=w.useState(""),c=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=o&&vl(u,o),f=d!==null,h=!!((C=o==null?void 0:o.content)!=null&&C.write),p=h?wl(u):void 0,g=w.useMemo(()=>{const y=[...d||[]];return p&&h&&y.push(p),y},[d,p,h]),v=Rb(g,s),m=w.useCallback(()=>{const y=g.find(_=>v!==_&&!_.completed);y&&a(y.name)},[g,v]);return w.useEffect(()=>{!s&&g.length>0&&a(g[0].name)},[g,s,m]),l.jsx(Ml.Provider,{value:m,children:l.jsx(Dl.Provider,{value:v==null?void 0:v.name,children:l.jsxs(Pr,{style:{maxWidth:"55rem"},children:[l.jsxs(Pn,{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:[Dn(r)," integration"]}),l.jsx("h3",{style:{marginBottom:"20px",fontSize:"large",fontWeight:"500"},children:c}),f&&l.jsx(Tb,{value:s,readNavObjects:d,onValueChange:y=>a(y),objectConfigurationsState:i,writeNavObject:p,showUninstallButton:!!n})]}),e]}),l.jsx(Zu,{})]})})})}function Pb({...e}){return l.jsx(Ab,{...e})}function Db({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c}){var C;const{projectId:u,projectIdOrName:d,isLoading:f}=Le(),{isLoading:h}=bs(),{isError:p,errorState:g}=Ht(),{seed:v,reset:m}=hl();return f||h?l.jsx(eo,{}):p(we.PROJECT,d)?l.jsx(un,{message:`Error loading project ${d}`}):p(we.INTEGRATION_LIST,d)?l.jsx(un,{message:"Error retrieving integrations for the project, double check the API key"}):(C=g[we.INTEGRATION_LIST])!=null&&C.apiError?l.jsx(un,{message:"Something went wrong, couldn't find integration information"}):l.jsx("div",{className:ml.resetContainer,children:l.jsx(Ym,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onInstallSuccess:i,onUpdateSuccess:s,onUninstallSuccess:a,fieldMapping:c,children:l.jsx(pl,{groupRef:r,children:l.jsx(id,{consumerRef:t,consumerName:n,groupRef:r,groupName:o,resetComponent:m,children:l.jsx(_g,{projectId:u,children:l.jsx(fI,{children:l.jsx(jg,{children:l.jsx(Pb,{children:l.jsx(sI,{})})})})})})})},v)})}function Fb(){return l.jsxs(Pr,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[l.jsx(Br,{}),l.jsx("p",{children:"Redirecting"})]})}function Mb({redirectURL:e,children:t}){return w.useEffect(()=>{e&&window.location.replace(e)},[e]),e?l.jsx(Fb,{}):t}function jb({buttonText:e,buttonVariant:t="secondary",buttonStyle:n={},onDisconnectSuccess:r,resetComponent:o}){const i=tt(),{projectId:s}=Le(),{selectedConnection:a,setConnections:c}=or(),[u,d]=w.useState(!1),f=!s||!a||!a.id||u,h=async()=>{if(!f){d(!0),console.warn("deleting connection",{projectId:s,connectionId:a==null?void 0:a.id});try{await je().connectionApi.deleteConnection({projectIdOrName:s,connectionId:a==null?void 0:a.id},{headers:{"X-Api-Key":i,"Content-Type":"application/json"}}),console.warn("successfully deleted connection:",a==null?void 0:a.id),r==null||r(a),je().connectionApi.listConnections({projectIdOrName:s},{headers:{"X-Api-Key":i??""}}).then(v=>{c(v),o()}).catch(v=>{st(v)})}catch(v){console.error("Error deleting connection."),st(v)}finally{d(!1)}}},p=u?"Disconnecting...":e;return l.jsx(at,{type:"button",onClick:h,disabled:f,variant:t,style:n,children:p})}function kb({provider:e,onDisconnectSuccess:t,resetComponent:n}){const{appName:r}=Le(),o=`You have successfully connected your ${Dn(e)} account to ${r}.`;return l.jsx(ra,{text:o,children:l.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:l.jsx(jb,{resetComponent:n,onDisconnectSuccess:t,buttonText:"Remove Connection",buttonVariant:"outline",buttonStyle:{fontSize:"13px"}})})})}function Lb({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,redirectUrl:i,onSuccess:s,onDisconnectSuccess:a,onConnectSuccess:c}){const{seed:u,reset:d}=hl(),f=w.useCallback(h=>{s?s(h.id):c&&c(h)},[s,c]);return l.jsx("div",{className:ml.resetContainer,children:l.jsx(pl,{provider:e,groupRef:r,children:l.jsx(id,{resetComponent:d,provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:o,onSuccess:f,onDisconnectSuccess:a,children:l.jsx(Mb,{redirectURL:i,children:l.jsx(kb,{resetComponent:d,provider:e,onDisconnectSuccess:a})})})})},u)}const Vb=(e,t)=>{const n=tt(),{projectId:r,isLoading:o}=Le(),{integrations:i}=bs(),[s,a]=w.useState(!1),[c,u]=w.useState(null);if(!n||!o&&!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=w.useMemo(()=>i==null?void 0:i.reduce((h,p)=>(p==null?void 0:p.name)===e?p:h,{}),[i,e]);return w.useEffect(()=>{!f||o||je().installationApi.listInstallations({projectIdOrName:r,integrationId:f.id,groupRef:t},{headers:{"x-api-key":n}}).then(h=>{a(!0),u(h.length>0)}).catch(h=>{console.error("Error listing installations."),st(h),a(!0)})},[t,n,r,f,o]),{isLoaded:s,isIntegrationInstalled:c}};exports.AmpersandContext=al;exports.AmpersandProvider=jm;exports.ConnectProvider=Lb;exports.FieldMapping=uo;exports.InstallIntegration=Db;exports.useAmpersandProvider=km;exports.useIsIntegrationInstalled=Vb;