@amp-labs/react 1.15.1 → 1.16.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.
- package/build/amp-react.cjs.js +17 -11
- package/build/amp-react.es.js +6853 -4856
- package/build/style.css +1 -1
- package/package.json +3 -2
package/build/amp-react.cjs.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),
|
|
2
|
-
`).filter(n=>n.trim()!==""),sc=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,ve=ic("REACT_APP_ENABLE_CSS",!1)==="true",ac="_box_3e1nt_1",mo={box:ac};function Dt({children:e,className:t,style:n}){return ve?a.jsx("div",{className:t?`${mo.box} ${t}`:mo.box,style:n,children:e}):a.jsx(N.Box,{className:t,style:n,borderWidth:1,borderRadius:4,children:e})}const cc="_container_1wvzr_1",go={container:cc};function Gt({children:e,className:t,style:n}){return ve?a.jsx("div",{className:t?`${go.container} ${t}`:go.container,style:n,children:e}):a.jsx(N.Container,{className:t,style:n,children:e})}const uc="_errorBoxContainer_1qhwq_1",lc="_errorBox_1qhwq_1",dc="_errorText_1qhwq_20",qn={errorBoxContainer:uc,errorBox:lc,errorText:dc};function ot({message:e}){return ve?a.jsxs(Gt,{className:qn.errorBoxContainer,children:[a.jsx(ho,{}),a.jsx(Dt,{className:qn.errorBox,children:a.jsx("p",{className:qn.errorText,children:e})})]}):a.jsxs(N.Box,{minHeight:"300px",padding:"30px",display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"center",children:[a.jsx(ho,{}),a.jsx(N.Box,{boxSizing:"border-box",display:"flex",justifyContent:"center",alignItems:"center","align-self":"stretch",padding:"12px 50px 12px 50px",borderRadius:"8px",border:"2px solid #FECACA",background:"#FEF2F2",children:a.jsx(N.Text,{color:"#991B1B",fontSize:"md",children:e})})]})}const pc="https://api.withampersand.com/v1".replace(/\/+$/,"");class Qo{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:pc}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||ti}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const fc=new Qo,An=class An{constructor(t=fc){this.configuration=t,this.fetchApi=async(n,o)=>{let i={url:n,init:o};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let r;try{r=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const c of this.middleware)c.onError&&(r=await c.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:r?r.clone():void 0})||r);if(r===void 0)throw s instanceof Error?new gc(s,"The request failed and the interceptors did not return an alternative response"):s}for(const s of this.middleware)s.post&&(r=await s.post({fetch:this.fetchApi,url:i.url,init:i.init,response:r.clone()})||r);return r},this.middleware=t.middleware}withMiddleware(...t){const n=this.clone();return n.middleware=n.middleware.concat(...t),n}withPreMiddleware(...t){const n=t.map(o=>({pre:o}));return this.withMiddleware(...n)}withPostMiddleware(...t){const n=t.map(o=>({post:o}));return this.withMiddleware(...n)}isJsonMime(t){return t?An.jsonRegex.test(t):!1}async request(t,n){const{url:o,init:i}=await this.createFetchParams(t,n),r=await this.fetchApi(o,i);if(r&&r.status>=200&&r.status<300)return r;throw new ei(r,"Response returned an error code")}async createFetchParams(t,n){let o=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(o+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(d=>i[d]===void 0?delete i[d]:{});const r=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},c={...s,...await r({init:s,context:t})},u={...c,body:mc(c.body)||c.body instanceof URLSearchParams||hc(c.body)?c.body:JSON.stringify(c.body)};return{url:o,init:u}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};An.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Xe=An;function hc(e){return typeof Blob<"u"&&e instanceof Blob}function mc(e){return typeof FormData<"u"&&e instanceof FormData}class ei extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class gc extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class G extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function M(e,t){const n=e[t];return n!=null}function ti(e,t=""){return Object.keys(e).map(n=>ni(n,e[n],t)).filter(n=>n.length>0).join("&")}function ni(e,t,n=""){const o=n+(n.length?`[${e}]`:e);if(t instanceof Array){const i=t.map(r=>encodeURIComponent(String(r))).join(`&${encodeURIComponent(o)}=`);return`${encodeURIComponent(o)}=${i}`}if(t instanceof Set){const i=Array.from(t);return ni(e,i,n)}return t instanceof Date?`${encodeURIComponent(o)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?ti(t,o):`${encodeURIComponent(o)}=${encodeURIComponent(String(t))}`}function wr(e,t){return Object.keys(e).reduce((n,o)=>({...n,[o]:t(e[o])}),{})}class ye{constructor(t,n=o=>o){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class Et{constructor(t){this.raw=t}async value(){}}class yc{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function vc(e){return Ic(e)}function Ic(e,t){return e==null?e:{fieldUsed:M(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:M(e,"keyFormat")?e.keyFormat:void 0}}function wc(e){return xc(e)}function xc(e,t){return e==null?e:{name:e.name,valuePrefix:M(e,"valuePrefix")?e.valuePrefix:void 0}}function _c(e){return bc(e)}function bc(e,t){return e==null?e:{name:e.name}}function Cc(e){return Oc(e)}function Oc(e,t){return e==null?e:{attachmentType:e.attachmentType,query:M(e,"query")?_c(e.query):void 0,header:M(e,"header")?wc(e.header):void 0,docsURL:M(e,"docsURL")?e.docsURL:void 0}}function Sc(e){return Nc(e)}function Nc(e,t){return e}function Ec(e){return Tc(e)}function Tc(e,t){return e==null?e:{days:M(e,"days")?e.days:void 0,fullHistory:M(e,"fullHistory")?e.fullHistory:void 0}}function Rc(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function ri(e){return Ac(e)}function Ac(e,t){return e==null?e:{defaultPeriod:Ec(e.defaultPeriod)}}function jc(e){if(e!==void 0)return e===null?null:{defaultPeriod:Rc(e.defaultPeriod)}}function Pc(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Dc(e){if(e!==void 0)return e===null?null:{defaultPeriod:Pc(e.defaultPeriod)}}function kc(e){return Fc(e)}function Fc(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function oi(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Mc(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:Dc(e.backfill)}}function Kc(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:wr(e.objects,Mc)}}function Lc(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function $c(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:wr(e.objects,Lc)}}function Hc(e){return Vc(e)}function Vc(e,t){return e==null?e:{apiKeyAsBasic:M(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:M(e,"apiKeyAsBasicOpts")?vc(e.apiKeyAsBasicOpts):void 0,docsURL:M(e,"docsURL")?e.docsURL:void 0}}function Uc(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function un(e){return Bc(e)}function Bc(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:M(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function qc(e){return Wc(e)}function Wc(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Jc(e){return zc(e)}function zc(e,t){return e==null?e:{provider:e.provider,read:M(e,"read")?e.read:void 0,write:M(e,"write")?e.write:void 0,proxy:M(e,"proxy")?kc(e.proxy):void 0}}function ii(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:e.read,write:e.write,proxy:oi(e.proxy)}}function Xc(e){return Yc(e)}function Yc(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Jc(e.content)}}function Gc(e){return Zc(e)}function Zc(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function si(e){return Qc(e)}function Qc(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function gn(e){return eu(e)}function eu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:M(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:M(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function yn(e){return tu(e)}function tu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:gn(e.providerApp),group:si(e.group),consumer:Gc(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:M(e,"ProviderConsumerRef")?e.ProviderConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0}}function nu(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:ii(e.content)}}function ru(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:nu(e.config)}}function ou(e){return iu(e)}function iu(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function su(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function au(e){return cu(e)}function cu(e,t){return e==null?e:{mode:M(e,"mode")?e.mode:void 0,pageSize:M(e,"pageSize")?e.pageSize:void 0}}function uu(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function lu(e){let t=!0;return t=t&&"fieldName"in e,t}function du(e,t){return e==null?e:{fieldName:e.fieldName}}function pu(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName}}function fu(e){let t=!0;return t=t&&"mapToName"in e,t}function ai(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:M(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:M(e,"default")?e.default:void 0,prompt:M(e,"prompt")?e.prompt:void 0}}function hu(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function yo(e){return mu(e)}function mu(e,t){return e==null?e:{...du(e),...ai(e)}}function vo(e){if(e!==void 0)return e===null?null:lu(e)?pu(e):fu(e)?hu(e):{}}function ci(e){return gu(e)}function gu(e,t){return e}function yu(e){return vu(e)}function vu(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,requiredFields:M(e,"requiredFields")?e.requiredFields.map(yo):void 0,optionalFields:M(e,"optionalFields")?e.optionalFields.map(yo):void 0,optionalFieldsAuto:M(e,"optionalFieldsAuto")?ci(e.optionalFieldsAuto):void 0,backfill:M(e,"backfill")?ri(e.backfill):void 0,delivery:M(e,"delivery")?au(e.delivery):void 0}}function Iu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(vo),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(vo),optionalFieldsAuto:e.optionalFieldsAuto,backfill:jc(e.backfill),delivery:uu(e.delivery)}}function wu(e){return xu(e)}function xu(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(yu):void 0}}function _u(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Iu)}}function bu(e){return Cu(e)}function Cu(e,t){return e==null?e:{objectName:e.objectName}}function Ou(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function Su(e){return Nu(e)}function Nu(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(bu):void 0}}function Eu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(Ou)}}function Tu(e){return Ru(e)}function Ru(e,t){return e==null?e:{name:e.name,displayName:M(e,"displayName")?e.displayName:void 0,provider:e.provider,read:M(e,"read")?wu(e.read):void 0,write:M(e,"write")?Su(e.write):void 0,proxy:M(e,"proxy")?ou(e.proxy):void 0}}function Au(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:_u(e.read),write:Eu(e.write),proxy:su(e.proxy)}}function ju(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:Au(e.content)}}function Pu(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:ju(e.latestRevision)}}function Du(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function ku(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 Fu(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Mu(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function Ku(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function Lu(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 $u(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:Mu(e.basicAuth),oauth2ClientCredentials:Ku(e.oauth2ClientCredentials),oauth2Password:Lu(e.oauth2Password)}}function Hu(e){return Vu(e)}function Vu(e,t){return e==null?e:{enabled:M(e,"enabled")?e.enabled:void 0}}function Uu(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName}}function Wn(e){return Bu(e)}function Bu(e,t){return e==null?e:{...Uu(e),...ai(e)}}function qu(e){return Wu(e)}function Wu(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,destination:e.destination,schedule:e.schedule,requiredFields:M(e,"requiredFields")?e.requiredFields.map(Wn):void 0,optionalFields:M(e,"optionalFields")?e.optionalFields.map(Wn):void 0,optionalFieldsAuto:M(e,"optionalFieldsAuto")?ci(e.optionalFieldsAuto):void 0,allFields:M(e,"allFields")?e.allFields.map(Wn):void 0,backfill:M(e,"backfill")?ri(e.backfill):void 0}}function Ju(e){return zu(e)}function zu(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(qu):void 0}}function Xu(e){return Yu(e)}function Yu(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function Gu(e){return Zu(e)}function Zu(e,t){return e==null?e:{objects:M(e,"objects")?e.objects.map(Xu):void 0}}function Qu(e){return el(e)}function el(e,t){return e==null?e:{name:e.name,displayName:M(e,"displayName")?e.displayName:void 0,provider:e.provider,read:M(e,"read")?Ju(e.read):void 0,write:M(e,"write")?Gu(e.write):void 0,proxy:M(e,"proxy")?Hu(e.proxy):void 0}}function tl(e){return nl(e)}function nl(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Qu(e.content)}}function rl(e){if(e!==void 0)return e===null?null:{providerAppId:e.providerAppId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:e.providerConsumerRef,refreshToken:e.refreshToken,scopes:e.scopes}}function ol(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:ii(e.content)}}function il(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:rl(e.connection),config:ol(e.config)}}function Ut(e){return sl(e)}function sl(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:M(e,"group")?si(e.group):void 0,healthStatus:e.healthStatus,connection:yn(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0,config:Xc(e.config)}}function al(e){return cl(e)}function cl(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Tu(e.content)}}function Io(e){return ul(e)}function ul(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:M(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:al(e.latestRevision)}}function ll(e){return dl(e)}function dl(e,t){return e==null?e:{iconURL:M(e,"iconURL")?e.iconURL:void 0,logoURL:M(e,"logoURL")?e.logoURL:void 0}}function pl(e){return fl(e)}function fl(e,t){return e==null?e:{iconURL:M(e,"iconURL")?e.iconURL:void 0,logoURL:M(e,"logoURL")?e.logoURL:void 0}}function hl(e){return ml(e)}function ml(e,t){return e==null?e:{regular:M(e,"regular")?pl(e.regular):void 0,darkMode:M(e,"darkMode")?ll(e.darkMode):void 0}}function gl(e){return yl(e)}function yl(e,t){return e==null?e:{workspaceRefField:M(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:M(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:M(e,"scopesField")?e.scopesField:void 0}}function vl(e){return Il(e)}function Il(e,t){return e==null?e:{grantType:e.grantType,authURL:M(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:M(e,"audience")?e.audience:void 0,tokenMetadataFields:gl(e.tokenMetadataFields),docsURL:M(e,"docsURL")?e.docsURL:void 0,authURLParams:M(e,"authURLParams")?e.authURLParams:void 0}}function wl(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider}}function xl(e){return _l(e)}function _l(e,t){return e==null?e:{bulkWrite:qc(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function wo(e){return bl(e)}function bl(e,t){return e==null?e:{name:e.name,authType:Sc(e.authType),baseURL:e.baseURL,oauth2Opts:M(e,"oauth2Opts")?vl(e.oauth2Opts):void 0,apiKeyOpts:M(e,"apiKeyOpts")?Cc(e.apiKeyOpts):void 0,basicOpts:M(e,"basicOpts")?Hc(e.basicOpts):void 0,support:xl(e.support),providerOpts:e.providerOpts,displayName:M(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:M(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:M(e,"media")?hl(e.media):void 0,labels:M(e,"labels")?e.labels:void 0}}function Cl(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:Kc(e.read),write:$c(e.write),proxy:oi(e.proxy)}}function Ol(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Cl(e.content)}}function Sl(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:Ol(e.config)}}function Nl(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:Sl(e.installation)}}function El(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function Tl(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:El(e.project)}}function Rl(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 Al(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:Rl(e.providerApp)}}class jl extends Xe{async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:o,body:$u(t.generateConnectionParams)},n);return new ye(r,s=>yn(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new G("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:i,query:o},n);return new ye(r,s=>yn(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const o={};t.provider!==void 0&&(o.provider=t.provider),t.groupRef!==void 0&&(o.groupRef=t.groupRef),t.consumerRef!==void 0&&(o.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:o},n);return new ye(r,s=>s.map(yn))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class Pl extends Xe{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new G("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:o,body:ru(t.installation)},n);return new ye(r,s=>Ut(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new G("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:i,query:o},n);return new Et(r)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new G("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:i,query:o},n);return new ye(r,s=>Ut(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async importInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new G("installation","Required parameter requestParameters.installation was null or undefined when calling importInstallation.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations:import".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:o,body:il(t.installation)},n);return new ye(r,s=>Ut(s))}async importInstallation(t,n){return await(await this.importInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const o={};t.groupRef!==void 0&&(o.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:i,query:o},n);return new ye(r,s=>s.map(Ut))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new G("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new G("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:i,query:o,body:Nl(t.installationUpdate)},n);return new ye(r,s=>Ut(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class Dl extends Xe{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:o,body:Uc(t.batchUpsertIntegrationsRequest)},n);return new ye(r,s=>s.map(Io))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new G("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:o,body:Pu(t.integration)},n);return new Et(r)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:i,query:o},n);return new Et(r)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:o},n);return new ye(r,s=>s.map(Io))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class kl extends Xe{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new G("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const o={},i={};i["Content-Type"]="application/json";const r=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:o,body:wl(t.connectOAuthParams)},n);return this.isJsonMime(r.headers.get("content-type"))?new ye(r):new yc(r)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class Fl extends Xe{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new G("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects",method:"POST",headers:i,query:o,body:Du(t.project)},n);return new ye(r,s=>un(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:o},n);return new Et(r)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:o},n);return new ye(r,s=>un(s))}async getProject(t,n){return await(await this.getProjectRaw(t,n)).value()}async listProjectsRaw(t){const n={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/projects",method:"GET",headers:o,query:n},t);return new ye(i,r=>r.map(un))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new G("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:o,body:Tl(t.projectUpdate)},n);return new ye(r,s=>un(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Ml extends Xe{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new G("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:o},n);return new ye(r,s=>wo(s))}async getProvider(t,n){return await(await this.getProviderRaw(t,n)).value()}async listProvidersRaw(t){const n={},o={};this.configuration&&this.configuration.apiKey&&(o["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const i=await this.request({path:"/providers",method:"GET",headers:o,query:n},t);return new ye(i,r=>wr(r,wo))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class Kl extends Xe{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new G("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:o,body:ku(t.providerApp)},n);return new ye(r,s=>gn(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new G("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:i,query:o},n);return new Et(r)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const o={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:o},n);return new ye(r,s=>s.map(gn))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new G("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new G("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:i,query:o,body:Al(t.providerAppUpdate)},n);return new ye(r,s=>gn(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class Ll extends Xe{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const o={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:o,body:Fu(t.revision)},n);return new Et(r)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new G("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new G("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new G("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new G("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const o={};t.connectionId!==void 0&&(o.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const r=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:i,query:o},n);return new ye(r,s=>tl(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class $l{constructor(t){this.connectionApi=new jl(t),this.installationApi=new Pl(t),this.integrationApi=new Dl(t),this.oAuthApi=new kl(t),this.projectApi=new Fl(t),this.providerApi=new Ml(t),this.providerAppApi=new Kl(t),this.revisionApi=new Ll(t)}}const Hl="1.15.1",Vl="v1",ln="https://api.withampersand.com";function ui(){try{const e=process.env.REACT_APP_AMP_SERVER;switch(e){case"local":return"http://localhost:8080";case"dev":return"https://dev-api.withampersand.com";case"staging":return"https://staging-api.withampersand.com";case"prod":return ln;case"mock":return"http://127.0.0.1:4010";case"":return ln;default:return e??ln}}catch{return ln}}const Ul=(e,t)=>`${e}/${t}`;function Bl(){return Ul(ui(),Vl)}const ql=ui(),Wl=Bl(),Jl=new Qo({basePath:Wl,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Hl}});let zl=new $l(Jl);const fe=()=>zl;function Xl(){return a.jsx(N.Box,{className:"loading-icon",height:"100%",width:"100%",display:"flex",justifyContent:"center",marginTop:"20%",marginBottom:"20%",children:a.jsx(N.Stack,{alignItems:"center",children:a.jsx(N.Spinner,{height:"100px",width:"100px",alignSelf:"center",thickness:"8px",speed:"1s",emptyColor:"gray.200",color:"blue.500",size:"xl",margin:"20px"})})})}const Yl="_loader_h78nh_1",Gl="_rotate_h78nh_1",Zl="_ball1_h78nh_1",Ql="_ball2_h78nh_1",ed={loader:Yl,rotate:Gl,ball1:Zl,ball2:Ql};function td(){return a.jsx("span",{className:ed.loader})}function qe(){return ve?a.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:a.jsx(td,{})}):a.jsx(Xl,{})}const Ce=async(e,t)=>{var n;if(e instanceof ei){const{status:o,statusText:i}=e.response;console.error(o===500?"Internal Server Error (500):":o===400?"Bad Request (400):":`Error (${o}):`,i);const r=await e.response.json(),s=((n=r==null?void 0:r.causes)==null?void 0:n.join(`
|
|
3
|
-
`))||"[ERROR] Creating installation failed.";console.error("[Error Message]",s),t&&t(s)}else console.error("Unexpected error:",e.message)},
|
|
4
|
-
component is wrapped with AmpersandProvider`);return e}const sd=()=>{const[e,t]=y.useState(!1),n=y.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}},hi=y.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function We(){const e=y.useContext(hi);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function ad({children:e,integration:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,onInstallSuccess:s,onUpdateSuccess:c,onUninstallSuccess:u,fieldMapping:d}){const p=xe(),{projectId:h}=Ie(),{integrations:g}=di(),{setError:f,isError:m}=dt(),{isIntegrationDeleted:x,setIntegrationDeleted:w}=sd(),[O,v]=y.useState([]),[C,b]=y.useState(!0),I=(O==null?void 0:O[0])||null,S=y.useMemo(()=>sc(t,g||[]),[t,g]);y.useEffect(()=>{S===null&&(g!=null&&g.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,S,g]);const H=y.useCallback(X=>{v([X])},[v]),k=y.useCallback(()=>{S!=null&&S.id&&fe().installationApi.listInstallations({projectIdOrName:h,integrationId:S.id,groupRef:i},{headers:{"X-Api-Key":p??""}}).then(X=>{b(!1),v(X||[])}).catch(X=>{f(me.INSTALLATION_LIST,S.id),b(!1),console.error("Error retrieving installation information: ",X)})},[S,h,p,f,i]),V=(S==null?void 0:S.id)||"";y.useEffect(()=>{k()},[k]);const z=y.useMemo(()=>({integrationId:(S==null?void 0:S.id)||"",provider:(S==null?void 0:S.provider)||"",integrationObj:S,consumerRef:n,consumerName:o,groupRef:i,groupName:r,installation:I,setInstallation:H,resetInstallations:k,onInstallSuccess:s,onUpdateSuccess:c,onUninstallSuccess:u,isIntegrationDeleted:x,setIntegrationDeleted:w,fieldMapping:d}),[S,n,o,i,r,I,H,k,s,c,u,x,w,d]);if(S!==null){const X=`Error retrieving installation information for integration "${(S==null?void 0:S.name)||"unknown"}"`;return m(me.INSTALLATION_LIST,V)?a.jsx(ot,{message:X}):a.jsx(hi.Provider,{value:z,children:C?a.jsx(qe,{}):e})}return a.jsx(ot,{message:`Integration "${t}" not found`})}const mi=y.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),kt=()=>{const e=y.useContext(mi);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function gi({provider:e,groupRef:t,children:n}){const o=xe(),{projectId:i}=Ie(),[r,s]=y.useState(null),[c,u]=y.useState(null),[d,p]=y.useState(!0),{setError:h,isError:g}=dt(),{provider:f}=We();if(!i)throw new Error("ConnectionsProvider must be used within AmpersandProvider");const m=e||f;if(!m)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");y.useEffect(()=>{fe().connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:m},{headers:{"X-Api-Key":o??""}}).then(w=>{p(!1),s(w)}).catch(w=>{console.error(`Error retrieving existing OAuth connections for group ID ${t}.`),Ce(w),p(!1),h(me.CONNECTION_LIST,i)})},[i,o,t,m,h]);const x=y.useMemo(()=>({connections:r,selectedConnection:c,setConnections:s,setSelectedConnection:u}),[r,c,s,u]);return g(me.CONNECTION_LIST,i)?a.jsx(ot,{message:"Error retrieving existing connections"}):a.jsx(mi.Provider,{value:x,children:d?a.jsx(qe,{}):n})}var dn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xr(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var xn={exports:{}};xn.exports;(function(e,t){var n=200,o="__lodash_hash_undefined__",i=1,r=2,s=9007199254740991,c="[object Arguments]",u="[object Array]",d="[object AsyncFunction]",p="[object Boolean]",h="[object Date]",g="[object Error]",f="[object Function]",m="[object GeneratorFunction]",x="[object Map]",w="[object Number]",O="[object Null]",v="[object Object]",C="[object Promise]",b="[object Proxy]",I="[object RegExp]",S="[object Set]",H="[object String]",k="[object Symbol]",V="[object Undefined]",z="[object WeakMap]",X="[object ArrayBuffer]",Z="[object DataView]",te="[object Float32Array]",Q="[object Float64Array]",ue="[object Int8Array]",le="[object Int16Array]",re="[object Int32Array]",Oe="[object Uint8Array]",Ne="[object Uint8ClampedArray]",T="[object Uint16Array]",K="[object Uint32Array]",F=/[\\^$.*+?()[\]{}|]/g,D=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,R={};R[te]=R[Q]=R[ue]=R[le]=R[re]=R[Oe]=R[Ne]=R[T]=R[K]=!0,R[c]=R[u]=R[X]=R[p]=R[Z]=R[h]=R[g]=R[f]=R[x]=R[w]=R[v]=R[I]=R[S]=R[H]=R[z]=!1;var B=typeof dn=="object"&&dn&&dn.Object===Object&&dn,W=typeof self=="object"&&self&&self.Object===Object&&self,U=B||W||Function("return this")(),J=t&&!t.nodeType&&t,q=J&&!0&&e&&!e.nodeType&&e,oe=q&&q.exports===J,j=oe&&B.process,de=function(){try{return j&&j.binding&&j.binding("util")}catch{}}(),L=de&&de.isTypedArray;function Ee(l,_){for(var E=-1,$=l==null?0:l.length,pe=0,ee=[];++E<$;){var ge=l[E];_(ge,E,l)&&(ee[pe++]=ge)}return ee}function Te(l,_){for(var E=-1,$=_.length,pe=l.length;++E<$;)l[pe+E]=_[E];return l}function Ge(l,_){for(var E=-1,$=l==null?0:l.length;++E<$;)if(_(l[E],E,l))return!0;return!1}function Ve(l,_){for(var E=-1,$=Array(l);++E<l;)$[E]=_(E);return $}function Ct(l){return function(_){return l(_)}}function Mt(l,_){return l.has(_)}function Ue(l,_){return l==null?void 0:l[_]}function ft(l){var _=-1,E=Array(l.size);return l.forEach(function($,pe){E[++_]=[pe,$]}),E}function Kt(l,_){return function(E){return l(_(E))}}function Ot(l){var _=-1,E=Array(l.size);return l.forEach(function($){E[++_]=$}),E}var Je=Array.prototype,Ze=Function.prototype,je=Object.prototype,Re=U["__core-js_shared__"],en=Ze.toString,ze=je.hasOwnProperty,Yr=function(){var l=/[^.]+$/.exec(Re&&Re.keys&&Re.keys.IE_PROTO||"");return l?"Symbol(src)_1."+l:""}(),Gr=je.toString,Qs=RegExp("^"+en.call(ze).replace(F,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Zr=oe?U.Buffer:void 0,tn=U.Symbol,Qr=U.Uint8Array,eo=je.propertyIsEnumerable,ea=Je.splice,ht=tn?tn.toStringTag:void 0,to=Object.getOwnPropertySymbols,ta=Zr?Zr.isBuffer:void 0,na=Kt(Object.keys,Object),Ln=St(U,"DataView"),Lt=St(U,"Map"),$n=St(U,"Promise"),Hn=St(U,"Set"),Vn=St(U,"WeakMap"),$t=St(Object,"create"),ra=yt(Ln),oa=yt(Lt),ia=yt($n),sa=yt(Hn),aa=yt(Vn),no=tn?tn.prototype:void 0,Un=no?no.valueOf:void 0;function mt(l){var _=-1,E=l==null?0:l.length;for(this.clear();++_<E;){var $=l[_];this.set($[0],$[1])}}function ca(){this.__data__=$t?$t(null):{},this.size=0}function ua(l){var _=this.has(l)&&delete this.__data__[l];return this.size-=_?1:0,_}function la(l){var _=this.__data__;if($t){var E=_[l];return E===o?void 0:E}return ze.call(_,l)?_[l]:void 0}function da(l){var _=this.__data__;return $t?_[l]!==void 0:ze.call(_,l)}function pa(l,_){var E=this.__data__;return this.size+=this.has(l)?0:1,E[l]=$t&&_===void 0?o:_,this}mt.prototype.clear=ca,mt.prototype.delete=ua,mt.prototype.get=la,mt.prototype.has=da,mt.prototype.set=pa;function Qe(l){var _=-1,E=l==null?0:l.length;for(this.clear();++_<E;){var $=l[_];this.set($[0],$[1])}}function fa(){this.__data__=[],this.size=0}function ha(l){var _=this.__data__,E=rn(_,l);if(E<0)return!1;var $=_.length-1;return E==$?_.pop():ea.call(_,E,1),--this.size,!0}function ma(l){var _=this.__data__,E=rn(_,l);return E<0?void 0:_[E][1]}function ga(l){return rn(this.__data__,l)>-1}function ya(l,_){var E=this.__data__,$=rn(E,l);return $<0?(++this.size,E.push([l,_])):E[$][1]=_,this}Qe.prototype.clear=fa,Qe.prototype.delete=ha,Qe.prototype.get=ma,Qe.prototype.has=ga,Qe.prototype.set=ya;function gt(l){var _=-1,E=l==null?0:l.length;for(this.clear();++_<E;){var $=l[_];this.set($[0],$[1])}}function va(){this.size=0,this.__data__={hash:new mt,map:new(Lt||Qe),string:new mt}}function Ia(l){var _=on(this,l).delete(l);return this.size-=_?1:0,_}function wa(l){return on(this,l).get(l)}function xa(l){return on(this,l).has(l)}function _a(l,_){var E=on(this,l),$=E.size;return E.set(l,_),this.size+=E.size==$?0:1,this}gt.prototype.clear=va,gt.prototype.delete=Ia,gt.prototype.get=wa,gt.prototype.has=xa,gt.prototype.set=_a;function nn(l){var _=-1,E=l==null?0:l.length;for(this.__data__=new gt;++_<E;)this.add(l[_])}function ba(l){return this.__data__.set(l,o),this}function Ca(l){return this.__data__.has(l)}nn.prototype.add=nn.prototype.push=ba,nn.prototype.has=Ca;function st(l){var _=this.__data__=new Qe(l);this.size=_.size}function Oa(){this.__data__=new Qe,this.size=0}function Sa(l){var _=this.__data__,E=_.delete(l);return this.size=_.size,E}function Na(l){return this.__data__.get(l)}function Ea(l){return this.__data__.has(l)}function Ta(l,_){var E=this.__data__;if(E instanceof Qe){var $=E.__data__;if(!Lt||$.length<n-1)return $.push([l,_]),this.size=++E.size,this;E=this.__data__=new gt($)}return E.set(l,_),this.size=E.size,this}st.prototype.clear=Oa,st.prototype.delete=Sa,st.prototype.get=Na,st.prototype.has=Ea,st.prototype.set=Ta;function Ra(l,_){var E=sn(l),$=!E&&qa(l),pe=!E&&!$&&Bn(l),ee=!E&&!$&&!pe&&po(l),ge=E||$||pe||ee,_e=ge?Ve(l.length,String):[],be=_e.length;for(var he in l)ze.call(l,he)&&!(ge&&(he=="length"||pe&&(he=="offset"||he=="parent")||ee&&(he=="buffer"||he=="byteLength"||he=="byteOffset")||$a(he,be)))&&_e.push(he);return _e}function rn(l,_){for(var E=l.length;E--;)if(ao(l[E][0],_))return E;return-1}function Aa(l,_,E){var $=_(l);return sn(l)?$:Te($,E(l))}function Ht(l){return l==null?l===void 0?V:O:ht&&ht in Object(l)?Ka(l):Ba(l)}function ro(l){return Vt(l)&&Ht(l)==c}function oo(l,_,E,$,pe){return l===_?!0:l==null||_==null||!Vt(l)&&!Vt(_)?l!==l&&_!==_:ja(l,_,E,$,oo,pe)}function ja(l,_,E,$,pe,ee){var ge=sn(l),_e=sn(_),be=ge?u:at(l),he=_e?u:at(_);be=be==c?v:be,he=he==c?v:he;var Pe=be==v,Be=he==v,Se=be==he;if(Se&&Bn(l)){if(!Bn(_))return!1;ge=!0,Pe=!1}if(Se&&!Pe)return ee||(ee=new st),ge||po(l)?io(l,_,E,$,pe,ee):Fa(l,_,be,E,$,pe,ee);if(!(E&i)){var Le=Pe&&ze.call(l,"__wrapped__"),$e=Be&&ze.call(_,"__wrapped__");if(Le||$e){var ct=Le?l.value():l,et=$e?_.value():_;return ee||(ee=new st),pe(ct,et,E,$,ee)}}return Se?(ee||(ee=new st),Ma(l,_,E,$,pe,ee)):!1}function Pa(l){if(!lo(l)||Va(l))return!1;var _=co(l)?Qs:D;return _.test(yt(l))}function Da(l){return Vt(l)&&uo(l.length)&&!!R[Ht(l)]}function ka(l){if(!Ua(l))return na(l);var _=[];for(var E in Object(l))ze.call(l,E)&&E!="constructor"&&_.push(E);return _}function io(l,_,E,$,pe,ee){var ge=E&i,_e=l.length,be=_.length;if(_e!=be&&!(ge&&be>_e))return!1;var he=ee.get(l);if(he&&ee.get(_))return he==_;var Pe=-1,Be=!0,Se=E&r?new nn:void 0;for(ee.set(l,_),ee.set(_,l);++Pe<_e;){var Le=l[Pe],$e=_[Pe];if($)var ct=ge?$($e,Le,Pe,_,l,ee):$(Le,$e,Pe,l,_,ee);if(ct!==void 0){if(ct)continue;Be=!1;break}if(Se){if(!Ge(_,function(et,vt){if(!Mt(Se,vt)&&(Le===et||pe(Le,et,E,$,ee)))return Se.push(vt)})){Be=!1;break}}else if(!(Le===$e||pe(Le,$e,E,$,ee))){Be=!1;break}}return ee.delete(l),ee.delete(_),Be}function Fa(l,_,E,$,pe,ee,ge){switch(E){case Z:if(l.byteLength!=_.byteLength||l.byteOffset!=_.byteOffset)return!1;l=l.buffer,_=_.buffer;case X:return!(l.byteLength!=_.byteLength||!ee(new Qr(l),new Qr(_)));case p:case h:case w:return ao(+l,+_);case g:return l.name==_.name&&l.message==_.message;case I:case H:return l==_+"";case x:var _e=ft;case S:var be=$&i;if(_e||(_e=Ot),l.size!=_.size&&!be)return!1;var he=ge.get(l);if(he)return he==_;$|=r,ge.set(l,_);var Pe=io(_e(l),_e(_),$,pe,ee,ge);return ge.delete(l),Pe;case k:if(Un)return Un.call(l)==Un.call(_)}return!1}function Ma(l,_,E,$,pe,ee){var ge=E&i,_e=so(l),be=_e.length,he=so(_),Pe=he.length;if(be!=Pe&&!ge)return!1;for(var Be=be;Be--;){var Se=_e[Be];if(!(ge?Se in _:ze.call(_,Se)))return!1}var Le=ee.get(l);if(Le&&ee.get(_))return Le==_;var $e=!0;ee.set(l,_),ee.set(_,l);for(var ct=ge;++Be<be;){Se=_e[Be];var et=l[Se],vt=_[Se];if($)var fo=ge?$(vt,et,Se,_,l,ee):$(et,vt,Se,l,_,ee);if(!(fo===void 0?et===vt||pe(et,vt,E,$,ee):fo)){$e=!1;break}ct||(ct=Se=="constructor")}if($e&&!ct){var an=l.constructor,cn=_.constructor;an!=cn&&"constructor"in l&&"constructor"in _&&!(typeof an=="function"&&an instanceof an&&typeof cn=="function"&&cn instanceof cn)&&($e=!1)}return ee.delete(l),ee.delete(_),$e}function so(l){return Aa(l,za,La)}function on(l,_){var E=l.__data__;return Ha(_)?E[typeof _=="string"?"string":"hash"]:E.map}function St(l,_){var E=Ue(l,_);return Pa(E)?E:void 0}function Ka(l){var _=ze.call(l,ht),E=l[ht];try{l[ht]=void 0;var $=!0}catch{}var pe=Gr.call(l);return $&&(_?l[ht]=E:delete l[ht]),pe}var La=to?function(l){return l==null?[]:(l=Object(l),Ee(to(l),function(_){return eo.call(l,_)}))}:Xa,at=Ht;(Ln&&at(new Ln(new ArrayBuffer(1)))!=Z||Lt&&at(new Lt)!=x||$n&&at($n.resolve())!=C||Hn&&at(new Hn)!=S||Vn&&at(new Vn)!=z)&&(at=function(l){var _=Ht(l),E=_==v?l.constructor:void 0,$=E?yt(E):"";if($)switch($){case ra:return Z;case oa:return x;case ia:return C;case sa:return S;case aa:return z}return _});function $a(l,_){return _=_??s,!!_&&(typeof l=="number"||P.test(l))&&l>-1&&l%1==0&&l<_}function Ha(l){var _=typeof l;return _=="string"||_=="number"||_=="symbol"||_=="boolean"?l!=="__proto__":l===null}function Va(l){return!!Yr&&Yr in l}function Ua(l){var _=l&&l.constructor,E=typeof _=="function"&&_.prototype||je;return l===E}function Ba(l){return Gr.call(l)}function yt(l){if(l!=null){try{return en.call(l)}catch{}try{return l+""}catch{}}return""}function ao(l,_){return l===_||l!==l&&_!==_}var qa=ro(function(){return arguments}())?ro:function(l){return Vt(l)&&ze.call(l,"callee")&&!eo.call(l,"callee")},sn=Array.isArray;function Wa(l){return l!=null&&uo(l.length)&&!co(l)}var Bn=ta||Ya;function Ja(l,_){return oo(l,_)}function co(l){if(!lo(l))return!1;var _=Ht(l);return _==f||_==m||_==d||_==b}function uo(l){return typeof l=="number"&&l>-1&&l%1==0&&l<=s}function lo(l){var _=typeof l;return l!=null&&(_=="object"||_=="function")}function Vt(l){return l!=null&&typeof l=="object"}var po=L?Ct(L):Da;function za(l){return Wa(l)?Ra(l):ka(l)}function Xa(){return[]}function Ya(){return!1}e.exports=Ja})(xn,xn.exports);var cd=xn.exports;const ud=xr(cd),xt="other";function Ye(e){return e.mapToName!==void 0}function ld(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(o=>o.objectName===t))||null}function dd(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!Ye(n)&&!!n.fieldName))||null}function pd(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(o=>Ye(o)&&!!o.mapToName))||[]}function fd(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!Ye(n)&&!!n.fieldName))||null}const yi=(e,t)=>{var n,o,i;return(i=(o=(n=e==null?void 0:e.content)==null?void 0:n.read)==null?void 0:o.objects)==null?void 0:i[t]};function hd(e){return Ye(e)?e.mapToName:e.fieldName}const vi=(e,t)=>{var o,i,r;const n=[];return(r=(i=(o=t.content)==null?void 0:o.read)==null?void 0:i.objects)==null||r.forEach(s=>{n.push({name:s==null?void 0:s.objectName,completed:e?!!yi(e,s.objectName):!1})}),n},Ii=e=>{var n;return{name:xt,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function md(e,t){var r;const n=vi(e,t),i=!!((r=t==null?void 0:t.content)!=null&&r.write)?Ii(e):void 0;return i&&n.push(i),n}function wi(e,t,n){const o=(e==null?void 0:e.filter(r=>!(t!=null&&t[r==null?void 0:r.mapToName])))||[],i=o.map(r=>r.mapToName);return n(me.MAPPING,i),o!=null&&o.length&&console.error("required fields not met",o.map(r=>r.mapToDisplayName)),{errorList:i}}function _r(e,t){return ud(e,t)}const gd=(e,t,n)=>{var f,m,x,w,O,v;if(!e)return null;const o=ld(e,t),i=o&&dd(o),r=o&&fd(o),s=o&&pd(o),c=(o==null?void 0:o.allFields)||[],u=n==null?void 0:n.content,d=((x=(m=(f=u==null?void 0:u.read)==null?void 0:f.objects)==null?void 0:m[t])==null?void 0:x.selectedFields)||{},p=((v=(O=(w=u==null?void 0:u.read)==null?void 0:w.objects)==null?void 0:O[t])==null?void 0:v.selectedFieldMappings)||{},h={...d},g={...p};return{allFields:c,requiredFields:i,optionalFields:r,requiredMapFields:s,selectedOptionalFields:d,selectedFieldMappings:p,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:h,requiredMapFields:g}}},yd=(e,t)=>{var s,c;if(!e)return null;const n=(c=(s=t==null?void 0:t.content)==null?void 0:s.write)==null?void 0:c.objects,o=Object.keys(n||{}),i={};o.forEach(u=>{i[u]=!0});const r={...i};return{writeObjects:(e==null?void 0:e.objects)||[],selectedNonConfigurableWriteFields:i,isWriteModified:!1,savedConfig:{selectedNonConfigurableWriteFields:r}}};function xi(e,t,n){var r,s;const o=(r=e==null?void 0:e.content)==null?void 0:r.read,i=(s=e==null?void 0:e.content)==null?void 0:s.write;return{read:gd(o,t,n),write:yd(i,n)}}const _i=(e,t,n,o)=>{const i=xi(e,n,t);o(n,i)},vd=(e,t,n)=>{const o=md(t,e),i={};o.forEach(({name:r,completed:s})=>{s&&(i[r]=xi(e,r,t))}),n(i)},bi=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},o=new Set;return t==null||t.forEach(r=>o.add(hd(r))),{...Array.from(o).reduce((r,s)=>({...r,[s]:!0}),{}),...n||{}}},Ci=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(o=>{t[o]!==void 0?n[o]=t[o]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${o}`)}),n};function Oi(e,t){return t[e]||void 0}async function br({createConfig:e,projectId:t,integrationId:n,groupRef:o,connectionId:i,apiKey:r,setError:s,setInstallation:c,onInstallSuccess:u}){const d={projectIdOrName:t,integrationId:n,installation:{groupRef:o,connectionId:i,config:e}};try{const p=await fe().installationApi.createInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}});c(p),u==null||u(p.id,p.config)}catch(p){Ce(p,s)}}function jn(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const Id=(e,t)=>{const n=e.content.read,o=n==null?void 0:n.objects;return o==null?void 0:o.find(i=>i.objectName===t)},wd=(e,t,n,o)=>{const i=bi(e),r=Ci(e),s=Id(n,t);if(!s)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${o}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:s.schedule,destination:s.destination,selectedFields:i,selectedFieldMappings:r,backfill:s.backfill}}}}};return jn(n)&&(c.content.proxy={enabled:!0}),c},xd=(e,t,n,o,i,r,s,c,u,d,p,h)=>{const g=wd(u,r,c,o);return g?br({createConfig:g,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:d,setInstallation:p,onInstallSuccess:h}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Si=e=>{var r,s;const t={},n=(r=e.write)==null?void 0:r.writeObjects,o=(s=e.write)==null?void 0:s.selectedNonConfigurableWriteFields,i=o?Object.keys(o):[];return n&&n.forEach(c=>{const u=c.objectName;i.includes(u)&&(t[u]={objectName:u})}),t},_d=e=>{const t=e.content.write;return t==null?void 0:t.objects},bd=(e,t,n)=>{if(!_d(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=Si(e),r={revisionId:t.id,createdBy:`consumer:${n}`,content:{provider:t.content.provider,read:{objects:{}},write:{objects:i}}};return jn(t)&&(r.content.proxy={enabled:!0}),r},Cd=(e,t,n,o,i,r,s,c,u,d,p)=>{const h=bd(c,s,o);return h?br({createConfig:h,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:r,setError:u,setInstallation:d,onInstallSuccess:p}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},Od=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-background").trim()||"#FEF2F2",Sd=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-border").trim()||"#FECACA",Nd=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-text").trim()||"#991B1B",Ed={backgroundColor:Od,borderColor:Sd,color:Nd,padding:".5rem 1rem"};function Ni({children:e,style:t}){return a.jsx(Dt,{style:{...Ed,...t},children:e})}var Ei={exports:{}};/*!
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),g=require("react"),T=require("@chakra-ui/react");require("react-dom");function Dl(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 $=Dl(g),kl={primary:{bg:"black",color:"white",_hover:{bg:"gray.700",_disabled:{bg:"gray.600"}},_disabled:{bg:"gray.600",color:"gray.300",cursor:"not-allowed",opacity:1}},warning:{bg:"red.50",outline:"2px solid red.100",outlineOffset:"0",borderColor:"red.100",color:"red.800",_hover:{bg:"red.100"}}},Fl=T.extendTheme({components:{Tabs:{baseStyle:{tab:{width:"100%",borderRadius:"4px",_hover:{bg:"gray.200"},_selected:{color:"black",fontWeight:"500",bg:"gray.100",border:"none",_hover:{bg:"gray.200"}}},warningTab:{width:"100%",borderRadius:"4px",_hover:{bg:"red.100"},_selected:{color:"red.800",fontWeight:"500",bg:"red.50",border:"none",_hover:{bg:"red.100"}}}}},Button:{variants:kl}}}),Ml=T.extendTheme(Fl);function Ll({children:e}){return a.jsx(T.ChakraProvider,{theme:Ml,children:e})}const Ds=g.createContext(null),$l=Ds.Provider,Ve=()=>{const e=g.useContext(Ds);if(e===null)throw new Error("useApiKey must be used within an ApiKeyProvider");return e};var Te=(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))(Te||{});const ks=g.createContext(void 0);function on(){const e=g.useContext(ks);if(!e)throw new Error("useErrorState must be used within a ErrorProvider");return e}const Kl=(()=>{const e={};return Object.values(Te).forEach(t=>{e[t]={}}),e})();function Vl({children:e}){const[t,n]=g.useState(Kl),r=g.useCallback((d,f,m=!0)=>{n(p=>{const h={...p};return h[d]=h[d]||{},h[d][f]=m,h})},[n]),i=g.useCallback((d,f)=>{var m;return!!((m=t[d])!=null&&m[f])},[t]),o=g.useCallback((d,f)=>{var m;return(m=t[d])==null?void 0:m[f]},[t]),s=g.useCallback((d,f)=>{n(m=>{var h;const p={...m};return(h=p[d])==null||delete h[f],p})},[n]),c=g.useCallback(d=>{n(f=>{const m={...f};return m[d]={},m})},[n]),l=g.useCallback((d,f)=>{n(m=>{const p={...m};return p[d]=p[d]||{},f.forEach(h=>{p[d][h]=!0}),p})},[n]),u=g.useMemo(()=>({errorState:t,setErrorState:n,setError:r,isError:i,removeError:s,resetBoundary:c,setErrors:l,getError:o}),[t,n,r,i,s,c,l,o]);return a.jsx(ks.Provider,{value:u,children:e})}function Vi(){return a.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M24 18V26",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M24 34H24.02",stroke:"#7F1D1D",strokeWidth:"4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Hl(e,t){try{return process.env[e]}catch{return t}}function Fs(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Pt(e,t){return(t==null?void 0:t.displayName)??Fs(e)}const Vo=e=>e.split(`
|
|
2
|
+
`).filter(n=>n.trim()!==""),Bl=(e,t)=>(t==null?void 0:t.length)===0||!e?null:t.find(n=>n.name===e)??null,Pe=Hl("REACT_APP_ENABLE_CSS",!1)==="true",Ul="_box_3e1nt_1",Hi={box:Ul};function xn({children:e,className:t,style:n}){return Pe?a.jsx("div",{className:t?`${Hi.box} ${t}`:Hi.box,style:n,children:e}):a.jsx(T.Box,{className:t,style:n,borderWidth:1,borderRadius:4,children:e})}const ql="_container_1wvzr_1",Bi={container:ql};function kn({children:e,className:t,style:n}){return Pe?a.jsx("div",{className:t?`${Bi.container} ${t}`:Bi.container,style:n,children:e}):a.jsx(T.Container,{className:t,style:n,children:e})}const Wl="_errorBoxContainer_1qhwq_1",zl="_errorBox_1qhwq_1",Jl="_errorText_1qhwq_20",oo={errorBoxContainer:Wl,errorBox:zl,errorText:Jl};function Ut({message:e}){return Pe?a.jsxs(kn,{className:oo.errorBoxContainer,children:[a.jsx(Vi,{}),a.jsx(xn,{className:oo.errorBox,children:a.jsx("p",{className:oo.errorText,children:e})})]}):a.jsxs(T.Box,{minHeight:"300px",padding:"30px",display:"flex",flexDirection:"column",justifyContent:"space-evenly",alignItems:"center",children:[a.jsx(Vi,{}),a.jsx(T.Box,{boxSizing:"border-box",display:"flex",justifyContent:"center",alignItems:"center","align-self":"stretch",padding:"12px 50px 12px 50px",borderRadius:"8px",border:"2px solid #FECACA",background:"#FEF2F2",children:a.jsx(T.Text,{color:"#991B1B",fontSize:"md",children:e})})]})}const Xl="https://api.withampersand.com/v1".replace(/\/+$/,"");class Ms{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:Xl}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||$s}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 Yl=new Ms,Hr=class Hr{constructor(t=Yl){this.configuration=t,this.fetchApi=async(n,r)=>{let i={url:n,init:r};for(const s of this.middleware)s.pre&&(i=await s.pre({fetch:this.fetchApi,...i})||i);let o;try{o=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(s){for(const c of this.middleware)c.onError&&(o=await c.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:s,response:o?o.clone():void 0})||o);if(o===void 0)throw s instanceof Error?new Ql(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?Hr.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 Ls(o,"Response returned an error code")}async createFetchParams(t,n){let r=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(r+="?"+this.configuration.queryParamsStringify(t.query));const i=Object.assign({},this.configuration.headers,t.headers);Object.keys(i).forEach(u=>i[u]===void 0?delete i[u]:{});const o=typeof n=="function"?n:async()=>n,s={method:t.method,headers:i,body:t.body,credentials:this.configuration.credentials},c={...s,...await o({init:s,context:t})},l={...c,body:Zl(c.body)||c.body instanceof URLSearchParams||Gl(c.body)?c.body:JSON.stringify(c.body)};return{url:r,init:l}}clone(){const t=this.constructor,n=new t(this.configuration);return n.middleware=this.middleware.slice(),n}};Hr.jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");let Rt=Hr;function Gl(e){return typeof Blob<"u"&&e instanceof Blob}function Zl(e){return typeof FormData<"u"&&e instanceof FormData}class Ls extends Error{constructor(t,n){super(n),this.response=t,this.name="ResponseError"}}class Ql extends Error{constructor(t,n){super(n),this.cause=t,this.name="FetchError"}}class ie extends Error{constructor(t,n){super(n),this.field=t,this.name="RequiredError"}}function K(e,t){const n=e[t];return n!=null}function $s(e,t=""){return Object.keys(e).map(n=>Ks(n,e[n],t)).filter(n=>n.length>0).join("&")}function Ks(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 Ks(e,i,n)}return t instanceof Date?`${encodeURIComponent(r)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?$s(t,r):`${encodeURIComponent(r)}=${encodeURIComponent(String(t))}`}function Ho(e,t){return Object.keys(e).reduce((n,r)=>({...n,[r]:t(e[r])}),{})}class je{constructor(t,n=r=>r){this.raw=t,this.transformer=n}async value(){return this.transformer(await this.raw.json())}}class On{constructor(t){this.raw=t}async value(){}}class eu{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function tu(e){return nu(e)}function nu(e,t){return e==null?e:{fieldUsed:K(e,"fieldUsed")?e.fieldUsed:void 0,keyFormat:K(e,"keyFormat")?e.keyFormat:void 0}}function ru(e){return ou(e)}function ou(e,t){return e==null?e:{name:e.name,valuePrefix:K(e,"valuePrefix")?e.valuePrefix:void 0}}function iu(e){return su(e)}function su(e,t){return e==null?e:{name:e.name}}function au(e){return cu(e)}function cu(e,t){return e==null?e:{attachmentType:e.attachmentType,query:K(e,"query")?iu(e.query):void 0,header:K(e,"header")?ru(e.header):void 0,docsURL:K(e,"docsURL")?e.docsURL:void 0}}function lu(e){return uu(e)}function uu(e,t){return e}function du(e){return pu(e)}function pu(e,t){return e==null?e:{days:K(e,"days")?e.days:void 0,fullHistory:K(e,"fullHistory")?e.fullHistory:void 0}}function fu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function Vs(e){return hu(e)}function hu(e,t){return e==null?e:{defaultPeriod:du(e.defaultPeriod)}}function mu(e){if(e!==void 0)return e===null?null:{defaultPeriod:fu(e.defaultPeriod)}}function gu(e){if(e!==void 0)return e===null?null:{days:e.days,fullHistory:e.fullHistory}}function vu(e){if(e!==void 0)return e===null?null:{defaultPeriod:gu(e.defaultPeriod)}}function yu(e){return wu(e)}function wu(e,t){return e==null?e:{enabled:K(e,"enabled")?e.enabled:void 0}}function Hs(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Iu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,schedule:e.schedule,destination:e.destination,selectedFields:e.selectedFields,selectedFieldMappings:e.selectedFieldMappings,selectedFieldsAuto:e.selectedFieldsAuto,backfill:vu(e.backfill)}}function xu(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ho(e.objects,Iu)}}function bu(e){if(e!==void 0)return e===null?null:{objectName:e.objectName}}function _u(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:Ho(e.objects,bu)}}function Cu(e){return Su(e)}function Su(e,t){return e==null?e:{apiKeyAsBasic:K(e,"apiKeyAsBasic")?e.apiKeyAsBasic:void 0,apiKeyAsBasicOpts:K(e,"apiKeyAsBasicOpts")?tu(e.apiKeyAsBasicOpts):void 0,docsURL:K(e,"docsURL")?e.docsURL:void 0}}function Ou(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function hr(e){return Eu(e)}function Eu(e,t){return e==null?e:{id:e.id,name:e.name,appName:e.appName,orgId:K(e,"orgId")?e.orgId:void 0,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Nu(e){return Tu(e)}function Tu(e,t){return e==null?e:{insert:e.insert,update:e.update,upsert:e.upsert,_delete:e.delete}}function Ru(e){return Au(e)}function Au(e,t){return e==null?e:{provider:e.provider,read:K(e,"read")?e.read:void 0,write:K(e,"write")?e.write:void 0,proxy:K(e,"proxy")?yu(e.proxy):void 0}}function Bs(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 Pu(e)}function Pu(e,t){return e==null?e:{id:e.id,revisionId:e.revisionId,createTime:new Date(e.createTime),createdBy:e.createdBy,content:Ru(e.content)}}function Du(e){return ku(e)}function ku(e,t){return e==null?e:{consumerRef:e.consumerRef,consumerName:e.consumerName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function Us(e){return Fu(e)}function Fu(e,t){return e==null?e:{groupRef:e.groupRef,groupName:e.groupName,projectId:e.projectId,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function br(e){return Mu(e)}function Mu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,externalRef:K(e,"externalRef")?e.externalRef:void 0,provider:e.provider,clientId:e.clientId,scopes:K(e,"scopes")?e.scopes:void 0,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function _r(e){return Lu(e)}function Lu(e,t){return e==null?e:{id:e.id,projectId:e.projectId,providerApp:br(e.providerApp),group:Us(e.group),consumer:Du(e.consumer),providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:K(e,"ProviderConsumerRef")?e.ProviderConsumerRef:void 0,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0}}function $u(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:Bs(e.content)}}function Ku(e){if(e!==void 0)return e===null?null:{groupRef:e.groupRef,connectionId:e.connectionId,config:$u(e.config)}}function Vu(e){return Hu(e)}function Hu(e,t){return e==null?e:{enabled:K(e,"enabled")?e.enabled:void 0}}function Bu(e){if(e!==void 0)return e===null?null:{enabled:e.enabled}}function Uu(e){return qu(e)}function qu(e,t){return e==null?e:{mode:K(e,"mode")?e.mode:void 0,pageSize:K(e,"pageSize")?e.pageSize:void 0}}function Wu(e){if(e!==void 0)return e===null?null:{mode:e.mode,pageSize:e.pageSize}}function zu(e){let t=!0;return t=t&&"fieldName"in e,t}function Ju(e,t){return e==null?e:{fieldName:e.fieldName,mapToName:K(e,"mapToName")?e.mapToName:void 0}}function Xu(e){if(e!==void 0)return e===null?null:{fieldName:e.fieldName,mapToName:e.mapToName}}function Yu(e){let t=!0;return t=t&&"mapToName"in e,t}function qs(e,t){return e==null?e:{mapToName:e.mapToName,mapToDisplayName:K(e,"mapToDisplayName")?e.mapToDisplayName:void 0,_default:K(e,"default")?e.default:void 0,prompt:K(e,"prompt")?e.prompt:void 0}}function Gu(e){if(e!==void 0)return e===null?null:{mapToName:e.mapToName,mapToDisplayName:e.mapToDisplayName,default:e._default,prompt:e.prompt}}function Ui(e){return Zu(e)}function Zu(e,t){return e==null?e:{...Ju(e),...qs(e)}}function qi(e){if(e!==void 0)return e===null?null:zu(e)?Xu(e):Yu(e)?Gu(e):{}}function Ws(e){return Qu(e)}function Qu(e,t){return e}function ed(e){return td(e)}function td(e,t){return e==null?e:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,requiredFields:K(e,"requiredFields")?e.requiredFields.map(Ui):void 0,optionalFields:K(e,"optionalFields")?e.optionalFields.map(Ui):void 0,optionalFieldsAuto:K(e,"optionalFieldsAuto")?Ws(e.optionalFieldsAuto):void 0,backfill:K(e,"backfill")?Vs(e.backfill):void 0,delivery:K(e,"delivery")?Uu(e.delivery):void 0}}function nd(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,destination:e.destination,schedule:e.schedule,requiredFields:e.requiredFields===void 0?void 0:e.requiredFields.map(qi),optionalFields:e.optionalFields===void 0?void 0:e.optionalFields.map(qi),optionalFieldsAuto:e.optionalFieldsAuto,backfill:mu(e.backfill),delivery:Wu(e.delivery)}}function rd(e){return od(e)}function od(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(ed):void 0}}function id(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(nd)}}function sd(e){return ad(e)}function ad(e,t){return e==null?e:{objectName:e.objectName,inheritMappingFromRead:K(e,"inheritMappingFromRead")?e.inheritMappingFromRead:void 0}}function cd(e){if(e!==void 0)return e===null?null:{objectName:e.objectName,inheritMappingFromRead:e.inheritMappingFromRead}}function ld(e){return ud(e)}function ud(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(sd):void 0}}function dd(e){if(e!==void 0)return e===null?null:{objects:e.objects===void 0?void 0:e.objects.map(cd)}}function pd(e){return fd(e)}function fd(e,t){return e==null?e:{name:e.name,displayName:K(e,"displayName")?e.displayName:void 0,provider:e.provider,read:K(e,"read")?rd(e.read):void 0,write:K(e,"write")?ld(e.write):void 0,proxy:K(e,"proxy")?Vu(e.proxy):void 0}}function hd(e){if(e!==void 0)return e===null?null:{name:e.name,displayName:e.displayName,provider:e.provider,read:id(e.read),write:dd(e.write),proxy:Bu(e.proxy)}}function md(e){if(e!==void 0)return e===null?null:{specVersion:e.specVersion,content:hd(e.content)}}function gd(e){if(e!==void 0)return e===null?null:{name:e.name,provider:e.provider,latestRevision:md(e.latestRevision)}}function vd(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name,orgId:e.orgId}}function yd(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 wd(e){if(e!==void 0)return e===null?null:{sourceZipUrl:e.sourceZipUrl,sourceYaml:e.sourceYaml}}function Id(e){if(e!==void 0)return e===null?null:{username:e.username,password:e.password}}function xd(e){if(e!==void 0)return e===null?null:{clientId:e.clientId,clientSecret:e.clientSecret,scopes:e.scopes}}function bd(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 _d(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:Id(e.basicAuth),oauth2ClientCredentials:xd(e.oauth2ClientCredentials),oauth2Password:bd(e.oauth2Password)}}function Cd(e){return Sd(e)}function Sd(e,t){return e==null?e:{enabled:K(e,"enabled")?e.enabled:void 0}}function Od(e,t){return e==null?e:{fieldName:e.fieldName,displayName:e.displayName}}function io(e){return Ed(e)}function Ed(e,t){return e==null?e:{...Od(e),...qs(e)}}function Nd(e){return Td(e)}function Td(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName,destination:e.destination,schedule:e.schedule,requiredFields:K(e,"requiredFields")?e.requiredFields.map(io):void 0,optionalFields:K(e,"optionalFields")?e.optionalFields.map(io):void 0,optionalFieldsAuto:K(e,"optionalFieldsAuto")?Ws(e.optionalFieldsAuto):void 0,allFields:K(e,"allFields")?e.allFields.map(io):void 0,backfill:K(e,"backfill")?Vs(e.backfill):void 0}}function Rd(e){return Ad(e)}function Ad(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(Nd):void 0}}function jd(e){return Pd(e)}function Pd(e,t){return e==null?e:{objectName:e.objectName,displayName:e.displayName}}function Dd(e){return kd(e)}function kd(e,t){return e==null?e:{objects:K(e,"objects")?e.objects.map(jd):void 0}}function Fd(e){return Md(e)}function Md(e,t){return e==null?e:{name:e.name,displayName:K(e,"displayName")?e.displayName:void 0,provider:e.provider,read:K(e,"read")?Rd(e.read):void 0,write:K(e,"write")?Dd(e.write):void 0,proxy:K(e,"proxy")?Cd(e.proxy):void 0}}function Ld(e){return $d(e)}function $d(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:Fd(e.content)}}function Kd(e){if(e!==void 0)return e===null?null:{providerAppId:e.providerAppId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerWorkspaceRef:e.providerWorkspaceRef,providerConsumerRef:e.providerConsumerRef,refreshToken:e.refreshToken,scopes:e.scopes}}function Vd(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,content:Bs(e.content)}}function Hd(e){if(e!==void 0)return e===null?null:{provider:e.provider,connection:Kd(e.connection),config:Vd(e.config)}}function Bn(e){return Bd(e)}function Bd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,integrationId:e.integrationId,group:K(e,"group")?Us(e.group):void 0,healthStatus:e.healthStatus,connection:_r(e.connection),createTime:new Date(e.createTime),createdBy:e.createdBy,updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0,config:ju(e.config)}}function Ud(e){return qd(e)}function qd(e,t){return e==null?e:{id:e.id,specVersion:e.specVersion,createTime:new Date(e.createTime),content:pd(e.content)}}function Wi(e){return Wd(e)}function Wd(e,t){return e==null?e:{id:e.id,projectId:e.projectId,name:e.name,provider:e.provider,createTime:new Date(e.createTime),updateTime:K(e,"updateTime")?new Date(e.updateTime):void 0,latestRevision:Ud(e.latestRevision)}}function zd(e){return Jd(e)}function Jd(e,t){return e==null?e:{iconURL:K(e,"iconURL")?e.iconURL:void 0,logoURL:K(e,"logoURL")?e.logoURL:void 0}}function Xd(e){return Yd(e)}function Yd(e,t){return e==null?e:{iconURL:K(e,"iconURL")?e.iconURL:void 0,logoURL:K(e,"logoURL")?e.logoURL:void 0}}function Gd(e){return Zd(e)}function Zd(e,t){return e==null?e:{regular:K(e,"regular")?Xd(e.regular):void 0,darkMode:K(e,"darkMode")?zd(e.darkMode):void 0}}function Qd(e){return ep(e)}function ep(e,t){return e==null?e:{workspaceRefField:K(e,"workspaceRefField")?e.workspaceRefField:void 0,consumerRefField:K(e,"consumerRefField")?e.consumerRefField:void 0,scopesField:K(e,"scopesField")?e.scopesField:void 0}}function tp(e){return np(e)}function np(e,t){return e==null?e:{grantType:e.grantType,authURL:K(e,"authURL")?e.authURL:void 0,tokenURL:e.tokenURL,explicitScopesRequired:e.explicitScopesRequired,explicitWorkspaceRequired:e.explicitWorkspaceRequired,audience:K(e,"audience")?e.audience:void 0,tokenMetadataFields:Qd(e.tokenMetadataFields),docsURL:K(e,"docsURL")?e.docsURL:void 0,authURLParams:K(e,"authURLParams")?e.authURLParams:void 0}}function rp(e){if(e!==void 0)return e===null?null:{providerWorkspaceRef:e.providerWorkspaceRef,projectId:e.projectId,groupRef:e.groupRef,groupName:e.groupName,consumerRef:e.consumerRef,consumerName:e.consumerName,providerAppId:e.providerAppId,provider:e.provider}}function op(e){return ip(e)}function ip(e,t){return e==null?e:{bulkWrite:Nu(e.bulkWrite),proxy:e.proxy,read:e.read,subscribe:e.subscribe,write:e.write}}function zi(e){return sp(e)}function sp(e,t){return e==null?e:{name:e.name,authType:lu(e.authType),baseURL:e.baseURL,oauth2Opts:K(e,"oauth2Opts")?tp(e.oauth2Opts):void 0,apiKeyOpts:K(e,"apiKeyOpts")?au(e.apiKeyOpts):void 0,basicOpts:K(e,"basicOpts")?Cu(e.basicOpts):void 0,support:op(e.support),providerOpts:e.providerOpts,displayName:K(e,"displayName")?e.displayName:void 0,postAuthInfoNeeded:K(e,"postAuthInfoNeeded")?e.postAuthInfoNeeded:void 0,media:K(e,"media")?Gd(e.media):void 0,labels:K(e,"labels")?e.labels:void 0}}function ap(e){if(e!==void 0)return e===null?null:{provider:e.provider,read:xu(e.read),write:_u(e.write),proxy:Hs(e.proxy)}}function cp(e){if(e!==void 0)return e===null?null:{revisionId:e.revisionId,createdBy:e.createdBy,content:ap(e.content)}}function lp(e){if(e!==void 0)return e===null?null:{connectionId:e.connectionId,config:cp(e.config)}}function up(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,installation:lp(e.installation)}}function dp(e){if(e!==void 0)return e===null?null:{appName:e.appName,name:e.name}}function pp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,project:dp(e.project)}}function fp(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 hp(e){if(e!==void 0)return e===null?null:{updateMask:e.updateMask,providerApp:fp(e.providerApp)}}class mp extends Rt{async generateConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling generateConnection.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections:generate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:_d(t.generateConnectionParams)},n);return new je(o,s=>_r(s))}async generateConnection(t,n){return await(await this.generateConnectionRaw(t,n)).value()}async getConnectionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getConnection.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getConnection.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections/{connectionId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{connectionId}",encodeURIComponent(String(t.connectionId))),method:"GET",headers:i,query:r},n);return new je(o,s=>_r(s))}async getConnection(t,n){return await(await this.getConnectionRaw(t,n)).value()}async listConnectionsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listConnections.");const r={};t.provider!==void 0&&(r.provider=t.provider),t.groupRef!==void 0&&(r.groupRef=t.groupRef),t.consumerRef!==void 0&&(r.consumerRef=t.consumerRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/connections".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new je(o,s=>s.map(_r))}async listConnections(t,n){return await(await this.listConnectionsRaw(t,n)).value()}}class gp extends Rt{async createInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling createInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Ku(t.installation)},n);return new je(o,s=>Bn(s))}async createInstallation(t,n){return await(await this.createInstallationRaw(t,n)).value()}async deleteInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling deleteInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"DELETE",headers:i,query:r},n);return new On(o)}async deleteInstallation(t,n){await this.deleteInstallationRaw(t,n)}async getInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling getInstallation.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"GET",headers:i,query:r},n);return new je(o,s=>Bn(s))}async getInstallation(t,n){return await(await this.getInstallationRaw(t,n)).value()}async importInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling importInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling importInstallation.");if(t.installation===null||t.installation===void 0)throw new ie("installation","Required parameter requestParameters.installation was null or undefined when calling importInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations:import".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:Hd(t.installation)},n);return new je(o,s=>Bn(s))}async importInstallation(t,n){return await(await this.importInstallationRaw(t,n)).value()}async listInstallationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listInstallations.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling listInstallations.");const r={};t.groupRef!==void 0&&(r.groupRef=t.groupRef);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"GET",headers:i,query:r},n);return new je(o,s=>s.map(Bn))}async listInstallations(t,n){return await(await this.listInstallationsRaw(t,n)).value()}async updateInstallationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateInstallation.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling updateInstallation.");if(t.installationId===null||t.installationId===void 0)throw new ie("installationId","Required parameter requestParameters.installationId was null or undefined when calling updateInstallation.");if(t.installationUpdate===null||t.installationUpdate===void 0)throw new ie("installationUpdate","Required parameter requestParameters.installationUpdate was null or undefined when calling updateInstallation.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/installations/{installationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{installationId}",encodeURIComponent(String(t.installationId))),method:"PATCH",headers:i,query:r,body:up(t.installationUpdate)},n);return new je(o,s=>Bn(s))}async updateInstallation(t,n){return await(await this.updateInstallationRaw(t,n)).value()}}class vp extends Rt{async batchUpsertIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling batchUpsertIntegrations.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations:batch".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PUT",headers:i,query:r,body:Ou(t.batchUpsertIntegrationsRequest)},n);return new je(o,s=>s.map(Wi))}async batchUpsertIntegrations(t,n){return await(await this.batchUpsertIntegrationsRaw(t,n)).value()}async createIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createIntegration.");if(t.integration===null||t.integration===void 0)throw new ie("integration","Required parameter requestParameters.integration was null or undefined when calling createIntegration.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:gd(t.integration)},n);return new On(o)}async createIntegration(t,n){await this.createIntegrationRaw(t,n)}async deleteIntegrationRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteIntegration.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling deleteIntegration.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"DELETE",headers:i,query:r},n);return new On(o)}async deleteIntegration(t,n){await this.deleteIntegrationRaw(t,n)}async listIntegrationsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listIntegrations.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new je(o,s=>s.map(Wi))}async listIntegrations(t,n){return await(await this.listIntegrationsRaw(t,n)).value()}}class yp extends Rt{async oauthConnectRaw(t,n){if(t.connectOAuthParams===null||t.connectOAuthParams===void 0)throw new ie("connectOAuthParams","Required parameter requestParameters.connectOAuthParams was null or undefined when calling oauthConnect.");const r={},i={};i["Content-Type"]="application/json";const o=await this.request({path:"/oauth-connect",method:"POST",headers:i,query:r,body:rp(t.connectOAuthParams)},n);return this.isJsonMime(o.headers.get("content-type"))?new je(o):new eu(o)}async oauthConnect(t,n){return await(await this.oauthConnectRaw(t,n)).value()}}class wp extends Rt{async createProjectRaw(t,n){if(t.project===null||t.project===void 0)throw new ie("project","Required parameter requestParameters.project was null or undefined when calling createProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects",method:"POST",headers:i,query:r,body:vd(t.project)},n);return new je(o,s=>hr(s))}async createProject(t,n){return await(await this.createProjectRaw(t,n)).value()}async deleteProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"DELETE",headers:i,query:r},n);return new On(o)}async deleteProject(t,n){await this.deleteProjectRaw(t,n)}async getProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getProject.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new je(o,s=>hr(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 je(i,o=>o.map(hr))}async listProjects(t){return await(await this.listProjectsRaw(t)).value()}async updateProjectRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProject.");if(t.projectUpdate===null||t.projectUpdate===void 0)throw new ie("projectUpdate","Required parameter requestParameters.projectUpdate was null or undefined when calling updateProject.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"PATCH",headers:i,query:r,body:pp(t.projectUpdate)},n);return new je(o,s=>hr(s))}async updateProject(t,n){return await(await this.updateProjectRaw(t,n)).value()}}class Ip extends Rt{async getProviderRaw(t,n){if(t.provider===null||t.provider===void 0)throw new ie("provider","Required parameter requestParameters.provider was null or undefined when calling getProvider.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/providers/{provider}".replace("{provider}",encodeURIComponent(String(t.provider))),method:"GET",headers:i,query:r},n);return new je(o,s=>zi(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 je(i,o=>Ho(o,zi))}async listProviders(t){return await(await this.listProvidersRaw(t)).value()}}class xp extends Rt{async createProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createProviderApp.");if(t.providerApp===null||t.providerApp===void 0)throw new ie("providerApp","Required parameter requestParameters.providerApp was null or undefined when calling createProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"POST",headers:i,query:r,body:yd(t.providerApp)},n);return new je(o,s=>br(s))}async createProviderApp(t,n){return await(await this.createProviderAppRaw(t,n)).value()}async deleteProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling deleteProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling deleteProviderApp.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"DELETE",headers:i,query:r},n);return new On(o)}async deleteProviderApp(t,n){await this.deleteProviderAppRaw(t,n)}async listProviderAppsRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling listProviderApps.");const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))),method:"GET",headers:i,query:r},n);return new je(o,s=>s.map(br))}async listProviderApps(t,n){return await(await this.listProviderAppsRaw(t,n)).value()}async updateProviderAppRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling updateProviderApp.");if(t.providerAppId===null||t.providerAppId===void 0)throw new ie("providerAppId","Required parameter requestParameters.providerAppId was null or undefined when calling updateProviderApp.");if(t.providerAppUpdate===null||t.providerAppUpdate===void 0)throw new ie("providerAppUpdate","Required parameter requestParameters.providerAppUpdate was null or undefined when calling updateProviderApp.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/provider-apps/{providerAppId}".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{providerAppId}",encodeURIComponent(String(t.providerAppId))),method:"PATCH",headers:i,query:r,body:hp(t.providerAppUpdate)},n);return new je(o,s=>br(s))}async updateProviderApp(t,n){return await(await this.updateProviderAppRaw(t,n)).value()}}class bp extends Rt{async createRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling createRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling createRevision.");const r={},i={};i["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))),method:"POST",headers:i,query:r,body:wd(t.revision)},n);return new On(o)}async createRevision(t,n){await this.createRevisionRaw(t,n)}async getHydratedRevisionRaw(t,n){if(t.projectIdOrName===null||t.projectIdOrName===void 0)throw new ie("projectIdOrName","Required parameter requestParameters.projectIdOrName was null or undefined when calling getHydratedRevision.");if(t.integrationId===null||t.integrationId===void 0)throw new ie("integrationId","Required parameter requestParameters.integrationId was null or undefined when calling getHydratedRevision.");if(t.revisionId===null||t.revisionId===void 0)throw new ie("revisionId","Required parameter requestParameters.revisionId was null or undefined when calling getHydratedRevision.");if(t.connectionId===null||t.connectionId===void 0)throw new ie("connectionId","Required parameter requestParameters.connectionId was null or undefined when calling getHydratedRevision.");const r={};t.connectionId!==void 0&&(r.connectionId=t.connectionId);const i={};this.configuration&&this.configuration.apiKey&&(i["X-Api-Key"]=this.configuration.apiKey("X-Api-Key"));const o=await this.request({path:"/projects/{projectIdOrName}/integrations/{integrationId}/revisions/{revisionId}:hydrate".replace("{projectIdOrName}",encodeURIComponent(String(t.projectIdOrName))).replace("{integrationId}",encodeURIComponent(String(t.integrationId))).replace("{revisionId}",encodeURIComponent(String(t.revisionId))),method:"GET",headers:i,query:r},n);return new je(o,s=>Ld(s))}async getHydratedRevision(t,n){return await(await this.getHydratedRevisionRaw(t,n)).value()}}class _p{constructor(t){this.connectionApi=new mp(t),this.installationApi=new gp(t),this.integrationApi=new vp(t),this.oAuthApi=new yp(t),this.projectApi=new wp(t),this.providerApi=new Ip(t),this.providerAppApi=new xp(t),this.revisionApi=new bp(t)}}const Cp="1.16.0",Sp="v1",mr="https://api.withampersand.com";function zs(){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 Op=(e,t)=>`${e}/${t}`;function Ep(){return Op(zs(),Sp)}const Np=zs(),Tp=Ep(),Rp=new Ms({basePath:Tp,headers:{"X-Amp-Client":"react","X-Amp-Client-Version":Cp}});let Ap=new _p(Rp);const Se=()=>Ap;function jp(){return a.jsx(T.Box,{className:"loading-icon",height:"100%",width:"100%",display:"flex",justifyContent:"center",marginTop:"20%",marginBottom:"20%",children:a.jsx(T.Stack,{alignItems:"center",children:a.jsx(T.Spinner,{height:"100px",width:"100px",alignSelf:"center",thickness:"8px",speed:"1s",emptyColor:"gray.200",color:"blue.500",size:"xl",margin:"20px"})})})}const Pp="_loader_h78nh_1",Dp="_rotate_h78nh_1",kp="_ball1_h78nh_1",Fp="_ball2_h78nh_1",Mp={loader:Pp,rotate:Dp,ball1:kp,ball2:Fp};function Lp(){return a.jsx("span",{className:Mp.loader})}function Et(){return Pe?a.jsx("div",{style:{display:"flex",width:"100%",height:"100%",justifyContent:"center",marginTop:"20%",marginBottom:"20%"},children:a.jsx(Lp,{})}):a.jsx(jp,{})}const Ye=async(e,t)=>{var n;if(e instanceof Ls){const{status:r,statusText:i}=e.response;console.error(r===500?"Internal Server Error (500):":r===400?"Bad Request (400):":`Error (${r}):`,i);const o=await e.response.json(),s=((n=o==null?void 0:o.causes)==null?void 0:n.join(`
|
|
3
|
+
`))||"[ERROR] Creating installation failed.";console.error("[Error Message]",s),t&&t(s)}else console.error("Unexpected error:",e.message)},Js=g.createContext({integrations:null}),Xs=()=>{const e=g.useContext(Js);if(!e)throw new Error("useIntegrationList must be used within a IntegrationListProvider");return e};function $p({projectIdOrName:e,children:t}){const n=Ve(),{setError:r,isError:i}=on(),[o,s]=g.useState(null),[c,l]=g.useState(!0);g.useEffect(()=>{Se().integrationApi.listIntegrations({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(d=>{l(!1),s(d||[])}).catch(d=>{console.error("Error retrieving integration information."),Ye(d),l(!1),r(Te.INTEGRATION_LIST,e)})},[e,n,r]);const u=g.useMemo(()=>({integrations:o}),[o]);return i(Te.INTEGRATION_LIST,e)?a.jsx(Ut,{message:"Error retrieving integrations for the project, double check the API key"}):a.jsx(Js.Provider,{value:u,children:c?a.jsx(Et,{}):t})}const Ys=g.createContext({project:null,appName:"",projectId:"",projectIdOrName:""}),De=()=>{const e=g.useContext(Ys);if(!e)throw new Error("useProject must be used within a ProjectProvider");return e};function Kp({projectIdOrName:e,children:t}){const n=Ve(),{isError:r,setError:i}=on(),[o,s]=g.useState(null),[c,l]=g.useState(!0);g.useEffect(()=>{Se().projectApi.getProject({projectIdOrName:e},{headers:{"X-Api-Key":n??""}}).then(d=>{l(!1),s(d)}).catch(d=>{console.error("Error loading Ampersand project."),Ye(d),i(Te.PROJECT,e),l(!1)})},[e,n,l,i]);const u=g.useMemo(()=>({projectId:(o==null?void 0:o.id)||"",projectIdOrName:e,project:o,appName:(o==null?void 0:o.appName)||""}),[e,o]);return r(Te.PROJECT,e)?a.jsx(Ut,{message:`Error loading project ${e}`}):a.jsx(Ys.Provider,{value:u,children:c?a.jsx(Et,{}):t})}function Vp(e){const{options:{apiKey:t,projectId:n,project:r},children:i}=e,o=r||n;if(n&&r)throw new Error("Use AmpersandProvider either with projectId or project but not both.");if(!o)throw new Error("Cannot use AmpersandProvider without a projectId or name.");if(!t)throw new Error("Cannot use AmpersandProvider without an apiKey.");return a.jsx(Ll,{children:a.jsx(Vl,{children:a.jsx($l,{value:t,children:a.jsx(Kp,{projectIdOrName:o,children:a.jsx($p,{projectIdOrName:o,children:i})})})})})}const Gs=g.createContext(null);function Hp(){const e=g.useContext(Gs);if(!e)throw new Error(`Cannot call useAmpersandProvider unless your
|
|
4
|
+
component is wrapped with AmpersandProvider`);return e}const Bp=()=>{const[e,t]=g.useState(!1),n=g.useCallback(()=>{t(!0)},[t]);return{isIntegrationDeleted:e,setIntegrationDeleted:n}},Zs=g.createContext({integrationId:"",provider:"",integrationObj:void 0,consumerRef:"",consumerName:"",groupRef:"",groupName:"",installation:void 0,setInstallation:()=>{},resetInstallations:()=>{},onInstallSuccess:void 0,onUpdateSuccess:void 0,onUninstallSuccess:void 0,isIntegrationDeleted:!1,setIntegrationDeleted:()=>{}});function yt(){const e=g.useContext(Zs);if(!e)throw new Error("useInstallIntegrationProps must be used within an InstallIntegrationProvider");return e}function Up({children:e,integration:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,onInstallSuccess:s,onUpdateSuccess:c,onUninstallSuccess:l,fieldMapping:u}){const d=Ve(),{projectId:f}=De(),{integrations:m}=Xs(),{setError:p,isError:h}=on(),{isIntegrationDeleted:v,setIntegrationDeleted:I}=Bp(),[C,w]=g.useState([]),[_,b]=g.useState(!0),x=(C==null?void 0:C[0])||null,O=g.useMemo(()=>Bl(t,m||[]),[t,m]);g.useEffect(()=>{O===null&&(m!=null&&m.length)&&console.error(`Integration "${t}" not found in integration list`)},[t,O,m]);const M=g.useCallback(X=>{w([X])},[w]),E=g.useCallback(()=>{O!=null&&O.id&&Se().installationApi.listInstallations({projectIdOrName:f,integrationId:O.id,groupRef:i},{headers:{"X-Api-Key":d??""}}).then(X=>{b(!1),w(X||[])}).catch(X=>{p(Te.INSTALLATION_LIST,O.id),b(!1),console.error("Error retrieving installation information: ",X)})},[O,f,d,p,i]),V=(O==null?void 0:O.id)||"";g.useEffect(()=>{E()},[E]);const z=g.useMemo(()=>({integrationId:(O==null?void 0:O.id)||"",provider:(O==null?void 0:O.provider)||"",integrationObj:O,consumerRef:n,consumerName:r,groupRef:i,groupName:o,installation:x,setInstallation:M,resetInstallations:E,onInstallSuccess:s,onUpdateSuccess:c,onUninstallSuccess:l,isIntegrationDeleted:v,setIntegrationDeleted:I,fieldMapping:u}),[O,n,r,i,o,x,M,E,s,c,l,v,I,u]);if(O!==null){const X=`Error retrieving installation information for integration "${(O==null?void 0:O.name)||"unknown"}"`;return h(Te.INSTALLATION_LIST,V)?a.jsx(Ut,{message:X}):a.jsx(Zs.Provider,{value:z,children:_?a.jsx(Et,{}):e})}return a.jsx(Ut,{message:`Integration "${t}" not found`})}const Qs=g.createContext({connections:null,selectedConnection:null,setConnections:()=>{},setSelectedConnection:()=>{}}),Fn=()=>{const e=g.useContext(Qs);if(!e)throw new Error("useConnections must be used within a ConnectionsProvider");return e};function ea({provider:e,groupRef:t,children:n}){const r=Ve(),{projectId:i}=De(),[o,s]=g.useState(null),[c,l]=g.useState(null),[u,d]=g.useState(!0),{setError:f,isError:m}=on(),{provider:p}=yt();if(!i)throw new Error("ConnectionsProvider must be used within AmpersandProvider");const h=e||p;if(!h)throw new Error("ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider");g.useEffect(()=>{Se().connectionApi.listConnections({projectIdOrName:i,groupRef:t,provider:h},{headers:{"X-Api-Key":r??""}}).then(I=>{d(!1),s(I)}).catch(I=>{console.error(`Error retrieving existing OAuth connections for group ID ${t}.`),Ye(I),d(!1),f(Te.CONNECTION_LIST,i)})},[i,r,t,h,f]);const v=g.useMemo(()=>({connections:o,selectedConnection:c,setConnections:s,setSelectedConnection:l}),[o,c,s,l]);return m(Te.CONNECTION_LIST,i)?a.jsx(Ut,{message:"Error retrieving existing connections"}):a.jsx(Qs.Provider,{value:v,children:u?a.jsx(Et,{}):n})}var gr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Bo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Er={exports:{}};Er.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=1,o=2,s=9007199254740991,c="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",d="[object Boolean]",f="[object Date]",m="[object Error]",p="[object Function]",h="[object GeneratorFunction]",v="[object Map]",I="[object Number]",C="[object Null]",w="[object Object]",_="[object Promise]",b="[object Proxy]",x="[object RegExp]",O="[object Set]",M="[object String]",E="[object Symbol]",V="[object Undefined]",z="[object WeakMap]",X="[object ArrayBuffer]",Z="[object DataView]",te="[object Float32Array]",q="[object Float64Array]",ae="[object Int8Array]",re="[object Int16Array]",ee="[object Int32Array]",pe="[object Uint8Array]",he="[object Uint8ClampedArray]",N="[object Uint16Array]",P="[object Uint32Array]",L=/[\\^$.*+?()[\]{}|]/g,k=/^\[object .+?Constructor\]$/,D=/^(?:0|[1-9]\d*)$/,A={};A[te]=A[q]=A[ae]=A[re]=A[ee]=A[pe]=A[he]=A[N]=A[P]=!0,A[c]=A[l]=A[X]=A[d]=A[Z]=A[f]=A[m]=A[p]=A[v]=A[I]=A[w]=A[x]=A[O]=A[M]=A[z]=!1;var Y=typeof gr=="object"&&gr&&gr.Object===Object&&gr,G=typeof self=="object"&&self&&self.Object===Object&&self,H=Y||G||Function("return this")(),Q=t&&!t.nodeType&&t,W=Q&&!0&&e&&!e.nodeType&&e,ce=W&&W.exports===Q,j=ce&&Y.process,fe=function(){try{return j&&j.binding&&j.binding("util")}catch{}}(),B=fe&&fe.isTypedArray;function Ie(y,S){for(var R=-1,J=y==null?0:y.length,_e=0,le=[];++R<J;){var Re=y[R];S(Re,R,y)&&(le[_e++]=Re)}return le}function ke(y,S){for(var R=-1,J=S.length,_e=y.length;++R<J;)y[_e+R]=S[R];return y}function qe(y,S){for(var R=-1,J=y==null?0:y.length;++R<J;)if(S(y[R],R,y))return!0;return!1}function Fe(y,S){for(var R=-1,J=Array(y);++R<y;)J[R]=S(R);return J}function me(y){return function(S){return y(S)}}function wt(y,S){return y.has(S)}function We(y,S){return y==null?void 0:y[S]}function ot(y){var S=-1,R=Array(y.size);return y.forEach(function(J,_e){R[++S]=[_e,J]}),R}function It(y,S){return function(R){return y(S(R))}}function xt(y){var S=-1,R=Array(y.size);return y.forEach(function(J){R[++S]=J}),R}var ze=Array.prototype,He=Function.prototype,Me=Object.prototype,Oe=H["__core-js_shared__"],bt=He.toString,Ge=Me.hasOwnProperty,kt=function(){var y=/[^.]+$/.exec(Oe&&Oe.keys&&Oe.keys.IE_PROTO||"");return y?"Symbol(src)_1."+y:""}(),Wt=Me.toString,it=RegExp("^"+bt.call(Ge).replace(L,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ee=ce?H.Buffer:void 0,Ft=H.Symbol,zt=H.Uint8Array,Mt=Me.propertyIsEnumerable,cn=ze.splice,et=Ft?Ft.toStringTag:void 0,Lt=Object.getOwnPropertySymbols,Jt=Ee?Ee.isBuffer:void 0,ln=It(Object.keys,Object),Xt=bn(H,"DataView"),Ce=bn(H,"Map"),Ze=bn(H,"Promise"),ne=bn(H,"Set"),de=bn(H,"WeakMap"),Le=bn(Object,"create"),$t=pn(Xt),U=pn(Ce),oe=pn(Ze),se=pn(ne),Ae=pn(de),$e=Ft?Ft.prototype:void 0,tt=$e?$e.valueOf:void 0;function Be(y){var S=-1,R=y==null?0:y.length;for(this.clear();++S<R;){var J=y[S];this.set(J[0],J[1])}}function Je(){this.__data__=Le?Le(null):{},this.size=0}function nt(y){var S=this.has(y)&&delete this.__data__[y];return this.size-=S?1:0,S}function be(y){var S=this.__data__;if(Le){var R=S[y];return R===r?void 0:R}return Ge.call(S,y)?S[y]:void 0}function un(y){var S=this.__data__;return Le?S[y]!==void 0:Ge.call(S,y)}function to(y,S){var R=this.__data__;return this.size+=this.has(y)?0:1,R[y]=Le&&S===void 0?r:S,this}Be.prototype.clear=Je,Be.prototype.delete=nt,Be.prototype.get=be,Be.prototype.has=un,Be.prototype.set=to;function ft(y){var S=-1,R=y==null?0:y.length;for(this.clear();++S<R;){var J=y[S];this.set(J[0],J[1])}}function ir(){this.__data__=[],this.size=0}function sr(y){var S=this.__data__,R=lr(S,y);if(R<0)return!1;var J=S.length-1;return R==J?S.pop():cn.call(S,R,1),--this.size,!0}function ar(y){var S=this.__data__,R=lr(S,y);return R<0?void 0:S[R][1]}function xe(y){return lr(this.__data__,y)>-1}function _t(y,S){var R=this.__data__,J=lr(R,y);return J<0?(++this.size,R.push([y,S])):R[J][1]=S,this}ft.prototype.clear=ir,ft.prototype.delete=sr,ft.prototype.get=ar,ft.prototype.has=xe,ft.prototype.set=_t;function Ct(y){var S=-1,R=y==null?0:y.length;for(this.clear();++S<R;){var J=y[S];this.set(J[0],J[1])}}function dn(){this.size=0,this.__data__={hash:new Be,map:new(Ce||ft),string:new Be}}function no(y){var S=ur(this,y).delete(y);return this.size-=S?1:0,S}function Kn(y){return ur(this,y).get(y)}function ol(y){return ur(this,y).has(y)}function il(y,S){var R=ur(this,y),J=R.size;return R.set(y,S),this.size+=R.size==J?0:1,this}Ct.prototype.clear=dn,Ct.prototype.delete=no,Ct.prototype.get=Kn,Ct.prototype.has=ol,Ct.prototype.set=il;function cr(y){var S=-1,R=y==null?0:y.length;for(this.__data__=new Ct;++S<R;)this.add(y[S])}function sl(y){return this.__data__.set(y,r),this}function al(y){return this.__data__.has(y)}cr.prototype.add=cr.prototype.push=sl,cr.prototype.has=al;function Yt(y){var S=this.__data__=new ft(y);this.size=S.size}function cl(){this.__data__=new ft,this.size=0}function ll(y){var S=this.__data__,R=S.delete(y);return this.size=S.size,R}function ul(y){return this.__data__.get(y)}function dl(y){return this.__data__.has(y)}function pl(y,S){var R=this.__data__;if(R instanceof ft){var J=R.__data__;if(!Ce||J.length<n-1)return J.push([y,S]),this.size=++R.size,this;R=this.__data__=new Ct(J)}return R.set(y,S),this.size=R.size,this}Yt.prototype.clear=cl,Yt.prototype.delete=ll,Yt.prototype.get=ul,Yt.prototype.has=dl,Yt.prototype.set=pl;function fl(y,S){var R=dr(y),J=!R&&Nl(y),_e=!R&&!J&&ro(y),le=!R&&!J&&!_e&&$i(y),Re=R||J||_e||le,Ue=Re?Fe(y.length,String):[],Xe=Ue.length;for(var Ne in y)Ge.call(y,Ne)&&!(Re&&(Ne=="length"||_e&&(Ne=="offset"||Ne=="parent")||le&&(Ne=="buffer"||Ne=="byteLength"||Ne=="byteOffset")||_l(Ne,Xe)))&&Ue.push(Ne);return Ue}function lr(y,S){for(var R=y.length;R--;)if(ki(y[R][0],S))return R;return-1}function hl(y,S,R){var J=S(y);return dr(y)?J:ke(J,R(y))}function Vn(y){return y==null?y===void 0?V:C:et&&et in Object(y)?xl(y):El(y)}function Ai(y){return Hn(y)&&Vn(y)==c}function ji(y,S,R,J,_e){return y===S?!0:y==null||S==null||!Hn(y)&&!Hn(S)?y!==y&&S!==S:ml(y,S,R,J,ji,_e)}function ml(y,S,R,J,_e,le){var Re=dr(y),Ue=dr(S),Xe=Re?l:Gt(y),Ne=Ue?l:Gt(S);Xe=Xe==c?w:Xe,Ne=Ne==c?w:Ne;var st=Xe==w,St=Ne==w,Qe=Xe==Ne;if(Qe&&ro(y)){if(!ro(S))return!1;Re=!0,st=!1}if(Qe&&!st)return le||(le=new Yt),Re||$i(y)?Pi(y,S,R,J,_e,le):wl(y,S,Xe,R,J,_e,le);if(!(R&i)){var ht=st&&Ge.call(y,"__wrapped__"),mt=St&&Ge.call(S,"__wrapped__");if(ht||mt){var Zt=ht?y.value():y,Kt=mt?S.value():S;return le||(le=new Yt),_e(Zt,Kt,R,J,le)}}return Qe?(le||(le=new Yt),Il(y,S,R,J,_e,le)):!1}function gl(y){if(!Li(y)||Sl(y))return!1;var S=Fi(y)?it:k;return S.test(pn(y))}function vl(y){return Hn(y)&&Mi(y.length)&&!!A[Vn(y)]}function yl(y){if(!Ol(y))return ln(y);var S=[];for(var R in Object(y))Ge.call(y,R)&&R!="constructor"&&S.push(R);return S}function Pi(y,S,R,J,_e,le){var Re=R&i,Ue=y.length,Xe=S.length;if(Ue!=Xe&&!(Re&&Xe>Ue))return!1;var Ne=le.get(y);if(Ne&&le.get(S))return Ne==S;var st=-1,St=!0,Qe=R&o?new cr:void 0;for(le.set(y,S),le.set(S,y);++st<Ue;){var ht=y[st],mt=S[st];if(J)var Zt=Re?J(mt,ht,st,S,y,le):J(ht,mt,st,y,S,le);if(Zt!==void 0){if(Zt)continue;St=!1;break}if(Qe){if(!qe(S,function(Kt,fn){if(!wt(Qe,fn)&&(ht===Kt||_e(ht,Kt,R,J,le)))return Qe.push(fn)})){St=!1;break}}else if(!(ht===mt||_e(ht,mt,R,J,le))){St=!1;break}}return le.delete(y),le.delete(S),St}function wl(y,S,R,J,_e,le,Re){switch(R){case Z:if(y.byteLength!=S.byteLength||y.byteOffset!=S.byteOffset)return!1;y=y.buffer,S=S.buffer;case X:return!(y.byteLength!=S.byteLength||!le(new zt(y),new zt(S)));case d:case f:case I:return ki(+y,+S);case m:return y.name==S.name&&y.message==S.message;case x:case M:return y==S+"";case v:var Ue=ot;case O:var Xe=J&i;if(Ue||(Ue=xt),y.size!=S.size&&!Xe)return!1;var Ne=Re.get(y);if(Ne)return Ne==S;J|=o,Re.set(y,S);var st=Pi(Ue(y),Ue(S),J,_e,le,Re);return Re.delete(y),st;case E:if(tt)return tt.call(y)==tt.call(S)}return!1}function Il(y,S,R,J,_e,le){var Re=R&i,Ue=Di(y),Xe=Ue.length,Ne=Di(S),st=Ne.length;if(Xe!=st&&!Re)return!1;for(var St=Xe;St--;){var Qe=Ue[St];if(!(Re?Qe in S:Ge.call(S,Qe)))return!1}var ht=le.get(y);if(ht&&le.get(S))return ht==S;var mt=!0;le.set(y,S),le.set(S,y);for(var Zt=Re;++St<Xe;){Qe=Ue[St];var Kt=y[Qe],fn=S[Qe];if(J)var Ki=Re?J(fn,Kt,Qe,S,y,le):J(Kt,fn,Qe,y,S,le);if(!(Ki===void 0?Kt===fn||_e(Kt,fn,R,J,le):Ki)){mt=!1;break}Zt||(Zt=Qe=="constructor")}if(mt&&!Zt){var pr=y.constructor,fr=S.constructor;pr!=fr&&"constructor"in y&&"constructor"in S&&!(typeof pr=="function"&&pr instanceof pr&&typeof fr=="function"&&fr instanceof fr)&&(mt=!1)}return le.delete(y),le.delete(S),mt}function Di(y){return hl(y,Al,bl)}function ur(y,S){var R=y.__data__;return Cl(S)?R[typeof S=="string"?"string":"hash"]:R.map}function bn(y,S){var R=We(y,S);return gl(R)?R:void 0}function xl(y){var S=Ge.call(y,et),R=y[et];try{y[et]=void 0;var J=!0}catch{}var _e=Wt.call(y);return J&&(S?y[et]=R:delete y[et]),_e}var bl=Lt?function(y){return y==null?[]:(y=Object(y),Ie(Lt(y),function(S){return Mt.call(y,S)}))}:jl,Gt=Vn;(Xt&&Gt(new Xt(new ArrayBuffer(1)))!=Z||Ce&&Gt(new Ce)!=v||Ze&&Gt(Ze.resolve())!=_||ne&&Gt(new ne)!=O||de&&Gt(new de)!=z)&&(Gt=function(y){var S=Vn(y),R=S==w?y.constructor:void 0,J=R?pn(R):"";if(J)switch(J){case $t:return Z;case U:return v;case oe:return _;case se:return O;case Ae:return z}return S});function _l(y,S){return S=S??s,!!S&&(typeof y=="number"||D.test(y))&&y>-1&&y%1==0&&y<S}function Cl(y){var S=typeof y;return S=="string"||S=="number"||S=="symbol"||S=="boolean"?y!=="__proto__":y===null}function Sl(y){return!!kt&&kt in y}function Ol(y){var S=y&&y.constructor,R=typeof S=="function"&&S.prototype||Me;return y===R}function El(y){return Wt.call(y)}function pn(y){if(y!=null){try{return bt.call(y)}catch{}try{return y+""}catch{}}return""}function ki(y,S){return y===S||y!==y&&S!==S}var Nl=Ai(function(){return arguments}())?Ai:function(y){return Hn(y)&&Ge.call(y,"callee")&&!Mt.call(y,"callee")},dr=Array.isArray;function Tl(y){return y!=null&&Mi(y.length)&&!Fi(y)}var ro=Jt||Pl;function Rl(y,S){return ji(y,S)}function Fi(y){if(!Li(y))return!1;var S=Vn(y);return S==p||S==h||S==u||S==b}function Mi(y){return typeof y=="number"&&y>-1&&y%1==0&&y<=s}function Li(y){var S=typeof y;return y!=null&&(S=="object"||S=="function")}function Hn(y){return y!=null&&typeof y=="object"}var $i=B?me(B):vl;function Al(y){return Tl(y)?fl(y):yl(y)}function jl(){return[]}function Pl(){return!1}e.exports=Rl})(Er,Er.exports);var qp=Er.exports;const Wp=Bo(qp),tn="other";function At(e){return e.mapToName!==void 0}function zp(e,t){var n;return((n=e==null?void 0:e.objects)==null?void 0:n.find(r=>r.objectName===t))||null}function Jp(e){var t;return((t=e==null?void 0:e.requiredFields)==null?void 0:t.filter(n=>!At(n)&&!!n.fieldName))||null}function Xp(e){var n;return((n=e==null?void 0:e.requiredFields)==null?void 0:n.filter(r=>At(r)&&!!r.mapToName))||[]}function Yp(e){var t;return((t=e==null?void 0:e.optionalFields)==null?void 0:t.filter(n=>!At(n)&&!!n.fieldName))||null}const ta=(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 Gp(e){return At(e)?e.mapToName:e.fieldName}const Uo=(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,completed:e?!!ta(e,s.objectName):!1})}),n},qo=e=>{var n;return{name:tn,completed:e?!!((n=e==null?void 0:e.content)!=null&&n.write):!1}};function Zp(e,t){var o;const n=Uo(e,t),i=!!((o=t==null?void 0:t.content)!=null&&o.write)?qo(e):void 0;return i&&n.push(i),n}function na(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(Te.MAPPING,i),r!=null&&r.length&&console.error("required fields not met",r.map(o=>o.mapToDisplayName)),{errorList:i}}function Wo(e,t){return Wp(e,t)}const Qp=(e,t,n)=>{var p,h,v,I,C,w;if(!e)return null;const r=zp(e,t),i=r&&Jp(r),o=r&&Yp(r),s=r&&Xp(r),c=(r==null?void 0:r.allFields)||[],l=n==null?void 0:n.content,u=((v=(h=(p=l==null?void 0:l.read)==null?void 0:p.objects)==null?void 0:h[t])==null?void 0:v.selectedFields)||{},d=((w=(C=(I=l==null?void 0:l.read)==null?void 0:I.objects)==null?void 0:C[t])==null?void 0:w.selectedFieldMappings)||{},f={...u},m={...d};return{allFields:c,requiredFields:i,optionalFields:o,requiredMapFields:s,selectedOptionalFields:u,selectedFieldMappings:d,isOptionalFieldsModified:!1,isRequiredMapFieldsModified:!1,savedConfig:{optionalFields:f,requiredMapFields:m}}},ef=(e,t)=>{var s,c;if(!e)return null;const n=(c=(s=t==null?void 0:t.content)==null?void 0:s.write)==null?void 0:c.objects,r=Object.keys(n||{}),i={};r.forEach(l=>{i[l]=!0});const o={...i};return{writeObjects:(e==null?void 0:e.objects)||[],selectedNonConfigurableWriteFields:i,isWriteModified:!1,savedConfig:{selectedNonConfigurableWriteFields:o}}};function ra(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:Qp(r,t,n),write:ef(i,n)}}const oa=(e,t,n,r)=>{const i=ra(e,n,t);r(n,i)},tf=(e,t,n)=>{const r=Zp(t,e),i={};r.forEach(({name:o,completed:s})=>{s&&(i[o]=ra(e,o,t))}),n(i)},ia=e=>{const{requiredFields:t,selectedOptionalFields:n}=(e==null?void 0:e.read)||{},r=new Set;return t==null||t.forEach(o=>r.add(Gp(o))),{...Array.from(r).reduce((o,s)=>({...o,[s]:!0}),{}),...n||{}}},sa=e=>{const{selectedFieldMappings:t}=(e==null?void 0:e.read)||{},n={};return t&&Object.keys(t).forEach(r=>{t[r]!==void 0?n[r]=t[r]||"":console.warn(`Error undefined when generating selectedRequiredMapFieldsSubmit for key: ${r}`)}),n};function aa(e,t){return t[e]||void 0}async function zo({createConfig:e,projectId:t,integrationId:n,groupRef:r,connectionId:i,apiKey:o,setError:s,setInstallation:c,onInstallSuccess:l}){const u={projectIdOrName:t,integrationId:n,installation:{groupRef:r,connectionId:i,config:e}};try{const d=await Se().installationApi.createInstallation(u,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}});c(d),l==null||l(d.id,d.config)}catch(d){Ye(d,s)}}function Br(e){var t;return(t=e.content.proxy)==null?void 0:t.enabled}const nf=(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)},rf=(e,t,n,r)=>{const i=ia(e),o=sa(e),s=nf(n,t);if(!s)return console.error(`Error when getting object from hydratedRevision for objectName: ${t}`),null;const c={revisionId:n.id,createdBy:`consumer:${r}`,content:{provider:n.content.provider,read:{objects:{[t]:{objectName:t,schedule:s.schedule,destination:s.destination,selectedFields:i,selectedFieldMappings:o,backfill:s.backfill}}}}};return Br(n)&&(c.content.proxy={enabled:!0}),c},of=(e,t,n,r,i,o,s,c,l,u,d,f)=>{const m=rf(l,o,c,r);return m?zo({createConfig:m,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:s,setError:u,setInstallation:d,onInstallSuccess:f}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},ca=e=>{var o,s;const t={},n=(o=e.write)==null?void 0:o.writeObjects,r=(s=e.write)==null?void 0:s.selectedNonConfigurableWriteFields,i=r?Object.keys(r):[];return n&&n.forEach(c=>{const l=c.objectName;i.includes(l)&&(t[l]={objectName:l})}),t},sf=e=>{const t=e.content.write;return t==null?void 0:t.objects},af=(e,t,n)=>{if(!sf(t))return console.error("Error when getting write objects from hydratedRevision"),null;const i=ca(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},cf=(e,t,n,r,i,o,s,c,l,u,d)=>{const f=af(c,s,r);return f?zo({createConfig:f,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:l,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))},lf=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-background").trim()||"#FEF2F2",uf=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-border").trim()||"#FECACA",df=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-error-text").trim()||"#991B1B",pf={backgroundColor:lf,borderColor:uf,color:df,padding:".5rem 1rem"};function la({children:e,style:t}){return a.jsx(xn,{style:{...pf,...t},children:e})}var ua={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
|
|
8
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",s=0;s<arguments.length;s++){var c=arguments[s];c&&(o=i(o,r(c)))}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 c in o)t.call(o,c)&&o[c]&&(s=i(s,c));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})()})(ua);var ff=ua.exports;const qt=Bo(ff),hf="_button_rchgn_1",mf="_buttonError_rchgn_21",gf="_danger_rchgn_40",vf="_ghost_rchgn_50",so={button:hf,buttonError:mf,danger:gf,ghost:vf};function vt({className:e,style:t,type:n,children:r,variant:i,...o}){const s=qt(so.button,{[so.danger]:i==="danger",[so.ghost]:i==="ghost",[e||""]:!!e});return a.jsx("button",{type:n,className:s,style:t,...o,children:r})}function da(){return a.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("path",{d:"M2.25 4.5H3.75H15.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M7.5 8.25V12.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),a.jsx("path",{d:"M10.5 8.25V12.75",stroke:"#991B1B",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}const Jn="uninstall-installation",yf=g.forwardRef(({text:e="Uninstall"},t)=>{const n=T.useTab({ref:t}),r=T.useMultiStyleConfig("Tabs",n);return a.jsxs(T.Button,{__css:r.warningTab,...n,minHeight:15,children:[a.jsxs(T.Box,{as:"span",display:"flex",alignItems:"center",gap:2,my:2,mx:4,children:[da(),a.jsx(T.Box,{textAlign:"left",children:a.jsx(T.Text,{color:"red.800",children:e})})]}),n.children]})}),pa=g.createContext({hydratedRevision:null,loading:!1}),Mn=()=>{const e=g.useContext(pa);if(!e)throw new Error("useHydratedRevision must be used within a HydratedRevisionProvider");return e};function wf({projectId:e,children:t}){var _;const{selectedConnection:n}=Fn(),{integrationId:r,integrationObj:i}=yt(),[o,s]=g.useState(null),[c,l]=g.useState(!0),{isError:u,removeError:d,setError:f}=on(),m=Ve(),p=n==null?void 0:n.id,h=(_=i==null?void 0:i.latestRevision)==null?void 0:_.id,v=(i==null?void 0:i.name)||r;g.useEffect(()=>{e&&r&&h&&p&&m&&Se().revisionApi.getHydratedRevision({projectIdOrName:e,integrationId:r,revisionId:h,connectionId:p},{headers:{"X-Api-Key":m??""}}).then(b=>{s(b),l(!1),d(Te.HYDRATED_REVISION,v)}).catch(b=>{console.error(`Error loading integration ${v}.`),Ye(b),l(!1),f(Te.HYDRATED_REVISION,v)})},[e,r,h,p,m,d,f,v]);const I=g.useMemo(()=>({hydratedRevision:o,loading:c}),[o,c]),w=`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 a.jsx(pa.Provider,{value:I,children:u(Te.HYDRATED_REVISION,v)?a.jsx(Ut,{message:w}):t})}function Ht(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 bo(e,t){return bo=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},bo(e,t)}function If(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,bo(e,t)}var _o={exports:{}},vr={exports:{}},ge={};/** @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
|
|
15
|
+
*/var Ji;function xf(){if(Ji)return ge;Ji=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,h=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,I=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function _(x){if(typeof x=="object"&&x!==null){var O=x.$$typeof;switch(O){case t:switch(x=x.type,x){case l:case u:case r:case o:case i:case f:return x;default:switch(x=x&&x.$$typeof,x){case c:case d:case h:case p:case s:return x;default:return O}}case n:return O}}}function b(x){return _(x)===u}return ge.AsyncMode=l,ge.ConcurrentMode=u,ge.ContextConsumer=c,ge.ContextProvider=s,ge.Element=t,ge.ForwardRef=d,ge.Fragment=r,ge.Lazy=h,ge.Memo=p,ge.Portal=n,ge.Profiler=o,ge.StrictMode=i,ge.Suspense=f,ge.isAsyncMode=function(x){return b(x)||_(x)===l},ge.isConcurrentMode=b,ge.isContextConsumer=function(x){return _(x)===c},ge.isContextProvider=function(x){return _(x)===s},ge.isElement=function(x){return typeof x=="object"&&x!==null&&x.$$typeof===t},ge.isForwardRef=function(x){return _(x)===d},ge.isFragment=function(x){return _(x)===r},ge.isLazy=function(x){return _(x)===h},ge.isMemo=function(x){return _(x)===p},ge.isPortal=function(x){return _(x)===n},ge.isProfiler=function(x){return _(x)===o},ge.isStrictMode=function(x){return _(x)===i},ge.isSuspense=function(x){return _(x)===f},ge.isValidElementType=function(x){return typeof x=="string"||typeof x=="function"||x===r||x===u||x===o||x===i||x===f||x===m||typeof x=="object"&&x!==null&&(x.$$typeof===h||x.$$typeof===p||x.$$typeof===s||x.$$typeof===c||x.$$typeof===d||x.$$typeof===I||x.$$typeof===C||x.$$typeof===w||x.$$typeof===v)},ge.typeOf=_,ge}var ve={};/** @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
|
|
22
|
+
*/var Xi;function bf(){return Xi||(Xi=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,c=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,m=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,h=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,I=e?Symbol.for("react.fundamental"):60117,C=e?Symbol.for("react.responder"):60118,w=e?Symbol.for("react.scope"):60119;function _(j){return typeof j=="string"||typeof j=="function"||j===r||j===u||j===o||j===i||j===f||j===m||typeof j=="object"&&j!==null&&(j.$$typeof===h||j.$$typeof===p||j.$$typeof===s||j.$$typeof===c||j.$$typeof===d||j.$$typeof===I||j.$$typeof===C||j.$$typeof===w||j.$$typeof===v)}function b(j){if(typeof j=="object"&&j!==null){var fe=j.$$typeof;switch(fe){case t:var B=j.type;switch(B){case l:case u:case r:case o:case i:case f:return B;default:var Ie=B&&B.$$typeof;switch(Ie){case c:case d:case h:case p:case s:return Ie;default:return fe}}case n:return fe}}}var x=l,O=u,M=c,E=s,V=t,z=d,X=r,Z=h,te=p,q=n,ae=o,re=i,ee=f,pe=!1;function he(j){return pe||(pe=!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(j)||b(j)===l}function N(j){return b(j)===u}function P(j){return b(j)===c}function L(j){return b(j)===s}function k(j){return typeof j=="object"&&j!==null&&j.$$typeof===t}function D(j){return b(j)===d}function A(j){return b(j)===r}function Y(j){return b(j)===h}function G(j){return b(j)===p}function H(j){return b(j)===n}function Q(j){return b(j)===o}function W(j){return b(j)===i}function ce(j){return b(j)===f}ve.AsyncMode=x,ve.ConcurrentMode=O,ve.ContextConsumer=M,ve.ContextProvider=E,ve.Element=V,ve.ForwardRef=z,ve.Fragment=X,ve.Lazy=Z,ve.Memo=te,ve.Portal=q,ve.Profiler=ae,ve.StrictMode=re,ve.Suspense=ee,ve.isAsyncMode=he,ve.isConcurrentMode=N,ve.isContextConsumer=P,ve.isContextProvider=L,ve.isElement=k,ve.isForwardRef=D,ve.isFragment=A,ve.isLazy=Y,ve.isMemo=G,ve.isPortal=H,ve.isProfiler=Q,ve.isStrictMode=W,ve.isSuspense=ce,ve.isValidElementType=_,ve.typeOf=b}()),ve}var Yi;function fa(){return Yi||(Yi=1,process.env.NODE_ENV==="production"?vr.exports=xf():vr.exports=bf()),vr.exports}/*
|
|
23
23
|
object-assign
|
|
24
24
|
(c) Sindre Sorhus
|
|
25
25
|
@license MIT
|
|
26
|
-
*/var
|
|
27
|
-
Valid keys: `+JSON.stringify(Object.keys(
|
|
26
|
+
*/var ao,Gi;function _f(){if(Gi)return ao;Gi=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function r(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function i(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var s={},c=0;c<10;c++)s["_"+String.fromCharCode(c)]=c;var l=Object.getOwnPropertyNames(s).map(function(d){return s[d]});if(l.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 ao=i()?Object.assign:function(o,s){for(var c,l=r(o),u,d=1;d<arguments.length;d++){c=Object(arguments[d]);for(var f in c)t.call(c,f)&&(l[f]=c[f]);if(e){u=e(c);for(var m=0;m<u.length;m++)n.call(c,u[m])&&(l[u[m]]=c[u[m]])}}return l},ao}var co,Zi;function Jo(){if(Zi)return co;Zi=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return co=e,co}var lo,Qi;function ha(){return Qi||(Qi=1,lo=Function.call.bind(Object.prototype.hasOwnProperty)),lo}var uo,es;function Cf(){if(es)return uo;es=1;var e=function(){};if(process.env.NODE_ENV!=="production"){var t=Jo(),n={},r=ha();e=function(o){var s="Warning: "+o;typeof console<"u"&&console.error(s);try{throw new Error(s)}catch{}}}function i(o,s,c,l,u){if(process.env.NODE_ENV!=="production"){for(var d in o)if(r(o,d)){var f;try{if(typeof o[d]!="function"){var m=Error((l||"React class")+": "+c+" type `"+d+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof o[d]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw m.name="Invariant Violation",m}f=o[d](s,d,l,c,null,t)}catch(h){f=h}if(f&&!(f instanceof Error)&&e((l||"React class")+": type specification of "+c+" `"+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 "+c+" type: "+f.message+(p??""))}}}}return i.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(n={})},uo=i,uo}var po,ts;function Sf(){if(ts)return po;ts=1;var e=fa(),t=_f(),n=Jo(),r=ha(),i=Cf(),o=function(){};process.env.NODE_ENV!=="production"&&(o=function(c){var l="Warning: "+c;typeof console<"u"&&console.error(l);try{throw new Error(l)}catch{}});function s(){return null}return po=function(c,l){var u=typeof Symbol=="function"&&Symbol.iterator,d="@@iterator";function f(N){var P=N&&(u&&N[u]||N[d]);if(typeof P=="function")return P}var m="<<anonymous>>",p={array:C("array"),bigint:C("bigint"),bool:C("boolean"),func:C("function"),number:C("number"),object:C("object"),string:C("string"),symbol:C("symbol"),any:w(),arrayOf:_,element:b(),elementType:x(),instanceOf:O,node:z(),objectOf:E,oneOf:M,oneOfType:V,shape:Z,exact:te};function h(N,P){return N===P?N!==0||1/N===1/P:N!==N&&P!==P}function v(N,P){this.message=N,this.data=P&&typeof P=="object"?P:{},this.stack=""}v.prototype=Error.prototype;function I(N){if(process.env.NODE_ENV!=="production")var P={},L=0;function k(A,Y,G,H,Q,W,ce){if(H=H||m,W=W||G,ce!==n){if(l){var j=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw j.name="Invariant Violation",j}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var fe=H+":"+G;!P[fe]&&L<3&&(o("You are manually calling a React.PropTypes validation function for the `"+W+"` 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."),P[fe]=!0,L++)}}return Y[G]==null?A?Y[G]===null?new v("The "+Q+" `"+W+"` is marked as required "+("in `"+H+"`, but its value is `null`.")):new v("The "+Q+" `"+W+"` is marked as required in "+("`"+H+"`, but its value is `undefined`.")):null:N(Y,G,H,Q,W)}var D=k.bind(null,!1);return D.isRequired=k.bind(null,!0),D}function C(N){function P(L,k,D,A,Y,G){var H=L[k],Q=re(H);if(Q!==N){var W=ee(H);return new v("Invalid "+A+" `"+Y+"` of type "+("`"+W+"` supplied to `"+D+"`, expected ")+("`"+N+"`."),{expectedType:N})}return null}return I(P)}function w(){return I(s)}function _(N){function P(L,k,D,A,Y){if(typeof N!="function")return new v("Property `"+Y+"` of component `"+D+"` has invalid PropType notation inside arrayOf.");var G=L[k];if(!Array.isArray(G)){var H=re(G);return new v("Invalid "+A+" `"+Y+"` of type "+("`"+H+"` supplied to `"+D+"`, expected an array."))}for(var Q=0;Q<G.length;Q++){var W=N(G,Q,D,A,Y+"["+Q+"]",n);if(W instanceof Error)return W}return null}return I(P)}function b(){function N(P,L,k,D,A){var Y=P[L];if(!c(Y)){var G=re(Y);return new v("Invalid "+D+" `"+A+"` of type "+("`"+G+"` supplied to `"+k+"`, expected a single ReactElement."))}return null}return I(N)}function x(){function N(P,L,k,D,A){var Y=P[L];if(!e.isValidElementType(Y)){var G=re(Y);return new v("Invalid "+D+" `"+A+"` of type "+("`"+G+"` supplied to `"+k+"`, expected a single ReactElement type."))}return null}return I(N)}function O(N){function P(L,k,D,A,Y){if(!(L[k]instanceof N)){var G=N.name||m,H=he(L[k]);return new v("Invalid "+A+" `"+Y+"` of type "+("`"+H+"` supplied to `"+D+"`, expected ")+("instance of `"+G+"`."))}return null}return I(P)}function M(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 P(L,k,D,A,Y){for(var G=L[k],H=0;H<N.length;H++)if(h(G,N[H]))return null;var Q=JSON.stringify(N,function(ce,j){var fe=ee(j);return fe==="symbol"?String(j):j});return new v("Invalid "+A+" `"+Y+"` of value `"+String(G)+"` "+("supplied to `"+D+"`, expected one of "+Q+"."))}return I(P)}function E(N){function P(L,k,D,A,Y){if(typeof N!="function")return new v("Property `"+Y+"` of component `"+D+"` has invalid PropType notation inside objectOf.");var G=L[k],H=re(G);if(H!=="object")return new v("Invalid "+A+" `"+Y+"` of type "+("`"+H+"` supplied to `"+D+"`, expected an object."));for(var Q in G)if(r(G,Q)){var W=N(G,Q,D,A,Y+"."+Q,n);if(W instanceof Error)return W}return null}return I(P)}function V(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 P=0;P<N.length;P++){var L=N[P];if(typeof L!="function")return o("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+pe(L)+" at index "+P+"."),s}function k(D,A,Y,G,H){for(var Q=[],W=0;W<N.length;W++){var ce=N[W],j=ce(D,A,Y,G,H,n);if(j==null)return null;j.data&&r(j.data,"expectedType")&&Q.push(j.data.expectedType)}var fe=Q.length>0?", expected one of type ["+Q.join(", ")+"]":"";return new v("Invalid "+G+" `"+H+"` supplied to "+("`"+Y+"`"+fe+"."))}return I(k)}function z(){function N(P,L,k,D,A){return q(P[L])?null:new v("Invalid "+D+" `"+A+"` supplied to "+("`"+k+"`, expected a ReactNode."))}return I(N)}function X(N,P,L,k,D){return new v((N||"React class")+": "+P+" type `"+L+"."+k+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+D+"`.")}function Z(N){function P(L,k,D,A,Y){var G=L[k],H=re(G);if(H!=="object")return new v("Invalid "+A+" `"+Y+"` of type `"+H+"` "+("supplied to `"+D+"`, expected `object`."));for(var Q in N){var W=N[Q];if(typeof W!="function")return X(D,A,Y,Q,ee(W));var ce=W(G,Q,D,A,Y+"."+Q,n);if(ce)return ce}return null}return I(P)}function te(N){function P(L,k,D,A,Y){var G=L[k],H=re(G);if(H!=="object")return new v("Invalid "+A+" `"+Y+"` of type `"+H+"` "+("supplied to `"+D+"`, expected `object`."));var Q=t({},L[k],N);for(var W in Q){var ce=N[W];if(r(N,W)&&typeof ce!="function")return X(D,A,Y,W,ee(ce));if(!ce)return new v("Invalid "+A+" `"+Y+"` key `"+W+"` supplied to `"+D+"`.\nBad object: "+JSON.stringify(L[k],null," ")+`
|
|
27
|
+
Valid keys: `+JSON.stringify(Object.keys(N),null," "));var j=ce(G,W,D,A,Y+"."+W,n);if(j)return j}return null}return I(P)}function q(N){switch(typeof N){case"number":case"string":case"undefined":return!0;case"boolean":return!N;case"object":if(Array.isArray(N))return N.every(q);if(N===null||c(N))return!0;var P=f(N);if(P){var L=P.call(N),k;if(P!==N.entries){for(;!(k=L.next()).done;)if(!q(k.value))return!1}else for(;!(k=L.next()).done;){var D=k.value;if(D&&!q(D[1]))return!1}}else return!1;return!0;default:return!1}}function ae(N,P){return N==="symbol"?!0:P?P["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&P instanceof Symbol:!1}function re(N){var P=typeof N;return Array.isArray(N)?"array":N instanceof RegExp?"object":ae(P,N)?"symbol":P}function ee(N){if(typeof N>"u"||N===null)return""+N;var P=re(N);if(P==="object"){if(N instanceof Date)return"date";if(N instanceof RegExp)return"regexp"}return P}function pe(N){var P=ee(N);switch(P){case"array":case"object":return"an "+P;case"boolean":case"date":case"regexp":return"a "+P;default:return P}}function he(N){return!N.constructor||!N.constructor.name?m:N.constructor.name}return p.checkPropTypes=i,p.resetWarningCache=i.resetWarningCache,p.PropTypes=p,p},po}var fo,ns;function Of(){if(ns)return fo;ns=1;var e=Jo();function t(){}function n(){}return n.resetWarningCache=t,fo=function(){function r(s,c,l,u,d,f){if(f!==e){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},fo}if(process.env.NODE_ENV!=="production"){var Ef=fa(),Nf=!0;_o.exports=Sf()(Ef.isElement,Nf)}else _o.exports=Of()();var Tf=_o.exports;const F=Bo(Tf);var Co={exports:{}},ye={};/**
|
|
28
28
|
* @license React
|
|
29
29
|
* react-is.production.min.js
|
|
30
30
|
*
|
|
@@ -32,7 +32,7 @@ Valid keys: `+JSON.stringify(Object.keys(T),null," "));var j=oe(W,q,P,R,B+"."+q
|
|
|
32
32
|
*
|
|
33
33
|
* This source code is licensed under the MIT license found in the
|
|
34
34
|
* LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/var
|
|
35
|
+
*/var rs;function Rf(){if(rs)return ye;rs=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"),c=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h;h=Symbol.for("react.module.reference");function v(I){if(typeof I=="object"&&I!==null){var C=I.$$typeof;switch(C){case e:switch(I=I.type,I){case n:case i:case r:case u:case d:return I;default:switch(I=I&&I.$$typeof,I){case c:case s:case l:case m:case f:case o:return I;default:return C}}case t:return C}}}return ye.ContextConsumer=s,ye.ContextProvider=o,ye.Element=e,ye.ForwardRef=l,ye.Fragment=n,ye.Lazy=m,ye.Memo=f,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(I){return v(I)===s},ye.isContextProvider=function(I){return v(I)===o},ye.isElement=function(I){return typeof I=="object"&&I!==null&&I.$$typeof===e},ye.isForwardRef=function(I){return v(I)===l},ye.isFragment=function(I){return v(I)===n},ye.isLazy=function(I){return v(I)===m},ye.isMemo=function(I){return v(I)===f},ye.isPortal=function(I){return v(I)===t},ye.isProfiler=function(I){return v(I)===i},ye.isStrictMode=function(I){return v(I)===r},ye.isSuspense=function(I){return v(I)===u},ye.isSuspenseList=function(I){return v(I)===d},ye.isValidElementType=function(I){return typeof I=="string"||typeof I=="function"||I===n||I===i||I===r||I===u||I===d||I===p||typeof I=="object"&&I!==null&&(I.$$typeof===m||I.$$typeof===f||I.$$typeof===o||I.$$typeof===s||I.$$typeof===l||I.$$typeof===h||I.getModuleId!==void 0)},ye.typeOf=v,ye}var we={};/**
|
|
36
36
|
* @license React
|
|
37
37
|
* react-is.development.js
|
|
38
38
|
*
|
|
@@ -40,4 +40,10 @@ Valid keys: `+JSON.stringify(Object.keys(T),null," "));var j=oe(W,q,P,R,B+"."+q
|
|
|
40
40
|
*
|
|
41
41
|
* This source code is licensed under the MIT license found in the
|
|
42
42
|
* LICENSE file in the root directory of this source tree.
|
|
43
|
-
*/var Ao;function zd(){return Ao||(Ao=1,process.env.NODE_ENV!=="production"&&function(){var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),r=Symbol.for("react.provider"),s=Symbol.for("react.context"),c=Symbol.for("react.server_context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),m=!1,x=!1,w=!1,O=!1,v=!1,C;C=Symbol.for("react.module.reference");function b(L){return!!(typeof L=="string"||typeof L=="function"||L===n||L===i||v||L===o||L===d||L===p||O||L===f||m||x||w||typeof L=="object"&&L!==null&&(L.$$typeof===g||L.$$typeof===h||L.$$typeof===r||L.$$typeof===s||L.$$typeof===u||L.$$typeof===C||L.getModuleId!==void 0))}function I(L){if(typeof L=="object"&&L!==null){var Ee=L.$$typeof;switch(Ee){case e:var Te=L.type;switch(Te){case n:case i:case o:case d:case p:return Te;default:var Ge=Te&&Te.$$typeof;switch(Ge){case c:case s:case u:case g:case h:case r:return Ge;default:return Ee}}case t:return Ee}}}var S=s,H=r,k=e,V=u,z=n,X=g,Z=h,te=t,Q=i,ue=o,le=d,re=p,Oe=!1,Ne=!1;function T(L){return Oe||(Oe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function K(L){return Ne||(Ne=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function F(L){return I(L)===s}function D(L){return I(L)===r}function P(L){return typeof L=="object"&&L!==null&&L.$$typeof===e}function R(L){return I(L)===u}function B(L){return I(L)===n}function W(L){return I(L)===g}function U(L){return I(L)===h}function J(L){return I(L)===t}function q(L){return I(L)===i}function oe(L){return I(L)===o}function j(L){return I(L)===d}function de(L){return I(L)===p}ce.ContextConsumer=S,ce.ContextProvider=H,ce.Element=k,ce.ForwardRef=V,ce.Fragment=z,ce.Lazy=X,ce.Memo=Z,ce.Portal=te,ce.Profiler=Q,ce.StrictMode=ue,ce.Suspense=le,ce.SuspenseList=re,ce.isAsyncMode=T,ce.isConcurrentMode=K,ce.isContextConsumer=F,ce.isContextProvider=D,ce.isElement=P,ce.isForwardRef=R,ce.isFragment=B,ce.isLazy=W,ce.isMemo=U,ce.isPortal=J,ce.isProfiler=q,ce.isStrictMode=oe,ce.isSuspense=j,ce.isSuspenseList=de,ce.isValidElementType=b,ce.typeOf=I}()),ce}process.env.NODE_ENV==="production"?ar.exports=Jd():ar.exports=zd();var jo=ar.exports;const Po=e=>typeof e=="object"&&e!=null&&e.nodeType===1,Do=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",er=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return Do(n.overflowY,t)||Do(n.overflowX,t)||(o=>{const i=(r=>{if(!r.ownerDocument||!r.ownerDocument.defaultView)return null;try{return r.ownerDocument.defaultView.frameElement}catch{return null}})(o);return!!i&&(i.clientHeight<o.scrollHeight||i.clientWidth<o.scrollWidth)})(e)}return!1},fn=(e,t,n,o,i,r,s,c)=>r<e&&s>t||r>e&&s<t?0:r<=e&&c<=n||s>=t&&c>=n?r-e-o:s>t&&c<n||r<e&&c>n?s-t+i:0,Xd=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Yd=(e,t)=>{var n,o,i,r;if(typeof document>"u")return[];const{scrollMode:s,block:c,inline:u,boundary:d,skipOverflowHiddenElements:p}=t,h=typeof d=="function"?d:le=>le!==d;if(!Po(e))throw new TypeError("Invalid target");const g=document.scrollingElement||document.documentElement,f=[];let m=e;for(;Po(m)&&h(m);){if(m=Xd(m),m===g){f.push(m);break}m!=null&&m===document.body&&er(m)&&!er(document.documentElement)||m!=null&&er(m,p)&&f.push(m)}const x=(o=(n=window.visualViewport)==null?void 0:n.width)!=null?o:innerWidth,w=(r=(i=window.visualViewport)==null?void 0:i.height)!=null?r:innerHeight,{scrollX:O,scrollY:v}=window,{height:C,width:b,top:I,right:S,bottom:H,left:k}=e.getBoundingClientRect(),{top:V,right:z,bottom:X,left:Z}=(le=>{const re=window.getComputedStyle(le);return{top:parseFloat(re.scrollMarginTop)||0,right:parseFloat(re.scrollMarginRight)||0,bottom:parseFloat(re.scrollMarginBottom)||0,left:parseFloat(re.scrollMarginLeft)||0}})(e);let te=c==="start"||c==="nearest"?I-V:c==="end"?H+X:I+C/2-V+X,Q=u==="center"?k+b/2-Z+z:u==="end"?S+z:k-Z;const ue=[];for(let le=0;le<f.length;le++){const re=f[le],{height:Oe,width:Ne,top:T,right:K,bottom:F,left:D}=re.getBoundingClientRect();if(s==="if-needed"&&I>=0&&k>=0&&H<=w&&S<=x&&I>=T&&H<=F&&k>=D&&S<=K)return ue;const P=getComputedStyle(re),R=parseInt(P.borderLeftWidth,10),B=parseInt(P.borderTopWidth,10),W=parseInt(P.borderRightWidth,10),U=parseInt(P.borderBottomWidth,10);let J=0,q=0;const oe="offsetWidth"in re?re.offsetWidth-re.clientWidth-R-W:0,j="offsetHeight"in re?re.offsetHeight-re.clientHeight-B-U:0,de="offsetWidth"in re?re.offsetWidth===0?0:Ne/re.offsetWidth:0,L="offsetHeight"in re?re.offsetHeight===0?0:Oe/re.offsetHeight:0;if(g===re)J=c==="start"?te:c==="end"?te-w:c==="nearest"?fn(v,v+w,w,B,U,v+te,v+te+C,C):te-w/2,q=u==="start"?Q:u==="center"?Q-x/2:u==="end"?Q-x:fn(O,O+x,x,R,W,O+Q,O+Q+b,b),J=Math.max(0,J+v),q=Math.max(0,q+O);else{J=c==="start"?te-T-B:c==="end"?te-F+U+j:c==="nearest"?fn(T,F,Oe,B,U+j,te,te+C,C):te-(T+Oe/2)+j/2,q=u==="start"?Q-D-R:u==="center"?Q-(D+Ne/2)+oe/2:u==="end"?Q-K+W+oe:fn(D,K,Ne,R,W+oe,Q,Q+b,b);const{scrollLeft:Ee,scrollTop:Te}=re;J=L===0?0:Math.max(0,Math.min(Te+J/L,re.scrollHeight-Oe/L+j)),q=de===0?0:Math.max(0,Math.min(Ee+q/de,re.scrollWidth-Ne/de+oe)),te+=Te-J,Q+=Ee-q}ue.push({el:re,top:J,left:q})}return ue};var Tt=function(){return Tt=Object.assign||function(t){for(var n,o=1,i=arguments.length;o<i;o++){n=arguments[o];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Tt.apply(this,arguments)};var Gd=0;function ko(e){return typeof e=="function"?e:De}function De(){}function Pi(e,t){if(e){var n=Yd(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach(function(o){var i=o.el,r=o.top,s=o.left;i.scrollTop=r,i.scrollLeft=s})}}function Fo(e,t,n){var o=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return o}function Or(e,t){var n;function o(){n&&clearTimeout(n)}function i(){for(var r=arguments.length,s=new Array(r),c=0;c<r;c++)s[c]=arguments[c];o(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return i.cancel=o,i}function we(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(o){for(var i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];return t.some(function(c){return c&&c.apply(void 0,[o].concat(r)),o.preventDownshiftDefault||o.hasOwnProperty("nativeEvent")&&o.nativeEvent.preventDownshiftDefault})}}function Nt(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(o){t.forEach(function(i){typeof i=="function"?i(o):i&&(i.current=o)})}}function Di(){return String(Gd++)}function Zd(e){var t=e.isOpen,n=e.resultCount,o=e.previousResultCount;return t?n?n!==o?n+" result"+(n===1?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function Mo(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function ki(e){return typeof e.type=="string"}function Fi(e){return e.props}function Qd(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var ep=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function hn(e){e===void 0&&(e={});var t={};return ep.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function _n(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,o){return n[o]=bn(t,o)?t[o]:e[o],n},{})}function bn(e,t){return e[t]!==void 0}function cr(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function tp(e){return Object.prototype.toString.call(e)==="[object Object]"}function wt(e,t,n,o,i){var r=n.length;if(r===0)return-1;var s=r-1;(typeof e!="number"||e<0||e>s)&&(e=t>0?-1:s+1);var c=e+t;c<0?c=s:c>s&&(c=0);var u=Rt(c,t<0,n,o,i);return u===-1?e>=r?-1:e:u}function Rt(e,t,n,o,i){i===void 0&&(i=!1);var r=n.length;if(t){for(var s=e;s>=0;s--)if(!o(n[s],s))return s}else for(var c=e;c<r;c++)if(!o(n[c],c))return c;return i?Rt(t?r-1:0,t,n,o):-1}function Cn(e,t,n,o){return o===void 0&&(o=!0),n&&t.some(function(i){return i&&(Fo(i,e,n)||o&&Fo(i,n.document.activeElement,n))})}var Sr=De;process.env.NODE_ENV!=="production"&&(Sr=function(t,n,o){var i="This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props";Object.keys(t).forEach(function(r){n[r]!==void 0&&o[r]===void 0?console.error('downshift: A component has changed the controlled prop "'+r+'" to be uncontrolled. '+i):n[r]===void 0&&o[r]!==void 0&&console.error('downshift: A component has changed the uncontrolled prop "'+r+'" to be controlled. '+i)})});var np=Or(function(e){Mi(e).textContent=""},500);function Mi(e){var t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}function Ki(e,t){if(!(!e||!t)){var n=Mi(t);n.textContent=e,np(t)}}function rp(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var Li=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,$i=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,Hi=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,vn=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,In=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Vi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Ui=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Bi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,qi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Wi=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Ji=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,zi=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Xi=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,ur=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,Yi=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Gi=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Zi=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,op=Object.freeze({__proto__:null,blurButton:Yi,blurInput:Ji,changeInput:zi,clickButton:ur,clickItem:Wi,controlledPropUpdatedSelectedItem:Gi,itemMouseEnter:Hi,keyDownArrowDown:In,keyDownArrowUp:vn,keyDownEnd:qi,keyDownEnter:Ui,keyDownEscape:Vi,keyDownHome:Bi,keyDownSpaceButton:Xi,mouseUp:$i,touchEnd:Zi,unknown:Li}),ip=["refKey","ref"],sp=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],ap=["onKeyDown","onBlur","onChange","onInput","onChangeText"],cp=["refKey","ref"],up=["onMouseMove","onMouseDown","onClick","onPress","index","item"],lp=function(){var e=function(t){function n(i){var r;r=t.call(this,i)||this,r.id=r.props.id||"downshift-"+Di(),r.menuId=r.props.menuId||r.id+"-menu",r.labelId=r.props.labelId||r.id+"-label",r.inputId=r.props.inputId||r.id+"-input",r.getItemId=r.props.getItemId||function(v){return r.id+"-item-"+v},r.items=[],r.itemCount=null,r.previousResultCount=0,r.timeoutIds=[],r.internalSetTimeout=function(v,C){var b=setTimeout(function(){r.timeoutIds=r.timeoutIds.filter(function(I){return I!==b}),v()},C);r.timeoutIds.push(b)},r.setItemCount=function(v){r.itemCount=v},r.unsetItemCount=function(){r.itemCount=null},r.isItemDisabled=function(v,C){var b=r.getItemNodeFromIndex(C);return b&&b.hasAttribute("disabled")},r.setHighlightedIndex=function(v,C){v===void 0&&(v=r.props.defaultHighlightedIndex),C===void 0&&(C={}),C=hn(C),r.internalSetState(ne({highlightedIndex:v},C))},r.clearSelection=function(v){r.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:r.props.defaultHighlightedIndex,isOpen:r.props.defaultIsOpen},v)},r.selectItem=function(v,C,b){C=hn(C),r.internalSetState(ne({isOpen:r.props.defaultIsOpen,highlightedIndex:r.props.defaultHighlightedIndex,selectedItem:v,inputValue:r.props.itemToString(v)},C),b)},r.selectItemAtIndex=function(v,C,b){var I=r.items[v];I!=null&&r.selectItem(I,C,b)},r.selectHighlightedItem=function(v,C){return r.selectItemAtIndex(r.getState().highlightedIndex,v,C)},r.internalSetState=function(v,C){var b,I,S={},H=typeof v=="function";return!H&&v.hasOwnProperty("inputValue")&&r.props.onInputValueChange(v.inputValue,ne({},r.getStateAndHelpers(),v)),r.setState(function(k){var V;k=r.getState(k);var z=H?v(k):v;z=r.props.stateReducer(k,z),b=z.hasOwnProperty("selectedItem");var X={};return b&&z.selectedItem!==k.selectedItem&&(I=z.selectedItem),(V=z).type||(V.type=Li),Object.keys(z).forEach(function(Z){k[Z]!==z[Z]&&(S[Z]=z[Z]),Z!=="type"&&(z[Z],bn(r.props,Z)||(X[Z]=z[Z]))}),H&&z.hasOwnProperty("inputValue")&&r.props.onInputValueChange(z.inputValue,ne({},r.getStateAndHelpers(),z)),X},function(){ko(C)();var k=Object.keys(S).length>1;k&&r.props.onStateChange(S,r.getStateAndHelpers()),b&&r.props.onSelect(v.selectedItem,r.getStateAndHelpers()),I!==void 0&&r.props.onChange(I,r.getStateAndHelpers()),r.props.onUserAction(S,r.getStateAndHelpers())})},r.rootRef=function(v){return r._rootNode=v},r.getRootProps=function(v,C){var b,I=v===void 0?{}:v,S=I.refKey,H=S===void 0?"ref":S,k=I.ref,V=nt(I,ip),z=C===void 0?{}:C,X=z.suppressRefError,Z=X===void 0?!1:X;r.getRootProps.called=!0,r.getRootProps.refKey=H,r.getRootProps.suppressRefError=Z;var te=r.getState(),Q=te.isOpen;return ne((b={},b[H]=Nt(k,r.rootRef),b.role="combobox",b["aria-expanded"]=Q,b["aria-haspopup"]="listbox",b["aria-owns"]=Q?r.menuId:void 0,b["aria-labelledby"]=r.labelId,b),V)},r.keyDownHandlers={ArrowDown:function(C){var b=this;if(C.preventDefault(),this.getState().isOpen){var I=C.shiftKey?5:1;this.moveHighlightedIndex(I,{type:In})}else this.internalSetState({isOpen:!0,type:In},function(){var S=b.getItemCount();if(S>0){var H=b.getState(),k=H.highlightedIndex,V=wt(k,1,{length:S},b.isItemDisabled,!0);b.setHighlightedIndex(V,{type:In})}})},ArrowUp:function(C){var b=this;if(C.preventDefault(),this.getState().isOpen){var I=C.shiftKey?-5:-1;this.moveHighlightedIndex(I,{type:vn})}else this.internalSetState({isOpen:!0,type:vn},function(){var S=b.getItemCount();if(S>0){var H=b.getState(),k=H.highlightedIndex,V=wt(k,-1,{length:S},b.isItemDisabled,!0);b.setHighlightedIndex(V,{type:vn})}})},Enter:function(C){if(C.which!==229){var b=this.getState(),I=b.isOpen,S=b.highlightedIndex;if(I&&S!=null){C.preventDefault();var H=this.items[S],k=this.getItemNodeFromIndex(S);if(H==null||k&&k.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Ui})}}},Escape:function(C){C.preventDefault(),this.reset(ne({type:Vi},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},r.buttonKeyDownHandlers=ne({},r.keyDownHandlers,{" ":function(C){C.preventDefault(),this.toggleMenu({type:Xi})}}),r.inputKeyDownHandlers=ne({},r.keyDownHandlers,{Home:function(C){var b=this.getState(),I=b.isOpen;if(I){C.preventDefault();var S=this.getItemCount();if(!(S<=0||!I)){var H=Rt(0,!1,{length:S},this.isItemDisabled);this.setHighlightedIndex(H,{type:Bi})}}},End:function(C){var b=this.getState(),I=b.isOpen;if(I){C.preventDefault();var S=this.getItemCount();if(!(S<=0||!I)){var H=Rt(S-1,!0,{length:S},this.isItemDisabled);this.setHighlightedIndex(H,{type:qi})}}}}),r.getToggleButtonProps=function(v){var C=v===void 0?{}:v,b=C.onClick;C.onPress;var I=C.onKeyDown,S=C.onKeyUp,H=C.onBlur,k=nt(C,sp),V=r.getState(),z=V.isOpen,X={onClick:we(b,r.buttonHandleClick),onKeyDown:we(I,r.buttonHandleKeyDown),onKeyUp:we(S,r.buttonHandleKeyUp),onBlur:we(H,r.buttonHandleBlur)},Z=k.disabled?{}:X;return ne({type:"button",role:"button","aria-label":z?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},Z,k)},r.buttonHandleKeyUp=function(v){v.preventDefault()},r.buttonHandleKeyDown=function(v){var C=cr(v);r.buttonKeyDownHandlers[C]&&r.buttonKeyDownHandlers[C].call(r,v)},r.buttonHandleClick=function(v){if(v.preventDefault(),r.props.environment){var C=r.props.environment.document,b=C.body,I=C.activeElement;b&&b===I&&v.target.focus()}process.env.NODE_ENV==="test"?r.toggleMenu({type:ur}):r.internalSetTimeout(function(){return r.toggleMenu({type:ur})})},r.buttonHandleBlur=function(v){var C=v.target;r.internalSetTimeout(function(){if(!(r.isMouseDown||!r.props.environment)){var b=r.props.environment.document.activeElement;(b==null||b.id!==r.inputId)&&b!==C&&r.reset({type:Yi})}})},r.getLabelProps=function(v){return ne({htmlFor:r.inputId,id:r.labelId},v)},r.getInputProps=function(v){var C=v===void 0?{}:v,b=C.onKeyDown,I=C.onBlur,S=C.onChange,H=C.onInput;C.onChangeText;var k=nt(C,ap),V,z={};V="onChange";var X=r.getState(),Z=X.inputValue,te=X.isOpen,Q=X.highlightedIndex;if(!k.disabled){var ue;z=(ue={},ue[V]=we(S,H,r.inputHandleChange),ue.onKeyDown=we(b,r.inputHandleKeyDown),ue.onBlur=we(I,r.inputHandleBlur),ue)}return ne({"aria-autocomplete":"list","aria-activedescendant":te&&typeof Q=="number"&&Q>=0?r.getItemId(Q):void 0,"aria-controls":te?r.menuId:void 0,"aria-labelledby":k&&k["aria-label"]?void 0:r.labelId,autoComplete:"off",value:Z,id:r.inputId},z,k)},r.inputHandleKeyDown=function(v){var C=cr(v);C&&r.inputKeyDownHandlers[C]&&r.inputKeyDownHandlers[C].call(r,v)},r.inputHandleChange=function(v){r.internalSetState({type:zi,isOpen:!0,inputValue:v.target.value,highlightedIndex:r.props.defaultHighlightedIndex})},r.inputHandleBlur=function(){r.internalSetTimeout(function(){var v;if(!(r.isMouseDown||!r.props.environment)){var C=r.props.environment.document.activeElement,b=(C==null||(v=C.dataset)==null?void 0:v.toggle)&&r._rootNode&&r._rootNode.contains(C);b||r.reset({type:Ji})}})},r.menuRef=function(v){r._menuNode=v},r.getMenuProps=function(v,C){var b,I=v===void 0?{}:v,S=I.refKey,H=S===void 0?"ref":S,k=I.ref,V=nt(I,cp),z=C===void 0?{}:C,X=z.suppressRefError,Z=X===void 0?!1:X;return r.getMenuProps.called=!0,r.getMenuProps.refKey=H,r.getMenuProps.suppressRefError=Z,ne((b={},b[H]=Nt(k,r.menuRef),b.role="listbox",b["aria-labelledby"]=V&&V["aria-label"]?void 0:r.labelId,b.id=r.menuId,b),V)},r.getItemProps=function(v){var C,b=v===void 0?{}:v,I=b.onMouseMove,S=b.onMouseDown,H=b.onClick;b.onPress;var k=b.index,V=b.item,z=V===void 0?process.env.NODE_ENV==="production"?void 0:Qd("getItemProps","item"):V,X=nt(b,up);k===void 0?(r.items.push(z),k=r.items.indexOf(z)):r.items[k]=z;var Z="onClick",te=H,Q=(C={onMouseMove:we(I,function(){k!==r.getState().highlightedIndex&&(r.setHighlightedIndex(k,{type:Hi}),r.avoidScrolling=!0,r.internalSetTimeout(function(){return r.avoidScrolling=!1},250))}),onMouseDown:we(S,function(le){le.preventDefault()})},C[Z]=we(te,function(){r.selectItemAtIndex(k,{type:Wi})}),C),ue=X.disabled?{onMouseDown:Q.onMouseDown}:Q;return ne({id:r.getItemId(k),role:"option","aria-selected":r.getState().highlightedIndex===k},ue,X)},r.clearItems=function(){r.items=[]},r.reset=function(v,C){v===void 0&&(v={}),v=hn(v),r.internalSetState(function(b){var I=b.selectedItem;return ne({isOpen:r.props.defaultIsOpen,highlightedIndex:r.props.defaultHighlightedIndex,inputValue:r.props.itemToString(I)},v)},C)},r.toggleMenu=function(v,C){v===void 0&&(v={}),v=hn(v),r.internalSetState(function(b){var I=b.isOpen;return ne({isOpen:!I},I&&{highlightedIndex:r.props.defaultHighlightedIndex},v)},function(){var b=r.getState(),I=b.isOpen,S=b.highlightedIndex;I&&r.getItemCount()>0&&typeof S=="number"&&r.setHighlightedIndex(S,v),ko(C)()})},r.openMenu=function(v){r.internalSetState({isOpen:!0},v)},r.closeMenu=function(v){r.internalSetState({isOpen:!1},v)},r.updateStatus=Or(function(){var v;if((v=r.props)!=null&&(v=v.environment)!=null&&v.document){var C=r.getState(),b=r.items[C.highlightedIndex],I=r.getItemCount(),S=r.props.getA11yStatusMessage(ne({itemToString:r.props.itemToString,previousResultCount:r.previousResultCount,resultCount:I,highlightedItem:b},C));r.previousResultCount=I,Ki(S,r.props.environment.document)}},200);var s=r.props,c=s.defaultHighlightedIndex,u=s.initialHighlightedIndex,d=u===void 0?c:u,p=s.defaultIsOpen,h=s.initialIsOpen,g=h===void 0?p:h,f=s.initialInputValue,m=f===void 0?"":f,x=s.initialSelectedItem,w=x===void 0?null:x,O=r.getState({highlightedIndex:d,isOpen:g,inputValue:m,selectedItem:w});return O.selectedItem!=null&&r.props.initialInputValue===void 0&&(O.inputValue=r.props.itemToString(O.selectedItem)),r.state=O,r}Md(n,t);var o=n.prototype;return o.internalClearTimeouts=function(){this.timeoutIds.forEach(function(r){clearTimeout(r)}),this.timeoutIds=[]},o.getState=function(r){return r===void 0&&(r=this.state),_n(r,this.props)},o.getItemCount=function(){var r=this.items.length;return this.itemCount!=null?r=this.itemCount:this.props.itemCount!==void 0&&(r=this.props.itemCount),r},o.getItemNodeFromIndex=function(r){return this.props.environment?this.props.environment.document.getElementById(this.getItemId(r)):null},o.scrollHighlightedItemIntoView=function(){{var r=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(r,this._menuNode)}},o.moveHighlightedIndex=function(r,s){var c=this.getItemCount(),u=this.getState(),d=u.highlightedIndex;if(c>0){var p=wt(d,r,{length:c},this.isItemDisabled,!0);this.setHighlightedIndex(p,s)}},o.getStateAndHelpers=function(){var r=this.getState(),s=r.highlightedIndex,c=r.inputValue,u=r.selectedItem,d=r.isOpen,p=this.props.itemToString,h=this.id,g=this.getRootProps,f=this.getToggleButtonProps,m=this.getLabelProps,x=this.getMenuProps,w=this.getInputProps,O=this.getItemProps,v=this.openMenu,C=this.closeMenu,b=this.toggleMenu,I=this.selectItem,S=this.selectItemAtIndex,H=this.selectHighlightedItem,k=this.setHighlightedIndex,V=this.clearSelection,z=this.clearItems,X=this.reset,Z=this.setItemCount,te=this.unsetItemCount,Q=this.internalSetState;return{getRootProps:g,getToggleButtonProps:f,getLabelProps:m,getMenuProps:x,getInputProps:w,getItemProps:O,reset:X,openMenu:v,closeMenu:C,toggleMenu:b,selectItem:I,selectItemAtIndex:S,selectHighlightedItem:H,setHighlightedIndex:k,clearSelection:V,clearItems:z,setItemCount:Z,unsetItemCount:te,setState:Q,itemToString:p,id:h,highlightedIndex:s,inputValue:c,isOpen:d,selectedItem:u}},o.componentDidMount=function(){var r=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Ko(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){r.internalClearTimeouts()};else{var s=function(){r.isMouseDown=!0},c=function(f){r.isMouseDown=!1;var m=Cn(f.target,[r._rootNode,r._menuNode],r.props.environment);!m&&r.getState().isOpen&&r.reset({type:$i},function(){return r.props.onOuterClick(r.getStateAndHelpers())})},u=function(){r.isTouchMove=!1},d=function(){r.isTouchMove=!0},p=function(f){var m=Cn(f.target,[r._rootNode,r._menuNode],r.props.environment,!1);!r.isTouchMove&&!m&&r.getState().isOpen&&r.reset({type:Zi},function(){return r.props.onOuterClick(r.getStateAndHelpers())})},h=this.props.environment;h.addEventListener("mousedown",s),h.addEventListener("mouseup",c),h.addEventListener("touchstart",u),h.addEventListener("touchmove",d),h.addEventListener("touchend",p),this.cleanup=function(){r.internalClearTimeouts(),r.updateStatus.cancel(),h.removeEventListener("mousedown",s),h.removeEventListener("mouseup",c),h.removeEventListener("touchstart",u),h.removeEventListener("touchmove",d),h.removeEventListener("touchend",p)}}},o.shouldScroll=function(r,s){var c=this.props.highlightedIndex===void 0?this.getState():this.props,u=c.highlightedIndex,d=s.highlightedIndex===void 0?r:s,p=d.highlightedIndex,h=u&&this.getState().isOpen&&!r.isOpen,g=u!==p;return h||g},o.componentDidUpdate=function(r,s){process.env.NODE_ENV!=="production"&&(Sr(this.state,r,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&Ko(this._menuNode,this.getMenuProps)),bn(this.props,"selectedItem")&&this.props.selectedItemChanged(r.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Gi,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(s,r)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},o.componentWillUnmount=function(){this.cleanup()},o.render=function(){var r=Mo(this.props.children,De);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var s=Mo(r(this.getStateAndHelpers()));if(!s)return null;if(this.getRootProps.called||this.props.suppressRefError)return process.env.NODE_ENV!=="production"&&!this.getRootProps.suppressRefError&&!this.props.suppressRefError&&dp(s,this.getRootProps),s;if(ki(s))return y.cloneElement(s,this.getRootProps(Fi(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(y.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Zd,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&tp(n)&&!n.hasOwnProperty("toString")&&console.warn("downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.","The object that was passed:",n),String(n))},onStateChange:De,onInputValueChange:De,onUserAction:De,onChange:De,onSelect:De,onOuterClick:De,selectedItemChanged:function(n,o){return n!==o},environment:typeof window>"u"?void 0:window,stateReducer:function(n,o){return o},suppressRefError:!1,scrollIntoView:Pi},e.stateChangeTypes=op,e}();process.env.NODE_ENV!=="production"&&(lp.propTypes={children:A.func,defaultHighlightedIndex:A.number,defaultIsOpen:A.bool,initialHighlightedIndex:A.number,initialSelectedItem:A.any,initialInputValue:A.string,initialIsOpen:A.bool,getA11yStatusMessage:A.func,itemToString:A.func,onChange:A.func,onSelect:A.func,onStateChange:A.func,onInputValueChange:A.func,onUserAction:A.func,onOuterClick:A.func,selectedItemChanged:A.func,stateReducer:A.func,itemCount:A.number,id:A.string,environment:A.shape({addEventListener:A.func.isRequired,removeEventListener:A.func.isRequired,document:A.shape({createElement:A.func.isRequired,getElementById:A.func.isRequired,activeElement:A.any.isRequired,body:A.any.isRequired}).isRequired,Node:A.func.isRequired}),suppressRefError:A.bool,scrollIntoView:A.func,selectedItem:A.any,isOpen:A.bool,inputValue:A.string,highlightedIndex:A.number,labelId:A.string,inputId:A.string,menuId:A.string,getItemId:A.func});function Ko(e,t){var n=t.refKey;e||console.error('downshift: The ref prop "'+n+'" from getMenuProps was not applied correctly on your menu element.')}function dp(e,t){var n=t.refKey,o=n!=="ref",i=!ki(e);i&&!o&&!jo.isForwardRef(e)?console.error("downshift: You returned a non-DOM element. You must specify a refKey in getRootProps"):!i&&o&&console.error('downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified "'+n+'"'),!jo.isForwardRef(e)&&!Fi(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var Qi={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function pp(e,t,n){var o=e.props,i=e.type,r={};Object.keys(t).forEach(function(s){fp(s,e,t,n),n[s]!==t[s]&&(r[s]=n[s])}),o.onStateChange&&Object.keys(r).length&&o.onStateChange(ne({type:i},r))}function fp(e,t,n,o){var i=t.props,r=t.type,s="on"+Nr(e)+"Change";i[s]&&o[e]!==void 0&&o[e]!==n[e]&&i[s](ne({type:r},o))}function hp(e,t){return t.changes}var Lo=Or(function(e,t){Ki(e,t)},200),mp=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?y.useLayoutEffect:y.useEffect,gp="useId"in y?function(t){var n=t.id,o=t.labelId,i=t.menuId,r=t.getItemId,s=t.toggleButtonId,c=t.inputId,u="downshift-"+y.useId();n||(n=u);var d=y.useRef({labelId:o||n+"-label",menuId:i||n+"-menu",getItemId:r||function(p){return n+"-item-"+p},toggleButtonId:s||n+"-toggle-button",inputId:c||n+"-input"});return d.current}:function(t){var n=t.id,o=n===void 0?"downshift-"+Di():n,i=t.labelId,r=t.menuId,s=t.getItemId,c=t.toggleButtonId,u=t.inputId,d=y.useRef({labelId:i||o+"-label",menuId:r||o+"-menu",getItemId:s||function(p){return o+"-item-"+p},toggleButtonId:c||o+"-toggle-button",inputId:u||o+"-input"});return d.current};function yp(e,t,n,o){var i,r;if(e===void 0){if(t===void 0)throw new Error(o);i=n[t],r=t}else r=t===void 0?n.indexOf(e):t,i=e;return[i,r]}function Nr(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function es(e){var t=y.useRef(e);return t.current=e,t}function vp(e,t,n,o){var i=y.useRef(),r=y.useRef(),s=y.useCallback(function(f,m){r.current=m,f=_n(f,m.props);var x=e(f,m),w=m.props.stateReducer(f,ne({},m,{changes:x}));return w},[e]),c=y.useReducer(s,t,n),u=c[0],d=c[1],p=es(t),h=y.useCallback(function(f){return d(ne({props:p.current},f))},[p]),g=r.current;return y.useEffect(function(){var f=_n(i.current,g==null?void 0:g.props),m=g&&i.current&&!o(f,u);m&&pp(g,f,u),i.current=u},[u,g,o]),[u,h]}var qt={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:hp,scrollIntoView:Pi,environment:typeof window>"u"?void 0:window};function ut(e,t,n){n===void 0&&(n=Qi);var o=e["default"+Nr(t)];return o!==void 0?o:n[t]}function Wt(e,t,n){n===void 0&&(n=Qi);var o=e[t];if(o!==void 0)return o;var i=e["initial"+Nr(t)];return i!==void 0?i:ut(e,t,n)}function Ip(e){var t=Wt(e,"selectedItem"),n=Wt(e,"isOpen"),o=Cp(e),i=Wt(e,"inputValue");return{highlightedIndex:o<0&&t&&n?e.items.findIndex(function(r){return e.itemToKey(r)===e.itemToKey(t)}):o,isOpen:n,selectedItem:t,inputValue:i}}function Jt(e,t,n){var o=e.items,i=e.initialHighlightedIndex,r=e.defaultHighlightedIndex,s=e.isItemDisabled,c=e.itemToKey,u=t.selectedItem,d=t.highlightedIndex;return o.length===0?-1:i!==void 0&&d===i&&!s(o[i],i)?i:r!==void 0&&!s(o[r],r)?r:u?o.findIndex(function(p){return c(u)===c(p)}):n<0&&!s(o[o.length-1],o.length-1)?o.length-1:n>0&&!s(o[0],0)?0:-1}function wp(e,t,n){var o=y.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return y.useEffect(function(){if(!e)return De;var i=n.map(function(p){return p.current});function r(){o.current.isTouchEnd=!1,o.current.isMouseDown=!0}function s(p){o.current.isMouseDown=!1,Cn(p.target,i,e)||t()}function c(){o.current.isTouchEnd=!1,o.current.isTouchMove=!1}function u(){o.current.isTouchMove=!0}function d(p){o.current.isTouchEnd=!0,!o.current.isTouchMove&&!Cn(p.target,i,e,!1)&&t()}return e.addEventListener("mousedown",r),e.addEventListener("mouseup",s),e.addEventListener("touchstart",c),e.addEventListener("touchmove",u),e.addEventListener("touchend",d),function(){e.removeEventListener("mousedown",r),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",c),e.removeEventListener("touchmove",u),e.removeEventListener("touchend",d)}},[n,e,t]),o.current}var ts=function(){return De};process.env.NODE_ENV!=="production"&&(ts=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];var i=y.useRef(n.reduce(function(s,c){return s[c]={},s},{}));y.useEffect(function(){Object.keys(i.current).forEach(function(s){var c=i.current[s];if(!Object.keys(c).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var u=c.suppressRefError,d=c.refKey,p=c.elementRef;u||p!=null&&p.current||console.error('downshift: The ref prop "'+d+'" from '+s+" was not applied correctly on your element.")})},[]);var r=y.useCallback(function(s,c,u,d){i.current[s]={suppressRefError:c,refKey:u,elementRef:d}},[]);return r});function xp(e,t,n,o){o===void 0&&(o={});var i=o.document,r=Pn();y.useEffect(function(){if(!(!e||r||!i)){var s=e(t);Lo(s,i)}},n),y.useEffect(function(){return function(){Lo.cancel(),rp(i)}},[i])}function _p(e){var t=e.highlightedIndex,n=e.isOpen,o=e.itemRefs,i=e.getItemNodeFromIndex,r=e.menuElement,s=e.scrollIntoView,c=y.useRef(!0);return mp(function(){t<0||!n||!Object.keys(o.current).length||(c.current===!1?c.current=!0:s(i(t),r))},[t]),c}var ns=De;process.env.NODE_ENV!=="production"&&(ns=function(t){var n=t.props,o=t.state,i=y.useRef(n),r=Pn();y.useEffect(function(){r||(Sr(o,i.current,n),i.current=n)},[o,n,r])});function $o(e,t,n){var o;n===void 0&&(n=!0);var i=((o=e.items)==null?void 0:o.length)&&t>=0;return ne({isOpen:!1,highlightedIndex:-1},i&&ne({selectedItem:e.items[t],isOpen:ut(e,"isOpen"),highlightedIndex:ut(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function bp(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Pn(){var e=y.useRef(!0);return y.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function lr(e){var t=ut(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function Cp(e){var t=Wt(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var wn={environment:A.shape({addEventListener:A.func.isRequired,removeEventListener:A.func.isRequired,document:A.shape({createElement:A.func.isRequired,getElementById:A.func.isRequired,activeElement:A.any.isRequired,body:A.any.isRequired}).isRequired,Node:A.func.isRequired}),itemToString:A.func,itemToKey:A.func,stateReducer:A.func},rs=ne({},wn,{getA11yStatusMessage:A.func,highlightedIndex:A.number,defaultHighlightedIndex:A.number,initialHighlightedIndex:A.number,isOpen:A.bool,defaultIsOpen:A.bool,initialIsOpen:A.bool,selectedItem:A.any,initialSelectedItem:A.any,defaultSelectedItem:A.any,id:A.string,labelId:A.string,menuId:A.string,getItemId:A.func,toggleButtonId:A.string,onSelectedItemChange:A.func,onHighlightedIndexChange:A.func,onStateChange:A.func,onIsOpenChange:A.func,scrollIntoView:A.func});function Op(e,t,n){var o=t.type,i=t.props,r;switch(o){case n.ItemMouseMove:r={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:r={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:r={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Jt(i,e,0)};break;case n.FunctionOpenMenu:r={isOpen:!0,highlightedIndex:Jt(i,e,0)};break;case n.FunctionCloseMenu:r={isOpen:!1};break;case n.FunctionSetHighlightedIndex:r={highlightedIndex:i.isItemDisabled(i.items[t.highlightedIndex],t.highlightedIndex)?-1:t.highlightedIndex};break;case n.FunctionSetInputValue:r={inputValue:t.inputValue};break;case n.FunctionReset:r={highlightedIndex:lr(i),isOpen:ut(i,"isOpen"),selectedItem:ut(i,"selectedItem"),inputValue:ut(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return ne({},e,r)}Tt(Tt({},rs),{items:A.array.isRequired,isItemDisabled:A.func});Tt(Tt({},qt),{isItemDisabled:function(){return!1}});process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;var Er=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Tr=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,Rr=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,Ar=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,jr=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,Pr=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,Dr=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,kr=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,Fr=process.env.NODE_ENV!=="production"?"__input_change__":8,On=process.env.NODE_ENV!=="production"?"__input_blur__":9,Mr=process.env.NODE_ENV!=="production"?"__input_click__":10,os=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,is=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,Kr=process.env.NODE_ENV!=="production"?"__item_click__":13,ss=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,as=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,cs=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,us=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,ls=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,Lr=process.env.NODE_ENV!=="production"?"__function_select_item__":19,ds=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,ps=process.env.NODE_ENV!=="production"?"__function_reset__":21,$r=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,fs=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:$r,FunctionCloseMenu:us,FunctionOpenMenu:cs,FunctionReset:ps,FunctionSelectItem:Lr,FunctionSetHighlightedIndex:ls,FunctionSetInputValue:ds,FunctionToggleMenu:as,InputBlur:On,InputChange:Fr,InputClick:Mr,InputKeyDownArrowDown:Er,InputKeyDownArrowUp:Tr,InputKeyDownEnd:jr,InputKeyDownEnter:kr,InputKeyDownEscape:Rr,InputKeyDownHome:Ar,InputKeyDownPageDown:Dr,InputKeyDownPageUp:Pr,ItemClick:Kr,ItemMouseMove:is,MenuMouseLeave:os,ToggleButtonClick:ss});function Sp(e){var t=Ip(e),n=t.selectedItem,o=t.inputValue;return o===""&&n&&e.defaultInputValue===void 0&&e.initialInputValue===void 0&&e.inputValue===void 0&&(o=e.itemToString(n)),ne({},t,{inputValue:o})}var Np=ne({},rs,{items:A.array.isRequired,isItemDisabled:A.func,inputValue:A.string,defaultInputValue:A.string,initialInputValue:A.string,inputId:A.string,onInputValueChange:A.func});function Ep(e,t,n,o){var i=y.useRef(),r=vp(e,t,n,o),s=r[0],c=r[1],u=Pn();return y.useEffect(function(){if(bn(t,"selectedItem")){if(!u){var d=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);d&&c({type:$r,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[_n(s,t),c]}var hs=De;process.env.NODE_ENV!=="production"&&(hs=function(t,n){A.checkPropTypes(Np,t,"prop",n.name)});var Tp=ne({},qt,{isItemDisabled:function(){return!1}});function Rp(e,t){var n,o=t.type,i=t.props,r=t.altKey,s;switch(o){case Kr:s={isOpen:ut(i,"isOpen"),highlightedIndex:lr(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case Er:e.isOpen?s={highlightedIndex:wt(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:r&&e.selectedItem==null?-1:Jt(i,e,1),isOpen:i.items.length>=0};break;case Tr:e.isOpen?r?s=$o(i,e.highlightedIndex):s={highlightedIndex:wt(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:Jt(i,e,-1),isOpen:i.items.length>=0};break;case kr:s=$o(i,e.highlightedIndex);break;case Rr:s=ne({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case Pr:s={highlightedIndex:wt(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case Dr:s={highlightedIndex:wt(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case Ar:s={highlightedIndex:Rt(0,!1,i.items,i.isItemDisabled)};break;case jr:s={highlightedIndex:Rt(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case On:s=ne({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=i.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])});break;case Fr:s={isOpen:!0,highlightedIndex:lr(i),inputValue:t.inputValue};break;case Mr:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Jt(i,e,0)};break;case Lr:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case $r:s={inputValue:t.inputValue};break;default:return Op(e,t,fs)}return ne({},e,s)}var Ap=["onMouseLeave","refKey","ref"],jp=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],Pp=["onClick","onPress","refKey","ref"],Dp=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];Hr.stateChangeTypes=fs;function Hr(e){e===void 0&&(e={}),hs(e,Hr);var t=ne({},Tp,e),n=t.items,o=t.scrollIntoView,i=t.environment,r=t.getA11yStatusMessage,s=Ep(Rp,t,Sp,bp),c=s[0],u=s[1],d=c.isOpen,p=c.highlightedIndex,h=c.selectedItem,g=c.inputValue,f=y.useRef(null),m=y.useRef({}),x=y.useRef(null),w=y.useRef(null),O=Pn(),v=gp(t),C=y.useRef(),b=es({state:c,props:t}),I=y.useCallback(function(F){return m.current[v.getItemId(F)]},[v]);xp(r,c,[d,p,h,g],i);var S=_p({menuElement:f.current,highlightedIndex:p,isOpen:d,itemRefs:m,scrollIntoView:o,getItemNodeFromIndex:I});ns({props:t,state:c}),y.useEffect(function(){var F=Wt(t,"isOpen");F&&x.current&&x.current.focus()},[]),y.useEffect(function(){O||(C.current=n.length)});var H=wp(i,y.useCallback(function(){b.current.state.isOpen&&u({type:On,selectItem:!1})},[u,b]),y.useMemo(function(){return[f,w,x]},[f.current,w.current,x.current])),k=ts("getInputProps","getMenuProps");y.useEffect(function(){d||(m.current={})},[d]),y.useEffect(function(){var F;!d||!(i!=null&&i.document)||!(x!=null&&(F=x.current)!=null&&F.focus)||i.document.activeElement!==x.current&&x.current.focus()},[d,i]);var V=y.useMemo(function(){return{ArrowDown:function(D){D.preventDefault(),u({type:Er,altKey:D.altKey})},ArrowUp:function(D){D.preventDefault(),u({type:Tr,altKey:D.altKey})},Home:function(D){b.current.state.isOpen&&(D.preventDefault(),u({type:Ar}))},End:function(D){b.current.state.isOpen&&(D.preventDefault(),u({type:jr}))},Escape:function(D){var P=b.current.state;(P.isOpen||P.inputValue||P.selectedItem||P.highlightedIndex>-1)&&(D.preventDefault(),u({type:Rr}))},Enter:function(D){var P=b.current.state;!P.isOpen||D.which===229||(D.preventDefault(),u({type:kr}))},PageUp:function(D){b.current.state.isOpen&&(D.preventDefault(),u({type:Pr}))},PageDown:function(D){b.current.state.isOpen&&(D.preventDefault(),u({type:Dr}))}}},[u,b]),z=y.useCallback(function(F){return ne({id:v.labelId,htmlFor:v.inputId},F)},[v]),X=y.useCallback(function(F,D){var P,R=F===void 0?{}:F,B=R.onMouseLeave,W=R.refKey,U=W===void 0?"ref":W,J=R.ref,q=nt(R,Ap),oe=D===void 0?{}:D,j=oe.suppressRefError,de=j===void 0?!1:j;return k("getMenuProps",de,U,f),ne((P={},P[U]=Nt(J,function(L){f.current=L}),P.id=v.menuId,P.role="listbox",P["aria-labelledby"]=q&&q["aria-label"]?void 0:""+v.labelId,P.onMouseLeave=we(B,function(){u({type:os})}),P),q)},[u,k,v]),Z=y.useCallback(function(F){var D,P,R=F===void 0?{}:F,B=R.item,W=R.index,U=R.refKey,J=U===void 0?"ref":U,q=R.ref,oe=R.onMouseMove,j=R.onMouseDown,de=R.onClick;R.onPress;var L=R.disabled,Ee=nt(R,jp);L!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var Te=b.current,Ge=Te.props,Ve=Te.state,Ct=yp(B,W,Ge.items,"Pass either item or index to getItemProps!"),Mt=Ct[0],Ue=Ct[1],ft=Ge.isItemDisabled(Mt,Ue),Kt="onClick",Ot=de,Je=function(){H.isTouchEnd||Ue===Ve.highlightedIndex||(S.current=!1,u({type:is,index:Ue,disabled:ft}))},Ze=function(){u({type:Kr,index:Ue})},je=function(en){return en.preventDefault()};return ne((D={},D[J]=Nt(q,function(Re){Re&&(m.current[v.getItemId(Ue)]=Re)}),D["aria-disabled"]=ft,D["aria-selected"]=Ue===Ve.highlightedIndex,D.id=v.getItemId(Ue),D.role="option",D),!ft&&(P={},P[Kt]=we(Ot,Ze),P),{onMouseMove:we(oe,Je),onMouseDown:we(j,je)},Ee)},[u,v,b,H,S]),te=y.useCallback(function(F){var D,P=F===void 0?{}:F,R=P.onClick;P.onPress;var B=P.refKey,W=B===void 0?"ref":B,U=P.ref,J=nt(P,Pp),q=b.current.state,oe=function(){u({type:ss})};return ne((D={},D[W]=Nt(U,function(j){w.current=j}),D["aria-controls"]=v.menuId,D["aria-expanded"]=q.isOpen,D.id=v.toggleButtonId,D.tabIndex=-1,D),!J.disabled&&ne({},{onClick:we(R,oe)}),J)},[u,b,v]),Q=y.useCallback(function(F,D){var P,R=F===void 0?{}:F,B=R.onKeyDown,W=R.onChange,U=R.onInput,J=R.onBlur;R.onChangeText;var q=R.onClick,oe=R.refKey,j=oe===void 0?"ref":oe,de=R.ref,L=nt(R,Dp),Ee=D===void 0?{}:D,Te=Ee.suppressRefError,Ge=Te===void 0?!1:Te;k("getInputProps",Ge,j,x);var Ve=b.current.state,Ct=function(je){var Re=cr(je);Re&&V[Re]&&V[Re](je)},Mt=function(je){u({type:Fr,inputValue:je.target.value})},Ue=function(je){if(i!=null&&i.document&&Ve.isOpen&&!H.isMouseDown){var Re=je.relatedTarget===null&&i.document.activeElement!==i.document.body;u({type:On,selectItem:!Re})}},ft=function(){u({type:Mr})},Kt="onChange",Ot={};if(!L.disabled){var Je;Ot=(Je={},Je[Kt]=we(W,U,Mt),Je.onKeyDown=we(B,Ct),Je.onBlur=we(J,Ue),Je.onClick=we(q,ft),Je)}return ne((P={},P[j]=Nt(de,function(Ze){x.current=Ze}),P["aria-activedescendant"]=Ve.isOpen&&Ve.highlightedIndex>-1?v.getItemId(Ve.highlightedIndex):"",P["aria-autocomplete"]="list",P["aria-controls"]=v.menuId,P["aria-expanded"]=Ve.isOpen,P["aria-labelledby"]=L&&L["aria-label"]?void 0:v.labelId,P.autoComplete="off",P.id=v.inputId,P.role="combobox",P.value=Ve.inputValue,P),Ot,L)},[u,v,i,V,b,H,k]),ue=y.useCallback(function(){u({type:as})},[u]),le=y.useCallback(function(){u({type:us})},[u]),re=y.useCallback(function(){u({type:cs})},[u]),Oe=y.useCallback(function(F){u({type:ls,highlightedIndex:F})},[u]),Ne=y.useCallback(function(F){u({type:Lr,selectedItem:F})},[u]),T=y.useCallback(function(F){u({type:ds,inputValue:F})},[u]),K=y.useCallback(function(){u({type:ps})},[u]);return{getItemProps:Z,getLabelProps:z,getMenuProps:X,getInputProps:Q,getToggleButtonProps:te,toggleMenu:ue,openMenu:re,closeMenu:le,setHighlightedIndex:Oe,setInputValue:T,selectItem:Ne,reset:K,highlightedIndex:p,isOpen:d,selectedItem:h,inputValue:g}}wn.stateReducer,wn.itemToKey,wn.environment,A.array,A.array,A.array,A.func,A.number,A.number,A.number,A.func,A.func,A.string,A.string;qt.itemToKey,qt.stateReducer,qt.environment;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;const kp="_comboboxContainer_12y8e_1",Fp="_label_12y8e_8",Mp="_inputContainer_12y8e_12",Kp="_input_12y8e_12",Lp="_toggleButton_12y8e_25",$p="_menu_12y8e_30",Hp="_menuItem_12y8e_43",Vp="_highlighted_12y8e_50",Up="_selected_12y8e_54",Bp="_hidden_12y8e_58",tt={comboboxContainer:kp,label:Fp,inputContainer:Mp,input:Kp,toggleButton:Lp,menu:$p,menuItem:Hp,highlighted:Vp,selected:Up,hidden:Bp};function qp(e){const t=e.toLowerCase();return function(o){return!e||o.label.toLowerCase().includes(t)||o.value.toLowerCase().includes(t)}}function Wp({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:o}){const[i,r]=y.useState(e);y.useEffect(()=>r(e),[e]);const s=f=>{r(e.filter(qp(f)))},{isOpen:c,getToggleButtonProps:u,getMenuProps:d,getInputProps:p,highlightedIndex:h,getItemProps:g}=Hr({items:i,selectedItem:t?e.find(f=>f.value===t):null,itemToString:f=>(f==null?void 0:f.label)||"",onInputValueChange:({inputValue:f})=>s(f),onSelectedItemChange:({selectedItem:f})=>n(f)});return a.jsxs("div",{children:[a.jsx("div",{className:tt.comboboxContainer,children:a.jsxs("div",{className:tt.inputContainer,children:[a.jsx("input",{placeholder:o,className:tt.input,...p()}),a.jsx("button",{"aria-label":"toggle menu",className:tt.toggleButton,type:"button",...u(),children:c?a.jsx(a.Fragment,{children:"↑"}):a.jsx(a.Fragment,{children:"↓"})})]})}),a.jsx("ul",{className:`${tt.menu} ${c&&e.length?"":tt.hidden}`,...d(),children:c&&i.map((f,m)=>a.jsx("li",{className:`${tt.menuItem} ${h===m?tt.highlighted:""} ${t===(f==null?void 0:f.value)?tt.selected:""}`,...g({item:f,index:m}),children:a.jsx("span",{children:f.label})},f.id))})]})}const ms=y.createContext(null);function gs(){const e=y.useContext(ms);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const ys=y.createContext(()=>{});function Jp(){const e=y.useContext(ys);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var vs=Symbol.for("immer-nothing"),Ho=Symbol.for("immer-draftable"),ke=Symbol.for("immer-state"),zp=process.env.NODE_ENV!=="production"?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function Ae(e,...t){if(process.env.NODE_ENV!=="production"){const n=zp[e],o=typeof n=="function"?n.apply(null,t):n;throw new Error(`[Immer] ${o}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var At=Object.getPrototypeOf;function jt(e){return!!e&&!!e[ke]}function _t(e){var t;return e?Is(e)||Array.isArray(e)||!!e[Ho]||!!((t=e.constructor)!=null&&t[Ho])||kn(e)||Fn(e):!1}var Xp=Object.prototype.constructor.toString();function Is(e){if(!e||typeof e!="object")return!1;const t=At(e);if(t===null)return!0;const n=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Xp}function Sn(e,t){Dn(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,o)=>t(o,n,e))}function Dn(e){const t=e[ke];return t?t.type_:Array.isArray(e)?1:kn(e)?2:Fn(e)?3:0}function dr(e,t){return Dn(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function ws(e,t,n){const o=Dn(e);o===2?e.set(t,n):o===3?e.add(n):e[t]=n}function Yp(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function kn(e){return e instanceof Map}function Fn(e){return e instanceof Set}function It(e){return e.copy_||e.base_}function pr(e,t){if(kn(e))return new Map(e);if(Fn(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=Is(e);if(t===!0||t==="class_only"&&!n){const o=Object.getOwnPropertyDescriptors(e);delete o[ke];let i=Reflect.ownKeys(o);for(let r=0;r<i.length;r++){const s=i[r],c=o[s];c.writable===!1&&(c.writable=!0,c.configurable=!0),(c.get||c.set)&&(o[s]={configurable:!0,writable:!0,enumerable:c.enumerable,value:e[s]})}return Object.create(At(e),o)}else{const o=At(e);if(o!==null&&n)return{...e};const i=Object.create(o);return Object.assign(i,e)}}function Vr(e,t=!1){return Mn(e)||jt(e)||!_t(e)||(Dn(e)>1&&(e.set=e.add=e.clear=e.delete=Gp),Object.freeze(e),t&&Object.entries(e).forEach(([n,o])=>Vr(o,!0))),e}function Gp(){Ae(2)}function Mn(e){return Object.isFrozen(e)}var Zp={};function bt(e){const t=Zp[e];return t||Ae(0,e),t}var Xt;function xs(){return Xt}function Qp(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Vo(e,t){t&&(bt("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function fr(e){hr(e),e.drafts_.forEach(ef),e.drafts_=null}function hr(e){e===Xt&&(Xt=e.parent_)}function Uo(e){return Xt=Qp(Xt,e)}function ef(e){const t=e[ke];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Bo(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[ke].modified_&&(fr(t),Ae(4)),_t(e)&&(e=Nn(t,e),t.parent_||En(t,e)),t.patches_&&bt("Patches").generateReplacementPatches_(n[ke].base_,e,t.patches_,t.inversePatches_)):e=Nn(t,n,[]),fr(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==vs?e:void 0}function Nn(e,t,n){if(Mn(t))return t;const o=t[ke];if(!o)return Sn(t,(i,r)=>qo(e,o,t,i,r,n)),t;if(o.scope_!==e)return t;if(!o.modified_)return En(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const i=o.copy_;let r=i,s=!1;o.type_===3&&(r=new Set(i),i.clear(),s=!0),Sn(r,(c,u)=>qo(e,o,i,c,u,n,s)),En(e,i,!1),n&&e.patches_&&bt("Patches").generatePatches_(o,n,e.patches_,e.inversePatches_)}return o.copy_}function qo(e,t,n,o,i,r,s){if(process.env.NODE_ENV!=="production"&&i===n&&Ae(5),jt(i)){const c=r&&t&&t.type_!==3&&!dr(t.assigned_,o)?r.concat(o):void 0,u=Nn(e,i,c);if(ws(n,o,u),jt(u))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(_t(i)&&!Mn(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Nn(e,i),(!t||!t.scope_.parent_)&&typeof o!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,o)&&En(e,i)}}function En(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Vr(t,n)}function tf(e,t){const n=Array.isArray(e),o={type_:n?1:0,scope_:t?t.scope_:xs(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=o,r=Ur;n&&(i=[o],r=Yt);const{revoke:s,proxy:c}=Proxy.revocable(i,r);return o.draft_=c,o.revoke_=s,c}var Ur={get(e,t){if(t===ke)return e;const n=It(e);if(!dr(n,t))return nf(e,n,t);const o=n[t];return e.finalized_||!_t(o)?o:o===tr(e.base_,t)?(nr(e),e.copy_[t]=gr(o,e)):o},has(e,t){return t in It(e)},ownKeys(e){return Reflect.ownKeys(It(e))},set(e,t,n){const o=_s(It(e),t);if(o!=null&&o.set)return o.set.call(e.draft_,n),!0;if(!e.modified_){const i=tr(It(e),t),r=i==null?void 0:i[ke];if(r&&r.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Yp(n,i)&&(n!==void 0||dr(e.base_,t)))return!0;nr(e),mr(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return tr(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,nr(e),mr(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=It(e),o=Reflect.getOwnPropertyDescriptor(n,t);return o&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:o.enumerable,value:n[t]}},defineProperty(){Ae(11)},getPrototypeOf(e){return At(e.base_)},setPrototypeOf(){Ae(12)}},Yt={};Sn(Ur,(e,t)=>{Yt[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Yt.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&Ae(13),Yt.set.call(this,e,t,void 0)};Yt.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&Ae(14),Ur.set.call(this,e[0],t,n,e[0])};function tr(e,t){const n=e[ke];return(n?It(n):e)[t]}function nf(e,t,n){var i;const o=_s(t,n);return o?"value"in o?o.value:(i=o.get)==null?void 0:i.call(e.draft_):void 0}function _s(e,t){if(!(t in e))return;let n=At(e);for(;n;){const o=Object.getOwnPropertyDescriptor(n,t);if(o)return o;n=At(n)}}function mr(e){e.modified_||(e.modified_=!0,e.parent_&&mr(e.parent_))}function nr(e){e.copy_||(e.copy_=pr(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var rf=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,n,o)=>{if(typeof t=="function"&&typeof n!="function"){const r=n;n=t;const s=this;return function(u=r,...d){return s.produce(u,p=>n.call(this,p,...d))}}typeof n!="function"&&Ae(6),o!==void 0&&typeof o!="function"&&Ae(7);let i;if(_t(t)){const r=Uo(this),s=gr(t,void 0);let c=!0;try{i=n(s),c=!1}finally{c?fr(r):hr(r)}return Vo(r,o),Bo(i,r)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===vs&&(i=void 0),this.autoFreeze_&&Vr(i,!0),o){const r=[],s=[];bt("Patches").generateReplacementPatches_(t,i,r,s),o(r,s)}return i}else Ae(1,t)},this.produceWithPatches=(t,n)=>{if(typeof t=="function")return(s,...c)=>this.produceWithPatches(s,u=>t(u,...c));let o,i;return[this.produce(t,n,(s,c)=>{o=s,i=c}),o,i]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){_t(e)||Ae(8),jt(e)&&(e=of(e));const t=Uo(this),n=gr(e,void 0);return n[ke].isManual_=!0,hr(t),n}finishDraft(e,t){const n=e&&e[ke];(!n||!n.isManual_)&&Ae(9);const{scope_:o}=n;return Vo(o,t),Bo(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){const i=t[n];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}n>-1&&(t=t.slice(n+1));const o=bt("Patches").applyPatches_;return jt(e)?o(e,t):this.produce(e,i=>o(i,t))}};function gr(e,t){const n=kn(e)?bt("MapSet").proxyMap_(e,t):Fn(e)?bt("MapSet").proxySet_(e,t):tf(e,t);return(t?t.scope_:xs()).drafts_.push(n),n}function of(e){return jt(e)||Ae(10,e),bs(e)}function bs(e){if(!_t(e)||Mn(e))return e;const t=e[ke];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=pr(e,t.scope_.immer_.useStrictShallowCopy_)}else n=pr(e,!0);return Sn(n,(o,i)=>{ws(n,o,bs(i))}),t&&(t.finalized_=!1),n}var Fe=new rf,Bt=Fe.produce;Fe.produceWithPatches.bind(Fe);Fe.setAutoFreeze.bind(Fe);Fe.setUseStrictShallowCopy.bind(Fe);Fe.applyPatches.bind(Fe);Fe.createDraft.bind(Fe);Fe.finishDraft.bind(Fe);const Cs=y.createContext(void 0),sf={};function Br(){const e=y.useContext(Cs);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function af({children:e}){const{installation:t}=We(),{hydratedRevision:n,loading:o}=Zt(),[i,r]=y.useState(sf),s=t==null?void 0:t.config;y.useEffect(()=>{n!=null&&n.content&&!o&&s&&!(Object.entries(i).length>0)&&vd(n,s,r)},[n,o,s,i]);const c=y.useCallback((f,m)=>{r(x=>Bt(x,w=>{w[f]=Bt(w[f],m)}))},[r]),u=y.useCallback((f,m)=>{r(x=>Bt(x,w=>{w[f]=m}))},[r]),d=y.useCallback(()=>{r(Bt(f=>{const m=f.other.write;m&&(m.isWriteModified=!1)}))},[r]),p=y.useCallback(f=>{r(Bt(m=>{var w;const x=(w=m[f])==null?void 0:w.read;x&&(x.isOptionalFieldsModified=!1,x.isRequiredMapFieldsModified=!1)}))},[r]),h=y.useCallback(f=>{f===xt?d():p(f)},[p,d]),g=y.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:r,setConfigureState:c,resetConfigureState:u,resetPendingConfigurationState:h}),[i,u,h,c]);return a.jsx(Cs.Provider,{value:g,children:e})}const pt=()=>{const{appName:e}=Ie(),{objectConfigurationsState:t,setConfigureState:n}=Br(),{selectedObjectName:o}=gs(),i=Oi(o||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:o}};function cf(e,t,n){var i;const o=((i=e==null?void 0:e.read)==null?void 0:i.selectedFieldMappings)||{};if(o[t]=n,e!=null&&e.read){const r=e.read.savedConfig.requiredMapFields,c=!_r(r,o);e.read.isRequiredMapFieldsModified=c}}function Os(e,t,n,o){t(e,i=>cf(i,n,o))}function Ss({field:e,onSelectChange:t,allFields:n}){var f;const{configureState:o,selectedObjectName:i,setConfigureState:r}=pt(),[s,c]=y.useState(!0),u=(f=o==null?void 0:o.read)==null?void 0:f.selectedFieldMappings,d=u==null?void 0:u[e.mapToName];y.useEffect(()=>{e._default&&!d&&i&&o&&Os(i,r,e.mapToName,e._default),c(!1)},[e,r,i,d,o]);const p=y.useMemo(()=>n==null?void 0:n.map(m=>a.jsx("option",{value:m.fieldName,children:m.displayName},m.fieldName)),[n]),h=y.useMemo(()=>n.map(m=>({id:m.fieldName,label:m.displayName,value:m.fieldName})),[n]),g=ve?a.jsx(Wp,{items:h,selectedValue:d||null,onSelectedItemChange:m=>{t({target:{name:e.mapToName,value:m==null?void 0:m.value}})},placeholder:d||"Please select one"}):a.jsx(N.Select,{name:e.mapToName,variant:"flushed",value:d||void 0,onChange:t,placeholder:d?void 0:"Please select one",disabled:s,children:p});return a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[a.jsx("h3",{style:{fontWeight:500},children:e.mapToDisplayName}),a.jsx("p",{style:{paddingBottom:"1rem"},children:e==null?void 0:e.prompt}),g]},e.mapToName)}const uf="_divider_j6suu_1",Wo={divider:uf};function qr({className:e,style:t}){return ve?a.jsx("hr",{className:e?`${Wo.divider} ${e}`:Wo.divider,style:t}):a.jsx(N.Divider,{className:e,style:t})}const lf=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-text-secondary").trim()||"#737373";function Ft({string:e}){return a.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"2rem",paddingBottom:"1rem"},children:[a.jsx("h3",{style:{color:lf,fontSize:"1rem",fontWeight:"500"},children:e}),a.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:a.jsx(qr,{style:{marginLeft:"1rem"}})})]})}function df(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=pt(),{fieldMapping:o}=We(),{isError:i,removeError:r}=dt(),s=u=>{const{value:d,name:p}=u.target;d&&(e&&Os(e,n,p,d),i(me.MAPPING,p)&&r(me.MAPPING,p))},c=y.useMemo(()=>{var p;if(!e||!o)return[];const u=o?Object.values(o[e]||{}).flat():[];return(((p=t==null?void 0:t.read)==null?void 0:p.requiredMapFields)||[]).concat(u).reduce((h,g)=>h.find(m=>m.mapToName===g.mapToName)?h.map(m=>m.mapToName===g.mapToName?g:m):h.concat(g),new Array).filter(Ye)},[t,o,e]);return c.length?a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:"Map the following fields (required)"}),a.jsx("div",{style:{display:"flex",gap:"2rem",flexDirection:"column"},children:c.map(u=>{var d;return a.jsxs(N.FormControl,{isInvalid:i(me.MAPPING,u.mapToName),children:[a.jsx(Ss,{allFields:((d=t==null?void 0:t.read)==null?void 0:d.allFields)||[],field:u,onSelectChange:s}),a.jsx(N.FormErrorMessage,{children:" * required"})]},u.mapToName)})})]}):null}function pf(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function Ns(...e){return t=>e.forEach(n=>pf(n,t))}function Es(...e){return Y.useCallback(Ns(...e),e)}function ff(e,t=[]){let n=[];function o(r,s){const c=Y.createContext(s),u=n.length;n=[...n,s];const d=h=>{var O;const{scope:g,children:f,...m}=h,x=((O=g==null?void 0:g[e])==null?void 0:O[u])||c,w=Y.useMemo(()=>m,Object.values(m));return a.jsx(x.Provider,{value:w,children:f})};d.displayName=r+"Provider";function p(h,g){var x;const f=((x=g==null?void 0:g[e])==null?void 0:x[u])||c,m=Y.useContext(f);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${h}\` must be used within \`${r}\``)}return[d,p]}const i=()=>{const r=n.map(s=>Y.createContext(s));return function(c){const u=(c==null?void 0:c[e])||r;return Y.useMemo(()=>({[`__scope${e}`]:{...c,[e]:u}}),[c,u])}};return i.scopeName=e,[o,hf(i,...t)]}function hf(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(i=>({useScope:i(),scopeName:i.scopeName}));return function(r){const s=o.reduce((c,{useScope:u,scopeName:d})=>{const h=u(r)[`__scope${d}`];return{...c,...h}},{});return Y.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Jo(e,t,{checkForDefaultPrevented:n=!0}={}){return function(i){if(e==null||e(i),n===!1||!i.defaultPrevented)return t==null?void 0:t(i)}}function Ts(e){const t=Y.useRef(e);return Y.useEffect(()=>{t.current=e}),Y.useMemo(()=>(...n)=>{var o;return(o=t.current)==null?void 0:o.call(t,...n)},[])}function mf({prop:e,defaultProp:t,onChange:n=()=>{}}){const[o,i]=gf({defaultProp:t,onChange:n}),r=e!==void 0,s=r?e:o,c=Ts(n),u=Y.useCallback(d=>{if(r){const h=typeof d=="function"?d(e):d;h!==e&&c(h)}else i(d)},[r,e,i,c]);return[s,u]}function gf({defaultProp:e,onChange:t}){const n=Y.useState(e),[o]=n,i=Y.useRef(o),r=Ts(t);return Y.useEffect(()=>{i.current!==o&&(r(o),i.current=o)},[o,i,r]),n}function yf(e){const t=Y.useRef({value:e,previous:e});return Y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var yr=globalThis!=null&&globalThis.document?Y.useLayoutEffect:()=>{};function vf(e){const[t,n]=Y.useState(void 0);return yr(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const r=i[0];let s,c;if("borderBoxSize"in r){const u=r.borderBoxSize,d=Array.isArray(u)?u[0]:u;s=d.inlineSize,c=d.blockSize}else s=e.offsetWidth,c=e.offsetHeight;n({width:s,height:c})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}function If(e,t){return Y.useReducer((n,o)=>t[n][o]??n,e)}var Rs=e=>{const{present:t,children:n}=e,o=wf(t),i=typeof n=="function"?n({present:o.isPresent}):Y.Children.only(n),r=Es(o.ref,xf(i));return typeof n=="function"||o.isPresent?Y.cloneElement(i,{ref:r}):null};Rs.displayName="Presence";function wf(e){const[t,n]=Y.useState(),o=Y.useRef({}),i=Y.useRef(e),r=Y.useRef("none"),s=e?"mounted":"unmounted",[c,u]=If(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Y.useEffect(()=>{const d=mn(o.current);r.current=c==="mounted"?d:"none"},[c]),yr(()=>{const d=o.current,p=i.current;if(p!==e){const g=r.current,f=mn(d);e?u("MOUNT"):f==="none"||(d==null?void 0:d.display)==="none"?u("UNMOUNT"):u(p&&g!==f?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,u]),yr(()=>{if(t){let d;const p=t.ownerDocument.defaultView??window,h=f=>{const x=mn(o.current).includes(f.animationName);if(f.target===t&&x&&(u("ANIMATION_END"),!i.current)){const w=t.style.animationFillMode;t.style.animationFillMode="forwards",d=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=w)})}},g=f=>{f.target===t&&(r.current=mn(o.current))};return t.addEventListener("animationstart",g),t.addEventListener("animationcancel",h),t.addEventListener("animationend",h),()=>{p.clearTimeout(d),t.removeEventListener("animationstart",g),t.removeEventListener("animationcancel",h),t.removeEventListener("animationend",h)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:Y.useCallback(d=>{d&&(o.current=getComputedStyle(d)),n(d)},[])}}function mn(e){return(e==null?void 0:e.animationName)||"none"}function xf(e){var o,i;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var As=Y.forwardRef((e,t)=>{const{children:n,...o}=e,i=Y.Children.toArray(n),r=i.find(bf);if(r){const s=r.props.children,c=i.map(u=>u===r?Y.Children.count(s)>1?Y.Children.only(null):Y.isValidElement(s)?s.props.children:null:u);return a.jsx(vr,{...o,ref:t,children:Y.isValidElement(s)?Y.cloneElement(s,void 0,c):null})}return a.jsx(vr,{...o,ref:t,children:n})});As.displayName="Slot";var vr=Y.forwardRef((e,t)=>{const{children:n,...o}=e;if(Y.isValidElement(n)){const i=Of(n);return Y.cloneElement(n,{...Cf(o,n.props),ref:t?Ns(t,i):i})}return Y.Children.count(n)>1?Y.Children.only(null):null});vr.displayName="SlotClone";var _f=({children:e})=>a.jsx(a.Fragment,{children:e});function bf(e){return Y.isValidElement(e)&&e.type===_f}function Cf(e,t){const n={...t};for(const o in t){const i=e[o],r=t[o];/^on[A-Z]/.test(o)?i&&r?n[o]=(...c)=>{r(...c),i(...c)}:i&&(n[o]=i):o==="style"?n[o]={...i,...r}:o==="className"&&(n[o]=[i,r].filter(Boolean).join(" "))}return{...e,...n}}function Of(e){var o,i;let t=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Sf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],js=Sf.reduce((e,t)=>{const n=Y.forwardRef((o,i)=>{const{asChild:r,...s}=o,c=r?As:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Wr="Checkbox",[Nf,Nm]=ff(Wr),[Ef,Tf]=Nf(Wr),Ps=Y.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:o,checked:i,defaultChecked:r,required:s,disabled:c,value:u="on",onCheckedChange:d,form:p,...h}=e,[g,f]=Y.useState(null),m=Es(t,b=>f(b)),x=Y.useRef(!1),w=g?p||!!g.closest("form"):!0,[O=!1,v]=mf({prop:i,defaultProp:r,onChange:d}),C=Y.useRef(O);return Y.useEffect(()=>{const b=g==null?void 0:g.form;if(b){const I=()=>v(C.current);return b.addEventListener("reset",I),()=>b.removeEventListener("reset",I)}},[g,v]),a.jsxs(Ef,{scope:n,state:O,disabled:c,children:[a.jsx(js.button,{type:"button",role:"checkbox","aria-checked":lt(O)?"mixed":O,"aria-required":s,"data-state":Fs(O),"data-disabled":c?"":void 0,disabled:c,value:u,...h,ref:m,onKeyDown:Jo(e.onKeyDown,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:Jo(e.onClick,b=>{v(I=>lt(I)?!0:!I),w&&(x.current=b.isPropagationStopped(),x.current||b.stopPropagation())})}),w&&a.jsx(Rf,{control:g,bubbles:!x.current,name:o,value:u,checked:O,required:s,disabled:c,form:p,style:{transform:"translateX(-100%)"},defaultChecked:lt(r)?!1:r})]})});Ps.displayName=Wr;var Ds="CheckboxIndicator",ks=Y.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:o,...i}=e,r=Tf(Ds,n);return a.jsx(Rs,{present:o||lt(r.state)||r.state===!0,children:a.jsx(js.span,{"data-state":Fs(r.state),"data-disabled":r.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});ks.displayName=Ds;var Rf=e=>{const{control:t,checked:n,bubbles:o=!0,defaultChecked:i,...r}=e,s=Y.useRef(null),c=yf(n),u=vf(t);Y.useEffect(()=>{const p=s.current,h=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==n&&f){const m=new Event("click",{bubbles:o});p.indeterminate=lt(n),f.call(p,lt(n)?!1:n),p.dispatchEvent(m)}},[c,n,o]);const d=Y.useRef(lt(n)?!1:n);return a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??d.current,...r,tabIndex:-1,ref:s,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function lt(e){return e==="indeterminate"}function Fs(e){return lt(e)?"indeterminate":e?"checked":"unchecked"}var Ms=Ps,Ks=ks;function Ls(e,t){if(e==null)return{};var n={},o=Object.keys(e),i,r;for(r=0;r<o.length;r++)i=o[r],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var Af=["color"],$s=y.forwardRef(function(e,t){var n=e.color,o=n===void 0?"currentColor":n,i=Ls(e,Af);return y.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),y.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))}),jf=["color"],Pf=y.forwardRef(function(e,t){var n=e.color,o=n===void 0?"currentColor":n,i=Ls(e,jf);return y.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),y.createElement("path",{d:"M2 7.5C2 7.22386 2.22386 7 2.5 7H12.5C12.7761 7 13 7.22386 13 7.5C13 7.77614 12.7761 8 12.5 8H2.5C2.22386 8 2 7.77614 2 7.5Z",fill:o,fillRule:"evenodd",clipRule:"evenodd"}))});const Df="_checkboxGroupContainer_j54z7_1",kf="_stack_j54z7_6",Ff="_selectAllContainer_j54z7_11",Mf="_fieldContainer_j54z7_18",Kf="_checkbox_j54z7_1",Pt={checkboxGroupContainer:Df,stack:kf,selectAllContainer:Ff,fieldContainer:Mf,checkbox:Kf};function Hs({id:e,isChecked:t,label:n,onCheckedChange:o}){return a.jsxs("div",{className:Pt.fieldContainer,children:[a.jsx(Ms,{className:Pt.checkbox,id:e,onCheckedChange:o,checked:t,children:a.jsx(Ks,{children:a.jsx($s,{})})}),a.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Vs({id:e,isChecked:t,label:n,onCheckedChange:o,isIndeterminate:i}){return a.jsxs("div",{className:Pt.selectAllContainer,children:[a.jsx(Ms,{className:Pt.checkbox,id:e,onCheckedChange:o,children:a.jsxs(Ks,{children:[i&&a.jsx(Pf,{}),t===!0&&a.jsx($s,{})]})}),a.jsx("label",{htmlFor:e,children:n})]})}function Us({children:e}){return a.jsx("div",{className:Pt.checkboxGroupContainer,children:e})}function Bs({children:e}){return a.jsx("div",{className:Pt.stack,children:e})}function Lf(e,t,n){var i,r;const o=((i=e==null?void 0:e.read)==null?void 0:i.selectedOptionalFields)||{};if(o[t]=n,n||delete o[t],(r=e.read)!=null&&r.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,u=!_r(s,o);e.read.isOptionalFieldsModified=u}else console.warn("read.savedConfig.optionalFields is undefined")}function Tn(e,t,n,o){t(e,i=>Lf(i,n,o))}function $f(){var h,g;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:o}=pt(),i=(h=t==null?void 0:t.read)==null?void 0:h.selectedOptionalFields,r=(f,m)=>{f!=="indeterminate"&&o&&t&&Tn(o,n,m,f)},s=(g=t==null?void 0:t.read)==null?void 0:g.optionalFields,c=f=>{o&&s&&s.forEach(m=>{Ye(m)||Tn(o,n,m.fieldName,f)})},u=!!(s&&s.length>0),d=Object.keys(i||{}).length===(s==null?void 0:s.length),p=!d&&Object.keys(i||{}).length>0;return u&&a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`${e} reads the following optional fields`}),a.jsxs(Us,{children:[((s==null?void 0:s.length)||0)>=2&&a.jsx(Vs,{id:"select-all-fields",isChecked:d,label:"Select all",onCheckedChange:c,isIndeterminate:p}),a.jsx(Bs,{children:s.map(f=>Ye(f)?null:a.jsx(Hs,{id:f.fieldName,isChecked:!!(i!=null&&i[f==null?void 0:f.fieldName]),label:f.displayName,onCheckedChange:m=>r(m,f.fieldName)},f.fieldName))})]})]})}function Hf(){var h,g;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:o}=pt(),i=(h=t==null?void 0:t.read)==null?void 0:h.selectedOptionalFields,r=f=>{const{name:m,checked:x}=f.target;o&&t&&Tn(o,n,m,x)},s=(g=t==null?void 0:t.read)==null?void 0:g.optionalFields,c=f=>{const{checked:m}=f.target;o&&s&&s.forEach(x=>{Ye(x)||Tn(o,n,x.fieldName,m)})},u=!!(s&&s.length>0),d=Object.keys(i||{}).length===(s==null?void 0:s.length),p=!d&&Object.keys(i||{}).length>0;return u&&a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`${e} reads the following optional fields`}),a.jsxs(N.Stack,{marginBottom:10,maxHeight:300,overflowY:"scroll",border:"2px solid #EFEFEF",borderRadius:8,gap:0,children:[((s==null?void 0:s.length)||0)>=2&&a.jsx(N.Box,{backgroundColor:"gray.50",paddingX:4,paddingY:2,children:a.jsx(N.Checkbox,{name:"selectAll",id:"selectAll",onChange:c,isIndeterminate:p,isChecked:d,children:"Select all"})}),s.map(f=>Ye(f)?null:a.jsx(N.Box,{paddingX:4,paddingY:2,borderBottom:"1px",borderColor:"gray.100",children:a.jsx(N.Checkbox,{name:f.fieldName,id:f.fieldName,isChecked:!!(i!=null&&i[f==null?void 0:f.fieldName]),onChange:r,children:a.jsx("p",{style:{overflowWrap:"anywhere"},children:f.displayName})})},f.fieldName))]})]})}function Vf(){return ve?a.jsx($f,{}):a.jsx(Hf,{})}const Uf=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-badge").trim()||"#e5e5e5",Bf=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-badge-text").trim()||"#404040",qf={color:Bf,backgroundColor:Uf,borderRadius:"4px",display:"inline-block",fontSize:"0.75rem",fontWeight:500,lineHeight:"1.25",padding:"0.25rem 0.5rem"};function Wf({children:e,style:t,...n}){return a.jsx("span",{style:{...qf,...t},...n,children:e})}function Jf(){var o,i,r;const{configureState:e,selectedObjectName:t}=pt(),{appName:n}=Ie();return a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`${n} reads the following ${t} fields`}),a.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:"2rem"},children:(i=(o=e==null?void 0:e.read)==null?void 0:o.requiredFields)!=null&&i.length?(r=e.read)==null?void 0:r.requiredFields.map(s=>Ye(s)?null:a.jsx(Wf,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function zf(){return a.jsxs(a.Fragment,{children:[a.jsx(Jf,{}),a.jsx(df,{}),a.jsx(Vf,{})]})}function Xf(e,t,n){var o,i,r;if(((o=e==null?void 0:e.write)==null?void 0:o.selectedNonConfigurableWriteFields)===null&&(e.write.selectedNonConfigurableWriteFields={}),e!=null&&e.write){const s=e.write.selectedNonConfigurableWriteFields;if(s[t]=n,n||delete s[t],(r=(i=e==null?void 0:e.write)==null?void 0:i.savedConfig)!=null&&r.selectedNonConfigurableWriteFields){const c=e.write.savedConfig.selectedNonConfigurableWriteFields,d=!_r(c,s);e.write.isWriteModified=d}}}function Rn(e,t,n,o){t(e,i=>{Xf(i,n,o)})}function Yf(){var h,g,f,m;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:o}=pt(),i=(h=n==null?void 0:n.write)==null?void 0:h.selectedNonConfigurableWriteFields,r=(g=n==null?void 0:n.write)==null?void 0:g.writeObjects,s=(x,w)=>{x!=="indeterminate"&&t&&n&&Rn(t,o,w,x)},c=x=>{var w,O;t&&n&&((O=(w=n==null?void 0:n.write)==null?void 0:w.writeObjects)==null||O.forEach(v=>{Rn(t,o,v.objectName,x)}))},u=!!r,d=Object.keys(i||{}).length===((m=(f=n==null?void 0:n.write)==null?void 0:f.writeObjects)==null?void 0:m.length),p=!d&&Object.keys(i||{}).length>0;return u&&a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`Allow ${e} to write to these object`}),a.jsxs(Us,{children:[((r==null?void 0:r.length)||0)>=2&&a.jsx(Vs,{id:"select-all-fields",onCheckedChange:c,isIndeterminate:p,isChecked:d,label:"Select all"}),a.jsx(Bs,{children:r.map(x=>a.jsx(Hs,{id:x.objectName,onCheckedChange:w=>s(w,x.objectName),isChecked:!!(i!=null&&i[x.objectName]),label:x.displayName},x.objectName))})]})]})}function Gf(){var h,g,f,m;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:o}=pt(),i=(h=n==null?void 0:n.write)==null?void 0:h.selectedNonConfigurableWriteFields,r=(g=n==null?void 0:n.write)==null?void 0:g.writeObjects,s=x=>{const{name:w,checked:O}=x.target;t&&n&&Rn(t,o,w,O)},c=x=>{var O,v;const{checked:w}=x.target;t&&n&&((v=(O=n==null?void 0:n.write)==null?void 0:O.writeObjects)==null||v.forEach(C=>{Rn(t,o,C.objectName,w)}))},u=!!r,d=Object.keys(i||{}).length===((m=(f=n==null?void 0:n.write)==null?void 0:f.writeObjects)==null?void 0:m.length),p=!d&&Object.keys(i||{}).length>0;return u&&a.jsxs(a.Fragment,{children:[a.jsx(Ft,{string:`Allow ${e} to write to these object`}),a.jsxs(N.Stack,{marginBottom:10,maxHeight:300,overflowY:"scroll",border:"2px solid #EFEFEF",borderRadius:8,gap:0,children:[((r==null?void 0:r.length)||0)>=2&&a.jsx(N.Box,{backgroundColor:"gray.50",paddingX:4,paddingY:2,children:a.jsx(N.Checkbox,{name:"selectAll",id:"selectAll",onChange:c,isIndeterminate:p,isChecked:d,children:"Select all"})}),r.map(x=>a.jsx(N.Box,{display:"flex",alignItems:"center",borderBottom:"1px",borderColor:"gray.100",paddingX:4,paddingY:2,children:a.jsx(N.Checkbox,{name:x.objectName,id:x.objectName,onChange:s,isChecked:!!(i!=null&&i[x.objectName]),children:a.jsx("p",{style:{overflowWrap:"anywhere"},children:x.displayName})})},x.objectName))]})]})}function Zf(){return ve?a.jsx(Yf,{}):a.jsx(Gf,{})}function Qf(){const e=xe(),{projectId:t,appName:n}=Ie(),{integrationId:o,installation:i,resetInstallations:r,setIntegrationDeleted:s,onUninstallSuccess:c}=We(),[u,d]=y.useState(!1),p=!t||!o||!(i!=null&&i.id)||u,h=async()=>{if(!p){d(!0),console.warn("uninstalling installation",{projectId:t,integrationId:o,installationId:i.id});try{await fe().installationApi.deleteInstallation({projectIdOrName:t,integrationId:o,installationId:i.id},{headers:{"X-Api-Key":e,"Content-Type":"application/json"}}),console.warn("successfully uninstalled installation: ",i.id),c==null||c(i==null?void 0:i.id),r(),s()}catch(x){console.error("Error uninstalling installation."),Ce(x)}finally{d(!1)}}},g=u?"Uninstalling...":"Yes, uninstall",f=i!=null&&i.id?`Once you uninstall this integration, all your configuration will be lost, and "${n}" may stop working.`:"You've successfully uninstalled the integration.",m=ve?a.jsx(He,{type:"button",onClick:h,disabled:p,variant:"danger",children:g}):a.jsx(N.Button,{onClick:h,variant:"warning",isDisabled:p,children:g});return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[a.jsx("p",{children:f}),(i==null?void 0:i.id)&&m]})}const eh=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-neutral-100").trim()||"#f5f5f5",th=getComputedStyle(document.documentElement).getPropertyValue("--amp-shadows-sm").trim()||"0 1px 2px 0 rgba(0, 0, 0, 0.05)";function qs({onSave:e,onReset:t,isLoading:n,isCreateMode:o=!1,errorMsg:i}){var S,H,k;const{installation:r}=We(),{hydratedRevision:s,loading:c}=Zt(),{configureState:u,selectedObjectName:d}=pt(),p=r==null?void 0:r.config,h=p&&d&&!!yi(p,d)||!1,g=((S=u==null?void 0:u.read)==null?void 0:S.isOptionalFieldsModified)||((H=u==null?void 0:u.read)==null?void 0:H.isRequiredMapFieldsModified),f=(k=u==null?void 0:u.write)==null?void 0:k.isWriteModified,O=c||n||!u||!d||!(g||f||o||d!==xt&&!h),v=d===xt,C=d===Ti,b=ve?a.jsx(He,{type:"submit",disabled:O,children:o?"Install":"Save"}):a.jsx(N.Button,{type:"submit",variant:"primary",isDisabled:O,children:o?"Install":"Save"}),I=ve?a.jsx(He,{type:"button",onClick:t,disabled:O,variant:"ghost",children:"Reset"}):a.jsx(N.Button,{isDisabled:O,onClick:t,children:"Reset"});return n?a.jsx(qe,{}):a.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[a.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:"1rem",marginBottom:"2rem"},children:[b,I]}),a.jsxs(Dt,{style:{padding:"2rem",minHeight:"300px",backgroundColor:"white",borderColor:eh,boxShadow:th},children:[i&&a.jsx(Ni,{children:typeof i=="string"?i:"Installation Failed."}),c&&a.jsx(qe,{}),s&&!C&&!v&&a.jsx(zf,{}),s&&!C&&v&&a.jsx(Zf,{}),!c&&C&&a.jsx(Qf,{})]})]})}const Ws=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:o,onInstallSuccess:i,onUpdateSuccess:r}=We(),{hydratedRevision:s,loading:c}=Zt(),{selectedObjectName:u}=gs(),{selectedConnection:d}=kt(),p=xe(),{projectId:h}=Ie(),{resetBoundary:g,setErrors:f,setError:m,getError:x}=dt(),{resetConfigureState:w,objectConfigurationsState:O,resetPendingConfigurationState:v}=Br(),C=Oi(u||"",O),{onNextIncompleteTab:b}=Jp(),I=y.useCallback(()=>{g(me.INSTALLATION_MUTATION)},[g]),S=y.useCallback(k=>k?V=>{m(me.INSTALLATION_MUTATION,k,V)}:V=>{console.error("objectName is required to set installation error: ",V)},[m]),H=y.useCallback(k=>k?x(me.INSTALLATION_MUTATION,k):"",[x]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:o,hydratedRevision:s,loading:c,selectedObjectName:u,selectedConnection:d,apiKey:p,projectId:h,resetBoundary:g,setErrors:f,setMutateInstallationError:S,getMutateInstallationError:H,resetMutateInstallationErrorState:I,resetConfigureState:w,objectConfigurationsState:O,resetPendingConfigurationState:v,configureState:C,onInstallSuccess:i,onUpdateSuccess:r,onNextIncompleteTab:b}},nh=void 0;function rh(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:o,hydratedRevision:i,loading:r,selectedObjectName:s,selectedConnection:c,apiKey:u,projectId:d,resetBoundary:p,setErrors:h,setMutateInstallationError:g,getMutateInstallationError:f,resetMutateInstallationErrorState:m,resetConfigureState:x,objectConfigurationsState:w,resetPendingConfigurationState:O,configureState:v,onInstallSuccess:C,onNextIncompleteTab:b}=Ws(),[I,S]=y.useState(!1),H=s===xt,k=f(s),V=y.useCallback(()=>{p(me.MAPPING),i!=null&&i.content&&!r&&s&&_i(i,nh,s,x)},[p,i,r,s,x]);y.useEffect(()=>{!v&&(i!=null&&i.content)&&!r&&V()},[v,w,i,r,V]);const z=()=>{m();const{requiredMapFields:te,selectedFieldMappings:Q}=(v==null?void 0:v.read)||{},{errorList:ue}=wi(te,Q,h);ue.length>0||(s&&(c!=null&&c.id)&&u&&d&&e&&t&&n&&i?(S(!0),xd(d,e,t,n,c.id,s,u,i,v,g(s),o,C).finally(()=>{S(!1),O(s),b()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},X=()=>{m(),s&&(c!=null&&c.id)&&u&&d&&e&&t&&n&&i?(S(!0),Cd(d,e,t,n,c.id,u,i,v,g(s),o,C).finally(()=>{S(!1),O(s),b()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},Z=te=>{te.preventDefault(),H?X():z()};return a.jsx(qs,{errorMsg:k,isCreateMode:!0,isLoading:I,onSave:Z,onReset:V})}function oh({updateConfig:e,projectId:t,integrationId:n,installationId:o,apiKey:i,selectedObjectName:r,setInstallation:s,onUpdateSuccess:c,setError:u}){const d={projectIdOrName:t,installationId:o,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${r}`],installation:{config:e}}};return fe().installationApi.updateInstallation(d,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}}).then(p=>{s(p),c==null||c(p.id,p.config)}).catch(p=>{Ce(p,u)})}const ih=(e,t,n,o,i,r)=>{const s=bi(e),c=Ci(e),u={content:{read:{objects:{[t]:{objectName:t,schedule:o,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:c,backfill:r}}}}};return jn(i)&&(u.content||(u.content={}),u.content.proxy={enabled:!0}),u},sh=(e,t,n,o,i,r,s,c,u,d,p)=>{const h=ih(r,o||"",c,c.schedule,u,c.backfill);return h?oh({updateConfig:h,projectId:e,integrationId:t,installationId:n,apiKey:i,selectedObjectName:o,setError:d,setInstallation:s,onUpdateSuccess:p}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},ah=(e,t)=>{const o={content:{write:{objects:Si(e)}}};return jn(t)&&(o.content||(o.content={}),o.content.proxy={enabled:!0}),o},ch=(e,t,n,o,i,r,s,c,u)=>{const d=ah(i,r);if(!d)return console.error("Error when generating write updateConfig from configureState"),Promise.resolve(null);const p={projectIdOrName:e,installationId:n,integrationId:t,installationUpdate:{updateMask:["config.content.write.objects"],installation:{config:d}}};return fe().installationApi.updateInstallation(p,{headers:{"X-Api-Key":o,"Content-Type":"application/json"}}).then(h=>{c(h),u==null||u(h.id,h.config)}).catch(h=>{Ce(h,s)})};function uh({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:o,loading:i,selectedObjectName:r,apiKey:s,projectId:c,resetBoundary:u,setErrors:d,setMutateInstallationError:p,getMutateInstallationError:h,resetConfigureState:g,resetPendingConfigurationState:f,configureState:m,onUpdateSuccess:x,onNextIncompleteTab:w}=Ws(),[O,v]=y.useState(!1),C=r===xt,b=h(r),{config:I}=e,S=y.useCallback(()=>{u(me.MAPPING),o!=null&&o.content&&!i&&r&&_i(o,I,r,g)},[u,o,i,r,I,g]);y.useEffect(()=>{m||S()},[m,S]),y.useEffect(()=>{e&&S()},[e,S]);const H=y.useMemo(()=>{var Z,te,Q;return(Q=(te=(Z=o==null?void 0:o.content)==null?void 0:Z.read)==null?void 0:te.objects)==null?void 0:Q.find(ue=>(ue==null?void 0:ue.objectName)===r)},[o,r]),k=()=>{const{requiredMapFields:X,selectedFieldMappings:Z}=(m==null?void 0:m.read)||{},{errorList:te}=wi(X,Z,d);te.length>0||(o&&e&&r&&s&&c&&H?(v(!0),sh(c,t.id,e.id,r,s,m,n,H,o,p(r),x).finally(()=>{v(!1),f(r),w()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},V=()=>{e&&r&&s&&c&&o?(v(!0),ch(c,t.id,e.id,s,m,o,p(r),n,x).finally(()=>{v(!1),f(r),w()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},z=X=>{X.preventDefault(),C?V():k()};return a.jsx(qs,{errorMsg:b,onSave:z,onReset:S,isLoading:O})}function lh(){const{integrationObj:e,installation:t}=We();return e?t&&e?a.jsx(uh,{installation:t,integrationObj:e}):a.jsx(rh,{}):a.jsx(ot,{message:"We can't load the integration"})}function dh(){return a.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),a.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Jr({text:e,children:t}){return a.jsx(Gt,{children:a.jsxs(Dt,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"},children:[a.jsx(dh,{}),a.jsx("p",{children:e}),t]})})}const ph=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function fh({projectId:e,integrationId:t,groupRef:n,consumerRef:o,connectionId:i,apiKey:r,hydratedRevision:s,setError:c,setInstallation:u,onInstallSuccess:d}){const p=ph(s,o);return p?br({createConfig:p,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:r,setError:c,setInstallation:u,onInstallSuccess:d}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function hh({provider:e}){const t=`You have successfully installed your ${it(e)} integration.`;return a.jsx(Jr,{text:t})}const mh=e=>{const{read:t,write:n,proxy:o}=(e==null?void 0:e.content)??{};return!t&&!n&&(o==null?void 0:o.enabled)||!1};function gh({children:e,resetComponent:t}){var b;const{projectId:n}=Ie(),o=xe(),{hydratedRevision:i,loading:r}=Zt(),{integrationObj:s,installation:c,groupRef:u,consumerRef:d,setInstallation:p,onInstallSuccess:h,isIntegrationDeleted:g}=We(),{selectedConnection:f}=kt(),[m,x]=y.useState(!1),w=r||m,O=(b=i==null?void 0:i.content)==null?void 0:b.provider,v=mh(i),C=I=>{console.error("Error when creating proxy installation:",I)};return y.useEffect(()=>{!w&&i&&v&&!c&&f&&o&&(s!=null&&s.id)&&(x(!0),fh({apiKey:o,projectId:n,integrationId:s==null?void 0:s.id,groupRef:u,consumerRef:d,connectionId:f==null?void 0:f.id,hydratedRevision:i,setError:C,setInstallation:p,onInstallSuccess:h}).then(()=>{x(!1)}).catch(I=>{x(!1),console.error("Error when creating proxy installation:",I)}))},[i,v,c,f,o,n,s==null?void 0:s.id,u,d,p,w,h]),s?w?a.jsx(qe,{}):v&&O&&c?a.jsx(hh,{provider:O}):g?a.jsx(Jr,{text:"Integration successfully uninstalled.",children:ve&&a.jsx(He,{type:"button",onClick:t,style:{width:"100%"},children:"Reinstall Integration"})}):a.jsx("div",{children:e}):a.jsx(ot,{message:"We can't load the integration"})}function Js(){return a.jsxs("footer",{style:{backgroundColor:"#EFEFEF",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[a.jsx("p",{children:"Secured by"}),a.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:a.jsx("img",{style:{height:".8em"},src:"https://ampersand-website.vercel.app/logo-black.svg",alt:"Ampersand"})})]})}function Me({children:e}){return a.jsx(Gt,{children:a.jsxs(Dt,{children:[a.jsx("div",{style:{padding:"3rem 2rem"},children:e}),a.jsx(Js,{})]})})}function Qt({children:e}){return a.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function Ke({error:e}){return e?a.jsx(Ni,{style:{marginTop:"2em"},children:e}):null}function zr({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o,children:i,title:r}){if(!r&&!o)throw new Error("Either title or providerName is required");return a.jsxs(Me,{children:[a.jsx(Qt,{children:r||`Set up ${o} integration`}),a.jsx(Ke,{error:t}),i,a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const yh="_link_oo2kv_1",vh={link:yh};function Xr({href:e,className:t,style:n,label:o,children:i,newTab:r=!1}){return ve?a.jsx("a",{className:vh.link,style:n,href:e,"aria-label":o||void 0,target:r?"_blank":"_self",rel:r?"noopener noreferrer":void 0,children:i}):a.jsx(N.Link,{href:e,className:t,style:n,"aria-label":o||void 0,target:r?"_blank":"_self",rel:r?"noopener noreferrer":void 0,color:"#737373",children:i})}const Ih=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-text-secondary").trim()||"#737373";function Kn({url:e,providerDisplayName:t,credentialName:n}){return a.jsxs("p",{style:{color:Ih},children:[a.jsx(Xr,{href:e,newTab:!0,children:a.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const wh="_input_19woe_1",xh="_inputError_19woe_17",_h="_error_19woe_31",rr={input:wh,inputError:xh,error:_h};function bh({id:e,type:t,className:n,isError:o=!1,...i}){const r=o?zt(rr.inputError,rr.input):rr.input;return a.jsx("input",{id:e,type:t,className:zt(r,n),...i})}const Ch="_textarea_1efhx_1",Oh="_textareaError_1efhx_13",Sh="_error_1efhx_27",or={textarea:Ch,textareaError:Oh,error:Sh};function Nh({className:e,isError:t=!1,...n}){const o=t?zt(or.textareaError,or.textarea):or.textarea;return a.jsx("textarea",{className:zt(e,o),...n})}const rt={Input:bh,Textarea:Nh};function Eh({provider:e,providerInfo:t,handleSubmit:n,error:o,isButtonDisabled:i}){var x;const[r,s]=y.useState(!1),c=()=>s(!r),[u,d]=y.useState(""),p=w=>d(w.currentTarget.value),h=u.length>0,g=i||!h,f=it(e,t),m=(x=t.apiKeyOpts)==null?void 0:x.docsURL;return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{my:"6",children:a.jsx(N.Heading,{as:"h4",size:"md",children:`Set up ${f} integration`})}),a.jsx(Ke,{error:o}),a.jsxs(N.Stack,{spacing:4,children:[m&&a.jsx(Kn,{url:m,providerDisplayName:f,credentialName:"API key"}),a.jsxs(N.InputGroup,{size:"md",children:[a.jsx(N.Input,{onChange:p,pr:"4.5rem",type:r?"text":"password",placeholder:"API Key"}),a.jsx(N.InputRightElement,{width:"4.5rem",children:a.jsx(N.Button,{h:"1.75rem",size:"sm",onClick:c,children:r?"Hide":"Show"})})]})]}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:g,width:"100%",type:"submit",onClick:()=>{n({apiKey:u})},children:"Next"})]})})}function Th({provider:e,providerInfo:t,handleSubmit:n,error:o,isButtonDisabled:i}){var x;const[r,s]=y.useState(!1),c=()=>s(w=>!w),[u,d]=y.useState(""),p=w=>d(w.currentTarget.value),h=u.length>0,g=i||!h,f=it(e,t),m=(x=t.apiKeyOpts)==null?void 0:x.docsURL;return a.jsx(zr,{providerName:f,handleSubmit:()=>{n({apiKey:u})},error:o,isButtonDisabled:g,children:a.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[m&&a.jsx(Kn,{url:m,providerDisplayName:f,credentialName:"API key"}),a.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[a.jsx(rt.Input,{id:"password",name:"password",type:r?"text":"password",placeholder:"Password",onChange:w=>p(w)}),a.jsx(He,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,children:r?"Hide":"Show"})]})]})})}function Rh({...e}){return ve?a.jsx(Th,{...e}):a.jsx(Eh,{...e})}function Ah({provider:e,providerInfo:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,children:s,selectedConnection:c,setSelectedConnection:u}){const d=Ie(),[p,h]=y.useState(!1),[g,f]=y.useState(null),m=xe();y.useEffect(()=>{if(e&&fe&&p&&g!=null){const w={groupName:r,groupRef:i,consumerName:o,consumerRef:n,provider:e,apiKey:g};fe().connectionApi.generateConnection({projectIdOrName:d.projectId,generateConnectionParams:w},{headers:{"X-Api-Key":m??"","Content-Type":"application/json"}}).then(O=>{u(O)}).catch(O=>{console.error("Error loading provider info."),Ce(O)})}},[m,e,p,o,n,r,i,d,u,g]);const x=w=>{f(w.apiKey),h(!0)};return c===null?a.jsx(Rh,{provider:e,providerInfo:t,handleSubmit:x,error:null}):s}function jh({provider:e,providerInfo:t,handleSubmit:n,error:o,isButtonDisabled:i}){var v;const[r,s]=y.useState(!1),c=()=>s(!r),[u,d]=y.useState(""),[p,h]=y.useState(""),g=C=>d(C.currentTarget.value),f=C=>h(C.currentTarget.value),m=it(e,t),x=(v=t.basicOpts)==null?void 0:v.docsURL,w=u.length>0,O=i||!w;return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(N.Heading,{as:"h4",size:"md",children:`Set up ${m} integration`})}),a.jsx(Ke,{error:o}),a.jsx("br",{}),a.jsxs(N.Stack,{spacing:4,children:[x&&a.jsx(Kn,{url:x,providerDisplayName:m,credentialName:"credentials"}),a.jsx(N.Input,{placeholder:"Username",onChange:g}),a.jsxs(N.InputGroup,{size:"md",children:[a.jsx(N.Input,{onChange:f,pr:"4.5rem",type:r?"text":"password",placeholder:"Password"}),a.jsx(N.InputRightElement,{width:"4.5rem",children:a.jsx(N.Button,{h:"1.75rem",size:"sm",onClick:c,children:r?"Hide":"Show"})})]})]}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:O,width:"100%",type:"submit",onClick:()=>{n({user:u,pass:p})},children:"Next"})]})})}function Ph({provider:e,providerInfo:t,handleSubmit:n,error:o,isButtonDisabled:i}){var O;const[r,s]=y.useState(!1),c=()=>s(v=>!v),[u,d]=y.useState({username:"",password:""}),{username:p,password:h}=u,g=it(e,t),f=(O=t.basicOpts)==null?void 0:O.docsURL,m=p.length>0,x=i||!m,w=v=>{const{name:C,value:b}=v.currentTarget;d(I=>({...I,[C]:b}))};return a.jsx(zr,{providerName:g,handleSubmit:()=>{n({user:p,pass:h})},error:o,isButtonDisabled:x,children:a.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[f&&a.jsx(Kn,{url:f,providerDisplayName:g,credentialName:"credentials"}),a.jsx(rt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:v=>w(v)}),a.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[a.jsx(rt.Input,{id:"password",name:"password",type:r?"text":"password",placeholder:"Password",onChange:v=>w(v)}),a.jsx(He,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,children:r?"Hide":"Show"})]})]})})}function Dh({...e}){return ve?a.jsx(Ph,{...e}):a.jsx(jh,{...e})}function kh({provider:e,providerInfo:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,children:s,selectedConnection:c,setSelectedConnection:u}){const d=Ie(),[p,h]=y.useState(!1),[g,f]=y.useState(null),m=xe();y.useEffect(()=>{if(e&&fe&&p&&g!=null){const w={groupName:r,groupRef:i,consumerName:o,consumerRef:n,provider:e,basicAuth:{username:g.user,password:g.pass}};fe().connectionApi.generateConnection({projectIdOrName:d.projectId,generateConnectionParams:w},{headers:{"X-Api-Key":m??"","Content-Type":"application/json"}}).then(O=>{u(O)}).catch(O=>{console.error("Error loading provider info."),Ce(O)})}},[m,e,p,o,n,r,i,d,g,u]);const x=w=>{const{user:O,pass:v}=w;f({user:O,pass:v}),h(!0)};return c===null?a.jsx(Dh,{provider:e,providerInfo:t,handleSubmit:x,error:null}):s}function Fh({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o}){return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(N.Heading,{as:"h4",size:"md",children:`Set up ${o} integration`})}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:n,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function Mh({...e}){return ve?a.jsx(zr,{...e}):a.jsx(Fh,{...e})}function Kh({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,children:r,selectedConnection:s,setSelectedConnection:c,providerName:u}){const d=Ie(),p=xe(),[h,g]=y.useState(!1);y.useEffect(()=>{if(e&&fe&&h){const m={groupName:i,groupRef:o,consumerName:n,consumerRef:t,provider:e};fe().connectionApi.generateConnection({projectIdOrName:d.projectId,generateConnectionParams:m},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(x=>{c(x)}).catch(x=>{console.error("Error loading provider info."),Ce(x)})}},[p,e,h,n,t,i,o,c,d]);const f=()=>{g(!0)};return s===null?a.jsx(Mh,{handleSubmit:f,error:null,providerName:u}):r}const zs=async(e,t,n,o,i,r,s,c)=>{var d;const u=await fe().providerApi.getProvider({provider:i},{headers:{"X-Api-Key":o??""}});if(!u)throw new Error(`Provider ${i} not found`);if(u.authType==="oauth2"&&((d=u.oauth2Opts)==null?void 0:d.grantType)==="authorizationCode"){const h=(await fe().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":o??""}})).find(x=>x.provider===i),g=it(i,u);if(!h)throw new Error(`You must first set up a ${g} Provider App using the Ampersand Console.`);const f={connectOAuthParams:{providerWorkspaceRef:r,projectId:e,groupRef:n,groupName:c,consumerRef:t,consumerName:s,providerAppId:h.id,provider:i}};return await fe().oAuthApi.oauthConnect(f)}throw new Error(`Provider ${i} does not support an OAuth2 web flow.`)},zo=600,Xo=600,Lh="AUTHORIZATION_SUCCEEDED",$h="AUTHORIZATION_FAILED";function Hh(e,t,n){return y.useCallback(async o=>{const i=await fe().connectionApi.getConnection({projectIdOrName:e,connectionId:o},{headers:{"X-Api-Key":t??""}});n(i)},[e,t,n])}function Vh(e,t,n,o){return y.useCallback(()=>{if(!o)return;const i=window.screenX+(window.outerWidth-zo)/2,r=window.screenY+(window.outerHeight-Xo)/2.5,s=`width=${zo},height=${Xo},left=${i},top=${r}`,c=window.open(o,e,s);t(c),window.addEventListener("message",n,!1)},[o,e,t,n])}function Uh(e,t){return y.useCallback(n=>{var o,i;if(n.origin===ql){if(n.data.eventType===Lh){const r=(o=n.data.data)==null?void 0:o.connection;r?e(r):console.error("Connection ID not found in event data: ",{event:n})}n.data.eventType===$h&&(console.error("OAuth failed: ",{event:n}),t==null||t(((i=n==null?void 0:n.data)==null?void 0:i.message)??"OAuth failed. Please try again."))}},[t,e])}function Xs({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:o,error:i}){const r=xe(),{projectId:s}=Ie(),[c,u]=y.useState(null),[d,p]=y.useState(null),{setSelectedConnection:h}=kt(),g=Uh(u,o),f=Vh(n,p,g,t),m=Hh(s,r,h);y.useEffect(()=>{t&&!d&&f()},[t,d,f,g,n]),y.useEffect(()=>{c&&m(c).then(()=>{d==null||d.close()}).catch(w=>{console.error("Error refreshing connection: ",w),o==null||o(w.message??"Unexpected error: not able to refresh connection")})},[c,r,h,m,d,o]);const x=d&&setInterval(()=>{(d!=null&&d.closed||!d)&&x&&(clearInterval(x),window.removeEventListener("message",g),p(null),!c&&!i?(console.error("OAuth failed. Please try again."),o==null||o("OAuth failed. Please try again.")):c&&o&&(o==null||o(null)))},500);return a.jsx("div",{children:e})}function Bh({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o}){return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(N.Heading,{as:"h4",size:"md",children:`Set up ${o} integration`})}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:n,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function qh({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o}){return ve?a.jsxs(Me,{children:[a.jsx(Qt,{children:`Set up ${o} integration`}),a.jsx(Ke,{error:t}),a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]}):a.jsx(Bh,{handleSubmit:e,error:t,isButtonDisabled:n,providerName:o})}function Wh({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,providerName:r}){const{projectId:s}=Ie(),c=xe(),[u,d]=y.useState(null),[p,h]=y.useState(null),g=async()=>{h(null);try{const m=await zs(s,t,o,c,e,void 0,n,i);d(m)}catch(m){console.error("Could not fetch OAuth popup URL."),Ce(m),h(m.message??"Unexpected error")}},f=y.useCallback(m=>{h(m),d(null)},[]);return a.jsx(Xs,{windowTitle:`Connect to ${r}`,oauthUrl:u,onError:f,children:a.jsx(qh,{handleSubmit:g,error:p,providerName:r})})}const Jh=N.createIcon({displayName:"ExternalLinkIcon",path:a.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[a.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),a.jsx("path",{d:"M15 3h6v6"}),a.jsx("path",{d:"M10 14L21 3"})]})}),Ys="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function zh({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o}){return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{children:a.jsx(N.Heading,{as:"h4",size:"md",children:"Enter your Salesforce subdomain"})}),a.jsxs(Xr,{href:Ys,newTab:!0,children:["What is my Salesforce subdomain? ",a.jsx(Jh,{})]}),a.jsx(Ke,{error:n}),a.jsxs("div",{style:{display:"flex",marginTop:"1em"},children:[a.jsx(N.Input,{placeholder:"my-domain",onChange:i=>t(i.currentTarget.value)}),a.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:o,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function Xh({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o}){const i={handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o};return ve?a.jsxs(Me,{children:[a.jsx(Qt,{children:"Enter your Salesforce subdomain"}),a.jsx(Xr,{href:Ys,newTab:!0,children:"What is my Salesforce subdomain?"}),a.jsx(Ke,{error:n}),a.jsxs("div",{style:{display:"flex",marginTop:"1em"},children:[a.jsx(rt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:r=>t(r.currentTarget.value)}),a.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:o,type:"submit",onClick:e,children:"Next"})]}):a.jsx(zh,{...i})}function Yh({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o,providerName:i}){return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsxs(N.Heading,{as:"h4",size:"md",children:["Enter your ",i," workspace"]})}),a.jsx(Ke,{error:n}),a.jsx(N.Flex,{marginTop:"1em",children:a.jsx(N.Input,{placeholder:"MyWorkspace",onChange:r=>t(r.currentTarget.value)})}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:o,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function Gh({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o,providerName:i}){if(!ve){const r={handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:o,providerName:i};return a.jsx(Yh,{...r})}return a.jsxs(Me,{children:[a.jsxs(Qt,{children:["Enter your ",i," workspace"]}),a.jsx(Ke,{error:n}),a.jsx("br",{}),a.jsx(rt.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:r=>t(r.currentTarget.value)}),a.jsx("br",{}),a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:o,type:"submit",onClick:e,children:"Next"})]})}const Zh="salesforce";function Qh({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,providerName:r}){const{projectId:s}=Ie(),c=xe(),[u,d]=y.useState(""),[p,h]=y.useState(null),[g,f]=y.useState(null),m=async()=>{if(f(null),!u){f("Workspace is required");return}try{const O=await zs(s,t,o,c,e,u,n,i);h(O)}catch(O){console.error(O),f((O==null?void 0:O.message)??"Unexpected error")}},x=y.useCallback(O=>{f(O),h(null)},[]),w=e===Zh?a.jsx(Xh,{handleSubmit:m,setWorkspace:d,error:g,isButtonDisabled:u.length===0}):a.jsx(Gh,{handleSubmit:m,setWorkspace:d,error:g,isButtonDisabled:u.length===0,providerName:r});return a.jsx(Xs,{windowTitle:`Connect to ${r}`,oauthUrl:p,onError:x,children:w})}function em({handleSubmit:e,error:t,explicitScopesRequired:n,isButtonDisabled:o,providerName:i}){const[r,s]=y.useState(!1),[c,u]=y.useState(""),[d,p]=y.useState(""),[h,g]=y.useState(""),f=()=>s(!r),m=I=>u(I.currentTarget.value),x=I=>p(I.currentTarget.value),w=I=>g(I.currentTarget.value),O=c.length>0,v=d.length>0,C=o||!O||!v,b=()=>{const I={clientId:d,clientSecret:c};n&&h.length>0&&(I.scopes=Ir(h)),e(I)};return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(N.Heading,{as:"h4",size:"md",children:`Set up ${i} integration`})}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsxs(N.Stack,{spacing:4,children:[a.jsx(N.Input,{placeholder:"Client ID",onChange:x}),a.jsxs(N.InputGroup,{size:"md",children:[a.jsx(N.Input,{onChange:m,pr:"4.5rem",type:r?"text":"password",placeholder:"Client Secret"}),a.jsx(N.InputRightElement,{width:"4.5rem",children:a.jsx(N.Button,{h:"1.75rem",size:"sm",onClick:f,children:r?"Hide":"Show"})})]}),n&&a.jsx(N.Textarea,{placeholder:"Scopes separated by new line",onChange:w})]}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:C,width:"100%",type:"submit",onClick:b,children:"Next"})]})})}function tm({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,explicitScopesRequired:r,providerName:s,selectedConnection:c,setSelectedConnection:u}){const{projectId:d}=Ie(),p=xe(),[h,g]=y.useState(null),f=async m=>{g(null);const x={groupName:i,groupRef:o,consumerName:n,consumerRef:t,provider:e,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes}};fe().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:x},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(w=>{u(w)}).catch(w=>{console.error("Error loading provider info."),Ce(w),g("Error loading provider info")})};return c===null?a.jsx(em,{providerName:s,handleSubmit:f,error:h,explicitScopesRequired:r}):a.jsx(qe,{})}function nm({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o,explicitScopesRequired:i}){const[r,s]=y.useState(!1),[c,u]=y.useState(""),[d,p]=y.useState(""),[h,g]=y.useState(""),[f,m]=y.useState(""),x=()=>s(!r),w=V=>u(V.currentTarget.value),O=V=>p(V.currentTarget.value),v=V=>g(V.currentTarget.value),C=V=>m(V.currentTarget.value),b=c.length>0,I=d.length>0,S=h.length>0,H=n||!b||!I||!S,k=()=>{const V={workspace:h,clientId:d,clientSecret:c};i&&f.length>0&&(V.scopes=Ir(f)),e(V)};return a.jsx(Me,{children:a.jsxs(N.FormControl,{children:[a.jsx(N.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(N.Heading,{as:"h4",size:"md",children:`Set up ${o} integration`})}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsxs(N.Stack,{spacing:4,children:[a.jsx(N.Input,{placeholder:"MyWorkspace",onChange:v}),a.jsx(N.Input,{placeholder:"Client ID",onChange:O}),a.jsxs(N.InputGroup,{size:"md",children:[a.jsx(N.Input,{onChange:w,pr:"4.5rem",type:r?"text":"password",placeholder:"Client Secret"}),a.jsx(N.InputRightElement,{width:"4.5rem",children:a.jsx(N.Button,{h:"1.75rem",size:"sm",onClick:x,children:r?"Hide":"Show"})})]}),i&&a.jsx(N.Textarea,{placeholder:"Scopes separated by new line",onChange:C})]}),a.jsx("br",{}),a.jsx(N.Button,{variant:"primary",isDisabled:H,width:"100%",type:"submit",onClick:k,children:"Next"})]})})}function rm({provider:e,providerName:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,explicitScopesRequired:s,selectedConnection:c,setSelectedConnection:u}){const{projectId:d}=Ie(),p=xe(),[h,g]=y.useState(null),f=async m=>{g(null);const x={groupName:r,groupRef:i,consumerName:o,consumerRef:n,provider:e,providerWorkspaceRef:m.workspace,oauth2ClientCredentials:{clientId:m.clientId,clientSecret:m.clientSecret,scopes:m.scopes}};fe().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:x},{headers:{"X-Api-Key":p??"","Content-Type":"application/json"}}).then(w=>{u(w)}).catch(w=>{console.error("Error loading provider info."),Ce(w),g("Error loading provider info")})};return c===null?a.jsx(nm,{providerName:t,handleSubmit:f,error:h,explicitScopesRequired:s}):a.jsx(qe,{})}function om({handleSubmit:e,error:t,isButtonDisabled:n,providerName:o,explicitScopesRequired:i,explicitWorkspaceRequired:r}){const[s,c]=y.useState(!1),[u,d]=y.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),p=()=>c(I=>!I),h=I=>{const{name:S,value:H}=I.currentTarget;d(k=>({...k,[S]:H}))},{clientSecret:g,clientId:f,workspace:m,scopes:x}=u,w=g.length>0,O=f.length>0,v=r?m.length>0:!0,C=n||!w||!O||!v,b=()=>{const I={clientId:f,clientSecret:g};r&&(I.workspace=m),i&&x.length>0&&(I.scopes=Ir(x)),e(I)};return a.jsxs(Me,{children:[a.jsx(Qt,{children:`Set up ${o} integration`}),a.jsx(Ke,{error:t}),a.jsx("br",{}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[r&&a.jsx(rt.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:I=>h(I)}),a.jsx(rt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:I=>h(I)}),a.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[a.jsx(rt.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:I=>h(I)}),a.jsx(He,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:p,children:s?"Hide":"Show"})]}),i&&a.jsx(rt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:I=>h(I)})]}),a.jsx("br",{}),a.jsx(He,{style:{marginTop:"1em",width:"100%"},disabled:C,type:"submit",onClick:b,children:"Next"})]})}function im({provider:e,providerName:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,explicitScopesRequired:s,explicitWorkspaceRequired:c,selectedConnection:u,setSelectedConnection:d}){const{projectId:p}=Ie(),h=xe(),[g,f]=y.useState(null),m=async x=>{f(null);const w={groupName:r,groupRef:i,consumerName:o,consumerRef:n,provider:e,providerWorkspaceRef:x.workspace,oauth2ClientCredentials:{clientId:x.clientId,clientSecret:x.clientSecret,scopes:x.scopes}};fe().connectionApi.generateConnection({projectIdOrName:p,generateConnectionParams:w},{headers:{"X-Api-Key":h??"","Content-Type":"application/json"}}).then(O=>{d(O)}).catch(O=>{console.error("Error loading provider info."),Ce(O),f("Error loading provider info")})};return u===null?a.jsx(om,{providerName:t,handleSubmit:m,error:g,explicitScopesRequired:s,explicitWorkspaceRequired:c}):a.jsx(qe,{})}function sm({...e}){return ve?a.jsx(im,{...e}):e.explicitWorkspaceRequired?a.jsx(rm,{...e}):a.jsx(tm,{...e})}const am="authorizationCode",cm="clientCredentials";function um({provider:e,providerInfo:t,consumerRef:n,consumerName:o,groupRef:i,groupName:r,selectedConnection:s,setSelectedConnection:c}){if(t.oauth2Opts===void 0)return a.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:u,explicitScopesRequired:d,explicitWorkspaceRequired:p}=t.oauth2Opts,h=it(e,t),g={provider:e,consumerRef:n,consumerName:o,groupRef:i,groupName:r,providerName:h};return u===am?p?a.jsx(Qh,{...g}):a.jsx(Wh,{...g}):u===cm?a.jsx(sm,{...g,explicitWorkspaceRequired:p,explicitScopesRequired:d,selectedConnection:s,setSelectedConnection:c}):u==="password"?a.jsx("em",{children:"Password flow not supported yet"}):u==="PKCE"?a.jsx("em",{children:"PKCE flow not supported yet"}):a.jsxs("em",{children:["Unsupported grant type: ",u]})}function lm(e){const{selectedConnection:t}=kt();y.useEffect(()=>{e&&t&&e(t.id)},[e,t])}function dm({onSuccess:e}){lm(e)}const pm=async(e,t)=>{const n=await fe().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!n)throw new Error(`Provider ${t} not found`);return n};function Gs({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,children:r,onSuccess:s}){const c=xe(),[u,d]=y.useState(null),{provider:p}=We(),{selectedConnection:h,setSelectedConnection:g,connections:f}=kt();dm({onSuccess:s});const m=e||p,x=(u==null?void 0:u.displayName)??Zo(m);if(y.useEffect(()=>{if(!h&&f&&f.length>0){const[O]=f;g(O)}pm(c,m).then(O=>{d(O)}).catch(O=>{console.error("Error loading provider info."),Ce(O)})},[f,h,g,c,m]),!e&&!p)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(h)return r;if(u==null)return a.jsx("strong",{children:"Provider not found"});const w={provider:m,consumerRef:t,consumerName:n,groupRef:o,groupName:i,selectedConnection:h,setSelectedConnection:g,providerName:x,providerInfo:u};return u.authType==="none"?a.jsx(Kh,{...w,children:r}):u.authType==="basic"?a.jsx(kh,{...w,children:r}):u.authType==="apiKey"?a.jsx(Ah,{...w,children:r}):a.jsx(um,{...w})}const fm=a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[a.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),a.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function hm(e,t){return t?y.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},y.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?fm:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:a.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}const Zs=y.forwardRef(({objectName:e,completed:t,pending:n,displayName:o},i)=>{const r=N.useTab({ref:i}),s=N.useMultiStyleConfig("Tabs",r);return a.jsxs(N.Button,{__css:s.tab,...r,variant:"outline",minHeight:15,children:[a.jsxs(N.Box,{as:"span",display:"flex",alignItems:"center",gap:2,mr:"3",children:[hm(t,n),a.jsxs(N.Box,{textAlign:"left",children:[a.jsx(N.Text,{children:o||e}),n&&a.jsx(N.Text,{fontSize:10,fontStyle:"italic",children:"pending"})]})]}),r.children]})});function mm({pending:e,completed:t,displayName:n}){return a.jsxs(a.Fragment,{children:[a.jsx(qr,{style:{margin:"1rem 0"}}),a.jsx(Zs,{objectName:xt,completed:t,pending:e,displayName:n},"other-write")]})}function gm(e,t){return e!=null&&e[t]?e[t]:{name:Ti,completed:!1}}const ym=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-background-secondary").trim()||"#FCFCFC";function vm({children:e}){var O,v,C;const{project:t}=Ie(),{installation:n,provider:o}=We(),{hydratedRevision:i}=Zt(),{objectConfigurationsState:r}=Br(),[s,c]=y.useState(0),u=(t==null?void 0:t.appName)||"",d=n==null?void 0:n.config,p=i&&vi(d,i),h=p!==null,g=!!((O=i==null?void 0:i.content)!=null&&O.write),f=g?Ii(d):void 0,m=y.useMemo(()=>{const b=[...p||[]];return f&&g&&b.push(f),b},[p,f,g]),x=gm(m,s),w=y.useCallback(()=>{const b=m.find(I=>x!==I&&!I.completed);b&&c(m.indexOf(b))},[m,x]);return a.jsx(ys.Provider,{value:w,children:a.jsx(ms.Provider,{value:x==null?void 0:x.name,children:a.jsxs(Gt,{style:{maxWidth:"55rem"},children:[a.jsxs(Dt,{style:{display:"flex",gap:"1rem",padding:"3rem",backgroundColor:ym},children:[a.jsxs("div",{style:{width:"20rem"},children:[a.jsxs(N.Text,{children:[it(o)," integration"]}),a.jsx(N.Text,{marginBottom:"20px",fontSize:"1.125rem",fontWeight:"500",children:u}),h&&a.jsxs(N.Tabs,{index:s,onChange:c,orientation:"horizontal",children:[p.map(b=>{var I,S,H,k;return a.jsx(Zs,{objectName:b.name,completed:b.completed,pending:((S=(I=r[b.name])==null?void 0:I.read)==null?void 0:S.isOptionalFieldsModified)||((k=(H=r[b.name])==null?void 0:H.read)==null?void 0:k.isRequiredMapFieldsModified)},b.name)}),g&&f&&a.jsx(mm,{completed:f.completed,pending:(C=(v=r==null?void 0:r.other)==null?void 0:v.write)==null?void 0:C.isWriteModified,displayName:p!=null&&p.length?"other":"write"}),n&&a.jsxs(a.Fragment,{children:[a.jsx(qr,{style:{margin:"3rem 0 1rem 0"}}),a.jsx(kd,{text:"Uninstall"},"uninstall-installation")]})]})]}),e]}),a.jsx(Js,{})]})})})}function Im({...e}){return a.jsx(vm,{...e})}function wm(){const[e,t]=y.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}function xm({integration:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,onInstallSuccess:r,onUpdateSuccess:s,onUninstallSuccess:c,fieldMapping:u}){var f;const{projectId:d}=Ie(),{errorState:p}=dt(),{seed:h,reset:g}=wm();return(f=p[me.INTEGRATION_LIST])!=null&&f.apiError?a.jsx(ot,{message:"Something went wrong, couldn't find integration information"}):a.jsx(ad,{integration:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,onInstallSuccess:r,onUpdateSuccess:s,onUninstallSuccess:c,fieldMapping:u,children:a.jsx(gi,{groupRef:o,children:a.jsx(Gs,{consumerRef:t,consumerName:n,groupRef:o,groupName:i,children:a.jsx(Fd,{projectId:d,children:a.jsx(gh,{resetComponent:g,children:a.jsx(af,{children:a.jsx(Im,{children:a.jsx(lh,{})})})})})})})},h)}function _m(){return a.jsxs(Gt,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[a.jsx(qe,{}),a.jsx("p",{children:"Redirecting"})]})}function bm({redirectURL:e,children:t}){return y.useEffect(()=>{e&&window.location.replace(e)},[e]),e?a.jsx(_m,{}):t}function Cm({provider:e}){const{appName:t}=Ie(),n=`You have successfully connected your ${it(e)} account to ${t}.`;return a.jsx(Jr,{text:n})}function Om({provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,redirectUrl:r,onSuccess:s}){return a.jsx(gi,{provider:e,groupRef:o,children:a.jsx(Gs,{provider:e,consumerRef:t,consumerName:n,groupRef:o,groupName:i,onSuccess:s,children:a.jsx(bm,{redirectURL:r,children:a.jsx(Cm,{provider:e})})})})}const Sm=(e,t)=>{const n=xe(),{projectId:o}=Ie(),{integrations:i}=di(),[r,s]=y.useState(!1),[c,u]=y.useState(null);if(!n||!o)throw new Error("useIsIntegrationInstalled must be used within AmpersandProvider");if(!e)throw new Error("useIsIntegrationInstalled requires an integration name");if(!t)throw new Error("useIsIntegrationInstalled requires a groupRef");const d=y.useMemo(()=>i==null?void 0:i.reduce((p,h)=>(h==null?void 0:h.name)===e?h:p,{}),[i,e]);return y.useEffect(()=>{d&&fe().installationApi.listInstallations({projectIdOrName:o,integrationId:d.id,groupRef:t},{headers:{"x-api-key":n}}).then(p=>{s(!0),u(p.length>0)}).catch(p=>{console.error("Error listing installations."),Ce(p),s(!0)})},[t,n,o,d]),{isLoaded:r,isIntegrationInstalled:c}};exports.AmpersandContext=fi;exports.AmpersandProvider=od;exports.ConnectProvider=Om;exports.FieldMapping=Ss;exports.InstallIntegration=xm;exports.useAmpersandProvider=id;exports.useIsIntegrationInstalled=Sm;
|
|
43
|
+
*/var os;function Af(){return os||(os=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"),c=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),u=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),f=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),h=!1,v=!1,I=!1,C=!1,w=!1,_;_=Symbol.for("react.module.reference");function b(B){return!!(typeof B=="string"||typeof B=="function"||B===n||B===i||w||B===r||B===u||B===d||C||B===p||h||v||I||typeof B=="object"&&B!==null&&(B.$$typeof===m||B.$$typeof===f||B.$$typeof===o||B.$$typeof===s||B.$$typeof===l||B.$$typeof===_||B.getModuleId!==void 0))}function x(B){if(typeof B=="object"&&B!==null){var Ie=B.$$typeof;switch(Ie){case e:var ke=B.type;switch(ke){case n:case i:case r:case u:case d:return ke;default:var qe=ke&&ke.$$typeof;switch(qe){case c:case s:case l:case m:case f:case o:return qe;default:return Ie}}case t:return Ie}}}var O=s,M=o,E=e,V=l,z=n,X=m,Z=f,te=t,q=i,ae=r,re=u,ee=d,pe=!1,he=!1;function N(B){return pe||(pe=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1}function P(B){return he||(he=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1}function L(B){return x(B)===s}function k(B){return x(B)===o}function D(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function A(B){return x(B)===l}function Y(B){return x(B)===n}function G(B){return x(B)===m}function H(B){return x(B)===f}function Q(B){return x(B)===t}function W(B){return x(B)===i}function ce(B){return x(B)===r}function j(B){return x(B)===u}function fe(B){return x(B)===d}we.ContextConsumer=O,we.ContextProvider=M,we.Element=E,we.ForwardRef=V,we.Fragment=z,we.Lazy=X,we.Memo=Z,we.Portal=te,we.Profiler=q,we.StrictMode=ae,we.Suspense=re,we.SuspenseList=ee,we.isAsyncMode=N,we.isConcurrentMode=P,we.isContextConsumer=L,we.isContextProvider=k,we.isElement=D,we.isForwardRef=A,we.isFragment=Y,we.isLazy=G,we.isMemo=H,we.isPortal=Q,we.isProfiler=W,we.isStrictMode=ce,we.isSuspense=j,we.isSuspenseList=fe,we.isValidElementType=b,we.typeOf=x}()),we}process.env.NODE_ENV==="production"?Co.exports=Rf():Co.exports=Af();var is=Co.exports;const ss=e=>typeof e=="object"&&e!=null&&e.nodeType===1,as=(e,t)=>(!t||e!=="hidden")&&e!=="visible"&&e!=="clip",ho=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){const n=getComputedStyle(e,null);return as(n.overflowY,t)||as(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},yr=(e,t,n,r,i,o,s,c)=>o<e&&s>t||o>e&&s<t?0:o<=e&&c<=n||s>=t&&c>=n?o-e-r:s>t&&c<n||o<e&&c>n?s-t+i:0,jf=e=>{const t=e.parentElement;return t??(e.getRootNode().host||null)},Pf=(e,t)=>{var n,r,i,o;if(typeof document>"u")return[];const{scrollMode:s,block:c,inline:l,boundary:u,skipOverflowHiddenElements:d}=t,f=typeof u=="function"?u:re=>re!==u;if(!ss(e))throw new TypeError("Invalid target");const m=document.scrollingElement||document.documentElement,p=[];let h=e;for(;ss(h)&&f(h);){if(h=jf(h),h===m){p.push(h);break}h!=null&&h===document.body&&ho(h)&&!ho(document.documentElement)||h!=null&&ho(h,d)&&p.push(h)}const v=(r=(n=window.visualViewport)==null?void 0:n.width)!=null?r:innerWidth,I=(o=(i=window.visualViewport)==null?void 0:i.height)!=null?o:innerHeight,{scrollX:C,scrollY:w}=window,{height:_,width:b,top:x,right:O,bottom:M,left:E}=e.getBoundingClientRect(),{top:V,right:z,bottom:X,left:Z}=(re=>{const ee=window.getComputedStyle(re);return{top:parseFloat(ee.scrollMarginTop)||0,right:parseFloat(ee.scrollMarginRight)||0,bottom:parseFloat(ee.scrollMarginBottom)||0,left:parseFloat(ee.scrollMarginLeft)||0}})(e);let te=c==="start"||c==="nearest"?x-V:c==="end"?M+X:x+_/2-V+X,q=l==="center"?E+b/2-Z+z:l==="end"?O+z:E-Z;const ae=[];for(let re=0;re<p.length;re++){const ee=p[re],{height:pe,width:he,top:N,right:P,bottom:L,left:k}=ee.getBoundingClientRect();if(s==="if-needed"&&x>=0&&E>=0&&M<=I&&O<=v&&x>=N&&M<=L&&E>=k&&O<=P)return ae;const D=getComputedStyle(ee),A=parseInt(D.borderLeftWidth,10),Y=parseInt(D.borderTopWidth,10),G=parseInt(D.borderRightWidth,10),H=parseInt(D.borderBottomWidth,10);let Q=0,W=0;const ce="offsetWidth"in ee?ee.offsetWidth-ee.clientWidth-A-G:0,j="offsetHeight"in ee?ee.offsetHeight-ee.clientHeight-Y-H:0,fe="offsetWidth"in ee?ee.offsetWidth===0?0:he/ee.offsetWidth:0,B="offsetHeight"in ee?ee.offsetHeight===0?0:pe/ee.offsetHeight:0;if(m===ee)Q=c==="start"?te:c==="end"?te-I:c==="nearest"?yr(w,w+I,I,Y,H,w+te,w+te+_,_):te-I/2,W=l==="start"?q:l==="center"?q-v/2:l==="end"?q-v:yr(C,C+v,v,A,G,C+q,C+q+b,b),Q=Math.max(0,Q+w),W=Math.max(0,W+C);else{Q=c==="start"?te-N-Y:c==="end"?te-L+H+j:c==="nearest"?yr(N,L,pe,Y,H+j,te,te+_,_):te-(N+pe/2)+j/2,W=l==="start"?q-k-A:l==="center"?q-(k+he/2)+ce/2:l==="end"?q-P+G+ce:yr(k,P,he,A,G+ce,q,q+b,b);const{scrollLeft:Ie,scrollTop:ke}=ee;Q=B===0?0:Math.max(0,Math.min(ke+Q/B,ee.scrollHeight-pe/B+j)),W=fe===0?0:Math.max(0,Math.min(Ie+W/fe,ee.scrollWidth-he/fe+ce)),te+=ke-Q,q+=Ie-W}ae.push({el:ee,top:Q,left:W})}return ae};var En=function(){return En=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},En.apply(this,arguments)};var Df=0;function cs(e){return typeof e=="function"?e:at}function at(){}function ma(e,t){if(e){var n=Pf(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 ls(e,t,n){var r=e===t||t instanceof n.Node&&e.contains&&e.contains(t);return r}function Xo(e,t){var n;function r(){n&&clearTimeout(n)}function i(){for(var o=arguments.length,s=new Array(o),c=0;c<o;c++)s[c]=arguments[c];r(),n=setTimeout(function(){n=null,e.apply(void 0,s)},t)}return i.cancel=r,i}function Ke(){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(c){return c&&c.apply(void 0,[r].concat(o)),r.preventDownshiftDefault||r.hasOwnProperty("nativeEvent")&&r.nativeEvent.preventDownshiftDefault})}}function Cn(){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 ga(){return String(Df++)}function kf(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 us(e,t){return e=Array.isArray(e)?e[0]:e,!e&&t?t:e}function va(e){return typeof e.type=="string"}function ya(e){return e.props}function Ff(e,t){console.error('The property "'+t+'" is required in "'+e+'"')}var Mf=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function wr(e){e===void 0&&(e={});var t={};return Mf.forEach(function(n){e.hasOwnProperty(n)&&(t[n]=e[n])}),t}function Nr(e,t){return!e||!t?e:Object.keys(e).reduce(function(n,r){return n[r]=Tr(t,r)?t[r]:e[r],n},{})}function Tr(e,t){return e[t]!==void 0}function So(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&t.indexOf("Arrow")!==0?"Arrow"+t:t}function Lf(e){return Object.prototype.toString.call(e)==="[object Object]"}function mn(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 c=e+t;c<0?c=s:c>s&&(c=0);var l=Nn(c,t<0,n,r,i);return l===-1?e>=o?-1:e:l}function Nn(e,t,n,r,i){i===void 0&&(i=!1);var o=n.length;if(t){for(var s=e;s>=0;s--)if(!r(n[s],s))return s}else for(var c=e;c<o;c++)if(!r(n[c],c))return c;return i?Nn(t?o-1:0,t,n,r):-1}function Rr(e,t,n,r){return r===void 0&&(r=!0),n&&t.some(function(i){return i&&(ls(i,e,n)||r&&ls(i,n.document.activeElement,n))})}var Yo=at;process.env.NODE_ENV!=="production"&&(Yo=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 $f=Xo(function(e){wa(e).textContent=""},500);function wa(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 Ia(e,t){if(!(!e||!t)){var n=wa(t);n.textContent=e,$f(t)}}function Kf(e){var t=e==null?void 0:e.getElementById("a11y-status-message");t&&t.remove()}var xa=process.env.NODE_ENV!=="production"?"__autocomplete_unknown__":0,ba=process.env.NODE_ENV!=="production"?"__autocomplete_mouseup__":1,_a=process.env.NODE_ENV!=="production"?"__autocomplete_item_mouseenter__":2,Cr=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_up__":3,Sr=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_arrow_down__":4,Ca=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_escape__":5,Sa=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_enter__":6,Oa=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_home__":7,Ea=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_end__":8,Na=process.env.NODE_ENV!=="production"?"__autocomplete_click_item__":9,Ta=process.env.NODE_ENV!=="production"?"__autocomplete_blur_input__":10,Ra=process.env.NODE_ENV!=="production"?"__autocomplete_change_input__":11,Aa=process.env.NODE_ENV!=="production"?"__autocomplete_keydown_space_button__":12,Oo=process.env.NODE_ENV!=="production"?"__autocomplete_click_button__":13,ja=process.env.NODE_ENV!=="production"?"__autocomplete_blur_button__":14,Pa=process.env.NODE_ENV!=="production"?"__autocomplete_controlled_prop_updated_selected_item__":15,Da=process.env.NODE_ENV!=="production"?"__autocomplete_touchend__":16,Vf=Object.freeze({__proto__:null,blurButton:ja,blurInput:Ta,changeInput:Ra,clickButton:Oo,clickItem:Na,controlledPropUpdatedSelectedItem:Pa,itemMouseEnter:_a,keyDownArrowDown:Sr,keyDownArrowUp:Cr,keyDownEnd:Ea,keyDownEnter:Sa,keyDownEscape:Ca,keyDownHome:Oa,keyDownSpaceButton:Aa,mouseUp:ba,touchEnd:Da,unknown:xa}),Hf=["refKey","ref"],Bf=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Uf=["onKeyDown","onBlur","onChange","onInput","onChangeText"],qf=["refKey","ref"],Wf=["onMouseMove","onMouseDown","onClick","onPress","index","item"],zf=function(){var e=function(t){function n(i){var o;o=t.call(this,i)||this,o.id=o.props.id||"downshift-"+ga(),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(w){return o.id+"-item-"+w},o.items=[],o.itemCount=null,o.previousResultCount=0,o.timeoutIds=[],o.internalSetTimeout=function(w,_){var b=setTimeout(function(){o.timeoutIds=o.timeoutIds.filter(function(x){return x!==b}),w()},_);o.timeoutIds.push(b)},o.setItemCount=function(w){o.itemCount=w},o.unsetItemCount=function(){o.itemCount=null},o.isItemDisabled=function(w,_){var b=o.getItemNodeFromIndex(_);return b&&b.hasAttribute("disabled")},o.setHighlightedIndex=function(w,_){w===void 0&&(w=o.props.defaultHighlightedIndex),_===void 0&&(_={}),_=wr(_),o.internalSetState(ue({highlightedIndex:w},_))},o.clearSelection=function(w){o.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:o.props.defaultHighlightedIndex,isOpen:o.props.defaultIsOpen},w)},o.selectItem=function(w,_,b){_=wr(_),o.internalSetState(ue({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,selectedItem:w,inputValue:o.props.itemToString(w)},_),b)},o.selectItemAtIndex=function(w,_,b){var x=o.items[w];x!=null&&o.selectItem(x,_,b)},o.selectHighlightedItem=function(w,_){return o.selectItemAtIndex(o.getState().highlightedIndex,w,_)},o.internalSetState=function(w,_){var b,x,O={},M=typeof w=="function";return!M&&w.hasOwnProperty("inputValue")&&o.props.onInputValueChange(w.inputValue,ue({},o.getStateAndHelpers(),w)),o.setState(function(E){var V;E=o.getState(E);var z=M?w(E):w;z=o.props.stateReducer(E,z),b=z.hasOwnProperty("selectedItem");var X={};return b&&z.selectedItem!==E.selectedItem&&(x=z.selectedItem),(V=z).type||(V.type=xa),Object.keys(z).forEach(function(Z){E[Z]!==z[Z]&&(O[Z]=z[Z]),Z!=="type"&&(z[Z],Tr(o.props,Z)||(X[Z]=z[Z]))}),M&&z.hasOwnProperty("inputValue")&&o.props.onInputValueChange(z.inputValue,ue({},o.getStateAndHelpers(),z)),X},function(){cs(_)();var E=Object.keys(O).length>1;E&&o.props.onStateChange(O,o.getStateAndHelpers()),b&&o.props.onSelect(w.selectedItem,o.getStateAndHelpers()),x!==void 0&&o.props.onChange(x,o.getStateAndHelpers()),o.props.onUserAction(O,o.getStateAndHelpers())})},o.rootRef=function(w){return o._rootNode=w},o.getRootProps=function(w,_){var b,x=w===void 0?{}:w,O=x.refKey,M=O===void 0?"ref":O,E=x.ref,V=Ht(x,Hf),z=_===void 0?{}:_,X=z.suppressRefError,Z=X===void 0?!1:X;o.getRootProps.called=!0,o.getRootProps.refKey=M,o.getRootProps.suppressRefError=Z;var te=o.getState(),q=te.isOpen;return ue((b={},b[M]=Cn(E,o.rootRef),b.role="combobox",b["aria-expanded"]=q,b["aria-haspopup"]="listbox",b["aria-owns"]=q?o.menuId:void 0,b["aria-labelledby"]=o.labelId,b),V)},o.keyDownHandlers={ArrowDown:function(_){var b=this;if(_.preventDefault(),this.getState().isOpen){var x=_.shiftKey?5:1;this.moveHighlightedIndex(x,{type:Sr})}else this.internalSetState({isOpen:!0,type:Sr},function(){var O=b.getItemCount();if(O>0){var M=b.getState(),E=M.highlightedIndex,V=mn(E,1,{length:O},b.isItemDisabled,!0);b.setHighlightedIndex(V,{type:Sr})}})},ArrowUp:function(_){var b=this;if(_.preventDefault(),this.getState().isOpen){var x=_.shiftKey?-5:-1;this.moveHighlightedIndex(x,{type:Cr})}else this.internalSetState({isOpen:!0,type:Cr},function(){var O=b.getItemCount();if(O>0){var M=b.getState(),E=M.highlightedIndex,V=mn(E,-1,{length:O},b.isItemDisabled,!0);b.setHighlightedIndex(V,{type:Cr})}})},Enter:function(_){if(_.which!==229){var b=this.getState(),x=b.isOpen,O=b.highlightedIndex;if(x&&O!=null){_.preventDefault();var M=this.items[O],E=this.getItemNodeFromIndex(O);if(M==null||E&&E.hasAttribute("disabled"))return;this.selectHighlightedItem({type:Sa})}}},Escape:function(_){_.preventDefault(),this.reset(ue({type:Ca},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},o.buttonKeyDownHandlers=ue({},o.keyDownHandlers,{" ":function(_){_.preventDefault(),this.toggleMenu({type:Aa})}}),o.inputKeyDownHandlers=ue({},o.keyDownHandlers,{Home:function(_){var b=this.getState(),x=b.isOpen;if(x){_.preventDefault();var O=this.getItemCount();if(!(O<=0||!x)){var M=Nn(0,!1,{length:O},this.isItemDisabled);this.setHighlightedIndex(M,{type:Oa})}}},End:function(_){var b=this.getState(),x=b.isOpen;if(x){_.preventDefault();var O=this.getItemCount();if(!(O<=0||!x)){var M=Nn(O-1,!0,{length:O},this.isItemDisabled);this.setHighlightedIndex(M,{type:Ea})}}}}),o.getToggleButtonProps=function(w){var _=w===void 0?{}:w,b=_.onClick;_.onPress;var x=_.onKeyDown,O=_.onKeyUp,M=_.onBlur,E=Ht(_,Bf),V=o.getState(),z=V.isOpen,X={onClick:Ke(b,o.buttonHandleClick),onKeyDown:Ke(x,o.buttonHandleKeyDown),onKeyUp:Ke(O,o.buttonHandleKeyUp),onBlur:Ke(M,o.buttonHandleBlur)},Z=E.disabled?{}:X;return ue({type:"button",role:"button","aria-label":z?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},Z,E)},o.buttonHandleKeyUp=function(w){w.preventDefault()},o.buttonHandleKeyDown=function(w){var _=So(w);o.buttonKeyDownHandlers[_]&&o.buttonKeyDownHandlers[_].call(o,w)},o.buttonHandleClick=function(w){if(w.preventDefault(),o.props.environment){var _=o.props.environment.document,b=_.body,x=_.activeElement;b&&b===x&&w.target.focus()}process.env.NODE_ENV==="test"?o.toggleMenu({type:Oo}):o.internalSetTimeout(function(){return o.toggleMenu({type:Oo})})},o.buttonHandleBlur=function(w){var _=w.target;o.internalSetTimeout(function(){if(!(o.isMouseDown||!o.props.environment)){var b=o.props.environment.document.activeElement;(b==null||b.id!==o.inputId)&&b!==_&&o.reset({type:ja})}})},o.getLabelProps=function(w){return ue({htmlFor:o.inputId,id:o.labelId},w)},o.getInputProps=function(w){var _=w===void 0?{}:w,b=_.onKeyDown,x=_.onBlur,O=_.onChange,M=_.onInput;_.onChangeText;var E=Ht(_,Uf),V,z={};V="onChange";var X=o.getState(),Z=X.inputValue,te=X.isOpen,q=X.highlightedIndex;if(!E.disabled){var ae;z=(ae={},ae[V]=Ke(O,M,o.inputHandleChange),ae.onKeyDown=Ke(b,o.inputHandleKeyDown),ae.onBlur=Ke(x,o.inputHandleBlur),ae)}return ue({"aria-autocomplete":"list","aria-activedescendant":te&&typeof q=="number"&&q>=0?o.getItemId(q):void 0,"aria-controls":te?o.menuId:void 0,"aria-labelledby":E&&E["aria-label"]?void 0:o.labelId,autoComplete:"off",value:Z,id:o.inputId},z,E)},o.inputHandleKeyDown=function(w){var _=So(w);_&&o.inputKeyDownHandlers[_]&&o.inputKeyDownHandlers[_].call(o,w)},o.inputHandleChange=function(w){o.internalSetState({type:Ra,isOpen:!0,inputValue:w.target.value,highlightedIndex:o.props.defaultHighlightedIndex})},o.inputHandleBlur=function(){o.internalSetTimeout(function(){var w;if(!(o.isMouseDown||!o.props.environment)){var _=o.props.environment.document.activeElement,b=(_==null||(w=_.dataset)==null?void 0:w.toggle)&&o._rootNode&&o._rootNode.contains(_);b||o.reset({type:Ta})}})},o.menuRef=function(w){o._menuNode=w},o.getMenuProps=function(w,_){var b,x=w===void 0?{}:w,O=x.refKey,M=O===void 0?"ref":O,E=x.ref,V=Ht(x,qf),z=_===void 0?{}:_,X=z.suppressRefError,Z=X===void 0?!1:X;return o.getMenuProps.called=!0,o.getMenuProps.refKey=M,o.getMenuProps.suppressRefError=Z,ue((b={},b[M]=Cn(E,o.menuRef),b.role="listbox",b["aria-labelledby"]=V&&V["aria-label"]?void 0:o.labelId,b.id=o.menuId,b),V)},o.getItemProps=function(w){var _,b=w===void 0?{}:w,x=b.onMouseMove,O=b.onMouseDown,M=b.onClick;b.onPress;var E=b.index,V=b.item,z=V===void 0?process.env.NODE_ENV==="production"?void 0:Ff("getItemProps","item"):V,X=Ht(b,Wf);E===void 0?(o.items.push(z),E=o.items.indexOf(z)):o.items[E]=z;var Z="onClick",te=M,q=(_={onMouseMove:Ke(x,function(){E!==o.getState().highlightedIndex&&(o.setHighlightedIndex(E,{type:_a}),o.avoidScrolling=!0,o.internalSetTimeout(function(){return o.avoidScrolling=!1},250))}),onMouseDown:Ke(O,function(re){re.preventDefault()})},_[Z]=Ke(te,function(){o.selectItemAtIndex(E,{type:Na})}),_),ae=X.disabled?{onMouseDown:q.onMouseDown}:q;return ue({id:o.getItemId(E),role:"option","aria-selected":o.getState().highlightedIndex===E},ae,X)},o.clearItems=function(){o.items=[]},o.reset=function(w,_){w===void 0&&(w={}),w=wr(w),o.internalSetState(function(b){var x=b.selectedItem;return ue({isOpen:o.props.defaultIsOpen,highlightedIndex:o.props.defaultHighlightedIndex,inputValue:o.props.itemToString(x)},w)},_)},o.toggleMenu=function(w,_){w===void 0&&(w={}),w=wr(w),o.internalSetState(function(b){var x=b.isOpen;return ue({isOpen:!x},x&&{highlightedIndex:o.props.defaultHighlightedIndex},w)},function(){var b=o.getState(),x=b.isOpen,O=b.highlightedIndex;x&&o.getItemCount()>0&&typeof O=="number"&&o.setHighlightedIndex(O,w),cs(_)()})},o.openMenu=function(w){o.internalSetState({isOpen:!0},w)},o.closeMenu=function(w){o.internalSetState({isOpen:!1},w)},o.updateStatus=Xo(function(){var w;if((w=o.props)!=null&&(w=w.environment)!=null&&w.document){var _=o.getState(),b=o.items[_.highlightedIndex],x=o.getItemCount(),O=o.props.getA11yStatusMessage(ue({itemToString:o.props.itemToString,previousResultCount:o.previousResultCount,resultCount:x,highlightedItem:b},_));o.previousResultCount=x,Ia(O,o.props.environment.document)}},200);var s=o.props,c=s.defaultHighlightedIndex,l=s.initialHighlightedIndex,u=l===void 0?c:l,d=s.defaultIsOpen,f=s.initialIsOpen,m=f===void 0?d:f,p=s.initialInputValue,h=p===void 0?"":p,v=s.initialSelectedItem,I=v===void 0?null:v,C=o.getState({highlightedIndex:u,isOpen:m,inputValue:h,selectedItem:I});return C.selectedItem!=null&&o.props.initialInputValue===void 0&&(C.inputValue=o.props.itemToString(C.selectedItem)),o.state=C,o}If(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),Nr(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 c=this.getItemCount(),l=this.getState(),u=l.highlightedIndex;if(c>0){var d=mn(u,o,{length:c},this.isItemDisabled,!0);this.setHighlightedIndex(d,s)}},r.getStateAndHelpers=function(){var o=this.getState(),s=o.highlightedIndex,c=o.inputValue,l=o.selectedItem,u=o.isOpen,d=this.props.itemToString,f=this.id,m=this.getRootProps,p=this.getToggleButtonProps,h=this.getLabelProps,v=this.getMenuProps,I=this.getInputProps,C=this.getItemProps,w=this.openMenu,_=this.closeMenu,b=this.toggleMenu,x=this.selectItem,O=this.selectItemAtIndex,M=this.selectHighlightedItem,E=this.setHighlightedIndex,V=this.clearSelection,z=this.clearItems,X=this.reset,Z=this.setItemCount,te=this.unsetItemCount,q=this.internalSetState;return{getRootProps:m,getToggleButtonProps:p,getLabelProps:h,getMenuProps:v,getInputProps:I,getItemProps:C,reset:X,openMenu:w,closeMenu:_,toggleMenu:b,selectItem:x,selectItemAtIndex:O,selectHighlightedItem:M,setHighlightedIndex:E,clearSelection:V,clearItems:z,setItemCount:Z,unsetItemCount:te,setState:q,itemToString:d,id:f,highlightedIndex:s,inputValue:c,isOpen:u,selectedItem:l}},r.componentDidMount=function(){var o=this;if(process.env.NODE_ENV!=="production"&&this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&ds(this._menuNode,this.getMenuProps),!this.props.environment)this.cleanup=function(){o.internalClearTimeouts()};else{var s=function(){o.isMouseDown=!0},c=function(p){o.isMouseDown=!1;var h=Rr(p.target,[o._rootNode,o._menuNode],o.props.environment);!h&&o.getState().isOpen&&o.reset({type:ba},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},l=function(){o.isTouchMove=!1},u=function(){o.isTouchMove=!0},d=function(p){var h=Rr(p.target,[o._rootNode,o._menuNode],o.props.environment,!1);!o.isTouchMove&&!h&&o.getState().isOpen&&o.reset({type:Da},function(){return o.props.onOuterClick(o.getStateAndHelpers())})},f=this.props.environment;f.addEventListener("mousedown",s),f.addEventListener("mouseup",c),f.addEventListener("touchstart",l),f.addEventListener("touchmove",u),f.addEventListener("touchend",d),this.cleanup=function(){o.internalClearTimeouts(),o.updateStatus.cancel(),f.removeEventListener("mousedown",s),f.removeEventListener("mouseup",c),f.removeEventListener("touchstart",l),f.removeEventListener("touchmove",u),f.removeEventListener("touchend",d)}}},r.shouldScroll=function(o,s){var c=this.props.highlightedIndex===void 0?this.getState():this.props,l=c.highlightedIndex,u=s.highlightedIndex===void 0?o:s,d=u.highlightedIndex,f=l&&this.getState().isOpen&&!o.isOpen,m=l!==d;return f||m},r.componentDidUpdate=function(o,s){process.env.NODE_ENV!=="production"&&(Yo(this.state,o,this.props),this.getMenuProps.called&&!this.getMenuProps.suppressRefError&&ds(this._menuNode,this.getMenuProps)),Tr(this.props,"selectedItem")&&this.props.selectedItemChanged(o.selectedItem,this.props.selectedItem)&&this.internalSetState({type:Pa,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=us(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=us(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&&Jf(s,this.getRootProps),s;if(va(s))return g.cloneElement(s,this.getRootProps(ya(s)));if(process.env.NODE_ENV!=="production")throw new Error("downshift: If you return a non-DOM element, you must apply the getRootProps function")},n}(g.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:kf,itemToString:function(n){return n==null?"":(process.env.NODE_ENV!=="production"&&Lf(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:ma},e.stateChangeTypes=Vf,e}();process.env.NODE_ENV!=="production"&&(zf.propTypes={children:F.func,defaultHighlightedIndex:F.number,defaultIsOpen:F.bool,initialHighlightedIndex:F.number,initialSelectedItem:F.any,initialInputValue:F.string,initialIsOpen:F.bool,getA11yStatusMessage:F.func,itemToString:F.func,onChange:F.func,onSelect:F.func,onStateChange:F.func,onInputValueChange:F.func,onUserAction:F.func,onOuterClick:F.func,selectedItemChanged:F.func,stateReducer:F.func,itemCount:F.number,id:F.string,environment:F.shape({addEventListener:F.func.isRequired,removeEventListener:F.func.isRequired,document:F.shape({createElement:F.func.isRequired,getElementById:F.func.isRequired,activeElement:F.any.isRequired,body:F.any.isRequired}).isRequired,Node:F.func.isRequired}),suppressRefError:F.bool,scrollIntoView:F.func,selectedItem:F.any,isOpen:F.bool,inputValue:F.string,highlightedIndex:F.number,labelId:F.string,inputId:F.string,menuId:F.string,getItemId:F.func});function ds(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 Jf(e,t){var n=t.refKey,r=n!=="ref",i=!va(e);i&&!r&&!is.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+'"'),!is.isForwardRef(e)&&!ya(e)[n]&&console.error('downshift: You must apply the ref prop "'+n+'" from getRootProps onto your root element.')}var ka={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Xf(e,t,n){var r=e.props,i=e.type,o={};Object.keys(t).forEach(function(s){Yf(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 Yf(e,t,n,r){var i=t.props,o=t.type,s="on"+Go(e)+"Change";i[s]&&r[e]!==void 0&&r[e]!==n[e]&&i[s](ue({type:o},r))}function Gf(e,t){return t.changes}var ps=Xo(function(e,t){Ia(e,t)},200),Zf=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?g.useLayoutEffect:g.useEffect,Qf="useId"in g?function(t){var n=t.id,r=t.labelId,i=t.menuId,o=t.getItemId,s=t.toggleButtonId,c=t.inputId,l="downshift-"+g.useId();n||(n=l);var u=g.useRef({labelId:r||n+"-label",menuId:i||n+"-menu",getItemId:o||function(d){return n+"-item-"+d},toggleButtonId:s||n+"-toggle-button",inputId:c||n+"-input"});return u.current}:function(t){var n=t.id,r=n===void 0?"downshift-"+ga():n,i=t.labelId,o=t.menuId,s=t.getItemId,c=t.toggleButtonId,l=t.inputId,u=g.useRef({labelId:i||r+"-label",menuId:o||r+"-menu",getItemId:s||function(d){return r+"-item-"+d},toggleButtonId:c||r+"-toggle-button",inputId:l||r+"-input"});return u.current};function eh(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 Go(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Fa(e){var t=g.useRef(e);return t.current=e,t}function th(e,t,n,r){var i=g.useRef(),o=g.useRef(),s=g.useCallback(function(p,h){o.current=h,p=Nr(p,h.props);var v=e(p,h),I=h.props.stateReducer(p,ue({},h,{changes:v}));return I},[e]),c=g.useReducer(s,t,n),l=c[0],u=c[1],d=Fa(t),f=g.useCallback(function(p){return u(ue({props:d.current},p))},[d]),m=o.current;return g.useEffect(function(){var p=Nr(i.current,m==null?void 0:m.props),h=m&&i.current&&!r(p,l);h&&Xf(m,p,l),i.current=l},[l,m,r]),[l,f]}var qn={itemToString:function(t){return t?String(t):""},itemToKey:function(t){return t},stateReducer:Gf,scrollIntoView:ma,environment:typeof window>"u"?void 0:window};function Qt(e,t,n){n===void 0&&(n=ka);var r=e["default"+Go(t)];return r!==void 0?r:n[t]}function Wn(e,t,n){n===void 0&&(n=ka);var r=e[t];if(r!==void 0)return r;var i=e["initial"+Go(t)];return i!==void 0?i:Qt(e,t,n)}function nh(e){var t=Wn(e,"selectedItem"),n=Wn(e,"isOpen"),r=ah(e),i=Wn(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 zn(e,t,n){var r=e.items,i=e.initialHighlightedIndex,o=e.defaultHighlightedIndex,s=e.isItemDisabled,c=e.itemToKey,l=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:l?r.findIndex(function(d){return c(l)===c(d)}):n<0&&!s(r[r.length-1],r.length-1)?r.length-1:n>0&&!s(r[0],0)?0:-1}function rh(e,t,n){var r=g.useRef({isMouseDown:!1,isTouchMove:!1,isTouchEnd:!1});return g.useEffect(function(){if(!e)return at;var i=n.map(function(d){return d.current});function o(){r.current.isTouchEnd=!1,r.current.isMouseDown=!0}function s(d){r.current.isMouseDown=!1,Rr(d.target,i,e)||t()}function c(){r.current.isTouchEnd=!1,r.current.isTouchMove=!1}function l(){r.current.isTouchMove=!0}function u(d){r.current.isTouchEnd=!0,!r.current.isTouchMove&&!Rr(d.target,i,e,!1)&&t()}return e.addEventListener("mousedown",o),e.addEventListener("mouseup",s),e.addEventListener("touchstart",c),e.addEventListener("touchmove",l),e.addEventListener("touchend",u),function(){e.removeEventListener("mousedown",o),e.removeEventListener("mouseup",s),e.removeEventListener("touchstart",c),e.removeEventListener("touchmove",l),e.removeEventListener("touchend",u)}},[n,e,t]),r.current}var Ma=function(){return at};process.env.NODE_ENV!=="production"&&(Ma=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];var i=g.useRef(n.reduce(function(s,c){return s[c]={},s},{}));g.useEffect(function(){Object.keys(i.current).forEach(function(s){var c=i.current[s];if(!Object.keys(c).length){console.error("downshift: You forgot to call the "+s+" getter function on your component / element.");return}var l=c.suppressRefError,u=c.refKey,d=c.elementRef;l||d!=null&&d.current||console.error('downshift: The ref prop "'+u+'" from '+s+" was not applied correctly on your element.")})},[]);var o=g.useCallback(function(s,c,l,u){i.current[s]={suppressRefError:c,refKey:l,elementRef:u}},[]);return o});function oh(e,t,n,r){r===void 0&&(r={});var i=r.document,o=Ur();g.useEffect(function(){if(!(!e||o||!i)){var s=e(t);ps(s,i)}},n),g.useEffect(function(){return function(){ps.cancel(),Kf(i)}},[i])}function ih(e){var t=e.highlightedIndex,n=e.isOpen,r=e.itemRefs,i=e.getItemNodeFromIndex,o=e.menuElement,s=e.scrollIntoView,c=g.useRef(!0);return Zf(function(){t<0||!n||!Object.keys(r.current).length||(c.current===!1?c.current=!0:s(i(t),o))},[t]),c}var La=at;process.env.NODE_ENV!=="production"&&(La=function(t){var n=t.props,r=t.state,i=g.useRef(n),o=Ur();g.useEffect(function(){o||(Yo(r,i.current,n),i.current=n)},[r,n,o])});function fs(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:Qt(e,"isOpen"),highlightedIndex:Qt(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}function sh(e,t){return e.isOpen===t.isOpen&&e.inputValue===t.inputValue&&e.highlightedIndex===t.highlightedIndex&&e.selectedItem===t.selectedItem}function Ur(){var e=g.useRef(!0);return g.useEffect(function(){return e.current=!1,function(){e.current=!0}},[]),e.current}function Eo(e){var t=Qt(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}function ah(e){var t=Wn(e,"highlightedIndex");return t>-1&&e.isItemDisabled(e.items[t],t)?-1:t}var Or={environment:F.shape({addEventListener:F.func.isRequired,removeEventListener:F.func.isRequired,document:F.shape({createElement:F.func.isRequired,getElementById:F.func.isRequired,activeElement:F.any.isRequired,body:F.any.isRequired}).isRequired,Node:F.func.isRequired}),itemToString:F.func,itemToKey:F.func,stateReducer:F.func},$a=ue({},Or,{getA11yStatusMessage:F.func,highlightedIndex:F.number,defaultHighlightedIndex:F.number,initialHighlightedIndex:F.number,isOpen:F.bool,defaultIsOpen:F.bool,initialIsOpen:F.bool,selectedItem:F.any,initialSelectedItem:F.any,defaultSelectedItem:F.any,id:F.string,labelId:F.string,menuId:F.string,getItemId:F.func,toggleButtonId:F.string,onSelectedItemChange:F.func,onHighlightedIndexChange:F.func,onStateChange:F.func,onIsOpenChange:F.func,scrollIntoView:F.func});function ch(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:zn(i,e,0)};break;case n.FunctionOpenMenu:o={isOpen:!0,highlightedIndex:zn(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:Eo(i),isOpen:Qt(i,"isOpen"),selectedItem:Qt(i,"selectedItem"),inputValue:Qt(i,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return ue({},e,o)}En(En({},$a),{items:F.array.isRequired,isItemDisabled:F.func});En(En({},qn),{isItemDisabled:function(){return!1}});process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;process.env.NODE_ENV;var Zo=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_down__":0,Qo=process.env.NODE_ENV!=="production"?"__input_keydown_arrow_up__":1,ei=process.env.NODE_ENV!=="production"?"__input_keydown_escape__":2,ti=process.env.NODE_ENV!=="production"?"__input_keydown_home__":3,ni=process.env.NODE_ENV!=="production"?"__input_keydown_end__":4,ri=process.env.NODE_ENV!=="production"?"__input_keydown_page_up__":5,oi=process.env.NODE_ENV!=="production"?"__input_keydown_page_down__":6,ii=process.env.NODE_ENV!=="production"?"__input_keydown_enter__":7,si=process.env.NODE_ENV!=="production"?"__input_change__":8,Ar=process.env.NODE_ENV!=="production"?"__input_blur__":9,ai=process.env.NODE_ENV!=="production"?"__input_click__":10,Ka=process.env.NODE_ENV!=="production"?"__menu_mouse_leave__":11,Va=process.env.NODE_ENV!=="production"?"__item_mouse_move__":12,ci=process.env.NODE_ENV!=="production"?"__item_click__":13,Ha=process.env.NODE_ENV!=="production"?"__togglebutton_click__":14,Ba=process.env.NODE_ENV!=="production"?"__function_toggle_menu__":15,Ua=process.env.NODE_ENV!=="production"?"__function_open_menu__":16,qa=process.env.NODE_ENV!=="production"?"__function_close_menu__":17,Wa=process.env.NODE_ENV!=="production"?"__function_set_highlighted_index__":18,li=process.env.NODE_ENV!=="production"?"__function_select_item__":19,za=process.env.NODE_ENV!=="production"?"__function_set_input_value__":20,Ja=process.env.NODE_ENV!=="production"?"__function_reset__":21,ui=process.env.NODE_ENV!=="production"?"__controlled_prop_updated_selected_item__":22,Xa=Object.freeze({__proto__:null,ControlledPropUpdatedSelectedItem:ui,FunctionCloseMenu:qa,FunctionOpenMenu:Ua,FunctionReset:Ja,FunctionSelectItem:li,FunctionSetHighlightedIndex:Wa,FunctionSetInputValue:za,FunctionToggleMenu:Ba,InputBlur:Ar,InputChange:si,InputClick:ai,InputKeyDownArrowDown:Zo,InputKeyDownArrowUp:Qo,InputKeyDownEnd:ni,InputKeyDownEnter:ii,InputKeyDownEscape:ei,InputKeyDownHome:ti,InputKeyDownPageDown:oi,InputKeyDownPageUp:ri,ItemClick:ci,ItemMouseMove:Va,MenuMouseLeave:Ka,ToggleButtonClick:Ha});function lh(e){var t=nh(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 uh=ue({},$a,{items:F.array.isRequired,isItemDisabled:F.func,inputValue:F.string,defaultInputValue:F.string,initialInputValue:F.string,inputId:F.string,onInputValueChange:F.func});function dh(e,t,n,r){var i=g.useRef(),o=th(e,t,n,r),s=o[0],c=o[1],l=Ur();return g.useEffect(function(){if(Tr(t,"selectedItem")){if(!l){var u=t.itemToKey(t.selectedItem)!==t.itemToKey(i.current);u&&c({type:ui,inputValue:t.itemToString(t.selectedItem)})}i.current=s.selectedItem===i.current?t.selectedItem:s.selectedItem}},[s.selectedItem,t.selectedItem]),[Nr(s,t),c]}var Ya=at;process.env.NODE_ENV!=="production"&&(Ya=function(t,n){F.checkPropTypes(uh,t,"prop",n.name)});var ph=ue({},qn,{isItemDisabled:function(){return!1}});function fh(e,t){var n,r=t.type,i=t.props,o=t.altKey,s;switch(r){case ci:s={isOpen:Qt(i,"isOpen"),highlightedIndex:Eo(i),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case Zo:e.isOpen?s={highlightedIndex:mn(e.highlightedIndex,1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:o&&e.selectedItem==null?-1:zn(i,e,1),isOpen:i.items.length>=0};break;case Qo:e.isOpen?o?s=fs(i,e.highlightedIndex):s={highlightedIndex:mn(e.highlightedIndex,-1,i.items,i.isItemDisabled,!0)}:s={highlightedIndex:zn(i,e,-1),isOpen:i.items.length>=0};break;case ii:s=fs(i,e.highlightedIndex);break;case ei:s=ue({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case ri:s={highlightedIndex:mn(e.highlightedIndex,-10,i.items,i.isItemDisabled,!0)};break;case oi:s={highlightedIndex:mn(e.highlightedIndex,10,i.items,i.isItemDisabled,!0)};break;case ti:s={highlightedIndex:Nn(0,!1,i.items,i.isItemDisabled)};break;case ni:s={highlightedIndex:Nn(i.items.length-1,!0,i.items,i.isItemDisabled)};break;case Ar:s=ue({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&((n=i.items)==null?void 0:n.length)&&t.selectItem&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])});break;case si:s={isOpen:!0,highlightedIndex:Eo(i),inputValue:t.inputValue};break;case ai:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:zn(i,e,0)};break;case li:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case ui:s={inputValue:t.inputValue};break;default:return ch(e,t,Xa)}return ue({},e,s)}var hh=["onMouseLeave","refKey","ref"],mh=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],gh=["onClick","onPress","refKey","ref"],vh=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];di.stateChangeTypes=Xa;function di(e){e===void 0&&(e={}),Ya(e,di);var t=ue({},ph,e),n=t.items,r=t.scrollIntoView,i=t.environment,o=t.getA11yStatusMessage,s=dh(fh,t,lh,sh),c=s[0],l=s[1],u=c.isOpen,d=c.highlightedIndex,f=c.selectedItem,m=c.inputValue,p=g.useRef(null),h=g.useRef({}),v=g.useRef(null),I=g.useRef(null),C=Ur(),w=Qf(t),_=g.useRef(),b=Fa({state:c,props:t}),x=g.useCallback(function(L){return h.current[w.getItemId(L)]},[w]);oh(o,c,[u,d,f,m],i);var O=ih({menuElement:p.current,highlightedIndex:d,isOpen:u,itemRefs:h,scrollIntoView:r,getItemNodeFromIndex:x});La({props:t,state:c}),g.useEffect(function(){var L=Wn(t,"isOpen");L&&v.current&&v.current.focus()},[]),g.useEffect(function(){C||(_.current=n.length)});var M=rh(i,g.useCallback(function(){b.current.state.isOpen&&l({type:Ar,selectItem:!1})},[l,b]),g.useMemo(function(){return[p,I,v]},[p.current,I.current,v.current])),E=Ma("getInputProps","getMenuProps");g.useEffect(function(){u||(h.current={})},[u]),g.useEffect(function(){var L;!u||!(i!=null&&i.document)||!(v!=null&&(L=v.current)!=null&&L.focus)||i.document.activeElement!==v.current&&v.current.focus()},[u,i]);var V=g.useMemo(function(){return{ArrowDown:function(k){k.preventDefault(),l({type:Zo,altKey:k.altKey})},ArrowUp:function(k){k.preventDefault(),l({type:Qo,altKey:k.altKey})},Home:function(k){b.current.state.isOpen&&(k.preventDefault(),l({type:ti}))},End:function(k){b.current.state.isOpen&&(k.preventDefault(),l({type:ni}))},Escape:function(k){var D=b.current.state;(D.isOpen||D.inputValue||D.selectedItem||D.highlightedIndex>-1)&&(k.preventDefault(),l({type:ei}))},Enter:function(k){var D=b.current.state;!D.isOpen||k.which===229||(k.preventDefault(),l({type:ii}))},PageUp:function(k){b.current.state.isOpen&&(k.preventDefault(),l({type:ri}))},PageDown:function(k){b.current.state.isOpen&&(k.preventDefault(),l({type:oi}))}}},[l,b]),z=g.useCallback(function(L){return ue({id:w.labelId,htmlFor:w.inputId},L)},[w]),X=g.useCallback(function(L,k){var D,A=L===void 0?{}:L,Y=A.onMouseLeave,G=A.refKey,H=G===void 0?"ref":G,Q=A.ref,W=Ht(A,hh),ce=k===void 0?{}:k,j=ce.suppressRefError,fe=j===void 0?!1:j;return E("getMenuProps",fe,H,p),ue((D={},D[H]=Cn(Q,function(B){p.current=B}),D.id=w.menuId,D.role="listbox",D["aria-labelledby"]=W&&W["aria-label"]?void 0:""+w.labelId,D.onMouseLeave=Ke(Y,function(){l({type:Ka})}),D),W)},[l,E,w]),Z=g.useCallback(function(L){var k,D,A=L===void 0?{}:L,Y=A.item,G=A.index,H=A.refKey,Q=H===void 0?"ref":H,W=A.ref,ce=A.onMouseMove,j=A.onMouseDown,fe=A.onClick;A.onPress;var B=A.disabled,Ie=Ht(A,mh);B!==void 0&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var ke=b.current,qe=ke.props,Fe=ke.state,me=eh(Y,G,qe.items,"Pass either item or index to getItemProps!"),wt=me[0],We=me[1],ot=qe.isItemDisabled(wt,We),It="onClick",xt=fe,ze=function(){M.isTouchEnd||We===Fe.highlightedIndex||(O.current=!1,l({type:Va,index:We,disabled:ot}))},He=function(){l({type:ci,index:We})},Me=function(bt){return bt.preventDefault()};return ue((k={},k[Q]=Cn(W,function(Oe){Oe&&(h.current[w.getItemId(We)]=Oe)}),k["aria-disabled"]=ot,k["aria-selected"]=We===Fe.highlightedIndex,k.id=w.getItemId(We),k.role="option",k),!ot&&(D={},D[It]=Ke(xt,He),D),{onMouseMove:Ke(ce,ze),onMouseDown:Ke(j,Me)},Ie)},[l,w,b,M,O]),te=g.useCallback(function(L){var k,D=L===void 0?{}:L,A=D.onClick;D.onPress;var Y=D.refKey,G=Y===void 0?"ref":Y,H=D.ref,Q=Ht(D,gh),W=b.current.state,ce=function(){l({type:Ha})};return ue((k={},k[G]=Cn(H,function(j){I.current=j}),k["aria-controls"]=w.menuId,k["aria-expanded"]=W.isOpen,k.id=w.toggleButtonId,k.tabIndex=-1,k),!Q.disabled&&ue({},{onClick:Ke(A,ce)}),Q)},[l,b,w]),q=g.useCallback(function(L,k){var D,A=L===void 0?{}:L,Y=A.onKeyDown,G=A.onChange,H=A.onInput,Q=A.onBlur;A.onChangeText;var W=A.onClick,ce=A.refKey,j=ce===void 0?"ref":ce,fe=A.ref,B=Ht(A,vh),Ie=k===void 0?{}:k,ke=Ie.suppressRefError,qe=ke===void 0?!1:ke;E("getInputProps",qe,j,v);var Fe=b.current.state,me=function(Me){var Oe=So(Me);Oe&&V[Oe]&&V[Oe](Me)},wt=function(Me){l({type:si,inputValue:Me.target.value})},We=function(Me){if(i!=null&&i.document&&Fe.isOpen&&!M.isMouseDown){var Oe=Me.relatedTarget===null&&i.document.activeElement!==i.document.body;l({type:Ar,selectItem:!Oe})}},ot=function(){l({type:ai})},It="onChange",xt={};if(!B.disabled){var ze;xt=(ze={},ze[It]=Ke(G,H,wt),ze.onKeyDown=Ke(Y,me),ze.onBlur=Ke(Q,We),ze.onClick=Ke(W,ot),ze)}return ue((D={},D[j]=Cn(fe,function(He){v.current=He}),D["aria-activedescendant"]=Fe.isOpen&&Fe.highlightedIndex>-1?w.getItemId(Fe.highlightedIndex):"",D["aria-autocomplete"]="list",D["aria-controls"]=w.menuId,D["aria-expanded"]=Fe.isOpen,D["aria-labelledby"]=B&&B["aria-label"]?void 0:w.labelId,D.autoComplete="off",D.id=w.inputId,D.role="combobox",D.value=Fe.inputValue,D),xt,B)},[l,w,i,V,b,M,E]),ae=g.useCallback(function(){l({type:Ba})},[l]),re=g.useCallback(function(){l({type:qa})},[l]),ee=g.useCallback(function(){l({type:Ua})},[l]),pe=g.useCallback(function(L){l({type:Wa,highlightedIndex:L})},[l]),he=g.useCallback(function(L){l({type:li,selectedItem:L})},[l]),N=g.useCallback(function(L){l({type:za,inputValue:L})},[l]),P=g.useCallback(function(){l({type:Ja})},[l]);return{getItemProps:Z,getLabelProps:z,getMenuProps:X,getInputProps:q,getToggleButtonProps:te,toggleMenu:ae,openMenu:ee,closeMenu:re,setHighlightedIndex:pe,setInputValue:N,selectItem:he,reset:P,highlightedIndex:d,isOpen:u,selectedItem:f,inputValue:m}}Or.stateReducer,Or.itemToKey,Or.environment,F.array,F.array,F.array,F.func,F.number,F.number,F.number,F.func,F.func,F.string,F.string;qn.itemToKey,qn.stateReducer,qn.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 yh="_comboboxContainer_12y8e_1",wh="_label_12y8e_8",Ih="_inputContainer_12y8e_12",xh="_input_12y8e_12",bh="_toggleButton_12y8e_25",_h="_menu_12y8e_30",Ch="_menuItem_12y8e_43",Sh="_highlighted_12y8e_50",Oh="_selected_12y8e_54",Eh="_hidden_12y8e_58",Vt={comboboxContainer:yh,label:wh,inputContainer:Ih,input:xh,toggleButton:bh,menu:_h,menuItem:Ch,highlighted:Sh,selected:Oh,hidden:Eh};function Nh(e){const t=e.toLowerCase();return function(r){return!e||r.label.toLowerCase().includes(t)||r.value.toLowerCase().includes(t)}}function Th({items:e,selectedValue:t,onSelectedItemChange:n,placeholder:r}){const[i,o]=g.useState(e);g.useEffect(()=>o(e),[e]);const s=p=>{o(e.filter(Nh(p)))},{isOpen:c,getToggleButtonProps:l,getMenuProps:u,getInputProps:d,highlightedIndex:f,getItemProps:m}=di({items:i,selectedItem:t?e.find(p=>p.value===t):null,itemToString:p=>(p==null?void 0:p.label)||"",onInputValueChange:({inputValue:p})=>s(p),onSelectedItemChange:({selectedItem:p})=>n(p)});return a.jsxs("div",{children:[a.jsx("div",{className:Vt.comboboxContainer,children:a.jsxs("div",{className:Vt.inputContainer,children:[a.jsx("input",{placeholder:r,className:Vt.input,...d()}),a.jsx("button",{"aria-label":"toggle menu",className:Vt.toggleButton,type:"button",...l(),children:c?a.jsx(a.Fragment,{children:"↑"}):a.jsx(a.Fragment,{children:"↓"})})]})}),a.jsx("ul",{className:`${Vt.menu} ${c&&e.length?"":Vt.hidden}`,...u(),children:c&&i.map((p,h)=>a.jsx("li",{className:`${Vt.menuItem} ${f===h?Vt.highlighted:""} ${t===(p==null?void 0:p.value)?Vt.selected:""}`,...m({item:p,index:h}),children:a.jsx("span",{children:p.label})},p.id))})]})}const Tn=Math.min,gn=Math.max,jr=Math.round,Ir=Math.floor,nn=e=>({x:e,y:e}),Rh={left:"right",right:"left",bottom:"top",top:"bottom"},Ah={start:"end",end:"start"};function No(e,t,n){return gn(e,Tn(t,n))}function er(e,t){return typeof e=="function"?e(t):e}function vn(e){return e.split("-")[0]}function tr(e){return e.split("-")[1]}function Ga(e){return e==="x"?"y":"x"}function pi(e){return e==="y"?"height":"width"}function Rn(e){return["top","bottom"].includes(vn(e))?"y":"x"}function fi(e){return Ga(Rn(e))}function jh(e,t,n){n===void 0&&(n=!1);const r=tr(e),i=fi(e),o=pi(i);let s=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Pr(s)),[s,Pr(s)]}function Ph(e){const t=Pr(e);return[To(e),t,To(t)]}function To(e){return e.replace(/start|end/g,t=>Ah[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 kh(e,t,n,r){const i=tr(e);let o=Dh(vn(e),n==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(To)))),o}function Pr(e){return e.replace(/left|right|bottom|top/g,t=>Rh[t])}function Fh(e){return{top:0,right:0,bottom:0,left:0,...e}}function Za(e){return typeof e!="number"?Fh(e):{top:e,right:e,bottom:e,left:e}}function Dr(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 hs(e,t,n){let{reference:r,floating:i}=e;const o=Rn(t),s=fi(t),c=pi(s),l=vn(t),u=o==="y",d=r.x+r.width/2-i.width/2,f=r.y+r.height/2-i.height/2,m=r[c]/2-i[c]/2;let p;switch(l){case"top":p={x:d,y:r.y-i.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:f};break;case"left":p={x:r.x-i.width,y:f};break;default:p={x:r.x,y:r.y}}switch(tr(t)){case"start":p[s]-=m*(n&&u?-1:1);break;case"end":p[s]+=m*(n&&u?-1:1);break}return p}const Mh=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=n,c=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:f}=hs(u,r,l),m=r,p={},h=0;for(let v=0;v<c.length;v++){const{name:I,fn:C}=c[v],{x:w,y:_,data:b,reset:x}=await C({x:d,y:f,initialPlacement:r,placement:m,strategy:i,middlewareData:p,rects:u,platform:s,elements:{reference:e,floating:t}});d=w??d,f=_??f,p={...p,[I]:{...p[I],...b}},x&&h<=50&&(h++,typeof x=="object"&&(x.placement&&(m=x.placement),x.rects&&(u=x.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:d,y:f}=hs(u,m,l)),v=-1)}return{x:d,y:f,placement:m,strategy:i,middlewareData:p}};async function Qa(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:o,rects:s,elements:c,strategy:l}=e,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:m=!1,padding:p=0}=er(t,e),h=Za(p),I=c[m?f==="floating"?"reference":"floating":f],C=Dr(await o.getClippingRect({element:(n=await(o.isElement==null?void 0:o.isElement(I)))==null||n?I:I.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(c.floating)),boundary:u,rootBoundary:d,strategy:l})),w=f==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c.floating)),b=await(o.isElement==null?void 0:o.isElement(_))?await(o.getScale==null?void 0:o.getScale(_))||{x:1,y:1}:{x:1,y:1},x=Dr(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:w,offsetParent:_,strategy:l}):w);return{top:(C.top-x.top+h.top)/b.y,bottom:(x.bottom-C.bottom+h.bottom)/b.y,left:(C.left-x.left+h.left)/b.x,right:(x.right-C.right+h.right)/b.x}}const Lh=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:o,platform:s,elements:c,middlewareData:l}=t,{element:u,padding:d=0}=er(e,t)||{};if(u==null)return{};const f=Za(d),m={x:n,y:r},p=fi(i),h=pi(p),v=await s.getDimensions(u),I=p==="y",C=I?"top":"left",w=I?"bottom":"right",_=I?"clientHeight":"clientWidth",b=o.reference[h]+o.reference[p]-m[p]-o.floating[h],x=m[p]-o.reference[p],O=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let M=O?O[_]:0;(!M||!await(s.isElement==null?void 0:s.isElement(O)))&&(M=c.floating[_]||o.floating[h]);const E=b/2-x/2,V=M/2-v[h]/2-1,z=Tn(f[C],V),X=Tn(f[w],V),Z=z,te=M-v[h]-X,q=M/2-v[h]/2+E,ae=No(Z,q,te),re=!l.arrow&&tr(i)!=null&&q!==ae&&o.reference[h]/2-(q<Z?z:X)-v[h]/2<0,ee=re?q<Z?q-Z:q-te:0;return{[p]:m[p]+ee,data:{[p]:ae,centerOffset:q-ae-ee,...re&&{alignmentOffset:ee}},reset:re}}}),$h=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:c,platform:l,elements:u}=t,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:m,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:v=!0,...I}=er(e,t);if((n=o.arrow)!=null&&n.alignmentOffset)return{};const C=vn(i),w=Rn(c),_=vn(c)===c,b=await(l.isRTL==null?void 0:l.isRTL(u.floating)),x=m||(_||!v?[Pr(c)]:Ph(c)),O=h!=="none";!m&&O&&x.push(...kh(c,v,h,b));const M=[c,...x],E=await Qa(t,I),V=[];let z=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&V.push(E[C]),f){const q=jh(i,s,b);V.push(E[q[0]],E[q[1]])}if(z=[...z,{placement:i,overflows:V}],!V.every(q=>q<=0)){var X,Z;const q=(((X=o.flip)==null?void 0:X.index)||0)+1,ae=M[q];if(ae)return{data:{index:q,overflows:z},reset:{placement:ae}};let re=(Z=z.filter(ee=>ee.overflows[0]<=0).sort((ee,pe)=>ee.overflows[1]-pe.overflows[1])[0])==null?void 0:Z.placement;if(!re)switch(p){case"bestFit":{var te;const ee=(te=z.filter(pe=>{if(O){const he=Rn(pe.placement);return he===w||he==="y"}return!0}).map(pe=>[pe.placement,pe.overflows.filter(he=>he>0).reduce((he,N)=>he+N,0)]).sort((pe,he)=>pe[1]-he[1])[0])==null?void 0:te[0];ee&&(re=ee);break}case"initialPlacement":re=c;break}if(i!==re)return{reset:{placement:re}}}return{}}}};async function Kh(e,t){const{placement:n,platform:r,elements:i}=e,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=vn(n),c=tr(n),l=Rn(n)==="y",u=["left","top"].includes(s)?-1:1,d=o&&l?-1:1,f=er(t,e);let{mainAxis:m,crossAxis:p,alignmentAxis:h}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return c&&typeof h=="number"&&(p=c==="end"?h*-1:h),l?{x:p*d,y:m*u}:{x:m*u,y:p*d}}const Vh=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:c}=t,l=await Kh(t,e);return s===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},Hh=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:c={fn:I=>{let{x:C,y:w}=I;return{x:C,y:w}}},...l}=er(e,t),u={x:n,y:r},d=await Qa(t,l),f=Rn(vn(i)),m=Ga(f);let p=u[m],h=u[f];if(o){const I=m==="y"?"top":"left",C=m==="y"?"bottom":"right",w=p+d[I],_=p-d[C];p=No(w,p,_)}if(s){const I=f==="y"?"top":"left",C=f==="y"?"bottom":"right",w=h+d[I],_=h-d[C];h=No(w,h,_)}const v=c.fn({...t,[m]:p,[f]:h});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[m]:o,[f]:s}}}}}};function qr(){return typeof window<"u"}function Ln(e){return ec(e)?(e.nodeName||"").toLowerCase():"#document"}function ct(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Dt(e){var t;return(t=(ec(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ec(e){return qr()?e instanceof Node||e instanceof ct(e).Node:!1}function Nt(e){return qr()?e instanceof Element||e instanceof ct(e).Element:!1}function jt(e){return qr()?e instanceof HTMLElement||e instanceof ct(e).HTMLElement:!1}function ms(e){return!qr()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ct(e).ShadowRoot}function nr(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=Tt(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function Bh(e){return["table","td","th"].includes(Ln(e))}function Wr(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function hi(e){const t=mi(),n=Nt(e)?Tt(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 Uh(e){let t=rn(e);for(;jt(t)&&!An(t);){if(hi(t))return t;if(Wr(t))return null;t=rn(t)}return null}function mi(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function An(e){return["html","body","#document"].includes(Ln(e))}function Tt(e){return ct(e).getComputedStyle(e)}function zr(e){return Nt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function rn(e){if(Ln(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ms(e)&&e.host||Dt(e);return ms(t)?t.host:t}function tc(e){const t=rn(e);return An(t)?e.ownerDocument?e.ownerDocument.body:e.body:jt(t)&&nr(t)?t:tc(t)}function Xn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=tc(e),o=i===((r=e.ownerDocument)==null?void 0:r.body),s=ct(i);if(o){const c=Ro(s);return t.concat(s,s.visualViewport||[],nr(i)?i:[],c&&n?Xn(c):[])}return t.concat(i,Xn(i,[],n))}function Ro(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function nc(e){const t=Tt(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=jt(e),o=i?e.offsetWidth:n,s=i?e.offsetHeight:r,c=jr(n)!==o||jr(r)!==s;return c&&(n=o,r=s),{width:n,height:r,$:c}}function gi(e){return Nt(e)?e:e.contextElement}function Sn(e){const t=gi(e);if(!jt(t))return nn(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:o}=nc(t);let s=(o?jr(n.width):n.width)/r,c=(o?jr(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const qh=nn(0);function rc(e){const t=ct(e);return!mi()||!t.visualViewport?qh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Wh(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ct(e)?!1:t}function yn(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),o=gi(e);let s=nn(1);t&&(r?Nt(r)&&(s=Sn(r)):s=Sn(e));const c=Wh(o,n,r)?rc(o):nn(0);let l=(i.left+c.x)/s.x,u=(i.top+c.y)/s.y,d=i.width/s.x,f=i.height/s.y;if(o){const m=ct(o),p=r&&Nt(r)?ct(r):r;let h=m,v=Ro(h);for(;v&&r&&p!==h;){const I=Sn(v),C=v.getBoundingClientRect(),w=Tt(v),_=C.left+(v.clientLeft+parseFloat(w.paddingLeft))*I.x,b=C.top+(v.clientTop+parseFloat(w.paddingTop))*I.y;l*=I.x,u*=I.y,d*=I.x,f*=I.y,l+=_,u+=b,h=ct(v),v=Ro(h)}}return Dr({width:d,height:f,x:l,y:u})}function zh(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const o=i==="fixed",s=Dt(r),c=t?Wr(t.floating):!1;if(r===s||c&&o)return n;let l={scrollLeft:0,scrollTop:0},u=nn(1);const d=nn(0),f=jt(r);if((f||!f&&!o)&&((Ln(r)!=="body"||nr(s))&&(l=zr(r)),jt(r))){const m=yn(r);u=Sn(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-l.scrollLeft*u.x+d.x,y:n.y*u.y-l.scrollTop*u.y+d.y}}function Jh(e){return Array.from(e.getClientRects())}function Ao(e,t){const n=zr(e).scrollLeft;return t?t.left+n:yn(Dt(e)).left+n}function Xh(e){const t=Dt(e),n=zr(e),r=e.ownerDocument.body,i=gn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=gn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Ao(e);const c=-n.scrollTop;return Tt(r).direction==="rtl"&&(s+=gn(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:c}}function Yh(e,t){const n=ct(e),r=Dt(e),i=n.visualViewport;let o=r.clientWidth,s=r.clientHeight,c=0,l=0;if(i){o=i.width,s=i.height;const u=mi();(!u||u&&t==="fixed")&&(c=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:c,y:l}}function Gh(e,t){const n=yn(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,o=jt(e)?Sn(e):nn(1),s=e.clientWidth*o.x,c=e.clientHeight*o.y,l=i*o.x,u=r*o.y;return{width:s,height:c,x:l,y:u}}function gs(e,t,n){let r;if(t==="viewport")r=Yh(e,n);else if(t==="document")r=Xh(Dt(e));else if(Nt(t))r=Gh(t,n);else{const i=rc(e);r={...t,x:t.x-i.x,y:t.y-i.y}}return Dr(r)}function oc(e,t){const n=rn(e);return n===t||!Nt(n)||An(n)?!1:Tt(n).position==="fixed"||oc(n,t)}function Zh(e,t){const n=t.get(e);if(n)return n;let r=Xn(e,[],!1).filter(c=>Nt(c)&&Ln(c)!=="body"),i=null;const o=Tt(e).position==="fixed";let s=o?rn(e):e;for(;Nt(s)&&!An(s);){const c=Tt(s),l=hi(s);!l&&c.position==="fixed"&&(i=null),(o?!l&&!i:!l&&c.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||nr(s)&&!l&&oc(e,s))?r=r.filter(d=>d!==s):i=c,s=rn(s)}return t.set(e,r),r}function Qh(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?Wr(t)?[]:Zh(t,this._c):[].concat(n),r],c=s[0],l=s.reduce((u,d)=>{const f=gs(t,d,i);return u.top=gn(f.top,u.top),u.right=Tn(f.right,u.right),u.bottom=Tn(f.bottom,u.bottom),u.left=gn(f.left,u.left),u},gs(t,c,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function em(e){const{width:t,height:n}=nc(e);return{width:t,height:n}}function tm(e,t,n){const r=jt(t),i=Dt(t),o=n==="fixed",s=yn(e,!0,o,t);let c={scrollLeft:0,scrollTop:0};const l=nn(0);if(r||!r&&!o)if((Ln(t)!=="body"||nr(i))&&(c=zr(t)),r){const p=yn(t,!0,o,t);l.x=p.x+t.clientLeft,l.y=p.y+t.clientTop}else i&&(l.x=Ao(i));let u=0,d=0;if(i&&!r&&!o){const p=i.getBoundingClientRect();d=p.top+c.scrollTop,u=p.left+c.scrollLeft-Ao(i,p)}const f=s.left+c.scrollLeft-l.x-u,m=s.top+c.scrollTop-l.y-d;return{x:f,y:m,width:s.width,height:s.height}}function mo(e){return Tt(e).position==="static"}function vs(e,t){if(!jt(e)||Tt(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Dt(e)===n&&(n=n.ownerDocument.body),n}function ic(e,t){const n=ct(e);if(Wr(e))return n;if(!jt(e)){let i=rn(e);for(;i&&!An(i);){if(Nt(i)&&!mo(i))return i;i=rn(i)}return n}let r=vs(e,t);for(;r&&Bh(r)&&mo(r);)r=vs(r,t);return r&&An(r)&&mo(r)&&!hi(r)?n:r||Uh(e)||n}const nm=async function(e){const t=this.getOffsetParent||ic,n=this.getDimensions,r=await n(e.floating);return{reference:tm(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function rm(e){return Tt(e).direction==="rtl"}const om={convertOffsetParentRelativeRectToViewportRelativeRect:zh,getDocumentElement:Dt,getClippingRect:Qh,getOffsetParent:ic,getElementRects:nm,getClientRects:Jh,getDimensions:em,getScale:Sn,isElement:Nt,isRTL:rm};function im(e,t){let n=null,r;const i=Dt(e);function o(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function s(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),o();const{left:u,top:d,width:f,height:m}=e.getBoundingClientRect();if(c||t(),!f||!m)return;const p=Ir(d),h=Ir(i.clientWidth-(u+f)),v=Ir(i.clientHeight-(d+m)),I=Ir(u),w={rootMargin:-p+"px "+-h+"px "+-v+"px "+-I+"px",threshold:gn(0,Tn(1,l))||1};let _=!0;function b(x){const O=x[0].intersectionRatio;if(O!==l){if(!_)return s();O?s(!1,O):r=setTimeout(()=>{s(!1,1e-7)},1e3)}_=!1}try{n=new IntersectionObserver(b,{...w,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,w)}n.observe(e)}return s(!0),o}function sm(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=gi(e),d=i||o?[...u?Xn(u):[],...Xn(t)]:[];d.forEach(C=>{i&&C.addEventListener("scroll",n,{passive:!0}),o&&C.addEventListener("resize",n)});const f=u&&c?im(u,n):null;let m=-1,p=null;s&&(p=new ResizeObserver(C=>{let[w]=C;w&&w.target===u&&p&&(p.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var _;(_=p)==null||_.observe(t)})),n()}),u&&!l&&p.observe(u),p.observe(t));let h,v=l?yn(e):null;l&&I();function I(){const C=yn(e);v&&(C.x!==v.x||C.y!==v.y||C.width!==v.width||C.height!==v.height)&&n(),v=C,h=requestAnimationFrame(I)}return n(),()=>{var C;d.forEach(w=>{i&&w.removeEventListener("scroll",n),o&&w.removeEventListener("resize",n)}),f==null||f(),(C=p)==null||C.disconnect(),p=null,l&&cancelAnimationFrame(h)}}const am=Vh,cm=Hh,lm=$h,um=Lh,ys=(e,t,n)=>{const r=new Map,i={platform:om,...n},o={...i.platform,_c:r};return Mh(e,t,{...i,platform:o})};/*
|
|
44
|
+
* React Tooltip
|
|
45
|
+
* {@link https://github.com/ReactTooltip/react-tooltip}
|
|
46
|
+
* @copyright ReactTooltip Team
|
|
47
|
+
* @license MIT
|
|
48
|
+
*/const dm="react-tooltip-core-styles",pm="react-tooltip-base-styles",ws={core:!1,base:!1};function Is({css:e,id:t=pm,type:n="base",ref:r}){var i,o;if(!e||typeof document>"u"||ws[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=dm),r||(r={});const{insertAt:s}=r;if(document.getElementById(t))return;const c=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.id=t,l.type="text/css",s==="top"&&c.firstChild?c.insertBefore(l,c.firstChild):c.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e)),ws[n]=!0}const xs=async({elementReference:e=null,tooltipReference:t=null,tooltipArrowReference:n=null,place:r="top",offset:i=10,strategy:o="absolute",middlewares:s=[am(Number(i)),lm({fallbackAxisSideDirection:"start"}),cm({padding:5})],border:c})=>{if(!e)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};if(t===null)return{tooltipStyles:{},tooltipArrowStyles:{},place:r};const l=s;return n?(l.push(um({element:n,padding:5})),ys(e,t,{placement:r,strategy:o,middleware:l}).then(({x:u,y:d,placement:f,middlewareData:m})=>{var p,h;const v={left:`${u}px`,top:`${d}px`,border:c},{x:I,y:C}=(p=m.arrow)!==null&&p!==void 0?p:{x:0,y:0},w=(h={top:"bottom",right:"left",bottom:"top",left:"right"}[f.split("-")[0]])!==null&&h!==void 0?h:"bottom",_=c&&{borderBottom:c,borderRight:c};let b=0;if(c){const x=`${c}`.match(/(\d+)px/);b=x!=null&&x[1]?Number(x[1]):1}return{tooltipStyles:v,tooltipArrowStyles:{left:I!=null?`${I}px`:"",top:C!=null?`${C}px`:"",right:"",bottom:"",..._,[w]:`-${4+b}px`},place:f}})):ys(e,t,{placement:"bottom",strategy:o,middleware:l}).then(({x:u,y:d,placement:f})=>({tooltipStyles:{left:`${u}px`,top:`${d}px`},tooltipArrowStyles:{},place:f}))},bs=(e,t)=>!("CSS"in window&&"supports"in window.CSS)||window.CSS.supports(e,t),_s=(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},Cs=e=>e!==null&&!Array.isArray(e)&&typeof e=="object",jo=(e,t)=>{if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((i,o)=>jo(i,t[o]));if(Array.isArray(e)!==Array.isArray(t))return!1;if(!Cs(e)||!Cs(t))return e===t;const n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(i=>jo(e[i],t[i]))},fm=e=>{if(!(e instanceof HTMLElement||e instanceof SVGElement))return!1;const t=getComputedStyle(e);return["overflow","overflow-x","overflow-y"].some(n=>{const r=t.getPropertyValue(n);return r==="auto"||r==="scroll"})},Ss=e=>{if(!e)return null;let t=e.parentElement;for(;t;){if(fm(t))return t;t=t.parentElement}return document.scrollingElement||document.documentElement},hm=typeof window<"u"?g.useLayoutEffect:g.useEffect,gt=e=>{e.current&&(clearTimeout(e.current),e.current=null)},mm="DEFAULT_TOOLTIP_ID",gm={anchorRefs:new Set,activeAnchor:{current:null},attach:()=>{},detach:()=>{},setActiveAnchor:()=>{}},vm=g.createContext({getTooltipData:()=>gm});function sc(e=mm){return g.useContext(vm).getTooltipData(e)}var _n={tooltip:"core-styles-module_tooltip__3vRRp",fixed:"core-styles-module_fixed__pcSol",arrow:"core-styles-module_arrow__cvMwQ",noArrow:"core-styles-module_noArrow__xock6",clickable:"core-styles-module_clickable__ZuTTB",show:"core-styles-module_show__Nt9eE",closing:"core-styles-module_closing__sGnxF"},go={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 ym=({forwardRef:e,id:t,className:n,classNameArrow:r,variant:i="dark",anchorId:o,anchorSelect:s,place:c="top",offset:l=10,events:u=["hover"],openOnClick:d=!1,positionStrategy:f="absolute",middlewares:m,wrapper:p,delayShow:h=0,delayHide:v=0,float:I=!1,hidden:C=!1,noArrow:w=!1,clickable:_=!1,closeOnEsc:b=!1,closeOnScroll:x=!1,closeOnResize:O=!1,openEvents:M,closeEvents:E,globalCloseEvents:V,imperativeModeOnly:z,style:X,position:Z,afterShow:te,afterHide:q,disableTooltip:ae,content:re,contentWrapperRef:ee,isOpen:pe,defaultIsOpen:he=!1,setIsOpen:N,activeAnchor:P,setActiveAnchor:L,border:k,opacity:D,arrowColor:A,role:Y="tooltip"})=>{var G;const H=g.useRef(null),Q=g.useRef(null),W=g.useRef(null),ce=g.useRef(null),j=g.useRef(null),[fe,B]=g.useState({tooltipStyles:{},tooltipArrowStyles:{},place:c}),[Ie,ke]=g.useState(!1),[qe,Fe]=g.useState(!1),[me,wt]=g.useState(null),We=g.useRef(!1),ot=g.useRef(null),{anchorRefs:It,setActiveAnchor:xt}=sc(t),ze=g.useRef(!1),[He,Me]=g.useState([]),Oe=g.useRef(!1),bt=d||u.includes("click"),Ge=bt||(M==null?void 0:M.click)||(M==null?void 0:M.dblclick)||(M==null?void 0:M.mousedown),kt=M?{...M}:{mouseover:!0,focus:!0,mouseenter:!1,click:!1,dblclick:!1,mousedown:!1};!M&&bt&&Object.assign(kt,{mouseenter:!1,focus:!1,mouseover:!1,click:!0});const Wt=E?{...E}:{mouseout:!0,blur:!0,mouseleave:!1,click:!1,dblclick:!1,mouseup:!1};!E&&bt&&Object.assign(Wt,{mouseleave:!1,blur:!1,mouseout:!1});const it=V?{...V}:{escape:b||!1,scroll:x||!1,resize:O||!1,clickOutsideAnchor:Ge||!1};z&&(Object.assign(kt,{mouseenter:!1,focus:!1,click:!1,dblclick:!1,mousedown:!1}),Object.assign(Wt,{mouseleave:!1,blur:!1,click:!1,dblclick:!1,mouseup:!1}),Object.assign(it,{escape:!1,scroll:!1,resize:!1,clickOutsideAnchor:!1})),hm(()=>(Oe.current=!0,()=>{Oe.current=!1}),[]);const Ee=U=>{Oe.current&&(U&&Fe(!0),setTimeout(()=>{Oe.current&&(N==null||N(U),pe===void 0&&ke(U))},10))};g.useEffect(()=>{if(pe===void 0)return()=>null;pe&&Fe(!0);const U=setTimeout(()=>{ke(pe)},10);return()=>{clearTimeout(U)}},[pe]),g.useEffect(()=>{if(Ie!==We.current)if(gt(j),We.current=Ie,Ie)te==null||te();else{const U=(oe=>{const se=oe.match(/^([\d.]+)(ms|s)$/);if(!se)return 0;const[,Ae,$e]=se;return Number(Ae)*($e==="ms"?1:1e3)})(getComputedStyle(document.body).getPropertyValue("--rt-transition-show-delay"));j.current=setTimeout(()=>{Fe(!1),wt(null),q==null||q()},U+25)}},[Ie]);const Ft=U=>{B(oe=>jo(oe,U)?oe:U)},zt=(U=h)=>{gt(W),qe?Ee(!0):W.current=setTimeout(()=>{Ee(!0)},U)},Mt=(U=v)=>{gt(ce),ce.current=setTimeout(()=>{ze.current||Ee(!1)},U)},cn=U=>{var oe;if(!U)return;const se=(oe=U.currentTarget)!==null&&oe!==void 0?oe:U.target;if(!(se!=null&&se.isConnected))return L(null),void xt({current:null});h?zt():Ee(!0),L(se),xt({current:se}),gt(ce)},et=()=>{_?Mt(v||100):v?Mt():Ee(!1),gt(W)},Lt=({x:U,y:oe})=>{var se;const Ae={getBoundingClientRect:()=>({x:U,y:oe,width:0,height:0,top:oe,left:U,right:U,bottom:oe})};xs({place:(se=me==null?void 0:me.place)!==null&&se!==void 0?se:c,offset:l,elementReference:Ae,tooltipReference:H.current,tooltipArrowReference:Q.current,strategy:f,middlewares:m,border:k}).then($e=>{Ft($e)})},Jt=U=>{if(!U)return;const oe=U,se={x:oe.clientX,y:oe.clientY};Lt(se),ot.current=se},ln=U=>{var oe;if(!Ie)return;const se=U.target;se.isConnected&&(!((oe=H.current)===null||oe===void 0)&&oe.contains(se)||[document.querySelector(`[id='${o}']`),...He].some(Ae=>Ae==null?void 0:Ae.contains(se))||(Ee(!1),gt(W)))},Xt=_s(cn,50),Ce=_s(et,50),Ze=U=>{Ce.cancel(),Xt(U)},ne=()=>{Xt.cancel(),Ce()},de=g.useCallback(()=>{var U,oe;const se=(U=me==null?void 0:me.position)!==null&&U!==void 0?U:Z;se?Lt(se):I?ot.current&&Lt(ot.current):P!=null&&P.isConnected&&xs({place:(oe=me==null?void 0:me.place)!==null&&oe!==void 0?oe:c,offset:l,elementReference:P,tooltipReference:H.current,tooltipArrowReference:Q.current,strategy:f,middlewares:m,border:k}).then(Ae=>{Oe.current&&Ft(Ae)})},[Ie,P,re,X,c,me==null?void 0:me.place,l,f,Z,me==null?void 0:me.position,I]);g.useEffect(()=>{var U,oe;const se=new Set(It);He.forEach(xe=>{ae!=null&&ae(xe)||se.add({current:xe})});const Ae=document.querySelector(`[id='${o}']`);Ae&&!(ae!=null&&ae(Ae))&&se.add({current:Ae});const $e=()=>{Ee(!1)},tt=Ss(P),Be=Ss(H.current);it.scroll&&(window.addEventListener("scroll",$e),tt==null||tt.addEventListener("scroll",$e),Be==null||Be.addEventListener("scroll",$e));let Je=null;it.resize?window.addEventListener("resize",$e):P&&H.current&&(Je=sm(P,H.current,de,{ancestorResize:!0,elementResize:!0,layoutShift:!0}));const nt=xe=>{xe.key==="Escape"&&Ee(!1)};it.escape&&window.addEventListener("keydown",nt),it.clickOutsideAnchor&&window.addEventListener("click",ln);const be=[],un=xe=>{Ie&&(xe==null?void 0:xe.target)===P||cn(xe)},to=xe=>{Ie&&(xe==null?void 0:xe.target)===P&&et()},ft=["mouseover","mouseout","mouseenter","mouseleave","focus","blur"],ir=["click","dblclick","mousedown","mouseup"];Object.entries(kt).forEach(([xe,_t])=>{_t&&(ft.includes(xe)?be.push({event:xe,listener:Ze}):ir.includes(xe)&&be.push({event:xe,listener:un}))}),Object.entries(Wt).forEach(([xe,_t])=>{_t&&(ft.includes(xe)?be.push({event:xe,listener:ne}):ir.includes(xe)&&be.push({event:xe,listener:to}))}),I&&be.push({event:"pointermove",listener:Jt});const sr=()=>{ze.current=!0},ar=()=>{ze.current=!1,et()};return _&&!Ge&&((U=H.current)===null||U===void 0||U.addEventListener("mouseenter",sr),(oe=H.current)===null||oe===void 0||oe.addEventListener("mouseleave",ar)),be.forEach(({event:xe,listener:_t})=>{se.forEach(Ct=>{var dn;(dn=Ct.current)===null||dn===void 0||dn.addEventListener(xe,_t)})}),()=>{var xe,_t;it.scroll&&(window.removeEventListener("scroll",$e),tt==null||tt.removeEventListener("scroll",$e),Be==null||Be.removeEventListener("scroll",$e)),it.resize?window.removeEventListener("resize",$e):Je==null||Je(),it.clickOutsideAnchor&&window.removeEventListener("click",ln),it.escape&&window.removeEventListener("keydown",nt),_&&!Ge&&((xe=H.current)===null||xe===void 0||xe.removeEventListener("mouseenter",sr),(_t=H.current)===null||_t===void 0||_t.removeEventListener("mouseleave",ar)),be.forEach(({event:Ct,listener:dn})=>{se.forEach(no=>{var Kn;(Kn=no.current)===null||Kn===void 0||Kn.removeEventListener(Ct,dn)})})}},[P,de,qe,It,He,M,E,V,bt,h,v]),g.useEffect(()=>{var U,oe;let se=(oe=(U=me==null?void 0:me.anchorSelect)!==null&&U!==void 0?U:s)!==null&&oe!==void 0?oe:"";!se&&t&&(se=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`);const Ae=new MutationObserver($e=>{const tt=[],Be=[];$e.forEach(Je=>{if(Je.type==="attributes"&&Je.attributeName==="data-tooltip-id"&&(Je.target.getAttribute("data-tooltip-id")===t?tt.push(Je.target):Je.oldValue===t&&Be.push(Je.target)),Je.type==="childList"){if(P){const nt=[...Je.removedNodes].filter(be=>be.nodeType===1);if(se)try{Be.push(...nt.filter(be=>be.matches(se))),Be.push(...nt.flatMap(be=>[...be.querySelectorAll(se)]))}catch{}nt.some(be=>{var un;return!!(!((un=be==null?void 0:be.contains)===null||un===void 0)&&un.call(be,P))&&(Fe(!1),Ee(!1),L(null),gt(W),gt(ce),!0)})}if(se)try{const nt=[...Je.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||Be.length)&&Me(Je=>[...Je.filter(nt=>!Be.includes(nt)),...tt])});return Ae.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-tooltip-id"],attributeOldValue:!0}),()=>{Ae.disconnect()}},[t,s,me==null?void 0:me.anchorSelect,P]),g.useEffect(()=>{de()},[de]),g.useEffect(()=>{if(!(ee!=null&&ee.current))return()=>null;const U=new ResizeObserver(()=>{setTimeout(()=>de())});return U.observe(ee.current),()=>{U.disconnect()}},[re,ee==null?void 0:ee.current]),g.useEffect(()=>{var U;const oe=document.querySelector(`[id='${o}']`),se=[...He,oe];P&&se.includes(P)||L((U=He[0])!==null&&U!==void 0?U:oe)},[o,He,P]),g.useEffect(()=>(he&&Ee(!0),()=>{gt(W),gt(ce)}),[]),g.useEffect(()=>{var U;let oe=(U=me==null?void 0:me.anchorSelect)!==null&&U!==void 0?U:s;if(!oe&&t&&(oe=`[data-tooltip-id='${t.replace(/'/g,"\\'")}']`),oe)try{const se=Array.from(document.querySelectorAll(oe));Me(se)}catch{Me([])}},[t,s,me==null?void 0:me.anchorSelect]),g.useEffect(()=>{W.current&&(gt(W),zt(h))},[h]);const Le=(G=me==null?void 0:me.content)!==null&&G!==void 0?G:re,$t=Ie&&Object.keys(fe.tooltipStyles).length>0;return g.useImperativeHandle(e,()=>({open:U=>{if(U!=null&&U.anchorSelect)try{document.querySelector(U.anchorSelect)}catch{return void console.warn(`[react-tooltip] "${U.anchorSelect}" is not a valid CSS selector`)}wt(U??null),U!=null&&U.delay?zt(U.delay):Ee(!0)},close:U=>{U!=null&&U.delay?Mt(U.delay):Ee(!1)},activeAnchor:P,place:fe.place,isOpen:!!(qe&&!C&&Le&&$t)})),qe&&!C&&Le?g.createElement(p,{id:t,role:Y,className:qt("react-tooltip",_n.tooltip,go.tooltip,go[i],n,`react-tooltip__place-${fe.place}`,_n[$t?"show":"closing"],$t?"react-tooltip__show":"react-tooltip__closing",f==="fixed"&&_n.fixed,_&&_n.clickable),onTransitionEnd:U=>{gt(j),Ie||U.propertyName!=="opacity"||(Fe(!1),wt(null),q==null||q())},style:{...X,...fe.tooltipStyles,opacity:D!==void 0&&$t?D:void 0},ref:H},Le,g.createElement(p,{className:qt("react-tooltip-arrow",_n.arrow,go.arrow,r,w&&_n.noArrow),style:{...fe.tooltipArrowStyles,background:A?`linear-gradient(to right bottom, transparent 50%, ${A} 50%)`:void 0},ref:Q})):null},wm=({content:e})=>g.createElement("span",{dangerouslySetInnerHTML:{__html:e}}),Im=g.forwardRef(({id:e,anchorId:t,anchorSelect:n,content:r,html:i,render:o,className:s,classNameArrow:c,variant:l="dark",place:u="top",offset:d=10,wrapper:f="div",children:m=null,events:p=["hover"],openOnClick:h=!1,positionStrategy:v="absolute",middlewares:I,delayShow:C=0,delayHide:w=0,float:_=!1,hidden:b=!1,noArrow:x=!1,clickable:O=!1,closeOnEsc:M=!1,closeOnScroll:E=!1,closeOnResize:V=!1,openEvents:z,closeEvents:X,globalCloseEvents:Z,imperativeModeOnly:te=!1,style:q,position:ae,isOpen:re,defaultIsOpen:ee=!1,disableStyleInjection:pe=!1,border:he,opacity:N,arrowColor:P,setIsOpen:L,afterShow:k,afterHide:D,disableTooltip:A,role:Y="tooltip"},G)=>{const[H,Q]=g.useState(r),[W,ce]=g.useState(i),[j,fe]=g.useState(u),[B,Ie]=g.useState(l),[ke,qe]=g.useState(d),[Fe,me]=g.useState(C),[wt,We]=g.useState(w),[ot,It]=g.useState(_),[xt,ze]=g.useState(b),[He,Me]=g.useState(f),[Oe,bt]=g.useState(p),[Ge,kt]=g.useState(v),[Wt,it]=g.useState(null),[Ee,Ft]=g.useState(null),zt=g.useRef(pe),{anchorRefs:Mt,activeAnchor:cn}=sc(e),et=Ce=>Ce==null?void 0:Ce.getAttributeNames().reduce((Ze,ne)=>{var de;return ne.startsWith("data-tooltip-")&&(Ze[ne.replace(/^data-tooltip-/,"")]=(de=Ce==null?void 0:Ce.getAttribute(ne))!==null&&de!==void 0?de:null),Ze},{}),Lt=Ce=>{const Ze={place:ne=>{var de;fe((de=ne)!==null&&de!==void 0?de:u)},content:ne=>{Q(ne??r)},html:ne=>{ce(ne??i)},variant:ne=>{var de;Ie((de=ne)!==null&&de!==void 0?de:l)},offset:ne=>{qe(ne===null?d:Number(ne))},wrapper:ne=>{var de;Me((de=ne)!==null&&de!==void 0?de:f)},events:ne=>{const de=ne==null?void 0:ne.split(" ");bt(de??p)},"position-strategy":ne=>{var de;kt((de=ne)!==null&&de!==void 0?de:v)},"delay-show":ne=>{me(ne===null?C:Number(ne))},"delay-hide":ne=>{We(ne===null?w:Number(ne))},float:ne=>{It(ne===null?_:ne==="true")},hidden:ne=>{ze(ne===null?b:ne==="true")},"class-name":ne=>{it(ne)}};Object.values(Ze).forEach(ne=>ne(null)),Object.entries(Ce).forEach(([ne,de])=>{var Le;(Le=Ze[ne])===null||Le===void 0||Le.call(Ze,de)})};g.useEffect(()=>{Q(r)},[r]),g.useEffect(()=>{ce(i)},[i]),g.useEffect(()=>{fe(u)},[u]),g.useEffect(()=>{Ie(l)},[l]),g.useEffect(()=>{qe(d)},[d]),g.useEffect(()=>{me(C)},[C]),g.useEffect(()=>{We(w)},[w]),g.useEffect(()=>{It(_)},[_]),g.useEffect(()=>{ze(b)},[b]),g.useEffect(()=>{kt(v)},[v]),g.useEffect(()=>{zt.current!==pe&&console.warn("[react-tooltip] Do not change `disableStyleInjection` dynamically.")},[pe]),g.useEffect(()=>{typeof window<"u"&&window.dispatchEvent(new CustomEvent("react-tooltip-inject-styles",{detail:{disableCore:pe==="core",disableBase:pe}}))},[]),g.useEffect(()=>{var Ce;const Ze=new Set(Mt);let ne=n;if(!ne&&e&&(ne=`[data-tooltip-id='${e.replace(/'/g,"\\'")}']`),ne)try{document.querySelectorAll(ne).forEach(oe=>{Ze.add({current:oe})})}catch{console.warn(`[react-tooltip] "${ne}" is not a valid CSS selector`)}const de=document.querySelector(`[id='${t}']`);if(de&&Ze.add({current:de}),!Ze.size)return()=>null;const Le=(Ce=Ee??de)!==null&&Ce!==void 0?Ce:cn.current,$t=new MutationObserver(oe=>{oe.forEach(se=>{var Ae;if(!Le||se.type!=="attributes"||!(!((Ae=se.attributeName)===null||Ae===void 0)&&Ae.startsWith("data-tooltip-")))return;const $e=et(Le);Lt($e)})}),U={attributes:!0,childList:!1,subtree:!1};if(Le){const oe=et(Le);Lt(oe),$t.observe(Le,U)}return()=>{$t.disconnect()}},[Mt,cn,Ee,t,n]),g.useEffect(()=>{q!=null&&q.border&&console.warn("[react-tooltip] Do not set `style.border`. Use `border` prop instead."),he&&!bs("border",`${he}`)&&console.warn(`[react-tooltip] "${he}" is not a valid \`border\`.`),q!=null&&q.opacity&&console.warn("[react-tooltip] Do not set `style.opacity`. Use `opacity` prop instead."),N&&!bs("opacity",`${N}`)&&console.warn(`[react-tooltip] "${N}" is not a valid \`opacity\`.`)},[]);let Jt=m;const ln=g.useRef(null);if(o){const Ce=o({content:(Ee==null?void 0:Ee.getAttribute("data-tooltip-content"))||H||null,activeAnchor:Ee});Jt=Ce?g.createElement("div",{ref:ln,className:"react-tooltip-content-wrapper"},Ce):null}else H&&(Jt=H);W&&(Jt=g.createElement(wm,{content:W}));const Xt={forwardRef:G,id:e,anchorId:t,anchorSelect:n,className:qt(s,Wt),classNameArrow:c,content:Jt,contentWrapperRef:ln,place:j,variant:B,offset:ke,wrapper:He,events:Oe,openOnClick:h,positionStrategy:Ge,middlewares:I,delayShow:Fe,delayHide:wt,float:ot,hidden:xt,noArrow:x,clickable:O,closeOnEsc:M,closeOnScroll:E,closeOnResize:V,openEvents:z,closeEvents:X,globalCloseEvents:Z,imperativeModeOnly:te,style:q,position:ae,isOpen:re,defaultIsOpen:ee,border:he,opacity:N,arrowColor:P,setIsOpen:L,afterShow:k,afterHide:D,disableTooltip:A,activeAnchor:Ee,setActiveAnchor:Ce=>Ft(Ce),role:Y};return g.createElement(ym,{...Xt})});typeof window<"u"&&window.addEventListener("react-tooltip-inject-styles",e=>{e.detail.disableCore||Is({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||Is({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 xm(){return a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"17",viewBox:"0 0 16 17",fill:"none",children:[a.jsxs("g",{clipPath:"url(#clip0_2896_16290)",children:[a.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"}),a.jsx("path",{d:"M8.00293 5.83301L7.99768 5.83301",stroke:"#6B7280",strokeLinecap:"round",strokeLinejoin:"round"})]}),a.jsx("defs",{children:a.jsx("clipPath",{id:"clip0_2896_16290",children:a.jsx("rect",{width:"16",height:"16",fill:"white",transform:"translate(16 16.5) rotate(180)"})})})]})}function bm({id:e,tooltipText:t}){return a.jsxs(a.Fragment,{children:[a.jsx("span",{"data-tooltip-id":e,style:{maxWidth:"20rem"},children:xm()}),a.jsx(Im,{id:e,place:"top",content:t,style:{maxWidth:"30rem"}})]})}const vi=g.createContext(null);function ac(){const e=g.useContext(vi);if(e===null)throw new Error("useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider");return{selectedObjectName:e}}const yi=g.createContext(()=>{});function _m(){const e=g.useContext(yi);if(!e)throw new Error("useSetNextTabIndex must be used within a NextTabIndexProvider");return{onNextIncompleteTab:e}}var cc=Symbol.for("immer-nothing"),Os=Symbol.for("immer-draftable"),lt=Symbol.for("immer-state"),Cm=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=Cm[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 jn=Object.getPrototypeOf;function Pn(e){return!!e&&!!e[lt]}function wn(e){var t;return e?lc(e)||Array.isArray(e)||!!e[Os]||!!((t=e.constructor)!=null&&t[Os])||Xr(e)||Yr(e):!1}var Sm=Object.prototype.constructor.toString();function lc(e){if(!e||typeof e!="object")return!1;const t=jn(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)===Sm}function kr(e,t){Jr(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function Jr(e){const t=e[lt];return t?t.type_:Array.isArray(e)?1:Xr(e)?2:Yr(e)?3:0}function Po(e,t){return Jr(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function uc(e,t,n){const r=Jr(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function Om(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Xr(e){return e instanceof Map}function Yr(e){return e instanceof Set}function hn(e){return e.copy_||e.base_}function Do(e,t){if(Xr(e))return new Map(e);if(Yr(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const n=lc(e);if(t===!0||t==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(e);delete r[lt];let i=Reflect.ownKeys(r);for(let o=0;o<i.length;o++){const s=i[o],c=r[s];c.writable===!1&&(c.writable=!0,c.configurable=!0),(c.get||c.set)&&(r[s]={configurable:!0,writable:!0,enumerable:c.enumerable,value:e[s]})}return Object.create(jn(e),r)}else{const r=jn(e);if(r!==null&&n)return{...e};const i=Object.create(r);return Object.assign(i,e)}}function wi(e,t=!1){return Gr(e)||Pn(e)||!wn(e)||(Jr(e)>1&&(e.set=e.add=e.clear=e.delete=Em),Object.freeze(e),t&&Object.entries(e).forEach(([n,r])=>wi(r,!0))),e}function Em(){rt(2)}function Gr(e){return Object.isFrozen(e)}var Nm={};function In(e){const t=Nm[e];return t||rt(0,e),t}var Yn;function dc(){return Yn}function Tm(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Es(e,t){t&&(In("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function ko(e){Fo(e),e.drafts_.forEach(Rm),e.drafts_=null}function Fo(e){e===Yn&&(Yn=e.parent_)}function Ns(e){return Yn=Tm(Yn,e)}function Rm(e){const t=e[lt];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Ts(e,t){t.unfinalizedDrafts_=t.drafts_.length;const n=t.drafts_[0];return e!==void 0&&e!==n?(n[lt].modified_&&(ko(t),rt(4)),wn(e)&&(e=Fr(t,e),t.parent_||Mr(t,e)),t.patches_&&In("Patches").generateReplacementPatches_(n[lt].base_,e,t.patches_,t.inversePatches_)):e=Fr(t,n,[]),ko(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==cc?e:void 0}function Fr(e,t,n){if(Gr(t))return t;const r=t[lt];if(!r)return kr(t,(i,o)=>Rs(e,r,t,i,o,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Mr(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),kr(o,(c,l)=>Rs(e,r,i,c,l,n,s)),Mr(e,i,!1),n&&e.patches_&&In("Patches").generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Rs(e,t,n,r,i,o,s){if(process.env.NODE_ENV!=="production"&&i===n&&rt(5),Pn(i)){const c=o&&t&&t.type_!==3&&!Po(t.assigned_,r)?o.concat(r):void 0,l=Fr(e,i,c);if(uc(n,r,l),Pn(l))e.canAutoFreeze_=!1;else return}else s&&n.add(i);if(wn(i)&&!Gr(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Fr(e,i),(!t||!t.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&Mr(e,i)}}function Mr(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&wi(t,n)}function Am(e,t){const n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:dc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let i=r,o=Ii;n&&(i=[r],o=Gn);const{revoke:s,proxy:c}=Proxy.revocable(i,o);return r.draft_=c,r.revoke_=s,c}var Ii={get(e,t){if(t===lt)return e;const n=hn(e);if(!Po(n,t))return jm(e,n,t);const r=n[t];return e.finalized_||!wn(r)?r:r===vo(e.base_,t)?(yo(e),e.copy_[t]=Lo(r,e)):r},has(e,t){return t in hn(e)},ownKeys(e){return Reflect.ownKeys(hn(e))},set(e,t,n){const r=pc(hn(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){const i=vo(hn(e),t),o=i==null?void 0:i[lt];if(o&&o.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(Om(n,i)&&(n!==void 0||Po(e.base_,t)))return!0;yo(e),Mo(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 vo(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,yo(e),Mo(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const n=hn(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 jn(e.base_)},setPrototypeOf(){rt(12)}},Gn={};kr(Ii,(e,t)=>{Gn[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Gn.deleteProperty=function(e,t){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(t))&&rt(13),Gn.set.call(this,e,t,void 0)};Gn.set=function(e,t,n){return process.env.NODE_ENV!=="production"&&t!=="length"&&isNaN(parseInt(t))&&rt(14),Ii.set.call(this,e[0],t,n,e[0])};function vo(e,t){const n=e[lt];return(n?hn(n):e)[t]}function jm(e,t,n){var i;const r=pc(t,n);return r?"value"in r?r.value:(i=r.get)==null?void 0:i.call(e.draft_):void 0}function pc(e,t){if(!(t in e))return;let n=jn(e);for(;n;){const r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=jn(n)}}function Mo(e){e.modified_||(e.modified_=!0,e.parent_&&Mo(e.parent_))}function yo(e){e.copy_||(e.copy_=Do(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Pm=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(l=o,...u){return s.produce(l,d=>n.call(this,d,...u))}}typeof n!="function"&&rt(6),r!==void 0&&typeof r!="function"&&rt(7);let i;if(wn(t)){const o=Ns(this),s=Lo(t,void 0);let c=!0;try{i=n(s),c=!1}finally{c?ko(o):Fo(o)}return Es(o,r),Ts(i,o)}else if(!t||typeof t!="object"){if(i=n(t),i===void 0&&(i=t),i===cc&&(i=void 0),this.autoFreeze_&&wi(i,!0),r){const o=[],s=[];In("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,...c)=>this.produceWithPatches(s,l=>t(l,...c));let r,i;return[this.produce(t,n,(s,c)=>{r=s,i=c}),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){wn(e)||rt(8),Pn(e)&&(e=Dm(e));const t=Ns(this),n=Lo(e,void 0);return n[lt].isManual_=!0,Fo(t),n}finishDraft(e,t){const n=e&&e[lt];(!n||!n.isManual_)&&rt(9);const{scope_:r}=n;return Es(r,t),Ts(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=In("Patches").applyPatches_;return Pn(e)?r(e,t):this.produce(e,i=>r(i,t))}};function Lo(e,t){const n=Xr(e)?In("MapSet").proxyMap_(e,t):Yr(e)?In("MapSet").proxySet_(e,t):Am(e,t);return(t?t.scope_:dc()).drafts_.push(n),n}function Dm(e){return Pn(e)||rt(10,e),fc(e)}function fc(e){if(!wn(e)||Gr(e))return e;const t=e[lt];let n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=Do(e,t.scope_.immer_.useStrictShallowCopy_)}else n=Do(e,!0);return kr(n,(r,i)=>{uc(n,r,fc(i))}),t&&(t.finalized_=!1),n}var ut=new Pm,Un=ut.produce;ut.produceWithPatches.bind(ut);ut.setAutoFreeze.bind(ut);ut.setUseStrictShallowCopy.bind(ut);ut.applyPatches.bind(ut);ut.createDraft.bind(ut);ut.finishDraft.bind(ut);const hc=g.createContext(void 0),km={};function Zr(){const e=g.useContext(hc);if(!e)throw new Error("useObjectsConfigureState must be used within a ConfigurationProvider");return e}function Fm({children:e}){const{installation:t}=yt(),{hydratedRevision:n,loading:r}=Mn(),[i,o]=g.useState(km),s=t==null?void 0:t.config;g.useEffect(()=>{n!=null&&n.content&&!r&&s&&!(Object.entries(i).length>0)&&tf(n,s,o)},[n,r,s,i]);const c=g.useCallback((p,h)=>{o(v=>Un(v,I=>{I[p]=Un(I[p],h)}))},[o]),l=g.useCallback((p,h)=>{o(v=>Un(v,I=>{I[p]=h}))},[o]),u=g.useCallback(()=>{o(Un(p=>{const h=p.other.write;h&&(h.isWriteModified=!1)}))},[o]),d=g.useCallback(p=>{o(Un(h=>{var I;const v=(I=h[p])==null?void 0:I.read;v&&(v.isOptionalFieldsModified=!1,v.isRequiredMapFieldsModified=!1)}))},[o]),f=g.useCallback(p=>{p===tn?u():d(p)},[d,u]),m=g.useMemo(()=>({objectConfigurationsState:i,setObjectConfigurationsState:o,setConfigureState:c,resetConfigureState:l,resetPendingConfigurationState:f}),[i,l,f,c]);return a.jsx(hc.Provider,{value:m,children:e})}const sn=()=>{const{appName:e}=De(),{objectConfigurationsState:t,setConfigureState:n}=Zr(),{selectedObjectName:r}=ac(),i=aa(r||"",t);return{appName:e,configureState:i,setConfigureState:n,selectedObjectName:r}};function Mm(e,t,n){var i;const r=((i=e==null?void 0:e.read)==null?void 0:i.selectedFieldMappings)||{};if(r[t]=n,e!=null&&e.read){const o=e.read.savedConfig.requiredMapFields,c=!Wo(o,r);e.read.isRequiredMapFieldsModified=c}}function mc(e,t,n,r){t(e,i=>Mm(i,n,r))}function gc({field:e,onSelectChange:t,allFields:n}){var p;const{configureState:r,selectedObjectName:i,setConfigureState:o}=sn(),[s,c]=g.useState(!0),l=(p=r==null?void 0:r.read)==null?void 0:p.selectedFieldMappings,u=l==null?void 0:l[e.mapToName];g.useEffect(()=>{e._default&&!u&&i&&r&&mc(i,o,e.mapToName,e._default),c(!1)},[e,o,i,u,r]);const d=g.useMemo(()=>n==null?void 0:n.map(h=>a.jsx("option",{value:h.fieldName,children:h.displayName},h.fieldName)),[n]),f=g.useMemo(()=>n.map(h=>({id:h.fieldName,label:h.displayName,value:h.fieldName})),[n]),m=Pe?a.jsx(Th,{items:f,selectedValue:u||null,onSelectedItemChange:h=>{t({target:{name:e.mapToName,value:h==null?void 0:h.value}})},placeholder:u||"Please select one"}):a.jsx(T.Select,{name:e.mapToName,variant:"flushed",value:u||void 0,onChange:t,placeholder:u?void 0:"Please select one",disabled:s,children:d});return a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[a.jsxs("div",{style:{display:"flex",flexDirection:"row",gap:".25rem",marginBottom:".25rem"},children:[a.jsx("span",{style:{fontWeight:500},children:e.mapToDisplayName}),a.jsx("span",{children:(e==null?void 0:e.prompt)&&a.jsx(bm,{id:`tooltip-id-${e==null?void 0:e.prompt}`,tooltipText:e==null?void 0:e.prompt})})]}),m]},e.mapToName)}const Lm="_divider_j6suu_1",As={divider:Lm};function rr({className:e,style:t}){return Pe?a.jsx("hr",{className:e?`${As.divider} ${e}`:As.divider,style:t}):a.jsx(T.Divider,{className:e,style:t})}const $m=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-text-secondary").trim()||"#737373";function $n({string:e}){return a.jsxs("div",{style:{display:"flex",position:"relative",paddingTop:"2rem",paddingBottom:"1rem"},children:[a.jsx("h3",{style:{color:$m,fontSize:"1rem",fontWeight:"500"},children:e}),a.jsx("div",{style:{display:"flex",flex:1,justifyContent:"flex-end",alignItems:"center"},children:a.jsx(rr,{style:{marginLeft:"1rem"}})})]})}function Km(){const{selectedObjectName:e,configureState:t,setConfigureState:n}=sn(),{fieldMapping:r}=yt(),{isError:i,removeError:o}=on(),s=l=>{const{value:u,name:d}=l.target;u&&(e&&mc(e,n,d,u),i(Te.MAPPING,d)&&o(Te.MAPPING,d))},c=g.useMemo(()=>{var d;if(!e||!r)return[];const l=r?Object.values(r[e]||{}).flat():[];return(((d=t==null?void 0:t.read)==null?void 0:d.requiredMapFields)||[]).concat(l).reduce((f,m)=>f.find(h=>h.mapToName===m.mapToName)?f.map(h=>h.mapToName===m.mapToName?m:h):f.concat(m),new Array).filter(At)},[t,r,e]);return c.length?a.jsxs(a.Fragment,{children:[a.jsx($n,{string:"Map the following fields (required)"}),a.jsx("div",{style:{display:"flex",gap:"1rem",flexDirection:"column"},children:c.map(l=>{var u;return a.jsxs(T.FormControl,{isInvalid:i(Te.MAPPING,l.mapToName),children:[a.jsx(gc,{allFields:((u=t==null?void 0:t.read)==null?void 0:u.allFields)||[],field:l,onSelectChange:s}),a.jsx(T.FormErrorMessage,{children:" * required"})]},l.mapToName)})})]}):null}function Vm(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function vc(...e){return t=>e.forEach(n=>Vm(n,t))}function Zn(...e){return $.useCallback(vc(...e),e)}function Hm(e,t=[]){let n=[];function r(o,s){const c=$.createContext(s),l=n.length;n=[...n,s];const u=f=>{var C;const{scope:m,children:p,...h}=f,v=((C=m==null?void 0:m[e])==null?void 0:C[l])||c,I=$.useMemo(()=>h,Object.values(h));return a.jsx(v.Provider,{value:I,children:p})};u.displayName=o+"Provider";function d(f,m){var v;const p=((v=m==null?void 0:m[e])==null?void 0:v[l])||c,h=$.useContext(p);if(h)return h;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,d]}const i=()=>{const o=n.map(s=>$.createContext(s));return function(c){const l=(c==null?void 0:c[e])||o;return $.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return i.scopeName=e,[r,Bm(i,...t)]}function Bm(...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((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return $.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Ot(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=$.useRef(e);return $.useEffect(()=>{t.current=e}),$.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function bi({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,i]=Um({defaultProp:t,onChange:n}),o=e!==void 0,s=o?e:r,c=xi(n),l=$.useCallback(u=>{if(o){const f=typeof u=="function"?u(e):u;f!==e&&c(f)}else i(u)},[o,e,i,c]);return[s,l]}function Um({defaultProp:e,onChange:t}){const n=$.useState(e),[r]=n,i=$.useRef(r),o=xi(t);return $.useEffect(()=>{i.current!==r&&(o(r),i.current=r)},[r,i,o]),n}function qm(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 Lr=globalThis!=null&&globalThis.document?$.useLayoutEffect:()=>{};function Wm(e){const[t,n]=$.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,c;if("borderBoxSize"in o){const l=o.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,c=u.blockSize}else s=e.offsetWidth,c=e.offsetHeight;n({width:s,height:c})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function zm(e,t){return $.useReducer((n,r)=>t[n][r]??n,e)}var _i=e=>{const{present:t,children:n}=e,r=Jm(t),i=typeof n=="function"?n({present:r.isPresent}):$.Children.only(n),o=Zn(r.ref,Xm(i));return typeof n=="function"||r.isPresent?$.cloneElement(i,{ref:o}):null};_i.displayName="Presence";function Jm(e){const[t,n]=$.useState(),r=$.useRef({}),i=$.useRef(e),o=$.useRef("none"),s=e?"mounted":"unmounted",[c,l]=zm(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return $.useEffect(()=>{const u=xr(r.current);o.current=c==="mounted"?u:"none"},[c]),Lr(()=>{const u=r.current,d=i.current;if(d!==e){const m=o.current,p=xr(u);e?l("MOUNT"):p==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&m!==p?"ANIMATION_OUT":"UNMOUNT"),i.current=e}},[e,l]),Lr(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,f=p=>{const v=xr(r.current).includes(p.animationName);if(p.target===t&&v&&(l("ANIMATION_END"),!i.current)){const I=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=I)})}},m=p=>{p.target===t&&(o.current=xr(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",f),t.addEventListener("animationend",f),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",f),t.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:$.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function xr(e){return(e==null?void 0:e.animationName)||"none"}function Xm(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 $r=$.forwardRef((e,t)=>{const{children:n,...r}=e,i=$.Children.toArray(n),o=i.find(Gm);if(o){const s=o.props.children,c=i.map(l=>l===o?$.Children.count(s)>1?$.Children.only(null):$.isValidElement(s)?s.props.children:null:l);return a.jsx($o,{...r,ref:t,children:$.isValidElement(s)?$.cloneElement(s,void 0,c):null})}return a.jsx($o,{...r,ref:t,children:n})});$r.displayName="Slot";var $o=$.forwardRef((e,t)=>{const{children:n,...r}=e;if($.isValidElement(n)){const i=Qm(n);return $.cloneElement(n,{...Zm(r,n.props),ref:t?vc(t,i):i})}return $.Children.count(n)>1?$.Children.only(null):null});$o.displayName="SlotClone";var Ym=({children:e})=>a.jsx(a.Fragment,{children:e});function Gm(e){return $.isValidElement(e)&&e.type===Ym}function Zm(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]=(...c)=>{o(...c),i(...c)}:i&&(n[r]=i):r==="style"?n[r]={...i,...o}:r==="className"&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}function Qm(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 eg=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],an=eg.reduce((e,t)=>{const n=$.forwardRef((r,i)=>{const{asChild:o,...s}=r,c=o?$r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...s,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Ci="Checkbox",[tg,Dy]=Hm(Ci),[ng,rg]=tg(Ci),yc=$.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:i,defaultChecked:o,required:s,disabled:c,value:l="on",onCheckedChange:u,form:d,...f}=e,[m,p]=$.useState(null),h=Zn(t,b=>p(b)),v=$.useRef(!1),I=m?d||!!m.closest("form"):!0,[C=!1,w]=bi({prop:i,defaultProp:o,onChange:u}),_=$.useRef(C);return $.useEffect(()=>{const b=m==null?void 0:m.form;if(b){const x=()=>w(_.current);return b.addEventListener("reset",x),()=>b.removeEventListener("reset",x)}},[m,w]),a.jsxs(ng,{scope:n,state:C,disabled:c,children:[a.jsx(an.button,{type:"button",role:"checkbox","aria-checked":en(C)?"mixed":C,"aria-required":s,"data-state":xc(C),"data-disabled":c?"":void 0,disabled:c,value:l,...f,ref:h,onKeyDown:Ot(e.onKeyDown,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:Ot(e.onClick,b=>{w(x=>en(x)?!0:!x),I&&(v.current=b.isPropagationStopped(),v.current||b.stopPropagation())})}),I&&a.jsx(og,{control:m,bubbles:!v.current,name:r,value:l,checked:C,required:s,disabled:c,form:d,style:{transform:"translateX(-100%)"},defaultChecked:en(o)?!1:o})]})});yc.displayName=Ci;var wc="CheckboxIndicator",Ic=$.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...i}=e,o=rg(wc,n);return a.jsx(_i,{present:r||en(o.state)||o.state===!0,children:a.jsx(an.span,{"data-state":xc(o.state),"data-disabled":o.disabled?"":void 0,...i,ref:t,style:{pointerEvents:"none",...e.style}})})});Ic.displayName=wc;var og=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:i,...o}=e,s=$.useRef(null),c=qm(n),l=Wm(t);$.useEffect(()=>{const d=s.current,f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==n&&p){const h=new Event("click",{bubbles:r});d.indeterminate=en(n),p.call(d,en(n)?!1:n),d.dispatchEvent(h)}},[c,n,r]);const u=$.useRef(en(n)?!1:n);return a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:i??u.current,...o,tabIndex:-1,ref:s,style:{...e.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function en(e){return e==="indeterminate"}function xc(e){return en(e)?"indeterminate":e?"checked":"unchecked"}var bc=yc,_c=Ic;function Cc(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 ig=["color"],Sc=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Cc(e,ig);return g.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),g.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),sg=["color"],ag=g.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,i=Cc(e,sg);return g.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},i,{ref:t}),g.createElement("path",{d:"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 cg="_checkboxGroupContainer_j54z7_1",lg="_stack_j54z7_6",ug="_selectAllContainer_j54z7_11",dg="_fieldContainer_j54z7_18",pg="_checkbox_j54z7_1",Dn={checkboxGroupContainer:cg,stack:lg,selectAllContainer:ug,fieldContainer:dg,checkbox:pg};function Oc({id:e,isChecked:t,label:n,onCheckedChange:r}){return a.jsxs("div",{className:Dn.fieldContainer,children:[a.jsx(bc,{className:Dn.checkbox,id:e,onCheckedChange:r,checked:t,children:a.jsx(_c,{children:a.jsx(Sc,{})})}),a.jsx("label",{htmlFor:e,style:{overflowWrap:"anywhere"},children:n})]})}function Ec({id:e,isChecked:t,label:n,onCheckedChange:r,isIndeterminate:i}){return a.jsxs("div",{className:Dn.selectAllContainer,children:[a.jsx(bc,{className:Dn.checkbox,id:e,onCheckedChange:r,children:a.jsxs(_c,{children:[i&&a.jsx(ag,{}),t===!0&&a.jsx(Sc,{})]})}),a.jsx("label",{htmlFor:e,children:n})]})}function Nc({children:e}){return a.jsx("div",{className:Dn.checkboxGroupContainer,children:e})}function Tc({children:e}){return a.jsx("div",{className:Dn.stack,children:e})}function fg(e,t,n){var i,o;const r=((i=e==null?void 0:e.read)==null?void 0:i.selectedOptionalFields)||{};if(r[t]=n,n||delete r[t],(o=e.read)!=null&&o.savedConfig.optionalFields){const s=e.read.savedConfig.optionalFields,l=!Wo(s,r);e.read.isOptionalFieldsModified=l}else console.warn("read.savedConfig.optionalFields is undefined")}function Kr(e,t,n,r){t(e,i=>fg(i,n,r))}function hg(){var f,m;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=sn(),i=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,o=(p,h)=>{p!=="indeterminate"&&r&&t&&Kr(r,n,h,p)},s=(m=t==null?void 0:t.read)==null?void 0:m.optionalFields,c=p=>{r&&s&&s.forEach(h=>{At(h)||Kr(r,n,h.fieldName,p)})},l=!!(s&&s.length>0),u=Object.keys(i||{}).length===(s==null?void 0:s.length),d=!u&&Object.keys(i||{}).length>0;return l&&a.jsxs(a.Fragment,{children:[a.jsx($n,{string:`${e} reads the following optional fields`}),a.jsxs(Nc,{children:[((s==null?void 0:s.length)||0)>=2&&a.jsx(Ec,{id:"select-all-fields",isChecked:u,label:"Select all",onCheckedChange:c,isIndeterminate:d}),a.jsx(Tc,{children:s.map(p=>At(p)?null:a.jsx(Oc,{id:p.fieldName,isChecked:!!(i!=null&&i[p==null?void 0:p.fieldName]),label:p.displayName,onCheckedChange:h=>o(h,p.fieldName)},p.fieldName))})]})]})}function mg(){var f,m;const{appName:e,configureState:t,setConfigureState:n,selectedObjectName:r}=sn(),i=(f=t==null?void 0:t.read)==null?void 0:f.selectedOptionalFields,o=p=>{const{name:h,checked:v}=p.target;r&&t&&Kr(r,n,h,v)},s=(m=t==null?void 0:t.read)==null?void 0:m.optionalFields,c=p=>{const{checked:h}=p.target;r&&s&&s.forEach(v=>{At(v)||Kr(r,n,v.fieldName,h)})},l=!!(s&&s.length>0),u=Object.keys(i||{}).length===(s==null?void 0:s.length),d=!u&&Object.keys(i||{}).length>0;return l&&a.jsxs(a.Fragment,{children:[a.jsx($n,{string:`${e} reads the following optional fields`}),a.jsxs(T.Stack,{marginBottom:10,maxHeight:300,overflowY:"scroll",border:"2px solid #EFEFEF",borderRadius:8,gap:0,children:[((s==null?void 0:s.length)||0)>=2&&a.jsx(T.Box,{backgroundColor:"gray.50",paddingX:4,paddingY:2,children:a.jsx(T.Checkbox,{name:"selectAll",id:"selectAll",onChange:c,isIndeterminate:d,isChecked:u,children:"Select all"})}),s.map(p=>At(p)?null:a.jsx(T.Box,{paddingX:4,paddingY:2,borderBottom:"1px",borderColor:"gray.100",children:a.jsx(T.Checkbox,{name:p.fieldName,id:p.fieldName,isChecked:!!(i!=null&&i[p==null?void 0:p.fieldName]),onChange:o,children:a.jsx("p",{style:{overflowWrap:"anywhere"},children:p.displayName})})},p.fieldName))]})]})}function gg(){return Pe?a.jsx(hg,{}):a.jsx(mg,{})}const vg=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-badge").trim()||"#e5e5e5",yg=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-badge-text").trim()||"#404040",wg={color:yg,backgroundColor:vg,borderRadius:"4px",display:"inline-block",fontSize:"0.75rem",fontWeight:500,lineHeight:"1.25",padding:"0.25rem 0.5rem"};function Ig({children:e,style:t,...n}){return a.jsx("span",{style:{...wg,...t},...n,children:e})}function xg(){var r,i,o;const{configureState:e,selectedObjectName:t}=sn(),{appName:n}=De();return a.jsxs(a.Fragment,{children:[a.jsx($n,{string:`${n} reads the following ${t} fields`}),a.jsx("div",{style:{display:"flex",gap:".5rem",marginBottom:"2rem"},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=>At(s)?null:a.jsx(Ig,{children:s.displayName},s.fieldName)):"There are no required fields."})]})}function bg(){return a.jsxs(a.Fragment,{children:[a.jsx(xg,{}),a.jsx(Km,{}),a.jsx(gg,{})]})}function _g(e,t,n){var r,i,o;if(((r=e==null?void 0:e.write)==null?void 0:r.selectedNonConfigurableWriteFields)===null&&(e.write.selectedNonConfigurableWriteFields={}),e!=null&&e.write){const s=e.write.selectedNonConfigurableWriteFields;if(s[t]=n,n||delete s[t],(o=(i=e==null?void 0:e.write)==null?void 0:i.savedConfig)!=null&&o.selectedNonConfigurableWriteFields){const c=e.write.savedConfig.selectedNonConfigurableWriteFields,u=!Wo(c,s);e.write.isWriteModified=u}}}function Vr(e,t,n,r){t(e,i=>{_g(i,n,r)})}function Cg(){var f,m,p,h;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=sn(),i=(f=n==null?void 0:n.write)==null?void 0:f.selectedNonConfigurableWriteFields,o=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects,s=(v,I)=>{v!=="indeterminate"&&t&&n&&Vr(t,r,I,v)},c=v=>{var I,C;t&&n&&((C=(I=n==null?void 0:n.write)==null?void 0:I.writeObjects)==null||C.forEach(w=>{Vr(t,r,w.objectName,v)}))},l=!!o,u=Object.keys(i||{}).length===((h=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null?void 0:h.length),d=!u&&Object.keys(i||{}).length>0;return l&&a.jsxs(a.Fragment,{children:[a.jsx($n,{string:`Allow ${e} to write to these objects`}),a.jsxs(Nc,{children:[((o==null?void 0:o.length)||0)>=2&&a.jsx(Ec,{id:"select-all-fields",onCheckedChange:c,isIndeterminate:d,isChecked:u,label:"Select all"}),a.jsx(Tc,{children:o.map(v=>a.jsx(Oc,{id:v.objectName,onCheckedChange:I=>s(I,v.objectName),isChecked:!!(i!=null&&i[v.objectName]),label:v.displayName},v.objectName))})]})]})}function Sg(){var f,m,p,h;const{appName:e,selectedObjectName:t,configureState:n,setConfigureState:r}=sn(),i=(f=n==null?void 0:n.write)==null?void 0:f.selectedNonConfigurableWriteFields,o=(m=n==null?void 0:n.write)==null?void 0:m.writeObjects,s=v=>{const{name:I,checked:C}=v.target;t&&n&&Vr(t,r,I,C)},c=v=>{var C,w;const{checked:I}=v.target;t&&n&&((w=(C=n==null?void 0:n.write)==null?void 0:C.writeObjects)==null||w.forEach(_=>{Vr(t,r,_.objectName,I)}))},l=!!o,u=Object.keys(i||{}).length===((h=(p=n==null?void 0:n.write)==null?void 0:p.writeObjects)==null?void 0:h.length),d=!u&&Object.keys(i||{}).length>0;return l&&a.jsxs(a.Fragment,{children:[a.jsx($n,{string:`Allow ${e} to write to these objects`}),a.jsxs(T.Stack,{marginBottom:10,maxHeight:300,overflowY:"scroll",border:"2px solid #EFEFEF",borderRadius:8,gap:0,children:[((o==null?void 0:o.length)||0)>=2&&a.jsx(T.Box,{backgroundColor:"gray.50",paddingX:4,paddingY:2,children:a.jsx(T.Checkbox,{name:"selectAll",id:"selectAll",onChange:c,isIndeterminate:d,isChecked:u,children:"Select all"})}),o.map(v=>a.jsx(T.Box,{display:"flex",alignItems:"center",borderBottom:"1px",borderColor:"gray.100",paddingX:4,paddingY:2,children:a.jsx(T.Checkbox,{name:v.objectName,id:v.objectName,onChange:s,isChecked:!!(i!=null&&i[v.objectName]),children:a.jsx("p",{style:{overflowWrap:"anywhere"},children:v.displayName})})},v.objectName))]})]})}function Og(){return Pe?a.jsx(Cg,{}):a.jsx(Sg,{})}function Eg(){const e=Ve(),{projectId:t,appName:n}=De(),{integrationId:r,installation:i,resetInstallations:o,setIntegrationDeleted:s,onUninstallSuccess:c}=yt(),[l,u]=g.useState(!1),d=!t||!r||!(i!=null&&i.id)||l,f=async()=>{if(!d){u(!0),console.warn("uninstalling installation",{projectId:t,integrationId:r,installationId:i.id});try{await Se().installationApi.deleteInstallation({projectIdOrName:t,integrationId:r,installationId:i.id},{headers:{"X-Api-Key":e,"Content-Type":"application/json"}}),console.warn("successfully uninstalled installation: ",i.id),c==null||c(i==null?void 0:i.id),o(),s()}catch(v){console.error("Error uninstalling installation."),Ye(v)}finally{u(!1)}}},m=l?"Uninstalling...":"Yes, uninstall",p=i!=null&&i.id?`Once you uninstall this integration, all your configuration will be lost, and "${n}" may stop working.`:"You've successfully uninstalled the integration.",h=Pe?a.jsx(vt,{type:"button",onClick:f,disabled:d,variant:"danger",children:m}):a.jsx(T.Button,{onClick:f,variant:"warning",isDisabled:d,children:m});return a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[a.jsx("p",{children:p}),(i==null?void 0:i.id)&&h]})}const Ng=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-neutral-100").trim()||"#f5f5f5",Tg=getComputedStyle(document.documentElement).getPropertyValue("--amp-shadows-sm").trim()||"0 1px 2px 0 rgba(0, 0, 0, 0.05)";function Rc({onSave:e,onReset:t,isLoading:n,isCreateMode:r=!1,errorMsg:i}){var O,M,E;const{installation:o}=yt(),{hydratedRevision:s,loading:c}=Mn(),{configureState:l,selectedObjectName:u}=sn(),d=o==null?void 0:o.config,f=d&&u&&!!ta(d,u)||!1,m=((O=l==null?void 0:l.read)==null?void 0:O.isOptionalFieldsModified)||((M=l==null?void 0:l.read)==null?void 0:M.isRequiredMapFieldsModified),p=(E=l==null?void 0:l.write)==null?void 0:E.isWriteModified,C=c||n||!l||!u||!(m||p||r||u!==tn&&!f),w=u===tn,_=u===Jn,b=Pe?a.jsx(vt,{type:"submit",disabled:C,children:r?"Install":"Save"}):a.jsx(T.Button,{type:"submit",variant:"primary",isDisabled:C,children:r?"Install":"Save"}),x=Pe?a.jsx(vt,{type:"button",onClick:t,disabled:C,variant:"ghost",children:"Reset"}):a.jsx(T.Button,{isDisabled:C,onClick:t,children:"Reset"});return n?a.jsx(Et,{}):a.jsxs("form",{style:{width:"34rem"},onSubmit:e,children:[a.jsxs("div",{style:{display:"flex",flexDirection:"row-reverse",gap:"1rem",marginBottom:"2rem"},children:[b,x]}),a.jsxs(xn,{style:{padding:"2rem",minHeight:"300px",backgroundColor:"white",borderColor:Ng,boxShadow:Tg},children:[i&&a.jsx(la,{children:typeof i=="string"?i:"Installation Failed."}),c&&a.jsx(Et,{}),s&&!_&&!w&&a.jsx(bg,{}),s&&!_&&w&&a.jsx(Og,{}),!c&&_&&a.jsx(Eg,{})]})]})}const Ac=()=>{const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,onInstallSuccess:i,onUpdateSuccess:o}=yt(),{hydratedRevision:s,loading:c}=Mn(),{selectedObjectName:l}=ac(),{selectedConnection:u}=Fn(),d=Ve(),{projectId:f}=De(),{resetBoundary:m,setErrors:p,setError:h,getError:v}=on(),{resetConfigureState:I,objectConfigurationsState:C,resetPendingConfigurationState:w}=Zr(),_=aa(l||"",C),{onNextIncompleteTab:b}=_m(),x=g.useCallback(()=>{m(Te.INSTALLATION_MUTATION)},[m]),O=g.useCallback(E=>E?V=>{h(Te.INSTALLATION_MUTATION,E,V)}:V=>{console.error("objectName is required to set installation error: ",V)},[h]),M=g.useCallback(E=>E?v(Te.INSTALLATION_MUTATION,E):"",[v]);return{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:s,loading:c,selectedObjectName:l,selectedConnection:u,apiKey:d,projectId:f,resetBoundary:m,setErrors:p,setMutateInstallationError:O,getMutateInstallationError:M,resetMutateInstallationErrorState:x,resetConfigureState:I,objectConfigurationsState:C,resetPendingConfigurationState:w,configureState:_,onInstallSuccess:i,onUpdateSuccess:o,onNextIncompleteTab:b}},Rg=void 0;function Ag(){const{integrationId:e,groupRef:t,consumerRef:n,setInstallation:r,hydratedRevision:i,loading:o,selectedObjectName:s,selectedConnection:c,apiKey:l,projectId:u,resetBoundary:d,setErrors:f,setMutateInstallationError:m,getMutateInstallationError:p,resetMutateInstallationErrorState:h,resetConfigureState:v,objectConfigurationsState:I,resetPendingConfigurationState:C,configureState:w,onInstallSuccess:_,onNextIncompleteTab:b}=Ac(),[x,O]=g.useState(!1),M=s===tn,E=p(s),V=g.useCallback(()=>{d(Te.MAPPING),i!=null&&i.content&&!o&&s&&oa(i,Rg,s,v)},[d,i,o,s,v]);g.useEffect(()=>{!w&&(i!=null&&i.content)&&!o&&V()},[w,I,i,o,V]);const z=()=>{h();const{requiredMapFields:te,selectedFieldMappings:q}=(w==null?void 0:w.read)||{},{errorList:ae}=na(te,q,f);ae.length>0||(s&&(c!=null&&c.id)&&l&&u&&e&&t&&n&&i?(O(!0),of(u,e,t,n,c.id,s,l,i,w,m(s),r,_).finally(()=>{O(!1),C(s),b()})):console.error("CreateInstallallation - onSaveReadCreate: missing required props"))},X=()=>{h(),s&&(c!=null&&c.id)&&l&&u&&e&&t&&n&&i?(O(!0),cf(u,e,t,n,c.id,l,i,w,m(s),r,_).finally(()=>{O(!1),C(s),b()})):console.error("CreateInstallallation - onSaveWriteCreate: missing required props")},Z=te=>{te.preventDefault(),M?X():z()};return a.jsx(Rc,{errorMsg:E,isCreateMode:!0,isLoading:x,onSave:Z,onReset:V})}function jg({updateConfig:e,projectId:t,integrationId:n,installationId:r,apiKey:i,selectedObjectName:o,setInstallation:s,onUpdateSuccess:c,setError:l}){const u={projectIdOrName:t,installationId:r,integrationId:n,installationUpdate:{updateMask:[`config.content.read.objects.${o}`],installation:{config:e}}};return Se().installationApi.updateInstallation(u,{headers:{"X-Api-Key":i,"Content-Type":"application/json"}}).then(d=>{s(d),c==null||c(d.id,d.config)}).catch(d=>{Ye(d,l)})}const Pg=(e,t,n,r,i,o)=>{const s=ia(e),c=sa(e),l={content:{read:{objects:{[t]:{objectName:t,schedule:r,destination:(n==null?void 0:n.destination)||"",selectedFields:s,selectedFieldMappings:c,backfill:o}}}}};return Br(i)&&(l.content||(l.content={}),l.content.proxy={enabled:!0}),l},Dg=(e,t,n,r,i,o,s,c,l,u,d)=>{const f=Pg(o,r||"",c,c.schedule,l,c.backfill);return f?jg({updateConfig:f,projectId:e,integrationId:t,installationId:n,apiKey:i,selectedObjectName:r,setError:u,setInstallation:s,onUpdateSuccess:d}):(console.error("Error when generating updateConfig from configureState"),Promise.resolve(null))},kg=(e,t)=>{const r={content:{write:{objects:ca(e)}}};return Br(t)&&(r.content||(r.content={}),r.content.proxy={enabled:!0}),r},Fg=(e,t,n,r,i,o,s,c,l)=>{const u=kg(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 Se().installationApi.updateInstallation(d,{headers:{"X-Api-Key":r,"Content-Type":"application/json"}}).then(f=>{c(f),l==null||l(f.id,f.config)}).catch(f=>{Ye(f,s)})};function Mg({installation:e,integrationObj:t}){const{setInstallation:n,hydratedRevision:r,loading:i,selectedObjectName:o,apiKey:s,projectId:c,resetBoundary:l,setErrors:u,setMutateInstallationError:d,getMutateInstallationError:f,resetConfigureState:m,resetPendingConfigurationState:p,configureState:h,onUpdateSuccess:v,onNextIncompleteTab:I}=Ac(),[C,w]=g.useState(!1),_=o===tn,b=f(o),{config:x}=e,O=g.useCallback(()=>{l(Te.MAPPING),r!=null&&r.content&&!i&&o&&oa(r,x,o,m)},[l,r,i,o,x,m]);g.useEffect(()=>{h||O()},[h,O]),g.useEffect(()=>{e&&O()},[e,O]);const M=g.useMemo(()=>{var Z,te,q;return(q=(te=(Z=r==null?void 0:r.content)==null?void 0:Z.read)==null?void 0:te.objects)==null?void 0:q.find(ae=>(ae==null?void 0:ae.objectName)===o)},[r,o]),E=()=>{const{requiredMapFields:X,selectedFieldMappings:Z}=(h==null?void 0:h.read)||{},{errorList:te}=na(X,Z,u);te.length>0||(r&&e&&o&&s&&c&&M?(w(!0),Dg(c,t.id,e.id,o,s,h,n,M,r,d(o),v).finally(()=>{w(!1),p(o),I()})):console.error("UpdateInstallation - onSaveUpdate missing required props"))},V=()=>{e&&o&&s&&c&&r?(w(!0),Fg(c,t.id,e.id,s,h,r,d(o),n,v).finally(()=>{w(!1),p(o),I()})):console.error("UpdateInstallation - onSaveUpdate missing required props")},z=X=>{X.preventDefault(),_?V():E()};return a.jsx(Rc,{errorMsg:b,onSave:z,onReset:O,isLoading:C})}function Lg(){const{integrationObj:e,installation:t}=yt();return e?t&&e?a.jsx(Mg,{installation:t,integrationObj:e}):a.jsx(Ag,{}):a.jsx(Ut,{message:"We can't load the integration"})}function $g(){return a.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[a.jsx("circle",{cx:"24",cy:"24",r:"24",fill:"#BBF7D0"}),a.jsx("path",{d:"M34.6666 18.6667L20 32.0001L13.3333 25.9395",stroke:"#16A34A",strokeWidth:"5.33333",strokeLinecap:"round",strokeLinejoin:"round"})]})}function Si({text:e,children:t}){return a.jsx(kn,{children:a.jsxs(xn,{style:{display:"flex",flexDirection:"column",alignItems:"center",padding:"3rem",gap:"3rem",boxShadow:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)"},children:[a.jsx($g,{}),a.jsx("p",{children:e}),t]})})}const Kg=(e,t)=>({revisionId:e.id,createdBy:`consumer:${t}`,content:{provider:e.content.provider,proxy:{enabled:!0}}});function Vg({projectId:e,integrationId:t,groupRef:n,consumerRef:r,connectionId:i,apiKey:o,hydratedRevision:s,setError:c,setInstallation:l,onInstallSuccess:u}){const d=Kg(s,r);return d?zo({createConfig:d,projectId:e,integrationId:t,groupRef:n,connectionId:i,apiKey:o,setError:c,setInstallation:l,onInstallSuccess:u}):(console.error("Error when generating createConfig from configureState"),Promise.resolve(null))}function Hg({provider:e}){const t=`You have successfully installed your ${Pt(e)} integration.`;return a.jsx(Si,{text:t})}const Bg=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 Ug({children:e,resetComponent:t}){var b;const{projectId:n}=De(),r=Ve(),{hydratedRevision:i,loading:o}=Mn(),{integrationObj:s,installation:c,groupRef:l,consumerRef:u,setInstallation:d,onInstallSuccess:f,isIntegrationDeleted:m}=yt(),{selectedConnection:p}=Fn(),[h,v]=g.useState(!1),I=o||h,C=(b=i==null?void 0:i.content)==null?void 0:b.provider,w=Bg(i),_=x=>{console.error("Error when creating proxy installation:",x)};return g.useEffect(()=>{!I&&i&&w&&!c&&p&&r&&(s!=null&&s.id)&&(v(!0),Vg({apiKey:r,projectId:n,integrationId:s==null?void 0:s.id,groupRef:l,consumerRef:u,connectionId:p==null?void 0:p.id,hydratedRevision:i,setError:_,setInstallation:d,onInstallSuccess:f}).then(()=>{v(!1)}).catch(x=>{v(!1),console.error("Error when creating proxy installation:",x)}))},[i,w,c,p,r,n,s==null?void 0:s.id,l,u,d,I,f]),s?I?a.jsx(Et,{}):w&&C&&c?a.jsx(Hg,{provider:C}):m?a.jsx(Si,{text:"Integration successfully uninstalled.",children:Pe&&a.jsx(vt,{type:"button",onClick:t,style:{width:"100%"},children:"Reinstall Integration"})}):a.jsx("div",{children:e}):a.jsx(Ut,{message:"We can't load the integration"})}function Oi(){return a.jsxs("footer",{style:{backgroundColor:"#EFEFEF",padding:"1em",fontSize:"0.8em",color:"gray",display:"flex",justifyContent:"center",alignItems:"center",borderRadius:"0 0 4px 4px",gap:"0.4em"},children:[a.jsx("p",{children:"Secured by"}),a.jsx("a",{href:"https://www.withampersand.com/",target:"_blank","aria-label":"Go to Ampersand",rel:"noreferrer noopener",children:a.jsx("img",{style:{height:".8em"},src:"https://ampersand-website.vercel.app/logo-black.svg",alt:"Ampersand"})})]})}function dt({children:e}){return a.jsx(kn,{children:a.jsxs(xn,{children:[a.jsx("div",{style:{padding:"3rem 2rem"},children:e}),a.jsx(Oi,{})]})})}function or({children:e}){return a.jsx("h1",{style:{fontWeight:600,lineHeight:1.2,fontSize:"1.2em"},children:e})}function pt({error:e}){return e?a.jsx(la,{style:{marginTop:"2em"},children:e}):null}function Ei({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,children:i,title:o}){if(!o&&!r)throw new Error("Either title or providerName is required");return a.jsxs(dt,{children:[a.jsx(or,{children:o||`Set up ${r} integration`}),a.jsx(pt,{error:t}),i,a.jsx(vt,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]})}const qg="_link_oo2kv_1",Wg={link:qg};function Ni({href:e,className:t,style:n,label:r,children:i,newTab:o=!1}){return Pe?a.jsx("a",{className:Wg.link,style:n,href:e,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,children:i}):a.jsx(T.Link,{href:e,className:t,style:n,"aria-label":r||void 0,target:o?"_blank":"_self",rel:o?"noopener noreferrer":void 0,color:"#737373",children:i})}const zg=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-text-secondary").trim()||"#737373";function Qr({url:e,providerDisplayName:t,credentialName:n}){return a.jsxs("p",{style:{color:zg},children:[a.jsx(Ni,{href:e,newTab:!0,children:a.jsx("span",{style:{textDecoration:"underline"},children:"Learn more"})})," about where to find your ",t," ",n,"."]})}const Jg="_input_19woe_1",Xg="_inputError_19woe_17",Yg="_error_19woe_31",wo={input:Jg,inputError:Xg,error:Yg};function Gg({id:e,type:t,className:n,isError:r=!1,...i}){const o=r?qt(wo.inputError,wo.input):wo.input;return a.jsx("input",{id:e,type:t,className:qt(o,n),...i})}const Zg="_textarea_1efhx_1",Qg="_textareaError_1efhx_13",ev="_error_1efhx_27",Io={textarea:Zg,textareaError:Qg,error:ev};function tv({className:e,isError:t=!1,...n}){const r=t?qt(Io.textareaError,Io.textarea):Io.textarea;return a.jsx("textarea",{className:qt(e,r),...n})}const Bt={Input:Gg,Textarea:tv};function nv({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var v;const[o,s]=g.useState(!1),c=()=>s(!o),[l,u]=g.useState(""),d=I=>u(I.currentTarget.value),f=l.length>0,m=i||!f,p=Pt(e,t),h=(v=t.apiKeyOpts)==null?void 0:v.docsURL;return a.jsx(dt,{children:a.jsxs(T.FormControl,{children:[a.jsx(T.FormLabel,{my:"6",children:a.jsx(T.Heading,{as:"h4",size:"md",children:`Set up ${p} integration`})}),a.jsx(pt,{error:r}),a.jsxs(T.Stack,{spacing:4,children:[h&&a.jsx(Qr,{url:h,providerDisplayName:p,credentialName:"API key"}),a.jsxs(T.InputGroup,{size:"md",children:[a.jsx(T.Input,{onChange:d,pr:"4.5rem",type:o?"text":"password",placeholder:"API Key"}),a.jsx(T.InputRightElement,{width:"4.5rem",children:a.jsx(T.Button,{h:"1.75rem",size:"sm",onClick:c,children:o?"Hide":"Show"})})]})]}),a.jsx("br",{}),a.jsx(T.Button,{variant:"primary",isDisabled:m,width:"100%",type:"submit",onClick:()=>{n({apiKey:l})},children:"Next"})]})})}function rv({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var v;const[o,s]=g.useState(!1),c=()=>s(I=>!I),[l,u]=g.useState(""),d=I=>u(I.currentTarget.value),f=l.length>0,m=i||!f,p=Pt(e,t),h=(v=t.apiKeyOpts)==null?void 0:v.docsURL;return a.jsx(Ei,{providerName:p,handleSubmit:()=>{n({apiKey:l})},error:r,isButtonDisabled:m,children:a.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[h&&a.jsx(Qr,{url:h,providerDisplayName:p,credentialName:"API key"}),a.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[a.jsx(Bt.Input,{id:"password",name:"password",type:o?"text":"password",placeholder:"Password",onChange:I=>d(I)}),a.jsx(vt,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,children:o?"Hide":"Show"})]})]})})}function ov({...e}){return Pe?a.jsx(rv,{...e}):a.jsx(nv,{...e})}function iv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:c,setSelectedConnection:l}){const u=De(),[d,f]=g.useState(!1),[m,p]=g.useState(null),h=Ve();g.useEffect(()=>{if(e&&Se&&d&&m!=null){const I={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,apiKey:m};Se().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:I},{headers:{"X-Api-Key":h??"","Content-Type":"application/json"}}).then(C=>{l(C)}).catch(C=>{console.error("Error loading provider info."),Ye(C)})}},[h,e,d,r,n,o,i,u,l,m]);const v=I=>{p(I.apiKey),f(!0)};return c===null?a.jsx(ov,{provider:e,providerInfo:t,handleSubmit:v,error:null}):s}function sv({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var w;const[o,s]=g.useState(!1),c=()=>s(!o),[l,u]=g.useState(""),[d,f]=g.useState(""),m=_=>u(_.currentTarget.value),p=_=>f(_.currentTarget.value),h=Pt(e,t),v=(w=t.basicOpts)==null?void 0:w.docsURL,I=l.length>0,C=i||!I;return a.jsx(dt,{children:a.jsxs(T.FormControl,{children:[a.jsx(T.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(T.Heading,{as:"h4",size:"md",children:`Set up ${h} integration`})}),a.jsx(pt,{error:r}),a.jsx("br",{}),a.jsxs(T.Stack,{spacing:4,children:[v&&a.jsx(Qr,{url:v,providerDisplayName:h,credentialName:"credentials"}),a.jsx(T.Input,{placeholder:"Username",onChange:m}),a.jsxs(T.InputGroup,{size:"md",children:[a.jsx(T.Input,{onChange:p,pr:"4.5rem",type:o?"text":"password",placeholder:"Password"}),a.jsx(T.InputRightElement,{width:"4.5rem",children:a.jsx(T.Button,{h:"1.75rem",size:"sm",onClick:c,children:o?"Hide":"Show"})})]})]}),a.jsx("br",{}),a.jsx(T.Button,{variant:"primary",isDisabled:C,width:"100%",type:"submit",onClick:()=>{n({user:l,pass:d})},children:"Next"})]})})}function av({provider:e,providerInfo:t,handleSubmit:n,error:r,isButtonDisabled:i}){var C;const[o,s]=g.useState(!1),c=()=>s(w=>!w),[l,u]=g.useState({username:"",password:""}),{username:d,password:f}=l,m=Pt(e,t),p=(C=t.basicOpts)==null?void 0:C.docsURL,h=d.length>0,v=i||!h,I=w=>{const{name:_,value:b}=w.currentTarget;u(x=>({...x,[_]:b}))};return a.jsx(Ei,{providerName:m,handleSubmit:()=>{n({user:d,pass:f})},error:r,isButtonDisabled:v,children:a.jsxs("div",{style:{display:"flex",gap:"1rem",flexDirection:"column",marginTop:"1rem"},children:[p&&a.jsx(Qr,{url:p,providerDisplayName:m,credentialName:"credentials"}),a.jsx(Bt.Input,{id:"username",name:"username",type:"text",placeholder:"Username",onChange:w=>I(w)}),a.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[a.jsx(Bt.Input,{id:"password",name:"password",type:o?"text":"password",placeholder:"Password",onChange:w=>I(w)}),a.jsx(vt,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:c,children:o?"Hide":"Show"})]})]})})}function cv({...e}){return Pe?a.jsx(av,{...e}):a.jsx(sv,{...e})}function lv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,children:s,selectedConnection:c,setSelectedConnection:l}){const u=De(),[d,f]=g.useState(!1),[m,p]=g.useState(null),h=Ve();g.useEffect(()=>{if(e&&Se&&d&&m!=null){const I={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,basicAuth:{username:m.user,password:m.pass}};Se().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:I},{headers:{"X-Api-Key":h??"","Content-Type":"application/json"}}).then(C=>{l(C)}).catch(C=>{console.error("Error loading provider info."),Ye(C)})}},[h,e,d,r,n,o,i,u,m,l]);const v=I=>{const{user:C,pass:w}=I;p({user:C,pass:w}),f(!0)};return c===null?a.jsx(cv,{provider:e,providerInfo:t,handleSubmit:v,error:null}):s}function uv({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return a.jsx(dt,{children:a.jsxs(T.FormControl,{children:[a.jsx(T.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(T.Heading,{as:"h4",size:"md",children:`Set up ${r} integration`})}),a.jsx(pt,{error:t}),a.jsx("br",{}),a.jsx(T.Button,{variant:"primary",isDisabled:n,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function dv({...e}){return Pe?a.jsx(Ei,{...e}):a.jsx(uv,{...e})}function pv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,selectedConnection:s,setSelectedConnection:c,providerName:l}){const u=De(),d=Ve(),[f,m]=g.useState(!1);g.useEffect(()=>{if(e&&Se&&f){const h={groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e};Se().connectionApi.generateConnection({projectIdOrName:u.projectId,generateConnectionParams:h},{headers:{"X-Api-Key":d??"","Content-Type":"application/json"}}).then(v=>{c(v)}).catch(v=>{console.error("Error loading provider info."),Ye(v)})}},[d,e,f,n,t,i,r,c,u]);const p=()=>{m(!0)};return s===null?a.jsx(dv,{handleSubmit:p,error:null,providerName:l}):o}const jc=async(e,t,n,r,i,o,s,c)=>{var u;const l=await Se().providerApi.getProvider({provider:i},{headers:{"X-Api-Key":r??""}});if(!l)throw new Error(`Provider ${i} not found`);if(l.authType==="oauth2"&&((u=l.oauth2Opts)==null?void 0:u.grantType)==="authorizationCode"){const f=(await Se().providerAppApi.listProviderApps({projectIdOrName:e},{headers:{"X-Api-Key":r??""}})).find(v=>v.provider===i),m=Pt(i,l);if(!f)throw new Error(`You must first set up a ${m} Provider App using the Ampersand Console.`);const p={connectOAuthParams:{providerWorkspaceRef:o,projectId:e,groupRef:n,groupName:c,consumerRef:t,consumerName:s,providerAppId:f.id,provider:i}};return await Se().oAuthApi.oauthConnect(p)}throw new Error(`Provider ${i} does not support an OAuth2 web flow.`)},js=600,Ps=600,fv="AUTHORIZATION_SUCCEEDED",hv="AUTHORIZATION_FAILED";function mv(e,t,n){return g.useCallback(async r=>{const i=await Se().connectionApi.getConnection({projectIdOrName:e,connectionId:r},{headers:{"X-Api-Key":t??""}});n(i)},[e,t,n])}function gv(e,t,n,r){return g.useCallback(()=>{if(!r)return;const i=window.screenX+(window.outerWidth-js)/2,o=window.screenY+(window.outerHeight-Ps)/2.5,s=`width=${js},height=${Ps},left=${i},top=${o}`,c=window.open(r,e,s);t(c),window.addEventListener("message",n,!1)},[r,e,t,n])}function vv(e,t){return g.useCallback(n=>{var r,i;if(n.origin===Np){if(n.data.eventType===fv){const o=(r=n.data.data)==null?void 0:r.connection;o?e(o):console.error("Connection ID not found in event data: ",{event:n})}n.data.eventType===hv&&(console.error("OAuth failed: ",{event:n}),t==null||t(((i=n==null?void 0:n.data)==null?void 0:i.message)??"OAuth failed. Please try again."))}},[t,e])}function Pc({children:e,oauthUrl:t,windowTitle:n="Connect to Provider",onError:r,error:i}){const o=Ve(),{projectId:s}=De(),[c,l]=g.useState(null),[u,d]=g.useState(null),{setSelectedConnection:f}=Fn(),m=vv(l,r),p=gv(n,d,m,t),h=mv(s,o,f);return g.useEffect(()=>{t&&!u&&p()},[t,u,p,m,n]),g.useEffect(()=>{c&&h(c).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")})},[c,o,f,h,u,r]),g.useEffect(()=>{if(!u)return;const v=setInterval(()=>{u.closed&&(clearInterval(v),window.removeEventListener("message",m),d(null),!c&&!i?(console.error("OAuth failed. Please try again."),r==null||r("OAuth failed. Please try again.")):c&&(r==null||r(null)))},500);return()=>{clearInterval(v),window.removeEventListener("message",m)}},[u,c,i,m,r]),a.jsx("div",{children:e})}function yv({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return a.jsx(dt,{children:a.jsxs(T.FormControl,{children:[a.jsx(T.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(T.Heading,{as:"h4",size:"md",children:`Set up ${r} integration`})}),a.jsx(pt,{error:t}),a.jsx("br",{}),a.jsx(T.Button,{variant:"primary",isDisabled:n,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function wv({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r}){return Pe?a.jsxs(dt,{children:[a.jsx(or,{children:`Set up ${r} integration`}),a.jsx(pt,{error:t}),a.jsx(vt,{style:{marginTop:"1em",width:"100%"},disabled:n,type:"submit",onClick:e,children:"Next"})]}):a.jsx(yv,{handleSubmit:e,error:t,isButtonDisabled:n,providerName:r})}function Iv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=De(),c=Ve(),[l,u]=g.useState(null),[d,f]=g.useState(null),m=async()=>{f(null);try{const h=await jc(s,t,r,c,e,void 0,n,i);u(h)}catch(h){console.error("Could not fetch OAuth popup URL."),Ye(h),f(h.message??"Unexpected error")}},p=g.useCallback(h=>{f(h),u(null)},[]);return a.jsx(Pc,{windowTitle:`Connect to ${o}`,oauthUrl:l,onError:p,children:a.jsx(wv,{handleSubmit:m,error:d,providerName:o})})}const xv=T.createIcon({displayName:"ExternalLinkIcon",path:a.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[a.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),a.jsx("path",{d:"M15 3h6v6"}),a.jsx("path",{d:"M10 14L21 3"})]})}),Dc="https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5";function bv({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){return a.jsx(dt,{children:a.jsxs(T.FormControl,{children:[a.jsx(T.FormLabel,{children:a.jsx(T.Heading,{as:"h4",size:"md",children:"Enter your Salesforce subdomain"})}),a.jsxs(Ni,{href:Dc,newTab:!0,children:["What is my Salesforce subdomain? ",a.jsx(xv,{})]}),a.jsx(pt,{error:n}),a.jsxs("div",{style:{display:"flex",marginTop:"1em"},children:[a.jsx(T.Input,{placeholder:"my-domain",onChange:i=>t(i.currentTarget.value)}),a.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),a.jsx("br",{}),a.jsx(T.Button,{variant:"primary",isDisabled:r,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function _v({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r}){const i={handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r};return Pe?a.jsxs(dt,{children:[a.jsx(or,{children:"Enter your Salesforce subdomain"}),a.jsx(Ni,{href:Dc,newTab:!0,children:"What is my Salesforce subdomain?"}),a.jsx(pt,{error:n}),a.jsxs("div",{style:{display:"flex",marginTop:"1em"},children:[a.jsx(Bt.Input,{id:"salesforce-subdomain",type:"text",placeholder:"my-domain",onChange:o=>t(o.currentTarget.value)}),a.jsx("p",{style:{lineHeight:"2.2em",marginLeft:"0.4em"},children:".my.salesforce.com"})]}),a.jsx(vt,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]}):a.jsx(bv,{...i})}function Cv({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:i}){return a.jsx(dt,{children:a.jsxs(T.FormControl,{children:[a.jsx(T.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsxs(T.Heading,{as:"h4",size:"md",children:["Enter your ",i," workspace"]})}),a.jsx(pt,{error:n}),a.jsx(T.Flex,{marginTop:"1em",children:a.jsx(T.Input,{placeholder:"MyWorkspace",onChange:o=>t(o.currentTarget.value)})}),a.jsx("br",{}),a.jsx(T.Button,{variant:"primary",isDisabled:r,width:"100%",type:"submit",onClick:e,children:"Next"})]})})}function Sv({handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:i}){if(!Pe){const o={handleSubmit:e,setWorkspace:t,error:n,isButtonDisabled:r,providerName:i};return a.jsx(Cv,{...o})}return a.jsxs(dt,{children:[a.jsxs(or,{children:["Enter your ",i," workspace"]}),a.jsx(pt,{error:n}),a.jsx("br",{}),a.jsx(Bt.Input,{id:"workspace",type:"text",placeholder:"MyWorkspace",onChange:o=>t(o.currentTarget.value)}),a.jsx("br",{}),a.jsx(vt,{style:{marginTop:"1em",width:"100%"},disabled:r,type:"submit",onClick:e,children:"Next"})]})}const Ov="salesforce";function Ev({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,providerName:o}){const{projectId:s}=De(),c=Ve(),[l,u]=g.useState(""),[d,f]=g.useState(null),[m,p]=g.useState(null),h=async()=>{if(p(null),!l){p("Workspace is required");return}try{const C=await jc(s,t,r,c,e,l,n,i);f(C)}catch(C){console.error(C),p((C==null?void 0:C.message)??"Unexpected error")}},v=g.useCallback(C=>{p(C),f(null)},[]),I=e===Ov?a.jsx(_v,{handleSubmit:h,setWorkspace:u,error:m,isButtonDisabled:l.length===0}):a.jsx(Sv,{handleSubmit:h,setWorkspace:u,error:m,isButtonDisabled:l.length===0,providerName:o});return a.jsx(Pc,{windowTitle:`Connect to ${o}`,oauthUrl:d,onError:v,children:I})}function Nv({handleSubmit:e,error:t,explicitScopesRequired:n,isButtonDisabled:r,providerName:i}){const[o,s]=g.useState(!1),[c,l]=g.useState(""),[u,d]=g.useState(""),[f,m]=g.useState(""),p=()=>s(!o),h=x=>l(x.currentTarget.value),v=x=>d(x.currentTarget.value),I=x=>m(x.currentTarget.value),C=c.length>0,w=u.length>0,_=r||!C||!w,b=()=>{const x={clientId:u,clientSecret:c};n&&f.length>0&&(x.scopes=Vo(f)),e(x)};return a.jsx(dt,{children:a.jsxs(T.FormControl,{children:[a.jsx(T.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(T.Heading,{as:"h4",size:"md",children:`Set up ${i} integration`})}),a.jsx(pt,{error:t}),a.jsx("br",{}),a.jsxs(T.Stack,{spacing:4,children:[a.jsx(T.Input,{placeholder:"Client ID",onChange:v}),a.jsxs(T.InputGroup,{size:"md",children:[a.jsx(T.Input,{onChange:h,pr:"4.5rem",type:o?"text":"password",placeholder:"Client Secret"}),a.jsx(T.InputRightElement,{width:"4.5rem",children:a.jsx(T.Button,{h:"1.75rem",size:"sm",onClick:p,children:o?"Hide":"Show"})})]}),n&&a.jsx(T.Textarea,{placeholder:"Scopes separated by new line",onChange:I})]}),a.jsx("br",{}),a.jsx(T.Button,{variant:"primary",isDisabled:_,width:"100%",type:"submit",onClick:b,children:"Next"})]})})}function Tv({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,explicitScopesRequired:o,providerName:s,selectedConnection:c,setSelectedConnection:l}){const{projectId:u}=De(),d=Ve(),[f,m]=g.useState(null),p=async h=>{m(null);const v={groupName:i,groupRef:r,consumerName:n,consumerRef:t,provider:e,oauth2ClientCredentials:{clientId:h.clientId,clientSecret:h.clientSecret,scopes:h.scopes}};Se().connectionApi.generateConnection({projectIdOrName:u,generateConnectionParams:v},{headers:{"X-Api-Key":d??"","Content-Type":"application/json"}}).then(I=>{l(I)}).catch(I=>{console.error("Error loading provider info."),Ye(I),m("Error loading provider info")})};return c===null?a.jsx(Nv,{providerName:s,handleSubmit:p,error:f,explicitScopesRequired:o}):a.jsx(Et,{})}function Rv({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:i}){const[o,s]=g.useState(!1),[c,l]=g.useState(""),[u,d]=g.useState(""),[f,m]=g.useState(""),[p,h]=g.useState(""),v=()=>s(!o),I=V=>l(V.currentTarget.value),C=V=>d(V.currentTarget.value),w=V=>m(V.currentTarget.value),_=V=>h(V.currentTarget.value),b=c.length>0,x=u.length>0,O=f.length>0,M=n||!b||!x||!O,E=()=>{const V={workspace:f,clientId:u,clientSecret:c};i&&p.length>0&&(V.scopes=Vo(p)),e(V)};return a.jsx(dt,{children:a.jsxs(T.FormControl,{children:[a.jsx(T.FormLabel,{marginTop:"16",marginBottom:"0",children:a.jsx(T.Heading,{as:"h4",size:"md",children:`Set up ${r} integration`})}),a.jsx(pt,{error:t}),a.jsx("br",{}),a.jsxs(T.Stack,{spacing:4,children:[a.jsx(T.Input,{placeholder:"MyWorkspace",onChange:w}),a.jsx(T.Input,{placeholder:"Client ID",onChange:C}),a.jsxs(T.InputGroup,{size:"md",children:[a.jsx(T.Input,{onChange:I,pr:"4.5rem",type:o?"text":"password",placeholder:"Client Secret"}),a.jsx(T.InputRightElement,{width:"4.5rem",children:a.jsx(T.Button,{h:"1.75rem",size:"sm",onClick:v,children:o?"Hide":"Show"})})]}),i&&a.jsx(T.Textarea,{placeholder:"Scopes separated by new line",onChange:_})]}),a.jsx("br",{}),a.jsx(T.Button,{variant:"primary",isDisabled:M,width:"100%",type:"submit",onClick:E,children:"Next"})]})})}function Av({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,selectedConnection:c,setSelectedConnection:l}){const{projectId:u}=De(),d=Ve(),[f,m]=g.useState(null),p=async h=>{m(null);const v={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:h.workspace,oauth2ClientCredentials:{clientId:h.clientId,clientSecret:h.clientSecret,scopes:h.scopes}};Se().connectionApi.generateConnection({projectIdOrName:u,generateConnectionParams:v},{headers:{"X-Api-Key":d??"","Content-Type":"application/json"}}).then(I=>{l(I)}).catch(I=>{console.error("Error loading provider info."),Ye(I),m("Error loading provider info")})};return c===null?a.jsx(Rv,{providerName:t,handleSubmit:p,error:f,explicitScopesRequired:s}):a.jsx(Et,{})}function jv({handleSubmit:e,error:t,isButtonDisabled:n,providerName:r,explicitScopesRequired:i,explicitWorkspaceRequired:o}){const[s,c]=g.useState(!1),[l,u]=g.useState({clientSecret:"",clientId:"",workspace:"",scopes:""}),d=()=>c(x=>!x),f=x=>{const{name:O,value:M}=x.currentTarget;u(E=>({...E,[O]:M}))},{clientSecret:m,clientId:p,workspace:h,scopes:v}=l,I=m.length>0,C=p.length>0,w=o?h.length>0:!0,_=n||!I||!C||!w,b=()=>{const x={clientId:p,clientSecret:m};o&&(x.workspace=h),i&&v.length>0&&(x.scopes=Vo(v)),e(x)};return a.jsxs(dt,{children:[a.jsx(or,{children:`Set up ${r} integration`}),a.jsx(pt,{error:t}),a.jsx("br",{}),a.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"1.2rem"},children:[o&&a.jsx(Bt.Input,{id:"workspace",name:"workspace",type:"text",placeholder:"MyWorkspace",onChange:x=>f(x)}),a.jsx(Bt.Input,{id:"clientId",name:"clientId",type:"text",placeholder:"Client ID",onChange:x=>f(x)}),a.jsxs("div",{style:{display:"flex",gap:".5rem"},children:[a.jsx(Bt.Input,{id:"clientSecret",name:"clientSecret",type:s?"text":"password",placeholder:"Client Secret",onChange:x=>f(x)}),a.jsx(vt,{type:"button",style:{height:"2.5rem",width:"5rem"},onClick:d,children:s?"Hide":"Show"})]}),i&&a.jsx(Bt.Textarea,{name:"scopes",placeholder:"Scopes separated by new line",onChange:x=>f(x)})]}),a.jsx("br",{}),a.jsx(vt,{style:{marginTop:"1em",width:"100%"},disabled:_,type:"submit",onClick:b,children:"Next"})]})}function Pv({provider:e,providerName:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,explicitScopesRequired:s,explicitWorkspaceRequired:c,selectedConnection:l,setSelectedConnection:u}){const{projectId:d}=De(),f=Ve(),[m,p]=g.useState(null),h=async v=>{p(null);const I={groupName:o,groupRef:i,consumerName:r,consumerRef:n,provider:e,providerWorkspaceRef:v.workspace,oauth2ClientCredentials:{clientId:v.clientId,clientSecret:v.clientSecret,scopes:v.scopes}};Se().connectionApi.generateConnection({projectIdOrName:d,generateConnectionParams:I},{headers:{"X-Api-Key":f??"","Content-Type":"application/json"}}).then(C=>{u(C)}).catch(C=>{console.error("Error loading provider info."),Ye(C),p("Error loading provider info")})};return l===null?a.jsx(jv,{providerName:t,handleSubmit:h,error:m,explicitScopesRequired:s,explicitWorkspaceRequired:c}):a.jsx(Et,{})}function Dv({...e}){return Pe?a.jsx(Pv,{...e}):e.explicitWorkspaceRequired?a.jsx(Av,{...e}):a.jsx(Tv,{...e})}const kv="authorizationCode",Fv="clientCredentials";function Mv({provider:e,providerInfo:t,consumerRef:n,consumerName:r,groupRef:i,groupName:o,selectedConnection:s,setSelectedConnection:c}){if(t.oauth2Opts===void 0)return a.jsx("em",{children:"Provider is missing OAuth2 options"});const{grantType:l,explicitScopesRequired:u,explicitWorkspaceRequired:d}=t.oauth2Opts,f=Pt(e,t),m={provider:e,consumerRef:n,consumerName:r,groupRef:i,groupName:o,providerName:f};return l===kv?d?a.jsx(Ev,{...m}):a.jsx(Iv,{...m}):l===Fv?a.jsx(Dv,{...m,explicitWorkspaceRequired:d,explicitScopesRequired:u,selectedConnection:s,setSelectedConnection:c}):l==="password"?a.jsx("em",{children:"Password flow not supported yet"}):l==="PKCE"?a.jsx("em",{children:"PKCE flow not supported yet"}):a.jsxs("em",{children:["Unsupported grant type: ",l]})}function Lv(e){const{selectedConnection:t}=Fn();g.useEffect(()=>{e&&t&&e(t.id)},[e,t])}function $v({onSuccess:e}){Lv(e)}const Kv=async(e,t)=>{const n=await Se().providerApi.getProvider({provider:t},{headers:{"X-Api-Key":e??""}});if(!n)throw new Error(`Provider ${t} not found`);return n};function kc({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:o,onSuccess:s}){const c=Ve(),[l,u]=g.useState(null),{provider:d}=yt(),{selectedConnection:f,setSelectedConnection:m,connections:p}=Fn();$v({onSuccess:s});const h=e||d,v=(l==null?void 0:l.displayName)??Fs(h);if(g.useEffect(()=>{if(!f&&p&&p.length>0){const[C]=p;m(C)}Kv(c,h).then(C=>{u(C)}).catch(C=>{console.error("Error loading provider info."),Ye(C)})},[p,f,m,c,h]),!e&&!d)throw new Error("ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider");if(f)return o;if(l==null)return a.jsx("strong",{children:"Provider not found"});const I={provider:h,consumerRef:t,consumerName:n,groupRef:r,groupName:i,selectedConnection:f,setSelectedConnection:m,providerName:v,providerInfo:l};return l.authType==="none"?a.jsx(pv,{...I,children:o}):l.authType==="basic"?a.jsx(lv,{...I,children:o}):l.authType==="apiKey"?a.jsx(iv,{...I,children:o}):a.jsx(Mv,{...I})}const Vv=a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:[a.jsx("circle",{cx:"9",cy:"9",r:"9",fill:"#BBF7D0"}),a.jsx("path",{d:"M13 7L7.5 12L5 9.72727",stroke:"#16A34A",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});function Fc(e,t){return t?g.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},g.createElement("circle",{cx:"9",cy:"9",r:"5",fill:"#FBD38D"})):e?Vv:a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",children:a.jsx("circle",{cx:"9",cy:"9",r:"5",fill:"#BFDBFE"})})}const Mc=g.forwardRef(({objectName:e,completed:t,pending:n,displayName:r},i)=>{const o=T.useTab({ref:i}),s=T.useMultiStyleConfig("Tabs",o);return a.jsxs(T.Button,{__css:s.tab,...o,variant:"outline",minHeight:15,children:[a.jsxs(T.Box,{as:"span",display:"flex",alignItems:"center",gap:2,mr:"3",children:[Fc(t,n),a.jsxs(T.Box,{textAlign:"left",children:[a.jsx(T.Text,{children:r||e}),n&&a.jsx(T.Text,{fontSize:10,fontStyle:"italic",children:"pending"})]})]}),o.children]})});function Hv({pending:e,completed:t,displayName:n}){return a.jsxs(a.Fragment,{children:[a.jsx(rr,{style:{margin:"1rem 0"}}),a.jsx(Mc,{objectName:tn,completed:t,pending:e,displayName:n},"other-write")]})}function Bv(e,t=[]){let n=[];function r(o,s){const c=$.createContext(s),l=n.length;n=[...n,s];const u=f=>{var C;const{scope:m,children:p,...h}=f,v=((C=m==null?void 0:m[e])==null?void 0:C[l])||c,I=$.useMemo(()=>h,Object.values(h));return a.jsx(v.Provider,{value:I,children:p})};u.displayName=o+"Provider";function d(f,m){var v;const p=((v=m==null?void 0:m[e])==null?void 0:v[l])||c,h=$.useContext(p);if(h)return h;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return[u,d]}const i=()=>{const o=n.map(s=>$.createContext(s));return function(c){const l=(c==null?void 0:c[e])||o;return $.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return i.scopeName=e,[r,Uv(i,...t)]}function Uv(...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((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return $.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Lc(e,t=[]){let n=[];function r(o,s){const c=$.createContext(s),l=n.length;n=[...n,s];function u(f){const{scope:m,children:p,...h}=f,v=(m==null?void 0:m[e][l])||c,I=$.useMemo(()=>h,Object.values(h));return a.jsx(v.Provider,{value:I,children:p})}function d(f,m){const p=(m==null?void 0:m[e][l])||c,h=$.useContext(p);if(h)return h;if(s!==void 0)return s;throw new Error(`\`${f}\` must be used within \`${o}\``)}return u.displayName=o+"Provider",[u,d]}const i=()=>{const o=n.map(s=>$.createContext(s));return function(c){const l=(c==null?void 0:c[e])||o;return $.useMemo(()=>({[`__scope${e}`]:{...c,[e]:l}}),[c,l])}};return i.scopeName=e,[r,qv(i,...t)]}function qv(...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((c,{useScope:l,scopeName:u})=>{const f=l(o)[`__scope${u}`];return{...c,...f}},{});return $.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Wv(e){const t=e+"CollectionProvider",[n,r]=Lc(t),[i,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=p=>{const{scope:h,children:v}=p,I=g.useRef(null),C=g.useRef(new Map).current;return a.jsx(i,{scope:h,itemMap:C,collectionRef:I,children:v})};s.displayName=t;const c=e+"CollectionSlot",l=g.forwardRef((p,h)=>{const{scope:v,children:I}=p,C=o(c,v),w=Zn(h,C.collectionRef);return a.jsx($r,{ref:w,children:I})});l.displayName=c;const u=e+"CollectionItemSlot",d="data-radix-collection-item",f=g.forwardRef((p,h)=>{const{scope:v,children:I,...C}=p,w=g.useRef(null),_=Zn(h,w),b=o(u,v);return g.useEffect(()=>(b.itemMap.set(w,{ref:w,...C}),()=>void b.itemMap.delete(w))),a.jsx($r,{[d]:"",ref:_,children:I})});f.displayName=u;function m(p){const h=o(e+"CollectionConsumer",p);return g.useCallback(()=>{const I=h.collectionRef.current;if(!I)return[];const C=Array.from(I.querySelectorAll(`[${d}]`));return Array.from(h.itemMap.values()).sort((b,x)=>C.indexOf(b.ref.current)-C.indexOf(x.ref.current))},[h.collectionRef,h.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},m,r]}var zv=$.useId||(()=>{}),Jv=0;function $c(e){const[t,n]=$.useState(zv());return Lr(()=>{e||n(r=>r??String(Jv++))},[e]),e||(t?`radix-${t}`:"")}var Xv=$.createContext(void 0);function Kc(e){const t=$.useContext(Xv);return e||t||"ltr"}var xo="rovingFocusGroup.onEntryFocus",Yv={bubbles:!1,cancelable:!0},eo="RovingFocusGroup",[Ko,Vc,Gv]=Wv(eo),[Zv,Hc]=Lc(eo,[Gv]),[Qv,ey]=Zv(eo),Bc=$.forwardRef((e,t)=>a.jsx(Ko.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Ko.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(ty,{...e,ref:t})})}));Bc.displayName=eo;var ty=$.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,m=$.useRef(null),p=Zn(t,m),h=Kc(o),[v=null,I]=bi({prop:s,defaultProp:c,onChange:l}),[C,w]=$.useState(!1),_=xi(u),b=Vc(n),x=$.useRef(!1),[O,M]=$.useState(0);return $.useEffect(()=>{const E=m.current;if(E)return E.addEventListener(xo,_),()=>E.removeEventListener(xo,_)},[_]),a.jsx(Qv,{scope:n,orientation:r,dir:h,loop:i,currentTabStopId:v,onItemFocus:$.useCallback(E=>I(E),[I]),onItemShiftTab:$.useCallback(()=>w(!0),[]),onFocusableItemAdd:$.useCallback(()=>M(E=>E+1),[]),onFocusableItemRemove:$.useCallback(()=>M(E=>E-1),[]),children:a.jsx(an.div,{tabIndex:C||O===0?-1:0,"data-orientation":r,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:Ot(e.onMouseDown,()=>{x.current=!0}),onFocus:Ot(e.onFocus,E=>{const V=!x.current;if(E.target===E.currentTarget&&V&&!C){const z=new CustomEvent(xo,Yv);if(E.currentTarget.dispatchEvent(z),!z.defaultPrevented){const X=b().filter(re=>re.focusable),Z=X.find(re=>re.active),te=X.find(re=>re.id===v),ae=[Z,te,...X].filter(Boolean).map(re=>re.ref.current);Wc(ae,d)}}x.current=!1}),onBlur:Ot(e.onBlur,()=>w(!1))})})}),Uc="RovingFocusGroupItem",qc=$.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:o,...s}=e,c=$c(),l=o||c,u=ey(Uc,n),d=u.currentTabStopId===l,f=Vc(n),{onFocusableItemAdd:m,onFocusableItemRemove:p}=u;return $.useEffect(()=>{if(r)return m(),()=>p()},[r,m,p]),a.jsx(Ko.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:a.jsx(an.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:Ot(e.onMouseDown,h=>{r?u.onItemFocus(l):h.preventDefault()}),onFocus:Ot(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:Ot(e.onKeyDown,h=>{if(h.key==="Tab"&&h.shiftKey){u.onItemShiftTab();return}if(h.target!==h.currentTarget)return;const v=oy(h,u.orientation,u.dir);if(v!==void 0){if(h.metaKey||h.ctrlKey||h.altKey||h.shiftKey)return;h.preventDefault();let C=f().filter(w=>w.focusable).map(w=>w.ref.current);if(v==="last")C.reverse();else if(v==="prev"||v==="next"){v==="prev"&&C.reverse();const w=C.indexOf(h.currentTarget);C=u.loop?iy(C,w+1):C.slice(w+1)}setTimeout(()=>Wc(C))}})})})});qc.displayName=Uc;var ny={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function ry(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function oy(e,t,n){const r=ry(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ny[r]}function Wc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function iy(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var sy=Bc,ay=qc,Ti="Tabs",[cy,ky]=Bv(Ti,[Hc]),zc=Hc(),[ly,Ri]=cy(Ti),Jc=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:s="horizontal",dir:c,activationMode:l="automatic",...u}=e,d=Kc(c),[f,m]=bi({prop:r,onChange:i,defaultProp:o});return a.jsx(ly,{scope:n,baseId:$c(),value:f,onValueChange:m,orientation:s,dir:d,activationMode:l,children:a.jsx(an.div,{dir:d,"data-orientation":s,...u,ref:t})})});Jc.displayName=Ti;var Xc="TabsList",Yc=$.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,o=Ri(Xc,n),s=zc(n);return a.jsx(sy,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:r,children:a.jsx(an.div,{role:"tablist","aria-orientation":o.orientation,...i,ref:t})})});Yc.displayName=Xc;var Gc="TabsTrigger",Zc=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...o}=e,s=Ri(Gc,n),c=zc(n),l=el(s.baseId,r),u=tl(s.baseId,r),d=r===s.value;return a.jsx(ay,{asChild:!0,...c,focusable:!i,active:d,children:a.jsx(an.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...o,ref:t,onMouseDown:Ot(e.onMouseDown,f=>{!i&&f.button===0&&f.ctrlKey===!1?s.onValueChange(r):f.preventDefault()}),onKeyDown:Ot(e.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&s.onValueChange(r)}),onFocus:Ot(e.onFocus,()=>{const f=s.activationMode!=="manual";!d&&!i&&f&&s.onValueChange(r)})})})});Zc.displayName=Gc;var Qc="TabsContent",uy=$.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:o,...s}=e,c=Ri(Qc,n),l=el(c.baseId,r),u=tl(c.baseId,r),d=r===c.value,f=$.useRef(d);return $.useEffect(()=>{const m=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(_i,{present:i||d,children:({present:m})=>a.jsx(an.div,{"data-state":d?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":l,hidden:!m,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:f.current?"0s":void 0},children:m&&o})})});uy.displayName=Qc;function el(e,t){return`${e}-trigger-${t}`}function tl(e,t){return`${e}-content-${t}`}var dy=Jc,py=Yc,nl=Zc;const fy="_tabsRoot_1keq3_1",hy="_tabsList_1keq3_6",my="_tabTrigger_1keq3_12",gy="_danger_1keq3_25",Qn={tabsRoot:fy,tabsList:hy,tabTrigger:my,danger:gy};function rl({objectName:e,completed:t,pending:n,displayName:r}){return a.jsx(nl,{value:e,className:Qn.tabTrigger,children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[Fc(t,n),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[a.jsx("span",{children:r||e}),n&&a.jsx("span",{style:{fontSize:".8rem",fontStyle:"italic"},children:"pending"})]})]})})}function vy({completed:e,pending:t,displayName:n}){return a.jsxs(a.Fragment,{children:[a.jsx(rr,{style:{margin:"1rem 0"}}),a.jsx(rl,{objectName:tn,completed:e,pending:t,displayName:n},"other-write")]})}function yy(){return a.jsxs(a.Fragment,{children:[a.jsx(rr,{style:{margin:"3rem 0 1rem 0"}}),a.jsx(nl,{value:Jn,className:qt(Qn.tabTrigger,Qn.danger),children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".5rem",marginRight:".5rem"},children:[da(),a.jsx("span",{children:"Uninstall"})]})})]})}function wy({value:e,readNavObjects:t,onValueChange:n,objectConfigurationsState:r,otherNavObject:i,showUninstallButton:o}){var s,c;return a.jsx(dy,{value:e,className:Qn.tabsRoot,onValueChange:n,children:a.jsxs(py,{className:Qn.tabsList,children:[t.map(l=>{var u,d,f,m;return a.jsx(rl,{objectName:l.name,completed:l.completed,pending:((d=(u=r==null?void 0:r[l.name])==null?void 0:u.read)==null?void 0:d.isOptionalFieldsModified)||((m=(f=r==null?void 0:r[l.name])==null?void 0:f.read)==null?void 0:m.isRequiredMapFieldsModified)||!1},l.name)}),i&&a.jsx(vy,{completed:i.completed,pending:((c=(s=r==null?void 0:r.other)==null?void 0:s.write)==null?void 0:c.isWriteModified)||!1,displayName:t.length?"other":"write"}),o&&a.jsx(yy,{})]})})}function Iy(e,t){return t===Jn?{name:Jn,completed:!1}:e.find(n=>n.name===t)}const xy=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-background-secondary").trim()||"#FCFCFC";function by({children:e}){var C;const{project:t}=De(),{installation:n,provider:r}=yt(),{hydratedRevision:i}=Mn(),{objectConfigurationsState:o}=Zr(),[s,c]=g.useState(""),l=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=i&&Uo(u,i),f=d!==null,m=!!((C=i==null?void 0:i.content)!=null&&C.write),p=m?qo(u):void 0,h=g.useMemo(()=>{const w=[...d||[]];return p&&m&&w.push(p),w},[d,p,m]),v=Iy(h,s),I=g.useCallback(()=>{const w=h.find(_=>v!==_&&!_.completed);w&&c(w.name)},[h,v]);return g.useEffect(()=>{!s&&h.length>0&&c(h[0].name)},[h,s,I]),a.jsx(yi.Provider,{value:I,children:a.jsx(vi.Provider,{value:v==null?void 0:v.name,children:a.jsxs(kn,{style:{maxWidth:"55rem"},children:[a.jsxs(xn,{style:{display:"flex",gap:"1rem",padding:"3rem",backgroundColor:xy},children:[a.jsxs("div",{style:{width:"20rem"},children:[a.jsxs("h1",{children:[Pt(r)," integration"]}),a.jsx("h3",{style:{marginBottom:"20px",fontSize:"1.125rem",fontWeight:"500"},children:l}),f&&a.jsx(wy,{value:s,readNavObjects:d,onValueChange:w=>c(w),objectConfigurationsState:o,otherNavObject:p,showUninstallButton:!!n})]}),e]}),a.jsx(Oi,{})]})})})}function _y(e,t){return e!=null&&e[t]?e[t]:{name:Jn,completed:!1}}const Cy=getComputedStyle(document.documentElement).getPropertyValue("--amp-colors-background-secondary").trim()||"#FCFCFC";function Sy({children:e}){var C,w,_;const{project:t}=De(),{installation:n,provider:r}=yt(),{hydratedRevision:i}=Mn(),{objectConfigurationsState:o}=Zr(),[s,c]=g.useState(0),l=(t==null?void 0:t.appName)||"",u=n==null?void 0:n.config,d=i&&Uo(u,i),f=d!==null,m=!!((C=i==null?void 0:i.content)!=null&&C.write),p=m?qo(u):void 0,h=g.useMemo(()=>{const b=[...d||[]];return p&&m&&b.push(p),b},[d,p,m]),v=_y(h,s),I=g.useCallback(()=>{const b=h.find(x=>v!==x&&!x.completed);b&&c(h.indexOf(b))},[h,v]);return a.jsx(yi.Provider,{value:I,children:a.jsx(vi.Provider,{value:v==null?void 0:v.name,children:a.jsxs(kn,{style:{maxWidth:"55rem"},children:[a.jsxs(xn,{style:{display:"flex",gap:"1rem",padding:"3rem",backgroundColor:Cy},children:[a.jsxs("div",{style:{width:"20rem"},children:[a.jsxs(T.Text,{children:[Pt(r)," integration"]}),a.jsx(T.Text,{marginBottom:"20px",fontSize:"1.125rem",fontWeight:"500",children:l}),f&&a.jsxs(T.Tabs,{index:s,onChange:c,orientation:"horizontal",children:[d.map(b=>{var x,O,M,E;return a.jsx(Mc,{objectName:b.name,completed:b.completed,pending:((O=(x=o[b.name])==null?void 0:x.read)==null?void 0:O.isOptionalFieldsModified)||((E=(M=o[b.name])==null?void 0:M.read)==null?void 0:E.isRequiredMapFieldsModified)},b.name)}),m&&p&&a.jsx(Hv,{completed:p.completed,pending:(_=(w=o==null?void 0:o.other)==null?void 0:w.write)==null?void 0:_.isWriteModified,displayName:d!=null&&d.length?"other":"write"}),n&&a.jsxs(a.Fragment,{children:[a.jsx(rr,{style:{margin:"3rem 0 1rem 0"}}),a.jsx(yf,{text:"Uninstall"},"uninstall-installation")]})]})]}),e]}),a.jsx(Oi,{})]})})})}function Oy({...e}){return Pe?a.jsx(by,{...e}):a.jsx(Sy,{...e})}function Ey(){const[e,t]=g.useState(1);return{seed:e,reset:()=>{t(Math.random())}}}function Ny({integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:c,fieldMapping:l}){var p;const{projectId:u}=De(),{errorState:d}=on(),{seed:f,reset:m}=Ey();return(p=d[Te.INTEGRATION_LIST])!=null&&p.apiError?a.jsx(Ut,{message:"Something went wrong, couldn't find integration information"}):a.jsx(Up,{integration:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onInstallSuccess:o,onUpdateSuccess:s,onUninstallSuccess:c,fieldMapping:l,children:a.jsx(ea,{groupRef:r,children:a.jsx(kc,{consumerRef:t,consumerName:n,groupRef:r,groupName:i,children:a.jsx(wf,{projectId:u,children:a.jsx(Ug,{resetComponent:m,children:a.jsx(Fm,{children:a.jsx(Oy,{children:a.jsx(Lg,{})})})})})})})},f)}function Ty(){return a.jsxs(kn,{style:{display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:[a.jsx(Et,{}),a.jsx("p",{children:"Redirecting"})]})}function Ry({redirectURL:e,children:t}){return g.useEffect(()=>{e&&window.location.replace(e)},[e]),e?a.jsx(Ty,{}):t}function Ay({provider:e}){const{appName:t}=De(),n=`You have successfully connected your ${Pt(e)} account to ${t}.`;return a.jsx(Si,{text:n})}function jy({provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,redirectUrl:o,onSuccess:s}){return a.jsx(ea,{provider:e,groupRef:r,children:a.jsx(kc,{provider:e,consumerRef:t,consumerName:n,groupRef:r,groupName:i,onSuccess:s,children:a.jsx(Ry,{redirectURL:o,children:a.jsx(Ay,{provider:e})})})})}const Py=(e,t)=>{const n=Ve(),{projectId:r}=De(),{integrations:i}=Xs(),[o,s]=g.useState(!1),[c,l]=g.useState(null);if(!n||!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 u=g.useMemo(()=>i==null?void 0:i.reduce((d,f)=>(f==null?void 0:f.name)===e?f:d,{}),[i,e]);return g.useEffect(()=>{u&&Se().installationApi.listInstallations({projectIdOrName:r,integrationId:u.id,groupRef:t},{headers:{"x-api-key":n}}).then(d=>{s(!0),l(d.length>0)}).catch(d=>{console.error("Error listing installations."),Ye(d),s(!0)})},[t,n,r,u]),{isLoaded:o,isIntegrationInstalled:c}};exports.AmpersandContext=Gs;exports.AmpersandProvider=Vp;exports.ConnectProvider=jy;exports.FieldMapping=gc;exports.InstallIntegration=Ny;exports.useAmpersandProvider=Hp;exports.useIsIntegrationInstalled=Py;
|